item-reports.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Author: ExactMetrics team
  4. * Author URI: https://exactmetrics.com
  5. * Copyright 2018 ExactMetrics team
  6. * License: GPLv2 or later
  7. * License URI: http://www.gnu.org/licenses/gpl-2.0.html
  8. */
  9. // Exit if accessed directly
  10. if ( ! defined( 'ABSPATH' ) )
  11. exit();
  12. if ( ! class_exists( 'GADWP_Frontend_Item_Reports' ) ) {
  13. final class GADWP_Frontend_Item_Reports {
  14. private $gadwp;
  15. public function __construct() {
  16. $this->gadwp = GADWP();
  17. add_action( 'admin_bar_menu', array( $this, 'custom_adminbar_node' ), 999 );
  18. }
  19. function custom_adminbar_node( $wp_admin_bar ) {
  20. if ( GADWP_Tools::check_roles( $this->gadwp->config->options['access_front'] ) && $this->gadwp->config->options['frontend_item_reports'] ) {
  21. /* @formatter:off */
  22. $args = array( 'id' => 'gadwp-1',
  23. 'title' => '<span class="ab-icon"></span><span class="">' . __( "Analytics", 'google-analytics-dashboard-for-wp' ) . '</span>',
  24. 'href' => '#1',
  25. );
  26. /* @formatter:on */
  27. $wp_admin_bar->add_node( $args );
  28. }
  29. }
  30. }
  31. }