= new static($theURI); } return static::$instances[$uri]; } /** * Returns the base URI for the request. * * @param boolean $pathonly If false, prepend the scheme, host and port information. Default is false. * * @return string The base URI string * * @since 1.7.0 */ public static function base($pathonly = false) { // Get the base request path. if (empty(static::$base)) { $config = Factory::getContainer()->get('config'); $uri = static::getInstance(); $live_site = ($uri->isSsl()) ? str_replace('http://', 'https://', $config->get('live_site', '')) : $config->get('live_site', ''); if (trim($live_site) != '') { $uri = static::getInstance($live_site); static::$base['prefix'] = $uri->toString(['scheme', 'host', 'port']); static::$base['path'] = rtrim($uri->toString(['path']), '/\\'); if (\defined('JPATH_BASE') && \defined('JPATH_ADMINISTRATOR') && JPATH_BASE == JPATH_ADMINISTRATOR) { static::$base['path'] .= '/administrator'; } if (\defined('JPATH_BASE') && \defined('JPATH_API') && JPATH_BASE == JPATH_API) { static::$base['path'] .= '/api'; } } else { static::$base['prefix'] = $uri->toString(['scheme', 'host', 'port']); if (strpos(PHP_SAPI, 'cgi') !== false && !ini_get('cgi.fix_pathinfo') && !empty($_SERVER['REQUEST_URI'])) { // PHP-CGI on Apache with "cgi.fix_pathinfo = 0" // We shouldn't have user-supplied PATH_INFO in PHP_SELF in this case // because PHP will not work with PATH_INFO at all. $script_name = $_SERVER['PHP_SELF']; } else { // Others $script_name = $_SERVER['SCRIPT_NAME']; } // Extra cleanup to remove invalid chars in the URL to prevent injections through broken server implementation $script_name = str_replace(["'", '"', '<', '>'], ['%27', '%22', '%3C', '%3E'], $script_name); static::$base['path'] = rtrim(\dirname($script_name), '/\\'); } } return $pathonly === false ? static::$base['prefix'] . static::$base['path'] . '/' : static::$base['path']; } /** * Returns the root URI for the request. * * @param boolean $pathonly If false, prepend the scheme, host and port information. Default is false. * @param string $path The path * * @return string The root URI string. * * @since 1.7.0 */ public static function root($pathonly = false, $path = null) { // Get the scheme if (empty(static::$root)) { $uri = static::getInstance(static::base()); static::$root['prefix'] = $uri->toString(['scheme', 'host', 'port']); static::$root['path'] = rtrim($uri->toString(['path']), '/\\'); } // Get the scheme if (isset($path)) { static::$root['path'] = $path; } return $pathonly === false ? static::$root['prefix'] . static::$root['path'] . '/' : static::$root['path']; } /** * Returns the URL for the request, minus the query. * * @return string * * @since 1.7.0 */ public static function current() { // Get the current URL. if (empty(static::$current)) { $uri = static::getInstance(); static::$current = $uri->toString(['scheme', 'host', 'port', 'path']); } return static::$current; } /** * Method to reset class static members for testing and other various issues. * * @return void * * @since 1.7.0 */ public static function reset() { static::$instances = []; static::$base = []; static::$root = []; static::$current = ''; } /** * Checks if the supplied URL is internal * * @param string $url The URL to check. * * @return boolean True if Internal. * * @since 1.7.0 */ public static function isInternal($url) { $url = str_replace('\\', '/', $url); $uri = static::getInstance($url); $base = $uri->toString(['scheme', 'host', 'port', 'path']); $host = $uri->toString(['scheme', 'host', 'port']); // @see UriTest if ( empty($host) && strpos($uri->path, 'index.php') === 0 || !empty($host) && preg_match('#^' . preg_quote(static::base(), '#') . '#', $base) || !empty($host) && $host === static::getInstance(static::base())->host && strpos($uri->path, 'index.php') !== false || !empty($host) && $base === $host && preg_match('#^' . preg_quote($base, '#') . '#', static::base()) ) { return true; } return false; } /** * Build a query from an array (reverse of the PHP parse_str()). * * @param array $params The array of key => value pairs to return as a query string. * * @return string The resulting query string. * * @see parse_str() * @since 1.7.0 * @note The parent method is protected, this exposes it as public for B/C */ public static function buildQuery(array $params) { return parent::buildQuery($params); } /** * Parse a given URI and populate the class fields. * * @param string $uri The URI string to parse. * * @return boolean True on success. * * @since 1.7.0 * @note The parent method is protected, this exposes it as public for B/C */ public function parse($uri) { return parent::parse($uri); } } An Error Occurred: Whoops, looks like something went wrong.

Sorry, there was a problem we could not recover from.

The server returned a "500 - Whoops, looks like something went wrong."

Help me resolve this