summaryrefslogtreecommitdiff
path: root/kohana/helpers/html.php
diff options
context:
space:
mode:
Diffstat (limited to 'kohana/helpers/html.php')
-rw-r--r--kohana/helpers/html.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/kohana/helpers/html.php b/kohana/helpers/html.php
index daf16a04..375baf38 100644
--- a/kohana/helpers/html.php
+++ b/kohana/helpers/html.php
@@ -50,6 +50,18 @@ class html_Core {
}
/**
+ * Perform a html::specialchars() with additional URL specific encoding.
+ *
+ * @param string string to convert
+ * @param boolean encode existing entities
+ * @return string
+ */
+ public static function specialurlencode($str, $double_encode = TRUE)
+ {
+ return str_replace(' ', '%20', html::specialchars($str, $double_encode));
+ }
+
+ /**
* Create HTML link anchors.
*
* @param string URL or URI string
@@ -80,7 +92,7 @@ class html_Core {
return
// Parsed URL
- '<a href="'.html::specialchars($site_url, FALSE).'"'
+ '<a href="'.html::specialurlencode($site_url, FALSE).'"'
// Attributes empty? Use an empty string
.(is_array($attributes) ? html::attributes($attributes) : '').'>'
// Title empty? Use the parsed URL
@@ -100,7 +112,7 @@ class html_Core {
{
return
// Base URL + URI = full URL
- '<a href="'.html::specialchars(url::base(FALSE, $protocol).$file, FALSE).'"'
+ '<a href="'.html::specialurlencode(url::base(FALSE, $protocol).$file, FALSE).'"'
// Attributes empty? Use an empty string
.(is_array($attributes) ? html::attributes($attributes) : '').'>'
// Title empty? Use the filename part of the URI