Unused var fixes. Props DD32. see #8220

git-svn-id: http://svn.automattic.com/wordpress/trunk@9716 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-11-15 18:10:35 +00:00
parent 322baa914d
commit 40c754df1d
19 changed files with 25 additions and 37 deletions

View File

@ -160,7 +160,6 @@ if ( !empty( $post->post_password ) ) {
} elseif ( is_sticky( $post->ID ) ) { } elseif ( is_sticky( $post->ID ) ) {
$visibility = 'public'; $visibility = 'public';
$visibility_trans = __('Public, Sticky'); $visibility_trans = __('Public, Sticky');
$sticky = 'sticky';
} else { } else {
$visibility = 'public'; $visibility = 'public';
$visibility_trans = __('Public'); $visibility_trans = __('Public');

View File

@ -87,7 +87,7 @@ function link_submit_meta_box($link) {
<div id="delete-action"> <div id="delete-action">
<?php <?php
if ( !empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('manage_links') ) { ?> if ( !empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('manage_links') ) { ?>
<a class="submitdelete deletion" href="<?php echo wp_nonce_url("link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->link_id); ?>" onclick="if ( confirm('<?php echo js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete."), $link->link_name )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a> <a class="submitdelete deletion" href="<?php echo wp_nonce_url("link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->link_id); ?>" onclick="if ( confirm('<?php echo js_escape(sprintf(__("You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete."), $link->link_name )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>
<?php } ?> <?php } ?>
</div> </div>

View File

@ -522,7 +522,7 @@ class Blogger_Import {
} }
function import_post( $entry ) { function import_post( $entry ) {
global $wpdb, $importing_blog; global $importing_blog;
// The old permalink is all Blogger gives us to link comments to their posts. // The old permalink is all Blogger gives us to link comments to their posts.
if ( isset( $entry->draft ) ) if ( isset( $entry->draft ) )
@ -659,7 +659,7 @@ class Blogger_Import {
} }
function get_user_options($current) { function get_user_options($current) {
global $wpdb, $importer_users; global $importer_users;
if ( ! isset( $importer_users ) ) if ( ! isset( $importer_users ) )
$importer_users = (array) get_users_of_blog(); $importer_users = (array) get_users_of_blog();

View File

@ -55,7 +55,7 @@ class MT_Import {
} }
function users_form($n) { function users_form($n) {
global $wpdb, $testing; global $wpdb;
$users = $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY ID"); $users = $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY ID");
?><select name="userselect[<?php echo $n; ?>]"> ?><select name="userselect[<?php echo $n; ?>]">
<option value="#NONE#"><?php _e('- Select -') ?></option> <option value="#NONE#"><?php _e('- Select -') ?></option>
@ -101,7 +101,6 @@ class MT_Import {
//function to check the authorname and do the mapping //function to check the authorname and do the mapping
function checkauthor($author) { function checkauthor($author) {
global $wpdb;
//mtnames is an array with the names in the mt import file //mtnames is an array with the names in the mt import file
$pass = wp_generate_password(); $pass = wp_generate_password();
if (!(in_array($author, $this->mtnames))) { //a new mt author name is found if (!(in_array($author, $this->mtnames))) { //a new mt author name is found
@ -109,7 +108,7 @@ class MT_Import {
$this->mtnames[$this->j] = $author; //add that new mt author name to an array $this->mtnames[$this->j] = $author; //add that new mt author name to an array
$user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user $user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user
if (!$user_id) { //banging my head against the desk now. if (!$user_id) { //banging my head against the desk now.
if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname if ($this->newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname
$user_id = wp_create_user($author, $pass); $user_id = wp_create_user($author, $pass);
$this->newauthornames[$this->j] = $author; //now we have a name, in the place of left_blank. $this->newauthornames[$this->j] = $author; //now we have a name, in the place of left_blank.
} else { } else {

View File

@ -353,7 +353,6 @@ function wp_dashboard_quick_press() {
} }
function wp_dashboard_recent_drafts( $drafts = false ) { function wp_dashboard_recent_drafts( $drafts = false ) {
global $post;
if ( !$drafts ) { if ( !$drafts ) {
$drafts_query = new WP_Query( array( $drafts_query = new WP_Query( array(
'post_type' => 'post', 'post_type' => 'post',

View File

@ -330,6 +330,9 @@ function wp_handle_sideload( &$file, $overrides = false ) {
// You may define your own function and pass the name in $overrides['upload_error_handler'] // You may define your own function and pass the name in $overrides['upload_error_handler']
$upload_error_handler = 'wp_handle_upload_error'; $upload_error_handler = 'wp_handle_upload_error';
// You may define your own function and pass the name in $overrides['unique_filename_callback']
$unique_filename_callback = null;
// $_POST['action'] must be set and its value must equal $overrides['action'] or this: // $_POST['action'] must be set and its value must equal $overrides['action'] or this:
$action = 'wp_handle_sideload'; $action = 'wp_handle_sideload';

View File

@ -262,7 +262,7 @@ function media_handle_sideload($file_array, $post_id, $desc = null, $post_data =
), $post_data ); ), $post_data );
// Save the data // Save the data
$id = wp_insert_attachment($attachment, $file, $post_parent); $id = wp_insert_attachment($attachment, $file, $post_id);
if ( !is_wp_error($id) ) { if ( !is_wp_error($id) ) {
wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
return $url; return $url;
@ -905,8 +905,6 @@ function get_attachment_fields_to_edit($post, $errors = null) {
$post = (object) $post; $post = (object) $post;
$edit_post = sanitize_post($post, 'edit'); $edit_post = sanitize_post($post, 'edit');
$file = wp_get_attachment_url($post->ID);
$link = get_attachment_link($post->ID);
$form_fields = array( $form_fields = array(
'post_title' => array( 'post_title' => array(
@ -1019,10 +1017,6 @@ function get_media_item( $attachment_id, $args = null ) {
else else
return false; return false;
$title_label = __('Title');
$description_label = __('Description');
$tags_label = __('Tags');
$toggle_on = __('Show'); $toggle_on = __('Show');
$toggle_off = __('Hide'); $toggle_off = __('Hide');
@ -1030,7 +1024,7 @@ function get_media_item( $attachment_id, $args = null ) {
$filename = basename($post->guid); $filename = basename($post->guid);
$title = attribute_escape($post->post_title); $title = attribute_escape($post->post_title);
$description = attribute_escape($post->post_content);
if ( $_tags = get_the_tags($attachment_id) ) { if ( $_tags = get_the_tags($attachment_id) ) {
foreach ( $_tags as $tag ) foreach ( $_tags as $tag )
$tags[] = $tag->name; $tags[] = $tag->name;

View File

@ -27,7 +27,6 @@
* @return mixed * @return mixed
*/ */
function plugins_api($action, $args = null) { function plugins_api($action, $args = null) {
global $wp_version;
if( is_array($args) ) if( is_array($args) )
$args = (object)$args; $args = (object)$args;
@ -247,8 +246,6 @@ function install_updated($page = 1) {
* @param int $totalpages Number of pages. * @param int $totalpages Number of pages.
*/ */
function display_plugins_table($plugins, $page = 1, $totalpages = 1){ function display_plugins_table($plugins, $page = 1, $totalpages = 1){
global $tab;
$type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : ''; $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
$term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : ''; $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
@ -674,7 +671,7 @@ function do_plugin_install_local_package($package, $filename = '') {
$install_actions = apply_filters('install_plugin_complete_actions', array( $install_actions = apply_filters('install_plugin_complete_actions', array(
'activate_plugin' => '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" target="_parent">' . __('Activate Plugin') . '</a>', 'activate_plugin' => '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" target="_parent">' . __('Activate Plugin') . '</a>',
'plugins_page' => '<a href="' . admin_url('plugins.php') . '" title="' . __('Goto plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>' 'plugins_page' => '<a href="' . admin_url('plugins.php') . '" title="' . __('Goto plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>'
), $plugin_information, $plugin_file); ), array(), $plugin_file);
if ( ! empty($install_actions) ) if ( ! empty($install_actions) )
show_message('<strong>' . __('Actions:') . '</strong> ' . implode(' | ', (array)$install_actions)); show_message('<strong>' . __('Actions:') . '</strong> ' . implode(' | ', (array)$install_actions));
} }

View File

@ -769,7 +769,6 @@ function get_available_post_statuses($type = 'post') {
* @return unknown * @return unknown
*/ */
function wp_edit_posts_query( $q = false ) { function wp_edit_posts_query( $q = false ) {
global $wpdb;
if ( false === $q ) if ( false === $q )
$q = $_GET; $q = $_GET;
$q['m'] = isset($q['m']) ? (int) $q['m'] : 0; $q['m'] = isset($q['m']) ? (int) $q['m'] : 0;
@ -832,7 +831,6 @@ function get_available_post_mime_types($type = 'attachment') {
* @return unknown * @return unknown
*/ */
function wp_edit_attachments_query( $q = false ) { function wp_edit_attachments_query( $q = false ) {
global $wpdb;
if ( false === $q ) if ( false === $q )
$q = $_GET; $q = $_GET;

View File

@ -207,7 +207,7 @@ function inline_edit_term_row($type) {
$columns = $is_tag ? get_column_headers('tag') : get_column_headers('category'); $columns = $is_tag ? get_column_headers('tag') : get_column_headers('category');
$hidden = array_intersect( array_keys( $columns ), array_filter( (array) get_user_option( "manage-$type-columns-hidden" ) ) ); $hidden = array_intersect( array_keys( $columns ), array_filter( (array) get_user_option( "manage-$type-columns-hidden" ) ) );
$col_count = count($columns) - count($hidden); $col_count = count($columns) - count($hidden);
$output = ''; ?> ?>
<form method="get" action=""><table style="display: none"><tbody id="inlineedit"> <form method="get" action=""><table style="display: none"><tbody id="inlineedit">
<tr id="inline-edit" class="inline-edit-row" style="display: none"><td colspan="<?php echo $col_count; ?>"> <tr id="inline-edit" class="inline-edit-row" style="display: none"><td colspan="<?php echo $col_count; ?>">
@ -659,7 +659,6 @@ function tag_rows( $page = 1, $pagesize = 20, $searchterms = '' ) {
// convert it to table rows // convert it to table rows
$out = ''; $out = '';
$class = '';
$count = 0; $count = 0;
foreach( $tags as $tag ) foreach( $tags as $tag )
$out .= _tag_row( $tag, ++$count % 2 ? ' class="iedit alternate"' : ' class="iedit"' ); $out .= _tag_row( $tag, ++$count % 2 ? ' class="iedit alternate"' : ' class="iedit"' );
@ -1879,7 +1878,6 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
global $comment, $post; global $comment, $post;
$comment = get_comment( $comment_id ); $comment = get_comment( $comment_id );
$post = get_post($comment->comment_post_ID); $post = get_post($comment->comment_post_ID);
$authordata = get_userdata($post->post_author);
$the_comment_status = wp_get_comment_status($comment->comment_ID); $the_comment_status = wp_get_comment_status($comment->comment_ID);
if ( current_user_can( 'edit_post', $post->ID ) ) { if ( current_user_can( 'edit_post', $post->ID ) ) {

View File

@ -22,6 +22,8 @@ wp_reset_vars(array('action'));
* @param int $page_ID Page ID. * @param int $page_ID Page ID.
*/ */
function redirect_page($page_ID) { function redirect_page($page_ID) {
global $action;
$referredby = ''; $referredby = '';
if ( !empty($_POST['referredby']) ) { if ( !empty($_POST['referredby']) ) {
$referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']); $referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']);

View File

@ -29,7 +29,7 @@ function get_bookmark($bookmark, $output = OBJECT, $filter = 'raw') {
wp_cache_add($bookmark->link_id, $bookmark, 'bookmark'); wp_cache_add($bookmark->link_id, $bookmark, 'bookmark');
$_bookmark = $bookmark; $_bookmark = $bookmark;
} else { } else {
if ( isset($GLOBALS['link']) && ($GLOBALS['link']->link_id == $link) ) { if ( isset($GLOBALS['link']) && ($GLOBALS['link']->link_id == $bookmark) ) {
$_bookmark = & $GLOBALS['link']; $_bookmark = & $GLOBALS['link'];
} elseif ( ! $_bookmark = wp_cache_get($bookmark, 'bookmark') ) { } elseif ( ! $_bookmark = wp_cache_get($bookmark, 'bookmark') ) {
$_bookmark = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->links WHERE link_id = %d LIMIT 1", $bookmark)); $_bookmark = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->links WHERE link_id = %d LIMIT 1", $bookmark));

View File

@ -158,7 +158,6 @@ function wp_next_scheduled( $hook, $args = array() ) {
* @return null Cron could not be spawned, because it is not needed to run. * @return null Cron could not be spawned, because it is not needed to run.
*/ */
function spawn_cron( $local_time ) { function spawn_cron( $local_time ) {
global $current_blog;
/* /*
* do not even start the cron if local server timer has drifted * do not even start the cron if local server timer has drifted

View File

@ -411,7 +411,7 @@ class WP_Http {
$length = hexdec( $match[1] ); $length = hexdec( $match[1] );
$chunkLength = strlen( $match[0] ); $chunkLength = strlen( $match[0] );
$strBody = substr($body, strlen( $match[0] ), $length); $strBody = substr($body, $chunkLength, $length);
$parsedBody .= $strBody; $parsedBody .= $strBody;
$body = ltrim(str_replace(array($match[0], $strBody), '', $body), "\n"); $body = ltrim(str_replace(array($match[0], $strBody), '', $body), "\n");

View File

@ -1512,9 +1512,7 @@ function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) {
$default = $avatar_default; $default = $avatar_default;
} }
if ( 'custom' == $default ) if ( 'mystery' == $default )
$default = add_query_arg( 's', $size, $defaults[$avatar_default][1] );
elseif ( 'mystery' == $default )
$default = "http://www.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s={$size}"; // ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com') $default = "http://www.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s={$size}"; // ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com')
elseif ( 'blank' == $default ) elseif ( 'blank' == $default )
$default = includes_url('images/blank.gif'); $default = includes_url('images/blank.gif');
@ -1524,6 +1522,8 @@ function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) {
$default = "http://www.gravatar.com/avatar/s={$size}"; $default = "http://www.gravatar.com/avatar/s={$size}";
elseif ( empty($email) ) elseif ( empty($email) )
$default = "http://www.gravatar.com/avatar/?d=$default&amp;s={$size}"; $default = "http://www.gravatar.com/avatar/?d=$default&amp;s={$size}";
else
$default = add_query_arg( 's', $size, $default );
if ( !empty($email) ) { if ( !empty($email) ) {
$out = 'http://www.gravatar.com/avatar/'; $out = 'http://www.gravatar.com/avatar/';

View File

@ -123,7 +123,7 @@ function has_filter($tag, $function_to_check = false) {
* @subpackage Plugin * @subpackage Plugin
* @since 0.71 * @since 0.71
* @global array $wp_filter Stores all of the filters * @global array $wp_filter Stores all of the filters
* @global array $merge_filters Merges the filter hooks using this function. * @global array $merged_filters Merges the filter hooks using this function.
* @global array $wp_current_filter stores the list of current filters with the current one last * @global array $wp_current_filter stores the list of current filters with the current one last
* *
* @param string $tag The name of the filter hook. * @param string $tag The name of the filter hook.
@ -219,7 +219,7 @@ function remove_filter($tag, $function_to_remove, $priority = 10, $accepted_args
* @return bool True when finished. * @return bool True when finished.
*/ */
function remove_all_filters($tag, $priority = false) { function remove_all_filters($tag, $priority = false) {
global $wp_filter, $merge_filters; global $wp_filter, $merged_filters;
if( isset($wp_filter[$tag]) ) { if( isset($wp_filter[$tag]) ) {
if( false !== $priority && isset($$wp_filter[$tag][$priority]) ) if( false !== $priority && isset($$wp_filter[$tag][$priority]) )

View File

@ -2161,7 +2161,7 @@ function &get_pages($args = '') {
$pages = $wpdb->get_results($query); $pages = $wpdb->get_results($query);
if ( empty($pages) ) { if ( empty($pages) ) {
$page = apply_filters('get_pages', array(), $r); $pages = apply_filters('get_pages', array(), $r);
return $pages; return $pages;
} }
@ -3322,7 +3322,7 @@ function wp_save_post_revision( $post_id ) {
* @return object|bool The autosaved data or false on failure or when no autosave exists. * @return object|bool The autosaved data or false on failure or when no autosave exists.
*/ */
function wp_get_post_autosave( $post_id ) { function wp_get_post_autosave( $post_id ) {
global $wpdb;
if ( !$post = get_post( $post_id ) ) if ( !$post = get_post( $post_id ) )
return false; return false;

View File

@ -186,7 +186,7 @@ function get_theme_data( $theme_file ) {
if ( preg_match( '|Author URI:(.*)$|mi', $theme_data, $author_uri ) ) if ( preg_match( '|Author URI:(.*)$|mi', $theme_data, $author_uri ) )
$author_uri = clean_url( trim( $author_uri[1]) ); $author_uri = clean_url( trim( $author_uri[1]) );
else else
$author_uti = ''; $author_uri = '';
if ( preg_match( '|Template:(.*)$|mi', $theme_data, $template ) ) if ( preg_match( '|Template:(.*)$|mi', $theme_data, $template ) )
$template = wp_kses( trim( $template[1] ), $themes_allowed_tags ); $template = wp_kses( trim( $template[1] ), $themes_allowed_tags );

View File

@ -259,7 +259,7 @@ function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) {
$meta_value = trim( $meta_value ); $meta_value = trim( $meta_value );
if ( ! empty($meta_value) ) if ( ! empty($meta_value) )
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s AND meta_value = %s", $userid, $meta_key, $meta_value) ); $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s AND meta_value = %s", $user_id, $meta_key, $meta_value) );
else else
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );