diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 918f78dc206c8855fdffcc6247638c8b9a13df3d..42c7a30da38a091952fe0d500c3099ea267ed40e 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,4 +1,5 @@ Zen 5.x-1.x-dev + #196181: _phptemplate_callback doesn't look in sub-theme folder for .tpl.php files * Added SUBTHEME directory as a starter sub-theme for developers #199036 by joachim: Make padding on #squeeze conditional #199578: Fatal error on Zen Classic theme settings when using admin theme diff --git a/template-subtheme.php b/template-subtheme.php index ef4eaa648744a1c3c7845f1562694ad4f735a70c..c5f225bdf2ee25b3be49f64a617b06a5df65a5d0 100644 --- a/template-subtheme.php +++ b/template-subtheme.php @@ -53,31 +53,6 @@ function path_to_subtheme() { return $theme_path; } -/* - * These next functions allow sub-themes to have their own page.tpl.php, - * node.tpl.php, node-type.tpl.php, etc. - */ -function _phptemplate_node($vars, $suggestions) { - return _zen_default('node', $vars, $suggestions); -} - -function _phptemplate_comment($vars, $suggestions) { - return _zen_default('comment', $vars, $suggestions); -} - -function _phptemplate_page($vars, $suggestions) { - return _zen_default('page', $vars, $suggestions); -} - -function _phptemplate_block($vars, $suggestions) { - return _zen_default('block', $vars, $suggestions); -} - -function _phptemplate_box($vars, $suggestions) { - return _zen_default('box', $vars, $suggestions); -} - - /** * Allow sub-themes to have their own .tpl.php template files. * @@ -132,3 +107,28 @@ function _zen_default($hook, $variables, $suggestions = array(), $extension = '. return call_user_func('_'. $theme_engine .'_render', $file, $variables); } } + +/* + * Rather than let _phptemplate_variables() dynamically, and slowly, define + * override functions for functions we will definitely need, we define them + * explicitly here. + */ +function _phptemplate_page($vars, $suggestions) { + return _zen_default('page', $vars, $suggestions); +} + +function _phptemplate_node($vars, $suggestions) { + return _zen_default('node', $vars, $suggestions); +} + +function _phptemplate_comment($vars, $suggestions) { + return _zen_default('comment', $vars, $suggestions); +} + +function _phptemplate_block($vars, $suggestions) { + return _zen_default('block', $vars, $suggestions); +} + +function _phptemplate_box($vars, $suggestions) { + return _zen_default('box', $vars, $suggestions); +} diff --git a/template.php b/template.php index 61f260173ac6117cf6124e1cf670e1eef86f0eff..9be62ff864763b9c6812e85791b6c68e4a6dd8dd 100644 --- a/template.php +++ b/template.php @@ -321,6 +321,26 @@ function _phptemplate_variables($hook, $vars = array()) { break; } + /* To override _phptemplate_default(), we need to dynamically define a + * _phptemplate_HOOK() function. + */ + if (!function_exists("_phptemplate_$hook")) { + // Only create a function if $hook contains letters and underscores. + if (!preg_match('/\W/', $hook)) { + $declaration = <<