Cheetah
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
ChWsbTemplate Class Reference
Inheritance diagram for ChWsbTemplate:
ChWsbFilesUploader ChWsbModuleTemplate ChWsbOrcaForumsTemplate ChWsbPaginate ChWsbPrivacyView ChWsbTemplateAdmin ChFilesUploader ChPhotosUploader ChSoundsUploader ChVideosUploader ChAdsTemplate ChBlogsTemplate ChBoardTemplate ChChatTemplate ChCRSSTemplate ChMbpTemplate ChPageACTemplate ChPmtTemplate ChPollTemplate ChQuotesTemplate ChShoutBoxTemplate ChSimpleMessengerTemplate ChSitesTemplate ChSpyTemplate ChWallTemplate ChWsbConnectTemplate ChWsbFilesTemplate ChWsbMobileTemplate ChWsbTextTemplate ChWsbTwigTemplate ChBasePrivacyView

Public Member Functions

 __construct ($sRootPath=CH_DIRECTORY_PATH_ROOT, $sRootUrl=CH_WSB_URL_ROOT)
 
 loadTemplates ()
 
 init ()
 
 addLocation ($sKey, $sLocationPath, $sLocationUrl)
 
 addDynamicLocation ($sLocationPath, $sLocationUrl)
 
 removeLocation ($sKey)
 
 addLocationJs ($sKey, $sLocationPath, $sLocationUrl)
 
 addDynamicLocationJs ($sLocationPath, $sLocationUrl)
 
 removeLocationJs ($sKey)
 
 getCodeKey ()
 
 getCode ()
 
 getPageWidth ()
 
 setPageWidth ($sWidth)
 
 setPageTitle ($sTitle)
 
 setPageMainBoxTitle ($sTitle)
 
 setPageDescription ($sDescription)
 
 addJsOption ($mixedName)
 
 addJsTranslation ($mixedKey)
 
 addJsImage ($aImages)
 
 addJsIcon ($aIcons)
 
 addCssStyle ($sName, $sContent)
 
 addPageKeywords ($mixedKeywords, $sDevider=',')
 
 setOpenGraphInfo ($a, $sNamespace='og')
 
 getMetaInfo ()
 
 getTemplate ($sName)
 
 getIconUrl ($sName, $sCheckIn=CH_WSB_TEMPLATE_CHECK_IN_BOTH)
 
 getIconPath ($sName, $sCheckIn=CH_WSB_TEMPLATE_CHECK_IN_BOTH)
 
 getImageUrl ($sName, $sCheckIn=CH_WSB_TEMPLATE_CHECK_IN_BOTH)
 
 getImagePath ($sName, $sCheckIn=CH_WSB_TEMPLATE_CHECK_IN_BOTH)
 
 getCssUrl ($sName, $sCheckIn=CH_WSB_TEMPLATE_CHECK_IN_BOTH)
 
 getCssPath ($sName, $sCheckIn=CH_WSB_TEMPLATE_CHECK_IN_BOTH)
 
 getHtml ($sName, $sCheckIn=CH_WSB_TEMPLATE_CHECK_IN_BOTH)
 
 parseHtmlByName ($sName, $aVariables, $mixedKeyWrapperHtml=null, $sCheckIn=CH_WSB_TEMPLATE_CHECK_IN_BOTH)
 
 parseHtmlByContent ($sContent, $aVariables, $mixedKeyWrapperHtml=null)
 
 parseHtmlByTemplateName ($sName, $aVariables, $mixedKeyWrapperHtml=null)
 
 parsePageByName ($sName, $aVariables)
 
 parseSystemKey ($sKey, $mixedKeyWrapperHtml=null)
 
 getTemplatesCacheObject ()
 
 getCached ($sName, &$aVariables, $mixedKeyWrapperHtml=null, $sCheckIn=CH_WSB_TEMPLATE_CHECK_IN_BOTH, $bEvaluate=true)
 
 addJs ($mixedFiles, $bDynamic=false)
 
 addJsSystem ($mixedFiles)
 
 deleteJs ($mixedFiles)
 
 deleteJsSystem ($mixedFiles)
 
 _compileJs ($sAbsolutePath, &$aIncluded)
 
 _wrapInTagJs ($sFile)
 
 _wrapInTagJsCode ($sCode)
 
 addCss ($mixedFiles, $bDynamic=false)
 
 addCssAsync ($mixedFiles)
 
 includeCssAsync ()
 
 addCssSystem ($mixedFiles)
 
 deleteCss ($mixedFiles)
 
 deleteCssSystem ($mixedFiles)
 
 _compileCss ($sAbsolutePath, &$aIncluded)
 
 _minifyCss ($s)
 
 _wrapInTagCss ($sFile)
 
 _wrapInTagCssCode ($sCode)
 
 includeCssStyles ()
 
 includeFiles ($sType, $bSystem=false)
 
 _includeFiles ($sType, &$aFiles)
 
 _processFiles ($sType, $sAction, $mixedFiles, $bDynamic=false, $bSystem=false)
 
 _parseContent ($sContent, $aVariables, $mixedKeyWrapperHtml=null)
 
 _compileContent ($sContent, $aVarName, $iVarDepth, $aVarValues, $mixedKeyWrapperHtml=null)
 
 _getAbsoluteLocation ($sType, $sFolder, $sName, $sCheckIn=CH_WSB_TEMPLATE_CHECK_IN_BOTH)
 
 _getAbsoluteLocationJs ($sType, $sName)
 
 _getAbsoluteLocationCss ($sType, $sName)
 
 _getInlineData ($sType, $sName, $sCheckIn)
 
 _getCacheFileName ($sType, $sAbsolutePath)
 
 _getKeyWrappers ($mixedKeyWrapperHtml)
 
 _processJsTranslations ()
 
 _processJsOptions ()
 
 _processJsImages ()
 
 _getLoaderUrl ($sType, $sName)
 
 displayAccessDenied ()
 
 displayNoData ()
 
 displayErrorOccured ()
 
 displayPageNotFound ()
 
 displayMsg ($s, $bTranslate=false)
 
 processInjection ($iPageIndex, $sKey, $sValue="")
 
 addInjection ($sKey, $sType, $sData, $iReplace=0)
 

Static Public Member Functions

static _callbackParseUrl ($sPath, $aMatches)
 

Public Attributes

 $_sPrefix
 
 $_sRootPath
 
 $_sRootUrl
 
 $_sInjectionsTable
 
 $_sInjectionsCache
 
 $_sCode
 
 $_sCodeKey
 
 $_sKeyWrapperHtml
 
 $_sFolderHtml
 
 $_sFolderCss
 
 $_sFolderImages
 
 $_sFolderIcons
 
 $_aTemplates
 
 $_aLocations
 
 $_aLocationsJs
 
 $_bCacheEnable
 
 $_sCacheFolderUrl
 
 $_sCachePublicFolderUrl
 
 $_sCachePublicFolderPath
 
 $_sCacheFilePrefix
 
 $_bImagesInline
 
 $_iImagesMaxSize
 
 $_bCssCache
 
 $_bCssArchive
 
 $_sCssCachePrefix
 
 $_bJsCache
 
 $_bJsArchive
 
 $_sJsCachePrefix
 

Detailed Description

Template engine.

An object of the class allows to:

  1. Manage HTML templates.
  2. Get URL/path for any template image/icon.
  3. Attach CSS/JavaScript files to the output.
  4. Add some content to any template key using Injection engine.

Avalable constructions.

  1. <ch_include_auto:template_name.html /> - the content of the file would be inserted. File would be taken from current template if it existes there, and from base directory otherwise.
  2. <ch_include_base:template_name.html /> - the content of the file would be inserted. File would be taken from base directory.
  3. <ch_include_tmpl:template_name.html /> - the content of the file would be inserted. File would be taken from tmpl_xxx directory.
  4. <ch_url_root > - the value of $GLOBALS['site']['url'] variable will be inserted.
  5. <ch_url_admin > - the value of $GLOBALS['site']['url_admin'] variable will be inserted.
  6. <ch_text:_language_key /> - _language_key will be translated using language file(function _t()) and inserted.
  7. <ch_text_js:_language_key /> - _language_key will be translated using language file(function _t()) and inserted, use it to insert text into js string.
  8. <ch_text_attribute:_language_key /> - _language_key will be translated using language file(function _t()) and inserted, use it to insert text into html attribute.
  1. <ch_image_url:image_file_name /> - image with 'image_file_name' file name will be searched in the images folder of current template. If it's not found, then it will be searched in the images folder of base template. On success full URL will be inserted, otherwise an empty string.
  2. <ch_icon_url:icon_file_name /> - the same with <ch_image_url:image_file_name />, but icons will be searched in the images/icons/ folders.
  3. <ch_injection:injection_name /> - will be replaced with injections registered with the page and injection_name in the sys_injections/sys_injections_admin/ tables.
  4. <ch_if:tag_name>some_HTML</ch_if:tag_name> - will be replaced with provided content if the condition is true, and with empty string otherwise.
  5. <ch_repeat:cycle_name>some_HTML</ch_repeat:cycle_name> - an inner HTML content will be repeated in accordance with received data.

Related classes: ChWsbTemplateAdmin - for processing admin templates. Template classes in modules - for processing modiles' templates.

Global variables: oSysTemplate - is used for template processing in user part. oAdmTemplate - is used for template processing in admin part.

Add injection:

  1. Register it in the sys_injections table or sys_injections_admin table for admin panel.
  2. Clear injections cache(sys_injections.inc and sys_injections_admin.inc in cache folder).

Predefined template keys to add injections:

  1. injection_head - add injections in the <head> tag.
  2. injection_body - add ingection(attribute) in the <body> tag.
  3. injection_header - add injection inside the <body> tag at the very beginning.
  4. injection_logo_before - add injection at the left of the main logo(inside logo's DIV).
  5. injection_logo_after - add injection at the right of the main logo(inside logo's DIV).
  6. injection_between_logo_top_menu - add injection between logo and top menu.
  7. injection_top_menu_before - add injection at the left of the top menu(inside top menu's DIV).
  8. injection_top_menu_after - add injection at the right of the top menu(inside top menu's DIV).
  9. injection_between_top_menu_breadcrumb - add injection between top menu and breadcrumb.
  10. injection_breadcrumb_before - add injection at the left of the breadcrumb(inside breadcrumb's DIV).
  11. injection_breadcrumb_after - add injection at the right of the breadcrumb(inside breadcrumb's DIV).
  12. injection_between_breadcrumb_content - add injection between breadcrumb and main content.
  13. injection_content_before - add injection just before main content(inside content's DIV).
  14. injection_content_after - add injection just after main content(inside content's DIV).
  15. injection_between_content_footer - add injection between content and footer.
  16. injection_footer_before - add injection at the left of the footer(inside footer's DIV).
  17. injection_footer_after - add injection at the right of the footer(inside footer's DIV).
  18. injection_footer - add injection inside the <body> tag at the very end.

Example of usage: global $oSysTemplate;

$oSysTemplate->addCss(array('test1.css', 'test2.css')); $oSysTemplate->addJs(array('test1.js', 'test2.js')); $oSysTemplate->parseHtmlByName('messageBox.html', array( 'id' => $iId, 'msgText' => $sText, 'ch_if:timer' => array( 'condition' => $iTimer > 0, 'content' => array( 'id' => $iId, 'time' => 1000 * $iTimer, 'on_close' => $sOnClose, ) ), 'ch_if:timer' => array( array( 'name' => $sName, 'title' => $sTitle ), array( 'name' => $sName, 'title' => $sTitle ) ) ));

Memberships/ACL: Doesn't depend on user's membership.

Alerts: no alerts available

Definition at line 120 of file ChWsbTemplate.php.

Constructor & Destructor Documentation

◆ __construct()

ChWsbTemplate::__construct (   $sRootPath = CH_DIRECTORY_PATH_ROOT,
  $sRootUrl = CH_WSB_URL_ROOT 
)

Constructor

Reimplemented in ChWsbOrcaForumsTemplate.

Definition at line 162 of file ChWsbTemplate.php.

Member Function Documentation

◆ _callbackParseUrl()

static ChWsbTemplate::_callbackParseUrl (   $sPath,
  $aMatches 
)
static

Private callback function for CSS compiler.

Parameters
string$sPathCSS file absolute path.
array$aMatchesmatched parts of image's URL.
Returns
string converted image's URL.

Definition at line 1276 of file ChWsbTemplate.php.

◆ _compileContent()

ChWsbTemplate::_compileContent (   $sContent,
  $aVarName,
  $iVarDepth,
  $aVarValues,
  $mixedKeyWrapperHtml = null 
)

Compile content

Parameters
string$sContenttemplate.
string$aVarNamevariable name to be saved in the output file.
integer$iVarDepthdepth is used to process nesting, for example, in cycles.
array$aVarValuesvalues to be compiled in.
mixed$mixedKeyWrapperHtmlkey wrapper(string value if left and right parts are the same, array(0 => left, 1 => right) otherwise).
Returns
string the result of operation.

Definition at line 1604 of file ChWsbTemplate.php.

◆ _compileCss()

ChWsbTemplate::_compileCss (   $sAbsolutePath,
$aIncluded 
)

Compile CSS files' structure(

See also
@import css_file_path) in one file.
Parameters
string$sAbsolutePathCSS file absolute path(full URL for external CSS/JS files).
array$aIncludedan array of already included CSS files.
Returns
string result of operation.

Definition at line 1198 of file ChWsbTemplate.php.

◆ _compileJs()

ChWsbTemplate::_compileJs (   $sAbsolutePath,
$aIncluded 
)

Compile JS files in one file.

Parameters
string$sAbsolutePathCSS file absolute path(full URL for external CSS/JS files).
array$aIncludedan array of already included JS files.
Returns
string result of operation.

Definition at line 1044 of file ChWsbTemplate.php.

◆ _getAbsoluteLocation()

ChWsbTemplate::_getAbsoluteLocation (   $sType,
  $sFolder,
  $sName,
  $sCheckIn = CH_WSB_TEMPLATE_CHECK_IN_BOTH 
)

Get absolute location of some template's part.

Parameters
string$sType- result type. Available values 'url' and 'path'.
string$sFolder- folders to be searched in.
See also
$_sFolderHtml, $_sFolderCss, $_sFolderImages and $_sFolderIcons
Parameters
string$sName- requested part name.
string$sCheckInwhere the content would be searched(base, template, both)
Returns
string absolute location (path/url) of the part.

try to find from received path

Definition at line 1711 of file ChWsbTemplate.php.

◆ _getAbsoluteLocationCss()

ChWsbTemplate::_getAbsoluteLocationCss (   $sType,
  $sName 
)

Definition at line 1774 of file ChWsbTemplate.php.

◆ _getAbsoluteLocationJs()

ChWsbTemplate::_getAbsoluteLocationJs (   $sType,
  $sName 
)

Get absolute location of some template's part.

Parameters
string$sTyperesult type. Available values 'url' and 'path'.
string$sNamerequested part name.
Returns
string absolute location (path/url) of the part.

Definition at line 1761 of file ChWsbTemplate.php.

◆ _getCacheFileName()

ChWsbTemplate::_getCacheFileName (   $sType,
  $sAbsolutePath 
)

Get file name where the template would be cached.

Parameters
string$sAbsolutePathtemplate's real path.
Returns
string the result of operation.

Definition at line 1812 of file ChWsbTemplate.php.

◆ _getInlineData()

ChWsbTemplate::_getInlineData (   $sType,
  $sName,
  $sCheckIn 
)

Get inline data for Images and Icons.

Parameters
string$sTypeimage/icon
string$sNamefile name
string$sCheckInwhere the content would be searched(base, template, both)
Returns
unknown

Definition at line 1786 of file ChWsbTemplate.php.

◆ _getKeyWrappers()

ChWsbTemplate::_getKeyWrappers (   $mixedKeyWrapperHtml)

Get template key wrappers(left, right)

Parameters
mixed$mixedKeyWrapperHtmlkey wrapper(string value if left and right parts are the same, array(0 => left, 1 => right) otherwise).
Returns
array result of operation.

Definition at line 1835 of file ChWsbTemplate.php.

◆ _getLoaderUrl()

ChWsbTemplate::_getLoaderUrl (   $sType,
  $sName 
)

Get Gzip loader URL.

Parameters
$sTypecontent type CSS/JS
$sNamefile name.
Returns
string with URL

Definition at line 1901 of file ChWsbTemplate.php.

◆ _includeFiles()

ChWsbTemplate::_includeFiles (   $sType,
$aFiles 
)

Include CSS/JS files without caching.

Parameters
string$sTypethe file type (css or js)
array$aFilesCSS/JS files to be added to the page.
Returns
string result of operation.

Definition at line 1404 of file ChWsbTemplate.php.

◆ _minifyCss()

ChWsbTemplate::_minifyCss (   $s)

Minify CSS

Parameters
string$sCSS string to minify
Returns
string minified CSS string.

Definition at line 1263 of file ChWsbTemplate.php.

◆ _parseContent()

ChWsbTemplate::_parseContent (   $sContent,
  $aVariables,
  $mixedKeyWrapperHtml = null 
)

Parse content.

Parameters
string$sContent- HTML file's content.
array$aVariables- key/value pairs. key should be the same as template's key, but without prefix and postfix.
mixed$mixedKeyWrapperHtml- key wrapper(string value if left and right parts are the same, array(0 => left, 1 => right) otherwise).
Returns
string the result of operation.

Definition at line 1496 of file ChWsbTemplate.php.

◆ _processFiles()

ChWsbTemplate::_processFiles (   $sType,
  $sAction,
  $mixedFiles,
  $bDynamic = false,
  $bSystem = false 
)

Insert/Delete CSS file from output stack.

Parameters
string$sTypethe file type (css or js)
string$sActionadd/delete
mixed$mixedFilesstring value represents a single CSS file name. An array - array of CSS file names.
Returns
boolean result of operation.

Definition at line 1422 of file ChWsbTemplate.php.

◆ _processJsImages()

ChWsbTemplate::_processJsImages ( )

Process all added images and return them as a string.

Returns
string with JS code.

Definition at line 1885 of file ChWsbTemplate.php.

◆ _processJsOptions()

ChWsbTemplate::_processJsOptions ( )

Process all added options and return them as a string.

Returns
string with JS code.

Definition at line 1872 of file ChWsbTemplate.php.

◆ _processJsTranslations()

ChWsbTemplate::_processJsTranslations ( )

Process all added language translations and return them as a string.

Returns
string with JS code.

Definition at line 1852 of file ChWsbTemplate.php.

◆ _wrapInTagCss()

ChWsbTemplate::_wrapInTagCss (   $sFile)

Wrap an URL to CSS file into CSS tag.

Parameters
string$sFile- URL to CSS file.
Returns
string the result of operation.

Definition at line 1296 of file ChWsbTemplate.php.

◆ _wrapInTagCssCode()

ChWsbTemplate::_wrapInTagCssCode (   $sCode)

Wrap CSS code into CSS tag.

Parameters
string$sCode- CSS code.
Returns
string the result of operation.

Definition at line 1308 of file ChWsbTemplate.php.

◆ _wrapInTagJs()

ChWsbTemplate::_wrapInTagJs (   $sFile)

Wrap an URL to JS file into JS tag.

Parameters
string$sFile- URL to JS file.
Returns
string the result of operation.

Definition at line 1092 of file ChWsbTemplate.php.

◆ _wrapInTagJsCode()

ChWsbTemplate::_wrapInTagJsCode (   $sCode)

Wrap JS code into JS tag.

Parameters
string$sCode- JS code.
Returns
string the result of operation.

Definition at line 1102 of file ChWsbTemplate.php.

◆ addCss()

ChWsbTemplate::addCss (   $mixedFiles,
  $bDynamic = false 
)

Add CSS file(s) to global output.

Parameters
mixed$mixedFilesstring value represents a single CSS file name. An array - array of CSS file names.
boolean$bDynamicin the dynamic mode CSS file(s) are not included to global output, but are returned from the function directly.
Returns
boolean/string result of operation

Definition at line 1114 of file ChWsbTemplate.php.

◆ addCssAsync()

ChWsbTemplate::addCssAsync (   $mixedFiles)

Add additional heavy css file (not very necessary) to load asynchronously for desktop browsers only

Parameters
mixed$mixedFilesstring value represents a single CSS file name. An array - array of CSS file names.

Definition at line 1123 of file ChWsbTemplate.php.

◆ addCssStyle()

ChWsbTemplate::addCssStyle (   $sName,
  $sContent 
)

Add CSS style.

Parameters
string$sNameCSS class name.
string$sContentCSS class styles.

Definition at line 499 of file ChWsbTemplate.php.

◆ addCssSystem()

ChWsbTemplate::addCssSystem (   $mixedFiles)

Add System CSS file(s) to global output. System CSS files are the files which are attached to all pages. They will be cached separately from the others.

Parameters
mixed$mixedFilesstring value represents a single CSS file name. An array - array of CSS file names.
Returns
boolean/string result of operation

Definition at line 1166 of file ChWsbTemplate.php.

◆ addDynamicLocation()

ChWsbTemplate::addDynamicLocation (   $sLocationPath,
  $sLocationUrl 
)

Add dynamic location.

Parameters
string$sLocationPath- location's path. For modules: '[path_to_cheetah]/modules/[vendor_name]/[module_name]/'
string$sLocationUrl- location's url. For modules: '[url_to_cheetah]/modules/[vendor_name]/[module_name]/'
Returns
location key. Is needed to remove the location.

Definition at line 304 of file ChWsbTemplate.php.

◆ addDynamicLocationJs()

ChWsbTemplate::addDynamicLocationJs (   $sLocationPath,
  $sLocationUrl 
)

Add dynamic JS location.

Parameters
string$sLocationPath- location's path. For modules: '[path_to_cheetah]/modules/[vendor_name]/[module_name]/'
string$sLocationUrl- location's url. For modules: '[url_to_cheetah]/modules/[vendor_name]/[module_name]/'
Returns
location key. Is needed to remove the location.

Definition at line 344 of file ChWsbTemplate.php.

◆ addInjection()

ChWsbTemplate::addInjection (   $sKey,
  $sType,
  $sData,
  $iReplace = 0 
)

Static method to add ingection available on the current page only.

Parameters
string$sKey- template's key.
string$sType- injection type(text, php).
string$sData- the data to be added.
integer$iReplace- replace already existed data or not.

Definition at line 2042 of file ChWsbTemplate.php.

◆ addJs()

ChWsbTemplate::addJs (   $mixedFiles,
  $bDynamic = false 
)

Add JS file(s) to global output.

Parameters
mixed$mixedFilesstring value represents a single JS file name. An array - array of JS file names.
boolean$bDynamicin the dynamic mode JS file(s) are not included to global output, but are returned from the function directly.
Returns
boolean/string result of operation.

Definition at line 999 of file ChWsbTemplate.php.

◆ addJsIcon()

ChWsbTemplate::addJsIcon (   $aIcons)

Add icon in JS output.

Parameters
array$aIconsan array of icons descriptors. The descriptor is a key/value pear in the array of descriptors.

Definition at line 480 of file ChWsbTemplate.php.

◆ addJsImage()

ChWsbTemplate::addJsImage (   $aImages)

Add image in JS output.

Parameters
array$aImagesan array of image descriptors. The descriptor is a key/value pear in the array of descriptors.

Definition at line 461 of file ChWsbTemplate.php.

◆ addJsOption()

ChWsbTemplate::addJsOption (   $mixedName)

Add Option in JS output.

Parameters
mixed$mixedNameoption's name or an array of options' names.

Definition at line 434 of file ChWsbTemplate.php.

◆ addJsSystem()

ChWsbTemplate::addJsSystem (   $mixedFiles)

Add System JS file(s) to global output. System JS files are the files which are attached to all pages. They will be cached separately from the others.

Parameters
mixed$mixedFilesstring value represents a single JS file name. An array - array of JS file names.
boolean$bDynamicin the dynamic mode JS file(s) are not included to global output, but are returned from the function directly.
Returns
boolean/string result of operation.

Definition at line 1012 of file ChWsbTemplate.php.

◆ addJsTranslation()

ChWsbTemplate::addJsTranslation (   $mixedKey)

Add language translation for key in JS output.

Parameters
mixed$mixedKeylanguage key or an array of keys.

Definition at line 447 of file ChWsbTemplate.php.

◆ addLocation()

ChWsbTemplate::addLocation (   $sKey,
  $sLocationPath,
  $sLocationUrl 
)

Add location in array of locations. Note. Location is the path/url to folder where 'templates' folder is stored.

Parameters
string$sKey- location's unique key.
string$sLocationPath- location's path. For modules: '[path_to_cheetah]/modules/[vendor_name]/[module_name]/'
string$sLocationUrl- location's url. For modules: '[url_to_cheetah]/modules/[vendor_name]/[module_name]/'

Definition at line 290 of file ChWsbTemplate.php.

◆ addLocationJs()

ChWsbTemplate::addLocationJs (   $sKey,
  $sLocationPath,
  $sLocationUrl 
)

Add JS location in array of JS locations. Note. Location is the path/url to folder where JS files are stored.

Parameters
string$sKey- location's unique key.
string$sLocationPath- location's path. For modules: '[path_to_cheetah]/modules/[vendor_name]/[module_name]/js/'
string$sLocationUrl- location's url. For modules: '[url_to_cheetah]/modules/[vendor_name]/[module_name]/js/'

Definition at line 330 of file ChWsbTemplate.php.

◆ addPageKeywords()

ChWsbTemplate::addPageKeywords (   $mixedKeywords,
  $sDevider = ',' 
)

Set page keywords.

Parameters
mixed$mixedKeywordsnecessary page keywords(string - single keyword, array - an array of keywords).
string$sDevider- string devider.

Definition at line 509 of file ChWsbTemplate.php.

◆ deleteCss()

ChWsbTemplate::deleteCss (   $mixedFiles)

Delete CSS file(s) from global output.

Parameters
mixed$mixedFilesstring value represents a single CSS file name. An array - array of CSS file names.
Returns
boolean result of operation.

Definition at line 1176 of file ChWsbTemplate.php.

◆ deleteCssSystem()

ChWsbTemplate::deleteCssSystem (   $mixedFiles)

Delete System CSS file(s) from global output.

Parameters
mixed$mixedFilesstring value represents a single CSS file name. An array - array of CSS file names.
Returns
boolean result of operation.

Definition at line 1187 of file ChWsbTemplate.php.

◆ deleteJs()

ChWsbTemplate::deleteJs (   $mixedFiles)

Delete JS file(s) from global output.

Parameters
mixed$mixedFilesstring value represents a single JS file name. An array - array of JS file names.
Returns
boolean result of operation.

Definition at line 1022 of file ChWsbTemplate.php.

◆ deleteJsSystem()

ChWsbTemplate::deleteJsSystem (   $mixedFiles)

Delete System JS file(s) from global output.

Parameters
mixed$mixedFilesstring value represents a single JS file name. An array - array of JS file names.
Returns
boolean result of operation.

Definition at line 1033 of file ChWsbTemplate.php.

◆ displayAccessDenied()

ChWsbTemplate::displayAccessDenied ( )

Static functions to display pages with errors, messages and so on.

Reimplemented in ChBlogsTemplate, ChAdsTemplate, and ChWsbTwigTemplate.

Definition at line 1911 of file ChWsbTemplate.php.

◆ displayErrorOccured()

ChWsbTemplate::displayErrorOccured ( )

Reimplemented in ChWsbTwigTemplate.

Definition at line 1939 of file ChWsbTemplate.php.

◆ displayMsg()

ChWsbTemplate::displayMsg (   $s,
  $bTranslate = false 
)

Reimplemented in ChWsbTwigTemplate.

Definition at line 1968 of file ChWsbTemplate.php.

◆ displayNoData()

ChWsbTemplate::displayNoData ( )

Reimplemented in ChWsbTwigTemplate.

Definition at line 1925 of file ChWsbTemplate.php.

◆ displayPageNotFound()

ChWsbTemplate::displayPageNotFound ( )

Reimplemented in ChWsbTwigTemplate, and ChWsbMobileTemplate.

Definition at line 1953 of file ChWsbTemplate.php.

◆ getCached()

ChWsbTemplate::getCached (   $sName,
$aVariables,
  $mixedKeyWrapperHtml = null,
  $sCheckIn = CH_WSB_TEMPLATE_CHECK_IN_BOTH,
  $bEvaluate = true 
)

Get template from cache if it's enabled.

Parameters
string$sNametemplate name
string$aVariableskey/value pairs. key should be the same as template's key, but without prefix and postfix.
mixed$mixedKeyWrapperHtml- key wrapper(string value if left and right parts are the same, array(0 => left, 1 => right) otherwise).
string$sCheckInwhere the content would be searched(base, template, both)
boolean$bEvaluateneed to evaluate the template or not.
Returns
string result of operation or false on failure.

Definition at line 932 of file ChWsbTemplate.php.

◆ getCode()

ChWsbTemplate::getCode ( )

Get currently active template code.

Returns
string template's code.

Definition at line 376 of file ChWsbTemplate.php.

◆ getCodeKey()

ChWsbTemplate::getCodeKey ( )

Get request line key.

Returns
string key.

Definition at line 367 of file ChWsbTemplate.php.

◆ getCssPath()

ChWsbTemplate::getCssPath (   $sName,
  $sCheckIn = CH_WSB_TEMPLATE_CHECK_IN_BOTH 
)

Get full Path of CSS file.

Parameters
string$sName- CSS file name.
string$sCheckInwhere the content would be searched(base, template, both)
Returns
string full URL.

Definition at line 632 of file ChWsbTemplate.php.

◆ getCssUrl()

ChWsbTemplate::getCssUrl (   $sName,
  $sCheckIn = CH_WSB_TEMPLATE_CHECK_IN_BOTH 
)

Get full URL of CSS file.

Parameters
string$sName- CSS file name.
string$sCheckInwhere the content would be searched(base, template, both)
Returns
string full URL.

Definition at line 621 of file ChWsbTemplate.php.

◆ getHtml()

ChWsbTemplate::getHtml (   $sName,
  $sCheckIn = CH_WSB_TEMPLATE_CHECK_IN_BOTH 
)

Get content of HTML file.

Parameters
string$sName- HTML file name.
string$sCheckInwhere the content would be searched(base, template, both)
Returns
string full content of the file and false on failure.

Definition at line 643 of file ChWsbTemplate.php.

◆ getIconPath()

ChWsbTemplate::getIconPath (   $sName,
  $sCheckIn = CH_WSB_TEMPLATE_CHECK_IN_BOTH 
)

Get absolute Path for the icon.

Parameters
string$sName- icon's file name.
string$sCheckInwhere the content would be searched(base, template, both)
Returns
string absolute path.

Definition at line 584 of file ChWsbTemplate.php.

◆ getIconUrl()

ChWsbTemplate::getIconUrl (   $sName,
  $sCheckIn = CH_WSB_TEMPLATE_CHECK_IN_BOTH 
)

Get full URL for the icon.

Parameters
string$sNameicon's file name.
string$sCheckInwhere the content would be searched(base, template, both)
Returns
string full URL.

Definition at line 569 of file ChWsbTemplate.php.

◆ getImagePath()

ChWsbTemplate::getImagePath (   $sName,
  $sCheckIn = CH_WSB_TEMPLATE_CHECK_IN_BOTH 
)

Get absolute Path for the image.

Parameters
string$sName- image's file name.
string$sCheckInwhere the content would be searched(base, template, both)
Returns
string absolute path.

Definition at line 610 of file ChWsbTemplate.php.

◆ getImageUrl()

ChWsbTemplate::getImageUrl (   $sName,
  $sCheckIn = CH_WSB_TEMPLATE_CHECK_IN_BOTH 
)

Get full URL for the image.

Parameters
string$sName- images's file name.
string$sCheckInwhere the content would be searched(base, template, both)
Returns
string full URL.

Definition at line 595 of file ChWsbTemplate.php.

◆ getMetaInfo()

ChWsbTemplate::getMetaInfo ( )

Returns page meta info, like meta keyword, meta description, location, etc

Definition at line 534 of file ChWsbTemplate.php.

◆ getPageWidth()

ChWsbTemplate::getPageWidth ( )

Get page width.

Returns
string with page width.

Definition at line 385 of file ChWsbTemplate.php.

◆ getTemplate()

ChWsbTemplate::getTemplate (   $sName)

Get template, which was loaded earlier.

See also
method this->loadTemplates and field this->_aTemplates
Parameters
string$sName- template name.
Returns
string template's content.

Definition at line 558 of file ChWsbTemplate.php.

◆ getTemplatesCacheObject()

ChWsbTemplate::getTemplatesCacheObject ( )

Get cache object for templates

Returns
cache class instance

Definition at line 914 of file ChWsbTemplate.php.

◆ includeCssAsync()

ChWsbTemplate::includeCssAsync ( )

Return script tag with special code to load async css. This tag is added after js files list

Definition at line 1138 of file ChWsbTemplate.php.

◆ includeCssStyles()

ChWsbTemplate::includeCssStyles ( )

Definition at line 1315 of file ChWsbTemplate.php.

◆ includeFiles()

ChWsbTemplate::includeFiles (   $sType,
  $bSystem = false 
)

Include CSS/JS file(s) attached to the page in its head section.

See also
the method is system and would be called automatically.
Parameters
string$sTypethe type of file('js' or 'css')
Returns
string the result CSS code.

Definition at line 1339 of file ChWsbTemplate.php.

◆ init()

ChWsbTemplate::init ( )

Initialize template engine. Note. The method is executed with the system, you shouldn't execute it in your subclasses.

Definition at line 249 of file ChWsbTemplate.php.

◆ loadTemplates()

ChWsbTemplate::loadTemplates ( )

Load templates.

Reimplemented in ChQuotesTemplate, ChPmtTemplate, ChCRSSTemplate, ChBlogsTemplate, and ChAdsTemplate.

Definition at line 238 of file ChWsbTemplate.php.

◆ parseHtmlByContent()

ChWsbTemplate::parseHtmlByContent (   $sContent,
  $aVariables,
  $mixedKeyWrapperHtml = null 
)

Parse HTML template.

See also
Doesn't allow to use cache.
Parameters
string$sContent- HTML file content.
array$aVariables- key/value pairs. key should be the same as template's key, but without prefix and postfix.
mixed$mixedKeyWrapperHtml- key wrapper(string value if left and right parts are the same, array(left, right) otherwise).
Returns
string the result of operation.

Definition at line 687 of file ChWsbTemplate.php.

◆ parseHtmlByName()

ChWsbTemplate::parseHtmlByName (   $sName,
  $aVariables,
  $mixedKeyWrapperHtml = null,
  $sCheckIn = CH_WSB_TEMPLATE_CHECK_IN_BOTH 
)

Parse HTML template. Search for the template with accordance to it's file name.

See also
allows to use cache.
Parameters
string$sName- HTML file name.
array$aVariables- key/value pairs. key should be the same as template's key, but without prefix and postfix.
mixed$mixedKeyWrapperHtml- key wrapper(string value if left and right parts are the same, array(left, right) otherwise).
string$sCheckInwhere the content would be searched(base, template, both)
Returns
string the result of operation.

Reimplemented in ChQuotesTemplate, and ChWsbTwigTemplate.

Definition at line 660 of file ChWsbTemplate.php.

◆ parseHtmlByTemplateName()

ChWsbTemplate::parseHtmlByTemplateName (   $sName,
  $aVariables,
  $mixedKeyWrapperHtml = null 
)

Parse earlier loaded HTML template.

See also
Doesn't allow to use cache.
Parameters
string$sName- template name.
array$aVariables- key/value pairs. Key should be the same as template's key, excluding prefix and postfix.
Returns
string the result of operation.
See also
$this->_aTemplates

Reimplemented in ChCRSSTemplate, ChBlogsTemplate, and ChAdsTemplate.

Definition at line 704 of file ChWsbTemplate.php.

◆ parsePageByName()

ChWsbTemplate::parsePageByName (   $sName,
  $aVariables 
)

Parse page HTML template. Search for the page's template with accordance to it's file name.

See also
allows to use cache.
Parameters
string$sName- HTML file name.
array$aVariables- key/value pairs. key should be the same as template's key, but without prefix and postfix.
Returns
string the result of operation.

Definition at line 720 of file ChWsbTemplate.php.

◆ parseSystemKey()

ChWsbTemplate::parseSystemKey (   $sKey,
  $mixedKeyWrapperHtml = null 
)

Parse system keys.

Parameters
string$sKeykey
Returns
string value associated with the key.

Reimplemented in ChWsbTemplateAdmin.

Definition at line 760 of file ChWsbTemplate.php.

◆ processInjection()

ChWsbTemplate::processInjection (   $iPageIndex,
  $sKey,
  $sValue = "" 
)
  • * * Static methods for work with template injections * * *

Static method is used to add/replace the content of some key in the template. It's usefull when you don't want to modify existing template but need to add some data to existing template key.

Parameters
integer$iPageIndex- page index where injections would processed. Use 0 if you want it to be done on all the pages.
string$sKey- template key.
string$sValue- the data to be added.
Returns
string the result of operation.

Definition at line 1994 of file ChWsbTemplate.php.

◆ removeLocation()

ChWsbTemplate::removeLocation (   $sKey)

Remove location from array of locations. Note. Location is the path/url to folder where templates are stored.

Parameters
string$sKey- location's unique key.

Definition at line 317 of file ChWsbTemplate.php.

◆ removeLocationJs()

ChWsbTemplate::removeLocationJs (   $sKey)

Remove JS location from array of locations. Note. Location is the path/url to folder where templates are stored.

Parameters
string$sKey- JS location's unique key.

Definition at line 357 of file ChWsbTemplate.php.

◆ setOpenGraphInfo()

ChWsbTemplate::setOpenGraphInfo (   $a,
  $sNamespace = 'og' 
)

Set page meta Open Graph info.

Parameters
array$aopen graph info, such as type, image, title, site_name
string$sNamespacenamespace, by default 'og'

Definition at line 527 of file ChWsbTemplate.php.

◆ setPageDescription()

ChWsbTemplate::setPageDescription (   $sDescription)

Set page description.

Parameters
string$sDescriptionnecessary page description.

Definition at line 425 of file ChWsbTemplate.php.

◆ setPageMainBoxTitle()

ChWsbTemplate::setPageMainBoxTitle (   $sTitle)

Set page's main box title.

Parameters
string$sTitlenecessary page's main box title.

Definition at line 416 of file ChWsbTemplate.php.

◆ setPageTitle()

ChWsbTemplate::setPageTitle (   $sTitle)

Set page title.

Parameters
string$sTitlenecessary page title.

Definition at line 407 of file ChWsbTemplate.php.

◆ setPageWidth()

ChWsbTemplate::setPageWidth (   $sWidth)

Set page width.

Parameters
string$sWidthnecessary page width.

Definition at line 394 of file ChWsbTemplate.php.

Member Data Documentation

◆ $_aLocations

ChWsbTemplate::$_aLocations

Definition at line 139 of file ChWsbTemplate.php.

◆ $_aLocationsJs

ChWsbTemplate::$_aLocationsJs

Definition at line 140 of file ChWsbTemplate.php.

◆ $_aTemplates

ChWsbTemplate::$_aTemplates

Definition at line 137 of file ChWsbTemplate.php.

◆ $_bCacheEnable

ChWsbTemplate::$_bCacheEnable

Cache related fields

Definition at line 145 of file ChWsbTemplate.php.

◆ $_bCssArchive

ChWsbTemplate::$_bCssArchive

Definition at line 153 of file ChWsbTemplate.php.

◆ $_bCssCache

ChWsbTemplate::$_bCssCache

Definition at line 152 of file ChWsbTemplate.php.

◆ $_bImagesInline

ChWsbTemplate::$_bImagesInline

Definition at line 150 of file ChWsbTemplate.php.

◆ $_bJsArchive

ChWsbTemplate::$_bJsArchive

Definition at line 156 of file ChWsbTemplate.php.

◆ $_bJsCache

ChWsbTemplate::$_bJsCache

Definition at line 155 of file ChWsbTemplate.php.

◆ $_iImagesMaxSize

ChWsbTemplate::$_iImagesMaxSize

Definition at line 151 of file ChWsbTemplate.php.

◆ $_sCacheFilePrefix

ChWsbTemplate::$_sCacheFilePrefix

Definition at line 149 of file ChWsbTemplate.php.

◆ $_sCacheFolderUrl

ChWsbTemplate::$_sCacheFolderUrl

Definition at line 146 of file ChWsbTemplate.php.

◆ $_sCachePublicFolderPath

ChWsbTemplate::$_sCachePublicFolderPath

Definition at line 148 of file ChWsbTemplate.php.

◆ $_sCachePublicFolderUrl

ChWsbTemplate::$_sCachePublicFolderUrl

Definition at line 147 of file ChWsbTemplate.php.

◆ $_sCode

ChWsbTemplate::$_sCode

Definition at line 130 of file ChWsbTemplate.php.

◆ $_sCodeKey

ChWsbTemplate::$_sCodeKey

Definition at line 131 of file ChWsbTemplate.php.

◆ $_sCssCachePrefix

ChWsbTemplate::$_sCssCachePrefix

Definition at line 154 of file ChWsbTemplate.php.

◆ $_sFolderCss

ChWsbTemplate::$_sFolderCss

Definition at line 134 of file ChWsbTemplate.php.

◆ $_sFolderHtml

ChWsbTemplate::$_sFolderHtml

Definition at line 133 of file ChWsbTemplate.php.

◆ $_sFolderIcons

ChWsbTemplate::$_sFolderIcons

Definition at line 136 of file ChWsbTemplate.php.

◆ $_sFolderImages

ChWsbTemplate::$_sFolderImages

Definition at line 135 of file ChWsbTemplate.php.

◆ $_sInjectionsCache

ChWsbTemplate::$_sInjectionsCache

Definition at line 129 of file ChWsbTemplate.php.

◆ $_sInjectionsTable

ChWsbTemplate::$_sInjectionsTable

Definition at line 128 of file ChWsbTemplate.php.

◆ $_sJsCachePrefix

ChWsbTemplate::$_sJsCachePrefix

Definition at line 157 of file ChWsbTemplate.php.

◆ $_sKeyWrapperHtml

ChWsbTemplate::$_sKeyWrapperHtml

Definition at line 132 of file ChWsbTemplate.php.

◆ $_sPrefix

ChWsbTemplate::$_sPrefix

Main fields

Definition at line 125 of file ChWsbTemplate.php.

◆ $_sRootPath

ChWsbTemplate::$_sRootPath

Definition at line 126 of file ChWsbTemplate.php.

◆ $_sRootUrl

ChWsbTemplate::$_sRootUrl

Definition at line 127 of file ChWsbTemplate.php.


The documentation for this class was generated from the following file: