From f3a6204bb0f4538d6a77d9c85c56545be73ecd64 Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 29 Oct 2006 20:24:11 +0000 Subject: --- system/helpers/url_helper.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index cd628c6ae..9010a06a3 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -110,10 +110,7 @@ function anchor($uri = '', $title = '', $attributes = '') } else { - if (is_array($attributes)) - { - $attributes = parse_url_attributes($attributes); - } + $attributes = _parse_attributes($attributes); } return ''.$title.''; @@ -157,7 +154,7 @@ function anchor_popup($uri = '', $title = '', $attributes = FALSE) $atts[$key] = ( ! isset($attributes[$key])) ? $val : $attributes[$key]; } - return "".$title.""; + return "".$title.""; } // ------------------------------------------------------------------------ @@ -178,10 +175,7 @@ function mailto($email, $title = '', $attributes = '') $title = $email; } - if (is_array($attributes)) - { - $attributes = parse_url_attributes($attributes); - } + $attributes = _parse_attributes($attributes); return ''.$title.''; } @@ -468,8 +462,13 @@ function redirect($uri = '', $method = 'location') * @param bool * @return string */ -function parse_url_attributes($attributes, $javascript = FALSE) +function _parse_attributes($attributes, $javascript = FALSE) { + if (is_string($attributes)) + { + return ($attributes != '') ? ' '.$attributes : ''; + } + $att = ''; foreach ($attributes as $key => $val) { @@ -483,7 +482,7 @@ function parse_url_attributes($attributes, $javascript = FALSE) } } - if ($javascript == TRUE) + if ($javascript == TRUE AND $att != '') { $att = substr($att, 0, -1); } -- cgit v1.2.3-24-g4f1b