Skip to:
Content

bbPress.org

Changeset 7111


Ignore:
Timestamp:
08/03/2020 01:33:59 PM (3 months ago)
Author:
xknown
Message:

PHP 7.4 Compat: Remove the create_function calls.

They are deprecated, and they seem to be removed in PHP 8.0.

Location:
branches/1.1
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/1.1/bb-admin/includes/functions.bb-admin.php

    r6170 r7111  
    3838
    3939    $message = '<div id="message" class="' . esc_attr( $class ) . '">' . $message . '</div>';
    40     $message = str_replace( "'", "\'", $message );
    41     $lambda = create_function( '', "echo '$message';" );
     40    $lambda = function() use( $message ) { echo $message; };
    4241    add_action( 'bb_admin_notices', $lambda );
    4342    return $lambda;
     
    153152
    154153                // Get an array of all plugin added keys
    155                 $plugin_menu_keys = array_filter( $menu_keys, create_function( '$v', 'if ($v >= ' . $lower . ' && $v < ' . $upper . ') { return $v; }' ) );
     154                $plugin_menu_keys = array_filter( $menu_keys, function( $v ) use ( $lower, $upper ) { if ( $v >= $lower && $v < $upper ) { return $v; } } );
    156155
    157156                // If there is an array of keys
  • branches/1.1/bb-admin/options-discussion.php

    r2865 r7111  
    7373);
    7474
    75 $bb_get_option_avatars_show = create_function( '$a', 'return 1;' );
     75$bb_get_option_avatars_show = function( $a ) { return 1; };
    7676add_filter( 'bb_get_option_avatars_show', $bb_get_option_avatars_show );
    7777$avatar_options = array(
  • branches/1.1/bb-admin/options-wordpress.php

    r2455 r7111  
    5353
    5454$bb_role_names[''] = _c( 'none|no bbPress role' );
    55 $bb_role_names = array_merge( $bb_role_names, array_map( create_function( '$a', 'return sprintf( _c( "bbPress %s|bbPress role" ), $a );' ), $wp_roles->get_names() ) );
     55$bb_role_names = array_merge( $bb_role_names, array_map( function( $a ) { return sprintf( _c( "bbPress %s|bbPress role" ), $a ); }, $wp_roles->get_names() ) );
    5656
    5757$wpRoles = array(
  • branches/1.1/search.php

    r2449 r7111  
    1111   
    1212    /* Recent */
    13     add_filter( 'bb_recent_search_fields',   create_function( '$f', 'return $f . ", MAX(post_time) AS post_time";' ) );
    14     add_filter( 'bb_recent_search_group_by', create_function( '', 'return "t.topic_id";' ) );
     13    add_filter( 'bb_recent_search_fields',   function( $f ) { return $f . ", MAX(post_time) AS post_time"; } );
     14    add_filter( 'bb_recent_search_group_by', function() { return "t.topic_id"; } );
    1515    $bb_query_form->BB_Query_Form( 'post', array(), array( 'order_by' => 'p.post_time', 'count' => true, 'per_page' => $per_page, 'post_status' => 0, 'topic_status' => 0, 'post_text' => $q, 'forum_id', 'tag', 'topic_author', 'post_author' ), 'bb_recent_search' );
    1616    $recent = $bb_query_form->results;
Note: See TracChangeset for help on using the changeset viewer.