/** * Get instance of object * * @param array $plgParams Plugin params * * @return T3Parameter */ function &getInstance($plgParams = null) { static $_instance = null; if (!isset($_instance)) { $template = T3_ACTIVE_TEMPLATE; $template_info = T3Common::get_template_params(); //get cookie options $params_cookie = array(); $params_cookie[] = 'ui'; foreach (array_keys($template_info->toArray()) as $name) { if (preg_match('/^option_(.+)$/', $name, $matches) && $template_info->get($name)) { $params_cookie[] = $matches[1]; } } $_instance = new T3Parameter($template, $params_cookie); if ($plgParams) { foreach ($plgParams->toArray() as $key => $value) { $_instance->setParam($key, $value); } } } return $_instance; }
/** * Get active layout name * * @return string */ public static function get_active_layout() { //return T3Parameter::_getParam('layouts'); $params = T3Common::get_template_params(); $device = T3Common::mobile_device_detect(); if (!$device) { //desktop // Get from override profile $active_profile = T3Common::get_active_profile(); $default_profile = T3Common::get_default_profile(); if ($active_profile != $default_profile && $active_profile != 'default') { $file = self::getFilePath($active_profile, 'profiles'); if (is_file($file)) { $content = file_get_contents($file); // $params = new JParameter($content); // Strict standards: Declaration of JParameter::loadSetupFile() should be compatible with that of JRegistry::loadSetupFile() $params = $content; if (!$content instanceof JRegistry) { $params = new JRegistry($content); } $layout = $params->get('desktop_layout', ''); if (T3Common::layout_exists($layout)) { return $layout; } } } // Cannot get from override profile for this page, get from usersetting $layout = T3Parameter::_getParam('layouts', ''); if (T3Common::layout_exists($layout)) { return $layout; } // Get default $layout = $params->get('desktop_layout', ''); if (!T3Common::layout_exists($layout)) { $params = T3Common::get_template_params(); $layout = $params->get('desktop_layout', ''); if (!T3Common::layout_exists($layout)) { $layout = 'default'; } } } else { $layout = $params->get($device . '_layout', ''); if (!$layout) { $layout = $params->get('handheld_layout', ''); } if ($layout == -1) { //disable => use layout from desktop $device = ''; $layout = $params->get('desktop_layout', ''); if (!T3Common::layout_exists($layout)) { $layout = 'default'; } } elseif ($layout == 1) { //default => use layout from t3 engine $layout = $device; if (!T3Common::layout_exists($layout)) { $layout = 'handheld'; } } elseif (!T3Common::layout_exists($layout)) { $layout = 'handheld'; } } return $layout; }
function get_active_layout() { //return T3Parameter::_getParam('layouts'); $params = T3Common::get_template_params(); $device = T3Common::mobile_device_detect(); if (!$device) { //desktop //get from override profile $active_profile = T3Common::get_active_profile(); $default_profile = T3Common::get_default_profile(); if ($active_profile != $default_profile && $active_profile != 'default') { $path = 'etc' . DS . 'profiles' . DS . $active_profile . '.ini'; $file = T3Path::path(T3_TEMPLATE_LOCAL) . DS . $path; if (!is_file($file)) { $file = T3Path::path(T3_TEMPLATE_CORE) . DS . $path; } if (is_file($file)) { $content = file_get_contents($file); $params = new JParameter($content); $layout = $params->get('desktop_layout', ''); if (T3Common::layout_exists($layout)) { return $layout; } } } //cannot get from override profile for this page, get from usersetting $layout = T3Parameter::get('layouts', ''); if (T3Common::layout_exists($layout)) { return $layout; } //get default $layout = $params->get('desktop_layout', ''); if (!T3Common::layout_exists($layout)) { $layout = 'default'; } } else { $layout = $params->get($device . '_layout', ''); if (!$layout) { $layout = $params->get('handheld_layout', ''); } if ($layout == -1) { //disable => use layout from desktop $device = ''; $layout = $params->get('desktop_layout', ''); if (!T3Common::layout_exists($layout)) { $layout = 'default'; } } else { if ($layout == 1) { //default => use layout from t3 engine $layout = $device; if (!T3Common::layout_exists($layout)) { $layout = 'handheld'; } } else { if (!T3Common::layout_exists($layout)) { $layout = 'handheld'; } } } } return $layout; }