mirror of
https://github.com/getgrav/grav.git
synced 2026-07-19 23:02:13 +02:00
Merge branch 'develop' of https://github.com/getgrav/grav into 2.0
This commit is contained in:
@@ -12,12 +12,18 @@
|
||||
* Make it possible to include debug bar also into non-HTML responses
|
||||
|
||||
# v1.3.5
|
||||
## xx/xx/2017
|
||||
## 10/11/2017
|
||||
|
||||
1. [](#improved)
|
||||
* Refactored `URI` class with numerous bug fixes, and optimizations
|
||||
* Override `system.media.upload_limit` with PHP's `post_max_size` or `upload_max_filesize`
|
||||
* Updated `bin/grav clean` command to remove unnecessary vendor files (save some bytes)
|
||||
* Added a `http_status_code` Twig function to allow setting HTTP status codes from Twig directly.
|
||||
* Deter XSS attacks via URI path/uri methods (credit:newbthenewbd)
|
||||
* Added support for `$uri->toArray()` and `(string)$uri`
|
||||
* Added support for `type` on `Asstes::addInlineJs()` [#1683](https://github.com/getgrav/grav/pull/1683)
|
||||
1. [](#bugfix)
|
||||
* Fixed method signature error with `GPM\InstallCommand::processPackage()` [#1682](https://github.com/getgrav/grav/pull/1682)
|
||||
|
||||
# v1.3.4
|
||||
## 09/29/2017
|
||||
|
||||
@@ -934,15 +934,6 @@ form:
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
media.upload_limit:
|
||||
type: text
|
||||
append: bytes
|
||||
label: PLUGIN_ADMIN.UPLOAD_LIMIT
|
||||
help: PLUGIN_ADMIN.UPLOAD_LIMIT_HELP
|
||||
classes: small
|
||||
validate:
|
||||
type: number
|
||||
|
||||
media.enable_media_timestamp:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.ENABLE_MEDIA_TIMESTAMP
|
||||
|
||||
@@ -124,7 +124,6 @@ images:
|
||||
|
||||
media:
|
||||
enable_media_timestamp: false # Enable media timestamps
|
||||
upload_limit: 0 # Set maximum upload size in bytes (0 is unlimited)
|
||||
unsupported_inline_types: [] # Array of supported media types to try to display inline
|
||||
allowed_fallback_types: [] # Array of allowed media types of files found if accessed via Page route
|
||||
auto_metadata_exif: false # Automatically create metadata files from Exif data where possible
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
// Some standard defines
|
||||
define('GRAV', true);
|
||||
define('GRAV_VERSION', '1.3.4');
|
||||
define('GRAV_VERSION', '1.3.5');
|
||||
//define('GRAV_TESTING', true);
|
||||
define('DS', '/');
|
||||
|
||||
|
||||
@@ -465,12 +465,13 @@ class Assets
|
||||
* For adding chunks of string-based inline JS
|
||||
*
|
||||
* @param mixed $asset
|
||||
* @param int $priority the priority, bigger comes first
|
||||
* @param string $group name of the group
|
||||
* @param int $priority the priority, bigger comes first
|
||||
* @param string $group name of the group
|
||||
* @param null $attributes
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addInlineJs($asset, $priority = null, $group = null)
|
||||
public function addInlineJs($asset, $priority = null, $group = null, $attributes = null)
|
||||
{
|
||||
$asset = trim($asset);
|
||||
|
||||
@@ -485,7 +486,8 @@ class Assets
|
||||
'asset' => $asset,
|
||||
'priority' => intval($priority ?: 10),
|
||||
'order' => count($this->js),
|
||||
'group' => $group ?: 'head'
|
||||
'group' => $group ?: 'head',
|
||||
'type' => $attributes ?: '',
|
||||
];
|
||||
|
||||
// check for dynamic array and merge with defaults
|
||||
@@ -667,7 +669,8 @@ class Assets
|
||||
}
|
||||
|
||||
if ($inline_js) {
|
||||
$output .= "\n<script>\n" . $inline_js . "\n</script>\n";
|
||||
$attribute_string = isset($inline) && $inline['type'] ? " type=\"" . $inline['type'] . "\"" : '';
|
||||
$output .= "\n<script" . $attribute_string . ">\n" . $inline_js . "\n</script>\n";
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
||||
@@ -12,6 +12,7 @@ use Grav\Common\Debugger;
|
||||
use Grav\Common\Grav;
|
||||
use Grav\Common\Data\Data;
|
||||
use Grav\Common\Service\ConfigServiceProvider;
|
||||
use Grav\Common\Utils;
|
||||
|
||||
class Config extends Data
|
||||
{
|
||||
@@ -95,6 +96,10 @@ class Config extends Data
|
||||
$this->joinDefaults($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
// Override the media.upload_limit based on PHP values
|
||||
$upload_limit = Utils::getUploadLimit();
|
||||
$this->items['system']['media']['upload_limit'] = $upload_limit > 0 ? $upload_limit : 1024*1024*1024;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -903,4 +903,40 @@ abstract class Utils
|
||||
|
||||
return $path . $basename;
|
||||
}
|
||||
|
||||
public static function getUploadLimit()
|
||||
{
|
||||
static $max_size = -1;
|
||||
|
||||
if ($max_size < 0) {
|
||||
$post_max_size = static::parseSize(ini_get('post_max_size'));
|
||||
if ($post_max_size > 0) {
|
||||
$max_size = $post_max_size;
|
||||
}
|
||||
|
||||
$upload_max = static::parseSize(ini_get('upload_max_filesize'));
|
||||
if ($upload_max > 0 && $upload_max < $max_size) {
|
||||
$max_size = $upload_max;
|
||||
}
|
||||
}
|
||||
|
||||
return $max_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a readable file size and return a value in bytes
|
||||
*
|
||||
* @param $size
|
||||
* @return int
|
||||
*/
|
||||
public static function parseSize($size)
|
||||
{
|
||||
$unit = preg_replace('/[^bkmgtpezy]/i', '', $size);
|
||||
$size = preg_replace('/[^0-9\.]/', '', $size);
|
||||
if ($unit) {
|
||||
return intval($size * pow(1024, stripos('bkmgtpezy', $unit[0])));
|
||||
} else {
|
||||
return intval($size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ class InstallCommand extends ConsoleCommand
|
||||
} else {
|
||||
$is_valid_destination = Installer::isValidDestination($this->destination . DS . $package->install_path);
|
||||
if ($is_valid_destination || Installer::lastErrorCode() == Installer::NOT_FOUND) {
|
||||
$this->processPackage($package, true, false);
|
||||
$this->processPackage($package, false);
|
||||
} else {
|
||||
if (Installer::lastErrorCode() == Installer::EXISTS) {
|
||||
|
||||
@@ -205,7 +205,7 @@ class InstallCommand extends ConsoleCommand
|
||||
|
||||
if ($answer) {
|
||||
$is_update = true;
|
||||
$this->processPackage($package, true, $is_update);
|
||||
$this->processPackage($package, $is_update);
|
||||
} else {
|
||||
$this->output->writeln("<yellow>Package " . $package_name . " not overwritten</yellow>");
|
||||
}
|
||||
@@ -311,7 +311,7 @@ class InstallCommand extends ConsoleCommand
|
||||
if ($answer) {
|
||||
foreach ($packages as $dependencyName => $dependencyVersion) {
|
||||
$package = $this->gpm->findPackage($dependencyName);
|
||||
$this->processPackage($package, true, ($type == 'update') ? true : false);
|
||||
$this->processPackage($package, ($type == 'update') ? true : false);
|
||||
}
|
||||
$this->output->writeln('');
|
||||
} else {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user