Merge pull request #1 from typecho/master

同步最新
This commit is contained in:
ShingChi
2014-03-11 15:23:15 +08:00
116 changed files with 219 additions and 96 deletions
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 纯数据抽象组件
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* Typecho Blog Platform
*
+17
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* Typecho Blog Platform
*
@@ -140,6 +141,22 @@ class Widget_Abstract_Contents extends Widget_Abstract
return $this->pluginHandle(__CLASS__)->contentEx($content, $this);
}
/**
* 输出文章的第一行作为摘要
*
* @return string
*/
protected function ___summary()
{
$content = $this->content;
$parts = preg_split("/<\/\s*(?:p|blockquote|q|pre)\s*>/i", $content, 2);
if (!empty($parts)) {
$content = $parts[0] . '</p>';
}
return $content;
}
/**
* 锚点id
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 描述性数据
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 全局选项
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 用户抽象组件
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 异步调用组件
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* Typecho Blog Platform
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* Typecho Blog Platform
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 评论归档
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* Typecho Blog Platform
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 回响归档
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* Typecho Blog Platform
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 文件管理列表
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 编辑文章
*
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 文章相关文件
*
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 没有关联的文件
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 独立页面管理列表
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 编辑页面
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 独立页面列表
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 文章管理列表
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 按日期归档列表组件
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 编辑文章
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 最新文章
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 相关内容
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 相关内容
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* Typecho Blog Platform
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* Typecho Blog Platform
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 反馈提交
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* Typecho Blog Platform
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 登录动作
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 登出动作
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* Typecho Blog Platform
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* Widget_Metas_Category_Admin
+3
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 编辑分类
*
@@ -199,7 +200,9 @@ class Widget_Metas_Category_Edit extends Widget_Abstract_Metas implements Widget
$name->addRule('required', _t('必须填写分类名称'));
$name->addRule(array($this, 'nameExists'), _t('分类名称已经存在'));
$name->addRule(array($this, 'nameToSlug'), _t('分类名称无法被转换为缩略名'));
$name->addRule('xssCheck', _t('请不要在分类名称中使用特殊字符'));
$slug->addRule(array($this, 'slugExists'), _t('缩略名已经存在'));
$slug->addRule('xssCheck', _t('请不要在缩略名中使用特殊字符'));
}
if ('update' == $action) {
+25 -25
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 分类输出
*
@@ -36,12 +37,12 @@ class Widget_Metas_Category_List extends Widget_Abstract_Metas
private $_treeViewCategories = array();
/**
* _singleCategoryOptions
* _categoryOptions
*
* @var mixed
* @access private
*/
private $_singleCategoryOptions = NULL;
private $_categoryOptions = NULL;
/**
* 顶层分类
@@ -132,26 +133,24 @@ class Widget_Metas_Category_List extends Widget_Abstract_Metas
/**
* 列出分类回调
*
* @param mixed $singleCategoryOptions
* @access private
* @return void
*/
private function treeViewCategoriesCallback()
{
$singleCategoryOptions = $this->_singleCategoryOptions;
$categoryOptions = $this->_categoryOptions;
if ($this->_customTreeViewCategoriesCallback) {
return treeViewCategories($this, $singleCategoryOptions);
return treeViewCategories($this, $categoryOptions);
}
$classes = array();
if ($singleCategoryOptions->itemClass) {
if ($categoryOptions->itemClass) {
$classes[] = $singleCommentOptions->itemClass;
}
$classes[] = 'category-level-' . $this->levels;
echo '<' . $singleCategoryOptions->itemTag . ' class="'
echo '<' . $categoryOptions->itemTag . ' class="'
. implode(' ', $classes);
if ($this->levels > 0) {
@@ -163,12 +162,12 @@ class Widget_Metas_Category_List extends Widget_Abstract_Metas
echo '"><a href="' . $this->permalink . '">' . $this->name . '</a>';
if ($singleCategoryOptions->showCount) {
printf($singleCategoryOptions->countTemplate, intval($this->count));
if ($categoryOptions->showCount) {
printf($categoryOptions->countTemplate, intval($this->count));
}
if ($singleCategoryOptions->showFeed) {
printf($singleCategoryOptions->feedTemplate, $this->feedUrl);
if ($categoryOptions->showFeed) {
printf($categoryOptions->feedTemplate, $this->feedUrl);
}
if ($this->children) {
@@ -181,9 +180,9 @@ class Widget_Metas_Category_List extends Widget_Abstract_Metas
/**
* 预处理分类迭代
*
* @param array $categories
* @param array $categories
* @param array $parents
* @access private
* @return void
*/
private function levelWalkCallback(array $categories, $parents = array())
{
@@ -252,8 +251,8 @@ class Widget_Metas_Category_List extends Widget_Abstract_Metas
$this->sequence ++;
//在子评论之前输出
echo '<' . $this->_singleCategoryOptions->wrapTag . (empty($this->_singleCategoryOptions->wrapClass)
? '' : ' class="' . $this->_singleCategoryOptions->wrapClass . '"') . '>';
echo '<' . $this->_categoryOptions->wrapTag . (empty($this->_categoryOptions->wrapClass)
? '' : ' class="' . $this->_categoryOptions->wrapClass . '"') . '>';
foreach ($children as $child) {
$this->row = $child;
@@ -262,7 +261,7 @@ class Widget_Metas_Category_List extends Widget_Abstract_Metas
}
//在子评论之后输出
echo '</' . $this->_singleCategoryOptions->wrapTag . '>';
echo '</' . $this->_categoryOptions->wrapTag . '>';
$this->sequence --;
}
@@ -270,15 +269,16 @@ class Widget_Metas_Category_List extends Widget_Abstract_Metas
/**
* treeViewCategories
*
*
* @param $categoryOptions 输出选项
* @access public
* @return void
*/
public function listCategories($singleCategoryOptions = NULL)
public function listCategories($categoryOptions = NULL)
{
//初始化一些变量
$this->_singleCategoryOptions = Typecho_Config::factory($singleCategoryOptions);
$this->_singleCategoryOptions->setDefault(array(
$this->_categoryOptions = Typecho_Config::factory($categoryOptions);
$this->_categoryOptions->setDefault(array(
'wrapTag' => 'ul',
'wrapClass' => '',
'itemTag' => 'li',
@@ -290,18 +290,18 @@ class Widget_Metas_Category_List extends Widget_Abstract_Metas
));
// 插件插件接口
$this->pluginHandle()->trigger($plugged)->listCategories($this->_singleCategoryOptions, $this);
$this->pluginHandle()->trigger($plugged)->listCategories($this->_categoryOptions, $this);
if (!$plugged) {
$this->stack = $this->getCategories($this->_top);
if ($this->have()) {
echo '<' . $this->_singleCategoryOptions->wrapTag . (empty($this->_singleCategoryOptions->wrapClass)
? '' : ' class="' . $this->_singleCategoryOptions->wrapClass . '"') . '>';
echo '<' . $this->_categoryOptions->wrapTag . (empty($this->_categoryOptions->wrapClass)
? '' : ' class="' . $this->_categoryOptions->wrapClass . '"') . '>';
while ($this->next()) {
$this->treeViewCategoriesCallback();
}
echo '</' . $this->_singleCategoryOptions->wrapTag . '>';
echo '</' . $this->_categoryOptions->wrapTag . '>';
}
$this->stack = $this->_map;
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 标签云
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 标签云
*
+3
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 标签编辑
*
@@ -181,7 +182,9 @@ class Widget_Metas_Tag_Edit extends Widget_Abstract_Metas implements Widget_Inte
$name->addRule('required', _t('必须填写标签名称'));
$name->addRule(array($this, 'nameExists'), _t('标签名称已经存在'));
$name->addRule(array($this, 'nameToSlug'), _t('标签名称无法被转换为缩略名'));
$name->addRule('xssCheck', _t('请不要标签名称中使用特殊字符'));
$slug->addRule(array($this, 'slugExists'), _t('缩略名已经存在'));
$slug->addRule('xssCheck', _t('请不要在缩略名中使用特殊字符'));
}
if ('update' == $action) {
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* Typecho Blog Platform
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 全局选项
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 评论设置
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 基本设置
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 基本设置
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 文章阅读设置
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* Typecho Blog Platform
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 插件管理
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* Typecho Blog Platform
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* Typecho Blog Platform
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* Typecho Blog Platform
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 注册组件
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 安全选项组件
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 通用异步服务
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 全局统计
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* Typecho Blog Platform
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 编辑风格
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 风格文件列表
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 风格列表
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 升级动作
*
+3
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 上传动作
*
@@ -64,6 +65,7 @@ class Widget_Upload extends Widget_Abstract_Contents implements Widget_Interface
*/
private static function getSafeName(&$name)
{
$name = str_replace(array('"', '<', '>'), '', $name);
$name = str_replace('\\', '/', $name);
$name = false === strpos($name, '/') ? ('a' . $name) : str_replace('/', '/a', $name);
$info = pathinfo($name);
@@ -413,6 +415,7 @@ class Widget_Upload extends Widget_Abstract_Contents implements Widget_Interface
public function action()
{
if ($this->user->pass('contributor', true) && $this->request->isPost()) {
$this->security->protect();
if ($this->request->is('do=modify&cid')) {
$this->modify();
} else {
+5
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 当前登录用户
@@ -123,6 +124,10 @@ class Widget_User extends Typecho_Widget
->where((strpos($name, '@') ? 'mail' : 'name') . ' = ?', $name)
->limit(1));
if (empty($user)) {
return false;
}
$hashValidate = $this->pluginHandle()->trigger($hashPluggable)->hashValidate($password, $user['password']);
if (!$hashPluggable) {
$hashValidate = Typecho_Common::hashValidate($password, $user['password']);
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* Typecho Blog Platform
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 相关内容
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 编辑用户
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 编辑用户
*
+1
View File
@@ -1,4 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* Typecho Blog Platform
*