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


PHP IL10N::t方法代码示例

本文整理汇总了PHP中OCP\IL10N::t方法的典型用法代码示例。如果您正苦于以下问题:PHP IL10N::t方法的具体用法?PHP IL10N::t怎么用?PHP IL10N::t使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OCP\IL10N的用法示例。


在下文中一共展示了IL10N::t方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: format

 /**
  * @param IEvent $event
  * @param string $parameter The parameter to be formatted
  * @param bool $allowHtml   Should HTML be used to format the parameter?
  * @param bool $verbose     Should paths, names, etc be shortened or full length
  * @return string The formatted parameter
  */
 public function format(IEvent $event, $parameter, $allowHtml, $verbose = false)
 {
     // If the username is empty, the action has been performed by a remote
     // user, or via a public share. We don't know the username in that case
     if ($parameter === '') {
         if ($allowHtml === null) {
             return '<user display-name="' . Util::sanitizeHTML($this->l->t('"remote user"')) . '">' . Util::sanitizeHTML('') . '</user>';
         }
         if ($allowHtml) {
             return '<strong>' . $this->l->t('"remote user"') . '</strong>';
         } else {
             return $this->l->t('"remote user"');
         }
     }
     $user = $this->manager->get($parameter);
     $displayName = $user ? $user->getDisplayName() : $parameter;
     $parameter = Util::sanitizeHTML($parameter);
     if ($allowHtml === null) {
         return '<user display-name="' . Util::sanitizeHTML($displayName) . '">' . Util::sanitizeHTML($parameter) . '</user>';
     }
     if ($allowHtml) {
         $avatarPlaceholder = '';
         if ($this->config->getSystemValue('enable_avatars', true)) {
             $avatarPlaceholder = '<div class="avatar" data-user="' . $parameter . '"></div>';
         }
         return $avatarPlaceholder . '<strong>' . Util::sanitizeHTML($displayName) . '</strong>';
     } else {
         return $displayName;
     }
 }
开发者ID:ynott,项目名称:activity,代码行数:37,代码来源:userformatter.php

示例2: fopen

 /**
  * Asynchronously scan data that are written to the file
  * @param string $path
  * @param string $mode
  * @return resource | bool
  */
 public function fopen($path, $mode)
 {
     $stream = $this->storage->fopen($path, $mode);
     if (is_resource($stream) && $this->isWritingMode($mode)) {
         try {
             $scanner = $this->scannerFactory->getScanner();
             $scanner->initAsyncScan();
             return CallBackWrapper::wrap($stream, null, function ($data) use($scanner) {
                 $scanner->onAsyncData($data);
             }, function () use($scanner, $path) {
                 $status = $scanner->completeAsyncScan();
                 if (intval($status->getNumericStatus()) === \OCA\Files_Antivirus\Status::SCANRESULT_INFECTED) {
                     //prevent from going to trashbin
                     if (App::isEnabled('files_trashbin')) {
                         \OCA\Files_Trashbin\Storage::preRenameHook([]);
                     }
                     $owner = $this->getOwner($path);
                     $this->unlink($path);
                     if (App::isEnabled('files_trashbin')) {
                         \OCA\Files_Trashbin\Storage::postRenameHook([]);
                     }
                     \OC::$server->getActivityManager()->publishActivity('files_antivirus', Activity::SUBJECT_VIRUS_DETECTED, [$path, $status->getDetails()], Activity::MESSAGE_FILE_DELETED, [], $path, '', $owner, Activity::TYPE_VIRUS_DETECTED, Activity::PRIORITY_HIGH);
                     throw new InvalidContentException($this->l10n->t('Virus %s is detected in the file. Upload cannot be completed.', $status->getDetails()));
                 }
             });
         } catch (\Exception $e) {
             $message = implode(' ', [__CLASS__, __METHOD__, $e->getMessage()]);
             $this->logger->warning($message);
         }
     }
     return $stream;
 }
开发者ID:drognisep,项目名称:Portfolio-Site,代码行数:38,代码来源:avirwrapper.php

示例3: updatePrivateKeyPassword

 /**
  * @NoAdminRequired
  * @UseSession
  *
  * @param string $oldPassword
  * @param string $newPassword
  * @return DataResponse
  */
 public function updatePrivateKeyPassword($oldPassword, $newPassword)
 {
     $result = false;
     $uid = $this->userSession->getUser()->getUID();
     $errorMessage = $this->l->t('Could not update the private key password.');
     //check if password is correct
     $passwordCorrect = $this->userManager->checkPassword($uid, $newPassword);
     if ($passwordCorrect !== false) {
         $encryptedKey = $this->keyManager->getPrivateKey($uid);
         $decryptedKey = $this->crypt->decryptPrivateKey($encryptedKey, $oldPassword);
         if ($decryptedKey) {
             $encryptedKey = $this->crypt->symmetricEncryptFileContent($decryptedKey, $newPassword);
             $header = $this->crypt->generateHeader();
             if ($encryptedKey) {
                 $this->keyManager->setPrivateKey($uid, $header . $encryptedKey);
                 $this->session->setPrivateKey($decryptedKey);
                 $result = true;
             }
         } else {
             $errorMessage = $this->l->t('The old password was not correct, please try again.');
         }
     } else {
         $errorMessage = $this->l->t('The current log-in password was not correct, please try again.');
     }
     if ($result === true) {
         $this->session->setStatus(Session::INIT_SUCCESSFUL);
         return new DataResponse(['message' => (string) $this->l->t('Private key password successfully updated.')]);
     } else {
         return new DataResponse(['message' => (string) $errorMessage], Http::STATUS_BAD_REQUEST);
     }
 }
开发者ID:samj1912,项目名称:repo,代码行数:39,代码来源:settingscontroller.php

示例4: setLogLevel

 /**
  * set log level for logger
  *
  * @param int $level
  * @return JSONResponse
  */
 public function setLogLevel($level)
 {
     if ($level < 0 || $level > 4) {
         return new JSONResponse(['message' => (string) $this->l10n->t('log-level out of allowed range')], Http::STATUS_BAD_REQUEST);
     }
     $this->config->setSystemValue('loglevel', $level);
     return new JSONResponse(['level' => $level]);
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:14,代码来源:LogSettingsController.php

示例5: validatePrice

 private function validatePrice()
 {
     $price = $this->request->getParam("price");
     $name = $this->l10n->t("Price");
     if (!$this->validator->validateRequired($name, $price)) {
         return;
     }
     $this->validator->validateFloat($name, $price);
 }
开发者ID:ChristophWurst,项目名称:fuel,代码行数:9,代码来源:recordvalidationmiddleware.php

示例6: __construct

 public function __construct(IL10N $l, OpenStack $openstackAuth, Rackspace $rackspaceAuth)
 {
     $this->setIdentifier('swift')->addIdentifierAlias('\\OC\\Files\\Storage\\Swift')->setStorageClass('\\OCA\\Files_External\\Lib\\Storage\\Swift')->setText($l->t('OpenStack Object Storage'))->addParameters([(new DefinitionParameter('service_name', $l->t('Service name')))->setFlag(DefinitionParameter::FLAG_OPTIONAL), (new DefinitionParameter('region', $l->t('Region')))->setFlag(DefinitionParameter::FLAG_OPTIONAL), new DefinitionParameter('bucket', $l->t('Bucket')), (new DefinitionParameter('timeout', $l->t('Request timeout (seconds)')))->setFlag(DefinitionParameter::FLAG_OPTIONAL)])->addAuthScheme(AuthMechanism::SCHEME_OPENSTACK)->setLegacyAuthMechanismCallback(function (array $params) use($openstackAuth, $rackspaceAuth) {
         if (isset($params['options']['key']) && $params['options']['key']) {
             return $rackspaceAuth;
         }
         return $openstackAuth;
     });
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:9,代码来源:Swift.php

示例7: destroy

 /**
  * @param string $id
  * @return DataResponse
  */
 public function destroy($id)
 {
     $group = $this->groupManager->get($id);
     if ($group) {
         if ($group->delete()) {
             return new DataResponse(array('status' => 'success', 'data' => array('groupname' => $id)), Http::STATUS_NO_CONTENT);
         }
     }
     return new DataResponse(array('status' => 'error', 'data' => array('message' => (string) $this->l10n->t('Unable to delete group.'))), Http::STATUS_FORBIDDEN);
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:14,代码来源:groupscontroller.php

示例8: afterException

 /**
  * Log error message and return a response which can be displayed to the user
  *
  * @param \OCP\AppFramework\Controller $controller
  * @param string $methodName
  * @param \Exception $exception
  * @return JSONResponse
  */
 public function afterException($controller, $methodName, \Exception $exception)
 {
     $this->logger->error($exception->getMessage(), ['app' => $this->appName]);
     if ($exception instanceof HintException) {
         $message = $exception->getHint();
     } else {
         $message = $this->l->t('Unknown error');
     }
     return new JSONResponse(['message' => $message], Http::STATUS_BAD_REQUEST);
 }
开发者ID:kenwi,项目名称:core,代码行数:18,代码来源:addservermiddleware.php

示例9: save

 /**
  * Save Parameters
  * @param string $avMode - antivirus mode
  * @param string $avSocket - path to socket (Socket mode)
  * @param string $avHost - antivirus url
  * @param int $avPort - port
  * @param string $avCmdOptions - extra command line options
  * @param int $avChunkSize - Size of one portion
  * @param string $avPath - path to antivirus executable (Executable mode)
  * @param string $avInfectedAction - action performed on infected files
  * @return JSONResponse
  */
 public function save($avMode, $avSocket, $avHost, $avPort, $avCmdOptions, $avChunkSize, $avPath, $avInfectedAction)
 {
     $this->settings->setAvMode($avMode);
     $this->settings->setAvSocket($avSocket);
     $this->settings->setAvHost($avHost);
     $this->settings->setAvPort($avPort);
     $this->settings->setAvCmdOptions($avCmdOptions);
     $this->settings->setAvChunkSize($avChunkSize);
     $this->settings->setAvPath($avPath);
     $this->settings->setAvInfectedAction($avInfectedAction);
     return new JSONResponse(array('data' => array('message' => (string) $this->l10n->t('Saved')), 'status' => 'success', 'settings' => $this->settings->getAllValues()));
 }
开发者ID:drognisep,项目名称:Portfolio-Site,代码行数:24,代码来源:settingscontroller.php

示例10: getNotificationTypes

 /**
  * @param \OCP\IL10N $l
  * @return array Array "stringID of the type" => "translated string description for the setting"
  */
 public function getNotificationTypes(\OCP\IL10N $l)
 {
     if (isset($this->notificationTypes[$l->getLanguageCode()])) {
         return $this->notificationTypes[$l->getLanguageCode()];
     }
     $notificationTypes = array(self::TYPE_SHARED => $l->t('A file or folder has been <strong>shared</strong>'), self::TYPE_SHARE_CREATED => $l->t('A new file or folder has been <strong>created</strong>'), self::TYPE_SHARE_CHANGED => $l->t('A file or folder has been <strong>changed</strong>'), self::TYPE_SHARE_DELETED => $l->t('A file or folder has been <strong>deleted</strong>'), self::TYPE_SHARE_RESTORED => $l->t('A file or folder has been <strong>restored</strong>'));
     // Allow other apps to add new notification types
     $additionalNotificationTypes = $this->activityManager->getNotificationTypes($l->getLanguageCode());
     $notificationTypes = array_merge($notificationTypes, $additionalNotificationTypes);
     $this->notificationTypes[$l->getLanguageCode()] = $notificationTypes;
     return $notificationTypes;
 }
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:16,代码来源:data.php

示例11: format

 /**
  * @param IEvent $event
  * @param string $parameter The parameter to be formatted
  * @return string The formatted parameter
  */
 public function format(IEvent $event, $parameter)
 {
     // If the username is empty, the action has been performed by a remote
     // user, or via a public share. We don't know the username in that case
     if ($parameter === '') {
         return '<user display-name="' . Util::sanitizeHTML($this->l->t('"remote user"')) . '">' . Util::sanitizeHTML('') . '</user>';
     }
     $user = $this->manager->get($parameter);
     $displayName = $user ? $user->getDisplayName() : $parameter;
     $parameter = Util::sanitizeHTML($parameter);
     return '<user display-name="' . Util::sanitizeHTML($displayName) . '">' . Util::sanitizeHTML($parameter) . '</user>';
 }
开发者ID:drognisep,项目名称:Portfolio-Site,代码行数:17,代码来源:UserFormatter.php

示例12: setBackupScheduled

 /**
  * @ControllerManaged
  *
  * @param boolean $scheduled        	
  */
 protected function setBackupScheduled($scheduled)
 {
     $statusContainer = $this->backupService->createStatusInformation();
     if ($statusContainer->getOverallStatus() == StatusContainer::ERROR) {
         throw new EasyBackupException($this->trans->t('Not all preconditions are met, backup cannot be scheduled'));
     }
     $this->configService->setBackupScheduled($scheduled);
     if ($scheduled) {
         $this->backupService->scheduleBackupJob();
     } else {
         $this->backupService->unScheduleBackupJob();
     }
 }
开发者ID:ArcherSys,项目名称:ArcherSysOSCloud7,代码行数:18,代码来源:backupcontroller.php

示例13: addServer

 /**
  * add server to the list of trusted ownCloud servers
  *
  * @param string $url
  * @return int
  * @throws HintException
  */
 public function addServer($url)
 {
     $hash = $this->hash($url);
     $query = $this->connection->getQueryBuilder();
     $query->insert($this->dbTable)->values(['url' => $query->createParameter('url'), 'url_hash' => $query->createParameter('url_hash')])->setParameter('url', $url)->setParameter('url_hash', $hash);
     $result = $query->execute();
     if ($result) {
         return (int) $this->connection->lastInsertId('*PREFIX*' . $this->dbTable);
     } else {
         $message = 'Internal failure, Could not add ownCloud as trusted server: ' . $url;
         $message_t = $this->l->t('Could not add server');
         throw new HintException($message, $message_t);
     }
 }
开发者ID:reverserob,项目名称:core,代码行数:21,代码来源:dbhandler.php

示例14: listCategories

 /**
  * Get all available categories
  * @return array
  */
 public function listCategories()
 {
     $categories = array(array('id' => 0, 'displayName' => (string) $this->l10n->t('Enabled')), array('id' => 1, 'displayName' => (string) $this->l10n->t('Not enabled')));
     if ($this->config->getSystemValue('appstoreenabled', true)) {
         $categories[] = array('id' => 2, 'displayName' => (string) $this->l10n->t('Recommended'));
         // apps from external repo via OCS
         $ocs = \OC_OCSClient::getCategories();
         foreach ($ocs as $k => $v) {
             $categories[] = array('id' => $k, 'displayName' => str_replace('ownCloud ', '', $v));
         }
     }
     $categories['status'] = 'success';
     return $categories;
 }
开发者ID:Romua1d,项目名称:core,代码行数:18,代码来源:appsettingscontroller.php

示例15: __construct

 public function __construct(IL10N $l, ISession $session, ICrypto $crypto)
 {
     $this->session = $session;
     $this->crypto = $crypto;
     $this->setIdentifier('password::sessioncredentials')->setScheme(self::SCHEME_PASSWORD)->setText($l->t('Session credentials'))->addParameters([]);
     \OCP\Util::connectHook('OC_User', 'post_login', $this, 'authenticate');
 }
开发者ID:kenwi,项目名称:core,代码行数:7,代码来源:sessioncredentials.php


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