PHP Class HeadModule, vanilla

Inheritance: extends Module
显示文件 Open project: vanilla/vanilla Class Usage Examples

Protected Properties

Property Type Description
$_Subtitle A string to be concatenated with $this->_Title.
$_Title The main text for the "title" tag in the head.
$_TitleDivider string to be concatenated with $this->_Title if there is also a $this->_Subtitle string being concatenated.

Public Methods

Method Description
__construct ( string $Sender = '' )
addCss ( string $HRef, string $Media = '', boolean $AddVersion = true, array $Options = null ) Adds a "link" tag to the head containing a reference to a stylesheet.
addRss ( $HRef, $Title )
addScript ( string $Src, string $Type = 'text/javascript', boolean $AddVersion = true, mixed $Options = [] ) Adds a "script" tag to the head.
addString ( $String ) Adds a string to the collection of strings to be inserted into the head.
addTag ( $Tag, $Properties, $Content = null, $Index = null ) Adds a new tag to the head.
assetTarget ( ) : string
clearCSS ( ) Removes any added stylesheets from the head.
clearScripts ( ) Removes any script include tags from the head.
clearTag ( $Tag, $Property = '', $Value = '' ) Removes any tags with the specified $Tag, $Property, and $Value.
getStrings ( ) Return all strings.
getTags ( $RequestedType = '' ) Return all Tags of the specified type (or all tags).
setFavIcon ( $HRef ) Sets the favicon location.
setSubtitle ( string $subtitle = '' ) Sets the subtitle.
setTitleDivider ( string $titleDivider = ' — ' ) Sets the title divider.
tagCmp ( $A, $B ) : integer
tags ( array $Value = null ) Gets or sets the tags collection.
title ( string $Title = '', boolean $NoSubtitle = false ) : mixed | string Gets/sets the modules title.
toString ( ) Render the entire head module.

Method Details

__construct() public method

public __construct ( string $Sender = '' )
$Sender string

addCss() public method

Adds a "link" tag to the head containing a reference to a stylesheet.
public addCss ( string $HRef, string $Media = '', boolean $AddVersion = true, array $Options = null )
$HRef string Location of the stylesheet relative to the web root (if an absolute path with http:// is provided, it will use the HRef as provided). ie. /themes/default/css/layout.css or http://url.com/layout.css
$Media string Type media for the stylesheet. ie. "screen", "print", etc.
$AddVersion boolean Whether to append version number as query string.
$Options array Additional properties to pass to AddTag, e.g. 'ie' => 'lt IE 7';

addRss() public method

public addRss ( $HRef, $Title )
$HRef
$Title

addScript() public method

Adds a "script" tag to the head.
public addScript ( string $Src, string $Type = 'text/javascript', boolean $AddVersion = true, mixed $Options = [] )
$Src string The location of the script relative to the web root. ie. "/js/jquery.js"
$Type string The type of script being added. ie. "text/javascript"
$AddVersion boolean Whether to append version number as query string.
$Options mixed Additional options to add to the tag. The following values are accepted: - numeric: This will be the script's sort. - string: This will hint the script (inline will inline the file in the page. - array: An array of options (ex. sort, hint, version).

addString() public method

Adds a string to the collection of strings to be inserted into the head.
public addString ( $String )

addTag() public method

Adds a new tag to the head.
public addTag ( $Tag, $Properties, $Content = null, $Index = null )

assetTarget() public method

public assetTarget ( ) : string
return string

clearCSS() public method

Removes any added stylesheets from the head.
public clearCSS ( )

clearScripts() public method

Removes any script include tags from the head.
public clearScripts ( )

clearTag() public method

Only $Tag is required.
public clearTag ( $Tag, $Property = '', $Value = '' )

getStrings() public method

Return all strings.
public getStrings ( )

getTags() public method

Return all Tags of the specified type (or all tags).
public getTags ( $RequestedType = '' )

setFavIcon() public method

Sets the favicon location.
public setFavIcon ( $HRef )

setSubtitle() public method

Sets the subtitle.
public setSubtitle ( string $subtitle = '' )
$subtitle string The subtitle which should be displayed in the title.

setTitleDivider() public method

This is the string that is used to concatenate title and subtitle. Defaults to ' — '.
public setTitleDivider ( string $titleDivider = ' — ' )
$titleDivider string The string that concats title and subtitle.

tagCmp() public static method

public static tagCmp ( $A, $B ) : integer
$A
$B
return integer

tags() public method

Gets or sets the tags collection.
public tags ( array $Value = null )
$Value array .

title() public method

Gets/sets the modules title.
public title ( string $Title = '', boolean $NoSubtitle = false ) : mixed | string
$Title string
$NoSubtitle boolean
return mixed | string

toString() public method

Render the entire head module.
public toString ( )

Property Details

$_Subtitle protected_oe property

A string to be concatenated with $this->_Title.
protected $_Subtitle

$_Title protected_oe property

The main text for the "title" tag in the head.
protected $_Title

$_TitleDivider protected_oe property

string to be concatenated with $this->_Title if there is also a $this->_Subtitle string being concatenated.
protected $_TitleDivider