There's a lockup in the tri-menu area. Traffic ahead. Eliminating generic file editor.
git-svn-id: https://develop.svn.wordpress.org/trunk@6549 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
94a6353473
commit
92a412f1f2
@ -1,11 +1,45 @@
|
||||
<ul id="adminmenu">
|
||||
<?php
|
||||
$self = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
|
||||
$self = preg_replace('|^.*/plugins/|i', '', $self);
|
||||
|
||||
get_admin_page_parent();
|
||||
|
||||
foreach ($menu as $item) {
|
||||
// We're going to do this loop three times
|
||||
?>
|
||||
|
||||
<ul id="dashmenu">
|
||||
<?php
|
||||
foreach ( $menu as $key => $item ) {
|
||||
if ( 3 < $key ) // get each menu item before 3
|
||||
continue;
|
||||
$class = '';
|
||||
// 0 = name, 1 = capability, 2 = file
|
||||
if (( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) $class = ' class="current"';
|
||||
|
||||
if ( !empty($submenu[$item[2]]) ) {
|
||||
$submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index.
|
||||
$menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
|
||||
if ( file_exists(ABSPATH . PLUGINDIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
|
||||
echo "\n\t<li><a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
|
||||
else
|
||||
echo "\n\t<li><a href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
|
||||
} else if ( current_user_can($item[1]) ) {
|
||||
if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") )
|
||||
echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
|
||||
else
|
||||
echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>";
|
||||
}
|
||||
}
|
||||
do_action( 'dashmenu' );
|
||||
?>
|
||||
</ul>
|
||||
|
||||
<ul id="adminmenu">
|
||||
<?php
|
||||
foreach ( $menu as $key => $item ) {
|
||||
if ( 5 > $key || $key > 25 ) // get each menu item before 3
|
||||
continue;
|
||||
|
||||
$class = '';
|
||||
|
||||
// 0 = name, 1 = capability, 2 = file
|
||||
@ -25,10 +59,40 @@ foreach ($menu as $item) {
|
||||
echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>";
|
||||
}
|
||||
}
|
||||
|
||||
do_action( 'adminmenu' );
|
||||
?>
|
||||
</ul>
|
||||
|
||||
<ul id="sidemenu">
|
||||
<?php
|
||||
foreach ( $menu as $key => $item ) {
|
||||
if ( 26 > $key ) // get each menu item before 3
|
||||
continue;
|
||||
|
||||
$class = '';
|
||||
|
||||
// 0 = name, 1 = capability, 2 = file
|
||||
if (( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) $class = ' class="current"';
|
||||
|
||||
if ( !empty($submenu[$item[2]]) ) {
|
||||
$submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index.
|
||||
$menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
|
||||
if ( file_exists(ABSPATH . PLUGINDIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
|
||||
echo "\n\t<li><a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a> |</li>";
|
||||
else
|
||||
echo "\n\t<li><a href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a> |</li>";
|
||||
} else if ( current_user_can($item[1]) ) {
|
||||
if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") )
|
||||
echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a> |</li>";
|
||||
else
|
||||
echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a> |</li>";
|
||||
}
|
||||
}
|
||||
do_action( 'sidemenu' );
|
||||
?>
|
||||
</ul>
|
||||
|
||||
|
||||
<?php
|
||||
// Sub-menu
|
||||
if ( isset($submenu["$parent_file"]) ) :
|
||||
|
@ -19,7 +19,6 @@ $awaiting_mod = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comme
|
||||
if ( 100 < $awaiting_mod )
|
||||
$awaiting_mod = '99+'; // to not blow out layout
|
||||
$menu[15] = array( sprintf( __('Comments %s'), "<span id='awaiting-mod' class='comment-count'>$awaiting_mod</span>" ), 'edit_posts', 'edit-comments.php');
|
||||
$menu[20] = array(__('Blogroll'), 'manage_links', 'link-manager.php');
|
||||
$menu[25] = array(__('Design'), 'switch_themes', 'themes.php');
|
||||
$menu[30] = array(__('Plugins'), 'activate_plugins', 'plugins.php');
|
||||
if ( current_user_can('edit_users') )
|
||||
@ -30,8 +29,8 @@ $menu[40] = array(__('Settings'), 'manage_options', 'options-general.php');
|
||||
|
||||
|
||||
$_wp_real_parent_file['post.php'] = 'post-new.php'; // Back-compat
|
||||
$submenu['post-new.php'][5] = array(__('Write Post'), 'edit_posts', 'post-new.php');
|
||||
$submenu['post-new.php'][10] = array(__('Write Page'), 'edit_pages', 'page-new.php');
|
||||
$submenu['post-new.php'][5] = array(__('Post'), 'edit_posts', 'post-new.php');
|
||||
$submenu['post-new.php'][10] = array(__('Page'), 'edit_pages', 'page-new.php');
|
||||
|
||||
$submenu['edit-comments.php'][5] = array(__('Comments'), 'edit_posts', 'edit-comments.php');
|
||||
$awaiting_mod = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'");
|
||||
@ -40,16 +39,16 @@ $submenu['edit-comments.php'][25] = array(sprintf(__("Awaiting Moderation (%s)")
|
||||
|
||||
$submenu['edit.php'][5] = array(__('Posts'), 'edit_posts', 'edit.php');
|
||||
$submenu['edit.php'][10] = array(__('Pages'), 'edit_pages', 'edit-pages.php');
|
||||
$submenu['edit.php'][12] = array(__('Uploads'), 'upload_files', 'upload.php');
|
||||
$submenu['edit.php'][15] = array(__('Categories'), 'manage_categories', 'categories.php');
|
||||
$submenu['edit.php'][30] = array(__('Files'), 'edit_files', 'templates.php');
|
||||
$submenu['edit.php'][35] = array(__('Import'), 'import', 'import.php');
|
||||
$submenu['edit.php'][40] = array(__('Export'), 'import', 'export.php');
|
||||
$submenu['edit.php'][15] = array(__('Links'), 'manage_links', 'link-manager.php');
|
||||
$submenu['edit.php'][20] = array(__('Categories'), 'manage_categories', 'categories.php');
|
||||
$submenu['edit.php'][25] = array(__('Media Library'), 'upload_files', 'upload.php');
|
||||
$submenu['edit.php'][30] = array(__('Import'), 'import', 'import.php');
|
||||
$submenu['edit.php'][35] = array(__('Export'), 'import', 'export.php');
|
||||
|
||||
$submenu['link-manager.php'][5] = array(__('Manage Blogroll'), 'manage_links', 'link-manager.php');
|
||||
$submenu['link-manager.php'][10] = array(__('Add Link'), 'manage_links', 'link-add.php');
|
||||
$submenu['link-manager.php'][20] = array(__('Import Links'), 'manage_links', 'link-import.php');
|
||||
$submenu['link-manager.php'][30] = array(__('Categories'), 'manage_links', 'edit-link-categories.php');
|
||||
|
||||
$submenu['edit.php'][50] = array(__('Add Link'), 'manage_links', 'link-add.php'); // todo: axe
|
||||
$submenu['edit.php'][55] = array(__('Import Links'), 'manage_links', 'link-import.php'); // todo: axe
|
||||
$submenu['edit.php'][60] = array(__('Categories'), 'manage_links', 'edit-link-categories.php'); // todo: axe
|
||||
|
||||
if ( current_user_can('edit_users') ) {
|
||||
$_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php.
|
||||
|
@ -1,160 +0,0 @@
|
||||
<?php
|
||||
require_once('admin.php');
|
||||
$title = __('Template & File Editing');
|
||||
$parent_file = 'edit.php';
|
||||
|
||||
wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file'));
|
||||
|
||||
$recents = get_option('recently_edited');
|
||||
|
||||
if (empty($file)) {
|
||||
if ($recents) {
|
||||
$file = $recents[0];
|
||||
} else {
|
||||
$file = 'index.php';
|
||||
}
|
||||
}
|
||||
|
||||
$file = validate_file_to_edit($file);
|
||||
$real_file = get_real_file_to_edit($file);
|
||||
|
||||
switch($action) {
|
||||
|
||||
case 'update':
|
||||
|
||||
check_admin_referer('edit-file_' . $file);
|
||||
|
||||
if ( ! current_user_can('edit_files') )
|
||||
wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
|
||||
|
||||
$newcontent = stripslashes($_POST['newcontent']);
|
||||
if (is_writeable($real_file)) {
|
||||
$f = @ fopen($real_file, 'w+');
|
||||
if ( $f ) {
|
||||
fwrite($f, $newcontent);
|
||||
fclose($f);
|
||||
wp_redirect("templates.php?file=$file&a=te");
|
||||
} else {
|
||||
wp_redirect("templates.php?file=$file&a=err");
|
||||
}
|
||||
} else {
|
||||
wp_redirect("templates.php?file=$file&a=err");
|
||||
}
|
||||
|
||||
exit();
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
require_once('./admin-header.php');
|
||||
|
||||
if ( ! current_user_can('edit_files') )
|
||||
wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
|
||||
|
||||
if (strpos($file, 'wp-config.php') !== false)
|
||||
wp_die('<p>'.__('The config file cannot be edited or viewed through the web interface. Sorry!').'</p>');
|
||||
|
||||
update_recently_edited($file);
|
||||
|
||||
if (!is_file($real_file))
|
||||
$error = true;
|
||||
|
||||
if (!$error) {
|
||||
$f = @ fopen($real_file, 'r');
|
||||
if ( $f ) {
|
||||
if ( filesize($real_file ) > 0 ) {
|
||||
$content = fread($f, filesize($real_file));
|
||||
$content = htmlspecialchars($content);
|
||||
} else {
|
||||
$content = '';
|
||||
}
|
||||
} else {
|
||||
$error = true;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<?php if (isset($_GET['a'])) : ?>
|
||||
<?php if ( 'err' == $_GET['a'] ) : ?>
|
||||
<div id="message" class="error"><p><?php _e('Could not save file.') ?></p></div>
|
||||
<?php else: ?>
|
||||
<div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<div class="wrap">
|
||||
<?php
|
||||
if (is_writeable($real_file)) {
|
||||
echo '<h2>' . sprintf(__('Editing <strong>%s</strong>'), wp_specialchars($file) ) . '</h2>';
|
||||
} else {
|
||||
echo '<h2>' . sprintf(__('Browsing <strong>%s</strong>'), wp_specialchars($file) ) . '</h2>';
|
||||
}
|
||||
?>
|
||||
<div id="templateside">
|
||||
<?php
|
||||
if ( $recents ) :
|
||||
?>
|
||||
<h3><?php _e('Recent'); ?></h3>
|
||||
<?php
|
||||
echo '<ol>';
|
||||
foreach ($recents as $recent) :
|
||||
echo "<li><a href='templates.php?file=" . attribute_escape($recent) . "'>" . wp_specialchars(get_file_description(basename($recent))) . "</a></li>";
|
||||
endforeach;
|
||||
echo '</ol>';
|
||||
endif;
|
||||
?>
|
||||
<h3><?php _e('Common'); ?></h3>
|
||||
<?php $common_files = array('index.php', '.htaccess', 'my-hacks.php');
|
||||
$old_files = array('wp-layout.css', 'wp-comments.php', 'wp-comments-popup.php');
|
||||
foreach ($old_files as $old_file) {
|
||||
if (file_exists(ABSPATH . $old_file))
|
||||
$common_files[] = $old_file;
|
||||
} ?>
|
||||
<ul>
|
||||
<?php foreach ($common_files as $common_file) : ?>
|
||||
<li><a href="templates.php?file=<?php echo $common_file?>"><?php echo get_file_description($common_file); ?></a></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php if (!$error) { ?>
|
||||
<form name="template" id="template" action="templates.php" method="post">
|
||||
<?php wp_nonce_field('edit-file_' . $file) ?>
|
||||
<div><textarea cols="70" rows="25" name="newcontent" id='newcontent' tabindex="1"><?php echo $content ?></textarea>
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="file" value="<?php echo $file ?>" />
|
||||
</div>
|
||||
<?php if ( is_writeable($real_file) ) : ?>
|
||||
<p class="submit">
|
||||
<?php
|
||||
echo "<input type='submit' name='submit' value=' " . __('Update File »') . "' tabindex='2' />";
|
||||
?>
|
||||
</p>
|
||||
<?php else : ?>
|
||||
<p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
<?php
|
||||
} else {
|
||||
echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
|
||||
}
|
||||
?>
|
||||
<div class="clear"> </div>
|
||||
</div>
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Other Files') ?></h2>
|
||||
|
||||
<p><?php _e('To edit a file, type its name here. You can edit any file <a href="http://codex.wordpress.org/Changing_File_Permissions" title="Read more about making files writable">writable by the server</a>, e.g. CHMOD 666.') ?></p>
|
||||
<form name="file" action="templates.php" method="get">
|
||||
<input type="text" name="file" />
|
||||
<input type="submit" name="submit" value="<?php _e('Edit file »') ?>" />
|
||||
</form>
|
||||
|
||||
<p><?php _e('Note: of course, you can also edit the files/templates in your text editor of choice and upload them. This online editor is only meant to be used when you don’t have access to a text editor or FTP client.') ?></p>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
include("admin-footer.php");
|
||||
?>
|
@ -899,6 +899,31 @@ a.view-comment-post-link {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* menu stuff */
|
||||
|
||||
#dashmenu {
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
position: absolute;
|
||||
top: 7px;
|
||||
left: 0;
|
||||
padding-left: 12px;
|
||||
}
|
||||
|
||||
#dashmenu a {
|
||||
color: #999;
|
||||
padding: 6px;
|
||||
line-height: 220%;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
#dashmenu a:hover, #dashmenu a.current, #dashmenu a.current:hover {
|
||||
background: #e4f2fd;
|
||||
-moz-border-radius-topleft: 3px;
|
||||
-moz-border-radius-topright: 3px;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
#adminmenu {
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
@ -910,7 +935,7 @@ a.view-comment-post-link {
|
||||
#adminmenu a {
|
||||
font-size: 16px;
|
||||
color: #2583ad;
|
||||
padding: 6px 6px;
|
||||
padding: 6px;
|
||||
line-height: 200%;
|
||||
border: 1px solid #e4f2fd;
|
||||
border-bottom: 1px solid #c6d9e9;
|
||||
@ -931,12 +956,34 @@ a.view-comment-post-link {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
#adminmenu li, #submenu li {
|
||||
#sidemenu {
|
||||
margin: 0;
|
||||
color: #999;
|
||||
list-style: none;
|
||||
position: absolute;
|
||||
right: 25%;
|
||||
top: 55px;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
#sidemenu a {
|
||||
color: #2583ad;
|
||||
padding: 3px;
|
||||
line-height: 200%;
|
||||
}
|
||||
|
||||
#sidemenu a:hover, #sidemenu a.current, #sidemenu a.current:hover {
|
||||
color: #d54e21;
|
||||
}
|
||||
|
||||
#dashmenu li, #adminmenu li, #submenu li, #sidemenu li {
|
||||
display: inline;
|
||||
line-height: 200%;
|
||||
list-style: none;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#adminmenu #awaiting-mod {
|
||||
@ -971,6 +1018,8 @@ a.view-comment-post-link {
|
||||
height: 15px;
|
||||
}
|
||||
|
||||
/* end menu stuff */
|
||||
|
||||
/* Admin Footer */
|
||||
|
||||
#footer {
|
||||
|
Loading…
Reference in New Issue
Block a user