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

This commit is contained in:
Matias Griese
2022-02-22 11:36:36 +02:00
7 changed files with 29 additions and 18 deletions

View File

@@ -14,6 +14,8 @@
* Fixed phpstan issues (All level 2, Framework level 5)
2. [](#bugfix)
* Fixed `'mbstring' extension is not loaded` error, use Polyfill instead [#3504](https://github.com/getgrav/grav/pull/3504)
* Fixed new `Utils::pathinfo()` and `Utils::basename()` being too strict for legacy use [#3542](https://github.com/getgrav/grav/issues/3542)
* Fixed non-standard video html atributes generated by `{{ media.html() }}` [#3540](https://github.com/getgrav/grav/issues/3540)
# v1.7.30
## 02/07/2022

12
composer.lock generated
View File

@@ -4356,16 +4356,16 @@
},
{
"name": "phar-io/version",
"version": "3.1.1",
"version": "3.2.1",
"source": {
"type": "git",
"url": "https://github.com/phar-io/version.git",
"reference": "15a90844ad40f127afd244c0cad228de2a80052a"
"reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phar-io/version/zipball/15a90844ad40f127afd244c0cad228de2a80052a",
"reference": "15a90844ad40f127afd244c0cad228de2a80052a",
"url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74",
"reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74",
"shasum": ""
},
"require": {
@@ -4401,9 +4401,9 @@
"description": "Library for handling version information and constraints",
"support": {
"issues": "https://github.com/phar-io/version/issues",
"source": "https://github.com/phar-io/version/tree/3.1.1"
"source": "https://github.com/phar-io/version/tree/3.2.1"
},
"time": "2022-02-07T21:56:48+00:00"
"time": "2022-02-21T01:04:05+00:00"
},
{
"name": "phpdocumentor/reflection-common",

View File

@@ -16,8 +16,8 @@ use Grav\Common\Assets\Traits\TestingAssetsTrait;
use Grav\Common\Config\Config;
use Grav\Framework\Object\PropertyObject;
use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator;
use function array_slice;
use function call_user_func_array;
use function count;
use function func_get_args;
use function is_array;
@@ -174,6 +174,10 @@ class Assets extends PropertyObject
*/
public function add($asset)
{
if (!$asset) {
return $this;
}
$args = func_get_args();
// More than one asset
@@ -198,7 +202,8 @@ class Assets extends PropertyObject
call_user_func_array([$this, 'add'], $args);
} else {
// Get extension
$extension = Utils::pathinfo(parse_url($asset, PHP_URL_PATH), PATHINFO_EXTENSION);
$path = parse_url($asset, PHP_URL_PATH);
$extension = $path ? Utils::pathinfo($path, PATHINFO_EXTENSION) : '';
// JavaScript or CSS
if ($extension !== '') {

View File

@@ -62,6 +62,7 @@ use function call_user_func_array;
use function function_exists;
use function get_class;
use function in_array;
use function is_array;
use function is_callable;
use function is_int;
use function is_string;
@@ -729,14 +730,17 @@ class Grav extends Container
*/
public function fallbackUrl($path)
{
$path_parts = Utils::pathinfo($path);
if (!is_array($path_parts)) {
return false;
}
/** @var Uri $uri */
$uri = $this['uri'];
/** @var Config $config */
$config = $this['config'];
$path_parts = Utils::pathinfo($path);
/** @var Pages $pages */
$pages = $this['pages'];
$page = $pages->find($path_parts['dirname'], true);

View File

@@ -25,7 +25,7 @@ trait MediaPlayerTrait
public function controls($status = true)
{
if ($status) {
$this->attributes['controls'] = true;
$this->attributes['controls'] = 'controls';
} else {
unset($this->attributes['controls']);
}
@@ -42,7 +42,7 @@ trait MediaPlayerTrait
public function loop($status = false)
{
if ($status) {
$this->attributes['loop'] = true;
$this->attributes['loop'] = 'loop';
} else {
unset($this->attributes['loop']);
}
@@ -59,7 +59,7 @@ trait MediaPlayerTrait
public function autoplay($status = false)
{
if ($status) {
$this->attributes['autoplay'] = true;
$this->attributes['autoplay'] = 'autoplay';
} else {
unset($this->attributes['autoplay']);
}
@@ -76,7 +76,7 @@ trait MediaPlayerTrait
public function muted($status = false)
{
if ($status) {
$this->attributes['muted'] = true;
$this->attributes['muted'] = 'muted';
} else {
unset($this->attributes['muted']);
}
@@ -110,6 +110,6 @@ trait MediaPlayerTrait
*/
public function resetPlayer()
{
$this->attributes['controls'] = true;
$this->attributes['controls'] = 'controls';
}
}

View File

@@ -40,7 +40,7 @@ trait VideoMediaTrait
public function playsinline($status = false)
{
if ($status) {
$this->attributes['playsinline'] = true;
$this->attributes['playsinline'] = 'playsinline';
} else {
unset($this->attributes['playsinline']);
}

View File

@@ -995,7 +995,7 @@ abstract class Utils
* @return string[]|string
* @phpstan-return array{dirname: string, basename: string, extension: string|null, filename: string}|string
*/
public static function pathinfo(string $path, int $flags = null)
public static function pathinfo($path, int $flags = null)
{
$path = str_replace(['%2F', '%5C'], ['/', '\\'], rawurlencode($path));
@@ -1021,7 +1021,7 @@ abstract class Utils
* @param string $suffix
* @return string
*/
public static function basename(string $path, string $suffix = ''): string
public static function basename($path, string $suffix = ''): string
{
return rawurldecode(basename(str_replace(['%2F', '%5C'], '/', rawurlencode($path)), $suffix));
}