當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ElggEntity::__set方法代碼示例

本文整理匯總了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);
     }
 }
開發者ID:sephiroth88,項目名稱:Elgg,代碼行數:24,代碼來源:ElggUser.php

示例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;
     }
 }
開發者ID:cyrixhero,項目名稱:Elgg,代碼行數:37,代碼來源:ElggUser.php

示例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);
 }
開發者ID:duanhv,項目名稱:mdg-social,代碼行數:20,代碼來源:ElggUser.php

示例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;
     }
 }
開發者ID:elgg,項目名稱:elgg,代碼行數:33,代碼來源:ElggUser.php


注:本文中的ElggEntity::__set方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。