1
|
<?php
|
2
|
/**
|
3
|
* @file
|
4
|
* Contains infrequently used theme registry build functions.
|
5
|
*/
|
6
|
|
7
|
/**
|
8
|
* Implements HOOK_theme().
|
9
|
*
|
10
|
* We are simply using this hook as a convenient time to do some related work.
|
11
|
*/
|
12
|
function _zen_theme(&$existing, $type, $theme, $path) {
|
13
|
// If we are auto-rebuilding the theme registry, warn about the feature.
|
14
|
if (
|
15
|
// Don't display on update.php or install.php.
|
16
|
!defined('MAINTENANCE_MODE')
|
17
|
// Only display for site config admins.
|
18
|
&& function_exists('user_access') && user_access('administer site configuration')
|
19
|
&& theme_get_setting('zen_rebuild_registry')
|
20
|
// Always display in the admin section, otherwise limit to three per hour.
|
21
|
&& (arg(0) == 'admin' || flood_is_allowed($GLOBALS['theme'] . '_rebuild_registry_warning', 3))
|
22
|
) {
|
23
|
flood_register_event($GLOBALS['theme'] . '_rebuild_registry_warning');
|
24
|
drupal_set_message(t('For easier theme development, the theme registry is being rebuilt on every page request. It is <em>extremely</em> important to <a href="!link">turn off this feature</a> on production websites.', array('!link' => url('admin/appearance/settings/' . $GLOBALS['theme']))), 'warning', FALSE);
|
25
|
}
|
26
|
|
27
|
// hook_theme() expects an array, so return an empty one.
|
28
|
return array();
|
29
|
}
|