From 5049086062fc6ea428053a3510abc0c538a8696f Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Fri, 23 Jan 2015 14:46:34 -0700 Subject: [PATCH 1/8] Fix to pickup deprecated `markdown_extra` system setting. --- 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 feeb449a8..e5d7698d6 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -419,7 +419,7 @@ class Page // pages.markdown_extra is deprecated, but still check it... if (isset($this->markdown_extra) || $config->get('system.pages.markdown_extra') !== null) { - $defaults['extra'] = $this->markdown_extra; + $defaults['extra'] = $this->markdown_extra ?: $config->get('system.pages.markdown_extra'); } // Initialize the preferred variant of Parsedown From 76a6b770656fc19447fd5a6fa25263ccb991b85c Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Fri, 23 Jan 2015 15:57:54 -0700 Subject: [PATCH 2/8] fixed typo in mime types --- system/config/media.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/system/config/media.yaml b/system/config/media.yaml index f5a4795da..057d8be91 100644 --- a/system/config/media.yaml +++ b/system/config/media.yaml @@ -52,19 +52,19 @@ mp3: ogg: type: audio thumb: media/thumb-ogg.png - mine: audio/ogg + mime: audio/ogg wma: type: audio thumb: media/thumb-wma.png - mine: audio/wma + mime: audio/wma m4a: type: audio thumb: media/thumb-m4a.png - mine: audio/m4a + mime: audio/m4a wav: type: audio thumb: media/thumb-wav.png - mine: audio/wav + mime: audio/wav txt: type: file From 05bd5cb96462eca1358a07e31c7de03265d2c405 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Fri, 23 Jan 2015 16:17:02 -0700 Subject: [PATCH 3/8] Fix for aggressive and greedy regex stripping numbers after / when should only strip order --- system/src/Grav/Common/Markdown/ParsedownGravTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php index 2cd116cbb..3e2a8307d 100644 --- a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php +++ b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php @@ -219,7 +219,7 @@ trait ParsedownGravTrait // If this is a 'real' filepath clean it up if (file_exists($this->page->path() . '/' . parse_url($markdown_url, PHP_URL_PATH))) { - $relative_path = $this->base_url . preg_replace('/\/([\d]+.)/', '/', str_replace($this->pages_dir, '', $this->page->path())); + $relative_path = $this->base_url . preg_replace('/\/([\d]+\.)/', '/', str_replace($this->pages_dir, '', $this->page->path())); $markdown_url = preg_replace('/^([\d]+.)/', '', preg_replace('/\/([\d]+.)/', '/', trim(preg_replace('/[^\/]+(\.md$)/', '', $markdown_url), '/'))); } From 8b251ca350eeb8d6e317c1f799bd68fb8cfebf84 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Fri, 23 Jan 2015 16:37:20 -0700 Subject: [PATCH 4/8] Part 2 of greedy fix --- system/src/Grav/Common/Markdown/ParsedownGravTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php index 3e2a8307d..0039c653e 100644 --- a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php +++ b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php @@ -220,7 +220,7 @@ trait ParsedownGravTrait // If this is a 'real' filepath clean it up if (file_exists($this->page->path() . '/' . parse_url($markdown_url, PHP_URL_PATH))) { $relative_path = $this->base_url . preg_replace('/\/([\d]+\.)/', '/', str_replace($this->pages_dir, '', $this->page->path())); - $markdown_url = preg_replace('/^([\d]+.)/', '', preg_replace('/\/([\d]+.)/', '/', trim(preg_replace('/[^\/]+(\.md$)/', '', $markdown_url), '/'))); + $markdown_url = preg_replace('/^([\d]+\.)/', '', preg_replace('/\/([\d]+\.)/', '/', trim(preg_replace('/[^\/]+(\.md$)/', '', $markdown_url), '/'))); } // else its a relative path already From fad428b94bc81bf590f6a0083c0b390f45eca1d5 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Fri, 23 Jan 2015 16:44:39 -0700 Subject: [PATCH 5/8] Fix for broken image last-ditch-effort mechanism --- system/src/Grav/Common/Grav.php | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/system/src/Grav/Common/Grav.php b/system/src/Grav/Common/Grav.php index aa5ef997c..26d68300f 100644 --- a/system/src/Grav/Common/Grav.php +++ b/system/src/Grav/Common/Grav.php @@ -107,29 +107,28 @@ class Grav extends Container if (!$page || !$page->routable()) { // special case where a media file is requested - if (!$page) { - $path_parts = pathinfo($path); + $path_parts = pathinfo($path); - $page = $c['pages']->dispatch($path_parts['dirname']); - if ($page) { - $media = $page->media()->all(); - $media_file = urldecode($path_parts['basename']); - if (isset($media[$media_file])) { - $medium = $media[$media_file]; + $page = $c['pages']->dispatch($path_parts['dirname']); + if ($page) { + $media = $page->media()->all(); + $media_file = urldecode($path_parts['basename']); + if (isset($media[$media_file])) { + $medium = $media[$media_file]; - // loop through actions for the image and call them - foreach ($c['uri']->query(null, true) as $action => $params) { - if (in_array($action, Medium::$valid_actions)) { - call_user_func_array(array(&$medium, $action), explode(',', $params)); - } + // loop through actions for the image and call them + foreach ($c['uri']->query(null, true) as $action => $params) { + if (in_array($action, Medium::$valid_actions)) { + call_user_func_array(array(&$medium, $action), explode(',', $params)); } - header('Content-type: '. $mime = $medium->get('mime')); - echo file_get_contents($medium->path()); - die; } + header('Content-type: '. $medium->get('mime')); + echo file_get_contents($medium->path()); + die; } } + // If no page found, fire event $event = $c->fireEvent('onPageNotFound'); From 63a2ffc0b1722b0f271e8d1e0f3e6d34a9fcd37c Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Fri, 23 Jan 2015 17:09:37 -0700 Subject: [PATCH 6/8] fix for markdown images/links in pages with slug override --- system/src/Grav/Common/Grav.php | 1 - system/src/Grav/Common/Markdown/ParsedownGravTrait.php | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/system/src/Grav/Common/Grav.php b/system/src/Grav/Common/Grav.php index 26d68300f..2d39ae4dd 100644 --- a/system/src/Grav/Common/Grav.php +++ b/system/src/Grav/Common/Grav.php @@ -128,7 +128,6 @@ class Grav extends Container } } - // If no page found, fire event $event = $c->fireEvent('onPageNotFound'); diff --git a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php index 0039c653e..b893fa60c 100644 --- a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php +++ b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php @@ -210,16 +210,16 @@ trait ParsedownGravTrait { // if absolute and starts with a base_url move on if ($this->base_url != '' && strpos($markdown_url, $this->base_url) === 0) { - $new_url = $markdown_url; + return $markdown_url; // if its absolute and starts with / } elseif (strpos($markdown_url, '/') === 0) { - $new_url = $this->base_url . $markdown_url; + return $this->base_url . $markdown_url; } else { $relative_path = $this->base_url . $this->page->route(); + $real_path = $this->page->path() . '/' . parse_url($markdown_url, PHP_URL_PATH); - // If this is a 'real' filepath clean it up - if (file_exists($this->page->path() . '/' . parse_url($markdown_url, PHP_URL_PATH))) { - $relative_path = $this->base_url . preg_replace('/\/([\d]+\.)/', '/', str_replace($this->pages_dir, '', $this->page->path())); + // strip numeric order from markdown path + if (($real_path)) { $markdown_url = preg_replace('/^([\d]+\.)/', '', preg_replace('/\/([\d]+\.)/', '/', trim(preg_replace('/[^\/]+(\.md$)/', '', $markdown_url), '/'))); } From f40410816e593bd5b7453b4428cd5144dfe1e26a Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Fri, 23 Jan 2015 17:21:58 -0700 Subject: [PATCH 7/8] updated changelog --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d35a69eef..b7c41bc5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +# v0.9.15 +## 01/23/2015 + +3. [](#bugfix) + * Typo in video mime types + * Fix for old `markdown_extra` system setting not getting picked up + * Fix in regex for Markdown links with numeric values in path + * Fix for broken image routing mechanism that got broken at some point + * Fix for markdown images/links in pages with page slug override + # v0.9.14 ## 01/23/2015 From 60423e4a28abcd41c07064056978c3336e1f689e Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Fri, 23 Jan 2015 17:22:41 -0700 Subject: [PATCH 8/8] version update --- system/defines.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/defines.php b/system/defines.php index 81e161036..e87129e07 100644 --- a/system/defines.php +++ b/system/defines.php @@ -2,7 +2,7 @@ // Some standard defines define('GRAV', true); -define('GRAV_VERSION', '0.9.14'); +define('GRAV_VERSION', '0.9.15'); define('DS', '/'); // Directories and Paths