WordPress.org

Make WordPress Core

Ticket #14772: adminbarfixes.diff

File adminbarfixes.diff, 8.9 KB (added by markmcwilliams, 8 years ago)

blogs/sites and ms-* => /network/

  • admin-bar.php

     
    102102add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_my_account_menu', 20 );
    103103
    104104/**
    105  * Use the $wp_admin_bar global to add the "My Blogs/[Blog Name]" menu and all submenus.
     105 * Use the $wp_admin_bar global to add the "My Sites/[Site Name]" menu and all submenus.
    106106 */
    107107function wp_admin_bar_my_blogs_menu() {
    108108        global $wpdb, $wp_admin_bar;
     
    118118                }
    119119        }
    120120
    121         /* Add the 'My Dashboards' menu if the user has more than one blog. */
     121        /* Add the 'My Dashboards' menu if the user has more than one site. */
    122122        if ( count( $wp_admin_bar->user->blogs ) > 1 ) {
    123                 $wp_admin_bar->add_menu( array( 'id' => 'my-blogs', 'title' => __( 'My Blogs' ), 'href' => $wp_admin_bar->user->account_domain ) );
     123                $wp_admin_bar->add_menu( array( 'id' => 'my-blogs', 'title' => __( 'My Sites' ), 'href' => $wp_admin_bar->user->account_domain ) );
    124124
    125125                $default = includes_url('images/wpmini-blue.png');
    126126
     
    145145                                $wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-d', 'title' => __( 'Dashboard' ), 'href' => constant( 'PROTO' ) . $blogdomain . '/wp-admin/' ) );
    146146                                $wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-n', 'title' => __( 'New Post' ), 'href' => constant( 'PROTO' ) . $blogdomain . '/wp-admin/post-new.php' ) );
    147147                                // @todo, stats plugins should add this:
    148                                 //$wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-s', 'title' => __( 'Blog Stats' ), 'href' => constant( 'PROTO' ) . $blogdomain . '/wp-admin/index.php?page=stats' ) );
     148                                //$wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-s', 'title' => __( 'Site Stats' ), 'href' => constant( 'PROTO' ) . $blogdomain . '/wp-admin/index.php?page=stats' ) );
    149149                                $wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-c', 'title' => __( 'Manage Comments' ), 'href' => constant( 'PROTO' ) . $blogdomain . '/wp-admin/edit-comments.php' ) );
    150                                 $wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-v', 'title' => __( 'Read Blog' ), 'href' => constant( 'PROTO' ) . $blogdomain ) );
     150                                $wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-v', 'title' => __( 'Read Site' ), 'href' => constant( 'PROTO' ) . $blogdomain ) );
    151151                        }
    152152                        $counter++;
    153153                }
    154154
    155                 /* Add the "Manage Blogs" menu item */
    156                 // @todo, use dashboard blog.
    157                 $wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'manage-blogs', 'title' => __( 'Manage Blogs' ), admin_url('my-sites.php') ) );
     155                /* Add the "Manage Sites" menu item */
     156                // @todo, use dashboard site.
     157                $wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'manage-blogs', 'title' => __( 'Manage Sites' ), admin_url('my-sites.php') ) );
    158158
    159         /* Add the 'My Dashboard' menu if the user only has one blog. */
     159        /* Add the 'My Dashboard' menu if the user only has one site. */
    160160        } else {
    161161                $wp_admin_bar->add_menu( array( 'id' => 'my-blogs', 'title' => __( 'My Blog' ), 'href' => $wp_admin_bar->user->account_domain ) );
    162162
     
    165165                // @todo Stats plugins should add this.
    166166                //$wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'blog-1-s', 'title' => __( 'Blog Stats' ), 'href' => admin_ur;('index.php?page=stats') ) );
    167167                $wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'blog-1-c', 'title' => __( 'Manage Comments' ), 'href' => admin_url('edit-comments.php') ) );
    168                 $wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'blog-1-v', 'title' => __( 'Read Blog' ), 'href' => home_url() ) );
     168                $wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'blog-1-v', 'title' => __( 'Read Site' ), 'href' => home_url() ) );
    169169        }
    170170}
    171171add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_my_blogs_menu', 30 );
     
    181181
    182182        $default = includes_url('images/wpmini-blue.png');
    183183
    184         $wp_admin_bar->add_menu( array( 'id' => 'blog', 'title' => '<img class="avatar" src="' . $default . '" alt="' . __( 'Current blog avatar' ) . '" width="16" height="16" />', 'href' => home_url() ) );
     184        $wp_admin_bar->add_menu( array( 'id' => 'blog', 'title' => '<img class="avatar" src="' . $default . '" alt="' . __( 'Current site avatar' ) . '" width="16" height="16" />', 'href' => home_url() ) );
    185185}
    186186add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_blog_separator', 40 );
    187187
    188188/**
    189  * Use the $wp_admin_bar global to add a menu for blog info, accessable to all users.
     189 * Use the $wp_admin_bar global to add a menu for site info, accessable to all users.
    190190 */
    191191function wp_admin_bar_bloginfo_menu() {
    192192        global $wp_admin_bar;
     
    195195                return false;
    196196
    197197        /* Add the Blog Info menu */
    198         $wp_admin_bar->add_menu( array( 'id' => 'bloginfo', 'title' => __( 'Blog Info' ), 'href' => '' ) );
     198        $wp_admin_bar->add_menu( array( 'id' => 'bloginfo', 'title' => __( 'Site Info' ), 'href' => '' ) );
    199199
    200200        $wp_admin_bar->add_menu( array( 'parent' => 'bloginfo', 'title' => __( 'Get Shortlink' ), 'href' => '', 'meta' => array( 'onclick' => 'javascript:function wpcomshort() { var url=document.location;var links=document.getElementsByTagName(&#39;link&#39;);var found=0;for(var i = 0, l; l = links[i]; i++){if(l.getAttribute(&#39;rel&#39;)==&#39;shortlink&#39;) {found=l.getAttribute(&#39;href&#39;);break;}}if (!found) {for (var i = 0; l = document.links[i]; i++) {if (l.getAttribute(&#39;rel&#39;) == &#39;shortlink&#39;) {found = l.getAttribute(&#39;href&#39;);break;}}}if (found) {prompt(&#39;URL:&#39;, found);} else {alert(&#39;No shortlink available for this page&#39;); } return false; } wpcomshort();' ) ) );
    201201}
     
    343343}
    344344add_filter('locale', 'wp_admin_bar_lang');
    345345
    346 ?>
     346?>
     347 No newline at end of file
  • admin-bar/admin-bar-superadmin.php

     
    2929
    3030        wp_admin_bar_build_snackmenu();
    3131
    32         /* Get the settings we need for the current blog */
     32        /* Get the settings we need for the current site */
    3333        $matureaction = $current_blog->mature ? 'unmatureblog' : 'matureblog';
    3434        $maturetext = $current_blog->mature ? esc_attr__('Unmark as mature') : esc_attr__('Mark as mature');
    35         $suspendtext = $current_blog->spam ? esc_attr('Unsuspend blog') : esc_attr('Suspend blog');
     35        $suspendtext = $current_blog->spam ? esc_attr('Unsuspend site') : esc_attr('Suspend site');
    3636        $suspendaction = $current_blog->spam ? 'unspamblog' : 'spamblog';
    37         $mature_url = admin_url( "ms-edit.php?action=confirm&amp;action2={$matureaction}&amp;id={$current_blog->blog_id}&amp;msg=" . urlencode( 'Are you sure you want to ' . strtolower( $maturetext ) . " {$current_blog->domain} as mature?" ) );
    38         $suspend_url = admin_url( "ms-edit.php?action=confirm&amp;action2={$suspendaction}&amp;id={$current_blog->blog_id}&amp;msg=" . urlencode( 'Are you sure you want to ' . strtolower( $suspendtext ) . " {$current_blog->domain} ?" ) );
     37        $mature_url = network_admin_url( "edit.php?action=confirm&amp;action2={$matureaction}&amp;id={$current_blog->blog_id}&amp;msg=" . urlencode( 'Are you sure you want to ' . strtolower( $maturetext ) . " {$current_blog->domain} as mature?" ) );
     38        $suspend_url = network_admin_url( "edit.php?action=confirm&amp;action2={$suspendaction}&amp;id={$current_blog->blog_id}&amp;msg=" . urlencode( 'Are you sure you want to ' . strtolower( $suspendtext ) . " {$current_blog->domain} ?" ) );
    3939
    4040        /* Add the submenu items to the Super Admin menu */
    41         $wp_admin_bar->add_menu( array( 'parent' => 'superadmin', 'title' => __( 'Blog Dashboard' ), 'href' => admin_url(), 'position' => 10 ) );
    42         $wp_admin_bar->add_menu( array( 'parent' => 'superadmin', 'title' => __( 'Blog Options' ),  'href' => admin_url( "ms-sites.php?action=blogs&amp;searchaction=id&amp;s={$current_blog->blog_id}" ), 'position' => 30 ) );
     41        $wp_admin_bar->add_menu( array( 'parent' => 'superadmin', 'title' => __( 'Site Dashboard' ), 'href' => network_admin_url(), 'position' => 10 ) );
     42        $wp_admin_bar->add_menu( array( 'parent' => 'superadmin', 'title' => __( 'Site Options' ),  'href' => network_admin_url( "sites.php?action=blogs&amp;searchaction=id&amp;s={$current_blog->blog_id}" ), 'position' => 30 ) );
    4343        $wp_admin_bar->add_menu( array( 'parent' => 'superadmin', 'title' => "$maturetext", 'href' => $mature_url, 'position' => 50 ) );
    4444        $wp_admin_bar->add_menu( array( 'parent' => 'superadmin', 'title' => "$suspendtext", 'href' => $suspend_url, 'position' => 80 ) );
    4545}
     
    153153        return (object) $stats;
    154154}
    155155
    156 ?>
     156?>
     157 No newline at end of file