Phpfox_Template_Cache

Description

Template Cache Class handles the caching of a template file and converts any custom code into PHP code. Class is only loaded if the template cache file does not exist.

  • author: Raymond Benc
  • version: $Id: cache.class.php 1687 2010-07-22 03:13:27Z Raymond_Benc $
  • copyright: [PHPFOX_COPYRIGHT]

Located in /include/library/phpfox/template/cache.class.php (line 20)

Phpfox_Template
   |
   --Phpfox_Template_Cache
Method Summary
 Phpfox_Template_Cache __construct ()
 mixed compile (string $sName, [string $sData = null], [bool $bRemoveHeader = false], [bool $bSkipDbCheck = false])
 array getAll ()
 string parse (string $sData, [bool $bRemoveHeader = false])
 bool remove ([mixed $sName = null])
 bool _compileCustomFunction (string $sFunction, string $sModifiers, string $sArguments,  &$sResult, string $sResult)
 string _compileIf (string $sArguments, [bool $bElseif = false], [bool $bWhile = false])
 string _compileParseIsExpr (string $sIsArg, string $aArgs)
 string _compileSectionStart (string $sArguments)
 string _compileTag (string $sTag)
 string _compileVariable (string $sVariable)
 string _parse (string $sData, [bool $bRemoveHeader = false])
 array _parseArgs (string $sArguments)
 string _parseForm (string $sForm, string $sData)
 string _parseFunction (string $sFunction, string $sModifiers, string $sArguments)
 string _parseModifier (string $sVariable, string $sModifiers)
 string _parseVariable (string $sVariable)
 string _parseVariables (array $aVariables, array $aModifiers)
 string _plugin (string $sFunction, string $sType)
 string _removeQuote (string $string)
Variables
array $_aForeachElseStack = array() (line 27)

Foreach stack.

  • access: private
array $_aLiterals = array() (line 62)

Literal blocks. {literal}{/literal}

  • access: private
array $_aModuleBlocks = array() (line 55)

Module blocks.

  • access: private
array $_aPhpBlocks = array() (line 41)

PHP blocks. {php}{/php}

  • access: private
array $_aRequireStack = array() (line 34)

Require stack.

  • access: private
array $_aSectionelseStack = array() (line 48)

Section blocks. {section}{/section}

  • access: private
string $_sDbQstrRegexp = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"' (line 69)

String regex.

  • access: private
string $_sFuncRegexp = '[a-zA-Z_]+' (line 97)

Function regex.

  • access: private
string $_sSiQstrRegexp = '\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'' (line 76)

String regex.

  • access: private
string $_sSvarRegexp = '\%\w+\.\w+\%' (line 90)

Variable regex.

  • access: private
string $_sVarBracketRegexp = '\[[\$|\#]?\w+\#?\]' (line 83)

Bracket regex.

  • access: private

Inherited Variables

Inherited from Phpfox_Template

Phpfox_Template::$bIsSample
Phpfox_Template::$iThemeId
Phpfox_Template::$sDisplayLayout
Phpfox_Template::$sLeftDelim
Phpfox_Template::$sReservedVarname
Phpfox_Template::$sRightDelim
Phpfox_Template::$_aBreadCrumbs
Phpfox_Template::$_aBreadCrumbTitle
Phpfox_Template::$_aCacheHeaders
Phpfox_Template::$_aEditor
Phpfox_Template::$_aHeaders
Phpfox_Template::$_aImages
Phpfox_Template::$_aMeta
Phpfox_Template::$_aMobileHeaders
Phpfox_Template::$_aNewUrl
Phpfox_Template::$_aPhrases
Phpfox_Template::$_aPlugins
Phpfox_Template::$_aRemoveUrl
Phpfox_Template::$_aSections
Phpfox_Template::$_aTheme
Phpfox_Template::$_aTitles
Phpfox_Template::$_aVars
Phpfox_Template::$_bIsAdminCp
Phpfox_Template::$_bIsTestMode
Phpfox_Template::$_iCacheTime
Phpfox_Template::$_sSetLayout
Phpfox_Template::$_sStaticThemeFolder
Phpfox_Template::$_sStyleFolder
Phpfox_Template::$_sThemeFolder
Phpfox_Template::$_sThemeLayout
Phpfox_Template::$_sUrl
Methods
Constructor __construct (line 103)

Class constructor. Build all the regex we will be using with this class.

  • access: public
Phpfox_Template_Cache __construct ()

Redefinition of:
Phpfox_Template::__construct()
Class constructor we use to build the current theme and style we are using.
compile (line 125)

Compile a template file and cache it to a PHP flat file.

  • return: We only return the templates content if the installer does not have a writable directory.
  • access: public
mixed compile (string $sName, [string $sData = null], [bool $bRemoveHeader = false], [bool $bSkipDbCheck = false])
  • string $sName: Name of the template.
  • string $sData: Contents of the template.
  • bool $bRemoveHeader: TRUE to remove the time stamp we added to the header of each cache file.
  • bool $bSkipDbCheck: TRUE to skip checks on the database to see if the cache file exists there as well.
getAll (line 200)

Get all the template files that have been cached.

  • return: List of cached files.
  • access: public
array getAll ()
parse (line 262)

Parse a templates content and convert it into PHP.

  • return: Parsed and converted content.
  • see: self::_parse()
  • access: public
string parse (string $sData, [bool $bRemoveHeader = false])
  • string $sData: Content of the template.
  • bool $bRemoveHeader: TRUE to remove cache headers in the template.
remove (line 234)

Remove a cache file or the entire directory.

  • return: TRUE if removed, FALSE if not.
  • access: public
bool remove ([mixed $sName = null])
  • mixed $sName: Pass nothing to remove all cached files, or the STRING name of the file to just remove that file.
_compileCustomFunction (line 1456)

Compile custom function into the template it is loaded in.

  • return: TRUE function converted, FALSE if it didn't convert.
  • access: private
bool _compileCustomFunction (string $sFunction, string $sModifiers, string $sArguments,  &$sResult, string $sResult)
  • string $sFunction: Name of the function.
  • string $sModifiers: Modifier to load.
  • string $sArguments: Arguments of the function.
  • string $sResult: Converted string of the PHP function.
  • &$sResult
_compileIf (line 1500)

Compile IF statments.

  • return: Returns the converted PHP if statment code.
  • access: private
string _compileIf (string $sArguments, [bool $bElseif = false], [bool $bWhile = false])
  • string $sArguments: If statment arguments.
  • bool $bElseif: TRUE if this is an ELSEIF.
  • bool $bWhile: TRUE of this is a WHILE loop.
_compileParseIsExpr (line 1622)

Compile IF statment expressions.

  • return: Converted PHP code.
  • access: private
string _compileParseIsExpr (string $sIsArg, string $aArgs)
  • string $sIsArg: If expression arguments.
  • string $aArgs: Arguments.
_compileSectionStart (line 1696)

Complie sections {section}{/section}

  • return: Converted PHP foreach().
  • access: private
string _compileSectionStart (string $sArguments)
  • string $sArguments: Section arguments.
_compileTag (line 363)

Compile custom tags. (eg. {literal})

  • return: Converted block of code based on the tag.
  • access: private
string _compileTag (string $sTag)
  • string $sTag: Name of the tag to parse.
_compileVariable (line 1134)

Compile all variables.

  • return: Converted variable.
  • access: private
string _compileVariable (string $sVariable)
  • string $sVariable: Variable name.
_parse (line 276)

Parse a templates content and convert it into PHP.

  • return: Parsed and converted content.
  • access: private
string _parse (string $sData, [bool $bRemoveHeader = false])
  • string $sData: Content of the template.
  • bool $bRemoveHeader: TRUE to remove cache headers in the template.
_parseArgs (line 1018)

Parse arguments. (eg. {for bar1=sample1 bar2=sample2}

  • return: ARRAY of all the arguments.
  • access: private
array _parseArgs (string $sArguments)
  • string $sArguments: Arguments to parse.
_parseForm (line 344)

Parse HTML forms. This is where we automatically add our security token.

  • return: Converted form.
  • access: private
string _parseForm (string $sForm, string $sData)
  • string $sForm: Form attributes.
  • string $sData: Contents of the form.
_parseFunction (line 389)

Parse all the custom tags used within templates. In templates we do not use conventional PHP code as we seperate PHP logic from the template. The tags we use work similar to that off SMARTY.

  • return: Converted PHP value of the function.
  • access: private
string _parseFunction (string $sFunction, string $sModifiers, string $sArguments)
  • string $sFunction: Name of the function.
  • string $sModifiers: Modifiers.
  • string $sArguments: Any arguments we are passing.
_parseModifier (line 1229)

Parse modifiers.

  • return: Converted modifier.
  • access: private
string _parseModifier (string $sVariable, string $sModifiers)
  • string $sVariable: Variable name.
  • string $sModifiers: Modifiers.
_parseVariable (line 1116)

Parse a specific variable.

  • return: Converted variable.
  • access: private
string _parseVariable (string $sVariable)
  • string $sVariable: Name of the variable we are parsing.
_parseVariables (line 1093)

Parse variables.

  • return: Converted variable.
  • access: private
string _parseVariables (array $aVariables, array $aModifiers)
  • array $aVariables: ARRAY of variables.
  • array $aModifiers: ARRAY of modifiers.
_plugin (line 1414)

Load custom plug-ins.

NOTE: This is not in use yet.

  • return: Returns function to load.
  • access: private
string _plugin (string $sFunction, string $sType)
  • string $sFunction: Custom function name.
  • string $sType: Type of function.
_removeQuote (line 1817)

Remove quotes from PHP variables.

  • return: Converted PHP variable.
  • access: private
string _removeQuote (string $string)
  • string $string: PHP variable to work with.

Inherited Methods

Inherited From Phpfox_Template

 Phpfox_Template::__construct()
 Phpfox_Template::assign()
 Phpfox_Template::clean()
 Phpfox_Template::clearBreadCrumb()
 Phpfox_Template::getBreadCrumb()
 Phpfox_Template::getBuiltTemplate()
 Phpfox_Template::getHeader()
 Phpfox_Template::getHeaderFile()
 Phpfox_Template::getKeywords()
 Phpfox_Template::getLayout()
 Phpfox_Template::getLayoutFile()
 Phpfox_Template::getMenu()
 Phpfox_Template::getMobileHeader()
 Phpfox_Template::getStyle()
 Phpfox_Template::getStyleLogo()
 Phpfox_Template::getTemplate()
 Phpfox_Template::getTemplateFile()
 Phpfox_Template::getThemeCache()
 Phpfox_Template::getThemeFolder()
 Phpfox_Template::getThemeLayout()
 Phpfox_Template::getTitle()
 Phpfox_Template::getVar()
 Phpfox_Template::getXml()
 Phpfox_Template::rebuildMenu()
 Phpfox_Template::removeUrl()
 Phpfox_Template::setBreadCrumb()
 Phpfox_Template::setEditor()
 Phpfox_Template::setFullSite()
 Phpfox_Template::setHeader()
 Phpfox_Template::setImage()
 Phpfox_Template::setLayout()
 Phpfox_Template::setMeta()
 Phpfox_Template::setMobileHeader()
 Phpfox_Template::setPhrase()
 Phpfox_Template::setStyle()
 Phpfox_Template::setTemplate()
 Phpfox_Template::setTitle()
 Phpfox_Template::setUrl()
 Phpfox_Template::testStyle()
 Phpfox_Template::_getCachedName()
 Phpfox_Template::_getFromCache()
 Phpfox_Template::_getMenu()
 Phpfox_Template::_isCached()
 Phpfox_Template::_register()
 Phpfox_Template::_returnLayout()

Documentation generated on Tue, 28 Sep 2010 10:36:37 +0200 by phpDocumentor 1.4.0a2