本文整理汇总了PHP中OCP\IL10N类的典型用法代码示例。如果您正苦于以下问题:PHP IL10N类的具体用法?PHP IL10N怎么用?PHP IL10N使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IL10N类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: setUp
public function setUp()
{
$this->request = $this->getMockBuilder('\\OCP\\IRequest')->disableOriginalConstructor()->getMock();
$this->l10n = $this->getMockBuilder('\\OCP\\IL10N')->disableOriginalConstructor()->getMock();
$this->l10n->expects($this->any())->method('t')->will($this->returnCallback(function ($message, array $replace) {
return vsprintf($message, $replace);
}));
$this->config = $this->getMockBuilder('\\OCP\\IConfig')->disableOriginalConstructor()->getMock();
$this->connection = $this->getMockBuilder('\\OC\\DB\\Connection')->disableOriginalConstructor()->getMock();
$this->userManager = $this->getMockBuilder('\\OCP\\IUserManager')->disableOriginalConstructor()->getMock();
$this->view = $this->getMockBuilder('\\OC\\Files\\View')->disableOriginalConstructor()->getMock();
$this->logger = $this->getMockBuilder('\\OCP\\ILogger')->disableOriginalConstructor()->getMock();
$this->encryptionController = $this->getMockBuilder('\\OC\\Settings\\Controller\\EncryptionController')->setConstructorArgs(['settings', $this->request, $this->l10n, $this->config, $this->connection, $this->userManager, $this->view, $this->logger])->setMethods(['getMigration'])->getMock();
}
开发者ID:evanjt,项目名称:core,代码行数:14,代码来源:EncryptionControllerTest.php
示例12: setUp
public function setUp()
{
parent::setUp();
$this->l10n = $this->getMockBuilder('\\OCP\\IL10N')->disableOriginalConstructor()->getMock();
$this->mailer = $this->getMockBuilder('\\OCP\\Mail\\IMailer')->disableOriginalConstructor()->getMock();
$this->logger = $this->getMockBuilder('\\OCP\\ILogger')->disableOriginalConstructor()->getMock();
$this->defaults = $this->getMockBuilder('\\OCP\\Defaults')->disableOriginalConstructor()->getMock();
$this->user = $this->getMockBuilder('\\OCP\\IUser')->disableOriginalConstructor()->getMock();
$this->l10n->expects($this->any())->method('t')->will($this->returnCallback(function ($text, $parameters = array()) {
return vsprintf($text, $parameters);
}));
$this->defaults->expects($this->once())->method('getName')->will($this->returnValue('UnitTestCloud'));
$this->user->expects($this->once())->method('getEMailAddress')->willReturn('[email protected]');
$this->user->expects($this->once())->method('getDisplayName')->willReturn('TestUser');
}
开发者ID:kenwi,项目名称:core,代码行数:15,代码来源:MailNotificationsTest.php
示例13: setUp
public function setUp()
{
parent::setUp();
$this->storageMock = $this->getMockBuilder('OCP\\Files\\Storage')->disableOriginalConstructor()->getMock();
$this->cryptMock = $this->getMockBuilder('OCA\\Encryption\\Crypto\\Crypt')->disableOriginalConstructor()->getMock();
$this->utilMock = $this->getMockBuilder('OCA\\Encryption\\Util')->disableOriginalConstructor()->getMock();
$this->keyManagerMock = $this->getMockBuilder('OCA\\Encryption\\KeyManager')->disableOriginalConstructor()->getMock();
$this->sessionMock = $this->getMockBuilder('OCA\\Encryption\\Session')->disableOriginalConstructor()->getMock();
$this->encryptAllMock = $this->getMockBuilder('OCA\\Encryption\\Crypto\\EncryptAll')->disableOriginalConstructor()->getMock();
$this->decryptAllMock = $this->getMockBuilder('OCA\\Encryption\\Crypto\\DecryptAll')->disableOriginalConstructor()->getMock();
$this->loggerMock = $this->getMockBuilder('OCP\\ILogger')->disableOriginalConstructor()->getMock();
$this->l10nMock = $this->getMockBuilder('OCP\\IL10N')->disableOriginalConstructor()->getMock();
$this->l10nMock->expects($this->any())->method('t')->with($this->anything())->willReturnArgument(0);
$this->instance = new Encryption($this->cryptMock, $this->keyManagerMock, $this->utilMock, $this->sessionMock, $this->encryptAllMock, $this->decryptAllMock, $this->loggerMock, $this->l10nMock);
}
开发者ID:GitHubUser4234,项目名称:core,代码行数:15,代码来源:EncryptionTest.php
示例14: setUp
public function setUp()
{
parent::setUp();
$this->request = $this->getMockBuilder('\\OCP\\IRequest')->disableOriginalConstructor()->getMock();
$this->config = $this->getMockBuilder('\\OCP\\IConfig')->disableOriginalConstructor()->getMock();
$this->config = $this->getMockBuilder('\\OCP\\IConfig')->disableOriginalConstructor()->getMock();
$this->clientService = $this->getMockBuilder('\\OCP\\Http\\Client\\IClientService')->disableOriginalConstructor()->getMock();
$this->util = $this->getMockBuilder('\\OC_Util')->disableOriginalConstructor()->getMock();
$this->urlGenerator = $this->getMockBuilder('\\OCP\\IURLGenerator')->disableOriginalConstructor()->getMock();
$this->l10n = $this->getMockBuilder('\\OCP\\IL10N')->disableOriginalConstructor()->getMock();
$this->l10n->expects($this->any())->method('t')->will($this->returnCallback(function ($message, array $replace) {
return vsprintf($message, $replace);
}));
$this->checkSetupController = $this->getMockBuilder('\\OC\\Settings\\Controller\\CheckSetupController')->setConstructorArgs(['settings', $this->request, $this->config, $this->clientService, $this->urlGenerator, $this->util, $this->l10n])->setMethods(['getCurlVersion'])->getMock();
}
开发者ID:GrumpyCrouton,项目名称:core,代码行数:15,代码来源:CheckSetupControllerTest.php
示例15: setUp
public function setUp()
{
parent::setUp();
$this->request = $this->getMockBuilder('\\OCP\\IRequest')->disableOriginalConstructor()->getMock();
$this->l10n = $this->getMockBuilder('\\OCP\\IL10N')->disableOriginalConstructor()->getMock();
$this->l10n->expects($this->any())->method('t')->will($this->returnArgument(0));
$this->config = $this->getMockBuilder('\\OCP\\IConfig')->disableOriginalConstructor()->getMock();
$cacheFactory = $this->getMockBuilder('\\OCP\\ICacheFactory')->disableOriginalConstructor()->getMock();
$this->cache = $this->getMockBuilder('\\OCP\\ICache')->disableOriginalConstructor()->getMock();
$cacheFactory->expects($this->once())->method('create')->with('settings')->will($this->returnValue($this->cache));
$this->navigationManager = $this->getMockBuilder('\\OCP\\INavigationManager')->disableOriginalConstructor()->getMock();
$this->appManager = $this->getMockBuilder('\\OCP\\App\\IAppManager')->disableOriginalConstructor()->getMock();
$this->ocsClient = $this->getMockBuilder('\\OC\\OCSClient')->disableOriginalConstructor()->getMock();
$this->appSettingsController = new AppSettingsController('settings', $this->request, $this->l10n, $this->config, $cacheFactory, $this->navigationManager, $this->appManager, $this->ocsClient);
}
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:15,代码来源:AppSettingsControllerTest.php
示例16: setUp
public function setUp()
{
$this->logger = $this->getMock('\\OCP\\ILogger');
$this->config = $this->getMock('\\OCP\\IConfig');
$this->defaultProvider = $this->getMock('\\OC\\Share20\\IShareProvider');
$this->secureRandom = $this->getMock('\\OCP\\Security\\ISecureRandom');
$this->hasher = $this->getMock('\\OCP\\Security\\IHasher');
$this->mountManager = $this->getMock('\\OCP\\Files\\Mount\\IMountManager');
$this->groupManager = $this->getMock('\\OCP\\IGroupManager');
$this->l = $this->getMock('\\OCP\\IL10N');
$this->l->method('t')->will($this->returnCallback(function ($text, $parameters = []) {
return vsprintf($text, $parameters);
}));
$this->manager = new Manager($this->logger, $this->config, $this->defaultProvider, $this->secureRandom, $this->hasher, $this->mountManager, $this->groupManager, $this->l);
}
开发者ID:gcstang,项目名称:core,代码行数:15,代码来源:managertest.php
示例17: setUp
protected function setUp()
{
parent::setUp();
$this->request = $this->getMockBuilder('OCP\\IRequest')->disableOriginalConstructor()->getMock();
$this->groupManager = $this->getMockBuilder('OCP\\IGroupManager')->disableOriginalConstructor()->getMock();
$this->userManager = $this->getMockBuilder('OCP\\IUserManager')->disableOriginalConstructor()->getMock();
$this->activityManager = $this->getMockBuilder('OCP\\Activity\\IManager')->disableOriginalConstructor()->getMock();
$this->notificationManager = $this->getMockBuilder('OC\\Notification\\IManager')->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->urlGenerator = $this->getMockBuilder('OCP\\IURLGenerator')->disableOriginalConstructor()->getMock();
$this->manager = $this->getMockBuilder('OCA\\AnnouncementCenter\\Manager')->disableOriginalConstructor()->getMock();
}
开发者ID:arietimmerman,项目名称:announcementcenter,代码行数:15,代码来源:PageControllerTest.php
示例18: 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
示例19: 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
示例20: 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
注:本文中的OCP\IL10N类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论