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


PHP General::array_map_recursive方法代码示例

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


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

示例1: setArray

 /**
  * A quick way to set a large number of properties. Given an associative
  * array or a nested associative array (where the key will be the group),
  * this function will merge the `$array` with the existing configuration.
  * By default the given `$array` will overwrite any existing keys unless
  * the `$overwrite` parameter is passed as false.
  *
  * @since Symphony 2.3.2 The `$overwrite` parameter is available
  * @param array $array
  *  An associative array of properties, 'property' => 'value' or
  *  'group' => array('property' => 'value')
  * @param boolean $overwrite
  *  An optional boolean parameter to indicate if it is safe to use array_merge
  *  or if the provided array should be integrated using the 'set()' method
  *  to avoid possible change collision. Defaults to false.
  */
 public function setArray(array $array, $overwrite = false)
 {
     $array = General::array_map_recursive('stripslashes', $array);
     if ($overwrite) {
         $this->_properties = array_merge($this->_properties, $array);
     } else {
         foreach ($array as $set => $values) {
             foreach ($values as $key => $val) {
                 self::set($key, $val, $set);
             }
         }
     }
 }
开发者ID:davjand,项目名称:codecept-symphonycms-db,代码行数:29,代码来源:class.configuration.php

示例2: __buildPage

    /**
     * This function sets the page's parameters, processes the Datasources and
     * Events and sets the `$xml` and `$xsl` variables. This functions resolves the `$page`
     * by calling the `resolvePage()` function. If a page is not found, it attempts
     * to locate the Symphony 404 page set in the backend otherwise it throws
     * the default Symphony 404 page. If the page is found, the page's XSL utility
     * is found, and the system parameters are set, including any URL parameters,
     * params from the Symphony cookies. Events and Datasources are executed and
     * any parameters  generated by them are appended to the existing parameters
     * before setting the Page's XML and XSL variables are set to the be the
     * generated XML (from the Datasources and Events) and the XSLT (from the
     * file attached to this Page)
     *
     * @uses FrontendPageResolved
     * @uses FrontendParamsResolve
     * @uses FrontendParamsPostResolve
     * @see resolvePage()
     */
    private function __buildPage()
    {
        $start = precision_timer();
        if (!($page = $this->resolvePage())) {
            throw new FrontendPageNotFoundException();
        }
        /**
         * Just after having resolved the page, but prior to any commencement of output creation
         * @delegate FrontendPageResolved
         * @param string $context
         * '/frontend/'
         * @param FrontendPage $page
         *  An instance of this class, passed by reference
         * @param array $page_data
         *  An associative array of page data, which is a combination from `tbl_pages` and
         *  the path of the page on the filesystem. Passed by reference
         */
        Symphony::ExtensionManager()->notifyMembers('FrontendPageResolved', '/frontend/', array('page' => &$this, 'page_data' => &$page));
        $this->_pageData = $page;
        $path = explode('/', $page['path']);
        $root_page = is_array($path) ? array_shift($path) : $path;
        $current_path = explode(dirname($_SERVER['SCRIPT_NAME']), $_SERVER['REQUEST_URI'], 2);
        $current_path = '/' . ltrim(end($current_path), '/');
        $split_path = explode('?', $current_path, 3);
        $current_path = rtrim(current($split_path), '/');
        $querystring = '?' . next($split_path);
        // Get max upload size from php and symphony config then choose the smallest
        $upload_size_php = ini_size_to_bytes(ini_get('upload_max_filesize'));
        $upload_size_sym = Symphony::Configuration()->get('max_upload_size', 'admin');
        $date = new DateTime();
        $this->_param = array('today' => $date->format('Y-m-d'), 'current-time' => $date->format('H:i'), 'this-year' => $date->format('Y'), 'this-month' => $date->format('m'), 'this-day' => $date->format('d'), 'timezone' => $date->format('P'), 'website-name' => Symphony::Configuration()->get('sitename', 'general'), 'page-title' => $page['title'], 'root' => URL, 'workspace' => URL . '/workspace', 'root-page' => $root_page ? $root_page : $page['handle'], 'current-page' => $page['handle'], 'current-page-id' => $page['id'], 'current-path' => $current_path == '' ? '/' : $current_path, 'parent-path' => '/' . $page['path'], 'current-query-string' => self::sanitizeParameter($querystring), 'current-url' => URL . $current_path, 'upload-limit' => min($upload_size_php, $upload_size_sym), 'symphony-version' => Symphony::Configuration()->get('version', 'symphony'));
        if (isset($this->_env['url']) && is_array($this->_env['url'])) {
            foreach ($this->_env['url'] as $key => $val) {
                $this->_param[$key] = $val;
            }
        }
        if (is_array($_GET) && !empty($_GET)) {
            foreach ($_GET as $key => $val) {
                if (in_array($key, array('symphony-page', 'debug', 'profile'))) {
                    continue;
                }
                // If the browser sends encoded entities for &, ie. a=1&b=2
                // this causes the $_GET to output they key as amp;b, which results in
                // $url-amp;b. This pattern will remove amp; allow the correct param
                // to be used, $url-b
                $key = preg_replace('/(^amp;|\\/)/', null, $key);
                // If the key gets replaced out then it will break the XML so prevent
                // the parameter being set.
                if (!General::createHandle($key)) {
                    continue;
                }
                // Handle ?foo[bar]=hi as well as straight ?foo=hi RE: #1348
                if (is_array($val)) {
                    $val = General::array_map_recursive(array('FrontendPage', 'sanitizeParameter'), $val);
                } else {
                    $val = self::sanitizeParameter($val);
                }
                $this->_param['url-' . $key] = $val;
            }
        }
        if (is_array($_COOKIE[__SYM_COOKIE_PREFIX__]) && !empty($_COOKIE[__SYM_COOKIE_PREFIX__])) {
            foreach ($_COOKIE[__SYM_COOKIE_PREFIX__] as $key => $val) {
                $this->_param['cookie-' . $key] = $val;
            }
        }
        // Flatten parameters:
        General::flattenArray($this->_param);
        // Add Page Types to parameters so they are not flattened too early
        $this->_param['page-types'] = $page['type'];
        /**
         * Just after having resolved the page params, but prior to any commencement of output creation
         * @delegate FrontendParamsResolve
         * @param string $context
         * '/frontend/'
         * @param array $params
         *  An associative array of this page's parameters
         */
        Symphony::ExtensionManager()->notifyMembers('FrontendParamsResolve', '/frontend/', array('params' => &$this->_param));
        $xml_build_start = precision_timer();
        $xml = new XMLElement('data');
        $xml->setIncludeHeader(true);
        $events = new XMLElement('events');
//.........这里部分代码省略.........
开发者ID:hananils,项目名称:pompodium,代码行数:101,代码来源:class.frontendpage.php

示例3: __buildParams

 protected function __buildParams($params)
 {
     if (!is_array($params) || empty($params)) {
         return;
     }
     $params = General::array_map_recursive(array('General', 'sanitize'), $params);
     $wrapper = new XMLElement('div');
     $wrapper->setAttribute('id', 'params');
     $table = new XMLElement('table');
     foreach ($params as $key => $value) {
         $value = is_array($value) ? implode(', ', $value) : $value;
         $row = new XMLElement('tr');
         $row->appendChild(new XMLElement('th', "\${$key}"));
         $row->appendChild(new XMLElement('td', "'{$value}'"));
         $table->appendChild($row);
     }
     $wrapper->appendChild($table);
     return $wrapper;
 }
开发者ID:davjand,项目名称:codecept-symphonycms-db,代码行数:19,代码来源:content.debug.php

示例4: setArray

 /**
  * A quick way to set a large number of properties. Given an array that may
  * contain 'property' => 'value' or 'group' => array('property' => 'value') or
  * a combination of both, this will PHP's array_merge with `$this->_properties`
  *
  * @param array $array
  *  An associative array of properties, 'property' => 'value' or 'group' => array(
  *  'property' => 'value'
  */
 public function setArray(array $array)
 {
     $array = General::array_map_recursive('stripslashes', $array);
     $this->_properties = array_merge($this->_properties, $array);
 }
开发者ID:bauhouse,项目名称:Piano-Sonata,代码行数:14,代码来源:class.configuration.php


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