function _pathologic_url in Pathologic 5
Same name and namespace in other branches
- 6 pathologic.module \_pathologic_url()
- 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.
Okay, here's where the major changes are in the D5 version. menu_get_item() has different parameters, and returns an empty array on failure.
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 - preg_replace_callback() callback function. Properly formats an HREF element. Here's where the magic happens…
- _pathologic_do_src in ./
pathologic.module - preg_replace_callback() callback function. Okay. If we have a local SRC attribute, there are two possibilities.
File
- ./
pathologic.module, line 163
Code
function _pathologic_url($path, $fragment = NULL) {
// Does this look like an internal URL?
if ($path !== '<front>' && count(menu_get_item(NULL, $path)) === 0 && drupal_get_path_alias($path) === $path) {
// It's not.
global $base_url;
$return = $base_url . '/' . $path;
if ($fragment !== NULL) {
$return .= '#' . $fragment;
}
return $return;
}
return url($path, NULL, $fragment === '' ? NULL : $fragment, TRUE);
}