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


PHP Set::filter方法代码示例

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


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

示例1: _constructTagAttributes

 /**
  * @param array $attributes
  * @return string
  */
 public function _constructTagAttributes(array $attributes = array())
 {
     $attributes = Set::filter($attributes);
     $outputHtml = '';
     if ($attributes) {
         foreach ($attributes as $attName => $attValue) {
             if (is_array($attValue)) {
                 $attValue = implode(' ', $attValue);
             }
             $attName = trim($attName);
             $attValue = trim($attValue);
             switch ($attName) {
                 case 'value':
                     $attValue = htmlentities($attValue, ENT_QUOTES, 'utf-8');
                     break;
                 case 'disabled':
                     if ($attValue) {
                         $attValue = 'disabled';
                     }
                     break;
             }
             if ((!$attValue || !is_string($attName)) && $attValue !== 0 && $attValue !== '0') {
                 continue;
             }
             $outputHtml .= ' ' . $attName . '="' . esc_attr($attValue) . '"';
         }
     }
     return $outputHtml;
 }
开发者ID:nikolaskarica,项目名称:bds-alliance,代码行数:33,代码来源:gumm_helper.php

示例2: paragraphize

 public function paragraphize($text, $options = array())
 {
     $output = '';
     $attrString = '';
     foreach ($options as $attr => $value) {
         $attrString .= ' ' . $attr . '="' . $value . '"';
     }
     if (strpos($text, '<p>') !== false) {
         if ($attrString) {
             $output = str_replace('<p>', '<p' . $attrString . '>', $text);
         }
     } else {
         $textChunks = Set::filter(explode(PHP_EOL, $text));
         foreach ($textChunks as $para) {
             $para = trim($para);
             if (strlen($para) <= 1) {
                 continue;
             }
             if ($attrString) {
                 $output .= '<p' . $attrString . '>' . $para . '</p>';
             } else {
                 $output .= '<p>' . $para . '</p>';
             }
         }
     }
     return $output ? $output : $text;
 }
开发者ID:nikolaskarica,项目名称:bds-alliance,代码行数:27,代码来源:text.php

示例3: geraTabela

 private function geraTabela()
 {
     $this->genSettings(function ($val, $key) {
         if (!empty($val)) {
             $val = htmlentities($val, ENT_QUOTES, "UTF-8");
             $this->settings['conditions']['AND']["{$this->modelClass}.{$key} LIKE"] = "%{$val}%";
         }
     }, [0, 3]);
     $this->genSettings(function ($val, $key) {
         if (!empty($val)) {
             $this->settings['conditions']["{$this->modelClass}.{$key}"] = $val;
         }
     }, [3, 4]);
     $this->genSettings(function ($val, $key) {
         if (!empty($val)) {
             $this->settings[$key] = $val;
         }
     }, [7, 4]);
     $this->Paginator->settings = array_merge($this->paginate, Set::filter($this->settings));
     extract($this->Paginator->settings);
     $this->set(compact('page', 'sort', 'direction'));
     try {
         return $this->Paginator->paginate();
     } catch (Exception $e) {
         $this->Paginator->settings['page'] = $this->request->params['paging'][$this->modelClass]['pageCount'];
     }
     return $this->Paginator->paginate();
 }
开发者ID:AmmonMa,项目名称:cake_ERP,代码行数:28,代码来源:GestaoEventosController.php

示例4: _render

 protected function _render($options)
 {
     $metaFields = array_keys(Set::filter(Set::booleanize($this->getParam('metaFields'))));
     echo '<div class="line-meta-details">';
     echo $this->Html->postDetails($metaFields, array('prefixes' => array('author' => __('By', 'gummfw'), 'date' => __('/', 'gummfw'), 'comments' => __('/', 'gummfw'), 'category' => __('/', 'gummfw')), 'formats' => array('date' => 'd F Y')));
     echo '</div>';
 }
开发者ID:nikolaskarica,项目名称:bds-alliance,代码行数:7,代码来源:single_post_meta.php

示例5: beforeSave

 function beforeSave($options = array())
 {
     // create contact's "display title" from name and surname
     if (isset($this->data['Contact']['kind']) && strtoupper($this->data['Contact']['kind']) == 'T' && isset($this->data['Contact']['name']) && isset($this->data['Contact']['surname'])) {
         $this->data['Contact']['title'] = implode(' ', Set::filter(array($this->data['Contact']['name'], $this->data['Contact']['surname'])));
     }
     return parent::beforeSave();
 }
开发者ID:malamalca,项目名称:lil-crm,代码行数:8,代码来源:Contact.php

示例6: consultaVolumeAnalistas

 public function consultaVolumeAnalistas($tipo, $ids = null, $data_inicio = array(), $data_fim = array())
 {
     $this->recursive = -1;
     $conditions = Set::filter(array('GestaoEvento_Analista.id_analista' => isset($ids) ? $ids : null));
     $contain = array($tipo => array('conditions' => array("dt_chegada   >=" => !empty($data_inicio['data']) ? "{$data_inicio['data']} {$data_inicio['hora']}" : "0000-00-00 00:00", "dt_chegada   <=" => !empty($data_fim['data']) ? "{$data_fim['data']} {$data_fim['hora']}" : "9999-99-99 99:99")));
     $order = "{$this->alias}.{$this->displayField} ASC";
     $data = $this->find('all', compact('conditions', 'contain', 'order'));
     return $data;
 }
开发者ID:AmmonMa,项目名称:cake_ERP,代码行数:9,代码来源:GestaoEvento_Analista.php

示例7: view

 function view($id = null)
 {
     $this->ProductionManager->recursive = 2;
     // Set User's ID in model which is needed for validation
     $this->ProductionManager->id = $this->Auth->user('id');
     $this->ProductionManager->role = $this->Auth->user('role');
     $admin = false;
     if (!empty($this->ProductionManager->role)) {
         //Only allow the user to update his own profile unless the person has the admin role
         if ($this->ProductionManager->role != "admin") {
             $id = $this->ProductionManager->id;
         } else {
             $admin = true;
         }
     }
     if (!$id) {
         $this->Session->setFlash(__('Invalid production manager', true));
         $this->redirect(array('action' => 'index'));
     }
     if (is_numeric($id)) {
         $production_manager = $this->ProductionManager->read(null, $id);
     } else {
         $production_manager = $this->ProductionManager->findBySlug($id);
     }
     //Find the user's account id
     $userAccount = $this->ProductionManager->User->find('first', array('conditions' => array('User.production_manager_id' => $production_manager['ProductionManager']['id'])));
     foreach ($production_manager['Project'] as $item => $value) {
         //debug($production_manager['Project'][$item]['complete']);
         if ($production_manager['Project'][$item]['complete'] == 1) {
             $completeProjects[] = $production_manager['Project'][$item];
         } else {
             $incompleteProjects[] = $production_manager['Project'][$item];
         }
     }
     if (empty($completeProjects)) {
         $completeProjects = null;
     }
     if (empty($incompleteProjects)) {
         $incompleteProjects = null;
     }
     $this->paginate['Project'] = array('recursive' => 2, 'order' => array('Project.complete' => 'asc'), 'limit' => 150, 'contain' => array('ProductionManager' => array('conditions' => array('ProductionManager.id =' => $production_manager['ProductionManager']['id'])), 'Client'));
     $projects = Set::filter($this->paginate('Project'));
     for ($i = 0; $i < count($projects); $i++) {
         if (!empty($projects[$i]['ProductionManager'][0])) {
             if ($projects[$i]['ProductionManager'][0]['id'] != $production_manager['ProductionManager']['id']) {
                 unset($projects[$i]);
             }
         } else {
             unset($projects[$i]);
         }
     }
     //debug($projects);
     $projects = array_values($projects);
     //debug($projects);
     $this->set(compact('production_manager', 'projects', 'completeProjects', 'incompleteProjects', 'userAccount'));
     //$this->set('production_manager', $this->ProductionManager->read(null, $id));
 }
开发者ID:robsawyer,项目名称:PMT,代码行数:57,代码来源:production_managers_controller.php

示例8: filter

 /**
  * Filters empty elements out of a route array, excluding '0'.
  *
  * @param array $var Either an array to filter, or value when in callback
  * @return mixed Either filtered array, or true/false when in callback
  * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::filter
  */
 public static function filter(array $var)
 {
     foreach ($var as $k => $v) {
         if (is_array($v)) {
             $var[$k] = Set::filter($v);
         }
     }
     return array_filter($var, array('Set', '_filter'));
 }
开发者ID:kailIII,项目名称:Gawfa-Microfinance,代码行数:16,代码来源:Set.php

示例9: beforeFind

 function beforeFind(&$Model, $query = array())
 {
     $optionName = $this->settings[$Model->alias]['optionName'];
     if (isset($query[$optionName])) {
         $options = $query[$optionName];
         unset($query[$optionName]);
         $query = Set::merge($this->defaultQuery, $this->options($Model, $options), Set::filter($query));
     }
     return $query;
 }
开发者ID:hiromi2424,项目名称:Collectionable,代码行数:10,代码来源:options.php

示例10: _render

 protected function _render($options)
 {
     $networks = Set::filter(Set::booleanize($this->getParam('socialNetworks')));
     echo '<div class="bluebox-share-options">';
     echo '<span>' . __('Share The Story', 'gummfw') . '</span>';
     echo '<div class="bluebox-details-social">';
     View::renderElement('social-links', array('networks' => $networks, 'accountMode' => 'share', 'additionalClass' => 'bluebox-shadows'));
     echo '</div>';
     echo '</div>';
 }
开发者ID:nikolaskarica,项目名称:bds-alliance,代码行数:10,代码来源:single_sharebox.php

示例11: consultaVolumeStatus

 public function consultaVolumeStatus(array $default = null, array $data_inicio = null, array $data_fim = null)
 {
     $this->recursive = -1;
     $this->virtualFields = ['quantidade' => 'COUNT(evento)'];
     $joins = [$this->joins['GestaoEvento_Evento']];
     $group = ['status'];
     $order = ['GestaoEvento_Status.status ASC'];
     $conditions = Set::filter(['GestaoEvento_Status.id_status' => $default, 'GestaoEvento_Evento.dt_chegada   >=' => !empty($data_inicio['data']) ? "{$data_inicio['data']} {$data_inicio['hora']}" : "0000-00-00 00:00", 'GestaoEvento_Evento.dt_chegada   <=' => !empty($data_fim['data']) ? "{$data_fim['data']} {$data_fim['hora']}" : "9999-99-99 99:99"]);
     return $this->find('all', compact('conditions', 'joins', 'order', 'group'));
 }
开发者ID:AmmonMa,项目名称:cake_ERP,代码行数:10,代码来源:GestaoEvento_Status.php

示例12: filter

 public static function filter($input)
 {
     if (is_array($input)) {
         foreach ($input as &$value) {
             if (is_array($value)) {
                 $value = self::filter($value);
             }
         }
     }
     return Set::filter($input);
 }
开发者ID:hiromi2424,项目名称:cake_app_base,代码行数:11,代码来源:app_model.php

示例13: render

 /**
  * @return void
  */
 public function render($fields)
 {
     $networks = Set::filter(Set::booleanize($this->getParam('socialNetworks')));
     $mode = $this->getParam('mode');
     // echo '<div class="bluebox-share-options">';
     //     echo '<span>' . __('Share The Story') . '</span>';
     echo '<div class="bluebox-details-social">';
     View::renderElement('social-links', array('networks' => $networks, 'accountMode' => $mode, 'additionalClass' => 'social-link bluebox-shadows'));
     echo '</div>';
     // echo '</div>';
 }
开发者ID:nikolaskarica,项目名称:bds-alliance,代码行数:14,代码来源:gumm_social_networks.php

示例14: trigger

 /**
  * Trigger an event or array of events
  *
  * @param string|array $eventName
  * @param array $data (optional) Array of data to pass along to the event handler
  * @return array
  *
  */
 public function trigger(&$HandlerObject, $eventName, $data = array())
 {
     if (!is_array($eventName)) {
         $eventName = array($eventName);
     }
     $eventNames = Set::filter($eventName);
     foreach ($eventNames as $eventName) {
         $eventData = EventCore::__parseEventName($eventName);
         $return[$eventData['event']] = EventCore::__dispatchEvent($HandlerObject, $eventData['scope'], $eventData['event'], $data);
     }
     return $return;
 }
开发者ID:rchavik,项目名称:infinitas,代码行数:20,代码来源:events.php

示例15: filterQueryPostsArgs

 protected function filterQueryPostsArgs($args)
 {
     global $woocommerce;
     if ($_args = $woocommerce->query->get_catalog_ordering_args()) {
         $args = array_merge($args, $_args);
     }
     if ($termIds = Set::filter(Set::booleanize($this->getParam('product_cat')))) {
         $termIds = array_keys($termIds);
         $args = Set::merge($args, array('tax_query' => array(array('taxonomy' => 'product_cat', 'field' => 'term_id', 'terms' => (array) $termIds))));
     }
     return $args;
 }
开发者ID:nikolaskarica,项目名称:bds-alliance,代码行数:12,代码来源:gumm_woocommerce_products.php


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