Example #1
0
 protected function get_partial_templates()
 {
     $templates = array();
     $root = \ICanBoogie\DOCUMENT_ROOT;
     $models = array('default', 'all');
     foreach ($models as $model) {
         $path = self::BASE . $model . '/templates/partials';
         if (!is_dir($root . $path)) {
             continue;
         }
         $dh = opendir($root . $path);
         if (!$dh) {
             Debug::trigger('Unable to open directory %path', array('%path' => $path));
             continue;
         }
         while (($file = readdir($dh)) !== false) {
             if ($file[0] == '.') {
                 continue;
             }
             $pos = strrpos($file, '.');
             if (!$pos) {
                 continue;
             }
             $id = preg_replace('#\\.(php|html)$#', '', $file);
             $templates[$id] = $root . $path . '/' . $file;
         }
         closedir($dh);
     }
     return $templates;
 }