This commit is contained in:
joyqi
2024-01-02 11:16:44 +08:00
committed by GitHub
parent f3299ecb8a
commit 77aebcbd0e
7 changed files with 22 additions and 6 deletions
+8 -5
View File
@@ -33,11 +33,14 @@ $post = \Widget\Contents\Post\Edit::alloc()->prepare();
$permalink = ltrim($permalink, '/');
$permalink = preg_replace("/\[([_a-z0-9-]+)[^\]]*\]/i", "{\\1}", $permalink);
if ($post->have()) {
$permalink = str_replace([
'{cid}', '{category}', '{year}', '{month}', '{day}'
], [
$post->cid, $post->category, $post->year, $post->month, $post->day
], $permalink);
$permalink = preg_replace_callback(
"/\{(cid|category|year|month|day)\}/i",
function ($matches) use ($post) {
$key = $matches[1];
return $post->getRouterParam($key);
},
$permalink
);
}
$input = '<input type="text" id="slug" name="slug" autocomplete="off" value="' . htmlspecialchars($post->slug ?? '') . '" class="mono" />';
?>