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


PHP Registry::save方法代码示例

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


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

示例1: deleteTemplatesCache

 /**
  * Removes compiled block templates
  * @return bool
  */
 public static function deleteTemplatesCache()
 {
     static $is_deleted = false;
     if (!$is_deleted) {
         // mark cache as outdated
         Registry::setChangedTables('bm_blocks');
         // run cache routines
         Registry::save();
         $is_deleted = true;
     }
     return $is_deleted;
 }
开发者ID:arpad9,项目名称:bygmarket,代码行数:16,代码来源:RenderManager.php

示例2: fn_redirect


//.........这里部分代码省略.........
        if (!empty($https_path) && substr($location, 0, strlen($https_path)) == $https_path) {
            // if https path partially equal to http path check if https path is not just a part of http path
            // e. g. http://example.com/pathsimple & https://example.com/path
            if ($_protocol != 'http' || empty($http_path) || substr($http_path, 0, strlen($https_path)) != $https_path) {
                $_location = substr($location, strlen($https_path) + 1);
                $_protocol = 'https';
            }
        }
        $protocol = Registry::get('config.http_path') != Registry::get('config.https_path') && !empty($_protocol) ? $_protocol : $protocol;
        $location = !empty($_protocol) ? $_location : $location;
    }
    if ($external_redirect == false) {
        fn_set_hook('redirect', $location);
        $protocol_changed = defined('HTTPS') && $protocol == 'http' || !defined('HTTPS') && $protocol == 'https';
        // For correct redirection, location must be absolute with path
        $location = ($protocol == 'http' ? Registry::get('config.http_location') : Registry::get('config.https_location')) . '/' . ltrim($location, '/');
        // Parse the query string
        $fragment = '';
        $query_array = array();
        $parsed_location = parse_url($location);
        if (!empty($parsed_location['query'])) {
            parse_str($parsed_location['query'], $query_array);
            $location = str_replace('?' . $parsed_location['query'], '', $location);
        }
        if (!empty($parsed_location['fragment'])) {
            $fragment = '#' . $parsed_location['fragment'];
            $location = str_replace($fragment, '', $location);
        }
        if ($protocol_changed && (Registry::get('config.http_host') != Registry::get('config.https_host') || Registry::get('config.http_path') != Registry::get('config.https_path'))) {
            $query_array[Session::getName()] = Session::getId();
        }
        // If this is not ajax request, remove ajax specific parameters
        if (!defined('AJAX_REQUEST')) {
            unset($query_array['is_ajax']);
            unset($query_array['result_ids']);
        } else {
            $query_array['result_ids'] = implode(',', Tygh::$app['ajax']->result_ids);
            $query_array['is_ajax'] = Tygh::$app['ajax']->redirect_type;
            $query_array['full_render'] = !empty($_REQUEST['full_render']) ? $_REQUEST['full_render'] : false;
            $query_array['callback'] = Tygh::$app['ajax']->callback;
            $ajax_assigned_vars = Tygh::$app['ajax']->getAssignedVars();
            if (!empty($ajax_assigned_vars['html'])) {
                unset($ajax_assigned_vars['html']);
            }
            $query_array['_ajax_data'] = $ajax_assigned_vars;
        }
        if (!empty($query_array)) {
            $location .= '?' . http_build_query($query_array) . $fragment;
        }
        // Redirect from https to http location
        if ($protocol_changed && defined('HTTPS')) {
            $meta_redirect = true;
        }
    }
    fn_set_hook('redirect_complete', $meta_redirect);
    if (!defined('AJAX_REQUEST') && Embedded::isEnabled()) {
        if (strpos($location, Registry::get('config.http_location')) === 0) {
            $location = str_replace(Registry::get('config.http_location'), '', $location);
        } elseif (strpos($location, Registry::get('config.https_location')) === 0) {
            $location = str_replace(Registry::get('config.https_location'), '', $location);
        }
        $location = Embedded::getUrl() . '#!' . urlencode($location);
        $meta_redirect = true;
    }
    if (defined('AJAX_REQUEST')) {
        // make in-script redirect during ajax request
        $_purl = parse_url($location);
        $_GET = array();
        $_POST = array();
        if (!empty($_purl['query'])) {
            parse_str($_purl['query'], $_GET);
        }
        $_REQUEST = Bootstrap::safeInput($_GET);
        $_SERVER['REQUEST_METHOD'] = 'GET';
        $_SERVER['REQUEST_URI'] = $_purl['path'];
        $_SERVER['QUERY_STRING'] = !empty($_purl['query']) ? $_purl['query'] : '';
        fn_get_route($_REQUEST);
        Registry::save();
        // save registry cache to execute cleanup handlers
        fn_init_settings();
        fn_init_addons();
        Registry::clearCacheLevels();
        Tygh::$app['ajax']->updateRequest();
        return fn_dispatch();
    } elseif (!ob_get_contents() && !headers_sent() && !$meta_redirect) {
        if ($is_permanent) {
            header('HTTP/1.0 301 Moved Permanently');
        }
        header('Location: ' . $location);
        exit;
    } else {
        $delay = (Debugger::isActive() || fn_is_development()) && !Registry::get('runtime.comet') ? 10 : 0;
        if ($delay != 0) {
            fn_echo('<a href="' . htmlspecialchars($location) . '" style="text-transform: lowercase;">' . __('continue') . '</a>');
        }
        fn_echo('<meta http-equiv="Refresh" content="' . $delay . ';URL=' . htmlspecialchars($location) . '" />');
    }
    fn_flush();
    exit;
}
开发者ID:arpad9,项目名称:bygmarket,代码行数:101,代码来源:fn.common.php


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