Merge branch 'master' into enhancement/build-release

Conflicts:
	.travis.yml
This commit is contained in:
Daniel Rudolf 2015-11-25 18:03:03 +01:00
commit 18fc928797
10 changed files with 64 additions and 46 deletions

22
.gitignore vendored
View File

@ -15,22 +15,22 @@ desktop.ini
/build/phpdoc-*.git/ /build/phpdoc-*.git/
# Composer # Composer
composer.lock /composer.lock
composer.phar /composer.phar
vendor/* /vendor
# User config # User config
config/config.php /config/config.php
# User themes # User themes
themes/* /themes/*
!themes/default/* !/themes/default
# User plugins # User plugins
plugins/* /plugins/*
!plugins/0?-* !/plugins/0?-*
!plugins/1?-* !/plugins/1?-*
!plugins/DummyPlugin.php !/plugins/DummyPlugin.php
# User content # User content
content/* /content

View File

@ -16,6 +16,7 @@ before_deploy:
- ./vendor/bin/phpdoc -d . -i 'vendor/*' -i 'plugins/*' -f 'plugins/DummyPlugin.php' -t "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" --title "Pico 1.0 API Documentation ($TRAVIS_TAG)" - ./vendor/bin/phpdoc -d . -i 'vendor/*' -i 'plugins/*' -f 'plugins/DummyPlugin.php' -t "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" --title "Pico 1.0 API Documentation ($TRAVIS_TAG)"
- ./build/deploy-phpdoc.sh "picocms/Pico" "gh-pages" "$GITHUB_OAUTH_TOKEN" "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "phpDoc/$TRAVIS_TAG" - ./build/deploy-phpdoc.sh "picocms/Pico" "gh-pages" "$GITHUB_OAUTH_TOKEN" "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "phpDoc/$TRAVIS_TAG"
- composer install --no-dev - composer install --no-dev
- composer dump-autoload --optimize
- tar -czf "pico-release-$TRAVIS_TAG.tar.gz" README.md LICENSE CONTRIBUTING.md CHANGELOG.md composer.json composer.lock config content-sample lib plugins themes vendor .htaccess index.php - tar -czf "pico-release-$TRAVIS_TAG.tar.gz" README.md LICENSE CONTRIBUTING.md CHANGELOG.md composer.json composer.lock config content-sample lib plugins themes vendor .htaccess index.php
deploy: deploy:

View File

@ -11,6 +11,7 @@ Released: -
want to parse the contents of a page, use the `content` filter instead want to parse the contents of a page, use the `content` filter instead
* [Changed] Improve documentation * [Changed] Improve documentation
* [Changed] Improve table styling in default theme * [Changed] Improve table styling in default theme
* [Changed] Throw a RuntimeException when the `content` dir isn't accessible
* [Changed] Reuse `ParsedownExtra` object; new `onParsedownRegistration` event * [Changed] Reuse `ParsedownExtra` object; new `onParsedownRegistration` event
* [Fixed] `PicoDeprecated`: Sanitize `content_dir` and `base_url` options when * [Fixed] `PicoDeprecated`: Sanitize `content_dir` and `base_url` options when
reading `config.php` in Picos root dir reading `config.php` in Picos root dir

View File

@ -46,11 +46,11 @@ Upgrading Pico is very easy: You just have to replace all of Pico's files - that
Pico follows [Semantic Versioning 2.0][SemVer] and uses version numbers like `MAJOR`.`MINOR`.`PATCH`. When we update... Pico follows [Semantic Versioning 2.0][SemVer] and uses version numbers like `MAJOR`.`MINOR`.`PATCH`. When we update...
- the `PATCH` version (e.g. `1.0.0` to `1.0.1`), we made backwards-compatible bug fixes. It's then sufficient to extract [Pico's latest release][LatestRelease] to your existing installation directory and overwriting all files. - the `PATCH` version (e.g. `1.0.0` to `1.0.1`), we made backwards-compatible bug fixes. It's then sufficient to extract [Pico's latest release][LatestRelease] to your existing installation directory and overwriting all files. Alternatively you can either use the [*source code* of Pico's latest release][LatestRelease] or pull from Pico's Git repository, but are then required to update Pico's [composer][] dependencies manually by running `php composer.phar update`.
- the `MINOR` version (e.g. `1.0` to `1.1`), we added functionality in a backwards-compatible manner, but anyway recommend you to "install" Pico newly. Backup all of your files, empty your installation directory and install Pico as elucidated above. You can then copy your `config/config.php` and `content` directory without any change. If applicable, you can also copy the folder of your custom theme within the `themes` directory. Provided that you're using plugins, also copy all of your plugins from the `plugins` directory. - the `MINOR` version (e.g. `1.0` to `1.1`), we added functionality in a backwards-compatible manner, but anyway recommend you to "install" Pico newly. Backup all of your files, empty your installation directory and install Pico as elucidated above. You can then copy your `config/config.php` and `content` directory without any change. If applicable, you can also copy the folder of your custom theme within the `themes` directory. Provided that you're using plugins, also copy all of your plugins from the `plugins` directory.
- the `MAJOR` version (e.g. `1.0` to `2.0`), a appropriate upgrade tutorial will be provided. - the `MAJOR` version (e.g. `1.0` to `2.0`), we made incompatible API changes. We will then provide a appropriate upgrade tutorial.
Upgrading Pico 0.8 or 0.9 to Pico 1.0 is a special case. The new `PicoDeprecated` plugin ensures backwards compatibility, so you basically can follow the above upgrade instructions as if we updated the `MINOR` version. However, we recommend you to take some further steps to confine the necessity of `PicoDeprecated` as far as possible. For more information about what has changed with Pico 1.0 and a step-by-step upgrade tutorial, please refer to the [upgrade page of our website][HelpUpgrade]. Upgrading Pico 0.8 or 0.9 to Pico 1.0 is a special case. The new `PicoDeprecated` plugin ensures backwards compatibility, so you basically can follow the above upgrade instructions as if we updated the `MINOR` version. However, we recommend you to take some further steps to confine the necessity of `PicoDeprecated` as far as possible. For more information about what has changed with Pico 1.0 and a step-by-step upgrade tutorial, please refer to the [upgrade page of our website][HelpUpgrade].

View File

@ -2,20 +2,31 @@
"name": "picocms/pico", "name": "picocms/pico",
"type": "library", "type": "library",
"description": "Pico is a flat file CMS, this means there is no administration backend and database to deal with. You simply create .md files in the \"content\" folder and that becomes a page.", "description": "Pico is a flat file CMS, this means there is no administration backend and database to deal with. You simply create .md files in the \"content\" folder and that becomes a page.",
"keywords": ["cms"], "keywords": ["flat-file","cms","php","twig","markdown"],
"homepage": "http://picocms.org/", "homepage": "http://picocms.org/",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
"name": "Gilbert Pellegrom", "name": "Gilbert Pellegrom",
"email": "gilbert@pellegrom.me" "email": "gilbert@pellegrom.me",
"role": "Project Founder"
},
{
"name": "The Pico Community",
"homepage": "https://github.com/picocms/Pico/graphs/contributors",
"role": "Contributors"
} }
], ],
"support": {
"docs": "http://picocms.org/docs",
"issues": "https://github.com/picocms/Pico/issues",
"source": "https://github.com/picocms/Pico"
},
"require": { "require": {
"php": ">=5.3.6", "php": ">=5.3.6",
"twig/twig": "1.18.*", "twig/twig": "^1.18",
"erusev/parsedown-extra": "0.7.*", "erusev/parsedown-extra": "^0.7",
"symfony/yaml" : "2.3" "symfony/yaml" : "^2.3"
}, },
"require-dev" : { "require-dev" : {
"phpdocumentor/phpdocumentor": "^2.8" "phpdocumentor/phpdocumentor": "^2.8"

View File

@ -267,6 +267,7 @@ class Pico
* the rendered contents. * the rendered contents.
* *
* @return string rendered Pico contents * @return string rendered Pico contents
* @throws RuntimeException thrown when a not recoverable error occurs
*/ */
public function run() public function run()
{ {
@ -281,6 +282,11 @@ class Pico
$this->loadConfig(); $this->loadConfig();
$this->triggerEvent('onConfigLoaded', array(&$this->config)); $this->triggerEvent('onConfigLoaded', array(&$this->config));
// check content dir
if (!is_dir($this->getConfig('content_dir'))) {
throw new RuntimeException('Invalid content directory "' . $this->getConfig('content_dir') . '"');
}
// evaluate request url // evaluate request url
$this->evaluateRequestUrl(); $this->evaluateRequestUrl();
$this->triggerEvent('onRequestUrl', array(&$this->requestUrl)); $this->triggerEvent('onRequestUrl', array(&$this->requestUrl));
@ -1025,7 +1031,7 @@ class Pico
* *
* @see Pico::readPages() * @see Pico::readPages()
* @see Pico::sortPages() * @see Pico::sortPages()
* @return array|null the data of all pages * @return array[]|null the data of all pages
*/ */
public function getPages() public function getPages()
{ {
@ -1333,8 +1339,7 @@ class Pico
if (!empty($this->plugins)) { if (!empty($this->plugins)) {
foreach ($this->plugins as $plugin) { foreach ($this->plugins as $plugin) {
// only trigger events for plugins that implement PicoPluginInterface // only trigger events for plugins that implement PicoPluginInterface
// deprecated events (plugins for Pico 0.9 and older) will be // deprecated events (plugins for Pico 0.9 and older) will be triggered by `PicoDeprecated`
// triggered by the `PicoPluginDeprecated` plugin
if (is_a($plugin, 'PicoPluginInterface')) { if (is_a($plugin, 'PicoPluginInterface')) {
$plugin->handleEvent($eventName, $params); $plugin->handleEvent($eventName, $params);
} }

View File

@ -67,7 +67,7 @@ class PicoDeprecated extends AbstractPicoPlugin
* *
* @see DummyPlugin::onPluginsLoaded() * @see DummyPlugin::onPluginsLoaded()
*/ */
public function onPluginsLoaded(&$plugins) public function onPluginsLoaded(array &$plugins)
{ {
if (!empty($plugins)) { if (!empty($plugins)) {
foreach ($plugins as $plugin) { foreach ($plugins as $plugin) {
@ -110,7 +110,7 @@ class PicoDeprecated extends AbstractPicoPlugin
* @param mixed[] &$realConfig array of config variables * @param mixed[] &$realConfig array of config variables
* @return void * @return void
*/ */
public function onConfigLoaded(&$realConfig) public function onConfigLoaded(array &$realConfig)
{ {
global $config; global $config;
@ -167,7 +167,7 @@ class PicoDeprecated extends AbstractPicoPlugin
* @param mixed[] &$realConfig array of config variables * @param mixed[] &$realConfig array of config variables
* @return void * @return void
*/ */
protected function loadRootDirConfig(&$realConfig) protected function loadRootDirConfig(array &$realConfig)
{ {
if (file_exists($this->getRootDir() . 'config.php')) { if (file_exists($this->getRootDir() . 'config.php')) {
// config.php in Pico::$rootDir is deprecated // config.php in Pico::$rootDir is deprecated
@ -284,7 +284,7 @@ class PicoDeprecated extends AbstractPicoPlugin
* *
* @see DummyPlugin::onMetaHeaders() * @see DummyPlugin::onMetaHeaders()
*/ */
public function onMetaHeaders(&$headers) public function onMetaHeaders(array &$headers)
{ {
$this->triggerEvent('before_read_file_meta', array(&$headers)); $this->triggerEvent('before_read_file_meta', array(&$headers));
} }
@ -294,7 +294,7 @@ class PicoDeprecated extends AbstractPicoPlugin
* *
* @see DummyPlugin::onMetaParsed() * @see DummyPlugin::onMetaParsed()
*/ */
public function onMetaParsed(&$meta) public function onMetaParsed(array &$meta)
{ {
$this->triggerEvent('file_meta', array(&$meta)); $this->triggerEvent('file_meta', array(&$meta));
} }
@ -328,7 +328,7 @@ class PicoDeprecated extends AbstractPicoPlugin
* *
* @see DummyPlugin::onSinglePageLoaded() * @see DummyPlugin::onSinglePageLoaded()
*/ */
public function onSinglePageLoaded(&$pageData) public function onSinglePageLoaded(array &$pageData)
{ {
$this->triggerEvent('get_page_data', array(&$pageData, $pageData['meta'])); $this->triggerEvent('get_page_data', array(&$pageData, $pageData['meta']));
} }
@ -344,7 +344,7 @@ class PicoDeprecated extends AbstractPicoPlugin
* *
* @see DummyPlugin::onPagesLoaded() * @see DummyPlugin::onPagesLoaded()
*/ */
public function onPagesLoaded(&$pages, &$currentPage, &$previousPage, &$nextPage) public function onPagesLoaded(array &$pages, array &$currentPage = null, array &$previousPage = null, array &$nextPage = null)
{ {
// remove keys of pages array // remove keys of pages array
$plainPages = array(); $plainPages = array();
@ -391,7 +391,7 @@ class PicoDeprecated extends AbstractPicoPlugin
* *
* @see DummyPlugin::onPageRendering() * @see DummyPlugin::onPageRendering()
*/ */
public function onPageRendering(&$twig, &$twigVariables, &$templateName) public function onPageRendering(Twig_Environment &$twig, array &$twigVariables, &$templateName)
{ {
// template name contains file extension since Pico 1.0 // template name contains file extension since Pico 1.0
$fileExtension = ''; $fileExtension = '';

View File

@ -30,7 +30,7 @@ class PicoParsePagesContent extends AbstractPicoPlugin
* *
* @see DummyPlugin::onSinglePageLoaded() * @see DummyPlugin::onSinglePageLoaded()
*/ */
public function onSinglePageLoaded(&$pageData) public function onSinglePageLoaded(array &$pageData)
{ {
if (!isset($pageData['content'])) { if (!isset($pageData['content'])) {
$pageData['content'] = $this->prepareFileContent($pageData['raw_content'], $pageData['meta']); $pageData['content'] = $this->prepareFileContent($pageData['raw_content'], $pageData['meta']);

View File

@ -40,7 +40,7 @@ class PicoExcerpt extends AbstractPicoPlugin
* *
* @see DummyPlugin::onConfigLoaded() * @see DummyPlugin::onConfigLoaded()
*/ */
public function onConfigLoaded(&$config) public function onConfigLoaded(array &$config)
{ {
if (!isset($config['excerpt_length'])) { if (!isset($config['excerpt_length'])) {
$config['excerpt_length'] = 50; $config['excerpt_length'] = 50;
@ -53,7 +53,7 @@ class PicoExcerpt extends AbstractPicoPlugin
* @see PicoExcerpt::createExcerpt() * @see PicoExcerpt::createExcerpt()
* @see DummyPlugin::onSinglePageLoaded() * @see DummyPlugin::onSinglePageLoaded()
*/ */
public function onSinglePageLoaded(&$pageData) public function onSinglePageLoaded(array &$pageData)
{ {
if (!isset($pageData['excerpt'])) { if (!isset($pageData['excerpt'])) {
$pageData['excerpt'] = $this->createExcerpt( $pageData['excerpt'] = $this->createExcerpt(

View File

@ -11,7 +11,7 @@
* @license http://opensource.org/licenses/MIT * @license http://opensource.org/licenses/MIT
* @version 1.0 * @version 1.0
*/ */
class DummyPlugin extends AbstractPicoPlugin final class DummyPlugin extends AbstractPicoPlugin
{ {
/** /**
* This plugin is enabled by default? * This plugin is enabled by default?
@ -40,7 +40,7 @@ class DummyPlugin extends AbstractPicoPlugin
* @param object[] &$plugins loaded plugin instances * @param object[] &$plugins loaded plugin instances
* @return void * @return void
*/ */
public function onPluginsLoaded(&$plugins) public function onPluginsLoaded(array &$plugins)
{ {
// your code // your code
} }
@ -52,7 +52,7 @@ class DummyPlugin extends AbstractPicoPlugin
* @param mixed[] &$config array of config variables * @param mixed[] &$config array of config variables
* @return void * @return void
*/ */
public function onConfigLoaded(&$config) public function onConfigLoaded(array &$config)
{ {
// your code // your code
} }
@ -141,7 +141,7 @@ class DummyPlugin extends AbstractPicoPlugin
* array key is later used to access the found value * array key is later used to access the found value
* @return void * @return void
*/ */
public function onMetaHeaders(&$headers) public function onMetaHeaders(array &$headers)
{ {
// your code // your code
} }
@ -155,7 +155,7 @@ class DummyPlugin extends AbstractPicoPlugin
* @param string[] &$headers known meta header fields * @param string[] &$headers known meta header fields
* @return void * @return void
*/ */
public function onMetaParsing(&$rawContent, &$headers) public function onMetaParsing(&$rawContent, array &$headers)
{ {
// your code // your code
} }
@ -167,7 +167,7 @@ class DummyPlugin extends AbstractPicoPlugin
* @param string[] &$meta parsed meta data * @param string[] &$meta parsed meta data
* @return void * @return void
*/ */
public function onMetaParsed(&$meta) public function onMetaParsed(array &$meta)
{ {
// your code // your code
} }
@ -249,7 +249,7 @@ class DummyPlugin extends AbstractPicoPlugin
* @param array &$pageData data of the loaded page * @param array &$pageData data of the loaded page
* @return void * @return void
*/ */
public function onSinglePageLoaded(&$pageData) public function onSinglePageLoaded(array &$pageData)
{ {
// your code // your code
} }
@ -264,13 +264,13 @@ class DummyPlugin extends AbstractPicoPlugin
* @see Pico::getCurrentPage() * @see Pico::getCurrentPage()
* @see Pico::getPreviousPage() * @see Pico::getPreviousPage()
* @see Pico::getNextPage() * @see Pico::getNextPage()
* @param array &$pages data of all known pages * @param array[] &$pages data of all known pages
* @param array &$currentPage data of the page being served * @param array|null &$currentPage data of the page being served
* @param array &$previousPage data of the previous page * @param array|null &$previousPage data of the previous page
* @param array &$nextPage data of the next page * @param array|null &$nextPage data of the next page
* @return void * @return void
*/ */
public function onPagesLoaded(&$pages, &$currentPage, &$previousPage, &$nextPage) public function onPagesLoaded(array &$pages, array &$currentPage = null, array &$previousPage = null, array &$nextPage = null)
{ {
// your code // your code
} }
@ -295,7 +295,7 @@ class DummyPlugin extends AbstractPicoPlugin
* @param string &$templateName file name of the template * @param string &$templateName file name of the template
* @return void * @return void
*/ */
public function onPageRendering(&$twig, &$twigVariables, &$templateName) public function onPageRendering(Twig_Environment &$twig, array &$twigVariables, &$templateName)
{ {
// your code // your code
} }