From: Michael J. Rubinsky Date: Mon, 28 Jun 2010 22:35:10 +0000 (-0400) Subject: No need for a factory method any longer, use Horde_Url style parameters here X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=fbcd1aa2a6c6816c68f0e87afca2c1e6e1cadcea;p=horde.git No need for a factory method any longer, use Horde_Url style parameters here --- diff --git a/jonah/lib/Driver.php b/jonah/lib/Driver.php index 91bb1a8e1..ebda7d3d2 100644 --- a/jonah/lib/Driver.php +++ b/jonah/lib/Driver.php @@ -516,41 +516,6 @@ class Jonah_Driver { } /** - * Attempts to return a concrete Jonah_Driver instance based on $driver. - * - * @param string $driver The type of concrete Jonah_Driver subclass to - * return. The is based on the storage driver - * ($driver). The code is dynamically included. - * - * @param array $params A hash containing any additional configuration or - * connection parameters a subclass might need. - * - * @return mixed The newly created concrete Jonah_Driver instance, or false - * on an error. - */ - function factory($driver = null, $params = null) - { - if ($driver === null) { - $driver = $GLOBALS['conf']['news']['storage']['driver']; - } - $driver = basename($driver); - - if ($params === null) { - $params = Horde::getDriverConfig(array('news', 'storage'), $driver); - } - - $class = 'Jonah_Driver_' . $driver; - if (!class_exists($class, false)) { - include dirname(__FILE__) . '/Driver/' . $driver . '.php'; - } - if (class_exists($class)) { - return new $class($params); - } else { - return PEAR::raiseError(sprintf(_("No such backend \"%s\" found"), $driver)); - } - } - - /** * Stubs for the tag functions. If supported by the backend, these need * to be implemented in the concrete Jonah_Driver_* class. */ diff --git a/jonah/lib/Jonah.php b/jonah/lib/Jonah.php index 3610fcc9c..db56770ea 100644 --- a/jonah/lib/Jonah.php +++ b/jonah/lib/Jonah.php @@ -249,11 +249,11 @@ class Jonah } } if ($channel_id = Horde_Util::getFormData('channel_id')) { - $news = Jonah_News::factory(); + $news = $GLOBALS['injector']->getInstance('Jonah_Driver'); $channel = $news->getChannel($channel_id); if ($channel['channel_type'] == Jonah::INTERNAL_CHANNEL && Jonah::checkPermissions(Jonah::typeToPermName($channel['channel_type']), Horde_Perms::EDIT, $channel_id)) { - $menu->addArray(array('url' => Horde::applicationUrl('stories/edit.php?channel_id=' . (int)$channel_id), 'text' => _("_New Story"), 'icon' => 'new.png')); + $menu->addArray(array('url' => Horde::applicationUrl('stories/edit.php')->add('channel_id', (int)$channel_id), 'text' => _("_New Story"), 'icon' => 'new.png')); } }