XOOPS  2.6.0
XoopsTheme Class Reference

Public Member Functions

 addBaseAssets ($type, $assets)
 
 addBaseScriptAssets ($assets)
 
 addBaseStylesheetAssets ($assets)
 
 addHttpMeta ($name, $value=null)
 
 addLink ($rel, $href= '', $attributes=array())
 
 addMeta ($type= 'meta', $name= '', $value= '')
 
 addScript ($src= '', $attributes=array(), $content= '')
 
 addScriptAssets ($assets, $filters= 'default', $target=null)
 
 addStylesheet ($src= '', $attributes=array(), $content= '')
 
 addStylesheetAssets ($assets, $filters= 'default', $target=null)
 
 checkCache ()
 
 genElementId ($tagName= 'xos')
 
 generateCacheId ($cache_id, $extraString= '')
 
 getLocalizationAssets ($type="main")
 
 headContent ($params, $content, &$smarty, &$repeat)
 
 render ($canvasTpl=null, $pageTpl=null, $contentTpl=null, $vars=array())
 
 renderAttributes ($coll)
 
 renderMetas ($return=false)
 
 renderMetasByType ($type)
 
 resourcePath ($path)
 
 setNamedAsset ($name, $assets, $filters=null)
 
 xoInit ()
 

Public Attributes

 $assets = null
 
 $baseAssets
 
 $bufferOutput = true
 
 $canvasTemplate = 'theme.html'
 
 $content = ''
 
 $contentCacheId = null
 
 $contentCacheLifetime = 0
 
 $contentTemplate = ''
 
 $folderName = ''
 
 $headersCacheEngine = 'default'
 
 $htmlHeadStrings = array()
 
 $metas
 
 $path = ''
 
 $plugins = array('XoopsThemeBlocksPlugin')
 
 $renderBanner = true
 
 $renderCount = 0
 
 $template = false
 
 $templateVars = array()
 
 $themesPath = 'themes'
 
 $url = ''
 
 $use_extra_cache_id = true
 

Detailed Description

Definition at line 138 of file theme.php.

Member Function Documentation

XoopsTheme::addBaseAssets (   $type,
  $assets 
)

addBaseAssets - add a list of assets to the page, these will all be combined into a single asset file at render time

Parameters
string$typetype of asset, i.e. 'css' or 'js'
array$assetslist of source files to process
Returns
void

Definition at line 740 of file theme.php.

References $assets, and $type.

Referenced by addBaseScriptAssets(), and addBaseStylesheetAssets().

Here is the caller graph for this function:

XoopsTheme::addBaseScriptAssets (   $assets)

addBaseScriptAssets - add a list of scripts to the page

Parameters
array$assetslist of source files to process
Returns
void

Definition at line 756 of file theme.php.

References $assets, and addBaseAssets().

Referenced by xoInit().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsTheme::addBaseStylesheetAssets (   $assets)

addBaseStylesheetAssets - add a list of stylesheets to the page

Parameters
array$assetslist of source files to process
Returns
void

Definition at line 768 of file theme.php.

References $assets, and addBaseAssets().

Referenced by xoInit().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsTheme::addHttpMeta (   $name,
  $value = null 
)

Set a meta http-equiv value

Parameters
string$namemeta tag name
null$valuemeta tag value
Returns
string|false

Definition at line 827 of file theme.php.

References $name, and addMeta().

Here is the call graph for this function:

XoopsTheme::addLink (   $rel,
  $href = '',
  $attributes = array() 
)

Add a <link> to the header

Parameters
string$relRelationship from the current doc to the anchored one
string$hrefURI of the anchored document
array$attributesAdditional attributes to add to the <link> element
Returns
void

Definition at line 807 of file theme.php.

References addMeta().

Here is the call graph for this function:

XoopsTheme::addMeta (   $type = 'meta',
  $name = '',
  $value = '' 
)

Change output page meta-information

Parameters
string$type
string$name
string$value
Returns
string

Definition at line 845 of file theme.php.

References $name, and $type.

Referenced by addHttpMeta(), addLink(), addScript(), addStylesheet(), and xoInit().

Here is the caller graph for this function:

XoopsTheme::addScript (   $src = '',
  $attributes = array(),
  $content = '' 
)

Load theme specific language constants

Parameters
string$typelanguage type, like 'main', 'admin'; Needs to be declared in theme xo-info.php
string$languagespecific language
Returns
bool|mixed *#@+ 20 Manipulating page meta-information Adds script code to the document head This methods allows the insertion of an external script file (if $src is provided), or of a script snippet. The file URI is parsed to take benefit of the theme resource overloading system. The $attributes parameter allows you to specify the attributes that will be added to the inserted <script> tag. If unspecified, the type attribute value will default to 'text/javascript'. // Add an external script using a physical path $theme->addScript( 'www/script.js', null, '' ); $theme->addScript( 'modules/newbb/script.js', null, '' ); // Specify attributes for the <script> tag $theme->addScript( 'mod_xoops_SiteManager::common.js', array( 'type' => 'application/x-javascript' ), '' ); // Insert a code snippet $theme->addScript( null, array( 'type' => 'application/x-javascript' ), 'window.open("Hello world");' );
Parameters
string$srcpath to an external script file
array$attributeshash of attributes to add to the <script> tag
string$contentCode snippet to output within the <script> tag
Returns
void

Definition at line 654 of file theme.php.

References $content, $xoops, addMeta(), Xoops\getInstance(), and resourcePath().

Referenced by addScriptAssets().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsTheme::addScriptAssets (   $assets,
  $filters = 'default',
  $target = null 
)

addScriptAssets - add a list of scripts to the page

Parameters
array$assetslist of source files to process
string$filterscomma separated list of filters
string$targettarget path, will default to assets directory
Returns
void

Definition at line 710 of file theme.php.

References $assets, $target, $url, and addScript().

Here is the call graph for this function:

XoopsTheme::addStylesheet (   $src = '',
  $attributes = array(),
  $content = '' 
)

Add StyleSheet or CSS code to the document head

Parameters
string | null$srcpath to .css file
array | null$attributesname => value paired array of attributes such as title
string$contentCSS code to output between the <style> tags (in case $src is empty)
Returns
void

Definition at line 682 of file theme.php.

References $content, $xoops, addMeta(), Xoops\getInstance(), and resourcePath().

Referenced by addStylesheetAssets().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsTheme::addStylesheetAssets (   $assets,
  $filters = 'default',
  $target = null 
)

addStylesheetAssets - add a list of stylesheets to the page

Parameters
string[]$assets list of source files to process
string$filterscomma separated list of filters
string$targettarget path, will default to assets directory
Returns
void

Definition at line 725 of file theme.php.

References $assets, $target, $url, and addStylesheet().

Here is the call graph for this function:

XoopsTheme::checkCache ( )

XoopsTheme::checkCache()

Returns
bool

Definition at line 459 of file theme.php.

References $_SERVER, $contentCacheLifetime, $template, $uri, generateCacheId(), XoopsBaseConfig\get(), Xoops\getInstance(), and render().

Here is the call graph for this function:

XoopsTheme::genElementId (   $tagName = 'xos')

Generates a unique element ID

Parameters
string$tagName
Returns
string

Definition at line 975 of file theme.php.

XoopsTheme::generateCacheId (   $cache_id,
  $extraString = '' 
)

Generate cache id based on extra information of language and user groups User groups other than anonymous should be detected to avoid disclosing group sensitive contents

Parameters
string$cache_idraw cache id
string$extraStringextra string
Returns
string complete cache id

Definition at line 425 of file theme.php.

References $groups, $xoops, XoopsBaseConfig\get(), and Xoops\getInstance().

Referenced by checkCache().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsTheme::getLocalizationAssets (   $type = "main")

Load localization information Folder structure for localization: themes/themefolder/english

  • main.php - language definitions
  • style.css - localization stylesheet
  • script.js - localization script
Parameters
string$typelanguage domain (unused?)
Returns
array list of 2 arrays, one

Definition at line 579 of file theme.php.

References $language, $xoops, XoopsLoad\fileExists(), Xoops\getInstance(), Xoops_Locale_Abstract\getLocale(), and Xoops_Locale\loadThemeLocale().

Referenced by xoInit().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsTheme::headContent (   $params,
  $content,
$smarty,
$repeat 
)

XoopsTheme::headContent()

Parameters
$params
string$content
$smarty
$repeat
Returns
void

Definition at line 868 of file theme.php.

References $content.

XoopsTheme::render (   $canvasTpl = null,
  $pageTpl = null,
  $contentTpl = null,
  $vars = array() 
)

Render the page The theme engine builds pages from 2 templates: canvas and content. A module can call this method directly and specify what templates the theme engine must use. If render() hasn't been called before, the theme defaults will be used for the canvas and page template (and xoopsOption['template_main'] for the content).

Parameters
string$canvasTplThe canvas template, if different from the theme default
string$pageTplThe page template, if different from the theme default (unsupported, 2.3+ only)
string$contentTplThe content template
array$varsTemplate variables to send to the template engine
Returns
bool

Definition at line 494 of file theme.php.

References $content, $header, $name, $type, $xoops, Xoops\getInstance(), and renderMetas().

Referenced by checkCache().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsTheme::renderAttributes (   $coll)

Transform an attributes collection to an XML string

Parameters
array$coll
Returns
string

Definition at line 991 of file theme.php.

References $name.

Referenced by renderMetasByType().

Here is the caller graph for this function:

XoopsTheme::renderMetas (   $return = false)

XoopsTheme::renderMetas()

Parameters
bool$returntrue to return as string, false to echo
Returns
bool|string

Definition at line 882 of file theme.php.

References $type, $url, and renderMetasByType().

Referenced by render().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsTheme::renderMetasByType (   $type)

XoopsTheme::renderMetasByType() render the specified metadata type

Parameters
string$typetype to render
Returns
string

Definition at line 919 of file theme.php.

References $content, $name, $type, and renderAttributes().

Referenced by renderMetas().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsTheme::resourcePath (   $path)

Return a themable file resource path

Parameters
string$path
Returns
string

Definition at line 1009 of file theme.php.

References $path, $xoops_root_path, XoopsLoad\fileExists(), and XoopsBaseConfig\get().

Referenced by addScript(), addStylesheet(), and Xoops_Locale\loadThemeLocale().

Here is the call graph for this function:

Here is the caller graph for this function:

XoopsTheme::setNamedAsset (   $name,
  $assets,
  $filters = null 
)

setNamedAsset - Add an asset reference to the asset manager. The specifed assest will be added to the asset manager with the specified name. As an example:

$theme->setNamedAsset('aacss','module/aa/assets/css/*.css');

This will create an asset reference which can be added using other asset functions, such as:

$theme->addBaseStylesheetAssets('');

Additional custom filters can be specified for the named assest if needed.

Parameters
string$namethe name of the reference to be added
mixed$assetsa string asset path, or an array of asset paths, may include wildcard
string$filterscomma separated list of filters
Returns
boolean true if asset registers, false on error

Definition at line 793 of file theme.php.

References $assets, and $name.

XoopsTheme::xoInit ( )

*#@- *#@+ 10 Initialization Initializes this theme Upon initialization, the theme creates its template engine and instanciates the plug-ins from the specified $plugins list. If the theme is a 2.0 theme, that does not display redirection messages, the HTTP redirections system is disabled to ensure users will see the redirection screen.

Returns
bool

Definition at line 304 of file theme.php.

References $_SERVER, $avatar, $folderName, $GLOBALS, $metas, $name, $response, $xoops, addBaseScriptAssets(), addBaseStylesheetAssets(), addMeta(), XoopsLoad\fileExists(), XoopsBaseConfig\get(), Xoops\getInstance(), and getLocalizationAssets().

Here is the call graph for this function:

Member Data Documentation

XoopsTheme::$assets = null
XoopsTheme::$baseAssets
Initial value:
= array(
'js' => array(),
'css' => array(),
)

Definition at line 252 of file theme.php.

XoopsTheme::$bufferOutput = true

Definition at line 171 of file theme.php.

XoopsTheme::$canvasTemplate = 'theme.html'

Definition at line 178 of file theme.php.

XoopsTheme::$content = ''

Definition at line 209 of file theme.php.

Referenced by addScript(), addStylesheet(), headContent(), render(), and renderMetasByType().

XoopsTheme::$contentCacheId = null

Definition at line 202 of file theme.php.

XoopsTheme::$contentCacheLifetime = 0

Definition at line 197 of file theme.php.

Referenced by checkCache().

XoopsTheme::$contentTemplate = ''

Definition at line 192 of file theme.php.

XoopsTheme::$folderName = ''

Definition at line 152 of file theme.php.

Referenced by xoInit().

XoopsTheme::$headersCacheEngine = 'default'

Definition at line 285 of file theme.php.

XoopsTheme::$htmlHeadStrings = array()

Definition at line 262 of file theme.php.

XoopsTheme::$metas
Initial value:
= array(
'meta' => array(), 'link' => array(), 'script' => array()
)

Definition at line 236 of file theme.php.

Referenced by xoInit().

XoopsTheme::$path = ''

Definition at line 159 of file theme.php.

Referenced by resourcePath().

XoopsTheme::$plugins = array('XoopsThemeBlocksPlugin')

Definition at line 217 of file theme.php.

XoopsTheme::$renderBanner = true

Definition at line 145 of file theme.php.

XoopsTheme::$renderCount = 0

Definition at line 222 of file theme.php.

XoopsTheme::$template = false

Definition at line 229 of file theme.php.

Referenced by checkCache().

XoopsTheme::$templateVars = array()

Definition at line 269 of file theme.php.

XoopsTheme::$themesPath = 'themes'

Definition at line 185 of file theme.php.

XoopsTheme::$url = ''

Definition at line 164 of file theme.php.

Referenced by addScriptAssets(), addStylesheetAssets(), and renderMetas().

XoopsTheme::$use_extra_cache_id = true

Definition at line 276 of file theme.php.


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