'value1', 'key2' => 'value2') * generated hidden form elements * @return string An html form that will automatically post itself */ public static function post_with_html($url, $data) { $id = uniqid(); $html = "
\n"; $html .= ""; echo $html; } /** * Gets the URL of the current request * @param bool $show_query Include the query string in the URL * @return string A URL */ public static function get_request_uri($show_query = true) { $isSecure = false; if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') { $_SERVER ['HTTPS'] = 'on'; } if((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || ($_SERVER['SERVER_PORT'] == 443)) { $isSecure = true; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') { $isSecure = true; } $protocol = $isSecure ? 'https' : 'http'; // for ngrok url and Local by Flywheel Live URL if (isset($_SERVER['HTTP_X_ORIGINAL_HOST'])) { $host = $_SERVER['HTTP_X_ORIGINAL_HOST']; } else { $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];//WAS SERVER_NAME and caused problems on some boxes } $url = "{$protocol}://{$host}{$_SERVER['REQUEST_URI']}"; $url = ($show_query) ? $url : preg_replace('/\?.*/', '', $url); return $url; } public static function parse_host($url) { $url = parse_url(trim($url)); if ($url == false) { return null; } return trim($url['host'] ? $url['host'] : array_shift(explode('/', $url['path'], 2))); } }