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


PHP arr::remove方法代码示例

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


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

示例1: html_element

 public function html_element()
 {
     // Import base data
     $data = $this->data;
     // Get the options and default selection
     $time = $this->time_array(arr::remove('value', $data));
     // No labels or values
     unset($data['label']);
     $input = '';
     foreach ($this->parts as $type => $val) {
         if (is_int($type)) {
             // Just add the separators
             $input .= $val;
             continue;
         }
         // Set this input name
         $data['name'] = $this->data['name'] . '[' . $type . ']';
         // Set the selected option
         $selected = $time[$type];
         if ($type == 'am_pm') {
             // Options are static
             $options = array('AM' => 'AM', 'PM' => 'PM');
         } else {
             // minute(s), hour(s), etc
             $type .= 's';
             // Use the date helper to generate the options
             $options = empty($val) ? date::$type() : call_user_func_array(array('date', $type), $val);
         }
         $input .= form::dropdown($data, $options, $selected);
     }
     return $input;
 }
开发者ID:JasonWiki,项目名称:docs,代码行数:32,代码来源:Form_Dateselect.php

示例2: tiers_POST

 protected static function tiers_POST($id, $envelope)
 {
     if (is_null($id)) {
         self::throwErrorAndDie('Invalid request', array($id), 410);
     }
     $data = self::requireData($envelope);
     $tier_agents = array();
     if ($agents = arr::get($data, 'agents')) {
         foreach ($agents as $agent) {
             if ($tier_agent_id = arr::get($agent, 'tier_agent_id')) {
                 $tier_agent = Doctrine::getTable('TierAgent')->findOneBy('tier_agent_id', $tier_agent_id);
             } else {
                 $tier_agent = new TierAgent();
             }
             try {
                 $tier_agent->synchronizeWithArray($agent);
                 $tier_agent->save();
                 $tier_agents[] = $tier_agent->toArray();
             } catch (Exception $e) {
                 self::throwErrorAndDie('Invalid data', Bluebox_Controller::$validation->errors(), 400);
             }
         }
         arr::remove('agents', $data);
         arr::merge($envelope['data'], $data);
     }
     $response = self::generalAPI_POST($id, 'tier_id', 'Tier', $envelope);
     $response['agents'] = $tier_agents;
     return $response;
 }
开发者ID:swk,项目名称:bluebox,代码行数:29,代码来源:CallCenter.php

示例3: html_element

 public function html_element()
 {
     // Import base data
     $base_data = $this->data;
     unset($base_data['label']);
     // Get the options and default selection
     $options = arr::remove('options', $base_data);
     $selected = arr::remove('selected', $base_data);
     return form::dropdown($base_data, $options, $selected);
 }
开发者ID:TODDMAN,项目名称:gallery3-vendor,代码行数:10,代码来源:Form_Dropdown.php

示例4: get_array

 /**
  * Get Notice Array
  *
  * Either returns the entire notice array and resets it,
  * or returns and removes a specific type of notice from
  * the array.
  *
  * @param string - Type of notice to return
  * @return array - The notice array
  */
 public static function get_array($type = NULL)
 {
     if ($type === NULL) {
         $notices = self::$notices;
         self::$notices = array();
         return $notices;
     } else {
         return arr::remove($type, self::$notices);
     }
 }
开发者ID:kierangraham,项目名称:Notice,代码行数:20,代码来源:notice.php

示例5: form

 /**
  * Creates and returns a form view object based on the defined inputs,
  * rules, and callbacks. ORM::validate is used as the validation method.
  *
  * Error i18n files follow the format: form_model_name, eg: Model_User would
  * use form_user for errors.
  *
  * @param   array    values array to validate
  * @param   boolean  YES to save the model, or a URI to redirect, on success
  * @return  View
  */
 public function form(array &$array, $save = NO)
 {
     $array = Validation::factory($array)->pre_filter('trim');
     foreach ($this->rules as $column => $rules) {
         foreach ($rules as $rule) {
             $array->add_rules($column, $rule);
         }
     }
     foreach ($this->callbacks as $column => $rules) {
         foreach ($rules as $rule) {
             $array->add_callbacks($column, $rule);
         }
     }
     // Load the form
     $form = View::factory($this->view)->set('action', Router::$current_uri)->set('cancel', Router::$current_uri)->set('attributes', array())->bind('inputs', $inputs)->bind('errors', $errors);
     if (!$this->validate($array, $save)) {
         // Load errors
         $errors = $array->errors('form_' . $this->object_name);
     }
     $inputs = array();
     foreach ($this->inputs as $name => $data) {
         if (is_int($name)) {
             $name = $data;
             $data = nil;
         } else {
             if (isset($data['type']) and $data['type'] === 'dropdown') {
                 if (isset($data['options']) and !is_array($data['options'])) {
                     list($model, $attr) = arr::callback_string($data['options']);
                     // Generate a list of options
                     $data['options'] = ORM::factory($model)->select_list($attr[0], $attr[1]);
                 }
                 if (!isset($data['selected'])) {
                     $data['selected'] = $array[$name];
                 }
             } elseif (isset($data['type']) and $data['type'] === 'upload') {
                 // Form must be multi-part
                 $attributes['enctype'] = 'multipart/form-data';
             } else {
                 $data['value'] = $array[$name];
             }
         }
         if (!isset($data['name'])) {
             // Set input name
             $data['name'] = $name;
         }
         if (!isset($data['title'])) {
             // Set field title
             $data['title'] = ucfirst($name);
         }
         // Add the column to the inputs
         $inputs[arr::remove('title', $data)] = $data;
     }
     return $form;
 }
开发者ID:enormego,项目名称:EightPHP,代码行数:65,代码来源:form.php

示例6: process

 /**
  * Creates a temporary image and executes the given actions. By creating a
  * temporary copy of the image before manipulating it, this process is atomic.
  */
 public function process($image, $actions, $dir, $file, $render = FALSE, $background = NULL)
 {
     // We only need the filename
     $image = $image['file'];
     // Unique temporary filename
     $this->tmp_image = $dir . 'k2img--' . sha1(time() . $dir . $file) . substr($file, strrpos($file, '.'));
     // Copy the image to the temporary file
     copy($image, $this->tmp_image);
     // Quality change is done last
     $quality = (int) arr::remove('quality', $actions);
     // Use 95 for the default quality
     empty($quality) and $quality = 95;
     if (is_string($background)) {
         // Set the background color
         $this->background = escapeshellarg($background);
     } else {
         // Use a transparent background
         $this->background = 'transparent';
     }
     // All calls to these will need to be escaped, so do it now
     $this->cmd_image = escapeshellarg($this->tmp_image);
     $this->new_image = $render ? $this->cmd_image : escapeshellarg($dir . $file);
     if ($status = $this->execute($actions)) {
         // Use convert to change the image into its final version. This is
         // done to allow the file type to change correctly, and to handle
         // the quality conversion in the most effective way possible.
         if ($error = exec(escapeshellcmd($this->dir . 'convert' . $this->ext) . ' -background ' . $this->background . ' -flatten -quality ' . $quality . '% ' . $this->cmd_image . ' ' . $this->new_image)) {
             $this->errors[] = $error;
         } else {
             // Output the image directly to the browser
             if ($render === TRUE) {
                 $contents = file_get_contents($this->tmp_image);
                 switch (substr($file, strrpos($file, '.') + 1)) {
                     case 'jpg':
                     case 'jpeg':
                         header('Content-Type: image/jpeg');
                         break;
                     case 'gif':
                         header('Content-Type: image/gif');
                         break;
                     case 'png':
                         header('Content-Type: image/png');
                         break;
                 }
                 echo $contents;
             }
         }
     }
     // Remove the temporary image
     unlink($this->tmp_image);
     $this->tmp_image = '';
     return $status;
 }
开发者ID:JasonWiki,项目名称:docs,代码行数:57,代码来源:ImageMagick.php

示例7: html_element

 public function html_element()
 {
     // Import base data
     $base_data = $this->data;
     unset($base_data['label']);
     if (isset($base_data['multiple']) && !!$base_data['multiple']) {
         $base_data['name'] = str_replace('[]', '', $base_data['name']) . '[]';
     }
     // Get the options and default selection
     $options = arr::remove('options', $base_data);
     $selected = arr::remove('selected', $base_data);
     return form::dropdown($base_data, $options, $selected);
 }
开发者ID:enormego,项目名称:EightPHP,代码行数:13,代码来源:dropdown.php

示例8: save

 public function save()
 {
     if (request::is_ajax() && request::method() === 'post') {
         $this->auto_render = FALSE;
         $post = security::xss_clean($this->input->post());
         $officeBudget = arr::remove('currentBudget', $post);
         if ($post['status'] == 'Approved') {
             $this->budget_model->updateBudget($post['office_id'], $officeBudget);
             echo $this->request_model->insert($post);
         }
         $this->request_model->insert($post);
         log_helper::add("1", $this->user_log, $this->user_id, "Added New Request");
     }
 }
开发者ID:humbleBeginner,项目名称:inventory-pho2,代码行数:14,代码来源:requests.php

示例9: html_element

 protected function html_element()
 {
     // Import the data
     $data = $this->data;
     if (empty($data['checked'])) {
         // Not checked
         unset($data['checked']);
     } else {
         // Is checked
         $data['checked'] = 'checked';
     }
     if ($label = arr::remove('label', $data)) {
         // There must be one space before the text
         $label = ' ' . ltrim($label);
     }
     return '<label>' . form::input($data) . $label . '</label>';
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:17,代码来源:Form_Checkbox.php

示例10: save

 public function save()
 {
     if (request::is_ajax() and request::method() === 'post') {
         $this->auto_render = FALSE;
         $office_id = Auth::instance()->get_user()->office_id;
         $post = security::xss_clean($this->input->post());
         $post['office_id'] = $office_id;
         $post['status'] = 'Received';
         $officeBudget = arr::remove('currentBudget', $post);
         if ($post['status'] == 'Approved') {
             $this->budget_model->updateBudget($post['office_id'], $officeBudget);
             echo $this->request_model->insert($post);
         }
         log_helper::add("1", $this->user_log, $this->user_id, "Requested a Budget");
         $this->request_model->insert($post);
     }
 }
开发者ID:humbleBeginner,项目名称:inventory-pho2,代码行数:17,代码来源:office_requests.php

示例11: save

 public function save()
 {
     if (request::is_ajax() and request::method() === 'post') {
         $this->auto_render = FALSE;
         $post = security::xss_clean($this->input->post());
         // echo $this->auth->hash("admin").'<br />';
         // echo $this->auth->hash_password("admin");
         // die();
         $role = arr::remove('role', $post);
         foreach ($post as $key => $value) {
             $this->user_model->{$key} = $value;
         }
         $this->user_model->add(ORM::factory('role', 'login'));
         $this->user_model->add(ORM::factory('role', $role));
         log_helper::add("1", $this->user_log, $this->user_id, "Added New " . $role . " User.");
         echo $this->user_model->save();
     }
 }
开发者ID:humbleBeginner,项目名称:inventory-pho2,代码行数:18,代码来源:users.php

示例12: save

 public function save()
 {
     if ($this->form->validate() and $data = $this->form->as_array()) {
         if (empty($data['password'])) {
             // Remove the empty password so it's not reset
             unset($data['password'], $data['confirm']);
         }
         // Need to set this before saving
         $new_user = $this->object->id == 0;
         // Remove the roles from data
         isset($data['roles']) and $roles = arr::remove('roles', $data);
         foreach ($data as $field => $val) {
             // Set object data from the form
             $this->{$field} = $val;
         }
         if ($status = parent::save()) {
             // if ($new_user)
             // {
             // 	foreach ($roles as $role)
             // 	{
             // 		// Add the user roles
             // 		$this->add_role($role);
             // 	}
             // }
             // else
             // {
             // 	foreach (array_diff($this->roles, $roles) as $role)
             // 	{
             // 		// Remove roles that were deactivated
             // 		$this->remove_role($role);
             // 	}
             //
             // 	foreach (array_diff($roles, $this->roles) as $role)
             // 	{
             // 		// Add new roles
             // 		$this->add_role($role);
             // 	}
             // }
         }
         // Return the save status
         return $status;
     }
     return FALSE;
 }
开发者ID:TODDMAN,项目名称:gallery3-vendor,代码行数:44,代码来源:user_edit.php

示例13: __call

 public function __call($method, $args)
 {
     // Concat all the arguments into a filepath
     array_unshift($args, $method);
     $path = join('/', $args);
     // Loop through the routes and see if anything matches
     foreach ((array) Kohana::config('assets', FALSE, FALSE) as $key => $val) {
         if (preg_match('#^' . $key . '$#u', $path)) {
             // If the supplied value is a config array ...
             if (is_array($val)) {
                 // ... get the mapped route ...
                 $route = arr::remove('route', $val);
                 // ... and apply the rest of the config settings
                 $this->apply_config($val);
             } else {
                 $route = $val;
             }
             if (strpos($route, '$') !== FALSE) {
                 // Use regex routing
                 $routed_path = preg_replace('#^' . $key . '$#u', $route, $path);
             } else {
                 // Standard routing
                 $routed_path = $route;
             }
             // A valid route has been found
             break;
         }
     }
     // If no matching route is found, then 404
     if (!isset($routed_path)) {
         Event::run('system.404');
     }
     $pathinfo = pathinfo($routed_path);
     $directories = explode('/', $pathinfo['dirname']);
     $directory = array_shift($directories);
     $path = join('/', $directories) . '/' . $pathinfo['filename'];
     // Search for file using cascading file system, 404 if not found
     $file = Kohana::find_file($directory, $path, FALSE, $pathinfo['extension']);
     if (!$file) {
         Event::run('system.404');
     }
     readfile($file);
 }
开发者ID:evansd-archive,项目名称:kohana-module--assets,代码行数:43,代码来源:assets.php

示例14: save

 public function save()
 {
     if (request::is_ajax() && request::method() === 'post') {
         $this->auto_render = FALSE;
         $post = security::xss_clean($this->input->post());
         $request_id = arr::remove('request_id', $post);
         foreach ($post as $key => $value) {
             $this->transaction_model->{$key} = $value;
         }
         $budget = $this->budget_model->where('office_id', $post['office_id'])->find();
         $budget_left = (double) $budget->amount_left - (double) $post['amount_paid'];
         $this->budget_model->updateBudget($post['office_id'], $budget_left);
         $request = $this->request_model->find($request_id);
         $request->grand_total = $post['amount_left'];
         $request->save();
         log_helper::add("1", $this->user_log, $this->user_id, "Added New Transaction.");
         echo $this->transaction_model->save();
     }
 }
开发者ID:humbleBeginner,项目名称:inventory-pho2,代码行数:19,代码来源:transactions.php

示例15: save

 public function save()
 {
     if (request::is_ajax() && request::method() === 'post') {
         $this->auto_render = FALSE;
         $post = security::xss_clean($this->input->post());
         $items = $post['items'];
         arr::remove('items', $post);
         foreach ($post as $key => $value) {
             $this->purchase_model->{$key} = $value;
         }
         $last_purchase = $this->purchase_model->save();
         if ($last_purchase->id) {
             $i = 0;
             foreach ($items as $key => $value) {
                 $items[$key]['purchase_id'] = $last_purchase->id;
                 $this->item_stock_model->insert($items[$i]);
                 $i++;
             }
         }
     }
 }
开发者ID:humbleBeginner,项目名称:inventory-pho2,代码行数:21,代码来源:purchases.php


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