Properties

$enabled

$enabled : boolean

This plugin is enabled by default?

Type

boolean

$statusChanged

$statusChanged : boolean

Boolean indicating if this plugin was ever enabled/disabled manually

Type

boolean

$dependsOn

$dependsOn : array<mixed,string>

This plugin depends on .

..

Type

array<mixed,string>

$pico

$pico : \Pico

Current instance of Pico

Type

\Pico

$dependants

$dependants : array<mixed,object>

List of plugin which depend on this plugin

Type

array<mixed,object>

Methods

__construct()

__construct(\Pico  $pico) 

Constructs a new instance of a Pico plugin

Parameters

\Pico $pico

current instance of Pico

handleEvent()

handleEvent(string  $eventName, array  $params) : void

Handles a event that was triggered by Pico

Parameters

string $eventName

name of the triggered event

array $params

passed parameters

setEnabled()

setEnabled(boolean  $enabled, boolean  $recursive = true, boolean  $auto = false) : void

Enables or disables this plugin

Parameters

boolean $enabled

enable (true) or disable (false) this plugin

boolean $recursive

when true, enable or disable recursively In other words, if you enable a plugin, all required plugins are enabled, too. When disabling a plugin, all depending plugins are disabled likewise. Recursive operations are only performed as long as a plugin wasn't enabled/disabled manually. This parameter is optional and defaults to true.

boolean $auto

enable or disable to fulfill a dependency This parameter is optional and defaults to false.

isEnabled()

isEnabled() : boolean

Returns true if this plugin is enabled, false otherwise

Returns

boolean —

plugin is enabled (true) or disabled (false)

isStatusChanged()

isStatusChanged() : boolean

Returns true if the plugin was ever enabled/disabled manually

Returns

boolean —

plugin is in its default state (true), false otherwise

getPico()

getPico() : \Pico

Returns the plugins instance of Pico

Returns

\Pico

the plugins instance of Pico

__call()

__call(string  $methodName, array  $params) : mixed

Passes all not satisfiable method calls to Pico

Parameters

string $methodName

name of the method to call

array $params

parameters to pass

Returns

mixed —

return value of the called method

getDependencies()

getDependencies() : array<mixed,string>

Returns a list of names of plugins required by this plugin

Returns

array<mixed,string> —

required plugins

getDependants()

getDependants() : array<mixed,object>

Returns a list of plugins which depend on this plugin

Returns

array<mixed,object> —

dependant plugins

onPluginsLoaded()

onPluginsLoaded(  $plugins) : void

Triggered after Pico has loaded all available plugins

This event is triggered nevertheless the plugin is enabled or not. It is NOT guaranteed that plugin dependencies are fulfilled!

Parameters

$plugins

onConfigLoaded()

onConfigLoaded(  $config) : void

Triggered after Pico has read its configuration

Parameters

$config

onRequestUrl()

onRequestUrl(  $url) : void

Triggered after Pico has evaluated the request URL

Parameters

$url

onRequestFile()

onRequestFile(  $file) : void

Triggered after Pico has discovered the content file to serve

Parameters

$file

onContentLoading()

onContentLoading(  $file) : void

Triggered before Pico reads the contents of the file to serve

Parameters

$file

onContentLoaded()

onContentLoaded(  $rawContent) : void

Triggered after Pico has read the contents of the file to serve

Parameters

$rawContent

on404ContentLoading()

on404ContentLoading(  $file) : void

Triggered before Pico reads the contents of a 404 file

Parameters

$file

on404ContentLoaded()

on404ContentLoaded(  $rawContent) : void

Triggered after Pico has read the contents of the 404 file

Parameters

$rawContent

onMetaHeaders()

onMetaHeaders(  $headers) : void

Triggered when Pico reads its known meta header fields

Parameters

$headers

onMetaParsing()

onMetaParsing(  $rawContent,   $headers) : void

Triggered before Pico parses the meta header

Parameters

$rawContent
$headers

onMetaParsed()

onMetaParsed(  $meta) : void

Triggered after Pico has parsed the meta header

Parameters

$meta

onContentParsing()

onContentParsing(  $rawContent) : void

Triggered before Pico parses the pages content

Parameters

$rawContent

prepareFileContent()

prepareFileContent(  $content) : void

Triggered after Pico has prepared the raw file contents for parsing

Parameters

$content

onContentParsed()

onContentParsed(  $content) : void

Triggered after Pico has parsed the contents of the file to serve

Parameters

$content

onPagesLoading()

onPagesLoading() : void

Triggered before Pico reads all known pages

onSinglePageLoaded()

onSinglePageLoaded(  $pageData) : void

Triggered when Pico reads a single page from the list of all known pages

The $pageData parameter consists of the following values:

+----------------+--------+------------------------------------------+
| Array key      | Type   | Description                              |
+----------------+--------+------------------------------------------+
| id             | string | relative path to the content file        |
| url            | string | URL to the page                          |
| title          | string | title of the page (YAML header)          |
| description    | string | description of the page (YAML header)    |
| author         | string | author of the page (YAML header)         |
| time           | string | timestamp derived from the Date header   |
| date           | string | date of the page (YAML header)           |
| date_formatted | string | formatted date of the page               |
| raw_content    | string | raw, not yet parsed contents of the page |
| meta           | string | parsed meta data of the page             |
+----------------+--------+------------------------------------------+

Parameters

$pageData

onPagesLoaded()

onPagesLoaded(  $pages,   $currentPage,   $previousPage,   $nextPage) : void

Triggered after Pico has read all known pages

See DummyPlugin::onSinglePageLoaded() for details about the structure of the page data.

Parameters

$pages
$currentPage
$previousPage
$nextPage

onTwigRegistration()

onTwigRegistration() : void

Triggered before Pico registers the twig template engine

onPageRendering()

onPageRendering(  $twig,   $twigVariables,   $templateName) : void

Triggered before Pico renders the page

Parameters

$twig
$twigVariables
$templateName

onPageRendered()

onPageRendered(  $output) : void

Triggered after Pico has rendered the page

Parameters

$output

checkDependencies()

checkDependencies(boolean  $recursive) : void

Enables all plugins which this plugin depends on

Parameters

boolean $recursive

enable required plugins automatically

Throws

\RuntimeException

thrown when a dependency fails

checkDependants()

checkDependants(boolean  $recursive) : void

Disables all plugins which depend on this plugin

Parameters

boolean $recursive

disabled dependant plugins automatically

Throws

\RuntimeException

thrown when a dependency fails