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


PHP arr::merge方法代码示例

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


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

示例1: set

 public static function set($conference)
 {
     $xml = FreeSwitch::setSection('conferences');
     foreach (Conference::$default_keymap as $action => $digits) {
         $xml->update('/caller-controls/group[@name="default-keymap"]/control[@action="' . $action . '"]{@digits="' . $digits . '"}');
     }
     $xml = FreeSwitch::setSection('conference_profile', $conference['conference_id']);
     $xml->deleteChildren();
     $profile = arr::merge(Conference::$default_profile, $conference['profile']);
     $registry = $conference['registry'];
     foreach ($profile as $parameter => $value) {
         $value = str_replace('/', '\\/', $value);
         if (isset($registry[$parameter])) {
             $value = $registry[$parameter];
         }
         $xml->update('/param[@name="' . $parameter . '"]{@value="' . $value . '"}');
     }
     if (!empty($registry['moh_type'])) {
         $value = str_replace('/', '\\/', $registry['moh_type']);
         $xml->update('/param[@name="moh-sound"]{@value="' . $value . '"}');
     }
     if (empty($conference['pins'])) {
         return;
     }
     foreach ($conference['pins'] as $pin) {
         if (empty($pin)) {
             continue;
         }
         $xml->update('/param[@name="pin"]{@value="' . $pin . '"}');
     }
 }
开发者ID:swk,项目名称:bluebox,代码行数:31,代码来源:conference.php

示例2: render

 public function render($print = FALSE, $renderer = FALSE)
 {
     // Give helpers an entry to this view instance
     self::$instance = $this;
     if ($this->is_set('mustache_template') or stristr($this->kohana_filename, '.mus')) {
         if (isset($this->kohana_local_data['mustache_template']) and $this->kohana_local_data['mustache_template'] === FALSE) {
             return parent::render($print, $renderer);
         }
         $mustache_data = arr::merge(self::$kohana_global_data, $this->kohana_local_data);
         if (empty($this->kohana_local_data['mustache_partials'])) {
             $mustache_partials = array();
         } else {
             $mustache_partials = $this->kohana_local_data['mustache_partials'];
             unset($mustache_data['mustache_partials']);
         }
         $mustache = new Mustache();
         $output = $mustache->render(parent::render(FALSE), $mustache_data, $mustache_partials);
         $output = str_replace(array("\n", '  '), '', $output);
         if (!empty($this->kohana_local_data['mustache_escape_apostrophes'])) {
             $output = str_replace('\'', '\\\'', $output);
         }
         if ($print === TRUE) {
             // Display the output
             echo $output;
             return;
         }
         return $output;
     } else {
         return parent::render($print, $renderer);
     }
 }
开发者ID:swk,项目名称:bluebox,代码行数:31,代码来源:Bluebox_View.php

示例3: createExtension

 public static function createExtension()
 {
     Event::$data += array('voicemail_password' => self::generatePin(), 'voicemail_timezone' => kohana::config('locale.timezone'), 'voicemail_email_all_messages' => empty(Event::$data['user']['email_address']) ? 0 : 1, 'voicemail_delete_file' => 0, 'voicemail_attach_audio_file' => 1, 'voicemail_email_address' => empty(Event::$data['user']['email_address']) ? '' : Event::$data['user']['email_address']);
     extract(Event::$data);
     Doctrine::getTable('Voicemail')->getRecordListener()->get('MultiTenant')->setOption('disabled', TRUE);
     $name_append = '';
     if (!empty($owner_name)) {
         $name_append = ' for ' . $owner_name;
     }
     try {
         $voicemail = new Voicemail();
         $voicemail['name'] = 'VM ' . $extension . $name_append;
         $voicemail['mailbox'] = $extension;
         $voicemail['password'] = $voicemail_password;
         $voicemail['account_id'] = $account_id;
         $voicemail['plugins'] = array('timezone' => array('timezone' => $voicemail_timezone));
         $voicemail['registry'] = array('email_all_messages' => $voicemail_email_all_messages, 'delete_file' => $voicemail_delete_file, 'attach_audio_file' => $voicemail_attach_audio_file, 'email_address' => $voicemail_email_address);
         $voicemail->save();
         $plugin = array('voicemail' => array('mwi_box' => $voicemail['voicemail_id']));
         $device['plugins'] = arr::merge($device['plugins'], $plugin);
     } catch (Exception $e) {
         Doctrine::getTable('Voicemail')->getRecordListener()->get('MultiTenant')->setOption('disabled', FALSE);
         kohana::log('error', 'Unable to generate voicemail for device: ' . $e->getMessage());
         throw $e;
     }
     Doctrine::getTable('Voicemail')->getRecordListener()->get('MultiTenant')->setOption('disabled', FALSE);
 }
开发者ID:swk,项目名称:bluebox,代码行数:27,代码来源:Voicemails.php

示例4: validate

 public function validate(CM_Form_Abstract $form)
 {
     if ($this->_extra_validation) {
         $values = array();
         foreach ($form->get_values() as $name => $value) {
             $values[$name] = $value->get_raw();
             $this->_extra_validation->label($name, $form->get_field($name)->get_label());
         }
         // Validation только read-only, поэтому создаем новый объект
         $this->_extra_validation = $this->_extra_validation->copy($values);
     }
     try {
         $this->get_model()->check($this->_extra_validation);
     } catch (ORM_Validation_Exception $e) {
         $errors = $e->errors('validation');
         if ($external = arr::get($errors, '_external')) {
             $errors = arr::merge($errors, $external);
             unset($errors['_external']);
         }
         foreach ($errors as $name => $error) {
             $form->get_field($name)->set_error($error);
         }
         return FALSE;
     }
     return TRUE;
 }
开发者ID:ariol,项目名称:adminshop,代码行数:26,代码来源:ORM.php

示例5: createExtension

 public static function createExtension()
 {
     Event::$data += array('callerid_internal_name' => Event::$data['owner_name'], 'callerid_external_name' => Event::$data['owner_name'], 'callerid_external_number' => str_pad(Event::$data['extension'], 10, "5", STR_PAD_LEFT));
     extract(Event::$data);
     $plugin = array('callerid' => array('internal_name' => $callerid_internal_name, 'internal_number' => $extension, 'external_name' => $callerid_external_name, 'external_number' => $callerid_external_number));
     $device['plugins'] = arr::merge($device['plugins'], $plugin);
 }
开发者ID:swk,项目名称:bluebox,代码行数:7,代码来源:CidLib.php

示例6: createExtension

 public static function createExtension()
 {
     Event::$data += array('sip_username' => html::token(Event::$data['owner_name']), 'sip_password' => inflector::generatePassword());
     extract(Event::$data);
     $plugin = array('sip' => array('username' => $sip_username, 'password' => $sip_password));
     $device['plugins'] = arr::merge($device['plugins'], $plugin);
 }
开发者ID:swk,项目名称:bluebox,代码行数:7,代码来源:SipLib.php

示例7: dropdown

 public static function dropdown($data, $selected = NULL, $extra = '')
 {
     // standardize the $data as an array, strings default to the class_type
     if (!is_array($data)) {
         $data = array('name' => $data);
     }
     // add in all the defaults if they are not provided
     $defaults = array('null_option' => FALSE, 'default_first' => TRUE, 'unauth_before_auth' => FALSE);
     $data = arr::merge($defaults, $data);
     $options = array();
     $sipinterfaces = Doctrine::getTable('SipInterface')->findAll();
     foreach ($sipinterfaces as $sipinterface) {
         if (!($id = arr::get($sipinterface, 'sipinterface_id')) or !($name = arr::get($sipinterface, 'name'))) {
             continue;
         }
         if ($data['unauth_before_auth'] and !$sipinterface['auth'] or !$data['unauth_before_auth'] and $sipinterface['auth']) {
             arr::unshift_assoc($options, $id, $name);
             continue;
         }
         $options[$id] = $name;
     }
     if ($data['default_first'] and $default_sipinterface = SipInterface::get_default()) {
         unset($options[$default_sipinterface['sipinterface_id']]);
         arr::unshift_assoc($options, $default_sipinterface['sipinterface_id'], $default_sipinterface['name']);
     }
     if ($data['null_option']) {
         arr::unshift_assoc($options, 0, $data['null_option']);
     }
     $data = array_diff($data, $defaults);
     // use kohana helper to generate the markup
     return form::dropdown($data, $options, $selected, $extra);
 }
开发者ID:swk,项目名称:bluebox,代码行数:32,代码来源:sipinterfaces.php

示例8: 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

示例9: ignoreLogLevels

 public static function ignoreLogLevels($ignore)
 {
     if (!is_array($ignore)) {
         $ignore = array($ignore);
     }
     self::$ignore = arr::merge(self::$ignore, $ignore);
 }
开发者ID:swk,项目名称:bluebox,代码行数:7,代码来源:Message.php

示例10: determineUninstallOrder

 public static function determineUninstallOrder()
 {
     self::$uninstallOrder = array();
     $dependencies = self::listDependencies();
     $catalog = Package_Catalog::getCatalog();
     foreach ($catalog as $id => $package) {
         $reliance = self::graphReliance($dependencies, $package['packageName']);
         self::$uninstallOrder = arr::merge(self::$uninstallOrder, $reliance);
     }
     self::$uninstallOrder = array_unique(self::$uninstallOrder);
     self::$uninstallOrder = array_flip(self::$uninstallOrder);
 }
开发者ID:swk,项目名称:bluebox,代码行数:12,代码来源:Graph.php

示例11: __construct

 /**
  * Intialize migration library
  *
  * @param   bool   Do we want output of migration steps?
  * @param   string Database group
  */
 public function __construct($config = NULL)
 {
     $this->config = arr::merge(Kohana::$config->load('migrations')->as_array(), (array) $config);
     $database = Kohana::$config->load('database.' . Arr::get(Kohana::$config->load('migrations'), 'database', 'default'));
     // Set the driver class name
     $driver = 'Migration_Driver_' . ucfirst($database['type']);
     // Create the database connection instance
     $this->driver = new $driver(Arr::get(Kohana::$config->load('migrations'), 'database', 'default'));
     $this->driver->versions()->init();
     if (!is_dir($this->config['path'])) {
         mkdir($this->config['path'], 0777, TRUE);
     }
 }
开发者ID:roissard,项目名称:timestamped-migrations,代码行数:19,代码来源:migrations.php

示例12: view_category

 protected function view_category($id = 1, $t = NULL)
 {
     if (!isset($this->list[$id])) {
         return array();
     }
     $result = array();
     $tmp = $this->list[$id];
     $result[$tmp['id']] = trim($t . ' ' . $tmp['title']);
     if (array_key_exists($tmp['id'], $this->parent)) {
         foreach ($this->parent[$tmp['id']] as $v) {
             $result = arr::merge($result, $this->view_category($v, $t . $this->dash));
         }
     }
     return $result;
 }
开发者ID:TdroL,项目名称:hurtex,代码行数:15,代码来源:category.php

示例13: dropdown

 public static function dropdown($data, $selected = NULL, $extra = '')
 {
     // standardize the $data as an array, strings default to the class_type
     if (!is_array($data)) {
         $data = array('name' => $data);
     }
     // add in all the defaults if they are not provided
     $defaults = array('nullOption' => FALSE);
     $data = arr::merge($defaults, $data);
     $options = TTSEngine::catalog();
     if ($data['nullOption']) {
         array_unshift($options, $data['nullOption']);
     }
     $data = array_diff($data, $defaults);
     // use kohana helper to generate the markup
     return form::dropdown($data, $options, $selected, $extra);
 }
开发者ID:swk,项目名称:bluebox,代码行数:17,代码来源:tts.php

示例14: main_right_tabs

 /**
  * Generate Main Tab Menus (RIGHT SIDE)
  */
 public static function main_right_tabs($user = FALSE)
 {
     $main_right_tabs = array();
     // Change tabs for MHI
     if (Kohana::config('config.enable_mhi') == TRUE and Kohana::config('settings.subdomain') == '') {
         $main_right_tabs = array('users' => Kohana::lang('ui_admin.users'), 'mhi/settings' => Kohana::lang('ui_admin.settings'));
     } else {
         // Build the tabs array depending on the role permissions for each section
         if ($user) {
             // Check permissions for settings panel
             $main_right_tabs = Auth::instance()->has_permission('settings', $user) ? arr::merge($main_right_tabs, array('settings/site' => Kohana::lang('ui_admin.settings'))) : $main_right_tabs;
             // Check permissions for the manage panel
             $main_right_tabs = Auth::instance()->has_permission('manage', $user) ? arr::merge($main_right_tabs, array('manage' => Kohana::lang('ui_admin.manage'))) : $main_right_tabs;
             // Check permissions for users panel
             $main_right_tabs = Auth::instance()->has_permission('users', $user) ? arr::merge($main_right_tabs, array('users' => Kohana::lang('ui_admin.users'))) : $main_right_tabs;
         }
     }
     return $main_right_tabs;
 }
开发者ID:nanangsyaifudin,项目名称:HAC-2012,代码行数:22,代码来源:admin.php

示例15: meta_data

 /**
  * Load addon Information from readme.txt file
  *
  * @param   string addon name
  * @param   string addon type
  * @param   array  default meta data
  * @return  array
  */
 public static function meta_data($addon, $type, $defaults = array())
 {
     $base = $type == 'plugin' ? PLUGINPATH : THEMEPATH;
     // Determine if readme.txt (Case Insensitive) exists
     $file = $base . $addon . "/readme.txt";
     if (file::file_exists_i($file, $file)) {
         $fp = fopen($file, 'r');
         // Pull only the first 8kiB of the file in.
         $file_data = fread($fp, 8192);
         fclose($fp);
         preg_match_all('/^(.*):(.*)$/mU', $file_data, $matches, PREG_PATTERN_ORDER);
         $meta_data = array_combine(array_map('trim', $matches[1]), array_map('trim', $matches[2]));
         foreach (array('png', 'gif', 'jpg', 'jpeg') as $ext) {
             if (file_exists($base . $addon . "/screenshot.{$ext}")) {
                 $meta_data['Screenshot'] = "screenshot.{$ext}";
                 break;
             }
         }
         return arr::merge($defaults, $meta_data);
     }
     return false;
 }
开发者ID:rjmackay,项目名称:Ushahidi_Web,代码行数:30,代码来源:addon.php


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