本文整理汇总了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';
}
}
示例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;
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
示例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;
}
}
示例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');
}