Compare commits

...

56 Commits

Author SHA1 Message Date
Andy Miller
e4e0c06ea8 Merge branch 'release/1.0.0' 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
35 changed files with 620 additions and 166 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

@@ -1,3 +1,33 @@
# 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 +108,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,15 @@
"license": "MIT",
"require": {
"php": ">=5.4.0",
"twig/twig": "~1.16",
"twig/twig": "~1.23",
"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.*",

245
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": "09fcc6b4528be7d9c8af68a66e85f0b2",
"content-hash": "69bee250cbc5160401d50cc47c8d6aba",
"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",
@@ -212,20 +213,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 +267,7 @@
"whoops",
"zf2"
],
"time": "2015-09-27 09:47:06"
"time": "2015-06-29 05:42:04"
},
{
"name": "gregwar/cache",
@@ -403,25 +404,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 +432,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 +449,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 +720,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 +749,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev"
"dev-master": "2.8-dev"
}
},
"autoload": {
@@ -769,20 +776,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 +797,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 +809,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev"
"dev-master": "2.8-dev"
}
},
"autoload": {
@@ -829,24 +836,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 +977,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev"
"dev-master": "2.8-dev"
}
},
"autoload": {
@@ -888,20 +1011,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 +1033,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev"
"dev-master": "2.8-dev"
}
},
"autoload": {
@@ -937,7 +1060,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",
@@ -1004,9 +1127,7 @@
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"filp/whoops": 20
},
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {

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:
1: '0755'
0: '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

@@ -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 # Default cache folder perms. Usually 0755 or 0775 depending on setup
debug: false # Show an overlay over images indicating the pixel depth of the image when working with retina for example
media:

View File

@@ -2,7 +2,7 @@
// Some standard defines
define('GRAV', true);
define('GRAV_VERSION', '1.0.0-rc.6');
define('GRAV_VERSION', '1.0.0');
define('DS', '/');
// Directories and Paths

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

@@ -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

@@ -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;
}
@@ -620,7 +620,7 @@ class Validation
if (is_string($value)) {
$value = trim($value);
}
return (bool) $params !== true || !empty($value);
}

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

@@ -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

@@ -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

@@ -204,6 +204,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] = $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

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,8 @@ class ImageFile extends Image
// Asking the cache for the cacheFile
try {
$file = $this->cache->getOrCreateFile($cacheFile, $conditions, $generate, $actual);
$perms = octdec(self::getGrav()['config']->get('system.images.cache_perms', '0755'));
$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

@@ -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)

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

@@ -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

@@ -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',

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;
}
}