Merge pull request #8 from typecho/master

更新
This commit is contained in:
ShingChi 2013-12-20 17:26:02 -08:00
commit def9d487ef
67 changed files with 803 additions and 429 deletions

9
.travis.yml Normal file
View File

@ -0,0 +1,9 @@
language: php
php:
- 5.5
- 5.4
- 5.3
script: cd ./tools/ && make all

15
README.md Normal file
View File

@ -0,0 +1,15 @@
Typecho Blogging Platform
=========================
####Homepage
http://typecho.org/
####Document
http://docs.typecho.org/
####Forum
http://forum.typecho.org/
####Download
http://typecho.org/download

View File

@ -1,4 +1,4 @@
<?php if(!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php if(!defined('__TYPECHO_ADMIN__')) exit; ?>
<script src="<?php $options->adminUrl('js/jquery.js?v=' . $suffixVersion); ?>"></script>
<script src="<?php $options->adminUrl('js/jquery-ui.js?v=' . $suffixVersion); ?>"></script>
<script src="<?php $options->adminUrl('js/typecho.js?v=' . $suffixVersion); ?>"></script>

View File

@ -3,6 +3,8 @@ if (!defined('__DIR__')) {
define('__DIR__', dirname(__FILE__));
}
define('__TYPECHO_ADMIN__', true);
/** 载入配置文件 */
if (!@include_once __DIR__ . '/../config.inc.php') {
file_exists(__DIR__ . '/../install.php') ? header('Location: ../install.php') : print('Missing Config File');

View File

@ -1,4 +1,4 @@
<?php if(!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php if(!defined('__TYPECHO_ADMIN__')) exit; ?>
<div class="typecho-foot" role="contentinfo">
<div class="copyright">
<a href="http://typecho.org" class="i-logo-s">Typecho</a>

View File

@ -622,7 +622,7 @@ button {
.typecho-login {
display: table-cell;
padding-bottom: 100px;
padding: 30px 0 100px;
width: 280px;
text-align: center;
vertical-align: middle; }
@ -1263,6 +1263,7 @@ a.operate-reply {
margin-right: 4px;
padding: 3px;
cursor: pointer;
vertical-align: middle;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
-ms-border-radius: 2px;
@ -1273,7 +1274,7 @@ a.operate-reply {
.wmd-button-row li.wmd-spacer {
height: 20px;
margin: 0 10px 0 6px;
padding: 3px 0;
padding: 0;
width: 1px;
background: #E9E9E6;
cursor: default; }

View File

@ -1,3 +1,4 @@
<?php if(!defined('__TYPECHO_ADMIN__')) exit; ?>
<script>
$(document).ready(function () {
// 自定义字段

View File

@ -1,4 +1,4 @@
<?php if(!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php if(!defined('__TYPECHO_ADMIN__')) exit; ?>
<?php
$fields = isset($post) ? $post->getFieldItems() : $page->getFieldItems();
$defaultFields = isset($post) ? $post->getDefaultFieldItems() : $page->getDefaultFieldItems();

View File

@ -1,5 +1,5 @@
<?php if(!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php $content = !empty($post) ? $post : $page; if ($options->markdown && (!$content->have() || $content->isMarkdown)): ?>
<?php if(!defined('__TYPECHO_ADMIN__')) exit; ?>
<?php $content = !empty($post) ? $post : $page; if ($options->markdown): ?>
<script src="<?php $options->adminUrl('js/pagedown.js?v=' . $suffixVersion); ?>"></script>
<script src="<?php $options->adminUrl('js/pagedown-extra.js?v=' . $suffixVersion); ?>"></script>
<script src="<?php $options->adminUrl('js/diff.js?v=' . $suffixVersion); ?>"></script>
@ -9,7 +9,7 @@ $(document).ready(function () {
toolbar = $('<div class="editor" id="wmd-button-bar" />').insertBefore(textarea.parent())
preview = $('<div id="wmd-preview" class="wmd-hidetab" />').insertAfter('.editor');
var options = {};
var options = {}, isMarkdown = <?php echo intval($content->isMarkdown || !$content->have()); ?>;
options.strings = {
bold: '<?php _e('加粗'); ?> <strong> Ctrl+B',
@ -166,6 +166,8 @@ $(document).ready(function () {
}
});
<?php Typecho_Plugin::factory('admin/editor-js.php')->markdownEditor($content); ?>
var input = $('#text'), th = textarea.height(), ph = preview.height();
editor.hooks.chain('enterFakeFullScreen', function () {
@ -192,51 +194,72 @@ $(document).ready(function () {
preview.height(ph);
});
editor.run();
function initMarkdown() {
editor.run();
var imageButton = $('#wmd-image-button'),
linkButton = $('#wmd-link-button');
var imageButton = $('#wmd-image-button'),
linkButton = $('#wmd-link-button');
Typecho.insertFileToEditor = function (file, url, isImage) {
var button = isImage ? imageButton : linkButton;
Typecho.insertFileToEditor = function (file, url, isImage) {
var button = isImage ? imageButton : linkButton;
options.strings[isImage ? 'imagename' : 'linkname'] = file;
button.trigger('click');
options.strings[isImage ? 'imagename' : 'linkname'] = file;
button.trigger('click');
var checkDialog = setInterval(function () {
if ($('.wmd-prompt-dialog').length > 0) {
$('.wmd-prompt-dialog input').val(url).select();
clearInterval(checkDialog);
checkDialog = null;
}
}, 10);
};
var checkDialog = setInterval(function () {
if ($('.wmd-prompt-dialog').length > 0) {
$('.wmd-prompt-dialog input').val(url).select();
clearInterval(checkDialog);
checkDialog = null;
}
}, 10);
};
// 编辑预览切换
var edittab = $('.editor').prepend('<div class="wmd-edittab"><a href="#wmd-editarea" class="active">撰写</a><a href="#wmd-preview">预览</a></div>'),
editarea = $(textarea.parent()).attr("id", "wmd-editarea");
// 编辑预览切换
var edittab = $('.editor').prepend('<div class="wmd-edittab"><a href="#wmd-editarea" class="active"><?php _e('撰写'); ?></a><a href="#wmd-preview"><?php _e('预览'); ?></a></div>'),
editarea = $(textarea.parent()).attr("id", "wmd-editarea");
$(".wmd-edittab a").click(function() {
$(".wmd-edittab a").removeClass('active');
$(this).addClass("active");
$("#wmd-editarea, #wmd-preview").addClass("wmd-hidetab");
$(".wmd-edittab a").click(function() {
$(".wmd-edittab a").removeClass('active');
$(this).addClass("active");
$("#wmd-editarea, #wmd-preview").addClass("wmd-hidetab");
var selected_tab = $(this).attr("href"),
selected_el = $(selected_tab).removeClass("wmd-hidetab");
var selected_tab = $(this).attr("href"),
selected_el = $(selected_tab).removeClass("wmd-hidetab");
// 预览时隐藏编辑器按钮
if (selected_tab == "#wmd-preview") {
$("#wmd-button-row").addClass("wmd-visualhide");
} else {
$("#wmd-button-row").removeClass("wmd-visualhide");
}
// 预览时隐藏编辑器按钮
if (selected_tab == "#wmd-preview") {
$("#wmd-button-row").addClass("wmd-visualhide");
} else {
$("#wmd-button-row").removeClass("wmd-visualhide");
}
// 预览和编辑窗口高度一致
$("#wmd-preview").outerHeight($("#wmd-editarea").innerHeight());
// 预览和编辑窗口高度一致
$("#wmd-preview").outerHeight($("#wmd-editarea").innerHeight());
return false;
});
return false;
});
}
if (isMarkdown) {
initMarkdown();
} else {
var notice = $('<div class="message notice"><?php _e('这篇文章不是由Markdown语法创建的, 继续使用Markdown编辑它吗?'); ?> '
+ '<button class="btn-xs primary yes"><?php _e(''); ?></button> '
+ '<button class="btn-xs no"><?php _e(''); ?></button></div>')
.hide().insertBefore(textarea).slideDown();
$('.yes', notice).click(function () {
notice.remove();
$('<input type="hidden" name="markdown" value="1" />').appendTo('.submit');
initMarkdown();
});
$('.no', notice).click(function () {
notice.remove();
});
}
});
</script>
<?php endif; ?>

View File

@ -1,4 +1,4 @@
<?php if(!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php if(!defined('__TYPECHO_ADMIN__')) exit; ?>
<?php
if (isset($post) && $post instanceof Typecho_Widget && $post->have()) {
$fileParentContent = $post;

View File

@ -1,4 +1,4 @@
<?php if(!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php if(!defined('__TYPECHO_ADMIN__')) exit; ?>
<?php
if (isset($post) || isset($page)) {

View File

@ -1,4 +1,4 @@
<?php if(!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php if(!defined('__TYPECHO_ADMIN__')) exit; ?>
</body>
</html>
<?php

View File

@ -1,11 +1,11 @@
<?php if(!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php if(!defined('__TYPECHO_ADMIN__')) exit; ?>
<script>
(function () {
$(document).ready(function () {
var error = $('.typecho-option .error:first');
if (error.length > 0) {
$('html,body').scrollTop(error.offset().top);
$('html,body').scrollTop(error.parents('.typecho-option').offset().top);
}
$('form').submit(function () {

View File

@ -1,5 +1,5 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) {
if (!defined('__TYPECHO_ADMIN__')) {
exit;
}
@ -20,12 +20,12 @@ $header = Typecho_Plugin::factory('admin/header.php')->header($header);
<meta charset="<?php $options->charset(); ?>">
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php _e('%s - %s - Powered by Typecho', $menu->title, $options->title); ?></title>
<meta name="robots" content="noindex, nofollow">
<?php echo $header; ?>
</head>
<body<?php if (isset($bodyClass)) {echo ' class="' . $bodyClass . '"';} ?>>
<!--[if lt IE 9]>
<div class="message error browsehappy"><?php _e('当前网页 <strong>不支持</strong> 你正在使用的浏览器. 为了正常的访问, 请 <a href="http://browsehappy.com/">升级你的浏览器</a>'); ?>.</div>
<div class="message error browsehappy" role="dialog"><?php _e('当前网页 <strong>不支持</strong> 你正在使用的浏览器. 为了正常的访问, 请 <a href="http://browsehappy.com/">升级你的浏览器</a>'); ?>.</div>
<![endif]-->

View File

@ -1666,6 +1666,9 @@ else
* its own image insertion dialog, this hook should return true, and the callback should be called with the chosen
* image url (or null if the user cancelled). If this hook returns false, the default dialog will be used.
*/
hooks.addNoop("makeButton");
hooks.addNoop("enterFullScreen");
hooks.addNoop("enterFakeFullScreen");
hooks.addNoop("exitFullScreen");
@ -1699,7 +1702,7 @@ else
}
fullScreenManager = new FullScreenManager(hooks, getString);
uiManager = new UIManager(idPostfix, panels, undoManager, previewManager, commandManager, fullScreenManager, options.helpButton, getString);
uiManager = new UIManager(idPostfix, panels, hooks, undoManager, previewManager, commandManager, fullScreenManager, options.helpButton, getString);
uiManager.setUndoRedoButtonStates();
var forceRefresh = that.refreshPreview = function () { previewManager.refresh(true); };
@ -2614,6 +2617,132 @@ else
return background;
};
// 扩展了原来ui的功能
// 允许创建一个自定义html的对话框
ui.dialog = function (html, callback, ok, cancel) {
// These variables need to be declared at this level since they are used
// in multiple functions.
var dialog; // The dialog box.
// Used as a keydown event handler. Esc dismisses the prompt.
// Key code 27 is ESC.
var checkEscape = function (key) {
var code = (key.charCode || key.keyCode);
if (code === 27) {
close(true);
}
};
// Dismisses the hyperlink input box.
// isCancel is true if we don't care about the input text.
// isCancel is false if we are going to keep the text.
var close = function (isCancel) {
util.removeEvent(doc.body, "keydown", checkEscape);
dialog.parentNode.removeChild(dialog);
callback(isCancel);
return false;
};
// Create the text input box form/window.
var createDialog = function () {
// The main dialog box.
dialog = doc.createElement("div");
dialog.className = "wmd-prompt-dialog";
dialog.setAttribute("role", "dialog");
/*
dialog.style.padding = "10px;";
dialog.style.position = "fixed";
dialog.style.width = "400px";
dialog.style.zIndex = "1001";
*/
// The dialog text.
var question = doc.createElement("div");
// The web form container for the text box and buttons.
var form = doc.createElement("form"),
style = form.style;
form.onsubmit = function () { return close(false); };
/*
style.padding = "0";
style.margin = "0";
style.cssFloat = "left";
style.width = "100%";
style.textAlign = "center";
style.position = "relative";
*/
dialog.appendChild(form);
form.appendChild(question);
if ('function' == typeof(html)) {
html.call(this, question);
} else {
question.innerHTML = html;
}
// The ok button
var okButton = doc.createElement("button");
okButton.type = "button";
okButton.className = "btn-s primary";
okButton.onclick = function () { return close(false); };
okButton.innerHTML = ok;
/*
style = okButton.style;
style.margin = "10px";
style.display = "inline";
style.width = "7em";
*/
// The cancel button
var cancelButton = doc.createElement("button");
cancelButton.type = "button";
cancelButton.className = "btn-s";
cancelButton.onclick = function () { return close(true); };
cancelButton.innerHTML = cancel;
/*
style = cancelButton.style;
style.margin = "10px";
style.display = "inline";
style.width = "7em";
*/
form.appendChild(okButton);
form.appendChild(cancelButton);
util.addEvent(doc.body, "keydown", checkEscape);
/*
dialog.style.top = "50%";
dialog.style.left = "50%";
dialog.style.display = "block";
if (uaSniffed.isIE_5or6) {
dialog.style.position = "absolute";
dialog.style.top = doc.documentElement.scrollTop + 200 + "px";
dialog.style.left = "50%";
}
*/
doc.body.appendChild(dialog);
// This has to be done AFTER adding the dialog to the form if you
// want it to be centered.
/*
dialog.style.marginTop = -(position.getHeight(dialog) / 2) + "px";
dialog.style.marginLeft = -(position.getWidth(dialog) / 2) + "px";
*/
};
// Why is this in a zero-length timeout?
// Is it working around a browser bug?
setTimeout(function () {
createDialog();
}, 0);
}
// This simulates a modal dialog box and asks for the URL when you
// click the hyperlink or image buttons.
//
@ -2674,6 +2803,7 @@ else
// The main dialog box.
dialog = doc.createElement("div");
dialog.className = "wmd-prompt-dialog";
dialog.setAttribute("role", "dialog");
/*
dialog.style.padding = "10px;";
dialog.style.position = "fixed";
@ -2787,7 +2917,7 @@ else
}, 0);
};
function UIManager(postfix, panels, undoManager, previewManager, commandManager, fullScreenManager, helpOptions, getString) {
function UIManager(postfix, panels, hooks, undoManager, previewManager, commandManager, fullScreenManager, helpOptions, getString) {
var inputBox = panels.input,
buttons = {}; // buttons.undo, buttons.link, etc. The actual DOM elements.
@ -3093,6 +3223,9 @@ else
buttons.exitFullscreen.style.display = 'none';
buttons.exitFullscreen.execute = function () { fullScreenManager.doFullScreen(buttons, false); };
// button hooks
hooks.makeButton(buttons, makeButton, bindCommand, ui);
if (helpOptions) {
var helpButton = document.createElement("li");
var helpButtonImage = document.createElement("span");

View File

@ -1317,3 +1317,26 @@ jQuery.cookie = function (key, value, options) {
};
})( jQuery );
jQuery.fn.css2 = jQuery.fn.css;
jQuery.fn.css = function() {
if (arguments.length) return jQuery.fn.css2.apply(this, arguments);
var attr = ['font-family','font-size','font-weight','font-style','color', 'box-sizing',
'text-transform','text-decoration','letter-spacing', 'box-shadow',
'line-height','text-align','vertical-align','direction','background-color',
'background-image','background-repeat','background-position',
'background-attachment','opacity','width','height','top','right','bottom',
'left','margin-top','margin-right','margin-bottom','margin-left',
'padding-top','padding-right','padding-bottom','padding-left',
'border-top-width','border-right-width','border-bottom-width',
'border-left-width','border-top-color','border-right-color',
'border-bottom-color','border-left-color','border-top-style',
'border-right-style','border-bottom-style','border-left-style','position',
'display','visibility','z-index','overflow-x','overflow-y','white-space',
'clip','float','clear','cursor','list-style-image','list-style-position',
'list-style-type','marker-offset'];
var len = attr.length, obj = {};
for (var i = 0; i < len; i++)
obj[attr[i]] = jQuery.fn.css2.call(this, attr[i]);
return obj;
};

View File

@ -50,16 +50,16 @@ $isAllComments = ('on' == $request->get('__typecho_all_comments') || 'on' == Typ
<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="dropdown-toggle btn-s" type="button"><?php _e('<i class="sr-only">操作</i>选中项'); ?> <i class="i-caret-down"></i></button>
<button class="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 href="<?php $options->index('/action/comments-edit?do=approved'); ?>"><?php _e('通过'); ?></a></li>
<li><a href="<?php $options->index('/action/comments-edit?do=waiting'); ?>"><?php _e('待审核'); ?></a></li>
<li><a href="<?php $options->index('/action/comments-edit?do=spam'); ?>"><?php _e('标记垃圾'); ?></a></li>
<li><a lang="<?php _e('你确认要删除这些评论吗?'); ?>" href="<?php $options->index('/action/comments-edit?do=delete'); ?>"><?php _e('删除'); ?></a></li>
<?php if('spam' == $request->get('status')): ?>
<li><a lang="<?php _e('你确认要删除所有垃圾评论吗?'); ?>" href="<?php $options->index('/action/comments-edit?do=delete-spam'); ?>"><?php _e('删除所有垃圾评论'); ?></a></li>
<?php endif; ?>
<li><a lang="<?php _e('你确认要删除这些评论吗?'); ?>" href="<?php $options->index('/action/comments-edit?do=delete'); ?>"><?php _e('删除'); ?></a></li>
</ul>
<?php if('spam' == $request->get('status')): ?>
<button lang="<?php _e('你确认要删除所有垃圾评论吗?'); ?>" class="btn-s btn-warn btn-operate" href="<?php $options->index('/action/comments-edit?do=delete-spam'); ?>"><?php _e('删除所有垃圾评论'); ?></button>
<?php endif; ?>
</div>
</div>
<div class="search" role="search">
@ -192,16 +192,16 @@ $isAllComments = ('on' == $request->get('__typecho_all_comments') || 'on' == Typ
<div class="operate">
<input type="checkbox" class="typecho-table-select-all" />
<div class="btn-group btn-drop">
<button class="dropdown-toggle btn-s" type="button"><?php _e('<i class="sr-only">操作</i>选中项'); ?> <i class="i-caret-down"></i></button>
<button class="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 href="<?php $options->index('/action/comments-edit?do=approved'); ?>"><?php _e('通过'); ?></a></li>
<li><a href="<?php $options->index('/action/comments-edit?do=waiting'); ?>"><?php _e('待审核'); ?></a></li>
<li><a href="<?php $options->index('/action/comments-edit?do=spam'); ?>"><?php _e('标记垃圾'); ?></a></li>
<li><a lang="<?php _e('你确认要删除这些评论吗?'); ?>" href="<?php $options->index('/action/comments-edit?do=delete'); ?>"><?php _e('删除'); ?></a></li>
<?php if('spam' == $request->get('status')): ?>
<li><a lang="<?php _e('你确认要删除所有垃圾评论吗?'); ?>" href="<?php $options->index('/action/comments-edit?do=delete-spam'); ?>"><?php _e('删除所有垃圾评论'); ?></a></li>
<?php endif; ?>
</ul>
<?php if('spam' == $request->get('status')): ?>
<button lang="<?php _e('你确认要删除所有垃圾评论吗?'); ?>" class="btn-s btn-warn btn-operate" href="<?php $options->index('/action/comments-edit?do=delete-spam'); ?>"><?php _e('删除所有垃圾评论'); ?></button>
<?php endif; ?>
</div>
</div>
<?php if($comments->have()): ?>

View File

@ -18,11 +18,12 @@ $stat = Typecho_Widget::widget('Widget_Stat');
<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="dropdown-toggle btn-s" type="button"><?php _e('<i class="sr-only">操作</i>选中项'); ?> <i class="i-caret-down"></i></button>
<button class="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 $options->index('/action/contents-attachment-edit?do=delete'); ?>"><?php _e('删除'); ?></a></li>
</ul>
</div>
<button class="btn-s btn-warn btn-operate" href="<?php $options->index('/action/contents-attachment-edit?do=clear'); ?>" lang="<?php _e('您确认要清理未归档的文件吗?'); ?>"><?php _e('清理未归档文件'); ?></button>
</div>
</div>
<div class="search" role="search">
<?php if ('' != $request->keywords): ?>
@ -93,11 +94,12 @@ $stat = Typecho_Widget::widget('Widget_Stat');
<div class="operate">
<input type="checkbox" class="typecho-table-select-all" />
<div class="btn-group btn-drop">
<button class="dropdown-toggle btn-s" type="button"><?php _e('<i class="sr-only">操作</i>选中项'); ?> <i class="i-caret-down"></i></button>
<button class="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 $options->index('/action/contents-attachment-edit?do=delete'); ?>"><?php _e('删除'); ?></a></li>
</ul>
</div>
<button class="btn-s btn-warn btn-operate" href="<?php $options->index('/action/contents-attachment-edit?do=clear'); ?>" lang="<?php _e('您确认要清理未归档的文件吗?'); ?>"><?php _e('清理未归档文件'); ?></button>
</div>
<?php if($attachments->have()): ?>
<ul class="typecho-pager">

View File

@ -24,7 +24,7 @@ include 'menu.php';
<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="dropdown-toggle btn-s" type="button"><?php _e('<i class="sr-only">操作</i>选中项'); ?> <i class="i-caret-down"></i></button>
<button class="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 $options->index('/action/metas-category-edit?do=delete'); ?>"><?php _e('删除'); ?></a></li>
<li><a lang="<?php _e('刷新分类可能需要等待较长时间, 你确认要刷新这些分类吗?'); ?>" href="<?php $options->index('/action/metas-category-edit?do=refresh'); ?>"><?php _e('刷新'); ?></a></li>
@ -92,7 +92,7 @@ include 'menu.php';
<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="dropdown-toggle btn-s" type="button"><?php _e('<i class="sr-only">操作</i>选中项'); ?> <i class="i-caret-down"></i></button>
<button class="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 $options->index('/action/metas-tag-edit?do=delete'); ?>"><?php _e('删除'); ?></a></li>
<li><a lang="<?php _e('刷新标签可能需要等待较长时间, 你确认要刷新这些标签吗?'); ?>" href="<?php $options->index('/action/metas-tag-edit?do=refresh'); ?>"><?php _e('刷新'); ?></a></li>

View File

@ -15,7 +15,7 @@ $stat = Typecho_Widget::widget('Widget_Stat');
<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="dropdown-toggle btn-s" type="button"><?php _e('<i class="sr-only">操作</i>选中项'); ?> <i class="i-caret-down"></i></button>
<button class="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 $options->index('/action/contents-page-edit?do=delete'); ?>"><?php _e('删除'); ?></a></li>
</ul>

View File

@ -15,7 +15,7 @@ $stat = Typecho_Widget::widget('Widget_Stat');
<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="dropdown-toggle btn-s" type="button"><?php _e('<i class="sr-only">操作</i>选中项'); ?> <i class="i-caret-down"></i></button>
<button class="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 $options->index('/action/contents-post-edit?do=delete'); ?>"><?php _e('删除'); ?></a></li>
</ul>
@ -125,7 +125,7 @@ $stat = Typecho_Widget::widget('Widget_Stat');
<div class="operate">
<input type="checkbox" class="typecho-table-select-all" />
<div class="btn-group btn-drop">
<button class="dropdown-toggle btn-s" type="button"><?php _e('<i class="sr-only">操作</i>选中项'); ?> <i class="i-caret-down"></i></button>
<button class="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 $options->index('/action/contents-post-edit?do=delete'); ?>"><?php _e('删除'); ?></a></li>
</ul>

View File

@ -13,7 +13,7 @@ include 'menu.php';
<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="dropdown-toggle btn-s" type="button"><?php _e('<i class="sr-only">操作</i>选中项'); ?> <i class="i-caret-down"></i></button>
<button class="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 $options->index('/action/users-edit?do=delete'); ?>"><?php _e('删除'); ?></a></li>
</ul>
@ -92,7 +92,7 @@ include 'menu.php';
<div class="operate">
<input type="checkbox" class="typecho-table-select-all" />
<div class="btn-group btn-drop">
<button class="dropdown-toggle btn-s" type="button"><?php _e('<i class="sr-only">操作</i>选中项'); ?> <i class="i-caret-down"></i></button>
<button class="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 $options->index('/action/users-edit?do=delete'); ?>"><?php _e('删除'); ?></a></li>
</ul>

View File

@ -27,7 +27,7 @@ Typecho_Widget::widget('Widget_Contents_Attachment_Edit')->to($attachment);
</p>
<div id="upload-panel" class="p">
<div class="upload-area">拖放替换文件到这里 或者 <a href="###" class="upload-file">选择文件替换</a></div>
<div class="upload-area"><?php _e('拖放文件到这里<br>或者 %s选择文件上传%s', '<a href="###" class="upload-file">', '</a>'); ?></div>
<ul id="file-list"></ul>
</div>
</div>

View File

@ -1,4 +1,4 @@
<?php if(!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php if(!defined('__TYPECHO_ADMIN__')) exit; ?>
<div class="typecho-head-nav clearfix" role="navigation">
<nav id="typecho-nav-list">
<?php $menu->output(); ?>
@ -9,7 +9,7 @@
if ($user->logged > 0) {
_e('最后登录: %s', Typecho_I18n::dateWord($user->logged + $options->timezone, $options->gmtTime + $options->timezone));
}
?>" 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(); ?>">网站</a>
?>" 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

@ -1,4 +1,4 @@
<?php if(!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php if(!defined('__TYPECHO_ADMIN__')) exit; ?>
<div class="colgroup">
<div class="typecho-page-title col-mb-12">
<h2><?php echo $menu->title; ?><?php

View File

@ -17,6 +17,7 @@
margin-right: 4px;
padding: 3px;
cursor: pointer;
vertical-align: middle;
@include border-radius(2px);
&:hover {
background-color: #E9E9E6;
@ -24,7 +25,7 @@
&.wmd-spacer {
height: 20px;
margin: 0 10px 0 6px;
padding: 3px 0;
padding: 0;
width: 1px;
background: #E9E9E6;
cursor: default;

View File

@ -302,7 +302,7 @@ a.button:hover, a.balloon-button:hover {
}
.typecho-login {
display: table-cell;
padding-bottom: 100px;
padding: 30px 0 100px;
width: 280px;
text-align: center;
vertical-align: middle;

View File

@ -1,4 +1,4 @@
<?php if(!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php if(!defined('__TYPECHO_ADMIN__')) exit; ?>
<script>
(function () {
$(document).ready(function () {
@ -6,7 +6,7 @@
checkEl : 'input[type=checkbox]',
rowEl : 'tr',
selectAllEl : '.typecho-table-select-all',
actionEl : '.dropdown-menu a'
actionEl : '.dropdown-menu a,button.btn-operate'
});
$('.btn-drop').dropdownMenu({

View File

@ -11,7 +11,7 @@ include 'menu.php';
<div class="col-mb-12">
<div id="typecho-welcome">
<form action="<?php echo Typecho_Router::url('do', array('action' => 'upgrade', 'widget' => 'Upgrade'),
Typecho_Common::url('index.php', $options->siteUrl)); ?>" method="post">
Typecho_Common::url('index.php', $options->rootUrl)); ?>" method="post">
<h3><?php _e('检测到新版本!'); ?></h3>
<ul>
<li><?php _e('您已经更新了系统程序, 我们还需要执行一些后续步骤来完成升级'); ?></li>
@ -29,5 +29,12 @@ include 'menu.php';
<?php
include 'copyright.php';
include 'common-js.php';
include 'footer.php';
?>
<script>
(function () {
if (window.sessionStorage) {
sessionStorage.removeItem('update');
}
})();
</script>
<?php include 'footer.php'; ?>

View File

@ -1,4 +1,4 @@
<?php if(!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php if(!defined('__TYPECHO_ADMIN__')) exit; ?>
<?php Typecho_Plugin::factory('admin/write-js.php')->write(); ?>
<?php Typecho_Widget::widget('Widget_Metas_Tag_Cloud', 'sort=count&desc=1&limit=200')->to($tags); ?>
@ -109,20 +109,32 @@ $(document).ready(function() {
var slug = $('#slug');
if (slug.length > 0) {
var sw = slug.width();
if (slug.val().length > 0) {
slug.css('width', 'auto').attr('size', slug.val().length);
var justifySlug = $('<div />').css(slug.css()).css({
'display' : 'none',
'width' : 'auto'
}).insertAfter(slug), originalWidth = slug.width();
function justifySlugWidth() {
var html = slug.val().replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/'/g, '&#039;')
.replace(/"/g, '&quot;')
.replace(/ /g, '&nbsp;')
.replace(/((&nbsp;)*)&nbsp;/g, '$1 ')
.replace(/\n/g, '<br />')
.replace(/<br \/>[ ]*$/, '<br />-')
.replace(/<br \/> /g, '<br />&nbsp;');
justifySlug.css('min-width', html.length > 0
? 'inherit' : originalWidth);
justifySlug.html(html);
slug.width(justifySlug.width());
}
slug.bind('input propertychange', function () {
var t = $(this), l = t.val().length;
if (l > 0) {
t.css('width', 'auto').attr('size', l);
} else {
t.css('width', sw).removeAttr('size');
}
}).width();
slug.bind('input propertychange', justifySlugWidth);
justifySlugWidth();
}
// 原始的插入图片和文件

View File

@ -18,7 +18,7 @@ Typecho_Widget::widget('Widget_Contents_Page_Edit')->to($page);
<p class="title">
<label for="title" class="sr-only"><?php _e('标题'); ?></label>
<input type="text" id="title" name="title" autocomplete="off" value="<?php echo htmlspecialchars($page->title); ?>" placeholder="<?php _e('标题'); ?>" class="w-100 text title" />
<input type="text" id="title" name="title" autocomplete="off" value="<?php $page->title(); ?>" placeholder="<?php _e('标题'); ?>" class="w-100 text title" />
</p>
<?php $permalink = Typecho_Common::url($options->routingTable['page']['url'], $options->index);
list ($scheme, $permalink) = explode(':', $permalink, 2);

View File

@ -18,7 +18,7 @@ Typecho_Widget::widget('Widget_Contents_Post_Edit')->to($post);
<p class="title">
<label for="title" class="sr-only"><?php _e('标题'); ?></label>
<input type="text" id="title" name="title" autocomplete="off" value="<?php echo htmlspecialchars($post->title); ?>" placeholder="<?php _e('标题'); ?>" class="w-100 text title" />
<input type="text" id="title" name="title" autocomplete="off" value="<?php $post->title(); ?>" placeholder="<?php _e('标题'); ?>" class="w-100 text title" />
</p>
<?php $permalink = Typecho_Common::url($options->routingTable['post']['url'], $options->index);
list ($scheme, $permalink) = explode(':', $permalink, 2);

View File

@ -333,11 +333,11 @@ list($prefixVersion, $suffixVersion) = explode('/', $currentVersion);
/** 初始内容 */
$installDb->query($installDb->insert('table.contents')->rows(array('title' => _t('欢迎使用 Typecho'), 'slug' => 'start', 'created' => Typecho_Date::gmtTime(), 'modified' => Typecho_Date::gmtTime(),
'text' => _t('如果您看到这篇文章,表示您的 blog 已经安装成功.'), 'authorId' => 1, 'type' => 'post', 'status' => 'publish', 'commentsNum' => 1, 'allowComment' => 1,
'text' => '<!--markdown-->' . _t('如果您看到这篇文章,表示您的 blog 已经安装成功.'), 'authorId' => 1, 'type' => 'post', 'status' => 'publish', 'commentsNum' => 1, 'allowComment' => 1,
'allowPing' => 1, 'allowFeed' => 1, 'parent' => 0)));
$installDb->query($installDb->insert('table.contents')->rows(array('title' => _t('关于'), 'slug' => 'start-page', 'created' => Typecho_Date::gmtTime(), 'modified' => Typecho_Date::gmtTime(),
'text' => _t('本页面由 Typecho 创建, 这只是个测试页面.'), 'authorId' => 1, 'order' => 0, 'type' => 'page', 'status' => 'publish', 'commentsNum' => 0, 'allowComment' => 1,
'text' => '<!--markdown-->' . _t('本页面由 Typecho 创建, 这只是个测试页面.'), 'authorId' => 1, 'order' => 0, 'type' => 'page', 'status' => 'publish', 'commentsNum' => 0, 'allowComment' => 1,
'allowPing' => 1, 'allowFeed' => 1, 'parent' => 0)));
/** 初始评论 */
@ -594,15 +594,11 @@ Typecho_Db::set(\$db);
<h2><?php _e('安装说明'); ?></h2>
<p><strong><?php _e('本安装程序将自动检测服务器环境是否符合最低配置需求. 如果不符合, 将在上方出现提示信息, 请按照提示信息检查您的主机配置. 如果服务器环境符合要求, 将在下方出现 "开始下一步" 的按钮, 点击此按钮即可一步完成安装.'); ?></strong></p>
<h2><?php _e('许可及协议'); ?></h2>
<p><?php _e('Typecho 基于 <a href="http://www.gnu.org/copyleft/gpl.html">GPL</a> 协议发布,我们允许用户在 GPL 协议许可的范围内使用,拷贝,修改和分发此程序.
您可以自由地将其用于商业以及非商业用途.'); ?></p>
<p><?php _e('Typecho 软件由其社区提供支持,核心开发团队负责维护程序日常开发工作以及新特性的制定.如果您遇到使用上的问题,
程序中的 BUG,以及期许的新功能,欢迎您在社区中交流或者直接向我们贡献代码.对于贡献突出者,他的名字将出现在贡献者名单中.'); ?></p>
<h3><?php _e('此版本贡献者(排名不分先后)'); ?></h3>
<ol>
</ol>
<p><a href="http://typecho.org"><?php _e('查看所有贡献者'); ?></a></p>
<p><?php _e('Typecho 基于 <a href="http://www.gnu.org/copyleft/gpl.html">GPL</a> 协议发布, 我们允许用户在 GPL 协议许可的范围内使用, 拷贝, 修改和分发此程序.'); ?>
<?php _e('在GPL许可的范围内您可以自由地将其用于商业以及非商业用途.'); ?></p>
<p><?php _e('Typecho 软件由其社区提供支持, 核心开发团队负责维护程序日常开发工作以及新特性的制定.'); ?>
<?php _e('如果您遇到使用上的问题, 程序中的 BUG, 以及期许的新功能, 欢迎您在社区中交流或者直接向我们贡献代码.'); ?>
<?php _e('对于贡献突出者, 他的名字将出现在贡献者名单中.'); ?></p>
</div>
<p class="submit"><button type="submit" class="primary"><?php _e('我准备好了, 开始下一步 &raquo;'); ?></button></p>
</form>

View File

@ -97,7 +97,7 @@ $baeDbPassword = "getenv('HTTP_BAE_ENV_SK')";
<li>
<label class="typecho-label" for="dbHost"><?php _e('数据库地址'); ?></label>
<input type="text" class="text" name="dbHost" id="dbHost" value="<?php _v('dbHost', 'localhost'); ?>"/>
<p class="description"><?php _e('您可能会使用 "localhost"'); ?></p>
<p class="description"><?php _e('您可能会使用 "%s"', 'localhost'); ?></p>
</li>
<li>
<label class="typecho-label" for="dbPort"><?php _e('数据库端口'); ?></label>
@ -107,7 +107,7 @@ $baeDbPassword = "getenv('HTTP_BAE_ENV_SK')";
<li>
<label class="typecho-label" for="dbUser"><?php _e('数据库用户名'); ?></label>
<input type="text" class="text" name="dbUser" id="dbUser" value="<?php _v('dbUser', 'root'); ?>" />
<p class="description"><?php _e('您可能会使用 "root"'); ?></p>
<p class="description"><?php _e('您可能会使用 "%s"', 'root'); ?></p>
</li>
<li>
<label class="typecho-label" for="dbPassword"><?php _e('数据库密码'); ?></label>

View File

@ -2,7 +2,7 @@
<li>
<label class="typecho-label" for="dbHost"><?php _e('数据库地址'); ?></label>
<input type="text" class="text" name="dbHost" id="dbHost" value="<?php _v('dbHost', 'localhost'); ?>"/>
<p class="description"><?php _e('您可能会使用 "localhost"'); ?></p>
<p class="description"><?php _e('您可能会使用 "%s"', 'localhost'); ?></p>
</li>
<li>
<label class="typecho-label" for="dbPort"><?php _e('数据库端口'); ?></label>
@ -12,7 +12,7 @@
<li>
<label class="typecho-label" for="dbUser"><?php _e('数据库用户名'); ?></label>
<input type="text" class="text" name="dbUser" id="dbUser" value="<?php _v('dbUser', 'postgres'); ?>" />
<p class="description"><?php _e('您可能会使用 "postgres"'); ?></p>
<p class="description"><?php _e('您可能会使用 "%s"', 'postgres'); ?></p>
</li>
<li>
<label class="typecho-label" for="dbPassword"><?php _e('数据库密码'); ?></label>

View File

@ -2,8 +2,6 @@
#define root directory
DIR=../
TINYMCE=3_2_2
#update subversion
update:
@ -11,7 +9,8 @@ update:
rm -Rf build/
git clone https://github.com/typecho/typecho-replica.git build
rm -Rf build/.git
rm -Rf build/.gitignore
rm -f build/.gitignore
rm -f build/.gitattributes
for i in `find build/ -name '*.css'`; do echo $$i && java -Xmx32m -jar yuicompressor-2.4.2.jar $$i --charset UTF-8 -o $$i; done;
for i in `find build/admin/js/ -name '*.js'`; do echo $$i && java -Xmx32m -jar yuicompressor-2.4.2.jar $$i --charset UTF-8 -o $$i; done;
for i in `find build/ -name '*.php'`; do php -l $$i; done;
@ -20,7 +19,10 @@ update:
package:
@echo 'package'
rm -Rf build/tools/
rm -Rf build/todo.txt
rm -f build/todo.txt
rm -f build/changelog.txt
rm -f build/.travis.yml
rm -f build/README.md
rm -Rf build/admin/scss
rm -Rf build/admin/img/editor
rm -Rf build/admin/img/icons
@ -52,15 +54,13 @@ theme:
make clear
typecho:
for i in `php list.php "build/var/Typecho/"`; do php tc.php "in=$$i&out=build/var/Typecho.php"; done;
rm -Rf build/var/Typecho/
install:
make update
rm -Rf build/tools/
rm -Rf build/todo.txt
rm -f build/todo.txt
rm -f build/changelog.txt
rm -f build/.travis.yml
rm -f build/README.md
rm -Rf build/admin/scss
rm -Rf build/admin/img/editor
rm -Rf build/admin/img/icons
@ -71,14 +71,10 @@ install:
make clear
tinymce:
wget http://prdownloads.sourceforge.net/tinymce/tinymce_${TINYMCE}.zip?download
unzip tinymce_${TINYMCE}.zip
for i in `find tinymce/jscripts/ -name '*.js'`; do php mcecp.php "in=$$i&out=../usr/plugins/TinyMCE/tiny_mce/$$i"; done;
for i in `find tinymce/jscripts/ -name '*.htm'`; do php mcecp.php "in=$$i&out=../usr/plugins/TinyMCE/tiny_mce/$$i"; done;
rm -Rf tinymce/
rm -Rf tinymce_${TINYMCE}.zip
svn ci ../usr/plugins/TinyMCE/tiny_mce/ -m "upgrade tiny_mce to ${TINYMCE}"
pot:
cd ../ && php tools/list.php ./ > tools/files.txt
cd ../ && xgettext --files-from=tools/files.txt -Lphp --from-code=UTF-8 --keyword=_t --keyword=_e --keyword=_n:1,2 --no-location --copyright-holder=Typecho --package-name=Typecho --package-version=`grep -E "VERSION = '(.*)'" ./var/Typecho/Common.php | cut -d "'" -f 2` --no-wrap --output=tools/messages.pot
rm -f files.txt
all:

View File

@ -6,68 +6,31 @@ if (!isset($argv[1])) {
exit(1);
}
//获取一个目录下的文件
function mgGetFile($inpath, $trim = false,$stamp = NULL)
{
$file = array();
/**
* 获取所有文件
*
* @param string $dir
* @param string $pattern
* @return array
*/
function all_files($dir, $pattern = '*') {
$result = array();
if(!is_dir($inpath))
{
return $file;
}
$items = glob($dir . '/' . $pattern, GLOB_BRACE);
foreach ($items as $item) {
if (is_file($item)) {
$result[] = $item;
}
}
$handle=opendir($inpath);
if(NULL != $stamp)
{
$stamp = explode("|",$stamp);
}
while ($tmp = readdir($handle))
{
if(file_exists($inpath."/".$tmp) && eregi("^([_@0-9a-zA-Z\x80-\xff\^\.\%-]{0,})[\.]([0-9a-zA-Z]{1,})$",$tmp,$file_name))
{
if($stamp != NULL && in_array($file_name[2],$stamp))
{
$file[] = $trim ? $file_name[0] : $file_name[1];
}
else if($stamp == NULL)
{
$file[] = $trim ? $file_name[0] : $file_name[1];
}
}
}
closedir($handle);
return $file;
}
//获取一个目录下的目录
function mgGetDir($inpath)
{
$handle=opendir($inpath);
$dir = array();
while ($tmp = readdir($handle))
{
if(is_dir($inpath."/".$tmp) && $tmp != ".." && $tmp != "." && 0 !== stripos($tmp,'.'))
{
$dir[] = $tmp;
}
}
closedir($handle);
return $dir;
}
function listFile($inpath, $stamp)
{
$files = mgGetFile($inpath, true, $stamp);
$dirs = mgGetDir($inpath);
if ($dirs) {
foreach ($dirs as $dir) {
$files = array_merge($files, listFile($dir, $stamp));
$items = glob($dir . '/*', GLOB_ONLYDIR);
foreach ($items as $item) {
if (is_dir($item)) {
$result = array_merge($result, all_files($item, $pattern));
}
}
return $files;
return $result;
}
echo implode("\n", listFile($argv[1], 'php'));
echo implode("\n", all_files($argv[1], '*.php'));

View File

@ -1,38 +0,0 @@
<?php
/** 参数不存在则退出 */
if (!isset($argv[1])) {
echo 'no args';
exit(1);
}
/** 解析所有的参数 */
parse_str($argv[1], $options);
/** 必要参数检测 */
if (!isset($options['in']) || !isset($options['out'])) {
echo 'no input or output file';
exit(1);
}
$in = $options['in'];
$out = str_replace('tinymce/jscripts/tiny_mce/', '', $options['out']);
if (file_exists($out)) {
echo $out . "\n";
unlink($out);
copy($in, $out);
switch ($out) {
case '../usr/plugins/TinyMCE/tiny_mce/tiny_mce.js':
file_put_contents($out, str_replace('javascript:;', '#', file_get_contents($out)));
break;
default:
break;
}
}
exit(0);

View File

@ -1,7 +1,7 @@
<div id="comments">
<?php $this->comments()->to($comments); ?>
<?php if ($comments->have()): ?>
<h3><?php $this->commentsNum(_t('暂无评论'), _t('仅有 1 条评论'), _t('已有 %d 条评论')); ?></h3>
<h3><?php $this->commentsNum(_t('暂无评论'), _t('仅有条评论'), _t('已有 %d 条评论')); ?></h3>
<?php $comments->listComments(); ?>

View File

@ -1,8 +1,5 @@
<!DOCTYPE HTML>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<html class="no-js">
<head>
<meta charset="<?php $this->options->charset(); ?>">
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
@ -30,7 +27,7 @@
</head>
<body>
<!--[if lt IE 8]>
<div class="browsehappy"><?php _e('当前网页 <strong>不支持</strong> 你正在使用的浏览器. 为了正常的访问, 请 <a href="http://browsehappy.com/">升级你的浏览器</a>'); ?>.</div>
<div class="browsehappy" role="dialog"><?php _e('当前网页 <strong>不支持</strong> 你正在使用的浏览器. 为了正常的访问, 请 <a href="http://browsehappy.com/">升级你的浏览器</a>'); ?>.</div>
<![endif]-->
<header id="header" class="clearfix">

View File

@ -15,6 +15,11 @@
</article>
<?php $this->need('comments.php'); ?>
<ul class="post-near">
<li>上一篇:<?php $this->thePrev('%s','没有了'); ?></li>
<li>下一篇:<?php $this->theNext('%s','没有了'); ?></li>
</ul>
</div><!-- end #main-->
<?php $this->need('sidebar.php'); ?>

View File

@ -195,6 +195,16 @@ textarea {
clear: both;
}
.post-near {
list-style: none;
margin: 30px 0;
padding: 0;
color: #999;
}
.post-near li {
margin: 10px 0;
}
.archive-title {
margin: 1em 0 -1em;
padding-top: 20px;
@ -364,7 +374,8 @@ textarea {
.post-content video, .comment-content video {
max-width: 100%;
}
.post-content a img {
.post-content a img,
.comment-content a img {
background: #FFF;
position: relative;
bottom: -4px; /* hidden img parent link border */

View File

@ -20,7 +20,7 @@
class Typecho_Common
{
/** 程序版本 */
const VERSION = '0.9/13.12.10';
const VERSION = '0.9/13.12.20';
/**
* 缓存的包含路径

View File

@ -29,16 +29,28 @@ class Typecho_Cookie
*/
private static $_prefix = '';
/**
* 路径
*
* @var string
* @access private
*/
private static $_path = '/';
/**
* 设置前缀
*
* @param string $prefix
* @param string $url
* @access public
* @return void
*/
public static function setPrefix($prefix)
public static function setPrefix($url)
{
self::$_prefix = md5($prefix);
self::$_prefix = md5($url);
$parsed = parse_url($url);
/** 在路径后面强制加上斜杠 */
self::$_path = empty($parsed['path']) ? '/' : Typecho_Common::url(NULL, $parsed['path']);
}
/**
@ -74,27 +86,19 @@ class Typecho_Cookie
* @param string $key 指定的参数
* @param mixed $value 设置的值
* @param integer $expire 过期时间,默认为0,表示随会话时间结束
* @param string $url 路径(可以是域名,也可以是地址)
* @return void
*/
public static function set($key, $value, $expire = 0, $url = NULL)
public static function set($key, $value, $expire = 0)
{
$path = '/';
$key = self::$_prefix . $key;
if (!empty($url)) {
$parsed = parse_url($url);
/** 在路径后面强制加上斜杠 */
$path = empty($parsed['path']) ? '/' : Typecho_Common::url(NULL, $parsed['path']);
}
/** 对数组型COOKIE的写入支持 */
if (is_array($value)) {
foreach ($value as $name => $val) {
setrawcookie("{$key}[{$name}]", rawurlencode($val), $expire, $path);
setrawcookie("{$key}[{$name}]", rawurlencode($val), $expire, self::$_path);
}
} else {
setrawcookie($key, rawurlencode($value), $expire, $path);
setrawcookie($key, rawurlencode($value), $expire, self::$_path);
}
$_COOKIE[$key] = $value;
@ -107,28 +111,20 @@ class Typecho_Cookie
* @param string $key 指定的参数
* @return void
*/
public static function delete($key, $url = NULL)
public static function delete($key)
{
$key = self::$_prefix . $key;
if (!isset($_COOKIE[$key])) {
return;
}
$path = '/';
if (!empty($url)) {
$parsed = parse_url($url);
/** 在路径后面强制加上斜杠 */
$path = empty($parsed['path']) ? '/' : Typecho_Common::url(NULL, $parsed['path']);
}
/** 对数组型COOKIE的删除支持 */
if (is_array($_COOKIE[$key])) {
foreach ($_COOKIE[$key] as $name => $val) {
setcookie("{$key}[{$name}]", '', time() - 2592000, $path);
setcookie("{$key}[{$name}]", '', time() - 2592000, self::$_path);
}
} else {
setcookie($key, '', time() - 2592000, $path);
setcookie($key, '', time() - 2592000, self::$_path);
}
unset($_COOKIE[$key]);

View File

@ -13,8 +13,7 @@
* @param string $string 需要翻译的文字
* @return string
*/
function _t($string)
{
function _t($string) {
if (func_num_args() <= 1) {
return Typecho_I18n::translate($string);
} else {
@ -30,8 +29,7 @@ function _t($string)
* @param string $string 需要翻译并输出的文字
* @return void
*/
function _e()
{
function _e() {
$args = func_get_args();
echo call_user_func_array('_t', $args);
}
@ -44,8 +42,7 @@ function _e()
* @param integer $number 数字
* @return string
*/
function _n($single, $plural, $number)
{
function _n($single, $plural, $number) {
return Typecho_I18n::ngettext($single, $plural, $number);
}
@ -126,40 +123,41 @@ class Typecho_I18n
$between = $now - $from;
/** 如果是一天 */
if ($between > 0 && $between < 86400 && idate('d', $from) == idate('d', $now)) {
if ($between >= 0 && $between < 86400 && date('d', $from) == date('d', $now)) {
/** 如果是一小时 */
if ($between < 3600 && idate('H', $from) == idate('H', $now)) {
if ($between < 3600) {
/** 如果是一分钟 */
if ($between < 60 && idate('i', $from) == idate('i', $now)) {
$second = idate('s', $now) - idate('s', $from);
if (0 == $second) {
if ($between < 60) {
if (0 == $between) {
return _t('刚刚');
} else {
return sprintf(_n('%d秒前', '%d秒前', $second), $second);
return str_replace('%d', $between, _n('一秒前', '%d秒前', $between));
}
}
$min = idate('i', $now) - idate('i', $from);
return sprintf(_n('%d分钟前', '%d分钟前', $min), $min);
$min = floor($between / 60);
return str_replace('%d', $min, _n('一分钟前', '%d分钟前', $min));
}
$hour = idate('H', $now) - idate('H', $from);
return sprintf(_n('%d小时前', '%d小时前', $hour), $hour);
$hour = floor($between / 3600);
return str_replace('%d', $hour, _n('一小时前', '%d小时前', $hour));
}
/** 如果是昨天 */
if ($between > 0 && $between < 172800 && (idate('z', $from) + 1 == idate('z', $now) || idate('z', $from) > 2 + idate('z', $now))) {
if ($between > 0 && $between < 172800
&& (date('z', $from) + 1 == date('z', $now) // 在同一年的情况
|| date('z', $from) + 1 == date('L') + 365 + date('z', $now))) { // 跨年的情况
return _t('昨天 %s', date('H:i', $from));
}
/** 如果是一个星期 */
if ($between > 0 && $between < 604800 && idate('W', $from) == idate('W', $now)) {
$day = intval($between / (3600 * 24));
return sprintf(_n('%d天前', '%d天前', $day), $day);
if ($between > 0 && $between < 604800) {
$day = floor($between / 86400);
return str_replace('%d', $day, _n('一天前', '%天前', $day));
}
/** 如果是 */
if ($between > 0 && $between < 31622400 && idate('Y', $from) == idate('Y', $now)) {
if (date('Y', $from) == date('Y', $now)) {
return date(_t('n月j日'), $from);
}

View File

@ -78,17 +78,14 @@ class Typecho_I18n_GetText
// Caching can be turned off
$this->enable_cache = $enable_cache;
// $MAGIC1 = (int)0x950412de; //bug in PHP 5
$MAGIC1 = (int) - 1794895138;
// $MAGIC2 = (int)0xde120495; //bug
$MAGIC2 = (int) - 569244523;
$this->STREAM = @fopen($file, 'rb');
$magic = $this->readint();
if ($magic == $MAGIC1) {
$unpacked = unpack('c', $this->read(4));
$magic = array_shift($unpacked);
if (-34 == $magic) {
$this->BYTEORDER = 0;
} elseif ($magic == $MAGIC2) {
} elseif (-107 == $magic) {
$this->BYTEORDER = 1;
} else {
$this->error = 1; // not MO file
@ -103,6 +100,24 @@ class Typecho_I18n_GetText
$this->translations = $this->readint();
}
/**
* read
*
* @param mixed $count
* @access private
* @return void
*/
private function read($count)
{
$count = abs($count);
if ($count > 0) {
return fread($this->STREAM, $count);
}
return NULL;
}
/**
* Reads a 32bit Integer from the Stream
*
@ -111,7 +126,7 @@ class Typecho_I18n_GetText
*/
private function readint()
{
$end = unpack($this->BYTEORDER == 0 ? 'V' : 'N', fread($this->STREAM, 4));
$end = unpack($this->BYTEORDER == 0 ? 'V' : 'N', $this->read(4));
return array_shift($end);
}
@ -123,7 +138,7 @@ class Typecho_I18n_GetText
*/
private function readintarray($count)
{
return unpack(($this->BYTEORDER == 0 ? 'V' : 'N') . $count, fread($this->STREAM, 4 * $count));
return unpack(($this->BYTEORDER == 0 ? 'V' : 'N') . $count, $this->read(4 * $count));
}
/**

View File

@ -47,6 +47,22 @@ class Typecho_Request
*/
private $_requestUri = NULL;
/**
* _requestRoot
*
* @var mixed
* @access private
*/
private $_requestRoot = NULL;
/**
* 获取baseurl
*
* @var string
* @access private
*/
private $_baseUrl = NULL;
/**
* 客户端ip地址
*
@ -305,6 +321,30 @@ class Typecho_Request
$this->_params = array_merge($this->_params, $params);
}
/**
* getRequestRoot
*
* @access public
* @return void
*/
public function getRequestRoot()
{
if (NULL === $this->_requestRoot) {
$root = rtrim(($this->isSecure() ? 'https' : 'http')
. '://' . $_SERVER['HTTP_HOST']
. $this->getBaseUrl(), '/') . '/';
$pos = strrpos($root, '.php/');
if ($pos) {
$root = dirname(substr($root, 0, $pos));
}
$this->_requestRoot = rtrim($root, '/');
}
return $this->_requestRoot;
}
/**
* 获取当前请求url
*
@ -362,6 +402,69 @@ class Typecho_Request
return $this->_requestUri = $requestUri;
}
/**
* getBaseUrl
*
* @access public
* @return string
*/
public function getBaseUrl()
{
if (NULL !== $this->_baseUrl) {
return $this->_baseUrl;
}
//处理baseUrl
$filename = (isset($_SERVER['SCRIPT_FILENAME'])) ? basename($_SERVER['SCRIPT_FILENAME']) : '';
if (isset($_SERVER['SCRIPT_NAME']) && basename($_SERVER['SCRIPT_NAME']) === $filename) {
$baseUrl = $_SERVER['SCRIPT_NAME'];
} elseif (isset($_SERVER['PHP_SELF']) && basename($_SERVER['PHP_SELF']) === $filename) {
$baseUrl = $_SERVER['PHP_SELF'];
} elseif (isset($_SERVER['ORIG_SCRIPT_NAME']) && basename($_SERVER['ORIG_SCRIPT_NAME']) === $filename) {
$baseUrl = $_SERVER['ORIG_SCRIPT_NAME']; // 1and1 shared hosting compatibility
} else {
// Backtrack up the script_filename to find the portion matching
// php_self
$path = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : '';
$file = isset($_SERVER['SCRIPT_FILENAME']) ? $_SERVER['SCRIPT_FILENAME'] : '';
$segs = explode('/', trim($file, '/'));
$segs = array_reverse($segs);
$index = 0;
$last = count($segs);
$baseUrl = '';
do {
$seg = $segs[$index];
$baseUrl = '/' . $seg . $baseUrl;
++$index;
} while (($last > $index) && (false !== ($pos = strpos($path, $baseUrl))) && (0 != $pos));
}
// Does the baseUrl have anything in common with the request_uri?
$finalBaseUrl = NULL;
$requestUri = $this->getRequestUri();
if (0 === strpos($requestUri, $baseUrl)) {
// full $baseUrl matches
$finalBaseUrl = $baseUrl;
} else if (0 === strpos($requestUri, dirname($baseUrl))) {
// directory portion of $baseUrl matches
$finalBaseUrl = rtrim(dirname($baseUrl), '/');
} else if (!strpos($requestUri, basename($baseUrl))) {
// no match whatsoever; set it blank
$finalBaseUrl = '';
} else if ((strlen($requestUri) >= strlen($baseUrl))
&& ((false !== ($pos = strpos($requestUri, $baseUrl))) && ($pos !== 0)))
{
// If using mod_rewrite or ISAPI_Rewrite strip the script filename
// out of baseUrl. $pos !== 0 makes sure it is not matching a value
// from PATH_INFO or QUERY_STRING
$baseUrl = substr($requestUri, 0, $pos + strlen($baseUrl));
}
return ($this->_baseUrl = (NULL === $finalBaseUrl) ? rtrim($baseUrl, '/') : $finalBaseUrl);
}
/**
* 根据当前uri构造指定参数的uri
*
@ -418,55 +521,7 @@ class Typecho_Request
//处理requestUri
$requestUri = $this->getRequestUri();
//处理baseUrl
$filename = (isset($_SERVER['SCRIPT_FILENAME'])) ? basename($_SERVER['SCRIPT_FILENAME']) : '';
if (isset($_SERVER['SCRIPT_NAME']) && basename($_SERVER['SCRIPT_NAME']) === $filename) {
$baseUrl = $_SERVER['SCRIPT_NAME'];
} elseif (isset($_SERVER['PHP_SELF']) && basename($_SERVER['PHP_SELF']) === $filename) {
$baseUrl = $_SERVER['PHP_SELF'];
} elseif (isset($_SERVER['ORIG_SCRIPT_NAME']) && basename($_SERVER['ORIG_SCRIPT_NAME']) === $filename) {
$baseUrl = $_SERVER['ORIG_SCRIPT_NAME']; // 1and1 shared hosting compatibility
} else {
// Backtrack up the script_filename to find the portion matching
// php_self
$path = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : '';
$file = isset($_SERVER['SCRIPT_FILENAME']) ? $_SERVER['SCRIPT_FILENAME'] : '';
$segs = explode('/', trim($file, '/'));
$segs = array_reverse($segs);
$index = 0;
$last = count($segs);
$baseUrl = '';
do {
$seg = $segs[$index];
$baseUrl = '/' . $seg . $baseUrl;
++$index;
} while (($last > $index) && (false !== ($pos = strpos($path, $baseUrl))) && (0 != $pos));
}
// Does the baseUrl have anything in common with the request_uri?
$finalBaseUrl = NULL;
if (0 === strpos($requestUri, $baseUrl)) {
// full $baseUrl matches
$finalBaseUrl = $baseUrl;
} else if (0 === strpos($requestUri, dirname($baseUrl))) {
// directory portion of $baseUrl matches
$finalBaseUrl = rtrim(dirname($baseUrl), '/');
} else if (!strpos($requestUri, basename($baseUrl))) {
// no match whatsoever; set it blank
$finalBaseUrl = '';
} else if ((strlen($requestUri) >= strlen($baseUrl))
&& ((false !== ($pos = strpos($requestUri, $baseUrl))) && ($pos !== 0)))
{
// If using mod_rewrite or ISAPI_Rewrite strip the script filename
// out of baseUrl. $pos !== 0 makes sure it is not matching a value
// from PATH_INFO or QUERY_STRING
$baseUrl = substr($requestUri, 0, $pos + strlen($baseUrl));
}
$finalBaseUrl = (NULL === $finalBaseUrl) ? rtrim($baseUrl, '/') : $finalBaseUrl;
$finalBaseUrl = $this->getBaseUrl();
// Remove the query string from REQUEST_URI
if ($pos = strpos($requestUri, '?')) {

View File

@ -1087,5 +1087,22 @@ Typecho_Date::setTimezoneOffset($options->timezone);
->rows(array('name' => 'frontArchive', 'user' => 0, 'value' => 0)));
}
}
/**
* v0_9r13_12_20
*
* @param mixed $db
* @param mixed $options
* @access public
* @return void
*/
public function v0_9r13_12_20($db, $options)
{
$commentsWhitelist = $db->fetchRow($db->select()->from('table.options')->where('name = ?', 'commentsWhitelist'));
if (empty($commentsWhitelist)) {
$db->query($db->insert('table.options')
->rows(array('name' => 'commentsWhitelist', 'user' => 0, 'value' => 0)));
}
}
}

View File

@ -235,6 +235,31 @@ class Widget_Abstract_Metas extends Widget_Abstract
return is_array($inputTags) ? $result : current($result);
}
/**
* 清理没有任何内容的标签
*
* @access public
* @return void
*/
public function clearTags()
{
// 取出count为0的标签
$tags = Typecho_Common::arrayFlatten($this->db->fetchAll($this->db->select('mid')
->from('table.metas')->where('count = ?', 0)), 'mid');
foreach ($tags as $tag) {
// 确认是否已经没有关联了
$content = $this->db->fetchRow($this->db->select('cid')
->from('table.relationships')->where('mid = ?', $tag)
->limit(1));
if (empty($content)) {
$this->db->query($this->db->delete('table.metas')
->where('mid = ?', $tag));
}
}
}
/**
* 根据内容的指定类别和状态更新相关meta的计数信息
*

View File

@ -621,7 +621,7 @@ class Widget_Archive extends Widget_Abstract_Contents
$src = parse_url($permalink);
$target = parse_url($requestUrl);
if ($src['host'] != $target['host'] || $src['path'] != $target['path']) {
if ($src['host'] != $target['host'] || urldecode($src['path']) != urldecode($target['path'])) {
$this->response->redirect($permalink, true);
}
}
@ -779,7 +779,7 @@ class Widget_Archive extends Widget_Abstract_Contents
/** 保存密码至cookie */
if ($this->request->isPost() && isset($this->request->protectPassword)) {
Typecho_Cookie::set('protectPassword', $this->request->protectPassword, 0, $this->options->siteUrl);
Typecho_Cookie::set('protectPassword', $this->request->protectPassword, 0);
}
/** 匹配类型 */

View File

@ -388,30 +388,34 @@ class Widget_Comments_Archive extends Widget_Abstract_Comments
*/
public function listComments($singleCommentOptions = NULL)
{
if ($this->have()) {
//初始化一些变量
$parsedSingleCommentOptions = Typecho_Config::factory($singleCommentOptions);
$parsedSingleCommentOptions->setDefault(array(
'before' => '<ol class="comment-list">',
'after' => '</ol>',
'beforeAuthor' => '',
'afterAuthor' => '',
'beforeDate' => '',
'afterDate' => '',
'dateFormat' => $this->options->commentDateFormat,
'replyWord' => _t('回复'),
'commentStatus' => _t('您的评论正等待审核!'),
'avatarSize' => 32,
'defaultAvatar' => NULL
));
$this->pluginHandle()->trigger($plugged)->listComments($singleCommentOptions, $this);
if (!$plugged) {
if ($this->have()) {
//初始化一些变量
$parsedSingleCommentOptions = Typecho_Config::factory($singleCommentOptions);
$parsedSingleCommentOptions->setDefault(array(
'before' => '<ol class="comment-list">',
'after' => '</ol>',
'beforeAuthor' => '',
'afterAuthor' => '',
'beforeDate' => '',
'afterDate' => '',
'dateFormat' => $this->options->commentDateFormat,
'replyWord' => _t('回复'),
'commentStatus' => _t('您的评论正等待审核!'),
'avatarSize' => 32,
'defaultAvatar' => NULL
));
echo $parsedSingleCommentOptions->before;
echo $parsedSingleCommentOptions->before;
while ($this->next()) {
$this->threadedCommentsCallback($parsedSingleCommentOptions);
while ($this->next()) {
$this->threadedCommentsCallback($parsedSingleCommentOptions);
}
echo $parsedSingleCommentOptions->after;
}
echo $parsedSingleCommentOptions->after;
}
}

View File

@ -221,6 +221,8 @@ class Widget_Contents_Attachment_Edit extends Widget_Contents_Post_Edit implemen
/** 格式化文章主键 */
$posts = is_array($cid) ? $cid : array($cid);
foreach ($posts as $post) {
// 删除插件接口
$this->pluginHandle()->delete($post, $this);
$condition = $this->db->sql()->where('cid = ?', $post);
$row = $this->db->fetchRow($this->select()
@ -238,6 +240,9 @@ class Widget_Contents_Attachment_Edit extends Widget_Contents_Post_Edit implemen
$status = $this->status;
// 完成删除插件接口
$this->pluginHandle()->finishDelete($post, $this);
$deleteCount ++;
}
@ -258,6 +263,61 @@ class Widget_Contents_Attachment_Edit extends Widget_Contents_Post_Edit implemen
}
}
/**
* clearAttachment
*
* @access public
* @return void
*/
public function clearAttachment()
{
$page = 1;
do {
$posts = Typecho_Common::arrayFlatten($this->db->fetchAll($this->select('cid')
->from('table.contents')
->where('type = ? AND parent = ?', 'attachment', 0)
->page($page, 100)), 'cid');
$page ++;
foreach ($posts as $post) {
// 删除插件接口
$this->pluginHandle()->delete($post, $this);
$condition = $this->db->sql()->where('cid = ?', $post);
$row = $this->db->fetchRow($this->select()
->where('table.contents.type = ?', 'attachment')
->where('table.contents.cid = ?', $post)
->limit(1), array($this, 'push'));
if ($this->isWriteable($condition) && $this->delete($condition)) {
/** 删除文件 */
Widget_Upload::deleteHandle($row);
/** 删除评论 */
$this->db->query($this->db->delete('table.comments')
->where('cid = ?', $post));
$status = $this->status;
// 完成删除插件接口
$this->pluginHandle()->finishDelete($post, $this);
$deleteCount ++;
}
unset($condition);
}
} while (count($posts) == 100);
/** 设置提示信息 */
$this->widget('Widget_Notice')->set($deleteCount > 0 ? _t('未归档文件已经被清理') : _t('没有未归档文件被清理'),
$deleteCount > 0 ? 'success' : 'notice');
/** 返回原网页 */
$this->response->redirect(Typecho_Common::url('manage-medias.php', $this->options->adminUrl));
}
/**
* 绑定动作
*
@ -268,6 +328,7 @@ class Widget_Contents_Attachment_Edit extends Widget_Contents_Post_Edit implemen
{
$this->on($this->request->is('do=delete'))->deleteAttachment();
$this->on($this->request->is('do=update'))->updateAttachment();
$this->on($this->request->is('do=clear'))->clearAttachment();
$this->response->redirect($this->options->adminUrl);
}
}

View File

@ -85,6 +85,9 @@ class Widget_Contents_Page_Edit extends Widget_Contents_Post_Edit implements Wid
$contents['type'] = 'page';
$this->publish($contents);
// 完成发布插件接口
$this->pluginHandle()->finishPublish($contents, $this);
/** 发送ping */
$this->widget('Widget_Service')->sendPing($this->cid);
@ -101,6 +104,9 @@ class Widget_Contents_Page_Edit extends Widget_Contents_Post_Edit implements Wid
$contents['type'] = 'page_draft';
$this->save($contents);
// 完成发布插件接口
$this->pluginHandle()->finishSave($contents, $this);
if ($this->request->isAjax()) {
$created = new Typecho_Date($this->options->gmtTime);
$this->response->throwJson(array(
@ -133,6 +139,9 @@ class Widget_Contents_Page_Edit extends Widget_Contents_Post_Edit implements Wid
/** 格式化页面主键 */
$pages = is_array($cid) ? $cid : array($cid);
foreach ($pages as $page) {
// 删除插件接口
$this->pluginHandle()->delete($page, $this);
if ($this->delete($this->db->sql()->where('cid = ?', $page))) {
/** 删除评论 */
$this->db->query($this->db->delete('table.comments')
@ -163,6 +172,9 @@ class Widget_Contents_Page_Edit extends Widget_Contents_Post_Edit implements Wid
$this->deleteFields($draft['cid']);
}
// 完成删除插件接口
$this->pluginHandle()->finishDelete($page, $this);
$deleteCount ++;
}
}

View File

@ -716,6 +716,9 @@ class Widget_Contents_Post_Edit extends Widget_Abstract_Contents implements Widg
$contents['type'] = 'post';
$this->publish($contents);
// 完成发布插件接口
$this->pluginHandle()->finishPublish($contents, $this);
/** 发送ping */
$trackback = array_unique(preg_split("/(\r|\n|\r\n)/", trim($this->request->trackback)));
$this->widget('Widget_Service')->sendPing($this->cid, $trackback);
@ -738,6 +741,9 @@ class Widget_Contents_Post_Edit extends Widget_Abstract_Contents implements Widg
$contents['type'] = 'post_draft';
$this->save($contents);
// 完成保存插件接口
$this->pluginHandle()->finishSave($contents, $this);
if ($this->request->isAjax()) {
$created = new Typecho_Date($this->options->gmtTime);
$this->response->throwJson(array(
@ -770,6 +776,8 @@ class Widget_Contents_Post_Edit extends Widget_Abstract_Contents implements Widg
/** 格式化文章主键 */
$posts = is_array($cid) ? $cid : array($cid);
foreach ($posts as $post) {
// 删除插件接口
$this->pluginHandle()->delete($post, $this);
$condition = $this->db->sql()->where('cid = ?', $post);
$postObject = $this->db->fetchObject($this->db->select('status', 'type')
@ -809,11 +817,19 @@ class Widget_Contents_Post_Edit extends Widget_Abstract_Contents implements Widg
$this->deleteFields($draft['cid']);
}
// 完成删除插件接口
$this->pluginHandle()->finishDelete($post, $this);
$deleteCount ++;
}
unset($condition);
}
// 清理标签
if ($deleteCount > 0) {
$this->widget('Widget_Abstract_Metas')->clearTags();
}
}
/** 设置提示信息 */

View File

@ -26,7 +26,7 @@ class Widget_Init extends Typecho_Widget
$options = $this->widget('Widget_Options');
/** cookie初始化 */
Typecho_Cookie::setPrefix($options->siteUrl);
Typecho_Cookie::setPrefix($options->rootUrl);
/** 初始化charset */
Typecho_Common::$charset = $options->charset;

View File

@ -330,7 +330,10 @@ class Widget_Metas_Tag_Edit extends Widget_Abstract_Metas implements Widget_Inte
if ($tags && is_array($tags)) {
foreach ($tags as $tag) {
$this->refreshCountByTypeAndStatus($tag, 'post', 'publish');
}
}
// 自动清理标签
$this->clearTags();
$this->widget('Widget_Notice')->set(_t('标签刷新已经完成'), 'success');
} else {

View File

@ -33,8 +33,7 @@ class Widget_Notice extends Typecho_Widget
{
$this->highlight = $theId;
Typecho_Cookie::set('__typecho_notice_highlight', $theId,
$this->widget('Widget_Options')->gmtTime + $this->widget('Widget_Options')->timezone + 86400,
$this->widget('Widget_Options')->siteUrl);
$this->widget('Widget_Options')->gmtTime + $this->widget('Widget_Options')->timezone + 86400);
}
/**
@ -64,10 +63,8 @@ class Widget_Notice extends Typecho_Widget
}
Typecho_Cookie::set('__typecho_notice', json_encode($notice),
$this->widget('Widget_Options')->gmtTime + $this->widget('Widget_Options')->timezone + 86400,
$this->widget('Widget_Options')->siteUrl);
$this->widget('Widget_Options')->gmtTime + $this->widget('Widget_Options')->timezone + 86400);
Typecho_Cookie::set('__typecho_notice_type', $type,
$this->widget('Widget_Options')->gmtTime + $this->widget('Widget_Options')->timezone + 86400,
$this->widget('Widget_Options')->siteUrl);
$this->widget('Widget_Options')->gmtTime + $this->widget('Widget_Options')->timezone + 86400);
}
}

View File

@ -145,7 +145,7 @@ class Widget_Options extends Typecho_Widget
*/
protected function ___index()
{
return $this->rewrite ? $this->siteUrl : Typecho_Common::url('index.php', $this->siteUrl);
return $this->rewrite ? $this->rootUrl : Typecho_Common::url('index.php', $this->rootUrl);
}
/**
@ -179,7 +179,7 @@ class Widget_Options extends Typecho_Widget
protected function ___adminUrl()
{
return Typecho_Common::url(defined('__TYPECHO_ADMIN_DIR__') ?
__TYPECHO_ADMIN_DIR__ : '/admin/', $this->siteUrl);
__TYPECHO_ADMIN_DIR__ : '/admin/', $this->rootUrl);
}
/**
@ -202,7 +202,7 @@ class Widget_Options extends Typecho_Widget
protected function ___loginAction()
{
return Typecho_Router::url('do', array('action' => 'login', 'widget' => 'Login'),
Typecho_Common::url('index.php', $this->siteUrl));
Typecho_Common::url('index.php', $this->rootUrl));
}
/**
@ -353,9 +353,17 @@ class Widget_Options extends Typecho_Widget
$this->stack[] = &$this->row;
/** 初始化站点信息 */
$this->originalSiteUrl = $this->siteUrl;
$this->siteUrl = Typecho_Common::url(NULL, $this->siteUrl);
$this->plugins = unserialize($this->plugins);
/** 动态获取根目录 */
$this->rootUrl = $this->request->getRequestRoot();
if (defined('__TYPECHO_ADMIN__')) {
$adminDir = '/' . trim(defined('__TYPECHO_ADMIN_DIR__') ? __TYPECHO_ADMIN_DIR__ : '/admin/', '/');
$this->rootUrl = substr($this->rootUrl, 0, - strlen($adminDir));
}
/** 增加对SSL连接的支持 */
if ($this->request->isSecure() && 0 === strpos($this->siteUrl, 'http://')) {
$this->siteUrl = substr_replace($this->siteUrl, 'https', 0, 4);

View File

@ -34,8 +34,8 @@ class Widget_Options_Discussion extends Widget_Abstract_Options implements Widge
/** 评论日期格式 */
$commentDateFormat = new Typecho_Widget_Helper_Form_Element_Text('commentDateFormat', NULL, $this->options->commentDateFormat,
_t('评论日期格式'), _t('这是一个默认的格式,当你在模板中调用显示评论日期方法时, 如果没有指定日期格式, 将按照此格式输出.<br />
具体写法请参考 <a href="http://www.php.net/manual/zh/function.date.php">PHP 日期格式写法</a>.'));
_t('评论日期格式'), _t('这是一个默认的格式,当你在模板中调用显示评论日期方法时, 如果没有指定日期格式, 将按照此格式输出.') . '<br />'
. _t('具体写法请参考 <a href="http://www.php.net/manual/zh/function.date.php">PHP 日期格式写法</a>.'));
$commentDateFormat->input->setAttribute('class', 'w-40 mono');
$form->addInput($commentDateFormat);
@ -156,8 +156,8 @@ class Widget_Options_Discussion extends Widget_Abstract_Options implements Widge
/** 允许使用的HTML标签和属性 */
$commentsHTMLTagAllowed = new Typecho_Widget_Helper_Form_Element_Textarea('commentsHTMLTagAllowed', NULL,
htmlspecialchars($this->options->commentsHTMLTagAllowed),
_t('允许使用的HTML标签和属性'), _t('默认的用户评论不允许填写任何的HTML标签, 你可以在这里填写允许使用的HTML标签.<br />
比如: <code>&lt;a href=&quot;&quot;&gt; &lt;img src=&quot;&quot;&gt; &lt;blockquote&gt;</code>'));
_t('允许使用的HTML标签和属性'), _t('默认的用户评论不允许填写任何的HTML标签, 你可以在这里填写允许使用的HTML标签.') . '<br />'
. _t('比如: %s', ': <code>&lt;a href=&quot;&quot;&gt; &lt;img src=&quot;&quot;&gt; &lt;blockquote&gt;</code>'));
$commentsHTMLTagAllowed->input->setAttribute('class', 'mono');
$form->addInput($commentsHTMLTagAllowed);

View File

@ -34,10 +34,20 @@ class Widget_Options_General extends Widget_Abstract_Options implements Widget_I
/** 站点名称 */
$title = new Typecho_Widget_Helper_Form_Element_Text('title', NULL, $this->options->title, _t('站点名称'), _t('站点的名称将显示在网页的标题处.'));
$form->addInput($title);
$title->input->setAttribute('class', 'w-40');
$form->addInput($title->addRule('required', _t('请填写站点名称')));
/** 站点地址 */
$siteUrl = new Typecho_Widget_Helper_Form_Element_Text('siteUrl', NULL, $this->options->originalSiteUrl, _t('站点地址'), _t('站点地址主要用于生成内容的永久链接.')
. ($this->options->originalSiteUrl == $this->options->rootUrl ?
'' : '</p><p class="message notice mono">' . _t('当前地址 <strong>%s</strong> 与上述设定值不一致',
$this->options->rootUrl)));
$siteUrl->input->setAttribute('class', 'w-60 mono');
$form->addInput($siteUrl->addRule('required', _t('请填写站点地址'))
->addRule('url', _t('请填写一个合法的URL地址')));
/** 站点描述 */
$description = new Typecho_Widget_Helper_Form_Element_Textarea('description', NULL, $this->options->description, _t('站点描述'), _t('站点描述将显示在网页代码的头部.'));
$description = new Typecho_Widget_Helper_Form_Element_Text('description', NULL, $this->options->description, _t('站点描述'), _t('站点描述将显示在网页代码的头部.'));
$form->addInput($description);
/** 关键词 */
@ -113,7 +123,7 @@ class Widget_Options_General extends Widget_Abstract_Options implements Widget_I
);
$attachmentTypes = new Typecho_Widget_Helper_Form_Element_Checkbox('attachmentTypes', $attachmentTypesOptions,
$attachmentTypesOptionsValue, _t('允许上传的文件类型'), _t('用逗号 "," 将后缀名隔开, 例如: <code>cpp, h, mak</code>'));
$attachmentTypesOptionsValue, _t('允许上传的文件类型'), _t('用逗号 "," 将后缀名隔开, 例如: %s', '<code>cpp, h, mak</code>'));
$form->addInput($attachmentTypes->multiMode());
/** 提交按钮 */
@ -137,8 +147,9 @@ class Widget_Options_General extends Widget_Abstract_Options implements Widget_I
$this->response->goBack();
}
$settings = $this->request->from('title', 'description', 'keywords', 'allowRegister', 'timezone', 'attachmentTypes');
$settings = $this->request->from('title', 'siteUrl', 'description', 'keywords', 'allowRegister', 'timezone', 'attachmentTypes');
$settings['siteUrl'] = rtrim('/', $settings['siteUrl']);
$attachmentTypes = array();
if ($this->isEnableByCheckbox($settings['attachmentTypes'], '@image@')) {
$attachmentTypes[] = '@image@';

View File

@ -201,13 +201,13 @@ RewriteRule . {$basePath}index.php [L]
public function form()
{
/** 构建表格 */
$form = new Typecho_Widget_Helper_Form(Typecho_Common::url('index.php/action/options-permalink', $this->options->siteUrl),
$form = new Typecho_Widget_Helper_Form(Typecho_Common::url('index.php/action/options-permalink', $this->options->rootUrl),
Typecho_Widget_Helper_Form::POST_METHOD);
/** 是否使用地址重写功能 */
$rewrite = new Typecho_Widget_Helper_Form_Element_Radio('rewrite', array('0' => _t('不启用'), '1' => _t('启用')),
$this->options->rewrite, _t('是否使用地址重写功能'), _t('地址重写即 rewrite 功能是某些服务器软件提供的优化内部连接的功能.<br />
打开此功能可以让你的链接看上去完全是静态地址.'));
$this->options->rewrite, _t('是否使用地址重写功能'), _t('地址重写即 rewrite 功能是某些服务器软件提供的优化内部连接的功能.') . '<br />'
. _t('打开此功能可以让你的链接看上去完全是静态地址.'));
$errorStr = _t('重写功能检测失败, 请检查你的服务器设置');
@ -215,11 +215,11 @@ RewriteRule . {$basePath}index.php [L]
if (((isset($_SERVER['SERVER_SOFTWARE']) && false !== strpos(strtolower($_SERVER['SERVER_SOFTWARE']), 'apache'))
|| function_exists('apache_get_version')) && !file_exists(__TYPECHO_ROOT_DIR__ . '/.htaccess')
&& !is_writeable(__TYPECHO_ROOT_DIR__)) {
$errorStr .= '<br /><strong>' . _t('我们检测到你使用了apache服务器, 但是程序无法在根目录创建.htaccess文件, 这可能是产生这个错误的原因.
请调整你的目录权限, 或者手动创建一个.htaccess文件.') . '</strong>';
$errorStr .= '<br /><strong>' . _t('我们检测到你使用了apache服务器, 但是程序无法在根目录创建.htaccess文件, 这可能是产生这个错误的原因.')
. _t('请调整你的目录权限, 或者手动创建一个.htaccess文件.') . '</strong>';
}
$errorStr .= _t('<br />如果你仍然想启用此功能, <a href="%s">请点击这里</a>', Typecho_Common::url('index.php/action/options-permalink?do=enableRewriteAnyway', $this->options->siteUrl));
$errorStr .= '<br />' . _t('如果你仍然想启用此功能, <a href="%s">请点击这里</a>', Typecho_Common::url('index.php/action/options-permalink?do=enableRewriteAnyway', $this->options->siteUrl));
$form->addInput($rewrite->addRule(array($this, 'checkRewrite'), $errorStr));
$patterns = array('/archives/[cid:digital]/' => _t('默认风格') . ' <code>/archives/{cid}/</code>',
@ -241,20 +241,23 @@ RewriteRule . {$basePath}index.php [L]
$patterns['custom'] = _t('个性化定义') . ' <input type="text" class="w-50 text-s mono" name="customPattern" value="' . $customPatternValue . '" />';
$postPattern = new Typecho_Widget_Helper_Form_Element_Radio('postPattern', $patterns,
$postPatternValue, _t('自定义文章路径'), _t('可用参数: <code>{cid}</code> 日志 ID, <code>{slug}</code> 日志缩略名, <code>{category}</code> 分类, <code>{year}</code> , <code>{month}</code> , <code>{day}</code> <br />选择一种合适的文章静态路径风格, 使得你的网站链接更加友好.<br />
一旦你选择了某种链接风格请不要轻易修改它.'));
$postPatternValue, _t('自定义文章路径'), _t('可用参数: <code>{cid}</code> 日志 ID, <code>{slug}</code> 日志缩略名, <code>{category}</code> 分类, <code>{year}</code> 年, <code>{month}</code> 月, <code>{day}</code> 日')
. '<br />' . _t('选择一种合适的文章静态路径风格, 使得你的网站链接更加友好.')
. '<br />' . _t('一旦你选择了某种链接风格请不要轻易修改它.'));
if ($customPatternValue) {
$postPattern->value('custom');
}
$form->addInput($postPattern->multiMode());
/** 独立页面后缀名 */
$pagePattern = new Typecho_Widget_Helper_Form_Element_Text('pagePattern', NULL, $this->decodeRule($this->options->routingTable['page']['url']), _t('独立页面路径'), _t('可用参数: <code>{cid}</code> 页面 ID、<code>{slug}</code> 页面缩略名<br />请在路径中至少包含上述的一项参数.'));
$pagePattern = new Typecho_Widget_Helper_Form_Element_Text('pagePattern', NULL, $this->decodeRule($this->options->routingTable['page']['url']), _t('独立页面路径'), _t('可用参数: <code>{cid}</code> 页面 ID、<code>{slug}</code> 页面缩略名')
. '<br />' . _t('请在路径中至少包含上述的一项参数.'));
$pagePattern->input->setAttribute('class', 'mono w-60');
$form->addInput($pagePattern->addRule(array($this, 'checkPagePattern'), _t('独立页面路径中没有包含 {cid} 或者 {slug} ')));
/** 分类页面 */
$categoryPattern = new Typecho_Widget_Helper_Form_Element_Text('categoryPattern', NULL, $this->decodeRule($this->options->routingTable['category']['url']), _t('分类路径'), _t('可用参数: <code>{mid}</code> 分类 ID、<code>{slug}</code> 分类缩略名<br />请在路径中至少包含上述的一项参数.'));
$categoryPattern = new Typecho_Widget_Helper_Form_Element_Text('categoryPattern', NULL, $this->decodeRule($this->options->routingTable['category']['url']), _t('分类路径'), _t('可用参数: <code>{mid}</code> 分类 ID、<code>{slug}</code> 分类缩略名')
. '<br />' . _t('请在路径中至少包含上述的一项参数.'));
$categoryPattern->input->setAttribute('class', 'mono w-60');
$form->addInput($categoryPattern->addRule(array($this, 'checkCategoryPattern'), _t('分类路径中没有包含 {mid} 或者 {slug} ')));

View File

@ -34,9 +34,9 @@ class Widget_Options_Reading extends Widget_Options_Permalink
/** 文章日期格式 */
$postDateFormat = new Typecho_Widget_Helper_Form_Element_Text('postDateFormat', NULL, $this->options->postDateFormat,
_t('文章日期格式'), _t('此格式用于指定显示在文章归档中的日期默认显示格式.<br />
在某些主题中这个格式可能不会生效, 因为主题作者可以自定义日期格式.<br />
请参考 <a href="http://www.php.net/manual/zh/function.date.php">PHP 日期格式写法</a>.'));
_t('文章日期格式'), _t('此格式用于指定显示在文章归档中的日期默认显示格式.') . '<br />'
. _t('在某些主题中这个格式可能不会生效, 因为主题作者可以自定义日期格式.') . '<br />'
. _t('请参考 <a href="http://www.php.net/manual/zh/function.date.php">PHP 日期格式写法</a>.'));
$postDateFormat->input->setAttribute('class', 'w-40 mono');
$form->addInput($postDateFormat);
@ -132,8 +132,8 @@ class Widget_Options_Reading extends Widget_Options_Permalink
/** FEED全文输出 */
$feedFullText = new Typecho_Widget_Helper_Form_Element_Radio('feedFullText', array('0' => _t('仅输出摘要'), '1' => _t('全文输出')),
$this->options->feedFullText, _t('聚合全文输出'), _t('如果你不希望在聚合中输出文章全文,请使用仅输出摘要选项.<br />
摘要的文字取决于你在文章中使用分隔符的位置.'));
$this->options->feedFullText, _t('聚合全文输出'), _t('如果你不希望在聚合中输出文章全文,请使用仅输出摘要选项.') . '<br />'
. _t('摘要的文字取决于你在文章中使用分隔符的位置.'));
$form->addInput($feedFullText);
/** 提交按钮 */

View File

@ -134,8 +134,8 @@ class Widget_Service extends Widget_Abstract_Options implements Widget_Interface
$input['trackback'] = $trackback;
}
$client->setCookie('__typecho_uid', Typecho_Cookie::get('__typecho_uid'), 0, $this->options->siteUrl)
->setCookie('__typecho_authCode', Typecho_Cookie::get('__typecho_authCode'), 0, $this->options->siteUrl)
$client->setCookie('__typecho_uid', Typecho_Cookie::get('__typecho_uid'))
->setCookie('__typecho_authCode', Typecho_Cookie::get('__typecho_authCode'))
->setHeader('User-Agent', $this->options->generator)
->setTimeout(3)
->setData($input)

View File

@ -104,9 +104,6 @@ class Widget_Upgrade extends Widget_Abstract_Options implements Widget_Interface
$this->update(array('value' => 'Typecho ' . Typecho_Common::VERSION),
$this->db->sql()->where('name = ?', 'generator'));
/** 删除更新cookie */
Typecho_Cookie::delete('__typecho_check_version');
$this->widget('Widget_Notice')->set(empty($message) ? _t("升级已经完成") : $message,
empty($message) ? 'success' : 'notice');
}

View File

@ -135,9 +135,8 @@ class Widget_User extends Typecho_Widget
$authCode = sha1(Typecho_Common::randString(20));
$user['authCode'] = $authCode;
Typecho_Cookie::set('__typecho_uid', $user['uid'], $expire, $this->options->siteUrl);
Typecho_Cookie::set('__typecho_authCode', Typecho_Common::hash($authCode),
$expire, $this->options->siteUrl);
Typecho_Cookie::set('__typecho_uid', $user['uid'], $expire);
Typecho_Cookie::set('__typecho_authCode', Typecho_Common::hash($authCode), $expire);
//更新最后登录时间以及验证码
$this->db->query($this->db
@ -196,10 +195,8 @@ class Widget_User extends Typecho_Widget
return;
}
Typecho_Cookie::delete('__typecho_uid', $this->options->siteUrl);
Typecho_Cookie::delete('__typecho_authCode', $this->options->siteUrl);
Typecho_Cookie::delete('__typecho_feed');
Typecho_Cookie::delete('__typecho_check_version');
Typecho_Cookie::delete('__typecho_uid');
Typecho_Cookie::delete('__typecho_authCode');
}
/**

View File

@ -94,23 +94,23 @@ class Widget_Users_Edit extends Widget_Abstract_Users implements Widget_Interfac
Typecho_Widget_Helper_Form::POST_METHOD);
/** 用户名称 */
$name = new Typecho_Widget_Helper_Form_Element_Text('name', NULL, NULL, _t('用户名 *'), _t('此用户名将作为用户登录时所用的名称.<br />
请不要与系统中现有的用户名重复.'));
$name = new Typecho_Widget_Helper_Form_Element_Text('name', NULL, NULL, _t('用户名 *'), _t('此用户名将作为用户登录时所用的名称.')
. '<br />' . _t('请不要与系统中现有的用户名重复.'));
$form->addInput($name);
/** 电子邮箱地址 */
$mail = new Typecho_Widget_Helper_Form_Element_Text('mail', NULL, NULL, _t('电子邮箱地址 *'), _t('电子邮箱地址将作为此用户的主要联系方式.<br />
请不要与系统中现有的电子邮箱地址重复.'));
$mail = new Typecho_Widget_Helper_Form_Element_Text('mail', NULL, NULL, _t('电子邮箱地址 *'), _t('电子邮箱地址将作为此用户的主要联系方式.')
. '<br />' . _t('请不要与系统中现有的电子邮箱地址重复.'));
$form->addInput($mail);
/** 用户昵称 */
$screenName = new Typecho_Widget_Helper_Form_Element_Text('screenName', NULL, NULL, _t('用户昵称'), _t('用户昵称可以与用户名不同, 用于前台显示.<br />
如果你将此项留空, 将默认使用用户名.'));
$screenName = new Typecho_Widget_Helper_Form_Element_Text('screenName', NULL, NULL, _t('用户昵称'), _t('用户昵称可以与用户名不同, 用于前台显示.')
. '<br />' . _t('如果你将此项留空, 将默认使用用户名.'));
$form->addInput($screenName);
/** 用户密码 */
$password = new Typecho_Widget_Helper_Form_Element_Password('password', NULL, NULL, _t('用户密码'), _t('为此用户分配一个密码.<br />
建议使用特殊字符与字母的混编样式,以增加系统安全性.'));
$password = new Typecho_Widget_Helper_Form_Element_Password('password', NULL, NULL, _t('用户密码'), _t('为此用户分配一个密码.')
. '<br />' . _t('建议使用特殊字符与字母、数字的混编样式,以增加系统安全性.'));
$password->input->setAttribute('class', 'w-60');
$form->addInput($password);
@ -126,8 +126,8 @@ class Widget_Users_Edit extends Widget_Abstract_Users implements Widget_Interfac
/** 用户组 */
$group = new Typecho_Widget_Helper_Form_Element_Select('group', array('visitor' => _t('访问者'),
'subscriber' => _t('关注者'), 'contributor' => _t('贡献者'), 'editor' => _t('编辑'), 'administrator' => _t('管理员')),
NULL, _t('用户组'), _t('不同的用户组拥有不同的权限.<br />
具体的权限分配表请<a href="http://docs.typecho.org/develop/acl">参考这里</a>.'));
NULL, _t('用户组'), _t('不同的用户组拥有不同的权限.')
. '<br />' . _t('具体的权限分配表请<a href="http://docs.typecho.org/develop/acl">参考这里</a>.'));
$form->addInput($group);
/** 用户动作 */

View File

@ -45,8 +45,8 @@ class Widget_Users_Profile extends Widget_Users_Edit implements Widget_Interface
Typecho_Widget_Helper_Form::POST_METHOD);
/** 用户昵称 */
$screenName = new Typecho_Widget_Helper_Form_Element_Text('screenName', NULL, NULL, _t('昵称'), _t('用户昵称可以与用户名不同, 用于前台显示.<br />
如果你将此项留空, 将默认使用用户名.'));
$screenName = new Typecho_Widget_Helper_Form_Element_Text('screenName', NULL, NULL, _t('昵称'), _t('用户昵称可以与用户名不同, 用于前台显示.')
. '<br />' . _t('如果你将此项留空, 将默认使用用户名.'));
$form->addInput($screenName);
/** 个人主页地址 */
@ -54,8 +54,8 @@ class Widget_Users_Profile extends Widget_Users_Edit implements Widget_Interface
$form->addInput($url);
/** 电子邮箱地址 */
$mail = new Typecho_Widget_Helper_Form_Element_Text('mail', NULL, NULL, _t('电子邮箱地址 *'), _t('电子邮箱地址将作为此用户的主要联系方式.<br />
请不要与系统中现有的电子邮箱地址重复.'));
$mail = new Typecho_Widget_Helper_Form_Element_Text('mail', NULL, NULL, _t('电子邮箱地址 *'), _t('电子邮箱地址将作为此用户的主要联系方式.')
. '<br />' . _t('请不要与系统中现有的电子邮箱地址重复.'));
$form->addInput($mail);
/** 用户动作 */
@ -97,8 +97,8 @@ class Widget_Users_Profile extends Widget_Users_Edit implements Widget_Interface
$markdown = new Typecho_Widget_Helper_Form_Element_Radio('markdown',
array('0' => _t('关闭'), '1' => _t('打开')),
$this->options->markdown, _t('使用 Markdown 语法编辑和解析内容'),
_t('使用 <a href="http://daringfireball.net/projects/markdown/">Markdown</a> 语法能够使您的撰写过程更加简便直观.<br />
此功能开启不会影响以前没有使用 Markdown 语法编辑的内容.'));
_t('使用 <a href="http://daringfireball.net/projects/markdown/">Markdown</a> 语法能够使您的撰写过程更加简便直观.')
. '<br />' . _t('此功能开启不会影响以前没有使用 Markdown 语法编辑的内容.'));
$form->addInput($markdown);
/** 自动保存 */
@ -210,8 +210,8 @@ class Widget_Users_Profile extends Widget_Users_Edit implements Widget_Interface
Typecho_Widget_Helper_Form::POST_METHOD);
/** 用户密码 */
$password = new Typecho_Widget_Helper_Form_Element_Password('password', NULL, NULL, _t('用户密码'), _t('为此用户分配一个密码.<br />
建议使用特殊字符与字母的混编样式,以增加系统安全性.'));
$password = new Typecho_Widget_Helper_Form_Element_Password('password', NULL, NULL, _t('用户密码'), _t('为此用户分配一个密码.')
. '<br />' . _t('建议使用特殊字符与字母、数字的混编样式,以增加系统安全性.'));
$password->input->setAttribute('class', 'w-60');
$form->addInput($password);