PHP Класс Nexcessnet_Turpentine_Model_Observer_Esi

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Наследование: extends Varien_Event_Observer
Показать файл Открыть проект

Открытые методы

Метод Описание
addMessagesBlockRewrite ( Varien_Object $eventObject ) : null Add the core/messages block rewrite if the flash message fix is enabled
checkCacheFlag ( Varien_Object $eventObject ) : null Allows disabling page-caching by setting the cache flag on a controller
checkRedirectUrl ( Varien_Object $eventObject ) : null On controller redirects, check the target URL and set to home page if it would otherwise go to a getBlock URL
hookToAddToCartAfter ( $observer )
hookToAddToCartBefore ( $observer )
hookToAddToWishlistBefore ( $observer ) : Nexcessnet_Turpentine_Model_Observer_Esi Set the form key on the add to wishlist request
hookToControllerActionPostDispatch ( $observer )
hookToControllerActionPreDispatch ( $observer )
injectEsi ( Varien_Object $eventObject ) : null Encode block data in URL then replace with ESI template
loadCacheClearEvents ( Varien_Object $eventObject ) : null Load the cache clear events from stored config
removeCustomerGroupCookie ( Varien_Object $eventObject ) : null Destroy the cookie with the customer group when customer logs out
replaceFormKeyPlaceholder ( Varien_Object $eventObject ) : null Replace the form key placeholder with the ESI include fragment
setCustomerGroupCookie ( Varien_Object $eventObject ) : null Set a cookie with the customer group id when customer logs in
setFlagHeaders ( Varien_Object $eventObject ) : null Check the ESI flag and set the ESI header if needed
setReplaceFormKeyFlag ( Varien_Object $eventObject ) : null Check the magento version and runtime env and set the replace_form_key flag if needed

Защищенные методы

Метод Описание
_checkIsEsiUrl ( string $url ) : boolean Check if a URL *is* for the /turpentine/esi/getBlock/ action
_checkIsNotEsiUrl ( string $url ) : boolean Check if a URL *is not* for the /turpentine/esi/getBlock/ action
_fixupUencUrl ( string $uencUrl ) : string Fix a URL to ensure it uses Magento's base URL instead of the backend URL
_getBlockLayoutHandles ( Mage_Core_Block_Template $block ) : array Get the active layout handles for this block and any child blocks
_getComplexRegistryData ( array $valueOptions, mixed $value ) : array Get the complex registry entry data
_getDefaultEsiOptions ( $options ) : array Get the default ESI options
_getEsiData ( Mage_Core_Block_Template $blockObject, array $esiOptions ) : Varien_Object Generate ESI data to be encoded in URL

Описание методов

_checkIsEsiUrl() защищенный Метод

Check if a URL *is* for the /turpentine/esi/getBlock/ action
protected _checkIsEsiUrl ( string $url ) : boolean
$url string
Результат boolean

_checkIsNotEsiUrl() защищенный Метод

Check if a URL *is not* for the /turpentine/esi/getBlock/ action
protected _checkIsNotEsiUrl ( string $url ) : boolean
$url string
Результат boolean

_fixupUencUrl() защищенный Метод

Fix a URL to ensure it uses Magento's base URL instead of the backend URL
protected _fixupUencUrl ( string $uencUrl ) : string
$uencUrl string
Результат string

_getBlockLayoutHandles() защищенный Метод

This is probably kind of slow since it uses a bunch of xpath searches but this was the easiest way to get the info needed. Should be a target for future optimization There is an issue with encoding the used handles in the URL, if the used handles change (ex customer logs in), the cached version of the page will still have the old handles encoded in it's ESI url. This can lead to weirdness like the "Log in" link displaying for already logged in visitors on pages that were initially visited by not-logged-in visitors. Not sure of a solution for this yet. Above problem is currently solved by EsiController::_swapCustomerHandles() but it would be best to find a more general solution to this.
protected _getBlockLayoutHandles ( Mage_Core_Block_Template $block ) : array
$block Mage_Core_Block_Template
Результат array

_getComplexRegistryData() защищенный Метод

Get the complex registry entry data
protected _getComplexRegistryData ( array $valueOptions, mixed $value ) : array
$valueOptions array
$value mixed
Результат array

_getDefaultEsiOptions() защищенный Метод

Get the default ESI options
protected _getDefaultEsiOptions ( $options ) : array
Результат array

_getEsiData() защищенный Метод

Generate ESI data to be encoded in URL
protected _getEsiData ( Mage_Core_Block_Template $blockObject, array $esiOptions ) : Varien_Object
$blockObject Mage_Core_Block_Template
$esiOptions array
Результат Varien_Object

addMessagesBlockRewrite() публичный Метод

The core/messages block is rewritten because it doesn't use a template we can replace with an ESI include tag, just dumps out a block of hard-coded HTML and also frequently skips the toHtml method
public addMessagesBlockRewrite ( Varien_Object $eventObject ) : null
$eventObject Varien_Object
Результат null

checkCacheFlag() публичный Метод

Events: controller_action_layout_generate_blocks_after
public checkCacheFlag ( Varien_Object $eventObject ) : null
$eventObject Varien_Object
Результат null

checkRedirectUrl() публичный Метод

On controller redirects, check the target URL and set to home page if it would otherwise go to a getBlock URL
public checkRedirectUrl ( Varien_Object $eventObject ) : null
$eventObject Varien_Object
Результат null

hookToAddToCartAfter() публичный Метод

public hookToAddToCartAfter ( $observer )

hookToAddToCartBefore() публичный Метод

public hookToAddToCartBefore ( $observer )

hookToAddToWishlistBefore() публичный Метод

Set the form key on the add to wishlist request
public hookToAddToWishlistBefore ( $observer ) : Nexcessnet_Turpentine_Model_Observer_Esi
$observer
Результат Nexcessnet_Turpentine_Model_Observer_Esi

hookToControllerActionPostDispatch() публичный Метод

public hookToControllerActionPostDispatch ( $observer )

hookToControllerActionPreDispatch() публичный Метод

public hookToControllerActionPreDispatch ( $observer )

injectEsi() публичный Метод

Encode block data in URL then replace with ESI template
public injectEsi ( Varien_Object $eventObject ) : null
$eventObject Varien_Object
Результат null

loadCacheClearEvents() публичный Метод

Load the cache clear events from stored config
public loadCacheClearEvents ( Varien_Object $eventObject ) : null
$eventObject Varien_Object
Результат null

removeCustomerGroupCookie() публичный Метод

Events: customer_logout
public removeCustomerGroupCookie ( Varien_Object $eventObject ) : null
$eventObject Varien_Object
Результат null

replaceFormKeyPlaceholder() публичный Метод

Replace the form key placeholder with the ESI include fragment
public replaceFormKeyPlaceholder ( Varien_Object $eventObject ) : null
$eventObject Varien_Object
Результат null

setCustomerGroupCookie() публичный Метод

Events: customer_login
public setCustomerGroupCookie ( Varien_Object $eventObject ) : null
$eventObject Varien_Object
Результат null

setFlagHeaders() публичный Метод

Events: http_response_send_before
public setFlagHeaders ( Varien_Object $eventObject ) : null
$eventObject Varien_Object
Результат null

setReplaceFormKeyFlag() публичный Метод

Check the magento version and runtime env and set the replace_form_key flag if needed
public setReplaceFormKeyFlag ( Varien_Object $eventObject ) : null
$eventObject Varien_Object
Результат null