diff --git a/README.md b/README.md
index ef4a6ad..02089c7 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,11 @@
# Castle-Typecho-Theme
MD风格单栏主题
-Version 0.2.6
+Version 0.3.0
## LICENSE
GPL V3
## 链接
Blog https://ohmyga.cn
-Docs https://castle.ohmyga.cc/ (目前还没写完)
+Docs https://castle.ohmyga.cc/ (快写完了!)
## 提示
(继续偷懒不写README)
如果觉得本主题还行的话,请给本项目一个Star吧!
diff --git a/functions.php b/functions.php
index a32f68c..84b29e4 100644
--- a/functions.php
+++ b/functions.php
@@ -1,20 +1,20 @@
addItem($PageType);
}
- /*$PSetting = new Typecho_Widget_Helper_Form_Element_Textarea('PSetting', NULL, NULL,
+ $PSetting = new Typecho_Widget_Helper_Form_Element_Textarea('PSetting', NULL, NULL,
'高级设置', '文章/独立页高级设置,如果不懂此有何用请勿填写。');
- $layout->addItem($PSetting);*/
+ $layout->addItem($PSetting);
}
function themeInit($comment) {
@@ -145,8 +145,8 @@ function themeInit($comment) {
}
/* 文章阅读次数(含Cookie) */
-function PostView($archive) {
- $cid = $archive->cid;
+function PostView($moe) {
+ $cid = $moe->cid;
$db = Typecho_Db::get();
$prefix = $db->getPrefix();
if (!array_key_exists('views', $db->fetchRow($db->select()->from('table.contents')))) {
@@ -156,7 +156,7 @@ function PostView($archive) {
}
$row = $db->fetchRow($db->select('views')->from('table.contents')->where('cid = ?', $cid));
- if ($archive->is('single')) {
+ if ($moe->is('single')) {
$views = Typecho_Cookie::get('extend_contents_views');
if(empty($views)){
$views = array();
@@ -174,8 +174,8 @@ function PostView($archive) {
}
/* 文章or页面高级设置 */
-function PSetting($type) {
- $setting = Typecho_Widget::widget("Widget_Archive")->fields->PSetting;
+function PSetting($moe, $type) {
+ $setting = $moe->fields->PSetting;
if (json_decode($setting) == null) {
$output = null;
} else {
@@ -210,6 +210,10 @@ function randPic() {
$img = array_rand($openfile);
preg_match('/\/random\/(.*).jpg/', $openfile[$img], $out);
$output = Helper::options()->siteUrl.'usr/themes/'.getTheme().'/random/'.$out[1].'.jpg';
+ }elseif ($setting == 'cdn'){
+ $output = adSetting('randPic', 'url').'?rand='.$rand;
+ }elseif ($setting == 'cdnno'){
+ $output = adSetting('randPic', 'url');
}
return $output;
}
@@ -284,6 +288,8 @@ function themeResource($content) {
$output = Helper::options()->themeUrl.'/'.$content;
}elseif ($setting == 'jsdelivr') {
$output = 'https://cdn.jsdelivr.net/gh/ohmyga233/castle-Typecho-Theme@'.themeVer('current').'/'.$content;
+ }elseif ($setting == 'cdn') {
+ $output = adSetting('resource', 'url').'/'.$content;
}
return $output;
@@ -381,10 +387,10 @@ function tcs() {
if (!empty($cookie)) {
if ($cookie == 'off') {
}else{
- setcookie('nightSwitch', 'open');
+ setcookie('nightSwitch', 'open', NULL, '/');
}
}else{
- setcookie('nightSwitch', 'open');
+ setcookie('nightSwitch', 'open', NULL, '/');
}
}
}
@@ -646,13 +652,9 @@ public static function getAdminMail(){
return $mail;
}
- static public function parseAll($content,$parseBoard=false){
- $new = self::parseBiaoQing(self::parseFancyBox(self::parseRuby($content)));
- if($parseBoard){
- return self::parseBoard($new);
- }else{
- return $new;
- }
+ static public function parseAll($content){
+ $new = self::parseBiaoQing(self::parseFancyBox(self::parseRuby(self::parseTable($content))));
+ return $new;
}
static public function parseBiaoQing($content){
@@ -690,6 +692,66 @@ static public function parseRuby($string){
$new=preg_replace($reg,$rp,$string);
return $new;
}
+
+ static public function parseTable($content){
+ $reg = '/