@@ -70,13 +70,6 @@ class Horde_Url
7070 */
7171 public $ url ;
7272
73- /**
74- * Cached parameter list for use in toString().
75- *
76- * @var array
77- */
78- protected $ _cache ;
79-
8073 /**
8174 * Constructor.
8275 *
@@ -168,8 +161,6 @@ public function add($parameters, $value = null)
168161 }
169162 }
170163
171- unset($ this ->_cache );
172-
173164 return $ this ;
174165 }
175166
@@ -191,8 +182,6 @@ public function remove($parameters)
191182 unset($ this ->parameters [$ parameter ]);
192183 }
193184
194- unset($ this ->_cache );
195-
196185 return $ this ;
197186 }
198187
@@ -275,8 +264,8 @@ public function toString($raw = false, $full = true)
275264 }
276265 }
277266
278- if ($ params = $ this ->_getParameters () ) {
279- $ url .= '? ' . implode ( $ raw ? '& ' : '& ' , $ params );
267+ if ($ params = $ this ->parameters ) {
268+ $ url .= '? ' . http_build_query ( $ params , "" , $ raw ? '& ' : '& ' );
280269 }
281270
282271 if ($ this ->anchor ) {
@@ -286,33 +275,6 @@ public function toString($raw = false, $full = true)
286275 return strval ($ url );
287276 }
288277
289- /**
290- * Return a formatted list of URL parameters.
291- *
292- * @return array Parameter list.
293- */
294- protected function _getParameters ()
295- {
296- if (!isset ($ this ->_cache )) {
297- $ params = array ();
298-
299- foreach ($ this ->parameters as $ p => $ v ) {
300- if (is_array ($ v )) {
301- foreach ($ v as $ val ) {
302- $ params [] = rawurlencode ($ p ) . '[]= ' . rawurlencode ($ val );
303- }
304- } else {
305- $ params [] = rawurlencode ($ p ) .
306- (strlen ($ v ) ? ('= ' . rawurlencode ($ v )) : '' );
307- }
308- }
309-
310- $ this ->_cache = $ params ;
311- }
312-
313- return $ this ->_cache ;
314- }
315-
316278 /**
317279 * Creates the full URL string.
318280 *
0 commit comments