Skip to content

Commit

Permalink
Deprecate support for non-autoloadable JDocument subclasses
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Babker committed Nov 21, 2015
1 parent ef6c1b1 commit bb0db5f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions libraries/joomla/document/document.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,26 +275,28 @@ public static function getInstance($type = 'html', $attributes = array())

if (empty(self::$instances[$signature]))
{
$type = preg_replace('/[^A-Z0-9_\.-]/i', '', $type);
$path = __DIR__ . '/' . $type . '/' . $type . '.php';
$rawpath = __DIR__ . '/raw/raw.php';
$type = preg_replace('/[^A-Z0-9_\.-]/i', '', $type);
$ntype = null;

// Determine the path and class
$class = 'JDocument' . $type;

if (!class_exists($class))
{
// @deprecated 4.0 - JDocument objects should be autoloaded instead
$path = __DIR__ . '/' . $type . '/' . $type . '.php';
$rawpath = __DIR__ . '/raw/raw.php';

if (file_exists($path))
{
JLog::add('Non-autoloadable JDocument subclasses are deprecated, support will be removed in 4.0.', JLog::WARNING, 'deprecated');
require_once $path;
}
// Default to the raw format
elseif (file_exists($rawpath))
{
$ntype = $type;
$type = 'raw';

$type = 'raw';
$class = 'JDocument' . $type;

require_once $rawpath;
Expand Down

0 comments on commit bb0db5f

Please sign in to comment.