Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/04/2024 02:30:49 AM (20 months ago)
Author:
espellcaste
Message:

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

Follow-up to [13901]

See #9164 and #7228

File:
1 edited

Legend:

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

    r13890 r13903  
    2424
    2525    // Default options.
    26     $options = array (
     26    $options = array(
    2727
    2828        /* Components ********************************************************/
     
    6464
    6565        // Allow Group Activity Deletions.
    66         'bp-disable-group-activity-deletions'   => false,
     66        'bp-disable-group-activity-deletions'  => false,
    6767
    6868        // Allow users to delete their own accounts.
     
    312312function bp_core_activate_site_options( $keys = array() ) {
    313313
    314     if ( !empty( $keys ) && is_array( $keys ) ) {
     314    if ( ! empty( $keys ) && is_array( $keys ) ) {
    315315        $bp = buddypress();
    316316
     
    321321                $bp->site_options[ $key ] = bp_get_option( $key, $default );
    322322
    323                 if ( !bp_update_option( $key, $bp->site_options[ $key ] ) ) {
     323                if ( ! bp_update_option( $key, $bp->site_options[ $key ] ) ) {
    324324                    $errors = true;
    325325                }
     
    365365    if ( false === $root_blog_options_meta ) {
    366366        $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';
    368368        $blog_options_query     = "SELECT option_name AS name, option_value AS value FROM {$blog_options_table} WHERE option_name IN ( {$blog_options_keys} )";
    369369        $root_blog_options_meta = $wpdb->get_results( $blog_options_query );
     
    379379             * @param array $value Array of multisite options from sitemeta table.
    380380             */
    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            );
    387390
    388391            $current_site           = get_current_site();
     
    398401        // Loop through our results and make them usable.
    399402        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;
    401404        }
    402405
     
    594597 * @since 14.0.0
    595598 *
    596  * @param bool $default Optional. 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.
    598601 * @return bool True if group activity deletions are disabled, otherwise false.
    599602 */
    600 function bp_disable_group_activity_deletions( $default = false ) {
     603function bp_disable_group_activity_deletions( $retval = false ) {
    601604
    602605    /**
     
    605608     * @since 14.0.0
    606609     *
    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 ) );
    610614}
    611615
     
    615619 * @since 1.6.0
    616620 *
    617  * @param bool $default Optional. 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.
    619623 * @return bool True if users are able to delete their own accounts, otherwise
    620624 *              false.
    621625 */
    622 function bp_disable_account_deletion( $default = false ) {
     626function bp_disable_account_deletion( $retval = false ) {
    623627
    624628    /**
     
    627631     * @since 1.6.0
    628632     *
    629      * @param bool $value Whether 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 ) );
    632636}
    633637
     
    639643 * @todo split and move into blog and forum components.
    640644 *
    641  * @param bool $default Optional. 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.
    643647 * @return bool True if activity comments are disabled for blog and forum
    644648 *              items, otherwise false.
    645649 */
    646 function bp_disable_blogforum_comments( $default = false ) {
     650function bp_disable_blogforum_comments( $retval = false ) {
    647651
    648652    /**
     
    651655     * @since 1.6.0
    652656     *
    653      * @param bool $value Whether 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 ) );
    656660}
    657661
     
    663667 * @todo Move into groups component.
    664668 *
    665  * @param bool $default Optional. 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.
    667671 * @return bool True if group creation is restricted, otherwise false.
    668672 */
    669 function bp_restrict_group_creation( $default = true ) {
     673function bp_restrict_group_creation( $retval = true ) {
    670674
    671675    /**
     
    674678     * @since 1.6.0
    675679     *
    676      * @param bool $value Whether 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 ) );
    679683}
    680684
     
    684688 * @since 1.6.0
    685689 *
    686  * @param bool $default Optional. 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.
    688692 * @return bool True if Akismet is enabled, otherwise false.
    689693 */
    690 function bp_is_akismet_active( $default = true ) {
     694function bp_is_akismet_active( $retval = true ) {
    691695
    692696    /**
     
    695699     * @since 1.6.0
    696700     *
    697      * @param bool $value Whether 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 ) );
    700704}
    701705
     
    705709 * @since 2.0.0
    706710 *
    707  * @param bool $default Optional. 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.
    709713 * @return bool True if Heartbeat refresh is enabled, otherwise false.
    710714 */
    711 function bp_is_activity_heartbeat_active( $default = true ) {
     715function bp_is_activity_heartbeat_active( $retval = true ) {
    712716
    713717    /**
     
    716720     * @since 2.0.0
    717721     *
    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 ) );
    721725}
    722726
     
    739743     * @param string $package_id The current theme package ID.
    740744     */
    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}
Note: See TracChangeset for help on using the changeset viewer.