Changeset 42343 for trunk/src/wp-admin/includes/ms.php
- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/ms.php
r41289 r42343 17 17 */ 18 18 function check_upload_size( $file ) { 19 if ( get_site_option( 'upload_space_check_disabled' ) ) 19 if ( get_site_option( 'upload_space_check_disabled' ) ) { 20 20 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 23 24 return $file; 24 25 if ( defined( 'WP_IMPORTING' ) ) 25 } 26 27 if ( defined( 'WP_IMPORTING' ) ) { 26 28 return $file; 29 } 27 30 28 31 $space_left = get_upload_space_available(); … … 80 83 do_action( 'delete_blog', $blog_id, $drop ); 81 84 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 ); 83 91 84 92 // Remove users from this blog. … … 138 146 * @param int $blog_id The site ID. 139 147 */ 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 ); 142 150 $top_dir = $dir; 143 $stack = array($dir);144 $index = 0;151 $stack = array( $dir ); 152 $index = 0; 145 153 146 154 while ( $index < count( $stack ) ) { 147 155 // Get indexed directory from stack 148 $dir = $stack[ $index];156 $dir = $stack[ $index ]; 149 157 150 158 $dh = @opendir( $dir ); 151 159 if ( $dh ) { 152 160 while ( ( $file = @readdir( $dh ) ) !== false ) { 153 if ( $file == '.' || $file == '..' ) 161 if ( $file == '.' || $file == '..' ) { 154 162 continue; 163 } 155 164 156 165 if ( @is_dir( $dir . DIRECTORY_SEPARATOR . $file ) ) { … … 167 176 $stack = array_reverse( $stack ); // Last added dirs are deepest 168 177 foreach ( (array) $stack as $dir ) { 169 if ( $dir != $top_dir) 170 @rmdir( $dir ); 178 if ( $dir != $top_dir ) { 179 @rmdir( $dir ); 180 } 171 181 } 172 182 … … 184 194 do_action( 'deleted_blog', $blog_id, $drop ); 185 195 186 if ( $switch ) 196 if ( $switch ) { 187 197 restore_current_blog(); 198 } 188 199 } 189 200 … … 207 218 } 208 219 209 $id = (int) $id;220 $id = (int) $id; 210 221 $user = new WP_User( $id ); 211 222 212 if ( ! $user->exists() )223 if ( ! $user->exists() ) { 213 224 return false; 225 } 214 226 215 227 // Global super-administrators are protected, and cannot be deleted. … … 244 256 245 257 if ( $link_ids ) { 246 foreach ( $link_ids as $link_id ) 258 foreach ( $link_ids as $link_id ) { 247 259 wp_delete_link( $link_id ); 260 } 248 261 } 249 262 … … 253 266 254 267 $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 ) { 256 269 delete_metadata_by_mid( 'user', $mid ); 270 } 257 271 258 272 $wpdb->delete( $wpdb->users, array( 'ID' => $id ) ); … … 275 289 */ 276 290 function 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' ) ) { 278 292 return false; 293 } 279 294 280 295 $space_allowed = get_space_allowed(); … … 285 300 286 301 if ( ( $space_allowed - $space_used ) < 0 ) { 287 if ( $echo ) 302 if ( $echo ) { 288 303 _e( 'Sorry, you have used your space allocation. Please delete some files to upload more files.' ); 304 } 289 305 return true; 290 306 } else { … … 300 316 function display_space_usage() { 301 317 $space_allowed = get_space_allowed(); 302 $space_used = get_space_used();318 $space_used = get_space_used(); 303 319 304 320 $percent_used = ( $space_used / $space_allowed ) * 100; … … 314 330 } 315 331 ?> 316 <strong><?php 332 <strong> 333 <?php 317 334 /* translators: Storage space that's been used. 1: Percentage of used space, 2: Total space allowed in megabytes or gigabytes */ 318 335 printf( __( 'Used: %1$s%% of %2$s' ), number_format( $percent_used ), $space ); 319 ?></strong> 336 ?> 337 </strong> 320 338 <?php 321 339 } … … 349 367 restore_current_blog(); 350 368 351 if ( ! $quota )369 if ( ! $quota ) { 352 370 $quota = ''; 371 } 353 372 354 373 ?> … … 382 401 global $wpdb; 383 402 384 if ( null !== $deprecated ) 403 if ( null !== $deprecated ) { 385 404 _deprecated_argument( __FUNCTION__, '3.0.2' ); 405 } 386 406 387 407 $wpdb->update( $wpdb->users, array( sanitize_key( $pref ) => $value ), array( 'ID' => $id ) ); … … 426 446 $id = (int) $id; 427 447 428 if ( ! $user = get_userdata( $id ) )448 if ( ! $user = get_userdata( $id ) ) { 429 449 return false; 450 } 430 451 431 452 clean_user_cache( $user ); … … 444 465 */ 445 466 function format_code_lang( $code = '' ) { 446 $code = strtolower( substr( $code, 0, 2 ) );467 $code = strtolower( substr( $code, 0, 2 ) ); 447 468 $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 ); 459 655 460 656 /** … … 501 697 */ 502 698 function _access_denied_splash() { 503 if ( ! is_user_logged_in() || is_network_admin() ) 699 if ( ! is_user_logged_in() || is_network_admin() ) { 504 700 return; 701 } 505 702 506 703 $blogs = get_blogs_of_user( get_current_user_id() ); 507 704 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() ) ) ) { 509 706 return; 707 } 510 708 511 709 $blog_name = get_bloginfo( 'name' ); 512 710 513 if ( empty( $blogs ) ) 711 if ( empty( $blogs ) ) { 514 712 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>'; 517 716 $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>'; 518 717 519 $output .= '<h3>' . __( 'Your Sites') . '</h3>';718 $output .= '<h3>' . __( 'Your Sites' ) . '</h3>'; 520 719 $output .= '<table>'; 521 720 … … 524 723 $output .= "<td>{$blog->blogname}</td>"; 525 724 $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>'; 527 726 $output .= '</tr>'; 528 727 } … … 559 758 */ 560 759 function mu_dropdown_languages( $lang_files = array(), $current = '' ) { 561 $flag = false;760 $flag = false; 562 761 $output = array(); 563 762 … … 566 765 567 766 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>'; 571 770 } 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>'; 575 774 } 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 english583 $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 } 584 783 585 784 // Order by name … … 622 821 623 822 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>'; 625 824 } 626 825 } … … 639 838 */ 640 839 function avoid_blog_page_permalink_collision( $data, $postarr ) { 641 if ( is_subdomain_install() ) 840 if ( is_subdomain_install() ) { 642 841 return $data; 643 if ( $data['post_type'] != 'page' ) 842 } 843 if ( $data['post_type'] != 'page' ) { 644 844 return $data; 645 if ( !isset( $data['post_name'] ) || $data['post_name'] == '' ) 845 } 846 if ( ! isset( $data['post_name'] ) || $data['post_name'] == '' ) { 646 847 return $data; 647 if ( !is_main_site() ) 848 } 849 if ( ! is_main_site() ) { 648 850 return $data; 851 } 649 852 650 853 $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 ) ) { 653 856 $post_name .= mt_rand( 1, 10 ); 654 857 $c ++; … … 676 879 <td> 677 880 <?php 678 $all_blogs = get_blogs_of_user( get_current_user_id() );881 $all_blogs = get_blogs_of_user( get_current_user_id() ); 679 882 $primary_blog = get_user_meta( get_current_user_id(), 'primary_blog', true ); 680 883 if ( count( $all_blogs ) > 1 ) { … … 682 885 ?> 683 886 <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 ) { 686 890 $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 ?> 689 897 </select> 690 898 <?php 691 if ( ! $found ) {899 if ( ! $found ) { 692 900 $blog = reset( $all_blogs ); 693 901 update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id ); … … 696 904 $blog = reset( $all_blogs ); 697 905 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. 699 907 update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id ); 908 } 700 909 } else { 701 echo "N/A";910 echo 'N/A'; 702 911 } 703 912 ?> … … 720 929 */ 721 930 function can_edit_network( $network_id ) { 722 if ( $network_id == get_current_network_id() ) 931 if ( $network_id == get_current_network_id() ) { 723 932 $result = true; 724 else933 } else { 725 934 $result = false; 935 } 726 936 727 937 /** … … 752 962 753 963 /** 754 *755 964 * @param array $users 756 965 */ … … 774 983 wp_nonce_field( 'ms-users-delete' ); 775 984 $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 ?> 777 987 <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 ) { 779 990 if ( $user_id != '' && $user_id != '0' ) { 780 991 $delete_user = get_userdata( $user_id ); … … 792 1003 <?php echo '<input type="hidden" name="user[]" value="' . esc_attr( $user_id ) . '" />' . "\n"; ?> 793 1004 </th> 794 <?php $blogs = get_blogs_of_user( $user_id, true ); 1005 <?php 1006 $blogs = get_blogs_of_user( $user_id, true ); 795 1007 796 1008 if ( ! empty( $blogs ) ) { 797 1009 ?> 798 <td><fieldset><p><legend><?php printf( 1010 <td><fieldset><p><legend> 1011 <?php 1012 printf( 799 1013 /* translators: user login */ 800 1014 __( 'What should be done with content owned by %s?' ), 801 1015 '<em>' . $delete_user->user_login . '</em>' 802 ); ?></legend></p> 1016 ); 1017 ?> 1018 </legend></p> 803 1019 <?php 804 1020 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>'; 809 1030 $user_dropdown .= "<select name='blog[$user_id][$key]' id='reassign_user'>"; 810 $user_list = '';1031 $user_list = ''; 811 1032 foreach ( $blog_users as $user ) { 812 1033 if ( ! in_array( $user->ID, $allusers ) ) { … … 822 1043 <ul style="list-style:none;"> 823 1044 <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" /> 825 1046 <?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" /> 827 1048 <?php _e( 'Attribute all content to:' ); ?></label> 828 1049 <?php echo $user_dropdown; ?></li> … … 831 1052 } 832 1053 } 833 echo "</fieldset></td></tr>";1054 echo '</fieldset></td></tr>'; 834 1055 } else { 835 1056 ?> … … 847 1068 do_action( 'delete_user_form', $current_user, $allusers ); 848 1069 849 if ( 1 == count( $users ) ) : ?> 1070 if ( 1 == count( $users ) ) : 1071 ?> 850 1072 <p><?php _e( 'Once you hit “Confirm Deletion”, the user will be permanently removed.' ); ?></p> 851 1073 <?php else : ?> 852 1074 <p><?php _e( 'Once you hit “Confirm Deletion”, 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' ); 856 1079 ?> 857 1080 </form> … … 916 1139 * } 917 1140 */ 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 ); 924 1165 925 1166 // 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 ); 931 1174 932 1175 // Setup the links array … … 975 1218 return array( 976 1219 'id' => 'overview', 977 'title' => __( 'Overview'),1220 'title' => __( 'Overview' ), 978 1221 '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> — 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> — 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> — 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’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> — 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> — 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> — 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> — 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’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> — 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>', 984 1227 ); 985 1228 } … … 993 1236 */ 994 1237 function 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.