@@ -517,28 +517,28 @@ protected function _writeUrl($params) {
517
517
}
518
518
$ out = $ this ->template ;
519
519
520
- $ search = $ replace = array ();
520
+ if (!empty ($ this ->keys )) {
521
+
522
+ $ search = $ replace = array ();
521
523
522
- if (empty ($ this ->keys )) {
523
- $ keys = array ();
524
- } else {
525
524
$ lengths = array_map ('strlen ' , $ this ->keys );
526
525
$ flipped = array_combine ($ this ->keys , $ lengths );
527
526
arsort ($ flipped );
528
527
$ keys = array_keys ($ flipped );
529
- }
530
528
531
- foreach ($ keys as $ key ) {
532
- $ string = null ;
533
- if (isset ($ params [$ key ])) {
534
- $ string = $ params [$ key ];
535
- } elseif (strpos ($ out , $ key ) != strlen ($ out ) - strlen ($ key )) {
536
- $ key .= '/ ' ;
529
+ foreach ($ keys as $ key ) {
530
+ $ string = null ;
531
+ if (isset ($ params [$ key ])) {
532
+ $ string = $ params [$ key ];
533
+ } elseif (strpos ($ out , $ key ) != strlen ($ out ) - strlen ($ key )) {
534
+ $ key .= '/ ' ;
535
+ }
536
+ $ search [] = ': ' . $ key ;
537
+ $ replace [] = $ string ;
537
538
}
538
- $ search [] = ' : ' . $ key ;
539
- $ replace [] = $ string ;
539
+ $ out = str_replace ( $ search , $ replace , $ out ) ;
540
+
540
541
}
541
- $ out = str_replace ($ search , $ replace , $ out );
542
542
543
543
if (strpos ($ this ->template , '* ' )) {
544
544
$ out = str_replace ('* ' , $ params ['pass ' ], $ out );
0 commit comments