From e695b1942c9e449dbcf9288d0b4e1b65ee69378d Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 2 Dec 2015 15:36:16 -0700 Subject: [PATCH 1/7] .gitignore for accounts - https://github.com/getgrav/grav-plugin-login/issues/16 --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 755814004..197774ee6 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,8 @@ logs/* !logs/.* images/* !images/.* +user/accounts/* +!user/accounts/.* user/data/* !user/data/.* user/plugins/* From dc8c0b6522b58a6f1d52975a04aa03fec4d54f1f Mon Sep 17 00:00:00 2001 From: Djamil Legato Date: Wed, 2 Dec 2015 23:44:18 -0800 Subject: [PATCH 2/7] Fixed changelog differ to take into account betas/rc versions (fixes #496) --- system/src/Grav/Common/GPM/Remote/Grav.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } From 23a9a736002cdcac08f22810f2e74ce2a9772a4d Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Thu, 3 Dec 2015 12:16:16 -0700 Subject: [PATCH 3/7] Added logic to support link attributes via query string --- .../Common/Markdown/ParsedownGravTrait.php | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) 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 From b80ed731b0ab1b66ef4bdcc18b202f9118a04881 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Thu, 3 Dec 2015 13:44:25 -0700 Subject: [PATCH 4/7] Made `Page.evaluate()` public so it can be used by twig, plugins etc. --- system/src/Grav/Common/Page/Page.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)) { From 4ca8fab750bfddf2a9fdbb2c725987ba206b5c05 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Thu, 3 Dec 2015 14:48:15 -0700 Subject: [PATCH 5/7] removed unused Plugin and Theme initialization --- bin/gpm | 2 -- 1 file changed, 2 deletions(-) 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( From f1f8579a0b2e7969f551c4ed06141ffb112aed15 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Thu, 3 Dec 2015 14:48:34 -0700 Subject: [PATCH 6/7] New setters to set state of CSS / JS pipelining --- system/src/Grav/Common/Assets.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/system/src/Grav/Common/Assets.php b/system/src/Grav/Common/Assets.php index 16822b990..41198544c 100644 --- a/system/src/Grav/Common/Assets.php +++ b/system/src/Grav/Common/Assets.php @@ -1124,6 +1124,26 @@ 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; + } + public function __toString() { return ''; From f29f698f61a63203c7f578eb2ec5628172b8d865 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Thu, 3 Dec 2015 16:56:30 -0700 Subject: [PATCH 7/7] setter method to allow explicit setting of asset timestamp --- system/src/Grav/Common/Assets.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/system/src/Grav/Common/Assets.php b/system/src/Grav/Common/Assets.php index 41198544c..069c30fca 100644 --- a/system/src/Grav/Common/Assets.php +++ b/system/src/Grav/Common/Assets.php @@ -1144,6 +1144,16 @@ class Assets $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 '';