Commit graph

298 commits

Author SHA1 Message Date
Daniel Rudolf 6e6d80c044
Add Pico::substituteUrl() and url Twig filter
Allows theme developers and users to use URL placeholders like `%base_url%` in meta headers, e.g. to include images.
2019-08-30 16:37:01 +02:00
Daniel Rudolf 715cb83431
Improve class docs of Pico::getBaseThemeUrl() and Pico::getUrlFromPath() 2019-08-29 23:07:16 +02:00
Daniel Rudolf 8d6e9ac31e
Replace file_exists() by is_file() 2019-08-29 23:06:27 +02:00
Daniel Rudolf c9a3f84673
Sync config/config.yml.template with Pico::loadConfig() 2019-07-14 16:16:57 +02:00
Daniel Rudolf 6476d6507d
Re-add deprecated Pico::getBaseThemeUrl() to maintain BC 2019-07-14 15:21:12 +02:00
Daniel Rudolf 3eab6c58d0
Bump version to 2.1.0-nightly 2019-07-14 15:19:59 +02:00
Daniel Rudolf f3b5a92247
Fix directory separator in Pico::getUrlFromPath() 2019-07-14 14:56:14 +02:00
Daniel Rudolf ad729a99c4
Remove base_dir and theme_dir Twig variables
These variables aren't really needed in Twig and can still be accessed using $config
2019-07-14 14:56:14 +02:00
Daniel Rudolf 33117be981
Config: Rename theme_url to themes_url, add plugins_url, assets_url and assets_dir 2019-07-14 14:56:14 +02:00
Daniel Rudolf 38bb0a4ac7
Various small improvements 2019-04-30 15:30:00 +02:00
Daniel Rudolf bb1b8639bd
Add Pico::getUrlFromPath() and Pico::getAbsoluteUrl(), replacing Pico::getBaseThemeUrl() 2019-04-30 15:26:31 +02:00
Daniel Rudolf f016c8a937
Add Pico::getNormalizedPath() 2019-04-30 15:22:49 +02:00
Daniel Rudolf 8ce3b0c224
Add debug mode
You can enable Pico's debug mode by setting the PICO_DEBUG environment variable. At the moment this just enables Twig's debug mode.
2019-03-28 20:12:46 +01:00
Daniel Rudolf edf849725d
Config template: Add more Twig config options 2019-03-28 20:11:46 +01:00
Daniel Rudolf 008ca6f41b
Pico::loadConfig(): Make twig cache path absolute 2019-03-28 19:14:23 +01:00
Daniel Rudolf 787344a526
Rename prev_page Twig variable to previous_page 2019-03-11 23:02:57 +01:00
Daniel Rudolf 34ae8e8812
Support %config.*% Markdown placeholders 2019-03-11 23:02:45 +01:00
Daniel Rudolf feba0b32df
Update Pico::VERSION and Pico::VERSION_ID 2019-01-03 01:34:16 +01:00
Daniel Rudolf 9924cf8485
Update Pico::VERSION and Pico::VERSION_ID 2018-12-17 15:55:52 +01:00
M.Martellenghi 84949975b0
Proberly handle hostnames with ports in Pico::getBaseUrl() (#472)
* fixed getting current port from current host

Resolves #472
2018-12-17 15:53:33 +01:00
Daniel Rudolf b8106c6c31
Update Pico::VERSION and Pico::VERSION_ID 2018-12-03 12:34:08 +01:00
Daniel Rudolf cde8c8697b
Improve/update/fix phpDoc class docs 2018-12-03 11:52:05 +01:00
Daniel Rudolf 5e4d758acb
Various small code improvements 2018-12-03 11:51:39 +01:00
Daniel Rudolf e172dd20a1
Don't require env variables, proberly handle alt server ports 2018-09-10 01:51:35 +02:00
Daniel Rudolf 010a3649b6
Update Pico::VERSION and Pico::VERSION_ID 2018-08-12 13:49:16 +02:00
Bitm@rte 9005edaa25 add support for windows path on evaluateRequestUrl() method (#452)
* add support for windows path on evaluateRequestUrl() method

* update CHANGELOG.md
2018-08-06 23:47:52 +02:00
Daniel Rudolf 2f9f40d76c
Update Pico::VERSION and Pico::VERSION_ID 2018-07-29 13:11:14 +02:00
Daniel Rudolf c7d4d25ab3
Add missing registred meta headers
Use the `Formatted Date` meta header to explicitly set a page's formatted date (i.e. `$meta['date_formatted']`), and `Time` to set `$meta['time']`. Use the `Hidden` meta header to manually hide a page (the page is still accessible, but won't show up in the pages list). Note the difference between `$pageData['hidden']` and `$pageData['meta']['hidden']`.
2018-07-29 12:51:28 +02:00
Daniel Rudolf be86f8fa8c
Update Pico::VERSION 2018-07-01 18:12:34 +02:00
johannes Heimbach c12b50dc1b stop config.yml on loading again 2018-04-29 17:21:27 +02:00
Daniel Rudolf 568166ad07
Check Pico::VERSION constant before deploying a new release 2018-03-29 22:48:24 +02:00
Daniel Rudolf b405edba17
Various small improvements 2018-03-29 22:47:23 +02:00
Daniel Rudolf 190889b77b
Fix sorting of Pico::$nativePlugins
Thanks to PT on our Freenode IRC channel #picocms for reporting this!
2018-03-29 22:45:12 +02:00
Daniel Rudolf 05c2c968c3
Use filter_id() for the url_param and form_param Twig functions
This is a follow-up to 80263a91dc
2018-02-24 16:40:00 +01:00
Daniel Rudolf 80263a91dc
Disallow the use of the callback filter for the url_param and form_param Twig functions 2018-02-24 14:02:59 +01:00
Daniel Rudolf 03cc10183c
Fix page tree 2018-01-31 12:29:59 +01:00
Daniel Rudolf 888190f15a
Various small improvements 2018-01-21 23:06:38 +01:00
Daniel Rudolf b129a4fb12
Various small improvements 2017-12-27 21:36:56 +01:00
Daniel Rudolf afd0a4d7a3
Change AbstractPicoPlugin::$enabled's behavior
AbstractPicoPlugin::$enabled now defaults to NULL what leaves the decision whether a plugin should be enabled or disabled by default up to Pico (precisely AbstractPicoPlugin::triggerEvent()). If all dependencies of a plugin are fulfilled, Pico enables the plugin by default. Otherwise the plugin is silently disabled (this was the behavior when AbstractPicoPlugin::$enabled was set to TRUE previously).

If a plugin should never be disabled *silently* (e.g. when dealing with security-relevant stuff like access control, or similar), set AbstractPicoPlugin::$enabled to TRUE. If Pico can't fulfill all the plugin's dependencies, it will throw an RuntimeException.

If a plugin rather does some "crazy stuff" a user should really be aware of before using it, you can set AbstractPicoPlugin::$enabled to FALSE. The user will then have to enable the plugin manually. However, if another plugin depends on this plugin, it might get enabled silently nevertheless.

No matter what, the user can always explicitly enable or disable a plugin in Pico's config.
2017-12-27 21:36:08 +01:00
Daniel Rudolf 37dfe0e6ef
Force themes to use .twig as file extension
We recommend plugin developers to use templates when serving HTML contents (like the UI of PicoAdmin), however, by supporting multiple file extensions for themes, we make it pretty hard to overwrite a plugin's template with a theme. As always, we preserve BC using PicoDeprecated.
2017-11-25 21:52:03 +01:00
Daniel Rudolf 28d2648ba0
Add Pico::buildPageTree()
Pico's page tree is a list of all the tree's branches (no matter the depth). Thus, by iterating a array element, you get the nodes of a given branch. All leaf nodes do represent a page, but inner nodes may or may not represent a page (e.g. if there's a `sub/page.md`, but neither a `sub/index.md` nor a `sub.md`, the inner node `sub`, that is the parent of the `sub/page` node, represents no page itself).

A page's file path describes its node's path in the tree (e.g. the page `sub/page.md` is represented by the `sub/page` node, thus a child of the `sub` node and a element of the `sub` branch). However, the index page of a folder (e.g. `sub/index.md`), is *not* a node of the `sub` branch, but rather of the `/` branch. The page's node is not `sub/index`, but `sub`. If two pages are described by the same node (e.g. if both a `sub/index.md` and a `sub.md` exist), the index page takes precedence. Pico's main index page (i.e. `index.md`) is represented by the tree's root node `/` and a special case: it is the only node of the `` (i.e. the empty string) branch.

A node is represented by an array with the keys `id`, `page` and `children`. The `id` key contains a string with the node's name. If the node represents a page, the `page` key is a reference to the page's data array. If the node is a inner node, the `children` key is a reference to its matching branch (i.e. a list of the node's children). The order of a node's children matches the order in Pico's pages array.

If you want to walk the whole page tree, start with the tree's root node at `$pageTree[""]["/"]`. The root node's `children` key is a reference to the `/` branch at `$pageTree["/"]`, that is a list of the root node's direct child nodes and their siblings.

You MUST NOT iterate the page tree itself (i.e. the list of the tree's branches), its order is undefined and the array will be replaced by a non-iterable data structure with Pico 3.0.
2017-11-18 18:34:57 +01:00
Daniel Rudolf 3846d3b685
Various small improvements 2017-11-18 18:28:02 +01:00
Daniel Rudolf 1cd6e241f0
Prepare v2.0.0-beta.1 2017-11-05 18:28:11 +01:00
Daniel Rudolf e8a19cb2f9
Fix Pico::parseFileMeta() 2017-11-04 20:49:41 +01:00
Daniel Rudolf 61319b011e
Add license/copyright file header; improve phpDoc class docs 2017-10-19 21:55:41 +02:00
Daniel Rudolf d8a649e6f7
Don't lower meta data unsolicited and flip meta headers array
Don't lower unregistered meta headers on the first level unsolicited (e.g. `SomeNotRegisteredKey: foobar` in the YAML Frontmatter should result in `['SomeNotRegisteredKey']`, not `['somenotregisteredkey']`). Furthermore, Pico no longer compares registered meta headers in a case-insensitive manner. However, you can now register multiple search strings that are used to find a registered meta header. This is achieved by flipping the meta headers array: Pico 2.0 uses the array key to search for a meta value and the array value to store the found meta value. Previously it was the other way round (what didn't make much sense...).
2017-10-14 23:12:16 +02:00
Daniel Rudolf 151908fbad
Remove various event params that are a bit out of place 2017-10-14 22:08:11 +02:00
Daniel Rudolf 709416328a
Pico::loadPlugins(): Add plugin blacklist and allow disabling local plugins 2017-10-13 21:02:51 +02:00
Daniel Rudolf 867f81a443
Various small improvements 2017-10-12 16:15:58 +02:00
Daniel Rudolf 9dcb06c258
Pico::sortPlugins(): Fix sorting of non-native plugins 2017-10-12 12:12:37 +02:00