Ticket #3428: 3428.02.patch
| File 3428.02.patch, 8.3 KB (added by , 15 years ago) |
|---|
-
bp-activity/bp-activity-loader.php
class BP_Activity_Component extends BP_Component { 76 76 'path' => BP_PLUGIN_DIR, 77 77 'slug' => BP_ACTIVITY_SLUG, 78 78 'root_slug' => isset( $bp->pages->activity->slug ) ? $bp->pages->activity->slug : BP_ACTIVITY_SLUG, 79 'has_directory' => true, 79 80 'search_string' => __( 'Search Activity...', 'buddypress' ), 80 81 'global_tables' => $global_tables, 81 82 'notification_callback' => 'bp_activity_format_notifications', -
bp-blogs/bp-blogs-loader.php
class BP_Blogs_Component extends BP_Component { 53 53 'path' => BP_PLUGIN_DIR, 54 54 'slug' => BP_BLOGS_SLUG, 55 55 'root_slug' => isset( $bp->pages->blogs->slug ) ? $bp->pages->blogs->slug : BP_BLOGS_SLUG, 56 'has_directory' => true, 56 57 'notification_callback' => 'bp_blogs_format_notifications', 57 58 'search_string' => __( 'Search sites...', 'buddypress' ), 58 59 'autocomplete_all' => defined( 'BP_MESSAGES_AUTOCOMPLETE_ALL' ), -
bp-core/admin/bp-core-admin.php
function bp_core_admin_page_options() { 483 483 // Get the existing WP pages 484 484 $existing_pages = bp_core_get_page_meta(); 485 485 486 // An array of strings looped over to create component setup markup 487 $directory_pages = array( 488 'members' => __( 'Community Members', 'buddypress' ), 489 'activity' => __( 'Activity Streams', 'buddypress' ), 490 'groups' => __( 'User Groups', 'buddypress' ), 491 'forums' => __( 'Discussion Forums', 'buddypress' ), 492 ); 493 494 if ( is_multisite() ) 495 $directory_pages['blogs'] = __( "Site Directory", 'buddypress' ); ?> 486 // Now, set up an array of components (along with component names) that have directory pages 487 $directory_pages = array(); 488 foreach( $bp->loaded_components as $component_id => $data ) { 489 if ( isset( $bp->{$component_id} ) ) { 490 // Only components that need directories should be listed here 491 if ( empty( $bp->{$component_id}->has_directory ) ) 492 continue; 493 494 // component->name was introduced in BP 1.5, so we must provide a fallback 495 $component_name = isset( $bp->{$component_id}->name ) ? $bp->{$component_id}->name : ucwords( $component_id ); 496 497 $directory_pages[$component_id] = $component_name; 498 499 } 500 } 501 502 $directory_pages = apply_filters( 'bp_directory_pages', $directory_pages ); 503 504 ?> 496 505 497 506 <h3><?php _e( 'Directories', 'buddypress' ); ?></h3> 498 507 -
bp-core/bp-core-component.php
class BP_Component { 33 33 * @var string Unique slug (used in query string and permalinks) 34 34 */ 35 35 var $slug; 36 37 /** 38 * @var bool Does this component need a top-level directory? 39 */ 40 var $has_directory; 36 41 37 42 /** 38 43 * @var string The path to the plugins files … … class BP_Component { 107 112 $defaults = array( 108 113 'slug' => '', 109 114 'root_slug' => '', 115 'has_directory' => false, 110 116 'notification_callback' => '', 111 117 'search_string' => '', 112 118 'global_tables' => '' … … class BP_Component { 119 125 // Slug used for root directory 120 126 $this->root_slug = apply_filters( 'bp_' . $this->id . '_root_slug', $r['root_slug'] ); 121 127 128 // Does this component have a top-level directory? 129 $this->has_directory = apply_filters( 'bp_' . $this->id . '_has_directory', $r['has_directory'] ); 130 122 131 // Search string 123 132 $this->search_string = apply_filters( 'bp_' . $this->id . '_search_string', $r['search_string'] ); 124 133 -
bp-core/bp-core-functions.php
function bp_core_get_page_meta() { 92 92 } 93 93 } 94 94 95 foreach( $page_ids as $component_name => $page_id ) { 96 if ( empty( $component_name ) || empty( $page_id ) ) 97 unset( $page_ids[$component_name] ); 98 } 99 95 100 return apply_filters( 'bp_core_get_page_meta', $page_ids ); 96 101 } 97 102 … … function bp_core_update_page_meta( $blog_page_ids ) { 121 126 function bp_core_get_page_names() { 122 127 global $wpdb, $bp; 123 128 124 // Set pages as standard class125 $pages = new stdClass;126 127 129 // Get pages and IDs 128 130 if ( $page_ids = bp_core_get_page_meta() ) { 131 132 // Set pages as standard class 133 $pages = new stdClass; 129 134 130 135 $posts_table_name = bp_is_multiblog_mode() ? $wpdb->get_blog_prefix( bp_get_root_blog_id() ) . 'posts' : $wpdb->posts; 131 136 $page_ids_sql = implode( ',', (array)$page_ids ); … … function bp_core_activation_notice() { 420 425 $wp_page_components = array(); 421 426 422 427 // Only some BP components require a WP page to function - those with a non-empty root_slug 423 foreach( $bp-> active_components as $component_id => $is_active ) {424 if ( !empty( $bp->{$component_id}-> root_slug) ) {428 foreach( $bp->loaded_components as $component_id => $is_active ) { 429 if ( !empty( $bp->{$component_id}->has_directory ) ) { 425 430 $wp_page_components[] = array( 426 431 'id' => $component_id, 427 'name' => $bp->{$component_id}->name432 'name' => isset( $bp->{$component_id}->name ) ? $bp->{$component_id}->name : ucwords( $bp->{$component_id}->id ) 428 433 ); 429 434 } 430 435 } … … function bp_core_add_root_component( $slug ) { 1068 1073 1069 1074 if ( empty( $bp->pages ) ) 1070 1075 $bp->pages = bp_core_get_page_names(); 1071 1076 1072 1077 $match = false; 1073 1078 1074 1079 // Check if the slug is registered in the $bp->pages global 1075 1080 foreach ( (array)$bp->pages as $key => $page ) { 1076 1081 if ( $key == $slug || $page->slug == $slug ) … … function bp_core_add_root_component( $slug ) { 1082 1087 $bp->add_root[] = $slug; 1083 1088 add_action( 'bp_init', 'bp_core_create_root_component_page' ); 1084 1089 } 1090 1091 // Make sure that this component is registered as requiring a top-level directory 1092 if ( isset( $bp->{$slug} ) ) { 1093 $bp->loaded_components[$bp->{$slug}->slug] = $bp->{$slug}->id; 1094 $bp->{$slug}->has_directory = true; 1095 } 1085 1096 } 1086 1097 1087 1098 function bp_core_create_root_component_page() { -
bp-forums/bp-forums-loader.php
class BP_Forums_Component extends BP_Component { 55 55 $globals = array( 56 56 'slug' => BP_FORUMS_SLUG, 57 57 'root_slug' => isset( $bp->pages->forums->slug ) ? $bp->pages->forums->slug : BP_FORUMS_SLUG, 58 'has_directory' => true, 58 59 'notification_callback' => 'messages_format_notifications', 59 60 'search_string' => __( 'Search Forums...', 'buddypress' ), 60 61 ); -
bp-groups/bp-groups-loader.php
class BP_Groups_Component extends BP_Component { 78 78 $globals = array( 79 79 'slug' => BP_GROUPS_SLUG, 80 80 'root_slug' => isset( $bp->pages->groups->slug ) ? $bp->pages->groups->slug : BP_GROUPS_SLUG, 81 'has_directory' => true, 81 82 'notification_callback' => 'groups_format_notifications', 82 83 'search_string' => __( 'Search Groups...', 'buddypress' ), 83 84 'global_tables' => $global_tables -
bp-members/bp-members-loader.php
class BP_Members_Component extends BP_Component { 65 65 $globals = array( 66 66 'slug' => BP_MEMBERS_SLUG, 67 67 'root_slug' => isset( $bp->pages->members->slug ) ? $bp->pages->members->slug : BP_MEMBERS_SLUG, 68 'has_directory' => true, 68 69 'search_string' => __( 'Search Members...', 'buddypress' ), 69 70 ); 70 71
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)