public_html/wp-content/plugins/wp-statistics/wp-statistics.php
// This function adds the admin bar menu if the user has selected it.
This function adds the admin bar menu if the user has selected it.
This function adds the admin bar menu if the user has selected it .
function wp_statistics_menubar() {
		GLOBAL $wp_admin_bar, $wp_version, $WP_Statistics;
		$read = current_user_can( wp_statistics_validate_capability( $WP_Statistics->get_option('read_capability', 'manage_options') ) );
		$manage = current_user_can( wp_statistics_validate_capability( $WP_Statistics->get_option('manage_capability', 'manage_options') ) );
		if( is_admin_bar_showing() && ( $read || $manage ) ) {
			$AdminURL = get_admin_url();
			if( version_compare( $wp_version, '3.8-RC', '>=' ) || version_compare( $wp_version, '3.8', '>=' ) ) {
				$wp_admin_bar->add_menu( array(
					'id'		=>	'wp-statistic-menu',
					'title'		=>	'<span class="ab-icon"></span>',
					'href'		=>	$AdminURL . 'admin.php?page=' . WP_STATISTICS_OVERVIEW_PAGE
				));
			} else {
				$wp_admin_bar->add_menu( array(
					'id'		=>	'wp-statistic-menu',
					'title'		=>	'<img src="'.plugin_dir_url(__FILE__).'/assets/images/icon.png"/>',
					'href'		=>	$AdminURL . 'admin.php?page=' . WP_STATISTICS_OVERVIEW_PAGE
				));
			}
			$wp_admin_bar->add_menu( array(
				'id'		=> 	'wp-statistics-menu-useronline',
				'parent'	=>	'wp-statistic-menu',
				'title'		=>	__('User Online', 'wp_statistics') . ": " . wp_statistics_useronline(),
				'href'		=>  $AdminURL . 'admin.php?page=' . WP_STATISTICS_ONLINE_PAGE
			));
			$wp_admin_bar->add_menu( array(
				'id'		=> 	'wp-statistics-menu-todayvisitor',
				'parent'	=>	'wp-statistic-menu',
				'title'		=>	__('Today visitor', 'wp_statistics') . ": " . wp_statistics_visitor('today')
			));
			$wp_admin_bar->add_menu( array(
				'id'		=> 	'wp-statistics-menu-todayvisit',
				'parent'	=>	'wp-statistic-menu',
				'title'		=>	__('Today visit', 'wp_statistics') . ": " . wp_statistics_visit('today')
			));
			$wp_admin_bar->add_menu( array(
				'id'		=> 	'wp-statistics-menu-yesterdayvisitor',
				'parent'	=>	'wp-statistic-menu',
				'title'		=>	__('Yesterday visitor', 'wp_statistics') . ": " . wp_statistics_visitor('yesterday')
			));
			$wp_admin_bar->add_menu( array(
				'id'		=> 	'wp-statistics-menu-yesterdayvisit',
				'parent'	=>	'wp-statistic-menu',
				'title'		=>	__('Yesterday visit', 'wp_statistics') . ": " . wp_statistics_visit('yesterday')
			));
			$wp_admin_bar->add_menu( array(
				'id'		=> 	'wp-statistics-menu-viewstats',
				'parent'	=>	'wp-statistic-menu',
				'title'		=>	__('View Stats', 'wp_statistics'),
				'href'		=>	$AdminURL . 'admin.php?page=' . WP_STATISTICS_OVERVIEW_PAGE
			));
		}
	}
function wp_statistics_menubar ( ) { GLOBAL $ wp_admin_bar , $ wp_version , $ WP_Statistics ; $ read = current_user_can ( wp_statistics_validate_capability ( $ WP_Statistics -> get_option ( 'read_capability' , 'manage_options' ) ) ) ; $ manage = current_user_can ( wp_statistics_validate_capability ( $ WP_Statistics -> get_option ( 'manage_capability' , 'manage_options' ) ) ) ; if ( is_admin_bar_showing ( ) && ( $ read || $ manage ) ) { $ AdminURL = get_admin_url ( ) ; if ( version_compare ( $ wp_version , '3.8-RC' , '>=' ) || version_compare ( $ wp_version , '3.8' , '>=' ) ) { $ wp_admin_bar -> add_menu ( array ( 'id' => 'wp-statistic-menu' , 'title' => '<span class="ab-icon"></span>' , 'href' => $ AdminURL . 'admin.php?page=' . WP_STATISTICS_OVERVIEW_PAGE ) ) ; } else { $ wp_admin_bar -> add_menu ( array ( 'id' => 'wp-statistic-menu' , 'title' => '<img src="' . plugin_dir_url ( __FILE__ ) . '/assets/images/icon.png"/>' , 'href' => $ AdminURL . 'admin.php?page=' . WP_STATISTICS_OVERVIEW_PAGE ) ) ; } $ wp_admin_bar -> add_menu ( array ( 'id' => 'wp-statistics-menu-useronline' , 'parent' => 'wp-statistic-menu' , 'title' => __ ( 'User Online' , 'wp_statistics' ) . " :  " . wp_statistics_useronline ( ) , 'href' => $ AdminURL . 'admin.php?page=' . WP_STATISTICS_ONLINE_PAGE ) ) ; $ wp_admin_bar -> add_menu ( array ( 'id' => 'wp-statistics-menu-todayvisitor' , 'parent' => 'wp-statistic-menu' , 'title' => __ ( 'Today visitor' , 'wp_statistics' ) . " :  " . wp_statistics_visitor ( 'today' ) ) ) ; $ wp_admin_bar -> add_menu ( array ( 'id' => 'wp-statistics-menu-todayvisit' , 'parent' => 'wp-statistic-menu' , 'title' => __ ( 'Today visit' , 'wp_statistics' ) . " :  " . wp_statistics_visit ( 'today' ) ) ) ; $ wp_admin_bar -> add_menu ( array ( 'id' => 'wp-statistics-menu-yesterdayvisitor' , 'parent' => 'wp-statistic-menu' , 'title' => __ ( 'Yesterday visitor' , 'wp_statistics' ) . " :  " . wp_statistics_visitor ( 'yesterday' ) ) ) ; $ wp_admin_bar -> add_menu ( array ( 'id' => 'wp-statistics-menu-yesterdayvisit' , 'parent' => 'wp-statistic-menu' , 'title' => __ ( 'Yesterday visit' , 'wp_statistics' ) . " :  " . wp_statistics_visit ( 'yesterday' ) ) ) ; $ wp_admin_bar -> add_menu ( array ( 'id' => 'wp-statistics-menu-viewstats' , 'parent' => 'wp-statistic-menu' , 'title' => __ ( 'View Stats' , 'wp_statistics' ) , 'href' => $ AdminURL . 'admin.php?page=' . WP_STATISTICS_OVERVIEW_PAGE ) ) ; } }
This function adds the admin bar menu if the user has selected it.
This function adds the admin bar menu if the user has selected it .
// Find out if the user can read or manage statistics.