~canonical-sysadmins/wordpress/4.8.1

« back to all changes in this revision

Viewing changes to wp-includes/ms-deprecated.php

  • Committer: Barry Price
  • Date: 2016-08-17 04:50:12 UTC
  • mfrom: (1.1.18 upstream)
  • Revision ID: barry.price@canonical.com-20160817045012-qfui81zhqnqv2ba9
Merge WP4.6 from upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 * @return int Current site ID.
25
25
 */
26
26
function get_dashboard_blog() {
27
 
    _deprecated_function( __FUNCTION__, '3.1' );
 
27
    _deprecated_function( __FUNCTION__, '3.1.0' );
28
28
    if ( $blog = get_site_option( 'dashboard_blog' ) )
29
29
        return get_blog_details( $blog );
30
30
 
41
41
 * @param int $len Optional. The length of password to generate. Default 8.
42
42
 */
43
43
function generate_random_password( $len = 8 ) {
44
 
        _deprecated_function( __FUNCTION__, '3.0', 'wp_generate_password()' );
 
44
        _deprecated_function( __FUNCTION__, '3.0.0', 'wp_generate_password()' );
45
45
        return wp_generate_password( $len );
46
46
}
47
47
 
61
61
 * @param string $user_login Optional. Username for the user to check. Default empty.
62
62
 */
63
63
function is_site_admin( $user_login = '' ) {
64
 
        _deprecated_function( __FUNCTION__, '3.0', 'is_super_admin()' );
 
64
        _deprecated_function( __FUNCTION__, '3.0.0', 'is_super_admin()' );
65
65
 
66
66
        if ( empty( $user_login ) ) {
67
67
                $user_id = get_current_user_id();
86
86
 * @see wp_die()
87
87
 */
88
88
function graceful_fail( $message ) {
89
 
        _deprecated_function( __FUNCTION__, '3.0', 'wp_die()' );
 
89
        _deprecated_function( __FUNCTION__, '3.0.0', 'wp_die()' );
90
90
        $message = apply_filters( 'graceful_fail', $message );
91
91
        $message_template = apply_filters( 'graceful_fail_template',
92
92
'<!DOCTYPE html>
126
126
 * @param string $username Username.
127
127
 */
128
128
function get_user_details( $username ) {
129
 
        _deprecated_function( __FUNCTION__, '3.0', 'get_user_by()' );
 
129
        _deprecated_function( __FUNCTION__, '3.0.0', 'get_user_by()' );
130
130
        return get_user_by('login', $username);
131
131
}
132
132
 
140
140
 * @param int $post_id Post ID.
141
141
 */
142
142
function clear_global_post_cache( $post_id ) {
143
 
        _deprecated_function( __FUNCTION__, '3.0', 'clean_post_cache()' );
 
143
        _deprecated_function( __FUNCTION__, '3.0.0', 'clean_post_cache()' );
144
144
}
145
145
 
146
146
/**
151
151
 * @see is_main_site()
152
152
 */
153
153
function is_main_blog() {
154
 
        _deprecated_function( __FUNCTION__, '3.0', 'is_main_site()' );
 
154
        _deprecated_function( __FUNCTION__, '3.0.0', 'is_main_site()' );
155
155
        return is_main_site();
156
156
}
157
157
 
167
167
 * @return string|bool Either false or the valid email address.
168
168
 */
169
169
function validate_email( $email, $check_domain = true) {
170
 
        _deprecated_function( __FUNCTION__, '3.0', 'is_email()' );
 
170
        _deprecated_function( __FUNCTION__, '3.0.0', 'is_email()' );
171
171
        return is_email( $email, $check_domain );
172
172
}
173
173
 
183
183
 * @param string $deprecated Unused.
184
184
 */
185
185
function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) {
186
 
        _deprecated_function( __FUNCTION__, '3.0', 'wp_get_sites()' );
 
186
        _deprecated_function( __FUNCTION__, '3.0.0', 'wp_get_sites()' );
187
187
 
188
188
        global $wpdb;
189
189
        $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 );
216
216
 * @return array List of "most active" sites.
217
217
 */
218
218
function get_most_active_blogs( $num = 10, $display = true ) {
219
 
        _deprecated_function( __FUNCTION__, '3.0' );
 
219
        _deprecated_function( __FUNCTION__, '3.0.0' );
220
220
 
221
221
        $blogs = get_blog_list( 0, 'all', false ); // $blog_id -> $details
222
222
        if ( is_array( $blogs ) ) {
267
267
 * @param string $url Optional. Redirect URL. Default empty.
268
268
 */
269
269
function wpmu_admin_do_redirect( $url = '' ) {
270
 
        _deprecated_function( __FUNCTION__, '3.3' );
 
270
        _deprecated_function( __FUNCTION__, '3.3.0' );
271
271
 
272
272
        $ref = '';
273
273
        if ( isset( $_GET['ref'] ) )
307
307
 * @return string
308
308
 */
309
309
function wpmu_admin_redirect_add_updated_param( $url = '' ) {
310
 
        _deprecated_function( __FUNCTION__, '3.3' );
 
310
        _deprecated_function( __FUNCTION__, '3.3.0' );
311
311
 
312
312
        if ( strpos( $url, 'updated=true' ) === false ) {
313
313
                if ( strpos( $url, '?' ) === false )
332
332
 * @return int
333
333
 */
334
334
function get_user_id_from_string( $string ) {
335
 
        _deprecated_function( __FUNCTION__, '3.6', 'get_user_by()' );
 
335
        _deprecated_function( __FUNCTION__, '3.6.0', 'get_user_by()' );
336
336
 
337
337
        if ( is_email( $string ) )
338
338
                $user = get_user_by( 'email', $string );
357
357
 * @return string
358
358
 */
359
359
function get_blogaddress_by_domain( $domain, $path ) {
360
 
        _deprecated_function( __FUNCTION__, '3.7' );
 
360
        _deprecated_function( __FUNCTION__, '3.7.0' );
361
361
 
362
362
        if ( is_subdomain_install() ) {
363
363
                $url = "http://" . $domain.$path;
388
388
 * @return string|int The ID of the newly created blog
389
389
 */
390
390
function create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 ) {
391
 
        _deprecated_function( __FUNCTION__, '4.4' );
 
391
        _deprecated_function( __FUNCTION__, '4.4.0' );
392
392
 
393
393
        if ( empty($path) )
394
394
                $path = '/';
424
424
 * @return array|false The network admins
425
425
 */
426
426
function get_admin_users_for_domain( $sitedomain = '', $path = '' ) {
427
 
        _deprecated_function( __FUNCTION__, '4.4' );
 
427
        _deprecated_function( __FUNCTION__, '4.4.0' );
428
428
 
429
429
        global $wpdb;
430
430
 
438
438
 
439
439
        return false;
440
440
}
 
441
 
 
442
/**
 
443
 * Return an array of sites for a network or networks.
 
444
 *
 
445
 * @since 3.7.0
 
446
 * @deprecated 4.6.0
 
447
 * @see get_sites()
 
448
 *
 
449
 * @global wpdb $wpdb WordPress database abstraction object.
 
450
 *
 
451
 * @param array $args {
 
452
 *     Array of default arguments. Optional.
 
453
 *
 
454
 *     @type int|array $network_id A network ID or array of network IDs. Set to null to retrieve sites
 
455
 *                                 from all networks. Defaults to current network ID.
 
456
 *     @type int       $public     Retrieve public or non-public sites. Default null, for any.
 
457
 *     @type int       $archived   Retrieve archived or non-archived sites. Default null, for any.
 
458
 *     @type int       $mature     Retrieve mature or non-mature sites. Default null, for any.
 
459
 *     @type int       $spam       Retrieve spam or non-spam sites. Default null, for any.
 
460
 *     @type int       $deleted    Retrieve deleted or non-deleted sites. Default null, for any.
 
461
 *     @type int       $limit      Number of sites to limit the query to. Default 100.
 
462
 *     @type int       $offset     Exclude the first x sites. Used in combination with the $limit parameter. Default 0.
 
463
 * }
 
464
 * @return array An empty array if the install is considered "large" via wp_is_large_network(). Otherwise,
 
465
 *               an associative array of site data arrays, each containing the site (network) ID, blog ID,
 
466
 *               site domain and path, dates registered and modified, and the language ID. Also, boolean
 
467
 *               values for whether the site is public, archived, mature, spam, and/or deleted.
 
468
 */
 
469
function wp_get_sites( $args = array() ) {
 
470
        global $wpdb;
 
471
 
 
472
        _deprecated_function( __FUNCTION__, '4.6.0', 'get_sites()' );
 
473
 
 
474
        if ( wp_is_large_network() )
 
475
                return array();
 
476
 
 
477
        $defaults = array(
 
478
                'network_id' => $wpdb->siteid,
 
479
                'public'     => null,
 
480
                'archived'   => null,
 
481
                'mature'     => null,
 
482
                'spam'       => null,
 
483
                'deleted'    => null,
 
484
                'limit'      => 100,
 
485
                'offset'     => 0,
 
486
        );
 
487
 
 
488
        $args = wp_parse_args( $args, $defaults );
 
489
 
 
490
        // Backwards compatibility
 
491
        if( is_array( $args['network_id'] ) ){
 
492
                $args['network__in'] = $args['network_id'];
 
493
                $args['network_id'] = null;
 
494
        }
 
495
 
 
496
        if( is_numeric( $args['limit'] ) ){
 
497
                $args['number'] = $args['limit'];
 
498
                $args['limit'] = null;
 
499
        }
 
500
 
 
501
        // Make sure count is disabled.
 
502
        $args['count'] = false;
 
503
 
 
504
        $_sites  = get_sites( $args );
 
505
 
 
506
        $results = array();
 
507
 
 
508
        foreach ( $_sites as $_site ) {
 
509
                $_site = get_site( $_site );
 
510
                $results[] = $_site->to_array();
 
511
        }
 
512
 
 
513
        return $results;
 
514
}