summaryrefslogtreecommitdiff
path: root/system/helpers
diff options
context:
space:
mode:
authorroot <root@sleepydogs.net>2009-09-13 09:01:55 -0700
committerroot <root@sleepydogs.net>2009-09-13 09:01:55 -0700
commitc62d1f440f077ba806b7ff0c6b90ef89c79b2fd3 (patch)
treeb64f05e2a7bd8db7200e3c407904e255826b4cf2 /system/helpers
parentb96ac1eb81b7ccd5bd050ffab0ca9ce1feec8f4f (diff)
parentcaa2002d7777e0ceb884d4c628650804620ca2b6 (diff)
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'system/helpers')
-rw-r--r--system/helpers/form.php19
-rw-r--r--system/helpers/url.php9
2 files changed, 19 insertions, 9 deletions
diff --git a/system/helpers/form.php b/system/helpers/form.php
index ce8767c5..815eef84 100644
--- a/system/helpers/form.php
+++ b/system/helpers/form.php
@@ -283,15 +283,21 @@ class form_Core {
// Inner key should always be a string
$inner_key = (string) $inner_key;
- $sel = in_array($inner_key, $selected) ? ' selected="selected"' : '';
- $input .= '<option value="'.$inner_key.'"'.$sel.'>'.$inner_val.'</option>'."\n";
+ $attr = array('value' => $inner_key);
+ if (in_array($inner_key, $selected)) {
+ $attr['selected'] = 'selected';
+ }
+ $input .= '<option '.html::attributes($attr).'>'.html::purify($inner_val).'</option>'."\n";
}
$input .= '</optgroup>'."\n";
}
else
{
- $sel = in_array($key, $selected) ? ' selected="selected"' : '';
- $input .= '<option value="'.$key.'"'.$sel.'>'.$val.'</option>'."\n";
+ $attr = array('value' => $key);
+ if (in_array($key, $selected)) {
+ $attr['selected'] = 'selected';
+ }
+ $input .= '<option '.html::attributes($attr).'>'.html::purify($val).'</option>'."\n";
}
}
$input .= '</select>';
@@ -410,8 +416,9 @@ class form_Core {
{
$value = arr::remove('value', $data);
}
+ // $value must be ::purify
- return '<button'.form::attributes($data, 'button').' '.$extra.'>'.$value.'</button>';
+ return '<button'.form::attributes($data, 'button').' '.$extra.'>'.html::purify($value).'</button>';
}
/**
@@ -455,7 +462,7 @@ class form_Core {
$text = ucwords(inflector::humanize($data['for']));
}
- return '<label'.form::attributes($data).' '.$extra.'>'.$text.'</label>';
+ return '<label'.form::attributes($data).' '.$extra.'>'.html::purify($text).'</label>';
}
/**
diff --git a/system/helpers/url.php b/system/helpers/url.php
index f3d0ec8b..56f6db4b 100644
--- a/system/helpers/url.php
+++ b/system/helpers/url.php
@@ -2,7 +2,7 @@
/**
* URL helper class.
*
- * $Id: url.php 4029 2009-03-03 12:39:32Z Shadowhand $
+ * $Id: url.php 4479 2009-07-23 04:51:22Z ixmatus $
*
* @package Core
* @author Kohana Team
@@ -15,11 +15,14 @@ class url_Core {
* Fetches the current URI.
*
* @param boolean include the query string
+ * @param boolean include the suffix
* @return string
*/
- public static function current($qs = FALSE)
+ public static function current($qs = FALSE, $suffix = FALSE)
{
- return ($qs === TRUE) ? Router::$complete_uri : Router::$current_uri;
+ $uri = ($qs === TRUE) ? Router::$complete_uri : Router::$current_uri;
+
+ return ($suffix === TRUE) ? $uri.Kohana::config('core.url_suffix') : $uri;
}
/**