Пример #1
0
 /**
  * Загрузка конфигурационных данных
  *
  */
 function load_config()
 {
     $this->config->load('setting', true);
     //$this->setting = $this->config->item('setting');
     //$this->config->load('wconfig', true);
     //$this->setting = array_merge_assoc_recursive_distinct($this->config->item('setting'), $this->config->item('wconfig'));
     //$this->setting = array_merge_recursive($this->config->item('setting'), $this->config->item('wconfig'));
     $this->load->library('wconfig');
     //print_r($this->config->item('wconfig'));
     $wconfig = $this->wconfig->get('config_write', 'adverts');
     //$this->setting = $this->config->item('setting');
     $this->setting = array_merge_assoc_recursive_distinct($this->config->item('setting'), $wconfig['config']);
     //print_r($wconfig);
     //print_r($this->setting);
     $this->config->load('validation', true);
     $this->validation = $this->config->item('validation');
     //print_r($this->setting);
     //exit;
 }
Пример #2
0
 /**
  * Возвращает весь конфиг из файлов конфигурации
  *
  */
 function getConfig()
 {
     $this->load->library('wconfig');
     //print_r($this->config->item('wconfig'));
     $this->wconfig->type('array');
     //загружаем конфигурационный файл 'setting.php'
     //$setting_config = $this->wconfig->get('setting', 'duc');
     //загружаем конфигурационный файл 'resize.php'
     //$resize_config = $this->wconfig->get('resize', 'duc');
     //$this->setting = $this->config->item('setting');
     // объединчяем все конфиги в один
     //$config = array_merge_assoc_recursive_distinct($setting_config['config'], $resize_config['config']);
     //print_r($config);
     //exit;
     $this->config->load('setting', true);
     $this->config->load('resize', true);
     $config = array_merge_assoc_recursive_distinct($this->config->item('setting'), $this->config->item('resize'));
     //$config = $this->config->item('setting');
     return $config;
 }
Пример #3
0
 function array_merge_assoc_recursive_distinct()
 {
     $arrays = func_get_args();
     $base = array_shift($arrays);
     if (!is_array($base)) {
         $base = empty($base) ? array() : array($base);
     }
     foreach ($arrays as $append) {
         if (!is_array($append)) {
             $base = $append;
             //$append = array($append);
         } else {
             foreach ($append as $key => $value) {
                 if (!array_key_exists($key, $base) and !is_numeric($key)) {
                     $base[$key] = $append[$key];
                     continue;
                 }
                 if (is_array($value) or is_array($base[$key])) {
                     $base[$key] = array_merge_assoc_recursive_distinct($base[$key], $append[$key]);
                 } else {
                     if (is_numeric($key)) {
                         if (!in_array($value, $base)) {
                             //$base[] = $value;
                             $base[$key] = $value;
                         }
                     } else {
                         $base[$key] = $value;
                     }
                 }
             }
         }
     }
     return $base;
 }