本文整理匯總了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;
}
}