function ape_check_path in Advanced Page Expiration 7
Checks saved paths against the current request path.
Parameters
string $haystack: The list of paths to compare.
string $path: The path to check against.
Return value
bool Whether the path was found within the haystack.
2 calls to ape_check_path()
- ape_check_cacheable in ./
ape.module - Check if global page caching is enabled and the user is anonymous.
- ape_page_delivery_callback_alter in ./
ape.module - Implements hook_page_delivery_callback_alter().
File
- ./
ape.module, line 227 - Allows finer control of the Cache Control header.
Code
function ape_check_path($haystack, $path = NULL) {
if (!$path) {
$path = $_GET['q'];
}
// This is pretty much lifted from the block module.
// Convert path to lowercase. This allows comparison of the same path
// with different case. Ex: /Page, /page, /PAGE.
$pages = drupal_strtolower($haystack);
// Convert the Drupal path to lowercase.
$path = drupal_strtolower(drupal_get_path_alias($path));
// Compare the lowercase internal and lowercase path alias (if any).
$page_match = drupal_match_path($path, $pages);
if ($path != $_GET['q']) {
$page_match = $page_match || drupal_match_path($path, $pages);
}
return $page_match;
}