不填写时采用默认图片' ); $layout->addItem($thumb); $desc = new Typecho_Widget_Helper_Form_Element_Text( 'desc', NULL, NULL, 'SEO描述', '用于填写文章或独立页面的SEO描述,如果不填写则没有' ); $layout->addItem($desc); $keywords = new Typecho_Widget_Helper_Form_Element_Text( 'keywords', NULL, NULL, 'SEO关键词', '用于填写文章或独立页面的SEO关键词,如果不填写则没有' ); $layout->addItem($keywords); $showTimeWarning = new Typecho_Widget_Helper_Form_Element_Select( 'showTimeWarning', array( 'on' => '开启(默认)', 'off' => '关闭' ), 'on', '是否开启当前页面的文章过期警告', '用于单独设置当前文章的过期警告
仅在文章内作用,独立页面无需改动
' ); $layout->addItem($showTimeWarning); $ShowReward = new Typecho_Widget_Helper_Form_Element_Select('ShowReward', array( 'off' => '关闭(默认)', 'show' => '开启打赏', ), 'off', '是否开启文章打赏', '介绍:开启此功能需要在主题设置中添加二维码图片' ); $layout->addItem($ShowReward); $ShowToc = new Typecho_Widget_Helper_Form_Element_Select('ShowToc', array( 'show' => '开启(默认)', 'off' => '关闭', ), 'show', '是否显示文章目录', '介绍:或许有的文章不需要目录功能,默认是开启的,一般不需要设置' ); $layout->addItem($ShowToc); $CopyRight = new Typecho_Widget_Helper_Form_Element_Select('CopyRight', array( 'on' => ' CC BY-NC-SA 4.0(默认)', 'off' => '禁止转载', ), 'on', '文章版权说明', '介绍:默认为CC BY-NC-SA 4.0' ); $layout->addItem($CopyRight); } // 新文章缩略图 function get_ArticleThumbnail($widget){ // 当文章无图片时的随机缩略图 // $rand = mt_rand(1, 26); // 随机 1-9 张缩略图 // // 缩略图加速 // $rand_url; // if(!empty(Helper::options()->articleImgSpeed)){ // $rand_url = Helper::options()->articleImgSpeed; // }else { // $rand_url = $widget->widget('Widget_Options')->themeUrl . '/images/articles/'; // } // $random = $rand_url . $rand . '.jpg'; // 随机缩略图路径 // $random = 'https://static01.imgkr.com/temp/517e5d14c312427dbf93304563869279.png'; // $attach = $widget->attachments(1)->attachment; $random = '/usr/themes/butterfly/img/DefualtThumbnail.jpg'; $pattern = '/\
- '."\n";
} else {
$to_depth2 = ($to_depth > ($prev_depth - $catalog_depth)) ? ($prev_depth - $catalog_depth) : $to_depth;
if ($to_depth2) {
for ($i=0; $i<$to_depth2; $i++) {
$index .= ''."\n".'
\[tabs\](.*?)\[\/tabs\]<\/p>/ism', function ($text) {
return '[tabs]' . $text[1] . '[/tabs]';
}, $text);
$text = preg_replace_callback('/\[tabs\](.*?)\[\/tabs\]/ism', function ($text) {
return preg_replace('~ ' . $text[2] . ' ' . $text[3] . '' . $text[1] . '
", $text[6]);
for($i=0;$i