本文整理汇总了PHP中OCP\IL10N::l方法的典型用法代码示例。如果您正苦于以下问题:PHP IL10N::l方法的具体用法?PHP IL10N::l怎么用?PHP IL10N::l使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCP\IL10N
的用法示例。
在下文中一共展示了IL10N::l方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addPersonalRootCertificate
/**
* Add a new personal root certificate to the users' trust store
*
* @NoAdminRequired
* @NoSubadminRequired
* @return array
*/
public function addPersonalRootCertificate()
{
if ($this->isCertificateImportAllowed() === false) {
return new DataResponse('Individual certificate management disabled', Http::STATUS_FORBIDDEN);
}
$file = $this->request->getUploadedFile('rootcert_import');
if (empty($file)) {
return new DataResponse(['message' => 'No file uploaded'], Http::STATUS_UNPROCESSABLE_ENTITY);
}
try {
$certificate = $this->certificateManager->addCertificate(file_get_contents($file['tmp_name']), $file['name']);
return new DataResponse(['name' => $certificate->getName(), 'commonName' => $certificate->getCommonName(), 'organization' => $certificate->getOrganization(), 'validFrom' => $certificate->getIssueDate()->getTimestamp(), 'validTill' => $certificate->getExpireDate()->getTimestamp(), 'validFromString' => $this->l10n->l('date', $certificate->getIssueDate()), 'validTillString' => $this->l10n->l('date', $certificate->getExpireDate()), 'issuer' => $certificate->getIssuerName(), 'issuerOrganization' => $certificate->getIssuerOrganization()]);
} catch (\Exception $e) {
return new DataResponse('An error occurred.', Http::STATUS_UNPROCESSABLE_ENTITY);
}
}
示例2: addPersonalRootCertificate
/**
* Add a new personal root certificate to the users' trust store
*
* @NoAdminRequired
* @NoSubadminRequired
* @return array
*/
public function addPersonalRootCertificate()
{
$headers = [];
if ($this->request->isUserAgent([\OC\AppFramework\Http\Request::USER_AGENT_IE_8])) {
// due to upload iframe workaround, need to set content-type to text/plain
$headers['Content-Type'] = 'text/plain';
}
if ($this->isCertificateImportAllowed() === false) {
return new DataResponse(['message' => 'Individual certificate management disabled'], Http::STATUS_FORBIDDEN, $headers);
}
$file = $this->request->getUploadedFile('rootcert_import');
if (empty($file)) {
return new DataResponse(['message' => 'No file uploaded'], Http::STATUS_UNPROCESSABLE_ENTITY, $headers);
}
try {
$certificate = $this->certificateManager->addCertificate(file_get_contents($file['tmp_name']), $file['name']);
return new DataResponse(['name' => $certificate->getName(), 'commonName' => $certificate->getCommonName(), 'organization' => $certificate->getOrganization(), 'validFrom' => $certificate->getIssueDate()->getTimestamp(), 'validTill' => $certificate->getExpireDate()->getTimestamp(), 'validFromString' => $this->l10n->l('date', $certificate->getIssueDate()), 'validTillString' => $this->l10n->l('date', $certificate->getExpireDate()), 'issuer' => $certificate->getIssuerName(), 'issuerOrganization' => $certificate->getIssuerOrganization()], Http::STATUS_OK, $headers);
} catch (\Exception $e) {
return new DataResponse('An error occurred.', Http::STATUS_UNPROCESSABLE_ENTITY, $headers);
}
}
示例3: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$outputType = $input->getOption('output');
if ($outputType === self::OUTPUT_FORMAT_JSON || $outputType === self::OUTPUT_FORMAT_JSON_PRETTY) {
$certificates = array_map(function (ICertificate $certificate) {
return ['name' => $certificate->getName(), 'common_name' => $certificate->getCommonName(), 'organization' => $certificate->getOrganization(), 'expire' => $certificate->getExpireDate()->format(\DateTime::ATOM), 'issuer' => $certificate->getIssuerName(), 'issuer_organization' => $certificate->getIssuerOrganization(), 'issue_date' => $certificate->getIssueDate()->format(\DateTime::ATOM)];
}, $this->certificateManager->listCertificates());
if ($outputType === self::OUTPUT_FORMAT_JSON) {
$output->writeln(json_encode(array_values($certificates)));
} else {
$output->writeln(json_encode(array_values($certificates), JSON_PRETTY_PRINT));
}
} else {
$table = new Table($output);
$table->setHeaders(['File Name', 'Common Name', 'Organization', 'Valid Until', 'Issued By']);
$rows = array_map(function (ICertificate $certificate) {
return [$certificate->getName(), $certificate->getCommonName(), $certificate->getOrganization(), $this->l->l('date', $certificate->getExpireDate()), $certificate->getIssuerName()];
}, $this->certificateManager->listCertificates());
$table->setRows($rows);
$table->render();
}
}
示例4: createMailBody
/**
* create mail body for plain text and html mail
*
* @param string $filename the shared file
* @param string $link link to the shared file
* @param int $expiration expiration date (timestamp)
* @return array an array of the html mail body and the plain text mail body
*/
private function createMailBody($filename, $link, $expiration)
{
$formattedDate = $expiration ? $this->l->l('date', $expiration) : null;
$html = new \OC_Template("core", "mail", "");
$html->assign('link', $link);
$html->assign('user_displayname', $this->senderDisplayName);
$html->assign('filename', $filename);
$html->assign('expiration', $formattedDate);
$htmlMail = $html->fetchPage();
$plainText = new \OC_Template("core", "altmail", "");
$plainText->assign('link', $link);
$plainText->assign('user_displayname', $this->senderDisplayName);
$plainText->assign('filename', $filename);
$plainText->assign('expiration', $formattedDate);
$plainTextMail = $plainText->fetchPage();
return [$htmlMail, $plainTextMail];
}