本文整理汇总了PHP中OC_L10N::get方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_L10N::get方法的具体用法?PHP OC_L10N::get怎么用?PHP OC_L10N::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_L10N
的用法示例。
在下文中一共展示了OC_L10N::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendEmail
public static function sendEmail($args)
{
if (OC_User::userExists($_POST['user'])) {
$token = hash('sha256', OC_Util::generate_random_bytes(30) . OC_Config::getValue('passwordsalt', ''));
OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', hash('sha256', $token));
// Hash the token again to prevent timing attacks
$email = OC_Preferences::getValue($_POST['user'], 'settings', 'email', '');
if (!empty($email)) {
$link = OC_Helper::linkToRoute('core_lostpassword_reset', array('user' => $_POST['user'], 'token' => $token));
$link = OC_Helper::makeURLAbsolute($link);
$tmpl = new OC_Template('core/lostpassword', 'email');
$tmpl->assign('link', $link, false);
$msg = $tmpl->fetchPage();
$l = OC_L10N::get('core');
$from = 'lostpassword-noreply@' . OCP\Util::getServerHost();
OC_Mail::send($email, $_POST['user'], $l->t('ownCloud password reset'), $msg, $from, 'ownCloud');
echo 'Mailsent';
self::displayLostPasswordPage(false, true);
} else {
self::displayLostPasswordPage(true, false);
}
} else {
self::displayLostPasswordPage(true, false);
}
}
示例2: __construct
function __construct()
{
$this->l = OC_L10N::get('lib');
$version = OC_Util::getVersion();
$this->defaultEntity = 'ownCloud';
/* e.g. company name, used for footers and copyright notices */
$this->defaultName = 'ownCloud';
/* short name, used when referring to the software */
$this->defaultTitle = 'ownCloud';
/* can be a longer name, for titles */
$this->defaultBaseUrl = 'https://owncloud.org';
$this->defaultSyncClientUrl = 'https://owncloud.org/sync-clients/';
$this->defaultiOSClientUrl = 'https://itunes.apple.com/us/app/owncloud/id543672169?mt=8';
$this->defaultAndroidClientUrl = 'https://play.google.com/store/apps/details?id=com.owncloud.android';
$this->defaultDocBaseUrl = 'http://doc.owncloud.org';
$this->defaultDocVersion = $version[0] . '.0';
// used to generate doc links
$this->defaultSlogan = $this->l->t('web services under your control');
$this->defaultLogoClaim = '';
$this->defaultMailHeaderColor = '#1d2d44';
/* header color of mail notifications */
if (file_exists(OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php')) {
// prevent defaults.php from printing output
ob_start();
require_once 'themes/' . OC_Util::getTheme() . '/defaults.php';
ob_end_clean();
$this->theme = new OC_Theme();
}
}
示例3: search
function search($query)
{
$collection = new Collection(\OCP\User::getUser());
$l = \OC_L10N::get('media');
$app_name = (string) $l->t('Music');
$artists = $collection->getArtists($query);
$albums = $collection->getAlbums(0, $query);
$songs = $collection->getSongs(0, 0, $query);
$results = array();
foreach ($artists as $artist) {
$results[] = new \OC_Search_Result($artist['artist_name'], '', \OCP\Util::linkTo('media', 'index.php') . '#artist=' . urlencode($artist['artist_name']), $app_name);
}
foreach ($albums as $album) {
$artist = $collection->getArtistName($album['album_artist']);
$results[] = new \OC_Search_Result($album['album_name'], 'by ' . $artist, \OCP\Util::linkTo('media', 'index.php') . '#artist=' . urlencode($artist) . '&album=' . urlencode($album['album_name']), $app_name);
}
foreach ($songs as $song) {
$minutes = floor($song['song_length'] / 60);
$seconds = $song['song_length'] % 60;
$artist = $collection->getArtistName($song['song_artist']);
$album = $collection->getalbumName($song['song_album']);
$results[] = new \OC_Search_Result($song['song_name'], "by {$artist}, in {$album} {$minutes}:{$seconds}", \OCP\Util::linkTo('media', 'index.php') . '#artist=' . urlencode($artist) . '&album=' . urlencode($album) . '&song=' . urlencode($song['song_name']), $app_name);
}
return $results;
}
示例4: sendEmail
public static function sendEmail($args)
{
$isEncrypted = OC_App::isEnabled('files_encryption');
if (!$isEncrypted || isset($_POST['continue'])) {
$continue = true;
} else {
$continue = false;
}
if (OC_User::userExists($_POST['user']) && $continue) {
$token = hash('sha256', OC_Util::generate_random_bytes(30) . OC_Config::getValue('passwordsalt', ''));
OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', hash('sha256', $token));
// Hash the token again to prevent timing attacks
$email = OC_Preferences::getValue($_POST['user'], 'settings', 'email', '');
if (!empty($email)) {
$link = OC_Helper::linkToRoute('core_lostpassword_reset', array('user' => $_POST['user'], 'token' => $token));
$link = OC_Helper::makeURLAbsolute($link);
$tmpl = new OC_Template('core/lostpassword', 'email');
$tmpl->assign('link', $link, false);
$msg = $tmpl->fetchPage();
$l = OC_L10N::get('core');
$from = OCP\Util::getDefaultEmailAddress('lostpassword-noreply');
try {
OC_Mail::send($email, $_POST['user'], $l->t('ownCloud password reset'), $msg, $from, 'ownCloud');
} catch (Exception $e) {
OC_Template::printErrorPage('A problem occurs during sending the e-mail please contact your administrator.');
}
self::displayLostPasswordPage(false, true);
} else {
self::displayLostPasswordPage(true, false);
}
} else {
self::displayLostPasswordPage(true, false);
}
}
示例5: set
/**
* sets the users avatar
* @param \OC_Image|resource|string $data OC_Image, imagedata or path to set a new avatar
* @throws Exception if the provided file is not a jpg or png image
* @throws Exception if the provided image is not valid
* @throws \OC\NotSquareException if the image is not square
* @return void
*/
public function set($data)
{
if ($data instanceof OC_Image) {
$img = $data;
$data = $img->data();
} else {
$img = new OC_Image($data);
}
$type = substr($img->mimeType(), -3);
if ($type === 'peg') {
$type = 'jpg';
}
if ($type !== 'jpg' && $type !== 'png') {
$l = \OC_L10N::get('lib');
throw new \Exception($l->t("Unknown filetype"));
}
if (!$img->valid()) {
$l = \OC_L10N::get('lib');
throw new \Exception($l->t("Invalid image"));
}
if (!($img->height() === $img->width())) {
throw new \OC\NotSquareException();
}
$this->view->unlink('avatar.jpg');
$this->view->unlink('avatar.png');
$this->view->file_put_contents('avatar.' . $type, $data);
}
示例6: search
function search($query)
{
require_once 'lib_collection.php';
$l = OC_L10N::get('media');
$app_name = (string) $l->t('Music');
$artists = OC_MEDIA_COLLECTION::getArtists($query);
$albums = OC_MEDIA_COLLECTION::getAlbums(0, $query);
$songs = OC_MEDIA_COLLECTION::getSongs(0, 0, $query);
$results = array();
foreach ($artists as $artist) {
$results[] = new OC_Search_Result($artist['artist_name'], '', OCP\Util::linkTo('media', 'index.php') . '#artist=' . urlencode($artist['artist_name']), $app_name);
}
foreach ($albums as $album) {
$artist = OC_MEDIA_COLLECTION::getArtistName($album['album_artist']);
$results[] = new OC_Search_Result($album['album_name'], 'by ' . $artist, OCP\Util::linkTo('media', 'index.php') . '#artist=' . urlencode($artist) . '&album=' . urlencode($album['album_name']), $app_name);
}
foreach ($songs as $song) {
$minutes = floor($song['song_length'] / 60);
$secconds = $song['song_length'] % 60;
$artist = OC_MEDIA_COLLECTION::getArtistName($song['song_artist']);
$album = OC_MEDIA_COLLECTION::getalbumName($song['song_album']);
$results[] = new OC_Search_Result($song['song_name'], "by {$artist}, in {$album} {$minutes}:{$secconds}", OCP\Util::linkTo('media', 'index.php') . '#artist=' . urlencode($artist) . '&album=' . urlencode($album) . '&song=' . urlencode($song['song_name']), $app_name);
}
return $results;
}
示例7: validatepassword
public function validatepassword($password)
{
$response = array();
$error = '';
if (strlen($password) < intval($this->service->getAppValue('minlength'))) {
$error .= \OC_L10N::get('passwordpolicy')->t('Password is too short. ');
}
if ($this->service->getAppValue('hasnumbers') == "true") {
if (preg_match("/[0-9]/", $password) != 1) {
$error .= \OC_L10N::get('passwordpolicy')->t('Password does not contain numbers. ');
}
}
if ($this->service->getAppValue('hasspecialchars') == "true") {
$specialcharslist = $this->service->getAppValue('specialcharslist');
if (!checkSpecialChars($specialcharslist, $password)) {
$error .= \OC_L10N::get('passwordpolicy')->t('Password does not contain special characters. ');
}
}
if ($this->service->getAppValue('hasmixedcase') == "true") {
if (!checkMixedCase($password)) {
$error .= \OC_L10N::get('passwordpolicy')->t('Password does not contain upper and lower case characters.');
}
}
if (!empty($error)) {
$errormsg = \OC_L10N::get('passwordpolicy')->t('Password does not conform to the Password Policy. [%s]', [$error]);
if ($this->request->server['PATH_INFO'] == "/settings/personal/changepassword") {
$response = array('status' => "Failure", 'data' => array('message' => "{$errormsg}"));
} else {
$response = array('status' => "Failure", 'msg' => "{$errormsg}");
}
}
return $response;
}
示例8: checkSubAdminUser
/**
* Check if the user is a subadmin, send json error msg if not
*/
public static function checkSubAdminUser()
{
if (!OC_SubAdmin::isSubAdmin(OC_User::getUser())) {
$l = OC_L10N::get('lib');
self::error(array('data' => array('message' => $l->t('Authentication error'), 'error' => 'authentication_error')));
exit;
}
}
示例9: __construct
/**
* Constructor
* @param Configuration $configuration an instance of Configuration
* @param ILDAPWrapper $ldap an instance of ILDAPWrapper
*/
public function __construct(Configuration $configuration, ILDAPWrapper $ldap) {
parent::__construct($ldap);
$this->configuration = $configuration;
if(is_null(Wizard::$l)) {
Wizard::$l = \OC_L10N::get('user_ldap');
}
$this->result = new WizardResult;
}
示例10: init
public static function init()
{
\OC::$CLASSPATH['OCA_Gsync\\Contact'] = self::APP_ID . '/lib/contact.php';
\OC::$CLASSPATH['OCA_Gsync\\Request'] = self::APP_ID . '/lib/request.php';
\OC::$CLASSPATH['OCA_Gsync\\Adapter'] = self::APP_ID . '/lib/adapter.php';
\OCP\App::registerPersonal(self::APP_ID, 'settings');
self::$l10n = \OC_L10N::get('core');
}
示例11: checkSubAdminUser
/**
* Check if the user is a subadmin, send json error msg if not
*/
public static function checkSubAdminUser()
{
self::checkLoggedIn();
if (!OC_Group::inGroup(OC_User::getUser(), 'admin') && !OC_SubAdmin::isSubAdmin(OC_User::getUser())) {
$l = OC_L10N::get('lib');
self::error(array('data' => array('message' => $l->t('Authentication error'))));
exit;
}
}
示例12: __construct
public function __construct($appName, IRequest $request, $userId, IConfig $config, PathMapper $pathMapper, ContentMapper $contentMapper){
parent::__construct($appName, $request);
$this->trans = \OC_L10N::get('secure_container');
$this->userId = $userId;
$this->config = $config;
$this->pathMapper = $pathMapper;
$this->contentMapper = $contentMapper;
}
示例13: __construct
/**
*
* @param string $sender user id (if nothing is set we use the currently logged-in user)
*/
public function __construct($sender = null)
{
$this->l = \OC_L10N::get('core');
$this->senderId = $sender;
$this->from = \OCP\Util::getDefaultEmailAddress('sharing-noreply');
if ($this->senderId) {
$this->from = \OCP\Config::getUserValue($this->senderId, 'settings', 'email', $this->from);
$this->senderDisplayName = \OCP\User::getDisplayName($this->senderId);
} else {
$this->senderDisplayName = \OCP\User::getDisplayName();
}
}
示例14: shutdown
function shutdown()
{
$l = OC_L10N::get('news');
$error = error_get_last();
if ($error['type'] & (E_ERROR | E_COMPILE_ERROR | E_CORE_ERROR)) {
//all fatal errors
if (strpos($error['message'], 'get_uri')) {
//handle a fatal error caused by a SimplePie bug (https://github.com/simplepie/simplepie/issues/214)
OCP\Util::writeLog('news', 'ajax/createfeed.php: Fatal error:' . $error['message'], OCP\Util::ERROR);
exit;
}
}
}
示例15: getExpertiseString
/**
* @brief Finds the expertise level given the level value
* @param Expertise level value
* @return string (Expertise level string)
*/
public static function getExpertiseString($val)
{
$l = OC_L10N::get('collaboration');
switch ($val) {
case 1:
return $l->t('Beginner');
case 2:
return $l->t('Intermediate');
case 3:
return $l->t('Expert');
}
return $val;
}