Upgrade to 3.9.5

This commit is contained in:
Bastian Allgeier
2023-06-07 14:12:49 +02:00
parent 38c8ba7e59
commit f76fbaa53e
49 changed files with 625 additions and 633 deletions

5
kirby/vendor/bin/yaml-lint.bat vendored Normal file
View File

@@ -0,0 +1,5 @@
@ECHO OFF
setlocal DISABLEDELAYEDEXPANSION
SET BIN_TARGET=%~dp0/yaml-lint
SET COMPOSER_RUNTIME_BIN_DIR=%~dp0
php "%BIN_TARGET%" %*

View File

@@ -17,6 +17,7 @@
namespace claviska;
use Exception;
use GdImage;
use League\ColorExtractor\Color;
use League\ColorExtractor\ColorExtractor;
use League\ColorExtractor\Palette;
@@ -64,11 +65,11 @@ class SimpleImage
protected array $flags;
protected $image;
protected $image = null;
protected string $mimeType;
protected null|array|false $exif;
protected null|array|false $exif = null;
//////////////////////////////////////////////////////////////////////////////////////////////////
// Magic methods
@@ -115,10 +116,7 @@ class SimpleImage
*/
public function __destruct()
{
//Check for a valid GDimage instance
$type_check = (gettype($this->image) == 'object' && $this->image::class == 'GdImage');
if (is_resource($this->image) && $type_check) {
if ($this->image instanceof GdImage) {
imagedestroy($this->image);
}
}
@@ -585,7 +583,8 @@ class SimpleImage
*/
public function getExif(): ?array
{
return $this->exif ?? null;
// returns null if exif value is falsy: null, false or empty array.
return $this->exif ?: null;
}
/**
@@ -649,8 +648,8 @@ class SimpleImage
/**
* Same as PHP's imagecopymerge, but works with transparent images. Used internally for overlay.
*
* @param resource $dstIm Destination image link resource.
* @param resource $srcIm Source image link resource.
* @param GdImage $dstIm Destination image.
* @param GdImage $srcIm Source image.
* @param int $dstX x-coordinate of destination point.
* @param int $dstY y-coordinate of destination point.
* @param int $srcX x-coordinate of source point.
@@ -659,7 +658,7 @@ class SimpleImage
* @param int $srcH Source height.
* @return bool true if success.
*/
protected static function imageCopyMergeAlpha($dstIm, $srcIm, int $dstX, int $dstY, int $srcX, int $srcY, int $srcW, int $srcH, int $pct): bool
protected static function imageCopyMergeAlpha(GdImage $dstIm, GdImage $srcIm, int $dstX, int $dstY, int $srcX, int $srcY, int $srcW, int $srcH, int $pct): bool
{
// Are we merging with transparency?
if ($pct < 100) {
@@ -1376,7 +1375,7 @@ class SimpleImage
/**
* Receives a text and breaks into LINES.
*/
private function textSeparateLines(string $text, string $fontFile, int $fontSize, int $maxWidth): array
private function textSeparateLines(string $text, string $fontFile, float $fontSize, int $maxWidth): array
{
$lines = [];
$words = self::textSeparateWords($text);

View File

@@ -2,17 +2,17 @@
"packages": [
{
"name": "claviska/simpleimage",
"version": "4.0.2",
"version_normalized": "4.0.2.0",
"version": "4.0.5",
"version_normalized": "4.0.5.0",
"source": {
"type": "git",
"url": "https://github.com/claviska/SimpleImage.git",
"reference": "226d507cca0c8400d69bee7eb324158e3cbe246e"
"reference": "b25690f0fc25b2f0b91731370465a3b4e52ea587"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/claviska/SimpleImage/zipball/226d507cca0c8400d69bee7eb324158e3cbe246e",
"reference": "226d507cca0c8400d69bee7eb324158e3cbe246e",
"url": "https://api.github.com/repos/claviska/SimpleImage/zipball/b25690f0fc25b2f0b91731370465a3b4e52ea587",
"reference": "b25690f0fc25b2f0b91731370465a3b4e52ea587",
"shasum": ""
},
"require": {
@@ -24,7 +24,7 @@
"laravel/pint": "^1.5",
"phpstan/phpstan": "^1.10"
},
"time": "2023-03-20T15:27:20+00:00",
"time": "2023-06-05T14:32:39+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@@ -46,7 +46,7 @@
"description": "A PHP class that makes working with images as simple as possible.",
"support": {
"issues": "https://github.com/claviska/SimpleImage/issues",
"source": "https://github.com/claviska/SimpleImage/tree/4.0.2"
"source": "https://github.com/claviska/SimpleImage/tree/4.0.5"
},
"funding": [
{
@@ -1006,17 +1006,17 @@
},
{
"name": "symfony/yaml",
"version": "v5.4.21",
"version_normalized": "5.4.21.0",
"version": "v5.4.23",
"version_normalized": "5.4.23.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "3713e20d93e46e681e51605d213027e48dab3469"
"reference": "4cd2e3ea301aadd76a4172756296fe552fb45b0b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/3713e20d93e46e681e51605d213027e48dab3469",
"reference": "3713e20d93e46e681e51605d213027e48dab3469",
"url": "https://api.github.com/repos/symfony/yaml/zipball/4cd2e3ea301aadd76a4172756296fe552fb45b0b",
"reference": "4cd2e3ea301aadd76a4172756296fe552fb45b0b",
"shasum": ""
},
"require": {
@@ -1033,7 +1033,7 @@
"suggest": {
"symfony/console": "For validating YAML files using the lint command"
},
"time": "2023-02-21T19:46:44+00:00",
"time": "2023-04-23T19:33:36+00:00",
"bin": [
"Resources/bin/yaml-lint"
],
@@ -1064,7 +1064,7 @@
"description": "Loads and dumps YAML files",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/yaml/tree/v5.4.21"
"source": "https://github.com/symfony/yaml/tree/v5.4.23"
},
"funding": [
{

View File

@@ -1,8 +1,8 @@
<?php return array(
'root' => array(
'name' => 'getkirby/cms',
'pretty_version' => '3.9.4',
'version' => '3.9.4.0',
'pretty_version' => '3.9.5',
'version' => '3.9.5.0',
'reference' => NULL,
'type' => 'kirby-cms',
'install_path' => __DIR__ . '/../../',
@@ -11,9 +11,9 @@
),
'versions' => array(
'claviska/simpleimage' => array(
'pretty_version' => '4.0.2',
'version' => '4.0.2.0',
'reference' => '226d507cca0c8400d69bee7eb324158e3cbe246e',
'pretty_version' => '4.0.5',
'version' => '4.0.5.0',
'reference' => 'b25690f0fc25b2f0b91731370465a3b4e52ea587',
'type' => 'library',
'install_path' => __DIR__ . '/../claviska/simpleimage',
'aliases' => array(),
@@ -38,8 +38,8 @@
'dev_requirement' => false,
),
'getkirby/cms' => array(
'pretty_version' => '3.9.4',
'version' => '3.9.4.0',
'pretty_version' => '3.9.5',
'version' => '3.9.5.0',
'reference' => NULL,
'type' => 'kirby-cms',
'install_path' => __DIR__ . '/../../',
@@ -158,9 +158,9 @@
),
),
'symfony/yaml' => array(
'pretty_version' => 'v5.4.21',
'version' => '5.4.21.0',
'reference' => '3713e20d93e46e681e51605d213027e48dab3469',
'pretty_version' => 'v5.4.23',
'version' => '5.4.23.0',
'reference' => '4cd2e3ea301aadd76a4172756296fe552fb45b0b',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/yaml',
'aliases' => array(),

View File

@@ -69,9 +69,7 @@ class Dumper
}
if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value) && false !== strpos($value, "\n") && false === strpos($value, "\r")) {
// If the first line starts with a space character, the spec requires a blockIndicationIndicator
// http://www.yaml.org/spec/1.2/spec.html#id2793979
$blockIndentationIndicator = (' ' === substr($value, 0, 1)) ? (string) $this->indentation : '';
$blockIndentationIndicator = $this->getBlockIndentationIndicator($value);
if (isset($value[-2]) && "\n" === $value[-2] && "\n" === $value[-1]) {
$blockChompingIndicator = '+';
@@ -98,9 +96,7 @@ class Dumper
$output .= sprintf('%s%s !%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', $value->getTag());
if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value->getValue()) && false !== strpos($value->getValue(), "\n") && false === strpos($value->getValue(), "\r\n")) {
// If the first line starts with a space character, the spec requires a blockIndicationIndicator
// http://www.yaml.org/spec/1.2/spec.html#id2793979
$blockIndentationIndicator = (' ' === substr($value->getValue(), 0, 1)) ? (string) $this->indentation : '';
$blockIndentationIndicator = $this->getBlockIndentationIndicator($value->getValue());
$output .= sprintf(' |%s', $blockIndentationIndicator);
foreach (explode("\n", $value->getValue()) as $row) {
@@ -145,9 +141,7 @@ class Dumper
$output = sprintf('%s!%s', $prefix ? $prefix.' ' : '', $value->getTag());
if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value->getValue()) && false !== strpos($value->getValue(), "\n") && false === strpos($value->getValue(), "\r\n")) {
// If the first line starts with a space character, the spec requires a blockIndicationIndicator
// http://www.yaml.org/spec/1.2/spec.html#id2793979
$blockIndentationIndicator = (' ' === substr($value->getValue(), 0, 1)) ? (string) $this->indentation : '';
$blockIndentationIndicator = $this->getBlockIndentationIndicator($value->getValue());
$output .= sprintf(' |%s', $blockIndentationIndicator);
foreach (explode("\n", $value->getValue()) as $row) {
@@ -163,4 +157,20 @@ class Dumper
return $output."\n".$this->dump($value->getValue(), $inline - 1, $indent, $flags);
}
private function getBlockIndentationIndicator(string $value): string
{
$lines = explode("\n", $value);
// If the first line (that is neither empty nor contains only spaces)
// starts with a space character, the spec requires a block indentation indicator
// http://www.yaml.org/spec/1.2/spec.html#id2793979
foreach ($lines as $line) {
if ('' !== trim($line, ' ')) {
return (' ' === substr($line, 0, 1)) ? (string) $this->indentation : '';
}
}
return '';
}
}