Upgrade to 4.5.0
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace Kirby\Cms;
|
||||
|
||||
use Kirby\Http\Url as BaseUrl;
|
||||
use Kirby\Toolkit\Str;
|
||||
|
||||
/**
|
||||
* The `Url` class extends the
|
||||
@@ -31,6 +32,26 @@ class Url extends BaseUrl
|
||||
return App::instance()->url();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a string to a safe version to be used in a URL,
|
||||
* obeying the `slugs.maxlength` option
|
||||
*
|
||||
* @param string $string The unsafe string
|
||||
* @param string $separator To be used instead of space and
|
||||
* other non-word characters.
|
||||
* @param string $allowed List of all allowed characters (regex)
|
||||
* @param int $maxlength The maximum length of the slug
|
||||
* @return string The safe string
|
||||
*/
|
||||
public static function slug(
|
||||
string $string = null,
|
||||
string $separator = null,
|
||||
string $allowed = null,
|
||||
): string {
|
||||
$maxlength = App::instance()->option('slugs.maxlength', 255);
|
||||
return Str::slug($string, $separator, $allowed, $maxlength);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an absolute Url to a template asset if it exists.
|
||||
* This is used in the `css()` and `js()` helpers
|
||||
|
Reference in New Issue
Block a user