Changeset 13903
- Timestamp:
- 06/04/2024 02:30:49 AM (19 months ago)
- Location:
- trunk/src/bp-core
- Files:
-
- 7 edited
-
bp-core-moderation.php (modified) (7 diffs)
-
bp-core-options.php (modified) (20 diffs)
-
bp-core-rest-api.php (modified) (1 diff)
-
bp-core-taxonomy.php (modified) (5 diffs)
-
bp-core-template-loader.php (modified) (9 diffs)
-
bp-core-theme-compatibility.php (modified) (9 diffs)
-
bp-core-update.php (modified) (20 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-moderation.php
r13878 r13903 26 26 function bp_core_check_for_flood( $user_id = 0 ) { 27 27 28 $throttle_time = bp_get_option( '_bp_throttle_time' ); 29 28 30 // Option disabled. No flood checks. 29 if ( ! $throttle_time = bp_get_option( '_bp_throttle_time' )) {31 if ( ! $throttle_time ) { 30 32 return true; 31 33 } … … 37 39 38 40 $last_posted = get_user_meta( $user_id, '_bp_last_posted', true ); 39 if ( isset( $last_posted ) && ( time() < ( $last_posted + $throttle_time ) ) && ! current_user_can( 'throttle' ) ) {41 if ( isset( $last_posted ) && ( time() < ( $last_posted + $throttle_time ) ) && ! current_user_can( 'throttle' ) ) { 40 42 return false; 41 43 } … … 79 81 // Define local variable(s). 80 82 $_post = array(); 81 $matches = '';83 $matches = array(); 82 84 83 85 /** User Data ************************************************************ … … 119 121 foreach ( $matches[0] as $found_url ) { 120 122 if ( 0 === strpos( $found_url, home_url() ) ) { 121 $num_links -=1;123 --$num_links; 122 124 } 123 125 } … … 298 300 299 301 // Skip empty lines. 300 if ( empty( $word ) ) { continue; } 302 if ( empty( $word ) ) { 303 continue; 304 } 301 305 302 306 // Do some escaping magic so that '#' chars in the … … 332 336 function bp_core_current_user_ip() { 333 337 $retval = ''; 338 334 339 if ( isset( $_SERVER['REMOTE_ADDR'] ) ) { 335 340 $retval = preg_replace( '/[^0-9a-fA-F:., ]/', '', wp_unslash( $_SERVER['REMOTE_ADDR'] ) ); … … 354 359 */ 355 360 function bp_core_current_user_ua() { 361 $retval = ''; 356 362 357 363 // Sanity check the user agent. 358 364 if ( ! empty( $_SERVER['HTTP_USER_AGENT'] ) ) { 359 365 $retval = substr( $_SERVER['HTTP_USER_AGENT'], 0, 254 ); 360 } else {361 $retval = '';362 366 } 363 367 -
trunk/src/bp-core/bp-core-options.php
r13890 r13903 24 24 25 25 // Default options. 26 $options = array (26 $options = array( 27 27 28 28 /* Components ********************************************************/ … … 64 64 65 65 // Allow Group Activity Deletions. 66 'bp-disable-group-activity-deletions' => false,66 'bp-disable-group-activity-deletions' => false, 67 67 68 68 // Allow users to delete their own accounts. … … 312 312 function bp_core_activate_site_options( $keys = array() ) { 313 313 314 if ( ! empty( $keys ) && is_array( $keys ) ) {314 if ( ! empty( $keys ) && is_array( $keys ) ) { 315 315 $bp = buddypress(); 316 316 … … 321 321 $bp->site_options[ $key ] = bp_get_option( $key, $default ); 322 322 323 if ( ! bp_update_option( $key, $bp->site_options[ $key ] ) ) {323 if ( ! bp_update_option( $key, $bp->site_options[ $key ] ) ) { 324 324 $errors = true; 325 325 } … … 365 365 if ( false === $root_blog_options_meta ) { 366 366 $blog_options_keys = "'" . join( "', '", (array) $root_blog_option_keys ) . "'"; 367 $blog_options_table = bp_is_multiblog_mode() ? $wpdb->options : $wpdb->get_blog_prefix( bp_get_root_blog_id() ) . 'options';367 $blog_options_table = bp_is_multiblog_mode() ? $wpdb->options : $wpdb->get_blog_prefix( bp_get_root_blog_id() ) . 'options'; 368 368 $blog_options_query = "SELECT option_name AS name, option_value AS value FROM {$blog_options_table} WHERE option_name IN ( {$blog_options_keys} )"; 369 369 $root_blog_options_meta = $wpdb->get_results( $blog_options_query ); … … 379 379 * @param array $value Array of multisite options from sitemeta table. 380 380 */ 381 $network_options = apply_filters( 'bp_core_network_options', array( 382 'tags_blog_id' => '0', 383 'sitewide_tags_blog' => '', 384 'registration' => '0', 385 'fileupload_maxk' => '1500' 386 ) ); 381 $network_options = apply_filters( 382 'bp_core_network_options', 383 array( 384 'tags_blog_id' => '0', 385 'sitewide_tags_blog' => '', 386 'registration' => '0', 387 'fileupload_maxk' => '1500', 388 ) 389 ); 387 390 388 391 $current_site = get_current_site(); … … 398 401 // Loop through our results and make them usable. 399 402 foreach ( $root_blog_options_meta as $root_blog_option ) { 400 $root_blog_options[ $root_blog_option->name] = $root_blog_option->value;403 $root_blog_options[ $root_blog_option->name ] = $root_blog_option->value; 401 404 } 402 405 … … 594 597 * @since 14.0.0 595 598 * 596 * @param bool $ defaultOptional. Fallback value if not found in the database.597 * Default: false.599 * @param bool $retval Optional. Fallback value if not found in the database. 600 * Default: false. 598 601 * @return bool True if group activity deletions are disabled, otherwise false. 599 602 */ 600 function bp_disable_group_activity_deletions( $ default= false ) {603 function bp_disable_group_activity_deletions( $retval = false ) { 601 604 602 605 /** … … 605 608 * @since 14.0.0 606 609 * 607 * @param bool $value Whether or not group creator, group admin or group mod are able to delete group activity post. 608 */ 609 return (bool) apply_filters( 'bp_disable_group_activity_deletions', (bool) bp_get_option( 'bp-disable-group-activity-deletions', $default ) ); 610 * @param bool $disable_group_deletions Whether or not group creator, 611 * group admin or group mod are able to delete group activity post. 612 */ 613 return (bool) apply_filters( 'bp_disable_group_activity_deletions', (bool) bp_get_option( 'bp-disable-group-activity-deletions', $retval ) ); 610 614 } 611 615 … … 615 619 * @since 1.6.0 616 620 * 617 * @param bool $ defaultOptional. Fallback value if not found in the database.618 * Default: true.621 * @param bool $retval Optional. Fallback value if not found in the database. 622 * Default: true. 619 623 * @return bool True if users are able to delete their own accounts, otherwise 620 624 * false. 621 625 */ 622 function bp_disable_account_deletion( $ default= false ) {626 function bp_disable_account_deletion( $retval = false ) { 623 627 624 628 /** … … 627 631 * @since 1.6.0 628 632 * 629 * @param bool $ valueWhether or not members are able to delete their own accounts.630 */ 631 return apply_filters( 'bp_disable_account_deletion', (bool) bp_get_option( 'bp-disable-account-deletion', $ default) );633 * @param bool $disable_account_deletion Whether or not members are able to delete their own accounts. 634 */ 635 return apply_filters( 'bp_disable_account_deletion', (bool) bp_get_option( 'bp-disable-account-deletion', $retval ) ); 632 636 } 633 637 … … 639 643 * @todo split and move into blog and forum components. 640 644 * 641 * @param bool $ defaultOptional. Fallback value if not found in the database.642 * Default: false.645 * @param bool $retval Optional. Fallback value if not found in the database. 646 * Default: false. 643 647 * @return bool True if activity comments are disabled for blog and forum 644 648 * items, otherwise false. 645 649 */ 646 function bp_disable_blogforum_comments( $ default= false ) {650 function bp_disable_blogforum_comments( $retval = false ) { 647 651 648 652 /** … … 651 655 * @since 1.6.0 652 656 * 653 * @param bool $ valueWhether or not blog and forum activity stream comments are disabled.654 */ 655 return (bool) apply_filters( 'bp_disable_blogforum_comments', (bool) bp_get_option( 'bp-disable-blogforum-comments', $ default) );657 * @param bool $disable_blog_forum_comments Whether or not blog and forum activity stream comments are disabled. 658 */ 659 return (bool) apply_filters( 'bp_disable_blogforum_comments', (bool) bp_get_option( 'bp-disable-blogforum-comments', $retval ) ); 656 660 } 657 661 … … 663 667 * @todo Move into groups component. 664 668 * 665 * @param bool $ defaultOptional. Fallback value if not found in the database.666 * Default: true.669 * @param bool $retval Optional. Fallback value if not found in the database. 670 * Default: true. 667 671 * @return bool True if group creation is restricted, otherwise false. 668 672 */ 669 function bp_restrict_group_creation( $ default= true ) {673 function bp_restrict_group_creation( $retval = true ) { 670 674 671 675 /** … … 674 678 * @since 1.6.0 675 679 * 676 * @param bool $ valueWhether or not group creation is turned off.677 */ 678 return (bool) apply_filters( 'bp_restrict_group_creation', (bool) bp_get_option( 'bp_restrict_group_creation', $ default) );680 * @param bool $group_creation Whether or not group creation is turned off. 681 */ 682 return (bool) apply_filters( 'bp_restrict_group_creation', (bool) bp_get_option( 'bp_restrict_group_creation', $retval ) ); 679 683 } 680 684 … … 684 688 * @since 1.6.0 685 689 * 686 * @param bool $ defaultOptional. Fallback value if not found in the database.687 * Default: true.690 * @param bool $retval Optional. Fallback value if not found in the database. 691 * Default: true. 688 692 * @return bool True if Akismet is enabled, otherwise false. 689 693 */ 690 function bp_is_akismet_active( $ default= true ) {694 function bp_is_akismet_active( $retval = true ) { 691 695 692 696 /** … … 695 699 * @since 1.6.0 696 700 * 697 * @param bool $ valueWhether or not Akismet is enabled.698 */ 699 return (bool) apply_filters( 'bp_is_akismet_active', (bool) bp_get_option( '_bp_enable_akismet', $ default) );701 * @param bool $akismet Whether or not Akismet is enabled. 702 */ 703 return (bool) apply_filters( 'bp_is_akismet_active', (bool) bp_get_option( '_bp_enable_akismet', $retval ) ); 700 704 } 701 705 … … 705 709 * @since 2.0.0 706 710 * 707 * @param bool $ defaultOptional. Fallback value if not found in the database.708 * Default: true.711 * @param bool $retval Optional. Fallback value if not found in the database. 712 * Default: true. 709 713 * @return bool True if Heartbeat refresh is enabled, otherwise false. 710 714 */ 711 function bp_is_activity_heartbeat_active( $ default= true ) {715 function bp_is_activity_heartbeat_active( $retval = true ) { 712 716 713 717 /** … … 716 720 * @since 2.0.0 717 721 * 718 * @param bool $ value Whether or not Activity Heartbeat refresh is enabled.719 */ 720 return (bool) apply_filters( 'bp_is_activity_heartbeat_active', (bool) bp_get_option( '_bp_enable_heartbeat_refresh', $ default) );722 * @param bool $heartbeat_active Whether or not Activity Heartbeat refresh is enabled. 723 */ 724 return (bool) apply_filters( 'bp_is_activity_heartbeat_active', (bool) bp_get_option( '_bp_enable_heartbeat_refresh', $retval ) ); 721 725 } 722 726 … … 739 743 * @param string $package_id The current theme package ID. 740 744 */ 741 return apply_filters( 'bp_get_theme_package_id', bp_get_option( '_bp_theme_package_id', $package_id ) );742 } 745 return apply_filters( 'bp_get_theme_package_id', (string) bp_get_option( '_bp_theme_package_id', $package_id ) ); 746 } -
trunk/src/bp-core/bp-core-rest-api.php
r13890 r13903 302 302 * @since 5.0.0 303 303 * 304 * @param array|string $ listList of strings.304 * @param array|string $collection List of strings. 305 305 * @return array Sanitized array of strings. 306 306 */ 307 function bp_rest_sanitize_string_list( $ list) {308 if ( ! is_array( $ list) ) {309 $ list = preg_split( '/[\s,]+/', $list);310 } 311 312 return array_unique( array_map( 'sanitize_text_field', $ list) );307 function bp_rest_sanitize_string_list( $collection ) { 308 if ( ! is_array( $collection ) ) { 309 $collection = preg_split( '/[\s,]+/', $collection ); 310 } 311 312 return array_unique( array_map( 'sanitize_text_field', $collection ) ); 313 313 } 314 314 -
trunk/src/bp-core/bp-core-taxonomy.php
r12728 r13903 154 154 $taxonomy_site_map = array(); 155 155 foreach ( (array) $taxonomies as $taxonomy ) { 156 $taxonomy_site_id = bp_get_taxonomy_term_site_id( $taxonomy );156 $taxonomy_site_id = bp_get_taxonomy_term_site_id( $taxonomy ); 157 157 $taxonomy_site_map[ $taxonomy_site_id ][] = $taxonomy; 158 158 } … … 242 242 $taxonomy_site_map = array(); 243 243 foreach ( (array) $taxonomies as $taxonomy ) { 244 $taxonomy_site_id = bp_get_taxonomy_term_site_id( $taxonomy );244 $taxonomy_site_id = bp_get_taxonomy_term_site_id( $taxonomy ); 245 245 $taxonomy_site_map[ $taxonomy_site_id ][] = $taxonomy; 246 246 } … … 276 276 * @see get_term_by() for a full description of function and parameters. 277 277 * 278 * @param string $field Either 'slug', 'name', 'id' (term_id), or 'term_taxonomy_id' 279 * @param string|int $value Search for this term value 278 * @param string $field Either 'slug', 'name', 'id' (term_id), or 'term_taxonomy_id'. 279 * @param string|int $value Search for this term value. 280 280 * @param string $taxonomy Taxonomy name. Optional, if `$field` is 'term_taxonomy_id'. 281 * @param string $output Constant OBJECT, ARRAY_A, or ARRAY_N 281 * @param string $output Constant OBJECT, ARRAY_A, or ARRAY_N. 282 282 * @param string $filter Optional, default is raw or no WordPress defined filter will applied. 283 283 * … … 386 386 * @since 7.0.0 387 387 * 388 * @param array $args {389 * Array of arguments to query BP Terms.388 * @param array $args { 389 * Array of arguments to query BP Terms. 390 390 * @see `get_terms()` for full description of arguments in case of a member type. 391 391 * } … … 442 442 * @since 7.0.0 443 443 * 444 * @param int $term_id The BP Term ID. Required.445 * @param string $taxonomy The BP Taxonomy Name. Required.444 * @param int $term_id The BP Term ID. Required. 445 * @param string $taxonomy The BP Taxonomy Name. Required. 446 446 * @return bool|WP_Error True on success, WP_Error on failure. 447 447 */ -
trunk/src/bp-core/bp-core-template-loader.php
r13878 r13903 186 186 187 187 // Trim off any slashes from the template name. 188 $template_name = ltrim( $template_name, '/' );188 $template_name = ltrim( $template_name, '/' ); 189 189 190 190 // Loop through template stack. … … 253 253 254 254 // Set up data array. 255 $data = array();255 $data = array(); 256 256 $data['file'] = $data['uri'] = $located; 257 257 258 258 $find = array( 259 259 get_theme_root(), 260 bp_get_theme_compat_dir() 260 bp_get_theme_compat_dir(), 261 261 ); 262 262 263 263 $replace = array( 264 264 get_theme_root_uri(), 265 bp_get_theme_compat_url() 265 bp_get_theme_compat_url(), 266 266 ); 267 267 … … 340 340 341 341 // Setup some default variables. 342 $tag = 'bp_template_stack'; 343 $args = $stack = array(); 342 $tag = 'bp_template_stack'; 343 $args = array(); 344 $stack = array(); 344 345 345 346 // Add 'bp_template_stack' to the current filter array. … … 384 385 * @param array $stack Array of registered directories for template locations. 385 386 */ 386 return (array) apply_filters( 'bp_get_template_stack', $stack ) ;387 return (array) apply_filters( 'bp_get_template_stack', $stack ); 387 388 } 388 389 … … 397 398 * @param string $slug See {@link bp_get_template_part()}. 398 399 * @param string|null $name See {@link bp_get_template_part()}. 399 * @param bool $ echoIf true, template content will be echoed. If false,400 * @param bool $ret If true, template content will be echoed. If false, 400 401 * returned. Default: true. 401 402 * @param array $args See {@link bp_get_template_part()}. 402 403 * @return string|null If $echo, returns the template content. 403 404 */ 404 function bp_buffer_template_part( $slug, $name = null, $ echo= true, $args = array() ) {405 function bp_buffer_template_part( $slug, $name = null, $ret = true, $args = array() ) { 405 406 ob_start(); 406 407 … … 417 418 418 419 // Echo or return the output buffer contents. 419 if ( true === $ echo) {420 if ( true === $ret ) { 420 421 // phpcs:ignore WordPress.Security.EscapeOutput 421 422 echo $output; … … 500 501 'buddypress', 501 502 'community', 502 '' 503 '', 503 504 ); 504 505 … … 565 566 566 567 // Bail if filters are suppressed on this query. 567 if ( true == $posts_query->get( 'suppress_filters' ) ) {568 if ( true === $posts_query->get( 'suppress_filters' ) ) { 568 569 return; 569 570 } … … 831 832 */ 832 833 function bp_get_theme_compat_templates() { 833 return bp_get_query_template( 'buddypress', array( 834 'plugin-buddypress.php', 835 'buddypress.php', 836 'community.php', 837 'generic.php', 838 'page.php', 839 'single.php', 840 'singular.php', 841 'index.php' 842 ) ); 834 return bp_get_query_template( 835 'buddypress', 836 array( 837 'plugin-buddypress.php', 838 'buddypress.php', 839 'community.php', 840 'generic.php', 841 'page.php', 842 'single.php', 843 'singular.php', 844 'index.php', 845 ) 846 ); 843 847 } 844 848 -
trunk/src/bp-core/bp-core-theme-compatibility.php
r13890 r13903 36 36 37 37 // Make sure theme package is available, set to default if not. 38 if ( ! isset( $bp->theme_compat->packages[ $theme] ) || ! is_a( $bp->theme_compat->packages[$theme], 'BP_Theme_Compat' ) ) {38 if ( ! isset( $bp->theme_compat->packages[ $theme ] ) || ! is_a( $bp->theme_compat->packages[ $theme ], 'BP_Theme_Compat' ) ) { 39 39 $theme = 'legacy'; 40 40 } 41 41 42 42 // Set the active theme compat theme. 43 $bp->theme_compat->theme = $bp->theme_compat->packages[ $theme];43 $bp->theme_compat->theme = $bp->theme_compat->packages[ $theme ]; 44 44 } 45 45 … … 208 208 $theme_compat = false; 209 209 210 // If the theme doesn't support BP, do some additional checks.211 } else {210 // If the theme doesn't support BP, do some additional checks. 211 } elseif ( in_array( 'bp-default', array( get_template(), get_stylesheet() ), true ) ) { 212 212 // Bail if theme is a derivative of bp-default. 213 if ( in_array( 'bp-default', array( get_template(), get_stylesheet() ) ) ) { 214 $theme_compat = false; 213 $theme_compat = false; 215 214 216 215 // Brute-force check for a BP template. 217 216 // Examples are clones of bp-default. 218 } elseif ( locate_template( 'members/members-loop.php', false, false ) ) { 219 $theme_compat = false; 220 } 217 } elseif ( locate_template( 'members/members-loop.php', false, false ) ) { 218 $theme_compat = false; 221 219 } 222 220 … … 250 248 * 251 249 * @param bool $set True to set the flag to true, false to set it to false. 252 * @return bool Returns the value of $set.250 * @return bool 253 251 */ 254 252 function bp_set_theme_compat_active( $set = true ) { … … 462 460 } 463 461 464 bp_set_theme_compat_feature( 'legacy', array( 465 'name' => 'cover_image', 466 'settings' => array( 467 'components' => array( 'members', 'groups' ), 468 'width' => $bp_content_width, 469 'height' => $top_offset + round( $avatar_height / 2 ), 470 'callback' => 'bp_legacy_theme_cover_image', 471 'theme_handle' => $bp_handle, 472 ), 473 ) ); 462 bp_set_theme_compat_feature( 463 'legacy', 464 array( 465 'name' => 'cover_image', 466 'settings' => array( 467 'components' => array( 'members', 'groups' ), 468 'width' => $bp_content_width, 469 'height' => $top_offset + round( $avatar_height / 2 ), 470 'callback' => 'bp_legacy_theme_cover_image', 471 'theme_handle' => $bp_handle, 472 ), 473 ) 474 ); 474 475 } 475 476 … … 490 491 } 491 492 492 return (bool) ( $bp->theme_compat->original_template == $template );493 return (bool) ( $bp->theme_compat->original_template === $template ); 493 494 } 494 495 … … 524 525 // Only set if the theme package was not previously registered or if the 525 526 // override flag is set. 526 if ( empty( $bp->theme_compat->packages[ $theme->id] ) || ( true === $override ) ) {527 $bp->theme_compat->packages[ $theme->id] = $theme;527 if ( empty( $bp->theme_compat->packages[ $theme->id ] ) || ( true === $override ) ) { 528 $bp->theme_compat->packages[ $theme->id ] = $theme; 528 529 } 529 530 } … … 632 633 633 634 // Copy the new post global into the main $wp_query. 634 $wp_query->post = $post;635 $wp_query->posts = array( $post );635 $wp_query->post = $post; 636 $wp_query->posts = array( $post ); 636 637 637 638 // Prevent comments form from appearing. … … 821 822 822 823 // Filters exist. 823 if ( isset( $wp_filter[ $tag] ) ) {824 if ( isset( $wp_filter[ $tag ] ) ) { 824 825 825 826 // Filters exist in this priority. 826 if ( ! empty( $priority ) && isset( $wp_filter[ $tag][$priority] ) ) {827 if ( ! empty( $priority ) && isset( $wp_filter[ $tag ][ $priority ] ) ) { 827 828 828 829 // Store filters in a backup. 829 $bp->filters->wp_filter[ $tag][$priority] = $wp_filter[$tag][$priority];830 $bp->filters->wp_filter[ $tag ][ $priority ] = $wp_filter[ $tag ][ $priority ]; 830 831 831 832 // Unset the filters. 832 unset( $wp_filter[ $tag][$priority] );833 834 // Priority is empty.833 unset( $wp_filter[ $tag ][ $priority ] ); 834 835 // Priority is empty. 835 836 } else { 836 837 837 838 // Store filters in a backup. 838 $bp->filters->wp_filter[ $tag] = $wp_filter[$tag];839 $bp->filters->wp_filter[ $tag ] = $wp_filter[ $tag ]; 839 840 840 841 // Unset the filters. 841 unset( $wp_filter[ $tag] );842 unset( $wp_filter[ $tag ] ); 842 843 } 843 844 } 844 845 845 846 // Check merged filters. 846 if ( isset( $merged_filters[ $tag] ) ) {847 if ( isset( $merged_filters[ $tag ] ) ) { 847 848 848 849 // Store filters in a backup. 849 $bp->filters->merged_filters[ $tag] = $merged_filters[$tag];850 $bp->filters->merged_filters[ $tag ] = $merged_filters[ $tag ]; 850 851 851 852 // Unset the filters. 852 unset( $merged_filters[ $tag] );853 unset( $merged_filters[ $tag ] ); 853 854 } 854 855 … … 876 877 877 878 // Filters exist. 878 if ( isset( $bp->filters->wp_filter[ $tag] ) ) {879 if ( isset( $bp->filters->wp_filter[ $tag ] ) ) { 879 880 880 881 // Filters exist in this priority. 881 if ( ! empty( $priority ) && isset( $bp->filters->wp_filter[ $tag][$priority] ) ) {882 if ( ! empty( $priority ) && isset( $bp->filters->wp_filter[ $tag ][ $priority ] ) ) { 882 883 883 884 // Store filters in a backup. 884 $wp_filter[ $tag][$priority] = $bp->filters->wp_filter[$tag][$priority];885 $wp_filter[ $tag ][ $priority ] = $bp->filters->wp_filter[ $tag ][ $priority ]; 885 886 886 887 // Unset the filters. 887 unset( $bp->filters->wp_filter[ $tag][$priority] );888 889 // Priority is empty.888 unset( $bp->filters->wp_filter[ $tag ][ $priority ] ); 889 890 // Priority is empty. 890 891 } else { 891 892 892 893 // Store filters in a backup. 893 $wp_filter[ $tag] = $bp->filters->wp_filter[$tag];894 $wp_filter[ $tag ] = $bp->filters->wp_filter[ $tag ]; 894 895 895 896 // Unset the filters. 896 unset( $bp->filters->wp_filter[ $tag] );897 unset( $bp->filters->wp_filter[ $tag ] ); 897 898 } 898 899 } 899 900 900 901 // Check merged filters. 901 if ( isset( $bp->filters->merged_filters[ $tag] ) ) {902 if ( isset( $bp->filters->merged_filters[ $tag ] ) ) { 902 903 903 904 // Store filters in a backup. 904 $merged_filters[ $tag] = $bp->filters->merged_filters[$tag];905 $merged_filters[ $tag ] = $bp->filters->merged_filters[ $tag ]; 905 906 906 907 // Unset the filters. 907 unset( $bp->filters->merged_filters[ $tag] );908 unset( $bp->filters->merged_filters[ $tag ] ); 908 909 } 909 910 -
trunk/src/bp-core/bp-core-update.php
r13637 r13903 60 60 $action = false; 61 61 62 if ( ! empty( $_REQUEST['action'] ) && ( '-1' != $_REQUEST['action'] ) ) {62 if ( ! empty( $_REQUEST['action'] ) && ( '-1' !== $_REQUEST['action'] ) ) { 63 63 $action = $_REQUEST['action']; 64 } elseif ( ! empty( $_REQUEST['action2'] ) && ( '-1' != $_REQUEST['action2'] ) ) {64 } elseif ( ! empty( $_REQUEST['action2'] ) && ( '-1' !== $_REQUEST['action2'] ) ) { 65 65 $action = $_REQUEST['action2']; 66 66 } 67 67 68 68 // Bail if not activating. 69 if ( empty( $action ) || ! in_array( $action, array( 'activate', 'activate-selected' )) ) {69 if ( empty( $action ) || ! in_array( $action, array( 'activate', 'activate-selected' ), true ) ) { 70 70 return false; 71 71 } 72 72 73 73 // The plugin(s) being activated. 74 if ( $action == 'activate' ) {74 if ( $action === 'activate' ) { 75 75 $plugins = isset( $_GET['plugin'] ) ? array( $_GET['plugin'] ) : array(); 76 76 } else { … … 79 79 80 80 // Set basename if empty. 81 if ( empty( $basename ) && ! empty( $bp->basename ) ) {81 if ( empty( $basename ) && ! empty( $bp->basename ) ) { 82 82 $basename = $bp->basename; 83 83 } … … 89 89 90 90 // Is BuddyPress being activated? 91 return in_array( $basename, $plugins );91 return in_array( $basename, $plugins, true ); 92 92 } 93 93 … … 104 104 $action = false; 105 105 106 if ( ! empty( $_REQUEST['action'] ) && ( '-1' != $_REQUEST['action'] ) ) {106 if ( ! empty( $_REQUEST['action'] ) && ( '-1' !== $_REQUEST['action'] ) ) { 107 107 $action = $_REQUEST['action']; 108 } elseif ( ! empty( $_REQUEST['action2'] ) && ( '-1' != $_REQUEST['action2'] ) ) {108 } elseif ( ! empty( $_REQUEST['action2'] ) && ( '-1' !== $_REQUEST['action2'] ) ) { 109 109 $action = $_REQUEST['action2']; 110 110 } 111 111 112 112 // Bail if not deactivating. 113 if ( empty( $action ) || ! in_array( $action, array( 'deactivate', 'deactivate-selected' )) ) {113 if ( empty( $action ) || ! in_array( $action, array( 'deactivate', 'deactivate-selected' ), true ) ) { 114 114 return false; 115 115 } 116 116 117 117 // The plugin(s) being deactivated. 118 if ( 'deactivate' == $action ) {118 if ( 'deactivate' === $action ) { 119 119 $plugins = isset( $_GET['plugin'] ) ? array( $_GET['plugin'] ) : array(); 120 120 } else { … … 123 123 124 124 // Set basename if empty. 125 if ( empty( $basename ) && ! empty( $bp->basename ) ) {125 if ( empty( $basename ) && ! empty( $bp->basename ) ) { 126 126 $basename = $bp->basename; 127 127 } … … 133 133 134 134 // Is bbPress being deactivated? 135 return in_array( $basename, $plugins );135 return in_array( $basename, $plugins, true ); 136 136 } 137 137 … … 184 184 * @param array $value Array of default components to activate. 185 185 */ 186 $default_components = apply_filters( 'bp_new_install_default_components', array( 187 'activity' => 1, 188 'members' => 1, 189 'settings' => 1, 190 'xprofile' => 1, 191 'notifications' => 1, 192 ) ); 193 194 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 195 require_once( buddypress()->plugin_dir . '/bp-core/admin/bp-core-admin-schema.php' ); 186 $default_components = apply_filters( 187 'bp_new_install_default_components', 188 array( 189 'activity' => 1, 190 'members' => 1, 191 'settings' => 1, 192 'xprofile' => 1, 193 'notifications' => 1, 194 ) 195 ); 196 197 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 198 require_once buddypress()->plugin_dir . '/bp-core/admin/bp-core-admin-schema.php'; 196 199 $switched_to_root_blog = false; 197 200 … … 226 229 bp_delete_rewrite_rules(); 227 230 228 // Upgrades.231 // Upgrades. 229 232 } else { 230 233 … … 351 354 foreach ( $tables as $table_name => $indexes ) { 352 355 foreach ( $indexes as $index ) { 353 if ( $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", bp_esc_like( $table_name ) ) ) ) {356 if ( $wpdb->query( $wpdb->prepare( 'SHOW TABLES LIKE %s', bp_esc_like( $table_name ) ) ) ) { 354 357 $wpdb->query( "ALTER TABLE {$table_name} DROP INDEX {$index}" ); 355 358 } … … 372 375 // Delete old database version options. 373 376 delete_site_option( 'bp-activity-db-version' ); 374 delete_site_option( 'bp-blogs-db-version' );375 delete_site_option( 'bp-friends-db-version' );376 delete_site_option( 'bp-groups-db-version' );377 delete_site_option( 'bp-blogs-db-version' ); 378 delete_site_option( 'bp-friends-db-version' ); 379 delete_site_option( 'bp-groups-db-version' ); 377 380 delete_site_option( 'bp-messages-db-version' ); 378 381 delete_site_option( 'bp-xprofile-db-version' ); … … 389 392 390 393 // Delete possible site options. 391 delete_site_option( 'bp-db-version' );392 delete_site_option( '_bp_db_version' );393 delete_site_option( 'bp-core-db-version' );394 delete_site_option( 'bp-db-version' ); 395 delete_site_option( '_bp_db_version' ); 396 delete_site_option( 'bp-core-db-version' ); 394 397 delete_site_option( '_bp-core-db-version' ); 395 398 396 399 // Delete possible blog options. 397 delete_blog_option( bp_get_root_blog_id(), 'bp-db-version' );398 delete_blog_option( bp_get_root_blog_id(), 'bp-core-db-version' );400 delete_blog_option( bp_get_root_blog_id(), 'bp-db-version' ); 401 delete_blog_option( bp_get_root_blog_id(), 'bp-core-db-version' ); 399 402 delete_site_option( bp_get_root_blog_id(), '_bp-core-db-version' ); 400 delete_site_option( bp_get_root_blog_id(), '_bp_db_version' );403 delete_site_option( bp_get_root_blog_id(), '_bp_db_version' ); 401 404 } 402 405 … … 417 420 418 421 // Get the active components. 419 $active_components = bp_get_option( $active_components_key );422 $active_components = bp_get_option( $active_components_key ); 420 423 421 424 // Add notifications. 422 if ( ! in_array( $notifications_component_id, $active_components ) ) {425 if ( ! in_array( $notifications_component_id, $active_components, true ) ) { 423 426 $active_components[ $notifications_component_id ] = 1; 424 427 } … … 629 632 'object_type' => 'field', 630 633 'meta_key' => 'allow_custom_visibility', 631 'meta_value' => 'disabled' 634 'meta_value' => 'disabled', 632 635 ), 633 636 array( … … 635 638 '%s', 636 639 '%s', 637 '%s' 640 '%s', 638 641 ) 639 642 ); … … 693 696 $signup_position = 0; 694 697 foreach ( $signup_fields as $signup_field_id ) { 695 $signup_position += 1;698 ++$signup_position; 696 699 697 700 $wpdb->insert( … … 964 967 array( 965 968 '%s', 966 '%s' 969 '%s', 967 970 ) 968 971 ); … … 975 978 */ 976 979 function bp_cleanup_friendship_activities() { 977 bp_activity_delete( array( 978 'component' => buddypress()->friends->id, 979 'type' => 'friendship_created', 980 'hide_sitewide' => true, 981 ) ); 980 bp_activity_delete( 981 array( 982 'component' => buddypress()->friends->id, 983 'type' => 'friendship_created', 984 'hide_sitewide' => true, 985 ) 986 ); 982 987 } 983 988 … … 1019 1024 1020 1025 // If the saved page title is the same as the legacy title, there's nothing to do. 1021 if ( $legacy_titles[ $component ] == $page->post_title ) {1026 if ( $legacy_titles[ $component ] === $page->post_title ) { 1022 1027 continue; 1023 1028 } 1024 1029 1025 1030 // Update the page with the legacy title. 1026 wp_update_post( array( 1027 'ID' => $page_id, 1028 'post_title' => $legacy_titles[ $component ], 1029 ) ); 1031 wp_update_post( 1032 array( 1033 'ID' => $page_id, 1034 'post_title' => $legacy_titles[ $component ], 1035 ) 1036 ); 1030 1037 } 1031 1038 } … … 1071 1078 1072 1079 // Suppress errors because users shouldn't see what happens next. 1073 $old_suppress = $wpdb->suppress_errors();1080 $old_suppress = $wpdb->suppress_errors(); 1074 1081 1075 1082 // Never use bp_core_get_table_prefix() for any global users tables. 1076 $table_exists = (bool) $wpdb->get_results( "DESCRIBE {$signups_table};" );1083 $table_exists = (bool) $wpdb->get_results( "DESCRIBE {$signups_table};" ); 1077 1084 1078 1085 // Table already exists, so maybe upgrade instead? … … 1087 1094 } 1088 1095 1089 // Table does not exist, and we are a single site, so install the multisite1090 // signups table using WordPress core's database schema.1096 // Table does not exist, and we are a single site, so install the multisite 1097 // signups table using WordPress core's database schema. 1091 1098 } elseif ( ! is_multisite() ) { 1092 1099 bp_core_install_signups();
Note: See TracChangeset
for help on using the changeset viewer.