Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/02/2023 02:05:08 AM (3 years ago)
Author:
imath
Message:

Prevent potential issues with late_includes() in Component classes

Use require_once instead of require to load action & screen files.

See #4954
Fixes #8910
Closes https://github.com/buddypress/buddypress/pull/112

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-messages/classes/class-bp-messages-component.php

    r13481 r13495  
    9898                                in_array( bp_current_action(), array( 'compose', 'notices', 'view' ), true )
    9999                        ) {
    100                                 require $this->path . 'bp-messages/actions/' . bp_current_action() . '.php';
     100                                require_once $this->path . 'bp-messages/actions/' . bp_current_action() . '.php';
    101101                        }
    102102
     
    105105                                in_array( bp_action_variable( 0 ), array( 'delete', 'read', 'unread', 'bulk-manage', 'bulk-delete', 'exit' ), true )
    106106                        ) {
    107                                 require $this->path . 'bp-messages/actions/' . bp_action_variable( 0 ) . '.php';
     107                                require_once $this->path . 'bp-messages/actions/' . bp_action_variable( 0 ) . '.php';
    108108                        }
    109109
     
    112112                                // Single action.
    113113                                if ( in_array( bp_current_action(), array( 'star', 'unstar' ), true ) ) {
    114                                         require $this->path . 'bp-messages/actions/star.php';
     114                                        require_once $this->path . 'bp-messages/actions/star.php';
    115115                                }
    116116
    117117                                // Bulk-manage.
    118118                                if ( bp_is_action_variable( 'bulk-manage' ) ) {
    119                                         require $this->path . 'bp-messages/actions/bulk-manage-star.php';
     119                                        require_once $this->path . 'bp-messages/actions/bulk-manage-star.php';
    120120                                }
    121121                        }
     
    123123                        // Screens - User profile integration.
    124124                        if ( bp_is_user() ) {
    125                                 require $this->path . 'bp-messages/screens/inbox.php';
     125                                require_once $this->path . 'bp-messages/screens/inbox.php';
    126126
    127127                                /*
     
    131131                                 */
    132132                                if ( bp_is_user_messages() && in_array( bp_current_action(), array( 'sentbox', 'compose', 'notices', 'view' ), true ) ) {
    133                                         require $this->path . 'bp-messages/screens/' . bp_current_action() . '.php';
     133                                        require_once $this->path . 'bp-messages/screens/' . bp_current_action() . '.php';
    134134                                }
    135135
    136136                                // Nav item - Starred.
    137137                                if ( bp_is_active( $this->id, 'star' ) && bp_is_current_action( bp_get_messages_starred_slug() ) ) {
    138                                         require $this->path . 'bp-messages/screens/starred.php';
     138                                        require_once $this->path . 'bp-messages/screens/starred.php';
    139139                                }
    140140                        }
Note: See TracChangeset for help on using the changeset viewer.