function _pathfilter_base_url_re in Path Filter 7
Same name and namespace in other branches
- 5.2 pathfilter.module \_pathfilter_base_url_re()
- 6.2 pathfilter.module \_pathfilter_base_url_re()
Generates the regular expression that will be used to find a url that should have 'internal:'.
1 call to _pathfilter_base_url_re()
- _pathfilter_internalize in ./
pathfilter.module - Internalizes all urls in a string automatically, doing the user's job for them.
File
- ./
pathfilter.module, line 240 - This filter takes internal Drupal paths in double quotes, written as e.g. "internal:node/99", and replaces them with the appropriate absolute http URL using Drupal's url() function [1]. E.g. for a site located at http://example.com/mysite
Code
function _pathfilter_base_url_re() {
static $base_url_re;
if ($base_url_re != '') {
return $base_url_re;
}
global $base_url;
$base_path = base_path();
if ($base_path != '/') {
$tmp_base_url = str_replace($base_path, '', $base_url . '/');
}
else {
$tmp_base_url = $base_url;
}
$base_url_re = array(
0 => '/^(' . preg_quote($tmp_base_url, '/') . ')?' . preg_quote($base_path, '/') . '/',
1 => '/^(' . preg_quote($tmp_base_url, '/') . ')?' . preg_quote(drupal_encode_path($base_path), '/') . '/',
);
return $base_url_re;
}