function themekey_match_path in ThemeKey 6.2
Same name and namespace in other branches
- 6.4 themekey_base.inc \themekey_match_path()
- 6.3 themekey_base.inc \themekey_match_path()
- 7.3 themekey_base.inc \themekey_match_path()
- 7 themekey_base.inc \themekey_match_path()
- 7.2 themekey_base.inc \themekey_match_path()
Detects if a ThemeKey rule for property drupal:path matches to the current page request.
Parameters
$condition: ThemeKey rule as associative array:
- property (must be "drupal:path")
- operator
- value
$parameters: reference to an array containing all ThemeKey properties an their values
Return value
boolean
1 call to themekey_match_path()
- themekey_match_condition in ./
themekey_base.inc - Detects if a ThemeKey rule matches to the current page request.
File
- ./
themekey_base.inc, line 58 - The functions in this file are the back end of ThemeKey.
Code
function themekey_match_path($condition, &$parameters) {
static $alias_uri = '';
if ('drupal:path' != $condition['property']) {
return FALSE;
}
if (!variable_get('themekey_path_case_sensitive', 0)) {
$condition['value'] = strtolower($condition['value']);
}
$condition_parts = explode('/', $condition['value']);
$get_q = themekey_get_q();
$get_q_parts = explode('/', $get_q);
$wildcards = themekey_match_path_parts($get_q_parts, $condition_parts);
if (FALSE === $wildcards && module_exists('path')) {
if (empty($alias_uri)) {
// Derive path from request_uri
$offset = (variable_get('clean_url', 0) ? 0 : 3) + strlen(base_path());
$alias_uri = substr(request_uri(), $offset);
if (strpos($alias_uri, '?') !== FALSE) {
// Remove query string from request uri
$alias_uri_parts = explode('?', $alias_uri);
$alias_uri = $alias_uri_parts[0];
}
// For $alias_uri != $_GET['q'] the page was requested using an
// aliased path, otherwise get the path alias internally
if ($alias_uri == $get_q) {
$alias_uri = drupal_get_path_alias($get_q);
}
}
if ($alias_uri != $get_q) {
$alias_parts = explode('/', $alias_uri);
$wildcards = themekey_match_path_parts($alias_parts, $condition_parts);
}
}
if (is_array($wildcards)) {
$parameters['internal:temp_wildcards'] = $wildcards;
return TRUE;
}
$parameters['internal:temp_wildcards'] = array();
return FALSE;
}