Merge branch '1.7' of github.com:getgrav/grav into 1.7

This commit is contained in:
Matias Griese
2020-09-02 12:41:42 +03:00
3 changed files with 20 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
# v1.7.0-rc.16
## mm/dd/2020
## 09/01/2020
1. [](#new)
* Added a new `svg_image()` twig function to make it easier to 'include' SVG source in Twig
@@ -444,6 +444,15 @@
* Optimization: Initialize debugbar only after the configuration has been loaded
* Optimization: Combine some early Grav processors into a single one
# 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

View File

@@ -8,7 +8,7 @@
// Some standard defines
define('GRAV', true);
define('GRAV_VERSION', '1.7.0-rc.15');
define('GRAV_VERSION', '1.7.0-rc.16');
define('GRAV_TESTING', true);
define('DS', '/');

View File

@@ -1420,7 +1420,7 @@ class TwigExtension extends AbstractExtension implements GlobalsInterface
* @param $classes
* @return string|string[]|null
*/
public static function svgImageFunction($path, $classes = null)
public static function svgImageFunction($path, $classes = null, $strip_style = false)
{
$path = Utils::fullPath($path);
@@ -1431,6 +1431,14 @@ class TwigExtension extends AbstractExtension implements GlobalsInterface
$classes = " inline-block $classes";
$matched = false;
//Remove xml tag if it exists
$svg = preg_replace('/^<\?xml.*\?>/','', $svg);
//Strip style if needed
if ($strip_style) {
$svg = preg_replace('/<style.*<\/style>/s', '', $svg);
}
//Look for existing class
$svg = preg_replace_callback('/^<svg.*?(class=\"(.*?)").*>/', function($matches) use ($classes, &$matched) {
if (isset($matches[2])) {