function _pathfilter_process_internal in Path Filter 6
Same name and namespace in other branches
- 5.2 pathfilter.module \_pathfilter_process_internal()
- 5 pathfilter.module \_pathfilter_process_internal()
- 6.2 pathfilter.module \_pathfilter_process_internal()
- 7 pathfilter.module \_pathfilter_process_internal()
1 call to _pathfilter_process_internal()
File
- ./
pathfilter.module, line 117 - 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_process_internal($format, $matches) {
$absolute = variable_get('pathfilter_link_absolute_' . $format, 1) ? TRUE : FALSE;
if (module_exists('i18n')) {
if (preg_match('/(node\\/([0-9]+))$/', $matches[3], $match)) {
// if we have a drupal node url, ensure we get the translated url alias
$languages = language_list('enabled');
$languages = $languages[1];
$language = $languages[i18n_node_get_lang($match[2])];
$link = url($match[1], array(
'language' => $language,
'query' => $matches[4],
'fragment' => $matches[5],
'absolute' => $absolute,
));
}
}
$link = $link ? $link : url($matches[3], array(
'query' => $matches[4],
'fragment' => $matches[5],
'absolute' => $absolute,
));
return $matches[1] . $link . $matches[1];
}