Compare commits

..

108 Commits

Author SHA1 Message Date
Andy Miller
08cbd9553f Merge branch 'release/1.0.5' 2015-12-18 16:50:33 -07:00
Andy Miller
dcaa9a35c3 Missed changeling entry 2015-12-18 16:50:19 -07:00
Andy Miller
4a80691e07 version update 2015-12-18 16:49:03 -07:00
Andy Miller
425831a7ae Fix for empty file when writing cache 2015-12-18 15:09:21 -07:00
Djamil Legato
984e0455b1 'informations' is not a thing 😞 2015-12-18 13:44:59 -08:00
Djamil Legato
00ecfb30f3 Ensuring gpm selfupgrades doesn't continue if PHP min version requirement isn't met. Gracefully abort with error and details. 2015-12-18 13:38:28 -08:00
Djamil Legato
c18f20e483 Added GRAV_PHP_MIN 2015-12-18 13:37:19 -08:00
Djamil Legato
71c5ff8c51 Added new Upgrader::meetsRequirements method
Ensures the PHP version meets the Grav's mininum required one.
2015-12-18 13:35:31 -08:00
Djamil Legato
1996dd7de8 Allowing Installer to set errors as string 2015-12-18 13:33:57 -08:00
Andy Miller
e87daa2361 Added support to get plugin languages from individual language files in languages folder of plugin 2015-12-18 12:29:45 -07:00
Flavio Copes
987feb1385 Make saveConfig static so it's more easily accessible 2015-12-18 15:42:33 +01:00
Flavio Copes
8d048c689f Persists to disk the plugin parameters currently stored in the Grav Config object 2015-12-18 14:44:03 +01:00
Flavio Copes
139ef04e0a Handle non-array values in file validation 2015-12-18 10:38:10 +01:00
Flavio Copes
4c01e6c93e Merge pull request #530 from mufac/mufac-patch-1
Prevent error if no collections present
2015-12-18 10:04:11 +01:00
Andy Miller
27744ba747 Merge branch 'feature/markdown_extendability' into develop 2015-12-17 18:09:28 -07:00
Andy Miller
3d3c6f4eba missing doc blocks 2015-12-17 18:09:11 -07:00
Andy Miller
fb4abc5f5f Use Grav's version of Parsedown until PR is accepted (crossing fingers) 2015-12-17 17:52:20 -07:00
mufac
f29b141d69 Prevent error if no collections present
If there are no collections you can get a "Invalid argument supplied for foreach()" without an empty default.
2015-12-17 16:14:48 -06:00
Andy Miller
1cecd09423 requires changes in parsedown 2015-12-17 10:35:22 -07:00
Andy Miller
0142e76270 cleanup 2015-12-16 21:51:38 -07:00
Andy Miller
5f8c7f41ec Add ability to extend markdown 2015-12-16 19:50:10 -07:00
Flavio Copes
451baff26e filterFile if the file field allows multiple items returns an array, otherwise a string 2015-12-16 15:16:14 +01:00
Flavio Copes
0e8e27877e Fix https://github.com/getgrav/grav-plugin-admin/issues/335, when looping the fields param in a list field, first check it exists 2015-12-15 11:52:27 +01:00
Andy Miller
d8a993bc86 Properly convert comma to spaces for multiple attributes #518 2015-12-14 18:30:55 -07:00
Andy Miller
ec7dbbdc8b Added 7z format to standard file types #521 2015-12-14 18:13:14 -07:00
Djamil Legato
e152cfd10f Forcing travis VM to western most date and echo a Travis date to catch it on log 2015-12-12 17:47:19 -08:00
Andy Miller
747daa46f1 Merge branch 'release/1.0.4' 2015-12-12 13:03:34 -07:00
Andy Miller
17a0590ee4 Merge branch 'release/1.0.4' into develop 2015-12-12 13:03:34 -07:00
Andy Miller
653edb064b version update 2015-12-12 13:03:22 -07:00
Andy Miller
40f5d57737 Default value not in quotes. Needs to be a string for Admin compatibility - https://docs.saltstack.com/en/latest/topics/troubleshooting/yaml_idiosyncrasies.html#integers-are-parsed-as-integers 2015-12-12 08:43:41 -07:00
Flavio Copes
566c5cb38f Revert "Fix issue in images cache permissions"
This reverts commit 7e3058e3f0.
2015-12-12 10:18:32 +01:00
Flavio Copes
7e3058e3f0 Fix issue in images cache permissions
the leading '0' in the default 0755 was omitted as interpreted as an
integer, leading to errors in setting the images cache folder
permissions (not readable by Grav)
2015-12-12 10:13:21 +01:00
Djamil Legato
053d8a3fd5 Merge branch 'develop' of https://github.com/getgrav/grav into develop 2015-12-11 21:17:30 -08:00
Djamil Legato
0e810c15e2 Keep going if files are not found while creating a new project 2015-12-11 21:17:19 -08:00
Andy Miller
6b9154d1f3 Fix for cleaning build on linux 2015-12-11 22:08:59 -07:00
Andy Miller
4a5a400b89 Merge branch 'release/1.0.3' 2015-12-11 21:52:41 -07:00
Andy Miller
2d7a3232cc Merge branch 'release/1.0.3' into develop 2015-12-11 21:52:41 -07:00
Andy Miller
96d7c4790f version update 2015-12-11 21:52:14 -07:00
Andy Miller
c0b9ada21c fix for Image perms on admin save 2015-12-11 21:43:32 -07:00
Djamil Legato
7b116b41ae Not meant to be checked in 2015-12-11 20:42:30 -08:00
Djamil Legato
fcdd0bc0e9 Reverted CleanCommand to pure Command 2015-12-11 20:19:57 -07:00
Djamil Legato
0619f7c656 Reverted CleanCommand to pure Command 2015-12-11 18:44:52 -08:00
Andy Miller
f7696b61d3 Merge branch 'release/1.0.2' 2015-12-11 18:51:36 -07:00
Andy Miller
48083b203a Merge branch 'release/1.0.2' into develop 2015-12-11 18:51:36 -07:00
Andy Miller
f8aa9fed91 version update 2015-12-11 18:51:26 -07:00
Andy Miller
c55521ac4a fixed timing calculation 2015-12-11 17:16:10 -07:00
Andy Miller
2bb23efa7c Merge branch 'release/1.0.1' 2015-12-11 15:38:45 -07:00
Andy Miller
cdcb76cc55 Merge branch 'release/1.0.1' into develop 2015-12-11 15:38:45 -07:00
Andy Miller
def726a012 version update 2015-12-11 15:38:08 -07:00
Andy Miller
7d1291e2b9 Fixed cleanup to take into account symfony folder changes 2015-12-11 15:17:01 -07:00
Andy Miller
a0297e9d65 Fix error that can results from enabling debugger from admin 2015-12-11 15:00:54 -07:00
Andy Miller
e4e0c06ea8 Merge branch 'release/1.0.0' 2015-12-11 14:00:21 -07:00
Andy Miller
f46ad2d032 Merge branch 'release/1.0.0' into develop 2015-12-11 14:00:21 -07:00
Andy Miller
0c807b6108 version update 2015-12-11 13:59:52 -07:00
Andy Miller
3a47d6a580 force lowercase of username 2015-12-11 10:34:59 -07:00
Andy Miller
52947b3a2c Added Image cache perms option 2015-12-10 20:51:40 -07:00
Andy Miller
eacfc798f4 wrap security section of account blueprints in an authorize check 2015-12-10 16:05:22 -07:00
Andy Miller
5c0e5f3c01 updated debugbar 2015-12-10 16:04:46 -07:00
Andy Miller
985141b842 Merge pull request #515 from lennerd/fix/medium-url
Escape graph root in page medium to work with special characters.
2015-12-10 13:27:02 -07:00
Andy Miller
1aac2ab95d Merge branch 'develop' of https://github.com/getgrav/grav into develop 2015-12-10 12:13:01 -07:00
Andy Miller
aa7d5ddf59 translate validation messages 2015-12-10 12:12:56 -07:00
Flavio Copes
e87505378d Fix a parentheses issue that changes the logic and throw an error if $value['error'] is not set 2015-12-10 19:19:32 +01:00
Matias Griese
53f097c2b3 Fix wrong ordering when moving bulk of pages 2015-12-10 11:25:14 +02:00
Matias Griese
6ea7fe9dba Fix moving page if its just placeholder 2015-12-10 11:19:56 +02:00
Matias Griese
0206f1b0c7 Fix Page::copy() and Page::move() to support multiple moves at once 2015-12-10 10:46:09 +02:00
Matias Griese
ef9f2c77dd Minor fix in Page class 2015-12-10 10:24:21 +02:00
Andy Miller
822292f541 Merge branch 'develop' of https://github.com/getgrav/grav into develop 2015-12-09 10:13:53 -07:00
Andy Miller
ec08cd9374 Better fix for GPM issues 2015-12-09 10:13:44 -07:00
Flavio Copes
8fb4063cf2 Merge pull request #511 from getgrav/feature/fix-multisite-subfolder
Make $container available in setup.php
2015-12-09 17:25:31 +01:00
Lennart Hildebrandt
8a2b444c48 Escape graph root in page medium to work with special characters. 2015-12-09 12:30:08 +01:00
Andy Miller
9c6f243902 Fix for GPM problems "Call to a member function set() on null" 2015-12-08 21:20:41 -07:00
Andy Miller
d5bd99b363 Fix for individual asset pipeline value not functioning + optimizations #513 2015-12-08 11:42:39 -07:00
Matias Griese
5554c07cbf Merge pull request #508 from getgrav/feature/gantry
Add support to manually initialize theme
2015-12-08 10:12:00 +02:00
Andy Miller
acd95aac6f Merge branch 'develop' of https://github.com/getgrav/grav into develop 2015-12-07 16:46:37 -07:00
Andy Miller
8ad5f2624d Added iconv polyfill library 2015-12-07 16:46:28 -07:00
Andy Miller
8adc0e1c17 Merge pull request #510 from getgrav/feature/fix-translation
Fix issue when `translations_fallback` is turned off, the translations are always relative to the default language even if the active language is != default
2015-12-07 15:29:56 -07:00
Flavio Copes
fab66cf3a5 Make $container available in setup.php 2015-12-07 19:20:10 +01:00
Flavio Copes
5df48e7a68 Fix issue when translations_fallback is turned off, the translations are always relative to the default language even if the active language is != default 2015-12-07 16:25:46 +01:00
Djamil Legato
079a8c5728 Fixed LICENSE link 2015-12-06 13:24:27 -08:00
Flavio Copes
d9196426a1 Hide the session setting in admin as turning it off crashes the admin. 2015-12-06 18:20:16 +01:00
Flavio Copes
2f686f5b74 Improve a couple page method docs 2015-12-06 18:19:21 +01:00
Djamil Legato
c4b5df20a9 🎈 Added many more gpm index options (--filter, --sort, --updates-only, --plugins-only, --themes-only, --desc) 2015-12-04 17:54:14 -08:00
Djamil Legato
06608a6d3c Implemented sort method for Iterator ($iterator->sort($callback)) 2015-12-04 17:39:49 -08:00
Andy Miller
fd63911faf Useful cache info output 2015-12-04 15:50:04 -07:00
Flavio Copes
66a1e55867 Update pages blueprints to add the page preview in the markdown editor with the current admin changes 2015-12-04 23:12:36 +01:00
Andy Miller
af2eb2e75d Reverted PHP7 apcu as it seems to kill Doctrine Cache 2015-12-04 15:02:26 -07:00
Andy Miller
9b4f32cafd Merge branch 'develop' into feature/gantry 2015-12-03 22:15:17 -07:00
Andy Miller
9179fbd1a2 minor performance optimization 2015-12-03 22:12:01 -07:00
Andy Miller
24ea7f1f55 Support APCu extension loaded for PHP7.0 2015-12-03 19:05:53 -07:00
Andy Miller
9b95053110 Support APCu extension loaded for PHP7.0 2015-12-03 19:05:36 -07:00
Andy Miller
71ffb9c72f Merge branch 'develop' into feature/gantry 2015-12-03 18:06:30 -07:00
Andy Miller
f29f698f61 setter method to allow explicit setting of asset timestamp 2015-12-03 16:56:30 -07:00
Andy Miller
f1f8579a0b New setters to set state of CSS / JS pipelining 2015-12-03 14:48:34 -07:00
Andy Miller
4ca8fab750 removed unused Plugin and Theme initialization 2015-12-03 14:48:15 -07:00
Andy Miller
b80ed731b0 Made Page.evaluate() public so it can be used by twig, plugins etc. 2015-12-03 13:44:25 -07:00
Andy Miller
23a9a73600 Added logic to support link attributes via query string 2015-12-03 12:16:16 -07:00
Djamil Legato
dc8c0b6522 Fixed changelog differ to take into account betas/rc versions (fixes #496) 2015-12-02 23:44:18 -08:00
Andy Miller
e695b1942c .gitignore for accounts - https://github.com/getgrav/grav-plugin-login/issues/16 2015-12-02 15:38:05 -07:00
Andy Miller
3f543e7e84 Merge branch 'feature/gantry' of https://github.com/getgrav/grav into feature/gantry 2015-12-02 15:36:22 -07:00
Andy Miller
7f6f9e82e3 .gitignore for accounts - https://github.com/getgrav/grav-plugin-login/issues/16 2015-12-02 15:36:16 -07:00
Djamil Legato
51529eb0ce Merge branch 'develop' into feature/gantry 2015-12-02 14:10:17 -08:00
Andy Miller
05b24a4b75 Merge branch 'develop' of https://github.com/getgrav/grav into develop 2015-12-02 12:39:01 -07:00
Andy Miller
ca5819489f Fix for sandbox command 2015-12-02 12:38:56 -07:00
Matias Griese
1d2acf8096 Move onThemeInitialized event into Themes::initTheme() 2015-12-02 17:24:12 +02:00
Andy Miller
98278e965b Merge pull request #495 from tcsizmadia/develop
Updated Hungarian translation with new string.
2015-12-02 07:50:12 -07:00
Matias Griese
7bc990688c Add missing parent constructor to Themes class 2015-12-02 11:24:20 +02:00
Tamas Csizmadia
b86aa6d473 Updated Hungarian translation with new string. 2015-12-01 21:57:31 +01:00
Andy Miller
fa52e18e3f Merge branch 'release/1.0.0-rc.6' into develop 2015-12-01 13:13:16 -07:00
49 changed files with 966 additions and 244 deletions

2
.gitignore vendored
View File

@@ -16,6 +16,8 @@ logs/*
!logs/.*
images/*
!images/.*
user/accounts/*
!user/accounts/.*
user/data/*
!user/data/.*
user/plugins/*

View File

@@ -40,8 +40,10 @@ env:
- TRAVIS_TAG=$(curl --fail --user ${GH_API_USER} -s https://api.github.com/repos/getgrav/grav/releases/latest | grep tag_name | head -n 1 | cut -d '"' -f 4)
before_install:
- export TZ=Pacific/Honolulu
- composer self-update
- go get github.com/aktau/github-release
- echo "Travis Date: `date`"
- git clone --quiet --depth=50 --branch=master https://${BB_TOKEN}bitbucket.org/rockettheme/grav-devtools.git $RT_DEVTOOLS &>/dev/null;
- if [ ! -z "$TRAVIS_TAG" ]; then
cd "${RT_DEVTOOLS}";

View File

@@ -1,3 +1,77 @@
# v1.0.5
## 12/18/2015
1. [](#new)
* Add ability to extend markdown with plugins
* Added support for plugins to have individual language files
* Added `7z` to media formats
* Use Grav's fork of Parsedown until PR is merged
* New function to persist plugin configuration to disk
* GPM `selfupgrade` will now check PHP version requirements
1. [](#improved)
* If the field allows multiple files, return array
* Handle non-array values in file validation
1. [](#bugfix)
* Fix when looping `fields` param in a `list` field
* Properly convert commas to spaces for media attributes
* Forcing Travis VM to HI timezone to address future files in zip file
# v1.0.4
## 12/12/2015
1. [](#bugfix)
* Needed to put default image folder permissions for YAML compatibility
# v1.0.3
## 12/11/2015
1. [](#bugfix)
* Fixed issue when saving config causing incorrect image cache folder perms
# v1.0.2
## 12/11/2015
1. [](#bugfix)
* Fix for timing display in debugbar
# v1.0.1
## 12/11/2015
1. [](#improved)
* Reduced package sizes by removing extra vendor dev bits
1. [](#bugfix)
* Fix issue when you enable debugger from admin plugin
# v1.0.0
## 12/11/2015
1. [](#new)
* Add new link attributes via markdown media
* Added setters to set state of CSS/JS pipelining
* Added `user/accounts` to `.gitignore`
* Added configurable permissions option for Image cache
1. [](#improved)
* Hungarian translation updated
* Refactored Theme initialization for improved flexibility
* Wrapped security section of account blueprints in an 'super user' authorize check
* Minor performance optimizations
* Updated core page blueprints with markdown preview option
* Added useful cache info output to Debugbar
* Added `iconv` polyfill library used by Symfony 2.8
* Force lowercase of username in a few places for case sensitive filesystems
1. [](#bugfix)
* Fix for GPM problems "Call to a member function set() on null"
* Fix for individual asset pipeline values not functioning
* Fix `Page::copy()` and `Page::move()` to support multiple moves at once
* Fixed page moving of a page with no content
* Fix for wrong ordering when moving many pages
* Escape root path in page medium files to work with special characters
* Add missing parent constructor to Themes class
* Fix missing file error in `bin/grav sandbox` command
* Fixed changelog differ when upgrading Grav
* Fixed a logic error in `Validation->validate()`
* Make `$container` available in `setup.php` to fix multi-site
# v1.0.0-rc.6
## 12/01/2015
@@ -78,7 +152,7 @@
1. [](#new)
* New Page collection options! `@self.parent, @self.siblings, @self.descendants` + more
* Whitelist of file types for fallback route functionality (images by default)
* White list of file types for fallback route functionality (images by default)
1. [](#improved)
* Assets switched from defines to streams
1. [](#bugfix)

View File

@@ -103,7 +103,7 @@ What you mainly want to know is that:
# License
See [LICENSE](LICENSE)
See [LICENSE](LICENSE.txt)
[gitflow-model]: http://nvie.com/posts/a-successful-git-branching-model/

View File

@@ -40,8 +40,6 @@ if (!function_exists('curl_version')) {
$grav = Grav::instance(array('loader' => $autoload));
$grav['config']->init();
$grav['streams'];
$grav['plugins']->init();
$grav['themes']->init();
$app = new Application('Grav Package Manager', GRAV_VERSION);
$app->addCommands(array(

View File

@@ -7,14 +7,16 @@
"license": "MIT",
"require": {
"php": ">=5.4.0",
"twig/twig": "~1.16",
"twig/twig": "~1.23",
"erusev/parsedown": "dev-master as 1.6.0",
"erusev/parsedown-extra": "~0.7",
"symfony/yaml": "~2.7",
"symfony/console": "~2.7",
"symfony/event-dispatcher": "~2.7",
"symfony/var-dumper": "~2.7",
"doctrine/cache": "~1.4",
"filp/whoops": "1.2.*@dev",
"symfony/yaml": "~2.8",
"symfony/console": "~2.8",
"symfony/event-dispatcher": "~2.8",
"symfony/var-dumper": "~2.8",
"symfony/polyfill-iconv": "~1.0",
"doctrine/cache": "~1.5",
"filp/whoops": "1.1.10",
"monolog/monolog": "~1.0",
"gregwar/image": "~2.0",
"ircmaxell/password-compat": "1.0.*",
@@ -24,6 +26,12 @@
"rockettheme/toolbox": "~1.2",
"maximebf/debugbar": "~1.10"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/getgrav/parsedown"
}
],
"autoload": {
"psr-4": {
"Grav\\": "system/src/Grav"

268
composer.lock generated
View File

@@ -1,23 +1,24 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "b1323e540382de7390663756b3a87de7",
"hash": "82d333365d7424d73da22f99a2daa42c",
"content-hash": "6d876da7dbe11934a98374e67d15550c",
"packages": [
{
"name": "doctrine/cache",
"version": "v1.5.1",
"version": "v1.5.2",
"source": {
"type": "git",
"url": "https://github.com/doctrine/cache.git",
"reference": "2b9cec5a5e722010cbebc91713d4c11eaa064d5e"
"reference": "47c7128262da274f590ae6f86eb137a7a64e82af"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/cache/zipball/2b9cec5a5e722010cbebc91713d4c11eaa064d5e",
"reference": "2b9cec5a5e722010cbebc91713d4c11eaa064d5e",
"url": "https://api.github.com/repos/doctrine/cache/zipball/47c7128262da274f590ae6f86eb137a7a64e82af",
"reference": "47c7128262da274f590ae6f86eb137a7a64e82af",
"shasum": ""
},
"require": {
@@ -74,7 +75,7 @@
"cache",
"caching"
],
"time": "2015-11-02 18:35:48"
"time": "2015-12-03 10:50:37"
},
{
"name": "donatj/phpuseragentparser",
@@ -129,16 +130,16 @@
},
{
"name": "erusev/parsedown",
"version": "1.6.0",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/erusev/parsedown.git",
"reference": "3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7"
"url": "https://github.com/getgrav/parsedown.git",
"reference": "10a7ff776c3f16b1b3aa41c176c48150fc091065"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/erusev/parsedown/zipball/3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7",
"reference": "3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7",
"url": "https://api.github.com/repos/getgrav/parsedown/zipball/10a7ff776c3f16b1b3aa41c176c48150fc091065",
"reference": "10a7ff776c3f16b1b3aa41c176c48150fc091065",
"shasum": ""
},
"type": "library",
@@ -147,7 +148,6 @@
"Parsedown": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -164,7 +164,10 @@
"markdown",
"parser"
],
"time": "2015-10-04 16:44:32"
"support": {
"source": "https://github.com/getgrav/parsedown/tree/master"
},
"time": "2015-12-17 17:48:21"
},
{
"name": "erusev/parsedown-extra",
@@ -212,20 +215,20 @@
},
{
"name": "filp/whoops",
"version": "dev-master",
"version": "1.1.10",
"source": {
"type": "git",
"url": "https://github.com/filp/whoops.git",
"reference": "9a393ceb80f7497b6513feb574638e87048fed55"
"reference": "72538eeb70bbfb11964412a3d098d109efd012f7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/filp/whoops/zipball/9a393ceb80f7497b6513feb574638e87048fed55",
"reference": "9a393ceb80f7497b6513feb574638e87048fed55",
"url": "https://api.github.com/repos/filp/whoops/zipball/72538eeb70bbfb11964412a3d098d109efd012f7",
"reference": "72538eeb70bbfb11964412a3d098d109efd012f7",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
"php": ">=5.3.0"
},
"require-dev": {
"mockery/mockery": "0.9.*"
@@ -266,7 +269,7 @@
"whoops",
"zf2"
],
"time": "2015-09-27 09:47:06"
"time": "2015-06-29 05:42:04"
},
{
"name": "gregwar/cache",
@@ -403,25 +406,25 @@
},
{
"name": "maximebf/debugbar",
"version": "v1.10.5",
"version": "v1.11.0",
"source": {
"type": "git",
"url": "https://github.com/maximebf/php-debugbar.git",
"reference": "30e53e8a28284b69dd223c9f5ee8957befd72636"
"reference": "07741d84d39d10f00551c94284cdefcc69703e77"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/30e53e8a28284b69dd223c9f5ee8957befd72636",
"reference": "30e53e8a28284b69dd223c9f5ee8957befd72636",
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/07741d84d39d10f00551c94284cdefcc69703e77",
"reference": "07741d84d39d10f00551c94284cdefcc69703e77",
"shasum": ""
},
"require": {
"php": ">=5.3.0",
"psr/log": "~1.0",
"symfony/var-dumper": "~2.6"
"psr/log": "^1.0",
"symfony/var-dumper": "^2.6|^3.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
"phpunit/phpunit": "^4.0|^5.0"
},
"suggest": {
"kriswallsmith/assetic": "The best way to manage assets",
@@ -431,12 +434,12 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.10-dev"
"dev-master": "1.11-dev"
}
},
"autoload": {
"psr-0": {
"DebugBar": "src/"
"psr-4": {
"DebugBar\\": "src/DebugBar/"
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -448,14 +451,19 @@
"name": "Maxime Bouroumeau-Fuseau",
"email": "maxime.bouroumeau@gmail.com",
"homepage": "http://maximebf.com"
},
{
"name": "Barry vd. Heuvel",
"email": "barryvdh@gmail.com"
}
],
"description": "Debug bar in the browser for php application",
"homepage": "https://github.com/maximebf/php-debugbar",
"keywords": [
"debug"
"debug",
"debugbar"
],
"time": "2015-10-19 20:35:12"
"time": "2015-12-10 09:50:24"
},
{
"name": "monolog/monolog",
@@ -714,25 +722,26 @@
},
{
"name": "symfony/console",
"version": "v2.7.7",
"version": "v2.8.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "16bb1cb86df43c90931df65f529e7ebd79636750"
"reference": "d232bfc100dfd32b18ccbcab4bcc8f28697b7e41"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/16bb1cb86df43c90931df65f529e7ebd79636750",
"reference": "16bb1cb86df43c90931df65f529e7ebd79636750",
"url": "https://api.github.com/repos/symfony/console/zipball/d232bfc100dfd32b18ccbcab4bcc8f28697b7e41",
"reference": "d232bfc100dfd32b18ccbcab4bcc8f28697b7e41",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
"php": ">=5.3.9",
"symfony/polyfill-mbstring": "~1.0"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/event-dispatcher": "~2.1",
"symfony/process": "~2.1"
"symfony/event-dispatcher": "~2.1|~3.0.0",
"symfony/process": "~2.1|~3.0.0"
},
"suggest": {
"psr/log": "For using the console logger",
@@ -742,7 +751,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev"
"dev-master": "2.8-dev"
}
},
"autoload": {
@@ -769,20 +778,20 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2015-11-18 09:54:26"
"time": "2015-11-30 12:35:10"
},
{
"name": "symfony/event-dispatcher",
"version": "v2.7.7",
"version": "v2.8.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
"reference": "7e2f9c31645680026c2372edf66f863fc7757af5"
"reference": "a5eb815363c0388e83247e7e9853e5dbc14999cc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/7e2f9c31645680026c2372edf66f863fc7757af5",
"reference": "7e2f9c31645680026c2372edf66f863fc7757af5",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a5eb815363c0388e83247e7e9853e5dbc14999cc",
"reference": "a5eb815363c0388e83247e7e9853e5dbc14999cc",
"shasum": ""
},
"require": {
@@ -790,10 +799,10 @@
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "~2.0,>=2.0.5",
"symfony/dependency-injection": "~2.6",
"symfony/expression-language": "~2.6",
"symfony/stopwatch": "~2.3"
"symfony/config": "~2.0,>=2.0.5|~3.0.0",
"symfony/dependency-injection": "~2.6|~3.0.0",
"symfony/expression-language": "~2.6|~3.0.0",
"symfony/stopwatch": "~2.3|~3.0.0"
},
"suggest": {
"symfony/dependency-injection": "",
@@ -802,7 +811,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev"
"dev-master": "2.8-dev"
}
},
"autoload": {
@@ -829,24 +838,140 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
"time": "2015-10-30 20:10:21"
"time": "2015-10-30 20:15:42"
},
{
"name": "symfony/var-dumper",
"version": "v2.7.7",
"name": "symfony/polyfill-iconv",
"version": "v1.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "72bcb27411780eaee9469729aace73c0d46fb2b8"
"url": "https://github.com/symfony/polyfill-iconv.git",
"reference": "21a18998764e569c1675efc7191887130b319605"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/72bcb27411780eaee9469729aace73c0d46fb2b8",
"reference": "72bcb27411780eaee9469729aace73c0d46fb2b8",
"url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/21a18998764e569c1675efc7191887130b319605",
"reference": "21a18998764e569c1675efc7191887130b319605",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Iconv\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Iconv extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"iconv",
"polyfill",
"portable",
"shim"
],
"time": "2015-11-04 20:28:58"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "0b6a8940385311a24e060ec1fe35680e17c74497"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0b6a8940385311a24e060ec1fe35680e17c74497",
"reference": "0b6a8940385311a24e060ec1fe35680e17c74497",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
],
"time": "2015-11-04 20:28:58"
},
{
"name": "symfony/var-dumper",
"version": "v2.8.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "e6f3855005f2bfad7d7e72431d374a6478893fe3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/e6f3855005f2bfad7d7e72431d374a6478893fe3",
"reference": "e6f3855005f2bfad7d7e72431d374a6478893fe3",
"shasum": ""
},
"require": {
"php": ">=5.3.9",
"symfony/polyfill-mbstring": "~1.0"
},
"require-dev": {
"twig/twig": "~1.20|~2.0"
},
"suggest": {
"ext-symfony_debug": ""
@@ -854,7 +979,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev"
"dev-master": "2.8-dev"
}
},
"autoload": {
@@ -888,20 +1013,20 @@
"debug",
"dump"
],
"time": "2015-11-18 13:41:01"
"time": "2015-11-18 13:45:00"
},
{
"name": "symfony/yaml",
"version": "v2.7.7",
"version": "v2.8.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "4cfcd7a9fceba662b3c036b7d9a91f6197af046c"
"reference": "f79824187de95064a2f5038904c4d7f0227fedb5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/4cfcd7a9fceba662b3c036b7d9a91f6197af046c",
"reference": "4cfcd7a9fceba662b3c036b7d9a91f6197af046c",
"url": "https://api.github.com/repos/symfony/yaml/zipball/f79824187de95064a2f5038904c4d7f0227fedb5",
"reference": "f79824187de95064a2f5038904c4d7f0227fedb5",
"shasum": ""
},
"require": {
@@ -910,7 +1035,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev"
"dev-master": "2.8-dev"
}
},
"autoload": {
@@ -937,7 +1062,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2015-11-18 13:41:01"
"time": "2015-11-30 12:35:10"
},
{
"name": "twig/twig",
@@ -1002,10 +1127,17 @@
}
],
"packages-dev": [],
"aliases": [],
"aliases": [
{
"alias": "1.6.0",
"alias_normalized": "1.6.0.0",
"version": "9999999-dev",
"package": "erusev/parsedown"
}
],
"minimum-stability": "stable",
"stability-flags": {
"filp/whoops": 20
"erusev/parsedown": 20
},
"prefer-stable": false,
"prefer-lowest": false,

View File

@@ -516,6 +516,17 @@ form:
validate:
type: bool
twig.umask_fix:
type: toggle
label: PLUGIN_ADMIN.TWIG_UMASK_FIX
help: PLUGIN_ADMIN.TWIG_UMASK_FIX_HELP
highlight: 0
options:
1: PLUGIN_ADMIN.YES
0: PLUGIN_ADMIN.NO
validate:
type: bool
assets:
type: section
title: PLUGIN_ADMIN.ASSETS
@@ -688,6 +699,17 @@ form:
validate:
type: bool
images.cache_perms:
type: select
size: small
label: PLUGIN_ADMIN.CACHE_PERMS
help: PLUGIN_ADMIN.CACHE_PERMS_HELP
highlight: '0755'
options:
'0755': '0755'
'0775': '0775'
images.debug:
type: toggle
label: PLUGIN_ADMIN.IMAGES_DEBUG
@@ -745,13 +767,14 @@ form:
fields:
session.enabled:
type: toggle
type: hidden
label: PLUGIN_ADMIN.ENABLED
help: PLUGIN_ADMIN.SESSION_ENABLED_HELP
highlight: 1
options:
1: PLUGIN_ADMIN.YES
0: PLUGIN_ADMIN.NO
default: true
validate:
type: bool

View File

@@ -29,6 +29,7 @@ form:
content:
type: markdown
showPreview: true
validate:
type: textarea

View File

@@ -25,6 +25,7 @@ form:
content:
type: markdown
showPreview: true
uploads:
type: pagemedia

View File

@@ -25,6 +25,7 @@ form:
content:
type: markdown
showPreview: true
uploads:
type: pagemedia

View File

@@ -54,26 +54,32 @@ form:
default: 'en'
help: PLUGIN_ADMIN.LANGUAGE_HELP
groups:
type: selectize
size: large
label: PLUGIN_ADMIN.GROUPS
'@data-options': '\Grav\User\Groups::groups'
classes: fancy
help: PLUGIN_ADMIN.GROUPS_HELP
validate:
type: commalist
security:
title: Security
type: section
security: admin.super
access.admin:
type: array
label: PLUGIN_ADMIN.ADMIN_ACCESS
multiple: false
validate:
type: array
fields:
groups:
type: selectize
size: large
label: PLUGIN_ADMIN.GROUPS
'@data-options': '\Grav\User\Groups::groups'
classes: fancy
help: PLUGIN_ADMIN.GROUPS_HELP
validate:
type: commalist
access.site:
type: array
label: PLUGIN_ADMIN.SITE_ACCESS
multiple: false
validate:
type: array
access.admin:
type: array
label: PLUGIN_ADMIN.ADMIN_ACCESS
multiple: false
validate:
type: array
access.site:
type: array
label: PLUGIN_ADMIN.SITE_ACCESS
multiple: false
validate:
type: array

View File

@@ -168,6 +168,10 @@ zip:
type: file
thumb: media/thumb-zip.png
mime: application/zip
7z:
type: file
thumb: media/thumb-7zip.png
mime: application/x-7z-compressed
gz:
type: file
thumb: media/thumb-gz.png

View File

@@ -97,6 +97,7 @@ debugger:
images:
default_image_quality: 85 # Default image quality to use when resampling images (85%)
cache_all: false # Cache all image by default
cache_perms: '0755' # MUST BE IN QUOTES!! Default cache folder perms. Usually '0755' or '0775'
debug: false # Show an overlay over images indicating the pixel depth of the image when working with retina for example
media:

View File

@@ -2,8 +2,9 @@
// Some standard defines
define('GRAV', true);
define('GRAV_VERSION', '1.0.0-rc.6');
define('GRAV_VERSION', '1.0.5');
define('DS', '/');
define('GRAV_PHP_MIN', '5.5.9');
// Directories and Paths
if (!defined('GRAV_ROOT')) {

View File

@@ -50,3 +50,4 @@ NICETIME:
FORM:
VALIDATION_FAIL: <b>A validáció hibát talált:</b>
INVALID_INPUT: Az itt megadott érték érvénytelen:
MISSING_REQUIRED_FIELD: Ez a kötelező mező nincs kitöltve:

View File

@@ -186,7 +186,7 @@ class Assets
$this->base_url = $base_url . '/';
// Register any preconfigured collections
foreach ($config->get('system.assets.collections') as $name => $collection) {
foreach ($config->get('system.assets.collections', []) as $name => $collection) {
$this->registerCollection($name, (array)$collection);
}
}
@@ -203,7 +203,7 @@ class Assets
*
* @return $this
*/
public function add($asset, $priority = null, $pipeline = null)
public function add($asset, $priority = null, $pipeline = true)
{
// More than one asset
if (is_array($asset)) {
@@ -243,7 +243,7 @@ class Assets
*
* @return $this
*/
public function addCss($asset, $priority = null, $pipeline = null, $group = null)
public function addCss($asset, $priority = null, $pipeline = true, $group = null)
{
if (is_array($asset)) {
foreach ($asset as $a) {
@@ -259,16 +259,20 @@ class Assets
$asset = $this->buildLocalLink($asset);
}
// Check for existence
if ($asset === false) {
return $this;
}
$data = [
'asset' => $asset,
'priority' => intval($priority ?: 10),
'order' => count($this->css),
'pipeline' => $pipeline ?: true,
'pipeline' => (bool) $pipeline,
'group' => $group ?: 'head'
];
// check for dynamic array and merge with defaults
$count_args = func_num_args();
if (func_num_args() == 2) {
$dynamic_arg = func_get_arg(1);
if (is_array($dynamic_arg)) {
@@ -297,7 +301,7 @@ class Assets
* @param string $group name of the group
* @return $this
*/
public function addJs($asset, $priority = null, $pipeline = null, $loading = null, $group = null)
public function addJs($asset, $priority = null, $pipeline = true, $loading = null, $group = null)
{
if (is_array($asset)) {
foreach ($asset as $a) {
@@ -313,17 +317,21 @@ class Assets
$asset = $this->buildLocalLink($asset);
}
// Check for existence
if ($asset === false) {
return $this;
}
$data = [
'asset' => $asset,
'priority' => intval($priority ?: 10),
'order' => count($this->js),
'pipeline' => $pipeline ?: true,
'pipeline' => (bool) $pipeline,
'loading' => $loading ?: '',
'group' => $group ?: 'head'
];
// check for dynamic array and merge with defaults
$count_args = func_num_args();
if (func_num_args() == 2) {
$dynamic_arg = func_get_arg(1);
if (is_array($dynamic_arg)) {
@@ -351,7 +359,7 @@ class Assets
*
* @return \Grav\Common\Assets
*/
public function addAsyncJs($asset, $priority = null, $pipeline = null, $group = null)
public function addAsyncJs($asset, $priority = null, $pipeline = true, $group = null)
{
return $this->addJs($asset, $priority, $pipeline, 'async', $group);
}
@@ -368,7 +376,7 @@ class Assets
*
* @return \Grav\Common\Assets
*/
public function addDeferJs($asset, $priority = null, $pipeline = null, $group = null)
public function addDeferJs($asset, $priority = null, $pipeline = true, $group = null)
{
return $this->addJs($asset, $priority, $pipeline, 'defer', $group);
}
@@ -1124,6 +1132,36 @@ class Assets
return $this->addDir($directory, self::JS_REGEX);
}
/**
* Sets the state of CSS Pipeline
*
* @param boolean $value
*/
public function setCssPipeline($value)
{
$this->css_pipeline = (bool) $value;
}
/**
* Sets the state of JS Pipeline
*
* @param boolean $value
*/
public function setJsPipeline($value)
{
$this->js_pipeline = (bool) $value;
}
/**
* Explicitly set's a timestamp for assets
*
* @param $value
*/
public function setTimestamp($value)
{
$this->timestamp = '?'.$value;
}
public function __toString()
{
return '';

View File

@@ -38,6 +38,8 @@ class Cache extends Getters
*/
protected $driver;
protected $driver_name;
/**
* @var bool
*/
@@ -110,6 +112,10 @@ class Cache extends Getters
// Set the cache namespace to our unique key
$this->driver->setNamespace($this->key);
// Dump Cache state
$grav['debugger']->addMessage('Cache: [' . ($this->enabled ? 'true' : 'false') . '] Driver: [' . $this->driver_name . ']');
}
/**
@@ -136,6 +142,8 @@ class Cache extends Getters
$driver_name = $setting;
}
$this->driver_name = $driver_name;
switch ($driver_name) {
case 'apc':
$driver = new \Doctrine\Common\Cache\ApcCache();

View File

@@ -113,8 +113,13 @@ class Setup extends Data
],
];
public function __construct($environment = 'localhost')
public function __construct($container)
{
$environment = $container['uri']->environment();
if (!$environment) {
$environment = 'localhost';
}
// Pre-load setup.php which contains our initial configuration.
// Configuration may contain dynamic parts, which is why we need to always load it.
$file = GRAV_ROOT . '/setup.php';

View File

@@ -338,8 +338,10 @@ class Blueprint implements \ArrayAccess, ExportInterface
if ($field['type'] === 'list') {
// we loop through list to get the actual field
foreach($field['fields'] as $subName => &$subField) {
$this->parseFormField($subField);
if (isset($field['fields']) && $field['fields']) {
foreach($field['fields'] as $subName => &$subField) {
$this->parseFormField($subField);
}
}
} else {
$this->parseFormField($field);

View File

@@ -32,7 +32,7 @@ class Validation
}
// special case for files, value is never empty and errors with code 4 instead
if (empty($validate['required']) && $field['type'] == 'file' && (isset($value['error']) && ($value['error'] == UPLOAD_ERR_NO_FILE) || in_array(UPLOAD_ERR_NO_FILE, $value['error']))) {
if (empty($validate['required']) && $field['type'] == 'file' && (isset($value['error']) && ($value['error'] == UPLOAD_ERR_NO_FILE || in_array(UPLOAD_ERR_NO_FILE, $value['error'])))) {
return;
}
@@ -43,7 +43,7 @@ class Validation
$type = (string) isset($field['validate']['type']) ? $field['validate']['type'] : $field['type'];
$method = 'type'.strtr($type, '-', '_');
$name = ucfirst(isset($field['label']) ? $field['label'] : $field['name']);
$message = (string) isset($field['validate']['message']) ? $field['validate']['message'] : $language->translate('FORM.INVALID_INPUT', null, true) . ' "' . $language->translate($name) . '"';
$message = (string) isset($field['validate']['message']) ? $language->translate($field['validate']['message']) : $language->translate('FORM.INVALID_INPUT', null, true) . ' "' . $language->translate($name) . '"';
if (method_exists(__CLASS__, $method)) {
$success = self::$method($value, $validate, $field);
@@ -84,7 +84,7 @@ class Validation
}
// special case for files, value is never empty and errors with code 4 instead
if (empty($validate['required']) && $field['type'] == 'file' && (isset($value['error']) && ($value['error'] == UPLOAD_ERR_NO_FILE) || in_array(UPLOAD_ERR_NO_FILE, $value['error']))) {
if (empty($validate['required']) && $field['type'] == 'file' && (isset($value['error']) && ($value['error'] == UPLOAD_ERR_NO_FILE || in_array(UPLOAD_ERR_NO_FILE, $value['error'])))) {
return null;
}
@@ -283,7 +283,15 @@ class Validation
protected static function filterFile($value, array $params, array $field)
{
return (array) $value;
if ($field['multiple'] == true) {
return (array) $value;
}
if (is_array($value)) {
return reset($value);
}
return $value;
}
/**
@@ -620,7 +628,7 @@ class Validation
if (is_string($value)) {
$value = trim($value);
}
return (bool) $params !== true || !empty($value);
}

View File

@@ -15,6 +15,8 @@ class Debugger
protected $renderer;
protected $enabled;
protected $timers = [];
public function __construct()
{
$this->debugbar = new StandardDebugBar();
@@ -98,15 +100,17 @@ class Debugger
{
if ($name[0] == '_' || $this->grav['config']->get('system.debugger.enabled')) {
$this->debugbar['time']->startMeasure($name, $description);
$this->timers[] = $name;
}
return $this;
}
public function stopTimer($name)
{
if ($name[0] == '_' || $this->grav['config']->get('system.debugger.enabled')) {
if (in_array($name, $this->timers) && ($name[0] == '_' || $this->grav['config']->get('system.debugger.enabled'))) {
$this->debugbar['time']->stopMeasure($name);
}
return $this;
}

View File

@@ -274,6 +274,11 @@ abstract class Folder
throw new \RuntimeException('Cannot move non-existing folder.');
}
// Don't do anything if the source is the same as the new target
if ($source == $target) {
return;
}
// Make sure that path to the target exists before moving.
self::create(dirname($target));

View File

@@ -281,6 +281,10 @@ class Installer
{
$msg = 'Unknown Error';
if (is_string(self::$error)) {
return self::$error;
}
switch (self::$error) {
case 0:
$msg = 'No Error';
@@ -333,7 +337,7 @@ class Installer
/**
* Allows to manually set an error
* @param $error the Error code
* @param int|string $error the Error code
*/
public static function setError($error)

View File

@@ -55,7 +55,7 @@ class Grav extends AbstractPackageCollection
$diffLog = [];
foreach ($this->data['changelog'] as $version => $changelog) {
preg_match("/[\d\.]+/", $version, $cleanVersion);
preg_match("/[\w-\.]+/", $version, $cleanVersion);
if (!$cleanVersion || version_compare($diff, $cleanVersion[0], ">=")) { continue; }

View File

@@ -1,22 +1,32 @@
<?php
namespace Grav\Common\GPM;
use Grav\Common\Grav;
/**
* Class Upgrader
*
* @package Grav\Common\GPM
*/
class Upgrader
{
/**
* Remote details about latest Grav version
*
* @var Packages
*/
private $remote;
/**
* Internal cache
*
* @var Iterator
*/
protected $cache;
/**
* Creates a new GPM instance with Local and Remote packages available
*
* @param boolean $refresh Applies to Remote Packages only and forces a refetch of data
* @param callable $callback Either a function or callback in array notation
*/
@@ -27,6 +37,7 @@ class Upgrader
/**
* Returns the release date of the latest version of Grav
*
* @return string
*/
public function getReleaseDate()
@@ -36,6 +47,7 @@ class Upgrader
/**
* Returns the version of the installed Grav
*
* @return string
*/
public function getLocalVersion()
@@ -45,6 +57,7 @@ class Upgrader
/**
* Returns the version of the remotely available Grav
*
* @return string
*/
public function getRemoteVersion()
@@ -54,6 +67,7 @@ class Upgrader
/**
* Returns an array of assets available to download remotely
*
* @return array
*/
public function getAssets()
@@ -63,6 +77,7 @@ class Upgrader
/**
* Returns the changelog list for each version of Grav
*
* @param string $diff the version number to start the diff from
*
* @return array return the changelog list for each version
@@ -72,8 +87,21 @@ class Upgrader
return $this->remote->getChangelog($diff);
}
/**
* @return bool
*/
public function meetsRequirements()
{
if (version_compare(PHP_VERSION, GRAV_PHP_MIN, '<')) {
return false;
}
return true;
}
/**
* Checks if the currently installed Grav is upgradable to a newer version
*
* @return boolean True if it's upgradable, False otherwise.
*/
public function isUpgradable()
@@ -83,6 +111,7 @@ class Upgrader
/**
* Checks if Grav is currently symbolically linked
*
* @return boolean True if Grav is symlinked, False otherwise.
*/

View File

@@ -230,7 +230,6 @@ class Grav extends Container
$debugger->startTimer('themes', 'Themes');
$this['themes']->init();
$this->fireEvent('onThemeInitialized');
$debugger->stopTimer('themes');
$task = $this['task'];

View File

@@ -215,4 +215,26 @@ class Iterator implements \ArrayAccess, \Iterator, \Countable, \Serializable
return $this;
}
/**
* Sorts elements from the list and returns a copy of the list in the proper order
*
* @param callable|null $callback
*
* @param bool $desc
*
* @return $this|array
* @internal param bool $asc
*
*/
public function sort(callable $callback = null, $desc = false)
{
if (!$callback || !is_callable($callback)) { return $this; }
$items = $this->items;
uasort($items, $callback);
return !$desc ? $items : array_reverse($items, true);
}
}

View File

@@ -352,7 +352,7 @@ class Language
if ($this->config->get('system.languages.translations_fallback', true)) {
$languages = $this->getFallbackLanguages();
} else {
$languages = (array)$this->getDefault();
$languages = (array)$this->getLanguage();
}
}
} else {

View File

@@ -3,6 +3,7 @@ namespace Grav\Common\Markdown;
use Grav\Common\GravTrait;
use Grav\Common\Uri;
use RocketTheme\Toolbox\Event\Event;
/**
* A trait to add some custom processing to the identifyLink() method in Parsedown and ParsedownExtra
@@ -15,9 +16,11 @@ trait ParsedownGravTrait
protected $base_url;
protected $pages_dir;
protected $special_chars;
protected $twig_link_regex = '/\!*\[(?:.*)\]\((\{([\{%#])\s*(.*?)\s*(?:\2|\})\})\)/';
public $completeable_blocks = [];
public $continueable_blocks = [];
/**
* Initialization function to setup key variables needed by the MarkdownGravLinkTrait
*
@@ -26,8 +29,10 @@ trait ParsedownGravTrait
*/
protected function init($page, $defaults)
{
$grav = self::getGrav();
$this->page = $page;
$this->pages = self::getGrav()['pages'];
$this->pages = $grav['pages'];
$this->BlockTypes['{'] [] = "TwigTag";
$this->base_url = rtrim(self::getGrav()['base_url'] . self::getGrav()['pages']->base(), '/');
$this->pages_dir = self::getGrav()['locator']->findResource('page://');
@@ -41,8 +46,67 @@ trait ParsedownGravTrait
$this->setUrlsLinked($defaults['auto_url_links']);
$this->setMarkupEscaped($defaults['escape_markup']);
$this->setSpecialChars($defaults['special_chars']);
$grav->fireEvent('onMarkdownInitialized', new Event(['markdown' => $this]));
}
/**
* Be able to define a new Block type or override an existing one
*
* @param $type
* @param $tag
*/
public function addBlockType($type, $tag, $continueable = false, $completeable = false)
{
$this->BlockTypes[$type] []= $tag;
if ($continueable) {
$this->continueable_blocks[] = $tag;
}
if ($completeable) {
$this->completeable_blocks[] = $tag;
}
}
/**
* Be able to define a new Inline type or override an existing one
*
* @param $type
* @param $tag
*/
public function addInlineType($type, $tag)
{
$this->InlineTypes[$type] []= $tag;
$this->inlineMarkerList .= $type;
}
/**
* Overrides the default behavior to allow for plugin-provided blocks to be continueable
*
* @param $Type
* @return bool
*/
protected function isBlockContinueable($Type)
{
$continueable = in_array($Type, $this->continueable_blocks) || method_exists($this, 'block'.$Type.'Continue');
return $continueable;
}
/**
* Overrides the default behavior to allow for plugin-provided blocks to be completeable
*
* @param $Type
* @return bool
*/
protected function isBlockCompleteable($Type)
{
$completeable = in_array($Type, $this->completeable_blocks) || method_exists($this, 'block'.$Type.'Complete');
return $completeable;
}
/**
* Make the element function publicly accessible, Medium uses this to render from Twig
*
@@ -73,7 +137,7 @@ trait ParsedownGravTrait
*/
protected function blockTwigTag($Line)
{
if (preg_match('/[{%|{{|{#].*[#}|}}|%}]/', $Line['body'], $matches)) {
if (preg_match('/(?:{{|{%|{#)(.*)(?:}}|%}|#})/', $Line['body'], $matches)) {
$Block = array(
'markup' => $Line['body'],
);
@@ -204,6 +268,48 @@ trait ParsedownGravTrait
if (isset($excerpt['element']['attributes']['href'])) {
$url = parse_url(htmlspecialchars_decode($excerpt['element']['attributes']['href']));
// if there is a query, then parse it and build action calls
if (isset($url['query'])) {
$actions = array_reduce(explode('&', $url['query']), function ($carry, $item) {
$parts = explode('=', $item, 2);
$value = isset($parts[1]) ? $parts[1] : null;
$carry[$parts[0]] = $value;
return $carry;
}, []);
// valid attributes supported
$valid_attributes = ['rel', 'target', 'id', 'class', 'classes'];
// Unless told to not process, go through actions
if (array_key_exists('noprocess', $actions)) {
unset($actions['noprocess']);
} else {
// loop through actions for the image and call them
foreach ($actions as $attrib => $value) {
$key = $attrib;
if (in_array($attrib, $valid_attributes)) {
// support both class and classes
if ($attrib == 'classes') {
$attrib = 'class';
}
$excerpt['element']['attributes'][$attrib] = str_replace(',', ' ', $value);
unset($actions[$key]);
}
}
}
$url['query']= http_build_query($actions, null, '&', PHP_QUERY_RFC3986);
}
// if no query elements left, unset query
if (empty($url['query'])) {
unset ($url['query']);
}
// if there is no scheme, the file is local
if (!isset($url['scheme']) && (count($url) > 0)) {
// convert the URl is required
@@ -213,4 +319,16 @@ trait ParsedownGravTrait
return $excerpt;
}
// For extending this class via plugins
public function __call($method, $args)
{
if (isset($this->$method) === true) {
$func = $this->$method;
return call_user_func_array($func, $args);
}
}
}

View File

@@ -55,6 +55,7 @@ class ImageFile extends Image
$cacheFile .= $this->prettyName;
}
$cacheFile .= '.'.$type;
// If the files does not exists, save it
@@ -79,7 +80,9 @@ class ImageFile extends Image
// Asking the cache for the cacheFile
try {
$file = $this->cache->getOrCreateFile($cacheFile, $conditions, $generate, $actual);
$perms = self::getGrav()['config']->get('system.images.cache_perms', '0755');
$perms = octdec($perms);
$file = $this->cache->setDirectoryMode($perms)->getOrCreateFile($cacheFile, $conditions, $generate, $actual);
} catch (GenerationError $e) {
$file = $e->getNewFile();
}

View File

@@ -135,7 +135,7 @@ class ImageMedium extends Medium
*/
public function url($reset = true)
{
$output = preg_replace('|^' . GRAV_ROOT . '|', '', $this->saveImage());
$output = preg_replace('|^' . preg_quote(GRAV_ROOT) . '|', '', $this->saveImage());
if ($reset) {
$this->reset();

View File

@@ -137,7 +137,7 @@ class Medium extends Data implements RenderableInterface
*/
public function url($reset = true)
{
$output = preg_replace('|^' . GRAV_ROOT . '|', '', $this->get('filepath'));
$output = preg_replace('|^' . preg_quote(GRAV_ROOT) . '|', '', $this->get('filepath'));
if ($reset) {
$this->reset();

View File

@@ -5,6 +5,7 @@ use Exception;
use Grav\Common\Filesystem\Folder;
use Grav\Common\Config\Config;
use Grav\Common\GravTrait;
use Grav\Common\Language\Language;
use Grav\Common\Utils;
use Grav\Common\Cache;
use Grav\Common\Twig;
@@ -381,7 +382,7 @@ class Page
*/
public function modifyHeader($key, $value)
{
$this->header->$key = $value;
$this->header->{$key} = $value;
}
/**
@@ -392,8 +393,7 @@ class Page
*/
public function summary($size = null)
{
/** @var Config $config */
$config = self::getGrav()['config']->get('site.summary');
$config = (array) self::getGrav()['config']->get('site.summary');
if (isset($this->header->summary)) {
$config = array_merge($config, $this->header->summary);
}
@@ -728,27 +728,30 @@ class Page
* You need to call $this->save() in order to perform the move.
*
* @param Page $parent New parent page.
* @return Page
* @return $this
*/
public function move(Page $parent)
{
$clone = clone $this;
$clone->_action = 'move';
$clone->_original = $this;
$clone->parent($parent);
$clone->id(time().md5($clone->filePath()));
if (!$this->_original) {
$clone = clone $this;
$this->_original = $clone;
}
$this->_action = 'move';
$this->parent($parent);
$this->id(time().md5($this->filePath()));
if ($parent->path()) {
$clone->path($parent->path() . '/' . $clone->folder());
$this->path($parent->path() . '/' . $this->folder());
}
if ($parent->route()) {
$clone->route($parent->route() . '/'. $clone->slug());
$this->route($parent->route() . '/'. $this->slug());
} else {
$clone->route(self::getGrav()['pages']->root()->route() . '/'. $clone->slug());
$this->route(self::getGrav()['pages']->root()->route() . '/'. $this->slug());
}
return $clone;
return $this;
}
/**
@@ -758,14 +761,14 @@ class Page
* You need to call $this->save() in order to perform the move.
*
* @param Page $parent New parent page.
* @return Page
* @return $this
*/
public function copy($parent)
{
$clone = $this->move($parent);
$clone->_action = 'copy';
$this->move($parent);
$this->_action = 'copy';
return $clone;
return $this;
}
/**
@@ -826,7 +829,7 @@ class Page
$blueprints = $this->blueprints();
$values = $blueprints->filter($this->toArray());
if ($values && isset($values['header'])) {
$this->header($values['header']);
$this->header($values['header']);
}
}
@@ -1805,11 +1808,13 @@ class Page
if (isset($routes[$uri_path])) {
$child_page = $pages->dispatch($uri->route())->parent();
if ($child_page) while (!$child_page->root()) {
if ($this->path() == $child_page->path()) {
return true;
if ($child_page) {
while (!$child_page->root()) {
if ($this->path() == $child_page->path()) {
return true;
}
$child_page = $child_page->parent();
}
$child_page = $child_page->parent();
}
}
@@ -1843,7 +1848,7 @@ class Page
/**
* Helper method to return a page.
*
* @param string $url the url of the page
* @param string $url the url of the page
* @param bool $all
*
* @return \Grav\Common\Page\Page page you were looking for if it exists
@@ -1951,7 +1956,7 @@ class Page
* @return mixed
* @internal
*/
protected function evaluate($value)
public function evaluate($value)
{
// Parse command.
if (is_string($value)) {
@@ -2141,7 +2146,7 @@ class Page
*/
protected function doRelocation($reorder)
{
if (empty($this->_original) ) {
if (!$this->_original) {
return;
}
@@ -2182,7 +2187,7 @@ class Page
// Handle all the other pages.
$page = $pages->get($path);
if ($page && $page->exists() && $page->order() != $order+1) {
if ($page && $page->exists() && !$page->_action && $page->order() != $order+1) {
$page = $page->move($parent);
$page->order($order+1);
$page->save(false);
@@ -2190,11 +2195,12 @@ class Page
}
}
}
if ($this->_action == 'move' && $this->_original->exists()) {
Folder::move($this->_original->path(), $this->path());
}
if ($this->_action == 'copy' && $this->_original->exists()) {
Folder::copy($this->_original->path(), $this->path());
if (is_dir($this->_original->path())) {
if ($this->_action == 'move') {
Folder::move($this->_original->path(), $this->path());
} elseif ($this->_action == 'copy') {
Folder::copy($this->_original->path(), $this->path());
}
}
if ($this->name() != $this->_original->name()) {
@@ -2204,7 +2210,6 @@ class Page
}
}
$this->_action = null;
$this->_original = null;
}

View File

@@ -237,7 +237,7 @@ class Pages
/**
* Get a page instance.
*
* @param string $path
* @param string $path The filesystem full path of the page
* @return Page
* @throws \Exception
*/
@@ -264,7 +264,7 @@ class Pages
/**
* Dispatch URI to a page.
*
* @param $url
* @param string $url The relative URL of the page
* @param bool $all
* @return Page|null
*/

View File

@@ -6,6 +6,7 @@ use Grav\Common\Page\Page;
use Grav\Common\Config\Config;
use RocketTheme\Toolbox\Event\EventDispatcher;
use RocketTheme\Toolbox\Event\EventSubscriberInterface;
use RocketTheme\Toolbox\File\YamlFile;
/**
* The Plugin object just holds the id and path to a plugin.
@@ -182,4 +183,26 @@ class Plugin implements EventSubscriberInterface
// Return configurations as a new data config class
return new Data($header);
}
/**
* Persists to disk the plugin parameters currently stored in the Grav Config object
*
* @param string $plugin_name The name of the plugin whose config it should store.
*
* @return true
*/
public static function saveConfig($plugin_name) {
if (!$plugin_name) {
return false;
}
$locator = Grav::instance()['locator'];
$filename = 'config://plugins/' . $plugin_name . '.yaml';
$file = YamlFile::instance($locator->findResource($filename, true, true));
$content = Grav::instance()['config']->get('plugins.' . $plugin_name);
$file->save($content);
$file->free();
return true;
}
}

View File

@@ -104,8 +104,12 @@ class Plugins extends Iterator
continue;
}
$type = $directory->getBasename();
$list[$type] = self::get($type);
$plugin = $directory->getBasename();
$result = self::get($plugin);
if ($result) {
$list[$plugin] = $result;
}
}
}
ksort($list);
@@ -120,9 +124,9 @@ class Plugins extends Iterator
$blueprint->name = $name;
// Load default configuration.
$file = CompiledYamlFile::instance("plugins://{$name}/{$name}.yaml");
$file = CompiledYamlFile::instance("plugins://{$name}/{$name}" . YAML_EXT);
// ensure the plugin exists physically
// ensure this is a valid plugin
if (!$file->exists()) {
return null;
}

View File

@@ -40,7 +40,7 @@ class ConfigServiceProvider implements ServiceProviderInterface
public static function setup(Container $container)
{
return new Setup($container['uri']->environment());
return new Setup($container);
}
public static function blueprints(Container $container)
@@ -108,10 +108,45 @@ class ConfigServiceProvider implements ServiceProviderInterface
$files += (new ConfigFileFinder)->locateFiles($paths);
$paths = $locator->findResources('plugins://');
$files += (new ConfigFileFinder)->setBase('plugins')->locateInFolders($paths, 'languages');
$paths = static::pluginFolderPaths($paths, 'languages');
$files += (new ConfigFileFinder)->locateFiles($paths);
}
$languages = new CompiledLanguages($cache, $files, GRAV_ROOT);
return $languages->name("master-{$setup->environment}")->load();
}
/**
* Find specific paths in plugins
*
* @param $plugins
* @param $folder_path
* @return array
*/
private static function pluginFolderPaths($plugins, $folder_path)
{
$paths = [];
foreach ($plugins as $path) {
$iterator = new \DirectoryIterator($path);
/** @var \DirectoryIterator $directory */
foreach ($iterator as $directory) {
if (!$directory->isDir() || $directory->isDot()) {
continue;
}
// Path to the languages folder
$lang_path = $directory->getPathName() . '/' . $folder_path;
// If this folder exists, add it to the list of paths
if (file_exists($lang_path)) {
$paths []= $lang_path;
}
}
}
return $paths;
}
}

View File

@@ -25,6 +25,8 @@ class Themes extends Iterator
public function __construct(Grav $grav)
{
parent::__construct();
$this->grav = $grav;
$this->config = $grav['config'];
@@ -34,13 +36,18 @@ class Themes extends Iterator
public function init()
{
/** @var EventDispatcher $events */
$events = $this->grav['events'];
/** @var Themes $themes */
$themes = $this->grav['themes'];
$themes->configure();
$this->initTheme();
}
public function initTheme()
{
/** @var Themes $themes */
$themes = $this->grav['themes'];
try {
$instance = $themes->load();
} catch (\InvalidArgumentException $e) {
@@ -48,10 +55,15 @@ class Themes extends Iterator
}
if ($instance instanceof EventSubscriberInterface) {
/** @var EventDispatcher $events */
$events = $this->grav['events'];
$events->addSubscriber($instance);
}
$this->grav['theme'] = $instance;
$this->grav->fireEvent('onThemeInitialized');
}
/**
@@ -74,8 +86,12 @@ class Themes extends Iterator
continue;
}
$type = $directory->getBasename();
$list[$type] = self::get($type);
$theme = $directory->getBasename();
$result = self::get($theme);
if ($result) {
$list[$theme] = $result;
}
}
}
ksort($list);
@@ -100,14 +116,20 @@ class Themes extends Iterator
$blueprint = $blueprints->get("{$name}/blueprints");
$blueprint->name = $name;
// Load default configuration.
$file = CompiledYamlFile::instance("themes://{$name}/{$name}" . YAML_EXT);
// ensure this is a valid theme
if (!$file->exists()) {
return null;
}
// Find thumbnail.
$thumb = "themes://{$name}/thumbnail.jpg";
if ($path = $this->grav['locator']->findResource($thumb, false)) {
$blueprint->set('thumbnail', $this->grav['base_url'] . '/' . $path);
}
// Load default configuration.
$file = CompiledYamlFile::instance("themes://{$name}/{$name}" . YAML_EXT);
$obj = new Data($file->content(), $blueprint);
// Override with user configuration.

View File

@@ -20,6 +20,10 @@ trait WriteCacheFileTrait
*/
protected function writeCacheFile($file, $content)
{
if (empty($file)) {
return;
}
if (!isset(self::$umask)) {
self::$umask = self::getGrav()['config']->get('system.twig.umask_fix', false);
}

View File

@@ -32,6 +32,9 @@ class User extends Data
{
$locator = self::getGrav()['locator'];
// force lowercase of username
$username = strtolower($username);
$blueprints = new Blueprints('blueprints://');
$blueprint = $blueprints->get('user/account');
$file_path = $locator->findResource('account://' . $username . YAML_EXT);

View File

@@ -2,14 +2,24 @@
namespace Grav\Console\Cli;
use Grav\Common\Filesystem\Folder;
use Grav\Console\ConsoleCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
/**
* Class CleanCommand
* @package Grav\Console\Cli
*/
class CleanCommand extends ConsoleCommand
class CleanCommand extends Command
{
/* @var InputInterface $output */
protected $input;
/* @var OutputInterface $output */
protected $output;
/**
* @var array
*/
@@ -83,7 +93,7 @@ class CleanCommand extends ConsoleCommand
'vendor/maximebf/debugbar/bower.json',
'vendor/maximebf/debugbar/composer.json',
'vendor/maximebf/debugbar/.bowerrc',
'vendor/maximebf/debugbar/src/Debugbar/Resources/vendor',
'vendor/maximebf/debugbar/src/DebugBar/Resources/vendor',
'vendor/maximebf/debugbar/demo',
'vendor/maximebf/debugbar/docs',
'vendor/maximebf/debugbar/tests',
@@ -121,28 +131,34 @@ class CleanCommand extends ConsoleCommand
'vendor/rockettheme/toolbox/.travis.yml',
'vendor/rockettheme/toolbox/composer.json',
'vendor/rockettheme/toolbox/phpunit.xml',
'vendor/symfony/console/Symfony/Component/Console/composer.json',
'vendor/symfony/console/Symfony/Component/Console/phpunit.xml.dist',
'vendor/symfony/console/Symfony/Component/Console/.gitignore',
'vendor/symfony/console/Symfony/Component/Console/.git',
'vendor/symfony/console/Symfony/Component/Console/Tests',
'vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/.git',
'vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/.gitignore',
'vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/composer.json',
'vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/phpunit.xml.dist',
'vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests',
'vendor/symfony/yaml/Symfony/Component/Yaml/composer.json',
'vendor/symfony/yaml/Symfony/Component/Yaml/phpunit.xml.dist',
'vendor/symfony/yaml/Symfony/Component/Yaml/.gitignore',
'vendor/symfony/yaml/Symfony/Component/Yaml/.git',
'vendor/symfony/yaml/Symfony/Component/Yaml/Tests',
'vendor/tracy/tracy/.gitattributes',
'vendor/tracy/tracy/.travis.yml',
'vendor/tracy/tracy/composer.json',
'vendor/tracy/tracy/.gitignore',
'vendor/tracy/tracy/.git',
'vendor/tracy/tracy/examples',
'vendor/tracy/tracy/tests',
'vendor/symfony/console/composer.json',
'vendor/symfony/console/phpunit.xml.dist',
'vendor/symfony/console/.gitignore',
'vendor/symfony/console/.git',
'vendor/symfony/console/Tester',
'vendor/symfony/console/Tests',
'vendor/symfony/event-dispatcher/.git',
'vendor/symfony/event-dispatcher/.gitignore',
'vendor/symfony/event-dispatcher/composer.json',
'vendor/symfony/event-dispatcher/phpunit.xml.dist',
'vendor/symfony/event-dispatcher/Tests',
'vendor/symfony/polyfill-iconv/.git',
'vendor/symfony/polyfill-iconv/.gitignore',
'vendor/symfony/polyfill-iconv/composer.json',
'vendor/symfony/polyfill-mbstring/.git',
'vendor/symfony/polyfill-mbstring/.gitignore',
'vendor/symfony/polyfill-mbstring/composer.json',
'vendor/symfony/var-dumper/.git',
'vendor/symfony/var-dumper/.gitignore',
'vendor/symfony/var-dumper/composer.json',
'vendor/symfony/var-dumper/phpunit.xml.dist',
'vendor/symfony/var-dumper/Test',
'vendor/symfony/var-dumper/Tests',
'vendor/symfony/yaml/composer.json',
'vendor/symfony/yaml/phpunit.xml.dist',
'vendor/symfony/yaml/.gitignore',
'vendor/symfony/yaml/.git',
'vendor/symfony/yaml/Tests',
'vendor/twig/twig/.editorconfig',
'vendor/twig/twig/.travis.yml',
'vendor/twig/twig/.gitignore',
@@ -168,8 +184,10 @@ class CleanCommand extends ConsoleCommand
/**
* @return int|null|void
*/
protected function serve()
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->setupConsole($input, $output);
$this->cleanPaths();
}
@@ -177,12 +195,9 @@ class CleanCommand extends ConsoleCommand
{
$this->output->writeln('');
$this->output->writeln('<red>DELETING</red>');
$anything = false;
foreach ($this->paths_to_remove as $path) {
$path = ROOT_DIR . $path;
if (is_dir($path) && @Folder::delete($path)) {
$anything = true;
$this->output->writeln('<red>dir: </red>' . $path);
@@ -191,12 +206,30 @@ class CleanCommand extends ConsoleCommand
$this->output->writeln('<red>file: </red>' . $path);
}
}
if (!$anything) {
$this->output->writeln('');
$this->output->writeln('<green>Nothing to clean...</green>');
}
}
/**
* Set colors style definition for the formatter.
*
* @param InputInterface $input
* @param OutputInterface $output
*/
public function setupConsole(InputInterface $input, OutputInterface $output)
{
$this->input = $input;
$this->output = $output;
$this->output->getFormatter()->setStyle('normal', new OutputFormatterStyle('white'));
$this->output->getFormatter()->setStyle('yellow', new OutputFormatterStyle('yellow', null, array('bold')));
$this->output->getFormatter()->setStyle('red', new OutputFormatterStyle('red', null, array('bold')));
$this->output->getFormatter()->setStyle('cyan', new OutputFormatterStyle('cyan', null, array('bold')));
$this->output->getFormatter()->setStyle('green', new OutputFormatterStyle('green', null, array('bold')));
$this->output->getFormatter()->setStyle('magenta', new OutputFormatterStyle('magenta', null, array('bold')));
$this->output->getFormatter()->setStyle('white', new OutputFormatterStyle('white', null, array('bold')));
}
}

View File

@@ -48,7 +48,7 @@ class SandboxCommand extends ConsoleCommand
'/.editorconfig' => '/.editorconfig',
'/.gitignore' => '/.gitignore',
'/CHANGELOG.md' => '/CHANGELOG.md',
'/LICENSE' => '/LICENSE',
'/LICENSE.txt' => '/LICENSE.txt',
'/README.md' => '/README.md',
'/index.php' => '/index.php',
'/composer.json' => '/composer.json',
@@ -162,7 +162,7 @@ class SandboxCommand extends ConsoleCommand
$to = $this->destination . $target;
$this->output->writeln(' <cyan>' . $source . '</cyan> <comment>-></comment> ' . $to);
Folder::rcopy($from, $to);
@Folder::rcopy($from, $to);
}
}

View File

@@ -21,6 +21,16 @@ class IndexCommand extends ConsoleCommand
*/
protected $gpm;
/**
* @var
*/
protected $options;
/**
* @var array
*/
protected $sortKeys = ['name', 'slug', 'author', 'date'];
/**
*
*/
@@ -34,6 +44,43 @@ class IndexCommand extends ConsoleCommand
InputOption::VALUE_NONE,
'Force re-fetching the data from remote'
)
->addOption(
'filter',
'F',
InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
'Allows to limit the results based on one or multiple filters input. This can be either portion of a name/slug or a regex'
)
->addOption(
'themes-only',
'T',
InputOption::VALUE_NONE,
'Filters the results to only Themes'
)
->addOption(
'plugins-only',
'P',
InputOption::VALUE_NONE,
'Filters the results to only Plugins'
)
->addOption(
'updates-only',
'U',
InputOption::VALUE_NONE,
'Filters the results to Updatable Themes and Plugins only'
)
->addOption(
'sort',
's',
InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
'Allows to sort (ASC) the results based on one or multiple keys. SORT can be either "name", "slug", "author", "date"',
['date']
)
->addOption(
'desc',
'D',
InputOption::VALUE_NONE,
'Reverses the order of the output.'
)
->setDescription("Lists the plugins and themes available for installation")
->setHelp('The <info>index</info> command lists the plugins and themes available for installation')
;
@@ -44,16 +91,21 @@ class IndexCommand extends ConsoleCommand
*/
protected function serve()
{
$this->gpm = new GPM($this->input->getOption('force'));
$this->options = $this->input->getOptions();
$this->gpm = new GPM($this->options['force']);
$this->data = $this->gpm->getRepository();
$this->output->writeln('');
foreach ($this->data as $type => $packages) {
$data = $this->filter($this->data);
foreach ($data as $type => $packages) {
$this->output->writeln("<green>" . ucfirst($type) . "</green> [ " . count($packages) . " ]");
$index = 0;
$index = 0;
$packages = $this->sort($packages);
foreach ($packages as $slug => $package) {
$this->output->writeln(
// index
@@ -108,4 +160,65 @@ class IndexCommand extends ConsoleCommand
return '';
}
/**
* @param $data
*
* @return mixed
*/
public function filter($data)
{
// filtering and sorting
if ($this->options['plugins-only']) {
unset($data['themes']);
}
if ($this->options['themes-only']) {
unset($data['plugins']);
}
if ($this->options['filter'] || $this->options['updates-only'] || $this->options['desc']) {
foreach ($data as $type => $packages) {
foreach ($packages as $slug => $package) {
$filter = true;
// Filtering by string
if ($this->options['filter']) {
$filter = preg_grep('/(' . (implode('|', $this->options['filter'])) . ')/i', [$slug, $package->name]);
}
// Filtering updatables only
if ($this->options['updates-only'] && $filter) {
$method = ucfirst(preg_replace("/s$/", '', $package->package_type));
$filter = $this->gpm->{'is' . $method . 'Updatable'}($package->slug);
}
if (!$filter) {
unset($data[$type][$slug]);
}
}
}
}
return $data;
}
/**
* @param $packages
*/
public function sort($packages)
{
foreach ($this->options['sort'] as $key) {
$packages = $packages->sort(function ($a, $b) use ($key) {
switch ($key) {
case 'author':
return strcmp($a->{$key}['name'], $b->{$key}['name']);
break;
default:
return strcmp($a->$key, $b->$key);
}
}, $this->options['desc'] ? true : false);
}
return $packages;
}
}

View File

@@ -82,6 +82,18 @@ class SelfupgradeCommand extends ConsoleCommand
$remote = $this->upgrader->getRemoteVersion();
$release = strftime('%c', strtotime($this->upgrader->getReleaseDate()));
if (!$this->upgrader->meetsRequirements()) {
$this->output->writeln("");
$this->output->writeln("<red>ATTENTION:</red>");
$this->output->writeln(" Grav has increased the minimum PHP requirement.");
$this->output->writeln(" You are currently running PHP <red>" . PHP_VERSION . "</red>, but PHP <green>" . GRAV_PHP_MIN . "</green> is required.");
$this->output->writeln(" Additional information: <white>http://getgrav.org/blog/changing-php-requirements-to-5.5</white>");
$this->output->writeln("");
$this->output->writeln("Selfupgrade aborted.");
$this->output->writeln("");
exit;
}
if (!$this->upgrader->isUpgradable()) {
$this->output->writeln("You are already running the latest version of Grav (v" . $local . ") released on " . $release);
exit;

View File

@@ -1,8 +0,0 @@
<?php
namespace Grav;
class TestCase extends \PHPUnit_Framework_TestCase
{
}

View File

@@ -1,6 +0,0 @@
<?php
error_reporting(E_ALL);
date_default_timezone_set(@date_default_timezone_get());
require_once __DIR__.'/../../vendor/autoload.php';
require_once __DIR__.'/Grav/TestCase.php';

View File

@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="./bootstrap.php"
>
<testsuites>
<testsuite name="Full Grav Test Suite">
<directory>./Grav/</directory>
</testsuite>
</testsuites>
</phpunit>