summaryrefslogtreecommitdiff
path: root/kohana/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'kohana/helpers')
-rw-r--r--kohana/helpers/feed.php4
-rw-r--r--kohana/helpers/html.php16
-rw-r--r--kohana/helpers/valid.php2
3 files changed, 19 insertions, 3 deletions
diff --git a/kohana/helpers/feed.php b/kohana/helpers/feed.php
index 53b1fd15..c1e0b81f 100644
--- a/kohana/helpers/feed.php
+++ b/kohana/helpers/feed.php
@@ -20,6 +20,10 @@ class feed_Core {
*/
public static function parse($feed, $limit = 0)
{
+ // Check if SimpleXML is installed
+ if( ! function_exists('simplexml_load_file'))
+ throw new Kohana_User_Exception('Feed Error', 'SimpleXML must be installed!');
+
// Make limit an integer
$limit = (int) $limit;
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
diff --git a/kohana/helpers/valid.php b/kohana/helpers/valid.php
index 916a0c19..88cca584 100644
--- a/kohana/helpers/valid.php
+++ b/kohana/helpers/valid.php
@@ -277,7 +277,7 @@ class valid_Core {
{
// Use localeconv to set the decimal_point value: Usually a comma or period.
$locale = localeconv();
- return (preg_match('/^[-0-9'.$locale['decimal_point'].']++$/D', (string) $str));
+ return (preg_match('/^-?[0-9'.$locale['decimal_point'].']++$/D', (string) $str));
}
/**