*/ class Advanced_Visit_Counter_Admin extends Advanced_Visit_Counter_Queries { /** * The ID of this plugin. * * @var string $plugin_name The ID of this plugin. * @since 3.0.1 * @access private */ private $plugin_name ; /** * The version of this plugin. * * @var string $version The current version of this plugin. * @since 3.0.1 * @access private */ private $version ; public $transients = array( 'apvc_yearly_data', 'apvc_monthly_data', 'apvc_weekly_data', 'apvc_daily_data', 'apvc_browser_traffic_stats_data', 'apvc_browser_traffic_data', 'apvc_ref_traffic_data', 'apvc_os_data', 'apvc_orders_total', 'apvc_total_orders_data', 'apvc_total_products_sales', 'apvc_mvp_month_data', 'apvc_mvp_daily_data', 'apvc_fv_30_td', 'apvc_fv_30_past', 'apvc_fv_td', 'apvc_fv_past', 'apvc_get_visitors_mn_data', 'apvc_get_visitors_data', 'apvc_pvp_30_data', 'apvc_pvp_ip_30_data', 'apvc_pvp_daily_data', 'apvc_pvp_ip_daily_data', 'apvc_get_visit_stats' ) ; /** * Initialize the class and set its properties. * * @param string $plugin_name The name of this plugin. * @param string $version The version of this plugin. * * @since 3.0.1 */ public function __construct( $plugin_name, $version ) { $this->plugin_name = $plugin_name; $this->version = $version; } /** * Register the stylesheets for the admin area. * * @since 3.0.1 */ 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 Advanced_Visit_Counter_Loader as all of the hooks are defined * in that particular class. * * The Advanced_Visit_Counter_Loader will then create the relationship * between the defined hooks and the functions defined in this * class. */ if ( isset( $_GET['page'] ) && ($_GET['page'] === 'apvc-dashboard-page' || $_GET['page'] === 'apvc-smart-notifications-page') ) { wp_enqueue_style( 'apvc_material_icons', plugin_dir_url( __FILE__ ) . 'css/mdi/css/materialdesignicons.min.css', array(), $this->version, 'all' ); wp_enqueue_style( 'apvc_base', plugin_dir_url( __FILE__ ) . 'css/vendor.bundle.base.css', array(), $this->version, 'all' ); wp_enqueue_style( 'apvc_base', plugin_dir_url( __FILE__ ) . 'css/vendor.bundle.base.css', array(), $this->version, 'all' ); wp_enqueue_style( 'apvc_dataTables_bootstrap4', plugin_dir_url( __FILE__ ) . 'assets/datatables/dataTables.bootstrap4.css', array(), $this->version, 'all' ); wp_enqueue_style( 'apvc_icheck', plugin_dir_url( __FILE__ ) . 'css/icheck/all.css', array(), $this->version, 'all' ); wp_enqueue_style( 'apvc_select', plugin_dir_url( __FILE__ ) . 'css/select2.min.css', array(), $this->version, 'all' ); wp_enqueue_style( 'apvc_tags', plugin_dir_url( __FILE__ ) . 'css/jquery.tagsinput.min.css', array(), $this->version, 'all' ); wp_enqueue_style( 'apvc_colorPicker', plugin_dir_url( __FILE__ ) . 'css/asColorPicker.min.css', array(), $this->version, 'all' ); wp_enqueue_style( 'apvc_style_base', plugin_dir_url( __FILE__ ) . 'css/style.css', array(), filemtime( plugin_dir_path( __FILE__ ) . 'css/style.css' ), 'all' ); wp_enqueue_style( 'apvc_style_main', plugin_dir_url( __FILE__ ) . 'css/main/style.css', array(), filemtime( plugin_dir_path( __FILE__ ) . 'css/main/style.css' ), 'all' ); wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/advanced-page-visit-counter-admin.css', array(), filemtime( plugin_dir_path( __FILE__ ) . 'css/advanced-page-visit-counter-admin.css' ), 'all' ); } } /** * Register the JavaScript for the admin area. * * @since 3.0.1 */ public function enqueue_scripts() { global $wpdb ; /** * This function is provided for demonstration purposes only. * * An instance of this class should be passed to the run() function * defined in Advanced_Visit_Counter_Loader as all of the hooks are defined * in that particular class. * * The Advanced_Visit_Counter_Loader will then create the relationship * between the defined hooks and the functions defined in this * class. */ wp_enqueue_script( 'apvc-menu', plugin_dir_url( __FILE__ ) . 'js/apvc-menu.js', array( 'jquery' ), filemtime( plugin_dir_path( __FILE__ ) . 'js/apvc-menu.js' ), true ); if ( isset( $_GET['page'] ) && ($_GET['page'] === 'apvc-dashboard-page' || $_GET['page'] === 'apvc-smart-notifications-page') ) { wp_enqueue_script( 'apvc_js_base', plugin_dir_url( __FILE__ ) . 'js/vendor.bundle.base.js', array( 'jquery' ), $this->version, false ); wp_enqueue_script( 'apvc_chart_js', plugin_dir_url( __FILE__ ) . 'js/Chart.min.js', array( 'jquery' ), $this->version, false ); wp_enqueue_script( 'apvc_datatables_js', plugin_dir_url( __FILE__ ) . 'js/jquery.dataTables.js', array( 'jquery' ), $this->version, false ); wp_enqueue_script( 'apvc_datatables4_js', plugin_dir_url( __FILE__ ) . 'assets/datatables/dataTables.bootstrap4.js', array( 'jquery' ), $this->version, false ); wp_enqueue_script( 'apvc_hover_js', plugin_dir_url( __FILE__ ) . 'js/hoverable-collapse.js', array( 'jquery' ), $this->version, false ); wp_enqueue_script( 'apvc_misc_js', plugin_dir_url( __FILE__ ) . 'js/misc.js', array( 'jquery' ), $this->version, false ); wp_enqueue_script( 'apvc_settings_js', plugin_dir_url( __FILE__ ) . 'js/settings.js', array( 'jquery' ), $this->version, false ); wp_enqueue_script( 'apvc_icheck_js', plugin_dir_url( __FILE__ ) . 'js/icheck.min.js', array( 'jquery' ), $this->version, false ); wp_enqueue_script( 'apvc_select_js', plugin_dir_url( __FILE__ ) . 'js/select2.min.js', array( 'jquery' ), $this->version, false ); wp_enqueue_script( 'apvc_alert_js', plugin_dir_url( __FILE__ ) . 'js/sweetalert.min.js', array( 'jquery' ), $this->version, false ); wp_enqueue_script( 'apvc_asColor_js', plugin_dir_url( __FILE__ ) . 'js/jquery-asColor.min.js', array( 'jquery' ), $this->version, false ); wp_enqueue_script( 'apvc_color_picker_js', plugin_dir_url( __FILE__ ) . 'js/jquery-asColorPicker.min.js', array( 'jquery' ), $this->version, false ); wp_enqueue_script( 'apvc_tags_js', plugin_dir_url( __FILE__ ) . 'js/jquery.tagsinput.min.js', array( 'jquery' ), $this->version, false ); wp_enqueue_script( 'apvc_dashboard_js', plugin_dir_url( __FILE__ ) . 'js/dashboard.js', array( 'jquery' ), filemtime( plugin_dir_path( __FILE__ ) . 'js/dashboard.js' ), false ); wp_enqueue_script( 'apvc_script_js', plugin_dir_url( __FILE__ ) . 'js/script.js', array( 'jquery' ), filemtime( plugin_dir_path( __FILE__ ) . 'js/script.js' ), false ); wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/advanced-page-visit-counter-admin.js', array( 'jquery' ), filemtime( plugin_dir_path( __FILE__ ) . 'js/advanced-page-visit-counter-admin.js' ), true ); $translations = array( 'search_lable' => __( 'Search By :', 'advanced-page-visit-counter' ), 'shortcode_copied' => __( 'Shortcode Copied to clipboard.', 'advanced-page-visit-counter' ), 'import_completed' => __( 'Data Imported successfully.', 'advanced-page-visit-counter' ), 'import_failed' => __( 'File format is not supported.', 'advanced-page-visit-counter' ), 'shortcode_delete' => __( 'Shortcode Deleted successfully.', 'advanced-page-visit-counter' ), 'file_delete' => __( 'File Deleted successfully.', 'advanced-page-visit-counter' ), 'success' => __( 'Success', 'advanced-page-visit-counter' ), 'failed' => __( 'Failed', 'advanced-page-visit-counter' ), 'are_you_sure' => __( 'Are you sure?', 'advanced-page-visit-counter' ), 'are_you_sure_text' => __( "You won't be able to revert this!", 'advanced-page-visit-counter' ), 'cancel_btn' => __( 'Cancel', 'advanced-page-visit-counter' ), 'okay_btn' => __( 'OK', 'advanced-page-visit-counter' ), 'confirm_btn' => __( 'Great ', 'advanced-page-visit-counter' ), 'valid_date' => __( 'Please select valid date range.', 'advanced-page-visit-counter' ), 'valid_file' => __( 'Please upload valid file. (xls,xlsx,csv)', 'advanced-page-visit-counter' ), 'date_warning' => __( 'Please enter valid date.', 'advanced-page-visit-counter' ), 'data_warning' => __( 'Please enter valid data.', 'advanced-page-visit-counter' ), 'open' => __( 'Open', 'advanced-page-visit-counter' ), 'export_completed' => __( 'File Export Completed', 'advanced-page-visit-counter' ), 'shortcode_save' => __( 'Please Enter Shortcode Name', 'advanced-page-visit-counter' ), 'cleanup_completed' => __( 'Clean Up Process Completed', 'advanced-page-visit-counter' ), 'refresh_dashboard' => __( 'Dashboard is reloading now...', 'advanced-page-visit-counter' ), ); $table = APVC_DATA_TABLE; $sYear = $wpdb->get_var( "SELECT YEAR(date) FROM {$table} ORDER BY date ASC LIMIT 1" ); $eYear = date( 'Y' ); wp_localize_script( $this->plugin_name, 'apvc_ajax', array_merge( array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'apvc_url' => 'https://pagevisitcounter.com/', 'search_lable' => __( 'Search By :', 'advanced-page-visit-counter' ), 'admin_d_url' => admin_url( 'admin.php?page=apvc-dashboard-page' ), 'post_url' => get_home_url() . '/?p=', 'ap_rest_url' => get_rest_url(), 'wp_rest' => wp_create_nonce( 'wp_rest' ), 'security_nonce' => wp_create_nonce( 'security_nonce' ), 'show_in_k' => get_option( 'numbers_in_k' ), 'fl_warning' => __( 'Something went wrong! Please reload your browser and try again.', 'advanced-page-visit-counter' ), ), $translations ) ); wp_localize_script( 'apvc_script_js', 'apvc_translation', $translations ); } } /** * Advanced Page Visit Counter Settings Page Init * * @since 3.0.1 */ public function avc_settings_page_init() { global $wpdb ; add_menu_page( __( 'Advanced Page Visit Counter', 'advanced-page-visit-counter' ), __( 'Advanced Page Visit Counter', 'advanced-page-visit-counter' ), 'manage_options', 'apvc-dashboard-page', array( $this, 'apvc_dashboard_page' ), plugin_dir_url( __FILE__ ) . 'images/a-logo-1.png' ); $history_table = $wpdb->prefix . 'avc_page_visit_history'; $rows = $wpdb->get_results( "SHOW COLUMNS FROM {$history_table} LIKE 'article_title'" ); if ( count( $rows ) == 0 ) { add_submenu_page( 'apvc-dashboard-page', __( 'Dashboard', 'advanced-page-visit-counter' ), __( 'Dashboard', 'advanced-page-visit-counter' ), 'manage_options', 'apvc-dashboard-page', array( $this, 'apvc_dashboard_page' ) ); add_submenu_page( 'apvc-dashboard-page', __( 'Trending', 'advanced-page-visit-counter' ), __( 'Trending', 'advanced-page-visit-counter' ), 'manage_options', 'apvc-visits-page', 'Advanced_Visit_Counter_Admin::apvc_dashboard_page' ); add_submenu_page( 'apvc-dashboard-page', __( 'Reports', 'advanced-page-visit-counter' ), __( 'Reports', 'advanced-page-visit-counter' ), 'manage_options', 'apvc-visits-page', 'Advanced_Visit_Counter_Admin::apvc_dashboard_page' ); add_submenu_page( 'apvc-dashboard-page', __( 'Shortcode Generator', 'advanced-page-visit-counter' ), __( 'Shortcode Generator', 'advanced-page-visit-counter' ), 'manage_options', 'apvc-visits-page', 'Advanced_Visit_Counter_Admin::apvc_dashboard_page' ); add_submenu_page( 'apvc-dashboard-page', __( 'Shortcode Templates', 'advanced-page-visit-counter' ), __( 'Shortcode Templates', 'advanced-page-visit-counter' ), 'manage_options', 'apvc-visits-page', 'Advanced_Visit_Counter_Admin::apvc_dashboard_page' ); add_submenu_page( 'apvc-dashboard-page', __( 'Settings', 'advanced-page-visit-counter' ), __( 'Settings', 'advanced-page-visit-counter' ), 'manage_options', 'apvc-visits-page', 'Advanced_Visit_Counter_Admin::apvc_dashboard_page' ); } } public function apvc_admin_head() { } /** * Advanced Page Visit Counter Get total counts of the year. * * @since 3.0.1 */ public function apvc_get_total_counts_of_the_year_data() { if ( !wp_verify_nonce( $_POST['security'], 'security_nonce' ) ) { die( 'Permission Denied.' ); } global $wpdb ; $yearTotalCounts = get_transient( 'apvc_yearly_data' ); if ( empty($yearTotalCounts) ) { $yearTotalCounts = json_decode( $this->get_total_counts_of_the_year() ); set_transient( 'apvc_yearly_data', $yearTotalCounts, APVC_HOURLY_REFRESH ); } ?>

apvc_number_format( $yearTotalCounts->total_counts ) ) ; ?>

get_total_counts_of_last_month() ); set_transient( 'apvc_monthly_data', $monthTotalCounts, APVC_HOURLY_REFRESH ); } ?>

apvc_number_format( $monthTotalCounts->lastMonth ) ) ; ?>

countDiff ) ; ?>
get_total_counts_of_last_week() ); set_transient( 'apvc_weekly_data', $weeksTotalCounts, APVC_HOURLY_REFRESH ); } ?>

apvc_number_format( $weeksTotalCounts->lastWeek ) ) ; ?>

countDiff ) ; ?>
get_total_counts_of_last_daily() ); set_transient( 'apvc_daily_data', $dailyTotalCounts, APVC_HOURLY_REFRESH ); } ?>

apvc_number_format( $dailyTotalCounts->todaysCounts ) ) ; ?>

countDiff ) ; ?>
get_browser_traffic_stats_list() ); set_transient( 'apvc_browser_traffic_stats_data', $browserTrafficStatsList, APVC_HOURLY_REFRESH ); } $browserTrafficStats = get_transient( 'apvc_browser_traffic_data' ); if ( empty($browserTrafficStats) ) { $browserTrafficStats = json_decode( $this->get_browser_traffic_stats() ); set_transient( 'apvc_browser_traffic_data', $browserTrafficStats, APVC_HOURLY_REFRESH ); } $browserLogos = (array) json_decode( $this->get_browsers_logos() ); $browsersChartDataV = array(); $browsersChartDataK = array(); foreach ( $browserTrafficStatsList as $bChartList ) { array_push( $browsersChartDataV, $bChartList->total_count ); array_push( $browsersChartDataK, $bChartList->browser_full_name ); } ?>
browser_short_name] ) ? plugin_dir_url( __FILE__ ) . '/images/' . esc_html( $browserLogos[$statsList->browser_short_name] ) : plugin_dir_url( __FILE__ ) . '/images/' . esc_html( $browserLogos['default'] ) ); ?>
thumb
browser_full_name ) ; ?>
apvc_number_format( $statsList->total_count ) ) ; ?>
get_referral_websites_stats() ); set_transient( 'apvc_ref_traffic_data', $referralTrafficStats, APVC_HOURLY_REFRESH ); } $refChartDataV = array(); $refChartDataK = array(); foreach ( $referralTrafficStats as $refChartList ) { array_push( $refChartDataV, $refChartList->total_count ); array_push( $refChartDataK, ucfirst( $refChartList->http_referer ) ); } ?>
' ; foreach ( $referralTrafficStats as $refStats ) { ?>
http_referer ) ; ?>
apvc_number_format( $refStats->total_count ) ) . ' (' . number_format_i18n( $refStats->percentage, 2 ) . '%)' ; ?>
' ; ?>
get_stats_by_operating_systems() ); set_transient( 'apvc_os_data', $osTrafficStats, APVC_HOURLY_REFRESH ); update_option( 'avpc_recent_execution', date( 'Y-m-d H:i:s' ) ); } $osChartDataV = array(); $osChartDataK = array(); foreach ( $osTrafficStats as $osChartList ) { array_push( $osChartDataV, $osChartList->total_count ); array_push( $osChartDataK, ucfirst( $osChartList->operating_system ) ); } ?>
' ; foreach ( $osTrafficStats as $osStats ) { ?>
operating_system ) ) ; ?>
apvc_number_format( $osStats->total_count ) ) . ' (' . number_format_i18n( $osStats->percentage, 2 ) . '%)' ; ?>
' ; ?>
get_results( "SELECT COUNT(*) as ar_count, article_id, (SELECT post_title FROM {$wpdb->posts} WHERE ID = article_id ) as title FROM " . APVC_DATA_TABLE . " WHERE article_id != '' AND `date` > '{$pedate}' GROUP BY article_id ORDER BY ar_count DESC LIMIT 1" ); set_transient( 'apvc_mvp_month_data', $visits, APVC_HOURLY_REFRESH ); } } else { $visits = get_transient( 'apvc_mvp_daily_data' ); if ( empty($visits) ) { $visits = $wpdb->get_results( "SELECT COUNT(*) as ar_count, article_id, (SELECT post_title FROM {$wpdb->posts} WHERE ID = article_id ) as title FROM " . APVC_DATA_TABLE . " WHERE article_id != '' AND `date` > '{$sdate}' GROUP BY article_id ORDER BY ar_count DESC LIMIT 1" ); set_transient( 'apvc_mvp_daily_data', $visits, APVC_HOURLY_REFRESH ); } } ?>

title ) ? esc_html( $visits[0]->title ) : '' ) ; ?>
get_results( 'SELECT ip_address FROM ' . APVC_DATA_TABLE . " WHERE article_id != '' AND `date` >= '{$sdate}' GROUP BY ip_address", ARRAY_N ); set_transient( 'apvc_fv_30_td', $ipsToday, APVC_HOURLY_REFRESH ); } $ipsPast = get_transient( 'apvc_fv_30_past' ); if ( empty($ipsPast) ) { $ipsPast = $wpdb->get_results( 'SELECT ip_address FROM ' . APVC_DATA_TABLE . " WHERE article_id != '' AND `date` >= '{$pedate}' AND `date` < '{$sdate}' GROUP BY ip_address", ARRAY_N ); set_transient( 'apvc_fv_30_past', $ipsPast, APVC_HOURLY_REFRESH ); } } else { $ipsToday = get_transient( 'apvc_fv_td' ); if ( empty($ipsToday) ) { $ipsToday = $wpdb->get_results( 'SELECT ip_address FROM ' . APVC_DATA_TABLE . " WHERE article_id != '' AND `date` >= '{$sdate}' AND `date` <= '{$edate}' GROUP BY ip_address", ARRAY_N ); set_transient( 'apvc_fv_td', $ipsToday, APVC_HOURLY_REFRESH ); } $ipsPast = get_transient( 'apvc_fv_past' ); if ( empty($ipsPast) ) { $ipsPast = $wpdb->get_results( 'SELECT ip_address FROM ' . APVC_DATA_TABLE . " WHERE article_id != '' AND `date` >= '{$pedate}' AND `date` <= '{$sdate}'\t GROUP BY ip_address", ARRAY_N ); set_transient( 'apvc_fv_past', $ipsPast, APVC_HOURLY_REFRESH ); } } $ipsToday = call_user_func_array( 'array_merge', $ipsToday ); $ipsPast = call_user_func_array( 'array_merge', $ipsPast ); if ( count( $ipsPast ) <= 0 ) { $fnCount = count( $ipsToday ); } else { $fnCount = count( array_diff( $ipsToday, $ipsPast ) ); } ?>

= '{$pedate}' AND `date` <= '{$sdate}' "; $visitors = get_transient( 'apvc_get_visitors_mn_data' ); if ( empty($visitors) ) { $visitors = count( $wpdb->get_results( 'SELECT DISTINCT ip_address FROM ' . APVC_DATA_TABLE . " WHERE article_id != '' " . $q ) ); set_transient( 'apvc_get_visitors_mn_data', $visitors, APVC_HOURLY_REFRESH ); } } else { $q = " AND `date` >= '{$sdate}' "; $visitors = get_transient( 'apvc_get_visitors_data' ); if ( empty($visitors) ) { $visitors = count( $wpdb->get_results( 'SELECT DISTINCT ip_address FROM ' . APVC_DATA_TABLE . " WHERE article_id != '' " . $q ) ); set_transient( 'apvc_get_visitors_data', $visitors, APVC_HOURLY_REFRESH ); } } ?>

= '{$lstDate}' AND `date` <= '{$today}' "; $totalCounts = get_transient( 'apvc_pvp_30_data' ); if ( empty($totalCounts) ) { $totalCounts = count( $wpdb->get_results( 'SELECT * FROM ' . APVC_DATA_TABLE . " WHERE article_id != '' " . $q . ' ' ) ); set_transient( 'apvc_pvp_30_data', $totalCounts, APVC_HOURLY_REFRESH ); } $ipCounts = get_transient( 'apvc_pvp_ip_30_data' ); if ( empty($ipCounts) ) { $ipCounts = count( $wpdb->get_results( 'SELECT * FROM ' . APVC_DATA_TABLE . " WHERE article_id != '' " . $q . ' GROUP BY ip_address' ) ); set_transient( 'apvc_pvp_ip_30_data', $ipCounts, APVC_HOURLY_REFRESH ); } } else { $q = " AND `date` >= '{$today}' "; $totalCounts = get_transient( 'apvc_pvp_daily_data' ); if ( empty($totalCounts) ) { $totalCounts = count( $wpdb->get_results( 'SELECT * FROM ' . APVC_DATA_TABLE . " WHERE article_id != '' " . $q . ' ' ) ); set_transient( 'apvc_pvp_daily_data', $totalCounts, APVC_HOURLY_REFRESH ); } $ipCounts = get_transient( 'apvc_pvp_ip_daily_data' ); if ( empty($ipCounts) ) { $ipCounts = count( $wpdb->get_results( 'SELECT * FROM ' . APVC_DATA_TABLE . " WHERE article_id != '' " . $q . ' GROUP BY ip_address' ) ); set_transient( 'apvc_pvp_ip_daily_data', $ipCounts, APVC_HOURLY_REFRESH ); } } if ( $totalCounts > 0 && $ipCounts > 0 ) { $count = ( ceil( $totalCounts / $ipCounts ) !== 'NAN' ? ceil( $totalCounts / $ipCounts ) : '0' ); } else { $count = 0; } ?>

apvc_get_human_time_diff( $recentUpdated ) ; wp_die(); } /* * Advanced Page Visit Counter Refresh the dashboard with latest data. * * @since 3.0.6 */ public function apvc_refresh_dashboard() { if ( !wp_verify_nonce( $_POST['security'], 'security_nonce' ) ) { die( 'Permission Denied.' ); } foreach ( $this->transients as $transient ) { delete_transient( $transient ); } $this->apvc_get_total_counts_of_the_year_data(); $this->apvc_get_total_counts_of_the_month_data(); $this->apvc_get_total_counts_of_the_week_data(); $this->apvc_get_total_counts_daily_data(); $this->apvc_get_browsers_stats_data(); $this->apvc_get_referral_stats_data(); $this->apvc_get_os_stats_data(); $this->apvc_most_visited_article(); $this->apvc_get_first_time_visitors(); $this->apvc_get_visitors(); $this->apvc_get_page_views_per_visitor(); $this->apvc_get_visit_stats(); } /** * Advanced Page Visit Counter Get settings page data. * * @since 3.0.1 */ public function apvc_settings_page_content() { global $wpdb ; $recentUpdated = get_option( 'avpc_recent_execution', true ); ?>
" . $this->apvc_get_human_time_diff( $recentUpdated ) . '', 'advanced-page-visit-counter' ); ?>
apvc_loader_control(); ?>
apvc_loader_control(); ?>
apvc_loader_control(); ?>
apvc_loader_control(); ?>

apvc_loader_control(); ?>
apvc_loader_control(); ?>
apvc_loader_control(); ?>
apvc_loader_control(); ?>

apvc_loader_control(); ?>
apvc_loader_control(); ?>
apvc_loader_control(); ?>
apvc_loader_control(); ?>

Last 20 Days Statistics", 'advanced-page-visit-counter' ); ?>

*It can take some time to render chart based on size of the data.
apvc_loader_control(); ?>

apvc_loader_control(); ?>


apvc_loader_control(); ?>


apvc_loader_control(); ?>
apvc_get_top_10_page_data() ); ?>

' . __( 'No Pages Found', 'advanced-page-visit-counter' ) . '' ; } else { foreach ( $top10Pages as $pages ) { ?>

. title ) ; ?>

get_recent_visit( $pages->article_id ) ; ?>   count ) ; ?>   
apvc_get_top_10_posts_data() ); ?>

' . __( 'No Posts Found', 'advanced-page-visit-counter' ) . '' ; } else { foreach ( $top10Posts as $posts ) { ?>

. title ) ; ?>

get_recent_visit( $posts->article_id ) ; ?>  apvc_number_format( $posts->count ) ; ?>   
apvc_get_top_10_contries_data() ); ?>

' . __( 'No Countries Found', 'advanced-page-visit-counter' ) . '' ; } else { foreach ( $top10Country as $country ) { ?>

. country ) ; ?> <?php 
                echo  esc_attr( $country->country ) ;
                ?>

get_recent_visit( esc_html( $country->article_id ) ) ; ?>  apvc_number_format( intval( $country->count ) ) ; ?>   
apvc_get_top_10_ip_address_data() ); ?>

' . __( 'No IP Address Data Found', 'advanced-page-visit-counter' ) . '' ; } else { foreach ( $top10IPAddress as $ip_address ) { ?>

. ip_address ) ; ?> <?php 
                echo  esc_attr( $this->get_country_name( $ip_address->country ) ) ;
                ?>

get_recent_visit( $ip_address->ip_address, 'ip_address' ) ) ; ?>  apvc_number_format( $ip_address->count ) ) ; ?>   
get_the_reports( $offset, $per_page ) ); $total_pages = ceil( $apvcReports->totalCount / $per_page ); $per_page_var = ''; $dropDown = ''; if ( $pageno == 0 ) { $rCnt = 1; } else { $rCnt = absint( $per_page ) * absint( $pageno - 1 ) + 1; } ?>
list as $reports ) { echo '' ; } ?>
' . $rCnt++ . ' ' . $reports->article_id . '
' . $reports->title . '
' . $this->apvc_number_format( $reports->count ) . ' ' . __( 'View', 'advanced-page-visit-counter' ) . ' ' . __( 'View Chart', 'advanced-page-visit-counter' ) . ' X
prefix . 'avc_page_visit_history'; $art_id = sanitize_text_field( $_REQUEST['artID'] ); if ( $wpdb->query( "DELETE FROM {$history_table} WHERE article_id= '" . esc_sql( $art_id ) . "'" ) ) { echo wp_send_json_success( 'success' ) ; } else { echo wp_send_json_error() ; } wp_die(); } public function apvc_show_counter_options() { if ( !wp_verify_nonce( $_POST['security'], 'security_nonce' ) ) { die( 'Permission Denied.' ); } $art_id = esc_sql( sanitize_text_field( $_REQUEST['artID'] ) ); $active = get_post_meta( $art_id, 'apvc_active_counter', true ); $base_count = get_post_meta( $art_id, 'count_start_from', true ); $widget_label = get_post_meta( $art_id, 'widget_label', true ); ?>

name="apvc_active_counter"> name="apvc_active_counter">

get_the_detailed_reports( $article_id, $offset, $per_page ) ); $total_pages = ceil( $apvcDetailed->totalCount / $per_page ); if ( $pageno == 0 ) { $cnt = 1; } else { $cnt = intval( $per_page ) * intval( $pageno - 1 ) + 1; } ?>
list ) > 0 ) { foreach ( $apvcDetailed->list as $reports ) { $preBlock = ''; $preBlock = '
' . __( 'State: ', 'advanced-page-visit-counter' ) . 'Premium
' . __( 'City: ', 'advanced-page-visit-counter' ) . 'Premium'; echo '' ; } } else { echo '' ; } ?>
' . $cnt++ . '
' . $reports->title . '
' . ucfirst( $reports->article_type ) . ' ' . esc_html( $reports->user_type ) . ' ' . esc_html( $reports->date ) . '
' . esc_html( $reports->ip_address ) . '
' . __( 'Browser: ', 'advanced-page-visit-counter' ) . '' . ucwords( esc_html( $reports->browser_short_name ) ) . '
' . __( 'OS: ', 'advanced-page-visit-counter' ) . '' . ucwords( esc_html( $reports->operating_system ) ) . '
' . __( 'Device: ', 'advanced-page-visit-counter' ) . '' . ucwords( $reports->device_type ) . '
' . __( 'Country: ', 'advanced-page-visit-counter' ) . '' . ucwords( $reports->country ) . '' . $preBlock . '
' . esc_html( $reports->http_referer_clean ) . '
' . esc_html( $reports->http_referer ) . '
No Records Found
prefix . 'avc_page_visit_history'; $rows = $wpdb->get_results( "SHOW COLUMNS FROM {$history_table} LIKE 'article_title'" ); if ( count( $rows ) > 0 ) { ?>

Database Upgrade required...

Click on below button to upgrade the database.
apvc_top_trending_content(); } elseif ( isset( $_GET['apvc_page'] ) && $_GET['apvc_page'] === 'reports' && !isset( $_GET['article_id'] ) ) { $this->apvc_reports_page_content(); } elseif ( isset( $_GET['apvc_page'] ) && isset( $_GET['article_id'] ) && $_GET['apvc_page'] === 'detailed-reports' && $_GET['article_id'] != '' ) { $this->apvc_detailed_reports_page_content(); } elseif ( isset( $_GET['apvc_page'] ) && isset( $_GET['article_id'] ) && $_GET['apvc_page'] === 'detailed-reports-chart' && $_GET['article_id'] != '' ) { $this->apvc_detailed_reports_on_chart(); } elseif ( isset( $_GET['apvc_page'] ) && isset( $_GET['article_id'] ) && $_GET['apvc_page'] === 'country_reports-detailed' && $_GET['article_id'] != '' ) { $this->apvc_detailed_reports_for_the_country_content__premium_only(); } elseif ( isset( $_GET['apvc_page'] ) && isset( $_GET['country'] ) && $_GET['apvc_page'] === 'country_reports-list' && $_GET['country'] != '' ) { $this->country_reports_in_detailed__premium_only(); } elseif ( isset( $_GET['apvc_page'] ) && $_GET['apvc_page'] === 'settings' ) { $this->apvc_reports_settings_page(); } elseif ( isset( $_GET['apvc_page'] ) && $_GET['apvc_page'] === 'country_reports' ) { $this->country_reports__premium_only(); } elseif ( isset( $_GET['apvc_page'] ) && $_GET['apvc_page'] === 'shortcode_generator' ) { $this->apvc_shortcode_generator_page(); } elseif ( isset( $_GET['apvc_page'] ) && $_GET['apvc_page'] === 'export_data' ) { $this->apvc_export_data_page__premium_only(); } elseif ( isset( $_GET['apvc_page'] ) && $_GET['apvc_page'] === 'import_data' ) { $this->apvc_import_data_page__premium_only(); } elseif ( isset( $_GET['apvc_page'] ) && $_GET['apvc_page'] === 'cleanup_data' ) { $this->apvc_cleanup_data_page__premium_only(); } elseif ( isset( $_GET['apvc_page'] ) && $_GET['apvc_page'] === 'shortcode_library' ) { $this->apvc_shortcode_library(); } else { $this->apvc_settings_page_content(); } ?>

' . __( 'Settings have been saved successfully', 'advanced-page-visit-counter' ) . '
' ; } elseif ( isset( $_GET['m'] ) && $_GET['m'] === 'success' && isset( $_GET['t'] ) && $_GET['t'] === 'reset' ) { echo '' ; } ?>
1. 192.168.0.* (This exclude ip address range from 192.168.0.0 to 192.168.0.255)
2. 192.168.0.10/20 (This exclude ip address range from 192.168.0.10 to 192.168.0.20)
', 'advanced-page-visit-counter' ); ?>

apvc_spam_controller[0] ) && $avc_config->apvc_spam_controller[0] == 'on' ) { echo 'checked' ; } ?> >


apvc_widget_width[0]) ) { $width = $avc_config->apvc_widget_width[0]; } else { $width = 300; } ?>
apvc_widget_padding[0]) ) { $padding = $avc_config->apvc_widget_padding[0]; } else { $padding = 10; } ?>
" type="text" value="Today:" class="form-control">
apvc_atc_page_count[0] ) && $avc_config->apvc_atc_page_count[0] == 'on' ) { echo 'checked' ; } ?> >
apvc_show_global_count[0] ) && $avc_config->apvc_show_global_count[0] == 'on' ) { echo 'checked' ; } ?> >
apvc_show_today_count[0] ) && $avc_config->apvc_show_today_count[0] == 'on' ) { echo 'checked' ; } ?> >
apvc_get_shortcodes(); ?>
*All color properties ignored if any template selected.
*More than 40 templates available in the Premium version of the plugin.', 'advanced-page-visit-counter' ); ?>
cache_active[0] ) && $avc_config->cache_active[0] == 'on' ) { echo 'checked' ; } ?> >
*Update the permalink with press Save Changes. Don't forget to clear cache from your enabled plugin.", 'advanced-page-visit-counter' ); ?>
numbers_in_k[0] ) && $avc_config->numbers_in_k[0] == 'on' ) { echo 'checked' ; } ?>>
ip_anonymize[0] ) && $avc_config->ip_anonymize[0] == 'on' ) { echo 'checked' ; } ?> >
***.***.***.***









*All color properties ignored if any template selected.
*More than 40 templates available in the Premium version of the plugin.', 'advanced-page-visit-counter' ); ?>
$value ) { $rawFormData = explode( '=', $value ); if ( isset( $rawFormData[0] ) ) { $finalFormData[$rawFormData[0]][] = urldecode( sanitize_text_field( $rawFormData[1] ) ); } } $border_size = ( isset( $finalFormData['border_size'][0] ) ? $finalFormData['border_size'][0] : '' ); $border_radius = ( isset( $finalFormData['border_radius'][0] ) ? $finalFormData['border_radius'][0] : '' ); $bg_color = ( isset( $finalFormData['background_color'][0] ) ? $finalFormData['background_color'][0] : '' ); $font_size = ( isset( $finalFormData['font_size'][0] ) ? $finalFormData['font_size'][0] : '' ); $font_style = ( isset( $finalFormData['font_style'][0] ) ? $finalFormData['font_style'][0] : '' ); $font_color = ( isset( $finalFormData['font_color'][0] ) ? $finalFormData['font_color'][0] : '' ); $border_style = ( isset( $finalFormData['border_style'][0] ) ? $finalFormData['border_style'][0] : '' ); $border_color = ( isset( $finalFormData['border_color'][0] ) ? $finalFormData['border_color'][0] : '' ); $counter_label = ( isset( $finalFormData['counter_label'][0] ) ? $finalFormData['counter_label'][0] : '' ); $today_counter_label = ( isset( $finalFormData['today_counter_label'][0] ) ? $finalFormData['today_counter_label'][0] : '' ); $global_counter_label = ( isset( $finalFormData['global_counter_label'][0] ) ? $finalFormData['global_counter_label'][0] : '' ); $padding = ( isset( $finalFormData['padding'][0] ) ? $finalFormData['padding'][0] : '' ); $width = ( isset( $finalFormData['width'][0] ) ? $finalFormData['width'][0] : '' ); $shType = ( isset( $finalFormData['shortcode_type'][0] ) ? $finalFormData['shortcode_type'][0] : '' ); $shArticleID = ( isset( $finalFormData['apvc_articles_list'][0] ) ? $finalFormData['apvc_articles_list'][0] : '' ); $show_global_count = ( isset( $finalFormData['show_global_count'][0] ) ? $finalFormData['show_global_count'][0] : '' ); $show_today_count = ( isset( $finalFormData['show_today_count'][0] ) ? $finalFormData['show_today_count'][0] : '' ); $show_cr_pg_count = ( isset( $finalFormData['show_cr_pg_count'][0] ) ? $finalFormData['show_cr_pg_count'][0] : '' ); $widget_template = ( isset( $finalFormData['apvc_widget_template'][0] ) ? $finalFormData['apvc_widget_template'][0] : '' ); if ( empty($shArticleID) ) { $shArticleID = 1; } if ( $show_global_count == 'on' ) { $show_global_countVar = ' global="true" '; } else { $show_global_countVar = ' global="false" '; } if ( $show_today_count == 'on' ) { $show_today_countVar = ' today="true" '; } else { $show_today_countVar = ' today="false" '; } if ( $show_cr_pg_count == 'on' ) { $show_cr_pg_countVar = ' current="true" '; } else { $show_cr_pg_countVar = ' current="false" '; } $shArgs = ''; if ( $shType == 'individual' && !empty($shArticleID) ) { $shArgs = 'type="individual" article_id="' . $shArticleID . '"'; } elseif ( $shType == 'global' ) { $shArgs = 'type="global"'; } else { $shArgs = 'type="customized"'; } $counter_label = ( !empty($counter_label) ? $counter_label : 'Visits: ' ); $today_counter_label = ( !empty($today_counter_label) ? $today_counter_label : $counter_label ); $global_counter_label = ( !empty($global_counter_label) ? $global_counter_label : $counter_label ); $shortcode = '[apvc_embed ' . $shArgs . ' border_size="' . $border_size . '" border_radius="' . $border_radius . '" background_color="' . $bg_color . '" font_size="' . $font_size . '" font_style="' . $font_style . '" font_color="' . $font_color . '" counter_label="' . $counter_label . '" today_cnt_label="' . $today_counter_label . '" global_cnt_label="' . $global_counter_label . '" border_color="' . $border_color . '" border_style="' . $border_style . '" padding="' . $padding . '" width="' . $width . '" ' . $show_global_countVar . ' ' . $show_today_countVar . ' ' . $show_cr_pg_countVar . ' ' . $iconCR . ' ' . $iconGL . ' ' . $iconTD . ' icon_position="' . $apvc_icon_position . '" widget_template="' . $widget_template . '" ]'; ?>
apvc_get_shortcodes(); ?>

apvc_get_html_with_icon( $value['key'] . ' ' . $addClass ) : $this->apvc_get_html_without_icon( $value['key'] . ' ' . $addClass ) ) ; ?>
apvc_delete_rc[0]; if ( !empty($dd) ) { $dDate = date( 'Y-m-d 00:00:00', strtotime( '-' . $dd . ' days' ) ); return $wpdb->get_results( "DELETE FROM {$table} WHERE date<='{$dt}' " ); } } public function apvc_upgrade_database() { global $wpdb ; $history_table = $wpdb->prefix . 'avc_page_visit_history'; $article_title = $wpdb->get_results( "SELECT article_title FROM {$history_table} WHERE article_title != ''" ); if ( empty($article_title) ) { $sqlAlter = "ALTER TABLE {$history_table} DROP COLUMN article_title"; $wpdb->query( $sqlAlter ); } $addColumn = $wpdb->get_results( "SELECT country FROM {$history_table} WHERE country != ''" ); if ( empty($addColumn) ) { $addColumn = "ALTER TABLE {$history_table} ADD country TEXT AFTER flag"; $wpdb->query( $addColumn ); } return wp_send_json_success(); wp_die(); } public function apvc_detailed_reports_on_chart() { global $wpdb ; $tbl_history = APVC_DATA_TABLE; ?>
In premium version only.