当前位置: 首页>>代码示例>>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;未经允许,请勿转载。