summaryrefslogtreecommitdiffstats
path: root/system/helpers/form_helper.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/helpers/form_helper.php')
-rw-r--r--system/helpers/form_helper.php45
1 files changed, 25 insertions, 20 deletions
diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php
index 758056b50..a6dfdb2ba 100644
--- a/system/helpers/form_helper.php
+++ b/system/helpers/form_helper.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
@@ -49,7 +49,14 @@ if ( ! function_exists('form_open'))
$attributes = 'method="post"';
}
- $action = ( strpos($action, '://') === FALSE) ? $CI->config->site_url($action) : $action;
+ // If an action is not a full URL then turn it into one
+ if ($action && strpos($action, '://') === FALSE)
+ {
+ $action = $CI->config->site_url($action);
+ }
+
+ // If no action is provided then set to the current url
+ $action OR $action = $CI->config->site_url($CI->uri->uri_string());
$form = '<form action="'.$action.'"';
@@ -60,12 +67,12 @@ if ( ! function_exists('form_open'))
// CSRF
if ($CI->config->item('csrf_protection') === TRUE)
{
- $hidden[$CI->security->csrf_token_name] = $CI->security->csrf_hash;
+ $hidden[$CI->security->get_csrf_token_name()] = $CI->security->get_csrf_hash();
}
if (is_array($hidden) AND count($hidden) > 0)
{
- $form .= sprintf("\n<div class=\"hidden\">%s</div>", form_hidden($hidden));
+ $form .= sprintf("<div style=\"display:none\">%s</div>", form_hidden($hidden));
}
return $form;
@@ -107,7 +114,7 @@ if ( ! function_exists('form_open_multipart'))
/**
* Hidden Input Field
*
- * Generates hidden fields. You can pass a simple key/value string or an associative
+ * Generates hidden fields. You can pass a simple key/value string or an associative
* array with multiple values.
*
* @access public
@@ -533,7 +540,7 @@ if ( ! function_exists('form_label'))
/**
* Fieldset Tag
*
- * Used to produce <fieldset><legend>text</legend>. To close fieldset
+ * Used to produce <fieldset><legend>text</legend>. To close fieldset
* use form_fieldset_close()
*
* @access public
@@ -656,7 +663,7 @@ if ( ! function_exists('form_prep'))
* Form Value
*
* Grabs a value from the POST array for the specified field so you can
- * re-populate an input field or textarea. If Form Validation
+ * re-populate an input field or textarea. If Form Validation
* is active it retrieves the info from the validation class
*
* @access public
@@ -851,7 +858,7 @@ if ( ! function_exists('set_radio'))
/**
* Form Error
*
- * Returns the error for a specific form field. This is a helper for the
+ * Returns the error for a specific form field. This is a helper for the
* form validation class.
*
* @access public
@@ -878,7 +885,7 @@ if ( ! function_exists('form_error'))
/**
* Validation Error String
*
- * Returns all the errors associated with a form submission. This is a helper
+ * Returns all the errors associated with a form submission. This is a helper
* function for the form validation class.
*
* @access public
@@ -1025,25 +1032,23 @@ if ( ! function_exists('_get_validation_object'))
{
$CI =& get_instance();
- // We set this as a variable since we're returning by reference
+ // We set this as a variable since we're returning by reference.
$return = FALSE;
- if ( ! isset($CI->load->_ci_classes) OR ! isset($CI->load->_ci_classes['form_validation']))
+ if (FALSE !== ($object = $CI->load->is_loaded('form_validation')))
{
- return $return;
- }
-
- $object = $CI->load->_ci_classes['form_validation'];
+ if ( ! isset($CI->$object) OR ! is_object($CI->$object))
+ {
+ return $return;
+ }
- if ( ! isset($CI->$object) OR ! is_object($CI->$object))
- {
- return $return;
+ return $CI->$object;
}
- return $CI->$object;
+ return $return;
}
}
/* End of file form_helper.php */
-/* Location: ./system/helpers/form_helper.php */ \ No newline at end of file
+/* Location: ./system/helpers/form_helper.php */