function beautytips_manager_init in BeautyTips 6.2
Same name and namespace in other branches
- 7.2 beautytips_manager.module \beautytips_manager_init()
Implementation of hook_init().
File
- ./
beautytips_manager.module, line 68
Code
function beautytips_manager_init() {
$options = array();
$tips = beautytips_manager_get_custom_tips();
if (count($tips)) {
foreach ($tips as $tip) {
// Match path if necessary
if ($tip->pages) {
$path = drupal_get_path_alias($_GET['q']);
// Compare with the internal and path alias (if any).
$page_match = drupal_match_path($path, $tip->pages);
if ($path != $_GET['q']) {
$page_match = $page_match || drupal_match_path($_GET['q'], $tip->pages);
}
// When $tip->visibility has a value of 0, the beautytip is displayed on
// all pages except those listed in $tip->pages. When set to 1, it
// is displayed only on those pages listed in $tip->pages.
$page_match = !($tip->visibility xor $page_match);
}
else {
if (!$tip->visibility) {
$page_match = TRUE;
}
else {
$page_match = FALSE;
}
}
if ($page_match) {
$options['beautytips_manager_custom_' . $tip->bid] = beautytips_manager_build_beautytip($tip);
}
}
}
if (count($options)) {
beautytips_add_beautytips($options);
}
}