當前位置: 首頁>>代碼示例>>PHP>>正文


PHP OCP\IL10N類代碼示例

本文整理匯總了PHP中OCP\IL10N的典型用法代碼示例。如果您正苦於以下問題:PHP IL10N類的具體用法?PHP IL10N怎麽用?PHP IL10N使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了IL10N類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 public function __construct(BackendInterface $caldavBackend, $calendarInfo, IL10N $l10n)
 {
     parent::__construct($caldavBackend, $calendarInfo);
     if ($this->getName() === BirthdayService::BIRTHDAY_CALENDAR_URI) {
         $this->calendarInfo['{DAV:}displayname'] = $l10n->t('Contact birthdays');
     }
 }
開發者ID:stweil,項目名稱:owncloud-core,代碼行數:7,代碼來源:calendar.php

示例2: __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

示例3: __construct

 public function __construct(IL10N $l, ISession $session, ICredentialsManager $credentialsManager)
 {
     $this->session = $session;
     $this->credentialsManager = $credentialsManager;
     $this->setIdentifier('password::logincredentials')->setScheme(self::SCHEME_PASSWORD)->setText($l->t('Log-in credentials, save in database'))->addParameters([]);
     \OCP\Util::connectHook('OC_User', 'post_login', $this, 'authenticate');
 }
開發者ID:farukuzun,項目名稱:core-1,代碼行數:7,代碼來源:logincredentials.php

示例4: setUp

 public function setUp()
 {
     parent::setUp();
     $this->l10n = $this->getMockBuilder('\\OCP\\IL10N')->disableOriginalConstructor()->getMock();
     $this->l10n->expects($this->any())->method('t')->will($this->returnCallback(function ($text, $parameters = array()) {
         return vsprintf($text, $parameters);
     }));
 }
開發者ID:GitHubUser4234,項目名稱:core,代碼行數:8,代碼來源:CalendarTest.php

示例5: 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()];
     }
     // Allow apps to add new notification types
     $notificationTypes = $this->activityManager->getNotificationTypes($l->getLanguageCode());
     $this->notificationTypes[$l->getLanguageCode()] = $notificationTypes;
     return $notificationTypes;
 }
開發者ID:samj1912,項目名稱:repo,代碼行數:14,代碼來源:data.php

示例6: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->urlGenerator = $this->getMockBuilder('OCP\\IURLGenerator')->disableOriginalConstructor()->getMock();
     $this->infoCache = $this->getMockBuilder('OCA\\Activity\\ViewInfoCache')->disableOriginalConstructor()->getMock();
     $this->l = $this->getMockBuilder('OCP\\IL10N')->disableOriginalConstructor()->getMock();
     $this->l->expects($this->any())->method('t')->willReturnCallback(function ($string, $parameters) {
         return vsprintf($string, $parameters);
     });
 }
開發者ID:arietimmerman,項目名稱:activity,代碼行數:10,代碼來源:fileformattertest.php

示例7: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->sessionMock = $this->getMockBuilder('OCA\\Encryption\\Session')->disableOriginalConstructor()->getMock();
     $this->requestMock = $this->getMock('OCP\\IRequest');
     $this->l10nMock = $this->getMockBuilder('OCP\\IL10N')->disableOriginalConstructor()->getMock();
     $this->l10nMock->expects($this->any())->method('t')->will($this->returnCallback(function ($message) {
         return $message;
     }));
     $this->controller = new StatusController('encryptionTest', $this->requestMock, $this->l10nMock, $this->sessionMock);
 }
開發者ID:rchicoli,項目名稱:owncloud-core,代碼行數:11,代碼來源:StatusControllerTest.php

示例8: 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

示例9: getNameString

 public function getNameString(IL10N $l10n)
 {
     $name = $this->getName();
     if ($name === null) {
         $name = $l10n->t('Unknown artist');
         if (!is_string($name)) {
             /** @var \OC_L10N_String $name */
             $name = $name->__toString();
         }
     }
     return $name;
 }
開發者ID:pellaeon,項目名稱:music,代碼行數:12,代碼來源:artist.php

示例10: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->manager = $this->getMockBuilder('OCA\\AnnouncementCenter\\Manager')->disableOriginalConstructor()->getMock();
     $this->l = $this->getMockBuilder('OCP\\IL10N')->disableOriginalConstructor()->getMock();
     $this->l->expects($this->any())->method('t')->willReturnCallback(function ($string, $args) {
         return vsprintf($string, $args);
     });
     $this->factory = $this->getMockBuilder('OCP\\L10N\\IFactory')->disableOriginalConstructor()->getMock();
     $this->factory->expects($this->any())->method('get')->willReturn($this->l);
     $this->notifier = new NotificationsNotifier($this->manager, $this->factory);
 }
開發者ID:arietimmerman,項目名稱:announcementcenter,代碼行數:12,代碼來源:NotificationsNotifierTest.php

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: 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


注:本文中的OCP\IL10N類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。