Changeset 11885
- Timestamp:
- 03/05/2018 12:00:25 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 17 added
- 2 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/classes/class-bp-activity-component.php
r11360 r11885 52 52 $includes = array( 53 53 'cssjs', 54 'actions',55 'screens',56 54 'filters', 57 55 'adminbar', … … 84 82 85 83 parent::includes( $includes ); 84 } 85 86 /** 87 * Late includes method. 88 * 89 * Only load up certain code when on specific pages. 90 * 91 * @since 3.0.0 92 */ 93 public function late_includes() { 94 // Bail if PHPUnit is running. 95 if ( defined( 'BP_TESTS_DIR' ) ) { 96 return; 97 } 98 99 /* 100 * Load activity action and screen code if PHPUnit isn't running. 101 * 102 * For PHPUnit, we load these files in tests/phpunit/includes/install.php. 103 */ 104 if ( bp_is_current_component( 'activity' ) ) { 105 // Authenticated actions - Only fires when JS is disabled. 106 if ( is_user_logged_in() && 107 in_array( bp_current_action(), array( 'delete', 'spam', 'post', 'reply', 'favorite', 'unfavorite' ), true ) 108 ) { 109 require $this->path . 'bp-activity/actions/' . bp_current_action() . '.php'; 110 } 111 112 // RSS feeds. 113 if ( bp_is_current_action( 'feed' ) || bp_is_action_variable( 'feed', 0 ) ) { 114 require $this->path . 'bp-activity/actions/feeds.php'; 115 } 116 117 // Screens - Directory. 118 if ( bp_is_activity_directory() ) { 119 require $this->path . 'bp-activity/screens/directory.php'; 120 } 121 122 // Screens - User main nav. 123 if ( bp_is_user() ) { 124 require $this->path . 'bp-activity/screens/just-me.php'; 125 } 126 127 // Screens - User secondary nav. 128 if ( bp_is_user() && in_array( bp_current_action(), array( 'friends', 'groups', 'favorites', 'mentions' ), true ) ) { 129 require $this->path . 'bp-activity/screens/' . bp_current_action() . '.php'; 130 } 131 132 // Screens - Single permalink. 133 if ( bp_is_current_action( 'p' ) || is_numeric( bp_current_action() ) ) { 134 require $this->path . 'bp-activity/screens/permalink.php'; 135 } 136 137 // Theme compatibility. 138 new BP_Activity_Theme_Compat(); 139 } 140 141 // Activity notifications HTML table. 142 if ( bp_is_user_settings_notifications() ) { 143 require $this->path . 'bp-activity/screens/settings-email.php'; 144 } 86 145 } 87 146 -
trunk/tests/phpunit/includes/loader.php
r11882 r11885 17 17 } 18 18 tests_add_filter( 'bp_send_email_delivery_class', '_bp_mock_mailer' ); 19 20 /** 21 * Load up activity action and screen code. 22 * 23 * In BuddyPress, this is loaded conditionally, but PHPUnit needs all files 24 * loaded at the same time to prevent weird load order issues. 25 */ 26 add_action( 'bp_activity_includes', function() { 27 $dirs = array( 28 buddypress()->plugin_dir . 'bp-activity/actions/', 29 buddypress()->plugin_dir . 'bp-activity/screens/', 30 ); 31 32 foreach ( $dirs as $dir ) { 33 foreach ( glob( $dir . "*.php" ) as $file ) { 34 require $file; 35 } 36 } 37 } );
Note: See TracChangeset
for help on using the changeset viewer.