You are here

function _pathologic_escape in Pathologic 7

Same name and namespace in other branches
  1. 6.3 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 170
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, '~'));
}