function headerimage_eval_url in Header image 7
Same name and namespace in other branches
- 5 headerimage.module \headerimage_eval_url()
- 6 headerimage.module \headerimage_eval_url()
Evaluate url condition
Check if current page is in selected paths
Parameters
$condition: text with paths or '<frontpage>'. May contain wild cards.
Return value
true: current page matches one of the $condition paths; false: if not
1 call to headerimage_eval_url()
- headerimage_select_node in ./
headerimage.module - Select a node to be displayed in the block
File
- ./
headerimage.module, line 346 - headerimage.module Conditionally display an node in a block.
Code
function headerimage_eval_url($condition) {
$match = NULL;
$path = drupal_get_path_alias($_GET['q']);
$regexp = '/^(' . preg_replace(array(
'/(\\r\\n?|\\n)/',
'/\\\\\\*/',
'/(^|\\|)\\\\<front\\\\>($|\\|)/',
), array(
'|',
'.*',
'\\1' . preg_quote(variable_get('site_frontpage', 'node'), '/') . '\\2',
), preg_quote($condition, '/')) . ')$/';
// Compare with the internal and path alias (if any).
$match = preg_match($regexp, $path);
if ($match) {
return true;
}
if ($path != $_GET['q']) {
$match = preg_match($regexp, $_GET['q']);
}
return $match;
}