Changeset 13968 for trunk/src/bp-core/bp-core-wpabstraction.php
- Timestamp:
- 07/23/2024 01:13:42 AM (22 months ago)
- File:
-
- 1 edited
-
trunk/src/bp-core/bp-core-wpabstraction.php (modified) (26 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-wpabstraction.php
r13395 r13968 10 10 * 11 11 * @package BuddyPress 12 * @subpackage WPAbstraction12 * @subpackage Core 13 13 * @since 1.2.0 14 14 */ … … 24 24 * @global string $wp_version WP Version number. 25 25 * 26 * @return double26 * @return float 27 27 */ 28 28 function bp_get_major_wp_version() { … … 35 35 * Only add MS-specific abstraction functions if WordPress is not in multisite mode. 36 36 */ 37 if ( ! is_multisite() ) {37 if ( ! is_multisite() ) { 38 38 global $wpdb; 39 39 … … 41 41 $wpdb->blogid = BP_ROOT_BLOG; 42 42 43 if ( ! function_exists( 'get_blog_option' ) ) {43 if ( ! function_exists( 'get_blog_option' ) ) { 44 44 45 45 /** … … 52 52 * @param int $blog_id Blog ID to fetch for. Not used. 53 53 * @param string $option_name Option name to fetch. 54 * @param bool $default Whether or not default.54 * @param bool $default Optional. Default value to return if the option does not exist. 55 55 * @return mixed 56 56 */ … … 72 72 * @param string $option_name Option name to add. 73 73 * @param mixed $option_value Option value to add. 74 * @return mixed74 * @return bool 75 75 */ 76 76 function add_blog_option( $blog_id, $option_name, $option_value ) { … … 79 79 } 80 80 81 if ( ! function_exists( 'update_blog_option' ) ) {81 if ( ! function_exists( 'update_blog_option' ) ) { 82 82 83 83 /** … … 88 88 * @see update_blog_option() 89 89 * 90 * @param int $blog_id Blog ID to update for. Not used.91 * @param string $option_name Option name to update.92 * @param mixed $ valueOption value to update.93 * @return mixed94 */ 95 function update_blog_option( $blog_id, $option_name, $ value ) {96 return update_option( $option_name, $ value );97 } 98 } 99 100 if ( ! function_exists( 'delete_blog_option' ) ) {90 * @param int $blog_id Blog ID to update for. Not used. 91 * @param string $option_name Option name to update. 92 * @param mixed $option_value Option value to update. 93 * @return bool 94 */ 95 function update_blog_option( $blog_id, $option_name, $option_value ) { 96 return update_option( $option_name, $option_value ); 97 } 98 } 99 100 if ( ! function_exists( 'delete_blog_option' ) ) { 101 101 102 102 /** … … 109 109 * @param int $blog_id Blog ID to delete for. Not used. 110 110 * @param string $option_name Option name to delete. 111 * @return mixed111 * @return bool 112 112 */ 113 113 function delete_blog_option( $blog_id, $option_name ) { … … 116 116 } 117 117 118 if ( ! function_exists( 'switch_to_blog' ) ) {118 if ( ! function_exists( 'switch_to_blog' ) ) { 119 119 120 120 /** … … 126 126 * 127 127 * @param mixed $new_blog New blog to switch to. Not used. 128 * @param null $deprecated Whether or not deprecated.Not used.128 * @param null $deprecated Not used. 129 129 * @return int 130 130 */ … … 134 134 } 135 135 136 if ( ! function_exists( 'restore_current_blog' ) ) {136 if ( ! function_exists( 'restore_current_blog' ) ) { 137 137 138 138 /** … … 150 150 } 151 151 152 if ( ! function_exists( 'get_blogs_of_user' ) ) {153 154 /** 155 * Retri ve blogs associated with user.152 if ( ! function_exists( 'get_blogs_of_user' ) ) { 153 154 /** 155 * Retrieve blogs associated with user. 156 156 * 157 157 * @since 1.2.0 … … 160 160 * 161 161 * @param int $user_id ID of the user. Not used. 162 * @param bool $all Whether or notto return all. Not used.163 * @return bool162 * @param bool $all Whether to return all. Not used. 163 * @return false 164 164 */ 165 165 function get_blogs_of_user( $user_id, $all = false ) { … … 168 168 } 169 169 170 if ( ! function_exists( 'update_blog_status' ) ) {170 if ( ! function_exists( 'update_blog_status' ) ) { 171 171 172 172 /** … … 181 181 * @param string $value Value. Not used. 182 182 * @param null $deprecated Whether or not deprecated. Not used. 183 * @return bool183 * @return true 184 184 */ 185 185 function update_blog_status( $blog_id, $pref, $value, $deprecated = null ) { … … 188 188 } 189 189 190 if ( ! function_exists( 'is_subdomain_install' ) ) {190 if ( ! function_exists( 'is_subdomain_install' ) ) { 191 191 192 192 /** … … 200 200 */ 201 201 function is_subdomain_install() { 202 if ( ( defined( 'VHOST' ) && 'yes' == VHOST ) || ( defined( 'SUBDOMAIN_INSTALL' ) && SUBDOMAIN_INSTALL ) ) 203 return true; 204 205 return false; 202 return ( ( defined( 'VHOST' ) && 'yes' === VHOST ) || ( defined( 'SUBDOMAIN_INSTALL' ) && SUBDOMAIN_INSTALL ) ); 206 203 } 207 204 } … … 218 215 */ 219 216 function bp_core_get_status_sql( $prefix = false ) { 220 if ( ! is_multisite() )217 if ( ! is_multisite() ) { 221 218 return "{$prefix}user_status = 0"; 222 else 223 return "{$prefix}spam = 0 AND {$prefix}deleted = 0 AND {$prefix}user_status = 0"; 219 } 220 221 return "{$prefix}spam = 0 AND {$prefix}deleted = 0 AND {$prefix}user_status = 0"; 224 222 } 225 223 … … 232 230 * Borrowed from MediaWiki, under the GPLv2. Thanks! 233 231 */ 234 if ( ! function_exists( 'mb_strlen' ) ) {232 if ( ! function_exists( 'mb_strlen' ) ) { 235 233 236 234 /** … … 243 241 function mb_strlen( $str, $enc = '' ) { 244 242 $counts = count_chars( $str ); 245 $total = 0;243 $total = 0; 246 244 247 245 // Count ASCII bytes. 248 for ( $i = 0; $i < 0x80; $i++ ) {249 $total += $counts[ $i];246 for ( $i = 0; $i < 0x80; $i++ ) { 247 $total += $counts[ $i ]; 250 248 } 251 249 252 250 // Count multibyte sequence heads. 253 for ( $i = 0xc0; $i < 0xff; $i++ ) {254 $total += $counts[ $i];251 for ( $i = 0xc0; $i < 0xff; $i++ ) { 252 $total += $counts[ $i ]; 255 253 } 256 254 return $total; … … 258 256 } 259 257 260 if ( ! function_exists( 'mb_strpos' ) ) {258 if ( ! function_exists( 'mb_strpos' ) ) { 261 259 262 260 /** … … 275 273 preg_match( '/' . $needle . '/u', $haystack, $ar, PREG_OFFSET_CAPTURE, $offset ); 276 274 277 if ( isset( $ar[0][1] ) ) {275 if ( isset( $ar[0][1] ) ) { 278 276 return $ar[0][1]; 279 } else {280 return false; 281 }282 } 283 } 284 285 if ( ! function_exists( 'mb_strrpos' ) ) {277 } 278 279 return false; 280 } 281 } 282 283 if ( ! function_exists( 'mb_strrpos' ) ) { 286 284 287 285 /** … … 300 298 preg_match_all( '/' . $needle . '/u', $haystack, $ar, PREG_OFFSET_CAPTURE, $offset ); 301 299 302 if ( isset( $ar[0] ) && count( $ar[0] ) > 0 &&303 isset( $ar[0][ count( $ar[0] ) - 1][1] ) ) {304 return $ar[0][ count( $ar[0] ) - 1][1];305 } else {306 return false; 307 }300 if ( isset( $ar[0] ) && count( $ar[0] ) > 0 && 301 isset( $ar[0][ count( $ar[0] ) - 1 ][1] ) ) { 302 return $ar[0][ count( $ar[0] ) - 1 ][1]; 303 } 304 305 return false; 308 306 } 309 307 } … … 313 311 * 314 312 * @since 6.0.0 313 * 314 * @param WP_Error|null $errors The WP_Error object. 315 * @param array $data Associative array of complete site data. See {@see wp_insert_site()}. 315 316 */ 316 317 function bp_catch_site_data( $errors = null, $data = array() ) { … … 390 391 function bp_delete_site_no_tables_drop( $site ) { 391 392 if ( isset( $site->deleted ) && 1 === (int) $site->deleted ) { 392 return bp_delete_site( $site->id, false);393 } 394 } 395 add_action( 'wp_update_site', 'bp_delete_site_no_tables_drop' , 10, 1);393 bp_delete_site( $site->id ); 394 } 395 } 396 add_action( 'wp_update_site', 'bp_delete_site_no_tables_drop' ); 396 397 397 398 /**
Note: See TracChangeset
for help on using the changeset viewer.