修正撰写slug
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user