本文整理汇总了PHP中Website::triggerAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Website::triggerAll方法的具体用法?PHP Website::triggerAll怎么用?PHP Website::triggerAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Website
的用法示例。
在下文中一共展示了Website::triggerAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: trigger
public function trigger($nickname = null)
{
$user = $this->load_user($nickname);
Website::triggerAll($user);
Site::Flash('notice', 'Update has been triggered');
Redirect("admin/users/" . $user->permalink());
}
示例2: save
public function save()
{
if ($this->validate()) {
$changed = false;
if ($this->is_new) {
$this->password = $this->hashPassword($this->password);
$this->password_confirmation = $this->password;
$this->activation_code = md5(time() . $this->nickname . $this->email . rand(10000, 99999));
$this->cookie = md5(time() . $this->nickname . $this->email . $this->activation_code . rand(10000, 99999));
$this->version = 1;
$changed = true;
} else {
if ($this->changed_password) {
$this->password = $this->hashPassword($this->password);
$this->password_confirmation = $this->password;
}
if (!$this->cookie) {
$this->cookie = md5(time() . $this->nickname . $this->email . $this->activation_code . rand(10000, 99999));
}
// Update version
if ($this->calculateHash() != $this->hash) {
$this->version++;
$changed = true;
}
}
if ($this->activated && !$this->affiliate_code) {
$this->affiliate_code = uniqid();
}
$result = parent::save(self::table);
if ($result) {
if ($changed) {
Website::triggerAll($this);
}
$this->sync_forums();
if ($this->activated and $this->allow_emails) {
$this->newzapp_signup();
}
$id = mysql_real_escape_string($this->id);
$user_profile = UserProfile::find("user_profiles.user_id = '{$id}'");
if (!$user_profile) {
// Create a profile for the user
$user_profile = new UserProfile();
$user_profile->user_id = $this->id;
$user_profile->save();
}
}
return $result;
} else {
return false;
}
}