function epages_options_page() { global $epages_api_http_options; $valid_shop_id = false; $shop_id_validated = false; if (!get_option("epages_api_url_confirmed") && get_option("epages_api_url")) { $shop_id_validated = true; // We’re hitting the legal-API to verify whether the provided // Shop ID is actually pointing to the ePages API. $url = esc_html(get_option("epages_api_url")); $url = trim($url, "/") . "/"; epages_log(__("Trying to validate API URL: ", 'epages') . $url); $response = wp_remote_get($url, $epages_api_http_options); epages_log($response); $valid_shop_id = epages_is_valid_api_response($response); $mbo_url = epages_get_mbo_url($response); epages_log(__("API URL validation status: ") . ($valid_shop_id ? __("Success", 'epages') : __("Failure", 'epages'))); update_option("epages_api_url_confirmed", $valid_shop_id); update_option("epages_mbo_url", $mbo_url); } epages_load_template("options_page", array("valid_shop_id" => $valid_shop_id, "shop_id_validated" => $shop_id_validated)); }
function epages_add_popup() { global $epages_api_http_options; epages_load_template("popup", array("epages_plugin_url" => EPAGES_PLUGIN_URL, "epages_api_url" => get_option("epages_api_url"), "epages_api_http_options" => $epages_api_http_options)); }