예제 #1
0
 private static function _load_all_templates()
 {
     self::$_templates = array();
     if (self::db_table_exists('template')) {
         // load all templates into memory for quicker processing.
         foreach (self::get_templates() as $template) {
             // hook in here to load any custom company templates.
             if ($template['template_id'] && class_exists('module_company', false) && is_callable('module_company::template_get_company')) {
                 $custom_data = module_company::template_get_company($template['template_id'], $template);
                 if ($custom_data) {
                     $template = $custom_data;
                 }
             }
             if ($template['wysiwyg'] && stripos($template['content'], '<html')) {
                 if (preg_match('#<body>(.*)</body>#imsU', $template['content'], $matches)) {
                     $template['content'] = $matches[1];
                 }
             }
             self::$_templates[$template['template_key']] = $template;
         }
     }
 }