Skip to content

Commit 6ca8095

Browse files
committed
fix errors in 1.2.1
1 parent 9e914e2 commit 6ca8095

5 files changed

Lines changed: 14 additions & 56 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
default
22
Paul
33
.idea/
4-
typecho/
4+
typecho/
5+
postgres/

_includes/nav.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@
6868
</div>
6969
<div data-tab="folder">
7070
<nav class="nav flex-column nav-pills">
71-
<?php if(array_key_exists('MorechoCore', Typecho_Plugin::export()['activated'])): ?>
72-
<a class="nav-link <?php if(Typecho_Router::getPathInfo() == '/archive/')echo 'active' ?>"
73-
href="/archive/">全部文章</a>
71+
<?php if(array_key_exists('MorechoCore', Typecho_Plugin::export()['activated'])): ?>
72+
<a class="nav-link <?php if(strtolower($_SERVER['REQUEST_URI']) == '/archive/')echo 'active' ?>"
73+
href="/archive/">全部文章</a>
7474
<?php endif; ?>
7575
<?php $this->widget('Widget_Metas_Category_List')->to($categories); ?>
7676
<?php while($categories->next()): if($categories->parent == "0" && $categories->slug !== $this->options->hideCategory): ?>

archive.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
99

1010
if($this->is('tag')){
11-
$url = Typecho_Router::getPathInfo();
11+
$url = strtolower($_SERVER['REQUEST_URI']);
1212
if(substr($url, -1) == '/')$url = substr($url, 0, strlen($url)-1);
1313
if(!array_key_exists('MorechoCore', Typecho_Plugin::export()['activated']))
1414
Header("Location: ".$this->options->siteUrl.'archive.html/?tag='.trim(strrchr($url, '/'),'/'));

functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ function get_user_group($name = NULL){
173173
$profile = $db->fetchRow($db->select('group', 'uid')->from('table.users')->where('uid = ?', intval(Typecho_Cookie::get('__typecho_uid'))));
174174
else
175175
$profile = $db->fetchRow($db->select('group', 'name', 'screenName')->from('table.users')->where('name=? OR screenName=?', $name, $name));
176-
if(sizeof($profile) == 0) return isset($options->groupTitleV) ? $options->groupTitleV: '';
176+
if(empty($profile)) return isset($options->groupTitleV) ? $options->groupTitleV: '';
177177
return $profile['group'];
178178
}
179179

plugins/MorechoCore/Plugin.php

Lines changed: 7 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ public static function activate()
2727
{
2828
Helper::addRoute('Morecho_archive_page', '/archive/', 'Widget_Archive', 'render');
2929
Typecho_Plugin::factory('Widget_Archive')->handle = array('MorechoCore_Plugin', 'archive');
30-
Typecho_Plugin::factory('admin/header.php')->header = array('MorechoCore_Plugin', 'header');
31-
Typecho_Plugin::factory('admin/footer.php')->end = array('MorechoCore_Plugin', 'footer');
32-
Typecho_Plugin::factory('Widget_Abstract_Contents')->markdown = array('MorechoCore_Plugin', 'markdown');
33-
Typecho_Plugin::factory('Widget_Abstract_Comments')->markdown = array('MorechoCore_Plugin', 'markdown_safemod');
34-
Typecho_Plugin::factory('admin/editor-js.php')->markdownEditor = array('MorechoCore_Plugin', 'markdown_editor');
35-
Typecho_Plugin::factory('admin/write-post.php')->richEditor = array('MorechoCore_Plugin', 'editor');
36-
Typecho_Plugin::factory('admin/write-page.php')->richEditor = array('MorechoCore_Plugin', 'editor');
30+
//Typecho_Plugin::factory('admin/header.php')->header = array('MorechoCore_Plugin', 'header');
31+
//Typecho_Plugin::factory('admin/footer.php')->end = array('MorechoCore_Plugin', 'footer');
32+
//Typecho_Plugin::factory('Widget_Abstract_Contents')->markdown = array('MorechoCore_Plugin', 'markdown');
33+
//Typecho_Plugin::factory('Widget_Abstract_Comments')->markdown = array('MorechoCore_Plugin', 'markdown_safemod');
34+
//Typecho_Plugin::factory('admin/editor-js.php')->markdownEditor = array('MorechoCore_Plugin', 'markdown_editor');
35+
//Typecho_Plugin::factory('admin/write-post.php')->richEditor = array('MorechoCore_Plugin', 'editor');
36+
//Typecho_Plugin::factory('admin/write-page.php')->richEditor = array('MorechoCore_Plugin', 'editor');
3737
}
3838

3939
/**
@@ -113,49 +113,6 @@ public static function footer()
113113
$options = Helper::options();
114114
echo '<script src="'.$options->pluginUrl.'/MorechoCore/script.js"></script>';
115115
}
116-
117-
/**
118-
* 使用 Parsedown 解析
119-
*
120-
* @access public
121-
* @return void
122-
*/
123-
public static function markdown($text)
124-
{
125-
require_once dirname(__FILE__) . '/ParsedownExtend.php';
126-
return ParsedownExtend::instance()
127-
->setBreaksEnabled(true)
128-
->text($text);
129-
}
130-
131-
/**
132-
* 使用 Parsedown 解析(开启安全模式)
133-
*
134-
* @access public
135-
* @return void
136-
*/
137-
public static function markdown_safemod($text)
138-
{
139-
require_once dirname(__FILE__) . '/ParsedownExtend.php';
140-
return ParsedownExtend::instance()
141-
->setSafeMode(true)
142-
->setBreaksEnabled(true)
143-
->text($text);
144-
}
145-
146-
/**
147-
* 修改markdown编辑器
148-
*
149-
* @access public
150-
* @return void
151-
*/
152-
public static function editor($page)
153-
{
154-
Typecho_Widget::widget('Widget_Options')->to($options);
155-
list($prefixVersion, $suffixVersion) = explode('/', $options->version);
156-
$options->theme_folder_name = Typecho_Widget::widget('Widget_Options')->plugin('MorechoCore')->theme_folder_name;
157-
require dirname(__FILE__) . '/editor-js.php';
158-
}
159116

160117
/**
161118
* archive页面支持

0 commit comments

Comments
 (0)