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);
 }
Example #2
0
 /**
  * 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);
 }
Example #3
0
 /**
  * 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);
     }
 }