WP Statistics - Version 13.2.2

Version Description

= 13.0 = IMPORTANT NOTE Welcome to WP-Statistics v13.0, our biggest update! Thank you for being part of our community. Weve been working hard for one year to develop this version and make WP-Statistics better for you. Before updating, make sure you disabled all your add-ons, then after that, try to update add-ons.

If you encounter any bug, please create an issue on GitHub where we can act upon them more efficiently. Since GitHub is not a support forum, just bugs are welcomed, and any other request will be closed.

Download this release

Release Info

Developer mostafa.s1990
Plugin Icon 128x128 WP Statistics
Version 13.2.2
Comparing to
See all releases

Code changes from version 13.2.1 to 13.2.2

Files changed (77) hide show
  1. gulpfile.js +89 -0
  2. includes/admin/TinyMCE/class-wp-statistics-tinymce.php +1 -1
  3. includes/admin/class-wp-statistics-admin-ajax.php +7 -7
  4. includes/admin/class-wp-statistics-admin-export.php +1 -1
  5. includes/admin/class-wp-statistics-admin-network.php +1 -1
  6. includes/admin/class-wp-statistics-admin-notices.php +1 -1
  7. includes/admin/class-wp-statistics-admin-template.php +1 -1
  8. includes/admin/pages/class-wp-statistics-admin-page-category.php +1 -1
  9. includes/admin/pages/class-wp-statistics-admin-page-plugins.php +1 -1
  10. includes/admin/pages/class-wp-statistics-admin-page-settings.php +12 -1
  11. includes/admin/pages/class-wp-statistics-admin-page-tags.php +1 -1
  12. includes/admin/pages/class-wp-statistics-admin-page-visitors.php +5 -7
  13. includes/admin/templates/add-ons.php +10 -15
  14. includes/admin/templates/email.php +4 -4
  15. includes/admin/templates/layout/date.range.php +2 -2
  16. includes/admin/templates/layout/header.php +1 -1
  17. includes/admin/templates/layout/select.php +1 -1
  18. includes/admin/templates/layout/title.php +1 -1
  19. includes/admin/templates/layout/visitors.filter.php +1 -1
  20. includes/admin/templates/meta-box/about.php +3 -3
  21. includes/admin/templates/meta-box/pages-visitor-preview.php +1 -1
  22. includes/admin/templates/optimization/database.php +1 -1
  23. includes/admin/templates/optimization/export.php +4 -9
  24. includes/admin/templates/optimization/historical.php +2 -2
  25. includes/admin/templates/optimization/purging.php +10 -11
  26. includes/admin/templates/optimization/resources.php +14 -29
  27. includes/admin/templates/pages/author.php +4 -3
  28. includes/admin/templates/pages/category.php +2 -2
  29. includes/admin/templates/pages/online.php +12 -10
  30. includes/admin/templates/pages/overview.php +1 -1
  31. includes/admin/templates/pages/page-chart.php +3 -3
  32. includes/admin/templates/pages/pages.php +9 -12
  33. includes/admin/templates/pages/refer.url.php +7 -7
  34. includes/admin/templates/pages/tag.php +2 -2
  35. includes/admin/templates/pages/top-visitors.php +11 -11
  36. includes/admin/templates/pages/top.refer.php +5 -5
  37. includes/admin/templates/pages/visitors.php +12 -12
  38. includes/admin/templates/pages/words.php +8 -8
  39. includes/admin/templates/postbox.php +1 -1
  40. includes/admin/templates/settings/about.php +2 -2
  41. includes/admin/templates/settings/access-level.php +6 -4
  42. includes/admin/templates/settings/exclusions.php +10 -10
  43. includes/admin/templates/settings/externals.php +3 -3
  44. includes/admin/templates/settings/general.php +9 -14
  45. includes/admin/templates/settings/maintenance.php +2 -2
  46. includes/admin/templates/settings/notifications.php +6 -6
  47. includes/admin/templates/settings/privacy.php +4 -4
  48. includes/admin/templates/settings/visitor-ip.php +6 -5
  49. includes/class-wp-statistics-geoip.php +2 -2
  50. includes/class-wp-statistics-helper.php +1 -1
  51. includes/class-wp-statistics-pages.php +1 -1
  52. includes/class-wp-statistics-referred.php +4 -2
  53. includes/class-wp-statistics-user-agent.php +1 -1
  54. includes/class-wp-statistics-widget.php +24 -24
  55. includes/libraries/ExportData.php +1 -1
  56. includes/template-functions.php +1 -1
  57. includes/vendor/composer/ca-bundle/README.md +0 -85
  58. includes/vendor/composer/ca-bundle/composer.json +0 -54
  59. includes/vendor/geoip2/geoip2/README.md +0 -409
  60. includes/vendor/geoip2/geoip2/composer.json +0 -31
  61. includes/vendor/jaybizzle/crawler-detect/README.md +0 -76
  62. includes/vendor/jaybizzle/crawler-detect/composer.json +0 -29
  63. includes/vendor/maxmind-db/reader/README.md +0 -178
  64. includes/vendor/maxmind-db/reader/composer.json +0 -43
  65. includes/vendor/maxmind/web-service-common/README.md +0 -25
  66. includes/vendor/maxmind/web-service-common/composer.json +0 -31
  67. includes/vendor/psr/cache/README.md +0 -9
  68. includes/vendor/psr/cache/composer.json +0 -25
  69. includes/vendor/s1lentium/iptools/.gitignore +0 -32
  70. includes/vendor/s1lentium/iptools/README.md +0 -206
  71. includes/vendor/s1lentium/iptools/composer.json +0 -25
  72. includes/vendor/whichbrowser/parser/.gitignore +0 -12
  73. includes/vendor/whichbrowser/parser/README.md +0 -510
  74. includes/vendor/whichbrowser/parser/composer.json +0 -47
  75. license.txt +674 -0
  76. readme.txt +16 -6
  77. wp-statistics.php +1 -1
gulpfile.js ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var gulp = require('gulp'),
2
+ cleanCSS = require('gulp-clean-css'),
3
+ rename = require('gulp-rename'),
4
+ concat = require('gulp-concat'),
5
+ insert = require('gulp-insert'),
6
+ babel = require('gulp-babel'),
7
+ uglify = require('gulp-uglify'),
8
+ replace = require('gulp-replace'),
9
+ sass = require('gulp-sass'),
10
+ pipeline = require('readable-stream').pipeline;
11
+
12
+ // Gulp Sass Compiler
13
+ sass.compiler = require('node-sass');
14
+ gulp.task('sass', function () {
15
+ return gulp.src([
16
+ './assets/dev/sass/admin.scss',
17
+ './assets/dev/sass/jquery-datepicker/datepicker.scss',
18
+ './assets/dev/sass/rtl.scss',
19
+ './assets/dev/sass/frontend.scss',
20
+ ])
21
+ .pipe(sass({outputStyle: 'compressed'}))
22
+ .pipe(rename({suffix: '.min'}))
23
+ .pipe(gulp.dest(['./assets/css/']));
24
+ });
25
+
26
+ //Gulp Script Concat
27
+ gulp.task('script', function () {
28
+ return gulp.src([
29
+ './assets/dev/javascript/plugin/*.js',
30
+ './assets/dev/javascript/config.js',
31
+ './assets/dev/javascript/ajax.js',
32
+ './assets/dev/javascript/placeholder.js',
33
+ './assets/dev/javascript/helper.js',
34
+ './assets/dev/javascript/meta-box.js',
35
+ './assets/dev/javascript/meta-box/*.js',
36
+ './assets/dev/javascript/pages/*.js',
37
+ './assets/dev/javascript/run.js',
38
+ ])
39
+ .pipe(concat('admin.min.js'))
40
+ .pipe(insert.prepend('jQuery(document).ready(function ($) {'))
41
+ .pipe(insert.append('});'))
42
+ .pipe(gulp.dest('./assets/js/'))
43
+ .pipe(babel({presets: ['@babel/env']}))
44
+ .pipe(replace("\\n", ''))
45
+ .pipe(replace("\\t", ''))
46
+ .pipe(replace(" ", ''))
47
+ .pipe(uglify())
48
+ .pipe(gulp.dest('./assets/js/'));
49
+ });
50
+
51
+ // Gulp TinyMce Script
52
+ gulp.task('mce', function () {
53
+ return gulp.src(['./assets/dev/javascript/Tinymce/*.js'])
54
+ .pipe(concat('tinymce.min.js'))
55
+ .pipe(gulp.dest('./assets/js/')).pipe(babel({presets: ['@babel/env']})).pipe(replace("\\n", '')).pipe(replace("\\t", '')).pipe(replace(" ", '')).pipe(uglify()).pipe(gulp.dest('./assets/js/'));
56
+ });
57
+
58
+ // Gulp Script Minify
59
+ gulp.task('js', function () {
60
+ return gulp.src(['./assets/js/*.js', '!./assets/js/*.min.js'])
61
+ .pipe(babel({presets: ['@babel/env']}))
62
+ .pipe(uglify())
63
+ .pipe(rename({suffix: '.min'}))
64
+ .pipe(gulp.dest(function (file) {
65
+ return file.base;
66
+ }));
67
+ });
68
+
69
+ // Gulp Css Minify
70
+ gulp.task('css', function () {
71
+ return gulp.src(['./assets/css/*.css', '!./assets/css/*.min.css'])
72
+ .pipe(cleanCSS({
73
+ keepSpecialComments: 1,
74
+ level: 2
75
+ }))
76
+ .pipe(rename({suffix: '.min'}))
77
+ .pipe(gulp.dest(function (file) {
78
+ return file.base;
79
+ }));
80
+ });
81
+
82
+ // Gulp Watch
83
+ gulp.task('watch', function () {
84
+ gulp.watch('assets/dev/javascript/**/*.js', gulp.series('script'));
85
+ gulp.watch('assets/dev/sass/**/*.scss', gulp.series('sass'));
86
+ });
87
+
88
+ // global Task
89
+ gulp.task('default', gulp.parallel('sass', 'script', 'mce'));
includes/admin/TinyMCE/class-wp-statistics-tinymce.php CHANGED
@@ -139,7 +139,7 @@ class TinyMCE
139
  });
140
  ';
141
  $lang = TinyMCE::lang();
142
- echo $lang['translate'];
143
  echo '
144
  tinyMCEPreInit.load_ext("' . rtrim(WP_STATISTICS_URL, "/") . '", "' . $lang['locale'] . '");
145
  </script>
139
  });
140
  ';
141
  $lang = TinyMCE::lang();
142
+ echo $lang['translate']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
143
  echo '
144
  tinyMCEPreInit.load_ext("' . rtrim(WP_STATISTICS_URL, "/") . '", "' . $lang['locale'] . '");
145
  </script>
includes/admin/class-wp-statistics-admin-ajax.php CHANGED
@@ -103,7 +103,7 @@ class Ajax
103
 
104
  // Show Result
105
  if ($result) {
106
- echo sprintf(__('%s agent data deleted successfully.', 'wp-statistics'), '<code>' . $agent . '</code>');
107
  } else {
108
  _e('No agent data found to remove!', 'wp-statistics');
109
  }
@@ -141,7 +141,7 @@ class Ajax
141
 
142
  // Return Result
143
  if ($result) {
144
- echo sprintf(__('%s platform data deleted successfully.', 'wp-statistics'), '<code>' . htmlentities($platform, ENT_QUOTES) . '</code>');
145
  } else {
146
  _e('No platform data found to remove!', 'wp-statistics');
147
  }
@@ -177,7 +177,7 @@ class Ajax
177
  $result = $wpdb->query($wpdb->prepare("DELETE FROM " . DB::table('visitor') . " WHERE `ip` = %s", $ip_address));
178
 
179
  if ($result) {
180
- echo sprintf(__('%s IP data deleted successfully.', 'wp-statistics'), '<code>' . htmlentities($ip_address, ENT_QUOTES) . '</code>');
181
  } else {
182
  _e('No IP address data found to remove!', 'wp-statistics');
183
  }
@@ -224,11 +224,11 @@ class Ajax
224
  if ($table_name == "all") {
225
  $x_tbl = 1;
226
  foreach ($list_db_table as $tbl_key => $tbl_name) {
227
- echo ($x_tbl > 1 ? '<br>' : '') . DB::EmptyTable($tbl_name);
228
  $x_tbl++;
229
  }
230
  } else {
231
- echo DB::EmptyTable(DB::table($table_name));
232
  }
233
 
234
  } else {
@@ -255,7 +255,7 @@ class Ajax
255
  $purge_days = intval(sanitize_text_field($_POST['purge-days']));
256
  }
257
 
258
- echo Purge::purge_data($purge_days);
259
  } else {
260
  _e('Access denied!', 'wp-statistics');
261
  }
@@ -283,7 +283,7 @@ class Ajax
283
  if ($purge_hits < 10) {
284
  _e('Number of hits must be greater than or equal to 10!', 'wp-statistics');
285
  } else {
286
- echo Purge::purge_visitor_hits($purge_hits);
287
  }
288
  } else {
289
  _e('Access denied!', 'wp-statistics');
103
 
104
  // Show Result
105
  if ($result) {
106
+ echo sprintf(__('%s agent data deleted successfully.', 'wp-statistics'), '<code>' . esc_attr($agent) . '</code>');
107
  } else {
108
  _e('No agent data found to remove!', 'wp-statistics');
109
  }
141
 
142
  // Return Result
143
  if ($result) {
144
+ echo sprintf(__('%s platform data deleted successfully.', 'wp-statistics'), '<code>' . esc_attr($platform) . '</code>');
145
  } else {
146
  _e('No platform data found to remove!', 'wp-statistics');
147
  }
177
  $result = $wpdb->query($wpdb->prepare("DELETE FROM " . DB::table('visitor') . " WHERE `ip` = %s", $ip_address));
178
 
179
  if ($result) {
180
+ echo sprintf(__('%s IP data deleted successfully.', 'wp-statistics'), '<code>' . esc_attr($ip_address) . '</code>');
181
  } else {
182
  _e('No IP address data found to remove!', 'wp-statistics');
183
  }
224
  if ($table_name == "all") {
225
  $x_tbl = 1;
226
  foreach ($list_db_table as $tbl_key => $tbl_name) {
227
+ echo ($x_tbl > 1 ? '<br>' : '') . DB::EmptyTable($tbl_name); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
228
  $x_tbl++;
229
  }
230
  } else {
231
+ echo DB::EmptyTable(DB::table($table_name)); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
232
  }
233
 
234
  } else {
255
  $purge_days = intval(sanitize_text_field($_POST['purge-days']));
256
  }
257
 
258
+ echo Purge::purge_data($purge_days); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
259
  } else {
260
  _e('Access denied!', 'wp-statistics');
261
  }
283
  if ($purge_hits < 10) {
284
  _e('Number of hits must be greater than or equal to 10!', 'wp-statistics');
285
  } else {
286
+ echo Purge::purge_visitor_hits($purge_hits); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
287
  }
288
  } else {
289
  _e('Access denied!', 'wp-statistics');
includes/admin/class-wp-statistics-admin-export.php CHANGED
@@ -79,7 +79,7 @@ class Export
79
 
80
  // If we didn't get any rows, don't output anything.
81
  if (count($result) < 1) {
82
- echo "No data in table!";
83
  exit;
84
  }
85
 
79
 
80
  // If we didn't get any rows, don't output anything.
81
  if (count($result) < 1) {
82
+ echo "No data in table!"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
83
  exit;
84
  }
85
 
includes/admin/class-wp-statistics-admin-network.php CHANGED
@@ -119,7 +119,7 @@ class Network
119
  {
120
  global $plugin_page;
121
  $blog_id = str_replace('wp_statistics_blogid_', '', $plugin_page);
122
- $url = get_admin_url($blog_id) . '/admin.php?page=' . Menus::get_page_slug('overview');
123
  echo "<script>window.location.href = '$url';</script>";
124
  }
125
  }
119
  {
120
  global $plugin_page;
121
  $blog_id = str_replace('wp_statistics_blogid_', '', $plugin_page);
122
+ $url = esc_url(get_admin_url($blog_id) . '/admin.php?page=' . Menus::get_page_slug('overview'));
123
  echo "<script>window.location.href = '$url';</script>";
124
  }
125
  }
includes/admin/class-wp-statistics-admin-notices.php CHANGED
@@ -137,7 +137,7 @@ class Admin_Notices
137
  data: {
138
  'action': 'wp_statistics_close_notice',
139
  'notice': 'disable_all_addons',
140
- 'wps_nonce': '<?php echo wp_create_nonce('wp_rest'); ?>'
141
  },
142
  datatype: 'json'
143
  });
137
  data: {
138
  'action': 'wp_statistics_close_notice',
139
  'notice': 'disable_all_addons',
140
+ 'wps_nonce': '<?php echo wp_create_nonce('wp_rest'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'
141
  },
142
  datatype: 'json'
143
  });
includes/admin/class-wp-statistics-admin-template.php CHANGED
@@ -184,7 +184,7 @@ class Admin_Template
184
 
185
  // Export Data
186
  if ($args['echo']) {
187
- echo $export;
188
  } else {
189
  return $export;
190
  }
184
 
185
  // Export Data
186
  if ($args['echo']) {
187
+ echo $export; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
188
  } else {
189
  return $export;
190
  }
includes/admin/pages/class-wp-statistics-admin-page-category.php CHANGED
@@ -95,7 +95,7 @@ class category_page
95
  // Get Top Posts From Category
96
  $post_lists = Helper::get_post_list(array(
97
  'post_type' => 'post',
98
- 'category__in' => $_GET['ID']
99
  ));
100
  foreach ($post_lists as $post_id => $post_title) {
101
  $args['top_list'][$post_id] = array('ID' => $post_id, 'name' => $post_title, 'link' => Menus::admin_url('pages', array('ID' => $post_id)), 'count_visit' => (int)wp_statistics_pages('total', null, $post_id, null, null, 'post'));
95
  // Get Top Posts From Category
96
  $post_lists = Helper::get_post_list(array(
97
  'post_type' => 'post',
98
+ 'category__in' => sanitize_text_field($_GET['ID'])
99
  ));
100
  foreach ($post_lists as $post_id => $post_title) {
101
  $args['top_list'][$post_id] = array('ID' => $post_id, 'name' => $post_title, 'link' => Menus::admin_url('pages', array('ID' => $post_id)), 'count_visit' => (int)wp_statistics_pages('total', null, $post_id, null, null, 'post'));
includes/admin/pages/class-wp-statistics-admin-page-plugins.php CHANGED
@@ -78,7 +78,7 @@ class plugins_page
78
  $parse = new \Parsedown();
79
 
80
  // convert MarkDown To Html
81
- echo $parse->text(nl2br($data->body));
82
  }
83
  }
84
 
78
  $parse = new \Parsedown();
79
 
80
  // convert MarkDown To Html
81
+ echo $parse->text(nl2br($data->body)); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
82
  }
83
  }
84
 
includes/admin/pages/class-wp-statistics-admin-page-settings.php CHANGED
@@ -181,7 +181,18 @@ class settings_page
181
  );
182
 
183
  foreach ($wps_option_list as $option) {
184
- $wp_statistics_options[self::input_name_to_option($option)] = (isset($_POST[$option]) ? stripslashes(sanitize_textarea_field($_POST[$option])) : '');
 
 
 
 
 
 
 
 
 
 
 
185
  }
186
 
187
  return $wp_statistics_options;
181
  );
182
 
183
  foreach ($wps_option_list as $option) {
184
+
185
+ $value = '';
186
+
187
+ if (isset($_POST[$option])) {
188
+ if ($option == 'wps_content_report') {
189
+ $value = wp_kses_post($_POST[$option]);
190
+ } else {
191
+ $value = stripslashes(sanitize_textarea_field($_POST[$option]));
192
+ }
193
+ }
194
+
195
+ $wp_statistics_options[self::input_name_to_option($option)] = $value;
196
  }
197
 
198
  return $wp_statistics_options;
includes/admin/pages/class-wp-statistics-admin-page-tags.php CHANGED
@@ -96,7 +96,7 @@ class tags_page
96
  // Get Top Posts From Category
97
  $post_lists = Helper::get_post_list(array(
98
  'post_type' => 'post',
99
- 'tag_id' => $_GET['ID']
100
  ));
101
  foreach ($post_lists as $post_id => $post_title) {
102
  $args['top_list'][$post_id] = array('ID' => $post_id, 'name' => $post_title, 'link' => Menus::admin_url('pages', array('ID' => $post_id)), 'count_visit' => (int)wp_statistics_pages('total', null, $post_id, null, null, 'post'));
96
  // Get Top Posts From Category
97
  $post_lists = Helper::get_post_list(array(
98
  'post_type' => 'post',
99
+ 'tag_id' => sanitize_text_field($_GET['ID'])
100
  ));
101
  foreach ($post_lists as $post_id => $post_title) {
102
  $args['top_list'][$post_id] = array('ID' => $post_id, 'name' => $post_title, 'link' => Menus::admin_url('pages', array('ID' => $post_id)), 'count_visit' => (int)wp_statistics_pages('total', null, $post_id, null, null, 'post'));
includes/admin/pages/class-wp-statistics-admin-page-visitors.php CHANGED
@@ -191,15 +191,13 @@ class visitors_page
191
  */
192
  public static function Filter()
193
  {
194
- // Remove unused $_GET
195
- $params = (isset($_GET) ? $_GET : array()); // don't need to be sanitized since we need the count of the array elements, not data directly.
196
-
197
- foreach (array('page', 'from', 'to', 'order', 'orderby') as $i) {
198
- if (isset($params[$i])) {
199
- unset($params[$i]);
200
  }
201
  }
202
- $filter['number'] = count($params);
203
 
204
  // Code Button
205
  $filter['code'] = '<div class="wps-pull-' . (is_rtl() ? 'left' : 'right') . '" id="visitors-filter"><span class="dashicons dashicons-filter"></span><span class="filter-text">' . __("Filters", "wp-statistics") . '</span> ' . ($filter['number'] > 0 ? '<span class="wps-badge">' . number_format_i18n($filter['number']) . '</span>' : '') . '</div>';
191
  */
192
  public static function Filter()
193
  {
194
+ $params = 0;
195
+ foreach ($_GET as $params_key => $params_item) {
196
+ if (!in_array($params_key, array('page', 'from', 'to', 'order', 'orderby'))) {
197
+ $params++;
 
 
198
  }
199
  }
200
+ $filter['number'] = $params;
201
 
202
  // Code Button
203
  $filter['code'] = '<div class="wps-pull-' . (is_rtl() ? 'left' : 'right') . '" id="visitors-filter"><span class="dashicons dashicons-filter"></span><span class="filter-text">' . __("Filters", "wp-statistics") . '</span> ' . ($filter['number'] > 0 ? '<span class="wps-badge">' . number_format_i18n($filter['number']) . '</span>' : '') . '</div>';
includes/admin/templates/add-ons.php CHANGED
@@ -7,35 +7,32 @@
7
  <div class="plugin-card">
8
  <?php if ($plugin->is_feature and $plugin->featured_label) : ?>
9
  <div class="cover-ribbon">
10
- <div class="cover-ribbon-inside"><?php echo $plugin->featured_label; ?></div>
11
  </div>
12
  <?php endif; ?>
13
 
14
  <div class="plugin-card-top">
15
  <div class="name column-name">
16
  <h3>
17
- <a target="_blank" href="<?php echo $plugin->url; ?>" class="thickbox open-plugin-details-modal">
18
- <?php echo $plugin->name; ?>
19
- <img src="<?php echo $plugin->icon; ?>" class="plugin-icon" alt="<?php echo $plugin->name; ?>">
20
  </a>
21
  </h3>
22
  </div>
23
 
24
  <div class="desc column-description">
25
- <p><?php echo wp_trim_words($plugin->description, 15); ?></p>
26
  </div>
27
  </div>
28
  <div class="plugin-card-bottom">
29
  <div class="column-downloaded">
30
- <strong><?php _e('Version:', 'wp-statistics'); ?></strong><?php echo ' ' .
31
- $plugin->version; ?>
32
  <p><strong><?php _e('Status:', 'wp-statistics'); ?></strong>
33
  <?php
34
  if (is_plugin_active($plugin->slug . '/' . $plugin->slug . '.php')) {
35
  _e('Active', 'wp-statistics');
36
- } else if (file_exists(
37
- WP_PLUGIN_DIR . '/' . $plugin->slug . '/' . $plugin->slug . '.php'
38
- )) {
39
  _e('Inactive', 'wp-statistics');
40
  } else {
41
  _e('Not installed', 'wp-statistics');
@@ -46,14 +43,12 @@
46
  <div class="column-compatibility">
47
  <?php if (is_plugin_active($plugin->slug . '/' . $plugin->slug . '.php')) { ?>
48
  <a href="<?php echo wp_nonce_url(WP_STATISTICS\Menus::admin_url('plugins', array('action' => 'deactivate', 'plugin' => $plugin->slug)), $plugin->slug); ?>" class="button"><?php _e('Deactivate Add-On', 'wp-statistics'); ?></a>
49
- <?php } else { ?><?php if (file_exists(
50
- WP_PLUGIN_DIR . '/' . $plugin->slug . '/' . $plugin->slug . '.php'
51
- )) { ?>
52
  <a href="<?php echo wp_nonce_url(WP_STATISTICS\Menus::admin_url('plugins', array('action' => 'activate', 'plugin' => $plugin->slug)), $plugin->slug); ?>" class="button"><?php _e('Activate Add-On', 'wp-statistics'); ?></a>
53
  <?php } else { ?>
54
  <div class="column-price">
55
- <strong><?php echo $plugin->price; ?></strong>
56
- </div><a target="_blank" href="<?php echo $plugin->url; ?>" class="button-primary"><?php _e('Buy Add-On', 'wp-statistics'); ?></a>
57
  <?php } ?><?php } ?>
58
  </div>
59
  </div>
7
  <div class="plugin-card">
8
  <?php if ($plugin->is_feature and $plugin->featured_label) : ?>
9
  <div class="cover-ribbon">
10
+ <div class="cover-ribbon-inside"><?php echo esc_attr($plugin->featured_label); ?></div>
11
  </div>
12
  <?php endif; ?>
13
 
14
  <div class="plugin-card-top">
15
  <div class="name column-name">
16
  <h3>
17
+ <a target="_blank" href="<?php echo esc_url($plugin->url); ?>" class="thickbox open-plugin-details-modal">
18
+ <?php echo esc_attr($plugin->name); ?>
19
+ <img src="<?php echo esc_url($plugin->icon); ?>" class="plugin-icon" alt="<?php echo esc_attr($plugin->name); ?>">
20
  </a>
21
  </h3>
22
  </div>
23
 
24
  <div class="desc column-description">
25
+ <p><?php echo wp_trim_words(wp_kses_post($plugin->description), 15); ?></p>
26
  </div>
27
  </div>
28
  <div class="plugin-card-bottom">
29
  <div class="column-downloaded">
30
+ <strong><?php _e('Version:', 'wp-statistics'); ?></strong><?php echo ' ' . esc_attr($plugin->version); ?>
 
31
  <p><strong><?php _e('Status:', 'wp-statistics'); ?></strong>
32
  <?php
33
  if (is_plugin_active($plugin->slug . '/' . $plugin->slug . '.php')) {
34
  _e('Active', 'wp-statistics');
35
+ } else if (file_exists(WP_PLUGIN_DIR . '/' . $plugin->slug . '/' . $plugin->slug . '.php')) {
 
 
36
  _e('Inactive', 'wp-statistics');
37
  } else {
38
  _e('Not installed', 'wp-statistics');
43
  <div class="column-compatibility">
44
  <?php if (is_plugin_active($plugin->slug . '/' . $plugin->slug . '.php')) { ?>
45
  <a href="<?php echo wp_nonce_url(WP_STATISTICS\Menus::admin_url('plugins', array('action' => 'deactivate', 'plugin' => $plugin->slug)), $plugin->slug); ?>" class="button"><?php _e('Deactivate Add-On', 'wp-statistics'); ?></a>
46
+ <?php } else { ?><?php if (file_exists(WP_PLUGIN_DIR . '/' . $plugin->slug . '/' . $plugin->slug . '.php')) { ?>
 
 
47
  <a href="<?php echo wp_nonce_url(WP_STATISTICS\Menus::admin_url('plugins', array('action' => 'activate', 'plugin' => $plugin->slug)), $plugin->slug); ?>" class="button"><?php _e('Activate Add-On', 'wp-statistics'); ?></a>
48
  <?php } else { ?>
49
  <div class="column-price">
50
+ <strong><?php echo wp_kses_post($plugin->price); ?></strong>
51
+ </div><a target="_blank" href="<?php echo esc_url($plugin->url); ?>" class="button-primary"><?php _e('Buy Add-On', 'wp-statistics'); ?></a>
52
  <?php } ?><?php } ?>
53
  </div>
54
  </div>
includes/admin/templates/email.php CHANGED
@@ -397,12 +397,12 @@
397
  if (trim($logo) != "") {
398
  ?>
399
  <p align="center">
400
- <img src="<?php echo $logo; ?>" style="display: block;margin: 20px auto">
401
  </p> <br/>
402
  <?php
403
  }
404
  ?>
405
- <?php echo $content; ?>
406
  </td>
407
  </tr>
408
  </table>
@@ -417,12 +417,12 @@
417
  <table role="presentation" border="0" cellpadding="0" cellspacing="0">
418
  <tr>
419
  <td class="content-block" style="padding-bottom:0px;">
420
- <span class="apple-link"><?php echo $footer_text; ?></span>
421
  </td>
422
  </tr>
423
  <tr>
424
  <td class="content-block powered-by">
425
- <a href="<?php echo $site_url; ?>" target="_blank"><?php echo $site_title; ?></a>
426
  </td>
427
  </tr>
428
  </table>
397
  if (trim($logo) != "") {
398
  ?>
399
  <p align="center">
400
+ <img src="<?php echo esc_attr($logo); ?>" style="display: block;margin: 20px auto">
401
  </p> <br/>
402
  <?php
403
  }
404
  ?>
405
+ <?php echo esc_attr($content); ?>
406
  </td>
407
  </tr>
408
  </table>
417
  <table role="presentation" border="0" cellpadding="0" cellspacing="0">
418
  <tr>
419
  <td class="content-block" style="padding-bottom:0px;">
420
+ <span class="apple-link"><?php echo esc_attr($footer_text); ?></span>
421
  </td>
422
  </tr>
423
  <tr>
424
  <td class="content-block powered-by">
425
+ <a href="<?php echo esc_url($site_url); ?>" target="_blank"><?php echo esc_attr($site_title); ?></a>
426
  </td>
427
  </tr>
428
  </table>
includes/admin/templates/layout/date.range.php CHANGED
@@ -1,4 +1,4 @@
1
- <form action="<?php echo admin_url('admin.php'); ?>" method="get" class="wps-inline" id="jquery-datepicker">
2
  <?php
3
  if (isset($select_box)) {
4
  ?>
@@ -53,7 +53,7 @@
53
  </form>
54
  <?php
55
  if (isset($filter) and isset($filter['code'])) {
56
- echo $filter['code'];
57
  ?>
58
  <div class="wp-clearfix"></div>
59
  <?php
1
+ <form action="<?php echo esc_url(admin_url('admin.php')); ?>" method="get" class="wps-inline" id="jquery-datepicker">
2
  <?php
3
  if (isset($select_box)) {
4
  ?>
53
  </form>
54
  <?php
55
  if (isset($filter) and isset($filter['code'])) {
56
+ echo $filter['code']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
57
  ?>
58
  <div class="wp-clearfix"></div>
59
  <?php
includes/admin/templates/layout/header.php CHANGED
@@ -1,2 +1,2 @@
1
- <div class="wrap wps-wrap<?php echo(isset($class) ? ' ' . $class : ''); ?>">
2
  <?php require_once WP_STATISTICS_DIR . "/includes/admin/templates/header.php"; ?>
1
+ <div class="wrap wps-wrap<?php echo(isset($class) ? ' ' . esc_attr($class) : ''); ?>">
2
  <?php require_once WP_STATISTICS_DIR . "/includes/admin/templates/header.php"; ?>
includes/admin/templates/layout/select.php CHANGED
@@ -20,7 +20,7 @@ if (isset($list) and is_array($list) and count($list) > 0) {
20
  <?php
21
  foreach ($list as $id => $name) {
22
  ?>
23
- <option value="<?php echo $id; ?>" <?php selected($_GET['ID'], $id); ?>><?php echo esc_attr($name); ?></option>
24
  <?php
25
  }
26
  ?>
20
  <?php
21
  foreach ($list as $id => $name) {
22
  ?>
23
+ <option value="<?php echo esc_attr($id); ?>" <?php selected($_GET['ID'], $id); ?>><?php echo esc_attr($name); ?></option>
24
  <?php
25
  }
26
  ?>
includes/admin/templates/layout/title.php CHANGED
@@ -1,4 +1,4 @@
1
  <div class="wps-wrap__main">
2
- <h2 class="wps_title"><?php echo(isset($title) ? $title : (function_exists('get_admin_page_title') ? get_admin_page_title() : '')); ?></h2>
3
  <?php do_action('wp_statistics_after_admin_page_title'); ?>
4
  <div class="wp-clearfix"></div>
1
  <div class="wps-wrap__main">
2
+ <h2 class="wps_title"><?php echo(isset($title) ? esc_attr($title) : (function_exists('get_admin_page_title') ? get_admin_page_title() : '')); ?></h2>
3
  <?php do_action('wp_statistics_after_admin_page_title'); ?>
4
  <div class="wp-clearfix"></div>
includes/admin/templates/layout/visitors.filter.php CHANGED
@@ -1,5 +1,5 @@
1
  <div id="visitors-filter-popup" dir="<?php echo(is_rtl() ? 'rtl' : 'ltr') ?>" style="display:none;">
2
- <form action="<?php echo admin_url('admin.php'); ?>" method="get" id="wp_statistics_visitors_filter_form">
3
  <input type="hidden" name="page" value="<?php echo esc_attr($pageName); ?>">
4
 
5
  <div id="wps-visitors-filter-form">
1
  <div id="visitors-filter-popup" dir="<?php echo(is_rtl() ? 'rtl' : 'ltr') ?>" style="display:none;">
2
+ <form action="<?php echo esc_url(admin_url('admin.php')); ?>" method="get" id="wp_statistics_visitors_filter_form">
3
  <input type="hidden" name="page" value="<?php echo esc_attr($pageName); ?>">
4
 
5
  <div id="wps-visitors-filter-form">
includes/admin/templates/meta-box/about.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  $aboutWidgetContent = apply_filters('wp_statistics_about_widget_content', false);
3
  if ($aboutWidgetContent) {
4
- echo $aboutWidgetContent;
5
  return;
6
  }
7
  ?>
@@ -9,7 +9,7 @@ if ($aboutWidgetContent) {
9
  <tr>
10
  <td>
11
  <a href="https://wp-statistics.com" target="_blank">
12
- <img src="<?php echo WP_STATISTICS_URL . 'assets/images/logo-250.png'; ?>" alt="WP-Statistics" class="wps-about-logo" style="width: 60px;">
13
  </a>
14
  </td>
15
  <td>
@@ -18,7 +18,7 @@ if ($aboutWidgetContent) {
18
  <a href="https://wp-statistics.com/add-ons/" target="_blank"><?php _e('Add-Ons', 'wp-statistics'); ?></a> |
19
  <a href="https://wordpress.org/support/plugin/wp-statistics/reviews/?rate=5#new-post" target="_blank"><?php _e('Rate & Review', 'wp-statistics'); ?></a>
20
  <div class="wps-postbox-veronalabs">
21
- <a href="https://veronalabs.com/?utm_source=wp_statistics&utm_medium=display&utm_campaign=wordpress" target="_blank" title="<?php _e('Power by VeronaLabs', 'wp-statistics'); ?>"><img src="<?php echo WP_STATISTICS_URL; ?>assets/images/veronalabs.svg" alt="VeronaLabs Co" style="width: 80px;"/></a>
22
  </div>
23
  </div>
24
  </td>
1
  <?php
2
  $aboutWidgetContent = apply_filters('wp_statistics_about_widget_content', false);
3
  if ($aboutWidgetContent) {
4
+ echo wp_kses_post($aboutWidgetContent);
5
  return;
6
  }
7
  ?>
9
  <tr>
10
  <td>
11
  <a href="https://wp-statistics.com" target="_blank">
12
+ <img src="<?php echo esc_url(WP_STATISTICS_URL . 'assets/images/logo-250.png'); ?>" alt="WP-Statistics" class="wps-about-logo" style="width: 60px;">
13
  </a>
14
  </td>
15
  <td>
18
  <a href="https://wp-statistics.com/add-ons/" target="_blank"><?php _e('Add-Ons', 'wp-statistics'); ?></a> |
19
  <a href="https://wordpress.org/support/plugin/wp-statistics/reviews/?rate=5#new-post" target="_blank"><?php _e('Rate & Review', 'wp-statistics'); ?></a>
20
  <div class="wps-postbox-veronalabs">
21
+ <a href="https://veronalabs.com/?utm_source=wp_statistics&utm_medium=display&utm_campaign=wordpress" target="_blank" title="<?php _e('Power by VeronaLabs', 'wp-statistics'); ?>"><img src="<?php echo esc_url(WP_STATISTICS_URL); ?>assets/images/veronalabs.svg" alt="VeronaLabs" style="width: 80px;"/></a>
22
  </div>
23
  </div>
24
  </td>
includes/admin/templates/meta-box/pages-visitor-preview.php CHANGED
@@ -5,5 +5,5 @@
5
  <a href="https://wp-statistics.com/product/wp-statistics-widgets?utm_source=wp_statistics&utm_medium=display&utm_campaign=wordpress" class="button-primary" target="_blank"><?php _e('Unlock Visitors Information by Advanced Widgets!', 'wp-statistics'); ?></a>
6
  </div>
7
 
8
- <img src="<?php echo WP_STATISTICS_URL . 'assets/images/pages-visitor-preview.png'; ?>">
9
  </div>
5
  <a href="https://wp-statistics.com/product/wp-statistics-widgets?utm_source=wp_statistics&utm_medium=display&utm_campaign=wordpress" class="button-primary" target="_blank"><?php _e('Unlock Visitors Information by Advanced Widgets!', 'wp-statistics'); ?></a>
6
  </div>
7
 
8
+ <img src="<?php echo esc_url(WP_STATISTICS_URL . 'assets/images/pages-visitor-preview.png'); ?>">
9
  </div>
includes/admin/templates/optimization/database.php CHANGED
@@ -49,7 +49,7 @@
49
  <option value="0"><?php _e('Please select', 'wp-statistics'); ?></option>
50
  <?php
51
  foreach (WP_STATISTICS\DB::table('all') as $tbl_key => $tbl_name) {
52
- echo '<option value="' . $tbl_key . '">' . $tbl_name . '</option>';
53
  }
54
  ?>
55
  <option value="all"><?php echo __('All', 'wp-statistics'); ?></option>
49
  <option value="0"><?php _e('Please select', 'wp-statistics'); ?></option>
50
  <?php
51
  foreach (WP_STATISTICS\DB::table('all') as $tbl_key => $tbl_name) {
52
+ echo '<option value="' . esc_attr($tbl_key) . '">' . esc_attr($tbl_name) . '</option>';
53
  }
54
  ?>
55
  <option value="all"><?php echo __('All', 'wp-statistics'); ?></option>
includes/admin/templates/optimization/export.php CHANGED
@@ -18,17 +18,13 @@
18
  <select dir="<?php echo(is_rtl() ? 'rtl' : 'ltr'); ?>" id="table-to-export" name="table-to-export" required>
19
  <option value=""><?php _e('Please select', 'wp-statistics'); ?></option>
20
  <?php
21
- foreach (
22
- WP_STATISTICS\DB::table('all',
23
- array('historical', 'visitor_relationships')) as $tbl_key => $tbl_name
24
- ) {
25
- echo '<option value="' . $tbl_key . '">' . $tbl_name . '</option>';
26
  }
27
  ?>
28
  </select>
29
 
30
- <p class="description"><?php _e('Select the table for the output file.',
31
- 'wp-statistics'); ?></p>
32
  </td>
33
  </tr>
34
 
@@ -56,8 +52,7 @@
56
 
57
  <td>
58
  <input id="export-headers" type="checkbox" value="1" name="export-headers">
59
- <p class="description"><?php _e('Include a header row as the first line of the exported file.',
60
- 'wp-statistics'); ?></p>
61
  <?php submit_button(__('Start Now!', 'wp-statistics'), 'primary', 'export-file-submit'); ?>
62
  </td>
63
  </tr>
18
  <select dir="<?php echo(is_rtl() ? 'rtl' : 'ltr'); ?>" id="table-to-export" name="table-to-export" required>
19
  <option value=""><?php _e('Please select', 'wp-statistics'); ?></option>
20
  <?php
21
+ foreach (WP_STATISTICS\DB::table('all', array('historical', 'visitor_relationships')) as $tbl_key => $tbl_name) {
22
+ echo '<option value="' . esc_attr($tbl_key) . '">' . esc_attr($tbl_name) . '</option>';
 
 
 
23
  }
24
  ?>
25
  </select>
26
 
27
+ <p class="description"><?php _e('Select the table for the output file.', 'wp-statistics'); ?></p>
 
28
  </td>
29
  </tr>
30
 
52
 
53
  <td>
54
  <input id="export-headers" type="checkbox" value="1" name="export-headers">
55
+ <p class="description"><?php _e('Include a header row as the first line of the exported file.', 'wp-statistics'); ?></p>
 
56
  <?php submit_button(__('Start Now!', 'wp-statistics'), 'primary', 'export-file-submit'); ?>
57
  </td>
58
  </tr>
includes/admin/templates/optimization/historical.php CHANGED
@@ -27,7 +27,7 @@ $historical_visits = WP_STATISTICS\Historical::get('visits');
27
  <?php _e('Visitors', 'wp-statistics'); ?>:
28
  </th>
29
  <td>
30
- <input type="text" size="10" value="<?php echo $historical_visitors; ?>" id="wps_historical_visitors" name="wps_historical_visitors">
31
  <p class="description"><?php echo sprintf(__('Number of historical number of visitors to the site (current value is %s).', 'wp-statistics'), number_format_i18n($historical_visitors)); ?></p>
32
  </td>
33
  </tr>
@@ -37,7 +37,7 @@ $historical_visits = WP_STATISTICS\Historical::get('visits');
37
  <?php _e('Visits', 'wp-statistics'); ?>:
38
  </th>
39
  <td>
40
- <input type="text" size="10" value="<?php echo $historical_visits; ?>" id="wps_historical_visits" name="wps_historical_visits">
41
  <p class="description"><?php echo sprintf(__('Number of historical number of visits to the site (current value is %s).', 'wp-statistics'), number_format_i18n($historical_visits)); ?></p>
42
  </td>
43
  </tr>
27
  <?php _e('Visitors', 'wp-statistics'); ?>:
28
  </th>
29
  <td>
30
+ <input type="text" size="10" value="<?php echo esc_attr($historical_visitors); ?>" id="wps_historical_visitors" name="wps_historical_visitors">
31
  <p class="description"><?php echo sprintf(__('Number of historical number of visitors to the site (current value is %s).', 'wp-statistics'), number_format_i18n($historical_visitors)); ?></p>
32
  </td>
33
  </tr>
37
  <?php _e('Visits', 'wp-statistics'); ?>:
38
  </th>
39
  <td>
40
+ <input type="text" size="10" value="<?php echo esc_attr($historical_visits); ?>" id="wps_historical_visits" name="wps_historical_visits">
41
  <p class="description"><?php echo sprintf(__('Number of historical number of visits to the site (current value is %s).', 'wp-statistics'), number_format_i18n($historical_visits)); ?></p>
42
  </td>
43
  </tr>
includes/admin/templates/optimization/purging.php CHANGED
@@ -13,7 +13,7 @@
13
  return false;
14
 
15
  jQuery("#purge-data-submit").attr("disabled", "disabled");
16
- jQuery("#purge-data-status").html("<img src='<?php echo plugins_url('wp-statistics'); ?>/assets/images/loading.gif'/>");
17
  jQuery.ajax({
18
  url: ajaxurl,
19
  type: 'post',
@@ -45,7 +45,7 @@
45
  return false;
46
 
47
  jQuery("#purge-visitor-hits-submit").attr("disabled", "disabled");
48
- jQuery("#purge-visitor-hits-status").html("<img src='<?php echo plugins_url('wp-statistics'); ?>/assets/images/loading.gif'/>");
49
  jQuery.ajax({
50
  url: ajaxurl,
51
  type: 'post',
@@ -76,7 +76,7 @@
76
  return false;
77
 
78
  jQuery("#empty-table-submit").attr("disabled", "disabled");
79
- jQuery("#empty-status").html("<img src='<?php echo plugins_url('wp-statistics'); ?>/assets/images/loading.gif'/>");
80
  jQuery.ajax({
81
  url: ajaxurl,
82
  type: 'post',
@@ -107,7 +107,7 @@
107
  return false;
108
 
109
  jQuery("#delete-agents-submit").attr("disabled", "disabled");
110
- jQuery("#delete-agents-status").html("<img src='<?php echo plugins_url('wp-statistics'); ?>/assets/images/loading.gif'/>");
111
  jQuery.ajax({
112
  url: ajaxurl,
113
  type: 'post',
@@ -140,7 +140,7 @@
140
  return false;
141
 
142
  jQuery("#delete-platforms-submit").attr("disabled", "disabled");
143
- jQuery("#delete-platforms-status").html("<img src='<?php echo plugins_url('wp-statistics'); ?>/assets/images/loading.gif'/>");
144
  jQuery.ajax({
145
  url: ajaxurl,
146
  type: 'post',
@@ -173,7 +173,7 @@
173
  return false;
174
 
175
  jQuery("#delete-ip-submit").attr("disabled", "disabled");
176
- jQuery("#delete-ip-status").html("<img src='<?php echo plugins_url('wp-statistics'); ?>/assets/images/loading.gif'/>");
177
  jQuery.ajax({
178
  url: ajaxurl,
179
  type: 'post',
@@ -211,7 +211,7 @@
211
  <option value="0"><?php _e('Please select', 'wp-statistics'); ?></option>
212
  <?php
213
  foreach (WP_STATISTICS\DB::table('all', 'historical') as $tbl_key => $tbl_name) {
214
- echo '<option value="' . $tbl_key . '">' . $tbl_name . '</option>';
215
  }
216
  ?>
217
  <option value="all"><?php echo __('All', 'wp-statistics'); ?></option>
@@ -242,8 +242,7 @@
242
 
243
  <tr>
244
  <th scope="row">
245
- <label for="purge-visitor-hits"><?php _e('Purge visitors with more than:',
246
- 'wp-statistics'); ?></label>
247
  </th>
248
 
249
  <td>
@@ -278,7 +277,7 @@
278
  $agents = wp_statistics_ua_list();
279
  foreach ($agents as $agent) {
280
  $aid = preg_replace("/[^a-zA-Z]/", "", $agent);
281
- echo "<option value='$agent' id='agent-" . $aid . "-id'>" . $agent . "</option>";
282
  }
283
  ?>
284
  </select>
@@ -303,7 +302,7 @@
303
  foreach ($platforms as $platform) {
304
  if (!empty($platform)) {
305
  $pid = preg_replace("/[^a-zA-Z]/", "", $platform);
306
- echo "<option value='$platform' id='platform-" . $pid . "-id'>" . $platform . "</option>";
307
  }
308
  }
309
  ?>
13
  return false;
14
 
15
  jQuery("#purge-data-submit").attr("disabled", "disabled");
16
+ jQuery("#purge-data-status").html("<img src='<?php echo esc_url(plugins_url('wp-statistics')); ?>/assets/images/loading.gif'/>");
17
  jQuery.ajax({
18
  url: ajaxurl,
19
  type: 'post',
45
  return false;
46
 
47
  jQuery("#purge-visitor-hits-submit").attr("disabled", "disabled");
48
+ jQuery("#purge-visitor-hits-status").html("<img src='<?php echo esc_url(plugins_url('wp-statistics')); ?>/assets/images/loading.gif'/>");
49
  jQuery.ajax({
50
  url: ajaxurl,
51
  type: 'post',
76
  return false;
77
 
78
  jQuery("#empty-table-submit").attr("disabled", "disabled");
79
+ jQuery("#empty-status").html("<img src='<?php echo esc_url(plugins_url('wp-statistics')); ?>/assets/images/loading.gif'/>");
80
  jQuery.ajax({
81
  url: ajaxurl,
82
  type: 'post',
107
  return false;
108
 
109
  jQuery("#delete-agents-submit").attr("disabled", "disabled");
110
+ jQuery("#delete-agents-status").html("<img src='<?php echo esc_url(plugins_url('wp-statistics')); ?>/assets/images/loading.gif'/>");
111
  jQuery.ajax({
112
  url: ajaxurl,
113
  type: 'post',
140
  return false;
141
 
142
  jQuery("#delete-platforms-submit").attr("disabled", "disabled");
143
+ jQuery("#delete-platforms-status").html("<img src='<?php echo esc_url(plugins_url('wp-statistics')); ?>/assets/images/loading.gif'/>");
144
  jQuery.ajax({
145
  url: ajaxurl,
146
  type: 'post',
173
  return false;
174
 
175
  jQuery("#delete-ip-submit").attr("disabled", "disabled");
176
+ jQuery("#delete-ip-status").html("<img src='<?php echo esc_url(plugins_url('wp-statistics')); ?>/assets/images/loading.gif'/>");
177
  jQuery.ajax({
178
  url: ajaxurl,
179
  type: 'post',
211
  <option value="0"><?php _e('Please select', 'wp-statistics'); ?></option>
212
  <?php
213
  foreach (WP_STATISTICS\DB::table('all', 'historical') as $tbl_key => $tbl_name) {
214
+ echo '<option value="' . esc_attr($tbl_key) . '">' . esc_attr($tbl_name) . '</option>';
215
  }
216
  ?>
217
  <option value="all"><?php echo __('All', 'wp-statistics'); ?></option>
242
 
243
  <tr>
244
  <th scope="row">
245
+ <label for="purge-visitor-hits"><?php _e('Purge visitors with more than:', 'wp-statistics'); ?></label>
 
246
  </th>
247
 
248
  <td>
277
  $agents = wp_statistics_ua_list();
278
  foreach ($agents as $agent) {
279
  $aid = preg_replace("/[^a-zA-Z]/", "", $agent);
280
+ echo "<option value='$agent' id='agent-" . esc_attr($aid) . "-id'>" . esc_attr($agent) . "</option>";
281
  }
282
  ?>
283
  </select>
302
  foreach ($platforms as $platform) {
303
  if (!empty($platform)) {
304
  $pid = preg_replace("/[^a-zA-Z]/", "", $platform);
305
+ echo "<option value='$platform' id='platform-" . esc_attr($pid) . "-id'>" . esc_attr($platform) . "</option>";
306
  }
307
  }
308
  ?>
includes/admin/templates/optimization/resources.php CHANGED
@@ -23,8 +23,7 @@
23
 
24
  <td>
25
  <strong><?php echo ini_get('memory_limit'); ?></strong>
26
- <p class="description"><?php _e('The memory limit a script is allowed to consume, set in php.ini.',
27
- 'wp-statistics'); ?></p>
28
  </td>
29
  </tr>
30
 
@@ -33,14 +32,10 @@
33
  ?>
34
  <tr valign="top">
35
  <th scope="row">
36
- <?php echo sprintf(__('Number of rows in the %s table', 'wp-statistics'),
37
- '<code>' . $table_name . '</code>'); ?>:
38
  </th>
39
  <td>
40
- <strong><?php echo number_format_i18n($number_row); ?></strong> <?php echo _n('Row',
41
- 'Rows',
42
- number_format_i18n($number_row),
43
- 'wp-statistics'); ?>
44
  <p class="description"><?php _e('Number of rows', 'wp-statistics'); ?></p>
45
  </td>
46
  </tr>
@@ -64,8 +59,7 @@
64
 
65
  <td>
66
  <strong><?php echo WP_STATISTICS_VERSION; ?></strong>
67
- <p class="description"><?php _e('The WP Statistics version you are running.',
68
- 'wp-statistics'); ?></p>
69
  </td>
70
  </tr>
71
 
@@ -92,8 +86,7 @@
92
  _e('No', 'wp-statistics');
93
  } ?></strong>
94
 
95
- <p class="description"><?php _e('Is PHP Safe Mode active. The GeoIP code is not supported in Safe Mode.',
96
- 'wp-statistics'); ?></p>
97
  </td>
98
  </tr>
99
 
@@ -108,8 +101,7 @@
108
  } else {
109
  _e('No', 'wp-statistics');
110
  } ?></strong>
111
- <p class="description"><?php _e('Is PHP compiled with IPv6 support. You may see warning messages in your PHP log if it is not and you receive HTTP headers with IPv6 addresses in them.',
112
- 'wp-statistics'); ?></p>
113
  </td>
114
  </tr>
115
 
@@ -135,14 +127,12 @@
135
  <td>
136
  <strong><?php if (function_exists('curl_version')) {
137
  $curl_ver = curl_version();
138
- echo $curl_ver['version'];
139
  } else {
140
  _e('cURL not installed', 'wp-statistics');
141
  } ?></strong>
142
 
143
- <p class="description"><?php _e(
144
- 'The PHP cURL Extension version you are running. cURL is required for the GeoIP code, if it is not installed GeoIP will be disabled.',
145
- 'wp-statistics'
146
  ); ?></p>
147
  </td>
148
  </tr>
@@ -159,8 +149,7 @@
159
  _e('Not installed', 'wp-statistics');
160
  } ?></strong>
161
 
162
- <p class="description"><?php _e('If the gzopen() function is installed. The gzopen() function is required for the GeoIP database to be downloaded successfully.',
163
- 'wp-statistics'); ?></p>
164
  </td>
165
  </tr>
166
 
@@ -176,8 +165,7 @@
176
  _e('Not installed', 'wp-statistics');
177
  } ?></strong>
178
 
179
- <p class="description"><?php _e('If the GMP Math PHP extension is loaded, either GMP or BCMath is required for the GeoIP database to be read successfully.',
180
- 'wp-statistics'); ?></p>
181
  </td>
182
  </tr>
183
 
@@ -193,8 +181,7 @@
193
  _e('Not installed', 'wp-statistics');
194
  } ?></strong>
195
 
196
- <p class="description"><?php _e('If the BCMath PHP extension is loaded, either GMP or BCMath is required for the GeoIP database to be read successfully.',
197
- 'wp-statistics'); ?></p>
198
  </td>
199
  </tr>
200
  </tbody>
@@ -225,8 +212,7 @@
225
  $GeoIP_filedate);
226
  } ?></strong>
227
 
228
- <p class="description"><?php _e('The file size and date of the GeoIP database.',
229
- 'wp-statistics'); ?></p>
230
  </td>
231
  </tr>
232
  </tbody>
@@ -256,8 +242,7 @@
256
  </th>
257
 
258
  <td>
259
- <strong><?php echo htmlentities(\WP_STATISTICS\UserAgent::getHttpUserAgent(),
260
- ENT_QUOTES); ?></strong>
261
  <p class="description"><?php _e('The client user agent string.', 'wp-statistics'); ?></p>
262
  </td>
263
  </tr>
@@ -326,7 +311,7 @@
326
  ' . $server . '
327
  </th>
328
  <td>
329
- <strong>' . $_SERVER[$server] . '</strong>
330
  </td>
331
  </tr>';
332
  }
23
 
24
  <td>
25
  <strong><?php echo ini_get('memory_limit'); ?></strong>
26
+ <p class="description"><?php _e('The memory limit a script is allowed to consume, set in php.ini.', 'wp-statistics'); ?></p>
 
27
  </td>
28
  </tr>
29
 
32
  ?>
33
  <tr valign="top">
34
  <th scope="row">
35
+ <?php echo sprintf(__('Number of rows in the %s table', 'wp-statistics'), '<code>' . esc_attr($table_name) . '</code>'); ?>:
 
36
  </th>
37
  <td>
38
+ <strong><?php echo number_format_i18n($number_row); ?></strong> <?php echo _n('Row', 'Rows', number_format_i18n($number_row), 'wp-statistics'); ?>
 
 
 
39
  <p class="description"><?php _e('Number of rows', 'wp-statistics'); ?></p>
40
  </td>
41
  </tr>
59
 
60
  <td>
61
  <strong><?php echo WP_STATISTICS_VERSION; ?></strong>
62
+ <p class="description"><?php _e('The WP Statistics version you are running.', 'wp-statistics'); ?></p>
 
63
  </td>
64
  </tr>
65
 
86
  _e('No', 'wp-statistics');
87
  } ?></strong>
88
 
89
+ <p class="description"><?php _e('Is PHP Safe Mode active. The GeoIP code is not supported in Safe Mode.', 'wp-statistics'); ?></p>
 
90
  </td>
91
  </tr>
92
 
101
  } else {
102
  _e('No', 'wp-statistics');
103
  } ?></strong>
104
+ <p class="description"><?php _e('Is PHP compiled with IPv6 support. You may see warning messages in your PHP log if it is not and you receive HTTP headers with IPv6 addresses in them.', 'wp-statistics'); ?></p>
 
105
  </td>
106
  </tr>
107
 
127
  <td>
128
  <strong><?php if (function_exists('curl_version')) {
129
  $curl_ver = curl_version();
130
+ echo esc_attr($curl_ver['version']);
131
  } else {
132
  _e('cURL not installed', 'wp-statistics');
133
  } ?></strong>
134
 
135
+ <p class="description"><?php _e('The PHP cURL Extension version you are running. cURL is required for the GeoIP code, if it is not installed GeoIP will be disabled.', 'wp-statistics'
 
 
136
  ); ?></p>
137
  </td>
138
  </tr>
149
  _e('Not installed', 'wp-statistics');
150
  } ?></strong>
151
 
152
+ <p class="description"><?php _e('If the gzopen() function is installed. The gzopen() function is required for the GeoIP database to be downloaded successfully.', 'wp-statistics'); ?></p>
 
153
  </td>
154
  </tr>
155
 
165
  _e('Not installed', 'wp-statistics');
166
  } ?></strong>
167
 
168
+ <p class="description"><?php _e('If the GMP Math PHP extension is loaded, either GMP or BCMath is required for the GeoIP database to be read successfully.', 'wp-statistics'); ?></p>
 
169
  </td>
170
  </tr>
171
 
181
  _e('Not installed', 'wp-statistics');
182
  } ?></strong>
183
 
184
+ <p class="description"><?php _e('If the BCMath PHP extension is loaded, either GMP or BCMath is required for the GeoIP database to be read successfully.', 'wp-statistics'); ?></p>
 
185
  </td>
186
  </tr>
187
  </tbody>
212
  $GeoIP_filedate);
213
  } ?></strong>
214
 
215
+ <p class="description"><?php _e('The file size and date of the GeoIP database.', 'wp-statistics'); ?></p>
 
216
  </td>
217
  </tr>
218
  </tbody>
242
  </th>
243
 
244
  <td>
245
+ <strong><?php echo esc_textarea(\WP_STATISTICS\UserAgent::getHttpUserAgent()); ?></strong>
 
246
  <p class="description"><?php _e('The client user agent string.', 'wp-statistics'); ?></p>
247
  </td>
248
  </tr>
311
  ' . $server . '
312
  </th>
313
  <td>
314
+ <strong>' . esc_attr($_SERVER[$server]) . '</strong>
315
  </td>
316
  </tr>';
317
  }
includes/admin/templates/pages/author.php CHANGED
@@ -67,10 +67,10 @@
67
  <div class="meta-box-sortables">
68
  <div class="postbox">
69
  <button class="handlediv" type="button" aria-expanded="true">
70
- <span class="screen-reader-text"><?php printf(__('Toggle panel: %s', 'wp-statistics'), $top_title); ?></span>
71
  <span class="toggle-indicator" aria-hidden="true"></span>
72
  </button>
73
- <h2 class="hndle wps-d-inline-block"><span><?php echo $top_title; ?></span></h2>
74
  <div class="inside">
75
  <table class="widefat table-stats wps-summary-stats" id="summary-stats">
76
  <tbody>
@@ -86,7 +86,8 @@
86
  <a href="<?php echo esc_url($item['link']); ?>" title="<?php echo esc_attr($item['name']); ?>"><?php echo esc_attr($item['name']); ?></a>
87
  </th>
88
  <th class="th-center">
89
- <span><?php echo number_format_i18n($item['count_visit']); ?></span></th>
 
90
  </tr>
91
  <?php
92
  }
67
  <div class="meta-box-sortables">
68
  <div class="postbox">
69
  <button class="handlediv" type="button" aria-expanded="true">
70
+ <span class="screen-reader-text"><?php printf(__('Toggle panel: %s', 'wp-statistics'), esc_attr($top_title)); ?></span>
71
  <span class="toggle-indicator" aria-hidden="true"></span>
72
  </button>
73
+ <h2 class="hndle wps-d-inline-block"><span><?php echo esc_attr($top_title); ?></span></h2>
74
  <div class="inside">
75
  <table class="widefat table-stats wps-summary-stats" id="summary-stats">
76
  <tbody>
86
  <a href="<?php echo esc_url($item['link']); ?>" title="<?php echo esc_attr($item['name']); ?>"><?php echo esc_attr($item['name']); ?></a>
87
  </th>
88
  <th class="th-center">
89
+ <span><?php echo number_format_i18n($item['count_visit']); ?></span>
90
+ </th>
91
  </tr>
92
  <?php
93
  }
includes/admin/templates/pages/category.php CHANGED
@@ -67,10 +67,10 @@
67
  <div class="meta-box-sortables">
68
  <div class="postbox">
69
  <button class="handlediv" type="button" aria-expanded="true">
70
- <span class="screen-reader-text"><?php printf(__('Toggle panel: %s', 'wp-statistics'), $top_title); ?></span>
71
  <span class="toggle-indicator" aria-hidden="true"></span>
72
  </button>
73
- <h2 class="hndle wps-d-inline-block"><span><?php echo $top_title; ?></span></h2>
74
  <div class="inside">
75
  <table class="widefat table-stats wps-summary-stats" id="summary-stats">
76
  <tbody>
67
  <div class="meta-box-sortables">
68
  <div class="postbox">
69
  <button class="handlediv" type="button" aria-expanded="true">
70
+ <span class="screen-reader-text"><?php printf(__('Toggle panel: %s', 'wp-statistics'), esc_attr($top_title)); ?></span>
71
  <span class="toggle-indicator" aria-hidden="true"></span>
72
  </button>
73
+ <h2 class="hndle wps-d-inline-block"><span><?php echo esc_attr($top_title); ?></span></h2>
74
  <div class="inside">
75
  <table class="widefat table-stats wps-summary-stats" id="summary-stats">
76
  <tbody>
includes/admin/templates/pages/online.php CHANGED
@@ -4,7 +4,7 @@
4
  <div class="postbox">
5
  <div class="inside">
6
  <?php if (!is_array($user_online_list)) { ?>
7
- <div class='wps-center'><?php echo $user_online_list; ?></div>
8
  <?php } else { ?>
9
  <table width="100%" class="widefat table-stats">
10
  <tr>
@@ -34,18 +34,20 @@
34
  </td>
35
  <?php } ?>
36
  <?php if (WP_STATISTICS\GeoIP::active('city')) { ?>
37
- <td><?php echo $item['city']; ?></td>
38
  <?php } ?>
39
- <td style='text-align: left'><?php echo(isset($item['hash_ip']) ? $item['hash_ip'] : "<a href='" . $item['ip']['link'] . "'>" . $item['ip']['value'] . "</a>"); ?></td>
40
- <td style='text-align: left'><span><?php echo $item['online_for']; ?></span></td>
41
- <td style='text-align: left'><?php echo ($item['page']['link'] != '' ? '<a href="' . $item['page']['link'] . '" target="_blank" class="wps-text-muted">' : '') . $item['page']['title'] . ($item['page']['link'] != '' ? '</a>' : ''); ?></td>
42
- <td style='text-align: left'><?php echo $item['referred']; ?></td>
43
  <td style='text-align: left'>
44
  <?php if (isset($item['user']) and isset($item['user']['ID']) and $item['user']['ID'] > 0) { ?>
45
- <p><?php _e('ID', 'wp-statistics'); ?>: <a href="<?php echo get_edit_user_link($item['user']['ID']); ?>" target="_blank" class="wps-text-success">#<?php echo $item['user']['ID']; ?></a></p><p><?php _e('Email', 'wp-statistics'); ?>: <?php echo $item['user']['user_email']; ?></p><p><?php echo sprintf('Role: %s', implode(',', get_userdata($item['user']['ID'])->roles)) ?></p>
46
- <?php } else { ?><?php echo \WP_STATISTICS\Admin_Template::UnknownColumn(); ?><?php } ?>
 
 
47
  </td>
48
- <td style='text-align: center'><?php echo(isset($item['map']) ? "<a class='wps-text-muted' href='" . $item['ip']['link'] . "'>" . WP_STATISTICS\Admin_Template::icons('dashicons-visibility') . "</a><a class='show-map wps-text-muted' href='" . $item['map'] . "' target='_blank' title='" . __('Map', 'wp-statistics') . "'>" . WP_STATISTICS\Admin_Template::icons('dashicons-location-alt') . "</a>" : ""); ?></td>
49
  </tr>
50
  <?php } ?>
51
 
@@ -53,7 +55,7 @@
53
  <?php } ?>
54
  </div>
55
  </div>
56
- <?php echo isset($pagination) ? $pagination : ''; ?>
57
  </div>
58
  </div>
59
  </div>
4
  <div class="postbox">
5
  <div class="inside">
6
  <?php if (!is_array($user_online_list)) { ?>
7
+ <div class='wps-center'><?php echo esc_attr($user_online_list); ?></div>
8
  <?php } else { ?>
9
  <table width="100%" class="widefat table-stats">
10
  <tr>
34
  </td>
35
  <?php } ?>
36
  <?php if (WP_STATISTICS\GeoIP::active('city')) { ?>
37
+ <td><?php echo esc_attr($item['city']); ?></td>
38
  <?php } ?>
39
+ <td style='text-align: left'><?php echo(isset($item['hash_ip']) ? esc_attr($item['hash_ip']) : "<a href='" . esc_url($item['ip']['link']) . "'>" . esc_attr($item['ip']['value']) . "</a>"); ?></td>
40
+ <td style='text-align: left'><span><?php echo esc_attr($item['online_for']); ?></span></td>
41
+ <td style='text-align: left'><?php echo ($item['page']['link'] != '' ? '<a href="' . esc_url($item['page']['link']) . '" target="_blank" class="wps-text-muted">' : '') . esc_attr($item['page']['title']) . ($item['page']['link'] != '' ? '</a>' : ''); ?></td>
42
+ <td style='text-align: left'><?php echo wp_kses_post($item['referred']); ?></td>
43
  <td style='text-align: left'>
44
  <?php if (isset($item['user']) and isset($item['user']['ID']) and $item['user']['ID'] > 0) { ?>
45
+ <p><?php _e('ID', 'wp-statistics'); ?>: <a href="<?php echo get_edit_user_link($item['user']['ID']); ?>" target="_blank" class="wps-text-success">#<?php echo esc_attr($item['user']['ID']); ?></a></p><p><?php _e('Email', 'wp-statistics'); ?>: <?php echo esc_attr($item['user']['user_email']); ?></p><p><?php echo sprintf('Role: %s', implode(',', get_userdata($item['user']['ID'])->roles)) ?></p>
46
+ <?php } else { ?>
47
+ <?php echo \WP_STATISTICS\Admin_Template::UnknownColumn(); ?>
48
+ <?php } ?>
49
  </td>
50
+ <td style='text-align: center'><?php echo(isset($item['map']) ? "<a class='wps-text-muted' href='" . esc_url($item['ip']['link']) . "'>" . WP_STATISTICS\Admin_Template::icons('dashicons-visibility') . "</a><a class='show-map wps-text-muted' href='" . esc_url($item['map']) . "' target='_blank' title='" . __('Map', 'wp-statistics') . "'>" . WP_STATISTICS\Admin_Template::icons('dashicons-location-alt') . "</a>" : ""); ?></td>
51
  </tr>
52
  <?php } ?>
53
 
55
  <?php } ?>
56
  </div>
57
  </div>
58
+ <?php echo isset($pagination) ? $pagination : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
59
  </div>
60
  </div>
61
  </div>
includes/admin/templates/pages/overview.php CHANGED
@@ -19,7 +19,7 @@
19
  jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
20
 
21
  // postboxes setup
22
- postboxes.add_postbox_toggles('<?php echo $overview_page_slug; ?>');
23
  });
24
  </script>
25
 
19
  jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
20
 
21
  // postboxes setup
22
+ postboxes.add_postbox_toggles('<?php echo esc_attr($overview_page_slug); ?>');
23
  });
24
  </script>
25
 
includes/admin/templates/pages/page-chart.php CHANGED
@@ -15,13 +15,13 @@
15
  <div class="meta-box-sortables">
16
  <div class="postbox" id="wp-statistics-pages-widget">
17
  <button class="handlediv" type="button" aria-expanded="true">
18
- <span class="screen-reader-text">Toggle panel: Top Pages</span>
19
  <span class="toggle-indicator" aria-hidden="true"></span>
20
  </button>
21
 
22
- <h2 class="hndle wps-d-inline-block"><span>Visitors</span></h2>
23
  <div class="inside wps-wrap">
24
- <?php echo $visitors; ?>
25
  </div>
26
  </div>
27
  </div>
15
  <div class="meta-box-sortables">
16
  <div class="postbox" id="wp-statistics-pages-widget">
17
  <button class="handlediv" type="button" aria-expanded="true">
18
+ <span class="screen-reader-text"><?php _e('Toggle panel: Top Pages', 'wp-statistics'); ?></span>
19
  <span class="toggle-indicator" aria-hidden="true"></span>
20
  </button>
21
 
22
+ <h2 class="hndle wps-d-inline-block"><span><?php _e('Visitors', 'wp-statistics'); ?></span></h2>
23
  <div class="inside wps-wrap">
24
+ <?php echo wp_kses_post($visitors); ?>
25
  </div>
26
  </div>
27
  </div>
includes/admin/templates/pages/pages.php CHANGED
@@ -21,10 +21,10 @@
21
  <div class="meta-box-sortables">
22
  <div class="postbox" id="<?php echo \WP_STATISTICS\Meta_Box::getMetaBoxKey('pages'); ?>">
23
  <button class="handlediv" type="button" aria-expanded="true">
24
- <span class="screen-reader-text"><?php printf(__('Toggle panel: %s', 'wp-statistics'), $title); ?></span>
25
  <span class="toggle-indicator" aria-hidden="true"></span>
26
  </button>
27
- <h2 class="hndle wps-d-inline-block"><span><?php echo $title; ?></span></h2>
28
  <div class="inside">
29
 
30
  <?php
@@ -47,19 +47,18 @@
47
  ?>
48
 
49
  <tr>
50
- <td style='text-align: left;'><?php echo $i; ?></td>
51
  <td style='text-align: left;'>
52
- <span title='<?php echo $li['title']; ?>' class='wps-cursor-default wps-text-wrap'>
53
- <?php echo $li['title']; ?>
54
  </span>
55
  </td>
56
  <td style='text-align: left;'>
57
- <a href="<?php echo $li['link']; ?>" title="<?php echo $li['title']; ?>" target="_blank"><?php echo $li['str_url']; ?>
58
- </a>
59
  </td>
60
  <td style="text-align: left">
61
- <a href="<?php echo $li['hits_page']; ?>" class="wps-text-muted">
62
- <?php echo $li['number']; ?>
63
  </a>
64
  </td>
65
  </tr>
@@ -73,11 +72,9 @@
73
  <?php
74
  }
75
  ?>
76
-
77
-
78
  </div>
79
  </div>
80
- <?php echo isset($pagination) ? $pagination : ''; ?>
81
  </div>
82
  </div>
83
  </div>
21
  <div class="meta-box-sortables">
22
  <div class="postbox" id="<?php echo \WP_STATISTICS\Meta_Box::getMetaBoxKey('pages'); ?>">
23
  <button class="handlediv" type="button" aria-expanded="true">
24
+ <span class="screen-reader-text"><?php printf(__('Toggle panel: %s', 'wp-statistics'), esc_attr($title)); ?></span>
25
  <span class="toggle-indicator" aria-hidden="true"></span>
26
  </button>
27
+ <h2 class="hndle wps-d-inline-block"><span><?php echo esc_attr($title); ?></span></h2>
28
  <div class="inside">
29
 
30
  <?php
47
  ?>
48
 
49
  <tr>
50
+ <td style='text-align: left;'><?php echo esc_attr($i); ?></td>
51
  <td style='text-align: left;'>
52
+ <span title='<?php echo esc_attr($li['title']); ?>' class='wps-cursor-default wps-text-wrap'>
53
+ <?php echo esc_attr($li['title']); ?>
54
  </span>
55
  </td>
56
  <td style='text-align: left;'>
57
+ <a href="<?php echo esc_url($li['link']); ?>" title="<?php echo esc_attr($li['title']); ?>" target="_blank"><?php echo esc_attr($li['str_url']); ?></a>
 
58
  </td>
59
  <td style="text-align: left">
60
+ <a href="<?php echo esc_url($li['hits_page']); ?>" class="wps-text-muted">
61
+ <?php echo esc_attr($li['number']); ?>
62
  </a>
63
  </td>
64
  </tr>
72
  <?php
73
  }
74
  ?>
 
 
75
  </div>
76
  </div>
77
+ <?php echo isset($pagination) ? $pagination : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
78
  </div>
79
  </div>
80
  </div>
includes/admin/templates/pages/refer.url.php CHANGED
@@ -5,7 +5,7 @@
5
  |
6
  <li>
7
  <a class="current" href="<?php echo esc_url(add_query_arg(array('referrer' => $args['domain']))); ?>">
8
- <?php echo $args['domain']; ?>
9
  <span class="count">(<?php echo number_format_i18n($total); ?>)</span>
10
  </a>
11
  </li>
@@ -16,10 +16,10 @@
16
  <div class="meta-box-sortables">
17
  <div class="postbox">
18
  <button class="handlediv" type="button" aria-expanded="true">
19
- <span class="screen-reader-text"><?php echo sprintf(__('Toggle panel: %s', 'wp-statistics'), $title); ?></span>
20
  <span class="toggle-indicator" aria-hidden="true"></span>
21
  </button>
22
- <h2 class="hndle wps-d-inline-block"><span><?php echo $title; ?></span></h2>
23
  <div class="inside">
24
  <?php if (count($list) < 1) { ?>
25
  <div class='wps-center'><?php _e("No information is available.", "wp-statistics"); ?></div>
@@ -40,7 +40,7 @@
40
  <td style="text-align: left">
41
  <a href="<?php echo esc_url($item['refer']); ?>" target="_blank" title="<?php echo esc_attr($item['refer']); ?>"><?php echo preg_replace("(^https?://)", "", trim($item['refer'])); ?></a>
42
  </td>
43
- <td style='text-align: left;'><?php echo(isset($item['hash_ip']) ? $item['hash_ip'] : "<a href='" . $item['ip']['link'] . "' class='wps-text-success'>" . $item['ip']['value'] . "</a>"); ?></td>
44
  <td style="text-align: left">
45
  <a href="<?php echo esc_url($item['browser']['link']); ?>" title="<?php echo esc_attr($item['browser']['name']); ?>"><img src="<?php echo esc_url($item['browser']['logo']); ?>" alt="<?php echo esc_attr($item['browser']['name']); ?>" class="log-tools" title="<?php echo esc_attr($item['browser']['name']); ?>"/></a>
46
  </td>
@@ -49,15 +49,15 @@
49
  <img src="<?php echo esc_url($item['country']['flag']); ?>" alt="<?php echo esc_attr($item['country']['name']); ?>" title="<?php echo esc_attr($item['country']['name']); ?>" class="log-tools"/>
50
  </td>
51
  <?php } ?>
52
- <td style="text-align: left"><?php echo $item['date']; ?></td>
53
- <td style='text-align: center'><?php echo(isset($item['map']) ? "<a class='wps-text-muted' href='" . $item['ip']['link'] . "'>" . WP_STATISTICS\Admin_Template::icons('dashicons-visibility') . "</a><a class='show-map wps-text-muted' href='" . $item['map'] . "' target='_blank' title='" . __('Map', 'wp-statistics') . "'>" . WP_STATISTICS\Admin_Template::icons('dashicons-location-alt') . "</a>" : ""); ?></td>
54
  </tr>
55
  <?php } ?>
56
  </table>
57
  <?php } ?>
58
  </div>
59
  </div>
60
- <?php echo isset($pagination) ? $pagination : ''; ?>
61
  </div>
62
  </div>
63
  </div>
5
  |
6
  <li>
7
  <a class="current" href="<?php echo esc_url(add_query_arg(array('referrer' => $args['domain']))); ?>">
8
+ <?php echo esc_attr($args['domain']); ?>
9
  <span class="count">(<?php echo number_format_i18n($total); ?>)</span>
10
  </a>
11
  </li>
16
  <div class="meta-box-sortables">
17
  <div class="postbox">
18
  <button class="handlediv" type="button" aria-expanded="true">
19
+ <span class="screen-reader-text"><?php echo sprintf(__('Toggle panel: %s', 'wp-statistics'), esc_attr($title)); ?></span>
20
  <span class="toggle-indicator" aria-hidden="true"></span>
21
  </button>
22
+ <h2 class="hndle wps-d-inline-block"><span><?php echo esc_attr($title); ?></span></h2>
23
  <div class="inside">
24
  <?php if (count($list) < 1) { ?>
25
  <div class='wps-center'><?php _e("No information is available.", "wp-statistics"); ?></div>
40
  <td style="text-align: left">
41
  <a href="<?php echo esc_url($item['refer']); ?>" target="_blank" title="<?php echo esc_attr($item['refer']); ?>"><?php echo preg_replace("(^https?://)", "", trim($item['refer'])); ?></a>
42
  </td>
43
+ <td style='text-align: left;'><?php echo(isset($item['hash_ip']) ? $item['hash_ip'] : "<a href='" . esc_url($item['ip']['link']) . "' class='wps-text-success'>" . esc_attr($item['ip']['value']) . "</a>"); ?></td>
44
  <td style="text-align: left">
45
  <a href="<?php echo esc_url($item['browser']['link']); ?>" title="<?php echo esc_attr($item['browser']['name']); ?>"><img src="<?php echo esc_url($item['browser']['logo']); ?>" alt="<?php echo esc_attr($item['browser']['name']); ?>" class="log-tools" title="<?php echo esc_attr($item['browser']['name']); ?>"/></a>
46
  </td>
49
  <img src="<?php echo esc_url($item['country']['flag']); ?>" alt="<?php echo esc_attr($item['country']['name']); ?>" title="<?php echo esc_attr($item['country']['name']); ?>" class="log-tools"/>
50
  </td>
51
  <?php } ?>
52
+ <td style="text-align: left"><?php echo esc_attr($item['date']); ?></td>
53
+ <td style='text-align: center'><?php echo(isset($item['map']) ? "<a class='wps-text-muted' href='" . esc_url($item['ip']['link']) . "'>" . WP_STATISTICS\Admin_Template::icons('dashicons-visibility') . "</a><a class='show-map wps-text-muted' href='" . esc_url($item['map']) . "' target='_blank' title='" . __('Map', 'wp-statistics') . "'>" . WP_STATISTICS\Admin_Template::icons('dashicons-location-alt') . "</a>" : ""); ?></td>
54
  </tr>
55
  <?php } ?>
56
  </table>
57
  <?php } ?>
58
  </div>
59
  </div>
60
+ <?php echo isset($pagination) ? $pagination : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
61
  </div>
62
  </div>
63
  </div>
includes/admin/templates/pages/tag.php CHANGED
@@ -67,10 +67,10 @@
67
  <div class="meta-box-sortables">
68
  <div class="postbox">
69
  <button class="handlediv" type="button" aria-expanded="true">
70
- <span class="screen-reader-text"><?php printf(__('Toggle panel: %s', 'wp-statistics'), $top_title); ?></span>
71
  <span class="toggle-indicator" aria-hidden="true"></span>
72
  </button>
73
- <h2 class="hndle wps-d-inline-block"><span><?php echo $top_title; ?></span></h2>
74
  <div class="inside">
75
  <table class="widefat table-stats wps-summary-stats" id="summary-stats">
76
  <tbody>
67
  <div class="meta-box-sortables">
68
  <div class="postbox">
69
  <button class="handlediv" type="button" aria-expanded="true">
70
+ <span class="screen-reader-text"><?php printf(__('Toggle panel: %s', 'wp-statistics'), esc_attr($top_title)); ?></span>
71
  <span class="toggle-indicator" aria-hidden="true"></span>
72
  </button>
73
+ <h2 class="hndle wps-d-inline-block"><span><?php echo esc_attr($top_title); ?></span></h2>
74
  <div class="inside">
75
  <table class="widefat table-stats wps-summary-stats" id="summary-stats">
76
  <tbody>
includes/admin/templates/pages/top-visitors.php CHANGED
@@ -1,7 +1,7 @@
1
  <form method="get" style="margin-top: 15px;">
2
  <?php _e('Date', 'wp-statistics'); ?>:
3
- <input type="hidden" name="page" value="<?php echo $pageName; ?>">
4
- <input type="text" size="18" name="day" data-wps-date-picker="day" value="<?php echo $day; ?>" autocomplete="off" placeholder="YYYY-MM-DD">
5
  <input type="submit" value="<?php _e('Go', 'wp-statistics'); ?>" class="button-primary">
6
  </form>
7
  <div class="wp-clearfix"></div>
@@ -38,32 +38,32 @@
38
  </td>
39
  <?php if (WP_STATISTICS\GeoIP::active()) { ?>
40
  <td style="text-align: left">
41
- <img src="<?php echo $item['country']['flag']; ?>" alt="<?php echo $item['country']['name']; ?>" title="<?php echo $item['country']['name']; ?>" class="log-tools"/>
42
  </td>
43
  <?php } ?>
44
  <?php if (WP_STATISTICS\GeoIP::active('city')) { ?>
45
- <td><?php echo $item['city']; ?></td>
46
  <?php } ?>
47
- <td style='text-align: left'><span><?php echo $item['date']; ?></span></td>
48
- <td style='text-align: left'><?php echo(isset($item['hash_ip']) ? $item['hash_ip'] : "<a href='" . $item['ip']['link'] . "' class='wps-text-muted'>" . $item['ip']['value'] . "</a>"); ?></td>
49
  <td style='text-align: left'><?php echo esc_attr($item['platform']); ?></td>
50
  <td style='text-align: left'>
51
  <?php if (isset($item['user']) and isset($item['user']['ID']) and $item['user']['ID'] > 0) { ?>
52
- <a href="<?php echo \WP_STATISTICS\Menus::admin_url('visitors', array('user_id' => $item['user']['ID'])); ?>" class="wps-text-success"><?php echo $item['user']['user_login']; ?></a>
53
  <?php } else { ?>
54
  <?php echo \WP_STATISTICS\Admin_Template::UnknownColumn(); ?>
55
  <?php } ?>
56
  </td>
57
- <td style='text-align: left'><?php echo $item['referred']; ?></td>
58
- <td style='text-align: left'><?php echo $item['hits']; ?></td>
59
- <td style='text-align: center'><?php echo(isset($item['map']) ? "<a class='wps-text-muted' href='" . $item['ip']['link'] . "'>" . WP_STATISTICS\Admin_Template::icons('dashicons-visibility') . "</a><a class='show-map wps-text-muted' href='" . $item['map'] . "' target='_blank' title='" . __('Map', 'wp-statistics') . "'>" . WP_STATISTICS\Admin_Template::icons('dashicons-location-alt') . "</a>" : ""); ?></td>
60
  </tr>
61
  <?php } ?>
62
  </table>
63
  <?php } ?>
64
  </div>
65
  </div>
66
- <?php echo isset($pagination) ? $pagination : ''; ?>
67
  </div>
68
  </div>
69
  </div>
1
  <form method="get" style="margin-top: 15px;">
2
  <?php _e('Date', 'wp-statistics'); ?>:
3
+ <input type="hidden" name="page" value="<?php echo esc_attr($pageName); ?>">
4
+ <input type="text" size="18" name="day" data-wps-date-picker="day" value="<?php echo esc_attr($day); ?>" autocomplete="off" placeholder="YYYY-MM-DD">
5
  <input type="submit" value="<?php _e('Go', 'wp-statistics'); ?>" class="button-primary">
6
  </form>
7
  <div class="wp-clearfix"></div>
38
  </td>
39
  <?php if (WP_STATISTICS\GeoIP::active()) { ?>
40
  <td style="text-align: left">
41
+ <img src="<?php echo esc_url($item['country']['flag']); ?>" alt="<?php echo esc_attr($item['country']['name']); ?>" title="<?php echo esc_attr($item['country']['name']); ?>" class="log-tools"/>
42
  </td>
43
  <?php } ?>
44
  <?php if (WP_STATISTICS\GeoIP::active('city')) { ?>
45
+ <td><?php echo esc_attr($item['city']); ?></td>
46
  <?php } ?>
47
+ <td style='text-align: left'><span><?php echo esc_attr($item['date']); ?></span></td>
48
+ <td style='text-align: left'><?php echo(isset($item['hash_ip']) ? esc_attr($item['hash_ip']) : "<a href='" . esc_url($item['ip']['link']) . "' class='wps-text-muted'>" . esc_attr($item['ip']['value']) . "</a>"); ?></td>
49
  <td style='text-align: left'><?php echo esc_attr($item['platform']); ?></td>
50
  <td style='text-align: left'>
51
  <?php if (isset($item['user']) and isset($item['user']['ID']) and $item['user']['ID'] > 0) { ?>
52
+ <a href="<?php echo \WP_STATISTICS\Menus::admin_url('visitors', array('user_id' => $item['user']['ID'])); ?>" class="wps-text-success"><?php echo esc_attr($item['user']['user_login']); ?></a>
53
  <?php } else { ?>
54
  <?php echo \WP_STATISTICS\Admin_Template::UnknownColumn(); ?>
55
  <?php } ?>
56
  </td>
57
+ <td style='text-align: left'><?php echo wp_kses_post($item['referred']); ?></td>
58
+ <td style='text-align: left'><?php echo esc_attr($item['hits']); ?></td>
59
+ <td style='text-align: center'><?php echo(isset($item['map']) ? "<a class='wps-text-muted' href='" . esc_url($item['ip']['link']) . "'>" . WP_STATISTICS\Admin_Template::icons('dashicons-visibility') . "</a><a class='show-map wps-text-muted' href='" . esc_url($item['map']) . "' target='_blank' title='" . __('Map', 'wp-statistics') . "'>" . WP_STATISTICS\Admin_Template::icons('dashicons-location-alt') . "</a>" : ""); ?></td>
60
  </tr>
61
  <?php } ?>
62
  </table>
63
  <?php } ?>
64
  </div>
65
  </div>
66
+ <?php echo isset($pagination) ? $pagination : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
67
  </div>
68
  </div>
69
  </div>
includes/admin/templates/pages/top.refer.php CHANGED
@@ -32,14 +32,14 @@
32
  <td><?php echo number_format_i18n($item['rate']); ?></td>
33
  <td><?php echo WP_STATISTICS\Helper::show_site_icon($item['domain']) . " " . \WP_STATISTICS\Referred::get_referrer_link($item['domain'], $item['title']); ?>
34
  </td>
35
- <td><?php echo(trim($item['title']) == "" ? \WP_STATISTICS\Admin_Template::UnknownColumn() : $item['title']); ?>
36
  </td>
37
- <td><?php echo(trim($item['ip']) == "" ? \WP_STATISTICS\Admin_Template::UnknownColumn() : $item['ip']); ?></td>
38
  <?php if (\WP_STATISTICS\GeoIP::active()) { ?>
39
- <td><?php echo(trim($item['country']) == "" ? \WP_STATISTICS\Admin_Template::UnknownColumn() : "<img src='" . $item['flag'] . "' title='" . $item['country'] . "' alt='" . $item['country'] . "' class='log-tools'/>"); ?></td>
40
  <?php } ?>
41
  <td>
42
- <a class='wps-text-success' href='<?php echo esc_url($item['page_link']); ?>'><?php echo $item['number']; ?></a>
43
  </td>
44
  </tr>
45
 
@@ -48,7 +48,7 @@
48
  <?php } ?>
49
  </div>
50
  </div>
51
- <?php echo isset($pagination) ? $pagination : ''; ?>
52
  </div>
53
  </div>
54
  </div>
32
  <td><?php echo number_format_i18n($item['rate']); ?></td>
33
  <td><?php echo WP_STATISTICS\Helper::show_site_icon($item['domain']) . " " . \WP_STATISTICS\Referred::get_referrer_link($item['domain'], $item['title']); ?>
34
  </td>
35
+ <td><?php echo(trim($item['title']) == "" ? \WP_STATISTICS\Admin_Template::UnknownColumn() : esc_attr($item['title'])); ?>
36
  </td>
37
+ <td><?php echo(trim($item['ip']) == "" ? \WP_STATISTICS\Admin_Template::UnknownColumn() : esc_attr($item['ip'])); ?></td>
38
  <?php if (\WP_STATISTICS\GeoIP::active()) { ?>
39
+ <td><?php echo(trim($item['country']) == "" ? \WP_STATISTICS\Admin_Template::UnknownColumn() : "<img src='" . esc_url($item['flag']) . "' title='" . esc_attr($item['country']) . "' alt='" . esc_attr($item['country']) . "' class='log-tools'/>"); ?></td>
40
  <?php } ?>
41
  <td>
42
+ <a class='wps-text-success' href='<?php echo esc_url($item['page_link']); ?>'><?php echo esc_attr($item['number']); ?></a>
43
  </td>
44
  </tr>
45
 
48
  <?php } ?>
49
  </div>
50
  </div>
51
+ <?php echo isset($pagination) ? $pagination : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
52
  </div>
53
  </div>
54
  </div>
includes/admin/templates/pages/visitors.php CHANGED
@@ -52,47 +52,47 @@
52
  <?php foreach ($list as $item) { ?>
53
  <tr>
54
  <td style="text-align: left">
55
- <a href="<?php echo esc_url($item['browser']['link']); ?>" title="<?php echo $item['browser']['name']; ?>"><img src="<?php echo $item['browser']['logo']; ?>" alt="<?php echo $item['browser']['name']; ?>" class="log-tools" title="<?php echo $item['browser']['name']; ?>"/></a>
56
  </td>
57
  <?php if (WP_STATISTICS\GeoIP::active()) { ?>
58
  <td style="text-align: left">
59
- <img src="<?php echo $item['country']['flag']; ?>" alt="<?php echo $item['country']['name']; ?>" title="<?php echo $item['country']['name']; ?>" class="log-tools"/>
60
  </td>
61
  <?php } ?>
62
  <?php if (WP_STATISTICS\GeoIP::active('city')) { ?>
63
- <td><?php echo $item['city']; ?></td>
64
  <?php } ?>
65
- <td style='text-align: left'><span><?php echo $item['date']; ?></span></td>
66
  <td style='text-align: left'>
67
- <?php echo(isset($item['map']) ? "<a class='show-map' href='" . $item['map'] . "' target='_blank' title='" . __('Map', 'wp-statistics') . "'>" . WP_STATISTICS\Admin_Template::icons('dashicons-location-alt') . "</a>" : ""); ?>
68
- <?php echo(isset($item['hash_ip']) ? $item['hash_ip'] : "<a href='" . $item['ip']['link'] . "'>" . $item['ip']['value'] . "</a>"); ?>
69
  </td>
70
  <td style='text-align: left'><?php echo esc_attr($item['platform']); ?></td>
71
- <td style='text-align: left'><?php echo $item['hits']; ?></td>
72
  <td style='text-align: left'>
73
  <?php if (isset($item['user']) and isset($item['user']['ID']) and $item['user']['ID'] > 0) { ?>
74
- <a href="<?php echo \WP_STATISTICS\Menus::admin_url('visitors', array('user_id' => $item['user']['ID'])); ?>" class="wps-text-success"><?php echo $item['user']['user_login']; ?></a>
75
  <?php } else { ?>
76
- <?php echo \WP_STATISTICS\Admin_Template::UnknownColumn(); ?>
77
  <?php } ?>
78
  </td>
79
  <?php
80
  if (\WP_STATISTICS\Option::get('visitors_log')) {
81
  ?>
82
  <td style='text-align: left;' class="tbl-page-column">
83
- <span class="txt-overflow" title="<?php echo($item['page']['title'] != "" ? $item['page']['title'] : ''); ?>"><?php echo ($item['page']['link'] != '' ? '<a href="' . $item['page']['link'] . '" target="_blank" class="wps-text-muted">' : '') . ($item['page']['title'] != "" ? $item['page']['title'] : \WP_STATISTICS\Admin_Template::UnknownColumn()) . ($item['page']['link'] != '' ? '</a>' : ''); ?></span>
84
  </td>
85
  <?php
86
  }
87
  ?>
88
- <td style='text-align: left'><?php echo $item['referred']; ?></td>
89
  </tr>
90
  <?php } ?>
91
  </table>
92
  <?php } ?>
93
  </div>
94
  </div>
95
- <?php echo isset($pagination) ? $pagination : ''; ?>
96
  </div>
97
  </div>
98
  </div>
52
  <?php foreach ($list as $item) { ?>
53
  <tr>
54
  <td style="text-align: left">
55
+ <a href="<?php echo esc_url($item['browser']['link']); ?>" title="<?php echo esc_attr($item['browser']['name']); ?>"><img src="<?php echo esc_url($item['browser']['logo']); ?>" alt="<?php echo esc_attr($item['browser']['name']); ?>" class="log-tools" title="<?php echo esc_attr($item['browser']['name']); ?>"/></a>
56
  </td>
57
  <?php if (WP_STATISTICS\GeoIP::active()) { ?>
58
  <td style="text-align: left">
59
+ <img src="<?php echo esc_attr($item['country']['flag']); ?>" alt="<?php echo esc_attr($item['country']['name']); ?>" title="<?php echo esc_attr($item['country']['name']); ?>" class="log-tools"/>
60
  </td>
61
  <?php } ?>
62
  <?php if (WP_STATISTICS\GeoIP::active('city')) { ?>
63
+ <td><?php echo esc_attr($item['city']); ?></td>
64
  <?php } ?>
65
+ <td style='text-align: left'><span><?php echo esc_attr($item['date']); ?></span></td>
66
  <td style='text-align: left'>
67
+ <?php echo(isset($item['map']) ? "<a class='show-map' href='" . esc_url($item['map']) . "' target='_blank' title='" . __('Map', 'wp-statistics') . "'>" . WP_STATISTICS\Admin_Template::icons('dashicons-location-alt') . "</a>" : ""); ?>
68
+ <?php echo(isset($item['hash_ip']) ? esc_attr($item['hash_ip']) : "<a href='" . esc_url($item['ip']['link']) . "'>" . esc_attr($item['ip']['value']) . "</a>"); ?>
69
  </td>
70
  <td style='text-align: left'><?php echo esc_attr($item['platform']); ?></td>
71
+ <td style='text-align: left'><?php echo esc_attr($item['hits']); ?></td>
72
  <td style='text-align: left'>
73
  <?php if (isset($item['user']) and isset($item['user']['ID']) and $item['user']['ID'] > 0) { ?>
74
+ <a href="<?php echo esc_url(\WP_STATISTICS\Menus::admin_url('visitors', array('user_id' => $item['user']['ID']))); ?>" class="wps-text-success"><?php echo esc_attr($item['user']['user_login']); ?></a>
75
  <?php } else { ?>
76
+ <?php echo \WP_STATISTICS\Admin_Template::UnknownColumn(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
77
  <?php } ?>
78
  </td>
79
  <?php
80
  if (\WP_STATISTICS\Option::get('visitors_log')) {
81
  ?>
82
  <td style='text-align: left;' class="tbl-page-column">
83
+ <span class="txt-overflow" title="<?php echo($item['page']['title'] != "" ? esc_attr($item['page']['title']) : ''); ?>"><?php echo ($item['page']['link'] != '' ? '<a href="' . esc_url($item['page']['link']) . '" target="_blank" class="wps-text-muted">' : '') . ($item['page']['title'] != "" ? $item['page']['title'] : \WP_STATISTICS\Admin_Template::UnknownColumn()) . ($item['page']['link'] != '' ? '</a>' : ''); ?></span>
84
  </td>
85
  <?php
86
  }
87
  ?>
88
+ <td style='text-align: left'><?php echo wp_kses_post($item['referred']); ?></td>
89
  </tr>
90
  <?php } ?>
91
  </table>
92
  <?php } ?>
93
  </div>
94
  </div>
95
+ <?php echo isset($pagination) ? $pagination : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
96
  </div>
97
  </div>
98
  </div>
includes/admin/templates/pages/words.php CHANGED
@@ -37,30 +37,30 @@
37
 
38
  <?php foreach ($list as $item) { ?>
39
  <tr>
40
- <td style="text-align: left"><?php echo $item['word']; ?></td>
41
  <td style="text-align: left">
42
- <a href="<?php echo esc_url($item['browser']['link']); ?>" title="<?php echo $item['browser']['name']; ?>"><img src="<?php echo $item['browser']['logo']; ?>" alt="<?php echo $item['browser']['name']; ?>" class="log-tools" title="<?php echo $item['browser']['name']; ?>"/></a>
43
  </td>
44
  <?php if (WP_STATISTICS\GeoIP::active()) { ?>
45
  <td style="text-align: left">
46
- <img src="<?php echo $item['country']['flag']; ?>" alt="<?php echo $item['country']['name']; ?>" title="<?php echo $item['country']['name']; ?>" class="log-tools"/>
47
  </td>
48
  <?php } ?>
49
  <?php if (WP_STATISTICS\GeoIP::active('city')) { ?>
50
  <td style="text-align: left">
51
- <?php echo $item['city']; ?>
52
  </td>
53
  <?php } ?>
54
- <td style="text-align: left"><?php echo $item['date']; ?></td>
55
- <td style='text-align: left;'><?php echo(isset($item['hash_ip']) ? $item['hash_ip'] : "<a href='" . $item['ip']['link'] . "' class='wps-text-success'>" . $item['ip']['value'] . "</a>"); ?></td>
56
- <td style="text-align: left"><?php echo $item['referred']; ?></td>
57
  </tr>
58
  <?php } ?>
59
  </table>
60
  <?php } ?>
61
  </div>
62
  </div>
63
- <?php echo isset($pagination) ? $pagination : ''; ?>
64
  </div>
65
  </div>
66
  </div>
37
 
38
  <?php foreach ($list as $item) { ?>
39
  <tr>
40
+ <td style="text-align: left"><?php echo esc_attr($item['word']); ?></td>
41
  <td style="text-align: left">
42
+ <a href="<?php echo esc_url($item['browser']['link']); ?>" title="<?php echo esc_attr($item['browser']['name']); ?>"><img src="<?php echo esc_url($item['browser']['logo']); ?>" alt="<?php echo esc_attr($item['browser']['name']); ?>" class="log-tools" title="<?php echo esc_attr($item['browser']['name']); ?>"/></a>
43
  </td>
44
  <?php if (WP_STATISTICS\GeoIP::active()) { ?>
45
  <td style="text-align: left">
46
+ <img src="<?php echo esc_attr($item['country']['flag']); ?>" alt="<?php echo esc_attr($item['country']['name']); ?>" title="<?php echo esc_attr($item['country']['name']); ?>" class="log-tools"/>
47
  </td>
48
  <?php } ?>
49
  <?php if (WP_STATISTICS\GeoIP::active('city')) { ?>
50
  <td style="text-align: left">
51
+ <?php echo esc_attr($item['city']); ?>
52
  </td>
53
  <?php } ?>
54
+ <td style="text-align: left"><?php echo esc_attr($item['date']); ?></td>
55
+ <td style='text-align: left;'><?php echo(isset($item['hash_ip']) ? esc_attr($item['hash_ip']) : "<a href='" . esc_url($item['ip']['link']) . "' class='wps-text-success'>" . esc_attr($item['ip']['value']) . "</a>"); ?></td>
56
+ <td style="text-align: left"><?php echo wp_kses_post($item['referred']); ?></td>
57
  </tr>
58
  <?php } ?>
59
  </table>
60
  <?php } ?>
61
  </div>
62
  </div>
63
+ <?php echo isset($pagination) ? $pagination : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
64
  </div>
65
  </div>
66
  </div>
includes/admin/templates/postbox.php CHANGED
@@ -28,7 +28,7 @@
28
  $result = json_decode($response['body']);
29
  foreach ($result->items as $item) : ?>
30
  <div class="meta-box-sortables">
31
- <div class="inside-no-padding"><?php echo $item->content; ?></div>
32
  </div>
33
  <?php
34
  endforeach;
28
  $result = json_decode($response['body']);
29
  foreach ($result->items as $item) : ?>
30
  <div class="meta-box-sortables">
31
+ <div class="inside-no-padding"><?php echo wp_kses_post($item->content); ?></div>
32
  </div>
33
  <?php
34
  endforeach;
includes/admin/templates/settings/about.php CHANGED
@@ -4,14 +4,14 @@
4
  <tr valign="top">
5
  <td scope="row" align="center">
6
  <a href="https://wp-statistics.com" target="_blank">
7
- <img src="<?php echo WP_STATISTICS_URL . 'assets/images/logo-250.png'; ?>">
8
  </a>
9
  </td>
10
  </tr>
11
 
12
  <tr valign="top">
13
  <td scope="row" align="center">
14
- <h2><?php echo sprintf(__('WP-Statistics v%s', 'wp-statistics'), WP_STATISTICS_VERSION); ?></h2>
15
  </td>
16
  </tr>
17
 
4
  <tr valign="top">
5
  <td scope="row" align="center">
6
  <a href="https://wp-statistics.com" target="_blank">
7
+ <img src="<?php echo esc_url(WP_STATISTICS_URL . 'assets/images/logo-250.png'); ?>">
8
  </a>
9
  </td>
10
  </tr>
11
 
12
  <tr valign="top">
13
  <td scope="row" align="center">
14
+ <h2><?php echo sprintf(__('WP-Statistics v%s', 'wp-statistics'), esc_attr(WP_STATISTICS_VERSION)); ?></h2>
15
  </td>
16
  </tr>
17
 
includes/admin/templates/settings/access-level.php CHANGED
@@ -31,7 +31,8 @@ global $wp_roles;
31
  } else {
32
  $selected = "";
33
  }
34
- $option_list .= "<option value='{$key}'{$selected}>{$key}</option>";
 
35
  }
36
  ?>
37
  <tr valign="top">
@@ -39,7 +40,7 @@ global $wp_roles;
39
  <label for="wps_read_capability"><?php _e('Required User Level to View WP Statistics:', 'wp-statistics') ?></label>
40
  </th>
41
  <td>
42
- <select dir="ltr" id="wps_read_capability" name="wps_read_capability"><?php echo $option_list; ?></select>
43
  </td>
44
  </tr>
45
 
@@ -51,7 +52,8 @@ global $wp_roles;
51
  } else {
52
  $selected = "";
53
  }
54
- $option_list .= "<option value='{$key}'{$selected}>{$key}</option>";
 
55
  }
56
  ?>
57
  <tr valign="top">
@@ -59,7 +61,7 @@ global $wp_roles;
59
  <label for="wps_manage_capability"><?php _e('Required User Level to Manage WP Statistics:', 'wp-statistics') ?></label>
60
  </th>
61
  <td>
62
- <select dir="ltr" id="wps_manage_capability" name="wps_manage_capability"><?php echo $option_list; ?></select>
63
  </td>
64
  </tr>
65
 
31
  } else {
32
  $selected = "";
33
  }
34
+
35
+ $option_list .= sprintf("<option value='%s' %s>%s</option>", esc_attr($key), $selected, esc_attr($key));
36
  }
37
  ?>
38
  <tr valign="top">
40
  <label for="wps_read_capability"><?php _e('Required User Level to View WP Statistics:', 'wp-statistics') ?></label>
41
  </th>
42
  <td>
43
+ <select dir="ltr" id="wps_read_capability" name="wps_read_capability"><?php echo $option_list; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></select>
44
  </td>
45
  </tr>
46
 
52
  } else {
53
  $selected = "";
54
  }
55
+
56
+ $option_list .= sprintf("<option value='%s' %s>%s</option>", esc_attr($key), esc_attr($selected), esc_attr($key));
57
  }
58
  ?>
59
  <tr valign="top">
61
  <label for="wps_manage_capability"><?php _e('Required User Level to Manage WP Statistics:', 'wp-statistics') ?></label>
62
  </th>
63
  <td>
64
+ <select dir="ltr" id="wps_manage_capability" name="wps_manage_capability"><?php echo $option_list; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></select>
65
  </td>
66
  </tr>
67
 
includes/admin/templates/settings/exclusions.php CHANGED
@@ -33,11 +33,11 @@
33
  ?>
34
 
35
  <tr valign="top">
36
- <th scope="row"><label for="<?php echo $option_name; ?>"><?php echo $translated_role_name; ?>:</label>
37
  </th>
38
  <td>
39
- <input id="<?php echo $option_name; ?>" type="checkbox" value="1" name="<?php echo $option_name; ?>" <?php echo WP_STATISTICS\Option::get($store_name) == true ? "checked='checked'" : ''; ?>><label for="<?php echo $option_name; ?>"><?php _e('Exclude', 'wp-statistics'); ?></label>
40
- <p class="description"><?php echo sprintf(__('Exclude %s role from data collection.', 'wp-statistics'), $translated_role_name); ?></p>
41
  </td>
42
  </tr>
43
  <?php } ?>
@@ -60,7 +60,7 @@
60
  $robotlist = WP_STATISTICS\Helper::get_robots_list();
61
  update_option('wps_robotlist', $robotlist);
62
  }
63
- echo htmlentities($robotlist, ENT_QUOTES);
64
  ?>
65
  </textarea>
66
  <p class="description"><?php echo __('It is a list of words (one per line) to match against to detect robots. Entries must be at least four characters long, or they will be ignored.', 'wp-statistics'); ?></p>
@@ -91,14 +91,14 @@
91
  <tr valign="top">
92
  <th scope="row"><?php _e('Excluded IP Address List:', 'wp-statistics'); ?></th>
93
  <td>
94
- <textarea id="wps_exclude_ip" name="wps_exclude_ip" rows="5" cols="60" class="code" dir="ltr"><?php echo htmlentities(WP_STATISTICS\Option::get('exclude_ip'), ENT_QUOTES); ?></textarea>
95
  <p class="description"><?php echo __('You can add a list of IP addresses and subnet masks (one per line) to exclude from the statistics collection.', 'wp-statistics'); ?></p>
96
  <p class="description"><?php echo __('For IPv4 addresses, both 192.168.0.0/24 and 192.168.0.0/255.255.255.0 formats are acceptable. To specify an IP address, use a subnet value of 32 or 255.255.255.255.', 'wp-statistics'); ?></p>
97
  <p class="description"><?php echo __('For IPv6 addresses, use the fc00::/7 format.', 'wp-statistics'); ?></p>
98
  <?php
99
  foreach (\WP_STATISTICS\IP::$private_SubNets as $ip) {
100
  ?>
101
- <a onclick="var wps_exclude_ip = getElementById('wps_exclude_ip'); if( wps_exclude_ip != null ) { wps_exclude_ip.value = jQuery.trim( wps_exclude_ip.value + '\n<?php echo $ip; ?>' ); }" class="button"><?php _e('Add', 'wp-statistics'); ?><?php echo $ip; ?></a>
102
  <?php
103
  }
104
  ?>
@@ -144,7 +144,7 @@
144
  <tr valign="top">
145
  <th scope="row"><?php _e('Excluded Countries:', 'wp-statistics'); ?></th>
146
  <td>
147
- <textarea id="wps_excluded_countries" name="wps_excluded_countries" rows="5" cols="50" class="code" dir="ltr"><?php echo htmlentities(WP_STATISTICS\Option::get('excluded_countries'), ENT_QUOTES); ?></textarea>
148
  <p class="description"><?php echo __('Add the country codes (one per line, two letters each) to exclude them from statistics collection.', 'wp-statistics') . ' ' . __('Use "000" (three zeros) to exclude unknown countries.', 'wp-statistics') . ' ' . sprintf(__('(%1$sISO 3166 Country Codes%2$s)', 'wp-statistics'), '<a href="' . esc_url('https://dev.maxmind.com/geoip/legacy/codes/iso3166/') . '" target="_blank">', '</a>'); ?></p>
149
  </td>
150
  </tr>
@@ -152,7 +152,7 @@
152
  <tr valign="top">
153
  <th scope="row"><?php _e('Included Countries:', 'wp-statistics'); ?></th>
154
  <td>
155
- <textarea id="wps_included_countries" name="wps_included_countries" rows="5" cols="50" class="code" dir="ltr"><?php echo htmlentities(WP_STATISTICS\Option::get('included_countries'), ENT_QUOTES); ?></textarea>
156
  <p class="description"><?php echo __('Add the country codes (one per line, two letters each) to include them in statistics collection.', 'wp-statistics') . ' ' . __('Use "000" (three zeros) to exclude unknown countries.', 'wp-statistics') . ' ' . sprintf(__('(%1$sISO 3166 Country Codes%2$s)', 'wp-statistics'), '<a href="' . esc_url('https://dev.maxmind.com/geoip/legacy/codes/iso3166/') . '" target="_blank">', '</a>'); ?></p>
157
  </td>
158
  </tr>
@@ -169,7 +169,7 @@
169
  <tr valign="top">
170
  <th scope="row"><?php _e('Excluded Hosts:', 'wp-statistics'); ?></th>
171
  <td>
172
- <textarea id="wps_excluded_hosts" name="wps_excluded_hosts" rows="5" cols="80" class="code" dir="ltr"><?php echo htmlentities(WP_STATISTICS\Option::get('excluded_hosts'), ENT_QUOTES); ?></textarea>
173
  <p class="description"><?php echo __('You can add a list of fully qualified host names (i.e. server.example.com, one per line) to exclude from statistics collection.', 'wp-statistics'); ?></p><br>
174
  <p class="description"><?php echo __('Note: This option will NOT perform a reverse DNS lookup on each page load but instead cache the provided hostnames’ IP address for one hour. If you exclude dynamically assigned hosts, you may find some overlap when the host changes its IP address and when the cache is updated, resulting in some hits recorded.', 'wp-statistics'); ?></p>
175
  </td>
@@ -208,7 +208,7 @@
208
  <tr valign="top">
209
  <th scope="row"><?php _e('Excluded URLs:', 'wp-statistics'); ?></th>
210
  <td>
211
- <textarea id="wps_excluded_urls" name="wps_excluded_urls" rows="5" cols="80" class="code" dir="ltr"><?php echo htmlentities(WP_STATISTICS\Option::get('excluded_urls'), ENT_QUOTES); ?></textarea>
212
  <p class="description"><?php echo __('You can add a list of local URLs (i.e. /wordpress/about, one per line) to exclude from statistics collection.', 'wp-statistics'); ?></p><br>
213
  <p class="description"><?php echo __('Note: This option will NOT handle URL parameters (anything after the ?), only to the script name. Entries less than two characters will be ignored.', 'wp-statistics'); ?></p>
214
  </td>
33
  ?>
34
 
35
  <tr valign="top">
36
+ <th scope="row"><label for="<?php echo esc_attr($option_name); ?>"><?php echo esc_attr($translated_role_name); ?>:</label>
37
  </th>
38
  <td>
39
+ <input id="<?php echo esc_attr($option_name); ?>" type="checkbox" value="1" name="<?php echo esc_attr($option_name); ?>" <?php echo WP_STATISTICS\Option::get($store_name) == true ? "checked='checked'" : ''; ?>><label for="<?php echo esc_attr($option_name); ?>"><?php _e('Exclude', 'wp-statistics'); ?></label>
40
+ <p class="description"><?php echo sprintf(__('Exclude %s role from data collection.', 'wp-statistics'), esc_attr($translated_role_name)); ?></p>
41
  </td>
42
  </tr>
43
  <?php } ?>
60
  $robotlist = WP_STATISTICS\Helper::get_robots_list();
61
  update_option('wps_robotlist', $robotlist);
62
  }
63
+ echo esc_textarea($robotlist);
64
  ?>
65
  </textarea>
66
  <p class="description"><?php echo __('It is a list of words (one per line) to match against to detect robots. Entries must be at least four characters long, or they will be ignored.', 'wp-statistics'); ?></p>
91
  <tr valign="top">
92
  <th scope="row"><?php _e('Excluded IP Address List:', 'wp-statistics'); ?></th>
93
  <td>
94
+ <textarea id="wps_exclude_ip" name="wps_exclude_ip" rows="5" cols="60" class="code" dir="ltr"><?php echo esc_textarea(WP_STATISTICS\Option::get('exclude_ip')); ?></textarea>
95
  <p class="description"><?php echo __('You can add a list of IP addresses and subnet masks (one per line) to exclude from the statistics collection.', 'wp-statistics'); ?></p>
96
  <p class="description"><?php echo __('For IPv4 addresses, both 192.168.0.0/24 and 192.168.0.0/255.255.255.0 formats are acceptable. To specify an IP address, use a subnet value of 32 or 255.255.255.255.', 'wp-statistics'); ?></p>
97
  <p class="description"><?php echo __('For IPv6 addresses, use the fc00::/7 format.', 'wp-statistics'); ?></p>
98
  <?php
99
  foreach (\WP_STATISTICS\IP::$private_SubNets as $ip) {
100
  ?>
101
+ <a onclick="var wps_exclude_ip = getElementById('wps_exclude_ip'); if( wps_exclude_ip != null ) { wps_exclude_ip.value = jQuery.trim( wps_exclude_ip.value + '\n<?php echo esc_attr($ip); ?>' ); }" class="button"><?php _e('Add', 'wp-statistics'); ?><?php echo esc_attr($ip); ?></a>
102
  <?php
103
  }
104
  ?>
144
  <tr valign="top">
145
  <th scope="row"><?php _e('Excluded Countries:', 'wp-statistics'); ?></th>
146
  <td>
147
+ <textarea id="wps_excluded_countries" name="wps_excluded_countries" rows="5" cols="50" class="code" dir="ltr"><?php echo esc_textarea(WP_STATISTICS\Option::get('excluded_countries')); ?></textarea>
148
  <p class="description"><?php echo __('Add the country codes (one per line, two letters each) to exclude them from statistics collection.', 'wp-statistics') . ' ' . __('Use "000" (three zeros) to exclude unknown countries.', 'wp-statistics') . ' ' . sprintf(__('(%1$sISO 3166 Country Codes%2$s)', 'wp-statistics'), '<a href="' . esc_url('https://dev.maxmind.com/geoip/legacy/codes/iso3166/') . '" target="_blank">', '</a>'); ?></p>
149
  </td>
150
  </tr>
152
  <tr valign="top">
153
  <th scope="row"><?php _e('Included Countries:', 'wp-statistics'); ?></th>
154
  <td>
155
+ <textarea id="wps_included_countries" name="wps_included_countries" rows="5" cols="50" class="code" dir="ltr"><?php echo esc_textarea(WP_STATISTICS\Option::get('included_countries')); ?></textarea>
156
  <p class="description"><?php echo __('Add the country codes (one per line, two letters each) to include them in statistics collection.', 'wp-statistics') . ' ' . __('Use "000" (three zeros) to exclude unknown countries.', 'wp-statistics') . ' ' . sprintf(__('(%1$sISO 3166 Country Codes%2$s)', 'wp-statistics'), '<a href="' . esc_url('https://dev.maxmind.com/geoip/legacy/codes/iso3166/') . '" target="_blank">', '</a>'); ?></p>
157
  </td>
158
  </tr>
169
  <tr valign="top">
170
  <th scope="row"><?php _e('Excluded Hosts:', 'wp-statistics'); ?></th>
171
  <td>
172
+ <textarea id="wps_excluded_hosts" name="wps_excluded_hosts" rows="5" cols="80" class="code" dir="ltr"><?php echo esc_textarea(WP_STATISTICS\Option::get('excluded_hosts')); ?></textarea>
173
  <p class="description"><?php echo __('You can add a list of fully qualified host names (i.e. server.example.com, one per line) to exclude from statistics collection.', 'wp-statistics'); ?></p><br>
174
  <p class="description"><?php echo __('Note: This option will NOT perform a reverse DNS lookup on each page load but instead cache the provided hostnames’ IP address for one hour. If you exclude dynamically assigned hosts, you may find some overlap when the host changes its IP address and when the cache is updated, resulting in some hits recorded.', 'wp-statistics'); ?></p>
175
  </td>
208
  <tr valign="top">
209
  <th scope="row"><?php _e('Excluded URLs:', 'wp-statistics'); ?></th>
210
  <td>
211
+ <textarea id="wps_excluded_urls" name="wps_excluded_urls" rows="5" cols="80" class="code" dir="ltr"><?php echo esc_textarea(WP_STATISTICS\Option::get('excluded_urls')); ?></textarea>
212
  <p class="description"><?php echo __('You can add a list of local URLs (i.e. /wordpress/about, one per line) to exclude from statistics collection.', 'wp-statistics'); ?></p><br>
213
  <p class="description"><?php echo __('Note: This option will NOT handle URL parameters (anything after the ?), only to the script name. Entries less than two characters will be ignored.', 'wp-statistics'); ?></p>
214
  </td>
includes/admin/templates/settings/externals.php CHANGED
@@ -107,7 +107,7 @@
107
  </th>
108
 
109
  <td>
110
- <input type="text" size="3" id="geoip-private-country-code" name="wps_private_country_code" value="<?php echo htmlentities(WP_STATISTICS\Option::get('private_country_code', \WP_STATISTICS\GeoIP::$private_country), ENT_QUOTES); ?>">
111
  <p class="description"><?php echo __('The international standard two letter country code (ie. US = United States, CA = Canada, etc.) for private (non-routable) IP addresses (ie. 10.0.0.1, 192.158.1.1, 127.0.0.1, etc.).', 'wp-statistics') . ' ' . __('Use "000" (three zeros) to use "Unknown" as the country code.', 'wp-statistics'); ?></p>
112
  </td>
113
  </tr>
@@ -200,10 +200,10 @@
200
  $next_schedule = wp_next_scheduled('wp_statistics_referrerspam_hook');
201
 
202
  if ($next_schedule) {
203
- echo date(get_option('date_format'), $next_schedule) . ' @ ' . date(get_option('time_format'), $next_schedule);
204
  } else {
205
  $next_update = time() + (86400 * 7);
206
- echo date(get_option('date_format'), $next_update) . ' @ ' . date(get_option('time_format'), time());
207
  }
208
 
209
  echo '</code></p>';
107
  </th>
108
 
109
  <td>
110
+ <input type="text" size="3" id="geoip-private-country-code" name="wps_private_country_code" value="<?php echo esc_attr(WP_STATISTICS\Option::get('private_country_code', \WP_STATISTICS\GeoIP::$private_country)); ?>">
111
  <p class="description"><?php echo __('The international standard two letter country code (ie. US = United States, CA = Canada, etc.) for private (non-routable) IP addresses (ie. 10.0.0.1, 192.158.1.1, 127.0.0.1, etc.).', 'wp-statistics') . ' ' . __('Use "000" (three zeros) to use "Unknown" as the country code.', 'wp-statistics'); ?></p>
112
  </td>
113
  </tr>
200
  $next_schedule = wp_next_scheduled('wp_statistics_referrerspam_hook');
201
 
202
  if ($next_schedule) {
203
+ echo esc_attr(date(get_option('date_format'), $next_schedule) . ' @ ' . date(get_option('time_format'), $next_schedule));
204
  } else {
205
  $next_update = time() + (86400 * 7);
206
+ echo esc_attr(date(get_option('date_format'), $next_update) . ' @ ' . date(get_option('time_format'), time()));
207
  }
208
 
209
  echo '</code></p>';
includes/admin/templates/settings/general.php CHANGED
@@ -29,12 +29,9 @@
29
  </th>
30
 
31
  <td>
32
- <input type="text" class="small-text code" id="check_online" name="wps_check_online" value="<?php echo htmlentities(WP_STATISTICS\Option::get('check_online'),
33
- ENT_QUOTES); ?>"/>
34
  <?php _e('Seconds', 'wp-statistics'); ?>
35
- <p class="description"><?php echo sprintf(__('Time for checking out accurate online users on the site. Now: %s Seconds',
36
- 'wp-statistics'),
37
- WP_STATISTICS\Option::get('check_online')); ?></p>
38
  </td>
39
  </tr>
40
 
@@ -46,8 +43,7 @@
46
  <td>
47
  <input id="allonline" type="checkbox" value="1" name="wps_all_online" <?php echo WP_STATISTICS\Option::get('all_online') == true ? "checked='checked'" : ''; ?>>
48
  <label for="allonline"><?php _e('Enable', 'wp-statistics'); ?></label>
49
- <p class="description"><?php _e('Enable this option to ignore the exclusion settings and record all online users (including self referrals and robots). Should only be used for troubleshooting.',
50
- 'wp-statistics'); ?></p>
51
  </td>
52
  </tr>
53
  </tbody>
@@ -119,7 +115,7 @@
119
  <label for="coefficient"><?php _e('Coefficient per Visitor:', 'wp-statistics'); ?></label>
120
  </th>
121
  <td>
122
- <input type="text" class="small-text code" id="coefficient" name="wps_coefficient" value="<?php echo htmlentities(WP_STATISTICS\Option::get('coefficient'), ENT_QUOTES); ?>"/>
123
  <p class="description"><?php echo sprintf(__('This feature multiplies the number of each visitor. Currently %s.', 'wp-statistics'), WP_STATISTICS\Option::get('coefficient')); ?></p>
124
  </td>
125
  </tr>
@@ -152,7 +148,7 @@
152
  <input id="all_pages" type="checkbox" value="1" name="wps_track_all_pages" <?php echo WP_STATISTICS\Option::get('track_all_pages') == true ? "checked='checked'" : ''; ?>>
153
  <label for="all_pages"><?php _e('Enable', 'wp-statistics'); ?></label>
154
  <p class="description"><?php _e('Enable or disable this feature', 'wp-statistics'); ?></p>
155
- <p class="description"><?php echo sprintf(__('Track all WordPress pages, contains Category, Post Tags, Author, Custom Taxonomy, etc.', 'wp-statistics'), admin_url('options-permalink.php')); ?></p>
156
  </td>
157
  </tr>
158
 
@@ -226,7 +222,7 @@
226
  } else {
227
  $hidden = " style='display: none;'";
228
  } ?>
229
- <tr valign="top"<?php echo $hidden; ?> id='wps_show_hits_option'>
230
  <td scope="row" style="vertical-align: top;">
231
  <label for="display_hits_position"><?php _e('Display position:', 'wp-statistics'); ?></label>
232
  </td>
@@ -335,12 +331,11 @@
335
 
336
  <tr valign="top">
337
  <th scope="row">
338
- <label for="<?php echo $option_name; ?>"><?php _e($se['name'], 'wp-statistics'); ?>:</label>
339
  </th>
340
  <td>
341
- <input id="<?php echo $option_name; ?>" type="checkbox" value="1" name="<?php echo $option_name; ?>" <?php echo WP_STATISTICS\Option::get($store_name) == true ? "checked='checked'" : ''; ?>><label for="<?php echo $option_name; ?>"><?php _e('Disable',
342
- 'wp-statistics'); ?></label>
343
- <p class="description"><?php echo sprintf(__('Disable %s from data collection and reporting.', 'wp-statistics'), $se['name']); ?></p>
344
  </td>
345
  </tr>
346
  <?php } ?>
29
  </th>
30
 
31
  <td>
32
+ <input type="text" class="small-text code" id="check_online" name="wps_check_online" value="<?php echo esc_attr(WP_STATISTICS\Option::get('check_online')); ?>"/>
 
33
  <?php _e('Seconds', 'wp-statistics'); ?>
34
+ <p class="description"><?php echo sprintf(__('Time for checking out accurate online users on the site. Now: %s Seconds', 'wp-statistics'), WP_STATISTICS\Option::get('check_online')); ?></p>
 
 
35
  </td>
36
  </tr>
37
 
43
  <td>
44
  <input id="allonline" type="checkbox" value="1" name="wps_all_online" <?php echo WP_STATISTICS\Option::get('all_online') == true ? "checked='checked'" : ''; ?>>
45
  <label for="allonline"><?php _e('Enable', 'wp-statistics'); ?></label>
46
+ <p class="description"><?php _e('Enable this option to ignore the exclusion settings and record all online users (including self referrals and robots). Should only be used for troubleshooting.', 'wp-statistics'); ?></p>
 
47
  </td>
48
  </tr>
49
  </tbody>
115
  <label for="coefficient"><?php _e('Coefficient per Visitor:', 'wp-statistics'); ?></label>
116
  </th>
117
  <td>
118
+ <input type="text" class="small-text code" id="coefficient" name="wps_coefficient" value="<?php echo esc_attr(WP_STATISTICS\Option::get('coefficient')); ?>"/>
119
  <p class="description"><?php echo sprintf(__('This feature multiplies the number of each visitor. Currently %s.', 'wp-statistics'), WP_STATISTICS\Option::get('coefficient')); ?></p>
120
  </td>
121
  </tr>
148
  <input id="all_pages" type="checkbox" value="1" name="wps_track_all_pages" <?php echo WP_STATISTICS\Option::get('track_all_pages') == true ? "checked='checked'" : ''; ?>>
149
  <label for="all_pages"><?php _e('Enable', 'wp-statistics'); ?></label>
150
  <p class="description"><?php _e('Enable or disable this feature', 'wp-statistics'); ?></p>
151
+ <p class="description"><?php echo sprintf(__('Track all WordPress pages, contains Category, Post Tags, Author, Custom Taxonomy, etc.', 'wp-statistics'), esc_url(admin_url('options-permalink.php'))); ?></p>
152
  </td>
153
  </tr>
154
 
222
  } else {
223
  $hidden = " style='display: none;'";
224
  } ?>
225
+ <tr valign="top"<?php echo esc_attr($hidden); ?> id='wps_show_hits_option'>
226
  <td scope="row" style="vertical-align: top;">
227
  <label for="display_hits_position"><?php _e('Display position:', 'wp-statistics'); ?></label>
228
  </td>
331
 
332
  <tr valign="top">
333
  <th scope="row">
334
+ <label for="<?php echo esc_attr($option_name); ?>"><?php echo esc_attr($se['name']); ?>:</label>
335
  </th>
336
  <td>
337
+ <input id="<?php echo esc_attr($option_name); ?>" type="checkbox" value="1" name="<?php echo esc_attr($option_name); ?>" <?php echo WP_STATISTICS\Option::get($store_name) == true ? "checked='checked'" : ''; ?>><label for="<?php echo esc_attr($option_name); ?>"><?php _e('Disable', 'wp-statistics'); ?></label>
338
+ <p class="description"><?php echo sprintf(__('Disable %s from data collection and reporting.', 'wp-statistics'), esc_attr($se['name'])); ?></p>
 
339
  </td>
340
  </tr>
341
  <?php } ?>
includes/admin/templates/settings/maintenance.php CHANGED
@@ -32,7 +32,7 @@
32
  </th>
33
 
34
  <td>
35
- <input type="text" class="small-text code" id="wps_schedule_dbmaint_days" name="wps_schedule_dbmaint_days" value="<?php echo htmlentities(WP_STATISTICS\Option::get('schedule_dbmaint_days', "365"), ENT_QUOTES); ?>"/>
36
  <?php _e('Days', 'wp-statistics'); ?>
37
  <p class="description"><?php echo __('The number of days to keep statistics for.', 'wp-statistics') . ' ' . __('The minimum value is 30 days.', 'wp-statistics') . ' ' . __('Invalid values will disable the daily maintenance.', 'wp-statistics'); ?></p>
38
  </td>
@@ -66,7 +66,7 @@
66
  </th>
67
 
68
  <td>
69
- <input type="text" class="small-text code" id="wps_schedule_dbmaint_visitor_hits" name="wps_schedule_dbmaint_visitor_hits" value="<?php echo htmlentities(WP_STATISTICS\Option::get('schedule_dbmaint_visitor_hits', '50'), ENT_QUOTES); ?>"/>
70
  <?php _e('Hits', 'wp-statistics'); ?>
71
  <p class="description"><?php echo __('The number of hits required to delete the visitor.', 'wp-statistics') . ' ' . __('Minimum value is 10 hits.', 'wp-statistics') . ' ' . __('Invalid values will disable the daily maintenance.', 'wp-statistics'); ?></p>
72
  </td>
32
  </th>
33
 
34
  <td>
35
+ <input type="text" class="small-text code" id="wps_schedule_dbmaint_days" name="wps_schedule_dbmaint_days" value="<?php echo esc_attr(WP_STATISTICS\Option::get('schedule_dbmaint_days', "365")); ?>"/>
36
  <?php _e('Days', 'wp-statistics'); ?>
37
  <p class="description"><?php echo __('The number of days to keep statistics for.', 'wp-statistics') . ' ' . __('The minimum value is 30 days.', 'wp-statistics') . ' ' . __('Invalid values will disable the daily maintenance.', 'wp-statistics'); ?></p>
38
  </td>
66
  </th>
67
 
68
  <td>
69
+ <input type="text" class="small-text code" id="wps_schedule_dbmaint_visitor_hits" name="wps_schedule_dbmaint_visitor_hits" value="<?php echo esc_attr(WP_STATISTICS\Option::get('schedule_dbmaint_visitor_hits', '50')); ?>"/>
70
  <?php _e('Hits', 'wp-statistics'); ?>
71
  <p class="description"><?php echo __('The number of hits required to delete the visitor.', 'wp-statistics') . ' ' . __('Minimum value is 10 hits.', 'wp-statistics') . ' ' . __('Invalid values will disable the daily maintenance.', 'wp-statistics'); ?></p>
72
  </td>
includes/admin/templates/settings/notifications.php CHANGED
@@ -19,7 +19,7 @@
19
  <input dir="ltr" type="text" id="email_list" name="wps_email_list" size="30" value="<?php if (WP_STATISTICS\Option::get('email_list') == '') {
20
  $wp_statistics_options['email_list'] = get_bloginfo('admin_email');
21
  }
22
- echo htmlentities(WP_STATISTICS\Option::get('email_list'), ENT_QUOTES); ?>"/>
23
  <p class="description"><?php _e('Add email addresses you want to receive reports and separate them with a comma.', 'wp-statistics'); ?></p>
24
  </td>
25
  </tr>
@@ -83,7 +83,7 @@
83
  } else {
84
  $hidden = " style='display: none;'";
85
  } ?>
86
- <tr valign="top"<?php echo $hidden; ?> id='wps_stats_report_option'>
87
  <td scope="row" style="vertical-align: top;">
88
  <label for="time-report"><?php _e('Schedule:', 'wp-statistics'); ?></label>
89
  </td>
@@ -107,7 +107,7 @@
107
 
108
  foreach ($schedules as $key => $value) {
109
  if (!in_array($value, $schedules_item)) {
110
- echo '<option value="' . $key . '" ' . selected(WP_STATISTICS\Option::get('time_report'), $key) . '>' . $value['display'] . '</option>';
111
  $schedules_item[] = $value;
112
  }
113
  }
@@ -118,7 +118,7 @@
118
  </td>
119
  </tr>
120
 
121
- <tr valign="top"<?php echo $hidden; ?> id='wps_stats_report_option'>
122
  <td scope="row" style="vertical-align: top;">
123
  <label for="send-report"><?php _e('Send reports via:', 'wp-statistics'); ?></label>
124
  </td>
@@ -139,13 +139,13 @@
139
  </td>
140
  </tr>
141
 
142
- <tr valign="top"<?php echo $hidden; ?> id='wps_stats_report_option'>
143
  <td scope="row" style="vertical-align: top;">
144
  <label for="content-report"><?php _e('Message body:', 'wp-statistics'); ?></label>
145
  </td>
146
 
147
  <td>
148
- <?php wp_editor(WP_STATISTICS\Option::get('content_report'), 'content-report', array('media_buttons' => false, 'textarea_name' => 'wps_content_report', 'textarea_rows' => 5,)); ?>
149
  <p class="description"><?php _e('Enter the contents of the report.', 'wp-statistics'); ?></p>
150
 
151
  <p class="description data">
19
  <input dir="ltr" type="text" id="email_list" name="wps_email_list" size="30" value="<?php if (WP_STATISTICS\Option::get('email_list') == '') {
20
  $wp_statistics_options['email_list'] = get_bloginfo('admin_email');
21
  }
22
+ echo esc_textarea(WP_STATISTICS\Option::get('email_list')); ?>"/>
23
  <p class="description"><?php _e('Add email addresses you want to receive reports and separate them with a comma.', 'wp-statistics'); ?></p>
24
  </td>
25
  </tr>
83
  } else {
84
  $hidden = " style='display: none;'";
85
  } ?>
86
+ <tr valign="top"<?php echo esc_attr($hidden); ?> id='wps_stats_report_option'>
87
  <td scope="row" style="vertical-align: top;">
88
  <label for="time-report"><?php _e('Schedule:', 'wp-statistics'); ?></label>
89
  </td>
107
 
108
  foreach ($schedules as $key => $value) {
109
  if (!in_array($value, $schedules_item)) {
110
+ echo '<option value="' . esc_attr($key) . '" ' . selected(WP_STATISTICS\Option::get('time_report'), $key) . '>' . esc_attr($value['display']) . '</option>';
111
  $schedules_item[] = $value;
112
  }
113
  }
118
  </td>
119
  </tr>
120
 
121
+ <tr valign="top"<?php echo esc_attr($hidden); ?> id='wps_stats_report_option'>
122
  <td scope="row" style="vertical-align: top;">
123
  <label for="send-report"><?php _e('Send reports via:', 'wp-statistics'); ?></label>
124
  </td>
139
  </td>
140
  </tr>
141
 
142
+ <tr valign="top"<?php echo esc_attr($hidden); ?> id='wps_stats_report_option'>
143
  <td scope="row" style="vertical-align: top;">
144
  <label for="content-report"><?php _e('Message body:', 'wp-statistics'); ?></label>
145
  </td>
146
 
147
  <td>
148
+ <?php wp_editor(WP_STATISTICS\Option::get('content_report'), 'content-report', array('media_buttons' => false, 'textarea_name' => 'wps_content_report', 'textarea_rows' => 5)); ?>
149
  <p class="description"><?php _e('Enter the contents of the report.', 'wp-statistics'); ?></p>
150
 
151
  <p class="description data">
includes/admin/templates/settings/privacy.php CHANGED
@@ -6,7 +6,7 @@
6
  </tr>
7
 
8
  <tr valign="top">
9
- <td scope="row" colspan="2"><?php echo sprintf(__('If you want to delete visitor data, please <a href="%s">click here</a>.', 'wp-statistics'), WP_STATISTICS\Menus::admin_url('optimization', array('tab' => 'purging'))); ?></td>
10
  </tr>
11
 
12
  <tr valign="top">
@@ -14,7 +14,7 @@
14
  <label for="anonymize_ips"><?php _e('Anonymize IP Addresses:', 'wp-statistics'); ?></label>
15
  </th>
16
  <td>
17
- <input id="anonymize_ips" type="checkbox" value="1" name="wps_anonymize_ips" <?php echo WP_STATISTICS\Option::get('anonymize_ips') == true ? "checked='checked'" : ''; ?>>
18
  <label for="anonymize_ips"><?php _e('Enable', 'wp-statistics'); ?></label>
19
  <p class="description"><?php echo __('This option anonymizes the user IP address for GDPR compliance. For example, 888.888.888.888 > 888.888.888.000.', 'wp-statistics'); ?></p>
20
  </td>
@@ -25,7 +25,7 @@
25
  <label for="hash_ips"><?php _e('Hash IP Addresses:', 'wp-statistics'); ?></label>
26
  </th>
27
  <td>
28
- <input id="hash_ips" type="checkbox" value="1" name="wps_hash_ips" <?php echo WP_STATISTICS\Option::get('hash_ips') == true ? "checked='checked'" : ''; ?>>
29
  <label for="hash_ips"><?php _e('Enable', 'wp-statistics'); ?></label>
30
  <p class="description"><?php echo __('By enabling this option, you cannot recover the IP addresses in the future to find out location information, and IP addresses will not be stored in the database but instead used a unique hash.', 'wp-statistics') . ' ' . __('Also, it disables the "Store entire user agent string" setting.', 'wp-statistics'); ?></p>
31
  </td>
@@ -37,7 +37,7 @@
37
  </th>
38
 
39
  <td>
40
- <input id="store_ua" type="checkbox" value="1" name="wps_store_ua" <?php echo WP_STATISTICS\Option::get('store_ua') == true ? "checked='checked'" : ''; ?>>
41
  <label for="store_ua"><?php _e('Enable', 'wp-statistics'); ?></label>
42
  <p class="description"><?php _e('Only enable it for debugging. If the IP hashes are enabled, this option will be disabled automatically.', 'wp-statistics'); ?></p>
43
  </td>
6
  </tr>
7
 
8
  <tr valign="top">
9
+ <td scope="row" colspan="2"><?php echo sprintf(__('If you want to delete visitor data, please <a href="%s">click here</a>.', 'wp-statistics'), esc_url(WP_STATISTICS\Menus::admin_url('optimization', array('tab' => 'purging')))); ?></td>
10
  </tr>
11
 
12
  <tr valign="top">
14
  <label for="anonymize_ips"><?php _e('Anonymize IP Addresses:', 'wp-statistics'); ?></label>
15
  </th>
16
  <td>
17
+ <input id="anonymize_ips" type="checkbox" value="1" name="wps_anonymize_ips" <?php echo WP_STATISTICS\Option::get('anonymize_ips') == true ? "checked='checked'" : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
18
  <label for="anonymize_ips"><?php _e('Enable', 'wp-statistics'); ?></label>
19
  <p class="description"><?php echo __('This option anonymizes the user IP address for GDPR compliance. For example, 888.888.888.888 > 888.888.888.000.', 'wp-statistics'); ?></p>
20
  </td>
25
  <label for="hash_ips"><?php _e('Hash IP Addresses:', 'wp-statistics'); ?></label>
26
  </th>
27
  <td>
28
+ <input id="hash_ips" type="checkbox" value="1" name="wps_hash_ips" <?php echo WP_STATISTICS\Option::get('hash_ips') == true ? "checked='checked'" : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
29
  <label for="hash_ips"><?php _e('Enable', 'wp-statistics'); ?></label>
30
  <p class="description"><?php echo __('By enabling this option, you cannot recover the IP addresses in the future to find out location information, and IP addresses will not be stored in the database but instead used a unique hash.', 'wp-statistics') . ' ' . __('Also, it disables the "Store entire user agent string" setting.', 'wp-statistics'); ?></p>
31
  </td>
37
  </th>
38
 
39
  <td>
40
+ <input id="store_ua" type="checkbox" value="1" name="wps_store_ua" <?php echo WP_STATISTICS\Option::get('store_ua') == true ? "checked='checked'" : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
41
  <label for="store_ua"><?php _e('Enable', 'wp-statistics'); ?></label>
42
  <p class="description"><?php _e('Only enable it for debugging. If the IP hashes are enabled, this option will be disabled automatically.', 'wp-statistics'); ?></p>
43
  </td>
includes/admin/templates/settings/visitor-ip.php CHANGED
@@ -27,8 +27,9 @@ add_thickbox();
27
  ?>
28
  <tr>
29
  <td width="330" style="padding-top:10px;padding-bottom:10px;">
30
- <b><?php echo $key; ?></b></td>
31
- <td style="padding-top:10px;padding-bottom:10px;"> <?php echo ($value == "" ? "-" : substr(str_replace(array("\n", "\r"), '', trim($value)), 0, 200)) . (strlen($value) > 200 ? '..' : ''); ?></td>
 
32
  </tr>
33
  <?php
34
  }
@@ -80,14 +81,14 @@ add_thickbox();
80
  <table>
81
  <tr>
82
  <td style="width: 10px; padding: 0px;">
83
- <input type="radio" name="ip_method" style="vertical-align: -3px;" value="<?php echo $method; ?>"<?php if ($ip_method == $method) {
84
  echo " checked=\"checked\"";
85
  } ?>>
86
  </td>
87
- <td style="width: 250px;"> <?php printf(__('Use %1$s', 'wp-statistics'), $method); ?></td>
88
  <td><code><?php
89
  if (isset($_SERVER[$method]) and !empty($_SERVER[$method])) {
90
- echo sanitize_text_field(wp_unslash($_SERVER[$method]));
91
  } else {
92
  _e('No available data.', 'wp-statistics');
93
  } ?>
27
  ?>
28
  <tr>
29
  <td width="330" style="padding-top:10px;padding-bottom:10px;">
30
+ <b><?php echo esc_attr($key); ?></b>
31
+ </td>
32
+ <td style="padding-top:10px;padding-bottom:10px;"><?php echo esc_attr(($value == "" ? "-" : substr(str_replace(array("\n", "\r"), '', trim($value)), 0, 200)) . (strlen($value) > 200 ? '..' : '')); ?></td>
33
  </tr>
34
  <?php
35
  }
81
  <table>
82
  <tr>
83
  <td style="width: 10px; padding: 0px;">
84
+ <input type="radio" name="ip_method" style="vertical-align: -3px;" value="<?php echo esc_attr($method); ?>"<?php if ($ip_method == $method) {
85
  echo " checked=\"checked\"";
86
  } ?>>
87
  </td>
88
+ <td style="width: 250px;"> <?php printf(__('Use %1$s', 'wp-statistics'), esc_attr($method)); ?></td>
89
  <td><code><?php
90
  if (isset($_SERVER[$method]) and !empty($_SERVER[$method])) {
91
+ echo esc_attr(wp_unslash($_SERVER[$method]));
92
  } else {
93
  _e('No available data.', 'wp-statistics');
94
  } ?>
includes/class-wp-statistics-geoip.php CHANGED
@@ -13,13 +13,13 @@ class GeoIP
13
  */
14
  public static $library = array(
15
  'country' => array(
16
- 'source' => 'https://raw.githubusercontent.com/wp-statistics/GeoLite2-Country/master/GeoLite2-Country.mmdb.gz',
17
  'file' => 'GeoLite2-Country',
18
  'opt' => 'geoip',
19
  'cache' => 31536000 //1 Year
20
  ),
21
  'city' => array(
22
- 'source' => 'https://raw.githubusercontent.com/wp-statistics/GeoLite2-City/master/GeoLite2-City.mmdb.gz',
23
  'file' => 'GeoLite2-City',
24
  'opt' => 'geoip_city',
25
  'cache' => 6998000 //3 Month
13
  */
14
  public static $library = array(
15
  'country' => array(
16
+ 'source' => 'https://cdn.jsdelivr.net/npm/geolite2-country@1.0.2/GeoLite2-Country.mmdb.gz',
17
  'file' => 'GeoLite2-Country',
18
  'opt' => 'geoip',
19
  'cache' => 31536000 //1 Year
20
  ),
21
  'city' => array(
22
+ 'source' => 'https://cdn.jsdelivr.net/npm/geolite2-city@1.0.0/GeoLite2-City.mmdb.gz',
23
  'file' => 'GeoLite2-City',
24
  'opt' => 'geoip_city',
25
  'cache' => 6998000 //3 Month
includes/class-wp-statistics-helper.php CHANGED
@@ -130,7 +130,7 @@ class Helper
130
  ';
131
 
132
  if ($echo) {
133
- echo $text;
134
  } else {
135
  return $text;
136
  }
130
  ';
131
 
132
  if ($echo) {
133
+ echo wp_kses_post($text);
134
  } else {
135
  return $text;
136
  }
includes/class-wp-statistics-pages.php CHANGED
@@ -413,7 +413,7 @@ class Pages
413
  $list[] = array(
414
  'title' => $page_info['title'],
415
  'link' => $page_info['link'],
416
- 'str_url' => htmlentities(urldecode($item->uri), ENT_QUOTES),
417
  'hits_page' => Menus::admin_url('pages', array('ID' => $item->id, 'type' => $item->type)),
418
  'number' => number_format_i18n($item->count_sum)
419
  );
413
  $list[] = array(
414
  'title' => $page_info['title'],
415
  'link' => $page_info['link'],
416
+ 'str_url' => urldecode($item->uri),
417
  'hits_page' => Menus::admin_url('pages', array('ID' => $item->id, 'type' => $item->type)),
418
  'number' => number_format_i18n($item->count_sum)
419
  );
includes/class-wp-statistics-referred.php CHANGED
@@ -23,7 +23,7 @@ class Referred
23
  *
24
  * @var string
25
  */
26
- public static $referrer_spam_link = 'https://raw.githubusercontent.com/matomo-org/referrer-spam-blacklist/master/spammers.txt';
27
 
28
  /**
29
  * Referred constructor.
@@ -107,6 +107,8 @@ class Referred
107
  $html_referrer = '//' . $html_referrer;
108
  }
109
 
 
 
110
  // Parse Url
111
  $base_url = @parse_url($html_referrer);
112
 
@@ -140,7 +142,7 @@ class Referred
140
  $referrer = substr($referrer, 0, $length);
141
  }
142
 
143
- return htmlentities($referrer, ENT_QUOTES);
144
  }
145
 
146
  /**
23
  *
24
  * @var string
25
  */
26
+ public static $referrer_spam_link = 'https://cdn.jsdelivr.net/gh/matomo-org/referrer-spam-list@4.0.0/spammers.txt';
27
 
28
  /**
29
  * Referred constructor.
107
  $html_referrer = '//' . $html_referrer;
108
  }
109
 
110
+ $html_referrer = esc_url($html_referrer);
111
+
112
  // Parse Url
113
  $base_url = @parse_url($html_referrer);
114
 
142
  $referrer = substr($referrer, 0, $length);
143
  }
144
 
145
+ return $referrer;
146
  }
147
 
148
  /**
includes/class-wp-statistics-user-agent.php CHANGED
@@ -11,7 +11,7 @@ class UserAgent
11
  */
12
  public static function getHttpUserAgent()
13
  {
14
- return apply_filters('wp_statistics_user_http_agent', (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''));
15
  }
16
 
17
  /**
11
  */
12
  public static function getHttpUserAgent()
13
  {
14
+ return apply_filters('wp_statistics_user_http_agent', (isset($_SERVER['HTTP_USER_AGENT']) ? wp_unslash($_SERVER['HTTP_USER_AGENT']) : ''));
15
  }
16
 
17
  /**
includes/class-wp-statistics-widget.php CHANGED
@@ -32,159 +32,159 @@ class WP_Statistics_Widget extends \WP_Widget
32
  return;
33
  }
34
 
35
- echo $before_widget;
36
- echo $before_title . $widget_options['name_widget'] . $after_title;
37
  echo '<ul>';
38
 
39
  if ($widget_options['useronline_widget']) {
40
  echo '<li>';
41
  echo '<label>' . __('Online Users', 'wp-statistics') . ': </label>';
42
- echo number_format_i18n(wp_statistics_useronline());
43
  echo '</li>';
44
  }
45
 
46
  if ($widget_options['tvisit_widget']) {
47
  echo '<li>';
48
  echo '<label>' . __('Today\'s Visits', 'wp-statistics') . ': </label>';
49
- echo number_format_i18n(wp_statistics_visit('today'));
50
  echo '</li>';
51
  }
52
 
53
  if ($widget_options['tvisitor_widget']) {
54
  echo '<li>';
55
  echo '<label>' . __('Today\'s Visitors', 'wp-statistics') . ': </label>';
56
- echo number_format_i18n(wp_statistics_visitor('today', null, true));
57
  echo '</li>';
58
  }
59
 
60
  if ($widget_options['yvisit_widget']) {
61
  echo '<li>';
62
  echo '<label>' . __('Yesterday\'s Visits', 'wp-statistics') . ': </label>';
63
- echo number_format_i18n(wp_statistics_visit('yesterday'));
64
  echo '</li>';
65
  }
66
 
67
  if ($widget_options['yvisitor_widget']) {
68
  echo '<li>';
69
  echo '<label>' . __('Yesterday\'s Visitors', 'wp-statistics') . ': </label>';
70
- echo number_format_i18n(wp_statistics_visitor('yesterday', null, true));
71
  echo '</li>';
72
  }
73
 
74
  if ($widget_options['wvisit_widget']) {
75
  echo '<li>';
76
  echo '<label>' . __('Last 7 Days Visits', 'wp-statistics') . ': </label>';
77
- echo number_format_i18n(wp_statistics_visit('week'));
78
  echo '</li>';
79
  }
80
 
81
  if ($widget_options['mvisit_widget']) {
82
  echo '<li>';
83
  echo '<label>' . __('Last 30 Days Visits', 'wp-statistics') . ': </label>';
84
- echo number_format_i18n(wp_statistics_visit('month'));
85
  echo '</li>';
86
  }
87
 
88
  if ($widget_options['ysvisit_widget']) {
89
  echo '<li>';
90
  echo '<label>' . __('Last 365 Days Visits', 'wp-statistics') . ': </label>';
91
- echo number_format_i18n(wp_statistics_visit('year'));
92
  echo '</li>';
93
  }
94
 
95
  if ($widget_options['ttvisit_widget']) {
96
  echo '<li>';
97
  echo '<label>' . __('Total Visits', 'wp-statistics') . ': </label>';
98
- echo number_format_i18n(wp_statistics_visit('total'));
99
  echo '</li>';
100
  }
101
 
102
  if ($widget_options['ttvisitor_widget']) {
103
  echo '<li>';
104
  echo '<label>' . __('Total Visitors', 'wp-statistics') . ': </label>';
105
- echo number_format_i18n(wp_statistics_visitor('total', null, true));
106
  echo '</li>';
107
  }
108
 
109
  if ($widget_options['tpviews_widget']) {
110
  echo '<li>';
111
  echo '<label>' . __('Total Page Views', 'wp-statistics') . ': </label>';
112
- echo number_format_i18n(wp_statistics_pages('total'));
113
  echo '</li>';
114
  }
115
 
116
  if ($widget_options['ser_widget']) {
117
  echo '<li>';
118
  echo '<label>' . __('Search Engine Referrals', 'wp-statistics') . ': </label>';
119
- echo number_format_i18n(wp_statistics_searchengine($widget_options['select_se']));
120
  echo '</li>';
121
  }
122
 
123
  if ($widget_options['tp_widget']) {
124
  echo '<li>';
125
  echo '<label>' . __('Total Posts', 'wp-statistics') . ': </label>';
126
- echo number_format_i18n(WP_STATISTICS\Helper::getCountPosts());
127
  echo '</li>';
128
  }
129
 
130
  if ($widget_options['tpg_widget']) {
131
  echo '<li>';
132
  echo '<label>' . __('Total Pages', 'wp-statistics') . ': </label>';
133
- echo number_format_i18n(\WP_STATISTICS\Helper::getCountPages());
134
  echo '</li>';
135
  }
136
 
137
  if ($widget_options['tc_widget']) {
138
  echo '<li>';
139
  echo '<label>' . __('Total Comments', 'wp-statistics') . ': </label>';
140
- echo number_format_i18n(\WP_STATISTICS\Helper::getCountComment());
141
  echo '</li>';
142
  }
143
 
144
  if ($widget_options['ts_widget']) {
145
  echo '<li>';
146
  echo '<label>' . __('Total Spams', 'wp-statistics') . ': </label>';
147
- echo \WP_STATISTICS\Helper::getCountSpam();
148
  echo '</li>';
149
  }
150
 
151
  if ($widget_options['tu_widget']) {
152
  echo '<li>';
153
  echo '<label>' . __('Total Users', 'wp-statistics') . ': </label>';
154
- echo number_format_i18n(\WP_STATISTICS\Helper::getCountUsers());
155
  echo '</li>';
156
  }
157
 
158
  if ($widget_options['ap_widget']) {
159
  echo '<li>';
160
  echo '<label>' . __('Post Average', 'wp-statistics') . ': </label>';
161
- echo number_format_i18n(\WP_STATISTICS\Helper::getAveragePost());
162
  echo '</li>';
163
  }
164
 
165
  if ($widget_options['ac_widget']) {
166
  echo '<li>';
167
  echo '<label>' . __('Comment Average', 'wp-statistics') . ': </label>';
168
- echo number_format_i18n(\WP_STATISTICS\Helper::getAverageComment());
169
  echo '</li>';
170
  }
171
 
172
  if ($widget_options['au_widget']) {
173
  echo '<li>';
174
  echo '<label>' . __('User Average', 'wp-statistics') . ': </label>';
175
- echo number_format_i18n(\WP_STATISTICS\Helper::getAverageRegisterUser());
176
  echo '</li>';
177
  }
178
 
179
  if ($widget_options['lpd_widget']) {
180
  echo '<li>';
181
  echo '<label>' . __('Last Post Date', 'wp-statistics') . ': </label>';
182
- echo \WP_STATISTICS\Helper::getLastPostDate();
183
  echo '</li>';
184
  }
185
 
186
  echo '</ul>';
187
- echo $after_widget;
188
  }
189
 
190
  /**
32
  return;
33
  }
34
 
35
+ echo $before_widget; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
36
+ echo $before_title . esc_attr($widget_options['name_widget']) . $after_title; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
37
  echo '<ul>';
38
 
39
  if ($widget_options['useronline_widget']) {
40
  echo '<li>';
41
  echo '<label>' . __('Online Users', 'wp-statistics') . ': </label>';
42
+ echo number_format_i18n(wp_statistics_useronline()); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
43
  echo '</li>';
44
  }
45
 
46
  if ($widget_options['tvisit_widget']) {
47
  echo '<li>';
48
  echo '<label>' . __('Today\'s Visits', 'wp-statistics') . ': </label>';
49
+ echo number_format_i18n(wp_statistics_visit('today')); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
50
  echo '</li>';
51
  }
52
 
53
  if ($widget_options['tvisitor_widget']) {
54
  echo '<li>';
55
  echo '<label>' . __('Today\'s Visitors', 'wp-statistics') . ': </label>';
56
+ echo number_format_i18n(wp_statistics_visitor('today', null, true)); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
57
  echo '</li>';
58
  }
59
 
60
  if ($widget_options['yvisit_widget']) {
61
  echo '<li>';
62
  echo '<label>' . __('Yesterday\'s Visits', 'wp-statistics') . ': </label>';
63
+ echo number_format_i18n(wp_statistics_visit('yesterday')); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
64
  echo '</li>';
65
  }
66
 
67
  if ($widget_options['yvisitor_widget']) {
68
  echo '<li>';
69
  echo '<label>' . __('Yesterday\'s Visitors', 'wp-statistics') . ': </label>';
70
+ echo number_format_i18n(wp_statistics_visitor('yesterday', null, true)); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
71
  echo '</li>';
72
  }
73
 
74
  if ($widget_options['wvisit_widget']) {
75
  echo '<li>';
76
  echo '<label>' . __('Last 7 Days Visits', 'wp-statistics') . ': </label>';
77
+ echo number_format_i18n(wp_statistics_visit('week')); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
78
  echo '</li>';
79
  }
80
 
81
  if ($widget_options['mvisit_widget']) {
82
  echo '<li>';
83
  echo '<label>' . __('Last 30 Days Visits', 'wp-statistics') . ': </label>';
84
+ echo number_format_i18n(wp_statistics_visit('month')); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
85
  echo '</li>';
86
  }
87
 
88
  if ($widget_options['ysvisit_widget']) {
89
  echo '<li>';
90
  echo '<label>' . __('Last 365 Days Visits', 'wp-statistics') . ': </label>';
91
+ echo number_format_i18n(wp_statistics_visit('year')); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
92
  echo '</li>';
93
  }
94
 
95
  if ($widget_options['ttvisit_widget']) {
96
  echo '<li>';
97
  echo '<label>' . __('Total Visits', 'wp-statistics') . ': </label>';
98
+ echo number_format_i18n(wp_statistics_visit('total')); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
99
  echo '</li>';
100
  }
101
 
102
  if ($widget_options['ttvisitor_widget']) {
103
  echo '<li>';
104
  echo '<label>' . __('Total Visitors', 'wp-statistics') . ': </label>';
105
+ echo number_format_i18n(wp_statistics_visitor('total', null, true)); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
106
  echo '</li>';
107
  }
108
 
109
  if ($widget_options['tpviews_widget']) {
110
  echo '<li>';
111
  echo '<label>' . __('Total Page Views', 'wp-statistics') . ': </label>';
112
+ echo number_format_i18n(wp_statistics_pages('total')); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
113
  echo '</li>';
114
  }
115
 
116
  if ($widget_options['ser_widget']) {
117
  echo '<li>';
118
  echo '<label>' . __('Search Engine Referrals', 'wp-statistics') . ': </label>';
119
+ echo number_format_i18n(wp_statistics_searchengine($widget_options['select_se'])); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
120
  echo '</li>';
121
  }
122
 
123
  if ($widget_options['tp_widget']) {
124
  echo '<li>';
125
  echo '<label>' . __('Total Posts', 'wp-statistics') . ': </label>';
126
+ echo number_format_i18n(WP_STATISTICS\Helper::getCountPosts()); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
127
  echo '</li>';
128
  }
129
 
130
  if ($widget_options['tpg_widget']) {
131
  echo '<li>';
132
  echo '<label>' . __('Total Pages', 'wp-statistics') . ': </label>';
133
+ echo number_format_i18n(\WP_STATISTICS\Helper::getCountPages()); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
134
  echo '</li>';
135
  }
136
 
137
  if ($widget_options['tc_widget']) {
138
  echo '<li>';
139
  echo '<label>' . __('Total Comments', 'wp-statistics') . ': </label>';
140
+ echo number_format_i18n(\WP_STATISTICS\Helper::getCountComment()); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
141
  echo '</li>';
142
  }
143
 
144
  if ($widget_options['ts_widget']) {
145
  echo '<li>';
146
  echo '<label>' . __('Total Spams', 'wp-statistics') . ': </label>';
147
+ echo \WP_STATISTICS\Helper::getCountSpam(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
148
  echo '</li>';
149
  }
150
 
151
  if ($widget_options['tu_widget']) {
152
  echo '<li>';
153
  echo '<label>' . __('Total Users', 'wp-statistics') . ': </label>';
154
+ echo number_format_i18n(\WP_STATISTICS\Helper::getCountUsers()); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
155
  echo '</li>';
156
  }
157
 
158
  if ($widget_options['ap_widget']) {
159
  echo '<li>';
160
  echo '<label>' . __('Post Average', 'wp-statistics') . ': </label>';
161
+ echo number_format_i18n(\WP_STATISTICS\Helper::getAveragePost()); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
162
  echo '</li>';
163
  }
164
 
165
  if ($widget_options['ac_widget']) {
166
  echo '<li>';
167
  echo '<label>' . __('Comment Average', 'wp-statistics') . ': </label>';
168
+ echo number_format_i18n(\WP_STATISTICS\Helper::getAverageComment()); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
169
  echo '</li>';
170
  }
171
 
172
  if ($widget_options['au_widget']) {
173
  echo '<li>';
174
  echo '<label>' . __('User Average', 'wp-statistics') . ': </label>';
175
+ echo number_format_i18n(\WP_STATISTICS\Helper::getAverageRegisterUser()); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
176
  echo '</li>';
177
  }
178
 
179
  if ($widget_options['lpd_widget']) {
180
  echo '<li>';
181
  echo '<label>' . __('Last Post Date', 'wp-statistics') . ': </label>';
182
+ echo \WP_STATISTICS\Helper::getLastPostDate(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
183
  echo '</li>';
184
  }
185
 
186
  echo '</ul>';
187
+ echo $after_widget; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
188
  }
189
 
190
  /**
includes/libraries/ExportData.php CHANGED
@@ -65,7 +65,7 @@ abstract class ExportData {
65
  protected function write( $data ) {
66
  switch ( $this->exportTo ) {
67
  case 'browser':
68
- echo $data;
69
  break;
70
  case 'string':
71
  $this->stringData .= $data;
65
  protected function write( $data ) {
66
  switch ( $this->exportTo ) {
67
  case 'browser':
68
+ echo $data; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
69
  break;
70
  case 'string':
71
  $this->stringData .= $data;
includes/template-functions.php CHANGED
@@ -535,7 +535,7 @@ function wp_statistics_get_top_pages($rangestartdate = null, $rangeenddate = nul
535
 
536
  // Check age Title if page id or type not exist
537
  if ($page_info['link'] == "") {
538
- $page_url = htmlentities(path_join(get_site_url(), $url), ENT_QUOTES);
539
  $id = WP_STATISTICS\Pages::uri_to_id($out[0]);
540
  $post = get_post($id);
541
  if (is_object($post)) {
535
 
536
  // Check age Title if page id or type not exist
537
  if ($page_info['link'] == "") {
538
+ $page_url = path_join(get_site_url(), $url);
539
  $id = WP_STATISTICS\Pages::uri_to_id($out[0]);
540
  $post = get_post($id);
541
  if (is_object($post)) {
includes/vendor/composer/ca-bundle/README.md DELETED
@@ -1,85 +0,0 @@
1
- composer/ca-bundle
2
- ==================
3
-
4
- Small utility library that lets you find a path to the system CA bundle,
5
- and includes a fallback to the Mozilla CA bundle.
6
-
7
- Originally written as part of [composer/composer](https://github.com/composer/composer),
8
- now extracted and made available as a stand-alone library.
9
-
10
-
11
- Installation
12
- ------------
13
-
14
- Install the latest version with:
15
-
16
- ```bash
17
- $ composer require composer/ca-bundle
18
- ```
19
-
20
-
21
- Requirements
22
- ------------
23
-
24
- * PHP 5.3.2 is required but using the latest version of PHP is highly recommended.
25
-
26
-
27
- Basic usage
28
- -----------
29
-
30
- ### `Composer\CaBundle\CaBundle`
31
-
32
- - `CaBundle::getSystemCaRootBundlePath()`: Returns the system CA bundle path, or a path to the bundled one as fallback
33
- - `CaBundle::getBundledCaBundlePath()`: Returns the path to the bundled CA file
34
- - `CaBundle::validateCaFile($filename)`: Validates a CA file using openssl_x509_parse only if it is safe to use
35
- - `CaBundle::isOpensslParseSafe()`: Test if it is safe to use the PHP function openssl_x509_parse()
36
- - `CaBundle::reset()`: Resets the static caches
37
-
38
-
39
- #### To use with curl
40
-
41
- ```php
42
- $curl = curl_init("https://example.org/");
43
-
44
- $caPathOrFile = \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath();
45
- if (is_dir($caPathOrFile)) {
46
- curl_setopt($curl, CURLOPT_CAPATH, $caPathOrFile);
47
- } else {
48
- curl_setopt($curl, CURLOPT_CAINFO, $caPathOrFile);
49
- }
50
-
51
- $result = curl_exec($curl);
52
- ```
53
-
54
- #### To use with php streams
55
-
56
- ```php
57
- $opts = array(
58
- 'http' => array(
59
- 'method' => "GET"
60
- )
61
- );
62
-
63
- $caPathOrFile = \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath();
64
- if (is_dir($caPathOrFile)) {
65
- $opts['ssl']['capath'] = $caPathOrFile;
66
- } else {
67
- $opts['ssl']['cafile'] = $caPathOrFile;
68
- }
69
-
70
- $context = stream_context_create($opts);
71
- $result = file_get_contents('https://example.com', false, $context);
72
- ```
73
-
74
- #### To use with Guzzle
75
-
76
- ```php
77
- $client = new \GuzzleHttp\Client([
78
- \GuzzleHttp\RequestOptions::VERIFY => \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath()
79
- ]);
80
- ```
81
-
82
- License
83
- -------
84
-
85
- composer/ca-bundle is licensed under the MIT License, see the LICENSE file for details.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/composer/ca-bundle/composer.json DELETED
@@ -1,54 +0,0 @@
1
- {
2
- "name": "composer/ca-bundle",
3
- "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.",
4
- "type": "library",
5
- "license": "MIT",
6
- "keywords": [
7
- "cabundle",
8
- "cacert",
9
- "certificate",
10
- "ssl",
11
- "tls"
12
- ],
13
- "authors": [
14
- {
15
- "name": "Jordi Boggiano",
16
- "email": "j.boggiano@seld.be",
17
- "homepage": "http://seld.be"
18
- }
19
- ],
20
- "support": {
21
- "irc": "irc://irc.freenode.org/composer",
22
- "issues": "https://github.com/composer/ca-bundle/issues"
23
- },
24
- "require": {
25
- "ext-openssl": "*",
26
- "ext-pcre": "*",
27
- "php": "^5.3.2 || ^7.0 || ^8.0"
28
- },
29
- "require-dev": {
30
- "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8",
31
- "psr/log": "^1.0",
32
- "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0"
33
- },
34
- "autoload": {
35
- "psr-4": {
36
- "Composer\\CaBundle\\": "src"
37
- }
38
- },
39
- "autoload-dev": {
40
- "psr-4": {
41
- "Composer\\CaBundle\\": "tests"
42
- }
43
- },
44
- "extra": {
45
- "branch-alias": {
46
- "dev-master": "1.x-dev"
47
- }
48
- },
49
- "config": {
50
- "platform": {
51
- "php": "5.3.9"
52
- }
53
- }
54
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/geoip2/geoip2/README.md DELETED
@@ -1,409 +0,0 @@
1
- # GeoIP2 PHP API #
2
-
3
- ## Description ##
4
-
5
- This package provides an API for the GeoIP2
6
- [web services](https://dev.maxmind.com/geoip/geoip2/web-services) and
7
- [databases](https://dev.maxmind.com/geoip/geoip2/downloadable). The API also
8
- works with the free
9
- [GeoLite2 databases](https://dev.maxmind.com/geoip/geoip2/geolite2/).
10
-
11
- ## Install via Composer ##
12
-
13
- We recommend installing this package with [Composer](https://getcomposer.org/).
14
-
15
- ### Download Composer ###
16
-
17
- To download Composer, run in the root directory of your project:
18
-
19
- ```bash
20
- curl -sS https://getcomposer.org/installer | php
21
- ```
22
-
23
- You should now have the file `composer.phar` in your project directory.
24
-
25
- ### Install Dependencies ###
26
-
27
- Run in your project root:
28
-
29
- ```
30
- php composer.phar require geoip2/geoip2:~2.0
31
- ```
32
-
33
- You should now have the files `composer.json` and `composer.lock` as well as
34
- the directory `vendor` in your project directory. If you use a version control
35
- system, `composer.json` should be added to it.
36
-
37
- ### Require Autoloader ###
38
-
39
- After installing the dependencies, you need to require the Composer autoloader
40
- from your code:
41
-
42
- ```php
43
- require 'vendor/autoload.php';
44
- ```
45
-
46
- ## Install via Phar ##
47
-
48
- Although we strongly recommend using Composer, we also provide a
49
- [phar archive](https://php.net/manual/en/book.phar.php) containing most of the
50
- dependencies for GeoIP2. Our latest phar archive is available on
51
- [our releases page](https://github.com/maxmind/GeoIP2-php/releases).
52
-
53
- ### Install Dependencies ###
54
-
55
- In order to use the phar archive, you must have the PHP
56
- [Phar extension](https://php.net/manual/en/book.phar.php) installed and
57
- enabled.
58
-
59
- If you will be making web service requests, you must have the PHP
60
- [cURL extension](https://php.net/manual/en/book.curl.php)
61
- installed to use this archive. For Debian based distributions, this can
62
- typically be found in the the `php-curl` package. For other operating
63
- systems, please consult the relevant documentation. After installing the
64
- extension you may need to restart your web server.
65
-
66
- If you are missing this extension, you will see errors like the following:
67
-
68
- ```
69
- PHP Fatal error: Uncaught Error: Call to undefined function MaxMind\WebService\curl_version()
70
- ```
71
-
72
- ### Require Package ###
73
-
74
- To use the archive, just require it from your script:
75
-
76
- ```php
77
- require 'geoip2.phar';
78
- ```
79
-
80
- ## Optional C Extension ##
81
-
82
- The [MaxMind DB API](https://github.com/maxmind/MaxMind-DB-Reader-php)
83
- includes an optional C extension that you may install to dramatically increase
84
- the performance of lookups in GeoIP2 or GeoLite2 databases. To install, please
85
- follow the instructions included with that API.
86
-
87
- The extension has no effect on web-service lookups.
88
-
89
- ## IP Geolocation Usage ##
90
-
91
- IP geolocation is inherently imprecise. Locations are often near the center of
92
- the population. Any location provided by a GeoIP2 database or web service
93
- should not be used to identify a particular address or household.
94
-
95
- ## Database Reader ##
96
-
97
- ### Usage ###
98
-
99
- To use this API, you must create a new `\GeoIp2\Database\Reader` object with
100
- the path to the database file as the first argument to the constructor. You
101
- may then call the method corresponding to the database you are using.
102
-
103
- If the lookup succeeds, the method call will return a model class for the
104
- record in the database. This model in turn contains multiple container
105
- classes for the different parts of the data such as the city in which the
106
- IP address is located.
107
-
108
- If the record is not found, a `\GeoIp2\Exception\AddressNotFoundException`
109
- is thrown. If the database is invalid or corrupt, a
110
- `\MaxMind\Db\InvalidDatabaseException` will be thrown.
111
-
112
- See the API documentation for more details.
113
-
114
- ### City Example ###
115
-
116
- ```php
117
- <?php
118
- require_once 'vendor/autoload.php';
119
- use GeoIp2\Database\Reader;
120
-
121
- // This creates the Reader object, which should be reused across
122
- // lookups.
123
- $reader = new Reader('/usr/local/share/GeoIP/GeoIP2-City.mmdb');
124
-
125
- // Replace "city" with the appropriate method for your database, e.g.,
126
- // "country".
127
- $record = $reader->city('128.101.101.101');
128
-
129
- print($record->country->isoCode . "\n"); // 'US'
130
- print($record->country->name . "\n"); // 'United States'
131
- print($record->country->names['zh-CN'] . "\n"); // '美国'
132
-
133
- print($record->mostSpecificSubdivision->name . "\n"); // 'Minnesota'
134
- print($record->mostSpecificSubdivision->isoCode . "\n"); // 'MN'
135
-
136
- print($record->city->name . "\n"); // 'Minneapolis'
137
-
138
- print($record->postal->code . "\n"); // '55455'
139
-
140
- print($record->location->latitude . "\n"); // 44.9733
141
- print($record->location->longitude . "\n"); // -93.2323
142
-
143
- print($record->traits->network . "\n"); // '128.101.101.101/32'
144
-
145
- ```
146
-
147
- ### Anonymous IP Example ###
148
-
149
- ```php
150
- <?php
151
- require_once 'vendor/autoload.php';
152
- use GeoIp2\Database\Reader;
153
-
154
- // This creates the Reader object, which should be reused across
155
- // lookups.
156
- $reader = new Reader('/usr/local/share/GeoIP/GeoIP2-Anonymous-IP.mmdb');
157
-
158
- $record = $reader->anonymousIp('128.101.101.101');
159
-
160
- if ($record->isAnonymous) { print "anon\n"; }
161
- print($record->ipAddress . "\n"); // '128.101.101.101'
162
- print($record->network . "\n"); // '128.101.101.101/32'
163
-
164
- ```
165
-
166
- ### Connection-Type Example ###
167
-
168
- ```php
169
- <?php
170
- require_once 'vendor/autoload.php';
171
- use GeoIp2\Database\Reader;
172
-
173
- // This creates the Reader object, which should be reused across
174
- // lookups.
175
- $reader = new Reader('/usr/local/share/GeoIP/GeoIP2-Connection-Type.mmdb');
176
-
177
- $record = $reader->connectionType('128.101.101.101');
178
-
179
- print($record->connectionType . "\n"); // 'Corporate'
180
- print($record->ipAddress . "\n"); // '128.101.101.101'
181
- print($record->network . "\n"); // '128.101.101.101/32'
182
-
183
- ```
184
-
185
- ### Domain Example ###
186
-
187
- ```php
188
- <?php
189
- require_once 'vendor/autoload.php';
190
- use GeoIp2\Database\Reader;
191
-
192
- // This creates the Reader object, which should be reused across
193
- // lookups.
194
- $reader = new Reader('/usr/local/share/GeoIP/GeoIP2-Domain.mmdb');
195
-
196
- $record = $reader->domain('128.101.101.101');
197
-
198
- print($record->domain . "\n"); // 'umn.edu'
199
- print($record->ipAddress . "\n"); // '128.101.101.101'
200
- print($record->network . "\n"); // '128.101.101.101/32'
201
-
202
- ```
203
-
204
- ### Enterprise Example ###
205
-
206
- ```php
207
- <?php
208
- require_once 'vendor/autoload.php';
209
- use GeoIp2\Database\Reader;
210
-
211
- // This creates the Reader object, which should be reused across
212
- // lookups.
213
- $reader = new Reader('/usr/local/share/GeoIP/GeoIP2-Enterprise.mmdb');
214
-
215
- // Use the ->enterprise method to do a lookup in the Enterprise database
216
- $record = $reader->enterprise('128.101.101.101');
217
-
218
- print($record->country->confidence . "\n"); // 99
219
- print($record->country->isoCode . "\n"); // 'US'
220
- print($record->country->name . "\n"); // 'United States'
221
- print($record->country->names['zh-CN'] . "\n"); // '美国'
222
-
223
- print($record->mostSpecificSubdivision->confidence . "\n"); // 77
224
- print($record->mostSpecificSubdivision->name . "\n"); // 'Minnesota'
225
- print($record->mostSpecificSubdivision->isoCode . "\n"); // 'MN'
226
-
227
- print($record->city->confidence . "\n"); // 60
228
- print($record->city->name . "\n"); // 'Minneapolis'
229
-
230
- print($record->postal->code . "\n"); // '55455'
231
-
232
- print($record->location->accuracyRadius . "\n"); // 50
233
- print($record->location->latitude . "\n"); // 44.9733
234
- print($record->location->longitude . "\n"); // -93.2323
235
-
236
- print($record->traits->network . "\n"); // '128.101.101.101/32'
237
-
238
- ```
239
-
240
- ### ISP Example ###
241
-
242
- ```php
243
- <?php
244
- require_once 'vendor/autoload.php';
245
- use GeoIp2\Database\Reader;
246
-
247
- // This creates the Reader object, which should be reused across
248
- // lookups.
249
- $reader = new Reader('/usr/local/share/GeoIP/GeoIP2-ISP.mmdb');
250
-
251
- $record = $reader->isp('128.101.101.101');
252
-
253
- print($record->autonomousSystemNumber . "\n"); // 217
254
- print($record->autonomousSystemOrganization . "\n"); // 'University of Minnesota'
255
- print($record->isp . "\n"); // 'University of Minnesota'
256
- print($record->organization . "\n"); // 'University of Minnesota'
257
-
258
- print($record->ipAddress . "\n"); // '128.101.101.101'
259
- print($record->network . "\n"); // '128.101.101.101/32'
260
-
261
- ```
262
-
263
- ## Web Service Client ##
264
-
265
- ### Usage ###
266
-
267
- To use this API, you must create a new `\GeoIp2\WebService\Client`
268
- object with your `$accountId` and `$licenseKey`, then you call the method
269
- corresponding to a specific end point, passing it the IP address you want to
270
- look up.
271
-
272
- If the request succeeds, the method call will return a model class for the end
273
- point you called. This model in turn contains multiple record classes, each of
274
- which represents part of the data returned by the web service.
275
-
276
- If there is an error, a structured exception is thrown.
277
-
278
- See the API documentation for more details.
279
-
280
- ### Example ###
281
-
282
- ```php
283
- <?php
284
- require_once 'vendor/autoload.php';
285
- use GeoIp2\WebService\Client;
286
-
287
- // This creates a Client object that can be reused across requests.
288
- // Replace "42" with your account ID and "license_key" with your license
289
- // key.
290
- $client = new Client(42, 'abcdef123456');
291
-
292
- // Replace "city" with the method corresponding to the web service that
293
- // you are using, e.g., "country", "insights".
294
- $record = $client->city('128.101.101.101');
295
-
296
- print($record->country->isoCode . "\n"); // 'US'
297
- print($record->country->name . "\n"); // 'United States'
298
- print($record->country->names['zh-CN'] . "\n"); // '美国'
299
-
300
- print($record->mostSpecificSubdivision->name . "\n"); // 'Minnesota'
301
- print($record->mostSpecificSubdivision->isoCode . "\n"); // 'MN'
302
-
303
- print($record->city->name . "\n"); // 'Minneapolis'
304
-
305
- print($record->postal->code . "\n"); // '55455'
306
-
307
- print($record->location->latitude . "\n"); // 44.9733
308
- print($record->location->longitude . "\n"); // -93.2323
309
-
310
- print($record->traits->network . "\n"); // '128.101.101.101/32'
311
-
312
- ```
313
-
314
- ## Values to use for Database or Array Keys ##
315
-
316
- **We strongly discourage you from using a value from any `names` property as
317
- a key in a database or array.**
318
-
319
- These names may change between releases. Instead we recommend using one of the
320
- following:
321
-
322
- * `GeoIp2\Record\City` - `$city->geonameId`
323
- * `GeoIp2\Record\Continent` - `$continent->code` or `$continent->geonameId`
324
- * `GeoIp2\Record\Country` and `GeoIp2\Record\RepresentedCountry` -
325
- `$country->isoCode` or `$country->geonameId`
326
- * `GeoIp2\Record\Subdivision` - `$subdivision->isoCode` or `$subdivision->geonameId`
327
-
328
- ### What data is returned? ###
329
-
330
- While many of the end points return the same basic records, the attributes
331
- which can be populated vary between end points. In addition, while an end
332
- point may offer a particular piece of data, MaxMind does not always have every
333
- piece of data for any given IP address.
334
-
335
- Because of these factors, it is possible for any end point to return a record
336
- where some or all of the attributes are unpopulated.
337
-
338
- See the
339
- [GeoIP2 Precision web service docs](https://dev.maxmind.com/geoip/geoip2/web-services)
340
- for details on what data each end point may return.
341
-
342
- The only piece of data which is always returned is the `ipAddress`
343
- attribute in the `GeoIp2\Record\Traits` record.
344
-
345
- ## Integration with GeoNames ##
346
-
347
- [GeoNames](https://www.geonames.org/) offers web services and downloadable
348
- databases with data on geographical features around the world, including
349
- populated places. They offer both free and paid premium data. Each
350
- feature is unique identified by a `geonameId`, which is an integer.
351
-
352
- Many of the records returned by the GeoIP2 web services and databases
353
- include a `geonameId` property. This is the ID of a geographical feature
354
- (city, region, country, etc.) in the GeoNames database.
355
-
356
- Some of the data that MaxMind provides is also sourced from GeoNames. We
357
- source things like place names, ISO codes, and other similar data from
358
- the GeoNames premium data set.
359
-
360
- ## Reporting data problems ##
361
-
362
- If the problem you find is that an IP address is incorrectly mapped,
363
- please
364
- [submit your correction to MaxMind](https://www.maxmind.com/en/correction).
365
-
366
- If you find some other sort of mistake, like an incorrect spelling,
367
- please check the [GeoNames site](https://www.geonames.org/) first. Once
368
- you've searched for a place and found it on the GeoNames map view, there
369
- are a number of links you can use to correct data ("move", "edit",
370
- "alternate names", etc.). Once the correction is part of the GeoNames
371
- data set, it will be automatically incorporated into future MaxMind
372
- releases.
373
-
374
- If you are a paying MaxMind customer and you're not sure where to submit
375
- a correction, please
376
- [contact MaxMind support](https://www.maxmind.com/en/support) for help.
377
-
378
- ## Other Support ##
379
-
380
- Please report all issues with this code using the
381
- [GitHub issue tracker](https://github.com/maxmind/GeoIP2-php/issues).
382
-
383
- If you are having an issue with a MaxMind service that is not specific
384
- to the client API, please see
385
- [our support page](https://www.maxmind.com/en/support).
386
-
387
- ## Requirements ##
388
-
389
- This library requires PHP 5.6 or greater.
390
-
391
- This library also relies on the [MaxMind DB Reader](https://github.com/maxmind/MaxMind-DB-Reader-php).
392
-
393
- ## Contributing ##
394
-
395
- Patches and pull requests are encouraged. All code should follow the PSR-2
396
- style guidelines. Please include unit tests whenever possible. You may obtain
397
- the test data for the maxmind-db folder by running `git submodule update
398
- --init --recursive` or adding `--recursive` to your initial clone, or from
399
- https://github.com/maxmind/MaxMind-DB
400
-
401
- ## Versioning ##
402
-
403
- The GeoIP2 PHP API uses [Semantic Versioning](https://semver.org/).
404
-
405
- ## Copyright and License ##
406
-
407
- This software is Copyright (c) 2013-2019 by MaxMind, Inc.
408
-
409
- This is free software, licensed under the Apache License, Version 2.0.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/geoip2/geoip2/composer.json DELETED
@@ -1,31 +0,0 @@
1
- {
2
- "name": "geoip2/geoip2",
3
- "description": "MaxMind GeoIP2 PHP API",
4
- "keywords": ["geoip", "geoip2", "geolocation", "ip", "maxmind"],
5
- "homepage": "https://github.com/maxmind/GeoIP2-php",
6
- "type": "library",
7
- "license": "Apache-2.0",
8
- "authors": [
9
- {
10
- "name": "Gregory J. Oschwald",
11
- "email": "goschwald@maxmind.com",
12
- "homepage": "https://www.maxmind.com/"
13
- }
14
- ],
15
- "require": {
16
- "maxmind-db/reader": "~1.5",
17
- "maxmind/web-service-common": "~0.6",
18
- "php": ">=5.6",
19
- "ext-json": "*"
20
- },
21
- "require-dev": {
22
- "friendsofphp/php-cs-fixer": "2.*",
23
- "phpunit/phpunit": "5.*",
24
- "squizlabs/php_codesniffer": "3.*"
25
- },
26
- "autoload": {
27
- "psr-4": {
28
- "GeoIp2\\": "src"
29
- }
30
- }
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/jaybizzle/crawler-detect/README.md DELETED
@@ -1,76 +0,0 @@
1
- <p align="center"><a href="https://crawlerdetect.io/" target="_blank"><img src="https://cloud.githubusercontent.com/assets/340752/23082173/1bd1a396-f550-11e6-8aba-4d3c75edea2f.png" width="321" height="219" /></a><br><br>
2
- <a href="https://crawlerdetect.io/" target="_blank">crawlerdetect.io</a>
3
- <br><br>
4
- </p>
5
- <p align="center">
6
- <a href="https://github.com/JayBizzle/Crawler-Detect/actions"><img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/JayBizzle/Crawler-Detect/Test?style=flat-square"></a>
7
- <a href="https://packagist.org/packages/jaybizzle/crawler-detect"><img src="https://img.shields.io/packagist/dm/JayBizzle/Crawler-Detect.svg?style=flat-square" /></a>
8
- <a href="https://scrutinizer-ci.com/g/JayBizzle/Crawler-Detect/?branch=master"><img src="https://img.shields.io/scrutinizer/g/JayBizzle/Crawler-Detect.svg?style=flat-square" /></a>
9
- <a href="https://github.com/JayBizzle/Crawler-Detect"><img src="https://img.shields.io/badge/license-MIT-ff69b4.svg?style=flat-square" /></a>
10
- <a href="https://packagist.org/packages/jaybizzle/crawler-detect"><img src="https://img.shields.io/packagist/v/jaybizzle/Crawler-Detect.svg?style=flat-square" /></a>
11
- <a href="https://coveralls.io/github/JayBizzle/Crawler-Detect"><img src="https://img.shields.io/coveralls/JayBizzle/Crawler-Detect/master.svg?style=flat-square" /></a>
12
- </p>
13
-
14
- ## About CrawlerDetect
15
-
16
- CrawlerDetect is a PHP class for detecting bots/crawlers/spiders via the user agent and http_from header. Currently able to detect 1,000's of bots/spiders/crawlers.
17
-
18
- ### Installation
19
- ```
20
- composer require jaybizzle/crawler-detect
21
- ```
22
-
23
- ### Usage
24
- ```PHP
25
- use Jaybizzle\CrawlerDetect\CrawlerDetect;
26
-
27
- $CrawlerDetect = new CrawlerDetect;
28
-
29
- // Check the user agent of the current 'visitor'
30
- if($CrawlerDetect->isCrawler()) {
31
- // true if crawler user agent detected
32
- }
33
-
34
- // Pass a user agent as a string
35
- if($CrawlerDetect->isCrawler('Mozilla/5.0 (compatible; Sosospider/2.0; +http://help.soso.com/webspider.htm)')) {
36
- // true if crawler user agent detected
37
- }
38
-
39
- // Output the name of the bot that matched (if any)
40
- echo $CrawlerDetect->getMatches();
41
- ```
42
-
43
- ### Contributing
44
- If you find a bot/spider/crawler user agent that CrawlerDetect fails to detect, please submit a pull request with the regex pattern added to the `$data` array in `Fixtures/Crawlers.php` and add the failing user agent to `tests/crawlers.txt`.
45
-
46
- Failing that, just create an issue with the user agent you have found, and we'll take it from there :)
47
-
48
- ### Laravel Package
49
- If you would like to use this with Laravel, please see [Laravel-Crawler-Detect](https://github.com/JayBizzle/Laravel-Crawler-Detect)
50
-
51
- ### Symfony Bundle
52
- To use this library with Symfony 2/3/4, check out the [CrawlerDetectBundle](https://github.com/nicolasmure/CrawlerDetectBundle).
53
-
54
- ### YII2 Extension
55
- To use this library with the YII2 framework, check out [yii2-crawler-detect](https://github.com/AlikDex/yii2-crawler-detect).
56
-
57
- ### ES6 Library
58
- To use this library with NodeJS or any ES6 application based, check out [es6-crawler-detect](https://github.com/JefferyHus/es6-crawler-detect).
59
-
60
- ### Python Library
61
- To use this library in a Python project, check out [crawlerdetect](https://github.com/moskrc/CrawlerDetect).
62
-
63
- ### .NET Library
64
- To use this library in a .net standard (including .net core) based project, check out [NetCrawlerDetect](https://github.com/gplumb/NetCrawlerDetect).
65
-
66
- ### Ruby Gem
67
-
68
- To use this library with Ruby on Rails or any Ruby-based application, check out [crawler_detect](https://github.com/loadkpi/crawler_detect) gem.
69
-
70
- ### Go Module
71
-
72
- To use this library with Go, check out the [crawlerdetect](https://github.com/x-way/crawlerdetect) module.
73
-
74
- _Parts of this class are based on the brilliant [MobileDetect](https://github.com/serbanghita/Mobile-Detect)_
75
-
76
- [![Analytics](https://ga-beacon.appspot.com/UA-72430465-1/Crawler-Detect/readme?pixel)](https://github.com/JayBizzle/Crawler-Detect)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/jaybizzle/crawler-detect/composer.json DELETED
@@ -1,29 +0,0 @@
1
- {
2
- "name": "jaybizzle/crawler-detect",
3
- "type": "library",
4
- "description": "CrawlerDetect is a PHP class for detecting bots/crawlers/spiders via the user agent",
5
- "keywords": ["crawler", "crawler detect", "crawler detector", "crawlerdetect", "php crawler detect"],
6
- "homepage": "https://github.com/JayBizzle/Crawler-Detect/",
7
- "license": "MIT",
8
- "authors": [
9
- {
10
- "name": "Mark Beech",
11
- "email": "m@rkbee.ch",
12
- "role": "Developer"
13
- }
14
- ],
15
- "require": {
16
- "php": ">=5.3.0"
17
- },
18
- "require-dev": {
19
- "phpunit/phpunit": "^4.8|^5.5|^6.5"
20
- },
21
- "autoload": {
22
- "psr-4": {
23
- "Jaybizzle\\CrawlerDetect\\": "src/"
24
- }
25
- },
26
- "scripts": {
27
- "test": "vendor/bin/phpunit"
28
- }
29
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/maxmind-db/reader/README.md DELETED
@@ -1,178 +0,0 @@
1
- # MaxMind DB Reader PHP API #
2
-
3
- ## Description ##
4
-
5
- This is the PHP API for reading MaxMind DB files. MaxMind DB is a binary file
6
- format that stores data indexed by IP address subnets (IPv4 or IPv6).
7
-
8
- ## Installation (Composer) ##
9
-
10
- We recommend installing this package with [Composer](https://getcomposer.org/).
11
-
12
- ### Download Composer ###
13
-
14
- To download Composer, run in the root directory of your project:
15
-
16
- ```bash
17
- curl -sS https://getcomposer.org/installer | php
18
- ```
19
-
20
- You should now have the file `composer.phar` in your project directory.
21
-
22
- ### Install Dependencies ###
23
-
24
- Run in your project root:
25
-
26
- ```
27
- php composer.phar require maxmind-db/reader:~1.0
28
- ```
29
-
30
- You should now have the files `composer.json` and `composer.lock` as well as
31
- the directory `vendor` in your project directory. If you use a version control
32
- system, `composer.json` should be added to it.
33
-
34
- ### Require Autoloader ###
35
-
36
- After installing the dependencies, you need to require the Composer autoloader
37
- from your code:
38
-
39
- ```php
40
- require 'vendor/autoload.php';
41
- ```
42
-
43
- ## Installation (Standalone) ##
44
-
45
- If you don't want to use Composer for some reason, a custom
46
- `autoload.php` is provided for you in the project root. To use the
47
- library, simply include that file,
48
-
49
- ```php
50
- require('/path/to/MaxMind-DB-Reader-php/autoload.php');
51
- ```
52
-
53
- and then instantiate the reader class normally:
54
-
55
- ```php
56
- use MaxMind\Db\Reader;
57
- $reader = new Reader('example.mmdb');
58
- ```
59
-
60
- ## Installation (RPM)
61
-
62
- RPMs are available in the [official Fedora repository](https://apps.fedoraproject.org/packages/php-maxminddb).
63
-
64
- To install on Fedora, run:
65
-
66
- ```bash
67
- dnf install php-maxminddb
68
- ```
69
-
70
- To install on CentOS or RHEL 7, first [enable the EPEL repository](https://fedoraproject.org/wiki/EPEL)
71
- and then run:
72
-
73
- ```bash
74
- yum install php-maxminddb
75
- ```
76
-
77
- Please note that these packages are *not* maintained by MaxMind.
78
-
79
- ## Usage ##
80
-
81
- ## Example ##
82
-
83
- ```php
84
- <?php
85
- require_once 'vendor/autoload.php';
86
-
87
- use MaxMind\Db\Reader;
88
-
89
- $ipAddress = '24.24.24.24';
90
- $databaseFile = 'GeoIP2-City.mmdb';
91
-
92
- $reader = new Reader($databaseFile);
93
-
94
- // get returns just the record for the IP address
95
- print_r($reader->get($ipAddress));
96
-
97
- // getWithPrefixLen returns an array containing the record and the
98
- // associated prefix length for that record.
99
- print_r($reader->getWithPrefixLen($ipAddress));
100
-
101
- $reader->close();
102
- ```
103
-
104
- ## Optional PHP C Extension ##
105
-
106
- MaxMind provides an optional C extension that is a drop-in replacement for
107
- `MaxMind\Db\Reader`. In order to use this extension, you must install the
108
- Reader API as described above and install the extension as described below. If
109
- you are using an autoloader, no changes to your code should be necessary.
110
-
111
- ### Installing Extension ###
112
-
113
- First install [libmaxminddb](https://github.com/maxmind/libmaxminddb) as
114
- described in its [README.md
115
- file](https://github.com/maxmind/libmaxminddb/blob/master/README.md#installing-from-a-tarball).
116
- After successfully installing libmaxmindb, run the following commands from the
117
- top-level directory of this distribution:
118
-
119
- ```
120
- cd ext
121
- phpize
122
- ./configure
123
- make
124
- make test
125
- sudo make install
126
- ```
127
-
128
- You then must load your extension. The recommend method is to add the
129
- following to your `php.ini` file:
130
-
131
- ```
132
- extension=maxminddb.so
133
- ```
134
-
135
- Note: You may need to install the PHP development package on your OS such as
136
- php5-dev for Debian-based systems or php-devel for RedHat/Fedora-based ones.
137
-
138
- ## 128-bit Integer Support ##
139
-
140
- The MaxMind DB format includes 128-bit unsigned integer as a type. Although
141
- no MaxMind-distributed database currently makes use of this type, both the
142
- pure PHP reader and the C extension support this type. The pure PHP reader
143
- requires gmp or bcmath to read databases with 128-bit unsigned integers.
144
-
145
- The integer is currently returned as a hexadecimal string (prefixed with "0x")
146
- by the C extension and a decimal string (no prefix) by the pure PHP reader.
147
- Any change to make the reader implementations always return either a
148
- hexadecimal or decimal representation of the integer will NOT be considered a
149
- breaking change.
150
-
151
- ## Support ##
152
-
153
- Please report all issues with this code using the [GitHub issue tracker](https://github.com/maxmind/MaxMind-DB-Reader-php/issues).
154
-
155
- If you are having an issue with a MaxMind service that is not specific to the
156
- client API, please see [our support page](https://www.maxmind.com/en/support).
157
-
158
- ## Requirements ##
159
-
160
- This library requires PHP 5.6 or greater.
161
-
162
- The GMP or BCMath extension may be required to read some databases
163
- using the pure PHP API.
164
-
165
- ## Contributing ##
166
-
167
- Patches and pull requests are encouraged. All code should follow the PSR-1 and
168
- PSR-2 style guidelines. Please include unit tests whenever possible.
169
-
170
- ## Versioning ##
171
-
172
- The MaxMind DB Reader PHP API uses [Semantic Versioning](https://semver.org/).
173
-
174
- ## Copyright and License ##
175
-
176
- This software is Copyright (c) 2014-2019 by MaxMind, Inc.
177
-
178
- This is free software, licensed under the Apache License, Version 2.0.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/maxmind-db/reader/composer.json DELETED
@@ -1,43 +0,0 @@
1
- {
2
- "name": "maxmind-db/reader",
3
- "description": "MaxMind DB Reader API",
4
- "keywords": ["database", "geoip", "geoip2", "geolocation", "maxmind"],
5
- "homepage": "https://github.com/maxmind/MaxMind-DB-Reader-php",
6
- "type": "library",
7
- "license": "Apache-2.0",
8
- "authors": [
9
- {
10
- "name": "Gregory J. Oschwald",
11
- "email": "goschwald@maxmind.com",
12
- "homepage": "https://www.maxmind.com/"
13
- }
14
- ],
15
- "require": {
16
- "php": ">=5.6"
17
- },
18
- "suggest": {
19
- "ext-bcmath": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder",
20
- "ext-gmp": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder",
21
- "ext-maxminddb": "A C-based database decoder that provides significantly faster lookups"
22
- },
23
- "conflict": {
24
- "ext-maxminddb": "<1.6.0,>=2.0.0"
25
- },
26
- "require-dev": {
27
- "friendsofphp/php-cs-fixer": "2.*",
28
- "phpunit/phpunit": "5.*",
29
- "php-coveralls/php-coveralls": "^2.1",
30
- "phpunit/phpcov": "^3.0",
31
- "squizlabs/php_codesniffer": "3.*"
32
- },
33
- "autoload": {
34
- "psr-4": {
35
- "MaxMind\\Db\\": "src/MaxMind/Db"
36
- }
37
- },
38
- "autoload-dev": {
39
- "psr-4": {
40
- "MaxMind\\Db\\Test\\Reader\\": "tests/MaxMind/Db/Test/Reader"
41
- }
42
- }
43
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/maxmind/web-service-common/README.md DELETED
@@ -1,25 +0,0 @@
1
- # Common Code for MaxMind Web Service Clients #
2
-
3
- This is _not_ intended for direct use by third parties. Rather, it is for
4
- shared code between MaxMind's various web service client APIs.
5
-
6
- ## Requirements ##
7
-
8
- The library requires PHP 5.6 or greater.
9
-
10
- There are several other dependencies as defined in the `composer.json` file.
11
-
12
- ## Contributing ##
13
-
14
- Patches and pull requests are encouraged. All code should follow the PSR-2
15
- style guidelines. Please include unit tests whenever possible.
16
-
17
- ## Versioning ##
18
-
19
- This API uses [Semantic Versioning](http://semver.org/).
20
-
21
- ## Copyright and License ##
22
-
23
- This software is Copyright (c) 2015-2020 by MaxMind, Inc.
24
-
25
- This is free software, licensed under the Apache License, Version 2.0.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/maxmind/web-service-common/composer.json DELETED
@@ -1,31 +0,0 @@
1
- {
2
- "name": "maxmind/web-service-common",
3
- "description": "Internal MaxMind Web Service API",
4
- "minimum-stability": "stable",
5
- "homepage": "https://github.com/maxmind/web-service-common-php",
6
- "type": "library",
7
- "license": "Apache-2.0",
8
- "authors": [
9
- {
10
- "name": "Gregory Oschwald",
11
- "email": "goschwald@maxmind.com"
12
- }
13
- ],
14
- "require": {
15
- "php": ">=5.6",
16
- "composer/ca-bundle": "^1.0.3",
17
- "ext-curl": "*",
18
- "ext-json": "*"
19
- },
20
- "require-dev": {
21
- "friendsofphp/php-cs-fixer": "2.*",
22
- "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0",
23
- "squizlabs/php_codesniffer": "3.*"
24
- },
25
- "autoload": {
26
- "psr-4": {
27
- "MaxMind\\Exception\\": "src/Exception",
28
- "MaxMind\\WebService\\": "src/WebService"
29
- }
30
- }
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/psr/cache/README.md DELETED
@@ -1,9 +0,0 @@
1
- PSR Cache
2
- =========
3
-
4
- This repository holds all interfaces defined by
5
- [PSR-6](http://www.php-fig.org/psr/psr-6/).
6
-
7
- Note that this is not a Cache implementation of its own. It is merely an
8
- interface that describes a Cache implementation. See the specification for more
9
- details.
 
 
 
 
 
 
 
 
 
includes/vendor/psr/cache/composer.json DELETED
@@ -1,25 +0,0 @@
1
- {
2
- "name": "psr/cache",
3
- "description": "Common interface for caching libraries",
4
- "keywords": ["psr", "psr-6", "cache"],
5
- "license": "MIT",
6
- "authors": [
7
- {
8
- "name": "PHP-FIG",
9
- "homepage": "http://www.php-fig.org/"
10
- }
11
- ],
12
- "require": {
13
- "php": ">=5.3.0"
14
- },
15
- "autoload": {
16
- "psr-4": {
17
- "Psr\\Cache\\": "src/"
18
- }
19
- },
20
- "extra": {
21
- "branch-alias": {
22
- "dev-master": "1.0.x-dev"
23
- }
24
- }
25
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/s1lentium/iptools/.gitignore DELETED
@@ -1,32 +0,0 @@
1
- # phpstorm project files
2
- .idea
3
-
4
- # netbeans project files
5
- nbproject
6
-
7
- # zend studio for eclipse project files
8
- .buildpath
9
- .project
10
- .settings
11
-
12
- # windows thumbnail cache
13
- Thumbs.db
14
-
15
- # Mac DS_Store Files
16
- .DS_Store
17
-
18
- # composer vendor dir
19
- /vendor
20
-
21
- # phpunit itself is not needed
22
- phpunit.phar
23
-
24
- # local phpunit config
25
- phpunit.xml
26
- phpunit.xml.dist
27
-
28
- # coverage report
29
- /coverage
30
-
31
- composer.phar
32
- composer.lock
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/s1lentium/iptools/README.md DELETED
@@ -1,206 +0,0 @@
1
- # IPTools
2
-
3
- PHP Library for manipulating network addresses (IPv4 and IPv6).
4
-
5
- [![Build Status](https://travis-ci.org/S1lentium/IPTools.svg)](https://travis-ci.org/S1lentium/IPTools)
6
- [![Coverage Status](https://coveralls.io/repos/S1lentium/IPTools/badge.svg?branch=master&service=github)](https://coveralls.io/github/S1lentium/IPTools?branch=master)
7
- [![Code Climate](https://codeclimate.com/github/S1lentium/IPTools/badges/gpa.svg)](https://codeclimate.com/github/S1lentium/IPTools)
8
-
9
- [![PHP 5.4](https://img.shields.io/badge/PHP-5.4-8892BF.svg)](http://php.net)
10
- [![PHP 7.0](https://img.shields.io/badge/PHP-7.0-8892BF.svg)](http://php.net)
11
-
12
- ## Installation
13
- Composer:
14
- Run in command line:
15
- ```
16
- composer require s1lentium/iptools
17
- ```
18
- or put in composer.json:
19
- ```json
20
- {
21
- "require": {
22
- "s1lentium/iptools": "*"
23
- }
24
- }
25
- ```
26
-
27
- ## Usage
28
-
29
- ### IP Operations
30
- ```php
31
- $ip = new IP('192.168.1.1');
32
- echo $ip->version;// IPv4
33
- ```
34
-
35
- ```php
36
- $ip = new IP('fc00::');
37
- echo $ip->version; // IPv6
38
- ```
39
-
40
- **Parsing IP from integer, binary and hex:**
41
- ```php
42
- echo (string)IP::parse(2130706433); // 127.0.0.1
43
- echo (string)IP::parse('0b11000000101010000000000100000001') // 192.168.1.1
44
- echo (string)IP::parse('0x0a000001'); // 10.0.0.1
45
- ```
46
- or:
47
- ```php
48
- echo (string)IP::parseLong(2130706433); // 127.0.0.1
49
- echo (string)IP::parseBin('11000000101010000000000100000001'); // 192.168.1.1
50
- echo (string)IP::parseHex('0a000001'); // 10.0.0.1
51
- ```
52
-
53
- **Converting IP to other formats:**
54
- ```php
55
- echo IP::parse('192.168.1.1')->bin // 11000000101010000000000100000001
56
- echo IP::parse('10.0.0.1')->hex // 0a000001
57
- echo IP::parse('127.0.0.1')->long // 2130706433
58
- ```
59
-
60
- #### Other public properties:
61
-
62
- `maxPrefixLength`
63
- The max number of bits in the address representation: 32 for IPv4, 128 for IPv6.
64
-
65
- `octetsCount`
66
- The count of octets in IP address: 4 for IPv4, 16 for IPv6
67
-
68
- `reversePointer`
69
- The name of the reverse DNS PTR for the address:
70
- ```php
71
- echo new IP::parse('192.0.2.5')->reversePointer // 5.2.0.192.in-addr.arpa
72
- echo new IP::parse('2001:db8::567:89ab')->reversePointer // b.a.9.8.7.6.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa
73
- ```
74
-
75
- ### Network Operations
76
- ```php
77
- echo Network::parse('192.0.0.1 255.0.0.0')->CIDR; // 192.0.0.0/8
78
- echo (string)Network::parse('192.0.0.1/8')->netmask; // 255.0.0.0
79
- echo (string)Network::parse('192.0.0.1'); // 192.0.0.1/32
80
- ```
81
-
82
- **Exclude IP from Network:**
83
- ```php
84
- $excluded = Network::parse('192.0.0.0/8')->exclude(new IP('192.168.1.1'));
85
- foreach($excluded as $network) {
86
- echo (string)$network . '<br>';
87
- }
88
- ```
89
- 192.0.0.0/9
90
- 192.128.0.0/11
91
- 192.160.0.0/13
92
- 192.168.0.0/24
93
- 192.168.1.0/32
94
- 192.168.1.2/31
95
- ...
96
- 192.192.0.0/10
97
-
98
- **Exclude Subnet from Network:**
99
- ```php
100
- $excluded = Network::parse('192.0.0.0/8')->exclude(new Network('192.168.1.0/24'));
101
- foreach($excluded as $network) {
102
- echo (string)$network . '<br>';
103
- }
104
- ```
105
- 192.0.0.0/9
106
- 192.128.0.0/11
107
- 192.160.0.0/13
108
- 192.168.0.0/24
109
- 192.168.2.0/23
110
- ...
111
- 192.192.0.0/10
112
-
113
- **Split network into equal subnets**
114
- ```php
115
- $networks = Network::parse('192.168.0.0/22')->moveTo('24');
116
- foreach ($networks as $network) {
117
- echo (string)$network . '<br>';
118
- }
119
- ```
120
- 192.168.0.0/24
121
- 192.168.1.0/24
122
- 192.168.2.0/24
123
- 192.168.3.0/24
124
-
125
- **Iterate over Network IP adresses:**
126
- ```php
127
- $network = Network::parse('192.168.1.0/24');
128
- foreach($network as $ip) {
129
- echo (string)$ip . '<br>';
130
- }
131
- ```
132
- 192.168.1.0
133
- ...
134
- 192.168.1.255
135
-
136
- **Get Network hosts adresses as Range:**
137
- ```php
138
- $hosts = Network::parse('192.168.1.0/24')->hosts // Range(192.168.1.1, 192.168.1.254);
139
- foreach($hosts as $ip) {
140
- echo (string)$ip . '<br>';
141
- }
142
- ```
143
- 192.168.1.1
144
- ...
145
- 192.168.1.254
146
-
147
- **Count Network IP adresses**
148
- ```php
149
- echo count(Network::parse('192.168.1.0/24')) // 254
150
- ```
151
-
152
- ### Range Operations
153
- **Define the range in different formats:**
154
- ```php
155
- $range = new Range(new IP('192.168.1.0'), new IP('192.168.1.255'));
156
- $range = Range::parse('192.168.1.0-192.168.1.255');
157
- $range = Range::parse('192.168.1.*');
158
- $range = Range::parse('192.168.1.0/24');
159
- ```
160
- **Check if IP is within Range:**
161
- ```php
162
- echo Range::parse('192.168.1.1-192.168.1.254')->contains(new IP('192.168.1.5')); // true
163
- echo Range::parse('::1-::ffff')->contains(new IP('::1234')); // true
164
- ```
165
-
166
- **Iterate over Range IP adresses:**
167
- ```php
168
- $range = Range::parse('192.168.1.1-192.168.1.254');
169
- foreach($range as $ip) {
170
- echo (string)$ip . '<br>';
171
- }
172
- ```
173
- 192.168.1.1
174
- ...
175
- 192.168.1.254
176
-
177
- **Get Networks that fit into a specified range of IP Adresses:**
178
- ```php
179
- $networks = Range::parse('192.168.1.1-192.168.1.254')->getNetworks();
180
-
181
- foreach($networks as $network) {
182
- echo (string)$network . '<br>';
183
- }
184
- ```
185
- 192.168.1.1/32
186
- 192.168.1.2/31
187
- 192.168.1.4/30
188
- 192.168.1.8/29
189
- 192.168.1.16/28
190
- 192.168.1.32/27
191
- 192.168.1.64/26
192
- 192.168.1.128/26
193
- 192.168.1.192/27
194
- 192.168.1.224/28
195
- 192.168.1.240/29
196
- 192.168.1.248/30
197
- 192.168.1.252/31
198
- 192.168.1.254/32
199
-
200
- **Count IP adresses in Range**
201
- ```php
202
- echo count(Range::parse('192.168.1.1-192.168.1.254')) // 254
203
- ```
204
-
205
- # License
206
- The library is released under the [MIT](https://opensource.org/licenses/MIT).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/s1lentium/iptools/composer.json DELETED
@@ -1,25 +0,0 @@
1
- {
2
- "name": "s1lentium/iptools",
3
- "type": "library",
4
- "description": "PHP Library for manipulating network addresses (IPv4 and IPv6)",
5
- "keywords": ["IP-Tools", "network", "subnet", "cidr", "IP", "IPv4", "IPv6"],
6
- "license": "MIT",
7
- "authors": [{
8
- "name": "Safarov Alisher",
9
- "email": "alisher.safarov@outlook.com",
10
- "homepage": "https://github.com/S1lentium"
11
- }],
12
- "require": {
13
- "php": ">=5.4.0",
14
- "ext-bcmath": "*"
15
- },
16
- "require-dev": {
17
- "satooshi/php-coveralls": "~1.0",
18
- "phpunit/phpunit": "~4.0"
19
- },
20
- "autoload": {
21
- "psr-4": {
22
- "IPTools\\": "src/"
23
- }
24
- }
25
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/whichbrowser/parser/.gitignore DELETED
@@ -1,12 +0,0 @@
1
- runner.log
2
- runner.xml
3
- composer.lock
4
- package-lock.json
5
- vendor/*
6
- package.json
7
- Gruntfile.js
8
- node_modules/*
9
- humbug*
10
- build/*
11
- .vscode
12
- .DS_Store
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/whichbrowser/parser/README.md DELETED
@@ -1,510 +0,0 @@
1
- <img src="https://api.whichbrowser.net/whichbrowser.svg" width="400">
2
-
3
- This is an extremely complicated and almost completely useless browser sniffing library. Useless because you shouldn't use browser sniffing. So stop right now and go read something about feature detecting instead. I'm serious. Go away. You'll thank me later.
4
-
5
-
6
- WhichBrowser/Parser-PHP
7
- =======================
8
-
9
- The PHP version of WhichBrowser for use on a server. Fully compatible with PHP 5.4 or higher, including PHP 7 and HHVM.
10
-
11
- [![Build Status](https://travis-ci.org/WhichBrowser/Parser-PHP.svg?branch=master)](https://travis-ci.org/WhichBrowser/Parser)
12
- [![Coverage Status](https://coveralls.io/repos/WhichBrowser/Parser-PHP/badge.svg?branch=master&service=github)](https://coveralls.io/github/WhichBrowser/Parser-PHP?branch=master)
13
- [![License](https://poser.pugx.org/whichbrowser/parser/license)](https://packagist.org/packages/whichbrowser/parser)
14
- [![Latest Stable Version](https://poser.pugx.org/whichbrowser/parser/v/stable)](https://packagist.org/packages/whichbrowser/parser)
15
-
16
- [![Twitter Follow](https://img.shields.io/twitter/follow/whichbrowserlib.svg?style=social)](https://twitter.com/whichbrowserlib)
17
-
18
- Also available:
19
-
20
- - [WhichBrowser/Parser-JavaScript](https://github.com/WhichBrowser/Parser-JavaScript)<br>
21
- A JavaScript version of WhichBrowser for use with Node.js on the server
22
-
23
- - [WhichBrowser/Server](https://github.com/WhichBrowser/Server)<br>
24
- A server written in PHP that provides a JavaScript API for use in the browser
25
-
26
- ---
27
-
28
-
29
- About WhichBrowser
30
- ------------------
31
-
32
- **But why *almost completely useless* and not completely useless?**
33
- Well, there is always an exception to the rule. There are valid reasons to do browser sniffing: to improve the user experience or to gather intelligence about which browsers are used on your website. My website is html5test.com and I wanted to know which score belongs to which browser. And to do that you need a browser sniffing library.
34
-
35
- **Why is it extremely complicated?**
36
- Because everybody lies. Seriously, there is not a single browser that is completely truthful. Almost all browsers say they are Netscape 5 and almost all WebKit browsers say they are based on Gecko. Even Internet Explorer 11 now no longer claims to be IE at all, but instead an unnamed browser that is like Gecko. And it gets worse. That is why it is complicated.
37
-
38
- **What kind of information does it give?**
39
- You get a nice object which has information about the browser, rendering engine, os and device. It gives you names and versions and even device manufacturer and model. And WhichBrowser is pretty tenacious. It gives you info that others don't. For example:
40
-
41
- JUC (Linux; U; 2.3.6; zh-cn; GT-I8150; 480*800) UCWEB8.7.4.225/145/800
42
- UC Browser 8.7 on a Samsung Galaxy W running Android 2.3.6
43
-
44
- Android is never mentioned
45
-
46
- Mozilla/5.0 (Series40; Nokia501/10.0.2; Profile/MIDP-2.1 Configuration/CLDC-1.1) Gecko/20100401 S40OviBrowser/3.0.0.0.73
47
- Nokia Xpress 3.0.0 on a Nokia Asha 501 running Nokia Asha Platform
48
-
49
- Despite the useragent header claiming to be a Series40 device, we know it's actually running the Asha Platform and we also know that OviBrowser has been renamed to Nokia Xpress.
50
-
51
- Opera/9.80 (X11; Linux zvav; U; zh) Presto/2.8.119 Version/11.10
52
- Opera Mini on a Nokia 5230 running Series60 5.0
53
-
54
- The useragent header looks like Opera 11.10 on Linux, but we know it's Opera Mini. We can even figure out the real operating system and device model from other headers.
55
-
56
-
57
-
58
- Requirements
59
- -----------------
60
-
61
- WhichBrowser requires with PHP 5.4 or higher and supports PHP 7 and HHVM. WhichBrowser is compatible with the PSR-4 autoloading standard and follows PSR-1 and PSR-2 coding style.
62
-
63
-
64
- How to install it
65
- -----------------
66
-
67
- You can install WhichBrowser by using Composer - the standard package manager for PHP. The package is called `whichbrowser/parser`.
68
-
69
- composer require whichbrowser/parser
70
-
71
- You can easily update WhichBrowser by running a simple command.
72
-
73
- composer update whichbrowser/parser
74
-
75
- You should run this command as often as possible. You might even want to consider setting up a cron job for this purpose.
76
-
77
-
78
-
79
-
80
- How to use it
81
- -------------
82
-
83
- The first step require the Composer autoloader:
84
-
85
- ```php
86
- <?php
87
-
88
- require 'vendor/autoload.php';
89
- ```
90
-
91
- The second step is to create a new `WhichBrowser\Parser` object. This object will contain all the information the library could find about the browser. The object has a required parameter, either the headers send by the browser, or a useragent string. Using the headers is preferable, because it will allow a better detection, but if you have just the useragent string, this will also work.
92
-
93
- For example:
94
-
95
- ```php
96
- $result = new WhichBrowser\Parser(getallheaders());
97
- ```
98
-
99
- or:
100
-
101
- ```php
102
- $result = new WhichBrowser\Parser($_SERVER['HTTP_USER_AGENT']);
103
- ```
104
-
105
-
106
- The variable `$result` now contains an object which you can query for information. There are various ways to access the information.
107
-
108
-
109
- First of all, you can call to `toString()` function to get a human readable identification:
110
-
111
- ```php
112
- "You are using " . $result->toString();
113
- // You are using Chrome 27 on OS X Mountain Lion 10.8
114
- ```
115
-
116
- Another possiblity is to query the object:
117
-
118
- ```php
119
- $result->isType('desktop');
120
- // true
121
-
122
- $result->isType('mobile', 'tablet', 'media', 'gaming:portable');
123
- // false
124
-
125
- $result->isBrowser('Maxthon', '<', '4.0.5');
126
- // false
127
-
128
- $result->isOs('iOS', '>=', '8');
129
- // false
130
-
131
- $result->isOs('OS X');
132
- // true
133
-
134
- $result->isEngine('Blink');
135
- // true
136
- ```
137
-
138
- You can also access these properties directly:
139
-
140
- ```php
141
- $result->browser->toString();
142
- // Chrome 27
143
-
144
- $result->engine->toString();
145
- // Blink
146
-
147
- $result->os->toString();
148
- // OS X Mountain Lion 10.8
149
- ```
150
-
151
- Or access parts of these properties directly:
152
-
153
- ```php
154
- $result->browser->name;
155
- // Chrome
156
-
157
- $result->browser->name . ' ' . $result->browser->version.toString();
158
- // Chrome 27
159
-
160
- $result->browser->version->value;
161
- // 27.0.1453.110
162
-
163
- $result->engine->name;
164
- // Blink
165
- ```
166
-
167
- Finally you can also query versions directly:
168
-
169
- ```php
170
- $result->browser->version->is('>', 26);
171
- // true
172
-
173
- $result->os->version->is('<', '10.7.4');
174
- // false
175
- ```
176
-
177
- Options
178
- -------
179
-
180
- It is possible to set additional options by passing an array as the second parameter when creating the `Parser` object.
181
-
182
- ### Disabling detection of bots
183
-
184
- In some cases you may want to disable the detection of bots. This allows the bot the deliberately fool WhichBrowser, so you can pick up the identity of useragent what the bot tries to mimic. This is especially handy when you want to use WhichBrowser to switch between different variants of your website and want to make sure crawlers see the right variant of the website. For example, a bot that mimics a mobile device will see the mobile variant of you site.
185
-
186
- ```php
187
- $result = new WhichBrowser\Parser(getallheaders(), [ 'detectBots' => false ]);
188
- ```
189
-
190
- Enable result caching
191
- ---------------------
192
-
193
- WhichBrowser supports PSR-6 compatible cache adapters for caching results between requests. Using a cache is especially useful if you use WhichBrowser on every page of your website and a user visits multiple pages. During the first visit the headers will be parsed and the result will be cached. Upon further visits, the cached results will be used, which is much faster than having to parse the headers again and again.
194
-
195
- There are adapters available for other types of caches, such as APC, Doctrine, Memcached, MongoDB, Redis and many more. The configuration of these adapters all differ from each other, but once configured, all you have to do is pass it as an option when creating the `Parser` object, or use the `setCache()` function to set it afterwards. WhichBrowser has been tested to work with the adapters provided by [PHP Cache](http://php-cache.readthedocs.org/en/latest/). For a list of other packages that provide adapters see [Packagist](https://packagist.org/providers/psr/cache-implementation).
196
-
197
- For example, if you want to enable a memcached based cache you need to install an extra composer package:
198
-
199
- composer require cache/memcached-adapter
200
-
201
- And change the call to WhichBrowser/Parser as follows:
202
-
203
- ```php
204
- $client = new \Memcached();
205
- $client->addServer('localhost', 11211);
206
-
207
- $pool = new \Cache\Adapter\Memcached\MemcachedCachePool($client);
208
-
209
- $result = new WhichBrowser\Parser(getallheaders(), [ 'cache' => $pool ]);
210
- ```
211
-
212
- or
213
-
214
- ```php
215
- $client = new \Memcached();
216
- $client->addServer('localhost', 11211);
217
-
218
- $pool = new \Cache\Adapter\Memcached\MemcachedCachePool($client);
219
-
220
- $result = new WhichBrowser\Parser();
221
- $result->setCache($pool);
222
- $result->analyse(getallheaders());
223
- ```
224
-
225
- You can also specify after how many seconds a cached result should be discarded. The default value is 900 seconds or 15 minutes. If you think WhichBrowser uses too much memory for caching, you should lower this value. You can do this by setting the `cacheExpires` option or passing it as a second parameter to the `setCache()` function.
226
-
227
-
228
- API reference
229
- -------------
230
-
231
- ### The Parser object
232
-
233
- After a new `WhichBrowser\Parser` object is created, it contains a number of properties and functions. All of these properties are guaranteed to be present.
234
-
235
- **Properties:**
236
-
237
- * `browser`
238
- an object that contains information about the browser itself
239
- * `engine`
240
- an object that contains information about the rendering engine
241
- * `os`
242
- an object that contains information about the operating system
243
- * `device`
244
- an object that contains information about the device
245
-
246
- **Functions:**
247
-
248
- `getType()`
249
- Returns the `type` and `subtype` property of the `device` object. If a subtype is present it is concatenated to the type and seperated by a semicolor, for example: `mobile:smart` or `gaming:portable`. If the subtype is not applicable, it just return the type, for example: `desktop` or `ereader`.
250
-
251
- `isType($type [,$type [,$type [,$type]]])`
252
- If a single argument is used, the function returns `true` if the argument matches the `type` propery of `device` object. The argument can optionally also provide a subtype by concatenating it to the type and seperating it with a semicolon. It can use multiple arguments in which case the function returns `true` if one of the arguments matches. If none of the arguments matches, it returns `false`
253
-
254
- `isMobile()`
255
- Return `true` if the browser is a mobile device, like a phone, tablet, ereader, camera, portable media player, watch or portable gaming console. Otherwise it returns `false`.
256
-
257
- `isBrowser($name [, $comparison, $version])`
258
- Is used to query the `name` and `version` property of the `browser` object. The funcion can contain a single argument to a simple comparison based on `name`, or three arguments to compare both `name` and `version`. The first argument always contains the name of the browser. The second arguments is a string that can container either `<`, `<=`, `=`, `=>` or `>`. The third is an integer, float or string that contains the version. You can use versions like `10`, `10.7` or `'10.7.4'`. For more information about how version comparisons are performed, please see the `is()` function of the `Version` object.
259
-
260
- `isEngine($name [, $comparison, $version])`
261
- Is used to query the `name` and `version` property of the `engine` object. This function works in exactly the same way as `isBrowser`.
262
-
263
- `isOs($name [, $comparison, $version])`
264
- Is used to query the `name` and `version` property of the `os` object. This function works in exactly the same way as `isBrowser`.
265
-
266
- `isDetected()`
267
- Is there actually some browser detected, for did we fail to detect anything?
268
-
269
- `toString()`
270
- Get a human readable representation of the detected browser, including operating system and device information.
271
-
272
-
273
- ### The browser object
274
-
275
- An object of the `WhichBrowser\Model\Browser` class is used for the `browser` property of the main `WhichBrowser\Parser` object and contains a number of properties. If a property is not applicable in this situation it will be null or undefined.
276
-
277
- **Properties:**
278
-
279
- * `name`
280
- a string containing the name of the browser
281
- * `alias`
282
- a string containing an alternative name of the browser
283
- * `version`
284
- a version object containing information about the version of the browser
285
- * `stock`
286
- a boolean, true if the browser is the default browser of the operating system, false otherwise
287
- * `channel`
288
- a string containing the distribution channel, ie. 'Nightly' or 'Next'.
289
- * `mode`
290
- a string that can contain the operating mode of the browser, ie. 'proxy'.
291
- * `hidden`
292
- a boolean that is true if the browser does not have a name and is the default of the operating system.
293
- * `family`
294
- an object that contains information about to which family this browser belongs
295
- * `using`
296
- an object that contains information about to which kind of webview this browser uses
297
-
298
- **Functions:**
299
-
300
- `isFamily($name)`
301
- Does the family of this browser have this name, or does the browser itself have this name.
302
-
303
- `isUsing($name)`
304
- Is the browser using a webview using with the provided name.
305
-
306
- `getName()`
307
- Get the name of the browser
308
-
309
- `getVersion()`
310
- Get the version of the browser
311
-
312
- `toString()`
313
- Get a human readable representation of the detected browser
314
-
315
-
316
- ### The engine object
317
-
318
- An object of the `WhichBrowser\Model\Engine` class is used for the `engine` property of the main `WhichBrowser\Parser` object and contains a number of properties. If a property is not applicable in this situation it will be null or undefined.
319
-
320
- **Properties:**
321
-
322
- * `name`
323
- a string containing the name of the rendering engine
324
- * `version`
325
- a version object containing information about the version of the rendering engine
326
-
327
- **Functions:**
328
-
329
- `getName()`
330
- Get the name of the rendering engine
331
-
332
- `getVersion()`
333
- Get the version of the rendering engine
334
-
335
- `toString()`
336
- Get a human readable representation of the detected rendering engine
337
-
338
-
339
- ### The os object
340
-
341
- An object of the `WhichBrowser\Model\Os` class is used for the `os` property of the main `WhichBrowser\Parser` object and contains a number of properties. If a property is not applicable in this situation it will be null or undefined.
342
-
343
- **Properties:**
344
-
345
- * `name`
346
- a string containing the name of the operating system
347
- * `version`
348
- a version object containing information about the version of the operating system
349
- * `family`
350
- an object that contains information about to which family this operating system belongs
351
-
352
- **Functions:**
353
-
354
- `isFamily($name)`
355
- Does the family of this operating system have this name, or does the operating system itself have this name.
356
-
357
- `getName()`
358
- Get the name of the operating system
359
-
360
- `getVersion()`
361
- Get the version of the operating system
362
-
363
- `toString()`
364
- Get a human readable representation of the detected operating system
365
-
366
-
367
- ### The device object
368
-
369
- An object of the `WhichBrowser\Model\Device` class is used for the `device` property of the main `WhichBrowser\Parser` object and contains a number of properties. If a property is not applicable in this situation it will be null or undefined.
370
-
371
- **Properties:**
372
-
373
- * `type`
374
- a string containing the type of the browser.
375
- * `subtype`
376
- a string containing the subtype of the browser.
377
- * `identified`
378
- a boolean that is true if the device has been positively identified.
379
- * `manufacturer`
380
- a string containing the manufacturer of the device, ie. 'Apple' or 'Samsung'.
381
- * `model`
382
- as string containing the model of the device, ie. 'iPhone' or 'Galaxy S4'.
383
-
384
- The `type` property can contain any value from the following list:
385
-
386
- * desktop
387
- * mobile
388
- * tablet
389
- * gaming
390
- * headset
391
- * ereader
392
- * media
393
- * emulator
394
- * television
395
- * monitor
396
- * camera
397
- * signage
398
- * whiteboard
399
- * car
400
- * pos
401
- * bot
402
-
403
- If the `type` is "mobile", the `subtype` property can contain any value from the following list:
404
-
405
- * feature
406
- * smart
407
-
408
- If the `type` is "gaming", the `subtype` property can contain any value from the following list:
409
-
410
- * console
411
- * portable
412
-
413
- **Functions:**
414
-
415
- `getManufacturer()`
416
- Get the name of the manufacturer
417
-
418
- `getModel()`
419
- Get the name of the model
420
-
421
- `toString()`
422
- Get a human readable representation of the detected device
423
-
424
-
425
- ### The family object
426
-
427
- An object of the `WhichBrowser\Model\Family` class is used for the `family` property of the `WhichBrowser\Model\Browser` and `WhichBrowser\Model\Os` object and contains a number of properties. If a property is not applicable in this situation it will be null or undefined.
428
-
429
- **Properties:**
430
-
431
- * `name`
432
- a string containing the name of the family
433
- * `version`
434
- a version object containing information about the version of the family
435
-
436
- **Functions:**
437
-
438
- `getName()`
439
- Get the name of the family
440
-
441
- `getVersion()`
442
- Get the version of the family
443
-
444
- `toString()`
445
- Get a human readable representation of the family
446
-
447
-
448
- ### The using object
449
-
450
- An object of the `WhichBrowser\Model\Using` class is used for the `using` property of the `WhichBrowser\Model\Browser` object and contains a number of properties. If a property is not applicable in this situation it will be null or undefined.
451
-
452
- **Properties:**
453
-
454
- * `name`
455
- a string containing the name of the webview
456
- * `version`
457
- a version object containing information about the version of the webview
458
-
459
- **Functions:**
460
-
461
- `getName()`
462
- Get the name of the webview
463
-
464
- `getVersion()`
465
- Get the version of the webview
466
-
467
- `toString()`
468
- Get a human readable representation of the webview
469
-
470
-
471
- ### The version object
472
-
473
- An object of the `WhichBrowser\Model\Version` class is used for the `version` property of the `browser`, `engine` and `os` object and contains a number of properties and functions. If a property is not applicable in this situation it will be null or undefined.
474
-
475
- **Properties:**
476
-
477
- * `value`
478
- a string containing the original version number.
479
- * `alias`
480
- a string containing an alias for the version number, ie. 'XP' for Windows '5.1'.
481
- * `details`
482
- an integer containing the number of digits of the version number that should be printed.
483
-
484
- **Functions:**
485
-
486
- `is($version)` or `is($comparison, $version)`
487
- Using this function it is easy to compare a version to another version. If you specify only one argument, this function will return if the versions are the same. You can also specify two arguments, in that case the first argument contains the comparison operator, such as `<`, `<=`, `=`, `=>` or `>`. The second argument is the version you want to compare it to. You can use versions like `10`, `10.7` or `'10.7.4'`, but be aware that `10` is not the same as `10.0`. For example if our OS version is `10.7.4`:
488
-
489
- ```php
490
- $result->os->version->is('10.7.4');
491
- // true
492
-
493
- $result->os->version->is('10.7');
494
- // true
495
-
496
- $result->os->version->is('10');
497
- // true
498
-
499
- $result->os->version->is('10.0');
500
- // false
501
-
502
- $result->os->version->is('>', '10');
503
- // false
504
-
505
- $result->os->version->is('>', '10.7');
506
- // false
507
-
508
- $result->os->version->is('>', '10.7.3');
509
- // true
510
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/whichbrowser/parser/composer.json DELETED
@@ -1,47 +0,0 @@
1
- {
2
- "name": "whichbrowser/parser",
3
-
4
- "description": "Useragent sniffing library for PHP",
5
- "keywords": ["useragent","browser","sniffing", "ua"],
6
- "homepage": "http://whichbrowser.net",
7
- "license": "MIT",
8
- "authors": [
9
- {
10
- "name": "Niels Leenheer",
11
- "email": "niels@leenheer.nl",
12
- "role": "Developer"
13
- }
14
- ],
15
-
16
- "require": {
17
- "php": ">=5.4.0",
18
- "psr/cache": "^1.0"
19
- },
20
-
21
- "autoload": {
22
- "psr-4": {
23
- "WhichBrowser\\": [ "src/", "tests/src/" ]
24
- }
25
- },
26
-
27
- "suggest": {
28
- "cache/array-adapter": "Allows testing of the caching functionality"
29
- },
30
-
31
- "require-dev": {
32
- "symfony/yaml": ">=2.8",
33
- "phpunit/php-code-coverage": "^2.2|^3.0",
34
- "phpunit/PHPUnit": "^4.0|^5.0",
35
- "satooshi/php-coveralls": "^1.0",
36
- "icomefromthenet/reverse-regex" : "0.0.6.3",
37
- "squizlabs/php_codesniffer": "2.5.*"
38
- },
39
-
40
- "autoload-dev": {
41
- "psr-4": {
42
- "WhichBrowserTest\\": "tests/unit"
43
- },
44
-
45
- "files": [ "tests/src/polyfills.php" ]
46
- }
47
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
license.txt ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ <one line to give the program's name and a brief idea of what it does.>
635
+ Copyright (C) <year> <name of author>
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ <program> Copyright (C) <year> <name of author>
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <http://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <http://www.gnu.org/philosophy/why-not-lgpl.html>.
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://wp-statistics.com/donate/
4
  Tags: analytics, wordpress analytics, stats, statistics, visit, visitors, hits, chart, browser, today, yesterday, week, month, year, total, post, page, sidebar, google, live visit, search word, agent, google analytics, webmasters, google webmasters, geoip, location
5
  Requires at least: 3.0
6
  Tested up to: 5.9
7
- Stable tag: 13.2.1
8
  Requires PHP: 5.6
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -12,7 +12,7 @@ License URI: http://www.gnu.org/licenses/gpl-3.0.html
12
  This plugin gives you the complete information on your website's visitors.
13
 
14
  == Description ==
15
- = WP statistics: THE #1 WORDPRESS STATISTICS PLUGIN =
16
  Do you need a simple tool to know your website statistics? Do you need to represent these statistics? Are you caring about your users’ privacy while analyzing who are interested in your business or website? With WP Statistics you can know your website statistics without any need to send your users’ data anywhere. You can know how many people visit your personal or business website, where they’re coming from, what browsers and search engines they use, and which of your contents, categories, tags and users get more visits.
17
 
18
  All these data are recorded in your server, and YES! WP Statistics is [GDPR compliant](http://bit.ly/2x0AFgT).
@@ -53,11 +53,11 @@ If you encounter any bug, please create an issue on [GitHub](https://github.com/
53
  The greatest advantage of WP Statistics is that all the data is saved locally in WordPress.
54
  This helps a lot while implementing the new GDPR restrictions; because it’s not necessary to create a data processing contract with an external company! [Read more about WP Statistics compliance with GDPR](http://bit.ly/2x0AFgT).
55
 
56
- = Does WP Statistics support Multisite? =
57
  WP Statistics doesn't officially support the multisite feature; however, it does have limited functionally associated with it and should function without any issue. However, no support is provided at this time.
58
  Version 8.8 is the first release that can be installed, upgraded and removed correctly on multi-site. It also has some basic support for the network admin menu. This should not be taken as an indication that WP Statistics fully supports the multisite, but only should be considered as a very first step.
59
 
60
- = Does WP Statistics work with caching plugins? =
61
  Yes, the cache support added in v12.5.1
62
 
63
  If you're using a plugin cache:
@@ -92,17 +92,22 @@ Search Engine Referrals and Words are highly dependent on the search engines pro
92
 
93
  = PHP 7 Support? =
94
  WP Statistics is PHP 7 compliant; however, some versions of PHP 7 have bugs that can cause issues. One known issue is that PHP 7.0.4 cause memory exhaustion errors. Newer versions of PHP 7 do not have this issue.
95
- At this time (September, 2018) WP Statistics seems to run fine with PHP 7.2.6. But you may experience issues that we haven’t found yet. If you do, feel free to report it after you make sure it is not a problem with PHP.
96
 
97
  = IPv6 Support? =
98
  WP Statistics supports IPv6 as of version 11.0; however, PHP must be compiled with IPv6 support enabled; otherwise you may see warnings when a visitor from an IPv6 address hits your site.
99
 
100
  You can check if IPv6 support is enabled in PHP by visiting the Optimization > Resources/Information->Version Info > PHP IPv6 Enabled section.
101
 
102
- If IPv6 is not enabled, you may see an warning like:
103
 
104
  Warning: inet_pton() [function.inet-pton]: Unrecognized address 2003:0006:1507:5d71:6114:d8bd:80c2:1090
105
 
 
 
 
 
 
106
  == Screenshots ==
107
  1. Overview
108
  2. Browsers Statistics
@@ -126,6 +131,11 @@ Before updating, make sure you disabled all your add-ons, then after that, try t
126
  If you encounter any bug, please create an issue on [GitHub](https://github.com/wp-statistics/wp-statistics/issues/new) where we can act upon them more efficiently. Since [GitHub](https://github.com/wp-statistics/wp-statistics) is not a support forum, just bugs are welcomed, and any other request will be closed.
127
 
128
  == Changelog ==
 
 
 
 
 
129
  = v13.2.1 - 25.04.2022 =
130
  * Bugfix: Compatibility with PHP version lower than v7.4
131
 
4
  Tags: analytics, wordpress analytics, stats, statistics, visit, visitors, hits, chart, browser, today, yesterday, week, month, year, total, post, page, sidebar, google, live visit, search word, agent, google analytics, webmasters, google webmasters, geoip, location
5
  Requires at least: 3.0
6
  Tested up to: 5.9
7
+ Stable tag: 13.2.2
8
  Requires PHP: 5.6
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
12
  This plugin gives you the complete information on your website's visitors.
13
 
14
  == Description ==
15
+ = WP-Statistics: THE #1 WORDPRESS STATISTICS PLUGIN =
16
  Do you need a simple tool to know your website statistics? Do you need to represent these statistics? Are you caring about your users’ privacy while analyzing who are interested in your business or website? With WP Statistics you can know your website statistics without any need to send your users’ data anywhere. You can know how many people visit your personal or business website, where they’re coming from, what browsers and search engines they use, and which of your contents, categories, tags and users get more visits.
17
 
18
  All these data are recorded in your server, and YES! WP Statistics is [GDPR compliant](http://bit.ly/2x0AFgT).
53
  The greatest advantage of WP Statistics is that all the data is saved locally in WordPress.
54
  This helps a lot while implementing the new GDPR restrictions; because it’s not necessary to create a data processing contract with an external company! [Read more about WP Statistics compliance with GDPR](http://bit.ly/2x0AFgT).
55
 
56
+ = Does WP-Statistics support Multisite? =
57
  WP Statistics doesn't officially support the multisite feature; however, it does have limited functionally associated with it and should function without any issue. However, no support is provided at this time.
58
  Version 8.8 is the first release that can be installed, upgraded and removed correctly on multi-site. It also has some basic support for the network admin menu. This should not be taken as an indication that WP Statistics fully supports the multisite, but only should be considered as a very first step.
59
 
60
+ = Does WP-Statistics work with caching plugins? =
61
  Yes, the cache support added in v12.5.1
62
 
63
  If you're using a plugin cache:
92
 
93
  = PHP 7 Support? =
94
  WP Statistics is PHP 7 compliant; however, some versions of PHP 7 have bugs that can cause issues. One known issue is that PHP 7.0.4 cause memory exhaustion errors. Newer versions of PHP 7 do not have this issue.
95
+ At this time (September 2018) WP Statistics seems to run fine with PHP 7.2.6. But you may experience issues that we haven’t found yet. If you do, feel free to report it after you make sure it is not a problem with PHP.
96
 
97
  = IPv6 Support? =
98
  WP Statistics supports IPv6 as of version 11.0; however, PHP must be compiled with IPv6 support enabled; otherwise you may see warnings when a visitor from an IPv6 address hits your site.
99
 
100
  You can check if IPv6 support is enabled in PHP by visiting the Optimization > Resources/Information->Version Info > PHP IPv6 Enabled section.
101
 
102
+ If IPv6 is not enabled, you may see a warning like:
103
 
104
  Warning: inet_pton() [function.inet-pton]: Unrecognized address 2003:0006:1507:5d71:6114:d8bd:80c2:1090
105
 
106
+ = What 3rd party services does the plugin use? =
107
+ IP location services are provided by data created by [MaxMind](https://www.maxmind.com/), to detect the Visitor's location (Country & City) the plugin downloads the GeoLite2 Database created by [MaxMind](https://www.maxmind.com/) on your server locally and use it.
108
+
109
+ Referrer spam blacklist is provided by Matomo, available from https://github.com/matomo-org/referrer-spam-blacklist
110
+
111
  == Screenshots ==
112
  1. Overview
113
  2. Browsers Statistics
131
  If you encounter any bug, please create an issue on [GitHub](https://github.com/wp-statistics/wp-statistics/issues/new) where we can act upon them more efficiently. Since [GitHub](https://github.com/wp-statistics/wp-statistics) is not a support forum, just bugs are welcomed, and any other request will be closed.
132
 
133
  == Changelog ==
134
+ = v13.2.2 - 08.05.2022 =
135
+ * Improvement: Downloading 3rd party services, the GeoIP & Referrer Spammer databases now is on [jsDelivr](https://www.jsdelivr.com/)
136
+ * Bugfix: Storing & sending HTML tags allowed for notification message body
137
+ * Bugfix: Hardened plugin security and improvement
138
+
139
  = v13.2.1 - 25.04.2022 =
140
  * Bugfix: Compatibility with PHP version lower than v7.4
141
 
wp-statistics.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WP Statistics
4
  * Plugin URI: https://wp-statistics.com/
5
  * Description: This plugin gives you the complete information on your website's visitors.
6
- * Version: 13.2.1
7
  * Author: VeronaLabs
8
  * Author URI: https://veronalabs.com/
9
  * Text Domain: wp-statistics
3
  * Plugin Name: WP Statistics
4
  * Plugin URI: https://wp-statistics.com/
5
  * Description: This plugin gives you the complete information on your website's visitors.
6
+ * Version: 13.2.2
7
  * Author: VeronaLabs
8
  * Author URI: https://veronalabs.com/
9
  * Text Domain: wp-statistics