本文整理汇总了PHP中Typecho_Common::cutParagraph方法的典型用法代码示例。如果您正苦于以下问题:PHP Typecho_Common::cutParagraph方法的具体用法?PHP Typecho_Common::cutParagraph怎么用?PHP Typecho_Common::cutParagraph使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Typecho_Common
的用法示例。
在下文中一共展示了Typecho_Common::cutParagraph方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ___content
/**
* 获取文章内容
*
* @access protected
* @return string
*/
protected function ___content()
{
if ($this->hidden) {
return $this->text;
}
$content = $this->pluginHandle(__CLASS__)->trigger($plugged)->content($this->text, $this);
if (!$plugged) {
$content = $this->isMarkdown ? MarkdownExtraExtended::defaultTransform($content) : Typecho_Common::cutParagraph($content);
}
return $this->pluginHandle(__CLASS__)->contentEx($content, $this);
}
示例2: TsinaSync
/**
* 同步文章到新浪微博
*
* @access public
* @param $content $class
* @return status
*/
public static function TsinaSync($content, $class)
{
//获取插件的配置
$config = self::getWeiboSyncCfg();
//如果不是文章编辑(对象$class属于Widget_Abstract_Contents,是否等于对象的值Widget_Contents_Post_Edit,它继承Widget_Abstract_Contents对象),则直接返回内容
if (!is_a($class, 'Widget_Contents_Post_Edit')) {
return $content;
}
if ($config->sina_mode == '1') {
if (!$class->request->is("do=publish") || $class->request->is("do=publish") && !$class->have()) {
return $content;
}
} else {
if (!$class->request->is("do=publish") || $class->request->is("do=publish") && !empty($class->request->cid)) {
return $content;
}
}
$format = $config->sina_format ? $config->sina_format : '我在TypeCodes上发表了一篇文章《{title}》,链接地址{link}';
$title = $content['title'];
$link = self::SinaShortUrl($content['permalink']);
//如果插件配置中出现了{more}标签,即需要提取文章的摘要信息
if (strpos($format, '{more}') !== false) {
if (strpos($content['text'], '<!--more-->') !== false) {
$more_t = explode('<!--more-->', $content['text']);
list($more) = $more_t;
$more = Typecho_Common::fixHtml(Typecho_Common::cutParagraph($more));
$more = Typecho_Common::subStr(strip_tags($more), 0, 60, '...');
} else {
$more = $content['text'];
$more = Typecho_Common::fixHtml(Typecho_Common::cutParagraph($more));
$more = Typecho_Common::subStr(strip_tags($more), 0, 60, '...');
}
} else {
$more = "";
}
$search = array('{title}', '{link}', '{more}');
$replace = array($title, $link, $more);
$format = str_replace($search, $replace, $format);
$post_img = '';
if ($config->sina_imgflag) {
$content_substr = mb_substr($content['text'], 0, 900, 'utf-8');
if (preg_match('/!\\[[^\\]]*]\\((https):\\/\\/[^\\)]*\\.(png|jpg)(.*)\\)/i', $content_substr, $img_match)) {
if (preg_match('/(https:\\/\\/)[^>]*?\\.(png|jpg)/i', $img_match[0], $img_match_retult)) {
$post_img = $img_match_retult[0];
}
}
}
self::PostWeibo($format, $post_img);
return $content;
}
示例3: ___content
/**
* 获取文章内容
*
* @access protected
* @return string
*/
protected function ___content()
{
$content = $this->pluginHandle(__CLASS__)->trigger($plugged)->content($this->text, $this);
if (!$plugged) {
$content = Typecho_Common::cutParagraph($content);
}
return $this->pluginHandle(__CLASS__)->contentEx($content, $this);
}
示例4: ___content
/**
* 获取当前评论内容
*
* @access protected
* @return string
*/
protected function ___content()
{
$text = $this->parentContent['hidden'] ? _t('内容被隐藏') : $this->text;
$text = $this->pluginHandle(__CLASS__)->trigger($plugged)->content($text, $this);
if (!$plugged) {
$text = Typecho_Common::cutParagraph($text);
}
return $this->pluginHandle(__CLASS__)->contentEx($text, $this);
}
示例5: ___content
/**
* 获取当前评论内容
*
* @access protected
* @return string
*/
protected function ___content()
{
$text = $this->parentContent['hidden'] ? _t('内容被隐藏') : $this->text;
$text = $this->pluginHandle(__CLASS__)->trigger($plugged)->content($text, $this);
if (!$plugged) {
$text = $this->options->commentsMarkdown ? MarkdownExtraExtended::defaultTransform($text) : Typecho_Common::cutParagraph($text);
}
$text = $this->pluginHandle(__CLASS__)->contentEx($text, $this);
return Typecho_Common::stripTags($text, '<p><br>' . $this->options->commentsHTMLTagAllowed);
}
示例6: preview
/**
* 稿件预览
*
* @access public
* @return void
*/
public function preview()
{
$cid = $this->request->filter('int')->cid;
$resource = $this->_db->query($this->_db->select('text')->from('table.contribute')->where('cid = ?', $cid)->limit(1));
$result = $this->_db->fetchRow($resource);
$content = $result['text'];
$isMarkdown = strpos($content, '<!--markdown-->');
if (false !== $isMarkdown) {
$content = str_replace('<!--markdown-->', '', $content);
$content = MarkdownExtraExtended::defaultTransform($content);
} else {
$content = Typecho_Common::cutParagraph($content);
}
echo $content;
}