You are here

function _pathologic_abs_to_rel in Pathologic 6.2

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

Aid in turning an absolute path on the local server to a relative one.

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 122
Pathologic text filter for Drupal.

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