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