/** * Get current request id * * @return string|null */ protected function _getRequestId() { if (!$this->_processor) { return null; } return $this->_processor->getRequestId(); }
/** * Render placeholder tags around the block if needed * * @param Varien_Event_Observer $observer * @return Enterprise_PageCache_Model_Observer */ public function renderBlockPlaceholder(Varien_Event_Observer $observer) { if (!$this->_isEnabled) { return $this; } $block = $observer->getEvent()->getBlock(); $transport = $observer->getEvent()->getTransport(); $placeholder = $this->_config->getBlockPlaceholder($block); if ($transport && $placeholder && !$block->getSkipRenderTag()) { $blockHtml = $transport->getHtml(); $request = Mage::app()->getFrontController()->getRequest(); /** @var $processor Enterprise_PageCache_Model_Processor_Default */ $processor = $this->_processor->getRequestProcessor($request); if ($processor && $processor->allowCache($request)) { $container = $placeholder->getContainerClass(); if ($container && !Mage::getIsDeveloperMode()) { $container = new $container($placeholder); $container->setProcessor(Mage::getSingleton('enterprise_pagecache/processor')); $container->setPlaceholderBlock($block); $container->saveCache($blockHtml); } } $blockHtml = $placeholder->getStartTag() . $blockHtml . $placeholder->getEndTag(); $transport->setHtml($blockHtml); } return $this; }
/** * Return cache page id without application. Depends on GET super global array. * * @param Enterprise_PageCache_Model_Processor $processor * @return string */ public function getPageIdWithoutApp(Enterprise_PageCache_Model_Processor $processor) { $queryParams = $_GET; $sessionParams = Enterprise_PageCache_Model_Cookie::getCategoryCookieValue(); if ($sessionParams) { $sessionParams = (array) json_decode($sessionParams); foreach ($sessionParams as $key => $value) { if (in_array($key, $this->_paramsMap) && !isset($queryParams[$key])) { $queryParams[$key] = $value; } } } ksort($queryParams); $queryParams = json_encode($queryParams); Enterprise_PageCache_Model_Cookie::setCategoryCookieValue($queryParams); return $processor->getRequestId() . '_' . md5($queryParams); }
/** * Return cache page id without application. Depends on GET super global array. * * @param Enterprise_PageCache_Model_Processor $processor * @return string */ public function getPageIdWithoutApp(Enterprise_PageCache_Model_Processor $processor) { $queryParams = $_GET; ksort($queryParams); /** * unset known tracking codes */ unset($queryParams["trk_module"]); unset($queryParams["trk_msg"]); unset($queryParams["trk_contact"]); unset($queryParams["utm_source"]); unset($queryParams["utm_medium"]); unset($queryParams["utm_term"]); unset($queryParams["utm_campaign"]); unset($queryParams["utm_content"]); /** End Edit */ $queryParamsHash = md5(serialize($queryParams)); return $processor->getRequestId() . '_' . $queryParamsHash; }
protected function _createRequestIds() { parent::_createRequestIds(); $_helper = Mage::helper('weltpixel_mobiledetect'); $detectionSuffix = 'desktop'; if ($_helper->isMobile() || $_helper->isTablet()) { $detectionSuffix = 'mobile'; } $this->_requestId .= '_' . $detectionSuffix; $this->_requestCacheId = $this->prepareCacheId($this->_requestId); return $this; }
/** * model_load_after event processor. Collect tags of all loaded entities * * @param $observer */ public function registerModelTag(Varien_Event_Observer $observer) { if (!$this->isCacheEnabled()) { return $this; } $object = $observer->getEvent()->getObject(); if ($object && $object->getId()) { $tags = $object->getCacheIdTags(); if ($tags) { $this->_processor->addRequestTag($tags); } } }
public function __construct() { parent::__construct(); if (isset($_COOKIE[AW_Mobile_Model_Observer::MOBILE_COOKIE])) { $this->_requestId .= "_" . $_COOKIE[AW_Mobile_Model_Observer::MOBILE_COOKIE]; } else { $this->_requestId .= "_" . time() . mt_rand(); } if (preg_match("#switch/toMobile#", $this->_requestId) || preg_match("#switch/toDesktop#", $this->_requestId)) { $this->_requestId .= "_" . time() . mt_rand(); } Mage::register('_singleton/enterprise_pagecache/processor', $this, true); $this->_requestCacheId = $this->prepareCacheId($this->_requestId); }
/** * Populate request ids * * @return Elastera_PageCacheSSL_Model_Processor */ protected function _createRequestIds() { parent::_createRequestIds(); $uri = $this->_requestId; if ($uri) { /* start change - add '_ssl' to the $uri if the request is SSL */ if (Elastera_EnterprisePageCacheSSL_Helper_Data::isSSL()) { $uri .= '_ssl'; } /* end change - add '_ssl' to the $uri if the request is SSL */ } $this->_requestId = $uri; $this->_requestCacheId = $this->prepareCacheId($this->_requestId); return $this; }
protected function _getFullPageUrl() { if ($url = Mage::registry('m_original_request_uri')) { $uri = ''; if (isset($_SERVER['HTTP_HOST'])) { $uri = $_SERVER['HTTP_HOST']; } elseif (isset($_SERVER['SERVER_NAME'])) { $uri = $_SERVER['SERVER_NAME']; } if ($uri) { return $uri . $url; } } return parent::_getFullPageUrl(); }
/** * Update last visited category id cookie * * @param Enterprise_PageCache_Model_Processor $processor * @return Enterprise_PageCache_Model_Processor_Category */ protected function _updateCategoryViewedCookie(Enterprise_PageCache_Model_Processor $processor) { Enterprise_PageCache_Model_Cookie::setCategoryViewedCookieValue($processor->getMetadata(self::METADATA_CATEGORY_ID)); return $this; }
/** * Get current request id * * @return string|null */ protected function _getRequestId() { return !$this->_processor ? null : $this->_processor->getRequestId(); }
/** * Return cache page id without application. Depends on GET super global array. * * @param Enterprise_PageCache_Model_Processor $processor * @return string */ public function getPageIdWithoutApp(Enterprise_PageCache_Model_Processor $processor) { $queryParams = $_GET; ksort($queryParams); $queryParamsHash = md5(serialize($queryParams)); return $processor->getRequestId() . '_' . $queryParamsHash; }