MailTemplateList.php
authorEdward <edward@roojs.com>
Wed, 19 Feb 2014 07:54:24 +0000 (15:54 +0800)
committerEdward <edward@roojs.com>
Wed, 19 Feb 2014 07:54:24 +0000 (15:54 +0800)
MailTemplateList.php

index eb30358..6c8af16 100644 (file)
@@ -20,25 +20,31 @@ class Pman_Core_MailTemplateList extends Pman
         
         $templateDir = explode(PATH_SEPARATOR, $fopts['templateDir']);
         
+        $ret = array();
+        
         foreach ($templateDir as $dir){
-            echo "$dir <br/>";
+            
             if(!file_exists($dir . '/mail')){
                 continue;
             }
             
             if ($handle = opendir($dir . '/mail')) {
                 while (false !== ($entry = readdir($handle))) {
-                    if ($entry == "." || $entry == "..") {
+                    if ($entry == "." || $entry == ".." || !preg_match('/\.html$/', $entry)) {
                         continue;
                     }
                     
-                    echo "$entry <br/>";
+                    $ret[] = array(
+                        'file' => $entry,
+                        'content' => file_get_contents("$dir/mail/$entry")
+                    );
                 }
                 
                 closedir($handle);
             }
             
         }
+        print_r($ret);exit;
         exit;
         $this->jdata(array(array('name' => 'aa', 'body'=> 'test')));