Merged in feature/280-dev-dev01 (pull request #21)
auto-patch 280-dev-dev01-2024-01-19T16_41_58 * auto-patch 280-dev-dev01-2024-01-19T16_41_58
This commit is contained in:
3
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/.gitmodules
vendored
Normal file
3
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "maxmind-db"]
|
||||
path = maxmind-db
|
||||
url = git://github.com/maxmind/MaxMind-DB.git
|
||||
34
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/.php_cs
vendored
Normal file
34
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/.php_cs
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
return PhpCsFixer\Config::create()
|
||||
->setRiskyAllowed(true)
|
||||
->setRules([
|
||||
'@Symfony' => true,
|
||||
'@Symfony:risky' => true,
|
||||
'array_syntax' => ['syntax' => 'short'],
|
||||
'combine_consecutive_unsets' => true,
|
||||
'concat_space' => [ 'spacing' => 'one'],
|
||||
'heredoc_to_nowdoc' => true,
|
||||
'list_syntax' => ['syntax' => 'long'],
|
||||
'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'],
|
||||
'no_short_echo_tag' => true,
|
||||
'no_unreachable_default_argument_value' => true,
|
||||
'no_useless_else' => true,
|
||||
'no_useless_return' => true,
|
||||
'ordered_imports' => true,
|
||||
'pre_increment' => false,
|
||||
'php_unit_strict' => true,
|
||||
'php_unit_test_class_requires_covers' => true,
|
||||
'phpdoc_add_missing_param_annotation' => true,
|
||||
'phpdoc_no_alias_tag' => false,
|
||||
'phpdoc_order' => true,
|
||||
'semicolon_after_instruction' => true,
|
||||
'strict_comparison' => true,
|
||||
'strict_param' => true,
|
||||
'yoda_style' => false,
|
||||
])
|
||||
->setFinder(
|
||||
PhpCsFixer\Finder::create()
|
||||
->in(__DIR__)
|
||||
)
|
||||
;
|
||||
250
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/CHANGELOG.md
vendored
Normal file
250
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,250 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
2.7.0 (2017-10-27)
|
||||
------------------
|
||||
|
||||
* The following new anonymizer properties were added to `GeoIp2\Record\Traits`
|
||||
for use with GeoIP2 Precision Insights: `isAnonymous`, `isAnonymousVpn`,
|
||||
`isHostingProvider`, `isPublicProxy`, and `isTorExitNode`.
|
||||
|
||||
2.6.0 (2017-07-10)
|
||||
-----------------
|
||||
|
||||
* Code clean-up and tidying.
|
||||
* Set minimum required PHP version to 5.4 in `composer.json`. Previously,
|
||||
5.3 would work but was not tested. Now 5.4 is hard minimum version.
|
||||
|
||||
2.5.0 (2017-05-08)
|
||||
------------------
|
||||
|
||||
* Support for PHP 5.3 was dropped.
|
||||
* Added support for GeoLite2 ASN database.
|
||||
|
||||
2.4.5 (2017-01-31)
|
||||
------------------
|
||||
|
||||
* Additional error checking on the data returned from `MaxMind\Db\Reader`
|
||||
was added to help detect corrupt databases. GitHub #83.
|
||||
|
||||
2.4.4 (2016-10-11)
|
||||
------------------
|
||||
|
||||
* `isset()` on `mostSpecificSubdivision` attribute now returns the
|
||||
correct value. Reported by Juan Francisco Giordana. GitHub #81.
|
||||
|
||||
2.4.3 (2016-10-11)
|
||||
------------------
|
||||
|
||||
* `isset()` on `name` attribute now returns the correct value. Reported by
|
||||
Juan Francisco Giordana. GitHub #79.
|
||||
|
||||
2.4.2 (2016-08-17)
|
||||
------------------
|
||||
|
||||
* Updated documentation to clarify what the accuracy radius refers to.
|
||||
* Upgraded `maxmind/web-service-common` to 0.3.0. This version uses
|
||||
`composer/ca-bundle` rather than our own CA bundle. GitHub #75.
|
||||
* Improved PHP documentation generation.
|
||||
|
||||
2.4.1 (2016-06-10)
|
||||
------------------
|
||||
|
||||
* Corrected type annotations in documentation. GitHub #66.
|
||||
* Updated documentation to reflect that the accuracy radius is now included
|
||||
in City.
|
||||
* Upgraded web service client, which supports setting a proxy. GitHub #59.
|
||||
|
||||
2.4.0 (2016-04-15)
|
||||
------------------
|
||||
|
||||
* Added support for the GeoIP2 Enterprise database.
|
||||
|
||||
2.3.3 (2015-09-24)
|
||||
------------------
|
||||
|
||||
* Corrected case on `JsonSerializable` interface. Reported by Axel Etcheverry.
|
||||
GitHub #56.
|
||||
|
||||
2.3.2 (2015-09-23)
|
||||
------------------
|
||||
|
||||
* `JsonSerializable` compatibility interface was moved to `GeoIp2\Compat`
|
||||
rather than the global namespace to prevent autoloading issues. Reported by
|
||||
Tomas Buteler. GitHub #54.
|
||||
* Missing documentation for the `$postal` property was added to the
|
||||
`GeoIp2\Model\City` class. Fix by Roy Sindre Norangshol. GitHub #51.
|
||||
* In the Phar distribution, source files for this module no longer have their
|
||||
documentation stripped, allowing IDE introspection to work properly.
|
||||
Reported by Dominic Black. GitHub #52.
|
||||
|
||||
2.3.1 (2015-06-30)
|
||||
------------------
|
||||
|
||||
* Updated `maxmind/web-service-common` to version with fixes for PHP 5.3 and
|
||||
5.4.
|
||||
|
||||
2.3.0 (2015-06-29)
|
||||
------------------
|
||||
|
||||
* Support for demographics fields `averageIncome` and `populationDensity` in
|
||||
the `Location` record, returned by the Insights endpoint.
|
||||
* The `isAnonymousProxy` and `isSatelliteProvider` properties on
|
||||
`GeoIP2\Record\Traits` have been deprecated. Please use our [GeoIP2
|
||||
Anonymous IP database](https://www.maxmind.com/en/geoip2-anonymous-ip-database)
|
||||
to determine whether an IP address is used by an anonymizing service.
|
||||
|
||||
2.2.0-beta1 (2015-06-09)
|
||||
------------------------
|
||||
|
||||
* Typo fix in documentation.
|
||||
|
||||
2.2.0-alpha2 (2015-06-01)
|
||||
-------------------------
|
||||
|
||||
* `maxmind-ws/web-service-common` was renamed to `maxmind/web-service-common`.
|
||||
|
||||
2.2.0-alpha1 (2015-05-22)
|
||||
-------------------------
|
||||
|
||||
* The library no longer uses Guzzle and instead uses curl directly.
|
||||
* Support for `timeout` and `connectTimout` were added to the `$options` array
|
||||
passed to the `GeoIp2\WebService\Client` constructor. Pull request by Will
|
||||
Bradley. GitHub #36.
|
||||
|
||||
2.1.1 (2014-12-03)
|
||||
------------------
|
||||
|
||||
* The 2.1.0 Phar builds included a shebang line, causing issues when loading
|
||||
it as a library. This has been corrected. GitHub #33.
|
||||
|
||||
2.1.0 (2014-10-29)
|
||||
------------------
|
||||
|
||||
* Update ApiGen dependency to version that isn't broken on case sensitive
|
||||
file systems.
|
||||
* Added support for the GeoIP2 Anonymous IP database. The
|
||||
`GeoIP2\Database\Reader` class now has an `anonymousIp` method which returns
|
||||
a `GeoIP2\Model\AnonymousIp` object.
|
||||
* Boolean attributes like those in the `GeoIP2\Record\Traits` class now return
|
||||
`false` instead of `null` when they were not true.
|
||||
|
||||
2.0.0 (2014-09-22)
|
||||
------------------
|
||||
|
||||
* First production release.
|
||||
|
||||
0.9.0 (2014-09-15)
|
||||
------------------
|
||||
|
||||
* IMPORTANT: The deprecated `omni()` and `cityIspOrg()` methods have been
|
||||
removed from `GeoIp2\WebService\Client`.
|
||||
|
||||
0.8.1 (2014-09-12)
|
||||
------------------
|
||||
|
||||
* The check added to the `GeoIP2\Database\Reader` lookup methods in 0.8.0 did
|
||||
not work with the GeoIP2 City Database Subset by Continent with World
|
||||
Countries. This has been fixed. Fixes GitHub issue #23.
|
||||
|
||||
0.8.0 (2014-09-10)
|
||||
------------------
|
||||
|
||||
* The `GeoIp2\Database\Reader` lookup methods (e.g., `city()`, `isp()`) now
|
||||
throw a `BadMethodCallException` if they are used with a database that
|
||||
does not match the method. In particular, doing a `city()` lookup on a
|
||||
GeoIP2 Country database will result in an exception, and vice versa.
|
||||
* A `metadata()` method has been added to the `GeoIP2\Database\Reader` class.
|
||||
This returns a `MaxMind\Db\Reader\Metadata` class with information about the
|
||||
database.
|
||||
* The name attribute was missing from the RepresentedCountry class.
|
||||
|
||||
0.7.0 (2014-07-22)
|
||||
------------------
|
||||
|
||||
* The web service client API has been updated for the v2.1 release of the web
|
||||
service. In particular, the `cityIspOrg` and `omni` methods on
|
||||
`GeoIp2\WebService\Client` should be considered deprecated. The `city`
|
||||
method now provides all of the data formerly provided by `cityIspOrg`, and
|
||||
the `omni` method has been replaced by the `insights` method.
|
||||
* Support was added for GeoIP2 Connection Type, Domain and ISP databases.
|
||||
|
||||
|
||||
0.6.3 (2014-05-12)
|
||||
------------------
|
||||
|
||||
* With the previous Phar builds, some users received `phar error: invalid url
|
||||
or non-existent phar` errors. The correct alias is now used for the Phar,
|
||||
and this should no longer be an issue.
|
||||
|
||||
0.6.2 (2014-05-08)
|
||||
------------------
|
||||
|
||||
* The Phar build was broken with Guzzle 3.9.0+. This has been fixed.
|
||||
|
||||
0.6.1 (2014-05-01)
|
||||
------------------
|
||||
|
||||
* This API now officially supports HHVM.
|
||||
* The `maxmind-db/reader` dependency was updated to a version that does not
|
||||
require BC Math.
|
||||
* The Composer compatibility autoload rules are now targeted more narrowly.
|
||||
* A `box.json` file is included to build a Phar package.
|
||||
|
||||
0.6.0 (2014-02-19)
|
||||
------------------
|
||||
|
||||
* This API is now licensed under the Apache License, Version 2.0.
|
||||
* Model and record classes now implement `JsonSerializable`.
|
||||
* `isset` now works with model and record classes.
|
||||
|
||||
0.5.0 (2013-10-21)
|
||||
------------------
|
||||
|
||||
* Renamed $languages constructor parameters to $locales for both the Client
|
||||
and Reader classes.
|
||||
* Documentation and code clean-up (Ben Morel).
|
||||
* Added the interface `GeoIp2\ProviderInterface`, which is implemented by both
|
||||
`\GeoIp2\Database\Reader` and `\GeoIp2\WebService\Client`.
|
||||
|
||||
0.4.0 (2013-07-16)
|
||||
------------------
|
||||
|
||||
* This is the first release with the GeoIP2 database reader. Please see the
|
||||
`README.md` file and the `\GeoIp2\Database\Reader` class.
|
||||
* The general exception classes were replaced with specific exception classes
|
||||
representing particular types of errors, such as an authentication error.
|
||||
|
||||
0.3.0 (2013-07-12)
|
||||
------------------
|
||||
|
||||
* In namespaces and class names, "GeoIP2" was renamed to "GeoIp2" to improve
|
||||
consistency.
|
||||
|
||||
0.2.1 (2013-06-10)
|
||||
------------------
|
||||
|
||||
* First official beta release.
|
||||
* Documentation updates and corrections.
|
||||
|
||||
0.2.0 (2013-05-29)
|
||||
------------------
|
||||
|
||||
* `GenericException` was renamed to `GeoIP2Exception`.
|
||||
* We now support more languages. The new languages are de, es, fr, and pt-BR.
|
||||
* The REST API now returns a record with data about your account. There is
|
||||
a new `GeoIP\Records\MaxMind` class for this data.
|
||||
* The `continentCode` attribute on `Continent` was renamed to `code`.
|
||||
* Documentation updates.
|
||||
|
||||
0.1.1 (2013-05-14)
|
||||
------------------
|
||||
|
||||
* Updated Guzzle version requirement.
|
||||
* Fixed Composer example in README.md.
|
||||
|
||||
|
||||
0.1.0 (2013-05-13)
|
||||
------------------
|
||||
|
||||
* Initial release.
|
||||
202
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/LICENSE
vendored
Normal file
202
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/LICENSE
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
https://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
401
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/README.md
vendored
Normal file
401
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/README.md
vendored
Normal file
@@ -0,0 +1,401 @@
|
||||
# GeoIP2 PHP API #
|
||||
|
||||
## Description ##
|
||||
|
||||
This package provides an API for the GeoIP2
|
||||
[web services](https://dev.maxmind.com/geoip/geoip2/web-services) and
|
||||
[databases](https://dev.maxmind.com/geoip/geoip2/downloadable). The API also
|
||||
works with the free
|
||||
[GeoLite2 databases](https://dev.maxmind.com/geoip/geoip2/geolite2/).
|
||||
|
||||
## Install via Composer ##
|
||||
|
||||
We recommend installing this package with [Composer](https://getcomposer.org/).
|
||||
|
||||
### Download Composer ###
|
||||
|
||||
To download Composer, run in the root directory of your project:
|
||||
|
||||
```bash
|
||||
curl -sS https://getcomposer.org/installer | php
|
||||
```
|
||||
|
||||
You should now have the file `composer.phar` in your project directory.
|
||||
|
||||
### Install Dependencies ###
|
||||
|
||||
Run in your project root:
|
||||
|
||||
```
|
||||
php composer.phar require geoip2/geoip2:~2.0
|
||||
```
|
||||
|
||||
You should now have the files `composer.json` and `composer.lock` as well as
|
||||
the directory `vendor` in your project directory. If you use a version control
|
||||
system, `composer.json` should be added to it.
|
||||
|
||||
### Require Autoloader ###
|
||||
|
||||
After installing the dependencies, you need to require the Composer autoloader
|
||||
from your code:
|
||||
|
||||
```php
|
||||
require 'vendor/autoload.php';
|
||||
```
|
||||
|
||||
## Install via Phar ##
|
||||
|
||||
Although we strongly recommend using Composer, we also provide a
|
||||
[phar archive](https://php.net/manual/en/book.phar.php) containing most of the
|
||||
dependencies for GeoIP2. Our latest phar archive is available on
|
||||
[our releases page](https://github.com/maxmind/GeoIP2-php/releases).
|
||||
|
||||
### Install Dependencies ###
|
||||
|
||||
In order to use the phar archive, you must have the PHP
|
||||
[Phar extension](https://php.net/manual/en/book.phar.php) installed and
|
||||
enabled.
|
||||
|
||||
If you will be making web service requests, you must have the PHP
|
||||
[cURL extension](https://php.net/manual/en/book.curl.php)
|
||||
installed to use this archive. For Debian based distributions, this can
|
||||
typically be found in the the `php-curl` package. For other operating
|
||||
systems, please consult the relevant documentation. After installing the
|
||||
extension you may need to restart your web server.
|
||||
|
||||
If you are missing this extension, you will see errors like the following:
|
||||
|
||||
```
|
||||
PHP Fatal error: Uncaught Error: Call to undefined function MaxMind\WebService\curl_version()
|
||||
```
|
||||
|
||||
### Require Package ###
|
||||
|
||||
To use the archive, just require it from your script:
|
||||
|
||||
```php
|
||||
require 'geoip2.phar';
|
||||
```
|
||||
|
||||
## Optional C Extension ##
|
||||
|
||||
The [MaxMind DB API](https://github.com/maxmind/MaxMind-DB-Reader-php)
|
||||
includes an optional C extension that you may install to dramatically increase
|
||||
the performance of lookups in GeoIP2 or GeoLite2 databases. To install, please
|
||||
follow the instructions included with that API.
|
||||
|
||||
The extension has no effect on web-service lookups.
|
||||
|
||||
## IP Geolocation Usage ##
|
||||
|
||||
IP geolocation is inherently imprecise. Locations are often near the center of
|
||||
the population. Any location provided by a GeoIP2 database or web service
|
||||
should not be used to identify a particular address or household.
|
||||
|
||||
## Database Reader ##
|
||||
|
||||
### Usage ###
|
||||
|
||||
To use this API, you must create a new `\GeoIp2\Database\Reader` object with
|
||||
the path to the database file as the first argument to the constructor. You
|
||||
may then call the method corresponding to the database you are using.
|
||||
|
||||
If the lookup succeeds, the method call will return a model class for the
|
||||
record in the database. This model in turn contains multiple container
|
||||
classes for the different parts of the data such as the city in which the
|
||||
IP address is located.
|
||||
|
||||
If the record is not found, a `\GeoIp2\Exception\AddressNotFoundException`
|
||||
is thrown. If the database is invalid or corrupt, a
|
||||
`\MaxMind\Db\InvalidDatabaseException` will be thrown.
|
||||
|
||||
See the API documentation for more details.
|
||||
|
||||
### City Example ###
|
||||
|
||||
```php
|
||||
<?php
|
||||
require_once 'vendor/autoload.php';
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
// This creates the Reader object, which should be reused across
|
||||
// lookups.
|
||||
$reader = new Reader('/usr/local/share/GeoIP/GeoIP2-City.mmdb');
|
||||
|
||||
// Replace "city" with the appropriate method for your database, e.g.,
|
||||
// "country".
|
||||
$record = $reader->city('128.101.101.101');
|
||||
|
||||
print($record->country->isoCode . "\n"); // 'US'
|
||||
print($record->country->name . "\n"); // 'United States'
|
||||
print($record->country->names['zh-CN'] . "\n"); // '美国'
|
||||
|
||||
print($record->mostSpecificSubdivision->name . "\n"); // 'Minnesota'
|
||||
print($record->mostSpecificSubdivision->isoCode . "\n"); // 'MN'
|
||||
|
||||
print($record->city->name . "\n"); // 'Minneapolis'
|
||||
|
||||
print($record->postal->code . "\n"); // '55455'
|
||||
|
||||
print($record->location->latitude . "\n"); // 44.9733
|
||||
print($record->location->longitude . "\n"); // -93.2323
|
||||
|
||||
```
|
||||
|
||||
### Anonymous IP Example ###
|
||||
|
||||
```php
|
||||
<?php
|
||||
require_once 'vendor/autoload.php';
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
// This creates the Reader object, which should be reused across
|
||||
// lookups.
|
||||
$reader = new Reader('/usr/local/share/GeoIP/GeoIP2-Anonymous-IP.mmdb');
|
||||
|
||||
$record = $reader->anonymousIp('128.101.101.101');
|
||||
|
||||
if ($record->isAnonymous) { print "anon\n"; }
|
||||
print($record->ipAddress . "\n"); // '128.101.101.101'
|
||||
|
||||
```
|
||||
|
||||
### Connection-Type Example ###
|
||||
|
||||
```php
|
||||
<?php
|
||||
require_once 'vendor/autoload.php';
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
// This creates the Reader object, which should be reused across
|
||||
// lookups.
|
||||
$reader = new Reader('/usr/local/share/GeoIP/GeoIP2-Connection-Type.mmdb');
|
||||
|
||||
$record = $reader->connectionType('128.101.101.101');
|
||||
|
||||
print($record->connectionType . "\n"); // 'Corporate'
|
||||
print($record->ipAddress . "\n"); // '128.101.101.101'
|
||||
|
||||
```
|
||||
|
||||
### Domain Example ###
|
||||
|
||||
```php
|
||||
<?php
|
||||
require_once 'vendor/autoload.php';
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
// This creates the Reader object, which should be reused across
|
||||
// lookups.
|
||||
$reader = new Reader('/usr/local/share/GeoIP/GeoIP2-Domain.mmdb');
|
||||
|
||||
$record = $reader->domain('128.101.101.101');
|
||||
|
||||
print($record->domain . "\n"); // 'umn.edu'
|
||||
print($record->ipAddress . "\n"); // '128.101.101.101'
|
||||
|
||||
```
|
||||
|
||||
### Enterprise Example ###
|
||||
|
||||
```php
|
||||
<?php
|
||||
require_once 'vendor/autoload.php';
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
// This creates the Reader object, which should be reused across
|
||||
// lookups.
|
||||
$reader = new Reader('/usr/local/share/GeoIP/GeoIP2-Enterprise.mmdb');
|
||||
|
||||
// Use the ->enterprise method to do a lookup in the Enterprise database
|
||||
$record = $reader->enterprise('128.101.101.101');
|
||||
|
||||
print($record->country->confidence . "\n"); // 99
|
||||
print($record->country->isoCode . "\n"); // 'US'
|
||||
print($record->country->name . "\n"); // 'United States'
|
||||
print($record->country->names['zh-CN'] . "\n"); // '美国'
|
||||
|
||||
print($record->mostSpecificSubdivision->confidence . "\n"); // 77
|
||||
print($record->mostSpecificSubdivision->name . "\n"); // 'Minnesota'
|
||||
print($record->mostSpecificSubdivision->isoCode . "\n"); // 'MN'
|
||||
|
||||
print($record->city->confidence . "\n"); // 60
|
||||
print($record->city->name . "\n"); // 'Minneapolis'
|
||||
|
||||
print($record->postal->code . "\n"); // '55455'
|
||||
|
||||
print($record->location->accuracyRadius . "\n"); // 50
|
||||
print($record->location->latitude . "\n"); // 44.9733
|
||||
print($record->location->longitude . "\n"); // -93.2323
|
||||
|
||||
```
|
||||
|
||||
### ISP Example ###
|
||||
|
||||
```php
|
||||
<?php
|
||||
require_once 'vendor/autoload.php';
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
// This creates the Reader object, which should be reused across
|
||||
// lookups.
|
||||
$reader = new Reader('/usr/local/share/GeoIP/GeoIP2-ISP.mmdb');
|
||||
|
||||
$record = $reader->isp('128.101.101.101');
|
||||
|
||||
print($record->autonomousSystemNumber . "\n"); // 217
|
||||
print($record->autonomousSystemOrganization . "\n"); // 'University of Minnesota'
|
||||
print($record->isp . "\n"); // 'University of Minnesota'
|
||||
print($record->organization . "\n"); // 'University of Minnesota'
|
||||
|
||||
print($record->ipAddress . "\n"); // '128.101.101.101'
|
||||
|
||||
```
|
||||
|
||||
## Web Service Client ##
|
||||
|
||||
### Usage ###
|
||||
|
||||
To use this API, you must create a new `\GeoIp2\WebService\Client`
|
||||
object with your `$userId` and `$licenseKey`, then you call the method
|
||||
corresponding to a specific end point, passing it the IP address you want to
|
||||
look up.
|
||||
|
||||
If the request succeeds, the method call will return a model class for the end
|
||||
point you called. This model in turn contains multiple record classes, each of
|
||||
which represents part of the data returned by the web service.
|
||||
|
||||
If there is an error, a structured exception is thrown.
|
||||
|
||||
See the API documentation for more details.
|
||||
|
||||
### Example ###
|
||||
|
||||
```php
|
||||
<?php
|
||||
require_once 'vendor/autoload.php';
|
||||
use GeoIp2\WebService\Client;
|
||||
|
||||
// This creates a Client object that can be reused across requests.
|
||||
// Replace "42" with your user ID and "license_key" with your license
|
||||
// key.
|
||||
$client = new Client(42, 'abcdef123456');
|
||||
|
||||
// Replace "city" with the method corresponding to the web service that
|
||||
// you are using, e.g., "country", "insights".
|
||||
$record = $client->city('128.101.101.101');
|
||||
|
||||
print($record->country->isoCode . "\n"); // 'US'
|
||||
print($record->country->name . "\n"); // 'United States'
|
||||
print($record->country->names['zh-CN'] . "\n"); // '美国'
|
||||
|
||||
print($record->mostSpecificSubdivision->name . "\n"); // 'Minnesota'
|
||||
print($record->mostSpecificSubdivision->isoCode . "\n"); // 'MN'
|
||||
|
||||
print($record->city->name . "\n"); // 'Minneapolis'
|
||||
|
||||
print($record->postal->code . "\n"); // '55455'
|
||||
|
||||
print($record->location->latitude . "\n"); // 44.9733
|
||||
print($record->location->longitude . "\n"); // -93.2323
|
||||
|
||||
```
|
||||
|
||||
## Values to use for Database or Array Keys ##
|
||||
|
||||
**We strongly discourage you from using a value from any `names` property as
|
||||
a key in a database or array.**
|
||||
|
||||
These names may change between releases. Instead we recommend using one of the
|
||||
following:
|
||||
|
||||
* `GeoIp2\Record\City` - `$city->geonameId`
|
||||
* `GeoIp2\Record\Continent` - `$continent->code` or `$continent->geonameId`
|
||||
* `GeoIp2\Record\Country` and `GeoIp2\Record\RepresentedCountry` -
|
||||
`$country->isoCode` or `$country->geonameId`
|
||||
* `GeoIp2\Record\Subdivision` - `$subdivision->isoCode` or `$subdivision->geonameId`
|
||||
|
||||
### What data is returned? ###
|
||||
|
||||
While many of the end points return the same basic records, the attributes
|
||||
which can be populated vary between end points. In addition, while an end
|
||||
point may offer a particular piece of data, MaxMind does not always have every
|
||||
piece of data for any given IP address.
|
||||
|
||||
Because of these factors, it is possible for any end point to return a record
|
||||
where some or all of the attributes are unpopulated.
|
||||
|
||||
See the
|
||||
[GeoIP2 Precision web service docs](https://dev.maxmind.com/geoip/geoip2/web-services)
|
||||
for details on what data each end point may return.
|
||||
|
||||
The only piece of data which is always returned is the `ipAddress`
|
||||
attribute in the `GeoIp2\Record\Traits` record.
|
||||
|
||||
## Integration with GeoNames ##
|
||||
|
||||
[GeoNames](https://www.geonames.org/) offers web services and downloadable
|
||||
databases with data on geographical features around the world, including
|
||||
populated places. They offer both free and paid premium data. Each
|
||||
feature is unique identified by a `geonameId`, which is an integer.
|
||||
|
||||
Many of the records returned by the GeoIP2 web services and databases
|
||||
include a `geonameId` property. This is the ID of a geographical feature
|
||||
(city, region, country, etc.) in the GeoNames database.
|
||||
|
||||
Some of the data that MaxMind provides is also sourced from GeoNames. We
|
||||
source things like place names, ISO codes, and other similar data from
|
||||
the GeoNames premium data set.
|
||||
|
||||
## Reporting data problems ##
|
||||
|
||||
If the problem you find is that an IP address is incorrectly mapped,
|
||||
please
|
||||
[submit your correction to MaxMind](https://www.maxmind.com/en/correction).
|
||||
|
||||
If you find some other sort of mistake, like an incorrect spelling,
|
||||
please check the [GeoNames site](https://www.geonames.org/) first. Once
|
||||
you've searched for a place and found it on the GeoNames map view, there
|
||||
are a number of links you can use to correct data ("move", "edit",
|
||||
"alternate names", etc.). Once the correction is part of the GeoNames
|
||||
data set, it will be automatically incorporated into future MaxMind
|
||||
releases.
|
||||
|
||||
If you are a paying MaxMind customer and you're not sure where to submit
|
||||
a correction, please
|
||||
[contact MaxMind support](https://www.maxmind.com/en/support) for help.
|
||||
|
||||
## Other Support ##
|
||||
|
||||
Please report all issues with this code using the
|
||||
[GitHub issue tracker](https://github.com/maxmind/GeoIP2-php/issues).
|
||||
|
||||
If you are having an issue with a MaxMind service that is not specific
|
||||
to the client API, please see
|
||||
[our support page](https://www.maxmind.com/en/support).
|
||||
|
||||
## Requirements ##
|
||||
|
||||
This library requires PHP 5.4 or greater. This library works and is tested
|
||||
with HHVM.
|
||||
|
||||
This library also relies on the [MaxMind DB Reader](https://github.com/maxmind/MaxMind-DB-Reader-php).
|
||||
|
||||
## Contributing ##
|
||||
|
||||
Patches and pull requests are encouraged. All code should follow the PSR-2
|
||||
style guidelines. Please include unit tests whenever possible. You may obtain
|
||||
the test data for the maxmind-db folder by running `git submodule update
|
||||
--init --recursive` or adding `--recursive` to your initial clone, or from
|
||||
https://github.com/maxmind/MaxMind-DB
|
||||
|
||||
## Versioning ##
|
||||
|
||||
The GeoIP2 PHP API uses [Semantic Versioning](https://semver.org/).
|
||||
|
||||
## Copyright and License ##
|
||||
|
||||
This software is Copyright (c) 2013-2017 by MaxMind, Inc.
|
||||
|
||||
This is free software, licensed under the Apache License, Version 2.0.
|
||||
|
||||
31
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/composer.json
vendored
Normal file
31
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/composer.json
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "geoip2/geoip2",
|
||||
"description": "MaxMind GeoIP2 PHP API",
|
||||
"keywords": ["geoip", "geoip2", "geolocation", "ip", "maxmind"],
|
||||
"homepage": "https://github.com/maxmind/GeoIP2-php",
|
||||
"type": "library",
|
||||
"license": "Apache-2.0",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Gregory J. Oschwald",
|
||||
"email": "goschwald@maxmind.com",
|
||||
"homepage": "http://www.maxmind.com/"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"maxmind-db/reader": "~1.0",
|
||||
"maxmind/web-service-common": "~0.4",
|
||||
"php": ">=5.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "2.*",
|
||||
"phpunit/phpunit": "4.*",
|
||||
"squizlabs/php_codesniffer": "3.*",
|
||||
"apigen/apigen": "*"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"GeoIp2\\": "src"
|
||||
}
|
||||
}
|
||||
}
|
||||
2
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/maxmind-db/index.php
vendored
Normal file
2
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/maxmind-db/index.php
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
// Silence is golden.
|
||||
283
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Database/Reader.php
vendored
Normal file
283
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Database/Reader.php
vendored
Normal file
@@ -0,0 +1,283 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Database;
|
||||
|
||||
use GeoIp2\Exception\AddressNotFoundException;
|
||||
use GeoIp2\ProviderInterface;
|
||||
use MaxMind\Db\Reader as DbReader;
|
||||
use MaxMind\Db\Reader\InvalidDatabaseException;
|
||||
|
||||
/**
|
||||
* Instances of this class provide a reader for the GeoIP2 database format.
|
||||
* IP addresses can be looked up using the database specific methods.
|
||||
*
|
||||
* ## Usage ##
|
||||
*
|
||||
* The basic API for this class is the same for every database. First, you
|
||||
* create a reader object, specifying a file name. You then call the method
|
||||
* corresponding to the specific database, passing it the IP address you want
|
||||
* to look up.
|
||||
*
|
||||
* If the request succeeds, the method call will return a model class for
|
||||
* the method you called. This model in turn contains multiple record classes,
|
||||
* each of which represents part of the data returned by the database. If
|
||||
* the database does not contain the requested information, the attributes
|
||||
* on the record class will have a `null` value.
|
||||
*
|
||||
* If the address is not in the database, an
|
||||
* {@link \GeoIp2\Exception\AddressNotFoundException} exception will be
|
||||
* thrown. If an invalid IP address is passed to one of the methods, a
|
||||
* SPL {@link \InvalidArgumentException} will be thrown. If the database is
|
||||
* corrupt or invalid, a {@link \MaxMind\Db\Reader\InvalidDatabaseException}
|
||||
* will be thrown.
|
||||
*/
|
||||
class Reader implements ProviderInterface
|
||||
{
|
||||
private $dbReader;
|
||||
private $locales;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $filename the path to the GeoIP2 database file
|
||||
* @param array $locales list of locale codes to use in name property
|
||||
* from most preferred to least preferred
|
||||
*
|
||||
* @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
|
||||
* is corrupt or invalid
|
||||
*/
|
||||
public function __construct(
|
||||
$filename,
|
||||
$locales = ['en']
|
||||
) {
|
||||
$this->dbReader = new DbReader($filename);
|
||||
$this->locales = $locales;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a GeoIP2 City model.
|
||||
*
|
||||
* @param string $ipAddress an IPv4 or IPv6 address as a string
|
||||
*
|
||||
* @throws \GeoIp2\Exception\AddressNotFoundException if the address is
|
||||
* not in the database
|
||||
* @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
|
||||
* is corrupt or invalid
|
||||
*
|
||||
* @return \GeoIp2\Model\City
|
||||
*/
|
||||
public function city($ipAddress)
|
||||
{
|
||||
return $this->modelFor('City', 'City', $ipAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a GeoIP2 Country model.
|
||||
*
|
||||
* @param string $ipAddress an IPv4 or IPv6 address as a string
|
||||
*
|
||||
* @throws \GeoIp2\Exception\AddressNotFoundException if the address is
|
||||
* not in the database
|
||||
* @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
|
||||
* is corrupt or invalid
|
||||
*
|
||||
* @return \GeoIp2\Model\Country
|
||||
*/
|
||||
public function country($ipAddress)
|
||||
{
|
||||
return $this->modelFor('Country', 'Country', $ipAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a GeoIP2 Anonymous IP model.
|
||||
*
|
||||
* @param string $ipAddress an IPv4 or IPv6 address as a string
|
||||
*
|
||||
* @throws \GeoIp2\Exception\AddressNotFoundException if the address is
|
||||
* not in the database
|
||||
* @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
|
||||
* is corrupt or invalid
|
||||
*
|
||||
* @return \GeoIp2\Model\AnonymousIp
|
||||
*/
|
||||
public function anonymousIp($ipAddress)
|
||||
{
|
||||
return $this->flatModelFor(
|
||||
'AnonymousIp',
|
||||
'GeoIP2-Anonymous-IP',
|
||||
$ipAddress
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a GeoLite2 ASN model.
|
||||
*
|
||||
* @param string $ipAddress an IPv4 or IPv6 address as a string
|
||||
*
|
||||
* @throws \GeoIp2\Exception\AddressNotFoundException if the address is
|
||||
* not in the database
|
||||
* @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
|
||||
* is corrupt or invalid
|
||||
*
|
||||
* @return \GeoIp2\Model\Asn
|
||||
*/
|
||||
public function asn($ipAddress)
|
||||
{
|
||||
return $this->flatModelFor(
|
||||
'Asn',
|
||||
'GeoLite2-ASN',
|
||||
$ipAddress
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a GeoIP2 Connection Type model.
|
||||
*
|
||||
* @param string $ipAddress an IPv4 or IPv6 address as a string
|
||||
*
|
||||
* @throws \GeoIp2\Exception\AddressNotFoundException if the address is
|
||||
* not in the database
|
||||
* @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
|
||||
* is corrupt or invalid
|
||||
*
|
||||
* @return \GeoIp2\Model\ConnectionType
|
||||
*/
|
||||
public function connectionType($ipAddress)
|
||||
{
|
||||
return $this->flatModelFor(
|
||||
'ConnectionType',
|
||||
'GeoIP2-Connection-Type',
|
||||
$ipAddress
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a GeoIP2 Domain model.
|
||||
*
|
||||
* @param string $ipAddress an IPv4 or IPv6 address as a string
|
||||
*
|
||||
* @throws \GeoIp2\Exception\AddressNotFoundException if the address is
|
||||
* not in the database
|
||||
* @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
|
||||
* is corrupt or invalid
|
||||
*
|
||||
* @return \GeoIp2\Model\Domain
|
||||
*/
|
||||
public function domain($ipAddress)
|
||||
{
|
||||
return $this->flatModelFor(
|
||||
'Domain',
|
||||
'GeoIP2-Domain',
|
||||
$ipAddress
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a GeoIP2 Enterprise model.
|
||||
*
|
||||
* @param string $ipAddress an IPv4 or IPv6 address as a string
|
||||
*
|
||||
* @throws \GeoIp2\Exception\AddressNotFoundException if the address is
|
||||
* not in the database
|
||||
* @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
|
||||
* is corrupt or invalid
|
||||
*
|
||||
* @return \GeoIp2\Model\Enterprise
|
||||
*/
|
||||
public function enterprise($ipAddress)
|
||||
{
|
||||
return $this->modelFor('Enterprise', 'Enterprise', $ipAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a GeoIP2 ISP model.
|
||||
*
|
||||
* @param string $ipAddress an IPv4 or IPv6 address as a string
|
||||
*
|
||||
* @throws \GeoIp2\Exception\AddressNotFoundException if the address is
|
||||
* not in the database
|
||||
* @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
|
||||
* is corrupt or invalid
|
||||
*
|
||||
* @return \GeoIp2\Model\Isp
|
||||
*/
|
||||
public function isp($ipAddress)
|
||||
{
|
||||
return $this->flatModelFor(
|
||||
'Isp',
|
||||
'GeoIP2-ISP',
|
||||
$ipAddress
|
||||
);
|
||||
}
|
||||
|
||||
private function modelFor($class, $type, $ipAddress)
|
||||
{
|
||||
$record = $this->getRecord($class, $type, $ipAddress);
|
||||
|
||||
$record['traits']['ip_address'] = $ipAddress;
|
||||
$class = 'GeoIp2\\Model\\' . $class;
|
||||
|
||||
return new $class($record, $this->locales);
|
||||
}
|
||||
|
||||
private function flatModelFor($class, $type, $ipAddress)
|
||||
{
|
||||
$record = $this->getRecord($class, $type, $ipAddress);
|
||||
|
||||
$record['ip_address'] = $ipAddress;
|
||||
$class = 'GeoIp2\\Model\\' . $class;
|
||||
|
||||
return new $class($record);
|
||||
}
|
||||
|
||||
private function getRecord($class, $type, $ipAddress)
|
||||
{
|
||||
if (strpos($this->metadata()->databaseType, $type) === false) {
|
||||
$method = lcfirst($class);
|
||||
throw new \BadMethodCallException(
|
||||
"The $method method cannot be used to open a "
|
||||
. $this->metadata()->databaseType . ' database'
|
||||
);
|
||||
}
|
||||
$record = $this->dbReader->get($ipAddress);
|
||||
if ($record === null) {
|
||||
throw new AddressNotFoundException(
|
||||
"The address $ipAddress is not in the database."
|
||||
);
|
||||
}
|
||||
if (!is_array($record)) {
|
||||
// This can happen on corrupt databases. Generally,
|
||||
// MaxMind\Db\Reader will throw a
|
||||
// MaxMind\Db\Reader\InvalidDatabaseException, but occasionally
|
||||
// the lookup may result in a record that looks valid but is not
|
||||
// an array. This mostly happens when the user is ignoring all
|
||||
// exceptions and the more frequent InvalidDatabaseException
|
||||
// exceptions go unnoticed.
|
||||
throw new InvalidDatabaseException(
|
||||
"Expected an array when looking up $ipAddress but received: "
|
||||
. gettype($record)
|
||||
);
|
||||
}
|
||||
|
||||
return $record;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \InvalidArgumentException if arguments are passed to the method
|
||||
* @throws \BadMethodCallException if the database has been closed
|
||||
*
|
||||
* @return \MaxMind\Db\Reader\Metadata object for the database
|
||||
*/
|
||||
public function metadata()
|
||||
{
|
||||
return $this->dbReader->metadata();
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the GeoIP2 database and returns the resources to the system.
|
||||
*/
|
||||
public function close()
|
||||
{
|
||||
$this->dbReader->close();
|
||||
}
|
||||
}
|
||||
10
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Exception/AddressNotFoundException.php
vendored
Normal file
10
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Exception/AddressNotFoundException.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Exception;
|
||||
|
||||
/**
|
||||
* This class represents a generic error.
|
||||
*/
|
||||
class AddressNotFoundException extends GeoIp2Exception
|
||||
{
|
||||
}
|
||||
10
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Exception/AuthenticationException.php
vendored
Normal file
10
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Exception/AuthenticationException.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Exception;
|
||||
|
||||
/**
|
||||
* This class represents a generic error.
|
||||
*/
|
||||
class AuthenticationException extends GeoIp2Exception
|
||||
{
|
||||
}
|
||||
10
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Exception/GeoIp2Exception.php
vendored
Normal file
10
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Exception/GeoIp2Exception.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Exception;
|
||||
|
||||
/**
|
||||
* This class represents a generic error.
|
||||
*/
|
||||
class GeoIp2Exception extends \Exception
|
||||
{
|
||||
}
|
||||
24
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Exception/HttpException.php
vendored
Normal file
24
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Exception/HttpException.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Exception;
|
||||
|
||||
/**
|
||||
* This class represents an HTTP transport error.
|
||||
*/
|
||||
class HttpException extends GeoIp2Exception
|
||||
{
|
||||
/**
|
||||
* The URI queried.
|
||||
*/
|
||||
public $uri;
|
||||
|
||||
public function __construct(
|
||||
$message,
|
||||
$httpStatus,
|
||||
$uri,
|
||||
\Exception $previous = null
|
||||
) {
|
||||
$this->uri = $uri;
|
||||
parent::__construct($message, $httpStatus, $previous);
|
||||
}
|
||||
}
|
||||
26
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Exception/InvalidRequestException.php
vendored
Normal file
26
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Exception/InvalidRequestException.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Exception;
|
||||
|
||||
/**
|
||||
* This class represents an error returned by MaxMind's GeoIP2
|
||||
* web service.
|
||||
*/
|
||||
class InvalidRequestException extends HttpException
|
||||
{
|
||||
/**
|
||||
* The code returned by the MaxMind web service.
|
||||
*/
|
||||
public $error;
|
||||
|
||||
public function __construct(
|
||||
$message,
|
||||
$error,
|
||||
$httpStatus,
|
||||
$uri,
|
||||
\Exception $previous = null
|
||||
) {
|
||||
$this->error = $error;
|
||||
parent::__construct($message, $httpStatus, $uri, $previous);
|
||||
}
|
||||
}
|
||||
10
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Exception/OutOfQueriesException.php
vendored
Normal file
10
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Exception/OutOfQueriesException.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Exception;
|
||||
|
||||
/**
|
||||
* This class represents a generic error.
|
||||
*/
|
||||
class OutOfQueriesException extends GeoIp2Exception
|
||||
{
|
||||
}
|
||||
67
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Model/AbstractModel.php
vendored
Normal file
67
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Model/AbstractModel.php
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Model;
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
abstract class AbstractModel implements \JsonSerializable
|
||||
{
|
||||
protected $raw;
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*
|
||||
* @param mixed $raw
|
||||
*/
|
||||
public function __construct($raw)
|
||||
{
|
||||
$this->raw = $raw;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*
|
||||
* @param mixed $field
|
||||
*/
|
||||
protected function get($field)
|
||||
{
|
||||
if (isset($this->raw[$field])) {
|
||||
return $this->raw[$field];
|
||||
}
|
||||
if (preg_match('/^is_/', $field)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*
|
||||
* @param mixed $attr
|
||||
*/
|
||||
public function __get($attr)
|
||||
{
|
||||
if ($attr !== 'instance' && property_exists($this, $attr)) {
|
||||
return $this->$attr;
|
||||
}
|
||||
|
||||
throw new \RuntimeException("Unknown attribute: $attr");
|
||||
}
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*
|
||||
* @param mixed $attr
|
||||
*/
|
||||
public function __isset($attr)
|
||||
{
|
||||
return $attr !== 'instance' && isset($this->$attr);
|
||||
}
|
||||
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->raw;
|
||||
}
|
||||
}
|
||||
46
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Model/AnonymousIp.php
vendored
Normal file
46
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Model/AnonymousIp.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Model;
|
||||
|
||||
/**
|
||||
* This class provides the GeoIP2 Anonymous IP model.
|
||||
*
|
||||
* @property-read bool $isAnonymous This is true if the IP address belongs to
|
||||
* any sort of anonymous network.
|
||||
* @property-read bool $isAnonymousVpn This is true if the IP address belongs to
|
||||
* an anonymous VPN system.
|
||||
* @property-read bool $isHostingProvider This is true if the IP address belongs
|
||||
* to a hosting provider.
|
||||
* @property-read bool $isPublicProxy This is true if the IP address belongs to
|
||||
* a public proxy.
|
||||
* @property-read bool $isTorExitNode This is true if the IP address is a Tor
|
||||
* exit node.
|
||||
* @property-read string $ipAddress The IP address that the data in the model is
|
||||
* for.
|
||||
*/
|
||||
class AnonymousIp extends AbstractModel
|
||||
{
|
||||
protected $isAnonymous;
|
||||
protected $isAnonymousVpn;
|
||||
protected $isHostingProvider;
|
||||
protected $isPublicProxy;
|
||||
protected $isTorExitNode;
|
||||
protected $ipAddress;
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*
|
||||
* @param mixed $raw
|
||||
*/
|
||||
public function __construct($raw)
|
||||
{
|
||||
parent::__construct($raw);
|
||||
|
||||
$this->isAnonymous = $this->get('is_anonymous');
|
||||
$this->isAnonymousVpn = $this->get('is_anonymous_vpn');
|
||||
$this->isHostingProvider = $this->get('is_hosting_provider');
|
||||
$this->isPublicProxy = $this->get('is_public_proxy');
|
||||
$this->isTorExitNode = $this->get('is_tor_exit_node');
|
||||
$this->ipAddress = $this->get('ip_address');
|
||||
}
|
||||
}
|
||||
35
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Model/Asn.php
vendored
Normal file
35
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Model/Asn.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Model;
|
||||
|
||||
/**
|
||||
* This class provides the GeoLite2 ASN model.
|
||||
*
|
||||
* @property-read int|null $autonomousSystemNumber The autonomous system number
|
||||
* associated with the IP address.
|
||||
* @property-read string|null $autonomousSystemOrganization The organization
|
||||
* associated with the registered autonomous system number for the IP
|
||||
* address.
|
||||
* @property-read string $ipAddress The IP address that the data in the model is
|
||||
* for.
|
||||
*/
|
||||
class Asn extends AbstractModel
|
||||
{
|
||||
protected $autonomousSystemNumber;
|
||||
protected $autonomousSystemOrganization;
|
||||
protected $ipAddress;
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*
|
||||
* @param mixed $raw
|
||||
*/
|
||||
public function __construct($raw)
|
||||
{
|
||||
parent::__construct($raw);
|
||||
$this->autonomousSystemNumber = $this->get('autonomous_system_number');
|
||||
$this->autonomousSystemOrganization =
|
||||
$this->get('autonomous_system_organization');
|
||||
$this->ipAddress = $this->get('ip_address');
|
||||
}
|
||||
}
|
||||
133
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Model/City.php
vendored
Normal file
133
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Model/City.php
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Model;
|
||||
|
||||
/**
|
||||
* Model class for the data returned by GeoIP2 City web service and database.
|
||||
*
|
||||
* The only difference between the City and Insights model classes is which
|
||||
* fields in each record may be populated. See
|
||||
* https://dev.maxmind.com/geoip/geoip2/web-services more details.
|
||||
*
|
||||
* @property-read \GeoIp2\Record\City $city City data for the requested IP
|
||||
* address.
|
||||
* @property-read \GeoIp2\Record\Continent $continent Continent data for the
|
||||
* requested IP address.
|
||||
* @property-read \GeoIp2\Record\Country $country Country data for the requested
|
||||
* IP address. This object represents the country where MaxMind believes the
|
||||
* end user is located.
|
||||
* @property-read \GeoIp2\Record\Location $location Location data for the
|
||||
* requested IP address.
|
||||
* @property-read \GeoIp2\Record\Postal $postal Postal data for the
|
||||
* requested IP address.
|
||||
* @property-read \GeoIp2\Record\MaxMind $maxmind Data related to your MaxMind
|
||||
* account.
|
||||
* @property-read \GeoIp2\Record\Country $registeredCountry Registered country
|
||||
* data for the requested IP address. This record represents the country
|
||||
* where the ISP has registered a given IP block and may differ from the
|
||||
* user's country.
|
||||
* @property-read \GeoIp2\Record\RepresentedCountry $representedCountry
|
||||
* Represented country data for the requested IP address. The represented
|
||||
* country is used for things like military bases. It is only present when
|
||||
* the represented country differs from the country.
|
||||
* @property-read array $subdivisions An array of {@link \GeoIp2\Record\Subdivision}
|
||||
* objects representing the country subdivisions for the requested IP
|
||||
* address. The number and type of subdivisions varies by country, but a
|
||||
* subdivision is typically a state, province, county, etc. Subdivisions
|
||||
* are ordered from most general (largest) to most specific (smallest).
|
||||
* If the response did not contain any subdivisions, this method returns
|
||||
* an empty array.
|
||||
* @property-read \GeoIp2\Record\Subdivision $mostSpecificSubdivision An object
|
||||
* representing the most specific subdivision returned. If the response
|
||||
* did not contain any subdivisions, this method returns an empty
|
||||
* {@link \GeoIp2\Record\Subdivision} object.
|
||||
* @property-read \GeoIp2\Record\Traits $traits Data for the traits of the
|
||||
* requested IP address.
|
||||
*/
|
||||
class City extends Country
|
||||
{
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
protected $city;
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
protected $location;
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
protected $postal;
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
protected $subdivisions = [];
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*
|
||||
* @param mixed $raw
|
||||
* @param mixed $locales
|
||||
*/
|
||||
public function __construct($raw, $locales = ['en'])
|
||||
{
|
||||
parent::__construct($raw, $locales);
|
||||
|
||||
$this->city = new \GeoIp2\Record\City($this->get('city'), $locales);
|
||||
$this->location = new \GeoIp2\Record\Location($this->get('location'));
|
||||
$this->postal = new \GeoIp2\Record\Postal($this->get('postal'));
|
||||
|
||||
$this->createSubdivisions($raw, $locales);
|
||||
}
|
||||
|
||||
private function createSubdivisions($raw, $locales)
|
||||
{
|
||||
if (!isset($raw['subdivisions'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($raw['subdivisions'] as $sub) {
|
||||
array_push(
|
||||
$this->subdivisions,
|
||||
new \GeoIp2\Record\Subdivision($sub, $locales)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*
|
||||
* @param mixed $attr
|
||||
*/
|
||||
public function __get($attr)
|
||||
{
|
||||
if ($attr === 'mostSpecificSubdivision') {
|
||||
return $this->$attr();
|
||||
}
|
||||
|
||||
return parent::__get($attr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*
|
||||
* @param mixed $attr
|
||||
*/
|
||||
public function __isset($attr)
|
||||
{
|
||||
if ($attr === 'mostSpecificSubdivision') {
|
||||
// We always return a mostSpecificSubdivision, even if it is the
|
||||
// empty subdivision
|
||||
return true;
|
||||
}
|
||||
|
||||
return parent::__isset($attr);
|
||||
}
|
||||
|
||||
private function mostSpecificSubdivision()
|
||||
{
|
||||
return empty($this->subdivisions) ?
|
||||
new \GeoIp2\Record\Subdivision([], $this->locales) :
|
||||
end($this->subdivisions);
|
||||
}
|
||||
}
|
||||
31
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Model/ConnectionType.php
vendored
Normal file
31
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Model/ConnectionType.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Model;
|
||||
|
||||
/**
|
||||
* This class provides the GeoIP2 Connection-Type model.
|
||||
*
|
||||
* @property-read string|null $connectionType The connection type may take the
|
||||
* following values: "Dialup", "Cable/DSL", "Corporate", "Cellular".
|
||||
* Additional values may be added in the future.
|
||||
* @property-read string $ipAddress The IP address that the data in the model is
|
||||
* for.
|
||||
*/
|
||||
class ConnectionType extends AbstractModel
|
||||
{
|
||||
protected $connectionType;
|
||||
protected $ipAddress;
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*
|
||||
* @param mixed $raw
|
||||
*/
|
||||
public function __construct($raw)
|
||||
{
|
||||
parent::__construct($raw);
|
||||
|
||||
$this->connectionType = $this->get('connection_type');
|
||||
$this->ipAddress = $this->get('ip_address');
|
||||
}
|
||||
}
|
||||
71
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Model/Country.php
vendored
Normal file
71
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Model/Country.php
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Model;
|
||||
|
||||
/**
|
||||
* Model class for the data returned by GeoIP2 Country web service and database.
|
||||
*
|
||||
* The only difference between the City and Insights model classes is which
|
||||
* fields in each record may be populated. See
|
||||
* https://dev.maxmind.com/geoip/geoip2/web-services more details.
|
||||
*
|
||||
* @property-read \GeoIp2\Record\Continent $continent Continent data for the
|
||||
* requested IP address.
|
||||
* @property-read \GeoIp2\Record\Country $country Country data for the requested
|
||||
* IP address. This object represents the country where MaxMind believes the
|
||||
* end user is located.
|
||||
* @property-read \GeoIp2\Record\MaxMind $maxmind Data related to your MaxMind
|
||||
* account.
|
||||
* @property-read \GeoIp2\Record\Country $registeredCountry Registered country
|
||||
* data for the requested IP address. This record represents the country
|
||||
* where the ISP has registered a given IP block and may differ from the
|
||||
* user's country.
|
||||
* @property-read \GeoIp2\Record\RepresentedCountry $representedCountry
|
||||
* Represented country data for the requested IP address. The represented
|
||||
* country is used for things like military bases. It is only present when
|
||||
* the represented country differs from the country.
|
||||
* @property-read \GeoIp2\Record\Traits $traits Data for the traits of the
|
||||
* requested IP address.
|
||||
*/
|
||||
class Country extends AbstractModel
|
||||
{
|
||||
protected $continent;
|
||||
protected $country;
|
||||
protected $locales;
|
||||
protected $maxmind;
|
||||
protected $registeredCountry;
|
||||
protected $representedCountry;
|
||||
protected $traits;
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*
|
||||
* @param mixed $raw
|
||||
* @param mixed $locales
|
||||
*/
|
||||
public function __construct($raw, $locales = ['en'])
|
||||
{
|
||||
parent::__construct($raw);
|
||||
|
||||
$this->continent = new \GeoIp2\Record\Continent(
|
||||
$this->get('continent'),
|
||||
$locales
|
||||
);
|
||||
$this->country = new \GeoIp2\Record\Country(
|
||||
$this->get('country'),
|
||||
$locales
|
||||
);
|
||||
$this->maxmind = new \GeoIp2\Record\MaxMind($this->get('maxmind'));
|
||||
$this->registeredCountry = new \GeoIp2\Record\Country(
|
||||
$this->get('registered_country'),
|
||||
$locales
|
||||
);
|
||||
$this->representedCountry = new \GeoIp2\Record\RepresentedCountry(
|
||||
$this->get('represented_country'),
|
||||
$locales
|
||||
);
|
||||
$this->traits = new \GeoIp2\Record\Traits($this->get('traits'));
|
||||
|
||||
$this->locales = $locales;
|
||||
}
|
||||
}
|
||||
31
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Model/Domain.php
vendored
Normal file
31
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Model/Domain.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Model;
|
||||
|
||||
/**
|
||||
* This class provides the GeoIP2 Domain model.
|
||||
*
|
||||
* @property-read string|null $domain The second level domain associated with the
|
||||
* IP address. This will be something like "example.com" or
|
||||
* "example.co.uk", not "foo.example.com".
|
||||
* @property-read string $ipAddress The IP address that the data in the model is
|
||||
* for.
|
||||
*/
|
||||
class Domain extends AbstractModel
|
||||
{
|
||||
protected $domain;
|
||||
protected $ipAddress;
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*
|
||||
* @param mixed $raw
|
||||
*/
|
||||
public function __construct($raw)
|
||||
{
|
||||
parent::__construct($raw);
|
||||
|
||||
$this->domain = $this->get('domain');
|
||||
$this->ipAddress = $this->get('ip_address');
|
||||
}
|
||||
}
|
||||
47
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Model/Enterprise.php
vendored
Normal file
47
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Model/Enterprise.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Model;
|
||||
|
||||
/**
|
||||
* Model class for the data returned by GeoIP2 Enterprise database lookups.
|
||||
*
|
||||
* The only difference between the City and Enterprise model classes is which
|
||||
* fields in each record may be populated. See
|
||||
* https://dev.maxmind.com/geoip/geoip2/web-services more details.
|
||||
*
|
||||
* @property-read \GeoIp2\Record\City $city City data for the requested IP
|
||||
* address.
|
||||
* @property-read \GeoIp2\Record\Continent $continent Continent data for the
|
||||
* requested IP address.
|
||||
* @property-read \GeoIp2\Record\Country $country Country data for the requested
|
||||
* IP address. This object represents the country where MaxMind believes the
|
||||
* end user is located.
|
||||
* @property-read \GeoIp2\Record\Location $location Location data for the
|
||||
* requested IP address.
|
||||
* @property-read \GeoIp2\Record\MaxMind $maxmind Data related to your MaxMind
|
||||
* account.
|
||||
* @property-read \GeoIp2\Record\Country $registeredCountry Registered country
|
||||
* data for the requested IP address. This record represents the country
|
||||
* where the ISP has registered a given IP block and may differ from the
|
||||
* user's country.
|
||||
* @property-read \GeoIp2\Record\RepresentedCountry $representedCountry
|
||||
* Represented country data for the requested IP address. The represented
|
||||
* country is used for things like military bases. It is only present when
|
||||
* the represented country differs from the country.
|
||||
* @property-read array $subdivisions An array of {@link \GeoIp2\Record\Subdivision}
|
||||
* objects representing the country subdivisions for the requested IP
|
||||
* address. The number and type of subdivisions varies by country, but a
|
||||
* subdivision is typically a state, province, county, etc. Subdivisions
|
||||
* are ordered from most general (largest) to most specific (smallest).
|
||||
* If the response did not contain any subdivisions, this method returns
|
||||
* an empty array.
|
||||
* @property-read \GeoIp2\Record\Subdivision $mostSpecificSubdivision An object
|
||||
* representing the most specific subdivision returned. If the response
|
||||
* did not contain any subdivisions, this method returns an empty
|
||||
* {@link \GeoIp2\Record\Subdivision} object.
|
||||
* @property-read \GeoIp2\Record\Traits $traits Data for the traits of the
|
||||
* requested IP address.
|
||||
*/
|
||||
class Enterprise extends City
|
||||
{
|
||||
}
|
||||
47
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Model/Insights.php
vendored
Normal file
47
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Model/Insights.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Model;
|
||||
|
||||
/**
|
||||
* Model class for the data returned by GeoIP2 Precision: Insights web service.
|
||||
*
|
||||
* The only difference between the City and Insights model classes is which
|
||||
* fields in each record may be populated. See
|
||||
* https://dev.maxmind.com/geoip/geoip2/web-services more details.
|
||||
*
|
||||
* @property-read \GeoIp2\Record\City $city City data for the requested IP
|
||||
* address.
|
||||
* @property-read \GeoIp2\Record\Continent $continent Continent data for the
|
||||
* requested IP address.
|
||||
* @property-read \GeoIp2\Record\Country $country Country data for the requested
|
||||
* IP address. This object represents the country where MaxMind believes the
|
||||
* end user is located.
|
||||
* @property-read \GeoIp2\Record\Location $location Location data for the
|
||||
* requested IP address.
|
||||
* @property-read \GeoIp2\Record\MaxMind $maxmind Data related to your MaxMind
|
||||
* account.
|
||||
* @property-read \GeoIp2\Record\Country $registeredCountry Registered country
|
||||
* data for the requested IP address. This record represents the country
|
||||
* where the ISP has registered a given IP block and may differ from the
|
||||
* user's country.
|
||||
* @property-read \GeoIp2\Record\RepresentedCountry $representedCountry
|
||||
* Represented country data for the requested IP address. The represented
|
||||
* country is used for things like military bases. It is only present when
|
||||
* the represented country differs from the country.
|
||||
* @property-read array $subdivisions An array of {@link \GeoIp2\Record\Subdivision}
|
||||
* objects representing the country subdivisions for the requested IP
|
||||
* address. The number and type of subdivisions varies by country, but a
|
||||
* subdivision is typically a state, province, county, etc. Subdivisions
|
||||
* are ordered from most general (largest) to most specific (smallest).
|
||||
* If the response did not contain any subdivisions, this method returns
|
||||
* an empty array.
|
||||
* @property-read \GeoIp2\Record\Subdivision $mostSpecificSubdivision An object
|
||||
* representing the most specific subdivision returned. If the response
|
||||
* did not contain any subdivisions, this method returns an empty
|
||||
* {@link \GeoIp2\Record\Subdivision} object.
|
||||
* @property-read \GeoIp2\Record\Traits $traits Data for the traits of the
|
||||
* requested IP address.
|
||||
*/
|
||||
class Insights extends City
|
||||
{
|
||||
}
|
||||
44
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Model/Isp.php
vendored
Normal file
44
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Model/Isp.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Model;
|
||||
|
||||
/**
|
||||
* This class provides the GeoIP2 ISP model.
|
||||
*
|
||||
* @property-read int|null $autonomousSystemNumber The autonomous system number
|
||||
* associated with the IP address.
|
||||
* @property-read string|null $autonomousSystemOrganization The organization
|
||||
* associated with the registered autonomous system number for the IP
|
||||
* address.
|
||||
* @property-read string|null $isp The name of the ISP associated with the IP
|
||||
* address.
|
||||
* @property-read string|null $organization The name of the organization associated
|
||||
* with the IP address.
|
||||
* @property-read string $ipAddress The IP address that the data in the model is
|
||||
* for.
|
||||
*/
|
||||
class Isp extends AbstractModel
|
||||
{
|
||||
protected $autonomousSystemNumber;
|
||||
protected $autonomousSystemOrganization;
|
||||
protected $isp;
|
||||
protected $organization;
|
||||
protected $ipAddress;
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*
|
||||
* @param mixed $raw
|
||||
*/
|
||||
public function __construct($raw)
|
||||
{
|
||||
parent::__construct($raw);
|
||||
$this->autonomousSystemNumber = $this->get('autonomous_system_number');
|
||||
$this->autonomousSystemOrganization =
|
||||
$this->get('autonomous_system_organization');
|
||||
$this->isp = $this->get('isp');
|
||||
$this->organization = $this->get('organization');
|
||||
|
||||
$this->ipAddress = $this->get('ip_address');
|
||||
}
|
||||
}
|
||||
20
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/ProviderInterface.php
vendored
Normal file
20
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/ProviderInterface.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2;
|
||||
|
||||
interface ProviderInterface
|
||||
{
|
||||
/**
|
||||
* @param string $ipAddress an IPv4 or IPv6 address to lookup
|
||||
*
|
||||
* @return \GeoIp2\Model\Country a Country model for the requested IP address
|
||||
*/
|
||||
public function country($ipAddress);
|
||||
|
||||
/**
|
||||
* @param string $ipAddress an IPv4 or IPv6 address to lookup
|
||||
*
|
||||
* @return \GeoIp2\Model\City a City model for the requested IP address
|
||||
*/
|
||||
public function city($ipAddress);
|
||||
}
|
||||
66
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Record/AbstractPlaceRecord.php
vendored
Normal file
66
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Record/AbstractPlaceRecord.php
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Record;
|
||||
|
||||
abstract class AbstractPlaceRecord extends AbstractRecord
|
||||
{
|
||||
private $locales;
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*
|
||||
* @param mixed $record
|
||||
* @param mixed $locales
|
||||
*/
|
||||
public function __construct($record, $locales = ['en'])
|
||||
{
|
||||
$this->locales = $locales;
|
||||
parent::__construct($record);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*
|
||||
* @param mixed $attr
|
||||
*/
|
||||
public function __get($attr)
|
||||
{
|
||||
if ($attr === 'name') {
|
||||
return $this->name();
|
||||
}
|
||||
|
||||
return parent::__get($attr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*
|
||||
* @param mixed $attr
|
||||
*/
|
||||
public function __isset($attr)
|
||||
{
|
||||
if ($attr === 'name') {
|
||||
return $this->firstSetNameLocale() === null ? false : true;
|
||||
}
|
||||
|
||||
return parent::__isset($attr);
|
||||
}
|
||||
|
||||
private function name()
|
||||
{
|
||||
$locale = $this->firstSetNameLocale();
|
||||
|
||||
return $locale === null ? null : $this->names[$locale];
|
||||
}
|
||||
|
||||
private function firstSetNameLocale()
|
||||
{
|
||||
foreach ($this->locales as $locale) {
|
||||
if (isset($this->names[$locale])) {
|
||||
return $locale;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
61
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Record/AbstractRecord.php
vendored
Normal file
61
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Record/AbstractRecord.php
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Record;
|
||||
|
||||
abstract class AbstractRecord implements \JsonSerializable
|
||||
{
|
||||
private $record;
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*
|
||||
* @param mixed $record
|
||||
*/
|
||||
public function __construct($record)
|
||||
{
|
||||
$this->record = isset($record) ? $record : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*
|
||||
* @param mixed $attr
|
||||
*/
|
||||
public function __get($attr)
|
||||
{
|
||||
// XXX - kind of ugly but greatly reduces boilerplate code
|
||||
$key = $this->attributeToKey($attr);
|
||||
|
||||
if ($this->__isset($attr)) {
|
||||
return $this->record[$key];
|
||||
} elseif ($this->validAttribute($attr)) {
|
||||
if (preg_match('/^is_/', $key)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
throw new \RuntimeException("Unknown attribute: $attr");
|
||||
}
|
||||
|
||||
public function __isset($attr)
|
||||
{
|
||||
return $this->validAttribute($attr) &&
|
||||
isset($this->record[$this->attributeToKey($attr)]);
|
||||
}
|
||||
|
||||
private function attributeToKey($attr)
|
||||
{
|
||||
return strtolower(preg_replace('/([A-Z])/', '_\1', $attr));
|
||||
}
|
||||
|
||||
private function validAttribute($attr)
|
||||
{
|
||||
return in_array($attr, $this->validAttributes, true);
|
||||
}
|
||||
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->record;
|
||||
}
|
||||
}
|
||||
29
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Record/City.php
vendored
Normal file
29
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Record/City.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Record;
|
||||
|
||||
/**
|
||||
* City-level data associated with an IP address.
|
||||
*
|
||||
* This record is returned by all location services and databases besides
|
||||
* Country.
|
||||
*
|
||||
* @property-read int|null $confidence A value from 0-100 indicating MaxMind's
|
||||
* confidence that the city is correct. This attribute is only available
|
||||
* from the Insights service and the GeoIP2 Enterprise database.
|
||||
* @property-read int|null $geonameId The GeoName ID for the city. This attribute
|
||||
* is returned by all location services and databases.
|
||||
* @property-read string|null $name The name of the city based on the locales list
|
||||
* passed to the constructor. This attribute is returned by all location
|
||||
* services and databases.
|
||||
* @property-read array|null $names A array map where the keys are locale codes
|
||||
* and the values are names. This attribute is returned by all location
|
||||
* services and databases.
|
||||
*/
|
||||
class City extends AbstractPlaceRecord
|
||||
{
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
protected $validAttributes = ['confidence', 'geonameId', 'names'];
|
||||
}
|
||||
32
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Record/Continent.php
vendored
Normal file
32
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Record/Continent.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Record;
|
||||
|
||||
/**
|
||||
* Contains data for the continent record associated with an IP address.
|
||||
*
|
||||
* This record is returned by all location services and databases.
|
||||
*
|
||||
* @property-read string|null $code A two character continent code like "NA" (North
|
||||
* America) or "OC" (Oceania). This attribute is returned by all location
|
||||
* services and databases.
|
||||
* @property-read int|null $geonameId The GeoName ID for the continent. This
|
||||
* attribute is returned by all location services and databases.
|
||||
* @property-read string|null $name Returns the name of the continent based on the
|
||||
* locales list passed to the constructor. This attribute is returned by all location
|
||||
* services and databases.
|
||||
* @property-read array|null $names An array map where the keys are locale codes
|
||||
* and the values are names. This attribute is returned by all location
|
||||
* services and databases.
|
||||
*/
|
||||
class Continent extends AbstractPlaceRecord
|
||||
{
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
protected $validAttributes = [
|
||||
'code',
|
||||
'geonameId',
|
||||
'names',
|
||||
];
|
||||
}
|
||||
37
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Record/Country.php
vendored
Normal file
37
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Record/Country.php
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Record;
|
||||
|
||||
/**
|
||||
* Contains data for the country record associated with an IP address.
|
||||
*
|
||||
* This record is returned by all location services and databases.
|
||||
*
|
||||
* @property-read int|null $confidence A value from 0-100 indicating MaxMind's
|
||||
* confidence that the country is correct. This attribute is only available
|
||||
* from the Insights service and the GeoIP2 Enterprise database.
|
||||
* @property-read int|null $geonameId The GeoName ID for the country. This
|
||||
* attribute is returned by location services and databases.
|
||||
* @property-read string|null $isoCode The
|
||||
* {@link * https://en.wikipedia.org/wiki/ISO_3166-1 two-character ISO 3166-1 alpha
|
||||
* code} for the country. This attribute is returned by all location services
|
||||
* and databases.
|
||||
* @property-read string|null $name The name of the country based on the locales
|
||||
* list passed to the constructor. This attribute is returned by all location
|
||||
* services and databases.
|
||||
* @property-read array|null $names An array map where the keys are locale codes
|
||||
* and the values are names. This attribute is returned by all location
|
||||
* services and databases.
|
||||
*/
|
||||
class Country extends AbstractPlaceRecord
|
||||
{
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
protected $validAttributes = [
|
||||
'confidence',
|
||||
'geonameId',
|
||||
'isoCode',
|
||||
'names',
|
||||
];
|
||||
}
|
||||
52
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Record/Location.php
vendored
Normal file
52
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Record/Location.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Record;
|
||||
|
||||
/**
|
||||
* Contains data for the location record associated with an IP address.
|
||||
*
|
||||
* This record is returned by all location services and databases besides
|
||||
* Country.
|
||||
*
|
||||
* @property-read int|null $averageIncome The average income in US dollars
|
||||
* associated with the requested IP address. This attribute is only available
|
||||
* from the Insights service.
|
||||
* @property-read int|null $accuracyRadius The approximate accuracy radius in
|
||||
* kilometers around the latitude and longitude for the IP address. This is
|
||||
* the radius where we have a 67% confidence that the device using the IP
|
||||
* address resides within the circle centered at the latitude and longitude
|
||||
* with the provided radius.
|
||||
* @property-read float|null $latitude The approximate latitude of the location
|
||||
* associated with the IP address. This value is not precise and should not be
|
||||
* used to identify a particular address or household.
|
||||
* @property-read float|null $longitude The approximate longitude of the location
|
||||
* associated with the IP address. This value is not precise and should not be
|
||||
* used to identify a particular address or household.
|
||||
* @property-read int|null $populationDensity The estimated population per square
|
||||
* kilometer associated with the IP address. This attribute is only available
|
||||
* from the Insights service.
|
||||
* @property-read int|null $metroCode The metro code of the location if the location
|
||||
* is in the US. MaxMind returns the same metro codes as the
|
||||
* {@link * https://developers.google.com/adwords/api/docs/appendix/cities-DMAregions
|
||||
* Google AdWords API}.
|
||||
* @property-read string|null $timeZone The time zone associated with location, as
|
||||
* specified by the {@link https://www.iana.org/time-zones IANA Time Zone
|
||||
* Database}, e.g., "America/New_York".
|
||||
*/
|
||||
class Location extends AbstractRecord
|
||||
{
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
protected $validAttributes = [
|
||||
'averageIncome',
|
||||
'accuracyRadius',
|
||||
'latitude',
|
||||
'longitude',
|
||||
'metroCode',
|
||||
'populationDensity',
|
||||
'postalCode',
|
||||
'postalConfidence',
|
||||
'timeZone',
|
||||
];
|
||||
}
|
||||
19
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Record/MaxMind.php
vendored
Normal file
19
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Record/MaxMind.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Record;
|
||||
|
||||
/**
|
||||
* Contains data about your account.
|
||||
*
|
||||
* This record is returned by all location services and databases.
|
||||
*
|
||||
* @property-read int|null $queriesRemaining The number of remaining queries you
|
||||
* have for the service you are calling.
|
||||
*/
|
||||
class MaxMind extends AbstractRecord
|
||||
{
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
protected $validAttributes = ['queriesRemaining'];
|
||||
}
|
||||
26
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Record/Postal.php
vendored
Normal file
26
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Record/Postal.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Record;
|
||||
|
||||
/**
|
||||
* Contains data for the postal record associated with an IP address.
|
||||
*
|
||||
* This record is returned by all location databases and services besides
|
||||
* Country.
|
||||
*
|
||||
* @property-read string|null $code The postal code of the location. Postal codes
|
||||
* are not available for all countries. In some countries, this will only
|
||||
* contain part of the postal code. This attribute is returned by all location
|
||||
* databases and services besides Country.
|
||||
* @property-read int|null $confidence A value from 0-100 indicating MaxMind's
|
||||
* confidence that the postal code is correct. This attribute is only
|
||||
* available from the Insights service and the GeoIP2 Enterprise
|
||||
* database.
|
||||
*/
|
||||
class Postal extends AbstractRecord
|
||||
{
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
protected $validAttributes = ['code', 'confidence'];
|
||||
}
|
||||
35
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Record/RepresentedCountry.php
vendored
Normal file
35
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Record/RepresentedCountry.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Record;
|
||||
|
||||
/**
|
||||
* Contains data for the represented country associated with an IP address.
|
||||
*
|
||||
* This class contains the country-level data associated with an IP address
|
||||
* for the IP's represented country. The represented country is the country
|
||||
* represented by something like a military base.
|
||||
*
|
||||
* @property-read int|null $confidence A value from 0-100 indicating MaxMind's
|
||||
* confidence that the country is correct. This attribute is only available
|
||||
* from the Insights service and the GeoIP2 Enterprise database.
|
||||
* @property-read int|null $geonameId The GeoName ID for the country.
|
||||
* @property-read string|null $isoCode The {@link https://en.wikipedia.org/wiki/ISO_3166-1
|
||||
* two-character ISO 3166-1 alpha code} for the country.
|
||||
* @property-read string|null $name The name of the country based on the locales list
|
||||
* passed to the constructor.
|
||||
* @property-read array|null $names An array map where the keys are locale codes and
|
||||
* the values are names.
|
||||
* @property-read string|null $type A string indicating the type of entity that is
|
||||
* representing the country. Currently we only return <code>military</code>
|
||||
* but this could expand to include other types in the future.
|
||||
*/
|
||||
class RepresentedCountry extends Country
|
||||
{
|
||||
protected $validAttributes = [
|
||||
'confidence',
|
||||
'geonameId',
|
||||
'isoCode',
|
||||
'names',
|
||||
'type',
|
||||
];
|
||||
}
|
||||
40
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Record/Subdivision.php
vendored
Normal file
40
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Record/Subdivision.php
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Record;
|
||||
|
||||
/**
|
||||
* Contains data for the subdivisions associated with an IP address.
|
||||
*
|
||||
* This record is returned by all location databases and services besides
|
||||
* Country.
|
||||
*
|
||||
* @property-read int|null $confidence This is a value from 0-100 indicating
|
||||
* MaxMind's confidence that the subdivision is correct. This attribute is
|
||||
* only available from the Insights service and the GeoIP2 Enterprise
|
||||
* database.
|
||||
* @property-read int|null $geonameId This is a GeoName ID for the subdivision.
|
||||
* This attribute is returned by all location databases and services besides
|
||||
* Country.
|
||||
* @property-read string|null $isoCode This is a string up to three characters long
|
||||
* contain the subdivision portion of the
|
||||
* {@link * https://en.wikipedia.org/wiki/ISO_3166-2 ISO 3166-2 code}. This attribute
|
||||
* is returned by all location databases and services except Country.
|
||||
* @property-read string|null $name The name of the subdivision based on the
|
||||
* locales list passed to the constructor. This attribute is returned by all
|
||||
* location databases and services besides Country.
|
||||
* @property-read array|null $names An array map where the keys are locale codes
|
||||
* and the values are names. This attribute is returned by all location
|
||||
* databases and services besides Country.
|
||||
*/
|
||||
class Subdivision extends AbstractPlaceRecord
|
||||
{
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
protected $validAttributes = [
|
||||
'confidence',
|
||||
'geonameId',
|
||||
'isoCode',
|
||||
'names',
|
||||
];
|
||||
}
|
||||
114
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Record/Traits.php
vendored
Normal file
114
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Record/Traits.php
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Record;
|
||||
|
||||
/**
|
||||
* Contains data for the traits record associated with an IP address.
|
||||
*
|
||||
* This record is returned by all location services and databases.
|
||||
*
|
||||
* @property-read int|null $autonomousSystemNumber The
|
||||
* {@link * https://en.wikipedia.org/wiki/Autonomous_system_(Internet) autonomous
|
||||
* system number} associated with the IP address. This attribute is only
|
||||
* available from the City and Insights web service and the GeoIP2
|
||||
* Enterprise database.
|
||||
* @property-read string|null $autonomousSystemOrganization The organization
|
||||
* associated with the registered {@link * https://en.wikipedia.org/wiki/Autonomous_system_(Internet) autonomous
|
||||
* system number} for the IP address. This attribute is only available from
|
||||
* the City and Insights web service and the GeoIP2 Enterprise
|
||||
* database.
|
||||
* @property-read string|null $connectionType The connection type may take the
|
||||
* following values: "Dialup", "Cable/DSL", "Corporate", "Cellular".
|
||||
* Additional values may be added in the future. This attribute is only
|
||||
* available in the GeoIP2 Enterprise database.
|
||||
* @property-read string|null $domain The second level domain associated with the
|
||||
* IP address. This will be something like "example.com" or "example.co.uk",
|
||||
* not "foo.example.com". This attribute is only available from the
|
||||
* City and Insights web service and the GeoIP2 Enterprise
|
||||
* database.
|
||||
* @property-read string $ipAddress The IP address that the data in the model
|
||||
* is for. If you performed a "me" lookup against the web service, this
|
||||
* will be the externally routable IP address for the system the code is
|
||||
* running on. If the system is behind a NAT, this may differ from the IP
|
||||
* address locally assigned to it. This attribute is returned by all end
|
||||
* points.
|
||||
* @property-read bool $isAnonymous This is true if the IP address belongs to
|
||||
* any sort of anonymous network. This property is only available from GeoIP2
|
||||
* Precision Insights.
|
||||
* @property-read bool $isAnonymousProxy *Deprecated.* Please see our
|
||||
* {@link * https://www.maxmind.com/en/geoip2-anonymous-ip-database GeoIP2
|
||||
* Anonymous IP database} to determine whether the IP address is used by an
|
||||
* anonymizing service.
|
||||
* @property-read bool $isAnonymousVpn This is true if the IP address belongs to
|
||||
* an anonymous VPN system. This property is only available from GeoIP2
|
||||
* Precision Insights.
|
||||
* @property-read bool $isHostingProvider This is true if the IP address belongs
|
||||
* to a hosting provider. This property is only available from GeoIP2
|
||||
* Precision Insights.
|
||||
* @property-read bool $isLegitimateProxy This attribute is true if MaxMind
|
||||
* believes this IP address to be a legitimate proxy, such as an internal
|
||||
* VPN used by a corporation. This attribute is only available in the GeoIP2
|
||||
* Enterprise database.
|
||||
* @property-read bool $isPublicProxy This is true if the IP address belongs to
|
||||
* a public proxy. This property is only available from GeoIP2 Precision
|
||||
* Insights.
|
||||
* @property-read bool $isSatelliteProvider *Deprecated.* Due to the
|
||||
* increased coverage by mobile carriers, very few satellite providers now
|
||||
* serve multiple countries. As a result, the output does not provide
|
||||
* sufficiently relevant data for us to maintain it.
|
||||
* @property-read bool $isTorExitNode This is true if the IP address is a Tor
|
||||
* exit node. This property is only available from GeoIP2 Precision Insights.
|
||||
* @property-read string|null $isp The name of the ISP associated with the IP
|
||||
* address. This attribute is only available from the City and Insights web
|
||||
* services and the GeoIP2 Enterprise database.
|
||||
* @property-read string|null $organization The name of the organization associated
|
||||
* with the IP address. This attribute is only available from the City and
|
||||
* Insights web services and the GeoIP2 Enterprise database.
|
||||
* @property-read string|null $userType <p>The user type associated with the IP
|
||||
* address. This can be one of the following values:</p>
|
||||
* <ul>
|
||||
* <li>business
|
||||
* <li>cafe
|
||||
* <li>cellular
|
||||
* <li>college
|
||||
* <li>content_delivery_network
|
||||
* <li>dialup
|
||||
* <li>government
|
||||
* <li>hosting
|
||||
* <li>library
|
||||
* <li>military
|
||||
* <li>residential
|
||||
* <li>router
|
||||
* <li>school
|
||||
* <li>search_engine_spider
|
||||
* <li>traveler
|
||||
* </ul>
|
||||
* <p>
|
||||
* This attribute is only available from the Insights web service and the
|
||||
* GeoIP2 Enterprise database.
|
||||
* </p>
|
||||
*/
|
||||
class Traits extends AbstractRecord
|
||||
{
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
protected $validAttributes = [
|
||||
'autonomousSystemNumber',
|
||||
'autonomousSystemOrganization',
|
||||
'connectionType',
|
||||
'domain',
|
||||
'ipAddress',
|
||||
'isAnonymous',
|
||||
'isAnonymousProxy',
|
||||
'isAnonymousVpn',
|
||||
'isHostingProvider',
|
||||
'isLegitimateProxy',
|
||||
'isp',
|
||||
'isPublicProxy',
|
||||
'isSatelliteProvider',
|
||||
'isTorExitNode',
|
||||
'organization',
|
||||
'userType',
|
||||
];
|
||||
}
|
||||
239
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/WebService/Client.php
vendored
Normal file
239
wp/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/WebService/Client.php
vendored
Normal file
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\WebService;
|
||||
|
||||
use GeoIp2\Exception\AddressNotFoundException;
|
||||
use GeoIp2\Exception\AuthenticationException;
|
||||
use GeoIp2\Exception\GeoIp2Exception;
|
||||
use GeoIp2\Exception\HttpException;
|
||||
use GeoIp2\Exception\InvalidRequestException;
|
||||
use GeoIp2\Exception\OutOfQueriesException;
|
||||
use GeoIp2\ProviderInterface;
|
||||
use MaxMind\WebService\Client as WsClient;
|
||||
|
||||
/**
|
||||
* This class provides a client API for all the GeoIP2 Precision web services.
|
||||
* The services are Country, City, and Insights. Each service returns a
|
||||
* different set of data about an IP address, with Country returning the
|
||||
* least data and Insights the most.
|
||||
*
|
||||
* Each web service is represented by a different model class, and these model
|
||||
* classes in turn contain multiple record classes. The record classes have
|
||||
* attributes which contain data about the IP address.
|
||||
*
|
||||
* If the web service does not return a particular piece of data for an IP
|
||||
* address, the associated attribute is not populated.
|
||||
*
|
||||
* The web service may not return any information for an entire record, in
|
||||
* which case all of the attributes for that record class will be empty.
|
||||
*
|
||||
* ## Usage ##
|
||||
*
|
||||
* The basic API for this class is the same for all of the web service end
|
||||
* points. First you create a web service object with your MaxMind `$userId`
|
||||
* and `$licenseKey`, then you call the method corresponding to a specific end
|
||||
* point, passing it the IP address you want to look up.
|
||||
*
|
||||
* If the request succeeds, the method call will return a model class for
|
||||
* the service you called. This model in turn contains multiple record
|
||||
* classes, each of which represents part of the data returned by the web
|
||||
* service.
|
||||
*
|
||||
* If the request fails, the client class throws an exception.
|
||||
*/
|
||||
class Client implements ProviderInterface
|
||||
{
|
||||
private $locales;
|
||||
private $client;
|
||||
private static $basePath = '/geoip/v2.1';
|
||||
|
||||
const VERSION = 'v2.7.0';
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param int $userId your MaxMind user ID
|
||||
* @param string $licenseKey your MaxMind license key
|
||||
* @param array $locales list of locale codes to use in name property
|
||||
* from most preferred to least preferred
|
||||
* @param array $options array of options. Valid options include:
|
||||
* * `host` - The host to use when querying the web service.
|
||||
* * `timeout` - Timeout in seconds.
|
||||
* * `connectTimeout` - Initial connection timeout in seconds.
|
||||
* * `proxy` - The HTTP proxy to use. May include a schema, port,
|
||||
* username, and password, e.g.,
|
||||
* `http://username:password@127.0.0.1:10`.
|
||||
*/
|
||||
public function __construct(
|
||||
$userId,
|
||||
$licenseKey,
|
||||
$locales = ['en'],
|
||||
$options = []
|
||||
) {
|
||||
$this->locales = $locales;
|
||||
|
||||
// This is for backwards compatibility. Do not remove except for a
|
||||
// major version bump.
|
||||
if (is_string($options)) {
|
||||
$options = ['host' => $options];
|
||||
}
|
||||
|
||||
if (!isset($options['host'])) {
|
||||
$options['host'] = 'geoip.maxmind.com';
|
||||
}
|
||||
|
||||
$options['userAgent'] = $this->userAgent();
|
||||
|
||||
$this->client = new WsClient($userId, $licenseKey, $options);
|
||||
}
|
||||
|
||||
private function userAgent()
|
||||
{
|
||||
return 'GeoIP2-API/' . self::VERSION;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method calls the GeoIP2 Precision: City service.
|
||||
*
|
||||
* @param string $ipAddress IPv4 or IPv6 address as a string. If no
|
||||
* address is provided, the address that the web service is called
|
||||
* from will be used.
|
||||
*
|
||||
* @throws \GeoIp2\Exception\AddressNotFoundException if the address you
|
||||
* provided is not in our database (e.g., a private address).
|
||||
* @throws \GeoIp2\Exception\AuthenticationException if there is a problem
|
||||
* with the user ID or license key that you provided
|
||||
* @throws \GeoIp2\Exception\OutOfQueriesException if your account is out
|
||||
* of queries
|
||||
* @throws \GeoIp2\Exception\InvalidRequestException} if your request was received by the web service but is
|
||||
* invalid for some other reason. This may indicate an issue
|
||||
* with this API. Please report the error to MaxMind.
|
||||
* @throws \GeoIp2\Exception\HttpException if an unexpected HTTP error code or message was returned.
|
||||
* This could indicate a problem with the connection between
|
||||
* your server and the web service or that the web service
|
||||
* returned an invalid document or 500 error code.
|
||||
* @throws \GeoIp2\Exception\GeoIp2Exception This serves as the parent
|
||||
* class to the above exceptions. It will be thrown directly
|
||||
* if a 200 status code is returned but the body is invalid.
|
||||
*
|
||||
* @return \GeoIp2\Model\City
|
||||
*/
|
||||
public function city($ipAddress = 'me')
|
||||
{
|
||||
return $this->responseFor('city', 'City', $ipAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method calls the GeoIP2 Precision: Country service.
|
||||
*
|
||||
* @param string $ipAddress IPv4 or IPv6 address as a string. If no
|
||||
* address is provided, the address that the web service is called
|
||||
* from will be used.
|
||||
*
|
||||
* @throws \GeoIp2\Exception\AddressNotFoundException if the address you provided is not in our database (e.g.,
|
||||
* a private address).
|
||||
* @throws \GeoIp2\Exception\AuthenticationException if there is a problem
|
||||
* with the user ID or license key that you provided
|
||||
* @throws \GeoIp2\Exception\OutOfQueriesException if your account is out of queries
|
||||
* @throws \GeoIp2\Exception\InvalidRequestException} if your request was received by the web service but is
|
||||
* invalid for some other reason. This may indicate an
|
||||
* issue with this API. Please report the error to MaxMind.
|
||||
* @throws \GeoIp2\Exception\HttpException if an unexpected HTTP error
|
||||
* code or message was returned. This could indicate a problem
|
||||
* with the connection between your server and the web service
|
||||
* or that the web service returned an invalid document or 500
|
||||
* error code.
|
||||
* @throws \GeoIp2\Exception\GeoIp2Exception This serves as the parent class to the above exceptions. It
|
||||
* will be thrown directly if a 200 status code is returned but
|
||||
* the body is invalid.
|
||||
*
|
||||
* @return \GeoIp2\Model\Country
|
||||
*/
|
||||
public function country($ipAddress = 'me')
|
||||
{
|
||||
return $this->responseFor('country', 'Country', $ipAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method calls the GeoIP2 Precision: Insights service.
|
||||
*
|
||||
* @param string $ipAddress IPv4 or IPv6 address as a string. If no
|
||||
* address is provided, the address that the web service is called
|
||||
* from will be used.
|
||||
*
|
||||
* @throws \GeoIp2\Exception\AddressNotFoundException if the address you
|
||||
* provided is not in our database (e.g., a private address).
|
||||
* @throws \GeoIp2\Exception\AuthenticationException if there is a problem
|
||||
* with the user ID or license key that you provided
|
||||
* @throws \GeoIp2\Exception\OutOfQueriesException if your account is out
|
||||
* of queries
|
||||
* @throws \GeoIp2\Exception\InvalidRequestException} if your request was received by the web service but is
|
||||
* invalid for some other reason. This may indicate an
|
||||
* issue with this API. Please report the error to MaxMind.
|
||||
* @throws \GeoIp2\Exception\HttpException if an unexpected HTTP error code or message was returned.
|
||||
* This could indicate a problem with the connection between
|
||||
* your server and the web service or that the web service
|
||||
* returned an invalid document or 500 error code.
|
||||
* @throws \GeoIp2\Exception\GeoIp2Exception This serves as the parent
|
||||
* class to the above exceptions. It will be thrown directly
|
||||
* if a 200 status code is returned but the body is invalid.
|
||||
*
|
||||
* @return \GeoIp2\Model\Insights
|
||||
*/
|
||||
public function insights($ipAddress = 'me')
|
||||
{
|
||||
return $this->responseFor('insights', 'Insights', $ipAddress);
|
||||
}
|
||||
|
||||
private function responseFor($endpoint, $class, $ipAddress)
|
||||
{
|
||||
$path = implode('/', [self::$basePath, $endpoint, $ipAddress]);
|
||||
|
||||
try {
|
||||
$body = $this->client->get('GeoIP2 ' . $class, $path);
|
||||
} catch (\MaxMind\Exception\IpAddressNotFoundException $ex) {
|
||||
throw new AddressNotFoundException(
|
||||
$ex->getMessage(),
|
||||
$ex->getStatusCode(),
|
||||
$ex
|
||||
);
|
||||
} catch (\MaxMind\Exception\AuthenticationException $ex) {
|
||||
throw new AuthenticationException(
|
||||
$ex->getMessage(),
|
||||
$ex->getStatusCode(),
|
||||
$ex
|
||||
);
|
||||
} catch (\MaxMind\Exception\InsufficientFundsException $ex) {
|
||||
throw new OutOfQueriesException(
|
||||
$ex->getMessage(),
|
||||
$ex->getStatusCode(),
|
||||
$ex
|
||||
);
|
||||
} catch (\MaxMind\Exception\InvalidRequestException $ex) {
|
||||
throw new InvalidRequestException(
|
||||
$ex->getMessage(),
|
||||
$ex->getErrorCode(),
|
||||
$ex->getStatusCode(),
|
||||
$ex->getUri(),
|
||||
$ex
|
||||
);
|
||||
} catch (\MaxMind\Exception\HttpException $ex) {
|
||||
throw new HttpException(
|
||||
$ex->getMessage(),
|
||||
$ex->getStatusCode(),
|
||||
$ex->getUri(),
|
||||
$ex
|
||||
);
|
||||
} catch (\MaxMind\Exception\WebServiceException $ex) {
|
||||
throw new GeoIp2Exception(
|
||||
$ex->getMessage(),
|
||||
$ex->getCode(),
|
||||
$ex
|
||||
);
|
||||
}
|
||||
|
||||
$class = 'GeoIp2\\Model\\' . $class;
|
||||
|
||||
return new $class($body, $this->locales);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user