summaryrefslogtreecommitdiffstats
path: root/wp-admin
diff options
context:
space:
mode:
Diffstat (limited to 'wp-admin')
-rw-r--r--wp-admin/admin-ajax.php5
-rw-r--r--wp-admin/async-upload.php17
-rw-r--r--wp-admin/comment.php4
-rw-r--r--wp-admin/css/media.css54
-rw-r--r--wp-admin/css/widgets-rtl.css4
-rw-r--r--wp-admin/css/widgets.css6
-rw-r--r--wp-admin/custom-header.php128
-rw-r--r--wp-admin/edit-form-advanced.php18
-rw-r--r--wp-admin/edit-form-comment.php3
-rw-r--r--wp-admin/edit-link-form.php2
-rw-r--r--wp-admin/edit-page-form.php4
-rw-r--r--wp-admin/edit-post-rows.php12
-rw-r--r--wp-admin/edit.php8
-rw-r--r--wp-admin/import/blogger.php2
-rw-r--r--wp-admin/import/mt.php2
-rw-r--r--wp-admin/includes/admin.php3
-rw-r--r--wp-admin/includes/class-wp-filesystem-direct.php84
-rw-r--r--wp-admin/includes/comment.php27
-rw-r--r--wp-admin/includes/dashboard.php3
-rw-r--r--wp-admin/includes/file.php3
-rw-r--r--wp-admin/includes/image.php2
-rw-r--r--wp-admin/includes/media.php37
-rw-r--r--wp-admin/includes/post.php9
-rw-r--r--wp-admin/includes/schema.php2
-rw-r--r--wp-admin/includes/template.php147
-rw-r--r--wp-admin/includes/upgrade.php18
-rw-r--r--wp-admin/includes/widgets.php24
-rw-r--r--wp-admin/index.php18
-rw-r--r--wp-admin/js/editor.js33
-rw-r--r--wp-admin/js/post.js9
-rw-r--r--wp-admin/js/widgets.js4
-rw-r--r--wp-admin/menu.php4
-rw-r--r--wp-admin/page.php26
-rw-r--r--wp-admin/post.php26
-rw-r--r--wp-admin/rtl.css6
-rw-r--r--wp-admin/widgets.php4
-rw-r--r--wp-admin/wp-admin.css10
37 files changed, 449 insertions, 319 deletions
diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php
index 13a869e..4e34333 100644
--- a/wp-admin/admin-ajax.php
+++ b/wp-admin/admin-ajax.php
@@ -162,9 +162,8 @@ case 'add-category' : // On the Fly
if ( $parent ) // Do these all at once in a second
continue;
$category = get_category( $cat_id );
- $checked_categories[] = $cat_id;
ob_start();
- dropdown_categories( 0, $category );
+ wp_category_checklist( 0, $cat_id, $checked_categories );
$data = ob_get_contents();
ob_end_clean();
$x->add( array(
@@ -434,7 +433,7 @@ case 'add-meta' :
break;
case 'add-user' :
check_ajax_referer( $action );
- if ( !current_user_can('edit_users') )
+ if ( !current_user_can('create_users') )
die('-1');
require_once(ABSPATH . WPINC . '/registration.php');
if ( !$user_id = add_user() )
diff --git a/wp-admin/async-upload.php b/wp-admin/async-upload.php
index c6350aa..1a37dce 100644
--- a/wp-admin/async-upload.php
+++ b/wp-admin/async-upload.php
@@ -20,13 +20,26 @@ header('Content-Type: text/plain');
if ( !current_user_can('upload_files') )
wp_die(__('You do not have permission to upload files.'));
+// just fetch the detail form for that attachment
+if ( ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) {
+ echo get_media_item($id);
+ exit;
+}
+
$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
if (is_wp_error($id)) {
echo '<div id="media-upload-error">'.wp_specialchars($id->get_error_message()).'</div>';
exit;
}
-$type = $_REQUEST['type'];
-echo apply_filters("async_upload_{$type}", $id);
+if ( $_REQUEST['short'] ) {
+ // short form response - attachment ID only
+ echo $id;
+}
+else {
+ // long form response - big chunk o html
+ $type = $_REQUEST['type'];
+ echo apply_filters("async_upload_{$type}", $id);
+}
?>
diff --git a/wp-admin/comment.php b/wp-admin/comment.php
index 514be26..6691456 100644
--- a/wp-admin/comment.php
+++ b/wp-admin/comment.php
@@ -141,8 +141,10 @@ case 'deletecomment' :
else
wp_delete_comment( $comment->comment_ID );
- if ( '' != wp_get_referer() && false == $noredir )
+ if ( '' != wp_get_referer() && false == $noredir && false === strpos(wp_get_referer(), 'comment.php' ) )
wp_redirect( wp_get_referer() );
+ 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' );
diff --git a/wp-admin/css/media.css b/wp-admin/css/media.css
index 0cb2694..c77a069 100644
--- a/wp-admin/css/media.css
+++ b/wp-admin/css/media.css
@@ -91,8 +91,14 @@ tr.image-size label {
max-height: 40px;
}
-.filename {
- display: none;
+.filename.original {
+ float: left;
+}
+.crunching {
+ display: block;
+ line-height: 32px;
+ text-align: right;
+ margin-right: 5px;
}
button.dismiss {
position: absolute;
@@ -118,27 +124,31 @@ button.dismiss {
border-right-width: 3px;
border-right-style: solid;
}
+
+#library-form .progress, #gallery-form .progress {
+ display: none;
+}
+
.media-item .thumbnail {
max-width: 128px;
max-height: 128px;
}
.media-item .pinkynail {
- position: absolute;
- top: 2px;
- left: 2px;
+ float: left;
+ margin: 2px;
height: 32px;
max-width: 40px;
}
-tbody.media-item-info tr {
+thead.media-item-info tr {
background-color: transparent;
}
-tbody.media-item-info th, tbody.media-item-info td {
+thead.media-item-info th, thead.media-item-info td {
border: none;
margin: 0;
}
-.form-table tbody.media-item-info {
+.form-table thead.media-item-info {
border: 8px solid #fff;
}
@@ -164,23 +174,14 @@ abbr.required {
.describe-toggle-on, .describe-toggle-off {
display: block;
line-height: 36px;
- z-index: 2;
- position: absolute;
- top: 0px;
- right: 20px;
+ float: right;
+ margin-right: 20px;
}
.describe-toggle-off {
display: none;
}
+
.clickmask {
- background: transparent;
- position: absolute;
- top: 0px;
- left: 0px;
- cursor: pointer;
- border: none;
- z-index: 3;
- height: 36px;
}
.hidden {
@@ -210,17 +211,16 @@ abbr.required {
}
#media-upload .media-item {
+ position: relative;
border-bottom-width: 1px;
border-bottom-style: solid;
- width: 623px;
- position: relative;
min-height: 36px;
+ width: 100%;
}
-#media-upload .filename {
- display: block;
+.filename {
line-height: 36px;
- margin-left: 50px;
- z-index: 2;
+ margin-left: 10px;
+ float: left;
}
#media-upload .describe {
border-top-width: 1px;
@@ -239,4 +239,4 @@ abbr.required {
#media-upload tr.image-size {
margin-bottom: 1em;
height: 3em;
-} \ No newline at end of file
+}
diff --git a/wp-admin/css/widgets-rtl.css b/wp-admin/css/widgets-rtl.css
index 49359f5..89ff4b6 100644
--- a/wp-admin/css/widgets-rtl.css
+++ b/wp-admin/css/widgets-rtl.css
@@ -35,7 +35,7 @@ h4.widget-title a {
}
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;
- left:2em;
+ left:1em;
}
li.widget-list-control-item div.widget-control {
@@ -47,4 +47,4 @@ ul.widget-control-list div.widget-control-actions {
}
ul.widget-control-list .widget-title {
text-align:right;
-} \ No newline at end of file
+}
diff --git a/wp-admin/css/widgets.css b/wp-admin/css/widgets.css
index ea70396..5d044cf 100644
--- a/wp-admin/css/widgets.css
+++ b/wp-admin/css/widgets.css
@@ -91,6 +91,10 @@ ul.widget-control-list {
padding: 0 1em;
}
+ul.widget-control-list li {
+ position: relative;
+}
+
div#current-widgets p.submit {
padding: 1em;
}
@@ -135,7 +139,7 @@ h4.widget-title a {
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: 2em;
+ right: 1em;
}
li.widget-list-control-item h4.widget-title a:hover {
diff --git a/wp-admin/custom-header.php b/wp-admin/custom-header.php
index c5e5d20..c54d9a9 100644
--- a/wp-admin/custom-header.php
+++ b/wp-admin/custom-header.php
@@ -11,17 +11,27 @@ class Custom_Image_Header {
$page = add_theme_page(__('Custom Image Header'), __('Custom Image Header'), 'edit_themes', 'custom-header', array(&$this, 'admin_page'));
add_action("admin_print_scripts-$page", array(&$this, 'js_includes'));
+ add_action("admin_head-$page", array(&$this, 'take_action'), 50);
add_action("admin_head-$page", array(&$this, 'js'), 50);
add_action("admin_head-$page", $this->admin_header_callback, 51);
}
- function js_includes() {
- wp_enqueue_script('cropper');
- wp_enqueue_script('colorpicker');
+ function step() {
+ $step = (int) @$_GET['step'];
+ if ( $step < 1 || 3 < $step )
+ $step = 1;
+ return $step;
}
- function js() {
+ function js_includes() {
+ $step = $this->step();
+ if ( 1 == $step )
+ wp_enqueue_script('colorpicker');
+ elseif ( 2 == $step )
+ wp_enqueue_script('cropper');
+ }
+ function take_action() {
if ( isset( $_POST['textcolor'] ) ) {
check_admin_referer('custom-header');
if ( 'blank' == $_POST['textcolor'] ) {
@@ -36,48 +46,18 @@ class Custom_Image_Header {
check_admin_referer('custom-header');
remove_theme_mods();
}
- ?>
-<script type="text/javascript">
-
- function onEndCrop( coords, dimensions ) {
- $( 'x1' ).value = coords.x1;
- $( 'y1' ).value = coords.y1;
- $( 'x2' ).value = coords.x2;
- $( 'y2' ).value = coords.y2;
- $( 'width' ).value = dimensions.width;
- $( 'height' ).value = dimensions.height;
}
- // with a supplied ratio
- Event.observe(
- window,
- 'load',
- function() {
- var xinit = <?php echo HEADER_IMAGE_WIDTH; ?>;
- var yinit = <?php echo HEADER_IMAGE_HEIGHT; ?>;
- var ratio = xinit / yinit;
- var ximg = $('upload').width;
- var yimg = $('upload').height;
- if ( yimg < yinit || ximg < xinit ) {
- if ( ximg / yimg > ratio ) {
- yinit = yimg;
- xinit = yinit * ratio;
- } else {
- xinit = ximg;
- yinit = xinit / ratio;
- }
- }
- new Cropper.Img(
- 'upload',
- {
- ratioDim: { x: xinit, y: yinit },
- displayOnInit: true,
- onEndCrop: onEndCrop
- }
- )
- }
- );
+ function js() {
+ $step = $this->step();
+ if ( 1 == $step )
+ $this->js_1();
+ elseif ( 2 == $step )
+ $this->js_2();
+ }
+ function js_1() { ?>
+<script type="text/javascript">
var cp = new ColorPicker();
function pickColor(color) {
@@ -116,7 +96,7 @@ class Custom_Image_Header {
}
}
function colorDefault() {
- pickColor('<?php echo HEADER_TEXTCOLOR; ?>');
+ pickColor('#<?php echo HEADER_TEXTCOLOR; ?>');
}
function hide_text() {
@@ -149,6 +129,50 @@ Event.observe( window, 'load', hide_text );
<?php
}
+ function js_2() { ?>
+<script type="text/javascript">
+ function onEndCrop( coords, dimensions ) {
+ $( 'x1' ).value = coords.x1;
+ $( 'y1' ).value = coords.y1;
+ $( 'x2' ).value = coords.x2;
+ $( 'y2' ).value = coords.y2;
+ $( 'width' ).value = dimensions.width;
+ $( 'height' ).value = dimensions.height;
+ }
+
+ // with a supplied ratio
+ Event.observe(
+ window,
+ 'load',
+ function() {
+ var xinit = <?php echo HEADER_IMAGE_WIDTH; ?>;
+ var yinit = <?php echo HEADER_IMAGE_HEIGHT; ?>;
+ var ratio = xinit / yinit;
+ var ximg = $('upload').width;
+ var yimg = $('upload').height;
+ if ( yimg < yinit || ximg < xinit ) {
+ if ( ximg / yimg > ratio ) {
+ yinit = yimg;
+ xinit = yinit * ratio;
+ } else {
+ xinit = ximg;
+ yinit = xinit / ratio;
+ }
+ }
+ new Cropper.Img(
+ 'upload',
+ {
+ ratioDim: { x: xinit, y: yinit },
+ displayOnInit: true,
+ onEndCrop: onEndCrop
+ }
+ )
+ }
+ );
+</script>
+<?php
+ }
+
function step_1() {
if ( $_GET['updated'] ) { ?>
<div id="message" class="updated fade">
@@ -252,7 +276,7 @@ Event.observe( window, 'load', hide_text );
<form method="POST" action="<?php echo attribute_escape(add_query_arg('step', 3)) ?>">
<p><?php _e('Choose the part of the image you want to use as your header.'); ?></p>
-<div id="testWrap">
+<div id="testWrap" style="position: relative">
<img src="<?php echo $url; ?>" id="upload" width="<?php echo $width; ?>" height="<?php echo $height; ?>" />
</div>
@@ -327,19 +351,13 @@ Event.observe( window, 'load', hide_text );
}
function admin_page() {
- if ( !isset( $_GET['step'] ) )
- $step = 1;
- else
- $step = (int) $_GET['step'];
-
- if ( 1 == $step ) {
+ $step = $this->step();
+ if ( 1 == $step )
$this->step_1();
- } elseif ( 2 == $step ) {
+ elseif ( 2 == $step )
$this->step_2();
- } elseif ( 3 == $step ) {
+ elseif ( 3 == $step )
$this->step_3();
- }
-
}
}
diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php
index c71aa71..e12917d 100644
--- a/wp-admin/edit-form-advanced.php
+++ b/wp-admin/edit-form-advanced.php
@@ -54,13 +54,13 @@ $saveasdraft = '<input name="save" type="submit" id="save" class="button" tabind
<input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $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" name="post_author" value="<?php echo attribute_escape( $post->post_author ); ?>" />
+<input type="hidden" id="post_author" name="post_author" value="<?php echo attribute_escape( $post->post_author ); ?>" />
<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 ?>" />
<input name="referredby" type="hidden" id="referredby" value="<?php
if ( !empty($_REQUEST['popupurl']) )
echo clean_url(stripslashes($_REQUEST['popupurl']));
-else if ( url_to_postid(wp_get_referer()) == $post_ID && strpos( wp_get_referer(), '/wp-admin/' ) === false )
+else if ( strpos( wp_get_referer(), '/wp-admin/' ) === false && $post_ID && url_to_postid(wp_get_referer()) === $post_ID )
echo 'redo';
else
echo clean_url(stripslashes(wp_get_referer()));
@@ -222,7 +222,7 @@ endif; ?>
<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 ) ); ?>
- <input type="button" id="category-add-sumbit" class="add:categorychecklist:categorydiv button" value="<?php _e( 'Add' ); ?>" tabindex="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>
</p>
@@ -233,15 +233,15 @@ endif; ?>
<li class="wp-no-js-hidden"><a href="#categories-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>
</ul>
-<div id="categories-all" class="ui-tabs-panel">
- <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
- <?php dropdown_categories(); ?>
+<div id="categories-pop" class="ui-tabs-panel" style="display: none;">
+ <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" >
+ <?php $popular_ids = wp_popular_terms_checklist('category'); ?>
</ul>
</div>
-<div id="categories-pop" class="ui-tabs-panel" style="display: none;">
- <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" >
- <?php wp_popular_terms_checklist('category'); ?>
+<div id="categories-all" class="ui-tabs-panel">
+ <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
+ <?php wp_category_checklist($post_ID) ?>
</ul>
</div>
diff --git a/wp-admin/edit-form-comment.php b/wp-admin/edit-form-comment.php
index f0baaee..dfef0a7 100644
--- a/wp-admin/edit-form-comment.php
+++ b/wp-admin/edit-form-comment.php
@@ -46,7 +46,7 @@ $time = mysql2date(get_option('time_format'), $comment->comment_date);
<p class="submit">
<input type="submit" name="save" value="<?php _e('Save'); ?>" tabindex="4" class="button button-highlighted" />
<?php
-echo "<a class='submitdelete' href='" . wp_nonce_url("comment.php?action=deletecomment&amp;c=$comment->comment_ID", 'delete-comment_' . $comment->comment_ID) . "' onclick=\"if ( confirm('" . js_escape(__("You are about to delete this comment. \n 'Cancel' to stop, 'OK' to delete.")) . "') ) { return true;}return false;\">" . __('Delete comment') . "</a>";
+echo "<a class='submitdelete' href='" . wp_nonce_url("comment.php?action=deletecomment&amp;c=$comment->comment_ID&amp;_wp_original_http_referer=" . wp_get_referer(), 'delete-comment_' . $comment->comment_ID) . "' onclick=\"if ( confirm('" . js_escape(__("You are about to delete this comment. \n 'Cancel' to stop, 'OK' to delete.")) . "') ) { return true;}return false;\">" . __('Delete comment') . "</a>";
?>
</p>
@@ -95,6 +95,7 @@ echo "<a class='submitdelete' href='" . wp_nonce_url("comment.php?action=deletec
<input type="hidden" name="c" value="<?php echo $comment->comment_ID ?>" />
<input type="hidden" name="p" value="<?php echo $comment->comment_post_ID ?>" />
<input name="referredby" type="hidden" id="referredby" value="<?php echo wp_get_referer(); ?>" />
+<?php wp_original_referer_field(true, 'previous'); ?>
<input type="hidden" name="noredir" value="1" />
</div>
</div>
diff --git a/wp-admin/edit-link-form.php b/wp-admin/edit-link-form.php
index a68c6da..15c3fb5 100644
--- a/wp-admin/edit-link-form.php
+++ b/wp-admin/edit-link-form.php
@@ -118,7 +118,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 dropdown_link_categories(); ?>
+ <?php wp_link_category_checklist($link_id); ?>
</ul>
</div>
diff --git a/wp-admin/edit-page-form.php b/wp-admin/edit-page-form.php
index 1a4025f..e800a46 100644
--- a/wp-admin/edit-page-form.php
+++ b/wp-admin/edit-page-form.php
@@ -48,7 +48,7 @@ if (isset($mode) && 'bookmarklet' == $mode)
<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 ?>" />
<input name="referredby" type="hidden" id="referredby" value="<?php
-if ( url_to_postid(wp_get_referer()) == $post_ID && strpos( wp_get_referer(), '/wp-admin/' ) === false )
+if ( strpos( wp_get_referer(), '/wp-admin/' ) === false && $post_ID && url_to_postid(wp_get_referer()) === $post_ID )
echo 'redo';
else
echo clean_url(stripslashes(wp_get_referer()));
@@ -72,7 +72,7 @@ else
<p><strong><?php _e('Publish Status') ?></strong></p>
<p>
<select name='post_status' tabindex='4'>
-<?php if ( current_user_can('publish_posts') ) : ?>
+<?php if ( current_user_can('publish_pages') ) : ?>
<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>
diff --git a/wp-admin/edit-post-rows.php b/wp-admin/edit-post-rows.php
index 582db31..0906b68 100644
--- a/wp-admin/edit-post-rows.php
+++ b/wp-admin/edit-post-rows.php
@@ -22,6 +22,14 @@
if ( have_posts() ) {
$bgcolor = '';
add_filter('the_title','wp_specialchars');
+
+// Create array of post IDs.
+$post_ids = array();
+foreach ( $wp_query->posts as $a_post )
+ $post_ids[] = $a_post->ID;
+
+$comment_pending_count = get_pending_comments_num($post_ids);
+
while (have_posts()) : the_post();
$class = 'alternate' == $class ? '' : 'alternate';
global $current_user;
@@ -67,7 +75,7 @@ foreach($posts_columns as $column_name=>$column_display_name) {
}
}
?>
- <td><abbr title="<?php echo $t_time ?>"><?php echo $h_time ?></abbr></td>
+ <td><abbr title="<?php echo $t_time ?>"><?php echo apply_filters('post_date_column_time', $h_time, $post, $column_name) ?></abbr></td>
<?php
break;
case 'title':
@@ -113,7 +121,7 @@ foreach($posts_columns as $column_name=>$column_display_name) {
?>
<td class="num"><div class="post-com-count-wrapper">
<?php
- $left = get_pending_comments_num( $post->ID );
+ $left = isset($comment_pending_count) ? $comment_pending_count[$post->ID] : 0;
$pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
if ( $left )
echo '<strong>';
diff --git a/wp-admin/edit.php b/wp-admin/edit.php
index 0da6d50..b7cdcf4 100644
--- a/wp-admin/edit.php
+++ b/wp-admin/edit.php
@@ -167,8 +167,12 @@ foreach ($arc_result as $arc_row) {
</select>
<?php } ?>
-<?php wp_dropdown_categories('show_option_all='.__('View all categories').'&hide_empty=1&hierarchical=1&show_count=1&selected='.$cat);?>
-<?php do_action('restrict_manage_posts'); ?>
+<?php
+$dropdown_options = array('show_option_all' => __('View all categories'), 'hide_empty' => 0, 'hierarchical' => 1,
+ 'show_count' => 0, 'orderby' => 'name', 'selected' => $cat);
+wp_dropdown_categories($dropdown_options);
+do_action('restrict_manage_posts');
+?>
<input type="submit" id="post-query-submit" value="<?php _e('Filter'); ?>" class="button-secondary" />
<?php } ?>
diff --git a/wp-admin/import/blogger.php b/wp-admin/import/blogger.php
index fb15c66..27f7c87 100644
--- a/wp-admin/import/blogger.php
+++ b/wp-admin/import/blogger.php
@@ -770,7 +770,7 @@ class Blogger_Import {
$this->$key = $value;
if ( isset( $_REQUEST['blog'] ) ) {
- $blog = is_array($_REQUEST['blog']) ? array_shift( array_keys( $_REQUEST['blog'] ) ) : $_REQUEST['blog'];
+ $blog = is_array($_REQUEST['blog']) ? array_shift( $keys = array_keys( $_REQUEST['blog'] ) ) : $_REQUEST['blog'];
$blog = (int) $blog;
$result = $this->import_blog( $blog );
if ( is_wp_error( $result ) )
diff --git a/wp-admin/import/mt.php b/wp-admin/import/mt.php
index 6b945b2..dcf5892 100644
--- a/wp-admin/import/mt.php
+++ b/wp-admin/import/mt.php
@@ -312,7 +312,7 @@ class MT_Import {
else if ( 'ping' == $context )
$ping->title = $title;
} else if ( 0 === strpos($line, "STATUS:") ) {
- $status = trim( substr($line, strlen("STATUS:")) );
+ $status = trim( strtolower( substr($line, strlen("STATUS:")) ) );
if ( empty($status) )
$status = 'publish';
$post->post_status = $status;
diff --git a/wp-admin/includes/admin.php b/wp-admin/includes/admin.php
index 7f1c12c..992fcce 100644
--- a/wp-admin/includes/admin.php
+++ b/wp-admin/includes/admin.php
@@ -1,8 +1,5 @@
<?php
-if ( !defined( 'AUTOSAVE_INTERVAL' ) )
- define( 'AUTOSAVE_INTERVAL', 60 );
-
require_once(ABSPATH . 'wp-admin/includes/bookmark.php');
require_once(ABSPATH . 'wp-admin/includes/comment.php');
require_once(ABSPATH . 'wp-admin/includes/file.php');
diff --git a/wp-admin/includes/class-wp-filesystem-direct.php b/wp-admin/includes/class-wp-filesystem-direct.php
index dc74f52..45972a3 100644
--- a/wp-admin/includes/class-wp-filesystem-direct.php
+++ b/wp-admin/includes/class-wp-filesystem-direct.php
@@ -26,8 +26,7 @@ class WP_Filesystem_Direct{
return @file($file);
}
function put_contents($file,$contents,$mode=false,$type=''){
- $fp=@fopen($file,'w'.$type);
- if (!$fp)
+ if ( ! ($fp = @fopen($file,'w'.$type)) )
return false;
@fwrite($fp,$contents);
@fclose($fp);
@@ -37,6 +36,9 @@ class WP_Filesystem_Direct{
function cwd(){
return @getcwd();
}
+ function chdir($dir){
+ return @chdir($dir);
+ }
function chgrp($file,$group,$recursive=false){
if( ! $this->exists($file) )
return false;
@@ -45,10 +47,11 @@ class WP_Filesystem_Direct{
if( ! $this->is_dir($file) )
return @chgrp($file,$group);
//Is a directory, and we want recursive
+ $file = trailingslashit($file);
$filelist = $this->dirlist($file);
- foreach($filelist as $filename){
- $this->chgrp($file.'/'.$filename,$group,$recursive);
- }
+ foreach($filelist as $filename)
+ $this->chgrp($file . $filename, $group, $recursive);
+
return true;
}
function chmod($file,$mode=false,$recursive=false){
@@ -61,10 +64,11 @@ class WP_Filesystem_Direct{
if( ! $this->is_dir($file) )
return @chmod($file,$mode);
//Is a directory, and we want recursive
+ $file = trailingslashit($file);
$filelist = $this->dirlist($file);
- foreach($filelist as $filename){
- $this->chmod($file.'/'.$filename,$mode,$recursive);
- }
+ foreach($filelist as $filename)
+ $this->chmod($file . $filename, $mode, $recursive);
+
return true;
}
function chown($file,$owner,$recursive=false){
@@ -82,12 +86,12 @@ class WP_Filesystem_Direct{
return true;
}
function owner($file){
- $owneruid=@fileowner($file);
+ $owneruid = @fileowner($file);
if( ! $owneruid )
return false;
if( !function_exists('posix_getpwuid') )
return $owneruid;
- $ownerarray=posix_getpwuid($owneruid);
+ $ownerarray = posix_getpwuid($owneruid);
return $ownerarray['name'];
}
function getchmod($file){
@@ -163,23 +167,23 @@ class WP_Filesystem_Direct{
return $newmode;
}
function group($file){
- $gid=@filegroup($file);
+ $gid = @filegroup($file);
if( ! $gid )
return false;
if( !function_exists('posix_getgrgid') )
return $gid;
- $grouparray=posix_getgrgid($gid);
+ $grouparray = posix_getgrgid($gid);
return $grouparray['name'];
}
function copy($source,$destination,$overwrite=false){
- if( $overwrite && $this->exists($destination) )
+ if( ! $overwrite && $this->exists($destination) )
return false;
return copy($source,$destination);
}
function move($source,$destination,$overwrite=false){
- //Possible to use rename()
+ //Possible to use rename()?
if( $this->copy($source,$destination,$overwrite) && $this->exists($destination) ){
$this->delete($source);
return true;
@@ -188,24 +192,24 @@ class WP_Filesystem_Direct{
}
}
- function delete($file,$recursive=false){
+ 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) )
return @rmdir($file);
- $filelist = $this->dirlist($file);
- if( ! $filelist )
- return true; //No files exist, Say we've deleted them
+ //At this point its a folder, and we're in recursive mode
+ $file = trailingslashit($file);
+ $filelist = $this->dirlist($file, true);
$retval = true;
- foreach($filelist as $filename=>$fileinfo){
- if( ! $this->delete($file.'/'.$filename,$recursive) )
- $retval = false;
- }
+ if( is_array($filelist) ) //false if no files, So check first.
+ foreach($filelist as $filename=>$fileinfo)
+ if( ! $this->delete($file . $filename, $recursive) )
+ $retval = false;
+
if( ! @rmdir($file) )
return false;
return $retval;
@@ -224,7 +228,7 @@ class WP_Filesystem_Direct{
}
function is_readable($file){
- return @is_readable($file);
+ return @is_readable($file);
}
function is_writable($file){
@@ -242,15 +246,15 @@ class WP_Filesystem_Direct{
return @filesize($file);
}
- function touch($file,$time=0,$atime=0){
- if($time==0)
+ function touch($file, $time = 0, $atime = 0){
+ if($time == 0)
$time = time();
- if($atime==0)
+ if($atime == 0)
$atime = time();
return @touch($file,$time,$atime);
}
- function mkdir($path,$chmod=false,$chown=false,$chgrp=false){
+ function mkdir($path, $chmod = false, $chown = false, $chgrp = false){
if( ! $chmod)
$chmod = $this->permission;
@@ -264,6 +268,7 @@ class WP_Filesystem_Direct{
}
function rmdir($path,$recursive=false){
+ //Currently unused and untested, Use delete() instead.
if( ! $recursive )
return @rmdir($path);
//recursive:
@@ -292,6 +297,8 @@ class WP_Filesystem_Direct{
$struc = array();
$struc['name'] = $entry;
+ if( '.' == $struc['name'] || '..' == $struc['name'] )
+ continue; //Do not care about these folders.
if( '.' == $struc['name'][0] && !$incdot)
continue;
if( $limitFile && $struc['name'] != $limitFile)
@@ -307,22 +314,15 @@ class WP_Filesystem_Direct{
$struc['lastmod'] = date('M j',$struc['lastmodunix']);
$struc['time'] = date('h:i:s',$struc['lastmodunix']);
$struc['type'] = $this->is_dir($path.'/'.$entry) ? 'd' : 'f';
- if ('d' == $struc['type'] ){
- $struc['files'] = array();
- if( $incdot ){
- //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);
- }
- } else { //No dots
- if ($recursive)
- $struc['files'] = $this->dirlist($path.'/'.$struc['name'],$incdot,$recursive);
- }
+ if ('d' == $struc['type'] ){
+ if( $recursive )
+ $struc['files'] = $this->dirlist($path.'/'.$struc['name'], $incdot, $recursive);
+ else
+ $struc['files'] = array();
}
- //File
- $ret[$struc['name']] = $struc;
+
+ $ret[ $struc['name'] ] = $struc;
}
$dir->close();
unset($dir);
diff --git a/wp-admin/includes/comment.php b/wp-admin/includes/comment.php
index e08ae4d..0f2aa61 100644
--- a/wp-admin/includes/comment.php
+++ b/wp-admin/includes/comment.php
@@ -21,7 +21,7 @@ function edit_comment() {
$_POST['comment_content'] = $_POST['content'];
$_POST['comment_ID'] = (int) $_POST['comment_ID'];
- foreach ( array ('aa', 'mm', 'jj', 'hh', 'mm') 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;
@@ -66,9 +66,28 @@ function get_comment_to_edit( $id ) {
function get_pending_comments_num( $post_id ) {
global $wpdb;
- $post_id = (int) $post_id;
- $pending = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = $post_id AND comment_approved = '0'" );
- return $pending;
+
+ $single = false;
+ if ( !is_array($post_id) ) {
+ $post_id = (array) $post_id;
+ $single = true;
+ }
+ $post_id = array_map('intval', $post_id);
+ $post_id = "'" . implode("', '", $post_id) . "'";
+
+ $pending = $wpdb->get_results( "SELECT comment_post_ID, COUNT(comment_ID) as num_comments FROM $wpdb->comments WHERE comment_post_ID IN ( $post_id ) AND comment_approved = '0' GROUP BY comment_post_ID", ARRAY_N );
+
+ if ( empty($pending) )
+ return 0;
+
+ if ( $single )
+ return $pending[0][1];
+
+ $pending_keyed = array();
+ foreach ( $pending as $pend )
+ $pending_keyed[$pend[0]] = $pend[1];
+
+ return $pending_keyed;
}
// Add avatars to relevant places in admin, or try to
diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php
index 72a6dbc..9ce9db9 100644
--- a/wp-admin/includes/dashboard.php
+++ b/wp-admin/includes/dashboard.php
@@ -4,7 +4,8 @@
function wp_dashboard_setup() {
global $wpdb, $wp_dashboard_sidebars;
$update = false;
- if ( !$widget_options = get_option( 'dashboard_widget_options' ) )
+ $widget_options = get_option( 'dashboard_widget_options' );
+ if ( !$widget_options || !is_array($widget_options) )
$widget_options = array();
diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php
index 75ef4e3..a399a5a 100644
--- a/wp-admin/includes/file.php
+++ b/wp-admin/includes/file.php
@@ -174,8 +174,9 @@ function wp_handle_upload( &$file, $overrides = false ) {
// Move the file to the uploads dir
$new_file = $uploads['path'] . "/$filename";
- if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) )
+ if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) ) {
wp_die( __('There was a problem uploading your file. Please try again.' ) );
+ }
// Set correct file permissions
$stat = stat( dirname( $new_file ));
diff --git a/wp-admin/includes/image.php b/wp-admin/includes/image.php
index 2af026d..7699f98 100644
--- a/wp-admin/includes/image.php
+++ b/wp-admin/includes/image.php
@@ -235,7 +235,7 @@ function wp_read_image_metadata( $file ) {
// fetch additional info from exif if available
if ( is_callable('exif_read_data') && in_array($sourceImageType, apply_filters('wp_read_image_metadata_types', array(IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM)) ) ) {
- $exif = exif_read_data( $file );
+ $exif = @exif_read_data( $file );
if (!empty($exif['FNumber']))
$meta['aperture'] = round( wp_exif_frac2dec( $exif['FNumber'] ), 2 );
if (!empty($exif['Model']))
diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php
index d8c3858..6b28c96 100644
--- a/wp-admin/includes/media.php
+++ b/wp-admin/includes/media.php
@@ -57,7 +57,7 @@ function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = fal
if ( $url )
$html = "<a href='".attribute_escape($url)."'$rel>$html</a>";
- $html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url );
+ $html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url, $size );
return $html;
}
@@ -202,18 +202,6 @@ add_action('media_upload_media', 'media_upload_handler');
function media_upload_form_handler() {
check_admin_referer('media-form');
- // Insert media button was clicked
- if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
- // Upload File button was clicked
-
- $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
-
- if ( is_wp_error($id) ) {
- $errors['upload_error'] = $id;
- $id = false;
- }
- }
-
if ( !empty($_POST['attachments']) ) foreach ( $_POST['attachments'] as $attachment_id => $attachment ) {
$post = $_post = get_post($attachment_id, ARRAY_A);
if ( isset($attachment['post_content']) )
@@ -590,8 +578,9 @@ function get_attachment_fields_to_edit($post, $errors = null) {
}
function get_media_items( $post_id, $errors ) {
- if ( $post_id && $post = get_post($post_id) ) {
- if ( $post->post_type == 'attachment' )
+ if ( $post_id ) {
+ $post = get_post($post_id);
+ 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");
@@ -606,7 +595,7 @@ function get_media_items( $post_id, $errors ) {
foreach ( $attachments as $id => $attachment )
if ( $item = get_media_item( $id, array( 'errors' => isset($errors[$id]) ? $errors[$id] : null) ) )
- $output .= "\n<div id='media-item-$id' class='media-item child-of-$attachment->post_parent preloaded'><div id='media-upload-error-$id'></div><div class='filename'></div><div class='progress'><div class='bar'></div></div>$item<div class='progress clickmask'></div>\n</div>";
+ $output .= "\n<div id='media-item-$id' class='media-item child-of-$attachment->post_parent preloaded'><div class='progress'><div class='bar'></div></div><div id='media-upload-error-$id'></div><div class='filename'></div>$item\n</div>";
return $output;
}
@@ -665,15 +654,15 @@ function get_media_item( $attachment_id, $args = null ) {
$toggle_links
<div class='filename new'>$display_title</div>
<table class='slidetoggle describe $class'>
- <tbody class='media-item-info'>
+ <thead class='media-item-info'>
<tr>
<td class='A1B1' rowspan='4'><img class='thumbnail' src='$thumb_url' alt='' /></td>
<td>$filename</td>
</tr>
- <td>$post->post_mime_type</td></tr>
+ <tr><td>$post->post_mime_type</td></tr>
<tr><td>" . mysql2date($post->post_date, get_option('time_format')) . "</td></tr>
- <tr><td>" . apply_filters('media_meta', '', $post) . "</tr></td>
- </tbody>
+ <tr><td>" . apply_filters('media_meta', '', $post) . "</td></tr>
+ </thead>
<tbody>\n";
$defaults = array(
@@ -685,7 +674,7 @@ function get_media_item( $attachment_id, $args = null ) {
$delete_href = wp_nonce_url("post.php?action=delete-post&amp;post=$attachment_id", 'delete-post_' . $attachment_id);
if ( $send )
- $send = "<button type='submit' class='button' value='1' name='send[$attachment_id]'>" . __('Insert into Post') . '</button>';
+ $send = "<input type='submit' class='button' name='send[$attachment_id]' value='" . __('Insert into Post') . "' />";
if ( $delete )
$delete = "<a href='$delete_href' id='del[$attachment_id]' disabled='disabled' class='delete'>" . __('Delete') . "</button>";
if ( ( $send || $delete ) && !isset($form_fields['buttons']) )
@@ -744,6 +733,7 @@ function get_media_item( $attachment_id, $args = null ) {
if ( !empty($form_fields['_final']) )
$item .= "\t\t<tr class='final'><td colspan='2'>{$form_fields['_final']}</td></tr>\n";
+ $item .= "\t</tbody>\n";
$item .= "\t</table>\n";
foreach ( $hidden_fields as $name => $value )
@@ -794,12 +784,13 @@ jQuery(function($){
upload_url : "<?php echo attribute_escape( $flash_action_url ); ?>",
flash_url : "<?php echo get_option('siteurl').'/wp-includes/js/swfupload/swfupload_f9.swf'; ?>",
file_post_name: "async-upload",
- file_types: "*.*",
+ file_types: "<?php echo apply_filters('upload_file_glob', '*.*'); ?>",
post_params : {
"post_id" : "<?php echo $post_id; ?>",
"auth_cookie" : "<?php echo $_COOKIE[AUTH_COOKIE]; ?>",
"type" : "<?php echo $type; ?>",
- "tab" : "<?php echo $tab; ?>"
+ "tab" : "<?php echo $tab; ?>",
+ "short" : "1"
},
file_size_limit : "<?php echo wp_max_upload_size(); ?>b",
swfupload_element_id : "flash-upload-ui", // id of the element displayed when swfupload is available
diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php
index 2ee6210..aa1e833 100644
--- a/wp-admin/includes/post.php
+++ b/wp-admin/includes/post.php
@@ -74,7 +74,7 @@ function edit_post() {
if (!isset( $_POST['ping_status'] ))
$_POST['ping_status'] = 'closed';
- foreach ( array ('aa', 'mm', 'jj', 'hh', 'mm') 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;
@@ -288,7 +288,7 @@ function wp_write_post() {
if (!isset( $_POST['ping_status'] ))
$_POST['ping_status'] = 'closed';
- foreach ( array ('aa', 'mm', 'jj', 'hh', 'mm') 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;
@@ -506,10 +506,9 @@ function _relocate_children( $old_ID, $new_ID ) {
}
function get_available_post_statuses($type = 'post') {
- global $wpdb;
+ $stati = wp_count_posts($type);
- $stati = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT post_status FROM $wpdb->posts WHERE post_type = %s", $type));
- return $stati;
+ return array_keys(get_object_vars($stati));
}
function wp_edit_posts_query( $q = false ) {
diff --git a/wp-admin/includes/schema.php b/wp-admin/includes/schema.php
index 7b78d93..2d5ddcf 100644
--- a/wp-admin/includes/schema.php
+++ b/wp-admin/includes/schema.php
@@ -306,7 +306,7 @@ function populate_options() {
}
// 2.0.3
- add_option('secret', wp_generate_password());
+ add_option('secret', wp_generate_password(64));
// 2.1
add_option('blog_public', '1');
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
index 3e67338..db80bf8 100644
--- a/wp-admin/includes/template.php
+++ b/wp-admin/includes/template.php
@@ -55,11 +55,12 @@ function _cat_row( $category, $level, $name_override = false ) {
$output = "<tr id='cat-$category->term_id'$class>
<th scope='row' class='check-column'>";
if ( absint(get_option( 'default_category' ) ) != $category->term_id ) {
- $output .= "<input type='checkbox' name='delete[]' value='$category->term_id' /></th>";
+ $output .= "<input type='checkbox' name='delete[]' value='$category->term_id' />";
} else {
$output .= "&nbsp;";
}
- $output .= "<td>$edit</td>
+ $output .= "</th>
+ <td>$edit</td>
<td>$category->description</td>
<td class='num'>$posts_count</td>\n\t</tr>\n";
@@ -86,11 +87,17 @@ function link_cat_row( $category ) {
$category->count = number_format_i18n( $category->count );
$count = ( $category->count > 0 ) ? "<a href='link-manager.php?cat_id=$category->term_id'>$category->count</a>" : $category->count;
- $output = "<tr id='link-cat-$category->term_id'$class>" .
- '<th scope="row" class="check-column"> <input type="checkbox" name="delete[]" value="' . $category->term_id . '" /></th>' .
- "<td>$edit</td>
- <td>$category->description</td>
- <td class='num'>$count</td></tr>";
+ $output = "<tr id='link-cat-$category->term_id'$class>
+ <th scope='row' class='check-column'>";
+ if ( absint( get_option( 'default_link_category' ) ) != $category->term_id ) {
+ $output .= "<input type='checkbox' name='delete[]' value='$category->term_id' />";
+ } else {
+ $output .= "&nbsp;";
+ }
+ $output .= "</th>
+ <td>$edit</td>
+ <td>$category->description</td>
+ <td class='num'>$count</td></tr>";
return apply_filters( 'link_cat_row', $output );
}
@@ -106,93 +113,83 @@ function selected( $selected, $current) {
}
//
-// Nasty Category Stuff
+// Category Checklists
//
-function sort_cats( $cat1, $cat2 ) {
- if ( $cat1['checked'] || $cat2['checked'] )
- return ( $cat1['checked'] && !$cat2['checked'] ) ? -1 : 1;
- else
- return strcasecmp( $cat1['cat_name'], $cat2['cat_name'] );
+// Deprecated. Use wp_link_category_checklist
+function dropdown_categories( $default = 0, $parent = 0, $popular_ids = array() ) {
+ global $post_ID;
+ wp_category_checklist($post_ID);
}
-function wp_set_checked_post_categories( $default = 0 ) {
- global $post_ID, $checked_categories;
+class Walker_Category_Checklist extends Walker {
+ var $tree_type = 'category';
+ var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
- if ( empty($checked_categories) ) {
- if ( $post_ID ) {
- $checked_categories = wp_get_post_categories($post_ID);
-
- if ( count( $checked_categories ) == 0 ) {
- // No selected categories, strange
- $checked_categories[] = $default;
- }
- } else {
- $checked_categories[] = $default;
- }
+ function start_lvl(&$output, $depth, $args) {
+ $indent = str_repeat("\t", $depth);
+ $output .= "$indent<ul class='children'>\n";
}
-}
-function get_nested_categories( $default = 0, $parent = 0 ) {
- global $checked_categories;
-
- wp_set_checked_post_categories( $default = 0 );
-
- if ( is_object($parent) ) { // Hack: if passed a category object, will return nested cats with parent as root
- $root = array(
- 'children' => get_nested_categories( $default, $parent->term_id ),
- 'cat_ID' => $parent->term_id,
- 'checked' => in_array( $parent->term_id, $checked_categories ),
- 'cat_name' => get_the_category_by_ID( $parent->term_id )
- );
- $result = array( $parent->term_id => $root );
- } else {
- $parent = (int) $parent;
+ function end_lvl(&$output, $depth, $args) {
+ $indent = str_repeat("\t", $depth);
+ $output .= "$indent</ul>\n";
+ }
- $cats = get_categories("parent=$parent&hide_empty=0&fields=ids");
+ function start_el(&$output, $category, $depth, $args) {
+ extract($args);
- $result = array();
- if ( is_array( $cats ) ) {
- foreach ( $cats as $cat ) {
- $result[$cat]['children'] = get_nested_categories( $default, $cat );
- $result[$cat]['cat_ID'] = $cat;
- $result[$cat]['checked'] = in_array( $cat, $checked_categories );
- $result[$cat]['cat_name'] = get_the_category_by_ID( $cat );
- }
- }
+ $class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : '';
+ $output .= "\n<li id='category-$category->term_id'$class>" . '<label for="in-category-' . $category->term_id . '" class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="post_category[]" id="in-category-' . $category->term_id . '"' . (in_array( $category->term_id, $selected_cats ) ? ' checked="checked"' : "" ) . '/> ' . wp_specialchars( apply_filters('the_category', $category->name )) . '</label>';
}
- $result = apply_filters('get_nested_categories', $result);
- usort( $result, 'sort_cats' );
-
- return $result;
+ function end_el(&$output, $category, $depth, $args) {
+ $output .= "</li>\n";
+ }
}
-function write_nested_categories( $categories ) {
- foreach ( $categories as $category ) {
- echo "\n", '<li id="category-', $category['cat_ID'], '"><label for="in-category-', $category['cat_ID'], '" class="selectit"><input value="', $category['cat_ID'], '" type="checkbox" name="post_category[]" id="in-category-', $category['cat_ID'], '"', ($category['checked'] ? ' checked="checked"' : "" ), '/> ', wp_specialchars( apply_filters('the_category', $category['cat_name'] )), '</label>';
+function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false ) {
+ $walker = new Walker_Category_Checklist;
+ $descendants_and_self = (int) $descendants_and_self;
- if ( $category['children'] ) {
- echo "\n<ul>";
- write_nested_categories( $category['children'] );
- echo "\n</ul>";
- }
- echo '</li>';
+ $args = array();
+
+ if ( $post_id )
+ $args['selected_cats'] = wp_get_post_categories($post_id);
+ else
+ $args['selected_cats'] = array();
+ if ( is_array( $selected_cats ) )
+ $args['selected_cats'] = $selected_cats;
+ $args['popular_cats'] = get_terms( 'category', array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
+ if ( $descendants_and_self ) {
+ $categories = get_categories( "child_of=$descendants_and_self&hierarchical=0&hide_empty=0" );
+ $self = get_category( $descendants_and_self );
+ array_unshift( $categories, $self );
+ } else {
+ $categories = get_categories('get=all');
}
-}
-function dropdown_categories( $default = 0, $parent = 0 ) {
- write_nested_categories( get_nested_categories( $default, $parent ) );
+ $args = array($categories, 0, $args);
+ $output = call_user_func_array(array(&$walker, 'walk'), $args);
+
+ echo $output;
}
function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10 ) {
- $categories = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number ) );
+ global $post_ID;
+ if ( $post_ID )
+ $checked_categories = wp_get_post_categories($post_ID);
+ else
+ $checked_categories = array();
+ $categories = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) );
+ $popular_ids = array();
foreach ( (array) $categories as $category ) {
+ $popular_ids[] = $category->term_id;
$id = "popular-category-$category->term_id";
?>
- <li id="<?php echo $id; ?>" >
+ <li id="<?php echo $id; ?>" class="popular-category">
<label class="selectit" for="in-<?php echo $id; ?>">
<input id="in-<?php echo $id; ?>" type="checkbox" value="<?php echo (int) $category->term_id; ?>" />
<?php echo wp_specialchars( apply_filters( 'the_category', $category->name ) ); ?>
@@ -201,11 +198,17 @@ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10 ) {
<?php
}
+ return $popular_ids;
}
+// Deprecated. Use wp_link_category_checklist
function dropdown_link_categories( $default = 0 ) {
global $link_id;
+ wp_link_category_checklist($link_id);
+}
+
+function wp_link_category_checklist( $link_id = 0 ) {
if ( $link_id ) {
$checked_categories = wp_get_link_cats($link_id);
@@ -585,7 +588,7 @@ function _wp_get_comment_list( $status = '', $s = false, $start, $num ) {
elseif ( 'spam' == $status )
$approved = "comment_approved = 'spam'";
else
- $approved = "comment_approved != 'spam'";
+ $approved = "( comment_approved = '0' OR comment_approved = '1' )";
if ( $s ) {
$s = $wpdb->escape($s);
@@ -1049,7 +1052,7 @@ 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][] = array('id' => $id, 'title' => $title, 'callback' => $callback);
+ $wp_meta_boxes[$page][$context][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback);
}
function do_meta_boxes($page, $context, $object) {
diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php
index 1cc9df9..94bdbd3 100644
--- a/wp-admin/includes/upgrade.php
+++ b/wp-admin/includes/upgrade.php
@@ -62,13 +62,13 @@ function wp_install_defaults($user_id) {
// Default category
$cat_name = $wpdb->escape(__('Uncategorized'));
- $cat_slug = sanitize_title(__('Uncategorized'));
+ $cat_slug = sanitize_title(_c('Uncategorized|Default category slug'));
$wpdb->query("INSERT INTO $wpdb->terms (name, slug, term_group) VALUES ('$cat_name', '$cat_slug', '0')");
$wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('1', 'category', '', '0', '1')");
// Default link category
$cat_name = $wpdb->escape(__('Blogroll'));
- $cat_slug = sanitize_title(__('Blogroll'));
+ $cat_slug = sanitize_title(_c('Blogroll|Default link category slug'));
$wpdb->query("INSERT INTO $wpdb->terms (name, slug, term_group) VALUES ('$cat_name', '$cat_slug', '0')");
$wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('2', 'link_category', '', '0', '7')");
@@ -98,7 +98,7 @@ function wp_install_defaults($user_id) {
$now = date('Y-m-d H:i:s');
$now_gmt = gmdate('Y-m-d H:i:s');
$first_post_guid = get_option('home') . '/?p=1';
- $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, guid, comment_count, to_ping, pinged, post_content_filtered) VALUES ($user_id, '$now', '$now_gmt', '".$wpdb->escape(__('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'))."', '', '".$wpdb->escape(__('Hello world!'))."', '0', '".$wpdb->escape(__('hello-world'))."', '$now', '$now_gmt', '$first_post_guid', '1', '', '', '')");
+ $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, guid, comment_count, to_ping, pinged, post_content_filtered) VALUES ($user_id, '$now', '$now_gmt', '".$wpdb->escape(__('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'))."', '', '".$wpdb->escape(__('Hello world!'))."', '0', '".$wpdb->escape(_c('hello-world|Default post slug'))."', '$now', '$now_gmt', '$first_post_guid', '1', '', '', '')");
$wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (1, 1)" );
// Default comment
@@ -106,7 +106,7 @@ function wp_install_defaults($user_id) {
// First Page
$first_post_guid = get_option('home') . '/?page_id=2';
- $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, guid, post_status, post_type, to_ping, pinged, post_content_filtered) VALUES ($user_id, '$now', '$now_gmt', '".$wpdb->escape(__('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'))."', '', '".$wpdb->escape(__('About'))."', '0', '".$wpdb->escape(__('about'))."', '$now', '$now_gmt','$first_post_guid', 'publish', 'page', '', '', '')");
+ $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, guid, post_status, post_type, to_ping, pinged, post_content_filtered) VALUES ($user_id, '$now', '$now_gmt', '".$wpdb->escape(__('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'))."', '', '".$wpdb->escape(__('About'))."', '0', '".$wpdb->escape(_c('about|Default page slug'))."', '$now', '$now_gmt','$first_post_guid', 'publish', 'page', '', '', '')");
}
endif;
@@ -202,6 +202,9 @@ function upgrade_all() {
if ( $wp_current_db_version < 7499 )
upgrade_250();
+ if ( $wp_current_db_version < 7796 )
+ upgrade_251();
+
maybe_disable_automattic_widgets();
$wp_rewrite->flush_rules();
@@ -737,6 +740,13 @@ function upgrade_250() {
}
+function upgrade_251() {
+ global $wp_current_db_version;
+
+ // Make the secret longer
+ update_option('secret', wp_generate_password(64));
+}
+
// The functions we use to actually do stuff
// General
diff --git a/wp-admin/includes/widgets.php b/wp-admin/includes/widgets.php
index bd425f9..da8b822 100644
--- a/wp-admin/includes/widgets.php
+++ b/wp-admin/includes/widgets.php
@@ -21,7 +21,7 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
$no_widgets_shown = true;
$already_shown = array();
foreach ( $wp_registered_widgets as $name => $widget ) :
- if ( in_array( $widget['callback'], $already_shown ) ) // We already showed this multi-widget
+ if ( 'all' == $show && in_array( $widget['callback'], $already_shown ) ) // We already showed this multi-widget
continue;
if ( $search_terms ) {
@@ -47,7 +47,7 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
continue;
ob_start();
- $args = wp_list_widget_controls_dynamic_sidebar( array( 0 => array( 'widget_id' => $widget['id'], 'widget_name' => $widget['name'], '_display' => 'template' ) ) );
+ $args = wp_list_widget_controls_dynamic_sidebar( array( 0 => array( 'widget_id' => $widget['id'], 'widget_name' => $widget['name'], '_display' => 'template', '_show' => $show ), 1 => $widget['params'][0] ) );
$sidebar_args = call_user_func_array( 'wp_widget_control', $args );
$widget_control_template = ob_get_contents();
ob_end_clean();
@@ -61,7 +61,7 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
'key' => false,
'edit' => false
);
- if ( $is_multi ) {
+ if ( 'all' == $show && $is_multi ) {
// it's a multi-widget. We only need to show it in the list once.
$already_shown[] = $widget['callback'];
$num = (int) array_pop( explode( '-', $widget['id'] ) );
@@ -92,12 +92,17 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
$no_widgets_shown = false;
+
+ if ( 'all' != $show && $sidebar_args['_widget_title'] )
+ $widget_title = $sidebar_args['_widget_title'];
+ else
+ $widget_title = $widget['name'];
?>
<li id="widget-list-item-<?php echo attribute_escape( $widget['id'] ); ?>" class="widget-list-item">
<h4 class="widget-title widget-draggable">
- <?php echo wp_specialchars( $widget['name'] ); ?>
+ <?php echo $widget_title; ?>
<?php if ( 'add' == $action ) : ?>
@@ -192,7 +197,7 @@ function wp_widget_control( $sidebar_args ) {
$id_format = $widget['id'];
// We aren't showing a widget control, we're outputing a template for a mult-widget control
- if ( 'template' == $sidebar_args['_display'] && isset($control['params'][0]['number']) ) {
+ if ( 'all' == $sidebar_args['_show'] && 'template' == $sidebar_args['_display'] && isset($control['params'][0]['number']) ) {
// number == -1 implies a template where id numbers are replaced by a generic '%i%'
$control['params'][0]['number'] = -1;
// if given, id_base means widget id's should be constructed like {$id_base}-{$id_number}
@@ -202,7 +207,7 @@ function wp_widget_control( $sidebar_args ) {
$widget_title = '';
// We grab the normal widget output to find the widget's title
- if ( is_callable( $widget['_callback'] ) ) {
+ if ( ( 'all' != $sidebar_args['_show'] || 'template' != $sidebar_args['_display'] ) && is_callable( $widget['_callback'] ) ) {
ob_start();
$args = func_get_args();
call_user_func_array( $widget['_callback'], $args );
@@ -212,11 +217,13 @@ function wp_widget_control( $sidebar_args ) {
$wp_registered_widgets[$widget_id]['callback'] = $wp_registered_widgets[$widget_id]['_callback'];
unset($wp_registered_widgets[$widget_id]['_callback']);
- if ( $widget_title && $widget_title != $control['name'] )
+ if ( $widget_title && $widget_title != $sidebar_args['widget_name'] )
$widget_title = sprintf( _c('%1$s: %2$s|1: widget name, 2: widget title' ), $sidebar_args['widget_name'], $widget_title );
else
$widget_title = wp_specialchars( strip_tags( $sidebar_args['widget_name'] ) );
+ $sidebar_args['_widget_title'] = $widget_title;
+
if ( empty($sidebar_args['_display']) || 'template' != $sidebar_args['_display'] )
echo $sidebar_args['before_widget'];
?>
@@ -270,7 +277,8 @@ function wp_widget_control_ob_filter( $string ) {
if ( false === $end = strpos( $string, '%END_OF_TITLE%' ) )
return '';
$string = substr( $string, $beg + 14 , $end - $beg - 14);
- return wp_specialchars( strip_tags( $string ) );
+ $string = str_replace( '&nbsp;', ' ', $string );
+ return trim( wp_specialchars( strip_tags( $string ) ) );
}
function widget_css() {
diff --git a/wp-admin/index.php b/wp-admin/index.php
index 7270649..15bc950 100644
--- a/wp-admin/index.php
+++ b/wp-admin/index.php
@@ -9,12 +9,18 @@ wp_dashboard_setup();
function index_js() {
?>
<script type="text/javascript">
- jQuery(function() {
- jQuery('#dashboard_incoming_links div.dashboard-widget-content').not( '.dashboard-widget-control' ).find( '.widget-loading' ).parent().load('index-extra.php?jax=incominglinks');
- jQuery('#dashboard_primary div.dashboard-widget-content').not( '.dashboard-widget-control' ).find( '.widget-loading' ).parent().load('index-extra.php?jax=devnews');
- jQuery('#dashboard_secondary div.dashboard-widget-content').not( '.dashboard-widget-control' ).find( '.widget-loading' ).parent().load('index-extra.php?jax=planetnews');
- jQuery('#dashboard_plugins div.dashboard-widget-content').not( '.dashboard-widget-control' ).find( '.widget-loading' ).parent().load('index-extra.php?jax=plugins');
- });
+jQuery(function($) {
+ var ajaxWidgets = {
+ dashboard_incoming_links: 'incominglinks',
+ dashboard_primary: 'devnews',
+ dashboard_secondary: 'planetnews',
+ dashboard_plugins: 'plugins'
+ };
+ $.each( ajaxWidgets, function(i,a) {
+ var e = jQuery('#' + i + ' div.dashboard-widget-content').not('.dashboard-widget-control').find('.widget-loading');
+ if ( e.size() ) { e.parent().load('index-extra.php?jax=' + a); }
+ } );
+});
</script>
<?php
}
diff --git a/wp-admin/js/editor.js b/wp-admin/js/editor.js
index 757fd30..50955c7 100644
--- a/wp-admin/js/editor.js
+++ b/wp-admin/js/editor.js
@@ -13,7 +13,7 @@ wpEditorInit = function() {
switchEditors = {
saveCallback : function(el, content, body) {
-
+
document.getElementById(el).style.color = '#fff';
if ( tinyMCE.activeEditor.isHidden() )
content = document.getElementById(el).value;
@@ -26,8 +26,14 @@ switchEditors = {
pre_wpautop : function(content) {
// We have a TON of cleanup to do. Line breaks are already stripped.
+ // Protect pre|script tags
+ content = content.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
+ a = a.replace(/<br ?\/?>[\r\n]*/g, '<wp_temp>');
+ return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '<wp_temp>');
+ });
+
// Pretty it up for the source editor
- var blocklist1 = 'blockquote|ul|ol|li|table|thead|tbody|tr|th|td|div|h[1-6]|pre|p';
+ var blocklist1 = 'blockquote|ul|ol|li|table|thead|tbody|tr|th|td|div|h[1-6]|p';
content = content.replace(new RegExp('\\s*</('+blocklist1+')>\\s*', 'mg'), '</$1>\n');
content = content.replace(new RegExp('\\s*<(('+blocklist1+')[^>]*)>', 'mg'), '\n<$1>');
@@ -46,7 +52,7 @@ switchEditors = {
// Fix some block element newline issues
content = content.replace(new RegExp('\\s*<div', 'mg'), '\n<div');
content = content.replace(new RegExp('</div>\\s*', 'mg'), '</div>\n');
-
+
var blocklist2 = 'blockquote|ul|ol|li|table|thead|tr|th|td|h[1-6]|pre';
content = content.replace(new RegExp('\\s*<(('+blocklist2+') ?[^>]*)\\s*>', 'mg'), '\n<$1>');
content = content.replace(new RegExp('\\s*</('+blocklist2+')>\\s*', 'mg'), '</$1>\n');
@@ -65,6 +71,9 @@ switchEditors = {
content = content.replace(new RegExp('^\\s*', ''), '');
content = content.replace(new RegExp('\\s*$', ''), '');
+ // put back the line breaks in pre|script
+ content = content.replace(/<wp_temp>/g, '\n');
+
// Hope.
return content;
},
@@ -109,7 +118,7 @@ switchEditors = {
ec.style.padding = '6px';
}
- ta.style.color = '';
+ ta.style.color = '';
this.wpSetDefaultEditor('html');
}
},
@@ -148,15 +157,21 @@ switchEditors = {
pee = pee.replace(new RegExp('<p>\\s*?</p>', 'gi'), '');
pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1");
pee = pee.replace(new RegExp("<p>(<li.+?)</p>", 'gi'), "$1");
- pee = pee.replace(new RegExp('<p><blockquote([^>]*)>', 'gi'), "<blockquote$1><p>");
- pee = pee.replace(new RegExp('</blockquote></p>', 'gi'), '</p></blockquote>');
+ pee = pee.replace(new RegExp('<p>\\s*<blockquote([^>]*)>', 'gi'), "<blockquote$1><p>");
+ pee = pee.replace(new RegExp('</blockquote>\\s*</p>', 'gi'), '</p></blockquote>');
pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)', 'gi'), "$1");
pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1");
pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n");
pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*<br />', 'gi'), "$1");
pee = pee.replace(new RegExp('<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1');
- pee = pee.replace(new RegExp('^((?:&nbsp;)*)\\s', 'mg'), '$1&nbsp;');
- //pee = pee.replace(new RegExp('(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' "); // Hmm...
- return pee;
+ // pee = pee.replace(new RegExp('^((?:&nbsp;)*)\\s', 'mg'), '$1&nbsp;');
+
+ // Fix the pre|script tags
+ pee = pee.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
+ a = a.replace(/<br ?\/?>[\r\n]*/g, '\n');
+ return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '\n');
+ });
+
+ return pee;
}
}
diff --git a/wp-admin/js/post.js b/wp-admin/js/post.js
index 78b22ed..c938af3 100644
--- a/wp-admin/js/post.js
+++ b/wp-admin/js/post.js
@@ -118,6 +118,10 @@ jQuery(document).ready( function() {
jQuery('#in-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c );
noSyncChecks = false;
};
+ var catAddBefore = function( s ) {
+ s.data += '&' + jQuery( '#categorychecklist :checked' ).serialize();
+ return s;
+ };
var catAddAfter = function( r, s ) {
if ( !newCatParent ) newCatParent = jQuery('#newcat_parent');
if ( !newCatParentOption ) newCatParentOption = newCatParent.find( 'option[value=-1]' );
@@ -127,7 +131,7 @@ jQuery(document).ready( function() {
var th = jQuery(this);
var val = th.find('input').val();
var id = th.find('input')[0].id
- jQuery('#' + id).change( syncChecks );
+ jQuery('#' + id).change( syncChecks ).change();
if ( newCatParent.find( 'option[value=' + val + ']' ).size() )
return;
var name = jQuery.trim( th.text() );
@@ -140,6 +144,7 @@ jQuery(document).ready( function() {
jQuery('#categorychecklist').wpList( {
alt: '',
response: 'category-ajax-response',
+ addBefore: catAddBefore,
addAfter: catAddAfter
} );
jQuery('#category-add-toggle').click( function() {
@@ -148,7 +153,7 @@ jQuery(document).ready( function() {
jQuery('#newcat').focus();
return false;
} );
- jQuery('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change();
+ jQuery('.categorychecklist .popular-category :checkbox').change( syncChecks ).filter( ':checked' ).change();
jQuery('.edit-timestamp').click(function () {
if (jQuery('#timestampdiv').is(":hidden")) {
diff --git a/wp-admin/js/widgets.js b/wp-admin/js/widgets.js
index 2802f9b..4eb37ee 100644
--- a/wp-admin/js/widgets.js
+++ b/wp-admin/js/widgets.js
@@ -11,7 +11,7 @@ jQuery(function($) {
var widgetAnim = $.browser.msie ? function() {
var t = $(this);
if ( t.is(':visible') ) {
- if ( disableFields ) { t.find( ':enabled' ).not( '[name="widget-id[]"], [name*="[submit]"]' ).attr( 'disabled', 'disabled' ); }
+ if ( disableFields ) { t.find( ':input:enabled' ).not( '[name="widget-id[]"], [name*="[submit]"]' ).attr( 'disabled', 'disabled' ); }
li.css( 'marginLeft', 0 );
t.siblings('h4').children('a').text( widgetsL10n.edit );
} else {
@@ -25,7 +25,7 @@ jQuery(function($) {
var t = $(this);
if ( t.is(':visible') ) {
- if ( disableFields ) { t.find( ':enabled' ).not( '[name="widget-id[]"], [name*="[submit]"]' ).attr( 'disabled', 'disabled' ); }
+ if ( disableFields ) { t.find( ':input:enabled' ).not( '[name="widget-id[]"], [name*="[submit]"]' ).attr( 'disabled', 'disabled' ); }
if ( width > 250 )
li.animate( { marginLeft: 0 } );
t.siblings('h4').children('a').text( widgetsL10n.edit );
diff --git a/wp-admin/menu.php b/wp-admin/menu.php
index 342f1ee..3db528f 100644
--- a/wp-admin/menu.php
+++ b/wp-admin/menu.php
@@ -20,7 +20,8 @@ elseif (strpos($_SERVER['REQUEST_URI'], 'link-add.php') !== false)
else
$menu[10] = array(__('Manage'), 'edit_posts', 'edit.php');
-$awaiting_mod = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'");
+$awaiting_mod = wp_count_comments();
+$awaiting_mod = $awaiting_mod->moderated;
$menu[15] = array(__('Design'), 'switch_themes', 'themes.php');
$menu[20] = array( sprintf( __('Comments %s'), "<span id='awaiting-mod' class='count-$awaiting_mod'><span class='comment-count'>$awaiting_mod</span></span>" ), 'edit_posts', 'edit-comments.php');
$menu[30] = array(__('Settings'), 'manage_options', 'options-general.php');
@@ -52,6 +53,7 @@ if ( current_user_can('edit_users') ) {
$submenu['users.php'][5] = array(__('Authors &amp; Users'), 'edit_users', 'users.php');
$submenu['users.php'][10] = array(__('Your Profile'), 'read', 'profile.php');
} else {
+ $_wp_real_parent_file['users.php'] = 'profile.php';
$submenu['profile.php'][5] = array(__('Your Profile'), 'read', 'profile.php');
}
diff --git a/wp-admin/page.php b/wp-admin/page.php
index 6f755da..a314e5d 100644
--- a/wp-admin/page.php
+++ b/wp-admin/page.php
@@ -9,8 +9,10 @@ wp_reset_vars(array('action'));
function redirect_page($page_ID) {
$referredby = '';
- if ( !empty($_POST['referredby']) )
+ if ( !empty($_POST['referredby']) ) {
$referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']);
+ $referredby = remove_query_arg('_wp_original_http_referer', $referredby);
+ }
$referer = preg_replace('|https?://[^/]+|i', '', wp_get_referer());
if ( 'post' == $_POST['originalaction'] && !empty($_POST['mode']) && 'bookmarklet' == $_POST['mode'] ) {
@@ -32,6 +34,7 @@ function redirect_page($page_ID) {
$location = $location[0] . '#postcustom';
} elseif (!empty($referredby) && $referredby != $referer) {
$location = $_POST['referredby'];
+ $location = remove_query_arg('_wp_original_http_referer', $location);
if ( $_POST['referredby'] == 'redo' )
$location = get_permalink( $page_ID );
elseif ( false !== strpos($location, 'edit-pages.php') )
@@ -81,15 +84,18 @@ case 'edit':
wp_enqueue_script('editor');
wp_enqueue_script('thickbox');
wp_enqueue_script('media-upload');
- if ( $last = wp_check_post_lock( $post->ID ) ) {
- $last_user = get_userdata( $last );
- $last_user_name = $last_user ? $last_user->display_name : __('Somebody');
- $message = sprintf( __( 'Warning: %s is currently editing this page' ), wp_specialchars( $last_user_name ) );
- $message = str_replace( "'", "\'", "<div class='error'><p>$message</p></div>" );
- add_action('admin_notices', create_function( '', "echo '$message';" ) );
- } else {
- wp_set_post_lock( $post->ID );
- wp_enqueue_script('autosave');
+
+ if ( current_user_can('edit_page', $page_ID) ) {
+ if ( $last = wp_check_post_lock( $post->ID ) ) {
+ $last_user = get_userdata( $last );
+ $last_user_name = $last_user ? $last_user->display_name : __('Somebody');
+ $message = sprintf( __( 'Warning: %s is currently editing this page' ), wp_specialchars( $last_user_name ) );
+ $message = str_replace( "'", "\'", "<div class='error'><p>$message</p></div>" );
+ add_action('admin_notices', create_function( '', "echo '$message';" ) );
+ } else {
+ wp_set_post_lock( $post->ID );
+ wp_enqueue_script('autosave');
+ }
}
require_once('admin-header.php');
diff --git a/wp-admin/post.php b/wp-admin/post.php
index 66e0ab7..b9400b7 100644
--- a/wp-admin/post.php
+++ b/wp-admin/post.php
@@ -10,8 +10,10 @@ function redirect_post($post_ID = '') {
global $action;
$referredby = '';
- if ( !empty($_POST['referredby']) )
+ if ( !empty($_POST['referredby']) ) {
$referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']);
+ $referredby = remove_query_arg('_wp_original_http_referer', $referredby);
+ }
$referer = preg_replace('|https?://[^/]+|i', '', wp_get_referer());
if ( !empty($_POST['mode']) && 'bookmarklet' == $_POST['mode'] ) {
@@ -33,6 +35,7 @@ function redirect_post($post_ID = '') {
$location = $location[0] . '#postcustom';
} elseif (!empty($referredby) && $referredby != $referer) {
$location = $_POST['referredby'];
+ $location = remove_query_arg('_wp_original_http_referer', $location);
if ( $_POST['referredby'] == 'redo' )
$location = get_permalink( $post_ID );
elseif ( false !== strpos($location, 'edit.php') )
@@ -87,15 +90,18 @@ case 'edit':
wp_enqueue_script('editor');
wp_enqueue_script('thickbox');
wp_enqueue_script('media-upload');
- if ( $last = wp_check_post_lock( $post->ID ) ) {
- $last_user = get_userdata( $last );
- $last_user_name = $last_user ? $last_user->display_name : __('Somebody');
- $message = sprintf( __( 'Warning: %s is currently editing this post' ), wp_specialchars( $last_user_name ) );
- $message = str_replace( "'", "\'", "<div class='error'><p>$message</p></div>" );
- add_action('admin_notices', create_function( '', "echo '$message';" ) );
- } else {
- wp_set_post_lock( $post->ID );
- wp_enqueue_script('autosave');
+
+ if ( current_user_can('edit_post', $post_ID) ) {
+ if ( $last = wp_check_post_lock( $post->ID ) ) {
+ $last_user = get_userdata( $last );
+ $last_user_name = $last_user ? $last_user->display_name : __('Somebody');
+ $message = sprintf( __( 'Warning: %s is currently editing this post' ), wp_specialchars( $last_user_name ) );
+ $message = str_replace( "'", "\'", "<div class='error'><p>$message</p></div>" );
+ add_action('admin_notices', create_function( '', "echo '$message';" ) );
+ } else {
+ wp_set_post_lock( $post->ID );
+ wp_enqueue_script('autosave');
+ }
}
require_once('admin-header.php');
diff --git a/wp-admin/rtl.css b/wp-admin/rtl.css
index e5d9fb8..c5d94b2 100644
--- a/wp-admin/rtl.css
+++ b/wp-admin/rtl.css
@@ -114,6 +114,12 @@ p#post-search
float:right!important
}
+.tablenav .delete
+{
+ margin-left: 40px;
+ margin-right: 0;
+}
+
ul.view-switch
{
float:left;
diff --git a/wp-admin/widgets.php b/wp-admin/widgets.php
index 4a8751d..83264e4 100644
--- a/wp-admin/widgets.php
+++ b/wp-admin/widgets.php
@@ -18,7 +18,7 @@ if ( isset($_GET['sidebar']) && isset($wp_registered_sidebars[$_GET['sidebar']])
$sidebar = attribute_escape( $_GET['sidebar'] );
} elseif ( is_array($wp_registered_sidebars) && !empty($wp_registered_sidebars) ) {
// By default we look at the first defined sidebar
- $sidebar = array_shift( array_keys($wp_registered_sidebars) );
+ $sidebar = array_shift( $keys = array_keys($wp_registered_sidebars) );
} else {
// If no sidebars, die.
require_once( 'admin-header.php' );
@@ -317,5 +317,7 @@ if ( isset($_GET['message']) && isset($messages[$_GET['message']]) ) : ?>
<?php do_action( 'sidebar_admin_page' ); ?>
+<br class="clear" />
+
<?php require_once( 'admin-footer.php' ); ?>
diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css
index bf7e63f..7a9283c 100644
--- a/wp-admin/wp-admin.css
+++ b/wp-admin/wp-admin.css
@@ -34,8 +34,8 @@ form#upload #post_content, form#upload #post_title {
}
.form-invalid input {
- border-width: 1px; !important
- border-style: solid; !important
+ border-width: 1px !important;
+ border-style: solid !important;
}
@@ -879,6 +879,10 @@ html, body {
margin-bottom: 6px;
}
+#profile-page .form-table input[type=text] {
+ width: 300px;
+}
+
#pass-strength-result {
width: 197px;
float: left;
@@ -1436,7 +1440,7 @@ ul.view-switch li.current {
background-image: url(images/tail.gif);
background-repeat: no-repeat;
background-position: 15px bottom;
- background-color: thansparent;
+ background-color: transparent;
}
#tTips p#tTips_inside {