mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@16070 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -170,12 +170,7 @@ function wp_admin_bar_blog_separator() {
|
||||
function wp_admin_bar_bloginfo_menu() {
|
||||
global $wp_admin_bar;
|
||||
|
||||
/* Add the Site Info menu */
|
||||
$wp_admin_bar->add_menu( array( 'id' => 'bloginfo', 'title' => __( 'Site Info' ), 'href' => '', ) );
|
||||
|
||||
// TODO: Move this js out into a seperate file?
|
||||
$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('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;' ) ) );
|
||||
$wp_admin_bar->add_menu( array( 'id' => 'get-shortlink', 'title' => __( 'Get Shortlink' ), 'href' => '', ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -208,41 +203,6 @@ function wp_admin_bar_edit_menu() {
|
||||
function wp_admin_bar_header() {
|
||||
?>
|
||||
<style type="text/css" media="print">#wpadminbar { display:none; }</style>
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
(function(d, w) {
|
||||
var init = function() {
|
||||
var b = d.getElementsByTagName('body')[0],
|
||||
aB = d.getElementById('wpadminbar'),
|
||||
s = d.getElementById('adminbar-search');
|
||||
|
||||
if ( b && aB )
|
||||
b.appendChild( aB );
|
||||
|
||||
if ( s ) {
|
||||
if ( '' == s.value )
|
||||
s.value = s.getAttribute('title');
|
||||
|
||||
s.onblur = function() {
|
||||
this.value = '' == this.value ? this.getAttribute('title') : this.value;
|
||||
}
|
||||
s.onfocus = function() {
|
||||
this.value = this.getAttribute('title') == this.value ? '' : this.value;
|
||||
}
|
||||
}
|
||||
|
||||
if ( w.location.hash )
|
||||
w.scrollBy(0,-32);
|
||||
}
|
||||
|
||||
if ( w.addEventListener )
|
||||
w.addEventListener('load', init, false);
|
||||
else if ( w.attachEvent )
|
||||
w.attachEvent('onload', init);
|
||||
|
||||
})(document, window);
|
||||
/* ]]> */
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
@@ -272,9 +232,6 @@ function wp_admin_body_style() {
|
||||
<?php
|
||||
}
|
||||
|
||||
add_action('wp_head', 'wp_admin_body_style');
|
||||
add_action('admin_head', 'wp_admin_body_style');
|
||||
|
||||
/**
|
||||
* Determine whether the admin bar should be showing.
|
||||
*
|
||||
@@ -291,7 +248,10 @@ function is_admin_bar_showing() {
|
||||
if ( defined('WP_SHOW_ADMIN_BAR') )
|
||||
$show_admin_bar = (bool) WP_SHOW_ADMIN_BAR;
|
||||
|
||||
if ( ! is_user_logged_in() )
|
||||
if (
|
||||
! is_user_logged_in() ||
|
||||
( is_admin() && ! is_multisite() )
|
||||
)
|
||||
$show_admin_bar = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user