PHP Class PicoExcerpt

This plugin exists for backward compatibility and is disabled by default. It gets automatically enabled when {@link PicoDeprecated} is enabled. You can avoid this by calling {@link PicoExcerpt::setEnabled()}. This plugin doesn't do its job very well and depends on {@link PicoParsePagesContent}, what heavily impacts Pico's performance. You should either use the Description meta header field or write something own. Best solution seems to be a filter for twig, see e.g. {@link https://gist.github.com/james2doyle/6629712}.
Author: Daniel Rudolf
Inheritance: extends AbstractPicoPlugin
Show file Open project: gilbitron/pico

Protected Properties

Property Type Description
$dependsOn This plugin depends on PicoParsePagesContent
$enabled This plugin is disabled by default

Public Methods

Method Description
onConfigLoaded ( array &$config ) Adds the default excerpt length of 50 words to the config
onSinglePageLoaded ( array &$pageData ) Creates a excerpt for the contents of each page

Protected Methods

Method Description
createExcerpt ( string $string, integer $wordLimit ) : string Helper function to create a excerpt of a string

Method Details

createExcerpt() protected method

Helper function to create a excerpt of a string
protected createExcerpt ( string $string, integer $wordLimit ) : string
$string string the string to create a excerpt from
$wordLimit integer the maximum number of words the excerpt should be long
return string excerpt of $string

onConfigLoaded() public method

Adds the default excerpt length of 50 words to the config
See also: DummyPlugin::onConfigLoaded()
public onConfigLoaded ( array &$config )
$config array

onSinglePageLoaded() public method

Creates a excerpt for the contents of each page
See also: PicoExcerpt::createExcerpt()
See also: DummyPlugin::onSinglePageLoaded()
public onSinglePageLoaded ( array &$pageData )
$pageData array

Property Details

$dependsOn protected property

This plugin depends on PicoParsePagesContent
See also: PicoParsePagesContent
See also: AbstractPicoPlugin::$dependsOn
protected $dependsOn

$enabled protected property

This plugin is disabled by default
See also: AbstractPicoPlugin::$enabled
protected $enabled