Update (view): redesign

This commit is contained in:
2023-10-05 00:29:23 +08:00
parent f1f02bb7b6
commit 7374d66a21
14 changed files with 104 additions and 49 deletions

View File

@@ -1,5 +1,6 @@
<?php
use GrahamCampbell\Markdown\Facades\Markdown;
use Illuminate\Support\Str;
if (! function_exists('epoch_now_timestamp')) {
@@ -9,6 +10,27 @@ function epoch_now_timestamp()
}
}
if (! function_exists('read_duration')) {
function read_duration($text)
{
return Str::readDuration($text);
}
}
if (! function_exists('plain_text')) {
function plain_text($content)
{
return trim(preg_replace('/\s\s+/', ' ', strip_tags($content)));
}
}
if (! function_exists('markdown_min_read')) {
function markdown_min_read($markdown)
{
return read_duration(plain_text(Markdown::convert($markdown)->getContent()));
}
}
if (! function_exists('unslug')) {
function unslug($slug, $delimiter = '-')
{