当前位置: 首页>>代码示例>>PHP>>正文


PHP IL10N::l方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:hyb148,项目名称:core,代码行数:23,代码来源:certificatecontroller.php

示例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);
     }
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:28,代码来源:certificatecontroller.php

示例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();
     }
 }
开发者ID:kenwi,项目名称:core,代码行数:22,代码来源:listcertificates.php

示例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];
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:25,代码来源:mailnotifications.php


注:本文中的OCP\IL10N::l方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。