Commit graph

320 commits

Author SHA1 Message Date
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
Daniel Rudolf de6b3a7c28 Fix Markdown %meta.*% replacement
Don't even try to use arrays here...
2015-10-28 01:08:45 +01:00
Daniel Rudolf a654b1585b phpDocumentor 2.8.5 currently doesn't support the Generic notations
This will likely be implemented as soon as the proposed PSR-5: PHPDoc is accepted
2015-10-27 01:48:58 +01:00
Daniel Rudolf 92af554d14 Improve inline code comments; preparing use of phpDocumentor 2015-10-27 01:39:28 +01:00
theshka 01122f2901 fix spelling 2015-10-09 20:41:00 +02:00
theshka fe83d1fa7f fix spelling 2015-10-09 20:41:00 +02:00
Daniel Rudolf b09433a37b Allow multiple calls to Pico::setConfig() 2015-10-06 20:38:34 +02:00
Daniel Rudolf 1419cf1636 Add Pico::setConfig() method
Thanks @dav-m85
2015-10-06 20:23:28 +02:00
Daniel Rudolf 7537159868 Remove the need to register headers during onMetaHeaders()
Why? I'm currently writing the user docs and I really have no idea how to explain this whole process in a non-technical way... It is very likely that a normal user wants to use custom tags and it would be absurd to tell him,that he should learn a programming language to do so. On the other hand, providing a copy-and-paste template makes the whole idea of explicitly registering headers worthless. The only reasonable solution is to remove the need to register headers.

Anyway, I think @PontusHorn is right to say that registering headers makes the whole system more predictable. So plugin developers are still instructed to register their meta headers during . We actually can't check and ensure this, but that's imho the best solution.
2015-10-05 01:50:55 +02:00
Daniel Rudolf 46ef63186a Support $config['<plugin name>']['enabled'] option
... as a alternative to $config['<plugin name>.enabled']; Thanks @theshka for giving this hint
2015-10-04 22:52:08 +02:00
Daniel Rudolf 9d518fd722 Move sorting of $pages from Pico::getPages() to Pico::sortPages() 2015-10-04 22:39:38 +02:00
Daniel Rudolf 4f1e8667c3 Cast AbstractPicoPlugin::$dependsOn to array
Plugin devs could come up with the idea of setting AbstractPicoPlugin::$dependsOn to a string (single dependency) or null (no dependencies)
2015-10-04 22:30:35 +02:00
Daniel Rudolf 27d694697f Fix code formatting 2015-10-04 21:34:37 +02:00
Daniel Rudolf 9aa62b4b44 Improve method docs of Pico::load404Content() 2015-10-04 16:57:57 +02:00
Daniel Rudolf 77f939028c Support per-directory 404.md files 2015-10-04 15:24:38 +02:00
Daniel Rudolf 3a4721a20c SCANDIR_SORT_* constants are available since PHP 5.4
Thanks @Lomanic
2015-10-04 14:15:11 +02:00
Daniel Rudolf 241a52907e Update inline code comments 2015-10-01 22:52:10 +02:00
Daniel Rudolf fd64e4fa5e Add a exception to alpha sorting: List index files first
This guarantees that e.g. sub/index.md is listed before sub/foo.md
2015-10-01 21:54:30 +02:00
Daniel Rudolf 45815e2c6d Don't read file contents of inaccessible pages 2015-10-01 17:22:14 +02:00
Daniel Rudolf 95db5ba1a1 Drop inaccessible pages
e.g. drop sub.md if sub/index.md exists
2015-10-01 15:59:47 +02:00
Daniel Rudolf cdef7a6324 Explicitly treat relative paths to be relative to Picos root dir
This tempers the BC break, we can now recommend to simply remove the ROOT_DIR part
2015-10-01 15:14:45 +02:00
Daniel Rudolf fc7632b0ac Overhaul init of Pico
This may break BC if you're using one of the now deprecated constants (e.g. ROOT_DIR)
2015-10-01 15:05:50 +02:00
Daniel Rudolf 5e77d862bf Remove twig cache dir 2015-09-29 00:42:04 +02:00
Daniel Rudolf 5533b07531 Re-add lost PicoPluginInterface 2015-09-15 13:20:52 +02:00
Daniel Rudolf 70f187fb45 Rename IPicoPlugin to PicoPluginInterface 2015-09-15 13:15:45 +02:00
Daniel Rudolf 5731ede297 Allow omitting config/config.php; Fix write context on return value
Thanks @Lomanic for reporting
2015-09-14 23:01:08 +02:00
Daniel Rudolf 71e7da28cc Various fixes
Thanks @PontusHorn for spotting!
2015-09-13 20:46:09 +02:00
Daniel Rudolf a83b01ef4f Access plugins by class name, not file name
Class name and file name can differ regarding case sensitivity
2015-09-06 14:35:23 +02:00
Daniel Rudolf 533822320e Workaround for webservers omitting QUERY_STRING
Thanks @theshka for spotting
2015-08-30 21:31:47 +02:00
Daniel Rudolf 07ae26789c Add AbstractPicoPlugin
The plugin magic takes place here...
2015-08-28 18:26:56 +02:00
Daniel Rudolf 43a7540f46 Add IPicoPlugin 2015-08-28 18:25:54 +02:00
Daniel Rudolf cd145821ba Remove pull request message 2015-08-28 18:24:06 +02:00
Daniel Rudolf 92c307d8be Pico 1.0
I unfortunately messed up my repo so this is just a single commit... :(
2015-08-28 18:22:32 +02:00
Daniel Rudolf c496297c44 Class files should exactly match the class name 2015-08-28 18:13:50 +02:00
Daniel Rudolf adc356251e Remove index.html
A empty index.html is a solution for nothing...
2015-08-28 18:11:45 +02:00
Tyler Heshka 2fdcacc14b Merge pull request #244 from muja/scandir
Use scandir instead of opendir to ensure alphabetical order.
2015-08-04 11:21:18 -06:00
Daniel Rudolf 399b73aa3b Move config.php to config/; Add CONFIG_DIR and VENDOR_DIR constants 2015-08-01 22:03:54 +02:00
Danyel Bayraktar 8d82cde120 Use scandir instead of opendir to ensure alphabetical order. 2015-07-14 13:31:51 +02:00
theshka f4cc9727ff Fix call on method of an object just created with new/PHP 5.3.10 compatibility error. 2015-06-23 19:06:53 -04:00
Wojciech Grzebieniowski 577160b109 Apply PSR1/PSR2 coding standards.
Mostly - use consistent indentation. Currently some methods in Pico
class are indented with space ( get_files() ), some with tabs.
2015-06-10 11:40:26 +02:00
Wojciech Grzebieniowski 83a3313e53 Fixed indent 2015-06-10 09:10:25 +02:00
Wojciech Grzebieniowski 23b90e2a92 Avoid using global config variable.
Instead config is keeped in Pico::$config private variable, and the
config.php returns $config.
2015-06-09 12:01:11 +02:00
theshka eb368d31e1 fix date_formatted issue 2015-05-29 13:22:52 -04:00
theshka 529e268d5b fix namespace error 2015-05-20 20:44:26 -04:00
theshka 968dc183db Upgrade to Parsedown-extra 2015-04-29 07:09:08 -07:00
theshka 483334170f Merge pull request #131 from Frodox/devel-chris
Don't remove all comments while parse content
2015-04-28 18:47:49 -04:00
theshka b586c9fd5f Merge pull request #137 from sergeweyland/patch-1
Update pico.php
2015-04-28 18:28:18 -04:00
gregfedorov d6df89ad2c Typo causes error on php 5.6.7 2015-04-21 22:46:32 +03:00
picocms 275d975ad8 Merge pull request #162 from cmattoon/patch-1
Update pico.php
2015-04-21 14:32:07 +01:00
picocms eb494c072c Merge pull request #150 from pschmitt/master
Localize date meta
2015-04-21 14:30:34 +01:00
picocms 80fa39769c Merge pull request #113 from Snip1/master
Update pico.php
2015-04-21 14:28:42 +01:00
picocms fdd60d8f98 Merge pull request #207 from raptorz/master
fix get_protocol bug.
2015-04-21 14:26:30 +01:00
Diogo Oliveira de Melo 196d3cf283 Move content to content-sample
- move the directory content to content-sample
- remove CONTENT_DIR as a define on index.php
- create config value "content_dir" and replace all CONTENT_DIR by it's
correspondent $config['content_dir']
- add the content_dir config on config.php.template
2015-03-18 06:32:00 -03:00
raptor 8efa97accc fix get_protocol bug.
$_SERVER['HTTPS'] == '' on nginx http
2015-02-21 23:03:05 +08:00
Curtis Mattoon dfb5900835 Update pico.php
Added ignore for tmp file extensions in the get_files() method. When editing plugins with emacs, the get_files() method also grabs the temp files, which leads to a "Can't redclare class [PluginName]" error.

Side note: Would these arrays be better in a property (ala DRY)?
2014-04-22 19:44:37 -04:00
picocms 364a395226 Update pico.php
Updated link
2014-03-25 15:10:19 +00:00
Philipp Schmitt a2331c1b53 UTF-8 encoding for date meta 2014-02-27 13:47:35 +01:00
Philipp Schmitt 553a5ea010 Localize date meta
Use strftime() instead of date() so that non-english websites can
display the date meta in their locale. The locale can be set with
setLocale(LC_ALL, 'YOURLOCALE').
Please note that this changes the date format.
More information: http://php.net/strftime
2014-02-27 12:48:56 +01:00
sergeweyland aea6779195 Update pico.php
Fixes an issue wherein the alphabetical sorting of pages did not happen, because array key was not, in fact, the page's filename.
2014-01-17 19:05:10 +01:00
Cristian 2194dd1bdb Fix comment 2014-01-05 17:42:41 +04:00
Snip1 395011c770 Update pico.php
Adding    				'description' => isset($page_meta['description']) ? $page_meta['description'] : '',
 to    $data=array  allows for use of the description meta in place of the excerpt.
2013-11-17 20:36:27 -05:00
Christopher b136780988 Dont remove all comments from *.md. Only first one (other may be code) 2013-11-01 01:37:20 +04:00
Gilbert Pellegrom aa59661ff8 v0.8
Added ability to set template in content meta
2013-10-23 10:39:23 +01:00
Gilbert Pellegrom b2fa0a4abe Changed Pico methods to protected. 2013-10-23 10:23:11 +01:00
Gilbert Pellegrom 022334ff13 Added before_parse_content & after_parse_content hooks. content_parsed
hook is depreciated. Updated get_protocol() method.
2013-10-23 10:19:24 +01:00
Gilbert Pellegrom 9616d902e0 Merge pull request #88 from NeoBlack/feature/moveConfigLoading
[BUGFIX] load config and call hook before the other hooks
2013-10-23 02:07:07 -07:00
Benedict Etzel f665564a79 only append ellipsis in limit_words when string was actually limited 2013-10-21 13:04:02 +02:00
Frank Nägler 3d91c03979 [BUGFIX] load config and call hook before the other hooks
this bugfix is very important, because other hooks like "after_load_content" can not use the config.
2013-10-14 20:26:02 +02:00
Gilbert Pellegrom 45cd4ca5b7 v0.7
* [New] Added before_read_file_meta and get_page_data plugin hooks to
customize page meta data
 * [Changed] Make get_files() ignore dotfiles
 * [Changed] Make get_pages() ignore Emacs and temp files
 * [Changed] Use composer version of Markdown
 * [Changed] Other small tweaks
 * [Fixed] Date warnings and other small bugs
2013-09-04 12:10:26 +01:00
Gilbert Pellegrom 69d67b2b71 Merge pull request #61 from cmattoon/master
Modified Pico::get_pages() to ignore Emacs (~) and (#) temp files
2013-09-04 03:33:04 -07:00
Gilbert Pellegrom b3c7648e3a Merge pull request #36 from ibr/master
Using composer version of Markdown
2013-09-04 03:23:16 -07:00
Gilbert Pellegrom 41bfe9ab49 Merge pull request #31 from cochrandv/master
Make get_files ignore dotfiles.
2013-09-04 03:21:19 -07:00
Curtis Mattoon 2e26edaa13 Replaced spaces with tabs... d'oh 2013-08-06 21:51:03 -04:00
Curtis Mattoon 8141ccaeb5 Merge branch 'master' of https://github.com/cmattoon/Pico
Conflicts:
	lib/pico.php
2013-08-06 21:43:49 -04:00
Curtis Mattoon 10eeea80c1 Modified Pico::get_pages() to ignore Emacs (~) and Nano (#) temp files 2013-08-06 21:40:13 -04:00
Konrad Riedel 145915346c using composer for markdown 2013-07-10 15:12:44 +02:00
David Cochran adf440a9dd get_files() will ignore dotfiles now 2013-07-07 21:48:04 -05:00
David Street 51b46c89de Minor fixes 2013-07-07 22:31:19 -04:00
David Street 0458c857c1 Added two new plugin hooks allowing better customization of page meta data. 2013-07-07 22:09:39 -04:00
KIKIJIKI fc9409e5a1 Fixed the problem with pages having the same date.
If the order is by date and some pages have the same date, only one will
be added to the array because it uses the date as the key.

By adding an auto-incrementing id the key is guaranteed to be unique.
2013-05-12 19:52:27 +09:00
Gilbert Pellegrom b145ea7d23 v0.6.2
[Changed] Replaced glob_recursive with get_files
2013-05-07 16:27:39 +01:00
Gilbert Pellegrom f9ebb4d75c v0.6.2
[New] Added "content" and "excerpt" fields to pages
[New] Added excerpt_length config setting
2013-05-07 10:09:03 +01:00
Gilbert Pellegrom 2416172ba7 v0.6
[New] Added plugin functionality
[Changed] Other small cleanup
2013-05-06 16:38:38 +01:00
Gilbert Pellegrom 842c05824a v0.5
[New] Added ability to order pages by "alpha" or "date" (asc or desc)
[New] Added prev_page, current_page, next_page and is_front_page
template vars
[New] Added "Author" and "Date" title meta fields
[Changed] Added "twig_config" to settings
[Changed] Updated documentation
[Fixed] Query string 404 bug
2013-05-03 15:45:42 +01:00
Gilbert Pellegrom 8cebbb51f8 v0.4.1
[New] Added CONTENT_EXT global
[Changed] Use .md files instead of .txt
2013-05-01 15:52:18 +01:00
Gilbert Pellegrom cc7ceafc1e v0.4
[New] Add get_pages() function for listing content
[New] Added changelog.txt
[Changed] Updated default theme
[Changed] Updated documentation
2013-05-01 14:34:24 +01:00
Gilbert Pellegrom 585a39a800 v0.3 2013-04-27 17:23:17 +01:00
Gilbert Pellegrom ac055a715a Fix get_config() function #13. 2013-04-27 17:17:08 +01:00
Gilbert Pellegrom c88f8e7967 v0.2
Added some inline docs.
2013-04-26 17:38:10 +01:00
Gilbert Pellegrom 7d2f97f2f6 Update Twig (now uses composer) and add composer.json. 2013-04-26 17:22:30 +01:00
Gilbert Pellegrom 070cb92661 Merge pull request #11 from purplefish32/master
Fixes multicase URLs
2013-04-26 08:59:12 -07:00
Gilbert Pellegrom f43efaa2bd Merge pull request #10 from mathroc/feature/404-status-code
Answer with a 404 status code when the page is not found
2013-04-26 08:57:08 -07:00
Donovan Tengblad cae36cb3b3 Remove strtolower
fixes: #3
2012-11-21 13:35:53 +01:00
Mathieu Rochette 776ceb2ef6 Answer with a 404 status code when the page is not found 2012-10-26 14:08:13 +02:00
Mathieu Rochette 76e4b9d519 ignore cache files
but keep lib/cache/ directory
2012-10-23 16:21:10 +02:00
Bill Ortell ce55a6543b replaced error-proned wierd HTTPS server var call in Pico->base_url 2012-04-17 22:14:19 -04:00
Gilbert Pellegrom fd23b10740 Cleanup. 2012-04-04 14:57:34 +01:00
Gilbert Pellegrom 92b792e8f2 Initial commit. 2012-04-04 14:45:09 +01:00