diff --git a/bin/gpm b/bin/gpm index 5a039e597..f9f763624 100755 --- a/bin/gpm +++ b/bin/gpm @@ -40,8 +40,6 @@ if (!function_exists('curl_version')) { $grav = Grav::instance(array('loader' => $autoload)); $grav['config']->init(); $grav['streams']; -$grav['plugins']->init(); -$grav['themes']->init(); $app = new Application('Grav Package Manager', GRAV_VERSION); $app->addCommands(array( diff --git a/system/src/Grav/Common/Assets.php b/system/src/Grav/Common/Assets.php index 16822b990..069c30fca 100644 --- a/system/src/Grav/Common/Assets.php +++ b/system/src/Grav/Common/Assets.php @@ -1124,6 +1124,36 @@ class Assets return $this->addDir($directory, self::JS_REGEX); } + /** + * Sets the state of CSS Pipeline + * + * @param boolean $value + */ + public function setCssPipeline($value) + { + $this->css_pipeline = (bool) $value; + } + + /** + * Sets the state of JS Pipeline + * + * @param boolean $value + */ + public function setJsPipeline($value) + { + $this->js_pipeline = (bool) $value; + } + + /** + * Explicitly set's a timestamp for assets + * + * @param $value + */ + public function setTimestamp($value) + { + $this->timestamp = '?'.$value; + } + public function __toString() { return ''; diff --git a/system/src/Grav/Common/GPM/Remote/Grav.php b/system/src/Grav/Common/GPM/Remote/Grav.php index f8148a526..152b8eda7 100644 --- a/system/src/Grav/Common/GPM/Remote/Grav.php +++ b/system/src/Grav/Common/GPM/Remote/Grav.php @@ -55,7 +55,7 @@ class Grav extends AbstractPackageCollection $diffLog = []; foreach ($this->data['changelog'] as $version => $changelog) { - preg_match("/[\d\.]+/", $version, $cleanVersion); + preg_match("/[\w-\.]+/", $version, $cleanVersion); if (!$cleanVersion || version_compare($diff, $cleanVersion[0], ">=")) { continue; } diff --git a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php index fd6dd623f..5c075dcb5 100644 --- a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php +++ b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php @@ -204,6 +204,48 @@ trait ParsedownGravTrait if (isset($excerpt['element']['attributes']['href'])) { $url = parse_url(htmlspecialchars_decode($excerpt['element']['attributes']['href'])); + // if there is a query, then parse it and build action calls + if (isset($url['query'])) { + $actions = array_reduce(explode('&', $url['query']), function ($carry, $item) { + $parts = explode('=', $item, 2); + $value = isset($parts[1]) ? $parts[1] : null; + $carry[$parts[0]] = $value; + + return $carry; + }, []); + + // valid attributes supported + $valid_attributes = ['rel', 'target', 'id', 'class', 'classes']; + + // Unless told to not process, go through actions + if (array_key_exists('noprocess', $actions)) { + unset($actions['noprocess']); + } else { + // loop through actions for the image and call them + foreach ($actions as $attrib => $value) { + $key = $attrib; + + if (in_array($attrib, $valid_attributes)) { + // support both class and classes + if ($attrib == 'classes') { + $attrib = 'class'; + } + $excerpt['element']['attributes'][$attrib] = $value; + unset($actions[$key]); + } + } + } + + + $url['query']= http_build_query($actions, null, '&', PHP_QUERY_RFC3986); + } + + // if no query elements left, unset query + if (empty($url['query'])) { + unset ($url['query']); + } + + // if there is no scheme, the file is local if (!isset($url['scheme']) && (count($url) > 0)) { // convert the URl is required diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index 50b3fa83f..1aeb6a7f6 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -1951,7 +1951,7 @@ class Page * @return mixed * @internal */ - protected function evaluate($value) + public function evaluate($value) { // Parse command. if (is_string($value)) {