Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/ms-deprecated.php

    r14032 r15174  
    9999 * @since MU
    100100 * @deprecated 3.0.0
    101  * @deprecated Use $GLOBALS['current_user']->ID
    102  */
    103 function get_current_user_id() {
    104     _deprecated_function( __FUNCTION__, '3.0', '$GLOBALS[\'current_user\']->ID' );
    105     return $GLOBALS['current_user']->ID;
    106 }
    107 
    108 /**
    109  * @since MU
    110  * @deprecated 3.0.0
    111101 * @deprecated Use get_user_by()
    112102 * @see get_user_by()
     
    149139}
    150140
     141/**
     142 * @since MU
     143 * @deprecated 3.0.0
     144 * @deprecated Don't use this, really.
     145 */
     146function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) {
     147    _deprecated_function( __FUNCTION__, '3.0', "Don't use this, really." );
     148
     149    global $wpdb;
     150    $blogs = $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", $wpdb->siteid), ARRAY_A );
     151
     152    foreach ( (array) $blogs as $details ) {
     153        $blog_list[ $details['blog_id'] ] = $details;
     154        $blog_list[ $details['blog_id'] ]['postcount'] = $wpdb->get_var( "SELECT COUNT(ID) FROM " . $wpdb->get_blog_prefix( $details['blog_id'] ). "posts WHERE post_status='publish' AND post_type='post'" );
     155    }
     156    unset( $blogs );
     157    $blogs = $blog_list;
     158
     159    if ( false == is_array( $blogs ) )
     160        return array();
     161
     162    if ( $num == 'all' )
     163        return array_slice( $blogs, $start, count( $blogs ) );
     164    else
     165        return array_slice( $blogs, $start, $num );
     166}
     167
     168/**
     169 * @since MU
     170 * @deprecated 3.0.0
     171 * @deprecated Don't use this, really.
     172 */
     173function get_most_active_blogs( $num = 10, $display = true ) {
     174    _deprecated_function( __FUNCTION__, '3.0', "Don't use this, really." );
     175
     176    $blogs = get_blog_list( 0, 'all', false ); // $blog_id -> $details
     177    if ( is_array( $blogs ) ) {
     178        reset( $blogs );
     179        foreach ( (array) $blogs as $key => $details ) {
     180            $most_active[ $details['blog_id'] ] = $details['postcount'];
     181            $blog_list[ $details['blog_id'] ] = $details; // array_slice() removes keys!!
     182        }
     183        arsort( $most_active );
     184        reset( $most_active );
     185        foreach ( (array) $most_active as $key => $details )
     186            $t[ $key ] = $blog_list[ $key ];
     187
     188        unset( $most_active );
     189        $most_active = $t;
     190    }
     191
     192    if ( $display == true ) {
     193        if ( is_array( $most_active ) ) {
     194            reset( $most_active );
     195            foreach ( (array) $most_active as $key => $details ) {
     196                $url = esc_url('http://' . $details['domain'] . $details['path']);
     197                echo '<li>' . $details['postcount'] . " <a href='$url'>$url</a></li>";
     198            }
     199        }
     200    }
     201    return array_slice( $most_active, 0, $num );
     202}
    151203?>
Note: See TracChangeset for help on using the changeset viewer.