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


PHP array_merge函数代码示例

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


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

示例1: __construct

 /**
  * Parser constructor
  * @param array $options An options array
  * @throws Exception if the required option uniqueNode isn't set
  */
 public function __construct(array $options = array())
 {
     $this->options = array_merge(array("extractContainer" => false), $options);
     if (!isset($this->options["uniqueNode"])) {
         throw new Exception("Required option 'uniqueNode' not set");
     }
 }
开发者ID:estrategasdigitales,项目名称:rufiatta,代码行数:12,代码来源:UniqueNode.php

示例2: procesar

 function procesar()
 {
     toba::logger_ws()->debug('Servicio Llamado: ' . $this->info['basica']['item']);
     toba::logger_ws()->set_checkpoint();
     set_error_handler('toba_logger_ws::manejador_errores_recuperables', E_ALL);
     $this->validar_componente();
     //-- Pide los datos para construir el componente, WSF no soporta entregar objetos creados
     $clave = array();
     $clave['proyecto'] = $this->info['objetos'][0]['objeto_proyecto'];
     $clave['componente'] = $this->info['objetos'][0]['objeto'];
     list($tipo, $clase, $datos) = toba_constructor::get_runtime_clase_y_datos($clave, $this->info['objetos'][0]['clase'], false);
     agregar_dir_include_path(toba_dir() . '/php/3ros/wsf');
     $opciones_extension = toba_servicio_web::_get_opciones($this->info['basica']['item'], $clase);
     $wsdl = strpos($_SERVER['REQUEST_URI'], "?wsdl") !== false;
     $sufijo = 'op__';
     $metodos = array();
     $reflexion = new ReflectionClass($clase);
     foreach ($reflexion->getMethods() as $metodo) {
         if (strpos($metodo->name, $sufijo) === 0) {
             $servicio = substr($metodo->name, strlen($sufijo));
             $prefijo = $wsdl ? '' : '_';
             $metodos[$servicio] = $prefijo . $metodo->name;
         }
     }
     $opciones = array();
     $opciones['serviceName'] = $this->info['basica']['item'];
     $opciones['classes'][$clase]['operations'] = $metodos;
     $opciones = array_merge($opciones, $opciones_extension);
     $this->log->debug("Opciones del servidor: " . var_export($opciones, true), 'toba');
     $opciones['classes'][$clase]['args'] = array($datos);
     toba::logger_ws()->set_checkpoint();
     $service = new WSService($opciones);
     $service->reply();
     $this->log->debug("Fin de servicio web", 'toba');
 }
开发者ID:emma5021,项目名称:toba,代码行数:35,代码来源:toba_solicitud_servicio_web.php

示例3: inet6_expand

/**
 * Expand an IPv6 Address
 *
 * This will take an IPv6 address written in short form and expand it to include all zeros. 
 *
 * @param  string  $addr A valid IPv6 address
 * @return string  The expanded notation IPv6 address
 */
function inet6_expand($addr)
{
    /* Check if there are segments missing, insert if necessary */
    if (strpos($addr, '::') !== false) {
        $part = explode('::', $addr);
        $part[0] = explode(':', $part[0]);
        $part[1] = explode(':', $part[1]);
        $missing = array();
        for ($i = 0; $i < 8 - (count($part[0]) + count($part[1])); $i++) {
            array_push($missing, '0000');
        }
        $missing = array_merge($part[0], $missing);
        $part = array_merge($missing, $part[1]);
    } else {
        $part = explode(":", $addr);
    }
    // if .. else
    /* Pad each segment until it has 4 digits */
    foreach ($part as &$p) {
        while (strlen($p) < 4) {
            $p = '0' . $p;
        }
    }
    // foreach
    unset($p);
    /* Join segments */
    $result = implode(':', $part);
    /* Quick check to make sure the length is as expected */
    if (strlen($result) == 39) {
        return $result;
    } else {
        return false;
    }
    // if .. else
}
开发者ID:samburney,项目名称:pdns-backend-phpautoreverse,代码行数:43,代码来源:ipv6_functions.php

示例4: onls

 function onls()
 {
     $logdir = UC_ROOT . 'data/logs/';
     $dir = opendir($logdir);
     $logs = $loglist = array();
     while ($entry = readdir($dir)) {
         if (is_file($logdir . $entry) && strpos($entry, '.php') !== FALSE) {
             $logs = array_merge($logs, file($logdir . $entry));
         }
     }
     closedir($dir);
     $logs = array_reverse($logs);
     foreach ($logs as $k => $v) {
         if (count($v = explode("\t", $v)) > 1) {
             $v[3] = $this->date($v[3]);
             $v[4] = $this->lang[$v[4]];
             $loglist[$k] = $v;
         }
     }
     $page = max(1, intval($_GET['page']));
     $start = ($page - 1) * UC_PPP;
     $num = count($loglist);
     $multipage = $this->page($num, UC_PPP, $page, 'admin.php?m=log&a=ls');
     $loglist = array_slice($loglist, $start, UC_PPP);
     $this->view->assign('loglist', $loglist);
     $this->view->assign('multipage', $multipage);
     $this->view->display('admin_log');
 }
开发者ID:tang86,项目名称:discuz-utf8,代码行数:28,代码来源:log.php

示例5: __construct

 public function __construct(Session $session, $conf = array())
 {
     $this->session = $session;
     $this->config = array('width' => 100, 'height' => 20, 'bg_red' => 238, 'bg_green' => 255, 'bg_blue' => 255, 'bg_transparent' => true, 'bg_img' => false, 'bg_border' => false, 'char_red' => 0, 'char_green' => 0, 'char_blue' => 0, 'char_random_color' => true, 'char_random_color_lvl' => 2, 'char_transparent' => 10, 'char_px_spacing' => 20, 'char_min_size' => 14, 'char_max_size' => 14, 'char_max_rot_angle' => 30, 'char_vertical_offset' => true, 'char_fonts' => array('luggerbu.ttf'), 'char_fonts_dir' => __DIR__ . '/Resources/fonts', 'chars_used' => 'ABCDEFGHKLMNPRTWXYZ234569', 'easy_captcha' => false, 'easy_captcha_vowels' => 'AEIOUY', 'easy_captcha_consonants' => 'BCDFGHKLMNPRTVWXZ', 'easy_captcha_bool' => rand(0, 1), 'case_sensitive' => false, 'min_chars' => 3, 'max_chars' => 4, 'brush_size' => 1, 'format' => 'png', 'hash_algo' => 'sha1', 'flood_timer' => 0, 'max_refresh' => 1000, 'effect_blur' => false, 'effect_greyscale' => false, 'noise_min_px' => 0, 'noise_max_px' => 0, 'noise_min_lines' => 0, 'noise_max_lines' => 0, 'noise_min_circles' => 0, 'noise_max_circles' => 0, 'noise_color' => 3, 'noise_on_top' => false, 'error_images_dir' => __DIR__ . '/Resources/error', 'test_queries_flood' => false);
     if (count($conf)) {
         $this->config = array_merge($this->config, $conf);
     }
     if (true === $this->config['test_queries_flood']) {
         if ($this->testQueries() && $this->testLastRequest()) {
             $this->config['constructor_test'] = true;
         } else {
             $this->config['constructor_test'] = false;
             if (!$this->testQueries()) {
                 $this->config['constructor_error_reason'] = 'Error - too many queries';
                 $this->config['constructor_error_message'] = 'too_many';
             } elseif (!$this->testLastRequest()) {
                 $this->config['constructor_error_reason'] = 'Error - refreshing too fast';
                 $this->config['constructor_error_message'] = 'refresh';
             } else {
                 $this->config['constructor_error_reason'] = 'Error - unknown reason';
                 $this->config['constructor_error_message'] = 'unknown';
             }
             return false;
         }
     } else {
         $this->config['constructor_test'] = true;
     }
 }
开发者ID:verschoof,项目名称:CaptchaBundle-1,代码行数:28,代码来源:Captcha.php

示例6: actionEdit

 public function actionEdit($id)
 {
     $this->pageTitle = Yii::t('app', 'Редактирование категории');
     $model = ShopCategories::model()->findByPk($id);
     if (!$model) {
         throw new CHttpException(404, Yii::t('app', 'Категория не найдена'));
     }
     //var_dump($model->url);die;
     // var_dump($model->path);die;
     //var_dump($model->breadcrumbs);
     //die;
     $this->breadcrumbs = array_merge($this->breadcrumbs, array('Редактирование категории "' . $model->title . '"'));
     $possibleParents = $model->getPossibleParents();
     if (!empty($_POST) && array_key_exists('ShopCategories', $_POST)) {
         $this->performAjaxValidation($model);
         $model->attributes = $_POST['ShopCategories'];
         //var_dump($model->attributes);die;
         if ($model->validate()) {
             if ($model->save()) {
                 Yii::app()->user->setFlash('success', 'Категория "' . $model->title . '" успешно отредактирована');
                 Yii::app()->request->redirect($this->createUrl('index'));
             }
         }
     }
     //var_dump($possibleParents);die;
     $this->render('edit', array('model' => $model, 'possibleParents' => $possibleParents));
 }
开发者ID:Wiedzal,项目名称:narisuemvse,代码行数:27,代码来源:CategoriesController.php

示例7: global_filter

/**
 * 全局安全过滤函数
 * 支持SQL注入和跨站脚本攻击
 */
function global_filter()
{
    //APP,ACT 分别为控制器和控制器方法
    $params = array(APP, ACT);
    foreach ($params as $k => $v) {
        if (!preg_match("/^[a-zA-Z0-9_-]+\$/", $v)) {
            header_status_404();
        }
    }
    $arrStr = array('%0d%0a', "'", '<', '>', '$', 'script', 'document', 'eval', 'atestu', 'select', 'insert?into', 'delete?from');
    global_inject_input($_SERVER['HTTP_REFERER'], $arrStr, true);
    global_inject_input($_SERVER['HTTP_USER_AGENT'], $arrStr, true);
    global_inject_input($_SERVER['HTTP_ACCEPT_LANGUAGE'], $arrStr, true);
    global_inject_input($_GET, array_merge($arrStr, array('"')), true);
    //global_inject_input($_COOKIE, array_merge($arrStr, array('"', '&')), true);
    //cookie会有对url的记录(pGClX_last_url)。去掉对&的判断
    global_inject_input($_COOKIE, array_merge($arrStr, array('"')), true);
    global_inject_input($_SERVER, array('%0d%0a'), true);
    //处理跨域POST提交问题
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        //处理客户端POST请求处理没有HTTP_REFERER参数问题
        if (isset($_SERVER['HTTP_REFERER'])) {
            $url = parse_url($_SERVER['HTTP_REFERER']);
            $referer_host = !empty($url['port']) && $url['port'] != '80' ? $url['host'] . ':' . $url['port'] : $url['host'];
            if ($referer_host != $_SERVER['HTTP_HOST']) {
                header_status_404();
            }
        }
    }
    global_inject_input($_POST, array('%0d%0a'));
    global_inject_input($_REQUEST, array('%0d%0a'));
}
开发者ID:w5678912345,项目名称:Web-Security-Filter,代码行数:36,代码来源:security_filter.php

示例8: test

 public function test(CqmPatient $patient, $beginDate, $endDate)
 {
     // See if user has been a tobacco user before or simultaneosly to the encounter within two years (24 months)
     $date_array = array();
     foreach ($this->getApplicableEncounters() as $encType) {
         $dates = Helper::fetchEncounterDates($encType, $patient, $beginDate, $endDate);
         $date_array = array_merge($date_array, $dates);
     }
     // sort array to get the most recent encounter first
     $date_array = array_unique($date_array);
     rsort($date_array);
     // go through each unique date from most recent
     foreach ($date_array as $date) {
         // encounters time stamp is always 00:00:00, so change it to 23:59:59 or 00:00:00 as applicable
         $date = date('Y-m-d 23:59:59', strtotime($date));
         $beginMinus24Months = strtotime('-24 month', strtotime($date));
         $beginMinus24Months = date('Y-m-d 00:00:00', $beginMinus24Months);
         // this is basically a check to see if the patient is an reported as an active smoker on their last encounter
         if (Helper::check(ClinicalType::CHARACTERISTIC, Characteristic::TOBACCO_USER, $patient, $beginMinus24Months, $date)) {
             return true;
         } else {
             if (Helper::check(ClinicalType::CHARACTERISTIC, Characteristic::TOBACCO_NON_USER, $patient, $beginMinus24Months, $date)) {
                 return false;
             } else {
                 // nothing reported during this date period, so move on to next encounter
             }
         }
     }
     return false;
 }
开发者ID:katopenzz,项目名称:openemr,代码行数:30,代码来源:Denominator.php

示例9: getEndpointFromFields

 /**
  * @param array $fields
  * @return array|null
  */
 public static function getEndpointFromFields(array $fields)
 {
     $arEndpointList = null;
     $fieldsTmp = array();
     foreach ($fields as $moduleId => $arConnectorSettings) {
         if (is_numeric($moduleId)) {
             $moduleId = '';
         }
         foreach ($arConnectorSettings as $connectorCode => $arConnectorFields) {
             foreach ($arConnectorFields as $k => $arFields) {
                 if (isset($fieldsTmp[$moduleId][$connectorCode][$k]) && is_array($arFields)) {
                     $fieldsTmp[$moduleId][$connectorCode][$k] = array_merge($fieldsTmp[$moduleId][$connectorCode][$k], $arFields);
                 } else {
                     $fieldsTmp[$moduleId][$connectorCode][$k] = $arFields;
                 }
             }
         }
     }
     foreach ($fieldsTmp as $moduleId => $arConnectorSettings) {
         if (is_numeric($moduleId)) {
             $moduleId = '';
         }
         foreach ($arConnectorSettings as $connectorCode => $arConnectorFields) {
             foreach ($arConnectorFields as $arFields) {
                 $arEndpoint = array();
                 $arEndpoint['MODULE_ID'] = $moduleId;
                 $arEndpoint['CODE'] = $connectorCode;
                 $arEndpoint['FIELDS'] = $arFields;
                 $arEndpointList[] = $arEndpoint;
             }
         }
     }
     return $arEndpointList;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:38,代码来源:connectormanager.php

示例10: get_form

 function get_form($step, $data = array(), $files = array(), $opts = array())
 {
     $opts['prefix'] = $this->prefix_for_step($step);
     $opts = array_merge($opts, $this->get_form_opts($step));
     $f = new $this->steps[$step]($data, $files, $opts);
     return $f;
 }
开发者ID:bcampbell,项目名称:journalisted,代码行数:7,代码来源:wizard.php

示例11: initialize

 /**
  * Initialize the provider
  *
  * @return void
  */
 public function initialize()
 {
     $this->options = array_merge($this->defaultConfig, $this->options);
     date_default_timezone_set($this->options['log.timezone']);
     // Finally, create a formatter
     $formatter = new LineFormatter($this->options['log.outputformat'], $this->options['log.dateformat'], false);
     // Create a new directory
     $logPath = realpath($this->app->config('bono.base.path')) . '/' . $this->options['log.path'];
     if (!is_dir($logPath)) {
         mkdir($logPath, 0755);
     }
     // Create a handler
     $stream = new StreamHandler($logPath . '/' . date($this->options['log.fileformat']) . '.log');
     // Set our formatter
     $stream->setFormatter($formatter);
     // Create LogWriter
     $logger = new LogWriter(array('name' => $this->options['log.name'], 'handlers' => array($stream), 'processors' => array(new WebProcessor())));
     // Bind our logger to Bono Container
     $this->app->container->singleton('log', function ($c) {
         $log = new Log($c['logWriter']);
         $log->setEnabled($c['settings']['log.enabled']);
         $log->setLevel($c['settings']['log.level']);
         $env = $c['environment'];
         $env['slim.log'] = $log;
         return $log;
     });
     // Set the writer
     $this->app->config('log.writer', $logger);
 }
开发者ID:krisanalfa,项目名称:b-comp,代码行数:34,代码来源:LogProvider.php

示例12: doDisplay

 protected function doDisplay(array $context, array $blocks = array())
 {
     $__internal_6011e44fda209c22bd3a3f9e0022a24cfc2874076efa8f001603f24a1733d3fe = $this->env->getExtension("native_profiler");
     $__internal_6011e44fda209c22bd3a3f9e0022a24cfc2874076efa8f001603f24a1733d3fe->enter($__internal_6011e44fda209c22bd3a3f9e0022a24cfc2874076efa8f001603f24a1733d3fe_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template", "FSPBundle:Theme:cours.html.twig"));
     $this->parent->display($context, array_merge($this->blocks, $blocks));
     $__internal_6011e44fda209c22bd3a3f9e0022a24cfc2874076efa8f001603f24a1733d3fe->leave($__internal_6011e44fda209c22bd3a3f9e0022a24cfc2874076efa8f001603f24a1733d3fe_prof);
 }
开发者ID:SLAMAndreaGael,项目名称:FSP,代码行数:7,代码来源:c7f3519f90af54cfaf7ce5b678c8722f406619dd3758042c44941e8b3913f3a7.php

示例13: getFormattedMapping

 public function getFormattedMapping($data, $sep = '')
 {
     $return = array();
     if ($sep != '') {
         $sep .= '/';
     }
     if (!is_array($data)) {
         return $data;
     }
     foreach ($data as $key => $value) {
         if (!is_array($value)) {
             $return[$sep . $key] = $value;
         } elseif (count($value) == 0) {
             $return[$sep . $key . '/...'] = array();
         } elseif (isset($value[0])) {
             if (is_string($value[0])) {
                 $return[$sep . $key] = $value[0];
             } else {
                 $return = array_merge($return, $this->getFormattedMapping($value[0], $sep . $key . '/...'));
             }
         } else {
             $return = array_merge($return, $this->getFormattedMapping($value, $sep . $key));
         }
     }
     return $return;
 }
开发者ID:am-impact,项目名称:FeedMe,代码行数:26,代码来源:FeedMe_FeedService.php

示例14: doClean

 protected function doClean($values)
 {
     $username = isset($values[$this->getOption('username_field')]) ? $values[$this->getOption('username_field')] : '';
     $password = isset($values[$this->getOption('password_field')]) ? $values[$this->getOption('password_field')] : '';
     $allowEmail = sfConfig::get('app_sf_guard_plugin_allow_login_with_email', true);
     $method = $allowEmail ? 'retrieveByUsernameOrEmailAddress' : 'retrieveByUsername';
     // don't allow to sign in with an empty username
     if ($username) {
         if ($callable = sfConfig::get('app_sf_guard_plugin_retrieve_by_username_callable')) {
             $user = call_user_func_array($callable, array($username));
         } else {
             $user = $this->getTable()->retrieveByUsername($username);
         }
         // user exists?
         if ($user) {
             // password is ok?
             if ($user->getIsActive() && $user->checkPassword($password)) {
                 return array_merge($values, array('user' => $user));
             }
         }
     }
     if ($this->getOption('throw_global_error')) {
         throw new sfValidatorError($this, 'invalid');
     }
     throw new sfValidatorErrorSchema($this, array($this->getOption('username_field') => new sfValidatorError($this, 'invalid')));
 }
开发者ID:laiello,项目名称:tesiscdfeg12,代码行数:26,代码来源:sfGuardValidatorUser.class.php

示例15: index

 function index()
 {
     $path = \GCore\C::get('GCORE_ADMIN_PATH') . 'extensions' . DS . 'chronoforms' . DS;
     $files = \GCore\Libs\Folder::getFiles($path, true);
     $strings = array();
     //function to prepare strings
     $prepare = function ($str) {
         /*$path = \GCore\C::get('GCORE_FRONT_PATH');
         		if(strpos($str, $path) !== false AND strpos($str, $path) == 0){
         			return '//'.str_replace($path, '', $str);
         		}*/
         $val = !empty(\GCore\Libs\Lang::$translations[$str]) ? \GCore\Libs\Lang::$translations[$str] : '';
         return 'const ' . trim($str) . ' = "' . str_replace("\n", '\\n', $val) . '";';
     };
     foreach ($files as $file) {
         if (substr($file, -4, 4) == '.php') {
             // AND strpos($file, DS.'extensions'.DS) === TRUE){
             //$strings[] = $file;
             $file_code = file_get_contents($file);
             preg_match_all('/l_\\(("|\')([^(\\))]*?)("|\')\\)/i', $file_code, $langs);
             if (!empty($langs[2])) {
                 $strings = array_merge($strings, $langs[2]);
             }
         }
     }
     $strings = array_unique($strings);
     $strings = array_map($prepare, $strings);
     echo '<textarea rows="20" cols="80">' . implode("\n", $strings) . '</textarea>';
 }
开发者ID:ejailesb,项目名称:repo_empr,代码行数:29,代码来源:langs.php


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