Ejemplo n.º 1
0
 /**
  * Method to load JA's template positions
  *
  * @return  string
  */
 protected function joomlartPostionLoad()
 {
     $positions = array();
     $hasPositions = array();
     $jat3CommonFile = JPATH_ROOT . '/plugins/system/jat3/jat3/core/common.php';
     $templateName = $this->_template->element;
     if (file_exists($jat3CommonFile)) {
         jimport($jat3CommonFile);
         $jat3_engine_layout_path = JPATH_ROOT . '/templates/' . $templateName . '/etc/layouts/default.xml';
         $layout_info = T3Common::getXML($jat3_engine_layout_path);
         if (is_file($jat3_engine_layout_path)) {
             $layout_info = T3Common::getXML($jat3_engine_layout_path);
             foreach ($layout_info['children'] as $v) {
                 if ($v['name'] == 'blocks') {
                     foreach ($v['children'] as $block) {
                         if (!$block['data']) {
                             $position = (string) $block['attributes']['name'];
                             if (!in_array($position, $hasPositions)) {
                                 $_position = new stdClass();
                                 $_position->name = $position;
                                 $_position->params = array('style' => 'none');
                                 array_push($hasPositions, $position);
                                 array_push($positions, $_position);
                             }
                         } else {
                             $_l = explode(",", $block['data']);
                             foreach ($_l as $position) {
                                 $_position = new stdClass();
                                 $_position->name = $position;
                                 $_position->params = array('style' => 'none');
                                 array_push($hasPositions, $position);
                                 array_push($positions, $_position);
                             }
                         }
                     }
                 }
             }
         }
     }
     return $positions;
 }
Ejemplo n.º 2
0
 /**
  * Get layout infomation
  *
  * @param string $layout  Layout name
  *
  * @return array  Layout info
  */
 public static function get_layout_info($layout = '')
 {
     static $layout_infos = array();
     $params = T3Common::get_template_params();
     $device = T3Common::mobile_device_detect();
     if (!$layout || !T3Common::layout_exists($layout)) {
         $layout = T3Common::get_active_layout();
     }
     if (!isset($layout_infos[$layout])) {
         $layout_infos[$layout] = null;
         $active_layout_path = T3Common::layout_exists($layout);
         $engine_layout_path = '';
         $layout_info = null;
         if (is_file($active_layout_path)) {
             $layout_info = T3Common::getXML($active_layout_path);
         }
         // Detect engine layout to extend
         // If the layout property device is set, get the default engine layout by this property
         // If not found - get the engine layout by $device
         $basepath = T3Path::path(T3_BASETHEME) . DS . 'etc' . DS . 'layouts';
         $layout_device = T3Common::node_attributes($layout_info, 'device', $device);
         $engine_layout_path = $basepath . DS . $layout_device . '.xml';
         if (!is_file($engine_layout_path)) {
             if (!$device) {
                 $engine_layout_path = $basepath . DS . 'default.xml';
             } else {
                 $engine_layout_path = $basepath . DS . $device . '.xml';
                 if (!is_file($engine_layout_path)) {
                     $engine_layout_path = $basepath . DS . 'handheld.xml';
                 }
             }
         }
         $engine_layout_path_temp = T3Common::getXML($engine_layout_path);
         if ($engine_layout_path != $active_layout_path && is_file($engine_layout_path)) {
             $layout_info = $layout_info ? T3Common::merge_info($engine_layout_path_temp, $layout_info) : T3Common::getXML($engine_layout_path);
         }
         $layout_infos[$layout] = $layout_info;
     }
     return $layout_infos[$layout];
 }
Ejemplo n.º 3
0
 function get_layout_info($layout = '')
 {
     static $layout_infos = array();
     $params = T3Common::get_template_params();
     $device = T3Common::mobile_device_detect();
     if (!$layout || !T3Common::layout_exists($layout)) {
         $layout = T3Common::get_active_layout();
     }
     if (!isset($layout_infos[$layout])) {
         $layout_infos[$layout] = null;
         $active_layout_path = T3Common::layout_exists($layout);
         $engine_layout_path = '';
         //detect engine layout to extend
         //check the layout with the same name in engine
         //if not found - check the layout base on the device
         $engine_layout_path = T3Path::path(T3_BASETHEME) . DS . 'etc' . DS . 'layouts' . DS . $layout . '.xml';
         if (!is_file($engine_layout_path)) {
             if (!$device) {
                 $engine_layout_path = T3Path::path(T3_BASETHEME) . DS . 'etc' . DS . 'layouts' . DS . 'default.xml';
             } else {
                 $engine_layout_path = T3Path::path(T3_BASETHEME) . DS . 'etc' . DS . 'layouts' . DS . $device . '.xml';
                 if (!is_file($engine_layout_path)) {
                     $engine_layout_path = T3Path::path(T3_BASETHEME) . DS . 'etc' . DS . 'layouts' . DS . 'handheld.xml';
                 }
             }
         }
         $layout_info = null;
         if (is_file($active_layout_path)) {
             $layout_info = T3Common::getXML($active_layout_path);
         }
         if ($engine_layout_path != $active_layout_path && is_file($engine_layout_path)) {
             $layout_info = $layout_info ? T3Common::merge_info(T3Common::getXML($engine_layout_path), $layout_info) : T3Common::getXML($engine_layout_path);
         }
         $layout_infos[$layout] = $layout_info;
     }
     return $layout_infos[$layout];
 }