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


PHP arr::overwrite方法代码示例

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


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

示例1: _get_frm_valid

 private function _get_frm_valid()
 {
     $form = array('txt_name' => '', 'txt_phone' => '', 'txt_fax' => '', 'txt_email' => '', 'txt_address' => '', 'txt_city' => '', 'txt_zipcode' => '', 'txt_contact' => '', 'txt_state' => '', 'txt_slogan' => '', 'txt_title' => '', 'txt_keyword' => '', 'txt_description' => '', 'txt_per_test' => '', 'txt_width' => '', 'txt_height' => '', 'rdo_enable_cart' => '', 'attach_logo' => '');
     $errors = $form;
     if ($_POST) {
         $post = new Validation(array_merge($_POST, $_FILES));
         if (!empty($_FILES['attach_logo']['name'])) {
             $post->add_rules('attach_logo', 'upload::type[gif,jpg,png,jpeg]', 'upload::size[2M]');
         }
         $post->pre_filter('trim', TRUE);
         $post->add_rules('txt_name', 'required');
         $post->add_rules('txt_phone', 'required');
         //$post->add_rules('txt_fax','phone[7,10,11,14]');
         $post->add_rules('txt_email', 'required', 'email');
         $post->pre_filter('trim', TRUE);
         $post->add_rules('txt_width', 'digit');
         $post->add_rules('txt_height', 'digit');
         $post->add_rules('txt_per_test', 'digit');
         if ($post->validate()) {
             $form = arr::overwrite($form, $post->as_array());
             return $form;
         } else {
             $errors = arr::overwrite($errors, $post->errors('site_validation'));
             $str_error = '';
             foreach ($errors as $id => $name) {
                 if ($name) {
                     $str_error .= $name . '<br>';
                 }
             }
             $this->session->set_flash('error_msg', $str_error);
         }
     }
     url::redirect('admin_config');
     die;
 }
开发者ID:vobinh,项目名称:PHP,代码行数:35,代码来源:admin_config.php

示例2: render

 public function render($options = null)
 {
     if (!$options) {
         $config = Kohana::config_load('zest');
         $options = $config['comment'];
     }
     $array = array("date_format" => 'D jS M Y', "image" => array(50, 50), "html" => '{AVATAR}{DATE} by {AUTHOR}<br/><p>{TEXT}</p><a href="{DELETE_LINK}" title="delete comment"></a><div class="spacer">&nbsp;</div>', "default_image" => 'http://' . $_SERVER['HTTP_HOST'] . '/zest/images/user_icon.gif', "template" => '');
     $array = arr::overwrite($array, $options);
     if (isset($array['template']) && $array['template'] != "") {
         $html = zest::template_to_html('snippets/' . $array['template']);
     } else {
         $html = $array['html'];
     }
     $html = str_replace('{DATE}', date($array['date_format'], strtotime($this->date)), $html);
     $html = str_replace('{AVATAR}', gravatar::render($this->email, $array['image'][0], $array['default_image']), $html);
     if ($this->fl_deleted == 1) {
         $html = str_replace('{TEXT}', '<i>This comment has been deleted.</i>', $html);
     } else {
         $html = str_replace('{TEXT}', $this->title, $html);
     }
     $html = str_replace('{AUTHOR}', $this->display_name, $html);
     if ($this->can_modify()) {
         $html = str_replace('{DELETE_LINK}', $this->delete_url(), $html);
     }
     return $html;
 }
开发者ID:sydlawrence,项目名称:SocialFeed,代码行数:26,代码来源:zest_comment.php

示例3: login

 public function login()
 {
     $form = $errors = array("user" => "", "password" => "");
     $post = new Validation($_POST);
     $post->add_rules("user", "required");
     $post->add_rules("password", "required");
     if ($valid = $post->validate()) {
         try {
             $token = G3Remote::instance()->get_access_token($post["user"], $post["password"]);
             Session::instance()->set("g3_client_access_token", $token);
             $response = G3Remote::instance()->get_resource("gallery");
             $valid = true;
             $content = $this->_get_main_view($response->resource);
         } catch (Exception $e) {
             Kohana_Log::add("error", Kohana_Exception::text($e));
             $valid = false;
         }
     }
     if (!$valid) {
         $content = new View('login.html');
         $content->form = arr::overwrite($form, $post->as_array());
         $content->errors = arr::overwrite($errors, $post->errors());
     }
     $this->auto_render = false;
     print json_encode(array("status" => $valid ? "ok" : "error", "content" => (string) $content));
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:26,代码来源:g3_client.php

示例4: render_summary

 /**
  * Returns the formatted html
  *
  * html example
  * e.g <h1>{TITLE}</h1><h2>{DATE}</h2><h3>by {AUTHOR}</h3>{IMAGE}{TEXT}<div class="spacer">&nbsp;</div>
  *
  * @param   array	$options	Options for the rendering array('count', 'date_format','image' = array($width,$height), 'word_count', 'html')
  * @return	string	$html		Formatted HTML
  */
 public function render_summary($options = null, $feedpost_options = null)
 {
     $array = array('per_page' => 5, 'pagination' => 'classic', 'template' => 'feed', 'html' => '{FEEDPOSTS}{PAGINATION}');
     if (!$options) {
         $config = Kohana::config_load('zest');
         $options = $config['feed.summary'];
     }
     $array = arr::overwrite($array, $options);
     $uri = uri::instance();
     $page = $uri->segment('page', 1);
     $feedposts = "";
     $posts = $this->get_posts($array['per_page'], ($page - 1) * $array['per_page']);
     foreach ($posts as $post) {
         $feedposts .= $post->render_summary($feedpost_options);
     }
     $pagination = new Pagination(array('uri_segment' => 'page', 'total_items' => count($this->get_posts()), 'items_per_page' => $array['per_page'], 'style' => $array['pagination']));
     if ($array['template'] != '') {
         $html = zest::template_to_html('snippets/' . $array['template']);
     } else {
         $html = $array['html'];
     }
     $html = str_replace("{RSS_LINK}", $this->get_rss(), $html);
     $html = str_replace("{FEEDPOSTS}", $feedposts, $html);
     $html = str_replace("{PAGINATION}", $pagination, $html);
     $html = str_replace("{FEED_LINK}", $this->get_url(), $html);
     return $html;
 }
开发者ID:sydlawrence,项目名称:SocialFeed,代码行数:36,代码来源:feed.php

示例5: index

 function index()
 {
     $this->template->content = new View('admin/blocks');
     $this->template->content->title = Kohana::lang('ui_admin.blocks');
     // Get Registered Blocks
     if (!is_array($this->_registered_blocks)) {
         $this->_registered_blocks = array();
     }
     // Get Active Blocks
     $settings = ORM::factory('settings', 1);
     $active_blocks = $settings->blocks;
     $active_blocks = array_filter(explode("|", $active_blocks));
     // setup and initialize form field names
     $form = array('action' => '', 'block' => '');
     //	copy the form as errors, so the errors will be stored with keys corresponding to the form field names
     $errors = $form;
     $form_error = FALSE;
     $form_saved = FALSE;
     $form_action = "";
     if ($_POST) {
         $post = Validation::factory($_POST);
         //	 Add some filters
         $post->pre_filter('trim', TRUE);
         // Add some rules, the input field, followed by a list of checks, carried out in order
         $post->add_rules('action', 'required', 'alpha', 'length[1,1]');
         $post->add_rules('block', 'required', 'alpha_dash');
         if (!array_key_exists($post->block, $this->_registered_blocks)) {
             $post->add_error('block', 'exists');
         }
         if ($post->validate()) {
             // Activate a block
             if ($post->action == 'a') {
                 array_push($active_blocks, $post->block);
                 $settings->blocks = implode("|", $active_blocks);
                 $settings->save();
             } elseif ($post->action == 'd') {
                 $active_blocks = array_diff($active_blocks, array($post->block));
                 $settings->blocks = implode("|", $active_blocks);
                 $settings->save();
             }
         } else {
             $errors = arr::overwrite($errors, $post->errors('blocks'));
             $form_error = TRUE;
         }
     }
     // Sort the Blocks
     $sorted_blocks = blocks::sort($active_blocks, array_keys($this->_registered_blocks));
     $this->template->content->form = $form;
     $this->template->content->errors = $errors;
     $this->template->content->form_error = $form_error;
     $this->template->content->form_saved = $form_saved;
     $this->template->content->form_action = $form_action;
     $this->template->content->total_items = count($this->_registered_blocks);
     $this->template->content->registered_blocks = $this->_registered_blocks;
     $this->template->content->active_blocks = $active_blocks;
     $this->template->content->sorted_blocks = $sorted_blocks;
     // Javascript Header
     $this->template->tablerowsort_enabled = TRUE;
     $this->template->js = new View('admin/blocks_js');
 }
开发者ID:kjgarza,项目名称:ushahidi,代码行数:60,代码来源:blocks.php

示例6: _get_frm_valid

 private function _get_frm_valid()
 {
     $rdo_type = 'image';
     $file_ext = 'jpg,jpeg,gif,png';
     $form = array('hd_id' => '', 'attach_image' => '', 'txt_width' => '', 'txt_height' => '', 'sel_status' => '');
     $errors = $form;
     if ($_POST) {
         $post = new Validation(array_merge($_FILES, $_POST));
         $post->add_rules('attach_' . $rdo_type, 'upload::type[' . $file_ext . ']', 'upload::size[10M]');
         $post->add_rules('txt_width', 'digit');
         $post->add_rules('txt_height', 'digit');
         if ($post->validate()) {
             $form = arr::overwrite($form, $post->as_array());
             return $form;
         } else {
             $errors = $post->errors('banner_validation');
             $str_error = '';
             foreach ($errors as $id => $name) {
                 if ($name) {
                     $str_error .= $name . '<br>';
                 }
             }
             $this->session->set_flash('error_msg', $str_error);
             url::redirect($this->site['history']['current']);
             die;
         }
     }
 }
开发者ID:vobinh,项目名称:PHP,代码行数:28,代码来源:admin_banner.php

示例7: _get_frm_valid

 private function _get_frm_valid()
 {
     $hd_id = $this->input->post('hd_id');
     $form = $this->data_template_model->get_frm();
     $errors = $form;
     if ($_POST) {
         $post = new Validation($_POST);
         $post->pre_filter('trim', TRUE);
         $post->add_rules('txt_name', 'required', 'length[1,200]');
         $post->add_rules('txt_content', 'required');
         if ($post->validate()) {
             $form = arr::overwrite($form, $post->as_array());
             return $form;
         } else {
             $form = arr::overwrite($form, $post->as_array());
             $errors = arr::overwrite($errors, $post->errors('account_validation'));
             $str_error = '';
             foreach ($errors as $id => $name) {
                 if ($name) {
                     $str_error .= $name . '<br>';
                 }
             }
             $this->session->set_flash('error_msg', $str_error);
             if ($hd_id) {
                 url::redirect('admin_emailtemplate/edit/' . $hd_id);
             }
             die;
         }
     }
 }
开发者ID:vobinh,项目名称:PHP,代码行数:30,代码来源:admin_emailtemplate.php

示例8: _get_record

 private function _get_record()
 {
     $form = array('txt_name' => '', 'txt_email' => '', 'txt_phone' => '', 'txt_subject' => '', 'txt_content' => '', 'txt_code' => '', 'txt_last_name' => '', 'txt_first_name' => '', 'txt_company' => '');
     $errors = $form;
     if ($_POST) {
         $post = new Validation($_POST);
         $post->pre_filter('trim', TRUE);
         $post->add_rules('txt_name', 'required');
         $post->add_rules('txt_email', 'required', 'email');
         $post->add_rules('txt_subject', 'required');
         $post->add_rules('txt_content', 'required');
         //$post->add_rules('txt_code','required');
         //$post->add_callbacks('txt_random',array($this,'_check_security_code'));
         //$post->add_rules('sel_send','trim');
         if ($post->validate()) {
             $form = arr::overwrite($form, $post->as_array());
             return $form;
         } else {
             $form = arr::overwrite($form, $post->as_array());
             // Retrieve input data
             $this->session->set_flash('input_data', $form);
             // Set input data in session
             $errors = arr::overwrite($errors, $post->errors('contact_validation'));
             $error_msg = '';
             foreach ($errors as $id => $name) {
                 if ($name) {
                     $error_msg .= '<br>' . $name;
                 }
             }
             $this->session->set_flash('error_msg', $error_msg);
             url::redirect('contact');
             die;
         }
     }
 }
开发者ID:vobinh,项目名称:PHP,代码行数:35,代码来源:contact.php

示例9: index

 public function index()
 {
     // Create new session
     $this->session->create();
     $this->template->header->this_page = 'alerts';
     $this->template->content = new View('alerts');
     // Display news feeds?
     $this->template->content->allow_feed = Kohana::config('settings.allow_feed');
     // Retrieve default country, latitude, longitude
     $default_country = Kohana::config('settings.default_country');
     // Retrieve Country Cities
     $this->template->content->cities = $this->_get_cities($default_country);
     // Setup and initialize form field names
     $form = array('alert_mobile' => '', 'alert_mobile_yes' => '', 'alert_email' => '', 'alert_email_yes' => '', 'alert_lat' => '', 'alert_lon' => '', 'alert_radius' => '');
     // Copy the form as errors, so the errors will be stored with keys
     // corresponding to the form field names
     $errors = $form;
     $form_error = FALSE;
     $form_saved = FALSE;
     // If there is a post and $_POST is not empty
     if ($post = $this->input->post()) {
         // Create a new alert
         $alert = ORM::factory('alert');
         // Test to see if things passed the rule checks
         if ($alert->validate($post)) {
             // Yes! everything is valid
             // Save alert and send out confirmation code
             if (!empty($post->alert_mobile)) {
                 $this->_send_mobile_alert($post->alert_mobile, $post->alert_lon, $post->alert_lat, $post->alert_radius);
             }
             if (!empty($post->alert_email)) {
                 $this->_send_email_alert($post->alert_email, $post->alert_lon, $post->alert_lat, $post->alert_radius);
             }
             $this->session->set('alert_mobile', $post->alert_mobile);
             $this->session->set('alert_email', $post->alert_email);
             url::redirect('alerts/confirm');
         } else {
             // repopulate the form fields
             $form = arr::overwrite($form, $post->as_array());
             // populate the error fields, if any
             $errors = arr::overwrite($errors, $post->errors('alerts'));
             $form_error = TRUE;
         }
     } else {
         $form['alert_lat'] = Kohana::config('settings.default_lat');
         $form['alert_lon'] = Kohana::config('settings.default_lon');
         $form['alert_radius'] = 20;
     }
     $this->template->content->form = $form;
     $this->template->content->errors = $errors;
     $this->template->content->form_error = $form_error;
     $this->template->content->form_saved = $form_saved;
     // Javascript Header
     $this->template->header->map_enabled = TRUE;
     $this->template->header->js = new View('alerts_js');
     $this->template->header->js->default_map = Kohana::config('settings.default_map');
     $this->template->header->js->default_zoom = Kohana::config('settings.default_zoom');
     $this->template->header->js->latitude = $form['alert_lat'];
     $this->template->header->js->longitude = $form['alert_lon'];
 }
开发者ID:phpdiva,项目名称:Ushahidi_Haiti,代码行数:60,代码来源:alerts.php

示例10: register

 public function register()
 {
     $subview = new View('user/register');
     $subview->tab = 'main';
     $subview->section = 'register';
     // What are we working with here?
     $base = $this->newUser;
     // Must have an initialized user model object to get started
     if (!$base) {
         return FALSE;
     }
     // Nothing to do here.
     // Populate form data with whatever our database record has
     $subview->register = $base->toArray();
     // Pass errors from the controller to our view
     $validation = Bluebox_Controller::$validation;
     foreach ($validation->errors() as $field => $error) {
         // the form helper will expect the errors based on the field name
         // of register
         $field = preg_replace('/^user/', 'register', $field, 1, $count);
         if (!empty($count)) {
             $validation->add_error($field, $error);
         }
     }
     // If we are coming from a previous form field/post, we want to repopulate the previous field entries again on this page so
     // that errors/etc. can be corrected, rather then lost.
     if (isset($this->repopulateForm) and isset($this->repopulateForm['register'])) {
         $subview->register = arr::overwrite($subview->register, $this->repopulateForm['register']);
         $subview->confirm_password = $this->input->post('confirm_password');
     } else {
         $subview->confirm_password = '';
     }
     // Add our view to the main application
     $this->views[] = $subview;
 }
开发者ID:swk,项目名称:bluebox,代码行数:35,代码来源:user.php

示例11: _get_record_aut_config

 private function _get_record_aut_config()
 {
     $form = array('txt_aut_api_login' => '', 'txt_aut_transaction_key' => '', 'sel_aut_post_url' => '');
     $errors = $form;
     if ($_POST) {
         $post = new Validation($_POST);
         $post->pre_filter('trim', TRUE);
         $post->add_rules('txt_aut_api_login', 'trim', 'required');
         $post->add_rules('txt_aut_transaction_key', 'trim', 'required');
         $post->add_rules('sel_aut_post_url', 'trim', 'required');
         $form = arr::overwrite($form, $post->as_array());
         $form = $this->_set_form_aut_config($form);
         if ($post->validate()) {
             return $form;
         } else {
             $this->session->set_flash('frm_aut', $form);
             $errors = arr::overwrite($errors, $post->errors('authorizenet_config_validation'));
             $str_error = '';
             foreach ($errors as $id => $name) {
                 if ($name) {
                     $str_error .= '<br>' . $name;
                 }
             }
             $this->session->set_flash('error_msg', $str_error);
             url::redirect('admin_payment_method');
             die;
         }
     }
 }
开发者ID:vobinh,项目名称:PHP,代码行数:29,代码来源:admin_payment_method.php

示例12: index

 public function index()
 {
     $this->template->content = new View('admin/flickrwijit_form');
     // setup and initialize form field names
     $form = array('flickr_tag' => '', 'flickr_id' => '', 'num_of_photos' => '', 'image_width' => '', 'image_height' => '', 'block_position' => '', 'enable_cache' => '', 'block_no_photos' => '');
     //  Copy the form as errors, so the errors will be stored with keys
     //  corresponding to the form field names
     $errors = $form;
     $form_error = FALSE;
     $form_saved = FALSE;
     // check, has the form been submitted, if so, setup validation
     if ($_POST) {
         // Instantiate Validation, use $post, so we don't overwrite $_POST
         // fields with our own things
         $post = new Validation($_POST);
         // Add some filters
         $post->pre_filter('trim', TRUE);
         $post->add_rules('flickr_tag', 'required', 'length[0,500]');
         $post->add_rules('flickr_id', 'length[0,20]');
         $post->add_rules('num_of_photos', 'numeric');
         $post->add_rules('image_width', 'length[2,600]', 'numeric');
         $post->add_rules('image_height', 'required', 'length[2,600]', 'numeric');
         $post->add_rules('block_position', 'length[1,6]', 'numeric');
         $post->add_rules('enable_cache', 'between[0,1]', 'numeric');
         $post->add_rules('block_no_photos', 'between[4,10]', 'numeric');
         // passed validation test.
         if ($post->validate()) {
             $flickrwijit_settings = new Flickrwijit_Model(1);
             $flickrwijit_settings->flickr_tag = $post->flickr_tag;
             $flickrwijit_settings->flickr_id = $post->flickr_id;
             $flickrwijit_settings->num_of_photos = $post->num_of_photos;
             $flickrwijit_settings->image_height = $post->image_height;
             $flickrwijit_settings->image_width = $post->image_width;
             $flickrwijit_settings->block_position = $post->block_position;
             $flickrwijit_settings->enable_cache = $post->enable_cache;
             $flickrwijit_settings->block_no_photos = $post->block_no_photos;
             $flickrwijit_settings->save();
             // Delete Settings Cache
             // $this->cache->delete('settings');
             // $this->cache->delete_tag('settings');
             // Everything is A-Okay!
             $form_saved = TRUE;
             // repopulate the form fields
             $form = arr::overwrite($form, $post->as_array());
         } else {
             // repopulate the form fields
             $form = arr::overwrite($form, $post->as_array());
             // populate the error fields, if any
             $errors = arr::overwrite($errors, $post->errors('flickrwijit'));
             $form_error = TRUE;
         }
     } else {
         $flickrwijit_settings = ORM::factory('flickrwijit', 1);
         $form = array('flickr_tag' => $flickrwijit_settings->flickr_tag, 'flickr_id' => $flickrwijit_settings->flickr_id, 'num_of_photos' => $flickrwijit_settings->num_of_photos, 'image_width' => $flickrwijit_settings->image_width, 'image_height' => $flickrwijit_settings->image_height, 'block_position' => $flickrwijit_settings->block_position, 'enable_cache' => $flickrwijit_settings->enable_cache, 'block_no_photos' => $flickrwijit_settings->block_no_photos);
     }
     $this->template->content->form = $form;
     $this->template->content->errors = $errors;
     $this->template->content->form_error = $form_error;
     $this->template->content->form_saved = $form_saved;
 }
开发者ID:eyedol,项目名称:flickrwijit,代码行数:60,代码来源:flickrwijit.php

示例13: __construct

 public function __construct($options = array())
 {
     $default = array("width" => 900, "height" => 150, "view" => "includes/banner", "images" => array());
     $config = Kohana::config_load('zest');
     $config = arr::overwrite($default, $config['banner']);
     $this->config = arr::overwrite($config, $options);
 }
开发者ID:sydlawrence,项目名称:SocialFeed,代码行数:7,代码来源:Banner.php

示例14: index

 /**
  * Show latest PER_PAGE news on page
  * @return void
  */
 public function index($module = NULL, $page = 1)
 {
     $this->set_title(Kohana::lang('search.search'));
     if ($page == 1) {
         $this->add_breadcrumb(Kohana::lang('search.the_best_results'), url::current());
     } else {
         $this->add_breadcrumb(Kohana::lang('search.page_no') . ' ' . $page, url::current());
     }
     // Default values
     $form = array('value' => '');
     $errors = array();
     if ($_POST) {
         $post = new Validation($_POST);
         // Some filters
         $post->pre_filter('trim', TRUE);
         // Rules
         $post->add_rules('value', 'required');
         if ($post->validate()) {
             $form = arr::overwrite($form, $post->as_array());
         } else {
             // Repopulate form with error and original values
             $form = arr::overwrite($form, $post->as_array());
             $errors = $post->errors('search_errors');
         }
     }
     $this->template->content = new View('search');
     $data = $this->products->search($post['value']);
     $data2 = $this->page->search($post['value']);
     $data3 = $this->news->search($post['value']);
     $this->template->content->data = $data;
     $this->template->content->data2 = $data2;
     $this->template->content->data3 = $data3;
     $this->template->content->form = $form;
     $this->template->content->errors = $errors;
 }
开发者ID:repli2dev,项目名称:re-eshop,代码行数:39,代码来源:search.php

示例15: __construct

 public function __construct($options = array())
 {
     $default = array("width" => "100", "height" => "100", "images" => array(), "class" => "square_thumb", "view" => null, "thickbox" => true);
     $config = Kohana::config_load('zest');
     $config = arr::overwrite($default, $config['gallery']);
     $this->config = arr::overwrite($config, $options);
 }
开发者ID:sydlawrence,项目名称:SocialFeed,代码行数:7,代码来源:Gallery.php


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