function _adsense_page_match in Google AdSense integration 6
Same name and namespace in other branches
- 5.3 adsense.module \_adsense_page_match()
- 5 adsense.module \_adsense_page_match()
- 5.2 adsense.module \_adsense_page_match()
- 7 adsense.module \_adsense_page_match()
Determine if AdSense has permission to be used on the current page.
Return value
bool TRUE if can render, FALSE if not allowed.
5 calls to _adsense_page_match()
- adsense_cse_block in cse/
adsense_cse.module - Implementation of hook_block().
- adsense_display in ./
adsense.module - Generates the Google AdSense Ad.
- adsense_managed_block in managed/
adsense_managed.module - Implementation of hook_block().
- adsense_oldcode_block in old/
oldcode/ adsense_oldcode.module - Implementation of hook_block().
- adsense_search_block in old/
search/ adsense_search.module - Implementation of hook_block().
File
- ./
adsense.module, line 597 - Displays Google AdSense ads on Drupal pages.
Code
function _adsense_page_match() {
$pages = variable_get('adsense_access_pages', ADSENSE_ACCESS_PAGES_DEFAULT);
$visibility = variable_get('adsense_visibility', ADSENSE_VISIBILITY_DEFAULT);
if ($pages) {
if ($visibility == 2) {
return drupal_eval($pages);
}
$path = drupal_get_path_alias($_GET['q']);
$page_match = drupal_match_path($path, $pages);
if ($path != $_GET['q']) {
$page_match = $page_match || drupal_match_path($_GET['q'], $pages);
}
return !($visibility xor $page_match);
}
else {
return !$visibility;
}
}