From a649cfffc01d708570a2326856a5e74f929aecd7 Mon Sep 17 00:00:00 2001 From: shish Date: Tue, 8 Apr 2008 15:35:08 +0000 Subject: [PATCH] regex rather than two str_replaces, works better for some people git-svn-id: file:///home/shish/svn/shimmie2/trunk@776 7f39781d-f577-437e-ae19-be835c7a54ca --- index.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/index.php b/index.php index 06c737fa..33d99a98 100644 --- a/index.php +++ b/index.php @@ -55,10 +55,11 @@ foreach($themelets as $filename) { $custom_themelets = glob("themes/$_theme/*.theme.php"); if($custom_themelets) { + $m = array(); foreach($custom_themelets as $filename) { - $basename = str_replace($filename, "themes/$_theme/", ""); - $basename = str_replace($basename, ".theme.php", ""); - if(array_contains($themelets, "ext/$basename/theme.php")) { + if(preg_match("/themes\/$_theme\/(.*)\.theme\.php/",$filename,$m) + && array_contains($themelets, "ext/{$m[1]}/theme.php")) + { require_once $filename; } }