Skip to:
Content

BuddyPress.org

Changeset 13878


Ignore:
Timestamp:
06/01/2024 04:26:18 PM (18 months ago)
Author:
espellcaste
Message:

WPCS: The modified code addresses all Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword and Squiz.Functions.MultiLineFunctionDeclaration.SpaceAfterFunction issues specific to the foreach and function examples.

See #7228

Location:
trunk
Files:
61 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-filters.php

    r13636 r13878  
    306306    if ( ! empty( $usernames ) ) {
    307307        // Replace @mention text with userlinks.
    308         foreach( (array) $usernames as $user_id => $username ) {
     308        foreach ( (array) $usernames as $user_id => $username ) {
    309309            $activity->content = preg_replace( '/(@' . $username . '\b)/', "<a class='bp-suggestions-mention' href='" . bp_members_get_user_url( $user_id ) . "' rel='nofollow'>@$username</a>", $activity->content );
    310310        }
     
    344344
    345345    // Send @mentions and setup BP notifications.
    346     foreach( (array) $usernames as $user_id => $username ) {
     346    foreach ( (array) $usernames as $user_id => $username ) {
    347347
    348348        /**
  • trunk/src/bp-activity/bp-activity-functions.php

    r13716 r13878  
    104104
    105105    // We've found some mentions! Check to see if users exist.
    106     foreach( (array) array_values( $usernames ) as $username ) {
     106    foreach ( (array) array_values( $usernames ) as $username ) {
    107107        $user_id = bp_activity_get_userid_from_mentionname( $username );
    108108
     
    181181
    182182    // Increment mention count foreach mentioned user.
    183     foreach( (array) array_keys( $usernames ) as $user_id ) {
     183    foreach ( (array) array_keys( $usernames ) as $user_id ) {
    184184        bp_activity_update_mention_count_for_user( $user_id, $activity_id, $action );
    185185    }
     
    32563256        // Recursively delete all children of this comment.
    32573257        if ( ! empty( $children ) ) {
    3258             foreach( (array) $children as $child ) {
     3258            foreach ( (array) $children as $child ) {
    32593259                bp_activity_delete_children( $activity_id, $child->id );
    32603260            }
     
    38533853
    38543854    // Don't leave multiple notifications for the same activity item.
    3855     foreach( $notifications as $notification ) {
     3855    foreach ( $notifications as $notification ) {
    38563856        if ( $activity_id == $notification->item_id ) {
    38573857            return;
     
    41224122    buddypress()->activity->read_more_id = $activity->id;
    41234123
    4124     add_filter( 'embed_post_id',         function() { return buddypress()->activity->read_more_id; } );
     4124    add_filter( 'embed_post_id',         function () { return buddypress()->activity->read_more_id; } );
    41254125    add_filter( 'bp_embed_get_cache',    'bp_embed_activity_cache',      10, 3 );
    41264126    add_action( 'bp_embed_update_cache', 'bp_embed_activity_save_cache', 10, 3 );
  • trunk/src/bp-activity/classes/class-bp-activity-list-table.php

    r13816 r13878  
    181181
    182182            // Sort the array by the activity object's date_recorded value.
    183             usort( $activities['activities'], function( $a, $b ) { return $a->date_recorded > $b->date_recorded; } );
     183            usort( $activities['activities'], function ( $a, $b ) { return $a->date_recorded > $b->date_recorded; } );
    184184        }
    185185
  • trunk/src/bp-activity/classes/class-bp-activity-template.php

    r13816 r13878  
    313313
    314314        if ( !empty( $activity_parents['activities'] ) ) {
    315             foreach( $activity_parents['activities'] as $parent ) {
     315            foreach ( $activity_parents['activities'] as $parent ) {
    316316                $this->activity_parents[ $parent->id ] = $parent;
    317317            }
  • trunk/src/bp-core/admin/bp-core-admin-functions.php

    r13871 r13878  
    14071407    ?>
    14081408    <script type="text/javascript">
    1409     jQuery( '#menu-to-edit').on( 'click', 'a.item-edit', function() {
     1409    jQuery( '#menu-to-edit').on( 'click', 'a.item-edit', function () {
    14101410        var settings  = jQuery(this).closest( '.menu-item-bar' ).next( '.menu-item-settings' );
    14111411        var css_class = settings.find( '.edit-menu-item-classes' );
     
    15411541    ?>
    15421542    <script type="text/javascript">
    1543         jQuery( document ).ready( function($) {
    1544             $( '.row-actions .ham' ).each( function() {
     1543        jQuery( document ).ready( function ($) {
     1544            $( '.row-actions .ham' ).each( function () {
    15451545                $( this ).closest( 'tr' ).addClass( 'site-spammed' );
    15461546            });
  • trunk/src/bp-core/admin/bp-core-admin-settings.php

    r13870 r13878  
    432432        // in the $_POST array when unchecked, we loop through the registered settings.
    433433        if ( isset( $wp_settings_fields['buddypress'] ) ) {
    434             foreach( (array) $wp_settings_fields['buddypress'] as $section => $settings ) {
    435                 foreach( $settings as $setting_name => $setting ) {
     434            foreach ( (array) $wp_settings_fields['buddypress'] as $section => $settings ) {
     435                foreach ( $settings as $setting_name => $setting ) {
    436436                    $value = isset( $_POST[$setting_name] ) ? $_POST[$setting_name] : '';
    437437
     
    455455        );
    456456
    457         foreach( $legacy_options as $legacy_option ) {
     457        foreach ( $legacy_options as $legacy_option ) {
    458458            // Note: Each of these options is represented by its opposite in the UI
    459459            // Ie, the Profile Syncing option reads "Enable Sync", so when it's checked,
  • trunk/src/bp-core/admin/bp-core-admin-tools.php

    r13818 r13878  
    558558    $message = '<div id="message" class="' . esc_attr( $class ) . ' notice is-dismissible">' . $message . '</div>';
    559559    $message = str_replace( "'", "\'", $message );
    560     $lambda  = function() use ( $message ) {
     560    $lambda  = function () use ( $message ) {
    561561        echo wp_kses(
    562562            $message,
     
    782782        }
    783783
    784         foreach( $settings as $bp_setting ) {
     784        foreach ( $settings as $bp_setting ) {
    785785            $reverse = (
    786786                strpos( $bp_setting['id'], 'hide' ) !== false ||
     
    11301130        wp_add_inline_script(
    11311131            'site-health',
    1132             '( function() {
     1132            '( function () {
    11331133                let bpHelpSidebarLinks;
    11341134
    1135                 document.onreadystatechange = function()  {
     1135                document.onreadystatechange = function ()  {
    11361136                    if ( document.readyState === "complete" ) {
    11371137                        bpHelpSidebarLinks = document.querySelector( \'.bp-help-sidebar-links\' ).closest( \'p\')
     
    11421142                document.querySelectorAll( \'.contextual-help-tabs ul li a\' ).forEach(
    11431143                    function( a ) {
    1144                         a.addEventListener( \'click\', function( e ) {
     1144                        a.addEventListener( \'click\', function ( e ) {
    11451145                            if ( \'tab-link-bp-debug-settings\' === e.target.parentElement.getAttribute( \'id\' ) ) {
    11461146                                bpHelpSidebarLinks.style.display = \'block\';
  • trunk/src/bp-core/bp-core-avatars.php

    r13541 r13878  
    537537
    538538                // Check for current avatar.
    539                 foreach( $avatar_files as $key => $value ) {
     539                foreach ( $avatar_files as $key => $value ) {
    540540                    if ( strpos ( $value, $avatar_size )!== false ) {
    541541                        $avatar_url = $avatar_folder_url . '/' . $avatar_files[$key];
     
    545545                // Legacy avatar check.
    546546                if ( !isset( $avatar_url ) ) {
    547                     foreach( $avatar_files as $key => $value ) {
     547                    foreach ( $avatar_files as $key => $value ) {
    548548                        if ( strpos ( $value, $legacy_user_avatar_name )!== false ) {
    549549                            $avatar_url = $avatar_folder_url . '/' . $avatar_files[$key];
     
    553553                    // Legacy group avatar check.
    554554                    if ( !isset( $avatar_url ) ) {
    555                         foreach( $avatar_files as $key => $value ) {
     555                        foreach ( $avatar_files as $key => $value ) {
    556556                            if ( strpos ( $value, $legacy_group_avatar_name )!== false ) {
    557557                                $avatar_url = $avatar_folder_url . '/' . $avatar_files[$key];
     
    23132313    // Add a revision of the current avatar if it's not a mystery man!
    23142314    if ( $current_avatars ) {
    2315         foreach( $current_avatars as $current_avatar ) {
     2315        foreach ( $current_avatars as $current_avatar ) {
    23162316            if ( ! isset( $current_avatar->name, $current_avatar->id, $current_avatar->path ) ) {
    23172317                continue;
     
    23942394            }
    23952395        } else {
    2396             foreach( $avatar_types as $type_key => $avatar_path ) {
     2396            foreach ( $avatar_types as $type_key => $avatar_path ) {
    23972397                $filename  = wp_basename( $avatar_path );
    23982398                $avatar_id = pathinfo( $filename, PATHINFO_FILENAME );
  • trunk/src/bp-core/bp-core-buddybar.php

    r13519 r13878  
    968968    }
    969969
    970     foreach( $subnav_items as $subnav_item ) {
     970    foreach ( $subnav_items as $subnav_item ) {
    971971        $bp->{$component}->nav->delete_nav( $subnav_item->slug, $parent_slug );
    972972    }
  • trunk/src/bp-core/bp-core-caps.php

    r13818 r13878  
    7171
    7272    // Loop through available roles and add them.
    73     foreach( $wp_roles->role_objects as $role ) {
     73    foreach ( $wp_roles->role_objects as $role ) {
    7474        foreach ( bp_get_caps_for_role( $role->name ) as $cap ) {
    7575            $role->add_cap( $cap );
     
    105105
    106106    // Loop through available roles and remove them.
    107     foreach( $wp_roles->role_objects as $role ) {
     107    foreach ( $wp_roles->role_objects as $role ) {
    108108        foreach ( bp_get_caps_for_role( $role->name ) as $cap ) {
    109109            $role->remove_cap( $cap );
  • trunk/src/bp-core/bp-core-cssjs.php

    r13818 r13878  
    282282
    283283    <script type="text/javascript">
    284         jQuery( window ).on( 'load', function() {
     284        jQuery( window ).on( 'load', function () {
    285285            jQuery( '#avatar-to-crop' ).Jcrop( {
    286286                onChange: showPreview,
  • trunk/src/bp-core/bp-core-customizer-email.php

    r11904 r13878  
    2929
    3030    $sections = bp_email_get_customizer_sections();
    31     foreach( $sections as $section_id => $args ) {
     31    foreach ( $sections as $section_id => $args ) {
    3232        $wp_customize->add_section( $section_id, $args );
    3333    }
    3434
    3535    $settings = bp_email_get_customizer_settings();
    36     foreach( $settings as $setting_id => $args ) {
     36    foreach ( $settings as $setting_id => $args ) {
    3737        $wp_customize->add_setting( $setting_id, $args );
    3838    }
  • trunk/src/bp-core/bp-core-filters.php

    r13818 r13878  
    291291    global $wpdb;
    292292
    293     foreach( (array) $comments as $comment ) {
     293    foreach ( (array) $comments as $comment ) {
    294294        if ( $comment->user_id ) {
    295295            $user_ids[] = $comment->user_id;
     
    307307    }
    308308
    309     foreach( (array) $userdata as $user ) {
     309    foreach ( (array) $userdata as $user ) {
    310310        $users[$user->user_id] = bp_members_get_user_url( $user->user_id );
    311311    }
    312312
    313     foreach( (array) $comments as $i => $comment ) {
     313    foreach ( (array) $comments as $i => $comment ) {
    314314        if ( ! empty( $comment->user_id ) ) {
    315315            if ( ! empty( $users[$comment->user_id] ) ) {
  • trunk/src/bp-core/bp-core-functions.php

    r13818 r13878  
    208208 */
    209209function bp_sort_by_key( $items, $key, $type = 'alpha', $preserve_keys = false ) {
    210     $callback = function( $a, $b ) use ( $key, $type ) {
     210    $callback = function ( $a, $b ) use ( $key, $type ) {
    211211        $values = array( 0 => false, 1 => false );
    212212        foreach ( func_get_args() as $indexi => $index ) {
     
    28012801        $user_is_displayed = bp_is_user();
    28022802
    2803         foreach( $primary_items as $primary_item ) {
     2803        foreach ( $primary_items as $primary_item ) {
    28042804            $current_user_link = $primary_item['link'];
    28052805
  • trunk/src/bp-core/bp-core-moderation.php

    r13649 r13878  
    306306
    307307        // Loop through post data.
    308         foreach( $_post as $post_data ) {
     308        foreach ( $_post as $post_data ) {
    309309
    310310            // Check each user data for current word.
  • trunk/src/bp-core/bp-core-template-loader.php

    r13867 r13878  
    363363    // Loop through 'bp_template_stack' filters, and call callback functions.
    364364    do {
    365         foreach( (array) current( $filter ) as $the_ ) {
     365        foreach ( (array) current( $filter ) as $the_ ) {
    366366            if ( ! is_null( $the_['function'] ) ) {
    367367                $args[1] = $stack;
  • trunk/src/bp-core/bp-core-template.php

    r13844 r13878  
    473473     */
    474474    $options = apply_filters( 'bp_search_form_type_select_options', $options );
    475     foreach( (array) $options as $option_value => $option_title ) {
     475    foreach ( (array) $options as $option_value => $option_title ) {
    476476        $selection_box .= sprintf( '<option value="%s">%s</option>', esc_attr( $option_value ), esc_html( $option_title ) );
    477477    }
     
    679679        $attributes = (array) apply_filters( 'bp_get_form_field_attributes', $attributes, $name );
    680680
    681         foreach( $attributes as $attr => $value ) {
     681        foreach ( $attributes as $attr => $value ) {
    682682            // Numeric keyed array.
    683683            if (is_numeric( $attr ) ) {
     
    32203220            // Add current user member types.
    32213221            if ( $member_types = bp_get_member_type( bp_displayed_user_id(), false ) ) {
    3222                 foreach( $member_types as $member_type ) {
     3222                foreach ( $member_types as $member_type ) {
    32233223                    $bp_classes[] = sprintf( 'member-type-%s', esc_attr( $member_type ) );
    32243224                }
     
    35093509            $submenus = array();
    35103510
    3511             foreach( $nav_menu->children as $sub_menu ) {
     3511            foreach ( $nav_menu->children as $sub_menu ) {
    35123512                $submenu = new stdClass;
    35133513                $submenu->class  = array( 'menu-child' );
  • trunk/src/bp-core/classes/class-bp-admin.php

    r13870 r13878  
    408408        }
    409409
    410         foreach( $hooks as $hook ) {
     410        foreach ( $hooks as $hook ) {
    411411            add_action( "admin_head-$hook", 'bp_core_modify_admin_menu_highlight' );
    412412
     
    425425        do_action_ref_array( 'bp_admin_submenu_pages', array( &$this->submenu_pages ) );
    426426
    427         foreach( $this->submenu_pages as $subpage_type => $subpage_hooks ) {
     427        foreach ( $this->submenu_pages as $subpage_type => $subpage_hooks ) {
    428428            foreach ( $subpage_hooks as $subpage_hook ) {
    429429                add_action( "admin_print_styles-{$subpage_hook}", array( $this, 'add_inline_styles' ), 20 );
     
    468468        );
    469469
    470         foreach( $hooks as $hook ) {
     470        foreach ( $hooks as $hook ) {
    471471            add_action( "admin_head-$hook", 'bp_core_modify_admin_menu_highlight' );
    472472        }
     
    16361636                'plugin-install',
    16371637                '
    1638                 ( function() {
    1639                     document.onreadystatechange = function()  {
     1638                ( function () {
     1639                    document.onreadystatechange = function ()  {
    16401640                        if ( document.readyState === "complete" ) {
    16411641                            document.querySelector( \'.plugin-card-bp-classic .open-plugin-details-modal\' ).click();
  • trunk/src/bp-core/classes/class-bp-component.php

    r13741 r13878  
    652652            // Sub nav items are not required.
    653653            if ( ! empty( $sub_nav ) ) {
    654                 foreach( (array) $sub_nav as $nav ) {
     654                foreach ( (array) $sub_nav as $nav ) {
    655655                    if ( ! isset( $nav['slug'], $nav['parent_slug'] ) ) {
    656656                        continue;
     
    732732                // Sub nav items are not required.
    733733                if ( $this->sub_nav ) {
    734                     foreach( (array) $this->sub_nav as $nav ) {
     734                    foreach ( (array) $this->sub_nav as $nav ) {
    735735                        if ( isset( $nav['user_has_access_callback'] ) && is_callable( $nav['user_has_access_callback'] ) ) {
    736736                            $nav['user_has_access'] = call_user_func( $nav['user_has_access_callback'] );
     
    773773                $this->sub_nav = $sub_nav;
    774774
    775                 foreach( (array) $sub_nav as $nav ) {
     775                foreach ( (array) $sub_nav as $nav ) {
    776776                    bp_core_new_subnav_item( $nav, 'members' );
    777777                }
     
    828828            $pos = 0;
    829829            $not_set_pos = 1;
    830             foreach( $wp_admin_nav as $key => $nav ) {
     830            foreach ( $wp_admin_nav as $key => $nav ) {
    831831                if ( ! isset( $nav['position'] ) ) {
    832832                    $wp_admin_nav[$key]['position'] = $pos + $not_set_pos;
     
    852852
    853853            // Add each admin menu.
    854             foreach( $this->admin_menu as $admin_menu ) {
     854            foreach ( $this->admin_menu as $admin_menu ) {
    855855                $wp_admin_bar->add_node( $admin_menu );
    856856            }
     
    972972         */
    973973        if ( !empty( $tables ) && is_array( $tables ) ) {
    974             foreach( $tables as $meta_prefix => $table_name ) {
     974            foreach ( $tables as $meta_prefix => $table_name ) {
    975975                $wpdb->{$meta_prefix . 'meta'} = $table_name;
    976976            }
     
    14031403            $controllers = (array) apply_filters( 'bp_' . $this->id . '_rest_api_controllers', $controllers );
    14041404
    1405             foreach( $controllers as $controller ) {
     1405            foreach ( $controllers as $controller ) {
    14061406                if ( ! in_array( $controller, $_controllers, true ) ) {
    14071407                    continue;
  • trunk/src/bp-core/classes/class-bp-core-html-element.php

    r11112 r13878  
    7070        // Render attributes.
    7171        $attributes = '';
    72         foreach( (array) $r['attr'] as $attr => $val ) {
     72        foreach ( (array) $r['attr'] as $attr => $val ) {
    7373            // If attribute is empty, skip.
    7474            if ( empty( $val ) ) {
  • trunk/src/bp-core/classes/class-bp-core-nav.php

    r13468 r13878  
    476476
    477477        if ( $primary_nav_items ) {
    478             foreach( $primary_nav_items as $key_nav => $primary_nav ) {
     478            foreach ( $primary_nav_items as $key_nav => $primary_nav ) {
    479479                // Try to get the children.
    480480                $children = $this->get_secondary( array( 'parent_slug' => $primary_nav->slug, 'user_has_access' => true ) );
  • trunk/src/bp-core/classes/class-bp-core-oembed-extension.php

    r13818 r13878  
    440440                buddypress()->{$this->slug_endpoint}->embedargs_in_progress = array();
    441441
    442                 foreach( $custom_args as $arg ) {
     442                foreach ( $custom_args as $arg ) {
    443443                    if ( isset( $request[ $arg ] ) ) {
    444444                        buddypress()->{$this->slug_endpoint}->embedargs_in_progress[ $arg ] = $request[ $arg ];
     
    540540            // Add custom route args to iframe.
    541541            if ( isset( buddypress()->{$this->slug_endpoint}->embedargs_in_progress ) && buddypress()->{$this->slug_endpoint}->embedargs_in_progress ) {
    542                 foreach( buddypress()->{$this->slug_endpoint}->embedargs_in_progress as $key => $value ) {
     542                foreach ( buddypress()->{$this->slug_endpoint}->embedargs_in_progress as $key => $value ) {
    543543                    $url = add_query_arg( $key, $value, $url );
    544544                }
  • trunk/src/bp-core/classes/class-bp-core.php

    r13532 r13878  
    149149
    150150        // Loop through optional components.
    151         foreach( $bp->optional_components as $component ) {
     151        foreach ( $bp->optional_components as $component ) {
    152152            if ( bp_is_active( $component ) && file_exists( $bp->plugin_dir . '/bp-' . $component . '/bp-' . $component . '-loader.php' ) ) {
    153153                include( $bp->plugin_dir . '/bp-' . $component . '/bp-' . $component . '-loader.php' );
     
    156156
    157157        // Loop through required components.
    158         foreach( $bp->required_components as $component ) {
     158        foreach ( $bp->required_components as $component ) {
    159159            if ( file_exists( $bp->plugin_dir . '/bp-' . $component . '/bp-' . $component . '-loader.php' ) ) {
    160160                include( $bp->plugin_dir . '/bp-' . $component . '/bp-' . $component . '-loader.php' );
  • trunk/src/bp-core/deprecated/1.5.php

    r13824 r13878  
    346346    $group = new BP_Groups_Group( $group_id );
    347347
    348     foreach( (array) $usernames as $username ) {
     348    foreach ( (array) $usernames as $username ) {
    349349        if ( !$receiver_user_id = bp_core_get_userid( $username ) )
    350350            continue;
  • trunk/src/bp-core/deprecated/1.6.php

    r13824 r13878  
    265265
    266266        // For each of the problematic hooks, exit at the very end of execution.
    267         foreach( $actions as $action ) {
    268             add_action( 'wp_ajax_' . $action, function() {
     267        foreach ( $actions as $action ) {
     268            add_action( 'wp_ajax_' . $action, function () {
    269269                exit;
    270270            }, 9999 );
    271271
    272             add_action( 'wp_ajax_nopriv_' . $action, function() {
     272            add_action( 'wp_ajax_nopriv_' . $action, function () {
    273273                exit;
    274274            }, 9999 );
  • trunk/src/bp-friends/classes/class-bp-friends-friendship.php

    r13427 r13878  
    736736
    737737        // Sort and structure as expected in legacy function.
    738         usort( $last_activities, function( $a, $b ) {
     738        usort( $last_activities, function ( $a, $b ) {
    739739            if ( $a['date_recorded'] === $b['date_recorded'] ) {
    740740                return 0;
  • trunk/src/bp-groups/actions/create.php

    r13762 r13878  
    345345    unset( $bp->groups->group_creation_steps );
    346346
    347     foreach( (array) $temp as $position => $step ) {
     347    foreach ( (array) $temp as $position => $step ) {
    348348        $bp->groups->group_creation_steps[ $step['slug'] ] = array(
    349349            'rewrite_id'   => $step['rewrite_id'],
  • trunk/src/bp-groups/bp-groups-admin.php

    r13871 r13878  
    361361            }
    362362
    363             foreach( array_values( $user_names ) as $user_name ) {
     363            foreach ( array_values( $user_names ) as $user_name ) {
    364364                $un = trim( $user_name );
    365365
  • trunk/src/bp-groups/classes/class-bp-group-extension.php

    r13808 r13878  
    12921292                $this->edit_screen_template = '/groups/single/home';
    12931293            } else {
    1294                 add_action( 'bp_template_content_header', function() {
     1294                add_action( 'bp_template_content_header', function () {
    12951295                    echo '<ul class="content-header-nav">';
    12961296                    bp_group_admin_tabs();
     
    15211521
    15221522        $extension_slug = $this->slug;
    1523         $callback       = function() use ( $extension_slug, $group_id ) {
     1523        $callback       = function () use ( $extension_slug, $group_id ) {
    15241524            do_action( 'bp_groups_admin_meta_box_content_' . $extension_slug, $group_id );
    15251525        };
  • trunk/src/bp-groups/classes/class-bp-groups-list-table.php

    r13808 r13878  
    884884                <option value=""><?php esc_html_e( 'Change group type to&hellip;', 'buddypress' ) ?></option>
    885885
    886                 <?php foreach( $types as $type ) : ?>
     886                <?php foreach ( $types as $type ) : ?>
    887887
    888888                    <option value="<?php echo esc_attr( $type->name ); ?>"><?php echo esc_html( $type->labels['singular_name'] ); ?></option>
  • trunk/src/bp-groups/screens/single/send-invites.php

    r13762 r13878  
    3030
    3131        if ( ! empty( $_POST['friends'] ) ) {
    32             foreach( (array) $_POST['friends'] as $friend ) {
     32            foreach ( (array) $_POST['friends'] as $friend ) {
    3333                groups_invite_user( array( 'user_id' => $friend, 'group_id' => $bp->groups->current_group->id ) );
    3434            }
  • trunk/src/bp-members/bp-members-filters.php

    r13503 r13878  
    4646
    4747    // Add the filters to each field.
    48     foreach( $fields as $filter ) {
     48    foreach ( $fields as $filter ) {
    4949        add_filter( $filter, 'esc_html',       1 );
    5050        add_filter( $filter, 'wp_filter_kses', 2 );
  • trunk/src/bp-members/bp-members-functions.php

    r13871 r13878  
    21022102            $profile_field_ids = explode( ',', $user['meta']['profile_field_ids'] );
    21032103
    2104             foreach( (array) $profile_field_ids as $field_id ) {
     2104            foreach ( (array) $profile_field_ids as $field_id ) {
    21052105                $current_field = isset( $user['meta']["field_{$field_id}"] ) ? $user['meta']["field_{$field_id}"] : false;
    21062106
  • trunk/src/bp-members/classes/class-bp-members-admin.php

    r13871 r13878  
    24802480            ) );
    24812481
    2482             foreach( $field_groups as $fg ) {
    2483                 foreach( $fg->fields as $f ) {
     2482            foreach ( $field_groups as $fg ) {
     2483                foreach ( $fg->fields as $f ) {
    24842484                    $fdata[ $f->id ] = $f->name;
    24852485                }
     
    26382638            <option value=""><?php esc_html_e( 'Change member type to&hellip;', 'buddypress' ) ?></option>
    26392639
    2640             <?php foreach( $types as $type ) : ?>
     2640            <?php foreach ( $types as $type ) : ?>
    26412641
    26422642                <option value="<?php echo esc_attr( $type->name ); ?>"><?php echo esc_html( $type->labels['singular_name'] ); ?></option>
  • trunk/src/bp-members/screens/register.php

    r13799 r13878  
    197197                 * @param string $fieldname The name of the signup field.
    198198                 */
    199                 add_action( 'bp_' . $fieldname . '_errors', function() use ( $error_message, $fieldname ) {
     199                add_action( 'bp_' . $fieldname . '_errors', function () use ( $error_message, $fieldname ) {
    200200                    echo wp_kses(
    201201                        /**
  • trunk/src/bp-messages/bp-messages-cssjs.php

    r13464 r13878  
    6565            var acfb = jQuery("ul.first").autoCompletefb({urlLookup: ajaxurl});
    6666
    67             jQuery('#send_message_form').submit( function() {
     67            jQuery('#send_message_form').submit( function () {
    6868                var users = document.getElementById('send-to-usernames').className;
    6969                document.getElementById('send-to-usernames').value = String(users);
  • trunk/src/bp-messages/bp-messages-template.php

    r13844 r13878  
    19831983        $recipient_links = array();
    19841984
    1985         foreach( (array) $thread_template->thread->recipients as $recipient ) {
     1985        foreach ( (array) $thread_template->thread->recipients as $recipient ) {
    19861986            if ( (int) $recipient->user_id !== bp_loggedin_user_id() ) {
    19871987                $recipient_link = bp_core_get_userlink( $recipient->user_id );
  • trunk/src/bp-messages/classes/class-bp-messages-thread.php

    r13810 r13878  
    806806
    807807        // Sort threads by date_sent.
    808         foreach( (array) $thread_ids as $thread ) {
     808        foreach ( (array) $thread_ids as $thread ) {
    809809            $sorted_threads[ $thread->thread_id ] = strtotime( $thread->date_sent );
    810810        }
     
    12361236        $bp = buddypress();
    12371237
    1238         foreach( (array) $threads as $thread ) {
     1238        foreach ( (array) $threads as $thread ) {
    12391239            $message_ids = maybe_unserialize( $thread->message_ids );
    12401240
  • trunk/src/bp-templates/bp-legacy/buddypress-functions.php

    r13876 r13878  
    186186         * executes for users that aren't logged in. This is for backpat with BP <1.6.
    187187         */
    188         foreach( $actions as $name => $function ) {
     188        foreach ( $actions as $name => $function ) {
    189189            bp_ajax_register_action( $name );
    190190            add_action( 'wp_ajax_'        . $name, $function );
     
    17681768
    17691769        // Add new-message css class.
    1770         add_filter( 'bp_get_the_thread_message_css_class', function( $retval ) {
     1770        add_filter( 'bp_get_the_thread_message_css_class', function ( $retval ) {
    17711771            $retval[] = 'new-message';
    17721772            return $retval;
  • trunk/src/bp-templates/bp-nouveau/buddypress-functions.php

    r13718 r13878  
    103103        // Load AJAX code only on AJAX requests.
    104104        } else {
    105             add_action( 'admin_init', function() {
     105            add_action( 'admin_init', function () {
    106106                if ( defined( 'DOING_AJAX' ) && true === DOING_AJAX ) {
    107107                    require bp_nouveau()->includes_dir . 'ajax.php';
  • trunk/src/bp-templates/bp-nouveau/includes/activity/ajax.php

    r13636 r13878  
    1010defined( 'ABSPATH' ) || exit;
    1111
    12 add_action( 'admin_init', function() {
     12add_action( 'admin_init', function () {
    1313    $ajax_actions = array(
    1414        array(
  • trunk/src/bp-templates/bp-nouveau/includes/activity/loader.php

    r13481 r13878  
    6969        // Load AJAX code only on AJAX requests.
    7070        } else {
    71             add_action( 'admin_init', function() {
     71            add_action( 'admin_init', function () {
    7272                // AJAX condtion.
    7373                if ( defined( 'DOING_AJAX' ) && true === DOING_AJAX &&
  • trunk/src/bp-templates/bp-nouveau/includes/blogs/ajax.php

    r12082 r13878  
    1010defined( 'ABSPATH' ) || exit;
    1111
    12 add_action( 'admin_init', function() {
     12add_action( 'admin_init', function () {
    1313    $ajax_actions = array(
    1414        array(
  • trunk/src/bp-templates/bp-nouveau/includes/blogs/functions.php

    r13503 r13878  
    185185function bp_nouveau_get_blog_signup_inline_script() {
    186186    return '
    187         ( function( $ ) {
     187        ( function ( $ ) {
    188188            if ( $( \'body\' ).hasClass( \'register\' ) ) {
    189189                var blog_checked = $( \'#signup_with_blog\' );
     
    195195
    196196                // toggle "Blog Details" block whenever checkbox is checked
    197                 blog_checked.change( function( event ) {
     197                blog_checked.change( function ( event ) {
    198198                    // Toggle HTML5 required attribute.
    199                     $.each( $( \'#blog-details\' ).find( \'[aria-required]\' ), function( i, input ) {
     199                    $.each( $( \'#blog-details\' ).find( \'[aria-required]\' ), function ( i, input ) {
    200200                        $( input ).prop( \'required\',  $( event.target ).prop( \'checked\' ) );
    201201                    } );
  • trunk/src/bp-templates/bp-nouveau/includes/blogs/loader.php

    r13461 r13878  
    5353        // Load AJAX code only on AJAX requests.
    5454        } else {
    55             add_action( 'admin_init', function() {
     55            add_action( 'admin_init', function () {
    5656                if ( defined( 'DOING_AJAX' ) && true === DOING_AJAX && 0 === strpos( $_REQUEST['action'], 'blogs_' ) ) {
    5757                    require bp_nouveau()->blogs->dir . 'ajax.php';
     
    7474        }
    7575
    76         add_action( 'bp_nouveau_enqueue_scripts', function() {
     76        add_action( 'bp_nouveau_enqueue_scripts', function () {
    7777            if ( bp_get_blog_signup_allowed() && bp_is_register_page() ) {
    7878                wp_add_inline_script( 'bp-nouveau', bp_nouveau_get_blog_signup_inline_script() );
  • trunk/src/bp-templates/bp-nouveau/includes/friends/ajax.php

    r12094 r13878  
    1010defined( 'ABSPATH' ) || exit;
    1111
    12 add_action( 'admin_init', function() {
     12add_action( 'admin_init', function () {
    1313    $ajax_actions = array(
    1414        array(
  • trunk/src/bp-templates/bp-nouveau/includes/friends/loader.php

    r13461 r13878  
    5050        // Load AJAX code only on AJAX requests.
    5151        } else {
    52             add_action( 'admin_init', function() {
     52            add_action( 'admin_init', function () {
    5353                if ( defined( 'DOING_AJAX' ) && true === DOING_AJAX && 0 === strpos( $_REQUEST['action'], 'friends_' ) ) {
    5454                    require bp_nouveau()->friends->dir . 'ajax.php';
  • trunk/src/bp-templates/bp-nouveau/includes/groups/ajax.php

    r13862 r13878  
    1010defined( 'ABSPATH' ) || exit;
    1111
    12 add_action( 'admin_init', function() {
     12add_action( 'admin_init', function () {
    1313    $ajax_actions = array(
    1414        array( 'groups_filter'                      => array( 'function' => 'bp_nouveau_ajax_object_template_loader', 'nopriv' => true  ) ),
  • trunk/src/bp-templates/bp-nouveau/includes/groups/loader.php

    r13652 r13878  
    5555        // Load AJAX code only on AJAX requests.
    5656        } else {
    57             add_action( 'admin_init', function() {
     57            add_action( 'admin_init', function () {
    5858                if ( defined( 'DOING_AJAX' ) && true === DOING_AJAX && 0 === strpos( $_REQUEST['action'], 'groups_' ) ) {
    5959                    require bp_nouveau()->groups->dir . 'ajax.php';
  • trunk/src/bp-templates/bp-nouveau/includes/messages/ajax.php

    r13510 r13878  
    1010defined( 'ABSPATH' ) || exit;
    1111
    12 add_action( 'admin_init', function() {
     12add_action( 'admin_init', function () {
    1313    $ajax_actions = array(
    1414        array(
     
    138138     * @param array $value Array of un-trimmed usernames submitted.
    139139     */
    140     $recipients = apply_filters( 'bp_messages_recipients', array_map( function( $username ) {
     140    $recipients = apply_filters( 'bp_messages_recipients', array_map( function ( $username ) {
    141141        return trim( $username, '@' );
    142142    }, $_POST['send_to'] ) );
  • trunk/src/bp-templates/bp-nouveau/includes/messages/loader.php

    r13481 r13878  
    5353        // Load AJAX code only on AJAX requests.
    5454        } else {
    55             add_action( 'admin_init', function() {
     55            add_action( 'admin_init', function () {
    5656                if ( defined( 'DOING_AJAX' ) && true === DOING_AJAX && 0 === strpos( $_REQUEST['action'], 'messages_' ) ) {
    5757                    require bp_nouveau()->messages->dir . 'ajax.php';
  • trunk/src/bp-xprofile/bp-xprofile-admin.php

    r13806 r13878  
    12341234
    12351235        // Sort these fields types alphabetically.
    1236         uasort( $fields, function( $a, $b ) { return strnatcmp( $a[1]->name, $b[1]->name ); } );
     1236        uasort( $fields, function ( $a, $b ) { return strnatcmp( $a[1]->name, $b[1]->name ); } );
    12371237
    12381238        foreach ( $fields as $field_type_obj ) {
  • trunk/src/bp-xprofile/bp-xprofile-filters.php

    r13806 r13878  
    426426        $values      = explode( ';', $field_value );
    427427
    428         array_walk( $values, function( &$value, $key ) use ( $field_type, $field ) {
     428        array_walk( $values, function ( &$value, $key ) use ( $field_type, $field ) {
    429429            $value = bp_xprofile_escape_field_data( $value, $field_type, $field->id );
    430430        } );
     
    480480
    481481    // Locate comment authors with WP accounts.
    482     foreach( (array) $comments as $comment ) {
     482    foreach ( (array) $comments as $comment ) {
    483483        if ( $comment->user_id ) {
    484484            $user_ids[] = $comment->user_id;
     
    493493    // Pull up the xprofile fullname of each commenter.
    494494    if ( $fullnames = bp_core_get_user_displaynames( $user_ids ) ) {
    495         foreach( (array) $fullnames as $user_id => $user_fullname ) {
     495        foreach ( (array) $fullnames as $user_id => $user_fullname ) {
    496496            $users[ $user_id ] = trim( stripslashes( $user_fullname ) );
    497497        }
     
    499499
    500500    // Loop through and match xprofile fullname with commenters.
    501     foreach( (array) $comments as $i => $comment ) {
     501    foreach ( (array) $comments as $i => $comment ) {
    502502        if ( ! empty( $comment->user_id ) ) {
    503503            if ( ! empty( $users[ $comment->user_id ] ) ) {
  • trunk/src/bp-xprofile/bp-xprofile-functions.php

    r13756 r13878  
    394394    if ( is_array( $values ) ) {
    395395        $data = array();
    396         foreach( (array) $values as $value ) {
     396        foreach ( (array) $values as $value ) {
    397397
    398398            /**
     
    763763 *
    764764 * @since 2.0.0
    765  * 
     765 *
    766766 * @global wpdb $wpdb WordPress database object.
    767767 *
     
    963963 *
    964964 * @since 1.5.0
    965  * 
     965 *
    966966 * @global wpdb $wpdb WordPress database object.
    967967 *
     
    11461146 *
    11471147 * @since 2.0.0
    1148  * 
     1148 *
    11491149 * @global wpdb $wpdb WordPress database object.
    11501150 *
     
    13591359    $default_visibility_levels = BP_XProfile_Group::fetch_default_visibility_levels();
    13601360
    1361     foreach( (array) $default_visibility_levels as $d_field_id => $defaults ) {
     1361    foreach ( (array) $default_visibility_levels as $d_field_id => $defaults ) {
    13621362        // If the admin has forbidden custom visibility levels for this field, replace
    13631363        // the user-provided setting with the default specified by the admin.
     
    13681368
    13691369    $field_ids = array();
    1370     foreach( $user_visibility_levels as $field_id => $field_visibility ) {
     1370    foreach ( $user_visibility_levels as $field_id => $field_visibility ) {
    13711371        if ( in_array( $field_visibility, $levels ) ) {
    13721372            $field_ids[] = $field_id;
     
    14771477 *
    14781478 * @since 8.0.0
    1479  * 
     1479 *
    14801480 * @global wpdb $wpdb WordPress database object.
    14811481 *
  • trunk/src/bp-xprofile/bp-xprofile-template.php

    r13844 r13878  
    13761376            <?php if ( bp_current_user_can( 'bp_xprofile_change_field_visibility' ) ) : ?>
    13771377
    1378                 <?php foreach( bp_xprofile_get_visibility_levels() as $level ) : ?>
     1378                <?php foreach ( bp_xprofile_get_visibility_levels() as $level ) : ?>
    13791379
    13801380                    <?php
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-field-type-multiselectbox.php

    r13806 r13878  
    148148            // Check for updated posted values, but errors preventing them from
    149149            // being saved first time.
    150             foreach( $option_values as $i => $option_value ) {
     150            foreach ( $option_values as $i => $option_value ) {
    151151                if ( isset( $_POST[ 'field_' . $this->field_obj->id ] ) && $_POST[ 'field_' . $this->field_obj->id ][ $i ] != $option_value ) {
    152152                    if ( ! empty( $_POST[ 'field_' . $this->field_obj->id ][ $i ] ) ) {
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-field-type-selectbox.php

    r13806 r13878  
    117117            // Check for updated posted values, but errors preventing them from
    118118            // being saved first time.
    119             foreach( $option_values as $i => $option_value ) {
     119            foreach ( $option_values as $i => $option_value ) {
    120120                if ( isset( $_POST[ 'field_' . $this->field_obj->id ] ) && $_POST[ 'field_' . $this->field_obj->id ] != $option_value ) {
    121121                    if ( ! empty( $_POST[ 'field_' . $this->field_obj->id ] ) ) {
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-field.php

    r13806 r13878  
    16521652                    <select name="default-visibility" id="default-visibility">
    16531653
    1654                         <?php foreach( bp_xprofile_get_visibility_levels() as $level ) : ?>
     1654                        <?php foreach ( bp_xprofile_get_visibility_levels() as $level ) : ?>
    16551655
    16561656                            <option value="<?php echo esc_attr( $level['id'] ); ?>" <?php selected( $this->get_default_visibility(), $level['id'] ); ?>>
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-group.php

    r13797 r13878  
    325325        $field_ids = self::get_group_field_ids( $group_ids, $r );
    326326
    327         foreach( $groups as $group ) {
     327        foreach ( $groups as $group ) {
    328328            $group->fields = array();
    329329        }
     
    381381
    382382                // Loop through the results and find the fields that have data.
    383                 foreach( (array) $field_data as $data ) {
     383                foreach ( (array) $field_data as $data ) {
    384384
    385385                    // Empty fields may contain a serialized empty array.
     
    395395
    396396                // The remaining members of $field_ids are empty. Remove them.
    397                 foreach( $fields as $field_key => $field ) {
     397                foreach ( $fields as $field_key => $field ) {
    398398                    if ( in_array( $field->id, $field_ids ) ) {
    399399                        unset( $fields[ $field_key ] );
     
    409409
    410410                // Loop through fields.
    411                 foreach( (array) $fields as $field_key => $field ) {
     411                foreach ( (array) $fields as $field_key => $field ) {
    412412
    413413                    // Loop through the data in each field.
    414                     foreach( (array) $field_data as $data ) {
     414                    foreach ( (array) $field_data as $data ) {
    415415
    416416                        // Assign correct data value to the field.
     
    439439
    440440        // Merge the field array back in with the group array.
    441         foreach( (array) $groups as $group ) {
     441        foreach ( (array) $groups as $group ) {
    442442            // Indexes may have been shifted after previous deletions, so we get a
    443443            // fresh one each time through the loop.
    444444            $index = array_search( $group, $groups );
    445445
    446             foreach( (array) $fields as $field ) {
     446            foreach ( (array) $fields as $field ) {
    447447                if ( $group->id === $field->group_id ) {
    448448                    $groups[ $index ]->fields[] = $field;
     
    757757        $visibility_levels = bp_get_user_meta( $user_id, 'bp_xprofile_visibility_levels', true );
    758758
    759         foreach( (array) $fields as $key => $field ) {
     759        foreach ( (array) $fields as $key => $field ) {
    760760
    761761            // Does the admin allow this field to be customized?
  • trunk/tests/phpunit/includes/loader.php

    r12712 r13878  
    2626$components = array( 'activity', 'blogs', 'friends', 'groups', 'members', 'messages', 'notifications', 'settings', 'xprofile' );
    2727foreach ( $components as $component ) {
    28     add_action( "bp_{$component}_includes", function() use ( $component ) {
     28    add_action( "bp_{$component}_includes", function () use ( $component ) {
    2929        $dirs = array(
    3030            buddypress()->plugin_dir . 'bp-' . $component . '/actions/',
  • trunk/tests/phpunit/testcases/core/class-bp-user-query.php

    r13314 r13878  
    176176        ) );
    177177
    178         add_filter( 'bp_user_query_online_interval', function() { return 5; } );
     178        add_filter( 'bp_user_query_online_interval', function () { return 5; } );
    179179
    180180        $q = new BP_User_Query( array(
Note: See TracChangeset for help on using the changeset viewer.