Visitors Traffic Real Time Statistics - Version 1.17

Version Description

  1. bug fixing in RTL interface
  2. adding subscription box
Download this release

Release Info

Developer osamaesh
Plugin Icon 128x128 Visitors Traffic Real Time Statistics
Version 1.17
Comparing to
See all releases

Code changes from version 1.3 to 1.17

Files changed (124) hide show
  1. Visitors-Traffic-Real-Time-Statistics.php +131 -10
  2. WPHitsCounter.php +1031 -470
  3. ahc_about.php +0 -0
  4. ahc_help.php +0 -0
  5. ahc_settings.php +5 -0
  6. css/ar_css.css +1 -1
  7. css/en_newcss.css +0 -115
  8. css/eng_css.css +222 -0
  9. css/{en_css.css → engl_css.css} +120 -18
  10. css/jquery.jqplot.min.css +1 -0
  11. css/sweetalerts.css +1 -0
  12. database_basics_data.php +2 -1
  13. functions.php +2061 -1012
  14. images/247.png +0 -0
  15. images/24_7.ico +0 -0
  16. images/Icon-user.png +0 -0
  17. images/Spinner-1s-200px.svg +49 -0
  18. images/VisualEditor_-_Icon_-_Search.svg.png +0 -0
  19. images/browsers_nodata.png +0 -0
  20. images/contact-center-reporting-icon.png +0 -0
  21. images/decrease.png +0 -0
  22. images/down.png +0 -0
  23. images/increase.png +0 -0
  24. images/latestwords_nodata.png +0 -0
  25. images/live.gif +0 -0
  26. images/logo.png +0 -0
  27. images/myheaderbg.png +0 -0
  28. images/new_ticket_title.jpg +0 -0
  29. images/newticket.png +0 -0
  30. images/online.png +0 -0
  31. images/openW.jpg +0 -0
  32. images/openW.png +0 -0
  33. images/output_ZD6GUg-1-2.gif +0 -0
  34. images/plugin-1.png +0 -0
  35. images/plugin-2.png +0 -0
  36. images/plugin-3.png +0 -0
  37. images/plugin-4.png +0 -0
  38. images/plugin-5.png +0 -0
  39. images/plugin-6.png +0 -0
  40. images/recent_nodata.png +0 -0
  41. images/se_nodata.png +0 -0
  42. images/searchengin.png +0 -0
  43. images/searchengins.png +0 -0
  44. images/settings.jpg +0 -0
  45. images/stats.png +0 -0
  46. images/stats2.png +0 -0
  47. images/stats2.psd +0 -0
  48. images/stats3.png +0 -0
  49. images/topref_nodata.png +0 -0
  50. images/up.png +0 -0
  51. images/upgrade.png +0 -0
  52. images/visitors.png +0 -0
  53. images/visits.png +0 -0
  54. images/vtrts.png +0 -0
  55. images/vtrts_ads.gif +0 -0
  56. images/wordpress-plugins.png +0 -0
  57. init.php +55 -25
  58. js/ahc_jqscripts.js +358 -0
  59. js/front.js +59 -0
  60. js/jqplot.canvasAxisLabelRenderer.min.js +3 -0
  61. js/jqplot.canvasAxisTickRenderer.min.js +3 -0
  62. js/jqplot.canvasTextRenderer.min.js +3 -0
  63. js/jqplot.dateAxisRenderer.min.js +3 -0
  64. js/jqplot.enhancedLegendRenderer.min.js +3 -0
  65. js/jqplot.highlighter.min.js +3 -0
  66. js/jqplot.pieRenderer.min.js +3 -0
  67. js/jquery.jqplot.min.js +8 -0
  68. js/js.js +0 -183
  69. js/sweetalert.min.js +1 -0
  70. lang/ar_lang.php +23 -23
  71. lang/en_lang.php +23 -23
  72. lang/js/ar_lang.js +3 -3
  73. lang/js/en_lang.js +3 -3
  74. lib/Chart_js/.gitignore +0 -7
  75. lib/Chart_js/CONTRIBUTING.md +0 -20
  76. lib/Chart_js/Chart.js +0 -3379
  77. lib/Chart_js/Chart.min.js +5 -9
  78. lib/Chart_js/bower.json +0 -11
  79. lib/Chart_js/docs/00-Getting-Started.md +0 -200
  80. lib/Chart_js/docs/01-Line-Chart.md +0 -160
  81. lib/Chart_js/docs/02-Bar-Chart.md +0 -143
  82. lib/Chart_js/docs/03-Radar-Chart.md +0 -177
  83. lib/Chart_js/docs/04-Polar-Area-Chart.md +0 -172
  84. lib/Chart_js/docs/05-Pie-Doughnut-Chart.md +0 -158
  85. lib/Chart_js/docs/06-Advanced.md +0 -152
  86. lib/Chart_js/docs/07-Notes.md +0 -42
  87. lib/Chart_js/gulpfile.js +0 -131
  88. lib/Chart_js/package.json +0 -24
  89. lib/Chart_js/samples/bar.html +0 -48
  90. lib/Chart_js/samples/doughnut.html +0 -67
  91. lib/Chart_js/samples/line.html +0 -54
  92. lib/Chart_js/samples/pie.html +0 -58
  93. lib/Chart_js/samples/polar-area.html +0 -60
  94. lib/Chart_js/samples/radar.html +0 -53
  95. lib/Chart_js/src/Chart.Bar.js +0 -294
  96. lib/Chart_js/src/Chart.Core.js +0 -1943
  97. lib/Chart_js/src/Chart.Doughnut.js +0 -184
  98. lib/Chart_js/src/Chart.Line.js +0 -366
  99. lib/Chart_js/src/Chart.PolarArea.js +0 -248
  100. lib/Chart_js/src/Chart.Radar.js +0 -343
  101. lib/Chart_js/utils.js +147 -0
  102. lib/bootstrap/css/bootstrap-rtl.min.css +9 -0
  103. lib/bootstrap/css/bootstrap-theme.css +0 -457
  104. lib/bootstrap/css/bootstrap-theme.css.map +0 -1
  105. lib/bootstrap/css/bootstrap-theme.min.css +0 -5
  106. lib/bootstrap/css/bootstrap.css +0 -6358
  107. lib/bootstrap/css/bootstrap.css.map +0 -1
  108. lib/bootstrap/css/bootstrap.min.css +5 -3
  109. lib/bootstrap/js/bootstrap.js +0 -2276
  110. lib/bootstrap/js/bootstrap.min.js +6 -6
  111. lib/bootstrap/js/npm.js +0 -13
  112. lib/jscolor/arrow.gif +0 -0
  113. lib/jscolor/cross.gif +0 -0
  114. lib/jscolor/demo.html +12 -0
  115. lib/jscolor/hs.png +0 -0
  116. lib/jscolor/hv.png +0 -0
  117. lib/jscolor/jscolor.js +1010 -0
  118. license.txt +0 -674
  119. overview.php +419 -367
  120. readme.txt +71 -11
  121. screenshot-1.png +0 -0
  122. screenshot-7.png +0 -0
  123. settings.php +0 -13
  124. uninstall.php +27 -21
Visitors-Traffic-Real-Time-Statistics.php CHANGED
@@ -1,21 +1,142 @@
1
<?php
2
/*
3
- Plugin Name: Visitors Traffic Real Time Statistics
4
- Description: Hits counter that shows analytical numbers of your WordPress site visitors and hits. <a href="admin.php?page=ahc_hits_counter_menu">Dashboard</a> | <a href="http://www.wp-buy.com/product/visitors-traffic-real-time-statistics-pro">Upgrade to pro.</a>
5
Author: wp-buy
6
Author URI: https://www.wp-buy.com/
7
- Version: 1.3
8
-
9
*/
10
11
- define('AHC_PLUGIN_MAIN_FILE', __FILE__);
12
- define('AHC_PLUGIN_ROOT_DIR', dirname(__FILE__));
13
14
- require_once("functions.php");
15
- require_once("init.php");
16
17
- $path = plugin_basename( __FILE__ );
18
- add_action("after_plugin_row_{$path}", 'ahc_after_plugin_row', 10, 3);
19
20
//--------------------------------------------
21
?>
1
<?php
2
/*
3
+ Plugin Name: Visitor Traffic Real Time Statistics
4
+ Description: Hits counter that shows analytical numbers of your WordPress site visitors and hits.
5
Author: wp-buy
6
Author URI: https://www.wp-buy.com/
7
+ Version: 1.17
8
+ Text Domain: vtrts-free
9
+ Domain Path: /languages
10
*/
11
12
13
14
+
15
+ define('AHCFREE_PLUGIN_MAIN_FILE', __FILE__);
16
+ define('AHCFREE_PLUGIN_ROOT_DIR', dirname(__FILE__));
17
+
18
+ require_once(AHCFREE_PLUGIN_ROOT_DIR. "/functions.php");
19
+ require_once(AHCFREE_PLUGIN_ROOT_DIR."/init.php");
20
+
21
+ if( !function_exists('get_plugin_data') ){
22
+ include_once(ABSPATH . 'wp-includes/pluggable.php');
23
+
24
+ }
25
+
26
+
27
+ function ahcfree_plugin_action_links( $links ) {
28
+
29
+ $links = array_merge( array(
30
+ '<a href="' . esc_url( admin_url( '/admin.php?page=ahc_hits_counter_settings' ) ) . '">' . __( 'Settings', 'ahcfree' ) . '</a>',
31
+ '<a href="' . esc_url( admin_url( '/admin.php?page=ahc_hits_counter_menu_free' ) ) . '">' . __( 'Dashboard', 'ahcfree' ) . '</a>',
32
+ '<a target="_blank" href="' . esc_url('https://www.wp-buy.com/product/visitors-traffic-real-time-statistics-pro/' ) . '"><b style="color:green">' . __( 'Upgrade to PRO', 'ahcfree' ) . '</b></a>'
33
+
34
+ ), $links );
35
+
36
+ return $links;
37
+
38
+ }
39
+ add_action( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'ahcfree_plugin_action_links' );
40
+
41
+
42
+ if ( function_exists('get_plugin_data') ) {
43
+ $woodhl_detail = get_plugin_data( __FILE__ );
44
+ $installed_version = get_option( 'visitors-traffic-real-time-statistics-free-version' );
45
+ if( $installed_version != $woodhl_detail['Version'] ){
46
+ add_action( 'plugins_loaded', 'ahcfix_init' );
47
+ update_option( 'visitors-traffic-real-time-statistics-free-version', $woodhl_detail['Version'] );
48
+ }
49
+ }
50
+
51
+
52
+ function ahcfree_HideMessageAjaxFunction()
53
+ {
54
+ add_option( 'ahcfree_upgrade_message','yes');
55
+ }
56
+
57
+
58
+ function ahcfree_after_plugin_row($plugin_file, $plugin_data, $status) {
59
+
60
+ if(get_option('ahcfree_upgrade_message') !='yes')
61
+ {
62
+ $class_name = $plugin_data['slug'];
63
+
64
+ $upgradeMsg = '<tr id="' .$class_name. '-plugin-update-tr" class="plugin-update-tr active">';
65
+ $upgradeMsg .= '<td colspan="3" class="plugin-update">';
66
+ $upgradeMsg .= '<div id="' .$class_name. '-upgradeMsg" class="update-message" style="background:#FFF8E5; padding-left:10px; border-left:#FFB900 solid 4px" >';
67
+
68
+ $upgradeMsg .= 'You are running visitor traffic free. To get more features (<b style="color:red">Online users, GEO locations and visitors on the map</b>), you can <a href="https://www.wp-buy.com/product/visitors-traffic-real-time-statistics-pro/#plugins-page" target="_blank"><strong>upgrade now</strong></a> or ';
69
+
70
+ $upgradeMsg .= '<span id="HideMe" style="cursor:pointer" ><a href="javascript:void(0)"><strong>dismiss</strong></a> this message</span>';
71
+ $upgradeMsg .= '</div>';
72
+ $upgradeMsg .= '</td>';
73
+ $upgradeMsg .= '</tr>';
74
+
75
+
76
+ echo $upgradeMsg;
77
+ ?>
78
+
79
+ <script type="text/javascript">
80
+ jQuery(document).ready(function() {
81
+ var row = jQuery('#<?php echo $class_name;?>-plugin-update-tr').closest('tr').prev();
82
+ jQuery(row).addClass('update');
83
+
84
+
85
+ jQuery("#HideMe").click(function(){
86
+
87
+ jQuery("#<?php echo $class_name;?>-upgradeMsg").empty();
88
+ jQuery("#<?php echo $class_name;?>-upgradeMsg").removeAttr("style");
89
+
90
+ localStorage.setItem("vtrts_hide_upgrade_message", "hide_msg");
91
+
92
+
93
+ });
94
+
95
+ if(localStorage.getItem("vtrts_hide_upgrade_message") == "hide_msg")
96
+ {
97
+
98
+ jQuery("#<?php echo $class_name;?>-upgradeMsg").empty();
99
+ jQuery("#<?php echo $class_name;?>-upgradeMsg").removeAttr("style");
100
+ }
101
+
102
+ });
103
+ </script>
104
+
105
+
106
+ <?php
107
+
108
+ }
109
+ }
110
+
111
+ function ahcfree_row_meta( $meta_fields, $file ) {
112
+
113
+ if ( strpos($file,'Visitors-Traffic-Real-Time-Statistics.php') == false) {
114
+
115
+ return $meta_fields;
116
+ }
117
+
118
+ echo "<style>.pluginrows-rate-stars { display: inline-block; color: #ffb900; position: relative; top: 3px; }.pluginrows-rate-stars svg{ fill:#ffb900; } .pluginrows-rate-stars svg:hover{ fill:#ffb900 } .pluginrows-rate-stars svg:hover ~ svg{ fill:none; } </style>";
119
+
120
+ $plugin_rate = "https://wordpress.org/support/plugin/visitors-traffic-real-time-statistics/reviews/?rate=5#new-post";
121
+ $plugin_filter = "https://wordpress.org/support/plugin/visitors-traffic-real-time-statistics/reviews/?filter=5";
122
+ $svg_xmlns = "https://www.w3.org/2000/svg";
123
+ $svg_icon = '';
124
+
125
+ for ( $i = 0; $i < 5; $i++ ) {
126
+ $svg_icon .= "<svg xmlns='" . esc_url( $svg_xmlns ) . "' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-star'><polygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'/></svg>";
127
+ }
128
+
129
+ $meta_fields[] = '<a href="' . esc_url( $plugin_filter ) . '" target="_blank"><span class="dashicons dashicons-thumbs-up"></span>' . __( 'Vote!', 'pluginrows' ) . '</a>';
130
+ $meta_fields[] = "<a href='" . esc_url( $plugin_rate ) . "' target='_blank' title='" . esc_html__( 'Rate', 'pluginrows' ) . "'><i class='pluginrows-rate-stars'>" . $svg_icon . "</i></a>";
131
+
132
+ return $meta_fields;
133
+ }
134
+
135
+
136
+ $path = plugin_basename( __FILE__ );
137
+ add_action("after_plugin_row_{$path}", 'ahcfree_after_plugin_row', 10, 3);
138
+ add_action( 'wp_ajax_ahcfree_HideMessageAjaxFunction', 'ahcfree_HideMessageAjaxFunction' );
139
+ add_filter( 'plugin_row_meta', 'ahcfree_row_meta', 10, 4 );
140
141
//--------------------------------------------
142
?>
WPHitsCounter.php CHANGED
@@ -1,519 +1,1080 @@
1
<?php
2
3
- //use GeoIp2\Database\Reader;
4
-
5
- class WPHitsCounter{
6
-
7
- var $pageId;
8
- var $pageTitle;
9
- var $postType;
10
- var $ipAddress;
11
- var $ipIsUnknown;
12
- var $userAgent;
13
- var $referer;
14
- var $refererSite;
15
- var $browser;
16
- var $searchEngine;
17
- var $keyWords;
18
- var $requestUri;
19
20
21
- /**
22
- * Constructor
23
- *
24
- * @param integer $page_id
25
- * @param string $page_title Optional
26
- * @param string $post_type Optional
27
- */
28
- public function __construct($page_id, $page_title = NULL, $post_type = NULL){
29
- global $_SERVER;
30
- $this->ipAddress = ahc_get_client_ip_address();
31
- if($this->ipAddress == 'UNKNOWN'){
32
- $this->ipIsUnknown = true;
33
- $this->ipAddress = 'UNKNOWN'.uniqid();
34
- } else{
35
- $this->ipIsUnknown = false;
36
- }
37
38
- $this->userAgent = $_SERVER['HTTP_USER_AGENT'];
39
- $this->pageId = (isset($_GET['page_id'])) ? $_GET['page_id'] : $page_id;
40
- $this->pageTitle = $page_title;
41
- $this->postType = $post_type;
42
- $this->requestUri = trim($_SERVER['REQUEST_URI'], '/');
43
- if(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER'])){
44
- $hostName = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST);
45
- if($hostName != $_SERVER['SERVER_NAME']){
46
- $this->referer = $_SERVER['HTTP_REFERER'];
47
- $this->refererSite = $hostName;
48
- }
49
- }
50
- $this->searchEngine = NULL;
51
- $this->keyWords = NULL;
52
}
53
//--------------------------------------------
54
- /**
55
- * Trace visitor hit
56
- *
57
- * @return void
58
- */
59
- public function traceVisitorHit(){
60
- $this->cleanUnwantedRecords();
61
- $this->cleanHitsTable();
62
- if(!$this->isHitRecorded()){
63
- $visitorRecorded = $this->isVisitorRecorded();
64
- $this->getBrowser();
65
- usleep(10000);
66
- if(!empty($this->refererSite)){
67
- $this->getSearchEngine();
68
- }
69
-
70
- if(!$this->isTodayPreparedInDb()){
71
- $this->PrepareForTodayInDb();
72
- }
73
-
74
- if(!$visitorRecorded){
75
- $this->updateVisitsTime(1, 1);
76
- $this->updateVisitors(1, 1);
77
- } else{
78
- $this->updateVisitsTime(0, 1);
79
- $this->updateVisitors(0, 1);
80
- }
81
-
82
- if(!empty($this->pageId) && !empty($this->pageTitle) && $this->postType == 'post'){
83
- $this->updateTitleTraffic($this->pageId, $this->pageTitle);
84
- }
85
-
86
- if(!empty($this->keyWords) && !empty($this->searchEngine)){
87
- $this->updateKeywords($this->ipAddress, $this->keyWords, $this->referer, $this->searchEngine, $this->browser);
88
- }
89
-
90
- if(!empty($this->refererSite)){
91
- $this->updateReferingSites($this->refererSite);
92
- }
93
-
94
- if(!empty($this->searchEngine)){
95
- $this->updateSearchingVisits($this->searchEngine);
96
- }
97
-
98
- $this->updateBrowsers($this->browser);
99
-
100
- if(!$visitorRecorded){
101
- $this->updateRecentVisitors($this->ipAddress, $this->referer, $this->searchEngine, $this->browser);
102
- }
103
-
104
- $this->recordThisHits();
105
- }
106
- }
107
//--------------------------------------------
108
- /**
109
- * Is visit is already recorded
110
- *
111
- * @return boolean
112
- */
113
- protected function isHitRecorded(){
114
- global $wpdb;
115
- $sql = "SELECT COUNT(`hit_id`) AS ct FROM `ahc_hits` WHERE DATE(`hit_date`) = DATE(NOW()) AND `hit_ip_address` = %s AND `hit_page_id` = %s";
116
- $result = $wpdb->get_results($wpdb->prepare($sql, $this->ipAddress, $this->pageId) , OBJECT);
117
- if($result !== false){
118
- return ((int) $result[0]->ct > 0);
119
}
120
}
121
//--------------------------------------------
122
- /**
123
- * Is visitor is already recorded
124
- *
125
- * @return boolean
126
- */
127
- protected function isVisitorRecorded(){
128
- global $wpdb;
129
- $sql = "SELECT COUNT(`hit_id`) AS ct FROM `ahc_hits` WHERE DATE(`hit_date`) = DATE(NOW()) AND `hit_ip_address` = %s";
130
- $result = $wpdb->get_results($wpdb->prepare($sql, $this->ipAddress), OBJECT);
131
- if($result !== false){
132
- return ((int) $result[0]->ct > 0);
133
- }
134
}
135
//--------------------------------------------
136
- /**
137
- * Detect client browser
138
- *
139
- * @return void
140
- */
141
- protected function getBrowser(){
142
- if(strpos($this->userAgent, 'MSIE') !== false){
143
- $this->browser = 1;
144
- }
145
- elseif(strpos($this->userAgent, 'Trident') !== false){
146
- $this->browser = 1;
147
- }
148
- elseif(strpos($this->userAgent, 'Gecko') !== false){
149
- if(strpos($this->userAgent, 'Firefox') !== false){
150
- $this->browser = 2;
151
- }
152
- elseif(strpos($this->userAgent, 'Netscape') !== false){
153
- $this->browser = 3;
154
- }
155
- elseif(strpos($this->userAgent, 'Chrome') !== false){
156
- $this->browser = 4;
157
- }
158
- else{
159
- $this->browser = 5;
160
- }
161
- }
162
- elseif(strpos($this->userAgent, 'Opera Mini') !== false){
163
- $this->browser = 6;
164
- }
165
- elseif(strpos($this->userAgent, 'Opera') !== false){
166
- $this->browser = 7;
167
- }
168
- elseif(strpos($this->userAgent, 'Safari') !== false){
169
- $this->browser = 8;
170
- }
171
- elseif(strpos($this->userAgent, 'iPad') !== false){
172
- $this->browser = 9;
173
- }
174
- elseif(strpos($this->userAgent, 'Android') !== false){
175
- $this->browser = 10;
176
- }
177
- elseif(strpos($this->userAgent, 'AIR') !== false){
178
- $this->browser = 11;
179
- }
180
- elseif(strpos($this->userAgent, 'Fluid') !== false){
181
- $this->browser = 12;
182
- }
183
- elseif(strpos($this->userAgent, 'Maxthon') !== false){
184
- $this->browser = 13;
185
- }
186
- else{
187
- $this->browser = 14;
188
- }
189
}
190
//--------------------------------------------
191
- /**
192
- * Detect search engine
193
- *
194
- * @uses wpdb::prepare()
195
- * @uses wpdb::get_results()
196
- *
197
- * @return void
198
- */
199
- protected function getSearchEngine(){
200
- global $wpdb;
201
- $sql = "SELECT `srh_id`, `srh_query_parameter`, `srh_identifier` FROM `ahc_search_engines`";
202
- $results = $wpdb->get_results($sql, OBJECT);
203
- if($results !== false){
204
- foreach($results as $s){
205
- if(strpos($this->referer, $s->srh_identifier.'.') !== false){
206
- $this->searchEngine = $s->srh_id;
207
- $this->getKeyWords($s->srh_query_parameter);
208
- }
209
- }
210
- }
211
}
212
//--------------------------------------------
213
- /**
214
- * Detect search engine
215
- *
216
- * @uses wpdb::prepare()
217
- * @uses wpdb::get_results()
218
- *
219
- * @return void
220
- */
221
- protected function getKeyWords($query_param){
222
- $query = parse_url($this->referer, PHP_URL_QUERY);
223
- $query = rawurldecode($query);
224
- $arr = array();
225
- parse_str($query, $arr);
226
- if(isset($arr[$query_param])){
227
- $this->keyWords = $arr[$query_param];
228
- }
229
}
230
- //--------------------------------------------
231
- /**
232
- * Is there a record prepared for today's visits
233
- *
234
- * @uses wpdb::get_results()
235
- *
236
- * @return boolean
237
- */
238
- protected function isTodayPreparedInDb(){
239
- global $wpdb;
240
- $sql = "SELECT COUNT(`vst_id`) AS ct FROM `ahc_visitors` WHERE DATE(`vst_date`) = DATE(NOW())";
241
- $result = $wpdb->get_results($sql, OBJECT);
242
- if($result !== false){
243
- return ((int) $result[0]->ct > 0);
244
- }
245
}
246
//--------------------------------------------
247
- /**
248
- * Prepared a record for today's visits
249
- *
250
- * @uses wpdb::query()
251
- *
252
- * @return boolean
253
- */
254
- protected function PrepareForTodayInDb(){
255
- global $wpdb;
256
- $sql = "INSERT INTO `ahc_visitors` (`vst_date`, `vst_visitors`, `vst_visits`) VALUES (NOW(), 0, 0)";
257
- if($wpdb->query($sql) !== false){
258
- return true;
259
- }
260
- return false;
261
- }
262
//--------------------------------------------
263
- /**
264
- * Clean daily hits table
265
- *
266
- * @uses wpdb::query()
267
- *
268
- * @return boolean
269
- */
270
- protected function cleanHitsTable(){
271
- global $wpdb;
272
- $sql = "DELETE FROM `ahc_hits` WHERE DATE(`hit_date`) <> DATE(NOW())";
273
- if($wpdb->query($sql) !== false){
274
- return true;
275
- } else{
276
- return false;
277
}
278
}
279
//--------------------------------------------
280
- /**
281
- * Update browser visits
282
- *
283
- * @uses wpdb::prepare()
284
- * @uses wpdb::query()
285
- *
286
- * @param integer $bsr_id
287
- * @return boolean
288
- */
289
- protected function updateBrowsers($bsr_id){
290
- global $wpdb;
291
- $sql = "UPDATE `ahc_browsers` SET bsr_visits = bsr_visits + 1 WHERE bsr_id = %d";
292
- if($wpdb->query($wpdb->prepare($sql, $bsr_id)) !== false){
293
- return true;
294
- }
295
- return false;
296
}
297
//--------------------------------------------
298
- /**
299
- * Update visits sum order by search engine
300
- *
301
- * @uses wpdb::prepare()
302
- * @uses wpdb::get_results()
303
- * @uses wpdb::query()
304
- *
305
- * @param integer $srh_id
306
- * @return boolean
307
- */
308
- protected function updateSearchingVisits($srh_id){
309
- global $wpdb;
310
- $sql = "SELECT vtsh_id FROM `ahc_searching_visits` WHERE srh_id = %d AND DATE(vtsh_date) = DATE(NOW())";
311
- $result = $wpdb->get_results($wpdb->prepare($sql, $srh_id), OBJECT);
312
- if($result !== false){
313
- if($wpdb->num_rows > 0){
314
- $sql2 = "UPDATE `ahc_searching_visits` SET vtsh_visits = vtsh_visits + 1 WHERE vtsh_id = %d";
315
- return ($wpdb->query($wpdb->prepare($sql2, $result[0]->vtsh_id)) !== false);
316
- } else{
317
- $sql2 = "INSERT INTO `ahc_searching_visits` (srh_id, vtsh_date, vtsh_visits)
318
- VALUES (%d, NOW(), 1)";
319
- return ($wpdb->query($wpdb->prepare($sql2, $srh_id)) !== false);
320
- }
321
- } else{
322
- return false;
323
- }
324
}
325
//--------------------------------------------
326
- /**
327
- * Update visitors count
328
- *
329
- * @uses wpdb::prepare()
330
- * @uses wpdb::query()
331
- *
332
- * @param integer $visitors Optional
333
- * @param integer $visits Optional
334
- * @return boolean
335
- */
336
- protected function updateVisitors($visitors = 0, $visits = 0){
337
- global $wpdb;
338
- $sql = "UPDATE `ahc_visitors` SET vst_visitors = vst_visitors + %d, vst_visits = vst_visits + %d
339
- WHERE DATE(vst_date) = DATE(NOW())";
340
- return ($wpdb->query($wpdb->prepare($sql, $visitors, $visits)) !== false);
341
}
342
//--------------------------------------------
343
- /**
344
- * Update referring sites visits table
345
- *
346
- * @uses wpdb::prepare()
347
- * @uses wpdb::query()
348
- * @uses wpdb::get_results()
349
- *
350
- * @param string $rfr_site_name. referring site name
351
- * @return boolean
352
- */
353
- protected function updateReferingSites($rfr_site_name){
354
- global $wpdb;
355
- $sql = "SELECT rfr_id FROM `ahc_refering_sites` where rfr_site_name = %s";
356
- $result = $wpdb->get_results($wpdb->prepare($sql, $rfr_site_name), OBJECT);
357
- if($result !== false){
358
- if(!empty($result)){
359
- $sql2 = "UPDATE `ahc_refering_sites` SET rfr_visits = rfr_visits + 1 WHERE rfr_id = %d";
360
- return ($wpdb->query($wpdb->prepare($sql2, $result[0]->rfr_id)) !== false);
361
- } else{
362
- $sql2 = "INSERT INTO `ahc_refering_sites` (rfr_site_name, rfr_visits)
363
- VALUES(%s, 1)";
364
- return ($wpdb->query($wpdb->prepare($sql2, $rfr_site_name)) !== false);
365
- }
366
- } else{
367
- return false;
368
- }
369
}
370
//--------------------------------------------
371
- /**
372
- * Update recent visitors table
373
- *
374
- * @uses wpdb::prepare()
375
- * @uses wpdb::query()
376
- *
377
- * @param string $vtr_ip_address. IP address
378
- * @param string $vtr_referer Optional. Referring site name
379
- * @param integer $srh_id Optional. Search engine ID
380
- * @param integer $bsr_id Optional. Browser ID
381
- * @param integer $ctr_id Optional. Country ID
382
- * @return boolean
383
- */
384
- protected function updateRecentVisitors($vtr_ip_address, $vtr_referer = '', $srh_id = NULL, $bsr_id = NULL, $ctr_id = NULL){
385
- global $wpdb;
386
- $sql = "INSERT INTO `ahc_recent_visitors` (vtr_ip_address, vtr_referer, srh_id, bsr_id, ctr_id, vtr_date, vtr_time)
387
- VALUES (%s, %s, %d, %d, %d, NOW(), NOW())";
388
- return ($wpdb->query($wpdb->prepare($sql, $vtr_ip_address, $vtr_referer, $srh_id, $bsr_id, $ctr_id)) !== false);
389
}
390
//--------------------------------------------
391
- /**
392
- * Update key words table
393
- *
394
- * @uses wpdb::prepare()
395
- * @uses wpdb::query()
396
- *
397
- * @param string $vtr_ip_address. IP address
398
- * @param string $kwd_keywords. Key word
399
- * @param string $kwd_referer. Referring site name.
400
- * @param integer $srh_id. Search engine ID
401
- * @param integer $bsr_id. Browser ID
402
- * @return boolean
403
- */
404
- protected function updateKeywords($kwd_ip_address, $kwd_keywords, $kwd_referer, $srh_id, $bsr_id){
405
- global $wpdb;
406
- $sql = "INSERT INTO `ahc_keywords` (kwd_ip_address, kwd_keywords, kwd_referer, srh_id, bsr_id, kwd_date, kwd_time)
407
- VALUES (%s, %s, %s, %d, %d, NOW(), NOW())";
408
- return ($wpdb->query($wpdb->prepare($sql, $kwd_ip_address, $kwd_keywords, $kwd_referer, $srh_id, $bsr_id)) !== false);
409
}
410
//--------------------------------------------
411
- /**
412
- * Clean unwanted records. Only keeping a limit of fresh records. Limit is set by AHC_RECENT_VISITORS_LIMIT
413
- *
414
- * @uses wpdb::prepare()
415
- * @uses wpdb::get_results()
416
- * @uses wpdb::query()
417
- *
418
- * @return boolean
419
*/
420
- protected function cleanUnwantedRecords(){
421
- global $wpdb;
422
- $sql11 = "SELECT vtr_id FROM `ahc_recent_visitors` ORDER BY vtr_id LIMIT %d";
423
- $result = $wpdb->get_results($wpdb->prepare($sql11, AHC_RECENT_VISITORS_LIMIT), OBJECT);
424
- if($result !== false){
425
- $ids1 = array();
426
- $length = count($result);
427
- foreach($result as $r){
428
- $ids1[] = $r->vtr_id;
429
- }
430
- $ids1 = implode(',', $ids1);
431
- $sql12 = "DELETE FROM `ahc_recent_visitors`".((!empty($ids1))? " WHERE vtr_id NOT IN (".$ids1.")" : "");
432
-
433
- $sql21 = "SELECT kwd_id FROM `ahc_keywords` ORDER BY kwd_id LIMIT %d";
434
- $result2 = $wpdb->get_results($wpdb->prepare($sql21, AHC_RECENT_KEYWORDS_LIMIT), OBJECT);
435
- if($result2 !== false){
436
- $ids2 = array();
437
- foreach($result2 as $r){
438
- $ids2[] = $r->kwd_id;
439
- }
440
- $ids2 = implode(',', $ids2);
441
- $sql22 = "DELETE FROM `ahc_keywords`".((!empty($ids2))? " WHERE kwd_id NOT IN (".$ids2.")" : "");
442
-
443
- if($wpdb->query($sql12) !== false){
444
- return ($wpdb->query($sql22) !== false);
445
- }
446
- }
447
}
448
- return false;
449
}
450
//--------------------------------------------
451
- /**
452
- * Update traffic by title table
453
- *
454
- * @uses wpdb::prepare()
455
- * @uses wpdb::get_results()
456
- * @uses wpdb::query()
457
- *
458
- * @param integer $til_page_id
459
- * @param string $til_page_title
460
- * @return boolean
461
- */
462
- protected function updateTitleTraffic($til_page_id, $til_page_title){
463
- global $wpdb;
464
- $sql = "SELECT til_id FROM `ahc_title_traffic` where til_page_id = %s";
465
- $result = $wpdb->get_results($wpdb->prepare($sql, $til_page_id), OBJECT);
466
- if($result !== false){
467
- if(!empty($result)){
468
- $sql2 = "UPDATE `ahc_title_traffic`
469
SET til_hits = til_hits + 1, til_page_title = %s
470
WHERE til_id = %d";
471
- return ($wpdb->query($wpdb->prepare($sql2, $til_page_title, $result[0]->til_id)) !== false);
472
- } else{
473
- $sql2 = "INSERT INTO `ahc_title_traffic` (til_page_id, til_page_title, til_hits)
474
VALUES(%s, %s, 1)";
475
- return ($wpdb->query($wpdb->prepare($sql2, $til_page_id, $til_page_title)) !== false);
476
- }
477
- } else{
478
- return false;
479
- }
480
}
481
//--------------------------------------------
482
- /**
483
- * Update visitor's & visits' times table
484
- *
485
- * @uses wpdb::prepare()
486
- * @uses wpdb::query()
487
- *
488
- * @param integer $visitors Optional
489
- * @param integer $visits Optional
490
- * @return boolean
491
- */
492
- protected function updateVisitsTime($visitors = 0, $visits = 0){
493
- global $wpdb;
494
- $sql = "UPDATE `ahc_visits_time` SET vtm_visitors = vtm_visitors + %d, vtm_visits = vtm_visits + %d
495
- WHERE TIME(vtm_time_from) <= TIME(NOW()) AND TIME(vtm_time_to) >= TIME(NOW())";
496
- return ($wpdb->query($wpdb->prepare($sql, $visitors, $visits)) !== false);
497
- }
498
//--------------------------------------------
499
- /**
500
- * Record (insert) the visit
501
- *
502
- * @uses wpdb::prepare()
503
- * @uses wpdb::query()
504
- *
505
- * @return boolean
506
- */
507
- protected function recordThisHits(){
508
- global $wpdb;
509
- $sql = "INSERT INTO `ahc_hits`
510
- (`hit_ip_address`, `hit_user_agent`, `hit_request_uri`, `hit_page_id`, `hit_page_title`, `hit_referer`, `hit_referer_site`,
511
`srh_id`, `hit_search_words`, `bsr_id`, `hit_date`, `hit_time`)
512
- VALUES (%s, %s, %s, %s, %s, %s, %s, %d, %s, %d, NOW(), NOW())";
513
- $result = $wpdb->query($wpdb->prepare($sql, $this->ipAddress, $this->userAgent, $this->requestUri, $this->pageId, $this->pageTitle,
514
- $this->referer, $this->refererSite, $this->searchEngine, $this->keyWords, $this->browser));
515
- return ($result !== false);
516
- }
517
//--------------------------------------------
518
}
519
- ?>
1
<?php
2
3
+ class AHCFree_WPHitsCounterPro {
4
+
5
+ var $pageId;
6
+ var $pageTitle;
7
+ var $postType;
8
+ var $ipAddress;
9
+ var $ipIsUnknown;
10
+ var $userAgent;
11
+ var $referer;
12
+ var $refererSite;
13
+ var $browser;
14
+ var $searchEngine;
15
+ var $countryInternetCode;
16
+ var $countryId;
17
+ var $keyWords;
18
+ var $requestUri;
19
+
20
+ /**
21
+
22
+ * Constructor
23
+
24
+ *
25
+
26
+ * @param integer $page_id
27
+
28
+ * @param string $page_title Optional
29
+
30
+ * @param string $post_type Optional
31
+
32
+ */
33
+ public function __construct($page_id, $page_title = NULL, $post_type = NULL) {
34
+
35
+ global $_SERVER;
36
+
37
+ $this->ipAddress = ahcfree_get_client_ip_address();
38
+
39
+
40
+ if ($this->ipAddress == 'UNKNOWN') {
41
+
42
+ $this->ipIsUnknown = true;
43
+
44
+ $this->ipAddress = 'UNKNOWN' . uniqid();
45
+ } else {
46
+
47
+ $this->ipIsUnknown = false;
48
+ }
49
+
50
+
51
+
52
+ $this->userAgent = $_SERVER['HTTP_USER_AGENT'];
53
+
54
+ $this->pageId = (isset($page_id)) ? $page_id : $_GET['page_id'];
55
+
56
+ $this->pageTitle = $page_title;
57
+
58
+ $this->postType = $post_type;
59
60
+ $this->requestUri = trim($_SERVER['REQUEST_URI'], '/');
61
62
+ //$post_permalink = get_the_permalink($this->pageId);
63
+ //$protocol_arr = array('http://','https://','www.');
64
+ //$link = str_replace($protocol_arr,'',$post_permalink);
65
+ //$this->requestUri = trim(str_replace($_SERVER['HTTP_HOST'],'',$link),'/');
66
67
+ if (isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER'])) {
68
+
69
+ $hostName = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST);
70
+
71
+ if ($hostName != $_SERVER['SERVER_NAME']) {
72
+
73
+ $this->referer = $_SERVER['HTTP_REFERER'];
74
+
75
+ $this->refererSite = $hostName;
76
+ }
77
}
78
+
79
+ $this->searchEngine = NULL;
80
+
81
+ $this->keyWords = NULL;
82
+
83
+ $this->countryId = NULL;
84
+ }
85
+
86
//--------------------------------------------
87
//--------------------------------------------
88
+
89
+ /**
90
+
91
+ * Trace visitor hit
92
+
93
+ *
94
+
95
+ * @return void
96
+
97
+ */
98
+ public function traceVisitorHit() {
99
+
100
+ //$this->cleanUnwantedRecords();
101
+
102
+ $this->cleanHitsTable();
103
+
104
+ if (!$this->isHitRecorded()) {
105
+
106
+ $visitorRecorded = $this->isVisitorRecorded();
107
+
108
+ $this->getBrowser();
109
+
110
+ usleep(1000);
111
+
112
+ if (!empty($this->refererSite)) {
113
+
114
+ $this->getSearchEngine();
115
+ }
116
+
117
+
118
+ /*
119
+ if (!$this->isTodayPreparedInDb()) {
120
+
121
+ $this->PrepareForTodayInDb();
122
+ }*/
123
+
124
+
125
+
126
+ if (!$visitorRecorded) {
127
+
128
+ $this->updateVisitsTime(1, 1);
129
+
130
+ $this->updateVisitors(1, 1);
131
+ } else {
132
+
133
+ $this->updateVisitsTime(0, 1);
134
+
135
+ $this->updateVisitors(0, 1);
136
+ }
137
+
138
+
139
+ if (!empty($this->pageId) && !empty($this->pageTitle) && ($this->postType == 'post' or $this->postType == 'product' or $this->postType == 'page')) {
140
+
141
+
142
+
143
+ $this->updateTitleTraffic($this->pageId, $this->pageTitle);
144
+ }
145
+
146
+
147
+
148
+ if (!empty($this->keyWords) && !empty($this->searchEngine)) {
149
+
150
+ $this->updateKeywords($this->ipAddress, $this->keyWords, $this->referer, $this->searchEngine, $this->browser, $this->countryId);
151
+ }
152
+
153
+
154
+
155
+ if (!empty($this->refererSite)) {
156
+
157
+ $this->updateReferingSites($this->refererSite);
158
+ }
159
+
160
+
161
+
162
+ if (!empty($this->searchEngine)) {
163
+
164
+ $this->updateSearchingVisits($this->searchEngine);
165
+ }
166
+
167
+
168
+
169
+ if (!empty($this->countryId)) {
170
+
171
+ if ($visitorRecorded) {
172
+
173
+ $this->updateCountries($this->countryId, 0, 1);
174
+ } else {
175
+
176
+ $this->updateCountries($this->countryId, 1, 1);
177
}
178
+ }
179
+
180
+ $this->updateBrowsers($this->browser);
181
+
182
+
183
+
184
+ if (!$visitorRecorded) {
185
+
186
+ $this->updateRecentVisitors($this->ipAddress, $this->referer, $this->searchEngine, $this->browser, $this->countryId);
187
+ }
188
+
189
+
190
+
191
+ $this->recordThisHits();
192
}
193
+ }
194
+
195
//--------------------------------------------
196
+
197
+ /**
198
+
199
+ * Is visit is already recorded
200
+
201
+ *
202
+
203
+ * @return boolean
204
+
205
+ */
206
+ protected function isHitRecorded() {
207
+
208
+ global $wpdb;
209
+ $custom_timezone_offset = ahcfree_get_current_timezone_offset();
210
+
211
+ $wpdb->insert(
212
+ 'ahc_online_users',
213
+ array(
214
+ 'date' => date('Y-m-d H:i:s'),
215
+ 'hit_ip_address' => $this->ipAddress,
216
+ 'hit_page_id' => $this->pageId,
217
+ )
218
+ );
219
+
220
+ $sql = "SELECT COUNT(`hit_id`) AS ct FROM `ahc_hits` WHERE DATE(`hit_date`) = '". date("Y-m-d") ."' AND `hit_ip_address` = %s AND `hit_page_id` = %s";
221
+
222
+ //$sql = "SELECT COUNT(`hit_id`) AS ct FROM `ahc_hits` WHERE DATE(CONVERT_TZ(CONCAT_WS(' ',hit_date,hit_time),'" . AHCFREE_SERVER_CURRENT_TIMEZONE . "','" . $custom_timezone_offset . "')) = DATE(CONVERT_TZ(NOW( ),'" . AHCFREE_SERVER_CURRENT_TIMEZONE . "','" . $custom_timezone_offset . "')) AND `hit_ip_address` = %s AND `hit_page_id` = %s";
223
+
224
+ $result = $wpdb->get_results($wpdb->prepare($sql, $this->ipAddress, $this->pageId), OBJECT);
225
+
226
+ if ($result !== false) {
227
+
228
+ return ((int) $result[0]->ct > 0);
229
}
230
+ }
231
+
232
//--------------------------------------------
233
+
234
+ /**
235
+
236
+ * Is visitor is already recorded
237
+
238
+ *
239
+
240
+ * @return boolean
241
+
242
+ */
243
+ protected function isVisitorRecorded() {
244
+
245
+ global $wpdb;
246
+
247
+ $custom_timezone_offset = ahcfree_get_current_timezone_offset();
248
+
249
+ $sql = "SELECT COUNT(`hit_id`) AS ct FROM `ahc_hits` WHERE DATE(`hit_date`) = '". date("Y-m-d") ."' AND `hit_ip_address` = %s";
250
+
251
+ //$sql = "SELECT COUNT(`hit_id`) AS ct FROM `ahc_hits` WHERE DATE(CONVERT_TZ(CONCAT_WS(' ',hit_date,hit_time),'" . AHCFREE_SERVER_CURRENT_TIMEZONE . "','" . $custom_timezone_offset . "')) = DATE(CONVERT_TZ(NOW( ),'" . AHCFREE_SERVER_CURRENT_TIMEZONE . "','" . $custom_timezone_offset . "')) AND `hit_ip_address` = %s";
252
+
253
+ $result = $wpdb->get_results($wpdb->prepare($sql, $this->ipAddress), OBJECT);
254
+ if ($result !== false) {
255
+
256
+ return ((int) $result[0]->ct > 0);
257
}
258
+ }
259
+
260
//--------------------------------------------
261
+
262
+ /**
263
+
264
+ * Detect client browser
265
+
266
+ *
267
+
268
+ * @return void
269
+
270
+ */
271
+ protected function getBrowser() {
272
+
273
+ if (strpos($this->userAgent, 'MSIE') !== false) {
274
+
275
+ $this->browser = 1;
276
+ } elseif (strpos($this->userAgent, 'Trident') !== false) {
277
+
278
+ $this->browser = 1;
279
+ } elseif (strpos($this->userAgent, 'Gecko') !== false) {
280
+
281
+ if (strpos($this->userAgent, 'Firefox') !== false) {
282
+
283
+ $this->browser = 2;
284
+ } elseif (strpos($this->userAgent, 'Netscape') !== false) {
285
+
286
+ $this->browser = 3;
287
+ } elseif (strpos($this->userAgent, 'Chrome') !== false) {
288
+
289
+ $this->browser = 4;
290
+ } else {
291
+
292
+ $this->browser = 5;
293
+ }
294
+ } elseif (strpos($this->userAgent, 'Opera Mini') !== false) {
295
+
296
+ $this->browser = 6;
297
+ } elseif (strpos($this->userAgent, 'Opera') !== false) {
298
+
299
+ $this->browser = 7;
300
+ } elseif (strpos($this->userAgent, 'Safari') !== false) {
301
+
302
+ $this->browser = 8;
303
+ } elseif (strpos($this->userAgent, 'iPad') !== false) {
304
+
305
+ $this->browser = 9;
306
+ } elseif (strpos($this->userAgent, 'Android') !== false) {
307
+
308
+ $this->browser = 10;
309
+ } elseif (strpos($this->userAgent, 'AIR') !== false) {
310
+
311
+ $this->browser = 11;
312
+ } elseif (strpos($this->userAgent, 'Fluid') !== false) {
313
+
314
+ $this->browser = 12;
315
+ } elseif (strpos($this->userAgent, 'Maxthon') !== false) {
316
+
317
+ $this->browser = 13;
318
+ } else {
319
+
320
+ $this->browser = 14;
321
}
322
+ }
323
+
324
//--------------------------------------------
325
+
326
+ /**
327
+
328
+ * Detect country internet code
329
+
330
+ *
331
+
332
+ * @return void
333
+
334
+ */
335
+ protected function getCountryInternetCode() {
336
+
337
+ if (!$this->ipIsUnknown) {
338
+
339
+ $gi = geoip_open(AHCFREE_PLUGIN_ROOT_DIR . AHCFREE_DS . "geoip" . AHCFREE_DS . "data" . AHCFREE_DS . "GeoIP.dat", GEOIP_STANDARD);
340
+
341
+ $this->countryInternetCode = geoip_country_code_by_addr($gi, $this->ipAddress);
342
+
343
+ geoip_close($gi);
344
}
345
+
346
+ if (empty($this->countryInternetCode)) {
347
+
348
+ $this->countryInternetCode = 'XX';
349
}
350
+ }
351
+
352
//--------------------------------------------
353
+
354
+ /**
355
+
356
+ * Detect country ID
357
+
358
+ *
359
+
360
+ * @uses wpdb::prepare()
361
+
362
+ * @uses wpdb::get_results()
363
+
364
+ *
365
+
366
+ * @return void
367
+
368
+ */
369
+
370
+
371
//--------------------------------------------
372
+
373
+ /**
374
+
375
+ * Detect search engine
376
+
377
+ *
378
+
379
+ * @uses wpdb::prepare()
380
+
381
+ * @uses wpdb::get_results()
382
+
383
+ *
384
+
385
+ * @return void
386
+
387
+ */
388
+ protected function getSearchEngine() {
389
+
390
+ global $wpdb;
391
+
392
+ $sql = "SELECT `srh_id`, `srh_query_parameter`, `srh_identifier` FROM `ahc_search_engines`";
393
+
394
+ $results = $wpdb->get_results($sql, OBJECT);
395
+
396
+ if ($results !== false) {
397
+
398
+ foreach ($results as $s) {
399
+
400
+ if (strpos($this->referer, $s->srh_identifier . '.') !== false) {
401
+
402
+ $this->searchEngine = $s->srh_id;
403
+
404
+ $this->getKeyWords($s->srh_query_parameter);
405
}
406
+ }
407
}
408
+ }
409
+
410
//--------------------------------------------
411
+
412
+ /**
413
+
414
+ * Detect search engine
415
+
416
+ *
417
+
418
+ * @uses wpdb::prepare()
419
+
420
+ * @uses wpdb::get_results()
421
+
422
+ *
423
+
424
+ * @return void
425
+
426
+ */
427
+ protected function getKeyWords($query_param) {
428
+
429
+ $query = parse_url($this->referer, PHP_URL_QUERY);
430
+
431
+ $query = rawurldecode($query);
432
+
433
+ $arr = array();
434
+
435
+ parse_str($query, $arr);
436
+
437
+ if (isset($arr[$query_param])) {
438
+
439
+ $this->keyWords = $arr[$query_param];
440
}
441
+ }
442
+
443
//--------------------------------------------
444
+
445
+ /**
446
+
447
+ * Is there a record prepared for today's visits
448
+
449
+ *
450
+
451
+ * @uses wpdb::get_results()
452
+
453
+ *
454
+
455
+ * @return boolean
456
+
457
+ */
458
+ protected function isTodayPreparedInDb() {
459
+
460
+ global $wpdb;
461
+
462
+ $del_sql = "DELETE v1 FROM ahc_visitors v1, ahc_visitors v2 WHERE v1.`vst_id` > v2.`vst_id` AND v1.`vst_date` = v2.`vst_date`";
463
+
464
+ //$del_sql = "DELETE v1 FROM ahc_visitors v1, ahc_visitors v2 WHERE v1.`vst_id` > v2.`vst_id` AND CONVERT_TZ(v1.vst_date, '" . AHCFREE_SERVER_CURRENT_TIMEZONE . "','" . $custom_timezone_offset . "') = CONVERT_TZ(v2.vst_date, '" . AHCFREE_SERVER_CURRENT_TIMEZONE . "','" . $custom_timezone_offset . "') ";
465
+
466
+ $del_result = $wpdb->get_results($del_sql, OBJECT);
467
+
468
+
469
+ $sql = "SELECT COUNT(`vst_id`) AS ct FROM `ahc_visitors` WHERE DATE(`vst_date`) = '".date("Y-m-d")."'";
470
+
471
+ //$sql = "SELECT COUNT(`vst_id`) AS ct FROM `ahc_visitors` WHERE DATE(CONVERT_TZ(vst_date,'" . AHCFREE_SERVER_CURRENT_TIMEZONE . "','" . $custom_timezone_offset . "')) = DATE(CONVERT_TZ(NOW( ),'" . AHCFREE_SERVER_CURRENT_TIMEZONE . "','" . $custom_timezone_offset . "'))";
472
+
473
+ $result = $wpdb->get_results($sql, OBJECT);
474
+
475
+ if ($result !== false) {
476
+
477
+ return ((int) $result[0]->ct > 0);
478
}
479
+ }
480
+
481
//--------------------------------------------
482
+
483
+ /**
484
+
485
+ * Prepared a record for today's visits
486
+
487
+ *
488
+
489
+ * @uses wpdb::query()
490
+
491
+ *
492
+
493
+ * @return boolean
494
+
495
+ */
496
+ protected function PrepareForTodayInDb() {
497
+
498
+ global $wpdb;
499
+
500
+ $sql = "INSERT INTO `ahc_visitors` (`vst_date`, `vst_visitors`, `vst_visits`) VALUES ('".date("Y-m-d H:i:s")."', 0, 0)";
501
+
502
+ if ($wpdb->query($sql) !== false) {
503
+
504
+ return true;
505
}
506
+
507
+ return false;
508
+ }
509
+
510
//--------------------------------------------
511
+
512
+ /**
513
+
514
+ * Clean daily hits table
515
+
516
+ *
517
+
518
+ * @uses wpdb::query()
519
+
520
+ *
521
+
522
+ * @return boolean
523
+
524
+ */
525
+ protected function cleanHitsTable() {
526
+
527
+ global $wpdb;
528
+
529
+ $sql = "DELETE FROM ahc_online_users WHERE DATE(`date`) <> '".date("Y-m-d")."'";
530
+ $wpdb->query($sql);
531
+
532
+ $sql = "DELETE FROM `ahc_hits` WHERE DATE(`hit_date`) <> '".date("Y-m-d")."'";
533
+
534
+ if ($wpdb->query($sql) !== false) {
535
+
536
+ return true;
537
+ } else {
538
+
539
+ return false;
540
}
541
+ }
542
+
543
//--------------------------------------------
544
+
545
+ /**
546
+
547
+ * Update browser visits
548
+
549
+ *
550
+
551
+ * @uses wpdb::prepare()
552
+
553
+ * @uses wpdb::query()
554
+
555
+ *
556
+
557
+ * @param integer $bsr_id
558
+
559
+ * @return boolean
560
+
561
+ */
562
+ protected function updateBrowsers($bsr_id) {
563
+
564
+ global $wpdb;
565
+
566
+ $sql = "UPDATE `ahc_browsers` SET bsr_visits = bsr_visits + 1 WHERE bsr_id = %d";
567
+
568
+ if ($wpdb->query($wpdb->prepare($sql, $bsr_id)) !== false) {
569
+
570
+ return true;
571
}
572
+
573
+ return false;
574
+ }
575
+
576
//--------------------------------------------
577
+
578
+ /**
579
+
580
+ * Update country visits
581
+
582
+ *
583
+
584
+ * @uses wpdb::prepare()
585
+
586
+ * @uses wpdb::query()
587
+
588
+ *
589
+
590
+ * @param integer $ctr_id
591
+
592
+ * @param integer $visitors Optional
593
+
594
+ * @param integer $visits Optional
595
+
596
+ * @return boolean
597
+
598
+ */
599
+ protected function updateCountries($ctr_id, $visitors = 0, $visits = 0) {
600
+
601
+ global $wpdb;
602
+
603
+ $sql = "UPDATE `ahc_countries` SET ctr_visitors = ctr_visitors + %d, ctr_visits = ctr_visits + %d WHERE ctr_id = %d";
604
+
605
+ return ($wpdb->query($wpdb->prepare($sql, $visitors, $visits, $ctr_id)) !== false);
606
+ }
607
+
608
+ //--------------------------------------------
609
+
610
+ /**
611
+
612
+ * Update visits sum order by search engine
613
+
614
+ *
615
+
616
+ * @uses wpdb::prepare()
617
+
618
+ * @uses wpdb::get_results()
619
+
620
+ * @uses wpdb::query()
621
+
622
+ *
623
+
624
+ * @param integer $srh_id
625
+
626
+ * @return boolean
627
+
628
+ */
629
+ protected function updateSearchingVisits($srh_id) {
630
+
631
+ global $wpdb;
632
+
633
+ $custom_timezone_offset = ahcfree_get_current_timezone_offset();
634
+
635
+ $sql = "SELECT vtsh_id FROM `ahc_searching_visits` WHERE srh_id = %d AND DATE(vtsh_date) = '".date("Y-m-d")."'";
636
+ //$sql = "SELECT vtsh_id FROM `ahc_searching_visits` WHERE srh_id = %d AND DATE(CONVERT_TZ(vtsh_date,'" . AHCFREE_SERVER_CURRENT_TIMEZONE . "','" . $custom_timezone_offset . "')) = DATE(CONVERT_TZ(NOW( ),'" . AHCFREE_SERVER_CURRENT_TIMEZONE . "','" . $custom_timezone_offset . "'))";
637
+
638
+ $result = $wpdb->get_results($wpdb->prepare($sql, $srh_id), OBJECT);
639
+
640
+ if ($result !== false) {
641
+
642
+ if ($wpdb->num_rows > 0) {
643
+
644
+ $sql2 = "UPDATE `ahc_searching_visits` SET vtsh_visits = vtsh_visits + 1 WHERE vtsh_id = %d";
645
+
646
+ return ($wpdb->query($wpdb->prepare($sql2, $result[0]->vtsh_id)) !== false);
647
+ } else {
648
+
649
+ $sql2 = "INSERT INTO `ahc_searching_visits` (srh_id, vtsh_date, vtsh_visits)
650
+
651
+ VALUES (%d, %s, 1)";
652
+
653
+ return ($wpdb->query($wpdb->prepare($sql2, $srh_id, date("Y-m-d H:i:s"))) !== false);
654
+ }
655
+ } else {
656
+
657
+ return false;
658
}
659
+ }
660
+
661
//--------------------------------------------
662
+
663
+ /**
664
+
665
+ * Update visitors count
666
+
667
+ *
668
+
669
+ * @uses wpdb::prepare()
670
+
671
+ * @uses wpdb::query()
672
+
673
+ *
674
+
675
+ * @param integer $visitors Optional
676
+
677
+ * @param integer $visits Optional
678
+
679
+ * @return boolean
680
+
681
+ */
682
+ protected function updateVisitors($visitors = 0, $visits = 0) {
683
+
684
+ global $wpdb;
685
+
686
+
687
+ $sql = "INSERT INTO `ahc_daily_visitors_stats` (vst_date, vst_visitors, vst_visits) values(%s, %d, %d )";
688
+
689
+ $wpdb->query($wpdb->prepare($sql, date("Y-m-d H:i:s"), $visitors, $visits));
690
+
691
+ $sql = "INSERT INTO `ahc_visitors` (vst_date, vst_visitors, vst_visits) values(%s, %d, %d )";
692
+ //$sql = "UPDATE `ahc_visitors` SET vst_visitors = vst_visitors + %d, vst_visits = vst_visits + %d WHERE DATE(vst_date) = DATE(NOW())";
693
+
694
+ return ($wpdb->query($wpdb->prepare($sql, date("Y-m-d H:i:s"), $visitors, $visits)) !== false);
695
+ }
696
+
697
+ //--------------------------------------------
698
+
699
+ /**
700
+
701
+ * Update referring sites visits table
702
+
703
+ *
704
+
705
+ * @uses wpdb::prepare()
706
+
707
+ * @uses wpdb::query()
708
+
709
+ * @uses wpdb::get_results()
710
+
711
+ *
712
+
713
+ * @param string $rfr_site_name. referring site name
714
+
715
+ * @return boolean
716
+
717
+ */
718
+ protected function updateReferingSites($rfr_site_name) {
719
+
720
+ global $wpdb;
721
+
722
+ $sql = "SELECT rfr_id FROM `ahc_refering_sites` where rfr_site_name = %s";
723
+
724
+ $result = $wpdb->get_results($wpdb->prepare($sql, $rfr_site_name), OBJECT);
725
+
726
+ if ($result !== false) {
727
+
728
+ if (!empty($result)) {
729
+
730
+ $sql2 = "UPDATE `ahc_refering_sites` SET rfr_visits = rfr_visits + 1 WHERE rfr_id = %d";
731
+
732
+ return ($wpdb->query($wpdb->prepare($sql2, $result[0]->rfr_id)) !== false);
733
+ } else {
734
+
735
+ $sql2 = "INSERT INTO `ahc_refering_sites` (rfr_site_name, rfr_visits)
736
+
737
+ VALUES(%s, 1)";
738
+
739
+ return ($wpdb->query($wpdb->prepare($sql2, $rfr_site_name)) !== false);
740
+ }
741
+ } else {
742
+
743
+ return false;
744
+ }
745
+ }
746
+
747
+ //--------------------------------------------
748
+
749
+ /**
750
+
751
+ * Update recent visitors table
752
+
753
+ *
754
+
755
+ * @uses wpdb::prepare()
756
+
757
+ * @uses wpdb::query()
758
+
759
+ *
760
+
761
+ * @param string $vtr_ip_address. IP address
762
+
763
+ * @param string $vtr_referer Optional. Referring site name
764
+
765
+ * @param integer $srh_id Optional. Search engine ID
766
+
767
+ * @param integer $bsr_id Optional. Browser ID
768
+
769
+ * @param integer $ctr_id Optional. Country ID
770
+
771
+ * @return boolean
772
+
773
+ */
774
+ protected function updateRecentVisitors($vtr_ip_address, $vtr_referer = '', $srh_id = NULL, $bsr_id = NULL, $ctr_id = NULL) {
775
+
776
+ global $wpdb;
777
+
778
+
779
+
780
+
781
+ /* $ip_data = (ahcfree_advanced_get_link("http://ip-api.com/json/".$vtr_ip_address));
782
+ $ip_data = json_decode($ip_data['body']);
783
+
784
+ if($ip_data->city != '')
785
+ {
786
+
787
+ $ahc_city = $ip_data->city;
788
+ $ahc_region = $ip_data->regionName;
789
+ }
790
+
791
+ if(empty($ip_data->city) or empty($ip_data->regionName))
792
+ {
793
+ $ip_data = (ahcfree_advanced_get_link("http://api.db-ip.com/v2/c425dbfb764da5017d283d8a2d53360be0869a4b/".$vtr_ip_address));
794
+ $ip_data = json_decode($ip_data['body']);
795
+
796
+ $ahc_city = $ip_data->city;
797
+ $ahc_region = $ip_data->stateProv;
798
+ }
799
+
800
*/
801
+
802
+
803
+
804
+ $ip_data = (ahcfree_advanced_get_link("http://www.geoplugin.net/json.gp?ip=" . $vtr_ip_address));
805
+ $ip_data = json_decode($ip_data['body']);
806
+
807
+
808
+ if ($ip_data->geoplugin_city != '') {
809
+
810
+ $ahc_city = $ip_data->geoplugin_countryName;
811
+ $ahc_region = $ip_data->geoplugin_city;
812
+ }
813
+
814
+ if (empty($ip_data->geoplugin_city) or empty($ip_data->geoplugin_city)) {
815
+ $ip_data = (ahcfree_advanced_get_link("http://ip-api.com/json/" . $vtr_ip_address));
816
+ $ip_data = json_decode($ip_data['body']);
817
+
818
+ $ahc_city = $ip_data->city;
819
+ $ahc_region = $ip_data->regionName;
820
+ }
821
+
822
+
823
+ $sql = "INSERT INTO `ahc_recent_visitors` (vtr_ip_address, vtr_referer, srh_id, bsr_id, ctr_id, ahc_city, ahc_region, vtr_date, vtr_time) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)";
824
+
825
+
826
+
827
+ return ($wpdb->query($wpdb->prepare($sql, $vtr_ip_address, $vtr_referer, $srh_id, $bsr_id, $ctr_id, $ahc_city, $ahc_region, date("Y-m-d"), date("H:i:s") )) !== false);
828
+ }
829
+
830
+ //--------------------------------------------
831
+
832
+ /**
833
+
834
+ * Update key words table
835
+
836
+ *
837
+
838
+ * @uses wpdb::prepare()
839
+
840
+ * @uses wpdb::query()
841
+
842
+ *
843
+
844
+ * @param string $vtr_ip_address. IP address
845
+
846
+ * @param string $kwd_keywords. Key word
847
+
848
+ * @param string $kwd_referer. Referring site name.
849
+
850
+ * @param integer $srh_id. Search engine ID
851
+
852
+ * @param integer $bsr_id. Browser ID
853
+
854
+ * @param integer $ctr_id Optional. Country ID
855
+
856
+ * @return boolean
857
+
858
+ */
859
+ protected function updateKeywords($kwd_ip_address, $kwd_keywords, $kwd_referer, $srh_id, $bsr_id, $ctr_id = NULL) {
860
+
861
+ global $wpdb;
862
+
863
+ $sql = "INSERT INTO `ahc_keywords` (kwd_ip_address, kwd_keywords, kwd_referer, srh_id, ctr_id, bsr_id, kwd_date, kwd_time)
864
+
865
+ VALUES (%s, %s, %s, %d, %d, %d, %s, %s)";
866
+
867
+ return ($wpdb->query($wpdb->prepare($sql, $kwd_ip_address, $kwd_keywords, $kwd_referer, $srh_id, $ctr_id, $bsr_id, date("Y-m-d"), date("H:i:s"))) !== false);
868
+ }
869
+
870
+ //--------------------------------------------
871
+
872
+ /**
873
+
874
+ * Clean unwanted records. Only keeping a limit of fresh records. Limit is set by AHC_RECENT_VISITORS_LIMIT
875
+
876
+ *
877
+
878
+ * @uses wpdb::prepare()
879
+
880
+ * @uses wpdb::get_results()
881
+
882
+ * @uses wpdb::query()
883
+
884
+ *
885
+
886
+ * @return boolean
887
+
888
+ */
889
+ protected function cleanUnwantedRecords() {
890
+
891
+ global $wpdb;
892
+
893
+ $sql11 = "SELECT vtr_id FROM `ahc_recent_visitors` ORDER BY vtr_id LIMIT %d";
894
+
895
+ $result = $wpdb->get_results($wpdb->prepare($sql11, AHC_RECENT_VISITORS_LIMIT), OBJECT);
896
+
897
+ if ($result !== false) {
898
+
899
+ $ids1 = array();
900
+
901
+ $length = count($result);
902
+
903
+ foreach ($result as $r) {
904
+
905
+ $ids1[] = $r->vtr_id;
906
+ }
907
+
908
+ $ids1 = implode(',', $ids1);
909
+
910
+ $sql12 = "DELETE FROM `ahc_recent_visitors`" . ((!empty($ids1)) ? " WHERE vtr_id NOT IN (" . $ids1 . ")" : "");
911
+
912
+
913
+
914
+ $sql21 = "SELECT kwd_id FROM `ahc_keywords` ORDER BY kwd_id LIMIT %d";
915
+
916
+ $result2 = $wpdb->get_results($wpdb->prepare($sql21, AHCFREE_RECENT_KEYWORDS_LIMIT), OBJECT);
917
+
918
+ if ($result2 !== false) {
919
+
920
+ $ids2 = array();
921
+
922
+ foreach ($result2 as $r) {
923
+
924
+ $ids2[] = $r->kwd_id;
925
+ }
926
+
927
+ $ids2 = implode(',', $ids2);
928
+
929
+ $sql22 = "DELETE FROM `ahc_keywords`" . ((!empty($ids2)) ? " WHERE kwd_id NOT IN (" . $ids2 . ")" : "");
930
+
931
+
932
+
933
+ if ($wpdb->query($sql12) !== false) {
934
+
935
+ return ($wpdb->query($sql22) !== false);
936
}
937
+ }
938
}
939
+
940
+ return false;
941
+ }
942
+
943
//--------------------------------------------
944
+
945
+ /**
946
+
947
+ * Update traffic by title table
948
+
949
+ *
950
+
951
+ * @uses wpdb::prepare()
952
+
953
+ * @uses wpdb::get_results()
954
+
955
+ * @uses wpdb::query()
956
+
957
+ *
958
+
959
+ * @param integer $til_page_id
960
+
961
+ * @param string $til_page_title
962
+
963
+ * @return boolean
964
+
965
+ */
966
+ protected function updateTitleTraffic($til_page_id, $til_page_title) {
967
+
968
+ global $wpdb;
969
+
970
+ $sql = "SELECT til_id FROM `ahc_title_traffic` where til_page_id = %s";
971
+
972
+ $result = $wpdb->get_results($wpdb->prepare($sql, $til_page_id), OBJECT);
973
+
974
+ if ($result !== false) {
975
+
976
+ if (!empty($result)) {
977
+
978
+ $sql2 = "UPDATE `ahc_title_traffic`
979
+
980
SET til_hits = til_hits + 1, til_page_title = %s
981
+
982
WHERE til_id = %d";
983
+
984
+ return ($wpdb->query($wpdb->prepare($sql2, $til_page_title, $result[0]->til_id)) !== false);
985
+ } else {
986
+
987
+ $sql2 = "INSERT INTO `ahc_title_traffic` (til_page_id, til_page_title, til_hits)
988
+
989
VALUES(%s, %s, 1)";
990
+
991
+ return ($wpdb->query($wpdb->prepare($sql2, $til_page_id, $til_page_title)) !== false);
992
+ }
993
+ } else {
994
+
995
+ return false;
996
}
997
+ }
998
+
999
//--------------------------------------------
1000
+
1001
+ /**
1002
+
1003
+ * Update visitor's & visits' times table
1004
+
1005
+ *
1006
+
1007
+ * @uses wpdb::prepare()
1008
+
1009
+ * @uses wpdb::query()
1010
+
1011
+ *
1012
+
1013
+ * @param integer $visitors Optional
1014
+
1015
+ * @param integer $visits Optional
1016
+
1017
+ * @return boolean
1018
+
1019
+ */
1020
+ protected function updateVisitsTime($visitors = 0, $visits = 0) {
1021
+
1022
+ global $wpdb;
1023
+ $time = date('H:i:s');
1024
+ $sql = "UPDATE `ahc_visits_time` SET vtm_visitors = vtm_visitors + %d, vtm_visits = vtm_visits + %d
1025
+
1026
+ WHERE TIME(vtm_time_from) <= '$time' AND TIME(vtm_time_to) >= '$time'";
1027
+ $query = $wpdb->prepare($sql, $visitors, $visits);
1028
+ $result = ($wpdb->query($query) !== false);
1029
+
1030
+ $sql = "UPDATE `ahc_visits_time` SET vtm_visitors = 1
1031
+
1032
+ WHERE vtm_visitors = 0 AND TIME(vtm_time_from) <= '$time' AND TIME(vtm_time_to) >= '$time'";
1033
+ $query = $wpdb->query($sql);
1034
+
1035
+ $sql = "UPDATE `ahc_visits_time` SET vtm_visits = 1
1036
+
1037
+ WHERE vtm_visits = 0 AND TIME(vtm_time_from) <= '$time' AND TIME(vtm_time_to) >= '$time'";
1038
+ $query = $wpdb->query($sql);
1039
+
1040
+ return $result;
1041
+ }
1042
+
1043
//--------------------------------------------
1044
+
1045
+ /**
1046
+
1047
+ * Record (insert) the visit
1048
+
1049
+ *
1050
+
1051
+ * @uses wpdb::prepare()
1052
+
1053
+ * @uses wpdb::query()
1054
+
1055
+ *
1056
+
1057
+ * @return boolean
1058
+
1059
+ */
1060
+ protected function recordThisHits() {
1061
+
1062
+ global $wpdb;
1063
+
1064
+ $sql = "INSERT INTO `ahc_hits`
1065
+
1066
+ (`hit_ip_address`, `hit_user_agent`, `hit_request_uri`, `hit_page_id`, `hit_page_title`, `ctr_id`, `hit_referer`, `hit_referer_site`,
1067
+
1068
`srh_id`, `hit_search_words`, `bsr_id`, `hit_date`, `hit_time`)
1069
+
1070
+ VALUES (%s, %s, %s, %s, %s, %d, %s, %s, %d, %s, %d, %s, %s)";
1071
+
1072
+ $result = $wpdb->query($wpdb->prepare($sql, $this->ipAddress, $this->userAgent, $this->requestUri, $this->pageId, $this->pageTitle, $this->countryId, $this->referer, $this->refererSite, $this->searchEngine, $this->keyWords, $this->browser, date("Y-m-d"), date("H:i:s") ));
1073
+
1074
+ return ($result !== false);
1075
+ }
1076
+
1077
//--------------------------------------------
1078
}
1079
+
1080
+ ?>
ahc_about.php ADDED
File without changes
ahc_help.php ADDED
File without changes
ahc_settings.php ADDED
@@ -0,0 +1,5 @@
0
i{
1
}
2
if (ahcfree_savesettings()) {
3
<h1><img width="40px" src="<?php echo plugins_url('/images/logo.png', AHCFREE_PLUGIN_MAIN_FILE) ?>">&nbsp;Visitor Traffic Real Time Statistics <a title="change settings" href="admin.php?page=ahc_hits_counter_settings"><img src="<?php echo plugins_url('/images/settings.jpg', AHCFREE_PLUGIN_MAIN_FILE) ?>" /></a></h1><br />
4
<div class="panel">
5
<h2 style="height:35px !important; font-size:13px !important">Settings</h2>
6
<option value="<?php echo $value; ?>" <?php echo ( $value == $custom_timezone_offset ) ? 'selected' : ''; ?>><?php echo $value; ?></option>
7
global $wp_roles;
8
if ( !isset( $wp_roles ) ) $wp_roles = new WP_Roles();
9
$available_roles_names = $wp_roles->get_names();//we get all roles names
10
$available_roles_capable = array();
11
foreach ($available_roles_names as $role_key => $role_name) { //we iterate all the names
12
$role_object = get_role( $role_key );//we get the Role Object
13
$array_of_capabilities = $role_object->capabilities;//we get the array of capabilities for this role
14
if($array_of_capabilities['update_plugins'] == 1 || $array_of_capabilities['manage_links'] == 1 || $array_of_capabilities['manage_sites'] == 1 ){ //we check if the upload_files capability is present, and if its present check if its 0 (FALSE in Php)
15
$available_roles_capable[$role_key] = $role_name; //we populate the array of capable roles
16
}
17
}
18
19
select: \'#ahcUserRoles\'
1
+
2
i{
3
}
4
+ if (!empty($_POST['save'])) {
5
if (ahcfree_savesettings()) {
6
+ }
7
<h1><img width="40px" src="<?php echo plugins_url('/images/logo.png', AHCFREE_PLUGIN_MAIN_FILE) ?>">&nbsp;Visitor Traffic Real Time Statistics <a title="change settings" href="admin.php?page=ahc_hits_counter_settings"><img src="<?php echo plugins_url('/images/settings.jpg', AHCFREE_PLUGIN_MAIN_FILE) ?>" /></a></h1><br />
8
<div class="panel">
9
<h2 style="height:35px !important; font-size:13px !important">Settings</h2>
10
<option value="<?php echo $value; ?>" <?php echo ( $value == $custom_timezone_offset ) ? 'selected' : ''; ?>><?php echo $value; ?></option>
11
global $wp_roles;
12
if ( !isset( $wp_roles ) ) $wp_roles = new WP_Roles();
13
$available_roles_names = $wp_roles->get_names();//we get all roles names
14
$available_roles_capable = array();
15
foreach ($available_roles_names as $role_key => $role_name) { //we iterate all the names
16
$role_object = get_role( $role_key );//we get the Role Object
17
$array_of_capabilities = $role_object->capabilities;//we get the array of capabilities for this role
18
if($array_of_capabilities['update_plugins'] == 1 || $array_of_capabilities['manage_links'] == 1 || $array_of_capabilities['manage_sites'] == 1 ){ //we check if the upload_files capability is present, and if its present check if its 0 (FALSE in Php)
19
$available_roles_capable[$role_key] = $role_name; //we populate the array of capable roles
20
}
21
}
22
23
select: \'#ahcUserRoles\'
24
+ </div>
25
+ </form>
css/ar_css.css CHANGED
@@ -2,7 +2,7 @@
2
html {height: 100%}
3
body {height: 100%; margin:0; padding:0; overflow-x:hidden; font: 10px verdana;}
4
5
- .ahc_main_container{
6
direction: rtl; /* ## */
7
padding: 60px 20px;
8
}
2
html {height: 100%}
3
body {height: 100%; margin:0; padding:0; overflow-x:hidden; font: 10px verdana;}
4
5
+ .ahcfree_main_container{
6
direction: rtl; /* ## */
7
padding: 60px 20px;
8
}
css/en_newcss.css DELETED
@@ -1,115 +0,0 @@
1
- body {font: 10px verdana; background:#F1F1F1 !important}
2
-
3
- .legendsContainer{min-height: 410px; border: solid 1px #CCCCCC; border-radius: 5px; width:200px !important; padding: 10px; background-color: #F1F1F1;}
4
- .legendsContainer div.legend{float: left;display:inline; height:auto; width:180px !important; margin: 0 10px 10px 0;}
5
- div.legend span{font-size: 12px; line-height: 0.9;}
6
- div.legend span.color{display: block; float: left; width: 15px; height: 95%; margin-right: 8px;}
7
- div.legend span.name{margin-right: 5px;}
8
- div.legend span.value{color: #D34E4E;}
9
- .panel{
10
- margin-left:20px
11
- }
12
-
13
- .disabled_panel{
14
- background:#666;
15
- position:absolute
16
-
17
- }
18
-
19
- .ahc_main_container{
20
- direction: ltr; /* ## */
21
- font-family:Verdana, Geneva, sans-serif; font-size:8px !important;
22
- width:98%;
23
- }
24
- .ahc_main_container h1{
25
- font-size:20px;
26
- font-weight:normal;
27
- color:#657f97;
28
-
29
- }
30
- .hitsLogo{
31
- background:url(../images/hitslogo.png) left no-repeat;
32
- height:55px;
33
- width:55px;
34
- display:inline;
35
- float:left;
36
- }
37
- .rightPanelsContainer{float: left; /* ## */ margin: 0; padding: 0;}
38
- .leftPanelsContainer{float: right; /* ## */ margin: 0; padding: 0;}
39
- .cleaner{clear: both;}
40
- .panel, .panelcollapsed{
41
- background: #23282D;
42
- border:#23282D solid 1px;
43
- margin: 10px 0px;
44
- -moz-border-radius: 4px;
45
- -webkit-border-radius: 4px;
46
-
47
- }
48
- .panel h2, .panelcollapsed h2{
49
- font-size: 12px !important;
50
- font-weight: normal !important;
51
- margin: 0px !important;
52
-
53
- background-color:#666 !important;
54
- padding:5px !important;
55
-
56
- color: white !important;
57
- font-weight:bold !important;
58
- background-color:#23282D;
59
-
60
- -moz-border-radius: 3px !important;
61
- -webkit-border-radius: 3px !important;
62
- height:20px !important;
63
- }
64
- .panelcollapsed h2{
65
- background: #FFF url(../images/arrow_down.png) no-repeat 99% 50% !important;; /* ## */
66
- border-color: #CCC !important;;
67
- }
68
- .panelcontent{
69
- padding: 10px;
70
- background: #FFF;
71
- min-height:400px;
72
- }
73
- .panelcollapsed .panelcontent {display: none;}
74
- .panelcontent th{font-size: 12px; color: #657f97; font-weight: 0; padding: 5px; text-align: left; border-bottom:#CCC solid 1px; }
75
- .panelcontent td, .panelcontent td.values{text-align: left; color:#000; font-size: 12px; font-weight: 0; padding: 5px; text-align: left; border-bottom:#EFEFEF solid 1px}
76
- .panelcontent tr:hover{
77
- background:#F5F5F5
78
- }
79
-
80
- .fineFont{font-size: 10px !important}
81
-
82
- .lastVisitorsDetails{border-bottom: solid 1px #dad6ca; direction: ltr; padding: 5px;}
83
- .lastVisitorsDetails span{margin-right: 3px;}
84
- .lastVisitorsDetails img{vertical-align: middle;}
85
- .ipAddress{float: left; font-size: 14px; color: #3B9EF9; margin-bottom: 10px; margin-bottom: 10px;}
86
- .referingSite{color: #3B9EF9; margin-left: 5px; font-size: 12px;}
87
- .visitDateTime{float: right; color: #3B9EF9; font-size: 12px;}
88
-
89
- .lastSearchKeyWords, .visitorMarker{border-bottom: solid 1px #dad6ca; direction: ltr; padding: 5px;}
90
- .lastSearchKeyWords span, .countryMarker span{margin-right: 3px;}
91
- .lastSearchKeyWords img{vertical-align: middle;}
92
- .countryMarker{direction: ltr; padding: 5px;}
93
- .searchKeyWords{font-size: 14px;}
94
-
95
- .languageChanger{direction: rtl; /* ## */ font-size: 18px;}
96
-
97
- .countryMarker span.countryName, .visitorMarker span.ipAddress{margin-left: 5px;}
98
-
99
- .visitorMarker{border-bottom: dashed 1px #dad6ca;}
100
- .countryMarker span.countryName{font-size: 12px;}
101
- .countryMarker img{vertical-align: middle;}
102
- .visitorMarker span.ipAddress{font-size: 12px;}
103
- .visitorMarker span{float: left;}
104
-
105
- /* visitors graph begin */
106
- div.visitorsGraphContainer{float: left; width: 70%} /* ### */
107
- div.visitorsGraphContainer div.visitorsGraph{float: left; background-color: #82CE69; border-radius: 2px;}
108
- div.visitorsPercent{float: left; width: 25%; margin-left: 5px;} /* ### */
109
- /* visitors graph end */
110
-
111
- h2{
112
- text-align:left !important;
113
- font-size:14px !important;
114
- height:30px !important;
115
- }
css/eng_css.css ADDED
@@ -0,0 +1,222 @@
1
+ body {background:#F1F1F1 !important}
2
+
3
+
4
+ .show-swal2{
5
+ width:700px !important;
6
+ height:500px !important;
7
+ }
8
+
9
+ .box_widget{
10
+ height:130px;
11
+ font-family:'Open Sans', sans-serif;
12
+ color:#FFF;
13
+ font-size:40px;
14
+ text-align:right;
15
+ padding-right:10px;
16
+ padding-top:10px;
17
+
18
+ }
19
+ .smallinputs{
20
+ width:40px !important;
21
+ background:#333
22
+ }
23
+ .txt
24
+ {
25
+ font-size:20px;
26
+ }
27
+
28
+
29
+ #ahcfree_currenttime{
30
+ color:gray;
31
+ font-size:20px !important;
32
+ float:right !important;
33
+ vertical-align:middle
34
+ }
35
+
36
+ .blueBox{
37
+ background:url("../images/visits.png") no-repeat;
38
+ background-position:bottom left;
39
+ background-color:#578ebe;
40
+ }
41
+
42
+ .redBox{
43
+ background:url("../images/visitors.png") no-repeat;
44
+ background-position:bottom left;
45
+ background-color:#e35b5a;
46
+
47
+ }
48
+
49
+ .greenBox{
50
+ background:url("../images/online.png") no-repeat;
51
+ background-position:bottom left;
52
+ background-color:#44b6ae;
53
+ }
54
+
55
+ .movBox{
56
+ background:url("../images/searchengin.png") no-repeat;
57
+ background-position:bottom left;
58
+ background-color:#8775a7;
59
+ }
60
+
61
+
62
+ .legendsContainer{ border: solid 1px #CCCCCC; border-radius: 5px; width:auto !important; height:auto; padding: 10px; background-color: #F1F1F1;}
63
+ .legendsContainer div.legend{float: left;display:inline; height: 15px; width:180px !important; margin: 0 10px 10px 0;}
64
+ div.legend span{font-size: 12px; line-height: 0.9;}
65
+ div.legend span.color{display: block; float: left; width: 15px; height: 95%; margin-right: 8px;}
66
+ div.legend span.name{margin-right: 5px;}
67
+ div.legend span.value{color: #D34E4E;}
68
+
69
+ .panel{
70
+ margin-left:20px;
71
+ font-size:15px;
72
+ }
73
+
74
+ .disabled_panel{
75
+ background:#666;
76
+ position:absolute
77
+
78
+ }
79
+
80
+ .ahcfree_main_container{
81
+ direction: ltr; /* ## */
82
+ font-family:Verdana, Geneva, sans-serif; font-size:8px !important;
83
+ width:98%;
84
+ }
85
+ .ahcfree_main_container h1{
86
+ font-size:20px;
87
+ font-weight:normal;
88
+ color:#657f97;
89
+
90
+ }
91
+ .hitsLogo{
92
+ background:url(../images/hitslogo.png) left no-repeat;
93
+ height:55px;
94
+ width:55px;
95
+ display:inline;
96
+ float:left;
97
+ }
98
+ .rightPanelsContainer{float: left; /* ## */ margin: 0; padding: 0;}
99
+ .leftPanelsContainer{float: right; /* ## */ margin: 0; padding: 0;}
100
+ .cleaner{clear: both;}
101
+ .panel, .panelcollapsed{
102
+ background: #eee;
103
+ border:#dfdfdf solid 1px;
104
+ margin: 10px 0px;
105
+ padding: 0px 0px 5px;
106
+ -moz-border-radius: 4px;
107
+ -webkit-border-radius: 4px;
108
+
109
+ }
110
+ .panel h2, .panelcollapsed h2{
111
+ font-size: 12px !important;
112
+ font-weight: normal !important;
113
+ margin: 0px !important;
114
+ padding: 4px !important;
115
+ background: url(../images/headerbg.png) repeat-x !important; /* ## */
116
+ border-bottom:#dfdfdf solid 1px !important;;
117
+ -moz-border-radius: 3px !important;
118
+ -webkit-border-radius: 3px !important;
119
+ height:23px !important;
120
+ background-color:#FFF !important;
121
+ padding-top:10px !important;
122
+ padding-left:7px !important;
123
+ color: #657f97 !important;
124
+ font-weight:bold !important;
125
+ }
126
+ .panelcollapsed h2{
127
+ background: #FFF url(../images/arrow_down.png) no-repeat 99% 50% !important;; /* ## */
128
+ border-color: #CCC !important;;
129
+ }
130
+ .panelcontent{
131
+ padding: 10px;
132
+ background: #FFF;
133
+
134
+ }
135
+ .panelcollapsed .panelcontent {display: none;}
136
+ .panelcontent th{font-size: 12px; color: #657f97; font-weight: 0; padding: 5px; text-align: left; border-bottom:#CCC solid 1px; }
137
+ .panelcontent td, .panelcontent td.values{text-align: left; font-size:14px; font-weight: 0; padding: 5px; text-align: left; border-bottom:#EFEFEF solid 1px}
138
+ .panelcontent tr:hover{
139
+ background:#F5F5F5
140
+ }
141
+
142
+ .fineFont{font-size: 10px !important}
143
+
144
+ .lastVisitorsDetails{border-bottom: solid 1px #dad6ca; direction: ltr; padding: 5px;}
145
+ .lastVisitorsDetails span{margin-right: 3px;}
146
+ .lastVisitorsDetails img{vertical-align: middle;}
147
+ .ipAddress{float: left; font-size: 14px; color: #3B9EF9; margin-bottom: 10px; margin-bottom: 10px; width:150px;}
148
+ .referingSite{color: #3B9EF9; margin-left: 5px; font-size: 12px;}
149
+ .visitDateTime{float: right; color: #3B9EF9; font-size: 12px;}
150
+
151
+ .lastSearchKeyWords, .visitorMarker{border-bottom: solid 1px #dad6ca; direction: ltr; padding: 5px;}
152
+ .lastSearchKeyWords span, .countryMarker span{margin-right: 3px;}
153
+ .lastSearchKeyWords img{vertical-align: middle;}
154
+ .countryMarker{direction: ltr; padding: 5px;}
155
+ .searchKeyWords{font-size: 14px;}
156
+
157
+ .languageChanger{direction: rtl; /* ## */ font-size: 18px;}
158
+
159
+ .countryMarker span.countryName, .visitorMarker span.ipAddress{margin-left: 5px;}
160
+
161
+ .visitorMarker{border-bottom: dashed 1px #dad6ca;}
162
+ .countryMarker span.countryName{font-size: 12px;}
163
+ .countryMarker img{vertical-align: middle;}
164
+ .visitorMarker span.ipAddress{font-size: 12px;}
165
+ .visitorMarker span{float: left;}
166
+
167
+ /* visitors graph begin */
168
+ div.visitorsGraphContainer{float: left; width: 70%} /* ### */
169
+ div.visitorsGraphContainer div.visitorsGraph{float: left; background-color:#9F6; border-radius: 2px;}
170
+ div.visitorsGraphContainer div.visitorsGraph2{float: left; background-color:#393; border-radius: 2px;}
171
+ div.visitorsGraphContainer div.visitorsGraph3{float: left; background-color:#060; border-radius: 2px;}
172
+ div.visitorsPercent{float: left; width: 25%; margin-left: 5px;} /* ### */
173
+ /* visitors graph end */
174
+
175
+ h2{
176
+ text-align:left !important;
177
+ font-size:14px !important;
178
+ height:30px !important;
179
+ }
180
+
181
+
182
+ .recentv tr td{
183
+ font-size:12px !important;
184
+ }
185
+
186
+ /*************************************/
187
+
188
+ .increase_counter{
189
+ background-image:url('../images/increase.png');
190
+ }
191
+
192
+ .decrease_counter{
193
+ background-image:url('../images/decrease.png');
194
+ }
195
+ span#up-down {
196
+ display: inline-block;
197
+ width: 50px;
198
+ height: 30px;
199
+ background-repeat: no-repeat;
200
+ background-position: center center;
201
+ }
202
+
203
+ .hits_duration_select{
204
+ padding-top: 10px;
205
+ padding-left: 10px;
206
+ }
207
+ #visitors_graph_stats{
208
+ position:relative;
209
+ }
210
+ .panelcontent.loader:after {
211
+ content: "";
212
+ background-image: url(../images/Spinner-1s-200px.svg);
213
+ background-repeat: no-repeat;
214
+ width: 100%;
215
+ height: 100%;
216
+ position: absolute;
217
+ left: 0;
218
+ top: 0;
219
+ background-position: center;
220
+ z-index: 9999;
221
+ background-color: rgba(255,255,255,0.6);
222
+ }
css/{en_css.css → engl_css.css} RENAMED
@@ -1,13 +1,71 @@
1
- body {font: 10px verdana; background:#F1F1F1 !important}
2
3
- .legendsContainer{min-height: 410px; border: solid 1px #CCCCCC; border-radius: 5px; width:200px !important; padding: 10px; background-color: #F1F1F1;}
4
- .legendsContainer div.legend{float: left;display:inline; height:auto; width:180px !important; margin: 0 10px 10px 0;}
5
div.legend span{font-size: 12px; line-height: 0.9;}
6
div.legend span.color{display: block; float: left; width: 15px; height: 95%; margin-right: 8px;}
7
div.legend span.name{margin-right: 5px;}
8
div.legend span.value{color: #D34E4E;}
9
.panel{
10
- margin-left:20px
11
}
12
13
.disabled_panel{
@@ -16,12 +74,12 @@ position:absolute
16
17
}
18
19
- .ahc_main_container{
20
direction: ltr; /* ## */
21
font-family:Verdana, Geneva, sans-serif; font-size:8px !important;
22
width:98%;
23
}
24
- .ahc_main_container h1{
25
font-size:20px;
26
font-weight:normal;
27
color:#657f97;
@@ -50,18 +108,17 @@ float:left;
50
font-size: 12px !important;
51
font-weight: normal !important;
52
margin: 0px !important;
53
-
54
- background-color:#666 !important;
55
padding-top:10px !important;
56
padding-left:7px !important;
57
color: #657f97 !important;
58
font-weight:bold !important;
59
- padding: 4px !important;
60
- background: url(../images/myheaderbg.png) repeat-x !important; /* ## */
61
-