*/ class Advanced_Visit_Counter_Admin { /** * The ID of this plugin. * * @since 3.0.1 * @access private * @var string $plugin_name The ID of this plugin. */ private $plugin_name ; /** * The version of this plugin. * * @since 3.0.1 * @access private * @var string $version The current version of this plugin. */ private $version ; private $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" ) ; /** * Initialize the class and set its properties. * * @since 3.0.1 * @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 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' ) { 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. */ if ( isset( $_GET['page'] ) && $_GET['page'] === 'apvc-dashboard-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 :", "apvc" ), "shortcode_copied" => __( "Shortcode Copied to clipboard.", "apvc" ), "import_completed" => __( "Data Imported successfully.", "apvc" ), "import_failed" => __( "File format is not supported.", "apvc" ), "shortcode_delete" => __( "Shortcode Deleted successfully.", "apvc" ), "file_delete" => __( "File Deleted successfully.", "apvc" ), "success" => __( "Success", "apvc" ), "failed" => __( "Failed", "apvc" ), "are_you_sure" => __( "Are you sure?", "apvc" ), "are_you_sure_text" => __( "You won't be able to revert this!", "apvc" ), "cancel_btn" => __( "Cancel", "apvc" ), "okay_btn" => __( "OK", "apvc" ), "confirm_btn" => __( "Great ", "apvc" ), "valid_date" => __( "Please select valid date range.", "apvc" ), "valid_file" => __( "Please upload valid file. (xls,xlsx,csv)", "apvc" ), "date_warning" => __( "Please enter valid date.", "apvc" ), "data_warning" => __( "Please enter valid data.", "apvc" ), "open" => __( "Open", "apvc" ), "export_completed" => __( "File Export Completed", "apvc" ), "shortcode_save" => __( "Please Enter Shortcode Name", "apvc" ), "cleanup_completed" => __( "Clean Up Process Completed", "apvc" ), "refresh_dashboard" => __( "Dashboard is reloading now...", "apvc" ), ); $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( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'apvc_url' => 'https://pagevisitcounter.com/', "search_lable" => __( "Search By :", "apvc" ), 'admin_d_url' => admin_url( 'admin.php?page=apvc-dashboard-page' ), 'post_url' => get_home_url() . "/?p=", ) ); wp_localize_script( 'apvc_script_js', 'apvc_translation', $translations ); wp_localize_script( $this->plugin_name, 'apvc_translation', $translations ); } } /** * Advanced Page Visit Counter Settings Page Init * * @since 3.0.1 */ public function avc_settings_page_init() { add_menu_page( __( 'Advanced Page Visit Counter', 'apvc' ), __( 'Advanced Page Visit Counter', 'apvc' ), 'manage_options', 'apvc-dashboard-page', array( $this, 'apvc_dashboard_page' ), plugin_dir_url( __FILE__ ) . "images/a-logo-1.png" ); } /** * Advanced Page Visit Counter Get Browsers Logos to list on reports pages. * * @since 3.0.1 */ public function get_browsers_logos() { $logos = array( 'Firefox' => 'firefox.png', 'Chrome' => 'chrome.png', 'Safari' => 'Safari.png', 'MSIE' => 'Internet-Explorer.png', 'Opera' => 'opera.png', 'Vivaldi' => 'vivaldi.png', 'default' => 'default-browser.png', ); return wp_json_encode( $logos ); } /** * Advanced Page Visit Counter Get Country names to list on reports pages. * * @since 3.0.1 */ public function get_country_names() { $allCountries = [ "Afghanistan" => "AF", "land Islands" => "AX", "Albania" => "AL", "Algeria" => "DZ", "American Samoa" => "AS", "AndorrA" => "AD", "Angola" => "AO", "Anguilla" => "AI", "Antarctica" => "AQ", "Antigua and Barbuda" => "AG", "Argentina" => "AR", "Armenia" => "AM", "Aruba" => "AW", "Australia" => "AU", "Austria" => "AT", "Azerbaijan" => "AZ", "Bahamas" => "BS", "Bahrain" => "BH", "Bangladesh" => "BD", "Barbados" => "BB", "Belarus" => "BY", "Belgium" => "BE", "Belize" => "BZ", "Benin" => "BJ", "Bermuda" => "BM", "Bhutan" => "BT", "Bolivia" => "BO", "Bosnia and Herzegovina" => "BA", "Botswana" => "BW", "Bouvet Island" => "BV", "Brazil" => "BR", "British Indian Ocean Territory" => "IO", "Brunei Darussalam" => "BN", "Bulgaria" => "BG", "Burkina Faso" => "BF", "Burundi" => "BI", "Cambodia" => "KH", "Cameroon" => "CM", "Canada" => "CA", "Cape Verde" => "CV", "Cayman Islands" => "KY", "Central African Republic" => "CF", "Chad" => "TD", "Chile" => "CL", "China" => "CN", "Christmas Island" => "CX", "Cocos (Keeling) Islands" => "CC", "Colombia" => "CO", "Comoros" => "KM", "Congo" => "CG", "Congo, The Democratic Republic of the" => "CD", "Cook Islands" => "CK", "Costa Rica" => "CR", "Cote D'Ivoire" => "CI", "Croatia" => "HR", "Cuba" => "CU", "Cyprus" => "CY", "Czechia" => "CZ", "Denmark" => "DK", "Djibouti" => "DJ", "Dominica" => "DM", "Dominican Republic" => "DO", "Ecuador" => "EC", "Egypt" => "EG", "El Salvador" => "SV", "Equatorial Guinea" => "GQ", "Eritrea" => "ER", "Estonia" => "EE", "Ethiopia" => "ET", "Falkland Islands (Malvinas)" => "FK", "Faroe Islands" => "FO", "Fiji" => "FJ", "Finland" => "FI", "France" => "FR", "French Guiana" => "GF", "French Polynesia" => "PF", "French Southern Territories" => "TF", "Gabon" => "GA", "Gambia" => "GM", "Georgia" => "GE", "Germany" => "DE", "Ghana" => "GH", "Gibraltar" => "GI", "Greece" => "GR", "Greenland" => "GL", "Grenada" => "GD", "Guadeloupe" => "GP", "Guam" => "GU", "Guatemala" => "GT", "Guernsey" => "GG", "Guinea" => "GN", "Guinea-Bissau" => "GW", "Guyana" => "GY", "Haiti" => "HT", "Heard Island and Mcdonald Islands" => "HM", "Vatican City" => "VA", "Honduras" => "HN", "Hong Kong" => "HK", "Hungary" => "HU", "Iceland" => "IS", "India" => "IN", "Indonesia" => "ID", "Iran" => "IR", "Iraq" => "IQ", "Ireland" => "IE", "Isle of Man" => "IM", "Israel" => "IL", "Italy" => "IT", "Jamaica" => "JM", "Japan" => "JP", "Jersey" => "JE", "Hashemite Kingdom of Jordan" => "JO", "Kazakhstan" => "KZ", "Kenya" => "KE", "Kiribati" => "KI", "Korea, Democratic People'S Republic of" => "KP", "Republic of Korea" => "KR", "South Korea" => "KR", "Kuwait" => "KW", "Kyrgyzstan" => "KG", "Laos" => "LA", "Latvia" => "LV", "Lebanon" => "LB", "Lesotho" => "LS", "Liberia" => "LR", "Libyan Arab Jamahiriya" => "LY", "Liechtenstein" => "LI", "Republic of Lithuania" => "LT", "Luxembourg" => "LU", "Macao" => "MO", "Macedonia, The Former Yugoslav Republic of" => "MK", "Madagascar" => "MG", "Malawi" => "MW", "Malaysia" => "MY", "Maldives" => "MV", "Mali" => "ML", "Malta" => "MT", "Marshall Islands" => "MH", "Martinique" => "MQ", "Mauritania" => "MR", "Mauritius" => "MU", "Mayotte" => "YT", "Mexico" => "MX", "Micronesia, Federated States of" => "FM", "Republic of Moldova" => "MD", "Monaco" => "MC", "Mongolia" => "MN", "Montenegro" => "ME", "Montserrat" => "MS", "Morocco" => "MA", "Mozambique" => "MZ", "Myanmar" => "MM", "Namibia" => "NA", "Nauru" => "NR", "Nepal" => "NP", "Netherlands" => "NL", "Netherlands Antilles" => "AN", "New Caledonia" => "NC", "New Zealand" => "NZ", "Nicaragua" => "NI", "Niger" => "NE", "Nigeria" => "NG", "Niue" => "NU", "Norfolk Island" => "NF", "Northern Mariana Islands" => "MP", "Norway" => "NO", "Oman" => "OM", "Pakistan" => "PK", "Palau" => "PW", "Palestine" => "PS", "Panama" => "PA", "Papua New Guinea" => "PG", "Paraguay" => "PY", "Peru" => "PE", "Philippines" => "PH", "Pitcairn" => "PN", "Poland" => "PL", "Portugal" => "PT", "Puerto Rico" => "PR", "Qatar" => "QA", "Reunion" => "RE", "Romania" => "RO", "Russia" => "RU", "RWANDA" => "RW", "Saint Helena" => "SH", "Saint Kitts and Nevis" => "KN", "Saint Lucia" => "LC", "Saint Pierre and Miquelon" => "PM", "Saint Vincent and the Grenadines" => "VC", "Samoa" => "WS", "San Marino" => "SM", "Sao Tome and Principe" => "ST", "Saudi Arabia" => "SA", "Senegal" => "SN", "Serbia" => "RS", "Seychelles" => "SC", "Sierra Leone" => "SL", "Singapore" => "SG", "Slovakia" => "SK", "Slovenia" => "SI", "Solomon Islands" => "SB", "Somalia" => "SO", "South Africa" => "ZA", "South Georgia and the South Sandwich Islands" => "GS", "Spain" => "ES", "Sri Lanka" => "LK", "Sudan" => "SD", "Suriname" => "SR", "Svalbard and Jan Mayen" => "SJ", "Swaziland" => "SZ", "Sweden" => "SE", "Switzerland" => "CH", "Syrian Arab Republic" => "SY", "Taiwan" => "TW", "Tajikistan" => "TJ", "Tanzania" => "TZ", "Thailand" => "TH", "Timor-Leste" => "TL", "Togo" => "TG", "Tokelau" => "TK", "Tonga" => "TO", "Trinidad and Tobago" => "TT", "Tunisia" => "TN", "Turkey" => "TR", "Turkmenistan" => "TM", "Turks and Caicos Islands" => "TC", "Tuvalu" => "TV", "Uganda" => "UG", "Ukraine" => "UA", "United Arab Emirates" => "AE", "United Kingdom" => "GB", "United States" => "US", "United States Minor Outlying Islands" => "UM", "Uruguay" => "UY", "Uzbekistan" => "UZ", "Vanuatu" => "VU", "Venezuela" => "VE", "Vietnam" => "VN", "Virgin Islands, British" => "VG", "Virgin Islands, U.S." => "VI", "Wallis and Futuna" => "WF", "Western Sahara" => "EH", "Yemen" => "YE", "Zambia" => "ZM", "Zimbabwe" => "ZW", ]; return wp_json_encode( $allCountries ); } /** * Advanced Page Visit Counter Get short country name from full country name to list on reports pages. * * @since 3.0.1 */ public function get_country_name( $name ) { $allCountries = json_decode( $this->get_country_names() ); return $allCountries->{$name}; } /** * Advanced Page Visit Counter Get total counts of the last year. * * @since 3.0.1 */ public function get_total_counts_of_the_year() { global $wpdb ; $table = APVC_DATA_TABLE; $currentDate = date( 'Y-m-d H:i:s', strtotime( date( 'Y-m-d 0:0:0' ) . ' -1 year' ) ); $monthWise = $wpdb->get_results( "SELECT COUNT(*) as total_count, MONTH(date) as month, YEAR(date) as year FROM {$table} WHERE date >= '{$currentDate}' GROUP BY MONTH(date) order by year ASC", ARRAY_N ); $totalCounts = $wpdb->get_var( "SELECT COUNT(*) as total_count FROM {$table} WHERE date >= '" . $currentDate . "'" ); $monthArray = array(); foreach ( $monthWise as $value ) { array_push( $monthArray, $value[0] ); } return wp_json_encode( array( "months_wise" => $monthArray, "total_counts" => $totalCounts, ) ); } /** * Advanced Page Visit Counter Get total counts of the last month. * * @since 3.0.1 */ public function get_total_counts_of_last_month() { global $wpdb ; $table = APVC_DATA_TABLE; $currentDate = date( 'Y-m-d H:i:s', strtotime( date( 'Y-m-d 0:0:0' ) . ' -1 month' ) ); $prevMonthDate = date( 'Y-m-d H:i:s', strtotime( date( 'Y-m-d 0:0:0' ) . ' -2 month' ) ); $prevPrevMonthDate = date( 'Y-m-d H:i:s', strtotime( date( 'Y-m-d 0:0:0' ) . ' -3 month' ) ); $lastMonthCounts = $wpdb->get_var( "SELECT COUNT(*) as total_count FROM {$table} WHERE date >= '" . $currentDate . "'" ); $prevMonthCounts = $wpdb->get_var( "SELECT COUNT(*) as total_count FROM {$table} WHERE date >= '" . $prevMonthDate . "' AND date <= '" . $currentDate . "'" ); $prevPrevMonthCounts = $wpdb->get_var( "SELECT COUNT(*) as total_count FROM {$table} WHERE date >= '" . $prevPrevMonthDate . "' AND date <= '" . $prevMonthDate . "'" ); $diff = $lastMonthCounts - $prevMonthCounts; $diff = ( $diff >= 0 ? "+" . $diff : $diff ); $class = ( $diff >= 0 ? "text-success" : "text-danger" ); return wp_json_encode( array( "lastMonth" => $lastMonthCounts, "months_wise" => [ $prevPrevMonthCounts, $prevMonthCounts, $lastMonthCounts ], "countDiff" => $diff, "class" => $class, ) ); } /** * Advanced Page Visit Counter Get total counts of the last week. * * @since 3.0.1 */ public function get_total_counts_of_last_week() { global $wpdb ; $table = APVC_DATA_TABLE; $currentDate = date( 'Y-m-d H:i:s', strtotime( date( 'Y-m-d 0:0:0' ) . ' -1 week' ) ); $prevWeekDate = date( 'Y-m-d H:i:s', strtotime( date( 'Y-m-d 0:0:0' ) . ' -2 weeks' ) ); $prevPrevWeekDate = date( 'Y-m-d H:i:s', strtotime( date( 'Y-m-d 0:0:0' ) . ' -3 weeks' ) ); $lastWeekCounts = $wpdb->get_var( "SELECT COUNT(*) as total_count FROM {$table} WHERE date >= '" . $currentDate . "'" ); $prevWeekCounts = $wpdb->get_var( "SELECT COUNT(*) as total_count FROM {$table} WHERE date >= '" . $prevWeekDate . "' AND date <= '" . $currentDate . "'" ); $prevPrevWeekCounts = $wpdb->get_var( "SELECT COUNT(*) as total_count FROM {$table} WHERE date >= '" . $prevPrevWeekDate . "' AND date <= '" . $prevWeekDate . "'" ); $diff = $lastWeekCounts - $prevWeekCounts; $diff = ( $diff >= 0 ? "+" . $diff : $diff ); $class = ( $diff >= 0 ? "text-success" : "text-danger" ); return wp_json_encode( array( "lastWeek" => $lastWeekCounts, "weeks_wise" => [ $prevPrevWeekCounts, $prevWeekCounts, $lastWeekCounts ], "countDiff" => $diff, "class" => $class, ) ); } /** * Advanced Page Visit Counter Get total counts of daily. * * @since 3.0.1 */ public function get_total_counts_of_last_daily() { global $wpdb ; $table = APVC_DATA_TABLE; $currentDate = date( 'Y-m-d H:i:s', strtotime( date( 'Y-m-d 0:0:0' ) ) ); $yesterdayDate = date( 'Y-m-d H:i:s', strtotime( date( 'Y-m-d 0:0:0' ) . ' -2 day' ) ); $prevDate = date( 'Y-m-d H:i:s', strtotime( date( 'Y-m-d 0:0:0' ) . ' -3 day' ) ); $todaysCounts = $wpdb->get_var( "SELECT COUNT(*) as total_count FROM {$table} WHERE date >= '" . $currentDate . "'" ); $yesterdayCounts = $wpdb->get_var( "SELECT COUNT(*) as total_count FROM {$table} WHERE date >= '" . $yesterdayDate . "' AND date <= '" . $currentDate . "'" ); $prevDate = $wpdb->get_var( "SELECT COUNT(*) as total_count FROM {$table} WHERE date >= '" . $prevDate . "' AND date <= '" . $yesterdayDate . "'" ); $diff = $todaysCounts - $yesterdayCounts; $diff = ( $diff >= 0 ? "+" . $diff : $diff ); $class = ( $diff >= 0 ? "text-success" : "text-danger" ); return wp_json_encode( array( "todaysCounts" => $todaysCounts, "day_wise" => [ $prevDate, $yesterdayCounts, $todaysCounts ], "countDiff" => $diff, "class" => $class, ) ); } /** * Advanced Page Visit Counter Get total counts. * * @since 3.0.1 */ public function get_total_counts() { global $wpdb ; $table = APVC_DATA_TABLE; $total_count = $wpdb->get_var( "SELECT COUNT(*) FROM {$table}" ); return $total_count; wp_die(); } /** * Advanced Page Visit Counter Get browser traffic stats. * * @since 3.0.1 */ public function get_browser_traffic_stats() { global $wpdb ; $table = APVC_DATA_TABLE; $browserStats = $wpdb->get_results( "SELECT COUNT(*) as total_count, device_type, COUNT(*)*100/(SELECT COUNT(*) FROM {$table}) as percentage FROM {$table} GROUP BY device_type" ); return wp_json_encode( $browserStats ); } /** * Advanced Page Visit Counter Get browser traffic stats list. * * @since 3.0.1 */ public function get_browser_traffic_stats_list() { global $wpdb ; $table = APVC_DATA_TABLE; $currentDate = date( 'Y-m-d H:i:s', strtotime( date( 'Y-m-d 0:0:0' ) . ' -1 day' ) ); $browserStatsList = $wpdb->get_results( "SELECT COUNT(*) as total_count, browser_short_name, browser_full_name FROM {$table} WHERE date >= '{$currentDate}' GROUP BY browser_short_name order by total_count DESC LIMIT 5" ); return wp_json_encode( $browserStatsList ); } /** * Advanced Page Visit Counter Get referrel websites traffic stats. * * @since 3.0.1 */ public function get_referral_websites_stats() { global $wpdb ; $table = APVC_DATA_TABLE; $referralStats = $wpdb->get_results( "SELECT COUNT(*) as total_count, SUBSTRING_INDEX(SUBSTRING_INDEX(REPLACE(REPLACE(LOWER(http_referer), 'https://', ''), 'http://', ''), '/', 1), '?', 1) as http_referer, http_referer as htp_ref, COUNT(*)*100/(SELECT COUNT(*) FROM {$table}) as percentage FROM {$table} GROUP BY http_referer ORDER BY total_count DESC LIMIT 0,5 " ); return wp_json_encode( $referralStats ); } /** * Advanced Page Visit Counter Get stats by Operation Systems. * * @since 3.0.1 */ public function get_stats_by_operating_systems() { global $wpdb ; $table = APVC_DATA_TABLE; $OsStats = $wpdb->get_results( "SELECT COUNT(*) as total_count, operating_system, COUNT(*)*100/(SELECT COUNT(*) FROM {$table}) as percentage FROM {$table} GROUP BY operating_system ORDER BY total_count DESC LIMIT 0,5" ); return wp_json_encode( $OsStats ); } /** * Advanced Page Visit Counter Get recent visit stats. * * @since 3.0.1 */ public function get_recent_visit( $article_id, $type = '' ) { global $wpdb ; $table = APVC_DATA_TABLE; if ( $type == 'ip_address' ) { $recentVisit = $wpdb->get_var( "SELECT date FROM {$table} WHERE ip_address = '{$article_id}' ORDER BY date DESC" ); } else { $recentVisit = $wpdb->get_var( "SELECT date FROM {$table} WHERE article_id = {$article_id} ORDER BY date DESC" ); } $recentVisit = human_time_diff( strtotime( $recentVisit ), strtotime( date( "Y-m-d 0:0:0" ) ) ) . __( ' ago', "apvc" ); return $recentVisit; } /** * Advanced Page Visit Counter Get total reports. * * @since 3.0.1 */ public function get_the_reports( $offset, $no_of_records_per_page ) { global $wpdb ; $table = APVC_DATA_TABLE; $where = ''; $where = " "; $totalCount = count( $wpdb->get_results( "SELECT article_id FROM {$table} " . $where . " GROUP BY article_id" ) ); $apvcReports = $wpdb->get_results( "SELECT COUNT(*) as count, article_id, ( SELECT post_title FROM {$wpdb->prefix}posts WHERE ID=article_id ) as title FROM {$table} " . $where . " GROUP BY article_id ORDER BY count DESC LIMIT {$offset}, {$no_of_records_per_page}" ); return wp_json_encode( array( "totalCount" => $totalCount, "list" => $apvcReports, ) ); } /** * Advanced Page Visit Counter Get detailed report of any article. * * @since 3.0.1 */ public function get_the_detailed_reports( $article_id, $offset, $no_of_records_per_page ) { global $wpdb ; $table = APVC_DATA_TABLE; $where = ''; $where = " "; $totalCount = count( $wpdb->get_results( "SELECT article_id FROM {$table} WHERE article_id={$article_id} " . $where . " " ) ); $apvcReports = $wpdb->get_results( "SELECT *, (SELECT post_title FROM {$wpdb->prefix}posts WHERE ID={$article_id}) as title, SUBSTRING_INDEX(SUBSTRING_INDEX(REPLACE(REPLACE(LOWER(http_referer), 'https://', ''), 'http://', ''), '/', 1), '?', 1) as http_referer_clean FROM {$table} WHERE article_id={$article_id} " . $where . " ORDER BY date DESC LIMIT {$offset}, {$no_of_records_per_page}" ); return wp_json_encode( array( "totalCount" => $totalCount, "list" => $apvcReports, ) ); } /** * Advanced Page Visit Counter Get total counts of the year. * * @since 3.0.1 */ public function apvc_get_total_counts_of_the_year_data() { 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, HOURLY_REFRESH ); } ?>

total_counts ; ?>

months_wise ) ; ?>" id="apvc_total_visits_yearly"> get_total_counts_of_last_month() ); set_transient( "apvc_monthly_data", $monthTotalCounts, HOURLY_REFRESH ); } ?>

lastMonth ; ?>

countDiff ; ?>
months_wise ) ; ?>" height="60" id="apvc_total_visits_monthly"> get_total_counts_of_last_week() ); set_transient( "apvc_weekly_data", $weeksTotalCounts, HOURLY_REFRESH ); } ?>

lastWeek ; ?>

countDiff ; ?>
weeks_wise ) ; ?>" id="apvc_total_visits_weekly"> get_total_counts_of_last_daily() ); set_transient( "apvc_daily_data", $dailyTotalCounts, HOURLY_REFRESH ); } ?>

todaysCounts ; ?>

countDiff ; ?>
day_wise ) ; ?>" id="apvc_total_visits_daily"> get_browser_traffic_stats_list() ); set_transient( "apvc_browser_traffic_stats_data", $browserTrafficStatsList, 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, 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 ); } ?>
" ch_keys="" height="140">


browser_short_name] : plugin_dir_url( __FILE__ ) . "/images/" . $browserLogos['default'] ) ; ?>" alt="thumb">
browser_full_name, "apvc" ) ; ?>
total_count ; ?>
get_referral_websites_stats() ); set_transient( "apvc_ref_traffic_data", $referralTrafficStats, HOURLY_REFRESH ); } $refChartDataV = array(); $refChartDataK = array(); foreach ( $referralTrafficStats as $refChartList ) { array_push( $refChartDataV, $refChartList->total_count ); array_push( $refChartDataK, ucfirst( $refChartList->http_referer ) ); } ?>
" ref_keys="">

' . __( ucfirst( $refStats->http_referer ), 'apvc' ) . '

' . $refStats->total_count . ' (' . number_format_i18n( $refStats->percentage, 2 ) . '%)' . __( $refStats->htp_ref, 'apvc' ) . '
' ; $bsCnt++; } ?> get_stats_by_operating_systems() ); set_transient( "apvc_os_data", $osTrafficStats, 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 ) ); } ?>
" os_keys="">

' . __( ucfirst( $osStats->operating_system ), 'apvc' ) . '

' . $osStats->total_count . ' (' . number_format_i18n( $osStats->percentage, 2 ) . '%)
' ; $bsCnt++; } ?> 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, 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, HOURLY_REFRESH ); } } ?>

title ; ?>
= '$sdate' GROUP BY ip_address"; // echo '
'; // echo "SELECT ip_address FROM ".APVC_DATA_TABLE." WHERE article_id != '' AND `date` >= '$pedate' AND `date` < '$sdate' GROUP BY ip_address"; if ( isset( $_REQUEST['day'] ) && !empty($_REQUEST['day']) ) { $ipsToday = get_transient( "apvc_fv_30_td" ); if ( empty($ipsToday) ) { $ipsToday = $wpdb->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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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() { 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(); } /** * 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 ); ?>
apvc_get_version_info_block(); ?>
" . $this->apvc_get_human_time_diff( $recentUpdated ) . '', "apvc" ); ?>
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(); ?>

apvc_loader_control(); ?>

apvc_loader_control(); ?>

apvc_loader_control(); ?>

display_name . "!", "apvc" ) ; ?>

is_not_paying() ) { ?>

Visit", "apvc" ); ?>

get_upgrade_url() . '" class="btn btn-light">' . __( 'Upgrade Now!', 'apvc' ) . '' ; echo '
' . __( "Free Version " . $this->version, "apvc" ) . '
' ; ?>
get_results( "SELECT article_id, count(*) as count, ( SELECT post_title FROM {$wpdb->prefix}posts WHERE ID=article_id ) as title FROM {$table} " . $where . " GROUP BY article_id ORDER BY count DESC LIMIT 10" ); return wp_json_encode( $top10Pages ); } /** * Advanced Page Visit Counter Get top 10 posts data. * * @since 3.0.1 */ public function apvc_get_top_10_posts_data() { global $wpdb ; $table = APVC_DATA_TABLE; $where = ''; $where = " WHERE article_id != '' AND article_type NOT IN ('page','cart') "; $top10Posts = $wpdb->get_results( "SELECT article_id, count(*) as count, ( SELECT post_title FROM {$wpdb->prefix}posts WHERE ID=article_id ) as title FROM {$table} " . $where . " GROUP BY article_id ORDER BY count DESC LIMIT 10" ); return wp_json_encode( $top10Posts ); } /** * Advanced Page Visit Counter Get top 10 countries data. * * @since 3.0.1 */ public function apvc_get_top_10_contries_data() { global $wpdb ; $table = APVC_DATA_TABLE; $where = ''; $where = " WHERE country != '' "; $top10Country = $wpdb->get_results( "SELECT article_id, country, count(*) as count FROM {$table} " . $where . " GROUP BY country ORDER BY count DESC LIMIT 10" ); return wp_json_encode( $top10Country ); } /** * Advanced Page Visit Counter Get top 10 ip address data. * * @since 3.0.1 */ public function apvc_get_top_10_ip_address_data() { global $wpdb ; $table = APVC_DATA_TABLE; $where = ''; $where = " WHERE ip_address != '' "; $top10iPAddress = $wpdb->get_results( "SELECT article_id, ip_address, country, count(*) as count FROM {$table} " . $where . " GROUP BY ip_address ORDER BY count DESC LIMIT 10" ); return wp_json_encode( $top10iPAddress ); } /** * Advanced Page Visit Counter Get human time difference data. * * @since 3.0.1 */ public function apvc_get_human_time_diff( $recentVisit ) { $recentVisit = human_time_diff( strtotime( $recentVisit ), strtotime( date( "Y-m-d H:i:s" ) ) ) . __( ' ago', "apvc" ); return $recentVisit; } /** * Advanced Page Visit Counter Get loader. * * @since 3.0.1 */ public function apvc_loader_control() { ?>
apvc_get_top_10_page_data() ); ?>

' . __( "No Pages Found", "apvc" ) . '' ; } else { foreach ( $top10Pages as $pages ) { ?>

. title, "apvc" ) ; ?>

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

' . __( "No Posts Found", "apvc" ) . '' ; } else { foreach ( $top10Posts as $posts ) { ?>

. title, "apvc" ) ; ?>

get_recent_visit( $posts->article_id ) ; ?>  count, "apvc" ) ; ?>   
apvc_get_top_10_contries_data() ); ?>

' . __( "No Countries Found", "apvc" ) . '' ; } else { foreach ( $top10Country as $country ) { ?>

. country, "apvc" ) ; ?> get_country_name( $country->country ) ) ; ?>.svg" alt="country ; ?>" title="country ; ?>">

get_recent_visit( $country->article_id ) ; ?>  count, "apvc" ) ; ?>   
apvc_get_top_10_ip_address_data() ); ?>

' . __( "No IP Address Data Found", "apvc" ) . '' ; } else { foreach ( $top10IPAddress as $ip_address ) { ?>

. ip_address, "apvc" ) ; ?> get_country_name( $ip_address->country ) ) ; ?>.svg" alt="get_country_name( $ip_address->country ) ; ?>" title="get_country_name( $ip_address->country ) ; ?>">

get_recent_visit( $ip_address->ip_address, "ip_address" ) ; ?>  count, "apvc" ) ; ?>   
get_the_reports( $offset, $per_page ) ); $total_pages = ceil( $apvcReports->totalCount / $per_page ); $dropDown = ""; if ( $pageno == 0 ) { $rCnt = 1; } else { $rCnt = intval( $per_page ) * intval( $pageno - 1 ) + 1; } ?>
apvc_get_version_info_block(); ?>
list as $reports ) { echo '' ; } ?>
' . $rCnt++ . ' ' . $reports->article_id . '
' . __( $reports->title, "apvc" ) . '
' . $reports->count . ' ' . $this->get_recent_visit( $reports->article_id ) . ' article_id . $dropDown . "" ) . '" class="btn btn-outline-primary">' . __( 'Detailed Report', "apvc" ) . '
apvc_is_date( $d ) ) { $days_ago = date( 'Y-m-d', time() - $d * SECONDS_PER_DAY ); $where = " WHERE date >= '{$days_ago}' AND country = '{$country}' "; } else { if ( $this->apvc_is_date( $d ) && $this->apvc_is_date( $e ) ) { $where = " WHERE date >= '{$d}' AND date <= '{$e}' AND country = '{$country}' "; } else { $where = " WHERE country = '{$country}' "; } } $totalCount = count( $wpdb->get_results( "SELECT article_id FROM {$table} " . $where . " GROUP BY article_id" ) ); $apvcReports = $wpdb->get_results( "SELECT COUNT(*) as count, article_id, ( SELECT post_title FROM {$wpdb->prefix}posts WHERE ID=article_id ) as title FROM {$table} " . $where . " GROUP BY article_id ORDER BY count DESC LIMIT {$offset}, {$no_of_records_per_page}" ); return wp_json_encode( array( "totalCount" => $totalCount, "list" => $apvcReports, ) ); } /** * Advanced Page Visit Counter Get detailed reports. * * @since 3.0.1 */ public function apvc_detailed_reports_page_content() { global $wpdb ; $tbl_history = APVC_DATA_TABLE; $dropDown = ""; $g_checked = ( $_REQUEST['u_g'] == 'on' ? "checked" : "" ); $rg_checked = ( $_REQUEST['u_r'] == 'on' ? "checked" : "" ); if ( isset( $_GET['pageno'] ) ) { $pageno = $_GET['pageno']; } else { $pageno = 1; } $per_page = ( $_GET['per_page'] ? $_GET['per_page'] : 20 ); $offset = ($pageno - 1) * $per_page; $article_id = ( $_GET['article_id'] ? $_GET['article_id'] : "" ); $apvcDetailed = json_decode( $this->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; } ?>
apvc_get_version_info_block(); ?>
list ) > 0 ) { foreach ( $apvcDetailed->list as $reports ) { echo '' ; } } else { echo '' ; } ?>
' . $cnt++ . '
' . __( $reports->title, "apvc" ) . '
' . ucfirst( __( $reports->article_type, "apvc" ) ) . ' ' . __( $reports->user_type, "apvc" ) . ' ' . __( $reports->date, "apvc" ) . '
' . __( $reports->ip_address, "apvc" ) . '
' . __( "Browser: ", "apvc" ) . '' . ucwords( $reports->browser_short_name ) . '
' . __( "OS: ", "apvc" ) . '' . ucwords( $reports->operating_system ) . '
' . __( "Device: ", "apvc" ) . '' . ucwords( $reports->device_type ) . '
' . __( "Country: ", "apvc" ) . '' . ucwords( $reports->country ) . '
get_country_name( $reports->country ) ) . '.svg" alt="' . $reports->country . '" title="' . $reports->country . '">
' . __( $reports->http_referer_clean, "apvc" ) . '
' . __( $reports->http_referer, "apvc" ) . '
No Records Found
apvc_trending_page_content(); } else { if ( isset( $_GET['apvc_page'] ) && $_GET['apvc_page'] === 'reports' && !isset( $_GET['article_id'] ) ) { $this->apvc_reports_page_content(); } else { if ( isset( $_GET['apvc_page'] ) && isset( $_GET['article_id'] ) && $_GET['apvc_page'] === 'detailed-reports' && $_GET['article_id'] != '' ) { $this->apvc_detailed_reports_page_content(); } else { if ( 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(); } else { if ( isset( $_GET['apvc_page'] ) && isset( $_GET['country'] ) && $_GET['apvc_page'] === 'country_reports-list' && $_GET['country'] != '' ) { $this->country_reports_in_detailed__premium_only(); } else { if ( isset( $_GET['apvc_page'] ) && $_GET['apvc_page'] === 'settings' ) { $this->apvc_reports_settings_page(); } else { if ( isset( $_GET['apvc_page'] ) && $_GET['apvc_page'] === 'country_reports' ) { $this->country_reports__premium_only(); } else { if ( isset( $_GET['apvc_page'] ) && $_GET['apvc_page'] === 'shortcode_generator' ) { $this->apvc_shortcode_generator_page(); } else { if ( isset( $_GET['apvc_page'] ) && $_GET['apvc_page'] === 'export_data' ) { $this->apvc_export_data_page__premium_only(); } else { if ( isset( $_GET['apvc_page'] ) && $_GET['apvc_page'] === 'import_data' ) { $this->apvc_import_data_page__premium_only(); } else { if ( isset( $_GET['apvc_page'] ) && $_GET['apvc_page'] === 'cleanup_data' ) { $this->apvc_cleanup_data_page__premium_only(); } else { if ( isset( $_GET['apvc_page'] ) && $_GET['apvc_page'] === 'shortcode_library' ) { $this->apvc_shortcode_library(); } else { $this->apvc_settings_page_content(); } } } } } } } } } } } } ?>

' . __( 'OUR GREAT PLUGINS', 'apvc' ) . '

' ; ?>
  • 1.

    This plugin is very useful to hide admin bar based on selected user roles and user capabilities.

  • 2.

    This plugin is useful to Disable Block Editor default FullScreen mode in Latest WordPress 5.4+

  • 3.

    This plugin audits your site for specific security related checkpoints.

Checkout our website for special promo offers and discounts.
Visit Now
' ; } /** * Advanced Page Visit Counter Get reports settings data. * * @since 3.0.1 */ public function apvc_reports_settings_page() { global $wpdb, $post ; $avc_config = (object) get_option( "apvc_configurations", true ); ?>
apvc_get_version_info_block(); ?>
' . __( "Settings have been saved successfully", "apvc" ) . '
' ; } else { if ( isset( $_GET['m'] ) && $_GET['m'] === 'success' && isset( $_GET['t'] ) && $_GET['t'] === 'reset' ) { echo '' ; } } ?>

apvc_ip_address ) : '' ) ; ?>" />
apvc_exclude_counts ) : '' ) ; ?>" />
apvc_exclude_show_counter ) : '' ) ; ?>" />
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="Visits:" class="form-control">
" type="text" value="Today:" class="form-control">
" type="text" value="Total:" class="form-control">

apvc_atc_page_count[0] == "on" ) { echo "checked" ; } ?>>
apvc_show_global_count[0] == "on" ) { echo "checked" ; } ?>>
apvc_show_today_count[0] == "on" ) { echo "checked" ; } ?>>

*All color properties ignored if any template selected.
*More than 40 templates available in the Premium version of the plugin.", "apvc" ) ; ?>
apvc_get_premium_features_block(); ?>
$value ) { $rawFormData = explode( "=", $value ); if ( isset( $rawFormData[0] ) ) { $finalFormData[$rawFormData[0]][] = urldecode( trim( $rawFormData[1] ) ); } } update_option( "apvc_configurations", $finalFormData ); echo "success" ; wp_die(); } /** * Advanced Page Visit Counter Reset settings method. * * @since 3.0.1 */ public function apvc_reset_settings() { global $wpdb ; $finalFormData = array(); $finalFormData['apvc_post_types'] = array( 'post', 'page' ); $finalFormData['apvc_widget_width'] = array( 300 ); $finalFormData['apvc_default_label'] = array( 'Visits' ); $finalFormData['apvc_wid_alignment'] = array( 'center' ); $finalFormData['apvc_default_text_color'] = array( '#000000' ); $finalFormData['apvc_default_background_color'] = array( '#fffffff' ); $finalFormData['apvc_default_border_color'] = array( '#000000' ); $finalFormData['apvc_default_border_radius'] = array( 5 ); $finalFormData['apvc_default_border_width'] = array( 2 ); update_option( "apvc_configurations", $finalFormData ); echo "success" ; wp_die(); } /** * Advanced Page Visit Counter Reset data method. * * @since 3.0.1 */ public function apvc_reset_data() { global $wpdb ; $tbl_history = APVC_DATA_TABLE; $wpdb->query( "TRUNCATE TABLE {$tbl_history}" ); $wpdb->query( "DELETE FROM {$wpdb->postmeta} WHERE meta_key='count_start_from'" ); echo "success" ; wp_die(); } /** * Advanced Page Visit Counter Shortcode Generator Form. * * @since 3.0.1 */ public function apvc_shortcode_generator_page() { global $wpdb ; ?>
apvc_get_version_info_block(); ?>









*All color properties ignored if any template selected.
*More than 40 templates available in the Premium version of the plugin.", "apvc" ) ; ?>
$value ) { $rawFormData = explode( "=", $value ); if ( isset( $rawFormData[0] ) ) { $finalFormData[$rawFormData[0]][] = urldecode( trim( $rawFormData[1] ) ); } } $border_size = $finalFormData['border_size'][0]; $border_radius = $finalFormData['border_radius'][0]; $bg_color = $finalFormData['background_color'][0]; $font_size = $finalFormData['font_size'][0]; $font_style = $finalFormData['font_style'][0]; $font_color = $finalFormData['font_color'][0]; $border_style = $finalFormData['border_style'][0]; $border_color = $finalFormData['border_color'][0]; $counter_label = $finalFormData['counter_label'][0]; $today_counter_label = $finalFormData['today_counter_label'][0]; $global_counter_label = $finalFormData['global_counter_label'][0]; $padding = $finalFormData['padding'][0]; $width = $finalFormData['width'][0]; $shType = $finalFormData['shortcode_type'][0]; $shArticleID = $finalFormData['apvc_articles_list'][0]; $show_global_count = $finalFormData['show_global_count'][0]; $show_today_count = $finalFormData['show_today_count'][0]; $show_cr_pg_count = $finalFormData['show_cr_pg_count'][0]; $widget_template = $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 . '"'; } else { if ( $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 . '" ]'; ?>
get_results( "SELECT ID, post_title FROM {$wpdb->posts} WHERE post_type NOT IN('attachment','revision','nav_menu_item') AND post_status='publish'" ); $array = array(); $html = ''; foreach ( $allArticles as $article ) { $html .= ''; } echo $html ; wp_die(); } /** * Get column head title in wordpress admin * * @since 1.0.0 * * @return string */ public function apvc_columns_label( $defaults ) { $defaults['views'] = esc_html__( 'Views', "apvc" ); return $defaults; } /** * Get column head content in wordpress admin * * @param string $column_id * @param int $article_id * * @since 3.0.6 * */ public function apvc_columns_counts( $column_id, $article_id ) { global $wpdb ; $tbl_history = APVC_DATA_TABLE; if ( $column_id == 'views' ) { global $wpdb ; $post_result = get_post( $article_id ); if ( 'post' === $post_result->post_type ) { $type = 'post'; } else { $type = 'page'; } $totalVisits = $wpdb->get_var( "SELECT count(*) FROM " . APVC_DATA_TABLE . " WHERE article_id = {$article_id}" ); if ( $totalVisits ) { echo '' . esc_html( $totalVisits ) . '' ; } else { echo "0" ; } } } /** * Advanced Page Visit Counter Save posts meta for counter. * * @since 3.0.1 */ public function apvc_advanced_save_metaboxes( $post_id ) { global $wpdb ; $tbl_history = APVC_DATA_TABLE; $active_count = sanitize_text_field( $_POST["apvc_active_counter"] ); $reset_count = sanitize_text_field( $_POST["apvc_reset_cnt"] ); $start_count = sanitize_text_field( $_POST["count_start_from"] ); $widget_label = sanitize_text_field( $_POST["widget_label"] ); if ( empty($active_count) ) { $active_count = "Yes"; } update_post_meta( $post_id, "apvc_active_counter", $active_count ); update_post_meta( $post_id, "count_start_from", $start_count ); update_post_meta( $post_id, "widget_label", $widget_label ); if ( $reset_count == "Yes" ) { $wpdb->query( "DELETE FROM {$tbl_history} WHERE article_id={$post_id}" ); } } /** * Advanced Page Visit Counter Upgrade process method. * * @since 3.0.1 */ public function apvc_upgrader_process_complete() { $current_version = get_option( "apvc_version" ); // $this->apvc_migrate_from_old_version($current_version); update_option( "apvc_version", ADVANCED_PAGE_VISIT_COUNTER ); update_option( "apvc_newsletter", "show" ); } public function apvc_get_html_with_icon( $class ) { return '
Visits: 999
Today: 123
Total: 123
'; } public function apvc_get_html_without_icon( $class ) { return '
Visits: 999
Today: 123
Total: 123
'; } public function apvc_shortcode_library() { global $wpdb ; $shortcodes = json_decode( $this->apvc_get_shortcodes() ); ?>
apvc_get_version_info_block(); ?>
$value ) { $addClass = ( $value->class != '' ? $value->class : '' ); ?>

icon == 'yes' ? $this->apvc_get_html_with_icon( $key . " " . $addClass ) : $this->apvc_get_html_without_icon( $key . " " . $addClass ) ) ; ?>
div{color:#fff;display:inline-block;margin:0 30px}.template_3>div>span{font-weight:700;margin-left:10px}.template_3 .icons{color:#fff;margin-right:5px;font-weight:700}@media (max-width:644px){.template_3>div{margin:0 10px}}@media (max-width:525px){.template_3>div{color:#fff;display:block;margin:0;padding:10px 0;border-bottom:1px solid #fff}.template_3>div:last-child{border-bottom:none}}'; $shortcodes['template_6']['icon'] = 'yes'; $shortcodes['template_6']['class'] = 'effect2'; $shortcodes['template_6']['css'] = '.template_6{background:#764ba2;background:linear-gradient(90deg,#667eea 0,#764ba2 100%);padding:15px;margin:15px;border-radius:40px;border:2px solid #764ba2;font-family:calibri;font-size:13pt;text-align:center}.effect2{position:relative}.effect2:after{z-index:-1;position:absolute;content:"";bottom:15px;right:10px;left:auto;width:50%;top:50%;max-width:300px;background:#777;-webkit-box-shadow:0 15px 10px #777;-moz-box-shadow:0 15px 10px #777;box-shadow:0 15px 10px #777;-webkit-transform:rotate(4deg);-moz-transform:rotate(4deg);-o-transform:rotate(4deg);-ms-transform:rotate(4deg);transform:rotate(4deg)}.template_6>div{color:#fff;display:inline-block;margin:0 30px}.template_6>div>span{font-weight:700;margin-left:10px}.template_6 .icons{color:#fff;margin-right:5px;font-weight:700}@media (max-width:644px){.template_6>div{margin:0 10px}}@media (max-width:525px){.template_6>div{display:block;margin:0;padding:10px 0;border-bottom:1px solid #fcb8a1}.template_6>div:last-child{border-bottom:none}}'; $shortcodes['template_7']['icon'] = 'yes'; $shortcodes['template_7']['class'] = 'effect2'; $shortcodes['template_7']['css'] = '.template_7{background:#dfa579;background:linear-gradient(90deg,#c79081 0,#dfa579 100%);padding:15px;margin:15px;border-radius:40px;border:2px solid #dfa579;font-family:calibri;font-size:13pt;text-align:center}.effect2{position:relative}.effect2:after,.effect2:before{z-index:-1;position:absolute;content:"";bottom:25px;left:10px;width:50%;top:35%;max-width:300px;background:#000;-webkit-box-shadow:0 35px 20px #000;-moz-box-shadow:0 35px 20px #000;box-shadow:0 35px 20px #000;-webkit-transform:rotate(-7deg);-moz-transform:rotate(-7deg);-o-transform:rotate(-7deg);-ms-transform:rotate(-7deg);transform:rotate(-7deg)}.effect2:after{-webkit-transform:rotate(7deg);-moz-transform:rotate(7deg);-o-transform:rotate(7deg);-ms-transform:rotate(7deg);transform:rotate(7deg);right:10px;left:auto}.template_7>div{color:#fff;display:inline-block;margin:0 30px}.template_7>div>span{font-weight:700;margin-left:10px}.template_7 .icons{color:#fff;margin-right:5px;font-weight:700}@media (max-width:644px){.template_7>div{margin:0 10px}}@media (max-width:525px){.template_7>div{display:block;margin:0;padding:10px 0;border-bottom:1px solid #fcb8a1}.template_7>div:last-child{border-bottom:none}}'; $shortcodes['template_8']['icon'] = 'yes'; $shortcodes['template_8']['class'] = 'effect2'; $shortcodes['template_8']['css'] = '.template_8{background:#5fc3e4;background:linear-gradient(90deg,#e55d87 0,#5fc3e4 100%);padding:15px;margin:15px;border:2px solid #5fc3e4;font-family:calibri;font-size:13pt;text-align:center}.effect2{position:relative;-webkit-box-shadow:0 1px 4px rgba(0,0,0,.3),0 0 40px rgba(0,0,0,.1) inset;-moz-box-shadow:0 1px 4px rgba(0,0,0,.3),0 0 40px rgba(0,0,0,.1) inset;box-shadow:0 1px 4px rgba(0,0,0,.3),0 0 40px rgba(0,0,0,.1) inset}.effect2:after,.effect2:before{content:"";position:absolute;z-index:-1;-webkit-box-shadow:0 0 20px rgba(0,0,0,.8);-moz-box-shadow:0 0 20px rgba(0,0,0,.8);box-shadow:0 0 20px rgba(0,0,0,.8);top:0;bottom:0;left:10px;right:10px;-moz-border-radius:100px/10px;border-radius:100px/10px}.effect2:after{right:10px;left:auto;-webkit-transform:skew(8deg) rotate(3deg);-moz-transform:skew(8deg) rotate(3deg);-ms-transform:skew(8deg) rotate(3deg);-o-transform:skew(8deg) rotate(3deg);transform:skew(8deg) rotate(3deg)}.template_8>div{color:#fff;display:inline-block;margin:0 30px}.template_8>div>span{font-weight:700;margin-left:10px}.template_8 .icons{color:#fff;margin-right:5px;font-weight:700}@media (max-width:644px){.template_8>div{margin:0 10px}}@media (max-width:525px){.template_8>div{display:block;margin:0;padding:10px 0;border-bottom:1px solid #fff}.template_8>div:last-child{border-bottom:none}}'; $shortcodes['template_11']['icon'] = 'yes'; $shortcodes['template_11']['css'] = '.template_11{background:#2980b9;background:linear-gradient(225deg,#2980b9 0,#6dd5fa 50%,#fff 100%);padding:15px;margin:15px;border-radius:40px;border:2px solid #2980b9;font-family:calibri;font-size:13pt;text-align:center}.template_11>div{color:#1a1a1a;display:inline-block;margin:0 30px}.template_11>div>span{font-weight:700;margin-left:10px}.template_11 .icons{color:#1a1a1a;margin-right:5px;font-weight:700}@media (max-width:644px){.template_11>div{margin:0 10px}}@media (max-width:525px){.template_11>div{display:block;margin:0;padding:10px 0;border-bottom:1px solid #2980b9}.template_11>div:last-child{border-bottom:none}}'; $shortcodes['template_22']['icon'] = 'no'; $shortcodes['template_22']['css'] = '.template_22{background:#355c7d;background:linear-gradient(90deg,#355c7d 0,#6c5b7b 50%,#c06c84 100%);padding:15px;margin:15px;font-family:calibri;font-size:13pt;text-align:center;-webkit-box-shadow:0 10px 14px 0 rgba(0,0,0,.1);-moz-box-shadow:0 10px 14px 0 rgba(0,0,0,.1);box-shadow:0 10px 14px 0 rgba(0,0,0,.1)}.template_22>div{color:#fff;display:inline-block;margin:0 30px}.template_22>div>span{font-weight:700;margin-left:10px}@media (max-width:644px){.template_22>div{margin:0 10px}}@media (max-width:525px){.template_22>div{display:block;margin:0;padding:10px 0;border-bottom:1px solid #c06c84}.template_22>div:last-child{border-bottom:none}}'; $shortcodes['template_23']['icon'] = 'no'; $shortcodes['template_23']['css'] = '.template_23{background:#fc5c7d;background:linear-gradient(90deg,#fc5c7d 0,#6c5b7b 50%,#6a82fb 100%);padding:15px;margin:15px;font-family:calibri;font-size:13pt;text-align:center;-webkit-box-shadow:0 10px 14px 0 rgba(0,0,0,.1);-moz-box-shadow:0 10px 14px 0 rgba(0,0,0,.1);box-shadow:0 10px 14px 0 rgba(0,0,0,.1)}.template_23>div{color:#fff;display:inline-block;margin:0 30px}.template_23>div>span{font-weight:700;margin-left:10px}@media (max-width:644px){.template_23>div{margin:0 10px}}@media (max-width:525px){.template_23>div{display:block;margin:0;padding:10px 0;border-bottom:1px solid #c06c84}.template_23>div:last-child{border-bottom:none}}'; $shortcodes['template_24']['icon'] = 'no'; $shortcodes['template_24']['css'] = '.template_24{background:#fffbd5;background:linear-gradient(90deg,#fffbd5 0,#b20a2c 50%);padding:15px;margin:15px;font-family:calibri;font-size:13pt;text-align:center;-webkit-box-shadow:0 10px 14px 0 rgba(0,0,0,.1);-moz-box-shadow:0 10px 14px 0 rgba(0,0,0,.1);box-shadow:0 10px 14px 0 rgba(0,0,0,.1)}.template_24>div{color:#fff;display:inline-block;margin:0 30px}.template_24>div>span{font-weight:700;margin-left:10px}@media (max-width:644px){.template_24>div{margin:0 10px}}@media (max-width:525px){.template_24>div{display:block;margin:0;padding:10px 0;border-bottom:1px solid #fffbd5}.template_24>div:last-child{border-bottom:none}}'; $shortcodes['template_25']['icon'] = 'no'; $shortcodes['template_25']['css'] = '.template_25{background:#302b63;background:linear-gradient(90deg,#0f0c29 0,#7365ff 50%,#24243e 100%);padding:15px;margin:15px;font-family:calibri;font-size:13pt;text-align:center;-webkit-box-shadow:0 10px 14px 0 rgba(0,0,0,.1);-moz-box-shadow:0 10px 14px 0 rgba(0,0,0,.1);box-shadow:0 10px 14px 0 rgba(0,0,0,.1)}.template_25>div{color:#fff;display:inline-block;margin:0 30px}.template_25>div>span{font-weight:700;margin-left:10px}@media (max-width:644px){.template_25>div{margin:0 10px}}@media (max-width:525px){.template_25>div{display:block;margin:0;padding:10px 0;border-bottom:1px solid #0f0c29}.template_25>div:last-child{border-bottom:none}}'; $shortcodes['template_26']['icon'] = 'no'; $shortcodes['template_26']['css'] = '.template_26{background:#d3cce3;background:linear-gradient(90deg,#d3cce3 0,#e9e4f0 50%,#d3cce3 100%);padding:15px;margin:15px;font-family:calibri;font-size:13pt;text-align:center;-webkit-box-shadow:0 10px 14px 0 rgba(0,0,0,.1);-moz-box-shadow:0 10px 14px 0 rgba(0,0,0,.1);box-shadow:0 10px 14px 0 rgba(0,0,0,.1)}.template_26>div{color:#6a6279;display:inline-block;margin:0 30px}.template_26>div>span{font-weight:700;margin-left:10px}@media (max-width:644px){.template_26>div{margin:0 10px}}@media (max-width:525px){.template_26>div{display:block;margin:0;padding:10px 0;border-bottom:1px solid #7f7a8a}.template_26>div:last-child{border-bottom:none}}'; $shortcodes['template_29']['icon'] = 'no'; $shortcodes['template_29']['css'] = '.template_29{background:#6d6027;background:linear-gradient(90deg,#6d6027 0,#d3cbb8 80%,#3c3b3f 100%);padding:15px;margin:15px;font-family:calibri;font-size:13pt;text-align:center;-webkit-box-shadow:0 10px 14px 0 rgba(0,0,0,.2);-moz-box-shadow:0 10px 14px 0 rgba(0,0,0,.2);box-shadow:0 10px 14px 0 rgba(0,0,0,.2)}.template_29>div{color:#fff;display:inline-block;margin:0 30px}.template_29>div>span{font-weight:700;margin-left:10px}@media (max-width:644px){.template_29>div{margin:0 10px}}@media (max-width:525px){.template_29>div{display:block;margin:0;padding:10px 0;border-bottom:1px solid #00f260}.template_29>div:last-child{border-bottom:none}}'; $shortcodes['template_31']['icon'] = 'no'; $shortcodes['template_31']['css'] = '.template_31{background:#3a1c71;background:linear-gradient(90deg,#3a1c71 0,#d76d77 25%,#ffaf7b 50%);padding:15px;margin:15px;font-family:calibri;font-size:13pt;text-align:center;-webkit-box-shadow:0 10px 14px 0 rgba(0,0,0,.2);-moz-box-shadow:0 10px 14px 0 rgba(0,0,0,.2);box-shadow:0 10px 14px 0 rgba(0,0,0,.2)}.template_31>div{color:#1a1a1a;display:inline-block;margin:0 30px}.template_31>div>span{font-weight:700;margin-left:10px}@media (max-width:644px){.template_31>div{margin:0 10px}}@media (max-width:525px){.template_31>div{display:block;margin:0;padding:10px 0;border-bottom:1px solid #fff}.template_31>div:last-child{border-bottom:none}}'; $shortcodes['template_34']['icon'] = 'no'; $shortcodes['template_34']['css'] = '.template_34{background:#f7971e;background:linear-gradient(90deg,#f7971e 0,#ffd200 50%,#f7971e 1%);padding:15px;margin:15px;font-family:calibri;font-size:13pt;text-align:center;-webkit-box-shadow:0 10px 14px 0 rgba(0,0,0,.2);-moz-box-shadow:0 10px 14px 0 rgba(0,0,0,.2);box-shadow:0 10px 14px 0 rgba(0,0,0,.2)}.template_34>div{color:#1a1a1a;display:inline-block;margin:0 30px}.template_34>div>span{font-weight:700;margin-left:10px}@media (max-width:644px){.template_34>div{margin:0 10px}}@media (max-width:525px){.template_34>div{display:block;margin:0;padding:10px 0;border-bottom:1px solid #fff}.template_34>div:last-child{border-bottom:none}}'; $shortcodes['template_39']['icon'] = 'no'; $shortcodes['template_39']['css'] = '.template_39{background:#000;background:linear-gradient(90deg,#000 0,#b3cc2c 50%);padding:15px;margin:15px;font-family:calibri;font-size:13pt;text-align:center;-webkit-box-shadow:0 10px 14px 0 rgba(0,0,0,.2);-moz-box-shadow:0 10px 14px 0 rgba(0,0,0,.2);box-shadow:0 10px 14px 0 rgba(0,0,0,.2)}.template_39>div{color:#fff;display:inline-block;margin:0 30px}.template_39>div>span{font-weight:700;margin-left:10px}@media (max-width:644px){.template_39>div{margin:0 10px}}@media (max-width:525px){.template_39>div{display:block;margin:0;padding:10px 0;border-bottom:1px solid #fff}.template_39>div:last-child{border-bottom:none}}'; $shortcodes['template_40']['icon'] = 'no'; $shortcodes['template_40']['css'] = '.template_40{background:#ba8b02;background:linear-gradient(90deg,#ba8b02 0,#ffd65d 80%,#ba8b02 100%);padding:15px;margin:15px;font-family:calibri;font-size:13pt;text-align:center;-webkit-box-shadow:0 10px 14px 0 rgba(0,0,0,.2);-moz-box-shadow:0 10px 14px 0 rgba(0,0,0,.2);box-shadow:0 10px 14px 0 rgba(0,0,0,.2)}.template_40>div{color:#1a1a1a;display:inline-block;margin:0 30px}.template_40>div>span{font-weight:700;margin-left:10px}@media (max-width:644px){.template_40>div{margin:0 10px}}@media (max-width:525px){.template_40>div{display:block;margin:0;padding:10px 0;border-bottom:1px solid #fff}.template_40>div:last-child{border-bottom:none}}'; if ( !empty($shortcode) ) { return wp_json_encode( $shortcodes[$shortcode] ); } else { return wp_json_encode( $shortcodes ); } } /** * Advanced Page Visit Counter Migrate from older version. * * @since 3.0.1 */ public function apvc_migrate_from_old_version( $version ) { global $wpdb ; $version = get_option( "apvc_version" ); if ( $version != '3.0.0' && $version != '3.0.1' && $version != '3.0.2' && $version != '3.0.3' && $version != '3.0.4' && $version != '3.0.5' && $version != '3.0.6' ) { $newConfArray = array(); $avc_configNew = (object) get_option( "apvc_configurations", true ); $avc_config = json_decode( get_option( "avc_config", true ) ); foreach ( $avc_config as $key => $value ) { if ( $key == 'post_types' ) { $newConfArray['apvc_post_types'] = $value; } else { if ( $key == 'ip_address' ) { $ips = json_decode( $value ); foreach ( $ips as $ip ) { $newConfArray['apvc_ip_address'][] = $ip->tag; } } else { if ( $key == 'exclude_counts' ) { $exCounts = json_decode( $value ); foreach ( $exCounts as $exCount ) { $newConfArray['apvc_exclude_counts'][] = $exCount->tag; } } else { if ( $key == 'exclude_users' ) { $users = json_decode( $value ); foreach ( $users as $user ) { $newConfArray['apvc_exclude_users'][] = $user->tag; } } else { if ( $key == 'exclude_show_counter' ) { $exSCounts = json_decode( $value ); foreach ( $exSCounts as $exSCount ) { $newConfArray['apvc_exclude_show_counter'][] = $exSCount->tag; } } else { if ( $key == 'spam_controller' ) { $newConfArray['apvc_spam_controller'][0] = ( $value == "true" ? "on" : "" ); } else { if ( $key == 'show_conter_on_fron_side' ) { $newConfArray['apvc_show_conter_on_front_side'][0] = $value; } else { if ( $key == 'avc_default_text_color_of_counter' ) { $newConfArray['apvc_default_text_color'][0] = $value; } else { if ( $key == 'apv_default_label' ) { $newConfArray['apvc_default_label'][0] = $value; } else { if ( $key == 'apv_default_border_radius' ) { $newConfArray['apvc_default_border_radius'][0] = $value; } else { if ( $key == 'apv_default_background_color' ) { $newConfArray['apvc_default_background_color'][0] = $value; } else { if ( $key == 'apv_default_border_color' ) { $newConfArray['apvc_default_border_color'][0] = $value; } else { if ( $key == 'apv_default_border_width' ) { $newConfArray['apvc_default_border_width'][0] = $value; } else { if ( $key == 'wid_alignment' ) { $newConfArray['apvc_wid_alignment'][0] = $value; } else { if ( $key == 'show_today_count' ) { $newConfArray['apvc_show_today_count'][0] = ( $value == "true" ? "on" : "" ); } else { if ( $key == 'show_global_count' ) { $newConfArray['apvc_show_global_count'][0] = ( $value == "true" ? "on" : "" ); } else { if ( $key == 'widget_width' ) { $newConfArray['apvc_widget_width'][0] = $value; } } } } } } } } } } } } } } } } } } update_option( "apvc_configurations", $newConfArray ); } } }