You are here

function _pathologic_abs_to_rel in Pathologic 5

Same name and namespace in other branches
  1. 6 pathologic.module \_pathologic_abs_to_rel()
  2. 6.2 pathologic.module \_pathologic_abs_to_rel()

preg_replace_callback() callback function. Aids in turning an absolute path to a page on the local server to a relative path so that Pathologic can act on it further.

1 string reference to '_pathologic_abs_to_rel'
pathologic_filter in ./pathologic.module
Implementation of hook_filter().

File

./pathologic.module, line 111

Code

function _pathologic_abs_to_rel($matches) {

  // The attribute will be the first match (after 0), and the path will be the
  // last.
  $path = array_pop($matches);
  if ($path === '') {

    // It looks like this was meant to be a link to the front page.
    return $matches[1] . '="<front>"';
  }
  return $matches[1] . '="' . $path . '"';
}