diff --git a/CHANGELOG.md b/CHANGELOG.md index 9383e54d8..342805a26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -379,6 +379,15 @@ * Optimization: Initialize debugbar only after the configuration has been loaded * Optimization: Combine some early Grav processors into a single one +# v1.6.26 +## mm/dd/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) + + # v1.6.25 ## 05/14/2020 diff --git a/system/blueprints/config/system.yaml b/system/blueprints/config/system.yaml index 66d362d59..41b04b962 100644 --- a/system/blueprints/config/system.yaml +++ b/system/blueprints/config/system.yaml @@ -546,6 +546,15 @@ form: 0: PLUGIN_ADMIN.NO validate: 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: type: tab diff --git a/system/config/system.yaml b/system/config/system.yaml index acd0595f7..2f081cfb7 100644 --- a/system/config/system.yaml +++ b/system/config/system.yaml @@ -61,6 +61,12 @@ pages: special_chars: # List of special characters to automatically convert to entities '>': 'gt' '<': '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 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) diff --git a/system/src/Grav/Common/Page/Markdown/Excerpts.php b/system/src/Grav/Common/Page/Markdown/Excerpts.php index 7717d595c..f5dc274bf 100644 --- a/system/src/Grav/Common/Page/Markdown/Excerpts.php +++ b/system/src/Grav/Common/Page/Markdown/Excerpts.php @@ -102,7 +102,7 @@ class Excerpts ); // 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. if (array_key_exists('noprocess', $actions)) { @@ -246,6 +246,7 @@ class Excerpts $url_parts = is_string($url) ? $this->parseUrl($url) : $url; $actions = []; + // if there is a query, then parse it and build action calls if (isset($url_parts['query'])) { $actions = array_reduce( diff --git a/system/src/Grav/Common/Page/Medium/ImageMedium.php b/system/src/Grav/Common/Page/Medium/ImageMedium.php index 30c742bca..dd66bb199 100644 --- a/system/src/Grav/Common/Page/Medium/ImageMedium.php +++ b/system/src/Grav/Common/Page/Medium/ImageMedium.php @@ -510,6 +510,15 @@ class ImageMedium extends Medium 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. * @@ -519,10 +528,6 @@ class ImageMedium extends Medium */ public function __call($method, $args) { - if ($method === 'cropZoom') { - $method = 'zoomCrop'; - } - if (!\in_array($method, self::$magic_actions, true)) { return parent::__call($method, $args); }