Make WordPress Core


Ignore:
Timestamp:
10/29/2010 07:25:58 AM (16 years ago)
Author:
westi
Message:

More admin bar updates. See #14772 props filosofo.
Moves js out into seperate file.
Respects WP_SHOW_ADMIN_BAR.
Moved shortlink to top-level
Removed admin bar from non-multisite admin pages.
Set eol-style on new files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/admin-bar.php

    r16058 r16070  
    171171    global $wp_admin_bar;
    172172
    173     /* Add the Site Info menu */
    174     $wp_admin_bar->add_menu( array( 'id' => 'bloginfo', 'title' => __( 'Site Info' ), 'href' => '', ) );
    175 
    176     // TODO: Move this js out into a seperate file?
    177     $wp_admin_bar->add_menu( array( 'parent' => 'bloginfo', 'title' => __( 'Get Shortlink' ), 'href' => '', 'meta' => array(
    178             'onclick' => 'javascript:function wpcomshort() { var url=document.location;var links=document.getElementsByTagName('link');var found=0;for(var i = 0, l; l = links[i]; i++){if(l.getAttribute('rel')=='shortlink') {found=l.getAttribute('href');break;}}if (!found) {for (var i = 0; l = document.links[i]; i++) {if (l.getAttribute('rel') == 'shortlink') {found = l.getAttribute('href');break;}}}if (found) {prompt('' . esc_js( __( 'URL:' ) ) . '', found);} else {alert('' . esc_js( __( 'No shortlink available for this page.' ) ) . ''); } } wpcomshort(); return false;' ) ) );
     173    $wp_admin_bar->add_menu( array( 'id' => 'get-shortlink', 'title' => __( 'Get Shortlink' ), 'href' => '', ) );
    179174}
    180175
     
    209204    ?>
    210205    <style type="text/css" media="print">#wpadminbar { display:none; }</style>
    211     <script type="text/javascript">
    212     /*  <![CDATA[ */
    213     (function(d, w) {
    214         var init = function() {
    215             var b = d.getElementsByTagName('body')[0],
    216             aB = d.getElementById('wpadminbar'),
    217             s = d.getElementById('adminbar-search');
    218 
    219             if ( b && aB )
    220                 b.appendChild( aB );
    221 
    222             if ( s ) {
    223                 if ( '' == s.value )
    224                     s.value = s.getAttribute('title');
    225 
    226                 s.onblur = function() {
    227                     this.value = '' == this.value ? this.getAttribute('title') : this.value;
    228                 }
    229                 s.onfocus = function() {
    230                     this.value = this.getAttribute('title') == this.value ? '' : this.value;
    231                 }
    232             }
    233            
    234             if ( w.location.hash )
    235                 w.scrollBy(0,-32);
    236         }
    237 
    238         if ( w.addEventListener )
    239             w.addEventListener('load', init, false);
    240         else if ( w.attachEvent )
    241             w.attachEvent('onload', init);
    242 
    243     })(document, window);
    244     /*  ]]> */
    245     </script>
    246206    <?php
    247207}
     
    273233}
    274234
    275 add_action('wp_head', 'wp_admin_body_style');
    276 add_action('admin_head', 'wp_admin_body_style');
    277 
    278235/**
    279236 * Determine whether the admin bar should be showing.
     
    292249            $show_admin_bar = (bool) WP_SHOW_ADMIN_BAR;
    293250
    294         if ( ! is_user_logged_in() )
     251        if ( 
     252            ! is_user_logged_in() ||
     253            ( is_admin() && ! is_multisite() )
     254        )
    295255            $show_admin_bar = false;
    296256    }
Note: See TracChangeset for help on using the changeset viewer.