Changeset 32611 for trunk/src/wp-includes/ms-functions.php
- Timestamp:
- 05/26/2015 09:50:13 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ms-functions.php
r32381 r32611 29 29 * @since MU 1.0 30 30 * 31 * @global wpdb $wpdb 32 * 31 33 * @param string $sitedomain Optional. Site domain. 32 * @param string $path Optional. Site path.33 * @return array The network admins34 * @param string $path Optional. Site path. 35 * @return array|false The network admins 34 36 */ 35 37 function get_admin_users_for_domain( $sitedomain = '', $path = '' ) { … … 58 60 * @since MU 1.0 59 61 * 62 * @global wpdb $wpdb 63 * 60 64 * @param int $user_id The unique ID of the user 61 * @return object The blog object65 * @return object|void The blog object 62 66 */ 63 67 function get_active_blog_for_user( $user_id ) { … … 65 69 $blogs = get_blogs_of_user( $user_id ); 66 70 if ( empty( $blogs ) ) 67 return null;71 return; 68 72 69 73 if ( !is_multisite() ) … … 104 108 } 105 109 } else { 106 return null;110 return; 107 111 } 108 112 return $ret; … … 167 171 * @since MU 1.0 168 172 * 169 * @param int $blog_id ID of the blog you're adding the user to.170 * @param int $user_id ID of the user you're adding.171 * @param string $role The role you want the user to have172 * @return bool173 * @param int $blog_id ID of the blog you're adding the user to. 174 * @param int $user_id ID of the user you're adding. 175 * @param string $role The role you want the user to have 176 * @return true|WP_Error 173 177 */ 174 178 function add_user_to_blog( $blog_id, $user_id, $role ) { … … 216 220 * @since MU 1.0 217 221 * 218 * @param int $user_id ID of the user you're removing. 219 * @param int $blog_id ID of the blog you're removing the user from. 222 * @global wpdb $wpdb 223 * 224 * @param int $user_id ID of the user you're removing. 225 * @param int $blog_id ID of the blog you're removing the user from. 220 226 * @param string $reassign Optional. A user to whom to reassign posts. 221 * @return bool227 * @return true|WP_Error 222 228 */ 223 229 function remove_user_from_blog($user_id, $blog_id = '', $reassign = '') { … … 295 301 * @since MU 1.0 296 302 * 297 * @param string $domain The new blog's domain.298 * @param string $path The new blog's path.303 * @param string $domain The new blog's domain. 304 * @param string $path The new blog's path. 299 305 * @param string $weblog_title The new blog's title. 300 * @param int $site_idOptional. Defaults to 1.301 * @return int The ID of the newly created blog306 * @param int $site_id Optional. Defaults to 1. 307 * @return string|int The ID of the newly created blog 302 308 */ 303 309 function create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 ) { … … 350 356 * @since MU 2.6.5 351 357 * 358 * @global wpdb $wpdb 359 * 352 360 * @param string $domain 353 * @param string $path Optional. Not required for subdomain installations.361 * @param string $path Optional. Not required for subdomain installations. 354 362 * @return int 0 if no blog found, otherwise the ID of the matching blog 355 363 */ … … 447 455 * 448 456 * @since MU 457 * 458 * @global wpdb $wpdb 449 459 * 450 460 * @param string $user_name The login name provided by the user. … … 570 580 * @since MU 571 581 * 572 * @param string $blogname The blog name provided by the user. Must be unique. 582 * @global wpdb $wpdb 583 * @global string $domain 584 * 585 * @param string $blogname The blog name provided by the user. Must be unique. 573 586 * @param string $blog_title The blog title provided by the user. 574 587 * @return array Contains the new site data and error messages. … … 701 714 * @since MU 702 715 * 703 * @param string $domain The requested domain. 704 * @param string $path The requested path. 705 * @param string $title The requested site title. 706 * @param string $user The user's requested login name. 716 * @global wpdb $wpdb 717 * 718 * @param string $domain The requested domain. 719 * @param string $path The requested path. 720 * @param string $title The requested site title. 721 * @param string $user The user's requested login name. 707 722 * @param string $user_email The user's email address. 708 * @param array $metaBy default, contains the requested privacy setting and lang_id.723 * @param array $meta By default, contains the requested privacy setting and lang_id. 709 724 */ 710 725 function wpmu_signup_blog( $domain, $path, $title, $user, $user_email, $meta = array() ) { … … 736 751 * @since MU 737 752 * 738 * @param string $user The user's requested login name. 753 * @global wpdb $wpdb 754 * 755 * @param string $user The user's requested login name. 739 756 * @param string $user_email The user's email address. 740 * @param array $metaBy default, this is an empty array.757 * @param array $meta By default, this is an empty array. 741 758 */ 742 759 function wpmu_signup_user( $user, $user_email, $meta = array() ) { … … 778 795 * @since MU 779 796 * 780 * @param string $domain The new blog domain.781 * @param string $path The new blog path.782 * @param string $title The site title.783 * @param string $user The user's login name.797 * @param string $domain The new blog domain. 798 * @param string $path The new blog path. 799 * @param string $title The site title. 800 * @param string $user The user's login name. 784 801 * @param string $user_email The user's email address. 785 * @param string $key The activation key created in wpmu_signup_blog()786 * @param array $metaBy default, contains the requested privacy setting and lang_id.802 * @param string $key The activation key created in wpmu_signup_blog() 803 * @param array $meta By default, contains the requested privacy setting and lang_id. 787 804 * @return bool 788 805 */ … … 884 901 * @since MU 885 902 * 886 * @param string $user The user's login name.903 * @param string $user The user's login name. 887 904 * @param string $user_email The user's email address. 888 * @param string $key The activation key created in wpmu_signup_user()889 * @param array $metaBy default, an empty array.905 * @param string $key The activation key created in wpmu_signup_user() 906 * @param array $meta By default, an empty array. 890 907 * @return bool 891 908 */ … … 964 981 * @since MU 965 982 * 983 * @global wpdb $wpdb 984 * 966 985 * @param string $key The activation key provided to the user. 967 * @return array An array containing information about the activated user and/or blog986 * @return array|WP_Error An array containing information about the activated user and/or blog 968 987 */ 969 988 function wpmu_activate_signup($key) { … … 1059 1078 * 1060 1079 * @param string $user_name The new user's login name. 1061 * @param string $password The new user's password.1062 * @param string $email The new user's email address.1063 * @return int| boolReturns false on failure, or int $user_id on success1080 * @param string $password The new user's password. 1081 * @param string $email The new user's email address. 1082 * @return int|false Returns false on failure, or int $user_id on success 1064 1083 */ 1065 1084 function wpmu_create_user( $user_name, $password, $email ) { … … 1100 1119 * @since MU 1101 1120 * 1102 * @param string $domain The new site's domain.1103 * @param string $path The new site's path.1104 * @param string $title The new site's title.1105 * @param int $user_id The user ID of the new site's admin.1106 * @param array $metaOptional. Used to set initial site options.1107 * @param int $site_id Optional. Only relevant on multi-network installs.1108 * @return mixedReturns WP_Error object on failure, int $blog_id on success1121 * @param string $domain The new site's domain. 1122 * @param string $path The new site's path. 1123 * @param string $title The new site's title. 1124 * @param int $user_id The user ID of the new site's admin. 1125 * @param array $meta Optional. Used to set initial site options. 1126 * @param int $site_id Optional. Only relevant on multi-network installs. 1127 * @return int|WP_Error Returns WP_Error object on failure, int $blog_id on success 1109 1128 */ 1110 1129 function wpmu_create_blog( $domain, $path, $title, $user_id, $meta = array(), $site_id = 1 ) { … … 1265 1284 * @since MU 1266 1285 * 1267 * @param string $domain The domain to be checked. 1268 * @param string $path The path to be checked. 1269 * @param int $site_id Optional. Relevant only on multi-network installs. 1286 * @global wpdb $wpdb 1287 * 1288 * @param string $domain The domain to be checked. 1289 * @param string $path The path to be checked. 1290 * @param int $site_id Optional. Relevant only on multi-network installs. 1270 1291 * @return int 1271 1292 */ … … 1296 1317 * @since MU 1297 1318 * 1298 * @param string $domain The domain of the new site. 1299 * @param string $path The path of the new site. 1300 * @param int $site_id Unless you're running a multi-network install, be sure to set this value to 1. 1301 * @return int The ID of the new row 1319 * @global wpdb $wpdb 1320 * 1321 * @param string $domain The domain of the new site. 1322 * @param string $path The path of the new site. 1323 * @param int $site_id Unless you're running a multi-network install, be sure to set this value to 1. 1324 * @return int|false The ID of the new row 1302 1325 */ 1303 1326 function insert_blog($domain, $path, $site_id) { … … 1328 1351 * @since MU 1329 1352 * 1330 * @param int $blog_id The value returned by insert_blog(). 1353 * @global wpdb $wpdb 1354 * @global WP_Roles $wp_roles 1355 * 1356 * @param int $blog_id The value returned by insert_blog(). 1331 1357 * @param string $blog_title The title of the new site. 1332 1358 */ … … 1382 1408 * @deprecated Use wp_install_defaults() 1383 1409 * 1410 * @global wpdb $wpdb 1411 * 1384 1412 * @param int $blog_id Ignored in this function. 1385 1413 * @param int $user_id … … 1407 1435 * @since MU 1408 1436 * 1409 * @param int $blog_id1410 * @param int $user_id1437 * @param int $blog_id 1438 * @param int $user_id 1411 1439 * @param string $password 1412 * @param string $title The new blog's title1413 * @param array $metaOptional. Not used in the default function, but is passed along to hooks for customization.1440 * @param string $title The new blog's title 1441 * @param array $meta Optional. Not used in the default function, but is passed along to hooks for customization. 1414 1442 * @return bool 1415 1443 */ … … 1510 1538 * @since MU 1511 1539 * 1512 * @param int $user_id1540 * @param int $user_id 1513 1541 * @param string $password 1514 * @param array $metaOptional. Not used in the default function, but is passed along to hooks for customization.1542 * @param array $meta Optional. Not used in the default function, but is passed along to hooks for customization. 1515 1543 * @return bool 1516 1544 */ … … 1588 1616 * @since MU 1589 1617 * 1618 * @global object $current_site 1619 * 1590 1620 * @return object 1591 1621 */ … … 1602 1632 * 1603 1633 * @since MU 1634 * 1635 * @global wpdb $wpdb 1604 1636 * 1605 1637 * @param int $user_id … … 1675 1707 * 1676 1708 * @param string $directory 1677 * @return int 1709 * @return int|false 1678 1710 */ 1679 1711 function recurse_dirsize( $directory ) { … … 1738 1770 * 1739 1771 * @since MU 1772 * 1773 * @global wpdb $wpdb 1740 1774 */ 1741 1775 function update_posts_count( $deprecated = '' ) { … … 1748 1782 * 1749 1783 * @since MU 1784 * 1785 * @global wpdb $wpdb 1750 1786 * 1751 1787 * @param int $blog_id … … 1765 1801 * 1766 1802 * @see term_id_filter 1803 * 1804 * @global wpdb $wpdb 1805 * @staticvar int $global_terms_recurse 1767 1806 * 1768 1807 * @param int $term_id An ID for a term on the current blog. … … 1847 1886 * 1848 1887 * @param array $upload 1849 * @return mixedIf the upload is under the size limit, $upload is returned. Otherwise returns an error message.1888 * @return string|array If the upload is under the size limit, $upload is returned. Otherwise returns an error message. 1850 1889 */ 1851 1890 function upload_is_file_too_big( $upload ) { 1852 if ( is_array( $upload ) == false|| defined( 'WP_IMPORTING' ) || get_site_option( 'upload_space_check_disabled' ) )1891 if ( ! is_array( $upload ) || defined( 'WP_IMPORTING' ) || get_site_option( 'upload_space_check_disabled' ) ) 1853 1892 return $upload; 1854 1893 … … 1922 1961 function maybe_add_existing_user_to_blog() { 1923 1962 if ( false === strpos( $_SERVER[ 'REQUEST_URI' ], '/newbloguser/' ) ) 1924 return false;1963 return; 1925 1964 1926 1965 $parts = explode( '/', $_SERVER[ 'REQUEST_URI' ] ); … … 1945 1984 * @since MU 1946 1985 * 1986 * @global int $blog_id 1987 * 1947 1988 * @param array $details 1989 * @return true|WP_Error|void 1948 1990 */ 1949 1991 function add_existing_user_to_blog( $details = false ) { … … 1961 2003 */ 1962 2004 do_action( 'added_existing_user', $details['user_id'], $result ); 1963 }1964 return $result;2005 return $result; 2006 } 1965 2007 } 1966 2008 … … 1974 2016 * @see add_user_to_blog() 1975 2017 * 1976 * @param int $user_id2018 * @param int $user_id 1977 2019 * @param mixed $password Ignored. 1978 2020 * @param array $meta … … 2003 2045 * 2004 2046 * @param string|WP_User $user Optional. Defaults to current user. WP_User object, 2005 * or user login name as a string.2047 * or user login name as a string. 2006 2048 * @return bool 2007 2049 */ … … 2026 2068 * 2027 2069 * @param int $old_value 2028 * @param int $value The new public value2070 * @param int $value The new public value 2029 2071 */ 2030 2072 function update_blog_public( $old_value, $value ) { … … 2037 2079 * @since MU 2038 2080 * 2081 * @global wpdb $wpdb 2082 * 2039 2083 * @param string $key 2040 * @param int $user_id Optional. Defaults to current user.2041 * @param int $blog_id Optional. Defaults to current blog.2084 * @param int $user_id Optional. Defaults to current user. 2085 * @param int $blog_id Optional. Defaults to current blog. 2042 2086 * @return bool 2043 2087 */ … … 2051 2095 $local_key = $wpdb->get_blog_prefix( $blog_id ) . $key; 2052 2096 2053 if ( isset( $current_user->$local_key ) ) 2054 return true; 2055 2056 return false; 2097 return isset( $current_user->$local_key ); 2057 2098 } 2058 2099 … … 2066 2107 function users_can_register_signup_filter() { 2067 2108 $registration = get_site_option('registration'); 2068 if ( $registration == 'all' || $registration == 'user' ) 2069 return true; 2070 2071 return false; 2109 return ( $registration == 'all' || $registration == 'user' ); 2072 2110 } 2073 2111 … … 2106 2144 * 2107 2145 * @since 2.8.5 2146 * 2147 * @staticvar bool $forced_content 2108 2148 * 2109 2149 * @param string|bool $force … … 2214 2254 * 2215 2255 * @since 3.7.0 2256 * 2257 * @global wpdb $wpdb 2216 2258 */ 2217 2259 function wp_update_network_site_counts() { … … 2226 2268 * 2227 2269 * @since 3.7.0 2270 * 2271 * @global wpdb $wpdb 2228 2272 */ 2229 2273 function wp_update_network_user_counts() { … … 2365 2409 * 2366 2410 * @since 3.7.0 2411 * 2412 * @global wpdb $wpdb 2367 2413 * 2368 2414 * @param array $args {
Note: See TracChangeset
for help on using the changeset viewer.