From 60949f65ad526ee87ca06b4c79533ab1dc0ced1e Mon Sep 17 00:00:00 2001 From: mattab Date: Wed, 9 Oct 2013 14:22:13 +1300 Subject: [PATCH] Refs #4199 minor doc --- core/API/Request.php | 6 ++-- core/Db/Schema.php | 24 +++++--------- core/FrontController.php | 11 +++---- core/SettingsPiwik.php | 9 +++--- .../templates/trackingCodeGenerator.twig | 4 +-- plugins/CustomVariables/CustomVariables.php | 12 +++---- plugins/Goals/Goals.php | 31 ++++++++++--------- .../UsersManager/templates/userSettings.twig | 2 +- 8 files changed, 43 insertions(+), 56 deletions(-) diff --git a/core/API/Request.php b/core/API/Request.php index af8687a11c2..9ab13d4f6a7 100644 --- a/core/API/Request.php +++ b/core/API/Request.php @@ -183,10 +183,8 @@ static public function reloadAuthUsingTokenAuth($request = null) if ($token_auth) { /** - * This event will be triggered if the token_auth is found in the $request parameter. In this case the - * current session will be authenticated using this token_auth. It will overwrite the previous `Auth` - * object. - * @matt + * This event is triggered when authenticating the API call, only if the token_auth is found in the request. + * In this case the current session should authenticate using this token_auth. */ Piwik_PostEvent('API.Request.authenticate', array($token_auth)); Access::getInstance()->reloadAccess(); diff --git a/core/Db/Schema.php b/core/Db/Schema.php index dab7f016b17..015899928c7 100644 --- a/core/Db/Schema.php +++ b/core/Db/Schema.php @@ -130,23 +130,15 @@ public static function getSchemas($adapterName) */ private function loadSchema() { - $schema = null; - /** - * @matt can be removed? - */ - Piwik_PostEvent('Schema.loadSchema', array(&$schema)); - if ($schema === null) { - $config = Config::getInstance(); - $dbInfos = $config->database; - if (isset($dbInfos['schema'])) { - $schemaName = $dbInfos['schema']; - } else { - $schemaName = 'Myisam'; - } - $className = self::getSchemaClassName($schemaName); - $schema = new $className(); + $config = Config::getInstance(); + $dbInfos = $config->database; + if (isset($dbInfos['schema'])) { + $schemaName = $dbInfos['schema']; + } else { + $schemaName = 'Myisam'; } - $this->schema = $schema; + $className = self::getSchemaClassName($schemaName); + $this->schema = new $className(); } /** diff --git a/core/FrontController.php b/core/FrontController.php index 6c9b96be6bf..02f16e7ccb8 100644 --- a/core/FrontController.php +++ b/core/FrontController.php @@ -326,9 +326,8 @@ public function init() Access::getInstance(); /** - * This event is triggered after the platform is initialized and most plugins are loaded. The user is not - * authenticated at this point though. You can use this event for instance to initialize your own plugin. - * @matt + * This event is the first event triggered just after the platform is initialized and plugins are loaded. + * You can use this event to do early initialization. Note: the user is not authenticated yet. */ Piwik_PostEvent('Request.dispatchCoreAndPluginUpdatesScreen'); @@ -340,10 +339,8 @@ public function init() } /** - * This event is triggered shortly before the user is authenticated. Use it to create your own - * authentication object instead of the Piwik authentication. Make sure to implement the `Piwik\Auth` - * interface in case you want to define your own authentication. - * @matt here we have a problem if multiple plugins listen to this event? + * This event is triggered before the user is authenticated. You can use it to create your own + * authentication object which implements the `Piwik\Auth` interface, and override the default authentication logic. */ Piwik_PostEvent('Request.initAuthenticationObject'); try { diff --git a/core/SettingsPiwik.php b/core/SettingsPiwik.php index a8e9b2e4e91..24e857d3f04 100644 --- a/core/SettingsPiwik.php +++ b/core/SettingsPiwik.php @@ -60,14 +60,15 @@ static public function getKnownSegmentsToArchive() { if (self::$cachedKnownSegmentsToArchive === null) { $segments = Config::getInstance()->Segments; - $cachedResult = isset($segments['Segments']) ? $segments['Segments'] : array(); + $segmentsToProcess = isset($segments['Segments']) ? $segments['Segments'] : array(); /** - * @matt + * This event is triggered when the automatic archiving runs. + * You can use it to add segments to the list of segments to pre-process during archiving. */ - Piwik_PostEvent('Segments.getKnownSegmentsToArchiveAllSites', array(&$cachedResult)); + Piwik_PostEvent('Segments.getKnownSegmentsToArchiveAllSites', array(&$segmentsToProcess)); - self::$cachedKnownSegmentsToArchive = array_unique($cachedResult); + self::$cachedKnownSegmentsToArchive = array_unique($segmentsToProcess); } return self::$cachedKnownSegmentsToArchive; diff --git a/plugins/CoreAdminHome/templates/trackingCodeGenerator.twig b/plugins/CoreAdminHome/templates/trackingCodeGenerator.twig index 52aa5527da1..536171e4b97 100644 --- a/plugins/CoreAdminHome/templates/trackingCodeGenerator.twig +++ b/plugins/CoreAdminHome/templates/trackingCodeGenerator.twig @@ -45,7 +45,7 @@
@@ -67,7 +67,7 @@
diff --git a/plugins/CustomVariables/CustomVariables.php b/plugins/CustomVariables/CustomVariables.php index c641c792a58..b57a716bd58 100644 --- a/plugins/CustomVariables/CustomVariables.php +++ b/plugins/CustomVariables/CustomVariables.php @@ -124,13 +124,11 @@ public function getSegmentsMetadata(&$segments) */ public function getReportsWithGoalMetrics(&$dimensions) { - $dimensions = array_merge($dimensions, array( - array('category' => Piwik_Translate('General_Visit'), - 'name' => Piwik_Translate('CustomVariables_CustomVariables'), - 'module' => 'CustomVariables', - 'action' => 'getCustomVariables', - ), - )); + $dimensions[] = array('category' => Piwik_Translate('General_Visit'), + 'name' => Piwik_Translate('CustomVariables_CustomVariables'), + 'module' => 'CustomVariables', + 'action' => 'getCustomVariables', + ); } /** diff --git a/plugins/Goals/Goals.php b/plugins/Goals/Goals.php index 76fe8056670..21a34d25629 100644 --- a/plugins/Goals/Goals.php +++ b/plugins/Goals/Goals.php @@ -335,7 +335,7 @@ public function getReportMetadata(&$reports, $info) unset($goalMetrics['nb_visits_converted']); $reportsWithGoals = self::getAllReportsWithGoalMetrics(); - + foreach ($reportsWithGoals as $reportWithGoals) { // Select this report from the API metadata array // and add the Goal metrics to it @@ -356,8 +356,8 @@ static private function getAllReportsWithGoalMetrics() $reportsWithGoals = array(); /* - * This event is triggered to define available goal segments. - * @matt + * This event is triggered by the Goals plugin to gather the list of all reports which define Goal metrics (conversions, revenue). + * You can use this event to add your report to the list of reports displayed in the left column of the Goals Overview report. */ Piwik_PostEvent('Goals.getReportsWithGoalMetrics', array(&$reportsWithGoals)); @@ -384,18 +384,19 @@ static public function getProductReportColumns() */ public function getActualReportsWithGoalMetrics(&$dimensions) { - $dimensions = array_merge($dimensions, array( - array('category' => Piwik_Translate('General_Visit'), - 'name' => Piwik_Translate('Goals_VisitsUntilConv'), - 'module' => 'Goals', - 'action' => 'getVisitsUntilConversion' - ), - array('category' => Piwik_Translate('General_Visit'), - 'name' => Piwik_Translate('Goals_DaysToConv'), - 'module' => 'Goals', - 'action' => 'getDaysToConversion' - ) - )); + $reportWithGoalMetrics = array( + array('category' => Piwik_Translate('General_Visit'), + 'name' => Piwik_Translate('Goals_VisitsUntilConv'), + 'module' => 'Goals', + 'action' => 'getVisitsUntilConversion' + ), + array('category' => Piwik_Translate('General_Visit'), + 'name' => Piwik_Translate('Goals_DaysToConv'), + 'module' => 'Goals', + 'action' => 'getDaysToConversion' + ) + ); + $dimensions = array_merge($dimensions, $reportWithGoalMetrics); } public function getSegmentsMetadata(&$segments) diff --git a/plugins/UsersManager/templates/userSettings.twig b/plugins/UsersManager/templates/userSettings.twig index a1641e78799..7dc117e5c23 100644 --- a/plugins/UsersManager/templates/userSettings.twig +++ b/plugins/UsersManager/templates/userSettings.twig @@ -139,7 +139,7 @@ {% if anonymousSites is not empty %} {% endif %}