summaryrefslogtreecommitdiffstats
path: root/wp-includes
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-02-28 12:13:39 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-02-28 12:13:39 +0000
commitc897a0ba270f217512e37f8bd520dd24b35b058d (patch)
treeab5683db986751fe3d79c9aeddcbbafa708870c7 /wp-includes
parent8399b696d7660728535b85dbd90466f0e82e6fc8 (diff)
downloadwordpress-mu-c897a0ba270f217512e37f8bd520dd24b35b058d.tar.gz
wordpress-mu-c897a0ba270f217512e37f8bd520dd24b35b058d.tar.xz
wordpress-mu-c897a0ba270f217512e37f8bd520dd24b35b058d.zip
WP Merge to rev 4956
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@904 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes')
-rw-r--r--wp-includes/bookmark-template.php2
-rw-r--r--wp-includes/bookmark.php2
-rw-r--r--wp-includes/cache.php4
-rw-r--r--wp-includes/category-template.php2
-rw-r--r--wp-includes/classes.php18
-rw-r--r--wp-includes/cron.php8
-rw-r--r--wp-includes/feed-atom-comments.php8
-rw-r--r--wp-includes/feed-atom.php2
-rw-r--r--wp-includes/formatting.php2
-rw-r--r--wp-includes/general-template.php16
-rw-r--r--wp-includes/gettext.php2
-rw-r--r--wp-includes/js/autosave-js.php14
-rw-r--r--wp-includes/js/tinymce/tiny_mce_config.php2
-rw-r--r--wp-includes/link-template.php2
-rw-r--r--wp-includes/pluggable.php2
-rw-r--r--wp-includes/plugin.php115
-rw-r--r--wp-includes/post-template.php2
-rw-r--r--wp-includes/post.php8
-rw-r--r--wp-includes/query.php117
-rw-r--r--wp-includes/theme.php6
-rw-r--r--wp-includes/wp-db.php6
21 files changed, 160 insertions, 180 deletions
diff --git a/wp-includes/bookmark-template.php b/wp-includes/bookmark-template.php
index 2f475d4..e73edd7 100644
--- a/wp-includes/bookmark-template.php
+++ b/wp-includes/bookmark-template.php
@@ -345,7 +345,7 @@ function wp_list_bookmarks($args = '') {
} else {
//output one single list using title_li for the title
$bookmarks = get_bookmarks("limit=$limit&category=$category&show_updated=$show_updated&orderby=$orderby&order=$order&hide_invisible=$hide_invisible&show_updated=$show_updated");
-
+
if ( !empty($bookmarks) ) {
if ( !empty( $title_li ) ){
$output .= str_replace(array('%id', '%class'), array("linkcat-$category", $class), $category_before);
diff --git a/wp-includes/bookmark.php b/wp-includes/bookmark.php
index dc98d9d..5aea9a8 100644
--- a/wp-includes/bookmark.php
+++ b/wp-includes/bookmark.php
@@ -72,7 +72,7 @@ function get_bookmarks($args = '') {
}
if (!empty($exclusions))
$exclusions .= ')';
-
+
if ( ! empty($category_name) ) {
if ( $cat_id = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$category_name' LIMIT 1") )
$category = $cat_id;
diff --git a/wp-includes/cache.php b/wp-includes/cache.php
index b5a2b9d..e89e5f6 100644
--- a/wp-includes/cache.php
+++ b/wp-includes/cache.php
@@ -410,7 +410,7 @@ class WP_Object_Cache {
function WP_Object_Cache() {
return $this->__construct();
}
-
+
function __construct() {
global $blog_id;
@@ -453,7 +453,7 @@ class WP_Object_Cache {
function __destruct() {
$this->save();
- return true;
+ return true;
}
}
?>
diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php
index 0fd33bb..0d85c01 100644
--- a/wp-includes/category-template.php
+++ b/wp-includes/category-template.php
@@ -250,7 +250,7 @@ function wp_list_categories($args = '') {
$output .= __("No categories");
} else {
global $wp_query;
-
+
if ( is_category() )
$r['current_category'] = $wp_query->get_queried_object_id();
diff --git a/wp-includes/classes.php b/wp-includes/classes.php
index 223780f..e8563ec 100644
--- a/wp-includes/classes.php
+++ b/wp-includes/classes.php
@@ -414,16 +414,16 @@ class Walker {
$cb_args = array_merge( array($output, $element, $depth - 1), $args);
$output = call_user_func_array(array(&$this, 'start_el'), $cb_args);
}
-
+
// End the element.
if ( isset($element->$id_field) && $element->$id_field != 0 ) {
$cb_args = array_merge( array($output, $element, $depth - 1), $args);
$output = call_user_func_array(array(&$this, 'end_el'), $cb_args);
}
-
- continue;
+
+ continue;
}
-
+
// Walk the tree.
if ( !empty($previous_element) && ($element->$parent_field == $previous_element->$id_field) ) {
// Previous element is my parent. Descend a level.
@@ -512,19 +512,19 @@ class Walker_Page extends Walker {
$css_class .= ' current_page_parent';
$output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page->ID) . '" title="' . attribute_escape($page->post_title) . '">' . $page->post_title . '</a>';
-
+
if ( !empty($show_date) ) {
if ( 'modified' == $show_date )
$time = $page->post_modified;
else
$time = $page->post_date;
-
+
$output .= " " . mysql2date($date_format, $time);
}
return $output;
}
-
+
function end_el($output, $page, $depth) {
$output .= "</li>\n";
@@ -613,10 +613,10 @@ class Walker_Category extends Walker {
if ( empty($feed_image) )
$link .= ')';
}
-
+
if ( isset($show_count) && $show_count )
$link .= ' (' . intval($category->category_count) . ')';
-
+
if ( isset($show_date) && $show_date ) {
$link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp);
}
diff --git a/wp-includes/cron.php b/wp-includes/cron.php
index 3d24431..40004ca 100644
--- a/wp-includes/cron.php
+++ b/wp-includes/cron.php
@@ -54,7 +54,7 @@ function wp_unschedule_event( $timestamp, $hook, $args = array() ) {
function wp_clear_scheduled_hook( $hook ) {
$args = array_slice( func_get_args(), 1 );
-
+
while ( $timestamp = wp_next_scheduled( $hook, $args ) )
wp_unschedule_event( $timestamp, $hook, $args );
}
@@ -73,10 +73,10 @@ function wp_next_scheduled( $hook, $args = array() ) {
function spawn_cron() {
$crons = _get_cron_array();
-
+
if ( !is_array($crons) )
return;
-
+
$keys = array_keys( $crons );
if ( array_shift( $keys ) > time() )
return;
@@ -98,7 +98,7 @@ function wp_cron() {
return;
$crons = _get_cron_array();
-
+
if ( !is_array($crons) )
return;
diff --git a/wp-includes/feed-atom-comments.php b/wp-includes/feed-atom-comments.php
index 7687a8c..7efb3f9 100644
--- a/wp-includes/feed-atom-comments.php
+++ b/wp-includes/feed-atom-comments.php
@@ -16,10 +16,10 @@ echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '" ?' . '>'
printf(__('Comments for %s'), get_bloginfo_rss( 'name' ) . get_wp_title_rss());
?></title>
<subtitle type="text"><?php bloginfo_rss('description'); ?></subtitle>
-
+
<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastcommentmodified('GMT')); ?></updated>
<generator uri="http://wordpress.org/" version="<?php bloginfo('version'); ?>">WordPress</generator>
-
+
<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" content="<?php bloginfo_rss('home'); ?>" />
<link rel="self" type="application/atom+xml" href="<?php bloginfo_rss('comments_atom_url'); ?>" />
<id><?php bloginfo_rss('comments_atom_url'); ?></id>
@@ -41,13 +41,13 @@ if ( have_comments() ) : while ( have_comments() ) : the_comment();
}
?></title>
<link rel="alternate" href="<?php comment_link(); ?>" type="<?php bloginfo_rss('content_type'); ?>" />
-
+
<author>
<name><?php comment_author_rss(); ?></name>
<?php if (get_comment_author_url()) echo '<uri>' . get_comment_author_url() . '</uri>'; ?>
</author>
-
+
<id><?php comment_link(); ?></id>
<updated><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></updated>
<published><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></published>
diff --git a/wp-includes/feed-atom.php b/wp-includes/feed-atom.php
index e9b4c77..8a52d1c 100644
--- a/wp-includes/feed-atom.php
+++ b/wp-includes/feed-atom.php
@@ -13,7 +13,7 @@ $more = 1;
>
<title type="text"><?php bloginfo_rss('name') ?></title>
<subtitle type="text"><?php bloginfo_rss("description") ?></subtitle>
-
+
<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT')); ?></updated>
<generator uri="http://wordpress.org/" version="<?php bloginfo_rss('version'); ?>">WordPress</generator>
diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php
index 25971d3..daafba3 100644
--- a/wp-includes/formatting.php
+++ b/wp-includes/formatting.php
@@ -21,7 +21,7 @@ function wptexturize($text) {
$static_replacements = array_merge(array('&#8212;', ' &#8212; ', '&#8211;', 'xn--', '&#8230;', '&#8220;', '&#8217;s', '&#8221;', ' &#8482;'), $cockneyreplace);
$dynamic_characters = array('/\'(\d\d(?:&#8217;|\')?s)/', '/(\s|\A|")\'/', '/(\d+)"/', '/(\d+)\'/', '/(\S)\'([^\'\s])/', '/(\s|\A)"(?!\s)/', '/"(\s|\S|\Z)/', '/\'([\s.]|\Z)/', '/(\d+)x(\d+)/');
- $dynamic_replacements = array('&#8217;$1','$1&#8216;', '$1&#8243;', '$1&#8242;', '$1&#8217;$2', '$1&#8220;$2', '&#8221;$1', '&#8217;$1', '$1&#215;$2');
+ $dynamic_replacements = array('&#8217;$1','$1&#8216;', '$1&#8243;', '$1&#8242;', '$1&#8217;$2', '$1&#8220;$2', '&#8221;$1', '&#8217;$1', '$1&#215;$2');
for ( $i = 0; $i < $stop; $i++ ) {
$curl = $textarr[$i];
diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php
index 113c173..b0fd238 100644
--- a/wp-includes/general-template.php
+++ b/wp-includes/general-template.php
@@ -355,15 +355,15 @@ function wp_get_archives($args = '') {
} elseif ('yearly' == $type) {
$arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts WHERE post_type ='post' AND post_status = 'publish' GROUP BY YEAR(post_date) ORDER BY post_date DESC" . $limit);
if ($arcresults) {
- $afterafter = $after;
- foreach ($arcresults as $arcresult) {
- $url = get_year_link($arcresult->year);
- $text = sprintf('%d', $arcresult->year);
+ $afterafter = $after;
+ foreach ($arcresults as $arcresult) {
+ $url = get_year_link($arcresult->year);
+ $text = sprintf('%d', $arcresult->year);
if ($show_post_count)
- $after = '&nbsp;('.$arcresult->posts.')' . $afterafter;
- echo get_archives_link($url, $text, $format, $before, $after);
- }
- }
+ $after = '&nbsp;('.$arcresult->posts.')' . $afterafter;
+ echo get_archives_link($url, $text, $format, $before, $after);
+ }
+ }
} elseif ( 'daily' == $type ) {
$arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date DESC" . $limit);
if ( $arcresults ) {
diff --git a/wp-includes/gettext.php b/wp-includes/gettext.php
index dd79dcd..aabd9cf 100644
--- a/wp-includes/gettext.php
+++ b/wp-includes/gettext.php
@@ -308,7 +308,7 @@ class gettext_reader {
# poEdit doesn't put any semicolons, which
# results in parse error in eval
$string .= ';';
-
+
$total = 0;
$plural = 0;
diff --git a/wp-includes/js/autosave-js.php b/wp-includes/js/autosave-js.php
index e30134d..caaa16d 100644
--- a/wp-includes/js/autosave-js.php
+++ b/wp-includes/js/autosave-js.php
@@ -28,7 +28,7 @@ function autosave_cur_time() {
((now.getMinutes() < 10) ? ":0" : ":") + now.getMinutes() +
((now.getSeconds() < 10) ? ":0" : ":") + now.getSeconds();
}
-
+
function autosave_update_nonce() {
var response = nonceAjax.response;
document.getElementsByName('_wpnonce')[0].value = response;
@@ -38,7 +38,7 @@ function autosave_update_post_ID() {
var response = autosaveAjax.response;
var res = parseInt(response);
var message;
-
+
if(isNaN(res)) {
message = "<?php echo js_escape(__('Error: ')); ?>" + response;
} else {
@@ -70,7 +70,7 @@ function autosave_saved() {
var response = autosaveAjax.response;
var res = parseInt(response);
var message;
-
+
if(isNaN(res)) {
message = "<?php echo js_escape(__('Error: ')); ?>" + response;
} else {
@@ -127,7 +127,7 @@ function autosave() {
goodcats.push(cats[i].value);
}
catslist = goodcats.join(",");
-
+
autosaveAjax.setVar("action", "autosave");
autosaveAjax.setVar("cookie", document.cookie);
autosaveAjax.setVar("catslist", catslist);
@@ -139,15 +139,15 @@ function autosave() {
if ( form.ping_status.checked )
autosaveAjax.setVar("ping_status", 'open');
if(form.excerpt)
- autosaveAjax.setVar("excerpt", form.excerpt.value);
-
+ autosaveAjax.setVar("excerpt", form.excerpt.value);
+
if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 || rich == false ) {
autosaveAjax.setVar("content", form.content.value);
} else {
tinyMCE.wpTriggerSave();
autosaveAjax.setVar("content", form.content.value);
}
-
+
autosaveAjax.requestFile = "<?php echo get_option('siteurl'); ?>/wp-admin/admin-ajax.php";
autosaveAjax.method = "POST";
autosaveAjax.element = null;
diff --git a/wp-includes/js/tinymce/tiny_mce_config.php b/wp-includes/js/tinymce/tiny_mce_config.php
index 6697d9d..9e06575 100644
--- a/wp-includes/js/tinymce/tiny_mce_config.php
+++ b/wp-includes/js/tinymce/tiny_mce_config.php
@@ -40,7 +40,7 @@
$mce_browsers = apply_filters('mce_browsers', array('msie', 'gecko', 'opera', 'safari'));
$mce_browsers = implode($mce_browsers, ',');
-
+
$mce_popups_css = get_option('siteurl') . '/wp-includes/js/tinymce/plugins/wordpress/popups.css';
$mce_css = get_option('siteurl') . '/wp-includes/js/tinymce/plugins/wordpress/wordpress.css';
$mce_css = apply_filters('mce_css', $mce_css);
diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php
index 1f600ee..16f6b58 100644
--- a/wp-includes/link-template.php
+++ b/wp-includes/link-template.php
@@ -262,7 +262,7 @@ function get_post_comments_feed_link($post_id = '', $feed = 'rss2') {
$url = get_option('home') . "/?feed=$feed&amp;p=$id";
}
- return apply_filters('post_comments_feed_link', $url);
+ return apply_filters('post_comments_feed_link', $url);
}
function edit_post_link($link = 'Edit This', $before = '', $after = '') {
diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php
index 67f17a9..1c9c111 100644
--- a/wp-includes/pluggable.php
+++ b/wp-includes/pluggable.php
@@ -169,7 +169,7 @@ function wp_mail($to, $subject, $message, $headers = '') {
require_once(ABSPATH . WPINC . '/class-smtp.php');
$phpmailer = new PHPMailer();
}
-
+
$mail = compact('to', 'subject', 'message', 'headers');
$mail = apply_filters('wp_mail', $mail);
extract($mail);
diff --git a/wp-includes/plugin.php b/wp-includes/plugin.php
index e06869f..61580e7 100644
--- a/wp-includes/plugin.php
+++ b/wp-includes/plugin.php
@@ -7,79 +7,50 @@
function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
global $wp_filter;
- // check that we don't already have the same filter at the same priority
- if ( isset($wp_filter[$tag]["$priority"]) ) {
- foreach ( $wp_filter[$tag]["$priority"] as $filter ) {
- // uncomment if we want to match function AND accepted_args
- // if ( $filter == array($function, $accepted_args) ) {
- if ( $filter['function'] == $function_to_add )
- return true;
- }
- }
-
- // So the format is wp_filter['tag']['array of priorities']['array of ['array (functions, accepted_args)]']
- $wp_filter[$tag]["$priority"][] = array('function'=>$function_to_add, 'accepted_args'=>$accepted_args);
+ // So the format is wp_filter['tag']['array of priorities']['array of functions serialized']['array of ['array (functions, accepted_args)]']
+ $wp_filter[$tag][$priority][serialize($function_to_add)] = array('function' => $function_to_add, 'accepted_args' => $accepted_args);
return true;
}
function apply_filters($tag, $string) {
global $wp_filter;
- $args = array();
- for ( $a = 2; $a < func_num_args(); $a++ )
- $args[] = func_get_arg($a);
-
merge_filters($tag);
if ( !isset($wp_filter[$tag]) )
return $string;
- foreach ( (array) $wp_filter[$tag] as $priority => $functions ) {
- if ( !is_null($functions) ) {
- foreach ( (array) $functions as $function ) {
- $function_name = $function['function'];
- $accepted_args = $function['accepted_args'];
- $the_args = $args;
- array_unshift($the_args, $string);
- if ( $accepted_args > 0 )
- $the_args = array_slice($the_args, 0, $accepted_args);
- elseif ( 0 == $accepted_args )
- $the_args = NULL;
- $string = call_user_func_array($function_name, $the_args);
+ $args = func_get_args();
+
+ do{
+ foreach( (array) current($wp_filter[$tag]) as $the_ )
+ if ( !is_null($the_['function']) ){
+ $args[1] = $string;
+ $string = call_user_func_array($the_['function'], array_slice($args, 1, (int) $the_['accepted_args']));
}
- }
- }
+
+ } while ( next($wp_filter[$tag]) );
+
return $string;
}
function merge_filters($tag) {
global $wp_filter;
- if ( isset($wp_filter['all']) ) {
- foreach ( (array) $wp_filter['all'] as $priority => $functions ) {
- if ( isset($wp_filter[$tag][$priority]) )
- $wp_filter[$tag][$priority] = array_merge($wp_filter['all'][$priority], $wp_filter[$tag][$priority]);
- else
- $wp_filter[$tag][$priority] = array_merge($wp_filter['all'][$priority], array());
- $wp_filter[$tag][$priority] = array_unique($wp_filter[$tag][$priority]);
- }
- }
- if ( isset($wp_filter[$tag]) )
- uksort( $wp_filter[$tag], "strnatcasecmp" );
+ if ( isset($wp_filter['all']) )
+ $wp_filter[$tag] = array_merge($wp_filter['all'], (array) $wp_filter[$tag]);
+
+ if ( isset($wp_filter[$tag]) ){
+ reset($wp_filter[$tag]);
+ uksort($wp_filter[$tag], "strnatcasecmp");
+ }
}
function remove_filter($tag, $function_to_remove, $priority = 10, $accepted_args = 1) {
global $wp_filter;
- // rebuild the list of filters
- if ( isset($wp_filter[$tag]["$priority"]) ) {
- $new_function_list = array();
- foreach ( (array) $wp_filter[$tag]["$priority"] as $filter ) {
- if ( $filter['function'] != $function_to_remove )
- $new_function_list[] = $filter;
- }
- $wp_filter[$tag]["$priority"] = $new_function_list;
- }
+ unset($GLOBALS['wp_filter'][$tag][$priority][serialize($function_to_remove)]);
+
return true;
}
@@ -107,23 +78,12 @@ function do_action($tag, $arg = '') {
if ( !isset($wp_filter[$tag]) )
return;
- foreach ( (array) $wp_filter[$tag] as $priority => $functions ) {
- if ( !is_null($functions) ) {
- foreach ( (array) $functions as $function ) {
- $function_name = $function['function'];
- $accepted_args = $function['accepted_args'];
+ do{
+ foreach( (array) current($wp_filter[$tag]) as $the_ )
+ if ( !is_null($the_['function']) )
+ call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
- if ( $accepted_args > 0 )
- $the_args = array_slice($args, 0, $accepted_args);
- elseif ( $accepted_args == 0 )
- $the_args = NULL;
- else
- $the_args = $args;
-
- call_user_func_array($function_name, $the_args);
- }
- }
- }
+ } while ( next($wp_filter[$tag]) );
if ( is_array($wp_actions) )
$wp_actions[] = $tag;
@@ -151,22 +111,13 @@ function do_action_ref_array($tag, $args) {
if ( !isset($wp_filter[$tag]) )
return;
- foreach ( (array) $wp_filter[$tag] as $priority => $functions ) {
- if ( !is_null($functions) ) {
- foreach ( (array) $functions as $function ) {
- $function_name = $function['function'];
- $accepted_args = $function['accepted_args'];
- if ( $accepted_args > 0 )
- $the_args = array_slice($args, 0, $accepted_args);
- elseif ( 0 == $accepted_args )
- $the_args = NULL;
- else
- $the_args = $args;
-
- call_user_func_array($function_name, $the_args);
- }
- }
- }
+ do{
+ foreach( (array) current($wp_filter[$tag]) as $the_ )
+ if ( !is_null($the_['function']) )
+ call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
+
+ } while ( next($wp_filter[$tag]) );
+
}
function remove_action($tag, $function_to_remove, $priority = 10, $accepted_args = 1) {
diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php
index efdc038..cfa56f8 100644
--- a/wp-includes/post-template.php
+++ b/wp-includes/post-template.php
@@ -101,7 +101,7 @@ function get_the_content($more_link_text = '(more...)', $stripteaser = 0, $more_
if ( ! empty($more_link_text) )
$output .= ' <a href="'. get_permalink() . "#more-$id\" class=\"more-link\">$more_link_text</a>";
}
-
+
}
if ( $preview ) // preview fix for javascript bug with foreign languages
$output = preg_replace('/\%u([0-9A-F]{4,4})/e', "'&#'.base_convert('\\1',16,10).';'", $output);
diff --git a/wp-includes/post.php b/wp-includes/post.php
index 391bd9d..4a9d69c 100644
--- a/wp-includes/post.php
+++ b/wp-includes/post.php
@@ -80,7 +80,7 @@ function get_extended($post) {
$main = $post;
$extended = '';
}
-
+
// Strip leading and trailing whitespace
$main = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $main);
$extended = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $extended);
@@ -557,7 +557,7 @@ function wp_insert_post($postarr = array()) {
if ( 'draft' != $post_status )
$post_date_gmt = get_gmt_from_date($post_date);
}
-
+
if ( 'publish' == $post_status ) {
$now = gmdate('Y-m-d H:i:59');
if ( mysql2date('U', $post_date_gmt) > mysql2date('U', $now) )
@@ -706,7 +706,7 @@ function wp_insert_post($postarr = array()) {
// Schedule publication.
if ( 'future' == $post_status )
wp_schedule_single_event(strtotime($post_date_gmt. ' GMT'), 'publish_future_post', array($post_ID));
-
+
do_action('save_post', $post_ID);
do_action('wp_insert_post', $post_ID);
@@ -1109,7 +1109,7 @@ function &get_pages($args = '') {
$author_query = '';
if (!empty($authors)) {
$post_authors = preg_split('/[\s,]+/',$authors);
-
+
if ( count($post_authors) ) {
foreach ( $post_authors as $post_author ) {
//Do we have an author id or an author login?
diff --git a/wp-includes/query.php b/wp-includes/query.php
index 05415aa..79b6ba1 100644
--- a/wp-includes/query.php
+++ b/wp-includes/query.php
@@ -200,7 +200,7 @@ function is_single ($post = '') {
function is_singular() {
global $wp_query;
- return $wp_query->is_singular;
+ return $wp_query->is_singular;
}
function is_time () {
@@ -285,7 +285,7 @@ class WP_Query {
var $current_post = -1;
var $in_the_loop = false;
var $post;
-
+
var $comments;
var $comment_count = 0;
var $current_comment = -1;
@@ -360,7 +360,7 @@ class WP_Query {
function parse_query_vars() {
$this->parse_query('');
}
-
+
function fill_query_vars($array) {
$keys = array(
'error'
@@ -395,7 +395,7 @@ class WP_Query {
if ( !isset($array[$key]))
$array[$key] = '';
}
-
+
return $array;
}
@@ -410,9 +410,9 @@ class WP_Query {
$this->query = $query;
$this->query_vars = $qv;
}
-
+
$qv = $this->fill_query_vars($qv);
-
+
if ( ! empty($qv['robots']) ) {
$this->is_robots = true;
return;
@@ -561,21 +561,56 @@ class WP_Query {
$this->is_admin = true;
}
- if ( $this->is_single || $this->is_page || $this->is_attachment )
- $this->is_singular = true;
-
if ( false !== strpos($qv['feed'], 'comments-') ) {
$this->query_vars['feed'] = $qv['feed'] = str_replace('comments-', '', $qv['feed']);
$qv['withcomments'] = 1;
}
- if ( $this->is_feed && (!empty($qv['withcomments']) || ( empty($qv['withoutcomments']) && $this->is_singular ) ) )
+ $this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;
+
+ if ( $this->is_feed && ( !empty($qv['withcomments']) || ( empty($qv['withoutcomments']) && $this->is_singular ) ) )
$this->is_comment_feed = true;
- if ( ! ($this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup)) {
+ if ( !( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup ) ) {
$this->is_home = true;
}
+ // Correct is_* for page_on_front and page_for_posts
+ if ( $this->is_home && ( empty($this->query) || $qv['preview'] == 'true' ) && 'page' == get_option('show_on_front') && get_option('page_on_front') ) {
+ $this->is_page = true;
+ $this->is_home = false;
+ $this->query_vars['page_id'] = get_option('page_on_front');
+ }
+
+ if ( '' != $qv['pagename'] ) {
+ $this->queried_object =& get_page_by_path($qv['pagename']);
+ if ( !empty($this->queried_object) )
+ $this->queried_object_id = $this->queried_object->ID;
+ else
+ unset($this->queried_object);
+
+ if ( 'page' == get_option('show_on_front') && isset($this->queried_object_id) && $this->queried_object_id == get_option('page_for_posts') ) {
+ $this->is_page = false;
+ $this->is_home = true;
+ $this->is_posts_page = true;
+ }
+ }
+
+ if ( '' != $qv['page_id'] && 0 != intval($qv['page_id']) ) {
+ $this->query_vars['page_id'] = intval($qv['page_id']);
+ if ( 'page' == get_option('show_on_front') && $qv['page_id'] == get_option('page_for_posts') ) {
+ $this->is_page = false;
+ $this->is_home = true;
+ $this->is_posts_page = true;
+ }
+ }
+
+ if ( $this->is_posts_page && !$qv['withcomments'] )
+ $this->is_comment_feed = false;
+
+ $this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;
+ // Done correcting is_* for page_on_front and page_for_posts
+
if ( !empty($query) ) {
do_action_ref_array('parse_query', array(&$this));
}
@@ -609,7 +644,7 @@ class WP_Query {
// Shorthand.
$q = &$this->query_vars;
-
+
$q = $this->fill_query_vars($q);
// First let's clear some variables
@@ -724,18 +759,17 @@ class WP_Query {
$q['name'] = sanitize_title($q['name']);
$where .= " AND post_name = '" . $q['name'] . "'";
} else if ('' != $q['pagename']) {
- $reqpage = get_page_by_path($q['pagename']);
- if ( !empty($reqpage) )
- $reqpage = $reqpage->ID;
- else
- $reqpage = 0;
+ if ( isset($this->queried_object_id) )
+ $reqpage = $this->queried_object_id;
+ else {
+ $reqpage = get_page_by_path($q['pagename']);
+ if ( !empty($reqpage) )
+ $reqpage = $reqpage->ID;
+ else
+ $reqpage = 0;
+ }
- if ( ('page' == get_option('show_on_front') ) && ( $reqpage == get_option('page_for_posts') ) ) {
- $this->is_singular = false;
- $this->is_page = false;
- $this->is_home = true;
- $this->is_posts_page = true;
- } else {
+ if ( ('page' != get_option('show_on_front') ) || ( $reqpage != get_option('page_for_posts') ) ) {
$q['pagename'] = str_replace('%2F', '/', urlencode(urldecode($q['pagename'])));
$page_paths = '/' . trim($q['pagename'], '/');
$q['pagename'] = sanitize_title(basename($page_paths));
@@ -770,12 +804,7 @@ class WP_Query {
if (($q['page_id'] != '') && (intval($q['page_id']) != 0)) {
$q['page_id'] = intval($q['page_id']);
- if ( ('page' == get_option('show_on_front') ) && ( $q['page_id'] == get_option('page_for_posts') ) ) {
- $this->is_singular = false;
- $this->is_page = false;
- $this->is_home = true;
- $this->is_posts_page = true;
- } else {
+ if ( ('page' != get_option('show_on_front') ) || ( $q['page_id'] != get_option('page_for_posts') ) ) {
$q['p'] = $q['page_id'];
$where = ' AND ID = '.$q['page_id'];
}
@@ -1001,7 +1030,7 @@ class WP_Query {
$limits = 'LIMIT ' . $pgstrt . $q['posts_per_page'];
}
}
-
+
// Comments feeds
if ( $this->is_comment_feed && ( $this->is_archive || $this->is_search || !$this->is_singular ) ) {
if ( $this->is_archive || $this->is_search ) {
@@ -1013,19 +1042,19 @@ class WP_Query {
$cwhere = "WHERE post_status = 'publish' AND comment_approved = '1'";
$cgroupby = '';
}
-
+
$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_settings('posts_per_rss'));
$this->comment_count = count($this->comments);
$post_ids = array();
-
+
foreach ($this->comments as $comment)
$post_ids[] = (int) $comment->comment_post_ID;
-
+
$post_ids = join(',', $post_ids);
$join = '';
if ( $post_ids )
@@ -1061,14 +1090,14 @@ class WP_Query {
$this->comments = $wpdb->get_results($comments_request);
$this->comment_count = count($this->comments);
}
-
+
if ( !empty($limits) ) {
$found_posts_query = apply_filters( 'found_posts_query', 'SELECT FOUND_ROWS()' );
$this->found_posts = $wpdb->get_var( $found_posts_query );
$this->found_posts = apply_filters( 'found_posts', $this->found_posts );
$this->max_num_pages = ceil($this->found_posts / $q['posts_per_page']);
}
-
+
// Check post status to determine if post should be displayed.
if ( !empty($this->posts) && ($this->is_single || $this->is_page) ) {
$status = get_post_status($this->posts[0]);
@@ -1148,34 +1177,34 @@ class WP_Query {
$this->post = $this->posts[0];
}
}
-
+
function next_comment() {
$this->current_comment++;
-
+
$this->comment = $this->comments[$this->current_comment];
return $this->comment;
}
-
+
function the_comment() {
global $comment;
-
+
$comment = $this->next_comment();
-
+
if ($this->current_comment == 0) {
do_action('comment_loop_start');
}
}
-
+
function have_comments() {
if ($this->current_comment + 1 < $this->comment_count) {
return true;
} elseif ($this->current_comment + 1 == $this->comment_count) {
$this->rewind_comments();
}
-
+
return false;
}
-
+
function rewind_comments() {
$this->current_comment = -1;
if ($this->comment_count > 0) {
diff --git a/wp-includes/theme.php b/wp-includes/theme.php
index 8c60a9c..633412c 100644
--- a/wp-includes/theme.php
+++ b/wp-includes/theme.php
@@ -186,7 +186,7 @@ function get_themes() {
if ( !file_exists("$theme_root/$template/index.php") ) {
$parent_dir = dirname(dirname($theme_file));
if ( file_exists("$theme_root/$parent_dir/$template/index.php") ) {
- $template = "$parent_dir/$template";
+ $template = "$parent_dir/$template";
} else {
$wp_broken_themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => __('Template is missing.'));
continue;
@@ -484,7 +484,7 @@ function get_header_textcolor() {
}
function header_textcolor() {
- echo get_header_textcolor();
+ echo get_header_textcolor();
}
function get_header_image() {
@@ -492,7 +492,7 @@ function get_header_image() {
}
function header_image() {
- echo get_header_image();
+ echo get_header_image();
}
function add_custom_image_header($header_callback, $admin_header_callback) {
diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php
index 233b569..98ae962 100644
--- a/wp-includes/wp-db.php
+++ b/wp-includes/wp-db.php
@@ -50,7 +50,7 @@ class wpdb {
$this->db_connect();
return $this->__construct($dbuser, $dbpassword, $dbname, $dbhost);
}
-
+
function __construct($dbuser, $dbpassword, $dbname, $dbhost) {
register_shutdown_function(array(&$this, "__destruct"));
@@ -81,7 +81,7 @@ class wpdb {
}
function __destruct() {
- return true;
+ return true;
}
/**
@@ -320,7 +320,7 @@ class wpdb {
$this->func_call = "\$db->get_row(\"$query\",$output,$y)";
if ( $query )
$this->query($query);
-
+
if ( !isset($this->last_result[$y]) )
return null;