$cookies_to_forward = UBUtil::array_select_by_key($_COOKIE, array('ubvs', 'ubpv', 'ubvt')); $cookie_string = UBHTTP::cookie_string_from_array($cookies_to_forward); $req_headers = $referer == null ? array('Host: ' . $domain) : array('Referer: ' . $referer, 'Host: ' . $domain); // Make sure we don't get cached by Wordpress hosts like WPEngine header('Cache-Control: max-age=0; private'); list($success, $message) = UBHTTP::stream_request($http_method, $raw_url, $cookie_string, $req_headers, $user_agent); if ($success === false) { update_option(UBConfig::UB_PROXY_ERROR_MESSAGE_KEY, $message); } $end = microtime(true); $time_taken = ($end - $start) * 1000; UBLogger::debug_var('time_taken', $time_taken); UBLogger::debug("proxying for {$current_url} done successfuly -- took {$time_taken} ms"); exit(0); } }, UBConfig::int_min()); add_action('admin_init', function () { UBUtil::clear_flash(); # Disable incompatible scripts # WPML wp_dequeue_script('installer-admin'); # Enqueue our own scripts # Main page wp_enqueue_script('ub-rx', plugins_url('js/rx.lite.compat.min.js', __FILE__)); wp_enqueue_script('set-unbounce-domains-js', plugins_url('js/set-unbounce-domains.js', __FILE__), array('jquery', 'ub-rx')); wp_enqueue_script('unbounce-page-js', plugins_url('js/unbounce-page.js', __FILE__), array('jquery')); # Diagnostics page wp_enqueue_script('ub-clipboard-js', plugins_url('js/clipboard.min.js', __FILE__)); wp_enqueue_script('unbounce-diagnostics-js', plugins_url('js/unbounce-diagnostics.js', __FILE__), array('jquery', 'ub-clipboard-js')); # Re-enable incompatible scripts # WPML