Exemple #1
0
 function get_template_params()
 {
     static $params = null;
     if (!isset($params)) {
         $key = T3Cache::getProfileKey();
         $data = T3Cache::get_file($key);
         if ($data) {
             $params = new JParameter($data);
             return $params;
         }
         $profile = T3Common::get_active_profile();
         //Load global params
         $content = '';
         $file = T3Path::path(T3_TEMPLATE) . DS . 'params.ini';
         if (is_file($file)) {
             $content = file_get_contents($file);
         }
         //Load default profile setting
         $path = 'etc' . DS . 'profiles' . DS . 'default.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 .= "\n" . file_get_contents($file);
         }
         //Load all-pages profile setting
         $default_profile = T3Common::get_default_profile();
         if ($default_profile != 'default') {
             $path = 'etc' . DS . 'profiles' . DS . $default_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 .= "\n" . file_get_contents($file);
             }
         }
         //Load override profile setting
         if ($profile != $default_profile && $profile != 'default') {
             $path = 'etc' . DS . 'profiles' . DS . $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 .= "\n" . file_get_contents($file);
             }
         }
         $params = new JParameter($content);
         T3Cache::store_file($params->toString(), $key);
     }
     return $params;
 }