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


PHP array_merge_recursive函数代码示例

本文整理汇总了PHP中array_merge_recursive函数的典型用法代码示例。如果您正苦于以下问题:PHP array_merge_recursive函数的具体用法?PHP array_merge_recursive怎么用?PHP array_merge_recursive使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: admin_index

 function admin_index()
 {
     $this->Ticket->recursive = 0;
     $filters = $this->AlaxosFilter->get_filter();
     $data_ticket = array();
     if (empty($this->params['named']['export_excel'])) {
         $this->set('tickets', $this->paginate($this->Ticket, $filters));
     } else {
         Configure::write('debug', 0);
         $options = array();
         $this->set('export_to_excel', 1);
         $i = 0;
         $tickets = $this->Ticket->find('all', array_merge_recursive($options, array('conditions' => $filters)));
         foreach ($tickets as $ticket) {
             foreach ($ticket as $indx => $module) {
                 foreach ($module as $k => $v) {
                     $arr_fields_in_xls = array();
                     if (!empty($arr_fields_in_xls) && in_array($k, $arr_fields_in_xls[$indx])) {
                         $data_ticket[$i][__($indx, true) . ' ' . __($k, true)] = $module[$k];
                     } else {
                         $data_ticket[$i][__($indx, true) . ' ' . __($k, true)] = $module[$k];
                     }
                 }
             }
             $i++;
         }
         $this->set('tickets', $data_ticket);
     }
 }
开发者ID:sanily2j,项目名称:abc,代码行数:29,代码来源:tickets_controller.php

示例2: doBuildBefore

 /**
  * Add dynamic fields
  *
  * @param BuildBefore $event
  * @param string|null $alias
  * @param string|null $itemType
  * @param bool        $dynamicFirst flag if true - dynamic columns will be placed before static, false - after
  */
 public function doBuildBefore(BuildBefore $event, $alias = null, $itemType = null, $dynamicFirst = true)
 {
     $config = $event->getConfig();
     // get dynamic columns and merge them with static columns from configuration
     $additionalColumnSettings = $this->getDynamicFields($alias, $itemType);
     $filtersSorters = $this->getDynamicSortersAndFilters($additionalColumnSettings);
     $additionalColumnSettings = ['columns' => $additionalColumnSettings, 'sorters' => $filtersSorters['sorters'], 'filters' => $filtersSorters['filters']];
     $additionalColumnSettings = $this->datagridResolver->resolve($config->getName(), $additionalColumnSettings);
     foreach (['columns', 'sorters', 'filters'] as $itemName) {
         $path = '[' . $itemName . ']';
         // get already defined items
         $items = $config->offsetGetByPath($path, []);
         // merge additional items with existing
         if ($dynamicFirst) {
             $items = array_merge_recursive($additionalColumnSettings[$itemName], $items);
         } else {
             $items = array_merge_recursive($items, $additionalColumnSettings[$itemName]);
         }
         // set new item set with dynamic columns/sorters/filters
         $config->offsetSetByPath($path, $items);
     }
     // add/configure entity config properties
     $this->addEntityConfigProperties($config, $itemType);
     // add/configure entity config actions
     $actions = $config->offsetGetByPath(self::PATH_ACTIONS, []);
     $this->prepareRowActions($actions, $itemType);
     $config->offsetSetByPath(self::PATH_ACTIONS, $actions);
 }
开发者ID:snorchel,项目名称:platform,代码行数:36,代码来源:AbstractConfigGridListener.php

示例3: _initData

 /**
  * Initialize fixture data
  *
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 protected function _initData()
 {
     $this->_data['checkout'] = ['prices' => ['price_from' => 110, 'price_to' => 120], 'selection' => [0]];
     parent::_initData();
     $this->_data['fields'] = array_merge_recursive($this->_data['fields'], ['sku_type' => ['value' => 'Fixed', 'input_value' => '1', 'group' => static::GROUP_PRODUCT_DETAILS, 'input' => 'select'], 'price_type' => ['value' => 'Fixed', 'input_value' => '1', 'group' => static::GROUP_PRODUCT_DETAILS, 'input' => 'select'], 'price' => ['value' => 100, 'group' => static::GROUP_PRODUCT_DETAILS], 'tax_class_id' => ['value' => 'Taxable Goods', 'input_value' => '2', 'group' => static::GROUP_PRODUCT_DETAILS, 'input' => 'select'], 'weight_type' => ['value' => 'Fixed', 'input_value' => '1', 'group' => static::GROUP_PRODUCT_DETAILS, 'input' => 'select'], 'weight' => ['value' => '1', 'group' => static::GROUP_PRODUCT_DETAILS], 'product_website_1' => ['value' => 'Yes', 'input_value' => [1], 'group' => static::GROUP_PRODUCT_WEBSITE, 'input' => 'checkbox', 'input_name' => 'website_ids'], 'shipment_type' => ['value' => 'Separately', 'input_value' => '1', 'group' => static::GROUP_PRODUCT_DETAILS, 'input' => 'select'], 'bundle_selections' => ['value' => ['bundle_options' => [['title' => 'Drop-down Option', 'type' => 'Drop-down', 'required' => 'Yes', 'assigned_products' => [['search_data' => ['name' => '%item1_simple1::getName%'], 'data' => ['selection_price_value' => 10, 'selection_price_type' => 'Fixed', 'selection_qty' => 1, 'product_id' => '%item1_simple1::getProductId%']], ['search_data' => ['name' => '%item1_virtual2::getName%'], 'data' => ['selection_price_value' => 20, 'selection_price_type' => 'Percent', 'selection_qty' => 1, 'product_id' => '%item1_virtual2::getProductId%']]]]]], 'group' => static::GROUP]]);
     $this->_repository = Factory::getRepositoryFactory()->getMagentoBundleBundle($this->_dataConfig, $this->_data);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:12,代码来源:BundleFixed.php

示例4: getRendererdActivityMaps

 protected function getRendererdActivityMaps()
 {
     $default_content = '<img src="/static/themes/whitelabel/binaries/icons/favicon-64.png">';
     // Customizations should be set here
     // @todo Add case with custom 'toggle_content'
     $subjects = ['Splitbutton-normal' => ['settings' => ['as_dropdown' => false, 'css' => 'activity-map']], 'Splitbutton-normal-empty' => ['settings' => ['as_dropdown' => false, 'toggle_disabled' => true, 'css' => 'activity-map']], 'Splitbutton-normal-custom_content' => ['settings' => ['as_dropdown' => false, 'default_content' => $default_content, 'css' => 'activity-map']], 'Dropdown-normal' => ['settings' => ['as_dropdown' => true, 'css' => 'activity-map']], 'Dropdown-normal-empty' => ['settings' => ['as_dropdown' => true, 'toggle_disabled' => true, 'css' => 'activity-map']], 'Dropdown-normal-custom_content' => ['settings' => ['as_dropdown' => true, 'default_content' => $default_content, 'css' => 'activity-map']], 'Splitbutton-emphasized' => ['settings' => ['as_dropdown' => false, 'emphasized' => true, 'css' => 'activity-map']], 'Splitbutton-emphasized-empty' => ['settings' => ['as_dropdown' => false, 'emphasized' => true, 'css' => 'activity-map', 'toggle_disabled' => true]], 'Splitbutton-emphasized-custom_content' => ['settings' => ['as_dropdown' => false, 'emphasized' => true, 'css' => 'activity-map', 'default_content' => $default_content]], 'Dropdown-emphasized' => ['settings' => ['as_dropdown' => true, 'emphasized' => true, 'css' => 'activity-map']], 'Dropdown-emphasized-empty' => ['settings' => ['as_dropdown' => true, 'emphasized' => true, 'css' => 'activity-map', 'toggle_disabled' => true]], 'Dropdown-emphasized-custom_content' => ['settings' => ['as_dropdown' => true, 'emphasized' => true, 'default_content' => $default_content, 'css' => 'activity-map']]];
     foreach ($this->activity_types as $activity_type_name => $activity_type) {
         $activity_type_selector = $activity_type['selector'];
         foreach ($subjects as $subject_name => $subject) {
             // create activity map
             $activity_map = new ActivityMap();
             foreach ($this->sample_activities as $key => $activity_custom_state) {
                 $activity_settings = array_merge_recursive(['form_id' => 'randomId-' . rand()], $activity_custom_state['activity']['settings']);
                 $activity_state = ['name' => $key, 'label' => $activity_custom_state['activity']['label'], 'type' => Activity::TYPE_GENERAL, 'description' => $activity_custom_state['activity']['description'], 'verb' => 'read', 'rels' => $activity_custom_state['activity']['rels'], 'settings' => new Settings($activity_settings), 'url' => new Url(['type' => Url::TYPE_URI, 'value' => $activity_custom_state['link']])];
                 $activity = new Activity($activity_state);
                 $activity_map->setItem($key, $activity);
             }
             // render map
             $render_settings = ['default_activity_name' => $activity_type_name, 'css' => $subject['settings']['css'] . ' ' . $activity_type_selector];
             $render_settings = array_replace_recursive($subject['settings'], $render_settings);
             $rendered_maps[$subject_name] = $this->renderSubject($activity_map, $render_settings);
         }
         $rendered_activity_maps[$activity_type_name] = $rendered_maps;
     }
     return $rendered_activity_maps;
 }
开发者ID:honeybee,项目名称:honeybee-agavi-cmf-vendor,代码行数:26,代码来源:ThemePreviewSuccessView.class.php

示例5: getContent

 public function getContent(array $extra_attr = array())
 {
     $attr = array_merge_recursive($extra_attr, $this->attr);
     $sattr = $this->serializeAttr($attr, ['name', 'id']);
     $soptions = $this->options->serializeOptions($this->selected);
     return "<select {$sattr}>\n{$soptions}\n</select>";
 }
开发者ID:nitroxy,项目名称:php-forms,代码行数:7,代码来源:FormSelect.php

示例6: icl_register_admin_options

 function icl_register_admin_options($array, $key = "", $option = array())
 {
     if (is_object($option)) {
         $option = object_to_array($option);
     }
     foreach ($array as $k => $v) {
         $option = $key === '' ? array($k => maybe_unserialize($this->get_option_without_filtering($k))) : $option;
         if (is_array($v)) {
             $this->icl_register_admin_options($v, $key . '[' . $k . ']', $option[$k]);
         } else {
             $context = $this->get_context($key, $k);
             if ($v === '') {
                 icl_unregister_string($context, $key . $k);
             } elseif (isset($option[$k]) && ($key === '' || preg_match_all('#\\[([^\\]]+)\\]#', (string) $key, $opt_key_matches) > 0)) {
                 icl_register_string($context, $key . $k, $option[$k]);
                 $vals = array($k => 1);
                 $opt_keys = isset($opt_key_matches) ? array_reverse($opt_key_matches[1]) : array();
                 foreach ($opt_keys as $opt) {
                     $vals = array($opt => $vals);
                 }
                 update_option('_icl_admin_option_names', array_merge_recursive((array) get_option('_icl_admin_option_names'), $vals));
             }
         }
     }
 }
开发者ID:Junaid-Farid,项目名称:gocnex,代码行数:25,代码来源:wpml-admin-texts.class.php

示例7: paginate

 function paginate($term = null, $paginateOptions = array())
 {
     $this->_controller->paginate = array('SearchIndex' => array_merge_recursive(array('conditions' => array(array('SearchIndex.active' => 1), 'or' => array(array('SearchIndex.published' => null), array('SearchIndex.published <= ' => date('Y-m-d H:i:s'))))), $paginateOptions));
     if (isset($this->_controller->request->params['named']['type']) && $this->_controller->request->params['named']['type'] != 'All') {
         $this->_controller->request->data['SearchIndex']['type'] = Sanitize::escape($this->_controller->request->params['named']['type']);
         $this->_controller->paginate['SearchIndex']['conditions']['model'] = $this->_controller->data['SearchIndex']['type'];
     }
     // Add term condition, and sorting
     if (!$term && isset($this->_controller->request->params['named']['term'])) {
         $term = $this->_controller->request->params['named']['term'];
     }
     if ($term) {
         $term = Sanitize::escape($term);
         $this->_controller->request->data['SearchIndex']['term'] = $term;
         $term = implode(' ', array_map(array($this, 'replace'), preg_split('/[\\s_]/', $term))) . '*';
         if ($this->like) {
             $this->_controller->paginate['SearchIndex']['conditions'][] = array('or' => array("MATCH(data) AGAINST('{$term}')", 'SearchIndex.data LIKE' => "%{$this->_controller->data['SearchIndex']['term']}%"));
         } else {
             $this->_controller->paginate['SearchIndex']['conditions'][] = "MATCH(data) AGAINST('{$term}' IN BOOLEAN MODE)";
         }
         $this->_controller->paginate['SearchIndex']['fields'] = "*, MATCH(data) AGAINST('{$term}' IN BOOLEAN MODE) AS score";
         if (empty($this->_controller->paginate['SearchIndex']['order'])) {
             $this->_controller->paginate['SearchIndex']['order'] = "score DESC";
         }
     }
     return $this->_controller->paginate('SearchIndex');
 }
开发者ID:josegonzalez,项目名称:searchable,代码行数:27,代码来源:SearchComponent.php

示例8: addRule

 /**
  * Adds a rule $rule to the class $classname.
  *
  * The container can be fully configured using rules provided by associative arrays.
  * See {@link https://r.je/dice.html#example3} for a description of the rules.
  *
  * @param string $classname The name of the class to add the rule for
  * @param array $rule The rule to add to it
  */
 public function addRule($classname, $rule)
 {
     if (isset($rule['instanceOf']) && \is_string($rule['instanceOf']) && (!\array_key_exists('inherit', $rule) || $rule['inherit'] === true)) {
         $rule = \array_merge_recursive($this->getRule($rule['instanceOf']), $rule);
     }
     $this->rules[self::normalizeName($classname)] = \array_merge_recursive($this->getRule($classname), $rule);
 }
开发者ID:garrettw,项目名称:dice,代码行数:16,代码来源:Dice.php

示例9: outputArray

 /** {@inheritDoc} */
 public function outputArray(array $array, $count = false)
 {
     if ($this->getProperty('addall')) {
         $array = array_merge_recursive(array(array('id' => 0, 'name' => $this->modx->lexicon('mlmsystem_all'))), $array);
     }
     return parent::outputArray($array, $count);
 }
开发者ID:vgrish,项目名称:mlmsystem,代码行数:8,代码来源:getlist.class.php

示例10: execute

 /**
  * Execute shortcode.
  *
  * @param  Event        $event An event object.
  * @return string|null         Return modified contents.
  */
 public function execute(Event $event)
 {
     /* @var \Grav\Common\Data\Data $options */
     $options = $event['options'];
     /* @var \Grav\Common\Grav $grav */
     $grav = $event['grav'];
     /* @var \Grav\Common\Page\Page $page */
     $page = $event['page'];
     /* @var Config $config */
     $config = $grav['config'];
     $body = trim($event['body']);
     // Mimic \Grav\Common\Page\Page processMarkdown() method
     $defaults = (array) $config->get('system.pages.markdown');
     $defaults = array_merge_recursive($defaults, $this->defaults);
     $options->setDefaults($defaults);
     if (isset($page->header()->markdown)) {
         $options->merge($page->header()->markdown);
     }
     // Initialize the preferred variant of Parsedown
     if ($options->get('extra')) {
         $parsedown = new ParsedownExtra($page, $options->toArray());
     } else {
         $parsedown = new Parsedown($page, $options->toArray());
     }
     $content = $parsedown->text($body);
     return $content;
 }
开发者ID:Sommerregen,项目名称:grav-plugin-shortcodes,代码行数:33,代码来源:Markdown.php

示例11: render

 /**
  * {@inheritDoc}
  */
 public function render($content, array $attribs = [], ElementInterface $element = null, FormInterface $form = null)
 {
     if ($class = $this->getElementStateClass($element, $form)) {
         $attribs = array_merge_recursive(compact('class'), $attribs);
     }
     return parent::render($content, $attribs, $element, $form);
 }
开发者ID:coolms,项目名称:twbs,代码行数:10,代码来源:FormGroup.php

示例12: loadPlugins

 /**
  * Méthode qui charge le fichier plugins.xml
  *
  * @return	null
  * @author	Stephane F
  **/
 public function loadPlugins()
 {
     if (!is_file(path('XMLFILE_PLUGINS'))) {
         return;
     }
     # Mise en place du parseur XML
     $data = implode('', file(path('XMLFILE_PLUGINS')));
     $parser = xml_parser_create(PLX_CHARSET);
     xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
     xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0);
     xml_parse_into_struct($parser, $data, $values, $iTags);
     xml_parser_free($parser);
     # On verifie qu'il existe des tags "plugin"
     if (isset($iTags['plugin'])) {
         # On compte le nombre de tags "plugin"
         $nb = sizeof($iTags['plugin']);
         # On boucle sur $nb
         for ($i = 0; $i < $nb; $i++) {
             $name = $values[$iTags['plugin'][$i]]['attributes']['name'];
             if ($instance = $this->getInstance($name)) {
                 $this->aPlugins[$name] = $instance;
                 $this->aHooks = array_merge_recursive($this->aHooks, $instance->getHooks());
             }
         }
     }
 }
开发者ID:wafflefactor,项目名称:PluXml,代码行数:32,代码来源:class.plx.plugins.php

示例13: indexAction

 public function indexAction()
 {
     /** @var UserInterface $user */
     $user = $this->identity();
     $form = new UserForm($this->entityManager, 'user', $this->config);
     $form->setInputFilter(new ProfileFilter($this->entityManager, $this->config));
     $form->setAttribute('action', $this->url()->fromRoute($this->routes['account']['name'], $this->routes['account']['params'], $this->routes['account']['options'], $this->routes['account']['reuseMatchedParams']));
     $form->bind($user);
     $form->get('submit')->setValue(_('Update'));
     $avatar = $user->getAvatar();
     $request = $this->getRequest();
     if ($request->isPost()) {
         $post = array_merge_recursive($request->getPost()->toArray(), $request->getFiles()->toArray());
         $form->setData($post);
         if ($form->isValid()) {
             if ($user->getAvatar()['error'] == 0) {
                 $user->setAvatar($this->tssImageThumb()->process($user->getAvatar()));
             } else {
                 $user->setAvatar($avatar);
             }
             $this->entityManager->flush();
             $this->flashMessenger()->addInfoMessage(_('Profile updated with success!'));
             return $this->redirect()->toRoute($this->routes['account']['name'], $this->routes['account']['params'], $this->routes['account']['options'], $this->routes['account']['reuseMatchedParams']);
         } else {
             $this->flashMessenger()->addErrorMessage(_('Form with errors!'));
         }
     }
     $form->prepare();
     $viewModel = new ViewModel(array('form' => $form, 'user' => $user, 'routes' => $this->routes));
     return $viewModel;
 }
开发者ID:zetta-code,项目名称:tss-authentication,代码行数:31,代码来源:AccountController.php

示例14: fetchUserRole

 /**
  * Fetch policy list
  * Used by fetch( 'user', 'user_role', hash( 'user_id', $id ) ) template function.
  *
  * @param int $id User id or normal content object id in case of none user object (user group)
  * @return array(string=>array)
  */
 function fetchUserRole($id)
 {
     $user = eZUser::fetch($id);
     if ($user instanceof eZUser) {
         $roleList = $user->roles();
     } else {
         // user group or other non user classes:
         $roleList = eZRole::fetchByUser(array($id), true);
     }
     $accessArray = array();
     foreach (array_keys($roleList) as $roleKey) {
         $role = $roleList[$roleKey];
         $accessArray = array_merge_recursive($accessArray, $role->accessArray(true));
     }
     $resultArray = array();
     foreach ($accessArray as $moduleKey => $module) {
         $moduleName = $moduleKey;
         if ($moduleName != '*') {
             foreach ($module as $functionKey => $function) {
                 $functionName = $functionKey;
                 if ($functionName != '*') {
                     $hasLimitation = true;
                     foreach ($function as $limitationKey) {
                         if ($limitationKey == '*') {
                             $hasLimitation = false;
                             $limitationValue = '*';
                             $resultArray[] = array('moduleName' => $moduleName, 'functionName' => $functionName, 'limitation' => $limitationValue);
                         }
                     }
                     if ($hasLimitation) {
                         foreach ($function as $limitationKey => $limitation) {
                             if ($limitationKey !== '*') {
                                 $policyID = str_replace('p_', '', $limitationKey);
                                 $userRoleIdSeperator = strpos($policyID, '_');
                                 if ($userRoleIdSeperator !== false) {
                                     $policyID = substr($policyID, 0, $userRoleIdSeperator);
                                 }
                                 $limitationValue = eZPolicyLimitation::fetchByPolicyID($policyID);
                                 $resultArray[] = array('moduleName' => $moduleName, 'functionName' => $functionName, 'limitation' => $limitationValue);
                             } else {
                                 $limitationValue = '*';
                                 $resultArray[] = array('moduleName' => $moduleName, 'functionName' => $functionName, 'limitation' => $limitationValue);
                                 break;
                             }
                         }
                     }
                 } else {
                     $limitationValue = '*';
                     $resultArray[] = array('moduleName' => $moduleName, 'functionName' => $functionName, 'limitation' => $limitationValue);
                     break;
                 }
             }
         } else {
             $functionName = '*';
             $resultArray[] = array('moduleName' => '*', 'functionName' => $functionName, 'limitation' => '*');
             break;
         }
     }
     return array('result' => $resultArray);
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:67,代码来源:ezuserfunctioncollection.php

示例15: reconfigureAsset

 /**
  * Reconfigure asset
  * 
  * @return void
  */
 protected function reconfigureAsset()
 {
     $configuredAssetConfig = $this->app['config']->get('assets', []);
     $foundationAssetConfig = $this->app['config']->get('inoplate.foundation.assets', []);
     $assetConfig = array_merge_recursive($configuredAssetConfig, $foundationAssetConfig);
     Assets::config($assetConfig);
 }
开发者ID:inoplate,项目名称:foundation,代码行数:12,代码来源:InoplateServiceProvider.php


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