From: Edward Date: Wed, 19 Feb 2014 07:54:24 +0000 (+0800) Subject: MailTemplateList.php X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=commitdiff_plain;h=1cd79c294e7fc89a966b9dc1bb082f5729b643e2 MailTemplateList.php --- diff --git a/MailTemplateList.php b/MailTemplateList.php index eb30358b..6c8af160 100644 --- a/MailTemplateList.php +++ b/MailTemplateList.php @@ -20,25 +20,31 @@ class Pman_Core_MailTemplateList extends Pman $templateDir = explode(PATH_SEPARATOR, $fopts['templateDir']); + $ret = array(); + foreach ($templateDir as $dir){ - echo "$dir
"; + 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
"; + $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')));