PHP Class Craft\SeomaticTwigExtension

Inheritance: extends Twig_Extension
Datei anzeigen Open project: nystudio107/seomatic

Protected Properties

Property Type Description
$seomaticInitializing

Public Methods

Method Description
encodeEmailAddress ( $emailAddress ) * -------------------------------------------------------------------------------- Encode an email address as ordinal values to obfuscate it to bots --------------------------------------------------------------------------------
extractKeywords ( $text = null, $limit = 15, $withoutStopWords = true ) * -------------------------------------------------------------------------------- Extract the most important words from the passed in text via TextRank --------------------------------------------------------------------------------
extractSummary ( $text = null, $limit = null, $withoutStopWords = true ) * -------------------------------------------------------------------------------- Extract a summary from the text, or if it's not long enough, just return the text --------------------------------------------------------------------------------
extractTextFromMatrix ( $matrixBlocks ) * -------------------------------------------------------------------------------- Extract all of the text and rich text from the fields in MatrixBlockModels --------------------------------------------------------------------------------
getFilters ( ) * -------------------------------------------------------------------------------- Return our twig filters --------------------------------------------------------------------------------
getFullyQualifiedUrl ( $url ) * -------------------------------------------------------------------------------- Get a fully qualified URL based on the siteUrl, if no scheme/host is present --------------------------------------------------------------------------------
getFunctions ( ) * -------------------------------------------------------------------------------- Return our twig functions --------------------------------------------------------------------------------
getGlobals ( ) * -------------------------------------------------------------------------------- Return our global variables --------------------------------------------------------------------------------
getLocalizedUrls ( ) * -------------------------------------------------------------------------------- Returns an array of localized URLs for the current request --------------------------------------------------------------------------------
getName ( ) * -------------------------------------------------------------------------------- The name of our Twig extension --------------------------------------------------------------------------------
renderJSONLD ( $object = [] ) * -------------------------------------------------------------------------------- Render a generic JSON-LD object, passed in as an array() in the format:
truncateStringOnWord ( $theString, $desiredLength ) * -------------------------------------------------------------------------------- Truncate the the string passed in, breaking it on a word. $desiredLength is in characters; the returned string will be broken on a whole-word boundary, with an … appended to the end if it is truncated --------------------------------------------------------------------------------

Private Methods

Method Description
_get_current_template_path ( ) * -------------------------------------------------------------------------------- Get the current template path --------------------------------------------------------------------------------

Method Details

encodeEmailAddress() public method

* -------------------------------------------------------------------------------- Encode an email address as ordinal values to obfuscate it to bots --------------------------------------------------------------------------------
public encodeEmailAddress ( $emailAddress )

extractKeywords() public method

* -------------------------------------------------------------------------------- Extract the most important words from the passed in text via TextRank --------------------------------------------------------------------------------
public extractKeywords ( $text = null, $limit = 15, $withoutStopWords = true )

extractSummary() public method

* -------------------------------------------------------------------------------- Extract a summary from the text, or if it's not long enough, just return the text --------------------------------------------------------------------------------
public extractSummary ( $text = null, $limit = null, $withoutStopWords = true )

extractTextFromMatrix() public method

* -------------------------------------------------------------------------------- Extract all of the text and rich text from the fields in MatrixBlockModels --------------------------------------------------------------------------------
public extractTextFromMatrix ( $matrixBlocks )

getFilters() public method

* -------------------------------------------------------------------------------- Return our twig filters --------------------------------------------------------------------------------
public getFilters ( )

getFullyQualifiedUrl() public method

* -------------------------------------------------------------------------------- Get a fully qualified URL based on the siteUrl, if no scheme/host is present --------------------------------------------------------------------------------
public getFullyQualifiedUrl ( $url )

getFunctions() public method

* -------------------------------------------------------------------------------- Return our twig functions --------------------------------------------------------------------------------
public getFunctions ( )

getGlobals() public method

* -------------------------------------------------------------------------------- Return our global variables --------------------------------------------------------------------------------
public getGlobals ( )

getLocalizedUrls() public method

* -------------------------------------------------------------------------------- Returns an array of localized URLs for the current request --------------------------------------------------------------------------------
public getLocalizedUrls ( )

getName() public method

* -------------------------------------------------------------------------------- The name of our Twig extension --------------------------------------------------------------------------------
public getName ( )

renderJSONLD() public method

PHP: $myJSONLD = array( "type" => "Corporation", "name" => "nystudio107", "sameAs" => ["https://Twitter.com/nystudio107","https://plus.google.com/+nystudio107"], "address" => array( "type" => 'PostalAddress', "addressCountry" => "USA", ), ); Twig: {% set myJSONLD = { "type": "Corporation", "name": "nystudio107", "sameAs": ["https://Twitter.com/nystudio107","https://plus.google.com/+nystudio107"], "address": { "type": 'PostalAddress', "addressCountry": "USA", }, } %} The array can be nested arbitrarily deep with sub-arrays. The first key in the array, and in each sub-array, should be an "type" with a valid Schema.org type as the value. Because Twig doesn't support array keys with non-alphanumeric characters, SEOmatic transforms the keys "type" into "@type" at render time. --------------------------------------------------------------------------------
public renderJSONLD ( $object = [] )

truncateStringOnWord() public method

* -------------------------------------------------------------------------------- Truncate the the string passed in, breaking it on a word. $desiredLength is in characters; the returned string will be broken on a whole-word boundary, with an … appended to the end if it is truncated --------------------------------------------------------------------------------
public truncateStringOnWord ( $theString, $desiredLength )

Property Details

$seomaticInitializing protected_oe property

protected $seomaticInitializing