PHP Class Frontend\Core\Engine\Header

..)
Inheritance: extends Frontend\Core\Engine\Base\Object
Datei anzeigen Open project: forkcms/forkcms Class Usage Examples

Public Methods

Method Description
__construct ( Symfony\Component\HttpKernel\KernelInterface $kernel )
addCSS ( string $file, boolean $minify = true, boolean $addTimestamp = null ) Add a CSS file into the array
addJS ( string $file, boolean $minify = true, boolean $addTimestamp = null, integer $priorityGroup = self::PRIORITY_GROUP_DEFAULT ) Add a javascript file into the array
addJsData ( string $module, string $key, mixed $value ) Add data into the jsData
addLink ( array $attributes, boolean $overwrite = false, mixed $uniqueKeys = null ) Add link
addMetaData ( array $attributes, boolean $overwrite = false, mixed $uniqueKeys = null, mixed $additionalKey = null ) Add meta data
addMetaDescription ( string $value, boolean $overwrite = false ) Add meta-description, somewhat a shortcut for the addMetaData-method
addMetaKeywords ( string $value, boolean $overwrite = false ) Add meta-keywords, somewhat a shortcut for the addMetaData-method
addOpenGraphData ( string $key, string $value, boolean $overwrite = false ) Add Open Graph data
addOpenGraphImage ( string $image, boolean $overwrite = false, integer $width, integer $height ) Add Open Graph image
addRssLink ( string $title, string $link ) Add Rss link
extractOpenGraphImages ( string $content ) Extract images from content that can be added add Open Graph image
getCSSFiles ( ) : array Get all added CSS files
getJSFiles ( ) : array get all added javascript files
getLinks ( ) : array Get all links
getMeta ( ) : array Get meta
getMetaCustom ( ) : string Get the custom meta
getMetaValue ( string $attribute, string $attributeValue ) : array Get all attributes for meta tag specified by the attribute and the value for that attribute.
getPageTitle ( ) : string Get the page title
parse ( ) Parse the header into the template
setCanonicalUrl ( string $url ) Set the canonical URL
setMetaCustom ( string $meta ) Set the custom meta
setPageTitle ( string $value, boolean $overwrite = false ) Set the page title
setTwitterCard ( string $title, string $description, string $imageURL, string $cardType = 'summary', string $siteHandle = null, string $creatorHandle = null ) Set Twitter Card

Private Methods

Method Description
cssSort ( array $cssFiles ) : array Sort function for CSS-files
minifyCSS ( string $file ) : string Minify a CSS-file
minifyJS ( string $file ) : string Minify a javascript-file
parseCSS ( ) Parse the CSS-files
parseCustomHeaderHTMLAndGoogleAnalytics ( ) Parse Google Analytics
parseFacebook ( ) Parse Facebook related header-data
parseJS ( ) Parse the JS-files
parseMetaAndLinks ( ) Parse the meta and link-tags
parseSeo ( ) Parse SEO specific data

Method Details

__construct() public method

public __construct ( Symfony\Component\HttpKernel\KernelInterface $kernel )
$kernel Symfony\Component\HttpKernel\KernelInterface

addCSS() public method

Add a CSS file into the array
public addCSS ( string $file, boolean $minify = true, boolean $addTimestamp = null )
$file string The path for the CSS-file that should be loaded.
$minify boolean Should the CSS be minified?
$addTimestamp boolean May we add a timestamp for caching purposes?

addJS() public method

Add a javascript file into the array
public addJS ( string $file, boolean $minify = true, boolean $addTimestamp = null, integer $priorityGroup = self::PRIORITY_GROUP_DEFAULT )
$file string The path to the javascript-file that should be loaded.
$minify boolean Should the file be minified?
$addTimestamp boolean May we add a timestamp for caching purposes?
$priorityGroup integer

addJsData() public method

Add data into the jsData
public addJsData ( string $module, string $key, mixed $value )
$module string The name of the module.
$key string The key whereunder the value will be stored.
$value mixed The value

addMetaData() public method

Add meta data
public addMetaData ( array $attributes, boolean $overwrite = false, mixed $uniqueKeys = null, mixed $additionalKey = null )
$attributes array The attributes to parse.
$overwrite boolean Should we overwrite the current value?
$uniqueKeys mixed Which keys can we use to decide if an item is unique.
$additionalKey mixed This additional key helps you to create your own custom unique keys if required.

addMetaDescription() public method

Add meta-description, somewhat a shortcut for the addMetaData-method
public addMetaDescription ( string $value, boolean $overwrite = false )
$value string The description.
$overwrite boolean Should we overwrite the previous value?

addMetaKeywords() public method

Add meta-keywords, somewhat a shortcut for the addMetaData-method
public addMetaKeywords ( string $value, boolean $overwrite = false )
$value string The description.
$overwrite boolean Should we overwrite the previous value?

addOpenGraphData() public method

Add Open Graph data
public addOpenGraphData ( string $key, string $value, boolean $overwrite = false )
$key string The key (without og:).
$value string The value.
$overwrite boolean Should we overwrite the previous value?

addOpenGraphImage() public method

Add Open Graph image
public addOpenGraphImage ( string $image, boolean $overwrite = false, integer $width, integer $height )
$image string The path to the image.
$overwrite boolean Should we overwrite the previous value?
$width integer The width of the image.
$height integer The height of the image.

extractOpenGraphImages() public method

Extract images from content that can be added add Open Graph image
public extractOpenGraphImages ( string $content )
$content string The content (where from to extract the images).

getCSSFiles() public method

Get all added CSS files
public getCSSFiles ( ) : array
return array

getJSFiles() public method

get all added javascript files
public getJSFiles ( ) : array
return array

getMeta() public method

Get meta
public getMeta ( ) : array
return array

getMetaCustom() public method

Get the custom meta
public getMetaCustom ( ) : string
return string

getMetaValue() public method

Get all attributes for meta tag specified by the attribute and the value for that attribute.
public getMetaValue ( string $attribute, string $attributeValue ) : array
$attribute string The attribute to match on.
$attributeValue string The value for the unique attribute.
return array

getPageTitle() public method

Get the page title
public getPageTitle ( ) : string
return string

parse() public method

Parse the header into the template
public parse ( )

setCanonicalUrl() public method

Set the canonical URL
public setCanonicalUrl ( string $url )
$url string The Canonical URL.

setMetaCustom() public method

Set the custom meta
public setMetaCustom ( string $meta )
$meta string The meta data to set.

setPageTitle() public method

Set the page title
public setPageTitle ( string $value, boolean $overwrite = false )
$value string The page title to be set or to be prepended.
$overwrite boolean Should the existing page title be overwritten?

setTwitterCard() public method

Set Twitter Card
public setTwitterCard ( string $title, string $description, string $imageURL, string $cardType = 'summary', string $siteHandle = null, string $creatorHandle = null )
$title string The title (maximum 70 characters)
$description string A brief description of the card (maximum 200 characters)
$imageURL string The URL of the image (minimum 280x150 and <1MB)
$cardType string The cardtype, possible types: https://dev.twitter.com/cards/types
$siteHandle string (optional) Twitter handle of the site
$creatorHandle string (optional) Twitter handle of the author