├── wordpress_version.txt ├── .gitignore ├── .github └── CODEOWNERS ├── wordpress-org-assets ├── banner-772x250.jpg ├── icon-128x128.png ├── icon-256x256.png ├── screenshot-1.jpg └── screenshot-2.jpg ├── deploy ├── Dockerfile ├── LICENSE └── entrypoint.sh ├── test ├── bin │ ├── entrypoint.sh │ └── configure-test-harness.sh ├── integration │ ├── wpengine_geoipTest.php │ ├── GeoIpSmokeTest.php │ └── GeoIpTest.php ├── bootstrap.php └── Dockerfile.integration ├── .travis.yml ├── composer.json ├── phpcs.xml.dist ├── phpunit.xml.dist ├── src ├── wpengine-geoip.php ├── js │ └── admin.js ├── class-pluginupdater.php ├── readme.txt ├── class-geoip.php └── inc │ └── country-list.php ├── Makefile ├── README.md ├── LICENSE └── composer.lock /wordpress_version.txt: -------------------------------------------------------------------------------- 1 | 6.6 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # project 2 | /build/ 3 | /vendor/ 4 | 5 | # ide 6 | .idea 7 | .vscode 8 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # All changes must be approved by someone on the Electrum Team 2 | * @wpengine/team-electrum 3 | -------------------------------------------------------------------------------- /wordpress-org-assets/banner-772x250.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpengine/geoip/HEAD/wordpress-org-assets/banner-772x250.jpg -------------------------------------------------------------------------------- /wordpress-org-assets/icon-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpengine/geoip/HEAD/wordpress-org-assets/icon-128x128.png -------------------------------------------------------------------------------- /wordpress-org-assets/icon-256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpengine/geoip/HEAD/wordpress-org-assets/icon-256x256.png -------------------------------------------------------------------------------- /wordpress-org-assets/screenshot-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpengine/geoip/HEAD/wordpress-org-assets/screenshot-1.jpg -------------------------------------------------------------------------------- /wordpress-org-assets/screenshot-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpengine/geoip/HEAD/wordpress-org-assets/screenshot-2.jpg -------------------------------------------------------------------------------- /deploy/Dockerfile: -------------------------------------------------------------------------------- 1 | # Attribution: Helen Hou-Sandi https://github.com/10up/action-wordpress-plugin-deploy/ 2 | FROM debian:stable-slim 3 | 4 | RUN apt-get update \ 5 | && apt-get install -y subversion rsync git \ 6 | && apt-get clean -y \ 7 | && rm -rf /var/lib/apt/lists/* \ 8 | && git config --global user.email "rd@wpengine.com" \ 9 | && git config --global user.name "rd@wpengine.com" 10 | 11 | COPY entrypoint.sh /entrypoint.sh 12 | ENTRYPOINT ["/entrypoint.sh"] 13 | WORKDIR /workspace 14 | -------------------------------------------------------------------------------- /test/bin/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | WORDPRESS_DB_NAME=${WORDPRESS_DB_NAME} 4 | WORDPRESS_DB_USER=${WORDPRESS_DB_USER} 5 | WORDPRESS_DB_PASS=${WORDPRESS_DB_PASS} 6 | WORDPRESS_DB_HOST=${WORDPRESS_DB_HOST} 7 | 8 | # Start and configure mysql 9 | service mariadb start 10 | mariadb -e "CREATE DATABASE ${WORDPRESS_DB_NAME};" -uroot 11 | mariadb -e "GRANT ALL PRIVILEGES ON *.* TO '${WORDPRESS_DB_USER}'@'${WORDPRESS_DB_HOST}' IDENTIFIED BY '${WORDPRESS_DB_PASS}';" 12 | 13 | # Run docker command 14 | eval "${@}" -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: 'required' 2 | notifications: 3 | email: false 4 | 5 | services: 6 | - 'docker' 7 | 8 | cache: 9 | directories: 10 | - ${HOME}/.composer/cache 11 | 12 | branches: 13 | only: 14 | - master 15 | 16 | before_script: 17 | - make composer_install 18 | 19 | script: 20 | - make lint 21 | - make test 22 | 23 | after_success: 24 | - bash <(curl -s https://codecov.io/bash) 25 | - if [[ "${TRAVIS_BRANCH}" == "master" && "${TRAVIS_PULL_REQUEST}" == "false" ]]; then 26 | make deploy; 27 | fi 28 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "wpengine/geoip", 3 | "description": "WordPress Plugin: WP Engine GeoIP", 4 | "type": "project", 5 | "license": "GPL-2.0-or-later", 6 | "require": {}, 7 | "require-dev": { 8 | "squizlabs/php_codesniffer": "^3.4", 9 | "phpcompatibility/php-compatibility": "^9.3", 10 | "phpunit/phpunit": "^9.6.21", 11 | "wp-coding-standards/wpcs": "^2.1", 12 | "dealerdirect/phpcodesniffer-composer-installer": "^1.0", 13 | "yoast/phpunit-polyfills": "^3.0" 14 | }, 15 | "config": { 16 | "allow-plugins": { 17 | "dealerdirect/phpcodesniffer-composer-installer": true 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /phpcs.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | ./build 12 | ./test 13 | ./vendor 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | src 6 | 7 | 8 | build 9 | test 10 | vendor 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /test/bin/configure-test-harness.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Script expects these vars to be present 4 | WORDPRESS_DB_NAME=${WORDPRESS_DB_NAME} 5 | WORDPRESS_DB_USER=${WORDPRESS_DB_USER} 6 | WORDPRESS_DB_PASS=${WORDPRESS_DB_PASS} 7 | WORDPRESS_DB_HOST=${WORDPRESS_DB_HOST} 8 | 9 | # Configure test config 10 | WORDPRESS_DIR="/wordpress" 11 | WORDPRESS_TEST_HARNESS_CONFIG="${WORDPRESS_DIR}/wp-tests-config.php" 12 | cp "${WORDPRESS_DIR}/wp-tests-config-sample.php" "${WORDPRESS_TEST_HARNESS_CONFIG}" 13 | sed -i "s/youremptytestdbnamehere/${WORDPRESS_DB_NAME}/" "${WORDPRESS_TEST_HARNESS_CONFIG}" 14 | sed -i "s/yourusernamehere/${WORDPRESS_DB_USER}/" "${WORDPRESS_TEST_HARNESS_CONFIG}" 15 | sed -i "s/yourpasswordhere/${WORDPRESS_DB_PASS}/" "${WORDPRESS_TEST_HARNESS_CONFIG}" 16 | sed -i "s|localhost|${WORDPRESS_DB_HOST}|" "${WORDPRESS_TEST_HARNESS_CONFIG}" -------------------------------------------------------------------------------- /src/wpengine-geoip.php: -------------------------------------------------------------------------------- 1 | class-geoip.php to adhere to WPCS 5 | * 6 | * @package wpengine-geoip 7 | */ 8 | 9 | namespace WPEngine; 10 | 11 | // Exit if this file is directly accessed. 12 | if ( ! defined( 'ABSPATH' ) ) { 13 | exit; 14 | } 15 | 16 | /** 17 | * Replace plugin filename in options table 18 | */ 19 | function replace_previous_plugin_filename() { 20 | $active_plugins = get_option( 'active_plugins', array() ); 21 | foreach ( $active_plugins as $key => $active_plugin ) { 22 | if ( strstr( $active_plugin, '/wpengine-geoip.php' ) ) { 23 | $active_plugins[ $key ] = str_replace( '/wpengine-geoip.php', '/class-geoip.php', $active_plugin ); 24 | break; 25 | } 26 | } 27 | update_option( 'active_plugins', $active_plugins ); 28 | } 29 | replace_previous_plugin_filename(); 30 | -------------------------------------------------------------------------------- /src/js/admin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This JS file sends an ajax request on admin notification close. 3 | * 4 | * @package wpengine-geoip 5 | */ 6 | 7 | document.getElementById( 'wpbody' ).addEventListener( 8 | 'click', 9 | function ( event ) { 10 | // If this wasn't a click on a notice-dismiss close button, then abort. 11 | if ( 'notice-dismiss' !== event.target.className ) { 12 | return; 13 | } 14 | 15 | // This should be our parent div for the notice. 16 | var parent = event.path[ 1 ] || null; 17 | 18 | // If the parent div doesn't have our wpengine-geoip class, then abort. 19 | if ( ! parent || -1 === jQuery.inArray( 'wpengine-geoip', parent.classList ) ) { 20 | return; 21 | } 22 | 23 | // Get our notice's key. 24 | var key = parent.attributes[ 'data-key' ].value || null; 25 | 26 | // Send our POST request to admin-ajax. 27 | var http = new XMLHttpRequest(); 28 | var params = "action=geoip_dismiss_notice&key=" + key + "&nonce=" + window.nonce; 29 | http.open( "POST", ajaxurl, true ); 30 | http.setRequestHeader( "Content-type", "application/x-www-form-urlencoded" ); 31 | http.send( params ); 32 | } 33 | ); 34 | -------------------------------------------------------------------------------- /deploy/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Helen Hou-Sandi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /test/integration/wpengine_geoipTest.php: -------------------------------------------------------------------------------- 1 | assertEquals($expected, $actual); 24 | } 25 | 26 | public function test_activate_when_multiple_active_plugins() { 27 | $active_plugins = array( 28 | '/foo.php', 29 | '/wpengine-geoip.php', 30 | '/bar.php' 31 | ); 32 | update_option( 'active_plugins', $active_plugins ); 33 | 34 | replace_previous_plugin_filename(); 35 | $expected = array( 36 | '/foo.php', 37 | '/class-geoip.php', 38 | '/bar.php' 39 | ); 40 | $actual = get_option( 'active_plugins', array() ); 41 | $this->assertEquals($expected, $actual); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /test/bootstrap.php: -------------------------------------------------------------------------------- 1 | /dev/null 68 | 69 | # SVN delete all deleted files 70 | # Also suppress stdout here 71 | svn status | grep '^\!' | sed 's/! *//' | xargs -I% svn rm % > /dev/null 72 | 73 | # Copy tag locally to make this a single commit 74 | echo "➤ Copying tag..." 75 | svn cp "trunk" "tags/$VERSION" 76 | 77 | svn status 78 | 79 | if [[ -z "$DEPLOY" ]]; then 80 | echo "Set DEPLOY to deploy to SVN" 81 | exit 1 82 | fi 83 | 84 | echo "➤ Committing files..." 85 | svn commit -m "Update to version $VERSION from TravisCI" --no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD" 86 | echo "✓ Plugin deployed!" 87 | -------------------------------------------------------------------------------- /test/integration/GeoIpSmokeTest.php: -------------------------------------------------------------------------------- 1 | assertEquals('NA', do_shortcode('[geoip-continent]')); 16 | } 17 | 18 | public function test_shortcode_country() { 19 | $this->assertEquals('US', do_shortcode('[geoip-country]')); 20 | } 21 | 22 | public function test_shortcode_region() { 23 | $this->assertEquals('TX', do_shortcode('[geoip-region]')); 24 | } 25 | 26 | public function test_shortcode_city() { 27 | $this->assertEquals('Austin', do_shortcode('[geoip-city]')); 28 | } 29 | 30 | public function test_shortcode_postalcode() { 31 | $this->assertEquals('78759', do_shortcode('[geoip-postalcode]')); 32 | } 33 | 34 | public function test_shortcode_latitude() { 35 | $this->assertEquals('30.40000', do_shortcode('[geoip-latitude]')); 36 | } 37 | 38 | public function test_shortcode_longitude() { 39 | $this->assertEquals('-97.75280', do_shortcode('[geoip-longitude]')); 40 | } 41 | 42 | public function test_shortcode_location() { 43 | $this->assertEquals('Austin, TX US', do_shortcode('[geoip-location]')); 44 | } 45 | 46 | public function test_shortcode_content() { 47 | // Test in a location where content is expected 48 | $expected = 'Hello, world!'; 49 | $actual = do_shortcode('[geoip-content country="US"]Hello, world![/geoip-content]'); 50 | $this->assertEquals($expected, $actual); 51 | 52 | // Test by negating a location 53 | $expected = ''; 54 | $actual = do_shortcode('[geoip-content not_country="US"]Hello, world![/geoip-content]'); 55 | $this->assertEquals($expected, $actual); 56 | 57 | // Test with a dashed negation 58 | $expected = ''; 59 | $actual = do_shortcode('[geoip-content not-country="US"]Hello, world![/geoip-content]'); 60 | $this->assertEquals($expected, $actual); 61 | 62 | // Test in a location where content is not expected 63 | $expected = ''; 64 | $actual = do_shortcode('[geoip-content country="FR"]Hello, world![/geoip-content]'); 65 | $this->assertEquals($expected, $actual); 66 | 67 | // Test with a label that we don't understand 68 | $expected = 'Hello, world!'; 69 | $actual = do_shortcode('[geoip-content cooontry="US"]Hello, world![/geoip-content]'); 70 | $this->assertEquals($expected, $actual); 71 | 72 | // Test with a list of locations 73 | $expected = 'Hello, world!'; 74 | $actual = do_shortcode('[geoip-content country="FR,IE,AU,US"]Hello, world![/geoip-content]'); 75 | $this->assertEquals($expected, $actual); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/class-pluginupdater.php: -------------------------------------------------------------------------------- 1 | api_url = 'https://wpe-plugin-updates.wpengine.com/'; 58 | 59 | $this->cache_time = time() + HOUR_IN_SECONDS * 5; 60 | 61 | $this->properties = $this->get_full_plugin_properties( $properties, $this->api_url ); 62 | 63 | if ( ! $this->properties ) { 64 | return; 65 | } 66 | 67 | $this->register(); 68 | } 69 | 70 | /** 71 | * Get the full plugin properties, including the directory name, version, basename, and add a transient name. 72 | * 73 | * @param array $properties These properties are passed in when instantiating to identify the plugin and it's update location. 74 | * @param string $api_url The URL where the api is located. 75 | * @return array|null 76 | */ 77 | public function get_full_plugin_properties( $properties, $api_url ) { 78 | $plugins = \get_plugins(); 79 | 80 | // Scan through all plugins installed and find the one which matches this one in question. 81 | foreach ( $plugins as $plugin_basename => $plugin_data ) { 82 | // Match using the passed-in plugin's basename. 83 | if ( $plugin_basename === $properties['plugin_basename'] ) { 84 | // Add the values we need to the properties. 85 | $properties['plugin_dirname'] = dirname( $plugin_basename ); 86 | $properties['plugin_version'] = $plugin_data['Version']; 87 | $properties['plugin_update_transient_name'] = 'wpesu-plugin-' . sanitize_title( $properties['plugin_dirname'] ); 88 | $properties['plugin_update_transient_exp_name'] = 'wpesu-plugin-' . sanitize_title( $properties['plugin_dirname'] ) . '-expiry'; 89 | $properties['plugin_manifest_url'] = trailingslashit( $api_url ) . trailingslashit( $properties['plugin_slug'] ) . 'info.json'; 90 | 91 | return $properties; 92 | } 93 | } 94 | 95 | // No matching plugin was found installed. 96 | return null; 97 | } 98 | 99 | /** 100 | * Register hooks. 101 | * 102 | * @return void 103 | */ 104 | public function register() { 105 | add_filter( 'plugins_api', array( $this, 'filter_plugin_update_info' ), 20, 3 ); 106 | add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'filter_plugin_update_transient' ) ); 107 | } 108 | 109 | /** 110 | * Filter the plugin update transient to take over update notifications. 111 | * 112 | * @param ?object $transient_value The value of the `site_transient_update_plugins` transient. 113 | * 114 | * @handles site_transient_update_plugins 115 | * @return object 116 | */ 117 | public function filter_plugin_update_transient( $transient_value ) { 118 | // No update object exists. Return early. 119 | if ( empty( $transient_value ) ) { 120 | return $transient_value; 121 | } 122 | 123 | $result = $this->fetch_plugin_info(); 124 | 125 | if ( false === $result ) { 126 | return $transient_value; 127 | } 128 | 129 | $res = $this->parse_plugin_info( $result ); 130 | 131 | if ( version_compare( $this->properties['plugin_version'], $result->version, '<' ) ) { 132 | $transient_value->response[ $res->plugin ] = $res; 133 | $transient_value->checked[ $res->plugin ] = $result->version; 134 | } else { 135 | $transient_value->no_update[ $res->plugin ] = $res; 136 | } 137 | 138 | return $transient_value; 139 | } 140 | 141 | /** 142 | * Filters the plugin update information. 143 | * 144 | * @param object $res The response to be modified for the plugin in question. 145 | * @param string $action The action in question. 146 | * @param object $args The arguments for the plugin in question. 147 | * 148 | * @handles plugins_api 149 | * @return object 150 | */ 151 | public function filter_plugin_update_info( $res, $action, $args ) { 152 | // Do nothing if this is not about getting plugin information. 153 | if ( 'plugin_information' !== $action ) { 154 | return $res; 155 | } 156 | 157 | // Do nothing if it is not our plugin. 158 | if ( $this->properties['plugin_dirname'] !== $args->slug ) { 159 | return $res; 160 | } 161 | 162 | $result = $this->fetch_plugin_info(); 163 | 164 | // Do nothing if we don't get the correct response from the server. 165 | if ( false === $result ) { 166 | return $res; 167 | } 168 | 169 | return $this->parse_plugin_info( $result ); 170 | } 171 | 172 | /** 173 | * Fetches the plugin update object from the WP Product Info API. 174 | * 175 | * @return object|false 176 | */ 177 | private function fetch_plugin_info() { 178 | // Fetch cache first. 179 | $expiry = get_option( $this->properties['plugin_update_transient_exp_name'], 0 ); 180 | $response = get_option( $this->properties['plugin_update_transient_name'] ); 181 | 182 | if ( empty( $expiry ) || time() > $expiry || empty( $response ) ) { 183 | $response = wp_remote_get( 184 | $this->properties['plugin_manifest_url'], 185 | array( 186 | 'timeout' => 10, 187 | 'headers' => array( 188 | 'Accept' => 'application/json', 189 | ), 190 | ) 191 | ); 192 | 193 | if ( 194 | is_wp_error( $response ) || 195 | 200 !== wp_remote_retrieve_response_code( $response ) || 196 | empty( wp_remote_retrieve_body( $response ) ) 197 | ) { 198 | return false; 199 | } 200 | 201 | $response = wp_remote_retrieve_body( $response ); 202 | 203 | // Cache the response. 204 | update_option( $this->properties['plugin_update_transient_exp_name'], $this->cache_time, false ); 205 | update_option( $this->properties['plugin_update_transient_name'], $response, false ); 206 | } 207 | 208 | $decoded_response = json_decode( $response ); 209 | 210 | if ( json_last_error() !== JSON_ERROR_NONE ) { 211 | return false; 212 | } 213 | 214 | return $decoded_response; 215 | } 216 | 217 | /** 218 | * Parses the product info response into an object that WordPress would be able to understand. 219 | * 220 | * @param object $response The response object. 221 | * 222 | * @return stdClass 223 | */ 224 | private function parse_plugin_info( $response ) { 225 | 226 | global $wp_version; 227 | 228 | $res = new stdClass(); 229 | $res->name = $response->name; 230 | $res->slug = $response->slug; 231 | $res->version = $response->version; 232 | $res->requires = $response->requires; 233 | $res->download_link = $response->download_link; 234 | $res->trunk = $response->download_link; 235 | $res->new_version = $response->version; 236 | $res->plugin = $this->properties['plugin_basename']; 237 | $res->package = $response->download_link; 238 | 239 | // Plugin information modal and core update table use a strict version comparison, which is weird. 240 | // If we're genuinely not compatible with the point release, use our WP tested up to version. 241 | // otherwise use exact same version as WP to avoid false positive. 242 | $res->tested = 1 === version_compare( substr( $wp_version, 0, 3 ), $response->tested ) 243 | ? $response->tested 244 | : $wp_version; 245 | 246 | $res->sections = array( 247 | 'description' => $response->sections->description, 248 | 'changelog' => $response->sections->changelog, 249 | ); 250 | 251 | return $res; 252 | } 253 | } 254 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WP Engine GeoTarget 2 | [![Build Status](https://travis-ci.org/wpengine/geoip.svg?branch=master)](https://travis-ci.org/wpengine/geoip) [![codecov](https://codecov.io/gh/wpengine/geoip/branch/master/graph/badge.svg)](https://codecov.io/gh/wpengine/geoip) 3 | 4 | WP Engine GeoTarget integrates with the variables on your WP Engine site to display content catered to the visitor’s location. With the ability to access variables from as broad as country to as specific as latitude and longitude, your website can now display geographically relevant content. 5 | 6 | ## Use cases 7 | 8 | ### Geo-Marketing 9 | 10 | * Create marketing campaigns targeted only at certain locations. 11 | 12 | ### Localization 13 | 14 | * Redirect incoming traffic to content in the local language or currency. 15 | * Businesses with local branches can direct customers to a relevant physical location or local microsite. 16 | 17 | ### Ecommerce 18 | 19 | * Filter out merchandise or services that are not available in a certain locale. 20 | * Display country-specific shipping, tax, or sales information. 21 | 22 | ### Legal Requirements 23 | 24 | * Filter required legal notices from countries for whom those notices may not be relevant. 25 | 26 | ### * Please Note * 27 | 28 | If you are signed into a Premium or Enterprise plan, you can use this plugin at no additional cost. If you are on another plan type and would like to use GeoTarget on one of your sites, you can add it to your plan [here](http://wpengine.com/plans/?utm_source=wpengine-geoip). This will not function outside of the WP Engine environment. 29 | 30 | ## Installation 31 | 32 | 1. Upload `wpengine-geoip` to the `/wp-content/plugins/` directory 33 | 2. Activate the plugin through the 'Plugins' menu in WordPress 34 | 35 | ## How to use 36 | 37 | ### Location Variable Shortcodes 38 | 39 | You can use any of the following location variable shortcodes to return the various geographic location the user is visiting your site from: 40 | 41 | 1. Continent: `[geoip-continent]` 42 | 43 | 2. Country: `[geoip-country]` 44 | 45 | 3. Region: `[geoip-region]` 46 | * In the US region will return States 47 | * In Canada region will return Provinces 48 | * Outside the US/CA this will return a Region number. Please note region numbers are not unique between countries 49 | 50 | 4. City: `[geoip-city]` 51 | 52 | 5. Postal Code: `[geoip-postalcode]` 53 | * This variable is only available in the US due to limitations with the location data GeoTarget uses 54 | 55 | 6. Latitude: `[geoip-latitude]` 56 | 57 | 7. Longitude: `[geoip-longitude]` 58 | 59 | 8. Location: `[geoip-location]` 60 | 61 | #### Example 62 | 63 | **In your post editor:** 64 | 65 | > Hi, and welcome to [geoip-city]! The place to be in [geoip-region],[geoip-country]. 66 | 67 | **A visitor from Austin, Texas would see:** 68 | 69 | > Hi, and welcome to Austin! The place to be in TX, US. 70 | 71 | ### Localized Content 72 | 73 | The content shortcode allows you to hide or show specific content based on visitor geographies: 74 | 75 | > [geoip-content country="US"]Your US specific content goes here[/geoip-content] 76 | 77 | Below are all the supported geography options, this allows to you SHOW content for only specific locations: 78 | 79 | * continent 80 | * country 81 | * areacode 82 | * region 83 | * city 84 | * postalcode 85 | 86 | Below are all the supported negative geography options, this allows to you HIDE content for only specific locations: 87 | 88 | * not_continent 89 | * not_country 90 | * not_areacode 91 | * not_region 92 | * not_city 93 | * not_postalcode 94 | 95 | #### Examples of the Content Shortcode 96 | 97 | This will display “Content just for US visitors” strictly for visitors viewing from the United States. 98 | 99 | > [geoip-content country="US"] Content just for US visitors [/geoip-content] 100 | 101 | This will display “Content just for everyone in Texas and California” strictly for visitors from Texas and California. 102 | 103 | > [geoip-content region="TX, CA."] Content just for everyone in Texas and California [/geoip-content] 104 | 105 | You can mix and match geography and negative geography options to create verbose logic in a single shortcode: 106 | 107 | > [geoip-content country="US" not_city="Austin"]Content for US visitors but not for visitors in Austin[/geoip-content] 108 | 109 | #### Limitation 110 | 111 | There is a limitation in the logic that lets you filter content for multiple geographic areas. 112 | 113 | You can progressively limit the area that content is shown in. But once your content is hidden from an area, a subset of that area can't be added back in. 114 | 115 | For example, 116 | If I localize content so that it shows to all of Europe, then prevent my content from showing in Great Britain, I can't go back and show it to London. 117 | 118 | #### Creative Work Arounds 119 | 120 | Limit content to some regions of a country (or some cities of a state) 121 | 122 | ##### Example 1 123 | 124 | You want to show an offer for free shipping to every state in the US *but* Alaska and Hawaii. You may be inclined to write something like 125 | 126 | *Instead of:* 127 | 128 | > [geoip-content country="US" not_state="AK, HI"]Lorem ipsum dolor sit amet[/geoip-content] 129 | 130 | *Show it to all 48 states:* 131 | 132 | > [geoip-content state="AL, AZ, AR, CA, CO, CT, DE, FL, GA, ID, IL, IN, IA, KS, KY, LA, ME, MD, MA, MI, MN, MS, MO, MT, NE, NV, NH, NJ, NM, NY, NC, ND, OH, OK, OR, PA, RI, SC, SD, TN, TX, UT, VT, VA, WA, WV, WI, WY"]Free shipping on all orders over $50![/geoip-content] 133 | 134 | ##### Example 2 135 | 136 | You want to show discount airfare on a flight to Paris, France. The content should show to all of the US and France, but not Paris itself. 137 | 138 | *Instead of:* 139 | 140 | > [geoip-content country="US, FR" not_city="Paris"]Fly to Paris for only $199![/geoip-content] 141 | 142 | The problem here is that Paris, Texas will be hidden. The solution? 143 | 144 | *Just have two geoip-content shortcodes:* 145 | 146 | > [geoip-content country="FR" not_city="Paris"]Fly to Paris for only $199![/geoip-content] 147 | > [geoip-content country="US"]Fly to Paris for only $199![/geoip-content] 148 | 149 | ##### Example 3 150 | 151 | You want to show an ad written in Spanish to all of South America except for Brazil. Brasilia, however, has enough Spanish speakers that you want to include Brasilia. 152 | 153 | *Instead of:* 154 | 155 | > [geoip-content continent="SA" not_country="BR" city="Brasilia"]Lorem ipsum dolor sit amet[/geoip-content] 156 | 157 | *Just have two geoip-content shortcodes:* 158 | 159 | > [geoip-content continent="SA" not_country="BR"]Venta de la Navidad en los adaptadores USB[/geoip-content] 160 | > [geoip-content city="Brasilia"]Venta de la Navidad en los adaptadores USB[/geoip-content] 161 | 162 | ## Additional features 163 | 164 | ### Calculate distance between points 165 | 166 | You have a utility function that will calculate the distance from your provided lat/long coordinate to the visitor's location in either miles or kilometers. This can be useful for determining approximate distances, as results may be cached at the state or country level, depending on your configuration. 167 | 168 | #### Example 169 | 170 | ```php 171 | $latitude = 30.268246; 172 | $longitude = -97.745992; 173 | $geo = WPEngine\GeoIp::instance(); 174 | if ( false !== $geo->distance_to( $latitude, $longitude ) ) { 175 | $miles_to_wp_engine = $geo->distance_to( $latitude, $longitude ); 176 | } 177 | ``` 178 | 179 | ### Test pages from other locations 180 | 181 | You can use the following URL parameters to test how your localized content will appear to visitors from various geographic locations. You can add any of the parameters below to any URL of a page using the GeoTarget shortcodes or API calls: 182 | 183 | #### Examples 184 | 185 | Spoof visitor from the state of Texas: 186 | 187 | ```http 188 | https://yourdomain.com/?geoip®ion=TX 189 | ``` 190 | 191 | Spoof visitor from the United States: 192 | 193 | ```http 194 | yourdomain.com/?geoip&country=US 195 | ``` 196 | 197 | Spoof visitor from Austin, Texas 198 | 199 | ```http 200 | yourdomain.com/?geoip&city=Austin 201 | ``` 202 | 203 | Spoof visitor from the U.S. zip code 78701: 204 | 205 | ```http 206 | yourdomain.com/?geoip&zip=78701 207 | ``` 208 | 209 | ## Frequently Asked Questions 210 | 211 | 1. Will this work outside of the WP Engine hosting account? 212 | 213 | > No, this will only work within the WP Engine environment. This will not work for sites hosted on other web hosts. 214 | 215 | 2. Are there any other restrictions to using this plugin? 216 | 217 | > Yes. If you are signed into a Premium or Enterprise plan, you can use this plugin at no additional cost. If you are on another plan type and would like to use GeoTarget on one of your sites, you can add it to your plan [here](http://wpengine.com/plans/?utm_source=wpengine-geoip). For all plan types, just reach out to the [Support Team](https://my.wpengine.com/support) to enable GeoTarget for your site. 218 | > You can read our full GeoTarget activation guide [here](https://wpengine.com/support/geoip-personalizing-content-based-geography/). 219 | 220 | 3. What variables do I have access to? 221 | 222 | > Continent, country, state, city, zip, latitude, longitude. 223 | 224 | 4. How do I sign up for a WP Engine Account?: 225 | 226 | > That’s easy! [Signup here](http://wpengine.com/plans/?utm_source=wpengine-geoip). 227 | 228 | 5. I installed the plugin and used a shortcode or API call and it isn’t working. 229 | 230 | > Please contact the WP Engine [Support Team](https://my.wpengine.com/support). 231 | 232 | ## Contributing 233 | 234 | Running `make` from the repository root will download dependencies, lint, and test the plugin. `make build` will package the plugin as a zip and place it in the `/build` directory. 235 | -------------------------------------------------------------------------------- /src/readme.txt: -------------------------------------------------------------------------------- 1 | === WP Engine GeoTarget === 2 | Contributors: wpengine, markkelnar, stevenkword, stephenlin, ryanshoover, taylor4484, nateinaction 3 | Tags: wpe, wpengine, geotarget, geoip, localization, geolocation 4 | Requires at least: 3.0.1 5 | Tested up to: 6.6 6 | Stable tag: 1.2.9 7 | 8 | License: GPLv2 or later 9 | License URI: http://www.gnu.org/licenses/gpl-2.0.html 10 | 11 | Create a personalized user experience based on location. 12 | 13 | == Description == 14 | 15 | WP Engine GeoTarget integrates with the variables on your WP Engine site to display content catered to the visitor’s location. With the ability to access variables from as broad as country to as specific as latitude and longitude, your website can now display geographically relevant content. 16 | 17 | = Geo-Marketing = 18 | 19 | * Create marketing campaigns targeted only at certain locations. 20 | 21 | = Localization = 22 | 23 | * Redirect incoming traffic to content in the local language or currency. 24 | * Businesses with local branches can direct customers to a relevant physical location or local microsite. 25 | 26 | = Ecommerce = 27 | 28 | * Filter out merchandise or services that are not available in a certain locale. 29 | * Display country-specific shipping, tax, or sales information. 30 | 31 | = Legal Requirements = 32 | 33 | * Filter required legal notices from countries for whom those notices may not be relevant. 34 | 35 | = * Please Note * = 36 | 37 | Customers on Premium and Enterprise plans can use this plugin at no additional cost. If you are on another plan type and would like to use GeoTarget on one of your sites, you can add it to your plan [here](http://wpengine.com/plans/?utm_source=wpengine-geoip). This will not function outside of the WP Engine environment. 38 | 39 | == Installation == 40 | 41 | 1. Upload `wpengine-geoip` to the `/wp-content/plugins/` directory 42 | 2. Activate the plugin through the 'Plugins' menu in WordPress 43 | 44 | Please view the 'Other Notes' tab to see all of the available GeoTarget shortcodes 45 | 46 | 47 | == Location Variable Shortcodes == 48 | You can use any of the following location variable shortcodes to return the various geographic location the user is visiting your site from: 49 | 50 | 1) Continent: `[geoip-continent]` 51 | 52 | 2) Country: `[geoip-country]` 53 | 54 | 3) Region: `[geoip-region]` 55 | 56 | * In the US region will return States 57 | * In Canada region will return Provinces 58 | * Outside the US/CA this will return a Region number. Please note region numbers are not unique between countries 59 | 60 | 4) City: `[geoip-city]` 61 | 62 | 5) Postal Code: `[geoip-postalcode]` 63 | 64 | * This variable is only available in the US due to limitations with the location data GeoTarget uses 65 | 66 | 6) Latitude: `[geoip-latitude]` 67 | 68 | 7) Longitude: `[geoip-longitude]` 69 | 70 | 8) Location: `[geoip-location]` 71 | 72 | = Example = 73 | `Hi, and welcome to [geoip-city]! The place to be in [geoip-region],[geoip-country].` 74 | A visitor from Austin, Texas would see the following: 75 | `Hi, and welcome to Austin! The place to be in TX, US.` 76 | 77 | == Localized Content == 78 | 79 | ` 80 | [geoip-content country="US"]Your US specific content goes here[/geoip-content] 81 | ` 82 | 83 | The content shortcode allows you to hide or show specific content based on visitor geographies: 84 | 85 | Below are all the supported geography options, this allows to you SHOW content for only specific locations: 86 | 87 | * continent 88 | * country 89 | * areacode 90 | * region 91 | * city 92 | * postalcode 93 | 94 | Below are all the supported negative geography options, this allows to you HIDE content for only specific locations: 95 | 96 | * not_continent 97 | * not_country 98 | * not_areacode 99 | * not_region 100 | * not_city 101 | * not_postalcode 102 | 103 | = Examples of the Content Shortcode = 104 | This will display “Content just for US visitors” strictly for visitors viewing from the United States. 105 | 106 | ` 107 | [geoip-content country="US"] Content just for US visitors [/geoip-content] 108 | ` 109 | 110 | This will display “Content just for everyone in Texas and California” strictly for visitors from Texas and California. 111 | 112 | ` 113 | [geoip-content region="TX, CA."] Content just for everyone in Texas and California [/geoip-content] 114 | ` 115 | 116 | 117 | You can mix and match geography and negative geography options to create verbose logic in a single shortcode: 118 | 119 | ` 120 | [geoip-content country="US" not_city="Austin"]Content for US visitors but not for visitors in Austin[/geoip-content] 121 | ` 122 | 123 | = Limitations = 124 | 125 | There is a single limitation in the logic that lets you filter content for multiple geographic areas. 126 | 127 | You can progressively limit the area that content is shown in. But once your content is hidden from an area, a subset of that area can't be added back in. 128 | 129 | For example, 130 | If I limit my content to Europe, then limit my content from Great Britain, I can't go back and show it to London. 131 | 132 | = Creative Work Arounds = 133 | 134 | == Limit content to some regions of a country (or some cities of a state) == 135 | 136 | You want to show an offer for free shipping to every state in the US *but* Alaska and Hawaii. You may be inclined to write something like 137 | 138 | **BAD** 139 | 140 | ` 141 | [geoip-content country="US" not_state="AK, HI"]Lorem ipsum dolor sit amet[/geoip-content] 142 | ` 143 | 144 | Instead, show it to all other 48 states 145 | 146 | **GOOD** 147 | 148 | ` 149 | [geoip-content state="AL, AZ, AR, CA, CO, CT, DE, FL, GA, ID, IL, IN, IA, KS, KY, LA, ME, MD, MA, MI, MN, MS, MO, MT, NE, NV, NH, NJ, NM, NY, NC, ND, OH, OK, OR, PA, RI, SC, SD, TN, TX, UT, VT, VA, WA, WV, WI, WY"]Free shipping on all orders over $50![/geoip-content] 150 | ` 151 | 152 | == Duplicate location names == 153 | 154 | You want to show discount airfare on a flight to Paris, France. The content should show to all of the US and France, but not Paris itself. 155 | 156 | **BAD** 157 | 158 | ` 159 | [geoip-content country="US, FR" not_city="Paris"]Fly to Paris for only $199![/geoip-content] 160 | ` 161 | 162 | The problem here is that Paris, Texas will be hidden. The solution? Just have two geoip-content shortcodes. 163 | 164 | **GOOD** 165 | 166 | ` 167 | [geoip-content country="FR" not_city="Paris"]Fly to Paris for only $199![/geoip-content][geoip-content country="US"]Fly to Paris for only $199![/geoip-content] 168 | ` 169 | 170 | == Adding an area into an omitted region == 171 | 172 | You want to show an ad written in Spanish to all of South America except for Brazil. Brasilia, however, has enough Spanish speakers that you want to include Brasilia. 173 | 174 | **BAD** 175 | 176 | ` 177 | [geoip-content continent="SA" not_country="BR" city="Brasilia"]Lorem ipsum dolor sit amet[/geoip-content] 178 | ` 179 | 180 | **GOOD** 181 | 182 | ` 183 | [geoip-content continent="SA" not_country="BR"]Venta de la Navidad en los adaptadores USB[/geoip-content] 184 | ` 185 | 186 | ` 187 | [geoip-content city="Brasilia"]Venta de la Navidad en los adaptadores USB[/geoip-content] 188 | ` 189 | 190 | == Calculate distance between points == 191 | 192 | You have a utility function that will calculate the distance from your provided lat/lng coordinate to the visitor's location in either miles or kilometers. This can be useful for determining approximate distances, as results may be cached at the state or country level, depending on your configuration. 193 | 194 | Example use: 195 | 196 | ` 197 | $latitude = 30.268246; 198 | $longitude = -97.745992; 199 | $geo = WPEngine\GeoIp::instance(); 200 | if ( false !== $geo->distance_to( $latitude, $longitude ) ) { 201 | $miles_to_wp_engine = $geo->distance_to( $latitude, $longitude ); 202 | } 203 | ` 204 | 205 | == Testing Parameters == 206 | You can use the following URL parameters to test how your localized content will appear to visitors from various geographic locations. You can add any of the parameters below to any URL of a page using the GeoTarget shortcodes or API calls: 207 | 208 | Spoof visitor from the state of Texas: 209 | 210 | ` 211 | yourdomain.com/?geoip®ion=TX 212 | ` 213 | 214 | Spoof visitor from the United States: 215 | 216 | ` 217 | yourdomain.com/?geoip&country=US 218 | ` 219 | 220 | Spoof visitor from Austin, Texas 221 | 222 | ` 223 | yourdomain.com/?geoip&city=Austin 224 | ` 225 | 226 | Spoof visitor from the U.S. zip code 78701: 227 | 228 | ` 229 | yourdomain.com/?geoip&zip=78701 230 | ` 231 | 232 | 233 | Please note: full page redirects and TLD redirects still need to be implemented with the necessary API calls. 234 | 235 | == Frequently Asked Questions == 236 | 237 | 1) Will this work outside of the WP Engine hosting account? 238 | 239 | No, this will only work within the WP Engine environment. This will not work for sites hosted on other web hosts. 240 | 241 | 2) Are there any other restrictions to using this plugin? 242 | 243 | Yes. On Startup, Growth, and Scale plans the GeoTarget feature is available as an add-on. For Business and Premium plans or once you have added the GeoTarget add-on you will need to reach out to the [Support Team](https://my.wpengine.com/support) to fully enable GeoTarget for your site. 244 | 245 | You can read our full GeoTarget activation guide [here](https://wpengine.com/support/geoip-personalizing-content-based-geography/). 246 | 247 | 3) What variables do I have access to? 248 | 249 | Continent, country, state, city, zip, latitude, longitude. 250 | 251 | 4) How do I sign up for a WP Engine Account?: 252 | 253 | That’s easy! [Signup here](http://wpengine.com/plans/?utm_source=wpengine-geoip). 254 | 255 | 5) I installed the plugin and used a shortcode or API call and it isn’t working. 256 | 257 | Please contact the WP Engine [Support Team](https://my.wpengine.com/support). 258 | 259 | == Screenshots == 260 | 261 | 1. Authoring a new post with GeoTarget shortcodes 262 | 2. An example post using GeoTarget shortcodes 263 | 264 | == Changelog == 265 | 266 | = 1.2.9 = 267 | - Updates are now served from WP Engine servers. 268 | - Local development fixes. 269 | - Fix for `wp_localize_script` being called without expected parameter type. 270 | - Bump for WP 6.6 compatibility. 271 | 272 | = 1.2.8 = 273 | - Fix for development sites that call the `continent` method 274 | - Bump for WP 5.5 compatibility 275 | 276 | = 1.2.7 = 277 | - Optimize plugin name rename loop 278 | - Bump for WP 5.2 compatibility 279 | 280 | = 1.2.6 = 281 | - Bump for WP 5.0 compatibility 282 | 283 | = 1.2.5 = 284 | - Fix for anchor tag escaping in admin notice 285 | - Fix issue with code blocks in readme 286 | 287 | = 1.2.4 = 288 | - Updating branding to GeoTarget 289 | - Readme update 290 | 291 | = 1.2.3 = 292 | - Bumps version number for WP 4.9 compatibility 293 | - Updates shortcode usage examples 294 | 295 | = 1.2.2 = 296 | - We're escaping our output. AND we're escaping our output in a way where the code will actually work! 297 | - We've also gotten rid of any bleeding-edge JavaScript. Sure, it's cool. But a plugin that works for everybody is even cooler. 298 | 299 | = 1.2.1 = 300 | - When you dismiss the notice on development websites, it stays dismissed. Like it should. 301 | - The readme's code blocks actually have code in them now. Because what's the sense of a code block without code in it? 302 | 303 | = 1.2.0 = 304 | - Adds a utility function for calculating distances 305 | - Bumps version number for WP 4.5 compatibility 306 | 307 | = 1.1.3 = 308 | - Bumps version number for WP 4.4.2 compatibility 309 | 310 | = 1.1.2 = 311 | - Fixes logic for nested parameter selectors in content shortcode 312 | - Now supports nested shortcodes. You can use shortcodes inside the [geoip-content] shortcode 313 | - Updated Documentation 314 | - Bumps version number for WP 4.3 compatibility 315 | 316 | = 1.1.1 = 317 | - Fixes logic for negated parameters in content shortcode 318 | - Allows the plugin to run on development sites 319 | 320 | = 1.1.0 = 321 | - Adds continent shortcode 322 | - Adds content shortcode for localized geographic content 323 | - Adds testing parameters to spoof visitor location 324 | - Bumps version number for WP 4.2.2 compatibility 325 | 326 | = 1.0.2 = 327 | - Renames longitude environment variable 328 | - Bumps version number for WP 4.2 compatibility 329 | 330 | = 1.0.1 = 331 | - Changes to readme.txt 332 | 333 | = 1.0.0 = 334 | - Initial release 335 | 336 | = 0.7.0 = 337 | - Removes plugin dependency management artifacts 338 | 339 | = 0.6.0 = 340 | - Add shortcodes for postal code, latitude and longitude. 341 | 342 | = 0.5.0 = 343 | - Adds shortcodes for city, region, and country. 344 | - Displays admin notice when GEOIP environment variables are absent. 345 | - Formatting updates to readme and file headers. 346 | 347 | = 0.4.0 = 348 | - Code cleanup for WordPress coding standards and white space. 349 | 350 | = 0.3.0 = 351 | - Change action to react at 'init'. 352 | 353 | = 0.2.0 = 354 | - Add static function and singleton construction. 355 | 356 | = 0.1.0 = 357 | - Initial version 358 | 359 | == Upgrade Notice == 360 | 361 | = 1.1.2 = 362 | - Fixes logic for nested parameter selectors in content shortcode 363 | - Now supports nested shortcodes. You can use shortcodes inside the [geoip-content] shortcode 364 | - Updated Documentation 365 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /test/integration/GeoIpTest.php: -------------------------------------------------------------------------------- 1 | assertTrue( class_exists( self::$class_name ) ); 27 | $geo = GeoIp::instance(); 28 | $this->assertEquals( self::$class_name, get_class( $geo ) ); 29 | } 30 | 31 | /** 32 | * Verify shortcodes are added to WordPress 33 | * 34 | * @param string $slug Name of shortcode 35 | * 36 | * @dataProvider data_shortcode_slugs 37 | */ 38 | public function test_action_init_register_shortcodes($slug) { 39 | // Test that the plugin adds shortcodes via constructor side effect 40 | $this->assertTrue( shortcode_exists( $slug ) ); 41 | 42 | // Remove the shortcodes and readd them using action_init_register_shortcodes 43 | remove_shortcode( $slug ); 44 | $this->assertFalse( shortcode_exists( $slug ) ); 45 | 46 | $geoip_mock = $this->getMockBuilder( self::$class_name ) 47 | ->disableOriginalConstructor() 48 | ->setMethods( null ) 49 | ->getMock(); 50 | 51 | $geoip_mock->action_init_register_shortcodes(); 52 | $this->assertTrue( shortcode_exists( $slug ) ); 53 | } 54 | 55 | public function data_shortcode_slugs() { 56 | return array( 57 | [GeoIp::SHORTCODE_CONTINENT], 58 | [GeoIp::SHORTCODE_COUNTRY], 59 | [GeoIp::SHORTCODE_REGION], 60 | [GeoIp::SHORTCODE_CITY], 61 | [GeoIp::SHORTCODE_POSTAL_CODE], 62 | [GeoIp::SHORTCODE_LATITUDE], 63 | [GeoIp::SHORTCODE_LONGITUDE], 64 | [GeoIp::SHORTCODE_LOCATION], 65 | [GeoIp::SHORTCODE_CONTENT], 66 | ); 67 | } 68 | 69 | 70 | /** 71 | * Test init 72 | * 73 | * @param string $hook Name of WordPress hook 74 | * @param string $method_name Method being hooked 75 | * 76 | * @dataProvider data_test_init 77 | */ 78 | public function test_init($hook, $method_name) { 79 | // Test that the plugin adds the action via constructor side effect 80 | $geoip = GeoIp::instance(); 81 | $priority = has_action( $hook, array( $geoip, $method_name ) ); 82 | $this->assertIsInt( $priority ); 83 | 84 | // remove and readd action using init then test 85 | remove_action( $hook, array( $geoip, $method_name ), $priority ); 86 | $geoip::init(); 87 | $this->assertIsInt( has_action( $hook, array( $geoip, $method_name ) ) ); 88 | } 89 | 90 | public function data_test_init() 91 | { 92 | return array( 93 | ['init', 'setup'], 94 | ['init', 'action_init_register_shortcodes'], 95 | ['admin_enqueue_scripts', 'enqueue_admin_js'], 96 | ['admin_init', 'action_admin_init_check_plugin_dependencies'], 97 | ['admin_notices', 'action_admin_notices'], 98 | ['wp_ajax_geoip_dismiss_notice', 'ajax_action_dismiss_notice'], 99 | ); 100 | } 101 | 102 | public function test_setup() { 103 | $geoip_mock = $this->getMockBuilder( self::$class_name ) 104 | ->disableOriginalConstructor() 105 | ->setMethods( array( 'get_actuals', 'get_test_parameters' ) ) 106 | ->getMock(); 107 | 108 | $geoip_mock->geos = $expected_geos = array( 109 | 'countrycode' => "learn your abc\'s", 110 | 'region' => 'easy as', 111 | 'city' => '123', 112 | 'postalcode' => 'simple as', 113 | 'latitude' => 'do-re-me', 114 | 'longitude' => 'you and me', 115 | ); 116 | 117 | $expected_geos['countrycode'] = "learn your abc's"; 118 | 119 | $geoip_mock->method( 'get_actuals' ) 120 | ->willReturn( $geoip_mock->geos ); 121 | 122 | $geoip_mock->method( 'get_test_parameters' ) 123 | ->willReturn( $geoip_mock->geos ); 124 | 125 | $geoip_mock->setup(); 126 | $this->assertEquals($expected_geos, $geoip_mock->geos); 127 | $this->assertIsArray( $geoip_mock->admin_notices ); 128 | } 129 | 130 | /** 131 | * Test enqueue_admin_js 132 | */ 133 | public function test_enqueue_admin_js() { 134 | global $wp_scripts; 135 | 136 | // The script shouldn't be enqueued yet but alas dequeue before test 137 | wp_dequeue_script( GeoIp::TEXT_DOMAIN . '-admin-js' ); 138 | 139 | $geoip_mock = $this->getMockBuilder( self::$class_name ) 140 | ->disableOriginalConstructor() 141 | ->setMethods( array( 'helper_should_notice_show' ) ) 142 | ->getMock(); 143 | 144 | // Test when null/false return from helper_should_notice_show 145 | $geoip_mock->enqueue_admin_js(); 146 | $is_enqueued = isset($wp_scripts->registered[GeoIp::TEXT_DOMAIN . '-admin-js']); 147 | $this->assertFalse($is_enqueued); 148 | 149 | $geoip_mock->expects( $this->once() ) 150 | ->method( 'helper_should_notice_show' ) 151 | ->willReturn( true ); 152 | 153 | // Test for enqueue 154 | $geoip_mock->enqueue_admin_js(); 155 | $is_enqueued = isset($wp_scripts->registered[GeoIp::TEXT_DOMAIN . '-admin-js']); 156 | $this->assertTrue($is_enqueued); 157 | 158 | // Test for localized script with nonce 159 | $nonce_var_string = false; 160 | $wp_dependency = $wp_scripts->registered[GeoIp::TEXT_DOMAIN . '-admin-js']; 161 | if (isset($wp_dependency->extra['data'])) { 162 | $nonce_var_string = $wp_dependency->extra['data']; 163 | } 164 | $this->assertStringContainsString('nonce', $nonce_var_string); 165 | } 166 | 167 | /** 168 | * Test display of admin notice 169 | */ 170 | public function test_action_admin_notices() { 171 | $geoip_mock = $this->getMockBuilder( self::$class_name ) 172 | ->disableOriginalConstructor() 173 | ->setMethods( null ) 174 | ->getMock(); 175 | 176 | $notice = 'WP Engine GeoTarget requires a WP Engine account with GeoTarget enabled for full functionality. Only testing queries will work on this site.'; 177 | $geoip_mock->admin_notices = array( 178 | 'warning' => array( 179 | 'dependency' => sprintf( $notice, 'http://wpengine.com/plans/?utm_source=' . GeoIp::TEXT_DOMAIN ), 180 | ), 181 | ); 182 | 183 | ob_start(); 184 | $geoip_mock->action_admin_notices(); 185 | $actual_output = $this->getActualOutput(); 186 | ob_end_clean(); 187 | 188 | $expected_output = array( 189 | '
', 190 | '

', 191 | 'WP Engine GeoTarget requires a WP Engine account with GeoTarget enabled for full functionality. Only testing queries will work on this site.', 192 | '

', 193 | '
', 194 | ); 195 | 196 | foreach ( $expected_output as $line ) { 197 | $this->assertStringContainsString( $line, $actual_output ); 198 | } 199 | } 200 | 201 | public function test_geos_array_callers() { 202 | $geoip_mock = $this->getMockBuilder( self::$class_name ) 203 | ->disableOriginalConstructor() 204 | ->setMethods( null ) 205 | ->getMock(); 206 | 207 | // Test continent with null value 208 | $this->assertEmpty($geoip_mock->continent()); 209 | 210 | // Test continent with value but while countries is not yet set 211 | $this->assertEmpty($geoip_mock->continent('EC')); 212 | 213 | $geoip_mock->countries = array( 214 | 'EC' => array( 215 | 'country' => 'Ecuador', 216 | 'continent' => 'SA', 217 | ), 218 | ); 219 | 220 | // Test continent 221 | $this->assertEquals('SA', $geoip_mock->continent('EC')); 222 | 223 | $geoip_mock->geos = array( 224 | 'countrycode' => 'abc', 225 | 'region' => 'easy as', 226 | 'city' => '123', 227 | 'postalcode' => 'simple as', 228 | 'latitude' => 'do-re-me', 229 | 'longitude' => 'you and me', 230 | ); 231 | 232 | // Test geos getters 233 | $this->assertEquals('abc', $geoip_mock->country()); 234 | $this->assertEquals('easy as', $geoip_mock->region()); 235 | $this->assertEquals('123', $geoip_mock->city()); 236 | $this->assertEquals('simple as', $geoip_mock->postal_code()); 237 | $this->assertEquals('do-re-me', $geoip_mock->latitude()); 238 | $this->assertEquals('you and me', $geoip_mock->longitude()); 239 | } 240 | 241 | public function test_do_shortcode_except_content() { 242 | $geoip_mock = $this->getMockBuilder( self::$class_name ) 243 | ->disableOriginalConstructor() 244 | ->setMethods( null ) 245 | ->getMock(); 246 | 247 | $geoip_mock->geos = array(); 248 | 249 | // Test do_shortcode_region without GeoIP->geos['region'] set 250 | $this->assertEquals('[' . GeoIp::SHORTCODE_REGION . ']', $geoip_mock->do_shortcode_region( null )); 251 | 252 | // Test do_shortcode_city without GeoIP->geos['city'] set 253 | $this->assertEquals('[' . GeoIp::SHORTCODE_CITY . ']', $geoip_mock->do_shortcode_city( null )); 254 | 255 | // Test do_shortcode_postal_code without GeoIP->geos['postalcode'] set 256 | $this->assertEquals('[' . GeoIp::SHORTCODE_POSTAL_CODE . ']', $geoip_mock->do_shortcode_postal_code( null )); 257 | 258 | // Test do_shortcode_latitude without GeoIP->geos['latitude'] set 259 | $this->assertEquals('[' . GeoIp::SHORTCODE_LATITUDE . ']', $geoip_mock->do_shortcode_latitude( null )); 260 | 261 | // Test do_shortcode_longitude without GeoIP->geos['longitude'] set 262 | $this->assertEquals('[' . GeoIp::SHORTCODE_LONGITUDE . ']', $geoip_mock->do_shortcode_longitude( null )); 263 | 264 | // Test do_shortcode_country without GeoIP->geos['countrycode'] set 265 | $this->assertEquals('[' . GeoIp::SHORTCODE_COUNTRY . ']', $geoip_mock->do_shortcode_country( null )); 266 | 267 | $geoip_mock->geos = array( 268 | 'countrycode' => 'EC', 269 | 'region' => 'easy as', 270 | 'city' => '123', 271 | 'postalcode' => 'simple as', 272 | 'latitude' => 'do-re-me', 273 | 'longitude' => 'you and me', 274 | ); 275 | 276 | // Test do_shortcode_continent without GeoIP->countries set 277 | $this->assertEquals('[' . GeoIp::SHORTCODE_CONTINENT . ']', $geoip_mock->do_shortcode_continent( null )); 278 | 279 | $geoip_mock->countries = array( 280 | 'EC' => array( 281 | 'country' => 'Ecuador', 282 | 'continent' => 'SA', 283 | ), 284 | ); 285 | 286 | // Test do_shortcode_continent 287 | $this->assertEquals('SA', $geoip_mock->do_shortcode_continent( null )); 288 | 289 | // do_shortcode_... 290 | $this->assertEquals('EC', $geoip_mock->do_shortcode_country( null )); 291 | $this->assertEquals('easy as', $geoip_mock->do_shortcode_region( null )); 292 | $this->assertEquals('123', $geoip_mock->do_shortcode_city( null )); 293 | $this->assertEquals('simple as', $geoip_mock->do_shortcode_postal_code( null )); 294 | $this->assertEquals('do-re-me', $geoip_mock->do_shortcode_latitude( null )); 295 | $this->assertEquals('you and me', $geoip_mock->do_shortcode_longitude( null )); 296 | } 297 | 298 | public function test_do_shortcode_location() { 299 | $city = 'Raleigh'; 300 | $region = 'North Carolina'; 301 | $country = 'US'; 302 | 303 | $geoip_mock = $this->getMockBuilder( self::$class_name ) 304 | ->disableOriginalConstructor() 305 | ->setMethods( array('city', 'region', 'country') ) 306 | ->getMock(); 307 | 308 | $geoip_mock->method( 'country' ) 309 | ->willReturn( $country ); 310 | 311 | $geoip_mock->method( 'region' ) 312 | ->willReturn( $region ); 313 | 314 | $geoip_mock->method( 'city' ) 315 | ->will( $this->onConsecutiveCalls(null, $city) ); 316 | 317 | $this->assertEquals("{$region} {$country}", $geoip_mock->do_shortcode_location(null)); 318 | $this->assertEquals("{$city}, {$region} {$country}", $geoip_mock->do_shortcode_location(null)); 319 | } 320 | 321 | public function test_compare_location_type() { 322 | $geoip_mock = $this->getMockBuilder( self::$class_name ) 323 | ->disableOriginalConstructor() 324 | ->setMethods( null ) 325 | ->getMock(); 326 | 327 | $this->assertEquals(0, $geoip_mock->compare_location_type('planet', 'continent')); 328 | $this->assertEquals(2, $geoip_mock->compare_location_type('postalcode', 'areacode')); 329 | $this->assertEquals(-2, $geoip_mock->compare_location_type('areacode', 'postalcode')); 330 | } 331 | 332 | public function test_get_test_parameters() { 333 | $geoip_mock = $this->getMockBuilder( self::$class_name ) 334 | ->disableOriginalConstructor() 335 | ->setMethods( array('match_label_synonyms') ) 336 | ->getMock(); 337 | 338 | $geoip_mock->method( 'match_label_synonyms' ) 339 | ->will($this->returnArgument(0)); 340 | 341 | $geoip_mock->geos = array( 342 | 'overwrite_me' => 'should not exist', 343 | '&nother_geo' => 'not TX' 344 | ); 345 | 346 | // Test without $_GET['geoip'] set 347 | $this->assertEquals($geoip_mock->geos, $geoip_mock->get_test_parameters($geoip_mock->geos)); 348 | 349 | $_GET = array( 350 | 'geoip' => true, 351 | 'overwrite_me' => 'should exist', 352 | '¬her_geo' => 'TX&', // test escaping 353 | 'key_should_not_exist' => 'bad key bad!', 354 | ); 355 | 356 | $expected = array( 357 | 'overwrite_me' => 'should exist', 358 | '&nother_geo' => 'TX&', // test escaping 359 | ); 360 | $this->assertEquals($expected, $geoip_mock->get_test_parameters($geoip_mock->geos)); 361 | } 362 | 363 | public function test_match_label_synonyms() { 364 | $geoip_mock = $this->getMockBuilder( self::$class_name ) 365 | ->disableOriginalConstructor() 366 | ->setMethods( null ) 367 | ->getMock(); 368 | 369 | // Test empty string 370 | $this->assertEquals('', $geoip_mock->match_label_synonyms('')); 371 | 372 | // Test non-string 373 | $this->assertEquals(null, $geoip_mock->match_label_synonyms(null)); 374 | 375 | // Test country, state, zipcode and zip 376 | $this->assertEquals('countrycode', $geoip_mock->match_label_synonyms('country')); 377 | $this->assertEquals('region', $geoip_mock->match_label_synonyms('state')); 378 | $this->assertEquals('postalcode', $geoip_mock->match_label_synonyms('zipcode')); 379 | $this->assertEquals('postalcode', $geoip_mock->match_label_synonyms('zip')); 380 | } 381 | 382 | /** 383 | * @param float $latitude 384 | * @param float $longitude 385 | * @param bool $is_metric Should calculation be done in metric? 386 | * @param float $mock_latitude Response from the latitude method 387 | * @param float $mock_longitude Response from the longitude method 388 | * @param float $distance Distance between the two points 389 | * 390 | * @dataProvider data_distance_to 391 | */ 392 | public function test_distance_to($latitude, $longitude, $is_metric, $mock_latitude, $mock_longitude, $distance) { 393 | $geoip_mock = $this->getMockBuilder( self::$class_name ) 394 | ->disableOriginalConstructor() 395 | ->setMethods( array('latitude', 'longitude') ) 396 | ->getMock(); 397 | 398 | $geoip_mock->method( 'latitude' ) 399 | ->willReturn( $mock_latitude ); 400 | 401 | $geoip_mock->method( 'longitude' ) 402 | ->willReturn( $mock_longitude ); 403 | 404 | $this->assertEquals($distance, $geoip_mock->distance_to($latitude, $longitude, $is_metric)); 405 | } 406 | 407 | public function data_distance_to() { 408 | return array( 409 | array( // Test distance to the same point 410 | 'latitude' => 0.0, 411 | 'longitude' => 0.0, 412 | 'is_metric' => false, 413 | 'mock_latitude' => 0.0, 414 | 'mock_longitude' => 0.0, 415 | 'distance' => 0.0, 416 | ), 417 | array( // Test non-metric distance 418 | 'latitude' => 35.7796, 419 | 'longitude' => -78.6382, 420 | 'is_metric' => false, 421 | 'mock_latitude' => 30.2672, 422 | 'mock_longitude' => -97.7431, 423 | 'distance' => 8225.556014347605, 424 | ), 425 | array( // Test metric distance 426 | 'latitude' => 35.7796, 427 | 'longitude' => -78.6382, 428 | 'is_metric' => true, 429 | 'mock_latitude' => 30.2672, 430 | 'mock_longitude' => -97.7431, 431 | 'distance' => 13234.40254466985, 432 | ), 433 | ); 434 | } 435 | 436 | public function test_helper_should_notice_show() { 437 | $geoip_mock = $this->getMockBuilder( self::$class_name ) 438 | ->disableOriginalConstructor() 439 | ->setMethods( null ) 440 | ->getMock(); 441 | 442 | $geoip_mock->geos = array(); 443 | $notice = 'poke'; 444 | 445 | // Test no notice name 446 | $this->assertFalse($geoip_mock->helper_should_notice_show( null )); 447 | 448 | // Test dismissal not set and GeoIP not active 449 | $geoip_mock->geos['active'] = false; 450 | $this->assertTrue($geoip_mock->helper_should_notice_show( $notice )); 451 | 452 | // Test with dismissal not set but GeoIP active 453 | $geoip_mock->geos['active'] = true; 454 | $this->assertFalse($geoip_mock->helper_should_notice_show( $notice )); 455 | 456 | // Test with dismissal set but GeoIP not active 457 | add_user_meta( get_current_user_id(), GeoIP::TEXT_DOMAIN . '-notice-dismissed-' . $notice, true ); 458 | $geoip_mock->geos['active'] = false; 459 | $this->assertTrue($geoip_mock->helper_should_notice_show( $notice )); 460 | 461 | // Test with dismissal set and GeoIP active 462 | $geoip_mock->geos['active'] = true; 463 | $this->assertFalse($geoip_mock->helper_should_notice_show( $notice )); 464 | } 465 | 466 | public function test_action_admin_init_check_plugin_dependencies() { 467 | $geoip_mock = $this->getMockBuilder( self::$class_name ) 468 | ->disableOriginalConstructor() 469 | ->setMethods( array('helper_should_notice_show') ) 470 | ->getMock(); 471 | 472 | $geoip_mock->method( 'helper_should_notice_show' ) 473 | ->will( $this->onConsecutiveCalls(false, true) ); 474 | 475 | $geoip_mock->admin_notices = $expected = array( 476 | 'info' => array(), 477 | 'error' => array(), 478 | 'success' => array(), 479 | 'warning' => array(), 480 | ); 481 | 482 | // Test without an admin notice 483 | $geoip_mock->action_admin_init_check_plugin_dependencies(); 484 | $this->assertEquals($expected, $geoip_mock->admin_notices); 485 | 486 | // Test with an admin notice 487 | $notice = 'WP Engine GeoTarget requires a WP Engine account with GeoTarget enabled for full functionality. Only testing queries will work on this site.'; 488 | $expected['warning'] = array( 489 | 'dependency' => sprintf( $notice, 'http://wpengine.com/plans/?utm_source=' . GeoIp::TEXT_DOMAIN ), 490 | ); 491 | $geoip_mock->action_admin_init_check_plugin_dependencies(); 492 | $this->assertEquals($expected, $geoip_mock->admin_notices); 493 | } 494 | 495 | public function test_get_actuals() { 496 | $geoip_mock = $this->getMockBuilder( self::$class_name ) 497 | ->disableOriginalConstructor() 498 | ->setMethods( array('continent') ) 499 | ->getMock(); 500 | 501 | $geoip_mock->method( 'continent' ) 502 | ->willReturn( 'NA' ); 503 | 504 | $expected = array( 505 | 'countrycode' => 'US', 506 | 'countrycode3' => false, 507 | 'countryname' => 'United States', 508 | 'latitude' => '30.40000', 509 | 'longitude' => '-97.75280', 510 | 'areacode' => false, 511 | 'region' => 'TX', 512 | 'city' => 'Austin', 513 | 'postalcode' => '78759', 514 | 'active' => true, 515 | 'continent' => 'NA', 516 | ); 517 | $actual = $geoip_mock->get_actuals(); 518 | $this->assertEquals($expected, $actual); 519 | } 520 | } 521 | -------------------------------------------------------------------------------- /src/class-geoip.php: -------------------------------------------------------------------------------- 1 | city()}, {$geo->region()} {$geo->country()}?

"; 22 | return $content; 23 | } 24 | add_filter( 'the_content', 'geoip_append_content' ); 25 | */ 26 | 27 | namespace WPEngine; 28 | 29 | // Exit if this file is directly accessed. 30 | if ( ! defined( 'ABSPATH' ) ) { 31 | exit; 32 | } 33 | 34 | /** 35 | * Base class for the GeoTarget plugin, GeoTarget was formerly called GeoIP 36 | */ 37 | class GeoIp { 38 | 39 | /** 40 | * The single instance of this object. No need to have more than one. 41 | * 42 | * @var GeoIP 43 | */ 44 | private static $instance = null; 45 | 46 | /** 47 | * The path to the plugin. Let's just make that function call once. 48 | * 49 | * @var string 50 | */ 51 | private $geoip_path; 52 | 53 | /** 54 | * The geographical data loaded from the environment. 55 | * 56 | * @var array 57 | */ 58 | public $geos; 59 | 60 | /** 61 | * A list of countries and their continents. 62 | * 63 | * @var array 64 | */ 65 | public $countries; 66 | 67 | /** 68 | * WP-Admin errors notices. 69 | * 70 | * @var array 71 | */ 72 | public $admin_notices; 73 | 74 | /** 75 | * Text Domain. 76 | * 77 | * @var string 78 | */ 79 | const TEXT_DOMAIN = 'wpengine-geoip'; 80 | 81 | /** 82 | * Version Number. 83 | * 84 | * @var string 85 | */ 86 | const VERSION = '1.2.1'; 87 | 88 | // Shortcodes. 89 | const SHORTCODE_CONTINENT = 'geoip-continent'; 90 | const SHORTCODE_COUNTRY = 'geoip-country'; 91 | const SHORTCODE_REGION = 'geoip-region'; 92 | const SHORTCODE_CITY = 'geoip-city'; 93 | const SHORTCODE_POSTAL_CODE = 'geoip-postalcode'; 94 | const SHORTCODE_LATITUDE = 'geoip-latitude'; 95 | const SHORTCODE_LONGITUDE = 'geoip-longitude'; 96 | const SHORTCODE_LOCATION = 'geoip-location'; 97 | const SHORTCODE_CONTENT = 'geoip-content'; 98 | 99 | /** 100 | * Initialize hooks and setup environment variables 101 | * 102 | * @since 0.1.0 103 | */ 104 | public static function init() { 105 | 106 | // Initialize. 107 | add_action( 'init', array( self::instance(), 'setup' ) ); 108 | add_action( 'init', array( self::instance(), 'action_init_register_shortcodes' ) ); 109 | 110 | // Enqueue our javascript. 111 | add_action( 'admin_enqueue_scripts', array( self::instance(), 'enqueue_admin_js' ) ); 112 | 113 | // Check for updates. 114 | add_action( 'admin_init', array( self::instance(), 'check_for_upgrades' ) ); 115 | 116 | // Check for dependencies. 117 | add_action( 'admin_init', array( self::instance(), 'action_admin_init_check_plugin_dependencies' ), 9999 ); // check late. 118 | add_action( 'admin_notices', array( self::instance(), 'action_admin_notices' ) ); 119 | 120 | // Process AJAX requests. 121 | add_action( 'wp_ajax_geoip_dismiss_notice', array( self::instance(), 'ajax_action_dismiss_notice' ) ); 122 | } 123 | 124 | /** 125 | * Register singleton 126 | * 127 | * @since 0.1.0 128 | */ 129 | public static function instance() { 130 | // Create a new object if it doesn't exist. 131 | if ( is_null( self::$instance ) ) { 132 | self::$instance = new self(); 133 | } 134 | 135 | return self::$instance; 136 | } 137 | 138 | /** 139 | * Setup environment variables 140 | * 141 | * @since 0.1.0 142 | */ 143 | public function setup() { 144 | 145 | $this->geoip_path = plugin_dir_path( __FILE__ ); 146 | 147 | // Get our array of countries and continents. 148 | require_once $this->geoip_path . '/inc/country-list.php'; 149 | 150 | $this->countries = apply_filters( 'geoip_country_list', geoip_country_list() ); 151 | 152 | $this->geos = $this->get_actuals(); 153 | 154 | $this->geos = $this->get_test_parameters( $this->geos ); 155 | 156 | $this->geos = wp_unslash( $this->geos ); 157 | 158 | $this->geos = apply_filters( 'geoip_location_values', $this->geos ); 159 | 160 | // Prepopulate the admin notices array. 161 | $this->admin_notices = array( 162 | 'info' => array(), 163 | 'error' => array(), 164 | 'success' => array(), 165 | 'warning' => array(), 166 | ); 167 | } 168 | 169 | /** 170 | * Enqueue the admin Javascript file 171 | * 172 | * @since 1.2.1 173 | */ 174 | public function enqueue_admin_js() { 175 | // Only enqueue the JS if the notice will be showing. 176 | if ( ! $this->helper_should_notice_show( 'dependency' ) ) { 177 | return; 178 | } 179 | 180 | wp_enqueue_script( self::TEXT_DOMAIN . '-admin-js', plugins_url( 'js/admin.js', __FILE__ ), null, self::VERSION, true ); 181 | wp_localize_script( self::TEXT_DOMAIN . '-admin-js', 'nonce', array( wp_create_nonce( self::TEXT_DOMAIN ) ) ); 182 | } 183 | 184 | /** 185 | * Here we extract the data from headers set by nginx -- lets only send them if they are part of the cache key 186 | * 187 | * @since 0.1.0 188 | * @return array All of the GeoTarget related environment variables available on the current server instance 189 | */ 190 | public function get_actuals() { 191 | 192 | $geos = array( 193 | 'countrycode' => getenv( 'HTTP_GEOIP_COUNTRY_CODE' ), 194 | 'countrycode3' => getenv( 'HTTP_GEOIP_COUNTRY_CODE3' ), 195 | 'countryname' => getenv( 'HTTP_GEOIP_COUNTRY_NAME' ), 196 | 'latitude' => getenv( 'HTTP_GEOIP_LATITUDE' ), 197 | 'longitude' => getenv( 'HTTP_GEOIP_LONGITUDE' ), 198 | 'areacode' => getenv( 'HTTP_GEOIP_AREA_CODE' ), 199 | 'region' => getenv( 'HTTP_GEOIP_REGION' ), 200 | 'city' => getenv( 'HTTP_GEOIP_CITY' ), 201 | 'postalcode' => getenv( 'HTTP_GEOIP_POSTAL_CODE' ), 202 | ); 203 | 204 | $geos['active'] = ( isset( $geos['countrycode'] ) && false !== $geos['countrycode'] ) ? true : false; 205 | 206 | $geos['continent'] = $this->continent( $geos['countrycode'] ); 207 | 208 | return $geos; 209 | } 210 | 211 | /** 212 | * We want people to be able to test the plugin, so we'll include some url parameters that will spoof a location 213 | * 214 | * @since 1.1.0 215 | * @param array $geos Array of values for the user's location. 216 | * @return array Modified version of the GeoTarget location array based on url parameters 217 | */ 218 | public function get_test_parameters( $geos ) { 219 | // phpcs:ignore WordPress.Security.NonceVerification.Recommended 220 | $params = $_GET; 221 | 222 | if ( ! isset( $params['geoip'] ) ) { 223 | return $geos; 224 | } 225 | 226 | foreach ( $params as $key => $value ) { 227 | 228 | $key = esc_attr( $key ); 229 | $value = esc_attr( $value ); 230 | 231 | $key = $this->match_label_synonyms( $key ); 232 | 233 | if ( isset( $geos[ $key ] ) ) { 234 | $geos[ $key ] = $value; 235 | } 236 | } 237 | 238 | return $geos; 239 | } 240 | 241 | /** 242 | * Get Continent 243 | * 244 | * @since 1.1.0 245 | * @param string $country Two-letter country code. 246 | * @return string Two-letter continent code, e.g. EU for Europe 247 | */ 248 | public function continent( $country = '' ) { 249 | 250 | $continent = ''; 251 | 252 | if ( empty( $country ) && ! empty( $this->geos['countrycode'] ) ) { 253 | $country = $this->geos['countrycode']; 254 | } 255 | 256 | if ( isset( $this->countries[ $country ] ) ) { 257 | $continent = $this->countries[ $country ]['continent']; 258 | } 259 | 260 | return $continent; 261 | } 262 | 263 | /** 264 | * Get Country 265 | * 266 | * @since 0.5.0 267 | * @return string Two-letter country code, e.g.) US for the United States of America 268 | */ 269 | public function country() { 270 | return $this->geos['countrycode']; 271 | } 272 | 273 | /** 274 | * Get Region 275 | * 276 | * @since 0.5.0 277 | * @return string Two-letter region code. e.g.) CA for California 278 | */ 279 | public function region() { 280 | return $this->geos['region']; 281 | } 282 | 283 | /** 284 | * Get City 285 | * 286 | * @since 0.5.0 287 | * @return mixed Description 288 | */ 289 | public function city() { 290 | return $this->geos['city']; 291 | } 292 | 293 | /** 294 | * Get Postal Code 295 | * 296 | * @since 0.6.0 297 | * @return mixed Description 298 | */ 299 | public function postal_code() { 300 | return $this->geos['postalcode']; 301 | } 302 | 303 | /** 304 | * Get Latitude 305 | * 306 | * @since 0.6.0 307 | * @return mixed Description 308 | */ 309 | public function latitude() { 310 | return $this->geos['latitude']; 311 | } 312 | 313 | /** 314 | * Get Longitude 315 | * 316 | * @since 0.6.0 317 | * @return mixed Description 318 | */ 319 | public function longitude() { 320 | return $this->geos['longitude']; 321 | } 322 | 323 | /** 324 | * Register the shortcode(s) 325 | * 326 | * @since 0.5.0 327 | * @uses add_shortcode() 328 | */ 329 | public function action_init_register_shortcodes() { 330 | 331 | // Continent Shortcode. 332 | if ( ! shortcode_exists( self::SHORTCODE_CONTINENT ) ) { 333 | add_shortcode( self::SHORTCODE_CONTINENT, array( $this, 'do_shortcode_continent' ) ); 334 | } 335 | 336 | // Country Shortcode. 337 | if ( ! shortcode_exists( self::SHORTCODE_COUNTRY ) ) { 338 | add_shortcode( self::SHORTCODE_COUNTRY, array( $this, 'do_shortcode_country' ) ); 339 | } 340 | 341 | // Region Shortcode. 342 | if ( ! shortcode_exists( self::SHORTCODE_REGION ) ) { 343 | add_shortcode( self::SHORTCODE_REGION, array( $this, 'do_shortcode_region' ) ); 344 | } 345 | 346 | // City Shortcode. 347 | if ( ! shortcode_exists( self::SHORTCODE_CITY ) ) { 348 | add_shortcode( self::SHORTCODE_CITY, array( $this, 'do_shortcode_city' ) ); 349 | } 350 | 351 | // Postal Code Shortcode. 352 | if ( ! shortcode_exists( self::SHORTCODE_POSTAL_CODE ) ) { 353 | add_shortcode( self::SHORTCODE_POSTAL_CODE, array( $this, 'do_shortcode_postal_code' ) ); 354 | } 355 | 356 | // Latitude Shortcode. 357 | if ( ! shortcode_exists( self::SHORTCODE_LATITUDE ) ) { 358 | add_shortcode( self::SHORTCODE_LATITUDE, array( $this, 'do_shortcode_latitude' ) ); 359 | } 360 | 361 | // Longitude Shortcode. 362 | if ( ! shortcode_exists( self::SHORTCODE_LONGITUDE ) ) { 363 | add_shortcode( self::SHORTCODE_LONGITUDE, array( $this, 'do_shortcode_longitude' ) ); 364 | } 365 | 366 | // Smart Location Shortcode. 367 | if ( ! shortcode_exists( self::SHORTCODE_LOCATION ) ) { 368 | add_shortcode( self::SHORTCODE_LOCATION, array( $this, 'do_shortcode_location' ) ); 369 | } 370 | 371 | // Smart Location Shortcode. 372 | if ( ! shortcode_exists( self::SHORTCODE_CONTENT ) ) { 373 | add_shortcode( self::SHORTCODE_CONTENT, array( $this, 'do_shortcode_content' ) ); 374 | } 375 | } 376 | 377 | /** 378 | * Output the current continent 379 | * 380 | * @since 1.1.0 381 | * @param array $atts Shortcode attributes. 382 | * @return string Two-letter continent code 383 | */ 384 | public function do_shortcode_continent( $atts ) { 385 | $continent = '[' . self::SHORTCODE_CONTINENT . ']'; 386 | 387 | $country = $this->geos['countrycode']; 388 | 389 | if ( isset( $this->countries[ $country ] ) ) { 390 | $continent = $this->countries[ $country ]['continent']; 391 | } 392 | return $continent; 393 | } 394 | 395 | /** 396 | * Output the current country 397 | * 398 | * @since 0.5.0 399 | * @param array $atts Shortcode attributes. 400 | * @return string Two-letter country code 401 | */ 402 | public function do_shortcode_country( $atts ) { 403 | if ( isset( $this->geos['countrycode'] ) ) { 404 | return $this->country(); 405 | } 406 | return '[' . self::SHORTCODE_COUNTRY . ']'; 407 | } 408 | 409 | /** 410 | * Output the current region 411 | * 412 | * @since 0.5.0 413 | * @param array $atts Shortcode attributes. 414 | * @return string Two-letter region code 415 | */ 416 | public function do_shortcode_region( $atts ) { 417 | if ( isset( $this->geos['region'] ) ) { 418 | return $this->region(); 419 | } 420 | return '[' . self::SHORTCODE_REGION . ']'; 421 | } 422 | 423 | /** 424 | * Output the current city 425 | * 426 | * @since 0.5.0 427 | * @param array $atts Shortcode attributes. 428 | * @return string City name 429 | */ 430 | public function do_shortcode_city( $atts ) { 431 | if ( isset( $this->geos['city'] ) ) { 432 | return $this->city(); 433 | } 434 | return '[' . self::SHORTCODE_CITY . ']'; 435 | } 436 | 437 | /** 438 | * Output the current postal code 439 | * 440 | * @since 0.6.0 441 | * @param array $atts Shortcode attributes. 442 | * @return string postal code 443 | */ 444 | public function do_shortcode_postal_code( $atts ) { 445 | if ( isset( $this->geos['postalcode'] ) ) { 446 | return $this->postal_code(); 447 | } 448 | return '[' . self::SHORTCODE_POSTAL_CODE . ']'; 449 | } 450 | 451 | /** 452 | * Output the current latitude 453 | * 454 | * @since 0.6.0 455 | * @param array $atts Shortcode attributes. 456 | * @return string latitude 457 | */ 458 | public function do_shortcode_latitude( $atts ) { 459 | if ( isset( $this->geos['latitude'] ) ) { 460 | return $this->latitude(); 461 | } 462 | return '[' . self::SHORTCODE_LATITUDE . ']'; 463 | } 464 | 465 | /** 466 | * Output the current longitude 467 | * 468 | * @since 0.6.0 469 | * @param array $atts Shortcode attributes. 470 | * @return string longitude 471 | */ 472 | public function do_shortcode_longitude( $atts ) { 473 | if ( isset( $this->geos['longitude'] ) ) { 474 | return $this->longitude(); 475 | } 476 | return '[' . self::SHORTCODE_LONGITUDE . ']'; 477 | } 478 | 479 | /** 480 | * Output the current human readable location, in a smart way. 481 | * 482 | * @since 0.5.0 483 | * @param array $atts Shortcode attributes. 484 | * @return string $html 485 | */ 486 | public function do_shortcode_location( $atts ) { 487 | 488 | $city = $this->city(); 489 | if ( isset( $city ) && ! empty( $city ) ) { 490 | return trim( $city . ', ' . $this->region() . ' ' . $this->country() ); 491 | } 492 | // Fallback. 493 | return trim( $this->region() . ' ' . $this->country() ); 494 | } 495 | 496 | /** 497 | * Output the content filtered by region 498 | * 499 | * @since 1.1.0 500 | * @param array $atts Shortcode attributes. 501 | * @param string $content HTML content that comes between the shortcode tags. 502 | * @return string HTML 503 | */ 504 | public function do_shortcode_content( $atts, $content = null ) { 505 | 506 | $keep = true; 507 | 508 | $test_parameters = array(); 509 | 510 | // Process and organzie the test parameters. 511 | foreach ( $atts as $label => $value ) { 512 | 513 | // Intialize our negation parameters. 514 | $negate = 0; 515 | $inline_negate = 0; 516 | 517 | // Check to see if the attribute has "not-" or "not_" in it. 518 | $negate = preg_match( '/not?[-_]?(.*)/', $label, $matches ); 519 | 520 | // WordPress doesn't like a dash in shortcode parameter labels. 521 | // Just in case, check to see if the value has "not-" in it. 522 | if ( ! $negate ) { 523 | $negate = preg_match( '/not?\-([^=]+)\=\"?([^"]+)\"?/', $value, $matches ); 524 | $inline_negate = $negate; 525 | } 526 | 527 | // Label after the negation match. 528 | $label = $negate ? $matches[1] : $label; 529 | 530 | // Value after the negation match. 531 | $value = $inline_negate ? $matches[2] : $value; 532 | 533 | // Replace common synonyms with our values. 534 | $label = $this->match_label_synonyms( $label ); 535 | 536 | // Abort if the label doesn't match. 537 | if ( ! isset( $this->geos[ $label ] ) ) { 538 | continue; 539 | } 540 | 541 | // Find out if the value is comma delimited. 542 | $test_values = (array) explode( ',', $value ); 543 | 544 | // Add the value to the test parameters. 545 | $test_parameters[ $label ] = array( 546 | 'test_values' => $test_values, 547 | 'negate' => $negate, 548 | ); 549 | } 550 | 551 | // Sort the test parameters by region type – largest to smallest. 552 | uksort( $test_parameters, array( $this, 'compare_location_type' ) ); 553 | 554 | $test_parameters = apply_filters( 'geoip_test_parameters', $test_parameters, $atts ); 555 | 556 | // Process through parameters, testing to see if we have a match. 557 | foreach ( $test_parameters as $label => $parameter ) { 558 | 559 | $test_values = $parameter['test_values']; 560 | 561 | $negate = $parameter['negate']; 562 | 563 | // Sanitize the match value. 564 | $match_value = strtolower( $this->geos[ $label ] ); 565 | 566 | // Sanitize the test values. 567 | foreach ( $test_values as &$test_value ) { 568 | $test_value = strtolower( trim( $test_value, " \t\"." ) ); 569 | } 570 | 571 | $is_match = in_array( $match_value, $test_values, true ); 572 | 573 | $is_match = ! $negate ? $is_match : ! $is_match; 574 | 575 | if ( ! $is_match ) { 576 | $keep = false; 577 | } 578 | } 579 | 580 | if ( ! $keep ) { 581 | return ''; 582 | } 583 | 584 | // Process any shortcodes in the content. 585 | $content = do_shortcode( $content ); 586 | 587 | return apply_filters( 'geoip_content', $content, $atts ); 588 | } 589 | 590 | /** 591 | * Compare the location types 592 | * 593 | * Used for sorting location types from largest area to smallest area 594 | * 595 | * @since 1.1.2 596 | * @param string $a Type of location. 597 | * @param string $b Type of location. 598 | * @return int Whether $a is more important than b 599 | */ 600 | public function compare_location_type( $a, $b ) { 601 | $location_types = array( 602 | 'continent' => 1, 603 | 'countrycode' => 2, 604 | 'countrycode3' => 2, 605 | 'countryname' => 2, 606 | 'region' => 3, 607 | 'areacode' => 4, 608 | 'city' => 5, 609 | 'postalcode' => 6, 610 | ); 611 | 612 | if ( isset( $location_types[ $a ] ) && isset( $location_types[ $b ] ) ) { 613 | return $location_types[ $a ] - $location_types[ $b ]; 614 | } else { 615 | return 0; 616 | } 617 | } 618 | 619 | /** 620 | * Checks if environment variable depencies are available on the server 621 | * 622 | * @todo Include link to query documentation when available on the Plugin Directory 623 | * @since 0.5.0 624 | */ 625 | public function action_admin_init_check_plugin_dependencies() { 626 | $notice_key = 'dependency'; 627 | 628 | if ( $this->helper_should_notice_show( $notice_key ) ) { 629 | /* translators: Tells users that the plugin won't automatically work if they're not in the right setup */ 630 | $notice = __( 'WP Engine GeoTarget requires a WP Engine account with GeoTarget enabled for full functionality. Only testing queries will work on this site.', 'wpengine-geoip' ); 631 | $this->admin_notices['warning'][ $notice_key ] = sprintf( $notice, 'http://wpengine.com/plans/?utm_source=' . self::TEXT_DOMAIN ); 632 | } 633 | } 634 | 635 | /** 636 | * Initialize the checking for plugin updates. 637 | */ 638 | public function check_for_upgrades() { 639 | $properties = array( 640 | 'plugin_slug' => 'wpengine-geoip', 641 | 'plugin_basename' => plugin_basename( __FILE__ ), 642 | ); 643 | 644 | require_once __DIR__ . '/class-pluginupdater.php'; 645 | new \WPEngine\GeoIP\Updates\PluginUpdater( $properties ); 646 | } 647 | 648 | /** 649 | * Displays any of our registered notices 650 | * 651 | * @since 0.5.0 652 | */ 653 | public function action_admin_notices() { 654 | foreach ( $this->admin_notices as $type => $notices ) { 655 | foreach ( $notices as $key => $notice ) { 656 | ?> 657 |
658 |

659 | array( 664 | 'href' => array(), 665 | ), 666 | 'span', 667 | 'strong', 668 | 'em', 669 | ) 670 | ); 671 | ?> 672 |

673 |
674 | geos['active']; 708 | $is_dismissed = get_user_meta( get_current_user_id(), self::TEXT_DOMAIN . '-notice-dismissed-' . $notice, true ); 709 | 710 | // false = GeoTarget is active, or if we've dismissed the notice before. 711 | // true = GeoTarget is not active and we haven't dismissed the notice before. 712 | return ! ( $is_active || $is_dismissed ); 713 | } 714 | 715 | /** 716 | * As a favor to users, let's match some common synonyms 717 | * 718 | * @since 1.1.0 719 | * @param string $label The address label that needs a synonym. 720 | * @return string label 721 | */ 722 | public function match_label_synonyms( $label ) { 723 | 724 | if ( 'country' === $label ) { 725 | $label = 'countrycode'; 726 | } 727 | 728 | if ( 'state' === $label ) { 729 | $label = 'region'; 730 | } 731 | 732 | if ( 'zipcode' === $label || 'zip' === $label ) { 733 | $label = 'postalcode'; 734 | } 735 | 736 | return $label; 737 | } 738 | 739 | /** 740 | * Utility function: Calculate distance to point 741 | * 742 | * Provided a lat/lng, calculate the distance from visitor's location 743 | * Uses the Haversine Formula, accurate for short distance but not over poles or the equator 744 | * 745 | * Note: Test against a return value of false to make sure you got a calculated distance. Example: 746 | * $geo = WPEngine\GeoIp::instance(); 747 | * if ( false !== $geo->distance_to( $latitude, $longitude ) ) { 748 | * // Do something 749 | * } 750 | * 751 | * @link http://andrew.hedges.name/experiments/haversine/ 752 | * @since 1.2 753 | * @param float $lat Latitude of the destination in degrees. 754 | * @param float $lng Longitude of the destination in degrees. 755 | * @param bool $metric Whether to calculate the distance in kilometers or miles. 756 | * @return float Distance in miles 757 | */ 758 | public function distance_to( $lat, $lng, $metric = false ) { 759 | $start_lat = deg2rad( $this->latitude() ); 760 | $start_lng = deg2rad( $this->longitude() ); 761 | 762 | // Test for null values passed into the function or a 0,0 coordinate for the user. 763 | // If either exist, abort. (0,0 is the result when coordinates fail). 764 | if ( is_null( $lat ) || is_null( $lng ) || ( empty( $start_lat ) && empty( $start_lng ) ) ) { 765 | return false; 766 | } 767 | 768 | // Choose the right radius for the results: radius of the Earth in kilometers and miles. 769 | $radius = $metric ? 6373 : 3961; 770 | 771 | // Sanitize the user submitted variables. 772 | $lat = floatval( $lat ); 773 | $lng = floatval( $lng ); 774 | 775 | $dlng = $lng - $start_lng; 776 | $dlat = $lat - $start_lat; 777 | 778 | // Calculate the distance. 779 | $a = ( sin( $dlat / 2 ) * sin( $dlat / 2 ) ) + ( cos( $lat ) * cos( $start_lat ) * sin( $dlng / 2 ) * sin( $dlng / 2 ) ); 780 | $c = 2 * atan2( sqrt( $a ), sqrt( 1 - $a ) ); 781 | $d = $radius * $c; 782 | 783 | return $d; 784 | } 785 | } 786 | 787 | // Register the GeoTarget plugin instance. 788 | GeoIp::init(); 789 | -------------------------------------------------------------------------------- /src/inc/country-list.php: -------------------------------------------------------------------------------- 1 | array( 15 | 'country' => 'Afghanistan', 16 | 'continent' => 'AS', 17 | ), 18 | 'AX' => array( 19 | 'country' => 'Åland Islands', 20 | 'continent' => 'EU', 21 | ), 22 | 'AL' => array( 23 | 'country' => 'Albania', 24 | 'continent' => 'EU', 25 | ), 26 | 'DZ' => array( 27 | 'country' => 'Algeria', 28 | 'continent' => 'AF', 29 | ), 30 | 'AS' => array( 31 | 'country' => 'American Samoa', 32 | 'continent' => 'OC', 33 | ), 34 | 'AD' => array( 35 | 'country' => 'Andorra', 36 | 'continent' => 'EU', 37 | ), 38 | 'AO' => array( 39 | 'country' => 'Angola', 40 | 'continent' => 'AF', 41 | ), 42 | 'AI' => array( 43 | 'country' => 'Anguilla', 44 | 'continent' => 'NA', 45 | ), 46 | 'AQ' => array( 47 | 'country' => 'AN', 48 | 'continent' => 'AN', 49 | ), 50 | 'AG' => array( 51 | 'country' => 'Antigua and Barbuda', 52 | 'continent' => 'NA', 53 | ), 54 | 'AR' => array( 55 | 'country' => 'Argentina', 56 | 'continent' => 'SA', 57 | ), 58 | 'AM' => array( 59 | 'country' => 'Armenia', 60 | 'continent' => 'AS', 61 | ), 62 | 'AW' => array( 63 | 'country' => 'Aruba', 64 | 'continent' => 'NA', 65 | ), 66 | 'AU' => array( 67 | 'country' => 'Australia', 68 | 'continent' => 'OC', 69 | ), 70 | 'AT' => array( 71 | 'country' => 'Austria', 72 | 'continent' => 'EU', 73 | ), 74 | 'AZ' => array( 75 | 'country' => 'Azerbaijan', 76 | 'continent' => 'AS', 77 | ), 78 | 'BS' => array( 79 | 'country' => 'Bahamas', 80 | 'continent' => 'NA', 81 | ), 82 | 'BH' => array( 83 | 'country' => 'Bahrain', 84 | 'continent' => 'AS', 85 | ), 86 | 'BD' => array( 87 | 'country' => 'Bangladesh', 88 | 'continent' => 'AS', 89 | ), 90 | 'BB' => array( 91 | 'country' => 'Barbados', 92 | 'continent' => 'NA', 93 | ), 94 | 'BY' => array( 95 | 'country' => 'Belarus', 96 | 'continent' => 'EU', 97 | ), 98 | 'BE' => array( 99 | 'country' => 'Belgium', 100 | 'continent' => 'EU', 101 | ), 102 | 'BZ' => array( 103 | 'country' => 'Belize', 104 | 'continent' => 'NA', 105 | ), 106 | 'BJ' => array( 107 | 'country' => 'Benin', 108 | 'continent' => 'AF', 109 | ), 110 | 'BM' => array( 111 | 'country' => 'Bermuda', 112 | 'continent' => 'NA', 113 | ), 114 | 'BT' => array( 115 | 'country' => 'Bhutan', 116 | 'continent' => 'AS', 117 | ), 118 | 'BO' => array( 119 | 'country' => 'Bolivia', 120 | 'continent' => 'SA', 121 | ), 122 | 'BA' => array( 123 | 'country' => 'Bosnia and Herzegovina', 124 | 'continent' => 'EU', 125 | ), 126 | 'BW' => array( 127 | 'country' => 'Botswana', 128 | 'continent' => 'AF', 129 | ), 130 | 'BV' => array( 131 | 'country' => 'Bouvet Island', 132 | 'continent' => 'AN', 133 | ), 134 | 'BR' => array( 135 | 'country' => 'Brazil', 136 | 'continent' => 'SA', 137 | ), 138 | 'IO' => array( 139 | 'country' => 'British Indian Ocean Territory', 140 | 'continent' => 'AS', 141 | ), 142 | 'BN' => array( 143 | 'country' => 'Brunei Darussalam', 144 | 'continent' => 'AS', 145 | ), 146 | 'BG' => array( 147 | 'country' => 'Bulgaria', 148 | 'continent' => 'EU', 149 | ), 150 | 'BF' => array( 151 | 'country' => 'Burkina Faso', 152 | 'continent' => 'AF', 153 | ), 154 | 'BI' => array( 155 | 'country' => 'Burundi', 156 | 'continent' => 'AF', 157 | ), 158 | 'KH' => array( 159 | 'country' => 'Cambodia', 160 | 'continent' => 'AS', 161 | ), 162 | 'CM' => array( 163 | 'country' => 'Cameroon', 164 | 'continent' => 'AF', 165 | ), 166 | 'CA' => array( 167 | 'country' => 'Canada', 168 | 'continent' => 'NA', 169 | ), 170 | 'CV' => array( 171 | 'country' => 'Cape Verde', 172 | 'continent' => 'AF', 173 | ), 174 | 'KY' => array( 175 | 'country' => 'Cayman Islands', 176 | 'continent' => 'NA', 177 | ), 178 | 'CF' => array( 179 | 'country' => 'Central African Republic', 180 | 'continent' => 'AF', 181 | ), 182 | 'TD' => array( 183 | 'country' => 'Chad', 184 | 'continent' => 'AF', 185 | ), 186 | 'CL' => array( 187 | 'country' => 'Chile', 188 | 'continent' => 'SA', 189 | ), 190 | 'CN' => array( 191 | 'country' => 'China', 192 | 'continent' => 'AS', 193 | ), 194 | 'CX' => array( 195 | 'country' => 'Christmas Island', 196 | 'continent' => 'AS', 197 | ), 198 | 'CC' => array( 199 | 'country' => 'Cocos (Keeling) Islands', 200 | 'continent' => 'AS', 201 | ), 202 | 'CO' => array( 203 | 'country' => 'Colombia', 204 | 'continent' => 'SA', 205 | ), 206 | 'KM' => array( 207 | 'country' => 'Comoros', 208 | 'continent' => 'AF', 209 | ), 210 | 'CG' => array( 211 | 'country' => 'Congo', 212 | 'continent' => 'AF', 213 | ), 214 | 'CD' => array( 215 | 'country' => 'The Democratic Republic of The Congo', 216 | 'continent' => 'AF', 217 | ), 218 | 'CK' => array( 219 | 'country' => 'Cook Islands', 220 | 'continent' => 'OC', 221 | ), 222 | 'CR' => array( 223 | 'country' => 'Costa Rica', 224 | 'continent' => 'NA', 225 | ), 226 | 'CI' => array( 227 | 'country' => 'Cote D\'ivoire', 228 | 'continent' => 'AF', 229 | ), 230 | 'HR' => array( 231 | 'country' => 'Croatia', 232 | 'continent' => 'EU', 233 | ), 234 | 'CU' => array( 235 | 'country' => 'Cuba', 236 | 'continent' => 'NA', 237 | ), 238 | 'CY' => array( 239 | 'country' => 'Cyprus', 240 | 'continent' => 'AS', 241 | ), 242 | 'CZ' => array( 243 | 'country' => 'Czech Republic', 244 | 'continent' => 'EU', 245 | ), 246 | 'DK' => array( 247 | 'country' => 'Denmark', 248 | 'continent' => 'EU', 249 | ), 250 | 'DJ' => array( 251 | 'country' => 'Djibouti', 252 | 'continent' => 'AF', 253 | ), 254 | 'DM' => array( 255 | 'country' => 'Dominica', 256 | 'continent' => 'NA', 257 | ), 258 | 'DO' => array( 259 | 'country' => 'Dominican Republic', 260 | 'continent' => 'NA', 261 | ), 262 | 'EC' => array( 263 | 'country' => 'Ecuador', 264 | 'continent' => 'SA', 265 | ), 266 | 'EG' => array( 267 | 'country' => 'Egypt', 268 | 'continent' => 'AF', 269 | ), 270 | 'SV' => array( 271 | 'country' => 'El Salvador', 272 | 'continent' => 'NA', 273 | ), 274 | 'GQ' => array( 275 | 'country' => 'Equatorial Guinea', 276 | 'continent' => 'AF', 277 | ), 278 | 'ER' => array( 279 | 'country' => 'Eritrea', 280 | 'continent' => 'AF', 281 | ), 282 | 'EE' => array( 283 | 'country' => 'Estonia', 284 | 'continent' => 'EU', 285 | ), 286 | 'ET' => array( 287 | 'country' => 'Ethiopia', 288 | 'continent' => 'AF', 289 | ), 290 | 'FK' => array( 291 | 'country' => 'Falkland Islands (Malvinas)', 292 | 'continent' => 'SA', 293 | ), 294 | 'FO' => array( 295 | 'country' => 'Faroe Islands', 296 | 'continent' => 'EU', 297 | ), 298 | 'FJ' => array( 299 | 'country' => 'Fiji', 300 | 'continent' => 'OC', 301 | ), 302 | 'FI' => array( 303 | 'country' => 'Finland', 304 | 'continent' => 'EU', 305 | ), 306 | 'FR' => array( 307 | 'country' => 'France', 308 | 'continent' => 'EU', 309 | ), 310 | 'GF' => array( 311 | 'country' => 'French Guiana', 312 | 'continent' => 'SA', 313 | ), 314 | 'PF' => array( 315 | 'country' => 'French Polynesia', 316 | 'continent' => 'OC', 317 | ), 318 | 'TF' => array( 319 | 'country' => 'French Southern Territories', 320 | 'continent' => 'AN', 321 | ), 322 | 'GA' => array( 323 | 'country' => 'Gabon', 324 | 'continent' => 'AF', 325 | ), 326 | 'GM' => array( 327 | 'country' => 'Gambia', 328 | 'continent' => 'AF', 329 | ), 330 | 'GE' => array( 331 | 'country' => 'Georgia', 332 | 'continent' => 'AS', 333 | ), 334 | 'DE' => array( 335 | 'country' => 'Germany', 336 | 'continent' => 'EU', 337 | ), 338 | 'GH' => array( 339 | 'country' => 'Ghana', 340 | 'continent' => 'AF', 341 | ), 342 | 'GI' => array( 343 | 'country' => 'Gibraltar', 344 | 'continent' => 'EU', 345 | ), 346 | 'GR' => array( 347 | 'country' => 'Greece', 348 | 'continent' => 'EU', 349 | ), 350 | 'GL' => array( 351 | 'country' => 'Greenland', 352 | 'continent' => 'NA', 353 | ), 354 | 'GD' => array( 355 | 'country' => 'Grenada', 356 | 'continent' => 'NA', 357 | ), 358 | 'GP' => array( 359 | 'country' => 'Guadeloupe', 360 | 'continent' => 'NA', 361 | ), 362 | 'GU' => array( 363 | 'country' => 'Guam', 364 | 'continent' => 'OC', 365 | ), 366 | 'GT' => array( 367 | 'country' => 'Guatemala', 368 | 'continent' => 'NA', 369 | ), 370 | 'GG' => array( 371 | 'country' => 'Guernsey', 372 | 'continent' => 'EU', 373 | ), 374 | 'GN' => array( 375 | 'country' => 'Guinea', 376 | 'continent' => 'AF', 377 | ), 378 | 'GW' => array( 379 | 'country' => 'Guinea-bissau', 380 | 'continent' => 'AF', 381 | ), 382 | 'GY' => array( 383 | 'country' => 'Guyana', 384 | 'continent' => 'SA', 385 | ), 386 | 'HT' => array( 387 | 'country' => 'Haiti', 388 | 'continent' => 'NA', 389 | ), 390 | 'HM' => array( 391 | 'country' => 'Heard Island and Mcdonald Islands', 392 | 'continent' => 'AN', 393 | ), 394 | 'VA' => array( 395 | 'country' => 'Holy See (Vatican City State)', 396 | 'continent' => 'EU', 397 | ), 398 | 'HN' => array( 399 | 'country' => 'Honduras', 400 | 'continent' => 'NA', 401 | ), 402 | 'HK' => array( 403 | 'country' => 'Hong Kong', 404 | 'continent' => 'AS', 405 | ), 406 | 'HU' => array( 407 | 'country' => 'Hungary', 408 | 'continent' => 'EU', 409 | ), 410 | 'IS' => array( 411 | 'country' => 'Iceland', 412 | 'continent' => 'EU', 413 | ), 414 | 'IN' => array( 415 | 'country' => 'India', 416 | 'continent' => 'AS', 417 | ), 418 | 'ID' => array( 419 | 'country' => 'Indonesia', 420 | 'continent' => 'AS', 421 | ), 422 | 'IR' => array( 423 | 'country' => 'Iran', 424 | 'continent' => 'AS', 425 | ), 426 | 'IQ' => array( 427 | 'country' => 'Iraq', 428 | 'continent' => 'AS', 429 | ), 430 | 'IE' => array( 431 | 'country' => 'Ireland', 432 | 'continent' => 'EU', 433 | ), 434 | 'IM' => array( 435 | 'country' => 'Isle of Man', 436 | 'continent' => 'EU', 437 | ), 438 | 'IL' => array( 439 | 'country' => 'Israel', 440 | 'continent' => 'AS', 441 | ), 442 | 'IT' => array( 443 | 'country' => 'Italy', 444 | 'continent' => 'EU', 445 | ), 446 | 'JM' => array( 447 | 'country' => 'Jamaica', 448 | 'continent' => 'NA', 449 | ), 450 | 'JP' => array( 451 | 'country' => 'Japan', 452 | 'continent' => 'AS', 453 | ), 454 | 'JE' => array( 455 | 'country' => 'Jersey', 456 | 'continent' => 'EU', 457 | ), 458 | 'JO' => array( 459 | 'country' => 'Jordan', 460 | 'continent' => 'AS', 461 | ), 462 | 'KZ' => array( 463 | 'country' => 'Kazakhstan', 464 | 'continent' => 'AS', 465 | ), 466 | 'KE' => array( 467 | 'country' => 'Kenya', 468 | 'continent' => 'AF', 469 | ), 470 | 'KI' => array( 471 | 'country' => 'Kiribati', 472 | 'continent' => 'OC', 473 | ), 474 | 'KP' => array( 475 | 'country' => 'Democratic People\'s Republic of Korea', 476 | 'continent' => 'AS', 477 | ), 478 | 'KR' => array( 479 | 'country' => 'Republic of Korea', 480 | 'continent' => 'AS', 481 | ), 482 | 'KW' => array( 483 | 'country' => 'Kuwait', 484 | 'continent' => 'AS', 485 | ), 486 | 'KG' => array( 487 | 'country' => 'Kyrgyzstan', 488 | 'continent' => 'AS', 489 | ), 490 | 'LA' => array( 491 | 'country' => 'Lao People\'s Democratic Republic', 492 | 'continent' => 'AS', 493 | ), 494 | 'LV' => array( 495 | 'country' => 'Latvia', 496 | 'continent' => 'EU', 497 | ), 498 | 'LB' => array( 499 | 'country' => 'Lebanon', 500 | 'continent' => 'AS', 501 | ), 502 | 'LS' => array( 503 | 'country' => 'Lesotho', 504 | 'continent' => 'AF', 505 | ), 506 | 'LR' => array( 507 | 'country' => 'Liberia', 508 | 'continent' => 'AF', 509 | ), 510 | 'LY' => array( 511 | 'country' => 'Libya', 512 | 'continent' => 'AF', 513 | ), 514 | 'LI' => array( 515 | 'country' => 'Liechtenstein', 516 | 'continent' => 'EU', 517 | ), 518 | 'LT' => array( 519 | 'country' => 'Lithuania', 520 | 'continent' => 'EU', 521 | ), 522 | 'LU' => array( 523 | 'country' => 'Luxembourg', 524 | 'continent' => 'EU', 525 | ), 526 | 'MO' => array( 527 | 'country' => 'Macao', 528 | 'continent' => 'AS', 529 | ), 530 | 'MK' => array( 531 | 'country' => 'Macedonia', 532 | 'continent' => 'EU', 533 | ), 534 | 'MG' => array( 535 | 'country' => 'Madagascar', 536 | 'continent' => 'AF', 537 | ), 538 | 'MW' => array( 539 | 'country' => 'Malawi', 540 | 'continent' => 'AF', 541 | ), 542 | 'MY' => array( 543 | 'country' => 'Malaysia', 544 | 'continent' => 'AS', 545 | ), 546 | 'MV' => array( 547 | 'country' => 'Maldives', 548 | 'continent' => 'AS', 549 | ), 550 | 'ML' => array( 551 | 'country' => 'Mali', 552 | 'continent' => 'AF', 553 | ), 554 | 'MT' => array( 555 | 'country' => 'Malta', 556 | 'continent' => 'EU', 557 | ), 558 | 'MH' => array( 559 | 'country' => 'Marshall Islands', 560 | 'continent' => 'OC', 561 | ), 562 | 'MQ' => array( 563 | 'country' => 'Martinique', 564 | 'continent' => 'NA', 565 | ), 566 | 'MR' => array( 567 | 'country' => 'Mauritania', 568 | 'continent' => 'AF', 569 | ), 570 | 'MU' => array( 571 | 'country' => 'Mauritius', 572 | 'continent' => 'AF', 573 | ), 574 | 'YT' => array( 575 | 'country' => 'Mayotte', 576 | 'continent' => 'AF', 577 | ), 578 | 'MX' => array( 579 | 'country' => 'Mexico', 580 | 'continent' => 'NA', 581 | ), 582 | 'FM' => array( 583 | 'country' => 'Micronesia', 584 | 'continent' => 'OC', 585 | ), 586 | 'MD' => array( 587 | 'country' => 'Moldova', 588 | 'continent' => 'EU', 589 | ), 590 | 'MC' => array( 591 | 'country' => 'Monaco', 592 | 'continent' => 'EU', 593 | ), 594 | 'MN' => array( 595 | 'country' => 'Mongolia', 596 | 'continent' => 'AS', 597 | ), 598 | 'ME' => array( 599 | 'country' => 'Montenegro', 600 | 'continent' => 'EU', 601 | ), 602 | 'MS' => array( 603 | 'country' => 'Montserrat', 604 | 'continent' => 'NA', 605 | ), 606 | 'MA' => array( 607 | 'country' => 'Morocco', 608 | 'continent' => 'AF', 609 | ), 610 | 'MZ' => array( 611 | 'country' => 'Mozambique', 612 | 'continent' => 'AF', 613 | ), 614 | 'MM' => array( 615 | 'country' => 'Myanmar', 616 | 'continent' => 'AS', 617 | ), 618 | 'NA' => array( 619 | 'country' => 'Namibia', 620 | 'continent' => 'AF', 621 | ), 622 | 'NR' => array( 623 | 'country' => 'Nauru', 624 | 'continent' => 'OC', 625 | ), 626 | 'NP' => array( 627 | 'country' => 'Nepal', 628 | 'continent' => 'AS', 629 | ), 630 | 'NL' => array( 631 | 'country' => 'Netherlands', 632 | 'continent' => 'EU', 633 | ), 634 | 'AN' => array( 635 | 'country' => 'Netherlands Antilles', 636 | 'continent' => 'NA', 637 | ), 638 | 'NC' => array( 639 | 'country' => 'New Caledonia', 640 | 'continent' => 'OC', 641 | ), 642 | 'NZ' => array( 643 | 'country' => 'New Zealand', 644 | 'continent' => 'OC', 645 | ), 646 | 'NI' => array( 647 | 'country' => 'Nicaragua', 648 | 'continent' => 'NA', 649 | ), 650 | 'NE' => array( 651 | 'country' => 'Niger', 652 | 'continent' => 'AF', 653 | ), 654 | 'NG' => array( 655 | 'country' => 'Nigeria', 656 | 'continent' => 'AF', 657 | ), 658 | 'NU' => array( 659 | 'country' => 'Niue', 660 | 'continent' => 'OC', 661 | ), 662 | 'NF' => array( 663 | 'country' => 'Norfolk Island', 664 | 'continent' => 'OC', 665 | ), 666 | 'MP' => array( 667 | 'country' => 'Northern Mariana Islands', 668 | 'continent' => 'OC', 669 | ), 670 | 'NO' => array( 671 | 'country' => 'Norway', 672 | 'continent' => 'EU', 673 | ), 674 | 'OM' => array( 675 | 'country' => 'Oman', 676 | 'continent' => 'AS', 677 | ), 678 | 'PK' => array( 679 | 'country' => 'Pakistan', 680 | 'continent' => 'AS', 681 | ), 682 | 'PW' => array( 683 | 'country' => 'Palau', 684 | 'continent' => 'OC', 685 | ), 686 | 'PS' => array( 687 | 'country' => 'Palestinia', 688 | 'continent' => 'AS', 689 | ), 690 | 'PA' => array( 691 | 'country' => 'Panama', 692 | 'continent' => 'NA', 693 | ), 694 | 'PG' => array( 695 | 'country' => 'Papua New Guinea', 696 | 'continent' => 'OC', 697 | ), 698 | 'PY' => array( 699 | 'country' => 'Paraguay', 700 | 'continent' => 'SA', 701 | ), 702 | 'PE' => array( 703 | 'country' => 'Peru', 704 | 'continent' => 'SA', 705 | ), 706 | 'PH' => array( 707 | 'country' => 'Philippines', 708 | 'continent' => 'AS', 709 | ), 710 | 'PN' => array( 711 | 'country' => 'Pitcairn', 712 | 'continent' => 'OC', 713 | ), 714 | 'PL' => array( 715 | 'country' => 'Poland', 716 | 'continent' => 'EU', 717 | ), 718 | 'PT' => array( 719 | 'country' => 'Portugal', 720 | 'continent' => 'EU', 721 | ), 722 | 'PR' => array( 723 | 'country' => 'Puerto Rico', 724 | 'continent' => 'NA', 725 | ), 726 | 'QA' => array( 727 | 'country' => 'Qatar', 728 | 'continent' => 'AS', 729 | ), 730 | 'RE' => array( 731 | 'country' => 'Reunion', 732 | 'continent' => 'AF', 733 | ), 734 | 'RO' => array( 735 | 'country' => 'Romania', 736 | 'continent' => 'EU', 737 | ), 738 | 'RU' => array( 739 | 'country' => 'Russian Federation', 740 | 'continent' => 'EU', 741 | ), 742 | 'RW' => array( 743 | 'country' => 'Rwanda', 744 | 'continent' => 'AF', 745 | ), 746 | 'SH' => array( 747 | 'country' => 'Saint Helena', 748 | 'continent' => 'AF', 749 | ), 750 | 'KN' => array( 751 | 'country' => 'Saint Kitts and Nevis', 752 | 'continent' => 'NA', 753 | ), 754 | 'LC' => array( 755 | 'country' => 'Saint Lucia', 756 | 'continent' => 'NA', 757 | ), 758 | 'PM' => array( 759 | 'country' => 'Saint Pierre and Miquelon', 760 | 'continent' => 'NA', 761 | ), 762 | 'VC' => array( 763 | 'country' => 'Saint Vincent and The Grenadines', 764 | 'continent' => 'NA', 765 | ), 766 | 'WS' => array( 767 | 'country' => 'Samoa', 768 | 'continent' => 'OC', 769 | ), 770 | 'SM' => array( 771 | 'country' => 'San Marino', 772 | 'continent' => 'EU', 773 | ), 774 | 'ST' => array( 775 | 'country' => 'Sao Tome and Principe', 776 | 'continent' => 'AF', 777 | ), 778 | 'SA' => array( 779 | 'country' => 'Saudi Arabia', 780 | 'continent' => 'AS', 781 | ), 782 | 'SN' => array( 783 | 'country' => 'Senegal', 784 | 'continent' => 'AF', 785 | ), 786 | 'RS' => array( 787 | 'country' => 'Serbia', 788 | 'continent' => 'EU', 789 | ), 790 | 'SC' => array( 791 | 'country' => 'Seychelles', 792 | 'continent' => 'AF', 793 | ), 794 | 'SL' => array( 795 | 'country' => 'Sierra Leone', 796 | 'continent' => 'AF', 797 | ), 798 | 'SG' => array( 799 | 'country' => 'Singapore', 800 | 'continent' => 'AS', 801 | ), 802 | 'SK' => array( 803 | 'country' => 'Slovakia', 804 | 'continent' => 'EU', 805 | ), 806 | 'SI' => array( 807 | 'country' => 'Slovenia', 808 | 'continent' => 'EU', 809 | ), 810 | 'SB' => array( 811 | 'country' => 'Solomon Islands', 812 | 'continent' => 'OC', 813 | ), 814 | 'SO' => array( 815 | 'country' => 'Somalia', 816 | 'continent' => 'AF', 817 | ), 818 | 'ZA' => array( 819 | 'country' => 'South Africa', 820 | 'continent' => 'AF', 821 | ), 822 | 'GS' => array( 823 | 'country' => 'South Georgia and The South Sandwich Islands', 824 | 'continent' => 'AN', 825 | ), 826 | 'ES' => array( 827 | 'country' => 'Spain', 828 | 'continent' => 'EU', 829 | ), 830 | 'LK' => array( 831 | 'country' => 'Sri Lanka', 832 | 'continent' => 'AS', 833 | ), 834 | 'SD' => array( 835 | 'country' => 'Sudan', 836 | 'continent' => 'AF', 837 | ), 838 | 'SR' => array( 839 | 'country' => 'Suriname', 840 | 'continent' => 'SA', 841 | ), 842 | 'SJ' => array( 843 | 'country' => 'Svalbard and Jan Mayen', 844 | 'continent' => 'EU', 845 | ), 846 | 'SZ' => array( 847 | 'country' => 'Swaziland', 848 | 'continent' => 'AF', 849 | ), 850 | 'SE' => array( 851 | 'country' => 'Sweden', 852 | 'continent' => 'EU', 853 | ), 854 | 'CH' => array( 855 | 'country' => 'Switzerland', 856 | 'continent' => 'EU', 857 | ), 858 | 'SY' => array( 859 | 'country' => 'Syrian Arab Republic', 860 | 'continent' => 'AS', 861 | ), 862 | 'TW' => array( 863 | 'country' => 'Taiwan, Province of China', 864 | 'continent' => 'AS', 865 | ), 866 | 'TJ' => array( 867 | 'country' => 'Tajikistan', 868 | 'continent' => 'AS', 869 | ), 870 | 'TZ' => array( 871 | 'country' => 'Tanzania, United Republic of', 872 | 'continent' => 'AF', 873 | ), 874 | 'TH' => array( 875 | 'country' => 'Thailand', 876 | 'continent' => 'AS', 877 | ), 878 | 'TL' => array( 879 | 'country' => 'Timor-leste', 880 | 'continent' => 'AS', 881 | ), 882 | 'TG' => array( 883 | 'country' => 'Togo', 884 | 'continent' => 'AF', 885 | ), 886 | 'TK' => array( 887 | 'country' => 'Tokelau', 888 | 'continent' => 'OC', 889 | ), 890 | 'TO' => array( 891 | 'country' => 'Tonga', 892 | 'continent' => 'OC', 893 | ), 894 | 'TT' => array( 895 | 'country' => 'Trinidad and Tobago', 896 | 'continent' => 'NA', 897 | ), 898 | 'TN' => array( 899 | 'country' => 'Tunisia', 900 | 'continent' => 'AF', 901 | ), 902 | 'TR' => array( 903 | 'country' => 'Turkey', 904 | 'continent' => 'AS', 905 | ), 906 | 'TM' => array( 907 | 'country' => 'Turkmenistan', 908 | 'continent' => 'AS', 909 | ), 910 | 'TC' => array( 911 | 'country' => 'Turks and Caicos Islands', 912 | 'continent' => 'NA', 913 | ), 914 | 'TV' => array( 915 | 'country' => 'Tuvalu', 916 | 'continent' => 'OC', 917 | ), 918 | 'UG' => array( 919 | 'country' => 'Uganda', 920 | 'continent' => 'AF', 921 | ), 922 | 'UA' => array( 923 | 'country' => 'Ukraine', 924 | 'continent' => 'EU', 925 | ), 926 | 'AE' => array( 927 | 'country' => 'United Arab Emirates', 928 | 'continent' => 'AS', 929 | ), 930 | 'GB' => array( 931 | 'country' => 'United Kingdom', 932 | 'continent' => 'EU', 933 | ), 934 | 'US' => array( 935 | 'country' => 'United States', 936 | 'continent' => 'NA', 937 | ), 938 | 'UM' => array( 939 | 'country' => 'United States Minor Outlying Islands', 940 | 'continent' => 'OC', 941 | ), 942 | 'UY' => array( 943 | 'country' => 'Uruguay', 944 | 'continent' => 'SA', 945 | ), 946 | 'UZ' => array( 947 | 'country' => 'Uzbekistan', 948 | 'continent' => 'AS', 949 | ), 950 | 'VU' => array( 951 | 'country' => 'Vanuatu', 952 | 'continent' => 'OC', 953 | ), 954 | 'VE' => array( 955 | 'country' => 'Venezuela', 956 | 'continent' => 'SA', 957 | ), 958 | 'VN' => array( 959 | 'country' => 'Viet Nam', 960 | 'continent' => 'AS', 961 | ), 962 | 'VG' => array( 963 | 'country' => 'Virgin Islands, British', 964 | 'continent' => 'NA', 965 | ), 966 | 'VI' => array( 967 | 'country' => 'Virgin Islands, U.S.', 968 | 'continent' => 'NA', 969 | ), 970 | 'WF' => array( 971 | 'country' => 'Wallis and Futuna', 972 | 'continent' => 'OC', 973 | ), 974 | 'EH' => array( 975 | 'country' => 'Western Sahara', 976 | 'continent' => 'AF', 977 | ), 978 | 'YE' => array( 979 | 'country' => 'Yemen', 980 | 'continent' => 'AS', 981 | ), 982 | 'ZM' => array( 983 | 'country' => 'Zambia', 984 | 'continent' => 'AF', 985 | ), 986 | 'ZW' => array( 987 | 'country' => 'Zimbabwe', 988 | 'continent' => 'AF', 989 | ), 990 | ); 991 | 992 | return $countries; 993 | } 994 | -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "fa7f8f2932f829c3c7b554ad2f0b3e79", 8 | "packages": [], 9 | "packages-dev": [ 10 | { 11 | "name": "dealerdirect/phpcodesniffer-composer-installer", 12 | "version": "v1.0.0", 13 | "source": { 14 | "type": "git", 15 | "url": "https://github.com/PHPCSStandards/composer-installer.git", 16 | "reference": "4be43904336affa5c2f70744a348312336afd0da" 17 | }, 18 | "dist": { 19 | "type": "zip", 20 | "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/4be43904336affa5c2f70744a348312336afd0da", 21 | "reference": "4be43904336affa5c2f70744a348312336afd0da", 22 | "shasum": "" 23 | }, 24 | "require": { 25 | "composer-plugin-api": "^1.0 || ^2.0", 26 | "php": ">=5.4", 27 | "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" 28 | }, 29 | "require-dev": { 30 | "composer/composer": "*", 31 | "ext-json": "*", 32 | "ext-zip": "*", 33 | "php-parallel-lint/php-parallel-lint": "^1.3.1", 34 | "phpcompatibility/php-compatibility": "^9.0", 35 | "yoast/phpunit-polyfills": "^1.0" 36 | }, 37 | "type": "composer-plugin", 38 | "extra": { 39 | "class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" 40 | }, 41 | "autoload": { 42 | "psr-4": { 43 | "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" 44 | } 45 | }, 46 | "notification-url": "https://packagist.org/downloads/", 47 | "license": [ 48 | "MIT" 49 | ], 50 | "authors": [ 51 | { 52 | "name": "Franck Nijhof", 53 | "email": "franck.nijhof@dealerdirect.com", 54 | "homepage": "http://www.frenck.nl", 55 | "role": "Developer / IT Manager" 56 | }, 57 | { 58 | "name": "Contributors", 59 | "homepage": "https://github.com/PHPCSStandards/composer-installer/graphs/contributors" 60 | } 61 | ], 62 | "description": "PHP_CodeSniffer Standards Composer Installer Plugin", 63 | "homepage": "http://www.dealerdirect.com", 64 | "keywords": [ 65 | "PHPCodeSniffer", 66 | "PHP_CodeSniffer", 67 | "code quality", 68 | "codesniffer", 69 | "composer", 70 | "installer", 71 | "phpcbf", 72 | "phpcs", 73 | "plugin", 74 | "qa", 75 | "quality", 76 | "standard", 77 | "standards", 78 | "style guide", 79 | "stylecheck", 80 | "tests" 81 | ], 82 | "support": { 83 | "issues": "https://github.com/PHPCSStandards/composer-installer/issues", 84 | "source": "https://github.com/PHPCSStandards/composer-installer" 85 | }, 86 | "time": "2023-01-05T11:28:13+00:00" 87 | }, 88 | { 89 | "name": "doctrine/instantiator", 90 | "version": "2.0.0", 91 | "source": { 92 | "type": "git", 93 | "url": "https://github.com/doctrine/instantiator.git", 94 | "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" 95 | }, 96 | "dist": { 97 | "type": "zip", 98 | "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", 99 | "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", 100 | "shasum": "" 101 | }, 102 | "require": { 103 | "php": "^8.1" 104 | }, 105 | "require-dev": { 106 | "doctrine/coding-standard": "^11", 107 | "ext-pdo": "*", 108 | "ext-phar": "*", 109 | "phpbench/phpbench": "^1.2", 110 | "phpstan/phpstan": "^1.9.4", 111 | "phpstan/phpstan-phpunit": "^1.3", 112 | "phpunit/phpunit": "^9.5.27", 113 | "vimeo/psalm": "^5.4" 114 | }, 115 | "type": "library", 116 | "autoload": { 117 | "psr-4": { 118 | "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" 119 | } 120 | }, 121 | "notification-url": "https://packagist.org/downloads/", 122 | "license": [ 123 | "MIT" 124 | ], 125 | "authors": [ 126 | { 127 | "name": "Marco Pivetta", 128 | "email": "ocramius@gmail.com", 129 | "homepage": "https://ocramius.github.io/" 130 | } 131 | ], 132 | "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", 133 | "homepage": "https://www.doctrine-project.org/projects/instantiator.html", 134 | "keywords": [ 135 | "constructor", 136 | "instantiate" 137 | ], 138 | "support": { 139 | "issues": "https://github.com/doctrine/instantiator/issues", 140 | "source": "https://github.com/doctrine/instantiator/tree/2.0.0" 141 | }, 142 | "funding": [ 143 | { 144 | "url": "https://www.doctrine-project.org/sponsorship.html", 145 | "type": "custom" 146 | }, 147 | { 148 | "url": "https://www.patreon.com/phpdoctrine", 149 | "type": "patreon" 150 | }, 151 | { 152 | "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", 153 | "type": "tidelift" 154 | } 155 | ], 156 | "time": "2022-12-30T00:23:10+00:00" 157 | }, 158 | { 159 | "name": "myclabs/deep-copy", 160 | "version": "1.12.0", 161 | "source": { 162 | "type": "git", 163 | "url": "https://github.com/myclabs/DeepCopy.git", 164 | "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" 165 | }, 166 | "dist": { 167 | "type": "zip", 168 | "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", 169 | "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", 170 | "shasum": "" 171 | }, 172 | "require": { 173 | "php": "^7.1 || ^8.0" 174 | }, 175 | "conflict": { 176 | "doctrine/collections": "<1.6.8", 177 | "doctrine/common": "<2.13.3 || >=3 <3.2.2" 178 | }, 179 | "require-dev": { 180 | "doctrine/collections": "^1.6.8", 181 | "doctrine/common": "^2.13.3 || ^3.2.2", 182 | "phpspec/prophecy": "^1.10", 183 | "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" 184 | }, 185 | "type": "library", 186 | "autoload": { 187 | "files": [ 188 | "src/DeepCopy/deep_copy.php" 189 | ], 190 | "psr-4": { 191 | "DeepCopy\\": "src/DeepCopy/" 192 | } 193 | }, 194 | "notification-url": "https://packagist.org/downloads/", 195 | "license": [ 196 | "MIT" 197 | ], 198 | "description": "Create deep copies (clones) of your objects", 199 | "keywords": [ 200 | "clone", 201 | "copy", 202 | "duplicate", 203 | "object", 204 | "object graph" 205 | ], 206 | "support": { 207 | "issues": "https://github.com/myclabs/DeepCopy/issues", 208 | "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" 209 | }, 210 | "funding": [ 211 | { 212 | "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", 213 | "type": "tidelift" 214 | } 215 | ], 216 | "time": "2024-06-12T14:39:25+00:00" 217 | }, 218 | { 219 | "name": "nikic/php-parser", 220 | "version": "v5.3.1", 221 | "source": { 222 | "type": "git", 223 | "url": "https://github.com/nikic/PHP-Parser.git", 224 | "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b" 225 | }, 226 | "dist": { 227 | "type": "zip", 228 | "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b", 229 | "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b", 230 | "shasum": "" 231 | }, 232 | "require": { 233 | "ext-ctype": "*", 234 | "ext-json": "*", 235 | "ext-tokenizer": "*", 236 | "php": ">=7.4" 237 | }, 238 | "require-dev": { 239 | "ircmaxell/php-yacc": "^0.0.7", 240 | "phpunit/phpunit": "^9.0" 241 | }, 242 | "bin": [ 243 | "bin/php-parse" 244 | ], 245 | "type": "library", 246 | "extra": { 247 | "branch-alias": { 248 | "dev-master": "5.0-dev" 249 | } 250 | }, 251 | "autoload": { 252 | "psr-4": { 253 | "PhpParser\\": "lib/PhpParser" 254 | } 255 | }, 256 | "notification-url": "https://packagist.org/downloads/", 257 | "license": [ 258 | "BSD-3-Clause" 259 | ], 260 | "authors": [ 261 | { 262 | "name": "Nikita Popov" 263 | } 264 | ], 265 | "description": "A PHP parser written in PHP", 266 | "keywords": [ 267 | "parser", 268 | "php" 269 | ], 270 | "support": { 271 | "issues": "https://github.com/nikic/PHP-Parser/issues", 272 | "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1" 273 | }, 274 | "time": "2024-10-08T18:51:32+00:00" 275 | }, 276 | { 277 | "name": "phar-io/manifest", 278 | "version": "2.0.4", 279 | "source": { 280 | "type": "git", 281 | "url": "https://github.com/phar-io/manifest.git", 282 | "reference": "54750ef60c58e43759730615a392c31c80e23176" 283 | }, 284 | "dist": { 285 | "type": "zip", 286 | "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", 287 | "reference": "54750ef60c58e43759730615a392c31c80e23176", 288 | "shasum": "" 289 | }, 290 | "require": { 291 | "ext-dom": "*", 292 | "ext-libxml": "*", 293 | "ext-phar": "*", 294 | "ext-xmlwriter": "*", 295 | "phar-io/version": "^3.0.1", 296 | "php": "^7.2 || ^8.0" 297 | }, 298 | "type": "library", 299 | "extra": { 300 | "branch-alias": { 301 | "dev-master": "2.0.x-dev" 302 | } 303 | }, 304 | "autoload": { 305 | "classmap": [ 306 | "src/" 307 | ] 308 | }, 309 | "notification-url": "https://packagist.org/downloads/", 310 | "license": [ 311 | "BSD-3-Clause" 312 | ], 313 | "authors": [ 314 | { 315 | "name": "Arne Blankerts", 316 | "email": "arne@blankerts.de", 317 | "role": "Developer" 318 | }, 319 | { 320 | "name": "Sebastian Heuer", 321 | "email": "sebastian@phpeople.de", 322 | "role": "Developer" 323 | }, 324 | { 325 | "name": "Sebastian Bergmann", 326 | "email": "sebastian@phpunit.de", 327 | "role": "Developer" 328 | } 329 | ], 330 | "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", 331 | "support": { 332 | "issues": "https://github.com/phar-io/manifest/issues", 333 | "source": "https://github.com/phar-io/manifest/tree/2.0.4" 334 | }, 335 | "funding": [ 336 | { 337 | "url": "https://github.com/theseer", 338 | "type": "github" 339 | } 340 | ], 341 | "time": "2024-03-03T12:33:53+00:00" 342 | }, 343 | { 344 | "name": "phar-io/version", 345 | "version": "3.2.1", 346 | "source": { 347 | "type": "git", 348 | "url": "https://github.com/phar-io/version.git", 349 | "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" 350 | }, 351 | "dist": { 352 | "type": "zip", 353 | "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", 354 | "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", 355 | "shasum": "" 356 | }, 357 | "require": { 358 | "php": "^7.2 || ^8.0" 359 | }, 360 | "type": "library", 361 | "autoload": { 362 | "classmap": [ 363 | "src/" 364 | ] 365 | }, 366 | "notification-url": "https://packagist.org/downloads/", 367 | "license": [ 368 | "BSD-3-Clause" 369 | ], 370 | "authors": [ 371 | { 372 | "name": "Arne Blankerts", 373 | "email": "arne@blankerts.de", 374 | "role": "Developer" 375 | }, 376 | { 377 | "name": "Sebastian Heuer", 378 | "email": "sebastian@phpeople.de", 379 | "role": "Developer" 380 | }, 381 | { 382 | "name": "Sebastian Bergmann", 383 | "email": "sebastian@phpunit.de", 384 | "role": "Developer" 385 | } 386 | ], 387 | "description": "Library for handling version information and constraints", 388 | "support": { 389 | "issues": "https://github.com/phar-io/version/issues", 390 | "source": "https://github.com/phar-io/version/tree/3.2.1" 391 | }, 392 | "time": "2022-02-21T01:04:05+00:00" 393 | }, 394 | { 395 | "name": "phpcompatibility/php-compatibility", 396 | "version": "9.3.5", 397 | "source": { 398 | "type": "git", 399 | "url": "https://github.com/PHPCompatibility/PHPCompatibility.git", 400 | "reference": "9fb324479acf6f39452e0655d2429cc0d3914243" 401 | }, 402 | "dist": { 403 | "type": "zip", 404 | "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243", 405 | "reference": "9fb324479acf6f39452e0655d2429cc0d3914243", 406 | "shasum": "" 407 | }, 408 | "require": { 409 | "php": ">=5.3", 410 | "squizlabs/php_codesniffer": "^2.3 || ^3.0.2" 411 | }, 412 | "conflict": { 413 | "squizlabs/php_codesniffer": "2.6.2" 414 | }, 415 | "require-dev": { 416 | "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0" 417 | }, 418 | "suggest": { 419 | "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.", 420 | "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." 421 | }, 422 | "type": "phpcodesniffer-standard", 423 | "notification-url": "https://packagist.org/downloads/", 424 | "license": [ 425 | "LGPL-3.0-or-later" 426 | ], 427 | "authors": [ 428 | { 429 | "name": "Wim Godden", 430 | "homepage": "https://github.com/wimg", 431 | "role": "lead" 432 | }, 433 | { 434 | "name": "Juliette Reinders Folmer", 435 | "homepage": "https://github.com/jrfnl", 436 | "role": "lead" 437 | }, 438 | { 439 | "name": "Contributors", 440 | "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors" 441 | } 442 | ], 443 | "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.", 444 | "homepage": "http://techblog.wimgodden.be/tag/codesniffer/", 445 | "keywords": [ 446 | "compatibility", 447 | "phpcs", 448 | "standards" 449 | ], 450 | "support": { 451 | "issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues", 452 | "source": "https://github.com/PHPCompatibility/PHPCompatibility" 453 | }, 454 | "time": "2019-12-27T09:44:58+00:00" 455 | }, 456 | { 457 | "name": "phpunit/php-code-coverage", 458 | "version": "9.2.32", 459 | "source": { 460 | "type": "git", 461 | "url": "https://github.com/sebastianbergmann/php-code-coverage.git", 462 | "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5" 463 | }, 464 | "dist": { 465 | "type": "zip", 466 | "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/85402a822d1ecf1db1096959413d35e1c37cf1a5", 467 | "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5", 468 | "shasum": "" 469 | }, 470 | "require": { 471 | "ext-dom": "*", 472 | "ext-libxml": "*", 473 | "ext-xmlwriter": "*", 474 | "nikic/php-parser": "^4.19.1 || ^5.1.0", 475 | "php": ">=7.3", 476 | "phpunit/php-file-iterator": "^3.0.6", 477 | "phpunit/php-text-template": "^2.0.4", 478 | "sebastian/code-unit-reverse-lookup": "^2.0.3", 479 | "sebastian/complexity": "^2.0.3", 480 | "sebastian/environment": "^5.1.5", 481 | "sebastian/lines-of-code": "^1.0.4", 482 | "sebastian/version": "^3.0.2", 483 | "theseer/tokenizer": "^1.2.3" 484 | }, 485 | "require-dev": { 486 | "phpunit/phpunit": "^9.6" 487 | }, 488 | "suggest": { 489 | "ext-pcov": "PHP extension that provides line coverage", 490 | "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" 491 | }, 492 | "type": "library", 493 | "extra": { 494 | "branch-alias": { 495 | "dev-main": "9.2.x-dev" 496 | } 497 | }, 498 | "autoload": { 499 | "classmap": [ 500 | "src/" 501 | ] 502 | }, 503 | "notification-url": "https://packagist.org/downloads/", 504 | "license": [ 505 | "BSD-3-Clause" 506 | ], 507 | "authors": [ 508 | { 509 | "name": "Sebastian Bergmann", 510 | "email": "sebastian@phpunit.de", 511 | "role": "lead" 512 | } 513 | ], 514 | "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", 515 | "homepage": "https://github.com/sebastianbergmann/php-code-coverage", 516 | "keywords": [ 517 | "coverage", 518 | "testing", 519 | "xunit" 520 | ], 521 | "support": { 522 | "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", 523 | "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", 524 | "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.32" 525 | }, 526 | "funding": [ 527 | { 528 | "url": "https://github.com/sebastianbergmann", 529 | "type": "github" 530 | } 531 | ], 532 | "time": "2024-08-22T04:23:01+00:00" 533 | }, 534 | { 535 | "name": "phpunit/php-file-iterator", 536 | "version": "3.0.6", 537 | "source": { 538 | "type": "git", 539 | "url": "https://github.com/sebastianbergmann/php-file-iterator.git", 540 | "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" 541 | }, 542 | "dist": { 543 | "type": "zip", 544 | "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", 545 | "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", 546 | "shasum": "" 547 | }, 548 | "require": { 549 | "php": ">=7.3" 550 | }, 551 | "require-dev": { 552 | "phpunit/phpunit": "^9.3" 553 | }, 554 | "type": "library", 555 | "extra": { 556 | "branch-alias": { 557 | "dev-master": "3.0-dev" 558 | } 559 | }, 560 | "autoload": { 561 | "classmap": [ 562 | "src/" 563 | ] 564 | }, 565 | "notification-url": "https://packagist.org/downloads/", 566 | "license": [ 567 | "BSD-3-Clause" 568 | ], 569 | "authors": [ 570 | { 571 | "name": "Sebastian Bergmann", 572 | "email": "sebastian@phpunit.de", 573 | "role": "lead" 574 | } 575 | ], 576 | "description": "FilterIterator implementation that filters files based on a list of suffixes.", 577 | "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", 578 | "keywords": [ 579 | "filesystem", 580 | "iterator" 581 | ], 582 | "support": { 583 | "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", 584 | "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" 585 | }, 586 | "funding": [ 587 | { 588 | "url": "https://github.com/sebastianbergmann", 589 | "type": "github" 590 | } 591 | ], 592 | "time": "2021-12-02T12:48:52+00:00" 593 | }, 594 | { 595 | "name": "phpunit/php-invoker", 596 | "version": "3.1.1", 597 | "source": { 598 | "type": "git", 599 | "url": "https://github.com/sebastianbergmann/php-invoker.git", 600 | "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" 601 | }, 602 | "dist": { 603 | "type": "zip", 604 | "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", 605 | "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", 606 | "shasum": "" 607 | }, 608 | "require": { 609 | "php": ">=7.3" 610 | }, 611 | "require-dev": { 612 | "ext-pcntl": "*", 613 | "phpunit/phpunit": "^9.3" 614 | }, 615 | "suggest": { 616 | "ext-pcntl": "*" 617 | }, 618 | "type": "library", 619 | "extra": { 620 | "branch-alias": { 621 | "dev-master": "3.1-dev" 622 | } 623 | }, 624 | "autoload": { 625 | "classmap": [ 626 | "src/" 627 | ] 628 | }, 629 | "notification-url": "https://packagist.org/downloads/", 630 | "license": [ 631 | "BSD-3-Clause" 632 | ], 633 | "authors": [ 634 | { 635 | "name": "Sebastian Bergmann", 636 | "email": "sebastian@phpunit.de", 637 | "role": "lead" 638 | } 639 | ], 640 | "description": "Invoke callables with a timeout", 641 | "homepage": "https://github.com/sebastianbergmann/php-invoker/", 642 | "keywords": [ 643 | "process" 644 | ], 645 | "support": { 646 | "issues": "https://github.com/sebastianbergmann/php-invoker/issues", 647 | "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" 648 | }, 649 | "funding": [ 650 | { 651 | "url": "https://github.com/sebastianbergmann", 652 | "type": "github" 653 | } 654 | ], 655 | "time": "2020-09-28T05:58:55+00:00" 656 | }, 657 | { 658 | "name": "phpunit/php-text-template", 659 | "version": "2.0.4", 660 | "source": { 661 | "type": "git", 662 | "url": "https://github.com/sebastianbergmann/php-text-template.git", 663 | "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" 664 | }, 665 | "dist": { 666 | "type": "zip", 667 | "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", 668 | "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", 669 | "shasum": "" 670 | }, 671 | "require": { 672 | "php": ">=7.3" 673 | }, 674 | "require-dev": { 675 | "phpunit/phpunit": "^9.3" 676 | }, 677 | "type": "library", 678 | "extra": { 679 | "branch-alias": { 680 | "dev-master": "2.0-dev" 681 | } 682 | }, 683 | "autoload": { 684 | "classmap": [ 685 | "src/" 686 | ] 687 | }, 688 | "notification-url": "https://packagist.org/downloads/", 689 | "license": [ 690 | "BSD-3-Clause" 691 | ], 692 | "authors": [ 693 | { 694 | "name": "Sebastian Bergmann", 695 | "email": "sebastian@phpunit.de", 696 | "role": "lead" 697 | } 698 | ], 699 | "description": "Simple template engine.", 700 | "homepage": "https://github.com/sebastianbergmann/php-text-template/", 701 | "keywords": [ 702 | "template" 703 | ], 704 | "support": { 705 | "issues": "https://github.com/sebastianbergmann/php-text-template/issues", 706 | "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" 707 | }, 708 | "funding": [ 709 | { 710 | "url": "https://github.com/sebastianbergmann", 711 | "type": "github" 712 | } 713 | ], 714 | "time": "2020-10-26T05:33:50+00:00" 715 | }, 716 | { 717 | "name": "phpunit/php-timer", 718 | "version": "5.0.3", 719 | "source": { 720 | "type": "git", 721 | "url": "https://github.com/sebastianbergmann/php-timer.git", 722 | "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" 723 | }, 724 | "dist": { 725 | "type": "zip", 726 | "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", 727 | "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", 728 | "shasum": "" 729 | }, 730 | "require": { 731 | "php": ">=7.3" 732 | }, 733 | "require-dev": { 734 | "phpunit/phpunit": "^9.3" 735 | }, 736 | "type": "library", 737 | "extra": { 738 | "branch-alias": { 739 | "dev-master": "5.0-dev" 740 | } 741 | }, 742 | "autoload": { 743 | "classmap": [ 744 | "src/" 745 | ] 746 | }, 747 | "notification-url": "https://packagist.org/downloads/", 748 | "license": [ 749 | "BSD-3-Clause" 750 | ], 751 | "authors": [ 752 | { 753 | "name": "Sebastian Bergmann", 754 | "email": "sebastian@phpunit.de", 755 | "role": "lead" 756 | } 757 | ], 758 | "description": "Utility class for timing", 759 | "homepage": "https://github.com/sebastianbergmann/php-timer/", 760 | "keywords": [ 761 | "timer" 762 | ], 763 | "support": { 764 | "issues": "https://github.com/sebastianbergmann/php-timer/issues", 765 | "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" 766 | }, 767 | "funding": [ 768 | { 769 | "url": "https://github.com/sebastianbergmann", 770 | "type": "github" 771 | } 772 | ], 773 | "time": "2020-10-26T13:16:10+00:00" 774 | }, 775 | { 776 | "name": "phpunit/phpunit", 777 | "version": "9.6.21", 778 | "source": { 779 | "type": "git", 780 | "url": "https://github.com/sebastianbergmann/phpunit.git", 781 | "reference": "de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa" 782 | }, 783 | "dist": { 784 | "type": "zip", 785 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa", 786 | "reference": "de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa", 787 | "shasum": "" 788 | }, 789 | "require": { 790 | "doctrine/instantiator": "^1.5.0 || ^2", 791 | "ext-dom": "*", 792 | "ext-json": "*", 793 | "ext-libxml": "*", 794 | "ext-mbstring": "*", 795 | "ext-xml": "*", 796 | "ext-xmlwriter": "*", 797 | "myclabs/deep-copy": "^1.12.0", 798 | "phar-io/manifest": "^2.0.4", 799 | "phar-io/version": "^3.2.1", 800 | "php": ">=7.3", 801 | "phpunit/php-code-coverage": "^9.2.32", 802 | "phpunit/php-file-iterator": "^3.0.6", 803 | "phpunit/php-invoker": "^3.1.1", 804 | "phpunit/php-text-template": "^2.0.4", 805 | "phpunit/php-timer": "^5.0.3", 806 | "sebastian/cli-parser": "^1.0.2", 807 | "sebastian/code-unit": "^1.0.8", 808 | "sebastian/comparator": "^4.0.8", 809 | "sebastian/diff": "^4.0.6", 810 | "sebastian/environment": "^5.1.5", 811 | "sebastian/exporter": "^4.0.6", 812 | "sebastian/global-state": "^5.0.7", 813 | "sebastian/object-enumerator": "^4.0.4", 814 | "sebastian/resource-operations": "^3.0.4", 815 | "sebastian/type": "^3.2.1", 816 | "sebastian/version": "^3.0.2" 817 | }, 818 | "suggest": { 819 | "ext-soap": "To be able to generate mocks based on WSDL files", 820 | "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" 821 | }, 822 | "bin": [ 823 | "phpunit" 824 | ], 825 | "type": "library", 826 | "extra": { 827 | "branch-alias": { 828 | "dev-master": "9.6-dev" 829 | } 830 | }, 831 | "autoload": { 832 | "files": [ 833 | "src/Framework/Assert/Functions.php" 834 | ], 835 | "classmap": [ 836 | "src/" 837 | ] 838 | }, 839 | "notification-url": "https://packagist.org/downloads/", 840 | "license": [ 841 | "BSD-3-Clause" 842 | ], 843 | "authors": [ 844 | { 845 | "name": "Sebastian Bergmann", 846 | "email": "sebastian@phpunit.de", 847 | "role": "lead" 848 | } 849 | ], 850 | "description": "The PHP Unit Testing framework.", 851 | "homepage": "https://phpunit.de/", 852 | "keywords": [ 853 | "phpunit", 854 | "testing", 855 | "xunit" 856 | ], 857 | "support": { 858 | "issues": "https://github.com/sebastianbergmann/phpunit/issues", 859 | "security": "https://github.com/sebastianbergmann/phpunit/security/policy", 860 | "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.21" 861 | }, 862 | "funding": [ 863 | { 864 | "url": "https://phpunit.de/sponsors.html", 865 | "type": "custom" 866 | }, 867 | { 868 | "url": "https://github.com/sebastianbergmann", 869 | "type": "github" 870 | }, 871 | { 872 | "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", 873 | "type": "tidelift" 874 | } 875 | ], 876 | "time": "2024-09-19T10:50:18+00:00" 877 | }, 878 | { 879 | "name": "sebastian/cli-parser", 880 | "version": "1.0.2", 881 | "source": { 882 | "type": "git", 883 | "url": "https://github.com/sebastianbergmann/cli-parser.git", 884 | "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" 885 | }, 886 | "dist": { 887 | "type": "zip", 888 | "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", 889 | "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", 890 | "shasum": "" 891 | }, 892 | "require": { 893 | "php": ">=7.3" 894 | }, 895 | "require-dev": { 896 | "phpunit/phpunit": "^9.3" 897 | }, 898 | "type": "library", 899 | "extra": { 900 | "branch-alias": { 901 | "dev-master": "1.0-dev" 902 | } 903 | }, 904 | "autoload": { 905 | "classmap": [ 906 | "src/" 907 | ] 908 | }, 909 | "notification-url": "https://packagist.org/downloads/", 910 | "license": [ 911 | "BSD-3-Clause" 912 | ], 913 | "authors": [ 914 | { 915 | "name": "Sebastian Bergmann", 916 | "email": "sebastian@phpunit.de", 917 | "role": "lead" 918 | } 919 | ], 920 | "description": "Library for parsing CLI options", 921 | "homepage": "https://github.com/sebastianbergmann/cli-parser", 922 | "support": { 923 | "issues": "https://github.com/sebastianbergmann/cli-parser/issues", 924 | "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" 925 | }, 926 | "funding": [ 927 | { 928 | "url": "https://github.com/sebastianbergmann", 929 | "type": "github" 930 | } 931 | ], 932 | "time": "2024-03-02T06:27:43+00:00" 933 | }, 934 | { 935 | "name": "sebastian/code-unit", 936 | "version": "1.0.8", 937 | "source": { 938 | "type": "git", 939 | "url": "https://github.com/sebastianbergmann/code-unit.git", 940 | "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" 941 | }, 942 | "dist": { 943 | "type": "zip", 944 | "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", 945 | "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", 946 | "shasum": "" 947 | }, 948 | "require": { 949 | "php": ">=7.3" 950 | }, 951 | "require-dev": { 952 | "phpunit/phpunit": "^9.3" 953 | }, 954 | "type": "library", 955 | "extra": { 956 | "branch-alias": { 957 | "dev-master": "1.0-dev" 958 | } 959 | }, 960 | "autoload": { 961 | "classmap": [ 962 | "src/" 963 | ] 964 | }, 965 | "notification-url": "https://packagist.org/downloads/", 966 | "license": [ 967 | "BSD-3-Clause" 968 | ], 969 | "authors": [ 970 | { 971 | "name": "Sebastian Bergmann", 972 | "email": "sebastian@phpunit.de", 973 | "role": "lead" 974 | } 975 | ], 976 | "description": "Collection of value objects that represent the PHP code units", 977 | "homepage": "https://github.com/sebastianbergmann/code-unit", 978 | "support": { 979 | "issues": "https://github.com/sebastianbergmann/code-unit/issues", 980 | "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" 981 | }, 982 | "funding": [ 983 | { 984 | "url": "https://github.com/sebastianbergmann", 985 | "type": "github" 986 | } 987 | ], 988 | "time": "2020-10-26T13:08:54+00:00" 989 | }, 990 | { 991 | "name": "sebastian/code-unit-reverse-lookup", 992 | "version": "2.0.3", 993 | "source": { 994 | "type": "git", 995 | "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", 996 | "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" 997 | }, 998 | "dist": { 999 | "type": "zip", 1000 | "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", 1001 | "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", 1002 | "shasum": "" 1003 | }, 1004 | "require": { 1005 | "php": ">=7.3" 1006 | }, 1007 | "require-dev": { 1008 | "phpunit/phpunit": "^9.3" 1009 | }, 1010 | "type": "library", 1011 | "extra": { 1012 | "branch-alias": { 1013 | "dev-master": "2.0-dev" 1014 | } 1015 | }, 1016 | "autoload": { 1017 | "classmap": [ 1018 | "src/" 1019 | ] 1020 | }, 1021 | "notification-url": "https://packagist.org/downloads/", 1022 | "license": [ 1023 | "BSD-3-Clause" 1024 | ], 1025 | "authors": [ 1026 | { 1027 | "name": "Sebastian Bergmann", 1028 | "email": "sebastian@phpunit.de" 1029 | } 1030 | ], 1031 | "description": "Looks up which function or method a line of code belongs to", 1032 | "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", 1033 | "support": { 1034 | "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", 1035 | "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" 1036 | }, 1037 | "funding": [ 1038 | { 1039 | "url": "https://github.com/sebastianbergmann", 1040 | "type": "github" 1041 | } 1042 | ], 1043 | "time": "2020-09-28T05:30:19+00:00" 1044 | }, 1045 | { 1046 | "name": "sebastian/comparator", 1047 | "version": "4.0.8", 1048 | "source": { 1049 | "type": "git", 1050 | "url": "https://github.com/sebastianbergmann/comparator.git", 1051 | "reference": "fa0f136dd2334583309d32b62544682ee972b51a" 1052 | }, 1053 | "dist": { 1054 | "type": "zip", 1055 | "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", 1056 | "reference": "fa0f136dd2334583309d32b62544682ee972b51a", 1057 | "shasum": "" 1058 | }, 1059 | "require": { 1060 | "php": ">=7.3", 1061 | "sebastian/diff": "^4.0", 1062 | "sebastian/exporter": "^4.0" 1063 | }, 1064 | "require-dev": { 1065 | "phpunit/phpunit": "^9.3" 1066 | }, 1067 | "type": "library", 1068 | "extra": { 1069 | "branch-alias": { 1070 | "dev-master": "4.0-dev" 1071 | } 1072 | }, 1073 | "autoload": { 1074 | "classmap": [ 1075 | "src/" 1076 | ] 1077 | }, 1078 | "notification-url": "https://packagist.org/downloads/", 1079 | "license": [ 1080 | "BSD-3-Clause" 1081 | ], 1082 | "authors": [ 1083 | { 1084 | "name": "Sebastian Bergmann", 1085 | "email": "sebastian@phpunit.de" 1086 | }, 1087 | { 1088 | "name": "Jeff Welch", 1089 | "email": "whatthejeff@gmail.com" 1090 | }, 1091 | { 1092 | "name": "Volker Dusch", 1093 | "email": "github@wallbash.com" 1094 | }, 1095 | { 1096 | "name": "Bernhard Schussek", 1097 | "email": "bschussek@2bepublished.at" 1098 | } 1099 | ], 1100 | "description": "Provides the functionality to compare PHP values for equality", 1101 | "homepage": "https://github.com/sebastianbergmann/comparator", 1102 | "keywords": [ 1103 | "comparator", 1104 | "compare", 1105 | "equality" 1106 | ], 1107 | "support": { 1108 | "issues": "https://github.com/sebastianbergmann/comparator/issues", 1109 | "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" 1110 | }, 1111 | "funding": [ 1112 | { 1113 | "url": "https://github.com/sebastianbergmann", 1114 | "type": "github" 1115 | } 1116 | ], 1117 | "time": "2022-09-14T12:41:17+00:00" 1118 | }, 1119 | { 1120 | "name": "sebastian/complexity", 1121 | "version": "2.0.3", 1122 | "source": { 1123 | "type": "git", 1124 | "url": "https://github.com/sebastianbergmann/complexity.git", 1125 | "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" 1126 | }, 1127 | "dist": { 1128 | "type": "zip", 1129 | "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", 1130 | "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", 1131 | "shasum": "" 1132 | }, 1133 | "require": { 1134 | "nikic/php-parser": "^4.18 || ^5.0", 1135 | "php": ">=7.3" 1136 | }, 1137 | "require-dev": { 1138 | "phpunit/phpunit": "^9.3" 1139 | }, 1140 | "type": "library", 1141 | "extra": { 1142 | "branch-alias": { 1143 | "dev-master": "2.0-dev" 1144 | } 1145 | }, 1146 | "autoload": { 1147 | "classmap": [ 1148 | "src/" 1149 | ] 1150 | }, 1151 | "notification-url": "https://packagist.org/downloads/", 1152 | "license": [ 1153 | "BSD-3-Clause" 1154 | ], 1155 | "authors": [ 1156 | { 1157 | "name": "Sebastian Bergmann", 1158 | "email": "sebastian@phpunit.de", 1159 | "role": "lead" 1160 | } 1161 | ], 1162 | "description": "Library for calculating the complexity of PHP code units", 1163 | "homepage": "https://github.com/sebastianbergmann/complexity", 1164 | "support": { 1165 | "issues": "https://github.com/sebastianbergmann/complexity/issues", 1166 | "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" 1167 | }, 1168 | "funding": [ 1169 | { 1170 | "url": "https://github.com/sebastianbergmann", 1171 | "type": "github" 1172 | } 1173 | ], 1174 | "time": "2023-12-22T06:19:30+00:00" 1175 | }, 1176 | { 1177 | "name": "sebastian/diff", 1178 | "version": "4.0.6", 1179 | "source": { 1180 | "type": "git", 1181 | "url": "https://github.com/sebastianbergmann/diff.git", 1182 | "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" 1183 | }, 1184 | "dist": { 1185 | "type": "zip", 1186 | "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", 1187 | "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", 1188 | "shasum": "" 1189 | }, 1190 | "require": { 1191 | "php": ">=7.3" 1192 | }, 1193 | "require-dev": { 1194 | "phpunit/phpunit": "^9.3", 1195 | "symfony/process": "^4.2 || ^5" 1196 | }, 1197 | "type": "library", 1198 | "extra": { 1199 | "branch-alias": { 1200 | "dev-master": "4.0-dev" 1201 | } 1202 | }, 1203 | "autoload": { 1204 | "classmap": [ 1205 | "src/" 1206 | ] 1207 | }, 1208 | "notification-url": "https://packagist.org/downloads/", 1209 | "license": [ 1210 | "BSD-3-Clause" 1211 | ], 1212 | "authors": [ 1213 | { 1214 | "name": "Sebastian Bergmann", 1215 | "email": "sebastian@phpunit.de" 1216 | }, 1217 | { 1218 | "name": "Kore Nordmann", 1219 | "email": "mail@kore-nordmann.de" 1220 | } 1221 | ], 1222 | "description": "Diff implementation", 1223 | "homepage": "https://github.com/sebastianbergmann/diff", 1224 | "keywords": [ 1225 | "diff", 1226 | "udiff", 1227 | "unidiff", 1228 | "unified diff" 1229 | ], 1230 | "support": { 1231 | "issues": "https://github.com/sebastianbergmann/diff/issues", 1232 | "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" 1233 | }, 1234 | "funding": [ 1235 | { 1236 | "url": "https://github.com/sebastianbergmann", 1237 | "type": "github" 1238 | } 1239 | ], 1240 | "time": "2024-03-02T06:30:58+00:00" 1241 | }, 1242 | { 1243 | "name": "sebastian/environment", 1244 | "version": "5.1.5", 1245 | "source": { 1246 | "type": "git", 1247 | "url": "https://github.com/sebastianbergmann/environment.git", 1248 | "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" 1249 | }, 1250 | "dist": { 1251 | "type": "zip", 1252 | "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", 1253 | "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", 1254 | "shasum": "" 1255 | }, 1256 | "require": { 1257 | "php": ">=7.3" 1258 | }, 1259 | "require-dev": { 1260 | "phpunit/phpunit": "^9.3" 1261 | }, 1262 | "suggest": { 1263 | "ext-posix": "*" 1264 | }, 1265 | "type": "library", 1266 | "extra": { 1267 | "branch-alias": { 1268 | "dev-master": "5.1-dev" 1269 | } 1270 | }, 1271 | "autoload": { 1272 | "classmap": [ 1273 | "src/" 1274 | ] 1275 | }, 1276 | "notification-url": "https://packagist.org/downloads/", 1277 | "license": [ 1278 | "BSD-3-Clause" 1279 | ], 1280 | "authors": [ 1281 | { 1282 | "name": "Sebastian Bergmann", 1283 | "email": "sebastian@phpunit.de" 1284 | } 1285 | ], 1286 | "description": "Provides functionality to handle HHVM/PHP environments", 1287 | "homepage": "http://www.github.com/sebastianbergmann/environment", 1288 | "keywords": [ 1289 | "Xdebug", 1290 | "environment", 1291 | "hhvm" 1292 | ], 1293 | "support": { 1294 | "issues": "https://github.com/sebastianbergmann/environment/issues", 1295 | "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" 1296 | }, 1297 | "funding": [ 1298 | { 1299 | "url": "https://github.com/sebastianbergmann", 1300 | "type": "github" 1301 | } 1302 | ], 1303 | "time": "2023-02-03T06:03:51+00:00" 1304 | }, 1305 | { 1306 | "name": "sebastian/exporter", 1307 | "version": "4.0.6", 1308 | "source": { 1309 | "type": "git", 1310 | "url": "https://github.com/sebastianbergmann/exporter.git", 1311 | "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" 1312 | }, 1313 | "dist": { 1314 | "type": "zip", 1315 | "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", 1316 | "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", 1317 | "shasum": "" 1318 | }, 1319 | "require": { 1320 | "php": ">=7.3", 1321 | "sebastian/recursion-context": "^4.0" 1322 | }, 1323 | "require-dev": { 1324 | "ext-mbstring": "*", 1325 | "phpunit/phpunit": "^9.3" 1326 | }, 1327 | "type": "library", 1328 | "extra": { 1329 | "branch-alias": { 1330 | "dev-master": "4.0-dev" 1331 | } 1332 | }, 1333 | "autoload": { 1334 | "classmap": [ 1335 | "src/" 1336 | ] 1337 | }, 1338 | "notification-url": "https://packagist.org/downloads/", 1339 | "license": [ 1340 | "BSD-3-Clause" 1341 | ], 1342 | "authors": [ 1343 | { 1344 | "name": "Sebastian Bergmann", 1345 | "email": "sebastian@phpunit.de" 1346 | }, 1347 | { 1348 | "name": "Jeff Welch", 1349 | "email": "whatthejeff@gmail.com" 1350 | }, 1351 | { 1352 | "name": "Volker Dusch", 1353 | "email": "github@wallbash.com" 1354 | }, 1355 | { 1356 | "name": "Adam Harvey", 1357 | "email": "aharvey@php.net" 1358 | }, 1359 | { 1360 | "name": "Bernhard Schussek", 1361 | "email": "bschussek@gmail.com" 1362 | } 1363 | ], 1364 | "description": "Provides the functionality to export PHP variables for visualization", 1365 | "homepage": "https://www.github.com/sebastianbergmann/exporter", 1366 | "keywords": [ 1367 | "export", 1368 | "exporter" 1369 | ], 1370 | "support": { 1371 | "issues": "https://github.com/sebastianbergmann/exporter/issues", 1372 | "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" 1373 | }, 1374 | "funding": [ 1375 | { 1376 | "url": "https://github.com/sebastianbergmann", 1377 | "type": "github" 1378 | } 1379 | ], 1380 | "time": "2024-03-02T06:33:00+00:00" 1381 | }, 1382 | { 1383 | "name": "sebastian/global-state", 1384 | "version": "5.0.7", 1385 | "source": { 1386 | "type": "git", 1387 | "url": "https://github.com/sebastianbergmann/global-state.git", 1388 | "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" 1389 | }, 1390 | "dist": { 1391 | "type": "zip", 1392 | "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", 1393 | "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", 1394 | "shasum": "" 1395 | }, 1396 | "require": { 1397 | "php": ">=7.3", 1398 | "sebastian/object-reflector": "^2.0", 1399 | "sebastian/recursion-context": "^4.0" 1400 | }, 1401 | "require-dev": { 1402 | "ext-dom": "*", 1403 | "phpunit/phpunit": "^9.3" 1404 | }, 1405 | "suggest": { 1406 | "ext-uopz": "*" 1407 | }, 1408 | "type": "library", 1409 | "extra": { 1410 | "branch-alias": { 1411 | "dev-master": "5.0-dev" 1412 | } 1413 | }, 1414 | "autoload": { 1415 | "classmap": [ 1416 | "src/" 1417 | ] 1418 | }, 1419 | "notification-url": "https://packagist.org/downloads/", 1420 | "license": [ 1421 | "BSD-3-Clause" 1422 | ], 1423 | "authors": [ 1424 | { 1425 | "name": "Sebastian Bergmann", 1426 | "email": "sebastian@phpunit.de" 1427 | } 1428 | ], 1429 | "description": "Snapshotting of global state", 1430 | "homepage": "http://www.github.com/sebastianbergmann/global-state", 1431 | "keywords": [ 1432 | "global state" 1433 | ], 1434 | "support": { 1435 | "issues": "https://github.com/sebastianbergmann/global-state/issues", 1436 | "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" 1437 | }, 1438 | "funding": [ 1439 | { 1440 | "url": "https://github.com/sebastianbergmann", 1441 | "type": "github" 1442 | } 1443 | ], 1444 | "time": "2024-03-02T06:35:11+00:00" 1445 | }, 1446 | { 1447 | "name": "sebastian/lines-of-code", 1448 | "version": "1.0.4", 1449 | "source": { 1450 | "type": "git", 1451 | "url": "https://github.com/sebastianbergmann/lines-of-code.git", 1452 | "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" 1453 | }, 1454 | "dist": { 1455 | "type": "zip", 1456 | "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", 1457 | "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", 1458 | "shasum": "" 1459 | }, 1460 | "require": { 1461 | "nikic/php-parser": "^4.18 || ^5.0", 1462 | "php": ">=7.3" 1463 | }, 1464 | "require-dev": { 1465 | "phpunit/phpunit": "^9.3" 1466 | }, 1467 | "type": "library", 1468 | "extra": { 1469 | "branch-alias": { 1470 | "dev-master": "1.0-dev" 1471 | } 1472 | }, 1473 | "autoload": { 1474 | "classmap": [ 1475 | "src/" 1476 | ] 1477 | }, 1478 | "notification-url": "https://packagist.org/downloads/", 1479 | "license": [ 1480 | "BSD-3-Clause" 1481 | ], 1482 | "authors": [ 1483 | { 1484 | "name": "Sebastian Bergmann", 1485 | "email": "sebastian@phpunit.de", 1486 | "role": "lead" 1487 | } 1488 | ], 1489 | "description": "Library for counting the lines of code in PHP source code", 1490 | "homepage": "https://github.com/sebastianbergmann/lines-of-code", 1491 | "support": { 1492 | "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", 1493 | "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" 1494 | }, 1495 | "funding": [ 1496 | { 1497 | "url": "https://github.com/sebastianbergmann", 1498 | "type": "github" 1499 | } 1500 | ], 1501 | "time": "2023-12-22T06:20:34+00:00" 1502 | }, 1503 | { 1504 | "name": "sebastian/object-enumerator", 1505 | "version": "4.0.4", 1506 | "source": { 1507 | "type": "git", 1508 | "url": "https://github.com/sebastianbergmann/object-enumerator.git", 1509 | "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" 1510 | }, 1511 | "dist": { 1512 | "type": "zip", 1513 | "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", 1514 | "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", 1515 | "shasum": "" 1516 | }, 1517 | "require": { 1518 | "php": ">=7.3", 1519 | "sebastian/object-reflector": "^2.0", 1520 | "sebastian/recursion-context": "^4.0" 1521 | }, 1522 | "require-dev": { 1523 | "phpunit/phpunit": "^9.3" 1524 | }, 1525 | "type": "library", 1526 | "extra": { 1527 | "branch-alias": { 1528 | "dev-master": "4.0-dev" 1529 | } 1530 | }, 1531 | "autoload": { 1532 | "classmap": [ 1533 | "src/" 1534 | ] 1535 | }, 1536 | "notification-url": "https://packagist.org/downloads/", 1537 | "license": [ 1538 | "BSD-3-Clause" 1539 | ], 1540 | "authors": [ 1541 | { 1542 | "name": "Sebastian Bergmann", 1543 | "email": "sebastian@phpunit.de" 1544 | } 1545 | ], 1546 | "description": "Traverses array structures and object graphs to enumerate all referenced objects", 1547 | "homepage": "https://github.com/sebastianbergmann/object-enumerator/", 1548 | "support": { 1549 | "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", 1550 | "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" 1551 | }, 1552 | "funding": [ 1553 | { 1554 | "url": "https://github.com/sebastianbergmann", 1555 | "type": "github" 1556 | } 1557 | ], 1558 | "time": "2020-10-26T13:12:34+00:00" 1559 | }, 1560 | { 1561 | "name": "sebastian/object-reflector", 1562 | "version": "2.0.4", 1563 | "source": { 1564 | "type": "git", 1565 | "url": "https://github.com/sebastianbergmann/object-reflector.git", 1566 | "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" 1567 | }, 1568 | "dist": { 1569 | "type": "zip", 1570 | "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", 1571 | "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", 1572 | "shasum": "" 1573 | }, 1574 | "require": { 1575 | "php": ">=7.3" 1576 | }, 1577 | "require-dev": { 1578 | "phpunit/phpunit": "^9.3" 1579 | }, 1580 | "type": "library", 1581 | "extra": { 1582 | "branch-alias": { 1583 | "dev-master": "2.0-dev" 1584 | } 1585 | }, 1586 | "autoload": { 1587 | "classmap": [ 1588 | "src/" 1589 | ] 1590 | }, 1591 | "notification-url": "https://packagist.org/downloads/", 1592 | "license": [ 1593 | "BSD-3-Clause" 1594 | ], 1595 | "authors": [ 1596 | { 1597 | "name": "Sebastian Bergmann", 1598 | "email": "sebastian@phpunit.de" 1599 | } 1600 | ], 1601 | "description": "Allows reflection of object attributes, including inherited and non-public ones", 1602 | "homepage": "https://github.com/sebastianbergmann/object-reflector/", 1603 | "support": { 1604 | "issues": "https://github.com/sebastianbergmann/object-reflector/issues", 1605 | "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" 1606 | }, 1607 | "funding": [ 1608 | { 1609 | "url": "https://github.com/sebastianbergmann", 1610 | "type": "github" 1611 | } 1612 | ], 1613 | "time": "2020-10-26T13:14:26+00:00" 1614 | }, 1615 | { 1616 | "name": "sebastian/recursion-context", 1617 | "version": "4.0.5", 1618 | "source": { 1619 | "type": "git", 1620 | "url": "https://github.com/sebastianbergmann/recursion-context.git", 1621 | "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" 1622 | }, 1623 | "dist": { 1624 | "type": "zip", 1625 | "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", 1626 | "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", 1627 | "shasum": "" 1628 | }, 1629 | "require": { 1630 | "php": ">=7.3" 1631 | }, 1632 | "require-dev": { 1633 | "phpunit/phpunit": "^9.3" 1634 | }, 1635 | "type": "library", 1636 | "extra": { 1637 | "branch-alias": { 1638 | "dev-master": "4.0-dev" 1639 | } 1640 | }, 1641 | "autoload": { 1642 | "classmap": [ 1643 | "src/" 1644 | ] 1645 | }, 1646 | "notification-url": "https://packagist.org/downloads/", 1647 | "license": [ 1648 | "BSD-3-Clause" 1649 | ], 1650 | "authors": [ 1651 | { 1652 | "name": "Sebastian Bergmann", 1653 | "email": "sebastian@phpunit.de" 1654 | }, 1655 | { 1656 | "name": "Jeff Welch", 1657 | "email": "whatthejeff@gmail.com" 1658 | }, 1659 | { 1660 | "name": "Adam Harvey", 1661 | "email": "aharvey@php.net" 1662 | } 1663 | ], 1664 | "description": "Provides functionality to recursively process PHP variables", 1665 | "homepage": "https://github.com/sebastianbergmann/recursion-context", 1666 | "support": { 1667 | "issues": "https://github.com/sebastianbergmann/recursion-context/issues", 1668 | "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" 1669 | }, 1670 | "funding": [ 1671 | { 1672 | "url": "https://github.com/sebastianbergmann", 1673 | "type": "github" 1674 | } 1675 | ], 1676 | "time": "2023-02-03T06:07:39+00:00" 1677 | }, 1678 | { 1679 | "name": "sebastian/resource-operations", 1680 | "version": "3.0.4", 1681 | "source": { 1682 | "type": "git", 1683 | "url": "https://github.com/sebastianbergmann/resource-operations.git", 1684 | "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e" 1685 | }, 1686 | "dist": { 1687 | "type": "zip", 1688 | "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e", 1689 | "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e", 1690 | "shasum": "" 1691 | }, 1692 | "require": { 1693 | "php": ">=7.3" 1694 | }, 1695 | "require-dev": { 1696 | "phpunit/phpunit": "^9.0" 1697 | }, 1698 | "type": "library", 1699 | "extra": { 1700 | "branch-alias": { 1701 | "dev-main": "3.0-dev" 1702 | } 1703 | }, 1704 | "autoload": { 1705 | "classmap": [ 1706 | "src/" 1707 | ] 1708 | }, 1709 | "notification-url": "https://packagist.org/downloads/", 1710 | "license": [ 1711 | "BSD-3-Clause" 1712 | ], 1713 | "authors": [ 1714 | { 1715 | "name": "Sebastian Bergmann", 1716 | "email": "sebastian@phpunit.de" 1717 | } 1718 | ], 1719 | "description": "Provides a list of PHP built-in functions that operate on resources", 1720 | "homepage": "https://www.github.com/sebastianbergmann/resource-operations", 1721 | "support": { 1722 | "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4" 1723 | }, 1724 | "funding": [ 1725 | { 1726 | "url": "https://github.com/sebastianbergmann", 1727 | "type": "github" 1728 | } 1729 | ], 1730 | "time": "2024-03-14T16:00:52+00:00" 1731 | }, 1732 | { 1733 | "name": "sebastian/type", 1734 | "version": "3.2.1", 1735 | "source": { 1736 | "type": "git", 1737 | "url": "https://github.com/sebastianbergmann/type.git", 1738 | "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" 1739 | }, 1740 | "dist": { 1741 | "type": "zip", 1742 | "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", 1743 | "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", 1744 | "shasum": "" 1745 | }, 1746 | "require": { 1747 | "php": ">=7.3" 1748 | }, 1749 | "require-dev": { 1750 | "phpunit/phpunit": "^9.5" 1751 | }, 1752 | "type": "library", 1753 | "extra": { 1754 | "branch-alias": { 1755 | "dev-master": "3.2-dev" 1756 | } 1757 | }, 1758 | "autoload": { 1759 | "classmap": [ 1760 | "src/" 1761 | ] 1762 | }, 1763 | "notification-url": "https://packagist.org/downloads/", 1764 | "license": [ 1765 | "BSD-3-Clause" 1766 | ], 1767 | "authors": [ 1768 | { 1769 | "name": "Sebastian Bergmann", 1770 | "email": "sebastian@phpunit.de", 1771 | "role": "lead" 1772 | } 1773 | ], 1774 | "description": "Collection of value objects that represent the types of the PHP type system", 1775 | "homepage": "https://github.com/sebastianbergmann/type", 1776 | "support": { 1777 | "issues": "https://github.com/sebastianbergmann/type/issues", 1778 | "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" 1779 | }, 1780 | "funding": [ 1781 | { 1782 | "url": "https://github.com/sebastianbergmann", 1783 | "type": "github" 1784 | } 1785 | ], 1786 | "time": "2023-02-03T06:13:03+00:00" 1787 | }, 1788 | { 1789 | "name": "sebastian/version", 1790 | "version": "3.0.2", 1791 | "source": { 1792 | "type": "git", 1793 | "url": "https://github.com/sebastianbergmann/version.git", 1794 | "reference": "c6c1022351a901512170118436c764e473f6de8c" 1795 | }, 1796 | "dist": { 1797 | "type": "zip", 1798 | "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", 1799 | "reference": "c6c1022351a901512170118436c764e473f6de8c", 1800 | "shasum": "" 1801 | }, 1802 | "require": { 1803 | "php": ">=7.3" 1804 | }, 1805 | "type": "library", 1806 | "extra": { 1807 | "branch-alias": { 1808 | "dev-master": "3.0-dev" 1809 | } 1810 | }, 1811 | "autoload": { 1812 | "classmap": [ 1813 | "src/" 1814 | ] 1815 | }, 1816 | "notification-url": "https://packagist.org/downloads/", 1817 | "license": [ 1818 | "BSD-3-Clause" 1819 | ], 1820 | "authors": [ 1821 | { 1822 | "name": "Sebastian Bergmann", 1823 | "email": "sebastian@phpunit.de", 1824 | "role": "lead" 1825 | } 1826 | ], 1827 | "description": "Library that helps with managing the version number of Git-hosted PHP projects", 1828 | "homepage": "https://github.com/sebastianbergmann/version", 1829 | "support": { 1830 | "issues": "https://github.com/sebastianbergmann/version/issues", 1831 | "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" 1832 | }, 1833 | "funding": [ 1834 | { 1835 | "url": "https://github.com/sebastianbergmann", 1836 | "type": "github" 1837 | } 1838 | ], 1839 | "time": "2020-09-28T06:39:44+00:00" 1840 | }, 1841 | { 1842 | "name": "squizlabs/php_codesniffer", 1843 | "version": "3.10.3", 1844 | "source": { 1845 | "type": "git", 1846 | "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", 1847 | "reference": "62d32998e820bddc40f99f8251958aed187a5c9c" 1848 | }, 1849 | "dist": { 1850 | "type": "zip", 1851 | "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/62d32998e820bddc40f99f8251958aed187a5c9c", 1852 | "reference": "62d32998e820bddc40f99f8251958aed187a5c9c", 1853 | "shasum": "" 1854 | }, 1855 | "require": { 1856 | "ext-simplexml": "*", 1857 | "ext-tokenizer": "*", 1858 | "ext-xmlwriter": "*", 1859 | "php": ">=5.4.0" 1860 | }, 1861 | "require-dev": { 1862 | "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" 1863 | }, 1864 | "bin": [ 1865 | "bin/phpcbf", 1866 | "bin/phpcs" 1867 | ], 1868 | "type": "library", 1869 | "extra": { 1870 | "branch-alias": { 1871 | "dev-master": "3.x-dev" 1872 | } 1873 | }, 1874 | "notification-url": "https://packagist.org/downloads/", 1875 | "license": [ 1876 | "BSD-3-Clause" 1877 | ], 1878 | "authors": [ 1879 | { 1880 | "name": "Greg Sherwood", 1881 | "role": "Former lead" 1882 | }, 1883 | { 1884 | "name": "Juliette Reinders Folmer", 1885 | "role": "Current lead" 1886 | }, 1887 | { 1888 | "name": "Contributors", 1889 | "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" 1890 | } 1891 | ], 1892 | "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", 1893 | "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", 1894 | "keywords": [ 1895 | "phpcs", 1896 | "standards", 1897 | "static analysis" 1898 | ], 1899 | "support": { 1900 | "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", 1901 | "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", 1902 | "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", 1903 | "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" 1904 | }, 1905 | "funding": [ 1906 | { 1907 | "url": "https://github.com/PHPCSStandards", 1908 | "type": "github" 1909 | }, 1910 | { 1911 | "url": "https://github.com/jrfnl", 1912 | "type": "github" 1913 | }, 1914 | { 1915 | "url": "https://opencollective.com/php_codesniffer", 1916 | "type": "open_collective" 1917 | } 1918 | ], 1919 | "time": "2024-09-18T10:38:58+00:00" 1920 | }, 1921 | { 1922 | "name": "theseer/tokenizer", 1923 | "version": "1.2.3", 1924 | "source": { 1925 | "type": "git", 1926 | "url": "https://github.com/theseer/tokenizer.git", 1927 | "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" 1928 | }, 1929 | "dist": { 1930 | "type": "zip", 1931 | "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", 1932 | "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", 1933 | "shasum": "" 1934 | }, 1935 | "require": { 1936 | "ext-dom": "*", 1937 | "ext-tokenizer": "*", 1938 | "ext-xmlwriter": "*", 1939 | "php": "^7.2 || ^8.0" 1940 | }, 1941 | "type": "library", 1942 | "autoload": { 1943 | "classmap": [ 1944 | "src/" 1945 | ] 1946 | }, 1947 | "notification-url": "https://packagist.org/downloads/", 1948 | "license": [ 1949 | "BSD-3-Clause" 1950 | ], 1951 | "authors": [ 1952 | { 1953 | "name": "Arne Blankerts", 1954 | "email": "arne@blankerts.de", 1955 | "role": "Developer" 1956 | } 1957 | ], 1958 | "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", 1959 | "support": { 1960 | "issues": "https://github.com/theseer/tokenizer/issues", 1961 | "source": "https://github.com/theseer/tokenizer/tree/1.2.3" 1962 | }, 1963 | "funding": [ 1964 | { 1965 | "url": "https://github.com/theseer", 1966 | "type": "github" 1967 | } 1968 | ], 1969 | "time": "2024-03-03T12:36:25+00:00" 1970 | }, 1971 | { 1972 | "name": "wp-coding-standards/wpcs", 1973 | "version": "2.3.0", 1974 | "source": { 1975 | "type": "git", 1976 | "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", 1977 | "reference": "7da1894633f168fe244afc6de00d141f27517b62" 1978 | }, 1979 | "dist": { 1980 | "type": "zip", 1981 | "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/7da1894633f168fe244afc6de00d141f27517b62", 1982 | "reference": "7da1894633f168fe244afc6de00d141f27517b62", 1983 | "shasum": "" 1984 | }, 1985 | "require": { 1986 | "php": ">=5.4", 1987 | "squizlabs/php_codesniffer": "^3.3.1" 1988 | }, 1989 | "require-dev": { 1990 | "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || ^0.6", 1991 | "phpcompatibility/php-compatibility": "^9.0", 1992 | "phpcsstandards/phpcsdevtools": "^1.0", 1993 | "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" 1994 | }, 1995 | "suggest": { 1996 | "dealerdirect/phpcodesniffer-composer-installer": "^0.6 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically." 1997 | }, 1998 | "type": "phpcodesniffer-standard", 1999 | "notification-url": "https://packagist.org/downloads/", 2000 | "license": [ 2001 | "MIT" 2002 | ], 2003 | "authors": [ 2004 | { 2005 | "name": "Contributors", 2006 | "homepage": "https://github.com/WordPress/WordPress-Coding-Standards/graphs/contributors" 2007 | } 2008 | ], 2009 | "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions", 2010 | "keywords": [ 2011 | "phpcs", 2012 | "standards", 2013 | "wordpress" 2014 | ], 2015 | "support": { 2016 | "issues": "https://github.com/WordPress/WordPress-Coding-Standards/issues", 2017 | "source": "https://github.com/WordPress/WordPress-Coding-Standards", 2018 | "wiki": "https://github.com/WordPress/WordPress-Coding-Standards/wiki" 2019 | }, 2020 | "time": "2020-05-13T23:57:56+00:00" 2021 | }, 2022 | { 2023 | "name": "yoast/phpunit-polyfills", 2024 | "version": "3.0.0", 2025 | "source": { 2026 | "type": "git", 2027 | "url": "https://github.com/Yoast/PHPUnit-Polyfills.git", 2028 | "reference": "19e6d5fb8aad31f731f774f9646a10c64a8843d2" 2029 | }, 2030 | "dist": { 2031 | "type": "zip", 2032 | "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/19e6d5fb8aad31f731f774f9646a10c64a8843d2", 2033 | "reference": "19e6d5fb8aad31f731f774f9646a10c64a8843d2", 2034 | "shasum": "" 2035 | }, 2036 | "require": { 2037 | "php": ">=7.0", 2038 | "phpunit/phpunit": "^6.4.4 || ^7.0 || ^8.0 || ^9.0 || ^11.0" 2039 | }, 2040 | "require-dev": { 2041 | "php-parallel-lint/php-console-highlighter": "^1.0.0", 2042 | "php-parallel-lint/php-parallel-lint": "^1.4.0", 2043 | "yoast/yoastcs": "^3.1.0" 2044 | }, 2045 | "type": "library", 2046 | "extra": { 2047 | "branch-alias": { 2048 | "dev-main": "3.x-dev" 2049 | } 2050 | }, 2051 | "autoload": { 2052 | "files": [ 2053 | "phpunitpolyfills-autoload.php" 2054 | ] 2055 | }, 2056 | "notification-url": "https://packagist.org/downloads/", 2057 | "license": [ 2058 | "BSD-3-Clause" 2059 | ], 2060 | "authors": [ 2061 | { 2062 | "name": "Team Yoast", 2063 | "email": "support@yoast.com", 2064 | "homepage": "https://yoast.com" 2065 | }, 2066 | { 2067 | "name": "Contributors", 2068 | "homepage": "https://github.com/Yoast/PHPUnit-Polyfills/graphs/contributors" 2069 | } 2070 | ], 2071 | "description": "Set of polyfills for changed PHPUnit functionality to allow for creating PHPUnit cross-version compatible tests", 2072 | "homepage": "https://github.com/Yoast/PHPUnit-Polyfills", 2073 | "keywords": [ 2074 | "phpunit", 2075 | "polyfill", 2076 | "testing" 2077 | ], 2078 | "support": { 2079 | "issues": "https://github.com/Yoast/PHPUnit-Polyfills/issues", 2080 | "security": "https://github.com/Yoast/PHPUnit-Polyfills/security/policy", 2081 | "source": "https://github.com/Yoast/PHPUnit-Polyfills" 2082 | }, 2083 | "time": "2024-09-07T00:24:25+00:00" 2084 | } 2085 | ], 2086 | "aliases": [], 2087 | "minimum-stability": "stable", 2088 | "stability-flags": {}, 2089 | "prefer-stable": false, 2090 | "prefer-lowest": false, 2091 | "platform": {}, 2092 | "platform-dev": {}, 2093 | "plugin-api-version": "2.6.0" 2094 | } 2095 | --------------------------------------------------------------------------------