当前位置: 首页>>代码示例>>PHP>>正文


PHP Validation::isValid方法代码示例

本文整理汇总了PHP中Validation::isValid方法的典型用法代码示例。如果您正苦于以下问题:PHP Validation::isValid方法的具体用法?PHP Validation::isValid怎么用?PHP Validation::isValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Validation的用法示例。


在下文中一共展示了Validation::isValid方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _validation

 protected function _validation()
 {
     $valid = new Validation($this->_inData);
     if ($valid->isValid()) {
         $this->_insertDB();
         //            $this->_shipsSelect();
     } else {
         $this->_insertDB();
         //           echo '!!!';
     }
 }
开发者ID:RMMusic,项目名称:Sea_Battle,代码行数:11,代码来源:gameController.php

示例2: validateAll

 protected function validateAll()
 {
     if (is_array($this->values) && !empty($this->values)) {
         foreach ($this->values as $value => $rule) {
             if (is_string($value) && is_string($rule)) {
                 //executa a validação
                 $this->errors[$value] = Validation::isValid($value, $rule);
             } else {
                 $this->errors[$value] = 'Este não pode ser validado. Verifique se o tipo de validação foi passado';
             }
         }
     } else {
         $this->errors = 'O parâmetro $values não está definido, ou foi definido incorretamente. Ele deve ser um array';
         return false;
     }
 }
开发者ID:CauanCabral,项目名称:libs,代码行数:16,代码来源:validation.class.php

示例3: validate_logic_or

 /**
  * [[Description]]
  * @author Till Uhlig
  * @param  [[Type]] $key              [[Description]]
  * @param  [[Type]] $input            [[Description]]
  * @param  [[Type]] [$setting = null] [[Description]]
  * @param  [[Type]] [$param = null]   [[Description]]
  * @return boolean  [[Description]]
  */
 public static function validate_logic_or($key, $input, $setting = null, $param = null)
 {
     if ($setting['setError'] || !isset($input[$key]) || !isset($param)) {
         return;
     }
     if (!isset($param)) {
         throw new Exception('Validation rule \'' . __METHOD__ . '\', missing parameter.');
     }
     if (!is_array($param)) {
         throw new Exception('Validation rule \'' . __METHOD__ . '\', array required as parameter.');
     }
     /// fehlermeldungen verodern ///
     /// fehlermeldungen verodern ///
     /// fehlermeldungen verodern ///
     foreach ($param as $rules) {
         $f = new Validation(array($key => $input[$key]), $setting);
         $f->addSet($key, $rules);
         if ($f->isValid()) {
             $res = $f->getResult()[$key];
             return array('valid' => true, 'field' => $key, 'value' => $res);
         }
     }
     return false;
 }
开发者ID:ostepu,项目名称:ostepu-validation,代码行数:33,代码来源:Validation_Logic.php

示例4: array

    $objValid->_required = array('first_name', 'last_name', 'address_1', 'town', 'county', 'post_code', 'country', 'email', 'password', 'confirm_password');
    $objValid->_special = array('email' => 'email');
    $objValid->_post_remove = array('confirm_password');
    $objValid->_post_format = array('password' => 'password');
    // validate password
    $pass_1 = $objForm->getPost('password');
    $pass_2 = $objForm->getPost('confirm_password');
    if (!empty($pass_1) && !empty($pass_2) && $pass_1 != $pass_2) {
        $objValid->add2Errors('password_mismatch');
    }
    $email = $objForm->getPost('email');
    $user = $objUser->getByEmail($email);
    if (!empty($user)) {
        $objValid->add2Errors('email_duplicate');
    }
    if ($objValid->isValid()) {
        // add hash for activating account
        $objValid->_post['hash'] = mt_rand() . date('YmdHis') . mt_rand();
        // add registration date
        $objValid->_post['date'] = Helper::setDate();
        if ($objUser->addUser($objValid->_post, $objForm->getPost('password'))) {
            $_SESSION['link'] = $_POST['link'];
            Helper::redirect('/start/?page=registered');
        } else {
            Helper::redirect('/start/?page=registered-failed');
        }
    }
}
require_once '_header.php';
?>
开发者ID:huynhv,项目名称:uniguide,代码行数:30,代码来源:login.php

示例5: validate_satisfy_file_name

 /**
  * [[Description]]
  * @author Till Uhlig
  * @param  [[Type]] $key              [[Description]]
  * @param  [[Type]] $input            [[Description]]
  * @param  [[Type]] [$setting = null] [[Description]]
  * @param  [[Type]] [$param = null]   [[Description]]
  * @return boolean  [[Description]]
  */
 public static function validate_satisfy_file_name($key, $input, $setting = null, $param = null)
 {
     if (!$setting['setError'] && (!isset($input[$key]) || !isset($input[$key]['name']))) {
         return;
     }
     if ($setting['setError']) {
         return;
     }
     $file = $input[$key];
     if (!is_array($param)) {
         if ($file['name'] === $param) {
             return;
         } else {
             return false;
         }
     } else {
         $f = new Validation(array('name' => $file['name']), $setting);
         foreach ($param as $rule) {
             $f->addSet('name', $rule);
         }
         if ($f->isValid()) {
             return;
         } else {
             return false;
         }
     }
     return false;
 }
开发者ID:ostepu,项目名称:ostepu-validation,代码行数:37,代码来源:Validation_Condition.php

示例6: Page

<?php

$this->addScript('/admin/js/ckeditor/ckeditor.js');
$this->addScript('/admin/js/ckeditor/adapters/jquery.js');
$objPage = new Page($this->objLanguage);
$objForm = new Form($this->objUrl);
$objValidation = new Validation($this->objLanguage);
$expected = array('name', 'content', 'meta_title', 'meta_description', 'meta_keywords', 'identity');
$required = array('name', 'content', 'meta_title', 'meta_description', 'meta_keywords', 'identity');
if (isset($_POST['name'])) {
    $array = $objForm->post2Array($expected, 'content', array('identity' => 'sanitise'));
    if (array_key_exists('identity', $array) && !empty($array['identity']) && $objPage->duplicate($array['identity'])) {
        $objValidation->add2Errors('identity', 'identity_taken');
    }
    if ($objValidation->isValid($array, $required)) {
        if ($objPage->add($array)) {
            Helper::redirect($this->objUrl->getCurrent(array('a', 'id')) . '/a/index');
        }
    }
}
require_once 'header.php';
?>

<h1><?php 
echo $this->objLanguage->labels[9];
?>
</h1>

<form method="post">
	<table class="tbl_insert">
		<tr>
开发者ID:joakinCC,项目名称:udemy.com-Multilingual-CMS-Website-with-PHP-MySQL-jQuery,代码行数:31,代码来源:add.php

示例7: validate_perform_switch_case

 /**
  * [[Description]]
  * @author Till Uhlig
  * @param  [[Type]] $key              [[Description]]
  * @param  [[Type]] $input            [[Description]]
  * @param  [[Type]] [$setting = null] [[Description]]
  * @param  [[Type]] [$param = null]   [[Description]]
  * @return [[Type]] [[Description]]
  */
 public static function validate_perform_switch_case($key, $input, $setting = null, $param = null)
 {
     if ($setting['setError'] || !isset($input[$key]) || !isset($param)) {
         return;
     }
     if (!isset($param)) {
         throw new Exception('Validation rule \'' . __METHOD__ . '\', missing parameter.');
     }
     if (!is_array($param)) {
         throw new Exception('Validation rule \'' . __METHOD__ . '\', parameter should be an array.');
     }
     foreach ($param as $case) {
         $condition = $case[0];
         // set (selector, rules)
         $rules = $case[1];
         // rules only
         $satisfied = false;
         if (is_string($condition)) {
             if ($input[$key] === $condition) {
                 $satisfied = true;
             }
         } else {
             $f = new Validation($input, $setting);
             foreach ($condition as $set) {
                 $f->addSet($set[0], $set[1]);
             }
             if ($f->isValid()) {
                 $satisfied = true;
             }
         }
         if ($satisfied) {
             $f = new Validation($input, $setting);
             foreach ($rules as $set) {
                 $f->addSet($key, $set);
             }
             if ($f->isValid()) {
                 $r = $f->getResult();
                 if (isset($r[$key])) {
                     $r = $r[$key];
                 } else {
                     $r = null;
                 }
                 return array('valid' => true, 'field' => $key, 'value' => $r);
             } else {
                 return array('valid' => false, 'notifications' => $f->getNotifications(), 'errors' => $f->getErrors());
             }
         }
     }
     return;
 }
开发者ID:ostepu,项目名称:ostepu-validation,代码行数:59,代码来源:Validation_Perform.php

示例8: Form

<?php

if (Login::isLogged(Login::$_login_admin_id)) {
    Helper::redirect(SITE_URL . Login::$_dashboard_admin);
}
$objForm = new Form();
$objValidation = new Validation($objForm);
if ($objForm->isPost('login_user')) {
    $objAdmin = new Admin();
    $objValidation->_required = array('login_user', 'login_password');
    if ($objAdmin->isUser($objForm->getPost('login_user'), $objForm->getPost('login_password'))) {
        $result = Login::loginAdmin($objAdmin->_user, Url::getReferrerUrl());
    } else {
        $objValidation->add2Errors('login');
    }
    if ($objValidation->isValid()) {
    }
}
?>

<html>
    <head>
        <title>XBook Management System</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">

        <link href="css/Core.css" rel="stylesheet" type="text/css" />
        
        <link rel="stylesheet" href="../css/bootstrap.min.css">
        <link rel="stylesheet" href="../css/bootstrap-theme.min.css">
        <link rel="stylesheet" href="../css/bootstrap-select.min.css">
开发者ID:brahmantyo,项目名称:xbook,代码行数:31,代码来源:login.php


注:本文中的Validation::isValid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。