当前位置: 首页>>代码示例>>PHP>>正文


PHP OC_L10N::findLanguage方法代码示例

本文整理汇总了PHP中OC_L10N::findLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_L10N::findLanguage方法的具体用法?PHP OC_L10N::findLanguage怎么用?PHP OC_L10N::findLanguage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OC_L10N的用法示例。


在下文中一共展示了OC_L10N::findLanguage方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getUserLang

 /**
  * Gets the language of the user, including anonymous 
  *
  * @return The user language
  */
 public static function getUserLang()
 {
     $config = \OC::$server->getConfig();
     $lang = \OC_L10N::findLanguage();
     $userLang = $config->getUserValue(\OC_User::getUser(), 'core', 'lang', $lang);
     return $userLang;
 }
开发者ID:RepoHell,项目名称:agreedisclaimer,代码行数:12,代码来源:utils.php

示例2: testFindLanguage

 /**
  * @dataProvider findLanguageData
  */
 public function testFindLanguage($default, $preference, $expected)
 {
     OC_User::setUserId(null);
     if (is_null($default)) {
         OC_Config::deleteKey('default_language');
     } else {
         OC_Config::setValue('default_language', $default);
     }
     $_SERVER['HTTP_ACCEPT_LANGUAGE'] = $preference;
     $reflection = new \ReflectionClass('OC_L10N');
     $prop = $reflection->getProperty('language');
     $prop->setAccessible(1);
     $prop->setValue('');
     $prop->setAccessible(0);
     $this->assertSame($expected, OC_L10N::findLanguage());
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:19,代码来源:l10n.php

示例3: __construct

 /**
  * @param string $renderAs
  * @param string $appId application id
  */
 public function __construct($renderAs, $appId = '')
 {
     // yes - should be injected ....
     $this->config = \OC::$server->getConfig();
     // Decide which page we show
     if ($renderAs == 'user') {
         parent::__construct('core', 'layout.user');
         if (in_array(OC_App::getCurrentApp(), ['settings', 'admin', 'help']) !== false) {
             $this->assign('bodyid', 'body-settings');
         } else {
             $this->assign('bodyid', 'body-user');
         }
         // Update notification
         if ($this->config->getSystemValue('updatechecker', true) === true && OC_User::isAdminUser(OC_User::getUser())) {
             $updater = new \OC\Updater(\OC::$server->getHTTPHelper(), \OC::$server->getConfig());
             $data = $updater->check();
             if (isset($data['version']) && $data['version'] != '' and $data['version'] !== array()) {
                 $this->assign('updateAvailable', true);
                 $this->assign('updateVersion', $data['versionstring']);
                 $this->assign('updateLink', $data['web']);
                 \OCP\Util::addScript('core', 'update-notification');
             } else {
                 $this->assign('updateAvailable', false);
                 // No update available or not an admin user
             }
         } else {
             $this->assign('updateAvailable', false);
             // Update check is disabled
         }
         // Add navigation entry
         $this->assign('application', '');
         $this->assign('appid', $appId);
         $navigation = OC_App::getNavigation();
         $this->assign('navigation', $navigation);
         $settingsNavigation = OC_App::getSettingsNavigation();
         $this->assign('settingsnavigation', $settingsNavigation);
         foreach ($navigation as $entry) {
             if ($entry['active']) {
                 $this->assign('application', $entry['name']);
                 break;
             }
         }
         foreach ($settingsNavigation as $entry) {
             if ($entry['active']) {
                 $this->assign('application', $entry['name']);
                 break;
             }
         }
         $userDisplayName = OC_User::getDisplayName();
         $this->assign('user_displayname', $userDisplayName);
         $this->assign('user_uid', OC_User::getUser());
         $this->assign('appsmanagement_active', strpos(\OC::$server->getRequest()->getRequestUri(), \OC::$server->getURLGenerator()->linkToRoute('settings.AppSettings.viewApps')) === 0);
         $this->assign('enableAvatars', $this->config->getSystemValue('enable_avatars', true));
         $this->assign('userAvatarSet', \OC_Helper::userAvatarSet(OC_User::getUser()));
     } else {
         if ($renderAs == 'error') {
             parent::__construct('core', 'layout.guest', '', false);
             $this->assign('bodyid', 'body-login');
         } else {
             if ($renderAs == 'guest') {
                 parent::__construct('core', 'layout.guest');
                 $this->assign('bodyid', 'body-login');
             } else {
                 parent::__construct('core', 'layout.base');
             }
         }
     }
     // Send the language to our layouts
     $this->assign('language', OC_L10N::findLanguage());
     if (empty(self::$versionHash)) {
         $v = OC_App::getAppVersions();
         $v['core'] = implode('.', \OC_Util::getVersion());
         self::$versionHash = md5(implode(',', $v));
     }
     $useAssetPipeline = self::isAssetPipelineEnabled();
     if ($useAssetPipeline) {
         $this->append('jsfiles', OC_Helper::linkToRoute('js_config', array('v' => self::$versionHash)));
         $this->generateAssets();
     } else {
         // Add the js files
         $jsFiles = self::findJavascriptFiles(OC_Util::$scripts);
         $this->assign('jsfiles', array(), false);
         if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') {
             $this->append('jsfiles', OC_Helper::linkToRoute('js_config', array('v' => self::$versionHash)));
         }
         foreach ($jsFiles as $info) {
             $web = $info[1];
             $file = $info[2];
             $this->append('jsfiles', $web . '/' . $file . '?v=' . self::$versionHash);
         }
         // Add the css files
         $cssFiles = self::findStylesheetFiles(OC_Util::$styles);
         $this->assign('cssfiles', array());
         foreach ($cssFiles as $info) {
             $web = $info[1];
             $file = $info[2];
//.........这里部分代码省略.........
开发者ID:alfrescoo,项目名称:core,代码行数:101,代码来源:templatelayout.php

示例4: __construct

 /**
  * @param string $renderAs
  * @param string $appId application id
  */
 public function __construct($renderAs, $appId = '')
 {
     // yes - should be injected ....
     $this->config = \OC::$server->getConfig();
     // Decide which page we show
     if ($renderAs == 'user') {
         parent::__construct('core', 'layout.user');
         if (in_array(\OC_App::getCurrentApp(), ['settings', 'admin', 'help']) !== false) {
             $this->assign('bodyid', 'body-settings');
         } else {
             $this->assign('bodyid', 'body-user');
         }
         // Code integrity notification
         $integrityChecker = \OC::$server->getIntegrityCodeChecker();
         if (!$integrityChecker->hasPassedCheck()) {
             \OCP\Util::addScript('core', 'integritycheck-failed-notification');
         }
         // Add navigation entry
         $this->assign('application', '');
         $this->assign('appid', $appId);
         $navigation = \OC_App::getNavigation();
         $this->assign('navigation', $navigation);
         $settingsNavigation = \OC_App::getSettingsNavigation();
         $this->assign('settingsnavigation', $settingsNavigation);
         foreach ($navigation as $entry) {
             if ($entry['active']) {
                 $this->assign('application', $entry['name']);
                 break;
             }
         }
         foreach ($settingsNavigation as $entry) {
             if ($entry['active']) {
                 $this->assign('application', $entry['name']);
                 break;
             }
         }
         $userDisplayName = \OC_User::getDisplayName();
         $appsMgmtActive = strpos(\OC::$server->getRequest()->getRequestUri(), \OC::$server->getURLGenerator()->linkToRoute('settings.AppSettings.viewApps')) === 0;
         if ($appsMgmtActive) {
             $l = \OC::$server->getL10N('lib');
             $this->assign('application', $l->t('Apps'));
         }
         $this->assign('user_displayname', $userDisplayName);
         $this->assign('user_uid', \OC_User::getUser());
         $this->assign('appsmanagement_active', $appsMgmtActive);
         $this->assign('enableAvatars', $this->config->getSystemValue('enable_avatars', true) === true);
         if (\OC_User::getUser() === false) {
             $this->assign('userAvatarSet', false);
         } else {
             $this->assign('userAvatarSet', \OC::$server->getAvatarManager()->getAvatar(\OC_User::getUser())->exists());
         }
     } else {
         if ($renderAs == 'error') {
             parent::__construct('core', 'layout.guest', '', false);
             $this->assign('bodyid', 'body-login');
         } else {
             if ($renderAs == 'guest') {
                 parent::__construct('core', 'layout.guest');
                 $this->assign('bodyid', 'body-login');
             } else {
                 parent::__construct('core', 'layout.base');
             }
         }
     }
     // Send the language to our layouts
     $this->assign('language', \OC_L10N::findLanguage());
     if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
         if (empty(self::$versionHash)) {
             $v = \OC_App::getAppVersions();
             $v['core'] = implode('.', \OCP\Util::getVersion());
             self::$versionHash = md5(implode(',', $v));
         }
     } else {
         self::$versionHash = md5('not installed');
     }
     $useAssetPipeline = self::isAssetPipelineEnabled();
     if ($useAssetPipeline) {
         $this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('js_config', ['v' => self::$versionHash]));
         $this->generateAssets();
     } else {
         // Add the js files
         $jsFiles = self::findJavascriptFiles(\OC_Util::$scripts);
         $this->assign('jsfiles', array());
         if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') {
             $this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('js_config', ['v' => self::$versionHash]));
         }
         foreach ($jsFiles as $info) {
             $web = $info[1];
             $file = $info[2];
             $this->append('jsfiles', $web . '/' . $file . '?v=' . self::$versionHash);
         }
         // Add the css files
         $cssFiles = self::findStylesheetFiles(\OC_Util::$styles);
         $this->assign('cssfiles', array());
         foreach ($cssFiles as $info) {
             $web = $info[1];
//.........这里部分代码省略.........
开发者ID:ZverAleksey,项目名称:core,代码行数:101,代码来源:templatelayout.php

示例5: array

OC_Util::addScript('settings', 'certificates');
OC_Util::addStyle('settings', 'settings');
\OC_Util::addVendorScript('strengthify/jquery.strengthify');
\OC_Util::addVendorStyle('strengthify/strengthify');
\OC_Util::addScript('files', 'jquery.iframe-transport');
\OC_Util::addScript('files', 'jquery.fileupload');
if ($config->getSystemValue('enable_avatars', true) === true) {
    \OC_Util::addVendorScript('jcrop/js/jquery.Jcrop');
    \OC_Util::addVendorStyle('jcrop/css/jquery.Jcrop');
}
// Highlight navigation entry
OC::$server->getNavigationManager()->setActiveEntry('personal');
$storageInfo = OC_Helper::getStorageInfo('/');
$user = OC::$server->getUserManager()->get(OC_User::getUser());
$email = $user->getEMailAddress();
$userLang = $config->getUserValue(OC_User::getUser(), 'core', 'lang', OC_L10N::findLanguage());
$languageCodes = OC_L10N::findAvailableLanguages();
// array of common languages
$commonLangCodes = array('en', 'es', 'fr', 'de', 'de_DE', 'ja', 'ar', 'ru', 'nl', 'it', 'pt_BR', 'pt_PT', 'da', 'fi_FI', 'nb_NO', 'sv', 'tr', 'zh_CN', 'ko');
$languageNames = (include 'languageCodes.php');
$languages = array();
$commonLanguages = array();
foreach ($languageCodes as $lang) {
    $l = \OC::$server->getL10N('settings', $lang);
    // TRANSLATORS this is the language name for the language switcher in the personal settings and should be the localized version
    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])) {
        $ln = array('code' => $lang, 'name' => $languageNames[$lang]);
    } else {
开发者ID:nseps,项目名称:core,代码行数:31,代码来源:personal.php

示例6: addTranslations

 /**
  * add a translation JS file
  *
  * @param string $application application id
  * @param string $languageCode language code, defaults to the current language
  * @param bool $prepend prepend the Script to the beginning of the list 
  */
 public static function addTranslations($application, $languageCode = null, $prepend = false)
 {
     if (is_null($languageCode)) {
         $languageCode = \OC_L10N::findLanguage($application);
     }
     if (!empty($application)) {
         $path = "{$application}/l10n/{$languageCode}";
     } else {
         $path = "l10n/{$languageCode}";
     }
     //TODO eliminate double code
     if (!in_array($path, self::$scripts)) {
         if ($prepend === true) {
             array_unshift(self::$scripts, $path);
         } else {
             self::$scripts[] = $path;
         }
     }
 }
开发者ID:reverserob,项目名称:core,代码行数:26,代码来源:util.php

示例7: addTranslations

 /**
  * add a translation JS file
  *
  * @param string $application application id
  * @param string $languageCode language code, defaults to the current language
  * @param bool $prepend prepend the Script to the beginning of the list 
  */
 public static function addTranslations($application, $languageCode = null, $prepend = false)
 {
     if (is_null($languageCode)) {
         $languageCode = \OC_L10N::findLanguage($application);
     }
     if (!empty($application)) {
         $path = "{$application}/l10n/{$languageCode}";
     } else {
         $path = "l10n/{$languageCode}";
     }
     self::addExternalResource($application, $prepend, $path, "script");
 }
开发者ID:Angelos0,项目名称:core,代码行数:19,代码来源:util.php

示例8: addTranslations

 /**
  * add a translation JS file
  *
  * @param string $application application id
  * @param string $languageCode language code, defaults to the current language
  */
 public static function addTranslations($application, $languageCode = null)
 {
     if (is_null($languageCode)) {
         $languageCode = \OC_L10N::findLanguage($application);
     }
     if (!empty($application)) {
         $path = "{$application}/l10n/{$languageCode}";
     } else {
         $path = "l10n/{$languageCode}";
     }
     if (!in_array($path, self::$scripts)) {
         self::$scripts[] = $path;
     }
 }
开发者ID:GrumpyCrouton,项目名称:core,代码行数:20,代码来源:util.php

示例9: getEventData

 private function getEventData($e)
 {
     $event = array();
     // birthday
     if ($e['calendar'] == "birthday") {
         $event['type'] = "birthday";
         $event['title'] = $e['title'];
         if (OC_L10N::findLanguage() == "de" || OC_L10N::findLanguage() == "de_DE") {
             $event['date'] = $this->getNiceDateTime($e['start'], "d.m.y", true, "");
         } else {
             $event['date'] = $this->getNiceDateTime($e['start'], "m-d-y", true, "");
         }
         return $event;
     }
     // --------------------------------------------------------
     // no birthday, normal events
     $event['title'] = $this->cleanSpecialCharacter($e['title']);
     $event['color'] = $e['color'];
     $event['calendar'] = $e['calendar'];
     $event['location'] = $this->cleanSpecialCharacter($this->getProperty('LOCATION', $e['data']));
     // all day event => one day (no time output, one date)
     // start and end time = 00:00:00
     // startday = endday-1
     if (date("d.m.y H:i:s", $e['origStart']) == date("d.m.y H:i:s", $e['origEnd'] - 60 * 60 * 24) && date("H:i:s", $e['origStart']) == "00:00:00" && date("H:i:s", $e['origEnd']) == "00:00:00") {
         if (OC_L10N::findLanguage() == "de" || OC_L10N::findLanguage() == "de_DE") {
             $event['date'] = $this->getNiceDateTime($e['start'], "d.m.y", true, "");
         } else {
             $event['date'] = $this->getNiceDateTime($e['start'], "m-d-y", true, "");
         }
         // all day event => takes more than one day (no time output)
         // start and end time = 00:00:00
         // end - start > one day
     } elseif (date("H:i:s", $e['origStart']) == "00:00:00" && date("H:i:s", $e['origEnd'] - 60 * 60 * 24) == "00:00:00" && $e['origEnd'] - $e['origStart'] > 60 * 60 * 24) {
         // $e['end']-60*60*24 is for correct end day (end day before not at time 00:00:00)
         if (OC_L10N::findLanguage() == "de" || OC_L10N::findLanguage() == "de_DE") {
             $event['date'] = $this->getNiceDateTime($e['start'], "d.m.y", true, "") . " - " . $this->getNiceDateTime($e['end'] - 60 * 60 * 24, "d.m.y", true, "");
         } else {
             $event['date'] = $this->getNiceDateTime($e['start'], "m-d-y", true, "") . " - " . $this->getNiceDateTime($e['end'] - 60 * 60 * 24, "m-d-y", true, "");
         }
         // normal event => in one day (one date output)
     } elseif (date("d.m.y", $e['start']) == date("d.m.y", $e['end'])) {
         if (OC_L10N::findLanguage() == "de" || OC_L10N::findLanguage() == "de_DE") {
             $event['date'] = $this->getNiceDateTime($e['start'], "d.m.y", true, "H:i") . "Uhr - " . $this->getNiceDateTime($e['end'], "", false, "H:i") . 'Uhr';
         } else {
             $event['date'] = $this->getNiceDateTime($e['start'], "m-d-y", true, "H:i") . " - " . $this->getNiceDateTime($e['end'], "", false, "H:i");
         }
         // normal event => takes more than one day & all other (full output)
     } else {
         if (OC_L10N::findLanguage() == "de" || OC_L10N::findLanguage() == "de_DE") {
             $event['date'] = $this->getNiceDateTime($e['start'], "d.m.y", true, "H:i") . "Uhr - " . $this->getNiceDateTime($e['end'], "d.m.y", true, "H:i") . 'Uhr';
         } else {
             $event['date'] = $this->getNiceDateTime($e['start'], "m-d-y", true, "H:i") . " - " . $this->getNiceDateTime($e['end'], "m-d-y", true, "H:i");
         }
     }
     return $event;
 }
开发者ID:kam1katze,项目名称:ocDashboard,代码行数:56,代码来源:calendar.php

示例10: header

if ($path_info == '/notify_feed/feed.rss') {
    $type = 'RSS2.0';
} else {
    if ($path_info == '/notify_feed/feed.atom') {
        $type = 'ATOM1.0';
    } else {
        header('HTTP/1.0 404 Not Found');
        exit;
    }
}
if (!isset($_SERVER["PHP_AUTH_USER"]) or !OCP\User::checkPassword($uid = $_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) {
    header('WWW-Authenticate: Basic realm="ownCloud Login"');
    header('HTTP/1.0 401 Unauthorized');
    exit;
}
$lang = OC_Preferences::getValue($uid, 'core', 'lang', OC_L10N::findLanguage());
$l = OC_L10N::get('notify', $lang);
//TODO: use different feed creator library (like Zend_Feed) and switch html flag to true
$notifications = OC_Notify::getNotifications($uid, 50, $lang, false);
$baseAddress = (isset($_SERVER["HTTPS"]) ? 'https://' : 'http://') . $_SERVER["SERVER_NAME"];
$rssURI = $baseAddress . $baseuri . 'feed.rss';
$atomURI = $baseAddress . $baseuri . 'feed.atom';
$feed = new UniversalFeedCreator();
$feed->title = $l->t('ownCloud notifications');
$feed->description = $l->t('ownCloud notification stream of the user "%s".', array($uid));
$feed->link = $baseAddress . OC::$WEBROOT;
$feed->syndicationURL = $baseAddress . $_SERVER["PHP_SELF"];
$feed->image = new FeedImage();
$feed->image->title = 'ownCloud';
$feed->image->url = $baseAddress . OCP\Util::imagePath('core', 'logo-inverted.png');
$feed->image->link = $feed->link;
开发者ID:netcon-source,项目名称:apps,代码行数:31,代码来源:feed.php

示例11: OC_Defaults

$defaults = new OC_Defaults();
// initialize themable default strings and urls
// Highlight navigation entry
OC_Util::addScript('settings', 'personal');
OC_Util::addStyle('settings', 'settings');
OC_Util::addScript('3rdparty', 'chosen/chosen.jquery.min');
OC_Util::addStyle('3rdparty', 'chosen');
\OC_Util::addScript('files', 'jquery.fileupload');
if (\OC_Config::getValue('enable_avatars', true) === true) {
    \OC_Util::addScript('3rdparty/Jcrop', 'jquery.Jcrop.min');
    \OC_Util::addStyle('3rdparty/Jcrop', 'jquery.Jcrop.min');
}
OC_App::setActiveNavigationEntry('personal');
$storageInfo = OC_Helper::getStorageInfo('/');
$email = OC_Preferences::getValue(OC_User::getUser(), 'settings', 'email', '');
$userLang = OC_Preferences::getValue(OC_User::getUser(), 'core', 'lang', OC_L10N::findLanguage());
$languageCodes = OC_L10N::findAvailableLanguages();
//check if encryption was enabled in the past
$enableDecryptAll = OC_Util::encryptedFiles();
// array of common languages
$commonlangcodes = array('en', 'es', 'fr', 'de', 'de_DE', 'ja_JP', 'ar', 'ru', 'nl', 'it', 'pt_BR', 'pt_PT', 'da', 'fi_FI', 'nb_NO', 'sv', 'zh_CN', 'ko');
$languageNames = (include 'languageCodes.php');
$languages = array();
$commonlanguages = array();
foreach ($languageCodes as $lang) {
    $l = OC_L10N::get('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])) {
        $ln = array('code' => $lang, 'name' => $languageNames[$lang]);
开发者ID:omusico,项目名称:isle-web-framework,代码行数:31,代码来源:personal.php

示例12: OC_L10N

*
* @author Xavier Beurois
* @copyright 2012 Xavier Beurois www.djazz-lab.net
* 
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either 
* version 3 of the License, or any later version.
* 
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*  
* You should have received a copy of the GNU Lesser General Public 
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
* 
*/
require_once '../../../lib/base.php';
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('storage_charts');
$l = new OC_L10N('storage_charts', OC_L10N::findLanguage(array('en', 'fr')));
// Update and save the new configuration
if (is_numeric($_POST['s']) && in_array($_POST['k'], array('hu_size', 'hu_size_hus'))) {
    OC_DLStCharts::setUConfValue($_POST['k'], $_POST['s']);
    if (strcmp($_POST['k'], 'hu_size') == 0) {
        OC_JSON::encodedPrint(array('r' => OC_DLStChartsLoader::loadChart('clines_usse', $l)));
    } else {
        OC_JSON::encodedPrint(array('r' => OC_DLStChartsLoader::loadChart('chisto_us', $l)));
    }
}
开发者ID:blablubli,项目名称:owncloudapps,代码行数:31,代码来源:data.php

示例13: p

        ?>
"><?php 
        p($additionalparams['title']);
        ?>
</a>
                <?php 
    } else {
        p($additionalparams['title']);
    }
    ?>
                </h2>
        <?php 
}
// show date only if there are news
if (isset($additionalparams['title']) && $additionalparams['title'] != "" && isset($additionalparams['pubdate']) && $additionalparams['pubdate'] != "") {
    if (OC_L10N::findLanguage() == "de" || OC_L10N::findLanguage() == "de_DE") {
        ?>

                <div class='ocDashboard newsreader date'><?php 
        p(date("d.m.y", $additionalparams['pubdate']));
        ?>
 - <?php 
        print_unescaped(date("G:i", $additionalparams['pubdate']));
        ?>
 Uhr</div>

            <?php 
    } else {
        ?>

                <div class='ocDashboard newsreader date'><?php 
开发者ID:kam1katze,项目名称:ocDashboard,代码行数:31,代码来源:newsreader.inc.php

示例14: intval

* You should have received a copy of the GNU Affero General Public 
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
* 
*/
// Check if we are a user
OCP\User::checkLoggedIn();
OCP\App::checkAppEnabled('conversations');
OCP\App::setActiveNavigationEntry('conversations');
// register js and css
OCP\Util::addscript('conversations', 'conversations');
OCP\Util::addScript('conversations', 'jquery.infinitescroll.min');
OCP\Util::addScript('conversations', 'jquery.autosize.min');
OCP\Util::addScript('conversations', 'jquery.timeago');
OCP\Util::addstyle('conversations', 'style');
// add timeago translations
$lang = OC_L10N::findLanguage('conversations');
// TODO: may find a better solution than file_exists
if (in_array($lang, OC_L10N::findAvailableLanguages('conversations')) && file_exists('./apps/conversations/js/jquery.timeago.' . $lang . '.js')) {
    OCP\Util::addScript('conversations', 'jquery.timeago.' . $lang);
}
// rooms
$rooms = OC_Conversations::getRooms();
$updates = OC_Conversations::updateCheck();
$rooms = array_merge_recursive($rooms, $updates);
// get the page that is requested. Needed for endless scrolling
$count = 5;
if (isset($_GET['page'])) {
    $page = intval($_GET['page']) - 1;
} else {
    $page = 0;
}
开发者ID:efrainra,项目名称:OC-User-Conversations,代码行数:31,代码来源:index.php


注:本文中的OC_L10N::findLanguage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。