diff options
37 files changed, 287 insertions, 309 deletions
@@ -23,7 +23,7 @@ if ($use_querystring) { $eid = (int) $_GET['eid']; $_SERVER['PATH_INFO'] = $action; - + if ($eid) { $_SERVER['PATH_INFO'] .= "/$eid"; } @@ -173,7 +173,7 @@ class AtomParser { } else if($tag == 'category') { array_push($this->entry->categories, $attrs); } - + $this->ns_decls = array(); } @@ -201,7 +201,7 @@ class AtomParser { } array_shift($this->ns_contexts); - + #print str_repeat(" ", $this->depth * $this->indent) . "end_element('$name')" ."\n"; $this->depth--; @@ -342,7 +342,7 @@ class AtomServer { exit(); } else { // only allow what we have handlers for... - $this->not_allowed(array_keys($funcs)); + $this->not_allowed(array_keys($funcs)); } } } @@ -453,7 +453,7 @@ EOD; } function put_post($postID) { - + // checked for valid content-types (atom+xml) // quick check and exit $this->get_accepted_content_type($this->atom_content_types); @@ -508,9 +508,9 @@ EOD; if(!current_user_can('edit_post', $postID)) { $this->auth_required('Sorry, you do not have the right to delete this post.'); } - + if ($entry['post_type'] == 'attachment') { - $this->delete_attachment($postID); + $this->delete_attachment($postID); } else { $result = wp_delete_post($postID); @@ -523,7 +523,7 @@ EOD; } } - + function get_attachment($postID = NULL) { global $entry; @@ -551,7 +551,7 @@ EOD; $bits .= fread($fp, 4096); } fclose($fp); - + $slug = ''; if ( isset( $_SERVER['HTTP_SLUG'] ) ) $slug = sanitize_file_name( $_SERVER['HTTP_SLUG'] ); @@ -564,7 +564,7 @@ EOD; $file = wp_upload_bits( $slug, NULL, $bits); log_app('wp_upload_bits returns:',print_r($file,true)); - + $url = $file['url']; $file = $file['file']; $filename = basename($file); @@ -718,7 +718,7 @@ EOD; } fclose($fp); fclose($localfp); - + log_app('function',"put_file($postID)"); $this->ok(); } @@ -760,7 +760,7 @@ EOD; $url = $this->get_categories_url(); echo $url; } - + function get_attachments_url($page = NULL) { global $use_querystring; $url = get_bloginfo('url') . '/' . $this->script_name; @@ -790,7 +790,7 @@ EOD; global $post; $postID = $GLOBALS['post']->ID; } - + if ($use_querystring) { $url = get_bloginfo('url') . '/' . $this->script_name . '?action=/' . $this->ENTRY_PATH . "&eid=$postID"; } else { @@ -812,7 +812,7 @@ EOD; global $post; $postID = $GLOBALS['post']->ID; } - + if ($use_querystring) { $url = get_bloginfo('url') . '/' . $this->script_name . '?action=/' . $this->MEDIA_SINGLE_PATH ."&eid=$postID"; } else { @@ -873,8 +873,8 @@ EOD; $page = 1; } $page = (int) $page; - - $count = get_option('posts_per_rss'); + + $count = get_option('posts_per_rss'); $query = "paged=$page&posts_per_page=$count&order=DESC"; if($post_type == 'attachment') { $query .= "&post_type=$post_type"; @@ -887,7 +887,7 @@ EOD; $wpdb = $GLOBALS['wpdb']; $blog_id = $GLOBALS['blog_id']; $post_cache = $GLOBALS['post_cache']; - + $total_count = $this->get_posts_count(); $last_page = (int) ceil($total_count / $count); @@ -1056,7 +1056,7 @@ $post = $GLOBALS['post']; header('Content-Type: text/plain'); exit; } - + function not_found() { log_app('Status','404: Not Found'); header('Content-Type: text/plain'); @@ -1077,7 +1077,7 @@ $post = $GLOBALS['post']; status_header('400'); exit; } - + function created($post_ID, $content, $post_type = 'post') { global $use_querystring; log_app('created()::$post_ID',"$post_ID, $post_type"); @@ -1151,7 +1151,7 @@ $post = $GLOBALS['post']; function authenticate() { $login_data = array(); $already_md5 = false; - + log_app("authenticate()",print_r($_ENV, true)); // if using mod_rewrite/ENV hack @@ -1209,7 +1209,7 @@ $post = $GLOBALS['post']; function process_conditionals() { - + if(empty($this->params)) return; if($_SERVER['REQUEST_METHOD'] == 'DELETE') return; @@ -1240,7 +1240,7 @@ $post = $GLOBALS['post']; // If string is empty, return 0. If not, attempt to parse into a timestamp $client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0; - // Make a timestamp for our most recent modification... + // Make a timestamp for our most recent modification... $wp_modified_timestamp = strtotime($wp_last_modified); if ( ($client_last_modified && $client_etag) ? diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index c7b51d5..d3103d8 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -226,8 +226,8 @@ case 'autosave' : // The name of this action is hardcoded in edit_post() $_POST['post_status'] = 'draft'; $_POST['post_category'] = explode(",", $_POST['catslist']); if($_POST['post_type'] == 'page' || empty($_POST['post_category'])) - unset($_POST['post_category']); - + unset($_POST['post_category']); + if($_POST['post_ID'] < 0) { $_POST['temp_ID'] = $_POST['post_ID']; $id = wp_write_post(); diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 583aca9..7e89d3b 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -681,7 +681,7 @@ function get_nested_categories( $default = 0, $parent = 0 ) { if ( count( $checked_categories ) == 0 ) { // No selected categories, strange $checked_categories[] = $default; - } + } } else { $checked_categories[] = $default; } @@ -741,7 +741,7 @@ function get_nested_link_categories( $default = 0, $parent = 0 ) { if ( count( $checked_categories ) == 0 ) { // No selected categories, strange $checked_categories[] = $default; - } + } } else { $checked_categories[] = $default; } @@ -788,7 +788,7 @@ function cat_rows( $parent = 0, $level = 0, $categories = 0 ) { } $output = ob_get_contents(); ob_end_clean(); - + $output = apply_filters('cat_rows', $output); echo $output; @@ -1329,7 +1329,7 @@ function user_can_access_admin_page() { if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$parent][$plugin_page] ) ) return false; - + if ( empty( $parent) ) { if ( isset( $_wp_menu_nopriv[$pagenow] ) ) return false; @@ -1341,7 +1341,7 @@ function user_can_access_admin_page() { if ( isset( $_wp_submenu_nopriv[$key][$pagenow] ) ) return false; if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$key][$plugin_page] ) ) - return false; + return false; } return true; } @@ -1463,14 +1463,14 @@ function get_admin_page_parent() { if ( isset( $_wp_real_parent_file[$parent_file] ) ) $parent_file = $_wp_real_parent_file[$parent_file]; return $parent_file; - } + } } if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) ) { $parent_file = $pagenow; if ( isset( $_wp_real_parent_file[$parent_file] ) ) $parent_file = $_wp_real_parent_file[$parent_file]; - return $parent_file; + return $parent_file; } foreach (array_keys( $submenu ) as $parent) { @@ -1910,7 +1910,7 @@ function wp_handle_upload( &$file, $overrides = false ) { // Compute the URL $url = $uploads['url'] . "/$filename"; - + $return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) ); return $return; @@ -2069,7 +2069,7 @@ function update_home_siteurl( $old_value, $value ) { // Clear cookies for old paths. wp_clearcookie(); // Set cookies for new paths. - wp_setcookie( $user_login, $user_pass_md5, true, get_option( 'home' ), get_option( 'siteurl' )); + wp_setcookie( $user_login, $user_pass_md5, true, get_option( 'home' ), get_option( 'siteurl' )); } add_action( 'update_option_home', 'update_home_siteurl', 10, 2 ); diff --git a/wp-admin/custom-header.php b/wp-admin/custom-header.php index 4db9f71..1b913c2 100644 --- a/wp-admin/custom-header.php +++ b/wp-admin/custom-header.php @@ -17,7 +17,7 @@ class Custom_Image_Header { function js_includes() { wp_enqueue_script('cropper'); - wp_enqueue_script('colorpicker'); + wp_enqueue_script('colorpicker'); } function js() { @@ -115,7 +115,7 @@ class Custom_Image_Header { function colorDefault() { pickColor('<?php echo HEADER_TEXTCOLOR; ?>'); } - + function hide_text() { $('name').style.display = 'none'; $('desc').style.display = 'none'; @@ -126,7 +126,7 @@ class Custom_Image_Header { // $('hidetext').onclick = 'show_text()'; Event.observe( $('hidetext'), 'click', show_text ); } - + function show_text() { $('name').style.display = 'block'; $('desc').style.display = 'block'; @@ -134,7 +134,7 @@ class Custom_Image_Header { $('defaultcolor').style.display = 'inline'; $('textcolor').value = '<?php echo HEADER_TEXTCOLOR; ?>'; $('hidetext').value = '<?php _e('Hide Text'); ?>'; - Event.stopObserving( $('hidetext'), 'click', show_text ); + Event.stopObserving( $('hidetext'), 'click', show_text ); Event.observe( $('hidetext'), 'click', hide_text ); } diff --git a/wp-admin/import/blogger.php b/wp-admin/import/blogger.php index b5c1169..2908bbc 100644 --- a/wp-admin/import/blogger.php +++ b/wp-admin/import/blogger.php @@ -55,7 +55,7 @@ class Blogger_Import { return false;
}
$this->token = $matches[1];
-
+
wp_redirect( remove_query_arg( array( 'token', 'noheader' ) ) );
}
@@ -369,9 +369,9 @@ class Blogger_Import { $sock = $this->_get_blogger_sock( $blog['host'] );
if ( ! $sock ) return; // TODO: Error handling
$response = $this->_txrx( $sock, $request );
-
+
$response = $this->parse_response( $response );
-
+
// Extract the entries and send for insertion
preg_match_all( '/<entry[^>]*>.*?<\/entry>/s', $response['body'], $matches );
if ( count( $matches[0] ) ) {
@@ -437,7 +437,7 @@ class Blogger_Import { foreach ( $entries as $entry ) {
$entry = "<feed>$entry</feed>";
$AtomParser = new AtomParser();
- $AtomParser->parse( $entry );
+ $AtomParser->parse( $entry );
$this->import_comment($AtomParser->entry);
unset($AtomParser);
}
@@ -623,7 +623,7 @@ class Blogger_Import { $sel = ( $user->user_id == $current ) ? " selected='selected'" : '';
$options .= "<option value='$user->user_id'$sel>$user->display_name</option>";
}
-
+
return $options;
}
@@ -706,7 +706,7 @@ class Blogger_Import { function restart() {
global $wpdb;
$options = get_option( 'blogger_importer' );
-
+
if ( isset( $options['token'] ) )
$this->revoke( $options['token'] );
@@ -922,7 +922,7 @@ class AtomParser { } else if($tag == 'category') {
array_push($this->entry->categories, $attrs['term']);
}
-
+
$this->ns_decls = array();
}
@@ -950,7 +950,7 @@ class AtomParser { }
array_shift($this->ns_contexts);
-
+
#print str_repeat(" ", $this->depth * $this->indent) . "end_element('$name')" ."\n";
$this->depth--;
diff --git a/wp-admin/import/greymatter.php b/wp-admin/import/greymatter.php index 7332937..9203ff7 100644 --- a/wp-admin/import/greymatter.php +++ b/wp-admin/import/greymatter.php @@ -91,7 +91,7 @@ class GM_Import { if (!chdir($gmpath)) wp_die(sprintf(__("Wrong path, %s\ndoesn't exist\non the server"), $gmpath)); - + $this->header(); ?> <p><?php _e('The importer is running...') ?></p> @@ -128,7 +128,7 @@ class GM_Import { $user_info = array("user_login"=>"$user_login", "user_pass"=>"$pass1", "user_nickname"=>"$user_nickname", "user_email"=>"$user_email", "user_url"=>"$user_url", "user_ip"=>"$user_ip", "user_domain"=>"$user_domain", "user_browser"=>"$user_browser", "dateYMDhour"=>"$user_joindate", "user_level"=>"1", "user_idmode"=>"nickname"); $user_id = wp_insert_user($user_info); $this->gmnames[$userdata[0]] = $user_id; - + printf('<li>'.__('user %s...').' <strong>'.__('Done').'</strong></li>', "<em>$user_login</em>"); } @@ -213,21 +213,21 @@ class GM_Import { $user_email=$wpdb->escape("user@deleted.com"); $user_url=$wpdb->escape(""); $user_joindate=$wpdb->escape($user_joindate); - + $user_info = array("user_login"=>$user_login, "user_pass"=>$pass1, "user_nickname"=>$user_nickname, "user_email"=>$user_email, "user_url"=>$user_url, "user_ip"=>$user_ip, "user_domain"=>$user_domain, "user_browser"=>$user_browser, "dateYMDhour"=>$user_joindate, "user_level"=>0, "user_idmode"=>"nickname"); $user_id = wp_insert_user($user_info); $this->gmnames[$postinfo[1]] = $user_id; - + echo ': '; printf(__('registered deleted user %s at level 0 '), "<em>$user_login</em>"); } - + if (array_key_exists($postinfo[1], $this->gmnames)) { $post_author = $this->gmnames[$postinfo[1]]; } else { $post_author = $user_id; } - + $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_excerpt', 'post_status', 'comment_status', 'ping_status', 'post_modified', 'post_modified_gmt'); $post_ID = wp_insert_post($postdata); } @@ -309,5 +309,5 @@ class GM_Import { $gm_import = new GM_Import(); -register_importer('greymatter', __('Greymatter'), __('Import posts and comments from your Greymatter blog'), array ($gm_import, 'dispatch')); +register_importer('greymatter', __('GreyMatter'), __('Import users, posts, and comments from a Greymatter blog'), array ($gm_import, 'dispatch')); ?> diff --git a/wp-admin/link-import.php b/wp-admin/link-import.php index 6484dbb..f1f971d 100644 --- a/wp-admin/link-import.php +++ b/wp-admin/link-import.php @@ -12,16 +12,16 @@ if (!$step) $step = 0; ?> <?php switch ($step) { - case 0: - { - include_once('admin-header.php'); - if ( !current_user_can('manage_links') ) - wp_die(__('Cheatin’ uh?')); + case 0: { + include_once('admin-header.php'); + if ( !current_user_can('manage_links') ) + wp_die(__('Cheatin’ uh?')); - $opmltype = 'blogrolling'; // default. + $opmltype = 'blogrolling'; // default. ?> <div class="wrap"> + <h2><?php _e('Import your blogroll from another system') ?> </h2> <form enctype="multipart/form-data" action="link-import.php" method="post" name="blogroll"> <?php wp_nonce_field('import-bookmarks') ?> @@ -40,7 +40,6 @@ switch ($step) { <input id="userfile" name="userfile" type="file" size="30" /> </div> - </div> <p style="clear: both; margin-top: 1em;"><?php _e('Now select a category you want to put these links in.') ?><br /> @@ -60,72 +59,71 @@ foreach ($categories as $category) { </div> <?php - break; - } // end case 0 + break; + } // end case 0 - case 1: { + case 1: { check_admin_referer('import-bookmarks'); - include_once('admin-header.php'); - if ( !current_user_can('manage_links') ) - wp_die(__('Cheatin’ uh?')); + include_once('admin-header.php'); + if ( !current_user_can('manage_links') ) + wp_die(__('Cheatin’ uh?')); ?> <div class="wrap"> - <h2><?php _e('Importing...') ?></h2> +<h2><?php _e('Importing...') ?></h2> <?php - $cat_id = $_POST['cat_id']; - if (($cat_id == '') || ($cat_id == 0)) { - $cat_id = 1; - } - - $opml_url = $_POST['opml_url']; - if (isset($opml_url) && $opml_url != '' && $opml_url != 'http://') { - $blogrolling = true; - } - else // try to get the upload file. - { - $overrides = array('test_form' => false, 'test_type' => false); - $file = wp_handle_upload($_FILES['userfile'], $overrides); - - if ( isset($file['error']) ) - wp_die($file['error']); - - $url = $file['url']; - $opml_url = $file['file']; - $blogrolling = false; - } - - if (isset($opml_url) && $opml_url != '') { - $opml = wp_remote_fopen($opml_url); - include_once('link-parse-opml.php'); - - $link_count = count($names); - for ($i = 0; $i < $link_count; $i++) { - if ('Last' == substr($titles[$i], 0, 4)) - $titles[$i] = ''; - if ('http' == substr($titles[$i], 0, 4)) - $titles[$i] = ''; - $link = array( 'link_url' => $urls[$i], 'link_name' => $wpdb->escape($names[$i]), 'link_category' => array($cat_id), 'link_description' => $wpdb->escape($descriptions[$i]), 'link_owner' => $user_ID, 'link_rss' => $feeds[$i]); - wp_insert_link($link); - echo sprintf('<p>'.__('Inserted <strong>%s</strong>').'</p>', $names[$i]); - } + $cat_id = $_POST['cat_id']; + if ( $cat_id == '' || $cat_id == 0 ) + $cat_id = 1; + + $opml_url = $_POST['opml_url']; + if ( isset($opml_url) && $opml_url != '' && $opml_url != 'http://' ) { + $blogrolling = true; + } else { // try to get the upload file. + $overrides = array('test_form' => false, 'test_type' => false); + $file = wp_handle_upload($_FILES['userfile'], $overrides); + + if ( isset($file['error']) ) + wp_die($file['error']); + + $url = $file['url']; + $opml_url = $file['file']; + $blogrolling = false; + } + + if ( isset($opml_url) && $opml_url != '' ) { + $opml = wp_remote_fopen($opml_url); + include_once('link-parse-opml.php'); + + $link_count = count($names); + for ( $i = 0; $i < $link_count; $i++ ) { + if ('Last' == substr($titles[$i], 0, 4)) + $titles[$i] = ''; + if ( 'http' == substr($titles[$i], 0, 4) ) + $titles[$i] = ''; + $link = array( 'link_url' => $urls[$i], 'link_name' => $wpdb->escape($names[$i]), 'link_category' => array($cat_id), 'link_description' => $wpdb->escape($descriptions[$i]), 'link_owner' => $user_ID, 'link_rss' => $feeds[$i]); + wp_insert_link($link); + echo sprintf('<p>'.__('Inserted <strong>%s</strong>').'</p>', $names[$i]); + } ?> - <p><?php printf(__('Inserted %1$d links into category %2$s. All done! Go <a href="%3$s">manage those links</a>.'), $link_count, $cat_id, 'link-manager.php') ?></p> + +<p><?php printf(__('Inserted %1$d links into category %2$s. All done! Go <a href="%3$s">manage those links</a>.'), $link_count, $cat_id, 'link-manager.php') ?></p> + <?php - } // end if got url - else - { - echo "<p>" . __("You need to supply your OPML url. Press back on your browser and try again") . "</p>\n"; - } // end else - - if ( ! $blogrolling ) - @unlink($opml_url); +} // end if got url +else +{ + echo "<p>" . __("You need to supply your OPML url. Press back on your browser and try again") . "</p>\n"; +} // end else + +if ( ! $blogrolling ) + @unlink($opml_url); ?> </div> <?php - break; - } // end case 1 + break; + } // end case 1 } // end switch include('admin-footer.php'); diff --git a/wp-admin/menu.php b/wp-admin/menu.php index 59265d8..8c67b4a 100644 --- a/wp-admin/menu.php +++ b/wp-admin/menu.php @@ -119,7 +119,7 @@ foreach ( $menu as $id => $data ) { if ( $new_parent != $old_parent ) { $_wp_real_parent_file[$old_parent] = $new_parent; $menu[$id][2] = $new_parent; - + foreach ($submenu[$old_parent] as $index => $data) { $submenu[$new_parent][$index] = $submenu[$old_parent][$index]; unset($submenu[$old_parent][$index]); diff --git a/wp-admin/options.php b/wp-admin/options.php index f502a7d..8dbd161 100644 --- a/wp-admin/options.php +++ b/wp-admin/options.php @@ -94,7 +94,7 @@ function sanitize_option($option, $value) { // Remember to call stripslashes! break; } - return $value; + return $value; } switch($action) { @@ -169,7 +169,7 @@ foreach ( (array) $options as $option) : if (stristr($value, "\n")) echo "<textarea class='$class' name='$option->option_name' id='$option->option_name' cols='30' rows='5'>$value</textarea>"; else echo "<input class='$class' type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . $value . "'$disabled />"; - + echo "</td> <td>$option->option_description</td> </tr>"; diff --git a/wp-admin/page.php b/wp-admin/page.php index c239809..d5bb932 100644 --- a/wp-admin/page.php +++ b/wp-admin/page.php @@ -108,7 +108,7 @@ case 'editpost': } if ( isset($_POST['save']) ) - $location = "page.php?action=edit&post=$page_ID"; + $location = "page.php?action=edit&post=$page_ID"; } else { if ($_POST['save']) { $location = "page.php?action=edit&post=$page_ID"; diff --git a/wp-admin/post.php b/wp-admin/post.php index 8f0cc53..163e220 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -47,7 +47,7 @@ case 'edit': $editing = true; $post_ID = $p = (int) $_GET['post']; $post = get_post($post_ID); - + if ( 'page' == $post->post_type ) { wp_redirect("page.php?action=edit&post=$post_ID"); exit(); @@ -119,7 +119,7 @@ case 'editpost': if ( !empty($_POST['referredby']) ) $referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']); $referer = preg_replace('|https?://[^/]+|i', '', wp_get_referer()); - + if ($_POST['save']) { $location = "post.php?action=edit&post=$post_ID"; } elseif ($_POST['updatemeta']) { diff --git a/wp-admin/upgrade-schema.php b/wp-admin/upgrade-schema.php index 0c070b4..12903eb 100644 --- a/wp-admin/upgrade-schema.php +++ b/wp-admin/upgrade-schema.php @@ -3,12 +3,12 @@ global $wp_queries; $charset_collate = ''; - + if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) { if ( ! empty($wpdb->charset) ) $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; if ( ! empty($wpdb->collate) ) - $charset_collate .= " COLLATE $wpdb->collate"; + $charset_collate .= " COLLATE $wpdb->collate"; } $wp_queries="CREATE TABLE $wpdb->categories ( diff --git a/wp-admin/upload-functions.php b/wp-admin/upload-functions.php index 2ba76cd..c2b5519 100644 --- a/wp-admin/upload-functions.php +++ b/wp-admin/upload-functions.php @@ -13,13 +13,13 @@ function wp_upload_display( $dims = false, $href = '' ) { } if ( isset($attachment_data['width']) ) list($width,$height) = wp_shrink_dimensions($attachment_data['width'], $attachment_data['height'], 171, 128); - + ob_start(); the_title(); $post_title = attribute_escape(ob_get_contents()); ob_end_clean(); $post_content = apply_filters( 'content_edit_pre', $post->post_content ); - + $class = 'text'; $innerHTML = get_attachment_innerHTML( $id, false, $dims ); if ( $image_src = get_attachment_icon_src() ) { @@ -285,7 +285,7 @@ function wp_upload_posts_where( $where ) { function wp_upload_tab_browse() { global $wpdb, $action, $paged; $old_vars = compact( 'paged' ); - + switch ( $action ) : case 'edit' : case 'view' : diff --git a/wp-admin/upload-js.php b/wp-admin/upload-js.php index 50db0ac..b406355 100644 --- a/wp-admin/upload-js.php +++ b/wp-admin/upload-js.php @@ -189,7 +189,7 @@ addLoadEvent( function() { new Insertion.Top('upload-content', h); if (e) Event.stop(e); - return false; + return false; }, prepView: function(id) { @@ -264,7 +264,7 @@ addLoadEvent( function() { } return false; } - + }; theFileList.initializeVars(); theFileList.initializeLinks(); 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('—', ' — ', '–', 'xn--', '…', '“', '’s', '”', ' ™'), $cockneyreplace); $dynamic_characters = array('/\'(\d\d(?:’|\')?s)/', '/(\s|\A|")\'/', '/(\d+)"/', '/(\d+)\'/', '/(\S)\'([^\'\s])/', '/(\s|\A)"(?!\s)/', '/"(\s|\S|\Z)/', '/\'([\s.]|\Z)/', '/(\d+)x(\d+)/'); - $dynamic_replacements = array('’$1','$1‘', '$1″', '$1′', '$1’$2', '$1“$2', '”$1', '’$1', '$1×$2'); + $dynamic_replacements = array('’$1','$1‘', '$1″', '$1′', '$1’$2', '$1“$2', '”$1', '’$1', '$1×$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 = ' ('.$arcresult->posts.')' . $afterafter; - echo get_archives_link($url, $text, $format, $before, $after); - } - } + $after = ' ('.$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&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; diff --git a/wp-login.php b/wp-login.php index c79ee5a..5429aff 100644 --- a/wp-login.php +++ b/wp-login.php @@ -97,7 +97,7 @@ case 'retrievepassword' : $errors['user_email'] = __('<strong>ERROR</strong>: The e-mail field is empty.'); do_action('lostpassword_post'); - + if ( empty( $errors ) ) { $user_data = get_userdatabylogin(trim($_POST['user_login'])); // redefining user_login ensures we return the right case in the email @@ -247,7 +247,7 @@ default: $errors['expiredsession'] = __('Your session has expired.'); } } - + if ( $_POST && empty( $user_login ) ) $errors['user_login'] = __('<strong>ERROR</strong>: The username field is empty.'); if ( $_POST && empty( $user_pass ) ) @@ -504,7 +504,7 @@ class wp_xmlrpc_server extends IXR_Server { if(empty($category["description"])) { $category["description"] = ""; } - + $new_category = array( "cat_name" => $category["name"], "category_nicename" => $category["slug"], |