mirror of
https://github.com/typecho/typecho.git
synced 2025-03-19 17:39:42 +01:00
修正撰写slug
This commit is contained in:
parent
e3e8c149a0
commit
96d072bbdb
@ -20,12 +20,13 @@ Typecho_Widget::widget('Widget_Contents_Page_Edit')->to($page);
|
||||
<?php $permalink = Typecho_Common::url($options->routingTable['page']['url'], $options->index);
|
||||
list ($scheme, $permalink) = explode(':', $permalink, 2);
|
||||
$permalink = ltrim($permalink, '/');
|
||||
?>
|
||||
<?php if (preg_match("/\[slug:?[_0-9a-z-:]*\]/i", $permalink)):
|
||||
$permalink = preg_replace("/\[([_a-z0-9-]+)[^\]]*\]/i", "{\\1}", $permalink);
|
||||
if ($page->have()) {
|
||||
$permalink = str_replace('{cid}', $page->cid, $permalink);
|
||||
}
|
||||
$input = '<input type="text" id="slug" name="slug" autocomplete="off" value="' . htmlspecialchars($page->slug) . '" class="mono" />';
|
||||
?>
|
||||
<p class="mono url-slug"><?php echo preg_replace("/\[slug:?[_0-9a-z-:]*\]/i", $input, $permalink); ?></p>
|
||||
<?php endif; ?>
|
||||
<p class="mono url-slug"><?php echo preg_replace("/\{slug\}/i", $input, $permalink); ?></p>
|
||||
<p>
|
||||
<textarea style="height: <?php $options->editorSize(); ?>px" autocomplete="off" id="text" name="text" class="w-100 mono"><?php echo htmlspecialchars($page->text); ?></textarea>
|
||||
</p>
|
||||
|
@ -20,12 +20,17 @@ Typecho_Widget::widget('Widget_Contents_Post_Edit')->to($post);
|
||||
<?php $permalink = Typecho_Common::url($options->routingTable['post']['url'], $options->index);
|
||||
list ($scheme, $permalink) = explode(':', $permalink, 2);
|
||||
$permalink = ltrim($permalink, '/');
|
||||
?>
|
||||
<?php if (preg_match("/\[slug:?[_0-9a-z-:]*\]/i", $permalink)):
|
||||
$permalink = preg_replace("/\[([_a-z0-9-]+)[^\]]*\]/i", "{\\1}", $permalink);
|
||||
if ($post->have()) {
|
||||
$permalink = str_replace(array(
|
||||
'{cid}', '{category}', '{year}', '{month}', '{day}'
|
||||
), array(
|
||||
$post->cid, $post->category, $post->year, $post->month, $post->day
|
||||
), $permalink);
|
||||
}
|
||||
$input = '<input type="text" id="slug" name="slug" autocomplete="off" value="' . htmlspecialchars($post->slug) . '" class="mono" />';
|
||||
?>
|
||||
<p class="mono url-slug"><?php echo preg_replace("/\[slug:?[_0-9a-z-:]*\]/i", $input, $permalink); ?></p>
|
||||
<?php endif; ?>
|
||||
<p class="mono url-slug"><?php echo preg_replace("/\{slug\}/i", $input, $permalink); ?></p>
|
||||
|
||||
<p>
|
||||
<textarea style="height: <?php $options->editorSize(); ?>px" autocomplete="off" id="text" name="text" class="w-100 mono"><?php echo htmlspecialchars($post->text); ?></textarea>
|
||||
|
Loading…
x
Reference in New Issue
Block a user