Make WordPress Core


Ignore:
Timestamp:
01/18/2010 08:34:48 PM (15 years ago)
Author:
ryan
Message:

Coding standards, space after if

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/ms.php

    r12674 r12752  
    44        return $file;
    55    }
    6     if( $file['error'] != '0' ) // there's already an error
     6    if ( $file['error'] != '0' ) // there's already an error
    77        return $file;
    88
     
    1414    $space_left = $space_allowed - $space_used;
    1515    $file_size = filesize( $file['tmp_name'] );
    16     if( $space_left < $file_size )
     16    if ( $space_left < $file_size )
    1717        $file['error'] = sprintf( __( 'Not enough space to upload. %1$s Kb needed.' ), number_format( ($file_size - $space_left) /1024 ) );
    18     if( $file_size > ( 1024 * get_site_option( 'fileupload_maxk', 1500 ) ) )
     18    if ( $file_size > ( 1024 * get_site_option( 'fileupload_maxk', 1500 ) ) )
    1919        $file['error'] = sprintf(__('This file is too big. Files must be less than %1$s Kb in size.'), get_site_option( 'fileupload_maxk', 1500 ) );
    20     if( upload_is_user_over_quota( false ) ) {
     20    if ( upload_is_user_over_quota( false ) ) {
    2121        $file['error'] = __('You have used your space quota. Please delete files before uploading.');
    2222    }
    23     if( $file['error'] != '0' )
     23    if ( $file['error'] != '0' )
    2424        wp_die( $file['error'] . ' <a href="javascript:history.go(-1)">' . __( 'Back' ) . '</a>' );
    2525
     
    9191    if ( is_array( $blogs ) ) {
    9292        foreach( $blogs as $n => $blog ) {
    93             if( $blog[ 'blog_id' ] == $blog_id ) {
     93            if ( $blog[ 'blog_id' ] == $blog_id ) {
    9494                unset( $blogs[ $n ] );
    9595            }
     
    139139
    140140function confirm_delete_users( $users ) {
    141     if( !is_array( $users ) )
     141    if ( !is_array( $users ) )
    142142        return false;
    143143
     
    148148    wp_nonce_field( 'allusers' );
    149149    foreach ( (array) $_POST['allusers'] as $key => $val ) {
    150         if( $val != '' && $val != '0' ) {
     150        if ( $val != '' && $val != '0' ) {
    151151            $user = new WP_User( $val );
    152152            if ( in_array( $user->user_login, get_site_option( 'site_admins', array( 'admin' ) ) ) ) {
     
    155155            echo "<input type='hidden' name='user[]' value='{$val}'/>\n";
    156156            $blogs = get_blogs_of_user( $val, true );
    157             if( !empty( $blogs ) ) {
     157            if ( !empty( $blogs ) ) {
    158158                foreach ( (array) $blogs as $key => $details ) {
    159159                    $blog_users = get_users_of_blog( $details->userblog_id );
    160                     if( is_array( $blog_users ) && !empty( $blog_users ) ) {
     160                    if ( is_array( $blog_users ) && !empty( $blog_users ) ) {
    161161                        echo "<p><a href='http://{$details->domain}{$details->path}'>{$details->blogname}</a> ";
    162162                        echo "<select name='blog[$val][{$key}]'>";
    163163                        $out = '';
    164164                        foreach( $blog_users as $user ) {
    165                             if( $user->user_id != $val )
     165                            if ( $user->user_id != $val )
    166166                                $out .= "<option value='{$user->user_id}'>{$user->user_login}</option>";
    167167                        }
    168                         if( $out == '' )
     168                        if ( $out == '' )
    169169                            $out = "<option value='1'>admin</option>";
    170170                        echo $out;
     
    183183    $themes = get_themes();
    184184
    185     if( $blog_id != 0 )
     185    if ( $blog_id != 0 )
    186186        switch_to_blog( $blog_id );
    187187
    188188    $blog_allowed_themes = get_option( "allowedthemes" );
    189     if( !is_array( $blog_allowed_themes ) || empty( $blog_allowed_themes ) ) { // convert old allowed_themes to new allowedthemes
     189    if ( !is_array( $blog_allowed_themes ) || empty( $blog_allowed_themes ) ) { // convert old allowed_themes to new allowedthemes
    190190        $blog_allowed_themes = get_option( "allowed_themes" );
    191191
    192         if( is_array( $blog_allowed_themes ) ) {
     192        if ( is_array( $blog_allowed_themes ) ) {
    193193            foreach( (array) $themes as $key => $theme ) {
    194194                $theme_key = wp_specialchars( $theme[ 'Stylesheet' ] );
    195                 if( isset( $blog_allowed_themes[ $key ] ) == true ) {
     195                if ( isset( $blog_allowed_themes[ $key ] ) == true ) {
    196196                    $blog_allowedthemes[ $theme_key ] = 1;
    197197                }
     
    203203    }
    204204
    205     if( $blog_id != 0 )
     205    if ( $blog_id != 0 )
    206206        restore_current_blog();
    207207
     
    257257function update_profile_email() {
    258258    global $current_user, $wpdb;
    259     if( isset( $_GET[ 'newuseremail' ] ) && $current_user->ID ) {
     259    if ( isset( $_GET[ 'newuseremail' ] ) && $current_user->ID ) {
    260260        $new_email = get_option( $current_user->ID . '_new_email' );
    261         if( $new_email[ 'hash' ] == $_GET[ 'newuseremail' ] ) {
     261        if ( $new_email[ 'hash' ] == $_GET[ 'newuseremail' ] ) {
    262262            $user->ID = $current_user->ID;
    263263            $user->user_email = wp_specialchars( trim( $new_email[ 'newemail' ] ) );
     
    278278        $errors = new WP_Error();
    279279
    280     if( $current_user->id != $_POST[ 'user_id' ] )
     280    if ( $current_user->id != $_POST[ 'user_id' ] )
    281281        return false;
    282282
    283     if( $current_user->user_email != $_POST[ 'email' ] ) {
     283    if ( $current_user->user_email != $_POST[ 'email' ] ) {
    284284        if ( !is_email( $_POST[ 'email' ] ) ) {
    285285            $errors->add( 'user_email', __( "<strong>ERROR</strong>: The e-mail address isn't correct." ), array( 'form-field' => 'email' ) );
     
    287287        }
    288288
    289         if( $wpdb->get_var( $wpdb->prepare( "SELECT user_email FROM {$wpdb->users} WHERE user_email=%s", $_POST[ 'email' ] ) ) ) {
     289        if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_email FROM {$wpdb->users} WHERE user_email=%s", $_POST[ 'email' ] ) ) ) {
    290290            $errors->add( 'user_email', __( "<strong>ERROR</strong>: The e-mail address is already used." ), array( 'form-field' => 'email' ) );
    291291            delete_option( $current_user->ID . '_new_email' );
     
    328328function new_user_email_admin_notice() {
    329329    global $current_user;
    330     if( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) && isset( $_GET[ 'updated' ] ) && $email = get_option( $current_user->ID . '_new_email' ) )
     330    if ( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) && isset( $_GET[ 'updated' ] ) && $email = get_option( $current_user->ID . '_new_email' ) )
    331331        echo "<div id='update-nag'>" . sprintf( __( "Your email address has not been updated yet. Please check your inbox at %s for a confirmation email." ), $email[ 'newemail' ] ) . "</div>";
    332332}
     
    336336    $themes = get_themes();
    337337    $allowed_themes = get_site_option( 'allowedthemes' );
    338     if( !is_array( $allowed_themes ) || empty( $allowed_themes ) ) {
     338    if ( !is_array( $allowed_themes ) || empty( $allowed_themes ) ) {
    339339        $allowed_themes = get_site_option( "allowed_themes" ); // convert old allowed_themes format
    340         if( !is_array( $allowed_themes ) ) {
     340        if ( !is_array( $allowed_themes ) ) {
    341341            $allowed_themes = array();
    342342        } else {
    343343            foreach( (array) $themes as $key => $theme ) {
    344344                $theme_key = wp_specialchars( $theme[ 'Stylesheet' ] );
    345                 if( isset( $allowed_themes[ $key ] ) == true ) {
     345                if ( isset( $allowed_themes[ $key ] ) == true ) {
    346346                    $allowedthemes[ $theme_key ] = 1;
    347347                }
     
    355355function get_space_allowed() {
    356356    $spaceAllowed = get_option("blog_upload_space");
    357     if( $spaceAllowed == false )
     357    if ( $spaceAllowed == false )
    358358        $spaceAllowed = get_site_option("blog_upload_space");
    359     if( empty($spaceAllowed) || !is_numeric($spaceAllowed) )
     359    if ( empty($spaceAllowed) || !is_numeric($spaceAllowed) )
    360360        $spaceAllowed = 50;
    361361
     
    370370    else $percentused = ( $used / $space ) * 100;
    371371
    372     if( $space > 1000 ) {
     372    if ( $space > 1000 ) {
    373373        $space = number_format( $space / 1024 );
    374374        $space .= __('GB');
     
    408408    <?php
    409409}
    410 if( current_user_can('edit_posts') )
     410if ( current_user_can('edit_posts') )
    411411    add_action('activity_box_end', 'dashboard_quota');
    412412
     
    414414function upload_space_setting( $id ) {
    415415    $quota = get_blog_option($id, "blog_upload_space");
    416     if( !$quota )
     416    if ( !$quota )
    417417        $quota = '';
    418418
     
    431431    $wpdb->update( $wpdb->users, array( $pref => $value ), array( 'ID' => $id ) );
    432432
    433     if( $refresh == 1 )
     433    if ( $refresh == 1 )
    434434        refresh_user_details($id);
    435435
    436     if( $pref == 'spam' ) {
    437         if( $value == 1 )
     436    if ( $pref == 'spam' ) {
     437        if ( $value == 1 )
    438438            do_action( "make_spam_user", $id );
    439439        else
     
    483483    $size = $size / 1024 / 1024;
    484484
    485     if( ($spaceAllowed - $size) <= 0 ) {
     485    if ( ($spaceAllowed - $size) <= 0 ) {
    486486        wp_die( __('Sorry, you must delete files before you can upload any more.') );
    487487    }
     
    497497
    498498function sync_category_tag_slugs( $term, $taxonomy ) {
    499     if( $taxonomy == 'category' || $taxonomy == 'post_tag' ) {
    500         if( is_object( $term ) ) {
     499    if ( $taxonomy == 'category' || $taxonomy == 'post_tag' ) {
     500        if ( is_object( $term ) ) {
    501501            $term->slug = sanitize_title( $term->name );
    502502        } else {
     
    521521    $blog = get_active_blog_for_user( $current_user->ID );
    522522    $dashboard_blog = get_dashboard_blog();
    523     if( is_object( $blog ) ) {
     523    if ( is_object( $blog ) ) {
    524524        $protocol = ( is_ssl() ? 'https://' : 'http://' );
    525525        wp_redirect( $protocol . $blog->domain . $blog->path . 'wp-admin/?c=' . $c ); // redirect and count to 5, "just in case"
     
    626626    $mu_media_buttons = get_site_option( 'mu_media_buttons' );
    627627    $out = '';
    628     if( $mu_media_buttons[ 'image' ] ) {
     628    if ( $mu_media_buttons[ 'image' ] ) {
    629629        $image_upload_iframe_src = apply_filters('image_upload_iframe_src', "$media_upload_iframe_src&amp;type=image");
    630630        $image_title = __('Add an Image');
    631631        $out .= "<a href='{$image_upload_iframe_src}&amp;TB_iframe=true' id='add_image' class='thickbox' title='$image_title'><img src='images/media-button-image.gif' alt='$image_title' /></a>";
    632632    }
    633     if( $mu_media_buttons[ 'video' ] ) {
     633    if ( $mu_media_buttons[ 'video' ] ) {
    634634        $video_upload_iframe_src = apply_filters('video_upload_iframe_src', "$media_upload_iframe_src&amp;type=video");
    635635        $video_title = __('Add Video');
    636636        $out .= "<a href='{$video_upload_iframe_src}&amp;TB_iframe=true' id='add_video' class='thickbox' title='$video_title'><img src='images/media-button-video.gif' alt='$video_title' /></a>";
    637637    }
    638     if( $mu_media_buttons[ 'audio' ] ) {
     638    if ( $mu_media_buttons[ 'audio' ] ) {
    639639        $audio_upload_iframe_src = apply_filters('audio_upload_iframe_src', "$media_upload_iframe_src&amp;type=audio");
    640640        $audio_title = __('Add Audio');
     
    649649/* Warn the admin if SECRET SALT information is missing from wp-config.php */
    650650function secret_salt_warning() {
    651     if( !is_super_admin() )
     651    if ( !is_super_admin() )
    652652        return;
    653653    $secret_keys = array( 'NONCE_KEY', 'AUTH_KEY', 'AUTH_SALT', 'LOGGED_IN_KEY', 'LOGGED_IN_SALT', 'SECURE_AUTH_KEY', 'SECURE_AUTH_SALT' );
    654654    $out = '';
    655655    foreach( $secret_keys as $key ) {
    656         if( !defined( $key ) )
     656        if ( !defined( $key ) )
    657657            $out .= "define( '$key', '" . wp_generate_password() . wp_generate_password() . "' );<br />";
    658658    }
    659     if( $out != '' ) {
     659    if ( $out != '' ) {
    660660        $msg = sprintf( __( 'Warning! WordPress encrypts user cookies, but you must add the following lines to <strong>%swp-config.php</strong> for it to be more secure.<br />Please add the code before the line, <code>/* That\'s all, stop editing! Happy blogging. */</code>' ), ABSPATH );
    661661        $msg .= "<blockquote>$out</blockquote>";
     
    687687function admin_notice_feed() {
    688688    global $current_user;
    689     if( substr( $_SERVER[ 'PHP_SELF' ], -19 ) != '/wp-admin/index.php' )
     689    if ( substr( $_SERVER[ 'PHP_SELF' ], -19 ) != '/wp-admin/index.php' )
    690690        return;
    691691
    692     if( isset( $_GET[ 'feed_dismiss' ] ) )
     692    if ( isset( $_GET[ 'feed_dismiss' ] ) )
    693693        update_user_option( $current_user->id, 'admin_feed_dismiss', $_GET[ 'feed_dismiss' ], true );
    694694
    695695    $url = get_site_option( 'admin_notice_feed' );
    696     if( $url == '' )
     696    if ( $url == '' )
    697697        return;
    698698    include_once( ABSPATH . 'wp-includes/rss.php' );
    699699    $rss = @fetch_rss( $url );
    700     if( isset($rss->items) && 1 <= count($rss->items) ) {
    701         if( md5( $rss->items[0][ 'title' ] ) == get_user_option( 'admin_feed_dismiss', $current_user->id ) )
     700    if ( isset($rss->items) && 1 <= count($rss->items) ) {
     701        if ( md5( $rss->items[0][ 'title' ] ) == get_user_option( 'admin_feed_dismiss', $current_user->id ) )
    702702            return;
    703703        $item = $rss->items[0];
     
    715715        $msg .= "<p>" . $content . " <a href='$link'>" . __( 'Read More' ) . "</a> <a href='index.php?feed_dismiss=" . md5( $item[ 'title' ] ) . "'>" . __( "Dismiss" ) . "</a></p>";
    716716        echo "<div class='updated fade'>$msg</div>";
    717     } elseif( is_super_admin() ) {
     717    } elseif ( is_super_admin() ) {
    718718        printf("<div id='update-nag'>" . __("Your feed at %s is empty.") . "</div>", wp_specialchars( $url ));
    719719    }
     
    723723function site_admin_notice() {
    724724    global $current_user, $wp_db_version;
    725     if( !is_super_admin() )
     725    if ( !is_super_admin() )
    726726        return false;
    727727    printf("<div id='update-nag'>" . __("Hi %s! You're logged in as a site administrator.") . "</div>", $current_user->user_login);
     
    733733
    734734function avoid_blog_page_permalink_collision( $data, $postarr ) {
    735     if( is_subdomain_install() )
     735    if ( is_subdomain_install() )
    736736        return $data;
    737     if( $data[ 'post_type' ] != 'page' )
     737    if ( $data[ 'post_type' ] != 'page' )
    738738        return $data;
    739     if( !isset( $data[ 'post_name' ] ) || $data[ 'post_name' ] == '' )
     739    if ( !isset( $data[ 'post_name' ] ) || $data[ 'post_name' ] == '' )
    740740        return $data;
    741     if( !is_main_blog() )
     741    if ( !is_main_blog() )
    742742        return $data;
    743743
     
    748748        $c ++;
    749749    }
    750     if( $post_name != $data[ 'post_name' ] ) {
     750    if ( $post_name != $data[ 'post_name' ] ) {
    751751        $data[ 'post_name' ] = $post_name;
    752752    }
     
    10341034function remove_edit_plugin_link( $action_links, $plugin_file, $plugin_data, $context ) {
    10351035    foreach( $action_links as $t => $link ) {
    1036         if( !strpos( $link, __( "Open this file in the Plugin Editor" ) ) )
     1036        if ( !strpos( $link, __( "Open this file in the Plugin Editor" ) ) )
    10371037            $links[ $t ] = $link;
    10381038    }
     
    10511051        $all_blogs = get_blogs_of_user( $current_user->ID );
    10521052        $primary_blog = get_usermeta($current_user->ID, 'primary_blog');
    1053         if( count( $all_blogs ) > 1 ) {
     1053        if ( count( $all_blogs ) > 1 ) {
    10541054            $found = false;
    10551055            ?>
    10561056            <select name="primary_blog">
    10571057                <?php foreach( (array) $all_blogs as $blog ) {
    1058                     if( $primary_blog == $blog->userblog_id )
     1058                    if ( $primary_blog == $blog->userblog_id )
    10591059                        $found = true;
    1060                     ?><option value='<?php echo $blog->userblog_id ?>'<?php if( $primary_blog == $blog->userblog_id ) echo ' selected="selected"' ?>>http://<?php echo $blog->domain.$blog->path ?></option><?php
     1060                    ?><option value='<?php echo $blog->userblog_id ?>'<?php if ( $primary_blog == $blog->userblog_id ) echo ' selected="selected"' ?>>http://<?php echo $blog->domain.$blog->path ?></option><?php
    10611061                } ?>
    10621062            </select>
    10631063            <?php
    1064             if( !$found ) {
     1064            if ( !$found ) {
    10651065                $blog = array_shift( $all_blogs );
    10661066                update_usermeta( $current_user->ID, 'primary_blog', $blog->userblog_id );
    10671067            }
    1068         } elseif( count( $all_blogs ) == 1 ) {
     1068        } elseif ( count( $all_blogs ) == 1 ) {
    10691069            $blog = array_shift( $all_blogs );
    10701070            echo $blog->domain;
    1071             if( $primary_blog != $blog->userblog_id ) // Set the primary blog again if it's out of sync with blog list.
     1071            if ( $primary_blog != $blog->userblog_id ) // Set the primary blog again if it's out of sync with blog list.
    10721072                update_usermeta( $current_user->ID, 'primary_blog', $blog->userblog_id );
    10731073        } else {
     
    10821082add_action ( 'myblogs_allblogs_options', 'choose_primary_blog' );
    10831083
    1084 if( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) ) {
     1084if ( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) ) {
    10851085    add_action( 'admin_init', 'update_profile_email' );
    10861086    add_action( 'admin_init', 'profile_page_email_warning_ob_start' );
     
    11331133
    11341134    $blogs = get_blogs_of_user( $current_user->ID );
    1135     if( !$blogs || ( is_array( $blogs ) && empty( $blogs ) ) ) {
     1135    if ( !$blogs || ( is_array( $blogs ) && empty( $blogs ) ) ) {
    11361136        wp_die( __( 'You must be a member of at least one blog to use this page.' ) );
    11371137    }
     
    11411141    ?>
    11421142    <div class="wrap">
    1143     <?php if( $_GET[ 'updated' ] ) { ?>
     1143    <?php if ( $_GET[ 'updated' ] ) { ?>
    11441144        <div id="message" class="updated fade"><p><strong><?php _e( 'Your blog options have been updated.' ); ?></strong></p></div>
    11451145    <?php } ?>
Note: See TracChangeset for help on using the changeset viewer.