Version Description
- FIX: Manual datasource filepath handling corrected.
- FIX: Potential incompability with BuddyPress removed.
Download this release
Release Info
Developer | benjamin4 |
Plugin | GeoIP Detection |
Version | 2.5.4 |
Comparing to | |
See all releases |
Code changes from version 2.5.3 to 2.5.4
- data-sources/auto.php +3 -3
- data-sources/hostinfo.php +3 -3
- data-sources/manual.php +30 -15
- data-sources/precision.php +11 -7
- geoip-detect.php +2 -2
- readme.txt +5 -0
- upgrade-plugin.php +1 -1
- views/footer.php +17 -0
- views/lookup.php +9 -8
- views/options.php +18 -29
data-sources/auto.php
CHANGED
@@ -9,9 +9,9 @@ define('GEOIP_DETECT_DATA_UPDATE_FILENAME', 'GeoLite2-City.mmdb');
|
|
9 |
class AutoDataSource extends ManualDataSource
|
10 |
{
|
11 |
public function getId() { return 'auto'; }
|
12 |
-
public function getLabel() { return 'Automatic download & update of Maxmind GeoIP Lite City'; }
|
13 |
-
public function getShortLabel() { return
|
14 |
-
public function getDescriptionHTML() { return '(License: Creative Commons Attribution-ShareAlike 3.0 Unported. See <a href="https://github.com/yellowtree/wp-geoip-detect/wiki/FAQ#the-maxmind-lite-databases-are-licensed-creative-commons-sharealike-attribution-when-do-i-need-to-give-attribution" target="_blank">Licensing FAQ</a> for more details.)'; }
|
15 |
|
16 |
public function getStatusInformationHTML() {
|
17 |
$html = parent::getStatusInformationHTML();
|
9 |
class AutoDataSource extends ManualDataSource
|
10 |
{
|
11 |
public function getId() { return 'auto'; }
|
12 |
+
public function getLabel() { return __('Automatic download & update of Maxmind GeoIP Lite City', 'geoip-detect'); }
|
13 |
+
public function getShortLabel() { return sprintf(__('%s (updated monthly)', 'geoip-detect'), parent::getShortLabel()); }
|
14 |
+
public function getDescriptionHTML() { return __('(License: Creative Commons Attribution-ShareAlike 3.0 Unported. See <a href="https://github.com/yellowtree/wp-geoip-detect/wiki/FAQ#the-maxmind-lite-databases-are-licensed-creative-commons-sharealike-attribution-when-do-i-need-to-give-attribution" target="_blank">Licensing FAQ</a> for more details.)', 'geoip-detect'); }
|
15 |
|
16 |
public function getStatusInformationHTML() {
|
17 |
$html = parent::getStatusInformationHTML();
|
data-sources/hostinfo.php
CHANGED
@@ -93,10 +93,10 @@ class Reader implements \YellowTree\GeoipDetect\DataSources\ReaderInterface {
|
|
93 |
|
94 |
class HostInfoDataSource extends AbstractDataSource {
|
95 |
public function getId() { return 'hostinfo'; }
|
96 |
-
public function getLabel() { return 'HostIP.info Web-API'; }
|
97 |
|
98 |
-
public function getDescriptionHTML() { return 'Free (Licence: GPL)<br />(only English names, does only have the following fields: country name, country ID and city name)'; }
|
99 |
-
public function getStatusInformationHTML() { return 'You can choose a Maxmind database below.'; }
|
100 |
public function getParameterHTML() { return ''; }
|
101 |
|
102 |
public function activate() { }
|
93 |
|
94 |
class HostInfoDataSource extends AbstractDataSource {
|
95 |
public function getId() { return 'hostinfo'; }
|
96 |
+
public function getLabel() { return __('HostIP.info Web-API', 'geoip-detect'); }
|
97 |
|
98 |
+
public function getDescriptionHTML() { return __('Free (Licence: GPL)<br />(only English names, does only have the following fields: country name, country ID and city name)', 'geoip-detect'); }
|
99 |
+
public function getStatusInformationHTML() { return __('You can choose a Maxmind database below.', 'geoip-detect'); }
|
100 |
public function getParameterHTML() { return ''; }
|
101 |
|
102 |
public function activate() { }
|
data-sources/manual.php
CHANGED
@@ -9,16 +9,16 @@ define('GEOIP_DETECT_DATA_FILENAME', 'GeoLite2-City.mmdb');
|
|
9 |
class ManualDataSource extends AbstractDataSource {
|
10 |
|
11 |
public function getId() { return 'manual'; }
|
12 |
-
public function getLabel() { return 'Manual download & update of a Maxmind City or Country database'; }
|
13 |
|
14 |
-
public function getDescriptionHTML() { return '<a href="http://dev.maxmind.com/geoip/geoip2/geolite2/" target="_blank">Free version</a> - <a href="https://www.maxmind.com/en/geoip2-country-database" target="_blank">Commercial Version</a>'; }
|
15 |
public function getStatusInformationHTML() {
|
16 |
$built = $last_update = 0;
|
17 |
$date_format = get_option('date_format') . ' ' . get_option('time_format');
|
18 |
$file = $this->maxmindGetFilename();
|
19 |
|
20 |
if (!$file)
|
21 |
-
return '<b>No Maxmind database found
|
22 |
|
23 |
$relative_file = geoip_detect_get_relative_path(ABSPATH, $file);
|
24 |
|
@@ -40,9 +40,20 @@ class ManualDataSource extends AbstractDataSource {
|
|
40 |
}
|
41 |
|
42 |
public function getParameterHTML() {
|
43 |
-
$manual_file = get_option('geoip-detect-manual_file');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
$html = <<<HTML
|
45 |
-
Filepath to mmdb-file: <input type="text" size="40" name="options_manual[manual_file]" value="$manual_file"
|
|
|
|
|
46 |
HTML;
|
47 |
|
48 |
return $html;
|
@@ -51,12 +62,15 @@ HTML;
|
|
51 |
public function saveParameters($post) {
|
52 |
$message = '';
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
update_option('geoip-detect-
|
57 |
-
|
58 |
-
|
|
|
59 |
$message .= __('The manual datafile has not been found or is not a mmdb-File. ', 'geoip-detect');
|
|
|
|
|
60 |
}
|
61 |
}
|
62 |
|
@@ -74,7 +88,7 @@ HTML;
|
|
74 |
$reader = new \GeoIp2\Database\Reader ( $data_file, $locales );
|
75 |
} catch ( \Exception $e ) {
|
76 |
if (WP_DEBUG)
|
77 |
-
echo 'Error while creating reader for "
|
78 |
}
|
79 |
}
|
80 |
|
@@ -107,6 +121,7 @@ HTML;
|
|
107 |
}
|
108 |
|
109 |
public static function maxmindValidateFilename($filename) {
|
|
|
110 |
if (file_exists(ABSPATH . $filename))
|
111 |
$filename = ABSPATH . $filename;
|
112 |
|
@@ -114,12 +129,12 @@ HTML;
|
|
114 |
return '';
|
115 |
|
116 |
try {
|
117 |
-
$reader = new \GeoIp2\Database\Reader
|
118 |
$metadata = $reader->metadata();
|
119 |
$reader->close();
|
120 |
} catch ( \Exception $e ) {
|
121 |
if (WP_DEBUG)
|
122 |
-
echo 'Error while creating reader for "
|
123 |
return '';
|
124 |
}
|
125 |
|
@@ -130,14 +145,14 @@ HTML;
|
|
130 |
$reader = $this->getReader();
|
131 |
|
132 |
if (!method_exists($reader, 'metadata'))
|
133 |
-
return '
|
134 |
|
135 |
try {
|
136 |
$metadata = $reader->metadata();
|
137 |
$desc = $metadata->description;
|
138 |
return $desc['en'];
|
139 |
} catch (\Exception $e) {
|
140 |
-
return '
|
141 |
}
|
142 |
}
|
143 |
}
|
9 |
class ManualDataSource extends AbstractDataSource {
|
10 |
|
11 |
public function getId() { return 'manual'; }
|
12 |
+
public function getLabel() { return __('Manual download & update of a Maxmind City or Country database', 'geoip-detect'); }
|
13 |
|
14 |
+
public function getDescriptionHTML() { return __('<a href="http://dev.maxmind.com/geoip/geoip2/geolite2/" target="_blank">Free version</a> - <a href="https://www.maxmind.com/en/geoip2-country-database" target="_blank">Commercial Version</a>', 'geoip-detect'); }
|
15 |
public function getStatusInformationHTML() {
|
16 |
$built = $last_update = 0;
|
17 |
$date_format = get_option('date_format') . ' ' . get_option('time_format');
|
18 |
$file = $this->maxmindGetFilename();
|
19 |
|
20 |
if (!$file)
|
21 |
+
return '<b>' . __('No Maxmind database found.', 'geoip-detect') . '</b>';
|
22 |
|
23 |
$relative_file = geoip_detect_get_relative_path(ABSPATH, $file);
|
24 |
|
40 |
}
|
41 |
|
42 |
public function getParameterHTML() {
|
43 |
+
$manual_file = esc_attr(get_option('geoip-detect-manual_file'));
|
44 |
+
$current_value = '';
|
45 |
+
|
46 |
+
if ( get_option('geoip-detect-manual_file_validated') &&
|
47 |
+
get_option('geoip-detect-manual_file') != get_option('geoip-detect-manual_file_validated') &&
|
48 |
+
ABSPATH . get_option('geoip-detect-manual_file') != get_option('geoip-detect-manual_file_validated')
|
49 |
+
) {
|
50 |
+
$current_value = '<br >' . sprintf(__('Current value: %s', 'geoip-detect'), get_option('geoip-detect-manual_file_validated'));
|
51 |
+
}
|
52 |
+
|
53 |
$html = <<<HTML
|
54 |
+
<p>Filepath to mmdb-file: <input type="text" size="40" name="options_manual[manual_file]" value="$manual_file" /></p>
|
55 |
+
<span class="detail-box">e.g. wp-content/uploads/GeoLite2-Country.mmdb or absolute filepath$current_value</span>
|
56 |
+
<br />
|
57 |
HTML;
|
58 |
|
59 |
return $html;
|
62 |
public function saveParameters($post) {
|
63 |
$message = '';
|
64 |
|
65 |
+
$file = @$post['options_manual']['manual_file'];
|
66 |
+
if (!empty($file)) {
|
67 |
+
update_option('geoip-detect-manual_file', $file);
|
68 |
+
|
69 |
+
$validated_filename = self::maxmindValidateFilename($file);
|
70 |
+
if (empty($validated_filename)) {
|
71 |
$message .= __('The manual datafile has not been found or is not a mmdb-File. ', 'geoip-detect');
|
72 |
+
} else {
|
73 |
+
update_option('geoip-detect-manual_file_validated', $validated_filename);
|
74 |
}
|
75 |
}
|
76 |
|
88 |
$reader = new \GeoIp2\Database\Reader ( $data_file, $locales );
|
89 |
} catch ( \Exception $e ) {
|
90 |
if (WP_DEBUG)
|
91 |
+
echo printf(__('Error while creating reader for "%s": %s', 'geoip-detect'), $filename, $e->getMessage ());
|
92 |
}
|
93 |
}
|
94 |
|
121 |
}
|
122 |
|
123 |
public static function maxmindValidateFilename($filename) {
|
124 |
+
// Maybe make path absolute
|
125 |
if (file_exists(ABSPATH . $filename))
|
126 |
$filename = ABSPATH . $filename;
|
127 |
|
129 |
return '';
|
130 |
|
131 |
try {
|
132 |
+
$reader = new \GeoIp2\Database\Reader($filename);
|
133 |
$metadata = $reader->metadata();
|
134 |
$reader->close();
|
135 |
} catch ( \Exception $e ) {
|
136 |
if (WP_DEBUG)
|
137 |
+
echo printf(__('Error while creating reader for "%s": %s', 'geoip-detect'), $filename, $e->getMessage ());
|
138 |
return '';
|
139 |
}
|
140 |
|
145 |
$reader = $this->getReader();
|
146 |
|
147 |
if (!method_exists($reader, 'metadata'))
|
148 |
+
return __('Maxmind File Database (file does not exist or is not readable)', 'geoip-detect');
|
149 |
|
150 |
try {
|
151 |
$metadata = $reader->metadata();
|
152 |
$desc = $metadata->description;
|
153 |
return $desc['en'];
|
154 |
} catch (\Exception $e) {
|
155 |
+
return __('Maxmind File Database (file does not exist or is not readable)', 'geoip-detect');
|
156 |
}
|
157 |
}
|
158 |
}
|
data-sources/precision.php
CHANGED
@@ -61,16 +61,16 @@ class PrecisionDataSource extends AbstractDataSource {
|
|
61 |
}
|
62 |
|
63 |
public function getId() { return 'precision'; }
|
64 |
-
public function getLabel() { return 'Maxmind Precision Web-API'; }
|
65 |
|
66 |
-
public function getDescriptionHTML() { return '<a href="https://www.maxmind.com/en/geoip2-precision-services">Maxmind Precision Services</a>'; }
|
67 |
public function getStatusInformationHTML() {
|
68 |
$html = '';
|
69 |
-
$html .= 'API Type: '
|
70 |
|
71 |
$remaining = get_option('geoip-detect-precision-remaining_credits');
|
72 |
if ($remaining !== false) {
|
73 |
-
$html .= 'Remaining Credits: ca. '
|
74 |
}
|
75 |
|
76 |
if (!$this->isWorking())
|
@@ -84,10 +84,14 @@ class PrecisionDataSource extends AbstractDataSource {
|
|
84 |
$user_secret = esc_attr(get_option('geoip-detect-precision-user_secret'));
|
85 |
$current_api_type = get_option('geoip-detect-precision_api_type');
|
86 |
|
|
|
|
|
|
|
|
|
87 |
$html = <<<HTML
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
HTML;
|
92 |
|
93 |
foreach ($this->known_api_types as $name => $api_type) {
|
61 |
}
|
62 |
|
63 |
public function getId() { return 'precision'; }
|
64 |
+
public function getLabel() { return __('Maxmind Precision Web-API', 'geoip-detect'); }
|
65 |
|
66 |
+
public function getDescriptionHTML() { return __('<a href="https://www.maxmind.com/en/geoip2-precision-services">Maxmind Precision Services</a>', 'geoip-detect'); }
|
67 |
public function getStatusInformationHTML() {
|
68 |
$html = '';
|
69 |
+
$html .= sprintf(__('API Type: %s', 'geoip-detect'), ucfirst(get_option('geoip-detect-precision_api_type', 'city'))) . '<br />';
|
70 |
|
71 |
$remaining = get_option('geoip-detect-precision-remaining_credits');
|
72 |
if ($remaining !== false) {
|
73 |
+
$html .= sprintf(__('Remaining Credits: ca. %s', 'geoip-detect'), $remaining) . '<br />';
|
74 |
}
|
75 |
|
76 |
if (!$this->isWorking())
|
84 |
$user_secret = esc_attr(get_option('geoip-detect-precision-user_secret'));
|
85 |
$current_api_type = get_option('geoip-detect-precision_api_type');
|
86 |
|
87 |
+
$label_user_id = __('User ID:', 'geoip-detect');
|
88 |
+
$label_user_secret = __('User Secret:', 'geoip-detect');
|
89 |
+
$label_api_type = __('API Type:', 'geoip-detect');
|
90 |
+
|
91 |
$html = <<<HTML
|
92 |
+
$label_user_id <input type="text" size="10" name="options_precision[user_id]" value="$user_id" /><br />
|
93 |
+
$label_user_secret <input type="text" autocomplete="off" size="20" name="options_precision[user_secret]" value="$user_secret" /><br />
|
94 |
+
$label_api_type <select name="options_precision[api_type]">
|
95 |
HTML;
|
96 |
|
97 |
foreach ($this->known_api_types as $name => $api_type) {
|
geoip-detect.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.yellowtree.de
|
|
5 |
Description: Retrieving Geo-Information using the Maxmind GeoIP (Lite) Database.
|
6 |
Author: Yellow Tree (Benjamin Pick)
|
7 |
Author URI: http://www.yellowtree.de
|
8 |
-
Version: 2.5.
|
9 |
License: GPLv3 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
Text Domain: geoip-detect
|
@@ -16,7 +16,7 @@ Requires WP: 3.5
|
|
16 |
Requires PHP: 5.3.1
|
17 |
*/
|
18 |
|
19 |
-
define('GEOIP_DETECT_VERSION', '2.5.
|
20 |
|
21 |
/*
|
22 |
Copyright 2013-2015 Yellow Tree, Siegen, Germany
|
5 |
Description: Retrieving Geo-Information using the Maxmind GeoIP (Lite) Database.
|
6 |
Author: Yellow Tree (Benjamin Pick)
|
7 |
Author URI: http://www.yellowtree.de
|
8 |
+
Version: 2.5.4
|
9 |
License: GPLv3 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
Text Domain: geoip-detect
|
16 |
Requires PHP: 5.3.1
|
17 |
*/
|
18 |
|
19 |
+
define('GEOIP_DETECT_VERSION', '2.5.4');
|
20 |
|
21 |
/*
|
22 |
Copyright 2013-2015 Yellow Tree, Siegen, Germany
|
readme.txt
CHANGED
@@ -147,6 +147,11 @@ Fixing automatic weekly updates.
|
|
147 |
|
148 |
== Changelog ==
|
149 |
|
|
|
|
|
|
|
|
|
|
|
150 |
= 2.5.3 =
|
151 |
|
152 |
* FIX: (Security) Add nonces to backend to avoid CSRF (thanks to Gerard Arall).
|
147 |
|
148 |
== Changelog ==
|
149 |
|
150 |
+
= 2.5.4 =
|
151 |
+
|
152 |
+
* FIX: Manual datasource filepath handling corrected.
|
153 |
+
* FIX: Potential incompability with BuddyPress removed.
|
154 |
+
|
155 |
= 2.5.3 =
|
156 |
|
157 |
* FIX: (Security) Add nonces to backend to avoid CSRF (thanks to Gerard Arall).
|
upgrade-plugin.php
CHANGED
@@ -43,7 +43,7 @@ function geoip_detect_do_upgrade($old_version) {
|
|
43 |
* @param string $version The version to which the plugin is updating.
|
44 |
*/
|
45 |
function geoip_detect_maybe_upgrade_version( ) {
|
46 |
-
if (
|
47 |
return;
|
48 |
|
49 |
$version = GEOIP_DETECT_VERSION;
|
43 |
* @param string $version The version to which the plugin is updating.
|
44 |
*/
|
45 |
function geoip_detect_maybe_upgrade_version( ) {
|
46 |
+
if (!is_admin())
|
47 |
return;
|
48 |
|
49 |
$version = GEOIP_DETECT_VERSION;
|
views/footer.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<br><br>
|
2 |
+
<p class="legal_notices">
|
3 |
+
<br />
|
4 |
+
<?php printf(__('This extension is "charity-ware". You can use it for free but if you want to do me a favor, please <a href="%s" target="_blank">donate</a> to <a href="%s" target="_blank">this charity</a>. (See <a href="%s" target="_blank">FAQ</a> for more infos.)', 'geoip-detect'),
|
5 |
+
'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BSYUZHS8FH3CL',
|
6 |
+
'http://www.jmem-hainichen.de/homepage',
|
7 |
+
'https://github.com/yellowtree/wp-geoip-detect/wiki/FAQ#what-you-mean-by-this-plugin-is-charity-ware'); ?>
|
8 |
+
</p>
|
9 |
+
<p class="legal_notices">
|
10 |
+
<?php _e('This product includes GeoLite2 data created by MaxMind, available from <a href="http://www.maxmind.com/">http://www.maxmind.com</a>.', 'geoip-detect'); ?>
|
11 |
+
</p>
|
12 |
+
<style>
|
13 |
+
.legal_notices {
|
14 |
+
font-size: 80%;
|
15 |
+
font-style: italic;
|
16 |
+
}
|
17 |
+
</style>
|
views/lookup.php
CHANGED
@@ -16,7 +16,7 @@ if ($shortcode_options) {
|
|
16 |
}
|
17 |
?>
|
18 |
<div class="wrap">
|
19 |
-
<
|
20 |
<a href="options-general.php?page=<?php echo GEOIP_PLUGIN_BASENAME ?>">Options</a>
|
21 |
|
22 |
<p>
|
@@ -29,17 +29,18 @@ if ($shortcode_options) {
|
|
29 |
<br />
|
30 |
</p>
|
31 |
|
|
|
32 |
<form method="post" action="#">
|
33 |
<?php wp_nonce_field( 'geoip_detect_lookup' ); ?>
|
34 |
<input type="hidden" name="action" value="lookup" />
|
35 |
-
IP
|
36 |
-
<label
|
37 |
<select name="locales">
|
38 |
-
<option value="" <?php if (empty($_POST['locales'])) echo 'selected="selected"'
|
39 |
-
<option value="en" <?php if (!empty($_POST['locales']) && $_POST['locales'] == 'en') echo 'selected="selected"'
|
40 |
-
<option value="fr,en" <?php if (!empty($_POST['locales']) && $_POST['locales'] == 'fr,en') echo 'selected="selected"'
|
41 |
</select> </label><br />
|
42 |
-
<label><input type="checkbox" name="skip_cache" value="1" <?php if (!empty($_POST['skip_cache'])) echo 'checked="checked"'
|
43 |
<br />
|
44 |
<input type="submit" class="button button-secondary" value="<?php _e('Lookup', 'geoip-detect'); ?>" />
|
45 |
</form>
|
@@ -126,7 +127,7 @@ if ($shortcode_options) {
|
|
126 |
<p>
|
127 |
<?php printf(__('See %s for more documentation.', 'geoip-detect'), '<a href="http://dev.maxmind.com/geoip/geoip2/web-services/" target="_blank">http://dev.maxmind.com/geoip/geoip2/web-services/</a>');?>
|
128 |
</p>
|
129 |
-
|
130 |
</div>
|
131 |
<style>
|
132 |
.geoip_detect_error {
|
16 |
}
|
17 |
?>
|
18 |
<div class="wrap">
|
19 |
+
<h1><?php _e('GeoIP Detection', 'geoip-detect');?></h1>
|
20 |
<a href="options-general.php?page=<?php echo GEOIP_PLUGIN_BASENAME ?>">Options</a>
|
21 |
|
22 |
<p>
|
29 |
<br />
|
30 |
</p>
|
31 |
|
32 |
+
<h2>Test Lookup</h2>
|
33 |
<form method="post" action="#">
|
34 |
<?php wp_nonce_field( 'geoip_detect_lookup' ); ?>
|
35 |
<input type="hidden" name="action" value="lookup" />
|
36 |
+
<?php _e('IP', 'geoip-detect')?>: <input type="text" placeholder="<?php _e('Enter an IP (v4 or v6)', 'geoip-detect')?>" name="ip" value="<?php echo isset($_REQUEST['ip']) ? esc_attr($_REQUEST['ip']) : esc_attr(geoip_detect2_get_client_ip()); ?>" /><br />
|
37 |
+
<label><?php _e('Use these locales:', 'geoip-detect'); ?>
|
38 |
<select name="locales">
|
39 |
+
<option value="" <?php if (empty($_POST['locales'])) echo 'selected="selected"'?>><?php _e('Default (Current site language, English otherwise)', 'geoip-detect')?></option>
|
40 |
+
<option value="en" <?php if (!empty($_POST['locales']) && $_POST['locales'] == 'en') echo 'selected="selected"'?>><?php _e('English only', 'geoip-detect')?></option>
|
41 |
+
<option value="fr,en" <?php if (!empty($_POST['locales']) && $_POST['locales'] == 'fr,en') echo 'selected="selected"'?>><?php _e('French, English otherwise', 'geoip-detect')?></option>
|
42 |
</select> </label><br />
|
43 |
+
<label><input type="checkbox" name="skip_cache" value="1" <?php if (!empty($_POST['skip_cache'])) echo 'checked="checked"'?>/><?php _e('Skip cache', 'geoip-detect')?></label><br />
|
44 |
<br />
|
45 |
<input type="submit" class="button button-secondary" value="<?php _e('Lookup', 'geoip-detect'); ?>" />
|
46 |
</form>
|
127 |
<p>
|
128 |
<?php printf(__('See %s for more documentation.', 'geoip-detect'), '<a href="http://dev.maxmind.com/geoip/geoip2/web-services/" target="_blank">http://dev.maxmind.com/geoip/geoip2/web-services/</a>');?>
|
129 |
</p>
|
130 |
+
<?php require(GEOIP_PLUGIN_DIR . '/views/footer.php'); ?>
|
131 |
</div>
|
132 |
<style>
|
133 |
.geoip_detect_error {
|
views/options.php
CHANGED
@@ -3,8 +3,8 @@ $options = $currentSource->getParameterHTML();
|
|
3 |
?>
|
4 |
|
5 |
<div class="wrap">
|
6 |
-
<
|
7 |
-
<p><a href="tools.php?page=<?php echo GEOIP_PLUGIN_BASENAME ?>"
|
8 |
<?php if (!empty($message)): ?>
|
9 |
<p class="geoip_detect_error">
|
10 |
<?php echo $message; ?>
|
@@ -18,7 +18,7 @@ $options = $currentSource->getParameterHTML();
|
|
18 |
<?php echo $currentSource->getStatusInformationHTML(); ?>
|
19 |
</p>
|
20 |
<?php if ($options) : ?>
|
21 |
-
<
|
22 |
<p>
|
23 |
<form method="post" action="#">
|
24 |
<input type="hidden" name="action" value="options-source" />
|
@@ -36,7 +36,7 @@ $options = $currentSource->getParameterHTML();
|
|
36 |
<form method="post" action="#">
|
37 |
<input type="hidden" name="action" value="choose" />
|
38 |
<?php wp_nonce_field( 'geoip_detect_choose' ); ?>
|
39 |
-
<
|
40 |
<a href="https://github.com/yellowtree/wp-geoip-detect/wiki/FAQ#which-data-source-should-i-choose">Help</a>
|
41 |
<?php foreach ($sources as $s) : $id = $s->getId();?>
|
42 |
<p><input type="radio" name="options[source]" value="<?php echo $id ?>" <?php if ($currentSource->getId() == $id) { echo 'checked="checked"'; } ?> /><?php echo $s->getLabel(); ?></p>
|
@@ -50,42 +50,40 @@ $options = $currentSource->getParameterHTML();
|
|
50 |
<form method="post" action="#">
|
51 |
<input type="hidden" name="action" value="options" />
|
52 |
<?php wp_nonce_field( 'geoip_detect_options' ); ?>
|
53 |
-
<h3
|
54 |
<p>
|
55 |
<input type="checkbox" name="options[set_css_country]" value="1" <?php if (!empty($wp_options['set_css_country'])) { echo 'checked="checked"'; } ?>> <?php _e('Add a country-specific CSS class to the <body>-Tag.', 'geoip-detect'); ?><br />
|
56 |
</p>
|
57 |
<p>
|
58 |
<input type="checkbox" name="options[disable_pagecache]" value="1" <?php if (!empty($wp_options['disable_pagecache'])) { echo 'checked="checked"'; } ?>> <?php _e('Disable caching a page that contains a shortcode or API call to geo-dependent functions.', 'geoip-detect'); ?><br />
|
59 |
<span class="detail-box">
|
60 |
-
At least WP SuperCache, W3TotalCache and ZenCache are supported.
|
61 |
</span>
|
62 |
<?php if (!empty($wp_options['set_css_country']) && !empty($wp_options['disable_pagecache'])): ?>
|
63 |
-
<span class="geoip_detect_error"
|
64 |
<?php endif; ?>
|
65 |
</p>
|
66 |
|
67 |
<p>
|
68 |
-
<input type="checkbox" name="options[has_reverse_proxy]" value="1" <?php if (!empty($wp_options['has_reverse_proxy'])) { echo 'checked="checked"'; } ?>> 
|
69 |
<span class="detail-box">
|
70 |
<?php if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) : ?>
|
71 |
<?php printf(__('(With Proxy: %s - Without Proxy: %s - Client IP with current configuration: %s)', 'geoip-detect'), $_SERVER['HTTP_X_FORWARDED_FOR'], $_SERVER['REMOTE_ADDR'], geoip_detect2_get_client_ip()); ?><br />
|
72 |
<?php else: ?>
|
73 |
-
<?php echo "(This doesn't seem to be the case.)"; ?>
|
74 |
<?php endif; ?>
|
75 |
</em>
|
76 |
</span>
|
77 |
</p>
|
78 |
<p>
|
79 |
-
External IP of this server: <input type="text" name="options[external_ip]" value="<?php echo esc_attr($wp_options['external_ip']); ?>" placeholder="
|
80 |
<span class="detail-box">
|
81 |
-
Current value: <?php echo geoip_detect2_get_external_ip_adress(); ?><br />
|
82 |
-
If empty: Try to use an ip service to detect it (Internet connection is necessary). If this is not possible, 0.0.0.0 will be returned
|
83 |
-
(This external adress will be used when the request IP adress is not a public IP, e.g. 127.0.0.1)
|
84 |
-
|
85 |
</span>
|
86 |
</p>
|
87 |
|
88 |
-
|
89 |
|
90 |
<p>
|
91 |
<input type="submit" class="button button-primary" value="<?php _e('Save', 'geoip-detect'); ?>" />
|
@@ -93,19 +91,13 @@ $options = $currentSource->getParameterHTML();
|
|
93 |
</form>
|
94 |
<?php if (!$ipv6_supported) : ?>
|
95 |
<div class="geoip_detect_error">
|
96 |
-
<
|
97 |
<p>
|
98 |
-
Your version of PHP is compiled without IPv6-support, so it is not possible to lookup adresses like "2001:4860:4801:5::91". For more information see <a href="https://php.net/manual/en/function.inet-pton.php">PHP documentation & user comments</a>.
|
99 |
</p>
|
100 |
</div>
|
101 |
<?php endif; ?>
|
102 |
-
|
103 |
-
<br />
|
104 |
-
This extension is "charity-ware". You can use it for free but if you want to do me a favor, please <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BSYUZHS8FH3CL" target="_blank">donate</a> to <a href="http://www.jmem-hainichen.de/homepage" target="_blank">this charity</a>. (See <a href="https://github.com/yellowtree/wp-geoip-detect/wiki/FAQ#what-you-mean-by-this-plugin-is-charity-ware" target="_blank">FAQ</a> for more infos.)
|
105 |
-
</p>
|
106 |
-
<p class="legal_notices">
|
107 |
-
This product includes GeoLite2 data created by MaxMind, available from <a href="http://www.maxmind.com/">http://www.maxmind.com</a>.
|
108 |
-
</p>
|
109 |
</div>
|
110 |
<style>
|
111 |
.geoip_detect_error {
|
@@ -132,8 +124,5 @@ $options = $currentSource->getParameterHTML();
|
|
132 |
margin-left: 50px;
|
133 |
color: #777;
|
134 |
}
|
135 |
-
|
136 |
-
|
137 |
-
font-style: italic;
|
138 |
-
}
|
139 |
-
</style>
|
3 |
?>
|
4 |
|
5 |
<div class="wrap">
|
6 |
+
<h1><?php _e('GeoIP Detection', 'geoip-detect');?></h1>
|
7 |
+
<p><a href="tools.php?page=<?php echo GEOIP_PLUGIN_BASENAME ?>"><?php _e('Test IP Detection Lookup', 'geoip-detect')?></a></p>
|
8 |
<?php if (!empty($message)): ?>
|
9 |
<p class="geoip_detect_error">
|
10 |
<?php echo $message; ?>
|
18 |
<?php echo $currentSource->getStatusInformationHTML(); ?>
|
19 |
</p>
|
20 |
<?php if ($options) : ?>
|
21 |
+
<h2><?php _e('Options for this data source', 'geoip-detect'); ?></h2>
|
22 |
<p>
|
23 |
<form method="post" action="#">
|
24 |
<input type="hidden" name="action" value="options-source" />
|
36 |
<form method="post" action="#">
|
37 |
<input type="hidden" name="action" value="choose" />
|
38 |
<?php wp_nonce_field( 'geoip_detect_choose' ); ?>
|
39 |
+
<h2><?php _e('Choose data source:', 'geoip-detect'); ?></h2>
|
40 |
<a href="https://github.com/yellowtree/wp-geoip-detect/wiki/FAQ#which-data-source-should-i-choose">Help</a>
|
41 |
<?php foreach ($sources as $s) : $id = $s->getId();?>
|
42 |
<p><input type="radio" name="options[source]" value="<?php echo $id ?>" <?php if ($currentSource->getId() == $id) { echo 'checked="checked"'; } ?> /><?php echo $s->getLabel(); ?></p>
|
50 |
<form method="post" action="#">
|
51 |
<input type="hidden" name="action" value="options" />
|
52 |
<?php wp_nonce_field( 'geoip_detect_options' ); ?>
|
53 |
+
<h3><?php _e('General Options', 'geoip-detect'); ?></h3>
|
54 |
<p>
|
55 |
<input type="checkbox" name="options[set_css_country]" value="1" <?php if (!empty($wp_options['set_css_country'])) { echo 'checked="checked"'; } ?>> <?php _e('Add a country-specific CSS class to the <body>-Tag.', 'geoip-detect'); ?><br />
|
56 |
</p>
|
57 |
<p>
|
58 |
<input type="checkbox" name="options[disable_pagecache]" value="1" <?php if (!empty($wp_options['disable_pagecache'])) { echo 'checked="checked"'; } ?>> <?php _e('Disable caching a page that contains a shortcode or API call to geo-dependent functions.', 'geoip-detect'); ?><br />
|
59 |
<span class="detail-box">
|
60 |
+
<?php _e('At least WP SuperCache, W3TotalCache and ZenCache are supported.', 'geoip-detect'); ?>
|
61 |
</span>
|
62 |
<?php if (!empty($wp_options['set_css_country']) && !empty($wp_options['disable_pagecache'])): ?>
|
63 |
+
<span class="geoip_detect_error"><?php _e('Warning: As the CSS option above is active, this means that all pages are not cached.', 'geoip-detect'); ?></span>
|
64 |
<?php endif; ?>
|
65 |
</p>
|
66 |
|
67 |
<p>
|
68 |
+
<input type="checkbox" name="options[has_reverse_proxy]" value="1" <?php if (!empty($wp_options['has_reverse_proxy'])) { echo 'checked="checked"'; } ?>> <?php _e('The server is behind a reverse proxy', 'geoip-detect')?><em>
|
69 |
<span class="detail-box">
|
70 |
<?php if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) : ?>
|
71 |
<?php printf(__('(With Proxy: %s - Without Proxy: %s - Client IP with current configuration: %s)', 'geoip-detect'), $_SERVER['HTTP_X_FORWARDED_FOR'], $_SERVER['REMOTE_ADDR'], geoip_detect2_get_client_ip()); ?><br />
|
72 |
<?php else: ?>
|
73 |
+
<?php echo __("(This doesn't seem to be the case.)", 'geoip-detect'); ?>
|
74 |
<?php endif; ?>
|
75 |
</em>
|
76 |
</span>
|
77 |
</p>
|
78 |
<p>
|
79 |
+
<?php _e('External IP of this server:', 'geoip-detect'); ?> <input type="text" name="options[external_ip]" value="<?php echo esc_attr($wp_options['external_ip']); ?>" placeholder="<?php _e('detect automatically', 'geoip-detect'); ?>" />
|
80 |
<span class="detail-box">
|
81 |
+
<?php _e('Current value:', 'geoip-detect'); ?> <?php echo geoip_detect2_get_external_ip_adress(); ?><br />
|
82 |
+
<?php _e('If empty: Try to use an ip service to detect it (Internet connection is necessary). If this is not possible, 0.0.0.0 will be returned.', 'geoip-detect'); ?><br />
|
83 |
+
<?php _e('(This external adress will be used when the request IP adress is not a public IP, e.g. 127.0.0.1)', 'geoip-detect'); ?>
|
|
|
84 |
</span>
|
85 |
</p>
|
86 |
|
|
|
87 |
|
88 |
<p>
|
89 |
<input type="submit" class="button button-primary" value="<?php _e('Save', 'geoip-detect'); ?>" />
|
91 |
</form>
|
92 |
<?php if (!$ipv6_supported) : ?>
|
93 |
<div class="geoip_detect_error">
|
94 |
+
<h3><?php _e('IPv6 not supported', 'geoip-detect'); ?></h3>
|
95 |
<p>
|
96 |
+
<?php _e('Your version of PHP is compiled without IPv6-support, so it is not possible to lookup adresses like "2001:4860:4801:5::91". For more information see <a href="https://php.net/manual/en/function.inet-pton.php">PHP documentation & user comments</a>.', 'geoip-detect'); ?>
|
97 |
</p>
|
98 |
</div>
|
99 |
<?php endif; ?>
|
100 |
+
<?php require(GEOIP_PLUGIN_DIR . '/views/footer.php'); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
</div>
|
102 |
<style>
|
103 |
.geoip_detect_error {
|
124 |
margin-left: 50px;
|
125 |
color: #777;
|
126 |
}
|
127 |
+
|
128 |
+
</style>
|
|
|
|
|
|