Ticket #25229: wp-admin-includes-ms.diff
File wp-admin-includes-ms.diff, 10.2 KB (added by , 11 years ago) |
---|
-
src/wp-admin/includes/ms.php
61 61 } 62 62 63 63 $blog = get_blog_details( $blog_id ); 64 64 /** 65 * Fires before a blog is deleted. 66 * 67 * @since 3.0.0 68 * 69 * @param int $blog_id The blog ID. 70 * @param bool $drop True if blog's table should be dropped. Default is false. 71 */ 65 72 do_action( 'delete_blog', $blog_id, $drop ); 66 73 67 74 $users = get_users( array( 'blog_id' => $blog_id, 'fields' => 'ids' ) ); … … 80 87 $drop = false; 81 88 82 89 if ( $drop ) { 83 $drop_tables = apply_filters( 'wpmu_drop_tables', $wpdb->tables( 'blog' ), $blog_id ); 90 $tables = $wpdb->tables( 'blog' ); 91 /** 92 * Filter the tables to drop when the blog is deleted. 93 * 94 * @since 3.0.0 95 * 96 * @param array $tables The blog tables to be dropped. 97 * @param int $blog_id The id of the blog to drop tables for. 98 */ 99 $drop_tables = apply_filters( 'wpmu_drop_tables', $tables, $blog_id ); 84 100 85 101 foreach ( (array) $drop_tables as $table ) { 86 102 $wpdb->query( "DROP TABLE IF EXISTS `$table`" ); … … 89 105 $wpdb->delete( $wpdb->blogs, array( 'blog_id' => $blog_id ) ); 90 106 91 107 $uploads = wp_upload_dir(); 108 /** 109 * Filter the upload base directory to delete when the blog is deleted. 110 * 111 * @since 3.0.0 112 * 113 * @param string $uploads['basedir'] Uploads path without subdirectory. @see wp_upload_dir() 114 * @param int $blog_id The blog id. 115 */ 92 116 $dir = apply_filters( 'wpmu_delete_blog_upload_dir', $uploads['basedir'], $blog_id ); 93 117 $dir = rtrim( $dir, DIRECTORY_SEPARATOR ); 94 118 $top_dir = $dir; … … 137 161 138 162 if ( !$user->exists() ) 139 163 return false; 140 164 /** 165 * Fires when a user is deleted from the network. 166 * 167 * @since 3.0.0 168 * 169 * @param int $id User id of the user about to be deleted from the network. 170 */ 141 171 do_action( 'wpmu_delete_user', $id ); 142 172 143 173 $blogs = get_blogs_of_user( $id ); … … 172 202 173 203 clean_user_cache( $user ); 174 204 175 // allow for commit transaction 205 /** 206 * Fires after the user is deleted. 207 * 208 * @since 2.8.0 209 * 210 * @param int $id User id of the user about to be deleted from the network. 211 */ 176 212 do_action( 'deleted_user', $id ); 177 213 178 214 return true; … … 190 226 ); 191 227 update_option( 'adminhash', $new_admin_email ); 192 228 193 $ content = apply_filters( 'new_admin_email_content', __( "Dear user,229 $email_text = __( 'Dear user, 194 230 195 231 You recently requested to have the administration email address on 196 232 your site changed. … … 204 240 205 241 Regards, 206 242 All at ###SITENAME### 207 ###SITEURL### "), $new_admin_email);243 ###SITEURL###' ); 208 244 245 /** 246 * Filter the email text sent when the site admin email is changed. 247 * 248 * The following strings have a special meaning and will get replaced dynamically: 249 * ###ADMIN_URL### The link to click on to confirm the email change. Required otherwise this functunalty is will break. 250 * ###EMAIL### The new email. 251 * ###SITENAME### The name of the site. 252 * ###SITEURL### The url to the site. 253 * 254 * @since 3.0.0 255 * 256 * @param string $email_text Text in the email. 257 * @param string $new_admin_email New admin email that the current administration email was changed to. 258 */ 259 $content = apply_filters( 'new_admin_email_content', $email_text, $new_admin_email ); 260 209 261 $content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'options.php?adminhash='.$hash ) ), $content ); 210 262 $content = str_replace( '###EMAIL###', $value, $content ); 211 263 $content = str_replace( '###SITENAME###', get_site_option( 'site_name' ), $content ); … … 243 295 'newemail' => $_POST['email'] 244 296 ); 245 297 update_option( $current_user->ID . '_new_email', $new_user_email ); 298 299 $email_text = __( 'Dear user, 246 300 247 $content = apply_filters( 'new_user_email_content', __( "Dear user,248 249 301 You recently requested to have the email address on your account changed. 250 302 If this is correct, please click on the following link to change it: 251 303 ###ADMIN_URL### … … 257 309 258 310 Regards, 259 311 All at ###SITENAME### 260 ###SITEURL### " ), $new_user_email);312 ###SITEURL###' ); 261 313 314 /** 315 * Filter the email text sent when a user changes emails. 316 * 317 * The following strings have a special meaning and will get replaced dynamically: 318 * ###ADMIN_URL### The link to click on to confirm the email change. Required otherwise this functunalty is will break. 319 * ###EMAIL### The new email. 320 * ###SITENAME### The name of the site. 321 * ###SITEURL### The url to the site. 322 * 323 * @since 3.0.0 324 * 325 * @param string $email_text Text in the email. 326 * @param string $new_user_email New user email that the current user has changed to. 327 */ 328 $content = apply_filters( 'new_user_email_content', $email_text, $new_user_email ); 329 262 330 $content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'profile.php?newuseremail='.$hash ) ), $content ); 263 331 $content = str_replace( '###EMAIL###', $_POST['email'], $content); 264 332 $content = str_replace( '###SITENAME###', get_site_option( 'site_name' ), $content ); … … 377 445 clean_user_cache( $user ); 378 446 379 447 if ( $pref == 'spam' ) { 380 if ( $value == 1 ) 448 if ( $value == 1 ) { 449 /** 450 * Fires when the user is marked as a SPAM user. 451 * 452 * @since 3.0.0 453 * 454 * @param int $id User id of the user marked as SPAM. 455 */ 381 456 do_action( 'make_spam_user', $id ); 382 else 457 } else { 458 /** 459 * Fires when the user is marked as a HAM user. Opposite of SPAM. 460 * 461 * @since 3.0.0 462 * 463 * @param int $id User id of the user marked as HAM. 464 */ 383 465 do_action( 'make_ham_user', $id ); 466 } 384 467 } 385 468 386 469 return $value; … … 411 494 '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', 412 495 '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', 413 496 've' => 'Venda', 'vi' => 'Vietnamese', 'vo' => 'Volapük', 'cy' => 'Welsh','wa' => 'Walloon','wo' => 'Wolof', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'za' => 'Zhuang; Chuang', 'zu' => 'Zulu' ); 497 498 /** 499 * Filter the language codes. 500 * 501 * @since 3.0.0 502 * 503 * @param array $lang_codes Key/value pair of language codes where key is the short version. 504 * @param string $code A two-letter designation of the language. 505 */ 414 506 $lang_codes = apply_filters( 'lang_codes', $lang_codes, $code ); 415 507 return strtr( $code, $lang_codes ); 416 508 } … … 498 590 499 591 // Order by name 500 592 uksort( $output, 'strnatcasecmp' ); 501 593 /** 594 * Filter the languages available in the drop-down. 595 * 596 * @since 3.0.0 597 * 598 * @param array $output HTML output of the dropdown. 599 * @param array $lang_files Available language files. 600 * @param string $current The current language code. 601 */ 502 602 $output = apply_filters( 'mu_dropdown_languages', $output, $lang_files, $current ); 503 603 echo implode( "\n\t", $output ); 504 604 } … … 575 675 <?php if ( in_array( get_site_option( 'registration' ), array( 'all', 'blog' ) ) ) : ?> 576 676 <tr> 577 677 <th scope="row" colspan="2" class="th-full"> 578 <a href="<?php echo apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) ); ?>"><?php _e( 'Create a New Site' ); ?></a> 678 <?php 679 $sign_up_url = network_site_url( 'wp-signup.php' ); 680 /** 681 * Filter the site sign up URL. 682 * 683 * @since 3.0.0 684 * 685 * @param string $sign_up_url The site sign up URL. 686 */ 687 ?> 688 <a href="<?php echo apply_filters( 'wp_signup_location', $sign_up_url ); ?>"><?php _e( 'Create a New Site' ); ?></a> 579 689 </th> 580 690 </tr> 581 691 <?php endif; ?> … … 595 705 // If global super_admins override is defined, there is nothing to do here. 596 706 if ( isset($super_admins) ) 597 707 return false; 598 708 709 /** 710 * Fires before the user is granted Super Admin privileges. 711 * 712 * @since 3.0.0 713 * 714 * @param int $user_id User id of the user granted Super Admin privileges. 715 */ 599 716 do_action( 'grant_super_admin', $user_id ); 600 717 601 718 // Directly fetch site_admins instead of using get_super_admins() … … 605 722 if ( $user && ! in_array( $user->user_login, $super_admins ) ) { 606 723 $super_admins[] = $user->user_login; 607 724 update_site_option( 'site_admins' , $super_admins ); 725 726 /** 727 * Fires after the user granted Super Admin privileges. 728 * 729 * @since 3.0.0 730 * 731 * @param int $user_id User id of the user granted Super Admin privileges. 732 */ 608 733 do_action( 'granted_super_admin', $user_id ); 609 734 return true; 610 735 } … … 623 748 // If global super_admins override is defined, there is nothing to do here. 624 749 if ( isset($super_admins) ) 625 750 return false; 626 751 /** 752 * Fires before the user's Super Admin privileges are revoked. 753 * 754 * @since 3.0.0 755 * 756 * @param int $user_id User id of the user Super Admin privileges are being revoked from. 757 */ 627 758 do_action( 'revoke_super_admin', $user_id ); 628 759 629 760 // Directly fetch site_admins instead of using get_super_admins() … … 634 765 if ( false !== ( $key = array_search( $user->user_login, $super_admins ) ) ) { 635 766 unset( $super_admins[$key] ); 636 767 update_site_option( 'site_admins', $super_admins ); 768 769 /** 770 * Fires after the user's Super Admin privileges are revoked. 771 * 772 * @since 3.0.0 773 * 774 * @param int $user_id User id of the user Super Admin privileges were revoked from. 775 */ 637 776 do_action( 'revoked_super_admin', $user_id ); 638 777 return true; 639 778 } … … 656 795 $result = true; 657 796 else 658 797 $result = false; 659 798 /** 799 * Filter whether this network can be edited from this page. 800 * 801 * @since 3.1.0 802 * 803 * @param bool $result Whether the network can be edited from this page. 804 * @param int $site_id The network/site id to check. 805 */ 660 806 return apply_filters( 'can_edit_network', $result, $site_id ); 661 807 } 662 808