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