Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/11/2012 08:43:00 PM (13 years ago)
Author:
johnjamesjacoby
Message:

Fix unused variables and possible accidental assignments in bp-core-functions.php.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-functions.php

    r5721 r5723  
    129129 * @package BuddyPress Core
    130130 * @since 1.5
    131  *
    132  * @todo Remove the "Upgrading from an earlier version of BP pre-1.5" block. Temporary measure for
    133  *       people running trunk installations. Leave for a version or two, then remove.
    134131 */
    135132function bp_core_get_directory_page_ids() {
    136133    $page_ids = bp_get_option( 'bp-pages' );
    137134
    138     // Upgrading from an earlier version of BP pre-1.5
    139     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 
    149135    // 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 ) {
    152138            if ( empty( $component_name ) || empty( $page_id ) ) {
    153139                unset( $page_ids[$component_name] );
     
    189175
    190176    // 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 ) ) {
    192179
    193180        // Always get page data from the root blog, except on multiblog mode, when it comes
     
    197184        $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' " ) );
    198185
    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 ) {
    201188                if ( $page_name->ID == $page_id ) {
    202189                    $pages->{$component_id}->name  = $page_name->post_name;
     
    212199                    }
    213200
    214                     $pages->{$component_id}->slug = implode( '/', array_reverse( (array)$slug ) );
     201                    $pages->{$component_id}->slug = implode( '/', array_reverse( (array) $slug ) );
    215202                }
    216203
     
    443430
    444431            // 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 ) {
    446434                break;
    447435            }
     
    460448            if ( $i + 2 < $j ) {
    461449                $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];
    467456                }
    468457            }
    469458
    470459            // No output, so happened right now
    471             if ( !(int)trim( $output ) ) {
     460            if ( ! (int) trim( $output ) ) {
    472461                $output = $right_now_text;
    473462            }
Note: See TracChangeset for help on using the changeset viewer.