From ccbd0323ad66961a7059c71680b74d2724316db2 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Thu, 29 Jul 2010 15:27:30 -0600 Subject: [PATCH] Exclusively use Horde_Url in horde/Core --- framework/Core/lib/Horde/Core/Auth/Signup/Base.php | 4 +-- .../Core/lib/Horde/Core/Ui/VarRenderer/Html.php | 42 ++++++++++++---------- framework/Core/lib/Horde/Menu.php | 2 +- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/framework/Core/lib/Horde/Core/Auth/Signup/Base.php b/framework/Core/lib/Horde/Core/Auth/Signup/Base.php index 7d6f7de61..73aeb2400 100644 --- a/framework/Core/lib/Horde/Core/Auth/Signup/Base.php +++ b/framework/Core/lib/Horde/Core/Auth/Signup/Base.php @@ -81,9 +81,9 @@ abstract class Horde_Core_Auth_Signup_Base $message = sprintf(_("A new account for the user \"%s\" has been requested through the signup form."), $signup->name) . "\n\n" . _("Approve the account:") - . "\n" . Horde_Util::addParameter($link, 'a', 'approve') . "\n" + . "\n" . $link->copy()->add('a', 'approve') . "\n" . _("Deny the account:") - . "\n" . Horde_Util::addParameter($link, 'a', 'deny'); + . "\n" . $link->copy()->add('a', 'deny'); $mail = new Horde_Mime_Mail(array( 'subject' => sprintf(_("Account signup request for \"%s\""), $signup->name), 'body' => $message, diff --git a/framework/Core/lib/Horde/Core/Ui/VarRenderer/Html.php b/framework/Core/lib/Horde/Core/Ui/VarRenderer/Html.php index 0ef8c30ec..2c36973e7 100644 --- a/framework/Core/lib/Horde/Core/Ui/VarRenderer/Html.php +++ b/framework/Core/lib/Horde/Core/Ui/VarRenderer/Html.php @@ -209,39 +209,41 @@ class Horde_Core_Ui_VarRenderer_Html extends Horde_Core_Ui_VarRenderer $img = Horde::url($GLOBALS['registry']->get('webroot', 'horde') . '/services/images/view.php'); if (isset($image['img']['vfs_id'])) { /* Calling an image from VFS. */ - $img = Horde_Util::addParameter($img, array('f' => $image['img']['vfs_id'], - 's' => 'vfs', - 'p' => $image['img']['vfs_path'])); + $img->add(array( + 'f' => $image['img']['vfs_id'], + 'p' => $image['img']['vfs_path'], + 's' => 'vfs' + )); } else { /* Calling an image from a tmp directory (uploads). */ - $img = Horde_Util::addParameter($img, 'f', $image['img']['file']); + $img->add('f', $image['img']['file']); } /* Reset. */ $html .= Horde::link('#', _("Reset"), '', '', 'showImage(\'' . $img . '\', \'_p_' . $varname . '\', true);') . Horde::img('image/refresh.png', _("Reset")) . ''; /* Rotate 270. */ - $html .= Horde::link('#', _("Rotate Left"), '', '', 'showImage(\'' . Horde_Util::addParameter($img, array('a' => 'rotate', 'v' => '270')) . '\', \'_p_' . $varname . '\', true);') . Horde::img('image/rotate-270.png', _("Rotate Left")) . ''; + $html .= Horde::link('#', _("Rotate Left"), '', '', 'showImage(\'' . $img->copy()->add(array('a' => 'rotate', 'v' => '270')) . '\', \'_p_' . $varname . '\', true);') . Horde::img('image/rotate-270.png', _("Rotate Left")) . ''; /* Rotate 180. */ - $html .= Horde::link('#', _("Rotate 180"), '', '', 'showImage(\'' . Horde_Util::addParameter($img, array('a' => 'rotate', 'v' => '180')) . '\', \'_p_' . $varname . '\', true);') . Horde::img('image/rotate-180.png', _("Rotate 180")) . ''; + $html .= Horde::link('#', _("Rotate 180"), '', '', 'showImage(\'' . $img->copy()->add(array('a' => 'rotate', 'v' => '180')) . '\', \'_p_' . $varname . '\', true);') . Horde::img('image/rotate-180.png', _("Rotate 180")) . ''; /* Rotate 90. */ - $html .= Horde::link('#', _("Rotate Right"), '', '', 'showImage(\'' . Horde_Util::addParameter($img, array('a' => 'rotate', 'v' => '90')) . '\', \'_p_' . $varname . '\', true);') . Horde::img('image/rotate-90.png', _("Rotate Right")) . ''; + $html .= Horde::link('#', _("Rotate Right"), '', '', 'showImage(\'' . $img->copy()->add(array('a' => 'rotate', 'v' => '90')) . '\', \'_p_' . $varname . '\', true);') . Horde::img('image/rotate-90.png', _("Rotate Right")) . ''; /* Flip image. */ - $html .= Horde::link('#', _("Flip"), '', '', 'showImage(\'' . Horde_Util::addParameter($img, 'a', 'flip') . '\', \'_p_' . $varname . '\', true);') . Horde::img('image/flip.png', _("Flip")) . ''; + $html .= Horde::link('#', _("Flip"), '', '', 'showImage(\'' . $img->copy()->add('a', 'flip') . '\', \'_p_' . $varname . '\', true);') . Horde::img('image/flip.png', _("Flip")) . ''; /* Mirror image. */ - $html .= Horde::link('#', _("Mirror"), '', '', 'showImage(\'' . Horde_Util::addParameter($img, 'a', 'mirror') . '\', \'_p_' . $varname . '\', true);') . Horde::img('image/mirror.png', _("Mirror")) . ''; + $html .= Horde::link('#', _("Mirror"), '', '', 'showImage(\'' . $img->copy()->add('a', 'mirror') . '\', \'_p_' . $varname . '\', true);') . Horde::img('image/mirror.png', _("Mirror")) . ''; /* Apply grayscale. */ - $html .= Horde::link('#', _("Grayscale"), '', '', 'showImage(\'' . Horde_Util::addParameter($img, 'a', 'grayscale') . '\', \'_p_' . $varname . '\', true);') . Horde::img('image/grayscale.png', _("Grayscale")) . ''; + $html .= Horde::link('#', _("Grayscale"), '', '', 'showImage(\'' . $img->copy()->add('a', 'grayscale') . '\', \'_p_' . $varname . '\', true);') . Horde::img('image/grayscale.png', _("Grayscale")) . ''; /* Resize width. */ $html .= sprintf('%s', _("w:"), - Horde_Util::addParameter($img, 'a', 'resize'), + $img->copy()->add('a', 'resize'), $varname, $varname, $this->_genID('_w_' . $varname)); @@ -249,13 +251,13 @@ class Horde_Core_Ui_VarRenderer_Html extends Horde_Core_Ui_VarRenderer /* Resize height. */ $html .= sprintf('%s', _("h:"), - Horde_Util::addParameter($img, 'a', 'resize'), + $img->copy()->add('a', 'resize'), $varname, $varname, $this->_genID('_h_' . $varname)); /* Apply fixed ratio resize. */ - $html .= Horde::link('#', _("Fix ratio"), '', '', 'src=getResizeSrc(\'' . Horde_Util::addParameter($img, 'a', 'resize') . '\', \'' . $varname . '\', \'1\');showImage(src, \'_p_' . $varname . '\', true);') . Horde::img('ratio.png', _("Fix ratio"), '', $img_dir) . ''; + $html .= Horde::link('#', _("Fix ratio"), '', '', 'src=getResizeSrc(\'' . $img->copy()->add('a', 'resize') . '\', \'' . $varname . '\', \'1\');showImage(src, \'_p_' . $varname . '\', true);') . Horde::img('ratio.png', _("Fix ratio"), '', $img_dir) . ''; /* Keep also original if it has been requested. */ if ($var->type->getProperty('show_keeporig')) { @@ -1140,14 +1142,17 @@ EOT; } $img = Horde::url($GLOBALS['registry']->get('webroot', 'horde') . '/services/images/view.php'); + if (isset($image['img']['vfs_id'])) { /* Calling an image from VFS. */ - $img = Horde_Util::addParameter($img, array('f' => $image['img']['vfs_id'], - 's' => 'vfs', - 'p' => $image['img']['vfs_path'])); + $img->add(array( + 'f' => $image['img']['vfs_id'], + 'p' => $image['img']['vfs_path'], + 's' => 'vfs' + )); } else { /* Calling an image from a tmp directory (uploads). */ - $img = (string)Horde_Util::addParameter($img, 'f', $image['img']['file']); + $img->add('f', $image['img']['file']); } return Horde::img($img, '', '', ''); @@ -1460,8 +1465,7 @@ EOT; $cache->set($cid, serialize(array('data' => $captcha->getCAPTCHAAsJPEG(), 'ctype' => 'image/jpeg'))); - $url = Horde::url($GLOBALS['registry']->get('webroot', 'horde') . '/services/cacheview.php'); - $url = Horde_Util::addParameter($url, 'cid', $cid, false); + $url = Horde::url($GLOBALS['registry']->get('webroot', 'horde') . '/services/cacheview.php')->add('cid', $cid); return ''; diff --git a/framework/Core/lib/Horde/Menu.php b/framework/Core/lib/Horde/Menu.php index 11821003f..60e02e1f4 100644 --- a/framework/Core/lib/Horde/Menu.php +++ b/framework/Core/lib/Horde/Menu.php @@ -199,7 +199,7 @@ class Horde_Menu } else { if ($this->showService('login') && ($login_link = Horde::getServiceLink('login', $app))) { - $this->add(Horde_Util::addParameter($login_link, array('url' => Horde::selfUrl(true, true, true))), _("_Log in"), 'login.png', null, $auth_target, null, '__noselection'); + $this->add($login_link->add('url', Horde::selfUrl(true, true, true)), _("_Log in"), 'login.png', null, $auth_target, null, '__noselection'); } } } -- 2.11.0