Pico 3.0 API Documentation (pico-3.0 branch)

AbstractPlugin implements PluginInterface

Abstract class to extend from when implementing a Pico plugin

Please refer to PluginInterface for more information about how to develop a plugin for Pico.

Tags
see
PluginInterface
author

Daniel Rudolf

link
http://picocms.org
license

http://opensource.org/licenses/MIT The MIT License

version
3.0

Interfaces, Classes and Traits

PluginInterface
Common interface for Pico plugins

Table of Contents

__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
setEnabled()  : mixed
Enables or disables this plugin

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

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.

Return values
mixed

Search results