Skip to content

Commit

Permalink
支持typecho1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jrotty authored Dec 30, 2023
1 parent 10d2d9e commit a12ba7e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Keywords/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* @package Keywords
* @author 羽中
* @version 1.0.8
* @version 1.0.9
* @dependence 13.12.12-*
* @link http://www.yzmb.me/archives/net/keywords-for-typecho
*/
Expand Down Expand Up @@ -48,11 +48,11 @@ public static function config(Typecho_Widget_Helper_Form $form)
$keywords->input->setAttribute('style','max-width:400px;height:150px;');
$form->addInput($keywords);

$autolink = new Typecho_Widget_Helper_Form_Element_Checkbox('autolink',array('catslink'=>_t('分类名称'),'tagslink'=>_t('标签名称')),NULL,_t('自动内链'),_t('将与分类/标签名相同的词替换为分类/标签页链接'));
$autolink = new Typecho_Widget_Helper_Form_Element_Checkbox('autolink',array('catslink'=>_t('分类名称'),'tagslink'=>_t('标签名称')),[],_t('自动内链'),_t('将与分类/标签名相同的词替换为分类/标签页链接'));
$form->addInput($autolink);

$nofollow = new Typecho_Widget_Helper_Form_Element_Checkbox('nofollow',
array(1=>_t('nofollow标记')),NULL,_t('内链设置'));
array(1=>_t('nofollow标记')),[],_t('内链设置'));
$form->addInput($nofollow);

$blank = new Typecho_Widget_Helper_Form_Element_Select('blank',
Expand Down Expand Up @@ -102,7 +102,8 @@ public static function kwparse($content,$widget,$lastResult)
$txt = trim($row['0']);
if ($txt) {
$link = trim($row['1']);
$set = trim($row['2']);
$set = '';
if(isset($row['2'])){$set = trim($row['2']);}
$rel = '';
$open = '_blank';

Expand Down Expand Up @@ -147,7 +148,6 @@ private static function keywords()
$kwarray[] = explode('|',$kwset);
}
}

if ($autolink) {
$db = Typecho_Db::get();
$nofollow = $settings->nofollow ? 'n' : '';
Expand All @@ -156,7 +156,7 @@ private static function keywords()
if (in_array('catslink',$autolink)) {
$catselect = $db->select()->from('table.metas')->where('type = ?','category');
$catdata = $db->fetchAll($catselect,array(Typecho_Widget::widget('Widget_Abstract_Metas'),'filter'));

//并入分类链接
$cats = array();
foreach ($catdata as $cat) {
Expand Down Expand Up @@ -198,4 +198,4 @@ private static function lsort($a,$b) {
return strlen($a['0'])<strlen($b['0']) ? 1 : -1;
}

}
}

0 comments on commit a12ba7e

Please sign in to comment.