From a5d31e7187ded61bdb2bb4eb536be94ce51eb11e Mon Sep 17 00:00:00 2001 From: Gert Date: Sun, 22 Feb 2015 00:01:44 +0100 Subject: [PATCH] allow duplicated actions and follow medium on action --- .../src/Grav/Common/Markdown/ParsedownGravTrait.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php index ef6c8b12c..fe5aa5167 100644 --- a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php +++ b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php @@ -154,12 +154,18 @@ trait ParsedownGravTrait // if there is a query, then parse it and build action calls if (isset($url['query'])) { - parse_str($url['query'], $actions); + $actions = array_reduce(explode('&', $url['query']), function ($carry, $item) { + $parts = explode('=', $item, 2); + $value = isset($parts[1]) ? $parts[1] : null; + $carry[] = [ 'method' => $parts[0], 'params' => $value ]; + + return $carry; + }, []); } // loop through actions for the image and call them - foreach ($actions as $action => $params) { - call_user_func_array(array(&$medium, $action), explode(',', $params)); + foreach ($actions as $action) { + $medium = call_user_func_array(array($medium, $action['method']), explode(',', $action['params'])); } $excerpt['element'] = $medium->parseDownElement($title, $alt, $class);