From 310940b824eff4a116dcd72ccd339bb602021981 Mon Sep 17 00:00:00 2001 From: donncha Date: Tue, 10 Jun 2008 14:08:54 +0000 Subject: Merge with branches/2.5 in WordPress, revision 8066 git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1324 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-admin/async-upload.php | 4 ++- wp-admin/comment.php | 4 --- wp-admin/css/media.css | 20 +++++++++++++ wp-admin/css/widgets-rtl.css | 9 +++--- wp-admin/css/widgets.css | 28 +++++++------------ wp-admin/edit-comments.php | 2 +- wp-admin/includes/dashboard.php | 4 ++- wp-admin/includes/media.php | 13 ++++++--- wp-admin/includes/upgrade.php | 9 ++++++ wp-admin/includes/widgets.php | 3 +- wp-admin/js/link.js | 3 ++ wp-admin/js/media-upload.js | 35 ++++++++++++++++++++--- wp-admin/js/widgets.js | 8 +++--- wp-admin/media.php | 2 +- wp-admin/menu.php | 2 +- wp-admin/plugins.php | 4 +-- wp-admin/update.php | 2 +- wp-admin/user-edit.php | 2 +- wp-admin/widgets.php | 2 ++ wp-content/themes/classic/index.php | 2 +- wp-includes/comment.php | 5 ++++ wp-includes/functions.php | 2 ++ wp-includes/general-template.php | 12 +++++--- wp-includes/js/swfupload/handlers.js | 2 +- wp-includes/js/thickbox/thickbox.css | 9 +++--- wp-includes/link-template.php | 4 +-- wp-includes/media.php | 26 ++++++++++++++--- wp-includes/post.php | 54 ++++++++++++++++++++++++------------ wp-includes/rewrite.php | 12 ++++---- wp-includes/script-loader.php | 10 +++---- wp-includes/taxonomy.php | 10 ++++--- wp-includes/version.php | 6 ++-- wp-includes/widgets.php | 5 ++-- 33 files changed, 212 insertions(+), 103 deletions(-) diff --git a/wp-admin/async-upload.php b/wp-admin/async-upload.php index 1a37dce..c1c0f0d 100644 --- a/wp-admin/async-upload.php +++ b/wp-admin/async-upload.php @@ -15,7 +15,7 @@ if ( empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) ) unset($current_user); require_once('admin.php'); -header('Content-Type: text/plain'); +header('Content-Type: text/plain; charset=' . get_option('blog_charset')); if ( !current_user_can('upload_files') ) wp_die(__('You do not have permission to upload files.')); @@ -26,6 +26,8 @@ if ( ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) { exit; } +check_admin_referer('media-form'); + $id = media_handle_upload('async-upload', $_REQUEST['post_id']); if (is_wp_error($id)) { echo '
'.wp_specialchars($id->get_error_message()).'
'; diff --git a/wp-admin/comment.php b/wp-admin/comment.php index 6691456..4aa9749 100644 --- a/wp-admin/comment.php +++ b/wp-admin/comment.php @@ -193,10 +193,6 @@ case 'approvecomment' : wp_set_comment_status( $comment->comment_ID, 'approve' ); - if ( true == get_option('comments_notify') ) - wp_notify_postauthor( $comment->comment_ID ); - - if ( '' != wp_get_referer() && false == $noredir ) wp_redirect( wp_get_referer() ); else diff --git a/wp-admin/css/media.css b/wp-admin/css/media.css index c77a069..7d46c1c 100644 --- a/wp-admin/css/media.css +++ b/wp-admin/css/media.css @@ -196,6 +196,11 @@ abbr.required { #media-upload .media-upload-form p { margin: 0 1em 1em 0; } + +#media-upload .media-upload-form p.ml-submit { + padding: 1em 0; +} + #media-upload p.help { font-style: italic; font-weight: normal; @@ -240,3 +245,18 @@ abbr.required { margin-bottom: 1em; height: 3em; } + +#media-upload #filter { + width: 623px; +} + +#media-upload #filter .subsubsub { + margin: 8px 0; +} + +#filter .tablenav select { + border-style:solid; + border-width:1px; + padding:2px; + vertical-align:top; +} diff --git a/wp-admin/css/widgets-rtl.css b/wp-admin/css/widgets-rtl.css index 89ff4b6..ece02b5 100644 --- a/wp-admin/css/widgets-rtl.css +++ b/wp-admin/css/widgets-rtl.css @@ -38,13 +38,12 @@ li.widget-list-control-item h4.widget-title a, #dragHelper li.widget-list-contro left:1em; } -li.widget-list-control-item div.widget-control { - padding:0 0 0 10px; -} ul.widget-control-list div.widget-control-actions { margin-right:0; margin-left:-10px; } -ul.widget-control-list .widget-title { - text-align:right; +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 5d044cf..baeb851 100644 --- a/wp-admin/css/widgets.css +++ b/wp-admin/css/widgets.css @@ -74,7 +74,6 @@ ul#widget-list li.widget-list-item div.widget-description { font-size: 11px; } - ul#widget-list li.widget-list-item ul.widget-control-info { display: none; } @@ -91,27 +90,26 @@ ul.widget-control-list { padding: 0 1em; } -ul.widget-control-list li { - position: relative; -} - div#current-widgets p.submit { padding: 1em; } li.widget-list-control-item { - margin: 0 0 1em; + margin: 1em 0; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; } -li.widget-list-control-item h4, #dragHelper li.widget-list-control-item h4, li.widget-sortable h4 { +li.widget-list-control-item h4, +#dragHelper li.widget-list-control-item h4, +li.widget-sortable h4 { margin: 0; - padding: 0.4em 2.5em 0.4em 0.8em; cursor: move; font-size: 13px; + padding: 0.4em 2.5em 0.4em 0.8em; + position: relative; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; @@ -143,16 +141,16 @@ li.widget-list-control-item h4.widget-title a, } li.widget-list-control-item h4.widget-title a:hover { - text-decoration: none; border-bottom: none; } li.widget-list-control-item div.widget-control { display: none; - margin: 1em; - padding: 0 10px 0 7px; /* Correction for padding, margin, border of inputs */ + padding: 15px; font-size: 11px; + position: relative; + background-color: #CFEBF7; } li.widget-list-control-item div.widget-control p { @@ -161,15 +159,9 @@ li.widget-list-control-item div.widget-control p { } ul.widget-control-list div.widget-control-actions { - margin-right: -10px; /* Correction for padding, margin, border of inputs */ - margin-left: -6px; border-top-width: 1px; border-top-style: solid; - padding: 0.5em 0 0.8em; -} - -ul.widget-control-list .widget-title { - + padding: 0.5em 0 0; } .widget-control-edit { diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index bc62681..c756efe 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -97,7 +97,7 @@ if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['sp sprintf(__ngettext('Awaiting Moderation (%s)', 'Awaiting Moderation (%s)', $num_comments->moderated), "$num_comments->moderated"), 'approved' => _c('Approved|plural')); +$stati = array('moderated' => sprintf(__ngettext('Awaiting Moderation (%s)', 'Awaiting Moderation (%s)', number_format_i18n($num_comments->moderated) ), "" . number_format_i18n($num_comments->moderated) . ""), 'approved' => _c('Approved|plural')); $class = ( '' === $comment_status ) ? ' class="current"' : ''; $status_links[] = "
  • ".__('Show All Comments').""; foreach ( $stati as $status => $label ) { diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index ea88ee4..97fd26a 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -23,7 +23,9 @@ function wp_dashboard_setup() { /* Register Widgets and Controls */ // Recent Comments Widget - if ( current_user_can( 'moderate_comments' ) && $mod_comments = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'") ) { + $mod_comments = wp_count_comments(); + $mod_comments = $mod_comments->moderated; + if ( current_user_can( 'moderate_comments' ) && $mod_comments ) { $notice = sprintf( __ngettext( '%d comment awaiting moderation', '%d comments awaiting moderation', $mod_comments ), $mod_comments ); $notice = "$notice"; } else { diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index be70d92..0fb84bb 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -55,7 +55,7 @@ function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = fal $rel = $rel ? ' rel="attachment wp-att-'.attribute_escape($id).'"' : ''; if ( $url ) - $html = "$html"; + $html = '$html"; $html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url, $size ); @@ -180,7 +180,7 @@ add_action( 'media_buttons', 'media_buttons' ); function media_buttons_head() { $siteurl = get_option('siteurl'); echo "\n"; } @@ -791,6 +794,7 @@ jQuery(function($){ post_params : { "post_id" : "", "auth_cookie" : "", + "_wpnonce" : "", "type" : "", "tab" : "", "short" : "1" @@ -815,6 +819,7 @@ jQuery(function($){ //--> +

    @@ -959,7 +964,6 @@ function media_upload_library_form($errors) {
    -

    -

    @@ -1066,8 +1069,10 @@ jQuery(function($){
    +

    +

    flush_rules(); @@ -747,6 +750,12 @@ function upgrade_251() { update_option('secret', wp_generate_password(64)); } +function upgrade_252() { + global $wpdb; + + $wpdb->query("UPDATE $wpdb->users SET user_activation_key = ''"); +} + // The functions we use to actually do stuff // General diff --git a/wp-admin/includes/widgets.php b/wp-admin/includes/widgets.php index 641f80f..09936b7 100644 --- a/wp-admin/includes/widgets.php +++ b/wp-admin/includes/widgets.php @@ -227,6 +227,7 @@ function wp_widget_control( $sidebar_args ) { if ( empty($sidebar_args['_display']) || 'template' != $sidebar_args['_display'] ) echo $sidebar_args['before_widget']; ?> +

    @@ -239,7 +240,7 @@ function wp_widget_control( $sidebar_args ) { -

    +
    > diff --git a/wp-admin/js/link.js b/wp-admin/js/link.js index cfc0f94..2b3fa65 100644 --- a/wp-admin/js/link.js +++ b/wp-admin/js/link.js @@ -1,4 +1,7 @@ jQuery(document).ready( function() { + // close postboxes that should be closed + jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed'); + jQuery('#link_name').focus(); // postboxes add_postbox_toggles('link'); diff --git a/wp-admin/js/media-upload.js b/wp-admin/js/media-upload.js index b8c615d..506faf8 100644 --- a/wp-admin/js/media-upload.js +++ b/wp-admin/js/media-upload.js @@ -1,12 +1,39 @@ // send html to the post editor function send_to_editor(h) { - var win = window.opener ? window.opener : window.dialogArguments; - if ( !win ) - win = top; + var win = window.dialogArguments || opener || parent || top; + tinyMCE = win.tinyMCE; if ( typeof tinyMCE != 'undefined' && ( ed = tinyMCE.getInstanceById('content') ) && !ed.isHidden() ) { tinyMCE.selectedInstance.getWin().focus(); tinyMCE.execCommand('mceInsertContent', false, h); } else win.edInsertContent(win.edCanvas, h); -} \ No newline at end of file +} + +// thickbox settings +jQuery(function($) { + tb_position = function() { + var tbWindow = $('#TB_window'); + var width = $(window).width(); + var H = $(window).height(); + var W = ( 720 < width ) ? 720 : width; + + 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'}); + }; + + return $('a.thickbox').each( function() { + var href = $(this).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 - 80 ) + '&height=' + ( H - 85 ) ); + }); + }; + + $(window).resize( function() { tb_position() } ); + $(document).ready( function() { tb_position() } ); +}); + diff --git a/wp-admin/js/widgets.js b/wp-admin/js/widgets.js index 4eb37ee..b42812f 100644 --- a/wp-admin/js/widgets.js +++ b/wp-admin/js/widgets.js @@ -13,12 +13,12 @@ jQuery(function($) { if ( t.is(':visible') ) { 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 ); + t.siblings('div').children('h4').children('a').text( widgetsL10n.edit ); } else { t.find( ':disabled' ).attr( 'disabled', '' ); // always enable on open if ( width > 250 ) li.css( 'marginLeft', ( width - 250 ) * -1 ); - t.siblings('h4').children('a').text( widgetsL10n.cancel ); + t.siblings('div').children('h4').children('a').text( widgetsL10n.cancel ); } t.toggle(); } : function() { @@ -28,12 +28,12 @@ jQuery(function($) { 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 ); + t.siblings('div').children('h4').children('a').text( widgetsL10n.edit ); } else { t.find( ':disabled' ).attr( 'disabled', '' ); // always enable on open if ( width > 250 ) li.animate( { marginLeft: ( width - 250 ) * -1 } ); - t.siblings('h4').children('a').text( widgetsL10n.cancel ); + t.siblings('div').children('h4').children('a').text( widgetsL10n.cancel ); } t.animate( { height: 'toggle' } ); }; diff --git a/wp-admin/media.php b/wp-admin/media.php index 2508810..03b3749 100644 --- a/wp-admin/media.php +++ b/wp-admin/media.php @@ -92,7 +92,7 @@ case 'edit' :

    - +
    diff --git a/wp-admin/menu.php b/wp-admin/menu.php index 3db528f..81f9b33 100644 --- a/wp-admin/menu.php +++ b/wp-admin/menu.php @@ -23,7 +23,7 @@ else $awaiting_mod = wp_count_comments(); $awaiting_mod = $awaiting_mod->moderated; $menu[15] = array(__('Design'), 'switch_themes', 'themes.php'); -$menu[20] = array( sprintf( __('Comments %s'), "$awaiting_mod" ), 'edit_posts', 'edit-comments.php'); +$menu[20] = array( sprintf( __('Comments %s'), "" . number_format_i18n($awaiting_mod) . "" ), 'edit_posts', 'edit-comments.php'); $menu[30] = array(__('Settings'), 'manage_options', 'options-general.php'); $menu[35] = array(__('Plugins'), 'activate_plugins', 'plugins.php'); if ( current_user_can('edit_users') ) diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php index 1cd1a89..8e6b707 100644 --- a/wp-admin/plugins.php +++ b/wp-admin/plugins.php @@ -93,11 +93,11 @@ if (empty($plugins)) { $inactive = get_option('deactivated_plugins'); if ( !empty($active) ) { ?> - + - + diff --git a/wp-admin/update.php b/wp-admin/update.php index 34e9380..be95102 100644 --- a/wp-admin/update.php +++ b/wp-admin/update.php @@ -22,7 +22,7 @@ function request_filesystem_credentials($form_post, $type = '', $error = false) $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? $_POST['hostname'] : $credentials['hostname']); $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? $_POST['username'] : $credentials['username']); $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? $_POST['password'] : $credentials['password']); - $credentials['ssl'] = defined('FTP_SSL') ? FTP_SSL : (!empty($_POST['ssl']) ? $_POST['ssl'] : $credentials['ssl']); + $credentials['ssl'] = defined('FTP_SSL') ? FTP_SSL : ( isset($_POST['ssl']) ? $_POST['ssl'] : $credentials['ssl']); if ( ! $error && !empty($credentials['password']) && !empty($credentials['username']) && !empty($credentials['hostname']) ) { $stored_credentials = $credentials; diff --git a/wp-admin/user-edit.php b/wp-admin/user-edit.php index 8ee9c05..b01c3a8 100644 --- a/wp-admin/user-edit.php +++ b/wp-admin/user-edit.php @@ -171,7 +171,7 @@ include ('admin-header.php'); $color_info ): ?> diff --git a/wp-admin/widgets.php b/wp-admin/widgets.php index 83264e4..5e4659e 100644 --- a/wp-admin/widgets.php +++ b/wp-admin/widgets.php @@ -134,7 +134,9 @@ if ( isset($_GET['add']) && $_GET['add'] ) {
    • +

      +

      - + diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 63e6b1b..57af654 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -726,6 +726,11 @@ function wp_set_comment_status($comment_id, $comment_status) { break; case 'approve': $query = "UPDATE $wpdb->comments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1"; + if ( get_option('comments_notify') ) { + $comment = get_comment($comment_id); + wp_notify_postauthor($comment_id, $comment->comment_type); + } + break; case 'spam': $query = "UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID='$comment_id' LIMIT 1"; diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 6d37b02..89b4333 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1431,6 +1431,7 @@ function _config_wp_siteurl( $url = '' ) { return $url; } + function _mce_set_direction( $input ) { global $wp_locale; @@ -1443,6 +1444,7 @@ function _mce_set_direction( $input ) { return $input; } + function smilies_init() { global $wpsmiliestrans, $wp_smiliessearch, $wp_smiliesreplace; diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 052f55b..4a7f1bb 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -343,13 +343,17 @@ function get_archives_link($url, $text, $format = 'html', $before = '', $after = $url = clean_url($url); if ('link' == $format) - return "\t\n"; + $link_html = "\t\n"; elseif ('option' == $format) - return "\t\n"; + $link_html = "\t\n"; elseif ('html' == $format) - return "\t
    • $before$text$after
    • \n"; + $link_html = "\t
    • $before$text$after
    • \n"; else // custom - return "\t$before$text$after\n"; + $link_html = "\t$before$text$after\n"; + + $link_html = apply_filters( "get_archives_link", $link_html ); + + return $link_html; } diff --git a/wp-includes/js/swfupload/handlers.js b/wp-includes/js/swfupload/handlers.js index 92eb8ac..75ce85c 100644 --- a/wp-includes/js/swfupload/handlers.js +++ b/wp-includes/js/swfupload/handlers.js @@ -55,7 +55,7 @@ function prepareMediaItemInit(fileObj) { jQuery('#media-item-' + fileObj.id + ' .filename.original').replaceWith(jQuery('#media-item-' + fileObj.id + ' .filename.new')); // Also bind toggle to the links - jQuery('#media-item-' + fileObj.id + ' a.toggle').bind('click', function(){jQuery(this).siblings('.slidetoggle').slideToggle(150);jQuery(this).parent().eq(0).children('.toggle').toggle();jQuery(this).siblings('a.toggle').focus();return false;}); + jQuery('#media-item-' + fileObj.id + ' a.toggle').bind('click', function(){jQuery(this).siblings('.slidetoggle').slideToggle(150, function(){window.scrollTo(0,this.parentNode.offsetTop);});jQuery(this).parent().eq(0).children('.toggle').toggle();jQuery(this).siblings('a.toggle').focus();return false;}); // Bind AJAX to the new Delete button jQuery('#media-item-' + fileObj.id + ' a.delete').bind('click',function(){ diff --git a/wp-includes/js/thickbox/thickbox.css b/wp-includes/js/thickbox/thickbox.css index 0552cc5..dc502a7 100644 --- a/wp-includes/js/thickbox/thickbox.css +++ b/wp-includes/js/thickbox/thickbox.css @@ -45,19 +45,17 @@ #TB_window { position: fixed; - background: #ffffff; z-index: 102; color:#000000; display:none; - border: 4px solid #525252; text-align:left; - top:50%; + top:20px; left:50%; } * html #TB_window { /* ie6 hack */ position: absolute; -margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px'); +margin-top: expression(20) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px'); } #TB_window img#TB_Image { @@ -97,6 +95,9 @@ margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = d #TB_title{ background-color:#e8e8e8; height:27px; + border-width: 4px; + border-color: #525252; + border-style: solid solid none; } #TB_ajaxContent{ diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 74da3e7..92f57e4 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -184,7 +184,7 @@ function get_attachment_link($id = false) { else $name = $object->post_name; if (strpos($parentlink, '?') === false) - $link = trailingslashit($parentlink) . $name . '/'; + $link = user_trailingslashit( trailingslashit($parentlink) . $name ); } if (! $link ) { @@ -402,7 +402,7 @@ function get_tag_feed_link($tag_id, $feed = '') { $feed_link = 'feed'; else $feed_link = "feed/$feed"; - $link = $link . user_trailingslashit($feed_link, 'feed'); + $link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed'); } $link = apply_filters('tag_feed_link', $link, $feed); diff --git a/wp-includes/media.php b/wp-includes/media.php index f43a2f0..dc7da3a 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -90,16 +90,34 @@ function image_downsize($id, $size = 'medium') { } -// return an tag for the given image attachment, scaling it down if requested +/** + * An tag for an image attachment, scaling it down if requested. + * + * {@internal Missing Long Description}} + * + * @uses apply_filters() The 'get_image_tag_class' filter is the IMG element + * class attribute. + * @uses apply_filters() The 'get_image_tag' filter is the full IMG element with + * all attributes. + * + * @param int $id Attachment ID. + * @param string $alt Image Description for the alt attribute. + * @param string $title Image Description for the title attribute. + * @param string $align Part of the class name for aligning the image. + * @param string $size Optional. Default is 'medium'. + * @return string HTML IMG element for given image attachment + */ function get_image_tag($id, $alt, $title, $align, $size='medium') { list( $img_src, $width, $height ) = image_downsize($id, $size); $hwstring = image_hwstring($width, $height); - $html = ''.attribute_escape($alt).''; + $class = 'align'.attribute_escape($align).' size-'.attribute_escape($size).' wp-image-'.$id; + $class = apply_filters('get_image_tag_class', $class, $id, $align, $size); - $url = ''; - $html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url, $size ); + $html = ''.attribute_escape($alt).''; + + $html = apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $size ); return $html; } diff --git a/wp-includes/post.php b/wp-includes/post.php index 8219da6..cf76638 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -199,12 +199,11 @@ function &get_post(&$post, $output = OBJECT, $filter = 'raw') { * @subpackage Post * @since 2.5 * - * @param string $field {@internal Missing Description}} - * @param int|object &$post post ID or post object + * @param int|object $post post ID or post object * @return array of ancestor IDs */ function get_post_ancestors($post) { - $post = get_post(); + $post = get_post($post); if ( !empty($post->ancestors) ) return $post->ancestors; @@ -1164,7 +1163,7 @@ function wp_get_single_post($postid = 0, $mode = OBJECT) { * @param array $postarr post contents * @return int post ID or 0 on error */ -function wp_insert_post($postarr = array()) { +function wp_insert_post($postarr = array(), $wp_error = false) { global $wpdb, $wp_rewrite, $user_ID; $defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_ID, @@ -1187,8 +1186,12 @@ function wp_insert_post($postarr = array()) { $previous_status = 'new'; } - if ( ('' == $post_content) && ('' == $post_title) && ('' == $post_excerpt) ) - return 0; + if ( ('' == $post_content) && ('' == $post_title) && ('' == $post_excerpt) ) { + if ( $wp_error ) + return new WP_Error('empty_content', __('Content, title, and excerpt are empty.')); + else + return 0; + } // Make sure we set a valid category if (0 == count($post_category) || !is_array($post_category)) { @@ -1285,8 +1288,7 @@ function wp_insert_post($postarr = array()) { $suffix = 2; do { $alt_post_name = substr($post_name, 0, 200-(strlen($suffix)+1)). "-$suffix"; - // expected_slashed ($alt_post_name, $post_name, $post_type) - $post_name_check = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_name = '$alt_post_name' AND post_type = '$post_type' AND ID != %d AND post_parent = %d LIMIT 1", $post_ID, $post_parent)); + $post_name_check = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d AND post_parent = %d LIMIT 1", $alt_post_name, $post_type, $post_ID, $post_parent)); $suffix++; } while ($post_name_check); $post_name = $alt_post_name; @@ -1300,10 +1302,20 @@ function wp_insert_post($postarr = array()) { if ($update) { do_action( 'pre_post_update', $post_ID ); - $wpdb->update( $wpdb->posts, $data, $where ); + if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) { + if ( $wp_error ) + return new WP_Error('db_update_error', __('Could not update post in the database'), $wpdb->last_error); + else + return 0; + } } else { $data['post_mime_type'] = stripslashes( $post_mime_type ); // This isn't in the update - $wpdb->insert( $wpdb->posts, $data ); + if ( false === $wpdb->insert( $wpdb->posts, $data ) ) { + if ( $wp_error ) + return new WP_Error('db_insert_error', __('Could not insert post into the database'), $wpdb->last_error); + else + return 0; + } $post_ID = (int) $wpdb->insert_id; // use the newly generated $post_ID @@ -1320,19 +1332,29 @@ function wp_insert_post($postarr = array()) { $current_guid = get_post_field( 'guid', $post_ID ); - if ( 'page' == $post_type ) { + if ( 'page' == $post_type ) clean_page_cache($post_ID); - } else { + else clean_post_cache($post_ID); - } // Set GUID if ( !$update && '' == $current_guid ) $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post_ID ) ), $where ); $post = get_post($post_ID); - if ( !empty($page_template) ) + + if ( !empty($page_template) && 'page' == $post_type ) { $post->page_template = $page_template; + $page_templates = get_page_templates(); + if ( 'default' != $page_template && !in_array($page_template, $page_templates) ) { + if ( $wp_error ) + return new WP_Error('invalid_page_template', __('The page template is invalid.')); + else + return 0; + } + if ( ! update_post_meta($post_ID, '_wp_page_template', $page_template) ) + add_post_meta($post_ID, '_wp_page_template', $page_template, true); + } wp_transition_post_status($post_status, $previous_status, $post); @@ -2943,10 +2965,6 @@ function _publish_post_hook($post_id) { */ function _save_post_hook($post_id, $post) { if ( $post->post_type == 'page' ) { - if ( !empty($post->page_template) ) - if ( ! update_post_meta($post_id, '_wp_page_template', $post->page_template)) - add_post_meta($post_id, '_wp_page_template', $post->page_template, true); - clean_page_cache($post_id); global $wp_rewrite; $wp_rewrite->flush_rules(); diff --git a/wp-includes/rewrite.php b/wp-includes/rewrite.php index 2229497..176eee0 100644 --- a/wp-includes/rewrite.php +++ b/wp-includes/rewrite.php @@ -793,12 +793,12 @@ class WP_Rewrite { $robots_rewrite = array('robots.txt$' => $this->index . '?robots=1'); //Default Feed rules - These are require to allow for the direct access files to work with permalink structure starting with %category% - $default_feeds = array( '.*/wp-atom.php$' => $this->index .'?feed=atom', - '.*/wp-rdf.php$' => $this->index .'?feed=rdf', - '.*/wp-rss.php$' => $this->index .'?feed=rss', - '.*/wp-rss2.php$' => $this->index .'?feed=rss2', - '.*/wp-feed.php$' => $this->index .'?feed=feed', - '.*/wp-commentsrss2.php$' => $this->index . '?feed=rss2&withcomments=1'); + $default_feeds = array( '.*wp-atom.php$' => $this->index .'?feed=atom', + '.*wp-rdf.php$' => $this->index .'?feed=rdf', + '.*wp-rss.php$' => $this->index .'?feed=rss', + '.*wp-rss2.php$' => $this->index .'?feed=rss2', + '.*wp-feed.php$' => $this->index .'?feed=feed', + '.*wp-commentsrss2.php$' => $this->index . '?feed=rss2&withcomments=1'); // Post $post_rewrite = $this->generate_rewrite_rules($this->permalink_structure, EP_PERMALINK); diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 5ee222c..2bbafa3 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -80,8 +80,8 @@ class WP_Scripts { $this->add( 'dimensions', '/wp-includes/js/jquery/jquery.dimensions.min.js', array('jquery'), '1.1.2'); $this->add( 'suggest', '/wp-includes/js/jquery/suggest.js', array('dimensions'), '1.1'); $this->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20'); - $this->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.js', array('jquery'), '3.1'); - $this->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.0.2'); + $this->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.js', array('jquery'), '3.1-20080430'); + $this->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.0.2-20080430'); $this->add( 'swfupload-degrade', '/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js', array('swfupload'), '2.0.2'); $this->localize( 'swfupload-degrade', 'uploadDegradeOptions', array( 'is_lighttpd_before_150' => is_lighttpd_before_150(), @@ -144,7 +144,7 @@ class WP_Scripts { 'save' => __('Save'), 'cancel' => __('Cancel'), ) ); - $this->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20080519' ); + $this->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20080422' ); $this->localize( 'post', 'postL10n', array( 'tagsUsed' => __('Tags used on this post:'), 'add' => attribute_escape(__('Add')), @@ -164,7 +164,7 @@ class WP_Scripts { 'cancel' => __('Cancel'), 'edit' => __('Edit'), ) ); - $this->add( 'media-upload', '/wp-admin/js/media-upload.js', false, '20080109' ); + $this->add( 'media-upload', '/wp-admin/js/media-upload.js', false, '20080430' ); $this->localize( 'upload', 'uploadL10n', array( 'browseTitle' => attribute_escape(__('Browse your files')), 'back' => __('« Back'), @@ -187,7 +187,7 @@ class WP_Scripts { 'saveText' => attribute_escape(__('Save »')), 'confirmText' => __("Are you sure you want to delete the file '%title%'?\nClick ok to delete or cancel to go back.") ) ); - $this->add( 'admin-widgets', '/wp-admin/js/widgets.js', array( 'interface' ), '20080407c' ); + $this->add( 'admin-widgets', '/wp-admin/js/widgets.js', array( 'interface' ), '20080503' ); $this->localize( 'admin-widgets', 'widgetsL10n', array( 'add' => __('Add'), 'edit' => __('Edit'), diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index cc16a61..4418e99 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -1058,14 +1058,14 @@ function wp_get_object_terms($object_ids, $taxonomies, $args = array()) { if ( count($taxonomies) > 1 ) { foreach ( $taxonomies as $index => $taxonomy ) { $t = get_taxonomy($taxonomy); - if ( is_array($t->args) && $args != array_merge($args, $t->args) ) { + if ( isset($t->args) && is_array($t->args) && $args != array_merge($args, $t->args) ) { unset($taxonomies[$index]); $terms = array_merge($terms, wp_get_object_terms($object_ids, $taxonomy, array_merge($args, $t->args))); } } } else { $t = get_taxonomy($taxonomies[0]); - if ( is_array($t->args) ) + if ( isset($t->args) && is_array($t->args) ) $args = array_merge($args, $t->args); } @@ -1199,14 +1199,16 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) { if ( ! $term_id = is_term($slug) ) { $maxterm = $wpdb->get_var( "SELECT max(term_id) FROM {$wpdb->terms}" ); $term_id = mt_rand( $maxterm+100, $maxterm+4000 ); - $wpdb->query("INSERT INTO $wpdb->terms (term_id, name, slug, term_group) VALUES ('$term_id', '$name', '$slug', '$term_group')"); + if ( false === $wpdb->insert( $wpdb->terms, compact( 'term_id', 'name', 'slug', 'term_group' ) ) ) + return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error); } else if ( is_taxonomy_hierarchical($taxonomy) && !empty($parent) ) { // If the taxonomy supports hierarchy and the term has a parent, make the slug unique // by incorporating parent slugs. $slug = wp_unique_term_slug($slug, (object) $args); $maxterm = $wpdb->get_var( "SELECT max(term_id) FROM {$wpdb->terms}" ); $term_id = mt_rand( $maxterm+100, $maxterm+4000 ); - $wpdb->query("INSERT INTO $wpdb->terms (term_id, name, slug, term_group) VALUES ('$term_id', '$name', '$slug', '$term_group')"); + if ( false === $wpdb->insert( $wpdb->terms, compact( 'term_id','name', 'slug', 'term_group' ) ) ) + return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error); } if ( empty($slug) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 9e29068..d2aa5cc 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -8,7 +8,7 @@ * * @global string $wp_version */ -$wp_version = '2.5.1'; +$wp_version = '2.5.2-alpha'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB scheme @@ -16,7 +16,7 @@ $wp_version = '2.5.1'; * * @global int $wp_db_version */ -$wp_db_version = 7796; +$wp_db_version = 7935; -$wpmu_version = '1.5.1'; +$wpmu_version = '1.5.2-alpha'; ?> diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php index 9fa2630..1c356e6 100644 --- a/wp-includes/widgets.php +++ b/wp-includes/widgets.php @@ -710,10 +710,11 @@ function wp_widget_categories($args, $widget_args = 1) { echo $before_widget; echo $before_title . $title . $after_title; - $cat_args = "orderby=name&show_count={$c}&hierarchical={$h}"; + $cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h); if ( $d ) { - wp_dropdown_categories($cat_args . '&show_option_none= ' . __('Select Category')); + $cat_args['show_option_none'] = __('Select Category'); + wp_dropdown_categories($cat_args); ?>