当前位置: 首页>>代码示例>>PHP>>正文


PHP Arr::overwrite方法代码示例

本文整理汇总了PHP中Arr::overwrite方法的典型用法代码示例。如果您正苦于以下问题:PHP Arr::overwrite方法的具体用法?PHP Arr::overwrite怎么用?PHP Arr::overwrite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Arr的用法示例。


在下文中一共展示了Arr::overwrite方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Header favicon tag constructor
  * @param string|array $name Examples: 'keywords', 'description', 'copyright', or an associative array ('name' => 'keywords', 'content' => 'example keyword list')
  * @param string $content
  * @throws Kohana_Exception
  */
 public function __construct($href)
 {
     if (!is_array($href)) {
         $this->attributes['href'] = (string) $href;
     } else {
         $this->attributes = Arr::overwrite($this->attributes, $href);
     }
 }
开发者ID:roomcays,项目名称:kohana-html-header,代码行数:14,代码来源:favicon.php

示例2: __construct

 public function __construct($config = NULL)
 {
     include_once Kohana::find_file('vendor', 'recaptcha/recaptchalib');
     $this->_config = Kohana::$config->load('recaptcha');
     if (is_array($config)) {
         $this->_config = Arr::overwrite($this->_config, $config);
     }
     return $this;
 }
开发者ID:rpa-design,项目名称:kohana-recaptcha,代码行数:9,代码来源:recaptcha.php

示例3: __construct

 /**
  * Create a new field
  * @param string $name
  * @param string $id
  * @param string $label
  * @param array $config
  * @param array $attributes
  * @param array $extra
  */
 public function __construct($name, $id, $label, array $config = NULL, array $attributes = NULL, array $extra = NULL)
 {
     $this->_attributes = $this->_attributes + (array) $attributes;
     $this->_config = Arr::overwrite($this->_config, (array) $config);
     $this->_extra = (array) $extra;
     $this->_name = $name;
     $this->_label = $label;
     $this->_id = $id;
 }
开发者ID:Zahymaka,项目名称:ZForm,代码行数:18,代码来源:field.php

示例4: subir

 /**
  * Sube el comentario
  *
  * @param array $datos Los datos recibitos por POST
  * @return int  Retorna el ID del envio si hubo exito, sino retorna 0 o FALSE
  */
 public function subir(array $datos)
 {
     $exito = FALSE;
     // Hace la validacion
     if ($this->values($datos)->check()) {
         // Los datos han sido validados y los guardamos
         $this->save();
         $exito = $this->id;
     }
     // Llenamos los vectores con los valores que seran mostrados en los campos
     $this->errores = Arr::overwrite($this->errores, $this->validate()->errors(""));
     $this->formulario = Arr::overwrite($this->formulario, $datos);
     return $exito;
 }
开发者ID:reneegonam,项目名称:CoCo,代码行数:20,代码来源:comentario.php

示例5: action_editar

 /**
  * Vista de registro de nuevas informaciones
  */
 public function action_editar($id)
 {
     Model_Usuario::otorgar_acceso($this->request);
     $this->set_titulo("Editar evío");
     $envio = ORM::factory("envio", $id);
     if ($_POST) {
         if ($this->editar_info($id)) {
             $this->request->redirect("noticia/ver/" . $id);
         }
     } else {
         $this->formulario_subir_info = Arr::overwrite($this->formulario_subir_info, $envio->as_array());
     }
     $vista = View::factory("envio/subir")->set("usuario_id", $envio->usuario->id)->set("cat", NULL)->set("errores", $this->errores_subir_info)->set("formulario", $this->formulario_subir_info);
     $this->contenido = $vista;
 }
开发者ID:reneegonam,项目名称:CoCo,代码行数:18,代码来源:envio.php

示例6: validar_const_resid

 /**
  * Valida los datos ingresados para la solicitud de Constancia de Residencia
  */
 private function validar_const_resid()
 {
     $persona = ORM::factory("persona");
     $datos = Validate::factory($_POST)->filter("cedula_solic", "trim")->rule("cedula_solic", "digit")->rule("cedula_solic", "not_empty")->callback("cedula_solic", array($persona, "existe"))->filter("testigo_a", "trim")->rule("testigo_a", "digit")->rule("testigo_a", "not_empty")->callback("testigo_a", array($persona, "existe"))->filter("testigo_b", "trim")->rule("testigo_b", "digit")->rule("testigo_b", "not_empty")->callback("testigo_b", array($persona, "existe"))->rule("destinatario", "not_empty");
     if ($datos->check()) {
         $solic = ORM::factory("persona")->where("cedula", "=", $_POST['cedula_solic'])->find();
         $testigo_a = ORM::factory("persona")->where("cedula", "=", $_POST['testigo_a'])->find();
         $testigo_b = ORM::factory("persona")->where("cedula", "=", $_POST['testigo_b'])->find();
         // Los datos son validos y se puede otorgar la constancia
         $this->request->redirect("pdf/constancia_residencia/" . "?s=" . $solic->id . "&a=" . $testigo_a->id . "&b=" . $testigo_b->id . "&dest=" . $datos['destinatario']);
     }
     // Si llega aqui es porque hubo un error
     // Llenamos los vectores con los valores que seran mostrados en los campos
     $this->err_const_resid = $datos->errors("persona");
     $this->form_const_resid = Arr::overwrite($this->form_const_resid, $_POST);
 }
开发者ID:reneegonam,项目名称:CoCo,代码行数:19,代码来源:solicitud.php

示例7: _set_active_pos

 private function _set_active_pos()
 {
     $this->_fields_required = Arr::overwrite($this->_fields_required, $this->_pos_data);
 }
开发者ID:bluetechy,项目名称:kohana-payment,代码行数:4,代码来源:platnoscipl.php

示例8: test_overwrite

 /**
  *
  * @test
  * @dataProvider provider_overwrite
  */
 public function test_overwrite($expected, $arr1, $arr2, $arr3 = array(), $arr4 = array())
 {
     $this->assertSame($expected, Arr::overwrite($arr1, $arr2, $arr3, $arr4));
 }
开发者ID:sittercity,项目名称:core,代码行数:9,代码来源:ArrTest.php

示例9: data

 /**
  * Getter/setter for the data. Stores only expected array keys.
  *
  * @return array
  */
 public function data(array $data = NULL)
 {
     if ($data !== NULL) {
         // Only take keys that we actually expect.
         $this->_data = Arr::overwrite(array_fill_keys(array_keys($this->_fields), NULL), $data);
     }
     return $this->_data;
 }
开发者ID:drarok,项目名称:konform,代码行数:13,代码来源:Konform.php

示例10: factory

 /**
  * Instantiate a new menu
  *
  * @param string $config_file File name in config/menu/
  * @throws Kohana_Exception
  * @return Menu
  * @since 2.0
  */
 public static function factory($config_file = 'bootstrap', $config = array())
 {
     // Get already created instance
     if (array_key_exists($config_file, self::$_instances)) {
         return self::$_instances[$config_file];
     }
     // Load menu config
     $menu_config = self::_get_menu_config($config_file);
     // Add custom options
     $menu_config = Arr::overwrite($menu_config, $config);
     // Auto-detect view path when no view file given
     if (Arr::get($menu_config, 'view') === NULL) {
         $view_file = Kohana::find_file('views/' . self::VIEWS_DIR, $config_file) ? $config_file : self::DEFAULT_VIEW;
         $menu_config['view'] = self::VIEWS_DIR . DIRECTORY_SEPARATOR . $view_file;
     }
     return self::$_instances[$config_file] = new Menu($menu_config);
 }
开发者ID:vedmant,项目名称:kohana-menu,代码行数:25,代码来源:Menu.php

示例11: action_database

 public function action_database()
 {
     $action = Route::get('install')->uri(array('action' => 'database'));
     $view = View::factory('install/database')->bind('form', $form)->set('action', $action);
     $this->template->content = $view;
     $this->template->title = __('Database Configuration');
     $this->template->_activity = __('60');
     $this->template->menu = array(HTML::anchor(Route::get('install')->uri(), __('Welcome')), HTML::anchor(Route::get('install')->uri(array('action' => 'systemcheck')), __('System Check')), HTML::anchor(Route::get('install')->uri(array('action' => 'database')), __('Database')), __('Install'), __('Finish'));
     $form = array('user' => '', 'pass' => '', 'hostname' => 'localhost', 'database' => 'gleezcms', 'table_prefix' => 'gl_');
     if (isset($_POST['db'])) {
         $data = array('user' => $username = $_POST['user'], 'pass' => $password = $_POST['pass'], 'hostname' => $hostname = $_POST['hostname'], 'database' => $database = $_POST['database'], 'table_prefix' => $table_prefix = $_POST['table_prefix']);
         try {
             $this->check_database($username, $password, $hostname, $database);
             $this->_session->set('database_data', $data);
             $this->request->redirect(Route::get('install')->uri(array('action' => 'install')));
         } catch (Exception $e) {
             $form = Arr::overwrite($form, $_POST);
             $error = $e->getMessage();
             // TODO create better error messages
             // Try to use mysql_errno.
             // Error message of East Asian character sets will display garbled text on utf-8 web page
             switch ($error) {
                 case 'access':
                     $this->template->error = __('Wrong username or password');
                     break;
                 case 'unknown_host':
                     $this->template->error = __('Could not find the host');
                     break;
                 case 'connect_to_host':
                     $this->template->error = __('Could not connect to host');
                     break;
                 case 'select':
                     $this->template->error = __('Could not select the database');
                     break;
                 case 'version':
                     $this->template->error = __('Gleez requires at least MySQL version 5.0.0. You\'re using version :version', array(':version' => $this->mysql_version(1)));
                     break;
                 default:
                     $this->template->error = $error;
             }
         }
     }
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:43,代码来源:install.php

示例12: _z_create_fields

 /**
  * Create fields automatically
  */
 protected function _z_create_fields()
 {
     foreach ($this->_belongs_to as $column => $data) {
         // Field has already been set in
         if (isset($this->_z_fields[$data['foreign_key']]) or in_array($data['foreign_key'], $this->_z_exclude)) {
             continue;
         }
         // Assign label
         if (!isset($this->_z_labels[$data['foreign_key']])) {
             $this->_z_labels[$data['foreign_key']] = ucfirst(Inflector::humanize($column));
         }
         // Field type is set
         if (isset($this->_z_field_config[$data['foreign_key']]['type'])) {
             continue;
         }
         $options = ORM::factory($data['model']);
         $pk = Arr::overwrite(array($options->primary_key(), $options->primary_key()), (array) Arr::get($data, 'zform_pk'));
         $label = Arr::overwrite(array('name', 'name'), (array) Arr::get($data, 'zform_label'));
         $options = $options->select($pk)->select($label);
         $options = $options->find_all()->as_array($pk[1], $label[1]);
         $attributes = Arr::get($this->_z_attributes, $data['foreign_key']);
         $name = $this->field_name($data['foreign_key']);
         $id = $this->field_id($data['foreign_key']);
         $label = Arr::get($this->_z_labels, $data['foreign_key'], ucfirst(Inflector::humanize($column)));
         $config = array('options' => $options);
         $this->_z_fields[$data['foreign_key']] = new ZForm_Field_Enum($name, $id, $label, $config, $attributes, $data);
     }
     foreach ($this->_table_columns as $column => $field) {
         // Field has already been set or has been excluded
         if (isset($this->_z_fields[$column]) or in_array($column, $this->_z_exclude)) {
             $this->_z_labels[$column] = Arr::get($this->_z_labels, $column, ucfirst(Inflector::humanize($column)));
             continue;
         }
         $data_type = explode(' ', $field['data_type']);
         $data_type = $data_type[0];
         // Get additional config items, and add the default data
         $config = Arr::merge(Kohana::$config->load('zcolumns.default.default_column'), (array) Kohana::$config->load('zcolumns.default.' . $data_type));
         $config = Arr::merge($config, (array) Arr::get($this->_z_field_config, $column));
         $type = 'ZForm_Field_' . $config['type'];
         $attributes = Arr::get($this->_z_attributes, $column);
         $name = $this->field_name($column);
         $id = $this->field_id($column);
         $label = Arr::get($this->_z_labels, $column, ucfirst(Inflector::humanize($column)));
         $this->_z_labels[$column] = $label;
         $this->_z_fields[$column] = new $type($name, $id, $label, $config, $attributes, $field);
     }
 }
开发者ID:Zahymaka,项目名称:ZForm,代码行数:50,代码来源:zform.php

示例13: __construct

 /**
  * @param  array  $options
  */
 public function __construct(array $options)
 {
     $this->options = \Arr::overwrite($this->options, $options);
 }
开发者ID:spotman,项目名称:kohana-i18n-plural,代码行数:7,代码来源:helpers.php

示例14: hacer_registro_persona

 public function hacer_registro_persona($id = NULL)
 {
     $exito = FALSE;
     $persona = $id == NULL ? Model::factory("persona") : Model::factory("persona", $id);
     // Hace la validacion
     if ($persona->values($_POST)->check()) {
         // Los datos han sido validados
         $persona->save();
         $exito = $persona->id;
     }
     // Llenamos los vectores con los valores que seran mostrados en los campos
     $this->errores_persona = $persona->validate()->errors("usuario");
     $this->formulario_persona = Arr::overwrite($this->formulario_persona, $_POST);
     return $exito;
 }
开发者ID:reneegonam,项目名称:CoCo,代码行数:15,代码来源:admin.php

示例15: action_csv

 public function action_csv()
 {
     $this->auto_render = FALSE;
     $id = (int) Request::current()->param('id');
     $orm_form = ORM::factory('form', $id);
     if (!$orm_form->loaded()) {
         throw new HTTP_Exception_404();
     }
     $fields = array_flip(array('id', 'email', 'text', 'created'));
     $labels = Arr::overwrite($fields, $orm_form->responses->labels());
     $list = $orm_form->responses->find_all();
     $queue = array();
     Database::instance()->set_charset('cp1251');
     foreach ($list as $_orm) {
         $_values = array_map('Helper_CSV::escape', $_orm->as_array());
         $_values = array_intersect_key($_values, $fields);
         $_item = array_combine($labels, $_values);
         $queue[] = array_filter($_item);
     }
     Database::instance()->set_charset('utf8');
     Helper_CSV::instance()->send($queue);
 }
开发者ID:greor,项目名称:satin-spb,代码行数:22,代码来源:responses.php


注:本文中的Arr::overwrite方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。