stats_admin_bar_menu

Stats AdminBar.

Description

stats_admin_bar_menu( &$wp_admin_bar ); 

Parameters (1)

0. $wp_admin_bar
The wp admin bar.

Usage

  1. if ( !function_exists( 'stats_admin_bar_menu' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'jetpack-by-wordpress-com/modules/stats.php'; 
  3.  
  4. // The wp admin bar. 
  5. $wp_admin_bar = &$wp_admin_bar; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = stats_admin_bar_menu($wp_admin_bar); 
  9.  

Defined (1)

The function is defined in the following location(s).

/modules/stats.php  
  1. function stats_admin_bar_menu( &$wp_admin_bar ) { 
  2. $url = add_query_arg( 'page', 'stats', admin_url( 'admin.php' ) ); // no menu_page_url() blog-side. 
  3.  
  4. $img_src = esc_attr( add_query_arg( array( 'noheader'=>'', 'proxy'=>'', 'chart'=>'admin-bar-hours-scale' ), $url ) ); 
  5. $img_src_2x = esc_attr( add_query_arg( array( 'noheader'=>'', 'proxy'=>'', 'chart'=>'admin-bar-hours-scale-2x' ), $url ) ); 
  6.  
  7. $alt = esc_attr( __( 'Stats', jetpack ) ); 
  8.  
  9. $title = esc_attr( __( 'Views over 48 hours. Click for more Site Stats.', jetpack ) ); 
  10.  
  11. $menu = array( 'id' => 'stats', 'title' => "<div><script type='text/javascript'>var src;if(typeof(window.devicePixelRatio)=='undefined'||window.devicePixelRatio<2) {src='$img_src';}else{src='$img_src_2x';}document.write('<img src=\''+src+'\' alt=\'$alt\' title=\'$title\' />');</script></div>", 'href' => $url ); 
  12.  
  13. $wp_admin_bar->add_menu( $menu );