mirror of
https://github.com/typecho/typecho.git
synced 2025-01-17 20:48:42 +01:00
parent
31a59be5e6
commit
e3095acfc3
@ -141,6 +141,22 @@ class Widget_Abstract_Contents extends Widget_Abstract
|
||||
return $this->pluginHandle(__CLASS__)->contentEx($content, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 输出文章的第一行作为摘要
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function ___summary()
|
||||
{
|
||||
$content = $this->content;
|
||||
$parts = preg_split("/<\/\s*(?:p|blockquote|q|pre)\s*>/i", $content, 2);
|
||||
if (!empty($parts)) {
|
||||
$content = $parts[0] . '</p>';
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* 锚点id
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user