Exemple #1
0
 public function index($setting)
 {
     if (isset($setting['depth'])) {
         self::$_depth = $setting['depth'];
     } else {
         self::$_depth = 0;
     }
     if (self::$_depth > self::$_depth_limit) {
         return;
     }
     $this->data['message'] = $message = '';
     if ($block = $this->config->get('html_block_' . $setting['html_block_id'])) {
         if (!isset($block['store']) || !in_array($this->config->get('config_store_id'), $block['store'])) {
             return;
         }
         if (isset($block['style']) && !empty($block['css'])) {
             $file_name = DIR_APPLICATION . 'view/theme/' . $this->config->get('config_template') . '/stylesheet/html_block.css';
             if (!array_key_exists(md5($file_name), $this->document->getStyles())) {
                 $this->document->addStyle($file_name);
             }
         }
         if (!isset($block['use_cache']) || !($message = $this->cache->get('html_block.content.' . (int) $this->config->get('config_language_id') . '.' . $setting['html_block_id']))) {
             $message = $this->_render($block);
             if (isset($block['use_cache'])) {
                 $this->cache->set('html_block.content.' . (int) $this->config->get('config_language_id') . '.' . $setting['html_block_id'], $message);
             }
         }
         $this->data['message'] = $message;
     }
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/html_block.tpl')) {
         $this->template = $this->config->get('config_template') . '/template/module/html_block.tpl';
     } else {
         $this->template = 'default/template/module/html_block.tpl';
     }
     $this->render();
 }
Exemple #2
0
 public function getReplace()
 {
     if (is_numeric($this->_key)) {
         $depth = ControllerModuleHtmlBlock::getDepth();
         $args = array('html_block_id' => (int) $this->_key, 'depth' => $depth + 1);
         $action = new Action('module/html_block', $args);
         $file = $action->getFile();
         $class = $action->getClass();
         if (file_exists($file)) {
             require_once $file;
             $controller = new $class(app::registry()->get());
             $controller->index($args);
             $this->_replace = $controller->getOutput();
         }
     }
     return $this->_replace;
 }