Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions lib/Horde/Core/Ui/VarRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,16 @@ public function __construct($params = [])
public static function factory($driver, $params = [])
{
if (is_array($driver)) {
$app = $driver[0];
$app = Horde_String::ucfirst($driver[0]);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No new use of PSR-0 Horde_String - use the PSR-4 HordeString class.

$driver = $driver[1];
} else {
$app = '';
$app = 'Horde_Core';
Comment thread
amulet1 marked this conversation as resolved.
}

$driver = Horde_String::ucfirst(basename($driver));
$class = (empty($app) ? 'Horde_Core' : $app) . '_Ui_VarRenderer_' . $driver;
$class = $app . '_Ui_VarRenderer_' . $driver;

$ok = class_exists($class);

// TODO: Eliminate after renaming Horde_Ui_VarRenderer_* classes in other apps to {app}_Ui_VarRenderer_*
if (!$ok && !empty($app)) {
// fallback to legacy method (manual load)
$class = __CLASS__ . '_' . $driver;
include_once $GLOBALS['registry']->get('fileroot', $app) . '/lib/Ui/VarRenderer/' . $driver . '.php';
$ok = class_exists($class);
}

if (!$ok) {
if (!class_exists($class)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine - we should not try to play autoloader.

throw new LogicException('Class definition of ' . $class . ' not found.');
}

Expand Down
Loading