本文整理匯總了PHP中ElggEntity::__set方法的典型用法代碼示例。如果您正苦於以下問題:PHP ElggEntity::__set方法的具體用法?PHP ElggEntity::__set怎麽用?PHP ElggEntity::__set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ElggEntity
的用法示例。
在下文中一共展示了ElggEntity::__set方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __set
/**
* {@inheritdoc}
*/
public function __set($name, $value)
{
if (array_key_exists($name, $this->attributes)) {
switch ($name) {
case 'prev_last_action':
case 'last_login':
case 'prev_last_login':
if ($value !== null) {
$this->attributes[$name] = (int) $value;
} else {
$this->attributes[$name] = null;
}
break;
default:
parent::__set($name, $value);
break;
}
} else {
parent::__set($name, $value);
}
}
示例2: __set
/**
* {@inheritdoc}
*/
public function __set($name, $value)
{
if (!array_key_exists($name, $this->attributes)) {
parent::__set($name, $value);
return;
}
switch ($name) {
case 'prev_last_action':
case 'last_login':
case 'prev_last_login':
if ($value !== null) {
$this->attributes[$name] = (int) $value;
} else {
$this->attributes[$name] = null;
}
break;
case 'salt':
case 'password':
elgg_deprecated_notice("Setting salt/password directly is deprecated. Use ElggUser::setPassword().", "1.10");
$this->attributes[$name] = $value;
// this is emptied so that the user is not left with two usable hashes
$this->attributes['password_hash'] = '';
break;
// setting this not supported
// setting this not supported
case 'password_hash':
_elgg_services()->logger->error("password_hash is now an attribute of ElggUser and cannot be set.");
return;
break;
default:
parent::__set($name, $value);
break;
}
}
示例3: __set
/**
* Need to catch attempts to make a user an admin. Remove for 1.9
*
* @param string $name Name
* @param mixed $value Value
*
* @return bool
*/
public function __set($name, $value)
{
if ($name == 'admin' || $name == 'siteadmin') {
elgg_deprecated_notice('The admin/siteadmin metadata are not longer used. Use ElggUser->makeAdmin() and ElggUser->removeAdmin().', 1.7);
if ($value == 'yes' || $value == '1') {
$this->makeAdmin();
} else {
$this->removeAdmin();
}
}
return parent::__set($name, $value);
}
示例4: __set
/**
* {@inheritdoc}
*/
public function __set($name, $value)
{
if (!array_key_exists($name, $this->attributes)) {
parent::__set($name, $value);
return;
}
switch ($name) {
case 'prev_last_action':
case 'last_login':
case 'prev_last_login':
if ($value !== null) {
$this->attributes[$name] = (int) $value;
} else {
$this->attributes[$name] = null;
}
break;
case 'salt':
case 'password':
_elgg_services()->logger->error("User entities no longer contain salt/password");
break;
// setting this not supported
// setting this not supported
case 'password_hash':
_elgg_services()->logger->error("password_hash is a readonly attribute.");
break;
default:
parent::__set($name, $value);
break;
}
}