PHP Class Nexcessnet_Turpentine_Helper_Data

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.
Inheritance: extends Mage_Core_Helper_Abstract
Show file Open project: nexcess/magento-turpentine

Protected Properties

Property Type Description
$_crypt Mage_Core_Model_Encryption encryption singleton thing

Public Methods

Method Description
cleanExplode ( string $token, string $data ) : array Like built-in explode() but applies trim to each exploded element and filters out empty elements from result
freeze ( mixed $data ) : string Serialize a variable into a string that can be used in a URL
generateUuid ( ) : string Generate a v4 UUID
getAutoApplyOnSave ( ) : boolean Check if Turpentine should apply the new VCL on config changes
getBypassCookieName ( ) : string Get the cookie name for the Varnish bypass
getCacheKeyHash ( array $key ) : string Hash a cache key the same way blocks do
getChildBlockNames ( Mage_Core_Model_Layout_Element $blockNode ) : array Get a list of child blocks inside the given block
getHmac ( string $data ) : string Get the HMAC hash for given data
getModelName ( string | object $model ) : string Get the getModel formatted name of a model classname or object
getStripVclWhitespace ( ) : string Get config value specifying when to strip VCL whitespaces
getVclFix ( ) : string Get config value specifying when to strip VCL whitespaces
getVersion ( ) : string Get the Turpentine version
secureHash ( string $data ) : string Get SHA256 hash of a string, salted with encryption key
shouldStripVclWhitespace ( string $action ) : boolean Check if VCL whitespaces should be stripped for the given action
thaw ( string $data ) : mixed Unserialize data
urlBase64Decode ( string $str ) : string Base64 decode a string, counterpart to urlBase64Encode
urlBase64Encode ( string $str ) : string Base64 encode a string
useFlashMessagesFix ( ) : boolean Check config to see if Turpentine should handle the flash messages
useProductListToolbarFix ( ) : boolean Check config to see if Turpentine should apply the product list toolbar fix

Protected Methods

Method Description
_getChildBlockNames ( Mage_Core_Model_Layout_Element $blockNode ) : array The actual recursive implementation of getChildBlockNames
_getCrypt ( ) : Mage_Core_Model_Encryption Get encryption singleton thing
_getCryptKey ( ) : string Get Magento's encryption key

Method Details

_getChildBlockNames() protected method

The actual recursive implementation of getChildBlockNames
protected _getChildBlockNames ( Mage_Core_Model_Layout_Element $blockNode ) : array
$blockNode Mage_Core_Model_Layout_Element
return array

_getCrypt() protected method

Not using core/cryption because it auto-base64 encodes stuff which we don't want in this case
protected _getCrypt ( ) : Mage_Core_Model_Encryption
return Mage_Core_Model_Encryption

_getCryptKey() protected method

Get Magento's encryption key
protected _getCryptKey ( ) : string
return string

cleanExplode() public method

Like built-in explode() but applies trim to each exploded element and filters out empty elements from result
public cleanExplode ( string $token, string $data ) : array
$token string [description]
$data string [description]
return array

freeze() public method

Using gzdeflate to avoid the checksum/metadata overhead in gzencode and gzcompress
public freeze ( mixed $data ) : string
$data mixed
return string

generateUuid() public method

Generate a v4 UUID
public generateUuid ( ) : string
return string

getAutoApplyOnSave() public method

Check if Turpentine should apply the new VCL on config changes
public getAutoApplyOnSave ( ) : boolean
return boolean

getBypassCookieName() public method

Get the cookie name for the Varnish bypass
public getBypassCookieName ( ) : string
return string

getCacheKeyHash() public method

Hash a cache key the same way blocks do
public getCacheKeyHash ( array $key ) : string
$key array
return string

getChildBlockNames() public method

Get a list of child blocks inside the given block
public getChildBlockNames ( Mage_Core_Model_Layout_Element $blockNode ) : array
$blockNode Mage_Core_Model_Layout_Element
return array

getHmac() public method

Get the HMAC hash for given data
public getHmac ( string $data ) : string
$data string
return string

getModelName() public method

Get the getModel formatted name of a model classname or object
public getModelName ( string | object $model ) : string
$model string | object
return string

getStripVclWhitespace() public method

Get config value specifying when to strip VCL whitespaces
public getStripVclWhitespace ( ) : string
return string

getVclFix() public method

Get config value specifying when to strip VCL whitespaces
public getVclFix ( ) : string
return string

getVersion() public method

Get the Turpentine version
public getVersion ( ) : string
return string

secureHash() public method

Get SHA256 hash of a string, salted with encryption key
public secureHash ( string $data ) : string
$data string
return string

shouldStripVclWhitespace() public method

Check if VCL whitespaces should be stripped for the given action
public shouldStripVclWhitespace ( string $action ) : boolean
$action string can be either "apply", "save" or "download"
return boolean

thaw() public method

Unserialize data
public thaw ( string $data ) : mixed
$data string
return mixed

urlBase64Decode() public method

Base64 decode a string, counterpart to urlBase64Encode
public urlBase64Decode ( string $str ) : string
$str string
return string

urlBase64Encode() public method

NOTE this changes the last 2 characters to be friendly to URLs => . + => -
public urlBase64Encode ( string $str ) : string
$str string
return string

useFlashMessagesFix() public method

Check config to see if Turpentine should handle the flash messages
public useFlashMessagesFix ( ) : boolean
return boolean

useProductListToolbarFix() public method

Check config to see if Turpentine should apply the product list toolbar fix

Property Details

$_crypt protected property

encryption singleton thing
protected Mage_Core_Model_Encryption $_crypt
return Mage_Core_Model_Encryption