diff options
author | Christian Raue <christian.raue@gmail.com> | 2014-07-23 22:27:56 +0400 |
---|---|---|
committer | Christian Raue <christian.raue@gmail.com> | 2014-07-23 22:27:56 +0400 |
commit | d9adcfe6169c6c10059a670f2ed984908eb4e105 (patch) | |
tree | 25cfca25851214c1b744a07e67e9c120adfd7513 /core | |
parent | 2788e1dad22533f3e0dbddbdd16c51251c4e130a (diff) |
removed lots of trailing whitespace
Diffstat (limited to 'core')
115 files changed, 989 insertions, 989 deletions
diff --git a/core/API/Proxy.php b/core/API/Proxy.php index 43d57bcb38..d3e1fbad3f 100644 --- a/core/API/Proxy.php +++ b/core/API/Proxy.php @@ -164,11 +164,11 @@ class Proxy extends Singleton /** * Triggered before an API request is dispatched. - * + * * This event can be used to modify the arguments passed to one or more API methods. - * + * * **Example** - * + * * Piwik::addAction('API.Request.dispatch', function (&$parameters, $pluginName, $methodName) { * if ($pluginName == 'Actions') { * if ($methodName == 'getPageUrls') { @@ -178,7 +178,7 @@ class Proxy extends Singleton * } * } * }); - * + * * @param array &$finalParameters List of parameters that will be passed to the API method. * @param string $pluginName The name of the plugin the API method belongs to. * @param string $methodName The name of the API method that will be called. @@ -187,20 +187,20 @@ class Proxy extends Singleton /** * Triggered before an API request is dispatched. - * + * * This event exists for convenience and is triggered directly after the {@hook API.Request.dispatch} * event is triggered. It can be used to modify the arguments passed to a **single** API method. - * + * * _Note: This is can be accomplished with the {@hook API.Request.dispatch} event as well, however * event handlers for that event will have to do more work._ - * + * * **Example** - * + * * Piwik::addAction('API.Actions.getPageUrls', function (&$parameters) { * // force use of a single website. for some reason. * $parameters['idSite'] = 1; * }); - * + * * @param array &$finalParameters List of parameters that will be passed to the API method. */ Piwik::postEvent(sprintf('API.%s.%s', $pluginName, $methodName), array(&$finalParameters)); @@ -218,16 +218,16 @@ class Proxy extends Singleton /** * Triggered directly after an API request is dispatched. - * + * * This event exists for convenience and is triggered immediately before the * {@hook API.Request.dispatch.end} event. It can be used to modify the output of a **single** * API method. - * + * * _Note: This can be accomplished with the {@hook API.Request.dispatch.end} event as well, * however event handlers for that event will have to do more work._ * * **Example** - * + * * // append (0 hits) to the end of row labels whose row has 0 hits * Piwik::addAction('API.Actions.getPageUrls', function (&$returnValue, $info)) { * $returnValue->filter('ColumnCallbackReplace', 'label', function ($label, $hits) { @@ -238,13 +238,13 @@ class Proxy extends Singleton * } * }, null, array('nb_hits')); * } - * + * * @param mixed &$returnedValue The API method's return value. Can be an object, such as a * {@link Piwik\DataTable DataTable} instance. * could be a {@link Piwik\DataTable DataTable}. * @param array $extraInfo An array holding information regarding the API request. Will * contain the following data: - * + * * - **className**: The namespace-d class name of the API instance * that's being called. * - **module**: The name of the plugin the API request was @@ -257,11 +257,11 @@ class Proxy extends Singleton /** * Triggered directly after an API request is dispatched. - * + * * This event can be used to modify the output of any API method. - * + * * **Example** - * + * * // append (0 hits) to the end of row labels whose row has 0 hits for any report that has the 'nb_hits' metric * Piwik::addAction('API.Actions.getPageUrls', function (&$returnValue, $info)) { * // don't process non-DataTable reports and reports that don't have the nb_hits column @@ -270,7 +270,7 @@ class Proxy extends Singleton * ) { * return; * } - * + * * $returnValue->filter('ColumnCallbackReplace', 'label', function ($label, $hits) { * if ($hits === 0) { * return $label . " (0 hits)"; @@ -279,12 +279,12 @@ class Proxy extends Singleton * } * }, null, array('nb_hits')); * } - * + * * @param mixed &$returnedValue The API method's return value. Can be an object, such as a * {@link Piwik\DataTable DataTable} instance. * @param array $extraInfo An array holding information regarding the API request. Will * contain the following data: - * + * * - **className**: The namespace-d class name of the API instance * that's being called. * - **module**: The name of the plugin the API request was diff --git a/core/API/Request.php b/core/API/Request.php index 5c796a067d..d1944ea2ac 100644 --- a/core/API/Request.php +++ b/core/API/Request.php @@ -20,38 +20,38 @@ use Piwik\UrlHelper; /** * Dispatches API requests to the appropriate API method. - * + * * The Request class is used throughout Piwik to call API methods. The difference * between using Request and calling API methods directly is that Request * will do more after calling the API including: applying generic filters, applying queued filters, * and handling the **flat** and **label** query parameters. - * + * * Additionally, the Request class will **forward current query parameters** to the request * which is more convenient than calling {@link Piwik\Common::getRequestVar()} many times over. - * + * * In most cases, using a Request object to query the API is the correct approach. * * ### Post-processing - * + * * The return value of API methods undergo some extra processing before being returned by Request. * To learn more about what happens to API results, read [this](/guides/piwiks-web-api#extra-report-processing). * * ### Output Formats - * + * * The value returned by Request will be serialized to a certain format before being returned. * To see the list of supported output formats, read [this](/guides/piwiks-web-api#output-formats). - * + * * ### Examples - * + * * **Basic Usage** - * + * * $request = new Request('method=UserSettings.getWideScreen&idSite=1&date=yesterday&period=week' * . '&format=xml&filter_limit=5&filter_offset=0') * $result = $request->process(); * echo $result; - * + * * **Getting a unrendered DataTable** - * + * * // use the convenience method 'processRequest' * $dataTable = Request::processRequest('UserSettings.getWideScreen', array( * 'idSite' => 1, @@ -59,7 +59,7 @@ use Piwik\UrlHelper; * 'period' => 'week', * 'filter_limit' => 5, * 'filter_offset' => 0 - * + * * 'format' => 'original', // this is the important bit * )); * echo "This DataTable has " . $dataTable->getRowsCount() . " rows."; @@ -168,9 +168,9 @@ class Request /** * Dispatches the API request to the appropriate API method and returns the result * after post-processing. - * + * * Post-processing includes: - * + * * - flattening if **flat** is 0 * - running generic filters unless **disable_generic_filters** is set to 1 * - URL decoding label column values @@ -178,10 +178,10 @@ class Request * - removing columns based on the values of the **hideColumns** and **showColumns** query parameters * - filtering rows if the **label** query parameter is set * - converting the result to the appropriate format (ie, XML, JSON, etc.) - * + * * If `'original'` is supplied for the output format, the result is returned as a PHP * object. - * + * * @throws PluginDeactivatedException if the module plugin is not activated. * @throws Exception if the requested API method cannot be called, if required parameters for the * API method are missing or if the API method throws an exception and the **format** @@ -223,7 +223,7 @@ class Request /** * Returns the name of a plugin's API class by plugin name. - * + * * @param string $plugin The plugin name, eg, `'Referrers'`. * @return string The fully qualified API class name, eg, `'\Piwik\Plugins\Referrers\API'`. */ @@ -250,11 +250,11 @@ class Request /** * Triggered when authenticating an API request, but only if the **token_auth** * query parameter is found in the request. - * + * * Plugins that provide authentication capabilities should subscribe to this event * and make sure the global authentication object (the object returned by `Registry::get('auth')`) * is setup to use `$token_auth` when its `authenticate()` method is executed. - * + * * @param string $token_auth The value of the **token_auth** query parameter. */ Piwik::postEvent('API.Request.authenticate', array($token_auth)); @@ -305,7 +305,7 @@ class Request * Returns the original request parameters in the current query string as an array mapping * query parameter names with values. The result of this function will not be affected * by any modifications to `$_GET` and will not include parameters in `$_POST`. - * + * * @return array */ public static function getRequestParametersGET() @@ -379,7 +379,7 @@ class Request /** * Returns the segment query parameter from the original request, without modifications. - * + * * @return array|bool */ public static function getRawSegmentFromRequest() diff --git a/core/Access.php b/core/Access.php index a1b823a2cc..bd3dbbb6a1 100644 --- a/core/Access.php +++ b/core/Access.php @@ -12,24 +12,24 @@ use Piwik\Db; /** * Singleton that manages user access to Piwik resources. - * + * * To check whether a user has access to a resource, use one of the {@link Piwik Piwik::checkUser...} * methods. * * In Piwik there are four different access levels: - * + * * - **no access**: Users with this access level cannot view the resource. * - **view access**: Users with this access level can view the resource, but cannot modify it. * - **admin access**: Users with this access level can view and modify the resource. * - **Super User access**: Only the Super User has this access level. It means the user can do * whatever he/she wants. - * + * * Super user access is required to set some configuration options. * All other options are specific to the user or to a website. * * Access is granted per website. Uses with access for a website can view all * data associated with that website. - * + * */ class Access { diff --git a/core/Archive.php b/core/Archive.php index c7407c0af0..63f0a61dc8 100644 --- a/core/Archive.php +++ b/core/Archive.php @@ -16,49 +16,49 @@ use Piwik\Period\Factory; /** * The **Archive** class is used to query cached analytics statistics * (termed "archive data"). - * + * * You can use **Archive** instances to get data that was archived for one or more sites, * for one or more periods and one optional segment. - * + * * If archive data is not found, this class will initiate the archiving process. [1](#footnote-1) - * + * * **Archive** instances must be created using the {@link build()} factory method; * they cannot be constructed. - * + * * You can search for metrics (such as `nb_visits`) using the {@link getNumeric()} and * {@link getDataTableFromNumeric()} methods. You can search for * reports using the {@link getBlob()}, {@link getDataTable()} and {@link getDataTableExpanded()} methods. - * + * * If you're creating an API that returns report data, you may want to use the * {@link getDataTableFromArchive()} helper function. - * + * * ### Learn more - * + * * Learn more about _archiving_ [here](/guides/all-about-analytics-data). - * + * * ### Limitations - * + * * - You cannot get data for multiple range periods in a single query. * - You cannot get data for periods of different types in a single query. - * + * * ### Examples - * + * * **_Querying metrics for an API method_** - * + * * // one site and one period * $archive = Archive::build($idSite = 1, $period = 'week', $date = '2013-03-08'); * return $archive->getDataTableFromNumeric(array('nb_visits', 'nb_actions')); - * + * * // all sites and multiple dates * $archive = Archive::build($idSite = 'all', $period = 'month', $date = '2013-01-02,2013-03-08'); * return $archive->getDataTableFromNumeric(array('nb_visits', 'nb_actions')); - * + * * **_Querying and using metrics immediately_** - * + * * // one site and one period * $archive = Archive::build($idSite = 1, $period = 'week', $date = '2013-03-08'); * $data = $archive->getNumeric(array('nb_visits', 'nb_actions')); - * + * * $visits = $data['nb_visits']; * $actions = $data['nb_actions']; * @@ -67,37 +67,37 @@ use Piwik\Period\Factory; * // multiple sites and multiple dates * $archive = Archive::build($idSite = '1,2,3', $period = 'month', $date = '2013-01-02,2013-03-08'); * $data = $archive->getNumeric('nb_visits'); - * + * * $janSite1Visits = $data['1']['2013-01-01,2013-01-31']['nb_visits']; * $febSite1Visits = $data['1']['2013-02-01,2013-02-28']['nb_visits']; * // ... etc. - * + * * **_Querying for reports_** - * + * * $archive = Archive::build($idSite = 1, $period = 'week', $date = '2013-03-08'); * $dataTable = $archive->getDataTable('MyPlugin_MyReport'); * // ... manipulate $dataTable ... * return $dataTable; - * + * * **_Querying a report for an API method_** - * + * * public function getMyReport($idSite, $period, $date, $segment = false, $expanded = false) * { * $dataTable = Archive::getDataTableFromArchive('MyPlugin_MyReport', $idSite, $period, $date, $segment, $expanded); * $dataTable->queueFilter('ReplaceColumnNames'); * return $dataTable; * } - * + * * **_Querying data for multiple range periods_** - * + * * // get data for first range * $archive = Archive::build($idSite = 1, $period = 'range', $date = '2013-03-08,2013-03-12'); * $dataTable = $archive->getDataTableFromNumeric(array('nb_visits', 'nb_actions')); - * + * * // get data for second range * $archive = Archive::build($idSite = 1, $period = 'range', $date = '2013-03-15,2013-03-20'); * $dataTable = $archive->getDataTableFromNumeric(array('nb_visits', 'nb_actions')); - * + * * <a name="footnote-1"></a> * [1]: The archiving process will not be launched if browser archiving is disabled * and the current request came from a browser. @@ -215,13 +215,13 @@ class Archive /** * Returns a new Archive instance that will query archive data for the given set of * sites and periods, using an optional segment. - * + * * This method uses an array of Period instances and a Segment instance, instead of strings * like {@link build()}. - * + * * If you want to create an Archive instance using data found in query parameters, * use {@link build()}. - * + * * @param Segment $segment The segment to use. For no segment, use `new Segment('', $idSites)`. * @param array $periods An array of Period instances. * @param array $idSites An array of site IDs (eg, `array(1, 2, 3)`). @@ -253,16 +253,16 @@ class Archive /** * Queries and returns metric data in an array. - * + * * If multiple sites were requested in {@link build()} or {@link factory()} the result will * be indexed by site ID. - * + * * If multiple periods were requested in {@link build()} or {@link factory()} the result will * be indexed by period. - * + * * The site ID index is always first, so if multiple sites & periods were requested, the result * will be indexed by site ID first, then period. - * + * * @param string|array $names One or more archive names, eg, `'nb_visits'`, `'Referrers_distinctKeywords'`, * etc. * @return false|numeric|array `false` if there is no data to return, a single numeric value if we're not querying @@ -289,17 +289,17 @@ class Archive /** * Queries and returns blob data in an array. - * + * * Reports are stored in blobs as serialized arrays of {@link DataTable\Row} instances, but this * data can technically be anything. In other words, you can store whatever you want * as archive data blobs. * * If multiple sites were requested in {@link build()} or {@link factory()} the result will * be indexed by site ID. - * + * * If multiple periods were requested in {@link build()} or {@link factory()} the result will * be indexed by period. - * + * * The site ID index is always first, so if multiple sites & periods were requested, the result * will be indexed by site ID first, then period. * @@ -317,20 +317,20 @@ class Archive /** * Queries and returns metric data in a DataTable instance. - * + * * If multiple sites were requested in {@link build()} or {@link factory()} the result will * be a DataTable\Map that is indexed by site ID. - * + * * If multiple periods were requested in {@link build()} or {@link factory()} the result will * be a {@link DataTable\Map} that is indexed by period. - * + * * The site ID index is always first, so if multiple sites & periods were requested, the result * will be a {@link DataTable\Map} indexed by site ID which contains {@link DataTable\Map} instances that are * indexed by period. - * + * * _Note: Every DataTable instance returned will have at most one row in it. The contents of each * row will be the requested metrics for the appropriate site and period._ - * + * * @param string|array $names One or more archive names, eg, 'nb_visits', 'Referrers_distinctKeywords', * etc. * @return DataTable|DataTable\Map A DataTable if multiple sites and periods were not requested. @@ -344,20 +344,20 @@ class Archive /** * Queries and returns one or more reports as DataTable instances. - * + * * This method will query blob data that is a serialized array of of {@link DataTable\Row}'s and * unserialize it. - * + * * If multiple sites were requested in {@link build()} or {@link factory()} the result will * be a {@link DataTable\Map} that is indexed by site ID. - * + * * If multiple periods were requested in {@link build()} or {@link factory()} the result will * be a DataTable\Map that is indexed by period. - * + * * The site ID index is always first, so if multiple sites & periods were requested, the result * will be a {@link DataTable\Map} indexed by site ID which contains {@link DataTable\Map} instances that are * indexed by period. - * + * * @param string $name The name of the record to get. This method can only query one record at a time. * @param int|string|null $idSubtable The ID of the subtable to get (if any). * @return DataTable|DataTable\Map A DataTable if multiple sites and periods were not requested. @@ -371,13 +371,13 @@ class Archive /** * Queries and returns one report with all of its subtables loaded. - * + * * If multiple sites were requested in {@link build()} or {@link factory()} the result will * be a DataTable\Map that is indexed by site ID. - * + * * If multiple periods were requested in {@link build()} or {@link factory()} the result will * be a DataTable\Map that is indexed by period. - * + * * The site ID index is always first, so if multiple sites & periods were requested, the result * will be a {@link DataTable\Map indexed} by site ID which contains {@link DataTable\Map} instances that are * indexed by period. @@ -399,7 +399,7 @@ class Archive /** * Returns the list of plugins that archive the given reports. - * + * * @param array $archiveNames * @return array */ @@ -426,7 +426,7 @@ class Archive /** * Helper function that creates an Archive instance and queries for report data using * query parameter data. API methods can use this method to reduce code redundancy. - * + * * @param string $name The name of the report to return. * @param int|string|array $idSite @see {@link build()} * @param string $period @see {@link build()} diff --git a/core/ArchiveProcessor.php b/core/ArchiveProcessor.php index 10374f18c4..cd3fc0138c 100644 --- a/core/ArchiveProcessor.php +++ b/core/ArchiveProcessor.php @@ -20,58 +20,58 @@ use Piwik\Period; /** * Used by {@link Piwik\Plugin\Archiver} instances to insert and aggregate archive data. - * + * * ### See also - * + * * - **{@link Piwik\Plugin\Archiver}** - to learn how plugins should implement their own analytics * aggregation logic. * - **{@link Piwik\DataAccess\LogAggregator}** - to learn how plugins can perform data aggregation * across Piwik's log tables. - * + * * ### Examples - * + * * **Inserting numeric data** - * + * * // function in an Archiver descendant * public function aggregateDayReport() * { * $archiveProcessor = $this->getProcessor(); - * + * * $myFancyMetric = // ... calculate the metric value ... * $archiveProcessor->insertNumericRecord('MyPlugin_myFancyMetric', $myFancyMetric); * } - * + * * **Inserting serialized DataTables** - * + * * // function in an Archiver descendant * public function aggregateDayReport() * { * $archiveProcessor = $this->getProcessor(); - * + * * $maxRowsInTable = Config::getInstance()->General['datatable_archiving_maximum_rows_standard'];j - * + * * $dataTable = // ... build by aggregating visits ... * $serializedData = $dataTable->getSerialized($maxRowsInTable, $maxRowsInSubtable = $maxRowsInTable, * $columnToSortBy = Metrics::INDEX_NB_VISITS); - * + * * $archiveProcessor->insertBlobRecords('MyPlugin_myFancyReport', $serializedData); * } - * + * * **Aggregating archive data** - * + * * // function in Archiver descendant * public function aggregateMultipleReports() * { * $archiveProcessor = $this->getProcessor(); - * + * * // aggregate a metric * $archiveProcessor->aggregateNumericMetrics('MyPlugin_myFancyMetric'); * $archiveProcessor->aggregateNumericMetrics('MyPlugin_mySuperFancyMetric', 'max'); - * - * // aggregate a report + * + * // aggregate a report * $archiveProcessor->aggregateDataTableRecords('MyPlugin_myFancyReport'); * } - * + * */ class ArchiveProcessor { @@ -172,7 +172,7 @@ class ArchiveProcessor * when summed because they cannot be summed, eg, * `array('nb_uniq_visitors' => 'sum_daily_nb_uniq_visitors')`. * @return array Returns the row counts of each aggregated report before truncation, eg, - * + * * array( * 'report1' => array('level0' => $report1->getRowsCount, * 'recursive' => $report1->getRowsCountRecursive()), @@ -227,12 +227,12 @@ class ArchiveProcessor * @return array|int Returns the array of aggregate values. If only one metric was aggregated, * the aggregate value will be returned as is, not in an array. * For example, if `array('nb_visits', 'nb_hits')` is supplied for `$columns`, - * + * * array( * 'nb_visits' => 3040, * 'nb_hits' => 405 * ) - * + * * could be returned. If `array('nb_visits')` or `'nb_visits'` is used for `$columns`, * then `3040` would be returned. * @api @@ -272,7 +272,7 @@ class ArchiveProcessor * * @param array $numericRecords A name-value mapping of numeric values that should be * archived, eg, - * + * * array('Referrers_distinctKeywords' => 23, 'Referrers_distinctCampaigns' => 234) * @api */ diff --git a/core/ArchiveProcessor/Parameters.php b/core/ArchiveProcessor/Parameters.php index b6aa1c63f9..79cb1c7196 100644 --- a/core/ArchiveProcessor/Parameters.php +++ b/core/ArchiveProcessor/Parameters.php @@ -45,7 +45,7 @@ class Parameters /** * Constructor. - * + * * @ignore */ public function __construct(Site $site, Period $period, Segment $segment, $skipAggregationOfSubTables = false) diff --git a/core/ArchiveProcessor/Rules.php b/core/ArchiveProcessor/Rules.php index dec40d7568..03b26acf2f 100644 --- a/core/ArchiveProcessor/Rules.php +++ b/core/ArchiveProcessor/Rules.php @@ -23,7 +23,7 @@ use Piwik\Tracker\Cache; /** * This class contains Archiving rules/logic which are used when creating and processing Archives. - * + * */ class Rules { diff --git a/core/AssetManager/UIAssetMerger/StylesheetUIAssetMerger.php b/core/AssetManager/UIAssetMerger/StylesheetUIAssetMerger.php index 11d6a633af..de0f5f1ffa 100644 --- a/core/AssetManager/UIAssetMerger/StylesheetUIAssetMerger.php +++ b/core/AssetManager/UIAssetMerger/StylesheetUIAssetMerger.php @@ -81,7 +81,7 @@ class StylesheetUIAssetMerger extends UIAssetMerger protected function processFileContent($uiAsset) { - $pathsRewriter = $this->getCssPathsRewriter($uiAsset); + $pathsRewriter = $this->getCssPathsRewriter($uiAsset); $content = $uiAsset->getContent(); $content = $this->rewriteCssImagePaths($content, $pathsRewriter); $content = $this->rewriteCssImportPaths($content, $pathsRewriter); @@ -128,7 +128,7 @@ class StylesheetUIAssetMerger extends UIAssetMerger return function ($matches) use ($baseDirectory) { $absolutePath = PIWIK_USER_PATH . "/$baseDirectory/" . $matches[2]; - + // Allow to import extension less file if (strpos($matches[2], '.') === false) { $absolutePath .= '.less'; diff --git a/core/CliMulti/CliPhp.php b/core/CliMulti/CliPhp.php index b4c3d376a1..df82e05376 100644 --- a/core/CliMulti/CliPhp.php +++ b/core/CliMulti/CliPhp.php @@ -54,9 +54,9 @@ class CliPhp if (!$this->isValidPhpVersion($bin)) { return false; } - + $bin .= ' -q'; - + return $bin; } diff --git a/core/CliMulti/Process.php b/core/CliMulti/Process.php index 907d178e40..1b77dc152a 100644 --- a/core/CliMulti/Process.php +++ b/core/CliMulti/Process.php @@ -201,7 +201,7 @@ class Process * ps -e requires /proc * @return bool */ - private static function isProcFSMounted() + private static function isProcFSMounted() { return is_resource(@fopen('/proc', 'r')); } diff --git a/core/Common.php b/core/Common.php index 511f1ca61f..3b49dc9bd9 100644 --- a/core/Common.php +++ b/core/Common.php @@ -48,7 +48,7 @@ class Common /** * Returns a prefixed table name. - * + * * The table prefix is determined by the `[database] tables_prefix` INI config * option. * @@ -82,7 +82,7 @@ class Common * * The table prefix is determined by the `[database] tables_prefix` INI config * option. - * + * * @param string $table The prefixed table name, eg "piwik-production_log_visit". * @return string The unprefixed table name, eg "log_visit". * @api @@ -168,7 +168,7 @@ class Common /** * Multi-byte substr() - works with UTF-8. - * + * * Calls `mb_substr` if available and falls back to `substr` if it's not. * * @param string $string @@ -192,7 +192,7 @@ class Common /** * Multi-byte strlen() - works with UTF-8 - * + * * Calls `mb_substr` if available and falls back to `substr` if not. * * @param string $string @@ -210,9 +210,9 @@ class Common /** * Multi-byte strtolower() - works with UTF-8. - * + * * Calls `mb_strtolower` if available and falls back to `strtolower` if not. - * + * * @param string $string * @return string * @api @@ -232,18 +232,18 @@ class Common /** * Sanitizes a string to help avoid XSS vulnerabilities. - * + * * This function is automatically called when {@link getRequestVar()} is called, * so you should not normally have to use it. - * + * * This function should be used when outputting data that isn't escaped and was * obtained from the user (for example when using the `|raw` twig filter on goal names). - * + * * _NOTE: Sanitized input should not be used directly in an SQL query; SQL placeholders * should still be used._ - * + * * **Implementation Details** - * + * * - [htmlspecialchars](http://php.net/manual/en/function.htmlspecialchars.php) is used to escape text. * - Single quotes are not escaped so **Piwik's amazing community** will still be * **Piwik's amazing community**. @@ -318,7 +318,7 @@ class Common /** * Unsanitizes a single input value and returns the result. - * + * * @param string $value * @return string unsanitized input */ @@ -332,10 +332,10 @@ class Common * * This method should be used when you need to unescape data that was obtained from * the user. - * + * * Some data in Piwik is stored sanitized (such as site name). In this case you may * have to use this method to unsanitize it in order to, for example, output it in JSON. - * + * * @param string|array $value The data to unsanitize. If an array is passed, the * array is sanitized recursively. Key values are not unsanitized. * @return string|array The unsanitized data. @@ -381,9 +381,9 @@ class Common /** * Gets a sanitized request parameter by name from the `$_GET` and `$_POST` superglobals. - * + * * Use this function to get request parameter values. **_NEVER use `$_GET` and `$_POST` directly._** - * + * * If the variable cannot be found, and a default value was not provided, an exception is raised. * * _See {@link sanitizeInputValues()} to learn more about sanitization._ @@ -393,7 +393,7 @@ class Common * @param string|null $varDefault The value to return if the request parameter cannot be found or has an empty value. * @param string|null $varType Expected type of the request variable. This parameters value must be one of the following: * `'array'`, `'int'`, `'integer'`, `'string'`, `'json'`. - * + * * If `'json'`, the string value will be `json_decode`-d and then sanitized. * @param array|null $requestArrayToUse The array to use instead of `$_GET` and `$_POST`. * @throws Exception If the request parameter doesn't exist and there is no default value, or if the request parameter @@ -1012,10 +1012,10 @@ class Common /** * Returns a string with a comma separated list of placeholders for use in an SQL query. Used mainly * to fill the `IN (...)` part of a query. - * + * * @param array|string $fields The names of the mysql table fields to bind, e.g. * `array(fieldName1, fieldName2, fieldName3)`. - * + * * _Note: The content of the array isn't important, just its length._ * @return string The placeholder string, e.g. `"?, ?, ?"`. * @api diff --git a/core/Config.php b/core/Config.php index 0c56f95b0c..f71baa710a 100644 --- a/core/Config.php +++ b/core/Config.php @@ -13,13 +13,13 @@ use Exception; /** * Singleton that provides read & write access to Piwik's INI configuration. - * + * * This class reads and writes to the `config/config.ini.php` file. If config * options are missing from that file, this class will look for their default * values in `config/global.ini.php`. - * + * * ### Examples - * + * * **Getting a value:** * * // read the minimum_memory_limit option under the [General] section @@ -30,12 +30,12 @@ use Exception; * // set the minimum_memory_limit option * Config::getInstance()->General['minimum_memory_limit'] = 256; * Config::getInstance()->forceSave(); - * + * * **Setting an entire section:** - * + * * Config::getInstance()->MySection = array('myoption' => 1); * Config::getInstance()->forceSave(); - * + * * @method static \Piwik\Config getInstance() */ class Config extends Singleton diff --git a/core/Console.php b/core/Console.php index d03fe0501f..e0e9a3a32c 100644 --- a/core/Console.php +++ b/core/Console.php @@ -136,7 +136,7 @@ class Console extends Application $commands = array( 'Piwik\CliMulti\RequestCommand' ); - + if (class_exists('Piwik\Plugins\EnterpriseAdmin\EnterpriseAdmin')) { $extra = new \Piwik\Plugins\EnterpriseAdmin\EnterpriseAdmin(); $extra->addConsoleCommands($commands); diff --git a/core/CronArchive.php b/core/CronArchive.php index ae5c6fd8f9..1549392876 100644 --- a/core/CronArchive.php +++ b/core/CronArchive.php @@ -76,7 +76,7 @@ class CronArchive private $requests = 0; private $output = ''; private $archiveAndRespectTTL = true; - + private $lastSuccessRunTimestamp = false; private $errors = array(); private $isCoreInited = false; @@ -97,7 +97,7 @@ class CronArchive * The list of IDs of sites to ignore when launching archiving. Archiving will not be launched * for any site whose ID is in this list (even if the ID is supplied in {@link $shouldArchiveSpecifiedSites} * or if {@link $shouldArchiveAllSites} is true). - * + * * @var int[] */ public $shouldSkipSpecifiedSites = array(); @@ -921,10 +921,10 @@ class CronArchive /** * Triggered by the **core:archive** console command so plugins can modify the list of * websites that the archiving process will be launched for. - * + * * Plugins can use this hook to add websites to archive, remove websites to archive, or change * the order in which websites will be archived. - * + * * @param array $websiteIds The list of website IDs to launch the archiving process for. */ Piwik::postEvent('CronArchive.filterWebsiteIds', array(&$websiteIds)); diff --git a/core/DataAccess/LogAggregator.php b/core/DataAccess/LogAggregator.php index e790bab458..d52ff8b7a0 100644 --- a/core/DataAccess/LogAggregator.php +++ b/core/DataAccess/LogAggregator.php @@ -17,43 +17,43 @@ use Piwik\Tracker\GoalManager; /** * Contains methods that calculate metrics by aggregating log data (visits, actions, conversions, * ecommerce items). - * + * * You can use the methods in this class within {@link Piwik\Plugin\Archiver Archiver} descendants * to aggregate log data without having to write SQL queries. - * + * * ### Aggregation Dimension - * + * * All aggregation methods accept a **dimension** parameter. These parameters are important as * they control how rows in a table are aggregated together. - * + * * A **_dimension_** is just a table column. Rows that have the same values for these columns are * aggregated together. The result of these aggregations is a set of metrics for every recorded value * of a **dimension**. - * + * * _Note: A dimension is essentially the same as a **GROUP BY** field._ - * + * * ### Examples - * + * * **Aggregating visit data** - * + * * $archiveProcessor = // ... * $logAggregator = $archiveProcessor->getLogAggregator(); - * + * * // get metrics for every used browser language of all visits by returning visitors * $query = $logAggregator->queryVisitsByDimension( * $dimensions = array('log_visit.location_browser_lang'), * $where = 'log_visit.visitor_returning = 1', - * + * * // also count visits for each browser language that are not located in the US * $additionalSelects = array('sum(case when log_visit.location_country <> 'us' then 1 else 0 end) as nonus'), - * + * * // we're only interested in visits, unique visitors & actions, so don't waste time calculating anything else * $metrics = array(Metrics::INDEX_NB_UNIQ_VISITORS, Metrics::INDEX_NB_VISITS, Metrics::INDEX_NB_ACTIONS), * ); * if ($query === false) { * return; * } - * + * * while ($row = $query->fetch()) { * $uniqueVisitors = $row[Metrics::INDEX_NB_UNIQ_VISITORS]; * $visits = $row[Metrics::INDEX_NB_VISITS]; @@ -136,7 +136,7 @@ class LogAggregator /** * Constructor. - * + * * @param \Piwik\ArchiveProcessor\Parameters $params */ public function __construct(Parameters $params) @@ -268,7 +268,7 @@ class LogAggregator * clause. These can be aggregate expressions, eg, `SUM(somecol)`. * @param bool|array $metrics The set of metrics to calculate and return. If false, the query will select * all of them. The following values can be used: - * + * * - {@link Piwik\Metrics::INDEX_NB_UNIQ_VISITORS} * - {@link Piwik\Metrics::INDEX_NB_VISITS} * - {@link Piwik\Metrics::INDEX_NB_ACTIONS} @@ -590,7 +590,7 @@ class LogAggregator * clause. These can be aggregate expressions, eg, `SUM(somecol)`. * @param bool|array $metrics The set of metrics to calculate and return. If `false`, the query will select * all of them. The following values can be used: - * + * * - {@link Piwik\Metrics::INDEX_NB_UNIQ_VISITORS} * - {@link Piwik\Metrics::INDEX_NB_VISITS} * - {@link Piwik\Metrics::INDEX_NB_ACTIONS} @@ -601,7 +601,7 @@ class LogAggregator * log_action should be joined on. The table alias used for each join * is `"log_action$i"` where `$i` is the index of the column in this * array. - * + * * If a string is used for this parameter, the table alias is not * suffixed (since there is only one column). * @return mixed A Zend_Db_Statement if `$rankingQuery` isn't supplied, otherwise the result of @@ -688,32 +688,32 @@ class LogAggregator * - **{@link Piwik\Metrics::INDEX_GOAL_ECOMMERCE_REVENUE_SUBTOTAL}**: The total cost of all ecommerce items sold * within these conversions. This value does not * include tax, shipping or any applied discount. - * + * * _This metric is only applicable to the special * **ecommerce** goal (where `idGoal == 'ecommerceOrder'`)._ * - **{@link Piwik\Metrics::INDEX_GOAL_ECOMMERCE_REVENUE_TAX}**: The total tax applied to every transaction in these * conversions. - * + * * _This metric is only applicable to the special * **ecommerce** goal (where `idGoal == 'ecommerceOrder'`)._ * - **{@link Piwik\Metrics::INDEX_GOAL_ECOMMERCE_REVENUE_SHIPPING}**: The total shipping cost for every transaction * in these conversions. - * + * * _This metric is only applicable to the special * **ecommerce** goal (where `idGoal == 'ecommerceOrder'`)._ * - **{@link Piwik\Metrics::INDEX_GOAL_ECOMMERCE_REVENUE_DISCOUNT}**: The total discount applied to every transaction * in these conversions. - * + * * _This metric is only applicable to the special * **ecommerce** goal (where `idGoal == 'ecommerceOrder'`)._ * - **{@link Piwik\Metrics::INDEX_GOAL_ECOMMERCE_ITEMS}**: The total number of ecommerce items sold in each transaction * in these conversions. - * + * * _This metric is only applicable to the special * **ecommerce** goal (where `idGoal == 'ecommerceOrder'`)._ - * + * * Additional data can be selected through the `$additionalSelects` parameter. - * + * * _Note: This method will only query the **log_conversion** table. Other tables cannot be joined * using this method._ * @@ -747,9 +747,9 @@ class LogAggregator * * **Note:** The result of this function is meant for use in the `$additionalSelects` parameter * in one of the query... methods (for example {@link queryVisitsByDimension()}). - * + * * **Example** - * + * * // summarize one column * $visitTotalActionsRanges = array( * array(1, 1), @@ -757,7 +757,7 @@ class LogAggregator * array(10) * ); * $selects = LogAggregator::getSelectsFromRangedColumn('visit_total_actions', $visitTotalActionsRanges, 'log_visit', 'vta'); - * + * * // summarize another column in the same request * $visitCountVisitsRanges = array( * array(1, 1), @@ -768,17 +768,17 @@ class LogAggregator * $selects, * LogAggregator::getSelectsFromRangedColumn('visitor_count_visits', $visitCountVisitsRanges, 'log_visit', 'vcv') * ); - * + * * // perform the query * $logAggregator = // get the LogAggregator somehow * $query = $logAggregator->queryVisitsByDimension($dimensions = array(), $where = false, $selects); * $tableSummary = $query->fetch(); - * + * * $numberOfVisitsWithOneAction = $tableSummary['vta0']; * $numberOfVisitsBetweenTwoAnd10 = $tableSummary['vta1']; - * + * * $numberOfVisitsWithVisitCountOfOne = $tableSummary['vcv0']; - * + * * @param string $column The name of a column in `$table` that will be summarized. * @param array $ranges The array of ranges over which the data in the table * will be summarized. For example, diff --git a/core/DataFiles/Socials.php b/core/DataFiles/Socials.php index 41f7f565c0..ffd8511c6b 100755 --- a/core/DataFiles/Socials.php +++ b/core/DataFiles/Socials.php @@ -219,7 +219,7 @@ if (!isset($GLOBALS['Piwik_socialUrl'])) { // Vimeo 'vimeo.com' => 'Vimeo', - + //tumblr 'tumblr.com' => 'tumblr', ); diff --git a/core/DataTable.php b/core/DataTable.php index 796bcd8ce4..3f112edb1f 100644 --- a/core/DataTable.php +++ b/core/DataTable.php @@ -27,83 +27,83 @@ require_once PIWIK_INCLUDE_PATH . '/core/Common.php'; /** * The primary data structure used to store analytics data in Piwik. - * + * * <a name="class-desc-the-basics"></a> * ### The Basics - * + * * DataTables consist of rows and each row consists of columns. A column value can be * a numeric, a string or an array. - * + * * Every row has an ID. The ID is either the index of the row or {@link ID_SUMMARY_ROW}. - * + * * DataTables are hierarchical data structures. Each row can also contain an additional * nested sub-DataTable (commonly referred to as a 'subtable'). - * + * * Both DataTables and DataTable rows can hold **metadata**. _DataTable metadata_ is information * regarding all the data, such as the site or period that the data is for. _Row metadata_ * is information regarding that row, such as a browser logo or website URL. - * + * * Finally, all DataTables contain a special _summary_ row. This row, if it exists, is * always at the end of the DataTable. - * + * * ### Populating DataTables - * + * * Data can be added to DataTables in three different ways. You can either: - * + * * 1. create rows one by one and add them through {@link addRow()} then truncate if desired, * 2. create an array of DataTable\Row instances or an array of arrays and add them using * {@link addRowsFromArray()} or {@link addRowsFromSimpleArray()} * then truncate if desired, * 3. or set the maximum number of allowed rows (with {@link setMaximumAllowedRows()}) * and add rows one by one. - * + * * If you want to eventually truncate your data (standard practice for all Piwik plugins), * the third method is the most memory efficient. It is, unfortunately, not always possible * to use since it requires that the data be sorted before adding. - * + * * ### Manipulating DataTables - * + * * There are two ways to manipulate a DataTable. You can either: - * + * * 1. manually iterate through each row and manipulate the data, * 2. or you can use predefined filters. - * + * * A filter is a class that has a 'filter' method which will manipulate a DataTable in * some way. There are several predefined Filters that allow you to do common things, * such as, - * + * * - add a new column to each row, * - add new metadata to each row, * - modify an existing column value for each row, * - sort an entire DataTable, * - and more. - * + * * Using these filters instead of writing your own code will increase code clarity and * reduce code redundancy. Additionally, filters have the advantage that they can be * applied to DataTable\Map instances. So you can visit every DataTable in a {@link DataTable\Map} * without having to write a recursive visiting function. - * + * * All predefined filters exist in the **Piwik\DataTable\BaseFilter** namespace. - * + * * _Note: For convenience, [anonymous functions](http://www.php.net/manual/en/functions.anonymous.php) * can be used as DataTable filters._ - * + * * ### Applying Filters - * + * * Filters can be applied now (via {@link filter()}), or they can be applied later (via * {@link queueFilter()}). - * + * * Filters that sort rows or manipulate the number of rows should be applied right away. * Non-essential, presentation filters should be queued. - * + * * ### Learn more - * + * * - See **{@link ArchiveProcessor}** to learn how DataTables are persisted. - * + * * ### Examples - * + * * **Populating a DataTable** - * + * * // adding one row at a time * $dataTable = new DataTable(); * $dataTable->addRow(new Row(array( @@ -114,7 +114,7 @@ require_once PIWIK_INCLUDE_PATH . '/core/Common.php'; * Row::COLUMNS => array('label' => 'thing2', 'nb_visits' => 2, 'nb_actions' => 2), * Row::METADATA => array('url' => 'http://thing2.com') * ))); - * + * * // using an array of rows * $dataTable = new DataTable(); * $dataTable->addRowsFromArray(array( @@ -127,32 +127,32 @@ require_once PIWIK_INCLUDE_PATH . '/core/Common.php'; * Row::METADATA => array('url' => 'http://thing2.com') * ) * )); - * + * * // using a "simple" array * $dataTable->addRowsFromSimpleArray(array( * array('label' => 'thing1', 'nb_visits' => 1, 'nb_actions' => 1), * array('label' => 'thing2', 'nb_visits' => 2, 'nb_actions' => 2) * )); - * + * * **Getting & setting metadata** - * + * * $dataTable = \Piwik\Plugins\Referrers\API::getInstance()->getSearchEngines($idSite = 1, $period = 'day', $date = '2007-07-24'); * $oldPeriod = $dataTable->metadata['period']; * $dataTable->metadata['period'] = Period\Factory::build('week', Date::factory('2013-10-18')); - * + * * **Serializing & unserializing** - * + * * $maxRowsInTable = Config::getInstance()->General['datatable_archiving_maximum_rows_standard'];j - * + * * $dataTable = // ... build by aggregating visits ... * $serializedData = $dataTable->getSerialized($maxRowsInTable, $maxRowsInSubtable = $maxRowsInTable, * $columnToSortBy = Metrics::INDEX_NB_VISITS); - * + * * $serializedDataTable = $serializedData[0]; * $serailizedSubTable = $serializedData[$idSubtable]; - * + * * **Filtering for an API method** - * + * * public function getMyReport($idSite, $period, $date, $segment = false, $expanded = false) * { * $dataTable = Archive::getDataTableFromArchive('MyPlugin_MyReport', $idSite, $period, $date, $segment, $expanded); @@ -161,7 +161,7 @@ require_once PIWIK_INCLUDE_PATH . '/core/Common.php'; * $dataTable->queueFilter('ColumnCallbackAddMetadata', array('label', 'url', __NAMESPACE__ . '\getUrlFromLabelForMyReport')); * return $dataTable; * } - * + * * * @api */ @@ -181,14 +181,14 @@ class DataTable implements DataTableInterface /** * Name for metadata that describes how individual columns should be aggregated when {@link addDataTable()} * or {@link Piwik\DataTable\Row::sumRow()} is called. - * + * * This metadata value must be an array that maps column names with valid operations. Valid aggregation operations are: - * + * * - `'skip'`: do nothing * - `'max'`: does `max($column1, $column2)` * - `'min'`: does `min($column1, $column2)` * - `'sum'`: does `$column1 + $column2` - * + * * See {@link addDataTable()} and {@link DataTable\Row::sumRow()} for more information. */ const COLUMN_AGGREGATION_OPS_METADATA_NAME = 'column_aggregation_ops'; @@ -290,7 +290,7 @@ class DataTable implements DataTableInterface /** * Table metadata. Read [this](#class-desc-the-basics) to learn more. - * + * * Any data that describes the data held in the table's rows should go here. * * @var array @@ -390,7 +390,7 @@ class DataTable implements DataTableInterface /** * Applies a filter to this datatable. - * + * * If {@link enableRecursiveFilters()} was called, the filter will be applied * to all subtables as well. * @@ -428,7 +428,7 @@ class DataTable implements DataTableInterface /** * Adds a filter and a list of parameters to the list of queued filters. These filters will be * executed when {@link applyQueuedFilters()} is called. - * + * * Filters that prettify the column values or don't need the full set of rows should be queued. This * way they will be run after the table is truncated which will result in better performance. * @@ -457,17 +457,17 @@ class DataTable implements DataTableInterface /** * Sums a DataTable to this one. - * + * * This method will sum rows that have the same label. If a row is found in `$tableToSum` whose * label is not found in `$this`, the row will be added to `$this`. - * + * * If the subtables for this table are loaded, they will be summed as well. - * + * * Rows are summed together by summing individual columns. By default columns are summed by * adding one column value to another. Some columns cannot be aggregated this way. In these * cases, the {@link COLUMN_AGGREGATION_OPS_METADATA_NAME} * metadata can be used to specify a different type of operation. - * + * * @param \Piwik\DataTable $tableToSum */ public function addDataTable(DataTable $tableToSum, $doAggregateSubTables = true) @@ -487,10 +487,10 @@ class DataTable implements DataTableInterface /** * Returns the Row whose `'label'` column is equal to `$label`. - * + * * This method executes in constant time except for the first call which caches row * label => row ID mappings. - * + * * @param string $label `'label'` column value to look for. * @return Row|false The row if found, `false` if otherwise. */ @@ -516,7 +516,7 @@ class DataTable implements DataTableInterface * * This method executes in constant time except for the first call which caches row * label => row ID mappings. - * + * * @param string $label `'label'` column value to look for. * @return int The row ID. */ @@ -591,7 +591,7 @@ class DataTable implements DataTableInterface /** * Returns the row that has a subtable with ID matching `$idSubtable`. - * + * * @param int $idSubTable The subtable ID. * @return Row|false The row or false if not found */ @@ -608,7 +608,7 @@ class DataTable implements DataTableInterface /** * Adds a row to this table. - * + * * If {@link setMaximumAllowedRows()} was called and the current row count is * at the maximum, the new row will be summed to the summary row. If there is no summary row, * this row is set as the summary row. @@ -648,7 +648,7 @@ class DataTable implements DataTableInterface /** * Sets the summary row. - * + * * _Note: A DataTable can have only one summary row._ * * @param Row $row @@ -683,7 +683,7 @@ class DataTable implements DataTableInterface /** * Adds a new row from an array. - * + * * You can add row metadata with this method. * * @param array $row eg. `array(Row::COLUMNS => array('visits' => 13, 'test' => 'toto'), @@ -696,7 +696,7 @@ class DataTable implements DataTableInterface /** * Adds a new row a from an array of column values. - * + * * Row metadata cannot be added with this method. * * @param array $row eg. `array('name' => 'google analytics', 'license' => 'commercial')` @@ -758,10 +758,10 @@ class DataTable implements DataTableInterface /** * Returns the names of every column this DataTable contains. This method will return the * columns of the first row with data and will assume they occur in every other row as well. - * + * *_ Note: If column names still use their in-database INDEX values (@see Metrics), they * will be converted to their string name in the array result._ - * + * * @return array Array of string column names. */ public function getColumns() @@ -787,7 +787,7 @@ class DataTable implements DataTableInterface /** * Returns an array containing the requested metadata value of each row. - * + * * @param string $name The metadata column to return. * @return array */ @@ -802,7 +802,7 @@ class DataTable implements DataTableInterface /** * Returns the number of rows in the table including the summary row. - * + * * @return int */ public function getRowsCount() @@ -999,7 +999,7 @@ class DataTable implements DataTableInterface /** * Returns a string representation of this DataTable for convenient viewing. - * + * * _Note: This uses the **html** DataTable renderer._ * * @return string @@ -1018,7 +1018,7 @@ class DataTable implements DataTableInterface * each row has a label that exists in the other table, and if each row * is equal to the row in the other table with the same label. The order * of rows is not important. - * + * * @param \Piwik\DataTable $table1 * @param \Piwik\DataTable $table2 * @return bool @@ -1048,10 +1048,10 @@ class DataTable implements DataTableInterface /** * Serializes an entire DataTable hierarchy and returns the array of serialized DataTables. - * + * * The first element in the returned array will be the serialized representation of this DataTable. * Every subsequent element will be a serialized subtable. - * + * * This DataTable and subtables can optionally be truncated before being serialized. In most * cases where DataTables can become quite large, they should be truncated before being persisted * in an archive. @@ -1063,7 +1063,7 @@ class DataTable implements DataTableInterface * @param int $maximumRowsInSubDataTable If not null, defines the maximum number of rows allowed in serialized subtables. * @param string $columnToSortByBeforeTruncation The column to sort by before truncating, eg, `Metrics::INDEX_NB_VISITS`. * @return array The array of serialized DataTables: - * + * * array( * // this DataTable (the root) * 0 => 'eghuighahgaueytae78yaet7yaetae', @@ -1073,7 +1073,7 @@ class DataTable implements DataTableInterface * * // another subtable * 2 => 'gqegJHUIGHEQjkgneqjgnqeugUGEQHGUHQE', - * + * * // etc. * ); */ @@ -1140,9 +1140,9 @@ class DataTable implements DataTableInterface * Adds a set of rows from a serialized DataTable string. * * See {@link serialize()}. - * + * * _Note: This function will successfully load DataTables serialized by Piwik 1.X._ - * + * * @param string $stringSerialized A string with the format of a string in the array returned by * {@link serialize()}. * @throws Exception if `$stringSerialized` is invalid. @@ -1150,7 +1150,7 @@ class DataTable implements DataTableInterface public function addRowsFromSerializedArray($stringSerialized) { require_once PIWIK_INCLUDE_PATH . "/core/DataTable/Bridges.php"; - + $serialized = unserialize($stringSerialized); if ($serialized === false) { throw new Exception("The unserialization has failed!"); @@ -1160,11 +1160,11 @@ class DataTable implements DataTableInterface /** * Adds multiple rows from an array. - * + * * You can add row metadata with this method. * * @param array $array Array with the following structure - * + * * array( * // row1 * array( @@ -1191,11 +1191,11 @@ class DataTable implements DataTableInterface /** * Adds multiple rows from an array containing arrays of column values. - * + * * Row metadata cannot be added with this method. * * @param array $array Array with the following structure: - * + * * array( * array( col1_name => valueA, col2_name => valueC, ...), * array( col1_name => valueB, col2_name => valueD, ...), @@ -1272,28 +1272,28 @@ class DataTable implements DataTableInterface /** * Rewrites the input `$array` - * + * * array ( * LABEL => array(col1 => X, col2 => Y), * LABEL2 => array(col1 => X, col2 => Y), * ) - * + * * to a DataTable with rows that look like: - * + * * array ( * array( Row::COLUMNS => array('label' => LABEL, col1 => X, col2 => Y)), * array( Row::COLUMNS => array('label' => LABEL2, col1 => X, col2 => Y)), * ) * - * Will also convert arrays like: - * + * Will also convert arrays like: + * * array ( * LABEL => X, * LABEL2 => Y, * ) - * + * * to: - * + * * array ( * array( Row::COLUMNS => array('label' => LABEL, 'value' => X)), * array( Row::COLUMNS => array('label' => LABEL2, 'value' => Y)), @@ -1327,11 +1327,11 @@ class DataTable implements DataTableInterface /** * Sets the maximum depth level to at least a certain value. If the current value is * greater than `$atLeastLevel`, the maximum nesting level is not changed. - * + * * The maximum depth level determines the maximum number of subtable levels in the * DataTable tree. For example, if it is set to `2`, this DataTable is allowed to * have subtables, but the subtables are not. - * + * * @param int $atLeastLevel */ public static function setMaximumDepthLevelAllowedAtLeast($atLeastLevel) @@ -1379,7 +1379,7 @@ class DataTable implements DataTableInterface /** * Sets several metadata values by name. - * + * * @param array $values Array mapping metadata names with metadata values. */ public function setMetadataValues($values) @@ -1391,7 +1391,7 @@ class DataTable implements DataTableInterface /** * Sets metadata, erasing existing values. - * + * * @param array $values Array mapping metadata names with metadata values. */ public function setAllTableMetadata($metadata) @@ -1415,14 +1415,14 @@ class DataTable implements DataTableInterface * Traverses a DataTable tree using an array of labels and returns the row * it finds or `false` if it cannot find one. The number of path segments that * were successfully walked is also returned. - * + * * If `$missingRowColumns` is supplied, the specified path is created. When * a subtable is encountered w/o the required label, a new row is created * with the label, and a new subtable is added to the row. * * Read [http://en.wikipedia.org/wiki/Tree_(data_structure)#Traversal_methods](http://en.wikipedia.org/wiki/Tree_(data_structure)#Traversal_methods) * for more information about tree walking. - * + * * @param array $path The path to walk. An array of label values. The first element * refers to a row in this DataTable, the second in a subtable of * the first row, the third a subtable of the second row, etc. @@ -1493,7 +1493,7 @@ class DataTable implements DataTableInterface * * @param string|bool $labelColumn If supplied the label of the parent row will be added to * a new column in each subtable row. - * + * * If set to, `'label'` each subtable row's label will be prepended * w/ the parent row's label. So `'child_label'` becomes * `'parent_label - child_label'`. @@ -1549,9 +1549,9 @@ class DataTable implements DataTableInterface /** * Returns a new DataTable created with data from a 'simple' array. - * + * * See {@link addRowsFromSimpleArray()}. - * + * * @param array $array * @return \Piwik\DataTable */ @@ -1564,7 +1564,7 @@ class DataTable implements DataTableInterface /** * Creates a new DataTable instance from a serialized DataTable string. - * + * * See {@link getSerialized()} and {@link addRowsFromSerializedArray()} * for more information on DataTable serialization. * diff --git a/core/DataTable/BaseFilter.php b/core/DataTable/BaseFilter.php index 7e8f1c4dd4..fb2dc009f9 100644 --- a/core/DataTable/BaseFilter.php +++ b/core/DataTable/BaseFilter.php @@ -13,7 +13,7 @@ use Piwik\DataTable\Row; /** * A filter is set of logic that manipulates a DataTable. Existing filters do things like, - * + * * - remove rows * - change column values (change string to lowercase, truncate, etc.) * - add/remove columns or metadata (compute percentage values, add an 'icon' metadata based on the label, etc.) @@ -22,10 +22,10 @@ use Piwik\DataTable\Row; * * Filters are called with a DataTable instance and extra parameters that are specified * in {@link Piwik\DataTable::filter()} and {@link Piwik\DataTable::queueFilter()}. - * + * * To see examples of Filters look at the existing ones in the Piwik\DataTable\BaseFilter * namespace. - * + * * @api */ abstract class BaseFilter @@ -37,7 +37,7 @@ abstract class BaseFilter /** * Constructor. - * + * * @param DataTable $table */ public function __construct(DataTable $table) diff --git a/core/DataTable/Filter/AddColumnsProcessedMetrics.php b/core/DataTable/Filter/AddColumnsProcessedMetrics.php index 8ad329e610..f3d8191b1f 100644 --- a/core/DataTable/Filter/AddColumnsProcessedMetrics.php +++ b/core/DataTable/Filter/AddColumnsProcessedMetrics.php @@ -17,22 +17,22 @@ use Piwik\Metrics; * Adds processed metrics columns to a {@link DataTable} using metrics that already exist. * * Columns added are: - * + * * - **conversion_rate**: percent value of `nb_visits_converted / nb_visits * - **nb_actions_per_visit**: `nb_actions / nb_visits` * - **avg_time_on_site**: in number of seconds, `round(visit_length / nb_visits)`. Not * pretty formatted. * - **bounce_rate**: percent value of `bounce_count / nb_visits` - * + * * Adding the **filter_add_columns_when_show_all_columns** query parameter to * an API request will trigger the execution of this Filter. - * + * * _Note: This filter must be called before {@link ReplaceColumnNames} is called._ - * + * * **Basic usage example** - * + * * $dataTable->filter('AddColumnsProcessedMetrics'); - * + * * @api */ class AddColumnsProcessedMetrics extends BaseFilter @@ -43,7 +43,7 @@ class AddColumnsProcessedMetrics extends BaseFilter /** * Constructor. - * + * * @param DataTable $table The table to eventually filter. * @param bool $deleteRowsWithNoVisit Whether to delete rows with no visits or not. */ diff --git a/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php b/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php index 7f828a1f62..742f1aef6d 100644 --- a/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php +++ b/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php @@ -38,17 +38,17 @@ use Piwik\Tracker\GoalManager; * reports. * - **goal_%idGoal%_items**: number of items. Only for ecommerce order and abandoned cart * reports. - * + * * Adding the **filter_update_columns_when_show_all_goals** query parameter to * an API request will trigger the execution of this Filter. - * + * * _Note: This filter must be called before {@link ReplaceColumnNames} is called._ - * + * * **Basic usage example** - * + * * $dataTable->filter('AddColumnsProcessedMetricsGoal', * array($enable = true, $idGoal = Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER)); - * + * * @api */ class AddColumnsProcessedMetricsGoal extends AddColumnsProcessedMetrics @@ -72,7 +72,7 @@ class AddColumnsProcessedMetricsGoal extends AddColumnsProcessedMetrics /** * Constructor. - * + * * @param DataTable $table The table that will eventually filtered. * @param bool $enable Always set to true. * @param string $processOnlyIdGoal Defines what metrics to add (don't process metrics when you don't display them). diff --git a/core/DataTable/Filter/AddSummaryRow.php b/core/DataTable/Filter/AddSummaryRow.php index 09f6725db0..9cb4b3e2f1 100644 --- a/core/DataTable/Filter/AddSummaryRow.php +++ b/core/DataTable/Filter/AddSummaryRow.php @@ -16,12 +16,12 @@ use Piwik\DataTable\Row\DataTableSummaryRow; * Adds a summary row to {@link DataTable}s that contains the sum of all other table rows. * * **Basic usage example** - * + * * $dataTable->filter('AddSummaryRow'); - * + * * // use a human readable label for the summary row (instead of '-1') * $dataTable->filter('AddSummaryRow', array($labelSummaryRow = Piwik::translate('General_Total'))); - * + * * @api */ class AddSummaryRow extends BaseFilter diff --git a/core/DataTable/Filter/BeautifyRangeLabels.php b/core/DataTable/Filter/BeautifyRangeLabels.php index 7f60bdd714..534f484bff 100644 --- a/core/DataTable/Filter/BeautifyRangeLabels.php +++ b/core/DataTable/Filter/BeautifyRangeLabels.php @@ -28,11 +28,11 @@ use Piwik\Piwik; * This filter can be extended to vary exactly how ranges are prettified based * on the range values found in the DataTable. To see an example of this, * take a look at the {@link BeautifyTimeRangeLabels} filter. - * + * * **Basic usage example** - * + * * $dataTable->queueFilter('BeautifyRangeLabels', array("1 visit", "%s visits")); - * + * * @api */ class BeautifyRangeLabels extends ColumnCallbackReplace diff --git a/core/DataTable/Filter/BeautifyTimeRangeLabels.php b/core/DataTable/Filter/BeautifyTimeRangeLabels.php index 1841d94f48..aed7af7d8d 100644 --- a/core/DataTable/Filter/BeautifyTimeRangeLabels.php +++ b/core/DataTable/Filter/BeautifyTimeRangeLabels.php @@ -17,11 +17,11 @@ use Piwik\DataTable; * This filter customizes the behavior of the {@link BeautifyRangeLabels} filter * so range values that are less than one minute are displayed in seconds but * other ranges are displayed in minutes. - * + * * **Basic usage** - * + * * $dataTable->filter('BeautifyTimeRangeLabels', array("%1$s-%2$s min", "1 min", "%s min")); - * + * * @api */ class BeautifyTimeRangeLabels extends BeautifyRangeLabels diff --git a/core/DataTable/Filter/CalculateEvolutionFilter.php b/core/DataTable/Filter/CalculateEvolutionFilter.php index 28022952e0..80f789919e 100755 --- a/core/DataTable/Filter/CalculateEvolutionFilter.php +++ b/core/DataTable/Filter/CalculateEvolutionFilter.php @@ -17,12 +17,12 @@ use Piwik\Site; * it to each row as a percentage. * * **This filter cannot be used as an argument to {@link Piwik\DataTable::filter()}** since - * it requires corresponding data from another DataTable. Instead, + * it requires corresponding data from another DataTable. Instead, * you must manually perform a binary filter (see the **MultiSites** API for an * example). * * The evolution metric is calculated as: - * + * * ((currentValue - pastValue) / pastValue) * 100 * * @api diff --git a/core/DataTable/Filter/ColumnCallbackAddColumn.php b/core/DataTable/Filter/ColumnCallbackAddColumn.php index 0084fd076b..27746c4f28 100755 --- a/core/DataTable/Filter/ColumnCallbackAddColumn.php +++ b/core/DataTable/Filter/ColumnCallbackAddColumn.php @@ -13,13 +13,13 @@ use Piwik\DataTable\BaseFilter; /** * Adds a new column to every row of a {@link DataTable} based on the result of callback. - * + * * **Basic usage example** - * + * * $callback = function ($visits, $timeSpent) { * return round($timeSpent / $visits, 2); * }; - * + * * $dataTable->filter('ColumnCallbackAddColumn', array(array('nb_visits', 'sum_time_spent'), 'avg_time_on_site', $callback)); * * @api @@ -93,7 +93,7 @@ class ColumnCallbackAddColumn extends BaseFilter } $parameters = array_merge($columnValues, $functionParams); - + return call_user_func_array($functionToApply, $parameters); }); diff --git a/core/DataTable/Filter/ColumnCallbackAddColumnPercentage.php b/core/DataTable/Filter/ColumnCallbackAddColumnPercentage.php index de1e5e950a..056c129440 100644 --- a/core/DataTable/Filter/ColumnCallbackAddColumnPercentage.php +++ b/core/DataTable/Filter/ColumnCallbackAddColumnPercentage.php @@ -13,11 +13,11 @@ use Piwik\Piwik; /** * Calculates a percentage value for each row of a {@link DataTable} and adds the result * to each row. - * + * * See {@link ColumnCallbackAddColumnQuotient} for more information. * * **Basic usage example** - * + * * $nbVisits = // ... get the visits for a period ... * $dataTable->queueFilter('ColumnCallbackAddColumnPercentage', array('nb_visits', 'nb_visits_percentage', $nbVisits, 1)); * diff --git a/core/DataTable/Filter/ColumnCallbackAddColumnQuotient.php b/core/DataTable/Filter/ColumnCallbackAddColumnQuotient.php index d82599be5c..5cc83d8e3d 100644 --- a/core/DataTable/Filter/ColumnCallbackAddColumnQuotient.php +++ b/core/DataTable/Filter/ColumnCallbackAddColumnQuotient.php @@ -15,14 +15,14 @@ use Piwik\DataTable\Row; /** * Calculates the quotient of two columns and adds the result as a new column * for each row of a DataTable. - * + * * This filter is used to calculate rate values (eg, `'bounce_rate'`), averages * (eg, `'avg_time_on_page'`) and other types of values. * * **Basic usage example** - * + * * $dataTable->queueFilter('ColumnCallbackAddColumnQuotient', array('bounce_rate', 'bounce_count', 'nb_visits', $precision = 2)); - * + * * @api */ class ColumnCallbackAddColumnQuotient extends BaseFilter @@ -38,7 +38,7 @@ class ColumnCallbackAddColumnQuotient extends BaseFilter /** * Constructor. - * + * * @param DataTable $table The DataTable that will eventually be filtered. * @param string $columnNameToAdd The name of the column to add the quotient value to. * @param string $columnValueToRead The name of the column that holds the dividend. diff --git a/core/DataTable/Filter/ColumnCallbackAddMetadata.php b/core/DataTable/Filter/ColumnCallbackAddMetadata.php index 1a2b9b27f7..e89000f8fd 100644 --- a/core/DataTable/Filter/ColumnCallbackAddMetadata.php +++ b/core/DataTable/Filter/ColumnCallbackAddMetadata.php @@ -14,11 +14,11 @@ use Piwik\DataTable\BaseFilter; /** * Executes a callback for each row of a {@link DataTable} and adds the result as a new * row metadata value. - * + * * **Basic usage example** - * + * * $dataTable->filter('ColumnCallbackAddMetadata', array('label', 'logo', 'Piwik\Plugins\MyPlugin\getLogoFromLabel')); - * + * * @api */ class ColumnCallbackAddMetadata extends BaseFilter @@ -31,7 +31,7 @@ class ColumnCallbackAddMetadata extends BaseFilter /** * Constructor. - * + * * @param DataTable $table The DataTable instance that will be filtered. * @param string|array $columnsToRead The columns to read from each row and pass on to the callback. * @param string $metadataToAdd The name of the metadata field that will be added to each row. diff --git a/core/DataTable/Filter/ColumnCallbackDeleteRow.php b/core/DataTable/Filter/ColumnCallbackDeleteRow.php index f5883d1b6a..189fbd3b81 100644 --- a/core/DataTable/Filter/ColumnCallbackDeleteRow.php +++ b/core/DataTable/Filter/ColumnCallbackDeleteRow.php @@ -15,12 +15,12 @@ use Piwik\DataTable\BaseFilter; * Deletes all rows for which a callback returns true. * * **Basic usage example** - * + * * $labelsToRemove = array('label1', 'label2', 'label2'); * $dataTable->filter('ColumnCallbackDeleteRow', array('label', function ($label) use ($labelsToRemove) { * return in_array($label, $labelsToRemove); * })); - * + * * @api */ class ColumnCallbackDeleteRow extends BaseFilter @@ -31,7 +31,7 @@ class ColumnCallbackDeleteRow extends BaseFilter /** * Constructor. - * + * * @param DataTable $table The DataTable that will be filtered eventually. * @param array|string $columnsToFilter The column or array of columns that should be * passed to the callback. diff --git a/core/DataTable/Filter/ColumnCallbackReplace.php b/core/DataTable/Filter/ColumnCallbackReplace.php index bec7d683f5..e33dfa9a14 100644 --- a/core/DataTable/Filter/ColumnCallbackReplace.php +++ b/core/DataTable/Filter/ColumnCallbackReplace.php @@ -15,9 +15,9 @@ use Piwik\DataTable\Row; /** * Replaces one or more column values in each row of a DataTable with the results * of a callback. - * + * * **Basic usage example** - * + * * $truncateString = function ($value, $truncateLength) { * if (strlen($value) > $truncateLength) { * return substr(0, $truncateLength); @@ -25,10 +25,10 @@ use Piwik\DataTable\Row; * return $value; * } * }; - * + * * // label, url and truncate_length are columns in $dataTable * $dataTable->filter('ColumnCallbackReplace', array('label', 'url'), $truncateString, null, array('truncate_length')); - * + * */ class ColumnCallbackReplace extends BaseFilter { @@ -39,7 +39,7 @@ class ColumnCallbackReplace extends BaseFilter /** * Constructor. - * + * * @param DataTable $table The DataTable to filter. * @param array|string $columnsToFilter The columns whose values should be passed to the callback * and then replaced with the callback's result. diff --git a/core/DataTable/Filter/ColumnDelete.php b/core/DataTable/Filter/ColumnDelete.php index 7631c7a9c2..976519c6fa 100644 --- a/core/DataTable/Filter/ColumnDelete.php +++ b/core/DataTable/Filter/ColumnDelete.php @@ -16,15 +16,15 @@ use Piwik\DataTable\BaseFilter; * whitelist or both. * * This filter is used to handle the **hideColumn** and **showColumn** query parameters. - * + * * **Basic usage example** - * + * * $columnsToRemove = array('nb_hits', 'nb_pageviews'); * $dataTable->filter('ColumnDelete', array($columnsToRemove)); - * + * * $columnsToKeep = array('nb_visits'); * $dataTable->filter('ColumnDelete', array(array(), $columnsToKeep)); - * + * * @api */ class ColumnDelete extends BaseFilter diff --git a/core/DataTable/Filter/ExcludeLowPopulation.php b/core/DataTable/Filter/ExcludeLowPopulation.php index e346ea28fc..ee135b59d6 100644 --- a/core/DataTable/Filter/ExcludeLowPopulation.php +++ b/core/DataTable/Filter/ExcludeLowPopulation.php @@ -14,17 +14,17 @@ use Piwik\DataTable\BaseFilter; /** * Deletes all rows for which a specific column has a value that is lower than * specified minimum threshold value. - * + * * **Basic usage examples** - * + * * // remove all countries from UserCountry.getCountry that have less than 3 visits * $dataTable = // ... get a DataTable whose queued filters have been run ... * $dataTable->filter('ExcludeLowPopulation', array('nb_visits', 3)); - * + * * // remove all countries from UserCountry.getCountry whose percent of total visits is less than 5% * $dataTable = // ... get a DataTable whose queued filters have been run ... * $dataTable->filter('ExcludeLowPopulation', array('nb_visits', false, 0.05)); - * + * * // remove all countries from UserCountry.getCountry whose bounce rate is less than 10% * $dataTable = // ... get a DataTable that has a numerical bounce_rate column ... * $dataTable->filter('ExcludeLowPopulation', array('bounce_rate', 0.10)); @@ -50,7 +50,7 @@ class ExcludeLowPopulation extends BaseFilter * @param string $columnToFilter The name of the column whose value will determine whether * a row is deleted or not. * @param number|false $minimumValue The minimum column value. Rows with column values < - * this number will be deleted. If false, + * this number will be deleted. If false, * `$minimumPercentageThreshold` is used. * @param bool|float $minimumPercentageThreshold If supplied, column values must be a greater * percentage of the sum of all column values than diff --git a/core/DataTable/Filter/GroupBy.php b/core/DataTable/Filter/GroupBy.php index d783db8bca..8633fb2e9d 100755 --- a/core/DataTable/Filter/GroupBy.php +++ b/core/DataTable/Filter/GroupBy.php @@ -18,12 +18,12 @@ use Piwik\DataTable\BaseFilter; * _NOTE: This filter should never be queued, it must be applied directly on a {@link DataTable}._ * * **Basic usage example** - * + * * // group URLs by host * $dataTable->filter('GroupBy', array('label', function ($labelUrl) { * return parse_url($labelUrl, PHP_URL_HOST); * })); - * + * * @api */ class GroupBy extends BaseFilter diff --git a/core/DataTable/Filter/Limit.php b/core/DataTable/Filter/Limit.php index c06bac49c5..5cf848a50e 100644 --- a/core/DataTable/Filter/Limit.php +++ b/core/DataTable/Filter/Limit.php @@ -13,9 +13,9 @@ use Piwik\DataTable\BaseFilter; /** * Delete all rows from the table that are not in the given [offset, offset+limit) range. - * + * * **Basic example usage** - * + * * // delete all rows from 5 -> 15 * $dataTable->filter('Limit', array(5, 10)); * diff --git a/core/DataTable/Filter/MetadataCallbackAddMetadata.php b/core/DataTable/Filter/MetadataCallbackAddMetadata.php index 0f7af76a29..7f6aaef123 100644 --- a/core/DataTable/Filter/MetadataCallbackAddMetadata.php +++ b/core/DataTable/Filter/MetadataCallbackAddMetadata.php @@ -16,7 +16,7 @@ use Piwik\DataTable\BaseFilter; * row as a metadata value. Only metadata values are passed to the callback. * * **Basic usage example** - * + * * // add a logo metadata based on the url metadata * $dataTable->filter('MetadataCallbackAddMetadata', array('url', 'logo', 'Piwik\Plugins\MyPlugin\getLogoFromUrl')); * @@ -31,7 +31,7 @@ class MetadataCallbackAddMetadata extends BaseFilter /** * Constructor. - * + * * @param DataTable $table The DataTable that will eventually be filtered. * @param string|array $metadataToRead The metadata to read from each row and pass to the callback. * @param string $metadataToAdd The name of the metadata to add. @@ -57,7 +57,7 @@ class MetadataCallbackAddMetadata extends BaseFilter /** * See {@link MetadataCallbackAddMetadata}. - * + * * @param DataTable $table */ public function filter($table) diff --git a/core/DataTable/Filter/MetadataCallbackReplace.php b/core/DataTable/Filter/MetadataCallbackReplace.php index 50e773c98e..cb04cdb164 100644 --- a/core/DataTable/Filter/MetadataCallbackReplace.php +++ b/core/DataTable/Filter/MetadataCallbackReplace.php @@ -14,9 +14,9 @@ use Piwik\DataTable\Row; /** * Execute a callback for each row of a {@link DataTable} passing certain column values and metadata * as metadata, and replaces row metadata with the callback result. - * + * * **Basic usage example** - * + * * $dataTable->filter('MetadataCallbackReplace', array('url', function ($url) { * return $url . '#index'; * })); @@ -27,7 +27,7 @@ class MetadataCallbackReplace extends ColumnCallbackReplace { /** * Constructor. - * + * * @param DataTable $table The DataTable that will eventually be filtered. * @param array|string $metadataToFilter The metadata whose values should be passed to the callback * and then replaced with the callback's result. diff --git a/core/DataTable/Filter/Pattern.php b/core/DataTable/Filter/Pattern.php index 94893e6d9e..832fb856a2 100644 --- a/core/DataTable/Filter/Pattern.php +++ b/core/DataTable/Filter/Pattern.php @@ -13,9 +13,9 @@ use Piwik\DataTable\BaseFilter; /** * Deletes every row for which a specific column does not match a supplied regex pattern. - * + * * **Example** - * + * * // filter out all rows whose labels doesn't start with piwik * $dataTable->filter('Pattern', array('label', '^piwik')); * @@ -30,7 +30,7 @@ class Pattern extends BaseFilter /** * Constructor. - * + * * @param DataTable $table The table to eventually filter. * @param string $columnToFilter The column to match with the `$patternToSearch` pattern. * @param string $patternToSearch The regex pattern to use. @@ -74,7 +74,7 @@ class Pattern extends BaseFilter /** * See {@link Pattern}. - * + * * @param DataTable $table */ public function filter($table) diff --git a/core/DataTable/Filter/PatternRecursive.php b/core/DataTable/Filter/PatternRecursive.php index 10bf918f68..697403c2e3 100644 --- a/core/DataTable/Filter/PatternRecursive.php +++ b/core/DataTable/Filter/PatternRecursive.php @@ -16,9 +16,9 @@ use Piwik\DataTable\Manager; /** * Deletes rows that do not contain a column that matches a regex pattern and do not contain a * subtable that contains a column that matches a regex pattern. - * + * * **Example** - * + * * // only display index pageviews in Actions.getPageUrls * $dataTable->filter('PatternRecursive', array('label', 'index')); * @@ -32,7 +32,7 @@ class PatternRecursive extends BaseFilter /** * Constructor. - * + * * @param DataTable $table The table to eventually filter. * @param string $columnToFilter The column to match with the `$patternToSearch` pattern. * @param string $patternToSearch The regex pattern to use. @@ -48,7 +48,7 @@ class PatternRecursive extends BaseFilter /** * See {@link PatternRecursive}. - * + * * @param DataTable $table * @return int The number of deleted rows. */ diff --git a/core/DataTable/Filter/ReplaceColumnNames.php b/core/DataTable/Filter/ReplaceColumnNames.php index 4dd3218902..27875db41a 100644 --- a/core/DataTable/Filter/ReplaceColumnNames.php +++ b/core/DataTable/Filter/ReplaceColumnNames.php @@ -18,15 +18,15 @@ use Piwik\Tracker\GoalManager; /** * Replaces column names in each row of a table using an array that maps old column * names new ones. - * + * * If no mapping is provided, this column will use one that maps index metric names * (which are integers) with their string column names. In the database, reports are * stored with integer metric names because it results in blobs that take up less space. * When loading the reports, the column names must be replaced, which is handled by this * class. (See {@link Piwik\Metrics} for more information about integer metric names.) - * + * * **Basic example** - * + * * // filter use in a plugin's API method * public function getMyReport($idSite, $period, $date, $segment = false, $expanded = false) * { @@ -34,7 +34,7 @@ use Piwik\Tracker\GoalManager; * $dataTable->queueFilter('ReplaceColumnNames'); * return $dataTable; * } - * + * * @api */ class ReplaceColumnNames extends BaseFilter @@ -43,14 +43,14 @@ class ReplaceColumnNames extends BaseFilter /** * Constructor. - * + * * @param DataTable $table The table that will be eventually filtered. * @param array|null $mappingToApply The name mapping to apply. Must map old column names * with new ones, eg, - * + * * array('OLD_COLUMN_NAME' => 'NEW_COLUMN NAME', * 'OLD_COLUMN_NAME2' => 'NEW_COLUMN NAME2') - * + * * If null, {@link Piwik\Metrics::$mappingFromIdToName} is used. */ public function __construct($table, $mappingToApply = null) diff --git a/core/DataTable/Filter/ReplaceSummaryRowLabel.php b/core/DataTable/Filter/ReplaceSummaryRowLabel.php index 23a5926691..3c1e31e2d0 100644 --- a/core/DataTable/Filter/ReplaceSummaryRowLabel.php +++ b/core/DataTable/Filter/ReplaceSummaryRowLabel.php @@ -15,24 +15,24 @@ use Piwik\Piwik; /** * Replaces the label of the summary row with a supplied label. - * + * * This filter is only used to prettify the summary row label and so it should * always be queued on a {@link DataTable}. - * + * * This filter always recurses. In other words, this filter will always apply itself to * all subtables in the given {@link DataTable}'s table hierarchy. - * + * * **Basic example** - * + * * $dataTable->queueFilter('ReplaceSummaryRowLabel', array(Piwik::translate('General_Others'))); - * + * * @api */ class ReplaceSummaryRowLabel extends BaseFilter { /** * Constructor. - * + * * @param DataTable $table The table that will eventually be filtered. * @param string|null $newLabel The new label for summary row. If null, defaults to * `Piwik::translate('General_Others')`. diff --git a/core/DataTable/Filter/SafeDecodeLabel.php b/core/DataTable/Filter/SafeDecodeLabel.php index 8922482398..f2629618b1 100644 --- a/core/DataTable/Filter/SafeDecodeLabel.php +++ b/core/DataTable/Filter/SafeDecodeLabel.php @@ -13,7 +13,7 @@ use Piwik\DataTable\BaseFilter; /** * Sanitizes DataTable labels as an extra precaution. Called internally by Piwik. - * + * */ class SafeDecodeLabel extends BaseFilter { diff --git a/core/DataTable/Filter/Sort.php b/core/DataTable/Filter/Sort.php index e11749a0e4..6ba2cd1ff0 100644 --- a/core/DataTable/Filter/Sort.php +++ b/core/DataTable/Filter/Sort.php @@ -16,7 +16,7 @@ use Piwik\Metrics; /** * Sorts a {@link DataTable} based on the value of a specific column. - * + * * It is possible to specify a natural sorting (see [php.net/natsort](http://php.net/natsort) for details). * * @api @@ -28,7 +28,7 @@ class Sort extends BaseFilter /** * Constructor. - * + * * @param DataTable $table The table to eventually filter. * @param string $columnToSort The name of the column to sort by. * @param string $order order `'asc'` or `'desc'`. diff --git a/core/DataTable/Filter/Truncate.php b/core/DataTable/Filter/Truncate.php index 13d2a619c0..192d85b82f 100644 --- a/core/DataTable/Filter/Truncate.php +++ b/core/DataTable/Filter/Truncate.php @@ -16,26 +16,26 @@ use Piwik\Piwik; /** * Truncates a {@link DataTable} by merging all rows after a certain index into a new summary * row. If the count of rows is less than the index, nothing happens. - * + * * The {@link ReplaceSummaryRowLabel} filter will be queued after the table is truncated. - * + * * ### Examples - * + * * **Basic usage** - * + * * $dataTable->filter('Truncate', array($truncateAfter = 500)); - * + * * **Using a custom summary row label** - * + * * $dataTable->filter('Truncate', array($truncateAfter = 500, $summaryRowLabel = Piwik::translate('General_Total'))); - * + * * @api */ class Truncate extends BaseFilter { /** * Constructor. - * + * * @param DataTable $table The table that will be filtered eventually. * @param int $truncateAfter The row index to truncate at. All rows passed this index will * be removed. diff --git a/core/DataTable/Map.php b/core/DataTable/Map.php index 028c40b480..dd8bec7ca5 100644 --- a/core/DataTable/Map.php +++ b/core/DataTable/Map.php @@ -15,10 +15,10 @@ use Piwik\DataTable\Renderer\Console; /** * Stores an array of {@link DataTable}s indexed by one type of {@link DataTable} metadata (such as site ID * or period). - * + * * DataTable Maps are returned on all queries that involve multiple sites and/or multiple * periods. The Maps will contain a {@link DataTable} for each site and period combination. - * + * * The Map implements some {@link DataTable} such as {@link queueFilter()} and {@link getRowsCount}. * * @@ -73,7 +73,7 @@ class Map implements DataTableInterface /** * Queue a filter to {@link DataTable} child of contained by this instance. - * + * * See {@link Piwik\DataTable::queueFilter()} for more information.. * * @param string|Closure $className Filter name, eg. `'Limit'` or a Closure. @@ -142,7 +142,7 @@ class Map implements DataTableInterface /** * Returns the last element in the Map's array. - * + * * @return DataTable|Map|false */ public function getLastRow() @@ -188,7 +188,7 @@ class Map implements DataTableInterface * Renames the given column in each contained {@link DataTable}. * * See {@link DataTable::renameColumn()}. - * + * * @param string $oldName * @param string $newName */ @@ -203,7 +203,7 @@ class Map implements DataTableInterface * Deletes the specified columns in each contained {@link DataTable}. * * See {@link DataTable::deleteColumns()}. - * + * * @param array $columns The columns to delete. * @param bool $deleteRecursiveInSubtables This param is currently not used. */ @@ -216,7 +216,7 @@ class Map implements DataTableInterface /** * Deletes a table from the array of DataTables. - * + * * @param string $id The label associated with {@link DataTable}. */ public function deleteRow($id) @@ -263,19 +263,19 @@ class Map implements DataTableInterface * The result of this function is determined by the type of DataTable * this instance holds. If this DataTable\Map instance holds an array * of DataTables, this function will transform it from: - * + * * Label 0: * DataTable(row1) * Label 1: * DataTable(row2) - * + * * to: - * + * * DataTable(row1[label = 'Label 0'], row2[label = 'Label 1']) * * If this instance holds an array of DataTable\Maps, this function will * transform it from: - * + * * Outer Label 0: // the outer DataTable\Map * Inner Label 0: // one of the inner DataTable\Maps * DataTable(row1) @@ -286,9 +286,9 @@ class Map implements DataTableInterface * DataTable(row3) * Inner Label 1: * DataTable(row4) - * + * * to: - * + * * Inner Label 0: * DataTable(row1[label = 'Outer Label 0'], row3[label = 'Outer Label 1']) * Inner Label 1: @@ -366,11 +366,11 @@ class Map implements DataTableInterface /** * Sums a DataTable to all the tables in this array. - * + * * _Note: Will only add `$tableToSum` if the childTable has some rows._ * * See {@link Piwik\DataTable::addDataTable()}. - * + * * @param DataTable $tableToSum */ public function addDataTable(DataTable $tableToSum) diff --git a/core/DataTable/Row.php b/core/DataTable/Row.php index 18a7228359..3612cbe96a 100644 --- a/core/DataTable/Row.php +++ b/core/DataTable/Row.php @@ -14,7 +14,7 @@ use Piwik\Metrics; /** * This is what a {@link Piwik\DataTable} is composed of. - * + * * DataTable rows contain columns, metadata and a subtable ID. Columns and metadata * are stored as an array of name => value mappings. * @@ -59,7 +59,7 @@ class Row * Constructor. * * @param array $row An array with the following structure: - * + * * array( * Row::COLUMNS => array('label' => 'Piwik', * 'column1' => 42, @@ -264,7 +264,7 @@ class Row * Returns the array containing all the columns. * * @return array Example: - * + * * array( * 'column1' => VALUE, * 'label' => 'www.php.net' @@ -315,9 +315,9 @@ class Row /** * Sums a DataTable to this row's subtable. If this row has no subtable a new * one is created. - * + * * See {@link Piwik\DataTable::addDataTable()} to learn how DataTables are summed. - * + * * @param DataTable $subTable Table to sum to this row's subtable. */ public function sumSubtable(DataTable $subTable) @@ -495,7 +495,7 @@ class Row * Sums the given `$rowToSum` columns values to the existing row column values. * Only the int or float values will be summed. Label columns will be ignored * even if they have a numeric value. - * + * * Columns in `$rowToSum` that don't exist in `$this` are added to `$this`. * * @param \Piwik\DataTable\Row $rowToSum The row to sum to this row. @@ -573,7 +573,7 @@ class Row /** * Sums the metadata in `$rowToSum` with the metadata in `$this` row. - * + * * @param Row $rowToSum */ public function sumRowMetadata($rowToSum) @@ -597,7 +597,7 @@ class Row /** * Returns `true` if this row is the summary row, `false` if otherwise. This function * depends on the label of the row, and so, is not 100% accurate. - * + * * @return bool */ public function isSummaryRow() @@ -679,10 +679,10 @@ class Row * Helper function that tests if two rows are equal. * * Two rows are equal if: - * + * * - they have exactly the same columns / metadata * - they have a subDataTable associated, then we check that both of them are the same. - * + * * Column order is not important. * * @param \Piwik\DataTable\Row $row1 first to compare diff --git a/core/DataTable/Row/DataTableSummaryRow.php b/core/DataTable/Row/DataTableSummaryRow.php index 480631f2b8..7d477a304c 100644 --- a/core/DataTable/Row/DataTableSummaryRow.php +++ b/core/DataTable/Row/DataTableSummaryRow.php @@ -14,9 +14,9 @@ use Piwik\DataTable\Row; /** * A special row whose column values are the aggregate of the row's subtable. - * + * * This class creates sets its own columns to the sum of each row in the row's subtable. - * + * * Non-numeric columns are bypassed during summation and do not appear in this * rows columns. * @@ -27,7 +27,7 @@ class DataTableSummaryRow extends Row { /** * Constructor. - * + * * @param DataTable|null $subTable The subtable of this row. This parameter is mostly for * convenience. If set, its rows will be summed to this one, * but it will not be set as this row's subtable (so diff --git a/core/DataTable/Simple.php b/core/DataTable/Simple.php index f21aa62b9d..018818c203 100644 --- a/core/DataTable/Simple.php +++ b/core/DataTable/Simple.php @@ -12,7 +12,7 @@ use Piwik\DataTable; /** * A {@link Piwik\DataTable} where every row has two columns: **label** and **value**. - * + * * Simple DataTables are only used to slightly alter the output of some renderers * (notably the XML renderer). * @@ -25,7 +25,7 @@ class Simple extends DataTable * values. * * @param array $array Array containing the rows, eg, - * + * * array( * 'Label row 1' => $value1, * 'Label row 2' => $value2, diff --git a/core/Date.php b/core/Date.php index 09205abac7..7af59e1f2a 100644 --- a/core/Date.php +++ b/core/Date.php @@ -14,22 +14,22 @@ use Exception; /** * Utility class that wraps date/time related PHP functions. Using this class can * be easier than using `date`, `time`, `date_default_timezone_set`, etc. - * + * * ### Performance concerns - * + * * The helper methods in this class are instance methods and thus `Date` instances * need to be constructed before they can be used. The memory allocation can result * in noticeable performance degradation if you construct thousands of Date instances, * say, in a loop. - * + * * ### Examples - * + * * **Basic usage** - * + * * $date = Date::factory('2007-07-24 14:04:24', 'EST'); * $date->addHour(5); * echo $date->getLocalized("%longDay% the %day% of %longMonth% at %time%"); - * + * * @api */ class Date @@ -164,7 +164,7 @@ class Date /** * Returns a new date object with the same timestamp as `$this` but with a new * timezone. - * + * * See {@link getTimestamp()} to see how the timezone is used. * * @param string $timezone eg, `'UTC'`, `'Europe/London'`, etc. @@ -383,7 +383,7 @@ class Date /** * Returns `true` if current date is today. - * + * * @return bool */ public function isToday() @@ -560,9 +560,9 @@ class Date /** * Returns a localized date string using the given template. * The template should contain tags that will be replaced with localized date strings. - * + * * Allowed tags include: - * + * * - **%day%**: replaced with the day of the month without leading zeros, eg, **1** or **20**. * - **%shortMonth%**: the short month in the current language, eg, **Jan**, **Feb**. * - **%longMonth%**: the whole month name in the current language, eg, **January**, **February**. diff --git a/core/Db.php b/core/Db.php index 427ce1cd31..e0393f6a3c 100644 --- a/core/Db.php +++ b/core/Db.php @@ -14,21 +14,21 @@ use Piwik\Tracker; /** * Contains SQL related helper functions for Piwik's MySQL database. - * + * * Plugins should always use this class to execute SQL against the database. - * + * * ### Examples - * + * * $rows = Db::fetchAll("SELECT col1, col2 FROM mytable WHERE thing = ?", array('thingvalue')); * foreach ($rows as $row) { * doSomething($row['col1'], $row['col2']); * } - * + * * $value = Db::fetchOne("SELECT MAX(col1) FROM mytable"); * doSomethingElse($value); - * + * * Db::query("DELETE FROM mytable WHERE id < ?", array(23)); - * + * * @api */ class Db @@ -88,9 +88,9 @@ class Db /** * Connects to the database. - * + * * Shouldn't be called directly, use {@link get()} instead. - * + * * @param array|null $dbConfig Connection parameters in an array. Defaults to the `[database]` * INI config section. */ @@ -145,7 +145,7 @@ class Db /** * Executes an SQL query and returns the [Zend_Db_Statement](http://framework.zend.com/manual/1.12/en/zend.db.statement.html) * for the query. - * + * * This method is meant for non-query SQL statements like `INSERT` and `UPDATE. If you want to fetch * data from the DB you should use one of the fetch... functions. * @@ -247,16 +247,16 @@ class Db /** * Deletes all desired rows in a table, while using a limit. This function will execute many * DELETE queries until there are no more rows to delete. - * + * * Use this function when you need to delete many thousands of rows from a table without * locking the table for too long. - * + * * **Example** - * + * * // delete all visit rows whose ID is less than a certain value, 100000 rows at a time * $idVisit = // ... * Db::deleteAllRows(Common::prefixTable('log_visit'), "WHERE idvisit <= ?", "idvisit ASC", 100000, array($idVisit)); - * + * * @param string $table The name of the table to delete from. Must be prefixed (see {@link Piwik\Common::prefixTable()}). * @param string $where The where clause of the query. Must include the WHERE keyword. * @param $orderBy The column to order by and the order by direction, eg, `idvisit ASC`. @@ -285,7 +285,7 @@ class Db /** * Runs an `OPTIMIZE TABLE` query on the supplied table or tables. - * + * * Tables will only be optimized if the `[General] enable_sql_optimize_queries` INI config option is * set to **1**. * @@ -370,10 +370,10 @@ class Db /** * Locks the supplied table or tables. - * + * * **NOTE:** Piwik does not require the `LOCK TABLES` privilege to be available. Piwik * should still work if it has not been granted. - * + * * @param string|array $tablesToRead The table or tables to obtain 'read' locks on. Table names must * be prefixed (see {@link Piwik\Common::prefixTable()}). * @param string|array $tablesToWrite The table or tables to obtain 'write' locks on. Table names must @@ -405,7 +405,7 @@ class Db * * **NOTE:** Piwik does not require the `LOCK TABLES` privilege to be available. Piwik * should still work if it has not been granted. - * + * * @return \Zend_Db_Statement */ public static function unlockAllTables() @@ -416,7 +416,7 @@ class Db /** * Performs a `SELECT` statement on a table one chunk at a time and returns the first * successfully fetched value. - * + * * This function will execute a query on one set of rows in a table. If nothing * is fetched, it will execute the query on the next set of rows and so on until * the query returns a value. @@ -425,10 +425,10 @@ class Db * should be used when performing a `SELECT` that can take a long time to finish. * Using several smaller `SELECT`s will ensure that the table will not be locked * for too long. - * + * * **Example** - * - * // find the most recent visit that is older than a certain date + * + * // find the most recent visit that is older than a certain date * $dateStart = // ... * $sql = "SELECT idvisit * FROM $logVisit @@ -469,11 +469,11 @@ class Db /** * Performs a `SELECT` on a table one chunk at a time and returns an array * of every fetched value. - * + * * This function will break up a `SELECT` query into several smaller queries by * using only a limited number of rows at a time. It will accumulate the results * of each smaller query and return the result. - * + * * This function should be used when performing a `SELECT` that can * take a long time to finish. Using several smaller queries will ensure that * the table will not be locked for too long. @@ -509,11 +509,11 @@ class Db * This function will break up a `SELECT` query into several smaller queries by * using only a limited number of rows at a time. It will accumulate the results * of each smaller query and return the result. - * + * * This function should be used when performing a `SELECT` that can * take a long time to finish. Using several smaller queries will ensure that * the table will not be locked for too long. - * + * * @param string $sql The SQL to perform. The last two conditions of the `WHERE` * expression must be as follows: `'id >= ? AND id < ?'` where * **id** is the int id of the table. @@ -543,14 +543,14 @@ class Db /** * Performs a `UPDATE` or `DELETE` statement on a table one chunk at a time. - * + * * This function will break up a query into several smaller queries by * using only a limited number of rows at a time. - * + * * This function should be used when executing a non-query statement will * take a long time to finish. Using several smaller queries will ensure that * the table will not be locked for too long. - * + * * @param string $sql The SQL to perform. The last two conditions of the `WHERE` * expression must be as follows: `'id >= ? AND id < ?'` where * **id** is the int id of the table. diff --git a/core/Filesystem.php b/core/Filesystem.php index bcf36d29e1..ca0a30d5e2 100644 --- a/core/Filesystem.php +++ b/core/Filesystem.php @@ -14,7 +14,7 @@ use Piwik\Tracker\Cache; /** * Contains helper functions that deal with the filesystem. - * + * */ class Filesystem { @@ -70,7 +70,7 @@ class Filesystem /** * Attempts to create a new directory. All errors are silenced. - * + * * _Note: This function does **not** create directories recursively._ * * @param string $path The path of the directory to create. @@ -143,7 +143,7 @@ class Filesystem /** * Recursively find pathnames that match a pattern. - * + * * See {@link http://php.net/manual/en/function.glob.php glob} for more info. * * @param string $sDir directory The directory to glob in. @@ -239,7 +239,7 @@ class Filesystem /** * Copies the contents of a directory recursively from `$source` to `$target`. - * + * * @param string $source A directory or file to copy, eg. './tmp/latest'. * @param string $target A directory to copy to, eg. '.'. * @param bool $excludePhp Whether to avoid copying files if the file is related to PHP diff --git a/core/FrontController.php b/core/FrontController.php index 4de8eb4379..dc10f72e94 100644 --- a/core/FrontController.php +++ b/core/FrontController.php @@ -20,14 +20,14 @@ use Piwik\Plugins\CoreHome\Controller as CoreHomeController; /** * This singleton dispatches requests to the appropriate plugin Controller. - * + * * Piwik uses this class for all requests that go through **index.php**. Plugins can * use it to call controller actions of other plugins. - * + * * ### Examples - * + * * **Forwarding controller requests** - * + * * public function myConfiguredRealtimeMap() * { * $_GET['changeVisitAlpha'] = false; @@ -35,16 +35,16 @@ use Piwik\Plugins\CoreHome\Controller as CoreHomeController; * $_GET['showFooterMessage'] = false; * return FrontController::getInstance()->dispatch('UserCountryMap', 'realtimeMap'); * } - * + * * **Using other plugin controller actions** - * + * * public function myPopupWithRealtimeMap() * { * $_GET['changeVisitAlpha'] = false; * $_GET['removeOldVisits'] = false; * $_GET['showFooterMessage'] = false; * $realtimeMap = FrontController::getInstance()->fetchDispatch('UserCountryMap', 'realtimeMap'); - * + * * $view = new View('@MyPlugin/myPopupWithRealtimeMap.twig'); * $view->realtimeMap = $realtimeMap; * return $realtimeMap->render(); @@ -66,7 +66,7 @@ class FrontController extends Singleton /** * Executes the requested plugin controller method. - * + * * @throws Exception|\Piwik\PluginDeactivatedException in case the plugin doesn't exist, the action doesn't exist, * there is not enough permission, etc. * @@ -90,10 +90,10 @@ class FrontController extends Singleton /** * Triggered when a user with insufficient access permissions tries to view some resource. - * + * * This event can be used to customize the error that occurs when a user is denied access * (for example, displaying an error message, redirecting to a page other than login, etc.). - * + * * @param \Piwik\NoAccessException $exception The exception that was caught. */ Piwik::postEvent('User.isNotAuthorized', array($exception), $pending = true); @@ -181,10 +181,10 @@ class FrontController extends Singleton /** * Executes the requested plugin controller method and returns the data, capturing anything the * method `echo`s. - * + * * _Note: If the plugin controller returns something, the return value is returned instead * of whatever is in the output buffer._ - * + * * @param string $module The name of the plugin whose controller to execute, eg, `'UserCountryMap'`. * @param string $action The controller action name, eg, `'realtimeMap'`. * @param array $parameters Array of parameters to pass to the controller action method. @@ -268,9 +268,9 @@ class FrontController extends Singleton /** * Triggered when the configuration file cannot be found or read, which usually * means Piwik is not installed yet. - * + * * This event can be used to start the installation process or to display a custom error message. - * + * * @param Exception $exception The exception that was thrown by `Config::getInstance()`. */ Piwik::postEvent('Config.NoConfigurationFile', array($exception), $pending = true); @@ -379,9 +379,9 @@ class FrontController extends Singleton /** * Triggered just after the platform is initialized and plugins are loaded. - * + * * This event can be used to do early initialization. - * + * * _Note: At this point the user is not authenticated yet._ */ Piwik::postEvent('Request.dispatchCoreAndPluginUpdatesScreen'); @@ -396,12 +396,12 @@ class FrontController extends Singleton /** * Triggered before the user is authenticated, when the global authentication object * should be created. - * + * * Plugins that provide their own authentication implementation should use this event * to set the global authentication object (which must derive from {@link Piwik\Auth}). - * + * * **Example** - * + * * Piwik::addAction('Request.initAuthenticationObject', function() { * Piwik\Registry::set('auth', new MyAuthImplementation()); * }); @@ -430,7 +430,7 @@ class FrontController extends Singleton /** * Triggered after the platform is initialized and after the user has been authenticated, but * before the platform has handled the request. - * + * * Piwik uses this event to check for updates to Piwik. */ Piwik::postEvent('Platform.initialized'); diff --git a/core/Http.php b/core/Http.php index 7eb9ea94f9..6645edfb22 100644 --- a/core/Http.php +++ b/core/Http.php @@ -13,7 +13,7 @@ use Exception; /** * Contains HTTP client related helper methods that can retrieve content from remote servers * and optionally save to a local file. - * + * * Used to check for the latest Piwik version and download updates. * */ @@ -21,7 +21,7 @@ class Http { /** * Returns the "best" available transport method for {@link sendHttpRequest()} calls. - * + * * @return string Either `'curl'`, `'fopen'` or `'socket'`. * @api */ @@ -70,11 +70,11 @@ class Http * is returned on failure. * If `$getExtendedInfo` is `true` and `$destinationPath` is not specified an array with * the following information is returned on success: - * + * * - **status**: the HTTP status code * - **headers**: the HTTP headers * - **data**: the HTTP response data - * + * * `false` is still returned on failure. * @api */ @@ -544,17 +544,17 @@ class Http * is determined by the existing file's size and the expected file size, which * is stored in the piwik_option table before starting a download. The expected * file size is obtained through a `HEAD` HTTP request. - * + * * _Note: this function uses the **Range** HTTP header to accomplish downloading in * parts. Not every server supports this header._ - * + * * The proper use of this function is to call it once per request. The browser * should continue to send requests to Piwik which will in turn call this method * until the file has completely downloaded. In this way, the user can be informed * of a download's progress. - * + * * **Example Usage** - * + * * ``` * // browser JavaScript * var downloadFile = function (isStart) { @@ -572,10 +572,10 @@ class Http * }); * ajax.send(); * } - * + * * downloadFile(true); * ``` - * + * * ``` * // PHP controller action * public function myAction() @@ -585,7 +585,7 @@ class Http * Http::downloadChunk("http://bigfiles.com/averybigfile.zip", $outputPath, $isStart == 1); * } * ``` - * + * * @param string $url The url to download from. * @param string $outputPath The path to the file to save/append to. * @param bool $isContinuation `true` if this is the continuation of a download, diff --git a/core/IP.php b/core/IP.php index ca9d2702af..52f5f7c23f 100644 --- a/core/IP.php +++ b/core/IP.php @@ -246,7 +246,7 @@ class IP /** * Returns an IPv4 address from a 'mapped' IPv6 address. - * + * * @param string $ip eg, `'::ffff:192.0.2.128'` * @return string eg, `'192.0.2.128'` */ diff --git a/core/Log.php b/core/Log.php index 3436497884..db3961923d 100644 --- a/core/Log.php +++ b/core/Log.php @@ -12,29 +12,29 @@ use Piwik\Db; /** * Logging utility class. - * + * * Log entries are made with a message and log level. The logging utility will tag each * log entry with the name of the plugin that's doing the logging. If no plugin is found, * the name of the current class is used. - * + * * You can log messages using one of the public static functions (eg, 'error', 'warning', * 'info', etc.). Messages logged with the **error** level will **always** be logged to * the screen, regardless of whether the [log] log_writer config option includes the * screen writer. * * Currently, Piwik supports the following logging backends: - * + * * - **screen**: logging to the screen * - **file**: logging to a file * - **database**: logging to Piwik's MySQL database * * ### Logging configuration - * + * * The logging utility can be configured by manipulating the INI config options in the * `[log]` section. - * + * * The following configuration options can be set: - * + * * - `log_writers[]`: This is an array of log writer IDs. The three log writers provided * by Piwik core are **file**, **screen** and **database**. You can * get more by installing plugins. The default value is **screen**. @@ -51,53 +51,53 @@ use Piwik\Db; * to log to or a path to a directory to store logs in. If a * directory, the file name is piwik.log. Can be relative to * Piwik's root dir or an absolute path. Defaults to **tmp/logs**. - * + * * ### Custom message formatting - * + * * If you'd like to format log messages differently for different backends, you can use * one of the `'Log.format...Message'` events. - * + * * These events are fired when an object is logged. You can create your own custom class * containing the information to log and listen to these events to format it correctly for * different backends. - * + * * If you don't care about the backend when formatting an object, implement a `__toString()` * in the custom class. - * + * * ### Custom log writers - * + * * New logging backends can be added via the {@hook Log.getAvailableWriters}` event. A log * writer is just a callback that accepts log entry information (such as the message, * level, etc.), so any backend could conceivably be used (including existing PSR3 * backends). - * + * * ### Examples - * + * * **Basic logging** - * + * * Log::error("This log message will end up on the screen and in a file.") * Log::verbose("This log message uses %s params, but %s will only be called if the" * . " configured log level includes %s.", "sprintf", "sprintf", "verbose"); - * + * * **Logging objects** - * + * * class MyDebugInfo * { * // ... - * + * * public function __toString() * { * return // ... * } * } - * + * * try { * $myThirdPartyServiceClient->doSomething(); * } catch (Exception $unexpectedError) { * $debugInfo = new MyDebugInfo($unexpectedError, $myThirdPartyServiceClient); * Log::debug($debugInfo); * } - * + * * @method static \Piwik\Log getInstance() */ class Log extends Singleton @@ -331,7 +331,7 @@ class Log extends Singleton * make new logging writers available. * * A logging writer is a callback with the following signature: - * + * * function (int $level, string $tag, string $datetime, string $message) * * `$level` is the log level to use, `$tag` is the log tag used, `$datetime` is the date time @@ -341,7 +341,7 @@ class Log extends Singleton * name specified can be used in Piwik's INI configuration. * * **Example** - * + * * public function getAvailableWriters(&$writers) { * $writers['myloggername'] = function ($level, $tag, $datetime, $message) { * // ... @@ -349,7 +349,7 @@ class Log extends Singleton * } * * // 'myloggername' can now be used in the log_writers config option. - * + * * @param array $writers Array mapping writer names with logging writers. */ Piwik::postEvent(self::GET_AVAILABLE_WRITERS_EVENT, array(&$writers)); diff --git a/core/Menu/MenuAbstract.php b/core/Menu/MenuAbstract.php index 3c3fd4e013..baf5c659cb 100644 --- a/core/Menu/MenuAbstract.php +++ b/core/Menu/MenuAbstract.php @@ -16,11 +16,11 @@ use Piwik\Plugin\Manager as PluginManager; /** * Base class for classes that manage one of Piwik's menus. - * + * * There are three menus in Piwik, the main menu, the top menu and the admin menu. * Each menu has a class that manages the menu's content. Each class invokes * a different event to allow plugins to add new menu items. - * + * * @static \Piwik\Menu\MenuAbstract getInstance() */ abstract class MenuAbstract extends Singleton diff --git a/core/Menu/MenuAdmin.php b/core/Menu/MenuAdmin.php index cff021bb56..5c814b6706 100644 --- a/core/Menu/MenuAdmin.php +++ b/core/Menu/MenuAdmin.php @@ -14,7 +14,7 @@ use Piwik\Piwik; * Contains menu entries for the Admin menu. * Plugins can implement the `configureAdminMenu()` method of the `Menu` plugin class to add, rename of remove * items. If your plugin does not have a `Menu` class yet you can create one using `./console generate:menu`. - * + * * **Example** * * public function configureAdminMenu(MenuAdmin $menu) @@ -27,7 +27,7 @@ use Piwik\Piwik; * $order = 2 * ); * } - * + * * @method static \Piwik\Menu\MenuAdmin getInstance() */ class MenuAdmin extends MenuAbstract diff --git a/core/Menu/MenuTop.php b/core/Menu/MenuTop.php index 2901c82fe6..86fc1ab0c6 100644 --- a/core/Menu/MenuTop.php +++ b/core/Menu/MenuTop.php @@ -14,7 +14,7 @@ use Piwik\Piwik; * Contains menu entries for the Top menu (the menu at the very top of the page). * Plugins can implement the `configureTopMenu()` method of the `Menu` plugin class to add, rename of remove * items. If your plugin does not have a `Menu` class yet you can create one using `./console generate:menu`. - * + * * **Example** * * public function configureTopMenu(MenuTop $menu) @@ -27,7 +27,7 @@ use Piwik\Piwik; * $order = 2 * ); * } - * + * * @method static \Piwik\Menu\MenuTop getInstance() */ class MenuTop extends MenuAbstract diff --git a/core/Menu/MenuUser.php b/core/Menu/MenuUser.php index 6cbd9be7fe..ad9b195d46 100755 --- a/core/Menu/MenuUser.php +++ b/core/Menu/MenuUser.php @@ -12,7 +12,7 @@ namespace Piwik\Menu; * Contains menu entries for the User menu (the menu at the very top of the page). * Plugins can implement the `configureUserMenu()` method of the `Menu` plugin class to add, rename of remove * items. If your plugin does not have a `Menu` class yet you can create one using `./console generate:menu`. - * + * * **Example** * * public function configureUserMenu(MenuUser $menu) @@ -25,7 +25,7 @@ namespace Piwik\Menu; * $order = 2 * ); * } - * + * * @method static \Piwik\Menu\MenuUser getInstance() */ class MenuUser extends MenuAbstract diff --git a/core/Metrics.php b/core/Metrics.php index 3d6e8b84f7..8ac04a9a39 100644 --- a/core/Metrics.php +++ b/core/Metrics.php @@ -17,7 +17,7 @@ require_once PIWIK_INCLUDE_PATH . "/core/Piwik.php"; /** * This class contains metadata regarding core metrics and contains several * related helper functions. - * + * * Of note are the `INDEX_...` constants. In the database, metric column names * in {@link DataTable} rows are stored as integers to save space. The integer * values used are determined by these constants. diff --git a/core/MetricsFormatter.php b/core/MetricsFormatter.php index 049850496a..8c58215e30 100644 --- a/core/MetricsFormatter.php +++ b/core/MetricsFormatter.php @@ -12,7 +12,7 @@ use Piwik\Tracker\GoalManager; /** * Contains helper function that format numerical values in different ways. - * + * * @api */ class MetricsFormatter @@ -181,7 +181,7 @@ class MetricsFormatter /** * Prettifies a metric value based on the column name. - * + * * @param int $idSite The ID of the site the metric is for (used if the column value is an amount of money). * @param string $columnName The metric name. * @param mixed $value The metric value. diff --git a/core/Nonce.php b/core/Nonce.php index 825b9aea56..3937c4f94b 100644 --- a/core/Nonce.php +++ b/core/Nonce.php @@ -16,11 +16,11 @@ use Piwik\Session\SessionNamespace; * A cryptographic nonce -- "number used only once" -- is often recommended as * part of a robust defense against cross-site request forgery (CSRF/XSRF). This * class provides static methods that create and manage nonce values. - * + * * Nonces in Piwik are stored as a session variable and have a configurable expiration. * * Learn more about nonces [here](http://en.wikipedia.org/wiki/Cryptographic_nonce). - * + * * @api */ class Nonce @@ -56,10 +56,10 @@ class Nonce /** * Returns if a nonce is valid and comes from a valid request. - * + * * A nonce is valid if it matches the current nonce and if the current nonce * has not expired. - * + * * The request is valid if the referrer is a local URL (see {@link Url::isLocalUrl()}) * and if the HTTP origin is valid (see {@link getAcceptableOrigins()}). * @@ -108,7 +108,7 @@ class Nonce /** * Returns the **Origin** HTTP header or `false` if not found. - * + * * @return string|bool */ public static function getOrigin() @@ -156,7 +156,7 @@ class Nonce /** * Verifies and discards a nonce. - * + * * @param string $nonceName The nonce's unique ID. See {@link getNonce()}. * @param string|null $nonce The nonce from the client. If `null`, the value from the * **nonce** query parameter is used. diff --git a/core/Notification.php b/core/Notification.php index fcf1357a78..b7c576eba0 100644 --- a/core/Notification.php +++ b/core/Notification.php @@ -10,39 +10,39 @@ namespace Piwik; /** * Describes a UI notification. - * + * * UI notifications are messages displayed to the user near the top of the screen. * Notifications consist of a message, a context (the message type), a priority * and a display type. - * + * * **The context** affects the way the message looks, but not how it is displayed. - * + * * **The display type** determines how the message is displayed. - * + * * **The priority** determines where it is shown in the list of all displayed notifications. - * + * * ### Examples - * + * * **Display an error message** - * + * * $notification = new Notification('My Error Message'); * $notification->context = Notification::CONTEXT_ERROR; * Notification\Manager::notify('myUniqueNotificationId', $notification); - * + * * **Display a temporary success message** - * + * * $notification = new Notificiation('Success'); * $notification->context = Notification::CONTEXT_SUCCESS; * $notification->type = Notification::TYPE_TOAST; * Notification\Manager::notify('myUniqueNotificationId', $notification); - * + * * **Display a message near the top of the screen** - * + * * $notification = new Notification('Urgent: Your password has expired!'); * $notification->context = Notification::CONTEXT_INFO; * $notification->type = Notification::TYPE_PERSISTENT; * $notification->priority = Notification::PRIORITY_MAX; - * + * * @api */ class Notification @@ -75,7 +75,7 @@ class Notification /** * If this flag is applied, no close icon will be displayed. _Note: persistent notifications always have a close * icon._ - * + * * See {@link $flags}. */ const FLAG_NO_CLEAR = 1; @@ -99,39 +99,39 @@ class Notification /** * The notification title. The title is optional and is displayed directly before the message content. - * + * * @var string */ public $title; /** * The notification message. Must be set. - * + * * @var string */ public $message; /** * Contains extra display options. - * + * * Usage: `$notification->flags = Notification::FLAG_BAR | Notification::FLAG_FOO`. - * + * * @var int */ public $flags = self::FLAG_NO_CLEAR; /** * The notification's display type. See `TYPE_*` constants in {@link Notification}. - * + * * @var string */ public $type = self::TYPE_TRANSIENT; /** * The notification's context (message type). See `CONTEXT_*` constants in {@link Notification}. - * + * * A notification's context determines how it will be styled. - * + * * @var string */ public $context = self::CONTEXT_INFO; @@ -139,7 +139,7 @@ class Notification /** * The notification's priority. The higher the priority, the higher the order. See `PRIORITY_*` * constants in {@link Notification} to see possible priority values. - * + * * @var int */ public $priority; @@ -147,14 +147,14 @@ class Notification /** * If true, the message will not be escaped before being outputted as HTML. If you set this to * `true`, make sure you escape text yourself in order to avoid XSS vulnerabilities. - * + * * @var bool */ public $raw = false; /** * Constructor. - * + * * @param string $message The notification message. * @throws \Exception If the message is empty. */ @@ -169,7 +169,7 @@ class Notification /** * Returns `1` if the notification will be displayed without a close button, `0` if otherwise. - * + * * @return int `1` or `0`. */ public function hasNoClear() @@ -184,7 +184,7 @@ class Notification /** * Returns the notification's priority. If no priority has been set, a priority will be set based * on the notification's context. - * + * * @return int */ public function getPriority() diff --git a/core/Notification/Manager.php b/core/Notification/Manager.php index 54727fcfb6..921dc3fb82 100644 --- a/core/Notification/Manager.php +++ b/core/Notification/Manager.php @@ -13,7 +13,7 @@ use Piwik\Session\SessionNamespace; /** * Posts and removes UI notifications (see {@link Piwik\Notification} to learn more). - * + * */ class Manager { @@ -41,7 +41,7 @@ class Manager /** * Removes a posted notification by ID. - * + * * @param $id The notification ID, see {@link notify()}. */ public static function cancel($id) @@ -53,7 +53,7 @@ class Manager /** * Removes all temporary notifications. - * + * * Call this method after the notifications have been * displayed to make sure temporary notifications won't be displayed twice. */ diff --git a/core/Option.php b/core/Option.php index 1c403547d9..c2c7816bba 100644 --- a/core/Option.php +++ b/core/Option.php @@ -11,24 +11,24 @@ namespace Piwik; /** * Convenient key-value storage for user specified options and temporary * data that needs to be persisted beyond one request. - * + * * ### Examples - * + * * **Setting and getting options** - * + * * $optionValue = Option::get('MyPlugin.MyOptionName'); * if ($optionValue === false) { * // if not set, set it * Option::set('MyPlugin.MyOptionName', 'my option value'); * } - * + * * **Storing user specific options** - * + * * $userName = // ... * Option::set('MyPlugin.MyOptionName.' . $userName, 'my option value'); - * + * * **Clearing user specific options** - * + * * Option::deleteLike('MyPlugin.MyOptionName.%'); * * @api @@ -37,7 +37,7 @@ class Option { /** * Returns the option value for the requested option `$name`. - * + * * @param string $name The option name. * @return string|false The value or `false`, if not found. */ diff --git a/core/Period.php b/core/Period.php index fd99954021..bff447dc5e 100644 --- a/core/Period.php +++ b/core/Period.php @@ -13,12 +13,12 @@ use Piwik\Period\Range; /** * Date range representation. - * + * * Piwik allows users to view aggregated statistics for single days and for date * ranges consisting of several days. When requesting data, a **date** string and * a **period** string must be used to specify the date range that the data regards. * This is the class Piwik uses to represent and manipulate those date ranges. - * + * * There are five types of periods in Piwik: day, week, month, year and range, * where **range** is any date range. The reason the other periods exist instead * of just **range** is that Piwik will pre-archive reports for days, weeks, months @@ -47,7 +47,7 @@ abstract class Period /** * Constructor. - * + * * @param Date $date * @ignore */ @@ -69,16 +69,16 @@ abstract class Period /** * Returns true if `$dateString` and `$period` represent multiple periods. - * + * * Will return true for date/period combinations where date references multiple * dates and period is not `'range'`. For example, will return true for: - * + * * - **date** = `2012-01-01,2012-02-01` and **period** = `'day'` * - **date** = `2012-01-01,2012-02-01` and **period** = `'week'` * - **date** = `last7` and **period** = `'month'` - * + * * etc. - * + * * @static * @param $dateString string The **date** query parameter value. * @param $period string The **period** query parameter value. @@ -137,7 +137,7 @@ abstract class Period /** * Returns the period ID. - * + * * @return int A unique integer for this type of period. */ public function getId() @@ -147,7 +147,7 @@ abstract class Period /** * Returns the label for the current period. - * + * * @return string `"day"`, `"week"`, `"month"`, `"year"`, `"range"` */ public function getLabel() @@ -170,7 +170,7 @@ abstract class Period /** * Returns the number of available subperiods. - * + * * @return int */ public function getNumberOfSubperiods() @@ -182,7 +182,7 @@ abstract class Period /** * Returns the set of Period instances that together make up this period. For a year, * this would be 12 months. For a month this would be 28-31 days. Etc. - * + * * @return Period[] */ public function getSubperiods() @@ -222,7 +222,7 @@ abstract class Period /** * See {@link toString()}. - * + * * @return string */ public function __toString() @@ -232,7 +232,7 @@ abstract class Period /** * Returns a pretty string describing this period. - * + * * @return string */ abstract public function getPrettyString(); @@ -240,7 +240,7 @@ abstract class Period /** * Returns a short string description of this period that is localized with the currently used * language. - * + * * @return string */ abstract public function getLocalizedShortString(); @@ -248,14 +248,14 @@ abstract class Period /** * Returns a long string description of this period that is localized with the currently used * language. - * + * * @return string */ abstract public function getLocalizedLongString(); /** * Returns a succinct string describing this period. - * + * * @return string eg, `'2012-01-01,2012-01-31'`. */ public function getRangeString() diff --git a/core/Piwik.php b/core/Piwik.php index c3be1d7c19..c723c541ca 100644 --- a/core/Piwik.php +++ b/core/Piwik.php @@ -26,7 +26,7 @@ require_once PIWIK_INCLUDE_PATH . '/core/Translate.php'; /** * Main piwik helper class. - * + * * Contains helper methods for a variety of common tasks. Plugin developers are * encouraged to reuse these methods as much as possible. */ @@ -46,14 +46,14 @@ class Piwik /** * The idGoal query parameter value for the special 'abandoned carts' goal. - * + * * @api */ const LABEL_ID_GOAL_IS_ECOMMERCE_CART = 'ecommerceAbandonedCart'; /** * The idGoal query parameter value for the special 'ecommerce' goal. - * + * * @api */ const LABEL_ID_GOAL_IS_ECOMMERCE_ORDER = 'ecommerceOrder'; @@ -662,7 +662,7 @@ class Piwik /** * Returns `true` if the login is valid. - * + * * _Warning: does not check if the login already exists! You must use UsersManager_API->userExists as well._ * * @param string $userLogin @@ -776,7 +776,7 @@ class Piwik /** * Register an observer to an event. - * + * * **_Note: Observers should normally be defined in plugin objects. It is unlikely that you will * need to use this function._** * diff --git a/core/Plugin.php b/core/Plugin.php index d646b26866..389e85a6f6 100644 --- a/core/Plugin.php +++ b/core/Plugin.php @@ -19,7 +19,7 @@ require_once PIWIK_INCLUDE_PATH . '/core/Plugin/MetadataLoader.php'; /** * Base class of all Plugin Descriptor classes. - * + * * Any plugin that wants to add event observers to one of Piwik's {@hook # hooks}, * or has special installation/uninstallation logic must implement this class. * Plugins that can specify everything they need to in the _plugin.json_ files, @@ -27,16 +27,16 @@ require_once PIWIK_INCLUDE_PATH . '/core/Plugin/MetadataLoader.php'; * * Class implementations should be named after the plugin they are a part of * (eg, `class UserCountry extends Plugin`). - * + * * ### Plugin Metadata - * + * * In addition to providing a place for plugins to install/uninstall themselves * and add event observers, this class is also responsible for loading metadata * found in the plugin.json file. - * + * * The plugin.json file must exist in the root directory of a plugin. It can * contain the following information: - * + * * - **description**: An internationalized string description of what the plugin * does. * - **homepage**: The URL to the plugin's website. @@ -45,15 +45,15 @@ require_once PIWIK_INCLUDE_PATH . '/core/Plugin/MetadataLoader.php'; * - **license_homepage**: URL to website describing the license used. * - **version**: The plugin version (eg, 1.0.1). * - **theme**: `true` or `false`. If `true`, the plugin will be treated as a theme. - * + * * ### Examples - * + * * **How to extend** - * + * * use Piwik\Common; * use Piwik\Plugin; * use Piwik\Db; - * + * * class MyPlugin extends Plugin * { * public function getListHooksRegistered() @@ -66,17 +66,17 @@ require_once PIWIK_INCLUDE_PATH . '/core/Plugin/MetadataLoader.php'; * ) * ); * } - * + * * public function install() * { * Db::exec("CREATE TABLE " . Common::prefixTable('mytable') . "..."); * } - * + * * public function uninstall() * { * Db::exec("DROP TABLE IF EXISTS " . Common::prefixTable('mytable')); * } - * + * * public function getReportMetadata(&$metadata) * { * // ... @@ -87,7 +87,7 @@ require_once PIWIK_INCLUDE_PATH . '/core/Plugin/MetadataLoader.php'; * // ... * } * } - * + * * @api */ class Plugin @@ -159,7 +159,7 @@ class Plugin /** * Returns plugin information, including: - * + * * - 'description' => string // 1-2 sentence description of the plugin * - 'author' => string // plugin author * - 'author_homepage' => string // author homepage URL (or email "mailto:youremail@example.org") @@ -179,11 +179,11 @@ class Plugin /** * Returns a list of hooks with associated event observers. - * + * * Derived classes should use this method to associate callbacks with events. * * @return array eg, - * + * * array( * 'API.getReportMetadata' => 'myPluginFunction', * 'Another.event' => array( @@ -213,11 +213,11 @@ class Plugin /** * Installs the plugin. Derived classes should implement this class if the plugin * needs to: - * + * * - create tables * - update existing tables * - etc. - * + * * @throws \Exception if installation of fails for some reason. */ public function install() @@ -228,10 +228,10 @@ class Plugin /** * Uninstalls the plugins. Derived classes should implement this method if the changes * made in {@link install()} need to be undone during uninstallation. - * + * * In most cases, if you have an {@link install()} method, you should provide * an {@link uninstall()} method. - * + * * @throws \Exception if uninstallation of fails for some reason. */ public function uninstall() diff --git a/core/Plugin/API.php b/core/Plugin/API.php index 58de9e6461..cc16cfb64c 100644 --- a/core/Plugin/API.php +++ b/core/Plugin/API.php @@ -13,17 +13,17 @@ use Piwik\Singleton; /** * The base class of all API singletons. - * + * * Plugins that want to expose functionality through the Reporting API should create a class * that extends this one. Every public method in that class that is not annotated with **@ignore** * will be callable through Piwik's Web API. - * + * * _Note: If your plugin calculates and stores reports, they should be made available through the API._ - * + * * ### Examples - * + * * **Defining an API for a plugin** - * + * * class API extends \Piwik\Plugin\API * { * public function myMethod($idSite, $period, $date, $segment = false) @@ -32,11 +32,11 @@ use Piwik\Singleton; * return $dataTable; * } * } - * + * * **Linking to an API method** - * + * * <a href="?module=API&method=MyPlugin.myMethod&idSite=1&period=day&date=2013-10-23">Link</a> - * + * * @api */ abstract class API extends Singleton diff --git a/core/Plugin/Archiver.php b/core/Plugin/Archiver.php index fa79d07b26..7cc9fe26f5 100644 --- a/core/Plugin/Archiver.php +++ b/core/Plugin/Archiver.php @@ -15,41 +15,41 @@ use Piwik\Config as PiwikConfig; /** * The base class that should be extended by plugins that compute their own * analytics data. - * + * * Descendants should implement the {@link aggregateDayReport()} and {@link aggregateMultipleReports()} * methods. - * + * * Both of these methods should persist analytics data using the {@link \Piwik\ArchiveProcessor} * instance returned by {@link getProcessor()}. The {@link aggregateDayReport()} method should * compute analytics data using the {@link \Piwik\DataAccess\LogAggregator} instance * returned by {@link getLogAggregator()}. - * + * * ### Examples - * + * * **Extending Archiver** - * + * * class MyArchiver extends Archiver * { * public function aggregateDayReport() * { * $logAggregator = $this->getLogAggregator(); - * + * * $data = $logAggregator->queryVisitsByDimension(...); - * + * * $dataTable = new DataTable(); * $dataTable->addRowsFromSimpleArray($data); - * + * * $archiveProcessor = $this->getProcessor(); * $archiveProcessor->insertBlobRecords('MyPlugin_myReport', $dataTable->getSerialized(500)); * } - * + * * public function aggregateMultipleReports() * { * $archiveProcessor = $this->getProcessor(); * $archiveProcessor->aggregateDataTableRecords('MyPlugin_myReport', 500); * } * } - * + * * @api */ abstract class Archiver @@ -61,7 +61,7 @@ abstract class Archiver /** * Constructor. - * + * * @param ArchiveProcessor $processor The ArchiveProcessor instance to use when persisting archive * data. */ @@ -73,12 +73,12 @@ abstract class Archiver /** * Archives data for a day period. - * + * * Implementations of this method should do more computation intensive activities such * as aggregating data across log tables. Since this method only deals w/ data logged for a day, * aggregating individual log table rows isn't a problem. Doing this for any larger period, * however, would cause performance degradation. - * + * * Aggregate log table rows using a {@link Piwik\DataAccess\LogAggregator} instance. Get a * {@link Piwik\DataAccess\LogAggregator} instance using the {@link getLogAggregator()} method. */ @@ -86,11 +86,11 @@ abstract class Archiver /** * Archives data for a non-day period. - * + * * Implementations of this method should only aggregate existing reports of subperiods of the * current period. For example, it is more efficient to aggregate reports for each day of a * week than to aggregate each log entry of the week. - * + * * Use {@link Piwik\ArchiveProcessor::aggregateNumericMetrics()} and {@link Piwik\ArchiveProcessor::aggregateDataTableRecords()} * to aggregate archived reports. Get the {@link Piwik\ArchiveProcessor} instance using the {@link getProcessor()} * method. @@ -100,7 +100,7 @@ abstract class Archiver /** * Returns a {@link Piwik\ArchiveProcessor} instance that can be used to insert archive data for * the period, segment and site we are archiving data for. - * + * * @return \Piwik\ArchiveProcessor * @api */ @@ -112,7 +112,7 @@ abstract class Archiver /** * Returns a {@link Piwik\DataAccess\LogAggregator} instance that can be used to aggregate log table rows * for this period, segment and site. - * + * * @return \Piwik\DataAccess\LogAggregator * @api */ diff --git a/core/Plugin/ConsoleCommand.php b/core/Plugin/ConsoleCommand.php index 8db956df45..adb2c33a49 100644 --- a/core/Plugin/ConsoleCommand.php +++ b/core/Plugin/ConsoleCommand.php @@ -15,14 +15,14 @@ use Symfony\Component\Console\Output\OutputInterface; /** * The base class for console commands. - * + * * @api */ class ConsoleCommand extends SymfonyCommand { /** * Constructor. - * + * * @param string|null $name The name of the command, eg, `'generate:api'`. */ public function __construct($name = null) diff --git a/core/Plugin/Controller.php b/core/Plugin/Controller.php index 729e7da0f6..5521eaf0c2 100644 --- a/core/Plugin/Controller.php +++ b/core/Plugin/Controller.php @@ -40,18 +40,18 @@ use Piwik\ViewDataTable\Factory as ViewDataTableFactory; /** * Base class of all plugin Controllers. - * + * * Plugins that wish to add display HTML should create a Controller that either * extends from this class or from {@link ControllerAdmin}. Every public method in * the controller will be exposed as a controller method and can be invoked via * an HTTP request. - * + * * Learn more about Piwik's MVC system [here](/guides/mvc-in-piwik). - * + * * ### Examples - * + * * **Defining a controller** - * + * * class Controller extends \Piwik\Plugin\Controller * { * public function index() @@ -61,17 +61,17 @@ use Piwik\ViewDataTable\Factory as ViewDataTableFactory; * return $view->render(); * } * } - * + * * **Linking to a controller action** * * <a href="?module=MyPlugin&action=index&idSite=1&period=day&date=2013-10-10">Link</a> - * + * */ abstract class Controller { /** * The plugin name, eg. `'Referrers'`. - * + * * @var string * @api */ @@ -95,7 +95,7 @@ abstract class Controller /** * The value of the **idSite** query parameter. - * + * * @var int * @api */ @@ -103,7 +103,7 @@ abstract class Controller /** * The Site object created with {@link $idSite}. - * + * * @var Site * @api */ @@ -111,7 +111,7 @@ abstract class Controller /** * Constructor. - * + * * @api */ public function __construct() @@ -444,11 +444,11 @@ abstract class Controller /** * Returns a URL to a sparkline image for a report served by the current plugin. - * + * * The result of this URL should be used with the [sparkline()](/api-reference/Piwik/View#twig) twig function. - * + * * The current site ID and period will be used. - * + * * @param string $action Method name of the controller that serves the report. * @param array $customParameters The array of query parameter name/value pairs that * should be set in result URL. @@ -504,9 +504,9 @@ abstract class Controller /** * Assigns variables to {@link Piwik\View} instances that display an entire page. - * + * * The following variables assigned: - * + * * **date** - The value of the **date** query parameter. * **idSite** - The value of the **idSite** query parameter. * **rawDate** - The value of the **date** query parameter. @@ -519,11 +519,11 @@ abstract class Controller * **config_action_url_category_delimiter** - The value of the `[General] action_url_category_delimiter` * INI config option. * **topMenu** - The result of `MenuTop::getInstance()->getMenu()`. - * + * * As well as the variables set by {@link setPeriodVariablesView()}. - * + * * Will exit on error. - * + * * @param View $view * @return void * @api @@ -592,9 +592,9 @@ abstract class Controller /** * Assigns a set of generally useful variables to a {@link Piwik\View} instance. - * + * * The following variables assigned: - * + * * **enableMeasurePiwikForSiteId** - The value of the `[Debug] enable_measure_piwik_usage_in_idsite` * INI config option. * **isSuperUser** - True if the current user is the Super User, false if otherwise. @@ -607,7 +607,7 @@ abstract class Controller * **hasSVGLogo** - True if there is a SVG logo, false if otherwise. * **enableFrames** - The value of the `[General] enable_framed_pages` INI config option. If * true, {@link Piwik\View::setXFrameOptions()} is called on the view. - * + * * Also calls {@link setHostValidationVariablesView()}. * * @param View $view @@ -738,7 +738,7 @@ abstract class Controller /** * Sets general period variables on a view, including: - * + * * - **displayUniqueVisitors** - Whether unique visitors should be displayed for the current * period. * - **period** - The value of the **period** query parameter. @@ -771,7 +771,7 @@ abstract class Controller /** * Helper method used to redirect the current HTTP request to another module/action. - * + * * This function will exit immediately after executing. * * @param string $moduleToRedirect The plugin to redirect to, eg. `"MultiSites"`. @@ -834,10 +834,10 @@ abstract class Controller /** * Checks that the token_auth in the URL matches the currently logged-in user's token_auth. - * + * * This is a protection against CSRF and should be used in all controller * methods that modify Piwik or any user settings. - * + * * **The token_auth should never appear in the browser's address bar.** * * @throws \Piwik\NoAccessException If the token doesn't match. diff --git a/core/Plugin/ControllerAdmin.php b/core/Plugin/ControllerAdmin.php index 714f3ce464..e37cd7b11b 100644 --- a/core/Plugin/ControllerAdmin.php +++ b/core/Plugin/ControllerAdmin.php @@ -22,9 +22,9 @@ use Piwik\View; /** * Base class of plugin controllers that provide administrative functionality. - * + * * See {@link Controller} to learn more about Piwik controllers. - * + * */ abstract class ControllerAdmin extends Controller { diff --git a/core/Plugin/Dimension/VisitDimension.php b/core/Plugin/Dimension/VisitDimension.php index 594791f920..d906bd804f 100644 --- a/core/Plugin/Dimension/VisitDimension.php +++ b/core/Plugin/Dimension/VisitDimension.php @@ -277,7 +277,7 @@ abstract class VisitDimension extends Dimension $plugins = PluginManager::getInstance()->getLoadedPlugins(); $instances = array(); - + foreach ($plugins as $plugin) { foreach (self::getDimensions($plugin) as $instance) { $instances[] = $instance; diff --git a/core/Plugin/Manager.php b/core/Plugin/Manager.php index 8d3153377d..994aabc6e7 100644 --- a/core/Plugin/Manager.php +++ b/core/Plugin/Manager.php @@ -435,7 +435,7 @@ class Manager extends Singleton /** * Returns the currently enabled theme. - * + * * If no theme is enabled, the **Morpheus** plugin is returned (this is the base and default theme). * * @return Plugin @@ -496,7 +496,7 @@ class Manager extends Singleton * * @return array An array that maps plugin names with arrays of plugin information. Plugin * information consists of the following entries: - * + * * - **activated**: Whether the plugin is activated. * - **alwaysActivated**: Whether the plugin should always be activated, * or not. diff --git a/core/Plugin/Settings.php b/core/Plugin/Settings.php index ff21452968..54e5b05653 100644 --- a/core/Plugin/Settings.php +++ b/core/Plugin/Settings.php @@ -17,12 +17,12 @@ use Piwik\SettingsServer; /** * Base class of all plugin settings providers. Plugins that define their own configuration settings * can extend this class to easily make their settings available to Piwik users. - * + * * Descendants of this class should implement the {@link init()} method and call the * {@link addSetting()} method for each of the plugin's settings. - * + * * For an example, see the {@link Piwik\Plugins\ExampleSettingsPlugin\ExampleSettingsPlugin} plugin. - * + * * @api */ abstract class Settings implements StorageInterface @@ -60,7 +60,7 @@ abstract class Settings implements StorageInterface /** * Constructor. - * + * * @param string $pluginName The name of the plugin these settings are for. */ public function __construct($pluginName) @@ -90,7 +90,7 @@ abstract class Settings implements StorageInterface /** * Returns the introduction text for this plugin's settings. - * + * * @return string */ public function getIntroduction() @@ -187,7 +187,7 @@ abstract class Settings implements StorageInterface /** * Sets (overwrites) the value of a setting in memory. To persist the change, {@link save()} must be * called afterwards, otherwise the change has no effect. - * + * * Before the setting is changed, the {@link Piwik\Settings\Setting::$validate} and * {@link Piwik\Settings\Setting::$transform} closures will be invoked (if defined). If there is no validation * filter, the setting value will be casted to the appropriate data type. diff --git a/core/Plugin/ViewDataTable.php b/core/Plugin/ViewDataTable.php index fe603b159d..14b2f979f7 100644 --- a/core/Plugin/ViewDataTable.php +++ b/core/Plugin/ViewDataTable.php @@ -22,64 +22,64 @@ use Piwik\ViewDataTable\RequestConfig as VizRequest; /** * The base class of all report visualizations. - * + * * ViewDataTable instances load analytics data via Piwik's Reporting API and then output some * type of visualization of that data. - * + * * Visualizations can be in any format. HTML-based visualizations should extend * {@link Visualization}. Visualizations that use other formats, such as visualizations * that output an image, should extend ViewDataTable directly. * * ### Creating ViewDataTables - * + * * ViewDataTable instances are not created via the new operator, instead the {@link Piwik\ViewDataTable\Factory} * class is used. - * + * * The specific subclass to create is determined, first, by the **viewDataTable** query paramater. * If this parameter is not set, then the default visualization type for the report being * displayed is used. * * ### Configuring ViewDataTables - * + * * **Display properties** - * + * * ViewDataTable output can be customized by setting one of many available display * properties. Display properties are stored as fields in {@link Piwik\ViewDataTable\Config} objects. * ViewDataTables store a {@link Piwik\ViewDataTable\Config} object in the {@link $config} field. - * + * * Display properties can be set at any time before rendering. - * + * * **Request properties** - * + * * Request properties are similar to display properties in the way they are set. They are, * however, not used to customize ViewDataTable instances, but in the request to Piwik's * API when loading analytics data. - * + * * Request properties are set by setting the fields of a {@link Piwik\ViewDataTable\RequestConfig} object stored in * the {@link $requestConfig} field. They can be set at any time before rendering. * Setting them after data is loaded will have no effect. - * + * * **Customizing how reports are displayed** - * + * * Each individual report should be rendered in its own controller method. There are two * ways to render a report within its controller method. You can either: - * + * * 1. manually create and configure a ViewDataTable instance * 2. invoke {@link Piwik\Plugin\Controller::renderReport} and configure the ViewDataTable instance * in the {@hook ViewDataTable.configure} event. - * + * * ViewDataTable instances are configured by setting and modifying display properties and request * properties. - * + * * ### Creating new visualizations - * + * * New visualizations can be created by extending the ViewDataTable class or one of its * descendants. To learn more [read our guide on creating new visualizations](/guides/visualizing-report-data#creating-new-visualizations). - * + * * ### Examples - * + * * **Manually configuring a ViewDataTable** - * + * * // a controller method that displays a single report * public function myReport() * { @@ -89,18 +89,18 @@ use Piwik\ViewDataTable\RequestConfig as VizRequest; * // ... * return $view->render(); * } - * + * * **Using {@link Piwik\Plugin\Controller::renderReport}** - * + * * First, a controller method that displays a single report: - * + * * public function myReport() * { * return $this->renderReport(__FUNCTION__);` * } - * + * * Then the event handler for the {@hook ViewDataTable.configure} event: - * + * * public function configureViewDataTable(ViewDataTable $view) * { * switch ($view->requestConfig->apiMethodToRequestDataTable) { @@ -111,32 +111,32 @@ use Piwik\ViewDataTable\RequestConfig as VizRequest; * break; * } * } - * + * * **Using custom configuration objects in a new visualization** - * + * * class MyVisualizationConfig extends Piwik\ViewDataTable\Config * { * public $my_new_property = true; * } - * + * * class MyVisualizationRequestConfig extends Piwik\ViewDataTable\RequestConfig * { * public $my_new_property = false; * } - * + * * class MyVisualization extends Piwik\Plugin\ViewDataTable * { * public static function getDefaultConfig() * { * return new MyVisualizationConfig(); * } - * + * * public static function getDefaultRequestConfig() * { * return new MyVisualizationRequestConfig(); * } * } - * + * * * @api */ @@ -153,14 +153,14 @@ abstract class ViewDataTable implements ViewInterface /** * Contains display properties for this visualization. - * + * * @var \Piwik\ViewDataTable\Config */ public $config; /** * Contains request properties for this visualization. - * + * * @var \Piwik\ViewDataTable\RequestConfig */ public $requestConfig; @@ -229,10 +229,10 @@ abstract class ViewDataTable implements ViewInterface /** * Triggered during {@link ViewDataTable} construction. Subscribers should customize * the view based on the report that is being displayed. - * + * * Plugins that define their own reports must subscribe to this event in order to * specify how the Piwik UI should display the report. - * + * * **Example** * * // event handler @@ -245,7 +245,7 @@ abstract class ViewDataTable implements ViewInterface * break; * } * } - * + * * @param ViewDataTable $view The instance to configure. */ Piwik::postEvent('ViewDataTable.configure', array($this)); @@ -283,12 +283,12 @@ abstract class ViewDataTable implements ViewInterface /** * Returns the default config instance. - * + * * Visualizations that define their own display properties should override this method and * return an instance of their new {@link Piwik\ViewDataTable\Config} descendant. * * See the last example {@link ViewDataTable here} for more information. - * + * * @return \Piwik\ViewDataTable\Config */ public static function getDefaultConfig() @@ -298,12 +298,12 @@ abstract class ViewDataTable implements ViewInterface /** * Returns the default request config instance. - * + * * Visualizations that define their own request properties should override this method and * return an instance of their new {@link Piwik\ViewDataTable\RequestConfig} descendant. * * See the last example {@link ViewDataTable here} for more information. - * + * * @return \Piwik\ViewDataTable\RequestConfig */ public static function getDefaultRequestConfig() @@ -326,7 +326,7 @@ abstract class ViewDataTable implements ViewInterface /** * Returns the viewDataTable ID for this DataTable visualization. - * + * * Derived classes should not override this method. They should instead declare a const ID field * with the viewDataTable ID. * @@ -348,7 +348,7 @@ abstract class ViewDataTable implements ViewInterface /** * Returns `true` if this instance's or any of its ancestors' viewDataTable IDs equals the supplied ID, * `false` if otherwise. - * + * * Can be used to test whether a ViewDataTable object is an instance of a certain visualization or not, * without having to know where that visualization is. * @@ -479,7 +479,7 @@ abstract class ViewDataTable implements ViewInterface /** * Returns `true` if this visualization can display some type of data or not. - * + * * New visualization classes should override this method if they can only visualize certain * types of data. The evolution graph visualization, for example, can only visualize * sets of DataTables. If the API method used results in a single DataTable, the evolution diff --git a/core/Plugin/Visualization.php b/core/Plugin/Visualization.php index e86274c5ea..1c5a7a3bd8 100644 --- a/core/Plugin/Visualization.php +++ b/core/Plugin/Visualization.php @@ -24,11 +24,11 @@ use Piwik\ViewDataTable\Manager as ViewDataTableManager; /** * The base class for report visualizations that output HTML and use JavaScript. - * + * * Report visualizations that extend from this class will be displayed like all others in * the Piwik UI. The following extra UI controls will be displayed around the visualization * itself: - * + * * - report documentation, * - a footer message (if {@link Piwik\ViewDataTable\Config::$show_footer_message} is set), * - a list of links to related reports (if {@link Piwik\ViewDataTable\Config::$related_reports} is set), @@ -37,33 +37,33 @@ use Piwik\ViewDataTable\Manager as ViewDataTableManager; * - a limit control that allows users to change the amount of rows displayed (if * {@link Piwik\ViewDataTable\Config::$show_limit_control} is true), * - and more depending on the visualization. - * + * * ### Rendering Process - * + * * The following process is used to render reports: - * + * * - The report is loaded through Piwik's Reporting API. * - The display and request properties that require report data in order to determine a default * value are defaulted. These properties are: - * + * * - {@link Piwik\ViewDataTable\Config::$columns_to_display} * - {@link Piwik\ViewDataTable\RequestConfig::$filter_sort_column} * - {@link Piwik\ViewDataTable\RequestConfig::$filter_sort_order} - * + * * - Priority filters are applied to the report (see {@link Piwik\ViewDataTable\Config::$filters}). * - The filters that are applied to every report in the Reporting API (called **generic filters**) * are applied. (see {@link Piwik\API\Request}) * - The report's queued filters are applied. * - A {@link Piwik\View} instance is created and rendered. - * + * * ### Rendering Hooks - * + * * The Visualization class defines several overridable methods that are called at specific * points during the rendering process. Derived classes can override these methods change * the data that is displayed or set custom properties. - * + * * The overridable methods (called **rendering hooks**) are as follows: - * + * * - **beforeLoadDataTable**: Called at the start of the rendering process before any data * is loaded. * - **beforeGenericFiltersAreAppliedToLoadedDataTable**: Called after data is loaded and after priority @@ -76,20 +76,20 @@ use Piwik\ViewDataTable\Manager as ViewDataTableManager; * - **beforeRender**: Called immediately before a {@link Piwik\View} is created and rendered. * - **isThereDataToDisplay**: Called after a {@link Piwik\View} is created to determine if the report has * data or not. If not, a message is displayed to the user. - * + * * ### The DataTable JavaScript class - * + * * In the UI, visualization behavior is provided by logic in the **DataTable** JavaScript class. * When creating new visualizations, the **DataTable** JavaScript class (or one of its existing * descendants) should be extended. - * + * * To learn more read the [Visualizing Report Data](/guides/visualizing-report-data#creating-new-visualizations) * guide. * * ### Examples - * + * * **Changing the data that is loaded** - * + * * class MyVisualization extends Visualization * { * // load the previous period's data as well as the requested data. this will change @@ -101,20 +101,20 @@ use Piwik\ViewDataTable\Manager as ViewDataTableManager; * * $this->requestConfig->request_parameters_to_modify['date'] = $previousDate . ',' . $date; * } - * + * * // since we load the previous period's data too, we need to override the logic to * // check if there is data or not. * public function isThereDataToDisplay() * { * $tables = $this->dataTable->getDataTables() * $requestedDataTable = end($tables); - * + * * return $requestedDataTable->getRowsCount() != 0; * } * } - * + * * **Force properties to be set to certain values** - * + * * class MyVisualization extends Visualization * { * // ensure that some properties are set to certain values before rendering. @@ -133,9 +133,9 @@ class Visualization extends ViewDataTable { /** * The Twig template file to use when rendering, eg, `"@MyPlugin/_myVisualization.twig"`. - * + * * Must be defined by classes that extend Visualization. - * + * * @api */ const TEMPLATE_FILE = ''; @@ -253,9 +253,9 @@ class Visualization extends ViewDataTable /** * Returns `true` if there is data to display, `false` if otherwise. - * + * * Derived classes should override this method if they change the amount of data that is loaded. - * + * * @api */ protected function isThereDataToDisplay() @@ -507,7 +507,7 @@ class Visualization extends ViewDataTable /** * Hook that is called before loading report data from the API. - * + * * Use this method to change the request parameters that is sent to the API when requesting * data. * @@ -519,7 +519,7 @@ class Visualization extends ViewDataTable /** * Hook that is executed before generic filters are applied. - * + * * Use this method if you need access to the entire dataset (since generic filters will * limit and truncate reports). * diff --git a/core/RankingQuery.php b/core/RankingQuery.php index 0f4db68ab4..f40ae1273e 100644 --- a/core/RankingQuery.php +++ b/core/RankingQuery.php @@ -88,7 +88,7 @@ class RankingQuery /** * Constructor. - * + * * @param int|false $limit The result row limit. See {@link setLimit()}. */ public function __construct($limit = false) @@ -178,7 +178,7 @@ class RankingQuery * for each possible value you provide (where the rows of each set have a column value * that equals a possible value). Each of these new sets of rows will be individually * limited resulting in several limited result sets. - * + * * For example, you can run a query aggregating some data on the log_action table and * partition by log_action.type with the possible values of {@link Piwik\Tracker\Action::TYPE_PAGE_URL}, * {@link Piwik\Tracker\Action::TYPE_OUTLINK}, {@link Piwik\Tracker\Action::TYPE_DOWNLOAD}. diff --git a/core/ScheduledTask.php b/core/ScheduledTask.php index 18cb2aa94e..15b702dab8 100644 --- a/core/ScheduledTask.php +++ b/core/ScheduledTask.php @@ -15,9 +15,9 @@ use Piwik\ScheduledTime; /** * Contains metadata referencing PHP code that should be executed at regular * intervals. - * + * * See the {@link TaskScheduler} docs to learn more about scheduled tasks. - * + * * * @api */ @@ -67,7 +67,7 @@ class ScheduledTask /** * Constructor. - * + * * @param mixed $objectInstance The object or class that contains the method to execute regularly. * Usually this will be a {@link Plugin} instance. * @param string $methodName The name of the method that will be regularly executed. @@ -104,11 +104,11 @@ class ScheduledTask return $namespaced; } - + /** * Returns the object instance that contains the method to execute. Returns a class * name if the method is static. - * + * * @return mixed */ public function getObjectInstance() @@ -118,7 +118,7 @@ class ScheduledTask /** * Returns the name of the class that contains the method to execute. - * + * * @return string */ public function getClassName() @@ -128,7 +128,7 @@ class ScheduledTask /** * Returns the name of the method that will be executed. - * + * * @return string */ public function getMethodName() @@ -139,7 +139,7 @@ class ScheduledTask /** * Returns the value that will be passed to the method when executed, or `null` if * no value will be supplied. - * + * * @return string|null */ public function getMethodParameter() @@ -160,7 +160,7 @@ class ScheduledTask /** * Returns the time in milliseconds when this task will be executed next. - * + * * @return int */ public function getRescheduledTime() @@ -182,11 +182,11 @@ class ScheduledTask /** * Returns a unique name for this scheduled task. The name is stored in the DB and is used * to store a task's previous execution time. The name is created using: - * + * * - the name of the class that contains the method to execute, * - the name of the method to regularly execute, * - and the value that is passed to the executed task. - * + * * @return string */ public function getName() diff --git a/core/ScheduledTime.php b/core/ScheduledTime.php index 6035f830ff..f221a82a43 100644 --- a/core/ScheduledTime.php +++ b/core/ScheduledTime.php @@ -93,7 +93,7 @@ abstract class ScheduledTime /** * Sets the day of the period to execute the scheduled task. Not a valid operation for all period types. - * + * * @abstract * @param int $_day a number describing the day to set. Its meaning depends on the ScheduledTime's period type. * @throws Exception if method not supported by subclass or parameter _day is invalid @@ -102,7 +102,7 @@ abstract class ScheduledTime /** * Sets the hour of the day on which the task should be executed. - * + * * @param int $hour Must be `>= 0` and `< 24`. * @throws Exception If the current scheduled period is **hourly** or if `$hour` is invalid. * @api @@ -153,7 +153,7 @@ abstract class ScheduledTime // make sure the rescheduled date is in the future $rescheduledTime = (24 * 3600) + $rescheduledTime; } - + return $rescheduledTime; } @@ -181,14 +181,14 @@ abstract class ScheduledTime /** * Returns a new ScheduledTime instance using a string description of the scheduled period type * and a string description of the day within the period to execute the task on. - * + * * @param string $periodType The scheduled period type. Can be `'hourly'`, `'daily'`, `'weekly'`, or `'monthly'`. * @param string|int|false $periodDay A string describing the day within the scheduled period to execute * the task on. Only valid for week and month periods. - * + * * If `'weekly'` is supplied for `$periodType`, this should be a day * of the week, for example, `'monday'` or `'tuesday'`. - * + * * If `'monthly'` is supplied for `$periodType`, this can be a numeric * day in the month or a day in one week of the month. For example, * `12`, `23`, `'first sunday'` or `'fourth tuesday'`. diff --git a/core/ScheduledTime/Weekly.php b/core/ScheduledTime/Weekly.php index e5715b5fd0..5ae499b9eb 100644 --- a/core/ScheduledTime/Weekly.php +++ b/core/ScheduledTime/Weekly.php @@ -46,7 +46,7 @@ class Weekly extends ScheduledTime date('j', $currentTime) + $daysFromNow, date('Y', $currentTime) ); - + // Adjusts the scheduled hour $rescheduledTime = $this->adjustHour($rescheduledTime); $rescheduledTime = $this->adjustTimezone($rescheduledTime); diff --git a/core/Segment.php b/core/Segment.php index 99d2382ef8..01e056bf68 100644 --- a/core/Segment.php +++ b/core/Segment.php @@ -13,26 +13,26 @@ use Piwik\Plugins\API\API; /** * Limits the set of visits Piwik uses when aggregating analytics data. - * + * * A segment is a condition used to filter visits. They can, for example, * select visits that have a specific browser or come from a specific * country, or both. - * + * * Individual segment dimensions (such as `browserCode` and `countryCode`) * are defined by plugins. Read about the {@hook API.getSegmentDimensionMetadata} * event to learn more. - * + * * Plugins that aggregate data stored in Piwik can support segments by * using this class when generating aggregation SQL queries. - * + * * ### Examples - * + * * **Basic usage** - * + * * $idSites = array(1,2,3); * $segmentStr = "browserCode==ff;countryCode==CA"; * $segment = new Segment($segmentStr, $idSites); - * + * * $query = $segment->getSelectQuery( * $select = "table.col1, table2.col2", * $from = array("table", "table2"), @@ -41,15 +41,15 @@ use Piwik\Plugins\API\API; * $orderBy = "table.col1 DESC", * $groupBy = "table2.col2" * ); - * + * * Db::fetchAll($query['sql'], $query['bind']); - * + * * **Creating a _null_ segment** - * + * * $idSites = array(1,2,3); * $segment = new Segment('', $idSites); * // $segment->getSelectQuery will return a query that selects all visits - * + * * @api */ class Segment @@ -66,7 +66,7 @@ class Segment /** * Constructor. - * + * * @param string $segmentCondition The segment condition, eg, `'browserCode=ff;countryCode=CA'`. * @param array $idSites The list of sites the segment will be used with. Some segments are * dependent on the site, such as goal segments. @@ -186,7 +186,7 @@ class Segment /** * Returns the segment condition. - * + * * @return string */ public function getString() @@ -197,7 +197,7 @@ class Segment /** * Returns a hash of the segment condition, or the empty string if the segment * condition is empty. - * + * * @return string */ public function getHash() diff --git a/core/Settings/Setting.php b/core/Settings/Setting.php index 41cffbe526..2b8e53bf26 100644 --- a/core/Settings/Setting.php +++ b/core/Settings/Setting.php @@ -19,7 +19,7 @@ abstract class Setting /** * Describes the setting's PHP data type. When saved, setting values will always be casted to this * type. - * + * * See {@link Piwik\Plugin\Settings} for a list of supported data types. * * @var string @@ -30,7 +30,7 @@ abstract class Setting * Describes what HTML element should be used to manipulate the setting through Piwik's UI. * * See {@link Piwik\Plugin\Settings} for a list of supported control types. - * + * * @var string */ public $uiControlType = null; @@ -38,22 +38,22 @@ abstract class Setting /** * Name-value mapping of HTML attributes that will be added HTML form control, eg, * `array('size' => 3)`. Attributes will be escaped before outputting. - * + * * @var array */ public $uiControlAttributes = array(); /** * The list of all available values for this setting. If null, the setting can have any value. - * + * * If supplied, this field should be an array mapping available values with their prettified * display value. Eg, if set to `array('nb_visits' => 'Visits', 'nb_actions' => 'Actions')`, * the UI will display **Visits** and **Actions**, and when the user selects one, Piwik will * set the setting to **nb_visits** or **nb_actions** respectively. - * + * * The setting value will be validated if this field is set. If the value is not one of the * available values, an error will be triggered. - * + * * _Note: If a custom validator is supplied (see {@link $validate}), the setting value will * not be validated._ * @@ -63,7 +63,7 @@ abstract class Setting /** * Text that will appear above this setting's section in the _Plugin Settings_ admin page. - * + * * @var null|string */ public $introduction = null; @@ -71,7 +71,7 @@ abstract class Setting /** * Text that will appear directly underneath the setting title in the _Plugin Settings_ admin * page. If set, should be a short description of the setting. - * + * * @var null|string */ public $description = null; @@ -80,20 +80,20 @@ abstract class Setting * Text that will appear next to the setting's section in the _Plugin Settings_ admin page. If set, * it should contain information about the setting that is more specific than a general description, * such as the format of the setting value if it has a special format. - * + * * @var null|string */ public $inlineHelp = null; /** * A closure that does some custom validation on the setting before the setting is persisted. - * + * * The closure should take two arguments: the setting value and the {@link Setting} instance being * validated. If the value is found to be invalid, the closure should throw an exception with * a message that describes the error. - * + * * **Example** - * + * * $setting->validate = function ($value, Setting $setting) { * if ($value > 60) { * throw new \Exception('The time limit is not allowed to be greater than 60 minutes.'); @@ -107,13 +107,13 @@ abstract class Setting /** * A closure that transforms the setting value. If supplied, this closure will be executed after * the setting has been validated. - * + * * _Note: If a transform is supplied, the setting's {@link $type} has no effect. This means the * transformation function will be responsible for casting the setting value to the appropriate * data type._ * * **Example** - * + * * $setting->transform = function ($value, Setting $setting) { * if ($value > 30) { * $value = 30; @@ -128,7 +128,7 @@ abstract class Setting /** * Default value of this setting. - * + * * The default value is not casted to the appropriate data type. This means _**you**_ have to make * sure the value is of the correct type. * @@ -169,7 +169,7 @@ abstract class Setting /** * Returns the setting's persisted name, eg, `'refreshInterval'`. - * + * * @return string */ public function getName() @@ -179,7 +179,7 @@ abstract class Setting /** * Returns `true` if this setting can be displayed for the current user, `false` if otherwise. - * + * * @return bool */ public function isWritableByCurrentUser() @@ -199,7 +199,7 @@ abstract class Setting /** * Sets the object used to persist settings. - * + * * @return StorageInterface */ public function setStorage(StorageInterface $storage) @@ -210,7 +210,7 @@ abstract class Setting /** * Returns the previously persisted setting value. If no value was set, the default value * is returned. - * + * * @return mixed * @throws \Exception If the current user is not allowed to change the value of this setting. */ @@ -221,7 +221,7 @@ abstract class Setting /** * Sets and persists this setting's value overwriting any existing value. - * + * * @param mixed $value * @throws \Exception If the current user is not allowed to change the value of this setting. */ @@ -242,7 +242,7 @@ abstract class Setting /** * Returns the display order. The lower the return value, the earlier the setting will be displayed. - * + * * @return int */ public function getOrder() diff --git a/core/Settings/SystemSetting.php b/core/Settings/SystemSetting.php index f26c979ae1..935aec1388 100644 --- a/core/Settings/SystemSetting.php +++ b/core/Settings/SystemSetting.php @@ -14,7 +14,7 @@ use Piwik\Piwik; /** * Describes a system wide setting. Only the Super User can change this type of setting and * the value of this setting will affect all users. - * + * * See {@link \Piwik\Plugin\Settings}. * * @@ -33,7 +33,7 @@ class SystemSetting extends Setting /** * Constructor. - * + * * @param string $name The persisted name of the setting. * @param string $title The display name of the setting. */ @@ -47,7 +47,7 @@ class SystemSetting extends Setting /** * Returns the display order. System settings are displayed before user settings. - * + * * @return int */ public function getOrder() diff --git a/core/Settings/UserSetting.php b/core/Settings/UserSetting.php index 8f56f7104d..fa29269707 100644 --- a/core/Settings/UserSetting.php +++ b/core/Settings/UserSetting.php @@ -24,7 +24,7 @@ class UserSetting extends Setting /** * Constructor. - * + * * @param string $name The setting's persisted name. * @param string $title The setting's display name. * @param null|string $userLogin The user this setting applies to. Will default to the current user login. @@ -41,7 +41,7 @@ class UserSetting extends Setting /** * Returns the display order. User settings are displayed after system settings. - * + * * @return int */ public function getOrder() diff --git a/core/SettingsPiwik.php b/core/SettingsPiwik.php index c096182b73..4e83190e70 100644 --- a/core/SettingsPiwik.php +++ b/core/SettingsPiwik.php @@ -12,7 +12,7 @@ use Exception; /** * Contains helper methods that can be used to get common Piwik settings. - * + * */ class SettingsPiwik { @@ -63,27 +63,27 @@ class SettingsPiwik * Triggered during the cron archiving process to collect segments that * should be pre-processed for all websites. The archiving process will be launched * for each of these segments when archiving data. - * + * * This event can be used to add segments to be pre-processed. If your plugin depends * on data from a specific segment, this event could be used to provide enhanced * performance. - * + * * _Note: If you just want to add a segment that is managed by the user, use the * SegmentEditor API._ - * + * * **Example** - * + * * Piwik::addAction('Segments.getKnownSegmentsToArchiveAllSites', function (&$segments) { * $segments[] = 'country=jp;city=Tokyo'; * }); - * + * * @param array &$segmentsToProcess List of segment definitions, eg, - * + * * array( * 'browserCode=ff;resolution=800x600', * 'country=jp;city=Tokyo' * ) - * + * * Add segments to this array in your event handler. */ Piwik::postEvent('Segments.getKnownSegmentsToArchiveAllSites', array(&$segmentsToProcess)); @@ -97,7 +97,7 @@ class SettingsPiwik /** * Returns the list of stored segments to pre-process for an individual site when executing * cron archiving. - * + * * @param int $idSite The ID of the site to get stored segments for. * @return string The list of stored segments that apply to the requested site. */ @@ -109,25 +109,25 @@ class SettingsPiwik * Triggered during the cron archiving process to collect segments that * should be pre-processed for one specific site. The archiving process will be launched * for each of these segments when archiving data for that one site. - * + * * This event can be used to add segments to be pre-processed for one site. - * + * * _Note: If you just want to add a segment that is managed by the user, you should use the * SegmentEditor API._ - * + * * **Example** - * + * * Piwik::addAction('Segments.getKnownSegmentsToArchiveForSite', function (&$segments, $idSite) { * $segments[] = 'country=jp;city=Tokyo'; * }); - * + * * @param array &$segmentsToProcess List of segment definitions, eg, - * + * * array( * 'browserCode=ff;resolution=800x600', * 'country=JP;city=Tokyo' * ) - * + * * Add segments to this array in your event handler. * @param int $idSite The ID of the site to get segments for. */ @@ -231,7 +231,7 @@ class SettingsPiwik /** * Returns true if unique visitors should be processed for the given period type. - * + * * Unique visitor processing is controlled by the `[General] enable_processing_unique_visitors_...` * INI config options. By default, unique visitors are processed only for day/week/month periods. * diff --git a/core/SettingsServer.php b/core/SettingsServer.php index 679a00192d..6c172c3ecf 100644 --- a/core/SettingsServer.php +++ b/core/SettingsServer.php @@ -19,7 +19,7 @@ class SettingsServer * Returns true if the current script execution was triggered by the cron archiving script. * * Helpful for error handling: directly throw error without HTML (eg. when DB is down). - * + * * @return bool * @api */ @@ -102,7 +102,7 @@ class SettingsServer /** * Returns `true` if the GD PHP extension is available, `false` if otherwise. - * + * * _Note: ImageGraph and the sparkline report visualization depend on the GD extension._ * * @return bool diff --git a/core/Singleton.php b/core/Singleton.php index e2a0d60569..1dff87db5f 100644 --- a/core/Singleton.php +++ b/core/Singleton.php @@ -11,7 +11,7 @@ namespace Piwik; /** * The singleton base class restricts the instantiation of derived classes to one object only. - * + * * All plugin APIs are singletons and thus extend this class. * * @api diff --git a/core/Site.php b/core/Site.php index a0b728b035..7efeee77ef 100644 --- a/core/Site.php +++ b/core/Site.php @@ -15,27 +15,27 @@ use Piwik\Plugins\SitesManager\API; /** * Provides access to individual [site entity](/guides/persistence-and-the-mysql-backend#websites-aka-sites) data * (including name, URL, etc.). - * + * * **Data Cache** - * + * * Site data can be cached in order to avoid performing too many queries. * If a method needs many site entities, it is more efficient to query all of what * you need beforehand via the **SitesManager** API, then cache it using {@link setSites()} or * {@link setSitesFromArray()}. - * + * * Subsequent calls to `new Site($id)` will use the data in the cache instead of querying the database. - * + * * ### Examples - * + * * **Basic usage** - * + * * $site = new Site($idSite); * $name = $site->getName(); - * + * * **Without allocation** - * + * * $name = Site::getNameFor($idSite); - * + * * @api */ class Site @@ -54,7 +54,7 @@ class Site /** * Constructor. - * + * * @param int $idsite The ID of the site we want data for. */ public function __construct($idsite) @@ -71,7 +71,7 @@ class Site * individual site data. * * @param array $sites The array of sites data. Indexed by site ID. eg, - * + * * array('1' => array('name' => 'Site 1', ...), * '2' => array('name' => 'Site 2', ...))` */ @@ -100,17 +100,17 @@ class Site /** * Triggered so plugins can modify website entities without modifying the database. - * + * * This event should **not** be used to add data that is expensive to compute. If you * need to make HTTP requests or query the database for more information, this is not * the place to do it. * * **Example** - * + * * Piwik::addAction('Site.setSite', function ($idSite, &$info) { * $info['name'] .= " (original)"; * }); - * + * * @param int $idSite The ID of the website entity that will be modified. * @param array $infoSite The website entity. [Learn more.](/guides/persistence-and-the-mysql-backend#websites-aka-sites) */ @@ -121,9 +121,9 @@ class Site /** * Sets the cached Site data with a non-associated array of site data. - * + * * @param array $sites The array of sites data. eg, - * + * * array( * array('idsite' => '1', 'name' => 'Site 1', ...), * array('idsite' => '2', 'name' => 'Site 2', ...), @@ -172,9 +172,9 @@ class Site /** * Returns a string representation of the site this instance references. - * + * * Useful for debugging. - * + * * @return string */ public function __toString() @@ -223,7 +223,7 @@ class Site /** * Returns a site property by name. - * + * * @param string $name Name of the property to return (eg, `'main_url'` or `'name'`). * @return mixed * @throws Exception @@ -238,7 +238,7 @@ class Site /** * Returns the website type (by default `"website"`, which means it is a single website). - * + * * @return string */ public function getType() @@ -316,7 +316,7 @@ class Site /** * Returns the site search keyword query parameters for the site. - * + * * @return string * @throws Exception if data for the site cannot be found. */ @@ -327,7 +327,7 @@ class Site /** * Returns the site search category query parameters for the site. - * + * * @return string * @throws Exception if data for the site cannot be found. */ @@ -382,7 +382,7 @@ class Site /** * Clears the site data cache. - * + * * See also {@link setSites()} and {@link setSitesFromArray()}. */ public static function clearCache() diff --git a/core/TaskScheduler.php b/core/TaskScheduler.php index d2ddec3238..602c1987a6 100644 --- a/core/TaskScheduler.php +++ b/core/TaskScheduler.php @@ -17,17 +17,17 @@ define('DEBUG_FORCE_SCHEDULED_TASKS', false); /** * Manages scheduled task execution. - * + * * A scheduled task is a callback that should be executed every so often (such as daily, * weekly, monthly, etc.). They are registered with **TaskScheduler** through the * {@hook TaskScheduler.getScheduledTasks} event. - * + * * Tasks are executed when the cron core:archive command is executed. - * + * * ### Examples - * + * * **Scheduling a task** - * + * * // event handler for TaskScheduler.getScheduledTasks event * public function getScheduledTasks(&$tasks) * { @@ -39,14 +39,14 @@ define('DEBUG_FORCE_SCHEDULED_TASKS', false); * ScheduledTask::LOWEST_PRIORITY * ); * } - * + * * **Executing all pending tasks** - * + * * $results = TaskScheduler::runTasks(); * $task1Result = $results[0]; * $task1Name = $task1Result['task']; * $task1Output = $task1Result['output']; - * + * * echo "Executed task '$task1Name'. Task output:\n$task1Output"; * * @method static \Piwik\TaskScheduler getInstance() @@ -69,7 +69,7 @@ class TaskScheduler extends Singleton * * @return array An array describing the results of scheduled task execution. Each element * in the array will have the following format: - * + * * ``` * array( * 'task' => 'task name', @@ -157,10 +157,10 @@ class TaskScheduler extends Singleton /** * Determines a task's scheduled time and persists it, overwriting the previous scheduled time. - * + * * Call this method if your task's scheduled time has changed due to, for example, an option that * was changed. - * + * * @param ScheduledTask $task Describes the scheduled task being rescheduled. * @api */ @@ -171,7 +171,7 @@ class TaskScheduler extends Singleton /** * Returns true if the TaskScheduler is currently running a scheduled task. - * + * * @return bool */ public static function isTaskBeingExecuted() diff --git a/core/Tracker/Action.php b/core/Tracker/Action.php index d092622563..b3ca851f61 100644 --- a/core/Tracker/Action.php +++ b/core/Tracker/Action.php @@ -356,7 +356,7 @@ abstract class Action /** * Triggered after successfully persisting a [visit action entity](/guides/persistence-and-the-mysql-backend#visit-actions). - * + * * @param Action $tracker Action The Action tracker instance. * @param array $visitAction The visit action entity that was persisted. Read * [this](/guides/persistence-and-the-mysql-backend#visit-actions) to see what it contains. diff --git a/core/Tracker/Cache.php b/core/Tracker/Cache.php index 77f9d37689..0217b175de 100644 --- a/core/Tracker/Cache.php +++ b/core/Tracker/Cache.php @@ -65,22 +65,22 @@ class Cache Piwik::setUserHasSuperUserAccess(); $content = array(); - + /** * Triggered to get the attributes of a site entity that might be used by the * Tracker. - * + * * Plugins add new site attributes for use in other tracking events must * use this event to put those attributes in the Tracker Cache. - * + * * **Example** - * + * * public function getSiteAttributes($content, $idSite) * { * $sql = "SELECT info FROM " . Common::prefixTable('myplugin_extra_site_info') . " WHERE idsite = ?"; * $content['myplugin_site_data'] = Db::fetchOne($sql, array($idSite)); * } - * + * * @param array &$content Array mapping of site attribute names with values. * @param int $idSite The site ID to get attributes for. */ @@ -130,20 +130,20 @@ class Cache /** * Triggered before the [general tracker cache](/guides/all-about-tracking#the-tracker-cache) * is saved to disk. This event can be used to add extra content to the cache. - * + * * Data that is used during tracking but is expensive to compute/query should be * cached to keep tracking efficient. One example of such data are options * that are stored in the piwik_option table. Querying data for each tracking * request means an extra unnecessary database query for each visitor action. Using * a cache solves this problem. - * + * * **Example** - * + * * public function setTrackerCacheGeneral(&$cacheContent) * { * $cacheContent['MyPlugin.myCacheKey'] = Option::get('MyPlugin_myOption'); * } - * + * * @param array &$cacheContent Array of cached data. Each piece of data must be * mapped by name. */ diff --git a/core/Tracker/Db/Mysqli.php b/core/Tracker/Db/Mysqli.php index 66521b120b..2cd5e5f141 100644 --- a/core/Tracker/Db/Mysqli.php +++ b/core/Tracker/Db/Mysqli.php @@ -303,14 +303,14 @@ class Mysqli extends Db public function commit($xid) { - if($this->activeTransaction != $xid || $this->activeTransaction === false ) { - + if($this->activeTransaction != $xid || $this->activeTransaction === false ) { + return; } $this->activeTransaction = false; if(!$this->connection->commit() ) { - throw new DbException("Commit failed"); + throw new DbException("Commit failed"); } $this->connection->autocommit(true); } @@ -322,14 +322,14 @@ class Mysqli extends Db public function rollBack($xid) { - if($this->activeTransaction != $xid || $this->activeTransaction === false ) { + if($this->activeTransaction != $xid || $this->activeTransaction === false ) { return; } $this->activeTransaction = false; if(!$this->connection->rollback() ) { - throw new DbException("Rollback failed"); + throw new DbException("Rollback failed"); } - $this->connection->autocommit(true); + $this->connection->autocommit(true); } } diff --git a/core/Tracker/Db/Pdo/Mysql.php b/core/Tracker/Db/Pdo/Mysql.php index a4d148e415..a2f5a79b2c 100644 --- a/core/Tracker/Db/Pdo/Mysql.php +++ b/core/Tracker/Db/Pdo/Mysql.php @@ -267,7 +267,7 @@ class Mysql extends Db $this->activeTransaction = false; if(!$this->connection->commit() ) { - throw new DbException("Commit failed"); + throw new DbException("Commit failed"); } } @@ -284,7 +284,7 @@ class Mysql extends Db $this->activeTransaction = false; if(!$this->connection->rollBack() ) { - throw new DbException("Rollback failed"); + throw new DbException("Rollback failed"); } } } diff --git a/core/Tracker/GoalManager.php b/core/Tracker/GoalManager.php index 0b8f6be107..c7e55747d3 100644 --- a/core/Tracker/GoalManager.php +++ b/core/Tracker/GoalManager.php @@ -690,10 +690,10 @@ class GoalManager /** * Triggered after successfully recording a non-ecommerce conversion. - * + * * _Note: Subscribers should be wary of doing any expensive computation here as it may slow * the tracker down._ - * + * * @param array $conversion The conversion entity that was just persisted. See what information * it contains [here](/guides/persistence-and-the-mysql-backend#conversions). */ @@ -712,9 +712,9 @@ class GoalManager { /** * Triggered before persisting a new [conversion entity](/guides/persistence-and-the-mysql-backend#conversions). - * + * * This event can be used to modify conversion information or to add new information to be persisted. - * + * * @param array $conversion The conversion entity. Read [this](/guides/persistence-and-the-mysql-backend#conversions) * to see what it contains. * @param array $visitInformation The visit entity that we are tracking a conversion for. See what diff --git a/core/Tracker/Request.php b/core/Tracker/Request.php index ccd044320d..98057f6ccc 100644 --- a/core/Tracker/Request.php +++ b/core/Tracker/Request.php @@ -322,10 +322,10 @@ class Request /** * Triggered when obtaining the ID of the site we are tracking a visit for. - * + * * This event can be used to change the site ID so data is tracked for a different * website. - * + * * @param int &$idSite Initialized to the value of the **idsite** query parameter. If a * subscriber sets this variable, the value it uses must be greater * than 0. diff --git a/core/Tracker/Settings.php b/core/Tracker/Settings.php index 2d8299581d..836d03650a 100644 --- a/core/Tracker/Settings.php +++ b/core/Tracker/Settings.php @@ -101,7 +101,7 @@ class Settings // prevent the config hash from being the same, across different Piwik instances // (limits ability of different Piwik instances to cross-match users) $salt = SettingsPiwik::getSalt(); - + $configString = $os . $browserName . $browserVersion @@ -109,9 +109,9 @@ class Settings . $ip . $browserLang . $salt; - + $hash = md5($configString, $raw_output = true); - + return substr($hash, 0, Tracker::LENGTH_BINARY_ID); } -}
\ No newline at end of file +}
\ No newline at end of file diff --git a/core/Tracker/VisitInterface.php b/core/Tracker/VisitInterface.php index 66bd37becc..a7022072b8 100644 --- a/core/Tracker/VisitInterface.php +++ b/core/Tracker/VisitInterface.php @@ -11,13 +11,13 @@ namespace Piwik\Tracker; /** * Interface implemented by classes that track visit information for the Tracker. - * + * */ interface VisitInterface { /** * Stores the object describing the current tracking request. - * + * * @param Request $request * @return void */ @@ -25,7 +25,7 @@ interface VisitInterface /** * Tracks a visit. - * + * * @return void */ public function handle(); diff --git a/core/Translate.php b/core/Translate.php index c128fd672a..34bd35ba12 100644 --- a/core/Translate.php +++ b/core/Translate.php @@ -105,22 +105,22 @@ class Translate /** * Triggered when the current user's language is requested. - * + * * By default the current language is determined by the **language** query * parameter. Plugins can override this logic by subscribing to this event. - * + * * **Example** - * + * * public function getLanguage(&$lang) * { * $client = new My3rdPartyAPIClient(); * $thirdPartyLang = $client->getLanguageForUser(Piwik::getCurrentUserLogin()); - * + * * if (!empty($thirdPartyLang)) { * $lang = $thirdPartyLang; * } * } - * + * * @param string &$lang The language that should be used for the current user. Will be * initialized to the value of the **language** query parameter. */ @@ -190,19 +190,19 @@ class Translate /** * Triggered before generating the JavaScript code that allows i18n strings to be used * in the browser. - * + * * Plugins should subscribe to this event to specify which translations * should be available to JavaScript. * * Event handlers should add whole translation keys, ie, keys that include the plugin name. - * + * * **Example** * * public function getClientSideTranslationKeys(&$result) * { * $result[] = "MyPlugin_MyTranslation"; * } - * + * * @param array &$result The whole list of client side translation keys. */ Piwik::postEvent('Translate.getClientSideTranslationKeys', array(&$result)); diff --git a/core/Twig.php b/core/Twig.php index 7fa19ef247..b0707350c4 100755 --- a/core/Twig.php +++ b/core/Twig.php @@ -44,7 +44,7 @@ class Twig $manager = Plugin\Manager::getInstance(); $theme = $manager->getThemeEnabled(); $loaders = array(); - + //create loader for custom theme to overwrite twig templates if($theme && $theme->getPluginName() != \Piwik\Plugin\Manager::DEFAULT_THEME) { $customLoader = $this->getCustomThemeLoader($theme); @@ -56,7 +56,7 @@ class Twig } $loaders[] = $loader; - + $chainLoader = new Twig_Loader_Chain($loaders); // Create new Twig Environment and set cache dir diff --git a/core/Updates/0.9.1.php b/core/Updates/0.9.1.php index db81f8d14d..9d49a906e6 100644 --- a/core/Updates/0.9.1.php +++ b/core/Updates/0.9.1.php @@ -38,12 +38,12 @@ class Updates_0_9_1 extends Updates return array( 'UPDATE ' . Common::prefixTable('site') . ' - SET timezone = "UTC" + SET timezone = "UTC" WHERE timezone IN (' . $timezoneList . ')' => false, 'UPDATE `' . Common::prefixTable('option') . '` - SET option_value = "UTC" - WHERE option_name = "SitesManager_DefaultTimezone" + SET option_value = "UTC" + WHERE option_name = "SitesManager_DefaultTimezone" AND option_value IN (' . $timezoneList . ')' => false, ); } diff --git a/core/Updates/1.2-rc1.php b/core/Updates/1.2-rc1.php index 31d8ba58bc..e268ad8570 100644 --- a/core/Updates/1.2-rc1.php +++ b/core/Updates/1.2-rc1.php @@ -92,7 +92,7 @@ class Updates_1_2_rc1 extends Updates // Drop migrated fields 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` - DROP visitor_idcookie, + DROP visitor_idcookie, DROP config_md5config ' => 1091, 'ALTER TABLE `' . Common::prefixTable('log_conversion') . '` @@ -107,8 +107,8 @@ class Updates_1_2_rc1 extends Updates // Backfill action logs as best as we can 'UPDATE ' . Common::prefixTable('log_link_visit_action') . ' as action, ' . Common::prefixTable('log_visit') . ' as visit - SET action.idsite = visit.idsite, - action.server_time = visit.visit_last_action_time, + SET action.idsite = visit.idsite, + action.server_time = visit.visit_last_action_time, action.idvisitor = visit.idvisitor WHERE action.idvisit=visit.idvisit ' => false, diff --git a/core/Updates/1.5-b1.php b/core/Updates/1.5-b1.php index 9a8ed9653d..4157a8c115 100644 --- a/core/Updates/1.5-b1.php +++ b/core/Updates/1.5-b1.php @@ -27,14 +27,14 @@ class Updates_1_5_b1 extends Updates server_time DATETIME NOT NULL, idvisit INTEGER(10) UNSIGNED NOT NULL, idorder varchar(100) NOT NULL, - + idaction_sku INTEGER(10) UNSIGNED NOT NULL, idaction_name INTEGER(10) UNSIGNED NOT NULL, idaction_category INTEGER(10) UNSIGNED NOT NULL, price FLOAT NOT NULL, quantity INTEGER(10) UNSIGNED NOT NULL, deleted TINYINT(1) UNSIGNED NOT NULL, - + PRIMARY KEY(idvisit, idorder, idaction_sku), INDEX index_idsite_servertime ( idsite, server_time ) ) DEFAULT CHARSET=utf8 ' => 1050, diff --git a/core/Updates/1.8.4-b1.php b/core/Updates/1.8.4-b1.php index efd5e8b76c..272eb08498 100644 --- a/core/Updates/1.8.4-b1.php +++ b/core/Updates/1.8.4-b1.php @@ -78,7 +78,7 @@ class Updates_1_8_4_b1 extends Updates // grouping by name only would be case-insensitive, so we GROUP BY name,hash // ON (action.type = 1 AND canonical.hash = action.hash) will use index (type, hash) " INSERT INTO `$duplicates` ( - SELECT + SELECT action.idaction AS `before`, canonical.idaction AS `after` FROM diff --git a/core/Url.php b/core/Url.php index dfbf2dfd88..bf1e267e10 100644 --- a/core/Url.php +++ b/core/Url.php @@ -12,16 +12,16 @@ use Exception; /** * Provides URL related helper methods. - * + * * This class provides simple methods that can be used to parse and modify * the current URL. It is most useful when plugins need to redirect the current * request to a URL and when they need to link to other parts of Piwik in * HTML. - * + * * ### Examples - * + * * **Redirect to a different controller action** - * + * * public function myControllerAction() * { * $url = Url::getCurrentQueryStringWithParametersModified(array( @@ -30,9 +30,9 @@ use Exception; * )); * Url::redirectToUrl($url); * } - * + * * **Link to a different controller action in a template** - * + * * public function myControllerAction() * { * $url = Url::getCurrentQueryStringWithParametersModified(array( @@ -45,7 +45,7 @@ use Exception; * $view->realtimeMapUrl = $url; * return $view->render(); * } - * + * */ class Url { @@ -70,7 +70,7 @@ class Url /** * Returns the current URL without the query string. - * + * * @param bool $checkTrustedHost Whether to do trusted host check. Should ALWAYS be true, * except in {@link Piwik\Plugin\Controller}. * @return string eg, `"http://example.org/dir1/dir2/index.php"` if the current URL is @@ -306,7 +306,7 @@ class Url /** * Sets the host. Useful for CLI scripts, eg. core:archive command - * + * * @param $host string */ public static function setHost($host) @@ -367,7 +367,7 @@ class Url * * @return array If current URL is `"http://example.org/dir1/dir2/index.php?param1=value1¶m2=value2"` * this will return: - * + * * array( * 'param1' => string 'value1', * 'param2' => string 'value2' @@ -408,7 +408,7 @@ class Url /** * Converts an array of parameters name => value mappings to a query * string. - * + * * @param array $parameters eg. `array('param1' => 10, 'param2' => array(1,2))` * @return string eg. `"param1=10¶m2[]=1¶m2[]=2"` * @api @@ -440,7 +440,7 @@ class Url /** * Redirects the user to the referrer. If no referrer exists, the user is redirected * to the current URL without query string. - * + * * @api */ public static function redirectToReferrer() diff --git a/core/UrlHelper.php b/core/UrlHelper.php index 9262ec392d..485b5ec7bf 100644 --- a/core/UrlHelper.php +++ b/core/UrlHelper.php @@ -10,7 +10,7 @@ namespace Piwik; /** * Contains less commonly needed URL helper methods. - * + * */ class UrlHelper { @@ -108,9 +108,9 @@ class UrlHelper /** * Returns a URL created from the result of the [parse_url](http://php.net/manual/en/function.parse-url.php) * function. - * + * * Copied from the PHP comments at [http://php.net/parse_url](http://php.net/parse_url). - * + * * @param array $parsed Result of [parse_url](http://php.net/manual/en/function.parse-url.php). * @return false|string The URL or `false` if `$parsed` isn't an array. * @api diff --git a/core/View.php b/core/View.php index e7207d7beb..d9cbfe0b9c 100644 --- a/core/View.php +++ b/core/View.php @@ -27,7 +27,7 @@ if (!defined('PIWIK_USER_PATH')) { * View lets you set properties that will be passed on to a Twig template. * View will also set several properties that will be available in all Twig * templates, including: - * + * * - **currentModule**: The value of the **module** query parameter. * - **currentAction**: The value of the **action** query parameter. * - **userLogin**: The current user login name. @@ -43,29 +43,29 @@ if (!defined('PIWIK_USER_PATH')) { * - **show_autocompleter**: Whether the site selector should be shown or not. * - **loginModule**: The name of the currently used authentication module. * - **userAlias**: The alias of the current user. - * + * * ### Template Naming Convention - * + * * Template files should be named after the controller method they are used in. * If they are used in more than one controller method or are included by another * template, they should describe the output they generate and be prefixed with * an underscore, eg, **_dataTable.twig**. - * + * * ### Twig - * + * * Twig templates must exist in the **templates** folder in a plugin's root * folder. - * + * * The following filters are available to twig templates: - * + * * - **translate**: Outputs internationalized text using a translation token, eg, * `{{ 'General_Date'|translate }}`. sprintf parameters can be passed * to the filter. * - **urlRewriteWithParameters**: Modifies the current query string with the given * set of parameters, eg, - * + * * {{ {'module':'MyPlugin', 'action':'index'} | urlRewriteWithParameters }} - * + * * - **sumTime**: Pretty formats an number of seconds. * - **money**: Formats a numerical value as a monetary value using the currency * of the supplied site (second arg is site ID). @@ -74,9 +74,9 @@ if (!defined('PIWIK_USER_PATH')) { * eg, `{{ myReallyLongText|truncate(80) }}` * - **implode**: Calls `implode`. * - **ucwords**: Calls `ucwords`. - * + * * The following functions are available to twig templates: - * + * * - **linkTo**: Modifies the current query string with the given set of parameters, * eg `{{ linkTo({'module':'MyPlugin', 'action':'index'}) }}`. * - **sparkline**: Outputs a sparkline image HTML element using the sparkline image @@ -85,11 +85,11 @@ if (!defined('PIWIK_USER_PATH')) { * which is outputted in the template, eg, `{{ postEvent('MyPlugin.event') }}` * - **isPluginLoaded**: Returns true if the supplied plugin is loaded, false if otherwise. * `{% if isPluginLoaded('Goals') %}...{% endif %}` - * + * * ### Examples - * + * * **Basic usage** - * + * * // a controller method * public function myView() * { @@ -98,7 +98,7 @@ if (!defined('PIWIK_USER_PATH')) { * $view->property2 = "another view property"; * return $view->render(); * } - * + * * * @api */ @@ -117,7 +117,7 @@ class View implements ViewInterface /** * Constructor. - * + * * @param string $templateFile The template file to load. Must be in the following format: * `"@MyPlugin/templateFileName"`. Note the absence of .twig * from the end of the name. @@ -286,7 +286,7 @@ class View implements ViewInterface /** * Set stored value used in the Content-Type HTTP header field. The header is * set just before rendering. - * + * * @param string $contentType */ public function setContentType($contentType) @@ -297,7 +297,7 @@ class View implements ViewInterface /** * Set X-Frame-Options field in the HTTP response. The header is set just * before rendering. - * + * * _Note: setting this allows you to make sure the View **cannot** be * embedded in iframes. Learn more [here](https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options)._ * @@ -356,7 +356,7 @@ class View implements ViewInterface /** * Creates a View for and then renders the single report template. - * + * * Can be used for pages that display only one report to avoid having to create * a new template. * diff --git a/core/View/RenderTokenParser.php b/core/View/RenderTokenParser.php index 60547d4d99..2800beab8b 100644 --- a/core/View/RenderTokenParser.php +++ b/core/View/RenderTokenParser.php @@ -41,7 +41,7 @@ class RenderTokenParser extends Twig_TokenParser $variablesOverride = new Twig_Node_Expression_Array(array(), $token->getLine()); if ($stream->test(Twig_Token::NAME_TYPE, 'with')) { $stream->next(); - + $variablesOverride->addElement($this->parser->getExpressionParser()->parseExpression()); } diff --git a/core/View/ReportsByDimension.php b/core/View/ReportsByDimension.php index e520f382f9..e1cb058459 100644 --- a/core/View/ReportsByDimension.php +++ b/core/View/ReportsByDimension.php @@ -90,10 +90,10 @@ class ReportsByDimension extends View { /** * Triggered before rendering {@link ReportsByDimension} views. - * + * * Plugins can use this event to configure {@link ReportsByDimension} instances by * adding or removing reports to display. - * + * * @param ReportsByDimension $this The view instance. */ Piwik::postEvent('View.ReportsByDimension.render', array($this)); diff --git a/core/ViewDataTable/Config.php b/core/ViewDataTable/Config.php index 8fbdf85321..093f28b254 100644 --- a/core/ViewDataTable/Config.php +++ b/core/ViewDataTable/Config.php @@ -15,45 +15,45 @@ use Piwik\Plugins\API\API; /** * Contains base display properties for {@link Piwik\Plugin\ViewDataTable}s. Manipulating these * properties in a ViewDataTable instance will change how its report will be displayed. - * + * * <a name="client-side-properties-desc"></a> * **Client Side Properties** - * + * * Client side properties are properties that should be passed on to the browser so * client side JavaScript can use them. Only affects ViewDataTables that output HTML. * * <a name="overridable-properties-desc"></a> * **Overridable Properties** - * + * * Overridable properties are properties that can be set via the query string. * If a request has a query parameter that matches an overridable property, the property * will be set to the query parameter value. - * + * * **Reusing base properties** - * + * * Many of the properties in this class only have meaning for the {@link Piwik\Plugin\Visualization} - * class, but can be set for other visualizations that extend {@link Piwik\Plugin\ViewDataTable} + * class, but can be set for other visualizations that extend {@link Piwik\Plugin\ViewDataTable} * directly. - * + * * Visualizations that extend {@link Piwik\Plugin\ViewDataTable} directly and want to re-use these * properties must make sure the properties are used in the exact same way they are used in * {@link Piwik\Plugin\Visualization}. - * + * * **Defining new display properties** - * + * * If you are creating your own visualization and want to add new display properties for * it, extend this class and add your properties as fields. - * + * * Properties are marked as client side properties by calling the * {@link addPropertiesThatShouldBeAvailableClientSide()} method. - * + * * Properties are marked as overridable by calling the * {@link addPropertiesThatCanBeOverwrittenByQueryParams()} method. - * + * * ### Example - * + * * **Defining new display properties** - * + * * class MyCustomVizConfig extends Config * { * /** @@ -65,11 +65,11 @@ use Piwik\Plugins\API\API; * * Another custom property. It is available client side. * *\/ * public $another_custom_property = true; - * + * * public function __construct() * { * parent::__construct(); - * + * * $this->addPropertiesThatShouldBeAvailableClientSide(array('another_custom_property')); * $this->addPropertiesThatCanBeOverwrittenByQueryParams(array('my_custom_property')); * } @@ -469,7 +469,7 @@ class Config /** * Marks display properties as client side properties. [Read this](#client-side-properties-desc) * to learn more. - * + * * @param array $propertyNames List of property names, eg, `array('show_limit_control', 'show_goals')`. */ public function addPropertiesThatShouldBeAvailableClientSide(array $propertyNames) @@ -482,7 +482,7 @@ class Config /** * Marks display properties as overridable. [Read this](#overridable-properties-desc) to * learn more. - * + * * @param array $propertyNames List of property names, eg, `array('show_limit_control', 'show_goals')`. */ public function addPropertiesThatCanBeOverwrittenByQueryParams(array $propertyNames) @@ -495,7 +495,7 @@ class Config /** * Returns array of all property values in this config object. Property values are mapped * by name. - * + * * @return array eg, `array('show_limit_control' => 0, 'show_goals' => 1, ...)` */ public function getProperties() @@ -555,7 +555,7 @@ class Config * Adds a related report to the {@link $related_reports} property. If the report * references the one that is currently being displayed, it will not be added to the related * report list. - * + * * @param string $relatedReport The plugin and method of the report, eg, `'UserSettings.getBrowser'`. * @param string $title The report's display name, eg, `'Browsers'`. * @param array $queryParams Any extra query parameters to set in releated report's URL, eg, @@ -582,10 +582,10 @@ class Config * Adds several related reports to the {@link $related_reports} property. If * any of the reports references the report that is currently being displayed, it will not * be added to the list. All other reports will still be added though. - * + * * If you need to make sure the related report URL has some extra query parameters, * use {@link addRelatedReport()}. - * + * * @param array $relatedReports Array mapping report IDs with their internationalized display * titles, eg, * ``` @@ -604,9 +604,9 @@ class Config /** * Associates internationalized text with a metric. Overwrites existing mappings. - * + * * See {@link $translations}. - * + * * @param string $columnName The name of a column in the report data, eg, `'nb_visits'` or * `'goal_1_nb_conversions'`. * @param string $translation The internationalized text, eg, `'Visits'` or `"Conversions for 'My Goal'"`. @@ -618,9 +618,9 @@ class Config /** * Associates multiple translations with metrics. - * + * * See {@link $translations} and {@link addTranslation()}. - * + * * @param array $translations An array of column name => text mappings, eg, * ``` * array( diff --git a/core/ViewDataTable/Factory.php b/core/ViewDataTable/Factory.php index 52c74933d1..9ac90a1723 100644 --- a/core/ViewDataTable/Factory.php +++ b/core/ViewDataTable/Factory.php @@ -17,9 +17,9 @@ use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable; * Provides a means of creating {@link Piwik\Plugin\ViewDataTable} instances by ID. * * ### Examples - * + * * **Creating a ViewDataTable for a report** - * + * * // method in MyPlugin\Controller * public function myReport() * { @@ -28,9 +28,9 @@ use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable; * $view->config->translations['myFancyMetric'] = "My Fancy Metric"; * return $view->render(); * } - * + * * **Displaying a report in another way** - * + * * // method in MyPlugin\Controller * // use the same data that's used in myReport() above, but transform it in some way before * // displaying. @@ -40,9 +40,9 @@ use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable; * $view->config->filters[] = array('MyMagicFilter', array('an arg', 'another arg')); * return $view->render(); * } - * + * * **Force a report to be shown as a bar graph** - * + * * // method in MyPlugin\Controller * // force the myReport report to show as a bar graph if there is no viewDataTable query param, * // even though it is configured to show as a table. @@ -52,7 +52,7 @@ use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable; * $forceDefault = true); * return $view->render(); * } - * + * * * @api */ diff --git a/core/ViewDataTable/Manager.php b/core/ViewDataTable/Manager.php index 0559661d44..19e2335ce1 100644 --- a/core/ViewDataTable/Manager.php +++ b/core/ViewDataTable/Manager.php @@ -70,17 +70,17 @@ class Manager /** * Triggered when gathering all available DataTable visualizations. - * + * * Plugins that want to expose new DataTable visualizations should subscribe to * this event and add visualization class names to the incoming array. - * + * * **Example** - * + * * public function addViewDataTable(&$visualizations) * { * $visualizations[] = 'Piwik\\Plugins\\MyPlugin\\MyVisualization'; * } - * + * * @param array &$visualizations The array of all available visualizations. * @ignore * @deprecated since 2.5.0 Place visualization in a "Visualizations" directory instead. diff --git a/core/ViewDataTable/RequestConfig.php b/core/ViewDataTable/RequestConfig.php index d4856bebe4..ad77df8824 100644 --- a/core/ViewDataTable/RequestConfig.php +++ b/core/ViewDataTable/RequestConfig.php @@ -13,48 +13,48 @@ use Piwik\Common; /** * Contains base request properties for {@link Piwik\Plugin\ViewDataTable} instances. Manipulating * these properties will change the way a {@link Piwik\Plugin\ViewDataTable} loads report data. - * + * * <a name="client-side-parameters-desc"></a> * **Client Side Parameters** - * + * * Client side parameters are request properties that should be passed on to the browser so * client side JavaScript can use them. These properties will also be passed to the server with * every AJAX request made. - * + * * Only affects ViewDataTables that output HTML. - * + * * <a name="overridable-properties-desc"></a> * **Overridable Properties** * * Overridable properties are properties that can be set via the query string. * If a request has a query parameter that matches an overridable property, the property * will be set to the query parameter value. - * + * * **Reusing base properties** - * + * * Many of the properties in this class only have meaning for the {@link Piwik\Plugin\Visualization} - * class, but can be set for other visualizations that extend {@link Piwik\Plugin\ViewDataTable} + * class, but can be set for other visualizations that extend {@link Piwik\Plugin\ViewDataTable} * directly. - * + * * Visualizations that extend {@link Piwik\Plugin\ViewDataTable} directly and want to re-use these * properties must make sure the properties are used in the exact same way they are used in * {@link Piwik\Plugin\Visualization}. - * + * * **Defining new request properties** - * + * * If you are creating your own visualization and want to add new request properties for * it, extend this class and add your properties as fields. - * + * * Properties are marked as client side parameters by calling the * {@link addPropertiesThatShouldBeAvailableClientSide()} method. - * + * * Properties are marked as overridable by calling the * {@link addPropertiesThatCanBeOverwrittenByQueryParams()} method. * * ### Example - * + * * **Defining new request properties** - * + * * class MyCustomVizRequestConfig extends RequestConfig * { * /** @@ -66,16 +66,16 @@ use Piwik\Common; * * Another custom property. It is available client side. * *\/ * public $another_custom_property = true; - * + * * public function __construct() * { * parent::__construct(); - * + * * $this->addPropertiesThatShouldBeAvailableClientSide(array('another_custom_property')); * $this->addPropertiesThatCanBeOverwrittenByQueryParams(array('my_custom_property')); * } * } - * + * * @api */ class RequestConfig @@ -240,7 +240,7 @@ class RequestConfig /** * Marks request properties as client side properties. [Read this](#client-side-properties-desc) * to learn more. - * + * * @param array $propertyNames List of property names, eg, `array('disable_queued_filters', 'filter_column')`. */ public function addPropertiesThatShouldBeAvailableClientSide(array $propertyNames) @@ -253,7 +253,7 @@ class RequestConfig /** * Marks display properties as overridable. [Read this](#overridable-properties-desc) to * learn more. - * + * * @param array $propertyNames List of property names, eg, `array('disable_queued_filters', 'filter_column')`. */ public function addPropertiesThatCanBeOverwrittenByQueryParams(array $propertyNames) diff --git a/core/WidgetsList.php b/core/WidgetsList.php index d9ae1f4eb6..e67f6b1b77 100644 --- a/core/WidgetsList.php +++ b/core/WidgetsList.php @@ -14,10 +14,10 @@ use Piwik\Plugin\Widgets; /** * Manages the global list of reports that can be displayed as dashboard widgets. - * + * * Reports are added as dashboard widgets through the {@hook WidgetsList.addWidgets} * event. Observers for this event should call the {@link add()} method to add reports. - * + * * @api * @method static \Piwik\WidgetsList getInstance() */ @@ -198,9 +198,9 @@ class WidgetsList extends Singleton /** * Removes one or more widgets from the widget list. - * + * * @param string $widgetCategory The widget category. Can be a translation token. - * @param string|false $widgetName The name of the widget to remove. Cannot be a + * @param string|false $widgetName The name of the widget to remove. Cannot be a * translation token. If not supplied, the entire category * will be removed. */ diff --git a/core/testMinimumPhpVersion.php b/core/testMinimumPhpVersion.php index 7f03b02479..1be348e570 100644 --- a/core/testMinimumPhpVersion.php +++ b/core/testMinimumPhpVersion.php @@ -22,7 +22,7 @@ $minimumPhpInvalid = version_compare($piwik_minimumPHPVersion, $piwik_currentPHP if ($minimumPhpInvalid) { $piwik_errorMessage .= "<p><strong>To run Piwik you need at least PHP version $piwik_minimumPHPVersion</strong></p> <p>Unfortunately it seems your webserver is using PHP version $piwik_currentPHPVersion. </p> - <p>Please try to update your PHP version, Piwik is really worth it! Nowadays most web hosts + <p>Please try to update your PHP version, Piwik is really worth it! Nowadays most web hosts support PHP $piwik_minimumPHPVersion.</p> <p>Also see the FAQ: <a href='http://piwik.org/faq/how-to-install/#faq_77'>My Web host supports PHP4 by default. How can I enable PHP5?</a></p>"; } else { |