*/
class AP_Adblock_Detector_Admin {
/**
* The ID of this plugin.
*
* @since 1.0.0
* @access private
* @var string $plugin_name The ID of this plugin.
*/
private $plugin_name;
/**
* The version of this plugin.
*
* @since 1.0.0
* @access private
* @var string $version The current version of this plugin.
*/
private $version;
/**
* Initialize the class and set its properties.
*
* @since 1.0.0
* @param string $plugin_name The name of this plugin.
* @param string $version The version of this plugin.
*/
public function __construct( $plugin_name, $version ) {
$this->plugin_name = $plugin_name;
$this->version = $version;
}
/**
* Register the stylesheets for the admin area.
*
* @since 1.0.0
*/
public function enqueue_styles() {
/**
* This function is provided for demonstration purposes only.
*
* An instance of this class should be passed to the run() function
* defined in AP_Adblock_Detector_Loader as all of the hooks are defined
* in that particular class.
*
* The AP_Adblock_Detector_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/
wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/ap-adblock-detector-admin.css', array(), $this->version, 'all' );
}
/**
* Register the JavaScript for the admin area.
*
* @since 1.0.0
*/
public function enqueue_scripts() {
/**
* This function is provided for demonstration purposes only.
*
* An instance of this class should be passed to the run() function
* defined in AP_Adblock_Detector_Loader as all of the hooks are defined
* in that particular class.
*
* The AP_Adblock_Detector_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/
wp_enqueue_script( 'excanvas', plugin_dir_url( __FILE__ ) . 'js/excanvas.js' );
wp_script_add_data( 'excanvas', 'conditional', 'lt IE 9' );
wp_enqueue_script( 'jquery-ui-datepicker' );
wp_enqueue_style( 'jquery-style', plugin_dir_url( __FILE__ ) . 'css/jquery-ui-themes/smoothness/jquery-ui.min.css' );
wp_enqueue_style( 'jquery-jqplot', plugin_dir_url( __FILE__ ) . 'css/jquery.jqplot.min.css' );
wp_enqueue_script( 'jquery-jqplot', plugin_dir_url( __FILE__ ) . 'js/jquery.jqplot.min.js' );
wp_enqueue_script( 'jqplot-dateAxisRenderer', plugin_dir_url( __FILE__ ) . 'js/jqplot.dateAxisRenderer.js' );
wp_enqueue_script( 'jqplot-canvasTextRenderer', plugin_dir_url( __FILE__ ) . 'js/jqplot.canvasTextRenderer.js' );
wp_enqueue_script( 'jqplot-canvasAxisLabelRenderer', plugin_dir_url( __FILE__ ) . 'js/jqplot.canvasAxisLabelRenderer.js' );
wp_enqueue_script( 'jqplot-highlighter', plugin_dir_url( __FILE__ ) . 'js/jqplot.highlighter.js' );
wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/ap-adblock-detector-admin.js', array( 'jquery' ), $this->version, false );
wp_localize_script( $this->plugin_name, 'ap_adblock_detector', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
}
/**
* Register the plugin's settings menu.
*
* @since 1.0.0
*/
public function register_options_menu() {
add_menu_page( 'AdBlock Detector', 'AdBlock Detector', 'manage_options', 'ap-adblock-detector', array($this, 'render_stats_page'), 'dashicons-chart-line', 80 );
//add_submenu_page( 'ap-adblock-detector', 'Statistics - AdBlock Detector', 'Statistics', 'manage_options', 'ap-adblock-detector', array($this, 'render_stats_page') );
//add_submenu_page( 'ap-adblock-detector', 'Settings - AdBlock Detector', 'Settings', 'manage_options', 'ap-adblock-detector-settings', array($this, 'render_settings_page') );
}
public function render_stats_page() {
?>
prefix . "ap_adblock_detector_log` WHERE (`timestamp` >= NOW() - INTERVAL 24 HOUR)) as 'last24hours', " .
"(SELECT COUNT(*) FROM `" . $wpdb->prefix . "ap_adblock_detector_log` WHERE (`timestamp` >= NOW() - INTERVAL 7 DAY)) as 'last7days', " .
"(SELECT COUNT(*) FROM `" . $wpdb->prefix . "ap_adblock_detector_log` WHERE (`timestamp` >= NOW() - INTERVAL 30 DAY)) as 'last30days', " .
"(SELECT COUNT(*) FROM `" . $wpdb->prefix . "ap_adblock_detector_log`) as 'total'";
$results = $wpdb->get_row( $query );
if($results) {
echo '
';
echo '
' . __( 'Statistics : Pageviews affected by Ad Blocker', 'ap-adblock-detector') . '
';
echo __( 'The graph below will give you stats about the total number of pageviews from your visitors with any AdBlocker enabled.', 'ap-adblock-detector' );
echo '