/** * Returns the lookup-service details * * @since 4.6.1.1 * @return object Service object for geo lookup */ protected static function get_service($type = null) { $service = false; if (null === $type) { // Default service. if (defined('PO_REMOTE_IP_URL') && strlen(PO_REMOTE_IP_URL) > 5) { $type = ''; } else { $settings = IncPopupDatabase::get_settings(); $type = @$settings['geo_lookup']; } } if ('' == $type) { $service = (object) array('url' => PO_REMOTE_IP_URL, 'label' => 'wp-config.php', 'type' => 'text'); } else { if ('geo_db' === $type) { $service = (object) array('url' => 'db', 'label' => __('Local IP Lookup Table', PO_LANG), 'type' => 'text'); } else { $geo_service = IncPopupDatabase::get_geo_services(); $service = @$geo_service[$type]; } } return $service; }
<?php /** * Display the popup settings page. */ $loading_methods = IncPopupDatabase::get_loading_methods(); $settings = IncPopupDatabase::get_settings(); $cur_method = $settings['loadingmethod']; $form_url = esc_url_raw(remove_query_arg(array('message', 'action', '_wpnonce'))); // Theme compatibility. $theme_compat = IncPopupAddon_HeaderFooter::check(); $theme_class = $theme_compat->okay ? 'msg-ok' : 'msg-err'; // START: Geo Lookup $geo_service = IncPopupDatabase::get_geo_services(); $no_ip_cache = false; $custom_geo = false; $geo_msg = ''; if (!IncPopupAddon_GeoDB::table_exists()) { $no_ip_cache = true; $settings['geo_db'] = false; $geo_msg .= '<p class="locked-msg">' . sprintf(__('<strong>Local IP Lookup Table</strong>: This is unavailable because ' . 'no geo-data table was found in your database. For details, ' . 'read the "Using a Local Geo-Database" in the ' . '<a href="%1$s" target="_blank">PopUp usage guide</a>.', PO_LANG), 'http://premium.wpmudev.org/project/the-pop-over-plugin/#usage') . '</p>'; } if (defined('PO_REMOTE_IP_URL') && strlen(PO_REMOTE_IP_URL) > 5) { $custom_geo = true; $settings['geo_lookup'] = ''; $geo_msg .= '<p class="locked-msg">' . __('<strong>Custom Webservice</strong>: You have configured a custom ' . 'lookup service in <tt>wp-config.php</tt> via the constant ' . '"<tt>PO_REMOTE_IP_URL</tt>". To use one of the default services ' . 'you have to remove that constant from wp-config.php.', PO_LANG) . '</p>'; } // ----- END: Geo Lookup $rules = IncPopup::get_rules(); $rule_headers = array('name' => 'Name', 'desc' => 'Description', 'rules' => 'Rules', 'limit' => 'Limit'); $ordered_rules = array();