Commit graph

347 commits

Author SHA1 Message Date
Daniel Rudolf
b6468ca215
Various small improvements 2017-10-08 00:36:29 +02:00
Daniel Rudolf
9a9872fe8e
Add Pico::getPageId() 2017-10-08 00:36:14 +02:00
Daniel Rudolf
7087573aed
Pico::loadPlugins(): Load composer-plugins first and skip conflicting plugins in the plugins/ dir 2017-10-08 00:35:36 +02:00
Daniel Rudolf
fc76d37dbc
Improve class docs 2017-08-05 02:49:58 +02:00
Daniel Rudolf
32ae70f398
Add $default param to getConfig() method
- Pico::getConfig()
- AbstractPicoPlugin::getPluginCongif()
2017-08-05 00:19:03 +02:00
Daniel Rudolf
8138212a27
Pico::evaluateRequestUrl(): Improve REQUEST_URI handling
Don't 404 "/index.php" requests
2017-08-03 22:17:48 +02:00
Daniel Rudolf
b73e197ccb
Refactor YAML frontmatter date parsing
You can now explicitly specify both the `date_formatted` and `time` meta values to overwrite Pico's page date handling. Specifying `time` doesn't make much sense in general, however, specifying `date_formatted` allows you to use `{{ meta.date_formatted }}` on all systems, even those where `strftime()` doesn't work as wished
2017-07-28 12:16:26 +02:00
Daniel Rudolf
3e88c58ce0
Merge branch 'master' into pico-1.1
Conflicts:
	lib/Pico.php
2017-07-18 21:39:39 +02:00
Daniel Rudolf
d3c624777f
Improve guessing whether URL rewriting is enabled
Besides searching for the env var 'PICO_URL_REWRITING', also try 'REDIRECT_PICO_URL_REWRITING'.
2017-07-18 21:36:15 +02:00
Daniel Rudolf
53e9eaa5e4
Fix Pico's REQUEST_URI routing method when installed to / 2017-07-18 21:31:14 +02:00
Daniel Rudolf
414f5ac18e
Allow pages to be sorted by arbitrary meta values
This basically works like Pico's `sort_by` Twig filter
2017-07-14 20:37:05 +02:00
Daniel Rudolf
b626782b87
Use Pico::substituteFileContent() for Twig's "markdown" filter 2017-06-21 14:27:50 +02:00
Daniel Rudolf
55a0a5bc91
Add Pico::substituteFileContent() method 2017-06-21 14:27:34 +02:00
Daniel Rudolf
05c8d95b3f
Only load Twig_Extension_Debug when Twig's debug mode is enabled 2017-06-20 23:34:07 +02:00
Daniel Rudolf
4cd993c50a
Fix PHP Syntax Error 2017-06-20 18:02:32 +02:00
Daniel Rudolf
fd78ec38c7
Various small improvements 2017-06-20 17:32:09 +02:00
Daniel Rudolf
793fcdb4e1
Add "remove" fallback to Twig's "sort_by" filter 2017-06-20 17:31:49 +02:00
Daniel Rudolf
21051fe08b
Pico::loadComposerPlugins(): Use Pico::getVendorDir() instead of Pico::$vendorDir 2017-06-14 17:43:40 +02:00
Daniel Rudolf
23ad80b98a
Let Pico load plugins from vendor/pico-plugin.php
Split the Pico::loadPlugins() method to Pico::loadLocalPlugins() and Pico::loadComposerPlugins()
2017-06-14 17:10:42 +02:00
Daniel Rudolf
b098e22033
Various small improvements 2017-05-14 01:26:38 +02:00
Daniel Rudolf
d26da62bf1
Add onSinglePageContent event 2017-05-14 01:26:29 +02:00
Daniel Rudolf
773f4795f7
Remove Pico::registerTwig(), use Pico::getTwig() instead 2017-05-14 01:26:07 +02:00
Daniel Rudolf
80c88f2a7d
Refactor onMetaHeaders event 2017-05-14 01:25:10 +02:00
Daniel Rudolf
f4332a247c
Force PicoDeprecated to be first plugin in the plugins array 2017-05-14 01:11:16 +02:00
Daniel Rudolf
624310bbe7
Various small improvements 2017-05-13 18:17:58 +02:00
Daniel Rudolf
191f6edbe9
Don't pass the $plugins argument of the onPluginsLoaded event by reference
This is a BC breaking change!

Manipulating Pico's $plugins array is a really bad idea. We've introduced the Pico::loadPlugin() method to safely load plugins at any time, however, Pico might do unexpected things when loading plugins too late. See the class docs of Pico::loadPlugin() for more details. Nevertheless, this change breaks BC to Pico 1.0. However, I don't know a single plugin that relies on manipulating the $plugins array. If you just want to load a plugin manually, use Pico::loadPlugin() instead.
2017-05-13 18:17:19 +02:00
Daniel Rudolf
6e28a51080
Refactor onPages… and onPage… core events
Add new onPagesDiscovered event passing the unsorted pages array, move the $currentPage, $previousPage and $nextPage arguments from the onPagesLoaded event to the new onCurrentPageDiscovered event, remove the $twig argument from the onPageRendering event and rather trigger the new onTwigRegistered event for this. Also add the new onYamlParserRegistered and onParsedownRegistered events passing the YAML parser resp. the Parsedown instance. Allow plugin's to skip a page by setting the $id argument of the onSinglePageLoading event to NULL.
2017-05-13 18:08:54 +02:00
Daniel Rudolf
7b222b03e4
Add Pico::API_VERSION 2017-05-10 17:00:48 +02:00
Daniel Rudolf
36b3aef1c7
Fix Pico::loadPlugin() when called before Pico::loadPlugins() 2017-05-07 14:20:44 +02:00
Daniel Rudolf
1d73524e41
Search for content/index.md to determine the content dir to use 2017-05-02 00:22:35 +02:00
Daniel Rudolf
f52e3dc890
Add Pico::getVendorDir()
The vendor directory is the installation path of the `picocms/Pico` package. If `picocms/Pico` is the composer root package (as in pre-bundled releases), it should be identical to `Pico::getRootDir()`. However, if `picocms/Pico` was installed as composer dependency (e.g. by `picocms/pico-composer`), the vendor directory usually corresponds to something like `Pico::getRootDir() . "vendor/picocms/pico"`. The vendor directory is currently only used as a last resort to load Pico's sample contents.
2017-05-01 22:27:57 +02:00
Daniel Rudolf
3f17a2e28e
Merge branch 'master' into pico-1.1
Conflicts:
	content-sample/index.md
	themes/default/font/fontello.eot
	themes/default/font/fontello.svg
	themes/default/font/fontello.ttf
	themes/default/font/fontello.woff
	themes/default/font/fontello.woff2
	themes/default/fontello.css
2017-05-01 20:38:03 +02:00
Daniel Rudolf
82a342ba44
Various small improvements 2017-05-01 15:12:13 +02:00
Daniel Rudolf
a2d0d745ff
Fix detection of Windows-based server environments 2017-02-19 23:43:43 +01:00
Daniel Rudolf
882a80a179
Update docs to reflect 9b7523b 2017-02-06 00:01:25 +01:00
Daniel Rudolf
d4c65fa523
Allow configuring Parsedown 2017-02-05 21:49:54 +01:00
Daniel Rudolf
5429a3a932
Add Pico::getTwigTemplate() 2017-02-05 20:20:26 +01:00
Daniel Rudolf
9b7523b9e8
Use .yml files to configure Pico
Instead of using `*.config.php` files, use `*.yml` files to configure Pico. YAML is much easier to understand, more user friendly and (at least a bit) more error-tolerant, but still very powerful. Don't break BC by letting `PicoDeprecated` still read `config/config.php`.
2017-02-05 16:52:18 +01:00
Daniel Rudolf
0a080c8965
Add lazy init for Symfony YAML, Parsedown and Twig 2017-02-05 15:55:53 +01:00
Daniel Rudolf
c56ba02b0b
Reintroduce plugin prefix classifications
This partially reverts commit 9254240
2016-12-12 20:58:38 +01:00
Daniel Rudolf
9254240e44
Load plugins from <plugin name>.php and <plugin name>/<plugin name>.php only 2016-12-12 20:37:17 +01:00
Daniel Rudolf
eec1d625c4
Add Pico::getFilesGlob() method 2016-12-12 20:36:46 +01:00
Daniel Rudolf
586d792c32
Update Pico::VERSION_ID constant 2016-12-12 17:09:30 +01:00
Daniel Rudolf
46f5d3d56d
Move Twig link filter and url_param and form_param functions to PicoTwigExtension 2016-12-12 17:08:40 +01:00
Daniel Rudolf
1f35346f53
Improve detection of hidden files to serve 404 contents instead
Follow-up to 9b72b5c316
2016-12-12 16:37:20 +01:00
Daniel Rudolf
8f7e4da53d
Rename Pico 1.1 to Pico 2.0 2016-12-12 15:31:06 +01:00
Daniel Rudolf
2e880d6c7f
Discover the previous and next pages of all pages 2016-12-12 14:49:57 +01:00
Daniel Rudolf
9b72b5c316
Give pages starting with a underscore (_) a special treatment
Follow-up to b493ebdb84
2016-12-12 14:49:05 +01:00
Daniel Rudolf
9a2dd4f078
Mark Twig variables rewrite_url and is_front_page as deprecated 2016-12-06 20:52:27 +01:00
Daniel Rudolf
ec3f7fb626
Improve class docs 2016-12-06 20:22:50 +01:00
Daniel Rudolf
5193b77fdf
Reuse YAML parser instance 2016-12-06 20:22:38 +01:00
Daniel Rudolf
5d48aa7040
Let Pico::getTwigVariables() return the "real" array
Currently Pico::getTwigVariables() always returns the default twig variables and ignores all additions/changes made through the onPageRendering event. The method now returns the "real" variables array used by Twig.
2016-12-06 20:04:07 +01:00
Daniel Rudolf
bc5729629d
Fire onMetaHeaders event only once, cache results of Pico::getMetaHeaders() 2016-12-06 20:01:38 +01:00
Daniel Rudolf
82c6dd9795
Don't sort pages when a unknown sort method is specified
Specifying a custom sort method usually means that all pages are sort by a plugin, so Pico's default alphabetical order is overwritten anyway. Letting Pico sort the pages first and discarding the result is burned CPU time...
2016-12-06 19:47:37 +01:00
Daniel Rudolf
5cf47e65de
Various small improvements 2016-12-06 19:03:58 +01:00
Daniel Rudolf
7a6e4f8271
Sort all loaded plugins using a plugin dependency topology
Execution order matters: if plugin A depends on plugin B, it usually means that plugin B does stuff which plugin A requires. However, Pico loads plugins in alphabetical order, so events might get fired on plugin A before plugin B.

Hence plugins need to be sorted. Pico sorts plugins using a dependency topology, this means that it moves all plugins, on which a plugin depends, in front of that plugin. The order isn't touched apart from that, so they are still sorted alphabetically, as long as this doesn't interfere with the dependency topology. Circular dependencies are being ignored; their behavior is undefiend. Missing dependencies are being ignored until you try to enable the dependant plugin.

This method bases on [Marc J. Schmidt's Topological Sort library](https://github.com/marcj/topsort.php) in version 1.1.0, licensed under the MIT license. It uses the `ArraySort` implementation ([class `\MJS\TopSort\Implementations\ArraySort`](https://github.com/marcj/topsort.php/blob/1.1.0/src/Implementations/ArraySort.php)).
2016-12-06 17:18:59 +01:00
Daniel Rudolf
0a269746eb
Add Pico::is404Content() method 2016-11-26 16:48:10 +01:00
Daniel Rudolf
d9393df4fa
Pico::getBaseUrl(): Improve hostname detection with proxies 2016-11-23 23:26:55 +01:00
Daniel Rudolf
38615e444d
Use Pico::loadFileContent() in Pico::readPages() 2016-10-09 02:49:30 +02:00
Daniel Rudolf
bea610dbf4
Pico::evaluateRequestUrl(): Replace strpos()+substr() with strstr() 2016-10-05 14:17:10 +02:00
Daniel Rudolf
3ebb51a55e
Improve class docs
Follow-up to 00603f6
2016-10-01 19:01:21 +02:00
Daniel Rudolf
00603f61fc
Add integrated 404 Not Found page
Resolves #299
2016-10-01 18:58:04 +02:00
Daniel Rudolf
a74db1ddbb
Add Pico::filterVariable() method
This method can be used to validate and filter input data and can be called via `Pico::getUrlParameter()` (URL GET parameters) and `Pico::getFormParameter()` (HTTP POST parameters). `Pico::filterVariable()` is basically a wrapper for PHP's `filter_var()` function with various compatibility extensions to allow theme developers to use its functionality in Twig templates. Therefore Pico 1.1 adds the `url_param` (`Pico::getUrlParameter()`) and `form_param` (`Pico::getFormParameter()`) Twig functions.

Resolves #305
2016-09-17 20:10:24 +02:00
Daniel Rudolf
0b4099fdb0
Improve class docs 2016-09-17 20:02:49 +02:00
Daniel Rudolf
f73c9622b8
Fix Pico::evaluateRequestUrl(): PHP's built-in webserver doesn't always set QUERY_STRING 2016-09-17 20:02:29 +02:00
Daniel Rudolf
21bd18bcf0
Replace Pico::discoverRequestFile() with public Pico::resolveFilePath()
This allows plugins (e.g. PicoAdmin) to safely resolve file paths without the need of re-implementing the method.
2016-07-20 19:23:19 +02:00
Daniel Rudolf
e27be7a80f
Merge branch 'master' into pico-1.1 2016-07-15 03:23:09 +02:00
Daniel Rudolf
fb4bdfe1fc
Fix Pico::parseFileMeta() for non-YAML 1-liners
\Symfony\Component\Yaml\Parser::parse() returns the unchanged value when a 1-liner string which is no valid YAML is passed. Assume this string to be the page title. Thus the following page will work now:

```
---
This is the title
---

# Example page

{{ meta.title }} is going to be "This is the title" - or "%meta.title%" == "This is the title".
```
2016-07-15 03:13:58 +02:00
Daniel Rudolf
aa1bc077a7
Add $dropIndex parameter to Pico::getPageUrl() method
This allows one to prevent Pico from removing the last "index" path component. Example use case: Pico's official admin plugin. We must distinguish between "content/sub.md" and "content/sub/index.md", otherwise it wouldn't be possible to edit both pages.
2016-07-14 00:24:06 +02:00
Daniel Rudolf
848e28b7e6
Declare Pico::getFiles() public
This might be a useful helper method for plugins (e.g. PicoAdmin)
2016-07-14 00:20:22 +02:00
Daniel Rudolf
ddf3da0391
Merge branch 'master' into pico-1.1
Conflicts:
	.htaccess
	config/config.php.template
	content-sample/index.md
	lib/Pico.php
2016-06-18 20:23:23 +02:00
Daniel Rudolf
eeb43e131f
Pico::prepareFileContent(): Declare $variables variable 2016-06-18 20:19:16 +02:00
Daniel Rudolf
94279c57f8
Improve phpDocs class docs 2016-05-23 15:13:56 +02:00
Daniel Rudolf
e01044319a
Build system: Use dynamic phpDoc title 2016-04-24 21:13:47 +02:00
Daniel Rudolf
0e8cd0873d
Merge branch 'master' into pico-1.1
Conflicts:
	.htaccess
2016-04-24 20:23:00 +02:00
Daniel Rudolf
6465c2b0a9
Support REQUEST_URI routing method
With Pico 1.0 you had to setup URL rewriting (e.g. using `mod_rewrite` on Apache) in a way that rewritten URLs follow the `QUERY_STRING` principles. Starting with version 1.1, Pico additionally supports the `REQUEST_URI` routing method, what allows you to simply rewrite all requests to just `index.php`. Pico then reads the requested page from the `REQUEST_URI` environment variable provided by the webserver. Please note that `QUERY_STRING` takes precedence over `REQUEST_URI`.
2016-04-24 20:11:05 +02:00
Daniel Rudolf
6234be88b0
Always use on404Content... execution path when serving a 404.md 2016-04-24 04:06:04 +02:00
Daniel Rudolf
d19621a908
Improve themes dir guessing; add $config['theme_url'] config 2016-04-24 01:22:43 +02:00
Daniel Rudolf
1b3ef7516d
Drop the "index" part of URLs
Closes #347. Thanks @Robby-
2016-04-23 21:41:09 +02:00
Daniel Rudolf
a119122497 Fix coding standard violation 2016-04-22 14:31:14 +02:00
Daniel Rudolf
b133f6dae5 Add Pico::VERSION_ID (like PHP_VERSION_ID) 2016-04-22 14:23:46 +02:00
Daniel Rudolf
8dfb1b14c7
Improve HTTPS detection with proxies
Fixes #344. Thanks @Robby-

Implementation details taken from Symfony 3.0.4, method \Symfony\Component\HttpFoundation\Request::isSecure(), see https://github.com/symfony/symfony/blob/v3.0.4/src/Symfony/Component/HttpFoundation/Request.php#L1169-L1192
2016-04-17 02:44:41 +02:00
Daniel Rudolf
bbd8ef8847 Fix Date meta header parsing with ISO-8601 datetime strings
Symfony YAML interprets ISO-8601 datetime strings and returns timestamps instead of the string. This behavior conforms to the YAML standard, i.e. this is no bug of Symfony YAML.

Fixes #336. Thanks @csholmq for reporting this.
2016-03-16 14:27:42 +01:00
Daniel Rudolf
0a4e7443d2 Fix class doc typos 2016-03-16 13:33:52 +01:00
Daniel Rudolf
3d11b8a979 Replace is_a() function calls with instanceof operator 2016-03-11 19:07:45 +01:00
Daniel Rudolf
dc621b24cd Improve class docs of Pico::loadConfig() 2016-03-06 21:00:00 +01:00
Daniel Rudolf
988a23fd02 Modular config: Load config from any config/*.config.php
Resolves #330

After loading the `config/config.php`, Pico proceeds with any existing `config/*.config.php` in alphabetical order. The file order is crucial: Config values which has been set already, cannot be overwritten by a succeeding file. This is also true for arrays, i.e. when specifying `$config['test'] = array('foo' => 'bar')` in `config/a.config.php` and `$config['test'] = array('baz' => 42)` in `config/b.config.php`, `$config['test']['baz']` will be undefined
2016-03-06 20:55:46 +01:00
Daniel Rudolf
cd74b681f5 Fix scope isolated config includes 2016-03-06 20:47:25 +01:00
Daniel Rudolf
75d5081bfb Use scope isolated includes for plugins & config 2016-03-06 20:06:24 +01:00
Daniel Rudolf
5bb1c325ff Add onSinglePageLoading event; allow skipping pages in onSinglePageLoaded 2016-03-06 00:54:36 +01:00
Daniel Rudolf
245cd15770 Refactor Pico::prepareFileContent() for better performance 2016-03-06 00:49:45 +01:00
Daniel Rudolf
479926eeb4 Add Pico::VERSION constant 2016-03-06 00:38:51 +01:00
Daniel Rudolf
43705d0f76 Minor code refactoring 2016-03-06 00:29:40 +01:00
Daniel Rudolf
0d40259c06 Merge branch 'master' into pico-1.1 2016-03-03 00:34:41 +01:00
Daniel Rudolf
8426a53f63 Allow Pico::$requestFile to point to somewhere outside content_dir
Bugfix; Refactoring Pico::load404Content() and Pico::discoverCurrentPage()
2016-03-03 00:04:31 +01:00
Daniel Rudolf
2a3e2fa576 Fix typos in class docs/exception messages 2016-03-02 22:10:49 +01:00
Daniel Rudolf
1709b920d1 Add AbstractPicoPlugin::getPluginConfig() method 2016-03-02 21:46:35 +01:00
Daniel Rudolf
a8f0fd1f33 Merge branch 'master' into pico-1.1 2016-02-29 21:00:14 +01:00
Daniel Rudolf
a2aa46fd0e Don't let dependant plugins automatically enable plugins which should be disabled by default
Follow-up to f10440b and c0a7fdc
2016-02-29 20:58:42 +01:00
Daniel Rudolf
c0a7fdc801 Don't always check dependants of a disabled plugin
This isn't necessary because dependant plugins will check their dependencies on their own. Follow-up to f10440b
2016-02-29 20:41:41 +01:00
Daniel Rudolf
5a9c02f7bf Allow plugins to trigger events
You MUST NOT trigger events of Pico's core through a plugin!
2016-02-29 19:51:06 +01:00
Daniel Rudolf
56b2ed6c7d Allow manual plugin loading 2016-02-29 19:50:35 +01:00
Daniel Rudolf
4f487b7ccf AbstractPicoPlugin: Fix typos in exception message 2016-02-29 19:47:02 +01:00
Daniel Rudolf
f10440b996 Check dependencies when a plugin is enabled by default 2016-02-29 19:44:25 +01:00
Daniel Rudolf
d8be108c5b Suppress PHP warning when using date_default_timezone_get()
Thanks to @nem25 for reporting this
2016-02-04 14:19:14 +01:00
Daniel Rudolf
1c2f6a1b23 Update class docs 2016-01-25 19:31:53 +01:00
Daniel Rudolf
73078a3dc3 Fix code formatting + class docs 2016-01-07 03:00:32 +01:00
Daniel Rudolf
c760205d70 Pico::triggerEvent(): Fix method docs typo 2015-12-28 22:41:39 +01:00
Daniel Rudolf
070da6d73f Improve "404.md not found" exception message 2015-12-23 16:18:16 +01:00
Daniel Rudolf
5be2f8e597 Fix path handling on Windows
Fixes #307; thank you @bpgs for reporting!
2015-12-23 16:17:06 +01:00
Daniel Rudolf
9e4af2cba4 Merge pull request #294 from picocms/enhancement/YamlParseError2
Catch YAML parse errors (2)
2015-12-21 04:13:07 +01:00
Daniel Rudolf
43f953b67a Pico::readPages(): Call Pico::parseFileMeta() again when a exception is thrown 2015-12-21 04:08:35 +01:00
Daniel Rudolf
3798cbe478 Remove page title fallback 2015-12-21 04:05:25 +01:00
Daniel Rudolf
329049bd18 Fix empty meta header 2015-12-21 03:42:59 +01:00
Daniel Rudolf
dc6ac516a8 Fix Pico::getPageUrl() 2015-12-13 22:27:27 +01:00
Daniel Rudolf
a138d23daf Throw LogicException instead of RuntimeException in Pico::setConfig() 2015-12-13 22:19:02 +01:00
Daniel Rudolf
0c85d70820 Adding $queryData parameter to Pico::getPageUrl() method
This allows developers to easily add custom query data to an page URL without the need to check enabled URL rewriting on their own. Since Twigs `link` filter is just an alias for Pico::getPageUrl(), theme designers can do the same with e.g. `{{ "index"|link("foo=bar&baz=42") }}`.

Theme designers, heads up! Don't forget that the result of the `link` filter is never escaped, so the result could contain unescaped ampersands when passing custom query data. You should pass the result to Twigs `escape` filter when using custom query data.
2015-12-13 22:14:05 +01:00
Daniel Rudolf
93f7aaad8b Class docs: Use default markdown table format 2015-12-07 15:17:39 +01:00
Daniel Rudolf
be46e19677 Merge branch 'master' into feature/PicoTwigExtension
Conflicts:
	CHANGELOG.md
2015-11-29 22:19:57 +01:00
Daniel Rudolf
2ce422d907 PicoTwigExtension: Refactor error handling 2015-11-29 22:18:41 +01:00
Daniel Rudolf
9aaab5de1a Refactor Pico::parseFileMeta() 2015-11-29 21:58:30 +01:00
Daniel Rudolf
5ea94d06e6 Catch YAML parse errors 2015-11-29 20:58:41 +01:00
Daniel Rudolf
2d9b5aa1a2 Fix operators 2015-11-29 16:39:03 +01:00
Daniel Rudolf
698a249d45 Force Pico::$requestUrl to have no leading/trailing slash
Fixes #291
2015-11-27 22:52:45 +01:00
Daniel Rudolf
2761f8b751 Refactor Pico::isUrlRewritingEnabled() 2015-11-27 20:13:17 +01:00
Daniel Rudolf
86d1f713f2 Move PHP version check to index.php 2015-11-27 19:45:21 +01:00
Daniel Rudolf
81138ce06a Merge branch 'master' of github.com:picocms/Pico 2015-11-27 19:43:47 +01:00
Daniel Rudolf
81821e7811 Improve Pico::getBaseUrl() code styling 2015-11-27 19:28:48 +01:00
theshka
1fae7ab3df * [New] added PHP_VERSION check to Pico::run() 2015-11-27 12:27:45 -06:00
Daniel Rudolf
840d41bca5 Improve type hinting 2015-11-25 04:07:46 +01:00
Daniel Rudolf
c34afad4af Fix typo 2015-11-22 14:08:35 +01:00
Daniel Rudolf
d252df4b98 Throw RuntimeException on invalid content dirs 2015-11-19 04:48:22 +01:00
Daniel Rudolf
f5006c036a Prevent double slashes in base_url when installed to document root
Fixes #274
2015-11-13 22:29:58 +01:00
Daniel Rudolf
c72ea0ecec PicoDeprecated: Sanitize content_dir and base_url options when reading config.php in Picos root dir 2015-11-13 19:10:30 +01:00
Daniel Rudolf
10de8efa11 Move markdown filter to PicoTwigExtension 2015-11-13 16:49:53 +01:00
Daniel Rudolf
f19adc64b9 Add PicoTwigExtension with map and sort_by filters 2015-11-13 16:48:01 +01:00
Daniel Rudolf
78ceabe878 Various improvements
- Reuse ParsedownExtra object
- Add new markdown Twig filter
- Improve class docs in general
- Document plugin number prefix usage
2015-11-12 15:34:56 +01:00
Daniel Rudolf
f9e9642c22 Fix Pico::getPageUrl()
With enabled URL rewriting we must call rawurlencode() on the file path parts rather the whole path
2015-11-08 14:01:35 +01:00
Daniel Rudolf
2ca711ad59 Add missing rawurlencode() to Pico::getPageUrl()
Replace urldecode() in Pico::evaluateRequestUrl() with rawurldecode()
See #272 for details, thanks @smcdougall for spotting!
2015-11-08 03:12:18 +01:00
Daniel Rudolf
cd7cd374bb Add content filter to get the parsed contents of a page (lazy loading) 2015-11-06 01:08:31 +01:00
Daniel Rudolf
af8de56512 Fix typos 2015-11-04 19:50:44 +01:00
Daniel Rudolf
ccac8dd4d3 Force trailing slash of $config['base_url'] and force existance of $config['timezone'] 2015-11-04 19:43:54 +01:00
Daniel Rudolf
90128f4946 Fix possible foreach on null errors 2015-11-03 23:49:34 +01:00
Daniel Rudolf
ebe007bd78 Guess content directory
As pointed out by @Lomanic (see https://github.com/picocms/Pico/pull/260#issuecomment-153091890; thank you btw\!) we actually have to explain users how to change the content directory. This runs contrary to our "stupidly simple" claim. So Pico now simply uses the `content` directory when it exists...
2015-11-02 19:48:58 +01:00
Daniel Rudolf
9a702415fb Remove return $config in config/config.php
I always thought that doing this is pretty unusual... But now it simply breaks BC - please refer to @Lomanic's [comment](https://github.com/picocms/Pico/pull/260#issuecomment-152610857). Using a return statement has no advantages, but increases the probability that something goes wrong (e.g. a clueless user removes the return statement). It was introduced with 23b90e2, but we never released it ([v0.9.1](4cb2b24fae/lib/pico.php (L188-L189))). Removing the return statement shouldn't cause any problems even for users which installed Pico in the meantime. As a result we don't break BC and moreover remove a prior BC break 😃
2015-10-31 00:32:08 +01:00
Daniel Rudolf
afb55b9cb6 Improve class docs 2015-10-29 18:13:35 +01:00
Daniel Rudolf
e6681ea903 Improve class docs
Also add some ToDos to inline docs
2015-10-29 18:07:45 +01:00
Daniel Rudolf
54ce5b9699 Various small improvements
- Improve class docs for phpDocumentor
- Add missing onPagesLoading() event to DummyPlugin
- Add some TODOs to the UPGRADE section of the docs
2015-10-29 02:55:30 +01:00
Daniel Rudolf
647a7b5bb7 Trap empty $requestFileParts 2015-10-28 01:41:26 +01:00
Daniel Rudolf
9e2604af85 Prevent content_dir breakouts using malicious request URLs
It's appalling that nobody (including me!) thought about that!
2015-10-28 01:36:28 +01:00