本文整理汇总了PHP中CI_Form_validation::run方法的典型用法代码示例。如果您正苦于以下问题:PHP CI_Form_validation::run方法的具体用法?PHP CI_Form_validation::run怎么用?PHP CI_Form_validation::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CI_Form_validation
的用法示例。
在下文中一共展示了CI_Form_validation::run方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run($group = '') {
$this->set_rules('nonce', 'Nonce', 'required|valid_nonce');
$result = parent::run($group);
if($result === true) {
$this->save_nonce();
}
return $result;
}
示例2: run
function run($group = '')
{
$return = parent::run($group);
if ($return === FALSE) {
$this->set_js_code();
}
return $return;
}
示例3: run
public function run($group = '')
{
// Is there a validation rule for the particular URI being accessed?
$uri = $group == '' ? trim($this->CI->uri->ruri_string(), '/') : $group;
if ($uri != '' and !isset($this->_config_rules[$uri])) {
$this->load_rules_from_database($uri);
}
return parent::run($group);
}
示例4: run
/**
* Run
*
* Validates the CSRF token then runs normal validation.
*
* @param string The validation group name
* @param bool If CSRF tokens should be used
* @return bool
*/
public function run($group = '', $csrf_enabled = TRUE)
{
log_message('debug', 'My_Form_validation::run() called');
// Do we even have any data to process? Mm?
if (count($_POST) == 0) {
return FALSE;
}
if ($csrf_enabled) {
$this->_validate_token();
}
return parent::run($group);
}
示例5: run
function run($group = '')
{
$rc = FALSE;
log_message('DEBUG', 'called MY_form_validation:run()');
if (count($_POST) === 0 and count($_FILES) > 0) {
//add a dummy $_POST
$_POST['DUMMY_ITEM'] = '';
$rc = parent::run($group);
unset($_POST['DUMMY_ITEM']);
} else {
//we are safe just run as is
$rc = parent::run($group);
}
return $rc;
}
示例6: run
public function run($module = '', $group = '')
{
is_object($module) and $this->CI =& $module;
return parent::run($group);
}
示例7: test_run
public function test_run()
{
// form_validation->run() is tested in many of the other unit tests
// This test will only test run(group='') when group is not empty
$config = array('pass' => array(array('field' => 'username', 'label' => 'user', 'rules' => 'alpha_numeric')), 'fail' => array(array('field' => 'username', 'label' => 'user', 'rules' => 'alpha')));
$_POST = array('username' => 'foo42');
$form_validation = new CI_Form_validation($config);
$this->assertTrue($form_validation->run('pass'));
$form_validation = new CI_Form_validation($config);
$this->assertFalse($form_validation->run('fail'));
}
开发者ID:saiful1105020,项目名称:Under-Construction-Bracathon-Project-,代码行数:11,代码来源:Form_validation_test.php
示例8: run
/**
* Performs the actual form validation
*
* @param string $module Name of the module
* @param string $group Name of the group array containing the rules
*
* @return bool Success or Failure
*/
public function run($module = '', $group = '')
{
$this->CI->lang->load('bf_form_validation');
is_object($module) && ($this->CI =& $module);
return parent::run($group);
}
示例9: run
function run($module = '', $group = '')
{
(is_object($module)) AND $this->CI =& $module;
return parent::run($group);
}
示例10: post
public function post()
{
// Validation result
$result = array('validation' => FALSE);
// Form name
$form_name = $this->input->post('form_name');
// Form settings
$form = $this->_get_form_settings($form_name);
// Do not validate the form if the form is not defined
if (is_null($form)) {
$this->xhr_output(array());
}
// If rules are defined in the config file...
if (isset($form['fields'])) {
$fields = $form['fields'];
// Get each field settings
foreach ($fields as $field => $settings) {
if (isset($settings['rules'])) {
$rules = $settings['rules'];
$label = !empty($settings['label']) ? 'lang:' . $settings['label'] : $field;
// See : http://codeigniter.com/user_guide/libraries/form_validation.html#translatingfn
$this->form_validation->set_rules($field, $label, $rules);
// User's callback rules
// Callbacks rules cannot be executed by CI_Form_validation()
// They are supposed to be $CI methods and we are here out of the scope of $CI
/*
* Not implemented for the moment
* @todo: execute_validation_callback() needs to be rewritten
$rules_array = explode('|', $rules);
foreach($rules_array as $rule)
{
if (substr($rule, 0, 9) == 'callback_')
{
$row = array(
'field' => $field,
'label' => $label,
'rule' => $rule,
'post' => $this->input->post($field),
);
$this->execute_validation_callback($row);
}
}
*/
}
}
// Check the rules
$validation_passed = $this->form_validation->run();
// Error
if (!$validation_passed) {
$result['title'] = lang('form_alert_error_title');
$result['message'] = lang($form['messages']['error']);
$result['errors'] = $this->form_validation->_error_array;
} else {
// Supposed to send back one array with 'title' and 'message' indexes
$result = $this->_process_data($form);
$result['validation'] = TRUE;
if (!isset($result['title']) && !isset($result['message'])) {
$result['title'] = lang('form_alert_success_title');
$result['message'] = lang($form['messages']['success']);
}
}
}
$this->xhr_output($result);
}
示例11: run
function run($module = '', $group = '')
{
is_object($module) && ($this->CI =& $module);
return parent::run($group);
}