Count per Day - Version 3.2.7

Version Description

  • Bugfix: GeoIP functionality
Download this release

Release Info

Developer Tom Braider
Plugin Icon 128x128 Count per Day
Version 3.2.7
Comparing to
See all releases

Code changes from version 3.2.6 to 3.2.7

Files changed (5) hide show
  1. counter-options.php +1 -1
  2. counter.php +10 -3
  3. geoip/GeoIP.dat +0 -0
  4. geoip/geoip.php +1 -1
  5. readme.txt +6 -3
counter-options.php CHANGED
@@ -632,7 +632,7 @@ switch($mode) {
632
  <?php } ?>
633
  <p>
634
  <span class="cpd-r"><?php _e('More informations about GeoIP', 'cpd') ?>:
635
- <a href="http://www.maxmind.com/app/geoip_country">www.maxmind.com</a></span>&nbsp;
636
  </p>
637
  </div>
638
  </div>
632
  <?php } ?>
633
  <p>
634
  <span class="cpd-r"><?php _e('More informations about GeoIP', 'cpd') ?>:
635
+ <a href="https://www.maxmind.com">www.maxmind.com</a></span>&nbsp;
636
  </p>
637
  </div>
638
  </div>
counter.php CHANGED
@@ -3,14 +3,14 @@
3
  Plugin Name: Count Per Day
4
  Plugin URI: http://www.tomsdimension.de/wp-plugins/count-per-day
5
  Description: Counter, shows reads and visitors per page; today, yesterday, last week, last months ... on dashboard, per shortcode or in widget.
6
- Version: 3.2.6
7
  License: Postcardware
8
  Author: Tom Braider
9
  Author URI: http://www.tomsdimension.de
10
  */
11
 
12
  $cpd_dir_name = 'count-per-day';
13
- $cpd_version = '3.2.6';
14
 
15
  if (strpos($_SERVER['SERVER_NAME'], '.test'))
16
  $cpd_path = str_replace('/', DIRECTORY_SEPARATOR, ABSPATH.PLUGINDIR.'/'.$cpd_dir_name.'/');
@@ -133,7 +133,14 @@ function count( $x, $page = 'x' )
133
  {
134
  // with GeoIP addon save country
135
  $gi = cpd_geoip_open($cpd_path.'geoip/GeoIP.dat', GEOIP_STANDARD);
136
- $country = strtolower(cpd_geoip_country_code_by_addr_v6($gi, $userip));
 
 
 
 
 
 
 
137
  $this->mysqlQuery('', $wpdb->prepare("INSERT INTO $wpdb->cpd_counter (page, ip, client, date, country, referer)
138
  VALUES (%s, $this->aton(%s), %s, %s, %s, %s)", $page, $userip, $client, $date, $country, $referer), 'count insert '.__LINE__);
139
  }
3
  Plugin Name: Count Per Day
4
  Plugin URI: http://www.tomsdimension.de/wp-plugins/count-per-day
5
  Description: Counter, shows reads and visitors per page; today, yesterday, last week, last months ... on dashboard, per shortcode or in widget.
6
+ Version: 3.2.7
7
  License: Postcardware
8
  Author: Tom Braider
9
  Author URI: http://www.tomsdimension.de
10
  */
11
 
12
  $cpd_dir_name = 'count-per-day';
13
+ $cpd_version = '3.2.7';
14
 
15
  if (strpos($_SERVER['SERVER_NAME'], '.test'))
16
  $cpd_path = str_replace('/', DIRECTORY_SEPARATOR, ABSPATH.PLUGINDIR.'/'.$cpd_dir_name.'/');
133
  {
134
  // with GeoIP addon save country
135
  $gi = cpd_geoip_open($cpd_path.'geoip/GeoIP.dat', GEOIP_STANDARD);
136
+ if ( strpos($userip,'.') !== false && strpos($userip,':') === false)
137
+ // IPv4
138
+ $country = strtolower(cpd_geoip_country_code_by_addr_v6($gi, '::'.$userip));
139
+ else
140
+ // IPv6
141
+ $country = strtolower(cpd_geoip_country_code_by_addr_v6($gi, $userip));
142
+ if (empty($country))
143
+ $country = '-';
144
  $this->mysqlQuery('', $wpdb->prepare("INSERT INTO $wpdb->cpd_counter (page, ip, client, date, country, referer)
145
  VALUES (%s, $this->aton(%s), %s, %s, %s, %s)", $page, $userip, $client, $date, $country, $referer), 'count insert '.__LINE__);
146
  }
geoip/GeoIP.dat CHANGED
Binary file
geoip/geoip.php CHANGED
@@ -22,7 +22,7 @@ function getCountry( $ip )
22
  global $cpd_path;
23
 
24
  // IPv4 > IPv6
25
- if( strpos($ip,'.') !== false )
26
  $ip = "::$ip";
27
 
28
  $gi = cpd_geoip_open($cpd_path.'/geoip/GeoIP.dat', GEOIP_STANDARD);
22
  global $cpd_path;
23
 
24
  // IPv4 > IPv6
25
+ if ( strpos($ip,'.') !== false && strpos($ip,':') === false)
26
  $ip = "::$ip";
27
 
28
  $gi = cpd_geoip_open($cpd_path.'/geoip/GeoIP.dat', GEOIP_STANDARD);
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Tom Braider
3
  Tags: counter, count, posts, visits, reads, dashboard, widget, shortcode
4
  Requires at least: 3.0
5
  Tested up to: 3.6
6
- Stable tag: 3.2.6
7
  License: Postcardware :)
8
  Donate link: http://www.tomsdimension.de/postcards
9
 
@@ -299,13 +299,16 @@ show( $before, $after, $show, $count, $page )'
299
  * On options page you can update you current visits. This take a while! The Script checks 100 IP addresses at once an reload itself until less then 100 addresses left. Click the update button to check the rest.
300
  * If the rest remains greater than 0 the IP address is not in GeoIP database (accuracy 99.5%).
301
  * You can update the GeoIP database from time to time to get new IP data. This necessitates write rights to geoip directory (e.g. chmod 777).
302
- * If the automatically update don't work download <a href="http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz">GeoIP.dat.gz</a> and extract it to the "geoip" directory.
303
- * More information about GeoIP on http://www.maxmind.com/app/geoip_country
304
 
305
 
306
 
307
  == Changelog ==
308
 
 
 
 
309
  = 3.2.6 =
310
  + New: posts only parameters for [CPD_MOST_VISITED_POSTS]
311
  + New: don't count password protected posts without password
3
  Tags: counter, count, posts, visits, reads, dashboard, widget, shortcode
4
  Requires at least: 3.0
5
  Tested up to: 3.6
6
+ Stable tag: 3.2.7
7
  License: Postcardware :)
8
  Donate link: http://www.tomsdimension.de/postcards
9
 
299
  * On options page you can update you current visits. This take a while! The Script checks 100 IP addresses at once an reload itself until less then 100 addresses left. Click the update button to check the rest.
300
  * If the rest remains greater than 0 the IP address is not in GeoIP database (accuracy 99.5%).
301
  * You can update the GeoIP database from time to time to get new IP data. This necessitates write rights to geoip directory (e.g. chmod 777).
302
+ * If the automatically update don't work download <a href="http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz">GeoIPv6.dat.gz</a>, extract and rename it to GeoIP.dat and load it to the "geoip" directory.
303
+ * More information about GeoIP on https://www.maxmind.com
304
 
305
 
306
 
307
  == Changelog ==
308
 
309
+ = 3.2.7 =
310
+ + Bugfix: GeoIP functionality
311
+
312
  = 3.2.6 =
313
  + New: posts only parameters for [CPD_MOST_VISITED_POSTS]
314
  + New: don't count password protected posts without password