diff --git a/Asset/AssetType.php b/Asset/AssetType.php
index 1b8e855c7..709724e23 100755
--- a/Asset/AssetType.php
+++ b/Asset/AssetType.php
@@ -31,4 +31,6 @@ abstract class AssetType extends Enum
public const JS = 1;
public const JSLATE = 2;
+
+ public const LINK = 3;
}
diff --git a/Event/EventManager.php b/Event/EventManager.php
index e698d588b..4b1bc2779 100755
--- a/Event/EventManager.php
+++ b/Event/EventManager.php
@@ -165,14 +165,14 @@ final class EventManager implements \Countable
* @param string $id Sub-requirement for event (can be regex)
* @param mixed $data Data to pass to the callback
*
- * @return bool returns true on successfully triggering ANY event, false if NO event could be triggered which also includes sub-requirements missing
+ * @return array
*
* @since 1.0.0
*/
- public function triggerSimilar(string $group, string $id = '', mixed $data = null) : bool
+ public function triggerSimilar(string $group, string $id = '', mixed $data = null) : array
{
if (empty($this->callbacks)) {
- return false;
+ return [];
}
$groupIsRegex = \str_starts_with($group, '/');
@@ -219,14 +219,14 @@ final class EventManager implements \Countable
$data['@triggerGroup'] ??= $group;
- $triggerValue = false;
+ $result = [];
foreach ($groups as $groupName => $ids) {
foreach ($ids as $id) {
- $triggerValue = $this->trigger($groupName, $id, $data) || $triggerValue;
+ \array_merge($result, $this->trigger($groupName, $id, $data));
}
}
- return $triggerValue;
+ return $result;
}
/**
@@ -236,14 +236,14 @@ final class EventManager implements \Countable
* @param string $id Sub-requirement for event
* @param mixed $data Data to pass to the callback
*
- * @return bool returns true on successfully triggering the event, false if the event couldn't be triggered which also includes sub-requirements missing
+ * @return array
*
* @since 1.0.0
*/
- public function trigger(string $group, string $id = '', mixed $data = null) : bool
+ public function trigger(string $group, string $id = '', mixed $data = null) : array
{
if (!isset($this->callbacks[$group])) {
- return false;
+ return [];
}
if (isset($this->groups[$group])) {
@@ -251,9 +251,10 @@ final class EventManager implements \Countable
}
if ($this->hasOutstanding($group)) {
- return false;
+ return [];
}
+ $result = [];
foreach ($this->callbacks[$group]['callbacks'] as $func) {
if (\is_array($data)) {
$data['@triggerGroup'] ??= $group;
@@ -267,7 +268,7 @@ final class EventManager implements \Countable
$data['@triggerId'] = $id;
}
- $this->dispatcher->dispatch($func, ...\array_values($data));
+ \array_merge($result, $this->dispatcher->dispatch($func, ...\array_values($data)));
}
if ($this->callbacks[$group]['remove']) {
@@ -276,7 +277,7 @@ final class EventManager implements \Countable
$this->reset($group);
}
- return true;
+ return $result;
}
/**
diff --git a/Image/Kernel.php b/Image/Kernel.php
index efef83fc5..7cefab962 100755
--- a/Image/Kernel.php
+++ b/Image/Kernel.php
@@ -199,6 +199,8 @@ final class Kernel
\imagepng($im, $outPath);
} elseif (\strripos($outPath, 'jpg') !== false || \strripos($outPath, 'jpeg') !== false) {
\imagejpeg($im, $outPath);
+ } elseif (\strripos($outPath, 'webp') !== false) {
+ \imagewebp($im, $outPath);
} else {
\imagegif($im, $outPath);
}
diff --git a/Image/Skew.php b/Image/Skew.php
index 20232b9e7..7e704e593 100755
--- a/Image/Skew.php
+++ b/Image/Skew.php
@@ -115,6 +115,8 @@ final class Skew
\imagepng($im, $outPath);
} elseif (\strripos($outPath, 'jpg') !== false || \strripos($outPath, 'jpeg') !== false) {
\imagejpeg($im, $outPath);
+ } elseif (\strripos($outPath, 'webp') !== false) {
+ \imagewebp($im, $outPath);
} else {
\imagegif($im, $outPath);
}
diff --git a/Image/Thresholding.php b/Image/Thresholding.php
index bc9e69d56..a088f06cd 100755
--- a/Image/Thresholding.php
+++ b/Image/Thresholding.php
@@ -124,6 +124,8 @@ final class Thresholding
\imagepng($out, $outPath);
} elseif (\strripos($outPath, 'jpg') !== false || \strripos($outPath, 'jpeg') !== false) {
\imagejpeg($out, $outPath);
+ } elseif (\strripos($outPath, 'webp') !== false) {
+ \imagewebp($im, $outPath);
} else {
\imagegif($out, $outPath);
}
diff --git a/Model/Html/Head.php b/Model/Html/Head.php
index b3822e11e..0bec7dbc7 100755
--- a/Model/Html/Head.php
+++ b/Model/Html/Head.php
@@ -111,7 +111,7 @@ final class Head implements RenderableInterface
*/
public function addAsset(int $type, string $uri, array $attributes = []) : void
{
- $this->assets[$uri] = ['type' => $type, 'attributes' => $attributes];
+ $this->assets[] = ['uri' => $uri, 'type' => $type, 'attributes' => $attributes];
}
/**
@@ -279,9 +279,19 @@ final class Head implements RenderableInterface
public function renderAssets() : string
{
$rendered = '';
- foreach ($this->assets as $uri => $asset) {
+ foreach ($this->assets as $asset) {
if ($asset['type'] === AssetType::CSS) {
- $rendered .= ' $attribute) {
+ $rendered .= \is_string($key)
+ ? ' ' . $key . '="' . $attribute . '"'
+ : ' ' . $attribute;
+ }
+
+ $rendered .= '>';
+ } elseif ($asset['type'] === AssetType::LINK) {
+ $rendered .= ' $attribute) {
$rendered .= \is_string($key)
@@ -291,7 +301,7 @@ final class Head implements RenderableInterface
$rendered .= '>';
} elseif ($asset['type'] === AssetType::JS) {
- $rendered .= '