You are here

function _pathologic_abs_to_rel in Pathologic 6

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

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. preg_replace_callback() callback function.

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

File

./pathologic.module, line 115
The main and only module file.

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 . '"';
}