Changeset 5723 for trunk/bp-core/bp-core-functions.php
- Timestamp:
- 02/11/2012 08:43:00 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-functions.php
r5721 r5723 129 129 * @package BuddyPress Core 130 130 * @since 1.5 131 *132 * @todo Remove the "Upgrading from an earlier version of BP pre-1.5" block. Temporary measure for133 * people running trunk installations. Leave for a version or two, then remove.134 131 */ 135 132 function bp_core_get_directory_page_ids() { 136 133 $page_ids = bp_get_option( 'bp-pages' ); 137 134 138 // Upgrading from an earlier version of BP pre-1.5139 if ( !isset( $page_ids['members'] ) && $ms_page_ids = get_site_option( 'bp-pages' ) ) {140 $page_blog_id = bp_is_multiblog_mode() ? get_current_blog_id() : bp_get_root_blog_id();141 142 if ( isset( $ms_page_ids[$page_blog_id] ) ) {143 $page_ids = $ms_page_ids[$page_blog_id];144 145 bp_update_option( 'bp-pages', $page_ids );146 }147 }148 149 135 // Ensure that empty indexes are unset. Should only matter in edge cases 150 if ( $page_ids&& is_array( $page_ids ) ) {151 foreach( (array) $page_ids as $component_name => $page_id ) {136 if ( !empty( $page_ids ) && is_array( $page_ids ) ) { 137 foreach( (array) $page_ids as $component_name => $page_id ) { 152 138 if ( empty( $component_name ) || empty( $page_id ) ) { 153 139 unset( $page_ids[$component_name] ); … … 189 175 190 176 // Get pages and IDs 191 if ( $page_ids = bp_core_get_directory_page_ids() ) { 177 $page_ids = bp_core_get_directory_page_ids(); 178 if ( !empty( $page_ids ) ) { 192 179 193 180 // Always get page data from the root blog, except on multiblog mode, when it comes … … 197 184 $page_names = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent, post_title FROM {$posts_table_name} WHERE ID IN ({$page_ids_sql}) AND post_status = 'publish' " ) ); 198 185 199 foreach ( (array) $page_ids as $component_id => $page_id ) {200 foreach ( (array) $page_names as $page_name ) {186 foreach ( (array) $page_ids as $component_id => $page_id ) { 187 foreach ( (array) $page_names as $page_name ) { 201 188 if ( $page_name->ID == $page_id ) { 202 189 $pages->{$component_id}->name = $page_name->post_name; … … 212 199 } 213 200 214 $pages->{$component_id}->slug = implode( '/', array_reverse( (array) $slug ) );201 $pages->{$component_id}->slug = implode( '/', array_reverse( (array) $slug ) ); 215 202 } 216 203 … … 443 430 444 431 // Finding the biggest chunk (if the chunk fits, break) 445 if ( ( $count = floor($since / $seconds) ) != 0 ) { 432 $count = floor( $since / $seconds ); 433 if ( 0 != $count ) { 446 434 break; 447 435 } … … 460 448 if ( $i + 2 < $j ) { 461 449 $seconds2 = $chunks[$i + 1][0]; 462 $name2 = $chunks[$i + 1][1]; 463 464 if ( ( $count2 = floor( ( $since - ( $seconds * $count ) ) / $seconds2 ) ) != 0 ) { 465 // Add to output var 466 $output .= ( 1 == $count2 ) ? _x( ',', 'Separator in time since', 'buddypress' ) . ' 1 '. $chunks[$i + 1][1] : _x( ',', 'Separator in time since', 'buddypress' ) . ' ' . $count2 . ' ' . $chunks[$i + 1][2]; 450 $name2 = $chunks[$i + 1][1]; 451 $count2 = floor( ( $since - ( $seconds * $count ) ) / $seconds2 ); 452 453 // Add to output var 454 if ( 0 != $count ) { 455 $output .= ( 1 == $count2 ) ? _x( ',', 'Separator in time since', 'buddypress' ) . ' 1 '. $name2 : _x( ',', 'Separator in time since', 'buddypress' ) . ' ' . $count2 . ' ' . $chunks[$i + 1][2]; 467 456 } 468 457 } 469 458 470 459 // No output, so happened right now 471 if ( ! (int)trim( $output ) ) {460 if ( ! (int) trim( $output ) ) { 472 461 $output = $right_now_text; 473 462 }
Note: See TracChangeset
for help on using the changeset viewer.