Remove various event params that are a bit out of place
This commit is contained in:
parent
a231abc4c1
commit
151908fbad
2 changed files with 25 additions and 27 deletions
27
lib/Pico.php
27
lib/Pico.php
|
@ -395,13 +395,13 @@ class Pico
|
|||
$this->triggerEvent('onRequestFile', array(&$this->requestFile));
|
||||
|
||||
// load raw file content
|
||||
$this->triggerEvent('onContentLoading', array(&$this->requestFile));
|
||||
$this->triggerEvent('onContentLoading');
|
||||
|
||||
$hiddenFileRegex = '/(?:^|\/)(?:_|404' . preg_quote($this->getConfig('content_ext'), '/') . '$)/';
|
||||
if (file_exists($this->requestFile) && !preg_match($hiddenFileRegex, $this->requestFile)) {
|
||||
$this->rawContent = $this->loadFileContent($this->requestFile);
|
||||
} else {
|
||||
$this->triggerEvent('on404ContentLoading', array(&$this->requestFile));
|
||||
$this->triggerEvent('on404ContentLoading');
|
||||
|
||||
header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
|
||||
$this->rawContent = $this->load404Content($this->requestFile);
|
||||
|
@ -413,17 +413,17 @@ class Pico
|
|||
$this->triggerEvent('onContentLoaded', array(&$this->rawContent));
|
||||
|
||||
// parse file meta
|
||||
$this->triggerEvent('onMetaParsing', array(&$this->rawContent));
|
||||
$this->triggerEvent('onMetaParsing');
|
||||
$this->meta = $this->parseFileMeta($this->rawContent, $this->getMetaHeaders());
|
||||
$this->triggerEvent('onMetaParsed', array(&$this->meta));
|
||||
|
||||
// parse file content
|
||||
$this->triggerEvent('onContentParsing', array(&$this->rawContent));
|
||||
$this->triggerEvent('onContentParsing');
|
||||
|
||||
$this->content = $this->prepareFileContent($this->rawContent, $this->meta);
|
||||
$this->triggerEvent('onContentPrepared', array(&$this->content));
|
||||
$markdown = $this->prepareFileContent($this->rawContent, $this->meta);
|
||||
$this->triggerEvent('onContentPrepared', array(&$markdown));
|
||||
|
||||
$this->content = $this->parseFileContent($this->content);
|
||||
$this->content = $this->parseFileContent($markdown);
|
||||
$this->triggerEvent('onContentParsed', array(&$this->content));
|
||||
|
||||
// read pages
|
||||
|
@ -1490,15 +1490,12 @@ class Pico
|
|||
$id = substr($file, $contentDirLength, -$contentExtLength);
|
||||
|
||||
// trigger onSinglePageLoading event
|
||||
$this->triggerEvent('onSinglePageLoading', array(&$id));
|
||||
|
||||
if ($id === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// drop inaccessible pages (e.g. drop "sub.md" if "sub/index.md" exists)
|
||||
// skip inaccessible pages (e.g. drop "sub.md" if "sub/index.md" exists) by default
|
||||
$conflictFile = $contentDir . $id . '/index' . $contentExt;
|
||||
if (in_array($conflictFile, $files, true)) {
|
||||
$skipFile = in_array($conflictFile, $files, true) ?: null;
|
||||
$this->triggerEvent('onSinglePageLoading', array($id, &$skipFile));
|
||||
|
||||
if ($skipFile) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -113,10 +113,9 @@ class DummyPlugin extends AbstractPicoPlugin
|
|||
*
|
||||
* @see Pico::loadFileContent()
|
||||
* @see DummyPlugin::onContentLoaded()
|
||||
* @param string &$file path to the file which contents will be read
|
||||
* @return void
|
||||
*/
|
||||
public function onContentLoading(&$file)
|
||||
public function onContentLoading()
|
||||
{
|
||||
// your code
|
||||
}
|
||||
|
@ -126,10 +125,9 @@ class DummyPlugin extends AbstractPicoPlugin
|
|||
*
|
||||
* @see Pico::load404Content()
|
||||
* @see DummyPlugin::on404ContentLoaded()
|
||||
* @param string &$file path to the file which contents were requested
|
||||
* @return void
|
||||
*/
|
||||
public function on404ContentLoading(&$file)
|
||||
public function on404ContentLoading()
|
||||
{
|
||||
// your code
|
||||
}
|
||||
|
@ -167,11 +165,9 @@ class DummyPlugin extends AbstractPicoPlugin
|
|||
*
|
||||
* @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)
|
||||
public function onMetaParsing()
|
||||
{
|
||||
// your code
|
||||
}
|
||||
|
@ -194,10 +190,9 @@ class DummyPlugin extends AbstractPicoPlugin
|
|||
* @see Pico::prepareFileContent()
|
||||
* @see DummyPlugin::prepareFileContent()
|
||||
* @see DummyPlugin::onContentParsed()
|
||||
* @param string &$rawContent raw file contents of the requested page
|
||||
* @return void
|
||||
*/
|
||||
public function onContentParsing(&$rawContent)
|
||||
public function onContentParsing()
|
||||
{
|
||||
// your code
|
||||
}
|
||||
|
@ -246,16 +241,22 @@ class DummyPlugin extends AbstractPicoPlugin
|
|||
/**
|
||||
* Triggered before Pico loads a single page
|
||||
*
|
||||
* Set `$id` to `null` to remove this page from the pages array.
|
||||
* 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...
|
||||
*
|
||||
* @see DummyPlugin::onSinglePageContent()
|
||||
* @see DummyPlugin::onSinglePageLoaded()
|
||||
* @see DummyPlugin::onPagesDiscovered()
|
||||
* @see DummyPlugin::onPagesLoaded()
|
||||
* @param string &$id relative path to the content file
|
||||
* @param string $id relative path to the content file
|
||||
* @param bool|null $skipPage set this to TRUE to remove this page from
|
||||
* the pages array, otherwise leave it unchanged
|
||||
* @return void
|
||||
*/
|
||||
public function onSinglePageLoading(&$id)
|
||||
public function onSinglePageLoading($id, &$skipPage)
|
||||
{
|
||||
// your code
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue