Skip to:
Content

BuddyPress.org

Changeset 11774


Ignore:
Timestamp:
12/13/2017 01:16:42 AM (9 years ago)
Author:
boonebgorges
Message:

Remove calls to create_function().

create_function() is deprecated in PHP 7.2.

Merges [11773] to the 2.9 branch.

See #7634.

Location:
branches/2.9
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/2.9

  • branches/2.9/src/bp-core/deprecated/1.6.php

    r10544 r11774  
    266266                // For each of the problematic hooks, exit at the very end of execution
    267267                foreach( $actions as $action ) {
    268                         add_action( 'wp_ajax_'        . $action, create_function( '', 'exit;' ), 9999 );
    269                         add_action( 'wp_ajax_nopriv_' . $action, create_function( '', 'exit;' ), 9999 );
     268                        add_action( 'wp_ajax_' . $action, function() {
     269                                exit;
     270                        }, 9999 );
     271
     272                        add_action( 'wp_ajax_nopriv_' . $action, function() {
     273                                exit;
     274                        }, 9999 );
    270275                }
    271276        }
  • branches/2.9/src/bp-groups/classes/class-bp-group-extension.php

    r11554 r11774  
    754754                        if ( bp_is_current_action( $this->slug ) ) {
    755755                                add_filter( 'bp_group_user_has_access',   array( $this, 'group_access_protection' ), 10, 2 );
    756                                 add_action( 'bp_template_content_header', create_function( '', 'echo "' . esc_attr( $this->name ) . '";' ) );
    757                                 add_action( 'bp_template_title',          create_function( '', 'echo "' . esc_attr( $this->name ) . '";' ) );
     756
     757                                $extension_name = $this->name;
     758                                add_action( 'bp_template_content_header', function() use ( $extension_name ) {
     759                                        echo esc_attr( $extension_name );
     760                                } );
     761                                add_action( 'bp_template_title', function() use ( $extension_name ) {
     762                                        echo esc_attr( $extension_name );
     763                                } );
    758764                        }
    759765                }
     
    11971203                $screen   = $this->screens['admin'];
    11981204
     1205                $extension_slug = $this->slug;
     1206                $callback = function() use ( $extension_slug, $group_id ) {
     1207                        do_action( 'bp_groups_admin_meta_box_content_' . $extension_slug, $group_id );
     1208                };
     1209
    11991210                add_meta_box(
    12001211                        $screen['slug'],
    12011212                        $screen['name'],
    1202                         create_function( '', 'do_action( "bp_groups_admin_meta_box_content_' . $this->slug . '", ' . $group_id . ' );' ),
     1213                        $callback,
    12031214                        get_current_screen()->id,
    12041215                        $screen['metabox_context'],
  • branches/2.9/src/bp-members/bp-members-screens.php

    r11360 r11774  
    184184                if ( !empty( $bp->signup->errors ) ) {
    185185                        foreach ( (array) $bp->signup->errors as $fieldname => $error_message ) {
    186                                 /*
    187                                  * The addslashes() and stripslashes() used to avoid create_function()
    188                                  * syntax errors when the $error_message contains quotes.
    189                                  */
    190 
    191186                                /**
    192187                                 * Filters the error message in the loop.
     
    196191                                 * @param string $value Error message wrapped in html.
    197192                                 */
    198                                 add_action( 'bp_' . $fieldname . '_errors', create_function( '', 'echo apply_filters(\'bp_members_signup_error_message\', "<div class=\"error\">" . stripslashes( \'' . addslashes( $error_message ) . '\' ) . "</div>" );' ) );
     193                                add_action( 'bp_' . $fieldname . '_errors', function() use ( $error_message ) {
     194                                        echo apply_filters( 'bp_members_signup_error_message', "<div class=\"error\">" . $error_message . "</div>" );
     195                                } );
    199196                        }
    200197                } else {
  • branches/2.9/src/bp-templates/bp-legacy/buddypress-functions.php

    r11726 r11774  
    16121612
    16131613                // Add new-message css class.
    1614                 add_filter( 'bp_get_the_thread_message_css_class', create_function( '$retval', '
    1615                         $retval[] = "new-message";
     1614                add_filter( 'bp_get_the_thread_message_css_class', function( $retval ) {
     1615                        $retval[] = 'new-message';
    16161616                        return $retval;
    1617                 ' ) );
     1617                } );
    16181618
    16191619                // Output single message template part.
Note: See TracChangeset for help on using the changeset viewer.