移动js目录,增加markdown库
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php if(!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<script src="<?php $options->adminUrl('javascript/jquery.js?v=' . $suffixVersion); ?>"></script>
|
||||
<script src="<?php $options->adminUrl('javascript/jquery-ui.js?v=' . $suffixVersion); ?>"></script>
|
||||
<script src="<?php $options->adminUrl('javascript/typecho.js?v=' . $suffixVersion); ?>"></script>
|
||||
<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>
|
||||
<script>
|
||||
(function () {
|
||||
$(document).ready(function() {
|
||||
|
||||
@@ -7,7 +7,7 @@ if (isset($post) && $post instanceof Typecho_Widget && $post->have()) {
|
||||
}
|
||||
?>
|
||||
|
||||
<script src="<?php $options->adminUrl('javascript/filedrop.js?v=' . $suffixVersion); ?>"></script>
|
||||
<script src="<?php $options->adminUrl('js/filedrop.js?v=' . $suffixVersion); ?>"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var errorWord = '<?php $val = function_exists('ini_get') ? trim(ini_get('upload_max_filesize')) : 0;
|
||||
|
||||
@@ -6,7 +6,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) {
|
||||
$header = '<link rel="stylesheet" href="' . Typecho_Common::url('css/normalize.css?v=' . $suffixVersion, $options->adminUrl) . '">
|
||||
<link rel="stylesheet" href="' . Typecho_Common::url('css/grid.css?v=' . $suffixVersion, $options->adminUrl) . '">
|
||||
<link rel="stylesheet" href="' . Typecho_Common::url('css/style.css?v=' . $suffixVersion, $options->adminUrl) . '">
|
||||
<script src="' . Typecho_Common::url('javascript/modernizr.min.js?v=' . $suffixVersion, $options->adminUrl) . '"></script>';
|
||||
<script src="' . Typecho_Common::url('js/modernizr.min.js?v=' . $suffixVersion, $options->adminUrl) . '"></script>';
|
||||
|
||||
/** 注册一个初始化插件 */
|
||||
$header = Typecho_Plugin::factory('admin/header.php')->header($header);
|
||||
|
||||
5228
admin/js/markdown.js
Normal file
5228
admin/js/markdown.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -42,7 +42,7 @@ Typecho_Widget::widget('Widget_Contents_Attachment_Edit')->to($attachment);
|
||||
include 'copyright.php';
|
||||
include 'common-js.php';
|
||||
?>
|
||||
<script src="<?php $options->adminUrl('javascript/filedrop.js?v=' . $suffixVersion); ?>"></script>
|
||||
<script src="<?php $options->adminUrl('js/filedrop.js?v=' . $suffixVersion); ?>"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
var errorWord = '<?php $val = function_exists('ini_get') ? trim(ini_get('upload_max_filesize')) : 0;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<?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); ?>
|
||||
|
||||
<script src="<?php $options->adminUrl('javascript/timepicker.js?v=' . $suffixVersion); ?>"></script>
|
||||
<script src="<?php $options->adminUrl('javascript/tokeninput.js?v=' . $suffixVersion); ?>"></script>
|
||||
<script src="<?php $options->adminUrl('js/timepicker.js?v=' . $suffixVersion); ?>"></script>
|
||||
<script src="<?php $options->adminUrl('js/tokeninput.js?v=' . $suffixVersion); ?>"></script>
|
||||
<script src="<?php $options->adminUrl('js/markdown.js?v=' . $suffixVersion); ?>"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// 日期时间控件
|
||||
|
||||
@@ -95,10 +95,12 @@ Typecho_Widget::widget('Widget_Contents_Post_Edit')->to($post);
|
||||
<section class="typecho-post-option visibility-option">
|
||||
<label class="typecho-label"><?php _e('公开度'); ?></label>
|
||||
<ul>
|
||||
<?php if ($user->pass('editor', true)): ?>
|
||||
<li><input id="publish" value="publish" name="visibility" type="radio"<?php if (($post->status == 'publish' && !$post->password) || !$post->status) { ?> checked="true"<?php } ?> /> <label for="publish"><?php _e('公开'); ?></label></li>
|
||||
<li><input id="password" value="password" name="visibility" type="radio"<?php if ($post->password) { ?> checked="true"<?php } ?> /> <label for="password">密码保护 <input type="text" id="post-password" name="post-password" class="text-s" value="<?php $post->password(); ?>" size="16" /></label></li>
|
||||
<li><input id="private" value="private" name="visibility" type="radio"<?php if ($post->status == 'private') { ?> checked="true"<?php } ?> /> <label for="private">私密</label></li>
|
||||
<li><input id="waiting" value="waiting" name="visibility" type="radio"<?php if ($post->status == 'waiting') { ?> checked="true"<?php } ?> /> <label for="waiting">待审核</label></li>
|
||||
<?php endif; ?>
|
||||
<li><input id="waiting" value="waiting" name="visibility" type="radio"<?php if (!$user->pass('editor', true) || $post->status == 'waiting') { ?> checked="true"<?php } ?> /> <label for="waiting">待审核</label></li>
|
||||
</ul>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -287,6 +287,7 @@ list($prefixVersion, $suffixVersion) = explode('/', $currentVersion);
|
||||
$installDb->query($installDb->insert('table.options')->rows(array('name' => 'feedFullText', 'user' => 0, 'value' => 1)));
|
||||
$installDb->query($installDb->insert('table.options')->rows(array('name' => 'editorSize', 'user' => 0, 'value' => 350)));
|
||||
$installDb->query($installDb->insert('table.options')->rows(array('name' => 'autoSave', 'user' => 0, 'value' => 0)));
|
||||
$installDb->query($installDb->insert('table.options')->rows(array('name' => 'markdown', 'user' => 0, 'value' => 1)));
|
||||
$installDb->query($installDb->insert('table.options')->rows(array('name' => 'commentsMaxNestingLevels', 'user' => 0, 'value' => 5)));
|
||||
$installDb->query($installDb->insert('table.options')->rows(array('name' => 'commentsPostTimeout', 'user' => 0, 'value' => 24 * 3600 * 30)));
|
||||
$installDb->query($installDb->insert('table.options')->rows(array('name' => 'commentsUrlNofollow', 'user' => 0, 'value' => 1)));
|
||||
|
||||
1618
var/Markdown.php
Normal file
1618
var/Markdown.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -955,4 +955,37 @@ Typecho_Date::setTimezoneOffset($options->timezone);
|
||||
{
|
||||
Typecho_Widget::widget('Widget_Themes_Edit', NULL, 'change=' . $options->theme, false)->action();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 升级至13.10.18
|
||||
*
|
||||
* @param mixed $db
|
||||
* @param mixed $options
|
||||
* @static
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public static function v0_9r13_10_18($db, $options)
|
||||
{
|
||||
// 增加markdown
|
||||
$db->query($db->insert('table.options')
|
||||
->rows(array('name' => 'markdown', 'user' => 0, 'value' => 0)));
|
||||
|
||||
// 更新原来被搞乱的草稿
|
||||
$db->query($db->update('table.contents')
|
||||
->rows(array(
|
||||
'type' => 'post_draft',
|
||||
'status' => 'publish'
|
||||
))
|
||||
->where('type = ? AND status = ?', 'post', 'draft'));
|
||||
|
||||
$db->query($db->update('table.contents')
|
||||
->rows(array(
|
||||
'type' => 'page_draft',
|
||||
'status' => 'publish'
|
||||
))
|
||||
->where('type = ? AND status = ?', 'page', 'draft'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,12 @@ class Widget_Abstract_Contents extends Widget_Abstract
|
||||
|
||||
$excerpt = $this->pluginHandle(__CLASS__)->trigger($plugged)->excerpt($excerpt, $this);
|
||||
if (!$plugged) {
|
||||
$excerpt = Typecho_Common::cutParagraph($excerpt);
|
||||
if ($this->isMarkdown) {
|
||||
$markdown = new Markdown();
|
||||
$excerpt = $markdown->transform($excerpt);
|
||||
} else {
|
||||
$excerpt = Typecho_Common::cutParagraph($excerpt);
|
||||
}
|
||||
}
|
||||
|
||||
return Typecho_Common::fixHtml($this->pluginHandle(__CLASS__)->excerptEx($excerpt, $this));
|
||||
@@ -105,7 +110,12 @@ class Widget_Abstract_Contents extends Widget_Abstract
|
||||
$content = $this->pluginHandle(__CLASS__)->trigger($plugged)->content($this->text, $this);
|
||||
|
||||
if (!$plugged) {
|
||||
$content = Typecho_Common::cutParagraph($content);
|
||||
if ($this->isMarkdown) {
|
||||
$markdown = new Markdown();
|
||||
$content = $markdown->transform($content);
|
||||
} else {
|
||||
$content = Typecho_Common::cutParagraph($content);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->pluginHandle(__CLASS__)->contentEx($content, $this);
|
||||
@@ -478,6 +488,12 @@ class Widget_Abstract_Contents extends Widget_Abstract
|
||||
}
|
||||
}
|
||||
|
||||
/** 处理Markdown **/
|
||||
$value['isMarkdown'] = (0 === strpos('<!--markdown-->', $value['text']));
|
||||
if ($value['isMarkdown']) {
|
||||
$value['text'] = substr($value['text'], 15);
|
||||
}
|
||||
|
||||
/** 生成聚合链接 */
|
||||
/** RSS 2.0 */
|
||||
$value['feedUrl'] = $routeExists ? Typecho_Router::url($type, $value, $this->options->feedUrl) : '#';
|
||||
|
||||
@@ -92,13 +92,13 @@ class Widget_Users_Profile extends Widget_Users_Edit implements Widget_Interface
|
||||
$form = new Typecho_Widget_Helper_Form(Typecho_Common::url('/action/users-profile', $this->options->index),
|
||||
Typecho_Widget_Helper_Form::POST_METHOD);
|
||||
|
||||
/** 编辑器 */
|
||||
/*
|
||||
$useRichEditor = new Typecho_Widget_Helper_Form_Element_Radio('useRichEditor',
|
||||
array('0' => _t('文本编辑器'), '1' => _t('所见即所得编辑器')),
|
||||
$this->options->useRichEditor, _t('编辑器选择'), _t('根据你的个人偏好选择合适的编辑器.'));
|
||||
$form->addInput($useRichEditor);
|
||||
*/
|
||||
/** 自动保存 */
|
||||
$markdown = new Typecho_Widget_Helper_Form_Element_Radio('markdown',
|
||||
array('0' => _t('关闭'), '1' => _t('打开')),
|
||||
$this->options->markdown, _t('使用Markdown语法编辑和解析内容'),
|
||||
_t('使用Markdown语法能够使您的撰写过程更加简便直观.<br />
|
||||
此功能开启不会影响以前没有使用Markdown语法编辑的内容.'));
|
||||
$form->addInput($markdown);
|
||||
|
||||
/** 自动保存 */
|
||||
$autoSave = new Typecho_Widget_Helper_Form_Element_Radio('autoSave',
|
||||
|
||||
Reference in New Issue
Block a user