Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (7 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

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

    r41289 r42343  
    1717 */
    1818function check_upload_size( $file ) {
    19     if ( get_site_option( 'upload_space_check_disabled' ) )
     19    if ( get_site_option( 'upload_space_check_disabled' ) ) {
    2020        return $file;
    21 
    22     if ( $file['error'] != '0' ) // there's already an error
     21    }
     22
     23    if ( $file['error'] != '0' ) { // there's already an error
    2324        return $file;
    24 
    25     if ( defined( 'WP_IMPORTING' ) )
     25    }
     26
     27    if ( defined( 'WP_IMPORTING' ) ) {
    2628        return $file;
     29    }
    2730
    2831    $space_left = get_upload_space_available();
     
    8083    do_action( 'delete_blog', $blog_id, $drop );
    8184
    82     $users = get_users( array( 'blog_id' => $blog_id, 'fields' => 'ids' ) );
     85    $users = get_users(
     86        array(
     87            'blog_id' => $blog_id,
     88            'fields'  => 'ids',
     89        )
     90    );
    8391
    8492    // Remove users from this blog.
     
    138146         * @param int    $blog_id            The site ID.
    139147         */
    140         $dir = apply_filters( 'wpmu_delete_blog_upload_dir', $uploads['basedir'], $blog_id );
    141         $dir = rtrim( $dir, DIRECTORY_SEPARATOR );
     148        $dir     = apply_filters( 'wpmu_delete_blog_upload_dir', $uploads['basedir'], $blog_id );
     149        $dir     = rtrim( $dir, DIRECTORY_SEPARATOR );
    142150        $top_dir = $dir;
    143         $stack = array($dir);
    144         $index = 0;
     151        $stack   = array( $dir );
     152        $index   = 0;
    145153
    146154        while ( $index < count( $stack ) ) {
    147155            // Get indexed directory from stack
    148             $dir = $stack[$index];
     156            $dir = $stack[ $index ];
    149157
    150158            $dh = @opendir( $dir );
    151159            if ( $dh ) {
    152160                while ( ( $file = @readdir( $dh ) ) !== false ) {
    153                     if ( $file == '.' || $file == '..' )
     161                    if ( $file == '.' || $file == '..' ) {
    154162                        continue;
     163                    }
    155164
    156165                    if ( @is_dir( $dir . DIRECTORY_SEPARATOR . $file ) ) {
     
    167176        $stack = array_reverse( $stack ); // Last added dirs are deepest
    168177        foreach ( (array) $stack as $dir ) {
    169             if ( $dir != $top_dir)
    170             @rmdir( $dir );
     178            if ( $dir != $top_dir ) {
     179                @rmdir( $dir );
     180            }
    171181        }
    172182
     
    184194    do_action( 'deleted_blog', $blog_id, $drop );
    185195
    186     if ( $switch )
     196    if ( $switch ) {
    187197        restore_current_blog();
     198    }
    188199}
    189200
     
    207218    }
    208219
    209     $id = (int) $id;
     220    $id   = (int) $id;
    210221    $user = new WP_User( $id );
    211222
    212     if ( !$user->exists() )
     223    if ( ! $user->exists() ) {
    213224        return false;
     225    }
    214226
    215227    // Global super-administrators are protected, and cannot be deleted.
     
    244256
    245257            if ( $link_ids ) {
    246                 foreach ( $link_ids as $link_id )
     258                foreach ( $link_ids as $link_id ) {
    247259                    wp_delete_link( $link_id );
     260                }
    248261            }
    249262
     
    253266
    254267    $meta = $wpdb->get_col( $wpdb->prepare( "SELECT umeta_id FROM $wpdb->usermeta WHERE user_id = %d", $id ) );
    255     foreach ( $meta as $mid )
     268    foreach ( $meta as $mid ) {
    256269        delete_metadata_by_mid( 'user', $mid );
     270    }
    257271
    258272    $wpdb->delete( $wpdb->users, array( 'ID' => $id ) );
     
    275289 */
    276290function upload_is_user_over_quota( $echo = true ) {
    277     if ( get_site_option( 'upload_space_check_disabled' ) )
     291    if ( get_site_option( 'upload_space_check_disabled' ) ) {
    278292        return false;
     293    }
    279294
    280295    $space_allowed = get_space_allowed();
     
    285300
    286301    if ( ( $space_allowed - $space_used ) < 0 ) {
    287         if ( $echo )
     302        if ( $echo ) {
    288303            _e( 'Sorry, you have used your space allocation. Please delete some files to upload more files.' );
     304        }
    289305        return true;
    290306    } else {
     
    300316function display_space_usage() {
    301317    $space_allowed = get_space_allowed();
    302     $space_used = get_space_used();
     318    $space_used    = get_space_used();
    303319
    304320    $percent_used = ( $space_used / $space_allowed ) * 100;
     
    314330    }
    315331    ?>
    316     <strong><?php
     332    <strong>
     333    <?php
    317334        /* translators: Storage space that's been used. 1: Percentage of used space, 2: Total space allowed in megabytes or gigabytes */
    318335        printf( __( 'Used: %1$s%% of %2$s' ), number_format( $percent_used ), $space );
    319     ?></strong>
     336    ?>
     337    </strong>
    320338    <?php
    321339}
     
    349367    restore_current_blog();
    350368
    351     if ( !$quota )
     369    if ( ! $quota ) {
    352370        $quota = '';
     371    }
    353372
    354373    ?>
     
    382401    global $wpdb;
    383402
    384     if ( null !== $deprecated )
     403    if ( null !== $deprecated ) {
    385404        _deprecated_argument( __FUNCTION__, '3.0.2' );
     405    }
    386406
    387407    $wpdb->update( $wpdb->users, array( sanitize_key( $pref ) => $value ), array( 'ID' => $id ) );
     
    426446    $id = (int) $id;
    427447
    428     if ( !$user = get_userdata( $id ) )
     448    if ( ! $user = get_userdata( $id ) ) {
    429449        return false;
     450    }
    430451
    431452    clean_user_cache( $user );
     
    444465 */
    445466function format_code_lang( $code = '' ) {
    446     $code = strtolower( substr( $code, 0, 2 ) );
     467    $code       = strtolower( substr( $code, 0, 2 ) );
    447468    $lang_codes = array(
    448         'aa' => 'Afar', 'ab' => 'Abkhazian', 'af' => 'Afrikaans', 'ak' => 'Akan', 'sq' => 'Albanian', 'am' => 'Amharic', 'ar' => 'Arabic', 'an' => 'Aragonese', 'hy' => 'Armenian', 'as' => 'Assamese', 'av' => 'Avaric', 'ae' => 'Avestan', 'ay' => 'Aymara', 'az' => 'Azerbaijani', 'ba' => 'Bashkir', 'bm' => 'Bambara', 'eu' => 'Basque', 'be' => 'Belarusian', 'bn' => 'Bengali',
    449         'bh' => 'Bihari', 'bi' => 'Bislama', 'bs' => 'Bosnian', 'br' => 'Breton', 'bg' => 'Bulgarian', 'my' => 'Burmese', 'ca' => 'Catalan; Valencian', 'ch' => 'Chamorro', 'ce' => 'Chechen', 'zh' => 'Chinese', 'cu' => 'Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic', 'cv' => 'Chuvash', 'kw' => 'Cornish', 'co' => 'Corsican', 'cr' => 'Cree',
    450         'cs' => 'Czech', 'da' => 'Danish', 'dv' => 'Divehi; Dhivehi; Maldivian', 'nl' => 'Dutch; Flemish', 'dz' => 'Dzongkha', 'en' => 'English', 'eo' => 'Esperanto', 'et' => 'Estonian', 'ee' => 'Ewe', 'fo' => 'Faroese', 'fj' => 'Fijjian', 'fi' => 'Finnish', 'fr' => 'French', 'fy' => 'Western Frisian', 'ff' => 'Fulah', 'ka' => 'Georgian', 'de' => 'German', 'gd' => 'Gaelic; Scottish Gaelic',
    451         'ga' => 'Irish', 'gl' => 'Galician', 'gv' => 'Manx', 'el' => 'Greek, Modern', 'gn' => 'Guarani', 'gu' => 'Gujarati', 'ht' => 'Haitian; Haitian Creole', 'ha' => 'Hausa', 'he' => 'Hebrew', 'hz' => 'Herero', 'hi' => 'Hindi', 'ho' => 'Hiri Motu', 'hu' => 'Hungarian', 'ig' => 'Igbo', 'is' => 'Icelandic', 'io' => 'Ido', 'ii' => 'Sichuan Yi', 'iu' => 'Inuktitut', 'ie' => 'Interlingue',
    452         'ia' => 'Interlingua (International Auxiliary Language Association)', 'id' => 'Indonesian', 'ik' => 'Inupiaq', 'it' => 'Italian', 'jv' => 'Javanese', 'ja' => 'Japanese', 'kl' => 'Kalaallisut; Greenlandic', 'kn' => 'Kannada', 'ks' => 'Kashmiri', 'kr' => 'Kanuri', 'kk' => 'Kazakh', 'km' => 'Central Khmer', 'ki' => 'Kikuyu; Gikuyu', 'rw' => 'Kinyarwanda', 'ky' => 'Kirghiz; Kyrgyz',
    453         'kv' => 'Komi', 'kg' => 'Kongo', 'ko' => 'Korean', 'kj' => 'Kuanyama; Kwanyama', 'ku' => 'Kurdish', 'lo' => 'Lao', 'la' => 'Latin', 'lv' => 'Latvian', 'li' => 'Limburgan; Limburger; Limburgish', 'ln' => 'Lingala', 'lt' => 'Lithuanian', 'lb' => 'Luxembourgish; Letzeburgesch', 'lu' => 'Luba-Katanga', 'lg' => 'Ganda', 'mk' => 'Macedonian', 'mh' => 'Marshallese', 'ml' => 'Malayalam',
    454         'mi' => 'Maori', 'mr' => 'Marathi', 'ms' => 'Malay', 'mg' => 'Malagasy', 'mt' => 'Maltese', 'mo' => 'Moldavian', 'mn' => 'Mongolian', 'na' => 'Nauru', 'nv' => 'Navajo; Navaho', 'nr' => 'Ndebele, South; South Ndebele', 'nd' => 'Ndebele, North; North Ndebele', 'ng' => 'Ndonga', 'ne' => 'Nepali', 'nn' => 'Norwegian Nynorsk; Nynorsk, Norwegian', 'nb' => 'Bokmål, Norwegian, Norwegian Bokmål',
    455         'no' => 'Norwegian', 'ny' => 'Chichewa; Chewa; Nyanja', 'oc' => 'Occitan, Provençal', 'oj' => 'Ojibwa', 'or' => 'Oriya', 'om' => 'Oromo', 'os' => 'Ossetian; Ossetic', 'pa' => 'Panjabi; Punjabi', 'fa' => 'Persian', 'pi' => 'Pali', 'pl' => 'Polish', 'pt' => 'Portuguese', 'ps' => 'Pushto', 'qu' => 'Quechua', 'rm' => 'Romansh', 'ro' => 'Romanian', 'rn' => 'Rundi', 'ru' => 'Russian',
    456         'sg' => 'Sango', 'sa' => 'Sanskrit', 'sr' => 'Serbian', 'hr' => 'Croatian', 'si' => 'Sinhala; Sinhalese', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'se' => 'Northern Sami', 'sm' => 'Samoan', 'sn' => 'Shona', 'sd' => 'Sindhi', 'so' => 'Somali', 'st' => 'Sotho, Southern', 'es' => 'Spanish; Castilian', 'sc' => 'Sardinian', 'ss' => 'Swati', 'su' => 'Sundanese', 'sw' => 'Swahili',
    457         'sv' => 'Swedish', 'ty' => 'Tahitian', 'ta' => 'Tamil', 'tt' => 'Tatar', 'te' => 'Telugu', 'tg' => 'Tajik', 'tl' => 'Tagalog', 'th' => 'Thai', 'bo' => 'Tibetan', 'ti' => 'Tigrinya', 'to' => 'Tonga (Tonga Islands)', 'tn' => 'Tswana', 'ts' => 'Tsonga', 'tk' => 'Turkmen', 'tr' => 'Turkish', 'tw' => 'Twi', 'ug' => 'Uighur; Uyghur', 'uk' => 'Ukrainian', 'ur' => 'Urdu', 'uz' => 'Uzbek',
    458         've' => 'Venda', 'vi' => 'Vietnamese', 'vo' => 'Volapük', 'cy' => 'Welsh','wa' => 'Walloon','wo' => 'Wolof', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'za' => 'Zhuang; Chuang', 'zu' => 'Zulu' );
     469        'aa' => 'Afar',
     470        'ab' => 'Abkhazian',
     471        'af' => 'Afrikaans',
     472        'ak' => 'Akan',
     473        'sq' => 'Albanian',
     474        'am' => 'Amharic',
     475        'ar' => 'Arabic',
     476        'an' => 'Aragonese',
     477        'hy' => 'Armenian',
     478        'as' => 'Assamese',
     479        'av' => 'Avaric',
     480        'ae' => 'Avestan',
     481        'ay' => 'Aymara',
     482        'az' => 'Azerbaijani',
     483        'ba' => 'Bashkir',
     484        'bm' => 'Bambara',
     485        'eu' => 'Basque',
     486        'be' => 'Belarusian',
     487        'bn' => 'Bengali',
     488        'bh' => 'Bihari',
     489        'bi' => 'Bislama',
     490        'bs' => 'Bosnian',
     491        'br' => 'Breton',
     492        'bg' => 'Bulgarian',
     493        'my' => 'Burmese',
     494        'ca' => 'Catalan; Valencian',
     495        'ch' => 'Chamorro',
     496        'ce' => 'Chechen',
     497        'zh' => 'Chinese',
     498        'cu' => 'Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic',
     499        'cv' => 'Chuvash',
     500        'kw' => 'Cornish',
     501        'co' => 'Corsican',
     502        'cr' => 'Cree',
     503        'cs' => 'Czech',
     504        'da' => 'Danish',
     505        'dv' => 'Divehi; Dhivehi; Maldivian',
     506        'nl' => 'Dutch; Flemish',
     507        'dz' => 'Dzongkha',
     508        'en' => 'English',
     509        'eo' => 'Esperanto',
     510        'et' => 'Estonian',
     511        'ee' => 'Ewe',
     512        'fo' => 'Faroese',
     513        'fj' => 'Fijjian',
     514        'fi' => 'Finnish',
     515        'fr' => 'French',
     516        'fy' => 'Western Frisian',
     517        'ff' => 'Fulah',
     518        'ka' => 'Georgian',
     519        'de' => 'German',
     520        'gd' => 'Gaelic; Scottish Gaelic',
     521        'ga' => 'Irish',
     522        'gl' => 'Galician',
     523        'gv' => 'Manx',
     524        'el' => 'Greek, Modern',
     525        'gn' => 'Guarani',
     526        'gu' => 'Gujarati',
     527        'ht' => 'Haitian; Haitian Creole',
     528        'ha' => 'Hausa',
     529        'he' => 'Hebrew',
     530        'hz' => 'Herero',
     531        'hi' => 'Hindi',
     532        'ho' => 'Hiri Motu',
     533        'hu' => 'Hungarian',
     534        'ig' => 'Igbo',
     535        'is' => 'Icelandic',
     536        'io' => 'Ido',
     537        'ii' => 'Sichuan Yi',
     538        'iu' => 'Inuktitut',
     539        'ie' => 'Interlingue',
     540        'ia' => 'Interlingua (International Auxiliary Language Association)',
     541        'id' => 'Indonesian',
     542        'ik' => 'Inupiaq',
     543        'it' => 'Italian',
     544        'jv' => 'Javanese',
     545        'ja' => 'Japanese',
     546        'kl' => 'Kalaallisut; Greenlandic',
     547        'kn' => 'Kannada',
     548        'ks' => 'Kashmiri',
     549        'kr' => 'Kanuri',
     550        'kk' => 'Kazakh',
     551        'km' => 'Central Khmer',
     552        'ki' => 'Kikuyu; Gikuyu',
     553        'rw' => 'Kinyarwanda',
     554        'ky' => 'Kirghiz; Kyrgyz',
     555        'kv' => 'Komi',
     556        'kg' => 'Kongo',
     557        'ko' => 'Korean',
     558        'kj' => 'Kuanyama; Kwanyama',
     559        'ku' => 'Kurdish',
     560        'lo' => 'Lao',
     561        'la' => 'Latin',
     562        'lv' => 'Latvian',
     563        'li' => 'Limburgan; Limburger; Limburgish',
     564        'ln' => 'Lingala',
     565        'lt' => 'Lithuanian',
     566        'lb' => 'Luxembourgish; Letzeburgesch',
     567        'lu' => 'Luba-Katanga',
     568        'lg' => 'Ganda',
     569        'mk' => 'Macedonian',
     570        'mh' => 'Marshallese',
     571        'ml' => 'Malayalam',
     572        'mi' => 'Maori',
     573        'mr' => 'Marathi',
     574        'ms' => 'Malay',
     575        'mg' => 'Malagasy',
     576        'mt' => 'Maltese',
     577        'mo' => 'Moldavian',
     578        'mn' => 'Mongolian',
     579        'na' => 'Nauru',
     580        'nv' => 'Navajo; Navaho',
     581        'nr' => 'Ndebele, South; South Ndebele',
     582        'nd' => 'Ndebele, North; North Ndebele',
     583        'ng' => 'Ndonga',
     584        'ne' => 'Nepali',
     585        'nn' => 'Norwegian Nynorsk; Nynorsk, Norwegian',
     586        'nb' => 'Bokmål, Norwegian, Norwegian Bokmål',
     587        'no' => 'Norwegian',
     588        'ny' => 'Chichewa; Chewa; Nyanja',
     589        'oc' => 'Occitan, Provençal',
     590        'oj' => 'Ojibwa',
     591        'or' => 'Oriya',
     592        'om' => 'Oromo',
     593        'os' => 'Ossetian; Ossetic',
     594        'pa' => 'Panjabi; Punjabi',
     595        'fa' => 'Persian',
     596        'pi' => 'Pali',
     597        'pl' => 'Polish',
     598        'pt' => 'Portuguese',
     599        'ps' => 'Pushto',
     600        'qu' => 'Quechua',
     601        'rm' => 'Romansh',
     602        'ro' => 'Romanian',
     603        'rn' => 'Rundi',
     604        'ru' => 'Russian',
     605        'sg' => 'Sango',
     606        'sa' => 'Sanskrit',
     607        'sr' => 'Serbian',
     608        'hr' => 'Croatian',
     609        'si' => 'Sinhala; Sinhalese',
     610        'sk' => 'Slovak',
     611        'sl' => 'Slovenian',
     612        'se' => 'Northern Sami',
     613        'sm' => 'Samoan',
     614        'sn' => 'Shona',
     615        'sd' => 'Sindhi',
     616        'so' => 'Somali',
     617        'st' => 'Sotho, Southern',
     618        'es' => 'Spanish; Castilian',
     619        'sc' => 'Sardinian',
     620        'ss' => 'Swati',
     621        'su' => 'Sundanese',
     622        'sw' => 'Swahili',
     623        'sv' => 'Swedish',
     624        'ty' => 'Tahitian',
     625        'ta' => 'Tamil',
     626        'tt' => 'Tatar',
     627        'te' => 'Telugu',
     628        'tg' => 'Tajik',
     629        'tl' => 'Tagalog',
     630        'th' => 'Thai',
     631        'bo' => 'Tibetan',
     632        'ti' => 'Tigrinya',
     633        'to' => 'Tonga (Tonga Islands)',
     634        'tn' => 'Tswana',
     635        'ts' => 'Tsonga',
     636        'tk' => 'Turkmen',
     637        'tr' => 'Turkish',
     638        'tw' => 'Twi',
     639        'ug' => 'Uighur; Uyghur',
     640        'uk' => 'Ukrainian',
     641        'ur' => 'Urdu',
     642        'uz' => 'Uzbek',
     643        've' => 'Venda',
     644        'vi' => 'Vietnamese',
     645        'vo' => 'Volapük',
     646        'cy' => 'Welsh',
     647        'wa' => 'Walloon',
     648        'wo' => 'Wolof',
     649        'xh' => 'Xhosa',
     650        'yi' => 'Yiddish',
     651        'yo' => 'Yoruba',
     652        'za' => 'Zhuang; Chuang',
     653        'zu' => 'Zulu',
     654    );
    459655
    460656    /**
     
    501697 */
    502698function _access_denied_splash() {
    503     if ( ! is_user_logged_in() || is_network_admin() )
     699    if ( ! is_user_logged_in() || is_network_admin() ) {
    504700        return;
     701    }
    505702
    506703    $blogs = get_blogs_of_user( get_current_user_id() );
    507704
    508     if ( wp_list_filter( $blogs, array( 'userblog_id' => get_current_blog_id() ) ) )
     705    if ( wp_list_filter( $blogs, array( 'userblog_id' => get_current_blog_id() ) ) ) {
    509706        return;
     707    }
    510708
    511709    $blog_name = get_bloginfo( 'name' );
    512710
    513     if ( empty( $blogs ) )
     711    if ( empty( $blogs ) ) {
    514712        wp_die( sprintf( __( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ), $blog_name ), 403 );
    515 
    516     $output = '<p>' . sprintf( __( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ), $blog_name ) . '</p>';
     713    }
     714
     715    $output  = '<p>' . sprintf( __( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ), $blog_name ) . '</p>';
    517716    $output .= '<p>' . __( 'If you reached this screen by accident and meant to visit one of your own sites, here are some shortcuts to help you find your way.' ) . '</p>';
    518717
    519     $output .= '<h3>' . __('Your Sites') . '</h3>';
     718    $output .= '<h3>' . __( 'Your Sites' ) . '</h3>';
    520719    $output .= '<table>';
    521720
     
    524723        $output .= "<td>{$blog->blogname}</td>";
    525724        $output .= '<td><a href="' . esc_url( get_admin_url( $blog->userblog_id ) ) . '">' . __( 'Visit Dashboard' ) . '</a> | ' .
    526             '<a href="' . esc_url( get_home_url( $blog->userblog_id ) ). '">' . __( 'View Site' ) . '</a></td>';
     725            '<a href="' . esc_url( get_home_url( $blog->userblog_id ) ) . '">' . __( 'View Site' ) . '</a></td>';
    527726        $output .= '</tr>';
    528727    }
     
    559758 */
    560759function mu_dropdown_languages( $lang_files = array(), $current = '' ) {
    561     $flag = false;
     760    $flag   = false;
    562761    $output = array();
    563762
     
    566765
    567766        if ( $code_lang == 'en_US' ) { // American English
    568             $flag = true;
    569             $ae = __( 'American English' );
    570             $output[$ae] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $ae . '</option>';
     767            $flag          = true;
     768            $ae            = __( 'American English' );
     769            $output[ $ae ] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $ae . '</option>';
    571770        } elseif ( $code_lang == 'en_GB' ) { // British English
    572             $flag = true;
    573             $be = __( 'British English' );
    574             $output[$be] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $be . '</option>';
     771            $flag          = true;
     772            $be            = __( 'British English' );
     773            $output[ $be ] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $be . '</option>';
    575774        } else {
    576             $translated = format_code_lang( $code_lang );
    577             $output[$translated] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . esc_html ( $translated ) . '</option>';
    578         }
    579 
    580     }
    581 
    582     if ( $flag === false ) // WordPress english
    583         $output[] = '<option value=""' . selected( $current, '', false ) . '>' . __( 'English' ) . "</option>";
     775            $translated            = format_code_lang( $code_lang );
     776            $output[ $translated ] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . esc_html( $translated ) . '</option>';
     777        }
     778    }
     779
     780    if ( $flag === false ) { // WordPress english
     781        $output[] = '<option value=""' . selected( $current, '', false ) . '>' . __( 'English' ) . '</option>';
     782    }
    584783
    585784    // Order by name
     
    622821
    623822    if ( get_site_option( 'wpmu_upgrade_site' ) != $wp_db_version ) {
    624         echo "<div class='update-nag'>" . sprintf( __( 'Thank you for Updating! Please visit the <a href="%s">Upgrade Network</a> page to update all your sites.' ), esc_url( network_admin_url( 'upgrade.php' ) ) ) . "</div>";
     823        echo "<div class='update-nag'>" . sprintf( __( 'Thank you for Updating! Please visit the <a href="%s">Upgrade Network</a> page to update all your sites.' ), esc_url( network_admin_url( 'upgrade.php' ) ) ) . '</div>';
    625824    }
    626825}
     
    639838 */
    640839function avoid_blog_page_permalink_collision( $data, $postarr ) {
    641     if ( is_subdomain_install() )
     840    if ( is_subdomain_install() ) {
    642841        return $data;
    643     if ( $data['post_type'] != 'page' )
     842    }
     843    if ( $data['post_type'] != 'page' ) {
    644844        return $data;
    645     if ( !isset( $data['post_name'] ) || $data['post_name'] == '' )
     845    }
     846    if ( ! isset( $data['post_name'] ) || $data['post_name'] == '' ) {
    646847        return $data;
    647     if ( !is_main_site() )
     848    }
     849    if ( ! is_main_site() ) {
    648850        return $data;
     851    }
    649852
    650853    $post_name = $data['post_name'];
    651     $c = 0;
    652     while( $c < 10 && get_id_from_blogname( $post_name ) ) {
     854    $c         = 0;
     855    while ( $c < 10 && get_id_from_blogname( $post_name ) ) {
    653856        $post_name .= mt_rand( 1, 10 );
    654857        $c ++;
     
    676879        <td>
    677880        <?php
    678         $all_blogs = get_blogs_of_user( get_current_user_id() );
     881        $all_blogs    = get_blogs_of_user( get_current_user_id() );
    679882        $primary_blog = get_user_meta( get_current_user_id(), 'primary_blog', true );
    680883        if ( count( $all_blogs ) > 1 ) {
     
    682885            ?>
    683886            <select name="primary_blog" id="primary_blog">
    684                 <?php foreach ( (array) $all_blogs as $blog ) {
    685                     if ( $primary_blog == $blog->userblog_id )
     887                <?php
     888                foreach ( (array) $all_blogs as $blog ) {
     889                    if ( $primary_blog == $blog->userblog_id ) {
    686890                        $found = true;
    687                     ?><option value="<?php echo $blog->userblog_id ?>"<?php selected( $primary_blog, $blog->userblog_id ); ?>><?php echo esc_url( get_home_url( $blog->userblog_id ) ) ?></option><?php
    688                 } ?>
     891                    }
     892                    ?>
     893                    <option value="<?php echo $blog->userblog_id; ?>"<?php selected( $primary_blog, $blog->userblog_id ); ?>><?php echo esc_url( get_home_url( $blog->userblog_id ) ); ?></option>
     894                    <?php
     895                }
     896                ?>
    689897            </select>
    690898            <?php
    691             if ( !$found ) {
     899            if ( ! $found ) {
    692900                $blog = reset( $all_blogs );
    693901                update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );
     
    696904            $blog = reset( $all_blogs );
    697905            echo esc_url( get_home_url( $blog->userblog_id ) );
    698             if ( $primary_blog != $blog->userblog_id ) // Set the primary blog again if it's out of sync with blog list.
     906            if ( $primary_blog != $blog->userblog_id ) { // Set the primary blog again if it's out of sync with blog list.
    699907                update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );
     908            }
    700909        } else {
    701             echo "N/A";
     910            echo 'N/A';
    702911        }
    703912        ?>
     
    720929 */
    721930function can_edit_network( $network_id ) {
    722     if ( $network_id == get_current_network_id() )
     931    if ( $network_id == get_current_network_id() ) {
    723932        $result = true;
    724     else
     933    } else {
    725934        $result = false;
     935    }
    726936
    727937    /**
     
    752962
    753963/**
    754  *
    755964 * @param array $users
    756965 */
     
    774983    wp_nonce_field( 'ms-users-delete' );
    775984    $site_admins = get_super_admins();
    776     $admin_out = '<option value="' . esc_attr( $current_user->ID ) . '">' . $current_user->user_login . '</option>'; ?>
     985    $admin_out   = '<option value="' . esc_attr( $current_user->ID ) . '">' . $current_user->user_login . '</option>';
     986    ?>
    777987    <table class="form-table">
    778     <?php foreach ( ( $allusers = (array) $_POST['allusers'] ) as $user_id ) {
     988    <?php
     989    foreach ( ( $allusers = (array) $_POST['allusers'] ) as $user_id ) {
    779990        if ( $user_id != '' && $user_id != '0' ) {
    780991            $delete_user = get_userdata( $user_id );
     
    7921003                    <?php echo '<input type="hidden" name="user[]" value="' . esc_attr( $user_id ) . '" />' . "\n"; ?>
    7931004                </th>
    794             <?php $blogs = get_blogs_of_user( $user_id, true );
     1005            <?php
     1006            $blogs = get_blogs_of_user( $user_id, true );
    7951007
    7961008            if ( ! empty( $blogs ) ) {
    7971009                ?>
    798                 <td><fieldset><p><legend><?php printf(
     1010                <td><fieldset><p><legend>
     1011                <?php
     1012                printf(
    7991013                    /* translators: user login */
    8001014                    __( 'What should be done with content owned by %s?' ),
    8011015                    '<em>' . $delete_user->user_login . '</em>'
    802                 ); ?></legend></p>
     1016                );
     1017                ?>
     1018                </legend></p>
    8031019                <?php
    8041020                foreach ( (array) $blogs as $key => $details ) {
    805                     $blog_users = get_users( array( 'blog_id' => $details->userblog_id, 'fields' => array( 'ID', 'user_login' ) ) );
    806                     if ( is_array( $blog_users ) && !empty( $blog_users ) ) {
    807                         $user_site = "<a href='" . esc_url( get_home_url( $details->userblog_id ) ) . "'>{$details->blogname}</a>";
    808                         $user_dropdown = '<label for="reassign_user" class="screen-reader-text">' . __( 'Select a user' ) . '</label>';
     1021                    $blog_users = get_users(
     1022                        array(
     1023                            'blog_id' => $details->userblog_id,
     1024                            'fields'  => array( 'ID', 'user_login' ),
     1025                        )
     1026                    );
     1027                    if ( is_array( $blog_users ) && ! empty( $blog_users ) ) {
     1028                        $user_site      = "<a href='" . esc_url( get_home_url( $details->userblog_id ) ) . "'>{$details->blogname}</a>";
     1029                        $user_dropdown  = '<label for="reassign_user" class="screen-reader-text">' . __( 'Select a user' ) . '</label>';
    8091030                        $user_dropdown .= "<select name='blog[$user_id][$key]' id='reassign_user'>";
    810                         $user_list = '';
     1031                        $user_list      = '';
    8111032                        foreach ( $blog_users as $user ) {
    8121033                            if ( ! in_array( $user->ID, $allusers ) ) {
     
    8221043                        <ul style="list-style:none;">
    8231044                            <li><?php printf( __( 'Site: %s' ), $user_site ); ?></li>
    824                             <li><label><input type="radio" id="delete_option0" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="delete" checked="checked" />
     1045                            <li><label><input type="radio" id="delete_option0" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID; ?>]" value="delete" checked="checked" />
    8251046                            <?php _e( 'Delete all content.' ); ?></label></li>
    826                             <li><label><input type="radio" id="delete_option1" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="reassign" />
     1047                            <li><label><input type="radio" id="delete_option1" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID; ?>]" value="reassign" />
    8271048                            <?php _e( 'Attribute all content to:' ); ?></label>
    8281049                            <?php echo $user_dropdown; ?></li>
     
    8311052                    }
    8321053                }
    833                 echo "</fieldset></td></tr>";
     1054                echo '</fieldset></td></tr>';
    8341055            } else {
    8351056                ?>
     
    8471068    do_action( 'delete_user_form', $current_user, $allusers );
    8481069
    849     if ( 1 == count( $users ) ) : ?>
     1070    if ( 1 == count( $users ) ) :
     1071    ?>
    8501072        <p><?php _e( 'Once you hit &#8220;Confirm Deletion&#8221;, the user will be permanently removed.' ); ?></p>
    8511073    <?php else : ?>
    8521074        <p><?php _e( 'Once you hit &#8220;Confirm Deletion&#8221;, these users will be permanently removed.' ); ?></p>
    853     <?php endif;
    854 
    855     submit_button( __('Confirm Deletion'), 'primary' );
     1075    <?php
     1076    endif;
     1077
     1078    submit_button( __( 'Confirm Deletion' ), 'primary' );
    8561079    ?>
    8571080    </form>
     
    9161139     * }
    9171140     */
    918     $links = apply_filters( 'network_edit_site_nav_links', array(
    919         'site-info'     => array( 'label' => __( 'Info' ),     'url' => 'site-info.php',     'cap' => 'manage_sites' ),
    920         'site-users'    => array( 'label' => __( 'Users' ),    'url' => 'site-users.php',    'cap' => 'manage_sites' ),
    921         'site-themes'   => array( 'label' => __( 'Themes' ),   'url' => 'site-themes.php',   'cap' => 'manage_sites' ),
    922         'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php', 'cap' => 'manage_sites' )
    923     ) );
     1141    $links = apply_filters(
     1142        'network_edit_site_nav_links', array(
     1143            'site-info'     => array(
     1144                'label' => __( 'Info' ),
     1145                'url'   => 'site-info.php',
     1146                'cap'   => 'manage_sites',
     1147            ),
     1148            'site-users'    => array(
     1149                'label' => __( 'Users' ),
     1150                'url'   => 'site-users.php',
     1151                'cap'   => 'manage_sites',
     1152            ),
     1153            'site-themes'   => array(
     1154                'label' => __( 'Themes' ),
     1155                'url'   => 'site-themes.php',
     1156                'cap'   => 'manage_sites',
     1157            ),
     1158            'site-settings' => array(
     1159                'label' => __( 'Settings' ),
     1160                'url'   => 'site-settings.php',
     1161                'cap'   => 'manage_sites',
     1162            ),
     1163        )
     1164    );
    9241165
    9251166    // Parse arguments
    926     $r = wp_parse_args( $args, array(
    927         'blog_id'  => isset( $_GET['blog_id'] ) ? (int) $_GET['blog_id'] : 0,
    928         'links'    => $links,
    929         'selected' => 'site-info',
    930     ) );
     1167    $r = wp_parse_args(
     1168        $args, array(
     1169            'blog_id'  => isset( $_GET['blog_id'] ) ? (int) $_GET['blog_id'] : 0,
     1170            'links'    => $links,
     1171            'selected' => 'site-info',
     1172        )
     1173    );
    9311174
    9321175    // Setup the links array
     
    9751218    return array(
    9761219        'id'      => 'overview',
    977         'title'   => __('Overview'),
     1220        'title'   => __( 'Overview' ),
    9781221        'content' =>
    979             '<p>' . __('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.') . '</p>' .
    980             '<p>' . __('<strong>Info</strong> &mdash; The site URL is rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.') . '</p>' .
    981             '<p>' . __('<strong>Users</strong> &mdash; This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.') . '</p>' .
    982             '<p>' . sprintf( __('<strong>Themes</strong> &mdash; This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site&#8217;s Appearance menu. To enable a theme for the entire network, see the <a href="%s">Network Themes</a> screen.' ), network_admin_url( 'themes.php' ) ) . '</p>' .
    983             '<p>' . __('<strong>Settings</strong> &mdash; This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.') . '</p>'
     1222            '<p>' . __( 'The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.' ) . '</p>' .
     1223            '<p>' . __( '<strong>Info</strong> &mdash; The site URL is rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.' ) . '</p>' .
     1224            '<p>' . __( '<strong>Users</strong> &mdash; This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.' ) . '</p>' .
     1225            '<p>' . sprintf( __( '<strong>Themes</strong> &mdash; This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site&#8217;s Appearance menu. To enable a theme for the entire network, see the <a href="%s">Network Themes</a> screen.' ), network_admin_url( 'themes.php' ) ) . '</p>' .
     1226            '<p>' . __( '<strong>Settings</strong> &mdash; This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.' ) . '</p>',
    9841227    );
    9851228}
     
    9931236 */
    9941237function get_site_screen_help_sidebar_content() {
    995     return '<p><strong>' . __('For more information:') . '</strong></p>' .
    996         '<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen">Documentation on Site Management</a>') . '</p>' .
    997         '<p>' . __('<a href="https://wordpress.org/support/forum/multisite/">Support Forums</a>') . '</p>';
    998 }
     1238    return '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
     1239        '<p>' . __( '<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen">Documentation on Site Management</a>' ) . '</p>' .
     1240        '<p>' . __( '<a href="https://wordpress.org/support/forum/multisite/">Support Forums</a>' ) . '</p>';
     1241}
Note: See TracChangeset for help on using the changeset viewer.