Commit 32b44fc6 authored by Administrator's avatar Administrator 💬

chore(update): `1.6.23` -> `1.6.27`

parent 1efa3e00
# v1.6.27
## 09/01/2020
1. [](#improved)
* Right trim route for safety
* Use the proper ellipsis for summary [#2939](https://github.com/getgrav/grav/pull/2939)
* Left pad schedule times with zeros [#2921](https://github.com/getgrav/grav/pull/2921)
# v1.6.26
## 06/08/2020
1. [](#improved)
* Added new configuration option to control the supported attributes in markdown links [#2882](https://github.com/getgrav/grav/issues/2882)
1. [](#bugfix)
* Fixed blueprint for `system.pages.hide_empty_folders` [#1925](https://github.com/getgrav/grav/issues/2925)
* JSON Route of homepage with no ‘route’ set is valid
* Fix case-insensitive search of location header [form#425](https://github.com/getgrav/grav-plugin-form/issues/425)
# v1.6.25
## 05/14/2020
1. [](#improved)
* Added system configuration support for `HTTP_X_Forwarded` headers (host disabled by default)
* Updated `PHPUserAgentParser` to 1.0.0
* Bump `Go` to version 1.13 in `travis.yaml`
# v1.6.24
## 04/27/2020
1. [](#improved)
* Added support for `X-Forwarded-Host` [#2891](https://github.com/getgrav/grav/pull/2891)
* Disable XDebug in Travis builds
# v1.6.23 # v1.6.23
## 03/19/2020 ## 03/19/2020
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "8cf8d58f86543809e5b922b12962484d", "content-hash": "40dbb242443086c99aa47ea8ca366d67",
"packages": [ "packages": [
{ {
"name": "antoligy/dom-string-iterators", "name": "antoligy/dom-string-iterators",
...@@ -260,23 +260,23 @@ ...@@ -260,23 +260,23 @@
}, },
{ {
"name": "donatj/phpuseragentparser", "name": "donatj/phpuseragentparser",
"version": "v0.15.0", "version": "v1.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/donatj/PhpUserAgent.git", "url": "https://github.com/donatj/PhpUserAgent.git",
"reference": "283e5812d3a3f2deb62377c14b0d24191aba1595" "reference": "1431382850017ac017d194f2a6f6cacb35212888"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/donatj/PhpUserAgent/zipball/283e5812d3a3f2deb62377c14b0d24191aba1595", "url": "https://api.github.com/repos/donatj/PhpUserAgent/zipball/1431382850017ac017d194f2a6f6cacb35212888",
"reference": "283e5812d3a3f2deb62377c14b0d24191aba1595", "reference": "1431382850017ac017d194f2a6f6cacb35212888",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.0" "php": ">=5.3.0"
}, },
"require-dev": { "require-dev": {
"camspiers/json-pretty": "0.1.*", "camspiers/json-pretty": "~1.0",
"donatj/drop": "*", "donatj/drop": "*",
"phpunit/phpunit": "~4.8" "phpunit/phpunit": "~4.8"
}, },
...@@ -284,7 +284,10 @@ ...@@ -284,7 +284,10 @@
"autoload": { "autoload": {
"files": [ "files": [
"src/UserAgentParser.php" "src/UserAgentParser.php"
] ],
"psr-4": {
"donatj\\UserAgent\\": "src/UserAgent"
}
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
...@@ -294,7 +297,7 @@ ...@@ -294,7 +297,7 @@
{ {
"name": "Jesse G. Donat", "name": "Jesse G. Donat",
"email": "donatj@gmail.com", "email": "donatj@gmail.com",
"homepage": "http://donatstudios.com", "homepage": "https://donatstudios.com",
"role": "Developer" "role": "Developer"
} }
], ],
...@@ -307,7 +310,17 @@ ...@@ -307,7 +310,17 @@
"user agent", "user agent",
"useragent" "useragent"
], ],
"time": "2020-01-21T17:51:39+00:00" "funding": [
{
"url": "https://www.paypal.me/donatj/15",
"type": "custom"
},
{
"url": "https://github.com/donatj",
"type": "github"
}
],
"time": "2020-04-24T18:07:07+00:00"
}, },
{ {
"name": "dragonmantank/cron-expression", "name": "dragonmantank/cron-expression",
......
...@@ -241,13 +241,15 @@ form: ...@@ -241,13 +241,15 @@ form:
type: commalist type: commalist
pages.hide_empty_folders: pages.hide_empty_folders:
type: selectize type: toggle
size: large label: PLUGIN_ADMIN.HIDE_EMPTY_FOLDERS
label: PLUGIN_ADMIN.HIDE_EMPTY_FOLDERS help: PLUGIN_ADMIN.HIDE_EMPTY_FOLDERS_HELP
help: PLUGIN_ADMIN.HIDE_EMPTY_FOLDERS_HELP highlight: 0
classes: fancy options:
validate: 1: PLUGIN_ADMIN.YES
type: commalist 0: PLUGIN_ADMIN.NO
validate:
type: bool
pages.url_taxonomy_filters: pages.url_taxonomy_filters:
type: toggle type: toggle
...@@ -513,6 +515,16 @@ form: ...@@ -513,6 +515,16 @@ form:
validate: validate:
type: bool type: bool
pages.markdown.valid_link_attributes:
type: selectize
size: large
label: PLUGIN_ADMIN.VALID_LINK_ATTRIBUTES
help: PLUGIN_ADMIN.VALID_LINK_ATTRIBUTES_HELP
placeholder: "rel, target, id, class, classes"
classes: fancy
validate:
type: commalist
caching: caching:
type: tab type: tab
title: PLUGIN_ADMIN.CACHING title: PLUGIN_ADMIN.CACHING
...@@ -1379,6 +1391,51 @@ form: ...@@ -1379,6 +1391,51 @@ form:
label: PLUGIN_ADMIN.CUSTOM_BASE_URL label: PLUGIN_ADMIN.CUSTOM_BASE_URL
help: PLUGIN_ADMIN.CUSTOM_BASE_URL_HELP help: PLUGIN_ADMIN.CUSTOM_BASE_URL_HELP
http_x_forwarded.protocol:
type: toggle
label: HTTP_X_FORWARDED_PROTO Enabled
highlight: 1
default: 1
options:
1: PLUGIN_ADMIN.YES
0: PLUGIN_ADMIN.NO
validate:
type: bool
http_x_forwarded.host:
type: toggle
label: HTTP_X_FORWARDED_HOST Enabled
highlight: 0
default: 0
options:
1: PLUGIN_ADMIN.YES
0: PLUGIN_ADMIN.NO
validate:
type: bool
http_x_forwarded.port:
type: toggle
label: HTTP_X_FORWARDED_PORT Enabled
highlight: 1
default: 1
options:
1: PLUGIN_ADMIN.YES
0: PLUGIN_ADMIN.NO
validate:
type: bool
http_x_forwarded.ip:
type: toggle
label: HTTP_X_FORWARDED IP Enabled
highlight: 1
default: 1
options:
1: PLUGIN_ADMIN.YES
0: PLUGIN_ADMIN.NO
validate:
type: bool
accounts.type: accounts.type:
type: hidden type: hidden
......
...@@ -10,6 +10,11 @@ custom_base_url: '' # Set the base_url manually, e. ...@@ -10,6 +10,11 @@ custom_base_url: '' # Set the base_url manually, e.
username_regex: '^[a-z0-9_-]{3,16}$' # Only lowercase chars, digits, dashes, underscores. 3 - 16 chars 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 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) intl_enabled: true # Special logic for PHP International Extension (mod_intl)
http_x_forwarded: # Configuration options for the various HTTP_X_FORWARD headers
protocol: true
host: false
port: true
ip: true
languages: languages:
supported: [] # List of languages supported. eg: [en, fr, de] supported: [] # List of languages supported. eg: [en, fr, de]
...@@ -54,6 +59,12 @@ pages: ...@@ -54,6 +59,12 @@ pages:
special_chars: # List of special characters to automatically convert to entities special_chars: # List of special characters to automatically convert to entities
'>': 'gt' '>': 'gt'
'<': 'lt' '<': 'lt'
valid_link_attributes: # Valid attributes to pass through via markdown links
- rel
- target
- id
- class
- classes
types: [html,htm,xml,txt,json,rss,atom] # list of valid page types types: [html,htm,xml,txt,json,rss,atom] # list of valid page types
append_url_extension: '' # Append page's extension in Page urls (e.g. '.html' results in /path/page.html) append_url_extension: '' # Append page's extension in Page urls (e.g. '.html' results in /path/page.html)
expires: 604800 # Page expires time in seconds (604800 seconds = 7 days) expires: 604800 # Page expires time in seconds (604800 seconds = 7 days)
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
// Some standard defines // Some standard defines
define('GRAV', true); define('GRAV', true);
define('GRAV_VERSION', '1.6.23'); define('GRAV_VERSION', '1.6.27');
define('GRAV_TESTING', false); define('GRAV_TESTING', false);
define('DS', '/'); define('DS', '/');
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
namespace Grav\Common; namespace Grav\Common;
use function donatj\UserAgent\parse_user_agent;
/** /**
* Internally uses the PhpUserAgent package https://github.com/donatj/PhpUserAgent * Internally uses the PhpUserAgent package https://github.com/donatj/PhpUserAgent
*/ */
......
...@@ -409,7 +409,7 @@ class Response ...@@ -409,7 +409,7 @@ class Response
} else { } else {
$code = (int)curl_getinfo($rch, CURLINFO_HTTP_CODE); $code = (int)curl_getinfo($rch, CURLINFO_HTTP_CODE);
if ($code === 301 || $code === 302 || $code === 303) { if ($code === 301 || $code === 302 || $code === 303) {
preg_match('/Location:(.*?)\n/', $header, $matches); preg_match('/(?:^|\n)Location:(.*?)\n/i', $header, $matches);
$uri = trim(array_pop($matches)); $uri = trim(array_pop($matches));
} else { } else {
$code = 0; $code = 0;
......
...@@ -87,7 +87,7 @@ class Excerpts ...@@ -87,7 +87,7 @@ class Excerpts
); );
// Valid attributes supported. // Valid attributes supported.
$valid_attributes = ['rel', 'target', 'id', 'class', 'classes']; $valid_attributes = Grav::instance()['config']->get('system.pages.markdown.valid_link_attributes');
// Unless told to not process, go through actions. // Unless told to not process, go through actions.
if (array_key_exists('noprocess', $actions)) { if (array_key_exists('noprocess', $actions)) {
...@@ -232,6 +232,7 @@ class Excerpts ...@@ -232,6 +232,7 @@ class Excerpts
$url_parts = is_string($url) ? $this->parseUrl($url) : $url; $url_parts = is_string($url) ? $this->parseUrl($url) : $url;
$actions = []; $actions = [];
// if there is a query, then parse it and build action calls // if there is a query, then parse it and build action calls
if (isset($url_parts['query'])) { if (isset($url_parts['query'])) {
$actions = array_reduce( $actions = array_reduce(
......
...@@ -516,6 +516,15 @@ class ImageMedium extends Medium ...@@ -516,6 +516,15 @@ class ImageMedium extends Medium
return $this; return $this;
} }
/**
* Handle this commonly used variant
*/
public function cropZoom()
{
$this->__call('zoomCrop', func_get_args());
return $this;
}
/** /**
* Forward the call to the image processing method. * Forward the call to the image processing method.
* *
...@@ -525,10 +534,6 @@ class ImageMedium extends Medium ...@@ -525,10 +534,6 @@ class ImageMedium extends Medium
*/ */
public function __call($method, $args) public function __call($method, $args)
{ {
if ($method === 'cropZoom') {
$method = 'zoomCrop';
}
if (!\in_array($method, self::$magic_actions, true)) { if (!\in_array($method, self::$magic_actions, true)) {
return parent::__call($method, $args); return parent::__call($method, $args);
} }
......
...@@ -608,7 +608,7 @@ class Page implements PageInterface ...@@ -608,7 +608,7 @@ class Page implements PageInterface
return $content; return $content;
} }
return mb_strimwidth($content, 0, $size, '...', 'UTF-8'); return mb_strimwidth($content, 0, $size, '', 'UTF-8');
} }
$summary = Utils::truncateHtml($content, $size); $summary = Utils::truncateHtml($content, $size);
......
...@@ -305,7 +305,7 @@ class Plugin implements EventSubscriberInterface, \ArrayAccess ...@@ -305,7 +305,7 @@ class Plugin implements EventSubscriberInterface, \ArrayAccess
// Create new config object and set it on the page object so it's cached for next time // Create new config object and set it on the page object so it's cached for next time
$page->modifyHeader($class_name_merged, new Data($header)); $page->modifyHeader($class_name_merged, new Data($header));
} else if (isset($page_header->{$class_name_merged})) { } elseif (isset($page_header->{$class_name_merged})) {
$merged = $page_header->{$class_name_merged}; $merged = $page_header->{$class_name_merged};
$header = $merged->toArray(); $header = $merged->toArray();
} }
......
...@@ -69,7 +69,7 @@ class Cron ...@@ -69,7 +69,7 @@ class Cron
'name_year' => 'année', 'name_year' => 'année',
'text_period' => 'Chaque %s', 'text_period' => 'Chaque %s',
'text_mins' => 'à %s minutes', 'text_mins' => 'à %s minutes',
'text_time' => 'à %s:%s', 'text_time' => 'à %02s:%02s',
'text_dow' => 'le %s', 'text_dow' => 'le %s',
'text_month' => 'de %s', 'text_month' => 'de %s',
'text_dom' => 'le %s', 'text_dom' => 'le %s',
...@@ -86,7 +86,7 @@ class Cron ...@@ -86,7 +86,7 @@ class Cron
'name_year' => 'year', 'name_year' => 'year',
'text_period' => 'Every %s', 'text_period' => 'Every %s',
'text_mins' => 'at %s minutes past the hour', 'text_mins' => 'at %s minutes past the hour',
'text_time' => 'at %s:%s', 'text_time' => 'at %02s:%02s',
'text_dow' => 'on %s', 'text_dow' => 'on %s',
'text_month' => 'of %s', 'text_month' => 'of %s',
'text_dom' => 'on the %s', 'text_dom' => 'on the %s',
......
...@@ -631,9 +631,9 @@ class Uri ...@@ -631,9 +631,9 @@ class Uri
{ {
if (getenv('HTTP_CLIENT_IP')) { if (getenv('HTTP_CLIENT_IP')) {
$ip = getenv('HTTP_CLIENT_IP'); $ip = getenv('HTTP_CLIENT_IP');
} elseif (getenv('HTTP_X_FORWARDED_FOR')) { } elseif (getenv('HTTP_X_FORWARDED_FOR') && Grav::instance()['config']->get('system.http_x_forwarded.ip')) {
$ip = getenv('HTTP_X_FORWARDED_FOR'); $ip = getenv('HTTP_X_FORWARDED_FOR');
} elseif (getenv('HTTP_X_FORWARDED')) { } elseif (getenv('HTTP_X_FORWARDED') && Grav::instance()['config']->get('system.http_x_forwarded.ip')) {
$ip = getenv('HTTP_X_FORWARDED'); $ip = getenv('HTTP_X_FORWARDED');
} elseif (getenv('HTTP_FORWARDED_FOR')) { } elseif (getenv('HTTP_FORWARDED_FOR')) {
$ip = getenv('HTTP_FORWARDED_FOR'); $ip = getenv('HTTP_FORWARDED_FOR');
...@@ -1150,7 +1150,7 @@ class Uri ...@@ -1150,7 +1150,7 @@ class Uri
protected function createFromEnvironment(array $env) protected function createFromEnvironment(array $env)
{ {
// Build scheme. // Build scheme.
if (isset($env['HTTP_X_FORWARDED_PROTO'])) { if (isset($env['HTTP_X_FORWARDED_PROTO']) && Grav::instance()['config']->get('system.http_x_forwarded.protocol')) {
$this->scheme = $env['HTTP_X_FORWARDED_PROTO']; $this->scheme = $env['HTTP_X_FORWARDED_PROTO'];
} elseif (isset($env['X-FORWARDED-PROTO'])) { } elseif (isset($env['X-FORWARDED-PROTO'])) {
$this->scheme = $env['X-FORWARDED-PROTO']; $this->scheme = $env['X-FORWARDED-PROTO'];
...@@ -1168,11 +1168,14 @@ class Uri ...@@ -1168,11 +1168,14 @@ class Uri
$this->password = $env['PHP_AUTH_PW'] ?? null; $this->password = $env['PHP_AUTH_PW'] ?? null;
// Build host. // Build host.
$hostname = 'localhost'; if (isset($env['HTTP_X_FORWARDED_HOST']) && Grav::instance()['config']->get('system.http_x_forwarded.host')) {
if (isset($env['HTTP_HOST'])) { $hostname = $env['HTTP_X_FORWARDED_HOST'];
} else if (isset($env['HTTP_HOST'])) {
$hostname = $env['HTTP_HOST']; $hostname = $env['HTTP_HOST'];
} elseif (isset($env['SERVER_NAME'])) { } elseif (isset($env['SERVER_NAME'])) {
$hostname = $env['SERVER_NAME']; $hostname = $env['SERVER_NAME'];
} else {
$hostname = 'localhost';
} }
// Remove port from HTTP_HOST generated $hostname // Remove port from HTTP_HOST generated $hostname
$hostname = Utils::substrToString($hostname, ':'); $hostname = Utils::substrToString($hostname, ':');
...@@ -1180,7 +1183,7 @@ class Uri ...@@ -1180,7 +1183,7 @@ class Uri
$this->host = $this->validateHostname($hostname) ? $hostname : 'unknown'; $this->host = $this->validateHostname($hostname) ? $hostname : 'unknown';
// Build port. // Build port.
if (isset($env['HTTP_X_FORWARDED_PORT'])) { if (isset($env['HTTP_X_FORWARDED_PORT']) && Grav::instance()['config']->get('system.http_x_forwarded.port')) {
$this->port = (int)$env['HTTP_X_FORWARDED_PORT']; $this->port = (int)$env['HTTP_X_FORWARDED_PORT'];
} elseif (isset($env['X-FORWARDED-PORT'])) { } elseif (isset($env['X-FORWARDED-PORT'])) {
$this->port = (int)$env['X-FORWARDED-PORT']; $this->port = (int)$env['X-FORWARDED-PORT'];
......
...@@ -286,7 +286,7 @@ class Route ...@@ -286,7 +286,7 @@ class Route
$url .= '?' . $this->getUriQuery(); $url .= '?' . $this->getUriQuery();
} }
return $url; return rtrim($url,'/');
} }
/** /**
...@@ -344,9 +344,8 @@ class Route ...@@ -344,9 +344,8 @@ class Route
$parts[] = $this->language; $parts[] = $this->language;
} }
if ($this->route !== '') { $parts[] = $this->extension ? $this->route . '.' . $this->extension : $this->route;
$parts[] = $this->extension ? $this->route . '.' . $this->extension : $this->route;
}
if ($this->gravParams) { if ($this->gravParams) {
$parts[] = RouteFactory::buildParams($this->gravParams); $parts[] = RouteFactory::buildParams($this->gravParams);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment