Skip to content

Commit

Permalink
新增 列表页解析开关
Browse files Browse the repository at this point in the history
以解决 文章过多 导致解析耗时严重 问题
  • Loading branch information
fghrsh committed Apr 27, 2017
1 parent ee4cd6c commit 7cbc35d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
8 changes: 6 additions & 2 deletions include.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ function APlayer_Filter_Plugin_ViewPost_Template(&$template) {
function APlayer_Filter_Plugin_ViewList_Template(&$template) {
global $APlayer;
global $zbp;
$articles = $template->GetTags('articles');
foreach($articles as $article) { $article->Intro = $APlayer->parseCallback($article->Intro, $zbp->Config('APlayer')); }
$config = $zbp->Config('APlayer');
if ($config->parselist) {
$articles = $template->GetTags('articles');
foreach($articles as $article) $article->Intro = $APlayer->parseCallback($article->Intro, $config);
}
}

function APlayer_Filter_Plugin_Zbp_MakeTemplatetags() {
Expand All @@ -39,6 +42,7 @@ function InstallPlugin_APlayer() {
$zbp->Config('APlayer')->mode = 1;
$zbp->Config('APlayer')->preload = 0;
$zbp->Config('APlayer')->mix = 1;
$zbp->Config('APlayer')->parselist = 0;
$zbp->SaveConfig('APlayer');
}
}
Expand Down
11 changes: 9 additions & 2 deletions main.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
$narrow = in_array('narrow', $options) ? 1 : 0;
$autoplay = in_array('autoplay', $options) ? 1 : 0;
$mix = in_array('mix', $options) ? 1 : 0;
$parselist = in_array('parselist', $options) ? 1 : 0;
if ($narrow != $zbp->Config('APlayer')->narrow) {
$zbp->Config('APlayer')->narrow = $narrow;
$tips .= '设置已应用;';
Expand Down Expand Up @@ -50,6 +51,10 @@
$zbp->Config('APlayer')->mix = $mix;
$tips .= '设置已应用;';
}
if ($parselist != $zbp->Config('APlayer')->parselist) {
$zbp->Config('APlayer')->parselist = $parselist;
$tips .= '设置已应用;';
}
$zbp->SaveConfig('APlayer');

if (!empty($tips)) {
Expand Down Expand Up @@ -80,7 +85,8 @@
'theme' => $zbp->Config('APlayer')->theme,
'mode' => $zbp->Config('APlayer')->mode,
'preload' => $zbp->Config('APlayer')->preload,
'mix' => $zbp->Config('APlayer')->mix
'mix' => $zbp->Config('APlayer')->mix,
'parselist' => $zbp->Config('APlayer')->parselist
);
?>
<tr>
Expand Down Expand Up @@ -111,7 +117,8 @@
简洁模式&nbsp;<input type="checkbox" name="options[]" value="narrow" <?php if($config['narrow']==1){echo 'checked="checked"';} ?>/>&nbsp;&nbsp;
自动播放&nbsp;<input type="checkbox" name="options[]" value="autoplay" <?php if($config['autoplay']==1){echo 'checked="checked"';} ?>/>&nbsp;&nbsp;
静音其他实例&nbsp;<input type="checkbox" name="options[]" value="mutex" <?php if($config['mutex']==1){echo 'checked="checked"';} ?>/>&nbsp;&nbsp;
获取歌词翻译(如有)&nbsp;<input type="checkbox" name="options[]" value="mix" <?php if($config['mix']==1){echo 'checked="checked"';} ?>/>&nbsp;&nbsp;
获取歌词翻译&nbsp;<input type="checkbox" name="options[]" value="mix" <?php if($config['mix']==1){echo 'checked="checked"';} ?>/>&nbsp;&nbsp;
解析列表页标签&nbsp;<input type="checkbox" name="options[]" value="parselist" <?php if($config['parselist']==1){echo 'checked="checked"';} ?>/>&nbsp;&nbsp;
</p>
<p align="left">---------------------------------------------------------</p>
<p align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Expand Down
4 changes: 2 additions & 2 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
<adapted>140614</adapted>
<version>1.3</version>
<pubdate>2016-06-02</pubdate>
<modified>2017-04-21</modified>
<modified>2017-04-24</modified>
<price>0</price>
<phpver>5.2</phpver>
<advanced>
<dependency></dependency>
<rewritefunctions></rewritefunctions>
<existsfunctions></existsfunctions>
<existsfunctions>curl_init</existsfunctions>
<conflict></conflict>
</advanced>
<sidebars>
Expand Down

0 comments on commit 7cbc35d

Please sign in to comment.