summaryrefslogtreecommitdiffstats
path: root/wp-includes
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-06-10 14:08:54 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-06-10 14:08:54 +0000
commit310940b824eff4a116dcd72ccd339bb602021981 (patch)
tree19f6efc7b30b9456eebc26d578c5dc7e125bb6e7 /wp-includes
parent616f7399dc4c4f7c56951c7b87a7aa91b3e690a3 (diff)
downloadwordpress-mu-310940b824eff4a116dcd72ccd339bb602021981.tar.gz
wordpress-mu-310940b824eff4a116dcd72ccd339bb602021981.tar.xz
wordpress-mu-310940b824eff4a116dcd72ccd339bb602021981.zip
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
Diffstat (limited to 'wp-includes')
-rw-r--r--wp-includes/comment.php5
-rw-r--r--wp-includes/functions.php2
-rw-r--r--wp-includes/general-template.php12
-rw-r--r--wp-includes/js/swfupload/handlers.js2
-rw-r--r--wp-includes/js/thickbox/thickbox.css9
-rw-r--r--wp-includes/link-template.php4
-rw-r--r--wp-includes/media.php26
-rw-r--r--wp-includes/post.php54
-rw-r--r--wp-includes/rewrite.php12
-rw-r--r--wp-includes/script-loader.php10
-rw-r--r--wp-includes/taxonomy.php10
-rw-r--r--wp-includes/version.php6
-rw-r--r--wp-includes/widgets.php5
13 files changed, 104 insertions, 53 deletions
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<link rel='archives' title='$title_text' href='$url' />\n";
+ $link_html = "\t<link rel='archives' title='$title_text' href='$url' />\n";
elseif ('option' == $format)
- return "\t<option value='$url'>$before $text $after</option>\n";
+ $link_html = "\t<option value='$url'>$before $text $after</option>\n";
elseif ('html' == $format)
- return "\t<li>$before<a href='$url' title='$title_text'>$text</a>$after</li>\n";
+ $link_html = "\t<li>$before<a href='$url' title='$title_text'>$text</a>$after</li>\n";
else // custom
- return "\t$before<a href='$url' title='$title_text'>$text</a>$after\n";
+ $link_html = "\t$before<a href='$url' title='$title_text'>$text</a>$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 <img src /> tag for the given image attachment, scaling it down if requested
+/**
+ * An <img src /> 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 = '<img src="'.attribute_escape($img_src).'" alt="'.attribute_escape($alt).'" title="'.attribute_escape($title).'" '.$hwstring.'class="align'.attribute_escape($align).' size-'.attribute_escape($size).' wp-image-'.$id.'" />';
+ $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 = '<img src="'.attribute_escape($img_src).'" alt="'.attribute_escape($alt).'" title="'.attribute_escape($title).'" '.$hwstring.'class="'.$class.'" />';
+
+ $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' => __('&laquo; Back'),
@@ -187,7 +187,7 @@ class WP_Scripts {
'saveText' => attribute_escape(__('Save &raquo;')),
'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);
?>
<script type='text/javascript'>