You are here

function _pathologic_escape in Pathologic 6.3

Same name and namespace in other branches
  1. 7 pathologic.module \_pathologic_escape()

Escape paths to convert. preg_replace_callback() callback.

1 string reference to '_pathologic_escape'
_pathologic in ./pathologic.module
Pathologic filter callback.

File

./pathologic.module, line 153
Pathologic text filter for Drupal.

Code

function _pathologic_escape($path) {

  // Quote special characters, but "convert" asterisks.
  // Apparently the special characters in the preg_replace below need to be
  // double-escaped…?
  return preg_replace(array(
    '/(?<!\\\\)\\\\\\*/',
    '/^https?/',
  ), array(
    '[^/]*',
    'https?',
  ), preg_quote($path, '~'));
}