本文整理汇总了PHP中CI_Form_validation类的典型用法代码示例。如果您正苦于以下问题:PHP CI_Form_validation类的具体用法?PHP CI_Form_validation怎么用?PHP CI_Form_validation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CI_Form_validation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($rules = array())
{
log_message('debug', '*** Hello from MY_Session ***');
$this->CI =& get_instance();
$this->CI->load->library("cimongo/cimongo");
parent::__construct($rules);
}
示例2: error
function error($field = '', $prefix = '', $suffix = '')
{
if (!empty($this->_field_data[$field]) && $this->_field_data[$field]['is_array']) {
return ($prefix ? $prefix : $this->_error_prefix) . array_shift($this->_field_data[$field]['error']) . ($suffix ? $suffix : $this->_error_suffix);
}
return parent::error($field, $prefix, $suffix);
}
示例3: matches
/**
* Better version of standard matches method, this one will check if field is array and find appropriate value of this field.
* @param string $str current value of form field.
* @param string $field form field name, can be array.
* @return boolean validation result.
*/
public function matches($str, $field)
{
if (strpos($field, '[') !== FALSE) {
$path = explode('[', str_replace(']', '', $field));
$fld = isset($_POST[$path[0]]) ? $_POST[$path[0]] : FALSE;
if ($fld === FALSE) {
return FALSE;
}
if (count($path) > 1) {
for ($i = 1; $i < count($path); $i++) {
$segment = $path[$i];
if (!isset($fld[$segment])) {
return FALSE;
}
$fld = $fld[$segment];
}
}
if ($str == $fld) {
return TRUE;
}
return FALSE;
} else {
return parent::matches($str, $field);
}
}
示例4: __construct
public function __construct()
{
parent::__construct();
$this->_error_prefix = '<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>';
$this->_error_suffix = '</div>';
}
示例5: array
function __construct($rules = array())
{
$this->CI =& get_instance();
// $this->CI->load->library("cimongo/cimongo");
parent::__construct($rules);
$this->CI->load->language('form_validation');
}
示例6: isset
/**
* ----------------------------------------------------------
* Set Value: Get the value from a form
* Extends method to return posted data for fields with no rules
* ----------------------------------------------------------
*
* @param string $field
* @param string $default
* @return string
*/
function set_value($field = '', $default = '')
{
// no post?
if (count($_POST) == 0) {
return $default;
}
// no rules for this field?
if (!isset($this->_field_data[$field])) {
$this->set_rules($field, '', '');
// fieldname is an array
if ($this->_field_data[$field]['is_array']) {
$keys = $this->_field_data[$field]['keys'];
$value = $this->_traverse_array($_POST, $keys);
} else {
$value = isset($_POST[$field]) ? $_POST[$field] : FALSE;
}
// field was not in the post
if ($value === FALSE) {
return $default;
} else {
$this->_field_data[$field]['postdata'] = form_prep($value, $field);
}
}
return parent::set_value($field, $default);
}
示例7: __construct
public function __construct($rules = array())
{
parent::__construct($rules);
$this->CI = &get_instance();
log_message('debug','BackendPro : MY_Form_validation class loaded');
}
示例8: array
function __construct($config = array())
{
parent::__construct($config);
parent::set_message('numeric_positive', 'The {field} field must contain a decimal greater or equal than 0.');
parent::set_message('image_base64', 'The {field} field must be a image in base64 format.');
parent::set_message('valid_base64', 'The {field} field must be base64 data.');
}
示例9: run
function run($group = '')
{
$return = parent::run($group);
if ($return === FALSE) {
$this->set_js_code();
}
return $return;
}
示例10: __construct
/**
* Crea y retorna el marco html para mostrar las validaciones
* Esta funcion permite hacer referencia a cualquier recurso CodeIgniter
* cargado o cargar otras nuevas sin inicializar las clases cada vez.
* @return void
*/
public function __construct($rules = array())
{
parent::__construct($rules);
$this->CI =& get_instance();
// Permite acceder a los recursos nativos de codeigniter.
$this->_error_prefix = '<div class="alert alert-danger">' . '<button type="button" class="close" data-dismiss="alert">×</button>';
$this->_error_suffix = '</div>';
}
示例11: array
/**
* Constructor
*
* @access public
*/
function __construct($rules = array())
{
parent::__construct($rules);
if ($this->CI->input->get('C') == 'addons_modules' && $this->CI->input->get('M') == 'show_module_cp' && isset($this->CI->_mcp_reference)) {
$this->CI->_mcp_reference->lang =& $this->CI->lang;
$this->CI =& $this->CI->_mcp_reference;
}
}
示例12:
function CI_TNotification($pstr_prefix = "<li>", $pstr_suffix = "</li>")
{
// smarty constructor
parent::__construct();
// set default delimiter
$this->prefix = $pstr_prefix;
$this->suffix = $pstr_suffix;
}
示例13: set_rules
/**
*@desc Allow set a custom validation error message
*
*/
public function set_rules($field, $label = '', $rules = '', $message = '')
{
$rules = parent::set_rules($field, $label, $rules);
if (!empty($message)) {
$this->_custom_field_errors[$field] = $message;
}
return $rules;
}
示例14: set_rules
public function set_rules($input_name, $input_name_display, $rule = NULL)
{
if ($rule == NULL) {
$rule = $input_name_display;
parent::set_rules($input_name, $input_name, $rule);
} else {
parent::set_rules($input_name, $input_name_display, $rule);
}
}
示例15: money
public function money($str)
{
//First check if decimal
if (!parent::decimal($str)) {
//Now check if integer
return (bool) parent::integer($str);
}
return TRUE;
}