123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314 |
- <?php
- /**
- * 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.
- *
- * @author Daniel Rudolf
- * @link http://picocms.org
- * @license http://opensource.org/licenses/MIT
- * @version 1.0
- */
- class DummyPlugin extends AbstractPicoPlugin
- {
- /**
- * This plugin is enabled by default?
- *
- * @see AbstractPicoPlugin::$enabled
- * @var boolean
- */
- protected $enabled = false;
- /**
- * This plugin depends on ...
- *
- * @see AbstractPicoPlugin::$dependsOn
- * @var string[]
- */
- protected $dependsOn = array();
- /**
- * 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!
- *
- * @see Pico::getPlugin()
- * @see Pico::getPlugins()
- * @param object[] &$plugins loaded plugin instances
- * @return void
- */
- public function onPluginsLoaded(&$plugins)
- {
- // your code
- }
- /**
- * Triggered after Pico has read its configuration
- *
- * @see Pico::getConfig()
- * @param mixed[] &$config array of config variables
- * @return void
- */
- public function onConfigLoaded(&$config)
- {
- // your code
- }
- /**
- * Triggered after Pico has evaluated the request URL
- *
- * @see Pico::getRequestUrl()
- * @param string &$url part of the URL describing the requested contents
- * @return void
- */
- public function onRequestUrl(&$url)
- {
- // your code
- }
- /**
- * Triggered after Pico has discovered the content file to serve
- *
- * @see Pico::getBaseUrl()
- * @see Pico::getRequestFile()
- * @param string &$file absolute path to the content file to serve
- * @return void
- */
- public function onRequestFile(&$file)
- {
- // your code
- }
- /**
- * Triggered before Pico reads the contents of the file to serve
- *
- * @see Pico::loadFileContent()
- * @see DummyPlugin::onContentLoaded()
- * @param string &$file path to the file which contents will be read
- * @return void
- */
- public function onContentLoading(&$file)
- {
- // your code
- }
- /**
- * Triggered after Pico has read the contents of the file to serve
- *
- * @see Pico::getRawContent()
- * @param string &$rawContent raw file contents
- * @return void
- */
- public function onContentLoaded(&$rawContent)
- {
- // your code
- }
- /**
- * Triggered before Pico reads the contents of a 404 file
- *
- * @see Pico::load404Content()
- * @see DummyPlugin::on404ContentLoaded()
- * @param string &$file path to the file which contents were requested
- * @return void
- */
- public function on404ContentLoading(&$file)
- {
- // your code
- }
- /**
- * Triggered after Pico has read the contents of the 404 file
- *
- * @see Pico::getRawContent()
- * @param string &$rawContent raw file contents
- * @return void
- */
- public function on404ContentLoaded(&$rawContent)
- {
- // your code
- }
- /**
- * Triggered when Pico reads its known meta header fields
- *
- * @see Pico::getMetaHeaders()
- * @param string[] &$headers list of known meta header
- * fields; the array value specifies the YAML key to search for, the
- * array key is later used to access the found value
- * @return void
- */
- public function onMetaHeaders(&$headers)
- {
- // your code
- }
- /**
- * Triggered before Pico parses the meta header
- *
- * @see Pico::parseFileMeta()
- * @see DummyPlugin::onMetaParsed()
- * @param string &$rawContent raw file contents
- * @param string[] &$headers known meta header fields
- * @return void
- */
- public function onMetaParsing(&$rawContent, &$headers)
- {
- // your code
- }
- /**
- * Triggered after Pico has parsed the meta header
- *
- * @see Pico::getFileMeta()
- * @param string[] &$meta parsed meta data
- * @return void
- */
- public function onMetaParsed(&$meta)
- {
- // your code
- }
- /**
- * Triggered before Pico parses the pages content
- *
- * @see Pico::prepareFileContent()
- * @see DummyPlugin::prepareFileContent()
- * @see DummyPlugin::onContentParsed()
- * @param string &$rawContent raw file contents
- * @return void
- */
- public function onContentParsing(&$rawContent)
- {
- // your code
- }
- /**
- * Triggered after Pico has prepared the raw file contents for parsing
- *
- * @see Pico::parseFileContent()
- * @see DummyPlugin::onContentParsed()
- * @param string &$content prepared file contents for parsing
- * @return void
- */
- public function prepareFileContent(&$content)
- {
- // your code
- }
- /**
- * Triggered after Pico has parsed the contents of the file to serve
- *
- * @see Pico::getFileContent()
- * @param string &$content parsed contents
- * @return void
- */
- public function onContentParsed(&$content)
- {
- // your code
- }
- /**
- * Triggered before Pico reads all known pages
- *
- * @see Pico::readPages()
- * @see DummyPlugin::onSinglePageLoaded()
- * @see DummyPlugin::onPagesLoaded()
- * @return void
- */
- public function onPagesLoading()
- {
- // your code
- }
- /**
- * Triggered when Pico reads a single page from the list of all known pages
- *
- * The `$pageData` parameter consists of the following values:
- * <pre>
- * +----------------+--------+------------------------------------------+
- * | 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 |
- * +----------------+--------+------------------------------------------+
- * </pre>
- *
- * @see DummyPlugin::onPagesLoaded()
- * @param array &$pageData data of the loaded page
- * @return void
- */
- public function onSinglePageLoaded(&$pageData)
- {
- // your code
- }
- /**
- * Triggered after Pico has read all known pages
- *
- * See {@link DummyPlugin::onSinglePageLoaded()} for details about the
- * structure of the page data.
- *
- * @see Pico::getPages()
- * @see Pico::getCurrentPage()
- * @see Pico::getPreviousPage()
- * @see Pico::getNextPage()
- * @param array &$pages data of all known pages
- * @param array &$currentPage data of the page being served
- * @param array &$previousPage data of the previous page
- * @param array &$nextPage data of the next page
- * @return void
- */
- public function onPagesLoaded(&$pages, &$currentPage, &$previousPage, &$nextPage)
- {
- // your code
- }
- /**
- * Triggered before Pico registers the twig template engine
- *
- * @return void
- */
- public function onTwigRegistration()
- {
- // your code
- }
- /**
- * Triggered before Pico renders the page
- *
- * @see Pico::getTwig()
- * @see DummyPlugin::onPageRendered()
- * @param Twig_Environment &$twig twig template engine
- * @param mixed[] &$twigVariables template variables
- * @param string &$templateName file name of the template
- * @return void
- */
- public function onPageRendering(&$twig, &$twigVariables, &$templateName)
- {
- // your code
- }
- /**
- * Triggered after Pico has rendered the page
- *
- * @param string &$output contents which will be sent to the user
- * @return void
- */
- public function onPageRendered(&$output)
- {
- // your code
- }
- }
|