diff options
-rw-r--r-- | wp-admin/css/press-this-ie.css | 1 | ||||
-rw-r--r-- | wp-admin/import/textpattern.php | 2 | ||||
-rw-r--r-- | wp-admin/includes/image.php | 10 | ||||
-rw-r--r-- | wp-admin/includes/template.php | 2 | ||||
-rw-r--r-- | wp-includes/formatting.php | 3 | ||||
-rw-r--r-- | wp-includes/pluggable.php | 44 | ||||
-rw-r--r-- | wp-includes/post.php | 25 | ||||
-rw-r--r-- | wp-includes/query.php | 67 | ||||
-rw-r--r-- | wp-includes/version.php | 4 | ||||
-rw-r--r-- | wp-includes/widgets.php | 8 | ||||
-rw-r--r-- | wp-settings.php | 2 |
11 files changed, 113 insertions, 55 deletions
diff --git a/wp-admin/css/press-this-ie.css b/wp-admin/css/press-this-ie.css index 54a1bfe..2e2282a 100644 --- a/wp-admin/css/press-this-ie.css +++ b/wp-admin/css/press-this-ie.css @@ -1,4 +1,3 @@ -
#posting {
position: static !important;
}
diff --git a/wp-admin/import/textpattern.php b/wp-admin/import/textpattern.php index c3fb1d7..bbddc08 100644 --- a/wp-admin/import/textpattern.php +++ b/wp-admin/import/textpattern.php @@ -333,7 +333,7 @@ class Textpattern_Import { $category1 = get_category_by_slug($Category1); $category1 = $category1->term_id; $category2 = get_category_by_slug($Category2); - $category2 = $category1->term_id; + $category2 = $category2->term_id; if($cat1 = $category1) { $cats[1] = $cat1; } if($cat2 = $category2) { $cats[2] = $cat2; } diff --git a/wp-admin/includes/image.php b/wp-admin/includes/image.php index 7699f98..8de2907 100644 --- a/wp-admin/includes/image.php +++ b/wp-admin/includes/image.php @@ -219,17 +219,17 @@ function wp_read_image_metadata( $file ) { if ( !empty($info['APP13']) ) { $iptc = iptcparse($info['APP13']); if ( !empty($iptc['2#110'][0]) ) // credit - $meta['credit'] = trim( $iptc['2#110'][0] ); + $meta['credit'] = utf8_encode(trim($iptc['2#110'][0])); elseif ( !empty($iptc['2#080'][0]) ) // byline - $meta['credit'] = trim( $iptc['2#080'][0] ); + $meta['credit'] = utf8_encode(trim($iptc['2#080'][0])); if ( !empty($iptc['2#055'][0]) and !empty($iptc['2#060'][0]) ) // created datee and time $meta['created_timestamp'] = strtotime($iptc['2#055'][0] . ' ' . $iptc['2#060'][0]); if ( !empty($iptc['2#120'][0]) ) // caption - $meta['caption'] = trim( $iptc['2#120'][0] ); + $meta['caption'] = utf8_encode(trim($iptc['2#120'][0])); if ( !empty($iptc['2#116'][0]) ) // copyright - $meta['copyright'] = trim( $iptc['2#116'][0] ); + $meta['copyright'] = utf8_encode(trim($iptc['2#116'][0])); if ( !empty($iptc['2#005'][0]) ) // title - $meta['title'] = trim( $iptc['2#005'][0] ); + $meta['title'] = utf8_encode(trim($iptc['2#005'][0])); } } diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 3d6aac5..e132733 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -715,7 +715,7 @@ function _wp_get_comment_list( $status = '', $s = false, $start, $num ) { $approved ORDER BY comment_date_gmt DESC LIMIT $start, $num"); } else { - $comments = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments USE INDEX (comment_date_gmt) WHERE $approved ORDER BY comment_date_gmt DESC LIMIT $start, $num" ); + $comments = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE $approved ORDER BY comment_date_gmt DESC LIMIT $start, $num" ); } update_comment_cache($comments); diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index e2b969a..eeafe0b 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -332,6 +332,9 @@ function sanitize_user( $username, $strict = false ) { if ( $strict ) $username = preg_replace('|[^a-z0-9 _.\-@]|i', '', $username); + // Consolidate contiguous whitespace + $username = preg_replace('|\s+|', ' ', $username); + return apply_filters('sanitize_user', $username, $raw_username, $strict); } diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index 0007633..8ca7ba1 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -1295,11 +1295,53 @@ function wp_generate_password($length = 12, $special_chars = true) { $password = ''; for ( $i = 0; $i < $length; $i++ ) - $password .= substr($chars, mt_rand(0, strlen($chars) - 1), 1); + $password .= substr($chars, wp_rand(0, strlen($chars) - 1), 1); return $password; } endif; +if ( !function_exists('wp_rand') ) : + /** + * Generates a random number + * + * @since 2.6.2 + * + * @param int $min Lower limit for the generated number (optional, default is 0) + * @param int $max Upper limit for the generated number (optional, default is 4294967295) + * @return int A random number between min and max + */ +function wp_rand( $min = 0, $max = 0 ) { + global $rnd_value; + + $seed = get_option('random_seed'); + + // Reset $rnd_value after 14 uses + // 32(md5) + 40(sha1) + 40(sha1) / 8 = 14 random numbers from $rnd_value + if ( strlen($rnd_value) < 8 ) { + $rnd_value = md5( uniqid(microtime() . mt_rand(), true ) . $seed ); + $rnd_value .= sha1($rnd_value); + $rnd_value .= sha1($rnd_value . $seed); + $seed = md5($seed . $rnd_value); + update_option('random_seed', $seed); + } + + // Take the first 8 digits for our value + $value = substr($rnd_value, 0, 8); + + // Strip the first eight, leaving the remainder for the next call to wp_rand(). + $rnd_value = substr($rnd_value, 8); + + $value = abs(hexdec($value)); + + // Reduce the value to be within the min - max range + // 4294967295 = 0xffffffff = max random number + if ( $max != 0 ) + $value = $min + (($max - $min + 1) * ($value / (4294967295 + 1))); + + return abs(intval($value)); +} +endif; + if ( !function_exists('wp_set_password') ) : /** * Updates the user's password with a new encrypted one. diff --git a/wp-includes/post.php b/wp-includes/post.php index bf7d922..54ce668 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -465,7 +465,7 @@ function get_posts($args = null) { 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' =>'', 'post_type' => 'post', - 'post_parent' => 0 + 'post_parent' => 0, 'suppress_filters' => true ); $r = wp_parse_args( $args, $defaults ); @@ -594,27 +594,20 @@ function get_post_meta($post_id, $key, $single = false) { $meta_cache = wp_cache_get($post_id, 'post_meta'); + if ( !$meta_cache ) { + update_postmeta_cache($post_id); + $meta_cache = wp_cache_get($post_id, 'post_meta'); + } + if ( isset($meta_cache[$key]) ) { if ( $single ) { return maybe_unserialize( $meta_cache[$key][0] ); } else { - return maybe_unserialize( $meta_cache[$key] ); + return array_map('maybe_unserialize', $meta_cache[$key]); } } - if ( !$meta_cache ) { - update_postmeta_cache($post_id); - $meta_cache = wp_cache_get($post_id, 'post_meta'); - } - - if ( $single ) { - if ( isset($meta_cache[$key][0]) ) - return maybe_unserialize($meta_cache[$key][0]); - else - return ''; - } else { - return maybe_unserialize($meta_cache[$key]); - } + return ''; } /** @@ -3297,7 +3290,7 @@ function _wp_put_post_revision( $post = null, $autosave = false ) { if ( !$post || empty($post['ID']) ) return; - if ( isset($post['post_type']) && 'revision' == $post_post['type'] ) + if ( isset($post['post_type']) && 'revision' == $post['post_type'] ) return new WP_Error( 'post_type', __( 'Cannot create a revision of a revision' ) ); $post = _wp_post_revision_fields( $post, $autosave ); diff --git a/wp-includes/query.php b/wp-includes/query.php index 35e53f3..e318020 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -775,7 +775,7 @@ class WP_Query { if ( !empty($qv['post_status']) )
$qv['post_status'] = preg_replace('|[^a-z0-9_,-]|', '', $qv['post_status']);
- if ( $this->is_posts_page && !$qv['withcomments'] )
+ if ( $this->is_posts_page && ( ! isset($qv['withcomments']) || ! $qv['withcomments'] ) )
$this->is_comment_feed = false;
$this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;
@@ -829,7 +829,12 @@ class WP_Query { $join = '';
$search = '';
$groupby = '';
+ $fields = "$wpdb->posts.*";
$post_status_join = false;
+ $page = 1;
+
+ if ( !isset($q['suppress_filters']) )
+ $q['suppress_filters'] = false;
if ( !isset($q['post_type']) ) {
if ( $this->is_search )
@@ -1361,8 +1366,10 @@ class WP_Query { // Apply filters on where and join prior to paging so that any
// manipulations to them are reflected in the paging by day queries.
- $where = apply_filters('posts_where', $where);
- $join = apply_filters('posts_join', $join);
+ if ( !$q['suppress_filters'] ) {
+ $where = apply_filters('posts_where', $where);
+ $join = apply_filters('posts_join', $join);
+ }
// Paging
if ( empty($q['nopaging']) && !$this->is_singular ) {
@@ -1394,9 +1401,11 @@ class WP_Query { $cgroupby = '';
}
- $cjoin = apply_filters('comment_feed_join', $cjoin);
- $cwhere = apply_filters('comment_feed_where', $cwhere);
- $cgroupby = apply_filters('comment_feed_groupby', $cgroupby);
+ if ( !$q['suppress_filters'] ) {
+ $cjoin = apply_filters('comment_feed_join', $cjoin);
+ $cwhere = apply_filters('comment_feed_where', $cwhere);
+ $cgroupby = apply_filters('comment_feed_groupby', $cgroupby);
+ }
$this->comments = (array) $wpdb->get_results("SELECT $distinct $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby ORDER BY comment_date_gmt DESC LIMIT " . get_option('posts_per_rss'));
$this->comment_count = count($this->comments);
@@ -1414,28 +1423,33 @@ class WP_Query { $where = "AND 0";
}
+ $orderby = $q['orderby'];
+
// Apply post-paging filters on where and join. Only plugins that
// manipulate paging queries should use these hooks.
-
- $where = apply_filters('posts_where_paged', $where);
- $groupby = apply_filters('posts_groupby', $groupby);
- $join = apply_filters('posts_join_paged', $join);
- $orderby = apply_filters('posts_orderby', $q['orderby']);
- $distinct = apply_filters('posts_distinct', $distinct);
- $fields = apply_filters('posts_fields', "$wpdb->posts.*");
- $limits = apply_filters( 'post_limits', $limits );
+ if ( !$q['suppress_filters'] ) {
+ $where = apply_filters('posts_where_paged', $where);
+ $groupby = apply_filters('posts_groupby', $groupby);
+ $join = apply_filters('posts_join_paged', $join);
+ $orderby = apply_filters('posts_orderby', $orderby);
+ $distinct = apply_filters('posts_distinct', $distinct);
+ $fields = apply_filters('posts_fields', $fields);
+ $limits = apply_filters( 'post_limits', $limits );
+ }
// Announce current selection parameters. For use by caching plugins.
do_action( 'posts_selection', $where . $groupby . $orderby . $limits . $join );
// Filter again for the benefit of caching plugins. Regular plugins should use the hooks above.
- $where = apply_filters('posts_where_request', $where);
- $groupby = apply_filters('posts_groupby_request', $groupby);
- $join = apply_filters('posts_join_request', $join);
- $orderby = apply_filters('posts_orderby_request', $orderby);
- $distinct = apply_filters('posts_distinct_request', $distinct);
- $fields = apply_filters('posts_fields_request', $fields);
- $limits = apply_filters( 'post_limits_request', $limits );
+ if ( !$q['suppress_filters'] ) {
+ $where = apply_filters('posts_where_request', $where);
+ $groupby = apply_filters('posts_groupby_request', $groupby);
+ $join = apply_filters('posts_join_request', $join);
+ $orderby = apply_filters('posts_orderby_request', $orderby);
+ $distinct = apply_filters('posts_distinct_request', $distinct);
+ $fields = apply_filters('posts_fields_request', $fields);
+ $limits = apply_filters( 'post_limits_request', $limits );
+ }
if ( ! empty($groupby) )
$groupby = 'GROUP BY ' . $groupby;
@@ -1445,12 +1459,14 @@ class WP_Query { if ( !empty($limits) )
$found_rows = 'SQL_CALC_FOUND_ROWS';
- $request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits";
- $this->request = apply_filters('posts_request', $request);
+ $this->request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits";
+ if ( !$q['suppress_filters'] )
+ $this->request = apply_filters('posts_request', $this->request);
$this->posts = $wpdb->get_results($this->request);
// Raw results filter. Prior to status checks.
- $this->posts = apply_filters('posts_results', $this->posts);
+ if ( !$q['suppress_filters'] )
+ $this->posts = apply_filters('posts_results', $this->posts);
if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) {
$cjoin = apply_filters('comment_feed_join', '');
@@ -1497,7 +1513,8 @@ class WP_Query { }
}
- $this->posts = apply_filters('the_posts', $this->posts);
+ if ( !$q['suppress_filters'] )
+ $this->posts = apply_filters('the_posts', $this->posts);
update_post_caches($this->posts);
diff --git a/wp-includes/version.php b/wp-includes/version.php index 38e145a..bd8f64c 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -8,7 +8,7 @@ * * @global string $wp_version */ -$wp_version = '2.6.1'; +$wp_version = '2.6.2'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. @@ -17,5 +17,5 @@ $wp_version = '2.6.1'; */ $wp_db_version = 8204; -$wpmu_version = '2.6.1'; +$wpmu_version = '2.6.2'; ?> diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php index 2a71a02..73e1f6e 100644 --- a/wp-includes/widgets.php +++ b/wp-includes/widgets.php @@ -1162,8 +1162,12 @@ function wp_widget_rss_output( $rss, $args = array() ) { $author = ' <cite>' . wp_specialchars( strip_tags( $item['author_name'] ) ) . '</cite>'; } - echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>{$date}{$summary}{$author}</li>"; - } + if ( $link == '' ) { + echo "<li>$title{$date}{$summary}{$author}</li>"; + } else { + echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>{$date}{$summary}{$author}</li>"; + } +} echo '</ul>'; } else { echo '<ul><li>' . __( 'An error has occurred; the feed is probably down. Try again later.' ) . '</li></ul>'; diff --git a/wp-settings.php b/wp-settings.php index d58c344..9f7fb82 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -101,7 +101,7 @@ if ( empty($PHP_SELF) || constant( 'VHOST' ) == 'no' ) $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]); if ( version_compare( '4.3', phpversion(), '>' ) ) { - die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %s but WordPress requires at least 4.3.'/*/WP_I18N_OLD_PHP*/, php_version() ) ); + die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %s but WordPress requires at least 4.3.'/*/WP_I18N_OLD_PHP*/, phpversion() ) ); } if ( !defined('WP_CONTENT_DIR') ) |