本文整理汇总了PHP中OC_L10N::l方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_L10N::l方法的具体用法?PHP OC_L10N::l怎么用?PHP OC_L10N::l使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_L10N
的用法示例。
在下文中一共展示了OC_L10N::l方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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)
{
$formatedDate = $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', $formatedDate);
$htmlMail = $html->fetchPage();
$alttext = new \OC_Template("core", "altmail", "");
$alttext->assign('link', $link);
$alttext->assign('user_displayname', $this->senderDisplayName);
$alttext->assign('filename', $filename);
$alttext->assign('expiration', $formatedDate);
$alttextMail = $alttext->fetchPage();
return array($htmlMail, $alttextMail);
}
示例2: testFirstWeekDay
/**
* @dataProvider firstDayDataProvider
* @param $expected
* @param $lang
*/
public function testFirstWeekDay($expected, $lang)
{
$l = new OC_L10N('test');
$l->forceLanguage($lang);
$this->assertSame($expected, $l->l('firstday', 'firstday'));
}
示例3: basename
<?php
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
$l = new OC_L10N('core');
if (!isset($_FILES['rootcert_import'])) {
OCP\JSON::error(array('error' => 'No certificate uploaded'));
exit;
}
$data = file_get_contents($_FILES['rootcert_import']['tmp_name']);
$filename = basename($_FILES['rootcert_import']['name']);
$certificateManager = \OC::$server->getCertificateManager();
try {
$cert = $certificateManager->addCertificate($data, $filename);
OCP\JSON::success(array('name' => $cert->getName(), 'commonName' => $cert->getCommonName(), 'organization' => $cert->getOrganization(), 'validFrom' => $cert->getIssueDate()->getTimestamp(), 'validTill' => $cert->getExpireDate()->getTimestamp(), 'validFromString' => $l->l('date', $cert->getIssueDate()), 'validTillString' => $l->l('date', $cert->getExpireDate()), 'issuer' => $cert->getIssuerName(), 'issuerOrganization' => $cert->getIssuerOrganization()));
} catch (\Exception $e) {
OCP\JSON::error(array('error' => 'Couldn\'t import SSL root certificate, allowed formats: PEM and DER'));
}
示例4: generateRelativeDatetime
/**
* Creates a relative datetime string (with today, yesterday) or the normal date
*
* @param \OC_L10N $l
* @param $timestamp
* @return string
*/
protected function generateRelativeDatetime(\OC_L10N $l, $timestamp)
{
$dateOfTimestamp = $l->l('date', $timestamp);
$dateOfToday = $l->l('date', time());
$dateOfYesterday = $l->l('date', time() - 3600 * 24);
if ($dateOfTimestamp === $dateOfToday) {
return (string) $l->t('Today %s', $l->l('time', $timestamp));
}
if ($dateOfTimestamp === $dateOfYesterday) {
return (string) $l->t('Yesterday %s', $l->l('time', $timestamp));
}
return (string) $l->l('datetime', $timestamp);
}
示例5: testNumericToDateTime
public function testNumericToDateTime()
{
$l = new OC_L10N('test');
$this->assertSame('February 13, 2009 23:31', $l->l('datetime', 1234567890));
}