public static function detect($request_uri) {
		// Don't bother looking up /
		if ($request_uri == '/') {
			return;
		}

		$request = explode('/', trim($request_uri, '/'));

		// Find the filename and extension
		$filename = $request[count($request)-1];
		$extension = substr($filename, strrpos($filename, '.'));

		// If the request does not contain an extension, it's not to be handled by media
		if (strpos($extension, '.') !== 0) {
			return;
		}

		// Remove the . from the extension
		$extension = substr($extension, 1);
		$request_string = implode('/', $request);

		// Detect if it is a request for multiple files
		$class = get_called_class();
		if (strpos($request_string, '&/') !== false) {
			$files = explode('&/', $request_string);

			$mtime = 0;
			foreach ($files as $file) {
				$file_mtime = $class::fetch('mtime', $file, $extension);

				if ($file_mtime === false) {
					$class::fail();
				}

				if ($file_mtime > $mtime) {
					$mtime = $file_mtime;
				}
			}

			if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
				if ($_SERVER['HTTP_IF_MODIFIED_SINCE'] == gmdate('D, d M Y H:i:s', $mtime).' GMT') {
					// Cached version
					$class::output($extension, '', $mtime);
				}
			}

			$content = '';
			foreach ($files as $file) {
				$content .= $class::fetch('content', $file, $extension) . "\n";
			}

			$content = $content;
			$filename = 'compacted.' . $extension;
		} else {
			$mtime = $class::fetch('mtime', $request_string, $extension);

			if ($mtime === false) {
				$class::fail();
			}

			if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
				if ($_SERVER['HTTP_IF_MODIFIED_SINCE'] == gmdate('D, d M Y H:i:s', $mtime).' GMT') {
					// Cached version
					$class::output($extension, '', $mtime);
				}
			}

			$content = $class::fetch('content', $request_string, $extension);

			// If content is null, we don't handle this extension at all. It would be false if the
			// file could not be found.
			if ($content === null) {
				return;
			}
		}

		// .css files can contain URLs and need to be passed through our URL
		// rewrite method
		if ($class::get_mime_type($extension) == 'text/css') {
			// FIXME: this has been disabled for now, but it needs to be fixed.
			// Only CSS files that have been fetched from the application's
			// asset directory should be rewritten.
			//$content = \Skeleton\Core\Util::rewrite_reverse_css($content);
		}

		$class::output($extension, $content, $mtime);
	}