Compare commits

...

266 Commits

Author SHA1 Message Date
Andy Miller
6496508810 Prepare for release 2017-05-16 13:33:59 -06:00
Andy Miller
d11099c0ae Updated toolbox 2017-05-15 15:10:42 -06:00
Matias Griese
9c5df5977d Merge remote-tracking branch 'origin/develop' into develop 2017-05-15 20:26:52 +03:00
Matias Griese
d3526ae544 Added support for a single array field in the forms 2017-05-15 20:26:45 +03:00
Andy Miller
52d4c3f137 Only store 'extra' metadata in yaml 2017-05-15 10:45:14 -06:00
Andy Miller
0c0bf4b137 Store metadata atomically for easy retrieval 2017-05-15 10:03:36 -06:00
Flavio Copes
6b282d845f Fix issue with exif when composer update is not run
For git-cloned repos
2017-05-15 12:36:31 +02:00
Andy Miller
82f223248e Added Exif + Auto generation of meta.yaml files (#1472)
* Added Exif + Auto generation of meta.yaml files

* Added twig function

* Put a check in for `exif_read_data` function
2017-05-12 16:20:22 -06:00
Ole Vik
a9f1ca429a Tiny typo (#1473) 2017-05-12 15:28:40 -06:00
Andy Miller
7db5d9189b Updated clean command 2017-05-12 15:28:03 -06:00
Andy Miller
8ff2003411 Added base32/64 encode/decode twig filters 2017-05-12 14:47:55 -06:00
j000
899cbffe33 ETag header should be inside double quotes (#1471)
It's small change, but still...

https://tools.ietf.org/html/rfc7232#section-2.3
2017-05-12 12:05:35 -06:00
Matias Griese
77b44f83e1 Add missing APCu 2017-05-11 13:37:24 +03:00
Matias Griese
5fc5813274 Use older version of doctrine/collections (PHP 5.5 support) 2017-05-10 11:06:40 +03:00
Matias Griese
56b0cf292e Changelog update 2017-05-10 10:34:37 +03:00
Matias Griese
08e0679942 Oops, accidentally merged local 2.0 branch into develop, revert GravTrait deprecation and several new Framework classes 2017-05-10 10:08:08 +03:00
Matias Griese
6c062edd18 Add Page interfaces to Grav Framework 2017-05-10 09:44:59 +03:00
Matias Griese
65d844c6e7 Merge branch 'feature/objects' of https://github.com/getgrav/grav into 2.0 2017-05-10 09:43:38 +03:00
Matias Griese
10b4a90501 Add useful functions to FileCollection class 2017-05-09 21:40:35 +03:00
Matias Griese
5f00e1f8ee Rename Collection class to ArrayCollection 2017-05-09 21:27:33 +03:00
Matias Griese
3c468a23c1 Remove Object Finder classes (replaced by FileCollection) 2017-05-09 20:18:32 +03:00
Matias Griese
93c4396bfb Add FileCollection class 2017-05-09 20:17:26 +03:00
Matias Griese
19ac7f3e3f Add AbstractLazyCollection 2017-05-09 12:32:07 +03:00
Scott Hamper
fc5c3023c6 [WIP] Web Server Config URL Rewrite Rules White List (#1458)
* Escaped literal periods in web server config files rewrite rules.

* Black listed "yml" file extension in web server configs rewrite rules.
2017-05-06 11:09:31 -06:00
Flavio Copes
04243f7dd3 Fix #1462 issue with no groups definition 2017-05-06 15:04:30 +02:00
Flavio Copes
cdc6b910cb Bump year 2017-05-05 17:21:59 +02:00
Flavio Copes
219bf9dc6c Groups selection pre-filled in user form 2017-05-05 17:19:16 +02:00
Matias Griese
ad66f0b637 Fix saving stored collections 2017-05-05 15:59:44 +03:00
Matias Griese
bd7469d8e0 Fix StoredObjectInterface::save() to have parameter to include children 2017-05-05 15:21:16 +03:00
Matias Griese
bfda4df2f2 Add storage interface also to object collection 2017-05-05 14:26:12 +03:00
Matias Griese
718608cd55 Improve object classes 2017-05-05 13:38:29 +03:00
Matias Griese
7217635c6f Merge branches 'develop' and 'feature/objects' of https://github.com/getgrav/grav into feature/objects
# Conflicts:
#	CHANGELOG.md
2017-05-05 09:30:59 +03:00
Andy Miller
3eeabdbf89 Merge branch 'develop' of https://github.com/getgrav/grav into develop
# Conflicts:
#	system/src/Grav/Common/Page/Page.php
2017-05-04 06:49:06 -06:00
Andy Miller
958557d2fe Removed logging statement for invalid slug #1459 2017-05-04 06:47:57 -06:00
Flavio Copes
c8345c6613 Edit check for valid slug. Fix #1459 2017-05-04 09:50:46 +02:00
Flavio Copes
83ed2aac00 Changelog 2017-04-25 12:43:44 +02:00
pfcloutier
849130621a Add more controls over HTML5 video attributes (autoplay, poster, loop controls) (#1442) 2017-04-25 12:42:27 +02:00
Andy Miller
bb6175397c Vendor updates 2017-04-24 18:02:04 -06:00
Andy Miller
2074c4933a Force redirect/route matching from start of route #1446 2017-04-24 17:57:47 -06:00
Andy Miller
e8aa9f0381 Merge tag '1.2.4' into develop
Release v1.2.4
2017-04-24 15:32:08 -06:00
Andy Miller
c8590b9523 Merge branch 'release/1.2.4' 2017-04-24 15:32:07 -06:00
Andy Miller
e4ffc8d3de Prepare for release 2017-04-24 15:31:57 -06:00
Andy Miller
e5a522a2fe Added ignores to install options for Installer::sophisticatedInstall() #1447 2017-04-24 15:00:31 -06:00
Andy Miller
34281a14a4 Updated changelog 2017-04-21 22:20:16 -06:00
Andy Miller
f6d910f226 Added support for showModular option in Pages::getList() 2017-04-21 22:18:36 -06:00
Matias Griese
7371a11891 Deprecated GravTrait 2017-04-21 21:34:41 +03:00
Matias Griese
48d5183e07 Added Debugger::getCaller() to figure out where the method was called from 2017-04-21 21:33:35 +03:00
Matias Griese
bf42db3af1 Update changelog 2017-04-21 13:42:38 +03:00
Matias Griese
28d3866eb0 Minor code improvements on processors 2017-04-21 13:26:39 +03:00
Matias Griese
f5517035ba Merge branches 'develop' and 'feature/objects' of https://github.com/getgrav/grav into feature/objects 2017-04-21 12:23:53 +03:00
Matias Griese
bc9dfe736d Move output handling into the render processor 2017-04-21 12:23:19 +03:00
Matias Griese
aee07203a2 Add support for custom output providers like Slim Framework 2017-04-21 11:22:08 +03:00
Andy Miller
13b3b9875e Should address uery strings at the root of multilang sites #1436 2017-04-20 11:02:54 -06:00
Matias Griese
7fc92dcaa2 Merge branch 'develop' of https://github.com/getgrav/grav into feature/objects 2017-04-20 15:48:32 +03:00
Matias Griese
6539931387 Add support for extra context vars in Twig::processSite() 2017-04-20 15:46:59 +03:00
Andy Miller
85a25d0adc Fix for Gantry5 init'ing theme as well as Admin plugin 2017-04-19 17:08:56 -06:00
Andy Miller
8f9e401fc9 Merge tag '1.2.3' into develop
Release v1.2.3
2017-04-19 15:59:57 -06:00
Andy Miller
fc7c6484a7 Merge branch 'release/1.2.3' 2017-04-19 15:59:56 -06:00
Andy Miller
7bbcefbb4d Prepare for release 2017-04-19 15:59:48 -06:00
Matias Griese
bd2f06e72f Merge branch 'develop' of https://github.com/getgrav/grav into feature/objects 2017-04-19 14:41:29 +03:00
Matias Griese
bc6bf737b9 Add Pages::baseUrl(), Pages::homeUrl() and Pages::url() functions and use them 2017-04-19 14:30:34 +03:00
MucaP
749d0e3f2d Those simple things everyone miss (#1428) 2017-04-14 13:26:15 -06:00
Andy Miller
7ba69dd5a1 Fixed Pages test 2017-04-14 12:38:59 -06:00
Andy Miller
00206d5957 Merge branch 'develop' of https://github.com/getgrav/grav into develop 2017-04-14 11:39:29 -06:00
Andy Miller
d214bb5b94 Improved getList() method to do more stuff 2017-04-14 11:39:24 -06:00
Ole Vik
1203b0d900 Fix typo in GPM.php (#1427) 2017-04-14 13:29:05 +02:00
Andy Miller
869b1c4c3b Updated changelog 2017-04-13 15:07:47 -06:00
Andy Miller
c06b2573a1 Added new pwd_regex and username_regex system configuration options 2017-04-13 15:03:20 -06:00
Benny
50dd834bc4 Allow user/account.yaml overrides + implemented more robust theme init (#1416)
* Allow `user/accounts.yaml` overrides and implemented more robust theme initialization

* Allow to override `theme://` in theme config
2017-04-13 14:38:54 -06:00
Matias Griese
7b13ceb9a3 Add new ContentBlock classes 2017-04-13 12:04:31 +03:00
Matias Griese
22effeac42 Move new Collection/Object classes into Grav\Framework 2017-04-13 12:04:14 +03:00
Matias Griese
0e77103883 Merge branches 'develop' and 'feature/objects' of https://github.com/getgrav/grav into feature/objects
# Conflicts:
#	composer.lock
2017-04-12 20:58:10 +03:00
Andy Miller
56e58f3b5e Return "" if no childType set rather than default 2017-04-12 10:28:55 -06:00
Andy Miller
619dc30aca Merge tag '1.2.2' into develop
Release v1.2.2
2017-04-11 14:21:16 -06:00
Andy Miller
5bc3ce07dc Merge branch 'release/1.2.2' 2017-04-11 14:21:15 -06:00
Andy Miller
0fe676c34b Preparing release 2017-04-11 14:21:03 -06:00
Andy Miller
60f97f27be Fix for redirects breaking #1420 2017-04-11 13:32:25 -06:00
Flavio Copes
1d7f41e4a8 Fix #1405 issue in direct-install with github-style dependencies 2017-04-11 11:30:27 +02:00
Andy Miller
3a97502219 Merge tag '1.2.1' into develop
Release v1.2.1
2017-04-10 18:36:59 -06:00
Andy Miller
ca09f789a7 Merge branch 'release/1.2.1' 2017-04-10 18:36:58 -06:00
Andy Miller
be94947d38 Prepare for release 2017-04-10 18:36:42 -06:00
Andy Miller
0a22ff0c68 Fixed changelog 2017-04-10 15:18:33 -06:00
Andy Miller
840a349ace Updated changelog 2017-04-10 15:18:10 -06:00
Andy Miller
b85e595bbb Little cleanup 2017-04-10 12:10:55 -06:00
Josh Weiss
082d4e3435 Ancestor and Inherited functions for Page & Pages (#1362)
* Ancestor and inherited functions for Page & Pages

Addes both helper methods to `Grav\Common\Page` and Grav instance utility functions to `Grav\Common\Pages`.

* Ancestor Page return considering field criteria

* Updates according to code review issue

Made changes to act on current Page object only for the Page functions

Changed variable name to better reflect the intention of the passed param for the Pages class functions

* Simplify duplicate code

* Simplify Pages logic

Simpilfied duplicate code. Also clarified  variable naming for similar functions.
2017-04-10 12:00:58 -06:00
Andy Miller
bfb6b6d68a Updated changelog 2017-04-04 13:31:32 -06:00
Andy Miller
8dc2ced94c Fix for direct-install of plugins with languages.yaml #1396 2017-04-04 13:24:10 -06:00
OliverO2
f510e136c8 Add {'loading': 'inline'} option for Js and CSS assets (#1377)
* Assets.php: Extract common functionaly of addCss() and addJs() into
  addTo(), make css() and js() honor $attributes['loading'],
  make pipelineCss() and pipelineJs() return generated content
  instead of URL depending on new option $returnURL.

* AssetsTest.php: Accept new 'loading' option for CSS, add tests for
  adding and pipelining local and remote assets with inline loading.
2017-04-04 11:25:39 -06:00
Flavio Copes
4365662304 Add query string in lighttpd default config (#1393) 2017-04-04 08:54:48 -06:00
Gilles van Eeden
4aa6dce853 add function isajaxrequest() (#1400)
* Update Taxonomy.php

* Update TwigExtension.php

* Update TwigExtension.php

Incorrect comment updated.

* Update TwigExtension.php

Add function ishuman() to detect agent disposition.

* Update TwigExtension.php

* Revert "Merge remote-tracking branch 'origin/develop' into develop"

This reverts commit 7a59a84290, reversing
changes made to 102973d22c.

* Revert "Revert "Merge remote-tracking branch 'origin/develop' into develop""

This reverts commit 50fc775c69.

* Attempt to resolve conflicts

* param comment corrected

* Update TwigExtension.php

* Update TwigExtension.php

* Update TwigExtension.php

* Update TwigExtension.php

* add isajaxrequest

Check HTTP_X_REQUESTED_WITH header. Non critical use only. Handy for
streamlining ajax presentation.

* remove ishuman

* remove Browser class
2017-04-04 08:53:27 -06:00
Flavio Copes
d338d79acb When determining language from HTTP_ACCEPT_LANGUAGE, also try base language only (#1402)
Fixes Safari sending the language code always with a locale (e.g. it-it
or fr-fr)
2017-04-04 08:51:16 -06:00
Frédéric Potvin
459b7c4a33 Fix #1389 related to bin/gpm direct-install (#1397)
Add --all-yes and --destination options

Fix a problem where temporary package files will not be
cleaned upon command error.
2017-04-02 18:45:57 -06:00
Andy Miller
06e880de57 Fixed a bad method signature causing warning when running tests on GPMTest object 2017-04-01 22:13:43 -06:00
Djamil Legato
cbf3df4bf1 Trying using Gimme to switch Golang version 2017-03-31 11:30:58 -07:00
Andy Miller
aabc8aeb31 Merge branch 'release/1.2.0' 2017-03-31 11:28:48 -06:00
Andy Miller
3d1ed7118e Merge tag '1.2.0' into develop
Release v1.2.0
2017-03-31 11:28:48 -06:00
Andy Miller
ca4f6f3c5c Prepare for release 2017-03-31 11:28:34 -06:00
Andy Miller
3a645ab4a2 updated changelog 2017-03-31 11:09:40 -06:00
Andy Miller
25ba6198e5 switched to stable composer vendor libs 2017-03-31 11:09:29 -06:00
Andy Miller
6564ea98b1 Analysis fixes 2017-03-30 14:30:20 -07:00
Andy Miller
8fe018a7dd Add file upload for user avatar in admin profile 2017-03-29 22:43:26 -07:00
Hugh Barnes
5c40337ff0 CSS pipeline rewrite URL fix for webserver root-based paths (#1383)
* Implement fix to not rewrite paths in CSS pipeline when CSS URLs use a path startng at webserver root (e.g. url('/path/to/asset')) - fixes #1382

* Amend CSS pipeline's resource location checking predicates to use Utils::startsWith, and consolidate into a single predicate

* Add back colon to data URL prefix test

Copy error in last commit would have broken any relative path beginning with the string 'data'
2017-03-26 17:50:22 -07:00
Frédéric Potvin
41e7142dfc [#1200] Clarified install and direct-install (#1384)
To help user that need to install specific version of a package.
So far it wasn't absolutely clear how to achieve and some
users ended up asking for help or opening issues asking
for the feature.
2017-03-26 10:02:50 -07:00
Frédéric Potvin
f45362b5b5 Invite users to join Slack instead of Gitter (#1385)
Since the team is now on Slack.
2017-03-26 10:00:42 -07:00
Andy Miller
f8fbc82196 Prepare for release 2017-03-22 17:30:00 -06:00
Andy Miller
c153039457 Fixed loading issues with improperly named themes #1373 2017-03-22 17:29:47 -06:00
Andy Miller
88ccc25c47 Added an admin only section for child ordering 2017-03-22 17:12:36 -06:00
Andy Miller
b8164d3fe6 changelog updated 2017-03-22 12:10:37 -06:00
Andy Miller
a1d4199e68 Merge branch 'feature/ordering-refactor' into develop 2017-03-22 12:09:47 -06:00
Andy Miller
30f8eca905 Allow Twig url() function to pass through external URLs 2017-03-22 12:04:24 -06:00
Andy Miller
ef7ff9ec4e Improved reorder logic and removed old logic 2017-03-21 20:20:08 -06:00
Andy Miller
0d471599d7 Changed logic for order handling 2017-03-21 15:35:16 -06:00
Andy Miller
13bc19f1e3 Moved debugger logic to avoid null page instances. 2017-03-20 15:25:41 -06:00
Andy Miller
da61196b7b Cleanup package files via GPM install to make them more windows-friendly #1361 2017-03-20 13:30:53 -06:00
Andy Miller
04e1710de1 Updated composer.json to pick up latest Gregwar Image library 2017-03-20 11:26:31 -06:00
Andy Miller
330a90b0ab Added language_codes to Twig init to allow for easy language name/code/native-name lookup 2017-03-20 10:36:26 -06:00
Andy Miller
5c34556246 Fix for page-level debugger override changing the option site-wide 2017-03-20 10:19:37 -06:00
Andy Miller
10a15ef33f Simplified some logic and fixed an issue with system-level process twig logic #1351 2017-03-19 21:24:46 -06:00
Andy Miller
4eebc81808 Merge branch 'develop' of https://github.com/getgrav/grav into develop 2017-03-18 13:54:29 -06:00
Andy Miller
cd37ea0689 Chaned image quality field to use new range field 2017-03-18 13:54:25 -06:00
ricardo118
7e50c340c7 Fix class for Config/System"Default ordering" (#1359)
Fix class for both "Default ordering" and "Append URL extension"
2017-03-18 11:50:37 -06:00
Ole Vik
701f18e782 Fix field class for Config/Site "Default language" (#1357) 2017-03-18 11:50:18 -06:00
Andy Miller
66a21db504 Prepare for release 2017-03-17 15:52:39 -06:00
Andy Miller
0290ffd26e Added the ability for a specific page to disable debugger 2017-03-17 15:13:12 -06:00
Matias Griese
020cc6f39b Merge remote-tracking branch 'origin/feature/objects' into feature/objects 2017-03-17 11:18:58 +02:00
Matias Griese
3897506c7f Add ObjectCollectionTrait::group() function 2017-03-17 11:18:50 +02:00
Andy Miller
b5cfb53d78 Updated vendor libraries 2017-03-15 18:16:03 -06:00
Andy Miller
252b2f71a0 Stopped invalid derivates throwing fatal error #1341 2017-03-15 18:15:34 -06:00
Andy Miller
262951ece4 Updated changelog 2017-03-15 17:28:00 -06:00
Andy Miller
874160480f Optimized theme autoloader to work with hyphenated classnames #1353 2017-03-15 17:21:49 -06:00
Andy Miller
79d6b8ab22 Set default release to testing during RC 2017-03-13 19:20:08 -06:00
Andy Miller
04228ecee9 Prepare for release 2017-03-13 18:38:06 -06:00
Andy Miller
3cf8bd5928 Improved evaluate() Twig function to use environment/context 2017-03-13 13:39:17 -06:00
Djamil Legato
9f57af80cf Merge branch 'develop' into feature/objects
# Conflicts:
#	CHANGELOG.md
2017-03-10 11:46:57 -08:00
Josh Weiss
c86d791d44 Fix for the blueprint fix. (#1334)
Discussed with @mahagr.

Saved YAML configs gave undesired extra parameter (!!float 1 for example) because floats were not being cast back to integers upon save. This was even true when the filterNumber function was giving back a correct parameter. filter_var from validateFloat was actually perserving the float variable type which the YAML engine perserved upon Yaml::dump.

This is a unconventional fix, but it is the simplest way to handle this edge case.
2017-03-09 07:54:26 -07:00
Andy Miller
ec9342ced1 Removed ID from nonce_field() twig function causing validation error
https://github.com/getgrav/grav-plugin-form/issues/115
2017-03-08 17:08:22 -07:00
Andy Miller
23ba8a1386 Fixed Page::expires(0) that was not getting picked up 2017-03-08 15:35:15 -07:00
Andy Miller
ebb8786cd9 Fixed Page::expires(0) that was not getting picked up 2017-03-08 15:34:54 -07:00
Matias Griese
703080a329 Start using StorageTrait for AbstractObject and AbstractObjectCollection 2017-03-07 15:45:15 +02:00
Matias Griese
c1ee217cef Update Object classes 2017-03-07 12:06:26 +02:00
Matias Griese
d0eed03fef Merge remote-tracking branch 'origin/feature/objects' into feature/objects 2017-03-06 18:59:04 +02:00
Matias Griese
9ba038b2b3 Implement ObjectStorageTrait 2017-03-06 18:58:55 +02:00
Matias Griese
34cff72fce Add FilesystemStorage::exists() 2017-03-06 14:27:40 +02:00
Andy Miller
4726873b57 Added new Page::folderExists() method 2017-03-05 18:38:34 -07:00
Andy Miller
90ea2fc067 Added block/line option to process markdown 2017-03-04 13:29:06 -07:00
Andy Miller
052a6df550 Merge branch 'feature/objects' of https://github.com/getgrav/grav into feature/objects 2017-03-04 13:28:50 -07:00
Andy Miller
8032830873 Added block/line option to process markdown 2017-03-04 13:28:43 -07:00
Matias Griese
4ace1d0b42 Implement nested saving support for Object\AbstractObject class 2017-02-28 19:10:42 +02:00
Matias Griese
d0f4fbdfcc Implement Object\FilesystemStorage class 2017-02-28 19:09:35 +02:00
Matias Griese
c7c3659312 Fixed Folder::move() 2017-02-27 20:28:37 +02:00
Matias Griese
f6e4091e51 Merge branches 'develop' and 'feature/objects' of https://github.com/getgrav/grav into feature/objects 2017-02-27 12:56:32 +02:00
Matias Griese
175fcb9415 Fixed exception when trying to find user account and there is no user://accounts folder 2017-02-27 12:53:24 +02:00
Andy Miller
da2a0f507b Added a fragment + query test 2017-02-26 14:10:43 -07:00
Flavio Copes
e771938672 Changelog 2017-02-26 08:55:22 +01:00
Josh Weiss
08e2bb558a Fixing a minor bug in Number validation. (#1329)
The function validateNumber only checks for numeric values.

**By PHP isNumeric**

"42",
1337,
0x539,
02471,
0b10100111001,
1337e0,
"not numeric",
array(),
9.1

**Will evaluate respectively**

'42' is numeric
'1337' is numeric
'1337' is numeric
'1337' is numeric
'1337' is numeric
'1337' is numeric
'not numeric' is NOT numeric
'Array' is NOT numeric
'9.1' is numeric

Grav though does not support all value types for a variety of reasons. One being YAML Blueprint definitions, where it makes sense to make a new type value for a more specialized format. Specifically for numbers if a more advance number format it would make sense to make a new type for that number format.

YAML spec specifically allows both Integer or Float contexts, as seen in the validate class validateInt and validateFloat. This is useful when the output formats explicitly needs to be a certain format.

However, in the case of generic numeric contexts, which numbers could be floats or ints dynamically, the values are cast back to an int currently in Grav numeric validation. Having dynamic primitive number formats is important, true in an interpreted language like JavaScript where 1 and 1.0 will both work for a number value.

The reason to cast the type of the variable still is to prevent wide selection of number formats, and to keep Grav in line with primitive YAML field formats.
2017-02-26 08:51:05 +01:00
Andy Miller
af304f14f4 Added offical_gpm_only check 2017-02-22 13:26:40 -07:00
Andy Miller
389cc296c2 Added Uri::isValidUrl() 2017-02-21 18:08:08 -07:00
Andy Miller
9f193904b5 Initial work to genericize direct-install (#1321) 2017-02-21 16:23:26 +01:00
Matias Griese
4945160bc7 Merge branches 'develop' and 'feature/objects' of https://github.com/getgrav/grav into feature/objects 2017-02-20 10:58:18 +02:00
Andy Miller
17e6e3ec11 Merge branch 'release/1.1.17' 2017-02-17 14:57:59 -07:00
Andy Miller
b969ab7deb Merge tag '1.1.17' into develop
Release v1.1.17
2017-02-17 14:57:59 -07:00
Andy Miller
50b355aaea Prepare for release 2017-02-17 14:57:48 -07:00
Matias Griese
b9424922a2 Changelog update 2017-02-17 10:38:05 +02:00
Matias Griese
14bde9f31f Fix Whoops displaying error page if there is PHP core warning or error (#980) 2017-02-17 10:35:33 +02:00
Flavio Copes
a3ccae5915 Fix GRAV_PHP_MIN for CLI 2017-02-16 10:37:35 +01:00
Flavio Copes
e2cc55a4e3 Fix syntax error in PHP 5.3. Move the version check before requiring the autoloaded deps 2017-02-16 10:16:30 +01:00
Andy Miller
724f24335a Updated changelog 2017-02-15 17:22:53 -07:00
Andy Miller
33a63de4f1 Fix for double extension during some redirects #1307 2017-02-15 17:21:16 -07:00
Pia Mancini
7ab0aee44a add space for sponsor's logo's to show inline (#1308) 2017-02-15 15:14:51 -08:00
Matias Griese
863d92cabf Collection now implements JsonSerializable 2017-02-15 12:25:36 +02:00
Matias Griese
eae222f264 Update Collection classes to be based on Doctrine Collections 2017-02-15 11:44:14 +02:00
Matias Griese
76c870ce04 Add new collection and object classes 2017-02-10 20:53:35 +02:00
Andy Miller
3e786e0ea9 Merge tag '1.1.16' into develop
Release v1.1.16
2017-02-10 11:52:33 -07:00
Andy Miller
994793acea Merge branch 'release/1.1.16' 2017-02-10 11:52:33 -07:00
Andy Miller
5b03125150 Prepare for release 2017-02-10 11:52:21 -07:00
Andy Miller
c36b26878f Updated changelog 2017-02-10 11:51:30 -07:00
Matias Griese
f8822de6fe Misc fixes to classes (type hinting, return types, missing variables...) (#1299) 2017-02-09 20:51:56 -07:00
Flavio Copes
97fe8095bd Add Languages::resetFallbackPageExtensions (#1276)
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();
```
2017-02-09 11:38:04 -08:00
Flavio Copes
212d35221a Fix blueprints slug validation (#1292)
* Fix blueprints slug validation

* 255 -> 200
2017-02-09 11:37:11 -08:00
Andy Miller
570b02a760 Added Pages::getPagesCacheId() 2017-02-08 16:38:05 -07:00
Andy Miller
c89914e63d Merge branch 'develop' of https://github.com/getgrav/grav into develop 2017-02-08 10:56:05 -07:00
Andy Miller
929fefbef4 Updated links to https:// 2017-02-08 10:55:57 -07:00
Matias Griese
030b020add Add some missing docblocks and typehints 2017-02-08 11:59:34 +02:00
Andy Miller
9100c54244 Fixes to allow not just ‘default/file’ cache in CLI (#1294)
* Fixes to allow not just ‘default/file’ cache in CLI

* vendor updates

* Better solution

* Added cli_compatibility to system blueprint

* Fall back to ‘file’ if cli_compatibility and (auto or volatile)
2017-02-07 13:48:50 -07:00
Flavio Copes
cab21f9834 Typo 2017-02-03 19:23:54 +01:00
Andy Miller
b707007e7d Added code to error output 2017-02-01 17:51:34 -07:00
Flavio Copes
a4c5d570ae Add query information to default Caddy config 2017-01-31 09:17:22 +01:00
Andy Miller
3dc0e84351 Updated readme with Gitter -> Slack 2017-01-30 18:45:14 -07:00
Andy Miller
993d93b067 Merge branch 'release/1.1.15' 2017-01-30 14:14:16 -07:00
Andy Miller
d269989c50 Merge branch 'release/1.1.15' into develop 2017-01-30 14:14:16 -07:00
Andy Miller
e17721b4bd Prepare for release 2017-01-30 14:13:32 -07:00
Andy Miller
f37bebaacd Added open collective info in readme 2017-01-30 13:29:36 -07:00
Andy Miller
f287dab16d Need to experiment more.. This is causing more issues than it fixes. 2017-01-30 13:19:21 -07:00
Andy Miller
31fe300a1e Merge branch 'develop' of https://github.com/getgrav/grav into develop 2017-01-30 13:17:25 -07:00
Andy Miller
f1faea26e5 Code insight fix 2017-01-30 13:17:20 -07:00
Pia Mancini
422b9907cf Add backers and sponsors from Open Collective (#1281)
This is for your open collective backers and sponsors to appear directly on your README. 
see how it'll look [here](https://github.com/apex/apex#backers)
[More info](https://github.com/opencollective/opencollective/wiki/Github-banner)

Also add badges on top.
2017-01-30 11:47:09 -08:00
Andy Miller
24bffcde80 Don’t set default param_sep, use system constant (#1275)
* Don’t set default param_sep, use system constant, but still allow override

* Automatically fix param_sep on windows

* Reverted back to original system.yaml syntax

* Comment fix

* PSR formating fixes

* Ensure automatic override of `param_sep` is only in cases where it’s different from system + windows + apache
2017-01-30 11:36:37 -07:00
Andy Miller
b7c76b5a53 Composer libs updated 2017-01-30 10:27:03 -07:00
Andy Miller
c7619e5b52 Updated composer libs 2017-01-27 16:45:23 -07:00
Andy Miller
3d05574d08 Merge branch 'develop' of https://github.com/getgrav/grav into develop 2017-01-27 07:21:08 -07:00
Andy Miller
6e8455fde6 Updated composer.phar 2017-01-27 07:20:58 -07:00
Matias Griese
c6c8577b6f Silence E_WARNING: Zend OPcache API is restricted by "restrict_api" configuration directive 2017-01-27 10:29:55 +02:00
A----
108312e8c0 Provided empty alt if '' is supplied (#1262)
* Provided empty alt if '' is supplied

* Fixing some tests

* Regexp tests

* Again.
2017-01-26 16:30:39 -07:00
Andy Miller
060f21f83d Skip symlinks in cache clearing if found - #1269 2017-01-24 20:36:22 -07:00
Flavio Copes
4d904e6f70 Add an additional parameter to GPM::findPackage to avoid throwing an exception, for use in Twig, re #1008 2017-01-22 15:48:26 +01:00
Andy Miller
6968e2edff Fix Response object to handle 303 redirects when open_basedir in effect [#1267] 2017-01-21 16:25:13 -07:00
Andy Miller
300f65c22e Implode an array returned by sort order #1264 2017-01-20 15:17:28 -07:00
Andy Miller
5ecf240c26 Added new Collection::merge() method #1258 2017-01-20 10:47:24 -07:00
Andy Miller
9536f2e418 Merge branch 'release/1.1.14' into develop 2017-01-18 15:13:14 -07:00
Andy Miller
645285ca5c Merge branch 'release/1.1.14' 2017-01-18 15:13:13 -07:00
Andy Miller
c7fd01a644 Prepare for release 2017-01-18 15:12:14 -07:00
Andy Miller
61c0c31992 Fix to allow you to enable content-encoding: identity. Set to ‘none’ by default. #548 2017-01-18 15:02:53 -07:00
Matias Griese
e2ee02a71d Fixed page.collection() returning array and not Collection object when header variable did not exist 2017-01-18 10:42:13 +02:00
Andy Miller
4e283322ea Merge branch 'release/1.1.13' into develop 2017-01-17 13:20:08 -07:00
Andy Miller
b5b452e585 Merge branch 'release/1.1.13' 2017-01-17 13:20:07 -07:00
Andy Miller
138abdcab1 Prepare for release 2017-01-17 13:19:19 -07:00
Andy Miller
bf661c4355 Vendor updates 2017-01-17 12:06:59 -07:00
Flavio Copes
085ca323e2 Fix #1254 issue in trying to process broken symlink 2017-01-17 14:25:42 +01:00
Matias Griese
c22b28f312 Merge remote-tracking branch 'origin/develop' into develop
# Conflicts:
#	CHANGELOG.md
2017-01-13 12:28:23 +02:00
Matias Griese
9b5ef4c263 Fixed all $_GET parameters missing in Nginx (please update your nginx.conf) [#1245](https://github.com/getgrav/grav/issues/1245) 2017-01-13 12:27:21 +02:00
Andy Miller
3cffe74965 Updated changelog 2017-01-12 11:55:10 -07:00
Andy Miller
759ba5143f Added ability to never cache twig. This makes it possible to cache content, but always process twig. Useful for regular but especially modular pages. (#1244) 2017-01-12 11:51:12 -07:00
Andy Miller
9ebff2287c Fixed an error in the ‘file’ type description 2017-01-12 10:59:05 -07:00
Andy Miller
e492fbde21 Hash added to blueprints 2017-01-12 06:40:51 -07:00
Andy Miller
7255556819 Fixed issue with multi-lang site caching non-lang specific pages for all langs #1211 2017-01-11 16:03:51 -07:00
Matias Griese
c718b8f32a Fixed broken hash method on page modifications detection 2017-01-09 21:23:11 +02:00
Andy Miller
07b66dd5d0 Vendor updates 2017-01-06 15:51:14 -07:00
Andy Miller
2e4686fada Updated changelog 2017-01-05 16:04:50 -07:00
ka7
e2544feeaf spelling fixes (#1236) 2017-01-05 16:02:45 -07:00
Andy Miller
970bf77492 Feature/theme dev improvements (#1232)
* Initial improvements to help theme development

* Added default language to site
2017-01-05 16:02:23 -07:00
Flavio Copes
0145f454b7 Merge remote-tracking branch 'origin/develop' into develop
# Conflicts:
#	CHANGELOG.md
2017-01-05 16:25:01 +01:00
Flavio Copes
e984d9b68f Lint 2017-01-05 16:08:37 +01:00
Flavio Copes
1cd6773ded Fix renaming the folder name if the page, in the default language, had a custom slug set in its header 2017-01-05 16:08:25 +01:00
Matias Griese
0445aa707b Fixed issue with Content-Encoding: none. It should really be Content-Encoding: identity instead 2017-01-05 12:03:22 +02:00
Flavio Copes
cc96d160a4 Try rename before doing copy&delete 2017-01-04 16:43:56 +01:00
Flavio Copes
4331ab374e Fix issue with pages folders validation not accepting uppercase letters 2017-01-04 16:35:38 +01:00
Flavio Copes
61005360a5 Add a better fix for #635. Overwrites https://github.com/getgrav/grav/pull/1214 2017-01-03 21:39:57 +01:00
Flavio Copes
335c44385a Fixes #635 use mv instead of rename as that does not support cross volume operations (#1214)
* Fixes #635 use mv instead of rename as that does not support cross volume operations

* Handle case exec is disabled

* Handle case is windows, where mv does not work

* Move isWindows check to Utils
2017-01-03 09:28:25 +01:00
Nicolas Lœuillet
88e9ad3df2 Updated gitignore for user/config/security.yaml (#1231) 2017-01-02 20:51:33 -07:00
Andy Miller
2b19414598 Merge branch 'release/1.1.12' 2016-12-26 09:50:32 -07:00
Andy Miller
b00cd00259 Merge branch 'release/1.1.12' into develop 2016-12-26 09:50:32 -07:00
Andy Miller
6097431021 Prepare for release 2016-12-26 09:50:18 -07:00
Andy Miller
55a9356681 Fix for #1227 issue - Admin JSON calls throwing errors with debugger on 2016-12-26 09:47:51 -07:00
Flavio Copes
8aee946682 Fix changelog 2016-12-23 16:12:21 +01:00
Andy Miller
523d3a331a Merge branch 'release/1.1.11' into develop 2016-12-22 11:43:10 -07:00
Andy Miller
397107b611 Merge branch 'release/1.1.11' 2016-12-22 11:43:09 -07:00
Andy Miller
342af3deba Prepare for release 2016-12-22 11:42:56 -07:00
Flavio Copes
dc92498cd0 Fix #900 issue with modular pages folders validation 2016-12-22 17:36:53 +01:00
Andy Miller
364209a27d Fixed type on template not found 2016-12-21 15:16:30 -07:00
Andy Miller
46d741a2ed Merge branch 'release/1.1.10' 2016-12-21 13:06:53 -07:00
Andy Miller
b5be9ee3f0 Merge branch 'release/1.1.10' into develop 2016-12-21 13:06:53 -07:00
Andy Miller
e0f17a48d5 Prepare for release 2016-12-21 13:06:42 -07:00
Andy Miller
fa27856bc0 Reworked changelog 2016-12-21 12:50:01 -07:00
Andy Miller
befaf5d387 Improved theme/plugin detect logic 2016-12-21 12:35:58 -07:00
Flavio Copes
9571e992d9 Improve changelog line 2016-12-20 18:05:04 +01:00
Flavio Copes
e40bed5be2 Explicitly expose array_unique Twig filter 2016-12-20 17:37:32 +01:00
Flavio Copes
442249c3a1 Fix issue with Inflector when translation is disabled [https://github.com/getgrav/grav-plugin-simplesearch/issues/87](https://github.com/getgrav/grav-plugin-simplesearch/issues/87) 2016-12-19 21:07:43 +01:00
Flavio Copes
8b8d8bcc5b Fix https://github.com/getgrav/grav-plugin-admin/issues/891 Add pattern for frontend validation of folder slugs 2016-12-17 18:10:19 +01:00
Flavio Copes
d2152cb48e Changelog 2016-12-17 15:09:58 +01:00
Andy Miller
81fc0d47ac Reworked PHP CLI router PR #1218 (#1219) 2016-12-17 15:07:40 +01:00
ChrisGitIt
8450f77443 fixed array handling (#1208)
if the input array looks like this: 
array('valA','valB') (not a keyed array)

The return result before my change was:
array(array('valA'),array('valB'))

The return result after my change is:
array('valA','valB')
2016-12-16 12:09:23 -07:00
Flavio Copes
0ccc34d860 Improve detection of home path. Also allow ~/.grav on Windows, drop ConsoleTrait::isWindows() method, used just for that. (#1204)
* Improve detection of home path. Also allow ~/.grav on Windows, drop ConsoleTrait::isWindows() method, used just for that.

* Extract loadLocalConfig method to ConsoleTrait

* Fix issue with using Yaml::parse direcly on a filename, now deprecated

* Changelog
2016-12-16 19:10:00 +01:00
Flavio Copes
5b6452d89e Revert "Fix #635 use mv instead of rename as that does not support cross volume operations"
This reverts commit d61d260ef1.
2016-12-14 23:17:02 +01:00
Flavio Copes
d61d260ef1 Fix #635 use mv instead of rename as that does not support cross volume operations 2016-12-14 22:40:42 +01:00
Djamil Legato
1125b51f27 Fixed case where extracting a package would cause an error during rename 2016-12-13 18:45:34 -08:00
Andy Miller
bf552e22f1 Merge branch 'release/1.1.9' into develop 2016-12-13 13:06:16 -07:00
182 changed files with 3613 additions and 1760 deletions

1
.gitignore vendored
View File

@@ -26,6 +26,7 @@ user/plugins/*
user/themes/*
!user/themes/.*
user/localhost/config/security.yaml
user/config/security.yaml
# OS Generated
.DS_Store*

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
# ![](https://avatars1.githubusercontent.com/u/8237355?v=2&s=50) Grav
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/cfd20465-d0f8-4a0a-8444-467f5b5f16ad/mini.png)](https://insight.sensiolabs.com/projects/cfd20465-d0f8-4a0a-8444-467f5b5f16ad) [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/getgrav/grav?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://travis-ci.org/getgrav/grav.svg?branch=develop)](https://travis-ci.org/getgrav/grav)
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/cfd20465-d0f8-4a0a-8444-467f5b5f16ad/mini.png)](https://insight.sensiolabs.com/projects/cfd20465-d0f8-4a0a-8444-467f5b5f16ad) [![Slack](https://grav-chat.now.sh/badge.svg)](https://chat.getgrav.org) [![Build Status](https://travis-ci.org/getgrav/grav.svg?branch=develop)](https://travis-ci.org/getgrav/grav) [![OpenCollective](https://opencollective.com/grav/backers/badge.svg)](#backers) [![OpenCollective](https://opencollective.com/grav/sponsors/badge.svg)](#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.

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

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

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

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

View File

@@ -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.
*/

View File

@@ -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(), '/');
}

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

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

View File

@@ -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.
*/

View File

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

View File

@@ -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.
*/

View File

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

View File

@@ -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.
*/

View 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();
}
}
}

View File

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

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

@@ -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);
}
/**

View File

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

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

@@ -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;
}
/**

View File

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

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

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

View File

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

View File

@@ -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.
*/

View File

@@ -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');
}
}

View File

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

View File

@@ -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.
*/

View File

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

View 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');
}
}
}
}

View File

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

View File

@@ -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) ?: [];
}
}

View File

@@ -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.
*/

View File

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

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

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

View 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.
*/
@@ -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)

View 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.
*/

View File

@@ -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']);
}
}
}
}

View 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.
*/

View 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.
*/

View 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.
*/

View 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.
*/

View 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.
*/

View 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.
*/
@@ -57,7 +57,7 @@ class Link implements RenderableInterface
*
* @param string $method
* @param mixed $args
* @return $this|mixed
* @return mixed
*/
public function __call($method, $args)
{

View 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.
*/
@@ -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