From 60949f65ad526ee87ca06b4c79533ab1dc0ced1e Mon Sep 17 00:00:00 2001
From: mattab <matthieu.aubry@gmail.com>
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 af8687a11c..9ab13d4f6a 100644
--- a/core/API/Request.php
+++ b/core/API/Request.php
@@ -183,10 +183,8 @@ class Request
         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 dab7f016b1..015899928c 100644
--- a/core/Db/Schema.php
+++ b/core/Db/Schema.php
@@ -130,23 +130,15 @@ class Schema
      */
     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 6c9b96be6b..02f16e7ccb 100644
--- a/core/FrontController.php
+++ b/core/FrontController.php
@@ -326,9 +326,8 @@ class FrontController
             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 @@ class FrontController
             }
 
             /**
-             * 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 a8e9b2e4e9..24e857d3f0 100644
--- a/core/SettingsPiwik.php
+++ b/core/SettingsPiwik.php
@@ -60,14 +60,15 @@ class SettingsPiwik
     {
         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 52aa5527da..536171e4b9 100644
--- a/plugins/CoreAdminHome/templates/trackingCodeGenerator.twig
+++ b/plugins/CoreAdminHome/templates/trackingCodeGenerator.twig
@@ -45,7 +45,7 @@
                 <div class="tracking-option-section">
                     <input type="checkbox" id="javascript-tracking-all-subdomains"/>
                     <label for="javascript-tracking-all-subdomains">{{ 'CoreAdminHome_JSTracking_MergeSubdomains'|translate }}
-                        <span class='current-site-name'>{{ defaultReportSiteName }}</span>
+                        <span class='current-site-name'>{{ defaultReportSiteName|raw }}</span>
                     </label>
 
                     <div class="small-form-description">
@@ -67,7 +67,7 @@
                 <div class="tracking-option-section">
                     <input type="checkbox" id="javascript-tracking-all-aliases"/>
                     <label for="javascript-tracking-all-aliases">{{ 'CoreAdminHome_JSTracking_MergeAliases'|translate }}
-                        <span class='current-site-name'>{{ defaultReportSiteName }}</span>
+                        <span class='current-site-name'>{{ defaultReportSiteName|raw }}</span>
                     </label>
 
                     <div class="small-form-description">
diff --git a/plugins/CustomVariables/CustomVariables.php b/plugins/CustomVariables/CustomVariables.php
index c641c792a5..b57a716bd5 100644
--- a/plugins/CustomVariables/CustomVariables.php
+++ b/plugins/CustomVariables/CustomVariables.php
@@ -124,13 +124,11 @@ class CustomVariables extends \Piwik\Plugin
      */
     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 76fe805667..21a34d2562 100644
--- a/plugins/Goals/Goals.php
+++ b/plugins/Goals/Goals.php
@@ -335,7 +335,7 @@ class Goals extends \Piwik\Plugin
         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 @@ class Goals extends \Piwik\Plugin
         $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 @@ class Goals extends \Piwik\Plugin
      */
     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 a1641e7879..7dc117e5c2 100644
--- a/plugins/UsersManager/templates/userSettings.twig
+++ b/plugins/UsersManager/templates/userSettings.twig
@@ -139,7 +139,7 @@
                         {% if anonymousSites is not empty %}
                             <select id="anonymousDefaultReportWebsite">
                                 {% for info in anonymousSites %}
-                                    <option value="{{ info.idsite }}" {% if anonymousDefaultReport==info.idsite %} selected="selected"{% endif %}>{{ info.name }}</option>
+                                    <option value="{{ info.idsite }}" {% if anonymousDefaultReport==info.idsite %} selected="selected"{% endif %}>{{ info.name|raw }}</option>
                                 {% endfor %}
                             </select>
                         {% endif %}
-- 
GitLab