diff --git a/plugins/LanguagesManager/LanguagesManager.php b/plugins/LanguagesManager/LanguagesManager.php index 9d81a7655f4994c09c1c5ff282eb6823d0c24814..9c977d2bab40ff36613987b28527fa05cf772db5 100644 --- a/plugins/LanguagesManager/LanguagesManager.php +++ b/plugins/LanguagesManager/LanguagesManager.php @@ -35,6 +35,7 @@ class LanguagesManager extends \Piwik\Plugin 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', 'AssetManager.getJavaScriptFiles' => 'getJsFiles', 'Request.dispatchCoreAndPluginUpdatesScreen' => 'initLanguage', + 'Platform.initialized' => 'initLanguage', 'UsersManager.deleteUser' => 'deleteUserLanguage', 'Template.topBar' => 'addLanguagesManagerToOtherTopBar', 'Template.jsGlobalVariables' => 'jsGlobalVariables' diff --git a/plugins/UserCountryMap/UserCountryMap.php b/plugins/UserCountryMap/UserCountryMap.php index 9d124ecf97fd8248764ceeb06fb6f90718daffdc..4d385d7f00dbd89bfbfaf1062d13d19bf9d740e8 100644 --- a/plugins/UserCountryMap/UserCountryMap.php +++ b/plugins/UserCountryMap/UserCountryMap.php @@ -35,11 +35,6 @@ class UserCountryMap extends \Piwik\Plugin public function postLoad() { - if (PluginManager::getInstance()->isPluginActivated('UserCountry')) { - WidgetsList::add('General_Visitors', Piwik::translate('UserCountryMap_VisitorMap'), 'UserCountryMap', 'visitorMap'); - WidgetsList::add('Live!', Piwik::translate('UserCountryMap_RealTimeMap'), 'UserCountryMap', 'realtimeMap'); - } - Piwik::addAction('Template.leftColumnUserCountry', array('Piwik\Plugins\UserCountryMap\UserCountryMap', 'insertMapInLocationReport')); } @@ -54,11 +49,23 @@ class UserCountryMap extends \Piwik\Plugin $hooks = array( 'AssetManager.getJavaScriptFiles' => 'getJsFiles', 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', - 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys' + 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys', + 'Platform.initialized' => array( + 'after' => true, + 'function' => 'registerWidgets' + ) ); return $hooks; } + public function registerWidgets() + { + if (PluginManager::getInstance()->isPluginActivated('UserCountry')) { + WidgetsList::add('General_Visitors', Piwik::translate('UserCountryMap_VisitorMap'), 'UserCountryMap', 'visitorMap'); + WidgetsList::add('Live!', Piwik::translate('UserCountryMap_RealTimeMap'), 'UserCountryMap', 'realtimeMap'); + } + } + public function getJsFiles(&$jsFiles) { $jsFiles[] = "libs/bower_components/visibilityjs/lib/visibility.core.js";