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


PHP Scalr_Util_DateTime::getFuzzyTimeString方法代碼示例

本文整理匯總了PHP中Scalr_Util_DateTime::getFuzzyTimeString方法的典型用法代碼示例。如果您正苦於以下問題:PHP Scalr_Util_DateTime::getFuzzyTimeString方法的具體用法?PHP Scalr_Util_DateTime::getFuzzyTimeString怎麽用?PHP Scalr_Util_DateTime::getFuzzyTimeString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Scalr_Util_DateTime的用法示例。


在下文中一共展示了Scalr_Util_DateTime::getFuzzyTimeString方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: xGenerateApiKeyAction

 public function xGenerateApiKeyAction()
 {
     if ($this->user->isAdmin() || !\Scalr::config('scalr.system.api.enabled')) {
         throw new Scalr_Exception_InsufficientPermissions();
     }
     $apiKeyEntity = new ApiKeyEntity($this->user->getId());
     $apiKeyEntity->save();
     $row = get_object_vars($apiKeyEntity);
     $row['created'] = Scalr_Util_DateTime::convertTz($apiKeyEntity->created);
     $row['lastUsed'] = $apiKeyEntity->lastUsed ? Scalr_Util_DateTime::convertTz($apiKeyEntity->lastUsed) : 0;
     $row['createdHr'] = $apiKeyEntity->created ? Scalr_Util_DateTime::getFuzzyTimeString($apiKeyEntity->created) : '';
     $row['lastUsedHr'] = $apiKeyEntity->lastUsed ? Scalr_Util_DateTime::getFuzzyTimeString($apiKeyEntity->lastUsed) : 'Never';
     $this->response->data(['key' => $row]);
 }
開發者ID:sacredwebsite,項目名稱:scalr,代碼行數:14,代碼來源:Core.php

示例2: getUserInfo

 public function getUserInfo()
 {
     $info['id'] = $this->id;
     $info['status'] = $this->status;
     $info['email'] = $this->getEmail();
     $info['fullname'] = $this->fullname;
     $info['dtcreated'] = Scalr_Util_DateTime::convertTz($this->dtCreated);
     $info['dtlastlogin'] = $this->dtLastLogin ? Scalr_Util_DateTime::convertTz($this->dtLastLogin) : 'Never';
     $info['dtlastloginhr'] = $this->dtLastLogin ? Scalr_Util_DateTime::getFuzzyTimeString($this->dtLastLogin) : 'Never';
     $info['gravatarhash'] = $this->getGravatarHash();
     $info['type'] = $this->type;
     $info['comments'] = $this->comments;
     $info['is2FaEnabled'] = $this->getSetting(Scalr_Account_User::SETTING_SECURITY_2FA_GGL) == '1' ? true : false;
     $info['password'] = $this->password ? true : false;
     return $info;
 }
開發者ID:rickb838,項目名稱:scalr,代碼行數:16,代碼來源:User.php

示例3: xGenerateApiKeyAction

 public function xGenerateApiKeyAction()
 {
     if ($this->user->isAdmin() || !\Scalr::config('scalr.system.api.enabled')) {
         throw new Scalr_Exception_InsufficientPermissions();
     }
     $apiKeyEntity = new ApiKeyEntity($this->user->getId());
     //It should prevents wiping out existing keys
     $attempts = 3;
     do {
         //Generates API KEY explicitly before saving
         $apiKeyEntity->keyId = $apiKeyEntity->getIterator()->getField('keyId')->getType()->generateValue($apiKeyEntity);
         if ($attempts-- == 0) {
             throw new RuntimeException("Could not generate uniquie API Key");
         }
     } while (ApiKeyEntity::findPk($apiKeyEntity->keyId) !== null);
     // Saving a new API key
     $apiKeyEntity->save();
     $row = get_object_vars($apiKeyEntity);
     $row['created'] = Scalr_Util_DateTime::convertTz($apiKeyEntity->created);
     $row['lastUsed'] = $apiKeyEntity->lastUsed ? Scalr_Util_DateTime::convertTz($apiKeyEntity->lastUsed) : 0;
     $row['createdHr'] = $apiKeyEntity->created ? Scalr_Util_DateTime::getFuzzyTimeString($apiKeyEntity->created) : '';
     $row['lastUsedHr'] = $apiKeyEntity->lastUsed ? Scalr_Util_DateTime::getFuzzyTimeString($apiKeyEntity->lastUsed) : 'Never';
     $this->response->data(['key' => $row]);
 }
開發者ID:mheydt,項目名稱:scalr,代碼行數:24,代碼來源:Core.php


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