Merge branch 'develop' of github.com:getgrav/grav into feature-multimedia

* 'develop' of github.com:getgrav/grav:
  switched to && operator
  Moved default image quality to defines.php
  Missing 'quality' in valid image functions
  updated version
  updated version
  updated changelog
  Fix for issue #158 - load order with debugger on
  Added support for external URL in directs
  more description for separator
  Serve images as static files
  Corrected HTML output of links with empty HTML anchors
  Changed Twig Link Regex which fixes #149 [Markdown Doesn't Handle [words](#)]

Conflicts:
	system/src/Grav/Common/Page/Medium.php
This commit is contained in:
Gert
2015-03-31 22:58:24 +02:00
9 changed files with 42 additions and 10 deletions

View File

@@ -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

Binary file not shown.

View File

@@ -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;

View File

@@ -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 /

View File

@@ -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);

View File

@@ -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,

View File

@@ -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();
}

View File

@@ -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));
}

View File

@@ -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()