本文整理汇总了PHP中System::getLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP System::getLanguage方法的具体用法?PHP System::getLanguage怎么用?PHP System::getLanguage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System
的用法示例。
在下文中一共展示了System::getLanguage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: invokeHandler
protected function invokeHandler()
{
$specific = array();
$size = getimagesize($this->file->getAbsPath());
if ($size !== false) {
$specific['imagesize'] = $size[0] . ' x ' . $size[1] . ' px';
} else {
$specific['imagesize'] = System::getLanguage()->_('Unknown');
}
if (extension_loaded('imagick') && class_exists('Imagick')) {
try {
$i = new Imagick($this->file->getAbsPath());
$specific['format'] = $i->getimageformat();
} catch (Exception $e) {
Log::handleException($e, false);
if ($this->file->ext == "svg") {
Log::sysLog('ImageHandler', '"librsvg" is not installed. Without it Imagick could not handle .svg files!');
}
}
} else {
$specific['format'] = System::getLanguage()->_('Unknown');
}
$this->smarty->assign('specific', $specific);
$this->smarty->display('handler/image.tpl');
}
示例2: __construct
/**
* Construct
*/
public function __construct()
{
parent::__construct();
$this->JSRMS = new JSRMS();
$this->JSRMS->requireResource('system');
$this->muteExpectedErrors();
$this->setCacheDir(SYSTEM_ROOT . '/classes/smarty/cache/');
$this->setCompileDir(SYSTEM_ROOT . '/classes/smarty/templates_c/');
$this->setTemplateDir(SYSTEM_ROOT . '/view/');
$this->registerObject('Router', Router::getInstance(), array('build'), false);
$this->registerObject('L10N', System::getLanguage(), array('_'), false);
$this->assign('LoggedIn', System::getUser() != NULL);
$this->assign('User', System::getUser());
$this->assign('Navigation', Navigation::$elements);
$this->assign('LangStrings', System::getLanguage()->getAllStrings());
// Configuration
$this->assign('HTTP_BASEDIR', System::getBaseURL());
$this->assign('MOD_REWRITE', MOD_REWRITE);
$this->assign('MAX_UPLOAD_SIZE', Utils::maxUploadSize());
if (System::getSession()->getData('successMsg', '') != '') {
$this->assign('successMsg', System::getSession()->getData('successMsg', ''));
System::getSession()->setData('successMsg', '');
}
if (System::getSession()->getData('errorMsg', '') != '') {
$this->assign('errorMsg', System::getSession()->getData('errorMsg', ''));
System::getSession()->setData('errorMsg', '');
}
if (System::getSession()->getData('infoMsg', '') != '') {
$this->assign('infoMsg', System::getSession()->getData('infoMsg', ''));
System::getSession()->setData('infoMsg', '');
}
}
示例3: createRequest
/**
* Create new request and sends email to user
* @static
* @param string Mail adress
* @throws MailFailureException, UserNotFoundException
*/
public static function createRequest($mail)
{
LostPW::cleanUp();
$user = User::find('email', $mail);
if ($user == NULL) {
throw new UserNotFoundException();
}
// Delete old requests
$sql = System::getDatabase()->prepare('DELETE FROM lostpw WHERE user_ID = :uid');
$sql->execute(array(':uid' => $user->uid));
// Create new request
$hash = LostPW::createHash();
$sql = System::getDatabase()->prepare('INSERT INTO lostpw (user_ID, hash, time) VALUES (:uid, :hash, :time)');
$sql->execute(array(':uid' => $user->uid, ':hash' => $hash, ':time' => time()));
// Send Mail
$content = new Template();
$content->assign('link', Router::getInstance()->build('AuthController', 'lostpw_check', array('hash' => $hash)));
$content->assign('user', $user);
$content->assign('title', System::getLanguage()->_('LostPW'));
// Determine template file
$tpl = 'mails/lostpw.' . LANGUAGE . '.tpl';
foreach ($content->getTemplateDir() as $dir) {
$file = 'mails/lostpw.' . $user->lang . '.tpl';
if (file_exists($dir . $file)) {
$tpl = $file;
break;
}
}
$mail = new Mail(System::getLanguage()->_('LostPW'), $content->fetch($tpl), $user);
$mail->send();
}
示例4: smarty_modifier_lang
function smarty_modifier_lang($string, $param = NULL)
{
if ($param === NULL) {
return System::getLanguage()->_($string);
}
return sprintf(System::getLanguage()->_($string), $param);
}
示例5: loadFile
private function loadFile()
{
if ($this->file != NULL) {
return;
}
$this->file = File::find('alias', $this->getParam('alias', ''));
if ($this->file == NULL) {
System::displayError(System::getLanguage()->_('ErrorFileNotFound'), '404 Not Found');
}
if (System::getUser() != NULL) {
$user_id = System::getUser()->uid;
} else {
$user_id = -1;
}
if ($user_id != $this->file->uid) {
if ($this->file->permission == FilePermissions::PRIVATE_ACCESS) {
System::displayError(System::getLanguage()->_('PermissionDenied'), '403 Forbidden');
exit;
} elseif ($this->file->permission == FilePermissions::RESTRICTED_ACCESS) {
if (is_array(System::getSession()->getData("authenticatedFiles"))) {
if (!in_array($this->file->alias, System::getSession()->getData("authenticatedFiles"))) {
System::forwardToRoute(Router::getInstance()->build('AuthController', 'authenticateFile', $this->file));
exit;
}
} else {
System::forwardToRoute(Router::getInstance()->build('AuthController', 'authenticateFile', $this->file));
exit;
}
}
}
}
示例6: __construct
/**
* Constructor
* @param string Field name
* @param string Label
* @param boolean Required field?
*/
public function __construct($name, $label, $required = false)
{
$this->type = 'checkbox';
$this->name = $name;
$this->label = $label;
$this->required = $required;
$this->error_msg = System::getLanguage()->_('ErrorPleaseCheck');
}
示例7: __construct
/**
* Constructor
*
* @param string Name des Formulars
* @param string Formular-Ziel
* @param string Formular-Typ (POST)
*/
public function __construct($name, $action = '', $method = 'post')
{
$this->name = $name;
$this->action = $action;
$this->method = strtolower($method);
$this->submit = new Button(System::getLanguage()->_('Submit'));
$this->submitName = 'submit';
}
示例8: index
public function index()
{
$user = System::getUser();
$form = new Form('form-profile');
$form->setAttribute('data-noajax', 'true');
$form->binding = $user;
$fieldset = new Fieldset(System::getLanguage()->_('General'));
$firstname = new Text('firstname', System::getLanguage()->_('Firstname'));
$firstname->binding = new Databinding('firstname');
$lastname = new Text('lastname', System::getLanguage()->_('Lastname'));
$lastname->binding = new Databinding('lastname');
$email = new Text('email', System::getLanguage()->_('EMail'), true);
$email->binding = new Databinding('email');
$email->blacklist = $this->getListOfMailAdresses($user);
$email->error_msg[4] = System::getLanguage()->_('ErrorMailAdressAlreadyExists');
$language = new Radiobox('lang', System::getLanguage()->_('Language'), L10N::getLanguages());
$language->binding = new Databinding('lang');
$fieldset->addElements($firstname, $lastname, $email, $language);
$form->addElements($fieldset);
$fieldset = new Fieldset(System::getLanguage()->_('Password'));
$password = new Password('password', System::getLanguage()->_('Password'));
$password->minlength = PASSWORD_MIN_LENGTH;
$password->binding = new Databinding('password');
$password2 = new Password('password2', System::getLanguage()->_('ReenterPassword'));
$fieldset->addElements($password, $password2);
$form->addElements($fieldset);
$fieldset = new Fieldset(System::getLanguage()->_('Settings'));
$quota = new Text('quota', System::getLanguage()->_('Quota'));
if ($user->quota > 0) {
$quota->value = System::getLanguage()->_('QuotaAvailabe', Utils::formatBytes($user->getFreeSpace()), Utils::formatBytes($user->quota));
} else {
$quota->value = System::getLanguage()->_('Unlimited');
}
$quota->readonly = true;
$fieldset->addElements($quota);
$form->addElements($fieldset);
if (Utils::getPOST('submit', false) !== false) {
if (!empty($password->value) && $password->value != $password2->value) {
$password2->error = System::getLanguage()->_('ErrorInvalidPasswords');
} else {
if ($form->validate()) {
$form->save();
System::getUser()->save();
System::getSession()->setData('successMsg', System::getLanguage()->_('ProfileUpdated'));
System::forwardToRoute(Router::getInstance()->build('ProfileController', 'index'));
exit;
}
}
} else {
$form->fill();
}
$form->setSubmit(new Button(System::getLanguage()->_('Save'), 'floppy-disk'));
$smarty = new Template();
$smarty->assign('title', System::getLanguage()->_('MyProfile'));
$smarty->assign('heading', System::getLanguage()->_('MyProfile'));
$smarty->assign('form', $form->__toString());
$smarty->display('form.tpl');
}
示例9: __construct
/**
* Constructor
* @param string Field name
* @param string Label
* @param boolean Required field?
*/
public function __construct($name, $label, $required = false)
{
$this->type = 'textarea';
$this->name = $name;
$this->label = $label;
$this->required = $required;
$this->columns = 30;
$this->rows = 10;
$this->error_msg = System::getLanguage()->_('ErrorEmptyTextfield');
}
示例10: __construct
/**
* Constructor
* @param string Field name
* @param string Label
* @param boolean Required field?
* @param string Allowed input
* @param int Max length
* @param int Min length
*/
public function __construct($name, $label, $required = false, $valid = '*', $maxlength = false, $minlength = false)
{
$this->type = 'text';
$this->name = $name;
$this->label = $label;
$this->required = $required;
$this->valid = $valid;
$this->maxlength = $maxlength;
$this->minlength = $minlength;
$this->error_msg = array(0 => System::getLanguage()->_('ErrorInvalidLengthMax'), 1 => System::getLanguage()->_('ErrorInvalidLengthMin'), 2 => System::getLanguage()->_('ErrorEmptyTextfield'), 3 => System::getLanguage()->_('ErrorInvalidNumber'), 4 => System::getLanguage()->_('ErrorInvalidInput'));
}
示例11: format
/**
* Formats a given timestamp to a localised date format
* @static
* @param int Timestamp
* @return string Formatted date
*/
public static function format($timestamp)
{
$day = date(System::getLanguage()->_('DateFormat'), $timestamp);
$time = date(System::getLanguage()->_('TimeFormat'), $timestamp);
if ($timestamp >= strtotime('yesterday')) {
$day = System::getLanguage()->_('Yesterday');
}
if ($timestamp >= strtotime('today') && $timestamp < strtotime('tomorrow')) {
$day = System::getLanguage()->_('Today');
}
return $day . ' ' . $time;
}
示例12: invokeHandler
protected function invokeHandler()
{
$error = array();
if (Utils::isLocalhostServer()) {
$error[] = System::getLanguage()->_('NoLocalhost');
}
if ($this->file->permission != FilePermissions::PUBLIC_ACCESS) {
$error[] = System::getLanguage()->_('OnlyPublicFiles');
}
$router = Router::getInstance();
$link = $router->build('DownloadController', 'raw', $this->file);
$link = "http://view.officeapps.live.com/op/view.aspx?src=" . urlencode($link);
$this->smarty->assign('error', join('<br>', $error));
$this->smarty->assign('link', $link);
$this->smarty->display('handler/office.tpl');
}
示例13: __construct
/**
* Constructor
* @param string Field name
* @param string Label
* @param string[]|string[][] Options
*/
public function __construct($name, $label, $options = array(), $select_text = '')
{
$this->name = $name;
$this->label = $label;
$this->select_text = $select_text;
$this->required = false;
$this->type = 'select';
$this->error_msg = array(0 => System::getLanguage()->_('ErrorChooseOption'), 1 => System::getLanguage()->_('ErrorInvalidOption'));
if (!empty($select_text)) {
$this->required = true;
}
if (is_array($options) && count($options) > 0) {
$this->options = $options;
return true;
} else {
return false;
}
}
示例14: php
public function php()
{
parent::checkAuthentification();
parent::checkIfAdmin();
$entries = LogEntry::find('log', 'php');
if ($entries == NULL) {
$entries = array();
} else {
if ($entries instanceof LogEntry) {
$entries = array($entries);
}
}
usort($entries, array('LogEntry', 'compare'));
$smarty = new Template();
$smarty->assign('entries', $entries);
$smarty->assign('title', System::getLanguage()->_('Log'));
$smarty->assign('heading', System::getLanguage()->_('PHPEntries'));
$smarty->assign('showPHPEntries', true);
$smarty->display('log/log.tpl');
}
示例15: getAll
public static function getAll()
{
return array(FilePermissions::PUBLIC_ACCESS => System::getLanguage()->_('PermissionPublic'), FilePermissions::RESTRICTED_ACCESS => System::getLanguage()->_('PermissionProtected'), FilePermissions::PRIVATE_ACCESS => System::getLanguage()->_('PermissionPrivate'));
}