Stash::_parse_context PHP Метод

_parse_context() приватный Метод

Replace the current context in a variable name
private _parse_context ( string $name, $disable_query_str = FALSE ) : string
$name string The variable name
Результат string
    private function _parse_context($name, $disable_query_str = FALSE)
    {
        // replace '@:' with current context name
        if (strncmp($name, '@:', 2) == 0) {
            $name = str_replace('@', self::$context, $name);
        }
        // fetch the *unadulterated* URI of the current page
        $ee_uri = new EE_URI();
        // documented as a 'private' method, but not actually. Called in CI_Router so unlikely to ever be made private.
        $ee_uri->_fetch_uri_string();
        $ee_uri->_remove_url_suffix();
        $ee_uri->_explode_segments();
        // provide a fallback value for index pages
        $uri = $ee_uri->uri_string();
        $uri = empty($uri) ? $this->EE->stash_model->get_index_key() : $uri;
        // append query string?
        if ($this->include_query_str && !$disable_query_str && ($query_str = $this->EE->input->server('QUERY_STRING'))) {
            $uri = $uri . '?' . $query_str;
        }
        // replace '@URI:' with the current URI
        if (strncmp($name, '@URI:', 5) == 0) {
            $name = str_replace('@URI', $uri, $name);
        }
        // apply a global variable prefix, if set
        if ($prefix = $this->EE->config->item('stash_var_prefix')) {
            if (strstr($name, ':')) {
                $name = str_replace(':', ':' . $prefix, $name);
            } else {
                $name = $prefix . $name;
            }
        }
        return $name;
    }