本文整理汇总了PHP中Record::beforeValidate方法的典型用法代码示例。如果您正苦于以下问题:PHP Record::beforeValidate方法的具体用法?PHP Record::beforeValidate怎么用?PHP Record::beforeValidate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Record
的用法示例。
在下文中一共展示了Record::beforeValidate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeValidate
public function beforeValidate()
{
if ($this->isNewRecord) {
$this->password = md5($this->salt . $this->password);
$this->created_at = time();
}
if (empty($this->activation_key)) {
$this->activation_key = md5(microtime()) . rand(10, 100);
}
return parent::beforeValidate();
}
示例2: beforeValidate
public function beforeValidate()
{
if (is_array($this->languages)) {
$this->languages = implode(',', $this->languages);
}
parent::beforeValidate();
return true;
}
示例3: beforeValidate
public function beforeValidate()
{
if (is_array($this->languages)) {
$this->languages = implode(',', $this->languages);
}
if ($this->tryGravatar && 0) {
$email = $this->user->email;
$url = "http://www.gravatar.com/avatar/" . md5(strtolower(trim($email))) . "?s=190&d=404";
$url = parse_url($url);
$errno = '';
$errstr = '';
if (FALSE !== ($f = @fsockopen($url['hostname'], '80', $errno, $errstr, 30))) {
$out = "GET {$url['path']}?{$url['query']} HTTP/1.1\r\n";
$out .= "Host: {$url['hostname']}\r\n";
$out .= "Connection: close\r\n\r\n";
@fwrite($f, $out);
}
}
parent::beforeValidate();
return true;
}