Skip to:
Content

BuddyPress.org

Changeset 13968


Ignore:
Timestamp:
07/23/2024 01:13:42 AM (8 months ago)
Author:
espellcaste
Message:

WPCS: Part XII: miscellaneous fixes for some of the files of the core component.

Follow-up to [13904]

See #9174 and #9173

Location:
trunk/src/bp-core
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-moderation.php

    r13903 r13968  
    5656 * @param string $content    The content being posted.
    5757 * @param string $error_type The error type to return. Either 'bool' or 'wp_error'.
    58  * @return bool|WP_Error True if test is passed, false if fail.
     58 * @return bool|WP_Error True if test is passed, false if it fails.
    5959 */
    6060function bp_core_check_for_moderation( $user_id = 0, $title = '', $content = '', $error_type = 'bool' ) {
  • trunk/src/bp-core/bp-core-options.php

    r13903 r13968  
    44 *
    55 * @package BuddyPress
    6  * @subpackage Options
     6 * @subpackage Core
    77 * @since 1.6.0
    88 */
     
    229229 * @since 1.5.0
    230230 *
    231  * @param string $option_name The option to be retrieved.
    232  * @param string $default    Optional. Default value to be returned if the option
    233  *                            isn't set. See {@link get_blog_option()}.
     231 * @param string $option_name   The option to be retrieved.
     232 * @param string $default_value Optional. Default value to be returned if the option
     233 *                              isn't set. See {@link get_blog_option()}.
    234234 * @return mixed The value for the option.
    235235 */
    236 function bp_get_option( $option_name, $default = '' ) {
    237     $value = get_blog_option( bp_get_root_blog_id(), $option_name, $default );
     236function bp_get_option( $option_name, $default_value = '' ) {
     237    $value = get_blog_option( bp_get_root_blog_id(), $option_name, $default_value );
    238238
    239239    /**
     
    345345 *
    346346 * @todo Use settings API and audit these methods.
     347 *
     348 * @global wpdb $wpdb WordPress database object.
    347349 *
    348350 * @return array $root_blog_options_meta List of options.
     
    427429 *
    428430 * "Root options" are those that apply across an entire installation, and are fetched only a single
    429  * time during a pageload and stored in `buddypress()->site_options` to prevent future lookups.
     431 * time during a page load and stored in `buddypress()->site_options` to prevent future lookups.
    430432 * See {@see bp_core_get_root_options()}.
    431433 *
     
    457459 * @since 1.6.0
    458460 *
    459  * @param bool $default Optional. Fallback value if not found in the database.
    460  *                      Default: true.
     461 * @param bool $default_value Optional. Fallback value if not found in the database.
     462 *                            Default: true.
    461463 * @return bool True if profile sync is enabled, otherwise false.
    462464 */
    463 function bp_disable_profile_sync( $default = false ) {
     465function bp_disable_profile_sync( $default_value = false ) {
    464466
    465467    /**
     
    468470     * @since 1.6.0
    469471     *
    470      * @param bool $value Whether or not syncing is disabled.
    471      */
    472     return (bool) apply_filters( 'bp_disable_profile_sync', (bool) bp_get_option( 'bp-disable-profile-sync', $default ) );
     472     * @param bool $profile_sync Whether or not syncing is disabled.
     473     */
     474    return (bool) apply_filters( 'bp_disable_profile_sync', (bool) bp_get_option( 'bp-disable-profile-sync', $default_value ) );
    473475}
    474476
     
    478480 * @since 1.6.0
    479481 *
    480  * @param bool $default Optional. Fallback value if not found in the database.
    481  *                      Default: true.
     482 * @param bool $default_value Optional. Fallback value if not found in the database.
     483 *                            Default: true.
    482484 * @return bool True if the admin bar should be hidden for logged-out users,
    483485 *              otherwise false.
    484486 */
    485 function bp_hide_loggedout_adminbar( $default = true ) {
     487function bp_hide_loggedout_adminbar( $default_value = true ) {
    486488
    487489    /**
     
    490492     * @since 1.6.0
    491493     *
    492      * @param bool $value Whether or not the toolbar is hidden.
    493      */
    494     return (bool) apply_filters( 'bp_hide_loggedout_adminbar', (bool) bp_get_option( 'hide-loggedout-adminbar', $default ) );
     494     * @param bool $hide_loggedout_adminar_bar Whether or not the toolbar is hidden.
     495     */
     496    return (bool) apply_filters( 'bp_hide_loggedout_adminbar', (bool) bp_get_option( 'hide-loggedout-adminbar', $default_value ) );
    495497}
    496498
     
    500502 * @since 1.6.0
    501503 *
    502  * @param bool $default Optional. Fallback value if not found in the database.
    503  *                      Default: true.
     504 * @param bool $default_value Optional. Fallback value if not found in the database.
     505 *                            Default: true.
    504506 * @return bool True if avatar uploads are disabled, otherwise false.
    505507 */
    506 function bp_disable_avatar_uploads( $default = true ) {
     508function bp_disable_avatar_uploads( $default_value = true ) {
    507509
    508510    /**
     
    511513     * @since 1.6.0
    512514     *
    513      * @param bool $value Whether or not members are able to upload their own avatars.
    514      */
    515     return (bool) apply_filters( 'bp_disable_avatar_uploads', (bool) bp_get_option( 'bp-disable-avatar-uploads', $default ) );
     515     * @param bool $disable_avatar Whether or not members are able to upload their own avatars.
     516     */
     517    return (bool) apply_filters( 'bp_disable_avatar_uploads', (bool) bp_get_option( 'bp-disable-avatar-uploads', $default_value ) );
    516518}
    517519
     
    521523 * @since 2.4.0
    522524 *
    523  * @param bool $default Optional. Fallback value if not found in the database.
    524  *                      Default: false.
     525 * @param bool $default_value Optional. Fallback value if not found in the database.
     526 *                            Default: false.
    525527 * @return bool True if cover image uploads are disabled, otherwise false.
    526528 */
    527 function bp_disable_cover_image_uploads( $default = false ) {
     529function bp_disable_cover_image_uploads( $default_value = false ) {
    528530
    529531    /**
     
    532534     * @since 2.4.0
    533535     *
    534      * @param bool $value Whether or not members are able to upload their own cover images.
    535      */
    536     return (bool) apply_filters( 'bp_disable_cover_image_uploads', (bool) bp_get_option( 'bp-disable-cover-image-uploads', $default ) );
     536     * @param bool $disable_cover_image Whether or not members are able to upload their own cover images.
     537     */
     538    return (bool) apply_filters( 'bp_disable_cover_image_uploads', (bool) bp_get_option( 'bp-disable-cover-image-uploads', $default_value ) );
    537539}
    538540
     
    545547 * @since 2.3.0
    546548 *
    547  * @param bool|null $default Optional. Fallback value if not found in the database.
    548  *                           Defaults to the value of `bp_disable_avatar_uploads()`.
     549 * @param bool|null $default_value Optional. Fallback value if not found in the database.
     550 *                                 Defaults to the value of `bp_disable_avatar_uploads()`.
    549551 * @return bool True if group avatar uploads are disabled, otherwise false.
    550552 */
    551 function bp_disable_group_avatar_uploads( $default = null ) {
     553function bp_disable_group_avatar_uploads( $default_value = null ) {
    552554    $disabled = bp_get_option( 'bp-disable-group-avatar-uploads', '' );
    553555
    554556    if ( '' === $disabled ) {
    555         if ( is_null( $default ) ) {
     557        if ( is_null( $default_value ) ) {
    556558            $disabled = bp_disable_avatar_uploads();
    557559        } else {
    558             $disabled = $default;
     560            $disabled = $default_value;
    559561        }
    560562    }
     
    565567     * @since 2.3.0
    566568     *
    567      * @param bool $disabled Whether or not members are able to upload their groups avatars.
    568      * @param bool $default  Default value passed to the function.
    569      */
    570     return (bool) apply_filters( 'bp_disable_group_avatar_uploads', $disabled, $default );
     569     * @param bool $disabled      Whether or not members are able to upload their groups avatars.
     570     * @param bool $default_value Default value passed to the function.
     571     */
     572    return apply_filters( 'bp_disable_group_avatar_uploads', wp_validate_boolean( $disabled ), $default_value );
    571573}
    572574
     
    576578 * @since 2.4.0
    577579 *
    578  * @param bool $default Optional. Fallback value if not found in the database.
    579  *                      Default: false.
     580 * @param bool $default_value Optional. Fallback value if not found in the database.
     581 *                            Default: false.
    580582 * @return bool True if group cover image uploads are disabled, otherwise false.
    581583 */
    582 function bp_disable_group_cover_image_uploads( $default = false ) {
     584function bp_disable_group_cover_image_uploads( $default_value = false ) {
    583585
    584586    /**
     
    587589     * @since 2.4.0
    588590     *
    589      * @param bool $value Whether or not members are able to upload thier groups cover images.
    590      */
    591     return (bool) apply_filters( 'bp_disable_group_cover_image_uploads', (bool) bp_get_option( 'bp-disable-group-cover-image-uploads', $default ) );
     591     * @param bool $disable_group_cover_image Whether or not members are able to upload their groups cover images.
     592     */
     593    return (bool) apply_filters( 'bp_disable_group_cover_image_uploads', (bool) bp_get_option( 'bp-disable-group-cover-image-uploads', $default_value ) );
    592594}
    593595
     
    597599 * @since 14.0.0
    598600 *
    599  * @param bool $retval Optional. Fallback value if not found in the database.
    600  *                     Default: false.
     601 * @param bool $default_value Optional. Fallback value if not found in the database.
     602 *                            Default: false.
    601603 * @return bool True if group activity deletions are disabled, otherwise false.
    602604 */
    603 function bp_disable_group_activity_deletions( $retval = false ) {
     605function bp_disable_group_activity_deletions( $default_value = false ) {
    604606
    605607    /**
     
    611613     *                                      group admin or group mod are able to delete group activity post.
    612614     */
    613     return (bool) apply_filters( 'bp_disable_group_activity_deletions', (bool) bp_get_option( 'bp-disable-group-activity-deletions', $retval ) );
     615    return (bool) apply_filters( 'bp_disable_group_activity_deletions', (bool) bp_get_option( 'bp-disable-group-activity-deletions', $default_value ) );
    614616}
    615617
     
    619621 * @since 1.6.0
    620622 *
    621  * @param bool $retval Optional. Fallback value if not found in the database.
    622  *                     Default: true.
     623 * @param bool $default_value Optional. Fallback value if not found in the database.
     624 *                            Default: true.
    623625 * @return bool True if users are able to delete their own accounts, otherwise
    624626 *              false.
    625627 */
    626 function bp_disable_account_deletion( $retval = false ) {
     628function bp_disable_account_deletion( $default_value = false ) {
    627629
    628630    /**
     
    633635     * @param bool $disable_account_deletion Whether or not members are able to delete their own accounts.
    634636     */
    635     return apply_filters( 'bp_disable_account_deletion', (bool) bp_get_option( 'bp-disable-account-deletion', $retval ) );
     637    return apply_filters( 'bp_disable_account_deletion', (bool) bp_get_option( 'bp-disable-account-deletion', $default_value ) );
    636638}
    637639
     
    643645 * @todo split and move into blog and forum components.
    644646 *
    645  * @param bool $retval Optional. Fallback value if not found in the database.
    646  *                     Default: false.
     647 * @param bool $default_value Optional. Fallback value if not found in the database.
     648 *                            Default: false.
    647649 * @return bool True if activity comments are disabled for blog and forum
    648650 *              items, otherwise false.
    649651 */
    650 function bp_disable_blogforum_comments( $retval = false ) {
     652function bp_disable_blogforum_comments( $default_value = false ) {
    651653
    652654    /**
     
    657659     * @param bool $disable_blog_forum_comments Whether or not blog and forum activity stream comments are disabled.
    658660     */
    659     return (bool) apply_filters( 'bp_disable_blogforum_comments', (bool) bp_get_option( 'bp-disable-blogforum-comments', $retval ) );
     661    return (bool) apply_filters( 'bp_disable_blogforum_comments', (bool) bp_get_option( 'bp-disable-blogforum-comments', $default_value ) );
    660662}
    661663
     
    667669 * @todo Move into groups component.
    668670 *
    669  * @param bool $retval Optional. Fallback value if not found in the database.
    670  *                     Default: true.
     671 * @param bool $default_value Optional. Fallback value if not found in the database.
     672 *                            Default: true.
    671673 * @return bool True if group creation is restricted, otherwise false.
    672674 */
    673 function bp_restrict_group_creation( $retval = true ) {
     675function bp_restrict_group_creation( $default_value = true ) {
    674676
    675677    /**
     
    680682     * @param bool $group_creation Whether or not group creation is turned off.
    681683     */
    682     return (bool) apply_filters( 'bp_restrict_group_creation', (bool) bp_get_option( 'bp_restrict_group_creation', $retval ) );
     684    return (bool) apply_filters( 'bp_restrict_group_creation', (bool) bp_get_option( 'bp_restrict_group_creation', $default_value ) );
    683685}
    684686
     
    688690 * @since 1.6.0
    689691 *
    690  * @param bool $retval Optional. Fallback value if not found in the database.
    691  *                     Default: true.
     692 * @param bool $default_value Optional. Fallback value if not found in the database.
     693 *                            Default: true.
    692694 * @return bool True if Akismet is enabled, otherwise false.
    693695 */
    694 function bp_is_akismet_active( $retval = true ) {
     696function bp_is_akismet_active( $default_value = true ) {
    695697
    696698    /**
     
    699701     * @since 1.6.0
    700702     *
    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 ) );
     703     * @param bool $is_akistmet_active Whether or not Akismet is enabled.
     704     */
     705    return (bool) apply_filters( 'bp_is_akismet_active', (bool) bp_get_option( '_bp_enable_akismet', $default_value ) );
    704706}
    705707
     
    709711 * @since 2.0.0
    710712 *
    711  * @param bool $retval Optional. Fallback value if not found in the database.
    712  *                     Default: true.
     713 * @param bool $default_value Optional. Fallback value if not found in the database.
     714 *                            Default: true.
    713715 * @return bool True if Heartbeat refresh is enabled, otherwise false.
    714716 */
    715 function bp_is_activity_heartbeat_active( $retval = true ) {
     717function bp_is_activity_heartbeat_active( $default_value = true ) {
    716718
    717719    /**
     
    722724     * @param bool $heartbeat_active Whether or not Activity Heartbeat refresh is enabled.
    723725     */
    724     return (bool) apply_filters( 'bp_is_activity_heartbeat_active', (bool) bp_get_option( '_bp_enable_heartbeat_refresh', $retval ) );
     726    return (bool) apply_filters( 'bp_is_activity_heartbeat_active', (bool) bp_get_option( '_bp_enable_heartbeat_refresh', $default_value ) );
    725727}
    726728
  • trunk/src/bp-core/bp-core-rest-api.php

    r13903 r13968  
    2525 * Should we use the REST Endpoints of built BuddyPress?
    2626 *
    27  * If the BP REST plugin is active, it overrides BuddyPress REST enpoints.
     27 * If the BP REST plugin is active, it overrides BuddyPress REST endpoints.
    2828 * This allows us to carry on maintaining all the BP REST API endpoints from
    2929 * the BP REST plugin on GitHub.
     
    5555     * @since 5.0.0
    5656     *
    57      * @param boolean $value True if the BP REST API is available. False otherwise.
     57     * @param bool $api_is_available True if the BP REST API is available. False otherwise.
    5858     */
    5959    return apply_filters( 'bp_rest_api_is_available', bp_rest_in_buddypress() ) || bp_rest_is_plugin_active();
     
    204204function bp_rest_sanitize_member_types( $value ) {
    205205    if ( empty( $value ) ) {
    206         return $value;
     206        return null;
    207207    }
    208208
  • trunk/src/bp-core/bp-core-rewrites.php

    r13877 r13968  
    326326 *
    327327 * @param string $request The request used during parsing.
    328  * @return array          Data to use to find a member single item from the request.
     328 * @return array Data to use to find a member single item from the request.
    329329 */
    330330function bp_rewrites_get_member_data( $request = '' ) {
  • trunk/src/bp-core/bp-core-taxonomy.php

    r13903 r13968  
    8888     * @since 2.6.0
    8989     *
    90      * @param int    $site_id  Site ID to cehck for.
     90     * @param int    $site_id  Site ID to check for.
    9191     * @param string $taxonomy Taxonomy slug to check for.
    9292     */
     
    105105 * @param string       $taxonomy  Taxonomy name.
    106106 * @param bool         $append    Optional. True to append terms to existing terms. Default: false.
    107  * @return array Array of term taxonomy IDs.
     107 * @return int[] Array of term taxonomy IDs.
    108108 */
    109109function bp_set_object_terms( $object_id, $terms, $taxonomy, $append = false ) {
  • trunk/src/bp-core/bp-core-template-loader.php

    r13903 r13968  
    88 *
    99 * @package BuddyPress
    10  * @subpackage TemplateFunctions
     10 * @subpackage Core
    1111 * @since 1.7.0
    1212 */
     
    1919 *
    2020 * @since 1.7.0
    21  * @since 7.0.0 Added $args parameter.
     21 * @since 7.0.0 Added `$args` parameter.
    2222 *
    2323 * @param string      $slug Template part slug. Used to generate filenames,
     
    5555     *
    5656     * @since 1.7.0
    57      * @since 7.0.0 Added $args parameter.
     57     * @since 7.0.0 Added `$args` parameter.
    5858     *
    5959     * @param array  $templates Array of templates located.
     
    7575 *
    7676 * @since 2.6.0
    77  * @since 7.0.0 Added $args parameter.
     77 * @since 7.0.0 Added `$args` parameter.
    7878 *
    7979 * @see bp_get_template_part() for full documentation.
     
    156156 *
    157157 * @since 1.7.0
    158  * @since 7.0.0 Added $args parameter.
     158 * @since 7.0.0 Added `$args` parameter.
    159159 *
    160160 * @param string|array $template_names Template file(s) to search for, in order.
     
    218218     * @since 2.5.0
    219219     *
    220      * @param bool $value True to load the template, false otherwise.
     220     * @param bool $load_template True to load the template, false otherwise.
    221221     */
    222222    $load_template = (bool) apply_filters( 'bp_locate_template_and_load', true );
     
    392392 *
    393393 * @since 1.7.0
    394  * @since 7.0.0 Added $args parameter.
     394 * @since 7.0.0 Added `$args` parameter.
    395395 *
    396396 * @see bp_get_template_part() for a description of $slug, $name and $args params.
     
    541541     * @since 1.7.0
    542542     *
    543      * @param array $value  Array of all template locations registered so far.
     543     * @param array $template_locations  Array of all template locations registered so far.
    544544     * @param array $stacks Array of template locations.
    545545     */
     
    643643     * @since 12.0.0
    644644     *
    645      * @param WP_Query $posts_query WP_Query instance. Passed by reference.
     645     * @param WP_Query $referer_query WP_Query instance. Passed by reference.
    646646     */
    647647    do_action_ref_array( 'bp_parse_query', array( &$referer_query ) );
     
    654654 *
    655655 * @since 12.0.0
     656 *
     657 * @global WP $wp WordPress main instance.
    656658 *
    657659 * @param string   $bp_request A specific BuddyPress request.
     
    659661 * @return true
    660662 */
    661 function bp_reset_query( $bp_request = '', WP_Query $query = null ) {
     663function bp_reset_query( $bp_request = '', $query = null ) {
    662664    global $wp;
    663665
     
    676678            $matched_query = wp_parse_url( $bp_request, PHP_URL_QUERY );
    677679        } else {
    678             // Temporarly override the request uri.
     680            // Temporarily override the request uri.
    679681            $_SERVER['REQUEST_URI'] = $bp_request;
    680682
     
    700702        $query->parse_query( $matched_query );
    701703
    702         // Use to requery in case of root profiles.
     704        // Use to request in case of root profiles.
    703705    } elseif ( isset( $wp->request ) ) {
    704         // Temporarly override the request uri.
     706        // Temporarily override the request uri.
    705707        $_SERVER['REQUEST_URI'] = str_replace( $wp->request, $bp_request, $reset_server_request_uri );
    706708
     
    783785 * @since 1.8.0
    784786 *
    785  * @return bool True if yes, false if no.
     787 * @return bool
    786788 */
    787789function bp_is_template_included() {
     
    794796 * @since 1.7.0
    795797 *
    796  * @global string $pagenow
     798 * @global string $pagenow The current page being loaded.
     799 * @global WP_Query $wp_query The WordPress Query object.
    797800 */
    798801function bp_load_theme_functions() {
  • trunk/src/bp-core/bp-core-theme-compatibility.php

    r13932 r13968  
    44 *
    55 * @package BuddyPress
    6  * @subpackage ThemeCompatibility
     6 * @subpackage Core
    77 * @since 1.7.0
    88 */
     
    6161     * @since 1.7.0
    6262     *
    63      * @param string $id ID of the theme package in use.
     63     * @param string $theme_compat_id ID of the theme package in use.
    6464     */
    6565    return apply_filters( 'bp_get_theme_compat_id', buddypress()->theme_compat->theme->id );
     
    8383     * @since 1.7.0
    8484     *
    85      * @param string $name Name of the theme package in use.
     85     * @param string $theme_compat_name Name of the theme package in use.
    8686     */
    8787    return apply_filters( 'bp_get_theme_compat_name', buddypress()->theme_compat->theme->name );
     
    105105     * @since 1.7.0
    106106     *
    107      * @param string $version The version string of the theme package in use.
     107     * @param string $theme_compat_version The version string of the theme package in use.
    108108     */
    109109    return apply_filters( 'bp_get_theme_compat_version', buddypress()->theme_compat->theme->version );
     
    127127     * @since 1.7.0
    128128     *
    129      * @param string $dir The absolute path of the theme package in use.
     129     * @param string $theme_compat_dir The absolute path of the theme package in use.
    130130     */
    131131    return apply_filters( 'bp_get_theme_compat_dir', buddypress()->theme_compat->theme->dir );
     
    150150     * @since 1.7.0
    151151     *
    152      * @param string $url URL of the theme package in use.
     152     * @param string $theme_compat_url URL of the theme package in use.
    153153     */
    154154    return apply_filters( 'bp_get_theme_compat_url', buddypress()->theme_compat->theme->url );
     
    170170    }
    171171
     172    $theme_compat_with_current_theme = wp_validate_boolean( buddypress()->theme_compat->use_with_current_theme );
     173
    172174    /**
    173175     * Filters whether or not to use theme compat for the active theme.
     
    175177     * @since 1.9.0
    176178     *
    177      * @param bool $use_with_current_theme True if the current theme needs theme compatibility.
    178      */
    179     return apply_filters( 'bp_use_theme_compat_with_current_theme', buddypress()->theme_compat->use_with_current_theme );
     179     * @param bool $theme_compat_with_current_theme True if the current theme needs theme compatibility.
     180     */
     181    return apply_filters( 'bp_use_theme_compat_with_current_theme', $theme_compat_with_current_theme );
    180182}
    181183
     
    373375 *
    374376 * @param string $feature The feature (eg: cover_image).
    375  * @return object The feature settings.
     377 * @return false|object The feature settings or false if the feature is not found.
    376378 */
    377379function bp_get_theme_compat_feature( $feature = '' ) {
     
    482484 * @param string $template The template name to check.
    483485 * @return bool True if the value of $template is the same as the
    484  *              "original_template" originally selected by WP. Otherwise false.
     486 *              "original_template" originally selected by WP. Otherwise, false.
    485487 */
    486488function bp_is_theme_compat_original_template( $template = '' ) {
     
    491493    }
    492494
    493     return (bool) ( $bp->theme_compat->original_template === $template );
     495    return $bp->theme_compat->original_template === $template;
    494496}
    495497
     
    807809 * @since 1.7.0
    808810 *
    809  * @global WP_filter $wp_filter
    810  * @global array $merged_filters
     811 * @global array $wp_filter      Stores all the filters.
     812 * @global array $merged_filters Merges the filter hooks using this function.
    811813 *
    812814 * @param string   $tag      The filter tag to remove filters from.
     
    862864 * @since 1.7.0
    863865 *
    864  * @global WP_filter $wp_filter
    865  * @global array $merged_filters
     866 * @global array $wp_filter      Stores all the filters.
     867 * @global array $merged_filters Merges the filter hooks using this function.
    866868 *
    867869 * @param string   $tag      The tag to which filters should be restored.
     
    978980 * @since 1.9.2
    979981 *
     982 * @global WP_Query $wp_query WordPress database query object.
     983 *
    980984 * @param  string $retval The current post content.
    981  * @return string $retval
     985 * @return string
    982986 */
    983987function bp_theme_compat_toggle_is_page( $retval = '' ) {
     
    10011005 *
    10021006 * @see bp_theme_compat_toggle_is_page()
    1003  * @param object $query The WP_Query object.
     1007 *
     1008 * @param WP_Query $query The WP_Query object.
    10041009 */
    10051010function bp_theme_compat_loop_end( $query ) {
     
    11191124 *
    11201125 * @param array $args An associative array containing **ONE** feature & keyed by the BP Component ID.
    1121  * @return boolean True if the theme supports the BP feature. False otherwise.
     1126 * @return bool True if the theme supports the BP feature. False otherwise.
    11221127 */
    11231128function bp_current_theme_supports( $args = array() ) {
    11241129    if ( is_array( $args ) && $args && ( 1 < count( $args ) || is_array( $args[ key( $args ) ] ) ) ) {
    1125         _doing_it_wrong( __FUNCTION__, esc_html( 'The function only supports checking 1 feature for a specific component at a time for now.', 'buddypress' ), '14.0.0' );
     1130        _doing_it_wrong(
     1131            __FUNCTION__,
     1132            esc_html__( 'The function only supports checking 1 feature for a specific component at a time for now.', 'buddypress' ),
     1133            '14.0.0'
     1134        );
     1135
    11261136        return false;
    11271137    }
     
    11341144     * @since 14.0.0
    11351145     *
    1136      * @param boolean $supports True if the theme supports the BP feature. False otherwise.
     1146     * @param bool $supports True if the theme supports the BP feature. False otherwise.
    11371147     */
    11381148    return apply_filters( 'bp_current_theme_supports', $supports, $args );
  • trunk/src/bp-core/bp-core-update.php

    r13943 r13968  
    44 *
    55 * @package BuddyPress
    6  * @subpackage Updater
     6 * @subpackage Core
    77 * @since 1.6.0
    88 */
     
    338338 *
    339339 * @since 2.3.0
     340 *
     341 * @global wpdb $wpdb WordPress database object.
    340342 */
    341343function bp_pre_schema_upgrade() {
     
    731733 *
    732734 * @param array $emails The array of emails schema.
     735 * @return array
    733736 */
    734737function bp_core_get_8_0_upgrade_email_schema( $emails ) {
     
    769772 *
    770773 * @param array $emails The array of emails schema.
     774 * @return array
    771775 */
    772776function bp_core_get_10_0_upgrade_email_schema( $emails ) {
     
    807811 *
    808812 * @param array $emails The array of emails schema.
     813 * @return array
    809814 */
    810815function bp_core_get_11_0_upgrade_email_schema( $emails ) {
     
    947952 *
    948953 * Edit db schema to stop using boolean fields in favor of tinyint ones.
    949  * This moves was necessary to support WP Playground.
     954 * This move was necessary to support WP Playground.
    950955 *
    951956 * @since 14.0.0
     957 *
     958 * @global wpdb $wpdb WordPress database object.
    952959 */
    953960function bp_update_to_14_0() {
    954961    global $wpdb;
    955     $bp        = buddypress();
    956     $bp_prefix = bp_core_get_table_prefix();
     962
     963    $bp = buddypress();
    957964
    958965    if ( isset( $bp->members->table_name_last_activity ) && $wpdb->get_var( "SHOW TABLES LIKE '%{$bp->members->table_name_last_activity}%'" ) ) {
     
    10001007function bp_migrate_new_member_activity_component() {
    10011008    global $wpdb;
     1009
    10021010    $bp = buddypress();
    10031011
  • trunk/src/bp-core/bp-core-wpabstraction.php

    r13395 r13968  
    1010 *
    1111 * @package BuddyPress
    12  * @subpackage WPAbstraction
     12 * @subpackage Core
    1313 * @since 1.2.0
    1414 */
     
    2424 * @global string $wp_version WP Version number.
    2525 *
    26  * @return double
     26 * @return float
    2727 */
    2828function bp_get_major_wp_version() {
     
    3535 * Only add MS-specific abstraction functions if WordPress is not in multisite mode.
    3636 */
    37 if ( !is_multisite() ) {
     37if ( ! is_multisite() ) {
    3838    global $wpdb;
    3939
     
    4141    $wpdb->blogid      = BP_ROOT_BLOG;
    4242
    43     if ( !function_exists( 'get_blog_option' ) ) {
     43    if ( ! function_exists( 'get_blog_option' ) ) {
    4444
    4545        /**
     
    5252         * @param int    $blog_id     Blog ID to fetch for. Not used.
    5353         * @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.
    5555         * @return mixed
    5656         */
     
    7272         * @param string $option_name  Option name to add.
    7373         * @param mixed  $option_value Option value to add.
    74          * @return mixed
     74         * @return bool
    7575         */
    7676        function add_blog_option( $blog_id, $option_name, $option_value ) {
     
    7979    }
    8080
    81     if ( !function_exists( 'update_blog_option' ) ) {
     81    if ( ! function_exists( 'update_blog_option' ) ) {
    8282
    8383        /**
     
    8888         * @see update_blog_option()
    8989         *
    90          * @param int    $blog_id     Blog ID to update for. Not used.
    91          * @param string $option_name Option name to update.
    92          * @param mixed  $value      Option value to update.
    93          * @return mixed
    94          */
    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' ) ) {
    101101
    102102        /**
     
    109109         * @param int    $blog_id     Blog ID to delete for. Not used.
    110110         * @param string $option_name Option name to delete.
    111          * @return mixed
     111         * @return bool
    112112         */
    113113        function delete_blog_option( $blog_id, $option_name ) {
     
    116116    }
    117117
    118     if ( !function_exists( 'switch_to_blog' ) ) {
     118    if ( ! function_exists( 'switch_to_blog' ) ) {
    119119
    120120        /**
     
    126126         *
    127127         * @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.
    129129         * @return int
    130130         */
     
    134134    }
    135135
    136     if ( !function_exists( 'restore_current_blog' ) ) {
     136    if ( ! function_exists( 'restore_current_blog' ) ) {
    137137
    138138        /**
     
    150150    }
    151151
    152     if ( !function_exists( 'get_blogs_of_user' ) ) {
    153 
    154         /**
    155          * Retrive blogs associated with user.
     152    if ( ! function_exists( 'get_blogs_of_user' ) ) {
     153
     154        /**
     155         * Retrieve blogs associated with user.
    156156         *
    157157         * @since 1.2.0
     
    160160         *
    161161         * @param int  $user_id ID of the user. Not used.
    162          * @param bool $all     Whether or not to return all. Not used.
    163          * @return bool
     162         * @param bool $all     Whether to return all. Not used.
     163         * @return false
    164164         */
    165165        function get_blogs_of_user( $user_id, $all = false ) {
     
    168168    }
    169169
    170     if ( !function_exists( 'update_blog_status' ) ) {
     170    if ( ! function_exists( 'update_blog_status' ) ) {
    171171
    172172        /**
     
    181181         * @param string $value      Value. Not used.
    182182         * @param null   $deprecated Whether or not deprecated. Not used.
    183          * @return bool
     183         * @return true
    184184         */
    185185        function update_blog_status( $blog_id, $pref, $value, $deprecated = null ) {
     
    188188    }
    189189
    190     if ( !function_exists( 'is_subdomain_install' ) ) {
     190    if ( ! function_exists( 'is_subdomain_install' ) ) {
    191191
    192192        /**
     
    200200         */
    201201        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 ) );
    206203        }
    207204    }
     
    218215 */
    219216function bp_core_get_status_sql( $prefix = false ) {
    220     if ( !is_multisite() )
     217    if ( ! is_multisite() ) {
    221218        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";
    224222}
    225223
     
    232230 * Borrowed from MediaWiki, under the GPLv2. Thanks!
    233231 */
    234 if ( !function_exists( 'mb_strlen' ) ) {
     232if ( ! function_exists( 'mb_strlen' ) ) {
    235233
    236234    /**
     
    243241    function mb_strlen( $str, $enc = '' ) {
    244242        $counts = count_chars( $str );
    245         $total = 0;
     243        $total  = 0;
    246244
    247245        // 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 ];
    250248        }
    251249
    252250        // 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 ];
    255253        }
    256254        return $total;
     
    258256}
    259257
    260 if ( !function_exists( 'mb_strpos' ) ) {
     258if ( ! function_exists( 'mb_strpos' ) ) {
    261259
    262260    /**
     
    275273        preg_match( '/' . $needle . '/u', $haystack, $ar, PREG_OFFSET_CAPTURE, $offset );
    276274
    277         if( isset( $ar[0][1] ) ) {
     275        if ( isset( $ar[0][1] ) ) {
    278276            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
     283if ( ! function_exists( 'mb_strrpos' ) ) {
    286284
    287285    /**
     
    300298        preg_match_all( '/' . $needle . '/u', $haystack, $ar, PREG_OFFSET_CAPTURE, $offset );
    301299
    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;
    308306    }
    309307}
     
    313311 *
    314312 * @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()}.
    315316 */
    316317function bp_catch_site_data( $errors = null, $data = array() ) {
     
    390391function bp_delete_site_no_tables_drop( $site ) {
    391392    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}
     396add_action( 'wp_update_site', 'bp_delete_site_no_tables_drop' );
    396397
    397398/**
Note: See TracChangeset for help on using the changeset viewer.