Changeset 11080
- Timestamp:
- 09/10/2016 02:25:50 PM (8 years ago)
- Location:
- trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/classes/class-bp-activity-component.php
r11022 r11080 121 121 ); 122 122 123 // Fetch the default directory title. 124 $default_directory_titles = bp_core_get_directory_page_default_titles(); 125 $default_directory_title = $default_directory_titles[$this->id]; 126 123 127 // All globals for activity component. 124 128 // Note that global_tables is included in this array. … … 127 131 'root_slug' => isset( $bp->pages->activity->slug ) ? $bp->pages->activity->slug : BP_ACTIVITY_SLUG, 128 132 'has_directory' => true, 129 'directory_title' => _x( 'Site-Wide Activity', 'component directory title', 'buddypress' ),133 'directory_title' => isset( $bp->pages->activity->title ) ? $bp->pages->activity->title : $default_directory_title, 130 134 'notification_callback' => 'bp_activity_format_notifications', 131 135 'search_string' => __( 'Search Activity...', 'buddypress' ), -
trunk/src/bp-blogs/classes/class-bp-blogs-component.php
r10674 r11080 7 7 * information from those blogs to make querying blogs in bulk more performant. 8 8 * 9 9 * @package BuddyPress 10 10 * @subpackage BlogsCore 11 11 * @since 1.5.0 … … 45 45 * @since 1.5.0 46 46 * 47 47 * @see BP_Component::setup_globals() for description of parameters. 48 48 * 49 49 * @param array $args See {@link BP_Component::setup_globals()}. … … 65 65 'blog' => $bp->table_prefix . 'bp_user_blogs_blogmeta', 66 66 ); 67 68 // Fetch the default directory title. 69 $default_directory_titles = bp_core_get_directory_page_default_titles(); 70 $default_directory_title = $default_directory_titles[$this->id]; 67 71 68 72 // All globals for blogs component. … … 71 75 'root_slug' => isset( $bp->pages->blogs->slug ) ? $bp->pages->blogs->slug : BP_BLOGS_SLUG, 72 76 'has_directory' => is_multisite(), // Non-multisite installs don't need a top-level Sites directory, since there's only one site. 73 'directory_title' => _x( 'Sites', 'component directory title', 'buddypress' ),77 'directory_title' => isset( $bp->pages->blogs->title ) ? $bp->pages->blogs->title : $default_directory_title, 74 78 'notification_callback' => 'bp_blogs_format_notifications', 75 79 'search_string' => __( 'Search sites...', 'buddypress' ), … … 151 155 * @param array $main_nav Optional. See BP_Component::setup_nav() for 152 156 * description. 153 157 * @param array $sub_nav Optional. See BP_Component::setup_nav() for 154 158 * description. 155 159 */ -
trunk/src/bp-core/bp-core-functions.php
r11048 r11080 631 631 } 632 632 633 $page_titles = array( 634 'activity' => _x( 'Activity', 'Page title for the Activity directory.', 'buddypress' ), 635 'groups' => _x( 'Groups', 'Page title for the Groups directory.', 'buddypress' ), 636 'blogs' => _x( 'Sites', 'Page title for the Sites directory.', 'buddypress' ), 637 'members' => _x( 'Members', 'Page title for the Members directory.', 'buddypress' ), 638 'activate' => _x( 'Activate', 'Page title for the user activation screen.', 'buddypress' ), 639 'register' => _x( 'Register', 'Page title for the user registration screen.', 'buddypress' ), 640 ); 633 $page_titles = bp_core_get_directory_page_default_titles(); 641 634 642 635 $pages_to_create = array(); … … 692 685 restore_current_blog(); 693 686 } 687 } 688 689 /** 690 * Get the default page titles for BP directory pages. 691 * 692 * @since 2.7.0 693 * 694 * @return array 695 */ 696 function bp_core_get_directory_page_default_titles() { 697 return array( 698 'activity' => _x( 'Activity', 'Page title for the Activity directory.', 'buddypress' ), 699 'groups' => _x( 'Groups', 'Page title for the Groups directory.', 'buddypress' ), 700 'blogs' => _x( 'Sites', 'Page title for the Sites directory.', 'buddypress' ), 701 'members' => _x( 'Members', 'Page title for the Members directory.', 'buddypress' ), 702 'activate' => _x( 'Activate', 'Page title for the user activation screen.', 'buddypress' ), 703 'register' => _x( 'Register', 'Page title for the user registration screen.', 'buddypress' ), 704 ); 694 705 } 695 706 -
trunk/src/bp-core/bp-core-update.php
r10941 r11080 266 266 267 267 // Version 2.7.0. 268 if ( $raw_db_version < 1 0940) {268 if ( $raw_db_version < 11079 ) { 269 269 bp_update_to_2_7(); 270 270 } … … 395 395 * a manual filter) to restore it. In 1.9.2, we add an option that flags 396 396 * whether bp-default or a child theme is active at the time of upgrade; if so, 397 * 397 398 * the theme directory will continue to be registered even if the theme is 398 399 * deactivated temporarily. Thus, new installations will not see bp-default, … … 510 511 * - Add email unsubscribe salt. 511 512 * 513 * - Save legacy directory titles to the corresponding WP pages. 514 * 512 515 * @since 2.7.0 513 516 */ 514 517 function bp_update_to_2_7() { 515 518 bp_add_option( 'bp-emails-unsubscribe-salt', base64_encode( wp_generate_password( 64, true, true ) ) ); 519 520 // Update post_titles 521 bp_270_migrate_directory_page_titles(); 516 522 } 517 523 … … 564 570 565 571 /** 572 * Update WP pages so that their post_title matches the legacy component directory title. 573 * 574 * As of 2.7.0, component directory titles come from the `post_title` attribute of the corresponding WP post object, 575 * instead of being hardcoded. To ensure that directory titles don't change for existing installations, we update these 576 * WP posts with the formerly hardcoded titles. 577 * 578 * @since 2.7.0 579 */ 580 function bp_270_migrate_directory_page_titles() { 581 $bp_pages = bp_core_get_directory_page_ids( 'all' ); 582 583 $default_titles = bp_core_get_directory_page_default_titles(); 584 585 $legacy_titles = array( 586 'activity' => _x( 'Site-Wide Activity', 'component directory title', 'buddypress' ), 587 'blogs' => _x( 'Sites', 'component directory title', 'buddypress' ), 588 'groups' => _x( 'Groups', 'component directory title', 'buddypress' ), 589 'members' => _x( 'Members', 'component directory title', 'buddypress' ), 590 ); 591 592 foreach ( $bp_pages as $component => $page_id ) { 593 if ( ! isset( $legacy_titles[ $component ] ) ) { 594 continue; 595 } 596 597 $page = get_post( $page_id ); 598 if ( ! $page ) { 599 continue; 600 } 601 602 // If the admin has changed the default title, don't touch it. 603 if ( isset( $default_titles[ $component ] ) && $default_titles[ $component ] !== $page->post_title ) { 604 continue; 605 } 606 607 // If the saved page title is the same as the legacy title, there's nothing to do. 608 if ( $legacy_titles[ $component ] == $page->post_title ) { 609 continue; 610 } 611 612 // Update the page with the legacy title. 613 wp_update_post( array( 614 'ID' => $page_id, 615 'post_title' => $legacy_titles[ $component ], 616 ) ); 617 } 618 } 619 620 /** 566 621 * Redirect user to BP's What's New page on first page load after activation. 567 622 * -
trunk/src/bp-groups/classes/class-bp-groups-component.php
r10794 r11080 169 169 ); 170 170 171 // Fetch the default directory title. 172 $default_directory_titles = bp_core_get_directory_page_default_titles(); 173 $default_directory_title = $default_directory_titles[$this->id]; 174 171 175 // All globals for groups component. 172 176 // Note that global_tables is included in this array. … … 175 179 'root_slug' => isset( $bp->pages->groups->slug ) ? $bp->pages->groups->slug : BP_GROUPS_SLUG, 176 180 'has_directory' => true, 177 'directory_title' => _x( 'Groups', 'component directory title', 'buddypress' ),181 'directory_title' => isset( $bp->pages->groups->title ) ? $bp->pages->groups->title : $default_directory_title, 178 182 'notification_callback' => 'groups_format_notifications', 179 183 'search_string' => _x( 'Search Groups...', 'Component directory search', 'buddypress' ), -
trunk/src/bp-members/classes/class-bp-members-component.php
r10774 r11080 109 109 } 110 110 111 // Fetch the default directory title. 112 $default_directory_titles = bp_core_get_directory_page_default_titles(); 113 $default_directory_title = $default_directory_titles[$this->id]; 114 111 115 // Override any passed args. 112 116 $args = array( … … 114 118 'root_slug' => isset( $bp->pages->members->slug ) ? $bp->pages->members->slug : BP_MEMBERS_SLUG, 115 119 'has_directory' => true, 116 'directory_title' => _x( 'Members', 'component directory title', 'buddypress' ),120 'directory_title' => isset( $bp->pages->members->title ) ? $bp->pages->members->title : $default_directory_title, 117 121 'search_string' => __( 'Search Members...', 'buddypress' ), 118 122 'global_tables' => array(
Note: See TracChangeset
for help on using the changeset viewer.