WordPress.org

Make WordPress Core

Changeset 32630


Ignore:
Timestamp:
05/27/2015 11:13:04 PM (6 years ago)
Author:
jeremyfelt
Message:

Use site objects rather than get_blog_status() in MS list tables.

Removes several repetitive calls to get_blog_status() that are not needed, as the data is already available as part of each site's object.

Fixes #32512.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-ms-sites-list-table.php

    r32472 r32630  
    215215            $blog_states = array();
    216216            foreach ( $status_list as $status => $col ) {
    217                 if ( get_blog_status( $blog['blog_id'], $status ) == 1 ) {
     217                if ( $blog[ $status ] == 1 ) {
    218218                    $class = " class='{$col[0]}'";
    219219                    $blog_states[] = $col[1];
     
    284284                            $actions['backend'] = "<span class='backend'><a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a></span>';
    285285                            if ( get_current_site()->blog_id != $blog['blog_id'] ) {
    286                                 if ( get_blog_status( $blog['blog_id'], 'deleted' ) == '1' )
    287                                     $actions['activate']    = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=activateblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to activate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Activate' ) . '</a></span>';
    288                                 else
    289                                     $actions['deactivate']  = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=deactivateblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to deactivate the site %s' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Deactivate' ) . '</a></span>';
    290 
    291                                 if ( get_blog_status( $blog['blog_id'], 'archived' ) == '1' )
    292                                     $actions['unarchive']   = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=unarchiveblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to unarchive the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Unarchive' ) . '</a></span>';
    293                                 else
    294                                     $actions['archive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=archiveblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to archive the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . _x( 'Archive', 'verb; site' ) . '</a></span>';
    295 
    296                                 if ( get_blog_status( $blog['blog_id'], 'spam' ) == '1' )
    297                                     $actions['unspam']  = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=unspamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to unspam the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . _x( 'Not Spam', 'site' ) . '</a></span>';
    298                                 else
    299                                     $actions['spam']    = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=spamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to mark the site %s as spam.' ), $blogname ) ) ), 'confirm') ) . '">' . _x( 'Spam', 'site' ) . '</a></span>';
    300 
    301                                 if ( current_user_can( 'delete_site', $blog['blog_id'] ) )
    302                                     $actions['delete']  = '<span class="delete"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=deleteblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to delete the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Delete' ) . '</a></span>';
     286                                if ( $blog['deleted'] == '1' ) {
     287                                    $actions['activate']   = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=activateblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to activate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Activate' ) . '</a></span>';
     288                                } else {
     289                                    $actions['deactivate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=deactivateblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to deactivate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Deactivate' ) . '</a></span>';
     290                                }
     291
     292                                if ( $blog['archived'] == '1' ) {
     293                                    $actions['unarchive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=unarchiveblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to unarchive the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Unarchive' ) . '</a></span>';
     294                                } else {
     295                                    $actions['archive']   = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=archiveblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to archive the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . _x( 'Archive', 'verb; site' ) . '</a></span>';
     296                                }
     297
     298                                if ( $blog['spam'] == '1' ) {
     299                                    $actions['unspam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=unspamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to unspam the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . _x( 'Not Spam', 'site' ) . '</a></span>';
     300                                } else {
     301                                    $actions['spam']   = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=spamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to mark the site %s as spam.' ), $blogname ) ) ), 'confirm' ) ) . '">' . _x( 'Spam', 'site' ) . '</a></span>';
     302                                }
     303
     304                                if ( current_user_can( 'delete_site', $blog['blog_id'] ) ) {
     305                                    $actions['delete'] = '<span class="delete"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=deleteblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to delete the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Delete' ) . '</a></span>';
     306                                }
    303307                            }
    304308
  • trunk/src/wp-admin/includes/class-wp-ms-users-list-table.php

    r31833 r32630  
    253253
    254254                                    $class = '';
    255                                     if ( get_blog_status( $val->userblog_id, 'spam' ) == 1 )
     255                                    if ( $val->spam == 1 ) {
    256256                                        $class .= 'site-spammed ';
    257                                     if ( get_blog_status( $val->userblog_id, 'mature' ) == 1 )
     257                                    }
     258                                    if ( $val->mature == 1 ) {
    258259                                        $class .= 'site-mature ';
    259                                     if ( get_blog_status( $val->userblog_id, 'deleted' ) == 1 )
     260                                    }
     261                                    if ( $val->deleted == 1 ) {
    260262                                        $class .= 'site-deleted ';
    261                                     if ( get_blog_status( $val->userblog_id, 'archived' ) == 1 )
     263                                    }
     264                                    if ( $val->archived == 1 ) {
    262265                                        $class .= 'site-archived ';
     266                                    }
    263267
    264268                                    $actions['view'] = '<a class="' . $class . '" href="' . esc_url( get_home_url( $val->userblog_id ) ) . '">' . __( 'View' ) . '</a>';
  • trunk/src/wp-includes/user.php

    r32626 r32630  
    11771177                'siteurl'     => $blog->siteurl,
    11781178                'archived'    => $blog->archived,
     1179                'mature'      => $blog->mature,
    11791180                'spam'        => $blog->spam,
    11801181                'deleted'     => $blog->deleted,
     
    12061207                'siteurl'     => $blog->siteurl,
    12071208                'archived'    => $blog->archived,
     1209                'mature'      => $blog->mature,
    12081210                'spam'        => $blog->spam,
    12091211                'deleted'     => $blog->deleted,
Note: See TracChangeset for help on using the changeset viewer.