summaryrefslogtreecommitdiffstats
path: root/wp-admin
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-06-13 17:21:00 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-06-13 17:21:00 +0000
commit12de05107e4c8b006bde6ee8916f34eb476d08da (patch)
tree123ee54ecd1f3f777373b7df54a4604012d43640 /wp-admin
parente51c7a9ca4bfdb45fa3ec7334bd33871e78c68b1 (diff)
downloadwordpress-mu-12de05107e4c8b006bde6ee8916f34eb476d08da.tar.gz
wordpress-mu-12de05107e4c8b006bde6ee8916f34eb476d08da.tar.xz
wordpress-mu-12de05107e4c8b006bde6ee8916f34eb476d08da.zip
WP Merge with revision 8075
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1328 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin')
-rw-r--r--wp-admin/admin-ajax.php24
-rw-r--r--wp-admin/admin-header.php76
-rw-r--r--wp-admin/admin.php8
-rw-r--r--wp-admin/async-upload.php4
-rw-r--r--wp-admin/categories.php3
-rw-r--r--wp-admin/comment.php10
-rw-r--r--wp-admin/css/colors-classic.css47
-rw-r--r--wp-admin/css/colors-fresh.css38
-rw-r--r--wp-admin/css/global-rtl.css28
-rw-r--r--wp-admin/css/global.css4
-rw-r--r--wp-admin/css/ie.css3
-rw-r--r--wp-admin/css/media.css16
-rw-r--r--wp-admin/css/press-this.css451
-rw-r--r--wp-admin/css/widgets-rtl.css8
-rw-r--r--wp-admin/css/widgets.css24
-rw-r--r--wp-admin/custom-header.php2
-rw-r--r--wp-admin/edit-category-form.php2
-rw-r--r--wp-admin/edit-comments.php18
-rw-r--r--wp-admin/edit-form-advanced.php206
-rw-r--r--wp-admin/edit-form-comment.php12
-rw-r--r--wp-admin/edit-link-categories.php3
-rw-r--r--wp-admin/edit-link-category-form.php2
-rw-r--r--wp-admin/edit-link-form.php88
-rw-r--r--wp-admin/edit-page-form.php160
-rw-r--r--wp-admin/edit-pages.php7
-rw-r--r--wp-admin/edit-tag-form.php4
-rw-r--r--wp-admin/edit-tags.php3
-rw-r--r--wp-admin/edit.php7
-rw-r--r--wp-admin/export.php4
-rw-r--r--wp-admin/gears-manifest.php217
-rw-r--r--wp-admin/images/gear.pngbin0 -> 16742 bytes
-rw-r--r--wp-admin/images/loading.gifbin0 -> 2530 bytes
-rw-r--r--wp-admin/images/logo.gifbin0 -> 1238 bytes
-rw-r--r--wp-admin/images/tab.pngbin0 -> 1006 bytes
-rw-r--r--wp-admin/import/blogger.php4
-rw-r--r--wp-admin/import/dotclear.php4
-rw-r--r--wp-admin/import/greymatter.php12
-rw-r--r--wp-admin/import/mt.php4
-rw-r--r--wp-admin/import/textpattern.php4
-rw-r--r--wp-admin/import/wordpress.php9
-rw-r--r--wp-admin/import/wp-cat2tag.php301
-rw-r--r--wp-admin/includes/bookmark.php19
-rw-r--r--wp-admin/includes/class-wp-filesystem-base.php158
-rw-r--r--wp-admin/includes/class-wp-filesystem-direct.php190
-rw-r--r--wp-admin/includes/class-wp-filesystem-ftpext.php248
-rw-r--r--wp-admin/includes/class-wp-filesystem-ftpsockets.php270
-rw-r--r--wp-admin/includes/comment.php4
-rw-r--r--wp-admin/includes/dashboard.php7
-rw-r--r--wp-admin/includes/export.php7
-rw-r--r--wp-admin/includes/file.php159
-rw-r--r--wp-admin/includes/media.php173
-rw-r--r--wp-admin/includes/plugin.php122
-rw-r--r--wp-admin/includes/post.php265
-rw-r--r--wp-admin/includes/schema.php26
-rw-r--r--wp-admin/includes/taxonomy.php2
-rw-r--r--wp-admin/includes/template.php100
-rw-r--r--wp-admin/includes/theme.php2
-rw-r--r--wp-admin/includes/update.php70
-rw-r--r--wp-admin/includes/upgrade.php95
-rw-r--r--wp-admin/includes/user.php37
-rw-r--r--wp-admin/includes/widgets.php14
-rw-r--r--wp-admin/index.php9
-rw-r--r--wp-admin/install-helper.php3
-rw-r--r--wp-admin/js/forms.js51
-rw-r--r--wp-admin/js/gallery.js20
-rw-r--r--wp-admin/js/media-upload.js6
-rw-r--r--wp-admin/js/post.js2
-rw-r--r--wp-admin/js/theme-preview.js44
-rw-r--r--wp-admin/js/word-count.js39
-rw-r--r--wp-admin/js/wp-gears.js83
-rw-r--r--wp-admin/link-add.php1
-rw-r--r--wp-admin/link-import.php10
-rw-r--r--wp-admin/link-manager.php3
-rw-r--r--wp-admin/link-parse-opml.php2
-rw-r--r--wp-admin/link.php1
-rw-r--r--wp-admin/media.php9
-rw-r--r--wp-admin/menu-header.php2
-rw-r--r--wp-admin/moderation.php2
-rw-r--r--wp-admin/options-discussion.php78
-rw-r--r--wp-admin/options-general.php29
-rw-r--r--wp-admin/options-misc.php8
-rw-r--r--wp-admin/options-permalink.php6
-rw-r--r--wp-admin/options-privacy.php4
-rw-r--r--wp-admin/options-reading.php18
-rw-r--r--wp-admin/options-writing.php10
-rw-r--r--wp-admin/page-new.php3
-rw-r--r--wp-admin/page.php11
-rw-r--r--wp-admin/plugin-editor.php9
-rw-r--r--wp-admin/plugins.php318
-rw-r--r--wp-admin/post-new.php3
-rw-r--r--wp-admin/post.php11
-rw-r--r--wp-admin/press-this.php503
-rw-r--r--wp-admin/revision.php209
-rw-r--r--wp-admin/setup-config.php24
-rw-r--r--wp-admin/sidebar.php18
-rw-r--r--wp-admin/themes.php106
-rw-r--r--wp-admin/update-links.php8
-rw-r--r--wp-admin/update.php25
-rw-r--r--wp-admin/upgrade.php6
-rw-r--r--wp-admin/upload.php3
-rw-r--r--wp-admin/user-edit.php4
-rw-r--r--wp-admin/users.php15
-rw-r--r--wp-admin/widgets.php8
-rw-r--r--wp-admin/wp-admin.css238
104 files changed, 4099 insertions, 1648 deletions
diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php
index 663880e..aef321f 100644
--- a/wp-admin/admin-ajax.php
+++ b/wp-admin/admin-ajax.php
@@ -1,7 +1,7 @@
<?php
define('DOING_AJAX', true);
-require_once('../wp-config.php');
+require_once('../wp-load.php');
require_once('includes/admin.php');
if ( !is_user_logged_in() )
@@ -15,7 +15,7 @@ if ( isset($_GET['action']) && 'ajax-tag-search' == $_GET['action'] ) {
if ( strstr( $s, ',' ) )
die; // it's a multiple tag insert, we won't find anything
- $results = $wpdb->get_col( "SELECT name FROM $wpdb->terms WHERE name LIKE ('%$s%')" );
+ $results = $wpdb->get_col( $wpdb->prepare("SELECT name FROM $wpdb->terms WHERE name LIKE (%s)", '%' . $s . '%') );
echo join( $results, "\n" );
die;
}
@@ -462,10 +462,11 @@ case 'add-user' :
$x->send();
break;
case 'autosave' : // The name of this action is hardcoded in edit_post()
- $nonce_age = check_ajax_referer( 'autosave', 'autosavenonce');
+ define( 'DOING_AUTOSAVE', true );
+
+ $nonce_age = check_ajax_referer( 'autosave', 'autosavenonce' );
global $current_user;
- $_POST['post_status'] = 'draft';
$_POST['post_category'] = explode(",", $_POST['catslist']);
$_POST['tags_input'] = explode(",", $_POST['tags_input']);
if($_POST['post_type'] == 'page' || empty($_POST['post_category']))
@@ -479,8 +480,9 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
$supplemental = array();
- $id = 0;
+ $id = $revision_id = 0;
if($_POST['post_ID'] < 0) {
+ $_POST['post_status'] = 'draft';
$_POST['temp_ID'] = $_POST['post_ID'];
if ( $do_autosave ) {
$id = wp_write_post();
@@ -511,8 +513,18 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
if ( !current_user_can('edit_post', $post_ID) )
die(__('You are not allowed to edit this post.'));
}
+
if ( $do_autosave ) {
- $id = edit_post();
+ // Drafts are just overwritten by autosave
+ if ( 'draft' == $post->post_status ) {
+ $id = edit_post();
+ } else { // Non drafts are not overwritten. The autosave is stored in a special post revision.
+ $revision_id = wp_create_post_autosave( $post->ID );
+ if ( is_wp_error($revision_id) )
+ $id = $revision_id;
+ else
+ $id = $post->ID;
+ }
$data = $message;
} else {
$id = $post->ID;
diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php
index 0185a98..7073e2f 100644
--- a/wp-admin/admin-header.php
+++ b/wp-admin/admin-header.php
@@ -5,6 +5,7 @@ if ( $editing ) {
if ( user_can_richedit() )
wp_enqueue_script( 'wp_tiny_mce' );
}
+wp_enqueue_script( 'wp-gears' );
$min_width_pages = array( 'post.php', 'post-new.php', 'page.php', 'page-new.php', 'widgets.php', 'comment.php', 'link.php' );
$the_current_page = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
@@ -28,14 +29,13 @@ get_admin_page_title();
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
<title><?php bloginfo('name') ?> &rsaquo; <?php echo wp_specialchars( strip_tags( $title ) ); ?> &#8212; WordPress</title>
<?php
+
wp_admin_css( 'css/global' );
wp_admin_css();
wp_admin_css( 'css/colors' );
+wp_admin_css( 'css/ie' );
+
?>
-<!--[if gte IE 6]>
-<?php wp_admin_css( 'css/ie' );
-?>
-<![endif]-->
<script type="text/javascript">
//<![CDATA[
addLoadEvent = function(func) {if (typeof jQuery != "undefined") jQuery(document).ready(func); else if (typeof wpOnload!='function'){wpOnload=func;} else {var oldonload=wpOnload; wpOnload=function(){oldonload();func();}}};
@@ -44,26 +44,74 @@ addLoadEvent = function(func) {if (typeof jQuery != "undefined") jQuery(document
<?php if ( ($parent_file != 'link-manager.php') && ($parent_file != 'options-general.php') && $ie6_no_scrollbar ) : ?>
<style type="text/css">* html { overflow-x: hidden; }</style>
<?php endif;
-if ( isset($page_hook) )
- do_action('admin_print_scripts-' . $page_hook);
-else if ( isset($plugin_page) )
- do_action('admin_print_scripts-' . $plugin_page);
-do_action('admin_print_scripts');
+
+$hook_suffixes = array();
if ( isset($page_hook) )
- do_action('admin_head-' . $page_hook);
+ $hook_suffixes[] = "-$page_hook";
else if ( isset($plugin_page) )
- do_action('admin_head-' . $plugin_page);
-do_action('admin_head');
+ $hook_suffixes[] = "-$plugin_page";
+else if ( isset($pagenow) )
+ $hook_suffixes[] = "-$pagenow";
+
+$hook_suffixes[] = '';
+
+foreach ( $hook_suffixes as $hook_suffix )
+ do_action("admin_print_styles$hook_suffix"); // do_action( 'admin_print_styles-XXX' ); do_action( 'admin_print_styles' );
+foreach ( $hook_suffixes as $hook_suffix )
+ do_action("admin_print_scripts$hook_suffix"); // do_action( 'admin_print_scripts-XXX' ); do_action( 'admin_print_scripts' );
+foreach ( $hook_suffixes as $hook_suffix )
+ do_action("admin_head$hook_suffix"); // do_action( 'admin_head-XXX' ); do_action( 'admin_head' );
+unset($hook_suffixes, $hook_suffix);
+
?>
</head>
<body class="wp-admin <?php echo apply_filters( 'admin_body_class', '' ); ?>">
<div id="wpwrap">
<div id="wpcontent">
<div id="wphead">
-<h1><?php bloginfo('name'); ?><span id="viewsite"><a href="<?php echo trailingslashit( get_option('home') ); ?>"><?php _e('Visit Site') ?></a></span></h1>
+<h1><?php if ( '' == get_bloginfo('name') ) echo '&nbsp;'; else echo get_bloginfo('name'); ?><span id="viewsite"><a href="<?php echo trailingslashit( get_option('home') ); ?>"><?php _e('Visit Site') ?></a></span></h1>
</div>
-<div id="user_info"><p><?php printf(__('Howdy, <a href="%1$s">%2$s</a>!'), 'profile.php', $user_identity) ?> | <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="<?php _e('Log Out') ?>"><?php _e('Log Out'); ?></a> | <?php _e('<a href="http://codex.wordpress.org/">Help</a>') ?> | <?php _e('<a href="http://wordpress.org/support/">Forums</a>') ?></p></div>
+
+<?php
+$gears_compat = false;
+
+if ( ($is_gecko || $is_winIE) && strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'webkit') === false ) {
+ $gears_compat = true;
+?>
+ <div id="gears-info-box" class="info-box" style="display:none;">
+ <img src="images/gear.png" title="Gear" alt="" class="gears-img" />
+ <div id="gears-msg1">
+ <h3 class="info-box-title"><?php _e('Speed up WordPress'); ?></h3>
+ <p><?php _e('WordPress has support for Gears that adds new features to your web browser.'); ?><br />
+ <a href="http://gears.google.com/" target="_blank" style="font-weight:normal;"><?php _e('More information...'); ?></a></p>
+ <p><?php _e('After installing and enabling it, most of the WordPress images, scripts and CSS files will be stored on this computer. This will speed up page loading.'); ?></p>
+ <p><strong><?php _e('Please make sure you are not using a public or shared computer.'); ?></strong></p>
+ <div class="submit"><button onclick="window.location = 'http://gears.google.com/?action=install&amp;return=<?php echo urlencode( admin_url() ); ?>';" class="button"><?php _e('Install Now'); ?></button>
+ <button class="button" style="margin-left:10px;" onclick="document.getElementById('gears-info-box').style.display='none';">Cancel</button></div>
+ </div>
+
+ <div id="gears-msg2" style="display:none;">
+ <h3 class="info-box-title"><?php _e('Gears Status'); ?></h3>
+ <p><?php _e('Gears is installed on this computer but is not enabled for use with WordPress.'); ?></p>
+ <p><?php _e('To enable it, make sure this web site is not on the denied list in Gears Settings under your browser\'s Tools menu, then click the button below.'); ?></p>
+ <p><strong><?php _e('However if this is a public or shared computer, Gears should not be enabled.'); ?></strong></p>
+ <div class="submit"><button class="button" onclick="wpGears.getPermission();"><?php _e('Enable Gears'); ?></button>
+ <button class="button" style="margin-left:10px;" onclick="document.getElementById('gears-info-box').style.display='none';">Cancel</button></div>
+ </div>
+
+ <div id="gears-msg3" style="display:none;">
+ <h3 class="info-box-title"><?php _e('Gears Status'); ?></h3>
+ <p><?php _e('Gears is installed and enabled on this computer. You can disable it from your browser Tools menu.'); ?></p>
+ <p><?php _e('If there are any errors, try disabling Gears, then reload the page and enable it again.'); ?></p>
+ <p><?php _e('Local storage status:'); ?> <span id="gears-wait"><span style="color:#f00;"><?php _e('Please wait! Updating files:'); ?></span> <span id="gears-upd-number"></span></span></p>
+ <div class="submit"><button class="button" onclick="document.getElementById('gears-info-box').style.display='none';"><?php _e('Close'); ?></button></div>
+ </div>
+ </div>
+
+<?php } ?>
+
+<div id="user_info"><p><?php printf(__('Howdy, <a href="%1$s">%2$s</a>!'), 'profile.php', $user_identity) ?> | <a href="<?php echo site_url('wp-login.php?action=logout', 'login') ?>" title="<?php _e('Log Out') ?>"><?php _e('Log Out'); ?></a> | <?php _e('<a href="http://codex.wordpress.org/">Help</a>') ?> | <?php _e('<a href="http://wordpress.org/support/">Forums</a>') ?> | <?php if ( $gears_compat ) { ?><span id="gears-menu"><a href="#" onclick="wpGears.message(1);return false;"><?php _e('Speed up!') ?></a></span><?php } ?></p></div>
<?php
require(ABSPATH . 'wp-admin/menu-header.php');
diff --git a/wp-admin/admin.php b/wp-admin/admin.php
index 1385e87..e9591e8 100644
--- a/wp-admin/admin.php
+++ b/wp-admin/admin.php
@@ -2,9 +2,9 @@
define('WP_ADMIN', TRUE);
if ( defined('ABSPATH') )
- require_once( ABSPATH . 'wp-config.php');
+ require_once(ABSPATH . 'wp-load.php');
else
- require_once('../wp-config.php');
+ require_once('../wp-load.php');
if ( get_option('db_version') != $wp_db_version ) {
require_once('../wp-includes/class-snoopy.php');
@@ -27,8 +27,8 @@ $time_format = get_option('time_format');
wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'popuptitle', 'popupurl', 'text', 'trackback', 'pingback'));
-wp_admin_css_color('classic', __('Classic'), get_option( 'siteurl' ) . "/wp-admin/css/colors-classic.css", array('#07273E', '#14568A', '#D54E21', '#2683AE'));
-wp_admin_css_color('fresh', __('Fresh'), get_option( 'siteurl' ) . "/wp-admin/css/colors-fresh.css", array('#464646', '#CEE1EF', '#D54E21', '#2683AE'));
+wp_admin_css_color('classic', __('Classic'), admin_url("css/colors-classic.css"), array('#07273E', '#14568A', '#D54E21', '#2683AE'));
+wp_admin_css_color('fresh', __('Fresh'), admin_url("css/colors-fresh.css"), array('#464646', '#CEE1EF', '#D54E21', '#2683AE'));
wp_enqueue_script( 'common' );
wp_enqueue_script( 'jquery-color' );
diff --git a/wp-admin/async-upload.php b/wp-admin/async-upload.php
index c1c0f0d..59feb8c 100644
--- a/wp-admin/async-upload.php
+++ b/wp-admin/async-upload.php
@@ -5,9 +5,9 @@
*/
if ( defined('ABSPATH') )
- require_once( ABSPATH . 'wp-config.php');
+ require_once(ABSPATH . 'wp-load.php');
else
- require_once('../wp-config.php');
+ require_once('../wp-load.php');
// Flash often fails to send cookies with the POST or upload, so we need to pass it in GET or POST instead
if ( empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
diff --git a/wp-admin/categories.php b/wp-admin/categories.php
index 945da0c..473a3a4 100644
--- a/wp-admin/categories.php
+++ b/wp-admin/categories.php
@@ -126,6 +126,7 @@ endif; ?>
<?php endif; ?>
<p id="post-search">
+ <label class="hidden" for="post-search-input"><?php _e('Search Categories'); ?>:</label>
<input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
<input type="submit" value="<?php _e( 'Search Categories' ); ?>" class="button" />
</p>
@@ -147,7 +148,7 @@ endif; ?>
<table class="widefat">
<thead>
<tr>
- <th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /></th>
+ <th scope="col" class="check-column"><input type="checkbox" /></th>
<th scope="col"><?php _e('Name') ?></th>
<th scope="col"><?php _e('Description') ?></th>
<th scope="col" class="num"><?php _e('Posts') ?></th>
diff --git a/wp-admin/comment.php b/wp-admin/comment.php
index 4aa9749..d1e394e 100644
--- a/wp-admin/comment.php
+++ b/wp-admin/comment.php
@@ -21,7 +21,7 @@ case 'editcomment' :
$title = __('Edit Comment');
wp_enqueue_script('comment');
- //wp_enqueue_script('thickbox');
+
require_once('admin-header.php');
$comment_id = absint( $_GET['c'] );
@@ -78,7 +78,7 @@ if ( 'spam' == $_GET['dt'] ) {
<table width="100%">
<tr>
-<td><input type='button' class="button" value='<?php _e('No'); ?>' onclick="self.location='<?php echo get_option('siteurl'); ?>/wp-admin/edit-comments.php';" /></td>
+<td><input type='button' class="button" value='<?php _e('No'); ?>' onclick="self.location='<?php echo admin_url('edit-comments.php'); ?>" /></td>
<td class="textright"><input type='submit' class="button" value='<?php echo $button; ?>' /></td>
</tr>
</table>
@@ -146,7 +146,7 @@ case 'deletecomment' :
else if ( '' != wp_get_original_referer() && false == $noredir )
wp_redirect( wp_get_original_referer() );
else
- wp_redirect( get_option('siteurl') . '/wp-admin/edit-comments.php' );
+ wp_redirect( admin_url('edit-comments.php') );
die;
break;
@@ -171,7 +171,7 @@ case 'unapprovecomment' :
if ( '' != wp_get_referer() && false == $noredir )
wp_redirect( wp_get_referer() );
else
- wp_redirect( get_option('siteurl') . '/wp-admin/edit.php?p=' . absint( $comment->comment_post_ID ) . '#comments' );
+ wp_redirect( admin_url('edit.php?p=' . absint( $comment->comment_post_ID ) . '#comments') );
exit();
break;
@@ -196,7 +196,7 @@ case 'approvecomment' :
if ( '' != wp_get_referer() && false == $noredir )
wp_redirect( wp_get_referer() );
else
- wp_redirect( get_option('siteurl') . '/wp-admin/edit.php?p=' . absint( $comment->comment_post_ID ) . '#comments' );
+ wp_redirect( admin_url('edit.php?p=' . absint( $comment->comment_post_ID ) . '#comments') );
exit();
break;
diff --git a/wp-admin/css/colors-classic.css b/wp-admin/css/colors-classic.css
index 6f83c66..83a1141 100644
--- a/wp-admin/css/colors-classic.css
+++ b/wp-admin/css/colors-classic.css
@@ -2,7 +2,7 @@ a.page-numbers:hover {
border-color: #999;
}
-body {
+body, .form-table .pre {
background-color: #fff;
color: #333;
}
@@ -37,7 +37,7 @@ input.disabled, textarea.disabled {
color: #fff;
}
-ul#category-tabs li.ui-tabs-selected, li.widget-list-control-item, div.nav, .tablenav, .submitbox, h3.dashboard-widget-title, h3.dashboard-widget-title span, h3.dashboard-widget-title small, ul.view-switch li.current, .form-table tr, #poststuff h3, .login form {
+ul#category-tabs li.ui-tabs-selected, li.widget-list-control-item, div.nav, .tablenav, .submitbox, h3.dashboard-widget-title, h3.dashboard-widget-title span, h3.dashboard-widget-title small, ul.view-switch li.current, .form-table tr, #poststuff h3, .login form, h3.info-box-title {
background-color: #cfebf7;
}
@@ -63,7 +63,7 @@ ul#widget-list li.widget-list-item h4.widget-title {
color: #000;
}
-ul.widget-control-list .sorthelper {
+.sorthelper {
background-color: #ccf3fa;
}
@@ -204,11 +204,11 @@ ul.widget-control-list .sorthelper {
border-color: #535353;
}
-.submit input:hover, .button:hover, .button-secondary:hover, #wphead #viewsite a:hover, #submenu a.current, #submenu a:hover, .submitbox #previewview a:hover, #the-comment-list .comment a:hover, #rightnow a:hover, a:hover, .subsubsub a:hover, .subsubsub a.current:hover, #login form .submit input:hover, div.dashboard-widget-submit input:hover, #edit-slug-buttons a.save:hover {
+.submit input:hover, .button:hover, .button-secondary:hover, #wphead #viewsite a:hover, #submenu a.current, #submenu a:hover, .submitbox #previewview a:hover, #the-comment-list .comment a:hover, #rightnow a:hover, a:hover, .subsubsub a:hover, .subsubsub a.current:hover, #login form .submit input:hover, div.dashboard-widget-submit input:hover, #edit-slug-buttons a.save:hover, #media-upload a.del-link:hover {
color: #d54e21;
}
-#adminmenu a:hover, #sidemenu a:hover {
+#adminmenu a:hover, #sidemenu a:hover, .ui-tabs-nav a:hover {
color: #97c4d8;
}
@@ -239,7 +239,8 @@ ul.widget-control-list .sorthelper {
border-bottom-color: #999;
}
-.submitbox .submitdelete:hover {
+.submitbox .submitdelete:hover,
+#media-upload a.delete:hover {
color: #fff;
background-color: #f00;
border-bottom-color: #f00;
@@ -291,11 +292,11 @@ ul.widget-control-list .sorthelper {
color: #5a5a5a;
}
-#poststuff #edButtonPreview, #poststuff #edButtonHTML, #the-comment-list p.comment-author strong a, a {
+#poststuff #edButtonPreview, #poststuff #edButtonHTML, #the-comment-list p.comment-author strong a, #media-upload a.del-link, #media-upload a.delete, a {
color: #2e7ca0;
}
-#adminmenu a {
+#adminmenu a, .ui-tabs-nav a {
color: #cfebf6;
}
@@ -303,7 +304,7 @@ ul.widget-control-list .sorthelper {
color: #2782af
}
/* Because we don't want visited on these links */
-#adminmenu a.current, #sidemenu a.current {
+#adminmenu a.current, #sidemenu a.current, body.press-this .ui-tabs-selected a, body.press-this .ui-tabs-selected a:hover {
background-color: #fff;
border-color: #07273e;
border-bottom-color: #fff;
@@ -414,11 +415,11 @@ input.readonly {
background-color: #fff;
}
-#plugins .active {
+.plugins .active {
background-color: #BBEEBB;
}
-#plugins .togl {
+.plugins .togl {
border-right-color: #ccc;
}
@@ -426,7 +427,7 @@ input.readonly {
background-color: #ffffe0;
}
-#plugins tr {
+.plugins tr {
background-color: #fff;
}
@@ -550,11 +551,6 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
color: #f00;
}
-#media-upload a.delete {
- color: #888;
-}
-
-
/* TinyMCE */
.wp_themeSkin *,
.wp_themeSkin a:hover,
@@ -565,7 +561,7 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
}
/* Containers */
-.wp_themeSkin table {
+.wp_themeSkin table, #wp_editbtns {
background: #83B4D5;
}
@@ -717,3 +713,18 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
background-color: #ddd;
color: #333;
}
+
+/* Diff */
+
+table.diff .diff-deletedline {
+ background-color: #ffdddd;
+}
+table.diff .diff-deletedline del {
+ background-color: #ff9999;
+}
+table.diff .diff-addedline {
+ background-color: #ddffdd;
+}
+table.diff .diff-addedline ins {
+ background-color: #99ff99;
+}
diff --git a/wp-admin/css/colors-fresh.css b/wp-admin/css/colors-fresh.css
index 1332c37..1d59940 100644
--- a/wp-admin/css/colors-fresh.css
+++ b/wp-admin/css/colors-fresh.css
@@ -2,7 +2,7 @@ a.page-numbers:hover {
border-color: #999;
}
-body {
+body, .form-table .pre {
background-color: #fff;
color: #333;
}
@@ -41,7 +41,7 @@ input.disabled, textarea.disabled {
color: #fff;
}
-li.widget-list-control-item, div.nav, .tablenav, .submitbox, h3.dashboard-widget-title, h3.dashboard-widget-title span, h3.dashboard-widget-title small, ul.view-switch li.current, .form-table tr, #poststuff h3, .login form {
+li.widget-list-control-item, div.nav, .tablenav, .submitbox, h3.dashboard-widget-title, h3.dashboard-widget-title span, h3.dashboard-widget-title small, ul.view-switch li.current, .form-table tr, #poststuff h3, .login form, h3.info-box-title {
background-color: #eaf3fa;
}
@@ -63,7 +63,7 @@ ul#widget-list li.widget-list-item h4.widget-title {
color: #000;
}
-ul.widget-control-list .sorthelper {
+.sorthelper {
background-color: #ccf3fa;
}
@@ -196,7 +196,7 @@ ul.widget-control-list .sorthelper {
border-color: #535353;
}
-.submit input:hover, .button:hover, .button-secondary:hover, #wphead #viewsite a:hover, #adminmenu a:hover, #sidemenu a:hover, #submenu a.current, #submenu a:hover, .submitbox #previewview a:hover, #the-comment-list .comment a:hover, #rightnow a:hover, a:hover, .subsubsub a:hover, .subsubsub a.current:hover, #login form .submit input:hover, div.dashboard-widget-submit input:hover, #edit-slug-buttons a.save:hover, #media-upload a.delete:hover {
+.submit input:hover, .button:hover, .button-secondary:hover, #wphead #viewsite a:hover, #adminmenu a:hover, #sidemenu a:hover, #submenu a.current, #submenu a:hover, .submitbox #previewview a:hover, #the-comment-list .comment a:hover, #rightnow a:hover, a:hover, .subsubsub a:hover, .subsubsub a.current:hover, #login form .submit input:hover, div.dashboard-widget-submit input:hover, #edit-slug-buttons a.save:hover, #media-upload a.delete:hover, #media-upload a.del-link:hover, .ui-tabs-nav a:hover {
color: #d54e21;
}
@@ -226,7 +226,8 @@ ul.widget-control-list .sorthelper {
border-bottom-color: #999;
}
-.submitbox .submitdelete:hover {
+.submitbox .submitdelete:hover,
+#media-upload a.delete:hover {
color: #fff;
background-color: #f00;
border-bottom-color: #f00;
@@ -278,12 +279,12 @@ ul.widget-control-list .sorthelper {
color: #666;
}
-#adminmenu a, #submenu a, #poststuff #edButtonPreview, #poststuff #edButtonHTML, #the-comment-list p.comment-author strong a, a {
+#adminmenu a, #submenu a, #poststuff #edButtonPreview, #poststuff #edButtonHTML, #the-comment-list p.comment-author strong a, #media-upload a.del-link, #media-upload a.delete, .ui-tabs-nav a, a {
color: #2583ad;
}
/* Because we don't want visited on these links */
-#adminmenu a.current, #sidemenu a.current {
+#adminmenu a.current, #sidemenu a.current, body.press-this .ui-tabs-selected a, body.press-this .ui-tabs-selected a:hover {
background-color: #fff;
border-color: #c6d9e9;
border-bottom-color: #fff;
@@ -383,11 +384,11 @@ input.readonly {
background-color: #fff;
}
-#plugins .active {
+.plugins .active {
background-color: #e7f7d3;
}
-#plugins .togl {
+.plugins .togl {
border-right-color: #ccc;
}
@@ -395,7 +396,7 @@ input.readonly {
background-color: #ffffe0;
}
-#plugins tr {
+.plugins tr {
background-color: #fff;
}
@@ -532,7 +533,7 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
}
/* Containers */
-.wp_themeSkin table {
+.wp_themeSkin table, #wp_editbtns {
background: #cee1ef;
}
@@ -688,3 +689,18 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
background-color: #ddd;
color: #333;
}
+
+/* Diff */
+
+table.diff .diff-deletedline {
+ background-color: #ffdddd;
+}
+table.diff .diff-deletedline del {
+ background-color: #ff9999;
+}
+table.diff .diff-addedline {
+ background-color: #ddffdd;
+}
+table.diff .diff-addedline ins {
+ background-color: #99ff99;
+}
diff --git a/wp-admin/css/global-rtl.css b/wp-admin/css/global-rtl.css
new file mode 100644
index 0000000..a34f7ad
--- /dev/null
+++ b/wp-admin/css/global-rtl.css
@@ -0,0 +1,28 @@
+/* styles for use by people extending the WordPress interface */
+.alignleft { float: right; }
+.alignright { float: left; }
+
+.textleft { text-align: right; }
+.textright { text-align: left; }
+
+.widefat td {
+ padding: 7px 10px 9px 15px;
+}
+
+.widefat th {
+ padding: 9px 10px 6px 15px;
+ text-align: right;
+}
+
+.widefat th input {
+ margin: 0 8px 0 0;
+}
+
+.widefat .check-column {
+ text-align: left;
+}
+
+.wrap h2 {
+ margin: 5px -4px 0 0;
+ padding: 0 0 7px 280px;
+}
diff --git a/wp-admin/css/global.css b/wp-admin/css/global.css
index 926aa88..295adea 100644
--- a/wp-admin/css/global.css
+++ b/wp-admin/css/global.css
@@ -194,3 +194,7 @@ th.check-column + th, th.check-column + td {
padding-bottom: 7px;
padding-right: 280px;
}
+
+.wrap h2.long-header {
+ padding-right: 0;
+}
diff --git a/wp-admin/css/ie.css b/wp-admin/css/ie.css
index 39ef254..e4d0355 100644
--- a/wp-admin/css/ie.css
+++ b/wp-admin/css/ie.css
@@ -111,7 +111,10 @@ div#dashboard-widgets {
.tablenav-pages {
display: block;
margin-top: -3px;
+}
+table.ie-fixed {
+ table-layout: fixed;
}
#post-search .button, #widget-search .button {
diff --git a/wp-admin/css/media.css b/wp-admin/css/media.css
index 7d46c1c..225fa84 100644
--- a/wp-admin/css/media.css
+++ b/wp-admin/css/media.css
@@ -222,6 +222,11 @@ abbr.required {
min-height: 36px;
width: 100%;
}
+
+#media-upload .ui-sortable .media-item {
+ cursor: move;
+}
+
.filename {
line-height: 36px;
margin-left: 10px;
@@ -233,6 +238,7 @@ abbr.required {
padding: 5px;
width: 100%;
clear: both;
+ cursor: default;
}
#media-upload .describe th.label {
padding-top: .5em;
@@ -260,3 +266,13 @@ abbr.required {
padding:2px;
vertical-align:top;
}
+
+#media-upload a.delete,
+#media-upload a.del-link {
+ padding: 0 3px 1px;
+}
+
+#media-upload .del-attachment {
+ display: none;
+ margin: 5px 0;
+}
diff --git a/wp-admin/css/press-this.css b/wp-admin/css/press-this.css
new file mode 100644
index 0000000..7a01f9a
--- /dev/null
+++ b/wp-admin/css/press-this.css
@@ -0,0 +1,451 @@
+body {
+ font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
+ color: #333;
+ margin: 0px;
+ padding: 0px;
+}
+/* Tabs */
+@media projection , screen {
+ .ui-tabs-hide {
+ display: none;
+ }
+}
+
+@media print {
+ .ui-tabs-nav {
+ display: none;
+ }
+}
+
+.ui-tabs-nav {
+ list-style: none;
+ border-bottom: 1px solid #C6D9E9;
+ padding-left: 8px;
+ margin-bottom: .5em;
+ margin-top: -2em;
+}
+
+/* Additional IE specific bug fixes... */
+* html .ui-tabs-nav { /* auto clear, @ IE 6 & IE 7 Quirks Mode */
+ display: inline-block;
+}
+
+* :first-child+html .ui-tabs-nav {
+ /* @ IE 7 Standards Mode - do not group selectors, otherwise IE 6 will ignore complete rule (because of the unknown + combinator)... */
+ display: inline-block;
+}
+
+.ui-tabs-nav:after {
+ /* clearing without presentational markup, IE gets extra treatment */
+ display: block;
+ clear: both;
+ content: " ";
+}
+
+.ui-tabs-nav li {
+ float: left;
+ margin: 0;
+ height: 2em;
+ line-height: 2em;
+}
+
+.ui-tabs-nav a,.ui-tabs-nav a span {
+ display: block;
+}
+
+.ui-tabs-nav a {
+ margin: 1px 0 0;
+ /* position: relative makes opacity fail for disabled tab in IE */
+ padding-left: 0;
+ color: #27537a;
+ font-weight: bold;
+ line-height: 2em;
+ text-align: center;
+ text-decoration: none;
+ white-space: nowrap; /* required in IE 6 */
+ outline: 0; /* prevent dotted border in Firefox */
+ padding: 0 1em;
+}
+
+.ui-tabs-nav .ui-tabs-selected a {
+ position: relative;
+ top: 1px;
+ z-index: 2;
+ margin-top: 0;
+ -moz-border-radius-topleft: 4px;
+ -moz-border-radius-topright: 4px;
+ -webkit-border-top-left-radius: 4px;
+ -webkit-border-top-right-radius: 4px;
+ border-style: solid;
+ border-width: 1px;
+ background: white;
+ border-bottom-width: 2px;
+ margin-top: -2px;
+}
+
+.ui-tabs-nav a:hover,.ui-tabs-nav a:focus,.ui-tabs-nav a:active,
+.ui-tabs-nav .ui-tabs-selected a:link,.ui-tabs-nav .ui-tabs-selected a:visited {
+ cursor: pointer;
+}
+
+#wphead {
+ border-top: none;
+}
+
+.button {
+font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
+padding: 3px 5px;
+font-size: 12px;
+line-height: 1.5em;
+border-width: 1px;
+border-style: solid;
+-moz-border-radius: 3px;
+-khtml-border-radius: 3px;
+-webkit-border-radius: 3px;
+border-radius: 3px;
+cursor: pointer;
+margin-left: 5px;
+text-decoration: none;
+}
+
+.howto {
+font-size: 11px;
+}
+#newtag { padding: 3px; }
+
+#wphead {
+ height: 2em;
+ padding-top: 8px;
+}
+
+#wphead #viewsite {
+ position: absolute;
+ margin-top: 12px;
+ margin-left: 10px;
+}
+
+#viewsite {
+ position: relative;
+ right: 8px;
+ top: 6px;
+ margin: 0 !important;
+}
+
+#wphead #viewsite a {
+ font: 12px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana,
+ sans-serif;
+ padding: 3px 4px;
+ display: block;
+ letter-spacing: normal;
+ border-width: 1px;
+ border-style: solid;
+ -moz-border-radius: 3px;
+ -khtml-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ text-decoration: none;
+}
+
+#previewview {
+ padding-top: 8px !important;
+ padding-bottom: 8px !important;
+}
+
+h1 {
+ font-size: .75em;
+ line-height: 2.666em;
+ top: .5em;
+ right: 0;
+ margin: 0 !important;
+ padding: 0 !important;
+ width: 236px;
+ background: none;
+}
+
+input.text {
+ border: 0pt none;
+ outline-color: -moz-use-text-color;
+ outline-style: none;
+ outline-width: medium;
+ padding: 0pt;
+ width: 100%;
+ border-style: solid;
+ color: #333333;
+}
+
+.titlewrap {
+ border-style: solid;
+ border-width: 1px;
+ padding: 2px 3px;
+ border-color: #CCCCCC;
+}
+
+div#container {
+ margin: 0;
+ min-width: 500px;
+}
+
+div#posting {
+ padding-left: 16px;
+ position: absolute;
+ z-index: 1;
+ width: 66%;
+}
+
+div#posting h2 {
+ margin: .5em 0 .25em 0;
+ font-size: 12px;
+ padding: 3px;
+ background: ;
+}
+
+div#container form {
+ margin: 0px;
+ padding: 0px;
+}
+
+div#categories {
+ font-size: 85%;
+ position: absolute;
+ top: 50px;
+ right: 16px;
+ width: 27%;
+ z-index: 2;
+}
+
+div#categories h2 {
+ color: #333;
+ font-size: 12px;
+ margin: .5em 0 0 1em;
+ padding: 0;
+}
+
+#categories-all {
+ overflow: auto;
+ padding: 1em;
+ height: 15em;
+}
+
+#categories ul {
+ list-style: none;
+ padding: 0;
+ margin: 0;
+}
+
+.editor-container {
+ border-width: 1px;
+ border-color: #ccc;
+ border-style: solid;
+ margin-bottom: 1em;
+}
+
+#tagsdiv #newtag {
+ margin-right: 5px;
+ width: 16em;
+}
+
+#tagchecklist {
+ padding-left: 1em;
+ margin-bottom: 1em;
+ font-size: 12px;
+ overflow: auto;
+}
+
+#tagchecklist strong {
+ position: absolute;
+ font-size: .75em;
+}
+
+#tagchecklist span {
+ margin-right: .5em;
+ margin-left: 10px;
+ display: block;
+ float: left;
+ font-size: 11px;
+ line-height: 1.8em;
+ white-space: nowrap;
+ cursor: default;
+}
+
+#tagchecklist span a {
+ margin: 6px 0pt 0pt -9px;
+ cursor: pointer;
+ width: 10px;
+ height: 10px;
+ display: block;
+ float: left;
+ text-indent: -9999px;
+ overflow: hidden;
+ position: absolute;
+}
+
+.howto {
+ font-style: italic;
+ display: block;
+}
+
+#post_title {
+ width: 99%;
+}
+
+#img_container {
+ background-color: #fff;
+ overflow: auto;
+ height: 100px;
+}
+
+#img_container img {
+ width: 75px;
+ height: 75px;
+ padding: 2px;
+ background-color: #f4f4f4;
+ margin-right: 7px;
+ margin-bottom: 7px;
+ cursor: pointer;
+}
+.submit {
+-moz-border-radius-bottomleft: 3px;
+-khtml-border-bottom-left-radius: 3px;
+-webkit-border-bottom-left-radius: 3px;
+border-bottom-left-radius: 3px;
+-moz-border-radius-bottomright: 3px;
+-khtml-border-bottom-right-radius: 3px;
+-webkit-border-bottom-right-radius: 3px;
+border-bottom-right-radius: 3px;
+margin: 0;
+padding: 0;
+}
+.submitbox {
+ width: 100%;
+ float: right;
+}
+
+.submitbox .submit a:hover {
+ border-bottom-width: 1px;
+ border-bottom-style: solid;
+}
+
+.submitbox .submit input {
+ border: none;
+ text-align: left;
+ padding: 12px 10px 10px 10px;
+ font-size: 12px;
+ margin: 10px;
+
+ -moz-border-radius: 3px;
+ -khtml-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ cursor: pointer;
+}
+
+.submitbox #previewview {
+ padding: 15px 10px;
+ -moz-border-radius-topleft: 3px;
+ -khtml-border-top-left-radius: 3px;
+ -webkit-border-top-left-radius: 3px;
+ border-top-left-radius: 3px;
+ -moz-border-radius-topright: 3px;
+ -khtml-border-top-right-radius: 3px;
+ -webkit-border-top-right-radius: 3px;
+ border-top-right-radius: 3px;
+}
+
+.hidden {
+ display: none;
+}
+
+.video_split #extra_fields {
+ width: 27%;
+ height: 300px;
+ float: left;
+}
+
+#embed_code {
+ border: 0;
+ width: 99%;
+ height: 200px;
+}
+.video_split .editor_area {
+ width: 70%;
+ float: right;
+}
+
+#jaxtag {
+ clear: both;
+ padding-left: 1em;
+}
+
+.ac_results {
+ padding: 0;
+ margin: 0;
+ list-style: none;
+ position: absolute;
+ z-index: 10000;
+ display: none;
+ border-width: 1px;
+ border-style: solid;
+}
+
+.ac_results li {
+ padding: 2px 5px;
+ white-space: nowrap;
+ text-align: left;
+}
+
+.ac_over {
+ cursor: pointer;
+}
+
+.ac_match {
+ text-decoration: underline;
+}
+
+
+.photolist {
+display: none;
+}
+
+#extra_fields small {
+display: block;
+margin-top: .5em;
+padding-bottom: .25em;
+}
+
+#TB_ajaxContent #options {
+position: absolute;
+top: 20px;
+right: 25px;
+background: white;
+padding: 5px;
+}
+#TB_ajaxContent h3 {
+margin-bottom: .25em;
+}
+
+.updated {
+ margin: 0;
+ margin-left: 15px;
+ margin-right: 15px;
+ padding: 0;
+ max-width: 980px;
+ border-width: 1px;
+ border-style: solid;
+ padding: 0 0.6em;
+ max-width: 950px;
+ margin-top: 1em;
+ margin-bottom: 1em;
+}
+
+.updated p, .error p {
+ margin: 0.6em 0;
+}
+
+.updated a, .error a {
+ text-decoration: underline;
+}
+
+.updated a {
+ text-decoration: none;
+ padding-bottom: 2px;
+}
diff --git a/wp-admin/css/widgets-rtl.css b/wp-admin/css/widgets-rtl.css
index ece02b5..8dd3994 100644
--- a/wp-admin/css/widgets-rtl.css
+++ b/wp-admin/css/widgets-rtl.css
@@ -29,9 +29,12 @@ ul#widget-list li.widget-list-item div.widget-description {
margin-right:0;
margin-left:8px;
}
+h4.widget-title span {
+ float: right;
+}
h4.widget-title a {
- right:auto;
- left:1em;
+ float: left;
+ margin: 0 1em 0 0;
}
li.widget-list-control-item h4.widget-title a, #dragHelper li.widget-list-control-item h4.widget-title a, #draghelper li.widget-list-control-item h4.widget-title a:visited {
right:auto;
@@ -45,5 +48,4 @@ ul.widget-control-list div.widget-control-actions {
ul.widget-control-list h4.widget-title,
#dragHelper h4.widget-title {
text-align: right;
- padding: 0.4em 0.8em 0.4em 2.5em;
}
diff --git a/wp-admin/css/widgets.css b/wp-admin/css/widgets.css
index baeb851..f21f22a 100644
--- a/wp-admin/css/widgets.css
+++ b/wp-admin/css/widgets.css
@@ -45,10 +45,20 @@ ul#widget-list li.widget-list-item {
margin: 0;
border-bottom-width: 1px;
border-bottom-style: solid;
- background-color: transparent;
line-height: 1;
}
+h4.widget-title span {
+ float: left;
+}
+
+h4.widget-title a {
+ float: right;
+ text-decoration: underline;
+ border-bottom: none;
+ margin-left: 1em;
+}
+
ul#widget-list li.widget-list-item h4.widget-title {
position: relative;
margin: 0;
@@ -59,7 +69,7 @@ ul#widget-list li.widget-list-item h4.widget-title {
-moz-border-radius: 3px;
-khtml-border-radius: 3px;
-webkit-border-radius: 3px;
- border-radius: 3px;;
+ border-radius: 3px;
}
#dragHelper h4.widget-title {
@@ -108,7 +118,7 @@ li.widget-sortable h4 {
margin: 0;
cursor: move;
font-size: 13px;
- padding: 0.4em 2.5em 0.4em 0.8em;
+ padding: 0.4em 0.8em;
position: relative;
-moz-border-radius: 3px;
-khtml-border-radius: 3px;
@@ -127,13 +137,6 @@ li.widget-sortable h4 {
text-decoration: none;
}
-h4.widget-title a {
- position: absolute;
- right: 1em;
- text-decoration: underline;
- border-bottom: none;
-}
-
li.widget-list-control-item h4.widget-title a,
#dragHelper li.widget-list-control-item h4.widget-title a,
#draghelper li.widget-list-control-item h4.widget-title a:visited {
@@ -150,7 +153,6 @@ li.widget-list-control-item div.widget-control {
padding: 15px;
font-size: 11px;
position: relative;
- background-color: #CFEBF7;
}
li.widget-list-control-item div.widget-control p {
diff --git a/wp-admin/custom-header.php b/wp-admin/custom-header.php
index c54d9a9..b1f583d 100644
--- a/wp-admin/custom-header.php
+++ b/wp-admin/custom-header.php
@@ -189,7 +189,7 @@ Event.observe( window, 'load', hide_text );
<div id="desc"><?php bloginfo('description');?></div>
</div>
<?php if ( !defined( 'NO_HEADER_TEXT' ) ) { ?>
-<form method="post" action="<?php echo get_option('siteurl') ?>/wp-admin/themes.php?page=custom-header&amp;updated=true">
+<form method="post" action="<?php echo admin_url('themes.php?page=custom-header&amp;updated=true') ?>">
<input type="button" value="<?php _e('Hide Text'); ?>" onclick="hide_text()" id="hidetext" />
<input type="button" value="<?php _e('Select a Text Color'); ?>" onclick="colorSelect($('textcolor'), 'pickcolor')" id="pickcolor" /><input type="button" value="<?php _e('Use Original Color'); ?>" onclick="colorDefault()" id="defaultcolor" />
<?php wp_nonce_field('custom-header') ?>
diff --git a/wp-admin/edit-category-form.php b/wp-admin/edit-category-form.php
index 6e32bda..a77d56e 100644
--- a/wp-admin/edit-category-form.php
+++ b/wp-admin/edit-category-form.php
@@ -26,7 +26,7 @@ if ( ! empty($cat_ID) ) {
<table class="form-table">
<tr class="form-field form-required">
<th scope="row" valign="top"><label for="cat_name"><?php _e('Category Name') ?></label></th>
- <td><input name="cat_name" id="cat_name" type="text" value="<?php echo attribute_escape($category->name); ?>" size="40" /><br />
+ <td><input name="cat_name" id="cat_name" type="text" value="<?php echo attribute_escape($category->name); ?>" size="40" aria-required="true" /><br />
<?php _e('The name is used to identify the category almost everywhere, for example under the post or in the category widget.'); ?></td>
</tr>
<tr class="form-field">
diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php
index c756efe..6bb04aa 100644
--- a/wp-admin/edit-comments.php
+++ b/wp-admin/edit-comments.php
@@ -12,8 +12,7 @@ if ( !empty( $_REQUEST['delete_comments'] ) ) {
$comments_deleted = $comments_approved = $comments_unapproved = $comments_spammed = 0;
foreach ($_REQUEST['delete_comments'] as $comment) : // Check the permissions on each
$comment = (int) $comment;
- $post_id = (int) $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = $comment");
- // $authordata = get_userdata( $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id") );
+ $post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment) );
if ( !current_user_can('edit_post', $post_id) )
continue;
if ( !empty( $_REQUEST['spamit'] ) ) {
@@ -117,6 +116,7 @@ unset($status_links);
</ul>
<p id="post-search">
+ <label class="hidden" for="post-search-input"><?php _e( 'Search Comments' ); ?>:</label>
<input type="text" id="post-search-input" name="s" value="<?php echo $search; ?>" />
<input type="submit" value="<?php _e( 'Search Comments' ); ?>" class="button" />
</p>
@@ -132,22 +132,24 @@ unset($status_links);
<?php
+$comments_per_page = apply_filters('comments_per_page', 20, $comment_status);
+
if ( isset( $_GET['apage'] ) )
$page = abs( (int) $_GET['apage'] );
else
$page = 1;
-$start = $offset = ( $page - 1 ) * 20;
+$start = $offset = ( $page - 1 ) * $comments_per_page;
-list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, 25 ); // Grab a few extra
+list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, $comments_per_page + 5 ); // Grab a few extra
-$comments = array_slice($_comments, 0, 20);
-$extra_comments = array_slice($_comments, 20);
+$comments = array_slice($_comments, 0, $comments_per_page);
+$extra_comments = array_slice($_comments, $comments_per_page);
$page_links = paginate_links( array(
'base' => add_query_arg( 'apage', '%#%' ),
'format' => '',
- 'total' => ceil($total / 20),
+ 'total' => ceil($total / $comments_per_page),
'current' => $page
));
@@ -186,7 +188,7 @@ if ($comments) {
<table class="widefat">
<thead>
<tr>
- <th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('comments-form'));" /></th>
+ <th scope="col" class="check-column"><input type="checkbox" /></th>
<th scope="col"><?php _e('Comment') ?></th>
<th scope="col"><?php _e('Date') ?></th>
<th scope="col" class="action-links"><?php _e('Actions') ?></th>
diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php
index 7d1ff7d..e87945e 100644
--- a/wp-admin/edit-form-advanced.php
+++ b/wp-admin/edit-form-advanced.php
@@ -1,12 +1,35 @@
<?php
-$action = isset($action)? $action : '';
+
+$action = isset($action) ? $action : '';
if ( isset($_GET['message']) )
$_GET['message'] = absint( $_GET['message'] );
$messages[1] = sprintf( __( 'Post updated. Continue editing below or <a href="%s">go back</a>.' ), attribute_escape( stripslashes( $_GET['_wp_original_http_referer'] ) ) );
$messages[2] = __('Custom field updated.');
$messages[3] = __('Custom field deleted.');
$messages[4] = __('Post updated.');
+$messages[5] = sprintf( __('Post restored to revision from %s'), wp_post_revision_title( $_GET['revision'], false ) );
+
+$notice = false;
+$notices[1] = __( 'There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>.' );
+
+if ( !isset($post_ID) || 0 == $post_ID ) {
+ $form_action = 'post';
+ $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post()
+ $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
+ $autosave = false;
+} else {
+ $post_ID = (int) $post_ID;
+ $form_action = 'editpost';
+ $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
+ $autosave = wp_get_post_autosave( $post_id );
+ if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) )
+ $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) );
+}
+
?>
+<?php if ( $notice ) : ?>
+<div id="notice" class="error"><p><?php echo $notice ?></p></div>
+<?php endif; ?>
<?php if (isset($_GET['message'])) : ?>
<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
<?php endif; ?>
@@ -20,33 +43,15 @@ $messages[4] = __('Post updated.');
<h2><?php _e('Write Post') ?></h2>
<?php
-if (!isset($post_ID) || 0 == $post_ID) {
- $form_action = 'post';
- $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post()
- $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
+if ( !isset($post_ID) || 0 == $post_ID)
wp_nonce_field('add-post');
-} else {
- $post_ID = (int) $post_ID;
- $form_action = 'editpost';
- $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
+else
wp_nonce_field('update-post_' . $post_ID);
-}
$form_pingback = '<input type="hidden" name="post_pingback" value="' . (int) get_option('default_pingback_flag') . '" id="post_pingback" />';
$form_prevstatus = '<input type="hidden" name="prev_status" value="' . attribute_escape( $post->post_status ) . '" />';
-$form_trackback = '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. attribute_escape( str_replace("\n", ' ', $post->to_ping) ) .'" />';
-
-if ('' != $post->pinged) {
- $pings = '<p>'. __('Already pinged:') . '</p><ul>';
- $already_pinged = explode("\n", trim($post->pinged));
- foreach ($already_pinged as $pinged_url) {
- $pings .= "\n\t<li>" . wp_specialchars($pinged_url) . "</li>";
- }
- $pings .= '</ul>';
-}
-
$saveasdraft = '<input name="save" type="submit" id="save" class="button" tabindex="3" value="' . attribute_escape( __('Save and Continue Editing') ) . '" />';
?>
@@ -83,10 +88,13 @@ else
<div class="inside">
-<p><strong><?php _e('Publish Status') ?></strong></p>
+<p><strong><label for='post_status'><?php _e('Publish Status') ?></label></strong></p>
<p>
-<select name='post_status' tabindex='4'>
-<?php if ( current_user_can('publish_posts') ) : // Contributors only get "Unpublished" and "Pending Review" ?>
+<select name='post_status' id='post_status' tabindex='4'>
+<?php
+// only show the publish menu item if they are allowed to publish posts or they are allowed to edit this post (accounts for 'edit_published_posts' capability)
+if ( current_user_can('publish_posts') OR ( $post->post_status == 'publish' AND current_user_can('edit_post', $post->ID) ) ) :
+?>
<option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'><?php _e('Published') ?></option>
<?php if ( 'future' == $post->post_status ) : ?>
<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
@@ -156,6 +164,7 @@ if ( ( 'edit' == $action) && current_user_can('delete_post', $post_ID) )
<br class="clear" />
<?php endif; ?>
<span id="autosave"></span>
+<span id="wp-word-count"></span>
</p>
<div class="side-info">
@@ -172,6 +181,9 @@ if ( ( 'edit' == $action) && current_user_can('delete_post', $post_ID) )
<li><a href="edit.php?post_status=draft"><?php _e('View Drafts'); ?></a></li>
<?php do_action('post_relatedlinks_list'); ?>
</ul>
+
+<h5><?php _e('Shortcuts') ?></h5>
+<p><?php _e('Drag-and-drop the following link to your bookmarks bar or right click it and add it to your favorites for a posting shortcut.') ?> <a href="<?php echo get_shortcut_link(); ?>" title="<?php echo attribute_escape(__('Press This')) ?>"><?php _e('Press This') ?></a></p>
</div>
<?php do_action('submitpost_box'); ?>
@@ -179,7 +191,7 @@ if ( ( 'edit' == $action) && current_user_can('delete_post', $post_ID) )
<div id="post-body">
<div id="titlediv">
-<h3><?php _e('Title') ?></h3>
+<h3><label for="title"><?php _e('Title') ?></label></h3>
<div id="titlewrap">
<input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape($post->post_title); ?>" id="title" autocomplete="off" />
</div>
@@ -194,7 +206,7 @@ endif; ?>
</div>
<div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
-<h3><?php _e('Post') ?></h3>
+<h3><label for="content"><?php _e('Post') ?></label></h3>
<?php the_editor($post->post_content); ?>
<?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?>
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
@@ -205,23 +217,22 @@ endif; ?>
<?php echo $form_pingback ?>
<?php echo $form_prevstatus ?>
-<div id="tagsdiv" class="postbox <?php echo postbox_classes('tagsdiv', 'post'); ?>">
-<h3><?php _e('Tags'); ?></h3>
-<div class="inside">
-<p id="jaxtag"><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post_ID ); ?>" /></p>
+<?php
+function post_tags_meta_box($post) {
+?>
+<p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /></p>
<div id="tagchecklist"></div>
-</div>
-</div>
-
-<div id="categorydiv" class="postbox <?php echo postbox_classes('categorydiv', 'post'); ?>">
-<h3><?php _e('Categories') ?></h3>
-<div class="inside">
+<?php
+}
+add_meta_box('tagsdiv', __('Tags'), 'post_tags_meta_box', 'post', 'normal', 'core');
+function post_categories_meta_box($post) {
+?>
<div id="category-adder" class="wp-hidden-children">
<h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
<p id="category-add" class="wp-hidden-child">
- <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" />
- <?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>
+ <label class="hidden" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" aria-required="true"/>
+ <label class="hidden" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>
<input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php _e( 'Add' ); ?>" tabindex="3" />
<?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?>
<span id="category-ajax-response"></span>
@@ -244,9 +255,10 @@ endif; ?>
<?php wp_category_checklist($post->ID, false, false, $popular_ids) ?>
</ul>
</div>
-
-</div>
-</div>
+<?php
+}
+add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post', 'normal', 'core');
+?>
<?php do_meta_boxes('post', 'normal', $post); ?>
@@ -254,32 +266,41 @@ endif; ?>
<h2><?php _e('Advanced Options'); ?></h2>
-<div id="postexcerpt" class="postbox <?php echo postbox_classes('postexcerpt', 'post'); ?>">
-<h3><?php _e('Excerpt') ?></h3>
-<div class="inside"><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea>
+<?php
+function post_excerpt_meta_box($post) {
+?>
+<label class="hidden" for="excerpt"><?php _e('Excerpt') ?></label><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea>
<p><?php _e('Excerpts are optional hand-crafted summaries of your content. You can <a href="http://codex.wordpress.org/Template_Tags/the_excerpt" target="_blank">use them in your template</a>'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'advanced', 'core');
+
+function post_trackback_meta_box($post) {
+ $form_trackback = '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. attribute_escape( str_replace("\n", ' ', $post->to_ping) ) .'" />';
+ if ('' != $post->pinged) {
+ $pings = '<p>'. __('Already pinged:') . '</p><ul>';
+ $already_pinged = explode("\n", trim($post->pinged));
+ foreach ($already_pinged as $pinged_url) {
+ $pings .= "\n\t<li>" . wp_specialchars($pinged_url) . "</li>";
+ }
+ $pings .= '</ul>';
+ }
-<div id="trackbacksdiv" class="postbox <?php echo postbox_classes('trackbacksdiv', 'post'); ?>">
-<h3><?php _e('Trackbacks') ?></h3>
-<div class="inside">
-<p><?php _e('Send trackbacks to:'); ?> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p>
+?>
+<p><label for="trackback"><?php _e('Send trackbacks to:'); ?></label> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p>
<p><?php _e('Trackbacks are a way to notify legacy blog systems that you&#8217;ve linked to them. If you link other WordPress blogs they&#8217;ll be notified automatically using <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">pingbacks</a>, no other action necessary.'); ?></p>
<?php
if ( ! empty($pings) )
echo $pings;
-?>
-</div>
-</div>
+}
+add_meta_box('trackbacksdiv', __('Trackbacks'), 'post_trackback_meta_box', 'post', 'advanced', 'core');
-<div id="postcustom" class="postbox <?php echo postbox_classes('postcustom', 'post'); ?>">
-<h3><?php _e('Custom Fields') ?></h3>
-<div class="inside">
+function post_custom_meta_box($post) {
+?>
<div id="postcustomstuff">
<table cellpadding="3">
<?php
-$metadata = has_meta($post_ID);
+$metadata = has_meta($post->ID);
list_meta($metadata);
?>
@@ -290,55 +311,66 @@ list_meta($metadata);
<div id="ajax-response"></div>
</div>
<p><?php _e('Custom fields can be used to add extra metadata to a post that you can <a href="http://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', 'post', 'advanced', 'core');
-<?php do_action('dbx_post_advanced'); ?>
+do_action('dbx_post_advanced');
-<div id="commentstatusdiv" class="postbox <?php echo postbox_classes('commentstatusdiv', 'post'); ?>">
-<h3><?php _e('Comments &amp; Pings') ?></h3>
-<div class="inside">
+function post_comment_status_meta_box($post) {
+?>
<input name="advanced_view" type="hidden" value="1" />
<p><label for="comment_status" class="selectit">
<input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> />
<?php _e('Allow Comments') ?></label></p>
<p><label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label></p>
<p><?php _e('These settings apply to this post only. &#8220;Pings&#8221; are <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">trackbacks and pingbacks</a>.'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('commentstatusdiv', __('Comments &amp; Pings'), 'post_comment_status_meta_box', 'post', 'advanced', 'core');
-<div id="passworddiv" class="postbox <?php echo postbox_classes('passworddiv', 'post'); ?>">
-<h3><?php _e('Password Protect This Post') ?></h3>
-<div class="inside">
-<p><input name="post_password" type="text" size="25" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /></p>
+function post_password_meta_box($post) {
+?>
+<p><label class="hidden" for="post_password"><?php _e('Password Protect This Post') ?></label><input name="post_password" type="text" size="25" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /></p>
<p><?php _e('Setting a password will require people who visit your blog to enter the above password to view this post and its comments.'); ?></p>
-</div>
-</div>
-
-<div id="slugdiv" class="postbox <?php echo postbox_classes('slugdiv', 'post'); ?>">
-<h3><?php _e('Post Slug') ?></h3>
-<div class="inside">
-<input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" />
-</div>
-</div>
+<?php
+}
+add_meta_box('passworddiv', __('Password Protect This Post'), 'post_password_meta_box', 'post', 'advanced', 'core');
+function post_slug_meta_box($post) {
+?>
+<label class="hidden" for="post_name"><?php _e('Post Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" />
<?php
+}
+add_meta_box('slugdiv', __('Post Slug'), 'post_slug_meta_box', 'post', 'advanced', 'core');
+
$authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
if ( $post->post_author && !in_array($post->post_author, $authors) )
$authors[] = $post->post_author;
if ( $authors && count( $authors ) > 1 ) :
+function post_author_meta_box($post) {
+ global $current_user, $user_ID;
+ $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
+ if ( $post->post_author && !in_array($post->post_author, $authors) )
+ $authors[] = $post->post_author;
?>
-<div id="authordiv" class="postbox <?php echo postbox_classes('authordiv', 'post'); ?>">
-<h3><?php _e('Post Author'); ?></h3>
-<div class="inside">
-<?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post_ID) ? $user_ID : $post->post_author) ); ?>
-</div>
-</div>
-<?php endif; ?>
+<label class="hidden" for="post_author_override"><?php _e('Post Author'); ?></label><?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author) ); ?>
+<?php
+}
+add_meta_box('authordiv', __('Post Author'), 'post_author_meta_box', 'post', 'advanced', 'core');
+endif;
-<?php do_meta_boxes('post', 'advanced', $post); ?>
+if ( isset($post_ID) && 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) :
+function post_revisions_meta_box($post) {
+ wp_list_post_revisions();
+}
+add_meta_box('revisionsdiv', __('Post Revisions'), 'post_revisions_meta_box', 'post', 'advanced', 'core');
+endif;
-<?php do_action('dbx_post_sidebar'); ?>
+do_meta_boxes('post', 'advanced', $post);
+
+do_action('dbx_post_sidebar');
+?>
</div>
</div>
diff --git a/wp-admin/edit-form-comment.php b/wp-admin/edit-form-comment.php
index dfef0a7..601f4cb 100644
--- a/wp-admin/edit-form-comment.php
+++ b/wp-admin/edit-form-comment.php
@@ -22,9 +22,9 @@ $form_extra = "' />\n<input type='hidden' name='comment_ID' value='" . $comment-
<div class="inside">
-<p><strong><?php _e('Approval Status') ?></strong></p>
+<p><strong><label for='comment_status'><?php _e('Approval Status') ?></label></strong></p>
<p>
-<select name='comment_status'>
+<select name='comment_status' id='comment_status'>
<option<?php selected( $comment->comment_approved, '1' ); ?> value='1'><?php _e('Approved') ?></option>
<option<?php selected( $comment->comment_approved, '0' ); ?> value='0'><?php _e('Moderated') ?></option>
<option<?php selected( $comment->comment_approved, 'spam' ); ?> value='spam'><?php _e('Spam') ?></option>
@@ -64,28 +64,28 @@ echo "<a class='submitdelete' href='" . wp_nonce_url("comment.php?action=deletec
<div id="post-body">
<div id="namediv" class="stuffbox">
-<h3><?php _e('Name') ?></h3>
+<h3><label for="name"><?php _e('Name') ?></label></h3>
<div class="inside">
<input type="text" name="newcomment_author" size="30" value="<?php echo attribute_escape( $comment->comment_author ); ?>" tabindex="1" id="name" />
</div>
</div>
<div id="emaildiv" class="stuffbox">
-<h3><?php _e('E-mail') ?></h3>
+<h3><label for="email"><?php _e('E-mail') ?></label></h3>
<div class="inside">
<input type="text" name="newcomment_author_email" size="30" value="<?php echo attribute_escape( $comment->comment_author_email ); ?>" tabindex="2" id="email" />
</div>
</div>
<div id="uridiv" class="stuffbox">
-<h3><?php _e('URL') ?></h3>
+<h3><label for="newcomment_author_url"><?php _e('URL') ?></label></h3>
<div class="inside">
<input type="text" id="newcomment_author_url" name="newcomment_author_url" size="30" value="<?php echo attribute_escape( $comment->comment_author_url ); ?>" tabindex="3" />
</div>
</div>
<div id="postdiv" class="postarea">
-<h3><?php _e('Comment') ?></h3>
+<h3><label for="content"><?php _e('Comment') ?></label></h3>
<?php the_editor($comment->comment_content, 'content', 'newcomment_author_url', false, 4); ?>
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
</div>
diff --git a/wp-admin/edit-link-categories.php b/wp-admin/edit-link-categories.php
index b8dfebc..da5b415 100644
--- a/wp-admin/edit-link-categories.php
+++ b/wp-admin/edit-link-categories.php
@@ -62,6 +62,7 @@ endif; ?>
<?php endif; ?>
<p id="post-search">
+ <label class="hidden" for="post-search-input"><?php _e( 'Search Categories' ); ?>:</label>
<input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
<input type="submit" value="<?php _e( 'Search Categories' ); ?>" class="button" />
</p>
@@ -101,7 +102,7 @@ if ( $page_links )
<table class="widefat">
<thead>
<tr>
- <th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /></th>
+ <th scope="col" class="check-column"><input type="checkbox" /></th>
<th scope="col"><?php _e('Name') ?></th>
<th scope="col"><?php _e('Description') ?></th>
<th scope="col" class="num" style="width: 90px;"><?php _e('Links') ?></th>
diff --git a/wp-admin/edit-link-category-form.php b/wp-admin/edit-link-category-form.php
index 517f574..f55a4c0 100644
--- a/wp-admin/edit-link-category-form.php
+++ b/wp-admin/edit-link-category-form.php
@@ -26,7 +26,7 @@ if ( ! empty($cat_ID) ) {
<table class="form-table">
<tr class="form-field form-required">
<th scope="row" valign="top"><label for="name"><?php _e('Category name') ?></label></th>
- <td><input name="name" id="name" type="text" value="<?php echo $category->name; ?>" size="40" /></td>
+ <td><input name="name" id="name" type="text" value="<?php echo $category->name; ?>" size="40" aria-required="true" /></td>
</tr>
<tr class="form-field">
<th scope="row" valign="top"><label for="description"><?php _e('Description (optional)') ?></label></th>
diff --git a/wp-admin/edit-link-form.php b/wp-admin/edit-link-form.php
index 15c3fb5..48b95cc 100644
--- a/wp-admin/edit-link-form.php
+++ b/wp-admin/edit-link-form.php
@@ -74,7 +74,7 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
<div id="post-body">
<div id="namediv" class="stuffbox">
-<h3><?php _e('Name') ?></h3>
+<h3><label for="link_name"><?php _e('Name') ?></label></h3>
<div class="inside">
<input type="text" name="link_name" size="30" tabindex="1" value="<?php echo $link->link_name; ?>" id="link_name" /><br />
<?php _e('Example: Nifty blogging software'); ?>
@@ -82,7 +82,7 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
</div>
<div id="addressdiv" class="stuffbox">
-<h3><?php _e('Web Address') ?></h3>
+<h3><label for="link_url"><?php _e('Web Address') ?></label></h3>
<div class="inside">
<input type="text" name="link_url" size="30" tabindex="1" value="<?php echo $link->link_url; ?>" id="link_url" /><br />
<?php _e('Example: <code>http://wordpress.org/</code> &#8212; don&#8217;t forget the <code>http://</code>'); ?>
@@ -90,21 +90,19 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
</div>
<div id="descriptiondiv" class="stuffbox">
-<h3><?php _e('Description') ?></h3>
+<h3><label for="link_description"><?php _e('Description') ?></label></h3>
<div class="inside">
<input type="text" name="link_description" size="30" tabindex="1" value="<?php echo $link->link_description; ?>" id="link_description" /><br />
<?php _e('This will be shown when someone hovers over the link in the blogroll, or optionally below the link.'); ?>
</div>
</div>
-<div id="linkcategorydiv" class="postbox <?php echo postbox_classes('linkcategorydiv', 'link'); ?>">
-<h3><?php _e('Categories') ?></h3>
-<div class="inside">
-
+<?php function link_categories_meta_box($link) { ?>
<div id="category-adder" class="wp-hidden-children">
<h4><a id="category-add-toggle" href="#category-add"><?php _e( '+ Add New Category' ); ?></a></h4>
<p id="link-category-add" class="wp-hidden-child">
- <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" />
+ <label class="hidden" for="newcat"><?php _e( '+ Add New Category' ); ?></label>
+ <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" aria-required="true" />
<input type="button" id="category-add-sumbit" class="add:categorychecklist:linkcategorydiv button" value="<?php _e( 'Add' ); ?>" />
<?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>
<span id="category-ajax-response"></span>
@@ -118,7 +116,7 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
<div id="categories-all" class="ui-tabs-panel">
<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
- <?php wp_link_category_checklist($link_id); ?>
+ <?php wp_link_category_checklist($link->link_id); ?>
</ul>
</div>
@@ -127,17 +125,17 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
<?php wp_popular_terms_checklist('link_category'); ?>
</ul>
</div>
-
-</div>
-</div>
+<?php
+}
+add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', 'link', 'normal', 'core');
+?>
<?php do_meta_boxes('link', 'normal', $link); ?>
<h2><?php _e('Advanced Options'); ?></h2>
-<div id="linktargetdiv" class="postbox <?php echo postbox_classes('linktargetdiv', 'link'); ?>">
-<h3><?php _e('Target') ?></h3>
-<div class="inside">
+<?php function link_target_meta_box($link) { ?>
+<fieldset><legend class="hidden"><?php _e('Target') ?></legend>
<label for="link_target_blank" class="selectit">
<input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo(($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
<code>_blank</code></label><br />
@@ -147,16 +145,17 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
<label for="link_target_none" class="selectit">
<input id="link_target_none" type="radio" name="link_target" value="" <?php echo(($link->link_target == '') ? 'checked="checked"' : ''); ?> />
<?php _e('none') ?></label>
+</fieldset>
<p><?php _e('Choose the frame your link targets. Essentially this means if you choose <code>_blank</code> your link will open in a new window.'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('linktargetdiv', __('Target'), 'link_target_meta_box', 'link', 'advanced', 'core');
-<div id="linkxfndiv" class="postbox <?php echo postbox_classes('linkxfndiv', 'link'); ?>">
-<h3><?php _e('Link Relationship (XFN)') ?></h3>
-<div class="inside">
+function link_xfn_meta_box($link) {
+?>
<table class="editform" style="width: 100%;" cellspacing="2" cellpadding="5">
<tr>
- <th style="width: 20%;" scope="row"><?php _e('rel:') ?></th>
+ <th style="width: 20%;" scope="row"><label for="link_rel"><?php _e('rel:') ?></label></th>
<td style="width: 80%;"><input type="text" name="link_rel" id="link_rel" size="50" value="<?php echo $link->link_rel; ?>" /></td>
</tr>
<tr>
@@ -164,15 +163,15 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
<table cellpadding="3" cellspacing="5" class="form-table">
<tr>
<th scope="row"> <?php _e('identity') ?> </th>
- <td>
+ <td><fieldset><legend class="hidden"> <?php _e('identity') ?> </legend>
<label for="me">
<input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />
<?php _e('another web address of mine') ?></label>
- </td>
+ </fieldset></td>
</tr>
<tr>
<th scope="row"> <?php _e('friendship') ?> </th>
- <td>
+ <td><fieldset><legend class="hidden"> <?php _e('friendship') ?> </legend>
<label for="contact">
<input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php _e('contact') ?></label>
<label for="acquaintance">
@@ -181,30 +180,30 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
<input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php _e('friend') ?></label>
<label for="friendship">
<input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship', '', 'radio'); ?> /> <?php _e('none') ?></label>
- </td>
+ </fieldset></td>
</tr>
<tr>
<th scope="row"> <?php _e('physical') ?> </th>
- <td>
+ <td><fieldset><legend class="hidden"> <?php _e('physical') ?> </legend>
<label for="met">
<input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> />
<?php _e('met') ?></label>
- </td>
+ </fieldset></td>
</tr>
<tr>
<th scope="row"> <?php _e('professional') ?> </th>
- <td>
+ <td><fieldset><legend class="hidden"> <?php _e('professional') ?> </legend>
<label for="co-worker">
<input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check('professional', 'co-worker'); ?> />
<?php _e('co-worker') ?></label>
<label for="colleague">
<input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check('professional', 'colleague'); ?> />
<?php _e('colleague') ?></label>
- </td>
+ </fieldset></td>
</tr>
<tr>
<th scope="row"> <?php _e('geographical') ?> </th>
- <td>
+ <td><fieldset><legend class="hidden"> <?php _e('geographical') ?> </legend>
<label for="co-resident">
<input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident', 'radio'); ?> />
<?php _e('co-resident') ?></label>
@@ -214,11 +213,11 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
<label for="geographical">
<input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical', '', 'radio'); ?> />
<?php _e('none') ?></label>
- </td>
+ </fieldset></td>
</tr>
<tr>
<th scope="row"> <?php _e('family') ?> </th>
- <td>
+ <td><fieldset><legend class="hidden"> <?php _e('family') ?> </legend>
<label for="child">
<input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?> />
<?php _e('child') ?></label>
@@ -237,11 +236,11 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
<label for="family">
<input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> />
<?php _e('none') ?></label>
- </td>
+ </fieldset></td>
</tr>
<tr>
<th scope="row"> <?php _e('romantic') ?> </th>
- <td>
+ <td><fieldset><legend class="hidden"> <?php _e('romantic') ?> </legend>
<label for="muse">
<input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> />
<?php _e('muse') ?></label>
@@ -254,19 +253,19 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
<label for="romantic">
<input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> />
<?php _e('sweetheart') ?></label>
- </td>
+ </fieldset></td>
</tr>
</table>
</td>
</tr>
</table>
<p><?php _e('If the link is to a person, you can specify your relationship with them using the above form. If you would like to learn more about the idea check out <a href="http://gmpg.org/xfn/">XFN</a>.'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('linkxfndiv', __('Link Relationship (XFN)'), 'link_xfn_meta_box', 'link', 'advanced', 'core');
-<div id="linkadvanceddiv" class="postbox <?php echo postbox_classes('linkadvanceddiv', 'link'); ?>">
-<h3><?php _e('Advanced') ?></h3>
-<div class="inside">
+function link_advanced_meta_box($link) {
+?>
<table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5">
<tr class="form-field">
<th valign="top" scope="row"><label for="link_image"><?php _e('Image Address') ?></label></th>
@@ -294,12 +293,13 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
</td>
</tr>
</table>
-</div>
-</div>
+<?php
+}
+add_meta_box('linkadvanceddiv', __('Advanced'), 'link_advanced_meta_box', 'link', 'advanced', 'core');
-<?php do_meta_boxes('link', 'advanced', $link); ?>
+do_meta_boxes('link', 'advanced', $link);
-<?php if ( $link_id ) : ?>
+if ( $link_id ) : ?>
<input type="hidden" name="action" value="save" />
<input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" />
<input type="hidden" name="order_by" value="<?php echo attribute_escape($order_by); ?>" />
diff --git a/wp-admin/edit-page-form.php b/wp-admin/edit-page-form.php
index e800a46..89ac2b2 100644
--- a/wp-admin/edit-page-form.php
+++ b/wp-admin/edit-page-form.php
@@ -5,10 +5,9 @@ $messages[1] = sprintf( __( 'Page updated. Continue editing below or <a href="%s
$messages[2] = __('Custom field updated.');
$messages[3] = __('Custom field deleted.');
$messages[4] = __('Page updated.');
-?>
-<?php if (isset($_GET['message'])) : ?>
-<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
-<?php endif;
+
+$notice = false;
+$notices[1] = __( 'There is an autosave of this page that is more recent than the version below. <a href="%s">View the autosave</a>.' );
if (!isset($post_ID) || 0 == $post_ID) {
$form_action = 'post';
@@ -20,6 +19,9 @@ if (!isset($post_ID) || 0 == $post_ID) {
$form_action = 'editpost';
$nonce_action = 'update-page_' . $post_ID;
$form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
+ $autosave = wp_get_post_autosave( $post_id );
+ if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) )
+ $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) );
}
$temp_ID = (int) $temp_ID;
@@ -31,6 +33,13 @@ if ( 0 != $post_ID && $sendto == get_permalink($post_ID) )
$sendto = 'redo';
?>
+<?php if ( $notice ) : ?>
+<div id="notice" class="error"><p><?php echo $notice ?></p></div>
+<?php endif; ?>
+<?php if (isset($_GET['message'])) : ?>
+<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
+<?php endif; ?>
+
<form name="post" action="page.php" method="post" id="post">
<div class="wrap">
<h2><?php _e('Write Page') ?></h2>
@@ -44,6 +53,7 @@ if (isset($mode) && 'bookmarklet' == $mode)
<input type="hidden" id="user-id" name="user_ID" value="<?php echo $user_ID ?>" />
<input type="hidden" id="hiddenaction" name="action" value='<?php echo $form_action ?>' />
<input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" />
+<input type="hidden" id="post_author" name="post_author" value="<?php echo attribute_escape( $post->post_author ); ?>" />
<?php echo $form_extra ?>
<input type="hidden" id="post_type" name="post_type" value="<?php echo $post->post_type ?>" />
<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo $post->post_status ?>" />
@@ -68,14 +78,14 @@ else
</div>
<div class="inside">
-
-<p><strong><?php _e('Publish Status') ?></strong></p>
+<p><strong><label for='post_status'><?php _e('Publish Status') ?></label></strong></p>
<p>
-<select name='post_status' tabindex='4'>
-<?php if ( current_user_can('publish_pages') ) : ?>
+<select name='post_status' tabindex='4' id='post_status'>
+<?php // Show publish in dropdown if user can publish or if they can re-publish this page ('edit_published_pages')
+// 'publish' option will be selected for published AND private posts (checkbox overrides dropdown)
+if ( current_user_can('publish_pages') OR ( $post->post_status == 'publish' AND current_user_can('edit_page', $post->ID) ) ) :
+?>
<option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'><?php _e('Published') ?></option>
-<?php else: ?>
-<option<?php selected( $post->post_status, 'private' ); ?> value='private'><?php _e('Published') ?></option>
<?php endif; ?>
<?php if ( 'future' == $post->post_status ) : ?>
<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Pending') ?></option>
@@ -84,8 +94,10 @@ else
<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Unpublished') ?></option>
</select>
</p>
-
+<?php if ( current_user_can( 'publish_posts' ) ) : ?>
<p><label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex='4' /> <?php _e('Keep this page private') ?></label></p>
+<?php endif; ?>
+
<?php
if ($post_ID) {
if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
@@ -140,6 +152,7 @@ if ( ('edit' == $action) && current_user_can('delete_page', $post_ID) )
<br class="clear" />
<?php endif; ?>
<span id="autosave"></span>
+<span id="wp-word-count"></span>
</p>
<div class="side-info">
@@ -159,7 +172,7 @@ if ( ('edit' == $action) && current_user_can('delete_page', $post_ID) )
<div id="post-body">
<div id="titlediv">
-<h3><?php _e('Title') ?></h3>
+<h3><label for="title"><?php _e('Title') ?></label></h3>
<div id="titlewrap">
<input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape( $post->post_title ); ?>" id="title" autocomplete="off" />
</div>
@@ -174,7 +187,7 @@ endif; ?>
</div>
<div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
-<h3><?php _e('Page') ?></h3>
+<h3><label for="content"><?php _e('Page') ?></label></h3>
<?php the_editor($post->post_content); ?>
<?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?>
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
@@ -188,13 +201,14 @@ endif; ?>
<h2><?php _e('Advanced Options'); ?></h2>
-<div id="pagepostcustom" class="postbox <?php echo postbox_classes('pagepostcustom', 'page'); ?>">
-<h3><?php _e('Custom Fields') ?></h3>
-<div class="inside">
+
+<?php
+function page_custom_meta_box($post){
+?>
<div id="postcustomstuff">
<table cellpadding="3">
<?php
-$metadata = has_meta($post_ID);
+$metadata = has_meta($post->ID);
list_meta($metadata);
?>
@@ -205,83 +219,97 @@ list_meta($metadata);
<div id="ajax-response"></div>
</div>
<p><?php _e('Custom fields can be used to add extra metadata to a post that you can <a href="http://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('pagecustomdiv', __('Custom Fields'), 'page_custom_meta_box', 'page', 'advanced', 'core');
-<div id="pagecommentstatusdiv" class="postbox <?php echo postbox_classes('pagecommentstatusdiv', 'page'); ?>">
-<h3><?php _e('Comments &amp; Pings') ?></h3>
-<div class="inside">
+function page_comments_status_meta_box($post){
+?>
<input name="advanced_view" type="hidden" value="1" />
<p><label for="comment_status" class="selectit">
<input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> />
<?php _e('Allow Comments') ?></label></p>
<p><label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label></p>
<p><?php _e('These settings apply to this page only. &#8220;Pings&#8221; are <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">trackbacks and pingbacks</a>.'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('pagecommentstatusdiv', __('Comments &amp; Pings'), 'page_comments_status_meta_box', 'page', 'advanced', 'core');
-<div id="pagepassworddiv" class="postbox <?php echo postbox_classes('pagepassworddiv', 'page'); ?>">
-<h3><?php _e('Password Protect This Page') ?></h3>
-<div class="inside">
-<p><input name="post_password" type="text" size="25" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /></p>
+function page_password_meta_box($post){
+?>
+<p><label class="hidden" for="post_password"><?php _e('Password Protect This Page') ?></label><input name="post_password" type="text" size="25" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /></p>
<p><?php _e('Setting a password will require people who visit your blog to enter the above password to view this page and its comments.'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('pagepassworddiv', __('Password Protect This Page'), 'page_password_meta_box', 'page', 'advanced', 'core');
-<div id="pageslugdiv" class="postbox <?php echo postbox_classes('pageslugdiv', 'page'); ?>">
-<h3><?php _e('Page Slug') ?></h3>
-<div class="inside">
-<input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" />
-</div>
-</div>
+function page_slug_meta_box($post){
+?>
+<label class="hidden" for="post_name"><?php _e('Page Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" />
+<?php
+}
+add_meta_box('pageslugdiv', __('Page Slug'), 'page_slug_meta_box', 'page', 'advanced', 'core');
-<div id="pageparentdiv" class="postbox <?php echo postbox_classes('pageparentdiv', 'page'); ?>">
-<h3><?php _e('Page Parent') ?></h3>
-<div class="inside">
-<select name="parent_id">
+function page_parent_meta_box($post){
+?>
+<label class="hidden" for="parent_id"><?php _e('Page Parent') ?></label>
+<select name="parent_id" id="parent_id">
<option value='0'><?php _e('Main Page (no parent)'); ?></option>
<?php parent_dropdown($post->post_parent); ?>
</select>
<p><?php _e('You can arrange your pages in hierarchies, for example you could have an &#8220;About&#8221; page that has &#8220;Life Story&#8221; and &#8220;My Dog&#8221; pages under it. There are no limits to how deeply nested you can make pages.'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('pageparentdiv', __('Page Parent'), 'page_parent_meta_box', 'page', 'advanced', 'core');
-<?php if ( 0 != count( get_page_templates() ) ) { ?>
-<div id="pagetemplatediv" class="postbox <?php echo postbox_classes('pagetemplatediv', 'page'); ?>">
-<h3><?php _e('Page Template') ?></h3>
-<div class="inside">
-<select name="page_template">
+if ( 0 != count( get_page_templates() ) ) {
+ function page_template_meta_box($post){
+?>
+<label class="hidden" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template">
<option value='default'><?php _e('Default Template'); ?></option>
<?php page_template_dropdown($post->page_template); ?>
</select>
<p><?php _e('Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you&#8217;ll see them above.'); ?></p>
-</div>
-</div>
-<?php } ?>
+<?php
+ }
+ add_meta_box('pagetemplatediv', __('Page Template'), 'page_template_meta_box', 'page', 'advanced', 'core');
+}
-<div id="pageorderdiv" class="postbox <?php echo postbox_classes('pageorderdiv', 'page'); ?>">
-<h3><?php _e('Page Order') ?></h3>
-<div class="inside">
-<p><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo $post->menu_order ?>" /></p>
+function page_order_meta_box($post){
+?>
+<p><label class="hidden" for="menu_order"><?php _e('Page Order') ?></label><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo $post->menu_order ?>" /></p>
<p><?php _e('Pages are usually ordered alphabetically, but you can put a number above to change the order pages appear in. (We know this is a little janky, it&#8217;ll be better in future releases.)'); ?></p>
-</div>
-</div>
-
<?php
+}
+add_meta_box('pageorderdiv', __('Page Order'), 'page_order_meta_box', 'page', 'advanced', 'core');
+
+
$authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
if ( $post->post_author && !in_array($post->post_author, $authors) )
$authors[] = $post->post_author;
-if ( $authors && count( $authors ) > 1 ) :
+if ( $authors && count( $authors ) > 1 ) {
+ function page_author_meta_box($post){
+ global $current_user, $user_ID;
+ $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
+ if ( $post->post_author && !in_array($post->post_author, $authors) )
+ $authors[] = $post->post_author;
?>
-<div id="pageauthordiv" class="postbox <?php echo postbox_classes('pageauthordiv', 'page'); ?>">
-<h3><?php _e('Page Author'); ?></h3>
-<div class="inside">
-<?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post_ID) ? $user_ID : $post->post_author) ); ?>
-</div>
-</div>
-<?php endif; ?>
+<label class="hidden" for="post_author_override"><?php _e('Page Author'); ?></label><?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author) ); ?>
+<?php
+ }
+ add_meta_box('pageauthordiv', __('Page Author'), 'page_author_meta_box', 'page', 'advanced', 'core');
+}
-<?php do_meta_boxes('page', 'advanced', $post); ?>
+
+if ( isset($post_ID) && 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) :
+function page_revisions_meta_box($post) {
+ wp_list_post_revisions();
+}
+add_meta_box('revisionsdiv', __('Page Revisions'), 'page_revisions_meta_box', 'page', 'advanced', 'core');
+endif;
+
+do_meta_boxes('page', 'advanced', $post);
+?>
</div>
</div>
diff --git a/wp-admin/edit-pages.php b/wp-admin/edit-pages.php
index ee4bee2..0f93d97 100644
--- a/wp-admin/edit-pages.php
+++ b/wp-admin/edit-pages.php
@@ -20,8 +20,8 @@ if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) {
}
$sendback = wp_get_referer();
- if (strpos($sendback, 'page.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/page-new.php';
- elseif (strpos($sendback, 'attachments.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/attachments.php';
+ if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page-new.php');
+ elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
$sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
wp_redirect($sendback);
@@ -111,6 +111,7 @@ endif;
?>
<p id="post-search">
+ <label class="hidden" for="post-search-input"><?php _e( 'Search Pages' ); ?>:</label>
<input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
<input type="submit" value="<?php _e( 'Search Pages' ); ?>" class="button" />
</p>
@@ -175,7 +176,7 @@ if ($posts) {
if ( 1 == count($posts) && is_singular() ) :
- $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
+ $comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved != 'spam' ORDER BY comment_date", $id) );
if ( $comments ) :
// Make sure comments, post, and post_author are cached
update_comment_cache($comments);
diff --git a/wp-admin/edit-tag-form.php b/wp-admin/edit-tag-form.php
index 62a8e2b..de0f6c8 100644
--- a/wp-admin/edit-tag-form.php
+++ b/wp-admin/edit-tag-form.php
@@ -26,12 +26,12 @@ if ( ! empty($tag_ID) ) {
<table class="form-table">
<tr class="form-field form-required">
<th scope="row" valign="top"><label for="name"><?php _e('Tag name') ?></label></th>
- <td><input name="name" id="name" type="text" value="<?php echo attribute_escape($tag->name); ?>" size="40" />
+ <td><input name="name" id="name" type="text" value="<?php echo attribute_escape($tag->name); ?>" size="40" aria-required="true" />
<p><?php _e('The name is how the tag appears on your site.'); ?></p></td>
</tr>
<tr class="form-field">
<th scope="row" valign="top"><label for="slug"><?php _e('Tag slug') ?></label></th>
- <td><input name="slug" id="slug" type="text" value="<?php echo attribute_escape($tag->slug); ?>" size="40" />
+ <td><input name="slug" id="slug" type="text" value="<?php echo attribute_escape(apply_filters('editable_slug', $tag->slug)); ?>" size="40" />
<p><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td>
</tr>
</table>
diff --git a/wp-admin/edit-tags.php b/wp-admin/edit-tags.php
index b50269b..fffe7ca 100644
--- a/wp-admin/edit-tags.php
+++ b/wp-admin/edit-tags.php
@@ -133,6 +133,7 @@ endif; ?>
<?php endif; ?>
<p id="post-search">
+ <label class="hidden" for="post-search-input"><?php _e( 'Search Tags' ); ?>:</label>
<input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
<input type="submit" value="<?php _e( 'Search Tags' ); ?>" class="button" />
</p>
@@ -172,7 +173,7 @@ if ( $page_links )
<table class="widefat">
<thead>
<tr>
- <th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /></th>
+ <th scope="col" class="check-column"><input type="checkbox" /></th>
<th scope="col"><?php _e('Name') ?></th>
<th scope="col" class="num" style="width: 90px"><?php _e('Posts') ?></th>
</tr>
diff --git a/wp-admin/edit.php b/wp-admin/edit.php
index b7cdcf4..467a9bb 100644
--- a/wp-admin/edit.php
+++ b/wp-admin/edit.php
@@ -20,8 +20,8 @@ if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) {
}
$sendback = wp_get_referer();
- if (strpos($sendback, 'post.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/post-new.php';
- elseif (strpos($sendback, 'attachments.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/attachments.php';
+ if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('post-new.php');
+ elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
$sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
wp_redirect($sendback);
@@ -116,6 +116,7 @@ endif;
?>
<p id="post-search">
+ <label class="hidden" for="post-search-input"><?php _e( 'Search Posts' ); ?>:</label>
<input type="text" id="post-search-input" name="s" value="<?php the_search_query(); ?>" />
<input type="submit" value="<?php _e( 'Search Posts' ); ?>" class="button" />
</p>
@@ -205,7 +206,7 @@ if ( $page_links )
if ( 1 == count($posts) && is_singular() ) :
- $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
+ $comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved != 'spam' ORDER BY comment_date", $id) );
if ( $comments ) :
// Make sure comments, post, and post_author are cached
update_comment_cache($comments);
diff --git a/wp-admin/export.php b/wp-admin/export.php
index e36b8bb..2c147f8 100644
--- a/wp-admin/export.php
+++ b/wp-admin/export.php
@@ -22,9 +22,9 @@ require_once ('admin-header.php');
<table class="form-table">
<tr>
-<th><?php _e('Restrict Author'); ?></th>
+<th><label for="author"><?php _e('Restrict Author'); ?></label></th>
<td>
-<select name="author">
+<select name="author" id="author">
<option value="all" selected="selected"><?php _e('All Authors'); ?></option>
<?php
$authors = $wpdb->get_col( "SELECT post_author FROM $wpdb->posts GROUP BY post_author" );
diff --git a/wp-admin/gears-manifest.php b/wp-admin/gears-manifest.php
new file mode 100644
index 0000000..6fc01da
--- /dev/null
+++ b/wp-admin/gears-manifest.php
@@ -0,0 +1,217 @@
+<?php
+
+define( 'ABSPATH', dirname(dirname(__FILE__)) );
+define( 'WPINC', '/wp-includes' );
+
+function __() {}
+function add_filter() {}
+function attribute_escape() {}
+function apply_filters() {}
+function get_option() {}
+function is_lighttpd_before_150() {}
+function add_action() {}
+function do_action_ref_array() {}
+function get_bloginfo() {}
+function is_admin() {return true;}
+function site_url() {}
+function admin_url() {}
+
+require(ABSPATH . '/wp-includes/script-loader.php');
+require(ABSPATH . '/wp-includes/version.php');
+
+$wp_scripts = new WP_Scripts();
+wp_default_scripts($wp_scripts);
+
+$wp_styles = new WP_Styles();
+wp_default_styles($wp_styles);
+
+$get_lang = file_exists( ABSPATH . '/wp-config.php') ? file( ABSPATH . '/wp-config.php' ) : file( dirname(ABSPATH) . '/wp-config.php' );
+
+if ( is_array($get_lang) ) {
+ foreach ( $get_lang as $val ) {
+ if ( strpos( $val, "'WPLANG'" ) !== false ) {
+ eval( $val );
+ break;
+ }
+ }
+}
+
+if ( defined('WPLANG') && '' != WPLANG ) {
+ if ( file_exists(ABSPATH . '/wp-content/languages') && @is_dir(ABSPATH . '/wp-content/languages') )
+ $langdir = '/wp-content/languages/';
+ else
+ $langdir = '/wp-includes/languages/';
+
+ $locale_file = ABSPATH . $langdir . WPLANG . '.php';
+ if ( is_readable($locale_file) )
+ include_once($locale_file);
+}
+
+$rtl = ( isset($text_direction) && 'rtl' == $text_direction ) ? true : false;
+
+$defaults = $man_version = '';
+foreach ( $wp_scripts->registered as $script ) {
+ if ( empty($script->src) || strpos($script->src, 'tiny_mce_config.php') ) continue;
+ $ver = empty($script->ver) ? $wp_version : $script->ver;
+ $src = str_replace( array( '/wp-admin/', '/wp-includes/' ), array( '', '../wp-includes/' ), $script->src );
+ $defaults .= '{ "url" : "' . $src . '?ver=' . $ver . '" },' . "\n";
+ $man_version .= $ver;
+}
+
+foreach ( $wp_styles->registered as $style ) {
+ if ( empty($style->src) ) continue;
+
+ $ver = empty($style->ver) ? $wp_version : $style->ver;
+ $src = str_replace( array( '/wp-admin/', '/wp-includes/' ), array( '', '../wp-includes/' ), $style->src );
+ if ( 'colors' == $style->handle ) $src = 'css/colors-classic.css';
+ $defaults .= '{ "url" : "' . $src . '?ver=' . $ver . '" },' . "\n";
+
+ if ( $rtl && isset($style->extra['rtl']) && $style->extra['rtl'] ) {
+ if ( is_bool( $style->extra['rtl'] ) )
+ $rtl_href = str_replace( '.css', '-rtl.css', $src );
+ else
+ $rtl_href = str_replace( array( '/wp-admin/', '/wp-includes/' ), array( '', '../wp-includes/' ), $style->extra['rtl'] );
+
+ $defaults .= '{ "url" : "' . $rtl_href . '?ver=' . $ver . '" },' . "\n";
+ }
+ $man_version .= $ver;
+}
+
+$man_version = md5($man_version);
+
+header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
+header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
+header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
+header( 'Pragma: no-cache' );
+header( 'Content-Type: application/x-javascript; charset=UTF-8' );
+?>
+{
+"betaManifestVersion" : 1,
+"version" : "<?php echo $man_version; ?>_20080606",
+"entries" : [
+<?php echo $defaults; ?>
+
+{ "url" : "images/align-center.png" },
+{ "url" : "images/align-left.png" },
+{ "url" : "images/align-none.png" },
+{ "url" : "images/align-right.png" },
+{ "url" : "images/browse-happy.gif" },
+{ "url" : "images/bubble_bg.gif" },
+{ "url" : "images/comment-grey-bubble.png" },
+{ "url" : "images/comment-pill.gif" },
+{ "url" : "images/comment-stalk-classic.gif" },
+{ "url" : "images/comment-stalk-fresh.gif" },
+{ "url" : "images/comment-stalk-rtl.gif" },
+{ "url" : "images/date-button.gif" },
+{ "url" : "images/fade-butt.png" },
+{ "url" : "images/gear.png" },
+{ "url" : "images/logo-ghost.png" },
+{ "url" : "images/logo-login.gif" },
+{ "url" : "images/logo.gif" },
+{ "url" : "images/media-button-gallery.gif" },
+{ "url" : "images/media-button-image.gif" },
+{ "url" : "images/media-button-music.gif" },
+{ "url" : "images/media-button-other.gif" },
+{ "url" : "images/media-button-video.gif" },
+{ "url" : "images/media-buttons.gif" },
+{ "url" : "images/tab.png" },
+{ "url" : "images/tail.gif" },
+{ "url" : "images/toggle-arrow-rtl.gif" },
+{ "url" : "images/toggle-arrow.gif" },
+{ "url" : "images/wordpress-logo.png" },
+{ "url" : "images/xit.gif" },
+
+{ "url" : "../wp-includes/images/crystal/archive.png" },
+{ "url" : "../wp-includes/images/crystal/audio.png" },
+{ "url" : "../wp-includes/images/crystal/code.png" },
+{ "url" : "../wp-includes/images/crystal/default.png" },
+{ "url" : "../wp-includes/images/crystal/document.png" },
+{ "url" : "../wp-includes/images/crystal/interactive.png" },
+{ "url" : "../wp-includes/images/crystal/text.png" },
+{ "url" : "../wp-includes/images/crystal/video.png" },
+{ "url" : "../wp-includes/images/crystal/spreadsheet.png" },
+{ "url" : "../wp-includes/images/rss.png" },
+{ "url" : "../wp-includes/js/thickbox/loadingAnimation.gif" },
+{ "url" : "../wp-includes/js/thickbox/tb-close.png" },
+{ "url" : "../wp-includes/js/swfupload/swfupload_f9.swf" },
+
+{ "url" : "../wp-includes/js/tinymce/tiny_mce_popup.js?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/utils/mctabs.js?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/utils/validate.js?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/utils/form_utils.js?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/utils/editable_selects.js?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/js/pasteword.js?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/js/pastetext.js?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/js/media.js?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/color_picker.js?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/charmap.js?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/image.js?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/link.js?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/source_editor.js?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/anchor.js?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js?ver=3091" },
+
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/source_editor.htm?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/anchor.htm?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/image.htm?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/link.htm?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/color_picker.htm?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/charmap.htm?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/media.htm?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/pasteword.htm?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/blank.htm?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/pastetext.htm?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/template.htm?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/editimage.html?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/wp-mce-help.php?ver=3091" },
+
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/plugins/spellchecker/css/content.css?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/css/content.css?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/css/content.css?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/css/media.css?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/pasteword.css?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/blank.css?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/wordpress.css?ver=3091" },
+
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/icons.gif" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/colorpicker.jpg" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/fm.gif" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/gotmoxie.png" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/sflogo.png" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/butt2.png" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/fade-butt.png" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/tabs.gif" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/down_arrow.gif" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/default/img/progress.gif" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_check.gif" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_arrow.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/drag.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/img/flash.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/img/flv_player.swf" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/img/quicktime.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/img/realmedia.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/img/shockwave.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/img/windowsmedia.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/img/trans.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/more.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/more_bug.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/page.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/page_bug.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/toolbars.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/img/image.png" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/img/delete.png" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/help.gif" }
+]}
diff --git a/wp-admin/images/gear.png b/wp-admin/images/gear.png
new file mode 100644
index 0000000..f7ac7f4
--- /dev/null
+++ b/wp-admin/images/gear.png
Binary files differ
diff --git a/wp-admin/images/loading.gif b/wp-admin/images/loading.gif
new file mode 100644
index 0000000..85b99d4
--- /dev/null
+++ b/wp-admin/images/loading.gif
Binary files differ
diff --git a/wp-admin/images/logo.gif b/wp-admin/images/logo.gif
new file mode 100644
index 0000000..cd49514
--- /dev/null
+++ b/wp-admin/images/logo.gif
Binary files differ
diff --git a/wp-admin/images/tab.png b/wp-admin/images/tab.png
new file mode 100644
index 0000000..413c755
--- /dev/null
+++ b/wp-admin/images/tab.png
Binary files differ
diff --git a/wp-admin/import/blogger.php b/wp-admin/import/blogger.php
index 27f7c87..1fdbf35 100644
--- a/wp-admin/import/blogger.php
+++ b/wp-admin/import/blogger.php
@@ -641,7 +641,7 @@ class Blogger_Import {
$host = $this->blogs[$importing_blog]['host'];
// Get an array of posts => authors
- $post_ids = (array) $wpdb->get_col("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'blogger_blog' AND meta_value = '$host'");
+ $post_ids = (array) $wpdb->get_col( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'blogger_blog' AND meta_value = %s", $host) );
$post_ids = join( ',', $post_ids );
$results = (array) $wpdb->get_results("SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = 'blogger_author' AND post_id IN ($post_ids)");
foreach ( $results as $row )
@@ -658,7 +658,7 @@ class Blogger_Import {
$post_ids = (array) array_keys( $authors_posts, $this->blogs[$importing_blog]['authors'][$author][0] );
$post_ids = join( ',', $post_ids);
- $wpdb->query("UPDATE $wpdb->posts SET post_author = $user_id WHERE id IN ($post_ids)");
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE id IN ($post_ids)", $user_id) );
$this->blogs[$importing_blog]['authors'][$author][1] = $user_id;
}
$this->save_vars();
diff --git a/wp-admin/import/dotclear.php b/wp-admin/import/dotclear.php
index 16df934..da1047f 100644
--- a/wp-admin/import/dotclear.php
+++ b/wp-admin/import/dotclear.php
@@ -13,7 +13,7 @@ if(!function_exists('get_comment_count'))
function get_comment_count($post_ID)
{
global $wpdb;
- return $wpdb->get_var('SELECT count(*) FROM '.$wpdb->comments.' WHERE comment_post_ID = '.$post_ID);
+ return $wpdb->get_var( $wpdb->prepare("SELECT count(*) FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
}
}
@@ -22,7 +22,7 @@ if(!function_exists('link_exists'))
function link_exists($linkname)
{
global $wpdb;
- return $wpdb->get_var('SELECT link_id FROM '.$wpdb->links.' WHERE link_name = "'.$linkname.'"');
+ return $wpdb->get_var( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_name = %s", $linkname) );
}
}
diff --git a/wp-admin/import/greymatter.php b/wp-admin/import/greymatter.php
index 92abc48..58aa757 100644
--- a/wp-admin/import/greymatter.php
+++ b/wp-admin/import/greymatter.php
@@ -38,16 +38,16 @@ class GM_Import {
<h3><?php _e('Second step: GreyMatter details:') ?></h3>
<table class="form-table">
<tr>
-<td><?php _e('Path to GM files:') ?></td>
-<td><input type="text" style="width:300px" name="gmpath" value="/home/my/site/cgi-bin/greymatter/" /></td>
+<td><label for="gmpath"><?php _e('Path to GM files:') ?></label></td>
+<td><input type="text" style="width:300px" name="gmpath" id="gmpath" value="/home/my/site/cgi-bin/greymatter/" /></td>
</tr>
<tr>
-<td><?php _e('Path to GM entries:') ?></td>
-<td><input type="text" style="width:300px" name="archivespath" value="/home/my/site/cgi-bin/greymatter/archives/" /></td>
+<td><label for="archivespath"><?php _e('Path to GM entries:') ?></label></td>
+<td><input type="text" style="width:300px" name="archivespath" id="archivespath" value="/home/my/site/cgi-bin/greymatter/archives/" /></td>
</tr>
<tr>
-<td><?php _e("Last entry's number:") ?></td>
-<td><input type="text" name="lastentry" value="00000001" /><br />
+<td><label for="lastentry"><?php _e("Last entry's number:") ?></label></td>
+<td><input type="text" name="lastentry" id="lastentry" value="00000001" /><br />
<?php _e("This importer will search for files 00000001.cgi to 000-whatever.cgi,<br />so you need to enter the number of the last GM post here.<br />(if you don't know that number, just log into your FTP and look it out<br />in the entries' folder)") ?></td>
</tr>
</table>
diff --git a/wp-admin/import/mt.php b/wp-admin/import/mt.php
index dcf5892..53ca091 100644
--- a/wp-admin/import/mt.php
+++ b/wp-admin/import/mt.php
@@ -149,9 +149,9 @@ class MT_Import {
$j = -1;
foreach ($authors as $author) {
++ $j;
- echo '<li>'.__('Current author:').' <strong>'.$author.'</strong><br />'.'<input type="text" value="'.$author.'" name="'.'user[]'.'" maxlength="30">';
+ echo '<li><label>'.__('Current author:').' <strong>'.$author.'</strong><br />'.'<input type="text" value="'.$author.'" name="'.'user[]'.'" maxlength="30">';
$this->users_form($j);
- echo '</li>';
+ echo '</label></li>';
}
echo '<input type="submit" value="'.__('Submit').'">'.'<br />';
diff --git a/wp-admin/import/textpattern.php b/wp-admin/import/textpattern.php
index 1c10015..c3fb1d7 100644
--- a/wp-admin/import/textpattern.php
+++ b/wp-admin/import/textpattern.php
@@ -8,7 +8,7 @@ if(!function_exists('get_comment_count'))
function get_comment_count($post_ID)
{
global $wpdb;
- return $wpdb->get_var('SELECT count(*) FROM '.$wpdb->comments.' WHERE comment_post_ID = '.$post_ID);
+ return $wpdb->get_var( $wpdb->prepare("SELECT count(*) FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
}
}
@@ -17,7 +17,7 @@ if(!function_exists('link_exists'))
function link_exists($linkname)
{
global $wpdb;
- return $wpdb->get_var('SELECT link_id FROM '.$wpdb->links.' WHERE link_name = "'.$wpdb->escape($linkname).'"');
+ return $wpdb->get_var( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_name = %s", $linkname) );
}
}
diff --git a/wp-admin/import/wordpress.php b/wp-admin/import/wordpress.php
index 03395bd..5271abe 100644
--- a/wp-admin/import/wordpress.php
+++ b/wp-admin/import/wordpress.php
@@ -218,7 +218,7 @@ class WP_Import {
function users_form($n, $author) {
if ( $this->allow_create_users() ) {
- printf(__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user_create['.intval($n).']'.'" maxlength="30"> <br />');
+ printf('<label>'.__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user_create['.intval($n).']'.'" maxlength="30"></label> <br />');
}
else {
echo __('Map to existing').'<br />';
@@ -357,6 +357,11 @@ class WP_Import {
$guid = $this->get_tag( $post, 'guid' );
$post_author = $this->get_tag( $post, 'dc:creator' );
+ $post_excerpt = $this->get_tag( $post, 'excerpt:encoded' );
+ $post_excerpt = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_excerpt);
+ $post_excerpt = str_replace('<br>', '<br />', $post_excerpt);
+ $post_excerpt = str_replace('<hr>', '<hr />', $post_excerpt);
+
$post_content = $this->get_tag( $post, 'content:encoded' );
$post_content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_content);
$post_content = str_replace('<br>', '<br />', $post_content);
@@ -404,7 +409,7 @@ class WP_Import {
$post_author = $this->checkauthor($post_author); //just so that if a post already exists, new users are not created by checkauthor
- $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_status', 'post_name', 'comment_status', 'ping_status', 'guid', 'post_parent', 'menu_order', 'post_type', 'post_password');
+ $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_excerpt', 'post_title', 'post_status', 'post_name', 'comment_status', 'ping_status', 'guid', 'post_parent', 'menu_order', 'post_type', 'post_password');
if ($post_type == 'attachment') {
$remote_url = $this->get_tag( $post, 'wp:attachment_url' );
if ( !$remote_url )
diff --git a/wp-admin/import/wp-cat2tag.php b/wp-admin/import/wp-cat2tag.php
index 246125e..3176fa4 100644
--- a/wp-admin/import/wp-cat2tag.php
+++ b/wp-admin/import/wp-cat2tag.php
@@ -3,50 +3,75 @@
class WP_Categories_to_Tags {
var $categories_to_convert = array();
var $all_categories = array();
+ var $tags_to_convert = array();
+ var $all_tags = array();
+ var $hybrids_ids = array();
function header() {
echo '<div class="wrap">';
- echo '<h2>' . __('Convert Categories to Tags') . '</h2>';
+ if ( ! current_user_can('manage_categories') ) {
+ echo '<div class="narrow">';
+ echo '<p>' . __('Cheatin&#8217; uh?') . '</p>';
+ echo '</div>';
+ } else { ?>
+ <div class="tablenav"><p style="margin:4px"><a style="display:inline;" class="button-secondary" href="admin.php?import=wp-cat2tag">Categories to Tags</a>
+ <a style="display:inline;" class="button-secondary" href="admin.php?import=wp-cat2tag&amp;step=3">Tags to Categories</a></p></div>
+<?php }
}
function footer() {
echo '</div>';
}
- function populate_all_categories() {
+ function populate_cats() {
global $wpdb;
$categories = get_categories('get=all');
foreach ( $categories as $category ) {
- if ( !tag_exists($wpdb->escape($category->name)) )
- $this->all_categories[] = $category;
+ $this->all_categories[] = $category;
+ if ( tag_exists( $wpdb->escape($category->name) ) )
+ $this->hybrids_ids[] = $category->term_id;
+ }
+ }
+
+ function populate_tags() {
+ global $wpdb;
+
+ $tags = get_terms( array('post_tag'), 'get=all' );
+ foreach ( $tags as $tag ) {
+ $this->all_tags[] = $tag;
+ if ( $this->_category_exists($tag->term_id) )
+ $this->hybrids_ids[] = $tag->term_id;
}
}
- function welcome() {
- $this->populate_all_categories();
+ function categories_tab() {
+ $this->populate_cats();
+ $cat_num = count($this->all_categories);
- echo '<div class="narrow">';
+ echo '<br class="clear" />';
- if (count($this->all_categories) > 0) {
+ if ( $cat_num > 0 ) {
+ echo '<h2>Convert Categories (' . $cat_num . ') to Tags.</h2>';
+ echo '<div class="narrow">';
echo '<p>' . __('Hey there. Here you can selectively converts existing categories to tags. To get started, check the categories you wish to be converted, then click the Convert button.') . '</p>';
- echo '<p>' . __('Keep in mind that if you convert a category with child categories, the children become top-level orphans.') . '</p>';
+ echo '<p>' . __('Keep in mind that if you convert a category with child categories, the children become top-level orphans.') . '</p></div>';
$this->categories_form();
+ } elseif ( $hyb_num > 0 ) {
+ echo '<p>' . __('You have no categories that can be converted. However some of your categories are both a tag and a category.') . '</p>';
} else {
echo '<p>'.__('You have no categories to convert!').'</p>';
}
-
- echo '</div>';
}
- function categories_form() {
-?>
+ function categories_form() { ?>
+
<script type="text/javascript">
-<!--
+/* <![CDATA[ */
var checkflag = "false";
function check_all_rows() {
- field = document.formlist;
+ field = document.catlist;
if ( 'false' == checkflag ) {
for ( i = 0; i < field.length; i++ ) {
if ( 'cats_to_convert[]' == field[i].name )
@@ -63,54 +88,153 @@ function check_all_rows() {
return '<?php _e('Check All') ?>';
}
}
-
-// -->
+/* ]]> */
</script>
-<?php
- echo '<form name="formlist" id="formlist" action="admin.php?import=wp-cat2tag&amp;step=2" method="post">
- <p><input type="button" class="button-secondary" value="' . __('Check All') . '"' . ' onClick="this.value=check_all_rows()"></p>';
- wp_nonce_field('import-cat2tag');
- echo '<ul style="list-style:none">';
+<form name="catlist" id="catlist" action="admin.php?import=wp-cat2tag&amp;step=2" method="post">
+<p><input type="button" class="button-secondary" value="<?php _e('Check All'); ?>" onclick="this.value=check_all_rows()">
+<?php wp_nonce_field('import-cat2tag'); ?></p>
+<ul style="list-style:none">
+<?php
$hier = _get_term_hierarchy('category');
foreach ($this->all_categories as $category) {
$category = sanitize_term( $category, 'category', 'display' );
- if ((int) $category->parent == 0) {
- echo '<li><label><input type="checkbox" name="cats_to_convert[]" value="' . intval($category->term_id) . '" /> ' . $category->name . ' (' . $category->count . ')</label>';
+ if ( (int) $category->parent == 0 ) {
+ if ( in_array( intval($category->term_id), $this->hybrids_ids ) ) {
+?>
+ <li style="color:#777;padding-left:1.3em;"><?php echo $category->name . ' (' . $category->count . ') *'; ?></li>
+<?php
+ } else {
+?>
+ <li><label><input type="checkbox" name="cats_to_convert[]" value="<?php echo intval($category->term_id); ?>" /> <?php echo $category->name . ' (' . $category->count . ')'; ?></label><?php
- if (isset($hier[$category->term_id])) {
- $this->_category_children($category, $hier);
+ if ( isset($hier[$category->term_id]) )
+ $this->_category_children($category, $hier);
+?></li>
+<?php
}
+ }
+ }
+?>
+</ul>
+
+<?php
+ if ( ! empty($this->hybrids_ids) ) {
+ echo '<p>' . __('* This category is also a tag. It cannot be convert again.') . '</p>';
+ }
+?>
+<p class="submit"><input type="submit" name="submit" class="button" value="<?php _e('Convert Categories to Tags'); ?>" /></p>
+</form>
+
+<?php
+ }
- echo '</li>';
+ function tags_tab() {
+ $this->populate_tags();
+ $tags_num = count($this->all_tags);
+
+ echo '<br class="clear" />';
+
+ if ( $tags_num > 0 ) {
+ echo '<h2>Convert Tags (' . $tags_num . ') to Categories.</h2>';
+ echo '<div class="narrow">';
+ echo '<p>' . __('Here you can selectively converts existing tags to categories. To get started, check the tags you wish to be converted, then click the Convert button.') . '</p>';
+ echo '<p>' . __('The newly created categories will still be associated with the same posts.') . '</p></div>';
+
+
+ $this->tags_form();
+ } elseif ( $hyb_num > 0 ) {
+ echo '<p>' . __('You have no tags that can be converted. However some of your tags are both a tag and a category.') . '</p>';
+ } else {
+ echo '<p>'.__('You have no tags to convert!').'</p>';
+ }
+ }
+
+ function tags_form() { ?>
+
+<script type="text/javascript">
+/* <![CDATA[ */
+var checktags = "false";
+function check_all_tagrows() {
+ field = document.taglist;
+ if ( 'false' == checktags ) {
+ for ( i = 0; i < field.length; i++ ) {
+ if ( 'tags_to_convert[]' == field[i].name )
+ field[i].checked = true;
+ }
+ checktags = 'true';
+ return '<?php _e('Uncheck All') ?>';
+ } else {
+ for ( i = 0; i < field.length; i++ ) {
+ if ( 'tags_to_convert[]' == field[i].name )
+ field[i].checked = false;
+ }
+ checktags = 'false';
+ return '<?php _e('Check All') ?>';
+ }
+}
+/* ]]> */
+</script>
+
+<form name="taglist" id="taglist" action="admin.php?import=wp-cat2tag&amp;step=4" method="post">
+<p><input type="button" class="button-secondary" value="<?php _e('Check All'); ?>" onclick="this.value=check_all_tagrows()">
+<?php wp_nonce_field('import-cat2tag'); ?></p>
+<ul style="list-style:none">
+<?php
+ foreach ( $this->all_tags as $tag ) {
+ if ( in_array( intval($tag->term_id), $this->hybrids_ids ) ) {
+?>
+ <li style="color:#777;padding-left:1.3em;"><?php echo attribute_escape($tag->name) . ' (' . $tag->count . ') *'; ?></li>
+<?php
+ } else {
+?>
+ <li><label><input type="checkbox" name="tags_to_convert[]" value="<?php echo intval($tag->term_id); ?>" /> <?php echo attribute_escape($tag->name) . ' (' . $tag->count . ')'; ?></label></li>
+
+<?php
}
}
+?>
+</ul>
- echo '</ul>';
+<?php
+ if ( ! empty($this->hybrids_ids) )
+ echo '<p>' . __('* This tag is also a category. It cannot be converted again.') . '</p>';
+?>
- echo '<p class="submit"><input type="submit" name="submit" class="button" value="' . __('Convert Tags') . '" /></p>';
+<p class="submit"><input type="submit" name="submit_tags" class="button" value="<?php _e('Convert Tags to Categories'); ?>" /></p>
+</form>
- echo '</form>';
+<?php
}
function _category_children($parent, $hier) {
- echo '<ul style="list-style:none">';
+?>
+ <ul style="list-style:none">
+<?php
foreach ($hier[$parent->term_id] as $child_id) {
$child =& get_category($child_id);
+
+ if ( in_array( intval($child->term_id), $this->hybrids_ids ) ) {
+?>
+ <li style="color:#777;padding-left:1.3em;"><?php echo $child->name . ' (' . $child->count . ') *'; ?></li>
+<?php
+ } else {
+?>
+ <li><label><input type="checkbox" name="cats_to_convert[]" value="<?php echo intval($child->term_id); ?>" /> <?php echo $child->name . ' (' . $child->count . ')'; ?></label>
+<?php
- echo '<li><label><input type="checkbox" name="cats_to_convert[]" value="' . intval($child->term_id) . '" /> ' . $child->name . ' (' . $child->count . ')</label>';
-
- if (isset($hier[$child->term_id])) {
+ if ( isset($hier[$child->term_id]) )
$this->_category_children($child, $hier);
+?> </li>
+<?php
}
-
- echo '</li>';
}
-
- echo '</ul>';
+?>
+ </ul>
+<?php
}
function _category_exists($cat_id) {
@@ -125,7 +249,7 @@ function check_all_rows() {
}
}
- function convert_them() {
+ function convert_categories() {
global $wpdb;
if ( (!isset($_POST['cats_to_convert']) || !is_array($_POST['cats_to_convert'])) && empty($this->categories_to_convert)) {
@@ -135,7 +259,6 @@ function check_all_rows() {
return;
}
-
if ( empty($this->categories_to_convert) )
$this->categories_to_convert = $_POST['cats_to_convert'];
$hier = _get_term_hierarchy('category');
@@ -164,12 +287,12 @@ function check_all_rows() {
$id = $id['term_taxonomy_id'];
$posts = get_objects_in_term($category->term_id, 'category');
foreach ( $posts as $post ) {
- if ( !$wpdb->get_var("SELECT object_id FROM $wpdb->term_relationships WHERE object_id = '$post' AND term_taxonomy_id = '$id'") )
- $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ('$post', '$id')");
+ if ( !$wpdb->get_var( $wpdb->prepare("SELECT object_id FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id = %d", $post, $id) ) )
+ $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES (%d, %d)", $post, $id) );
clean_post_cache($post);
}
} else {
- $tt_ids = $wpdb->get_col("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = '{$category->term_id}' AND taxonomy = 'category'");
+ $tt_ids = $wpdb->get_col( $wpdb->prepare("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'category'", $category->term_id) );
if ( $tt_ids ) {
$posts = $wpdb->get_col("SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id IN (" . join(',', $tt_ids) . ") GROUP BY object_id");
foreach ( (array) $posts as $post )
@@ -177,14 +300,14 @@ function check_all_rows() {
}
// Change the category to a tag.
- $wpdb->query("UPDATE $wpdb->term_taxonomy SET taxonomy = 'post_tag' WHERE term_id = '{$category->term_id}' AND taxonomy = 'category'");
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET taxonomy = 'post_tag' WHERE term_id = %d AND taxonomy = 'category'", $category->term_id) );
- $terms = $wpdb->get_col("SELECT term_id FROM $wpdb->term_taxonomy WHERE parent = '{$category->term_id}' AND taxonomy = 'category'");
+ $terms = $wpdb->get_col( $wpdb->prepare("SELECT term_id FROM $wpdb->term_taxonomy WHERE parent = %d AND taxonomy = 'category'", $category->term_id) );
foreach ( (array) $terms as $term )
clean_category_cache($term);
// Set all parents to 0 (root-level) if their parent was the converted tag
- $wpdb->query("UPDATE $wpdb->term_taxonomy SET parent = 0 WHERE parent = '{$category->term_id}' AND taxonomy = 'category'");
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET parent = 0 WHERE parent = %d AND taxonomy = 'category'", $category->term_id) );
}
// Clean the cache
clean_category_cache($category->term_id);
@@ -199,27 +322,93 @@ function check_all_rows() {
echo '<p>' . sprintf( __('We&#8217;re all done here, but you can always <a href="%s">convert more</a>.'), 'admin.php?import=wp-cat2tag' ) . '</p>';
}
+ function convert_tags() {
+ global $wpdb;
+
+ if ( (!isset($_POST['tags_to_convert']) || !is_array($_POST['tags_to_convert'])) && empty($this->tags_to_convert)) {
+ echo '<div class="narrow">';
+ echo '<p>' . sprintf(__('Uh, oh. Something didn&#8217;t work. Please <a href="%s">try again</a>.'), 'admin.php?import=wp-cat2tag&amp;step=3') . '</p>';
+ echo '</div>';
+ return;
+ }
+
+ if ( empty($this->categories_to_convert) )
+ $this->tags_to_convert = $_POST['tags_to_convert'];
+
+ $clean_cache = array();
+ echo '<ul>';
+
+ foreach ( (array) $this->tags_to_convert as $tag_id) {
+ $tag_id = (int) $tag_id;
+
+ echo '<li>' . sprintf(__('Converting tag #%s ... '), $tag_id);
+
+ if ( ! is_term($tag_id, 'post_tag') ) {
+ _e('Tag doesn\'t exist!');
+ } else {
+
+ if ( is_term($tag_id, 'category') ) {
+ _e('This Tag is already a Category.');
+ echo '</li>';
+ continue;
+ }
+
+ $tt_ids = $wpdb->get_col( $wpdb->prepare("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'post_tag'", $tag_id) );
+ if ( $tt_ids ) {
+ $posts = $wpdb->get_col("SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id IN (" . join(',', $tt_ids) . ") GROUP BY object_id");
+ foreach ( (array) $posts as $post )
+ clean_post_cache($post);
+ }
+
+ // Change the tag to a category.
+ $parent = $wpdb->get_var( $wpdb->prepare("SELECT parent FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'post_tag'", $tag_id) );
+ if ( 0 == $parent || (0 < (int) $parent && $this->_category_exists($parent)) )
+ $reset_parent = '';
+ else $reset_parent = ", parent = '0'";
+
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET taxonomy = 'category' $reset_parent WHERE term_id = %d AND taxonomy = 'post_tag'", $tag_id) );
+
+ // Clean the cache
+ $clean_cache[] = $tag_id;
+
+ _e('Converted successfully.');
+ }
+
+ echo '</li>';
+ }
+
+ clean_term_cache( $clean_cache, 'post_tag' );
+ delete_option('category_children');
+
+ echo '</ul>';
+ echo '<p>' . sprintf( __('We&#8217;re all done here, but you can always <a href="%s">convert more</a>.'), 'admin.php?import=wp-cat2tag&amp;step=3' ) . '</p>';
+ }
+
function init() {
$step = (isset($_GET['step'])) ? (int) $_GET['step'] : 1;
$this->header();
- if (!current_user_can('manage_categories')) {
- echo '<div class="narrow">';
- echo '<p>' . __('Cheatin&#8217; uh?') . '</p>';
- echo '</div>';
- } else {
- if ( $step > 1 )
- check_admin_referer('import-cat2tag');
+ if ( current_user_can('manage_categories') ) {
switch ($step) {
case 1 :
- $this->welcome();
+ $this->categories_tab();
break;
case 2 :
- $this->convert_them();
+ check_admin_referer('import-cat2tag');
+ $this->convert_categories();
+ break;
+
+ case 3 :
+ $this->tags_tab();
+ break;
+
+ case 4 :
+ check_admin_referer('import-cat2tag');
+ $this->convert_tags();
break;
}
}
@@ -234,6 +423,6 @@ function check_all_rows() {
$wp_cat2tag_importer = new WP_Categories_to_Tags();
-register_importer('wp-cat2tag', __('Categories to Tags Converter'), __('Convert existing categories to tags, selectively.'), array(&$wp_cat2tag_importer, 'init'));
+register_importer('wp-cat2tag', __('Categories and Tags Converter'), __('Convert existing categories to tags or tags to categories, selectively.'), array(&$wp_cat2tag_importer, 'init'));
?>
diff --git a/wp-admin/includes/bookmark.php b/wp-admin/includes/bookmark.php
index 2cae3b5..b48d313 100644
--- a/wp-admin/includes/bookmark.php
+++ b/wp-admin/includes/bookmark.php
@@ -47,7 +47,7 @@ function wp_delete_link($link_id) {
wp_delete_object_term_relationships($link_id, 'link_category');
- $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$link_id'");
+ $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->links WHERE link_id = %d", $link_id) );
do_action('deleted_link', $link_id);
@@ -73,7 +73,7 @@ function wp_insert_link($linkdata) {
$linkdata = wp_parse_args($linkdata, $defaults);
$linkdata = sanitize_bookmark($linkdata, 'db');
- extract($linkdata, EXTR_SKIP);
+ extract(stripslashes_deep($linkdata), EXTR_SKIP);
$update = false;
@@ -119,15 +119,14 @@ function wp_insert_link($linkdata) {
}
if ( $update ) {
- $wpdb->query("UPDATE $wpdb->links SET link_url='$link_url',
- link_name='$link_name', link_image='$link_image',
- link_target='$link_target',
- link_visible='$link_visible', link_description='$link_description',
- link_rating='$link_rating', link_rel='$link_rel',
- link_notes='$link_notes', link_rss = '$link_rss'
- WHERE link_id='$link_id'");
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->links SET link_url = %s,
+ link_name = %s, link_image = %s, link_target = %s,
+ link_visible = %s, link_description = %s, link_rating = %s,
+ link_rel = %s, link_notes = %s, link_rss = %s
+ WHERE link_id = %s", $link_url, $link_name, $link_image, $link_target, $link_visible, $link_description, $link_rating, $link_rel, $link_notes, $link_rss, $link_id) );
} else {
- $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES('$link_url','$link_name', '$link_image', '$link_target', '$link_description', '$link_visible', '$link_owner', '$link_rating', '$link_rel', '$link_notes', '$link_rss')");
+ $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
+ $link_url,$link_name, $link_image, $link_target, $link_description, $link_visible, $link_owner, $link_rating, $link_rel, $link_notes, $link_rss) );
$link_id = (int) $wpdb->insert_id;
}
diff --git a/wp-admin/includes/class-wp-filesystem-base.php b/wp-admin/includes/class-wp-filesystem-base.php
new file mode 100644
index 0000000..7bb6217
--- /dev/null
+++ b/wp-admin/includes/class-wp-filesystem-base.php
@@ -0,0 +1,158 @@
+<?php
+class WP_Filesystem_Base{
+ var $verbose = true;
+ var $cache = array();
+
+ var $method = '';
+
+ function abspath() {
+ if ( defined('FTP_BASE') && strpos($this->method, 'ftp') !== false )
+ return FTP_BASE;
+ return $this->find_folder(ABSPATH);
+ }
+ function wp_content_dir() {
+ if ( defined('FTP_CONTENT_DIR') && strpos($this->method, 'ftp') !== false )
+ return FTP_CONTENT_DIR;
+ return $this->find_folder(WP_CONTENT_DIR);
+ }
+ function wp_plugins_dir() {
+ if ( defined('FTP_PLUGIN_DIR') && strpos($this->method, 'ftp') !== false )
+ return FTP_PLUGIN_DIR;
+ return $this->find_folder(WP_PLUGIN_DIR);
+ }
+ function wp_themes_dir() {
+ return $this->wp_content_dir() . '/themes';
+ }
+ //Back compat: use abspath() or wp_*_dir
+ function find_base_dir($base = '.', $echo = false) {
+ $this->verbose = $echo;
+ return $this->abspath();
+ }
+ //Back compat: use ::abspath() or ::wp_*_dir
+ function get_base_dir($base = '.', $echo = false) {
+ $this->verbose = $echo;
+ return $this->abspath();
+ }
+
+ function find_folder($folder) {
+ $folder = str_replace('\\', '/', $folder); //Windows Sanitiation
+ if ( isset($this->cache[ $folder ] ) )
+ return $this->cache[ $folder ];
+
+ if ( $this->exists($folder) ) { //Folder exists at that absolute path.
+ $this->cache[ $folder ] = $folder;
+ return $folder;
+ }
+ if( $return = $this->search_for_folder($folder) )
+ $this->cache[ $folder ] = $return;
+ return $return;
+ }
+
+ // Assumes $folder is windows sanitized;
+ // Assumes that the drive letter is safe to be stripped off, Should not be a problem for windows servers.
+ function search_for_folder($folder, $base = '.', $loop = false ) {
+ if ( empty( $base ) || '.' == $base )
+ $base = trailingslashit($this->cwd());
+
+ $folder = preg_replace('|^([a-z]{1}):|i', '', $folder); //Strip out windows driveletter if its there.
+
+ $folder_parts = explode('/', $folder);
+ $last_path = $folder_parts[ count($folder_parts) - 1 ];
+
+ $files = $this->dirlist( $base );
+
+ foreach ( $folder_parts as $key ) {
+ if ( $key == $last_path )
+ continue; //We want this to be caught by the next code block.
+
+ //Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder,
+ // If its found, change into it and follow through looking for it.
+ // If it cant find WordPress down that route, it'll continue onto the next folder level, and see if that matches, and so on.
+ // If it reaches the end, and still cant find it, it'll return false for the entire function.
+ if( isset($files[ $key ]) ){
+ //Lets try that folder:
+ $newdir = trailingslashit(path_join($base, $key));
+ if( $this->verbose )
+ printf( __('Changing to %s') . '<br/>', $newdir );
+ if( $ret = $this->search_for_folder( $folder, $newdir, $loop) )
+ return $ret;
+ }
+ }
+
+ //Only check this as a last resort, to prevent locating the incorrect install. All above proceeedures will fail quickly if this is the right branch to take.
+ if(isset( $files[ $last_path ] ) ) {
+ if( $this->verbose )
+ printf( __('Found %s') . '<br/>', $base . $last_path );
+ return $base . $last_path;
+ }
+ if( $loop )
+ return false;//Prevent tihs function looping again.
+ //As an extra last resort, Change back to / if the folder wasnt found. This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... mainly dedicated setups.
+ return $this->search_for_folder($folder, '/', true);
+
+ }
+
+ //Common Helper functions.
+ function gethchmod($file){
+ //From the PHP.net page for ...?
+ $perms = $this->getchmod($file);
+ if (($perms & 0xC000) == 0xC000) // Socket
+ $info = 's';
+ elseif (($perms & 0xA000) == 0xA000) // Symbolic Link
+ $info = 'l';
+ elseif (($perms & 0x8000) == 0x8000) // Regular
+ $info = '-';
+ elseif (($perms & 0x6000) == 0x6000) // Block special
+ $info = 'b';
+ elseif (($perms & 0x4000) == 0x4000) // Directory
+ $info = 'd';
+ elseif (($perms & 0x2000) == 0x2000) // Character special
+ $info = 'c';
+ elseif (($perms & 0x1000) == 0x1000)// FIFO pipe
+ $info = 'p';
+ else // Unknown
+ $info = 'u';
+
+ // Owner
+ $info .= (($perms & 0x0100) ? 'r' : '-');
+ $info .= (($perms & 0x0080) ? 'w' : '-');
+ $info .= (($perms & 0x0040) ?
+ (($perms & 0x0800) ? 's' : 'x' ) :
+ (($perms & 0x0800) ? 'S' : '-'));
+
+ // Group
+ $info .= (($perms & 0x0020) ? 'r' : '-');
+ $info .= (($perms & 0x0010) ? 'w' : '-');
+ $info .= (($perms & 0x0008) ?
+ (($perms & 0x0400) ? 's' : 'x' ) :
+ (($perms & 0x0400) ? 'S' : '-'));
+
+ // World
+ $info .= (($perms & 0x0004) ? 'r' : '-');
+ $info .= (($perms & 0x0002) ? 'w' : '-');
+ $info .= (($perms & 0x0001) ?
+ (($perms & 0x0200) ? 't' : 'x' ) :
+ (($perms & 0x0200) ? 'T' : '-'));
+ return $info;
+ }
+ function getnumchmodfromh($mode) {
+ $realmode = "";
+ $legal = array("", "w", "r", "x", "-");
+ $attarray = preg_split("//", $mode);
+
+ for($i=0; $i < count($attarray); $i++)
+ if($key = array_search($attarray[$i], $legal))
+ $realmode .= $legal[$key];
+
+ $mode = str_pad($realmode, 9, '-');
+ $trans = array('-'=>'0', 'r'=>'4', 'w'=>'2', 'x'=>'1');
+ $mode = strtr($mode,$trans);
+
+ $newmode = '';
+ $newmode .= $mode[0] + $mode[1] + $mode[2];
+ $newmode .= $mode[3] + $mode[4] + $mode[5];
+ $newmode .= $mode[6] + $mode[7] + $mode[8];
+ return $newmode;
+ }
+}
+?> \ No newline at end of file
diff --git a/wp-admin/includes/class-wp-filesystem-direct.php b/wp-admin/includes/class-wp-filesystem-direct.php
index 45972a3..77a7582 100644
--- a/wp-admin/includes/class-wp-filesystem-direct.php
+++ b/wp-admin/includes/class-wp-filesystem-direct.php
@@ -1,51 +1,46 @@
<?php
-class WP_Filesystem_Direct{
+class WP_Filesystem_Direct extends WP_Filesystem_Base {
var $permission = null;
var $errors = array();
- function WP_Filesystem_Direct($arg){
+ function WP_Filesystem_Direct($arg) {
+ $this->method = 'direct';
$this->errors = new WP_Error();
$this->permission = umask();
}
- function connect(){
+ function connect() {
return true;
}
- function setDefaultPermissions($perm){
+ function setDefaultPermissions($perm) {
$this->permission = $perm;
}
- function find_base_dir($base = '.', $echo = false){
- return str_replace('\\','/',ABSPATH);
- }
- function get_base_dir($base = '.', $echo = false){
- return $this->find_base_dir($base, $echo);
- }
- function get_contents($file){
+ function get_contents($file) {
return @file_get_contents($file);
}
- function get_contents_array($file){
+ function get_contents_array($file) {
return @file($file);
}
- function put_contents($file,$contents,$mode=false,$type=''){
- if ( ! ($fp = @fopen($file,'w'.$type)) )
+ function put_contents($file, $contents, $mode = false, $type = '') {
+ if ( ! ($fp = @fopen($file, 'w' . $type)) )
return false;
- @fwrite($fp,$contents);
+ @fwrite($fp, $contents);
@fclose($fp);
$this->chmod($file,$mode);
return true;
}
- function cwd(){
+ function cwd() {
return @getcwd();
}
- function chdir($dir){
+ function chdir($dir) {
return @chdir($dir);
}
- function chgrp($file,$group,$recursive=false){
+ function chgrp($file, $group, $recursive = false) {
if( ! $this->exists($file) )
return false;
if( ! $recursive )
- return @chgrp($file,$group);
+ return @chgrp($file, $group);
if( ! $this->is_dir($file) )
- return @chgrp($file,$group);
+ return @chgrp($file, $group);
//Is a directory, and we want recursive
$file = trailingslashit($file);
$filelist = $this->dirlist($file);
@@ -54,7 +49,7 @@ class WP_Filesystem_Direct{
return true;
}
- function chmod($file,$mode=false,$recursive=false){
+ function chmod($file, $mode = false, $recursive = false) {
if( ! $mode )
$mode = $this->permission;
if( ! $this->exists($file) )
@@ -62,7 +57,7 @@ class WP_Filesystem_Direct{
if( ! $recursive )
return @chmod($file,$mode);
if( ! $this->is_dir($file) )
- return @chmod($file,$mode);
+ return @chmod($file, $mode);
//Is a directory, and we want recursive
$file = trailingslashit($file);
$filelist = $this->dirlist($file);
@@ -71,120 +66,51 @@ class WP_Filesystem_Direct{
return true;
}
- function chown($file,$owner,$recursive=false){
+ function chown($file, $owner, $recursive = false) {
if( ! $this->exists($file) )
return false;
if( ! $recursive )
- return @chown($file,$owner);
+ return @chown($file, $owner);
if( ! $this->is_dir($file) )
- return @chown($file,$owner);
+ return @chown($file, $owner);
//Is a directory, and we want recursive
$filelist = $this->dirlist($file);
foreach($filelist as $filename){
- $this->chown($file.'/'.$filename,$owner,$recursive);
+ $this->chown($file . '/' . $filename, $owner, $recursive);
}
return true;
}
- function owner($file){
+ function owner($file) {
$owneruid = @fileowner($file);
if( ! $owneruid )
return false;
- if( !function_exists('posix_getpwuid') )
+ if( ! function_exists('posix_getpwuid') )
return $owneruid;
$ownerarray = posix_getpwuid($owneruid);
return $ownerarray['name'];
}
- function getchmod($file){
+ function getchmod($file) {
return @fileperms($file);
}
- function gethchmod($file){
- //From the PHP.net page for ...?
- $perms = $this->getchmod($file);
- if (($perms & 0xC000) == 0xC000) {
- // Socket
- $info = 's';
- } elseif (($perms & 0xA000) == 0xA000) {
- // Symbolic Link
- $info = 'l';
- } elseif (($perms & 0x8000) == 0x8000) {
- // Regular
- $info = '-';
- } elseif (($perms & 0x6000) == 0x6000) {
- // Block special
- $info = 'b';
- } elseif (($perms & 0x4000) == 0x4000) {
- // Directory
- $info = 'd';
- } elseif (($perms & 0x2000) == 0x2000) {
- // Character special
- $info = 'c';
- } elseif (($perms & 0x1000) == 0x1000) {
- // FIFO pipe
- $info = 'p';
- } else {
- // Unknown
- $info = 'u';
- }
-
- // Owner
- $info .= (($perms & 0x0100) ? 'r' : '-');
- $info .= (($perms & 0x0080) ? 'w' : '-');
- $info .= (($perms & 0x0040) ?
- (($perms & 0x0800) ? 's' : 'x' ) :
- (($perms & 0x0800) ? 'S' : '-'));
-
- // Group
- $info .= (($perms & 0x0020) ? 'r' : '-');
- $info .= (($perms & 0x0010) ? 'w' : '-');
- $info .= (($perms & 0x0008) ?
- (($perms & 0x0400) ? 's' : 'x' ) :
- (($perms & 0x0400) ? 'S' : '-'));
-
- // World
- $info .= (($perms & 0x0004) ? 'r' : '-');
- $info .= (($perms & 0x0002) ? 'w' : '-');
- $info .= (($perms & 0x0001) ?
- (($perms & 0x0200) ? 't' : 'x' ) :
- (($perms & 0x0200) ? 'T' : '-'));
- return $info;
- }
- function getnumchmodfromh($mode) {
- $realmode = "";
- $legal = array("","w","r","x","-");
- $attarray = preg_split("//",$mode);
- for($i=0;$i<count($attarray);$i++){
- if($key = array_search($attarray[$i],$legal)){
- $realmode .= $legal[$key];
- }
- }
- $mode = str_pad($realmode,9,'-');
- $trans = array('-'=>'0','r'=>'4','w'=>'2','x'=>'1');
- $mode = strtr($mode,$trans);
- $newmode = '';
- $newmode .= $mode[0]+$mode[1]+$mode[2];
- $newmode .= $mode[3]+$mode[4]+$mode[5];
- $newmode .= $mode[6]+$mode[7]+$mode[8];
- return $newmode;
- }
- function group($file){
+ function group($file) {
$gid = @filegroup($file);
if( ! $gid )
return false;
- if( !function_exists('posix_getgrgid') )
+ if( ! function_exists('posix_getgrgid') )
return $gid;
$grouparray = posix_getgrgid($gid);
return $grouparray['name'];
}
- function copy($source,$destination,$overwrite=false){
+ function copy($source, $destination, $overwrite = false) {
if( ! $overwrite && $this->exists($destination) )
return false;
- return copy($source,$destination);
+ return copy($source, $destination);
}
- function move($source,$destination,$overwrite=false){
+ function move($source, $destination, $overwrite = false) {
//Possible to use rename()?
- if( $this->copy($source,$destination,$overwrite) && $this->exists($destination) ){
+ if( $this->copy($source, $destination, $overwrite) && $this->exists($destination) ){
$this->delete($source);
return true;
} else {
@@ -192,12 +118,12 @@ class WP_Filesystem_Direct{
}
}
- function delete($file, $recursive=false){
- $file = str_replace('\\','/',$file); //for win32, occasional problems deleteing files otherwise
+ function delete($file, $recursive = false) {
+ $file = str_replace('\\', '/', $file); //for win32, occasional problems deleteing files otherwise
if( $this->is_file($file) )
return @unlink($file);
- if( !$recursive && $this->is_dir($file) )
+ if( ! $recursive && $this->is_dir($file) )
return @rmdir($file);
//At this point its a folder, and we're in recursive mode
@@ -206,7 +132,7 @@ class WP_Filesystem_Direct{
$retval = true;
if( is_array($filelist) ) //false if no files, So check first.
- foreach($filelist as $filename=>$fileinfo)
+ foreach($filelist as $filename => $fileinfo)
if( ! $this->delete($file . $filename, $recursive) )
$retval = false;
@@ -215,34 +141,34 @@ class WP_Filesystem_Direct{
return $retval;
}
- function exists($file){
+ function exists($file) {
return @file_exists($file);
}
- function is_file($file){
+ function is_file($file) {
return @is_file($file);
}
- function is_dir($path){
+ function is_dir($path) {
return @is_dir($path);
}
- function is_readable($file){
+ function is_readable($file) {
return @is_readable($file);
}
- function is_writable($file){
+ function is_writable($file) {
return @is_writable($file);
}
- function atime($file){
+ function atime($file) {
return @fileatime($file);
}
- function mtime($file){
+ function mtime($file) {
return @filemtime($file);
}
- function size($file){
+ function size($file) {
return @filesize($file);
}
@@ -251,38 +177,38 @@ class WP_Filesystem_Direct{
$time = time();
if($atime == 0)
$atime = time();
- return @touch($file,$time,$atime);
+ return @touch($file, $time, $atime);
}
function mkdir($path, $chmod = false, $chown = false, $chgrp = false){
if( ! $chmod)
$chmod = $this->permission;
- if( !@mkdir($path,$chmod) )
+ if( ! @mkdir($path, $chmod) )
return false;
if( $chown )
- $this->chown($path,$chown);
+ $this->chown($path, $chown);
if( $chgrp )
- $this->chgrp($path,$chgrp);
+ $this->chgrp($path, $chgrp);
return true;
}
- function rmdir($path,$recursive=false){
+ function rmdir($path, $recursive = false) {
//Currently unused and untested, Use delete() instead.
if( ! $recursive )
return @rmdir($path);
//recursive:
$filelist = $this->dirlist($path);
- foreach($filelist as $filename=>$det){
- if ( '/' == substr($filename,-1,1) )
- $this->rmdir($path.'/'.$filename,$recursive);
+ foreach($filelist as $filename => $det) {
+ if ( '/' == substr($filename, -1, 1) )
+ $this->rmdir($path . '/' . $filename, $recursive);
@rmdir($filename);
}
return @rmdir($path);
}
- function dirlist($path,$incdot=false,$recursive=false){
- if( $this->is_file($path) ){
+ function dirlist($path, $incdot = false, $recursive = false) {
+ if( $this->is_file($path) ) {
$limitFile = basename($path);
$path = dirname($path);
} else {
@@ -293,9 +219,9 @@ class WP_Filesystem_Direct{
$ret = array();
$dir = dir($path);
- while (false !== ($entry = $dir->read())) {
+ while (false !== ($entry = $dir->read()) ) {
$struc = array();
- $struc['name'] = $entry;
+ $struc['name'] = $entry;
if( '.' == $struc['name'] || '..' == $struc['name'] )
continue; //Do not care about these folders.
@@ -315,9 +241,9 @@ class WP_Filesystem_Direct{
$struc['time'] = date('h:i:s',$struc['lastmodunix']);
$struc['type'] = $this->is_dir($path.'/'.$entry) ? 'd' : 'f';
- if ('d' == $struc['type'] ){
+ if ( 'd' == $struc['type'] ) {
if( $recursive )
- $struc['files'] = $this->dirlist($path.'/'.$struc['name'], $incdot, $recursive);
+ $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
else
$struc['files'] = array();
}
@@ -328,9 +254,5 @@ class WP_Filesystem_Direct{
unset($dir);
return $ret;
}
-
- function __destruct(){
- return;
- }
}
?>
diff --git a/wp-admin/includes/class-wp-filesystem-ftpext.php b/wp-admin/includes/class-wp-filesystem-ftpext.php
index 32ccd07..2069935 100644
--- a/wp-admin/includes/class-wp-filesystem-ftpext.php
+++ b/wp-admin/includes/class-wp-filesystem-ftpext.php
@@ -1,11 +1,10 @@
<?php
-class WP_Filesystem_FTPext{
+class WP_Filesystem_FTPext extends WP_Filesystem_Base{
var $link;
var $timeout = 5;
var $errors = array();
var $options = array();
- var $wp_base = '';
var $permission = null;
var $filetypes = array(
@@ -24,6 +23,7 @@ class WP_Filesystem_FTPext{
);
function WP_Filesystem_FTPext($opt='') {
+ $this->method = 'ftpext';
$this->errors = new WP_Error();
//Check if possible to use ftp functions.
@@ -60,12 +60,11 @@ class WP_Filesystem_FTPext{
$this->options['ssl'] = ( !empty($opt['ssl']) );
}
- function connect(){
- if ( $this->options['ssl'] && function_exists('ftp_ssl_connect') ) {
+ function connect() {
+ if ( $this->options['ssl'] && function_exists('ftp_ssl_connect') )
$this->link = @ftp_ssl_connect($this->options['hostname'], $this->options['port'],$this->timeout);
- } else {
+ else
$this->link = @ftp_connect($this->options['hostname'], $this->options['port'],$this->timeout);
- }
if ( ! $this->link ) {
$this->errors->add('connect', sprintf(__('Failed to connect to FTP Server %1$s:%2$s'), $this->options['hostname'], $this->options['port']));
@@ -80,76 +79,11 @@ class WP_Filesystem_FTPext{
return true;
}
- function setDefaultPermissions($perm){
+ function setDefaultPermissions($perm) {
$this->permission = $perm;
}
-
- function find_base_dir($base = '.',$echo = false, $loop = false) {
- //Sanitize the Windows path formats, This allows easier conparison and aligns it to FTP output.
- $abspath = str_replace('\\','/',ABSPATH); //windows: Straighten up the paths..
- if( strpos($abspath, ':') ){ //Windows, Strip out the driveletter
- if( preg_match("|.{1}\:(.+)|i", $abspath, $mat) )
- $abspath = $mat[1];
- }
- //Set up the base directory (Which unless specified, is the current one)
- if( empty( $base ) || '.' == $base ) $base = $this->cwd();
- $base = trailingslashit($base);
-
- //Can we see the Current directory as part of the ABSPATH?
- $location = strpos($abspath, $base);
- if( false !== $location ) {
- $newbase = path_join($base, substr($abspath, $location + strlen($base)));
-
- if( false !== $this->chdir($newbase) ){ //chdir sometimes returns null under certain circumstances, even when its changed correctly, FALSE will be returned if it doesnt change correctly.
- if($echo) printf( __('Changing to %s') . '<br/>', $newbase );
- //Check to see if it exists in that folder.
- if( $this->exists($newbase . 'wp-settings.php') ){
- if($echo) printf( __('Found %s'), $newbase . 'wp-settings.php<br/>' );
- return $newbase;
- }
- }
- }
-
- //Ok, Couldnt do a magic location from that particular folder level
-
- //Get a list of the files in the current directory, See if we can locate where we are in the folder stucture.
- $files = $this->dirlist($base);
-
- $arrPath = explode('/', $abspath);
- foreach($arrPath as $key){
- //Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder,
- // If its found, change into it and follow through looking for it.
- // If it cant find WordPress down that route, it'll continue onto the next folder level, and see if that matches, and so on.
- // If it reaches the end, and still cant find it, it'll return false for the entire function.
- if( isset($files[ $key ]) ){
- //Lets try that folder:
- $folder = path_join($base, $key);
- if($echo) printf( __('Changing to %s') . '<br/>', $folder );
- $ret = $this->find_base_dir( $folder, $echo, $loop);
- if( $ret )
- return $ret;
- }
- }
- //Only check this as a last resort, to prevent locating the incorrect install. All above proceeedures will fail quickly if this is the right branch to take.
- if(isset( $files[ 'wp-settings.php' ]) ){
- if($echo) printf( __('Found %s'), $base . 'wp-settings.php<br/>' );
- return $base;
- }
- if( $loop )
- return false;//Prevent tihs function looping again.
- //As an extra last resort, Change back to / if the folder wasnt found. This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... mainly dedicated setups.
- return $this->find_base_dir('/', $echo, true);
- }
-
- function get_base_dir($base = '.', $echo = false){
- if( defined('FTP_BASE') )
- $this->wp_base = FTP_BASE;
- if( empty($this->wp_base) )
- $this->wp_base = $this->find_base_dir($base,$echo);
- return $this->wp_base;
- }
- function get_contents($file,$type='',$resumepos=0){
+ function get_contents($file, $type = '', $resumepos = 0 ){
if( empty($type) ){
$extension = substr(strrchr($file, "."), 1);
$type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_ASCII;
@@ -157,7 +91,7 @@ class WP_Filesystem_FTPext{
$temp = tmpfile();
if ( ! $temp )
return false;
- if( ! @ftp_fget($this->link,$temp,$file,$type,$resumepos) )
+ if( ! @ftp_fget($this->link, $temp, $file, $type, $resumepos) )
return false;
fseek($temp, 0); //Skip back to the start of the file being written to
$contents = '';
@@ -167,202 +101,132 @@ class WP_Filesystem_FTPext{
fclose($temp);
return $contents;
}
- function get_contents_array($file){
- return explode("\n",$this->get_contents($file));
+ function get_contents_array($file) {
+ return explode("\n", $this->get_contents($file));
}
- function put_contents($file,$contents,$type=''){
- if( empty($type) ){
+ function put_contents($file, $contents, $type = '' ) {
+ if( empty($type) ) {
$extension = substr(strrchr($file, "."), 1);
$type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_ASCII;
}
$temp = tmpfile();
if ( ! $temp )
return false;
- fwrite($temp,$contents);
+ fwrite($temp, $contents);
fseek($temp, 0); //Skip back to the start of the file being written to
- $ret = @ftp_fput($this->link,$file,$temp,$type);
+ $ret = @ftp_fput($this->link, $file, $temp, $type);
fclose($temp);
return $ret;
}
- function cwd(){
+ function cwd() {
$cwd = ftp_pwd($this->link);
if( $cwd )
$cwd = trailingslashit($cwd);
return $cwd;
}
- function chdir($dir){
+ function chdir($dir) {
return @ftp_chdir($dir);
}
- function chgrp($file,$group,$recursive=false){
+ function chgrp($file, $group, $recursive = false ) {
return false;
}
- function chmod($file,$mode=false,$recursive=false){
+ function chmod($file, $mode = false, $recursive = false) {
if( ! $mode )
$mode = $this->permission;
if( ! $mode )
return false;
if ( ! $this->exists($file) )
return false;
- if ( ! $recursive || ! $this->is_dir($file) ){
- if (!function_exists('ftp_chmod'))
+ if ( ! $recursive || ! $this->is_dir($file) ) {
+ if ( ! function_exists('ftp_chmod') )
return @ftp_site($this->link, sprintf('CHMOD %o %s', $mode, $file));
- return @ftp_chmod($this->link,$mode,$file);
+ return @ftp_chmod($this->link, $mode, $file);
}
//Is a directory, and we want recursive
$filelist = $this->dirlist($file);
foreach($filelist as $filename){
- $this->chmod($file.'/'.$filename,$mode,$recursive);
+ $this->chmod($file . '/' . $filename, $mode, $recursive);
}
return true;
}
- function chown($file,$owner,$recursive=false){
+ function chown($file, $owner, $recursive = false ) {
return false;
}
- function owner($file){
+ function owner($file) {
$dir = $this->dirlist($file);
return $dir[$file]['owner'];
}
- function getchmod($file){
+ function getchmod($file) {
$dir = $this->dirlist($file);
return $dir[$file]['permsn'];
}
- function gethchmod($file){
- //From the PHP.net page for ...?
- $perms = $this->getchmod($file);
- if (($perms & 0xC000) == 0xC000) {
- // Socket
- $info = 's';
- } elseif (($perms & 0xA000) == 0xA000) {
- // Symbolic Link
- $info = 'l';
- } elseif (($perms & 0x8000) == 0x8000) {
- // Regular
- $info = '-';
- } elseif (($perms & 0x6000) == 0x6000) {
- // Block special
- $info = 'b';
- } elseif (($perms & 0x4000) == 0x4000) {
- // Directory
- $info = 'd';
- } elseif (($perms & 0x2000) == 0x2000) {
- // Character special
- $info = 'c';
- } elseif (($perms & 0x1000) == 0x1000) {
- // FIFO pipe
- $info = 'p';
- } else {
- // Unknown
- $info = 'u';
- }
-
- // Owner
- $info .= (($perms & 0x0100) ? 'r' : '-');
- $info .= (($perms & 0x0080) ? 'w' : '-');
- $info .= (($perms & 0x0040) ?
- (($perms & 0x0800) ? 's' : 'x' ) :
- (($perms & 0x0800) ? 'S' : '-'));
-
- // Group
- $info .= (($perms & 0x0020) ? 'r' : '-');
- $info .= (($perms & 0x0010) ? 'w' : '-');
- $info .= (($perms & 0x0008) ?
- (($perms & 0x0400) ? 's' : 'x' ) :
- (($perms & 0x0400) ? 'S' : '-'));
-
- // World
- $info .= (($perms & 0x0004) ? 'r' : '-');
- $info .= (($perms & 0x0002) ? 'w' : '-');
- $info .= (($perms & 0x0001) ?
- (($perms & 0x0200) ? 't' : 'x' ) :
- (($perms & 0x0200) ? 'T' : '-'));
- return $info;
- }
- function getnumchmodfromh($mode) {
- $realmode = "";
- $legal = array("","w","r","x","-");
- $attarray = preg_split("//",$mode);
- for($i=0;$i<count($attarray);$i++){
- if($key = array_search($attarray[$i],$legal)){
- $realmode .= $legal[$key];
- }
- }
- $mode = str_pad($realmode,9,'-');
- $trans = array('-'=>'0','r'=>'4','w'=>'2','x'=>'1');
- $mode = strtr($mode,$trans);
- $newmode = '';
- $newmode .= $mode[0]+$mode[1]+$mode[2];
- $newmode .= $mode[3]+$mode[4]+$mode[5];
- $newmode .= $mode[6]+$mode[7]+$mode[8];
- return $newmode;
- }
- function group($file){
+ function group($file) {
$dir = $this->dirlist($file);
return $dir[$file]['group'];
}
- function copy($source,$destination,$overwrite=false){
+ function copy($source, $destination, $overwrite = false ) {
if( ! $overwrite && $this->exists($destination) )
return false;
$content = $this->get_contents($source);
if( false === $content)
return false;
- return $this->put_contents($destination,$content);
+ return $this->put_contents($destination, $content);
}
- function move($source,$destination,$overwrite=false){
- return ftp_rename($this->link,$source,$destination);
+ function move($source, $destination, $overwrite = false) {
+ return ftp_rename($this->link, $source, $destination);
}
function delete($file,$recursive=false) {
if ( $this->is_file($file) )
- return @ftp_delete($this->link,$file);
+ return @ftp_delete($this->link, $file);
if ( !$recursive )
- return @ftp_rmdir($this->link,$file);
+ return @ftp_rmdir($this->link, $file);
$filelist = $this->dirlist($file);
foreach ((array) $filelist as $filename => $fileinfo) {
- $this->delete($file.'/'.$filename,$recursive);
+ $this->delete($file . '/' . $filename, $recursive);
}
- return @ftp_rmdir($this->link,$file);
+ return @ftp_rmdir($this->link, $file);
}
- function exists($file){
- $list = ftp_rawlist($this->link,$file,false);
+ function exists($file) {
+ $list = ftp_rawlist($this->link, $file, false);
if( ! $list )
return false;
return count($list) == 1 ? true : false;
}
- function is_file($file){
+ function is_file($file) {
return $this->is_dir($file) ? false : true;
}
- function is_dir($path){
+ function is_dir($path) {
$cwd = $this->cwd();
$result = @ftp_chdir($this->link, $path);
- if( $result && $path == $this->cwd() ||
- $this->cwd() != $cwd ) {
+ if( $result && $path == $this->cwd() || $this->cwd() != $cwd ) {
@ftp_chdir($this->link, $cwd);
return true;
}
return false;
}
- function is_readable($file){
+ function is_readable($file) {
//Get dir list, Check if the file is writable by the current user??
return true;
}
- function is_writable($file){
+ function is_writable($file) {
//Get dir list, Check if the file is writable by the current user??
return true;
}
- function atime($file){
+ function atime($file) {
return false;
}
- function mtime($file){
+ function mtime($file) {
return ftp_mdtm($this->link, $file);
}
- function size($file){
+ function size($file) {
return ftp_size($this->link, $file);
}
- function touch($file,$time=0,$atime=0){
+ function touch($file, $time = 0, $atime = 0) {
return false;
}
- function mkdir($path,$chmod=false,$chown=false,$chgrp=false){
+ function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
if( !@ftp_mkdir($this->link, $path) )
return false;
if( $chmod )
@@ -373,7 +237,7 @@ class WP_Filesystem_FTPext{
$this->chgrp($path, $chgrp);
return true;
}
- function rmdir($path,$recursive=false){
+ function rmdir($path, $recursive = false) {
if( ! $recursive )
return @ftp_rmdir($this->link, $path);
@@ -385,9 +249,9 @@ class WP_Filesystem_FTPext{
function parselisting($line) {
$is_windows = ($this->OS_remote == FTP_OS_Windows);
- if ($is_windows && preg_match("/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|<DIR>) +(.+)/",$line,$lucifer)) {
+ if ($is_windows && preg_match("/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|<DIR>) +(.+)/", $line, $lucifer)) {
$b = array();
- if ($lucifer[3]<70) { $lucifer[3]+=2000; } else { $lucifer[3]+=1900; } // 4digit year fix
+ if ($lucifer[3]<70) { $lucifer[3] +=2000; } else { $lucifer[3]+=1900; } // 4digit year fix
$b['isdir'] = ($lucifer[7]=="<DIR>");
if ( $b['isdir'] )
$b['type'] = 'd';
@@ -445,15 +309,15 @@ class WP_Filesystem_FTPext{
return $b;
}
- function dirlist($path='.',$incdot=false,$recursive=false){
- if( $this->is_file($path) ){
+ function dirlist($path = '.', $incdot = false, $recursive = false) {
+ if( $this->is_file($path) ) {
$limitFile = basename($path);
$path = dirname($path) . '/';
} else {
$limitFile = false;
}
- $list = @ftp_rawlist($this->link , '-a ' . $path, false);
+ $list = @ftp_rawlist($this->link, '-a ' . $path, false);
if ( $list === false )
return false;
@@ -464,10 +328,10 @@ class WP_Filesystem_FTPext{
if ( empty($entry) )
continue;
- if ( $entry["name"]=="." or $entry["name"]==".." )
+ if ( '.' == $entry["name"] || '..' == $entry["name"] )
continue;
- $dirlist[$entry['name']] = $entry;
+ $dirlist[ $entry['name'] ] = $entry;
}
if ( ! $dirlist )
@@ -485,11 +349,11 @@ class WP_Filesystem_FTPext{
//We're including the doted starts
if( '.' != $struc['name'] && '..' != $struc['name'] ){ //Ok, It isnt a special folder
if ($recursive)
- $struc['files'] = $this->dirlist($path.'/'.$struc['name'],$incdot,$recursive);
+ $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
}
} else { //No dots
if ($recursive)
- $struc['files'] = $this->dirlist($path.'/'.$struc['name'],$incdot,$recursive);
+ $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
}
}
//File
diff --git a/wp-admin/includes/class-wp-filesystem-ftpsockets.php b/wp-admin/includes/class-wp-filesystem-ftpsockets.php
index 5365623..3b6cdcc 100644
--- a/wp-admin/includes/class-wp-filesystem-ftpsockets.php
+++ b/wp-admin/includes/class-wp-filesystem-ftpsockets.php
@@ -1,29 +1,29 @@
<?php
-class WP_Filesystem_ftpsockets{
+class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
var $ftp = false;
var $timeout = 5;
var $errors;
var $options = array();
- var $wp_base = '';
var $permission = null;
var $filetypes = array(
- 'php'=>FTP_ASCII,
- 'css'=>FTP_ASCII,
- 'txt'=>FTP_ASCII,
- 'js'=>FTP_ASCII,
- 'html'=>FTP_ASCII,
- 'htm'=>FTP_ASCII,
- 'xml'=>FTP_ASCII,
-
- 'jpg'=>FTP_BINARY,
- 'png'=>FTP_BINARY,
- 'gif'=>FTP_BINARY,
- 'bmp'=>FTP_BINARY
+ 'php' => FTP_ASCII,
+ 'css' => FTP_ASCII,
+ 'txt' => FTP_ASCII,
+ 'js' => FTP_ASCII,
+ 'html'=> FTP_ASCII,
+ 'htm' => FTP_ASCII,
+ 'xml' => FTP_ASCII,
+
+ 'jpg' => FTP_BINARY,
+ 'png' => FTP_BINARY,
+ 'gif' => FTP_BINARY,
+ 'bmp' => FTP_BINARY
);
function WP_Filesystem_ftpsockets($opt='') {
+ $this->method = 'ftpsockets';
$this->errors = new WP_Error();
//Check if possible to use ftp functions.
@@ -86,241 +86,109 @@ class WP_Filesystem_ftpsockets{
$this->permission = $perm;
}
- function find_base_dir($base = '.',$echo = false, $loop = false) {
- //Sanitize the Windows path formats, This allows easier conparison and aligns it to FTP output.
- $abspath = str_replace('\\','/',ABSPATH); //windows: Straighten up the paths..
- if( strpos($abspath, ':') ){ //Windows, Strip out the driveletter
- if( preg_match("|.{1}\:(.+)|i", $abspath, $mat) )
- $abspath = $mat[1];
- }
-
- //Set up the base directory (Which unless specified, is the current one)
- if( empty( $base ) || '.' == $base ) $base = $this->cwd();
- $base = trailingslashit($base);
-
- //Can we see the Current directory as part of the ABSPATH?
- $location = strpos($abspath, $base);
- if( false !== $location ) {
- $newbase = path_join($base, substr($abspath, $location + strlen($base)));
-
- if( false !== $this->chdir($newbase) ){ //chdir sometimes returns null under certain circumstances, even when its changed correctly, FALSE will be returned if it doesnt change correctly.
- if($echo) printf( __('Changing to %s') . '<br/>', $newbase );
- //Check to see if it exists in that folder.
- if( $this->exists($newbase . 'wp-settings.php') ){
- if($echo) printf( __('Found %s'), $newbase . 'wp-settings.php<br/>' );
- return $newbase;
- }
- }
- }
-
- //Ok, Couldnt do a magic location from that particular folder level
-
- //Get a list of the files in the current directory, See if we can locate where we are in the folder stucture.
- $files = $this->dirlist($base);
-
- $arrPath = explode('/', $abspath);
- foreach($arrPath as $key){
- //Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder,
- // If its found, change into it and follow through looking for it.
- // If it cant find WordPress down that route, it'll continue onto the next folder level, and see if that matches, and so on.
- // If it reaches the end, and still cant find it, it'll return false for the entire function.
- if( isset($files[ $key ]) ){
- //Lets try that folder:
- $folder = path_join($base, $key);
- if($echo) printf( __('Changing to %s') . '<br/>', $folder );
- $ret = $this->find_base_dir( $folder, $echo, $loop);
- if( $ret )
- return $ret;
- }
- }
- //Only check this as a last resort, to prevent locating the incorrect install. All above proceeedures will fail quickly if this is the right branch to take.
- if(isset( $files[ 'wp-settings.php' ]) ){
- if($echo) printf( __('Found %s'), $base . 'wp-settings.php<br/>' );
- return $base;
- }
- if( $loop )
- return false;//Prevent tihs function looping again.
- //As an extra last resort, Change back to / if the folder wasnt found. This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... mainly dedicated setups.
- return $this->find_base_dir('/', $echo, true);
- }
-
- function get_base_dir($base = '.', $echo = false){
- if( defined('FTP_BASE') )
- $this->wp_base = FTP_BASE;
- if( empty($this->wp_base) )
- $this->wp_base = $this->find_base_dir($base, $echo);
- return $this->wp_base;
- }
-
- function get_contents($file,$type='',$resumepos=0){
+ function get_contents($file, $type = '', $resumepos = 0){
if( ! $this->exists($file) )
return false;
if( empty($type) ){
- $extension = substr(strrchr($file, "."), 1);
+ $extension = substr(strrchr($file, '.'), 1);
$type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_AUTOASCII;
}
$this->ftp->SetType($type);
- $temp = tmpfile();
- if ( ! $temp )
+ $temp = wp_tempnam( $file );
+ if ( ! $temphandle = fopen($temp, 'w+') )
return false;
- if ( ! $this->ftp->fget($temp, $file) ) {
- fclose($temp);
+ if ( ! $this->ftp->fget($temphandle, $file) ) {
+ fclose($temphandle);
+ unlink($temp);
return ''; //Blank document, File does exist, Its just blank.
}
- fseek($temp, 0); //Skip back to the start of the file being written to
+ fseek($temphandle, 0); //Skip back to the start of the file being written to
$contents = '';
- while ( !feof($temp) )
- $contents .= fread($temp, 8192);
- fclose($temp);
+ while ( ! feof($temphandle) )
+ $contents .= fread($temphandle, 8192);
+ fclose($temphandle);
+ unlink($temp);
return $contents;
}
function get_contents_array($file){
- return explode("\n",$this->get_contents($file));
+ return explode("\n", $this->get_contents($file) );
}
- function put_contents($file,$contents,$type=''){
+ function put_contents($file, $contents, $type = '' ) {
if( empty($type) ){
- $extension = substr(strrchr($file, "."), 1);
- $type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_ASCII;
+ $extension = substr(strrchr($file, '.'), 1);
+ $type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_AUTOASCII;
}
$this->ftp->SetType($type);
- $temp = tmpfile();
- if ( ! $temp )
+ $temp = wp_tempnam( $file );
+ if ( ! $temphandle = fopen($temp, 'w+') ){
+ unlink($temp);
return false;
- fwrite($temp,$contents);
- fseek($temp, 0); //Skip back to the start of the file being written to
- $ret = $this->ftp->fput($file, $temp);
- fclose($temp);
+ }
+ fwrite($temphandle, $contents);
+ fseek($temphandle, 0); //Skip back to the start of the file being written to
+ $ret = $this->ftp->fput($file, $temphandle);
+ fclose($temphandle);
+ unlink($temp);
return $ret;
}
- function cwd(){
+ function cwd() {
$cwd = $this->ftp->pwd();
if( $cwd )
$cwd = trailingslashit($cwd);
return $cwd;
}
- function chdir($file){
+ function chdir($file) {
return $this->ftp->chdir($file);
}
- function chgrp($file,$group,$recursive=false){
+ function chgrp($file, $group, $recursive = false ) {
return false;
}
- function chmod($file,$mode=false,$recursive=false){
+ function chmod($file, $mode = false, $recursive = false ){
if( ! $mode )
$mode = $this->permission;
if( ! $mode )
return false;
//if( ! $this->exists($file) )
// return false;
- if( ! $recursive || ! $this->is_dir($file) ){
+ if( ! $recursive || ! $this->is_dir($file) ) {
return $this->ftp->chmod($file,$mode);
}
//Is a directory, and we want recursive
$filelist = $this->dirlist($file);
foreach($filelist as $filename){
- $this->chmod($file.'/'.$filename,$mode,$recursive);
+ $this->chmod($file . '/' . $filename, $mode, $recursive);
}
return true;
}
- function chown($file,$owner,$recursive=false){
+ function chown($file, $owner, $recursive = false ) {
return false;
}
- function owner($file){
+ function owner($file) {
$dir = $this->dirlist($file);
return $dir[$file]['owner'];
}
- function getchmod($file){
+ function getchmod($file) {
$dir = $this->dirlist($file);
return $dir[$file]['permsn'];
}
- function gethchmod($file){
- //From the PHP.net page for ...?
- $perms = $this->getchmod($file);
- if (($perms & 0xC000) == 0xC000) {
- // Socket
- $info = 's';
- } elseif (($perms & 0xA000) == 0xA000) {
- // Symbolic Link
- $info = 'l';
- } elseif (($perms & 0x8000) == 0x8000) {
- // Regular
- $info = '-';
- } elseif (($perms & 0x6000) == 0x6000) {
- // Block special
- $info = 'b';
- } elseif (($perms & 0x4000) == 0x4000) {
- // Directory
- $info = 'd';
- } elseif (($perms & 0x2000) == 0x2000) {
- // Character special
- $info = 'c';
- } elseif (($perms & 0x1000) == 0x1000) {
- // FIFO pipe
- $info = 'p';
- } else {
- // Unknown
- $info = 'u';
- }
-
- // Owner
- $info .= (($perms & 0x0100) ? 'r' : '-');
- $info .= (($perms & 0x0080) ? 'w' : '-');
- $info .= (($perms & 0x0040) ?
- (($perms & 0x0800) ? 's' : 'x' ) :
- (($perms & 0x0800) ? 'S' : '-'));
-
- // Group
- $info .= (($perms & 0x0020) ? 'r' : '-');
- $info .= (($perms & 0x0010) ? 'w' : '-');
- $info .= (($perms & 0x0008) ?
- (($perms & 0x0400) ? 's' : 'x' ) :
- (($perms & 0x0400) ? 'S' : '-'));
-
- // World
- $info .= (($perms & 0x0004) ? 'r' : '-');
- $info .= (($perms & 0x0002) ? 'w' : '-');
- $info .= (($perms & 0x0001) ?
- (($perms & 0x0200) ? 't' : 'x' ) :
- (($perms & 0x0200) ? 'T' : '-'));
- return $info;
- }
-
- function getnumchmodfromh($mode) {
- $realmode = "";
- $legal = array("","w","r","x","-");
- $attarray = preg_split("//",$mode);
- for($i=0;$i<count($attarray);$i++){
- if($key = array_search($attarray[$i],$legal)){
- $realmode .= $legal[$key];
- }
- }
- $mode = str_pad($realmode,9,'-');
- $trans = array('-'=>'0','r'=>'4','w'=>'2','x'=>'1');
- $mode = strtr($mode,$trans);
- $newmode = '';
- $newmode .= $mode[0]+$mode[1]+$mode[2];
- $newmode .= $mode[3]+$mode[4]+$mode[5];
- $newmode .= $mode[6]+$mode[7]+$mode[8];
- return $newmode;
- }
-
- function group($file){
+ function group($file) {
$dir = $this->dirlist($file);
return $dir[$file]['group'];
}
- function copy($source,$destination,$overwrite=false){
+ function copy($source, $destination, $overwrite = false ) {
if( ! $overwrite && $this->exists($destination) )
return false;
@@ -328,14 +196,14 @@ class WP_Filesystem_ftpsockets{
if ( false === $content )
return false;
- return $this->put_contents($destination,$content);
+ return $this->put_contents($destination, $content);
}
- function move($source,$destination,$overwrite=false){
- return $this->ftp->rename($source,$destination);
+ function move($source, $destination, $overwrite = false ) {
+ return $this->ftp->rename($source, $destination);
}
- function delete($file,$recursive=false) {
+ function delete($file, $recursive = false ) {
if ( $this->is_file($file) )
return $this->ftp->delete($file);
if ( !$recursive )
@@ -344,15 +212,15 @@ class WP_Filesystem_ftpsockets{
return $this->ftp->mdel($file);
}
- function exists($file){
+ function exists($file) {
return $this->ftp->is_exists($file);
}
- function is_file($file){
+ function is_file($file) {
return $this->is_dir($file) ? false : true;
}
- function is_dir($path){
+ function is_dir($path) {
$cwd = $this->cwd();
if ( $this->chdir($path) ) {
$this->chdir($cwd);
@@ -361,33 +229,33 @@ class WP_Filesystem_ftpsockets{
return false;
}
- function is_readable($file){
+ function is_readable($file) {
//Get dir list, Check if the file is writable by the current user??
return true;
}
- function is_writable($file){
+ function is_writable($file) {
//Get dir list, Check if the file is writable by the current user??
return true;
}
- function atime($file){
+ function atime($file) {
return false;
}
- function mtime($file){
+ function mtime($file) {
return $this->ftp->mdtm($file);
}
- function size($file){
+ function size($file) {
return $this->ftp->filesize($file);
}
- function touch($file,$time=0,$atime=0){
+ function touch($file, $time = 0, $atime = 0 ){
return false;
}
- function mkdir($path,$chmod=false,$chown=false,$chgrp=false){
+ function mkdir($path, $chmod = false, $chown = false, $chgrp = false ) {
if( ! $this->ftp->mkdir($path) )
return false;
if( $chmod )
@@ -399,15 +267,15 @@ class WP_Filesystem_ftpsockets{
return true;
}
- function rmdir($path,$recursive=false){
+ function rmdir($path, $recursive = false ) {
if( ! $recursive )
return $this->ftp->rmdir($path);
return $this->ftp->mdel($path);
}
- function dirlist($path='.',$incdot=false,$recursive=false){
- if( $this->is_file($path) ){
+ function dirlist($path = '.', $incdot = false, $recursive = false ) {
+ if( $this->is_file($path) ) {
$limitFile = basename($path);
$path = dirname($path) . '/';
} else {
@@ -430,11 +298,11 @@ class WP_Filesystem_ftpsockets{
//We're including the doted starts
if( '.' != $struc['name'] && '..' != $struc['name'] ){ //Ok, It isnt a special folder
if ($recursive)
- $struc['files'] = $this->dirlist($path.'/'.$struc['name'],$incdot,$recursive);
+ $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
}
} else { //No dots
if ($recursive)
- $struc['files'] = $this->dirlist($path.'/'.$struc['name'],$incdot,$recursive);
+ $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
}
}
//File
diff --git a/wp-admin/includes/comment.php b/wp-admin/includes/comment.php
index 0f2aa61..8a47fe6 100644
--- a/wp-admin/includes/comment.php
+++ b/wp-admin/includes/comment.php
@@ -3,8 +3,8 @@
function comment_exists($comment_author, $comment_date) {
global $wpdb;
- return $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments
- WHERE comment_author = '$comment_author' AND comment_date = '$comment_date'");
+ return $wpdb->get_var( $wpdb->prepare("SELECT comment_post_ID FROM $wpdb->comments
+ WHERE comment_author = %s AND comment_date = %s", $comment_author, $comment_date) );
}
function edit_comment() {
diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php
index 97fd26a..1b4f86e 100644
--- a/wp-admin/includes/dashboard.php
+++ b/wp-admin/includes/dashboard.php
@@ -225,7 +225,7 @@ function wp_dashboard_dynamic_sidebar_params( $params ) {
}
if ( $widget_feed_link )
- $links[] = '<img class="rss-icon" src="' . get_option( 'siteurl' ) . '/' . WPINC . '/images/rss.png" alt="' . __( 'rss icon' ) . '" /> <a href="' . clean_url( $widget_feed_link ) . '">' . __( 'RSS' ) . '</a>';
+ $links[] = '<img class="rss-icon" src="' . includes_url('images/rss.png') . '" alt="' . __( 'rss icon' ) . '" /> <a href="' . clean_url( $widget_feed_link ) . '">' . __( 'RSS' ) . '</a>';
$links = apply_filters( "wp_dashboard_widget_links_$widget_id", $links );
@@ -269,7 +269,7 @@ function wp_dashboard_recent_comments( $sidebar_args ) {
$lambda = create_function( '', 'return 5;' );
add_filter( 'option_posts_per_rss', $lambda ); // hack - comments query doesn't accept per_page parameter
- $comments_query = new WP_Query('feed=rss2&withcomments=1');
+ $comments_query = new WP_Query(array('feed' => 'rss2', 'withcomments' => 1));
remove_filter( 'option_posts_per_rss', $lambda );
$is_first = true;
@@ -389,8 +389,7 @@ function wp_dashboard_secondary_output() {
$rss->items = array_slice($rss->items, 0, $items);
foreach ($rss->items as $item ) {
$title = wp_specialchars($item['title']);
- $author = preg_replace( '|(.+?):.+|s', '$1', $item['title'] );
- $post = preg_replace( '|.+?:(.+)|s', '$1', $item['title'] );
+ list($author,$post) = explode( ':', $title, 2 );
$link = clean_url($item['link']);
echo "\t<li><a href='$link'><span class='post'>$post</span><span class='hidden'> - </span><cite>$author</cite></a></li>\n";
diff --git a/wp-admin/includes/export.php b/wp-admin/includes/export.php
index 5590826..00201fa 100644
--- a/wp-admin/includes/export.php
+++ b/wp-admin/includes/export.php
@@ -17,7 +17,7 @@ header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
$where = '';
if ( $author and $author != 'all' ) {
$author_id = (int) $author;
- $where = " WHERE post_author = '$author_id' ";
+ $where = $wpdb->prepare(" WHERE post_author = %d ", $author_id);
}
// grab a snapshot of post IDs, just in case it changes during the export
@@ -201,6 +201,7 @@ echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
<guid isPermaLink="false"><?php the_guid(); ?></guid>
<description></description>
<content:encoded><?php echo wxr_cdata( apply_filters('the_content_export', $post->post_content) ); ?></content:encoded>
+<excerpt:encoded><?php echo wxr_cdata( apply_filters('the_excerpt_export', $post->post_excerpt) ); ?></excerpt:encoded>
<wp:post_id><?php echo $post->ID; ?></wp:post_id>
<wp:post_date><?php echo $post->post_date; ?></wp:post_date>
<wp:post_date_gmt><?php echo $post->post_date_gmt; ?></wp:post_date_gmt>
@@ -217,7 +218,7 @@ if ($post->post_type == 'attachment') { ?>
<wp:attachment_url><?php echo wp_get_attachment_url($post->ID); ?></wp:attachment_url>
<?php } ?>
<?php
-$postmeta = $wpdb->get_results("SELECT * FROM $wpdb->postmeta WHERE post_id = $post->ID");
+$postmeta = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID) );
if ( $postmeta ) {
?>
<?php foreach( $postmeta as $meta ) { ?>
@@ -228,7 +229,7 @@ if ( $postmeta ) {
<?php } ?>
<?php } ?>
<?php
-$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post->ID");
+$comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d", $post->ID) );
if ( $comments ) { foreach ( $comments as $c ) { ?>
<wp:comment>
<wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id>
diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php
index 01da1d0..29609b2 100644
--- a/wp-admin/includes/file.php
+++ b/wp-admin/includes/file.php
@@ -34,9 +34,9 @@ function get_home_path() {
function get_real_file_to_edit( $file ) {
if ('index.php' == $file || '.htaccess' == $file ) {
- $real_file = get_home_path().$file;
+ $real_file = get_home_path() . $file;
} else {
- $real_file = ABSPATH.$file;
+ $real_file = WP_CONTENT_DIR . $file;
}
return $real_file;
@@ -46,7 +46,7 @@ function get_temp_dir() {
if ( defined('WP_TEMP_DIR') )
return trailingslashit(WP_TEMP_DIR);
- $temp = ABSPATH . 'wp-content/';
+ $temp = WP_CONTENT_DIR . '/';
if ( is_dir($temp) && is_writable($temp) )
return $temp;
@@ -56,6 +56,18 @@ function get_temp_dir() {
return '/tmp/';
}
+function wp_tempnam($filename = '', $dir = ''){
+ if ( empty($dir) )
+ $dir = get_temp_dir();
+ $filename = basename($filename);
+ if ( empty($filename) )
+ $filename = time();
+
+ $filename = $dir . wp_unique_filename($dir, $filename);
+ touch($filename);
+ return $filename;
+}
+
function validate_file_to_edit( $file, $allowed_files = '' ) {
$file = stripslashes( $file );
@@ -174,6 +186,98 @@ function wp_handle_upload( &$file, $overrides = false ) {
return $return;
}
+// Pass this function an array similar to that of a $_FILES POST array.
+function wp_handle_sideload( &$file, $overrides = false ) {
+ // The default error handler.
+ if (! function_exists( 'wp_handle_upload_error' ) ) {
+ function wp_handle_upload_error( &$file, $message ) {
+ return array( 'error'=>$message );
+ }
+ }
+
+ // You may define your own function and pass the name in $overrides['upload_error_handler']
+ $upload_error_handler = 'wp_handle_upload_error';
+
+ // $_POST['action'] must be set and its value must equal $overrides['action'] or this:
+ $action = 'wp_handle_sideload';
+
+ // Courtesy of php.net, the strings that describe the error indicated in $_FILES[{form field}]['error'].
+ $upload_error_strings = array( false,
+ __( "The file exceeds the <code>upload_max_filesize</code> directive in <code>php.ini</code>." ),
+ __( "The file exceeds the <em>MAX_FILE_SIZE</em> directive that was specified in the HTML form." ),
+ __( "The file was only partially uploaded." ),
+ __( "No file was sent." ),
+ __( "Missing a temporary folder." ),
+ __( "Failed to write file to disk." ));
+
+ // All tests are on by default. Most can be turned off by $override[{test_name}] = false;
+ $test_form = true;
+ $test_size = true;
+
+ // If you override this, you must provide $ext and $type!!!!
+ $test_type = true;
+ $mimes = false;
+
+ // Install user overrides. Did we mention that this voids your warranty?
+ if ( is_array( $overrides ) )
+ extract( $overrides, EXTR_OVERWRITE );
+
+ // A correct form post will pass this test.
+ if ( $test_form && (!isset( $_POST['action'] ) || ($_POST['action'] != $action ) ) )
+ return $upload_error_handler( $file, __( 'Invalid form submission.' ));
+
+ // A successful upload will pass this test. It makes no sense to override this one.
+ if ( $file['error'] > 0 )
+ return $upload_error_handler( $file, $upload_error_strings[$file['error']] );
+
+ // A non-empty file will pass this test.
+ if ( $test_size && !(filesize($file['tmp_name']) > 0 ) )
+ return $upload_error_handler( $file, __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini.' ));
+
+ // A properly uploaded file will pass this test. There should be no reason to override this one.
+ if (! @ is_file( $file['tmp_name'] ) )
+ return $upload_error_handler( $file, __( 'Specified file does not exist.' ));
+
+ // A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter.
+ if ( $test_type ) {
+ $wp_filetype = wp_check_filetype( $file['name'], $mimes );
+
+ extract( $wp_filetype );
+
+ if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )
+ return $upload_error_handler( $file, __( 'File type does not meet security guidelines. Try another.' ));
+
+ if ( !$ext )
+ $ext = ltrim(strrchr($file['name'], '.'), '.');
+
+ if ( !$type )
+ $type = $file['type'];
+ }
+
+ // A writable uploads dir will pass this test. Again, there's no point overriding this one.
+ if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )
+ return $upload_error_handler( $file, $uploads['error'] );
+
+ $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback );
+
+ // Move the file to the uploads dir
+ $new_file = $uploads['path'] . "/$filename";
+ if ( false === @ rename( $file['tmp_name'], $new_file ) ) {
+ return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) );
+ }
+
+ // Set correct file permissions
+ $stat = stat( dirname( $new_file ));
+ $perms = $stat['mode'] & 0000666;
+ @ chmod( $new_file, $perms );
+
+ // Compute the URL
+ $url = $uploads['url'] . "/$filename";
+
+ $return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );
+
+ return $return;
+}
/**
* Downloads a url to a local file using the Snoopy HTTP Class
@@ -186,7 +290,7 @@ function download_url( $url ) {
if( ! $url )
return new WP_Error('http_no_url', __('Invalid URL Provided'));
- $tmpfname = tempnam(get_temp_dir(), 'wpupdate');
+ $tmpfname = wp_tempnam($url);
if( ! $tmpfname )
return new WP_Error('http_no_file', __('Could not create Temporary file'));
@@ -246,13 +350,13 @@ function unzip_file($file, $to) {
$tmppath .= $path[$j] . '/';
if ( ! $fs->is_dir($to . $tmppath) )
if ( !$fs->mkdir($to . $tmppath, 0755) )
- return new WP_Error('mkdir_failed', __('Could not create directory'));
+ return new WP_Error('mkdir_failed', __('Could not create directory'), $to . $tmppath);
}
// We've made sure the folders are there, so let's extract the file now:
if ( ! $file['folder'] )
if ( !$fs->put_contents( $to . $file['filename'], $file['content']) )
- return new WP_Error('copy_failed', __('Could not copy file'));
+ return new WP_Error('copy_failed', __('Could not copy file'), $to . $file['filename']);
$fs->chmod($to . $file['filename'], 0644);
}
@@ -270,27 +374,33 @@ function copy_dir($from, $to) {
foreach ( (array) $dirlist as $filename => $fileinfo ) {
if ( 'f' == $fileinfo['type'] ) {
if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true) )
- return false;
+ return new WP_Error('copy_failed', __('Could not copy file'), $to . $filename);
$wp_filesystem->chmod($to . $filename, 0644);
} elseif ( 'd' == $fileinfo['type'] ) {
if ( !$wp_filesystem->mkdir($to . $filename, 0755) )
- return false;
- if ( !copy_dir($from . $filename, $to . $filename) )
- return false;
+ return new WP_Error('mkdir_failed', __('Could not create directory'), $to . $filename);
+ $result = copy_dir($from . $filename, $to . $filename);
+ if ( is_wp_error($result) )
+ return $result;
}
}
-
- return true;
}
-function WP_Filesystem( $args = false, $preference = false ) {
+function WP_Filesystem( $args = false ) {
global $wp_filesystem;
- $method = get_filesystem_method($preference);
+ require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php');
+
+ $method = get_filesystem_method();
+
if ( ! $method )
return false;
- require_once('class-wp-filesystem-'.$method.'.php');
+ $abstraction_file = apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-'.$method.'.php', $method);
+ if( ! file_exists($abstraction_file) )
+ return;
+
+ require_once($abstraction_file);
$method = "WP_Filesystem_$method";
$wp_filesystem = new $method($args);
@@ -305,18 +415,17 @@ function WP_Filesystem( $args = false, $preference = false ) {
}
function get_filesystem_method() {
- $tempFile = tempnam(get_temp_dir(), 'WPU');
-
- if ( getmyuid() == fileowner($tempFile) ) {
- unlink($tempFile);
- return 'direct';
- } else {
- unlink($tempFile);
+ $method = false;
+ if( function_exists('getmyuid') && function_exists('fileowner') ){
+ $temp_file = wp_tempnam();
+ if ( getmyuid() == fileowner($temp_file) )
+ $method = 'direct';
+ unlink($temp_file);
}
- if ( extension_loaded('ftp') ) return 'ftpext';
- if ( extension_loaded('sockets') || function_exists('fsockopen') ) return 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread
- return false;
+ if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext';
+ if ( ! $method && ( extension_loaded('sockets') || function_exists('fsockopen') ) ) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread
+ return apply_filters('filesystem_method', $method);
}
?>
diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php
index 0fb84bb..4d42def 100644
--- a/wp-admin/includes/media.php
+++ b/wp-admin/includes/media.php
@@ -116,6 +116,83 @@ function media_handle_upload($file_id, $post_id, $post_data = array()) {
}
+function media_sideload_image($file, $post_id, $desc = null) {
+
+ if (!empty($file) ) {
+ // Upload File button was clicked
+
+ $file_array['name'] = basename($file);
+ $file_array['tmp_name'] = download_url($file);
+ $desc = @$desc;
+
+ $sideload = media_handle_sideload($file_array, $post_id, $desc);
+
+ $id = $sideload['id'];
+ $src = $sideload['src'];
+
+ unset($file_array['tmp_name']);
+ unset($file_array);
+
+ if ( is_wp_error($id) ) {
+ $errors['upload_error'] = $id;
+ $id = false;
+ }
+ }
+
+ if ( !empty($src) && !strpos($src, '://') )
+
+ $src = "http://$src";
+ $alt = @$desc;
+
+ if ( !empty($src) )
+ $html = "<img src='$src' alt='$alt' />";
+ return $html;
+
+}
+
+function media_handle_sideload($file_array, $post_id, $desc = null, $post_data = array()) {
+ $overrides = array('test_form'=>false);
+ $file = wp_handle_sideload($file_array, $overrides);
+
+ if ( isset($file['error']) )
+ return new wp_error( 'upload_error', $file['error'] );
+
+ $url = $file['url'];
+ $type = $file['type'];
+ $file = $file['file'];
+ $title = preg_replace('/\.[^.]+$/', '', basename($file));
+ $content = '';
+
+ // use image exif/iptc data for title and caption defaults if possible
+ if ( $image_meta = @wp_read_image_metadata($file) ) {
+ if ( trim($image_meta['title']) )
+ $title = $image_meta['title'];
+ if ( trim($image_meta['caption']) )
+ $content = $image_meta['caption'];
+ }
+
+ $title = @$desc;
+
+ // Construct the attachment array
+ $attachment = array_merge( array(
+ 'post_mime_type' => $type,
+ 'guid' => $url,
+ 'post_parent' => $post_id,
+ 'post_title' => $title,
+ 'post_content' => $content,
+ ), $post_data );
+
+ // Save the data
+ $id = wp_insert_attachment($attachment, $file, $post_parent);
+ if ( !is_wp_error($id) ) {
+ wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
+ }
+
+ return array('id' => $id, 'src' => $url);
+
+}
+
+
// wrap iframe content (produced by $content_func) in a doctype, html head/body etc
// any additional function args will be passed to content_func
function wp_iframe($content_func /* ... */) {
@@ -126,9 +203,12 @@ function wp_iframe($content_func /* ... */) {
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
<title><?php bloginfo('name') ?> &rsaquo; <?php _e('Uploads'); ?> &#8212; <?php _e('WordPress'); ?></title>
<?php
-wp_admin_css( 'css/global' );
-wp_admin_css();
-wp_admin_css( 'css/colors' );
+wp_enqueue_style( 'global' );
+wp_enqueue_style( 'wp-admin' );
+wp_enqueue_style( 'colors' );
+if ( 0 === strpos( $content_func, 'media' ) )
+ wp_enqueue_style( 'media' );
+
?>
<script type="text/javascript">
//<![CDATA[
@@ -136,6 +216,7 @@ function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}el
//]]>
</script>
<?php
+do_action('admin_print_styles');
do_action('admin_print_scripts');
do_action('admin_head');
if ( is_string($content_func) )
@@ -167,39 +248,15 @@ function media_buttons() {
$audio_title = __('Add Audio');
$out = <<<EOF
- <a href="{$image_upload_iframe_src}&amp;TB_iframe=true&amp;height=500&amp;width=640" class="thickbox" title='$image_title'><img src='images/media-button-image.gif' alt='$image_title' /></a>
- <a href="{$video_upload_iframe_src}&amp;TB_iframe=true&amp;height=500&amp;width=640" class="thickbox" title='$video_title'><img src='images/media-button-video.gif' alt='$video_title' /></a>
- <a href="{$audio_upload_iframe_src}&amp;TB_iframe=true&amp;height=500&amp;width=640" class="thickbox" title='$audio_title'><img src='images/media-button-music.gif' alt='$audio_title' /></a>
- <a href="{$media_upload_iframe_src}&amp;TB_iframe=true&amp;height=500&amp;width=640" class="thickbox" title='$media_title'><img src='images/media-button-other.gif' alt='$media_title' /></a>
+ <a href="{$image_upload_iframe_src}&amp;TB_iframe=true" class="thickbox" title='$image_title'><img src='images/media-button-image.gif' alt='$image_title' /></a>
+ <a href="{$video_upload_iframe_src}&amp;TB_iframe=true" class="thickbox" title='$video_title'><img src='images/media-button-video.gif' alt='$video_title' /></a>
+ <a href="{$audio_upload_iframe_src}&amp;TB_iframe=true" class="thickbox" title='$audio_title'><img src='images/media-button-music.gif' alt='$audio_title' /></a>
+ <a href="{$media_upload_iframe_src}&amp;TB_iframe=true" class="thickbox" title='$media_title'><img src='images/media-button-other.gif' alt='$media_title' /></a>
EOF;
printf($context, $out);
}
add_action( 'media_buttons', 'media_buttons' );
-
-function media_buttons_head() {
-$siteurl = get_option('siteurl');
-echo "<style type='text/css' media='all'>
- @import '{$siteurl}/wp-includes/js/thickbox/thickbox.css?ver=20080430';
- div#TB_title {
- background-color: #222222;
- color: #cfcfcf;
- }
- div#TB_title a, div#TB_title a:visited {
- color: #cfcfcf;
- }
- #TB_window {
- top: 20px;
- }
-</style>\n";
-}
-
-add_action( 'admin_print_scripts', 'media_buttons_head' );
-
-function media_admin_css() {
- wp_admin_css('css/media');
-}
-
add_action('media_upload_media', 'media_upload_handler');
function media_upload_form_handler() {
@@ -213,6 +270,8 @@ function media_upload_form_handler() {
$post['post_title'] = $attachment['post_title'];
if ( isset($attachment['post_excerpt']) )
$post['post_excerpt'] = $attachment['post_excerpt'];
+ if ( isset($attachment['menu_order']) )
+ $post['menu_order'] = $attachment['menu_order'];
$post = apply_filters('attachment_fields_to_save', $post, $attachment);
@@ -413,6 +472,7 @@ function media_upload_gallery() {
$errors = $return;
}
+ wp_enqueue_script('admin-gallery');
return wp_iframe( 'media_upload_gallery_form', $errors );
}
@@ -549,6 +609,10 @@ function get_attachment_fields_to_edit($post, $errors = null) {
</script>\n",
'helps' => __('Enter a link URL or click above for presets.'),
),
+ 'menu_order' => array(
+ 'label' => __('Order'),
+ 'value' => $edit_post->menu_order
+ ),
);
foreach ( get_attachment_taxonomies($post) as $taxonomy ) {
@@ -586,7 +650,7 @@ function get_media_items( $post_id, $errors ) {
if ( $post && $post->post_type == 'attachment' )
$attachments = array($post->ID => $post);
else
- $attachments = get_children("post_parent=$post_id&post_type=attachment&orderby=menu_order ASC, ID&order=DESC");
+ $attachments = get_children( array( 'post_parent' => $post_id, 'post_type' => 'attachment', 'orderby' => 'menu_order ASC, ID', 'order' => 'DESC') );
} else {
if ( is_array($GLOBALS['wp_the_query']->posts) )
foreach ( $GLOBALS['wp_the_query']->posts as $attachment )
@@ -679,9 +743,11 @@ function get_media_item( $attachment_id, $args = null ) {
if ( $send )
$send = "<input type='submit' class='button' name='send[$attachment_id]' value='" . attribute_escape( __( 'Insert into Post' ) ) . "' />";
if ( $delete )
- $delete = "<a href='$delete_href' id='del[$attachment_id]' disabled='disabled' class='delete'>" . __('Delete') . "</button>";
+ $delete = "<a href=\"#\" class=\"del-link\" onclick=\"document.getElementById('del_attachment_$attachment_id').style.display='block';return false;\">" . __('Delete') . "</a>";
if ( ( $send || $delete ) && !isset($form_fields['buttons']) )
- $form_fields['buttons'] = array('tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>$send $delete</td></tr>\n");
+ $form_fields['buttons'] = array('tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>$send $delete
+ <div id=\"del_attachment_$attachment_id\" class=\"del-attachment\" style=\"display:none;\">" . sprintf(__("You are about to delete <strong>%s</strong>."), $filename) . " <a href=\"$delete_href\" id=\"del[$attachment_id]\" class=\"delete\">" . __('Continue') . "</a>
+ <a href=\"#\" class=\"del-link\" onclick=\"this.parentNode.style.display='none';return false;\">" . __('Cancel') . "</a></div></td></tr>\n");
$hidden_fields = array();
@@ -703,6 +769,7 @@ function get_media_item( $attachment_id, $args = null ) {
}
$required = $field['required'] ? '<abbr title="required" class="required">*</abbr>' : '';
+ $aria_required = $field['required'] ? " aria-required='true' " : '';
$class = $id;
$class .= $field['required'] ? ' form-required' : '';
@@ -710,9 +777,9 @@ function get_media_item( $attachment_id, $args = null ) {
if ( !empty($field[$field['input']]) )
$item .= $field[$field['input']];
elseif ( $field['input'] == 'textarea' ) {
- $item .= "<textarea type='text' id='$name' name='$name'>" . attribute_escape( $field['value'] ) . "</textarea>";
+ $item .= "<textarea type='text' id='$name' name='$name'>" . attribute_escape( $field['value'] ) . $aria_required . "</textarea>";
} else {
- $item .= "<input type='text' id='$name' name='$name' value='" . attribute_escape( $field['value'] ) . "' />";
+ $item .= "<input type='text' id='$name' name='$name' value='" . attribute_escape( $field['value'] ) . "'" . $aria_required . "/>";
}
if ( !empty($field['helps']) )
$item .= "<p class='help'>" . join( "</p>\n<p class='help'>", array_unique((array) $field['helps']) ) . '</p>';
@@ -757,7 +824,7 @@ function media_upload_header() {
function media_upload_form( $errors = null ) {
global $type, $tab;
- $flash_action_url = get_option('siteurl') . "/wp-admin/async-upload.php";
+ $flash_action_url = admin_url('async-upload.php');
// If Mac and mod_security, no Flash. :(
$flash = true;
@@ -788,7 +855,7 @@ function media_upload_form( $errors = null ) {
jQuery(function($){
swfu = new SWFUpload({
upload_url : "<?php echo attribute_escape( $flash_action_url ); ?>",
- flash_url : "<?php echo get_option('siteurl').'/wp-includes/js/swfupload/swfupload_f9.swf'; ?>",
+ flash_url : "<?php echo includes_url('js/swfupload/swfupload_f9.swf'); ?>",
file_post_name: "async-upload",
file_types: "<?php echo apply_filters('upload_file_glob', '*.*'); ?>",
post_params : {
@@ -819,12 +886,11 @@ jQuery(function($){
//-->
</script>
-
<div id="flash-upload-ui">
<?php do_action('pre-flash-upload-ui'); ?>
<p><input id="flash-browse-button" type="button" value="<?php echo attribute_escape( __( 'Choose files to upload' ) ); ?>" class="button" /></p>
<?php do_action('post-flash-upload-ui'); ?>
- <p><?php _e('After a file has been uploaded, you can add titles and descriptions.'); ?></p>
+ <p class="howto"><?php _e('After a file has been uploaded, you can add titles and descriptions.'); ?></p>
</div>
<?php endif; // $flash ?>
@@ -850,7 +916,8 @@ function media_upload_type_form($type = 'file', $errors = null, $id = null) {
$post_id = intval($_REQUEST['post_id']);
- $form_action_url = get_option('siteurl') . "/wp-admin/media-upload.php?type=$type&tab=type&post_id=$post_id";
+ $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
+ $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
$callback = "type_form_$type";
?>
@@ -900,7 +967,7 @@ function media_upload_gallery_form($errors) {
$post_id = intval($_REQUEST['post_id']);
- $form_action_url = get_option('siteurl') . "/wp-admin/media-upload.php?type={$GLOBALS['type']}&tab=gallery&post_id=$post_id";
+ $form_action_url = admin_url("media-upload.php?type={$GLOBALS['type']}&tab=gallery&post_id=$post_id");
?>
@@ -939,7 +1006,7 @@ function media_upload_library_form($errors) {
$post_id = intval($_REQUEST['post_id']);
- $form_action_url = get_option('siteurl') . "/wp-admin/media-upload.php?type={$GLOBALS['type']}&tab=library&post_id=$post_id";
+ $form_action_url = admin_url("media-upload.php?type={$GLOBALS['type']}&tab=library&post_id=$post_id");
$_GET['paged'] = intval($_GET['paged']);
if ( $_GET['paged'] < 1 )
@@ -960,6 +1027,7 @@ function media_upload_library_form($errors) {
<input type="hidden" name="post_mime_type" value="<?php echo attribute_escape( $_GET['post_mime_type'] ); ?>" />
<div id="search-filter">
+ <label class="hidden" for="post-search-input"><?php _e('Search Media');?>:</label>
<input type="text" id="post-search-input" name="s" value="<?php the_search_query(); ?>" />
<input type="submit" value="<?php echo attribute_escape( __( 'Search Media' ) ); ?>" class="button" />
</div>
@@ -1085,14 +1153,14 @@ function type_form_image() {
<span class="alignleft"><label for="insertonly[src]">' . __('Image URL') . '</label></span>
<span class="alignright"><abbr title="required" class="required">*</abbr></span>
</th>
- <td class="field"><input id="insertonly[src]" name="insertonly[src]" value="" type="text"></td>
+ <td class="field"><input id="insertonly[src]" name="insertonly[src]" value="" type="text" aria-required="true"></td>
</tr>
<tr>
<th valign="top" scope="row" class="label">
<span class="alignleft"><label for="insertonly[alt]">' . __('Description') . '</label></span>
<span class="alignright"><abbr title="required" class="required">*</abbr></span>
</th>
- <td class="field"><input id="insertonly[alt]" name="insertonly[alt]" value="" type="text"></td>
+ <td class="field"><input id="insertonly[alt]" name="insertonly[alt]" value="" type="text" aria-required="true"></td>
</tr>
<tr><td></td><td class="help">' . __('Alternate text, e.g. "The Mona Lisa"') . '</td></tr>
<tr class="align">
@@ -1126,14 +1194,14 @@ function type_form_audio() {
<span class="alignleft"><label for="insertonly[href]">' . __('Audio File URL') . '</label></span>
<span class="alignright"><abbr title="required" class="required">*</abbr></span>
</th>
- <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text"></td>
+ <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td>
</tr>
<tr>
<th valign="top" scope="row" class="label">
<span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>
<span class="alignright"><abbr title="required" class="required">*</abbr></span>
</th>
- <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text"></td>
+ <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
</tr>
<tr><td></td><td class="help">' . __('Link text, e.g. "Still Alive by Jonathan Coulton"') . '</td></tr>
<tr>
@@ -1154,14 +1222,14 @@ function type_form_video() {
<span class="alignleft"><label for="insertonly[href]">' . __('Video URL') . '</label></span>
<span class="alignright"><abbr title="required" class="required">*</abbr></span>
</th>
- <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text"></td>
+ <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td>
</tr>
<tr>
<th valign="top" scope="row" class="label">
<span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>
<span class="alignright"><abbr title="required" class="required">*</abbr></span>
</th>
- <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text"></td>
+ <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
</tr>
<tr><td></td><td class="help">' . __('Link text, e.g. "Lucy on YouTube"') . '</td></tr>
<tr>
@@ -1182,14 +1250,14 @@ function type_form_file() {
<span class="alignleft"><label for="insertonly[href]">' . __('URL') . '</label></span>
<span class="alignright"><abbr title="required" class="required">*</abbr></span>
</th>
- <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text"></td>
+ <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td>
</tr>
<tr>
<th valign="top" scope="row" class="label">
<span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>
<span class="alignright"><abbr title="required" class="required">*</abbr></span>
</th>
- <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text"></td>
+ <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
</tr>
<tr><td></td><td class="help">' . __('Link text, e.g. "Ransom Demands (PDF)"') . '</td></tr>
<tr>
@@ -1211,12 +1279,9 @@ add_action('media_upload_image', 'media_upload_image');
add_action('media_upload_audio', 'media_upload_audio');
add_action('media_upload_video', 'media_upload_video');
add_action('media_upload_file', 'media_upload_file');
-add_action('admin_head_media_upload_type_form', 'media_admin_css');
add_filter('media_upload_gallery', 'media_upload_gallery');
-add_action('admin_head_media_upload_gallery_form', 'media_admin_css');
add_filter('media_upload_library', 'media_upload_library');
-add_action('admin_head_media_upload_library_form', 'media_admin_css');
?>
diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php
index a862c51..3afaed9 100644
--- a/wp-admin/includes/plugin.php
+++ b/wp-admin/includes/plugin.php
@@ -32,14 +32,15 @@ function get_plugin_data( $plugin_file ) {
}
function get_plugins($plugin_folder = '') {
- global $wp_plugins;
-
- if ( isset( $wp_plugins ) ) {
- return $wp_plugins;
- }
-
+
+ if ( ! $cache_plugins = wp_cache_get('plugins', 'plugins') )
+ $cached_plugins = array();
+
+ if ( isset($cache_plugins[ $plugin_folder ]) )
+ return $cache_plugins[ $plugin_folder ];
+
$wp_plugins = array ();
- $plugin_root = ABSPATH . PLUGINDIR;
+ $plugin_root = WP_PLUGIN_DIR;
if( !empty($plugin_folder) )
$plugin_root .= $plugin_folder;
@@ -85,6 +86,9 @@ function get_plugins($plugin_folder = '') {
uasort( $wp_plugins, create_function( '$a, $b', 'return strnatcasecmp( $a["Name"], $b["Name"] );' ));
+ $cache_plugins[ $plugin_folder ] = $wp_plugins;
+ wp_cache_set('plugins', $cache_plugins, 'plugins');
+
return $wp_plugins;
}
@@ -104,7 +108,7 @@ function activate_plugin($plugin, $redirect = '') {
if ( !empty($redirect) )
wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); // we'll override this later if the plugin can be included without fatal error
ob_start();
- @include(ABSPATH . PLUGINDIR . '/' . $plugin);
+ @include(WP_PLUGIN_DIR . '/' . $plugin);
$current[] = $plugin;
sort($current);
update_option('active_plugins', $current);
@@ -132,37 +136,97 @@ function deactivate_plugins($plugins, $silent= false) {
update_option('active_plugins', $current);
}
-function deactivate_all_plugins() {
- $current = get_option('active_plugins');
- if ( empty($current) )
- return;
+//Replaces reactivate_all_plugins() / deactivate_all_plugins() = 'deactivated_plugins' is now useless
+function activate_plugins($plugins, $redirect = '') {
+ if ( !is_array($plugins) )
+ $plugins = array($plugins);
- deactivate_plugins($current);
+ $errors = array();
+ foreach ( (array) $plugins as $plugin ) {
+ if ( !empty($redirect) )
+ $redirect = add_query_arg('plugin', $plugin, $redirect);
+ $result = activate_plugin($plugin, $redirect);
+ if ( is_wp_error($result) )
+ $errors[$plugin] = $result;
+ }
- update_option('deactivated_plugins', $current);
+ if ( !empty($errors) )
+ return new WP_Error('plugins_invalid', __('One of the plugins is invalid.'), $errors);
+
+ return true;
}
-function reactivate_all_plugins($redirect = '') {
- $plugins = get_option('deactivated_plugins');
+function delete_plugins($plugins, $redirect = '' ) {
+ global $wp_filesystem;
- if ( empty($plugins) )
+ if( empty($plugins) )
+ return false;
+
+ $checked = array();
+ foreach( $plugins as $plugin )
+ $checked[] = 'checked[]=' . $plugin;
+
+ ob_start();
+ $url = wp_nonce_url('plugins.php?action=delete-selected&' . implode('&', $checked), 'mass-manage-plugins');
+ if ( false === ($credentials = request_filesystem_credentials($url)) ) {
+ $data = ob_get_contents();
+ ob_end_clean();
+ if( ! empty($data) ){
+ include_once( ABSPATH . 'wp-admin/admin-header.php');
+ echo $data;
+ include( ABSPATH . 'wp-admin/admin-footer.php');
+ exit;
+ }
return;
+ }
- if ( !empty($redirect) )
- wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect));
+ if ( ! WP_Filesystem($credentials) ) {
+ request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again
+ $data = ob_get_contents();
+ ob_end_clean();
+ if( ! empty($data) ){
+ include_once( ABSPATH . 'wp-admin/admin-header.php');
+ echo $data;
+ include( ABSPATH . 'wp-admin/admin-footer.php');
+ exit;
+ }
+ return;
+ }
- $errors = array();
- foreach ( (array) $plugins as $plugin ) {
- $result = activate_plugin($plugin);
- if ( is_wp_error($result) )
- $errors[$plugin] = $result;
+ if ( $wp_filesystem->errors->get_error_code() ) {
+ return $wp_filesystem->errors;
}
- delete_option('deactivated_plugins');
+ if ( ! is_object($wp_filesystem) )
+ return new WP_Error('fs_unavailable', __('Could not access filesystem.'));
- if ( !empty($errors) )
- return new WP_Error('plugins_invalid', __('One of the plugins is invalid.'), $errors);
+ if ( $wp_filesystem->errors->get_error_code() )
+ return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);
+
+ //Get the base plugin folder
+ $plugins_dir = $wp_filesystem->wp_plugins_dir();
+ if ( empty($plugins_dir) )
+ return new WP_Error('fs_no_plugins_dir', __('Unable to locate WordPress Plugin directory.'));
+
+ $plugins_dir = trailingslashit( $plugins_dir );
+ $errors = array();
+
+ foreach( $plugins as $plugin_file ) {
+ $this_plugin_dir = trailingslashit( dirname($plugins_dir . $plugin_file) );
+ // If plugin is in its own directory, recursively delete the directory.
+ if ( strpos($plugin_file, '/') && $this_plugin_dir != $plugins_dir ) //base check on if plugin includes directory seperator AND that its not the root plugin folder
+ $deleted = $wp_filesystem->delete($this_plugin_dir, true);
+ else
+ $deleted = $wp_filesystem->delete($plugins_dir . $plugin_file);
+
+ if ( ! $deleted )
+ $errors[] = $plugin_file;
+ }
+
+ if( ! empty($errors) )
+ return new WP_Error('could_not_remove_plugin', sprintf(__('Could not fully remove the plugin(s) %s'), implode(', ', $errors)) );
+
return true;
}
@@ -179,7 +243,7 @@ function validate_active_plugins() {
// If a plugin file does not exist, remove it from the list of active
// plugins.
foreach ( $check_plugins as $check_plugin ) {
- if ( !file_exists(ABSPATH . PLUGINDIR . '/' . $check_plugin) ) {
+ if ( !file_exists(WP_PLUGIN_DIR . '/' . $check_plugin) ) {
$current = get_option('active_plugins');
$key = array_search($check_plugin, $current);
if ( false !== $key && NULL !== $key ) {
@@ -193,7 +257,7 @@ function validate_active_plugins() {
function validate_plugin($plugin) {
if ( validate_file($plugin) )
return new WP_Error('plugin_invalid', __('Invalid plugin.'));
- if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) )
+ if ( ! file_exists(WP_PLUGIN_DIR . '/' . $plugin) )
return new WP_Error('plugin_not_found', __('Plugin file does not exist.'));
return 0;
diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php
index aa1e833..f98b9de 100644
--- a/wp-admin/includes/post.php
+++ b/wp-admin/includes/post.php
@@ -1,30 +1,19 @@
<?php
-// Update an existing post with values provided in $_POST.
-function edit_post() {
-
- $post_ID = (int) $_POST['post_ID'];
-
- if ( 'page' == $_POST['post_type'] ) {
- if ( !current_user_can( 'edit_page', $post_ID ) )
- wp_die( __('You are not allowed to edit this page.' ));
- } else {
- if ( !current_user_can( 'edit_post', $post_ID ) )
- wp_die( __('You are not allowed to edit this post.' ));
- }
-
- // Autosave shouldn't save too soon after a real save
- if ( 'autosave' == $_POST['action'] ) {
- $post =& get_post( $post_ID );
- $now = time();
- $then = strtotime($post->post_date_gmt . ' +0000');
- $delta = AUTOSAVE_INTERVAL / 2;
- if ( ($now - $then) < $delta )
- return $post_ID;
- }
-
- // Rename.
- $_POST['ID'] = (int) $_POST['post_ID'];
+/**
+ * _wp_translate_postdata() - Rename $_POST data from form names to DB post columns.
+ *
+ * Manipulates $_POST directly.
+ *
+ * @package WordPress
+ * @since 2.6
+ *
+ * @param bool $update Are we updating a pre-existing post?
+ * @return object|bool WP_Error on failure, true on success.
+ */
+function _wp_translate_postdata( $update = false ) {
+ if ( $update )
+ $_POST['ID'] = (int) $_POST['post_ID'];
$_POST['post_content'] = $_POST['content'];
$_POST['post_excerpt'] = $_POST['excerpt'];
$_POST['post_parent'] = isset($_POST['parent_id'])? $_POST['parent_id'] : '';
@@ -32,21 +21,29 @@ function edit_post() {
if (!empty ( $_POST['post_author_override'] ) ) {
$_POST['post_author'] = (int) $_POST['post_author_override'];
- } else
+ } else {
if (!empty ( $_POST['post_author'] ) ) {
$_POST['post_author'] = (int) $_POST['post_author'];
} else {
$_POST['post_author'] = (int) $_POST['user_ID'];
}
+ }
if ( $_POST['post_author'] != $_POST['user_ID'] ) {
if ( 'page' == $_POST['post_type'] ) {
- if ( !current_user_can( 'edit_others_pages' ) )
- wp_die( __('You are not allowed to edit pages as this user.' ));
+ if ( !current_user_can( 'edit_others_pages' ) ) {
+ return new WP_Error( 'edit_others_pages', $update ?
+ __( 'You are not allowed to edit pages as this user.' ) :
+ __( 'You are not allowed to create pages as this user.' )
+ );
+ }
} else {
- if ( !current_user_can( 'edit_others_posts' ) )
- wp_die( __('You are not allowed to edit posts as this user.' ));
-
+ if ( !current_user_can( 'edit_others_posts' ) ) {
+ return new WP_Error( 'edit_others_posts', $update ?
+ __( 'You are not allowed to edit posts as this user.' ) :
+ __( 'You are not allowed to post as this user.' )
+ );
+ }
}
}
@@ -60,12 +57,20 @@ function edit_post() {
if ( isset($_POST['advanced']) && '' != $_POST['advanced'] )
$_POST['post_status'] = 'draft';
+ $previous_status = get_post_field('post_status', $_POST['ID']);
+
+ // Posts 'submitted for approval' present are submitted to $_POST the same as if they were being published.
+ // Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts.
if ( 'page' == $_POST['post_type'] ) {
- if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_pages' ))
- $_POST['post_status'] = 'pending';
+ if ( 'publish' == $_POST['post_status'] && !current_user_can( 'publish_pages' ) )
+ if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_pages') )
+ $_POST['post_status'] = 'pending';
} else {
- if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' ))
- $_POST['post_status'] = 'pending';
+ if ( 'publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' ) ) :
+ // Stop attempts to publish new posts, but allow already published posts to be saved if appropriate.
+ if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_posts') )
+ $_POST['post_status'] = 'pending';
+ endif;
}
if (!isset( $_POST['comment_status'] ))
@@ -74,14 +79,14 @@ function edit_post() {
if (!isset( $_POST['ping_status'] ))
$_POST['ping_status'] = 'closed';
- foreach ( array ('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) {
+ foreach ( array('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) {
if ( !empty( $_POST['hidden_' . $timeunit] ) && $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) {
$_POST['edit_date'] = '1';
break;
}
}
- if (!empty ( $_POST['edit_date'] ) ) {
+ if ( !empty( $_POST['edit_date'] ) ) {
$aa = $_POST['aa'];
$mm = $_POST['mm'];
$jj = $_POST['jj'];
@@ -92,10 +97,41 @@ function edit_post() {
$hh = ($hh > 23 ) ? $hh -24 : $hh;
$mn = ($mn > 59 ) ? $mn -60 : $mn;
$ss = ($ss > 59 ) ? $ss -60 : $ss;
- $_POST['post_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
- $_POST['post_date_gmt'] = get_gmt_from_date( "$aa-$mm-$jj $hh:$mn:$ss" );
+ $_POST['post_date'] = sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $aa, $mm, $jj, $hh, $mn, $ss );
+ $_POST['post_date_gmt'] = get_gmt_from_date( $_POST['post_date'] );
+ }
+
+ return true;
+}
+
+
+// Update an existing post with values provided in $_POST.
+function edit_post() {
+
+ $post_ID = (int) $_POST['post_ID'];
+
+ if ( 'page' == $_POST['post_type'] ) {
+ if ( !current_user_can( 'edit_page', $post_ID ) )
+ wp_die( __('You are not allowed to edit this page.' ));
+ } else {
+ if ( !current_user_can( 'edit_post', $post_ID ) )
+ wp_die( __('You are not allowed to edit this post.' ));
}
+ // Autosave shouldn't save too soon after a real save
+ if ( 'autosave' == $_POST['action'] ) {
+ $post =& get_post( $post_ID );
+ $now = time();
+ $then = strtotime($post->post_date_gmt . ' +0000');
+ $delta = AUTOSAVE_INTERVAL / 2;
+ if ( ($now - $then) < $delta )
+ return $post_ID;
+ }
+
+ $translated = _wp_translate_postdata( true );
+ if ( is_wp_error($translated) )
+ wp_die( $translated->get_error_message() );
+
// Meta Stuff
if ( isset($_POST['meta']) && $_POST['meta'] ) {
foreach ( $_POST['meta'] as $key => $value )
@@ -194,13 +230,13 @@ function post_exists($title, $content = '', $post_date = '') {
global $wpdb;
if (!empty ($post_date))
- $post_date = "AND post_date = '$post_date'";
+ $post_date = $wpdb->prepare("AND post_date = %s", $post_date);
if (!empty ($title))
- return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' $post_date");
+ return $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_title = %s $post_date", $title) );
else
if (!empty ($content))
- return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_content = '$content' $post_date");
+ return $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_content = %s $post_date", $content) );
return 0;
}
@@ -236,79 +272,9 @@ function wp_write_post() {
}
}
- // Rename.
- $_POST['post_content'] = $_POST['content'];
- $_POST['post_excerpt'] = $_POST['excerpt'];
- $_POST['post_parent'] = isset($_POST['parent_id'])? $_POST['parent_id'] : '';
- $_POST['to_ping'] = $_POST['trackback_url'];
-
- if (!empty ( $_POST['post_author_override'] ) ) {
- $_POST['post_author'] = (int) $_POST['post_author_override'];
- } else {
- if (!empty ( $_POST['post_author'] ) ) {
- $_POST['post_author'] = (int) $_POST['post_author'];
- } else {
- $_POST['post_author'] = (int) $_POST['user_ID'];
- }
-
- }
-
- if ( $_POST['post_author'] != $_POST['user_ID'] ) {
- if ( 'page' == $_POST['post_type'] ) {
- if ( !current_user_can( 'edit_others_pages' ) )
- return new WP_Error( 'edit_others_pages', __( 'You are not allowed to create pages as this user.' ) );
- } else {
- if ( !current_user_can( 'edit_others_posts' ) )
- return new WP_Error( 'edit_others_posts', __( 'You are not allowed to post as this user.' ) );
-
- }
- }
-
- // What to do based on which button they pressed
- if ( isset($_POST['saveasdraft']) && '' != $_POST['saveasdraft'] )
- $_POST['post_status'] = 'draft';
- if ( isset($_POST['saveasprivate']) && '' != $_POST['saveasprivate'] )
- $_POST['post_status'] = 'private';
- if ( isset($_POST['publish']) && ( '' != $_POST['publish'] ) && ( $_POST['post_status'] != 'private' ) )
- $_POST['post_status'] = 'publish';
- if ( isset($_POST['advanced']) && '' != $_POST['advanced'] )
- $_POST['post_status'] = 'draft';
-
- if ( 'page' == $_POST['post_type'] ) {
- if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_pages' ) )
- $_POST['post_status'] = 'pending';
- } else {
- if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' ) )
- $_POST['post_status'] = 'pending';
- }
-
- if (!isset( $_POST['comment_status'] ))
- $_POST['comment_status'] = 'closed';
-
- if (!isset( $_POST['ping_status'] ))
- $_POST['ping_status'] = 'closed';
-
- foreach ( array ('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) {
- if ( !empty( $_POST['hidden_' . $timeunit] ) && $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) {
- $_POST['edit_date'] = '1';
- break;
- }
- }
-
- if (!empty ( $_POST['edit_date'] ) ) {
- $aa = $_POST['aa'];
- $mm = $_POST['mm'];
- $jj = $_POST['jj'];
- $hh = $_POST['hh'];
- $mn = $_POST['mn'];
- $ss = $_POST['ss'];
- $jj = ($jj > 31 ) ? 31 : $jj;
- $hh = ($hh > 23 ) ? $hh -24 : $hh;
- $mn = ($mn > 59 ) ? $mn -60 : $mn;
- $ss = ($ss > 59 ) ? $ss -60 : $ss;
- $_POST['post_date'] = sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $aa, $mm, $jj, $hh, $mn, $ss );
- $_POST['post_date_gmt'] = get_gmt_from_date( $_POST['post_date'] );
- }
+ $translated = _wp_translate_postdata( false );
+ if ( is_wp_error($translated) )
+ return $translated;
// Create the post.
$post_ID = wp_insert_post( $_POST );
@@ -380,11 +346,9 @@ function add_meta( $post_ID ) {
wp_cache_delete($post_ID, 'post_meta');
- $wpdb->query( "
- INSERT INTO $wpdb->postmeta
- (post_id,meta_key,meta_value )
- VALUES ('$post_ID','$metakey','$metavalue' )
- " );
+ $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->postmeta
+ (post_id,meta_key,meta_value ) VALUES (%s, %s, %s)",
+ $post_ID, $metakey, $metavalue) );
return $wpdb->insert_id;
}
return false;
@@ -394,10 +358,10 @@ function delete_meta( $mid ) {
global $wpdb;
$mid = (int) $mid;
- $post_id = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = '$mid'");
+ $post_id = $wpdb->get_var( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = %d", $mid) );
wp_cache_delete($post_id, 'post_meta');
- return $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_id = '$mid'" );
+ return $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_id = %d", $mid) );
}
// Get a list of previously defined keys
@@ -417,7 +381,7 @@ function get_post_meta_by_id( $mid ) {
global $wpdb;
$mid = (int) $mid;
- $meta = $wpdb->get_row( "SELECT * FROM $wpdb->postmeta WHERE meta_id = '$mid'" );
+ $meta = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE meta_id = %d", $mid) );
if ( is_serialized_string( $meta->meta_value ) )
$meta->meta_value = maybe_unserialize( $meta->meta_value );
return $meta;
@@ -427,29 +391,30 @@ function get_post_meta_by_id( $mid ) {
function has_meta( $postid ) {
global $wpdb;
- return $wpdb->get_results( "
- SELECT meta_key, meta_value, meta_id, post_id
- FROM $wpdb->postmeta
- WHERE post_id = '$postid'
- ORDER BY meta_key,meta_id", ARRAY_A );
+ return $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value, meta_id, post_id
+ FROM $wpdb->postmeta WHERE post_id = %d
+ ORDER BY meta_key,meta_id", $postid), ARRAY_A );
}
-function update_meta( $mid, $mkey, $mvalue ) {
+function update_meta( $meta_id, $meta_key, $meta_value ) {
global $wpdb;
$protected = array( '_wp_attached_file', '_wp_attachment_metadata', '_wp_old_slug', '_wp_page_template' );
- if ( in_array($mkey, $protected) )
+ if ( in_array($meta_key, $protected) )
return false;
- $post_id = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = '$mid'");
+ $post_id = $wpdb->get_var( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = %d", $meta_id) );
wp_cache_delete($post_id, 'post_meta');
- $mvalue = maybe_serialize( stripslashes( $mvalue ));
- $mvalue = $wpdb->escape( $mvalue );
- $mid = (int) $mid;
- return $wpdb->query( "UPDATE $wpdb->postmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'" );
+ $meta_value = maybe_serialize( stripslashes( $meta_value ));
+ $meta_id = (int) $meta_id;
+
+ $data = compact( 'meta_key', 'meta_value' );
+ $where = compact( 'meta_id' );
+
+ return $wpdb->update( $wpdb->postmeta, $data, $where );
}
//
@@ -502,7 +467,7 @@ function _relocate_children( $old_ID, $new_ID ) {
global $wpdb;
$old_ID = (int) $old_ID;
$new_ID = (int) $new_ID;
- return $wpdb->query( "UPDATE $wpdb->posts SET post_parent = $new_ID WHERE post_parent = $old_ID" );
+ return $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = %d WHERE post_parent = %d", $new_ID, $old_ID) );
}
function get_available_post_statuses($type = 'post') {
@@ -631,7 +596,7 @@ function get_sample_permalink($id, $title=null, $name = null) {
$permalink = str_replace('%pagename%', "${uri}%pagename%", $permalink);
}
- $permalink = array($permalink, $post->post_name);
+ $permalink = array($permalink, apply_filters('editable_slug', $post->post_name));
$post->post_status = $original_status;
$post->post_date = $original_date;
$post->post_name = $original_name;
@@ -691,4 +656,28 @@ function wp_set_post_lock( $post_id ) {
update_post_meta( $post->ID, '_edit_last', $current_user->ID );
}
-?>
+/**
+ * wp_create_post_autosave() - creates autosave data for the specified post from $_POST data
+ *
+ * @package WordPress
+ * @subpackage Post Revisions
+ * @since 2.6
+ *
+ * @uses _wp_translate_postdata()
+ * @uses _wp_post_revision_fields()
+ */
+function wp_create_post_autosave( $post_id ) {
+ $translated = _wp_translate_postdata( true );
+ if ( is_wp_error( $translated ) )
+ return $translated;
+
+ // Only store one autosave. If there is already an autosave, overwrite it.
+ if ( $old_autosave = wp_get_post_autosave( $post_id ) ) {
+ $new_autosave = _wp_post_revision_fields( $_POST, true );
+ $new_autosave['ID'] = $old_autosave->ID;
+ return wp_update_post( $new_autosave );
+ }
+
+ // Otherwise create the new autosave as a special post revision
+ return _wp_put_post_revision( $_POST, true );
+}
diff --git a/wp-admin/includes/schema.php b/wp-admin/includes/schema.php
index 2d5ddcf..1e59f0e 100644
--- a/wp-admin/includes/schema.php
+++ b/wp-admin/includes/schema.php
@@ -227,10 +227,13 @@ CREATE TABLE IF NOT EXISTS $wpdb->signups (
";
function populate_options() {
- global $wpdb, $wp_db_version, $wpblog, $current_site;
+ global $wpdb, $wp_db_version, $current_site;
$schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
$guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
+
+ do_action('populate_options');
+
add_option('siteurl', $guessurl);
add_option('blogname', __('My Blog'));
add_option('blogdescription', sprintf(__('Just another %s weblog'), $current_site->site_name ) );
@@ -299,10 +302,10 @@ function populate_options() {
if ( ini_get('safe_mode') ) {
// Safe mode screws up mkdir(), so we must use a flat structure.
add_option('uploads_use_yearmonth_folders', 0);
- add_option('upload_path', 'wp-content');
+ add_option('upload_path', WP_CONTENT_DIR);
} else {
add_option('uploads_use_yearmonth_folders', 1);
- add_option('upload_path', 'wp-content/uploads');
+ add_option('upload_path', WP_CONTENT_DIR . '/uploads');
}
// 2.0.3
@@ -326,8 +329,11 @@ function populate_options() {
add_option('medium_size_w', 300);
add_option('medium_size_h', 300);
+ // 2.6
+ add_option('avatar_default', 'mystery');
+
// Delete unused options
- $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval');
+ $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins');
foreach ($unusedoptions as $option) :
delete_option($option);
endforeach;
@@ -344,6 +350,7 @@ function populate_roles() {
populate_roles_210();
populate_roles_230();
populate_roles_250();
+ populate_roles_260();
}
function populate_roles_160() {
@@ -499,4 +506,15 @@ function populate_roles_250() {
}
}
+function populate_roles_260() {
+ /*
+ $role = get_role( 'administrator' );
+
+ if ( !empty( $role ) ) {
+ $role->add_cap( 'update_plugins' );
+ $role->add_cap( 'delete_plugins' );
+ }
+ */
+}
+
?>
diff --git a/wp-admin/includes/taxonomy.php b/wp-admin/includes/taxonomy.php
index b490ed6..f3c5fcf 100644
--- a/wp-admin/includes/taxonomy.php
+++ b/wp-admin/includes/taxonomy.php
@@ -47,7 +47,7 @@ function wp_delete_category($cat_ID) {
if ( $cat_ID == $default )
return 0;
- return wp_delete_term($cat_ID, 'category', "default=$default");
+ return wp_delete_term($cat_ID, 'category', array('default' => $default));
}
function wp_insert_category($catarr, $wp_error = false) {
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
index 19f11f6..c348e7f 100644
--- a/wp-admin/includes/template.php
+++ b/wp-admin/includes/template.php
@@ -302,7 +302,7 @@ function tag_rows( $page = 1, $pagesize = 20, $searchterms = '' ) {
// define the columns to display, the syntax is 'internal name' => 'display name'
function wp_manage_posts_columns() {
$posts_columns = array();
- $posts_columns['cb'] = '<input type="checkbox" onclick="checkAll(document.getElementById(\'posts-filter\'));" />';
+ $posts_columns['cb'] = '<input type="checkbox" />';
if ( 'draft' === $_GET['post_status'] )
$posts_columns['modified'] = __('Modified');
elseif ( 'pending' === $_GET['post_status'] )
@@ -324,7 +324,7 @@ function wp_manage_posts_columns() {
// define the columns to display, the syntax is 'internal name' => 'display name'
function wp_manage_media_columns() {
$posts_columns = array();
- $posts_columns['cb'] = '<input type="checkbox" onclick="checkAll(document.getElementById(\'posts-filter\'));" />';
+ $posts_columns['cb'] = '<input type="checkbox" />';
$posts_columns['icon'] = '';
$posts_columns['media'] = _c('Media|media column header');
$posts_columns['desc'] = _c('Description|media column header');
@@ -339,7 +339,7 @@ function wp_manage_media_columns() {
function wp_manage_pages_columns() {
$posts_columns = array();
- $posts_columns['cb'] = '<input type="checkbox" onclick="checkAll(document.getElementById(\'posts-filter\'));" />';
+ $posts_columns['cb'] = '<input type="checkbox" />';
if ( 'draft' === $_GET['post_status'] )
$posts_columns['modified'] = __('Modified');
elseif ( 'pending' === $_GET['post_status'] )
@@ -505,7 +505,7 @@ foreach ($posts_columns as $column_name=>$column_display_name) {
*/
function page_rows( $pages ) {
if ( ! $pages )
- $pages = get_pages( 'sort_column=menu_order' );
+ $pages = get_pages( array('sort_column' => 'menu_order') );
if ( ! $pages )
return false;
@@ -717,7 +717,7 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) {
if (!$categories )
- $categories = get_categories( 'hide_empty=0' );
+ $categories = get_categories( array('hide_empty' => 0) );
if ( $categories ) {
foreach ( $categories as $category ) {
@@ -790,8 +790,8 @@ function _list_meta_row( $entry, &$count ) {
$delete_nonce = wp_create_nonce( 'delete-meta_' . $entry['meta_id'] );
$r .= "\n\t<tr id='meta-{$entry['meta_id']}' class='$style'>";
- $r .= "\n\t\t<td valign='top'><input name='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' /></td>";
- $r .= "\n\t\t<td><textarea name='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>";
+ $r .= "\n\t\t<td valign='top'><label class='hidden' for='meta[{$entry['meta_id']}][key]'>" . __( 'Key' ) . "</label><input name='meta[{$entry['meta_id']}][key]' id='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' /></td>";
+ $r .= "\n\t\t<td><label class='hidden' for='meta[{$entry['meta_id']}][value]'>" . __( 'Value' ) . "</label><textarea name='meta[{$entry['meta_id']}][value]' id='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>";
$r .= "\n\t\t<td style='text-align: center;'><input name='updatemeta' type='submit' tabindex='6' value='".attribute_escape(__( 'Update' ))."' class='add:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$update_nonce updatemeta' /><br />";
$r .= "\n\t\t<input name='deletemeta[{$entry['meta_id']}]' type='submit' ";
$r .= "class='delete:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$delete_nonce deletemeta' tabindex='6' value='".attribute_escape(__( 'Delete' ))."' />";
@@ -816,8 +816,8 @@ function meta_form() {
<p><strong><?php _e( 'Add a new custom field:' ) ?></strong></p>
<table id="newmeta" cellspacing="3" cellpadding="3">
<tr>
-<th colspan="2"><?php _e( 'Key' ) ?></th>
-<th><?php _e( 'Value' ) ?></th>
+<th colspan="2"><label <?php if ( $keys ) : ?> for="metakeyselect" <?php else : ?> for="metakeyinput" <?php endif; ?>><?php _e( 'Key' ) ?></label></th>
+<th><label for="metavalue"><?php _e( 'Value' ) ?></label></th>
</tr>
<tr valign="top">
<td style="width: 18%;" class="textright">
@@ -831,7 +831,7 @@ function meta_form() {
echo "\n\t<option value='$key'>$key</option>";
}
?>
-</select> <?php _e( 'or' ); ?>
+</select> <label for="metakeyinput"><?php _e( 'or' ); ?></label>
<?php endif; ?>
</td>
<td><input type="text" id="metakeyinput" name="metakeyinput" tabindex="7" /></td>
@@ -904,7 +904,7 @@ function page_template_dropdown( $default = '' ) {
function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
global $wpdb, $post_ID;
- $items = $wpdb->get_results( "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = $parent AND post_type = 'page' ORDER BY menu_order" );
+ $items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent) );
if ( $items ) {
foreach ( $items as $item ) {
@@ -1057,10 +1057,12 @@ function wp_remember_old_slug() {
* @param string $callback Function that fills the box with the desired content. The function should echo its output.
* @param string $page The type of edit page on which to show the box (post, page, link)
* @param string $context The context within the page where the boxes should show ('normal', 'advanced')
+ * @param string $priority The priority within the context where the boxes should show ('high', 'low')
*/
-function add_meta_box($id, $title, $callback, $page, $context = 'advanced') {
+function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $priority = 'default') {
global $wp_meta_boxes;
+
if ( !isset($wp_meta_boxes) )
$wp_meta_boxes = array();
if ( !isset($wp_meta_boxes[$page]) )
@@ -1068,23 +1070,81 @@ function add_meta_box($id, $title, $callback, $page, $context = 'advanced') {
if ( !isset($wp_meta_boxes[$page][$context]) )
$wp_meta_boxes[$page][$context] = array();
- $wp_meta_boxes[$page][$context][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback);
+ foreach ( array('high', 'core', 'default', 'low') as $a_priority ) {
+ if ( !isset($wp_meta_boxes[$page][$context][$a_priority][$id]) )
+ continue;
+ // If a core box was previously added or removed by a plugin, don't add.
+ if ( 'core' == $priority ) {
+ // If core box previously deleted, don't add
+ if ( false === $wp_meta_boxes[$page][$context][$a_priority][$id] )
+ return;
+ // If box was added with default priority, give it core priority to maintain sort order
+ if ( 'default' == $a_priority ) {
+ $wp_meta_boxes[$page][$context]['core'][$id] = $wp_meta_boxes[$page][$context]['default'][$id];
+ unset($wp_meta_boxes[$page][$context]['default'][$id]);
+ }
+ return;
+ }
+ // If no priority given and id already present, use existing priority
+ if ( empty($priority) )
+ $priority = $a_priority;
+ // An id can be in only one priority
+ if ( $priority != $a_priority )
+ unset($wp_meta_boxes[$page][$context][$a_priority][$id]);
+ }
+
+ if ( empty($priority) )
+ $priority = low;
+
+ if ( !isset($wp_meta_boxes[$page][$context][$priority]) )
+ $wp_meta_boxes[$page][$context][$priority] = array();
+
+ $wp_meta_boxes[$page][$context][$priority][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback);
}
function do_meta_boxes($page, $context, $object) {
global $wp_meta_boxes;
+ do_action('do_meta_boxes', $page, $context, $object);
+
if ( !isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context]) )
return;
- foreach ( (array) $wp_meta_boxes[$page][$context] as $box ) {
- echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . '">' . "\n";
- echo "<h3>{$box['title']}</h3>\n";
- echo '<div class="inside">' . "\n";
- call_user_func($box['callback'], $object, $box);
- echo "</div>\n";
- echo "</div>\n";
+ foreach ( array('high', 'core', 'default', 'low') as $priority ) {
+ foreach ( (array) $wp_meta_boxes[$page][$context][$priority] as $box ) {
+ if ( false === $box )
+ continue;
+ echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . '">' . "\n";
+ echo "<h3>{$box['title']}</h3>\n";
+ echo '<div class="inside">' . "\n";
+ call_user_func($box['callback'], $object, $box);
+ echo "</div>\n";
+ echo "</div>\n";
+ }
}
}
+/**
+ * remove_meta_box() - Remove a meta box from an edit form
+ *
+ * @since 2.6
+ *
+ * @param string $id String for use in the 'id' attribute of tags.
+ * @param string $page The type of edit page on which to show the box (post, page, link)
+ * @param string $context The context within the page where the boxes should show ('normal', 'advanced')
+ */
+function remove_meta_box($id, $page, $context) {
+ global $wp_meta_boxes;
+
+ if ( !isset($wp_meta_boxes) )
+ $wp_meta_boxes = array();
+ if ( !isset($wp_meta_boxes[$page]) )
+ $wp_meta_boxes[$page] = array();
+ if ( !isset($wp_meta_boxes[$page][$context]) )
+ $wp_meta_boxes[$page][$context] = array();
+
+ foreach ( array('high', 'core', 'default', 'low') as $priority )
+ $wp_meta_boxes[$page][$context][$priority][$id] = false;
+}
+
?>
diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php
index 7dae5be..ec670ce 100644
--- a/wp-admin/includes/theme.php
+++ b/wp-admin/includes/theme.php
@@ -33,7 +33,7 @@ function get_page_templates() {
if ( is_array( $templates ) ) {
foreach ( $templates as $template ) {
- $template_data = implode( '', file( ABSPATH.$template ));
+ $template_data = implode( '', file( WP_CONTENT_DIR.$template ));
preg_match( '|Template Name:(.*)$|mi', $template_data, $name );
preg_match( '|Description:(.*)$|mi', $template_data, $description );
diff --git a/wp-admin/includes/update.php b/wp-admin/includes/update.php
index 70d1441..d17298f 100644
--- a/wp-admin/includes/update.php
+++ b/wp-admin/includes/update.php
@@ -119,25 +119,24 @@ function wp_update_plugins() {
}
add_action( 'load-plugins.php', 'wp_update_plugins' );
-function wp_plugin_update_row( $file ) {
- global $plugin_data;
+function wp_plugin_update_row( $file, $plugin_data ) {
$current = get_option( 'update_plugins' );
if ( !isset( $current->response[ $file ] ) )
return false;
$r = $current->response[ $file ];
- echo "<tr><td colspan='5' class='plugin-update'>";
- if ( !current_user_can('edit_plugins') )
+ echo '<tr><td colspan="5" class="plugin-update">';
+ if ( ! current_user_can('update_plugins') )
printf( __('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a>.'), $plugin_data['Name'], $r->url, $r->new_version);
else if ( empty($r->package) )
printf( __('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> <em>automatic upgrade unavailable for this plugin</em>.'), $plugin_data['Name'], $r->url, $r->new_version);
else
- printf( __('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> or <a href="%4$s">upgrade automatically</a>.'), $plugin_data['Name'], $r->url, $r->new_version, wp_nonce_url("update.php?action=upgrade-plugin&amp;plugin=$file", 'upgrade-plugin_' . $file) );
+ printf( __('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> or <a href="%4$s">upgrade automatically</a>.'), $plugin_data['Name'], $r->url, $r->new_version, wp_nonce_url('update.php?action=upgrade-plugin&amp;plugin=' . $file, 'upgrade-plugin_' . $file) );
- echo "</td></tr>";
+ echo '</td></tr>';
}
-add_action( 'after_plugin_row', 'wp_plugin_update_row' );
+add_action( 'after_plugin_row', 'wp_plugin_update_row', 10, 2 );
function wp_update_plugin($plugin, $feedback = '') {
global $wp_filesystem;
@@ -151,7 +150,7 @@ function wp_update_plugin($plugin, $feedback = '') {
return new WP_Error('up_to_date', __('The plugin is at the latest version.'));
// Is a filesystem accessor setup?
- if ( ! $wp_filesystem || !is_object($wp_filesystem) )
+ if ( ! $wp_filesystem || ! is_object($wp_filesystem) )
WP_Filesystem();
if ( ! is_object($wp_filesystem) )
@@ -160,11 +159,18 @@ function wp_update_plugin($plugin, $feedback = '') {
if ( $wp_filesystem->errors->get_error_code() )
return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);
- //Get the Base folder
- $base = $wp_filesystem->get_base_dir();
+ //Get the base plugin folder
+ $plugins_dir = $wp_filesystem->wp_plugins_dir();
+ if ( empty($plugins_dir) )
+ return new WP_Error('fs_no_plugins_dir', __('Unable to locate WordPress Plugin directory.'));
+
+ //And the same for the Content directory.
+ $content_dir = $wp_filesystem->wp_content_dir();
+ if( empty($content_dir) )
+ return new WP_Error('fs_no_content_dir', __('Unable to locate WordPress Content directory (wp-content).'));
- if ( empty($base) )
- return new WP_Error('fs_nowordpress', __('Unable to locate WordPress directory.'));
+ $plugins_dir = trailingslashit( $plugins_dir );
+ $content_dir = trailingslashit( $content_dir );
// Get the URL to the zip file
$r = $current->response[ $plugin ];
@@ -175,12 +181,12 @@ function wp_update_plugin($plugin, $feedback = '') {
// Download the package
$package = $r->package;
apply_filters('update_feedback', sprintf(__('Downloading update from %s'), $package));
- $file = download_url($package);
+ $download_file = download_url($package);
- if ( is_wp_error($file) )
- return new WP_Error('download_failed', __('Download failed.'), $file->get_error_message());
+ if ( is_wp_error($download_file) )
+ return new WP_Error('download_failed', __('Download failed.'), $download_file->get_error_message());
- $working_dir = $base . 'wp-content/upgrade/' . basename($plugin, '.php');
+ $working_dir = $content_dir . 'upgrade/' . basename($plugin, '.php');
// Clean up working directory
if ( $wp_filesystem->is_dir($working_dir) )
@@ -188,16 +194,16 @@ function wp_update_plugin($plugin, $feedback = '') {
apply_filters('update_feedback', __('Unpacking the update'));
// Unzip package to working directory
- $result = unzip_file($file, $working_dir);
+ $result = unzip_file($download_file, $working_dir);
+
+ // Once extracted, delete the package
+ unlink($download_file);
+
if ( is_wp_error($result) ) {
- unlink($file);
$wp_filesystem->delete($working_dir, true);
return $result;
}
- // Once extracted, delete the package
- unlink($file);
-
if ( is_plugin_active($plugin) ) {
//Deactivate the plugin silently, Prevent deactivation hooks from running.
apply_filters('update_feedback', __('Deactivating the plugin'));
@@ -206,25 +212,25 @@ function wp_update_plugin($plugin, $feedback = '') {
// Remove the existing plugin.
apply_filters('update_feedback', __('Removing the old version of the plugin'));
- $plugin_dir = dirname($base . PLUGINDIR . "/$plugin");
- $plugin_dir = trailingslashit($plugin_dir);
+ $this_plugin_dir = trailingslashit( dirname($plugins_dir . $plugin) );
// If plugin is in its own directory, recursively delete the directory.
- if ( strpos($plugin, '/') && $plugin_dir != $base . PLUGINDIR . '/' ) //base check on if plugin includes directory seperator AND that its not the root plugin folder
- $deleted = $wp_filesystem->delete($plugin_dir, true);
+ if ( strpos($plugin, '/') && $this_plugin_dir != $plugins_dir ) //base check on if plugin includes directory seperator AND that its not the root plugin folder
+ $deleted = $wp_filesystem->delete($this_plugin_dir, true);
else
- $deleted = $wp_filesystem->delete($base . PLUGINDIR . "/$plugin");
+ $deleted = $wp_filesystem->delete($plugins_dir . $plugin);
- if ( !$deleted ) {
+ if ( ! $deleted ) {
$wp_filesystem->delete($working_dir, true);
return new WP_Error('delete_failed', __('Could not remove the old plugin'));
}
apply_filters('update_feedback', __('Installing the latest version'));
// Copy new version of plugin into place.
- if ( !copy_dir($working_dir, $base . PLUGINDIR) ) {
+ $result = copy_dir($working_dir, $plugins_dir);
+ if ( is_wp_error($result) ) {
//$wp_filesystem->delete($working_dir, true); //TODO: Uncomment? This DOES mean that the new files are available in the upgrade folder if it fails.
- return new WP_Error('install_failed', __('Installation failed'));
+ return $result;
}
//Get a list of the directories in the working directory before we delete it, We need to know the new folder for the plugin
@@ -237,13 +243,13 @@ function wp_update_plugin($plugin, $feedback = '') {
delete_option('update_plugins');
if( empty($filelist) )
- return false; //We couldnt find any files in the working dir
+ return false; //We couldnt find any files in the working dir, therefor no plugin installed? Failsafe backup.
$folder = $filelist[0];
- $plugin = get_plugins('/' . $folder); //Pass it with a leading slash, search out the plugins in the folder,
+ $plugin = get_plugins('/' . $folder); //Ensure to pass with leading slash
$pluginfiles = array_keys($plugin); //Assume the requested plugin is the first in the list
- return $folder . '/' . $pluginfiles[0]; //Pass it without a leading slash as WP requires
+ return $folder . '/' . $pluginfiles[0];
}
*/
diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php
index 800a86d..1b15aae 100644
--- a/wp-admin/includes/upgrade.php
+++ b/wp-admin/includes/upgrade.php
@@ -1,7 +1,7 @@
<?php
-if ( file_exists(ABSPATH . 'wp-content/install.php') )
- require (ABSPATH . 'wp-content/install.php');
+if ( file_exists(WP_CONTENT_DIR . '/install.php') )
+ require (WP_CONTENT_DIR . '/install.php');
require_once(ABSPATH . 'wp-admin/includes/admin.php');
require_once(ABSPATH . 'wp-admin/includes/schema.php');
@@ -208,6 +208,9 @@ function upgrade_all() {
if ( $wp_current_db_version < 7935 )
upgrade_252();
+ if ( $wp_current_db_version < 8000 )
+ upgrade_260();
+
maybe_disable_automattic_widgets();
$wp_rewrite->flush_rules();
@@ -224,7 +227,7 @@ function upgrade_100() {
foreach($posts as $post) {
if ('' == $post->post_name) {
$newtitle = sanitize_title($post->post_title);
- $wpdb->query("UPDATE $wpdb->posts SET post_name = '$newtitle' WHERE ID = '$post->ID'");
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_name = %s WHERE ID = %d", $newtitle, $post->ID) );
}
}
}
@@ -233,7 +236,7 @@ function upgrade_100() {
foreach ($categories as $category) {
if ('' == $category->category_nicename) {
$newtitle = sanitize_title($category->cat_name);
- $wpdb->query("UPDATE $wpdb->categories SET category_nicename = '$newtitle' WHERE cat_ID = '$category->cat_ID'");
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->categories SET category_nicename = %s WHERE cat_ID = %d", $newtitle, $category->cat_ID) );
}
}
@@ -256,14 +259,12 @@ function upgrade_100() {
if ($allposts) :
foreach ($allposts as $post) {
// Check to see if it's already been imported
- $cat = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post->ID AND category_id = $post->post_category");
+ $cat = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->post2cat WHERE post_id = %d AND category_id = %d", $post->ID, $post->post_category) );
if (!$cat && 0 != $post->post_category) { // If there's no result
- $wpdb->query("
- INSERT INTO $wpdb->post2cat
+ $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->post2cat
(post_id, category_id)
- VALUES
- ('$post->ID', '$post->post_category')
- ");
+ VALUES (%s, %s)
+ ", $post->ID, $post->post_category) );
}
}
endif;
@@ -291,7 +292,7 @@ function upgrade_110() {
foreach ($users as $user) {
if ('' == $user->user_nicename) {
$newname = sanitize_title($user->user_nickname);
- $wpdb->query("UPDATE $wpdb->users SET user_nicename = '$newname' WHERE ID = '$user->ID'");
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->users SET user_nicename = %s WHERE ID = %d", $newname, $user->ID) );
}
}
@@ -407,7 +408,7 @@ function upgrade_130() {
foreach ( $options as $option ) {
if ( 1 != $option->dupes ) { // Could this be done in the query?
$limit = $option->dupes - 1;
- $dupe_ids = $wpdb->get_col("SELECT option_id FROM $wpdb->options WHERE option_name = '$option->option_name' LIMIT $limit");
+ $dupe_ids = $wpdb->get_col( $wpdb->prepare("SELECT option_id FROM $wpdb->options WHERE option_name = %s LIMIT %d", $option->option_name, $limit) );
$dupe_ids = join($dupe_ids, ',');
$wpdb->query("DELETE FROM $wpdb->options WHERE option_id IN ($dupe_ids)");
}
@@ -451,8 +452,7 @@ function upgrade_160_helper( $users ) {
if ($idmode == 'namefl') $id = $user->user_firstname.' '.$user->user_lastname;
if ($idmode == 'namelf') $id = $user->user_lastname.' '.$user->user_firstname;
if (!$idmode) $id = $user->user_nickname;
- $id = $wpdb->escape( $id );
- $wpdb->query("UPDATE $wpdb->users SET display_name = '$id' WHERE ID = '$user->ID'");
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->users SET display_name = %s WHERE ID = %d", $id, $user->ID) );
endif;
// FIXME: RESET_CAPS is temporary code to reset roles and caps if flag is set.
@@ -482,7 +482,7 @@ function upgrade_160() {
$comments = $wpdb->get_results( "SELECT comment_post_ID, COUNT(*) as c FROM $wpdb->comments WHERE comment_approved = '1' GROUP BY comment_post_ID" );
if( is_array( $comments ) ) {
foreach ($comments as $comment) {
- $wpdb->query( "UPDATE $wpdb->posts SET comment_count = $comment->c WHERE ID = '$comment->comment_post_ID'" );
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET comment_count = %d WHERE ID = %d", $comment->c, $comment->comment_post_ID) );
}
}
@@ -491,10 +491,10 @@ function upgrade_160() {
if ( $wp_current_db_version > 2541 && $wp_current_db_version <= 3091 ) {
$objects = $wpdb->get_results("SELECT ID, post_type FROM $wpdb->posts WHERE post_status = 'object'");
foreach ($objects as $object) {
- $wpdb->query("UPDATE $wpdb->posts SET post_status = 'attachment',
- post_mime_type = '$object->post_type',
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_status = 'attachment',
+ post_mime_type = %s,
post_type = ''
- WHERE ID = $object->ID");
+ WHERE ID = %d", $object->post_type, $object->ID) );
$meta = get_post_meta($object->ID, 'imagedata', true);
if ( ! empty($meta['file']) )
@@ -522,7 +522,7 @@ function upgrade_210() {
$type = 'attachment';
}
- $wpdb->query("UPDATE $wpdb->posts SET post_status = '$status', post_type = '$type' WHERE ID = '$post->ID'");
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_status = %s, post_type = %s WHERE ID = %d", $status, $type, $post->ID) );
}
}
@@ -555,45 +555,42 @@ function upgrade_230() {
$categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_ID");
foreach ($categories as $category) {
$term_id = (int) $category->cat_ID;
- $name = $wpdb->escape($category->cat_name);
- $description = $wpdb->escape($category->category_description);
- $slug = $wpdb->escape($category->category_nicename);
- $parent = $wpdb->escape($category->category_parent);
$term_group = 0;
// Associate terms with the same slug in a term group and make slugs unique.
- if ( $exists = $wpdb->get_results("SELECT term_id, term_group FROM $wpdb->terms WHERE slug = '$slug'") ) {
+ if ( $exists = $wpdb->get_results( $wpdb->prepare("SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug) ) ) {
$term_group = $exists[0]->term_group;
$id = $exists[0]->term_id;
$num = 2;
do {
$alt_slug = $slug . "-$num";
$num++;
- $slug_check = $wpdb->get_var("SELECT slug FROM $wpdb->terms WHERE slug = '$alt_slug'");
+ $slug_check = $wpdb->get_var( $wpdb->prepare("SELECT slug FROM $wpdb->terms WHERE slug = %s", $alt_slug) );
} while ( $slug_check );
$slug = $alt_slug;
if ( empty( $term_group ) ) {
$term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms GROUP BY term_group") + 1;
- $wpdb->query("UPDATE $wpdb->terms SET term_group = '$term_group' WHERE term_id = '$id'");
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->terms SET term_group = %d WHERE term_id = %d", $term_group, $id) );
}
}
- $wpdb->query("INSERT INTO $wpdb->terms (term_id, name, slug, term_group) VALUES ('$term_id', '$name', '$slug', '$term_group')");
+ $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->terms (term_id, name, slug, term_group) VALUES
+ (%d, %s, %s, %d)", $term_id, $name, $slug, $term_group) );
$count = 0;
if ( !empty($category->category_count) ) {
$count = (int) $category->category_count;
$taxonomy = 'category';
- $wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('$term_id', '$taxonomy', '$description', '$parent', '$count')");
+ $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count) );
$tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id;
}
if ( !empty($category->link_count) ) {
$count = (int) $category->link_count;
$taxonomy = 'link_category';
- $wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('$term_id', '$taxonomy', '$description', '$parent', '$count')");
+ $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count) );
$tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id;
}
@@ -601,14 +598,14 @@ function upgrade_230() {
$have_tags = true;
$count = (int) $category->tag_count;
$taxonomy = 'post_tag';
- $wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('$term_id', '$taxonomy', '$description', '$parent', '$count')");
+ $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count) );
$tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id;
}
if ( empty($count) ) {
$count = 0;
$taxonomy = 'category';
- $wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('$term_id', '$taxonomy', '$description', '$parent', '$count')");
+ $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count) );
$tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id;
}
}
@@ -628,7 +625,7 @@ function upgrade_230() {
if ( empty($tt_id) )
continue;
- $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ('$post_id', '$tt_id')");
+ $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ( %d, %d)", $post_id, $tt_id) );
}
// < 3570 we used linkcategories. >= 3570 we used categories and link2cat.
@@ -647,20 +644,20 @@ function upgrade_230() {
$term_group = 0;
// Associate terms with the same slug in a term group and make slugs unique.
- if ( $exists = $wpdb->get_results("SELECT term_id, term_group FROM $wpdb->terms WHERE slug = '$slug'") ) {
+ if ( $exists = $wpdb->get_results( $wpdb->prepare("SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug) ) ) {
$term_group = $exists[0]->term_group;
$term_id = $exists[0]->term_id;
}
if ( empty($term_id) ) {
- $wpdb->query("INSERT INTO $wpdb->terms (name, slug, term_group) VALUES ('$name', '$slug', '$term_group')");
+ $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->terms (name, slug, term_group) VALUES (%s, %s, %d)", $name, $slug, $term_group) );
$term_id = (int) $wpdb->insert_id;
}
$link_cat_id_map[$cat_id] = $term_id;
$default_link_cat = $term_id;
- $wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('$term_id', 'link_category', '', '0', '0')");
+ $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES (%d, 'link_category', '', '0', '0')", $term_id) );
$tt_ids[$term_id] = (int) $wpdb->insert_id;
}
@@ -676,7 +673,7 @@ function upgrade_230() {
if ( empty($tt_id) )
continue;
- $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ('$link->link_id', '$tt_id')");
+ $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ( %d, %d)", $link->link_id, $tt_id) );
}
// Set default to the last category we grabbed during the upgrade loop.
@@ -691,7 +688,7 @@ function upgrade_230() {
if ( empty($tt_id) )
continue;
- $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ('$link_id', '$tt_id')");
+ $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ( %d, %d)", $link_id, $tt_id) );
}
}
@@ -704,10 +701,10 @@ function upgrade_230() {
$terms = $wpdb->get_results("SELECT term_taxonomy_id, taxonomy FROM $wpdb->term_taxonomy");
foreach ( (array) $terms as $term ) {
if ( ('post_tag' == $term->taxonomy) || ('category' == $term->taxonomy) )
- $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status = 'publish' AND post_type = 'post' AND term_taxonomy_id = '$term->term_taxonomy_id'");
+ $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status = 'publish' AND post_type = 'post' AND term_taxonomy_id = %d", $term->term_taxonomy_id) );
else
- $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = '$term->term_taxonomy_id'");
- $wpdb->query("UPDATE $wpdb->term_taxonomy SET count = '$count' WHERE term_taxonomy_id = '$term->term_taxonomy_id'");
+ $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term->term_taxonomy_id) );
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET count = %d WHERE term_taxonomy_id = %d", $count, $term->term_taxonomy_id) );
}
}
@@ -756,6 +753,10 @@ function upgrade_252() {
$wpdb->query("UPDATE $wpdb->users SET user_activation_key = ''");
}
+function upgrade_260() {
+ populate_roles_260();
+}
+
// The functions we use to actually do stuff
// General
@@ -850,7 +851,7 @@ function __get_option($setting) {
return preg_replace( '|/+$|', '', constant( 'WP_SITEURL' ) );
}
- $option = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = '$setting'");
+ $option = $wpdb->get_var( $wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s", $setting) );
if ( 'home' == $setting && '' == $option )
return __get_option('siteurl');
@@ -1100,7 +1101,7 @@ function make_db_current_silent() {
function make_site_theme_from_oldschool($theme_name, $template) {
$home_path = get_home_path();
- $site_dir = ABSPATH . "wp-content/themes/$template";
+ $site_dir = WP_CONTENT_DIR . "/themes/$template";
if (! file_exists("$home_path/index.php"))
return false;
@@ -1119,7 +1120,7 @@ function make_site_theme_from_oldschool($theme_name, $template) {
if ($oldfile == 'index.php') { // Check to make sure it's not a new index
$index = implode('', file("$oldpath/$oldfile"));
if (strpos($index, 'WP_USE_THEMES') !== false) {
- if (! @copy(ABSPATH . 'wp-content/themes/default/index.php', "$site_dir/$newfile"))
+ if (! @copy(WP_CONTENT_DIR . '/themes/default/index.php', "$site_dir/$newfile"))
return false;
continue; // Don't copy anything
}
@@ -1167,8 +1168,8 @@ function make_site_theme_from_oldschool($theme_name, $template) {
}
function make_site_theme_from_default($theme_name, $template) {
- $site_dir = ABSPATH . "wp-content/themes/$template";
- $default_dir = ABSPATH . 'wp-content/themes/default';
+ $site_dir = WP_CONTENT_DIR . "/themes/$template";
+ $default_dir = WP_CONTENT_DIR . '/themes/default';
// Copy files from the default theme to the site theme.
//$files = array('index.php', 'comments.php', 'comments-popup.php', 'footer.php', 'header.php', 'sidebar.php', 'style.css');
@@ -1226,7 +1227,7 @@ function make_site_theme() {
// Name the theme after the blog.
$theme_name = __get_option('blogname');
$template = sanitize_title($theme_name);
- $site_dir = ABSPATH . "wp-content/themes/$template";
+ $site_dir = WP_CONTENT_DIR . "/themes/$template";
// If the theme already exists, nothing to do.
if ( is_dir($site_dir)) {
@@ -1234,7 +1235,7 @@ function make_site_theme() {
}
// We must be able to write to the themes dir.
- if (! is_writable(ABSPATH . "wp-content/themes")) {
+ if (! is_writable(WP_CONTENT_DIR . "/themes")) {
return false;
}
diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php
index d25404f..4c02592 100644
--- a/wp-admin/includes/user.php
+++ b/wp-admin/includes/user.php
@@ -140,12 +140,8 @@ function edit_user( $user_id = 0 ) {
function get_author_user_ids() {
global $wpdb;
- // wpmu site admins don't have user_levels
- $level_key = $wpdb->prefix . 'capabilities';
-
- $query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key' AND meta_value != '0'";
-
- return $wpdb->get_col( $query );
+ $level_key = $wpdb->prefix . 'capabilities'; // wpmu site admins don't have user_levels
+ return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) );
}
function get_editable_authors( $user_id ) {
@@ -175,10 +171,9 @@ function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
return false;
}
- // wpmu site admins don't have user_levels
- $level_key = $wpdb->prefix . 'capabilities';
+ $level_key = $wpdb->prefix . 'capabilities'; // wpmu site admins don't have user_levels
- $query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key'";
+ $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key);
if ( $exclude_zeros )
$query .= " AND meta_value != 'a:1:{s:10:\"subscriber\";b:1;}'";
@@ -187,12 +182,9 @@ function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
function get_nonauthor_user_ids() {
global $wpdb;
- // wpmu site admins don't have user_levels
- $level_key = $wpdb->prefix . 'capabilities';
+ $level_key = $wpdb->prefix . 'capabilities'; // wpmu site admins don't have user_levels
- $query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key' AND meta_value = '0'";
-
- return $wpdb->get_col( $query );
+ return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) );
}
function get_others_unpublished_posts($user_id, $type='any') {
@@ -211,7 +203,7 @@ function get_others_unpublished_posts($user_id, $type='any') {
$other_unpubs = '';
} else {
$editable = join(',', $editable);
- $other_unpubs = $wpdb->get_results("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != '$user_id' ORDER BY post_modified $dir");
+ $other_unpubs = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified $dir", $user_id) );
}
return apply_filters('get_others_drafts', $other_unpubs);
@@ -244,8 +236,7 @@ function get_user_to_edit( $user_id ) {
function get_users_drafts( $user_id ) {
global $wpdb;
- $user_id = (int) $user_id;
- $query = "SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = $user_id ORDER BY post_modified DESC";
+ $query = $wpdb->prepare("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = %d ORDER BY post_modified DESC", $user_id);
$query = apply_filters('get_users_drafts', $query);
return $wpdb->get_results( $query );
}
@@ -256,7 +247,7 @@ function wp_delete_user($id, $reassign = 'novalue') {
$id = (int) $id;
if ($reassign == 'novalue') {
- $post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_author = $id");
+ $post_ids = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id) );
if ($post_ids) {
foreach ($post_ids as $post_id)
@@ -264,11 +255,11 @@ function wp_delete_user($id, $reassign = 'novalue') {
}
// Clean links
- $wpdb->query("DELETE FROM $wpdb->links WHERE link_owner = $id");
+ $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->links WHERE link_owner = %d", $id) );
} else {
$reassign = (int) $reassign;
- $wpdb->query("UPDATE $wpdb->posts SET post_author = {$reassign} WHERE post_author = {$id}");
- $wpdb->query("UPDATE $wpdb->links SET link_owner = {$reassign} WHERE link_owner = {$id}");
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $id) );
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d}", $reassign, $id) );
}
// FINALLY, delete user
@@ -325,7 +316,7 @@ class WP_User_Search {
function prepare_query() {
global $wpdb;
$this->first_user = ($this->page - 1) * $this->users_per_page;
- $this->query_limit = ' LIMIT ' . $this->first_user . ',' . $this->users_per_page;
+ $this->query_limit = $wpdb->prepare(" LIMIT %d, %d", $this->first_user, $this->users_per_page);
$this->query_sort = ' ORDER BY user_login';
$search_sql = '';
if ( $this->search_term ) {
@@ -339,7 +330,7 @@ class WP_User_Search {
$this->query_from_where = "FROM $wpdb->users";
if ( $this->role )
- $this->query_from_where .= " INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id WHERE $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE '%$this->role%'";
+ $this->query_from_where .= $wpdb->prepare(" INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id WHERE $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE %s", '%' . $this->role . '%');
else
$this->query_from_where .= ", $wpdb->usermeta WHERE $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '{$wpdb->prefix}capabilities'";
$this->query_from_where .= " $search_sql";
diff --git a/wp-admin/includes/widgets.php b/wp-admin/includes/widgets.php
index 09936b7..79a4f1a 100644
--- a/wp-admin/includes/widgets.php
+++ b/wp-admin/includes/widgets.php
@@ -102,7 +102,7 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
<li id="widget-list-item-<?php echo attribute_escape( $widget['id'] ); ?>" class="widget-list-item">
<h4 class="widget-title widget-draggable">
- <?php echo $widget_title; ?>
+ <span><?php echo $widget_title; ?></span>
<?php if ( 'add' == $action ) : ?>
@@ -116,6 +116,8 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
<?php endif; ?>
+ <br class="clear" />
+
</h4>
@@ -228,7 +230,7 @@ function wp_widget_control( $sidebar_args ) {
echo $sidebar_args['before_widget'];
?>
<div class="widget-top">
- <h4 class="widget-title"><?php echo $widget_title ?>
+ <h4 class="widget-title"><span><?php echo $widget_title ?></span>
<?php if ( $edit ) : ?>
@@ -240,6 +242,8 @@ function wp_widget_control( $sidebar_args ) {
<?php endif; ?>
+ <br class="clear" />
+
</h4></div>
<div class="widget-control"<?php if ( $edit ) echo ' style="display: block;"'; ?>>
@@ -282,10 +286,4 @@ function wp_widget_control_ob_filter( $string ) {
return trim( wp_specialchars( strip_tags( $string ) ) );
}
-function widget_css() {
- wp_admin_css( 'css/widgets' );
-}
-
-add_action( 'admin_head', 'widget_css' );
-
?>
diff --git a/wp-admin/index.php b/wp-admin/index.php
index 15bc950..3a10bcf 100644
--- a/wp-admin/index.php
+++ b/wp-admin/index.php
@@ -26,12 +26,8 @@ jQuery(function($) {
}
add_action( 'admin_head', 'index_js' );
-function index_css() {
- wp_admin_css( 'css/dashboard' );
-}
-add_action( 'admin_head', 'index_css' );
-
wp_enqueue_script( 'jquery' );
+wp_admin_css( 'dashboard' );
$title = __('Dashboard');
$parent_file = 'index.php';
@@ -110,13 +106,12 @@ if ( $can_switch_themes = current_user_can( 'switch_themes' ) )
$widgets_text = "<a href='widgets.php'>$widgets_text</a>";
?>
<p class="youare">
- <?php printf( __( 'You are using %1$s theme with %2$s.' ), $ct->title, $widgets_text ); ?>
+ <?php printf( __( 'You are using the %1$s theme with %2$s.' ), $ct->title, $widgets_text ); ?>
<?php if ( $can_switch_themes ) : ?>
<a href="themes.php" class="rbutton"><?php _e('Change Theme'); ?></a>
<?php endif; ?>
<?php update_right_now_message(); ?>
</p>
-
<?php do_action( 'rightnow_end' ); ?>
<?php do_action( 'activity_box_end' ); ?>
</div><!-- rightnow -->
diff --git a/wp-admin/install-helper.php b/wp-admin/install-helper.php
index d124b1a..8f04418 100644
--- a/wp-admin/install-helper.php
+++ b/wp-admin/install-helper.php
@@ -1,5 +1,6 @@
<?php
-require_once(dirname(dirname(__FILE__)).'/wp-config.php');
+$wp_only_load_config = true;
+require_once(dirname(dirname(__FILE__)).'/wp-load.php');
$debug = 0;
/**
diff --git a/wp-admin/js/forms.js b/wp-admin/js/forms.js
index 6cb2cb7..39ec66b 100644
--- a/wp-admin/js/forms.js
+++ b/wp-admin/js/forms.js
@@ -1,31 +1,26 @@
-function checkAll(form) {
- for (i = 0, n = form.elements.length; i < n; i++) {
- if(form.elements[i].type == "checkbox" && !(form.elements[i].getAttribute('onclick',2))) {
- if(form.elements[i].checked == true)
- form.elements[i].checked = false;
- else
- form.elements[i].checked = true;
- }
- }
+function checkAll(jQ) { // use attr( checked, fn )
+ jQuery(jQ).find( 'tbody :checkbox' ).attr( 'checked', function() {
+ return jQuery(this).attr( 'checked' ) ? '' : 'checked';
+ } );
}
-function getNumChecked(form) {
- var num = 0;
- for (i = 0, n = form.elements.length; i < n; i++) {
- if (form.elements[i].type == "checkbox") {
- if (form.elements[i].checked == true)
- num++;
+jQuery( function($) {
+ var lastClicked = false;
+ $( 'tbody :checkbox' ).click( function(e) {
+ if ( 'undefined' == e.shiftKey ) { return true; }
+ if ( e.shiftKey ) {
+ if ( !lastClicked ) { return true; }
+ var checks = $( lastClicked ).parents( 'form:first' ).find( ':checkbox' );
+ var first = checks.index( lastClicked );
+ var last = checks.index( this );
+ if ( 0 < first && 0 < last && first != last ) {
+ checks.slice( first, last ).attr( 'checked', $( this ).is( ':checked' ) ? 'checked' : '' );
+ }
}
- }
- return num;
-}
-
-function checkAllUsers(role) {
- var checkboxs = document.getElementsByTagName('input');
- for(var i = 0, inp; inp = checkboxs[i]; i++)
- if(inp.type.toLowerCase() == 'checkbox' && inp.className == role)
- if(inp.checked == false)
- inp.checked = true;
- else
- inp.checked = false;
-}
+ lastClicked = this;
+ return true;
+ } );
+ $( 'thead :checkbox' ).click( function() {
+ checkAll( $(this).parents( 'form:first' ) );
+ } );
+} );
diff --git a/wp-admin/js/gallery.js b/wp-admin/js/gallery.js
new file mode 100644
index 0000000..aae0221
--- /dev/null
+++ b/wp-admin/js/gallery.js
@@ -0,0 +1,20 @@
+jQuery(function($) {
+ var gallerySortable;
+ var gallerySortableInit = function() {
+ gallerySortable = $('#media-items').sortable( {
+ items: '.media-item',
+ placeholder: 'sorthelper',
+ update: galleryReorder
+ } );
+ }
+
+ // When an update has occurred, adjust the order for each item
+ var galleryReorder = function(e, sort) {
+ jQuery.each(sort['instance'].toArray(), function(i, id) {
+ jQuery('#' + id + ' .menu_order input')[0].value = i;
+ });
+ }
+
+ // initialize sortable
+ gallerySortableInit();
+});
diff --git a/wp-admin/js/media-upload.js b/wp-admin/js/media-upload.js
index 506faf8..8c88270 100644
--- a/wp-admin/js/media-upload.js
+++ b/wp-admin/js/media-upload.js
@@ -21,7 +21,10 @@ jQuery(function($) {
if ( tbWindow.size() ) {
tbWindow.width( W - 50 ).height( H - 45 );
$('#TB_iframeContent').width( W - 50 ).height( H - 75 );
- tbWindow.css({marginLeft: '-' + parseInt((( W - 50 ) / 2),10) + 'px'});
+ tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'});
+ if ( ! ( $.browser.msie && $.browser.version.substr(0,1) < 7 ) )
+ tbWindow.css({'top':'20px','margin-top':'0'});
+ $('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
};
return $('a.thickbox').each( function() {
@@ -34,6 +37,5 @@ jQuery(function($) {
};
$(window).resize( function() { tb_position() } );
- $(document).ready( function() { tb_position() } );
});
diff --git a/wp-admin/js/post.js b/wp-admin/js/post.js
index 9b3313c..a81fc81 100644
--- a/wp-admin/js/post.js
+++ b/wp-admin/js/post.js
@@ -18,6 +18,8 @@ function new_tag_remove_tag() {
}
function tag_update_quickclicks() {
+ if ( jQuery( '#tags-input' ).length == 0 )
+ return;
var current_tags = jQuery( '#tags-input' ).val().split(',');
jQuery( '#tagchecklist' ).empty();
shown = false;
diff --git a/wp-admin/js/theme-preview.js b/wp-admin/js/theme-preview.js
new file mode 100644
index 0000000..43b01cd
--- /dev/null
+++ b/wp-admin/js/theme-preview.js
@@ -0,0 +1,44 @@
+
+jQuery(function($) {
+ if ( 'undefined' == typeof $.fn.pngFix )
+ $.fn.pngFix = function() { return this; }
+
+ var thickDims = function() {
+ var tbWindow = $('#TB_window');
+ var H = $(window).height();
+ var W = $(window).width();
+
+ if ( tbWindow.size() ) {
+ tbWindow.width( W - 90 ).height( H - 60 );
+ $('#TB_iframeContent').width( W - 90 ).height( H - 90 );
+ tbWindow.css({'margin-left': '-' + parseInt((( W - 90 ) / 2),10) + 'px'});
+ if ( ! ( $.browser.msie && $.browser.version.substr(0,1) < 7 ) )
+ tbWindow.css({'top':'30px','margin-top':'0'});
+ };
+
+ return $('a.thickbox').each( function() {
+ var href = $(this).parents('.available-theme').find('.previewlink').attr('href');
+ if ( ! href ) return;
+ href = href.replace(/&width=[0-9]+/g, '');
+ href = href.replace(/&height=[0-9]+/g, '');
+ $(this).attr( 'href', href + '&width=' + ( W - 110 ) + '&height=' + ( H - 100 ) );
+ });
+ };
+
+ thickDims()
+ .click( function() {
+ var alink = $(this).parents('.available-theme').find('.activatelink');
+ var url = alink.attr('href');
+ var text = alink.html();
+
+ $('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
+ $('#TB_closeAjaxWindow').css({'float':'left'});
+ $('#TB_ajaxWindowTitle').css({'float':'right'})
+ .append('&nbsp;<a href="' + url + '" target="_top" class="tb-theme-preview-link">' + text + '</a>');
+
+ $('#TB_iframeContent').width('100%');
+ return false;
+ } );
+
+ $(window).resize( function() { thickDims() } );
+});
diff --git a/wp-admin/js/word-count.js b/wp-admin/js/word-count.js
new file mode 100644
index 0000000..9e3c1df
--- /dev/null
+++ b/wp-admin/js/word-count.js
@@ -0,0 +1,39 @@
+// Word count
+(function(JQ) {
+ wpWordCount = {
+
+ init : function() {
+ var t = this, last = 0, co = JQ('#content');
+
+ JQ('#wp-word-count').html( wordCountL10n.count.replace( /%d/, '<span id="word-count">0</span>' ) );
+ t.block = 0;
+ t.wc(co.val());
+ co.keyup( function(e) {
+ if ( e.keyCode == last ) return true;
+ if ( 13 == e.keyCode || 8 == last || 46 == last ) t.wc(co.val());
+ last = e.keyCode;
+ return true;
+ });
+ },
+
+ wc : function(tx) {
+ var t = this, w = JQ('#word-count'), tc = 0;
+
+ if ( t.block ) return;
+ t.block = 1;
+
+ setTimeout( function() {
+ if ( tx ) {
+ tx = tx.replace( /<.[^<>]*?>/g, ' ' ).replace( /&nbsp;/gi, ' ' );
+ tx = tx.replace( /[0-9.(),;:!?%#$¿'"_+=\\/-]*/g, '' );
+ tx.replace( /\S\s+/g, function(){tc++;} );
+ }
+ w.html(tc.toString());
+
+ setTimeout( function() { t.block = 0; }, 2000 );
+ }, 1 );
+ }
+ }
+}(jQuery));
+
+jQuery(document).ready( function(){ wpWordCount.init(); } );
diff --git a/wp-admin/js/wp-gears.js b/wp-admin/js/wp-gears.js
new file mode 100644
index 0000000..22b5c00
--- /dev/null
+++ b/wp-admin/js/wp-gears.js
@@ -0,0 +1,83 @@
+
+wpGears = {
+
+ createStore : function() {
+ if ( 'undefined' == typeof google || ! google.gears ) return;
+
+ if ( 'undefined' == typeof localServer )
+ localServer = google.gears.factory.create("beta.localserver");
+
+ store = localServer.createManagedStore(this.storeName());
+ store.manifestUrl = "gears-manifest.php";
+ store.checkForUpdate();
+ this.message();
+ },
+
+ getPermission : function() {
+ if ( 'undefined' != typeof google && google.gears ) {
+ if ( ! google.gears.factory.hasPermission )
+ google.gears.factory.getPermission( 'WordPress', 'images/logo.gif' );
+
+ try {
+ this.createStore();
+ } catch(e) {} // silence if canceled
+ }
+ },
+
+ storeName : function() {
+ var name = window.location.protocol + window.location.host;
+
+ name = name.replace(/[\/\\:*"?<>|;,]+/g, '_'); // gears beta doesn't allow certain chars in the store name
+ name = 'wp_' + name.substring(0, 60); // max length of name is 64 chars
+
+ return name;
+ },
+
+ message : function(show) {
+ var t = this, msg1 = t.I('gears-msg1'), msg2 = t.I('gears-msg2'), msg3 = t.I('gears-msg3'), num = t.I('gears-upd-number'), wait = t.I('gears-wait');
+
+ if ( ! msg1 ) return;
+
+ if ( 'undefined' != typeof google && google.gears ) {
+ if ( google.gears.factory.hasPermission ) {
+ msg1.style.display = msg2.style.display = 'none';
+ msg3.style.display = 'block';
+
+ if ( 'undefined' == typeof store )
+ t.createStore();
+
+ store.oncomplete = function(){wait.innerHTML = (' ' + wpGearsL10n.updateCompleted);};
+ store.onerror = function(){wait.innerHTML = (' ' + wpGearsL10n.error + ' ' + store.lastErrorMessage);};
+ store.onprogress = function(e){if(num) num.innerHTML = (' ' + e.filesComplete + ' / ' + e.filesTotal);};
+ } else {
+ msg1.style.display = msg3.style.display = 'none';
+ msg2.style.display = 'block';
+ }
+ }
+
+ if ( show ) t.I('gears-info-box').style.display = 'block';
+ },
+
+ I : function(id) {
+ return document.getElementById(id);
+ }
+}
+
+function gearsInit() {
+ if ( 'undefined' != typeof google && google.gears ) return;
+
+ var gf = false;
+ if ( 'undefined' != typeof GearsFactory ) { // Firefox
+ gf = new GearsFactory();
+ } else { // IE
+ try {
+ gf = new ActiveXObject('Gears.Factory');
+ } catch (e) {}
+ }
+
+ if ( ! gf ) return;
+ if ( 'undefined' == typeof google ) google = {};
+ if ( ! google.gears ) google.gears = { factory : gf };
+}
+
+gearsInit();
diff --git a/wp-admin/link-add.php b/wp-admin/link-add.php
index 20e60fd..c99fe4e 100644
--- a/wp-admin/link-add.php
+++ b/wp-admin/link-add.php
@@ -13,7 +13,6 @@ wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image',
wp_enqueue_script('link');
wp_enqueue_script('xfn');
-wp_enqueue_script('thickbox');
require('admin-header.php');
?>
diff --git a/wp-admin/link-import.php b/wp-admin/link-import.php
index 741a4dd..cefca95 100644
--- a/wp-admin/link-import.php
+++ b/wp-admin/link-import.php
@@ -30,19 +30,19 @@ switch ($step) {
<input type="hidden" name="step" value="1" />
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<div style="width: 48%;" class="alignleft">
-<h3><?php _e('Specify an OPML URL:'); ?></h3>
-<input type="text" name="opml_url" size="50" style="width: 90%;" value="http://" />
+<h3><label for="opml_url"><?php _e('Specify an OPML URL:'); ?></label></h3>
+<input type="text" name="opml_url" id="opml_url" size="50" style="width: 90%;" value="http://" />
</div>
<div style="width: 48%;" class="alignleft">
-<h3><?php _e('Or choose from your local disk:'); ?></h3>
+<h3><label for="userfile"><?php _e('Or choose from your local disk:'); ?></label></h3>
<input id="userfile" name="userfile" type="file" size="30" />
</div>
</div>
-<p style="clear: both; margin-top: 1em;"><?php _e('Now select a category you want to put these links in.') ?><br />
-<?php _e('Category:') ?> <select name="cat_id">
+<p style="clear: both; margin-top: 1em;"><label for="cat_id"><?php _e('Now select a category you want to put these links in.') ?></label><br />
+<?php _e('Category:') ?> <select name="cat_id" id="cat_id">
<?php
$categories = get_terms('link_category', 'get=all');
foreach ($categories as $category) {
diff --git a/wp-admin/link-manager.php b/wp-admin/link-manager.php
index 42ec201..48f59f2 100644
--- a/wp-admin/link-manager.php
+++ b/wp-admin/link-manager.php
@@ -78,6 +78,7 @@ if ( isset($_GET['deleted']) ) {
<h2><?php printf( __( 'Manage Links (<a href="%s">add new</a>)' ), 'link-add.php' ); ?></h2>
<p id="post-search">
+ <label class="hidden" for="post-search-input"><?php _e( 'Search Links' ); ?>:</label>
<input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
<input type="submit" value="<?php _e( 'Search Links' ); ?>" class="button" />
</p>
@@ -141,7 +142,7 @@ if ( $links ) {
<table class="widefat">
<thead>
<tr>
- <th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /></th>
+ <th scope="col" class="check-column"><input type="checkbox" /></th>
<?php foreach($link_columns as $column_display_name) {
echo $column_display_name;
} ?>
diff --git a/wp-admin/link-parse-opml.php b/wp-admin/link-parse-opml.php
index 0e5edf0..1cd27d0 100644
--- a/wp-admin/link-parse-opml.php
+++ b/wp-admin/link-parse-opml.php
@@ -1,5 +1,5 @@
<?php
-require_once('../wp-config.php');
+require_once('../wp-load.php');
// columns we wish to find are: link_url, link_name, link_target, link_description
// we need to map XML attribute names to our columns
diff --git a/wp-admin/link.php b/wp-admin/link.php
index 8766a71..eda242b 100644
--- a/wp-admin/link.php
+++ b/wp-admin/link.php
@@ -85,7 +85,6 @@ switch ($action) {
case 'edit' :
wp_enqueue_script('link');
wp_enqueue_script('xfn');
- wp_enqueue_script('thickbox');
$parent_file = 'edit.php';
$submenu_file = 'link-manager.php';
diff --git a/wp-admin/media.php b/wp-admin/media.php
index 03b3749..150dea7 100644
--- a/wp-admin/media.php
+++ b/wp-admin/media.php
@@ -17,6 +17,12 @@ case 'editattachment' :
$errors = media_upload_form_handler();
+
+ check_admin_referer('media-form');
+
+ if ( !current_user_can('edit_post', $attachment_id) )
+ wp_die ( __('You are not allowed to edit this attachment.') );
+
if ( empty($errors) ) {
$location = 'media.php';
if ( $referer = wp_get_original_referer() ) {
@@ -54,7 +60,8 @@ case 'edit' :
add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
wp_enqueue_script( 'wp-ajax-response' );
- add_action('admin_head', 'media_admin_css');
+ wp_admin_css( 'media' );
+
require( 'admin-header.php' );
diff --git a/wp-admin/menu-header.php b/wp-admin/menu-header.php
index 4c0ca13..8179fef 100644
--- a/wp-admin/menu-header.php
+++ b/wp-admin/menu-header.php
@@ -3,6 +3,8 @@ $self = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
$self = preg_replace('|^.*/plugins/|i', '', $self);
$self = preg_replace('|^.*/mu-plugins/|i', '', $self);
+global $menu, $submenu, $parent_file; //For when admin-header is included from within a function.
+
get_admin_page_parent();
// We're going to do this loop three times
diff --git a/wp-admin/moderation.php b/wp-admin/moderation.php
index 6750ac3..46cda95 100644
--- a/wp-admin/moderation.php
+++ b/wp-admin/moderation.php
@@ -1,4 +1,4 @@
<?php
-require_once('../wp-config.php');
+require_once('../wp-load.php');
wp_redirect('edit-comments.php?comment_status=moderated');
?>
diff --git a/wp-admin/options-discussion.php b/wp-admin/options-discussion.php
index 09f380e..ce524f6 100644
--- a/wp-admin/options-discussion.php
+++ b/wp-admin/options-discussion.php
@@ -15,7 +15,7 @@ include('admin-header.php');
<table class="form-table">
<tr valign="top">
<th scope="row"><?php _e('Default article settings') ?></th>
-<td>
+<td><fieldset><legend class="hidden"><?php _e('Default article settings') ?></legend>
<label for="default_pingback_flag">
<input name="default_pingback_flag" type="checkbox" id="default_pingback_flag" value="1" <?php checked('1', get_option('default_pingback_flag')); ?> />
<?php _e('Attempt to notify any blogs linked to from the article (slows down posting.)') ?></label>
@@ -29,11 +29,11 @@ include('admin-header.php');
<?php _e('Allow people to post comments on the article') ?></label>
<br />
<small><em><?php echo '(' . __('These settings may be overridden for individual articles.') . ')'; ?></em></small>
-</td>
+</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('E-mail me whenever') ?></th>
-<td>
+<td><fieldset><legend class="hidden"><?php _e('E-mail me whenever') ?></legend>
<label for="comments_notify">
<input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php checked('1', get_option('comments_notify')); ?> />
<?php _e('Anyone posts a comment') ?> </label>
@@ -41,11 +41,11 @@ include('admin-header.php');
<label for="moderation_notify">
<input name="moderation_notify" type="checkbox" id="moderation_notify" value="1" <?php checked('1', get_option('moderation_notify')); ?> />
<?php _e('A comment is held for moderation') ?> </label>
-</td>
+</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Before a comment appears') ?></th>
-<td>
+<td><fieldset><legend class="hidden"><?php _e('Before a comment appears') ?></legend>
<label for="comment_moderation">
<input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php checked('1', get_option('comment_moderation')); ?> />
<?php _e('An administrator must always approve the comment') ?> </label>
@@ -53,62 +53,98 @@ include('admin-header.php');
<label for="require_name_email"><input type="checkbox" name="require_name_email" id="require_name_email" value="1" <?php checked('1', get_option('require_name_email')); ?> /> <?php _e('Comment author must fill out name and e-mail') ?></label>
<br />
<label for="comment_whitelist"><input type="checkbox" name="comment_whitelist" id="comment_whitelist" value="1" <?php checked('1', get_option('comment_whitelist')); ?> /> <?php _e('Comment author must have a previously approved comment') ?></label>
-</td>
+</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Comment Moderation') ?></th>
-<td>
-<p><?php printf(__('Hold a comment in the queue if it contains %s or more links. (A common characteristic of comment spam is a large number of hyperlinks.)'), '<input name="comment_max_links" type="text" id="comment_max_links" size="3" value="' . get_option('comment_max_links'). '" />' ) ?></p>
+<td><fieldset><legend class="hidden"><?php _e('Comment Moderation') ?></legend>
+<p><label for="comment_max_links"><?php printf(__('Hold a comment in the queue if it contains %s or more links. (A common characteristic of comment spam is a large number of hyperlinks.)'), '<input name="comment_max_links" type="text" id="comment_max_links" size="3" value="' . get_option('comment_max_links'). '" />' ) ?></label></p>
-<p><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be held in the <a href="edit-comments.php?comment_status=moderated">moderation queue</a>. One word or IP per line. It will match inside words, so "press" will match "WordPress".') ?></p>
+<p><label for="moderation_keys"><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be held in the <a href="edit-comments.php?comment_status=moderated">moderation queue</a>. One word or IP per line. It will match inside words, so "press" will match "WordPress".') ?></label></p>
<p>
<textarea name="moderation_keys" cols="60" rows="10" id="moderation_keys" style="width: 98%; font-size: 12px;" class="code"><?php form_option('moderation_keys'); ?></textarea>
</p>
-</td>
+</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Comment Blacklist') ?></th>
-<td>
-<p><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be marked as spam. One word or IP per line. It will match inside words, so "press" will match "WordPress".') ?></p>
+<td><fieldset><legend class="hidden"><?php _e('Comment Blacklist') ?></legend>
+<p><label for="blacklist_keys"><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be marked as spam. One word or IP per line. It will match inside words, so "press" will match "WordPress".') ?></label></p>
<p>
<textarea name="blacklist_keys" cols="60" rows="10" id="blacklist_keys" style="width: 98%; font-size: 12px;" class="code"><?php form_option('blacklist_keys'); ?></textarea>
</p>
-</td>
+</fieldset></td>
</tr>
</table>
<h3><?php _e('Avatars') ?></h3>
-<p><?php _e('By default WordPress uses <a href="http://gravatar.com/">Gravatars</a> &#8212; short for Globally Recognized Avatars &#8212; for the pictures that show up next to comments. Plugins may override this.'); ?></p>
+<p><?php _e('An avatar is an image that follows you from weblog to weblog appearing beside your name when you comment on avatar enabled sites. Here you can enable the display of avatars for people who comment on your blog.'); ?></p>
<?php // the above would be a good place to link to codex documentation on the gravatar functions, for putting it in themes. anything like that? ?>
<table class="form-table">
<tr valign="top">
-<th scope="row"><?php _e('Avatar display') ?></th>
-<td>
+<th scope="row"><?php _e('Avatar Display') ?></th>
+<td><fieldset><legend class="hidden"><?php _e('Avatar display') ?></legend>
<?php
$yesorno = array(0 => __("Don&#8217;t show Avatars"), 1 => __('Show Avatars'));
foreach ( $yesorno as $key => $value) {
$selected = (get_option('show_avatars') == $key) ? 'checked="checked"' : '';
- echo "\n\t<label><input type='radio' name='show_avatars' value='$key' $selected> $value</label><br />";
+ echo "\n\t<label><input type='radio' name='show_avatars' value='$key' $selected/> $value</label><br />";
}
?>
-</td>
+</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Maximum Rating') ?></th>
-<td>
+<td><fieldset><legend class="hidden"><?php _e('Maximum Rating') ?></legend>
<?php
$ratings = array( 'G' => __('G &#8212; Suitable for all audiences'), 'PG' => __('PG &#8212; Possibly offensive, usually for audiences 13 and above'), 'R' => __('R &#8212; Intended for adult audiences above 17'), 'X' => __('X &#8212; Even more mature than above'));
foreach ($ratings as $key => $rating) :
$selected = (get_option('avatar_rating') == $key) ? 'checked="checked"' : '';
- echo "\n\t<label><input type='radio' name='avatar_rating' value='$key' $selected> $rating</label><br />";
+ echo "\n\t<label><input type='radio' name='avatar_rating' value='$key' $selected/> $rating</label><br />";
endforeach;
?>
-</td>
+</fieldset></td>
+</tr>
+<tr valign="top">
+<th scope="row"><?php _e('Default Avatar') ?></th>
+<td class="defaultavatarpicker"><fieldset><legend class="hidden"><?php _e('Default Avatar') ?></legend>
+
+<?php _e('For users without a custom avatar of their own, you can either display a generic logo or a generated one based on their e-mail address.'); ?><br />
+
+<?php
+$avatar_defaults = array(
+ 'mystery' => __('Mystery Man'),
+ 'blank' => __('Blank'),
+ 'gravatar_default' => __('Gravatar Logo'),
+ 'identicon' => __('Identicon (Generated)'),
+ 'wavatar' => __('Wavatar (Generated)'),
+ 'monsterid' => __('MonsterID (Generated)')
+);
+$avatar_defaults = apply_filters('avatar_defaults', $avatar_defaults);
+$default = get_option('avatar_default');
+if ( empty($default) )
+ $default = 'mystery';
+$size = 32;
+$avatar_list = '';
+foreach ( $avatar_defaults as $default_key => $default_name ) {
+ $selected = ($default == $default_key) ? 'checked="checked" ' : '';
+ $avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='{$default_key}' {$selected}/> ";
+
+ $avatar = get_avatar( $user_email, $size, $default_key );
+ $avatar_list .= preg_replace("/src='(.+?)'/", "src='\$1&amp;forcedefault=1'", $avatar);
+
+ $avatar_list .= ' ' . $default_name . '</label>';
+ $avatar_list .= '<br />';
+}
+echo apply_filters('default_avatar_select', $avatar_list);
+?>
+
+</fieldset></td>
</tr>
</table>
diff --git a/wp-admin/options-general.php b/wp-admin/options-general.php
index 8fdf3ef..d37bcee 100644
--- a/wp-admin/options-general.php
+++ b/wp-admin/options-general.php
@@ -14,33 +14,35 @@ include('./admin-header.php');
<input type='hidden' name='option_page' value='general' />
<table class="form-table">
<tr valign="top">
-<th scope="row"><?php _e('Blog Title') ?></th>
+<th scope="row"><label for="blogname"><?php _e('Blog Title') ?></label></th>
<td><input name="blogname" type="text" id="blogname" value="<?php form_option('blogname'); ?>" size="40" /></td>
</tr>
<tr valign="top">
-<th scope="row"><?php _e('Tagline') ?></th>
+<th scope="row"><label for="blogdescription"><?php _e('Tagline') ?></label></th>
<td><input name="blogdescription" type="text" id="blogdescription" style="width: 95%" value="<?php form_option('blogdescription'); ?>" size="45" />
<br />
<?php _e('In a few words, explain what this blog is about.') ?></td>
</tr>
<tr valign="top">
-<th scope="row"><?php _e('E-mail address') ?> </th>
-<td><input name="new_admin_email" type="text" id="new_admin_email" value="<?php form_option('admin_email'); ?>" size="40" class="code" />
+<tr valign="top">
+<th scope="row"><label for="admin_email"><?php _e('E-mail address') ?> </label></th>
+<td><input name="admin_email" type="text" id="admin_email" value="<?php form_option('admin_email'); ?>" size="40" class="code" />
<br />
-<?php _e('This address is used only for admin purposes.') ?> <?php _e('If you change this we will send you an email at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>') ?></td>
+<?php _e('This address is used for admin purposes.') ?> <?php _e('If you change this we will send you an email at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>') ?></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Membership') ?></th>
-<td> <label for="comment_registration">
-<input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked('1', get_option('comment_registration')); ?> />
+<td>
+<label for="comment_registration">
+<input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked('1', get_option('comment_registration')); ?> />
<?php _e('Users must be registered and logged in to comment') ?>
</label>
</td>
</tr>
<tr>
-<th scope="row"><?php _e('Timezone') ?> </th>
+<th scope="row"><label for="gmt_offset"><?php _e('Timezone') ?> </label></th>
<td>
-<select name="gmt_offset">
+<select name="gmt_offset" id="gmt_offset">
<?php
$current_offset = get_option('gmt_offset');
$offset_range = array (-12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5,
@@ -66,22 +68,23 @@ foreach ( $offset_range as $offset ) {
</select>
<?php _e('hours') ?><br />
<?php printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), gmdate(__('Y-m-d G:i:s'))); ?><br />
-<?php if ($current_offset) printf(__('UTC %1$s is <code>%2$s</code>'), $current_offset_name, gmdate(__('Y-m-d G:i:s'), current_time('timestamp'))); ?>
+<?php if ($current_offset) printf(__('UTC %1$s is <code>%2$s</code>'), $current_offset_name, gmdate(__('Y-m-d G:i:s'), current_time('timestamp'))); ?><br />
+<?php _e('Unfortunately, you have to manually update this for Daylight Savings Time.'); ?>
</td>
</tr>
<tr>
-<th scope="row"><?php _e('Date Format') ?></th>
+<th scope="row"><label for="date_format"><?php _e('Date Format') ?></label></th>
<td><input name="date_format" type="text" id="date_format" size="30" value="<?php form_option('date_format'); ?>" /><br />
<?php _e('Output:') ?> <strong><?php echo mysql2date(get_option('date_format'), current_time('mysql')); ?></strong></td>
</tr>
<tr>
-<th scope="row"><?php _e('Time Format') ?></th>
+<th scope="row"><label for="time_format"><?php _e('Time Format') ?></label></th>
<td><input name="time_format" type="text" id="time_format" size="30" value="<?php form_option('time_format'); ?>" /><br />
<?php _e('Output:') ?> <strong><?php echo gmdate(get_option('time_format'), current_time('timestamp')); ?></strong><br />
<?php _e('<a href="http://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date formatting</a>. Click "Save Changes" to update sample output.') ?></td>
</tr>
<tr>
-<th scope="row"><?php _e('Week Starts On') ?></th>
+<th scope="row"><label for="start_of_week"><?php _e('Week Starts On') ?></label></th>
<td><select name="start_of_week" id="start_of_week">
<?php
for ($day_index = 0; $day_index <= 6; $day_index++) :
diff --git a/wp-admin/options-misc.php b/wp-admin/options-misc.php
index 711e61e..7afd299 100644
--- a/wp-admin/options-misc.php
+++ b/wp-admin/options-misc.php
@@ -20,23 +20,23 @@ include('admin-header.php');
<table class="form-table">
<tr valign="top">
<th scope="row"><?php _e('Thumbnail size') ?></th>
-<td>
+<td><fieldset><legend class="hidden"><?php _e('Thumbnail size') ?></legend>
<label for="thumbnail_size_w"><?php _e('Width'); ?></label>
<input name="thumbnail_size_w" type="text" id="thumbnail_size_w" value="<?php form_option('thumbnail_size_w'); ?>" size="6" />
<label for="thumbnail_size_h"><?php _e('Height'); ?></label>
<input name="thumbnail_size_h" type="text" id="thumbnail_size_h" value="<?php form_option('thumbnail_size_h'); ?>" size="6" /><br />
<input name="thumbnail_crop" type="checkbox" id="thumbnail_crop" value="1" <?php checked('1', get_option('thumbnail_crop')); ?>/>
<label for="thumbnail_crop"><?php _e('Crop thumbnail to exact dimensions (normally thumbnails are proportional)'); ?></label>
-</td>
+</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Medium size') ?></th>
-<td>
+<td><fieldset><legend class="hidden"><?php _e('Medium size') ?></legend>
<label for="medium_size_w"><?php _e('Max Width'); ?></label>
<input name="medium_size_w" type="text" id="medium_size_w" value="<?php form_option('medium_size_w'); ?>" size="6" />
<label for="medium_size_h"><?php _e('Max Height'); ?></label>
<input name="medium_size_h" type="text" id="medium_size_h" value="<?php form_option('medium_size_h'); ?>" size="6" />
-</td>
+</fieldset></td>
</tr>
</table>
diff --git a/wp-admin/options-permalink.php b/wp-admin/options-permalink.php
index 5b4b6b2..06ad149 100644
--- a/wp-admin/options-permalink.php
+++ b/wp-admin/options-permalink.php
@@ -180,11 +180,11 @@ $structures = array(
<table class="form-table">
<tr>
- <th><?php _e('Category base'); ?></th>
- <td><?php if( constant( 'VHOST' ) == 'no' && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) { echo "/blog"; $category_base = str_replace( "/blog", "", $category_base ); }?> <input name="category_base" type="text" class="code" value="<?php echo attribute_escape( $category_base ); ?>" size="30" /></td>
+ <th><label for="category_base"><?php _e('Category base'); ?></label></th>
+ <td><?php if( constant( 'VHOST' ) == 'no' && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) { echo "/blog"; $category_base = str_replace( "/blog", "", $category_base ); }?> <input name="category_base" id='category_base' type="text" class="code" value="<?php echo attribute_escape( $category_base ); ?>" size="30" /></td>
</tr>
<tr>
- <th><?php _e('Tag base'); ?></th>
+ <th><label for="tag_base"><?php _e('Tag base'); ?></label></th>
<td><?php if( constant( 'VHOST' ) == 'no' && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) { echo "/blog"; $tag_base = str_replace( "/blog", "", $tag_base ); }?> <input name="tag_base" id="tag_base" type="text" class="code" value="<?php echo attribute_escape($tag_base); ?>" size="30" /></td>
</tr>
</table>
diff --git a/wp-admin/options-privacy.php b/wp-admin/options-privacy.php
index c3f68dc..6cd927d 100644
--- a/wp-admin/options-privacy.php
+++ b/wp-admin/options-privacy.php
@@ -18,13 +18,13 @@ if( trim( get_option('blog_public') ) == '' )
<table class="form-table">
<tr valign="top">
<th scope="row"><?php _e('Blog Visibility') ?> </th>
-<td>
+<td><fieldset><legend class="hidden"><?php _e('Blog Visibility') ?> </legend>
<p><input id="blog-public" type="radio" name="blog_public" value="1" <?php checked('1', get_option('blog_public')); ?> />
<label for="blog-public"><?php _e('I would like my blog to be visible to everyone, including search engines (like Google, Sphere, Technorati) and archivers and in public listings around this site.') ?></label></p>
<p><input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked('0', get_option('blog_public')); ?> />
<label for="blog-norobots"><?php _e('I would like to block search engines, but allow normal visitors'); ?></label></p>
<?php do_action('blog_privacy_selector'); ?>
-</td>
+</fieldset></td>
</tr>
</table>
diff --git a/wp-admin/options-reading.php b/wp-admin/options-reading.php
index 147841a..18181ff 100644
--- a/wp-admin/options-reading.php
+++ b/wp-admin/options-reading.php
@@ -16,7 +16,7 @@ include('admin-header.php');
<?php if ( get_pages() ): ?>
<tr valign="top">
<th scope="row"><?php _e('Front page displays')?></th>
-<td>
+<td><fieldset><legend class="hidden"><?php _e('Front page displays')?></legend>
<p><label>
<input name="show_on_front" type="radio" value="posts" class="tog" <?php checked('posts', get_option('show_on_front')); ?> />
<?php _e('Your latest posts'); ?>
@@ -28,8 +28,8 @@ include('admin-header.php');
</label>
</p>
<ul>
- <li><?php printf(__('Front page: %s'), wp_dropdown_pages("name=page_on_front&echo=0&show_option_none=".__('- Select -')."&selected=" . get_option('page_on_front'))); ?></li>
- <li><?php printf(__('Posts page: %s'), wp_dropdown_pages("name=page_for_posts&echo=0&show_option_none=".__('- Select -')."&selected=" . get_option('page_for_posts'))); ?></li>
+ <li><?php printf("<label for='page_on_front'>".__('Front page: %s')."</label>", wp_dropdown_pages("name=page_on_front&echo=0&show_option_none=".__('- Select -')."&selected=" . get_option('page_on_front'))); ?></li>
+ <li><?php printf("<label for='page_for_posts'>".__('Posts page: %s')."</label>", wp_dropdown_pages("name=page_for_posts&echo=0&show_option_none=".__('- Select -')."&selected=" . get_option('page_for_posts'))); ?></li>
</ul>
<?php if ( 'page' == get_option('show_on_front') && get_option('page_for_posts') == get_option('page_on_front') ) : ?>
<div id="front-page-warning" class="updated fade-ff0000">
@@ -38,29 +38,29 @@ include('admin-header.php');
</p>
</div>
<?php endif; ?>
-</td>
+</fieldset></td>
</tr>
<?php endif; ?>
<tr valign="top">
-<th scope="row"><?php _e('Blog pages show at most') ?></th>
+<th scope="row"><label for="posts_per_page"><?php _e('Blog pages show at most') ?></label></th>
<td>
<input name="posts_per_page" type="text" id="posts_per_page" value="<?php form_option('posts_per_page'); ?>" size="3" /> <?php _e('posts') ?>
</td>
</tr>
<tr valign="top">
-<th scope="row"><?php _e('Syndication feeds show the most recent') ?></th>
+<th scope="row"><label for="posts_per_rss"><?php _e('Syndication feeds show the most recent') ?></label></th>
<td><input name="posts_per_rss" type="text" id="posts_per_rss" value="<?php form_option('posts_per_rss'); ?>" size="3" /> <?php _e('posts') ?></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('For each article in a feed, show') ?> </th>
-<td>
+<td><fieldset><legend class="hidden"><?php _e('For each article in a feed, show') ?> </legend>
<p><label><input name="rss_use_excerpt" type="radio" value="0" <?php checked(0, get_option('rss_use_excerpt')); ?> /> <?php _e('Full text') ?></label><br />
<label><input name="rss_use_excerpt" type="radio" value="1" <?php checked(1, get_option('rss_use_excerpt')); ?> /> <?php _e('Summary') ?></label></p>
-</td>
+</fieldset></td>
</tr>
<tr valign="top">
-<th scope="row"><?php _e('Encoding for pages and feeds') ?></th>
+<th scope="row"><label for="blog_charset"><?php _e('Encoding for pages and feeds') ?></label></th>
<td><input name="blog_charset" type="text" id="blog_charset" value="<?php form_option('blog_charset'); ?>" size="20" class="code" /><br />
<?php _e('The character encoding you write your blog in (UTF-8 is <a href="http://developer.apple.com/documentation/macos8/TextIntlSvcs/TextEncodingConversionManager/TEC1.5/TEC.b0.html">recommended</a>)') ?></td>
</tr>
diff --git a/wp-admin/options-writing.php b/wp-admin/options-writing.php
index 5734415..83c2d6f 100644
--- a/wp-admin/options-writing.php
+++ b/wp-admin/options-writing.php
@@ -14,21 +14,21 @@ include('admin-header.php');
<input type='hidden' name='option_page' value='writing' />
<table class="form-table">
<tr valign="top">
-<th scope="row"> <?php _e('Size of the post box') ?></th>
+<th scope="row"><label for="default_post_edit_rows"> <?php _e('Size of the post box') ?></label></th>
<td><input name="default_post_edit_rows" type="text" id="default_post_edit_rows" value="<?php form_option('default_post_edit_rows'); ?>" size="2" style="width: 1.5em;" />
<?php _e('lines') ?></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Formatting') ?></th>
-<td>
+<td><fieldset><legend class="hidden"><?php _e('Formatting') ?></legend>
<label for="use_smilies">
<input name="use_smilies" type="checkbox" id="use_smilies" value="1" <?php checked('1', get_option('use_smilies')); ?> />
<?php _e('Convert emoticons like <code>:-)</code> and <code>:-P</code> to graphics on display') ?></label><br />
<label for="use_balanceTags"><input name="use_balanceTags" type="checkbox" id="use_balanceTags" value="1" <?php checked('1', get_option('use_balanceTags')); ?> /> <?php _e('WordPress should correct invalidly nested XHTML automatically') ?></label>
-</td>
+</fieldset></td>
</tr>
<tr valign="top">
-<th scope="row"><?php _e('Default Post Category') ?></th>
+<th scope="row"><label for="default_category"><?php _e('Default Post Category') ?></label></th>
<td><select name="default_category" id="default_category">
<?php
$categories = get_categories('get=all');
@@ -42,7 +42,7 @@ endforeach;
</select></td>
</tr>
<tr valign="top">
-<th scope="row"><?php _e('Default Link Category') ?></th>
+<th scope="row"><label for="default_link_category"><?php _e('Default Link Category') ?></label></th>
<td><select name="default_link_category" id="default_link_category">
<?php
$link_categories = get_terms('link_category', 'get=all');
diff --git a/wp-admin/page-new.php b/wp-admin/page-new.php
index f09d657..f324c3d 100644
--- a/wp-admin/page-new.php
+++ b/wp-admin/page-new.php
@@ -7,8 +7,9 @@ wp_enqueue_script('autosave');
wp_enqueue_script('page');
if ( user_can_richedit() )
wp_enqueue_script('editor');
-wp_enqueue_script('thickbox');
+add_thickbox();
wp_enqueue_script('media-upload');
+wp_enqueue_script('word-count');
require_once('admin-header.php');
?>
diff --git a/wp-admin/page.php b/wp-admin/page.php
index a314e5d..7e030d1 100644
--- a/wp-admin/page.php
+++ b/wp-admin/page.php
@@ -74,16 +74,17 @@ case 'edit':
if ( empty($post->ID) ) wp_die( __("You attempted to edit a page that doesn't exist. Perhaps it was deleted?") );
- if ( 'post' == $post->post_type ) {
- wp_redirect("post.php?action=edit&post=$post_ID");
+ if ( 'page' != $post->post_type ) {
+ wp_redirect( get_edit_post_link( $post_ID, 'url' ) );
exit();
}
wp_enqueue_script('page');
if ( user_can_richedit() )
wp_enqueue_script('editor');
- wp_enqueue_script('thickbox');
+ add_thickbox();
wp_enqueue_script('media-upload');
+ wp_enqueue_script('word-count');
if ( current_user_can('edit_page', $page_ID) ) {
if ( $last = wp_check_post_lock( $post->ID ) ) {
@@ -149,8 +150,8 @@ case 'delete':
}
$sendback = wp_get_referer();
- if (strpos($sendback, 'page.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/page.php';
- elseif (strpos($sendback, 'attachments.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/attachments.php';
+ if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page.php');
+ elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
$sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
wp_redirect($sendback);
exit();
diff --git a/wp-admin/plugin-editor.php b/wp-admin/plugin-editor.php
index f84daa1..dec6569 100644
--- a/wp-admin/plugin-editor.php
+++ b/wp-admin/plugin-editor.php
@@ -7,10 +7,7 @@ $parent_file = 'plugins.php';
wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file'));
-add_action( 'admin_head', 'theme_editor_css' );
-function theme_editor_css(){
- wp_admin_css( 'css/theme-editor' );
-}
+wp_admin_css( 'theme-editor' );
$plugins = get_plugins();
$plugin_files = array_keys($plugins);
@@ -19,7 +16,7 @@ if (empty($file))
$file = $plugin_files[0];
$file = validate_file_to_edit($file, $plugin_files);
-$real_file = get_real_file_to_edit( PLUGINDIR . "/$file");
+$real_file = WP_PLUGIN_DIR . '/' . $file;
switch($action) {
@@ -72,7 +69,7 @@ default:
require_once('admin-header.php');
- update_recently_edited(PLUGINDIR . "/$file");
+ update_recently_edited(WP_PLUGIN_DIR . '/' . $file);
if ( ! is_file($real_file) )
$error = 1;
diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php
index 8e6b707..2353275 100644
--- a/wp-admin/plugins.php
+++ b/wp-admin/plugins.php
@@ -8,41 +8,98 @@ if( is_array( $menu_perms ) == false )
if( $menu_perms[ 'plugins' ] != 1 )
return;
-if ( isset($_GET['action']) ) {
- if ( isset($_GET['plugin']) )
- $plugin = trim($_GET['plugin']);
-
- if ( 'activate' == $_GET['action'] ) {
- check_admin_referer('activate-plugin_' . $_GET['plugin']);
- $result = activate_plugin($_GET['plugin'], 'plugins.php?error=true&plugin=' . $plugin);
- if ( is_wp_error( $result ) )
- wp_die( $result->get_error_message() );
- wp_redirect('plugins.php?activate=true'); // overrides the ?error=true one above
- } elseif ( 'error_scrape' == $_GET['action'] ) {
- check_admin_referer('plugin-activation-error_' . $plugin);
- $valid = validate_plugin($plugin);
- if ( is_wp_error($valid) )
- wp_die($valid);
- error_reporting( E_ALL ^ E_NOTICE );
- @ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
- include(ABSPATH . PLUGINDIR . '/' . $plugin);
- } elseif ( 'deactivate' == $_GET['action'] ) {
- check_admin_referer('deactivate-plugin_' . $_GET['plugin']);
- deactivate_plugins($_GET['plugin']);
- wp_redirect('plugins.php?deactivate=true');
- } elseif ( 'deactivate-all' == $_GET['action'] ) {
- check_admin_referer('deactivate-all');
- deactivate_all_plugins();
- wp_redirect('plugins.php?deactivate-all=true');
- } elseif ('reactivate-all' == $_GET['action']) {
- check_admin_referer('reactivate-all');
- reactivate_all_plugins('plugins.php?errors=true');
- wp_redirect('plugins.php?reactivate-all=true'); // overrides the ?error=true one above
+$action = '';
+foreach( array('activate-selected', 'deactivate-selected', 'delete-selected') as $action_key ) {
+ if( isset($_POST[$action_key]) ) {
+ $action = $action_key;
+ break;
}
+}
+
+if( isset($_GET['action']) )
+ $action = $_GET['action'];
+
+$plugin = $_REQUEST['plugin'];
+
+if( !empty($action) ) {
+ switch( $action ) {
+ case 'activate':
+ check_admin_referer('activate-plugin_' . $plugin);
+ $result = activate_plugin($plugin, 'plugins.php?error=true&plugin=' . $plugin);
+ if ( is_wp_error( $result ) )
+ wp_die( $result->get_error_message() );
+ $recent = (array)get_option('recently_activated');
+ if( isset($recent[ $plugin ]) ){
+ unset($recent[ $plugin ]);
+ update_option('recently_activated', $recent);
+ }
+ wp_redirect('plugins.php?activate=true'); // overrides the ?error=true one above
+ exit;
+ break;
+ case 'activate-selected':
+ check_admin_referer('mass-manage-plugins');
+ activate_plugins($_POST['checked'], 'plugins.php?error=true');
+
+ $recent = (array)get_option('recently_activated');
+ foreach( (array)$_POST['checked'] as $plugin => $time) {
+ if( isset($recent[ $plugin ]) )
+ unset($recent[ $plugin ]);
+ }
+ if( $recent != get_option('recently_activated') ) //If array changed, update it.
+ update_option('recently_activated', $recent);
+
+ wp_redirect('plugins.php?activate-multi=true');
+ exit;
+ break;
+ case 'error_scrape':
+ check_admin_referer('plugin-activation-error_' . $plugin);
+ $valid = validate_plugin($plugin);
+ if ( is_wp_error($valid) )
+ wp_die($valid);
+ error_reporting( E_ALL ^ E_NOTICE );
+ @ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
+ include(WP_PLUGIN_DIR . '/' . $plugin);
+ exit;
+ break;
+ case 'deactivate':
+ check_admin_referer('deactivate-plugin_' . $plugin);
+ deactivate_plugins($plugin);
+ update_option('recently_activated', array($plugin => time()) + (array)get_option('recently_activated'));
+ wp_redirect('plugins.php?deactivate=true');
+ exit;
+ break;
+ case 'deactivate-selected':
+ check_admin_referer('mass-manage-plugins');
+ deactivate_plugins($_POST['checked']);
+ $deactivated = array();
+ foreach( (array)$_POST['checked'] as $plugin )
+ $deactivated[ $plugin ] = time();
+ update_option('recently_activated', $deactivated + (array)get_option('recently_activated'));
+ wp_redirect('plugins.php?deactivate-multi=true');
+ exit;
+ break;
+ case 'delete-selected':
+ if( ! current_user_can('delete_plugins') )
+ wp_die(__('You do not have sufficient permissions to delete plugins for this blog.'));
+ check_admin_referer('mass-manage-plugins');
+ $plugins = $_REQUEST['checked'];
+ include(ABSPATH . 'wp-admin/update.php');
+
+ $title = __('Delete Plugin');
+ $parent_file = 'plugins.php';
+
+ $delete_result = delete_plugins($plugins);
- exit;
+ wp_cache_delete('plugins', 'plugins');
+
+ break;
+ default:
+ var_dump("Unknown Action $action");
+ }
}
+wp_enqueue_script('admin-forms');
+
$title = __('Manage Plugins');
require_once('admin-header.php');
@@ -53,23 +110,26 @@ validate_active_plugins();
<?php if ( isset($_GET['error']) ) : ?>
<div id="message" class="updated fade"><p><?php _e('Plugin could not be activated because it triggered a <strong>fatal error</strong>.') ?></p>
<?php
- $plugin = trim($_GET['plugin']);
if ( wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $plugin) ) { ?>
- <iframe style="border:0" width="100%" height="70px" src="<?php bloginfo('wpurl'); ?>/wp-admin/plugins.php?action=error_scrape&amp;plugin=<?php echo attribute_escape($plugin); ?>&amp;_wpnonce=<?php echo attribute_escape($_GET['_error_nonce']); ?>"></iframe>
+ <iframe style="border:0" width="100%" height="70px" src="<?php echo admin_url('plugins.php?action=error_scrape&amp;plugin=' . attribute_escape($plugin) . '&amp;_wpnonce=' . attribute_escape($_GET['_error_nonce'])); ?>"></iframe>
<?php
}
?>
</div>
-<?php elseif ( isset($_GET['errors']) ) : ?>
- <div id="message" class="updated fade"><p><?php _e('Some plugins could not be reactivated because they triggered a <strong>fatal error</strong>.') ?></p></div>
+<?php elseif ( 'delete-selected' == $action ) :
+ if ( is_wp_error($delete_result) ) : ?>
+ <div id="message" class="updated fade"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div>
+ <?php else : ?>
+ <div id="message" class="updated fade"><p><?php _e('The selected plugins have been <strong>deleted</strong>.'); ?></p></div>
+ <?php endif; ?>
<?php elseif ( isset($_GET['activate']) ) : ?>
<div id="message" class="updated fade"><p><?php _e('Plugin <strong>activated</strong>.') ?></p></div>
+<?php elseif (isset($_GET['activate-multi'])) : ?>
+ <div id="message" class="updated fade"><p><?php _e('Selected plugins <strong>activated</strong>.'); ?></p></div>
<?php elseif ( isset($_GET['deactivate']) ) : ?>
<div id="message" class="updated fade"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p></div>
-<?php elseif (isset($_GET['deactivate-all'])) : ?>
- <div id="message" class="updated fade"><p><?php _e('All plugins <strong>deactivated</strong>.'); ?></p></div>
-<?php elseif (isset($_GET['reactivate-all'])) : ?>
- <div id="message" class="updated fade"><p><?php _e('Plugins <strong>reactivated</strong>.'); ?></p></div>
+<?php elseif (isset($_GET['deactivate-multi'])) : ?>
+ <div id="message" class="updated fade"><p><?php _e('Selected plugins <strong>deactivated</strong>.'); ?></p></div>
<?php endif; ?>
<div class="wrap">
@@ -77,106 +137,146 @@ validate_active_plugins();
<p><?php _e('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.'); ?></p>
<?php
-$plugins = get_plugins();
+$active_plugins = array();
+$available_plugins = array();
+$recent_plugins = array();
+$recently_activated = (array)get_option('recently_activated');
-if (empty($plugins)) {
- echo '<p>';
- _e("Couldn&#8217;t open plugins directory or there are no plugins available."); // TODO: make more helpful
- echo '</p>';
-} else {
-?>
+//Clean out any plugins which were deactivated over a week ago.
+foreach( $recently_activated as $key => $time )
+ if( $time + (7*24*60*60) < time() ) //1 week
+ unset($recently_activated[ $key ]);
+if( $recently_activated != get_option('recently_activated') ) //If array changed, update it.
+ update_option('recently_activated', $recently_activated);
-<div class="tablenav">
- <div class="alignleft">
- <?php
- $active = get_option('active_plugins');
- $inactive = get_option('deactivated_plugins');
- if ( !empty($active) ) {
- ?>
- <a class="button-secondary delete" href="<?php echo wp_nonce_url('plugins.php?action=deactivate-all', 'deactivate-all'); ?>"><?php _e('Deactivate All Plugins'); ?></a>
- <?php
- } elseif ( empty($active) && !empty($inactive) ) {
- ?>
- <a class="button-secondary delete" href="<?php echo wp_nonce_url('plugins.php?action=reactivate-all', 'reactivate-all'); ?>"><?php _e('Reactivate Plugins'); ?></a>
- <?php
- } // endif active/inactive plugin check
- ?>
- </div>
- <br class="clear" />
-</div>
+$all_plugins = get_plugins();
-<br class="clear" />
+$plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array());
+
+foreach( (array)$all_plugins as $plugin_file => $plugin_data) {
-<table class="widefat">
+ // Sanitize all displayed data
+ $plugin_data['Title'] = wp_kses($plugin_data['Title'], $plugins_allowedtags);
+ $plugin_data['Version'] = wp_kses($plugin_data['Version'], $plugins_allowedtags);
+ $plugin_data['Description'] = wp_kses($plugin_data['Description'], $plugins_allowedtags);
+ $plugin_data['Author'] = wp_kses($plugin_data['Author'], $plugins_allowedtags);
+ if( ! empty($plugin_data['Author']) )
+ $plugin_data['Description'] .= ' <cite>' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.</cite>';
+
+ if ( is_plugin_active($plugin_file) ) {
+ $active_plugins[ $plugin_file ] = $plugin_data;
+ } else {
+ if ( isset( $recently_activated[ $plugin_file ] ) ) //Was the plugin recently activated?
+ $recent_plugins[ $plugin_file ] = $plugin_data;
+ else
+ $available_plugins[ $plugin_file ] = $plugin_data;
+ }
+}
+
+?>
+
+<?php
+function print_plugins_table($plugins, $context = '') {
+?>
+<table class="widefat" id="<?php echo $context ?>-plugins-table">
<thead>
<tr>
- <th><?php _e('Plugin'); ?></th>
- <th class="num"><?php _e('Version'); ?></th>
- <th><?php _e('Description'); ?></th>
- <th class="status"><?php _e('Status') ?></th>
- <th class="action-links"><?php _e('Action'); ?></th>
+ <th scope="col" class="check-column"><input type="checkbox" /></th>
+ <th scope="col"><?php _e('Plugin'); ?></th>
+ <th scope="col" class="num"><?php _e('Version'); ?></th>
+ <th scope="col"><?php _e('Description'); ?></th>
+ <th scope="col" class="action-links"><?php _e('Action'); ?></th>
</tr>
</thead>
- <tbody id="plugins">
+ <tbody class="plugins">
<?php
- foreach($plugins as $plugin_file => $plugin_data) {
- $action_links = array();
-
- $style = '';
-
- if ( is_plugin_active($plugin_file) ) {
- $action_links[] = "<a href='" . wp_nonce_url("plugins.php?action=deactivate&amp;plugin=$plugin_file", 'deactivate-plugin_' . $plugin_file) . "' title='".__('Deactivate this plugin')."' class='delete'>".__('Deactivate')."</a>";
- $style = 'active';
- } else {
- $action_links[] = "<a href='" . wp_nonce_url("plugins.php?action=activate&amp;plugin=$plugin_file", 'activate-plugin_' . $plugin_file) . "' title='".__('Activate this plugin')."' class='edit'>".__('Activate')."</a>";
- }
- $plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array());
+ if( empty($plugins) ) {
+ echo '<tr>
+ <td colspan="6">' . __('No plugins to show') . '</td>
+ </tr>';
+ }
+ foreach( (array)$plugins as $plugin_file => $plugin_data) {
+ $action_links = array();
- // Sanitize all displayed data
- $plugin_data['Title'] = wp_kses($plugin_data['Title'], $plugins_allowedtags);
- $plugin_data['Version'] = wp_kses($plugin_data['Version'], $plugins_allowedtags);
- $plugin_data['Description'] = wp_kses($plugin_data['Description'], $plugins_allowedtags);
- $plugin_data['Author'] = wp_kses($plugin_data['Author'], $plugins_allowedtags);
- $author = ( empty($plugin_data['Author']) ) ? '' : ' <cite>' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.</cite>';
+ if( 'active' == $context )
+ $action_links[] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . $plugin_file, 'deactivate-plugin_' . $plugin_file) . '" title="' . __('Deactivate this plugin') . '" class="delete">' . __('Deactivate') . '</a>';
+ else //Available or Recently deactivated
+ $action_links[] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>';
- if ( $style != '' )
- $style = ' class="' . $style . '"';
+ if ( current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
+ $action_links[] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . __('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';
- $action_links = apply_filters('plugin_action_links', $action_links, $plugin_file, $plugin_info);
+ $action_links = apply_filters('plugin_action_links', $action_links, $plugin_file, $plugin_data, $context);
echo "
- <tr$style>
+ <tr class='$context'>
+ <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . attribute_escape($plugin_file) . "' /></th>
<td class='name'>{$plugin_data['Title']}</td>
<td class='vers'>{$plugin_data['Version']}</td>
- <td class='desc'><p>{$plugin_data['Description']}$author</p></td>
- <td class='status'>";
- if ( is_plugin_active($plugin_file) )
- echo __('<span class="active">Active</span>');
- else
- _e('<span class="inactive">Inactive</span>');
- echo "</td>
- <td class='togl action-links'>$toggle";
+ <td class='desc'><p>{$plugin_data['Description']}</p></td>
+ <td class='togl action-links'>";
if ( !empty($action_links) )
echo implode(' | ', $action_links);
- echo "</td>
- </tr>";
- do_action( 'after_plugin_row', $plugin_file );
+ echo '</td>
+ </tr>';
+ do_action( 'after_plugin_row', $plugin_file, $plugin_data, $context );
}
?>
</tbody>
</table>
-
-<?php
-}
+<?php
+} //End print_plugins_table()
?>
+<h3 id="currently-active"><?php _e('Currently Active Plugins') ?></h3>
+<form method="post" action="<?php echo admin_url('plugins.php') ?>">
+<?php wp_nonce_field('mass-manage-plugins') ?>
+
+<div class="tablenav">
+ <div class="alignleft">
+ <input type="submit" name="deactivate-selected" value="<?php _e('Deactivate') ?>" class="button-secondary" />
+ </div>
+</div>
+<br class="clear" />
+<?php print_plugins_table($active_plugins, 'active') ?>
+</form>
+
+<p><?php printf(__('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), WP_PLUGIN_DIR); ?></p>
+
+<?php if ( ! empty($recent_plugins) ) : ?>
+<h3 id="recent-plugins"><?php _e('Recently Active Plugins') ?></h3>
+<form method="post" action="<?php echo admin_url('plugins.php') ?>">
+<?php wp_nonce_field('mass-manage-plugins') ?>
+
+<div class="tablenav">
+ <div class="alignleft">
+ <input type="submit" name="activate-selected" value="<?php _e('Activate') ?>" class="button-secondary" />
+ </div>
+</div>
+<br class="clear" />
+<?php print_plugins_table($recent_plugins, 'recent') ?>
+</form>
+<?php endif; ?>
+
+<h3 id="available-plugins"><?php _e('Available Plugins') ?></h3>
+<form method="post" action="<?php echo admin_url('plugins.php') ?>">
+<?php wp_nonce_field('mass-manage-plugins') ?>
+
+<div class="tablenav">
+ <div class="alignleft">
+ <input type="submit" name="activate-selected" value="<?php _e('Activate') ?>" class="button-secondary" />
+ </div>
+</div>
+<br class="clear" />
+<?php print_plugins_table($available_plugins, 'available') ?>
+</form>
<?php if( is_site_admin() ) { ?>
<p><?php printf(__('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), PLUGINDIR); ?></p>
<h2><?php _e('Get More Plugins'); ?></h2>
<p><?php _e('You can find additional plugins for your site in the <a href="http://wordpress.org/extend/plugins/">WordPress plugin directory</a>.'); ?></p>
-<p><?php printf(__('To install a plugin you generally just need to upload the plugin file into your <code>%s</code> directory. Once a plugin is uploaded, you may activate it here.'), PLUGINDIR); ?></p>
+<p><?php printf(__('To install a plugin you generally just need to upload the plugin file into your <code>%s</code> directory. Once a plugin is uploaded, you may activate it here.'), WP_PLUGIN_DIR); ?></p>
<?php } // is_site_admin() ?>
</div>
diff --git a/wp-admin/post-new.php b/wp-admin/post-new.php
index 263783a..f1f2da5 100644
--- a/wp-admin/post-new.php
+++ b/wp-admin/post-new.php
@@ -7,8 +7,9 @@ wp_enqueue_script('autosave');
wp_enqueue_script('post');
if ( user_can_richedit() )
wp_enqueue_script('editor');
-wp_enqueue_script('thickbox');
+add_thickbox();
wp_enqueue_script('media-upload');
+wp_enqueue_script('word-count');
require_once ('./admin-header.php');
diff --git a/wp-admin/post.php b/wp-admin/post.php
index b9400b7..f6daec9 100644
--- a/wp-admin/post.php
+++ b/wp-admin/post.php
@@ -80,16 +80,17 @@ case 'edit':
if ( empty($post->ID) ) wp_die( __("You attempted to edit a post that doesn't exist. Perhaps it was deleted?") );
- if ( 'page' == $post->post_type ) {
- wp_redirect("page.php?action=edit&post=$post_ID");
+ if ( 'post' != $post->post_type ) {
+ wp_redirect( get_edit_post_link( $post->ID, 'url' ) );
exit();
}
wp_enqueue_script('post');
if ( user_can_richedit() )
wp_enqueue_script('editor');
- wp_enqueue_script('thickbox');
+ add_thickbox();
wp_enqueue_script('media-upload');
+ wp_enqueue_script('word-count');
if ( current_user_can('edit_post', $post_ID) ) {
if ( $last = wp_check_post_lock( $post->ID ) ) {
@@ -159,8 +160,8 @@ case 'delete':
}
$sendback = wp_get_referer();
- if (strpos($sendback, 'post.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/post-new.php';
- elseif (strpos($sendback, 'attachments.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/attachments.php';
+ if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('post-new.php');
+ elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
$sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
wp_redirect($sendback);
exit();
diff --git a/wp-admin/press-this.php b/wp-admin/press-this.php
new file mode 100644
index 0000000..a0bfd1c
--- /dev/null
+++ b/wp-admin/press-this.php
@@ -0,0 +1,503 @@
+<?php
+require_once('admin.php');
+
+if ( ! current_user_can('publish_posts') ) wp_die( __( 'Cheatin&#8217; uh?' )); ?>
+
+<?php
+function press_it() {
+ #define some basic variables
+ $quick['post_status'] = 'publish';
+ $quick['post_category'] = $_REQUEST['post_category'];
+ $quick['tags_input'] = $_REQUEST['tags_input'];
+ $quick['post_title'] = $_REQUEST['post_title'];
+ $quick['post_content'] = '';
+
+ # insert the post with nothing in it, to get an ID
+ $post_ID = wp_insert_post($quick, true);
+
+ $content = '';
+ switch ( $_REQUEST['post_type'] ) {
+ case 'text':
+ case 'quote':
+ $content .= $_REQUEST['content'];
+ break;
+
+ case 'photo':
+ foreach($_REQUEST['photo_src'] as $key => $data) {
+ #quote for matching
+ $quoted = str_replace('/', '\/', preg_quote($data));
+
+ # see if files exist in content - we don't want to upload non-used selected files.
+ preg_match('/'.$quoted.'/', $_REQUEST['content'], $matches[0]);
+ if($matches[0])
+ media_sideload_image($data, $post_ID, $_REQUEST['photo_description'][$key]);
+ }
+ $content = $_REQUEST['content'];
+ break;
+
+ case "video":
+ if($_REQUEST['embed_code'])
+ $content .= $_REQUEST['embed_code']."\n\n";
+ $content .= $_REQUEST['content'];
+ break;
+ }
+ # set the post_content
+ $quick['post_content'] = $content;
+
+ #error handling for $post
+ if ( is_wp_error($post_ID) ) {
+ wp_die($id);
+ wp_delete_post($post_ID);
+
+ #error handling for media_sideload
+ } else {
+ $quick['ID'] = $post_ID;
+ wp_update_post($quick);
+ }
+ return $post_ID;
+}
+
+
+function category_div() { ?>
+ <div id="categories">
+ <div class="submitbox" id="submitpost">
+ <div id="previewview"></div>
+ <div class="inside">
+ <h2><?php _e('Categories') ?></h2>
+ <div id="categories-all">
+ <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
+ <?php wp_category_checklist() ?>
+ </ul>
+ </div>
+ <h2><?php _e('Tags') ?></h2>
+ <p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /></p>
+ <div id="tagchecklist"></div>
+
+ </div>
+ <p class="submit">
+ <input type="submit" value="<?php _e('Publish') ?>" onclick="document.getElementById('photo_saving').style.display = '';"/>
+ <img src="images/loading.gif" alt="" id="photo_saving" style="width:16px; height:16px; vertical-align:-4px; display:none;"/>
+ </p>
+ </div>
+<?php }
+
+# For submitted posts.
+if ( 'post' == $_REQUEST['action'] ) {
+ check_admin_referer('press-this'); $post_ID = press_it(); ?>
+
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+ <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
+ <head>
+ <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
+ <title><?php _e('Press This') ?></title>
+ <?php
+ add_thickbox();
+ wp_enqueue_style('press-this');
+ wp_enqueue_style( 'colors' );
+ wp_enqueue_script('post');
+
+ do_action('admin_print_styles');
+ do_action('admin_print_scripts');
+ do_action('admin_head');
+ ?>
+ </head>
+ <body class="press-this">
+ <div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a onclick="window.opener.location.replace(this.href); window.close();" href="<?php echo get_permalink( $post_ID); ?>"><?php _e('View post'); ?></a> | <a href="post.php?action=edit&amp;post=<?php echo $post_ID; ?>" onclick="window.opener.location.replace(this.href); window.close();"><?php _e('Edit post'); ?></a> | <a href="#" onclick="window.close();">Close Window</a></p></div>
+ </body>
+ </html>
+ <?php die;
+}
+
+// Ajax Requests
+$title = wp_specialchars(stripslashes($_GET['t']));
+$selection = trim(wp_specialchars(str_replace("\n", ' ',stripslashes($_GET['s']))));
+$url = $_GET['u'];
+$image = $_GET['i'];
+if($_REQUEST['ajax'] == 'thickbox') { ?>
+ <script type="text/javascript" charset="utf-8">
+ jQuery('.cancel').click(function() {
+ tb_remove();
+ });
+
+ function image_selector() {
+ desc = jQuery('#this_photo_description').val();
+ src = jQuery('#this_photo').val();
+ pick(src, desc);
+ tb_remove();
+ return false;
+ }
+
+ jQuery('.select').click(function() {
+ image_selector();
+ });
+
+ </script>
+ <h3 id="title"><label for="post_title"><?php _e('Description') ?></label></h3>
+ <div class="titlewrap">
+ <input id="this_photo_description" name="photo_description" class="text" onkeypress="if(event.keyCode==13) image_selector();" value="<?php echo attribute_escape($title);?>"/>
+ </div>
+
+ <p><input type="hidden" name="this_photo" value="<?php echo $image; ?>" id="this_photo" />
+ <a href="#" class="select" rel="<?php echo $image; ?>"><img src="<?php echo $image; ?>" width="475" alt="Click to insert." title="Click to insert." /></a></p>
+
+ <p id="options"><a href="#" class="select" rel="<?php echo $image; ?>">Insert Image</a> | <a href="#" class="cancel">Cancel</a></p>
+<?php die;
+}
+
+
+if($_REQUEST['ajax'] == 'video') { ?>
+ <h2 id="embededcode"><label for="embed_code"><?php _e('Embed Code') ?></label></h2>
+ <div class="titlewrap" >
+ <textarea name="embed_code" id="embed_code" rows="8" cols="40"><?php echo $selection; ?></textarea>
+ </div>
+<?php die;
+}
+
+if($_REQUEST['ajax'] == 'photo_images') {
+$url = urldecode($url);
+$url = str_replace(' ', '%20', $url);
+
+ function get_images_from_uri($uri) {
+ if(preg_match('/\.(jpg|png|gif)/', $uri)) return "'".$uri."'";
+ $content = wp_remote_fopen($uri);
+ $host = parse_url($uri);
+ if ( false === $content ) return '';
+
+ $pattern = '/<img[^>]+src=[\'"]([^\'" >]+?)[\'" >]/is';
+ preg_match_all($pattern, $content, $matches);
+ if ( empty($matches[1]) ) return '';
+
+ $sources = array();
+
+ foreach ($matches[1] as $src) {
+ if ( false !== strpos($src, '&') ) continue;
+ if(strpos($src, 'http') === false) {
+ if(strpos($src, '../') === false && strpos($src, './') === false) {
+ $src = 'http://'.str_replace('//','/', $host['host'].'/'.$src);
+ } else {
+ $src = 'http://'.str_replace('//','/', $host['host'].'/'.$host['path'].'/'.$src);
+ }
+ }
+ $sources[] = $src;
+ }
+ return "'" . implode("','", $sources) . "'";
+ }
+
+
+ echo 'new Array('.get_images_from_uri($url).')';
+die;
+}
+
+if($_REQUEST['ajax'] == 'photo_js') { ?>
+
+ var last = null
+
+ function pick(img, desc) {
+ if (img) {
+ length = jQuery('.photolist input').length;
+ if(length == 0) length = 1;
+ jQuery('.photolist').append('<input name="photo_src[' + length + ']" value="' + img +'" type="hidden"/>');
+ jQuery('.photolist').append('<input name="photo_description[' + length + ']" value="' + desc +'" type="hidden"/>');
+ append_editor('<img src="' + img +'" alt="' + desc + '" />'); }
+ return false;
+ }
+
+ var my_src, img, img_tag, aspect, w, h, skip, i, strtoappend = "";
+
+ var my_src = eval(
+ jQuery.ajax({
+ type: "GET",
+ url: "<?php echo clean_url($_SERVER['PHP_SELF']); ?>",
+ cache : false,
+ async : false,
+ data: "ajax=photo_images&u=<?php echo urlencode($url); ?>",
+ dataType : "script"
+ }).responseText);
+
+ for (i = 0; i < my_src.length; i++) {
+ img = new Image();
+ img.src = my_src[i];
+ img_attr = 'id="img' + i;
+ skip = false;
+
+ if (img.width && img.height) {
+ if (img.width * img.height < 2500) skip = true;
+ aspect = img.width / img.height;
+ if (aspect > 1) { // Image is wide
+ scale = 75 / img.width;
+ } else { // Image is tall or square
+ scale = 75 / img.height;
+ }
+ if (scale < 1) {
+ w = parseInt(img.width * scale);
+ h = parseInt(img.height * scale);
+ } else {
+ w = img.width;
+ h = img.height;
+ }
+ img_attr += ' style="width: ' + w + 'px; height: ' + h + 'px;"';
+ }
+
+ if (!skip) strtoappend += '<a href="?ajax=thickbox&amp;i=' + img.src + '&amp;u=<?php echo $url; ?>&amp;height=400&amp;width=500" title="" class="thickbox"><img src="' + img.src + '" ' + img_attr + '/></a>';
+
+ }
+
+ jQuery('#img_container').html(strtoappend);
+
+ tb_init('a.thickbox, area.thickbox, input.thickbox'); //pass where to apply thickbox
+
+<?php die; }
+
+if($_REQUEST['ajax'] == 'photo') { ?>
+
+ <div class="photolist"></div>
+
+ <small><?php _e('Click images to select:') ?></small>
+ <div class="titlewrap">
+ <div id="img_container"></div>
+ </div>
+<?php die; }
+
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
+<head>
+ <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
+ <title><?php _e('Press This') ?></title>
+
+ <script type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce.js"></script>
+<?php
+ add_thickbox();
+ wp_enqueue_style('press-this');
+ wp_enqueue_style( 'colors' );
+ wp_enqueue_script('post');
+
+ do_action('admin_print_styles');
+ do_action('admin_print_scripts');
+ do_action('admin_head');
+?>
+ <script type="text/javascript">
+ <?php if ( user_can_richedit() ) {
+ $language = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) );
+ // Add TinyMCE languages
+ @include_once( dirname(__FILE__).'/../wp-includes/js/tinymce/langs/wp-langs.php' );
+ if ( isset($strings) ) echo $strings; ?>
+ (function() {
+ var base = tinymce.baseURL, sl = tinymce.ScriptLoader, ln = "<?php echo $language; ?>";
+
+ sl.markDone(base + '/langs/' + ln + '.js');
+ sl.markDone(base + '/themes/advanced/langs/' + ln + '.js');
+ sl.markDone(base + '/themes/advanced/langs/' + ln + '_dlg.js');
+ })();
+
+ tinyMCE.init({
+ mode: "textareas",
+ editor_selector: "mceEditor",
+ language : "<?php echo $language; ?>",
+ width: "100%",
+ theme : "advanced",
+ theme_advanced_buttons1 : "bold,italic,underline,blockquote,separator,strikethrough,bullist,numlist,undo,redo,link,unlink",
+ theme_advanced_buttons2 : "",
+ theme_advanced_buttons3 : "",
+ theme_advanced_toolbar_location : "top",
+ theme_advanced_toolbar_align : "left",
+ theme_advanced_statusbar_location : "bottom",
+ theme_advanced_resizing : true,
+ theme_advanced_resize_horizontal : false,
+ skin : "wp_theme",
+ dialog_type : "modal",
+ relative_urls : false,
+ remove_script_host : false,
+ convert_urls : false,
+ apply_source_formatting : false,
+ remove_linebreaks : false,
+ accessibility_focus : false,
+ tab_focus : ":next",
+ plugins : "safari,inlinepopups",
+ entities : "38,amp,60,lt,62,gt"
+ });
+ <?php } ?>
+
+ jQuery('#tags-input').hide();
+
+ tag_update_quickclicks();
+
+ // add the quickadd form
+ jQuery('#jaxtag').prepend('<span id="ajaxtag"><input type="text" name="newtag" id="newtag" class="form-input-tip" size="16" autocomplete="off" value="'+postL10n.addTag+'" /><input type="submit" class="button" id="tagadd" value="' + postL10n.add + '" tabindex="3" onclick="return false;" /><input type="hidden"/><input type="hidden"/><span class="howto">'+postL10n.separate+'</span></span>');
+
+ jQuery('#tagadd').click( tag_flush_to_text );
+ jQuery('#newtag').focus(function() {
+ if ( this.value == postL10n.addTag )
+ jQuery(this).val( '' ).removeClass( 'form-input-tip' );
+ });
+ jQuery('#newtag').blur(function() {
+ if ( this.value == '' )
+ jQuery(this).val( postL10n.addTag ).addClass( 'form-input-tip' );
+ });
+
+ // auto-save tags on post save/publish
+ jQuery('#publish').click( tag_save_on_publish );
+ jQuery('#save-post').click( tag_save_on_publish );
+
+ function set_menu(type) {
+ jQuery('#text_button').removeClass('ui-tabs-selected');
+ jQuery('#menu li').removeClass('ui-tabs-selected');
+ jQuery('#' + type + '_button').addClass('ui-tabs-selected');
+ jQuery("#post_type").val(type);
+ }
+ function set_editor(text) {
+ if(tinyMCE.activeEditor) tinyMCE.activeEditor.setContent('');
+ if(tinyMCE.activeEditor) tinyMCE.execCommand('mceInsertContent' ,false, text);
+ }
+ function append_editor(text) {
+ if(tinyMCE.activeEditor) tinyMCE.execCommand('mceInsertContent' ,false, text);
+ }
+ function set_title(title) { jQuery("#content_type").text(title); }
+ function reset_height() {
+ tinyMCE.height = '170px';
+ }
+ function show(tab_name) {
+ jQuery('body').removeClass('video_split');
+ jQuery('#extra_fields').hide();
+ switch(tab_name) {
+ case 'text' :
+ reset_height();
+ jQuery('.editor-container').show();
+ jQuery('#content_type').show();
+ set_menu('text');
+ set_title('<?php _e('Text') ?>');
+ set_editor("<?php echo $selection; ?>");
+ return false;
+ break;
+ case 'quote' :
+ reset_height();
+ jQuery('.editor-container').show();
+ jQuery('#content_type').show();
+ set_menu('quote');
+ set_title('<?php _e('Quote') ?>');
+ set_editor("<blockquote><p><?php echo $selection; ?> </p><p><cite><a href='<?php echo ''; ?>'><?php echo ''; ?></a></cite> </p></blockquote>");
+
+ return false;
+ break;
+ case 'video' :
+ reset_height();
+ jQuery('.editor-container').show();
+ jQuery('#content_type').show();
+ set_menu('video');
+ set_title('<?php _e('Caption') ?>');
+
+ jQuery('#extra_fields').show();
+ jQuery('body').addClass('video_split');
+
+
+ jQuery('#extra_fields').load('<?php echo clean_url($_SERVER['PHP_SELF']); ?>', { ajax: 'video', s: '<?php echo attribute_escape($selection); ?>'}, function() {
+
+ <?php
+ if ( preg_match("/youtube\.com\/watch/i", $url) ) {
+ list($domain, $video_id) = split("v=", $url);
+ $content = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/' . $video_id . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' . $video_id . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>'; ?>
+
+ <?php } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) {
+
+ list($domain, $video_id) = split(".com/", $url);
+ $content = '<object width="400" height="225"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /> <embed src="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"></embed></object>';
+
+ if(trim($selection) == '') $selection = '<a href="http://www.vimeo.com/' . $video_id . '?pg=embed&sec=' . $video_id . '">' . $title . '</a> on <a href="http://vimeo.com?pg=embed&sec=' . $video_id . '">Vimeo</a>';
+ }else {
+ $content = $selection;
+ } ?>
+ jQuery('#embed_code').prepend('<?php echo htmlentities($content); ?>');
+ set_editor("<?php echo $title; ?>");
+
+ });
+
+
+ return false;
+ break;
+
+ case 'photo' :
+ reset_height();
+ set_menu('photo');
+ set_title('Post');
+ <?php if($selection) { ?>
+ set_editor("<?php echo $selection; ?>");
+ <?php } else { ?>
+ set_editor('')
+ <?php } ?>
+ jQuery('#extra_fields').show();
+ jQuery('#extra_fields').prepend('<h2 id="waiting"><img src="images/loading.gif" alt="" /> Loading...</h2>');
+ jQuery('#extra_fields').load('<?php echo clean_url($_SERVER['PHP_SELF']).'/?ajax=photo&u='.attribute_escape($url); ?>');
+ jQuery.ajax({
+ type: "GET",
+ cache : false,
+ url: "<?php echo clean_url($_SERVER['PHP_SELF']); ?>",
+ data: "ajax=photo_js&u=<?php echo urlencode($url)?>",
+ dataType : "script",
+ success : function() {
+ jQuery('#waiting').innerHTML('');
+ }
+ });
+
+ return false;
+ break;
+
+ }
+
+ }
+
+ jQuery(document).ready(function() {
+ jQuery('#menu li').click(function (){
+ tab_name = this.id.split('_');
+ tab_name = tab_name[0];
+ show(tab_name);
+ });
+
+ <?php if ( preg_match("/youtube\.com\/watch/i", $url) ) { ?>
+ show('video');
+ <?php } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) { ?>
+ show('video');
+ <?php } elseif ( preg_match("/flickr\.com/i", $url) ) { ?>
+ show('photo');
+ <?php } ?>
+ });
+</script>
+</head>
+<body class="press-this">
+<div id="wphead">
+<h1><span id="viewsite"><a href="<?php echo get_option('home'); ?>/"><?php _e('Visit:') ?> <?php bloginfo('name'); ?></a></span></h1>
+</div>
+
+ <ul id="menu" class="ui-tabs-nav">
+ <li id="text_button" class="ui-tabs-selected"><a href="#"><?php _e('Text') ?></a></li>
+ <li id="photo_button"><a href="#"><?php _e('Photo') ?></a></li>
+ <li id="quote_button"><a href="#"><?php _e('Quote') ?></a></li>
+ <li id="video_button"><a href="#"><?php _e('Video') ?></a></li>
+ </ul>
+
+ <form action="press-this.php?action=post" method="post">
+
+ <?php wp_nonce_field('press-this') ?>
+ <input type="hidden" name="post_type" id="post_type" value="text"/>
+ <div id="posting">
+
+ <h2 id="title"><label for="post_title"><?php _e('Title') ?></label></h2>
+ <div class="titlewrap">
+ <input name="post_title" id="post_title" class="text" value="<?php echo attribute_escape($title);?>"/>
+ </div>
+
+ <div id="extra_fields" style="display: none"></div>
+ <div class="editor_area">
+ <h2 id="content_type"><label for="content"><?php _e('Post') ?></label></h2>
+ <div class="editor-container">
+ <textarea name="content" id="content" style="width:100%;" class="mceEditor">
+ <?php echo $selection; ?>
+ </textarea>
+ </div>
+ </div>
+
+ </div>
+ <?php category_div(); ?>
+ </form>
+
+</body>
+</html>
diff --git a/wp-admin/revision.php b/wp-admin/revision.php
new file mode 100644
index 0000000..a00fa81
--- /dev/null
+++ b/wp-admin/revision.php
@@ -0,0 +1,209 @@
+<?php
+
+require_once('admin.php');
+
+wp_reset_vars(array('revision', 'left', 'right', 'action'));
+$revision_id = absint($revision);
+$diff = absint($diff);
+$left = absint($left);
+$right = absint($right);
+
+$parent_file = $redirect = 'edit.php';
+
+switch ( $action ) :
+case 'delete' : // stubs
+case 'edit' :
+ if ( constant('WP_POST_REVISIONS') ) // stub
+ $redirect = remove_query_arg( 'action' );
+ else // Revisions disabled
+ $redirect = 'edit.php';
+ break;
+case 'restore' :
+ if ( !$revision = wp_get_post_revision( $revision_id ) )
+ break;
+ if ( !current_user_can( 'edit_post', $revision->post_parent ) )
+ break;
+ if ( !$post = get_post( $revision->post_parent ) )
+ break;
+
+ if ( !constant('WP_POST_REVISIONS') && !wp_is_post_autosave( $revision ) ) // Revisions disabled and we're not looking at an autosave
+ break;
+
+ check_admin_referer( "restore-post_$post->ID|$revision->ID" );
+
+ wp_restore_post_revision( $revision->ID );
+ $redirect = add_query_arg( array( 'message' => 5, 'revision' => $revision->ID ), get_edit_post_link( $post->ID, 'url' ) );
+ break;
+case 'diff' :
+ if ( !$left_revision = get_post( $left ) )
+ break;
+ if ( !$right_revision = get_post( $right ) )
+ break;
+
+ if ( !current_user_can( 'read_post', $left_revision->ID ) || !current_user_can( 'read_post', $right_revision->ID ) )
+ break;
+
+ // Don't allow reverse diffs?
+ if ( strtotime($right_revision->post_modified_gmt) < strtotime($left_revision->post_modified_gmt) ) {
+ $redirect = add_query_arg( array( 'left' => $right, 'right' => $left ) );
+ break;
+ }
+
+ if ( $left_revision->ID == $right_revision->post_parent ) // right is a revision of left
+ $post =& $left_revision;
+ elseif ( $left_revision->post_parent == $right_revision->ID ) // left is a revision of right
+ $post =& $right_revision;
+ elseif ( $left_revision->post_parent == $right_revision->post_parent ) // both are revisions of common parent
+ $post = get_post( $left_revision->post_parent );
+ else
+ break; // Don't diff two unrelated revisions
+
+ if ( !constant('WP_POST_REVISIONS') ) { // Revisions disabled
+ if (
+ // we're not looking at an autosave
+ ( !wp_is_post_autosave( $left_revision ) && !wp_is_post_autosave( $right_revision ) )
+ ||
+ // we're not comparing an autosave to the current post
+ ( $post->ID !== $left_revision->ID && $post->ID !== $right_revision->ID )
+ )
+ break;
+ }
+
+ if (
+ // They're the same
+ $left_revision->ID == $right_revision->ID
+ ||
+ // Neither is a revision
+ ( !wp_get_post_revision( $left_revision->ID ) && !wp_get_post_revision( $right_revision->ID ) )
+ )
+ break;
+
+ $post_title = '<a href="' . get_edit_post_link() . '">' . get_the_title() . '</a>';
+ $h2 = sprintf( __( 'Compare Revisions of &#8220;%1$s&#8221;' ), $post_title );
+
+ $left = $left_revision->ID;
+ $right = $right_revision->ID;
+
+ $redirect = false;
+ break;
+case 'view' :
+default :
+ if ( !$revision = wp_get_post_revision( $revision_id ) )
+ break;
+ if ( !$post = get_post( $revision->post_parent ) )
+ break;
+
+ if ( !current_user_can( 'read_post', $revision->ID ) || !current_user_can( 'read_post', $post->ID ) )
+ break;
+
+ if ( !constant('WP_POST_REVISIONS') && !wp_is_post_autosave( $revision ) ) // Revisions disabled and we're not looking at an autosave
+ break;
+
+ $post_title = '<a href="' . get_edit_post_link() . '">' . get_the_title() . '</a>';
+ $revision_title = wp_post_revision_title( $revision, false );
+ $h2 = sprintf( __( 'Post Revision for &#8220;%1$s&#8221; created on %2$s' ), $post_title, $revision_title );
+
+ // Sets up the diff radio buttons
+ $left = $revision->ID;
+ $right = $post->ID;
+
+ $redirect = false;
+ break;
+endswitch;
+
+if ( !$redirect && !in_array( $post->post_type, array( 'post', 'page' ) ) )
+ $redirect = 'edit.php';
+
+if ( $redirect ) {
+ wp_redirect( $redirect );
+ exit;
+}
+
+if ( 'page' == $post->post_type ) {
+ $submenu_file = 'edit-pages.php';
+ $title = __( 'Page Revisions' );
+} else {
+ $submenu_file = 'edit.php';
+ $title = __( 'Post Revisions' );
+}
+
+// Converts post_author ID# into name
+add_filter( '_wp_post_revision_field_post_author', 'get_author_name' );
+
+require_once( 'admin-header.php' );
+
+?>
+
+<div class="wrap">
+
+<h2 class="long-header"><?php echo $h2; ?></h2>
+
+<table class="form-table ie-fixed">
+ <col class="th" />
+<?php if ( 'diff' == $action ) : ?>
+<tr id="revision">
+ <th scope="row"></th>
+ <th scope="col" class="th-full">
+ <span class="alignleft"><?php printf( __('Older: %s'), wp_post_revision_title( $left_revision ) ); ?></span>
+ <span class="alignright"><?php printf( __('Newer: %s'), wp_post_revision_title( $right_revision ) ); ?></span>
+ </th>
+</tr>
+<?php endif;
+
+// use get_post_to_edit filters?
+$identical = true;
+foreach ( _wp_post_revision_fields() as $field => $field_title ) :
+ if ( 'diff' == $action ) {
+ $left_content = apply_filters( "_wp_post_revision_field_$field", $left_revision->$field, $field );
+ $right_content = apply_filters( "_wp_post_revision_field_$field", $right_revision->$field, $field );
+ if ( !$content = wp_text_diff( $left_content, $right_content ) )
+ continue; // There is no difference between left and right
+ $identical = false;
+ } else {
+ add_filter( "_wp_post_revision_field_$field", 'htmlspecialchars' );
+ $content = apply_filters( "_wp_post_revision_field_$field", $revision->$field, $field );
+ }
+ ?>
+
+ <tr id="revision-field-<?php echo $field; ?>">
+ <th scope="row"><?php echo wp_specialchars( $field_title ); ?></th>
+ <td><div class="pre"><?php echo $content; ?></div></td>
+ </tr>
+
+ <?php
+
+endforeach;
+
+if ( 'diff' == $action && $identical ) :
+
+ ?>
+
+ <tr><td colspan="2"><div class="updated"><p><?php _e( 'These revisions are identical.' ); ?></p></div></td></tr>
+
+ <?php
+
+endif;
+
+?>
+
+</table>
+
+<br class="clear" />
+
+<h2><?php echo $title; ?></h2>
+
+<?php
+
+$args = array( 'format' => 'form-table', 'parent' => true, 'right' => $right, 'left' => $left );
+if ( !constant( 'WP_POST_REVISIONS' ) )
+ $args['type'] = 'autosave';
+
+wp_list_post_revisions( $post, $args );
+
+?>
+
+</div>
+
+<?php
+
+require_once( 'admin-footer.php' );
diff --git a/wp-admin/setup-config.php b/wp-admin/setup-config.php
index 796ca07..a5c78c2 100644
--- a/wp-admin/setup-config.php
+++ b/wp-admin/setup-config.php
@@ -21,6 +21,10 @@ if ( !is_writable('../'))
if (file_exists('../wp-config.php'))
wp_die("<p>The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>.</p>");
+// Check if wp-config.php exists above the root directory
+if (file_exists('../../wp-config.php'))
+ wp_die("<p>The file 'wp-config.php' already exists one level above your WordPress installation. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>.</p>");
+
if (isset($_GET['step']))
$step = $_GET['step'];
else
@@ -69,28 +73,28 @@ switch($step) {
<p>Below you should enter your database connection details. If you're not sure about these, contact your host. </p>
<table class="form-table">
<tr>
- <th scope="row">Database Name</th>
- <td><input name="dbname" type="text" size="25" value="wordpress" /></td>
+ <th scope="row"><label for="dbname">Database Name</label></th>
+ <td><input name="dbname" id="dbname" type="text" size="25" value="wordpress" /></td>
<td>The name of the database you want to run WP in. </td>
</tr>
<tr>
- <th scope="row">User Name</th>
- <td><input name="uname" type="text" size="25" value="username" /></td>
+ <th scope="row"><label for="uname">User Name</label></th>
+ <td><input name="uname" id="uname" type="text" size="25" value="username" /></td>
<td>Your MySQL username</td>
</tr>
<tr>
- <th scope="row">Password</th>
- <td><input name="pwd" type="text" size="25" value="password" /></td>
+ <th scope="row"><label for="pwd">Password</label></th>
+ <td><input name="pwd" id="pwd" type="text" size="25" value="password" /></td>
<td>...and MySQL password.</td>
</tr>
<tr>
- <th scope="row">Database Host</th>
- <td><input name="dbhost" type="text" size="25" value="localhost" /></td>
+ <th scope="row"><label for="dbhost">Database Host</label></th>
+ <td><input name="dbhost" id="dbhost" type="text" size="25" value="localhost" /></td>
<td>99% chance you won't need to change this value.</td>
</tr>
<tr>
- <th scope="row">Table Prefix</th>
- <td><input name="prefix" type="text" id="prefix" value="wp_" size="25" /></td>
+ <th scope="row"><label for="prefix">Table Prefix</label></th>
+ <td><input name="prefix" id="prefix" type="text" id="prefix" value="wp_" size="25" /></td>
<td>If you want to run multiple WordPress installations in a single database, change this.</td>
</tr>
</table>
diff --git a/wp-admin/sidebar.php b/wp-admin/sidebar.php
index 9287285..43465ab 100644
--- a/wp-admin/sidebar.php
+++ b/wp-admin/sidebar.php
@@ -14,8 +14,9 @@ if ('b' == $_GET['a']) {
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=UTF-8" />
<title><?php _e('WordPress &#8250; Posted'); ?></title>
<?php
-wp_admin_css( 'css/global' );
-wp_admin_css();
+wp_admin_css( 'global', true );
+wp_admin_css( 'wp-admin', true );
+wp_admin_css( 'colors', true );
?>
</head>
<body>
@@ -32,8 +33,9 @@ wp_admin_css();
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('blog_charset'); ?>" />
<title><?php _e('WordPress &#8250; Sidebar'); ?></title>
<?php
-wp_admin_css( 'css/global' );
-wp_admin_css();
+wp_admin_css( 'global', true );
+wp_admin_css( 'wp-admin', true );
+wp_admin_css( 'colors', true );
?>
<style type="text/css" media="screen">
form {
@@ -60,8 +62,8 @@ form {
<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
<input type="hidden" name="mode" value="sidebar" />
<?php wp_nonce_field('add-post'); ?>
-<p><?php _e('Title:'); ?>
-<input type="text" name="post_title" size="20" tabindex="1" style="width: 100%;" />
+<p><label for="post_title"><?php _e('Title:'); ?></label>
+<input type="text" name="post_title" id="post_title" size="20" tabindex="1" style="width: 100%;" />
</p>
<p><?php _e('Categories:'); ?>
<span class="sidebar-categories">
@@ -69,8 +71,8 @@ form {
</span>
</p>
<p>
-Post:
-<textarea rows="8" cols="12" style="width: 100%" name="content" tabindex="2"></textarea>
+<label for="content">Post:</label>
+<textarea rows="8" cols="12" style="width: 100%" name="content" id="content" tabindex="2"></textarea>
</p>
<p>
<input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="<?php _e('Save as Draft'); ?>" />
diff --git a/wp-admin/themes.php b/wp-admin/themes.php
index 3b4103b..e09d8e8 100644
--- a/wp-admin/themes.php
+++ b/wp-admin/themes.php
@@ -36,6 +36,10 @@ if ( isset($_GET['action']) ) {
$title = __('Manage Themes');
$parent_file = 'themes.php';
+
+add_thickbox();
+wp_enqueue_script( 'theme-preview' );
+
require_once('admin-header.php');
if( is_site_admin() ) {
?><div id="message0" class="updated fade"><p><?php _e('Administrator: new themes must be activated in the <a href="wpmu-themes.php">Themes Admin</a> page before they appear here.'); ?></p></div><?php
@@ -48,32 +52,80 @@ if( is_site_admin() ) {
<div id="message2" class="updated fade"><p><?php printf(__('New theme activated. <a href="%s">Visit site</a>'), get_bloginfo('url') . '/'); ?></p></div>
<?php endif; ?>
+<?php
+ksort( $themes );
+$theme_total = count( $themes );
+$per_page = 15;
+
+if ( isset( $_GET['pagenum'] ) )
+ $page = absint( $_GET['pagenum'] );
+
+if ( empty($page) )
+ $page = 1;
+
+$start = $offset = ( $page - 1 ) * $per_page;
+
+$page_links = paginate_links( array(
+ 'base' => add_query_arg( 'pagenum', '%#%' ) . '#themenav',
+ 'format' => '',
+ 'total' => ceil($theme_total / $per_page),
+ 'current' => $page
+));
+
+$themes = array_slice( $themes, $start, $per_page );
+
+?>
<div class="wrap">
<h2><?php _e('Current Theme'); ?></h2>
-<div id="currenttheme">
+<div id="current-theme">
<?php if ( $ct->screenshot ) : ?>
-<img src="<?php echo get_option('siteurl') . '/' . $ct->stylesheet_dir . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" />
+<img src="<?php echo WP_CONTENT_URL . $ct->stylesheet_dir . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" />
<?php endif; ?>
<h3><?php printf(_c('%1$s %2$s by %3$s|1: theme title, 2: theme version, 3: theme author'), $ct->title, $ct->version, $ct->author) ; ?></h3>
-<p><?php echo $ct->description; ?></p>
+<p class="description"><?php echo $ct->description; ?></p>
<?php if ( $ct->tags ) : ?>
<p><?php _e('Tags:'); ?> <?php echo join(', ', $ct->tags); ?></p>
<?php endif; ?>
</div>
<h2><?php _e('Available Themes'); ?></h2>
-<?php if ( 1 < count($themes) ) { ?>
+<br class="clear" />
+
+<?php if ( $page_links ) : ?>
+<div class="tablenav">
+<?php echo "<div class='tablenav-pages'>$page_links</div>"; ?>
+<br class="clear" />
+</div>
+<br class="clear" />
+<?php endif; ?>
+<?php if ( 1 < $theme_total ) { ?>
+<table id="availablethemes" cellspacing="0" cellpadding="0">
<?php
$style = '';
$theme_names = array_keys($themes);
natcasesort($theme_names);
-foreach ($theme_names as $theme_name) {
- if ( $theme_name == $ct->name )
- continue;
+$rows = ceil(count($theme_names) / 3);
+for ( $row = 1; $row <= $rows; $row++ )
+ for ( $col = 1; $col <= 3; $col++ )
+ $table[$row][$col] = array_shift($theme_names);
+
+foreach ( $table as $row => $cols ) {
+?>
+<tr>
+<?php
+foreach ( $cols as $col => $theme_name ) {
+ $class = array('available-theme');
+ if ( $row == 1 ) $class[] = 'top';
+ if ( $col == 1 ) $class[] = 'left';
+ if ( $row == $rows ) $class[] = 'bottom';
+ if ( $col == 3 ) $class[] = 'right';
+?>
+ <td class="<?php echo join(' ', $class); ?>">
+<?php if ( !empty($theme_name) ) :
$template = $themes[$theme_name]['Template'];
$stylesheet = $themes[$theme_name]['Stylesheet'];
$title = $themes[$theme_name]['Title'];
@@ -82,26 +134,44 @@ foreach ($theme_names as $theme_name) {
$author = $themes[$theme_name]['Author'];
$screenshot = $themes[$theme_name]['Screenshot'];
$stylesheet_dir = $themes[$theme_name]['Stylesheet Dir'];
+ $preview_link = clean_url( get_option('home') . '/');
+ $preview_link = add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true', 'width' => 600, 'height' => 400 ), $preview_link );
+ $preview_text = attribute_escape( sprintf( __('Preview of "%s"'), $title ) );
$tags = $themes[$theme_name]['Tags'];
+ $thickbox_class = 'thickbox';
$activate_link = wp_nonce_url("themes.php?action=activate&amp;template=".urlencode($template)."&amp;stylesheet=".urlencode($stylesheet), 'switch-theme_' . $template);
+ $activate_text = attribute_escape( sprintf( __('Activate "%s"'), $title ) );
?>
-<div class="available-theme">
-<h3><a href="<?php echo $activate_link; ?>"><?php echo $title; ?></a></h3>
-
-<a href="<?php echo $activate_link; ?>" class="screenshot">
+ <a href="<?php echo $activate_link; ?>" class="<?php echo $thickbox_class; ?> screenshot">
<?php if ( $screenshot ) : ?>
-<img src="<?php echo get_option('siteurl') . '/' . $stylesheet_dir . '/' . $screenshot; ?>" alt="" />
+ <img src="<?php echo WP_CONTENT_URL . $stylesheet_dir . '/' . $screenshot; ?>" alt="" />
<?php endif; ?>
-</a>
-
-<p><?php echo $description; ?></p>
+ </a>
+ <h3><a class="<?php echo $thickbox_class; ?>" href="<?php echo $activate_link; ?>"><?php echo $title; ?></a></h3>
+ <p><?php echo $description; ?></p>
<?php if ( $tags ) : ?>
-<p><?php _e('Tags:'); ?> <?php echo join(', ', $tags); ?></p>
+ <p><?php _e('Tags:'); ?> <?php echo join(', ', $tags); ?></p>
+ <noscript><p class="themeactions"><a href="<?php echo $preview_link; ?>" title="<?php echo $preview_text; ?>"><?php _e('Preview'); ?></a> <a href="<?php echo $activate_link; ?>" title="<?php echo $activate_text; ?>"><?php _e('Activate'); ?></a></p></noscript>
<?php endif; ?>
+ <div style="display:none;"><a class="previewlink" href="<?php echo $preview_link; ?>"><?php echo $preview_text; ?></a> <a class="activatelink" href="<?php echo $activate_link; ?>"><?php echo $activate_text; ?></a></div>
+<?php endif; // end if not empty theme_name ?>
+ </td>
+<?php } // end foreach $cols ?>
+</tr>
+<?php } // end foreach $table ?>
+</table>
+<?php } ?>
+
+<br class="clear" />
+
+<?php if ( $page_links ) : ?>
+<div class="tablenav">
+<?php echo "<div class='tablenav-pages'>$page_links</div>"; ?>
+<br class="clear" />
</div>
-<?php } // end foreach theme_names ?>
+<?php endif; ?>
-<?php } ?>
+<br class="clear" />
<?php
// List broken themes, if any.
diff --git a/wp-admin/update-links.php b/wp-admin/update-links.php
index 6641279..5fd02e0 100644
--- a/wp-admin/update-links.php
+++ b/wp-admin/update-links.php
@@ -1,5 +1,5 @@
<?php
-require_once('../wp-config.php');
+require_once('../wp-load.php');
require_once( ABSPATH . 'wp-includes/class-snoopy.php');
if ( !get_option('use_linksupdate') )
@@ -36,9 +36,9 @@ if ( false !== ( $fs = @fsockopen('api.pingomatic.com', 80, $errno, $errstr, 5)
$returns = explode("\n", $body);
foreach ($returns as $return) :
- $time = $wpdb->escape( substr($return, 0, 19) );
- $uri = $wpdb->escape( preg_replace('/(.*?) | (.*?)/', '$2', $return) );
- $wpdb->query("UPDATE $wpdb->links SET link_updated = '$time' WHERE link_url = '$uri'");
+ $time = substr($return, 0, 19);
+ $uri = preg_replace('/(.*?) | (.*?)/', '$2', $return);
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->links SET link_updated = %s WHERE link_url = %s", $time, $uri) );
endforeach;
}
?>
diff --git a/wp-admin/update.php b/wp-admin/update.php
index be95102..c3cd289 100644
--- a/wp-admin/update.php
+++ b/wp-admin/update.php
@@ -2,8 +2,8 @@
require_once('admin.php');
-if ( !current_user_can('edit_plugins') )
- wp_die('<p>'.__('You do not have sufficient permissions to update plugins for this blog.').'</p>');
+if ( ! current_user_can('update_plugins') )
+ wp_die(__('You do not have sufficient permissions to update plugins for this blog.'));
function request_filesystem_credentials($form_post, $type = '', $error = false) {
$req_cred = apply_filters('request_filesystem_credentials', '', $form_post, $type, $error);
@@ -45,19 +45,19 @@ function request_filesystem_credentials($form_post, $type = '', $error = false)
<p><?php _e('To perform the requested update, FTP connection information is required.') ?></p>
<table class="form-table">
<tr valign="top">
-<th scope="row"><?php _e('Hostname:') ?></th>
+<th scope="row"><label for="hostname"><?php _e('Hostname:') ?></label></th>
<td><input name="hostname" type="text" id="hostname" value="<?php echo attribute_escape($hostname) ?>"<?php if( defined('FTP_HOST') ) echo ' disabled="disabled"' ?> size="40" /></td>
</tr>
<tr valign="top">
-<th scope="row"><?php _e('Username:') ?></th>
+<th scope="row"><label for="username"><?php _e('Username:') ?></label></th>
<td><input name="username" type="text" id="username" value="<?php echo attribute_escape($username) ?>"<?php if( defined('FTP_USER') ) echo ' disabled="disabled"' ?> size="40" /></td>
</tr>
<tr valign="top">
-<th scope="row"><?php _e('Password:') ?></th>
+<th scope="row"><label for="password"><?php _e('Password:') ?></label></th>
<td><input name="password" type="password" id="password" value=""<?php if( defined('FTP_PASS') ) echo ' disabled="disabled"' ?> size="40" /><?php if( defined('FTP_PASS') && !empty($password) ) echo '<em>'.__('(Password not shown)').'</em>'; ?></td>
</tr>
<tr valign="top">
-<th scope="row"><?php _e('Use SSL:') ?></th>
+<th scope="row"><label for="ssl"><?php _e('Use SSL:') ?></label></th>
<td>
<select name="ssl" id="ssl"<?php if( defined('FTP_SSL') ) echo ' disabled="disabled"' ?>>
<?php
@@ -110,15 +110,16 @@ function do_plugin_upgrade($plugin) {
return;
}
- $was_activated = is_plugin_active($plugin); //Check now, It'll be deactivated by the next line if it is,
+ $was_activated = is_plugin_active($plugin); //Check now, It'll be deactivated by the next line if it is
$result = wp_update_plugin($plugin, 'show_message');
if ( is_wp_error($result) ) {
show_message($result);
+ show_message( __('Installation Failed') );
} else {
- //Result is the new plugin file relative to PLUGINDIR
- show_message(__('Plugin upgraded successfully'));
+ //Result is the new plugin file relative to WP_PLUGIN_DIR
+ show_message( __('Plugin upgraded successfully') );
if( $result && $was_activated ){
show_message(__('Attempting reactivation of the plugin'));
echo '<iframe style="border:0" width="100%" height="170px" src="' . wp_nonce_url('update.php?action=activate-plugin&plugin=' . $result, 'activate-plugin_' . $result) .'"></iframe>';
@@ -151,8 +152,8 @@ if ( isset($_GET['action']) ) {
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
<title><?php bloginfo('name') ?> &rsaquo; <?php _e('Plugin Reactivation'); ?> &#8212; <?php _e('WordPress'); ?></title>
<?php
-wp_admin_css( 'css/global' );
-wp_admin_css( 'css/colors' );
+wp_admin_css( 'global', true );
+wp_admin_css( 'colors', true );
?>
</head>
<body>
@@ -164,7 +165,7 @@ wp_admin_css( 'css/colors' );
echo '<p>' . __('Plugin failed to reactivate due to a fatal error.') . '</p>';
error_reporting( E_ALL ^ E_NOTICE );
@ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
- include(ABSPATH . PLUGINDIR . '/' . $plugin);
+ include(WP_PLUGIN_DIR . '/' . $plugin);
}
echo "</body></html>";
}
diff --git a/wp-admin/upgrade.php b/wp-admin/upgrade.php
index a831abd..dc7ec4b 100644
--- a/wp-admin/upgrade.php
+++ b/wp-admin/upgrade.php
@@ -1,9 +1,7 @@
<?php
define('WP_INSTALLING', true);
-if (!file_exists('../wp-config.php'))
- die("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://codex.wordpress.org/Installing_WordPress#Step_3:_Set_up_wp-config.php'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.</p><p><a href='setup-config.php' class='button'>Create a Configuration File</a>");
-require('../wp-config.php');
+require('../wp-load.php');
timer_start();
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
@@ -18,7 +16,7 @@ else
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
<title><?php _e('WordPress &rsaquo; Upgrade'); ?></title>
- <?php wp_admin_css( 'css/install' ); ?>
+ <?php wp_admin_css( 'install', true ); ?>
</head>
<body>
<h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
diff --git a/wp-admin/upload.php b/wp-admin/upload.php
index 0f7412d..cf6c191 100644
--- a/wp-admin/upload.php
+++ b/wp-admin/upload.php
@@ -125,6 +125,7 @@ endif;
?>
<p id="post-search">
+ <label class="hidden" for="post-search-input"><?php _e( 'Search Media' ); ?>:</label>
<input type="text" id="post-search-input" name="s" value="<?php the_search_query(); ?>" />
<input type="submit" value="<?php _e( 'Search Media' ); ?>" class="button" />
</p>
@@ -211,7 +212,7 @@ if ( $page_links )
if ( 1 == count($posts) && is_singular() ) :
- $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
+ $comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved != 'spam' ORDER BY comment_date", $id) );
if ( $comments ) :
// Make sure comments, post, and post_author are cached
update_comment_cache($comments);
diff --git a/wp-admin/user-edit.php b/wp-admin/user-edit.php
index b01c3a8..76979f6 100644
--- a/wp-admin/user-edit.php
+++ b/wp-admin/user-edit.php
@@ -169,7 +169,7 @@ include ('admin-header.php');
<?php endif; ?>
<tr>
<th scope="row"><?php _e('Admin Color Scheme')?></th>
-<td>
+<td><fieldset><legend class="hidden"><?php _e('Admin Color Scheme')?></legend>
<?php
$current_color = get_user_option('admin_color', $user_id);
if ( empty($current_color) )
@@ -188,7 +188,7 @@ foreach ( $_wp_admin_css_colors as $color => $color_info ): ?>
<label for="admin_color_<?php echo $color; ?>"><?php echo $color_info->name ?></label>
</div>
<?php endforeach; ?>
-</td>
+</fieldset></td>
</tr>
</table>
diff --git a/wp-admin/users.php b/wp-admin/users.php
index b4b2e9d..4faf5ce 100644
--- a/wp-admin/users.php
+++ b/wp-admin/users.php
@@ -145,13 +145,13 @@ case 'delete':
?>
</ul>
<?php if ( $go_delete ) : ?>
- <p><?php _e('What should be done with posts and links owned by this user?'); ?></p>
+ <fieldset><p><legend><?php _e('What should be done with posts and links owned by this user?'); ?></legend></p>
<ul style="list-style:none;">
<li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" checked="checked" />
<?php _e('Delete all posts and links.'); ?></label></li>
<li><input type="radio" id="delete_option1" name="delete_option" value="reassign" />
<?php echo '<label for="delete_option1">'.__('Attribute all posts and links to:')."</label> $user_dropdown"; ?></li>
- </ul>
+ </ul></fieldset>
<input type="hidden" name="action" value="dodelete" />
<p class="submit"><input type="submit" name="submit" value="<?php _e('Confirm Deletion'); ?>" class="button-secondary" /></p>
<?php else : ?>
@@ -412,6 +412,7 @@ unset($role_links);
?>
</ul>
<p id="post-search">
+ <label class="hidden" for="post-search-input"><?php _e( 'Search Users' ); ?>:</label>
<input type="text" id="post-search-input" name="usersearch" value="<?php echo attribute_escape($wp_user_search->search_term); ?>" />
<input type="submit" value="<?php _e( 'Search Users' ); ?>" class="button" />
</p>
@@ -424,7 +425,7 @@ unset($role_links);
<div class="alignleft">
<input type="submit" value="<?php _e('Remove'); ?>" name="removeit" class="button-secondary delete" />
-<select name="new_role"><option value=''><?php _e('Change role to&hellip;') ?></option>"<?php wp_dropdown_roles(); ?></select>
+<label class="hidden" for="new_role"><?php _e('Change role to&hellip;') ?></label><select name="new_role" id="new_role"><option value=''><?php _e('Change role to&hellip;') ?></option>"<?php wp_dropdown_roles(); ?></select>
<input type="submit" value="<?php _e('Change'); ?>" name="changeit" class="button-secondary" />
<?php wp_nonce_field('bulk-users'); ?>
</div>
@@ -455,7 +456,7 @@ unset($role_links);
<table class="widefat">
<thead>
<tr class="thead">
- <th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /> </th>
+ <th scope="col" class="check-column"><input type="checkbox" /></th>
<th><?php _e('Username') ?></th>
<th><?php _e('Name') ?></th>
<th><?php _e('E-mail') ?></th>
@@ -487,9 +488,9 @@ foreach ( $wp_user_search->get_results() as $userid ) {
<br class="clear" />
</div>
-</form>
<?php endif; ?>
+</form>
</div>
<?php
@@ -503,6 +504,7 @@ foreach ( $wp_user_search->get_results() as $userid ) {
?>
<br class="clear" />
+<?php if ( current_user_can('create_users') ) { ?>
<?php if( apply_filters('show_adduser_fields', true) ) {?>
<div class="wrap">
@@ -529,7 +531,7 @@ foreach ( $wp_user_search->get_results() as $userid ) {
</table>
<p class="submit">
<?php echo $referer; ?>
- <input name="adduser" type="submit" id="addusersub" value="<?php _e('Add User &raquo;') ?>" />
+ <input name="adduser" type="submit" id="addusersub" value="<?php _e('Add User') ?>" />
</p>
</form>
</div>
@@ -547,6 +549,7 @@ foreach ( $wp_user_search->get_results() as $userid ) {
</div>
<?php
+}
break;
} // end of the $action switch
diff --git a/wp-admin/widgets.php b/wp-admin/widgets.php
index 5e4659e..7492276 100644
--- a/wp-admin/widgets.php
+++ b/wp-admin/widgets.php
@@ -7,6 +7,7 @@ if ( ! current_user_can('switch_themes') )
wp_die( __( 'Cheatin&#8217; uh?' ));
wp_enqueue_script( array( 'wp-lists', 'admin-widgets' ) );
+wp_admin_css( 'widgets' );
do_action( 'sidebar_admin_setup' );
@@ -234,15 +235,16 @@ if ( isset($_GET['message']) && isset($messages[$_GET['message']]) ) : ?>
<h2><?php _e( 'Widgets' ); ?></h2>
<p id="widget-search">
+ <label class="hidden" for="widget-search-input"><?php _e( 'Search Widgets' ); ?>:</label>
<input type="text" id="widget-search-input" name="s" value="<?php echo attribute_escape( $widget_search ); ?>" />
<input type="submit" class="button" value="<?php _e( 'Search Widgets' ); ?>" />
</p>
<div class="widget-liquid-left-holder">
<div id="available-widgets-filter" class="widget-liquid-left">
- <h3><?php _e('Available Widgets'); ?></h3>
+ <h3><label for="show"><?php _e('Available Widgets'); ?></label></h3>
<div class="nav">
- <select name="show">
+ <select name="show" id="show">
<?php foreach ( $show_values as $show_value => $show_text ) : $show_value = attribute_escape( $show_value ); ?>
<option value='<?php echo $show_value; ?>'<?php selected( $show_value, $show ); ?>><?php echo wp_specialchars( $show_text ); ?></option>
<?php endforeach; ?>
@@ -256,7 +258,7 @@ if ( isset($_GET['message']) && isset($messages[$_GET['message']]) ) : ?>
</div>
<div id="available-sidebars" class="widget-liquid-right">
- <h3><?php _e('Current Widgets'); ?></h3>
+ <h3><label for="sidebar-selector"><?php _e('Current Widgets'); ?></label></h3>
<div class="nav">
<select id="sidebar-selector" name="sidebar">
diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css
index 7a9283c..f61932b 100644
--- a/wp-admin/wp-admin.css
+++ b/wp-admin/wp-admin.css
@@ -1,13 +1,13 @@
-#plugins .name {
+.plugins .name {
font-weight: bold;
}
-#plugins p {
+.plugins p {
margin: 0 4px;
padding: 0;
}
-#plugins .togl {
+.plugins .togl {
width: 150px;
border-right-width: 1px;
border-right-style: solid;
@@ -52,28 +52,90 @@ form#upload #post_content {
margin: 10px 20px 10px 20px;
}
-.available-theme {
- width: 30%;
- margin: 0 1em;
- float: left;
- text-align: center;
- height: 28em;
- overflow: hidden;
+table#availablethemes {
+ border-spacing: 0px;
+ border: none;
+ border-top: 1px solid #ccc;
+ border-bottom: 1px solid #ccc;
+ margin: 10px auto;
+}
+td.available-theme {
+ vertical-align: top;
+ width: 240px;
+ margin: 0;
+ padding: 20px;
+ text-align: left;
+}
+table#availablethemes td {
+ border: 1px solid #eee;
+ border-top: none;
+}
+table#availablethemes td.top {
+ border-top: none;
+}
+table#availablethemes td.right {
+ border-right: none;
+ border-left: none;
+}
+table#availablethemes td.bottom {
+ border-bottom: none;
+}
+table#availablethemes td.left {
+ border-right: none;
+ border-left: none;
}
.available-theme a.screenshot {
- width: 250px;
- height: 200px;
+ width: 240px;
+ height: 180px;
display: block;
- margin: auto;
+ border: 1px solid #efefef;
margin-bottom: 10px;
overflow: hidden;
- border-width: 1px;
- border-style: solid;
}
-
.available-theme img {
- width: 100%;
+ width: 240px;
+}
+.available-theme h3 {
+ margin: 15px 0 5px;
+}
+
+#current-theme {
+ margin-top: 1em;
+}
+
+#current-theme a {
+ border-bottom: none;
+}
+
+#current-theme h3 {
+ font-size: 17px;
+ font-weight: normal;
+ margin: 0;
+}
+
+#current-theme .description {
+ margin-top: 5px;
+}
+
+#current-theme img {
+ float: left;
+ border: 1px solid #666;
+ margin-right: 1em;
+ margin-bottom: 1.5em;
+ width: 150px;
+}
+
+#TB_window #TB_title a.tb-theme-preview-link,
+#TB_window #TB_title a.tb-theme-preview-link:visited {
+ font-weight: bold;
+ color: #999;
+ text-decoration: none;
+}
+
+#TB_window #TB_title a.tb-theme-preview-link:hover,
+#TB_window #TB_title a.tb-theme-preview-link:focus {
+ color: #ccc;
}
.checkbox {
@@ -249,15 +311,6 @@ textarea.all-options, input.all-options {
border-collapse: separate;
}
-#currenttheme img {
- float: left;
- margin-right: 1em;
- margin-bottom: 1.5em;
- width: 300px;
- border-width: 1px;
- border-style: solid;
-}
-
#quicktags {
padding: 0;
border: 0 none;
@@ -394,26 +447,6 @@ set display:none; */
height: 22px;
}
-#your-profile fieldset {
- border-width: 1px;
- border-style: solid;
- float: left;
- width: 40%;
- padding: .5em 2em 1em;
- margin: 1em 1em 1em 0;
-}
-
-#your-profile fieldset input {
- width: 100%;
- font-size: 20px;
- padding: 2px;
-}
-
-#your-profile fieldset textarea {
- width: 100%;
- padding: 2px;
-}
-
#your-profile legend {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 22px;
@@ -894,6 +927,24 @@ html, body {
margin-right: 5px
}
+.form-table .pre {
+ padding: 8px;
+ margin: 0;
+}
+
+.pre {
+ /* http://www.longren.org/2006/09/27/wrapping-text-inside-pre-tags/ */
+ white-space: pre-wrap; /* css-3 */
+ white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
+ white-space: -pre-wrap; /* Opera 4-6 */
+ white-space: -o-pre-wrap; /* Opera 7 */
+ word-wrap: break-word; /* Internet Explorer 5.5+ */
+}
+
+table.form-table td .updated {
+ font-size: 13px;
+}
+
/* Post Screen */
#tagsdiv #newtag {
@@ -970,6 +1021,7 @@ html, body {
font-size: 1.5em;
margin-bottom: 15px;
padding: 0 0 3px;
+ clear: left;
}
#poststuff h3 {
@@ -1341,6 +1393,11 @@ p#post-search {
vertical-align:text-top;
}
+.defaultavatarpicker .avatar {
+ margin: 2px 0;
+ vertical-align: middle;
+}
+
body.minwidth {
min-width: 808px;
}
@@ -1464,3 +1521,92 @@ td.action-links, th.action-links {
.hide-if-no-js {
display: none;
}
+
+/* Diff */
+
+table.diff {
+ width: 100%;
+}
+
+table.diff col.content {
+ width: 50%;
+}
+
+table.diff tr {
+ background-color: transparent;
+}
+
+table.diff td, table.diff th {
+ padding: .5em;
+ font-family: monospace;
+ border: none;
+}
+
+table.diff .diff-deletedline del, table.diff .diff-addedline ins {
+ text-decoration: none;
+}
+
+#wp-word-count {
+ display: block;
+}
+
+fieldset {
+ border: 0;
+ padding: 0;
+ margin: 0;
+}
+
+.info-box {
+ top: 100px;
+ left: 50%;
+ margin-left: -225px;
+ height: 300px;
+ width: 450px;
+ border: 5px solid #ddd;
+ background: #f8f8f8;
+ position: absolute;
+ padding: 15px 15px 10px;
+ z-index: 1000;
+ display: none;
+}
+
+.info-box .submit {
+ position: absolute;
+ bottom: 15px;
+ width: 450px;
+ padding: 15px 0 0;
+}
+
+.info-box .gears-img {
+ float: right;
+ margin: 10px;
+}
+
+.info-box-title {
+ line-height: 2;
+ margin: 0;
+ padding: 0 7px;
+}
+
+#wp_editbtns {
+ padding: 2px;
+ position: absolute;
+ display: none;
+ z-index: 999998;
+}
+
+#wp_editimgbtn, #wp_delimgbtn {
+ margin: 2px;
+ padding: 2px;
+ border: 1px solid #999;
+ background-color: #eee;
+ -moz-border-radius: 3px;
+ -khtml-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+}
+
+#wp_editimgbtn:hover, #wp_delimgbtn:hover {
+ border-color: #555;
+ background-color: #ccc;
+}