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


PHP Text::validate方法代码示例

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


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

示例1: validate

 protected function validate()
 {
     parent::validate();
     if ($this->getIsValid() && !preg_match("/^([a-z0-9])([a-z0-9-_.]+)@([a-z0-9])([a-z0-9-_]+\\.)+([a-z]{2,4})\$/i", $this->getValue())) {
         $this->errors[] = 'error_invalidEmail';
     }
 }
开发者ID:BjoBre,项目名称:t3chimp,代码行数:7,代码来源:Email.php

示例2: refreshCache

 /**
  * Refreshes the properties of the class
  * @param  string $id_field Column to identify the user with
  * @param  string $field_id Value of the identification column
  * @return void
  */
 public function refreshCache($id_field, $field_id)
 {
     foreach (Sql::Query("SELECT * FROM accounts WHERE {$id_field} = '" . $field_id . "'") as $i) {
         foreach ($i as $key => $i2) {
             if (Text::validate($key, 'num')) {
                 continue;
             }
             $this->{$key} = $i2;
         }
     }
 }
开发者ID:studio-wolfree,项目名称:sonicwulf-php,代码行数:17,代码来源:User.php

示例3: validate

 public function validate()
 {
     $result = parent::validate();
     if ($result) {
         if (!is_numeric($this->value()) && $this->value() != '0') {
             $result = false;
             $this->invalidate('Value is not a number');
         }
     }
     return $result;
 }
开发者ID:stwessl,项目名称:form,代码行数:11,代码来源:Number.php

示例4: validate

 public function validate()
 {
     $result = parent::validate();
     if ($result) {
         $result = filter_var($this->value(), FILTER_VALIDATE_EMAIL);
         if (!$result) {
             $this->invalidate('Value must be a valid email address `youremail@yourdomain.com` ');
         }
     }
     return $result;
 }
开发者ID:stwessl,项目名称:form,代码行数:11,代码来源:Email.php

示例5: validate

 public function validate($val)
 {
     if (!empty($this->error)) {
         return false;
     }
     if (parent::validate($val)) {
         if (Useful::stripper($val) !== false) {
             if (strlen($val) < $this->min_length) {
                 $this->error[] = sprintf('must be more than %s characters', $this->min_length);
             }
             if ($this->alphanumeric && (!preg_match("#[A-Za-z]+#", $val) || !preg_match("#[0-9]+#", $val))) {
                 $this->error[] = 'must have at least one alphabetic character and one numeric character';
             }
         }
     }
     if ($this->confirm) {
         if ($val != $_POST[$this->confirm]) {
             $form = NibbleForm::getInstance();
             $form->{$this->confirm}->error[] = 'must match password';
         }
     }
     return !empty($this->error) ? false : true;
 }
开发者ID:priestd09,项目名称:Nibble-Framework,代码行数:23,代码来源:NibbleForm.class.php

示例6: jsRedirect

require_once 'system/nlb_mail.class.php';
require_once 'system/text.class.php';
require_once 'ets.php';
$db = new sqldb2($DB_CONFIG);
$user = new nlb_user($db);
$config = new nlb_config($db);
$blog = new nlb_blog($db);
$user->checkLogin();
// check for loged in user.
if ($user->isLogedIn) {
    jsRedirect("index.php");
}
include $config->langfile();
$start = mymicrotime();
$text = new Text($_POST, array('username', 'password', 'confirm-password', 'email', 'template', 'timezone'), array('custom'));
$text->validate();
$clean = $text->clean;
$baddata = false;
$problems = array();
if (!empty($_POST)) {
    if ($text->is_missing_required) {
        $baddata = true;
    }
    // if there was good submitted data...
    if ($clean['password'] != $clean['confirm-password']) {
        $baddata = true;
        $problems[] = $l['reg-badpassword'];
    }
    // valid email?
    if (!pear_check_email($clean['email'])) {
        $baddata = true;
开发者ID:nickfun,项目名称:newlifeblogger,代码行数:31,代码来源:register.php

示例7: userExists

 /**
  * Checks if an user exists
  * @param  string $id_field Field to identify the user with
  * @return bool             Returns true if the query was successful
  */
 static function userExists($id_field)
 {
     if (!Text::validate($id_field, 'num')) {
         $quote = "'";
     } else {
         $quote = '';
     }
     if (Sql::numRows("SELECT " . self::$id_field . " FROM accounts WHERE " . self::$id_field . " = " . $quote . $id_field . $quote) < 1) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:studio-wolfree,项目名称:sonicwulf-php,代码行数:18,代码来源:Users.php

示例8: isValid

 /**
  * Verifies if an email is correctly formatted (Alias of Text::validate)
  * @param  string  $email Email to check
  * @return boolean        Returns true if the email is valid
  */
 static function isValid($email)
 {
     return Text::validate($email, 'email');
 }
开发者ID:studio-wolfree,项目名称:codeboom,代码行数:9,代码来源:Mail.php


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