84 function graceful_fail( $message ) { |
84 function graceful_fail( $message ) { |
85 _deprecated_function( __FUNCTION__, '3.0', 'wp_die()' ); |
85 _deprecated_function( __FUNCTION__, '3.0', 'wp_die()' ); |
86 $message = apply_filters( 'graceful_fail', $message ); |
86 $message = apply_filters( 'graceful_fail', $message ); |
87 $message_template = apply_filters( 'graceful_fail_template', |
87 $message_template = apply_filters( 'graceful_fail_template', |
88 '<!DOCTYPE html> |
88 '<!DOCTYPE html> |
89 <html xmlns="http://www.w3.org/1999/xhtml"><head profile="http://gmpg.org/xfn/11"> |
89 <html xmlns="http://www.w3.org/1999/xhtml"><head> |
90 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
90 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
91 <title>Error!</title> |
91 <title>Error!</title> |
92 <style type="text/css"> |
92 <style type="text/css"> |
93 img { |
93 img { |
94 border: 0; |
94 border: 0; |
164 _deprecated_function( __FUNCTION__, '3.0', 'wp_get_sites()' ); |
164 _deprecated_function( __FUNCTION__, '3.0', 'wp_get_sites()' ); |
165 |
165 |
166 global $wpdb; |
166 global $wpdb; |
167 $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 ); |
167 $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 ); |
168 |
168 |
|
169 $blog_list = array(); |
169 foreach ( (array) $blogs as $details ) { |
170 foreach ( (array) $blogs as $details ) { |
170 $blog_list[ $details['blog_id'] ] = $details; |
171 $blog_list[ $details['blog_id'] ] = $details; |
171 $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'" ); |
172 $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'" ); |
172 } |
173 } |
173 unset( $blogs ); |
174 |
174 $blogs = $blog_list; |
175 if ( ! $blog_list ) { |
175 |
|
176 if ( false == is_array( $blogs ) ) |
|
177 return array(); |
176 return array(); |
178 |
177 } |
179 if ( $num == 'all' ) |
178 |
180 return array_slice( $blogs, $start, count( $blogs ) ); |
179 if ( $num == 'all' ) { |
181 else |
180 return array_slice( $blog_list, $start, count( $blog_list ) ); |
182 return array_slice( $blogs, $start, $num ); |
181 } else { |
|
182 return array_slice( $blog_list, $start, $num ); |
|
183 } |
183 } |
184 } |
184 |
185 |
185 /** |
186 /** |
186 * @since MU |
187 * @since MU |
187 * @deprecated 3.0.0 |
188 * @deprecated 3.0.0 |
191 _deprecated_function( __FUNCTION__, '3.0' ); |
192 _deprecated_function( __FUNCTION__, '3.0' ); |
192 |
193 |
193 $blogs = get_blog_list( 0, 'all', false ); // $blog_id -> $details |
194 $blogs = get_blog_list( 0, 'all', false ); // $blog_id -> $details |
194 if ( is_array( $blogs ) ) { |
195 if ( is_array( $blogs ) ) { |
195 reset( $blogs ); |
196 reset( $blogs ); |
|
197 $most_active = array(); |
|
198 $blog_list = array(); |
196 foreach ( (array) $blogs as $key => $details ) { |
199 foreach ( (array) $blogs as $key => $details ) { |
197 $most_active[ $details['blog_id'] ] = $details['postcount']; |
200 $most_active[ $details['blog_id'] ] = $details['postcount']; |
198 $blog_list[ $details['blog_id'] ] = $details; // array_slice() removes keys!! |
201 $blog_list[ $details['blog_id'] ] = $details; // array_slice() removes keys!! |
199 } |
202 } |
200 arsort( $most_active ); |
203 arsort( $most_active ); |
201 reset( $most_active ); |
204 reset( $most_active ); |
202 foreach ( (array) $most_active as $key => $details ) |
205 $t = array(); |
|
206 foreach ( (array) $most_active as $key => $details ) { |
203 $t[ $key ] = $blog_list[ $key ]; |
207 $t[ $key ] = $blog_list[ $key ]; |
204 |
208 } |
205 unset( $most_active ); |
209 unset( $most_active ); |
206 $most_active = $t; |
210 $most_active = $t; |
207 } |
211 } |
208 |
212 |
209 if ( $display == true ) { |
213 if ( $display == true ) { |