本文整理汇总了PHP中Piwik\Translate::getLanguageToLoad方法的典型用法代码示例。如果您正苦于以下问题:PHP Translate::getLanguageToLoad方法的具体用法?PHP Translate::getLanguageToLoad怎么用?PHP Translate::getLanguageToLoad使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Translate
的用法示例。
在下文中一共展示了Translate::getLanguageToLoad方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
$__languages = array('bg', 'cz', 'de', 'en', 'es', 'fr', 'hu', 'id', 'it', 'ja', 'nl', 'pl', 'pt', 'ro', 'ru', 'sr', 'tr', 'uk', 'zh');
if (isset($_SERVER['REQUEST_URI']) && $_SERVER['REQUEST_URI'] !== '') {
$realPath =& $_SERVER['REQUEST_URI'];
} elseif (isset($_SERVER['SCRIPT_NAME']) && $_SERVER['SCRIPT_NAME'] !== '') {
$realPath =& $_SERVER['SCRIPT_NAME'];
} else {
exit(LANG_UNKNOWN_DIR);
}
/** First of all, check if we are inside Piwik */
$dirName = dirname($realPath);
if ($dirName === '/') {
$dirName = '';
}
define('CLICKHEAT_PATH', $dirName . '/plugins/ClickHeat/libs/');
define('CLICKHEAT_INDEX_PATH', 'index.php?module=ClickHeat&');
define('CLICKHEAT_ROOT', PIWIK_INCLUDE_PATH . '/plugins/ClickHeat/libs/');
define('CLICKHEAT_CONFIG', PIWIK_INCLUDE_PATH . '/plugins/ClickHeat/clickheat.php');
define('IS_PIWIK_MODULE', true);
if (Piwik::hasUserSuperUserAccess()) {
define('CLICKHEAT_ADMIN', true);
} else {
define('CLICKHEAT_ADMIN', false);
}
define('CLICKHEAT_LANGUAGE', Translate::getLanguageToLoad());
require_once CLICKHEAT_CONFIG;
/** Specific definitions */
$clickheatConf['__screenSizes'] = array(0, 640, 800, 1024, 1280, 1440, 1600, 1800);
$clickheatConf['__browsersList'] = array('all' => '', 'firefox' => 'Firefox', 'chrome' => 'Google Chrome', 'msie' => 'Internet Explorer', 'safari' => 'Safari', 'opera' => 'Opera', 'kmeleon' => 'K-meleon', 'unknown' => '');
self::conf($clickheatConf);
}
示例2: loadPluginTranslations
/**
* Load translations for loaded plugins
*
* @param bool|string $language Optional language code
*/
public function loadPluginTranslations($language = false)
{
if (empty($language)) {
$language = Translate::getLanguageToLoad();
}
$cache = new CacheFile('tracker', 43200);
// ttl=12hours
$cacheKey = 'PluginTranslations';
if (!empty($language)) {
$cacheKey .= '-' . trim($language);
}
if (!empty($this->loadedPlugins)) {
// makes sure to create a translation in case loaded plugins change (ie Tests vs Tracker vs UI etc)
$cacheKey .= '-' . md5(implode('', $this->getLoadedPluginsName()));
}
$translations = $cache->get($cacheKey);
if (!empty($translations) && is_array($translations) && !Development::isEnabled()) {
Translate::mergeTranslationArray($translations);
return;
}
$translations = array();
$pluginNames = self::getAllPluginsNames();
foreach ($pluginNames as $pluginName) {
if ($this->isPluginLoaded($pluginName) || $this->isPluginBundledWithCore($pluginName)) {
$this->loadTranslation($pluginName, $language);
if (isset($GLOBALS['Piwik_translations'][$pluginName])) {
$translations[$pluginName] = $GLOBALS['Piwik_translations'][$pluginName];
}
}
}
$cache->set($cacheKey, $translations);
}
示例3: loadPluginTranslations
/**
* Load translations for loaded plugins
*
* @param bool|string $language Optional language code
*/
public function loadPluginTranslations($language = false)
{
if (empty($language)) {
$language = Translate::getLanguageToLoad();
}
$plugins = $this->getLoadedPlugins();
foreach ($plugins as $plugin) {
$this->loadTranslation($plugin, $language);
}
}