diff options
66 files changed, 97 insertions, 94 deletions
diff --git a/apps/files/ajax/list.php b/apps/files/ajax/list.php index 2f2f7054566..16e48a2c2af 100644 --- a/apps/files/ajax/list.php +++ b/apps/files/ajax/list.php @@ -2,7 +2,7 @@ OCP\JSON::checkLoggedIn(); \OC::$server->getSession()->close(); -$l = OC_L10N::get('files'); +$l = \OC::$server->getL10N('files'); // Load the files $dir = isset($_GET['dir']) ? $_GET['dir'] : ''; diff --git a/apps/files/ajax/move.php b/apps/files/ajax/move.php index e9a34a1b2f9..3a07554ad00 100644 --- a/apps/files/ajax/move.php +++ b/apps/files/ajax/move.php @@ -9,7 +9,7 @@ $dir = stripslashes($_POST["dir"]); $file = stripslashes($_POST["file"]); $target = stripslashes(rawurldecode($_POST["target"])); -$l = OC_L10N::get('files'); +$l = \OC::$server->getL10N('files'); if(\OC\Files\Filesystem::file_exists($target . '/' . $file)) { OCP\JSON::error(array("data" => array( "message" => $l->t("Could not move %s - File with this name already exists", array($file)) ))); diff --git a/apps/files/ajax/newfile.php b/apps/files/ajax/newfile.php index 8173816af3a..606576760ec 100644 --- a/apps/files/ajax/newfile.php +++ b/apps/files/ajax/newfile.php @@ -46,7 +46,7 @@ function progress($notification_code, $severity, $message, $message_code, $bytes } } -$l10n = \OC_L10n::get('files'); +$l10n = \OC::$server->getL10N('files'); $result = array( 'success' => false, diff --git a/apps/files/ajax/newfolder.php b/apps/files/ajax/newfolder.php index 4ea2ee71de2..ea7a10c2ab9 100644 --- a/apps/files/ajax/newfolder.php +++ b/apps/files/ajax/newfolder.php @@ -11,7 +11,7 @@ OCP\JSON::callCheck(); $dir = isset( $_POST['dir'] ) ? stripslashes($_POST['dir']) : ''; $foldername = isset( $_POST['foldername'] ) ? stripslashes($_POST['foldername']) : ''; -$l10n = \OC_L10n::get('files'); +$l10n = \OC::$server->getL10N('files'); $result = array( 'success' => false, diff --git a/apps/files/ajax/rename.php b/apps/files/ajax/rename.php index e5fdf8af98c..00c8a1e44db 100644 --- a/apps/files/ajax/rename.php +++ b/apps/files/ajax/rename.php @@ -27,7 +27,7 @@ OCP\JSON::callCheck(); $files = new \OCA\Files\App( \OC\Files\Filesystem::getView(), - \OC_L10n::get('files') + \OC::$server->getL10N('files') ); $result = $files->rename( $_GET["dir"], diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php index 4eca13f1933..b960e02ced7 100644 --- a/apps/files/ajax/upload.php +++ b/apps/files/ajax/upload.php @@ -10,7 +10,7 @@ OCP\JSON::setContentTypeHeader('text/plain'); $allowedPermissions = OCP\PERMISSION_ALL; $errorCode = null; -$l = OC_L10N::get('files'); +$l = \OC::$server->getL10N('files'); if (empty($_POST['dirToken'])) { // The standard case, files are uploaded through logged in users :) OCP\JSON::checkLoggedIn(); diff --git a/apps/files/appinfo/app.php b/apps/files/appinfo/app.php index 9af36c682fd..3567bc26def 100644 --- a/apps/files/appinfo/app.php +++ b/apps/files/appinfo/app.php @@ -1,6 +1,6 @@ <?php -$l = OC_L10N::get('files'); +$l = \OC::$server->getL10N('files'); OCP\App::registerAdmin('files', 'admin'); diff --git a/apps/files_encryption/ajax/adminrecovery.php b/apps/files_encryption/ajax/adminrecovery.php index 303ba0e16e1..070ca6f667e 100644 --- a/apps/files_encryption/ajax/adminrecovery.php +++ b/apps/files_encryption/ajax/adminrecovery.php @@ -13,7 +13,7 @@ use OCA\Encryption; \OCP\JSON::checkAppEnabled('files_encryption'); \OCP\JSON::callCheck(); -$l = OC_L10N::get('files_encryption'); +$l = \OC::$server->getL10N('files_encryption'); $return = false; // Enable recoveryAdmin diff --git a/apps/files_encryption/ajax/changeRecoveryPassword.php b/apps/files_encryption/ajax/changeRecoveryPassword.php index 99cc7b3cdde..71fbe333fe0 100644 --- a/apps/files_encryption/ajax/changeRecoveryPassword.php +++ b/apps/files_encryption/ajax/changeRecoveryPassword.php @@ -15,7 +15,7 @@ use OCA\Encryption; \OCP\JSON::checkAppEnabled('files_encryption'); \OCP\JSON::callCheck(); -$l = OC_L10N::get('core'); +$l = \OC::$server->getL10N('core'); $return = false; diff --git a/apps/files_encryption/ajax/updatePrivateKeyPassword.php b/apps/files_encryption/ajax/updatePrivateKeyPassword.php index a14c9fe5076..f88e9c64dfd 100644 --- a/apps/files_encryption/ajax/updatePrivateKeyPassword.php +++ b/apps/files_encryption/ajax/updatePrivateKeyPassword.php @@ -15,7 +15,7 @@ use OCA\Encryption; \OCP\JSON::checkAppEnabled('files_encryption'); \OCP\JSON::callCheck(); -$l = OC_L10N::get('core'); +$l = \OC::$server->getL10N('core'); $return = false; diff --git a/apps/files_encryption/files/error.php b/apps/files_encryption/files/error.php index b436587dfaf..c33a5a531f5 100644 --- a/apps/files_encryption/files/error.php +++ b/apps/files_encryption/files/error.php @@ -4,7 +4,7 @@ if (!isset($_)) { //also provide standalone error page require_once __DIR__ . '/../../../lib/base.php'; require_once __DIR__ . '/../lib/crypt.php'; - $l = OC_L10N::get('files_encryption'); + $l = \OC::$server->getL10N('files_encryption'); if (isset($_GET['errorCode'])) { $errorCode = $_GET['errorCode']; diff --git a/apps/files_external/ajax/dropbox.php b/apps/files_external/ajax/dropbox.php index bbedf8e9cac..db417de4b2d 100644 --- a/apps/files_external/ajax/dropbox.php +++ b/apps/files_external/ajax/dropbox.php @@ -5,7 +5,7 @@ require_once __DIR__ . '/../3rdparty/Dropbox/autoload.php'; OCP\JSON::checkAppEnabled('files_external'); OCP\JSON::checkLoggedIn(); OCP\JSON::callCheck(); -$l = OC_L10N::get('files_external'); +$l = \OC::$server->getL10N('files_external'); if (isset($_POST['app_key']) && isset($_POST['app_secret'])) { $oauth = new Dropbox_OAuth_Curl($_POST['app_key'], $_POST['app_secret']); diff --git a/apps/files_external/ajax/google.php b/apps/files_external/ajax/google.php index 13e74071846..40c10aa5d07 100644 --- a/apps/files_external/ajax/google.php +++ b/apps/files_external/ajax/google.php @@ -6,7 +6,7 @@ require_once 'Google_Client.php'; OCP\JSON::checkAppEnabled('files_external'); OCP\JSON::checkLoggedIn(); OCP\JSON::callCheck(); -$l = OC_L10N::get('files_external'); +$l = \OC::$server->getL10N('files_external'); if (isset($_POST['client_id']) && isset($_POST['client_secret']) && isset($_POST['redirect'])) { $client = new Google_Client(); diff --git a/apps/files_external/appinfo/app.php b/apps/files_external/appinfo/app.php index 04c48187e37..50a73bd5f9a 100644 --- a/apps/files_external/appinfo/app.php +++ b/apps/files_external/appinfo/app.php @@ -6,7 +6,7 @@ * later. * See the COPYING-README file. */ -$l = \OC_L10N::get('files_external'); +$l = \OC::$server->getL10N('files_external'); OC::$CLASSPATH['OC\Files\Storage\StreamWrapper'] = 'files_external/lib/streamwrapper.php'; OC::$CLASSPATH['OC\Files\Storage\FTP'] = 'files_external/lib/ftp.php'; diff --git a/apps/files_sharing/ajax/external.php b/apps/files_sharing/ajax/external.php index 37d0607cd3f..544a97e80be 100644 --- a/apps/files_sharing/ajax/external.php +++ b/apps/files_sharing/ajax/external.php @@ -10,7 +10,7 @@ OCP\JSON::callCheck(); OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('files_sharing'); -$l = OC_L10N::get('files_sharing'); +$l = \OC::$server->getL10N('files_sharing'); // check if server admin allows to mount public links from other servers if (OCA\Files_Sharing\Helper::isIncomingServer2serverShareEnabled() === false) { diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php index b22c553ec93..543cae7b0c1 100644 --- a/apps/files_sharing/appinfo/app.php +++ b/apps/files_sharing/appinfo/app.php @@ -1,5 +1,5 @@ <?php -$l = OC_L10N::get('files_sharing'); +$l = \OC::$server->getL10N('files_sharing'); OC::$CLASSPATH['OC_Share_Backend_File'] = 'files_sharing/lib/share/file.php'; OC::$CLASSPATH['OC_Share_Backend_Folder'] = 'files_sharing/lib/share/folder.php'; diff --git a/apps/files_trashbin/ajax/delete.php b/apps/files_trashbin/ajax/delete.php index 9d9c1dd100f..a2302802649 100644 --- a/apps/files_trashbin/ajax/delete.php +++ b/apps/files_trashbin/ajax/delete.php @@ -55,7 +55,7 @@ if ( $error ) { foreach ( $error as $e ) { $filelist .= $e.', '; } - $l = OC_L10N::get('files_trashbin'); + $l = \OC::$server->getL10N('files_trashbin'); $message = $l->t("Couldn't delete %s permanently", array(rtrim($filelist, ', '))); OCP\JSON::error(array("data" => array("message" => $message, "success" => $success, "error" => $error))); diff --git a/apps/files_trashbin/ajax/undelete.php b/apps/files_trashbin/ajax/undelete.php index afab79fcac6..02d651925ca 100644 --- a/apps/files_trashbin/ajax/undelete.php +++ b/apps/files_trashbin/ajax/undelete.php @@ -60,7 +60,7 @@ if ( $error ) { foreach ( $error as $e ) { $filelist .= $e.', '; } - $l = OC_L10N::get('files_trashbin'); + $l = OC::$server->getL10N('files_trashbin'); $message = $l->t("Couldn't restore %s", array(rtrim($filelist, ', '))); OCP\JSON::error(array("data" => array("message" => $message, "success" => $success, "error" => $error))); diff --git a/apps/files_trashbin/appinfo/app.php b/apps/files_trashbin/appinfo/app.php index 718c2f45a34..fe428121a25 100644 --- a/apps/files_trashbin/appinfo/app.php +++ b/apps/files_trashbin/appinfo/app.php @@ -1,5 +1,5 @@ <?php -$l = OC_L10N::get('files_trashbin'); +$l = \OC::$server->getL10N('files_trashbin'); OC::$CLASSPATH['OCA\Files_Trashbin\Exceptions\CopyRecursiveException'] = 'files_trashbin/lib/exceptions.php'; diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php index ee3969323cf..69eef09d1e9 100644 --- a/apps/files_trashbin/lib/trashbin.php +++ b/apps/files_trashbin/lib/trashbin.php @@ -891,7 +891,7 @@ class Trashbin { private static function getUniqueFilename($location, $filename, $view) { $ext = pathinfo($filename, PATHINFO_EXTENSION); $name = pathinfo($filename, PATHINFO_FILENAME); - $l = \OC_L10N::get('files_trashbin'); + $l = \OC::$server->getL10N('files_trashbin'); // if extension is not empty we set a dot in front of it if ($ext !== '') { diff --git a/apps/files_versions/ajax/rollbackVersion.php b/apps/files_versions/ajax/rollbackVersion.php index 900d8cd6e28..e6133507738 100644 --- a/apps/files_versions/ajax/rollbackVersion.php +++ b/apps/files_versions/ajax/rollbackVersion.php @@ -9,6 +9,6 @@ $revision=(int)$_GET['revision']; if(OCA\Files_Versions\Storage::rollback( $file, $revision )) { OCP\JSON::success(array("data" => array( "revision" => $revision, "file" => $file ))); }else{ - $l = OC_L10N::get('files_versions'); + $l = \OC::$server->getL10N('files_versions'); OCP\JSON::error(array("data" => array( "message" => $l->t("Could not revert: %s", array($file) )))); } diff --git a/apps/user_ldap/ajax/clearMappings.php b/apps/user_ldap/ajax/clearMappings.php index 9118d58c5cf..4e713c59f96 100644 --- a/apps/user_ldap/ajax/clearMappings.php +++ b/apps/user_ldap/ajax/clearMappings.php @@ -30,6 +30,6 @@ $subject = $_POST['ldap_clear_mapping']; if(\OCA\user_ldap\lib\Helper::clearMapping($subject)) { OCP\JSON::success(); } else { - $l=OC_L10N::get('user_ldap'); + $l = \OC::$server->getL10N('user_ldap'); OCP\JSON::error(array('message' => $l->t('Failed to clear the mappings.'))); } diff --git a/apps/user_ldap/ajax/deleteConfiguration.php b/apps/user_ldap/ajax/deleteConfiguration.php index ade57110d34..bca687c81ab 100644 --- a/apps/user_ldap/ajax/deleteConfiguration.php +++ b/apps/user_ldap/ajax/deleteConfiguration.php @@ -30,6 +30,6 @@ $prefix = $_POST['ldap_serverconfig_chooser']; if(\OCA\user_ldap\lib\Helper::deleteServerConfiguration($prefix)) { OCP\JSON::success(); } else { - $l=OC_L10N::get('user_ldap'); + $l = \OC::$server->getL10N('user_ldap'); OCP\JSON::error(array('message' => $l->t('Failed to delete the server configuration'))); } diff --git a/apps/user_ldap/ajax/testConfiguration.php b/apps/user_ldap/ajax/testConfiguration.php index a6375209611..c6372eb2ced 100644 --- a/apps/user_ldap/ajax/testConfiguration.php +++ b/apps/user_ldap/ajax/testConfiguration.php @@ -26,7 +26,7 @@ OCP\JSON::checkAdminUser(); OCP\JSON::checkAppEnabled('user_ldap'); OCP\JSON::callCheck(); -$l=OC_L10N::get('user_ldap'); +$l = \OC::$server->getL10N('user_ldap'); $ldapWrapper = new OCA\user_ldap\lib\LDAP(); $connection = new \OCA\user_ldap\lib\Connection($ldapWrapper, '', null); diff --git a/apps/user_ldap/ajax/wizard.php b/apps/user_ldap/ajax/wizard.php index adbcf6ff414..ef1241b9147 100644 --- a/apps/user_ldap/ajax/wizard.php +++ b/apps/user_ldap/ajax/wizard.php @@ -26,7 +26,7 @@ OCP\JSON::checkAdminUser(); OCP\JSON::checkAppEnabled('user_ldap'); OCP\JSON::callCheck(); -$l=OC_L10N::get('user_ldap'); +$l = \OC::$server->getL10N('user_ldap'); if(!isset($_POST['action'])) { \OCP\JSON::error(array('message' => $l->t('No action specified'))); diff --git a/apps/user_ldap/lib/wizard.php b/apps/user_ldap/lib/wizard.php index 4118b45bc35..dceb2206dbe 100644 --- a/apps/user_ldap/lib/wizard.php +++ b/apps/user_ldap/lib/wizard.php @@ -53,7 +53,7 @@ class Wizard extends LDAPUtility { parent::__construct($ldap); $this->configuration = $configuration; if(is_null(Wizard::$l)) { - Wizard::$l = \OC_L10N::get('user_ldap'); + Wizard::$l = \OC::$server->getL10N('user_ldap'); } $this->access = $access; $this->result = new WizardResult; diff --git a/apps/user_ldap/settings.php b/apps/user_ldap/settings.php index fcde5df3716..e7cdd0d926a 100644 --- a/apps/user_ldap/settings.php +++ b/apps/user_ldap/settings.php @@ -46,7 +46,7 @@ $wControls = $wControls->fetchPage(); $sControls = new OCP\Template('user_ldap', 'part.settingcontrols'); $sControls = $sControls->fetchPage(); -$l = \OC_L10N::get('user_ldap'); +$l = \OC::$server->getL10N('user_ldap'); $wizTabs = array(); $wizTabs[] = array('tpl' => 'part.wizard-server', 'cap' => $l->t('Server')); diff --git a/core/ajax/share.php b/core/ajax/share.php index 451c761c2cd..c6da79a8a42 100644 --- a/core/ajax/share.php +++ b/core/ajax/share.php @@ -90,7 +90,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo } break; case 'informRecipients': - $l = OC_L10N::get('core'); + $l = \OC::$server->getL10N('core'); $shareType = (int) $_POST['shareType']; $itemType = $_POST['itemType']; $itemSource = $_POST['itemSource']; @@ -153,7 +153,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo if(empty($result)) { \OCP\JSON::success(); } else { - $l = OC_L10N::get('core'); + $l = \OC::$server->getL10N('core'); OCP\JSON::error(array( 'data' => array( 'message' => $l->t("Couldn't send mail to following users: %s ", @@ -287,7 +287,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo $count = 0; // enable l10n support - $l = OC_L10N::get('core'); + $l = \OC::$server->getL10N('core'); foreach ($groups as $group) { if ($count < 15) { diff --git a/core/ajax/translations.php b/core/ajax/translations.php index e829453dbcc..c296cea572a 100644 --- a/core/ajax/translations.php +++ b/core/ajax/translations.php @@ -25,6 +25,6 @@ $app = isset($_POST["app"]) ? $_POST["app"] : ""; $app = OC_App::cleanAppId($app); -$l = OC_L10N::get( $app ); +$l = \OC::$server->getL10N($app); OC_JSON::success(array('data' => $l->getTranslations(), 'plural_form' => $l->getPluralFormString())); diff --git a/core/js/config.php b/core/js/config.php index b61694522db..6994f2ed8a2 100644 --- a/core/js/config.php +++ b/core/js/config.php @@ -14,7 +14,7 @@ header("Cache-Control: no-cache, must-revalidate"); header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Enable l10n support -$l = OC_L10N::get('core'); +$l = \OC::$server->getL10N('core'); // Enable OC_Defaults support $defaults = new OC_Defaults(); diff --git a/core/setup/controller.php b/core/setup/controller.php index e764b232e89..91b90e0adef 100644 --- a/core/setup/controller.php +++ b/core/setup/controller.php @@ -132,7 +132,7 @@ class Controller { } if (\OC_Util::runningOnMac()) { - $l10n = \OC_L10N::get('core'); + $l10n = \OC::$server->getL10N('core'); $themeName = \OC_Util::getTheme(); $theme = new \OC_Defaults(); $errors[] = array( diff --git a/core/strings.php b/core/strings.php index 01ab3866089..ebae63bf928 100644 --- a/core/strings.php +++ b/core/strings.php @@ -1,7 +1,7 @@ <?php //some strings that are used in /lib but wont be translatable unless they are in /core too -$l=OC_L10N::get('core'); +$l = \OC::$server->getL10N('core'); $l->t("Personal"); $l->t("Users"); $l->t("Apps"); diff --git a/lib/base.php b/lib/base.php index 0539814589e..176f799f94d 100644 --- a/lib/base.php +++ b/lib/base.php @@ -193,7 +193,7 @@ class OC { } public static function checkConfig() { - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); if (file_exists(self::$configDir . "/config.php") and !is_writable(self::$configDir . "/config.php") ) { @@ -574,7 +574,7 @@ class OC { // Check whether the sample configuration has been copied if(OC_Config::getValue('copied_sample_config', false)) { - $l = \OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); header('HTTP/1.1 503 Service Temporarily Unavailable'); header('Status: 503 Service Temporarily Unavailable'); OC_Template::printErrorPage( @@ -672,7 +672,6 @@ class OC { * Handle the request */ public static function handleRequest() { - $l = \OC_L10N::get('lib'); // load all the classpaths from the enabled apps so they are available // in the routing files of each app OC::loadAppClassPaths(); diff --git a/lib/private/app.php b/lib/private/app.php index 70f8980d2c1..d10d352b432 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -359,7 +359,7 @@ class OC_App { * entries are sorted by the key 'order' ascending. */ public static function getSettingsNavigation() { - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); $settings = array(); // by default, settings only contain the help menu @@ -1094,7 +1094,7 @@ class OC_App { * @throws Exception if no app-name was specified */ public static function installApp($app) { - $l = OC_L10N::get('core'); + $l = \OC::$server->getL10N('core'); $appData=OC_OCSClient::getApplication($app); // check if app is a shipped app or not. OCS apps have an integer as id, shipped apps use a string diff --git a/lib/private/avatar.php b/lib/private/avatar.php index 2286b896878..a9d9346d50a 100644 --- a/lib/private/avatar.php +++ b/lib/private/avatar.php @@ -62,12 +62,12 @@ class OC_Avatar implements \OCP\IAvatar { $type = 'jpg'; } if ($type !== 'jpg' && $type !== 'png') { - $l = \OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); throw new \Exception($l->t("Unknown filetype")); } if (!$img->valid()) { - $l = \OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); throw new \Exception($l->t("Invalid image")); } diff --git a/lib/private/defaults.php b/lib/private/defaults.php index dfd114cd2fe..3996cc081ed 100644 --- a/lib/private/defaults.php +++ b/lib/private/defaults.php @@ -27,7 +27,7 @@ class OC_Defaults { private $defaultMailHeaderColor; function __construct() { - $this->l = OC_L10N::get('lib'); + $this->l = \OC::$server->getL10N('lib'); $version = OC_Util::getVersion(); $this->defaultEntity = 'ownCloud'; /* e.g. company name, used for footers and copyright notices */ diff --git a/lib/private/installer.php b/lib/private/installer.php index dc9a3558b75..02e2190aaf2 100644 --- a/lib/private/installer.php +++ b/lib/private/installer.php @@ -62,7 +62,7 @@ class OC_Installer{ * @return integer */ public static function installApp( $data = array()) { - $l = \OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); list($extractDir, $path) = self::downloadApp($data); $info = self::checkAppsIntegrity($data, $extractDir, $path); @@ -229,7 +229,7 @@ class OC_Installer{ * @throws Exception */ public static function downloadApp($data = array()) { - $l = \OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); if(!isset($data['source'])) { throw new \Exception($l->t("No source specified when installing app")); @@ -285,7 +285,7 @@ class OC_Installer{ * @throws \Exception */ public static function checkAppsIntegrity($data = array(), $extractDir, $path, $isShipped=false) { - $l = \OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); //load the info.xml file of the app if(!is_file($extractDir.'/appinfo/info.xml')) { //try to find it in a subdir diff --git a/lib/private/json.php b/lib/private/json.php index da38654997f..f2719dd2bc7 100644 --- a/lib/private/json.php +++ b/lib/private/json.php @@ -25,7 +25,7 @@ class OC_JSON{ */ public static function checkAppEnabled($app) { if( !OC_App::isEnabled($app)) { - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); self::error(array( 'data' => array( 'message' => $l->t('Application is not enabled'), 'error' => 'application_not_enabled' ))); exit(); } @@ -36,7 +36,7 @@ class OC_JSON{ */ public static function checkLoggedIn() { if( !OC_User::isLoggedIn()) { - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' ))); exit(); } @@ -47,7 +47,7 @@ class OC_JSON{ */ public static function callCheck() { if( !OC_Util::isCallRegistered()) { - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); self::error(array( 'data' => array( 'message' => $l->t('Token expired. Please reload page.'), 'error' => 'token_expired' ))); exit(); } @@ -58,7 +58,7 @@ class OC_JSON{ */ public static function checkAdminUser() { if( !OC_User::isAdminUser(OC_User::getUser())) { - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' ))); exit(); } @@ -70,7 +70,7 @@ class OC_JSON{ */ public static function checkUserExists($user) { if (!OCP\User::userExists($user)) { - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); OCP\JSON::error(array('data' => array('message' => $l->t('Unknown user'), 'error' => 'unknown_user' ))); exit; } @@ -83,7 +83,7 @@ class OC_JSON{ */ public static function checkSubAdminUser() { if(!OC_SubAdmin::isSubAdmin(OC_User::getUser())) { - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' ))); exit(); } diff --git a/lib/private/l10n/factory.php b/lib/private/l10n/factory.php index d0c3799b9c2..fcc3f3e3394 100644 --- a/lib/private/l10n/factory.php +++ b/lib/private/l10n/factory.php @@ -20,12 +20,15 @@ class Factory { /** * get an L10N instance + * * @param string $app * @param string|null $lang * @return \OC_L10N */ - public function get($app) { - if (!isset($this->instances[$app])) { + public function get($app, $lang = null) { + if (!is_null($lang)) { + return new \OC_L10N($app, $lang); + } else if (!isset($this->instances[$app])) { $this->instances[$app] = new \OC_L10N($app); } return $this->instances[$app]; diff --git a/lib/private/server.php b/lib/private/server.php index 53aab7a586a..bf1801a5ce8 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -369,10 +369,11 @@ class Server extends SimpleContainer implements IServerContainer { * get an L10N instance * * @param string $app appid + * @param string $lang * @return \OC_L10N */ - function getL10N($app) { - return $this->query('L10NFactory')->get($app); + function getL10N($app, $lang = null) { + return $this->query('L10NFactory')->get($app, $lang); } /** diff --git a/lib/private/setup.php b/lib/private/setup.php index fdf98ab0959..2e23aae8838 100644 --- a/lib/private/setup.php +++ b/lib/private/setup.php @@ -15,7 +15,7 @@ class OC_Setup { ); public static function getTrans(){ - return OC_L10N::get('lib'); + return \OC::$server->getL10N('lib'); } public static function install($options) { diff --git a/lib/private/share/mailnotifications.php b/lib/private/share/mailnotifications.php index 1f4645eed9f..4a92503bdd3 100644 --- a/lib/private/share/mailnotifications.php +++ b/lib/private/share/mailnotifications.php @@ -52,7 +52,7 @@ class MailNotifications { * @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->l = \OC::$server->getL10N('core'); $this->senderId = $sender; diff --git a/lib/private/share/share.php b/lib/private/share/share.php index c3593beac45..e2e9b94125e 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -479,7 +479,7 @@ class Share extends \OC\Share\Constants { public static function shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions, $itemSourceName = null, \DateTime $expirationDate = null) { $uidOwner = \OC_User::getUser(); $shareWithinGroupOnly = self::shareWithGroupMembersOnly(); - $l = \OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); if (is_null($itemSourceName)) { $itemSourceName = $itemSource; @@ -849,7 +849,7 @@ class Share extends \OC\Share\Constants { * @return boolean true on success or false on failure */ public static function setPermissions($itemType, $itemSource, $shareType, $shareWith, $permissions) { - $l = \OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); if ($item = self::getItems($itemType, $itemSource, $shareType, $shareWith, \OC_User::getUser(), self::FORMAT_NONE, null, 1, false)) { // Check if this item is a reshare and verify that the permissions @@ -938,7 +938,7 @@ class Share extends \OC\Share\Constants { * @throws \Exception */ private static function validateExpireDate($expireDate, $shareTime, $itemType, $itemSource) { - $l = \OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); $date = new \DateTime($expireDate); $today = new \DateTime('now'); @@ -1083,7 +1083,7 @@ class Share extends \OC\Share\Constants { * @return \OCP\Share_Backend */ public static function getBackend($itemType) { - $l = \OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); if (isset(self::$backends[$itemType])) { return self::$backends[$itemType]; } else if (isset(self::$backendTypes[$itemType]['class'])) { @@ -1516,7 +1516,7 @@ class Share extends \OC\Share\Constants { private static function put($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, $parentFolder = null, $token = null, $itemSourceName = null, \DateTime $expirationDate = null) { $backend = self::getBackend($itemType); - $l = \OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); // Check if this is a reshare if ($checkReshare = self::getItemSharedWithBySource($itemType, $itemSource, self::FORMAT_NONE, null, true)) { diff --git a/lib/private/tags.php b/lib/private/tags.php index 0b62caf2dd8..0e58789ecd5 100644 --- a/lib/private/tags.php +++ b/lib/private/tags.php @@ -178,7 +178,7 @@ class Tags implements \OCP\ITags { } if($tagId === false) { - $l10n = \OC_L10N::get('core'); + $l10n = \OC::$server->getL10N('core'); throw new \Exception( $l10n->t('Could not find category "%s"', $tag) ); diff --git a/lib/private/template.php b/lib/private/template.php index 73fa53a2fa3..d95943a714c 100644 --- a/lib/private/template.php +++ b/lib/private/template.php @@ -56,7 +56,7 @@ class OC_Template extends \OC\Template\Base { $requesttoken = (OC::$server->getSession() and $registerCall) ? OC_Util::callRegister() : ''; $parts = explode('/', $app); // fix translation when app is something like core/lostpassword - $l10n = OC_L10N::get($parts[0]); + $l10n = \OC::$server->getL10N($parts[0]); $themeDefaults = new OC_Defaults(); list($path, $template) = $this->findTemplate($theme, $app, $name, $fext); diff --git a/lib/private/template/functions.php b/lib/private/template/functions.php index 46e48274001..3cbf0d9748f 100644 --- a/lib/private/template/functions.php +++ b/lib/private/template/functions.php @@ -117,7 +117,7 @@ function strip_time($timestamp){ * @return OC_L10N_String timestamp */ function relative_modified_date($timestamp, $fromTime = null, $dateOnly = false) { - $l=OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); if (!isset($fromTime) || $fromTime === null){ $fromTime = time(); } diff --git a/lib/private/user/manager.php b/lib/private/user/manager.php index a54755e71c5..5c155c27aba 100644 --- a/lib/private/user/manager.php +++ b/lib/private/user/manager.php @@ -237,7 +237,7 @@ class Manager extends PublicEmitter implements IUserManager { * @return bool|\OC\User\User the created user of false */ public function createUser($uid, $password) { - $l = \OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); // Check the name for bad characters // Allowed are: "a-z", "A-Z", "0-9" and "_.@-" if (preg_match('/[^a-zA-Z0-9 _\.@\-]/', $uid)) { diff --git a/lib/private/util.php b/lib/private/util.php index ad078e8a44c..adb7fb83d28 100755 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -392,7 +392,7 @@ class OC_Util { $offset = $clientTimeZone - $systemTimeZone; $timestamp = $timestamp + $offset * 60; } - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); return $l->l($dateOnly ? 'date' : 'datetime', $timestamp); } @@ -402,7 +402,7 @@ class OC_Util { * @return array arrays with error messages and hints */ public static function checkServer() { - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); $errors = array(); $CONFIG_DATADIRECTORY = OC_Config::getValue('datadirectory', OC::$SERVERROOT . '/data'); @@ -626,7 +626,7 @@ class OC_Util { * @return array errors array */ public static function checkDatabaseVersion() { - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); $errors = array(); $dbType = \OC_Config::getValue('dbtype', 'sqlite'); if ($dbType === 'pgsql') { @@ -707,7 +707,7 @@ class OC_Util { * @return array arrays with error messages and hints */ public static function checkDataDirectoryPermissions($dataDirectory) { - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); $errors = array(); if (self::runningOnWindows()) { //TODO: permissions checks for windows hosts @@ -738,7 +738,7 @@ class OC_Util { * @return bool true if the data directory is valid, false otherwise */ public static function checkDataDirectoryValidity($dataDirectory) { - $l = OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); $errors = array(); if (!file_exists($dataDirectory . '/.ocdata')) { $errors[] = array( diff --git a/lib/public/files/locknotacquiredexception.php b/lib/public/files/locknotacquiredexception.php index 9fb70e7cbe2..647b07bf878 100644 --- a/lib/public/files/locknotacquiredexception.php +++ b/lib/public/files/locknotacquiredexception.php @@ -36,7 +36,7 @@ class LockNotAcquiredException extends \Exception { public $lockType; public function __construct($path, $lockType, $code = 0, \Exception $previous = null) { - $message = \OC_L10N::get('core')->t('Could not obtain lock type %d on "%s".', array($lockType, $path)); + $message = \OC::$server->getL10N('core')->t('Could not obtain lock type %d on "%s".', array($lockType, $path)); parent::__construct($message, $code, $previous); } @@ -44,4 +44,4 @@ class LockNotAcquiredException extends \Exception { public function __toString() { return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; } -}
\ No newline at end of file +} diff --git a/lib/public/util.php b/lib/public/util.php index 87b7a4f19db..bc1b90a2c89 100644 --- a/lib/public/util.php +++ b/lib/public/util.php @@ -132,7 +132,7 @@ class Util { * @return \OC_L10N */ public static function getL10N($application, $language = null) { - return \OC_L10N::get($application, $language); + return \OC::$server->getL10N($application, $language); } /** diff --git a/settings/admin/controller.php b/settings/admin/controller.php index 7ced57791e9..395bc7c6e49 100644 --- a/settings/admin/controller.php +++ b/settings/admin/controller.php @@ -27,7 +27,7 @@ class Controller { \OC_Util::checkAdminUser(); \OCP\JSON::callCheck(); - $l = \OC_L10N::get('settings'); + $l = \OC::$server->getL10N('settings'); $smtp_settings = array( 'mail_domain' => null, @@ -80,7 +80,7 @@ class Controller { \OC_Util::checkAdminUser(); \OCP\JSON::callCheck(); - $l = \OC_L10N::get('settings'); + $l = \OC::$server->getL10N('settings'); $email = \OC_Preferences::getValue(\OC_User::getUser(), 'settings', 'email', ''); if (!empty($email)) { $defaults = new \OC_Defaults(); diff --git a/settings/ajax/apps/ocs.php b/settings/ajax/apps/ocs.php index b68083fca6b..aad0690e01c 100644 --- a/settings/ajax/apps/ocs.php +++ b/settings/ajax/apps/ocs.php @@ -8,7 +8,7 @@ OC_JSON::checkAdminUser(); -$l = OC_L10N::get('settings'); +$l = \OC::$server->getL10N('settings'); if(OC_Config::getValue('appstoreenabled', true)==false) { OCP\JSON::success(array('type' => 'external', 'data' => array())); diff --git a/settings/ajax/changedisplayname.php b/settings/ajax/changedisplayname.php index 54c8c05dd4b..1e52182ccf6 100644 --- a/settings/ajax/changedisplayname.php +++ b/settings/ajax/changedisplayname.php @@ -4,7 +4,7 @@ OCP\JSON::callCheck(); OC_JSON::checkLoggedIn(); -$l=OC_L10N::get('settings'); +$l = \OC::$server->getL10N('settings'); $username = isset($_POST["username"]) ? $_POST["username"] : OC_User::getUser(); $displayName = $_POST["displayName"]; diff --git a/settings/ajax/creategroup.php b/settings/ajax/creategroup.php index 854f2c37189..be376bea9dc 100644 --- a/settings/ajax/creategroup.php +++ b/settings/ajax/creategroup.php @@ -4,7 +4,7 @@ OCP\JSON::callCheck(); OC_JSON::checkAdminUser(); $groupname = $_POST["groupname"]; -$l = OC_L10N::get('settings'); +$l = \OC::$server->getL10N('settings'); // Does the group exist? if( in_array( $groupname, OC_Group::getGroups())) { diff --git a/settings/ajax/decryptall.php b/settings/ajax/decryptall.php index 55685f778d1..527e5b8fcee 100644 --- a/settings/ajax/decryptall.php +++ b/settings/ajax/decryptall.php @@ -12,7 +12,7 @@ $params = array('uid' => \OCP\User::getUser(), $view = new OC\Files\View('/'); $util = new \OCA\Encryption\Util($view, \OCP\User::getUser()); -$l = \OC_L10N::get('settings'); +$l = \OC::$server->getL10N('settings'); $result = $util->initEncryption($params); diff --git a/settings/ajax/deletekeys.php b/settings/ajax/deletekeys.php index 1f84452e117..86a45820af9 100644 --- a/settings/ajax/deletekeys.php +++ b/settings/ajax/deletekeys.php @@ -3,7 +3,7 @@ OCP\JSON::checkLoggedIn(); OCP\JSON::callCheck(); -$l = \OC_L10N::get('settings'); +$l = \OC::$server->getL10N('settings'); $user = \OC_User::getUser(); $view = new \OC\Files\View('/' . $user . '/files_encryption'); diff --git a/settings/ajax/installapp.php b/settings/ajax/installapp.php index 47f40f2b0cd..80bc1819724 100644 --- a/settings/ajax/installapp.php +++ b/settings/ajax/installapp.php @@ -14,6 +14,6 @@ $result = OC_App::installApp($appId); if($result !== false) { OC_JSON::success(array('data' => array('appid' => $appId))); } else { - $l = OC_L10N::get('settings'); + $l = \OC::$server->getL10N('settings'); OC_JSON::error(array("data" => array( "message" => $l->t("Couldn't remove app.") ))); } diff --git a/settings/ajax/lostpassword.php b/settings/ajax/lostpassword.php index 15b6cbc0122..395ba31f92b 100644 --- a/settings/ajax/lostpassword.php +++ b/settings/ajax/lostpassword.php @@ -3,7 +3,7 @@ OC_JSON::checkLoggedIn(); OCP\JSON::callCheck(); -$l=OC_L10N::get('settings'); +$l = \OC::$server->getL10N('settings'); // Get data if( isset( $_POST['email'] ) && OC_Mail::validateAddress($_POST['email']) ) { diff --git a/settings/ajax/removeuser.php b/settings/ajax/removeuser.php index 8732c6518a8..eda85238780 100644 --- a/settings/ajax/removeuser.php +++ b/settings/ajax/removeuser.php @@ -11,7 +11,7 @@ if(OC_User::getUser() === $username) { } if(!OC_User::isAdminUser(OC_User::getUser()) && !OC_SubAdmin::isUserAccessible(OC_User::getUser(), $username)) { - $l = OC_L10N::get('core'); + $l = \OC::$server->getL10N('core'); OC_JSON::error(array( 'data' => array( 'message' => $l->t('Authentication error') ))); exit(); } @@ -21,6 +21,6 @@ if( OC_User::deleteUser( $username )) { OC_JSON::success(array("data" => array( "username" => $username ))); } else{ - $l = OC_L10N::get('core'); + $l = \OC::$server->getL10N('core'); OC_JSON::error(array("data" => array( "message" => $l->t("Unable to delete user") ))); } diff --git a/settings/ajax/restorekeys.php b/settings/ajax/restorekeys.php index 68e19c90457..5c263fadab4 100644 --- a/settings/ajax/restorekeys.php +++ b/settings/ajax/restorekeys.php @@ -3,7 +3,7 @@ OCP\JSON::checkLoggedIn(); OCP\JSON::callCheck(); -$l = \OC_L10N::get('settings'); +$l = \OC::$server->getL10N('settings'); $user = \OC_User::getUser(); $view = new \OC\Files\View('/' . $user . '/files_encryption'); diff --git a/settings/ajax/setlanguage.php b/settings/ajax/setlanguage.php index 94773f3dc70..a3988db85bb 100644 --- a/settings/ajax/setlanguage.php +++ b/settings/ajax/setlanguage.php @@ -1,6 +1,6 @@ <?php -$l=OC_L10N::get('settings'); +$l = \OC::$server->getL10N('settings'); OC_JSON::checkLoggedIn(); OCP\JSON::callCheck(); diff --git a/settings/ajax/setquota.php b/settings/ajax/setquota.php index 2e6de2b759c..f19506a0456 100644 --- a/settings/ajax/setquota.php +++ b/settings/ajax/setquota.php @@ -13,7 +13,7 @@ $username = isset($_POST["username"])?$_POST["username"]:''; if(($username === '' && !OC_User::isAdminUser(OC_User::getUser())) || (!OC_User::isAdminUser(OC_User::getUser()) && !OC_SubAdmin::isUserAccessible(OC_User::getUser(), $username))) { - $l = OC_L10N::get('core'); + $l = \OC::$server->getL10N('core'); OC_JSON::error(array( 'data' => array( 'message' => $l->t('Authentication error') ))); exit(); } diff --git a/settings/ajax/togglegroups.php b/settings/ajax/togglegroups.php index 6963f9eb43c..27cb2b446ec 100644 --- a/settings/ajax/togglegroups.php +++ b/settings/ajax/togglegroups.php @@ -8,7 +8,7 @@ $username = $_POST["username"]; $group = $_POST["group"]; if($username === OC_User::getUser() && $group === "admin" && OC_User::isAdminUser($username)) { - $l = OC_L10N::get('core'); + $l = \OC::$server->getL10N('core'); OC_JSON::error(array( 'data' => array( 'message' => $l->t('Admins can\'t remove themself from the admin group')))); exit(); } @@ -16,7 +16,7 @@ if($username === OC_User::getUser() && $group === "admin" && OC_User::isAdminUs if(!OC_User::isAdminUser(OC_User::getUser()) && (!OC_SubAdmin::isUserAccessible(OC_User::getUser(), $username) || !OC_SubAdmin::isGroupAccessible(OC_User::getUser(), $group))) { - $l = OC_L10N::get('core'); + $l = \OC::$server->getL10N('core'); OC_JSON::error(array( 'data' => array( 'message' => $l->t('Authentication error') ))); exit(); } @@ -25,7 +25,7 @@ if(!OC_Group::groupExists($group)) { OC_Group::createGroup($group); } -$l = OC_L10N::get('settings'); +$l = \OC::$server->getL10N('settings'); $error = $l->t("Unable to add user to group %s", $group); $action = "add"; diff --git a/settings/ajax/uninstallapp.php b/settings/ajax/uninstallapp.php index 5c6371dc16f..cae7c33f292 100644 --- a/settings/ajax/uninstallapp.php +++ b/settings/ajax/uninstallapp.php @@ -14,6 +14,6 @@ $result = OC_App::removeApp($appId); if($result !== false) { OC_JSON::success(array('data' => array('appid' => $appId))); } else { - $l = OC_L10N::get('settings'); + $l = \OC::$server->getL10N('settings'); OC_JSON::error(array("data" => array( "message" => $l->t("Couldn't remove app.") ))); } diff --git a/settings/ajax/updateapp.php b/settings/ajax/updateapp.php index afaa9318fb2..6375a41024a 100644 --- a/settings/ajax/updateapp.php +++ b/settings/ajax/updateapp.php @@ -40,6 +40,6 @@ $result = OC_Installer::updateAppByOCSId($appId, $isShipped); if($result !== false) { OC_JSON::success(array('data' => array('appid' => $appId))); } else { - $l = OC_L10N::get('settings'); + $l = \OC::$server->getL10N('settings'); OC_JSON::error(array("data" => array( "message" => $l->t("Couldn't update app.") ))); } diff --git a/settings/personal.php b/settings/personal.php index a72b293413a..b290d6a959e 100644 --- a/settings/personal.php +++ b/settings/personal.php @@ -46,7 +46,7 @@ $languageNames=include 'languageCodes.php'; $languages=array(); $commonlanguages = array(); foreach($languageCodes as $lang) { - $l=OC_L10N::get('settings', $lang); + $l = \OC::$server->getL10N('settings', $lang); if(substr($l->t('__language_name__'), 0, 1) !== '_') {//first check if the language name is in the translation file $ln=array('code'=>$lang, 'name'=> (string)$l->t('__language_name__')); }elseif(isset($languageNames[$lang])) { |