/** * Loads the active Add-On files. * * @since 4.6 */ public static function load_optional_files() { $settings = IncPopupDatabase::get_settings(); if ($settings['geo_db']) { IncPopupAddon_GeoDB::init(); } // $available uses apply_filter to customize the results. $available = self::get_rules(); foreach ($available as $rule) { $path = PO_INC_DIR . 'rules/' . $rule; if (in_array($rule, $settings['rules']) && file_exists($path)) { include_once $path; } } }
/** * Test the geo lookup function. * * @since 4.6.1.1 */ public function ajax_test_geo() { $type = @$_POST['type']; $ip = $this->get_users_ip(); $service = $this->get_service($type); if ('db' == $service->url) { IncPopupAddon_GeoDB::init(); $country = apply_filters('popup-get-country', $country, $ip); } else { $country = $this->country_from_api($ip, $service); } echo 'IP: ' . $ip . "\nService: " . $service->label . "\nCountry: " . $country; die; }