WC_Integration_MaxMind_Geolocation::__construct()
Initialize the integration.
Description Description
Source Source
File: includes/integrations/maxmind-geolocation/class-wc-integration-maxmind-geolocation.php
public function __construct() { $this->id = 'maxmind_geolocation'; $this->method_title = __( 'MaxMind Geolocation', 'woocommerce' ); $this->method_description = __( 'An integration for utilizing MaxMind to do Geolocation lookups. Please note that this integration will only do country lookups.', 'woocommerce' ); /** * Supports overriding the database service to be used. * * @since 3.9.0 * @return mixed|null The geolocation database service. */ $this->database_service = apply_filters( 'woocommerce_maxmind_geolocation_database_service', null ); if ( null === $this->database_service ) { $this->database_service = new WC_Integration_MaxMind_Database_Service( $this->get_database_prefix() ); } $this->init_form_fields(); $this->init_settings(); // Bind to the save action for the settings. add_action( 'woocommerce_update_options_integration_' . $this->id, array( $this, 'process_admin_options' ) ); // Trigger notice if license key is missing. add_action( 'update_option_woocommerce_default_customer_address', array( $this, 'display_missing_license_key_notice' ), 1000, 2 ); /** * Allows for the automatic database update to be disabled. * * @deprecated 3.9.0 * @return bool Whether or not the database should be updated periodically. */ $bind_updater = apply_filters_deprecated( 'woocommerce_geolocation_update_database_periodically', array( true ), '3.9.0', 'woocommerce_maxmind_geolocation_update_database_periodically' ); /** * Allows for the automatic database update to be disabled. * Note that MaxMind's TOS requires that the databases be updated or removed periodically. * * @since 3.9.0 * @param bool $bind_updater Whether or not the database should be updated periodically. */ $bind_updater = apply_filters( 'woocommerce_maxmind_geolocation_update_database_periodically', $bind_updater ); // Bind to the scheduled updater action. if ( $bind_updater ) { add_action( 'woocommerce_geoip_updater', array( $this, 'update_database' ) ); } // Bind to the geolocation filter for MaxMind database lookups. add_filter( 'woocommerce_get_geolocation', array( $this, 'get_geolocation' ), 10, 2 ); }