From 97367a19014e37146ea2e8644f3487c173d054fd Mon Sep 17 00:00:00 2001 From: maximebf Date: Tue, 4 Mar 2014 18:48:27 -0300 Subject: [PATCH] updated htaccess in docs (fixed #27) added shortcuts methods for some types of inputs in form helper (fixed #22) --- docs/urls.md | 8 ++++++-- src/helpers/form.php | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/docs/urls.md b/docs/urls.md index c85f63d..26b579c 100644 --- a/docs/urls.md +++ b/docs/urls.md @@ -27,9 +27,13 @@ For cleaner and prettier url you can use url rewriting. When using Apache, simpl code below into a *.htaccess* file in the same directory as Atomik's core file. RewriteEngine on + # Allow access to assets folder RewriteRule ^app/plugins/(.+)/assets - [L] - RewriteRule ^app/ - [L,F] - RewriteRule ^vendor/ - [L,F] + RewriteRule ^vendor/maximebf/debugbar/src/DebugBar/Resources - [L] + # forbid access to files and folders under app and vendor + RewriteRule ^app/.*$ - [L,F] + RewriteRule ^vendor/.*$ - [L,F] + # rewrite to index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?action=$1 [L,QSA] diff --git a/src/helpers/form.php b/src/helpers/form.php index a8d5547..4bed6f9 100644 --- a/src/helpers/form.php +++ b/src/helpers/form.php @@ -72,6 +72,41 @@ public function input($name, $value = '', $type = 'text', $attrs = array()) return sprintf('', Atomik::htmlAttributes($attrs)); } + + public function password($name, $attrs = array()) + { + return $this->input($name, '', 'password', $attrs); + } + + public function email($name, $value = '', $attrs = array()) + { + return $this->input($name, $value, 'email', $attrs); + } + + public function date($name, $value = '', $attrs = array()) + { + return $this->input($name, $value, 'date', $attrs); + } + + public function time($name, $value = '', $attrs = array()) + { + return $this->input($name, $value, 'time', $attrs); + } + + public function number($name, $value = '', $attrs = array()) + { + return $this->input($name, $value, 'number', $attrs); + } + + public function url($name, $value = '', $attrs = array()) + { + return $this->input($name, $value, 'url', $attrs); + } + + public function datetime($name, $value = '', $attrs = array()) + { + return $this->input($name, $value, 'datetime', $attrs); + } public function checkbox($name, $checked = false, $value = 1, $attrs = array()) {