Exemplo n.º 1
0
 public function load($file = 'config', $use_sections = false, $fail_gracefully = false, $_module = '')
 {
     if (in_array($file, $this->is_loaded, true)) {
         return $this->item($file);
     }
     $_module or $_module = CI::$APP->router->fetch_module();
     list($path, $file) = Modules::find($file, $_module, 'config/');
     if ($path === false) {
         parent::load($file, $use_sections, $fail_gracefully);
         return $this->item($file);
     }
     if ($config = Modules::load_file($file, $path, 'config')) {
         /* reference to the config array */
         $current_config =& $this->config;
         if ($use_sections === true) {
             if (isset($current_config[$file])) {
                 $current_config[$file] = array_merge($current_config[$file], $config);
             } else {
                 $current_config[$file] = $config;
             }
         } else {
             $current_config = array_merge($current_config, $config);
         }
         $this->is_loaded[] = $file;
         unset($config);
         return $this->item($file);
     }
 }
Exemplo n.º 2
0
 /**
  * Creates an url to the specified uri for the specified language key.
  * 
  * @param  string
  * @param  string
  * @return string
  */
 public function lang_url($lang_key, $uri = '')
 {
     //		static $router;
     //		if( ! $router)
     if (!self::$router) {
         self::$router = load_class('Router');
     }
     $lkey = self::$router->validate_lang_key($lang_key);
     if (!$lkey) {
         log_message('warning', 'Config: The language key "' . $lang_key . '" is not allowed or is not confgured.');
     }
     if (is_array($uri)) {
         $uri = implode('/', $uri);
     }
     if ($uri == '') {
         return $this->slash_item('base_url') . $this->item('index_page') . ($lkey ? '/' . $lkey : '');
     } else {
         $suffix = $this->item('url_suffix') == FALSE ? '' : $this->item('url_suffix');
         return $this->slash_item('base_url') . $this->slash_item('index_page') . ($lkey ? $lkey . '/' : '') . preg_replace("|^/*(.+?)/*\$|", "\\1", $uri) . $suffix;
     }
 }
Exemplo n.º 3
0
 public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE, $_module = NULL)
 {
     $file == '' and $file = 'config';
     if (in_array($file, $this->is_loaded, TRUE)) {
         return $this->item($file);
     }
     $_module || ($_module = MY_Loader::$APP->router->fetch_module());
     list($path, $file) = Modules::find($file, $_module, 'config/');
     if ($path === FALSE) {
         parent::load($file, $use_sections, $fail_gracefully);
         return $this->item($file);
     }
     if ($config = Modules::load_file($file, $path, 'config')) {
         /* reference to the config array */
         $current_config =& $this->config;
         if ($use_sections === TRUE) {
             if (isset($current_config[$file])) {
                 $current_config[$file] = array_merge($current_config[$file], $config);
             } else {
                 $current_config[$file] = $config;
             }
         } else {
             $current_config = array_merge($current_config, $config);
         }
         $this->is_loaded[] = $file;
         unset($config);
         return $this->item($file);
     }
 }