data) && $cache->data) { $registry = unserialize($cache->data); } else { // We'll build it below. $registry = array(); } } // If we don't have registry or don't have an entry, build one and cache it. // This will build the registry as needed so unused functions won't be polluting it. if (empty($registry) || !isset($registry[$hook])) { global $theme; $registry[$hook] = _author_pane_build_preprocess($hook); cache_set("author_pane_registry:$theme", 'cache', serialize($registry)); } return $registry[$hook]; } /** * Helper function that does the leg work of finding preprocessor functions for a given hook. * * @param $hook * A theme hook that need preprocessing. * @return * An array of preprocessor functions. */ function _author_pane_build_preprocess($hook) { $return = array(); // Default preprocessor prefix. $prefixes['template'] = 'template'; // Add all modules so they can intervene with their own preprocessors. This allows them // to provide preprocess functions even if they are not the owner of the current hook. $prefixes += module_list(); // Some modules in d5 already have functions that look like preprocess hooks. unset($prefixes['search']); foreach ($prefixes as $prefix) { if (function_exists($prefix .'_preprocess')) { $return[] = $prefix .'_preprocess'; } if (function_exists($prefix .'_preprocess_'. $hook)) { $return[] = $prefix .'_preprocess_'. $hook; } } return $return; }