Commit graph

187 commits

Author SHA1 Message Date
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