Compare commits

...

627 Commits
1.3.5 ... 1.5.8

Author SHA1 Message Date
Andy Miller
8f588aca99 Merge branch 'release/1.5.8' 2019-02-07 16:04:55 -07:00
Andy Miller
5b34a9bfc4 prepare for release 2019-02-07 16:04:31 -07:00
Andy Miller
ef55d2615f update changelog 2019-02-07 16:03:49 -07:00
Matias Griese
2fa5021a0c Improved User unserialize to not to break the object if serialized data is not what expected 2019-02-01 09:04:01 +02:00
Hamilton Turner
b91574e5c2 Remove unused parameter (#2357) 2019-01-30 13:42:34 -07:00
Stefan Bauer
6d6689b431 Update CHANGELOG.md (#2355) 2019-01-29 10:21:39 +02:00
Andy Miller
95a4ecb0f1 Merge branch 'release/1.5.7' 2019-01-25 14:38:52 -07:00
Andy Miller
ff8cc83b3a Merge tag '1.5.7' into develop
Release v1.5.7
2019-01-25 14:38:52 -07:00
Andy Miller
fbd3bbdbf9 Prepare for release 2019-01-25 14:38:31 -07:00
Andy Miller
f0e58adfbc Updated vendor libraries 2019-01-25 14:37:43 -07:00
Raphaël Droz
f1363877d8 preserve accents in fields containing Twig expr. using unicode (#2279)
When a fields contain accentuated characters, reduce the risk of messing with it by passing unicode characters unescaped.
Twig will deal with them. And fewer backslash-escaping problems will arise.
2019-01-09 13:05:32 -07:00
Basile Trujillo [L0gIn]
e8825beae5 Added support for AWS Cloudfront forwarded scheme header (#2297)
AWS Cloudfront does not provide HTTP_X_FORWARDED_PROTO header but provide a HTTP_CLOUDFRONT_FORWARDED_PROTO header instead
2019-01-09 13:04:32 -07:00
ranitham
394dfad566 Small bugfix for responsive images (#2300)
* Replace spaces in image filename with %20 to avoid parse errors with the srcset attribute

* Update system/src/Grav/Common/Page/Medium/ImageMedium.php

Co-Authored-By: ranitham <ranitha.m@gmail.com>
2019-01-07 21:34:00 -07:00
Rotzbua
680bfef2c3 http to https (#2299) 2019-01-07 21:28:56 -07:00
Andy Miller
28bd4027cd Merge branch 'release/1.5.6' 2018-12-14 15:07:22 -07:00
Andy Miller
108541e0d0 Merge tag '1.5.6' into develop
Release v1.5.6
2018-12-14 15:07:22 -07:00
Andy Miller
54a177279f prepare for release 2018-12-14 15:07:12 -07:00
Andy Miller
b3e9974e95 updated changelog 2018-12-14 15:06:39 -07:00
Matias Griese
708c79cef8 Improved user serialization to use less memory in the session 2018-11-27 10:15:55 +02:00
Stephan Diehl
b6c582ad3a Update InitializeProcessor.php (#2268)
fix redirect_trailing_slash in a multi language page
2018-11-23 23:01:47 -07:00
Andy Miller
5e1980d770 New Discord reference 2018-11-15 16:30:21 -07:00
Andy Miller
5e7eb6b2f4 Better discord badge 2018-11-15 16:29:08 -07:00
Andy Miller
4daa07fd14 Discord Chat button 2018-11-15 16:21:51 -07:00
Djamil Legato
9a8b47872e Updated opencollective backers/sponsors list 2018-11-13 23:05:18 -08:00
Andy Miller
9405418572 Merge branch 'release/1.5.5' 2018-11-12 15:56:13 -07:00
Andy Miller
59ccd662c7 Merge tag '1.5.5' into develop
Release v1.5.5
2018-11-12 15:56:13 -07:00
Andy Miller
377751416b Prepare for release 2018-11-12 15:56:04 -07:00
Andy Miller
116c279f01 update changelog 2018-11-12 15:55:29 -07:00
Aaron Dalton
bf86b5a924 Propagate error code if between 400 and 600 for production sites (errors:display = false or -1) (#2181) 2018-11-11 21:22:47 -07:00
Emil Hesslow
d0b34d114d Register theme prefixes as namespaces in twig (#2210) 2018-11-11 21:18:57 -07:00
Makara Sok
b9dc2baef1 Remove hardcoded 302 when redirecting trailing slash (#2155)
When `system.pages.redirect_trailing_slash` is enabled, it's always a 302 even though `redirect_default_code` is set to something else. 

By removing it, it works as intended.
2018-11-09 22:30:35 -07:00
Andy Miller
72cc5b9d07 Merge tag '1.5.4' into develop
Release v1.5.4
2018-11-05 15:42:04 -07:00
Andy Miller
b9c28c5a7c Merge branch 'release/1.5.4' 2018-11-05 15:42:03 -07:00
Andy Miller
c56d7ac793 prepare for release 2018-11-05 15:41:54 -07:00
Andy Miller
000bac8cfc Updated changelog 2018-11-05 15:41:19 -07:00
Scott Hamper
e7d660149e Fixed markdown parsing for telephone links (#2235)
Telephone links use the `+` character to specify a country code, but Grav was replacing the `+` with a space character.
2018-11-03 14:57:02 -06:00
John Hamrick
829638c143 Update default.md (#2245)
Making documentation consistent between sources:  Issue Typo! #650

In (grav-learn/pages/01.basics/04.basic-tutorial/docs.md) the text under the heading Adding a New Page is 02.mypage 
In (grav/user/pages/01.home/default.md) the text under the heading Adding a New Page is 03.mypage
2018-11-03 14:56:21 -06:00
Matias Griese
d8a627898e Fixed fatal error if calling $session->invalidate() when there's no active session 2018-10-25 16:29:53 +03:00
MattAppleton
a3caa13c23 fix .webm typo (#2220)
Media type should be 'video' not file!
2018-10-16 20:18:32 -06:00
Andy Miller
9944486c17 Merge branch 'release/1.5.3' 2018-10-08 17:41:28 -06:00
Andy Miller
da5c9e415f Merge tag '1.5.3' into develop
Release v1.5.3
2018-10-08 17:41:28 -06:00
Andy Miller
7b5a1b2c14 Prepare for release 2018-10-08 17:41:18 -06:00
Andy Miller
235a5cc765 vendor updates 2018-10-08 17:33:49 -06:00
Andy Miller
073d601b67 Updated changelog 2018-10-06 16:37:11 -06:00
Andy Miller
ad1bbba0b3 Added configurable dangerous upload extensions 2018-10-06 16:35:54 -06:00
Matias Griese
b6b5e329aa Added Utils::getMimeByFilename(), Utils::getMimeByLocalFile() and Utils::checkFilename() methods 2018-10-04 14:44:04 +03:00
Andy Miller
0e973dab07 Merge branch 'release/1.5.2' 2018-10-01 15:33:13 -06:00
Andy Miller
15e371564a Merge tag '1.5.2' into develop
Release v1.5.2
2018-10-01 15:33:13 -06:00
Andy Miller
f0e33dc242 prepare for release 2018-10-01 15:32:29 -06:00
Andy Miller
e67c3c1091 updated changelog 2018-10-01 15:31:39 -06:00
Andy Miller
d5ce0bd93c updated vendor libs 2018-10-01 15:26:44 -06:00
Andy Miller
44dbcdf2b1 Added new XSS Twig function 2018-10-01 14:07:14 -06:00
Andy Miller
3216442946 Merge branch 'develop' of github.com:getgrav/grav into develop 2018-10-01 12:34:14 -06:00
Andy Miller
9d4471b196 Security refactor 2018-10-01 12:34:09 -06:00
Matias Griese
c48107acd9 Merge remote-tracking branch 'origin/develop' into develop 2018-10-01 21:02:11 +03:00
Matias Griese
4671518409 Fixed missing slug in Page::init() 2018-10-01 21:02:04 +03:00
Andy Miller
41bf943f49 get raw content for all pages 2018-09-30 21:11:46 -06:00
Andy Miller
f40c6a8617 Changelog updated 2018-09-30 18:37:42 -06:00
Andy Miller
fb98ca7b19 Added a new Security CLI command 2018-09-30 18:34:53 -06:00
Andy Miller
451ec49d9c refactor 2018-09-30 17:45:45 -06:00
Andy Miller
1709eb038c Fix for array method 2018-09-30 15:24:01 -06:00
Andy Miller
e69d6cefee ordering 2018-09-30 00:10:44 -06:00
Andy Miller
7abe01ed8c vertical style 2018-09-30 00:10:04 -06:00
Andy Miller
17a371d86a lang stuff 2018-09-29 21:37:01 -06:00
Andy Miller
5b787d56e6 Add default XSS security config 2018-09-29 21:24:58 -06:00
Andy Miller
33d98114ba XSS enhancements 2018-09-29 21:24:21 -06:00
Andy Miller
51f29e112a updated composer.json 2018-09-19 13:56:09 -06:00
Matias Griese
ca8805683d Added onHttpPostFilter event to allow plugins to globally clean up XSS in the forms and tasks 2018-09-19 12:09:32 +03:00
Matias Griese
8295bd8243 Added Utils::detectXssFromArray() and Utils::detectXss() methods 2018-09-19 12:06:49 +03:00
Matias Griese
da95d1bb1e Session expires in 30 mins independent from config settings (https://github.com/getgrav/grav-plugin-login/issues/178) 2018-09-13 17:31:11 +03:00
Matias Griese
bbc4fd6c79 Allow twig tags {% script %}, {% style %} and {% switch %} to be placed outside of blocks 2018-09-07 13:13:33 +03:00
Matias Griese
732ff8ecab Fixed nicetime() twig function 2018-09-07 10:36:56 +03:00
Matias Griese
41b7aadbda Fixed duplicate language strings (Yaml 4.1) 2018-09-06 12:34:50 +03:00
Matias Griese
834d6938db Fixed is_safe twig filter option 2018-09-06 10:28:40 +03:00
Andy Miller
dfabceb3d2 Fix for Page::translatedLanguages() #2163 2018-09-05 19:08:42 -06:00
Matias Griese
1808fd3d6e Allow $page->slug() to be called before $page->init() without breaking the page 2018-08-29 15:46:46 +03:00
Matias Griese
0b5c1dcfa7 Deprecation handling fixes 2018-08-26 11:01:17 +03:00
Matias Griese
1369f941f2 Commented out deprecation error on twig for now 2018-08-25 22:08:59 +03:00
Matias Griese
2101c6d0dc Further improve deprecated notices handling 2018-08-24 19:12:59 +03:00
Matias Griese
1993fc6a2c Better detect deprecation notices 2018-08-24 18:26:50 +03:00
Matias Griese
b9b43d1f05 Fixed notice on new deprecation logic 2018-08-24 18:22:07 +03:00
Matias Griese
8d53cf3c77 Add backtraces to the deprecation messages 2018-08-24 14:51:05 +03:00
Matias Griese
756ddaa97d Added Deprecated tab to DebugBar to catch future incompatibilities with later Grav versions 2018-08-24 11:31:51 +03:00
Djamil Legato
89f64e423d Fixed error message 2018-08-23 15:28:16 -07:00
Djamil Legato
ec5596b1a3 Fixed check for install command with symlinks, erroring out when no symlink available 2018-08-23 15:25:57 -07:00
Andy Miller
2de89e31c0 Merge branch 'release/1.5.1' 2018-08-23 13:02:49 -06:00
Andy Miller
9ca5598b6f Merge tag '1.5.1' into develop
Release v1.5.1
2018-08-23 13:02:49 -06:00
Andy Miller
05863276ef prepare for release 2018-08-23 13:02:37 -06:00
Andy Miller
5ac518f311 cast inline/indent to int 2018-08-22 12:54:45 -06:00
Andy Miller
41f488f8da Switch to Grav YAML wrapper that supports native and fallback YAML libs 2018-08-22 12:42:45 -06:00
Matias Griese
6cc6e51878 Added static Grav\Common\Yaml class which should be used instead of Symfony\Component\Yaml\Yaml 2018-08-22 20:59:00 +03:00
Andy Miller
78bcf84127 Merge branch 'develop' of github.com:getgrav/grav into develop
# Conflicts:
#	CHANGELOG.md
2018-08-21 14:10:02 -06:00
Andy Miller
6b224823f1 typo 2018-08-21 14:09:33 -06:00
Andy Miller
2734b2f605 Broken handling of user folder in Grav URI object #2151 2018-08-21 14:09:25 -06:00
Matias Griese
1ee88d5836 Updated deprecated Twig code so it works in both in Twig 1.34+ and Twig 2.4+ 2018-08-20 10:51:58 +03:00
Andy Miller
33fffa6a50 Merge tag '1.5.0' into develop
Release v1.5.0
2018-08-17 11:24:56 -06:00
Andy Miller
dbd825f0b6 Merge branch 'release/1.5.0' 2018-08-17 11:24:55 -06:00
Andy Miller
8ab0078d5a Prepare for release 2018-08-17 11:24:43 -06:00
Andy Miller
c381bc8304 PHP 7.2 by default now 2018-08-16 14:58:19 -06:00
Andy Miller
fb20b58369 changelog update 2018-08-15 17:12:20 -06:00
Andy Miller
906017e0c1 Added system blueprint for strict_mode settings 2018-08-15 17:12:10 -06:00
Andy Miller
266369ee04 unified 1.5.0 changelog entry for clarity 2018-08-15 16:15:37 -06:00
Andy Miller
308ac14dbe Updated changelog 2018-08-15 16:11:47 -06:00
Andy Miller
2a9da76512 Merge branch 'develop' into 1.5 2018-08-15 16:08:42 -06:00
Andy Miller
8e43550841 Updated changelog 2018-08-15 15:52:31 -06:00
Djamil Legato
75ac0201d8 Added support for multiple repos lookup (as array) in .grav/config
This will allow to keep clones of repositories on different folders and still be able to symlink them.

Example of ~/.grav/config:

```
github_repos:
    - /Users/my_user/Projects/grav/
    - /Users/my_user/Projects/personal/
    - /Users/my_user/Projects/work/
```
2018-08-15 13:38:18 -07:00
Andy Miller
8d9efe4ff7 Extra semicolon 2018-08-14 19:47:16 -06:00
Andy Miller
593400743a Fix for plugin order 2018-08-14 19:46:52 -06:00
Matias Griese
42ff8eaeb0 Make ObjectTrait::serialize() overrides easier 2018-08-13 22:28:12 +03:00
Matias Griese
5c2f9946f8 Merge branch 'develop' of https://github.com/getgrav/grav into 1.5 2018-08-13 09:36:07 +03:00
Jascha Geerds
63161e62a2 Fix broken nounce handling (#2121)
* Remove deprecated "getNonceOldStyle" function

This commit removes the following functions:

- getNonceOldStyle
- generateNonceStringOldStyle

The functions have been replaced in newer versions of
grav. It seems to me that they only existed in order to make a
upgrade to a newer version of grav painless (i.e. accept both types of
nonce tokens). Nowadays, existing old style nonces are expired long
time ago so it should be save to delete the deprecated funtions.

* Fix caching of nonces in static class variable

Currently, the behavior of `getNonce` is broken because it saves the
generated nonce in an array and only use the $action as the
key. However, the generated nonce does not only depend on the $action,
but also on $plusOneTick.

* Fix broken "plusOneTick" for nonces

It looks to me that there is a bug in the current implemention of
verifyNonce. Here is an example:

- 2018-08-01 10:00: We respond to a request and generate a nonce. The
  current tick is at 35489

- 2018-08-01 10:05: We use the previously generated nonce to make
  another request. We compare the given nounce with a new generated
  one (based on the same tick). The result is exactly the same and the
  request succeeds.

- 2018-08-01 14:00: We're now one tick ahead. Remember: A day (24
  hours) is separated into two ticks (each 12 hours). A request comes
  in, we compare the given nounce with a newly generated one based on
  the current tick (now at 35490). They don't match (which is totally
  okay).

  If the comparison fails, we then compare the given nounce with a
  another, newly generated one. This time, we pass "plusOneTick", to
  the function, which increases the current tick by one. Our tick is
  now at 35491. We generate a nonce based on that tick and of course,
  it still does not match the given nonce.

  Instead of increasing the tick, we should rather decreasing it by
  one (i.e. use the previous tick). If the first comparison fails, we
  use the current tick (35490), decrease it by one (35489) and then
  compare it again. 35489 is the same tick as in the very first
  request.

This bug leads to a maximum life time of 12 hours for a nonce and in
worst case only a few seconds (!)

I would like to prove the bug with an unit test but I'm too unexperienced
in PHP. Furthermore it seems that we need some kind of library which
is able to mock builtin functions (like "time"). Maybe
<https://github.com/Codeception/AspectMock> would be a good canditate?
2018-08-09 16:05:24 -06:00
lucaswillering
c84983ad5b Add muted and playsinline attributes (#2124)
Fixes: #2099

To be able to add videos to sites that behave as GIFs, two attributes are needed for the videos to be properly handled on iOS and in Chrome: muted and playsinline.

Muted
Chrome only allows videos to autoplay when the contain the muted attribute. Non-muted videos will not autoplay unless the user has interacted with the site. More details here:  https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#new-behaviors

Playsinline
The playsinline attribute allows developers to specify videos on iPhone should play inline and not automatically enter fullscreen mode when playback begins. More details here: https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#new-behaviors
2018-08-09 15:32:53 -06:00
atyner
3cee53508e Typo 'Subscxripted' on default Typography page (#2136) 2018-08-09 15:32:34 -06:00
Matias Griese
fde75e1ed5 Composer update (toolbox) 2018-08-08 21:09:25 +03:00
Matias Griese
16d2f607c8 Fixed Uri::parseUrl($url) with no path (part 2) 2018-08-07 23:12:38 +03:00
Matias Griese
816a3ebd93 Fixed Uri::parseUrl($url) with no path 2018-08-07 22:46:23 +03:00
Matias Griese
d59fe2fa3c Display better exception message if Grav fails to initialize 2018-08-07 22:32:29 +03:00
Matias Griese
ef55e7d219 Added option to disable SimpleCache key validation 2018-08-07 22:30:45 +03:00
Andy Miller
424da520cf Fix #2134 - inheritance of theme classes that include digits in camelcase 2018-08-06 15:37:59 -06:00
Andy Miller
08cb311e5e Fix truncator tests 2018-08-06 15:36:38 -06:00
Andy Miller
e1b5875c5b Update vendor libs 2018-08-06 15:22:55 -06:00
Andy Miller
7d27206fec Fixed #2133 - uppercase fallback media urls 2018-08-06 14:56:00 -06:00
Andy Miller
18d405d798 Improved Utils::url() to support query strings 2018-08-06 13:09:15 -06:00
Matias Griese
34fa50fcf0 Added FormatterInterface::getDefaultFileExtension() 2018-08-03 13:19:26 +03:00
Matias Griese
ca3cf2ea3c Added FormatterInterface::getSupportedFileExtensions() method, deprecated getFileExtension() 2018-08-03 13:03:51 +03:00
Matias Griese
76fb11366b Added Uri::method() to get current HTTP method (GET/POST etc) 2018-08-02 22:41:54 +03:00
Andy Miller
e4f2808870 prepare for release 2018-07-31 11:27:49 -06:00
Andy Miller
f7496b5341 Merge branch 'develop' into 1.5
# Conflicts:
#	CHANGELOG.md
#	composer.lock
#	system/defines.php
2018-07-31 11:27:08 -06:00
Andy Miller
2f0d600e86 Merge tag '1.4.8' into develop
Release v1.4.8
2018-07-31 11:23:36 -06:00
Andy Miller
fa7e6be95a Merge branch 'release/1.4.8' 2018-07-31 11:23:35 -06:00
Andy Miller
cea43a2d21 Prepare for release 2018-07-31 11:23:24 -06:00
Andy Miller
b7387c8741 vendor updates 2018-07-31 11:23:15 -06:00
Andy Miller
c83852f4e1 update changelog 2018-07-31 11:20:49 -06:00
Andy Miller
ce271cf389 Merge branch 'develop' of github.com:getgrav/grav into develop 2018-07-31 11:17:09 -06:00
Matias Griese
ead125d599 Merge branch 'develop' of https://github.com/getgrav/grav into 1.5 2018-07-30 12:10:24 +03:00
Andy Miller
8ee367e52e Don't allow null to be set as Page content 2018-07-27 15:05:45 -06:00
Jeremy Gonyea
db03091cff Added nginx config for hosting in a ddev project (#2117) 2018-07-27 14:23:35 -06:00
Matias Griese
6b5849b207 Added MediaTrait::getMediaCache() to allow custom caching 2018-07-20 22:54:22 +03:00
Matias Griese
ba0a8c4092 Added MediaTrait::clearMediaCache() to allow cache to be cleared 2018-07-20 22:25:22 +03:00
Matias Griese
c8ab5d34f7 Merge branch 'develop' into 1.5
# Conflicts:
#	CHANGELOG.md
#	system/defines.php
2018-07-19 10:05:26 +03:00
Hugh Barnes
c9367ba4f3 Add Grav version to debug bar Messages tab (#2106) 2018-07-18 19:03:25 -06:00
Matias Griese
a754f697d7 Added twig filters for casting values: |string, |int, |bool, |float, |array
Made `|markdown` filter HTML safe
2018-07-14 13:22:35 +03:00
Matias Griese
dd75ce515f Code style fix on Twig tags 2018-07-14 12:12:53 +03:00
Andy Miller
ea83b46bfb Prepare for release 2018-07-13 16:54:32 -06:00
Andy Miller
e7f628233d Update changelog 2018-07-13 16:47:49 -06:00
Andy Miller
24edf15e16 Merge branch 'release/1.4.7' 2018-07-13 16:38:56 -06:00
Andy Miller
70e65129d7 Merge tag '1.4.7' into develop
Release v1.4.7
2018-07-13 16:38:56 -06:00
Andy Miller
a5e97ef846 Prepare for release 2018-07-13 16:38:46 -06:00
Andy Miller
8a1f0d4932 update changelog 2018-07-13 16:38:04 -06:00
Andy Miller
f29997a5cf Minor vendor updates 2018-07-13 16:35:51 -06:00
Matias Griese
4daec6908c Merge branch 'develop' of https://github.com/getgrav/grav into 1.5 2018-07-06 09:17:41 +03:00
Timothy Cyrus
79bff58021 Change getBasename to getFilename where possible (#2087)
* Update Pages.php

* Update Themes.php

* Update Installer.php

* Update Plugins.php

* Update ConfigFileFinder.php
2018-07-05 14:14:57 -06:00
Matias Griese
05028d0d9b Changelog update 2018-07-05 13:14:17 +03:00
Matias Griese
b4148804e1 Criteria: Added support for LENGTH(), LOWER(), UPPER(), LTRIM(), RTRIM() and TRIM() 2018-07-05 13:12:59 +03:00
Matias Griese
07f8dfb1c5 Made ObjectCollection::matching() criteria expressions to behave more like in Twig 2018-07-05 12:27:28 +03:00
Matias Griese
f3c559f1c7 Composer update (Fixes blueprint issues) 2018-07-05 10:13:36 +03:00
Matias Griese
48a3228efd Merge remote-tracking branch 'origin/1.5' into 1.5
# Conflicts:
#	CHANGELOG.md
2018-07-05 10:07:14 +03:00
Matias Griese
be661e8685 Merge branch 'develop' of https://github.com/getgrav/grav into 1.5
# Conflicts:
#	CHANGELOG.md
2018-07-05 10:06:27 +03:00
Timothy Cyrus
a0918dfc4f Update Media.php (#2083)
Fixes getgrav/grav-plugin-admin#1330
2018-07-02 23:46:44 +01:00
Andy Miller
d214080974 Merge branch 'develop' into 1.5
# Conflicts:
#	CHANGELOG.md
2018-07-02 16:05:56 -06:00
Andy Miller
a09c6b1088 Fix for Page::routeCanonical accpeting string #2069 2018-06-22 11:59:22 +01:00
Andy Miller
dfed333e1b Set html in admin not in here… 2018-06-20 23:38:41 +01:00
Andy Miller
578e12940b Fix for modular page preview #2066 2018-06-20 22:56:27 +01:00
Andy Miller
7d215f95cf Merge tag '1.4.6' into develop
Release v1.4.6
2018-06-20 19:38:40 +01:00
Andy Miller
5435ee60d8 Merge branch 'release/1.4.6' 2018-06-20 19:38:39 +01:00
Andy Miller
761d79272c Prepare for release 2018-06-20 19:37:15 +01:00
Matias Griese
68a9552877 Merge branch 'develop' of https://github.com/getgrav/grav into 1.5
# Conflicts:
#	composer.json
#	composer.lock
2018-06-20 11:56:55 +03:00
Matias Griese
d72eca7fb5 Force Rockettheme/Toolbox to version 1.3.* in Grav 1.4 series 2018-06-20 11:11:46 +03:00
Matias Griese
ca9dba1372 Move wrongly placed items in changelog to the latest release 2018-06-20 10:57:57 +03:00
Matias Griese
7aa688ecbb Merge branch 'develop' of https://github.com/getgrav/grav into 1.5
# Conflicts:
#	CHANGELOG.md
#	system/defines.php
2018-06-20 10:51:52 +03:00
Andy Miller
794db2e3e5 set version as beta.1 2018-06-19 19:15:22 +01:00
Andy Miller
ba457f7bf3 composer update 2018-06-19 19:11:22 +01:00
Andy Miller
64715573a1 Update changelog 2018-06-19 18:46:42 +01:00
Andy Miller
8288551531 Merge tag '1.4.6' into develop
Release v1.4.6

# Conflicts:
#	system/defines.php
2018-06-19 18:45:32 +01:00
Andy Miller
34cc3781d6 Merge branch 'release/1.4.6' 2018-06-19 18:42:55 +01:00
Andy Miller
4eb986643c Merge tag '1.4.6' into develop
Release v1.4.6
2018-06-19 18:42:55 +01:00
Andy Miller
290e5be534 Prepare for release 2018-06-19 18:42:40 +01:00
Andy Miller
aea26f4db9 Updated changelog 2018-06-19 18:38:48 +01:00
Matias Griese
bf5e742a7f Revert Medium object cloning for now (has unexpected side effects) [#2045] 2018-06-15 09:51:42 +03:00
Matias Griese
9816b538f9 Merge branch 'develop' of https://github.com/getgrav/grav into 1.5
# Conflicts:
#	composer.lock
2018-06-15 09:22:46 +03:00
Matias Griese
bd21b7f966 Fixed image resource memory deallocation (part 2) [#2045] 2018-06-15 09:17:50 +03:00
Matias Griese
021fbb8ecd Merge remote-tracking branch 'origin/develop' into develop 2018-06-15 09:03:57 +03:00
Matias Griese
6d7e9ba107 Fixed image resource memory deallocation [#2045] 2018-06-15 09:03:51 +03:00
Matias Griese
bbfbdec483 Added setting to disable sessions from the site [#2013] 2018-06-14 19:23:35 +03:00
Andy Miller
62a32ab5c5 vendor updates 2018-06-14 16:00:31 +01:00
Matias Griese
2e3a64fcef Fixed incorrect routing with setup.php based base [#1892] 2018-06-14 14:55:08 +03:00
Matias Griese
ecdbff68d8 Fixed crash on IIS (Windows) with open_basedir in effect [#2053] 2018-06-14 14:31:29 +03:00
Matias Griese
9ca427e369 Composer update (rockettheme/toolbox => 1.4) 2018-06-14 12:46:27 +03:00
Matias Griese
228757a5ba Composer update (rockettheme/toolbox => dev-develop) 2018-06-12 13:06:58 +03:00
Matias Griese
027a760ce2 Added function Session::clear() 2018-06-12 12:06:14 +03:00
Matias Griese
0a3cadc6b2 Composer update 2018-06-12 10:55:38 +03:00
Matias Griese
04ea069280 Fixed routing issues with multisite and multilanguage (Grav 1.5 edition) (#2046)
* Fixed routing issues with multisite and multilanguage (#1501)
2018-06-12 10:48:13 +03:00
Matias Griese
280d54057c Merge branch 'develop' of https://github.com/getgrav/grav into 1.5 2018-06-12 10:40:42 +03:00
Jean-Baptiste Alleaume
036fc2d2af Modular template extension follows the master page extension (#2044) 2018-06-08 22:00:07 +00:00
Hydraner
ab58cca3f7 Add getter methods for original and action to the Page object. (#2005) 2018-06-08 21:37:44 +00:00
Jeremy Bouquain
f883820c6a Handle multibyte strings in truncateLetters (#2007) 2018-06-08 21:37:06 +00:00
Lauri Nurmi
9053f9ab44 Use @example.com in default email addresses. (#2020)
It could be a bad idea to use default email addresses that could really
exist. Instead, use example.com, which RFC2606 defines as one of the
domains reserved for examples.
2018-06-08 21:36:38 +00:00
Felipe Fonseca
bd7706a38e pointing fastcgi_pass path to match php7.0-fpm (on debian stretch) (#2021) 2018-06-08 21:36:11 +00:00
Tuukka Norri
da7a93527d Fix image memory use (#2045)
* Add a method for freeing the image file, free each derivative after it has been created

* Save the scaled derivative on disk before freeing it, store its path
2018-06-08 21:33:40 +00:00
Matias Griese
9f7534153e Merge branch 'develop' of https://github.com/getgrav/grav into 1.5
# Conflicts:
#	CHANGELOG.md
2018-06-01 12:37:13 +03:00
Andy Miller
3b4296c7a4 fix for URI’s with no authority // eg mailto:blah@blah.com 2018-05-31 17:48:48 -06:00
Andy Miller
8e065e1109 Fix classes on non-http based protocol links #2034 2018-05-31 14:28:48 -06:00
Andy Miller
93f3fa9685 Updated changelog 2018-05-31 14:08:01 -06:00
Andy Miller
27a9390ec7 Re-added SSL off-loading that was lost with Grav v1.4.0 merge #1888 2018-05-31 14:05:33 -06:00
Matias Griese
62a8d8b203 Add method MediaInterface::getMediaOrder() and implement it 2018-05-31 20:04:16 +03:00
Matias Griese
d7bd0bf1df Merge branch 'develop' of https://github.com/getgrav/grav into 1.5
# Conflicts:
#	CHANGELOG.md
2018-05-31 12:28:19 +03:00
Ante Drnasin
9eded2ef39 Update robots.txt (#2043)
When using "Fetch and Render as Google" in Google Search console it will report "partial" rendering due to the blocked images in /user/images directory which is blocked because of the Disallow /user/ rule. Proposing this small change as it improves google rendering of the page.
2018-05-30 11:47:21 -06:00
Andy Miller
636bc97d29 handle errors.display properly admin#1452 2018-05-29 09:26:52 -06:00
Matias Griese
3ccadded97 Fixed blueprint field validation: Allow numeric inputs in text fields 2018-05-22 10:42:30 +03:00
Andy Miller
b82c17ea56 Fixed typo in trucate #1943 2018-05-20 12:01:38 -06:00
Matias Griese
a0946c67b9 Implement SessionInterface 2018-05-17 10:46:13 +03:00
Matias Griese
00376d3118 Session code cleanup, add changelog entries 2018-05-17 10:22:14 +03:00
Matias Griese
e8fd5405a7 Merge branch 'feature/session' of https://github.com/getgrav/grav into 1.5 2018-05-17 10:14:10 +03:00
Matias Griese
eae017a30a Merge branch 'develop' of https://github.com/getgrav/grav into feature/session 2018-05-17 10:10:16 +03:00
Andy Miller
718dfa9b5d Merge branch 'develop' into 1.5
# Conflicts:
#	CHANGELOG.md
#	system/defines.php
#	system/src/Grav/Common/User/User.php
2018-05-15 17:55:50 -06:00
Andy Miller
03a0c42795 Merge branch 'release/1.4.5' 2018-05-15 12:55:39 -06:00
Andy Miller
1976471982 Merge tag '1.4.5' into develop
Release v1.4.5
2018-05-15 12:55:39 -06:00
Andy Miller
1426a7ec95 prepare for release 2018-05-15 12:55:27 -06:00
Andy Miller
2a759eed74 updated changelog 2018-05-15 11:46:54 -06:00
Andy Miller
8980b78220 Revert "Add MIME type to video <source> tag (#1992)"
This reverts commit e60fd82400.
2018-05-15 11:45:36 -06:00
Andy Miller
12b0a839e7 Merge branch 'develop' of github.com:getgrav/grav into develop 2018-05-15 11:43:42 -06:00
Andy Miller
b4d570fd21 updated changelog 2018-05-15 11:43:37 -06:00
Christian Weiske
e60fd82400 Add MIME type to video <source> tag (#1992) 2018-05-15 11:39:50 -06:00
Davide Liessi
a1abcfd067 Move fix for #1114 to Truncator::truncateLetters (#2004)
* Move fix for #1114 to Truncator::truncateLetters

The original fix provided by #1125 in Utils::truncateHtml compared the
summary size with the full HTML string length.
Thus, the string was still being truncated (and the HTML rewritten) even
when only the HTML string length, and not the text length, exceeded the
summary size.

* Add fix for #1114 also to Truncator::truncateWords
2018-05-15 11:38:48 -06:00
Christian Weiske
7f90ad8474 Do not crash when generating URLs with arrays as parameters (#2018)
When using a default image derivatives (#1979) setting like

  images:
    defaults:
      derivatives: [300,600]

then Grav crashes when a video gets embedded.
The following error occurs:

  rawurlencode() expects parameter 1 to be string, array given
  system/src/Grav/Common/Page/Medium/Medium.php:521

This patch encodes array URL parameters correctly.
2018-05-15 11:37:18 -06:00
Andy Miller
e1d52181a3 updated changelog 2018-05-15 11:36:20 -06:00
Matias Griese
d4494cb502 Fixed users getting logged out after Grav upgrade 2018-05-15 16:26:11 +03:00
Andy Miller
11266ce8f8 Revert "Add special handling for User authenticated and authorized properties"
This reverts commit 8e0e3e8718.
2018-05-14 18:25:36 -06:00
Andy Miller
2f17b3fa7d Revert "Add special handling for User authenticated and authorized properties"
This reverts commit 8e0e3e8718.
2018-05-14 18:25:19 -06:00
Matias Griese
dab595f571 Merge branch 'develop' of https://github.com/getgrav/grav into 1.5
# Conflicts:
#	system/defines.php
2018-05-14 21:25:35 +03:00
Matias Griese
afe72d0783 Merge remote-tracking branch 'origin/develop' into develop 2018-05-14 21:24:03 +03:00
Matias Griese
8e0e3e8718 Add special handling for User authenticated and authorized properties 2018-05-14 21:23:56 +03:00
Matias Griese
5ab956a8ec Fixed Route::withQueryParam() to accept array values 2018-05-14 12:30:30 +03:00
Andy Miller
a17554c951 Merge branch 'release/1.4.4' 2018-05-11 16:07:38 -06:00
Andy Miller
30ff986603 Merge tag '1.4.4' into develop
Releaase v1.4.4
2018-05-11 16:07:38 -06:00
Andy Miller
18f46d902d Prepare for release 2018-05-11 16:07:27 -06:00
Andy Miller
3948ed5618 updated changelog 2018-05-11 16:06:54 -06:00
Matias Griese
e6dd91f698 Added authorized support (2FA)
(cherry picked from commit 2c82e15)
2018-05-10 19:58:39 +03:00
Matias Griese
2c82e15fa1 Added authorized support (2FA) 2018-05-10 19:56:56 +03:00
Andy Miller
2c7d866724 alignment of parens 2018-05-09 22:43:26 -06:00
Andy Miller
a977023e45 minor vendor updates 2018-05-09 14:43:28 -06:00
Djamil Legato
9c7008e225 Enable markdown support for 2FA account field description 2018-05-09 10:41:23 -07:00
Matias Griese
342aa0ff04 Added MediaTrait::getMediaUri() 2018-05-09 14:01:20 +03:00
Matias Griese
d434d51d42 Merge remote-tracking branch 'origin/1.5' into 1.5 2018-05-08 21:00:24 +03:00
Matias Griese
f03eb693e6 Rename object key back to _key 2018-05-08 21:00:16 +03:00
Andy Miller
18928d6962 Revert "fire onPluginsInitialized event"
This reverts commit f7832e78dc.
2018-05-08 09:48:56 -06:00
Andy Miller
f7832e78dc fire onPluginsInitialized event 2018-05-07 21:32:00 -06:00
Matias Griese
68428a714a Change exception type in ContentBlock::fromArray() 2018-05-07 15:24:43 +03:00
Matias Griese
58db31a7d8 Added support for ContentBlock checksums 2018-05-07 14:58:50 +03:00
Matias Griese
2917345b56 Improve ObjectTrait 2018-05-04 21:43:12 +03:00
Matias Griese
1cfd3482bb Added Grav\Common\Media interfaces and trait; use those in Page and Media classes
Added `Grav\Common\Page` interface to allow custom page types in the future
2018-05-04 19:06:37 +03:00
Matias Griese
4d690938a8 Merge branch 'develop' of https://github.com/getgrav/grav into 1.5 2018-04-30 12:37:01 +03:00
Dmitry Yakovlev
40b475ecb9 Fix hardcoded string (#1993)
Fix hard-coded string "Modular Setup" to improve internationalization. Needs new string PLUGIN_ADMIN.MODULAR_SETUP in Admin plugin language file.
2018-04-28 11:29:28 -06:00
Gabriel Caruso
4ab0a601ad Use array_key_exists instead of in_array + array_keys (#1991) 2018-04-28 11:25:41 -06:00
Gabriel Caruso
40ba5e9106 Use dedicated PHPUnit assertions (#1990)
Signed-off-by: Gabriel Caruso <carusogabriel34@gmail.com>
2018-04-28 11:24:43 -06:00
Christian Weiske
d4ec2a25d4 Add default configuration for images (#1979)
This patch allows configuring image processing instructions
for all images.
A use case is generating a fixed set of sizes (derivatives) for
all images, without having to specify them in the content markdown.

Example configuration in user/config/system.yaml:

images:
  defaults:
    derivatives: "[300,600,1200]"
2018-04-28 11:24:14 -06:00
Andy Miller
0b1c18d63e Added Uri::post() and Uri::getConentType() 2018-04-27 16:44:38 -06:00
Andy Miller
f681f1c60b resolve streams earlier 2018-04-27 16:18:16 -06:00
Andy Miller
27df27d1df resolve streams earlier 2018-04-27 16:17:52 -06:00
Andy Miller
027dbcf6fa Added Uri::post() and Uri::getConentType() 2018-04-27 15:40:03 -06:00
Matias Griese
91e98cd32e Added RouteFactory::createFromString() rename MarkdownFormatter configuration option 2018-04-27 20:41:05 +03:00
Matias Griese
1cef2a182a Added Grav\Common\Media interfaces and trait; use those in Page and Media classes
Added `Grav\Common\Page` interface to allow custom page types in the future
2018-04-27 20:38:57 +03:00
Matias Griese
ad8764897a New classes have wrong namespace 2018-04-24 15:47:31 +03:00
Matias Griese
d2e700eea2 Formatters: Better error handling, allow custom file extension 2018-04-24 12:22:06 +03:00
Matias Griese
895e145d82 Added new Grav\Framework\File\Formatter classes for encoding/decoding YAML, MarkDown, JSON, INI and PHP serialized formats 2018-04-24 11:41:55 +03:00
Matias Griese
78ab2aa476 Minor improvement on session check (using PHP 5.4+ way) 2018-04-23 09:40:31 +03:00
Matias Griese
b9a7341e5e Composer update to fix YAML issues 2018-04-22 19:09:05 +03:00
Matias Griese
261ea62472 Added compatibility mode to fall back to Symfony YAML 2.8 when needed 2018-04-20 14:03:49 +03:00
Matias Griese
fae2aa4582 Added compatibility mode to fall back to Symfony YAML 2.8 when needed 2018-04-20 11:18:01 +03:00
Matias Griese
fb7230ec9a Merge branch 'develop' of https://github.com/getgrav/grav into 1.5
# Conflicts:
#	CHANGELOG.md
2018-04-20 10:24:06 +03:00
Andy Miller
692aff3c89 SORT_REGULAR for dates #1910 2018-04-18 18:37:34 -06:00
Andy Miller
3091a14223 Improve support for regex redirects with query and params #1983 2018-04-18 15:02:53 -06:00
Andy Miller
a49f3d460e allow type to be passed 2018-04-18 10:43:27 -06:00
Andy Miller
b6e0f8b75a Added a Medium::thumbnailExists() method 2018-04-17 23:29:23 -06:00
Andy Miller
ac8a1191f8 Fix for custom_base_url not routing properly 2018-04-17 19:04:16 -06:00
Matias Griese
830c9524eb Merge branch 'develop' of https://github.com/getgrav/grav into feature/session 2018-04-16 09:33:07 +03:00
Matias Griese
ce1e635451 Minimum PHP requirement was 5.6.4, not 5.6.0 2018-04-14 17:42:13 +03:00
Matias Griese
8b0c1b7937 Updated Symfony Components to 3.4, causing some compatibility issues with YAML files 2018-04-14 13:23:54 +03:00
Matias Griese
33cfa17899 Fix couple of deprecated extend@s 2018-04-14 13:00:40 +03:00
Matias Griese
87b0d80de0 PHP 5.6.0 minimum, updated to Doctrine Collections 1.4 2018-04-14 12:28:00 +03:00
Matias Griese
b8c61e34c9 Improve session error if it fails to start 2018-04-14 11:50:22 +03:00
Matias Griese
02555ba3f5 Merge branch 'develop' of https://github.com/getgrav/grav into feature/session 2018-04-13 21:04:40 +03:00
Andy Miller
4db2b75699 Merge tag '1.4.3' into develop
Release v1.4.3
2018-04-12 15:54:26 -06:00
Andy Miller
c64590af16 Merge branch 'release/1.4.3' 2018-04-12 15:54:25 -06:00
Andy Miller
3607124e55 Prepare for release 2018-04-12 15:54:16 -06:00
Andy Miller
e7405a13fc Revert "Test fixes for session/parsedown changes, jquery update, quark default theme"
This reverts commit cad10b6095.

# Conflicts:
#	CHANGELOG.md
2018-04-12 15:28:53 -06:00
Andy Miller
46f16ce4db Note about updated vendor libs 2018-04-12 15:26:26 -06:00
Andy Miller
d3a4466d9b Updated changelog 2018-04-12 15:25:29 -06:00
Andy Miller
46d682f889 Revert "Fix for audio/video parsedown #1924"
This reverts commit 33cfa5e104.

# Conflicts:
#	CHANGELOG.md
2018-04-12 15:25:19 -06:00
Matias Griese
2b17bf70de Merge branch 'develop' of https://github.com/getgrav/grav into feature/session 2018-04-10 09:47:59 +03:00
Andy Miller
8e019b7958 Updated changelog 2018-04-09 14:38:46 -06:00
Andy Miller
47037e3f5e moved sortArrayByKey logic into Utils:: 2018-04-09 14:35:44 -06:00
Andy Miller
1ec653268d Parsedown 1.8 breaks things, need to fix when final is released 2018-04-09 12:00:07 -06:00
Andy Miller
3ee140e77f Revert "Temporarily using parsedown dev-master to address HTML encoding issues #1921"
This reverts commit ff2df04a58.
2018-04-09 11:58:52 -06:00
Rex Kelly
cb490a1762 Add overriding of setup.php config file, via constants (#1945)
I'm working on a custom install of Grav, where being able to dynamically swap setup files was required. I've modified the $file assignment to permit overriding it's value via a defined constant, "GRAV_SETUP_PATH".

And I thought that might be useful to others, so I'm submitting a pull request.
2018-04-09 11:35:49 -06:00
Raul E Watson
6d8ba5ed4d Update CHANGELOG.md (#1958)
Fixed small typos in changelog
2018-04-09 11:34:56 -06:00
michielStaes
7020130511 Readme.md was missing info regarding the 'composer test-windows' command (#1970) 2018-04-09 11:34:36 -06:00
Andy Miller
ff2df04a58 Temporarily using parsedown dev-master to address HTML encoding issues #1921 2018-04-02 18:04:40 -06:00
Djamil Legato
3248b97997 Reverted zip changes while adding extra details about unzip failure 2018-03-29 13:07:11 -07:00
Djamil Legato
3c26d831fd Refactored Installer (zip) change to maintain consistency in the errorCode 2018-03-29 12:15:34 -07:00
Andy Miller
f4e584cda1 Fix for bad ZipArchive references 2018-03-24 13:49:56 -06:00
Andy Miller
df7e9b9c1f Merge tag '1.4.2' into develop
Release v1.4.2
2018-03-21 11:49:38 -06:00
Andy Miller
1108d063ef Merge branch 'release/1.4.2' 2018-03-21 11:49:37 -06:00
Andy Miller
a6306aae05 Prepare for release 2018-03-21 11:49:28 -06:00
Andy Miller
fdf79caf71 updated changelog 2018-03-21 11:19:47 -06:00
Matias Griese
f31f7f0962 Added Grav\Framework\Session class to replace RocketTheme\Toolbox\Session\Session
Improved session handling, allow all session configuration options in `system.session.options`
2018-03-21 12:45:57 +02:00
Matias Griese
df185621ad Composer update (Add missing PSR-7 requirements) 2018-03-21 11:29:26 +02:00
Andy Miller
301429d992 Merge branch 'develop' of github.com:getgrav/grav into develop 2018-03-20 10:33:32 -06:00
Andy Miller
07db8a2f9d Updated composer binary 2018-03-20 10:33:26 -06:00
Matias Griese
3a207843c7 Merge branch 'develop' of https://github.com/getgrav/grav into feature/1.4 2018-03-20 09:22:19 +02:00
Andy Miller
8f1639c10b case for case sensitive metadata grav-admin-plugin#1370 2018-03-18 21:37:17 -06:00
Andy Miller
b515a5add0 updated changelog 2018-03-18 12:57:40 -06:00
Andy Miller
33cfa5e104 Fix for audio/video parsedown #1924 2018-03-18 12:55:20 -06:00
Mujib Azizi
83b85e2cac Re-add .gitkeep to keep the backup folder. (#1913) 2018-03-18 11:59:19 -06:00
Mathieu Santostefano
861eb43efa Remove duplicate entry (#1916) 2018-03-18 11:58:40 -06:00
Al-Demon
a20d6d7230 Update LanguageCodes.php (#1917)
Add Bosnian LanguageCode
2018-03-18 11:57:16 -06:00
Andy Miller
40e7ee79b4 Added more detailed error handling (#1922) 2018-03-18 11:56:59 -06:00
Paul Massendari
dce97221c5 Small typo in default page (#1923) 2018-03-16 12:37:08 -07:00
Matias Griese
fea02736c5 Changelog: fixed typo 2018-03-15 10:45:37 +02:00
Andy Miller
d58ad3749d Fixed a test 2018-03-13 16:17:46 -06:00
Andy Miller
727f759b41 Added some twig stuff 2018-03-13 16:10:12 -06:00
Andy Miller
f42d59409b updaetd clean command with some minor changes 2018-03-11 16:28:50 -06:00
Andy Miller
4adaead4ec Merge branch 'release/1.4.1' 2018-03-11 16:13:03 -06:00
Andy Miller
8dbe248df1 Merge tag '1.4.1' into develop
Release v1.4.1
2018-03-11 16:13:03 -06:00
Andy Miller
0e26422613 Prepare for release 2018-03-11 16:12:55 -06:00
Matias Griese
234555b208 Fixed session timing out because of session cookie was not being sent 2018-03-11 21:52:49 +02:00
Andy Miller
3cfc3f1cbe Merge tag '1.4.0' into develop
Release v1.4.0
2018-03-09 13:03:06 -07:00
Andy Miller
9b149307ef Merge branch 'release/1.4.0' 2018-03-09 13:03:05 -07:00
Andy Miller
4c1d1dd5d0 Prepare for release 2018-03-09 13:02:50 -07:00
Andy Miller
cad10b6095 Test fixes for session/parsedown changes, jquery update, quark default theme 2018-03-09 12:45:27 -07:00
Andy Miller
7aa930ca55 Merge branch '1.4' into develop
# Conflicts:
#	system/src/Grav/Common/Twig/TwigExtension.php
#	system/src/Grav/Common/Uri.php
#	tests/unit/Grav/Common/AssetsTest.php
2018-03-09 12:43:08 -07:00
Matias Griese
7e1c6b6137 Do not initialize session in CLI and unit tests 2018-03-09 21:07:44 +02:00
Andy Miller
d008376169 Updated parsedown + toolbox 2018-03-08 17:08:20 -07:00
Andy Miller
eaac77881f Force clearing PHP clearstatcache and opcache-reset on Cache::clear() 2018-03-08 14:52:49 -07:00
Andy Miller
43ca0a2f58 vendor updates 2018-03-07 11:57:55 -07:00
Andy Miller
54cd7f85b8 theme_var() twig function now checks page header var first 2018-03-02 15:39:59 -06:00
Andy Miller
5ffe32ef58 Fix alt tag issue #1883 2018-03-01 15:30:51 -06:00
Andy Miller
b0ad83ebf7 support both alt and alt_text 2018-03-01 15:13:42 -06:00
mahagr
d5060a2012 Framework\Route::getRoute() return relative path only if offset isn't 0 2018-02-25 17:38:55 -06:00
mahagr
bf16e2e854 Framework\Route::getRoute() with parameters should return relative path 2018-02-25 17:37:23 -06:00
mahagr
ec78319993 Add Framework\Route::getRoute() parameters 2018-02-25 17:35:01 -06:00
mahagr
67b5649ee4 Add Framework\Route::getRouteParts() function 2018-02-25 17:29:29 -06:00
CSixtyFour
eca23a918a Fix for #1827 (#1888)
Modified Build scheme and Build port functions to take into account those in SSL offloading situations.
2018-02-24 11:00:26 -07:00
Andy Miller
5b291f8f54 Added Route overrides 2018-02-22 16:14:24 -07:00
Matias Griese
274c701907 Improved Object serialize()/unserialize() 2018-02-22 09:00:41 +02:00
Andy Miller
e533024b2e Added {% switch %} twig tag 2018-02-21 23:00:37 -07:00
Andy Miller
8750602f76 Added new {% markdown %} twig tag 2018-02-21 17:28:43 -07:00
Todd Coleman
51a9b9b7c7 Taxonomy Filtering - space characters (#1880)
Taxonomies with spaces were not recognized because they are encoded in the uri.
2018-02-21 10:43:20 -07:00
Matias Griese
42d8836569 Improved Session initialization (#1879) 2018-02-21 10:42:09 -07:00
Matias Griese
7cfc6fbdb8 Merge remote-tracking branch 'origin/1.4' into 1.4 2018-02-21 12:53:48 +02:00
Matias Griese
01886b6df9 Added better session checks, warn in debugbar if session messages cannot be used 2018-02-21 12:53:40 +02:00
Andy Miller
b7d4697db8 changelog updated 2018-02-20 17:30:17 -07:00
Matias Griese
742c6f9baa Fixed issue with UriFactory::parseQuery() 2018-02-20 12:00:17 +02:00
Matias Griese
c97da77153 Merge branch '1.4' of https://github.com/getgrav/grav into 1.4 2018-02-20 11:07:36 +02:00
Matias Griese
871848dc28 Added Grav\Framework\Route classes to allow route/link manipulation
Added `$grav['uri]->getCurrentRoute()` method to get `Grav\Framework\Route\Route` instance for the current URL
2018-02-20 11:07:28 +02:00
Andy Miller
84a0b5d1e1 cleanup with default value 2018-02-19 21:23:11 -07:00
Andy Miller
8e68317e7c Composer updates 2018-02-19 11:48:38 -07:00
Matias Griese
35f7a2a9de Added $grav['uri]->getCurrentUri() function to get Grav\Framework\Uri instance for the current URL. 2018-02-19 11:10:37 +02:00
Matias Griese
62dfa0e060 Reorder functions in Common\Uri class 2018-02-19 10:30:16 +02:00
Andy Miller
2e28461435 Updated changelog 2018-02-18 14:08:23 -07:00
Andy Miller
4259d01638 Fix bug with remote minimum PHP version determination 2018-02-18 14:07:35 -07:00
Matias Griese
39783df92d Fixed bug with absolute_urls=true 2018-02-17 14:35:02 +02:00
Matias Griese
d39253e36f Moved URI parts filtering functions to Framework\UriPartsFilter class 2018-02-17 14:28:26 +02:00
Matias Griese
82868037ec Some code cleanup on ParsedownGravTrait and Grav classes 2018-02-17 13:03:56 +02:00
Matias Griese
17ba58a5c2 Framework\Uri: Improve query parameter handling 2018-02-17 13:00:40 +02:00
Matias Griese
0a79788582 Improve Uri class by adding useful tests 2018-02-17 12:23:45 +02:00
Andy Miller
ccf0f9c74e Added support for php dependencies in GPM blueprints 2018-02-16 18:16:07 -07:00
Matias Griese
79e580a79d Added Grav\Framework\Uri classes extending PSR-7 HTTP message UriInterface implementation 2018-02-17 00:18:21 +02:00
Andy Miller
5b9a40de5f Prepare for release 2018-02-15 15:53:36 -07:00
Andy Miller
550468aefb Added checkbox-style support for switch field 2018-02-15 14:51:31 -07:00
Andy Miller
84a2a08d22 Fixed YAML blueprint valdiation/filtering 2018-02-14 22:29:41 -07:00
Matias Griese
ee8ea5af57 Clean up Utils class with minor fixes 2018-02-09 10:44:32 +02:00
Andy Miller
2f763809ac fixed twig evaluate function 2018-02-06 09:44:00 -07:00
Andy Miller
f91678df4a Fix for invalid template error in evaluate() 2018-02-06 09:42:13 -07:00
Andy Miller
4c654ef19c Stopped Chrome from auto-completing admin user profile form #1847 2018-02-05 13:07:51 -07:00
Andy Miller
637308d294 Fix for opengraph tags #1849 2018-02-05 11:59:14 -07:00
Andy Miller
e2ce65dc61 cast to array 2018-02-03 14:26:23 -07:00
Andy Miller
f6061e96e8 fix for assets change 2018-02-03 14:19:30 -07:00
Gabriel Caruso
8c0134eb64 Test against PHP 7.2 (#1835) 2018-02-03 14:05:48 -07:00
Mateusz Kutyba
18c6bd6e23 Remove the default type attribute from script tags (#1823) 2018-02-03 14:05:27 -07:00
Andy Miller
08be06c9bc Addd a new Medium:exists() method 2018-01-31 16:07:36 -07:00
Andy Miller
19ae66d0e9 updated changelog 2018-01-31 14:04:56 -07:00
Andy Miller
c3f84d8682 new read_file() twig function 2018-01-31 14:04:50 -07:00
Andy Miller
c721be8787 Added yaml encode/decode filters 2018-01-25 16:40:02 -07:00
Andy Miller
47746d3313 Added new Collection::toExtendedArray() 2018-01-25 16:37:21 -07:00
Andy Miller
103ac4b137 Improve collection filtering 2018-01-24 15:42:27 -07:00
Andy Miller
d2e3ea0f9d Prepare for release 2018-01-22 12:27:03 -07:00
Andy Miller
16ca3daf21 Updated pimple release 2018-01-22 12:25:17 -07:00
Andy Miller
db5f0efaab Fix for bad Uri::filter() call
https://github.com/getgrav/grav-plugin-page-inject/issues/14
2018-01-21 17:01:45 -07:00
Andy Miller
8eb0f87702 Changelog updated 2018-01-19 11:19:29 -07:00
Gabriel Caruso
2c44980b77 Refactoring tests (#1779) 2018-01-19 11:16:25 -07:00
Gabriel Caruso
f261173de2 Refactoring tests (#1779) 2018-01-19 11:15:20 -07:00
Andy Miller
75e293b2d7 Merge branch '1.4' of https://github.com/getgrav/grav into 1.4 2018-01-19 11:13:49 -07:00
Andy Miller
422eb5be5c License date update 2018-01-19 11:13:27 -07:00
Miguel Piedrafita
9d2dea07ad Update license year (#1813) 2018-01-19 11:10:56 -07:00
Matias Griese
821c4f7b4a Clean up Utils class with minor fixes (#1830) 2018-01-19 11:09:51 -07:00
Andy Miller
dcbb5ef90d Merge branch '1.4' of https://github.com/getgrav/grav into 1.4
# Conflicts:
#	CHANGELOG.md
2018-01-19 10:32:37 -07:00
Andy Miller
758ea8f581 Slight change in Whoops colors 2018-01-19 10:31:33 -07:00
Andy Miller
5a27977452 vendor updates 2018-01-19 10:30:53 -07:00
Matias Griese
8d39fdf23c Bug fix on Cache TTL = null 2018-01-19 12:53:33 +02:00
Matias Griese
73bd402551 Framework\Cache: Update all exceptions to be compatible with Psr\SimpleCache 2018-01-19 12:03:32 +02:00
Matias Griese
c473c0baaf Fixes wrong exception in ChainCache 2018-01-19 11:49:01 +02:00
Matias Griese
827b4e5d75 Clean up Utils class with minor fixes 2018-01-19 11:28:47 +02:00
Andy Miller
14af38fb0f Moved url() function into Utils class 2018-01-11 17:52:10 -07:00
Andy Miller
2c4d5307f6 Merge branch '1.4' of https://github.com/getgrav/grav into 1.4 2018-01-09 22:47:15 -07:00
Andy Miller
4677bad9ba Modular blueprint update 2018-01-09 22:47:11 -07:00
Matias Griese
ae245c0674 Misc object fixes (new features only) 2018-01-09 21:24:19 +02:00
Matias Griese
154fa4ed9a Update changelog 2018-01-09 13:02:36 +02:00
Matias Griese
a744b7fc8f Objects: Add protected function getVariable() to get serialized value for a single property
`ObjectPropertyTrait`: Added protected functions `isPropertyLoaded()`, `offsetLoad()`, `offsetPrepare()` and `offsetSerialize()`
2018-01-09 12:08:37 +02:00
Andy Miller
72abab6450 Dates should always be sorted numerically 2018-01-04 11:45:31 -07:00
Andy Miller
0695c29cf5 Bad quotes 2017-12-31 17:07:52 -08:00
Immanuel Bendahan
084a5c7fbe Bug fi (#1808) 2017-12-29 13:42:45 -07:00
Andy Miller
0feeb743ff update defines 2017-12-29 13:24:10 -07:00
Andy Miller
96fd694eae Use quark by default 2017-12-29 13:12:18 -07:00
Andy Miller
b2c883c869 updated changelog 2017-12-29 13:11:12 -07:00
Andy Miller
7941786db9 Setting Quark to default theme 2017-12-28 17:21:52 -07:00
Andy Miller
2ad9b6dc84 Fixes that ‘should’ work. 2017-12-28 14:39:35 -07:00
Andy Miller
59f7f15434 Get current route correctly 2017-12-27 14:58:56 -07:00
Andy Miller
8f522ee11d Merge branch '1.4' of https://github.com/getgrav/grav into 1.4 2017-12-27 13:39:27 -07:00
Andy Miller
f48c0b1700 fix for special chars in base path #1799 2017-12-27 13:39:16 -07:00
Matias Griese
b35b9eaecc Merge remote-tracking branch 'origin/1.4' into 1.4 2017-12-27 21:03:48 +02:00
Matias Griese
e217489d37 Added new configuration option system.session.initialize to delay session initialization if needed by a plugin 2017-12-27 21:03:41 +02:00
Andy Miller
5df6db9ffa Added a new typography page 2017-12-26 15:01:44 -07:00
Andy Miller
bd578070de removed _set method as it breaks GPM 2017-12-18 17:34:49 -07:00
Andy Miller
a8a061d4b2 updated defines for beta.2 2017-12-18 14:28:07 -07:00
Andy Miller
9d41417c26 updated changelog 2017-12-18 14:21:43 -07:00
Andy Miller
3888358dc9 Updated to latest vendor libs 2017-12-18 14:07:55 -07:00
Andy Miller
62302c0420 Merge branch '1.4' of https://github.com/getgrav/grav into 1.4 2017-12-18 12:18:17 -07:00
Andy Miller
2d93c1ace0 title change 2017-12-18 12:18:10 -07:00
Matias Griese
42de0bbb32 Changelog update 2017-12-18 09:16:52 +02:00
Andy Miller
3e15de74f4 Added header_var twig function 2017-12-17 13:45:48 -07:00
Andy Miller
a1c804ed41 Changed title 2017-12-15 16:08:53 -07:00
Andy Miller
559fde4e00 Tweak to default page 2017-12-15 15:54:50 -07:00
Andy Miller
1f1c429fc4 updated changelog 2017-12-15 15:27:23 -07:00
Andy Miller
e9b7c8dad2 Merge branch '1.4' of https://github.com/getgrav/grav into 1.4
# Conflicts:
#	CHANGELOG.md
2017-12-15 15:13:29 -07:00
Andy Miller
b6e5bfa7f3 Fixed BadMethodException in GPM updates #1784 2017-12-15 15:12:26 -07:00
Matias Griese
fb106b1106 Removed constructor from ObjectInterface 2017-12-15 21:31:40 +02:00
Matias Griese
34e3be710f Merge branch 'develop' of https://github.com/getgrav/grav into 1.4
# Conflicts:
#	composer.lock
2017-12-15 21:28:51 +02:00
Andy Miller
21674194e0 Updated changelog 2017-12-13 22:19:43 -07:00
Andy Miller
aadb8bb2ea Added some new theme twig functions 2017-12-13 21:51:06 -07:00
Andy Miller
af1465278d Updated vendor libraries to latest 2017-12-12 11:55:10 -07:00
Andy Miller
a8f5468f6a Updated vendor libs 2017-12-12 11:54:01 -07:00
Andy Miller
592c3ea5e2 Merge branch '1.4' of https://github.com/getgrav/grav into 1.4 2017-12-12 11:29:51 -07:00
Andy Miller
97b088b959 Updated welcome page 2017-12-12 11:29:02 -07:00
Matias Griese
3fec18e5e5 Composer update 2017-12-12 12:47:12 +02:00
Matias Griese
b15c5d7888 Merge branch 'develop' of https://github.com/getgrav/grav into 1.4 2017-12-12 12:45:14 +02:00
Matias Griese
24898de2ba Force composer to use PHP 5.5.9 compatible libraries, add composer security advisories check 2017-12-12 12:44:01 +02:00
Andy Miller
d629391ad9 updated changelog 2017-12-11 15:08:20 -07:00
Andy Miller
7ec66b2bf2 Transferred copyright 2017-12-11 15:08:05 -07:00
Andy Miller
b5f75acf50 Fix array casting with DOM elements 2017-12-11 13:17:03 -07:00
Djamil Legato
255f2f1db6 Changed GPM channel to testing 2017-12-11 11:56:07 -08:00
Djamil Legato
d34fad65b5 Removed Page interfaces 2017-12-11 11:49:19 -08:00
Djamil Legato
8d82fce89f Updated version to 1.4.0-beta.1 2017-12-11 11:46:30 -08:00
Matias Griese
bfd8a087bf Merge branch 'develop' of https://github.com/getgrav/grav into 2.0
# Conflicts:
#	CHANGELOG.md
#	system/defines.php
2017-12-11 20:54:33 +02:00
Djamil Legato
cc648b885c Updated grav version for 2.0 branch 2017-12-08 18:14:04 -08:00
Andy Miller
6628bbbe2f Fix for illegal offset scheme errors 2017-12-08 11:52:48 -07:00
Andy Miller
f9f8cb8b1f Merge branch 'release/1.3.10' 2017-12-06 06:43:37 -07:00
Andy Miller
70f6529e32 Merge tag '1.3.10' into develop
Release v1.3.10
2017-12-06 06:43:37 -07:00
Andy Miller
671e0d47ea Prepare for release 2017-12-06 06:43:28 -07:00
Andy Miller
e9f493096b Updated changelog 2017-12-06 06:43:03 -07:00
Andy Miller
ee2f5663c4 Revert "Fixed issue #1742 where the creation of GPM object tried to connect to Remote repositories even if only Local package was needed (#1746)"
This reverts commit 2cc34151df.
2017-12-06 06:41:47 -07:00
Andy Miller
d4204f13f8 Merge branch 'release/1.3.9' 2017-12-05 17:16:13 -07:00
Andy Miller
1a477609be Merge tag '1.3.9' into develop
Release v1.3.9
2017-12-05 17:16:13 -07:00
Andy Miller
0554b25c78 Prepare for release 2017-12-05 17:16:05 -07:00
Andy Miller
f4e7cbaa6e updated changelog 2017-12-05 17:15:28 -07:00
Andy Miller
83bfc1fd0f Added support for intl_enabled option 2017-12-05 17:03:05 -07:00
Andy Miller
30439b864d Added a quick type test for #1764 2017-12-05 11:04:59 -07:00
Andy Miller
80999121a9 Potential fix for #1764 2017-12-05 10:51:44 -07:00
Andy Miller
ca0d0bb373 Added a comment 2017-12-05 10:50:39 -07:00
Andy Miller
345578a05d Force field.multiple: true for checkboxes to use min/max rules 2017-12-04 22:32:26 -07:00
Andy Miller
1f0537124a Merge branch 'develop' of https://github.com/getgrav/grav into develop 2017-12-04 18:14:25 -07:00
Andy Miller
2a2b9a12a7 Fix for checkbox validation form#216 2017-12-04 18:14:20 -07:00
Iain Gillis
5a19e05931 Fix typo (#1770) 2017-12-02 22:08:55 -07:00
Matias Griese
acbc85773c Merge remote-tracking branch 'origin/2.0' into 2.0 2017-12-01 20:41:25 +02:00
Djamil Legato
b2fc101078 Merge branch 'develop' into 2.0 2017-12-01 10:41:06 -08:00
Matias Griese
d943c559e2 Merge branch 'develop' of https://github.com/getgrav/grav into 2.0 2017-12-01 20:40:36 +02:00
Andy Miller
6ae4680fcb Move system twig templates to last 2017-12-01 11:38:38 -07:00
Matias Griese
0524bd2083 Merge branch 'develop' of https://github.com/getgrav/grav into 2.0 2017-12-01 14:49:26 +02:00
Andy Miller
b4cf7899bb cleanup 2017-12-01 00:01:23 -07:00
Andy Miller
eac16911d0 Added new core twig templates 2017-11-30 18:31:13 -07:00
Andy Miller
21bef62b82 Added get and set FlashCookieObject() methods 2017-11-30 18:28:25 -07:00
Matias Griese
66d8269a1b Merge branch 'develop' of https://github.com/getgrav/grav into 2.0 2017-11-29 10:46:46 +02:00
Andy Miller
a1eccfdb61 Updated changelog 2017-11-28 12:58:04 -07:00
Matias Griese
90e05694d3 Merge remote-tracking branch 'origin/develop' into develop 2017-11-28 14:58:07 +02:00
Matias Griese
b97ac503a1 Add filter for item-list type (removes empty items from the list) 2017-11-28 14:57:53 +02:00
Agustin Villalba
2cc34151df Fixed issue #1742 where the creation of GPM object tried to connect to Remote repositories even if only Local package was needed (#1746)
All good, thanks!
2017-11-27 21:15:09 -07:00
Iain Gillis
4c160533c2 Add additional controls to HTML5 audio attributes (#1756)
Adds support for `autoplay`, `controls`, `loop`, and `preload` attributes, with rudimentary validation for preload.

Those for `autoplay`, `controls`, and `loop` are copied directly from pfcloutier-druide/aaa3f82

See also #1442.
2017-11-27 21:12:56 -07:00
Matias Griese
59dd0d1212 Fixed CSS Pipeline failing with Google remote fonts if the file was minified (#1261) (#1763)
* Fixed CSS Pipeline failing with Google remote fonts if the file was minified (#1261)

* Assets: Make tag check ungreedy again -- inline js may have tags in the content
2017-11-27 21:12:33 -07:00
Andy Miller
3bf7e38e52 Updated changelog 2017-11-27 18:30:10 -07:00
Andy Miller
362ee4c9eb Fix for URL encoding with Multibyte folders 2017-11-27 18:27:18 -07:00
Andy Miller
2462331884 Fix for MB Markdown links #1749 2017-11-27 18:21:08 -07:00
Matias Griese
ddd451b94c Merge branch 'develop' of https://github.com/getgrav/grav into 2.0 2017-11-17 08:04:41 +02:00
Matias Griese
cb4147a4bd Fixed token creation issue with Uri params like /id:3 2017-11-17 08:03:58 +02:00
Wensheng Yan
72f3a01abf Update Cache.php (#1745)
make sure find resource return valid path.
2017-11-15 18:35:44 -07:00
Matias Griese
aa2341dfb5 Merge branch 'develop' of https://github.com/getgrav/grav into 2.0
# Conflicts:
#	system/src/Grav/Common/User/User.php
2017-11-13 09:48:35 +02:00
Matias Griese
31e3c1c295 Remove support for config.user, it was broken and bad practise 2017-11-10 22:07:29 +02:00
Andy Miller
37891a1032 Minor optimizations 2017-11-08 05:34:42 -07:00
Andy Miller
70284e1517 Sort using folder name #1740 2017-11-07 18:38:35 -07:00
Andy Miller
0bca1dcb48 Fix for custom_base_url issues #1736 2017-11-07 17:50:06 -07:00
Andy Miller
36f9865c0b Couple of utility functions 2017-11-07 17:44:40 -07:00
Matias Griese
cd48551630 Fix changelog 2017-11-07 17:00:34 +02:00
Matias Griese
0ff130650f Merge remote-tracking branch 'origin/develop' into develop 2017-11-07 16:57:59 +02:00
Matias Griese
9b445ac5b6 Fixed "Invalid AJAX response" When using Built-in PHP Webserver in Windows (#1258) 2017-11-07 16:57:52 +02:00
Andy Miller
c21248fcc2 Updated changelog 2017-11-06 19:52:05 -07:00
Andy Miller
88aa4c5ec9 Added ability to toggle lowercase urls 2017-11-06 19:50:59 -07:00
Matias Griese
b31490e52d Merge branch 'develop' of https://github.com/getgrav/grav into 2.0 2017-11-06 10:28:10 +02:00
Matias Griese
0fd22ad933 Uri: Encode user and password to prevent issues in browsers 2017-11-06 10:26:17 +02:00
Matias Griese
980b2b67cd Code readability improvements 2017-11-06 10:18:22 +02:00
Andy Miller
00b56da220 Updated changelog 2017-11-02 14:51:13 -06:00
Andy Miller
fef6bdde5f Revert "Added system option to enable case insensitive urls. (#1638)"
This reverts commit 481fe1903e.
2017-11-02 14:48:42 -06:00
Sam
6f7938e939 Update README.md (#1705) 2017-11-01 17:21:14 -06:00
Viktor
2cd469cd7c Update CompiledFile.php (#1693)
const CACHE_DIR already defined with trailing slash

```php
define('CACHE_DIR', ROOT_DIR . 'cache/');
```
2017-11-01 17:20:38 -06:00
Matias Griese
cd15055280 Merge branch 'develop' of https://github.com/getgrav/grav into 2.0
# Conflicts:
#	CHANGELOG.md
2017-11-01 07:48:45 +02:00
Matias Griese
3380577e40 Improved script/style tag parameter handling 2017-11-01 07:45:59 +02:00
Andy Miller
0895b15489 Updated changelog 2017-10-31 16:38:16 -06:00
Andy Miller
d9062b60d6 Merge branch 'develop' of https://github.com/getgrav/grav into develop 2017-10-31 16:36:47 -06:00
Andy Miller
3f4049031d use Event object in Page/Pages events 2017-10-31 16:36:43 -06:00
Andy Miller
c81ce71074 Fix active() + activeChild() to work with UTF-8 #1727 2017-10-31 16:36:13 -06:00
Matias Griese
7c19d1520d Tweaked script/style tag formatting 2017-10-31 20:02:26 +02:00
Matias Griese
84789cbcd4 Added {% script %} and {% style %} tags for Twig templates 2017-10-31 16:50:05 +02:00
cofunin
f84ffd235b Fix ignoring media in modular.yaml (#1725) 2017-10-30 18:15:39 -06:00
Andy Miller
1ca6181856 Added onPageProcessed for dynamic addPage() calls 2017-10-30 16:19:13 -06:00
Andy Miller
f17954a5db Added a copy method to Medium object 2017-10-30 15:36:52 -06:00
Matias Griese
586fcf42ab Added {% try %} ... {% catch %} Error: {{ e.message }} {% endcatch %} tag to allow basic exception handling inside Twig 2017-10-30 13:33:45 +02:00
Matias Griese
18c597b3d2 Merge branch 'develop' of https://github.com/getgrav/grav into 2.0 2017-10-27 11:49:43 +03:00
Andy Miller
acea401a3d Merge branch 'release/1.3.8' 2017-10-26 18:37:27 -06:00
Andy Miller
e9e4106d22 Merge tag '1.3.8' into develop
Release v1.3.8
2017-10-26 18:37:27 -06:00
Andy Miller
0ec7158102 Prepare for release 2017-10-26 18:37:17 -06:00
Matias Griese
d00d8cb668 Merge branch 'develop' of https://github.com/getgrav/grav into 2.0
# Conflicts:
#	CHANGELOG.md
2017-10-25 11:07:39 +03:00
Andy Miller
d3695b2faa Fixed missing image file not throwing 404 p#1713 2017-10-23 16:19:08 -06:00
Andy Miller
0668a47758 Fixed GPM update issue with filtered slugs #1711 2017-10-23 16:13:22 -06:00
Andy Miller
ca645ef476 updated changelog 2017-10-19 22:13:36 -04:00
Andy Miller
3ff5f79561 Added manual order capability to Page media 2017-10-19 22:10:12 -04:00
Djamil Legato
b5c8b70163 More media order changes 2017-10-19 18:01:37 -04:00
Djamil Legato
173a70c017 Updated default yaml with media order 2017-10-19 17:39:10 -04:00
Djamil Legato
ae143814fb Updated default with new media order 2017-10-19 17:37:29 -04:00
Benoît Rouleau
eb52f670b9 fix nonsense logic (#1709) 2017-10-19 16:53:31 -04:00
Sam
dd166ce25c Update CONTRIBUTING.md copywriting (#1706) 2017-10-19 09:19:03 -04:00
Andy Miller
ea6423226a Merge branch 'release/1.3.7' 2017-10-18 16:35:41 -04:00
Andy Miller
85bf4406ed Merge tag '1.3.7' into develop
Release v1.3.7
2017-10-18 16:35:41 -04:00
Andy Miller
0cb8e0664e Prepare for release 2017-10-18 16:35:27 -04:00
Matias Griese
98dca95c15 Merge branch 'develop' of https://github.com/getgrav/grav into 2.0
# Conflicts:
#	CHANGELOG.md
2017-10-18 09:16:46 +03:00
Matias Griese
2842b8fa39 Fixed routing paths with urlencoded spaces and non-latin letters (#1688) 2017-10-17 14:40:30 +03:00
Matias Griese
317615854a Uri: Prefer using REQUEST_SCHEME instead of HTTPS (#1698) 2017-10-17 13:34:25 +03:00
Matias Griese
a9c82710a6 Regression: base_url_absolute always has the port number (#1690) 2017-10-16 12:36:06 +03:00
Matias Griese
3856a2a719 Add unit test for #1688 2017-10-16 11:13:25 +03:00
Viktor
880128c339 Update Grav Console Cli InstallCommand.php (#1692)
why do I have to clone the entire history of the plugin?
2017-10-13 08:34:39 -06:00
Matias Griese
731fe500ee Merge branch 'develop' of https://github.com/getgrav/grav into 2.0
# Conflicts:
#	CHANGELOG.md
2017-10-13 11:41:10 +03:00
Andy Miller
444b48f788 Merge branch 'release/1.3.6' 2017-10-12 12:26:29 -06:00
Andy Miller
cc69591799 Merge tag '1.3.6' into develop
Release v1.3.6
2017-10-12 12:26:29 -06:00
Andy Miller
0d6f774386 Prepare for release 2017-10-12 12:26:12 -06:00
Andy Miller
474ca513ae Fix for nginx and _url issue
[admin#1244](https://github.com/getgrav/grav-plugin-admin/issues/1244)
2017-10-12 12:23:49 -06:00
Matias Griese
f37c08f341 Regression: Ajax error in ngnix (#1244) 2017-10-12 21:18:34 +03:00
Matias Griese
92afba0e28 Add test case for #1244 2017-10-12 18:36:10 +03:00
Matias Griese
c7be8ebb22 Merge branch 'develop' of https://github.com/getgrav/grav into 2.0 2017-10-12 10:50:08 +03:00
Andy Miller
974fc552c5 Added another complex test 2017-10-11 19:24:16 -06:00
Andy Miller
9e1170bd50 Merge tag '1.3.5' into develop
Release v1.3.5
2017-10-11 14:49:28 -06:00
Matias Griese
4e6738cbc5 Composer update 2017-10-04 15:24:45 +03:00
Matias Griese
0d4a5a22c8 Merge branch 'develop' of https://github.com/getgrav/grav into 2.0
# Conflicts:
#	CHANGELOG.md
#	composer.lock
#	system/src/Grav/Common/Twig/TwigExtension.php
2017-10-04 13:09:31 +03:00
Matias Griese
8b3949b7d9 Fixed nested object access by Object::getNestedProperty() 2017-09-27 10:13:26 +03:00
Matias Griese
a535e8547a Fix bug 2017-09-26 19:02:51 +03:00
Matias Griese
0fd6fda4d8 Add method ObjectCollection::collectionGroup() 2017-09-26 18:26:39 +03:00
Matias Griese
71b11366bb Add support to serialize Object properties 2017-09-25 14:17:14 +03:00
Matias Griese
588c509194 Add ArrayCollection::chunk() function 2017-09-15 14:05:21 +03:00
mahagr
37b5818507 Fix bug on Object ArrayAccess 2017-09-14 15:58:16 +03:00
Matias Griese
23592b8a76 Major update on Object classes (backwards incompatible) 2017-09-13 09:50:34 +03:00
Matias Griese
62389975a2 Object code cleanup 2017-09-08 15:50:05 +03:00
Matias Griese
c0e1e155d7 Merge branch 'develop' of https://github.com/getgrav/grav into 2.0
# Conflicts:
#	composer.json
#	composer.lock
#	system/src/Grav/Common/Twig/TwigExtension.php
2017-09-08 14:54:50 +03:00
Matias Griese
8c3210332e Add ArrayObject and make Object not to implement ArrayAccess interface. Remove Toolbox dependency. 2017-09-08 14:44:37 +03:00
Matias Griese
758ccadb07 Code cleanup 2017-09-08 14:40:16 +03:00
Matias Griese
cd11b14998 Add FileCollectionInterface and AbstractFileCollection classes 2017-09-08 14:39:33 +03:00
Matias Griese
cdb5d591e8 Fix a bug in MemoryCache 2017-08-30 14:08:57 +03:00
Matias Griese
fab81b923b Composer update 2017-08-29 11:17:54 +03:00
Matias Griese
1bae601ad9 Add new FileCache class 2017-08-29 11:17:38 +03:00
Matias Griese
a4795a9df1 Add new SessionCache class 2017-08-29 10:37:14 +03:00
Matias Griese
0644eac7dc Merge branch 'develop' of https://github.com/getgrav/grav into 2.0
# Conflicts:
#	CHANGELOG.md
#	system/src/Grav/Common/Twig/TwigExtension.php
2017-08-29 08:56:04 +03:00
Matias Griese
96ee41a3dd Follow PSR-2 in Grav\Framework 2017-08-18 12:28:13 +03:00
Matias Griese
d15eb0e6ad Composer update 2017-08-17 10:01:42 +03:00
Matias Griese
c3066cd491 Merge branch 'develop' of https://github.com/getgrav/grav into 2.0 2017-08-17 09:59:29 +03:00
Matias Griese
557a3b80dd Merge branch 'develop' of https://github.com/getgrav/grav into 2.0
# Conflicts:
#	composer.lock
2017-08-16 09:30:09 +03:00
Djamil Legato
f89fe0ea1b Merge branch 'develop' into 2.0 2017-08-14 15:17:58 -07:00
Matias Griese
ad5cddf222 Merge branch 'develop' of https://github.com/getgrav/grav into 2.0
# Conflicts:
#	CHANGELOG.md
2017-08-14 20:15:43 +03:00
Matias Griese
fb0e086f57 Composer: Force doctrine/cache to use v1.6 (with PHP 5.5 support) 2017-08-10 21:13:14 +03:00
Matias Griese
53611c8627 Composer: Use develop version of rockettheme/toolbox 2017-08-10 21:08:42 +03:00
Matias Griese
dbebd14391 Because of B/C issues, login/logout code needed to be moved into the Login plugin 2017-08-10 11:40:42 +03:00
Matias Griese
6e511d0b20 Improve login/logout logic 2017-08-08 17:50:26 +03:00
Matias Griese
9685ab4a18 Added $grav->login() and $grav->logout() functions with event hooks for plugins
Added events `onUserLoginAuthenticate`, `onUserLoginAuthorize`, `onUserLoginFailure`, `onUserLogin`, `onUserLogout`
2017-08-08 14:31:53 +03:00
mahagr
670f0ce1d9 Merge branch 'develop' of https://github.com/getgrav/grav into 2.0 2017-07-19 15:35:05 -06:00
Andy Miller
6fadaa0789 Added nicenumber twig filter 2017-07-19 14:28:57 -06:00
mahagr
039d2286fb Add Object::getKey() function 2017-07-18 15:37:04 -06:00
mahagr
0cde375953 Merge branch 'develop' of https://github.com/getgrav/grav into 2.0
# Conflicts:
#	CHANGELOG.md
2017-07-18 15:34:41 -06:00
Matias Griese
a59fc7b8b8 Merge branch 'develop' of https://github.com/getgrav/grav into 2.0
# Conflicts:
#	CHANGELOG.md
2017-07-04 09:51:44 +03:00
Matias Griese
ee079635bf Merge branch 'develop' of https://github.com/getgrav/grav into 2.0
# Conflicts:
#	CHANGELOG.md
2017-06-28 10:37:46 +03:00
Matias Griese
ce319de97c Merge branch 'develop' of https://github.com/getgrav/grav into 2.0
# Conflicts:
#	CHANGELOG.md
2017-06-12 09:30:11 +03:00
Matias Griese
1bd3d2693d Merge branch 'develop' of https://github.com/getgrav/grav into 2.0 2017-06-08 11:29:08 +03:00
Matias Griese
3468f59ac7 Merge branch 'develop' of https://github.com/getgrav/grav into 2.0 2017-06-06 12:20:04 +03:00
Matias Griese
c4fac41fe3 Improve CacheTrait::getMultiple() 2017-05-31 13:35:14 +03:00
Matias Griese
512aae350e Fix cloning issues with ObjectCollection 2017-05-31 13:34:04 +03:00
Matias Griese
673131926a Improve caching functions 2017-05-29 14:30:52 +03:00
Matias Griese
668c9801eb Merge branch 'develop' of https://github.com/getgrav/grav into 2.0 2017-05-29 10:12:20 +03:00
Matias Griese
6dbf704a13 Implement memory and chain cache 2017-05-29 10:12:02 +03:00
Matias Griese
83943ce70d Namespace and TTL not needed in MemoryCache adapter 2017-05-26 13:12:18 +03:00
Matias Griese
99eff9587c Implement MemoryCache adapter 2017-05-26 12:27:48 +03:00
Matias Griese
5ec844d883 Merge branch 'develop' of https://github.com/getgrav/grav into 2.0 2017-05-26 11:57:00 +03:00
Matias Griese
7f3f634e3e Merge branch 'feature/debug-json' of https://github.com/getgrav/grav into 2.0
# Conflicts:
#	CHANGELOG.md
2017-05-24 15:18:23 +03:00
Matias Griese
b2070c8ab5 Fix error on missing renderer if using unknown file extension 2017-05-24 15:15:14 +03:00
Matias Griese
6ffc062531 Merge branch 'develop' of https://github.com/getgrav/grav into feature/debug-json
# Conflicts:
#	CHANGELOG.md
2017-05-24 15:13:11 +03:00
Matias Griese
4cc502c477 Merge branch 'feature/debug-json' of https://github.com/getgrav/grav into 2.0 2017-05-22 15:10:41 +03:00
Matias Griese
7ca0f8711c Make it possible to include debug bar also into non-HTML responses 2017-05-22 14:55:26 +03:00
Matias Griese
78cb767172 Merge branch 'develop' of https://github.com/getgrav/grav into 2.0
# Conflicts:
#	CHANGELOG.md
2017-05-22 09:09:32 +03:00
Matias Griese
9d918ad111 Merge branch 'develop' of https://github.com/getgrav/grav into 2.0 2017-05-19 08:09:43 +03:00
Matias Griese
cb29d81529 Merge branch 'develop' of https://github.com/getgrav/grav into 2.0 2017-05-18 17:45:34 +03:00
Matias Griese
dd2384622c Merge branch 'develop' of https://github.com/getgrav/grav into 2.0 2017-05-18 13:09:52 +03:00
Matias Griese
4b14a0db7a Merge branch 'develop' of https://github.com/getgrav/grav into 2.0 2017-05-18 09:52:06 +03:00
Matias Griese
bf687e6fa6 Merge branch 'develop' of https://github.com/getgrav/grav into 2.0
# Conflicts:
#	CHANGELOG.md
2017-05-18 09:45:03 +03:00
Matias Griese
012841617a Merge branch 'develop' of https://github.com/getgrav/grav into 2.0
# Conflicts:
#	CHANGELOG.md
2017-05-17 09:27:02 +03:00
Matias Griese
0269ec579b Object collections: Allow property get, set and grouping for nested arrays 2017-05-16 19:04:24 +03:00
Matias Griese
91a6224156 Rename Object::offsetLoad_*() functions, nested array access 2017-05-16 19:03:23 +03:00
Matias Griese
b4801560be Update docblocks 2017-05-16 12:24:41 +03:00
Matias Griese
c7bcbeabd9 Add support for loading properties in Object class 2017-05-16 12:00:49 +03:00
Matias Griese
41c130cd43 Merge branch 'develop' of https://github.com/getgrav/grav into 2.0
# Conflicts:
#	composer.lock
2017-05-16 10:54:16 +03:00
Djamil Legato
4f27ff1100 Merge branch 'develop' into 2.0
# Conflicts:
#	composer.json
#	composer.lock
2017-05-12 14:08:47 -07:00
Matias Griese
d1654a3e32 Added Grav\Framework\Cache classes providing PSR-16 Simple Cache implementation 2017-05-11 13:34:43 +03:00
Matias Griese
77c2e47b95 Greatly simplify Object classes 2017-05-11 13:20:01 +03:00
Matias Griese
ec4d451d7f Fix for PHP 5.5 support in ObjectCollectionTrait 2017-05-10 11:34:23 +03:00
Matias Griese
65c0c4438f Use older version of doctrine/collections (PHP 5.5 support) 2017-05-10 11:02:51 +03:00
Matias Griese
6685dadddf Oops, accidentally merged local 2.0 branch into develop, revert GravTrait deprecation and add back new Framework classes 2017-05-10 10:21:01 +03:00
258 changed files with 12959 additions and 2443 deletions

View File

@@ -11,9 +11,9 @@ git:
url: https://github.com/getgrav/grav-plugin-markdown-notices
path: user/plugins/markdown-notices
branch: master
antimatter:
url: https://github.com/getgrav/grav-theme-antimatter
path: user/themes/antimatter
quark:
url: https://github.com/getgrav/grav-theme-quark
path: user/themes/quark
branch: master
links:
problems:
@@ -28,7 +28,7 @@ links:
src: grav-plugin-markdown-notices
path: user/plugins/markdown-notices
scm: github
antimatter:
src: grav-theme-antimatter
path: user/themes/antimatter
quark:
src: grav-theme-quark
path: user/themes/quark
scm: github

2
.gitignore vendored
View File

@@ -37,9 +37,9 @@ Thumbs.db
# phpstorm
.idea/*
user/config/security.yaml
tests/_output/*
tests/_support/_generated/*
tests/cache/*
tests/error.log
/system/templates/testing

View File

@@ -1,9 +1,9 @@
language: php
php:
- '5.5'
- '5.6'
- '7.0.21'
- '7.1'
- '7.2'
branches:
only:
- develop

View File

@@ -1,16 +1,354 @@
# v1.5.8
## 02/07/2019
1. [](#improved)
* Improved `User` unserialize to not to break the object if serialized data is not what expected
* Removed unused parameter [#2357](https://github.com/getgrav/grav/pull/2357)
# v1.5.7
## 01/25/2019
1. [](#new)
* Support for AWS Cloudfront forwarded scheme header [#2297](https://github.com/getgrav/grav/pull/2297)
1. [](#improved)
* Set homepage with `https://` protocol [#2299](https://github.com/getgrav/grav/pull/2299)
* Preserve accents in fields containing Twig expr. using unicode [#2279](https://github.com/getgrav/grav/pull/2279)
* Updated vendor libraries
1. [](#bugfix)
* Support spaces with filenames in responsive images [#2300](https://github.com/getgrav/grav/pull/2300)
# v1.5.6
## 12/14/2018
1. [](#improved)
* Updated InitializeProcessor.php to use lang-safe redirect [#2268](https://github.com/getgrav/grav/pull/2268)
* Improved user serialization to use less memory in the session
# v1.5.5
## 11/12/2018
1. [](#new)
* Register theme prefixes as namespaces in Twig [#2210](https://github.com/getgrav/grav/pull/2210)
1. [](#improved)
* Propogate error code between 400 and 600 for production sites [#2181](https://github.com/getgrav/grav/pull/2181)
1. [](#bugfix)
* Remove hardcoded `302` when redirecting trailing slash [#2155](https://github.com/getgrav/grav/pull/2155)
# v1.5.4
## 11/05/2018
1. [](#improved)
* Updated default page `index.md` with some consistency fixes [#2245](https://github.com/getgrav/grav/pull/2245)
1. [](#bugfix)
* Fixed fatal error if calling `$session->invalidate()` when there's no active session
* Fixed typo in media.yaml for `webm` extension [#2220](https://github.com/getgrav/grav/pull/2220)
* Fixed markdown processing for telephone links [#2235](https://github.com/getgrav/grav/pull/2235)
# v1.5.3
## 10/08/2018
1. [](#new)
* Added `Utils::getMimeByFilename()`, `Utils::getMimeByLocalFile()` and `Utils::checkFilename()` methods
* Added configurable dangerous upload extensions in `security.yaml`
1. [](#improved)
* Updated vendor libraries to latest
# v1.5.2
## 10/01/2018
1. [](#new)
* Added new `Security` class for Grav security functionality including XSS checks
* Added new `bin/grav security` command to scan for security issues
* Added new `xss()` Twig function to allow for XSS checks on strings and arrays
* Added `onHttpPostFilter` event to allow plugins to globally clean up XSS in the forms and tasks
* Added `Deprecated` tab to DebugBar to catch future incompatibilities with later Grav versions
* Added deprecation notices for features which will be removed in Grav 2.0
1. [](#improved)
* Updated vendor libraries to latest
1. [](#bugfix)
* Allow `$page->slug()` to be called before `$page->init()` without breaking the page
* Fix for `Page::translatedLanguages()` to use routes always [#2163](https://github.com/getgrav/grav/issues/2163)
* Fixed `nicetime()` twig function
* Allow twig tags `{% script %}`, `{% style %}` and `{% switch %}` to be placed outside of blocks
* Session expires in 30 mins independent from config settings [login#178](https://github.com/getgrav/grav-plugin-login/issues/178)
# v1.5.1
## 08/23/2018
1. [](#new)
* Added static `Grav\Common\Yaml` class which should be used instead of `Symfony\Component\Yaml\Yaml`
1. [](#improved)
* Updated deprecated Twig code so it works in both in Twig 1.34+ and Twig 2.4+
* Switched to new Grav Yaml class to support Native + Fallback YAML libraries
1. [](#bugfix)
* Broken handling of user folder in Grav URI object [#2151](https://github.com/getgrav/grav/issues/2151)
# v1.5.0
## 08/17/2018
1. [](#new)
* Set minimum requirements to [PHP 5.6.4](https://getgrav.org/blog/raising-php-requirements-2018)
* Updated Doctrine Collections to 1.4
* Updated Symfony Components to 3.4 (with compatibility mode to fall back to Symfony YAML 2.8)
* Added `Uri::method()` to get current HTTP method (GET/POST etc)
* `FormatterInterface`: Added `getSupportedFileExtensions()` and `getDefaultFileExtension()` methods
* Added option to disable `SimpleCache` key validation
* Added support for multiple repo locations for `bin/grav install` command
* Added twig filters for casting values: `|string`, `|int`, `|bool`, `|float`, `|array`
* Made `ObjectCollection::matching()` criteria expressions to behave more like in Twig
* Criteria: Added support for `LENGTH()`, `LOWER()`, `UPPER()`, `LTRIM()`, `RTRIM()` and `TRIM()`
* Added `Grav\Framework\File\Formatter` classes for encoding/decoding YAML, Markdown, JSON, INI and PHP serialized strings
* Added `Grav\Framework\Session` class to replace `RocketTheme\Toolbox\Session\Session`
* Added `Grav\Common\Media` interfaces and trait; use those in `Page` and `Media` classes
* Added `Grav\Common\Page` interface to allow custom page types in the future
* Added setting to disable sessions from the site [#2013](https://github.com/getgrav/grav/issues/2013)
* Added new `strict_mode` settings in `system.yaml` for compatibility
1. [](#improved)
* Improved `Utils::url()` to support query strings
* Display better exception message if Grav fails to initialize
* Added `muted` and `playsinline` support to videos [#2124](https://github.com/getgrav/grav/pull/2124)
* Added `MediaTrait::clearMediaCache()` to allow cache to be cleared
* Added `MediaTrait::getMediaCache()` to allow custom caching
* Improved session handling, allow all session configuration options in `system.session.options`
1. [](#bugfix)
* Fix broken form nonce logic [#2121](https://github.com/getgrav/grav/pull/2121)
* Fixed issue with uppercase extensions and fallback media URLs [#2133](https://github.com/getgrav/grav/issues/2133)
* Fixed theme inheritance issue with `camel-case` that includes numbers [#2134](https://github.com/getgrav/grav/issues/2134)
* Typo in demo typography page [#2136](https://github.com/getgrav/grav/pull/2136)
* Fix for incorrect plugin order in debugger panel
* Made `|markdown` filter HTML safe
* Fixed bug in `ContentBlock` serialization
* Fixed `Route::withQueryParam()` to accept array values
* Fixed typo in truncate function [#1943](https://github.com/getgrav/grav/issues/1943)
* Fixed blueprint field validation: Allow numeric inputs in text fields
# v1.4.8
## 07/31/2018
1. [](#improved)
* Add Grav version to debug bar messages tab [#2106](https://github.com/getgrav/grav/pull/2106)
* Add Nginx config for ddev project to `webserver-configs` [#2117](https://github.com/getgrav/grav/pull/2117)
* Vendor library updates
1. [](#bugfix)
* Don't allow `null` to be set as Page content
# v1.4.7
## 07/13/2018
1. [](#improved)
* Use `getFilename` instead of `getBasename` [#2087](https://github.com/getgrav/grav/issues/2087)
1. [](#bugfix)
* Fix for modular page preview [#2066](https://github.com/getgrav/grav/issues/2066)
* `Page::routeCanonical()` should be string not array [#2069](https://github.com/getgrav/grav/issues/2069)
# v1.4.6
## 06/20/2018
1. [](#improved)
* Manually re-added the improved SSL off-loading that was lost with Grav v1.4.0 merge [#1888](https://github.com/getgrav/grav/pull/1888)
* Handle multibyte strings in `truncateLetters()` [#2007](https://github.com/getgrav/grav/pull/2007)
* Updated robots.txt to include `/user/images/` folder [#2043](https://github.com/getgrav/grav/pull/2043)
* Add getter methods for original and action to the Page object [#2005](https://github.com/getgrav/grav/pull/2005)
* Modular template extension follows the master page extension [#2044](https://github.com/getgrav/grav/pull/2044)
* Vendor library updates
1. [](#bugfix)
* Handle `errors.display` system property better in admin plugin [admin#1452](https://github.com/getgrav/grav-plugin-admin/issues/1452)
* Fix classes on non-http based protocol links [#2034](https://github.com/getgrav/grav/issues/2034)
* Fixed crash on IIS (Windows) with open_basedir in effect [#2053](https://github.com/getgrav/grav/issues/2053)
* Fixed incorrect routing with setup.php based base [#1892](https://github.com/getgrav/grav/issues/1892)
* Fixed image resource memory deallocation [#2045](https://github.com/getgrav/grav/pull/2045)
* Fixed issue with Errors `display:` option not handling integers properly [admin#1452](https://github.com/getgrav/grav-plugin-admin/issues/1452)
# v1.4.5
## 05/15/2018
1. [](#bugfix)
* Fixed an issue with some users getting **2FA** prompt after upgrade [admin#1442](https://github.com/getgrav/grav-plugin-admin/issues/1442)
* Do not crash when generating URLs with arrays as parameters [#2018](https://github.com/getgrav/grav/pull/2018)
* Utils::truncateHTML removes whitespace when generating summaries [#2004](https://github.com/getgrav/grav/pull/2004)
# v1.4.4
## 05/11/2018
1. [](#new)
* Added support for `Uri::post()` and `Uri::getConentType()`
* Added a new `Medium:thumbnailExists()` function [#1966](https://github.com/getgrav/grav/issues/1966)
* Added `authorized` support for 2FA
1. [](#improved)
* Added default configuration for images [#1979](https://github.com/getgrav/grav/pull/1979)
* Added dedicated PHPUnit assertions [#1990](https://github.com/getgrav/grav/pull/1990)
1. [](#bugfix)
* Use `array_key_exists` instead of `in_array + array_keys` [#1991](https://github.com/getgrav/grav/pull/1991)
* Fixed an issue with `custom_base_url` always causing 404 errors
* Improve support for regex redirects with query and params [#1983](https://github.com/getgrav/grav/issues/1983)
* Changed collection-based date sorting to `SORT_REGULAR` for better server compatibility [#1910](https://github.com/getgrav/grav/issues/1910)
* Fix hardcoded string in modular blueprint [#1933](https://github.com/getgrav/grav/pull/1993)
# v1.4.3
## 04/12/2018
1. [](#new)
* moved Twig `sortArrayByKey` logic into `Utils::` class
1. [](#improved)
* Rolled back Parsedown library to stable `1.6.4` until a better solution for `1.8.0` compatibility can fe found
* Updated vendor libraries to latest versions
1. [](#bugfix)
* Fix for bad reference to `ZipArchive` in `GPM::Installer`
# v1.4.2
## 03/21/2018
1. [](#new)
* Added new `|nicefilesize` Twig filter for pretty file (auto converts to bytes, kB, MB, GB, etc)
* Added new `regex_filter()` Twig function to values in arrays
1. [](#improved)
* Added bosnian to lang codes [#1917](https://github.com/getgrav/grav/issues/1917)
* Improved Zip extraction error codes [#1922](https://github.com/getgrav/grav/issues/1922)
1. [](#bugfix)
* Fixed an issue with Markdown Video and Audio that broke after Parsedown 1.7.0 Security updates [#1924](https://github.com/getgrav/grav/issues/1924)
* Fix for case-sensitive page metadata [admin#1370](https://github.com/getgrav/grav-plugin-admin/issues/1370)
* Fixed missing composer requirements for the new `Grav\Framework\Uri` classes
* Added missing PSR-7 vendor library required for URI additions in Grav 1.4.0
# v1.4.1
## 03/11/2018
1. [](#bugfix)
* Fixed session timing out because of session cookie was not being sent
# v1.4.0
## 03/09/2018
1. [](#new)
* Added `Grav\Framework\Uri` classes extending PSR-7 `HTTP message UriInterface` implementation
* Added `Grav\Framework\Route` classes to allow route/link manipulation
* Added `$grav['uri]->getCurrentUri()` method to get `Grav\Framework\Uri\Uri` instance for the current URL
* Added `$grav['uri]->getCurrentRoute()` method to get `Grav\Framework\Route\Route` instance for the current URL
* Added ability to have `php` version dependencies in GPM assets
* Added new `{% switch %}` twig tag for more elegant if statements
* Added new `{% markdown %}` twig tag
* Added **Route Overrides** to the default page blueprint
* Added new `Collection::toExtendedArray()` method that's particularly useful for Json output of data
* Added new `|yaml_encode` and `|yaml_decode` Twig filter to convert to and from YAML
* Added new `read_file()` Twig function to allow you to load and display a file in Twig (Supports streams and regular paths)
* Added a new `Medium::exists()` method to check for file existence
* Moved Twig `urlFunc()` to `Utils::url()` as its so darn handy
* Transferred overall copyright from RocketTheme, LLC, to Trilby Media LLC
* Added `theme_var`, `header_var` and `body_class` Twig functions for themes
* Added `Grav\Framework\Cache` classes providing PSR-16 `Simple Cache` implementation
* Added `Grav\Framework\ContentBlock` classes for nested HTML blocks with CSS/JS assets
* Added `Grav\Framework\Object` classes for creating collections of objects
* Added `|nicenumber` Twig filter
* Added `{% try %} ... {% catch %} Error: {{ e.message }} {% endcatch %}` tag to allow basic exception handling inside Twig
* Added `{% script %}` and `{% style %}` tags for Twig templates
* Deprecated GravTrait
1. [](#improved)
* Improved `Session` initialization
* Added ability to set a `theme_var()` option in page frontmatter
* Force clearing PHP `clearstatcache` and `opcache-reset` on `Cache::clear()`
* Better `Page.collection()` filtering support including ability to have non-published pages in collections
* Stopped Chrome from auto-completing admin user profile form [#1847](https://github.com/getgrav/grav/issues/1847)
* Support for empty `switch` field like a `checkbox`
* Made `modular` blueprint more flexible
* Code optimizations to `Utils` class [#1830](https://github.com/getgrav/grav/pull/1830)
* Objects: Add protected function `getElement()` to get serialized value for a single property
* `ObjectPropertyTrait`: Added protected functions `isPropertyLoaded()`, `offsetLoad()`, `offsetPrepare()` and `offsetSerialize()`
* `Grav\Framework\Cache`: Allow unlimited TTL
* Optimizations & refactoring to the test suite [#1779](https://github.com/getgrav/grav/pull/1779)
* Slight modification of Whoops error colors
* Added new configuration option `system.session.initialize` to delay session initialization if needed by a plugin
* Updated vendor libraries to latest versions
* Removed constructor from `ObjectInterface`
* Make it possible to include debug bar also into non-HTML responses
* Updated built-in JQuery to latest 3.3.1
1. [](#bugfix)
* Fixed issue with image alt tag always getting empted out unless set in markdown
* Fixed issue with remote PHP version determination for Grav updates [#1883](https://github.com/getgrav/grav/issues/1883)
* Fixed issue with _illegal scheme offset_ in `Uri::convertUrl()` [page-inject#8](https://github.com/getgrav/grav-plugin-page-inject/issues/8)
* Properly validate YAML blueprint fields so admin can save as proper YAML now [addresses many issues]
* Fixed OpenGraph metatags so only Twitter uses `name=`, and all others use `property=` [#1849](https://github.com/getgrav/grav/issues/1849)
* Fixed an issue with `evaluate()` and `evaluate_twig()` Twig functions that throws invalid template error
* Fixed issue with `|sort_by_key` twig filter if the input was null or not an array
* Date ordering should always be numeric [#1810](https://github.com/getgrav/grav/issues/1810)
* Fix for base paths containing special characters [#1799](https://github.com/getgrav/grav/issues/1799)
* Fix for session cookies in paths containing special characters
* Fix for `vundefined` error for version numbers in GPM [form#222](https://github.com/getgrav/grav-plugin-form/issues/222)
* Fixed `BadMethodCallException` thrown in GPM updates [#1784](https://github.com/getgrav/grav/issues/1784)
* NOTE: Parsedown security release now escapes `&` to `&amp;` in Markdown links
# v1.3.10
## 12/06/2017
1. [](#bugfix)
* Reverted GPM Local pull request as it broken admin [#1742](https://github.com/getgrav/grav/issues/1742)
# v1.3.9
## 12/05/2017
1. [](#new)
* Added new core Twig templates for `partials/metadata.html.twig` and `partials/messages.html.twig`
* Added ability to work with GPM locally [#1742](https://github.com/getgrav/grav/issues/1742)
* Added new HTML5 audio controls [#1756](https://github.com/getgrav/grav/issues/1756)
* Added `Medium::copy()` method to create a copy of a medium object
* Added new `force_lowercase_urls` functionality on routes and slugs
* Added new `item-list` filter type to remove empty items
* Added new `setFlashCookieObject()` and `getFlashCookieObject()` methods to `Session` object
* Added new `intl_enabled` option to disable PHP intl module collation when not needed
1. [](#bugfix)
* Fixed an issue with checkbox field validation [form#216](https://github.com/getgrav/grav-plugin-form/issues/216)
* Fixed issue with multibyte Markdown link URLs [#1749](https://github.com/getgrav/grav/issues/1749)
* Fixed issue with multibyte folder names [#1751](https://github.com/getgrav/grav/issues/1751)
* Fixed several issues related to `system.custom_base_url` that were broken [#1736](https://github.com/getgrav/grav/issues/1736)
* Dynamically added pages via `Pages::addPage()` were not firing `onPageProcessed()` event causing forms not to be processed
* Fixed `Page::active()` and `Page::activeChild()` to work with UTF-8 characters in the URL [#1727](https://github.com/getgrav/grav/issues/1727)
* Fixed typo in `modular.yaml` causing media to be ignored [#1725](https://github.com/getgrav/grav/issues/1725)
* Reverted `case_insensitive_urls` option as it was causing issues with taxonomy [#1733](https://github.com/getgrav/grav/pull/1733)
* Removed an extra `/` in `CompileFile.php` [#1693](https://github.com/getgrav/grav/pull/1693)
* Uri::Encode user and password to prevent issues in browsers
* Fixed "Invalid AJAX response" When using Built-in PHP Webserver in Windows [#1258](https://github.com/getgrav/grav-plugin-admin/issues/1258)
* Remove support for `config.user`, it was broken and bad practise
* Make sure that `clean cache` uses valid path [#1745](https://github.com/getgrav/grav/pull/1745)
* Fixed token creation issue with `Uri` params like `/id:3`
* Fixed CSS Pipeline failing with Google remote fonts if the file was minified [#1261](https://github.com/getgrav/grav-plugin-admin/issues/1261)
* Forced `field.multiple: true` to allow use of min/max options in `checkboxes.validate`
# v1.3.8
## 10/26/2017
1. [](#new)
* Added Page `media_order` capability to manually order page media via a page header
1. [](#bugfix)
* Fixed GPM update issue with filtered slugs [#1711](https://github.com/getgrav/grav/issues/1711)
* Fixed issue with missing image file not throwing 404 properly [#1713](https://github.com/getgrav/grav/issues/1713)
# v1.3.7
## 10/18/2017
1. [](#bugfix)
* Regression Uri: `base_url_absolute` always has the port number [#1690](https://github.com/getgrav/grav-plugin-admin/issues/1690)
* Uri: Prefer using REQUEST_SCHEME instead of HTTPS [#1698](https://github.com/getgrav/grav-plugin-admin/issues/1698)
* Fixed routing paths with urlencoded spaces and non-latin letters [#1688](https://github.com/getgrav/grav-plugin-admin/issues/1688)
# v1.3.6
## 10/12/2017
1. [](#bugfix)
* Regression: Ajax error in Nginx [admin#1244](https://github.com/getgrav/grav-plugin-admin/issues/1244)
* Remove the `_url=$uri` portion of the the Nginx `try_files` command [admin#1244](https://github.com/getgrav/grav-plugin-admin/issues/1244)
# v1.3.5
## 10/11/2017
1. [](#improved)
* Refactored `URI` class with numerous bug fixes, and optimizations
* Override `system.media.upload_limit` with PHP's `post_max_size` or `upload_max_filesize`
* Updated `bin/grav clean` command to remove unnecessary vendor files (save some bytes)
* Updated `bin/grav clean` command to remove unnecessary vendor files (save some bytes)
* Added a `http_status_code` Twig function to allow setting HTTP status codes from Twig directly.
* Deter XSS attacks via URI path/uri methods (credit:newbthenewbd)
* Added support for `$uri->toArray()` and `(string)$uri`
* Added support for `type` on `Asstes::addInlineJs()` [#1683](https://github.com/getgrav/grav/pull/1683)
1. [](#bugfix)
* Fixed method signature error with `GPM\InstallCommand::processPackage()` [#1682](https://github.com/getgrav/grav/pull/1682)
* Fixed method signature error with `GPM\InstallCommand::processPackage()` [#1682](https://github.com/getgrav/grav/pull/1682)
# v1.3.4
## 09/29/2017
@@ -24,7 +362,7 @@
* Improved support for Assets with query strings [#1451](https://github.com/getgrav/grav/issues/1451)
* Twig extension cleanup
1. [](#bugfix)
* Fixed an issue where fallback was not supporting dynamic page generation
* Fixed an issue where fallback was not supporting dynamic page generation
* Fixed issue with Image query string not being fully URL encoded [#1622](https://github.com/getgrav/grav/issues/1622)
* Fixed `Page::summary()` when using delimiter and multibyte UTF8 Characters [#1644](https://github.com/getgrav/grav/issues/1644)
* Fixed missing `.json` thumbnail throwing error when adding media [grav-plugin-admin#1156](https://github.com/getgrav/grav-plugin-admin/issues/1156)
@@ -67,7 +405,7 @@
* Allow `session.timeout` field to be set to `0` via blueprints [#1598](https://github.com/getgrav/grav/issues/1598)
* Fixed `Data::exists()` and `Data::raw()` functions breaking if `Data::file()` hasn't been called with non-null value
* Fixed parent theme auto-loading in child themes of Gantry 5
# v1.3.1
## 07/19/2017

View File

@@ -12,7 +12,7 @@ patches and features.
## Grav, Plugins, Themes and Skeletons
Grav is a large open source projectit's made up of over 100 repositories. When you initially consider contributing to Grav, you might be unsure about which of those 200 repositories implements the functionality you want to change or report a bug for.
Grav is a large open source projectit's made up of over 100 repositories. When you initially consider contributing to Grav, you might be unsure about which of those 200 repositories implements the functionality you want to change or report a bug for.
[https://github.com/getgrav/grav](https://github.com/getgrav/grav) is the main Grav repository. The core of Grav is provided by this repo.
@@ -60,20 +60,20 @@ Guidelines for bug reports:
A good bug report shouldn't leave others needing to chase you up for more
information. Please try to be as detailed as possible in your report.
What is your environment? Is it localhost, OSX, Linux, on a remote server? Same happening locally and or the server, or just locally or just on Linux?
- What is your environment? Is it localhost, OSX, Linux, on a remote server? Same happening locally and or the server, or just locally or just on Linux?
What steps will reproduce the issue? What browser(s) and OS experience the problem?
- What steps will reproduce the issue? What browser(s) and OS experience the problem?
What would you expect to be the outcome?
- What would you expect to be the outcome?
Did the problem start happening recently (e.g. after updating to a new version of Grav) or was this always a problem?
- Did the problem start happening recently (e.g. after updating to a new version of Grav) or was this always a problem?
If the problem started happening recently, can you reproduce the problem in an older version of Grav? What's the most recent version in which the problem doesn't happen? You can download older versions of Grav from the releases page on Github.
- If the problem started happening recently, can you reproduce the problem in an older version of Grav? What's the most recent version in which the problem doesn't happen? You can download older versions of Grav from the releases page on Github.
Can you reliably reproduce the issue? If not, provide details about how often the problem happens and under which conditions it normally happens.
- Can you reliably reproduce the issue? If not, provide details about how often the problem happens and under which conditions it normally happens.
All these details will help people to fix any potential bugs.
All these details will help contributors to fix any potential bugs.
Important: [include Code Samples in triple backticks](https://help.github.com/articles/github-flavored-markdown/#fenced-code-blocks) so that Github will provide a proper indentation. [Add the language name after the backticks](https://help.github.com/articles/github-flavored-markdown/#syntax-highlighting) to add syntax highlighting to the code snippets.

View File

@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2017 Grav
Copyright (c) 2018 Grav
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

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) [![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)
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/cfd20465-d0f8-4a0a-8444-467f5b5f16ad/mini.png)](https://insight.sensiolabs.com/projects/cfd20465-d0f8-4a0a-8444-467f5b5f16ad) [![Discord](https://img.shields.io/discord/501836936584101899.svg?logo=discord&colorB=728ADA&label=Discord%20Chat)](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,7 +18,7 @@ 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](https://learn.getgrav.org/basics/requirements#php-requirements)
- PHP 5.6.4 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
@@ -86,7 +86,7 @@ $ bin/gpm update
We appreciate any contribution to Grav, whether it is related to bugs, grammar, or simply a suggestion or improvement! Please refer to the [Contributing guide](CONTRIBUTING.md) for more guidance on this topic.
## Security issues
If you discover a possible security issue related to Grav or one of its plugins, please send an email to the core team at contact@getgrav.org and we'll address it as soon as possible.
If you discover a possible security issue related to Grav or one of its plugins, please email the core team at contact@getgrav.org and we'll address it as soon as possible.
# Getting Started
@@ -94,82 +94,25 @@ If you discover a possible security issue related to Grav or one of its plugins,
* [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)!
* If you have questions, jump on our [Discord Chat Server](https://chat.getgrav.org)!
* Have fun!
# Exploring More
* Have a look at our [Basic Tutorial](https://learn.getgrav.org/basics/basic-tutorial)
* Dive into more [advanced](https://learn.getgrav.org/advanced) functions
* Learn about the [Grav CLI](https://learn.getgrav.org/cli-console/grav-cli)
* Review examples in the [Grav Cookbook](https://learn.getgrav.org/cookbook)
# 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>
Support Grav with a monthly donation to help us continue development. [[Become a backer](https://opencollective.com/grav#backer)]
<img src="https://opencollective.com/grav/tiers/backers.svg?avatarHeight=36&width=600" />
# 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>
<img src="https://opencollective.com/grav/tiers/sponsors.svg?avatarHeight=36&width=600" />
# License
@@ -183,5 +126,5 @@ See [LICENSE](LICENSE.txt)
First install the dev dependencies by running `composer update` from the Grav root.
Then `composer test` will run the Unit Tests, which should be always executed successfully on any site.
Windows users should use the `composer test-windows` command.
You can also run a single unit test file, e.g. `composer test tests/unit/Grav/Common/AssetsTest.php`

Binary file not shown.

View File

@@ -41,5 +41,6 @@ $app->addCommands(array(
new \Grav\Console\Cli\ClearCacheCommand(),
new \Grav\Console\Cli\BackupCommand(),
new \Grav\Console\Cli\NewProjectCommand(),
new \Grav\Console\Cli\SecurityCommand(),
));
$app->run();

View File

@@ -3,32 +3,36 @@
"type": "project",
"description": "Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS",
"keywords": ["cms","flat-file cms","flat cms","flatfile cms","php"],
"homepage": "http://getgrav.org",
"homepage": "https://getgrav.org",
"license": "MIT",
"require": {
"php": ">=5.5.9",
"php": ">=5.6.4",
"twig/twig": "~1.24",
"erusev/parsedown": "~1.6",
"erusev/parsedown": "1.6.4",
"erusev/parsedown-extra": "~0.7",
"symfony/yaml": "~2.8",
"symfony/console": "~2.8",
"symfony/event-dispatcher": "~2.8",
"symfony/var-dumper": "~2.8",
"symfony/yaml": "~3.4",
"symfony/console": "~3.4",
"symfony/event-dispatcher": "~3.4",
"symfony/var-dumper": "~3.4",
"symfony/polyfill-iconv": "~1.0",
"doctrine/cache": "1.6.*",
"doctrine/collections": "1.3",
"doctrine/cache": "^1.6",
"doctrine/collections": "^1.4",
"psr/simple-cache": "^1.0",
"psr/http-message": "^1.0",
"guzzlehttp/psr7": "^1.4",
"filp/whoops": "~2.0",
"matthiasmullie/minify": "^1.3",
"monolog/monolog": "~1.0",
"gregwar/image": "2.*",
"donatj/phpuseragentparser": "~0.3",
"pimple/pimple": "~3.0",
"rockettheme/toolbox": "~1.0",
"pimple/pimple": "~3.2",
"rockettheme/toolbox": "~1.4",
"maximebf/debugbar": "~1.10",
"ext-mbstring": "*",
"ext-openssl": "*",
"ext-curl": "*",
"ext-zip": "*",
"ext-json": "*",
"league/climate": "^3.2",
"antoligy/dom-string-iterators": "^1.0",
"miljar/php-exif": "^0.6.3",
@@ -40,6 +44,11 @@
"fzaninotto/faker": "^1.5",
"victorjonsson/markdowndocs": "dev-master"
},
"config": {
"platform": {
"php": "5.6.4"
}
},
"repositories": [
{
"type": "vcs",

1166
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +1,15 @@
<?php
/**
* @package Grav.Core
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
namespace Grav;
define('GRAV_PHP_MIN', '5.5.9');
define('GRAV_PHP_MIN', '5.6.4');
// Ensure vendor libraries exist
$autoload = __DIR__ . '/vendor/autoload.php';
@@ -15,9 +17,9 @@ if (!is_file($autoload)) {
die("Please run: <i>bin/grav install</i>");
}
if (PHP_SAPI == 'cli-server') {
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>");
die("PHP webserver requires a router to run Grav, please use: <pre>php -S {$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']} system/router.php</pre>");
}
}
@@ -29,7 +31,7 @@ if (version_compare($ver = PHP_VERSION, $req = GRAV_PHP_MIN, '<')) {
}
// Register the auto-loader.
$loader = require_once $autoload;
$loader = require $autoload;
// Set timezone to default, falls back to system if php.ini not set
date_default_timezone_set(@date_default_timezone_get());

View File

@@ -9,3 +9,4 @@ Disallow: /vendor/
Disallow: /user/
Allow: /user/pages/
Allow: /user/themes/
Allow: /user/images/

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,5 @@
body header {
background: #8552A2;
background: #3085EE;
}
body .left-panel {

View File

@@ -0,0 +1,99 @@
title: PLUGIN_ADMIN.SECURITY
form:
validation: loose
fields:
xss_section:
type: section
title: PLUGIN_ADMIN.XSS_SECURITY
underline: true
xss_whitelist:
type: selectize
size: large
label: PLUGIN_ADMIN.XSS_WHITELIST_PERMISSIONS
help: PLUGIN_ADMIN.XSS_WHITELIST_PERMISSIONS_HELP
placeholder: 'admin.super'
classes: fancy
validate:
type: commalist
xss_enabled.on_events:
type: toggle
label: PLUGIN_ADMIN.XSS_ON_EVENTS
highlight: 1
options:
1: PLUGIN_ADMIN.YES
0: PLUGIN_ADMIN.NO
default: true
validate:
type: bool
xss_enabled.invalid_protocols:
type: toggle
label: PLUGIN_ADMIN.XSS_INVALID_PROTOCOLS
highlight: 1
options:
1: PLUGIN_ADMIN.YES
0: PLUGIN_ADMIN.NO
default: true
validate:
type: bool
xss_enabled.moz_binding:
type: toggle
label: PLUGIN_ADMIN.XSS_MOZ_BINDINGS
highlight: 1
options:
1: PLUGIN_ADMIN.YES
0: PLUGIN_ADMIN.NO
default: true
validate:
type: bool
xss_enabled.html_inline_styles:
type: toggle
label: PLUGIN_ADMIN.XSS_HTML_INLINE_STYLES
highlight: 1
options:
1: PLUGIN_ADMIN.YES
0: PLUGIN_ADMIN.NO
default: true
validate:
type: bool
xss_enabled.dangerous_tags:
type: toggle
label: PLUGIN_ADMIN.XSS_DANGEROUS_TAGS
highlight: 1
options:
1: PLUGIN_ADMIN.YES
0: PLUGIN_ADMIN.NO
default: true
validate:
type: bool
xss_dangerous_tags:
type: selectize
size: large
label: PLUGIN_ADMIN.XSS_DANGEROUS_TAGS_LIST
classes: fancy
validate:
type: commalist
uploads_section:
type: section
title: PLUGIN_ADMIN.UPLOADS_SECURITY
underline: true
uploads_dangerous_extensions:
type: selectize
size: large
label: PLUGIN_ADMIN.UPLOADS_DANGEROUS_EXTENSIONS
help: PLUGIN_ADMIN.UPLOADS_DANGEROUS_EXTENSIONS_HELP
classes: fancy
validate:
type: commalist

View File

@@ -835,6 +835,8 @@ form:
-1: PLUGIN_ADMIN.ERROR_SYSTEM
0: PLUGIN_ADMIN.ERROR_SIMPLE
1: PLUGIN_ADMIN.ERROR_FULL_BACKTRACE
validate:
type: int
errors.log:
@@ -994,6 +996,18 @@ form:
validate:
type: bool
session.initialize:
type: toggle
label: PLUGIN_ADMIN.SESSION_INITIALIZE
help: PLUGIN_ADMIN.SESSION_INITIALIZE_HELP
highlight: 1
options:
1: PLUGIN_ADMIN.YES
0: PLUGIN_ADMIN.NO
default: true
validate:
type: bool
session.timeout:
type: text
size: small
@@ -1131,6 +1145,16 @@ form:
label: PLUGIN_ADMIN.PWD_REGEX
help: PLUGIN_ADMIN.PWD_REGEX_HELP
intl_enabled:
type: toggle
label: PLUGIN_ADMIN.INTL_ENABLED
highlight: 1
help: PLUGIN_ADMIN.INTL_ENABLED_HELP
options:
1: PLUGIN_ADMIN.YES
0: PLUGIN_ADMIN.NO
validate:
type: bool
wrapped_site:
type: toggle
@@ -1154,17 +1178,6 @@ form:
validate:
type: bool
case_insensitive_urls:
type: toggle
label: PLUGIN_ADMIN.CASE_INSENSITIVE_URLS
highlight: 0
help: PLUGIN_ADMIN.CASE_INSENSITIVE_URLS_HELP
options:
1: PLUGIN_ADMIN.YES
0: PLUGIN_ADMIN.NO
validate:
type: bool
param_sep:
type: select
size: medium
@@ -1187,9 +1200,45 @@ form:
validate:
type: bool
force_lowercase_urls:
type: toggle
label: PLUGIN_ADMIN.FORCE_LOWERCASE_URLS
highlight: 1
default: 1
help: PLUGIN_ADMIN.FORCE_LOWERCASE_URLS_HELP
options:
1: PLUGIN_ADMIN.YES
0: PLUGIN_ADMIN.NO
validate:
type: bool
custom_base_url:
type: text
size: medium
placeholder: "e.g. http://yoursite.com/yourpath"
label: PLUGIN_ADMIN.CUSTOM_BASE_URL
help: PLUGIN_ADMIN.CUSTOM_BASE_URL_HELP
strict_mode.yaml_compat:
type: toggle
label: PLUGIN_ADMIN.STRICT_YAML_COMPAT
highlight: 1
default: 1
help: PLUGIN_ADMIN.STRICT_YAML_COMPAT_HELP
options:
1: PLUGIN_ADMIN.YES
0: PLUGIN_ADMIN.NO
validate:
type: bool
strict_mode.twig_compat:
type: toggle
label: PLUGIN_ADMIN.STRICT_TWIG_COMPAT
highlight: 1
default: 1
help: PLUGIN_ADMIN.STRICT_TWIG_COMPAT_HELP
options:
1: PLUGIN_ADMIN.YES
0: PLUGIN_ADMIN.NO
validate:
type: bool

View File

@@ -21,6 +21,9 @@ form:
title: PLUGIN_ADMIN.CONTENT
fields:
xss_check:
type: xss
header.title:
type: text
autofocus: true
@@ -32,7 +35,7 @@ form:
validate:
type: textarea
uploads:
header.media_order:
type: pagemedia
label: PLUGIN_ADMIN.PAGE_MEDIA
@@ -310,6 +313,31 @@ form:
toggleable: true
help: PLUGIN_ADMIN.APPEND_URL_EXT_HELP
routes_only:
type: section
title: PLUGIN_ADMIN.ROUTE_OVERRIDES
underline: true
fields:
header.routes.default:
type: text
toggleable: true
label: PLUGIN_ADMIN.ROUTE_DEFAULT
header.routes.canonical:
type: text
toggleable: true
label: PLUGIN_ADMIN.ROUTE_CANONICAL
header.routes.aliases:
type: array
toggleable: true
value_only: true
size: large
label: PLUGIN_ADMIN.ROUTE_ALIASES
admin_only:
type: section
title: PLUGIN_ADMIN.ADMIN_SPECIFIC_OVERRIDES

View File

@@ -1,5 +1,5 @@
title: PLUGIN_ADMIN:EXTERNAL
@extends:
extends@:
type: default
context: blueprints://pages
@@ -25,7 +25,7 @@ form:
content:
unset@: true
uploads:
header.media_order:
unset@: true
header.external_url:

View File

@@ -1,7 +1,5 @@
title: PLUGIN_ADMIN.MODULAR
@extends:
type: default
context: blueprints://pages
extends@: default
form:
fields:
@@ -13,35 +11,28 @@ form:
content:
fields:
modular_title:
type: spacer
title: PLUGIN_ADMIN.MODULAR_SETUP
header.content.items:
type: select
type: text
label: PLUGIN_ADMIN.ITEMS
default: '@self.modular'
options:
'@self.modular': Modular Children
size: medium
header.content.order.by:
type: select
type: text
label: PLUGIN_ADMIN.ORDER_BY
default: date
options:
folder: PLUGIN_ADMIN.FOLDER
title: PLUGIN_ADMIN.TITLE
date: PLUGIN_ADMIN.DATE
default: PLUGIN_ADMIN.DEFAULT
placeholder: date
help:
size: small
header.content.order.dir:
type: select
type: text
label: PLUGIN_ADMIN.ORDER
default: desc
options:
asc: PLUGIN_ADMIN.ASCENDING
desc: PLUGIN_ADMIN.DESCENDING
help: '"desc" or "asc" are valid values'
placeholder: desc
size: small
header.process:
type: ignore
content:
type: ignore
uploads:
type: ignore

View File

@@ -40,6 +40,7 @@ form:
type: password
size: large
label: PLUGIN_ADMIN.PASSWORD
autocomplete: new-password
validate:
required: false
message: PLUGIN_ADMIN.PASSWORD_VALIDATION_MESSAGE
@@ -93,6 +94,7 @@ form:
twofa_secret:
type: 2fa_secret
outerclasses: 'twofa-secret'
markdown: true
label: PLUGIN_ADMIN.2FA_SECRET
sublabel: PLUGIN_ADMIN.2FA_SECRET_HELP

View File

@@ -53,7 +53,7 @@ types:
thumb: media/thumb-flv.png
mime: video/x-flv
webm:
type: file
type: video
thumb: media/thumb-webm.png
mime: video/webm
ogv:

View File

@@ -0,0 +1,31 @@
xss_whitelist: [admin.super] # Whitelist of user access that should 'skip' XSS checking
xss_enabled:
on_events: true
invalid_protocols: true
moz_binding: true
html_inline_styles: true
dangerous_tags: true
xss_dangerous_tags:
- applet
- meta
- xml
- blink
- link
- style
- script
- embed
- object
- iframe
- frame
- frameset
- ilayer
- layer
- bgsound
- title
- base
uploads_dangerous_extensions:
- php
- html
- htm
- js
- exe

View File

@@ -3,7 +3,7 @@ default_lang: en # Default language for site (potenti
author:
name: John Appleseed # Default author name
email: 'john@email.com' # Default author email
email: 'john@example.com' # Default author email
taxonomies: [category,tag] # Arbitrary list of taxonomy types

View File

@@ -5,9 +5,11 @@ param_sep: ':' # Parameter separator, use ';'
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)
force_lowercase_urls: true # If you want to support mixed cased URLs set this to false
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
intl_enabled: true # Special logic for PHP International Extension (mod_intl)
languages:
supported: [] # List of languages supported. eg: [en, fr, de]
@@ -23,7 +25,7 @@ home:
hide_in_urls: false # Hide the home route in URLs
pages:
theme: antimatter # Default theme (defaults to "antimatter" theme)
theme: quark # Default theme (defaults to "quark" theme)
order:
by: default # Order pages by "default", "alpha" or "date"
dir: asc # Default ordering direction, "asc" or "desc"
@@ -86,7 +88,7 @@ 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
autoescape: false # Autoescape Twig vars (DEPRECATED, always enabled in strict mode)
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
@@ -130,6 +132,7 @@ media:
session:
enabled: true # Enable Session support
initialize: true # Initialize session from Grav (if false, plugin needs to start the session)
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
@@ -143,3 +146,7 @@ gpm:
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
strict_mode:
yaml_compat: true # Grav 1.5+: Enables YAML backwards compatibility
twig_compat: true # Grav 1.5+: Enables deprecated Twig autoescape setting (autoescape: false)

View File

@@ -2,18 +2,18 @@
/**
* @package Grav.Core
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
// Some standard defines
define('GRAV', true);
define('GRAV_VERSION', '1.3.5');
//define('GRAV_TESTING', true);
define('GRAV_VERSION', '1.5.8');
define('GRAV_TESTING', false);
define('DS', '/');
if (!defined('GRAV_PHP_MIN')) {
define('GRAV_PHP_MIN', '5.5.9');
define('GRAV_PHP_MIN', '5.6.4');
}
// Directories and Paths

View File

@@ -72,7 +72,6 @@ NICETIME:
SEC: sec
MIN: min
HR: hr
DAY: day
WK: wk
MO: mo
YR: yr
@@ -88,7 +87,6 @@ NICETIME:
SEC_PLURAL: secs
MIN_PLURAL: mins
HR_PLURAL: hrs
DAY_PLURAL: days
WK_PLURAL: wks
MO_PLURAL: mos
YR_PLURAL: yrs

View File

@@ -30,7 +30,6 @@ NICETIME:
SEC:
MIN:
HR:
DAY:
WK:
MO:
YR:
@@ -46,7 +45,6 @@ NICETIME:
SEC_PLURAL:
MIN_PLURAL:
HR_PLURAL:
DAY_PLURAL:
WK_PLURAL:
MO_PLURAL:
YR_PLURAL:

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Core
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -35,11 +35,15 @@ class Assets
const CSS_URL_REGEX = '{url\(([\'\"]?)(.*?)\1\)}';
/** @const Regex to match CSS sourcemap comments */
const CSS_SOURCEMAP_REGEX = '{\/\*# (.*) \*\/}';
const CSS_SOURCEMAP_REGEX = '{\/\*# (.*?) \*\/}';
/** @const Regex to match CSS import content */
const CSS_IMPORT_REGEX = '{@import(.*);}';
const CSS_IMPORT_REGEX = '{@import(.*?);}';
/**
* @const Regex to match <script> or <style> tag when adding inline style/script. Note that this only supports a
* single tag, so the check is greedy to avoid issues in JS.
*/
const HTML_TAG_REGEX = '#(<([A-Z][A-Z0-9]*)>)+(.*)(<\/\2>)#is';
@@ -613,7 +617,7 @@ class Assets
$inlineGroup = array_key_exists('loading', $attributes) && $attributes['loading'] === 'inline';
$attributes = $this->attributes(array_merge(['type' => 'text/javascript'], $attributes));
$attributes = $this->attributes($attributes);
$output = '';
$inline_js = '';

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.Backup
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -32,7 +32,7 @@ class ZipBackup
/**
* Backup
*
* @param null $destination
* @param string|null $destination
* @param callable|null $messager
*
* @return null|string
@@ -107,18 +107,19 @@ class ZipBackup
* @param $exclusiveLength
* @param $messager
*/
private static function folderToZip($folder, \ZipArchive &$zipFile, $exclusiveLength, callable $messager = null)
private static function folderToZip($folder, \ZipArchive $zipFile, $exclusiveLength, callable $messager = null)
{
$handle = opendir($folder);
while (false !== $f = readdir($handle)) {
if ($f != '.' && $f != '..') {
if ($f !== '.' && $f !== '..') {
$filePath = "$folder/$f";
// Remove prefix from file path before add to zip.
$localPath = substr($filePath, $exclusiveLength);
if (in_array($f, static::$ignoreFolders)) {
continue;
} elseif (in_array($localPath, static::$ignorePaths)) {
}
if (in_array($localPath, static::$ignorePaths)) {
$zipFile->addEmptyDir($f);
continue;
}

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -390,6 +390,7 @@ class Cache extends Getters
// Convert stream to a real path
try {
$path = $locator->findResource($stream, true, true);
if($path === false) continue;
$anything = false;
$files = glob($path . '/*');
@@ -428,6 +429,14 @@ class Cache extends Getters
$output[] = '';
}
// Clear stat cache
@clearstatcache();
// Clear opcache
if (function_exists('opcache_reset')) {
@opcache_reset();
}
return $output;
}

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
namespace Grav\Common\Config;
@@ -32,7 +32,7 @@ class CompiledBlueprints extends CompiledBase
*/
public function checksum()
{
if (!isset($this->checksum)) {
if (null === $this->checksum) {
$this->checksum = md5(json_encode($this->files) . json_encode($this->getTypes()) . $this->version);
}
@@ -92,6 +92,7 @@ class CompiledBlueprints extends CompiledBase
// Convert file list into parent list.
$list = [];
/** @var array $files */
foreach ($this->files as $files) {
foreach ($files as $name => $item) {
$list[$name][] = $this->path . $item['file'];

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.Config
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -60,7 +60,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->mergeRecursive([$name => $file->content()]);
}

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.Config
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -16,6 +16,7 @@ use Grav\Common\Utils;
class Config extends Data
{
/** @var string */
protected $checksum;
protected $modified = false;
protected $timestamp = 0;
@@ -108,6 +109,8 @@ class Config extends Data
*/
public function getLanguages()
{
user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.5, use Grav::instance()[\'languages\'] instead', E_USER_DEPRECATED);
return Grav::instance()['languages'];
}
}

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.Config
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -207,7 +207,7 @@ class ConfigFileFinder
continue;
}
$name = $directory->getBasename();
$name = $directory->getFilename();
$find = ($lookup ?: $name) . '.yaml';
$filename = "{$path}/{$name}/{$find}";

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.Config
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -133,11 +133,12 @@ class Setup extends Data
*/
public function __construct($container)
{
$environment = isset(static::$environment) ? static::$environment : ($container['uri']->environment() ?: 'localhost');
$environment = null !== static::$environment ? static::$environment : ($container['uri']->environment() ?: 'localhost');
// Pre-load setup.php which contains our initial configuration.
// Configuration may contain dynamic parts, which is why we need to always load it.
$file = GRAV_ROOT . '/setup.php';
// If "GRAVE_SETUP_PATH" has been defined, use it, otherwise use defaults.
$file = defined('GRAV_SETUP_PATH') ? GRAV_SETUP_PATH : GRAV_ROOT . '/setup.php';
$setup = is_file($file) ? (array) include $file : [];
// Add default streams defined in beginning of the class.
@@ -151,11 +152,13 @@ class Setup extends Data
// Set up environment.
$this->def('environment', $environment ?: 'cli');
$this->def('streams.schemes.environment.prefixes', ['' => ($environment ? ["user://{$this->environment}"] : [])]);
$this->def('streams.schemes.environment.prefixes', ['' => $environment ? ["user://{$this->environment}"] : []]);
}
/**
* @return $this
* @throws \RuntimeException
* @throws \InvalidArgumentException
*/
public function init()
{
@@ -175,7 +178,7 @@ class Setup extends Data
// Update streams.
foreach (array_reverse($files) as $path) {
$file = CompiledYamlFile::instance($path);
$content = $file->content();
$content = (array)$file->content();
if (!empty($content['schemes'])) {
$this->items['streams']['schemes'] = $content['schemes'] + $this->items['streams']['schemes'];
}
@@ -196,6 +199,7 @@ class Setup extends Data
* Initialize resource locator by using the configuration.
*
* @param UniformResourceLocator $locator
* @throws \BadMethodCallException
*/
public function initializeLocator(UniformResourceLocator $locator)
{
@@ -212,7 +216,7 @@ class Setup extends Data
$force = isset($config['force']) ? $config['force'] : false;
if (isset($config['prefixes'])) {
foreach ($config['prefixes'] as $prefix => $paths) {
foreach ((array)$config['prefixes'] as $prefix => $paths) {
$locator->addPath($scheme, $prefix, $paths, $override, $force);
}
}
@@ -229,7 +233,7 @@ class Setup extends Data
$schemes = [];
foreach ((array) $this->get('streams.schemes') as $scheme => $config) {
$type = !empty($config['type']) ? $config['type'] : 'ReadOnlyStream';
if ($type[0] != '\\') {
if ($type[0] !== '\\') {
$type = '\\RocketTheme\\Toolbox\\StreamWrapper\\' . $type;
}
@@ -242,6 +246,8 @@ class Setup extends Data
/**
* @param UniformResourceLocator $locator
* @throws \InvalidArgumentException
* @throws \BadMethodCallException
* @throws \RuntimeException
*/
protected function check(UniformResourceLocator $locator)
{
@@ -256,18 +262,22 @@ class Setup extends Data
);
}
if (!$locator->findResource('environment://config', true)) {
// If environment does not have its own directory, remove it from the lookup.
$this->set('streams.schemes.environment.prefixes', ['config' => []]);
$this->initializeLocator($locator);
}
try {
if (!$locator->findResource('environment://config', true)) {
// If environment does not have its own directory, remove it from the lookup.
$this->set('streams.schemes.environment.prefixes', ['config' => []]);
$this->initializeLocator($locator);
}
// Create security.yaml if it doesn't exist.
$filename = $locator->findResource('config://security.yaml', true, true);
$file = YamlFile::instance($filename);
if (!$file->exists()) {
$file->save(['salt' => Utils::generateRandomString(14)]);
$file->free();
// Create security.yaml if it doesn't exist.
$filename = $locator->findResource('config://security.yaml', true, true);
$file = YamlFile::instance($filename);
if (!$file->exists()) {
$file->save(['salt' => Utils::generateRandomString(14)]);
$file->free();
}
} catch (\RuntimeException $e) {
throw new \RuntimeException(sprintf('Grav failed to initialize: %s', $e->getMessage()), 500, $e);
}
}
}

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.Data
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -78,7 +78,7 @@ class BlueprintSchema extends BlueprintSchemaBase implements ExportInterface
} elseif (is_array($field) && is_array($val)) {
// Array has been defined in blueprints.
$messages += $this->validateArray($field, $val);
} elseif (isset($rules['validation']) && $rules['validation'] == 'strict') {
} elseif (isset($rules['validation']) && $rules['validation'] === 'strict') {
// Undefined/extra item.
throw new \RuntimeException(sprintf('%s is not defined in blueprints', $key));
}
@@ -106,7 +106,7 @@ class BlueprintSchema extends BlueprintSchemaBase implements ExportInterface
} elseif (is_array($field) && is_array($val)) {
// Array has been defined in blueprints.
$field = $this->filterArray($field, $val);
} elseif (isset($rules['validation']) && $rules['validation'] == 'strict') {
} elseif (isset($rules['validation']) && $rules['validation'] === 'strict') {
$field = null;
}
@@ -138,7 +138,7 @@ class BlueprintSchema extends BlueprintSchemaBase implements ExportInterface
if (isset($data[$name])) {
continue;
}
if ($field['type'] == 'file' && isset($data['data']['name'][$name])) { //handle case of file input fields required
if ($field['type'] === 'file' && isset($data['data']['name'][$name])) { //handle case of file input fields required
continue;
}
@@ -164,7 +164,7 @@ class BlueprintSchema extends BlueprintSchemaBase implements ExportInterface
$default = isset($field[$property]) ? $field[$property] : null;
$config = Grav::instance()['config']->get($value, $default);
if (!is_null($config)) {
if (null !== $config) {
$field[$property] = $config;
}
}

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.Data
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -65,11 +65,11 @@ class Blueprints
/** @var \DirectoryIterator $file */
foreach ($iterator as $file) {
if (!$file->isFile() || '.' . $file->getExtension() != YAML_EXT) {
if (!$file->isFile() || '.' . $file->getExtension() !== YAML_EXT) {
continue;
}
$name = $file->getBasename(YAML_EXT);
$this->types[$name] = ucfirst(strtr($name, '_', ' '));
$this->types[$name] = ucfirst(str_replace('_', ' ', $name));
}
}

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.Data
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -233,6 +233,7 @@ class Data implements DataInterface, \ArrayAccess, \Countable, ExportInterface
/**
* Save data if storage has been defined.
* @throws \RuntimeException
*/
public function save()
{

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.Data
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -10,9 +10,8 @@ namespace Grav\Common\Data;
use Grav\Common\Grav;
use Grav\Common\Utils;
use Symfony\Component\Yaml\Exception\ParseException;
use Symfony\Component\Yaml\Parser;
use Symfony\Component\Yaml\Yaml;
use Grav\Common\Yaml;
use RocketTheme\Toolbox\Compat\Yaml\Yaml as FallbackYaml;
class Validation
{
@@ -28,9 +27,12 @@ class Validation
$messages = [];
$validate = isset($field['validate']) ? (array) $field['validate'] : [];
// Validate type with fallback type text.
$type = (string) isset($validate['type']) ? $validate['type'] : $field['type'];
$method = 'type'.strtr($type, '-', '_');
// If value isn't required, we will stop validation if empty value is given.
if (empty($validate['required']) && ($value === null || $value === '')) {
if ((empty($validate['required']) || (isset($validate['required']) && $validate['required'] !== true)) && ($value === null || $value === '' || (($field['type'] === 'checkbox' || $field['type'] === 'switch') && $value == false))) {
return $messages;
}
@@ -38,23 +40,20 @@ class Validation
$field['type'] = 'text';
}
// If this is a YAML field, stop validation
if (isset($field['yaml']) && $field['yaml'] === true) {
return $messages;
}
// Get language class.
$language = Grav::instance()['language'];
// Validate type with fallback type text.
$type = (string) isset($field['validate']['type']) ? $field['validate']['type'] : $field['type'];
$method = 'type'.strtr($type, '-', '_');
$name = ucfirst(isset($field['label']) ? $field['label'] : $field['name']);
$message = (string) isset($field['validate']['message'])
? $language->translate($field['validate']['message'])
: $language->translate('FORM.INVALID_INPUT', null, true) . ' "' . $language->translate($name) . '"';
// If this is a YAML field validate/filter as such
if ($type != 'yaml' && isset($field['yaml']) && $field['yaml'] === true) {
$method = 'typeYaml';
}
if (method_exists(__CLASS__, $method)) {
$success = self::$method($value, $validate, $field);
} else {
@@ -101,15 +100,16 @@ class Validation
$field['type'] = 'text';
}
// If this is a YAML field, simply parse it and return the value.
if (isset($field['yaml']) && $field['yaml'] === true) {
return $value;
}
// Validate type with fallback type text.
$type = (string) isset($field['validate']['type']) ? $field['validate']['type'] : $field['type'];
$method = 'filter' . ucfirst(strtr($type, '-', '_'));
// If this is a YAML field validate/filter as such
if ($type !== 'yaml' && isset($field['yaml']) && $field['yaml'] === true) {
$method = 'filterYaml';
}
if (!method_exists(__CLASS__, $method)) {
$method = 'filterText';
}
@@ -127,10 +127,12 @@ class Validation
*/
public static function typeText($value, array $params, array $field)
{
if (!is_string($value)) {
if (!is_string($value) && !is_numeric($value)) {
return false;
}
$value = (string)$value;
if (isset($params['min']) && strlen($value) < $params['min']) {
return false;
}
@@ -161,7 +163,7 @@ class Validation
return is_array($value) ? $value : preg_split('/\s*,\s*/', $value, -1, PREG_SPLIT_NO_EMPTY);
}
protected static function typeCommaList($value, array $params, array $field)
public static function typeCommaList($value, array $params, array $field)
{
return is_array($value) ? true : self::typeText($value, $params, $field);
}
@@ -230,6 +232,8 @@ class Validation
*/
public static function typeCheckboxes($value, array $params, array $field)
{
// Set multiple: true so checkboxes can easily use min/max counts to control number of options required
$field['multiple'] = true;
return self::typeArray((array) $value, $params, $field);
}
@@ -253,7 +257,7 @@ class Validation
if (!isset($field['value'])) {
$field['value'] = 1;
}
if ($value && $value != $field['value']) {
if (isset($value) && $value != $field['value']) {
return false;
}
@@ -638,23 +642,14 @@ class Validation
return (array) $value;
}
public static function typeYaml($value, $params)
{
try {
Yaml::parse($value);
return true;
} catch (ParseException $e) {
return false;
}
}
public static function filterYaml($value, $params)
{
try {
return (array) Yaml::parse($value);
} catch (ParseException $e) {
return null;
if (!is_string($value)) {
return $value;
}
return (array) Yaml::parse($value);
}
/**
@@ -758,6 +753,11 @@ class Validation
&& $value instanceof \Countable);
}
public static function filterItem_List($value, $params)
{
return array_values(array_filter($value, function($v) { return !empty($v); } ));
}
public static function validateJson($value, $params)
{
return (bool) (@json_decode($value));

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.Data
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/

View File

@@ -2,13 +2,14 @@
/**
* @package Grav.Common
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
namespace Grav\Common;
use DebugBar\DataCollector\ConfigCollector;
use DebugBar\DataCollector\MessagesCollector;
use DebugBar\JavascriptRenderer;
use DebugBar\StandardDebugBar;
use Grav\Common\Config\Config;
@@ -31,13 +32,24 @@ class Debugger
protected $timers = [];
/** @var string[] $deprecations */
protected $deprecations = [];
protected $errorHandler;
/**
* Debugger constructor.
*/
public function __construct()
{
// Enable debugger until $this->init() gets called.
$this->enabled = true;
$this->debugbar = new StandardDebugBar();
$this->debugbar['time']->addMeasure('Loading', $this->debugbar['time']->getRequestStartTime(), microtime(true));
// Set deprecation collector.
$this->setErrorHandler();
}
/**
@@ -51,9 +63,19 @@ class Debugger
$this->grav = Grav::instance();
$this->config = $this->grav['config'];
// Enable/disable debugger based on configuration.
$this->enabled = $this->config->get('system.debugger.enabled');
if ($this->enabled()) {
$plugins_config = (array)$this->config->get('plugins');
ksort($plugins_config);
$this->debugbar->addCollector(new ConfigCollector((array)$this->config->get('system'), 'Config'));
$this->debugbar->addCollector(new ConfigCollector((array)$this->config->get('plugins'), 'Plugins'));
$this->debugbar->addCollector(new ConfigCollector($plugins_config, 'Plugins'));
$this->addMessage('Grav v' . GRAV_VERSION);
}
return $this;
@@ -68,12 +90,8 @@ class Debugger
*/
public function enabled($state = null)
{
if (isset($state)) {
if ($state !== null) {
$this->enabled = $state;
} else {
if (!isset($this->enabled)) {
$this->enabled = $this->config->get('system.debugger.enabled');
}
}
return $this->enabled;
@@ -90,8 +108,7 @@ class Debugger
// Only add assets if Page is HTML
$page = $this->grav['page'];
if ($page->templateFormat() != 'html') {
$this->enabled = false;
if ($page->templateFormat() !== 'html') {
return $this;
}
@@ -106,13 +123,13 @@ class Debugger
// Get the required CSS files
list($css_files, $js_files) = $this->renderer->getAssets(null, JavascriptRenderer::RELATIVE_URL);
foreach ($css_files as $css) {
foreach ((array)$css_files as $css) {
$assets->addCss($css);
}
$assets->addCss('/system/assets/debugger.css');
foreach ($js_files as $js) {
foreach ((array)$js_files as $js) {
$assets->addJs($js);
}
}
@@ -120,9 +137,9 @@ class Debugger
return $this;
}
public function getCaller($ignore = 2)
public function getCaller($limit = 2)
{
$trace = debug_backtrace(false, $ignore);
$trace = debug_backtrace(false, $limit);
return array_pop($trace);
}
@@ -163,6 +180,14 @@ class Debugger
public function render()
{
if ($this->enabled()) {
// Only add assets if Page is HTML
$page = $this->grav['page'];
if (!$this->renderer || $page->templateFormat() !== 'html') {
return $this;
}
$this->addDeprecations();
echo $this->renderer->render();
}
@@ -176,11 +201,31 @@ class Debugger
*/
public function sendDataInHeaders()
{
$this->debugbar->sendDataInHeaders();
if ($this->enabled()) {
$this->addDeprecations();
$this->debugbar->sendDataInHeaders();
}
return $this;
}
/**
* Returns collected debugger data.
*
* @return array
*/
public function getData()
{
if (!$this->enabled()) {
return null;
}
$this->addDeprecations();
$this->timers = [];
return $this->debugbar->getData();
}
/**
* Start a timer with an associated name and description
*
@@ -191,7 +236,7 @@ class Debugger
*/
public function startTimer($name, $description = null)
{
if ($name[0] == '_' || $this->config->get('system.debugger.enabled')) {
if ($name[0] === '_' || $this->enabled()) {
$this->debugbar['time']->startMeasure($name, $description);
$this->timers[] = $name;
}
@@ -208,7 +253,7 @@ class Debugger
*/
public function stopTimer($name)
{
if (in_array($name, $this->timers) && ($name[0] == '_' || $this->config->get('system.debugger.enabled'))) {
if (in_array($name, $this->timers, true) && ($name[0] === '_' || $this->enabled())) {
$this->debugbar['time']->stopMeasure($name);
}
@@ -247,4 +292,152 @@ class Debugger
return $this;
}
public function setErrorHandler()
{
$this->errorHandler = set_error_handler(
[$this, 'deprecatedErrorHandler']
);
}
/**
* @param int $errno
* @param string $errstr
* @param string $errfile
* @param int $errline
* @return bool
*/
public function deprecatedErrorHandler($errno, $errstr, $errfile, $errline)
{
if ($errno !== E_USER_DEPRECATED) {
if ($this->errorHandler) {
return \call_user_func($this->errorHandler, $errno, $errstr, $errfile, $errline);
}
return true;
}
if (!$this->enabled()) {
return true;
}
$backtrace = debug_backtrace(false);
// Skip current call.
array_shift($backtrace);
// Skip vendor libraries and the method where error was triggered.
while ($current = array_shift($backtrace)) {
if (isset($current['file']) && strpos($current['file'], 'vendor') !== false) {
continue;
}
if (isset($current['function']) && ($current['function'] === 'user_error' || $current['function'] === 'trigger_error')) {
$current = array_shift($backtrace);
}
break;
}
// Add back last call.
array_unshift($backtrace, $current);
// Filter arguments.
foreach ($backtrace as &$current) {
if (isset($current['args'])) {
$args = [];
foreach ($current['args'] as $arg) {
if (\is_string($arg)) {
$args[] = "'" . $arg . "'";
} elseif (\is_bool($arg)) {
$args[] = $arg ? 'true' : 'false';
} elseif (\is_scalar($arg)) {
$args[] = $arg;
} elseif (\is_object($arg)) {
$args[] = get_class($arg) . ' $object';
} elseif (\is_array($arg)) {
$args[] = '$array';
} else {
$args[] = '$object';
}
}
$current['args'] = $args;
}
}
unset($current);
$this->deprecations[] = [
'message' => $errstr,
'file' => $errfile,
'line' => $errline,
'trace' => $backtrace,
];
// Do not pass forward.
return true;
}
protected function addDeprecations()
{
if (!$this->deprecations) {
return;
}
$collector = new MessagesCollector('deprecated');
$this->addCollector($collector);
$collector->addMessage('Your site is using following deprecated features:');
/** @var array $deprecated */
foreach ($this->deprecations as $deprecated) {
list($message, $scope) = $this->getDepracatedMessage($deprecated);
$collector->addMessage($message, $scope);
}
}
protected function getDepracatedMessage($deprecated)
{
$scope = 'unknown';
if (stripos($deprecated['message'], 'grav') !== false) {
$scope = 'grav';
} elseif (!isset($deprecated['file'])) {
$scope = 'unknown';
} elseif (stripos($deprecated['file'], 'twig') !== false) {
$scope = 'twig';
} elseif (stripos($deprecated['file'], 'yaml') !== false) {
$scope = 'yaml';
} elseif (stripos($deprecated['file'], 'vendor') !== false) {
$scope = 'vendor';
}
$trace = [];
foreach ($deprecated['trace'] as $current) {
$class = isset($current['class']) ? $current['class'] : '';
$type = isset($current['type']) ? $current['type'] : '';
$function = $this->getFunction($current);
if (isset($current['file'])) {
$current['file'] = str_replace(GRAV_ROOT . '/', '', $current['file']);
}
unset($current['class'], $current['type'], $current['function'], $current['args']);
$trace[] = ['call' => $class . $type . $function] + $current;
}
return [
[
'message' => $deprecated['message'],
'trace' => $trace
],
$scope
];
}
protected function getFunction($trace)
{
if (!isset($trace['function'])) {
return '';
}
return $trace['function'] . '(' . implode(', ', $trace['args']) . ')';
}
}

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.Errors
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -18,6 +18,13 @@ class BareHandler extends Handler
*/
public function handle()
{
$inspector = $this->getInspector();
$code = $inspector->getException()->getCode();
if ( ($code >= 400) && ($code < 600) )
{
$this->getRun()->sendHttpCode($code);
}
return Handler::QUIT;
}

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.Errors
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -74,5 +74,8 @@ class Errors
}
$whoops->register();
// Re-register deprecation handler.
$grav['debugger']->setErrorHandler();
}
}

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.Errors
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -35,6 +35,10 @@ class SimplePageHandler extends Handler
$cssFile = $this->getResource("error.css");
$code = $inspector->getException()->getCode();
if ( ($code >= 400) && ($code < 600) )
{
$this->getRun()->sendHttpCode($code);
}
$message = $inspector->getException()->getMessage();
if ($inspector->getException() instanceof \ErrorException) {
@@ -57,6 +61,7 @@ class SimplePageHandler extends Handler
* @param $resource
*
* @return string
* @throws \RuntimeException
*/
protected function getResource($resource)
{
@@ -80,8 +85,7 @@ class SimplePageHandler extends Handler
// If we got this far, nothing was found.
throw new \RuntimeException(
"Could not find resource '$resource' in any resource paths."
. "(searched: " . join(", ", $this->searchPaths). ")"
"Could not find resource '{$resource}' in any resource paths (searched: " . implode(', ', $this->searchPaths). ')'
);
}
@@ -89,7 +93,7 @@ class SimplePageHandler extends Handler
{
if (!is_dir($path)) {
throw new \InvalidArgumentException(
"'$path' is not a valid directory"
"'{$path}' is not a valid directory"
);
}

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.Errors
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -20,14 +20,11 @@ trait CompiledFile
*/
public function content($var = null)
{
// Set some options
$this->settings(['native' => true, 'compat' => true]);
try {
// If nothing has been loaded, attempt to get pre-compiled version of the file first.
if ($var === null && $this->raw === null && $this->content === null) {
$key = md5($this->filename);
$file = PhpFile::instance(CACHE_DIR . DS . "compiled/files/{$key}{$this->extension}.php");
$file = PhpFile::instance(CACHE_DIR . "compiled/files/{$key}{$this->extension}.php");
$modified = $this->modified();
@@ -42,9 +39,9 @@ trait CompiledFile
// Load real file if cache isn't up to date (or is invalid).
if (
!isset($cache['@class'])
|| $cache['@class'] != $class
|| $cache['modified'] != $modified
|| $cache['filename'] != $this->filename
|| $cache['@class'] !== $class
|| $cache['modified'] !== $modified
|| $cache['filename'] !== $this->filename
) {
// Attempt to lock the file for writing.
try {
@@ -85,4 +82,28 @@ trait CompiledFile
return parent::content($var);
}
/**
* Serialize file.
*/
public function __sleep()
{
return [
'filename',
'extension',
'raw',
'content',
'settings'
];
}
/**
* Unserialize file.
*/
public function __wakeup()
{
if (!isset(static::$instances[$this->filename])) {
static::$instances[$this->filename] = $this;
}
}
}

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.File
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -108,8 +108,7 @@ abstract class Folder
$files[] = $file->getPathname() . '?'. $file->getMTime();
}
$hash = md5(serialize($files));
return $hash;
return md5(serialize($files));
}
/**
@@ -234,7 +233,7 @@ abstract class Folder
/** @var \RecursiveDirectoryIterator $file */
foreach ($iterator as $file) {
// Ignore hidden files.
if ($file->getFilename()[0] == '.') {
if ($file->getFilename()[0] === '.') {
continue;
}
if (!$folders && $file->isDir()) {
@@ -339,7 +338,7 @@ abstract class Folder
}
// Don't do anything if the source is the same as the new target
if ($source == $target) {
if ($source === $target) {
return;
}
@@ -377,6 +376,7 @@ abstract class Folder
* @param string $target
* @param bool $include_target
* @return bool
* @throws \RuntimeException
*/
public static function delete($target, $include_target = true)
{
@@ -435,6 +435,7 @@ abstract class Folder
* @param $dest
*
* @return bool
* @throws \RuntimeException
*/
public static function rcopy($src, $dest)
{
@@ -447,7 +448,7 @@ abstract class Folder
// If the destination directory does not exist create it
if (!is_dir($dest)) {
Folder::mkdir($dest);
static::mkdir($dest);
}
// Open the source directory to read in files
@@ -455,10 +456,10 @@ abstract class Folder
/** @var \DirectoryIterator $f */
foreach ($i as $f) {
if ($f->isFile()) {
copy($f->getRealPath(), "$dest/" . $f->getFilename());
copy($f->getRealPath(), "{$dest}/" . $f->getFilename());
} else {
if (!$f->isDot() && $f->isDir()) {
static::rcopy($f->getRealPath(), "$dest/$f");
static::rcopy($f->getRealPath(), "{$dest}/{$f}");
}
}
}
@@ -479,10 +480,10 @@ abstract class Folder
}
// Go through all items in filesystem and recursively remove everything.
$files = array_diff(scandir($folder), array('.', '..'));
$files = array_diff(scandir($folder, SCANDIR_SORT_NONE), array('.', '..'));
foreach ($files as $file) {
$path = "{$folder}/{$file}";
(is_dir($path)) ? self::doDelete($path) : @unlink($path);
is_dir($path) ? self::doDelete($path) : @unlink($path);
}
return $include_target ? @rmdir($folder) : true;

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.FileSystem
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -37,7 +37,7 @@ class RecursiveFolderFilterIterator extends \RecursiveFilterIterator
/** @var $current \SplFileInfo */
$current = $this->current();
if ($current->isDir() && !in_array($current->getFilename(), $this::$folder_ignores)) {
if ($current->isDir() && !in_array($current->getFilename(), $this::$folder_ignores, true)) {
return true;
}
return false;

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.GPM
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -13,7 +13,7 @@ use Grav\Common\Filesystem\Folder;
use Grav\Common\Inflector;
use Grav\Common\Iterator;
use Grav\Common\Utils;
use Symfony\Component\Yaml\Yaml;
use RocketTheme\Toolbox\File\YamlFile;
class GPM extends Iterator
{
@@ -624,7 +624,10 @@ class GPM extends Iterator
return false;
}
$blueprint = (array)Yaml::parse(file_get_contents($blueprint_file));
$file = YamlFile::instance($blueprint_file);
$blueprint = (array)$file->content();
$file->free();
return $blueprint;
}
@@ -719,8 +722,8 @@ class GPM extends Iterator
foreach ($packages as $package_name => $package) {
if (isset($package['dependencies'])) {
foreach ($package['dependencies'] as $dependency) {
if (is_array($dependency)) {
$dependency = array_keys($dependency)[0];
if (is_array($dependency) && isset($dependency['name'])) {
$dependency = $dependency['name'];
}
if ($dependency == $slug) {
@@ -835,6 +838,20 @@ class GPM extends Iterator
continue;
}
// Check PHP version
if ($dependency_slug == 'php') {
$current_php_version = phpversion();
if (version_compare($this->calculateVersionNumberFromDependencyVersion($dependencyVersionWithOperator),
$current_php_version) === 1
) {
//Needs a Grav update first
throw new \Exception("<red>One of the packages require PHP " . $dependencies['php'] . ". Please update PHP to resolve this");
} else {
unset($dependencies[$dependency_slug]);
continue;
}
}
//First, check for Grav dependency. If a dependency requires Grav > the current version, abort and tell.
if ($dependency_slug == 'grav') {
if (version_compare($this->calculateVersionNumberFromDependencyVersion($dependencyVersionWithOperator),
@@ -859,7 +876,9 @@ class GPM extends Iterator
// get currently installed version
$locator = Grav::instance()['locator'];
$blueprints_path = $locator->findResource('plugins://' . $dependency_slug . DS . 'blueprints.yaml');
$package_yaml = Yaml::parse(file_get_contents($blueprints_path));
$file = YamlFile::instance($blueprints_path);
$package_yaml = $file->content();
$file->free();
$currentlyInstalledVersion = $package_yaml['version'];
// if requirement is next significant release, check is compatible with currently installed version, might not be
@@ -1062,9 +1081,9 @@ class GPM extends Iterator
} elseif ($version == '') {
return null;
} elseif ($this->versionFormatIsNextSignificantRelease($version)) {
return substr($version, 1);
return trim(substr($version, 1));
} elseif ($this->versionFormatIsEqualOrHigher($version)) {
return substr($version, 2);
return trim(substr($version, 2));
} else {
return $version;
}

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.GPM
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -43,6 +43,11 @@ class Installer
*/
protected static $error = 0;
/**
* @var integer Zip Error Code
*/
protected static $error_zip = 0;
/**
* @var string Post install message
*/
@@ -190,10 +195,10 @@ class Installer
}
self::$error = self::ZIP_EXTRACT_ERROR;
self::$error_zip = $archive;
return false;
}
/**
* Instantiates and returns the package installer class
*
@@ -291,17 +296,17 @@ class Installer
{
foreach (new \DirectoryIterator($source_path) as $file) {
if ($file->isLink() || $file->isDot() || in_array($file->getBasename(),$ignores)) {
if ($file->isLink() || $file->isDot() || in_array($file->getFilename(), $ignores)) {
continue;
}
$path = $install_path . DS . $file->getBasename();
$path = $install_path . DS . $file->getFilename();
if ($file->isDir()) {
Folder::delete($path);
Folder::move($file->getPathname(), $path);
if ($file->getBasename() == 'bin') {
if ($file->getFilename() === 'bin') {
foreach (glob($path . DS . '*') as $bin_file) {
@chmod($bin_file, 0755);
}
@@ -460,7 +465,42 @@ class Installer
break;
case self::ZIP_EXTRACT_ERROR:
$msg = 'An error occurred while extracting the package';
$msg = 'Unable to extract the package. ';
if (self::$error_zip) {
switch(self::$error_zip) {
case \ZipArchive::ER_EXISTS:
$msg .= "File already exists.";
break;
case \ZipArchive::ER_INCONS:
$msg .= "Zip archive inconsistent.";
break;
case \ZipArchive::ER_MEMORY:
$msg .= "Malloc failure.";
break;
case \ZipArchive::ER_NOENT:
$msg .= "No such file.";
break;
case \ZipArchive::ER_NOZIP:
$msg .= "Not a zip archive.";
break;
case \ZipArchive::ER_OPEN:
$msg .= "Can't open file.";
break;
case \ZipArchive::ER_READ:
$msg .= "Read error.";
break;
case \ZipArchive::ER_SEEK:
$msg .= "Seek error.";
break;
}
}
break;
default:

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.GPM
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -114,7 +114,7 @@ class Licenses
{
if (!isset(self::$file)) {
$path = Grav::instance()['locator']->findResource('user://data') . '/licenses.yaml';;
$path = Grav::instance()['locator']->findResource('user://data') . '/licenses.yaml';
if (!file_exists($path)) {
touch($path);
}

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.GPM
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -18,10 +18,12 @@ class GravCore extends AbstractPackageCollection
private $version;
private $date;
private $min_php;
/**
* @param bool $refresh
* @param null $callback
* @throws \InvalidArgumentException
*/
public function __construct($refresh = false, $callback = null)
{
@@ -36,9 +38,10 @@ class GravCore extends AbstractPackageCollection
$this->data = json_decode($this->raw, true);
$this->version = isset($this->data['version']) ? $this->data['version'] : '-';
$this->date = isset($this->data['date']) ? $this->data['date'] : '-';
$this->min_php = isset($this->data['min_php']) ? $this->data['min_php'] : null;
if (isset($this->data['assets'])) {
foreach ($this->data['assets'] as $slug => $data) {
foreach ((array)$this->data['assets'] as $slug => $data) {
$this->items[$slug] = new Package($data);
}
}
@@ -68,10 +71,10 @@ class GravCore extends AbstractPackageCollection
}
$diffLog = [];
foreach ($this->data['changelog'] as $version => $changelog) {
foreach ((array)$this->data['changelog'] as $version => $changelog) {
preg_match("/[\w-\.]+/", $version, $cleanVersion);
if (!$cleanVersion || version_compare($diff, $cleanVersion[0], ">=")) {
if (!$cleanVersion || version_compare($diff, $cleanVersion[0], '>=')) {
continue;
}
@@ -91,6 +94,11 @@ class GravCore extends AbstractPackageCollection
return $this->date;
}
/**
* Determine if this version of Grav is eligible to be updated
*
* @return mixed
*/
public function isUpdatable()
{
return version_compare(GRAV_VERSION, $this->getVersion(), '<');
@@ -106,6 +114,25 @@ class GravCore extends AbstractPackageCollection
return $this->version;
}
/**
* Returns the minimum PHP version
*
* @return null|string
*/
public function getMinPHPVersion()
{
// If non min set, assume current PHP version
if (is_null($this->min_php)) {
$this->min_php = phpversion();
}
return $this->min_php;
}
/**
* Is this installation symlinked?
*
* @return bool
*/
public function isSymlink()
{
return is_link(GRAV_ROOT . DS . 'index.php');

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.GPM
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -24,11 +24,14 @@ class Upgrader
*/
private $remote;
private $min_php;
/**
* Creates a new GPM instance with Local and Remote packages available
*
* @param boolean $refresh Applies to Remote Packages only and forces a refetch of data
* @param callable $callback Either a function or callback in array notation
* @throws \InvalidArgumentException
*/
public function __construct($refresh = false, $callback = null)
{
@@ -88,17 +91,33 @@ class Upgrader
}
/**
* Make sure this meets minimum PHP requirements
*
* @return bool
*/
public function meetsRequirements()
{
if (version_compare(PHP_VERSION, GRAV_PHP_MIN, '<')) {
$current_php_version = phpversion();
if (version_compare($current_php_version, $this->minPHPVersion(), '<')) {
return false;
}
return true;
}
/**
* Get minimum PHP version from remote
*
* @return null
*/
public function minPHPVersion()
{
if (is_null($this->min_php)) {
$this->min_php = $this->remote->getMinPHPVersion();
}
return $this->min_php;
}
/**
* Checks if the currently installed Grav is upgradable to a newer version
*

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/

View File

@@ -2,19 +2,19 @@
/**
* @package Grav.Common
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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;
use RocketTheme\Toolbox\Event\EventDispatcher;
class Grav extends Container
{
@@ -38,8 +38,7 @@ class Grav extends Container
'uri' => 'Grav\Common\Uri',
'events' => 'RocketTheme\Toolbox\Event\EventDispatcher',
'cache' => 'Grav\Common\Cache',
'session' => 'Grav\Common\Session',
'Grav\Common\Service\MessagesServiceProvider',
'Grav\Common\Service\SessionServiceProvider',
'plugins' => 'Grav\Common\Plugins',
'themes' => 'Grav\Common\Themes',
'twig' => 'Grav\Common\Twig\Twig',
@@ -148,7 +147,7 @@ class Grav extends Container
// Initialize Locale if set and configured.
if ($this['language']->enabled() && $this['config']->get('system.languages.override_locale')) {
$language = $this['language']->getLanguage();
setlocale(LC_ALL, count($language < 3) ? ($language . '_' . strtoupper($language)) : $language);
setlocale(LC_ALL, strlen($language) < 3 ? ($language . '_' . strtoupper($language)) : $language);
} elseif ($this['config']->get('system.default_locale')) {
setlocale(LC_ALL, $this['config']->get('system.default_locale'));
}
@@ -205,11 +204,8 @@ class Grav extends Container
*/
public function redirectLangSafe($route, $code = null)
{
/** @var Language $language */
$language = $this['language'];
if (!$this['uri']->isExternal($route) && $language->enabled() && $language->isIncludeDefaultLanguage()) {
$this->redirect($language->getLanguage() . $route, $code);
if (!$this['uri']->isExternal($route)) {
$this->redirect($this['pages']->route($route), $code);
} else {
$this->redirect($route, $code);
}
@@ -256,11 +252,6 @@ class Grav extends Container
header('ETag: "' . md5($page->raw() . $page->modified()).'"');
}
// Set debugger data in headers
if (!($format === null || $format == 'html')) {
$this['debugger']->enabled(false);
}
// Set HTTP response code
if (isset($this['page']->header()->http_response_code)) {
http_response_code($this['page']->header()->http_response_code);
@@ -440,7 +431,7 @@ class Grav extends Container
*/
public function fallbackUrl($path)
{
$this->fireEvent('onPageFallBackUrl');
$this->fireEvent('onPageFallBackUrl');
/** @var Uri $uri */
$uri = $this['uri'];
@@ -448,15 +439,16 @@ class Grav extends Container
/** @var Config $config */
$config = $this['config'];
$uri_extension = $uri->extension();
$uri_extension = strtolower($uri->extension());
$fallback_types = $config->get('system.media.allowed_fallback_types', null);
$supported_types = $config->get('media.types');
// Check whitelist first, then ensure extension is a valid media type
if (!empty($fallback_types) && !in_array($uri_extension, $fallback_types)) {
return;
} elseif (!array_key_exists($uri_extension, $supported_types)) {
return;
if (!empty($fallback_types) && !\in_array($uri_extension, $fallback_types, true)) {
return false;
}
if (!array_key_exists($uri_extension, $supported_types)) {
return false;
}
$path_parts = pathinfo($path);
@@ -499,6 +491,9 @@ class Grav extends Container
}
Utils::download($page->path() . DIRECTORY_SEPARATOR . $uri->basename(), $download);
}
// Nothing found
return false;
}
return $page;

View File

@@ -2,12 +2,15 @@
/**
* @package Grav.Common
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
namespace Grav\Common;
/**
* @deprecated 1.4 Use Grav::instance() instead
*/
trait GravTrait
{
protected static $grav;
@@ -21,7 +24,8 @@ trait GravTrait
self::$grav = Grav::instance();
}
user_error(__TRAIT__ . ' is deprecated since Grav 1.4, use Grav::instance() instead', E_USER_DEPRECATED);
return self::$grav;
}
}

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.Helpers
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -32,7 +32,7 @@ class Base32 {
*/
public static function encode( $bytes ) {
$i = 0; $index = 0; $digit = 0;
$base32 = "";
$base32 = '';
$bytes_len = strlen($bytes);
while( $i < $bytes_len ) {
$currByte = ord($bytes{$i});
@@ -51,7 +51,7 @@ class Base32 {
} else {
$digit = ($currByte >> (8 - ($index + 5))) & 0x1F;
$index = ($index + 5) % 8;
if( $index == 0 ) $i++;
if( $index === 0 ) $i++;
}
$base32 .= self::$base32Chars{$digit};
}
@@ -96,7 +96,7 @@ class Base32 {
$bytes[$offset] |= $digit << (8 - $index);
}
}
$bites = "";
$bites = '';
foreach( $bytes as $byte ) $bites .= chr($byte);
return $bites;
}

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.Helpers
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -12,6 +12,7 @@ use Grav\Common\Grav;
use Grav\Common\Page\Page;
use Grav\Common\Uri;
use Grav\Common\Page\Medium\Medium;
use Grav\Common\Utils;
use RocketTheme\Toolbox\Event\Event;
use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator;
@@ -55,7 +56,7 @@ class Excerpts
public static function getExcerptFromHtml($html, $tag)
{
$doc = new \DOMDocument();
$doc->loadHtml($html);
$doc->loadHTML($html);
$images = $doc->getElementsByTagName($tag);
$excerpt = null;
@@ -116,7 +117,7 @@ class Excerpts
*/
public static function processLinkExcerpt($excerpt, Page $page, $type = 'link')
{
$url = htmlspecialchars_decode(urldecode($excerpt['element']['attributes']['href']));
$url = htmlspecialchars_decode(rawurldecode($excerpt['element']['attributes']['href']));
$url_parts = static::parseUrl($url);
@@ -141,9 +142,9 @@ class Excerpts
foreach ($actions as $attrib => $value) {
$key = $attrib;
if (in_array($attrib, $valid_attributes)) {
if (in_array($attrib, $valid_attributes, true)) {
// support both class and classes.
if ($attrib == 'classes') {
if ($attrib === 'classes') {
$attrib = 'class';
}
$excerpt['element']['attributes'][$attrib] = str_replace(',', ' ', $value);
@@ -171,10 +172,9 @@ class Excerpts
if ($type !== 'image' && !empty($url_parts['stream']) && !empty($url_parts['path'])) {
$url_parts['path'] = Grav::instance()['base_url_relative'] . '/' . static::resolveStream("{$url_parts['scheme']}://{$url_parts['path']}");
unset($url_parts['stream'], $url_parts['scheme']);
$excerpt['element']['attributes']['href'] = Uri::buildUrl($url_parts);
}
$excerpt['element']['attributes']['href'] = Uri::buildUrl($url_parts);
return $excerpt;
}
@@ -210,8 +210,8 @@ class Excerpts
} else {
// File is also local if scheme is http(s) and host matches.
$local_file = isset($url_parts['path'])
&& (empty($url_parts['scheme']) || in_array($url_parts['scheme'], ['http', 'https']))
&& (empty($url_parts['host']) || $url_parts['host'] == Grav::instance()['uri']->host());
&& (empty($url_parts['scheme']) || in_array($url_parts['scheme'], ['http', 'https'], true))
&& (empty($url_parts['host']) || $url_parts['host'] === Grav::instance()['uri']->host());
if ($local_file) {
$filename = basename($url_parts['path']);
@@ -245,13 +245,14 @@ class Excerpts
// Process operations
$medium = static::processMediaActions($medium, $url_parts);
$element_excerpt = $excerpt['element']['attributes'];
$alt = isset($excerpt['element']['attributes']['alt']) ? $excerpt['element']['attributes']['alt'] : '';
$title = isset($excerpt['element']['attributes']['title']) ? $excerpt['element']['attributes']['title'] : '';
$class = isset($excerpt['element']['attributes']['class']) ? $excerpt['element']['attributes']['class'] : '';
$id = isset($excerpt['element']['attributes']['id']) ? $excerpt['element']['attributes']['id'] : '';
$alt = isset($element_excerpt['alt']) ? $element_excerpt['alt'] : '';
$title = isset($element_excerpt['title']) ? $element_excerpt['title'] : '';
$class = isset($element_excerpt['class']) ? $element_excerpt['class'] : '';
$id = isset($element_excerpt['id']) ? $element_excerpt['id'] : '';
$excerpt['element'] = $medium->parseDownElement($title, $alt, $class, $id, true);
$excerpt['element'] = $medium->parsedownElement($title, $alt, $class, $id, true);
} else {
// Not a current page media file, see if it needs converting to relative.
@@ -292,6 +293,15 @@ class Excerpts
if (Grav::instance()['config']->get('system.images.auto_fix_orientation')) {
$actions[] = ['method' => 'fixOrientation', 'params' => ''];
}
$defaults = Grav::instance()['config']->get('system.images.defaults');
if (is_array($defaults) && count($defaults)) {
foreach ($defaults as $method => $params) {
$actions[] = [
'method' => $method,
'params' => $params,
];
}
}
// loop through actions for the image and call them
foreach ($actions as $action) {
@@ -321,7 +331,7 @@ class Excerpts
*/
protected static function parseUrl($url)
{
$url_parts = parse_url($url);
$url_parts = Utils::multibyteParseUrl($url);
if (isset($url_parts['scheme'])) {
/** @var UniformResourceLocator $locator */

View File

@@ -2,25 +2,30 @@
/**
* @package Grav.Common.Helpers
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
namespace Grav\Common\Helpers;
use Grav\Common\Grav;
use SebastianBergmann\GlobalState\RuntimeException;
class Exif
{
public $reader;
/**
* Exif constructor.
* @throws RuntimeException
*/
public function __construct()
{
if (Grav::instance()['config']->get('system.media.auto_metadata_exif')) {
if (function_exists('exif_read_data') && class_exists('\PHPExif\Reader\Reader')) {
$this->reader = \PHPExif\Reader\Reader::factory(\PHPExif\Reader\Reader::TYPE_NATIVE);
} else {
throw new \Exception('Please enable the Exif extension for PHP or disable Exif support in Grav system configuration');
throw new \RuntimeException('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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -34,7 +34,7 @@ class Truncator {
* @param string $ellipsis String to use as ellipsis (if any).
* @return string Safe truncated HTML.
*/
public static function truncateWords($html, $limit = 0, $ellipsis = "")
public static function truncateWords($html, $limit = 0, $ellipsis = '')
{
if ($limit <= 0) {
return $html;
@@ -47,6 +47,7 @@ class Truncator {
// Iterate over words.
$words = new DOMWordsIterator($body);
$truncated = false;
foreach ($words as $word) {
// If we have exceeded the limit, we delete the remainder of the content.
@@ -70,12 +71,19 @@ class Truncator {
self::insertEllipsis($curNode, $ellipsis);
}
$truncated = true;
break;
}
}
return self::innerHTML($body);
// Return original HTML if not truncated.
if ($truncated) {
return self::innerHTML($body);
} else {
return $html;
}
}
/**
@@ -94,28 +102,36 @@ class Truncator {
$dom = self::htmlToDomDocument($html);
// Grab the body of our DOM.
$body = $dom->getElementsByTagName("body")->item(0);
$body = $dom->getElementsByTagName('body')->item(0);
// Iterate over letters.
$letters = new DOMLettersIterator($body);
$truncated = false;
foreach ($letters as $letter) {
// If we have exceeded the limit, we want to delete the remainder of this document.
if ($letters->key() >= $limit) {
$currentText = $letters->currentTextPosition();
$currentText[0]->nodeValue = substr($currentText[0]->nodeValue, 0, $currentText[1] + 1);
$currentText[0]->nodeValue = mb_substr($currentText[0]->nodeValue, 0, $currentText[1] + 1);
self::removeProceedingNodes($currentText[0], $body);
if (!empty($ellipsis)) {
self::insertEllipsis($currentText[0], $ellipsis);
}
$truncated = true;
break;
}
}
return self::innerHTML($body);
// Return original HTML if not truncated.
if ($truncated) {
return self::innerHTML($body);
} else {
return $html;
}
}
/**
@@ -181,7 +197,7 @@ class Truncator {
{
$avoid = array('a', 'strong', 'em', 'h1', 'h2', 'h3', 'h4', 'h5'); //html tags to avoid appending the ellipsis to
if (in_array($domNode->parentNode->nodeName, $avoid) && $domNode->parentNode->parentNode !== null) {
if ($domNode->parentNode->parentNode !== null && in_array($domNode->parentNode->nodeName, $avoid, true)) {
// Append as text node to parent instead
$textNode = new DOMText($ellipsis);
@@ -204,7 +220,7 @@ class Truncator {
* @return string
*/
private static function innerHTML($element) {
$innerHTML = "";
$innerHTML = '';
$children = $element->childNodes;
foreach ($children as $child)
{

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -190,10 +190,11 @@ class Inflector
public function hyphenize($word)
{
$regex1 = preg_replace('/([A-Z]+)([A-Z][a-z])/', '\1-\2', $word);
$regex2 = preg_replace('/([a-zd])([A-Z])/', '\1-\2', $regex1);
$regex3 = preg_replace('/[^A-Z^a-z^0-9]+/', '-', $regex2);
$regex2 = preg_replace('/([a-z])([A-Z])/', '\1-\2', $regex1);
$regex3 = preg_replace('/([0-9])([A-Z])/', '\1-\2', $regex2);
$regex4 = preg_replace('/[^A-Z^a-z^0-9]+/', '-', $regex3);
return strtolower($regex3);
return strtolower($regex4);
}
/**

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -174,23 +174,23 @@ class Language
// if languages set
if ($this->enabled()) {
// try setting from prefix of URL (/en/blah/blah)
// Try setting language from prefix of URL (/en/blah/blah).
if (preg_match($regex, $uri, $matches)) {
$this->lang_in_url = true;
$this->active = $matches[2];
$uri = preg_replace("/\\" . $matches[1] . "/", '', $uri, 1);
$uri = preg_replace("/\\" . $matches[1] . '/', '', $uri, 1);
// store in session if different
if ($this->config->get('system.session.enabled', false)
// Store in session if language is different.
if (isset($this->grav['session']) && $this->grav['session']->isStarted()
&& $this->config->get('system.languages.session_store_active', true)
&& $this->grav['session']->active_language != $this->active
) {
$this->grav['session']->active_language = $this->active;
}
} else {
// try getting from session, else no active
if ($this->config->get('system.session.enabled', false) &&
$this->config->get('system.languages.session_store_active', true)) {
// Try getting language from the session, else no active.
if (isset($this->grav['session']) && $this->grav['session']->isStarted()
&& $this->config->get('system.languages.session_store_active', true)) {
$this->active = $this->grav['session']->active_language ?: null;
}
// if still null, try from http_accept_language header
@@ -203,8 +203,8 @@ 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)
// 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)) {

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.Language
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -22,6 +22,7 @@ class LanguageCodes
'bn-BD' => [ 'name' => 'Bengali (Bangladesh)', 'nativeName' => 'বাংলা (বাংলাদেশ)' ],
'bn-IN' => [ 'name' => 'Bengali (India)', 'nativeName' => 'বাংলা (ভারত)' ],
'br' => [ 'name' => 'Breton', 'nativeName' => 'Brezhoneg' ],
'bs' => [ 'name' => 'Bosnian', 'nativeName' => 'Bosanski' ],
'ca' => [ 'name' => 'Catalan', 'nativeName' => 'Català' ],
'ca-valencia'=> [ 'name' => 'Catalan (Valencian)', 'nativeName' => 'Català (valencià)' ], // not iso-639-1. a=l10n-drivers
'cs' => [ 'name' => 'Czech', 'nativeName' => 'Čeština' ],
@@ -157,14 +158,13 @@ class LanguageCodes
{
if (isset(static::$codes[$code])) {
return static::get($code, 'nativeName');
} else {
if (preg_match('/[a-zA-Z]{2}-[a-zA-Z]{2}/', $code)) {
return static::get(substr($code, 0, 2), 'nativeName') . ' (' . substr($code, -2) . ')';
} else {
return $code;
}
}
if (preg_match('/[a-zA-Z]{2}-[a-zA-Z]{2}/', $code)) {
return static::get(substr($code, 0, 2), 'nativeName') . ' (' . substr($code, -2) . ')';
}
return $code;
}
public static function getOrientation($code)
@@ -179,7 +179,7 @@ class LanguageCodes
public static function isRtl($code)
{
if (static::getOrientation($code) == 'rtl') {
if (static::getOrientation($code) === 'rtl') {
return true;
}
return false;
@@ -192,7 +192,6 @@ class LanguageCodes
if (isset(static::$codes[$key])) {
$results[$key] = static::$codes[$key];
}
}
return $results;
}
@@ -201,8 +200,8 @@ class LanguageCodes
{
if (isset(static::$codes[$code][$type])) {
return static::$codes[$code][$type];
} else {
return false;
}
return false;
}
}

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.Markdown
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, 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 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -17,10 +17,12 @@ class ParsedownExtra extends \ParsedownExtra
*
* @param $page
* @param $defaults
* @throws \Exception
*/
public function __construct($page, $defaults)
{
parent::__construct();
$this->init($page, $defaults);
}
}

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.Markdown
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -35,7 +35,7 @@ trait ParsedownGravTrait
$grav = Grav::instance();
$this->page = $page;
$this->BlockTypes['{'] [] = "TwigTag";
$this->BlockTypes['{'] [] = 'TwigTag';
$this->special_chars = ['>' => 'gt', '<' => 'lt', '"' => 'quot'];
if ($defaults === null) {
@@ -56,6 +56,9 @@ trait ParsedownGravTrait
*
* @param $type
* @param $tag
* @param bool $continuable
* @param bool $completable
* @param $index
*/
public function addBlockType($type, $tag, $continuable = false, $completable = false, $index = null)
{
@@ -67,7 +70,7 @@ trait ParsedownGravTrait
$block = &$this->BlockTypes[$type];
}
if (!isset($index)) {
if (null === $index) {
$block[] = $tag;
} else {
array_splice($block, $index, 0, [$tag]);
@@ -86,10 +89,11 @@ trait ParsedownGravTrait
*
* @param $type
* @param $tag
* @param $index
*/
public function addInlineType($type, $tag, $index = null)
{
if (!isset($index) || !isset($this->InlineTypes[$type])) {
if (null === $index || !isset($this->InlineTypes[$type])) {
$this->InlineTypes[$type] [] = $tag;
} else {
array_splice($this->InlineTypes[$type], $index, 0, [$tag]);
@@ -109,7 +113,7 @@ trait ParsedownGravTrait
*/
protected function isBlockContinuable($Type)
{
$continuable = in_array($Type, $this->continuable_blocks) || method_exists($this, 'block' . $Type . 'Continue');
$continuable = \in_array($Type, $this->continuable_blocks) || method_exists($this, 'block' . $Type . 'Continue');
return $continuable;
}
@@ -123,7 +127,7 @@ trait ParsedownGravTrait
*/
protected function isBlockCompletable($Type)
{
$completable = in_array($Type, $this->completable_blocks) || method_exists($this, 'block' . $Type . 'Complete');
$completable = \in_array($Type, $this->completable_blocks) || method_exists($this, 'block' . $Type . 'Complete');
return $completable;
}
@@ -157,32 +161,31 @@ trait ParsedownGravTrait
/**
* Ensure Twig tags are treated as block level items with no <p></p> tags
*
* @param array $line
* @return array|null
*/
protected function blockTwigTag($Line)
protected function blockTwigTag($line)
{
if (preg_match('/(?:{{|{%|{#)(.*)(?:}}|%}|#})/', $Line['body'], $matches)) {
$Block = [
'markup' => $Line['body'],
];
return $Block;
if (preg_match('/(?:{{|{%|{#)(.*)(?:}}|%}|#})/', $line['body'], $matches)) {
return ['markup' => $line['body']];
}
return null;
}
protected function inlineSpecialCharacter($Excerpt)
protected function inlineSpecialCharacter($excerpt)
{
if ($Excerpt['text'][0] === '&' && !preg_match('/^&#?\w+;/', $Excerpt['text'])) {
if ($excerpt['text'][0] === '&' && !preg_match('/^&#?\w+;/', $excerpt['text'])) {
return [
'markup' => '&amp;',
'extent' => 1,
];
}
if (isset($this->special_chars[$Excerpt['text'][0]])) {
if (isset($this->special_chars[$excerpt['text'][0]])) {
return [
'markup' => '&' . $this->special_chars[$Excerpt['text'][0]] . ';',
'markup' => '&' . $this->special_chars[$excerpt['text'][0]] . ';',
'extent' => 1,
];
}
@@ -199,11 +202,11 @@ trait ParsedownGravTrait
$excerpt['extent'] = $excerpt['extent'] + strlen($matches[1]) - 1;
return $excerpt;
} else {
$excerpt['type'] = 'image';
$excerpt = parent::inlineImage($excerpt);
}
$excerpt['type'] = 'image';
$excerpt = parent::inlineImage($excerpt);
// if this is an image process it
if (isset($excerpt['element']['attributes']['src'])) {
$excerpt = Excerpts::processImageExcerpt($excerpt, $this->page);
@@ -228,10 +231,10 @@ trait ParsedownGravTrait
$excerpt['extent'] = $excerpt['extent'] + strlen($matches[1]) - 1;
return $excerpt;
} else {
$excerpt = parent::inlineLink($excerpt);
}
$excerpt = parent::inlineLink($excerpt);
// if this is a link
if (isset($excerpt['element']['attributes']['href'])) {
$excerpt = Excerpts::processLinkExcerpt($excerpt, $this->page, $type);
@@ -243,10 +246,10 @@ trait ParsedownGravTrait
// For extending this class via plugins
public function __call($method, $args)
{
if (isset($this->$method) === true) {
$func = $this->$method;
if (isset($this->{$method}) === true) {
$func = $this->{$method};
return call_user_func_array($func, $args);
return \call_user_func_array($func, $args);
}
return null;

View File

@@ -0,0 +1,9 @@
<?php
namespace Grav\Common\Media\Interfaces;
/**
* Class implements media collection interface.
*/
interface MediaCollectionInterface
{
}

View File

@@ -0,0 +1,29 @@
<?php
namespace Grav\Common\Media\Interfaces;
/**
* Class implements media interface.
*/
interface MediaInterface
{
/**
* Gets the associated media collection.
*
* @return MediaCollectionInterface Collection of associated media.
*/
public function getMedia();
/**
* Get filesystem path to the associated media.
*
* @return string|null Media path or null if the object doesn't have media folder.
*/
public function getMediaFolder();
/**
* Get display order for the associated media.
*
* @return array Empty array means default ordering.
*/
public function getMediaOrder();
}

View File

@@ -0,0 +1,9 @@
<?php
namespace Grav\Common\Media\Interfaces;
/**
* Class implements media object interface.
*/
interface MediaObjectInterface
{
}

View File

@@ -0,0 +1,112 @@
<?php
namespace Grav\Common\Media\Traits;
use Grav\Common\Cache;
use Grav\Common\Grav;
use Grav\Common\Media\Interfaces\MediaCollectionInterface;
use Grav\Common\Page\Media;
use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator;
trait MediaTrait
{
protected $media;
/**
* Get filesystem path to the associated media.
*
* @return string|null
*/
abstract public function getMediaFolder();
/**
* Get display order for the associated media.
*
* @return array Empty array means default ordering.
*/
abstract public function getMediaOrder();
/**
* Get URI ot the associated media. Method will return null if path isn't URI.
*
* @return null|string
*/
public function getMediaUri()
{
$folder = $this->getMediaFolder();
if (strpos($folder, '://')) {
return $folder;
}
/** @var UniformResourceLocator $locator */
$locator = Grav::instance()['locator'];
$user = $locator->findResource('user://');
if (strpos($folder, $user) === 0) {
return 'user://' . substr($folder, strlen($user)+1);
}
return null;
}
/**
* Gets the associated media collection.
*
* @return MediaCollectionInterface Representation of associated media.
*/
public function getMedia()
{
$cache = $this->getMediaCache();
if ($this->media === null) {
// Use cached media if possible.
$cacheKey = md5('media' . $this->getCacheKey());
if (!$media = $cache->fetch($cacheKey)) {
$media = new Media($this->getMediaFolder(), $this->getMediaOrder());
$cache->save($cacheKey, $media);
}
$this->media = $media;
}
return $this->media;
}
/**
* Sets the associated media collection.
*
* @param MediaCollectionInterface $media Representation of associated media.
* @return $this
*/
protected function setMedia(MediaCollectionInterface $media)
{
$cache = $this->getMediaCache();
$cacheKey = md5('media' . $this->getCacheKey());
$cache->save($cacheKey, $media);
$this->media = $media;
return $this;
}
/**
* Clear media cache.
*/
protected function clearMediaCache()
{
$cache = $this->getMediaCache();
$cacheKey = md5('media' . $this->getCacheKey());
$cache->delete($cacheKey);
}
/**
* @return Cache
*/
protected function getMediaCache()
{
return Grav::instance()['cache'];
}
/**
* @return string
*/
abstract protected function getCacheKey();
}

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.Page
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
@@ -610,4 +610,23 @@ class Collection extends Iterator
return $this;
}
/**
* Get the extended version of this Collection with each page keyed by route
*
* @return array
* @throws \Exception
*/
public function toExtendedArray()
{
$items = [];
foreach ($this->items as $path => $slug) {
$page = $this->pages->get($path);
if ($page !== null) {
$items[$page->route()] = $page->toArray();
}
}
return $items;
}
}

View File

@@ -2,7 +2,7 @@
/**
* @package Grav.Common.Page
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/

Some files were not shown because too many files have changed in this diff Show More