diff --git a/libraries/joomla/document/document.php b/libraries/joomla/document/document.php index d23c5a8ea697a..dab0784e4ab04 100644 --- a/libraries/joomla/document/document.php +++ b/libraries/joomla/document/document.php @@ -277,27 +277,28 @@ public static function getInstance($type = 'html', $attributes = array()) { $type = preg_replace('/[^A-Z0-9_\.-]/i', '', $type); $path = __DIR__ . '/' . $type . '/' . $type . '.php'; + $rawpath = __DIR__ . '/raw/raw.php'; $ntype = null; - // Check if the document type exists - if (!file_exists($path)) - { - // Default to the raw format - $ntype = $type; - $type = 'raw'; - } - // Determine the path and class $class = 'JDocument' . $type; if (!class_exists($class)) { - $path = __DIR__ . '/' . $type . '/' . $type . '.php'; - if (file_exists($path)) { require_once $path; } + // Default to the raw format + elseif (file_exists($rawpath)) + { + $ntype = $type; + $type = 'raw'; + + $class = 'JDocument' . $type; + + require_once $rawpath; + } else { // @codeCoverageIgnoreStart