Changeset 13893 for trunk/src/bp-core/classes/class-bp-core.php
- Timestamp:
- 06/02/2024 02:07:21 AM (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/classes/class-bp-core.php
r13878 r13893 25 25 * 26 26 * @since 1.5.0 27 *28 27 */ 29 28 public function __construct() { … … 44 43 * @since 7.0.0 45 44 * 46 * @param string $key 45 * @param string $key The object var to get. 47 46 * @return mixed 48 47 */ 49 48 public function __get( $key = '' ) { 50 49 51 // Backwards compatibility for the original Notifications table var 50 // Backwards compatibility for the original Notifications table var. 52 51 if ( 'table_name_notifications' === $key ) { 53 52 return bp_is_active( 'notifications' ) … … 56 55 } 57 56 58 // Return object var if set, else null 57 // Return object var if set, else null. 59 58 return isset( $this->{$key} ) 60 59 ? $this->{$key} … … 90 89 * @since 1.5.0 91 90 * 92 * @param array $ valueArray of included and optional components.91 * @param array $optional_components Array of included and optional components. 93 92 */ 94 93 $bp->optional_components = apply_filters( 'bp_optional_components', array( 'activity', 'blogs', 'friends', 'groups', 'messages', 'notifications', 'settings', 'xprofile' ) ); … … 104 103 105 104 // Get a list of activated components. 106 if ( $active_components = bp_get_option( 'bp-active-components' ) ) { 105 $active_components = bp_get_option( 'bp-active-components' ); 106 if ( $active_components ) { 107 107 108 108 /** This filter is documented in bp-core/admin/bp-core-admin-components.php */ 109 $bp->active_components 109 $bp->active_components = apply_filters( 'bp_active_components', $active_components ); 110 110 111 111 /** … … 118 118 $bp->deactivated_components = apply_filters( 'bp_deactivated_components', array_values( array_diff( array_values( array_merge( $bp->optional_components, $bp->required_components ) ), array_keys( $bp->active_components ) ) ) ); 119 119 120 // Pre 1.5 Backwards compatibility.120 // Pre 1.5 Backwards compatibility. 121 121 } elseif ( $deactivated_components = bp_get_option( 'bp-deactivated-components' ) ) { 122 122 … … 130 130 131 131 // Setup the active components. 132 $active_components 132 $active_components = array_fill_keys( array_diff( array_values( array_merge( $bp->optional_components, $bp->required_components ) ), array_values( $bp->deactivated_components ) ), '1' ); 133 133 134 134 /** This filter is documented in bp-core/admin/bp-core-admin-components.php */ 135 135 $bp->active_components = apply_filters( 'bp_active_components', $bp->active_components ); 136 136 137 // Default to all components active.137 // Default to all components active. 138 138 } else { 139 139 … … 142 142 143 143 // Setup the active components. 144 $active_components 144 $active_components = array_fill_keys( array_values( array_merge( $bp->optional_components, $bp->required_components ) ), '1' ); 145 145 146 146 /** This filter is documented in bp-core/admin/bp-core-admin-components.php */ … … 151 151 foreach ( $bp->optional_components as $component ) { 152 152 if ( bp_is_active( $component ) && file_exists( $bp->plugin_dir . '/bp-' . $component . '/bp-' . $component . '-loader.php' ) ) { 153 include ( $bp->plugin_dir . '/bp-' . $component . '/bp-' . $component . '-loader.php' );153 include $bp->plugin_dir . '/bp-' . $component . '/bp-' . $component . '-loader.php'; 154 154 } 155 155 } … … 158 158 foreach ( $bp->required_components as $component ) { 159 159 if ( file_exists( $bp->plugin_dir . '/bp-' . $component . '/bp-' . $component . '-loader.php' ) ) { 160 include ( $bp->plugin_dir . '/bp-' . $component . '/bp-' . $component . '-loader.php' );160 include $bp->plugin_dir . '/bp-' . $component . '/bp-' . $component . '-loader.php'; 161 161 } 162 162 } … … 189 189 190 190 $includes = array( 191 'admin' 191 'admin', 192 192 ); 193 193 … … 237 237 238 238 // Logged in user is the 'current_user'. 239 $current_user 239 $current_user = wp_get_current_user(); 240 240 241 241 // The user ID of the user who is currently logged in. 242 $bp->loggedin_user = new stdClass;243 $bp->loggedin_user->id 242 $bp->loggedin_user = new stdClass(); 243 $bp->loggedin_user->id = isset( $current_user->ID ) ? $current_user->ID : 0; 244 244 245 245 /** Avatars ********************************************************** … … 247 247 248 248 // Fetches the default Gravatar image to use if the user/group/blog has no avatar or gravatar. 249 $bp->grav_default = new stdClass;249 $bp->grav_default = new stdClass(); 250 250 251 251 /** … … 256 256 * @param string $value Default user Gravatar. 257 257 */ 258 $bp->grav_default->user = apply_filters( 'bp_user_gravatar_default',$bp->site_options['avatar_default'] );258 $bp->grav_default->user = apply_filters( 'bp_user_gravatar_default', $bp->site_options['avatar_default'] ); 259 259 260 260 /** … … 272 272 * @since 1.1.0 273 273 * 274 * @param string $ valueDefault blog Gravatar.275 */ 276 $bp->grav_default->blog = apply_filters( 'bp_blog_gravatar_default',$bp->grav_default->user );274 * @param string $gravatar_default Default blog Gravatar. 275 */ 276 $bp->grav_default->blog = apply_filters( 'bp_blog_gravatar_default', $bp->grav_default->user ); 277 277 278 278 // Only fully deprecate the legacy navigation globals if BP Classic is not active. … … 325 325 326 326 // Global groups. 327 wp_cache_add_global_groups( array( 328 'bp', 329 'bp_pages', 330 'bp_invitations', 331 ) ); 327 wp_cache_add_global_groups( 328 array( 329 'bp', 330 'bp_pages', 331 'bp_invitations', 332 ) 333 ); 332 334 333 335 parent::setup_cache_groups(); … … 371 373 register_post_type( 372 374 bp_get_email_post_type(), 373 apply_filters( 'bp_register_email_post_type', array( 374 'description' => _x( 'BuddyPress emails', 'email post type description', 'buddypress' ), 375 'capabilities' => array( 376 'edit_posts' => 'bp_moderate', 377 'edit_others_posts' => 'bp_moderate', 378 'publish_posts' => 'bp_moderate', 379 'read_private_posts' => 'bp_moderate', 380 'delete_posts' => 'bp_moderate', 381 'delete_others_posts' => 'bp_moderate', 382 ), 383 'map_meta_cap' => true, 384 'labels' => bp_get_email_post_type_labels(), 385 'menu_icon' => 'dashicons-email', 386 'public' => false, 387 'publicly_queryable' => bp_current_user_can( 'bp_moderate' ), 388 'query_var' => false, 389 'rewrite' => false, 390 'show_in_admin_bar' => false, 391 'show_ui' => bp_current_user_can( 'bp_moderate' ), 392 'supports' => bp_get_email_post_type_supports(), 393 ) ) 375 apply_filters( 376 'bp_register_email_post_type', 377 array( 378 'description' => _x( 'BuddyPress emails', 'email post type description', 'buddypress' ), 379 'capabilities' => array( 380 'edit_posts' => 'bp_moderate', 381 'edit_others_posts' => 'bp_moderate', 382 'publish_posts' => 'bp_moderate', 383 'read_private_posts' => 'bp_moderate', 384 'delete_posts' => 'bp_moderate', 385 'delete_others_posts' => 'bp_moderate', 386 ), 387 'map_meta_cap' => true, 388 'labels' => bp_get_email_post_type_labels(), 389 'menu_icon' => 'dashicons-email', 390 'public' => false, 391 'publicly_queryable' => bp_current_user_can( 'bp_moderate' ), 392 'query_var' => false, 393 'rewrite' => false, 394 'show_in_admin_bar' => false, 395 'show_ui' => bp_current_user_can( 'bp_moderate' ), 396 'supports' => bp_get_email_post_type_supports(), 397 ) 398 ) 394 399 ); 395 400 }
Note: See TracChangeset
for help on using the changeset viewer.