Skip to content

Commit

Permalink
clean some unused widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
joyqi committed Apr 23, 2014
1 parent 8c3d36d commit 5e32925
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 91 deletions.
6 changes: 3 additions & 3 deletions admin/common-js.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?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>
<script src="<?php $options->adminStaticUrl('js', 'jquery.js?v=' . $suffixVersion); ?>"></script>
<script src="<?php $options->adminStaticUrl('js', 'jquery-ui.js?v=' . $suffixVersion); ?>"></script>
<script src="<?php $options->adminStaticUrl('js', 'typecho.js?v=' . $suffixVersion); ?>"></script>
<script>
(function () {
$(document).ready(function() {
Expand Down
6 changes: 3 additions & 3 deletions admin/editor-js.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?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>
<script src="<?php $options->adminStaticUrl('js', 'pagedown.js?v=' . $suffixVersion); ?>"></script>
<script src="<?php $options->adminStaticUrl('js', 'pagedown-extra.js?v=' . $suffixVersion); ?>"></script>
<script src="<?php $options->adminStaticUrl('js', 'diff.js?v=' . $suffixVersion); ?>"></script>
<script>
$(document).ready(function () {
var textarea = $('#text'),
Expand Down
6 changes: 3 additions & 3 deletions admin/file-upload-js.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
}
?>

<script src="<?php $options->adminUrl('js/moxie.js?v=' . $suffixVersion); ?>"></script>
<script src="<?php $options->adminUrl('js/plupload.js?v=' . $suffixVersion); ?>"></script>
<script src="<?php $options->adminStaticUrl('js', 'moxie.js?v=' . $suffixVersion); ?>"></script>
<script src="<?php $options->adminStaticUrl('js', 'plupload.js?v=' . $suffixVersion); ?>"></script>
<script>
$(document).ready(function() {
function updateAttacmentNumber () {
Expand Down Expand Up @@ -123,7 +123,7 @@ function fileUploadComplete (id, url, data) {
url : '<?php $security->index('/action/upload'
. (isset($fileParentContent) ? '?cid=' . $fileParentContent->cid : '')); ?>',
runtimes : 'html5,flash,html4',
flash_swf_url : '<?php $options->adminUrl('js/Moxie.swf'); ?>',
flash_swf_url : '<?php $options->adminStaticUrl('js', 'Moxie.swf'); ?>',
drop_element : $('.upload-area').get(0),
filters : {
max_file_size : '<?php echo $phpMaxFilesize ?>',
Expand Down
10 changes: 5 additions & 5 deletions admin/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
exit;
}

$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) . '">
$header = '<link rel="stylesheet" href="' . Typecho_Common::url('normalize.css?v=' . $suffixVersion, $options->adminStaticUrl('css')) . '">
<link rel="stylesheet" href="' . Typecho_Common::url('grid.css?v=' . $suffixVersion, $options->adminStaticUrl('css')) . '">
<link rel="stylesheet" href="' . Typecho_Common::url('style.css?v=' . $suffixVersion, $options->adminStaticUrl('css')) . '">
<!--[if lt IE 9]>
<script src="' . Typecho_Common::url('js/html5shiv.js?v=' . $suffixVersion, $options->adminUrl) . '"></script>
<script src="' . Typecho_Common::url('js/respond.js?v=' . $suffixVersion, $options->adminUrl) . '"></script>
<script src="' . Typecho_Common::url('html5shiv.js?v=' . $suffixVersion, $options->adminStaticUrl('js')) . '"></script>
<script src="' . Typecho_Common::url('respond.js?v=' . $suffixVersion, $options->adminStaticUrl('js')) . '"></script>
<![endif]-->';

/** 注册一个初始化插件 */
Expand Down
6 changes: 3 additions & 3 deletions admin/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
include 'copyright.php';
include 'common-js.php';
?>
<script src="<?php $options->adminUrl('js/moxie.js?v=' . $suffixVersion); ?>"></script>
<script src="<?php $options->adminUrl('js/plupload.js?v=' . $suffixVersion); ?>"></script>
<script src="<?php $options->adminStaticUrl('js', 'moxie.js?v=' . $suffixVersion); ?>"></script>
<script src="<?php $options->adminStaticUrl('js', 'plupload.js?v=' . $suffixVersion); ?>"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#attachment-url').click(function () {
Expand Down Expand Up @@ -146,7 +146,7 @@ function fileUploadComplete (id, url, data) {
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->adminUrl('js/Moxie.swf'); ?>',
flash_swf_url : '<?php $options->adminStaticUrl('js', 'Moxie.swf'); ?>',
drop_element : $('.upload-area').get(0),
filters : {
max_file_size : '<?php echo $phpMaxFilesize ?>',
Expand Down
4 changes: 2 additions & 2 deletions admin/plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<?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')->to($activatedPlugins); ?>
<?php Typecho_Widget::widget('Widget_Plugins_List@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">
Expand Down Expand Up @@ -70,7 +70,7 @@
</div>
<?php endif; ?>

<?php Typecho_Widget::widget('Widget_Plugins_List_Deactivated')->to($deactivatedPlugins); ?>
<?php Typecho_Widget::widget('Widget_Plugins_List@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">
Expand Down
4 changes: 2 additions & 2 deletions admin/write-js.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<?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('js/timepicker.js?v=' . $suffixVersion); ?>"></script>
<script src="<?php $options->adminUrl('js/tokeninput.js?v=' . $suffixVersion); ?>"></script>
<script src="<?php $options->adminStaticUrl('js', 'timepicker.js?v=' . $suffixVersion); ?>"></script>
<script src="<?php $options->adminStaticUrl('js', 'tokeninput.js?v=' . $suffixVersion); ?>"></script>
<script>
$(document).ready(function() {
// 日期时间控件
Expand Down
2 changes: 1 addition & 1 deletion var/Widget/Contents/Post/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ public function getMenuTitle()
public function getDefaultFieldItems()
{
$defaultFields = array();
$configFile = __TYPECHO_ROOT_DIR__ . __TYPECHO_THEME_DIR__ . '/' . $this->options->theme . '/functions.php';
$configFile = $this->options->themeFile($this->options->theme, 'functions.php');
$layout = new Typecho_Widget_Helper_Layout();
$fields = new Typecho_Config();

Expand Down
18 changes: 18 additions & 0 deletions var/Widget/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,24 @@ public function adminUrl($path = NULL)
echo Typecho_Common::url($path, $this->adminUrl);
}

/**
* 获取或输出后台静态文件路径
*
* @param string $type
* @param string $file
* @return void|string
*/
public function adminStaticUrl($type, $file = NULL)
{
$url = Typecho_Common::url($type, $this->adminUrl);

if (empty($file)) {
return $url;
}

echo Typecho_Common::url($file, $url);
}

/**
* 编码输出允许出现在评论中的html标签
*
Expand Down
33 changes: 0 additions & 33 deletions var/Widget/Plugins/List/Activated.php

This file was deleted.

33 changes: 0 additions & 33 deletions var/Widget/Plugins/List/Deactivated.php

This file was deleted.

2 changes: 1 addition & 1 deletion var/Widget/Themes/List.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function execute()
$info['screen'] = Typecho_Common::url(trim(__TYPECHO_THEME_DIR__, '/') .
'/' . $info['name'] . '/' . basename(current($screen)), $siteUrl);
} else {
$info['screen'] = Typecho_Common::url('/img/noscreen.png', $adminUrl);
$info['screen'] = Typecho_Common::url('noscreen.png', $options->adminStaticUrl('img'));
}

$result[$key] = $info;
Expand Down
4 changes: 2 additions & 2 deletions var/Widget/Users/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,12 @@ public function personalForm($pluginName, $className, $pluginFileName, &$group)
*/
public function personalFormList()
{
$this->widget('Widget_Plugins_List_Activated')->to($plugins);
$this->widget('Widget_Plugins_List@personalPlugins', 'activated=1')->to($plugins);
while ($plugins->next()) {
if ($plugins->personalConfig) {
echo '<h3>' . $plugins->title . '</h3>';
list($pluginFileName, $className) = Typecho_Plugin::portal($plugins->name,
__TYPECHO_ROOT_DIR__ . '/' . __TYPECHO_PLUGIN_DIR__);
$this->options->pluginDir($plugins->name));

$form = $this->personalForm($plugins->name, $className, $pluginFileName, $group);
if ($this->user->pass($group, true)) {
Expand Down

0 comments on commit 5e32925

Please sign in to comment.