Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
This is a example of a "Drafts" plugin for Pico. Pico is a stupidly simple, blazing fast, flat file CMS. http://picocms.org/
<?php
/**
* Pico Drafts Plugin (example)
*
* This is a example of a "Drafts" plugin for Pico's documentation.
* Pico is a stupidly simple, blazing fast, flat file CMS.
*
* This example plugin basically just removes all pages starting with a `_`
* from Pico's page list. The page will not show up anywhere, however, you
* can still access it by manually navigating to the corresponding URL.
*
* @author Daniel Rudolf
* @link http://picocms.org
* @license http://opensource.org/licenses/MIT The MIT License
*/
class PicoDrafts extends AbstractPicoPlugin
{
public function onPagesLoaded(array &$pages)
{
foreach ($pages as $pageId => $pageData) {
$fileName = basename($pageData['id']);
if ($fileName[0] === '_') {
unset($pages[$pageId]);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment