mirror of
https://github.com/getgrav/grav.git
synced 2025-12-05 15:29:57 +01:00
Compare commits
266 Commits
1.1.9
...
1.3.0-rc.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6496508810 | ||
|
|
d11099c0ae | ||
|
|
9c5df5977d | ||
|
|
d3526ae544 | ||
|
|
52d4c3f137 | ||
|
|
0c0bf4b137 | ||
|
|
6b282d845f | ||
|
|
82f223248e | ||
|
|
a9f1ca429a | ||
|
|
7db5d9189b | ||
|
|
8ff2003411 | ||
|
|
899cbffe33 | ||
|
|
77b44f83e1 | ||
|
|
5fc5813274 | ||
|
|
56b0cf292e | ||
|
|
08e0679942 | ||
|
|
6c062edd18 | ||
|
|
65d844c6e7 | ||
|
|
10b4a90501 | ||
|
|
5f00e1f8ee | ||
|
|
3c468a23c1 | ||
|
|
93c4396bfb | ||
|
|
19ac7f3e3f | ||
|
|
fc5c3023c6 | ||
|
|
04243f7dd3 | ||
|
|
cdc6b910cb | ||
|
|
219bf9dc6c | ||
|
|
ad66f0b637 | ||
|
|
bd7469d8e0 | ||
|
|
bfda4df2f2 | ||
|
|
718608cd55 | ||
|
|
7217635c6f | ||
|
|
3eeabdbf89 | ||
|
|
958557d2fe | ||
|
|
c8345c6613 | ||
|
|
83ed2aac00 | ||
|
|
849130621a | ||
|
|
bb6175397c | ||
|
|
2074c4933a | ||
|
|
e8aa9f0381 | ||
|
|
c8590b9523 | ||
|
|
e4ffc8d3de | ||
|
|
e5a522a2fe | ||
|
|
34281a14a4 | ||
|
|
f6d910f226 | ||
|
|
7371a11891 | ||
|
|
48d5183e07 | ||
|
|
bf42db3af1 | ||
|
|
28d3866eb0 | ||
|
|
f5517035ba | ||
|
|
bc9dfe736d | ||
|
|
aee07203a2 | ||
|
|
13b3b9875e | ||
|
|
7fc92dcaa2 | ||
|
|
6539931387 | ||
|
|
85a25d0adc | ||
|
|
8f9e401fc9 | ||
|
|
fc7c6484a7 | ||
|
|
7bbcefbb4d | ||
|
|
bd2f06e72f | ||
|
|
bc6bf737b9 | ||
|
|
749d0e3f2d | ||
|
|
7ba69dd5a1 | ||
|
|
00206d5957 | ||
|
|
d214bb5b94 | ||
|
|
1203b0d900 | ||
|
|
869b1c4c3b | ||
|
|
c06b2573a1 | ||
|
|
50dd834bc4 | ||
|
|
7b13ceb9a3 | ||
|
|
22effeac42 | ||
|
|
0e77103883 | ||
|
|
56e58f3b5e | ||
|
|
619dc30aca | ||
|
|
5bc3ce07dc | ||
|
|
0fe676c34b | ||
|
|
60f97f27be | ||
|
|
1d7f41e4a8 | ||
|
|
3a97502219 | ||
|
|
ca09f789a7 | ||
|
|
be94947d38 | ||
|
|
0a22ff0c68 | ||
|
|
840a349ace | ||
|
|
b85e595bbb | ||
|
|
082d4e3435 | ||
|
|
bfb6b6d68a | ||
|
|
8dc2ced94c | ||
|
|
f510e136c8 | ||
|
|
4365662304 | ||
|
|
4aa6dce853 | ||
|
|
d338d79acb | ||
|
|
459b7c4a33 | ||
|
|
06e880de57 | ||
|
|
cbf3df4bf1 | ||
|
|
aabc8aeb31 | ||
|
|
3d1ed7118e | ||
|
|
ca4f6f3c5c | ||
|
|
3a645ab4a2 | ||
|
|
25ba6198e5 | ||
|
|
6564ea98b1 | ||
|
|
8fe018a7dd | ||
|
|
5c40337ff0 | ||
|
|
41e7142dfc | ||
|
|
f45362b5b5 | ||
|
|
f8fbc82196 | ||
|
|
c153039457 | ||
|
|
88ccc25c47 | ||
|
|
b8164d3fe6 | ||
|
|
a1d4199e68 | ||
|
|
30f8eca905 | ||
|
|
ef7ff9ec4e | ||
|
|
0d471599d7 | ||
|
|
13bc19f1e3 | ||
|
|
da61196b7b | ||
|
|
04e1710de1 | ||
|
|
330a90b0ab | ||
|
|
5c34556246 | ||
|
|
10a15ef33f | ||
|
|
4eebc81808 | ||
|
|
cd37ea0689 | ||
|
|
7e50c340c7 | ||
|
|
701f18e782 | ||
|
|
66a21db504 | ||
|
|
0290ffd26e | ||
|
|
020cc6f39b | ||
|
|
3897506c7f | ||
|
|
b5cfb53d78 | ||
|
|
252b2f71a0 | ||
|
|
262951ece4 | ||
|
|
874160480f | ||
|
|
79d6b8ab22 | ||
|
|
04228ecee9 | ||
|
|
3cf8bd5928 | ||
|
|
9f57af80cf | ||
|
|
c86d791d44 | ||
|
|
ec9342ced1 | ||
|
|
23ba8a1386 | ||
|
|
ebb8786cd9 | ||
|
|
703080a329 | ||
|
|
c1ee217cef | ||
|
|
d0eed03fef | ||
|
|
9ba038b2b3 | ||
|
|
34cff72fce | ||
|
|
4726873b57 | ||
|
|
90ea2fc067 | ||
|
|
052a6df550 | ||
|
|
8032830873 | ||
|
|
4ace1d0b42 | ||
|
|
d0f4fbdfcc | ||
|
|
c7c3659312 | ||
|
|
f6e4091e51 | ||
|
|
175fcb9415 | ||
|
|
da2a0f507b | ||
|
|
e771938672 | ||
|
|
08e2bb558a | ||
|
|
af304f14f4 | ||
|
|
389cc296c2 | ||
|
|
9f193904b5 | ||
|
|
4945160bc7 | ||
|
|
17e6e3ec11 | ||
|
|
b969ab7deb | ||
|
|
50b355aaea | ||
|
|
b9424922a2 | ||
|
|
14bde9f31f | ||
|
|
a3ccae5915 | ||
|
|
e2cc55a4e3 | ||
|
|
724f24335a | ||
|
|
33a63de4f1 | ||
|
|
7ab0aee44a | ||
|
|
863d92cabf | ||
|
|
eae222f264 | ||
|
|
76c870ce04 | ||
|
|
3e786e0ea9 | ||
|
|
994793acea | ||
|
|
5b03125150 | ||
|
|
c36b26878f | ||
|
|
f8822de6fe | ||
|
|
97fe8095bd | ||
|
|
212d35221a | ||
|
|
570b02a760 | ||
|
|
c89914e63d | ||
|
|
929fefbef4 | ||
|
|
030b020add | ||
|
|
9100c54244 | ||
|
|
cab21f9834 | ||
|
|
b707007e7d | ||
|
|
a4c5d570ae | ||
|
|
3dc0e84351 | ||
|
|
993d93b067 | ||
|
|
d269989c50 | ||
|
|
e17721b4bd | ||
|
|
f37bebaacd | ||
|
|
f287dab16d | ||
|
|
31fe300a1e | ||
|
|
f1faea26e5 | ||
|
|
422b9907cf | ||
|
|
24bffcde80 | ||
|
|
b7c76b5a53 | ||
|
|
c7619e5b52 | ||
|
|
3d05574d08 | ||
|
|
6e8455fde6 | ||
|
|
c6c8577b6f | ||
|
|
108312e8c0 | ||
|
|
060f21f83d | ||
|
|
4d904e6f70 | ||
|
|
6968e2edff | ||
|
|
300f65c22e | ||
|
|
5ecf240c26 | ||
|
|
9536f2e418 | ||
|
|
645285ca5c | ||
|
|
c7fd01a644 | ||
|
|
61c0c31992 | ||
|
|
e2ee02a71d | ||
|
|
4e283322ea | ||
|
|
b5b452e585 | ||
|
|
138abdcab1 | ||
|
|
bf661c4355 | ||
|
|
085ca323e2 | ||
|
|
c22b28f312 | ||
|
|
9b5ef4c263 | ||
|
|
3cffe74965 | ||
|
|
759ba5143f | ||
|
|
9ebff2287c | ||
|
|
e492fbde21 | ||
|
|
7255556819 | ||
|
|
c718b8f32a | ||
|
|
07b66dd5d0 | ||
|
|
2e4686fada | ||
|
|
e2544feeaf | ||
|
|
970bf77492 | ||
|
|
0145f454b7 | ||
|
|
e984d9b68f | ||
|
|
1cd6773ded | ||
|
|
0445aa707b | ||
|
|
cc96d160a4 | ||
|
|
4331ab374e | ||
|
|
61005360a5 | ||
|
|
335c44385a | ||
|
|
88e9ad3df2 | ||
|
|
2b19414598 | ||
|
|
b00cd00259 | ||
|
|
6097431021 | ||
|
|
55a9356681 | ||
|
|
8aee946682 | ||
|
|
523d3a331a | ||
|
|
397107b611 | ||
|
|
342af3deba | ||
|
|
dc92498cd0 | ||
|
|
364209a27d | ||
|
|
46d741a2ed | ||
|
|
b5be9ee3f0 | ||
|
|
e0f17a48d5 | ||
|
|
fa27856bc0 | ||
|
|
befaf5d387 | ||
|
|
9571e992d9 | ||
|
|
e40bed5be2 | ||
|
|
442249c3a1 | ||
|
|
8b8d8bcc5b | ||
|
|
d2152cb48e | ||
|
|
81fc0d47ac | ||
|
|
8450f77443 | ||
|
|
0ccc34d860 | ||
|
|
5b6452d89e | ||
|
|
d61d260ef1 | ||
|
|
1125b51f27 | ||
|
|
bf552e22f1 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -26,6 +26,7 @@ user/plugins/*
|
||||
user/themes/*
|
||||
!user/themes/.*
|
||||
user/localhost/config/security.yaml
|
||||
user/config/security.yaml
|
||||
|
||||
# OS Generated
|
||||
.DS_Store*
|
||||
|
||||
@@ -54,17 +54,17 @@ RewriteRule .* index.php [L]
|
||||
|
||||
## Begin - Security
|
||||
# Block all direct access for these folders
|
||||
RewriteRule ^(.git|cache|bin|logs|backup|webserver-configs|tests)/(.*) error [F]
|
||||
RewriteRule ^(\.git|cache|bin|logs|backup|webserver-configs|tests)/(.*) error [F]
|
||||
# Block access to specific file types for these system folders
|
||||
RewriteRule ^(system|vendor)/(.*)\.(txt|xml|md|html|yaml|php|pl|py|cgi|twig|sh|bat)$ error [F]
|
||||
RewriteRule ^(system|vendor)/(.*)\.(txt|xml|md|html|yaml|yml|php|pl|py|cgi|twig|sh|bat)$ error [F]
|
||||
# Block access to specific file types for these user folders
|
||||
RewriteRule ^(user)/(.*)\.(txt|md|yaml|php|pl|py|cgi|twig|sh|bat)$ error [F]
|
||||
RewriteRule ^(user)/(.*)\.(txt|md|yaml|yml|php|pl|py|cgi|twig|sh|bat)$ error [F]
|
||||
# Block all direct access to .md files:
|
||||
RewriteRule \.md$ error [F]
|
||||
# Block all direct access to files and folders beginning with a dot
|
||||
RewriteRule (^|/)\.(?!well-known) - [F]
|
||||
# Block access to specific files in the root folder
|
||||
RewriteRule ^(LICENSE.txt|composer.lock|composer.json|\.htaccess)$ error [F]
|
||||
RewriteRule ^(LICENSE\.txt|composer\.lock|composer\.json|\.htaccess)$ error [F]
|
||||
## End - Security
|
||||
|
||||
</IfModule>
|
||||
|
||||
@@ -55,6 +55,7 @@ before_install:
|
||||
fi
|
||||
- if [ $TRAVIS_BRANCH != 'develop' ] && [ $TRAVIS_PHP_VERSION == "5.6" ] && [ $TRAVIS_PULL_REQUEST == "false" ]; then
|
||||
export 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);
|
||||
eval "$(curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | GIMME_GO_VERSION=1.8 bash)";
|
||||
go get github.com/aktau/github-release;
|
||||
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
|
||||
|
||||
210
CHANGELOG.md
210
CHANGELOG.md
@@ -1,3 +1,207 @@
|
||||
# v1.3.0-rc.1
|
||||
## 15/16/2017
|
||||
|
||||
1. [](#new)
|
||||
* Added support for a single array field in the forms
|
||||
* Added EXIF support with automatic generation of Page Media metafiles
|
||||
* Added Twig function to get EXIF data on any image file
|
||||
* Added `Pages::baseUrl()`, `Pages::homeUrl()` and `Pages::url()` functions
|
||||
* Added `base32_encode`, `base32_decode`, `base64_encode`, `base64_decode` Twig filters
|
||||
* Added `Debugger::getCaller()` to figure out where the method was called from
|
||||
* Added support for custom output providers like Slim Framework
|
||||
* Added `Grav\Framework\Collection` classes for creating collections
|
||||
1. [](#improved)
|
||||
* Add more controls over HTML5 video attributes (autoplay, poster, loop controls) [#1442](https://github.com/getgrav/grav/pull/1442)
|
||||
* Removed logging statement for invalid slug [#1459](https://github.com/getgrav/grav/issues/1459)
|
||||
* Groups selection pre-filled in user form
|
||||
* Improve error handling in `Folder::move()`
|
||||
* Added extra parameter for `Twig::processSite()` to include custom context
|
||||
* Updated RocketTheme Toolbox vendor library
|
||||
1. [](#bugfix)
|
||||
* Fix to force route/redirect matching from the start of the route by default [#1446](https://github.com/getgrav/grav/issues/1446)
|
||||
* Edit check for valid slug [#1459](https://github.com/getgrav/grav/issues/1459)
|
||||
|
||||
# v1.2.4
|
||||
## 04/24/2017
|
||||
|
||||
1. [](#improved)
|
||||
* Added optional ignores for `Installer::sophisticatedInstall()` [#1447](https://github.com/getgrav/grav/issues/1447)
|
||||
1. [](#bugfix)
|
||||
* Allow multiple calls to `Themes::initTheme()` without throwing errors
|
||||
* Fixed querystrings in root pages with multi-lang enabled [#1436](https://github.com/getgrav/grav/issues/1436)
|
||||
* Allow support for `Pages::getList()` with `show_modular` option [#1080](https://github.com/getgrav/grav-plugin-admin/issues/1080)
|
||||
|
||||
# v1.2.3
|
||||
## 04/19/2017
|
||||
|
||||
1. [](#improved)
|
||||
* Added new `pwd_regex` and `username_regex` system configuration options to allow format modifications
|
||||
* Allow `user/accounts.yaml` overrides and implemented more robust theme initialization
|
||||
* improved `getList()` method to do more powerful things
|
||||
* Fix Typo in GPM [#1427](https://github.com/getgrav/grav/issues/1427)
|
||||
|
||||
# v1.2.2
|
||||
## 04/11/2017
|
||||
|
||||
1. [](#bugfix)
|
||||
* Fix for redirects breaking [#1420](https://github.com/getgrav/grav/issues/1420)
|
||||
* Fix issue in direct-install with github-style dependencies [#1405](https://github.com/getgrav/grav/issues/1405)
|
||||
|
||||
# v1.2.1
|
||||
## 04/10/2017
|
||||
|
||||
1. [](#improved)
|
||||
* Added various `ancestor` helper methods in Page and Pages classes [#1362](https://github.com/getgrav/grav/pull/1362)
|
||||
* Added new `parents` field and switched Page blueprints to use this
|
||||
* Added `isajaxrequest()` Twig function [#1400](https://github.com/getgrav/grav/issues/1400)
|
||||
* Added ability to inline CSS and JS code via Asset manager [#1377](https://github.com/getgrav/grav/pull/1377)
|
||||
* Add query string in lighttpd default config [#1393](https://github.com/getgrav/grav/issues/1393)
|
||||
* Add `--all-yes` and `--destination` options for `bin/gpm direct-install` [#1397](https://github.com/getgrav/grav/pull/1397)
|
||||
1. [](#bugfix)
|
||||
* Fix for direct-install of plugins with `languages.yaml` [#1396](https://github.com/getgrav/grav/issues/1396)
|
||||
* When determining language from HTTP_ACCEPT_LANGUAGE, also try base language only [#1402](https://github.com/getgrav/grav/issues/1402)
|
||||
* Fixed a bad method signature causing warning when running tests on `GPMTest` object
|
||||
|
||||
# v1.2.0
|
||||
## 03/31/2017
|
||||
|
||||
1. [](#new)
|
||||
* Added file upload for user avatar in user/admin blueprint
|
||||
1. [](#improved)
|
||||
* Analysis fixes
|
||||
* Switched to stable composer lib versions
|
||||
|
||||
# v1.2.0-rc.3
|
||||
## 03/22/2017
|
||||
|
||||
1. [](#new)
|
||||
* Refactored Page re-ordering to handle all siblings at once
|
||||
* Added `language_codes` to Twig init to allow for easy language name/code/native-name lookup
|
||||
1. [](#improved)
|
||||
* Added an _Admin Overrides_ section with option to choose the order of children in Pages Management
|
||||
1. [](#bugfix)
|
||||
* Fixed loading issues with improperly named themes (use old broken method first) [#1373](https://github.com/getgrav/grav/issues/1373)
|
||||
* Simplified modular/twig processing logic and fixed an issue with system process config [#1351](https://github.com/getgrav/grav/issues/1351)
|
||||
* Cleanup package files via GPM install to make them more windows-friendly [#1361](https://github.com/getgrav/grav/pull/1361)
|
||||
* Fix for page-level debugger override changing the option site-wide
|
||||
* Allow `url()` twig function to pass-through external links
|
||||
|
||||
# v1.2.0-rc.2
|
||||
## 03/17/2017
|
||||
|
||||
1. [](#improved)
|
||||
* Updated vendor libraries to latest
|
||||
* Added the ability to disable debugger on a per-page basis with `debugger: false` in page frontmatter
|
||||
1. [](#bugfix)
|
||||
* Fixed an issue with theme inheritance and hyphenated base themes [#1353](https://github.com/getgrav/grav/issues/1353)
|
||||
* Fixed an issue when trying to use an `@2x` derivative on a non-image media file [#1341](https://github.com/getgrav/grav/issues/1341)
|
||||
|
||||
# v1.2.0-rc.1
|
||||
## 03/13/2017
|
||||
|
||||
1. [](#new)
|
||||
* Added default setting to only allow `direct-installs` from official GPM. Can be configured in `system.yaml`
|
||||
* Added a new `Utils::isValidUrl()` method
|
||||
* Added optional parameter to `|markdown(false)` filter to toggle block/line processing (default|true = `block`)
|
||||
* Added new `Page::folderExists()` method
|
||||
1. [](#improved)
|
||||
* `Twig::evaluate()` now takes current environment and context into account
|
||||
* Genericized `direct-install` so it can be called via Admin plugin
|
||||
1. [](#bugfix)
|
||||
* Fixed a minor bug in Number validation [#1329](https://github.com/getgrav/grav/issues/1329)
|
||||
* Fixed exception when trying to find user account and there is no `user://accounts` folder
|
||||
* Fixed issue when setting `Page::expires(0)` [Admin #1009](https://github.com/getgrav/grav-plugin-admin/issues/1009)
|
||||
* Removed ID from `nonce_field()` Twig function causing validation errors [Form #115](https://github.com/getgrav/grav-plugin-form/issues/115)
|
||||
|
||||
# v1.1.17
|
||||
## 02/17/2017
|
||||
|
||||
1. [](#bugfix)
|
||||
* Fix for double extensions getting added during some redirects [#1307](https://github.com/getgrav/grav/issues/1307)
|
||||
* Fix syntax error in PHP 5.3. Move the version check before requiring the autoloaded deps
|
||||
* Fix Whoops displaying error page if there is PHP core warning or error [Admin #980](https://github.com/getgrav/grav-plugin-admin/issues/980)
|
||||
|
||||
# v1.1.16
|
||||
## 02/10/2017
|
||||
|
||||
1. [](#new)
|
||||
* Exposed the Pages cache ID for use by plugins (e.g. Form) via `Pages::getPagesCacheId()`
|
||||
* Added `Languages::resetFallbackPageExtensions()` regarding [#1276](https://github.com/getgrav/grav/pull/1276)
|
||||
1. [](#improved)
|
||||
* Allowed CLI to use non-volatile cache drivers for better integration with CLI and Web caches
|
||||
* Added Gantry5-compatible query information to Caddy configuration
|
||||
* Added some missing docblocks and type-hints
|
||||
* Various code cleanups (return types, missing variables in doclbocks, etc.)
|
||||
1. [](#bugfix)
|
||||
* Fix blueprints slug validation [https://github.com/getgrav/grav-plugin-admin/issues/955](https://github.com/getgrav/grav-plugin-admin/issues/955)
|
||||
|
||||
# v1.1.15
|
||||
## 01/30/2017
|
||||
|
||||
1. [](#new)
|
||||
* Added a new `Collection::merge()` method to allow merging of multiple collections [#1258](https://github.com/getgrav/grav/pull/1258)
|
||||
* Added [OpenCollective](https://opencollective.com/grav) backer/sponsor info to `README.md`
|
||||
1. [](#improved)
|
||||
* Add an additional parameter to GPM::findPackage to avoid throwing an exception, for use in Twig [#1008](https://github.com/getgrav/grav/issues/1008)
|
||||
* Skip symlinks if found while clearing cache [#1269](https://github.com/getgrav/grav/issues/1269)
|
||||
1. [](#bugfix)
|
||||
* Fixed an issue when page collection with header-based `sort.by` returns an array [#1264](https://github.com/getgrav/grav/issues/1264)
|
||||
* Fix `Response` object to handle `303` redirects when `open_basedir` in effect [#1267](https://github.com/getgrav/grav/issues/1267)
|
||||
* Silence `E_WARNING: Zend OPcache API is restricted by "restrict_api" configuration directive`
|
||||
|
||||
# v1.1.14
|
||||
## 01/18/2017
|
||||
|
||||
1. [](#bugfix)
|
||||
* Fixed `Page::collection()` returning array and not Collection object when header variable did not exist
|
||||
* Revert `Content-Encoding: identity` fix, and let you set `cache: allow_webserver_gzip:` option to switch to `identity` [#548](https://github.com/getgrav/grav/issues/548)
|
||||
|
||||
# v1.1.13
|
||||
## 01/17/2017
|
||||
|
||||
1. [](#new)
|
||||
* Added new `never_cache_twig` page option in `system.yaml` and frontmatter. Allows dynamic Twig logic in regular and modular Twig templates [#1244](https://github.com/getgrav/grav/pull/1244)
|
||||
1. [](#improved)
|
||||
* Several improvements to aid theme development [#232](https://github.com/getgrav/grav/pull/1232)
|
||||
* Added `hash` cache check option and made dropdown more descriptive [Admin #923](https://github.com/getgrav/grav-plugin-admin/issues/923)
|
||||
1. [](#bugfix)
|
||||
* Fixed cross volume file system operations [#635](https://github.com/getgrav/grav/issues/635)
|
||||
* Fix issue with pages folders validation not accepting uppercase letters
|
||||
* Fix renaming the folder name if the page, in the default language, had a custom slug set in its header
|
||||
* Fixed issue with `Content-Encoding: none`. It should really be `Content-Encoding: identity` instead
|
||||
* Fixed broken `hash` method on page modifications detection
|
||||
* Fixed issue with multi-lang pages not caching independently without unique `.md` file [#1211](https://github.com/getgrav/grav/issues/1211)
|
||||
* Fixed all `$_GET` parameters missing in Nginx (please update your nginx.conf) [#1245](https://github.com/getgrav/grav/issues/1245)
|
||||
* Fixed issue in trying to process broken symlink [#1254](https://github.com/getgrav/grav/issues/1254)
|
||||
|
||||
# v1.1.12
|
||||
## 12/26/2016
|
||||
|
||||
1. [](#bugfix)
|
||||
* Fixed issue with JSON calls throwing errors due to debugger enabled [#1227](https://github.com/getgrav/grav/issues/1227)
|
||||
|
||||
# v1.1.11
|
||||
## 12/22/2016
|
||||
|
||||
1. [](#improved)
|
||||
* Fall back properly to HTML if template type not found
|
||||
1. [](#bugfix)
|
||||
* Fix issue with modular pages folders validation [#900](https://github.com/getgrav/grav-plugin-admin/issues/900)
|
||||
|
||||
# v1.1.10
|
||||
## 12/21/2016
|
||||
|
||||
1. [](#improved)
|
||||
* Improve detection of home path. Also allow `~/.grav` on Windows, drop `ConsoleTrait::isWindows()` method, used only for that [#1204](https://github.com/getgrav/grav/pull/1204)
|
||||
* Reworked PHP CLI router [#1219](https://github.com/getgrav/grav/pull/1219)
|
||||
* More robust theme/plugin logic in `bin/gpm direct-install`
|
||||
1. [](#bugfix)
|
||||
* Fixed case where extracting a package would cause an error during rename
|
||||
* Fix issue with using `Yaml::parse` direcly on a filename, now deprecated
|
||||
* Add pattern for frontend validation of folder slugs [#891](https://github.com/getgrav/grav-plugin-admin/issues/891)
|
||||
* Fix issue with Inflector when translation is disabled [SimpleSearch #87](https://github.com/getgrav/grav-plugin-simplesearch/issues/87)
|
||||
* Explicitly expose `array_unique` Twig filter [Admin #897](https://github.com/getgrav/grav-plugin-admin/issues/897)
|
||||
|
||||
# v1.1.9
|
||||
## 12/13/2016
|
||||
|
||||
@@ -44,7 +248,7 @@
|
||||
* Add 2 new language values for French [#1174](https://github.com/getgrav/grav/issues/1174)
|
||||
1. [](#bugfix)
|
||||
* Fixed issue when we have a meta file without corresponding media [#1179](https://github.com/getgrav/grav/issues/1179)
|
||||
* Update class namespace for Admin class [#874](https://github.com/getgrav/grav-plugin-admin/issues/874)
|
||||
* Update class namespace for Admin class [Admin #874](https://github.com/getgrav/grav-plugin-admin/issues/874)
|
||||
|
||||
# v1.1.9-rc.1
|
||||
## 11/09/2016
|
||||
@@ -107,7 +311,7 @@
|
||||
1. [](#bugfix)
|
||||
* Fixed missing `progress` method in the DirectInstall Command
|
||||
* `Response` class now handles better unsuccessful requests such as 404 and 401
|
||||
* Fixed saving of `external` page types [admin #789](https://github.com/getgrav/grav-plugin-admin/issues/789)
|
||||
* Fixed saving of `external` page types [Admin #789](https://github.com/getgrav/grav-plugin-admin/issues/789)
|
||||
* Fixed issue deleting parent folder of folder with `param_sep` in the folder name [admin #796](https://github.com/getgrav/grav-plugin-admin/issues/796)
|
||||
* Fixed an issue with streams in `bin/plugin`
|
||||
* Fixed `jpeg` file format support in Media
|
||||
@@ -912,7 +1116,7 @@
|
||||
* Added new `onImageMediumSaved()` event (useful for post-image processing)
|
||||
* Added `Vary: Accept-Encoding` option
|
||||
2. [](#improved)
|
||||
* Multilang-safe delimeter position
|
||||
* Multilang-safe delimiter position
|
||||
* Refactored Twig classes and added optional umask setting
|
||||
* Removed `pageinit()` timing
|
||||
* `Page->routable()` now takes `published()` state into account
|
||||
|
||||
@@ -110,7 +110,7 @@ Good pull requests - patches, improvements, new features - are a fantastic
|
||||
help. They should remain focused in scope and avoid containing unrelated
|
||||
commits.
|
||||
|
||||
**Please ask first** in Gitter or in the Forum before embarking on any significant pull request (e.g.
|
||||
**Please ask first** in [Slack](https://getgrav.org/slack) or in the Forum before embarking on any significant pull request (e.g.
|
||||
implementing features, refactoring code..),
|
||||
otherwise you risk spending a lot of time working on something that the
|
||||
project's developers might not want to merge into the project.
|
||||
|
||||
99
README.md
99
README.md
@@ -1,6 +1,6 @@
|
||||
#  Grav
|
||||
|
||||
[](https://insight.sensiolabs.com/projects/cfd20465-d0f8-4a0a-8444-467f5b5f16ad) [](https://gitter.im/getgrav/grav?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [](https://travis-ci.org/getgrav/grav)
|
||||
[](https://insight.sensiolabs.com/projects/cfd20465-d0f8-4a0a-8444-467f5b5f16ad) [](https://chat.getgrav.org) [](https://travis-ci.org/getgrav/grav) [](#backers) [](#sponsors)
|
||||
|
||||
Grav is a **Fast**, **Simple**, and **Flexible**, file-based Web-platform. There is **Zero** installation required. Just extract the ZIP archive, and you are already up and running. It follows similar principles to other flat-file CMS platforms, but has a different design philosophy than most. Grav comes with a powerful **Package Management System** to allow for simple installation and upgrading of plugins and themes, as well as simple updating of Grav itself.
|
||||
|
||||
@@ -18,8 +18,8 @@ The underlying architecture of Grav is designed to use well-established and _bes
|
||||
|
||||
# Requirements
|
||||
|
||||
- PHP 5.5.9 or higher. Check the [required modules list](http://learn.getgrav.org/basics/requirements#php-requirements)
|
||||
- Check the [Apache](http://learn.getgrav.org/basics/requirements#apache-requirements) or [IIS](http://learn.getgrav.org/basics/requirements#iis-requirements) requirements
|
||||
- PHP 5.5.9 or higher. Check the [required modules list](https://learn.getgrav.org/basics/requirements#php-requirements)
|
||||
- Check the [Apache](https://learn.getgrav.org/basics/requirements#apache-requirements) or [IIS](https://learn.getgrav.org/basics/requirements#iis-requirements) requirements
|
||||
|
||||
# QuickStart
|
||||
|
||||
@@ -27,7 +27,7 @@ These are the options to get Grav:
|
||||
|
||||
### Downloading a Grav Package
|
||||
|
||||
You can download a **ready-built** package from the [Downloads page on http://getgrav.org](http://getgrav.org/downloads)
|
||||
You can download a **ready-built** package from the [Downloads page on https://getgrav.org](https://getgrav.org/downloads)
|
||||
|
||||
### With Composer
|
||||
|
||||
@@ -45,17 +45,17 @@ $ composer create-project getgrav/grav ~/webroot/grav
|
||||
$ git clone https://github.com/getgrav/grav.git
|
||||
```
|
||||
|
||||
2. Install the **plugin** and **theme dependencies** by using the [Grav CLI application](http://learn.getgrav.org/advanced/grav-cli) `bin/grav`:
|
||||
2. Install the **plugin** and **theme dependencies** by using the [Grav CLI application](https://learn.getgrav.org/advanced/grav-cli) `bin/grav`:
|
||||
```
|
||||
$ cd ~/webroot/grav
|
||||
$ bin/grav install
|
||||
```
|
||||
|
||||
Check out the [install procedures](http://learn.getgrav.org/basics/installation) for more information.
|
||||
Check out the [install procedures](https://learn.getgrav.org/basics/installation) for more information.
|
||||
|
||||
# Adding Functionality
|
||||
|
||||
You can download [plugins](http://getgrav.org/downloads/plugins) or [themes](http://getgrav.org/downloads/themes) manually from the appropriate tab on the [Downloads page on http://getgrav.org](http://getgrav.org/downloads), but the preferred solution is to use the [Grav Package Manager](http://learn.getgrav.org/advanced/grav-gpm) or `GPM`:
|
||||
You can download [plugins](https://getgrav.org/downloads/plugins) or [themes](https://getgrav.org/downloads/themes) manually from the appropriate tab on the [Downloads page on https://getgrav.org](https://getgrav.org/downloads), but the preferred solution is to use the [Grav Package Manager](https://learn.getgrav.org/advanced/grav-gpm) or `GPM`:
|
||||
|
||||
```
|
||||
$ bin/gpm index
|
||||
@@ -69,7 +69,7 @@ $ bin/gpm install <plugin/theme>
|
||||
|
||||
# Updating
|
||||
|
||||
To update Grav you should use the [Grav Package Manager](http://learn.getgrav.org/advanced/grav-gpm) or `GPM`:
|
||||
To update Grav you should use the [Grav Package Manager](https://learn.getgrav.org/advanced/grav-gpm) or `GPM`:
|
||||
|
||||
```
|
||||
$ bin/gpm selfupgrade
|
||||
@@ -97,17 +97,86 @@ What you mainly want to know is that:
|
||||
|
||||
# Getting Started
|
||||
|
||||
* [What is Grav?](http://learn.getgrav.org/basics/what-is-grav)
|
||||
* [Install](http://learn.getgrav.org/basics/installation) Grav in few seconds
|
||||
* Understand the [Configuration](http://learn.getgrav.org/basics/grav-configuration)
|
||||
* Take a peek at our available free [Skeletons](http://getgrav.org/downloads/skeletons)
|
||||
* If you have questions, jump on our [Gitter Room](https://gitter.im/getgrav/grav)!
|
||||
* [What is Grav?](https://learn.getgrav.org/basics/what-is-grav)
|
||||
* [Install](https://learn.getgrav.org/basics/installation) Grav in few seconds
|
||||
* Understand the [Configuration](https://learn.getgrav.org/basics/grav-configuration)
|
||||
* Take a peek at our available free [Skeletons](https://getgrav.org/downloads/skeletons)
|
||||
* If you have questions, jump on our [Slack Room](https://getgrav.org/slack)!
|
||||
* Have fun!
|
||||
|
||||
# Exploring More
|
||||
|
||||
* Have a look at our [Basic Tutorial](http://learn.getgrav.org/basics/basic-tutorial)
|
||||
* Dive into more [advanced](http://learn.getgrav.org/advanced) functions
|
||||
* Have a look at our [Basic Tutorial](https://learn.getgrav.org/basics/basic-tutorial)
|
||||
* Dive into more [advanced](https://learn.getgrav.org/advanced) functions
|
||||
|
||||
# Backers
|
||||
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/grav#backer)]
|
||||
|
||||
<a href="https://opencollective.com/grav/backer/0/website" target="_blank"><img src="https://opencollective.com/grav/backer/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/1/website" target="_blank"><img src="https://opencollective.com/grav/backer/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/2/website" target="_blank"><img src="https://opencollective.com/grav/backer/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/3/website" target="_blank"><img src="https://opencollective.com/grav/backer/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/4/website" target="_blank"><img src="https://opencollective.com/grav/backer/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/5/website" target="_blank"><img src="https://opencollective.com/grav/backer/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/6/website" target="_blank"><img src="https://opencollective.com/grav/backer/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/7/website" target="_blank"><img src="https://opencollective.com/grav/backer/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/8/website" target="_blank"><img src="https://opencollective.com/grav/backer/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/9/website" target="_blank"><img src="https://opencollective.com/grav/backer/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/10/website" target="_blank"><img src="https://opencollective.com/grav/backer/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/11/website" target="_blank"><img src="https://opencollective.com/grav/backer/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/12/website" target="_blank"><img src="https://opencollective.com/grav/backer/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/13/website" target="_blank"><img src="https://opencollective.com/grav/backer/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/14/website" target="_blank"><img src="https://opencollective.com/grav/backer/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/15/website" target="_blank"><img src="https://opencollective.com/grav/backer/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/16/website" target="_blank"><img src="https://opencollective.com/grav/backer/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/17/website" target="_blank"><img src="https://opencollective.com/grav/backer/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/18/website" target="_blank"><img src="https://opencollective.com/grav/backer/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/19/website" target="_blank"><img src="https://opencollective.com/grav/backer/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/20/website" target="_blank"><img src="https://opencollective.com/grav/backer/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/21/website" target="_blank"><img src="https://opencollective.com/grav/backer/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/22/website" target="_blank"><img src="https://opencollective.com/grav/backer/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/23/website" target="_blank"><img src="https://opencollective.com/grav/backer/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/24/website" target="_blank"><img src="https://opencollective.com/grav/backer/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/25/website" target="_blank"><img src="https://opencollective.com/grav/backer/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/26/website" target="_blank"><img src="https://opencollective.com/grav/backer/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/27/website" target="_blank"><img src="https://opencollective.com/grav/backer/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/28/website" target="_blank"><img src="https://opencollective.com/grav/backer/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/backer/29/website" target="_blank"><img src="https://opencollective.com/grav/backer/29/avatar.svg"></a>
|
||||
|
||||
|
||||
# Sponsors
|
||||
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/grav#sponsor)]
|
||||
|
||||
<a href="https://opencollective.com/grav/sponsor/0/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/1/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/2/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/3/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/4/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/5/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/6/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/7/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/8/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/9/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/10/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/11/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/12/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/13/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/14/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/15/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/16/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/17/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/18/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/19/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/20/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/21/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/22/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/23/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/24/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/25/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/26/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/27/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/28/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/grav/sponsor/29/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/29/avatar.svg"></a>
|
||||
|
||||
# License
|
||||
|
||||
|
||||
Binary file not shown.
@@ -8,7 +8,7 @@
|
||||
"require": {
|
||||
"php": ">=5.5.9",
|
||||
"twig/twig": "~1.24",
|
||||
"erusev/parsedown": "dev-master as 1.6.0",
|
||||
"erusev/parsedown": "~1.6",
|
||||
"erusev/parsedown-extra": "~0.7",
|
||||
"symfony/yaml": "~2.8",
|
||||
"symfony/console": "~2.8",
|
||||
@@ -16,10 +16,11 @@
|
||||
"symfony/var-dumper": "~2.8",
|
||||
"symfony/polyfill-iconv": "~1.0",
|
||||
"doctrine/cache": "~1.5",
|
||||
"doctrine/collections": "1.3",
|
||||
"filp/whoops": "~2.0",
|
||||
"matthiasmullie/minify": "^1.3",
|
||||
"monolog/monolog": "~1.0",
|
||||
"gregwar/image": "dev-master#72568cfbeb77515278f2ccb386fc344e874b7ae8",
|
||||
"gregwar/image": "~2.0",
|
||||
"donatj/phpuseragentparser": "~0.3",
|
||||
"pimple/pimple": "~3.0",
|
||||
"rockettheme/toolbox": "~1.0",
|
||||
@@ -29,7 +30,8 @@
|
||||
"ext-curl": "*",
|
||||
"ext-zip": "*",
|
||||
"league/climate": "^3.2",
|
||||
"antoligy/dom-string-iterators": "^1.0"
|
||||
"antoligy/dom-string-iterators": "^1.0",
|
||||
"miljar/php-exif": "^0.6.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"codeception/codeception": "^2.1",
|
||||
|
||||
672
composer.lock
generated
672
composer.lock
generated
File diff suppressed because it is too large
Load Diff
17
index.php
17
index.php
@@ -2,11 +2,12 @@
|
||||
/**
|
||||
* @package Grav.Core
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Grav;
|
||||
define('GRAV_PHP_MIN', '5.5.9');
|
||||
|
||||
// Ensure vendor libraries exist
|
||||
$autoload = __DIR__ . '/vendor/autoload.php';
|
||||
@@ -14,16 +15,22 @@ if (!is_file($autoload)) {
|
||||
die("Please run: <i>bin/grav install</i>");
|
||||
}
|
||||
|
||||
if (PHP_SAPI == 'cli-server') {
|
||||
if (!isset($_SERVER['PHP_CLI_ROUTER'])) {
|
||||
die("PHP webserver requires a router to run Grav, please use: <pre>php -S {$_SERVER["SERVER_NAME"]}:{$_SERVER["SERVER_PORT"]} system/router.php</pre>");
|
||||
}
|
||||
}
|
||||
|
||||
use Grav\Common\Grav;
|
||||
use RocketTheme\Toolbox\Event\Event;
|
||||
|
||||
// Register the auto-loader.
|
||||
$loader = require_once $autoload;
|
||||
|
||||
if (version_compare($ver = PHP_VERSION, $req = GRAV_PHP_MIN, '<')) {
|
||||
die(sprintf('You are running PHP %s, but Grav needs at least <strong>PHP %s</strong> to run.', $ver, $req));
|
||||
}
|
||||
|
||||
// Register the auto-loader.
|
||||
$loader = require_once $autoload;
|
||||
|
||||
// Set timezone to default, falls back to system if php.ini not set
|
||||
date_default_timezone_set(@date_default_timezone_get());
|
||||
|
||||
@@ -44,6 +51,6 @@ $grav = Grav::instance(
|
||||
try {
|
||||
$grav->process();
|
||||
} catch (\Exception $e) {
|
||||
$grav->fireEvent('onFatalException', new Event(['exception' => $e]));
|
||||
$grav->fireEvent('onFatalException', new Event(array('exception' => $e)));
|
||||
throw $e;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,13 @@ form:
|
||||
placeholder: PLUGIN_ADMIN.SITE_TITLE_PLACEHOLDER
|
||||
help: PLUGIN_ADMIN.SITE_TITLE_HELP
|
||||
|
||||
default_lang:
|
||||
type: text
|
||||
label: PLUGIN_ADMIN.SITE_DEFAULT_LANG
|
||||
size: x-small
|
||||
placeholder: PLUGIN_ADMIN.SITE_DEFAULT_LANG_PLACEHOLDER
|
||||
help: PLUGIN_ADMIN.SITE_DEFAULT_LANG_HELP
|
||||
|
||||
author.name:
|
||||
type: text
|
||||
size: large
|
||||
|
||||
@@ -12,12 +12,13 @@ form:
|
||||
fields:
|
||||
home.alias:
|
||||
type: pages
|
||||
size: medium
|
||||
size: large
|
||||
classes: fancy
|
||||
label: PLUGIN_ADMIN.HOME_PAGE
|
||||
show_all: false
|
||||
show_modular: false
|
||||
show_root: false
|
||||
show_slug: true
|
||||
help: PLUGIN_ADMIN.HOME_PAGE_HELP
|
||||
|
||||
home.hide_in_urls:
|
||||
@@ -102,7 +103,7 @@ form:
|
||||
|
||||
pages.order.by:
|
||||
type: select
|
||||
size: long
|
||||
size: large
|
||||
classes: fancy
|
||||
label: PLUGIN_ADMIN.DEFAULT_ORDERING
|
||||
help: PLUGIN_ADMIN.DEFAULT_ORDERING_HELP
|
||||
@@ -155,6 +156,7 @@ form:
|
||||
|
||||
pages.append_url_extension:
|
||||
type: text
|
||||
size: x-small
|
||||
placeholder: "e.g. .html"
|
||||
label: PLUGIN_ADMIN.APPEND_URL_EXT
|
||||
help: PLUGIN_ADMIN.APPEND_URL_EXT_HELP
|
||||
@@ -244,6 +246,17 @@ form:
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
pages.never_cache_twig:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.NEVER_CACHE_TWIG
|
||||
help: PLUGIN_ADMIN.NEVER_CACHE_TWIG_HELP
|
||||
highlight: 0
|
||||
options:
|
||||
1: PLUGIN_ADMIN.YES
|
||||
0: PLUGIN_ADMIN.NO
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
pages.frontmatter.process_twig:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.FRONTMATTER_PROCESS_TWIG
|
||||
@@ -461,14 +474,15 @@ form:
|
||||
|
||||
cache.check.method:
|
||||
type: select
|
||||
size: small
|
||||
size: medium
|
||||
classes: fancy
|
||||
label: PLUGIN_ADMIN.CACHE_CHECK_METHOD
|
||||
help: PLUGIN_ADMIN.CACHE_CHECK_METHOD_HELP
|
||||
options:
|
||||
file: File
|
||||
folder: Folder
|
||||
none: None
|
||||
file: Markdown + Yaml file timestamps
|
||||
folder: Folder timestamps
|
||||
hash: All files timestamps
|
||||
none: No timestamp checking
|
||||
|
||||
cache.driver:
|
||||
type: select
|
||||
@@ -487,6 +501,55 @@ form:
|
||||
wincache: WinCache
|
||||
redis: Redis
|
||||
|
||||
cache.prefix:
|
||||
type: text
|
||||
size: x-small
|
||||
label: PLUGIN_ADMIN.CACHE_PREFIX
|
||||
help: PLUGIN_ADMIN.CACHE_PREFIX_HELP
|
||||
placeholder: PLUGIN_ADMIN.CACHE_PREFIX_PLACEHOLDER
|
||||
|
||||
cache.cli_compatibility:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.CLI_COMPATIBILITY
|
||||
help: PLUGIN_ADMIN.CLI_COMPATIBILITY_HELP
|
||||
highlight: 0
|
||||
options:
|
||||
1: PLUGIN_ADMIN.YES
|
||||
0: PLUGIN_ADMIN.NO
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
cache.lifetime:
|
||||
type: text
|
||||
size: small
|
||||
append: NICETIME.SECOND_PLURAL
|
||||
label: PLUGIN_ADMIN.LIFETIME
|
||||
help: PLUGIN_ADMIN.LIFETIME_HELP
|
||||
validate:
|
||||
type: number
|
||||
|
||||
cache.gzip:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.GZIP_COMPRESSION
|
||||
help: PLUGIN_ADMIN.GZIP_COMPRESSION_HELP
|
||||
highlight: 0
|
||||
options:
|
||||
1: PLUGIN_ADMIN.YES
|
||||
0: PLUGIN_ADMIN.NO
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
cache.allow_webserver_gzip:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.ALLOW_WEBSERVER_GZIP
|
||||
help: PLUGIN_ADMIN.ALLOW_WEBSERVER_GZIP_HELP
|
||||
highlight: 0
|
||||
options:
|
||||
1: PLUGIN_ADMIN.YES
|
||||
0: PLUGIN_ADMIN.NO
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
cache.memcache.server:
|
||||
type: text
|
||||
size: medium
|
||||
@@ -536,32 +599,6 @@ form:
|
||||
help: PLUGIN_ADMIN.REDIS_PORT_HELP
|
||||
placeholder: "6379"
|
||||
|
||||
cache.prefix:
|
||||
type: text
|
||||
size: x-small
|
||||
label: PLUGIN_ADMIN.CACHE_PREFIX
|
||||
help: PLUGIN_ADMIN.CACHE_PREFIX_HELP
|
||||
placeholder: PLUGIN_ADMIN.CACHE_PREFIX_PLACEHOLDER
|
||||
|
||||
cache.lifetime:
|
||||
type: text
|
||||
size: small
|
||||
append: NICETIME.SECOND_PLURAL
|
||||
label: PLUGIN_ADMIN.LIFETIME
|
||||
help: PLUGIN_ADMIN.LIFETIME_HELP
|
||||
validate:
|
||||
type: number
|
||||
|
||||
cache.gzip:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.GZIP_COMPRESSION
|
||||
help: PLUGIN_ADMIN.GZIP_COMPRESSION_HELP
|
||||
highlight: 0
|
||||
options:
|
||||
1: PLUGIN_ADMIN.YES
|
||||
0: PLUGIN_ADMIN.NO
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
twig:
|
||||
type: section
|
||||
@@ -821,13 +858,12 @@ form:
|
||||
|
||||
fields:
|
||||
images.default_image_quality:
|
||||
type: text
|
||||
type: range
|
||||
append: '%'
|
||||
label: PLUGIN_ADMIN.DEFAULT_IMAGE_QUALITY
|
||||
help: PLUGIN_ADMIN.DEFAULT_IMAGE_QUALITY_HELP
|
||||
classes: x-small
|
||||
validate:
|
||||
type: number
|
||||
min: 1
|
||||
max: 100
|
||||
|
||||
@@ -894,6 +930,17 @@ form:
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
media.auto_metadata_exif:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.ENABLE_AUTO_METADATA
|
||||
help: PLUGIN_ADMIN.ENABLE_AUTO_METADATA_HELP
|
||||
highlight: 0
|
||||
options:
|
||||
1: PLUGIN_ADMIN.YES
|
||||
0: PLUGIN_ADMIN.NO
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
|
||||
|
||||
media.allowed_fallback_types:
|
||||
@@ -1022,6 +1069,19 @@ form:
|
||||
fopen: PLUGIN_ADMIN.FOPEN
|
||||
curl: PLUGIN_ADMIN.CURL
|
||||
|
||||
gpm.official_gpm_only:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.GPM_OFFICIAL_ONLY
|
||||
highlight: auto
|
||||
help: PLUGIN_ADMIN.GPM_OFFICIAL_ONLY_HELP
|
||||
highlight: 1
|
||||
options:
|
||||
1: PLUGIN_ADMIN.YES
|
||||
0: PLUGIN_ADMIN.NO
|
||||
default: true
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
gpm.verify_peer:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.GPM_VERIFY_PEER
|
||||
@@ -1044,6 +1104,19 @@ form:
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
username_regex:
|
||||
type: text
|
||||
size: large
|
||||
label: PLUGIN_ADMIN.USERNAME_REGEX
|
||||
help: PLUGIN_ADMIN.USERNAME_REGEX_HELP
|
||||
|
||||
pwd_regex:
|
||||
type: text
|
||||
size: large
|
||||
label: PLUGIN_ADMIN.PWD_REGEX
|
||||
help: PLUGIN_ADMIN.PWD_REGEX_HELP
|
||||
|
||||
|
||||
wrapped_site:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.WRAPPED_SITE
|
||||
@@ -1091,6 +1164,6 @@ form:
|
||||
custom_base_url:
|
||||
type: text
|
||||
size: medium
|
||||
placeholder: "e.g. http://localhost:8080"
|
||||
placeholder: "e.g. http://yoursite.com/yourpath"
|
||||
label: PLUGIN_ADMIN.CUSTOM_BASE_URL
|
||||
help: PLUGIN_ADMIN.CUSTOM_BASE_URL_HELP
|
||||
|
||||
@@ -2,9 +2,9 @@ title: PLUGIN_ADMIN.DEFAULT
|
||||
|
||||
rules:
|
||||
slug:
|
||||
pattern: '[a-zа-я][a-zа-я0-9_\-]+'
|
||||
min: 2
|
||||
max: 80
|
||||
pattern: '[a-zA-Zа-яA-Я0-9_\-]+'
|
||||
min: 1
|
||||
max: 200
|
||||
|
||||
form:
|
||||
validation: loose
|
||||
@@ -117,31 +117,16 @@ form:
|
||||
title: PLUGIN_ADMIN.SETTINGS
|
||||
underline: true
|
||||
|
||||
ordering:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.FOLDER_NUMERIC_PREFIX
|
||||
help: PLUGIN_ADMIN.FOLDER_NUMERIC_PREFIX_HELP
|
||||
highlight: 1
|
||||
options:
|
||||
1: PLUGIN_ADMIN.ENABLED
|
||||
0: PLUGIN_ADMIN.DISABLED
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
folder:
|
||||
type: text
|
||||
label: PLUGIN_ADMIN.FOLDER_NAME
|
||||
validate:
|
||||
type: slug
|
||||
rule: slug
|
||||
|
||||
route:
|
||||
type: select
|
||||
type: parents
|
||||
label: PLUGIN_ADMIN.PARENT
|
||||
classes: fancy
|
||||
data-options@: '\Grav\Common\Page\Pages::parentsRawRoutes'
|
||||
data-default@: '\Grav\Plugin\Admin\Admin::rawRoute'
|
||||
options:
|
||||
'/': PLUGIN_ADMIN.DEFAULT_OPTION_ROOT
|
||||
|
||||
name:
|
||||
type: select
|
||||
@@ -165,9 +150,20 @@ form:
|
||||
title: PLUGIN_ADMIN.ORDERING
|
||||
underline: true
|
||||
|
||||
ordering:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.FOLDER_NUMERIC_PREFIX
|
||||
help: PLUGIN_ADMIN.FOLDER_NUMERIC_PREFIX_HELP
|
||||
highlight: 1
|
||||
options:
|
||||
1: PLUGIN_ADMIN.ENABLED
|
||||
0: PLUGIN_ADMIN.DISABLED
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
order:
|
||||
type: order
|
||||
label: PLUGIN_ADMIN.PAGE_ORDER
|
||||
label: PLUGIN_ADMIN.SORTABLE_PAGES
|
||||
sitemap:
|
||||
|
||||
overrides:
|
||||
@@ -224,6 +220,30 @@ form:
|
||||
twig: Twig
|
||||
use: keys
|
||||
|
||||
header.twig_first:
|
||||
type: toggle
|
||||
toggleable: true
|
||||
label: PLUGIN_ADMIN.TWIG_FIRST
|
||||
help: PLUGIN_ADMIN.TWIG_FIRST_HELP
|
||||
highlight: 0
|
||||
options:
|
||||
1: PLUGIN_ADMIN.YES
|
||||
0: PLUGIN_ADMIN.NO
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
header.never_cache_twig:
|
||||
type: toggle
|
||||
toggleable: true
|
||||
label: PLUGIN_ADMIN.NEVER_CACHE_TWIG
|
||||
help: PLUGIN_ADMIN.NEVER_CACHE_TWIG_HELP
|
||||
highlight: 0
|
||||
options:
|
||||
1: PLUGIN_ADMIN.YES
|
||||
0: PLUGIN_ADMIN.NO
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
header.child_type:
|
||||
type: select
|
||||
toggleable: true
|
||||
@@ -267,6 +287,18 @@ form:
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
header.debugger:
|
||||
type: toggle
|
||||
toggleable: true
|
||||
label: PLUGIN_ADMIN.DEBUGGER
|
||||
help: PLUGIN_ADMIN.DEBUGGER_HELP
|
||||
highlight: 1
|
||||
options:
|
||||
1: PLUGIN_ADMIN.ENABLED
|
||||
0: PLUGIN_ADMIN.DISABLED
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
header.template:
|
||||
type: text
|
||||
toggleable: true
|
||||
@@ -278,6 +310,25 @@ form:
|
||||
toggleable: true
|
||||
help: PLUGIN_ADMIN.APPEND_URL_EXT_HELP
|
||||
|
||||
admin_only:
|
||||
type: section
|
||||
title: PLUGIN_ADMIN.ADMIN_SPECIFIC_OVERRIDES
|
||||
underline: true
|
||||
|
||||
fields:
|
||||
|
||||
header.admin.children_display_order:
|
||||
type: select
|
||||
label: PLUGIN_ADMIN.ADMIN_CHILDREN_DISPLAY_ORDER
|
||||
help: PLUGIN_ADMIN.ADMIN_CHILDREN_DISPLAY_ORDER_HELP
|
||||
toggleable: true
|
||||
classes: fancy
|
||||
default: 'collection'
|
||||
options:
|
||||
'default': 'Ordered by Folder name (default)'
|
||||
'collection': 'Ordered by Collection definition'
|
||||
|
||||
|
||||
header.order_by:
|
||||
type: hidden
|
||||
|
||||
|
||||
@@ -3,12 +3,6 @@ title: PLUGIN_ADMIN:EXTERNAL
|
||||
type: default
|
||||
context: blueprints://pages
|
||||
|
||||
rules:
|
||||
slug:
|
||||
pattern: '[a-zа-я][a-zа-я0-9_\-]+'
|
||||
min: 2
|
||||
max: 80
|
||||
|
||||
form:
|
||||
validation: loose
|
||||
fields:
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
rules:
|
||||
slug:
|
||||
pattern: '[a-z][a-z0-9_\-]+'
|
||||
min: 2
|
||||
max: 80
|
||||
|
||||
form:
|
||||
validation: loose
|
||||
fields:
|
||||
|
||||
section:
|
||||
type: section
|
||||
title: PLUGIN_ADMIN.ADD_MODULAR_CONTENT
|
||||
|
||||
title:
|
||||
type: text
|
||||
label: PLUGIN_ADMIN.PAGE_TITLE
|
||||
validate:
|
||||
required: true
|
||||
|
||||
folder:
|
||||
type: text
|
||||
label: PLUGIN_ADMIN.FOLDER_NAME
|
||||
validate:
|
||||
type: slug
|
||||
required: true
|
||||
|
||||
route:
|
||||
type: select
|
||||
label: PLUGIN_ADMIN.PAGE
|
||||
classes: fancy
|
||||
data-options@: '\Grav\Common\Page\Pages::parentsRawRoutes'
|
||||
data-default@: '\Grav\Plugin\Admin\Admin::rawRoute'
|
||||
validate:
|
||||
required: true
|
||||
|
||||
name:
|
||||
type: select
|
||||
classes: fancy
|
||||
label: PLUGIN_ADMIN.MODULAR_TEMPLATE
|
||||
help: PLUGIN_ADMIN.PAGE_FILE_HELP
|
||||
default: default
|
||||
data-options@: '\Grav\Common\Page\Pages::modularTypes'
|
||||
validate:
|
||||
required: true
|
||||
|
||||
modular:
|
||||
type: hidden
|
||||
default: 1
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
blueprint:
|
||||
type: blueprint
|
||||
@@ -1,106 +0,0 @@
|
||||
rules:
|
||||
slug:
|
||||
pattern: '[a-z][a-z0-9_\-]+'
|
||||
min: 2
|
||||
max: 80
|
||||
|
||||
form:
|
||||
validation: loose
|
||||
fields:
|
||||
|
||||
tabs:
|
||||
type: tabs
|
||||
active: 1
|
||||
|
||||
fields:
|
||||
content:
|
||||
type: tab
|
||||
title: PLUGIN_ADMIN.CONTENT
|
||||
|
||||
fields:
|
||||
frontmatter:
|
||||
classes: frontmatter
|
||||
type: editor
|
||||
label: PLUGIN_ADMIN.FRONTMATTER
|
||||
autofocus: true
|
||||
codemirror:
|
||||
mode: 'yaml'
|
||||
indentUnit: 4
|
||||
autofocus: true
|
||||
indentWithTabs: false
|
||||
lineNumbers: true
|
||||
styleActiveLine: true
|
||||
gutters: ['CodeMirror-lint-markers']
|
||||
lint: true
|
||||
|
||||
content:
|
||||
type: markdown
|
||||
|
||||
uploads:
|
||||
type: pagemedia
|
||||
label: PLUGIN_ADMIN.PAGE_MEDIA
|
||||
|
||||
|
||||
options:
|
||||
type: tab
|
||||
title: PLUGIN_ADMIN.OPTIONS
|
||||
|
||||
fields:
|
||||
|
||||
columns:
|
||||
type: columns
|
||||
|
||||
fields:
|
||||
column1:
|
||||
type: column
|
||||
|
||||
fields:
|
||||
|
||||
ordering:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.FOLDER_NUMERIC_PREFIX
|
||||
help: PLUGIN_ADMIN.FOLDER_NUMERIC_PREFIX_HELP
|
||||
highlight: 1
|
||||
options:
|
||||
1: PLUGIN_ADMIN.ENABLED
|
||||
0: PLUGIN_ADMIN.DISABLED
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
folder:
|
||||
type: text
|
||||
label: PLUGIN_ADMIN.FILENAME
|
||||
validate:
|
||||
type: slug
|
||||
required: true
|
||||
|
||||
route:
|
||||
type: select
|
||||
label: PLUGIN_ADMIN.PARENT
|
||||
classes: fancy
|
||||
data-options@: '\Grav\Common\Page\Pages::parentsRawRoutes'
|
||||
data-default@: '\Grav\Plugin\Admin\Admin::rawRoute'
|
||||
options:
|
||||
'': PLUGIN_ADMIN.DEFAULT_OPTION_SELECT
|
||||
validate:
|
||||
required: true
|
||||
|
||||
name:
|
||||
type: select
|
||||
classes: fancy
|
||||
label: PLUGIN_ADMIN.MODULAR_TEMPLATE
|
||||
default: default
|
||||
data-options@: '\Grav\Common\Page\Pages::modularTypes'
|
||||
validate:
|
||||
required: true
|
||||
|
||||
column2:
|
||||
type: column
|
||||
|
||||
fields:
|
||||
order:
|
||||
type: order
|
||||
label: PLUGIN_ADMIN.ORDERING
|
||||
|
||||
blueprint:
|
||||
type: blueprint
|
||||
@@ -1,17 +0,0 @@
|
||||
rules:
|
||||
slug:
|
||||
pattern: '[a-z][a-z0-9_\-]+'
|
||||
min: 2
|
||||
max: 80
|
||||
|
||||
form:
|
||||
validation: loose
|
||||
fields:
|
||||
route:
|
||||
type: select
|
||||
label: PLUGIN_ADMIN.PARENT
|
||||
classes: fancy
|
||||
data-options@: '\Grav\Common\Page\Pages::parentsRawRoutes'
|
||||
data-default@: '\Grav\Plugin\Admin\Admin::rawRoute'
|
||||
options:
|
||||
'/': PLUGIN_ADMIN.DEFAULT_OPTION_ROOT
|
||||
@@ -1,66 +0,0 @@
|
||||
rules:
|
||||
slug:
|
||||
pattern: '[a-z][a-z0-9_\-]+'
|
||||
min: 2
|
||||
max: 80
|
||||
|
||||
form:
|
||||
validation: loose
|
||||
fields:
|
||||
|
||||
section:
|
||||
type: section
|
||||
title: PLUGIN_ADMIN.ADD_PAGE
|
||||
|
||||
title:
|
||||
type: text
|
||||
label: PLUGIN_ADMIN.PAGE_TITLE
|
||||
help: PLUGIN_ADMIN.PAGE_TITLE_HELP
|
||||
validate:
|
||||
required: true
|
||||
|
||||
folder:
|
||||
type: text
|
||||
label: PLUGIN_ADMIN.FOLDER_NAME
|
||||
help: PLUGIN_ADMIN.FOLDER_NAME_HELP
|
||||
validate:
|
||||
type: slug
|
||||
required: true
|
||||
|
||||
route:
|
||||
type: select
|
||||
label: PLUGIN_ADMIN.PARENT_PAGE
|
||||
classes: fancy
|
||||
data-options@: '\Grav\Common\Page\Pages::parentsRawRoutes'
|
||||
data-default@: '\Grav\Plugin\Admin\Admin::getLastPageRoute'
|
||||
options:
|
||||
'/': PLUGIN_ADMIN.DEFAULT_OPTION_ROOT
|
||||
validate:
|
||||
required: true
|
||||
|
||||
name:
|
||||
type: select
|
||||
classes: fancy
|
||||
label: PLUGIN_ADMIN.PAGE_FILE
|
||||
help: PLUGIN_ADMIN.PAGE_FILE_HELP
|
||||
data-options@: '\Grav\Common\Page\Pages::types'
|
||||
data-default@: '\Grav\Plugin\Admin\Admin::getLastPageName'
|
||||
validate:
|
||||
required: true
|
||||
|
||||
visible:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.VISIBLE
|
||||
help: PLUGIN_ADMIN.VISIBLE_HELP
|
||||
highlight: ''
|
||||
default: ''
|
||||
options:
|
||||
'': Auto
|
||||
1: PLUGIN_ADMIN.YES
|
||||
0: PLUGIN_ADMIN.NO
|
||||
validate:
|
||||
type: bool
|
||||
required: true
|
||||
|
||||
blueprint:
|
||||
type: blueprint
|
||||
@@ -1,35 +0,0 @@
|
||||
rules:
|
||||
slug:
|
||||
pattern: '[a-z][a-z0-9_\-]+'
|
||||
min: 2
|
||||
max: 80
|
||||
|
||||
form:
|
||||
validation: loose
|
||||
fields:
|
||||
|
||||
section:
|
||||
type: section
|
||||
title: PLUGIN_ADMIN.ADD_FOLDER
|
||||
|
||||
folder:
|
||||
type: text
|
||||
label: PLUGIN_ADMIN.FOLDER_NAME
|
||||
help: PLUGIN_ADMIN.FOLDER_NAME_HELP
|
||||
validate:
|
||||
type: slug
|
||||
required: true
|
||||
|
||||
route:
|
||||
type: select
|
||||
label: PLUGIN_ADMIN.PARENT_PAGE
|
||||
classes: fancy
|
||||
data-options@: '\Grav\Common\Page\Pages::parentsRawRoutes'
|
||||
data-default@: '\Grav\Plugin\Admin\Admin::getLastPageRoute'
|
||||
options:
|
||||
'/': PLUGIN_ADMIN.DEFAULT_OPTION_ROOT
|
||||
validate:
|
||||
required: true
|
||||
|
||||
blueprint:
|
||||
type: blueprint
|
||||
@@ -1,105 +0,0 @@
|
||||
rules:
|
||||
slug:
|
||||
pattern: '[a-z][a-z0-9_\-]+'
|
||||
min: 2
|
||||
max: 80
|
||||
|
||||
form:
|
||||
validation: loose
|
||||
fields:
|
||||
|
||||
tabs:
|
||||
type: tabs
|
||||
active: 1
|
||||
|
||||
fields:
|
||||
content:
|
||||
type: tab
|
||||
title: PLUGIN_ADMIN.CONTENT
|
||||
|
||||
fields:
|
||||
frontmatter:
|
||||
classes: frontmatter
|
||||
type: editor
|
||||
label: PLUGIN_ADMIN.FRONTMATTER
|
||||
autofocus: true
|
||||
codemirror:
|
||||
mode: 'yaml'
|
||||
indentUnit: 4
|
||||
autofocus: true
|
||||
indentWithTabs: false
|
||||
lineNumbers: true
|
||||
styleActiveLine: true
|
||||
gutters: ['CodeMirror-lint-markers']
|
||||
lint: true
|
||||
|
||||
content:
|
||||
type: markdown
|
||||
|
||||
uploads:
|
||||
type: pagemedia
|
||||
label: PLUGIN_ADMIN.PAGE_MEDIA
|
||||
|
||||
options:
|
||||
type: tab
|
||||
title: PLUGIN_ADMIN.OPTIONS
|
||||
|
||||
fields:
|
||||
|
||||
columns:
|
||||
type: columns
|
||||
|
||||
fields:
|
||||
column1:
|
||||
type: column
|
||||
|
||||
fields:
|
||||
|
||||
ordering:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.FOLDER_NUMERIC_PREFIX
|
||||
help: PLUGIN_ADMIN.FOLDER_NUMERIC_PREFIX_HELP
|
||||
highlight: 1
|
||||
options:
|
||||
1: PLUGIN_ADMIN.ENABLED
|
||||
0: PLUGIN_ADMIN.DISABLED
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
folder:
|
||||
type: text
|
||||
label: PLUGIN_ADMIN.FOLDER_NAME
|
||||
help: PLUGIN_ADMIN.FOLDER_NAME_HELP
|
||||
validate:
|
||||
type: slug
|
||||
required: true
|
||||
|
||||
route:
|
||||
type: select
|
||||
label: PLUGIN_ADMIN.PARENT
|
||||
classes: fancy
|
||||
data-options@: '\Grav\Common\Page\Pages::parentsRawRoutes'
|
||||
data-default@: '\Grav\Plugin\Admin\Admin::rawRoute'
|
||||
options:
|
||||
'/': PLUGIN_ADMIN.DEFAULT_OPTION_ROOT
|
||||
|
||||
name:
|
||||
type: select
|
||||
classes: fancy
|
||||
label: PLUGIN_ADMIN.DISPLAY_TEMPLATE
|
||||
help: PLUGIN_ADMIN.DISPLAY_TEMPLATE_HELP
|
||||
default: default
|
||||
data-options@: '\Grav\Common\Page\Pages::types'
|
||||
validate:
|
||||
required: true
|
||||
|
||||
column2:
|
||||
type: column
|
||||
|
||||
fields:
|
||||
order:
|
||||
type: order
|
||||
label: PLUGIN_ADMIN.ORDERING
|
||||
|
||||
blueprint:
|
||||
type: blueprint
|
||||
@@ -8,12 +8,18 @@ form:
|
||||
type: userinfo
|
||||
size: large
|
||||
|
||||
avatar:
|
||||
type: file
|
||||
size: large
|
||||
destination: 'user://accounts/avatars'
|
||||
multiple: false
|
||||
random_name: true
|
||||
|
||||
content:
|
||||
type: section
|
||||
title: PLUGIN_ADMIN.ACCOUNT
|
||||
underline: true
|
||||
|
||||
|
||||
username:
|
||||
type: text
|
||||
size: large
|
||||
@@ -37,7 +43,7 @@ form:
|
||||
validate:
|
||||
required: false
|
||||
message: PLUGIN_ADMIN.PASSWORD_VALIDATION_MESSAGE
|
||||
pattern: '(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}'
|
||||
config-pattern@: system.pwd_regex
|
||||
|
||||
fullname:
|
||||
type: text
|
||||
@@ -68,10 +74,11 @@ form:
|
||||
|
||||
fields:
|
||||
groups:
|
||||
type: selectize
|
||||
type: select
|
||||
multiple: true
|
||||
size: large
|
||||
label: PLUGIN_ADMIN.GROUPS
|
||||
data-options@: '\Grav\User\Groups::groups'
|
||||
data-options@: '\Grav\Common\User\Group::groupNames'
|
||||
classes: fancy
|
||||
help: PLUGIN_ADMIN.GROUPS_HELP
|
||||
validate:
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
title: Grav # Name of the site
|
||||
default_lang: en # Default language for site (potentially used by theme)
|
||||
|
||||
author:
|
||||
name: John Appleseed # Default author name
|
||||
|
||||
@@ -1,137 +1,144 @@
|
||||
absolute_urls: false # Absolute or relative URLs for `base_url`
|
||||
timezone: '' # Valid values: http://php.net/manual/en/timezones.php
|
||||
default_locale: # Default locale (defaults to system)
|
||||
param_sep: ':' # Parameter separator, use ';' for Apache on windows
|
||||
wrapped_site: false # For themes/plugins to know if Grav is wrapped by another platform
|
||||
reverse_proxy_setup: false # Running in a reverse proxy scenario with different webserver ports than proxy
|
||||
force_ssl: false # If enabled, Grav forces to be accessed via HTTPS (NOTE: Not an ideal solution)
|
||||
custom_base_url: '' # Set the base_url manually
|
||||
absolute_urls: false # Absolute or relative URLs for `base_url`
|
||||
timezone: '' # Valid values: http://php.net/manual/en/timezones.php
|
||||
default_locale: # Default locale (defaults to system)
|
||||
param_sep: ':' # Parameter separator, use ';' for Apache on windows
|
||||
wrapped_site: false # For themes/plugins to know if Grav is wrapped by another platform
|
||||
reverse_proxy_setup: false # Running in a reverse proxy scenario with different webserver ports than proxy
|
||||
force_ssl: false # If enabled, Grav forces to be accessed via HTTPS (NOTE: Not an ideal solution)
|
||||
custom_base_url: '' # Set the base_url manually, e.g. http://yoursite.com/yourpath
|
||||
username_regex: '^[a-z0-9_-]{3,16}$' # Only lowercase chars, digits, dashes, underscores. 3 - 16 chars
|
||||
pwd_regex: '(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}' # At least one number, one uppercase and lowercase letter, and be at least 8+ chars
|
||||
|
||||
languages:
|
||||
supported: [] # List of languages supported. eg: [en, fr, de]
|
||||
include_default_lang: true # Include the default lang prefix in all URLs
|
||||
translations: true # Enable translations by default
|
||||
translations_fallback: true # Fallback through supported translations if active lang doesn't exist
|
||||
session_store_active: false # Store active language in session
|
||||
http_accept_language: false # Attempt to set the language based on http_accept_language header in the browser
|
||||
override_locale: false # Override the default or system locale with language specific one
|
||||
supported: [] # List of languages supported. eg: [en, fr, de]
|
||||
include_default_lang: true # Include the default lang prefix in all URLs
|
||||
translations: true # Enable translations by default
|
||||
translations_fallback: true # Fallback through supported translations if active lang doesn't exist
|
||||
session_store_active: false # Store active language in session
|
||||
http_accept_language: false # Attempt to set the language based on http_accept_language header in the browser
|
||||
override_locale: false # Override the default or system locale with language specific one
|
||||
|
||||
home:
|
||||
alias: '/home' # Default path for home, ie /
|
||||
hide_in_urls: false # Hide the home route in URLs
|
||||
alias: '/home' # Default path for home, ie /
|
||||
hide_in_urls: false # Hide the home route in URLs
|
||||
|
||||
pages:
|
||||
theme: antimatter # Default theme (defaults to "antimatter" theme)
|
||||
theme: antimatter # Default theme (defaults to "antimatter" theme)
|
||||
order:
|
||||
by: default # Order pages by "default", "alpha" or "date"
|
||||
dir: asc # Default ordering direction, "asc" or "desc"
|
||||
by: default # Order pages by "default", "alpha" or "date"
|
||||
dir: asc # Default ordering direction, "asc" or "desc"
|
||||
list:
|
||||
count: 20 # Default item count per page
|
||||
count: 20 # Default item count per page
|
||||
dateformat:
|
||||
default: # The default date format Grav expects in the `date: ` field
|
||||
short: 'jS M Y' # Short date format
|
||||
long: 'F jS \a\t g:ia' # Long date format
|
||||
publish_dates: true # automatically publish/unpublish based on dates
|
||||
default: # The default date format Grav expects in the `date: ` field
|
||||
short: 'jS M Y' # Short date format
|
||||
long: 'F jS \a\t g:ia' # Long date format
|
||||
publish_dates: true # automatically publish/unpublish based on dates
|
||||
process:
|
||||
markdown: true # Process Markdown
|
||||
twig: false # Process Twig
|
||||
twig_first: false # Process Twig before markdown when processing both on a page
|
||||
markdown: true # Process Markdown
|
||||
twig: false # Process Twig
|
||||
twig_first: false # Process Twig before markdown when processing both on a page
|
||||
never_cache_twig: false # Only cache content, never cache twig processed in content (incompatible with `twig_first: true`)
|
||||
events:
|
||||
page: true # Enable page level events
|
||||
twig: true # Enable Twig level events
|
||||
page: true # Enable page level events
|
||||
twig: true # Enable Twig level events
|
||||
markdown:
|
||||
extra: false # Enable support for Markdown Extra support (GFM by default)
|
||||
auto_line_breaks: false # Enable automatic line breaks
|
||||
auto_url_links: false # Enable automatic HTML links
|
||||
escape_markup: false # Escape markup tags into entities
|
||||
special_chars: # List of special characters to automatically convert to entities
|
||||
extra: false # Enable support for Markdown Extra support (GFM by default)
|
||||
auto_line_breaks: false # Enable automatic line breaks
|
||||
auto_url_links: false # Enable automatic HTML links
|
||||
escape_markup: false # Escape markup tags into entities
|
||||
special_chars: # List of special characters to automatically convert to entities
|
||||
'>': 'gt'
|
||||
'<': 'lt'
|
||||
types: [txt,xml,html,htm,json,rss,atom] # list of valid page types
|
||||
append_url_extension: '' # Append page's extension in Page urls (e.g. '.html' results in /path/page.html)
|
||||
expires: 604800 # Page expires time in seconds (604800 seconds = 7 days)
|
||||
last_modified: false # Set the last modified date header based on file modifcation timestamp
|
||||
etag: false # Set the etag header tag
|
||||
vary_accept_encoding: false # Add `Vary: Accept-Encoding` header
|
||||
redirect_default_route: false # Automatically redirect to a page's default route
|
||||
redirect_default_code: 301 # Default code to use for redirects
|
||||
redirect_trailing_slash: true # Handle automatically or 301 redirect a trailing / URL
|
||||
ignore_files: [.DS_Store] # Files to ignore in Pages
|
||||
ignore_folders: [.git, .idea] # Folders to ignore in Pages
|
||||
ignore_hidden: true # Ignore all Hidden files and folders
|
||||
url_taxonomy_filters: true # Enable auto-magic URL-based taxonomy filters for page collections
|
||||
types: [txt,xml,html,htm,json,rss,atom] # list of valid page types
|
||||
append_url_extension: '' # Append page's extension in Page urls (e.g. '.html' results in /path/page.html)
|
||||
expires: 604800 # Page expires time in seconds (604800 seconds = 7 days)
|
||||
last_modified: false # Set the last modified date header based on file modification timestamp
|
||||
etag: false # Set the etag header tag
|
||||
vary_accept_encoding: false # Add `Vary: Accept-Encoding` header
|
||||
redirect_default_route: false # Automatically redirect to a page's default route
|
||||
redirect_default_code: 301 # Default code to use for redirects
|
||||
redirect_trailing_slash: true # Handle automatically or 301 redirect a trailing / URL
|
||||
ignore_files: [.DS_Store] # Files to ignore in Pages
|
||||
ignore_folders: [.git, .idea] # Folders to ignore in Pages
|
||||
ignore_hidden: true # Ignore all Hidden files and folders
|
||||
url_taxonomy_filters: true # Enable auto-magic URL-based taxonomy filters for page collections
|
||||
frontmatter:
|
||||
process_twig: false # Should the frontmatter be processed to replace Twig variables?
|
||||
ignore_fields: ['form','forms'] # Fields that might contain Twig variables and should not be processed
|
||||
process_twig: false # Should the frontmatter be processed to replace Twig variables?
|
||||
ignore_fields: ['form','forms'] # Fields that might contain Twig variables and should not be processed
|
||||
|
||||
cache:
|
||||
enabled: true # Set to true to enable caching
|
||||
enabled: true # Set to true to enable caching
|
||||
check:
|
||||
method: file # Method to check for updates in pages: file|folder|hash|none
|
||||
driver: auto # One of: auto|file|apc|xcache|memcache|wincache
|
||||
prefix: 'g' # Cache prefix string (prevents cache conflicts)
|
||||
lifetime: 604800 # Lifetime of cached data in seconds (0 = infinite)
|
||||
gzip: false # GZip compress the page output
|
||||
method: file # Method to check for updates in pages: file|folder|hash|none
|
||||
driver: auto # One of: auto|file|apc|xcache|memcache|wincache
|
||||
prefix: 'g' # Cache prefix string (prevents cache conflicts)
|
||||
cli_compatibility: false # Ensures only non-volatile drivers are used (file, redis, memcache, etc.)
|
||||
lifetime: 604800 # Lifetime of cached data in seconds (0 = infinite)
|
||||
gzip: false # GZip compress the page output
|
||||
allow_webserver_gzip: false # If true, `content-encoding: identity` but connection isn't closed before `onShutDown()` event
|
||||
redis:
|
||||
socket: false # Path to redis unix socket (e.g. /var/run/redis/redis.sock), false = use server and port to connect
|
||||
socket: false # Path to redis unix socket (e.g. /var/run/redis/redis.sock), false = use server and port to connect
|
||||
|
||||
twig:
|
||||
cache: true # Set to true to enable Twig caching
|
||||
debug: true # Enable Twig debug
|
||||
auto_reload: true # Refresh cache on changes
|
||||
autoescape: false # Autoescape Twig vars
|
||||
undefined_functions: true # Allow undefined functions
|
||||
undefined_filters: true # Allow undefined filters
|
||||
umask_fix: false # By default Twig creates cached files as 755, fix switches this to 775
|
||||
cache: true # Set to true to enable Twig caching
|
||||
debug: true # Enable Twig debug
|
||||
auto_reload: true # Refresh cache on changes
|
||||
autoescape: false # Autoescape Twig vars
|
||||
undefined_functions: true # Allow undefined functions
|
||||
undefined_filters: true # Allow undefined filters
|
||||
umask_fix: false # By default Twig creates cached files as 755, fix switches this to 775
|
||||
|
||||
assets: # Configuration for Assets Manager (JS, CSS)
|
||||
css_pipeline: false # The CSS pipeline is the unification of multiple CSS resources into one file
|
||||
css_pipeline_include_externals: true # Include external URLs in the pipeline by default
|
||||
css_pipeline_before_excludes: true # Render the pipeline before any excluded files
|
||||
css_minify: true # Minify the CSS during pipelining
|
||||
css_minify_windows: false # Minify Override for Windows platforms. False by default due to ThreadStackSize
|
||||
css_rewrite: true # Rewrite any CSS relative URLs during pipelining
|
||||
js_pipeline: false # The JS pipeline is the unification of multiple JS resources into one file
|
||||
js_pipeline_include_externals: true # Include external URLs in the pipeline by default
|
||||
js_pipeline_before_excludes: true # Render the pipeline before any excluded files
|
||||
js_minify: true # Minify the JS during pipelining
|
||||
enable_asset_timestamp: false # Enable asset timestamps
|
||||
assets: # Configuration for Assets Manager (JS, CSS)
|
||||
css_pipeline: false # The CSS pipeline is the unification of multiple CSS resources into one file
|
||||
css_pipeline_include_externals: true # Include external URLs in the pipeline by default
|
||||
css_pipeline_before_excludes: true # Render the pipeline before any excluded files
|
||||
css_minify: true # Minify the CSS during pipelining
|
||||
css_minify_windows: false # Minify Override for Windows platforms. False by default due to ThreadStackSize
|
||||
css_rewrite: true # Rewrite any CSS relative URLs during pipelining
|
||||
js_pipeline: false # The JS pipeline is the unification of multiple JS resources into one file
|
||||
js_pipeline_include_externals: true # Include external URLs in the pipeline by default
|
||||
js_pipeline_before_excludes: true # Render the pipeline before any excluded files
|
||||
js_minify: true # Minify the JS during pipelining
|
||||
enable_asset_timestamp: false # Enable asset timestamps
|
||||
collections:
|
||||
jquery: system://assets/jquery/jquery-2.x.min.js
|
||||
|
||||
errors:
|
||||
display: 0 # Display either (1) Full backtrace | (0) Simple Error | (-1) System Error
|
||||
log: true # Log errors to /logs folder
|
||||
display: 0 # Display either (1) Full backtrace | (0) Simple Error | (-1) System Error
|
||||
log: true # Log errors to /logs folder
|
||||
|
||||
debugger:
|
||||
enabled: false # Enable Grav debugger and following settings
|
||||
enabled: false # Enable Grav debugger and following settings
|
||||
shutdown:
|
||||
close_connection: true # Close the connection before calling onShutdown(). false for debugging
|
||||
close_connection: true # Close the connection before calling onShutdown(). false for debugging
|
||||
|
||||
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
|
||||
auto_fix_orientation: false # Automatically fix the image orientation based on the Exif data
|
||||
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
|
||||
auto_fix_orientation: false # Automatically fix the image orientation based on the Exif data
|
||||
|
||||
media:
|
||||
enable_media_timestamp: false # Enable media timetsamps
|
||||
upload_limit: 0 # Set maximum upload size in bytes (0 is unlimited)
|
||||
unsupported_inline_types: [] # Array of supported media types to try to display inline
|
||||
allowed_fallback_types: [] # Array of allowed media types of files found if accessed via Page route
|
||||
enable_media_timestamp: false # Enable media timestamps
|
||||
upload_limit: 0 # Set maximum upload size in bytes (0 is unlimited)
|
||||
unsupported_inline_types: [] # Array of supported media types to try to display inline
|
||||
allowed_fallback_types: [] # Array of allowed media types of files found if accessed via Page route
|
||||
auto_metadata_exif: false # Automatically create metadata files from Exif data where possible
|
||||
|
||||
session:
|
||||
enabled: true # Enable Session support
|
||||
timeout: 1800 # Timeout in seconds
|
||||
name: grav-site # Name prefix of the session cookie. Use alphanumeric, dashes or underscores only. Do not use dots in the session name
|
||||
secure: false # Set session secure. If true, indicates that communication for this cookie must be over an encrypted transmission. Enable this only on sites that run exclusively on HTTPS
|
||||
httponly: true # Set session HTTP only. If true, indicates that cookies should be used only over HTTP, and JavaScript modification is not allowed.
|
||||
split: true # Sessions should be independent between site and plugins (such as admin)
|
||||
enabled: true # Enable Session support
|
||||
timeout: 1800 # Timeout in seconds
|
||||
name: grav-site # Name prefix of the session cookie. Use alphanumeric, dashes or underscores only. Do not use dots in the session name
|
||||
secure: false # Set session secure. If true, indicates that communication for this cookie must be over an encrypted transmission. Enable this only on sites that run exclusively on HTTPS
|
||||
httponly: true # Set session HTTP only. If true, indicates that cookies should be used only over HTTP, and JavaScript modification is not allowed.
|
||||
split: true # Sessions should be independent between site and plugins (such as admin)
|
||||
path:
|
||||
|
||||
gpm:
|
||||
releases: stable # Set to either 'stable' or 'testing'
|
||||
proxy_url: # Configure a manual proxy URL for GPM (eg 127.0.0.1:3128)
|
||||
method: 'auto' # Either 'curl', 'fopen' or 'auto'. 'auto' will try fopen first and if not available cURL
|
||||
verify_peer: true # Sometimes on some systems (Windows most commonly) GPM is unable to connect because the SSL certificate cannot be verified. Disabling this setting might help.
|
||||
releases: stable # Set to either 'stable' or 'testing'
|
||||
proxy_url: # Configure a manual proxy URL for GPM (eg 127.0.0.1:3128)
|
||||
method: 'auto' # Either 'curl', 'fopen' or 'auto'. 'auto' will try fopen first and if not available cURL
|
||||
verify_peer: true # Sometimes on some systems (Windows most commonly) GPM is unable to connect because the SSL certificate cannot be verified. Disabling this setting might help.
|
||||
official_gpm_only: true # By default GPM direct-install will only allow URLs via the official GPM proxy to ensure security
|
||||
|
||||
@@ -2,16 +2,19 @@
|
||||
/**
|
||||
* @package Grav.Core
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
// Some standard defines
|
||||
define('GRAV', true);
|
||||
define('GRAV_VERSION', '1.1.9');
|
||||
define('GRAV_TESTING', false);
|
||||
define('GRAV_VERSION', '1.3.0-rc.1');
|
||||
define('GRAV_TESTING', true);
|
||||
define('DS', '/');
|
||||
define('GRAV_PHP_MIN', '5.5.9');
|
||||
|
||||
if (!defined('GRAV_PHP_MIN')) {
|
||||
define('GRAV_PHP_MIN', '5.5.9');
|
||||
}
|
||||
|
||||
// Directories and Paths
|
||||
if (!defined('GRAV_ROOT')) {
|
||||
|
||||
26
system/router.php
Normal file
26
system/router.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Grav.Core
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
if (PHP_SAPI !== 'cli-server') {
|
||||
exit('This script cannot be run from browser. Run it from a CLI.');
|
||||
}
|
||||
|
||||
$_SERVER['PHP_CLI_ROUTER'] = true;
|
||||
|
||||
if (is_file($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $_SERVER['SCRIPT_NAME'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$_SERVER = array_merge($_SERVER, $_ENV);
|
||||
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'index.php';
|
||||
$_SERVER['SCRIPT_NAME'] = DIRECTORY_SEPARATOR . 'index.php';
|
||||
$_SERVER['PHP_SELF'] = DIRECTORY_SEPARATOR . 'index.php';
|
||||
|
||||
require 'index.php';
|
||||
|
||||
error_log(sprintf('%s:%d [%d]: %s', $_SERVER['REMOTE_ADDR'], $_SERVER['REMOTE_PORT'], http_response_code(), $_SERVER['REQUEST_URI']), 4);
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
@@ -255,28 +255,32 @@ class Assets
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a CSS asset.
|
||||
* Add an asset to its assembly.
|
||||
*
|
||||
* It checks for duplicates.
|
||||
* You may add more than one asset passing an array as argument.
|
||||
* The third argument may alternatively contain an array of options which take precedence over positional
|
||||
* arguments.
|
||||
*
|
||||
* @param mixed $asset
|
||||
* @param int $priority the priority, bigger comes first
|
||||
* @param bool $pipeline false if this should not be pipelined
|
||||
* @param null $group
|
||||
* @param array $assembly the array assembling the assets
|
||||
* @param mixed $asset
|
||||
* @param int $priority the priority, bigger comes first
|
||||
* @param bool $pipeline false if this should not be pipelined
|
||||
* @param string $loading how the asset is loaded (async/defer/inline, for CSS: only inline)
|
||||
* @param string $group name of the group
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addCss($asset, $priority = null, $pipeline = true, $group = null)
|
||||
public function addTo(&$assembly, $asset, $priority = null, $pipeline = true, $loading = null, $group = null)
|
||||
{
|
||||
if (is_array($asset)) {
|
||||
foreach ($asset as $a) {
|
||||
$this->addCss($a, $priority, $pipeline, $group);
|
||||
$this->addTo($assembly, $a, $priority, $pipeline, $loading, $group);
|
||||
}
|
||||
|
||||
return $this;
|
||||
} elseif (isset($this->collections[$asset])) {
|
||||
$this->addCss($this->collections[$asset], $priority, $pipeline, $group);
|
||||
$this->addTo($assembly, $this->collections[$asset], $priority, $pipeline, $loading, $group);
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -297,15 +301,16 @@ class Assets
|
||||
'asset' => $asset,
|
||||
'remote' => $remote,
|
||||
'priority' => intval($priority ?: 10),
|
||||
'order' => count($this->css),
|
||||
'order' => count($assembly),
|
||||
'pipeline' => (bool) $pipeline,
|
||||
'loading' => $loading ?: '',
|
||||
'group' => $group ?: 'head',
|
||||
'modified' => $modified
|
||||
];
|
||||
|
||||
// check for dynamic array and merge with defaults
|
||||
if (func_num_args() > 1) {
|
||||
$dynamic_arg = func_get_arg(1);
|
||||
if (func_num_args() > 2) {
|
||||
$dynamic_arg = func_get_arg(2);
|
||||
if (is_array($dynamic_arg)) {
|
||||
$data = array_merge($data, $dynamic_arg);
|
||||
}
|
||||
@@ -313,17 +318,40 @@ class Assets
|
||||
|
||||
$key = md5($asset);
|
||||
if ($asset) {
|
||||
$this->css[$key] = $data;
|
||||
$assembly[$key] = $data;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a CSS asset.
|
||||
*
|
||||
* It checks for duplicates.
|
||||
* You may add more than one asset passing an array as argument.
|
||||
* The second argument may alternatively contain an array of options which take precedence over positional
|
||||
* arguments.
|
||||
*
|
||||
* @param mixed $asset
|
||||
* @param int $priority the priority, bigger comes first
|
||||
* @param bool $pipeline false if this should not be pipelined
|
||||
* @param string $group
|
||||
* @param string $loading how the asset is loaded (async/defer/inline, for CSS: only inline)
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addCss($asset, $priority = null, $pipeline = true, $group = null, $loading = null)
|
||||
{
|
||||
return $this->addTo($this->css, $asset, $priority, $pipeline, $loading, $group);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a JavaScript asset.
|
||||
*
|
||||
* It checks for duplicates.
|
||||
* You may add more than one asset passing an array as argument.
|
||||
* The second argument may alternatively contain an array of options which take precedence over positional
|
||||
* arguments.
|
||||
*
|
||||
* @param mixed $asset
|
||||
* @param int $priority the priority, bigger comes first
|
||||
@@ -335,55 +363,7 @@ class Assets
|
||||
*/
|
||||
public function addJs($asset, $priority = null, $pipeline = true, $loading = null, $group = null)
|
||||
{
|
||||
if (is_array($asset)) {
|
||||
foreach ($asset as $a) {
|
||||
$this->addJs($a, $priority, $pipeline, $loading, $group);
|
||||
}
|
||||
|
||||
return $this;
|
||||
} elseif (isset($this->collections[$asset])) {
|
||||
$this->addJs($this->collections[$asset], $priority, $pipeline, $loading, $group);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
$modified = false;
|
||||
$remote = $this->isRemoteLink($asset);
|
||||
if (!$remote) {
|
||||
$modified = $this->getLastModificationTime($asset);
|
||||
$asset = $this->buildLocalLink($asset);
|
||||
}
|
||||
|
||||
// Check for existence
|
||||
if ($asset === false) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'asset' => $asset,
|
||||
'remote' => $remote ,
|
||||
'priority' => intval($priority ?: 10),
|
||||
'order' => count($this->js),
|
||||
'pipeline' => (bool) $pipeline,
|
||||
'loading' => $loading ?: '',
|
||||
'group' => $group ?: 'head',
|
||||
'modified' => $modified
|
||||
];
|
||||
|
||||
// check for dynamic array and merge with defaults
|
||||
if (func_num_args() > 1) {
|
||||
$dynamic_arg = func_get_arg(1);
|
||||
if (is_array($dynamic_arg)) {
|
||||
$data = array_merge($data, $dynamic_arg);
|
||||
}
|
||||
}
|
||||
|
||||
$key = md5($asset);
|
||||
if ($asset) {
|
||||
$this->js[$key] = $data;
|
||||
}
|
||||
|
||||
return $this;
|
||||
return $this->addTo($this->js, $asset, $priority, $pipeline, $loading, $group);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -547,32 +527,54 @@ class Assets
|
||||
$this->css = array_reverse($this->css);
|
||||
$this->inline_css = array_reverse($this->inline_css);
|
||||
|
||||
$inlineGroup = array_key_exists('loading', $attributes) && $attributes['loading'] === 'inline';
|
||||
|
||||
$attributes = $this->attributes(array_merge(['type' => 'text/css', 'rel' => 'stylesheet'], $attributes));
|
||||
|
||||
$output = '';
|
||||
$inline_css = '';
|
||||
|
||||
if ($this->css_pipeline) {
|
||||
$pipeline_result = $this->pipelineCss($group);
|
||||
$pipeline_html = '<link href="' . $pipeline_result . '"' . $attributes . ' />' . "\n";
|
||||
$pipeline_result = $this->pipelineCss($group, !$inlineGroup);
|
||||
$pipeline_html = ($inlineGroup ? '' : '<link href="' . $pipeline_result . '"' . $attributes . ' />' . "\n");
|
||||
|
||||
if ($this->css_pipeline_before_excludes && $pipeline_result) {
|
||||
$output .= $pipeline_html;
|
||||
if ($inlineGroup) {
|
||||
$inline_css .= $pipeline_result;
|
||||
}
|
||||
else {
|
||||
$output .= $pipeline_html;
|
||||
}
|
||||
}
|
||||
foreach ($this->css_no_pipeline as $file) {
|
||||
if ($group && $file['group'] == $group) {
|
||||
$media = isset($file['media']) ? sprintf(' media="%s"', $file['media']) : '';
|
||||
$output .= '<link href="' . $file['asset'] . $this->getTimestamp($file) . '"' . $attributes . $media . ' />' . "\n";
|
||||
if ($file['loading'] === 'inline') {
|
||||
$inline_css .= $this->gatherLinks([$file], CSS_ASSET) . "\n";
|
||||
}
|
||||
else {
|
||||
$media = isset($file['media']) ? sprintf(' media="%s"', $file['media']) : '';
|
||||
$output .= '<link href="' . $file['asset'] . $this->getTimestamp($file) . '"' . $attributes . $media . ' />' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$this->css_pipeline_before_excludes && $pipeline_result) {
|
||||
$output .= $pipeline_html;
|
||||
if ($inlineGroup) {
|
||||
$inline_css .= $pipeline_result;
|
||||
}
|
||||
else {
|
||||
$output .= $pipeline_html;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($this->css as $file) {
|
||||
if ($group && $file['group'] == $group) {
|
||||
$media = isset($file['media']) ? sprintf(' media="%s"', $file['media']) : '';
|
||||
$output .= '<link href="' . $file['asset'] . $this->getTimestamp($file) . '"' . $attributes . $media . ' />' . "\n";
|
||||
if ($inlineGroup || $file['loading'] === 'inline') {
|
||||
$inline_css .= $this->gatherLinks([$file], CSS_ASSET) . "\n";
|
||||
}
|
||||
else {
|
||||
$media = isset($file['media']) ? sprintf(' media="%s"', $file['media']) : '';
|
||||
$output .= '<link href="' . $file['asset'] . $this->getTimestamp($file) . '"' . $attributes . $media . ' />' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -626,30 +628,52 @@ class Assets
|
||||
$this->js = array_reverse($this->js);
|
||||
$this->inline_js = array_reverse($this->inline_js);
|
||||
|
||||
$inlineGroup = array_key_exists('loading', $attributes) && $attributes['loading'] === 'inline';
|
||||
|
||||
$attributes = $this->attributes(array_merge(['type' => 'text/javascript'], $attributes));
|
||||
|
||||
$output = '';
|
||||
$inline_js = '';
|
||||
|
||||
if ($this->js_pipeline) {
|
||||
$pipeline_result = $this->pipelineJs($group);
|
||||
$pipeline_html = '<script src="' . $pipeline_result . '"' . $attributes . ' ></script>' . "\n";
|
||||
$pipeline_result = $this->pipelineJs($group, !$inlineGroup);
|
||||
$pipeline_html = ($inlineGroup ? '' : '<script src="' . $pipeline_result . '"' . $attributes . ' ></script>' . "\n");
|
||||
|
||||
if ($this->js_pipeline_before_excludes && $pipeline_result) {
|
||||
$output .= $pipeline_html;
|
||||
if ($inlineGroup) {
|
||||
$inline_js .= $pipeline_result;
|
||||
}
|
||||
else {
|
||||
$output .= $pipeline_html;
|
||||
}
|
||||
}
|
||||
foreach ($this->js_no_pipeline as $file) {
|
||||
if ($group && $file['group'] == $group) {
|
||||
$output .= '<script src="' . $file['asset'] . $this->getTimestamp($file) . '"' . $attributes . ' ' . $file['loading'] . '></script>' . "\n";
|
||||
if ($file['loading'] === 'inline') {
|
||||
$inline_js .= $this->gatherLinks([$file], JS_ASSET) . "\n";
|
||||
}
|
||||
else {
|
||||
$output .= '<script src="' . $file['asset'] . $this->getTimestamp($file) . '"' . $attributes . ' ' . $file['loading'] . '></script>' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$this->js_pipeline_before_excludes && $pipeline_result) {
|
||||
$output .= $pipeline_html;
|
||||
if ($inlineGroup) {
|
||||
$inline_js .= $pipeline_result;
|
||||
}
|
||||
else {
|
||||
$output .= $pipeline_html;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($this->js as $file) {
|
||||
if ($group && $file['group'] == $group) {
|
||||
$output .= '<script src="' . $file['asset'] . $this->getTimestamp($file) . '"' . $attributes . ' ' . $file['loading'] . '></script>' . "\n";
|
||||
if ($inlineGroup || $file['loading'] === 'inline') {
|
||||
$inline_js .= $this->gatherLinks([$file], JS_ASSET) . "\n";
|
||||
}
|
||||
else {
|
||||
$output .= '<script src="' . $file['asset'] . $this->getTimestamp($file) . '"' . $attributes . ' ' . $file['loading'] . '></script>' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -672,10 +696,11 @@ class Assets
|
||||
* Minify and concatenate CSS
|
||||
*
|
||||
* @param string $group
|
||||
* @param bool $returnURL true if pipeline should return the URL, otherwise the content
|
||||
*
|
||||
* @return bool|string
|
||||
* @return bool|string URL or generated content if available, else false
|
||||
*/
|
||||
protected function pipelineCss($group = 'head')
|
||||
protected function pipelineCss($group = 'head', $returnURL = true)
|
||||
{
|
||||
// temporary list of assets to pipeline
|
||||
$temp_css = [];
|
||||
@@ -695,9 +720,14 @@ class Assets
|
||||
$this->css_no_pipeline = json_decode(file_get_contents($this->assets_dir . $inline_file), true);
|
||||
}
|
||||
|
||||
// If pipeline exist return it
|
||||
// If pipeline exist return its URL or content
|
||||
if (file_exists($this->assets_dir . $file)) {
|
||||
return $relative_path . $this->getTimestamp();
|
||||
if ($returnURL) {
|
||||
return $relative_path . $this->getTimestamp();
|
||||
}
|
||||
else {
|
||||
return file_get_contents($this->assets_dir . $file) . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Remove any non-pipeline files
|
||||
@@ -744,7 +774,12 @@ class Assets
|
||||
if (strlen(trim($buffer)) > 0) {
|
||||
file_put_contents($this->assets_dir . $file, $buffer);
|
||||
|
||||
return $relative_path . $this->getTimestamp();
|
||||
if ($returnURL) {
|
||||
return $relative_path . $this->getTimestamp();
|
||||
}
|
||||
else {
|
||||
return $buffer . "\n";
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -754,10 +789,11 @@ class Assets
|
||||
* Minify and concatenate JS files.
|
||||
*
|
||||
* @param string $group
|
||||
* @param bool $returnURL true if pipeline should return the URL, otherwise the content
|
||||
*
|
||||
* @return string
|
||||
* @return bool|string URL or generated content if available, else false
|
||||
*/
|
||||
protected function pipelineJs($group = 'head')
|
||||
protected function pipelineJs($group = 'head', $returnURL = true)
|
||||
{
|
||||
// temporary list of assets to pipeline
|
||||
$temp_js = [];
|
||||
@@ -777,9 +813,14 @@ class Assets
|
||||
$this->js_no_pipeline = json_decode(file_get_contents($this->assets_dir . $inline_file), true);
|
||||
}
|
||||
|
||||
// If pipeline exist return it
|
||||
// If pipeline exist return its URL or content
|
||||
if (file_exists($this->assets_dir . $file)) {
|
||||
return $relative_path . $this->getTimestamp();
|
||||
if ($returnURL) {
|
||||
return $relative_path . $this->getTimestamp();
|
||||
}
|
||||
else {
|
||||
return file_get_contents($this->assets_dir . $file) . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Remove any non-pipeline files
|
||||
@@ -816,7 +857,12 @@ class Assets
|
||||
if (strlen(trim($buffer)) > 0) {
|
||||
file_put_contents($this->assets_dir . $file, $buffer);
|
||||
|
||||
return $relative_path . $this->getTimestamp();
|
||||
if ($returnURL) {
|
||||
return $relative_path . $this->getTimestamp();
|
||||
}
|
||||
else {
|
||||
return $buffer . "\n";
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -889,7 +935,7 @@ class Assets
|
||||
/**
|
||||
* Removes an item from the CSS array if set
|
||||
*
|
||||
* @param $key the asset key
|
||||
* @param string $key The asset key
|
||||
*/
|
||||
public function removeCss($key)
|
||||
{
|
||||
@@ -902,7 +948,7 @@ class Assets
|
||||
/**
|
||||
* Removes an item from the JS array if set
|
||||
*
|
||||
* @param $key the asset key
|
||||
* @param string $key The asset key
|
||||
*/
|
||||
public function removeJs($key)
|
||||
{
|
||||
@@ -1255,13 +1301,8 @@ class Assets
|
||||
|
||||
$old_url = $matches[2];
|
||||
|
||||
// ensure this is not a data url
|
||||
if (strpos($old_url, 'data:') === 0) {
|
||||
return $matches[0];
|
||||
}
|
||||
|
||||
// ensure this is not a remote url
|
||||
if ($this->isRemoteLink($old_url)) {
|
||||
// Ensure link is not rooted to webserver, a data URL, or to a remote host
|
||||
if (Utils::startsWith($old_url, '/') || Utils::startsWith($old_url, 'data:') || $this->isRemoteLink($old_url)) {
|
||||
return $matches[0];
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Backup
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
@@ -17,6 +17,7 @@ use RocketTheme\Toolbox\Event\Event;
|
||||
* The GravCache object is used throughout Grav to store and retrieve cached data.
|
||||
* It uses DoctrineCache library and supports a variety of caching mechanisms. Those include:
|
||||
*
|
||||
* APCu
|
||||
* APC
|
||||
* XCache
|
||||
* RedisCache
|
||||
@@ -173,6 +174,12 @@ class Cache extends Getters
|
||||
$setting = $this->driver_setting;
|
||||
$driver_name = 'file';
|
||||
|
||||
// CLI compatibility requires a non-volatile cache driver
|
||||
if ($this->config->get('system.cache.cli_compatibility') && (
|
||||
$setting == 'auto' || $this->isVolatileDriver($setting))) {
|
||||
$setting = $driver_name;
|
||||
}
|
||||
|
||||
if (!$setting || $setting == 'auto') {
|
||||
if (extension_loaded('apcu')) {
|
||||
$driver_name = 'apcu';
|
||||
@@ -250,7 +257,7 @@ class Cache extends Getters
|
||||
*
|
||||
* @param string $id the id of the cached entry
|
||||
*
|
||||
* @return object returns the cached entry, can be any type, or false if doesn't exist
|
||||
* @return object|bool returns the cached entry, can be any type, or false if doesn't exist
|
||||
*/
|
||||
public function fetch($id)
|
||||
{
|
||||
@@ -370,7 +377,9 @@ class Cache extends Getters
|
||||
|
||||
if (is_array($files)) {
|
||||
foreach ($files as $file) {
|
||||
if (is_file($file)) {
|
||||
if (is_link($file)) {
|
||||
$output[] = '<yellow>Skipping symlink: </yellow>' . $file;
|
||||
} elseif (is_file($file)) {
|
||||
if (@unlink($file)) {
|
||||
$anything = true;
|
||||
}
|
||||
@@ -435,4 +444,39 @@ class Cache extends Getters
|
||||
|
||||
return $this->lifetime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current driver name
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDriverName()
|
||||
{
|
||||
return $this->driver_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current driver setting
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDriverSetting()
|
||||
{
|
||||
return $this->driver_setting;
|
||||
}
|
||||
|
||||
/**
|
||||
* is this driver a volatile driver in that it resides in PHP process memory
|
||||
*
|
||||
* @param $setting
|
||||
* @return bool
|
||||
*/
|
||||
public function isVolatileDriver($setting)
|
||||
{
|
||||
if (in_array($setting, ['apc', 'apcu', 'xcache', 'wincache'])) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Config
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Config
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
namespace Grav\Common\Config;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Config
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Config
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
@@ -59,7 +59,7 @@ class CompiledLanguages extends CompiledBase
|
||||
{
|
||||
$file = CompiledYamlFile::instance($filename);
|
||||
if (preg_match('|languages\.yaml$|', $filename)) {
|
||||
$this->object->mergeRecursive($file->content());
|
||||
$this->object->mergeRecursive((array)$file->content());
|
||||
} else {
|
||||
$this->object->join($name, $file->content(), '/');
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Config
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Config
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Config
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Config
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Data
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Data
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Data
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Data
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Data
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Data
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
@@ -339,7 +339,7 @@ class Validation
|
||||
|
||||
protected static function filterNumber($value, array $params, array $field)
|
||||
{
|
||||
return (int) $value;
|
||||
return (string)(int)$value !== (string)(float)$value ? (float) $value : (int) $value;
|
||||
}
|
||||
|
||||
protected static function filterDateTime($value, array $params, array $field)
|
||||
@@ -582,9 +582,10 @@ class Validation
|
||||
foreach ($values as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
$value = implode(',', $value);
|
||||
$values[$key] = array_map('trim', explode(',', $value));
|
||||
} else {
|
||||
$values[$key] = trim($value);
|
||||
}
|
||||
|
||||
$values[$key] = array_map('trim', explode(',', $value));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Data
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
@@ -87,6 +87,14 @@ class Debugger
|
||||
public function addAssets()
|
||||
{
|
||||
if ($this->enabled()) {
|
||||
|
||||
// Only add assets if Page is HTML
|
||||
$page = $this->grav['page'];
|
||||
if ($page->templateFormat() != 'html') {
|
||||
$this->enabled = false;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** @var Assets $assets */
|
||||
$assets = $this->grav['assets'];
|
||||
|
||||
@@ -112,6 +120,13 @@ class Debugger
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCaller($ignore = 2)
|
||||
{
|
||||
$trace = debug_backtrace(false, $ignore);
|
||||
|
||||
return array_pop($trace);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a data collector
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Errors
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Errors
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
@@ -20,7 +20,8 @@ class Errors
|
||||
$jsonRequest = $_SERVER && isset($_SERVER['HTTP_ACCEPT']) && $_SERVER['HTTP_ACCEPT'] == 'application/json';
|
||||
|
||||
// Setup Whoops-based error handler
|
||||
$whoops = new \Whoops\Run;
|
||||
$system = new SystemFacade;
|
||||
$whoops = new \Whoops\Run($system);
|
||||
|
||||
$verbosity = 1;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Errors
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
39
system/src/Grav/Common/Errors/SystemFacade.php
Normal file
39
system/src/Grav/Common/Errors/SystemFacade.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Grav.Common.Errors
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Grav\Common\Errors;
|
||||
|
||||
class SystemFacade extends \Whoops\Util\SystemFacade
|
||||
{
|
||||
protected $whoopsShutdownHandler;
|
||||
|
||||
/**
|
||||
* @param callable $function
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerShutdownFunction(callable $function)
|
||||
{
|
||||
$this->whoopsShutdownHandler = $function;
|
||||
register_shutdown_function([$this, 'handleShutdown']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Special case to deal with Fatal errors and the like.
|
||||
*/
|
||||
public function handleShutdown()
|
||||
{
|
||||
$error = $this->getLastError();
|
||||
|
||||
// Ignore core warnings and errors.
|
||||
if ($error && !($error['type'] & (E_CORE_WARNING | E_CORE_ERROR))) {
|
||||
$handler = $this->whoopsShutdownHandler;
|
||||
$handler();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.File
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
@@ -69,7 +69,8 @@ trait CompiledFile
|
||||
|
||||
// Compile cached file into bytecode cache
|
||||
if (function_exists('opcache_invalidate')) {
|
||||
opcache_invalidate($file->filename(), true);
|
||||
// Silence error if function exists, but is restricted.
|
||||
@opcache_invalidate($file->filename(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.File
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.File
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.File
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.FileSystem
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
@@ -70,9 +70,13 @@ abstract class Folder
|
||||
|
||||
/** @var \RecursiveDirectoryIterator $file */
|
||||
foreach ($iterator as $filepath => $file) {
|
||||
$file_modified = $file->getMTime();
|
||||
if ($file_modified > $last_modified) {
|
||||
$last_modified = $file_modified;
|
||||
try {
|
||||
$file_modified = $file->getMTime();
|
||||
if ($file_modified > $last_modified) {
|
||||
$last_modified = $file_modified;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
Grav::instance()['log']->error('Could not process file: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,7 +332,8 @@ abstract class Folder
|
||||
*/
|
||||
public static function move($source, $target)
|
||||
{
|
||||
if (!is_dir($source)) {
|
||||
if (!file_exists($source) || !is_dir($source)) {
|
||||
// Rename fails if source folder does not exist.
|
||||
throw new \RuntimeException('Cannot move non-existing folder.');
|
||||
}
|
||||
|
||||
@@ -337,20 +342,32 @@ abstract class Folder
|
||||
return;
|
||||
}
|
||||
|
||||
if (file_exists($target)) {
|
||||
// Rename fails if target folder exists.
|
||||
throw new \RuntimeException('Cannot move files to existing folder/file.');
|
||||
}
|
||||
|
||||
// Make sure that path to the target exists before moving.
|
||||
self::create(dirname($target));
|
||||
|
||||
// Just rename the directory.
|
||||
$success = @rename($source, $target);
|
||||
// Silence warnings (chmod failed etc).
|
||||
@rename($source, $target);
|
||||
|
||||
if (!$success) {
|
||||
$error = error_get_last();
|
||||
throw new \RuntimeException($error['message']);
|
||||
// Rename function can fail while still succeeding, so let's check if the folder exists.
|
||||
if (!file_exists($target) || !is_dir($target)) {
|
||||
// In some rare cases rename() creates file, not a folder. Get rid of it.
|
||||
if (file_exists($target)) {
|
||||
@unlink($target);
|
||||
}
|
||||
// Rename doesn't support moving folders across filesystems. Use copy instead.
|
||||
self::copy($source, $target);
|
||||
self::delete($source);
|
||||
}
|
||||
|
||||
// Make sure that the change will be detected when caching.
|
||||
@touch(dirname($source));
|
||||
@touch(dirname($target));
|
||||
@touch($target);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.FileSystem
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
@@ -17,7 +17,7 @@ class RecursiveFolderFilterIterator extends \RecursiveFilterIterator
|
||||
/**
|
||||
* Create a RecursiveFilterIterator from a RecursiveIterator
|
||||
*
|
||||
* @param RecursiveIterator $iterator
|
||||
* @param \RecursiveIterator $iterator
|
||||
*/
|
||||
public function __construct(\RecursiveIterator $iterator)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.GPM
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.GPM
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.GPM
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.GPM
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
/**
|
||||
* @package Grav.Common.GPM
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Grav\Common\GPM;
|
||||
|
||||
use Grav\Common\Grav;
|
||||
use Grav\Common\Filesystem\Folder;
|
||||
use Grav\Common\Inflector;
|
||||
use Grav\Common\Iterator;
|
||||
use Grav\Common\Utils;
|
||||
@@ -74,7 +75,7 @@ class GPM extends Iterator
|
||||
* Returns the Locally installable packages
|
||||
*
|
||||
* @param array $list_type_installed
|
||||
* @return Iterator The installed packages
|
||||
* @return array The installed packages
|
||||
*/
|
||||
public function getInstallable($list_type_installed = ['plugins' => true, 'themes' => true])
|
||||
{
|
||||
@@ -117,6 +118,8 @@ class GPM extends Iterator
|
||||
if (isset($this->installed['themes'][$slug])) {
|
||||
return $this->installed['themes'][$slug];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -199,7 +202,7 @@ class GPM extends Iterator
|
||||
/**
|
||||
* Returns an array of Plugins and Themes that can be updated.
|
||||
* Plugins and Themes are extended with the `available` property that relies to the remote version
|
||||
* @param $list_type_update specifies what type of package to update
|
||||
* @param array $list_type_update specifies what type of package to update
|
||||
* @return array Array of updatable Plugins and Themes.
|
||||
* Format: ['total' => int, 'plugins' => array, 'themes' => array]
|
||||
*/
|
||||
@@ -222,7 +225,7 @@ class GPM extends Iterator
|
||||
/**
|
||||
* Returns an array of Plugins that can be updated.
|
||||
* The Plugins are extended with the `available` property that relies to the remote version
|
||||
* @return Iterator Array of updatable Plugins
|
||||
* @return array Array of updatable Plugins
|
||||
*/
|
||||
public function getUpdatablePlugins()
|
||||
{
|
||||
@@ -302,7 +305,7 @@ class GPM extends Iterator
|
||||
/**
|
||||
* Returns an array of Themes that can be updated.
|
||||
* The Themes are extended with the `available` property that relies to the remote version
|
||||
* @return Iterator Array of updatable Themes
|
||||
* @return array Array of updatable Themes
|
||||
*/
|
||||
public function getUpdatableThemes()
|
||||
{
|
||||
@@ -435,7 +438,7 @@ class GPM extends Iterator
|
||||
|
||||
/**
|
||||
* Returns the list of Plugins and Themes available in the repository
|
||||
* @return array Array of available Plugins and Themes
|
||||
* @return Remote\Packages Available Plugins and Themes
|
||||
* Format: ['plugins' => array, 'themes' => array]
|
||||
*/
|
||||
public function getRepository()
|
||||
@@ -446,9 +449,10 @@ class GPM extends Iterator
|
||||
/**
|
||||
* Searches for a Package in the repository
|
||||
* @param string $search Can be either the slug or the name
|
||||
* @return Remote\Package Package if found, FALSE if not
|
||||
* @param bool $ignore_exception True if should not fire an exception (for use in Twig)
|
||||
* @return Remote\Package|bool Package if found, FALSE if not
|
||||
*/
|
||||
public function findPackage($search)
|
||||
public function findPackage($search, $ignore_exception = false)
|
||||
{
|
||||
$search = strtolower($search);
|
||||
|
||||
@@ -470,6 +474,10 @@ class GPM extends Iterator
|
||||
throw new \RuntimeException("The cache/gpm folder is not writable. Please check the folder permissions.");
|
||||
}
|
||||
|
||||
if ($ignore_exception) {
|
||||
return false;
|
||||
}
|
||||
|
||||
throw new \RuntimeException("GPM not reachable. Please check your internet connection or check the Grav site is reachable");
|
||||
}
|
||||
|
||||
@@ -492,6 +500,153 @@ class GPM extends Iterator
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Download the zip package via the URL
|
||||
*
|
||||
* @param $package_file
|
||||
* @param $tmp
|
||||
* @return null|string
|
||||
*/
|
||||
public static function downloadPackage($package_file, $tmp)
|
||||
{
|
||||
$package = parse_url($package_file);
|
||||
$filename = basename($package['path']);
|
||||
|
||||
if (Grav::instance()['config']->get('system.gpm.official_gpm_only') && $package['host'] !== 'getgrav.org') {
|
||||
throw new \RuntimeException("Only official GPM URLs are allowed. You can modify this behavior in the System configuration.");
|
||||
}
|
||||
|
||||
$output = Response::get($package_file, []);
|
||||
|
||||
if ($output) {
|
||||
Folder::mkdir($tmp);
|
||||
file_put_contents($tmp . DS . $filename, $output);
|
||||
return $tmp . DS . $filename;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the local zip package to tmp
|
||||
*
|
||||
* @param $package_file
|
||||
* @param $tmp
|
||||
* @return null|string
|
||||
*/
|
||||
public static function copyPackage($package_file, $tmp)
|
||||
{
|
||||
$package_file = realpath($package_file);
|
||||
|
||||
if (file_exists($package_file)) {
|
||||
$filename = basename($package_file);
|
||||
Folder::mkdir($tmp);
|
||||
copy(realpath($package_file), $tmp . DS . $filename);
|
||||
return $tmp . DS . $filename;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to guess the package type from the source files
|
||||
*
|
||||
* @param $source
|
||||
* @return bool|string
|
||||
*/
|
||||
public static function getPackageType($source)
|
||||
{
|
||||
$plugin_regex = '/^class\\s{1,}[a-zA-Z0-9]{1,}\\s{1,}extends.+Plugin/m';
|
||||
$theme_regex = '/^class\\s{1,}[a-zA-Z0-9]{1,}\\s{1,}extends.+Theme/m';
|
||||
|
||||
if (
|
||||
file_exists($source . 'system/defines.php') &&
|
||||
file_exists($source . 'system/config/system.yaml')
|
||||
) {
|
||||
return 'grav';
|
||||
} else {
|
||||
// must have a blueprint
|
||||
if (!file_exists($source . 'blueprints.yaml')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// either theme or plugin
|
||||
$name = basename($source);
|
||||
if (Utils::contains($name, 'theme')) {
|
||||
return 'theme';
|
||||
} elseif (Utils::contains($name, 'plugin')) {
|
||||
return 'plugin';
|
||||
}
|
||||
foreach (glob($source . "*.php") as $filename) {
|
||||
$contents = file_get_contents($filename);
|
||||
if (preg_match($theme_regex, $contents)) {
|
||||
return 'theme';
|
||||
} elseif (preg_match($plugin_regex, $contents)) {
|
||||
return 'plugin';
|
||||
}
|
||||
}
|
||||
|
||||
// Assume it's a theme
|
||||
return 'theme';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to guess the package name from the source files
|
||||
*
|
||||
* @param $source
|
||||
* @return bool|string
|
||||
*/
|
||||
public static function getPackageName($source)
|
||||
{
|
||||
$ignore_yaml_files = ['blueprints', 'languages'];
|
||||
|
||||
foreach (glob($source . "*.yaml") as $filename) {
|
||||
$name = strtolower(basename($filename, '.yaml'));
|
||||
if (in_array($name, $ignore_yaml_files)) {
|
||||
continue;
|
||||
}
|
||||
return $name;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find/Parse the blueprint file
|
||||
*
|
||||
* @param $source
|
||||
* @return array|bool
|
||||
*/
|
||||
public static function getBlueprints($source)
|
||||
{
|
||||
$blueprint_file = $source . 'blueprints.yaml';
|
||||
if (!file_exists($blueprint_file)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$blueprint = (array)Yaml::parse(file_get_contents($blueprint_file));
|
||||
return $blueprint;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the install path for a name and a particular type of package
|
||||
*
|
||||
* @param $type
|
||||
* @param $name
|
||||
* @return string
|
||||
*/
|
||||
public static function getInstallPath($type, $name)
|
||||
{
|
||||
$locator = Grav::instance()['locator'];
|
||||
|
||||
if ($type == 'theme') {
|
||||
$install_path = $locator->findResource('themes://', false) . DS . $name;
|
||||
} else {
|
||||
$install_path = $locator->findResource('plugins://', false) . DS . $name;
|
||||
}
|
||||
return $install_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches for a list of Packages in the repository
|
||||
* @param array $searches An array of either slugs or names
|
||||
@@ -595,6 +750,8 @@ class GPM extends Iterator
|
||||
return $dependency[$dependency_slug];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.GPM
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
@@ -58,6 +58,7 @@ class Installer
|
||||
'sophisticated' => false,
|
||||
'theme' => false,
|
||||
'install_path' => '',
|
||||
'ignores' => [],
|
||||
'exclude_checks' => [self::EXISTS, self::NOT_FOUND, self::IS_LINK]
|
||||
];
|
||||
|
||||
@@ -134,7 +135,7 @@ class Installer
|
||||
self::moveInstall($extracted, $install_path);
|
||||
}
|
||||
} else {
|
||||
self::sophisticatedInstall($extracted, $install_path);
|
||||
self::sophisticatedInstall($extracted, $install_path, $options['ignores']);
|
||||
}
|
||||
|
||||
Folder::delete($tmp);
|
||||
@@ -181,7 +182,7 @@ class Installer
|
||||
return false;
|
||||
}
|
||||
|
||||
$package_folder_name = $zip->getNameIndex(0);
|
||||
$package_folder_name = preg_replace('#\./$#', '', $zip->getNameIndex(0));
|
||||
$zip->close();
|
||||
$extracted_folder = $destination . '/' . $package_folder_name;
|
||||
|
||||
@@ -280,11 +281,11 @@ class Installer
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function sophisticatedInstall($source_path, $install_path)
|
||||
public static function sophisticatedInstall($source_path, $install_path, $ignores = [])
|
||||
{
|
||||
foreach (new \DirectoryIterator($source_path) as $file) {
|
||||
|
||||
if ($file->isLink() || $file->isDot()) {
|
||||
if ($file->isLink() || $file->isDot() || in_array($file->getBasename(),$ignores)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -296,7 +297,7 @@ class Installer
|
||||
|
||||
if ($file->getBasename() == 'bin') {
|
||||
foreach (glob($path . DS . '*') as $bin_file) {
|
||||
@chmod($bin_file, 0755);
|
||||
@chmod($bin_file, 0755);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.GPM
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.GPM
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.GPM
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.GPM
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.GPM
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.GPM
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.GPM
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.GPM
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.GPM
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.GPM
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.GPM
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.GPM
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.GPM
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
@@ -190,11 +190,19 @@ class Response
|
||||
}
|
||||
|
||||
/**
|
||||
* Progress normalized for cURL and Fopen
|
||||
* Accepts a vsariable length of arguments passed in by stream method
|
||||
* Is this a remote file or not
|
||||
*
|
||||
* @return array Normalized array with useful data.
|
||||
* Format: ['code' => int|false, 'filesize' => bytes, 'transferred' => bytes, 'percent' => int]
|
||||
* @param $file
|
||||
* @return bool
|
||||
*/
|
||||
public static function isRemote($file)
|
||||
{
|
||||
return (bool) filter_var($file, FILTER_VALIDATE_URL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Progress normalized for cURL and Fopen
|
||||
* Accepts a variable length of arguments passed in by stream method
|
||||
*/
|
||||
public static function progress()
|
||||
{
|
||||
@@ -243,6 +251,8 @@ class Response
|
||||
if (self::isCurlAvailable()) {
|
||||
return self::getCurl(func_get_args());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -291,7 +301,7 @@ class Response
|
||||
case '401':
|
||||
throw new \RuntimeException("Invalid LICENSE");
|
||||
default:
|
||||
throw new \RuntimeException("Error while trying to download '$uri'\n");
|
||||
throw new \RuntimeException("Error while trying to download (code: $code): $uri \n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,7 +337,7 @@ class Response
|
||||
case '401':
|
||||
throw new \RuntimeException("Invalid LICENSE");
|
||||
default:
|
||||
throw new \RuntimeException("Error while trying to download '$uri'\nMessage: $error_message");
|
||||
throw new \RuntimeException("Error while trying to download (code: $code): $uri \nMessage: $error_message");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -361,7 +371,7 @@ class Response
|
||||
return curl_exec($ch);
|
||||
}
|
||||
|
||||
$max_redirects = isset($options['curl'][CURLOPT_MAXREDIRS]) ? $options['curl'][CURLOPT_MAXREDIRS] : 3;
|
||||
$max_redirects = isset($options['curl'][CURLOPT_MAXREDIRS]) ? $options['curl'][CURLOPT_MAXREDIRS] : 5;
|
||||
$options['curl'][CURLOPT_FOLLOWLOCATION] = false;
|
||||
|
||||
// open_basedir set but no redirects to follow, we can disable followlocation and proceed normally
|
||||
@@ -386,7 +396,7 @@ class Response
|
||||
$code = 0;
|
||||
} else {
|
||||
$code = curl_getinfo($rch, CURLINFO_HTTP_CODE);
|
||||
if ($code == 301 || $code == 302) {
|
||||
if ($code == 301 || $code == 302 || $code == 303) {
|
||||
preg_match('/Location:(.*?)\n/', $header, $matches);
|
||||
$uri = trim(array_pop($matches));
|
||||
} else {
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
/**
|
||||
* @package Grav.Common.GPM
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Grav\Common\GPM;
|
||||
|
||||
use Grav\Common\GPM\Remote\GravCore;
|
||||
|
||||
/**
|
||||
* Class Upgrader
|
||||
*
|
||||
@@ -18,17 +20,10 @@ class Upgrader
|
||||
/**
|
||||
* Remote details about latest Grav version
|
||||
*
|
||||
* @var Packages
|
||||
* @var GravCore
|
||||
*/
|
||||
private $remote;
|
||||
|
||||
/**
|
||||
* Internal cache
|
||||
*
|
||||
* @var Iterator
|
||||
*/
|
||||
protected $cache;
|
||||
|
||||
/**
|
||||
* Creates a new GPM instance with Local and Remote packages available
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,13 +2,17 @@
|
||||
/**
|
||||
* @package Grav.Common
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Grav\Common;
|
||||
|
||||
use Grav\Common\Config\Config;
|
||||
use Grav\Common\Language\Language;
|
||||
use Grav\Common\Page\Medium\ImageMedium;
|
||||
use Grav\Common\Page\Medium\Medium;
|
||||
use Grav\Common\Page\Page;
|
||||
use RocketTheme\Toolbox\DI\Container;
|
||||
use RocketTheme\Toolbox\Event\Event;
|
||||
|
||||
@@ -41,6 +45,7 @@ class Grav extends Container
|
||||
'Grav\Common\Service\PageServiceProvider',
|
||||
'Grav\Common\Service\OutputServiceProvider',
|
||||
'browser' => 'Grav\Common\Browser',
|
||||
'exif' => 'Grav\Common\Helpers\Exif',
|
||||
'Grav\Common\Service\StreamsServiceProvider',
|
||||
'Grav\Common\Service\ConfigServiceProvider',
|
||||
'inflector' => 'Grav\Common\Inflector',
|
||||
@@ -112,9 +117,6 @@ class Grav extends Container
|
||||
*/
|
||||
public function process()
|
||||
{
|
||||
/** @var Debugger $debugger */
|
||||
$debugger = $this['debugger'];
|
||||
|
||||
// process all processors (e.g. config, initialize, assets, ..., render)
|
||||
foreach ($this->processors as $processor) {
|
||||
$processor = $this[$processor];
|
||||
@@ -123,14 +125,10 @@ class Grav extends Container
|
||||
});
|
||||
}
|
||||
|
||||
// Set the header type
|
||||
$this->header();
|
||||
|
||||
echo $this->output;
|
||||
/** @var Debugger $debugger */
|
||||
$debugger = $this['debugger'];
|
||||
$debugger->render();
|
||||
|
||||
$this->fireEvent('onOutputRendered');
|
||||
|
||||
register_shutdown_function([$this, 'shutdown']);
|
||||
}
|
||||
|
||||
@@ -238,7 +236,7 @@ class Grav extends Container
|
||||
|
||||
// Calculate a Hash based on the raw file
|
||||
if ($page->eTag()) {
|
||||
header('ETag: ' . md5($page->raw() . $page->modified()));
|
||||
header('ETag: "' . md5($page->raw() . $page->modified()).'"');
|
||||
}
|
||||
|
||||
// Set debugger data in headers
|
||||
@@ -306,7 +304,12 @@ class Grav extends Container
|
||||
} else {
|
||||
// Without gzip we have no other choice than to prevent server from compressing the output.
|
||||
// This action turns off mod_deflate which would prevent us from closing the connection.
|
||||
header('Content-Encoding: none');
|
||||
if ($this['config']->get('system.cache.allow_webserver_gzip')) {
|
||||
header('Content-Encoding: identity');
|
||||
} else {
|
||||
header('Content-Encoding: none');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
@@ -20,6 +20,7 @@ trait GravTrait
|
||||
if (!self::$grav) {
|
||||
self::$grav = Grav::instance();
|
||||
}
|
||||
|
||||
return self::$grav;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Helpers
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
/**
|
||||
* @package Grav.Common.Helpers
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Grav\Common\Helpers;
|
||||
|
||||
use Grav\Common\Grav;
|
||||
use Grav\Common\Page\Page;
|
||||
use Grav\Common\Uri;
|
||||
use Grav\Common\Page\Medium\Medium;
|
||||
use RocketTheme\Toolbox\Event\Event;
|
||||
@@ -19,11 +20,11 @@ class Excerpts
|
||||
/**
|
||||
* Process Grav image media URL from HTML tag
|
||||
*
|
||||
* @param $html HTML tag e.g. `<img src="image.jpg" />`
|
||||
* @param $page The current page object
|
||||
* @return string Returns final HTML string
|
||||
* @param string $html HTML tag e.g. `<img src="image.jpg" />`
|
||||
* @param Page $page The current page object
|
||||
* @return string Returns final HTML string
|
||||
*/
|
||||
public static function processImageHtml($html, $page)
|
||||
public static function processImageHtml($html, Page $page)
|
||||
{
|
||||
$excerpt = static::getExcerptFromHtml($html, 'img');
|
||||
|
||||
@@ -47,8 +48,8 @@ class Excerpts
|
||||
/**
|
||||
* Get an Excerpt array from a chunk of HTML
|
||||
*
|
||||
* @param $html Chunk of HTML
|
||||
* @param $tag a tag, for example `img`
|
||||
* @param string $html Chunk of HTML
|
||||
* @param string $tag A tag, for example `img`
|
||||
* @return array|null returns nested array excerpt
|
||||
*/
|
||||
public static function getExcerptFromHtml($html, $tag)
|
||||
@@ -109,11 +110,11 @@ class Excerpts
|
||||
* Process a Link excerpt
|
||||
*
|
||||
* @param $excerpt
|
||||
* @param $page
|
||||
* @param Page $page
|
||||
* @param string $type
|
||||
* @return mixed
|
||||
*/
|
||||
public static function processLinkExcerpt($excerpt, $page, $type = 'link')
|
||||
public static function processLinkExcerpt($excerpt, Page $page, $type = 'link')
|
||||
{
|
||||
$url = htmlspecialchars_decode(urldecode($excerpt['element']['attributes']['href']));
|
||||
|
||||
@@ -189,11 +190,11 @@ class Excerpts
|
||||
/**
|
||||
* Process an image excerpt
|
||||
*
|
||||
* @param $excerpt
|
||||
* @param $page
|
||||
* @param array $excerpt
|
||||
* @param Page $page
|
||||
* @return mixed
|
||||
*/
|
||||
public static function processImageExcerpt($excerpt, $page)
|
||||
public static function processImageExcerpt(array $excerpt, Page $page)
|
||||
{
|
||||
$url = htmlspecialchars_decode(urldecode($excerpt['element']['attributes']['src']));
|
||||
$url_parts = static::parseUrl($url);
|
||||
@@ -225,6 +226,7 @@ class Excerpts
|
||||
$base_url = rtrim(Grav::instance()['base_url_relative'] . Grav::instance()['pages']->base(), '/');
|
||||
$page_route = '/' . ltrim(str_replace($base_url, '', $folder), '/');
|
||||
|
||||
/** @var Page $ext_page */
|
||||
$ext_page = Grav::instance()['pages']->dispatch($page_route, true);
|
||||
if ($ext_page) {
|
||||
$media = $ext_page->media();
|
||||
|
||||
27
system/src/Grav/Common/Helpers/Exif.php
Normal file
27
system/src/Grav/Common/Helpers/Exif.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Grav.Common.Helpers
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Grav\Common\Helpers;
|
||||
|
||||
use Grav\Common\Grav;
|
||||
|
||||
class Exif
|
||||
{
|
||||
public $reader;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
if (function_exists('exif_read_data') && class_exists('\PHPExif\Reader\Reader')) {
|
||||
$this->reader = \PHPExif\Reader\Reader::factory(\PHPExif\Reader\Reader::TYPE_NATIVE);
|
||||
} else {
|
||||
if (Grav::instance()['config']->get('system.media.auto_metadata_exif')) {
|
||||
throw new \Exception('Please enable the Exif extension for PHP or disable Exif support in Grav system configuration');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Helpers
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
@@ -10,6 +10,8 @@ namespace Grav\Common\Helpers;
|
||||
|
||||
use DOMText;
|
||||
use DOMDocument;
|
||||
use DOMElement;
|
||||
use DOMNode;
|
||||
use DOMWordsIterator;
|
||||
use DOMLettersIterator;
|
||||
|
||||
@@ -118,7 +120,7 @@ class Truncator {
|
||||
|
||||
/**
|
||||
* Builds a DOMDocument object from a string containing HTML.
|
||||
* @param string HTML to load
|
||||
* @param string $html HTML to load
|
||||
* @returns DOMDocument Returns a DOMDocument object.
|
||||
*/
|
||||
public static function htmlToDomDocument($html)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
@@ -26,11 +26,11 @@ class Inflector
|
||||
{
|
||||
if (empty($this->plural)) {
|
||||
$language = Grav::instance()['language'];
|
||||
$this->plural = $language->translate('INFLECTOR_PLURALS', null, true);
|
||||
$this->singular = $language->translate('INFLECTOR_SINGULAR', null, true);
|
||||
$this->uncountable = $language->translate('INFLECTOR_UNCOUNTABLE', null, true);
|
||||
$this->irregular = $language->translate('INFLECTOR_IRREGULAR', null, true);
|
||||
$this->ordinals = $language->translate('INFLECTOR_ORDINALS', null, true);
|
||||
$this->plural = $language->translate('INFLECTOR_PLURALS', null, true) ?: [];
|
||||
$this->singular = $language->translate('INFLECTOR_SINGULAR', null, true) ?: [];
|
||||
$this->uncountable = $language->translate('INFLECTOR_UNCOUNTABLE', null, true) ?: [];
|
||||
$this->irregular = $language->translate('INFLECTOR_IRREGULAR', null, true) ?: [];
|
||||
$this->ordinals = $language->translate('INFLECTOR_ORDINALS', null, true) ?: [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Language
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
@@ -170,7 +170,7 @@ class Language
|
||||
*/
|
||||
public function setActiveFromUri($uri)
|
||||
{
|
||||
$regex = '/(^\/(' . $this->getAvailable() . '))(?:\/.*|$)/i';
|
||||
$regex = '/(^\/(' . $this->getAvailable() . '))(?:\/|\?|$)/i';
|
||||
|
||||
// if languages set
|
||||
if ($this->enabled()) {
|
||||
@@ -178,7 +178,7 @@ class Language
|
||||
if (preg_match($regex, $uri, $matches)) {
|
||||
$this->lang_in_url = true;
|
||||
$this->active = $matches[2];
|
||||
$uri = preg_replace("/\\" . $matches[1] . "/", '', $matches[0], 1);
|
||||
$uri = preg_replace("/\\" . $matches[1] . "/", '', $uri, 1);
|
||||
|
||||
// store in session if different
|
||||
if ($this->config->get('system.session.enabled', false)
|
||||
@@ -203,6 +203,15 @@ class Language
|
||||
}
|
||||
}
|
||||
|
||||
// repeat if not found, try base language only - fixes Safari sending the language code always
|
||||
// with a locale (e.g. it-it or fr-fr)
|
||||
foreach ($preferred as $lang) {
|
||||
$lang = substr($lang, 0, 2);
|
||||
if ($this->validate($lang)) {
|
||||
$this->active = $lang;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -293,6 +302,21 @@ class Language
|
||||
return $this->page_extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the page_extensions value.
|
||||
*
|
||||
* Useful to re-initialize the pages and change site language at runtime, example:
|
||||
*
|
||||
* ```
|
||||
* $this->grav['language']->setActive('it');
|
||||
* $this->grav['language']->resetFallbackPageExtensions();
|
||||
* $this->grav['pages']->init();
|
||||
* ```
|
||||
*/
|
||||
public function resetFallbackPageExtensions() {
|
||||
$this->page_extensions = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an array of languages with active first, then fallback languages
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Language
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Markdown
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Markdown
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Markdown
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace Grav\Common\Markdown;
|
||||
|
||||
use Grav\Common\Grav;
|
||||
use Grav\Common\Helpers\Excerpts;
|
||||
use Grav\Common\Page\Page;
|
||||
use RocketTheme\Toolbox\Event\Event;
|
||||
|
||||
trait ParsedownGravTrait
|
||||
@@ -166,6 +167,8 @@ trait ParsedownGravTrait
|
||||
|
||||
return $Block;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function inlineSpecialCharacter($Excerpt)
|
||||
@@ -183,6 +186,8 @@ trait ParsedownGravTrait
|
||||
'extent' => 1,
|
||||
];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function inlineImage($excerpt)
|
||||
@@ -243,5 +248,7 @@ trait ParsedownGravTrait
|
||||
|
||||
return call_user_func_array($func, $args);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Page
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
@@ -74,6 +74,21 @@ class Collection extends Iterator
|
||||
return new static($this->items, $this->params, $this->pages);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Merge another collection with the current collection
|
||||
*
|
||||
* @param Collection $collection
|
||||
* @return $this
|
||||
*/
|
||||
public function merge(Collection $collection)
|
||||
{
|
||||
foreach($collection as $page) {
|
||||
$this->addPage($page);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set parameters to the Collection
|
||||
*
|
||||
@@ -146,7 +161,7 @@ class Collection extends Iterator
|
||||
*
|
||||
* @param Page|string|null $key
|
||||
*
|
||||
* @return $this|void
|
||||
* @return $this
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function remove($key = null)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Page
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,15 +2,18 @@
|
||||
/**
|
||||
* @package Grav.Common.Page
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Grav\Common\Page;
|
||||
|
||||
use Grav\Common\Grav;
|
||||
use Grav\Common\Page\Medium\AbstractMedia;
|
||||
use Grav\Common\Page\Medium\GlobalMedia;
|
||||
use Grav\Common\Page\Medium\MediumFactory;
|
||||
use RocketTheme\Toolbox\File\File;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
class Media extends AbstractMedia
|
||||
{
|
||||
@@ -18,6 +21,8 @@ class Media extends AbstractMedia
|
||||
|
||||
protected $path;
|
||||
|
||||
protected $standard_exif = ['FileSize', 'MimeType', 'height', 'width'];
|
||||
|
||||
/**
|
||||
* @param $path
|
||||
*/
|
||||
@@ -58,6 +63,8 @@ class Media extends AbstractMedia
|
||||
*/
|
||||
protected function init()
|
||||
{
|
||||
$config = Grav::instance()['config'];
|
||||
$exif = Grav::instance()['exif'];
|
||||
|
||||
// Handle special cases where page doesn't exist in filesystem.
|
||||
if (!is_dir($this->path)) {
|
||||
@@ -71,7 +78,7 @@ class Media extends AbstractMedia
|
||||
/** @var \DirectoryIterator $info */
|
||||
foreach ($iterator as $path => $info) {
|
||||
// Ignore folders and Markdown files.
|
||||
if (!$info->isFile() || $info->getExtension() == 'md' || $info->getBasename()[0] === '.') {
|
||||
if (!$info->isFile() || $info->getExtension() === 'md' || $info->getBasename()[0] === '.') {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -116,6 +123,23 @@ class Media extends AbstractMedia
|
||||
continue;
|
||||
}
|
||||
|
||||
// Read/store Exif metadata as required
|
||||
if (!empty($types['base']) && $medium->get('mime') === 'image/jpeg' && empty($types['meta']) && $config->get('system.media.auto_metadata_exif')) {
|
||||
$file_path = $types['base']['file'];
|
||||
$meta = $exif->reader->read($file_path);
|
||||
|
||||
if ($meta) {
|
||||
$meta_path = $file_path . '.meta.yaml';
|
||||
$meta_data = $meta->getData();
|
||||
$meta_trimmed = array_diff_key($meta_data, array_flip($this->standard_exif));
|
||||
if ($meta_trimmed) {
|
||||
$file = File::instance($meta_path);
|
||||
$file->save(Yaml::dump($meta_trimmed));
|
||||
$types['meta']['file'] = $meta_path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($types['meta'])) {
|
||||
$medium->addMetaFile($types['meta']['file']);
|
||||
}
|
||||
@@ -141,8 +165,12 @@ class Media extends AbstractMedia
|
||||
|
||||
foreach ($types['alternative'] as $altMedium) {
|
||||
if ($altMedium['file'] != $medium) {
|
||||
$ratio = $altMedium['file']->get('width') / $medium->get('width');
|
||||
$medium->addAlternative($ratio, $altMedium['file']);
|
||||
$altWidth = $altMedium['file']->get('width');
|
||||
$medWidth = $medium->get('width');
|
||||
if ($altWidth && $medWidth) {
|
||||
$ratio = $altWidth / $medWidth;
|
||||
$medium->addAlternative($ratio, $altMedium['file']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Page
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Page
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Page
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Page
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Page
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Page
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
@@ -57,7 +57,7 @@ class Link implements RenderableInterface
|
||||
*
|
||||
* @param string $method
|
||||
* @param mixed $args
|
||||
* @return $this|mixed
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $args)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Grav.Common.Page
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
@@ -49,6 +49,11 @@ class Medium extends Data implements RenderableInterface
|
||||
*/
|
||||
protected $styleAttributes = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $metadata = [];
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
*
|
||||
@@ -70,13 +75,23 @@ class Medium extends Data implements RenderableInterface
|
||||
/**
|
||||
* Return just metadata from the Medium object
|
||||
*
|
||||
* @return $this
|
||||
* @return Data
|
||||
*/
|
||||
public function meta()
|
||||
{
|
||||
return new Data($this->items);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing just the metadata
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function metadata()
|
||||
{
|
||||
return $this->metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add meta file for the medium.
|
||||
*
|
||||
@@ -84,7 +99,8 @@ class Medium extends Data implements RenderableInterface
|
||||
*/
|
||||
public function addMetaFile($filepath)
|
||||
{
|
||||
$this->merge(CompiledYamlFile::instance($filepath)->content());
|
||||
$this->metadata = (array)CompiledYamlFile::instance($filepath)->content();
|
||||
$this->merge($this->metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -229,7 +245,7 @@ class Medium extends Data implements RenderableInterface
|
||||
}
|
||||
|
||||
if (empty($attributes['alt'])) {
|
||||
if (!empty($alt)) {
|
||||
if (!empty($alt) || $alt === '') {
|
||||
$attributes['alt'] = $alt;
|
||||
} elseif (!empty($this->items['alt'])) {
|
||||
$attributes['alt'] = $this->items['alt'];
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user