From bb9bae4d979bf04f9e99c2a2ea36e6961464defe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= Date: Tue, 23 Oct 2007 09:42:09 +0000 Subject: #184876 by dijnz, merlinofchaos and myself: non-phptemplate files were not discovered - implement proper extension chopping --- includes/theme.inc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'includes') diff --git a/includes/theme.inc b/includes/theme.inc index 621b9e77d..258e7673a 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -766,10 +766,12 @@ function drupal_find_theme_templates($cache, $extension, $path) { // templates separately from checking for patterns. $files = drupal_system_listing($regex, $path, 'name', 0); foreach ($files as $template => $file) { - // Chop off the extension. We do it this way because $template will - // have one extension chopped off, but there might be more than one, - // such as with .tpl.php - $template = substr($template, 0, strpos($template, '.')); + // Chop off the remaining extensions if there are any. $template already + // has the rightmost extension removed, but there might still be more, + // such as with .tpl.php, which still has .tpl in $template at this point. + if (($pos = strpos($template, '.')) !== FALSE) { + $template = substr($template, 0, $pos); + } // Transform - in filenames to _ to match function naming scheme // for the purposes of searching. $hook = strtr($template, '-', '_'); -- cgit v1.2.3