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
파일 보기 프로젝트 열기: nexcess/magento-turpentine

공개 메소드들

메소드 설명
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