You are here

function _pathologic_url in Pathologic 6

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

Run the parts through url() if they look like they link to a local Drupal path. Otherwise, it's a link to a file or something -- try to return it in one piece.

4 calls to _pathologic_url()
pathologic_filter in ./pathologic.module
Implementation of hook_filter().
_pathologic_abs_regex in ./pathologic.module
Return the hard part of the regular expression to be used when making paths relative. $attr will probably be either 'href' or 'src'.
_pathologic_do_href in ./pathologic.module
Properly formats an HREF element. Here's where the magic happens… preg_replace_callback() callback function.
_pathologic_do_src in ./pathologic.module
Return a formatted SRC attribute.

File

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

Code

function _pathologic_url($path, $fragment = NULL) {

  // Does this look like an internal URL?
  if ($path !== '<front>' && !menu_get_item($path) && !drupal_lookup_path('source', $path)) {

    // It's not.
    global $base_url;
    $return = $base_url . '/' . $path;
    if ($fragment !== NULL && $fragment !== '') {
      $return .= '#' . $fragment;
    }
    return $return;
  }
  return url($path, array(
    'fragment' => $fragment,
    'absolute' => TRUE,
  ));
}