示例#1
0
文件: Assets.php 项目: techart/tao
 public function add_file_array($file, $options = array())
 {
     $options = (array) $options;
     $file = (string) $file;
     $exist = isset($this->files[$file]) ? $this->files[$file] : null;
     if (!empty($exist) && $exist['immutable']) {
         return $this;
     }
     if (empty($exist)) {
         $this->add($file, empty($options['weight']) ? 0 : $options['weight'], empty($options['type']) ? 'app' : $options['type'], !isset($options['join']) ? true : $options['join'], !isset($options['immutable']) ? false : $options['immutable'], isset($options['attrs']) ? $options['attrs'] : array(), isset($options['add_timestamp']) ? $options['add_timestamp'] : null, isset($options['minify']) ? $options['minify'] : false, isset($options['absolute']) ? $options['absolute'] : null, isset($options['place']) ? $options['place'] : null);
     } else {
         $exist_options = $exist->getArrayCopy();
         $exist_options = Core_Arrays::deep_merge_update($exist_options, $options);
         $this->files[$file] = new ArrayObject($exist_options);
     }
     return $this;
 }
示例#2
0
文件: AdminVars.php 项目: techart/tao
 static function options($options = array())
 {
     self::$options = Core_Arrays::deep_merge_update(self::$options, $options);
 }
示例#3
0
文件: Component.php 项目: techart/tao
 public function config($name)
 {
     if (!empty($this->cconfig[$name])) {
         return $this->cconfig[$name];
     }
     $config = array();
     $file = $this->dir() . "/{$this->config_dir}/{$name}.php";
     if (is_file($file)) {
         $config = (array) Config_DSL::Builder()->load($file)->object;
     }
     $file = $this->dir() . "/{$this->user_config_dir}/{$name}.php";
     if (is_file($file)) {
         $user_data = Config_DSL::Builder()->load($file)->object;
         $config = Core_Arrays::deep_merge_update($config, (array) $user_data);
     }
     $result = (object) $config;
     $method = "config_{$name}";
     if (method_exists($this, $method)) {
         $result = $this->{$method}($result);
     }
     return $this->cconfig[$name] = $result;
 }
示例#4
0
 public function test_deep_merge_update()
 {
     $arr1 = array("color" => array("favorite" => "red"), 5);
     $arr2 = array(10, "color" => array("favorite" => "green", "blue"));
     $this->assertEquals(Core_Arrays::deep_merge_update($arr1, $arr2), array('color' => array('favorite' => 'green', 0 => 'blue'), 0 => 10));
 }
示例#5
0
文件: MapCoords.php 项目: techart/tao
 protected function preprocess($template, $name, $data)
 {
     $t = parent::preprocess($template, $name, $data);
     $options = Core_Arrays::deep_merge_update($this->default_options, (array) $data['options']);
     $format = 'decimal';
     if (isset($data['format'])) {
         $format = $data['format'];
     }
     switch (count($this->check_schema($data))) {
         case 0:
             $values = $this->parse_field($data['__item']->{$name});
             if ($values['zoom']) {
                 $options['properties']['zoom'] = $values['zoom'];
             }
             break;
         case 1:
             $field_name = $this->schema[0];
             $values = $this->parse_field($data['__item']->{$field_name});
             if ($values['zoom']) {
                 $options['properties']['zoom'] = $values['zoom'];
             }
             break;
         case 3:
             $zoom_name = $this->schema[2];
             $zoom = $data['__item']->{$zoom_name};
             if (!is_null($zoom)) {
                 $options['properties']['zoom'] = $zoom;
             }
             break;
     }
     $use_zoom = $this->use_zoom_check($data);
     $show_zoom = $use_zoom && isset($data['show_zoom']);
     return $t->with(array('service' => $data['service'], 'options' => $options, 'format' => $format, 'use_zoom' => $use_zoom, 'show_zoom' => $show_zoom));
 }
示例#6
0
文件: Config.php 项目: techart/tao
 public static function initialize($opts = array())
 {
     self::$options['base_paths'] = array(Core::tao_config_dir(), '../app/config/', '../config/');
     self::$options = Core_Arrays::deep_merge_update(self::$options, $opts);
 }
示例#7
0
文件: Redactor.php 项目: techart/tao
 /**
  * Получение настроек редактора
  *
  * @return array
  */
 public function settings()
 {
     return Core_Arrays::deep_merge_update($this->default_settings(), $this->settings);
 }
示例#8
0
文件: HTML.php 项目: techart/tao
 protected function build_scripts_settings()
 {
     $settings = array_merge(Templates_HTML::scripts_settings(), $this->scripts_settings);
     if (!empty($settings)) {
         //FIXME: путь к файлу
         $this->use_script('/tao/scripts/tao.js', array('type' => 'lib', 'weight' => -15));
         $src = '';
         $values = array();
         foreach ($settings as $val) {
             if ($val[1]) {
                 $values = Core_Arrays::deep_merge_update($values, $val[0]);
             } else {
                 $values = array_merge_recursive($values, $val[0]);
             }
         }
         $src = 'jQuery.extend(true, TAO.settings, ' . json_encode($values) . ');';
         $this['js'] = $src . $this['js'];
     }
     return '';
 }
示例#9
0
 public static function options($config = array())
 {
     self::$options = Core_Arrays::deep_merge_update(self::$options, $config);
 }