Nexcessnet_Turpentine_Model_Varnish_Configurator_Abstract::_getTemplateVars PHP Method

_getTemplateVars() protected method

Build the list of template variables to apply to the VCL template
protected _getTemplateVars ( ) : array
return array
    protected function _getTemplateVars()
    {
        $vars = array('default_backend' => $this->_getDefaultBackend(), 'admin_backend' => $this->_getAdminBackend(), 'admin_frontname' => $this->_getAdminFrontname(), 'normalize_host_target' => $this->_getNormalizeHostTarget(), 'url_base_regex' => $this->getBaseUrlPathRegex(), 'allowed_hosts_regex' => $this->getAllowedHostsRegex(), 'url_excludes' => $this->_getUrlExcludes(), 'get_param_excludes' => $this->_getGetParamExcludes(), 'get_param_ignored' => $this->_getIgnoreGetParameters(), 'default_ttl' => $this->_getDefaultTtl(), 'enable_get_excludes' => $this->_getGetParamExcludes() ? 'true' : 'false', 'enable_get_ignored' => $this->_getIgnoreGetParameters() ? 'true' : 'false', 'send_unmodified_url' => $this->_sendUnModifiedUrlToBackend() ? 'true' : 'false', 'debug_headers' => $this->_getEnableDebugHeaders(), 'grace_period' => $this->_getGracePeriod(), 'force_cache_static' => $this->_getForceCacheStatic(), 'simple_hash_static' => $this->_getSimpleHashStatic(), 'generate_session_expires' => $this->_getGenerateSessionExpires(), 'generate_session' => $this->_getGenerateSession(), 'generate_session_start' => $this->_getGenerateSessionStart(), 'generate_session_end' => $this->_getGenerateSessionEnd(), 'static_extensions' => $this->_getStaticExtensions(), 'static_ttl' => $this->_getStaticTtl(), 'url_ttls' => $this->_getUrlTtls(), 'enable_caching' => $this->_getEnableCaching(), 'crawler_acl' => $this->_vcl_acl('crawler_acl', $this->_getCrawlerIps()), 'esi_cache_type_param' => Mage::helper('turpentine/esi')->getEsiCacheTypeParam(), 'esi_method_param' => Mage::helper('turpentine/esi')->getEsiMethodParam(), 'esi_ttl_param' => Mage::helper('turpentine/esi')->getEsiTtlParam(), 'secret_handshake' => Mage::helper('turpentine/varnish')->getSecretHandshake(), 'crawler_user_agent_regex' => $this->_getCrawlerUserAgents(), 'debug_acl' => $this->_vcl_acl('debug_acl', $this->_getDebugIps()), 'custom_c_code' => file_get_contents($this->_getVclTemplateFilename(self::VCL_CUSTOM_C_CODE_FILE)), 'esi_private_ttl' => Mage::helper('turpentine/esi')->getDefaultEsiTtl());
        if ((bool) Mage::getStoreConfig('turpentine_vcl/urls/bypass_cache_store_url')) {
            $vars['allowed_hosts'] = $this->_vcl_sub_allowed_hosts_regex();
        }
        if (Mage::getStoreConfig('turpentine_vcl/normalization/encoding')) {
            $vars['normalize_encoding'] = $this->_vcl_sub_normalize_encoding();
        }
        if (Mage::getStoreConfig('turpentine_vcl/normalization/user_agent')) {
            $vars['normalize_user_agent'] = $this->_vcl_sub_normalize_user_agent();
        }
        if (Mage::getStoreConfig('turpentine_vcl/normalization/host')) {
            $vars['normalize_host'] = $this->_vcl_sub_normalize_host();
        }
        if (Mage::getStoreConfig('turpentine_vcl/normalization/cookie_regex')) {
            $vars['normalize_cookie_regex'] = $this->_getNormalizeCookieRegex();
        }
        if (Mage::getStoreConfig('turpentine_vcl/normalization/cookie_target')) {
            $vars['normalize_cookie_target'] = $this->_getNormalizeCookieTarget();
        }
        if (Mage::getStoreConfig('turpentine_vcl/maintenance/enable')) {
            // in vcl_recv set the allowed IPs otherwise load the vcl_error (v3)/vcl_synth (v4)
            $vars['maintenance_allowed_ips'] = $this->_vcl_sub_maintenance_allowed_ips();
            // set the vcl_error from Magento database
            $vars['vcl_synth'] = $this->_vcl_sub_synth();
        }
        if (Mage::getStoreConfig('turpentine_varnish/general/https_redirect_fix')) {
            $vars['https_redirect'] = $this->_vcl_sub_https_redirect_fix();
            if (Mage::getStoreConfig('turpentine_varnish/servers/version') == '4.0') {
                $vars['vcl_synth'] = $this->_vcl_sub_synth_https_fix();
            }
        }
        foreach (array('', 'top') as $position) {
            $customIncludeFile = $this->_getCustomIncludeFilename($position);
            if (is_readable($customIncludeFile)) {
                $key = 'custom_vcl_include';
                $key .= $position ? '_' . $position : '';
                $vars[$key] = file_get_contents($customIncludeFile);
            }
        }
        return $vars;
    }

Usage Example

Example #1
0
 /**
  * Build the list of template variables to apply to the VCL template
  *
  * @return array
  */
 protected function _getTemplateVars()
 {
     $vars = parent::_getTemplateVars();
     $vars['esi_public_ttl'] = $this->_getDefaultTtl();
     $vars['advanced_session_validation'] = $this->_getAdvancedSessionValidation();
     return $vars;
 }
All Usage Examples Of Nexcessnet_Turpentine_Model_Varnish_Configurator_Abstract::_getTemplateVars