Upgrade to 4.0.0
This commit is contained in:
@@ -4,6 +4,7 @@ use Kirby\Cms\App;
|
||||
use Kirby\Cms\File;
|
||||
use Kirby\Cms\Helpers;
|
||||
use Kirby\Cms\Html;
|
||||
use Kirby\Cms\ModelWithContent;
|
||||
use Kirby\Cms\Page;
|
||||
use Kirby\Cms\Pages;
|
||||
use Kirby\Cms\Response;
|
||||
@@ -12,6 +13,7 @@ use Kirby\Cms\Url;
|
||||
use Kirby\Filesystem\Asset;
|
||||
use Kirby\Filesystem\F;
|
||||
use Kirby\Http\Router;
|
||||
use Kirby\Image\QrCode;
|
||||
use Kirby\Template\Slot;
|
||||
use Kirby\Template\Snippet;
|
||||
use Kirby\Toolkit\Date;
|
||||
@@ -195,10 +197,8 @@ if (Helpers::hasOverride('go') === false) { // @codeCoverageIgnore
|
||||
/**
|
||||
* Redirects to the given Urls
|
||||
* Urls can be relative or absolute.
|
||||
*
|
||||
* @todo Change return type to `never` once support for PHP 8.0 is dropped
|
||||
*/
|
||||
function go(string $url = '/', int $code = 302): void
|
||||
function go(string $url = '/', int $code = 302): never
|
||||
{
|
||||
Response::go($url, $code);
|
||||
}
|
||||
@@ -434,6 +434,20 @@ if (Helpers::hasOverride('params') === false) { // @codeCoverageIgnore
|
||||
}
|
||||
}
|
||||
|
||||
if (Helpers::hasOverride('qr') === false) { // @codeCoverageIgnore
|
||||
/**
|
||||
* Creates a QR code object
|
||||
*/
|
||||
function qr(string|ModelWithContent $data): QrCode
|
||||
{
|
||||
if ($data instanceof ModelWithContent) {
|
||||
$data = $data->url();
|
||||
}
|
||||
|
||||
return new QrCode($data);
|
||||
}
|
||||
}
|
||||
|
||||
if (Helpers::hasOverride('r') === false) { // @codeCoverageIgnore
|
||||
/**
|
||||
* Smart version of return with an if condition as first argument
|
||||
@@ -588,25 +602,6 @@ if (Helpers::hasOverride('tt') === false) { // @codeCoverageIgnore
|
||||
}
|
||||
}
|
||||
|
||||
if (Helpers::hasOverride('twitter') === false) { // @codeCoverageIgnore
|
||||
/**
|
||||
* Builds a Twitter link
|
||||
*/
|
||||
function twitter(
|
||||
string $username,
|
||||
string|null $text = null,
|
||||
string|null $title = null,
|
||||
string|null $class = null
|
||||
): string {
|
||||
return App::instance()->kirbytag([
|
||||
'twitter' => $username,
|
||||
'text' => $text,
|
||||
'title' => $title,
|
||||
'class' => $class
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
if (Helpers::hasOverride('u') === false) { // @codeCoverageIgnore
|
||||
/**
|
||||
* Shortcut for url()
|
||||
@@ -647,8 +642,11 @@ if (Helpers::hasOverride('video') === false) { // @codeCoverageIgnore
|
||||
* videos. The embed Urls are automatically detected from
|
||||
* the given Url.
|
||||
*/
|
||||
function video(string $url, array $options = [], array $attr = []): string|null
|
||||
{
|
||||
function video(
|
||||
string $url,
|
||||
array $options = [],
|
||||
array $attr = []
|
||||
): string|null {
|
||||
return Html::video($url, $options, $attr);
|
||||
}
|
||||
}
|
||||
@@ -657,8 +655,11 @@ if (Helpers::hasOverride('vimeo') === false) { // @codeCoverageIgnore
|
||||
/**
|
||||
* Embeds a Vimeo video by URL in an iframe
|
||||
*/
|
||||
function vimeo(string $url, array $options = [], array $attr = []): string|null
|
||||
{
|
||||
function vimeo(
|
||||
string $url,
|
||||
array $options = [],
|
||||
array $attr = []
|
||||
): string|null {
|
||||
return Html::vimeo($url, $options, $attr);
|
||||
}
|
||||
}
|
||||
@@ -679,8 +680,11 @@ if (Helpers::hasOverride('youtube') === false) { // @codeCoverageIgnore
|
||||
/**
|
||||
* Embeds a Youtube video by URL in an iframe
|
||||
*/
|
||||
function youtube(string $url, array $options = [], array $attr = []): string|null
|
||||
{
|
||||
function youtube(
|
||||
string $url,
|
||||
array $options = [],
|
||||
array $attr = []
|
||||
): string|null {
|
||||
return Html::youtube($url, $options, $attr);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user