Commit Graph

67 Commits

Author SHA1 Message Date
Rodrigo Primo 2c8d006c37 Update PHPCompatibility sniff names
The name of some sniffs changed in the most recent PHPCompatiblity version. This commit update all instances where those names are used in WooCommerce codebase.
2018-11-21 11:08:26 -02:00
Mohammad Jangda 0590522180
Use wp_get_upload_dir for geolite DB path
By default, `wp_upload_dir` will "will create a subfolder in your Uploads folder corresponding to the queried month (or current month, if no $time argument is provided" (https://developer.wordpress.org/reference/functions/wp_upload_dir/).

This is not necessary in our case since all we want is the `basedir` value.

We're switching to `wp_get_upload_dir`, which is a wrapper for `wp_upload_dir` that turns of the folder create behaviour.
2018-10-13 01:27:45 -04:00
Gerhard Potgieter 43de3d00cd Remove icanhazip service from ip lookup, their DNS is blacklisted and blocked by most servers. 2018-08-27 11:21:37 +02:00
Gerhard Potgieter 90a9fd49e6 X_FORWARDED_FOR standard states either just an IP or a comma seperated list of IP, Proxy, Proxy, ... 2018-06-11 10:49:03 +02:00
Claudio Sanches 574c829096 Introduced function to check if geolocation is enabled 2018-04-24 15:22:12 -03:00
Mike Jolley 6d9bacb982 Removes freegeoip service 2018-04-24 14:32:21 +01:00
Claudio Sanches 9ac00e1986 Use trailingslashit() instead of DIRECTORY_SEPARATOR
This will avoid any double `/` and should work on Windows too.
2018-04-23 14:19:42 -03:00
Shiva Poudel 0c5d6dd285 Tweak - Use of trailingslashit instead 2018-04-23 22:07:14 +05:45
Shiva Poudel a4b5f0bef4 Fix - Notice while downloding GeoIP database on Windows
DIRECTORY_SEPARATOR was the culprit :)

CC @claudiosanches

Closes #19742
2018-04-21 02:43:37 +05:45
Mike Jolley 01be034279 Disable geolocation if using legacy php #19548 2018-03-29 17:04:31 +01:00
Mike Jolley 69a3a78a4c Typo 2018-03-29 16:46:11 +01:00
Claudio Sanches 6405e8645a Removed legacy private methods from WC_Geolocation 2018-03-15 14:01:36 -03:00
Claudio Sanches a731135cae Removed outdated IP lookup service and improved check for valid IPs 2018-03-15 13:45:49 -03:00
Claudio Sanches 4a638c60bb Reschedule download of GeoLite2 database when something goes wrong 2018-03-14 16:07:00 -03:00
Claudio Sanches 51cfb9b03e Updated how GeoLite2 database is downloaded 2018-03-14 16:01:33 -03:00
Claudio Sanches 1791a192d8 Check for PHP version before try use GeoLite2 2018-03-14 14:07:20 -03:00
Claudio Sanches 7f6f4b848d Created WC_Geolite_Integration class to handle with GeoLite2 integration 2018-03-14 13:57:07 -03:00
Claudio Sanches 29b9e9c085 GeoLite2 Reader integration 2018-03-14 12:42:53 -03:00
Claudio Sanches 6fdc1a547d Download new GeoLite2 and deprecated legacy GeoLite 2018-03-13 15:57:32 -03:00
Pathurs 119d3485b1
Remove port from string before checking IP
Fix a bug where if `$_['HTTP_X_FORWARDED_FOR']` contains a port, an `rest_is_ip_address()` returns `bool(false)`.

WooCommerce Version: 3.1.2

Observed results of functions and variables:
```
WC_Geolocation::get_ip_address())	                                  string(0) ""
$_SERVER['X-Real-IP']	                                              string(7) "Not set"
$_SERVER['HTTP_X_FORWARDED_FOR']	                                  string(18) "203.41.99.98:50986"
trim( current( explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) )	  string(18) "203.41.99.98:50986"
$_SERVER['REMOTE_ADDR']	                                              string(12) "203.41.99.98"
```

Old result of calling `WC_Geolocation::geolocate_ip()`:
```array(2) { ["country"]=> string(0) "" ["state"]=> string(0) "" }```

New result of calling `WC_Geolocation::geolocate_ip()`:
```array(2) { ["country"]=> string(2) "AU" ["state"]=> string(0) "" }```
2018-01-02 11:54:26 +11:00
Claudio Sanches 4fb3624604 Fixed coding standards 2017-11-22 14:13:59 -02:00
Claudio Sanches d39a034f14 Drop support for legacy WP versions 2017-11-22 13:55:48 -02:00
Gerhard Potgieter a3fd99ddd9 GeoDB empty file handling (#17541)
* Make sure we do not save empty geodb files, also add checks to ensure we do not read form an empty geodb file.

* Add logger message when deleting file on checking size
2017-11-08 14:28:03 +00:00
claudiulodro 48f03b15ed Use correct server variable 2017-08-04 14:27:22 -07:00
dixitadusara ebe831ccec Issue Missing $ip Variable #15213 2017-05-23 11:50:30 +05:30
Mike Jolley 3ca4ec7927 is_ip_address should be static
Fixes #14970
2017-05-10 18:43:34 +01:00
Claudio Sanches 08db8cebec Check if IP address is valid 2017-05-05 16:58:08 -03:00
Claudio Sanches 486a81bf12 Fixed coding standards 2017-02-17 16:10:15 -02:00
Mike Jolley bbf8e750ce Tidy up includes 2017-02-16 11:46:01 +00:00
Jon Surrell e4d5886427 Replace log `tag` with log `source` 2016-12-29 11:58:43 +01:00
Jon Surrell 691c35e97b Update logger calls 2016-12-29 11:58:42 +01:00
Mike Jolley d3709ce0ef HTTP_X_COUNTRY_CODE 2016-12-20 15:24:30 +00:00
Mike Jolley f67f013957 [2.6] VIP fallback 2016-12-20 11:37:36 +00:00
Mike Jolley c4cf6ba740 [2.6] Change API fallbacks 2016-12-20 11:37:36 +00:00
Aristeides Stathopoulos b063bcfe4c last item in a multiline-array should end in a comma 2016-08-27 04:46:45 +03:00
Mike Jolley cfe28c9b25 Made WC_Logger pluggable via wc_get_logger function.
Closes #11474
2016-08-08 13:59:23 +01:00
Mike Jolley 66c61eebc8 Define full path for includes
Closes #11087
2016-07-27 11:58:43 +01:00
Mike Jolley 56520cd8bc Allow geo ip to be filtered
Closes #11066
2016-06-08 12:18:09 +01:00
Mike Jolley cb27af14c4 Status page geoip database 2016-03-30 13:11:26 +01:00
Mike Jolley dbfba48411 Disable API fallback for geolocating customers
Causes server slowdown due to external calls. Should be off by default.
Closes #10615
2016-03-30 13:02:21 +01:00
Mike Jolley d18e1eb115 woocommerce_geolocation_local_database_path filter 2016-03-30 12:58:50 +01:00
Mike Jolley e09613d7da get_external_ip_address docblock 2016-02-26 13:34:51 +00:00
Shiva Poudel 70496e5864 Tweak missing fallback param in geolocate_ip 2015-11-11 06:19:01 +05:45
Claudio Sanches 5893875b0c Removed period for file headers 2015-11-03 11:53:50 -02:00
Claudio Sanches ee30b5b308 Fixed php docs standards 2015-11-03 11:31:20 -02:00
Mike Jolley afbfd2b913 Tweak gzread 2015-07-15 16:37:29 +01:00
Claudio Sanches 9eb3b6ddf9 Changed all requests with wp_remote_* to wp_safe_remote_* 2015-06-01 13:28:55 +01:00
Claudio Sanches 1caa5ebcee Improved WC_Geolocation support for IPv6 #8184 2015-05-26 17:32:47 -03:00
Claudio Sanches 44dba5036c Added geolocate IPv6 support, closes #8184 2015-05-26 14:41:13 -03:00
Mike Jolley 470b259a8a Don't download GeoIP Database until geolocation option is enabled in settings. 2015-02-18 12:53:24 +00:00