diff options
author | Nala Ginrut <nalaginrut@gmail.com> | 2014-06-19 15:18:13 +0800 |
---|---|---|
committer | Nala Ginrut <nalaginrut@gmail.com> | 2014-06-19 15:18:13 +0800 |
commit | bfd1db41367f7931016931a94cf1b67396481c79 (patch) | |
tree | 2d696f2d8eca9ed2e4561c61c16584952d9f7b0b /app/helpers.php | |
parent | d0944e682d5a3491f72c5b566248b87fbaff032a (diff) | |
parent | efdc959c555872677e599d2ff12e1263d719f3f2 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'app/helpers.php')
-rw-r--r-- | app/helpers.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/app/helpers.php b/app/helpers.php index 8351328a..2df4d839 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -2,6 +2,21 @@ namespace Helper; +function param_csrf() +{ + return '&csrf_token='.\Core\Security::getCSRFToken(); +} + +function js($filename) +{ + return '<script type="text/javascript" src="'.$filename.'?'.filemtime($filename).'"></script>'; +} + +function css($filename) +{ + return '<link rel="stylesheet" href="'.$filename.'?'.filemtime($filename).'" media="screen">'; +} + function template($name, array $args = array()) { $tpl = new \Core\Template; @@ -153,6 +168,11 @@ function form_value($values, $name) return isset($values[$name]) ? 'value="'.escape($values[$name]).'"' : ''; } +function form_csrf() +{ + return '<input type="hidden" name="csrf_token" value="'.\Core\Security::getCSRFToken().'"/>'; +} + function form_hidden($name, $values = array()) { return '<input type="hidden" name="'.$name.'" id="form-'.$name.'" '.form_value($values, $name).'/>'; @@ -260,3 +280,8 @@ function form_number($name, $values = array(), array $errors = array(), array $a { return form_input('number', $name, $values, $errors, $attributes, $class); } + +function form_numeric($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '') +{ + return form_input('text', $name, $values, $errors, $attributes, $class.' form-numeric'); +} |