diff --git a/CHANGELOG.md b/CHANGELOG.md index 67d03f96a..a58998227 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,17 @@ # v0.9.20 -## 02/XX/2015 +## 03/24/2015 1. [](#new) * Added `addAsyncJs()` and `addDeferJs()` to Assets manager + * Added support for extranal URL redirects 2. [](#improved) - * + * Fix unpredictable asset ordering when set from plugin/system + * Updated `nginx.conf` to ensure system assets are accessible + * Ensure images are served as static files in Nginx + * Updated vendor libraries to latest versions + * Updated included composer.phar to latest version 3. [](#bugfix) - * + * Fixed issue with markdown links to `#` breaking HTML # v0.9.19 ## 02/28/2015 diff --git a/bin/composer.phar b/bin/composer.phar index 227468449..31b9d3915 100755 Binary files a/bin/composer.phar and b/bin/composer.phar differ diff --git a/nginx.conf b/nginx.conf index 22f7acd56..12a48054a 100644 --- a/nginx.conf +++ b/nginx.conf @@ -25,6 +25,10 @@ http { index index.php; if (!-e $request_filename){ rewrite ^(.*)$ /index.php last; } } + + location /images/ { + # Serve images as static + } location /user { rewrite ^/user/accounts/(.*)$ /error redirect; diff --git a/system/config/system.yaml b/system/config/system.yaml index 9e5359b23..aaafeef79 100644 --- a/system/config/system.yaml +++ b/system/config/system.yaml @@ -1,6 +1,6 @@ absolute_urls: false # Absolute or relative URLs for `base_url` timezone: '' # Valid values: http://php.net/manual/en/timezones.php -param_sep: ':' # Parameter separator +param_sep: ':' # Parameter separator, use ';' for Apache on windows home: alias: '/home' # Default path for home, ie / diff --git a/system/defines.php b/system/defines.php index 13aca8638..91ec2ac70 100644 --- a/system/defines.php +++ b/system/defines.php @@ -2,7 +2,7 @@ // Some standard defines define('GRAV', true); -define('GRAV_VERSION', '0.9.19'); +define('GRAV_VERSION', '0.9.20'); define('DS', '/'); // Directories and Paths @@ -40,3 +40,6 @@ define('RAW_CONTENT', 1); define('TWIG_CONTENT', 2); define('TWIG_CONTENT_LIST', 3); define('TWIG_TEMPLATES', 4); + +// Other defines +define('DEFAULT_IMG_QUALITY', 85); diff --git a/system/src/Grav/Common/Assets.php b/system/src/Grav/Common/Assets.php index 57830fb95..a63a08d3d 100644 --- a/system/src/Grav/Common/Assets.php +++ b/system/src/Grav/Common/Assets.php @@ -244,7 +244,7 @@ class Assets } $key = md5($asset); - if ($asset && !array_key_exists($key, $this->css)) { + if ($asset) { $this->css[$key] = [ 'asset' => $asset, 'priority' => $priority, @@ -286,7 +286,7 @@ class Assets } $key = md5($asset); - if ($asset && !array_key_exists($key, $this->js)) { + if ($asset) { $this->js[$key] = [ 'asset' => $asset, 'priority' => $priority, diff --git a/system/src/Grav/Common/Grav.php b/system/src/Grav/Common/Grav.php index 26c9f2fef..e0a91a06a 100644 --- a/system/src/Grav/Common/Grav.php +++ b/system/src/Grav/Common/Grav.php @@ -255,7 +255,13 @@ class Grav extends Container $this['session']->close(); } - header("Location: " . rtrim($uri->rootUrl(), '/') .'/'. trim($route, '/'), true, $code); + if ($this['uri']->isExternal($route)) { + $url = $route; + } else { + $url = rtrim($uri->rootUrl(), '/') .'/'. trim($route, '/'); + } + + header("Location: {$url}", true, $code); exit(); } diff --git a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php index 55e4e3b47..dde10eac4 100644 --- a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php +++ b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php @@ -19,7 +19,7 @@ trait ParsedownGravTrait protected $pages_dir; protected $special_chars; - protected $twig_link_regex = '/\!*\[(?:.*)\]\(([{{|{%|{#].*[#}|%}|}}])\)/'; + protected $twig_link_regex = '/\!*\[(?:.*)\]\((\{([\{%#])\s*(.*?)\s*(?:\2|\})\})\)/'; /** * Initialiazation function to setup key variables needed by the MarkdownGravLinkTrait @@ -203,7 +203,7 @@ trait ParsedownGravTrait $url = parse_url(htmlspecialchars_decode($excerpt['element']['attributes']['href'])); // if there is no scheme, the file is local - if (!isset($url['scheme'])) { + if (!isset($url['scheme']) && (count($url) > 0)) { // convert the URl is required $excerpt['element']['attributes']['href'] = $this->convertUrl(Uri::buildUrl($url)); } diff --git a/system/src/Grav/Common/Uri.php b/system/src/Grav/Common/Uri.php index 839b91c11..d1dad9fda 100644 --- a/system/src/Grav/Common/Uri.php +++ b/system/src/Grav/Common/Uri.php @@ -378,6 +378,20 @@ class Uri return $ipaddress; } + /** + * Is this an external URL? if it starts with `http` then yes, else false + * + * @param string $url the URL in question + * @return boolean is eternal state + */ + public function isExternal($url) + { + if (Utils::startsWith($url, 'http')) { + return true; + } else { + return false; + } + } /** * The opposite of built-in PHP method parse_url()