Пример #1
0
 function get_template($template_id, $section)
 {
     if (intval($template_id) == 0) {
         $t = gdTemplateDB::get_templates($section, true, true);
         $template_id = $t->template_id;
         wp_gdtpl_cache_template($t);
     }
     return new gdTemplateRender($template_id, $section);
 }
Пример #2
0
 function get_template($template_id, $section)
 {
     include STARRATING_PATH . 'code/t2/templates.php';
     if (intval($template_id) == 0) {
         $t = gdTemplateDB::get_templates($section, true, true);
         $template_id = $t->template_id;
         wp_gdtpl_cache_template($t);
     }
     return new gdTemplateRender($template_id, $section);
 }
Пример #3
0
 function gdTemplateRender($id, $section)
 {
     $this->dep = $this->tag = array();
     $this->tpl = wp_gdtpl_get_template($id);
     if (!is_object($this->tpl) || $this->tpl->section != $section) {
         $t = gdTemplateDB::get_templates($section, true, true);
         $id = $t->template_id;
         $this->tpl = wp_gdtpl_get_template($id);
     }
     $dependencies = unserialize($this->tpl->dependencies);
     if (is_array($dependencies)) {
         foreach ($dependencies as $key => $value) {
             $this->dep[$key] = new gdTemplateRender($value, $key);
         }
     }
     $this->elm = unserialize($this->tpl->elements);
     if (is_array($this->elm)) {
         foreach ($this->elm as $key => $value) {
             $this->tag[$key] = array();
             $this->custom[$key] = array();
             $this->custom[$key] = wp_get_custom_tags($value);
             preg_match_all('(%.+?%)', $value, $matches, PREG_PATTERN_ORDER);
             if (is_array($matches[0])) {
                 $this->tag[$key] = $matches[0];
             }
         }
     }
 }