replace with new namespace rule

This commit is contained in:
joyqi 2021-09-01 17:08:57 +08:00
parent 2fad7cc398
commit ba0bfd3551
51 changed files with 1325 additions and 1279 deletions

View File

@ -7,7 +7,7 @@ $actionUrl = $security->getTokenUrl(
\Typecho\Router::url('do', array('action' => 'backup', 'widget' => 'Backup'),
\Typecho\Common::url('index.php', $options->rootUrl)));
$backupFiles = \Typecho\Widget::widget('Widget_Backup')->listFiles();
$backupFiles = \Widget\Backup::alloc()->listFiles();
?>
<div class="main">

View File

@ -9,7 +9,7 @@ include 'menu.php';
<?php include 'page-title.php'; ?>
<div class="row typecho-page-main" role="form">
<div class="col-mb-12 col-tb-6 col-tb-offset-3">
<?php \Typecho\Widget::widget('Widget_Metas_Category_Edit')->form()->render(); ?>
<?php \Widget\Metas\Category\Edit::alloc()->form()->render(); ?>
</div>
</div>
</div>

View File

@ -20,7 +20,7 @@ if (!defined('__TYPECHO_ROOT_DIR__') && !@include_once __DIR__ . '/../config.inc
\Widget\Options::alloc()->to($options);
\Widget\User::alloc()->to($user);
\Widget\Security::alloc()->to($security);
\Typecho\Widget::widget('Widget_Menu')->to($menu);
\Widget\Menu::alloc()->to($menu);
/** 初始化上下文 */
$request = $options->request;

View File

@ -3,71 +3,71 @@
$fields = isset($post) ? $post->getFieldItems() : $page->getFieldItems();
$defaultFields = isset($post) ? $post->getDefaultFieldItems() : $page->getDefaultFieldItems();
?>
<section id="custom-field" class="typecho-post-option<?php if (empty($defaultFields) && empty($fields)): ?> fold<?php endif; ?>">
<label id="custom-field-expand" class="typecho-label"><a href="##"><i class="i-caret-right"></i> <?php _e('自定义字段'); ?></a></label>
<table class="typecho-list-table mono">
<colgroup>
<col width="25%"/>
<col width="10%"/>
<col width="55%"/>
<col width="10%"/>
</colgroup>
<?php foreach ($defaultFields as $field): ?>
<?php list ($label, $input) = $field; ?>
<tr>
<td><?php $label->render(); ?></td>
<td colspan="3"><?php $input->render(); ?></td>
</tr>
<?php endforeach; ?>
<?php foreach ($fields as $field): ?>
<tr>
<td>
<label for="fieldname" class="sr-only"><?php _e('字段名称'); ?></label>
<input type="text" name="fieldNames[]" value="<?php echo htmlspecialchars($field['name']); ?>" id="fieldname" class="text-s w-100">
</td>
<td>
<label for="fieldtype" class="sr-only"><?php _e('字段类型'); ?></label>
<select name="fieldTypes[]" id="fieldtype">
<option value="str"<?php if ('str' == $field['type']): ?> selected<?php endif; ?>><?php _e('字符'); ?></option>
<option value="int"<?php if ('int' == $field['type']): ?> selected<?php endif; ?>><?php _e('整数'); ?></option>
<option value="float"<?php if ('float' == $field['type']): ?> selected<?php endif; ?>><?php _e('小数'); ?></option>
</select>
</td>
<td>
<label for="fieldvalue" class="sr-only"><?php _e('字段值'); ?></label>
<textarea name="fieldValues[]" id="fieldvalue" class="text-s w-100" rows="2"><?php echo htmlspecialchars($field[$field['type'] . '_value']); ?></textarea>
</td>
<td>
<button type="button" class="btn btn-xs"><?php _e('删除'); ?></button>
</td>
</tr>
<?php endforeach; ?>
<?php if (empty($defaultFields) && empty($fields)): ?>
<tr>
<td>
<label for="fieldname" class="sr-only"><?php _e('字段名称'); ?></label>
<input type="text" name="fieldNames[]" placeholder="<?php _e('字段名称'); ?>" id="fieldname" class="text-s w-100">
</td>
<td>
<label for="fieldtype" class="sr-only"><?php _e('字段类型'); ?></label>
<select name="fieldTypes[]" id="fieldtype">
<option value="str"><?php _e('字符'); ?></option>
<option value="int"><?php _e('整数'); ?></option>
<option value="float"><?php _e('小数'); ?></option>
</select>
</td>
<td>
<label for="fieldvalue" class="sr-only"><?php _e('字段值'); ?></label>
<textarea name="fieldValues[]" placeholder="<?php _e('字段值'); ?>" id="fieldvalue" class="text-s w-100" rows="2"></textarea>
</td>
<td>
<button type="button" class="btn btn-xs"><?php _e('删除'); ?></button>
</td>
</tr>
<?php endif; ?>
</table>
<div class="description clearfix">
<button type="button" class="btn btn-xs operate-add"><?php _e('+添加字段'); ?></button>
<?php _e('自定义字段可以扩展你的模板功能, 使用方法参见 <a href="http://docs.typecho.org/help/custom-fields">帮助文档</a>'); ?>
</div>
</section>
<section id="custom-field" class="typecho-post-option<?php if (empty($defaultFields) && empty($fields)): ?> fold<?php endif; ?>">
<label id="custom-field-expand" class="typecho-label"><a href="##"><i class="i-caret-right"></i> <?php _e('自定义字段'); ?></a></label>
<table class="typecho-list-table mono">
<colgroup>
<col width="25%"/>
<col width="10%"/>
<col width="55%"/>
<col width="10%"/>
</colgroup>
<?php foreach ($defaultFields as $field): ?>
<?php list ($label, $input) = $field; ?>
<tr>
<td><?php $label->render(); ?></td>
<td colspan="3"><?php $input->render(); ?></td>
</tr>
<?php endforeach; ?>
<?php foreach ($fields as $field): ?>
<tr>
<td>
<label for="fieldname" class="sr-only"><?php _e('字段名称'); ?></label>
<input type="text" name="fieldNames[]" value="<?php echo htmlspecialchars($field['name']); ?>" id="fieldname" class="text-s w-100">
</td>
<td>
<label for="fieldtype" class="sr-only"><?php _e('字段类型'); ?></label>
<select name="fieldTypes[]" id="fieldtype">
<option value="str"<?php if ('str' == $field['type']): ?> selected<?php endif; ?>><?php _e('字符'); ?></option>
<option value="int"<?php if ('int' == $field['type']): ?> selected<?php endif; ?>><?php _e('整数'); ?></option>
<option value="float"<?php if ('float' == $field['type']): ?> selected<?php endif; ?>><?php _e('小数'); ?></option>
</select>
</td>
<td>
<label for="fieldvalue" class="sr-only"><?php _e('字段值'); ?></label>
<textarea name="fieldValues[]" id="fieldvalue" class="text-s w-100" rows="2"><?php echo htmlspecialchars($field[$field['type'] . '_value']); ?></textarea>
</td>
<td>
<button type="button" class="btn btn-xs"><?php _e('删除'); ?></button>
</td>
</tr>
<?php endforeach; ?>
<?php if (empty($defaultFields) && empty($fields)): ?>
<tr>
<td>
<label for="fieldname" class="sr-only"><?php _e('字段名称'); ?></label>
<input type="text" name="fieldNames[]" placeholder="<?php _e('字段名称'); ?>" id="fieldname" class="text-s w-100">
</td>
<td>
<label for="fieldtype" class="sr-only"><?php _e('字段类型'); ?></label>
<select name="fieldTypes[]" id="fieldtype">
<option value="str"><?php _e('字符'); ?></option>
<option value="int"><?php _e('整数'); ?></option>
<option value="float"><?php _e('小数'); ?></option>
</select>
</td>
<td>
<label for="fieldvalue" class="sr-only"><?php _e('字段值'); ?></label>
<textarea name="fieldValues[]" placeholder="<?php _e('字段值'); ?>" id="fieldvalue" class="text-s w-100" rows="2"></textarea>
</td>
<td>
<button type="button" class="btn btn-xs"><?php _e('删除'); ?></button>
</td>
</tr>
<?php endif; ?>
</table>
<div class="description clearfix">
<button type="button" class="btn btn-xs operate-add"><?php _e('+添加字段'); ?></button>
<?php _e('自定义字段可以扩展你的模板功能, 使用方法参见 <a href="http://docs.typecho.org/help/custom-fields">帮助文档</a>'); ?>
</div>
</section>

View File

@ -2,7 +2,7 @@
<?php
if (isset($post) && $post instanceof \Typecho\Widget && $post->have()) {
$fileParentContent = $post;
} else if (isset($page) && $page instanceof \Typecho\Widget && $page->have()) {
} elseif (isset($page) && $page instanceof \Typecho\Widget && $page->have()) {
$fileParentContent = $page;
}

View File

@ -5,9 +5,9 @@ if (isset($post) || isset($page)) {
$cid = isset($post) ? $post->cid : $page->cid;
if ($cid) {
\Typecho\Widget::widget('Widget_Contents_Attachment_Related', 'parentId=' . $cid)->to($attachment);
\Widget\Contents\Related::alloc(['parentId' => $cid])->to($attachment);
} else {
\Typecho\Widget::widget('Widget_Contents_Attachment_Unattached')->to($attachment);
\Widget\Contents\Attachment\Unattached::alloc()->to($attachment);
}
}
?>

View File

@ -21,6 +21,3 @@ $header = \Typecho\Plugin::factory('admin/header.php')->header($header);
<?php echo $header; ?>
</head>
<body<?php if (isset($bodyClass)) {echo ' class="' . $bodyClass . '"';} ?>>
<!--[if lt IE 9]>
<div class="message error browsehappy" role="dialog"><?php _e('当前网页 <strong>不支持</strong> 你正在使用的浏览器. 为了正常的访问, 请 <a href="http://browsehappy.com/">升级你的浏览器</a>'); ?>.</div>
<![endif]-->

View File

@ -3,7 +3,7 @@ include 'common.php';
include 'header.php';
include 'menu.php';
$stat = \Typecho\Widget::widget('Widget_Stat');
$stat = \Widget\Stat::alloc();
?>
<div class="main">
<div class="container typecho-dashboard">
@ -11,35 +11,40 @@ $stat = \Typecho\Widget::widget('Widget_Stat');
<div class="row typecho-page-main">
<div class="col-mb-12 welcome-board" role="main">
<p><?php _e('目前有 <em>%s</em> 篇文章, 并有 <em>%s</em> 条关于你的评论在 <em>%s</em> 个分类中.',
$stat->myPublishedPostsNum, $stat->myPublishedCommentsNum, $stat->categoriesNum); ?>
<br><?php _e('点击下面的链接快速开始:'); ?></p>
$stat->myPublishedPostsNum, $stat->myPublishedCommentsNum, $stat->categoriesNum); ?>
<br><?php _e('点击下面的链接快速开始:'); ?></p>
<ul id="start-link" class="clearfix">
<?php if($user->pass('contributor', true)): ?>
<li><a href="<?php $options->adminUrl('write-post.php'); ?>"><?php _e('撰写新文章'); ?></a></li>
<?php if($user->pass('editor', true) && 'on' == $request->get('__typecho_all_comments') && $stat->waitingCommentsNum > 0): ?>
<li><a href="<?php $options->adminUrl('manage-comments.php?status=waiting'); ?>"><?php _e('待审核的评论'); ?></a>
<span class="balloon"><?php $stat->waitingCommentsNum(); ?></span>
</li>
<?php elseif($stat->myWaitingCommentsNum > 0): ?>
<li><a href="<?php $options->adminUrl('manage-comments.php?status=waiting'); ?>"><?php _e('待审核评论'); ?></a>
<span class="balloon"><?php $stat->myWaitingCommentsNum(); ?></span>
</li>
<?php endif; ?>
<?php if($user->pass('editor', true) && 'on' == $request->get('__typecho_all_comments') && $stat->spamCommentsNum > 0): ?>
<li><a href="<?php $options->adminUrl('manage-comments.php?status=spam'); ?>"><?php _e('垃圾评论'); ?></a>
<span class="balloon"><?php $stat->spamCommentsNum(); ?></span>
</li>
<?php elseif($stat->mySpamCommentsNum > 0): ?>
<li><a href="<?php $options->adminUrl('manage-comments.php?status=spam'); ?>"><?php _e('垃圾评论'); ?></a>
<span class="balloon"><?php $stat->mySpamCommentsNum(); ?></span>
</li>
<?php endif; ?>
<?php if($user->pass('administrator', true)): ?>
<li><a href="<?php $options->adminUrl('themes.php'); ?>"><?php _e('更换外观'); ?></a></li>
<li><a href="<?php $options->adminUrl('plugins.php'); ?>"><?php _e('插件管理'); ?></a></li>
<li><a href="<?php $options->adminUrl('options-general.php'); ?>"><?php _e('系统设置'); ?></a></li>
<?php endif; ?>
<?php if ($user->pass('contributor', true)): ?>
<li><a href="<?php $options->adminUrl('write-post.php'); ?>"><?php _e('撰写新文章'); ?></a></li>
<?php if ($user->pass('editor', true) && 'on' == $request->get('__typecho_all_comments') && $stat->waitingCommentsNum > 0): ?>
<li>
<a href="<?php $options->adminUrl('manage-comments.php?status=waiting'); ?>"><?php _e('待审核的评论'); ?></a>
<span class="balloon"><?php $stat->waitingCommentsNum(); ?></span>
</li>
<?php elseif ($stat->myWaitingCommentsNum > 0): ?>
<li>
<a href="<?php $options->adminUrl('manage-comments.php?status=waiting'); ?>"><?php _e('待审核评论'); ?></a>
<span class="balloon"><?php $stat->myWaitingCommentsNum(); ?></span>
</li>
<?php endif; ?>
<?php if ($user->pass('editor', true) && 'on' == $request->get('__typecho_all_comments') && $stat->spamCommentsNum > 0): ?>
<li>
<a href="<?php $options->adminUrl('manage-comments.php?status=spam'); ?>"><?php _e('垃圾评论'); ?></a>
<span class="balloon"><?php $stat->spamCommentsNum(); ?></span>
</li>
<?php elseif ($stat->mySpamCommentsNum > 0): ?>
<li>
<a href="<?php $options->adminUrl('manage-comments.php?status=spam'); ?>"><?php _e('垃圾评论'); ?></a>
<span class="balloon"><?php $stat->mySpamCommentsNum(); ?></span>
</li>
<?php endif; ?>
<?php if ($user->pass('administrator', true)): ?>
<li><a href="<?php $options->adminUrl('themes.php'); ?>"><?php _e('更换外观'); ?></a></li>
<li><a href="<?php $options->adminUrl('plugins.php'); ?>"><?php _e('插件管理'); ?></a></li>
<li><a href="<?php $options->adminUrl('options-general.php'); ?>"><?php _e('系统设置'); ?></a>
</li>
<?php endif; ?>
<?php endif; ?>
<!--<li><a href="<?php $options->adminUrl('profile.php'); ?>"><?php _e('更新我的资料'); ?></a></li>-->
</ul>
@ -48,18 +53,18 @@ $stat = \Typecho\Widget::widget('Widget_Stat');
<div class="col-mb-12 col-tb-4" role="complementary">
<section class="latest-link">
<h3><?php _e('最近发布的文章'); ?></h3>
<?php \Typecho\Widget::widget('Widget_Contents_Post_Recent', 'pageSize=10')->to($posts); ?>
<?php \Widget\Contents\Post\Recent::alloc('pageSize=10')->to($posts); ?>
<ul>
<?php if($posts->have()): ?>
<?php while($posts->next()): ?>
<li>
<span><?php $posts->date('n.j'); ?></span>
<a href="<?php $posts->permalink(); ?>" class="title"><?php $posts->title(); ?></a>
</li>
<?php endwhile; ?>
<?php else: ?>
<li><em><?php _e('暂时没有文章'); ?></em></li>
<?php endif; ?>
<?php if ($posts->have()): ?>
<?php while ($posts->next()): ?>
<li>
<span><?php $posts->date('n.j'); ?></span>
<a href="<?php $posts->permalink(); ?>" class="title"><?php $posts->title(); ?></a>
</li>
<?php endwhile; ?>
<?php else: ?>
<li><em><?php _e('暂时没有文章'); ?></em></li>
<?php endif; ?>
</ul>
</section>
</div>
@ -68,17 +73,18 @@ $stat = \Typecho\Widget::widget('Widget_Stat');
<section class="latest-link">
<h3><?php _e('最近得到的回复'); ?></h3>
<ul>
<?php \Typecho\Widget::widget('Widget_Comments_Recent', 'pageSize=10')->to($comments); ?>
<?php if($comments->have()): ?>
<?php while($comments->next()): ?>
<li>
<span><?php $comments->date('n.j'); ?></span>
<a href="<?php $comments->permalink(); ?>" class="title"><?php $comments->author(false); ?></a>:
<?php $comments->excerpt(35, '...'); ?>
</li>
<?php endwhile; ?>
<?php \Widget\Comments\Recent::alloc('pageSize=10')->to($comments); ?>
<?php if ($comments->have()): ?>
<?php while ($comments->next()): ?>
<li>
<span><?php $comments->date('n.j'); ?></span>
<a href="<?php $comments->permalink(); ?>"
class="title"><?php $comments->author(false); ?></a>:
<?php $comments->excerpt(35, '...'); ?>
</li>
<?php endwhile; ?>
<?php else: ?>
<li><?php _e('暂时没有回复'); ?></li>
<li><?php _e('暂时没有回复'); ?></li>
<?php endif; ?>
</ul>
</section>
@ -104,46 +110,46 @@ include 'common-js.php';
?>
<script>
$(document).ready(function () {
var ul = $('#typecho-message ul'), cache = window.sessionStorage,
html = cache ? cache.getItem('feed') : '',
update = cache ? cache.getItem('update') : '';
if (!!html) {
ul.html(html);
} else {
html = '';
$.get('<?php $options->index('/action/ajax?do=feed'); ?>', function (o) {
for (var i = 0; i < o.length; i ++) {
var item = o[i];
html += '<li><span>' + item.date + '</span> <a href="' + item.link + '" target="_blank">' + item.title
+ '</a></li>';
}
$(document).ready(function () {
var ul = $('#typecho-message ul'), cache = window.sessionStorage,
html = cache ? cache.getItem('feed') : '',
update = cache ? cache.getItem('update') : '';
if (!!html) {
ul.html(html);
cache.setItem('feed', html);
}, 'json');
}
} else {
html = '';
$.get('<?php $options->index('/action/ajax?do=feed'); ?>', function (o) {
for (var i = 0; i < o.length; i++) {
var item = o[i];
html += '<li><span>' + item.date + '</span> <a href="' + item.link + '" target="_blank">' + item.title
+ '</a></li>';
}
function applyUpdate(update) {
if (update.available) {
$('<div class="update-check message error"><p>'
+ '<?php _e('您当前使用的版本是 %s'); ?>'.replace('%s', update.current) + '<br />'
+ '<strong><a href="' + update.link + '" target="_blank">'
+ '<?php _e('官方最新版本是 %s'); ?>'.replace('%s', update.latest) + '</a></strong></p></div>')
.insertAfter('.typecho-page-title').effect('highlight');
ul.html(html);
cache.setItem('feed', html);
}, 'json');
}
}
if (!!update) {
applyUpdate($.parseJSON(update));
} else {
$.get('<?php $options->index('/action/ajax?do=checkVersion'); ?>', function (o, status, resp) {
applyUpdate(o);
cache.setItem('update', resp.responseText);
}, 'json');
}
});
function applyUpdate(update) {
if (update.available) {
$('<div class="update-check message error"><p>'
+ '<?php _e('您当前使用的版本是 %s'); ?>'.replace('%s', update.current) + '<br />'
+ '<strong><a href="' + update.link + '" target="_blank">'
+ '<?php _e('官方最新版本是 %s'); ?>'.replace('%s', update.latest) + '</a></strong></p></div>')
.insertAfter('.typecho-page-title').effect('highlight');
}
}
if (!!update) {
applyUpdate($.parseJSON(update));
} else {
$.get('<?php $options->index('/action/ajax?do=checkVersion'); ?>', function (o, status, resp) {
applyUpdate(o);
cache.setItem('update', resp.responseText);
}, 'json');
}
});
</script>
<?php include 'footer.php'; ?>

View File

@ -3,27 +3,35 @@ include 'common.php';
include 'header.php';
include 'menu.php';
\Typecho\Widget::widget('Widget_Metas_Category_Admin')->to($categories);
\Widget\Metas\Category\Admin::alloc()->to($categories);
?>
<div class="main">
<div class="body container">
<?php include 'page-title.php'; ?>
<div class="row typecho-page-main manage-metas">
<div class="col-mb-12" role="main">
<form method="post" name="manage_categories" class="operate-form">
<div class="col-mb-12" role="main">
<form method="post" name="manage_categories" class="operate-form">
<div class="typecho-list-operate clearfix">
<div class="operate">
<label><i class="sr-only"><?php _e('全选'); ?></i><input type="checkbox" class="typecho-table-select-all" /></label>
<label><i class="sr-only"><?php _e('全选'); ?></i><input type="checkbox"
class="typecho-table-select-all"/></label>
<div class="btn-group btn-drop">
<button class="btn dropdown-toggle btn-s" type="button"><i class="sr-only"><?php _e('操作'); ?></i><?php _e('选中项'); ?> <i class="i-caret-down"></i></button>
<button class="btn dropdown-toggle btn-s" type="button"><i
class="sr-only"><?php _e('操作'); ?></i><?php _e('选中项'); ?> <i
class="i-caret-down"></i></button>
<ul class="dropdown-menu">
<li><a lang="<?php _e('此分类下的所有内容将被删除, 你确认要删除这些分类吗?'); ?>" href="<?php $security->index('/action/metas-category-edit?do=delete'); ?>"><?php _e('删除'); ?></a></li>
<li><a lang="<?php _e('刷新分类可能需要等待较长时间, 你确认要刷新这些分类吗?'); ?>" href="<?php $security->index('/action/metas-category-edit?do=refresh'); ?>"><?php _e('刷新'); ?></a></li>
<li><a lang="<?php _e('此分类下的所有内容将被删除, 你确认要删除这些分类吗?'); ?>"
href="<?php $security->index('/action/metas-category-edit?do=delete'); ?>"><?php _e('删除'); ?></a>
</li>
<li><a lang="<?php _e('刷新分类可能需要等待较长时间, 你确认要刷新这些分类吗?'); ?>"
href="<?php $security->index('/action/metas-category-edit?do=refresh'); ?>"><?php _e('刷新'); ?></a>
</li>
<li class="multiline">
<button type="button" class="btn merge btn-s" rel="<?php $security->index('/action/metas-category-edit?do=merge'); ?>"><?php _e('合并到'); ?></button>
<button type="button" class="btn merge btn-s"
rel="<?php $security->index('/action/metas-category-edit?do=merge'); ?>"><?php _e('合并到'); ?></button>
<select name="merge">
<?php $categories->parse('<option value="{mid}">{name}</option>'); ?>
</select>
@ -47,53 +55,63 @@ include 'menu.php';
<col width="10%" class="kit-hidden-mb"/>
</colgroup>
<thead>
<tr class="nodrag">
<th class="kit-hidden-mb"> </th>
<th><?php _e('名称'); ?></th>
<th><?php _e('子分类'); ?></th>
<th class="kit-hidden-mb"><?php _e('缩略名'); ?></th>
<th> </th>
<th class="kit-hidden-mb"><?php _e('文章数'); ?></th>
</tr>
<tr class="nodrag">
<th class="kit-hidden-mb"></th>
<th><?php _e('名称'); ?></th>
<th><?php _e('子分类'); ?></th>
<th class="kit-hidden-mb"><?php _e('缩略名'); ?></th>
<th></th>
<th class="kit-hidden-mb"><?php _e('文章数'); ?></th>
</tr>
</thead>
<tbody>
<?php if($categories->have()): ?>
<?php if ($categories->have()): ?>
<?php while ($categories->next()): ?>
<tr id="mid-<?php $categories->theId(); ?>">
<td class="kit-hidden-mb"><input type="checkbox" value="<?php $categories->mid(); ?>" name="mid[]"/></td>
<td><a href="<?php $options->adminUrl('category.php?mid=' . $categories->mid); ?>"><?php $categories->name(); ?></a>
<a href="<?php $categories->permalink(); ?>" title="<?php _e('浏览 %s', $categories->name); ?>"><i class="i-exlink"></i></a>
</td>
<td>
<?php if (count($categories->children) > 0): ?>
<a href="<?php $options->adminUrl('manage-categories.php?parent=' . $categories->mid); ?>"><?php echo _n('一个分类', '%d个分类', count($categories->children)); ?></a>
<?php else: ?>
<a href="<?php $options->adminUrl('category.php?parent=' . $categories->mid); ?>"><?php echo _e('新增'); ?></a>
<?php endif; ?>
</td>
<td class="kit-hidden-mb"><?php $categories->slug(); ?></td>
<td>
<?php if ($options->defaultCategory == $categories->mid): ?>
<?php _e('默认'); ?>
<?php else: ?>
<a class="hidden-by-mouse" href="<?php $security->index('/action/metas-category-edit?do=default&mid=' . $categories->mid); ?>" title="<?php _e('设为默认'); ?>"><?php _e('默认'); ?></a>
<?php endif; ?>
</td>
<td class="kit-hidden-mb"><a class="balloon-button left size-<?php echo \Typecho\Common::splitByCount($categories->count, 1, 10, 20, 50, 100); ?>" href="<?php $options->adminUrl('manage-posts.php?category=' . $categories->mid); ?>"><?php $categories->count(); ?></a></td>
</tr>
<tr id="mid-<?php $categories->theId(); ?>">
<td class="kit-hidden-mb"><input type="checkbox"
value="<?php $categories->mid(); ?>"
name="mid[]"/></td>
<td>
<a href="<?php $options->adminUrl('category.php?mid=' . $categories->mid); ?>"><?php $categories->name(); ?></a>
<a href="<?php $categories->permalink(); ?>"
title="<?php _e('浏览 %s', $categories->name); ?>"><i class="i-exlink"></i></a>
</td>
<td>
<?php if (count($categories->children) > 0): ?>
<a href="<?php $options->adminUrl('manage-categories.php?parent=' . $categories->mid); ?>"><?php echo _n('一个分类', '%d个分类', count($categories->children)); ?></a>
<?php else: ?>
<a href="<?php $options->adminUrl('category.php?parent=' . $categories->mid); ?>"><?php echo _e('新增'); ?></a>
<?php endif; ?>
</td>
<td class="kit-hidden-mb"><?php $categories->slug(); ?></td>
<td>
<?php if ($options->defaultCategory == $categories->mid): ?>
<?php _e('默认'); ?>
<?php else: ?>
<a class="hidden-by-mouse"
href="<?php $security->index('/action/metas-category-edit?do=default&mid=' . $categories->mid); ?>"
title="<?php _e('设为默认'); ?>"><?php _e('默认'); ?></a>
<?php endif; ?>
</td>
<td class="kit-hidden-mb"><a
class="balloon-button left size-<?php echo \Typecho\Common::splitByCount($categories->count, 1, 10, 20, 50, 100); ?>"
href="<?php $options->adminUrl('manage-posts.php?category=' . $categories->mid); ?>"><?php $categories->count(); ?></a>
</td>
</tr>
<?php endwhile; ?>
<?php else: ?>
<?php else: ?>
<tr>
<td colspan="6"><h6 class="typecho-list-table-title"><?php _e('没有任何分类'); ?></h6></td>
<td colspan="6"><h6 class="typecho-list-table-title"><?php _e('没有任何分类'); ?></h6>
</td>
</tr>
<?php endif; ?>
<?php endif; ?>
</tbody>
</table>
</div>
</form>
</div>
</form>
</div>
</div>
</div>
</div>
@ -104,51 +122,51 @@ include 'common-js.php';
?>
<script type="text/javascript">
(function () {
$(document).ready(function () {
var table = $('.typecho-list-table').tableDnD({
onDrop : function () {
var ids = [];
(function () {
$(document).ready(function () {
var table = $('.typecho-list-table').tableDnD({
onDrop: function () {
var ids = [];
$('input[type=checkbox]', table).each(function () {
ids.push($(this).val());
});
$('input[type=checkbox]', table).each(function () {
ids.push($(this).val());
});
$.post('<?php $security->index('/action/metas-category-edit?do=sort'); ?>',
$.param({mid : ids}));
$.post('<?php $security->index('/action/metas-category-edit?do=sort'); ?>',
$.param({mid: ids}));
$('tr', table).each(function (i) {
if (i % 2) {
$(this).addClass('even');
} else {
$(this).removeClass('even');
}
});
}
$('tr', table).each(function (i) {
if (i % 2) {
$(this).addClass('even');
} else {
$(this).removeClass('even');
}
});
}
});
table.tableSelectable({
checkEl: 'input[type=checkbox]',
rowEl: 'tr',
selectAllEl: '.typecho-table-select-all',
actionEl: '.dropdown-menu a'
});
$('.btn-drop').dropdownMenu({
btnEl: '.dropdown-toggle',
menuEl: '.dropdown-menu'
});
$('.dropdown-menu button.merge').click(function () {
var btn = $(this);
btn.parents('form').attr('action', btn.attr('rel')).submit();
});
<?php if (isset($request->mid)): ?>
$('.typecho-mini-panel').effect('highlight', '#AACB36');
<?php endif; ?>
});
table.tableSelectable({
checkEl : 'input[type=checkbox]',
rowEl : 'tr',
selectAllEl : '.typecho-table-select-all',
actionEl : '.dropdown-menu a'
});
$('.btn-drop').dropdownMenu({
btnEl : '.dropdown-toggle',
menuEl : '.dropdown-menu'
});
$('.dropdown-menu button.merge').click(function () {
var btn = $(this);
btn.parents('form').attr('action', btn.attr('rel')).submit();
});
<?php if (isset($request->mid)): ?>
$('.typecho-mini-panel').effect('highlight', '#AACB36');
<?php endif; ?>
});
})();
})();
</script>
<?php include 'footer.php'; ?>

View File

@ -3,8 +3,8 @@ include 'common.php';
include 'header.php';
include 'menu.php';
$stat = \Typecho\Widget::widget('Widget_Stat');
$comments = \Typecho\Widget::widget('Widget_Comments_Admin');
$stat = \Widget\Stat::alloc();
$comments = \Widget\Comments\Admin::alloc();
$isAllComments = ('on' == $request->get('__typecho_all_comments') || 'on' == \Typecho\Cookie::get('__typecho_all_comments'));
?>
<div class="main">

View File

@ -3,112 +3,134 @@ include 'common.php';
include 'header.php';
include 'menu.php';
$stat = \Typecho\Widget::widget('Widget_Stat');
$stat = \Widget\Stat::alloc();
$attachments = \Widget\Contents\Attachment\Admin::alloc();
?>
<?php \Typecho\Widget::widget('Widget_Contents_Attachment_Admin')->to($attachments); ?>
<div class="main">
<div class="body container">
<?php include 'page-title.php'; ?>
<div class="row typecho-page-main" role="main">
<div class="col-mb-12">
<div class="typecho-list-operate clearfix">
<form method="get">
<div class="operate">
<label><i class="sr-only"><?php _e('全选'); ?></i><input type="checkbox" class="typecho-table-select-all" /></label>
<label><i class="sr-only"><?php _e('全选'); ?></i><input type="checkbox"
class="typecho-table-select-all"/></label>
<div class="btn-group btn-drop">
<button class="btn dropdown-toggle btn-s" type="button"><i class="sr-only"><?php _e('操作'); ?></i><?php _e('选中项'); ?> <i class="i-caret-down"></i></button>
<ul class="dropdown-menu">
<li><a lang="<?php _e('你确认要删除这些文件吗?'); ?>" href="<?php $security->index('/action/contents-attachment-edit?do=delete'); ?>"><?php _e('删除'); ?></a></li>
</ul>
<button class="btn btn-s btn-warn btn-operate" href="<?php $security->index('/action/contents-attachment-edit?do=clear'); ?>" lang="<?php _e('您确认要清理未归档的文件吗?'); ?>"><?php _e('清理未归档文件'); ?></button>
<button class="btn dropdown-toggle btn-s" type="button"><i
class="sr-only"><?php _e('操作'); ?></i><?php _e('选中项'); ?> <i
class="i-caret-down"></i></button>
<ul class="dropdown-menu">
<li><a lang="<?php _e('你确认要删除这些文件吗?'); ?>"
href="<?php $security->index('/action/contents-attachment-edit?do=delete'); ?>"><?php _e('删除'); ?></a>
</li>
</ul>
<button class="btn btn-s btn-warn btn-operate"
href="<?php $security->index('/action/contents-attachment-edit?do=clear'); ?>"
lang="<?php _e('您确认要清理未归档的文件吗?'); ?>"><?php _e('清理未归档文件'); ?></button>
</div>
</div>
<div class="search" role="search">
<?php if ('' != $request->keywords): ?>
<a href="<?php $options->adminUrl('manage-medias.php'); ?>"><?php _e('&laquo; 取消筛选'); ?></a>
<a href="<?php $options->adminUrl('manage-medias.php'); ?>"><?php _e('&laquo; 取消筛选'); ?></a>
<?php endif; ?>
<input type="text" class="text-s" placeholder="<?php _e('请输入关键字'); ?>" value="<?php echo htmlspecialchars($request->keywords); ?>"<?php if ('' == $request->keywords): ?> onclick="value='';name='keywords';" <?php else: ?> name="keywords"<?php endif; ?>/>
<input type="text" class="text-s" placeholder="<?php _e('请输入关键字'); ?>"
value="<?php echo htmlspecialchars($request->keywords); ?>"<?php if ('' == $request->keywords): ?> onclick="value='';name='keywords';" <?php else: ?> name="keywords"<?php endif; ?>/>
<button type="submit" class="btn btn-s"><?php _e('筛选'); ?></button>
</div>
</form>
</div><!-- end .typecho-list-operate -->
<form method="post" name="manage_medias" class="operate-form">
<div class="typecho-table-wrap">
<table class="typecho-list-table draggable">
<colgroup>
<col width="20" class="kit-hidden-mb"/>
<col width="6%" class="kit-hidden-mb"/>
<col width="30%"/>
<col width="" class="kit-hidden-mb"/>
<col width="30%" class="kit-hidden-mb"/>
<col width="16%"/>
</colgroup>
<thead>
<div class="typecho-table-wrap">
<table class="typecho-list-table draggable">
<colgroup>
<col width="20" class="kit-hidden-mb"/>
<col width="6%" class="kit-hidden-mb"/>
<col width="30%"/>
<col width="" class="kit-hidden-mb"/>
<col width="30%" class="kit-hidden-mb"/>
<col width="16%"/>
</colgroup>
<thead>
<tr>
<th class="kit-hidden-mb"> </th>
<th class="kit-hidden-mb"> </th>
<th class="kit-hidden-mb"></th>
<th class="kit-hidden-mb"></th>
<th><?php _e('文件名'); ?></th>
<th class="kit-hidden-mb"><?php _e('上传者'); ?></th>
<th class="kit-hidden-mb"><?php _e('所属文章'); ?></th>
<th><?php _e('发布日期'); ?></th>
</tr>
</thead>
<tbody>
<?php if($attachments->have()): ?>
<?php while($attachments->next()): ?>
<?php $mime = \Typecho\Common::mimeIconType($attachments->attachment->mime); ?>
<tr id="<?php $attachments->theId(); ?>">
<td class="kit-hidden-mb"><input type="checkbox" value="<?php $attachments->cid(); ?>" name="cid[]"/></td>
<td class="kit-hidden-mb"><a href="<?php $options->adminUrl('manage-comments.php?cid=' . $attachments->cid); ?>" class="balloon-button size-<?php echo \Typecho\Common::splitByCount($attachments->commentsNum, 1, 10, 20, 50, 100); ?>"><?php $attachments->commentsNum(); ?></a></td>
<td>
<i class="mime-<?php echo $mime; ?>"></i>
<a href="<?php $options->adminUrl('media.php?cid=' . $attachments->cid); ?>"><?php $attachments->title(); ?></a>
<a href="<?php $attachments->permalink(); ?>" title="<?php _e('浏览 %s', $attachments->title); ?>"><i class="i-exlink"></i></a>
</td>
<td class="kit-hidden-mb"><?php $attachments->author(); ?></td>
<td class="kit-hidden-mb">
<?php if ($attachments->parentPost->cid): ?>
<a href="<?php $options->adminUrl('write-' . (0 === strpos($attachments->parentPost->type, 'post') ? 'post' : 'page') . '.php?cid=' . $attachments->parentPost->cid); ?>"><?php $attachments->parentPost->title(); ?></a>
<?php else: ?>
<span class="description"><?php _e('未归档'); ?></span>
<?php endif; ?>
</td>
<td><?php $attachments->dateWord(); ?></td>
</tr>
<?php endwhile; ?>
</thead>
<tbody>
<?php if ($attachments->have()): ?>
<?php while ($attachments->next()): ?>
<?php $mime = \Typecho\Common::mimeIconType($attachments->attachment->mime); ?>
<tr id="<?php $attachments->theId(); ?>">
<td class="kit-hidden-mb"><input type="checkbox"
value="<?php $attachments->cid(); ?>"
name="cid[]"/></td>
<td class="kit-hidden-mb"><a
href="<?php $options->adminUrl('manage-comments.php?cid=' . $attachments->cid); ?>"
class="balloon-button size-<?php echo \Typecho\Common::splitByCount($attachments->commentsNum, 1, 10, 20, 50, 100); ?>"><?php $attachments->commentsNum(); ?></a>
</td>
<td>
<i class="mime-<?php echo $mime; ?>"></i>
<a href="<?php $options->adminUrl('media.php?cid=' . $attachments->cid); ?>"><?php $attachments->title(); ?></a>
<a href="<?php $attachments->permalink(); ?>"
title="<?php _e('浏览 %s', $attachments->title); ?>"><i
class="i-exlink"></i></a>
</td>
<td class="kit-hidden-mb"><?php $attachments->author(); ?></td>
<td class="kit-hidden-mb">
<?php if ($attachments->parentPost->cid): ?>
<a href="<?php $options->adminUrl('write-' . (0 === strpos($attachments->parentPost->type, 'post') ? 'post' : 'page') . '.php?cid=' . $attachments->parentPost->cid); ?>"><?php $attachments->parentPost->title(); ?></a>
<?php else: ?>
<span class="description"><?php _e('未归档'); ?></span>
<?php endif; ?>
</td>
<td><?php $attachments->dateWord(); ?></td>
</tr>
<?php endwhile; ?>
<?php else: ?>
<tr>
<td colspan="6"><h6 class="typecho-list-table-title"><?php _e('没有任何文件'); ?></h6></td>
</tr>
<tr>
<td colspan="6"><h6 class="typecho-list-table-title"><?php _e('没有任何文件'); ?></h6>
</td>
</tr>
<?php endif; ?>
</tbody>
</table><!-- end .typecho-list-table -->
</div><!-- end .typecho-table-wrap -->
</tbody>
</table><!-- end .typecho-list-table -->
</div><!-- end .typecho-table-wrap -->
</form><!-- end .operate-form -->
<div class="typecho-list-operate clearfix">
<form method="get">
<div class="operate">
<label><i class="sr-only"><?php _e('全选'); ?></i><input type="checkbox" class="typecho-table-select-all" /></label>
<label><i class="sr-only"><?php _e('全选'); ?></i><input type="checkbox"
class="typecho-table-select-all"/></label>
<div class="btn-group btn-drop">
<button class="btn dropdown-toggle btn-s" type="button"><i class="sr-only"><?php _e('操作'); ?></i><?php _e('选中项'); ?> <i class="i-caret-down"></i></button>
<button class="btn dropdown-toggle btn-s" type="button"><i
class="sr-only"><?php _e('操作'); ?></i><?php _e('选中项'); ?> <i
class="i-caret-down"></i></button>
<ul class="dropdown-menu">
<li><a lang="<?php _e('你确认要删除这些文件吗?'); ?>" href="<?php $security->index('/action/contents-attachment-edit?do=delete'); ?>"><?php _e('删除'); ?></a></li>
<li><a lang="<?php _e('你确认要删除这些文件吗?'); ?>"
href="<?php $security->index('/action/contents-attachment-edit?do=delete'); ?>"><?php _e('删除'); ?></a>
</li>
</ul>
</div>
<button class="btn btn-s btn-warn btn-operate" href="<?php $security->index('/action/contents-attachment-edit?do=clear'); ?>" lang="<?php _e('您确认要清理未归档的文件吗?'); ?>"><?php _e('清理未归档文件'); ?></button>
<button class="btn btn-s btn-warn btn-operate"
href="<?php $security->index('/action/contents-attachment-edit?do=clear'); ?>"
lang="<?php _e('您确认要清理未归档的文件吗?'); ?>"><?php _e('清理未归档文件'); ?></button>
</div>
<?php if($attachments->have()): ?>
<ul class="typecho-pager">
<?php $attachments->pageNav(); ?>
</ul>
<?php endif; ?>
<?php if ($attachments->have()): ?>
<ul class="typecho-pager">
<?php $attachments->pageNav(); ?>
</ul>
<?php endif; ?>
</form>
</div><!-- end .typecho-list-operate -->
</div>
</div><!-- end .typecho-page-main -->
</div>

View File

@ -3,7 +3,8 @@ include 'common.php';
include 'header.php';
include 'menu.php';
$stat = \Typecho\Widget::widget('Widget_Stat');
$stat = \Widget\Stat::alloc();
$pages = \Widget\Contents\Page\Admin::alloc();
?>
<div class="main">
<div class="body container">
@ -13,93 +14,112 @@ $stat = \Typecho\Widget::widget('Widget_Stat');
<div class="typecho-list-operate clearfix">
<form method="get">
<div class="operate">
<label><i class="sr-only"><?php _e('全选'); ?></i><input type="checkbox" class="typecho-table-select-all" /></label>
<label><i class="sr-only"><?php _e('全选'); ?></i><input type="checkbox"
class="typecho-table-select-all"/></label>
<div class="btn-group btn-drop">
<button class="btn dropdown-toggle btn-s" type="button"><i class="sr-only"><?php _e('操作'); ?></i><?php _e('选中项'); ?> <i class="i-caret-down"></i></button>
<ul class="dropdown-menu">
<li><a lang="<?php _e('你确认要删除这些页面吗?'); ?>" href="<?php $security->index('/action/contents-page-edit?do=delete'); ?>"><?php _e('删除'); ?></a></li>
<li><a href="<?php $security->index('/action/contents-page-edit?do=mark&status=publish'); ?>"><?php _e('标记为<strong>%s</strong>', _t('公开')); ?></a></li>
<li><a href="<?php $security->index('/action/contents-page-edit?do=mark&status=hidden'); ?>"><?php _e('标记为<strong>%s</strong>', _t('隐藏')); ?></a></li>
</ul>
<button class="btn dropdown-toggle btn-s" type="button"><i
class="sr-only"><?php _e('操作'); ?></i><?php _e('选中项'); ?> <i
class="i-caret-down"></i></button>
<ul class="dropdown-menu">
<li><a lang="<?php _e('你确认要删除这些页面吗?'); ?>"
href="<?php $security->index('/action/contents-page-edit?do=delete'); ?>"><?php _e('删除'); ?></a>
</li>
<li>
<a href="<?php $security->index('/action/contents-page-edit?do=mark&status=publish'); ?>"><?php _e('标记为<strong>%s</strong>', _t('公开')); ?></a>
</li>
<li>
<a href="<?php $security->index('/action/contents-page-edit?do=mark&status=hidden'); ?>"><?php _e('标记为<strong>%s</strong>', _t('隐藏')); ?></a>
</li>
</ul>
</div>
</div>
<div class="search" role="search">
<?php if ('' != $request->keywords): ?>
<a href="<?php $options->adminUrl('manage-pages.php'); ?>"><?php _e('&laquo; 取消筛选'); ?></a>
<a href="<?php $options->adminUrl('manage-pages.php'); ?>"><?php _e('&laquo; 取消筛选'); ?></a>
<?php endif; ?>
<input type="text" class="text-s" placeholder="<?php _e('请输入关键字'); ?>" value="<?php echo htmlspecialchars($request->keywords); ?>" name="keywords" />
<input type="text" class="text-s" placeholder="<?php _e('请输入关键字'); ?>"
value="<?php echo htmlspecialchars($request->keywords); ?>" name="keywords"/>
<button type="submit" class="btn btn-s"><?php _e('筛选'); ?></button>
</div>
</form>
</div><!-- end .typecho-list-operate -->
<form method="post" name="manage_pages" class="operate-form">
<div class="typecho-table-wrap">
<table class="typecho-list-table">
<colgroup>
<col width="20" class="kit-hidden-mb"/>
<col width="6%" class="kit-hidden-mb"/>
<col width="30%"/>
<col width="30%"/>
<col width="" class="kit-hidden-mb"/>
<col width="16%"/>
</colgroup>
<thead>
<div class="typecho-table-wrap">
<table class="typecho-list-table">
<colgroup>
<col width="20" class="kit-hidden-mb"/>
<col width="6%" class="kit-hidden-mb"/>
<col width="30%"/>
<col width="30%"/>
<col width="" class="kit-hidden-mb"/>
<col width="16%"/>
</colgroup>
<thead>
<tr class="nodrag">
<th class="kit-hidden-mb"> </th>
<th class="kit-hidden-mb"> </th>
<th class="kit-hidden-mb"></th>
<th class="kit-hidden-mb"></th>
<th><?php _e('标题'); ?></th>
<th><?php _e('缩略名'); ?></th>
<th class="kit-hidden-mb"><?php _e('作者'); ?></th>
<th><?php _e('日期'); ?></th>
</tr>
</thead>
<tbody>
<?php \Typecho\Widget::widget('Widget_Contents_Page_Admin')->to($pages); ?>
<?php if($pages->have()): ?>
<?php while($pages->next()): ?>
<tr id="<?php $pages->theId(); ?>">
<td class="kit-hidden-mb"><input type="checkbox" value="<?php $pages->cid(); ?>" name="cid[]"/></td>
<td class="kit-hidden-mb"><a href="<?php $options->adminUrl('manage-comments.php?cid=' . $pages->cid); ?>" class="balloon-button size-<?php echo \Typecho\Common::splitByCount($pages->commentsNum, 1, 10, 20, 50, 100); ?>" title="<?php $pages->commentsNum(); ?> <?php _e('评论'); ?>"><?php $pages->commentsNum(); ?></a></td>
<td>
<a href="<?php $options->adminUrl('write-page.php?cid=' . $pages->cid); ?>"><?php $pages->title(); ?></a>
<?php
if ($pages->hasSaved || 'page_draft' == $pages->type) {
echo '<em class="status">' . _t('草稿') . '</em>';
}
if ('hidden' == $pages->status) {
echo '<em class="status">' . _t('隐藏') . '</em>';
}
?>
<a href="<?php $options->adminUrl('write-page.php?cid=' . $pages->cid); ?>" title="<?php _e('编辑 %s', htmlspecialchars($pages->title)); ?>"><i class="i-edit"></i></a>
<?php if ('page_draft' != $pages->type): ?>
<a href="<?php $pages->permalink(); ?>" title="<?php _e('浏览 %s', htmlspecialchars($pages->title)); ?>"><i class="i-exlink"></i></a>
<?php endif; ?>
</td>
<td><?php $pages->slug(); ?></td>
<td class="kit-hidden-mb"><?php $pages->author(); ?></td>
<td>
<?php if ($pages->hasSaved): ?>
<span class="description">
</thead>
<tbody>
<?php if ($pages->have()): ?>
<?php while ($pages->next()): ?>
<tr id="<?php $pages->theId(); ?>">
<td class="kit-hidden-mb"><input type="checkbox" value="<?php $pages->cid(); ?>"
name="cid[]"/></td>
<td class="kit-hidden-mb"><a
href="<?php $options->adminUrl('manage-comments.php?cid=' . $pages->cid); ?>"
class="balloon-button size-<?php echo \Typecho\Common::splitByCount($pages->commentsNum, 1, 10, 20, 50, 100); ?>"
title="<?php $pages->commentsNum(); ?> <?php _e('评论'); ?>"><?php $pages->commentsNum(); ?></a>
</td>
<td>
<a href="<?php $options->adminUrl('write-page.php?cid=' . $pages->cid); ?>"><?php $pages->title(); ?></a>
<?php
if ($pages->hasSaved || 'page_draft' == $pages->type) {
echo '<em class="status">' . _t('草稿') . '</em>';
}
if ('hidden' == $pages->status) {
echo '<em class="status">' . _t('隐藏') . '</em>';
}
?>
<a href="<?php $options->adminUrl('write-page.php?cid=' . $pages->cid); ?>"
title="<?php _e('编辑 %s', htmlspecialchars($pages->title)); ?>"><i
class="i-edit"></i></a>
<?php if ('page_draft' != $pages->type): ?>
<a href="<?php $pages->permalink(); ?>"
title="<?php _e('浏览 %s', htmlspecialchars($pages->title)); ?>"><i
class="i-exlink"></i></a>
<?php endif; ?>
</td>
<td><?php $pages->slug(); ?></td>
<td class="kit-hidden-mb"><?php $pages->author(); ?></td>
<td>
<?php if ($pages->hasSaved): ?>
<span class="description">
<?php $modifyDate = new \Typecho\Date($pages->modified); ?>
<?php _e('保存于 %s', $modifyDate->word()); ?>
</span>
<?php else: ?>
<?php $pages->dateWord(); ?>
<?php endif; ?>
</td>
</tr>
<?php endwhile; ?>
<?php else: ?>
<?php $pages->dateWord(); ?>
<?php endif; ?>
</td>
</tr>
<?php endwhile; ?>
<?php else: ?>
<tr>
<td colspan="6"><h6 class="typecho-list-table-title"><?php _e('没有任何页面'); ?></h6></td>
</tr>
<tr>
<td colspan="6"><h6 class="typecho-list-table-title"><?php _e('没有任何页面'); ?></h6>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div><!-- end .typecho-table-wrap -->
</tbody>
</table>
</div><!-- end .typecho-table-wrap -->
</form><!-- end .operate-form -->
</div><!-- end .typecho-list -->
</div><!-- end .typecho-page-main -->
@ -112,25 +132,25 @@ include 'common-js.php';
include 'table-js.php';
?>
<?php if(!isset($request->status) || 'publish' == $request->get('status')): ?>
<script type="text/javascript">
(function () {
$(document).ready(function () {
var table = $('.typecho-list-table').tableDnD({
onDrop : function () {
var ids = [];
<?php if (!isset($request->status) || 'publish' == $request->get('status')): ?>
<script type="text/javascript">
(function () {
$(document).ready(function () {
var table = $('.typecho-list-table').tableDnD({
onDrop: function () {
var ids = [];
$('input[type=checkbox]', table).each(function () {
ids.push($(this).val());
$('input[type=checkbox]', table).each(function () {
ids.push($(this).val());
});
$.post('<?php $security->index('/action/contents-page-edit?do=sort'); ?>',
$.param({cid: ids}));
}
});
$.post('<?php $security->index('/action/contents-page-edit?do=sort'); ?>',
$.param({cid : ids}));
}
});
});
})();
</script>
});
})();
</script>
<?php endif; ?>
<?php include 'footer.php'; ?>

View File

@ -3,8 +3,8 @@ include 'common.php';
include 'header.php';
include 'menu.php';
$stat = \Typecho\Widget::widget('Widget_Stat');
$posts = \Typecho\Widget::widget('Widget_Contents_Post_Admin');
$stat = \Widget\Stat::alloc();
$posts = \Widget\Contents\Post\Admin::alloc();
$isAllPosts = ('on' == $request->get('__typecho_all_posts') || 'on' == \Typecho\Cookie::get('__typecho_all_posts'));
?>
<div class="main">
@ -14,183 +14,234 @@ $isAllPosts = ('on' == $request->get('__typecho_all_posts') || 'on' == \Typecho\
<div class="col-mb-12 typecho-list">
<div class="clearfix">
<ul class="typecho-option-tabs right">
<?php if($user->pass('editor', true) && !isset($request->uid)): ?>
<li class="<?php if($isAllPosts): ?> current<?php endif; ?>"><a href="<?php echo $request->makeUriByRequest('__typecho_all_posts=on'); ?>"><?php _e('所有'); ?></a></li>
<li class="<?php if(!$isAllPosts): ?> current<?php endif; ?>"><a href="<?php echo $request->makeUriByRequest('__typecho_all_posts=off'); ?>"><?php _e('我的'); ?></a></li>
<?php endif; ?>
<?php if ($user->pass('editor', true) && !isset($request->uid)): ?>
<li class="<?php if ($isAllPosts): ?> current<?php endif; ?>"><a
href="<?php echo $request->makeUriByRequest('__typecho_all_posts=on'); ?>"><?php _e('所有'); ?></a>
</li>
<li class="<?php if (!$isAllPosts): ?> current<?php endif; ?>"><a
href="<?php echo $request->makeUriByRequest('__typecho_all_posts=off'); ?>"><?php _e('我的'); ?></a>
</li>
<?php endif; ?>
</ul>
<ul class="typecho-option-tabs">
<li<?php if(!isset($request->status) || 'all' == $request->get('status')): ?> class="current"<?php endif; ?>><a href="<?php $options->adminUrl('manage-posts.php'
. (isset($request->uid) ? '?uid=' . $request->uid : '')); ?>"><?php _e('可用'); ?></a></li>
<li<?php if('waiting' == $request->get('status')): ?> class="current"<?php endif; ?>><a href="<?php $options->adminUrl('manage-posts.php?status=waiting'
. (isset($request->uid) ? '&uid=' . $request->uid : '')); ?>"><?php _e('待审核'); ?>
<?php if(!$isAllPosts && $stat->myWaitingPostsNum > 0 && !isset($request->uid)): ?>
<span class="balloon"><?php $stat->myWaitingPostsNum(); ?></span>
<?php elseif($isAllPosts && $stat->waitingPostsNum > 0 && !isset($request->uid)): ?>
<span class="balloon"><?php $stat->waitingPostsNum(); ?></span>
<?php elseif(isset($request->uid) && $stat->currentWaitingPostsNum > 0): ?>
<span class="balloon"><?php $stat->currentWaitingPostsNum(); ?></span>
<?php endif; ?>
</a></li>
<li<?php if('draft' == $request->get('status')): ?> class="current"<?php endif; ?>><a href="<?php $options->adminUrl('manage-posts.php?status=draft'
. (isset($request->uid) ? '&uid=' . $request->uid : '')); ?>"><?php _e('草稿'); ?>
<?php if(!$isAllPosts && $stat->myDraftPostsNum > 0 && !isset($request->uid)): ?>
<span class="balloon"><?php $stat->myDraftPostsNum(); ?></span>
<?php elseif($isAllPosts && $stat->draftPostsNum > 0 && !isset($request->uid)): ?>
<span class="balloon"><?php $stat->draftPostsNum(); ?></span>
<?php elseif(isset($request->uid) && $stat->currentDraftPostsNum > 0): ?>
<span class="balloon"><?php $stat->currentDraftPostsNum(); ?></span>
<?php endif; ?>
</a></li>
<li<?php if (!isset($request->status) || 'all' == $request->get('status')): ?> class="current"<?php endif; ?>>
<a href="<?php $options->adminUrl('manage-posts.php'
. (isset($request->uid) ? '?uid=' . $request->uid : '')); ?>"><?php _e('可用'); ?></a>
</li>
<li<?php if ('waiting' == $request->get('status')): ?> class="current"<?php endif; ?>><a
href="<?php $options->adminUrl('manage-posts.php?status=waiting'
. (isset($request->uid) ? '&uid=' . $request->uid : '')); ?>"><?php _e('待审核'); ?>
<?php if (!$isAllPosts && $stat->myWaitingPostsNum > 0 && !isset($request->uid)): ?>
<span class="balloon"><?php $stat->myWaitingPostsNum(); ?></span>
<?php elseif ($isAllPosts && $stat->waitingPostsNum > 0 && !isset($request->uid)): ?>
<span class="balloon"><?php $stat->waitingPostsNum(); ?></span>
<?php elseif (isset($request->uid) && $stat->currentWaitingPostsNum > 0): ?>
<span class="balloon"><?php $stat->currentWaitingPostsNum(); ?></span>
<?php endif; ?>
</a></li>
<li<?php if ('draft' == $request->get('status')): ?> class="current"<?php endif; ?>><a
href="<?php $options->adminUrl('manage-posts.php?status=draft'
. (isset($request->uid) ? '&uid=' . $request->uid : '')); ?>"><?php _e('草稿'); ?>
<?php if (!$isAllPosts && $stat->myDraftPostsNum > 0 && !isset($request->uid)): ?>
<span class="balloon"><?php $stat->myDraftPostsNum(); ?></span>
<?php elseif ($isAllPosts && $stat->draftPostsNum > 0 && !isset($request->uid)): ?>
<span class="balloon"><?php $stat->draftPostsNum(); ?></span>
<?php elseif (isset($request->uid) && $stat->currentDraftPostsNum > 0): ?>
<span class="balloon"><?php $stat->currentDraftPostsNum(); ?></span>
<?php endif; ?>
</a></li>
</ul>
</div>
<div class="typecho-list-operate clearfix">
<form method="get">
<div class="operate">
<label><i class="sr-only"><?php _e('全选'); ?></i><input type="checkbox" class="typecho-table-select-all" /></label>
<label><i class="sr-only"><?php _e('全选'); ?></i><input type="checkbox"
class="typecho-table-select-all"/></label>
<div class="btn-group btn-drop">
<button class="btn dropdown-toggle btn-s" type="button"><i class="sr-only"><?php _e('操作'); ?></i><?php _e('选中项'); ?> <i class="i-caret-down"></i></button>
<button class="btn dropdown-toggle btn-s" type="button"><i
class="sr-only"><?php _e('操作'); ?></i><?php _e('选中项'); ?> <i
class="i-caret-down"></i></button>
<ul class="dropdown-menu">
<li><a lang="<?php _e('你确认要删除这些文章吗?'); ?>" href="<?php $security->index('/action/contents-post-edit?do=delete'); ?>"><?php _e('删除'); ?></a></li>
<li><a lang="<?php _e('你确认要删除这些文章吗?'); ?>"
href="<?php $security->index('/action/contents-post-edit?do=delete'); ?>"><?php _e('删除'); ?></a>
</li>
<?php if ($user->pass('editor', true)): ?>
<li><a href="<?php $security->index('/action/contents-post-edit?do=mark&status=publish'); ?>"><?php _e('标记为<strong>%s</strong>', _t('公开')); ?></a></li>
<li><a href="<?php $security->index('/action/contents-post-edit?do=mark&status=waiting'); ?>"><?php _e('标记为<strong>%s</strong>', _t('待审核')); ?></a></li>
<li><a href="<?php $security->index('/action/contents-post-edit?do=mark&status=hidden'); ?>"><?php _e('标记为<strong>%s</strong>', _t('隐藏')); ?></a></li>
<li><a href="<?php $security->index('/action/contents-post-edit?do=mark&status=private'); ?>"><?php _e('标记为<strong>%s</strong>', _t('私密')); ?></a></li>
<li>
<a href="<?php $security->index('/action/contents-post-edit?do=mark&status=publish'); ?>"><?php _e('标记为<strong>%s</strong>', _t('公开')); ?></a>
</li>
<li>
<a href="<?php $security->index('/action/contents-post-edit?do=mark&status=waiting'); ?>"><?php _e('标记为<strong>%s</strong>', _t('待审核')); ?></a>
</li>
<li>
<a href="<?php $security->index('/action/contents-post-edit?do=mark&status=hidden'); ?>"><?php _e('标记为<strong>%s</strong>', _t('隐藏')); ?></a>
</li>
<li>
<a href="<?php $security->index('/action/contents-post-edit?do=mark&status=private'); ?>"><?php _e('标记为<strong>%s</strong>', _t('私密')); ?></a>
</li>
<?php endif; ?>
</ul>
</div>
</div>
</div>
<div class="search" role="search">
<?php if ('' != $request->keywords || '' != $request->category): ?>
<a href="<?php $options->adminUrl('manage-posts.php'
. (isset($request->status) || isset($request->uid) ? '?' .
(isset($request->status) ? 'status=' . htmlspecialchars($request->get('status')) : '') .
(isset($request->uid) ? '?uid=' . htmlspecialchars($request->get('uid')) : '') : '')); ?>"><?php _e('&laquo; 取消筛选'); ?></a>
<a href="<?php $options->adminUrl('manage-posts.php'
. (isset($request->status) || isset($request->uid) ? '?' .
(isset($request->status) ? 'status=' . htmlspecialchars($request->get('status')) : '') .
(isset($request->uid) ? '?uid=' . htmlspecialchars($request->get('uid')) : '') : '')); ?>"><?php _e('&laquo; 取消筛选'); ?></a>
<?php endif; ?>
<input type="text" class="text-s" placeholder="<?php _e('请输入关键字'); ?>" value="<?php echo htmlspecialchars($request->keywords); ?>" name="keywords" />
<input type="text" class="text-s" placeholder="<?php _e('请输入关键字'); ?>"
value="<?php echo htmlspecialchars($request->keywords); ?>" name="keywords"/>
<select name="category">
<option value=""><?php _e('所有分类'); ?></option>
<?php \Typecho\Widget::widget('Widget_Metas_Category_List')->to($category); ?>
<?php while($category->next()): ?>
<option value="<?php $category->mid(); ?>"<?php if($request->get('category') == $category->mid): ?> selected="true"<?php endif; ?>><?php $category->name(); ?></option>
<?php endwhile; ?>
<option value=""><?php _e('所有分类'); ?></option>
<?php \Typecho\Widget::widget('Widget_Metas_Category_List')->to($category); ?>
<?php while ($category->next()): ?>
<option
value="<?php $category->mid(); ?>"<?php if ($request->get('category') == $category->mid): ?> selected="true"<?php endif; ?>><?php $category->name(); ?></option>
<?php endwhile; ?>
</select>
<button type="submit" class="btn btn-s"><?php _e('筛选'); ?></button>
<?php if(isset($request->uid)): ?>
<input type="hidden" value="<?php echo htmlspecialchars($request->get('uid')); ?>" name="uid" />
<?php if (isset($request->uid)): ?>
<input type="hidden" value="<?php echo htmlspecialchars($request->get('uid')); ?>"
name="uid"/>
<?php endif; ?>
<?php if(isset($request->status)): ?>
<input type="hidden" value="<?php echo htmlspecialchars($request->get('status')); ?>" name="status" />
<?php if (isset($request->status)): ?>
<input type="hidden" value="<?php echo htmlspecialchars($request->get('status')); ?>"
name="status"/>
<?php endif; ?>
</div>
</form>
</div><!-- end .typecho-list-operate -->
<form method="post" name="manage_posts" class="operate-form">
<div class="typecho-table-wrap">
<table class="typecho-list-table">
<colgroup>
<col width="20" class="kit-hidden-mb"/>
<col width="6%" class="kit-hidden-mb"/>
<col width="45%"/>
<col width="" class="kit-hidden-mb"/>
<col width="18%" class="kit-hidden-mb"/>
<col width="16%"/>
</colgroup>
<thead>
<div class="typecho-table-wrap">
<table class="typecho-list-table">
<colgroup>
<col width="20" class="kit-hidden-mb"/>
<col width="6%" class="kit-hidden-mb"/>
<col width="45%"/>
<col width="" class="kit-hidden-mb"/>
<col width="18%" class="kit-hidden-mb"/>
<col width="16%"/>
</colgroup>
<thead>
<tr>
<th class="kit-hidden-mb"> </th>
<th class="kit-hidden-mb"> </th>
<th class="kit-hidden-mb"></th>
<th class="kit-hidden-mb"></th>
<th><?php _e('标题'); ?></th>
<th class="kit-hidden-mb"><?php _e('作者'); ?></th>
<th class="kit-hidden-mb"><?php _e('分类'); ?></th>
<th><?php _e('日期'); ?></th>
</tr>
</thead>
<tbody>
<?php if($posts->have()): ?>
<?php while($posts->next()): ?>
<tr id="<?php $posts->theId(); ?>">
<td class="kit-hidden-mb"><input type="checkbox" value="<?php $posts->cid(); ?>" name="cid[]"/></td>
<td class="kit-hidden-mb"><a href="<?php $options->adminUrl('manage-comments.php?cid=' . ($posts->parentId ? $posts->parentId : $posts->cid)); ?>" class="balloon-button size-<?php echo \Typecho\Common::splitByCount($posts->commentsNum, 1, 10, 20, 50, 100); ?>" title="<?php $posts->commentsNum(); ?> <?php _e('评论'); ?>"><?php $posts->commentsNum(); ?></a></td>
<td>
<a href="<?php $options->adminUrl('write-post.php?cid=' . $posts->cid); ?>"><?php $posts->title(); ?></a>
<?php
if ($posts->hasSaved || 'post_draft' == $posts->type) {
echo '<em class="status">' . _t('草稿') . '</em>';
}
if ('hidden' == $posts->status) {
echo '<em class="status">' . _t('隐藏') . '</em>';
} else if ('waiting' == $posts->status) {
echo '<em class="status">' . _t('待审核') . '</em>';
} else if ('private' == $posts->status) {
echo '<em class="status">' . _t('私密') . '</em>';
} else if ($posts->password) {
echo '<em class="status">' . _t('密码保护') . '</em>';
}
?>
<a href="<?php $options->adminUrl('write-post.php?cid=' . $posts->cid); ?>" title="<?php _e('编辑 %s', htmlspecialchars($posts->title)); ?>"><i class="i-edit"></i></a>
<?php if ('post_draft' != $posts->type): ?>
<a href="<?php $posts->permalink(); ?>" title="<?php _e('浏览 %s', htmlspecialchars($posts->title)); ?>"><i class="i-exlink"></i></a>
<?php endif; ?>
</td>
<td class="kit-hidden-mb"><a href="<?php $options->adminUrl('manage-posts.php?uid=' . $posts->author->uid); ?>"><?php $posts->author(); ?></a></td>
<td class="kit-hidden-mb"><?php $categories = $posts->categories; $length = count($categories); ?>
<?php foreach ($categories as $key => $val): ?>
<?php echo '<a href="';
$options->adminUrl('manage-posts.php?category=' . $val['mid']
. (isset($request->uid) ? '&uid=' . $request->uid : '')
. (isset($request->status) ? '&status=' . $request->status : ''));
echo '">' . $val['name'] . '</a>' . ($key < $length - 1 ? ', ' : ''); ?>
<?php endforeach; ?>
</td>
<td>
<?php if ($posts->hasSaved): ?>
<span class="description">
</thead>
<tbody>
<?php if ($posts->have()): ?>
<?php while ($posts->next()): ?>
<tr id="<?php $posts->theId(); ?>">
<td class="kit-hidden-mb"><input type="checkbox" value="<?php $posts->cid(); ?>"
name="cid[]"/></td>
<td class="kit-hidden-mb"><a
href="<?php $options->adminUrl('manage-comments.php?cid=' . ($posts->parentId ? $posts->parentId : $posts->cid)); ?>"
class="balloon-button size-<?php echo \Typecho\Common::splitByCount($posts->commentsNum, 1, 10, 20, 50, 100); ?>"
title="<?php $posts->commentsNum(); ?> <?php _e('评论'); ?>"><?php $posts->commentsNum(); ?></a>
</td>
<td>
<a href="<?php $options->adminUrl('write-post.php?cid=' . $posts->cid); ?>"><?php $posts->title(); ?></a>
<?php
if ($posts->hasSaved || 'post_draft' == $posts->type) {
echo '<em class="status">' . _t('草稿') . '</em>';
}
if ('hidden' == $posts->status) {
echo '<em class="status">' . _t('隐藏') . '</em>';
} elseif ('waiting' == $posts->status) {
echo '<em class="status">' . _t('待审核') . '</em>';
} elseif ('private' == $posts->status) {
echo '<em class="status">' . _t('私密') . '</em>';
} elseif ($posts->password) {
echo '<em class="status">' . _t('密码保护') . '</em>';
}
?>
<a href="<?php $options->adminUrl('write-post.php?cid=' . $posts->cid); ?>"
title="<?php _e('编辑 %s', htmlspecialchars($posts->title)); ?>"><i
class="i-edit"></i></a>
<?php if ('post_draft' != $posts->type): ?>
<a href="<?php $posts->permalink(); ?>"
title="<?php _e('浏览 %s', htmlspecialchars($posts->title)); ?>"><i
class="i-exlink"></i></a>
<?php endif; ?>
</td>
<td class="kit-hidden-mb"><a
href="<?php $options->adminUrl('manage-posts.php?uid=' . $posts->author->uid); ?>"><?php $posts->author(); ?></a>
</td>
<td class="kit-hidden-mb"><?php $categories = $posts->categories;
$length = count($categories); ?>
<?php foreach ($categories as $key => $val): ?>
<?php echo '<a href="';
$options->adminUrl('manage-posts.php?category=' . $val['mid']
. (isset($request->uid) ? '&uid=' . $request->uid : '')
. (isset($request->status) ? '&status=' . $request->status : ''));
echo '">' . $val['name'] . '</a>' . ($key < $length - 1 ? ', ' : ''); ?>
<?php endforeach; ?>
</td>
<td>
<?php if ($posts->hasSaved): ?>
<span class="description">
<?php $modifyDate = new \Typecho\Date($posts->modified); ?>
<?php _e('保存于 %s', $modifyDate->word()); ?>
</span>
<?php else: ?>
<?php $posts->dateWord(); ?>
<?php endif; ?>
</td>
</tr>
<?php endwhile; ?>
<?php else: ?>
<?php $posts->dateWord(); ?>
<?php endif; ?>
</td>
</tr>
<?php endwhile; ?>
<?php else: ?>
<tr>
<td colspan="6"><h6 class="typecho-list-table-title"><?php _e('没有任何文章'); ?></h6></td>
</tr>
<tr>
<td colspan="6"><h6 class="typecho-list-table-title"><?php _e('没有任何文章'); ?></h6>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</tbody>
</table>
</div>
</form><!-- end .operate-form -->
<div class="typecho-list-operate clearfix">
<form method="get">
<div class="operate">
<label><i class="sr-only"><?php _e('全选'); ?></i><input type="checkbox" class="typecho-table-select-all" /></label>
<label><i class="sr-only"><?php _e('全选'); ?></i><input type="checkbox"
class="typecho-table-select-all"/></label>
<div class="btn-group btn-drop">
<button class="btn dropdown-toggle btn-s" type="button"><i class="sr-only"><?php _e('操作'); ?></i><?php _e('选中项'); ?> <i class="i-caret-down"></i></button>
<button class="btn dropdown-toggle btn-s" type="button"><i
class="sr-only"><?php _e('操作'); ?></i><?php _e('选中项'); ?> <i
class="i-caret-down"></i></button>
<ul class="dropdown-menu">
<li><a lang="<?php _e('你确认要删除这些文章吗?'); ?>" href="<?php $security->index('/action/contents-post-edit?do=delete'); ?>"><?php _e('删除'); ?></a></li>
<li><a lang="<?php _e('你确认要删除这些文章吗?'); ?>"
href="<?php $security->index('/action/contents-post-edit?do=delete'); ?>"><?php _e('删除'); ?></a>
</li>
<?php if ($user->pass('editor', true)): ?>
<li><a href="<?php $security->index('/action/contents-post-edit?do=mark&status=publish'); ?>"><?php _e('标记为<strong>%s</strong>', _t('公开')); ?></a></li>
<li><a href="<?php $security->index('/action/contents-post-edit?do=mark&status=waiting'); ?>"><?php _e('标记为<strong>%s</strong>', _t('待审核')); ?></a></li>
<li><a href="<?php $security->index('/action/contents-post-edit?do=mark&status=hidden'); ?>"><?php _e('标记为<strong>%s</strong>', _t('隐藏')); ?></a></li>
<li><a href="<?php $security->index('/action/contents-post-edit?do=mark&status=private'); ?>"><?php _e('标记为<strong>%s</strong>', _t('私密')); ?></a></li>
<li>
<a href="<?php $security->index('/action/contents-post-edit?do=mark&status=publish'); ?>"><?php _e('标记为<strong>%s</strong>', _t('公开')); ?></a>
</li>
<li>
<a href="<?php $security->index('/action/contents-post-edit?do=mark&status=waiting'); ?>"><?php _e('标记为<strong>%s</strong>', _t('待审核')); ?></a>
</li>
<li>
<a href="<?php $security->index('/action/contents-post-edit?do=mark&status=hidden'); ?>"><?php _e('标记为<strong>%s</strong>', _t('隐藏')); ?></a>
</li>
<li>
<a href="<?php $security->index('/action/contents-post-edit?do=mark&status=private'); ?>"><?php _e('标记为<strong>%s</strong>', _t('私密')); ?></a>
</li>
<?php endif; ?>
</ul>
</div>
</div>
</div>
<?php if($posts->have()): ?>
<ul class="typecho-pager">
<?php $posts->pageNav(); ?>
</ul>
<?php if ($posts->have()): ?>
<ul class="typecho-pager">
<?php $posts->pageNav(); ?>
</ul>
<?php endif; ?>
</form>
</div><!-- end .typecho-list-operate -->

View File

@ -3,54 +3,65 @@ include 'common.php';
include 'header.php';
include 'menu.php';
\Typecho\Widget::widget('Widget_Metas_Tag_Admin')->to($tags);
\Widget\Metas\Tag\Admin::alloc()->to($tags);
?>
<div class="main">
<div class="body container">
<?php include 'page-title.php'; ?>
<div class="row typecho-page-main manage-metas">
<div class="col-mb-12 col-tb-8" role="main">
<form method="post" name="manage_tags" class="operate-form">
<div class="col-mb-12 col-tb-8" role="main">
<form method="post" name="manage_tags" class="operate-form">
<div class="typecho-list-operate clearfix">
<div class="operate">
<label><i class="sr-only"><?php _e('全选'); ?></i><input type="checkbox" class="typecho-table-select-all" /></label>
<div class="btn-group btn-drop">
<button class="btn dropdown-toggle btn-s" type="button"><i class="sr-only"><?php _e('操作'); ?></i><?php _e('选中项'); ?> <i class="i-caret-down"></i></button>
<ul class="dropdown-menu">
<li><a lang="<?php _e('你确认要删除这些标签吗?'); ?>" href="<?php $security->index('/action/metas-tag-edit?do=delete'); ?>"><?php _e('删除'); ?></a></li>
<li><a lang="<?php _e('刷新标签可能需要等待较长时间, 你确认要刷新这些标签吗?'); ?>" href="<?php $security->index('/action/metas-tag-edit?do=refresh'); ?>"><?php _e('刷新'); ?></a></li>
<li class="multiline">
<button type="button" class="btn btn-s merge" rel="<?php $security->index('/action/metas-tag-edit?do=merge'); ?>"><?php _e('合并到'); ?></button>
<input type="text" name="merge" class="text-s" />
</li>
</ul>
</div>
<label><i class="sr-only"><?php _e('全选'); ?></i><input type="checkbox"
class="typecho-table-select-all"/></label>
<div class="btn-group btn-drop">
<button class="btn dropdown-toggle btn-s" type="button"><i
class="sr-only"><?php _e('操作'); ?></i><?php _e('选中项'); ?> <i
class="i-caret-down"></i></button>
<ul class="dropdown-menu">
<li><a lang="<?php _e('你确认要删除这些标签吗?'); ?>"
href="<?php $security->index('/action/metas-tag-edit?do=delete'); ?>"><?php _e('删除'); ?></a>
</li>
<li><a lang="<?php _e('刷新标签可能需要等待较长时间, 你确认要刷新这些标签吗?'); ?>"
href="<?php $security->index('/action/metas-tag-edit?do=refresh'); ?>"><?php _e('刷新'); ?></a>
</li>
<li class="multiline">
<button type="button" class="btn btn-s merge"
rel="<?php $security->index('/action/metas-tag-edit?do=merge'); ?>"><?php _e('合并到'); ?></button>
<input type="text" name="merge" class="text-s"/>
</li>
</ul>
</div>
</div>
</div>
<ul class="typecho-list-notable tag-list clearfix">
<?php if($tags->have()): ?>
<?php while ($tags->next()): ?>
<li class="size-<?php $tags->split(5, 10, 20, 30); ?>" id="<?php $tags->theId(); ?>">
<input type="checkbox" value="<?php $tags->mid(); ?>" name="mid[]"/>
<span rel="<?php echo $request->makeUriByRequest('mid=' . $tags->mid); ?>"><?php $tags->name(); ?></span>
<a class="tag-edit-link" href="<?php echo $request->makeUriByRequest('mid=' . $tags->mid); ?>"><i class="i-edit"></i></a>
</li>
<?php endwhile; ?>
<?php if ($tags->have()): ?>
<?php while ($tags->next()): ?>
<li class="size-<?php $tags->split(5, 10, 20, 30); ?>" id="<?php $tags->theId(); ?>">
<input type="checkbox" value="<?php $tags->mid(); ?>" name="mid[]"/>
<span
rel="<?php echo $request->makeUriByRequest('mid=' . $tags->mid); ?>"><?php $tags->name(); ?></span>
<a class="tag-edit-link"
href="<?php echo $request->makeUriByRequest('mid=' . $tags->mid); ?>"><i
class="i-edit"></i></a>
</li>
<?php endwhile; ?>
<?php else: ?>
<h6 class="typecho-list-table-title"><?php _e('没有任何标签'); ?></h6>
<h6 class="typecho-list-table-title"><?php _e('没有任何标签'); ?></h6>
<?php endif; ?>
</ul>
<input type="hidden" name="do" value="delete" />
</form>
</div>
<div class="col-mb-12 col-tb-4" role="form">
<?php \Typecho\Widget::widget('Widget_Metas_Tag_Edit')->form()->render(); ?>
</div>
<input type="hidden" name="do" value="delete"/>
</form>
</div>
<div class="col-mb-12 col-tb-4" role="form">
<?php \Typecho\Widget::widget('Widget_Metas_Tag_Edit')->form()->render(); ?>
</div>
</div>
</div>
</div>
@ -61,31 +72,31 @@ include 'common-js.php';
?>
<script type="text/javascript">
(function () {
$(document).ready(function () {
(function () {
$(document).ready(function () {
$('.typecho-list-notable').tableSelectable({
checkEl : 'input[type=checkbox]',
rowEl : 'li',
selectAllEl : '.typecho-table-select-all',
actionEl : '.dropdown-menu a'
$('.typecho-list-notable').tableSelectable({
checkEl: 'input[type=checkbox]',
rowEl: 'li',
selectAllEl: '.typecho-table-select-all',
actionEl: '.dropdown-menu a'
});
$('.btn-drop').dropdownMenu({
btnEl: '.dropdown-toggle',
menuEl: '.dropdown-menu'
});
$('.dropdown-menu button.merge').click(function () {
var btn = $(this);
btn.parents('form').attr('action', btn.attr('rel')).submit();
});
<?php if (isset($request->mid)): ?>
$('.typecho-mini-panel').effect('highlight', '#AACB36');
<?php endif; ?>
});
$('.btn-drop').dropdownMenu({
btnEl : '.dropdown-toggle',
menuEl : '.dropdown-menu'
});
$('.dropdown-menu button.merge').click(function () {
var btn = $(this);
btn.parents('form').attr('action', btn.attr('rel')).submit();
});
<?php if (isset($request->mid)): ?>
$('.typecho-mini-panel').effect('highlight', '#AACB36');
<?php endif; ?>
});
})();
})();
</script>
<?php include 'footer.php'; ?>

View File

@ -2,6 +2,8 @@
include 'common.php';
include 'header.php';
include 'menu.php';
$users = \Widget\Users\Admin::alloc();
?>
<div class="main">
<div class="body container">
@ -11,97 +13,116 @@ include 'menu.php';
<div class="typecho-list-operate clearfix">
<form method="get">
<div class="operate">
<label><i class="sr-only"><?php _e('全选'); ?></i><input type="checkbox" class="typecho-table-select-all" /></label>
<label><i class="sr-only"><?php _e('全选'); ?></i><input type="checkbox"
class="typecho-table-select-all"/></label>
<div class="btn-group btn-drop">
<button class="btn dropdown-toggle btn-s" type="button"><i class="sr-only"><?php _e('操作'); ?></i><?php _e('选中项'); ?> <i class="i-caret-down"></i></button>
<ul class="dropdown-menu">
<li><a lang="<?php _e('你确认要删除这些用户吗?'); ?>" href="<?php $security->index('/action/users-edit?do=delete'); ?>"><?php _e('删除'); ?></a></li>
</ul>
</div>
<button class="btn dropdown-toggle btn-s" type="button"><i
class="sr-only"><?php _e('操作'); ?></i><?php _e('选中项'); ?> <i
class="i-caret-down"></i></button>
<ul class="dropdown-menu">
<li><a lang="<?php _e('你确认要删除这些用户吗?'); ?>"
href="<?php $security->index('/action/users-edit?do=delete'); ?>"><?php _e('删除'); ?></a>
</li>
</ul>
</div>
</div>
<div class="search" role="search">
<?php if ('' != $request->keywords): ?>
<a href="<?php $options->adminUrl('manage-users.php'); ?>"><?php _e('&laquo; 取消筛选'); ?></a>
<a href="<?php $options->adminUrl('manage-users.php'); ?>"><?php _e('&laquo; 取消筛选'); ?></a>
<?php endif; ?>
<input type="text" class="text-s" placeholder="<?php _e('请输入关键字'); ?>" value="<?php echo htmlspecialchars($request->keywords); ?>" name="keywords" />
<input type="text" class="text-s" placeholder="<?php _e('请输入关键字'); ?>"
value="<?php echo htmlspecialchars($request->keywords); ?>" name="keywords"/>
<button type="submit" class="btn btn-s"><?php _e('筛选'); ?></button>
</div>
</form>
</div><!-- end .typecho-list-operate -->
<form method="post" name="manage_users" class="operate-form">
<div class="typecho-table-wrap">
<table class="typecho-list-table">
<colgroup>
<col width="20" class="kit-hidden-mb"/>
<col width="6%" class="kit-hidden-mb"/>
<col width="30%"/>
<col width="" class="kit-hidden-mb"/>
<col width="25%" class="kit-hidden-mb"/>
<col width="15%"/>
</colgroup>
<thead>
<div class="typecho-table-wrap">
<table class="typecho-list-table">
<colgroup>
<col width="20" class="kit-hidden-mb"/>
<col width="6%" class="kit-hidden-mb"/>
<col width="30%"/>
<col width="" class="kit-hidden-mb"/>
<col width="25%" class="kit-hidden-mb"/>
<col width="15%"/>
</colgroup>
<thead>
<tr>
<th class="kit-hidden-mb"> </th>
<th class="kit-hidden-mb"> </th>
<th class="kit-hidden-mb"></th>
<th class="kit-hidden-mb"></th>
<th><?php _e('用户名'); ?></th>
<th class="kit-hidden-mb"><?php _e('昵称'); ?></th>
<th class="kit-hidden-mb"><?php _e('电子邮件'); ?></th>
<th><?php _e('用户组'); ?></th>
</tr>
</thead>
<tbody>
<?php \Typecho\Widget::widget('Widget_Users_Admin')->to($users); ?>
<?php while($users->next()): ?>
<tr id="user-<?php $users->uid(); ?>">
<td class="kit-hidden-mb"><input type="checkbox" value="<?php $users->uid(); ?>" name="uid[]"/></td>
<td class="kit-hidden-mb"><a href="<?php $options->adminUrl('manage-posts.php?uid=' . $users->uid); ?>" class="balloon-button left size-<?php echo \Typecho\Common::splitByCount($users->postsNum, 1, 10, 20, 50, 100); ?>"><?php $users->postsNum(); ?></a></td>
<td><a href="<?php $options->adminUrl('user.php?uid=' . $users->uid); ?>"><?php $users->name(); ?></a>
<a href="<?php $users->permalink(); ?>" title="<?php _e('浏览 %s', $users->screenName); ?>"><i class="i-exlink"></i></a>
</td>
<td class="kit-hidden-mb"><?php $users->screenName(); ?></td>
<td class="kit-hidden-mb"><?php if($users->mail): ?><a href="mailto:<?php $users->mail(); ?>"><?php $users->mail(); ?></a><?php else: _e('暂无'); endif; ?></td>
<td><?php switch ($users->group) {
case 'administrator':
_e('管理员');
break;
case 'editor':
_e('编辑');
break;
case 'contributor':
_e('贡献者');
break;
case 'subscriber':
_e('关注者');
break;
case 'visitor':
_e('访问者');
break;
default:
break;
} ?></td>
</tr>
</thead>
<tbody>
<?php while ($users->next()): ?>
<tr id="user-<?php $users->uid(); ?>">
<td class="kit-hidden-mb"><input type="checkbox" value="<?php $users->uid(); ?>"
name="uid[]"/></td>
<td class="kit-hidden-mb"><a
href="<?php $options->adminUrl('manage-posts.php?uid=' . $users->uid); ?>"
class="balloon-button left size-<?php echo \Typecho\Common::splitByCount($users->postsNum, 1, 10, 20, 50, 100); ?>"><?php $users->postsNum(); ?></a>
</td>
<td>
<a href="<?php $options->adminUrl('user.php?uid=' . $users->uid); ?>"><?php $users->name(); ?></a>
<a href="<?php $users->permalink(); ?>"
title="<?php _e('浏览 %s', $users->screenName); ?>"><i
class="i-exlink"></i></a>
</td>
<td class="kit-hidden-mb"><?php $users->screenName(); ?></td>
<td class="kit-hidden-mb"><?php if ($users->mail): ?><a
href="mailto:<?php $users->mail(); ?>"><?php $users->mail(); ?></a><?php else: _e('暂无'); endif; ?>
</td>
<td><?php switch ($users->group) {
case 'administrator':
_e('管理员');
break;
case 'editor':
_e('编辑');
break;
case 'contributor':
_e('贡献者');
break;
case 'subscriber':
_e('关注者');
break;
case 'visitor':
_e('访问者');
break;
default:
break;
} ?></td>
</tr>
<?php endwhile; ?>
</tbody>
</table><!-- end .typecho-list-table -->
</div><!-- end .typecho-table-wrap -->
</tbody>
</table><!-- end .typecho-list-table -->
</div><!-- end .typecho-table-wrap -->
</form><!-- end .operate-form -->
<div class="typecho-list-operate clearfix">
<form method="get">
<div class="operate">
<label><i class="sr-only"><?php _e('全选'); ?></i><input type="checkbox" class="typecho-table-select-all" /></label>
<label><i class="sr-only"><?php _e('全选'); ?></i><input type="checkbox"
class="typecho-table-select-all"/></label>
<div class="btn-group btn-drop">
<button class="btn dropdown-toggle btn-s" type="button"><i class="sr-only"><?php _e('操作'); ?></i><?php _e('选中项'); ?> <i class="i-caret-down"></i></button>
<ul class="dropdown-menu">
<li><a lang="<?php _e('你确认要删除这些用户吗?'); ?>" href="<?php $security->index('/action/users-edit?do=delete'); ?>"><?php _e('删除'); ?></a></li>
</ul>
</div>
<button class="btn dropdown-toggle btn-s" type="button"><i
class="sr-only"><?php _e('操作'); ?></i><?php _e('选中项'); ?> <i
class="i-caret-down"></i></button>
<ul class="dropdown-menu">
<li><a lang="<?php _e('你确认要删除这些用户吗?'); ?>"
href="<?php $security->index('/action/users-edit?do=delete'); ?>"><?php _e('删除'); ?></a>
</li>
</ul>
</div>
</div>
<?php if($users->have()): ?>
<ul class="typecho-pager">
<?php $users->pageNav(); ?>
</ul>
<?php if ($users->have()): ?>
<ul class="typecho-pager">
<?php $users->pageNav(); ?>
</ul>
<?php endif; ?>
</form>
</div><!-- end .typecho-list-operate -->

View File

@ -9,7 +9,7 @@ if (preg_match("/^([0-9]+)([a-z]{1,2})$/i", $phpMaxFilesize, $matches)) {
$phpMaxFilesize = strtolower($matches[1] . $matches[2] . (1 == strlen($matches[2]) ? 'b' : ''));
}
\Typecho\Widget::widget('Widget_Contents_Attachment_Edit')->to($attachment);
$attachment = \Widget\Contents\Attachment\Edit::alloc();
?>
<div class="main">
@ -18,9 +18,10 @@ if (preg_match("/^([0-9]+)([a-z]{1,2})$/i", $phpMaxFilesize, $matches)) {
<div class="row typecho-page-main">
<div class="col-mb-12 col-tb-8" role="main">
<?php if ($attachment->attachment->isImage): ?>
<p><img src="<?php $attachment->attachment->url(); ?>" alt="<?php $attachment->attachment->name(); ?>" class="typecho-attachment-photo" /></p>
<p><img src="<?php $attachment->attachment->url(); ?>"
alt="<?php $attachment->attachment->name(); ?>" class="typecho-attachment-photo"/></p>
<?php endif; ?>
<p>
<?php $mime = \Typecho\Common::mimeIconType($attachment->attachment->mime); ?>
<i class="mime-<?php echo $mime; ?>"></i>
@ -29,11 +30,13 @@ if (preg_match("/^([0-9]+)([a-z]{1,2})$/i", $phpMaxFilesize, $matches)) {
</p>
<p>
<input id="attachment-url" type="text" class="mono w-100" value="<?php $attachment->attachment->url(); ?>" readonly />
<input id="attachment-url" type="text" class="mono w-100"
value="<?php $attachment->attachment->url(); ?>" readonly/>
</p>
<div id="upload-panel" class="p">
<div class="upload-area" draggable="true"><?php _e('拖放文件到这里<br>或者 %s选择文件上传%s', '<a href="###" class="upload-file">', '</a>'); ?></div>
<div class="upload-area"
draggable="true"><?php _e('拖放文件到这里<br>或者 %s选择文件上传%s', '<a href="###" class="upload-file">', '</a>'); ?></div>
<ul id="file-list"></ul>
</div>
</div>
@ -51,143 +54,146 @@ include 'common-js.php';
<script src="<?php $options->adminStaticUrl('js', 'moxie.js'); ?>"></script>
<script src="<?php $options->adminStaticUrl('js', 'plupload.js'); ?>"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#attachment-url').click(function () {
$(this).select();
});
$('.operate-delete').click(function () {
var t = $(this), href = t.attr('href');
if (confirm(t.attr('lang'))) {
window.location.href = href;
}
return false;
});
$('.upload-area').bind({
dragenter : function () {
$(this).parent().addClass('drag');
},
dragover : function (e) {
$(this).parent().addClass('drag');
},
drop : function () {
$(this).parent().removeClass('drag');
},
dragend : function () {
$(this).parent().removeClass('drag');
},
dragleave : function () {
$(this).parent().removeClass('drag');
}
});
function fileUploadStart (file) {
$('<ul id="file-list"></ul>').appendTo('#upload-panel');
$('<li id="' + file.id + '" class="loading">'
+ file.name + '</li>').prependTo('#file-list');
}
function fileUploadError (error) {
var file = error.file, code = error.code, word;
switch (code) {
case plupload.FILE_SIZE_ERROR:
word = '<?php _e('文件大小超过限制'); ?>';
break;
case plupload.FILE_EXTENSION_ERROR:
word = '<?php _e('文件扩展名不被支持'); ?>';
break;
case plupload.FILE_DUPLICATE_ERROR:
word = '<?php _e('文件已经上传过'); ?>';
break;
case plupload.HTTP_ERROR:
default:
word = '<?php _e('上传出现错误'); ?>';
break;
}
var fileError = '<?php _e('%s 上传失败'); ?>'.replace('%s', file.name),
li, exist = $('#' + file.id);
if (exist.length > 0) {
li = exist.removeClass('loading').html(fileError);
} else {
$('<ul id="file-list"></ul>').appendTo('#upload-panel');
li = $('<li>' + fileError + '<br />' + word + '</li>').prependTo('#file-list');
}
li.effect('highlight', {color : '#FBC2C4'}, 2000, function () {
$(this).remove();
$(document).ready(function () {
$('#attachment-url').click(function () {
$(this).select();
});
}
function fileUploadComplete (id, url, data) {
var img = $('.typecho-attachment-photo');
$('.operate-delete').click(function () {
var t = $(this), href = t.attr('href');
if (img.length > 0) {
img.get(0).src = '<?php $attachment->attachment->url(); ?>?' + Math.random();
}
$('#' + id).html('<?php _e('文件 %s 已经替换'); ?>'.replace('%s', data.title))
.effect('highlight', 1000, function () {
$(this).remove();
$('#file-list').remove();
});
}
var uploader = new plupload.Uploader({
browse_button : $('.upload-file').get(0),
url : '<?php $security->index('/action/upload?do=modify&cid=' . $attachment->cid); ?>',
runtimes : 'html5,flash,html4',
flash_swf_url : '<?php $options->adminStaticUrl('js', 'Moxie.swf'); ?>',
drop_element : $('.upload-area').get(0),
filters : {
max_file_size : '<?php echo $phpMaxFilesize ?>',
mime_types : [{'title' : '<?php _e('允许上传的文件'); ?>', 'extensions' : '<?php $attachment->attachment->type(); ?>'}],
prevent_duplicates : true
},
multi_selection : false,
init : {
FilesAdded : function (up, files) {
plupload.each(files, function(file) {
fileUploadStart(file);
});
uploader.start();
},
FileUploaded : function (up, file, result) {
if (200 == result.status) {
var data = $.parseJSON(result.response);
if (data) {
fileUploadComplete(file.id, data[0], data[1]);
return;
}
}
fileUploadError({
code : plupload.HTTP_ERROR,
file : file
});
},
Error : function (up, error) {
fileUploadError(error);
if (confirm(t.attr('lang'))) {
window.location.href = href;
}
}
});
uploader.init();
});
return false;
});
$('.upload-area').bind({
dragenter: function () {
$(this).parent().addClass('drag');
},
dragover: function (e) {
$(this).parent().addClass('drag');
},
drop: function () {
$(this).parent().removeClass('drag');
},
dragend: function () {
$(this).parent().removeClass('drag');
},
dragleave: function () {
$(this).parent().removeClass('drag');
}
});
function fileUploadStart(file) {
$('<ul id="file-list"></ul>').appendTo('#upload-panel');
$('<li id="' + file.id + '" class="loading">'
+ file.name + '</li>').prependTo('#file-list');
}
function fileUploadError(error) {
var file = error.file, code = error.code, word;
switch (code) {
case plupload.FILE_SIZE_ERROR:
word = '<?php _e('文件大小超过限制'); ?>';
break;
case plupload.FILE_EXTENSION_ERROR:
word = '<?php _e('文件扩展名不被支持'); ?>';
break;
case plupload.FILE_DUPLICATE_ERROR:
word = '<?php _e('文件已经上传过'); ?>';
break;
case plupload.HTTP_ERROR:
default:
word = '<?php _e('上传出现错误'); ?>';
break;
}
var fileError = '<?php _e('%s 上传失败'); ?>'.replace('%s', file.name),
li, exist = $('#' + file.id);
if (exist.length > 0) {
li = exist.removeClass('loading').html(fileError);
} else {
$('<ul id="file-list"></ul>').appendTo('#upload-panel');
li = $('<li>' + fileError + '<br />' + word + '</li>').prependTo('#file-list');
}
li.effect('highlight', {color: '#FBC2C4'}, 2000, function () {
$(this).remove();
});
}
function fileUploadComplete(id, url, data) {
var img = $('.typecho-attachment-photo');
if (img.length > 0) {
img.get(0).src = '<?php $attachment->attachment->url(); ?>?' + Math.random();
}
$('#' + id).html('<?php _e('文件 %s 已经替换'); ?>'.replace('%s', data.title))
.effect('highlight', 1000, function () {
$(this).remove();
$('#file-list').remove();
});
}
var uploader = new plupload.Uploader({
browse_button: $('.upload-file').get(0),
url: '<?php $security->index('/action/upload?do=modify&cid=' . $attachment->cid); ?>',
runtimes: 'html5,flash,html4',
flash_swf_url: '<?php $options->adminStaticUrl('js', 'Moxie.swf'); ?>',
drop_element: $('.upload-area').get(0),
filters: {
max_file_size: '<?php echo $phpMaxFilesize ?>',
mime_types: [{
'title': '<?php _e('允许上传的文件'); ?>',
'extensions': '<?php $attachment->attachment->type(); ?>'
}],
prevent_duplicates: true
},
multi_selection: false,
init: {
FilesAdded: function (up, files) {
plupload.each(files, function (file) {
fileUploadStart(file);
});
uploader.start();
},
FileUploaded: function (up, file, result) {
if (200 == result.status) {
var data = $.parseJSON(result.response);
if (data) {
fileUploadComplete(file.id, data[0], data[1]);
return;
}
}
fileUploadError({
code: plupload.HTTP_ERROR,
file: file
});
},
Error: function (up, error) {
fileUploadError(error);
}
}
});
uploader.init();
});
</script>
<?php
include 'footer.php';

View File

@ -1,4 +1,4 @@
<?php if(!defined('__TYPECHO_ADMIN__')) exit; ?>
<?php if (!defined('__TYPECHO_ADMIN__')) exit; ?>
<div class="typecho-head-nav clearfix" role="navigation">
<button class="menu-bar"><?php _e('菜单'); ?></button>
<nav id="typecho-nav-list">
@ -6,11 +6,13 @@
</nav>
<div class="operate">
<?php \Typecho\Plugin::factory('admin/menu.php')->navBar(); ?><a title="<?php
if ($user->logged > 0) {
$logged = new \Typecho\Date($user->logged);
_e('最后登录: %s', $logged->word());
}
?>" href="<?php $options->adminUrl('profile.php'); ?>" class="author"><?php $user->screenName(); ?></a><a class="exit" href="<?php $options->logoutUrl(); ?>"><?php _e('登出'); ?></a><a href="<?php $options->siteUrl(); ?>"><?php _e('网站'); ?></a>
if ($user->logged > 0) {
$logged = new \Typecho\Date($user->logged);
_e('最后登录: %s', $logged->word());
}
?>" href="<?php $options->adminUrl('profile.php'); ?>" class="author"><?php $user->screenName(); ?></a><a
class="exit" href="<?php $options->logoutUrl(); ?>"><?php _e('登出'); ?></a><a
href="<?php $options->siteUrl(); ?>"><?php _e('网站'); ?></a>
</div>
</div>

View File

@ -9,7 +9,7 @@ include 'menu.php';
<?php include 'page-title.php'; ?>
<div class="row typecho-page-main" role="form">
<div class="col-mb-12 col-tb-8 col-tb-offset-2">
<?php \Typecho\Widget::widget('Widget_Options_Discussion')->form()->render(); ?>
<?php \Widget\Options\Discussion::alloc()->form()->render(); ?>
</div>
</div>
</div>

View File

@ -9,7 +9,7 @@ include 'menu.php';
<?php include 'page-title.php'; ?>
<div class="row typecho-page-main" role="form">
<div class="col-mb-12 col-tb-8 col-tb-offset-2">
<?php \Typecho\Widget::widget('Widget_Options_General')->form()->render(); ?>
<?php \Widget\Options\General::alloc()->form()->render(); ?>
</div>
</div>
</div>

View File

@ -9,7 +9,7 @@ include 'menu.php';
<?php include 'page-title.php'; ?>
<div class="row typecho-page-main" role="form">
<div class="col-mb-12 col-tb-8 col-tb-offset-2">
<?php \Typecho\Widget::widget('Widget_Options_Permalink')->form()->render(); ?>
<?php \Widget\Options\Permalink::alloc()->form()->render(); ?>
</div>
</div>
</div>

View File

@ -9,7 +9,7 @@ include 'menu.php';
<?php include 'page-title.php'; ?>
<div class="row typecho-page-main" role="form">
<div class="col-mb-12 col-tb-8 col-tb-offset-2">
<?php \Typecho\Widget::widget('Widget_Plugins_Config')->config()->render(); ?>
<?php \Widget\Plugins\Config::alloc()->config()->render(); ?>
</div>
</div>
</div>

View File

@ -9,7 +9,7 @@ include 'menu.php';
<?php include 'page-title.php'; ?>
<div class="row typecho-page-main" role="form">
<div class="col-mb-12 col-tb-8 col-tb-offset-2">
<?php \Typecho\Widget::widget('Widget_Options_Reading')->form()->render(); ?>
<?php \Widget\Options\Reading::alloc()->form()->render(); ?>
</div>
</div>
</div>

View File

@ -14,11 +14,12 @@ include 'menu.php';
<?php if (!defined('__TYPECHO_THEME_WRITEABLE__') || __TYPECHO_THEME_WRITEABLE__): ?>
<li><a href="<?php $options->adminUrl('theme-editor.php'); ?>"><?php _e('编辑当前外观'); ?></a></li>
<?php endif; ?>
<li class="current"><a href="<?php $options->adminUrl('options-theme.php'); ?>"><?php _e('设置外观'); ?></a></li>
<li class="current"><a
href="<?php $options->adminUrl('options-theme.php'); ?>"><?php _e('设置外观'); ?></a></li>
</ul>
</div>
<div class="col-mb-12 col-tb-8 col-tb-offset-2" role="form">
<?php \Typecho\Widget::widget('Widget_Themes_Config')->config()->render(); ?>
<?php \Widget\Themes\Config::alloc()->config()->render(); ?>
</div>
</div>
</div>

View File

@ -8,19 +8,19 @@ include 'menu.php';
<?php include 'page-title.php'; ?>
<div class="row typecho-page-main" role="main">
<div class="col-mb-12 typecho-list">
<?php \Typecho\Widget::widget('Widget_Plugins_List@activated', 'activated=1')->to($activatedPlugins); ?>
<?php \Widget\Plugins\Rows::allocWithAlias('activated', 'activated=1')->to($activatedPlugins); ?>
<?php if ($activatedPlugins->have() || !empty($activatedPlugins->activatedPlugins)): ?>
<h4 class="typecho-list-table-title"><?php _e('启用的插件'); ?></h4>
<div class="typecho-table-wrap">
<table class="typecho-list-table">
<colgroup>
<col width="25%"/>
<col width="45%"/>
<col width="8%" class="kit-hidden-mb"/>
<col width="10%" class="kit-hidden-mb"/>
<col width=""/>
</colgroup>
<thead>
<h4 class="typecho-list-table-title"><?php _e('启用的插件'); ?></h4>
<div class="typecho-table-wrap">
<table class="typecho-list-table">
<colgroup>
<col width="25%"/>
<col width="45%"/>
<col width="8%" class="kit-hidden-mb"/>
<col width="10%" class="kit-hidden-mb"/>
<col width=""/>
</colgroup>
<thead>
<tr>
<th><?php _e('名称'); ?></th>
<th><?php _e('描述'); ?></th>
@ -28,61 +28,66 @@ include 'menu.php';
<th class="kit-hidden-mb"><?php _e('作者'); ?></th>
<th><?php _e('操作'); ?></th>
</tr>
</thead>
<tbody>
</thead>
<tbody>
<?php while ($activatedPlugins->next()): ?>
<tr id="plugin-<?php $activatedPlugins->name(); ?>">
<td><?php $activatedPlugins->title(); ?>
<?php if (!$activatedPlugins->dependence): ?>
<i class="i-delete" title="<?php _e('%s 无法在此版本的typecho下正常工作', $activatedPlugins->title); ?>"></i>
<?php endif; ?>
</td>
<td><?php $activatedPlugins->description(); ?></td>
<td class="kit-hidden-mb"><?php $activatedPlugins->version(); ?></td>
<td class="kit-hidden-mb"><?php echo empty($activatedPlugins->homepage) ? $activatedPlugins->author : '<a href="' . $activatedPlugins->homepage
. '">' . $activatedPlugins->author . '</a>'; ?></td>
<td>
<?php if ($activatedPlugins->activate || $activatedPlugins->deactivate || $activatedPlugins->config || $activatedPlugins->personalConfig): ?>
<?php if ($activatedPlugins->config): ?>
<a href="<?php $options->adminUrl('options-plugin.php?config=' . $activatedPlugins->name); ?>"><?php _e('设置'); ?></a>
&bull;
<tr id="plugin-<?php $activatedPlugins->name(); ?>">
<td><?php $activatedPlugins->title(); ?>
<?php if (!$activatedPlugins->dependence): ?>
<i class="i-delete"
title="<?php _e('%s 无法在此版本的typecho下正常工作', $activatedPlugins->title); ?>"></i>
<?php endif; ?>
<a lang="<?php _e('你确认要禁用插件 %s 吗?', $activatedPlugins->name); ?>" href="<?php $security->index('/action/plugins-edit?deactivate=' . $activatedPlugins->name); ?>"><?php _e('禁用'); ?></a>
<?php else: ?>
<span class="important"><?php _e('即插即用'); ?></span>
<?php endif; ?>
</td>
</tr>
</td>
<td><?php $activatedPlugins->description(); ?></td>
<td class="kit-hidden-mb"><?php $activatedPlugins->version(); ?></td>
<td class="kit-hidden-mb"><?php echo empty($activatedPlugins->homepage) ? $activatedPlugins->author : '<a href="' . $activatedPlugins->homepage
. '">' . $activatedPlugins->author . '</a>'; ?></td>
<td>
<?php if ($activatedPlugins->activate || $activatedPlugins->deactivate || $activatedPlugins->config || $activatedPlugins->personalConfig): ?>
<?php if ($activatedPlugins->config): ?>
<a href="<?php $options->adminUrl('options-plugin.php?config=' . $activatedPlugins->name); ?>"><?php _e('设置'); ?></a>
&bull;
<?php endif; ?>
<a lang="<?php _e('你确认要禁用插件 %s 吗?', $activatedPlugins->name); ?>"
href="<?php $security->index('/action/plugins-edit?deactivate=' . $activatedPlugins->name); ?>"><?php _e('禁用'); ?></a>
<?php else: ?>
<span class="important"><?php _e('即插即用'); ?></span>
<?php endif; ?>
</td>
</tr>
<?php endwhile; ?>
<?php if (!empty($activatedPlugins->activatedPlugins)): ?>
<?php foreach ($activatedPlugins->activatedPlugins as $key => $val): ?>
<tr>
<td><?php echo $key; ?></td>
<td colspan="3"><span class="warning"><?php _e('此插件文件已经损坏或者被不安全移除, 强烈建议你禁用它'); ?></span></td>
<td><a lang="<?php _e('你确认要禁用插件 %s 吗?', $key); ?>" href="<?php $security->index('/action/plugins-edit?deactivate=' . $key); ?>"><?php _e('禁用'); ?></a></td>
</tr>
<?php endforeach; ?>
<?php foreach ($activatedPlugins->activatedPlugins as $key => $val): ?>
<tr>
<td><?php echo $key; ?></td>
<td colspan="3"><span
class="warning"><?php _e('此插件文件已经损坏或者被不安全移除, 强烈建议你禁用它'); ?></span></td>
<td><a lang="<?php _e('你确认要禁用插件 %s 吗?', $key); ?>"
href="<?php $security->index('/action/plugins-edit?deactivate=' . $key); ?>"><?php _e('禁用'); ?></a>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div>
</tbody>
</table>
</div>
<?php endif; ?>
<?php \Typecho\Widget::widget('Widget_Plugins_List@unactivated', 'activated=0')->to($deactivatedPlugins); ?>
<?php \Widget\Plugins\Rows::allocWithAlias('unactivated', 'activated=0')->to($deactivatedPlugins); ?>
<?php if ($deactivatedPlugins->have() || !$activatedPlugins->have()): ?>
<h4 class="typecho-list-table-title"><?php _e('禁用的插件'); ?></h4>
<div class="typecho-table-wrap">
<table class="typecho-list-table deactivate">
<colgroup>
<col width="25%"/>
<col width="45%"/>
<col width="8%" class="kit-hidden-mb"/>
<col width="10%" class="kit-hidden-mb"/>
<col width=""/>
</colgroup>
<thead>
<h4 class="typecho-list-table-title"><?php _e('禁用的插件'); ?></h4>
<div class="typecho-table-wrap">
<table class="typecho-list-table deactivate">
<colgroup>
<col width="25%"/>
<col width="45%"/>
<col width="8%" class="kit-hidden-mb"/>
<col width="10%" class="kit-hidden-mb"/>
<col width=""/>
</colgroup>
<thead>
<tr>
<th><?php _e('名称'); ?></th>
<th><?php _e('描述'); ?></th>
@ -90,31 +95,32 @@ include 'menu.php';
<th class="kit-hidden-mb"><?php _e('作者'); ?></th>
<th class="typecho-radius-topright"><?php _e('操作'); ?></th>
</tr>
</thead>
<tbody>
</thead>
<tbody>
<?php if ($deactivatedPlugins->have()): ?>
<?php while ($deactivatedPlugins->next()): ?>
<tr id="plugin-<?php $deactivatedPlugins->name(); ?>">
<td><?php $deactivatedPlugins->title(); ?></td>
<td><?php $deactivatedPlugins->description(); ?></td>
<td class="kit-hidden-mb"><?php $deactivatedPlugins->version(); ?></td>
<td class="kit-hidden-mb"><?php echo empty($deactivatedPlugins->homepage) ? $deactivatedPlugins->author : '<a href="' . $deactivatedPlugins->homepage
. '">' . $deactivatedPlugins->author . '</a>'; ?></td>
<td>
<a href="<?php $security->index('/action/plugins-edit?activate=' . $deactivatedPlugins->name); ?>"><?php _e('启用'); ?></a>
</td>
</tr>
<?php endwhile; ?>
<?php while ($deactivatedPlugins->next()): ?>
<tr id="plugin-<?php $deactivatedPlugins->name(); ?>">
<td><?php $deactivatedPlugins->title(); ?></td>
<td><?php $deactivatedPlugins->description(); ?></td>
<td class="kit-hidden-mb"><?php $deactivatedPlugins->version(); ?></td>
<td class="kit-hidden-mb"><?php echo empty($deactivatedPlugins->homepage) ? $deactivatedPlugins->author : '<a href="' . $deactivatedPlugins->homepage
. '">' . $deactivatedPlugins->author . '</a>'; ?></td>
<td>
<a href="<?php $security->index('/action/plugins-edit?activate=' . $deactivatedPlugins->name); ?>"><?php _e('启用'); ?></a>
</td>
</tr>
<?php endwhile; ?>
<?php else: ?>
<tr>
<td colspan="5"><h6 class="typecho-list-table-title"><?php _e('没有安装插件'); ?></h6></td>
</tr>
<tr>
<td colspan="5"><h6 class="typecho-list-table-title"><?php _e('没有安装插件'); ?></h6>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</tbody>
</table>
</div>
<?php endif; ?>
</div>
</div>
</div>

View File

@ -3,7 +3,7 @@
include 'common.php';
/** 获取内容 Widget */
\Typecho\Widget::widget('Widget_Archive', 'type=single&checkPermalink=0&preview=1')->to($content);
\Widget\Archive::alloc('type=single&checkPermalink=0&preview=1')->to($content);
/** 检测是否存在 */
if (!$content->have()) {
@ -24,4 +24,4 @@ $content->render();
window.parent.postMessage('cancelPreview', '<?php $options->rootUrl(); ?>');
}
}
</script>
</script>

View File

@ -3,7 +3,7 @@ include 'common.php';
include 'header.php';
include 'menu.php';
$stat = \Typecho\Widget::widget('Widget_Stat');
$stat = \Widget\Stat::alloc();
?>
<div class="main">
@ -11,17 +11,19 @@ $stat = \Typecho\Widget::widget('Widget_Stat');
<?php include 'page-title.php'; ?>
<div class="row typecho-page-main">
<div class="col-mb-12 col-tb-3">
<p><a href="http://gravatar.com/emails/" title="<?php _e('在 Gravatar 上修改头像'); ?>"><?php echo '<img class="profile-avatar" src="' . \Typecho\Common::gravatarUrl($user->mail, 220, 'X', 'mm', $request->isSecure()) . '" alt="' . $user->screenName . '" />'; ?></a></p>
<p><a href="http://gravatar.com/emails/"
title="<?php _e('在 Gravatar 上修改头像'); ?>"><?php echo '<img class="profile-avatar" src="' . \Typecho\Common::gravatarUrl($user->mail, 220, 'X', 'mm', $request->isSecure()) . '" alt="' . $user->screenName . '" />'; ?></a>
</p>
<h2><?php $user->screenName(); ?></h2>
<p><?php $user->name(); ?></p>
<p><?php _e('目前有 <em>%s</em> 篇日志, 并有 <em>%s</em> 条关于你的评论在 <em>%s</em> 个分类中.',
$stat->myPublishedPostsNum, $stat->myPublishedCommentsNum, $stat->categoriesNum); ?></p>
<p><?php _e('目前有 <em>%s</em> 篇日志, 并有 <em>%s</em> 条关于你的评论在 <em>%s</em> 个分类中.',
$stat->myPublishedPostsNum, $stat->myPublishedCommentsNum, $stat->categoriesNum); ?></p>
<p><?php
if ($user->logged > 0) {
$logged = new \Typecho\Date($user->logged);
_e('最后登录: %s', $logged->word());
}
?></p>
if ($user->logged > 0) {
$logged = new \Typecho\Date($user->logged);
_e('最后登录: %s', $logged->word());
}
?></p>
</div>
<div class="col-mb-12 col-tb-6 col-tb-offset-1 typecho-content-panel" role="form">
@ -30,12 +32,12 @@ $stat = \Typecho\Widget::widget('Widget_Stat');
<?php \Typecho\Widget::widget('Widget_Users_Profile')->profileForm()->render(); ?>
</section>
<?php if($user->pass('contributor', true)): ?>
<br>
<section id="writing-option">
<h3><?php _e('撰写设置'); ?></h3>
<?php \Typecho\Widget::widget('Widget_Users_Profile')->optionsForm()->render(); ?>
</section>
<?php if ($user->pass('contributor', true)): ?>
<br>
<section id="writing-option">
<h3><?php _e('撰写设置'); ?></h3>
<?php \Typecho\Widget::widget('Widget_Users_Profile')->optionsForm()->render(); ?>
</section>
<?php endif; ?>
<br>

View File

@ -78,12 +78,6 @@ a.button:hover, a.balloon-button:hover {
@import "header";
@import "footer";
/* 低版本浏览器升级提示 */
.browsehappy {
border: none;
text-align: center;
}
/** 顶部消息样式 by 70 */
.popup {
display: none;

View File

@ -3,7 +3,7 @@ include 'common.php';
include 'header.php';
include 'menu.php';
\Typecho\Widget::widget('Widget_Themes_Files')->to($files);
\Widget\Themes\Files::alloc()->to($files);
?>
<div class="main">
@ -14,28 +14,30 @@ include 'menu.php';
<ul class="typecho-option-tabs fix-tabs clearfix">
<li><a href="<?php $options->adminUrl('themes.php'); ?>"><?php _e('可以使用的外观'); ?></a></li>
<li class="current"><a href="<?php $options->adminUrl('theme-editor.php'); ?>">
<?php if ($options->theme == $files->theme): ?>
<?php _e('编辑当前外观'); ?>
<?php else: ?>
<?php _e('编辑%s外观', ' <cite>' . $files->theme . '</cite> '); ?>
<?php endif; ?>
</a></li>
<?php if (Widget_Themes_Config::isExists()): ?>
<li><a href="<?php $options->adminUrl('options-theme.php'); ?>"><?php _e('设置外观'); ?></a></li>
<?php if ($options->theme == $files->theme): ?>
<?php _e('编辑当前外观'); ?>
<?php else: ?>
<?php _e('编辑%s外观', ' <cite>' . $files->theme . '</cite> '); ?>
<?php endif; ?>
</a></li>
<?php if (\Widget\Themes\Config::isExists()): ?>
<li><a href="<?php $options->adminUrl('options-theme.php'); ?>"><?php _e('设置外观'); ?></a></li>
<?php endif; ?>
</ul>
</div>
<div class="typecho-edit-theme">
<div class="col-mb-12 col-tb-8 col-9 content">
<form method="post" name="theme" id="theme" action="<?php $security->index('/action/themes-edit'); ?>">
<form method="post" name="theme" id="theme"
action="<?php $security->index('/action/themes-edit'); ?>">
<label for="content" class="sr-only"><?php _e('编辑源码'); ?></label>
<textarea name="content" id="content" class="w-100 mono" <?php if(!$files->currentIsWriteable()): ?>readonly<?php endif; ?>><?php echo $files->currentContent(); ?></textarea>
<textarea name="content" id="content" class="w-100 mono"
<?php if (!$files->currentIsWriteable()): ?>readonly<?php endif; ?>><?php echo $files->currentContent(); ?></textarea>
<p class="typecho-option typecho-option-submit">
<?php if($files->currentIsWriteable()): ?>
<input type="hidden" name="theme" value="<?php echo $files->currentTheme(); ?>" />
<input type="hidden" name="edit" value="<?php echo $files->currentFile(); ?>" />
<button type="submit" class="btn primary"><?php _e('保存文件'); ?></button>
<?php if ($files->currentIsWriteable()): ?>
<input type="hidden" name="theme" value="<?php echo $files->currentTheme(); ?>"/>
<input type="hidden" name="edit" value="<?php echo $files->currentFile(); ?>"/>
<button type="submit" class="btn primary"><?php _e('保存文件'); ?></button>
<?php else: ?>
<em><?php _e('此文件无法写入'); ?></em>
<?php endif; ?>
@ -44,9 +46,10 @@ include 'menu.php';
</div>
<ul class="col-mb-12 col-tb-4 col-3">
<li><strong>模板文件</strong></li>
<?php while($files->next()): ?>
<li<?php if($files->current): ?> class="current"<?php endif; ?>>
<a href="<?php $options->adminUrl('theme-editor.php?theme=' . $files->currentTheme() . '&file=' . $files->file); ?>"><?php $files->file(); ?></a></li>
<?php while ($files->next()): ?>
<li<?php if ($files->current): ?> class="current"<?php endif; ?>>
<a href="<?php $options->adminUrl('theme-editor.php?theme=' . $files->currentTheme() . '&file=' . $files->file); ?>"><?php $files->file(); ?></a>
</li>
<?php endwhile; ?>
</ul>
</div>

View File

@ -10,50 +10,55 @@ include 'menu.php';
<div class="row typecho-page-main" role="main">
<div class="col-mb-12">
<ul class="typecho-option-tabs fix-tabs clearfix">
<li class="current"><a href="<?php $options->adminUrl('themes.php'); ?>"><?php _e('可以使用的外观'); ?></a></li>
<li class="current"><a href="<?php $options->adminUrl('themes.php'); ?>"><?php _e('可以使用的外观'); ?></a>
</li>
<?php if (!defined('__TYPECHO_THEME_WRITEABLE__') || __TYPECHO_THEME_WRITEABLE__): ?>
<li><a href="<?php $options->adminUrl('theme-editor.php'); ?>"><?php _e('编辑当前外观'); ?></a></li>
<li><a href="<?php $options->adminUrl('theme-editor.php'); ?>"><?php _e('编辑当前外观'); ?></a></li>
<?php endif; ?>
<?php if (Widget_Themes_Config::isExists()): ?>
<li><a href="<?php $options->adminUrl('options-theme.php'); ?>"><?php _e('设置外观'); ?></a></li>
<?php if (\Widget\Themes\Config::isExists()): ?>
<li><a href="<?php $options->adminUrl('options-theme.php'); ?>"><?php _e('设置外观'); ?></a></li>
<?php endif; ?>
</ul>
<div class="typecho-table-wrap">
<table class="typecho-list-table typecho-theme-list">
<colgroup>
<col width="35%" />
<col />
<col width="35%"/>
<col/>
</colgroup>
<thead>
<th><?php _e('截图'); ?></th>
<th><?php _e('详情'); ?></th>
<th><?php _e('截图'); ?></th>
<th><?php _e('详情'); ?></th>
</thead>
<tbody>
<?php \Typecho\Widget::widget('Widget_Themes_List')->to($themes); ?>
<?php while($themes->next()): ?>
<tr id="theme-<?php $themes->name(); ?>" class="<?php if($themes->activated): ?>current<?php endif; ?>">
<td valign="top"><img src="<?php $themes->screen(); ?>" alt="<?php $themes->name(); ?>" /></td>
<?php \Widget\Themes\Rows::alloc()->to($themes); ?>
<?php while ($themes->next()): ?>
<tr id="theme-<?php $themes->name(); ?>"
class="<?php if ($themes->activated): ?>current<?php endif; ?>">
<td valign="top"><img src="<?php $themes->screen(); ?>"
alt="<?php $themes->name(); ?>"/></td>
<td valign="top">
<h3><?php '' != $themes->title ? $themes->title() : $themes->name(); ?></h3>
<cite>
<?php if($themes->author): ?><?php _e('作者'); ?>: <?php if($themes->homepage): ?><a href="<?php $themes->homepage() ?>"><?php endif; ?><?php $themes->author(); ?><?php if($themes->homepage): ?></a><?php endif; ?> &nbsp;&nbsp;<?php endif; ?>
<?php if($themes->version): ?><?php _e('版本'); ?>: <?php $themes->version() ?><?php endif; ?>
<?php if ($themes->author): ?><?php _e('作者'); ?>: <?php if ($themes->homepage): ?><a href="<?php $themes->homepage() ?>"><?php endif; ?><?php $themes->author(); ?><?php if ($themes->homepage): ?></a><?php endif; ?> &nbsp;&nbsp;<?php endif; ?>
<?php if ($themes->version): ?><?php _e('版本'); ?>: <?php $themes->version() ?><?php endif; ?>
</cite>
<p><?php echo nl2br($themes->description); ?></p>
<?php if($options->theme != $themes->name): ?>
<?php if ($options->theme != $themes->name): ?>
<p>
<?php if (!defined('__TYPECHO_THEME_WRITEABLE__') || __TYPECHO_THEME_WRITEABLE__): ?>
<a class="edit" href="<?php $options->adminUrl('theme-editor.php?theme=' . $themes->name); ?>"><?php _e('编辑'); ?></a> &nbsp;
<a class="edit"
href="<?php $options->adminUrl('theme-editor.php?theme=' . $themes->name); ?>"><?php _e('编辑'); ?></a> &nbsp;
<?php endif; ?>
<a class="activate" href="<?php $security->index('/action/themes-edit?change=' . $themes->name); ?>"><?php _e('启用'); ?></a>
<a class="activate"
href="<?php $security->index('/action/themes-edit?change=' . $themes->name); ?>"><?php _e('启用'); ?></a>
</p>
<?php endif; ?>
</td>
</tr>
<?php endwhile; ?>
<?php endwhile; ?>
</tbody>
</table>
</div>

View File

@ -11,15 +11,19 @@ include 'menu.php';
<div class="col-mb-12">
<div id="typecho-welcome">
<form action="<?php echo $security->getTokenUrl(
\Typecho\Router::url('do', array('action' => 'upgrade', 'widget' => 'Upgrade'),
\Typecho\Router::url('do', ['action' => 'upgrade', 'widget' => 'Upgrade'],
\Typecho\Common::url('index.php', $options->rootUrl))); ?>" method="post">
<h3><?php _e('检测到新版本!'); ?></h3>
<ul>
<li><?php _e('您已经更新了系统程序, 我们还需要执行一些后续步骤来完成升级'); ?></li>
<li><?php _e('此程序将把您的系统从 <strong>%s</strong> 升级到 <strong>%s</strong>', $options->version, \Typecho\Common::VERSION); ?></li>
<li><strong class="warning"><?php _e('在升级之前强烈建议先<a href="%s">备份您的数据</a>', \Typecho\Common::url('backup.php', $options->adminUrl)); ?></strong></li>
<li><strong
class="warning"><?php _e('在升级之前强烈建议先<a href="%s">备份您的数据</a>', \Typecho\Common::url('backup.php', $options->adminUrl)); ?></strong>
</li>
</ul>
<p><button class="btn primary" type="submit"><?php _e('完成升级 &raquo;'); ?></button></p>
<p>
<button class="btn primary" type="submit"><?php _e('完成升级 &raquo;'); ?></button>
</p>
</form>
</div>
</div>
@ -32,10 +36,10 @@ include 'copyright.php';
include 'common-js.php';
?>
<script>
(function () {
if (window.sessionStorage) {
sessionStorage.removeItem('update');
}
})();
(function () {
if (window.sessionStorage) {
sessionStorage.removeItem('update');
}
})();
</script>
<?php include 'footer.php'; ?>

View File

@ -9,7 +9,7 @@ include 'menu.php';
<?php include 'page-title.php'; ?>
<div class="row typecho-page-main" role="form">
<div class="col-mb-12 col-tb-6 col-tb-offset-3">
<?php \Typecho\Widget::widget('Widget_Users_Edit')->form()->render(); ?>
<?php \Widget\Users\Edit::alloc()->form()->render(); ?>
</div>
</div>
</div>

View File

@ -2,7 +2,7 @@
include 'common.php';
include 'header.php';
include 'menu.php';
\Typecho\Widget::widget('Widget_Contents_Page_Edit')->to($page);
\Widget\Contents\Page\Edit::alloc()->to($page);
?>
<div class="main">
<div class="body container">

View File

@ -2,7 +2,7 @@
include 'common.php';
include 'header.php';
include 'menu.php';
\Typecho\Widget::widget('Widget_Contents_Post_Edit')->to($post);
\Widget\Contents\Post\Edit::alloc()->to($post);
?>
<div class="main">
<div class="body container">

View File

@ -14,7 +14,7 @@ if (!defined('__TYPECHO_ROOT_DIR__') && !@include_once 'config.inc.php') {
}
/** 初始化组件 */
\Typecho\Widget::widget('Widget_Init');
\Widget\Init::alloc();
/** 注册一个初始化插件 */
\Typecho\Plugin::factory('index.php')->begin();

View File

@ -27,9 +27,6 @@
<?php $this->header(); ?>
</head>
<body>
<!--[if lt IE 8]>
<div class="browsehappy" role="dialog"><?php _e('当前网页 <strong>不支持</strong> 你正在使用的浏览器. 为了正常的访问, 请 <a href="http://browsehappy.com/">升级你的浏览器</a>'); ?>.</div>
<![endif]-->
<header id="header" class="clearfix">
<div class="container">

View File

@ -98,18 +98,6 @@ textarea {
border-bottom-color: transparent;
}
.browsehappy {
padding: 8px 0;
background: #FBE3E4;
color: #8A1F11;
text-align: center;
}
.browsehappy a {
color: #8A1F11;
text-decoration: underline;
font-weight: bold;
}
/* ------------------
* Header
* --------------- */

View File

@ -22,29 +22,29 @@ class Action extends Widget
* @var array
*/
private $map = [
'ajax' => 'Widget_Ajax',
'login' => 'Widget_Login',
'logout' => 'Widget_Logout',
'register' => 'Widget_Register',
'upgrade' => 'Widget_Upgrade',
'upload' => 'Widget_Upload',
'service' => 'Widget_Service',
'xmlrpc' => 'Widget_XmlRpc',
'comments-edit' => 'Widget_Comments_Edit',
'contents-page-edit' => 'Widget_Contents_Page_Edit',
'contents-post-edit' => 'Widget_Contents_Post_Edit',
'contents-attachment-edit' => 'Widget_Contents_Attachment_Edit',
'metas-category-edit' => 'Widget_Metas_Category_Edit',
'metas-tag-edit' => 'Widget_Metas_Tag_Edit',
'options-discussion' => 'Widget_Options_Discussion',
'options-general' => 'Widget_Options_General',
'options-permalink' => 'Widget_Options_Permalink',
'options-reading' => 'Widget_Options_Reading',
'plugins-edit' => 'Widget_Plugins_Edit',
'themes-edit' => 'Widget_Themes_Edit',
'users-edit' => 'Widget_Users_Edit',
'users-profile' => 'Widget_Users_Profile',
'backup' => 'Widget_Backup'
'ajax' => '\Widget\Ajax',
'login' => '\Widget\Login',
'logout' => '\Widget\Logout',
'register' => '\Widget\Register',
'upgrade' => '\Widget\Upgrade',
'upload' => '\Widget\Upload',
'service' => '\Widget\Service',
'xmlrpc' => '\Widget\XmlRpc',
'comments-edit' => '\Widget\Comments\Edit',
'contents-page-edit' => '\Widget\Contents\Page\Edit',
'contents-post-edit' => '\Widget\Contents\Post\Edit',
'contents-attachment-edit' => '\Widget\Contents\Attachment\Edit',
'metas-category-edit' => '\Widget\Metas\Category\Edit',
'metas-tag-edit' => '\Widget\Metas\Tag\Edit',
'options-discussion' => '\Widget\Options\Discussion',
'options-general' => '\Widget\Options\General',
'options-permalink' => '\Widget\Options\Permalink',
'options-reading' => '\Widget\Options\Reading',
'plugins-edit' => '\Widget\Plugins\Edit',
'themes-edit' => '\Widget\Themes\Edit',
'users-edit' => '\Widget\Users\Edit',
'users-profile' => '\Widget\Users\Profile',
'backup' => '\Widget\Backup'
];
/**

View File

@ -3,7 +3,7 @@
namespace Widget;
/**
* 可以被Widget_Do调用的接口
* 可以被Widget\Action调用的接口
*/
interface ActionInterface
{
@ -11,4 +11,4 @@ interface ActionInterface
* 接口需要实现的入口函数
*/
public function action();
}
}

View File

@ -3,6 +3,7 @@
namespace Widget;
use Typecho\Common;
use Typecho\Config;
use Typecho\Cookie;
use Typecho\Db;
use Typecho\Db\Query;
@ -14,7 +15,6 @@ use Typecho\Widget\Helper\PageNavigator\Classic;
use Typecho\Widget\Helper\PageNavigator\Box;
use Widget\Base\Contents;
use Widget\Base\Metas;
use Widget\Base\Users;
use Widget\Comments\Ping;
use Widget\Comments\Recent;
use Widget\Contents\Attachment\Related;
@ -221,13 +221,12 @@ class Archive extends Contents
private $pageNav;
/**
* @param Config $parameter
* @throws \Exception
*/
public function init()
protected function initParameter(Config $parameter)
{
parent::init();
$this->parameter->setDefault([
$parameter->setDefault([
'pageSize' => $this->options->pageSize,
'type' => null,
'checkPermalink' => true,
@ -235,14 +234,14 @@ class Archive extends Contents
]);
/** 用于判断是路由调用还是外部调用 */
if (null == $this->parameter->type) {
$this->parameter->type = Router::$current;
if (null == $parameter->type) {
$parameter->type = Router::$current;
} else {
$this->invokeFromOutside = true;
}
/** 用于判断是否为feed调用 */
if ($this->parameter->isFeed) {
if ($parameter->isFeed) {
$this->invokeByFeed = true;
}
@ -250,7 +249,7 @@ class Archive extends Contents
$this->themeDir = rtrim($this->options->themeFile($this->options->theme), '/') . '/';
/** 处理feed模式 **/
if ('feed' == $this->parameter->type) {
if ('feed' == $parameter->type) {
$this->currentFeedUrl = '';
/** 判断聚合类型 */
@ -277,12 +276,12 @@ class Archive extends Contents
}
$feedQuery = $this->request->feed;
//$this->parameter->type = Router::$current;
//$parameter->type = Router::$current;
//$this->request->setParams($params);
if ('/comments/' == $feedQuery || '/comments' == $feedQuery) {
/** 专为feed使用的hack */
$this->parameter->type = 'comments';
$parameter->type = 'comments';
} else {
$matched = Router::match($this->request->feed, 'pageSize=10&isFeed=1');
if ($matched instanceof Archive) {
@ -296,7 +295,7 @@ class Archive extends Contents
$this->setFeed(new Feed(Common::VERSION, $this->feedType, $this->options->charset, _t('zh-CN')));
/** 默认输出10则文章 **/
$this->parameter->pageSize = 10;
$parameter->pageSize = 10;
}
}

View File

@ -2,6 +2,7 @@
namespace Widget;
use Typecho\Config;
use Typecho\Db;
use Typecho\Plugin;
use Typecho\Widget;
@ -20,6 +21,31 @@ if (!defined('__TYPECHO_ROOT_DIR__')) {
*/
abstract class Base extends Widget
{
/**
* init user widget
*/
protected const INIT_USER = 0b001;
/**
* init security widget
*/
protected const INIT_SECURITY = 0b010;
/**
* init options widget
*/
protected const INIT_OPTIONS = 0b100;
/**
* init all widgets
*/
protected const INIT_ALL = 0b111;
/**
* init none widget
*/
protected const INIT_NONE = 0;
/**
* 全局选项
*
@ -53,30 +79,37 @@ abstract class Base extends Widget
*/
protected function init()
{
$this->initWith('db', 'options', 'user', 'security');
}
$this->db = Db::get();
$components = self::INIT_ALL;
/**
* init base component
*
* @param string ...$components
*/
protected function initWith(string ...$components)
{
if (in_array('db', $components)) {
$this->db = Db::get();
}
$this->initComponents($components);
if (in_array('options', $components)) {
$this->options = Options::alloc();
}
if (in_array('user', $components)) {
if ($components & self::INIT_USER) {
$this->user = User::alloc();
}
if (in_array('security', $components)) {
if ($components & self::INIT_OPTIONS) {
$this->options = Options::alloc();
}
if ($components & self::INIT_SECURITY) {
$this->security = Security::alloc();
}
$this->initParameter($this->parameter);
}
/**
* @param int $components
*/
protected function initComponents(int &$components)
{
}
/**
* @param Config $parameter
*/
protected function initParameter(Config $parameter)
{
}
}

View File

@ -4,11 +4,8 @@ namespace Widget\Comments;
use Typecho\Config;
use Typecho\Cookie;
use Typecho\Db\Exception;
use Typecho\Router;
use Typecho\Widget\Helper\PageNavigator\Box;
use Typecho\Widget\Response;
use Typecho\Widget\Request;
use Widget\Base\Comments;
if (!defined('__TYPECHO_ROOT_DIR__')) {
@ -58,17 +55,11 @@ class Archive extends Comments
private $singleCommentOptions = null;
/**
* 构造函数,初始化组件
*
* @param Request $request request对象
* @param Response $response response对象
* @param mixed $params 参数列表
* @throws Exception
* @param Config $parameter
*/
public function __construct(Request $request, Response $response, $params = null)
protected function initParameter(Config $parameter)
{
parent::__construct($request, $response, $params);
$this->parameter->setDefault('parentId=0&commentPage=0&commentsNum=0&allowComment=1');
$parameter->setDefault('parentId=0&commentPage=0&commentsNum=0&allowComment=1');
}
/**

View File

@ -4,8 +4,6 @@ namespace Widget\Comments;
use Typecho\Config;
use Typecho\Db\Exception;
use Typecho\Widget\Request;
use Typecho\Widget\Response;
use Widget\Base\Comments;
if (!defined('__TYPECHO_ROOT_DIR__')) {
@ -31,17 +29,11 @@ class Ping extends Comments
private $customSinglePingCallback = false;
/**
* 构造函数,初始化组件
*
* @param Request $request request对象
* @param Response $response response对象
* @param mixed $params 参数列表
* @throws Exception
* @param Config $parameter
*/
public function __construct(Request $request, Response $response, $params = null)
protected function initParameter(Config $parameter)
{
parent::__construct($request, $response, $params);
$this->parameter->setDefault('parentId=0');
$parameter->setDefault('parentId=0');
/** 初始化回调函数 */
if (function_exists('singlePing')) {

View File

@ -2,10 +2,9 @@
namespace Widget\Comments;
use Typecho\Config;
use Typecho\Db;
use Typecho\Db\Exception;
use Typecho\Widget\Request;
use Typecho\Widget\Response;
use Widget\Base\Comments;
if (!defined('__TYPECHO_ROOT_DIR__')) {
@ -23,17 +22,11 @@ if (!defined('__TYPECHO_ROOT_DIR__')) {
class Recent extends Comments
{
/**
* 构造函数,初始化组件
*
* @param Request $request request对象
* @param Response $response response对象
* @param mixed $params 参数列表
* @throws Exception
* @param Config $parameter
*/
public function __construct(Request $request, Response $response, $params = null)
protected function initParameter(Config $parameter)
{
parent::__construct($request, $response, $params);
$this->parameter->setDefault(
$parameter->setDefault(
['pageSize' => $this->options->commentsListSize, 'parentId' => 0, 'ignoreAuthor' => false]
);
}

View File

@ -2,10 +2,11 @@
namespace Widget\Contents\Post;
use Typecho\Config;
use Typecho\Db;
use Typecho\Router;
use Typecho\Widget;
use Widget\Options;
use Widget\Base;
if (!defined('__TYPECHO_ROOT_DIR__')) {
exit;
@ -18,40 +19,14 @@ if (!defined('__TYPECHO_ROOT_DIR__')) {
* @category typecho
* @package Widget
*/
class Date extends Widget
class Date extends Base
{
/**
* 全局选项
*
* @var Options
* @param Config $parameter
*/
protected $options;
/**
* 数据库对象
*
* @var Db
*/
protected $db;
/**
* 构造函数,初始化组件
*
* @param mixed $request request对象
* @param mixed $response response对象
* @param mixed $params 参数列表
* @throws Db\Exception
* @throws Widget\Exception
*/
public function __construct($request, $response, $params = null)
protected function initParameter(Config $parameter)
{
parent::__construct($request, $response, $params);
/** 初始化数据库 */
$this->db = Db::get();
/** 初始化常用组件 */
$this->options = Options::alloc();
$parameter->setDefault('format=Y-m&type=month&limit=0');
}
/**

View File

@ -3,7 +3,6 @@
namespace Widget;
use Typecho\Common;
use Typecho\Widget;
use Widget\Plugins\Config;
use Widget\Themes\Files;
use Widget\Users\Edit as UsersEdit;
@ -25,7 +24,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) {
*
* @package Widget
*/
class Menu extends Widget
class Menu extends Base
{
/**
* 当前菜单标题
@ -39,20 +38,6 @@ class Menu extends Widget
*/
public $addLink;
/**
* 全局选项
*
* @var Options
*/
protected $options;
/**
* 用户对象
*
* @var User
*/
protected $user;
/**
* 父菜单列表
*
@ -81,24 +66,6 @@ class Menu extends Widget
*/
private $currentUrl;
/**
* 构造函数,初始化组件
*
* @access public
* @param mixed $request request对象
* @param mixed $response response对象
* @param mixed $params 参数列表
* @return void
*/
public function __construct($request, $response, $params = null)
{
parent::__construct($request, $response, $params);
/** 初始化常用组件 */
$this->options = Options::alloc();
$this->user = User::alloc();
}
/**
* 执行函数,初始化菜单
*/
@ -137,7 +104,7 @@ class Menu extends Widget
[[CommentsAdmin::class, 'getMenuTitle'], [CommentsAdmin::class, 'getMenuTitle'], 'manage-comments.php?cid=', 'contributor', true],
[_t('分类'), _t('管理分类'), 'manage-categories.php', 'editor', false, 'category.php'],
[_t('新增分类'), _t('新增分类'), 'category.php', 'editor', true],
[[CategoryAdmin::class, 'getMenuTitle'], [CategoryAdmin::class, 'getMenuTitle'], 'manage-categories.php?parent=', 'editor', true, ['Widget_Metas_Category_Admin', 'getAddLink']],
[[CategoryAdmin::class, 'getMenuTitle'], [CategoryAdmin::class, 'getMenuTitle'], 'manage-categories.php?parent=', 'editor', true, [CategoryAdmin::class, 'getAddLink']],
[[CategoryEdit::class, 'getMenuTitle'], [CategoryEdit::class, 'getMenuTitle'], 'category.php?mid=', 'editor', true],
[[CategoryEdit::class, 'getMenuTitle'], [CategoryEdit::class, 'getMenuTitle'], 'category.php?parent=', 'editor', true],
[_t('标签'), _t('管理标签'), 'manage-tags.php', 'editor'],

View File

@ -77,17 +77,11 @@ class Rows extends Metas
private $parents = [];
/**
* 构造函数,初始化组件
*
* @access public
* @param mixed $request request对象
* @param mixed $response response对象
* @param mixed $params 参数列表
* @param Config $parameter
*/
public function __construct($request, $response, $params = null)
protected function initParameter(Config $parameter)
{
parent::__construct($request, $response, $params);
$this->parameter->setDefault('ignore=0&current=');
$parameter->setDefault('ignore=0&current=');
$select = $this->select()->where('type = ?', 'category');

View File

@ -4,7 +4,6 @@ namespace Widget;
use Typecho\Common;
use Typecho\Config;
use Typecho\Db;
use Typecho\Router;
use Typecho\Router\Parser;
use Typecho\Widget;
@ -57,17 +56,11 @@ if (!defined('__TYPECHO_ROOT_DIR__')) {
* @property-read string $attachmentTypes
* @property-read int $time
* @property-read string $frontPage
* @property-read int $commentsListSize
* @property-read bool $commentsShowCommentOnly
*/
class Options extends Base
{
/**
* 数据库对象
*
* @access protected
* @var Db
*/
protected $db;
/**
* 缓存的插件配置
*
@ -85,17 +78,26 @@ class Options extends Base
private $personalPluginConfig = [];
/**
* 构造函数,初始化组件
*
* @throws DbException
* @var bool options loaded
*/
public function init()
private $loaded = false;
/**
* @param int $components
*/
protected function initComponents(int &$components)
{
if (!$this->parameter->isEmpty()) {
// 使用参数初始化而不使用数据库
$components = self::INIT_NONE;
}
/**
* @param Config $parameter
*/
protected function initParameter(Config $parameter)
{
if (!$parameter->isEmpty()) {
$this->row = $this->parameter->toArray();
} else {
$this->initWith('db');
$this->loaded = true;
}
}
@ -106,7 +108,7 @@ class Options extends Base
*/
public function execute()
{
if (!empty($this->db)) {
if (!$this->loaded) {
$values = $this->db->fetchAll($this->db->select()->from('table.options')
->where('user = 0'), [$this, 'push']);
@ -159,7 +161,7 @@ class Options extends Base
/** 自动初始化路由表 */
$this->routingTable = unserialize($this->routingTable);
if (!empty($this->db) && !isset($this->routingTable[0])) {
if ($this->loaded && !isset($this->routingTable[0])) {
/** 解析路由并缓存 */
$parser = new Parser($this->routingTable);
$parsedRoutingTable = $parser->parse();

View File

@ -17,34 +17,34 @@ if (!defined('__TYPECHO_ROOT_DIR__')) {
* @copyright Copyright (c) 2014 Typecho team (http://typecho.org)
* @license GNU General Public License 2.0
*/
class Security extends Widget
class Security extends Base
{
/**
* @var string
*/
private $token;
/**
* @var Options
*/
private $options;
/**
* @var boolean
*/
private $enabled = true;
/**
* @param int $components
*/
public function initComponents(int &$components)
{
$components = self::INIT_OPTIONS | self::INIT_USER;
}
/**
* 初始化函数
*/
public function execute()
{
$this->options = Options::alloc();
$user = User::alloc();
$this->token = $this->options->secret;
if ($user->hasLogin()) {
$this->token .= '&' . $user->authCode . '&' . $user->uid;
if ($this->user->hasLogin()) {
$this->token .= '&' . $this->user->authCode . '&' . $this->user->uid;
}
}

View File

@ -2,9 +2,6 @@
namespace Widget;
use Typecho\Db;
use Typecho\Widget;
if (!defined('__TYPECHO_ROOT_DIR__')) {
exit;
}
@ -12,53 +9,46 @@ if (!defined('__TYPECHO_ROOT_DIR__')) {
/**
* 全局统计组件
*
* @link typecho
* @package Widget
* @copyright Copyright (c) 2008 Typecho team (http://www.typecho.org)
* @license GNU General Public License 2.0
* @property-read int $publishedPostsNum
* @property-read int $waitingPostsNum
* @property-read int $draftPostsNum
* @property-read int $myPublishedPostsNum
* @property-read int $myWaitingPostsNum
* @property-read int $myDraftPostsNum
* @property-read int $currentPublishedPostsNum
* @property-read int $currentWaitingPostsNum
* @property-read int $currentDraftPostsNum
* @property-read int $publishedPagesNum
* @property-read int $draftPagesNum
* @property-read int $publishedCommentsNum
* @property-read int $waitingCommentsNum
* @property-read int $spamCommentsNum
* @property-read int $myPublishedCommentsNum
* @property-read int $myWaitingCommentsNum
* @property-read int $mySpamCommentsNum
* @property-read int $currentCommentsNum
* @property-read int $currentPublishedCommentsNum
* @property-read int $currentWaitingCommentsNum
* @property-read int $currentSpamCommentsNum
* @property-read int $categoriesNum
* @property-read int $tagsNum
*/
class Stat extends Widget
class Stat extends Base
{
/**
* 用户对象
*
* @var User
* @param int $components
*/
protected $user;
/**
* 数据库对象
*
* @var Db
*/
protected $db;
/**
* 构造函数,初始化组件
*
* @param mixed $request request对象
* @param mixed $response response对象
* @param mixed $params 参数列表
* @throws Db\Exception
*/
public function __construct($request, $response, $params = null)
protected function initComponents(int &$components)
{
parent::__construct($request, $response, $params);
/** 初始化数据库 */
$this->db = Db::get();
/** 初始化常用组件 */
$this->user = User::alloc();
$components = self::INIT_USER;
}
/**
* 获取已发布的文章数目
*
* @access protected
* @return integer
*/
protected function ___publishedPostsNum()
protected function ___publishedPostsNum(): int
{
return $this->db->fetchObject($this->db->select(['COUNT(cid)' => 'num'])
->from('table.contents')
@ -69,10 +59,9 @@ class Stat extends Widget
/**
* 获取待审核的文章数目
*
* @access protected
* @return integer
*/
protected function ___waitingPostsNum()
protected function ___waitingPostsNum(): int
{
return $this->db->fetchObject($this->db->select(['COUNT(cid)' => 'num'])
->from('table.contents')
@ -83,10 +72,9 @@ class Stat extends Widget
/**
* 获取草稿文章数目
*
* @access protected
* @return integer
*/
protected function ___draftPostsNum()
protected function ___draftPostsNum(): int
{
return $this->db->fetchObject($this->db->select(['COUNT(cid)' => 'num'])
->from('table.contents')
@ -96,10 +84,9 @@ class Stat extends Widget
/**
* 获取当前用户已发布的文章数目
*
* @access protected
* @return integer
*/
protected function ___myPublishedPostsNum()
protected function ___myPublishedPostsNum(): int
{
return $this->db->fetchObject($this->db->select(['COUNT(cid)' => 'num'])
->from('table.contents')
@ -111,10 +98,9 @@ class Stat extends Widget
/**
* 获取当前用户待审核文章数目
*
* @access protected
* @return integer
*/
protected function ___myWaitingPostsNum()
protected function ___myWaitingPostsNum(): int
{
return $this->db->fetchObject($this->db->select(['COUNT(cid)' => 'num'])
->from('table.contents')
@ -126,10 +112,9 @@ class Stat extends Widget
/**
* 获取当前用户草稿文章数目
*
* @access protected
* @return integer
*/
protected function ___myDraftPostsNum()
protected function ___myDraftPostsNum(): int
{
return $this->db->fetchObject($this->db->select(['COUNT(cid)' => 'num'])
->from('table.contents')
@ -140,10 +125,9 @@ class Stat extends Widget
/**
* 获取当前用户已发布的文章数目
*
* @access protected
* @return integer
*/
protected function ___currentPublishedPostsNum()
protected function ___currentPublishedPostsNum(): int
{
return $this->db->fetchObject($this->db->select(['COUNT(cid)' => 'num'])
->from('table.contents')
@ -155,10 +139,9 @@ class Stat extends Widget
/**
* 获取当前用户待审核文章数目
*
* @access protected
* @return integer
*/
protected function ___currentWaitingPostsNum()
protected function ___currentWaitingPostsNum(): int
{
return $this->db->fetchObject($this->db->select(['COUNT(cid)' => 'num'])
->from('table.contents')
@ -170,10 +153,9 @@ class Stat extends Widget
/**
* 获取当前用户草稿文章数目
*
* @access protected
* @return integer
*/
protected function ___currentDraftPostsNum()
protected function ___currentDraftPostsNum(): int
{
return $this->db->fetchObject($this->db->select(['COUNT(cid)' => 'num'])
->from('table.contents')
@ -184,10 +166,9 @@ class Stat extends Widget
/**
* 获取已发布页面数目
*
* @access protected
* @return integer
*/
protected function ___publishedPagesNum()
protected function ___publishedPagesNum(): int
{
return $this->db->fetchObject($this->db->select(['COUNT(cid)' => 'num'])
->from('table.contents')
@ -198,10 +179,9 @@ class Stat extends Widget
/**
* 获取草稿页面数目
*
* @access protected
* @return integer
*/
protected function ___draftPagesNum()
protected function ___draftPagesNum(): int
{
return $this->db->fetchObject($this->db->select(['COUNT(cid)' => 'num'])
->from('table.contents')
@ -211,10 +191,9 @@ class Stat extends Widget
/**
* 获取当前显示的评论数目
*
* @access protected
* @return integer
*/
protected function ___publishedCommentsNum()
protected function ___publishedCommentsNum(): int
{
return $this->db->fetchObject($this->db->select(['COUNT(coid)' => 'num'])
->from('table.comments')
@ -224,10 +203,9 @@ class Stat extends Widget
/**
* 获取当前待审核的评论数目
*
* @access protected
* @return integer
*/
protected function ___waitingCommentsNum()
protected function ___waitingCommentsNum(): int
{
return $this->db->fetchObject($this->db->select(['COUNT(coid)' => 'num'])
->from('table.comments')
@ -237,10 +215,9 @@ class Stat extends Widget
/**
* 获取当前垃圾评论数目
*
* @access protected
* @return integer
*/
protected function ___spamCommentsNum()
protected function ___spamCommentsNum(): int
{
return $this->db->fetchObject($this->db->select(['COUNT(coid)' => 'num'])
->from('table.comments')
@ -250,10 +227,9 @@ class Stat extends Widget
/**
* 获取当前用户显示的评论数目
*
* @access protected
* @return integer
*/
protected function ___myPublishedCommentsNum()
protected function ___myPublishedCommentsNum(): int
{
return $this->db->fetchObject($this->db->select(['COUNT(coid)' => 'num'])
->from('table.comments')
@ -264,10 +240,9 @@ class Stat extends Widget
/**
* 获取当前用户显示的评论数目
*
* @access protected
* @return integer
*/
protected function ___myWaitingCommentsNum()
protected function ___myWaitingCommentsNum(): int
{
return $this->db->fetchObject($this->db->select(['COUNT(coid)' => 'num'])
->from('table.comments')
@ -278,10 +253,9 @@ class Stat extends Widget
/**
* 获取当前用户显示的评论数目
*
* @access protected
* @return integer
*/
protected function ___mySpamCommentsNum()
protected function ___mySpamCommentsNum(): int
{
return $this->db->fetchObject($this->db->select(['COUNT(coid)' => 'num'])
->from('table.comments')
@ -292,10 +266,9 @@ class Stat extends Widget
/**
* 获取当前文章的评论数目
*
* @access protected
* @return integer
*/
protected function ___currentCommentsNum()
protected function ___currentCommentsNum(): int
{
return $this->db->fetchObject($this->db->select(['COUNT(coid)' => 'num'])
->from('table.comments')
@ -305,10 +278,9 @@ class Stat extends Widget
/**
* 获取当前文章显示的评论数目
*
* @access protected
* @return integer
*/
protected function ___currentPublishedCommentsNum()
protected function ___currentPublishedCommentsNum(): int
{
return $this->db->fetchObject($this->db->select(['COUNT(coid)' => 'num'])
->from('table.comments')
@ -319,10 +291,9 @@ class Stat extends Widget
/**
* 获取当前文章显示的评论数目
*
* @access protected
* @return integer
*/
protected function ___currentWaitingCommentsNum()
protected function ___currentWaitingCommentsNum(): int
{
return $this->db->fetchObject($this->db->select(['COUNT(coid)' => 'num'])
->from('table.comments')
@ -333,10 +304,9 @@ class Stat extends Widget
/**
* 获取当前文章显示的评论数目
*
* @access protected
* @return integer
*/
protected function ___currentSpamCommentsNum()
protected function ___currentSpamCommentsNum(): int
{
return $this->db->fetchObject($this->db->select(['COUNT(coid)' => 'num'])
->from('table.comments')
@ -347,10 +317,9 @@ class Stat extends Widget
/**
* 获取分类数目
*
* @access protected
* @return integer
*/
protected function ___categoriesNum()
protected function ___categoriesNum(): int
{
return $this->db->fetchObject($this->db->select(['COUNT(mid)' => 'num'])
->from('table.metas')
@ -360,10 +329,9 @@ class Stat extends Widget
/**
* 获取标签数目
*
* @access protected
* @return integer
*/
protected function ___tagsNum()
protected function ___tagsNum(): int
{
return $this->db->fetchObject($this->db->select(['COUNT(mid)' => 'num'])
->from('table.metas')

View File

@ -3,6 +3,7 @@
namespace Widget\Themes;
use Typecho\Widget;
use Widget\Base;
use Widget\Options;
if (!defined('__TYPECHO_ROOT_DIR__')) {
@ -18,7 +19,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) {
* @copyright Copyright (c) 2008 Typecho team (http://www.typecho.org)
* @license GNU General Public License 2.0
*/
class Files extends Widget
class Files extends Base
{
/**
* 当前风格
@ -44,7 +45,7 @@ class Files extends Widget
public function execute()
{
/** 管理员权限 */
self::widget('Widget_User')->pass('administrator');
$this->user->pass('administrator');
$this->currentTheme = $this->request->filter('slug')->get('theme', Options::alloc()->theme);
if (

View File

@ -4,11 +4,9 @@ namespace Widget;
use Typecho\Common;
use Typecho\Cookie;
use Typecho\Db;
use Typecho\Db\Exception as DbException;
use Typecho\Widget;
use Typecho\Widget\Request;
use Typecho\Widget\Response;
use Widget\Base\Users;
if (!defined('__TYPECHO_ROOT_DIR__')) {
exit;
@ -22,7 +20,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) {
* @copyright Copyright (c) 2008 Typecho team (http://www.typecho.org)
* @license GNU General Public License 2.0
*/
class User extends Base
class User extends Users
{
/**
* 用户组
@ -37,20 +35,6 @@ class User extends Base
'visitor' => 4
];
/**
* 全局选项
*
* @var Options
*/
protected $options;
/**
* 数据库对象
*
* @var Db
*/
protected $db;
/**
* 用户
*
@ -66,11 +50,11 @@ class User extends Base
private $hasLogin = null;
/**
* init method
* @param int $components
*/
protected function init()
protected function initComponents(int &$components)
{
$this->initWith('db', 'options');
$components = self::INIT_OPTIONS;
}
/**
@ -81,15 +65,8 @@ class User extends Base
public function execute()
{
if ($this->hasLogin()) {
$rows = $this->db->fetchAll($this->db->select()
->from('table.options')->where('user = ?', $this->currentUser['uid']));
$this->push($this->currentUser);
foreach ($rows as $row) {
$this->options->{$row['name']} = $row['value'];
}
//更新最后活动时间
$this->db->query($this->db
->update('table.users')