]> git.mjollnir.org Git - s9y.git/commitdiff
Allow to link additionel_themes to templates directory, iterating multiple subdirecto...
authorgarvinhicking <garvinhicking>
Wed, 3 Aug 2005 14:18:10 +0000 (14:18 +0000)
committergarvinhicking <garvinhicking>
Wed, 3 Aug 2005 14:18:10 +0000 (14:18 +0000)
docs/NEWS
include/functions.inc.php

index 67d83dd68a322dfc4026a109a070a53220ce244d..2b938ec92543c9b5975d380506a4069b5835a844 100644 (file)
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -3,6 +3,11 @@
 Version 0.9 ()
 ------------------------------------------------------------------------
 
+    * Make template directory allow to contain subdirectories with more
+      templates. This allows you to symbolically link the "additional_themes"
+      CVS directory within your templates path, just like you can do
+      with the "additional_plugins" directory already (garvinhicking)
+
     * Allow UTF-8 recoding using mb_* functions (Tadashi Jokagi)
 
     * Allow to switch charsets ("Native" / "UTF-8"). (garvinhicking)
index d0616721bde8c863895b6d4b5bcc9f32ff4c478f..d926ff3472abb309afbdbdae8dbaa20493e63121 100644 (file)
@@ -84,14 +84,24 @@ function serendipity_formatTime($format, $time, $useOffset = true) {
     return serendipity_mb('ucfirst', serendipity_strftime($cache[$format], (int)$time, $useOffset));
 }
 
-function serendipity_fetchTemplates() {
+function serendipity_fetchTemplates($dir = '') {
     global $serendipity;
-    $dir = opendir($serendipity['serendipityPath'] . $serendipity['templatePath']);
-    while (($file = readdir($dir)) !== false) {
-        if (is_dir($serendipity['serendipityPath'] . $serendipity['templatePath'] . $file) && !ereg('^(\.|CVS)', $file) && !file_exists($serendipity['serendipityPath'] . $serendipity['templatePath'] . $file . '/inactive.txt') && file_exists($serendipity['serendipityPath'] . $serendipity['templatePath'] . $file . '/info.txt')) {
-            $rv[] = $file;
+
+    $cdir = opendir($serendipity['serendipityPath'] . $serendipity['templatePath'] . $dir);
+    $rv  = array();
+    while (($file = readdir($cdir)) !== false) {
+        if (is_dir($serendipity['serendipityPath'] . $serendipity['templatePath'] . $dir . $file) && !ereg('^(\.|CVS)', $file) && !file_exists($serendipity['serendipityPath'] . $serendipity['templatePath'] . $dir . $file . '/inactive.txt')) {
+            if (file_exists($serendipity['serendipityPath'] . $serendipity['templatePath'] . $dir . $file . '/info.txt')) {
+                $rv[] = $dir . $file;
+            } else {
+                $temp = serendipity_fetchTemplates($dir . $file . '/');
+                if (count($temp) > 0) {
+                    $rv = array_merge($rv, $temp);
+                }
+            }
         }
     }
+    closedir($cdir);
     natcasesort($rv);
     return $rv;
 }