Skip to content

Commit ee71ff6

Browse files
committed
修复插件 ThemeDemo 子路径模式不可用问题
1 parent da36e55 commit ee71ff6

2 files changed

Lines changed: 16 additions & 15 deletions

File tree

ThemeDemo/Plugin.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* 模板预览插件 【<a href="https://github.com/typecho-fans/plugins" target="_blank">TF</a>社区维护版】
55
*
66
* @package ThemeDemo
7-
* @author ShingChi, doudou
8-
* @version 1.2.1
7+
* @author ShingChi, doudou, hongweipeng
8+
* @version 1.2.2
99
* @link https://github.com/typecho-fans/plugins/tree/master/ThemeDemo
1010
*/
1111
/**
@@ -82,7 +82,7 @@ public static function personalConfig(Typecho_Widget_Helper_Form $form){}
8282

8383
/**
8484
* 输出导航条并配置路由表
85-
*
85+
*
8686
* @access public
8787
* @return void
8888
*/
@@ -119,10 +119,10 @@ public static function setMode(){
119119

120120
//配置路由表
121121
if ($settings->mode == 'cookie') {
122-
return;
122+
return;
123123
}
124124
$routes = $options->routingTable;
125-
$pathinfo = Typecho_Router::getPathInfo();
125+
$pathinfo = Typecho_Request::getInstance()->getPathInfo();
126126
if (preg_match('([^/]+)', $pathinfo, $matches)) {
127127
if (!self::check($matches[0])) return;
128128
} else {
@@ -199,10 +199,10 @@ public static function setTheme($widget)
199199

200200
/** 配置模版信息 */
201201
if (!empty($themeInfo['config'])) {
202-
$options->{'theme:' . $themeName} = $themeInfo['config'];
203-
foreach (unserialize($themeInfo['config']) as $row => $value) {
204-
$options->{$row} = $value;
205-
}
202+
$options->{'theme:' . $themeName} = $themeInfo['config'];
203+
foreach (unserialize($themeInfo['config']) as $row => $value) {
204+
$options->{$row} = $value;
205+
}
206206
}
207207

208208
/** 配置模版 */
@@ -249,4 +249,4 @@ public static function themeInfo($themeName)
249249

250250
return array('theme' => $themeName, 'config' => isset($config) ? $config : '');
251251
}
252-
}
252+
}

ThemeDemo/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<img src="https://typecho-fans.github.io/text-logo.svg" alt="TF Logo" title="Typecho Fans开源作品社区" align="right" height="100" />
33
</a>
44

5-
ThemeDemo v1.2.1 - 社区维护版
5+
ThemeDemo v1.2.2 - 社区维护版
66
======================
77
<h4 align="center">—— 多主题外观切换演示插件,支持Cookie参数或子路径双模式,可显示导航条。</h4>
88

@@ -37,7 +37,8 @@ ThemeDemo v1.2.1 - 社区维护版
3737
</table>
3838

3939
## 版本历史
40-
40+
* v1.2.2 (25-07-23) [@hongweipeng](https://github.com/hongweipeng)
41+
* 修复子路径模式无法使用问题;
4142
* v1.2.1 (20-07-19 [@jzwalk](https://github.com/jzwalk))
4243
* 综合之前所有衍生版本功能:
4344
* 集成Cookie与子路径双模式,增加切换选项;
@@ -60,9 +61,9 @@ ThemeDemo v1.2.1 - 社区维护版
6061

6162
## 贡献作者
6263

63-
[![jzwalk](https://avatars1.githubusercontent.com/u/252331?v=3&s=100)](https://github.com/jzwalk) | [![shingchi](https://avatars1.githubusercontent.com/u/1904614?v=3&s=100)](https://github.com/shingchi) | [![doudoutime](https://avatars1.githubusercontent.com/u/1299098?v=3&s=100)](https://github.com/doudoutime)
64-
:---:|:---:|:---:
65-
[jzwalk](https://github.com/jzwalk) (2020) | [shingchi](https://github.com/shingchi) (2014) | [doudoutime](https://github.com/doudoutime) (2012)
64+
[![jzwalk](https://avatars1.githubusercontent.com/u/7546325?v=3&s=100)](https://github.com/hongweipeng) | [![jzwalk](https://avatars1.githubusercontent.com/u/252331?v=3&s=100)](https://github.com/jzwalk) | [![shingchi](https://avatars1.githubusercontent.com/u/1904614?v=3&s=100)](https://github.com/shingchi) | [![doudoutime](https://avatars1.githubusercontent.com/u/1299098?v=3&s=100)](https://github.com/doudoutime)
65+
:---:|:---:|:---:|:---:
66+
[hongweipeng](https://github.com/hongweipeng) (2025) | [jzwalk](https://github.com/jzwalk) (2020) | [shingchi](https://github.com/shingchi) (2014) | [doudoutime](https://github.com/doudoutime) (2012)
6667

6768
## 附注/链接
6869

0 commit comments

Comments
 (0)