DummyPlugin extends AbstractPlugin
Pico dummy plugin - a template for plugins
You're a plugin developer? This template may be helpful :-) Simply remove the events you don't need and add your own logic.
Tags
Table of Contents
- API_VERSION = 3
- API version used by this plugin
- __construct() : mixed
- Constructs a new instance of a Pico plugin
- getDependants() : array<string|int, object>
- Returns a list of plugins which depend on this plugin
- getDependencies() : array<string|int, string>
- Returns a list of names of plugins required by this plugin
- getPico() : Pico
- Returns the plugin's instance of Pico
- getPluginConfig() : mixed
- Returns either the value of the specified plugin config variable or the config array
- handleEvent() : mixed
- Handles a event that was triggered by Pico
- isEnabled() : bool|null
- Returns a boolean indicating whether this plugin is enabled or not
- isStatusChanged() : bool
- Returns TRUE if the plugin was ever enabled/disabled manually
- on404ContentLoaded() : mixed
- Triggered after Pico has read the contents of the 404 file
- on404ContentLoading() : mixed
- Triggered before Pico reads the contents of a 404 file
- onConfigLoaded() : mixed
- Triggered after Pico has read its configuration
- onContentLoaded() : mixed
- Triggered after Pico has read the contents of the file to serve
- onContentLoading() : mixed
- Triggered before Pico reads the contents of the file to serve
- onContentParsed() : mixed
- Triggered after Pico has parsed the contents of the file to serve
- onContentParsing() : mixed
- Triggered before Pico parses the pages content
- onContentPrepared() : mixed
- Triggered after Pico has prepared the raw file contents for parsing
- onCurrentPageDiscovered() : mixed
- Triggered when Pico discovered the current, previous and next pages
- onMetaHeaders() : mixed
- Triggered when Pico reads its known meta header fields
- onMetaParsed() : mixed
- Triggered after Pico has parsed the meta header
- onMetaParsing() : mixed
- Triggered before Pico parses the meta header
- onPageRendered() : mixed
- Triggered after Pico has rendered the page
- onPageRendering() : mixed
- Triggered before Pico renders the page
- onPagesDiscovered() : mixed
- Triggered after Pico has discovered all known pages
- onPagesLoaded() : mixed
- Triggered after Pico has sorted the pages array
- onPagesLoading() : mixed
- Triggered before Pico reads all known pages
- onPageTreeBuilt() : mixed
- Triggered after Pico built the page tree
- onParsedownRegistered() : mixed
- Triggered when Pico registers the Parsedown parser
- onPluginManuallyLoaded() : mixed
- Triggered when Pico manually loads a plugin
- onPluginsLoaded() : mixed
- Triggered after Pico has loaded all available plugins
- onRequestFile() : mixed
- Triggered after Pico has discovered the content file to serve
- onRequestUrl() : mixed
- Triggered after Pico has evaluated the request URL
- onSinglePageContent() : mixed
- Triggered when Pico loads the raw contents of a single page
- onSinglePageLoaded() : mixed
- Triggered when Pico loads a single page
- onSinglePageLoading() : mixed
- Triggered before Pico loads a single page
- onThemeLoaded() : mixed
- Triggered after Pico loaded its theme
- onThemeLoading() : mixed
- Triggered before Pico loads its theme
- onTwigRegistered() : mixed
- Triggered when Pico registers the twig template engine
- onYamlParserRegistered() : mixed
- Triggered when Pico registers the YAML parser
- setEnabled() : mixed
- Enables or disables this plugin
Constants
API_VERSION
API version used by this plugin
public
int
API_VERSION
= 3
Methods
__construct()
Constructs a new instance of a Pico plugin
public
__construct(Pico $pico) : mixed
Parameters
- $pico : Pico
-
current instance of Pico
Return values
mixed —getDependants()
Returns a list of plugins which depend on this plugin
public
getDependants() : array<string|int, object>
Return values
array<string|int, object> —dependant plugins
getDependencies()
Returns a list of names of plugins required by this plugin
public
getDependencies() : array<string|int, string>
Return values
array<string|int, string> —required plugins
getPico()
Returns the plugin's instance of Pico
public
getPico() : Pico
Return values
Pico —the plugin's instance of Pico
getPluginConfig()
Returns either the value of the specified plugin config variable or the config array
public
getPluginConfig([string $configName = null ][, mixed $default = null ]) : mixed
Parameters
- $configName : string = null
-
optional name of a config variable
- $default : mixed = null
-
optional default value to return when the named config variable doesn't exist
Return values
mixed —if no name of a config variable has been supplied, the plugin's config array is returned; otherwise it returns either the value of the named config variable, or, if the named config variable doesn't exist, the provided default value or NULL
handleEvent()
Handles a event that was triggered by Pico
public
handleEvent(mixed $eventName, array<string|int, mixed> $params) : mixed
Parameters
- $eventName : mixed
-
name of the triggered event
- $params : array<string|int, mixed>
-
passed parameters
Return values
mixed —isEnabled()
Returns a boolean indicating whether this plugin is enabled or not
public
isEnabled() : bool|null
Return values
bool|null —plugin is enabled (TRUE) or disabled (FALSE)
isStatusChanged()
Returns TRUE if the plugin was ever enabled/disabled manually
public
isStatusChanged() : bool
Return values
bool —plugin is in its default state (TRUE), FALSE otherwise
on404ContentLoaded()
Triggered after Pico has read the contents of the 404 file
public
on404ContentLoaded(string &$rawContent) : mixed
Parameters
- $rawContent : string
-
raw file contents
Tags
Return values
mixed —on404ContentLoading()
Triggered before Pico reads the contents of a 404 file
public
on404ContentLoading() : mixed
Tags
Return values
mixed —onConfigLoaded()
Triggered after Pico has read its configuration
public
onConfigLoaded(array<string|int, mixed> &$config) : mixed
Parameters
- $config : array<string|int, mixed>
-
array of config variables
Tags
Return values
mixed —onContentLoaded()
Triggered after Pico has read the contents of the file to serve
public
onContentLoaded(string &$rawContent) : mixed
If Pico serves a 404 file, this event is triggered with the raw contents of said 404 file. Use Pico::is404Content() to check for this case when necessary.
Parameters
- $rawContent : string
-
raw file contents
Tags
Return values
mixed —onContentLoading()
Triggered before Pico reads the contents of the file to serve
public
onContentLoading() : mixed
Tags
Return values
mixed —onContentParsed()
Triggered after Pico has parsed the contents of the file to serve
public
onContentParsed(string &$content) : mixed
Parameters
- $content : string
-
parsed contents (HTML) of the requested page
Tags
Return values
mixed —onContentParsing()
Triggered before Pico parses the pages content
public
onContentParsing() : mixed
Tags
Return values
mixed —onContentPrepared()
Triggered after Pico has prepared the raw file contents for parsing
public
onContentPrepared(string &$markdown) : mixed
Parameters
- $markdown : string
-
Markdown contents of the requested page
Tags
Return values
mixed —onCurrentPageDiscovered()
Triggered when Pico discovered the current, previous and next pages
public
onCurrentPageDiscovered([array<string|int, mixed>|null &$currentPage = null ][, array<string|int, mixed>|null &$previousPage = null ][, array<string|int, mixed>|null &$nextPage = null ]) : mixed
If Pico isn't serving a regular page, but a plugin's virtual page, there will neither be a current, nor previous or next pages. Please refer to Pico::readPages() for information about the structure of a single page's data.
Parameters
- $currentPage : array<string|int, mixed>|null = null
-
data of the page being served
- $previousPage : array<string|int, mixed>|null = null
-
data of the previous page
- $nextPage : array<string|int, mixed>|null = null
-
data of the next page
Tags
Return values
mixed —onMetaHeaders()
Triggered when Pico reads its known meta header fields
public
onMetaHeaders(array<string|int, string> &$headers) : mixed
Parameters
- $headers : array<string|int, string>
-
list of known meta header fields; the array key specifies the YAML key to search for, the array value is later used to access the found value
Tags
Return values
mixed —onMetaParsed()
Triggered after Pico has parsed the meta header
public
onMetaParsed(array<string|int, string> &$meta) : mixed
Parameters
- $meta : array<string|int, string>
-
parsed meta data
Tags
Return values
mixed —onMetaParsing()
Triggered before Pico parses the meta header
public
onMetaParsing() : mixed
Tags
Return values
mixed —onPageRendered()
Triggered after Pico has rendered the page
public
onPageRendered(string &$output) : mixed
Parameters
- $output : string
-
contents which will be sent to the user
Tags
Return values
mixed —onPageRendering()
Triggered before Pico renders the page
public
onPageRendering(string &$templateName, array<string|int, mixed> &$twigVariables) : mixed
Parameters
- $templateName : string
-
file name of the template
- $twigVariables : array<string|int, mixed>
-
template variables
Tags
Return values
mixed —onPagesDiscovered()
Triggered after Pico has discovered all known pages
public
onPagesDiscovered(array<string|int, array<string|int, mixed>> &$pages) : mixed
Pico's pages array isn't sorted until the onPagesLoaded
event is
triggered. Please refer to Pico::readPages() for information
about the structure of Pico's pages array and the structure of a single
page's data.
Parameters
- $pages : array<string|int, array<string|int, mixed>>
-
list of all known pages
Tags
Return values
mixed —onPagesLoaded()
Triggered after Pico has sorted the pages array
public
onPagesLoaded(array<string|int, array<string|int, mixed>> &$pages) : mixed
Please refer to Pico::readPages() for information about the structure of Pico's pages array and the structure of a single page's data.
Parameters
- $pages : array<string|int, array<string|int, mixed>>
-
sorted list of all known pages
Tags
Return values
mixed —onPagesLoading()
Triggered before Pico reads all known pages
public
onPagesLoading() : mixed
Tags
Return values
mixed —onPageTreeBuilt()
Triggered after Pico built the page tree
public
onPageTreeBuilt(array<string|int, mixed> &$pageTree) : mixed
Please refer to Pico::buildPageTree() for information about the structure of Pico's page tree array.
Parameters
- $pageTree : array<string|int, mixed>
-
page tree
Tags
Return values
mixed —onParsedownRegistered()
Triggered when Pico registers the Parsedown parser
public
onParsedownRegistered(Parsedown &$parsedown) : mixed
Parameters
- $parsedown : Parsedown
-
Parsedown instance
Tags
Return values
mixed —onPluginManuallyLoaded()
Triggered when Pico manually loads a plugin
public
onPluginManuallyLoaded(object $plugin) : mixed
Parameters
- $plugin : object
-
loaded plugin instance
Tags
Return values
mixed —onPluginsLoaded()
Triggered after Pico has loaded all available plugins
public
onPluginsLoaded(array<string|int, object> $plugins) : mixed
This event is triggered nevertheless the plugin is enabled or not. It is NOT guaranteed that plugin dependencies are fulfilled!
Parameters
- $plugins : array<string|int, object>
-
loaded plugin instances
Tags
Return values
mixed —onRequestFile()
Triggered after Pico has discovered the content file to serve
public
onRequestFile(string &$file) : mixed
Parameters
- $file : string
-
absolute path to the content file to serve
Tags
Return values
mixed —onRequestUrl()
Triggered after Pico has evaluated the request URL
public
onRequestUrl(string &$url) : mixed
Parameters
- $url : string
-
part of the URL describing the requested contents
Tags
Return values
mixed —onSinglePageContent()
Triggered when Pico loads the raw contents of a single page
public
onSinglePageContent(string $id, string &$rawContent) : mixed
Please note that this event isn't triggered when the currently processed page is the requested page. The reason for this exception is that the raw contents of this page were loaded already.
Parameters
- $id : string
-
relative path to the content file
- $rawContent : string
-
raw file contents
Tags
Return values
mixed —onSinglePageLoaded()
Triggered when Pico loads a single page
public
onSinglePageLoaded(array<string|int, mixed> &$pageData) : mixed
Please refer to Pico::readPages() for information about the structure of a single page's data.
Parameters
- $pageData : array<string|int, mixed>
-
data of the loaded page
Tags
Return values
mixed —onSinglePageLoading()
Triggered before Pico loads a single page
public
onSinglePageLoading(string $id, bool|null &$skipPage) : mixed
Set the $skipFile
parameter to TRUE to remove this page from the pages
array. Pico usually passes NULL by default, unless it is a conflicting
page (i.e. content/sub.md
, but there's also a content/sub/index.md
),
then it passes TRUE. Don't change this value incautiously if it isn't
NULL! Someone likely set it to TRUE or FALSE on purpose...
Parameters
- $id : string
-
relative path to the content file
- $skipPage : bool|null
-
set this to TRUE to remove this page from the pages array, otherwise leave it unchanged
Tags
Return values
mixed —onThemeLoaded()
Triggered after Pico loaded its theme
public
onThemeLoaded(string $theme, int $themeApiVersion, array<string|int, mixed> &$themeConfig) : mixed
Parameters
- $theme : string
-
name of current theme
- $themeApiVersion : int
-
API version of the theme
- $themeConfig : array<string|int, mixed>
-
config array of the theme
Tags
Return values
mixed —onThemeLoading()
Triggered before Pico loads its theme
public
onThemeLoading(string &$theme) : mixed
Parameters
- $theme : string
-
name of current theme
Tags
Return values
mixed —onTwigRegistered()
Triggered when Pico registers the twig template engine
public
onTwigRegistered(TwigEnvironment &$twig) : mixed
Parameters
- $twig : TwigEnvironment
-
Twig instance
Tags
Return values
mixed —onYamlParserRegistered()
Triggered when Pico registers the YAML parser
public
onYamlParserRegistered(Parser &$yamlParser) : mixed
Parameters
- $yamlParser : Parser
-
YAML parser instance
Tags
Return values
mixed —setEnabled()
Enables or disables this plugin
public
setEnabled(mixed $enabled[, mixed $recursive = true ][, mixed $auto = false ]) : mixed
Parameters
- $enabled : mixed
-
enable (TRUE) or disable (FALSE) this plugin
- $recursive : mixed = true
-
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.
- $auto : mixed = false
-
enable or disable to fulfill a dependency. This parameter is optional and defaults to FALSE.