Skip to content
This repository was archived by the owner on Jun 5, 2019. It is now read-only.
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Removed stub functions from the plugin template.
  • Loading branch information
Richard Martin-Nielsen committed Aug 26, 2016
commit d34490606c53e0a5f75730a5f60a5afb56588a53
185 changes: 4 additions & 181 deletions PicoMultiLanguage.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,6 @@ final class PicoMultiLanguage extends AbstractPicoPlugin
$pages_by_language = array(), // array of page data grouped by language
$pages_by_id = array(); // array of page data grouped by id

/**
* 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(array &$plugins)
{
// your code
}

/**
* Triggered after Pico has read its configuration
Expand All @@ -98,81 +83,6 @@ public function onConfigLoaded(array &$config)
}
}

/**
* 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
*
Expand All @@ -184,25 +94,11 @@ public function on404ContentLoaded(&$rawContent)
*/
public function onMetaHeaders(array &$headers)
{
// your code
// your code
$headers['language'] = 'Language';
$headers['pid'] = 'pid';
}

/**
* 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, array &$headers)
{
// your code
}

/**
* Triggered after Pico has parsed the meta header
*
Expand All @@ -218,58 +114,6 @@ public function onMetaParsed(array &$meta)
}
}

/**
* 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 onContentPrepared(&$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
*
Expand Down Expand Up @@ -344,7 +188,7 @@ public function onPagesLoaded(
array &$previousPage = null,
array &$nextPage = null
) {
// only keep pages with same language as current
// only keep pages with same language as current
$current_lang = $currentPage['language'];
if (!$current_lang) {
return;
Expand All @@ -359,25 +203,15 @@ public function onPagesLoaded(
reset($pages);
while($current = current($pages)){
if($current === $currentPage){
break;
break;
}
next($pages);
next($pages);
}
$previousPage = next($pages);
prev($pages);
$nextPage = prev($pages);
}

/**
* Triggered before Pico registers the twig template engine
*
* @return void
*/
public function onTwigRegistration()
{
// your code
}

/**
* Triggered before Pico renders the page
*
Expand All @@ -398,17 +232,6 @@ public function onPageRendering(Twig_Environment &$twig, array &$twigVariables,

}

/**
* 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
}

private function get_item($array, $key, $default='') {
return isset($array[$key]) ? $array[$key] : $default;
}
Expand Down