Variable Cleanup, Unused variables, Typo'd variables, unused code blocks. Fixes #12299

git-svn-id: http://svn.automattic.com/wordpress/trunk@13242 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dd32 2010-02-20 02:01:46 +00:00
parent a6637d9c7a
commit 679250491d
21 changed files with 19 additions and 44 deletions

View File

@ -1835,7 +1835,7 @@ function media_upload_library_form($errors) {
$start = ( $_GET['paged'] - 1 ) * 10; $start = ( $_GET['paged'] - 1 ) * 10;
if ( $start < 1 ) if ( $start < 1 )
$start = 0; $start = 0;
add_filter( 'post_limits', $limit_filter = create_function( '$a', "return 'LIMIT $start, 10';" ) ); add_filter( 'post_limits', create_function( '$a', "return 'LIMIT $start, 10';" ) );
list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query(); list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();

View File

@ -125,7 +125,6 @@ function wpmu_delete_user($id) {
global $wpdb; global $wpdb;
$id = (int) $id; $id = (int) $id;
$user = get_userdata($id);
do_action('wpmu_delete_user', $id); do_action('wpmu_delete_user', $id);

View File

@ -960,7 +960,7 @@ function wp_edit_attachments_query( $q = false ) {
function postbox_classes( $id, $page ) { function postbox_classes( $id, $page ) {
if ( isset( $_GET['edit'] ) && $_GET['edit'] == $id ) if ( isset( $_GET['edit'] ) && $_GET['edit'] == $id )
return ''; return '';
$current_user = wp_get_current_user();
if ( $closed = get_user_option('closedpostboxes_'.$page ) ) { if ( $closed = get_user_option('closedpostboxes_'.$page ) ) {
if ( !is_array( $closed ) ) { if ( !is_array( $closed ) ) {
return ''; return '';

View File

@ -623,7 +623,7 @@ function populate_roles_300() {
* @param int $network_id id of network to populate * @param int $network_id id of network to populate
*/ */
function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $vhost = 'no' ) { function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $vhost = 'no' ) {
global $wpdb, $current_site, $wp_version, $wp_db_version, $wp_rewrite; global $wpdb, $current_site, $wp_db_version, $wp_rewrite;
$msg = ''; $msg = '';
//@todo: turn these checks into returned messages //@todo: turn these checks into returned messages

View File

@ -2111,7 +2111,7 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true,
if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) { if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) {
$actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>'; $actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
} elseif ( 'spam' == $the_comment_status ) { } elseif ( 'spam' == $the_comment_status ) {
$actions['unspam'] = "<a href='$untrash_url' class='delete:the-comment-list:comment-$comment->comment_ID:66cc66:unspam=1 vim-z vim-destructive'>" . __( 'Not Spam' ) . '</a>'; $actions['unspam'] = "<a href='$unspam_url' class='delete:the-comment-list:comment-$comment->comment_ID:66cc66:unspam=1 vim-z vim-destructive'>" . __( 'Not Spam' ) . '</a>';
} elseif ( 'trash' == $the_comment_status ) { } elseif ( 'trash' == $the_comment_status ) {
$actions['untrash'] = "<a href='$untrash_url' class='delete:the-comment-list:comment-$comment->comment_ID:66cc66:untrash=1 vim-z vim-destructive'>" . __( 'Restore' ) . '</a>'; $actions['untrash'] = "<a href='$untrash_url' class='delete:the-comment-list:comment-$comment->comment_ID:66cc66:untrash=1 vim-z vim-destructive'>" . __( 'Restore' ) . '</a>';
} }
@ -2678,7 +2678,6 @@ function the_attachment_links( $id = false ) {
* @param string $default slug for the role that should be already selected * @param string $default slug for the role that should be already selected
*/ */
function wp_dropdown_roles( $selected = false ) { function wp_dropdown_roles( $selected = false ) {
global $wp_roles;
$p = ''; $p = '';
$r = ''; $r = '';
@ -3288,7 +3287,7 @@ function find_posts_div($found_action = '') {
<?php wp_nonce_field( 'find-posts', '_ajax_nonce', false ); ?> <?php wp_nonce_field( 'find-posts', '_ajax_nonce', false ); ?>
<label class="screen-reader-text" for="find-posts-input"><?php _e( 'Search' ); ?></label> <label class="screen-reader-text" for="find-posts-input"><?php _e( 'Search' ); ?></label>
<input type="text" id="find-posts-input" name="ps" value="" /> <input type="text" id="find-posts-input" name="ps" value="" />
<input type="button" onclick="findPosts.send();" value="<?php esc_attr_e( 'Search' ); ?>" class="button" /><br /> <input type="button" onClick="findPosts.send();" value="<?php esc_attr_e( 'Search' ); ?>" class="button" /><br />
<input type="radio" name="find-posts-what" id="find-posts-posts" checked="checked" value="posts" /> <input type="radio" name="find-posts-what" id="find-posts-posts" checked="checked" value="posts" />
<label for="find-posts-posts"><?php _e( 'Posts' ); ?></label> <label for="find-posts-posts"><?php _e( 'Posts' ); ?></label>
@ -3298,7 +3297,7 @@ function find_posts_div($found_action = '') {
<div id="find-posts-response"></div> <div id="find-posts-response"></div>
</div> </div>
<div class="find-box-buttons"> <div class="find-box-buttons">
<input type="button" class="button alignleft" onclick="findPosts.close();" value="<?php esc_attr_e('Close'); ?>" /> <input type="button" class="button alignleft" onClick="findPosts.close();" value="<?php esc_attr_e('Close'); ?>" />
<input id="find-posts-submit" type="submit" class="button-primary alignright" value="<?php esc_attr_e('Select'); ?>" /> <input id="find-posts-submit" type="submit" class="button-primary alignright" value="<?php esc_attr_e('Select'); ?>" />
</div> </div>
</div> </div>
@ -3544,7 +3543,7 @@ function convert_to_screen( $screen ) {
} }
function screen_meta($screen) { function screen_meta($screen) {
global $wp_meta_boxes, $_wp_contextual_help, $post_type; global $wp_meta_boxes, $_wp_contextual_help, $title;
if ( is_string($screen) ) if ( is_string($screen) )
$screen = convert_to_screen($screen); $screen = convert_to_screen($screen);
@ -3607,8 +3606,6 @@ function screen_meta($screen) {
<?php <?php
endif; endif;
global $title;
$_wp_contextual_help = apply_filters('contextual_help_list', $_wp_contextual_help, $screen); $_wp_contextual_help = apply_filters('contextual_help_list', $_wp_contextual_help, $screen);
?> ?>
<div id="contextual-help-wrap" class="hidden"> <div id="contextual-help-wrap" class="hidden">

View File

@ -366,8 +366,6 @@ function display_theme($theme, $actions = null, $show_details = true) {
* @param int $totalpages Number of pages. * @param int $totalpages Number of pages.
*/ */
function display_themes($themes, $page = 1, $totalpages = 1) { function display_themes($themes, $page = 1, $totalpages = 1) {
global $themes_allowedtags;
$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'] ) : '';
?> ?>

View File

@ -87,9 +87,6 @@ function delete_theme($template) {
return new WP_Error('fs_no_themes_dir', __('Unable to locate WordPress theme directory.')); return new WP_Error('fs_no_themes_dir', __('Unable to locate WordPress theme directory.'));
$themes_dir = trailingslashit( $themes_dir ); $themes_dir = trailingslashit( $themes_dir );
$errors = array();
$theme_dir = trailingslashit($themes_dir . $template); $theme_dir = trailingslashit($themes_dir . $template);
$deleted = $wp_filesystem->delete($theme_dir, true); $deleted = $wp_filesystem->delete($theme_dir, true);

View File

@ -423,7 +423,6 @@ function wp_delete_user( $id, $reassign = 'novalue' ) {
global $wpdb; global $wpdb;
$id = (int) $id; $id = (int) $id;
$user = new WP_User($id);
// allow for transaction statement // allow for transaction statement
do_action('delete_user', $id); do_action('delete_user', $id);

View File

@ -51,15 +51,6 @@ if ( $post_id ) {
* @param int $post_id Optional. Post ID. * @param int $post_id Optional. Post ID.
*/ */
function redirect_post($post_id = '') { function redirect_post($post_id = '') {
global $action;
$referredby = '';
if ( !empty($_POST['referredby']) ) {
$referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']);
$referredby = remove_query_arg('_wp_original_http_referer', $referredby);
}
$referer = preg_replace('|https?://[^/]+|i', '', wp_get_referer());
if ( !empty($_POST['mode']) && 'sidebar' == $_POST['mode'] ) { if ( !empty($_POST['mode']) && 'sidebar' == $_POST['mode'] ) {
if ( isset($_POST['saveasdraft']) ) if ( isset($_POST['saveasdraft']) )
$location = 'sidebar.php?a=c'; $location = 'sidebar.php?a=c';

View File

@ -971,7 +971,7 @@ function comments_popup_script($width=400, $height=400, $file='') {
* @return null Returns null on single posts and pages. * @return null Returns null on single posts and pages.
*/ */
function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) { function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) {
global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post; global $id, $wpcommentspopupfile, $wpcommentsjavascript;
if ( false === $zero ) $zero = __( 'No Comments' ); if ( false === $zero ) $zero = __( 'No Comments' );
if ( false === $one ) $one = __( '1 Comment' ); if ( false === $one ) $one = __( '1 Comment' );

View File

@ -828,7 +828,7 @@ function wp_count_comments( $post_id = 0 ) {
$total = 0; $total = 0;
$approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed'); $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed');
$known_types = array_keys( $approved ); $known_types = array_keys( $approved );
foreach( (array) $count as $row_num => $row ) { foreach ( (array) $count as $row ) {
// Don't count post-trashed toward totals // Don't count post-trashed toward totals
if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] )
$total += $row['num_comments']; $total += $row['num_comments'];

View File

@ -23,7 +23,6 @@
* @return string Date formated by $dateformatstring or locale (if available). * @return string Date formated by $dateformatstring or locale (if available).
*/ */
function mysql2date( $dateformatstring, $mysqlstring, $translate = true ) { function mysql2date( $dateformatstring, $mysqlstring, $translate = true ) {
global $wp_locale;
$m = $mysqlstring; $m = $mysqlstring;
if ( empty( $m ) ) if ( empty( $m ) )
return false; return false;

View File

@ -1352,7 +1352,7 @@ function the_date( $d = '', $before = '', $after = '', $echo = true ) {
* @return string|null Null if displaying, string if retrieving. * @return string|null Null if displaying, string if retrieving.
*/ */
function get_the_date( $d = '' ) { function get_the_date( $d = '' ) {
global $post, $day; global $post;
$the_date = ''; $the_date = '';
if ( '' == $d ) if ( '' == $d )

View File

@ -1677,7 +1677,7 @@ function previous_comments_link( $label = '' ) {
* @return string Markup for pagination links. * @return string Markup for pagination links.
*/ */
function paginate_comments_links($args = array()) { function paginate_comments_links($args = array()) {
global $wp_query, $wp_rewrite; global $wp_rewrite;
if ( !is_singular() || !get_option('page_comments') ) if ( !is_singular() || !get_option('page_comments') )
return; return;

View File

@ -230,7 +230,7 @@ function update_blog_details( $blog_id, $details = array() ) {
foreach ( array_intersect( array_keys( $details ), $fields ) as $field ) foreach ( array_intersect( array_keys( $details ), $fields ) as $field )
$update_details[$field] = $details[$field]; $update_details[$field] = $details[$field];
$result = $wpdb->update( $wpdb->blogs, $update_details, array('blog_id' => $blog_id) ); $wpdb->update( $wpdb->blogs, $update_details, array('blog_id' => $blog_id) );
// If spam status changed, issue actions. // If spam status changed, issue actions.
if ( $details[ 'spam' ] != $current_details[ 'spam' ] ) { if ( $details[ 'spam' ] != $current_details[ 'spam' ] ) {

View File

@ -687,8 +687,6 @@ function wpmu_signup_blog_notification($domain, $path, $title, $user, $user_emai
} }
function wpmu_signup_user_notification($user, $user_email, $key, $meta = '') { function wpmu_signup_user_notification($user, $user_email, $key, $meta = '') {
global $current_site;
if ( !apply_filters('wpmu_signup_user_notification', $user, $user_email, $key, $meta) ) if ( !apply_filters('wpmu_signup_user_notification', $user, $user_email, $key, $meta) )
return false; return false;
@ -781,8 +779,6 @@ function wpmu_create_user( $user_name, $password, $email) {
if ( is_wp_error($user_id) ) if ( is_wp_error($user_id) )
return false; return false;
$user = new WP_User($user_id);
// Newly created users have no roles or caps until they are added to a blog. // Newly created users have no roles or caps until they are added to a blog.
update_user_option($user_id, 'capabilities', ''); update_user_option($user_id, 'capabilities', '');
update_user_option($user_id, 'user_level', ''); update_user_option($user_id, 'user_level', '');

View File

@ -969,7 +969,6 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
$comment = get_comment($comment_id); $comment = get_comment($comment_id);
$post = get_post($comment->comment_post_ID); $post = get_post($comment->comment_post_ID);
$user = get_userdata( $post->post_author ); $user = get_userdata( $post->post_author );
$current_user = wp_get_current_user();
if ( $comment->user_id == $post->post_author ) return false; // The author moderated a comment on his own post if ( $comment->user_id == $post->post_author ) return false; // The author moderated a comment on his own post

View File

@ -179,7 +179,7 @@ function the_content($more_link_text = null, $stripteaser = 0) {
* @return string * @return string
*/ */
function get_the_content($more_link_text = null, $stripteaser = 0) { function get_the_content($more_link_text = null, $stripteaser = 0) {
global $id, $post, $more, $page, $pages, $multipage, $preview, $pagenow; global $id, $post, $more, $page, $pages, $multipage, $preview;
if ( null === $more_link_text ) if ( null === $more_link_text )
$more_link_text = __( '(more...)' ); $more_link_text = __( '(more...)' );
@ -367,7 +367,7 @@ function body_class( $class = '' ) {
* @return array Array of classes. * @return array Array of classes.
*/ */
function get_body_class( $class = '' ) { function get_body_class( $class = '' ) {
global $wp_query, $wpdb, $current_user; global $wp_query, $wpdb;
$classes = array(); $classes = array();

View File

@ -1429,7 +1429,7 @@ function wp_count_posts( $type = 'post', $perm = '' ) {
foreach ( get_post_stati() as $state ) foreach ( get_post_stati() as $state )
$stats[$state] = 0; $stats[$state] = 0;
foreach ( (array) $count as $row_num => $row ) foreach ( (array) $count as $row )
$stats[$row['post_status']] = $row['num_posts']; $stats[$row['post_status']] = $row['num_posts'];
$stats = (object) $stats; $stats = (object) $stats;

View File

@ -869,7 +869,7 @@ class wpdb {
if (!$this->$dbhname ) { if (!$this->$dbhname ) {
$this->bail(" $this->bail("
<h1>Error establishing a database connection</h1> <h1>Error establishing a database connection</h1>
<p>This either means that the username and password information in your <code>wp-config.php</code> file is incorrect or we can't contact the database server at <code>$dbhost</code>. This could mean your host's database server is down.</p> <p>This either means that the username and password information in your <code>wp-config.php</code> file is incorrect or we can't contact the database server at <code>{$details['db_host']}</code>. This could mean your host's database server is down.</p>
<ul> <ul>
<li>Are you sure you have the correct username and password?</li> <li>Are you sure you have the correct username and password?</li>
<li>Are you sure that you have typed the correct hostname?</li> <li>Are you sure that you have typed the correct hostname?</li>

View File

@ -242,7 +242,7 @@ function reset_password($key, $login) {
do_action('password_reset', $user, $new_pass); do_action('password_reset', $user, $new_pass);
wp_set_password($new_pass, $user->ID); wp_set_password($new_pass, $user->ID);
update_user_option($user_ID, 'default_password_nag', true, true); //Set up the Password change nag. update_user_option($user->ID, 'default_password_nag', true, true); //Set up the Password change nag.
$message = sprintf(__('Username: %s'), $user->user_login) . "\r\n"; $message = sprintf(__('Username: %s'), $user->user_login) . "\r\n";
$message .= sprintf(__('Password: %s'), $new_pass) . "\r\n"; $message .= sprintf(__('Password: %s'), $new_pass) . "\r\n";
$message .= site_url('wp-login.php', 'login') . "\r\n"; $message .= site_url('wp-login.php', 'login') . "\r\n";