本文整理汇总了PHP中_get_validation_object函数的典型用法代码示例。如果您正苦于以下问题:PHP _get_validation_object函数的具体用法?PHP _get_validation_object怎么用?PHP _get_validation_object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_get_validation_object函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validation_errors_array
function validation_errors_array()
{
if (FALSE === ($OBJ =& _get_validation_object())) {
return array();
}
return $OBJ->error_array();
}
示例2: setCustomError
public function setCustomError($field_name = false, $error = false)
{
if (!empty($field_name) && !empty($error)) {
$validator =& _get_validation_object();
$validator->_field_data[$field_name] = array('field' => $field_name, 'rules' => false, 'postdata' => false, 'is_array' => false, 'error' => $error);
}
}
示例3: form_errors
function form_errors()
{
if (FALSE === ($OBJ =& _get_validation_object())) {
return '';
}
return $OBJ->get_errors();
}
示例4: validation_errors
function validation_errors($prefix = '', $suffix = '')
{
if (FALSE === ($OBJ =& _get_validation_object())) {
return '';
}
return $OBJ->error_string($prefix, $suffix);
}
示例5: set_value
function set_value($field = '', $default = '')
{
if (!isset($_POST[$field])) {
return $default;
}
if (FALSE === ($OBJ =& _get_validation_object())) {
return form_prep($_POST[$field], $field);
}
return form_prep($OBJ->set_value($field, $_POST[$field]), $field);
}
示例6: keepValidationErrors
function keepValidationErrors()
{
if (FALSE === ($OBJ =& _get_validation_object())) {
// No action
} else {
$errors = $OBJ->error_array();
foreach ($errors as $error) {
set_message_error($error);
}
}
}
示例7: validation_errors
function validation_errors($prefix = '', $suffix = '')
{
if (FALSE === ($OBJ =& _get_validation_object())) {
return '';
}
if ($prefix == '' && $suffix == '') {
$prefix = '<p class="error">';
$suffix = '</p>';
}
return $OBJ->error_string($prefix, $suffix);
}
示例8: validation_errors
/**
* Apply Bootstrap Styling to error summary.
*/
function validation_errors($prefix = '', $suffix = '')
{
if (FALSE === ($OBJ =& _get_validation_object())) {
return '';
}
$error_string = $OBJ->error_string($prefix, $suffix);
if (strlen(trim($error_string) > 0)) {
return alert($error_string);
} else {
return '';
}
}
示例9: set_value
function set_value($field = '', $default = '')
{
$OBJ =& _get_validation_object();
if ($OBJ === TRUE && isset($OBJ->_field_data[$field])) {
return form_prep($OBJ->set_value($field, $default));
} else {
if (!isset($_POST[$field])) {
return $default;
}
return form_prep($_POST[$field]);
}
}
示例10: set_checkbox
function set_checkbox($field = '', $value = '', $default = '')
{
$OBJ =& _get_validation_object();
if ($OBJ === TRUE && isset($OBJ->_field_data[$field])) {
return form_prep($OBJ->set_checkbox($field, $value, $default));
} else {
if (!isset($_POST[$field])) {
if (isset($default) && $default == TRUE) {
return 'checked=\'checked\'';
} else {
return '';
}
} else {
if ($_POST[$field] == $value) {
return 'checked=\'checked\'';
}
}
}
}
示例11: do_login
/**
* Login
*
* @access public
*/
function do_login()
{
$this->form_validation->set_rules('login', lang("E-mail", 'admin'), 'trim|required|min_length[3]|max_length[50]|valid_email');
$this->form_validation->set_rules('password', lang("Password", "admin"), 'trim|required|min_length[5]|max_length[32]');
if ($_POST['remember'] == 1) {
$remember = true;
} else {
$remember = false;
// $remember = true;
}
if ($this->dx_auth->is_max_login_attempts_exceeded()) {
$this->form_validation->set_rules('captcha', lang("Protection code", "admin"), 'trim|required|xss_clean|callback_captcha_check');
}
if ($this->form_validation->run($this) == FALSE) {
// if ($this->form_validation->run($this) == TRUE)
$err_object =& _get_validation_object();
foreach ($_POST as $k => $v) {
$err_text = $err_object->error($k, $prefix, $suffix);
$this->template->assign($k . '_error', $err_text);
}
} else {
if ($this->check_permissions($this->input->post('login'))) {
$rezult = $this->dx_auth->login($this->input->post('login'), $this->input->post('password'), $remember);
if ($rezult == TRUE) {
$this->lib_admin->log(lang("Entered the IP control panel", "admin") . " " . $this->input->ip_address());
redirect('admin/admin/init', 'refresh');
} else {
$this->template->assign('login_failed', lang("Username and password have not been found", "admin"));
}
} else {
$this->template->assign('login_failed', lang("Not enough access rights", "admin"));
}
}
$this->template->display('login_page');
// $this->template->show('login', TRUE);
}
示例12: form
public function form()
{
//let's see with which kind of object we are dealing with
$obj = $this->getContactById();
if (!$obj) {
if ($add_value = uri_assoc('add')) {
//retrieving uid from GET
if ($add_value) {
$obj = $add_value;
}
}
}
if ($obj) {
$this->{$obj}->setFormRules();
}
if (!empty($obj) && $this->{$obj}->validateForm()) {
//it's a submit and the form has been validated. Let's check if there is any binary file uploaded
$upload_info = saveUploadedFile();
//TODO error handling
if (is_array($upload_info['data'])) {
$this->load->helper('file');
foreach ($upload_info['data'] as $element => $element_status) {
//reads the file and converts it in base64 and stores it in $obj
if ($element_status['full_path']) {
$binary_file = base64_encode(read_file($element_status['full_path']));
if ($binary_file) {
$this->{$obj}->{$element} = $binary_file;
}
unlink($element_status['full_path']);
}
}
}
//ready to save in ldap
if ($this->{$obj}->save()) {
if (isset($this->{$obj}->uid)) {
redirect(site_url() . "/contact/details/uid/" . $this->{$obj}->uid);
}
if (isset($this->{$obj}->oid)) {
redirect(site_url() . "/contact/details/oid/" . $this->{$obj}->oid);
}
//this brings back to the previous page
//redirect($this->session->userdata('last_index'));
}
}
//it's not a form submit
if ($obj) {
//unset the errors found during the validation step, otherwise when a new contact is being created it gets errors
$form_validation_obj =& _get_validation_object();
$form_validation_obj->reset_errors();
//the contact is set so it's an early stage update and it needs to fill the form with the contact's data
$contact_id = $this->{$obj}->uid ? $this->{$obj}->uid : $this->{$obj}->oid;
if (!$contact_id) {
//it's not an update but a new contact creation
$form = $this->input->post('form');
switch ($this->{$obj}->objName) {
case 'person':
if (empty($form)) {
//this means that the form has been submitted automatically by js => no contacts found in the search
$first_name = $this->input->post('first_name');
$last_name = $this->input->post('last_name');
} else {
foreach ($form as $item) {
if ($item['field'] == 'first_name') {
$first_name = $item['value'];
}
if ($item['field'] == 'last_name') {
$last_name = $item['value'];
}
}
}
if (isset($first_name) && $first_name) {
$this->{$obj}->givenName = $first_name;
}
if (isset($last_name) && $last_name) {
$this->{$obj}->sn = $last_name;
}
break;
case 'organization':
if (empty($form)) {
$organization_name = $this->input->post('organization_name');
}
if (isset($organization_name) && $organization_name) {
$this->{$obj}->o = $organization_name;
}
break;
}
}
//preparing the form
foreach ($this->{$obj}->properties as $key => $property) {
$this->mdl_contacts->form_values[$key] = $this->{$obj}->{$key};
}
//for test purposes
//$o = $this->$obj;
//sets form submit url
if (isset($this->{$obj}->uid) && !empty($this->{$obj}->uid)) {
$form_url = site_url() . "/contact/form/uid/" . $this->{$obj}->uid;
}
if (isset($this->{$obj}->oid) && !empty($this->{$obj}->oid)) {
$form_url = site_url() . "/contact/form/oid/" . $this->{$obj}->oid;
}
//.........这里部分代码省略.........
示例13: form_has_error
/**
* Check whether the form has an error
*
* @deprecated since 0.7.1 use form_error() in the main form library
*
* @param string $field Name of the field
*
* @return bool
*/
function form_has_error($field = null)
{
if (false === ($OBJ =& _get_validation_object())) {
return false;
}
return $OBJ->has_error($field);
}
示例14: set_checkbox
function set_checkbox($field = '', $value = '', $default = FALSE)
{
$OBJ =& _get_validation_object();
if ($OBJ === FALSE) {
if (!isset($_POST[$field])) {
if (count($_POST) === 0 and $default == TRUE) {
return ' checked="checked"';
}
return '';
}
$field = $_POST[$field];
if (is_array($field)) {
if (!in_array($value, $field)) {
return '';
}
} else {
if ($field == '' or $value == '' or $field != $value) {
return '';
}
}
return ' checked="checked"';
}
return $OBJ->set_checkbox($field, $value, $default);
}
示例15: form_has_error
/**
* Check if the form has an error
*
* @access public
*
* @param string $field Name of the field
*
* @return bool
*/
function form_has_error($field = null)
{
if (FALSE === ($OBJ =& _get_validation_object())) {
return FALSE;
}
$return = $OBJ->has_error($field);
return $return;
}