diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-10-08 09:24:28 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2013-10-08 09:24:28 +0400 |
commit | 1fa8da9b963e99e08c829fe6491e8ccf2d1054e2 (patch) | |
tree | 137c50850a5f21f1651f8066d4bd381a661e1987 | |
parent | fcbef99dbf93df94ff5ed4cfaa5eeebfcf4aac14 (diff) |
Applying phpstorm code style PSR refs #3771
170 files changed, 1199 insertions, 1181 deletions
diff --git a/core/API/DataTableManipulator.php b/core/API/DataTableManipulator.php index 1c5d81768d..cfaa49e63d 100644 --- a/core/API/DataTableManipulator.php +++ b/core/API/DataTableManipulator.php @@ -76,7 +76,7 @@ abstract class DataTableManipulator /** * Manipulates child DataTables of a DataTable\Map. See @manipulate for more info. * - * @param DataTable\Map $dataTable + * @param DataTable\Map $dataTable * @return DataTable\Map */ protected function manipulateDataTableMap($dataTable) @@ -127,7 +127,7 @@ abstract class DataTableManipulator } } - $class = Request::getClassNameAPI( $this->apiModule ); + $class = Request::getClassNameAPI($this->apiModule); $method = $this->getApiMethodForSubtable(); $this->manipulateSubtableRequest($request); diff --git a/core/API/DataTableManipulator/LabelFilter.php b/core/API/DataTableManipulator/LabelFilter.php index 9faa82e7a9..c53b2fa44f 100644 --- a/core/API/DataTableManipulator/LabelFilter.php +++ b/core/API/DataTableManipulator/LabelFilter.php @@ -42,8 +42,8 @@ class LabelFilter extends DataTableManipulator * for the recursive search. If the label is not recursive, these parameters * are not needed. * - * @param string $labels the labels to search for - * @param DataTable $dataTable the data table to be filtered + * @param string $labels the labels to search for + * @param DataTable $dataTable the data table to be filtered * @param bool $addLabelIndex Whether to add label_index metadata describing which * label a row corresponds to. * @return DataTable diff --git a/core/API/DocumentationGenerator.php b/core/API/DocumentationGenerator.php index 84f976451d..2a471fd388 100644 --- a/core/API/DocumentationGenerator.php +++ b/core/API/DocumentationGenerator.php @@ -11,8 +11,8 @@ namespace Piwik\API; use Exception; -use Piwik\Common; +use Piwik\Common; use Piwik\Piwik; use Piwik\PluginsManager; use Piwik\Url; @@ -120,9 +120,9 @@ class DocumentationGenerator * It will export links to XML, CSV, HTML, JSON, PHP, etc. * It will not export links for methods such as deleteSite or deleteUser * - * @param string $class the class - * @param string $methodName the method - * @param array $parametersToSet parameters to set + * @param string $class the class + * @param string $methodName the method + * @param array $parametersToSet parameters to set * @return string|bool when not possible */ public function getExampleUrl($class, $methodName, $parametersToSet = array()) @@ -213,8 +213,8 @@ class DocumentationGenerator /** * Returns the methods $class.$name parameters (and default value if provided) as a string. * - * @param string $class The class name - * @param string $name The method name + * @param string $class The class name + * @param string $name The method name * @return string For example "(idSite, period, date = 'today')" */ public function getParametersString($class, $name) diff --git a/core/API/Proxy.php b/core/API/Proxy.php index 0a661eb30c..759f466437 100644 --- a/core/API/Proxy.php +++ b/core/API/Proxy.php @@ -10,6 +10,7 @@ */ namespace Piwik\API; + use Exception; use Piwik\Common; use ReflectionClass; @@ -86,7 +87,7 @@ class Proxy * * The method will introspect the methods, their parameters, etc. * - * @param string $className ModuleName eg. "API" + * @param string $className ModuleName eg. "API" */ public function registerClass($className) { @@ -108,8 +109,8 @@ class Proxy /** * Will be displayed in the API page * - * @param ReflectionClass $rClass Instance of ReflectionClass - * @param string $className Name of the class + * @param ReflectionClass $rClass Instance of ReflectionClass + * @param string $className Name of the class */ private function setDocumentation($rClass, $className) { @@ -144,9 +145,9 @@ class Proxy * It also logs the API calls, with the parameters values, the returned value, the performance, etc. * You can enable logging in config/global.ini.php (log_api_call) * - * @param string $className The class name (eg. API) - * @param string $methodName The method name - * @param array $parametersRequest The parameters pairs (name=>value) + * @param string $className The class name (eg. API) + * @param string $methodName The method name + * @param array $parametersRequest The parameters pairs (name=>value) * * @return mixed|null * @throws Exception|\Piwik\NoAccessException @@ -256,8 +257,8 @@ class Proxy * Returns the parameters names and default values for the method $name * of the class $class * - * @param string $class The class name - * @param string $name The method name + * @param string $class The class name + * @param string $name The method name * @return array Format array( * 'testParameter' => null, // no default value * 'life' => 42, // default value = 42 @@ -272,7 +273,7 @@ class Proxy /** * Returns the 'moduleName' part of 'Piwik_moduleName_API' classname * - * @param string $className "API" + * @param string $className "API" * @return string "Referrers" */ public function getModuleNameFromClassName($className) @@ -297,7 +298,7 @@ class Proxy /** * Returns an array containing the values of the parameters to pass to the method to call * - * @param array $requiredParameters array of (parameter name, default value) + * @param array $requiredParameters array of (parameter name, default value) * @param array $parametersRequest * @throws Exception * @return array values to pass to the function call @@ -340,7 +341,7 @@ class Proxy /** * Includes the class API by looking up plugins/UserSettings/API.php * - * @param string $fileName api class name eg. "API" + * @param string $fileName api class name eg. "API" * @throws Exception */ private function includeApiFile($fileName) @@ -356,8 +357,8 @@ class Proxy } /** - * @param string $class name of a class - * @param ReflectionMethod $method instance of ReflectionMethod + * @param string $class name of a class + * @param ReflectionMethod $method instance of ReflectionMethod */ private function loadMethodMetadata($class, $method) { @@ -389,8 +390,8 @@ class Proxy /** * Checks that the method exists in the class * - * @param string $className The class name - * @param string $methodName The method name + * @param string $className The class name + * @param string $methodName The method name * @throws Exception If the method is not found */ private function checkMethodExists($className, $methodName) @@ -403,8 +404,8 @@ class Proxy /** * Returns the number of required parameters (parameters without default values). * - * @param string $class The class name - * @param string $name The method name + * @param string $class The class name + * @param string $name The method name * @return int The number of required parameters */ private function getNumberOfRequiredParameters($class, $name) @@ -415,8 +416,8 @@ class Proxy /** * Returns true if the method is found in the API of the given class name. * - * @param string $className The class name - * @param string $methodName The method name + * @param string $className The class name + * @param string $methodName The method name * @return bool */ private function isMethodAvailable($className, $methodName) @@ -427,7 +428,7 @@ class Proxy /** * Checks that the class is a Singleton (presence of the getInstance() method) * - * @param string $className The class name + * @param string $className The class name * @throws Exception If the class is not a Singleton */ private function checkClassIsSingleton($className) diff --git a/core/API/Request.php b/core/API/Request.php index d9b470beff..5cb9a7c9ac 100644 --- a/core/API/Request.php +++ b/core/API/Request.php @@ -96,7 +96,7 @@ class Request /** * Constructs the request to the API, given the request url * - * @param string $request GET request that defines the API call (must at least contain a "method" parameter) + * @param string $request GET request that defines the API call (must at least contain a "method" parameter) * Example: method=UserSettings.getWideScreen&idSite=1&date=yesterday&period=week&format=xml * If a request is not provided, then we use the $_GET and $_POST superglobal and fetch * the values directly from the HTTP GET query. @@ -173,7 +173,7 @@ class Request * the current session will be authenticated using this token_auth. * It will overwrite the previous Auth object. * - * @param array $request If null, uses the default request ($_GET) + * @param array $request If null, uses the default request ($_GET) * @return void */ static public function reloadAuthUsingTokenAuth($request = null) @@ -274,7 +274,7 @@ class Request $segment = Common::getRequestVar('segment', '', 'string'); if (!empty($segment)) { $request = Request::getRequestParametersGET(); - if(!empty($request['segment'])) { + if (!empty($request['segment'])) { $segmentRaw = $request['segment']; } } diff --git a/core/API/ResponseBuilder.php b/core/API/ResponseBuilder.php index bf8f9f16fc..88faadcebe 100644 --- a/core/API/ResponseBuilder.php +++ b/core/API/ResponseBuilder.php @@ -11,8 +11,8 @@ namespace Piwik\API; use Exception; -use Piwik\API\DataTableManipulator\Flattener; +use Piwik\API\DataTableManipulator\Flattener; use Piwik\API\DataTableManipulator\LabelFilter; use Piwik\Common; use Piwik\DataTable\Renderer\Json; @@ -67,9 +67,9 @@ class ResponseBuilder * * - If an integer / float is returned, we simply return it * - * @param mixed $value The initial returned value, before post process. If set to null, success response is returned. - * @param bool|string $apiModule The API module that was called - * @param bool|string $apiMethod The API method that was called + * @param mixed $value The initial returned value, before post process. If set to null, success response is returned. + * @param bool|string $apiModule The API module that was called + * @param bool|string $apiMethod The API method that was called * @return mixed Usually a string, but can still be a PHP data structure if the format requested is 'original' */ public function getResponse($value = null, $apiModule = false, $apiMethod = false) @@ -170,7 +170,7 @@ class ResponseBuilder /** * Returns true if the user requested to serialize the output data (&serialize=1 in the request) * - * @param mixed $defaultSerializeValue Default value in case the user hasn't specified a value + * @param mixed $defaultSerializeValue Default value in case the user hasn't specified a value * @return bool */ protected function caseRendererPHPSerialize($defaultSerializeValue = 1) @@ -242,9 +242,9 @@ class ResponseBuilder @header("Content-Type: text/xml;charset=utf-8"); $return = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" . - "<result>\n" . - "\t<success message=\"" . $message . "\" />\n" . - "</result>"; + "<result>\n" . + "\t<success message=\"" . $message . "\" />\n" . + "</result>"; break; case 'json': @header("Content-Type: application/json"); @@ -426,7 +426,7 @@ class ResponseBuilder * ), * ); * - * @param array $array can contain scalar, arrays, DataTable and Set + * @param array $array can contain scalar, arrays, DataTable and Set * @return string */ public static function convertMultiDimensionalArrayToJson($array) diff --git a/core/Access.php b/core/Access.php index 2f2d369185..e4414500ae 100644 --- a/core/Access.php +++ b/core/Access.php @@ -40,7 +40,7 @@ use Piwik\Db; class Access { private static $instance = null; - + /** * Gets the singleton instance. Creates it if necessary. */ @@ -48,12 +48,12 @@ class Access { if (self::$instance == null) { self::$instance = new self; - + Piwik_PostTestEvent('Access.createAccessSingleton', array(self::$instance)); } return self::$instance; } - + /** * Sets the singleton instance. For testing purposes. */ @@ -61,7 +61,7 @@ class Access { self::$instance = $instance; } - + /** * Array of idsites available to the current user, indexed by permission level * @see getSitesIdWith*() @@ -138,7 +138,7 @@ class Access * If the login/password is correct the user is either the SuperUser or a normal user. * We load the access levels for this user for all the websites. * - * @param null|Auth $auth Auth adapter + * @param null|Auth $auth Auth adapter * @return bool true on success, false if reloading access failed (when auth object wasn't specified and user is not enforced to be Super User) */ public function reloadAccess(Auth $auth = null) @@ -188,7 +188,7 @@ class Access /** * Returns the SQL query joining sites and access table for a given login * - * @param string $select Columns or expression to SELECT FROM table, eg. "MIN(ts_created)" + * @param string $select Columns or expression to SELECT FROM table, eg. "MIN(ts_created)" * @return string SQL query */ public static function getSqlAccessSite($select) @@ -196,7 +196,7 @@ class Access return "SELECT " . $select . " FROM " . Common::prefixTable('access') . " as t1 JOIN " . Common::prefixTable('site') . " as t2 USING (idsite) " . - " WHERE login = ?"; + " WHERE login = ?"; } /** @@ -207,17 +207,17 @@ class Access protected function reloadAccessSuperUser() { $this->isSuperUser = true; - + try { $allSitesId = Plugins\SitesManager\API::getInstance()->getAllSitesId(); - } catch(\Exception $e) { + } catch (\Exception $e) { $allSitesId = array(); } $this->idsitesByAccess['superuser'] = $allSitesId; $this->login = Config::getInstance()->superuser['login']; Piwik_PostTestEvent('Access.loadingSuperUserAccess', array(&$this->idsitesByAccess, &$this->login)); - + return true; } @@ -266,10 +266,10 @@ class Access { return $this->token_auth; } - + /** * Returns the super user's login. - * + * * @return string */ public function getSuperUserLogin() @@ -369,7 +369,7 @@ class Access * This method checks that the user has ADMIN access for the given list of websites. * If the user doesn't have ADMIN access for at least one website of the list, we throw an exception. * - * @param int|array $idSites List of ID sites to check + * @param int|array $idSites List of ID sites to check * @throws \Piwik\NoAccessException If for any of the websites the user doesn't have an ADMIN access */ public function checkUserHasAdminAccess($idSites) @@ -390,7 +390,7 @@ class Access * This method checks that the user has VIEW or ADMIN access for the given list of websites. * If the user doesn't have VIEW or ADMIN access for at least one website of the list, we throw an exception. * - * @param int|array|string $idSites List of ID sites to check (integer, array of integers, string comma separated list of integers) + * @param int|array|string $idSites List of ID sites to check (integer, array of integers, string comma separated list of integers) * @throws \Piwik\NoAccessException If for any of the websites the user doesn't have an VIEW or ADMIN access */ public function checkUserHasViewAccess($idSites) diff --git a/core/Archive.php b/core/Archive.php index b29aef2731..5e09d1be2f 100644 --- a/core/Archive.php +++ b/core/Archive.php @@ -9,10 +9,11 @@ * @package Piwik */ namespace Piwik; + use Piwik\Archive\Parameters; use Piwik\ArchiveProcessor\Rules; -use Piwik\DataAccess\ArchiveSelector; +use Piwik\DataAccess\ArchiveSelector; use Piwik\Period\Range; /** @@ -284,12 +285,12 @@ class Archive * Optionally loads the table recursively, * or optionally fetches a given subtable with $idSubtable * - * @param string $name - * @param int $idSite - * @param string $period - * @param Date $date - * @param string $segment - * @param bool $expanded + * @param string $name + * @param int $idSite + * @param string $period + * @param Date $date + * @param string $segment + * @param bool $expanded * @param int|null $idSubtable * @param int|null $depth * @@ -363,7 +364,7 @@ class Archive $value = $this->uncompress($row['value']); $result->addMetadata($idSite, $periodStr, 'ts_archived', $row['ts_archived']); } - + $resultRow = & $result->get($idSite, $periodStr); $resultRow[$row['name']] = $value; } diff --git a/core/Archive/DataCollection.php b/core/Archive/DataCollection.php index c514702488..29b4dab96e 100644 --- a/core/Archive/DataCollection.php +++ b/core/Archive/DataCollection.php @@ -283,7 +283,7 @@ class DataCollection * Creates an empty index using a list of metadata names. If the 'site' and/or * 'period' metadata names are supplied, empty rows are added for every site/period * that was queried for. - * + * * Using this function ensures consistent ordering in the indexed result. * * @param array $metadataNamesToIndexBy List of metadata names to index archive data by. @@ -315,7 +315,7 @@ class DataCollection */ private function putRowInIndex(&$index, $metadataNamesToIndexBy, $row, $idSite, $period) { - $currentLevel = &$index; + $currentLevel = & $index; foreach ($metadataNamesToIndexBy as $metadataName) { if ($metadataName == 'site') { @@ -330,7 +330,7 @@ class DataCollection $currentLevel[$key] = array(); } - $currentLevel = &$currentLevel[$key]; + $currentLevel = & $currentLevel[$key]; } $currentLevel = $row; diff --git a/core/Archive/DataTableFactory.php b/core/Archive/DataTableFactory.php index c849c29168..c21fcf7dd5 100644 --- a/core/Archive/DataTableFactory.php +++ b/core/Archive/DataTableFactory.php @@ -53,7 +53,7 @@ class DataTableFactory /** * The maximum number of subtable levels to create when creating an expanded * DataTable. - * + * * @var int */ private $maxSubtableDepth = null; @@ -98,7 +98,7 @@ class DataTableFactory * Tells the factory instance to expand the DataTables that are created by * creating subtables and setting the subtable IDs of rows w/ subtables correctly. * - * @param null|int $maxSubtableDepth max depth for subtables. + * @param null|int $maxSubtableDepth max depth for subtables. * @param bool $addMetadataSubtableId Whether to add the subtable ID used in the * database to the in-memory DataTables as * metadata or not. @@ -331,10 +331,10 @@ class DataTableFactory * the subtable IDs of each DataTable row. * * @param DataTable $dataTable - * @param array $blobRow An array associating record names (w/ subtable if applicable) + * @param array $blobRow An array associating record names (w/ subtable if applicable) * with blob values. This should hold every subtable blob for * the loaded DataTable. - * @param int $treeLevel + * @param int $treeLevel */ private function setSubtables($dataTable, $blobRow, $treeLevel = 0) { diff --git a/core/Archive/Parameters.php b/core/Archive/Parameters.php index 8db15dcbb5..65c8d5a4c3 100644 --- a/core/Archive/Parameters.php +++ b/core/Archive/Parameters.php @@ -10,6 +10,7 @@ */ namespace Piwik\Archive; + use Exception; use Piwik\Segment; diff --git a/core/ArchiveProcessor.php b/core/ArchiveProcessor.php index 4ac17c04a3..db481096f3 100644 --- a/core/ArchiveProcessor.php +++ b/core/ArchiveProcessor.php @@ -9,14 +9,14 @@ * @package Piwik */ namespace Piwik; -use Exception; +use Exception; use Piwik\ArchiveProcessor\Rules; use Piwik\DataAccess\ArchiveSelector; use Piwik\DataAccess\ArchiveWriter; use Piwik\DataAccess\LogAggregator; -use Piwik\Db; +use Piwik\Db; use Piwik\Period; /** @@ -246,7 +246,7 @@ abstract class ArchiveProcessor */ protected function setNumberOfVisits($visitsMetricCached, $convertedVisitsMetricCached = false) { - if($visitsMetricCached === false) { + if ($visitsMetricCached === false) { $this->visitsMetricCached = $this->convertedVisitsMetricCached = false; } else { $this->visitsMetricCached = (int)$visitsMetricCached; diff --git a/core/ArchiveProcessor/Day.php b/core/ArchiveProcessor/Day.php index 691ea7c54d..d9f0b88f0c 100644 --- a/core/ArchiveProcessor/Day.php +++ b/core/ArchiveProcessor/Day.php @@ -9,6 +9,7 @@ * @package Piwik */ namespace Piwik\ArchiveProcessor; + use Piwik\ArchiveProcessor; use Piwik\DataArray; use Piwik\DataTable; @@ -63,7 +64,7 @@ class Day extends ArchiveProcessor * Windows XP 12 ... * Mac OS 15 36 ... * - * @param string $dimension Table log_visit field name to be use to compute common stats + * @param string $dimension Table log_visit field name to be use to compute common stats * @return DataArray */ public function getMetricsForDimension($dimension) diff --git a/core/ArchiveProcessor/Period.php b/core/ArchiveProcessor/Period.php index c2c48db8a8..a85debf563 100644 --- a/core/ArchiveProcessor/Period.php +++ b/core/ArchiveProcessor/Period.php @@ -63,12 +63,12 @@ class Period extends ArchiveProcessor * It returns an array that gives information about the "final" DataTable. The array gives for every field name, the number of rows in the * final DataTable (ie. the number of distinct LABEL over the period) (eg. the number of distinct keywords over the last month) * - * @param string|array $recordNames Field name(s) of DataTable to select so we can get the sum - * @param int $maximumRowsInDataTableLevelZero Max row count of parent datatable to archive - * @param int $maximumRowsInSubDataTable Max row count of children datatable(s) to archive - * @param string $columnToSortByBeforeTruncation Column name to sort by, before truncating rows (ie. if there are more rows than the specified max row count) - * @param array $columnAggregationOperations Operations for aggregating columns, @see Row::sumRow() - * @param array $invalidSummedColumnNameToRenamedName (current_column_name => new_column_name) for columns that must change names when summed + * @param string|array $recordNames Field name(s) of DataTable to select so we can get the sum + * @param int $maximumRowsInDataTableLevelZero Max row count of parent datatable to archive + * @param int $maximumRowsInSubDataTable Max row count of children datatable(s) to archive + * @param string $columnToSortByBeforeTruncation Column name to sort by, before truncating rows (ie. if there are more rows than the specified max row count) + * @param array $columnAggregationOperations Operations for aggregating columns, @see Row::sumRow() + * @param array $invalidSummedColumnNameToRenamedName (current_column_name => new_column_name) for columns that must change names when summed * (eg. unique visitors go from nb_uniq_visitors to sum_daily_nb_uniq_visitors) * * @return array array ( @@ -113,7 +113,7 @@ class Period extends ArchiveProcessor * * The aggregate metrics are then stored in the Archive and the values are returned. * - * @param array|string $columns Array of strings or string containing the field names to select + * @param array|string $columns Array of strings or string containing the field names to select * @param bool|string $operationToApply Available operations = sum, max, min. If false, the operation will be guessed from the column name (guesses from column names min_ and max_) * @return array */ @@ -155,8 +155,8 @@ class Period extends ArchiveProcessor * All these DataTables are then added together, and the resulting DataTable is returned. * * @param string $name - * @param array $invalidSummedColumnNameToRenamedName columns in the array (old name, new name) to be renamed as the sum operation is not valid on them (eg. nb_uniq_visitors->sum_daily_nb_uniq_visitors) - * @param array $columnAggregationOperations Operations for aggregating columns, @see Row::sumRow() + * @param array $invalidSummedColumnNameToRenamedName columns in the array (old name, new name) to be renamed as the sum operation is not valid on them (eg. nb_uniq_visitors->sum_daily_nb_uniq_visitors) + * @param array $columnAggregationOperations Operations for aggregating columns, @see Row::sumRow() * @return DataTable */ protected function getRecordDataTableSum($name, $invalidSummedColumnNameToRenamedName, $columnAggregationOperations = null) diff --git a/core/ArchiveProcessor/Rules.php b/core/ArchiveProcessor/Rules.php index 58ff2425df..18f13703ac 100644 --- a/core/ArchiveProcessor/Rules.php +++ b/core/ArchiveProcessor/Rules.php @@ -215,10 +215,10 @@ class Rules protected static function isRequestAuthorizedToArchive() { return !self::$archivingDisabledByTests && - (Rules::isBrowserTriggerEnabled() - || Common::isPhpCliMode() - || (Piwik::isUserIsSuperUser() - && SettingsServer::isArchivePhpTriggered())); + (Rules::isBrowserTriggerEnabled() + || Common::isPhpCliMode() + || (Piwik::isUserIsSuperUser() + && SettingsServer::isArchivePhpTriggered())); } public static function isBrowserTriggerEnabled() diff --git a/core/AssetManager.php b/core/AssetManager.php index c92a0508ed..c75f9435a7 100644 --- a/core/AssetManager.php +++ b/core/AssetManager.php @@ -191,7 +191,7 @@ class AssetManager */ public static function getCompiledBaseCss() { - $file = '/plugins/Zeitgeist/stylesheets/base.less'; + $file = '/plugins/Zeitgeist/stylesheets/base.less'; $less = self::makeLess(); $lessContent = self::getCssContentFromFile($file, $less); $css = $less->compile($lessContent); @@ -306,10 +306,10 @@ class AssetManager // We look for the currently enabled theme and add CSS from the json $theme = PluginsManager::getInstance()->getThemeEnabled(); - if($theme && $theme->getPluginName() != PluginsManager::DEFAULT_THEME) { + if ($theme && $theme->getPluginName() != PluginsManager::DEFAULT_THEME) { $info = $theme->getInformation(); - if(isset($info['stylesheet'])) { - $themeStylesheetFile = 'plugins/'. $theme->getPluginName() . '/' . $info['stylesheet']; + if (isset($info['stylesheet'])) { + $themeStylesheetFile = 'plugins/' . $theme->getPluginName() . '/' . $info['stylesheet']; } $stylesheets[] = $themeStylesheetFile; } @@ -359,7 +359,7 @@ class AssetManager private static function generateMergedJsFile() { $mergedContent = ""; - + // Loop through each js file $files = self::getJsFiles(); foreach ($files as $file) { diff --git a/core/Auth.php b/core/Auth.php index 30401d0e04..0b47da6ae1 100644 --- a/core/Auth.php +++ b/core/Auth.php @@ -55,7 +55,7 @@ class AuthResult /** * The login used to authenticate. - * + * * @var string */ protected $login = null; @@ -63,7 +63,7 @@ class AuthResult /** * The authentication result code. Can be self::FAILURE, self::SUCCESS, or * self::SUCCESS_SUPERUSER_AUTH_CODE. - * + * * @var int */ protected $code = null; @@ -84,7 +84,7 @@ class AuthResult /** * Returns the login used to authenticate. - * + * * @return string */ public function getIdentity() @@ -104,7 +104,7 @@ class AuthResult /** * Returns the authentication result code. - * + * * @return int */ public function getCode() @@ -114,7 +114,7 @@ class AuthResult /** * Returns true if this result was successfully authentication. - * + * * @return bool */ public function wasAuthenticationSuccessful() diff --git a/core/CacheFile.php b/core/CacheFile.php index 833daaff1e..4322b1b0a8 100644 --- a/core/CacheFile.php +++ b/core/CacheFile.php @@ -44,8 +44,8 @@ class CacheFile const MINIMUM_TTL = 60; /** - * @param string $directory directory to use - * @param int $timeToLiveInSeconds TTL + * @param string $directory directory to use + * @param int $timeToLiveInSeconds TTL */ public function __construct($directory, $timeToLiveInSeconds = 300) { @@ -61,7 +61,7 @@ class CacheFile /** * Function to fetch a cache entry * - * @param string $id The cache entry ID + * @param string $id The cache entry ID * @return array|bool False on error, or array the cache content */ public function get($id) @@ -112,8 +112,8 @@ class CacheFile /** * A function to store content a cache entry. * - * @param string $id The cache entry ID - * @param array $content The cache content + * @param string $id The cache entry ID + * @param array $content The cache content * @throws \Exception * @return bool True if the entry was succesfully stored */ @@ -170,7 +170,7 @@ class CacheFile /** * A function to delete a single cache entry * - * @param string $id The cache entry ID + * @param string $id The cache entry ID * @return bool True if the entry was succesfully deleted */ public function delete($id) diff --git a/core/Common.php b/core/Common.php index 4955cb75fd..5586b82f0a 100644 --- a/core/Common.php +++ b/core/Common.php @@ -47,7 +47,7 @@ class Common /** * Hashes a string into an integer which should be very low collision risks - * @param string $string String to hash + * @param string $string String to hash * @return int Resulting int hash */ public static function hashStringToInt($string) @@ -62,7 +62,7 @@ class Common * Returns the table name prefixed by the table prefix. * Works in both Tracker and UI mode. * - * @param string $table The table name to prefix, ie "log_visit" + * @param string $table The table name to prefix, ie "log_visit" * @return string The table name prefixed, ie "piwik-production_log_visit" * @api */ @@ -140,7 +140,7 @@ class Common * * @param string $string * @param int $start - * @param int ... optional length + * @param int ... optional length * @return string */ public static function substr($string, $start) @@ -173,7 +173,7 @@ class Common * * @param string $string * @param int $start - * @param int ... optional length + * @param int ... optional length * @return string */ public static function mb_substr($string, $start) @@ -367,9 +367,9 @@ class Common * * @see sanitizeInputValues() for the applied sanitization * - * @param string $varName name of the variable - * @param string $varDefault default value. If '', and if the type doesn't match, exit() ! - * @param string $varType Expected type, the value must be one of the following: array, int, integer, string, json + * @param string $varName name of the variable + * @param string $varDefault default value. If '', and if the type doesn't match, exit() ! + * @param string $varType Expected type, the value must be one of the following: array, int, integer, string, json * @param array $requestArrayToUse * * @throws Exception if the variable type is not known @@ -519,7 +519,7 @@ class Common * * @see http://php.net/bin2hex * - * @param string $str Hexadecimal representation + * @param string $str Hexadecimal representation * @return string */ public static function hex2bin($str) @@ -562,7 +562,7 @@ class Common * * @deprecated 1.4 * - * @param string $ip IP address in network address format + * @param string $ip IP address in network address format * @return string */ public static function long2ip($ip) @@ -721,7 +721,7 @@ class Common /** * Returns the browser language code, eg. "en-gb,en;q=0.5" * - * @param string|null $browserLang Optional browser language, otherwise taken from the request header + * @param string|null $browserLang Optional browser language, otherwise taken from the request header * @return string */ public static function getBrowserLanguage($browserLang = null) @@ -770,8 +770,8 @@ class Common * Returns the visitor country based on the Browser 'accepted language' * information, but provides a hook for geolocation via IP address. * - * @param string $lang browser lang - * @param bool $enableLanguageToCountryGuess If set to true, some assumption will be made and detection guessed more often, but accuracy could be affected + * @param string $lang browser lang + * @param bool $enableLanguageToCountryGuess If set to true, some assumption will be made and detection guessed more often, but accuracy could be affected * @param string $ip * @return string 2 letter ISO code */ @@ -789,8 +789,8 @@ class Common * Returns list of valid country codes * * @param string $browserLanguage - * @param array $validCountries Array of valid countries - * @param bool $enableLanguageToCountryGuess (if true, will guess country based on language that lacks region information) + * @param array $validCountries Array of valid countries + * @param bool $enableLanguageToCountryGuess (if true, will guess country based on language that lacks region information) * @return array Array of 2 letter ISO codes */ public static function extractCountryCodeFromBrowserLanguage($browserLanguage, $validCountries, $enableLanguageToCountryGuess) @@ -820,8 +820,8 @@ class Common /** * Returns the visitor language based only on the Browser 'accepted language' information * - * @param string $browserLanguage Browser's accepted langauge header - * @param array $validLanguages array of valid language codes + * @param string $browserLanguage Browser's accepted langauge header + * @param array $validLanguages array of valid language codes * @return string 2 letter ISO 639 code */ public static function extractLanguageCodeFromBrowserLanguage($browserLanguage, $validLanguages) @@ -848,7 +848,7 @@ class Common /** * Returns the continent of a given country * - * @param string $country 2 letters isocode + * @param string $country 2 letters isocode * * @return string Continent (3 letters code : afr, asi, eur, amn, ams, oce) */ @@ -901,7 +901,7 @@ class Common * Takes a list of fields defining numeric values and returns the corresponding * unnamed parameters to be bound to the field names in the where clause of a SQL query * - * @param array|string $fields array( fieldName1, fieldName2, fieldName3) Names of the mysql table fields to load + * @param array|string $fields array( fieldName1, fieldName2, fieldName3) Names of the mysql table fields to load * @return string "?, ?, ?" */ public static function getSqlStringFieldsArray($fields) diff --git a/core/Config.php b/core/Config.php index 892646e84c..a37dd19e52 100644 --- a/core/Config.php +++ b/core/Config.php @@ -10,6 +10,7 @@ */ namespace Piwik; + use Exception; require_once PIWIK_INCLUDE_PATH . '/core/functions.php'; @@ -156,7 +157,7 @@ class Config public static function getLocalConfigPath() { $path = self::getByDomainConfigPath(); - if($path) { + if ($path) { return $path; } @@ -165,7 +166,7 @@ class Config public function getConfigHostnameIfSet() { - if($this->getByDomainConfigPath() === false) { + if ($this->getByDomainConfigPath() === false) { return false; } return $this->getHostname(); @@ -234,7 +235,7 @@ class Config Piwik_ExitWithMessage(Piwik_TranslateException('General_ExceptionUnreadableFileDisabledMethod', array($this->pathGlobal, "parse_ini_file()"))); } - if($reportError) { + if ($reportError) { $this->checkLocalConfigFound(); } $this->configLocal = _parse_ini_file($this->pathLocal, true); @@ -414,7 +415,7 @@ class Config if (!$configCache) { return false; } - if($configLocal) { + if ($configLocal) { foreach ($configLocal as $name => $section) { if (!isset($configCache[$name])) { $configCache[$name] = $this->decodeValues($section); @@ -507,7 +508,7 @@ class Config $output = $this->dumpConfig($configLocal, $configGlobal, $configCache); if ($output !== false) { $success = @file_put_contents($pathLocal, $output); - if(!$success) { + if (!$success) { throw new Exception(Piwik_Translate('General_ConfigFileIsNotWritable', array("(config/config.ini.php)", ""))); } } diff --git a/core/Console/Command.php b/core/Console/Command.php index b386525b84..ba45e02bcd 100644 --- a/core/Console/Command.php +++ b/core/Console/Command.php @@ -32,7 +32,7 @@ class Command extends SymfonyCommand public function writeSuccessMessage(OutputInterface $output, $messages) { $lengths = array_map('strlen', $messages); - $maxLen = max($lengths) + 4; + $maxLen = max($lengths) + 4; $separator = str_pad('', $maxLen, '*'); diff --git a/core/Controller.php b/core/Controller.php index 72302d557f..c5ba494684 100644 --- a/core/Controller.php +++ b/core/Controller.php @@ -91,8 +91,8 @@ abstract class Controller * Helper method to convert "today" or "yesterday" to the default timezone specified. * If the date is absolute, ie. YYYY-MM-DD, it will not be converted to the timezone * - * @param string $date today, yesterday, YYYY-MM-DD - * @param string $defaultTimezone default timezone to use + * @param string $date today, yesterday, YYYY-MM-DD + * @param string $defaultTimezone default timezone to use * @return Date */ protected function getDateParameterInTimezone($date, $defaultTimezone) @@ -144,8 +144,8 @@ abstract class Controller * - echo the output of the rendering if fetch = false * - returns the output of the rendering if fetch = true * - * @param ViewDataTable $view view object to use - * @param bool $fetch indicates whether to output or return the content + * @param ViewDataTable $view view object to use + * @param bool $fetch indicates whether to output or return the content * @return string|void */ protected function renderView(ViewDataTable $view, $fetch = false) @@ -213,7 +213,7 @@ abstract class Controller $view = $this->getLastUnitGraph($currentModuleName, $currentControllerAction, $apiMethod); $view->columns_to_display = $columnsToDisplay; $view->visualization_properties->selectable_columns = - array_merge($view->visualization_properties->selectable_columns ?: array(), $selectableColumns); + array_merge($view->visualization_properties->selectable_columns ? : array(), $selectableColumns); $view->translations += $translations; if ($reportDocumentation) { @@ -233,7 +233,7 @@ abstract class Controller * - date: YYYY-MM-DD, today, yesterday * - period: day, week, month, year * - * @param array $paramsToSet array( 'date' => 'last50', 'viewDataTable' =>'sparkline' ) + * @param array $paramsToSet array( 'date' => 'last50', 'viewDataTable' =>'sparkline' ) * @throws \Piwik\NoAccessException * @return array */ @@ -290,8 +290,8 @@ abstract class Controller * Returns a numeric value from the API. * Works only for API methods that originally returns numeric values (there is no cast here) * - * @param string $methodToCall Name of method to call, eg. Referrers.getNumberOfDistinctSearchEngines - * @param bool|string $date A custom date to use when getting the value. If false, the 'date' query + * @param string $methodToCall Name of method to call, eg. Referrers.getNumberOfDistinctSearchEngines + * @param bool|string $date A custom date to use when getting the value. If false, the 'date' query * parameter is used. * * @return int|float @@ -311,8 +311,8 @@ abstract class Controller * It will automatically build a sparkline by setting the viewDataTable=sparkline parameter in the URL. * It will also computes automatically the 'date' for the 'last30' days/weeks/etc. * - * @param string $action Method name of the controller to call in the img src - * @param array $customParameters Array of name => value of parameters to set in the generated GET url + * @param string $action Method name of the controller to call in the img src + * @param array $customParameters Array of name => value of parameters to set in the generated GET url * @return string The generated URL */ protected function getUrlSparkline($action, $customParameters = array()) @@ -321,7 +321,7 @@ abstract class Controller array('viewDataTable' => 'sparkline', 'action' => $action, 'module' => $this->pluginName) - + $customParameters + + $customParameters ); // convert array values to comma separated foreach ($params as &$value) { @@ -487,9 +487,9 @@ abstract class Controller $changeTrustedHostsUrl = "index.php" . Url::getCurrentQueryStringWithParametersModified(array( - 'module' => 'CoreAdminHome', - 'action' => 'generalSettings' - )) + 'module' => 'CoreAdminHome', + 'action' => 'generalSettings' + )) . "#trustedHostsSection"; $warningStart = Piwik_Translate('CoreHome_InjectedHostWarningIntro', array( @@ -567,12 +567,12 @@ abstract class Controller * Helper method used to redirect the current http request to another module/action * If specified, will also redirect to a given website, period and /or date * - * @param string $moduleToRedirect Module, eg. "MultiSites" - * @param string $actionToRedirect Action, eg. "index" - * @param string $websiteId Website ID, eg. 1 - * @param string $defaultPeriod Default period, eg. "day" - * @param string $defaultDate Default date, eg. "today" - * @param array $parameters Parameters to append to url + * @param string $moduleToRedirect Module, eg. "MultiSites" + * @param string $actionToRedirect Action, eg. "index" + * @param string $websiteId Website ID, eg. 1 + * @param string $defaultPeriod Default period, eg. "day" + * @param string $defaultDate Default date, eg. "today" + * @param array $parameters Parameters to append to url */ public function redirectToIndex($moduleToRedirect, $actionToRedirect, $websiteId = null, $defaultPeriod = null, $defaultDate = null, $parameters = array()) { diff --git a/core/Controller/Admin.php b/core/Controller/Admin.php index 004160d453..2facfeeac8 100644 --- a/core/Controller/Admin.php +++ b/core/Controller/Admin.php @@ -69,16 +69,16 @@ abstract class Admin extends Controller $missingPlugins = PluginsManager::getInstance()->getMissingPlugins(); if (!empty($missingPlugins)) { $pluginsLink = Url::getCurrentQueryStringWithParametersModified(array( - 'module' => 'CorePluginsAdmin', 'action' => 'plugins' - )); + 'module' => 'CorePluginsAdmin', 'action' => 'plugins' + )); $view->invalidPluginsWarning = Piwik_Translate('CoreAdminHome_InvalidPluginsWarning', array( - self::getPiwikVersion(), - '<strong>' . implode('</strong>, <strong>', $missingPlugins) . '</strong>')) - . '<br/>' - . Piwik_Translate('CoreAdminHome_InvalidPluginsYouCanUninstall', array( - '<a href="' . $pluginsLink . '"/>', - '</a>' - )); + self::getPiwikVersion(), + '<strong>' . implode('</strong>, <strong>', $missingPlugins) . '</strong>')) + . '<br/>' + . Piwik_Translate('CoreAdminHome_InvalidPluginsYouCanUninstall', array( + '<a href="' . $pluginsLink . '"/>', + '</a>' + )); } self::checkPhpVersion($view); diff --git a/core/Cookie.php b/core/Cookie.php index 4492fffb72..229901e22e 100644 --- a/core/Cookie.php +++ b/core/Cookie.php @@ -77,11 +77,11 @@ class Cookie * Instantiate a new Cookie object and tries to load the cookie content if the cookie * exists already. * - * @param string $cookieName cookie Name - * @param int $expire The timestamp after which the cookie will expire, eg time() + 86400; + * @param string $cookieName cookie Name + * @param int $expire The timestamp after which the cookie will expire, eg time() + 86400; * use 0 (int zero) to expire cookie at end of browser session - * @param string $path The path on the server in which the cookie will be available on. - * @param bool|string $keyStore Will be used to store several bits of data (eg. one array per website) + * @param string $path The path on the server in which the cookie will be available on. + * @param bool|string $keyStore Will be used to store several bits of data (eg. one array per website) */ public function __construct($cookieName, $expire = null, $path = null, $keyStore = false) { @@ -127,9 +127,9 @@ class Cookie * * @link http://php.net/setcookie * - * @param string $Name Name of cookie - * @param string $Value Value of cookie - * @param int $Expires Time the cookie expires + * @param string $Name Name of cookie + * @param string $Value Value of cookie + * @param int $Expires Time the cookie expires * @param string $Path * @param string $Domain * @param bool $Secure @@ -317,8 +317,8 @@ class Cookie * You should save arrays only when you are sure about their maximum data size. * A cookie has to stay small and its size shouldn't increase over time! * - * @param string $name Name of the value to save; the name will be used to retrieve this value - * @param string|array|number $value Value to save. If null, entry will be deleted from cookie. + * @param string $name Name of the value to save; the name will be used to retrieve this value + * @param string|array|number $value Value to save. If null, entry will be deleted from cookie. */ public function set($name, $value) { @@ -376,7 +376,7 @@ class Cookie * Escape values from the cookie before sending them back to the client * (when using the get() method). * - * @param string $value Value to be escaped + * @param string $value Value to be escaped * @return mixed The value once cleaned. */ protected static function escapeValue($value) diff --git a/core/DataAccess/ArchiveSelector.php b/core/DataAccess/ArchiveSelector.php index e9a1d6efb5..4cf01afa24 100644 --- a/core/DataAccess/ArchiveSelector.php +++ b/core/DataAccess/ArchiveSelector.php @@ -20,8 +20,8 @@ use Piwik\Log; use Piwik\Period; use Piwik\Period\Range; use Piwik\Piwik; -use Piwik\Segment; +use Piwik\Segment; use Piwik\Site; /** @@ -275,8 +275,8 @@ class ArchiveSelector // create the SQL to find archives that are DONE return "(name IN ($allDoneFlags)) AND " . - " (value = '" . ArchiveProcessor::DONE_OK . "' OR " . - " value = '" . ArchiveProcessor::DONE_OK_TEMPORARY . "')"; + " (value = '" . ArchiveProcessor::DONE_OK . "' OR " . + " value = '" . ArchiveProcessor::DONE_OK_TEMPORARY . "')"; } static public function purgeOutdatedArchives(Date $dateStart) diff --git a/core/DataAccess/ArchiveWriter.php b/core/DataAccess/ArchiveWriter.php index 3d21ba4a5d..0c4e5911bb 100644 --- a/core/DataAccess/ArchiveWriter.php +++ b/core/DataAccess/ArchiveWriter.php @@ -17,8 +17,8 @@ use Piwik\Common; use Piwik\Config; use Piwik\Db; use Piwik\Db\BatchInsert; -use Piwik\Log; +use Piwik\Log; use Piwik\Period; use Piwik\Segment; use Piwik\SettingsPiwik; diff --git a/core/DataAccess/LogAggregator.php b/core/DataAccess/LogAggregator.php index fcde08cdf5..ef53f04cd8 100644 --- a/core/DataAccess/LogAggregator.php +++ b/core/DataAccess/LogAggregator.php @@ -15,8 +15,8 @@ use Piwik\Common; use Piwik\Date; use Piwik\Db; use Piwik\Metrics; -use Piwik\Segment; +use Piwik\Segment; use Piwik\Site; use Piwik\Tracker\GoalManager; @@ -128,12 +128,12 @@ class LogAggregator /** * Query visits logs by dimension, and return the aggregate data. * - * @param array|string $dimensions Can be a string, eg. "referrer_name", will be aliased as 'label' in the returned rows + * @param array|string $dimensions Can be a string, eg. "referrer_name", will be aliased as 'label' in the returned rows * Can also be an array of strings, when the dimension spans multiple fields, * eg. array("referrer_name", "referrer_keyword") * @param bool|string $where Additional condition for WHERE clause * @param array $additionalSelects Additional SELECT clause - * @param bool|array $metrics Set this if you want to limit the columns that are returned. + * @param bool|array $metrics Set this if you want to limit the columns that are returned. * The possible values in the array are Metrics::INDEX_*. * @param bool|\Piwik\RankingQuery $rankingQuery * A pre-configured ranking query instance that is used to limit the result. @@ -275,7 +275,7 @@ class LogAggregator protected function isFieldFunctionOrComplexExpression($field) { return strpos($field, "(") !== false - || strpos($field, "CASE") !== false; + || strpos($field, "CASE") !== false; } protected function getSelectAliasAs($metricId) @@ -286,7 +286,7 @@ class LogAggregator protected function isMetricRequested($metricId, $metricsRequested) { return $metricsRequested === false - || in_array($metricId, $metricsRequested); + || in_array($metricId, $metricsRequested); } protected function getWhereStatement($tableName, $datetimeField, $extraWhere = false) @@ -349,13 +349,13 @@ class LogAggregator /** * Queries the Actions table log_link_visit_action and returns the aggregate data. * - * @param array|string $dimensions the dimensionRecord(s) you're interested in - * @param string $where where clause + * @param array|string $dimensions the dimensionRecord(s) you're interested in + * @param string $where where clause * @param array|bool $additionalSelects additional select clause - * @param bool|array $metrics Set this if you want to limit the columns that are returned. + * @param bool|array $metrics Set this if you want to limit the columns that are returned. * The possible values in the array are Metrics::INDEX_*. - * @param \Piwik\RankingQuery $rankingQuery pre-configured ranking query instance - * @param bool|string $joinLogActionOnColumn column from log_link_visit_action that + * @param \Piwik\RankingQuery $rankingQuery pre-configured ranking query instance + * @param bool|string $joinLogActionOnColumn column from log_link_visit_action that * log_action should be joined on. * can be an array to join multiple times. * @return mixed diff --git a/core/DataFiles/Providers.php b/core/DataFiles/Providers.php index a25cf015b5..3eb970c2b3 100644 --- a/core/DataFiles/Providers.php +++ b/core/DataFiles/Providers.php @@ -12,40 +12,39 @@ /** * Providers names */ -if(!isset($GLOBALS['Piwik_ProviderNames'])) -{ +if (!isset($GLOBALS['Piwik_ProviderNames'])) { $GLOBALS['Piwik_ProviderNames'] = array( // France - "wanadoo" => "Orange", - "proxad" => "Free", - "bbox" => "Bouygues Telecom", - "bouyguestelecom" => "Bouygues Telecom", - "coucou-networks" => "Free Mobile", - "sfr" => "SFR", //Acronym, keep in uppercase - "univ-metz" => "Université de Lorraine", - "unilim" => "Université de Limoges", - "univ-paris5" => "Université Paris Descartes", + "wanadoo" => "Orange", + "proxad" => "Free", + "bbox" => "Bouygues Telecom", + "bouyguestelecom" => "Bouygues Telecom", + "coucou-networks" => "Free Mobile", + "sfr" => "SFR", //Acronym, keep in uppercase + "univ-metz" => "Université de Lorraine", + "unilim" => "Université de Limoges", + "univ-paris5" => "Université Paris Descartes", // US - "rr" => "Time Warner Cable Internet", // Not sure - "uu" => "Verizon", + "rr" => "Time Warner Cable Internet", // Not sure + "uu" => "Verizon", // UK - 'zen.net' => 'Zen Internet', + 'zen.net' => 'Zen Internet', // DE - 't-ipconnect' => 'Deutsche Telekom', - 't-dialin' => 'Deutsche Telekom', - 'dtag' => 'Deutsche Telekom', - 't-ipnet' => 'Deutsche Telekom', - 'd1-online' => 'Deutsche Telekom (Mobile)', - 'superkabel' => 'Kabel Deutschland', - 'unitymediagroup' => 'Unitymedia', - 'arcor-ip' => 'Vodafone', + 't-ipconnect' => 'Deutsche Telekom', + 't-dialin' => 'Deutsche Telekom', + 'dtag' => 'Deutsche Telekom', + 't-ipnet' => 'Deutsche Telekom', + 'd1-online' => 'Deutsche Telekom (Mobile)', + 'superkabel' => 'Kabel Deutschland', + 'unitymediagroup' => 'Unitymedia', + 'arcor-ip' => 'Vodafone', 'kabel-badenwuerttemberg' => 'Kabel BW', - 'alicedsl' => 'O2', - 'komdsl' => 'komDSL - Thüga MeteringService', - 'mediaways' => 'mediaWays - Telefonica', - 'citeq' => 'Citeq - Stadt Münster', + 'alicedsl' => 'O2', + 'komdsl' => 'komDSL - Thüga MeteringService', + 'mediaways' => 'mediaWays - Telefonica', + 'citeq' => 'Citeq - Stadt Münster', ); } diff --git a/core/DataTable.php b/core/DataTable.php index 50569d6069..c09cb3bfe3 100644 --- a/core/DataTable.php +++ b/core/DataTable.php @@ -12,7 +12,6 @@ namespace Piwik; use Closure; - use Exception; use Piwik\DataTable\Filter; use Piwik\DataTable\Manager; @@ -301,7 +300,7 @@ class DataTable * Sort the dataTable rows using the php callback function * * @param string $functionCallback - * @param string $columnSortedBy The column name. Used to then ask the datatable what column are you sorted by + * @param string $columnSortedBy The column name. Used to then ask the datatable what column are you sorted by */ public function sort($functionCallback, $columnSortedBy) { @@ -373,9 +372,9 @@ class DataTable /** * Apply a filter to this datatable * - * @param string|Closure $className Class name, eg. "Sort" or "Sort". + * @param string|Closure $className Class name, eg. "Sort" or "Sort". * If this variable is a closure, it will get executed immediately. - * @param array $parameters Array of parameters to the filter, eg. array('nb_visits', 'asc') + * @param array $parameters Array of parameters to the filter, eg. array('nb_visits', 'asc') */ public function filter($className, $parameters = array()) { @@ -405,8 +404,8 @@ class DataTable * Queue a DataTable_Filter that will be applied when applyQueuedFilters() is called. * (just before sending the datatable back to the browser (or API, etc.) * - * @param string $className The class name of the filter, eg. Limit - * @param array $parameters The parameters to give to the filter, eg. array( $offset, $limit) for the filter Limit + * @param string $className The class name of the filter, eg. Limit + * @param array $parameters The parameters to give to the filter, eg. array( $offset, $limit) for the filter Limit */ public function queueFilter($className, $parameters = array()) { @@ -471,7 +470,7 @@ class DataTable /** * Returns the Row that has a column 'label' with the value $label * - * @param string $label Value of the column 'label' of the row to return + * @param string $label Value of the column 'label' of the row to return * @return \Piwik\DataTable\Row|bool The row if found, false otherwise */ public function getRowFromLabel($label) @@ -494,7 +493,7 @@ class DataTable /** * Returns the row id for the givel label * - * @param string $label Value of the column 'label' of the row to return + * @param string $label Value of the column 'label' of the row to return * @return int|Row */ public function getRowIdFromLabel($label) @@ -587,7 +586,7 @@ class DataTable /** * Add a row to the table and rebuild the index if necessary * - * @param \Piwik\DataTable\Row $row to add at the end of the array + * @param \Piwik\DataTable\Row $row to add at the end of the array * @return \Piwik\DataTable\Row */ public function addRow(Row $row) @@ -638,7 +637,7 @@ class DataTable $this->rowsIndexByLabel[$label] = self::ID_SUMMARY_ROW; } } - + return $row; } @@ -655,7 +654,7 @@ class DataTable /** * Adds a new row from a PHP array data structure * - * @param array $row eg. array(Row::COLUMNS => array( 'visits' => 13, 'test' => 'toto'),) + * @param array $row eg. array(Row::COLUMNS => array( 'visits' => 13, 'test' => 'toto'),) */ public function addRowFromArray($row) { @@ -665,7 +664,7 @@ class DataTable /** * Adds a new row a PHP array data structure * - * @param array $row eg. array('name' => 'google analytics', 'license' => 'commercial') + * @param array $row eg. array('name' => 'google analytics', 'license' => 'commercial') */ public function addRowFromSimpleArray($row) { @@ -751,7 +750,7 @@ class DataTable /** * Returns an array containing the rows Metadata values * - * @param string $name Metadata column to return + * @param string $name Metadata column to return * @return array */ public function getRowsMetadata($name) @@ -851,8 +850,8 @@ class DataTable /** * Rename a column in all rows * - * @param string $oldName Old column name - * @param string $newName New column name + * @param string $oldName Old column name + * @param string $newName New column name */ public function renameColumn($oldName, $newName) { @@ -948,7 +947,7 @@ class DataTable /** * Deletes the rows from the list of rows ID * - * @param array $aKeys ID of the rows to delete + * @param array $aKeys ID of the rows to delete * @throws Exception if any of the row to delete couldn't be found */ public function deleteRows(array $aKeys) @@ -1019,9 +1018,9 @@ class DataTable * won't work. * * @throws Exception if an infinite recursion is found (a table row's has a subtable that is one of its parent table) - * @param int $maximumRowsInDataTable If not null, defines the number of rows maximum of the serialized dataTable - * @param int $maximumRowsInSubDataTable If not null, defines the number of rows maximum of the serialized subDataTable - * @param string $columnToSortByBeforeTruncation Column to sort by before truncation + * @param int $maximumRowsInDataTable If not null, defines the number of rows maximum of the serialized dataTable + * @param int $maximumRowsInSubDataTable If not null, defines the number of rows maximum of the serialized subDataTable + * @param string $columnToSortByBeforeTruncation Column to sort by before truncation * @return array Serialized arrays * array( // Datatable level0 * 0 => 'eghuighahgaueytae78yaet7yaetae', @@ -1093,7 +1092,7 @@ class DataTable * * The function creates all the necessary DataTable\Row * - * @param string $stringSerialized string of serialized datatable + * @param string $stringSerialized string of serialized datatable * @throws Exception */ public function addRowsFromSerializedArray($stringSerialized) @@ -1108,7 +1107,7 @@ class DataTable /** * Loads the DataTable from a PHP array data structure * - * @param array $array Array with the following structure + * @param array $array Array with the following structure * array( * // row1 * array( @@ -1138,7 +1137,7 @@ class DataTable * Basically maps a simple multidimensional php array to a DataTable. * Not recursive (if a row contains a php array itself, it won't be loaded) * - * @param array $array Array with the simple structure: + * @param array $array Array with the simple structure: * array( * array( col1_name => valueA, col2_name => valueC, ...), * array( col1_name => valueB, col2_name => valueD, ...), @@ -1331,7 +1330,7 @@ class DataTable * a subtable is encountered w/o the queried label, a new row is created * with the label, and a subtable is added to the row. * - * @param array $path The path to walk. An array of label values. + * @param array $path The path to walk. An array of label values. * @param array|bool $missingRowColumns * The default columns to use when creating new arrays. * If this parameter is supplied, new rows will be @@ -1398,7 +1397,7 @@ class DataTable /** * Returns a new DataTable that contains the rows of each of this table's subtables. * - * @param string|bool $labelColumn If supplied the label of the parent row will be + * @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. @@ -1480,7 +1479,7 @@ class DataTable /** * Set multiple aggregation operations at once. - * @param array $operations format: column name => operation + * @param array $operations format: column name => operation */ public function setColumnAggregationOperations($operations) { diff --git a/core/DataTable/Filter.php b/core/DataTable/Filter.php index 73cfb13ee5..27a7bc8938 100644 --- a/core/DataTable/Filter.php +++ b/core/DataTable/Filter.php @@ -11,7 +11,6 @@ namespace Piwik\DataTable; use Exception; - use Piwik\DataTable; use Piwik\DataTable\Row; diff --git a/core/DataTable/Filter/AddColumnsProcessedMetrics.php b/core/DataTable/Filter/AddColumnsProcessedMetrics.php index ad5b5d194d..1bc8205a30 100644 --- a/core/DataTable/Filter/AddColumnsProcessedMetrics.php +++ b/core/DataTable/Filter/AddColumnsProcessedMetrics.php @@ -27,7 +27,7 @@ class AddColumnsProcessedMetrics extends Filter /** * @param DataTable $table - * @param bool $deleteRowsWithNoVisit Automatically set to true when filter_add_columns_when_show_all_columns is found in the API request + * @param bool $deleteRowsWithNoVisit Automatically set to true when filter_add_columns_when_show_all_columns is found in the API request * @return AddColumnsProcessedMetrics */ public function __construct($table, $deleteRowsWithNoVisit = true) diff --git a/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php b/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php index 8a0e335681..51fe770217 100644 --- a/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php +++ b/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php @@ -11,7 +11,6 @@ namespace Piwik\DataTable\Filter; use Exception; - use Piwik\DataTable; use Piwik\Metrics; use Piwik\Piwik; @@ -48,8 +47,8 @@ class AddColumnsProcessedMetricsGoal extends AddColumnsProcessedMetrics * - revenue per visit * * @param DataTable $table - * @param bool $enable should be true (automatically set to true when filter_update_columns_when_show_all_goals is found in the API request) - * @param string $processOnlyIdGoal Defines what metrics to add (don't process metrics when you don't display them) + * @param bool $enable should be true (automatically set to true when filter_update_columns_when_show_all_goals is found in the API request) + * @param string $processOnlyIdGoal Defines what metrics to add (don't process metrics when you don't display them) * If self::GOALS_FULL_TABLE, all Goal metrics (and per goal metrics) will be processed * If self::GOALS_OVERVIEW, only the main goal metrics will be added * If an int > 0, then will process only metrics for this specific Goal @@ -121,7 +120,7 @@ class AddColumnsProcessedMetricsGoal extends AddColumnsProcessedMetrics foreach ($goals as $goalId => $columnValue) { $goalId = str_replace("idgoal=", "", $goalId); if (($this->processOnlyIdGoal > self::GOALS_FULL_TABLE - || $this->isEcommerce) + || $this->isEcommerce) && $this->processOnlyIdGoal != $goalId ) { continue; diff --git a/core/DataTable/Filter/BeautifyRangeLabels.php b/core/DataTable/Filter/BeautifyRangeLabels.php index 917ba1c2a7..cfa2122351 100644 --- a/core/DataTable/Filter/BeautifyRangeLabels.php +++ b/core/DataTable/Filter/BeautifyRangeLabels.php @@ -47,10 +47,10 @@ class BeautifyRangeLabels extends ColumnCallbackReplace /** * Constructor. * - * @param DataTable $table The DataTable that will be filtered. - * @param string $labelSingular The string to use when the range being beautified + * @param DataTable $table The DataTable that will be filtered. + * @param string $labelSingular The string to use when the range being beautified * is equal to '1-1 units'. - * @param string $labelPlural The string to use when the range being beautified + * @param string $labelPlural The string to use when the range being beautified * references more than one unit. This must be a format * string that takes one string parameter. */ @@ -65,7 +65,7 @@ class BeautifyRangeLabels extends ColumnCallbackReplace /** * Beautifies a range label and returns the pretty result. * - * @param string $value The range string. This must be in either a '$min-$max' format + * @param string $value The range string. This must be in either a '$min-$max' format * a '$min+' format. * @return string The pretty range label. */ @@ -114,8 +114,8 @@ class BeautifyRangeLabels extends ColumnCallbackReplace * This function can be overridden in derived types to customize beautifcation * behavior based on the range values. * - * @param string $oldLabel The original label value. - * @param int $lowerBound The lower bound of the range. + * @param string $oldLabel The original label value. + * @param int $lowerBound The lower bound of the range. * @return string The pretty range label. */ public function getSingleUnitLabel($oldLabel, $lowerBound) @@ -134,9 +134,9 @@ class BeautifyRangeLabels extends ColumnCallbackReplace * This function can be overridden in derived types to customize beautifcation * behavior based on the range values. * - * @param string $oldLabel The original label value. - * @param int $lowerBound The lower bound of the range. - * @param int $upperBound The upper bound of the range. + * @param string $oldLabel The original label value. + * @param int $lowerBound The lower bound of the range. + * @param int $upperBound The upper bound of the range. * @return string The pretty range label. */ public function getRangeLabel($oldLabel, $lowerBound, $upperBound) @@ -151,8 +151,8 @@ class BeautifyRangeLabels extends ColumnCallbackReplace * This function can be overridden in derived types to customize beautifcation * behavior based on the range values. * - * @param string $oldLabel The original label value. - * @param int $lowerBound The lower bound of the range. + * @param string $oldLabel The original label value. + * @param int $lowerBound The lower bound of the range. * @return string The pretty range label. */ public function getUnboundedLabel($oldLabel, $lowerBound) diff --git a/core/DataTable/Filter/BeautifyTimeRangeLabels.php b/core/DataTable/Filter/BeautifyTimeRangeLabels.php index 997ea2e70c..b86c7d398d 100644 --- a/core/DataTable/Filter/BeautifyTimeRangeLabels.php +++ b/core/DataTable/Filter/BeautifyTimeRangeLabels.php @@ -34,13 +34,13 @@ class BeautifyTimeRangeLabels extends BeautifyRangeLabels /** * Constructor. * - * @param DataTable $table The DataTable this filter will run over. - * @param string $labelSecondsPlural A string to use when beautifying range labels + * @param DataTable $table The DataTable this filter will run over. + * @param string $labelSecondsPlural A string to use when beautifying range labels * whose lower bound is between 0 and 60. Must be * a format string that takes two numeric params. - * @param string $labelMinutesSingular A string to use when replacing a range that + * @param string $labelMinutesSingular A string to use when replacing a range that * equals 60-60 (or 1 minute - 1 minute). - * @param string $labelMinutesPlural A string to use when replacing a range that + * @param string $labelMinutesPlural A string to use when replacing a range that * spans multiple minutes. This must be a * format string that takes one string parameter. */ @@ -58,8 +58,8 @@ class BeautifyTimeRangeLabels extends BeautifyRangeLabels * If the lower bound of the range is less than 60 the pretty range label * will be in seconds. Otherwise, it will be in minutes. * - * @param string $oldLabel The original label value. - * @param int $lowerBound The lower bound of the range. + * @param string $oldLabel The original label value. + * @param int $lowerBound The lower bound of the range. * @return string The pretty range label. */ public function getSingleUnitLabel($oldLabel, $lowerBound) @@ -80,9 +80,9 @@ class BeautifyTimeRangeLabels extends BeautifyRangeLabels * If the lower bound of the range is less than 60 the pretty range label * will be in seconds. Otherwise, it will be in minutes. * - * @param string $oldLabel The original label value. - * @param int $lowerBound The lower bound of the range. - * @param int $upperBound The upper bound of the range. + * @param string $oldLabel The original label value. + * @param int $lowerBound The lower bound of the range. + * @param int $upperBound The upper bound of the range. * @return string The pretty range label. */ public function getRangeLabel($oldLabel, $lowerBound, $upperBound) @@ -101,8 +101,8 @@ class BeautifyTimeRangeLabels extends BeautifyRangeLabels * If the lower bound of the range is less than 60 the pretty range label * will be in seconds. Otherwise, it will be in minutes. * - * @param string $oldLabel The original label value. - * @param int $lowerBound The lower bound of the range. + * @param string $oldLabel The original label value. + * @param int $lowerBound The lower bound of the range. * @return string The pretty range label. */ public function getUnboundedLabel($oldLabel, $lowerBound) diff --git a/core/DataTable/Filter/CalculateEvolutionFilter.php b/core/DataTable/Filter/CalculateEvolutionFilter.php index a0b8e0c14c..3030c13b25 100755 --- a/core/DataTable/Filter/CalculateEvolutionFilter.php +++ b/core/DataTable/Filter/CalculateEvolutionFilter.php @@ -136,11 +136,11 @@ class CalculateEvolutionFilter extends ColumnCallbackAddColumnPercentage /** * Calculates the evolution percentage for two arbitrary values. * - * @param float|int $currentValue The current metric value. - * @param float|int $pastValue The value of the metric in the past. We measure the % change + * @param float|int $currentValue The current metric value. + * @param float|int $pastValue The value of the metric in the past. We measure the % change * from this value to $currentValue. * @param float|int $quotientPrecision The quotient precision to round to. - * @param bool $appendPercentSign Whether to append a '%' sign to the end of the number or not. + * @param bool $appendPercentSign Whether to append a '%' sign to the end of the number or not. * * @return string The evolution percent 15% */ diff --git a/core/DataTable/Filter/ColumnCallbackAddColumn.php b/core/DataTable/Filter/ColumnCallbackAddColumn.php index e65ab52e40..d0fa21db75 100755 --- a/core/DataTable/Filter/ColumnCallbackAddColumn.php +++ b/core/DataTable/Filter/ColumnCallbackAddColumn.php @@ -45,11 +45,11 @@ class ColumnCallbackAddColumn extends Filter /** * Constructor. * - * @param DataTable $table The DataTable that will be filtered. - * @param array|string $columns The names of the columns to pass to the callback. - * @param string $columnToAdd The name of the column to add. - * @param mixed $functionToApply The callback to apply to each row of a DataTable. - * @param array $functionParameters Extra parameters to pass to $functionToApply. + * @param DataTable $table The DataTable that will be filtered. + * @param array|string $columns The names of the columns to pass to the callback. + * @param string $columnToAdd The name of the column to add. + * @param mixed $functionToApply The callback to apply to each row of a DataTable. + * @param array $functionParameters Extra parameters to pass to $functionToApply. */ public function __construct($table, $columns, $columnToAdd, $functionToApply, $functionParameters = array()) { @@ -69,7 +69,7 @@ class ColumnCallbackAddColumn extends Filter * Executes a callback on every row of the supplied table and adds the result of * the callback as a new column to each row. * - * @param DataTable $table The table to filter. + * @param DataTable $table The table to filter. */ public function filter($table) { diff --git a/core/DataTable/Filter/ColumnCallbackAddColumnQuotient.php b/core/DataTable/Filter/ColumnCallbackAddColumnQuotient.php index 69862cfc44..79be1288fc 100644 --- a/core/DataTable/Filter/ColumnCallbackAddColumnQuotient.php +++ b/core/DataTable/Filter/ColumnCallbackAddColumnQuotient.php @@ -39,9 +39,9 @@ class ColumnCallbackAddColumnQuotient extends Filter * @param number|string $divisorValueOrDivisorColumnName * if a numeric value is given, we use this value as the divisor to process the percentage. * if a string is given, this string is the column name's value used as the divisor. - * @param int $quotientPrecision Division precision - * @param bool|number $shouldSkipRows Whether rows w/o the column to read should be skipped. - * @param bool $getDivisorFromSummaryRow Whether to get the divisor from the summary row or the current row. + * @param int $quotientPrecision Division precision + * @param bool|number $shouldSkipRows Whether rows w/o the column to read should be skipped. + * @param bool $getDivisorFromSummaryRow Whether to get the divisor from the summary row or the current row. */ public function __construct($table, $columnNameToAdd, $columnValueToRead, $divisorValueOrDivisorColumnName, $quotientPrecision = 0, $shouldSkipRows = false, $getDivisorFromSummaryRow = false) { @@ -106,7 +106,7 @@ class ColumnCallbackAddColumnQuotient extends Filter * Returns the dividend to use when calculating the new column value. Can * be overridden by descendent classes to customize behavior. * - * @param Row $row The row being modified. + * @param Row $row The row being modified. * @return int|float */ protected function getDividend($row) @@ -118,7 +118,7 @@ class ColumnCallbackAddColumnQuotient extends Filter * Returns the divisor to use when calculating the new column value. Can * be overridden by descendent classes to customize behavior. * - * @param Row $row The row being modified. + * @param Row $row The row being modified. * @return int|float */ protected function getDivisor($row) diff --git a/core/DataTable/Filter/ColumnDelete.php b/core/DataTable/Filter/ColumnDelete.php index 5540634ef8..040862ddbf 100644 --- a/core/DataTable/Filter/ColumnDelete.php +++ b/core/DataTable/Filter/ColumnDelete.php @@ -58,7 +58,7 @@ class ColumnDelete extends Filter * @param DataTable $table * @param array|string $columnsToRemove An array of column names or a comma-separated list of * column names. These columns will be removed. - * @param array|string $columnsToKeep An array of column names that should be kept or a + * @param array|string $columnsToKeep An array of column names that should be kept or a * comma-separated list of column names. Columns not in * this list will be removed. * @param bool $deleteIfZeroOnly diff --git a/core/DataTable/Filter/ExcludeLowPopulation.php b/core/DataTable/Filter/ExcludeLowPopulation.php index 47de3ed73e..cd9bc24add 100644 --- a/core/DataTable/Filter/ExcludeLowPopulation.php +++ b/core/DataTable/Filter/ExcludeLowPopulation.php @@ -39,8 +39,8 @@ class ExcludeLowPopulation extends Filter * Constructor * * @param DataTable $table - * @param string $columnToFilter column to filter - * @param number|\Closure $minimumValue minimum value + * @param string $columnToFilter column to filter + * @param number|\Closure $minimumValue minimum value * @param bool $minimumPercentageThreshold */ public function __construct($table, $columnToFilter, $minimumValue, $minimumPercentageThreshold = false) diff --git a/core/DataTable/Filter/GroupBy.php b/core/DataTable/Filter/GroupBy.php index 2dbc839c59..e33a2e7c9c 100755 --- a/core/DataTable/Filter/GroupBy.php +++ b/core/DataTable/Filter/GroupBy.php @@ -44,10 +44,10 @@ class GroupBy extends Filter /** * Constructor. * - * @param DataTable $table The DataTable to filter. - * @param string $groupByColumn The column name to reduce. - * @param mixed $reduceFunction The reduce function. This must alter the $groupByColumn in some way. - * @param array $parameters Extra parameters to supply to the reduce function. + * @param DataTable $table The DataTable to filter. + * @param string $groupByColumn The column name to reduce. + * @param mixed $reduceFunction The reduce function. This must alter the $groupByColumn in some way. + * @param array $parameters Extra parameters to supply to the reduce function. */ public function __construct($table, $groupByColumn, $reduceFunction, $parameters = array()) { diff --git a/core/DataTable/Filter/Limit.php b/core/DataTable/Filter/Limit.php index e040244a0b..db79c8a1ee 100644 --- a/core/DataTable/Filter/Limit.php +++ b/core/DataTable/Filter/Limit.php @@ -25,9 +25,9 @@ class Limit extends Filter * Filter constructor. * * @param DataTable $table - * @param int $offset Starting row (indexed from 0) - * @param int $limit Number of rows to keep (specify -1 to keep all rows) - * @param bool $keepSummaryRow Whether to keep the summary row or not. + * @param int $offset Starting row (indexed from 0) + * @param int $limit Number of rows to keep (specify -1 to keep all rows) + * @param bool $keepSummaryRow Whether to keep the summary row or not. */ public function __construct($table, $offset, $limit = -1, $keepSummaryRow = false) { diff --git a/core/DataTable/Filter/PatternRecursive.php b/core/DataTable/Filter/PatternRecursive.php index ceaab23d22..0415ce7d6b 100644 --- a/core/DataTable/Filter/PatternRecursive.php +++ b/core/DataTable/Filter/PatternRecursive.php @@ -11,7 +11,6 @@ namespace Piwik\DataTable\Filter; use Exception; - use Piwik\DataTable\Filter; use Piwik\DataTable; use Piwik\DataTable\Manager; diff --git a/core/DataTable/Filter/RangeCheck.php b/core/DataTable/Filter/RangeCheck.php index 5fc2db1c9c..bac24d4acc 100644 --- a/core/DataTable/Filter/RangeCheck.php +++ b/core/DataTable/Filter/RangeCheck.php @@ -26,9 +26,9 @@ class RangeCheck extends Filter /** * @param DataTable $table - * @param string $columnToFilter name of the column to filter - * @param float $minimumValue minimum value for range - * @param float $maximumValue maximum value for range + * @param string $columnToFilter name of the column to filter + * @param float $minimumValue minimum value for range + * @param float $maximumValue maximum value for range */ public function __construct($table, $columnToFilter, $minimumValue = 0.00, $maximumValue = 100.0) { diff --git a/core/DataTable/Filter/ReplaceColumnNames.php b/core/DataTable/Filter/ReplaceColumnNames.php index 932c42e599..e571c528fd 100644 --- a/core/DataTable/Filter/ReplaceColumnNames.php +++ b/core/DataTable/Filter/ReplaceColumnNames.php @@ -37,8 +37,8 @@ class ReplaceColumnNames extends Filter protected $mappingToApply; /** - * @param DataTable $table Table - * @param array $mappingToApply Mapping to apply. Must have the format + * @param DataTable $table Table + * @param array $mappingToApply Mapping to apply. Must have the format * array( OLD_COLUMN_NAME => NEW_COLUMN NAME, * OLD_COLUMN_NAME2 => NEW_COLUMN NAME2, * ) diff --git a/core/DataTable/Filter/ReplaceSummaryRowLabel.php b/core/DataTable/Filter/ReplaceSummaryRowLabel.php index ef20db28bf..0a7ef49dc7 100644 --- a/core/DataTable/Filter/ReplaceSummaryRowLabel.php +++ b/core/DataTable/Filter/ReplaceSummaryRowLabel.php @@ -23,7 +23,7 @@ class ReplaceSummaryRowLabel extends Filter { /** * @param DataTable $table - * @param string|null $newLabel new label for summary row + * @param string|null $newLabel new label for summary row */ public function __construct($table, $newLabel = null) { diff --git a/core/DataTable/Filter/Sort.php b/core/DataTable/Filter/Sort.php index 1b58a27269..9078c65f08 100644 --- a/core/DataTable/Filter/Sort.php +++ b/core/DataTable/Filter/Sort.php @@ -30,10 +30,10 @@ class Sort extends Filter /** * @param DataTable $table - * @param string $columnToSort name of the column to sort by - * @param string $order order (asc|desc) - * @param bool $naturalSort use natural sort? - * @param bool $recursiveSort sort recursively? + * @param string $columnToSort name of the column to sort by + * @param string $order order (asc|desc) + * @param bool $naturalSort use natural sort? + * @param bool $recursiveSort sort recursively? */ public function __construct($table, $columnToSort, $order = 'desc', $naturalSort = true, $recursiveSort = false) { @@ -49,7 +49,7 @@ class Sort extends Filter /** * Updates the order * - * @param string $order asc|desc + * @param string $order asc|desc */ public function setOrder($order) { @@ -72,7 +72,7 @@ class Sort extends Filter public function sort($a, $b) { return !isset($a->c[Row::COLUMNS][$this->columnToSort]) - && !isset($b->c[Row::COLUMNS][$this->columnToSort]) + && !isset($b->c[Row::COLUMNS][$this->columnToSort]) ? 0 : ( @@ -84,10 +84,10 @@ class Sort extends Filter : (($a->c[Row::COLUMNS][$this->columnToSort] != $b->c[Row::COLUMNS][$this->columnToSort] || !isset($a->c[Row::COLUMNS]['label'])) ? ($this->sign * ( - $a->c[Row::COLUMNS][$this->columnToSort] + $a->c[Row::COLUMNS][$this->columnToSort] < $b->c[Row::COLUMNS][$this->columnToSort] - ? -1 - : 1) + ? -1 + : 1) ) : -1 * $this->sign * strnatcasecmp( $a->c[Row::COLUMNS]['label'], @@ -107,7 +107,7 @@ class Sort extends Filter function naturalSort($a, $b) { return !isset($a->c[Row::COLUMNS][$this->columnToSort]) - && !isset($b->c[Row::COLUMNS][$this->columnToSort]) + && !isset($b->c[Row::COLUMNS][$this->columnToSort]) ? 0 : (!isset($a->c[Row::COLUMNS][$this->columnToSort]) ? 1 @@ -131,16 +131,16 @@ class Sort extends Filter function sortString($a, $b) { return !isset($a->c[Row::COLUMNS][$this->columnToSort]) - && !isset($b->c[Row::COLUMNS][$this->columnToSort]) + && !isset($b->c[Row::COLUMNS][$this->columnToSort]) ? 0 : (!isset($a->c[Row::COLUMNS][$this->columnToSort]) ? 1 : (!isset($b->c[Row::COLUMNS][$this->columnToSort]) ? -1 : $this->sign * - strcasecmp($a->c[Row::COLUMNS][$this->columnToSort], - $b->c[Row::COLUMNS][$this->columnToSort] - ) + strcasecmp($a->c[Row::COLUMNS][$this->columnToSort], + $b->c[Row::COLUMNS][$this->columnToSort] + ) ) ); } diff --git a/core/DataTable/Map.php b/core/DataTable/Map.php index 5ed65df1ad..2210b3d114 100644 --- a/core/DataTable/Map.php +++ b/core/DataTable/Map.php @@ -9,6 +9,7 @@ * @package Piwik */ namespace Piwik\DataTable; + use Piwik\DataTable; use Piwik\DataTable\Renderer\Console; @@ -75,8 +76,8 @@ class Map /** * Queue a filter to the DataTable\Map will queue this filter to every DataTable of the DataTable\Map. * - * @param string $className Filter name, eg. Limit - * @param array $parameters Filter parameters, eg. array( 50, 10 ) + * @param string $className Filter name, eg. Limit + * @param array $parameters Filter parameters, eg. array( 50, 10 ) */ public function queueFilter($className, $parameters = array()) { @@ -98,8 +99,8 @@ class Map /** * Apply a filter to all tables in the array * - * @param string $className Name of filter class - * @param array $parameters Filter parameters + * @param string $className Name of filter class + * @param array $parameters Filter parameters */ public function filter($className, $parameters = array()) { @@ -150,7 +151,7 @@ class Map * Adds a new DataTable to the DataTable\Map * * @param DataTable $table - * @param string $label Label used to index this table in the array + * @param string $label Label used to index this table in the array */ public function addTable($table, $label) { @@ -329,9 +330,9 @@ class Map * Utility function used by mergeChildren. Copies the rows from one table, * sets their 'label' columns to a value and adds them to another table. * - * @param DataTable $toTable The table to copy rows to. - * @param DataTable $fromTable The table to copy rows from. - * @param string $label The value to set the 'label' column of every copied row. + * @param DataTable $toTable The table to copy rows to. + * @param DataTable $fromTable The table to copy rows from. + * @param string $label The value to set the 'label' column of every copied row. */ private function copyRowsAndSetLabel($toTable, $fromTable, $label) { @@ -341,10 +342,10 @@ class Map $columns = array_merge(array('label' => $label), $oldColumns); $row = new Row(array( - Row::COLUMNS => $columns, - Row::METADATA => $fromRow->getMetadata(), - Row::DATATABLE_ASSOCIATED => $fromRow->getIdSubDataTable() - )); + Row::COLUMNS => $columns, + Row::METADATA => $fromRow->getMetadata(), + Row::DATATABLE_ASSOCIATED => $fromRow->getIdSubDataTable() + )); $toTable->addRow($row); } } @@ -414,7 +415,7 @@ class Map /** * @see DataTable::getColumns() - * + * * @return array */ public function getColumns() diff --git a/core/DataTable/Renderer.php b/core/DataTable/Renderer.php index 6a82af8f44..2ffeb913e4 100644 --- a/core/DataTable/Renderer.php +++ b/core/DataTable/Renderer.php @@ -143,7 +143,7 @@ abstract class Renderer /** * Set the DataTable to be rendered * - * @param DataTable|Simple|DataTable\Map $table table to be rendered + * @param DataTable|Simple|DataTable\Map $table table to be rendered * @throws Exception */ public function setTable($table) @@ -160,7 +160,7 @@ abstract class Renderer /** * Set the Exception to be rendered * - * @param Exception $exception to be rendered + * @param Exception $exception to be rendered * @throws Exception */ public function setException($exception) @@ -216,7 +216,7 @@ abstract class Renderer /** * Returns $rawData after all applicable characters have been converted to HTML entities. * - * @param String $rawData data to be converted + * @param String $rawData data to be converted * @return String */ static protected function renderHtmlEntities($rawData) @@ -227,7 +227,7 @@ abstract class Renderer /** * Format a value to xml * - * @param string|number|bool $value value to format + * @param string|number|bool $value value to format * @return int|string */ public static function formatValueXml($value) diff --git a/core/DataTable/Renderer/Console.php b/core/DataTable/Renderer/Console.php index d0b509de3d..667ea97a78 100644 --- a/core/DataTable/Renderer/Console.php +++ b/core/DataTable/Renderer/Console.php @@ -55,7 +55,7 @@ class Console extends Renderer /** * Sets the prefix to be used * - * @param string $str new prefix + * @param string $str new prefix */ public function setPrefixRow($str) { @@ -65,8 +65,8 @@ class Console extends Renderer /** * Computes the output of the given array of data tables * - * @param DataTable\Map $map data tables to render - * @param string $prefix prefix to output before table data + * @param DataTable\Map $map data tables to render + * @param string $prefix prefix to output before table data * @return string */ protected function renderDataTableMap(DataTable\Map $map, $prefix) @@ -84,8 +84,8 @@ class Console extends Renderer /** * Computes the given dataTable output and returns the string/binary * - * @param DataTable $table data table to render - * @param string $prefix prefix to output before table data + * @param DataTable $table data table to render + * @param string $prefix prefix to output before table data * @return string */ protected function renderTable($table, $prefix = "") diff --git a/core/DataTable/Renderer/Json.php b/core/DataTable/Renderer/Json.php index ad22cab3ad..5c1ee83ed6 100644 --- a/core/DataTable/Renderer/Json.php +++ b/core/DataTable/Renderer/Json.php @@ -78,8 +78,8 @@ class Json extends Renderer } // decode all entities - $callback = function(&$value,$key) { - if(is_string($value)) { + $callback = function (&$value, $key) { + if (is_string($value)) { $value = html_entity_decode($value, ENT_QUOTES, "UTF-8"); }; }; diff --git a/core/DataTable/Renderer/Tsv.php b/core/DataTable/Renderer/Tsv.php index 97c9b8875a..2a727a5594 100644 --- a/core/DataTable/Renderer/Tsv.php +++ b/core/DataTable/Renderer/Tsv.php @@ -11,7 +11,6 @@ namespace Piwik\DataTable\Renderer; - /** * TSV export * diff --git a/core/DataTable/Renderer/Xml.php b/core/DataTable/Renderer/Xml.php index ec4a6585cf..cdcc9a6485 100644 --- a/core/DataTable/Renderer/Xml.php +++ b/core/DataTable/Renderer/Xml.php @@ -11,7 +11,6 @@ namespace Piwik\DataTable\Renderer; use Exception; - use Piwik\DataTable\Map; use Piwik\DataTable\Renderer; use Piwik\DataTable; diff --git a/core/DataTable/Row.php b/core/DataTable/Row.php index 8ac6f29617..19cc39508c 100644 --- a/core/DataTable/Row.php +++ b/core/DataTable/Row.php @@ -70,7 +70,7 @@ class Row /** * Efficient load of the Row structure from a well structured php array * - * @param array $row The row array has the structure + * @param array $row The row array has the structure * array( * Row::COLUMNS => array( * 'label' => 'Piwik', @@ -172,7 +172,7 @@ class Row /** * Deletes the given column * - * @param string $name Column name + * @param string $name Column name * @return bool True on success, false if the column didn't exist */ public function deleteColumn($name) @@ -202,7 +202,7 @@ class Row /** * Returns the given column * - * @param string $name Column name + * @param string $name Column name * @return mixed|bool The column value or false if it doesn't exist */ public function getColumn($name) @@ -217,7 +217,7 @@ class Row * Returns the array of all metadata, * or the specified metadata * - * @param string $name Metadata name + * @param string $name Metadata name * @return mixed */ public function getMetadata($name = null) @@ -277,7 +277,7 @@ class Row * If this row doesn't have a SubDataTable yet, we create a new one. * Then we add the values of the given DataTable to this row's DataTable. * - * @param DataTable $subTable Table to sum to this row's subDatatable + * @param DataTable $subTable Table to sum to this row's subDatatable * @see DataTable::addDataTable() for the algorithm used for the sum */ public function sumSubtable(DataTable $subTable) @@ -296,7 +296,7 @@ class Row * Set a DataTable to be associated to this row. * If the row already has a DataTable associated to it, throws an Exception. * - * @param DataTable $subTable DataTable to associate to this row + * @param DataTable $subTable DataTable to associate to this row * @return DataTable Returns $subTable. * @throws Exception */ @@ -312,7 +312,7 @@ class Row * Set a DataTable to this row. If there is already * a DataTable associated, it is simply overwritten. * - * @param DataTable $subTable DataTable to associate to this row + * @param DataTable $subTable DataTable to associate to this row * @return DataTable Returns $subTable. */ public function setSubtable(DataTable $subTable) @@ -334,7 +334,7 @@ class Row // self::DATATABLE_ASSOCIATED are set as negative values, // as a flag to signify that the subtable is loaded in memory return !is_null($this->c[self::DATATABLE_ASSOCIATED]) - && $this->c[self::DATATABLE_ASSOCIATED] < 0; + && $this->c[self::DATATABLE_ASSOCIATED] < 0; } /** @@ -361,8 +361,8 @@ class Row /** * Set the value $value to the column called $name. * - * @param string $name name of the column to set - * @param mixed $value value of the column to set + * @param string $name name of the column to set + * @param mixed $value value of the column to set */ public function setColumn($name, $value) { @@ -372,8 +372,8 @@ class Row /** * Set the value $value to the metadata called $name. * - * @param string $name name of the metadata to set - * @param mixed $value value of the metadata to set + * @param string $name name of the metadata to set + * @param mixed $value value of the metadata to set */ public function setMetadata($name, $value) { @@ -383,7 +383,7 @@ class Row /** * Deletes the given metadata * - * @param bool|string $name Meta column name (omit to delete entire metadata) + * @param bool|string $name Meta column name (omit to delete entire metadata) * @return bool True on success, false if the column didn't exist */ public function deleteMetadata($name = false) @@ -402,8 +402,8 @@ class Row /** * Add a new column to the row. If the column already exists, throws an exception * - * @param string $name name of the column to add - * @param mixed $value value of the column to set + * @param string $name name of the column to add + * @param mixed $value value of the column to set * @throws Exception */ public function addColumn($name, $value) @@ -418,7 +418,7 @@ class Row /** * Add columns to the row * - * @param array $columns Name/Value pairs, e.g., array( name => value , ...) + * @param array $columns Name/Value pairs, e.g., array( name => value , ...) * * @throws Exception * @return void @@ -440,8 +440,8 @@ class Row /** * Add a new metadata to the row. If the column already exists, throws an exception. * - * @param string $name name of the metadata to add - * @param mixed $value value of the metadata to set + * @param string $name name of the metadata to add + * @param mixed $value value of the metadata to set * @throws Exception */ public function addMetadata($name, $value) @@ -462,7 +462,7 @@ class Row * * @param \Piwik\DataTable\Row $rowToSum * @param bool $enableCopyMetadata - * @param array $aggregationOperations for columns that should not be summed, determine which + * @param array $aggregationOperations for columns that should not be summed, determine which * aggregation should be used (min, max). * format: column name => function name */ @@ -623,8 +623,8 @@ class Row * - if they have exactly the same columns / metadata * - if they have a subDataTable associated, then we check that both of them are the same. * - * @param \Piwik\DataTable\Row $row1 first to compare - * @param \Piwik\DataTable\Row $row2 second to compare + * @param \Piwik\DataTable\Row $row1 first to compare + * @param \Piwik\DataTable\Row $row2 second to compare * @return bool */ static public function isEqual(Row $row1, Row $row2) diff --git a/core/DataTable/Simple.php b/core/DataTable/Simple.php index 5dc11d780b..1a9341221f 100644 --- a/core/DataTable/Simple.php +++ b/core/DataTable/Simple.php @@ -9,6 +9,7 @@ * @package Piwik */ namespace Piwik\DataTable; + use Piwik\DataTable; /** @@ -29,7 +30,7 @@ class Simple extends DataTable /** * Loads (append) in the DataTable the array information * - * @param array $array Array containing the rows information + * @param array $array Array containing the rows information * array( * 'Label row 1' => Value row 1, * 'Label row 2' => Value row 2, diff --git a/core/Date.php b/core/Date.php index a32d7091a8..1b0d31e4d6 100644 --- a/core/Date.php +++ b/core/Date.php @@ -10,6 +10,7 @@ */ namespace Piwik; + use Exception; /** @@ -57,8 +58,8 @@ class Date /** * Returns a Date objects. * - * @param string|\Piwik\Date $dateString 'today' 'yesterday' or any YYYY-MM-DD or timestamp - * @param string $timezone if specified, the dateString will be relative to this $timezone. + * @param string|\Piwik\Date $dateString 'today' 'yesterday' or any YYYY-MM-DD or timestamp + * @param string $timezone if specified, the dateString will be relative to this $timezone. * For example, today in UTC+12 will be a timestamp in the future for UTC. * This is different from using ->setTimezone() * @throws Exception @@ -83,8 +84,8 @@ class Date // strtotime returns the timestamp for April 1st for a date like 2011-04-01,today // but we don't want this, as this is a date range and supposed to throw the exception strpos($dateString, ',') !== false - || - ($dateString = strtotime($dateString)) === false + || + ($dateString = strtotime($dateString)) === false ) ) { throw $invalidDateException; @@ -144,7 +145,7 @@ class Date * This timezone is used to offset the UTC timestamp returned by @see getTimestamp() * Doesn't modify $this * - * @param string $timezone 'UTC', 'Europe/London', ... + * @param string $timezone 'UTC', 'Europe/London', ... * @return \Piwik\Date */ public function setTimezone($timezone) @@ -180,8 +181,8 @@ class Date /** * Adjusts a UNIX timestamp in UTC to a specific timezone. * - * @param int $timestamp The UNIX timestamp to adjust. - * @param string $timezone The timezone to adjust to. + * @param int $timestamp The UNIX timestamp to adjust. + * @param string $timezone The timezone to adjust to. * @return int The adjusted time as seconds from EPOCH. */ public static function adjustForTimezone($timestamp, $timezone) @@ -311,7 +312,7 @@ class Date * Returns 0 if equal, -1 if current month is earlier or 1 if current month is later * For example: 10.03.2000 -> 15.03.1950 -> 0 * - * @param \Piwik\Date $date Month to compare + * @param \Piwik\Date $date Month to compare * @return int 0 = equal, 1 = later, -1 = earlier */ public function compareMonth(Date $date) @@ -381,7 +382,7 @@ class Date * Sets the time part of the date * Doesn't modify $this * - * @param string $time HH:MM:SS + * @param string $time HH:MM:SS * @return \Piwik\Date The new date with the time part set */ public function setTime($time) @@ -394,7 +395,7 @@ class Date * Returned is the new date object * Doesn't modify $this * - * @param int $day Day eg. 31 + * @param int $day Day eg. 31 * @return \Piwik\Date new date */ public function setDay($day) @@ -416,7 +417,7 @@ class Date * Returned is the new date object * Doesn't modify $this * - * @param int $year 2010 + * @param int $year 2010 * @return \Piwik\Date new date */ public function setYear($year) @@ -517,7 +518,7 @@ class Date * Returns a localized date string, given a template. * Allowed tags are: %day%, %shortDay%, %longDay%, etc. * - * @param string $template string eg. %shortMonth% %longYear% + * @param string $template string eg. %shortMonth% %longYear% * @return string eg. "Aug 2009" */ public function getLocalized($template) @@ -544,7 +545,7 @@ class Date * Returned is the new date object * Doesn't modify $this * - * @param int $n Number of days to add + * @param int $n Number of days to add * @return \Piwik\Date new date */ public function addDay($n) @@ -558,7 +559,7 @@ class Date * Returned is the new date object * Doesn't modify $this * - * @param int $n Number of hours to add + * @param int $n Number of hours to add * @return \Piwik\Date new date */ public function addHour($n) @@ -570,8 +571,8 @@ class Date /** * Adds N number of hours to a UNIX timestamp and returns the result. * - * @param int $timestamp The timestamp to add to. - * @param number $n Number of hours to add. + * @param int $timestamp The timestamp to add to. + * @param number $n Number of hours to add. * @return int The result as a UNIX timestamp. */ public static function addHourTo($timestamp, $n) @@ -604,7 +605,7 @@ class Date * Returned is the new date object * Doesn't modify $this * - * @param int $n Number of hours to substract + * @param int $n Number of hours to substract * @return \Piwik\Date new date */ public function subHour($n) @@ -618,7 +619,7 @@ class Date * Doesn't modify $this * * @param int $n - * @param string $period period to add (WEEK, DAY,...) + * @param string $period period to add (WEEK, DAY,...) * @return \Piwik\Date new date */ public function addPeriod($n, $period) @@ -637,7 +638,7 @@ class Date * Doesn't modify $this * * @param int $n - * @param string $period period to sub + * @param string $period period to sub * @return \Piwik\Date new date */ public function subPeriod($n, $period) @@ -647,7 +648,7 @@ class Date /** * Returns the number of days represented by a number of seconds. - * + * * @param int $secs * @return float */ diff --git a/core/Db.php b/core/Db.php index 6a9789122b..b7e0dd59c5 100644 --- a/core/Db.php +++ b/core/Db.php @@ -147,8 +147,8 @@ class Db /** * Fetches first row of result from the database query * - * @param string $sql SQL Query - * @param array $parameters Parameters to bind in the query, array( param1 => value1, param2 => value2) + * @param string $sql SQL Query + * @param array $parameters Parameters to bind in the query, array( param1 => value1, param2 => value2) * @return array * @throws \Exception */ @@ -165,8 +165,8 @@ class Db /** * Fetches first column of first row of result from the database query * - * @param string $sql SQL Query - * @param array $parameters Parameters to bind in the query, array( param1 => value1, param2 => value2) + * @param string $sql SQL Query + * @param array $parameters Parameters to bind in the query, array( param1 => value1, param2 => value2) * @return string * @throws \Exception */ @@ -183,8 +183,8 @@ class Db /** * Fetches result from the database query as an array of associative arrays. * - * @param string $sql SQL query - * @param array $parameters Parameters to bind in the query, array( param1 => value1, param2 => value2) + * @param string $sql SQL query + * @param array $parameters Parameters to bind in the query, array( param1 => value1, param2 => value2) * @return array * @throws \Exception */ @@ -202,11 +202,11 @@ class Db * Deletes all desired rows in a table, while using a limit. This function will execute a * DELETE query until there are no more rows to delete. * - * @param string $table The name of the table to delete from. Must be prefixed. - * @param string $where The where clause of the query. Must include the WHERE keyword. + * @param string $table The name of the table to delete from. Must be prefixed. + * @param string $where The where clause of the query. Must include the WHERE keyword. * @param $orderBy - * @param int $maxRowsPerQuery The maximum number of rows to delete per DELETE query. - * @param array $parameters Parameters to bind in the query. + * @param int $maxRowsPerQuery The maximum number of rows to delete per DELETE query. + * @param array $parameters Parameters to bind in the query. * @return int The total number of rows deleted. */ static public function deleteAllRows($table, $where, $orderBy, $maxRowsPerQuery = 100000, $parameters = array()) @@ -230,7 +230,7 @@ class Db /** * Runs an OPTIMIZE TABLE query on the supplied table or tables. The table names must be prefixed. * - * @param string|array $tables The name of the table to optimize or an array of tables to optimize. + * @param string|array $tables The name of the table to optimize or an array of tables to optimize. * @return \Zend_Db_Statement */ static public function optimizeTables($tables) @@ -268,7 +268,7 @@ class Db /** * Drops the supplied table or tables. The table names must be prefixed. * - * @param string|array $tables The name of the table to drop or an array of table names to drop. + * @param string|array $tables The name of the table to drop or an array of table names to drop. * @return \Zend_Db_Statement */ static public function dropTables($tables) @@ -283,8 +283,8 @@ class Db /** * Locks the supplied table or tables. The table names must be prefixed. * - * @param string|array $tablesToRead The table or tables to obtain 'read' locks on. - * @param string|array $tablesToWrite The table or tables to obtain 'write' locks on. + * @param string|array $tablesToRead The table or tables to obtain 'read' locks on. + * @param string|array $tablesToWrite The table or tables to obtain 'write' locks on. * @return \Zend_Db_Statement */ static public function lockTables($tablesToRead, $tablesToWrite = array()) @@ -326,13 +326,13 @@ class Db * Using several smaller SELECTs 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 + * @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. - * @param int $first The minimum ID to loop from. - * @param int $last The maximum ID to loop to. - * @param int $step The maximum number of rows to scan in each smaller SELECT. - * @param array $params Parameters to bind in the query, array( param1 => value1, param2 => value2) + * @param int $first The minimum ID to loop from. + * @param int $last The maximum ID to loop to. + * @param int $step The maximum number of rows to scan in each smaller SELECT. + * @param array $params Parameters to bind in the query, array( param1 => value1, param2 => value2) * * @return string */ @@ -361,13 +361,13 @@ class Db * for too long. * * - * @param string $sql The SQL to perform. The last two conditions of the WHERE + * @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. - * @param int $first The minimum ID to loop from. - * @param int $last The maximum ID to loop to. - * @param int $step The maximum number of rows to scan in each smaller SELECT. - * @param array $params Parameters to bind in the query, array( param1 => value1, param2 => value2) + * @param int $first The minimum ID to loop from. + * @param int $last The maximum ID to loop to. + * @param int $step The maximum number of rows to scan in each smaller SELECT. + * @param array $params Parameters to bind in the query, array( param1 => value1, param2 => value2) * * @return array */ @@ -390,13 +390,13 @@ class Db * Performs a SELECT on a table one chunk at a time and returns an array * of every fetched row. * - * @param string $sql The SQL to perform. The last two conditions of the WHERE + * @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. - * @param int $first The minimum ID to loop from. - * @param int $last The maximum ID to loop to. - * @param int $step The maximum number of rows to scan in each smaller SELECT. - * @param array $params Parameters to bind in the query, array( param1 => value1, param2 => value2) + * @param int $first The minimum ID to loop from. + * @param int $last The maximum ID to loop to. + * @param int $step The maximum number of rows to scan in each smaller SELECT. + * @param array $params Parameters to bind in the query, array( param1 => value1, param2 => value2) * * @return array */ @@ -420,13 +420,13 @@ class Db /** * Performs a non-SELECT query on a table one chunk at a time. * - * @param string $sql The SQL to perform. The last two conditions of the WHERE + * @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. - * @param int $first The minimum ID to loop from. - * @param int $last The maximum ID to loop to. - * @param int $step The maximum number of rows to scan in each smaller query. - * @param array $params Parameters to bind in the query, array( param1 => value1, param2 => value2) + * @param int $first The minimum ID to loop from. + * @param int $last The maximum ID to loop to. + * @param int $step The maximum number of rows to scan in each smaller query. + * @param array $params Parameters to bind in the query, array( param1 => value1, param2 => value2) * * @return array */ diff --git a/core/Db/Adapter.php b/core/Db/Adapter.php index dbcff64b59..a090fd9420 100644 --- a/core/Db/Adapter.php +++ b/core/Db/Adapter.php @@ -75,7 +75,7 @@ class Adapter */ private static function getAdapterClassName($adapterName) { - return 'Piwik\Db\Adapter\\' . str_replace(' ', '\\', ucwords(str_replace(array('_','\\'), ' ', strtolower($adapterName)))); + return 'Piwik\Db\Adapter\\' . str_replace(' ', '\\', ucwords(str_replace(array('_', '\\'), ' ', strtolower($adapterName)))); } /** diff --git a/core/Db/Adapter/Mysqli.php b/core/Db/Adapter/Mysqli.php index 544c25443d..eb76b9f552 100644 --- a/core/Db/Adapter/Mysqli.php +++ b/core/Db/Adapter/Mysqli.php @@ -25,7 +25,7 @@ class Mysqli extends Zend_Db_Adapter_Mysqli implements AdapterInterface /** * Constructor * - * @param array|Zend_Config $config database configuration + * @param array|Zend_Config $config database configuration */ public function __construct($config) { diff --git a/core/Db/Adapter/Pdo/Mysql.php b/core/Db/Adapter/Pdo/Mysql.php index bd14b9ddf4..03ddc9ccad 100644 --- a/core/Db/Adapter/Pdo/Mysql.php +++ b/core/Db/Adapter/Pdo/Mysql.php @@ -29,7 +29,7 @@ class Mysql extends Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface /** * Constructor * - * @param array|Zend_Config $config database configuration + * @param array|Zend_Config $config database configuration */ public function __construct($config) { @@ -207,8 +207,8 @@ class Mysql extends Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface * Prepares and executes an SQL statement with bound data. * Caches prepared statements to avoid preparing the same query more than once * - * @param string|Zend_Db_Select $sql The SQL statement with placeholders. - * @param array $bind An array of data to bind to the placeholders. + * @param string|Zend_Db_Select $sql The SQL statement with placeholders. + * @param array $bind An array of data to bind to the placeholders. * @return Zend_Db_Statement_Interface */ public function query($sql, $bind = array()) diff --git a/core/Db/BatchInsert.php b/core/Db/BatchInsert.php index 2f2bd97948..94560d1044 100644 --- a/core/Db/BatchInsert.php +++ b/core/Db/BatchInsert.php @@ -15,8 +15,8 @@ use Piwik\AssetManager; use Piwik\Common; use Piwik\Config; use Piwik\Db; -use Piwik\DbHelper; +use Piwik\DbHelper; use Piwik\Log; use Piwik\SettingsPiwik; use Piwik\SettingsServer; @@ -28,10 +28,10 @@ class BatchInsert * * NOTE: you should use tableInsertBatch() which will fallback to this function if LOAD DATA INFILE not available * - * @param string $tableName PREFIXED table name! you must call Common::prefixTable() before passing the table name - * @param array $fields array of unquoted field names - * @param array $values array of data to be inserted - * @param bool $ignoreWhenDuplicate Ignore new rows that contain unique key values that duplicate old rows + * @param string $tableName PREFIXED table name! you must call Common::prefixTable() before passing the table name + * @param array $fields array of unquoted field names + * @param array $values array of data to be inserted + * @param bool $ignoreWhenDuplicate Ignore new rows that contain unique key values that duplicate old rows */ public static function tableInsertBatchIterate($tableName, $fields, $values, $ignoreWhenDuplicate = true) { @@ -51,9 +51,9 @@ class BatchInsert * Performs a batch insert into a specific table using either LOAD DATA INFILE or plain INSERTs, * as a fallback. On MySQL, LOAD DATA INFILE is 20x faster than a series of plain INSERTs. * - * @param string $tableName PREFIXED table name! you must call Common::prefixTable() before passing the table name - * @param array $fields array of unquoted field names - * @param array $values array of data to be inserted + * @param string $tableName PREFIXED table name! you must call Common::prefixTable() before passing the table name + * @param array $fields array of unquoted field names + * @param array $values array of data to be inserted * @param bool $throwException Whether to throw an exception that was caught while trying * LOAD DATA INFILE, or not. * @throws Exception @@ -71,8 +71,8 @@ class BatchInsert 'quote' => '"', // chr(34) 'escape' => '\\\\', // chr(92) 'escapespecial_cb' => function ($str) { - return str_replace(array(chr(92), chr(34)), array(chr(92) . chr(92), chr(92) . chr(34)), $str); - }, + return str_replace(array(chr(92), chr(34)), array(chr(92) . chr(92), chr(92) . chr(34)), $str); + }, 'eol' => "\r\n", 'null' => 'NULL', ); @@ -111,10 +111,10 @@ class BatchInsert /** * Batch insert into table from CSV (or other delimited) file. * - * @param string $tableName Name of table - * @param array $fields Field names - * @param string $filePath Path name of a file. - * @param array $fileSpec File specifications (delimiter, line terminator, etc) + * @param string $tableName Name of table + * @param array $fields Field names + * @param string $filePath Path name of a file. + * @param array $fileSpec File specifications (delimiter, line terminator, etc) * * @throws Exception * @return bool True if successful; false otherwise @@ -203,9 +203,9 @@ class BatchInsert /** * Create CSV (or other delimited) files * - * @param string $filePath filename to create - * @param array $fileSpec File specifications (delimiter, line terminator, etc) - * @param array $rows Array of array corresponding to rows of values + * @param string $filePath filename to create + * @param array $fileSpec File specifications (delimiter, line terminator, etc) + * @param array $rows Array of array corresponding to rows of values * @throws Exception if unable to create or write to file */ static protected function createCSVFile($filePath, $fileSpec, $rows) diff --git a/core/Db/Schema.php b/core/Db/Schema.php index acf71e6a6a..dab7f016b1 100644 --- a/core/Db/Schema.php +++ b/core/Db/Schema.php @@ -165,7 +165,7 @@ class Schema /** * Get the SQL to create a specific Piwik table * - * @param string $tableName name of the table to create + * @param string $tableName name of the table to create * @return string SQL */ public function getTableCreateSql($tableName) @@ -186,7 +186,7 @@ class Schema /** * Create database * - * @param null|string $dbName database name to create + * @param null|string $dbName database name to create */ public function createDatabase($dbName = null) { @@ -249,7 +249,7 @@ class Schema /** * Get list of tables installed * - * @param bool $forceReload Invalidate cache + * @param bool $forceReload Invalidate cache * @return array installed tables */ public function getTablesInstalled($forceReload = true) diff --git a/core/Db/Schema/Myisam.php b/core/Db/Schema/Myisam.php index 15827facd5..080df61cea 100644 --- a/core/Db/Schema/Myisam.php +++ b/core/Db/Schema/Myisam.php @@ -409,7 +409,7 @@ class Myisam implements SchemaInterface /** * Get list of tables installed * - * @param bool $forceReload Invalidate cache + * @param bool $forceReload Invalidate cache * @return array installed Tables */ public function getTablesInstalled($forceReload = true) @@ -456,7 +456,7 @@ class Myisam implements SchemaInterface /** * Create database * - * @param string $dbName Name of the database to create + * @param string $dbName Name of the database to create */ public function createDatabase($dbName = null) { @@ -523,7 +523,7 @@ class Myisam implements SchemaInterface /** * Drop specific tables * - * @param array $doNotDelete Names of tables to not delete + * @param array $doNotDelete Names of tables to not delete */ public function dropTables($doNotDelete = array()) { diff --git a/core/Db/SchemaInterface.php b/core/Db/SchemaInterface.php index c8ad0eb340..7e677662ae 100644 --- a/core/Db/SchemaInterface.php +++ b/core/Db/SchemaInterface.php @@ -44,7 +44,7 @@ interface SchemaInterface /** * Create database * - * @param string $dbName Name of the database to create + * @param string $dbName Name of the database to create */ public function createDatabase($dbName = null); @@ -71,7 +71,7 @@ interface SchemaInterface /** * Drop specific tables * - * @param array $doNotDelete Names of tables to not delete + * @param array $doNotDelete Names of tables to not delete */ public function dropTables($doNotDelete = array()); @@ -86,7 +86,7 @@ interface SchemaInterface /** * Get list of tables installed * - * @param bool $forceReload Invalidate cache + * @param bool $forceReload Invalidate cache * @return array installed Tables */ public function getTablesInstalled($forceReload = true); diff --git a/core/DbHelper.php b/core/DbHelper.php index 91c6065e2b..77ee814ee7 100644 --- a/core/DbHelper.php +++ b/core/DbHelper.php @@ -19,7 +19,7 @@ class DbHelper /** * Get list of tables installed * - * @param bool $forceReload Invalidate cache + * @param bool $forceReload Invalidate cache * @return array Tables installed */ public static function getTablesInstalled($forceReload = true) @@ -30,7 +30,7 @@ class DbHelper /** * Drop specific tables * - * @param array $doNotDelete Names of tables to not delete + * @param array $doNotDelete Names of tables to not delete */ public static function dropTables($doNotDelete = array()) { @@ -82,7 +82,7 @@ class DbHelper */ public static function dropDatabase() { - if(defined('PIWIK_TEST_MODE') && PIWIK_TEST_MODE) { + if (defined('PIWIK_TEST_MODE') && PIWIK_TEST_MODE) { Schema::getInstance()->dropDatabase(); } } diff --git a/core/Error.php b/core/Error.php index dd6aac105b..9b1ed7b8dd 100644 --- a/core/Error.php +++ b/core/Error.php @@ -18,49 +18,49 @@ class Error { /** * The backtrace string to use when testing. - * + * * @var string */ public static $debugBacktraceForTests = null; /** * The error number. See http://php.net/manual/en/errorfunc.constants.php#errorfunc.constants.errorlevels - * + * * @var int */ public $errno; /** * The error message. - * + * * @var string */ public $errstr; /** * The file in which the error occurred. - * + * * @var string */ public $errfile; /** * The line number on which the error occurred. - * + * * @var int */ public $errline; /** * The error backtrace. - * + * * @var string */ public $backtrace; /** * Constructor. - * + * * @param int $errno * @param string $errstr * @param string $errfile @@ -118,7 +118,7 @@ class Error { if ($message instanceof Error) { $message = $message->errfile . '(' . $message->errline . '): ' . $message->getErrNoString() - . ' - ' . $message->errstr . "\n" . $message->backtrace; + . ' - ' . $message->errstr . "\n" . $message->backtrace; $message = $log->formatMessage($level, $tag, $datetime, $message); } diff --git a/core/EventDispatcher.php b/core/EventDispatcher.php index 5122250b08..6f3556a11c 100644 --- a/core/EventDispatcher.php +++ b/core/EventDispatcher.php @@ -10,6 +10,7 @@ */ namespace Piwik; + use Piwik\Plugin; /** @@ -22,12 +23,12 @@ class EventDispatcher const EVENT_CALLBACK_GROUP_FIRST = 0; const EVENT_CALLBACK_GROUP_SECOND = 1; const EVENT_CALLBACK_GROUP_THIRD = 2; - + /** * Singleton instance. */ private static $instance = null; - + /** * Returns the singleton EventDispatcher instance. Creates it if necessary. */ @@ -38,31 +39,31 @@ class EventDispatcher } return self::$instance; } - + /** * Array of observers (callbacks attached to events) that are not methods * of plugin classes. - * + * * @var array */ private $extraObservers = array(); - + /** * Array storing information for all pending events. Each item in the array * will be an array w/ two elements: - * + * * array( * 'Event.Name', // the event name * array('event', 'parameters') // the parameters to pass to event observers * ) - * + * * @var array */ private $pendingEvents = array(); - + /** * Triggers an event, executing all callbacks associated with it. - * + * * @param string $eventName The name of the event, ie, API.getReportMetadata. * @param array $params The parameters to pass to each callback when executing. * @param bool $pending Whether this event should be posted again for plugins @@ -77,36 +78,36 @@ class EventDispatcher if ($pending) { $this->pendingEvents[] = array($eventName, $params); } - + if (empty($plugins)) { $plugins = PluginsManager::getInstance()->getLoadedPlugins(); } - + $callbacks = array(); - + // collect all callbacks to execute foreach ($plugins as $plugin) { if (is_string($plugin)) { $plugin = PluginsManager::getInstance()->getLoadedPlugin($plugin); } - + $hooks = $plugin->getListHooksRegistered(); - + if (isset($hooks[$eventName])) { list($pluginFunction, $callbackGroup) = $this->getCallbackFunctionAndGroupNumber($hooks[$eventName]); - + $callbacks[$callbackGroup][] = array($plugin, $pluginFunction); } } - + if (isset($this->extraObservers[$eventName])) { foreach ($this->extraObservers[$eventName] as $callbackInfo) { list($callback, $callbackGroup) = $this->getCallbackFunctionAndGroupNumber($callbackInfo); - + $callbacks[$callbackGroup][] = $callback; } } - + // execute callbacks in order foreach ($callbacks as $callbackGroup) { foreach ($callbackGroup as $callback) { @@ -114,11 +115,11 @@ class EventDispatcher } } } - + /** * Associates a callback that is not a plugin class method with an event * name. - * + * * @param string $eventName * @param array|callable $callback This can be a normal PHP callback or an array * that looks like this: @@ -139,20 +140,20 @@ class EventDispatcher { $this->extraObservers[$eventName][] = $callback; } - + /** * Removes all registered observers for an event name. Only used for testing. - * + * * @param string $eventName */ public function clearObservers($eventName) { $this->extraObservers[$eventName] = array(); } - + /** * Re-posts all pending events to the given plugin. - * + * * @param Plugin $plugin */ public function postPendingEventsTo($plugin) @@ -162,7 +163,7 @@ class EventDispatcher $this->postEvent($eventName, $eventParams, $pending = false, array($plugin)); } } - + private function getCallbackFunctionAndGroupNumber($hookInfo) { if (is_array($hookInfo) @@ -180,7 +181,7 @@ class EventDispatcher $pluginFunction = $hookInfo; $callbackGroup = self::EVENT_CALLBACK_GROUP_SECOND; } - + return array($pluginFunction, $callbackGroup); } } diff --git a/core/ExceptionHandler.php b/core/ExceptionHandler.php index 13cca7f35d..7df2734884 100644 --- a/core/ExceptionHandler.php +++ b/core/ExceptionHandler.php @@ -21,7 +21,7 @@ class ExceptionHandler { /** * The backtrace string to use when testing. - * + * * @var string */ public static $debugBacktraceForTests = null; @@ -39,7 +39,7 @@ class ExceptionHandler { if ($message instanceof \Exception) { $message = sprintf("%s(%d): %s\n%s", $message->getFile(), $message->getLine(), $message->getMessage(), - self::$debugBacktraceForTests ?: $message->getTraceAsString()); + self::$debugBacktraceForTests ? : $message->getTraceAsString()); $message = $log->formatMessage($level, $tag, $datetime, $message); } diff --git a/core/Filechecks.php b/core/Filechecks.php index d85c246c52..8798b78235 100644 --- a/core/Filechecks.php +++ b/core/Filechecks.php @@ -116,7 +116,7 @@ class Filechecks require_once $manifest; } - if(!class_exists('\\Piwik\\Manifest')){ + if (!class_exists('\\Piwik\\Manifest')) { $messages[] = Piwik_Translate('General_WarningFileIntegrityNoManifest') . " If you are deploying Piwik from Git, this message is normal."; return $messages; } diff --git a/core/Filesystem.php b/core/Filesystem.php index feb02fd0b0..95a38681f4 100644 --- a/core/Filesystem.php +++ b/core/Filesystem.php @@ -46,7 +46,7 @@ class Filesystem * * Apache-specific; for IIS @see web.config * - * @param string $path without trailing slash + * @param string $path without trailing slash * @param bool $overwrite whether to overwrite an existing file or not * @param string $content */ @@ -169,9 +169,9 @@ class Filesystem * Recursively find pathnames that match a pattern * @see glob() * - * @param string $sDir directory - * @param string $sPattern pattern - * @param int $nFlags glob() flags + * @param string $sDir directory + * @param string $sPattern pattern + * @param int $nFlags glob() flags * @return array */ public static function globr($sDir, $sPattern, $nFlags = null) @@ -195,8 +195,8 @@ class Filesystem /** * Recursively delete a directory * - * @param string $dir Directory name - * @param boolean $deleteRootToo Delete specified top-level directory as well + * @param string $dir Directory name + * @param boolean $deleteRootToo Delete specified top-level directory as well * @param \Closure|false $beforeUnlink A closure to execute before unlinking. */ public static function unlinkRecursive($dir, $deleteRootToo, \Closure $beforeUnlink = null) @@ -228,8 +228,8 @@ class Filesystem /** * Copy individual file from $source to $target. * - * @param string $source eg. './tmp/latest/index.php' - * @param string $dest eg. './index.php' + * @param string $source eg. './tmp/latest/index.php' + * @param string $dest eg. './index.php' * @param bool $excludePhp * @throws Exception * @return bool @@ -259,8 +259,8 @@ class Filesystem /** * Copy recursively from $source to $target. * - * @param string $source eg. './tmp/latest' - * @param string $target eg. '.' + * @param string $source eg. './tmp/latest' + * @param string $target eg. '.' * @param bool $excludePhp */ public static function copyRecursive($source, $target, $excludePhp = false) diff --git a/core/FrontController.php b/core/FrontController.php index 5c29591ed4..155cac103f 100644 --- a/core/FrontController.php +++ b/core/FrontController.php @@ -10,6 +10,7 @@ */ namespace Piwik; + use Exception; use Piwik\API\Request; use Piwik\API\ResponseBuilder; @@ -222,8 +223,8 @@ class FrontController // which load the HTML page of the installer with the error. // This is at least required for misc/cron/archive.php and useful to all other scripts return (defined('PIWIK_ENABLE_DISPATCH') && !PIWIK_ENABLE_DISPATCH) - || Common::isPhpCliMode() - || SettingsServer::isArchivePhpTriggered(); + || Common::isPhpCliMode() + || SettingsServer::isArchivePhpTriggered(); } /** diff --git a/core/Http.php b/core/Http.php index 78b18ea528..2b30cc620d 100644 --- a/core/Http.php +++ b/core/Http.php @@ -62,10 +62,10 @@ class Http * @param string $destinationPath * @param int $followDepth * @param bool $acceptLanguage - * @param array|bool $byteRange For Range: header. Should be two element array of bytes, eg, array(0, 1024) + * @param array|bool $byteRange For Range: header. Should be two element array of bytes, eg, array(0, 1024) * Doesn't work w/ fopen method. * @param bool $getExtendedInfo True to return status code, headers & response, false if just response. - * @param string $httpMethod The HTTP method to use. Defaults to 'GET'. + * @param string $httpMethod The HTTP method to use. Defaults to 'GET'. * * @throws Exception * @return bool true (or string) on success; false on HTTP response error code (1xx or 4xx) @@ -96,12 +96,12 @@ class Http * @param string $destinationPath * @param resource $file * @param int $followDepth - * @param bool|string $acceptLanguage Accept-language header - * @param bool $acceptInvalidSslCertificate Only used with $method == 'curl'. If set to true (NOT recommended!) the SSL certificate will not be checked - * @param array|bool $byteRange For Range: header. Should be two element array of bytes, eg, array(0, 1024) + * @param bool|string $acceptLanguage Accept-language header + * @param bool $acceptInvalidSslCertificate Only used with $method == 'curl'. If set to true (NOT recommended!) the SSL certificate will not be checked + * @param array|bool $byteRange For Range: header. Should be two element array of bytes, eg, array(0, 1024) * Doesn't work w/ fopen method. - * @param bool $getExtendedInfo True to return status code, headers & response, false if just response. - * @param string $httpMethod The HTTP method to use. Defaults to 'GET'. + * @param bool $getExtendedInfo True to return status code, headers & response, false if just response. + * @param string $httpMethod The HTTP method to use. Defaults to 'GET'. * * @throws Exception * @return bool true (or string/array) on success; false on HTTP response error code (1xx or 4xx) @@ -214,14 +214,14 @@ class Http // send HTTP request header $requestHeader .= "Host: $host" . ($port != 80 ? ':' . $port : '') . "\r\n" - . ($proxyAuth ? $proxyAuth : '') - . 'User-Agent: ' . $userAgent . "\r\n" - . ($acceptLanguage ? $acceptLanguage . "\r\n" : '') - . $xff . "\r\n" - . $via . "\r\n" - . $rangeHeader - . "Connection: close\r\n" - . "\r\n"; + . ($proxyAuth ? $proxyAuth : '') + . 'User-Agent: ' . $userAgent . "\r\n" + . ($acceptLanguage ? $acceptLanguage . "\r\n" : '') + . $xff . "\r\n" + . $via . "\r\n" + . $rangeHeader + . "Connection: close\r\n" + . "\r\n"; fwrite($fsock, $requestHeader); $streamMetaData = array('timed_out' => false); @@ -537,8 +537,8 @@ class Http * Note this function uses the Range HTTP header to accomplish downloading in * parts. * - * @param string $url The url to download from. - * @param string $outputPath The path to the file to save/append to. + * @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, * or if we're starting a fresh one. * @@ -553,7 +553,7 @@ class Http ) { throw new Exception( Piwik_Translate('General_DownloadFail_FileExists', "'" . $outputPath . "'") - . ' ' . Piwik_Translate('General_DownloadPleaseRemoveExisting')); + . ' ' . Piwik_Translate('General_DownloadPleaseRemoveExisting')); } // if we're starting a download, get the expected file size & save as an option @@ -595,7 +595,7 @@ class Http if ($existingSize >= $expectedFileSize) { throw new Exception( Piwik_Translate('General_DownloadFail_FileExistsContinue', "'" . $outputPath . "'") - . ' ' . Piwik_Translate('General_DownloadPleaseRemoveExisting')); + . ' ' . Piwik_Translate('General_DownloadPleaseRemoveExisting')); } // download a chunk of the file diff --git a/core/IP.php b/core/IP.php index 81df27bef3..6e8e1d13e6 100644 --- a/core/IP.php +++ b/core/IP.php @@ -36,7 +36,7 @@ class IP /** * Sanitize human-readable IP address. * - * @param string $ipString IP address + * @param string $ipString IP address * @return string */ public static function sanitizeIp($ipString) @@ -84,7 +84,7 @@ class IP * - IPv6 block using CIDR notation, e.g., 2001:DB8::/48 represents the IPv6 addresses from 2001:DB8:0:0:0:0:0:0 to 2001:DB8:0:FFFF:FFFF:FFFF:FFFF:FFFF * - wildcards, e.g., 192.168.0.* * - * @param string $ipRangeString IP address range + * @param string $ipRangeString IP address range * @return string|bool IP address range in CIDR notation OR false */ public static function sanitizeIpRange($ipRangeString) @@ -128,7 +128,7 @@ class IP /** * Convert presentation format IP address to network address format * - * @param string $ipString IP address, either IPv4 or IPv6, e.g., "127.0.0.1" + * @param string $ipString IP address, either IPv4 or IPv6, e.g., "127.0.0.1" * @return string Binary-safe string, e.g., "\x7F\x00\x00\x01" */ public static function P2N($ipString) @@ -143,7 +143,7 @@ class IP * * @see prettyPrint() * - * @param string $ip IP address in network address format + * @param string $ip IP address in network address format * @return string IP address in presentation format */ public static function N2P($ip) @@ -156,7 +156,7 @@ class IP /** * Alias for N2P() * - * @param string $ip IP address in network address format + * @param string $ip IP address in network address format * @return string IP address in presentation format */ public static function prettyPrint($ip) @@ -167,7 +167,7 @@ class IP /** * Is this an IPv4, IPv4-compat, or IPv4-mapped address? * - * @param string $ip IP address in network address format + * @param string $ip IP address in network address format * @return bool True if IPv4, else false */ public static function isIPv4($ip) @@ -201,7 +201,7 @@ class IP * This function does not support the long (or its string representation) * returned by the built-in ip2long() function, from Piwik 1.3 and earlier. * - * @param string $ip IPv4 address in network address format + * @param string $ip IPv4 address in network address format * @return string IP address in presentation format */ public static function long2ip($ip) @@ -258,7 +258,7 @@ class IP /** * Get low and high IP addresses for a specified range. * - * @param array $ipRange An IP address range in presentation format + * @param array $ipRange An IP address range in presentation format * @return array|bool Array ($lowIp, $highIp) in network address format, or false if failure */ public static function getIpsForRange($ipRange) @@ -298,8 +298,8 @@ class IP * * An IPv4-mapped address should be range checked with an IPv4-mapped address range. * - * @param string $ip IP address in network address format - * @param array $ipRanges List of IP address ranges + * @param string $ip IP address in network address format + * @param array $ipRanges List of IP address ranges * @return bool True if in any of the specified IP address ranges; else false. */ public static function isIpInRange($ip, $ipRanges) @@ -362,8 +362,8 @@ class IP /** * Returns a non-proxy IP address from header * - * @param string $default Default value to return if no matching proxy header - * @param array $proxyHeaders List of proxy headers + * @param string $default Default value to return if no matching proxy header + * @param array $proxyHeaders List of proxy headers * @return string */ public static function getNonProxyIpFromHeader($default, $proxyHeaders) @@ -390,8 +390,8 @@ class IP /** * Returns the last IP address in a comma separated list, subject to an optional exclusion list. * - * @param string $csv Comma separated list of elements - * @param array $excludedIps Optional list of excluded IP addresses (or IP address ranges) + * @param string $csv Comma separated list of elements + * @param array $excludedIps Optional list of excluded IP addresses (or IP address ranges) * @return string Last (non-excluded) IP address in the list */ public static function getLastIpFromList($csv, $excludedIps = null) @@ -412,7 +412,7 @@ class IP /** * Get hostname for a given IP address * - * @param string $ipStr Human-readable IP address + * @param string $ipStr Human-readable IP address * @return string Hostname or unmodified $ipStr if failure */ public static function getHostByAddr($ipStr) diff --git a/core/Loader.php b/core/Loader.php index 927fbdc797..59a76d19a3 100644 --- a/core/Loader.php +++ b/core/Loader.php @@ -70,8 +70,8 @@ class Loader { $classPath = self::getClassFileName($class); if (strpos($class, '\Piwik') === 0 - || strpos($class, 'Piwik') === 0) - { + || strpos($class, 'Piwik') === 0 + ) { // Piwik classes are in core/ or plugins/ do { // auto-discover class location diff --git a/core/Log.php b/core/Log.php index 7063d21759..9be82abe78 100644 --- a/core/Log.php +++ b/core/Log.php @@ -14,15 +14,15 @@ use Piwik\Db; /** * Logging utility. - * + * * You can log messages using one of the public static functions (eg, 'error', 'warning', * 'info', etc.). - * + * * Currently, Piwik supports the following logging backends: * - logging to the screen * - logging to a file * - logging to a database - * + * * The logging utility can be configured by manipulating the INI config options in the * [log] section. */ @@ -52,14 +52,14 @@ class Log /** * The singleton Log instance. - * + * * @var Log */ private static $instance = null; /** * Returns the singleton Log instance or creates it if it doesn't exist. - * + * * @return Log */ public static function getInstance() @@ -82,7 +82,7 @@ class Log /** * The current logging level. Everything of equal or greater priority will be logged. * Everything else will be ignored. - * + * * @var int */ private $currentLogLevel = self::WARN; @@ -90,7 +90,7 @@ class Log /** * The array of callbacks executed when logging to a file. Each callback writes a log * message to a logging backend. - * + * * @var array */ private $writers = array(); @@ -98,21 +98,21 @@ class Log /** * The log message format string that turns a tag name, date-time and message into * one string to log. - * + * * @var string */ private $logMessageFormat = "%tag%[%datetime%] %message%"; /** * If we're logging to a file, this is the path to the file to log to. - * + * * @var string */ private $logToFilePath; /** * True if we're currently setup to log to a screen, false if otherwise. - * + * * @var bool */ private $loggingToScreen; @@ -132,10 +132,10 @@ class Log /** * Logs a message using the ERROR log level. - * + * * Note: Messages logged with the ERROR level are always logged to the screen in addition * to configured writers. - * + * * @param string $message The log message. This can be a sprintf format string. * @param ... mixed Optional sprintf params. * @api @@ -147,7 +147,7 @@ class Log /** * Logs a message using the WARNING log level. - * + * * @param string $message The log message. This can be a sprintf format string. * @param ... mixed Optional sprintf params. * @api @@ -159,7 +159,7 @@ class Log /** * Logs a message using the INFO log level. - * + * * @param string $message The log message. This can be a sprintf format string. * @param ... mixed Optional sprintf params. * @api @@ -171,7 +171,7 @@ class Log /** * Logs a message using the DEBUG log level. - * + * * @param string $message The log message. This can be a sprintf format string. * @param ... mixed Optional sprintf params. * @api @@ -183,7 +183,7 @@ class Log /** * Logs a message using the VERBOSE log level. - * + * * @param string $message The log message. This can be a sprintf format string. * @param ... mixed Optional sprintf params. * @api @@ -198,9 +198,9 @@ class Log * date time, and caller provided log message. The log message can be set through * the string_message_format ini option in the [log] section. By default it will * create log messages like: - * + * * [tag:datetime] log message - * + * * @param int $level * @param string $tag * @param string $datetime @@ -260,8 +260,9 @@ class Log private function setLogFilePathFromConfig($logConfig) { $logPath = $logConfig[self::LOGGER_FILE_PATH_CONFIG_OPTION]; - if ( !SettingsServer::isWindows() - && $logPath[0] != '/') { + if (!SettingsServer::isWindows() + && $logPath[0] != '/' + ) { $logPath = PIWIK_USER_PATH . DIRECTORY_SEPARATOR . $logPath; } $logPath = SettingsPiwik::rewriteTmpPathWithHostname($logPath); @@ -334,18 +335,19 @@ class Log private function logToScreen($level, $tag, $datetime, $message) { static $currentRequestKey; - if(empty($currentRequestKey)) { + if (empty($currentRequestKey)) { $currentRequestKey = substr(Common::generateUniqId(), 0, 5); } if (is_string($message)) { - if(!defined('PIWIK_TEST_MODE') - || !PIWIK_TEST_MODE) { + if (!defined('PIWIK_TEST_MODE') + || !PIWIK_TEST_MODE + ) { $message = '[' . $currentRequestKey . '] ' . $message; } $message = $this->formatMessage($level, $tag, $datetime, $message); - if(!Common::isPhpCliMode()) { + if (!Common::isPhpCliMode()) { $message = Common::sanitizeInputValue($message); $message = '<pre>' . $message . '</pre>'; } @@ -397,8 +399,8 @@ class Log } $sql = "INSERT INTO " . Common::prefixTable('logger_message') - . " (tag, timestamp, level, message)" - . " VALUES (?, ?, ?, ?)"; + . " (tag, timestamp, level, message)" + . " VALUES (?, ?, ?, ?)"; Db::query($sql, array($tag, $datetime, self::getStringLevel($level), (string)$message)); } @@ -493,11 +495,11 @@ class Log private function getStringLevel($level) { static $levelToName = array( - self::NONE => 'NONE', - self::ERROR => 'ERROR', - self::WARN => 'WARN', - self::INFO => 'INFO', - self::DEBUG => 'DEBUG', + self::NONE => 'NONE', + self::ERROR => 'ERROR', + self::WARN => 'WARN', + self::INFO => 'INFO', + self::DEBUG => 'DEBUG', self::VERBOSE => 'VERBOSE' ); return $levelToName[$level]; diff --git a/core/Mail.php b/core/Mail.php index 27ccf629ef..a0a8ec8e5a 100644 --- a/core/Mail.php +++ b/core/Mail.php @@ -24,7 +24,7 @@ class Mail extends Zend_Mail /** * Default charset utf-8 * - * @param string $charset charset, defaults to utf-8 + * @param string $charset charset, defaults to utf-8 */ public function __construct($charset = 'utf-8') { diff --git a/core/Menu/Main.php b/core/Menu/Main.php index 18130ba137..595cf82f5f 100644 --- a/core/Menu/Main.php +++ b/core/Menu/Main.php @@ -11,7 +11,6 @@ namespace Piwik\Menu; - /** * @package Piwik_Menu */ diff --git a/core/Menu/Top.php b/core/Menu/Top.php index ae9eab078f..7901a13d71 100644 --- a/core/Menu/Top.php +++ b/core/Menu/Top.php @@ -11,7 +11,6 @@ namespace Piwik\Menu; - /** * @package Piwik_Menu */ diff --git a/core/MetricsFormatter.php b/core/MetricsFormatter.php index 4760c03f6f..b86453d682 100644 --- a/core/MetricsFormatter.php +++ b/core/MetricsFormatter.php @@ -41,7 +41,7 @@ class MetricsFormatter * Pretty format a time * * @param int $numberOfSeconds - * @param bool $displayTimeAsSentence If set to true, will output "5min 17s", if false "00:05:17" + * @param bool $displayTimeAsSentence If set to true, will output "5min 17s", if false "00:05:17" * @param bool $isHtml * @param bool $round to the full seconds * @return string @@ -97,9 +97,9 @@ class MetricsFormatter /** * Pretty format a memory size value * - * @param number $size size in bytes - * @param string $unit The specific unit to use, if any. If null, the unit is determined by $size. - * @param int $precision The precision to use when rounding. + * @param number $size size in bytes + * @param string $unit The specific unit to use, if any. If null, the unit is determined by $size. + * @param int $precision The precision to use when rounding. * @return string */ public static function getPrettySizeFromBytes($size, $unit = null, $precision = 1) diff --git a/core/Nonce.php b/core/Nonce.php index 35b611d800..0f526fb328 100644 --- a/core/Nonce.php +++ b/core/Nonce.php @@ -31,8 +31,8 @@ class Nonce /** * Generate nonce * - * @param string $id Unique id to avoid namespace conflicts, e.g., ModuleName.ActionName - * @param int $ttl Optional time-to-live in seconds; default is 5 minutes + * @param string $id Unique id to avoid namespace conflicts, e.g., ModuleName.ActionName + * @param int $ttl Optional time-to-live in seconds; default is 5 minutes * @return string Nonce */ static public function getNonce($id, $ttl = 300) @@ -56,8 +56,8 @@ class Nonce /** * Verify nonce and check referrer (if present, i.e., it may be suppressed by the browser or a proxy/network). * - * @param string $id Unique id - * @param string $cnonce Nonce sent to client + * @param string $id Unique id + * @param string $cnonce Nonce sent to client * @return bool true if valid; false otherwise */ static public function verifyNonce($id, $cnonce) @@ -91,7 +91,7 @@ class Nonce /** * Discard nonce ("now" as opposed to waiting for garbage collection) * - * @param string $id Unique id + * @param string $id Unique id */ static public function discardNonce($id) { diff --git a/core/Option.php b/core/Option.php index d986b87522..3e4ad542d3 100644 --- a/core/Option.php +++ b/core/Option.php @@ -59,7 +59,7 @@ class Option /** * Returns the option value for the requested option $name, fetching from database, if not in cache. * - * @param string $name Key + * @param string $name Key * @return string|bool Value or false, if not found */ public function get($name) @@ -83,14 +83,14 @@ class Option * * @param string $name * @param string $value - * @param int $autoLoad if set to 1, this option value will be automatically loaded; should be set to 1 for options that will always be used in the Piwik request. + * @param int $autoLoad if set to 1, this option value will be automatically loaded; should be set to 1 for options that will always be used in the Piwik request. */ public function set($name, $value, $autoLoad = 0) { $autoLoad = (int)$autoLoad; Db::query('INSERT INTO `' . Common::prefixTable('option') . '` (option_name, option_value, autoload) ' . - ' VALUES (?, ?, ?) ' . - ' ON DUPLICATE KEY UPDATE option_value = ?', + ' VALUES (?, ?, ?) ' . + ' ON DUPLICATE KEY UPDATE option_value = ?', array($name, $value, $autoLoad, $value)); $this->all[$name] = $value; } @@ -98,8 +98,8 @@ class Option /** * Delete key-value pair from database and reload cache. * - * @param string $name Key to match exactly - * @param string $value Optional value + * @param string $name Key to match exactly + * @param string $value Optional value */ public function delete($name, $value = null) { @@ -120,8 +120,8 @@ class Option * Delete key-value pair(s) from database and reload cache. * The supplied pattern should use '%' as wildcards, and literal '_' should be escaped. * - * @param string $name Pattern of key to match. - * @param string $value Optional value + * @param string $name Pattern of key to match. + * @param string $value Optional value */ public function deleteLike($name, $value = null) { diff --git a/core/Period.php b/core/Period.php index 6e143dcf78..5b5822dd09 100644 --- a/core/Period.php +++ b/core/Period.php @@ -95,7 +95,7 @@ abstract class Period return is_string($dateString) && (preg_match('/^(last|previous){1}([0-9]*)$/D', $dateString, $regs) - || Range::parseDateRange($dateString)) + || Range::parseDateRange($dateString)) && $period != 'range'; } diff --git a/core/Period/Day.php b/core/Period/Day.php index 46e590c4ca..a53a5a49cb 100644 --- a/core/Period/Day.php +++ b/core/Period/Day.php @@ -9,6 +9,7 @@ * @package Piwik */ namespace Piwik\Period; + use Exception; use Piwik\Period; diff --git a/core/Period/Range.php b/core/Period/Range.php index 7579701cfc..649d557381 100644 --- a/core/Period/Range.php +++ b/core/Period/Range.php @@ -353,7 +353,7 @@ class Range extends Period /** * Returns the date that is one period before the supplied date. * - * @param bool|string $date The date to get the last date of. + * @param bool|string $date The date to get the last date of. * @param bool|string $period The period to use (either 'day', 'week', 'month', 'year'); * * @return array An array with two elements, a string for the date before $date and diff --git a/core/Piwik.php b/core/Piwik.php index b70892de3b..8da79c3f08 100644 --- a/core/Piwik.php +++ b/core/Piwik.php @@ -14,8 +14,8 @@ use Exception; use Piwik\Db\Adapter; use Piwik\Db\Schema; use Piwik\Db; -use Piwik\Plugin; +use Piwik\Plugin; use Piwik\Plugins\UsersManager\API; use Piwik\Session; use Piwik\Tracker; @@ -39,10 +39,10 @@ class Piwik * @var array */ public static $idPeriods = array( - 'day' => 1, - 'week' => 2, + 'day' => 1, + 'week' => 2, 'month' => 3, - 'year' => 4, + 'year' => 4, 'range' => 5, ); @@ -72,7 +72,7 @@ class Piwik if (!Common::isPhpCliMode()) { @header('Content-Type: text/html; charset=utf-8'); } - + $output = "<style>a{color:red;}</style>\n" . "<div style='color:red;font-family:Georgia;font-size:120%'>" . "<p><img src='plugins/Zeitgeist/images/error_medium.png' style='vertical-align:middle; float:left;padding:20 20 20 20' />" . @@ -122,7 +122,7 @@ class Piwik * Returns the Javascript code to be inserted on every page to track * * @param int $idSite - * @param string $piwikUrl http://path/to/piwik/directory/ + * @param string $piwikUrl http://path/to/piwik/directory/ * @return string */ static public function getJavascriptCode($idSite, $piwikUrl) @@ -306,7 +306,7 @@ class Piwik * Helper method user to set the current as Super User. * This should be used with great care as this gives the user all permissions. * - * @param bool $bool true to set current user as super user + * @param bool $bool true to set current user as super user * @api */ static public function setUserIsSuperUser($bool = true) @@ -518,9 +518,9 @@ class Piwik /** * Redirect to module (and action) * - * @param string $newModule Target module - * @param string $newAction Target action - * @param array $parameters Parameters to modify in the URL + * @param string $newModule Target module + * @param string $newAction Target action + * @param array $parameters Parameters to modify in the URL * @return bool false if the URL to redirect to is already this URL * * @api @@ -636,7 +636,7 @@ class Piwik /** * Returns the class name of an object without its namespace. - * + * * @param mixed|string $object * @return string */ diff --git a/core/Plugin.php b/core/Plugin.php index 63a293c3c0..ece49678dc 100644 --- a/core/Plugin.php +++ b/core/Plugin.php @@ -61,13 +61,13 @@ class Plugin $this->pluginInformation = $metadataLoader->load(); if ($this->hasDefinedPluginInformationInPluginClass() && $metadataLoader->hasPluginJson()) { - throw new \Exception('Plugin ' . $pluginName . ' has defined the method getInformation() and as well as having a plugin.json file. Please delete the getInformation() method from the plugin class. Alternatively, you may delete the plugin directory from plugins/'.$pluginName); + throw new \Exception('Plugin ' . $pluginName . ' has defined the method getInformation() and as well as having a plugin.json file. Please delete the getInformation() method from the plugin class. Alternatively, you may delete the plugin directory from plugins/' . $pluginName); } } private function hasDefinedPluginInformationInPluginClass() { - $myClassName = get_class(); + $myClassName = get_class(); $pluginClassName = get_class($this); if ($pluginClassName == $myClassName) { @@ -198,7 +198,7 @@ class Plugin /** * Extracts the plugin name from a backtrace array. Returns false if we can't find one. - * + * * @param array $backtrace The result of the debug_backtrace() or Exception::getTrace(). * @return string|false */ diff --git a/core/Plugin/Config.php b/core/Plugin/Config.php index cb4ecd42e5..f54ecd0250 100644 --- a/core/Plugin/Config.php +++ b/core/Plugin/Config.php @@ -24,8 +24,8 @@ class Config /** * Constructor * - * @param string $pluginName name of the plugin - * @param string $configFileName name of the plugin file; defaults to local.config.php + * @param string $pluginName name of the plugin + * @param string $configFileName name of the plugin file; defaults to local.config.php */ public function __construct($pluginName, $configFileName = 'local.config.php') { diff --git a/core/Plugin/MetadataLoader.php b/core/Plugin/MetadataLoader.php index 22cd2ed55a..789f485f0b 100644 --- a/core/Plugin/MetadataLoader.php +++ b/core/Plugin/MetadataLoader.php @@ -27,7 +27,7 @@ require_once PIWIK_INCLUDE_PATH . '/core/Version.php'; class MetadataLoader { const PLUGIN_JSON_FILENAME = 'plugin.json'; - + /** * The name of the plugin whose metadata will be loaded. * diff --git a/core/PluginsArchiver.php b/core/PluginsArchiver.php index 93749321db..7dc6a2d2e2 100644 --- a/core/PluginsArchiver.php +++ b/core/PluginsArchiver.php @@ -39,7 +39,7 @@ abstract class PluginsArchiver { $className = get_class($this); $pluginName = str_replace(array("Piwik\\Plugins\\", "\\Archiver"), "", $className); - if(strpos($pluginName, "\\") !== false) { + if (strpos($pluginName, "\\") !== false) { throw new \Exception("unexpected plugin name $pluginName in shouldArchive()"); } return $this->getProcessor()->shouldProcessReportsForPlugin($pluginName); diff --git a/core/PluginsManager.php b/core/PluginsManager.php index 6d7e189b0a..1975ed9f86 100644 --- a/core/PluginsManager.php +++ b/core/PluginsManager.php @@ -118,7 +118,7 @@ class PluginsManager /** * Returns true if plugin is always activated * - * @param string $name Name of plugin + * @param string $name Name of plugin * @return bool */ private function isPluginAlwaysActivated($name) @@ -140,19 +140,19 @@ class PluginsManager /** * Returns true if plugin has been activated * - * @param string $name Name of plugin + * @param string $name Name of plugin * @return bool */ public function isPluginActivated($name) { return in_array($name, $this->pluginsToLoad) - || $this->isPluginAlwaysActivated($name); + || $this->isPluginAlwaysActivated($name); } /** * Returns true if plugin is loaded (in memory) * - * @param string $name Name of plugin + * @param string $name Name of plugin * @return bool */ public function isPluginLoaded($name) @@ -194,10 +194,10 @@ class PluginsManager */ public function uninstallPlugin($pluginName) { - if($this->isPluginActivated($pluginName)) { + if ($this->isPluginActivated($pluginName)) { throw new \Exception("To uninstall the plugin $pluginName, first disable it in Piwik > Settings > Plugins"); } - if(!$this->isPluginInFilesystem($pluginName)) { + if (!$this->isPluginInFilesystem($pluginName)) { throw new \Exception("You are trying to uninstall the plugin $pluginName but it was not found in the directory piwik/plugins/"); } @@ -214,7 +214,7 @@ class PluginsManager Filesystem::deleteAllCacheOnUpdate(); self::deletePluginFromFilesystem($pluginName); - if($this->isPluginInFilesystem($pluginName)) { + if ($this->isPluginInFilesystem($pluginName)) { return false; } return true; @@ -228,7 +228,7 @@ class PluginsManager /** * Deactivate plugin * - * @param string $pluginName Name of plugin + * @param string $pluginName Name of plugin * @param array|bool $plugins Array of plugin names * @return array|bool */ @@ -269,7 +269,7 @@ class PluginsManager /** * Activate the specified plugin and install (if needed) * - * @param string $pluginName Name of plugin + * @param string $pluginName Name of plugin * @throws \Exception */ public function activatePlugin($pluginName) @@ -287,11 +287,11 @@ class PluginsManager // Only one theme enabled at a time $themeEnabled = $this->getThemeEnabled(); - if($themeEnabled && $themeEnabled->getPluginName() != self::DEFAULT_THEME) { + if ($themeEnabled && $themeEnabled->getPluginName() != self::DEFAULT_THEME) { $themeAlreadyEnabled = $themeEnabled->getPluginName(); $plugin = $this->loadPlugin($pluginName); - if($plugin->isTheme()) { - $plugins = $this->deactivatePlugin( $themeAlreadyEnabled, $plugins ); + if ($plugin->isTheme()) { + $plugins = $this->deactivatePlugin($themeAlreadyEnabled, $plugins); } } @@ -322,7 +322,7 @@ class PluginsManager $existingPlugins = $this->readPluginsDirectory(); $isPluginInFilesystem = array_search($pluginName, $existingPlugins) !== false; return Filesystem::isValidFilename($pluginName) - && $isPluginInFilesystem; + && $isPluginInFilesystem; } /** @@ -337,11 +337,12 @@ class PluginsManager $plugins = $this->getLoadedPlugins(); $theme = false; - foreach($plugins as $plugin) { + foreach ($plugins as $plugin) { /* @var $plugin Plugin */ - if($plugin->isTheme() - && $this->isPluginActivated($plugin->getPluginName())) { - if($plugin->getPluginName() != self::DEFAULT_THEME) { + if ($plugin->isTheme() + && $this->isPluginActivated($plugin->getPluginName()) + ) { + if ($plugin->getPluginName() != self::DEFAULT_THEME) { return $plugin; // enabled theme (not default) } $theme = $plugin; // default theme @@ -366,8 +367,7 @@ class PluginsManager $listPlugins = array_unique($listPlugins); foreach ($listPlugins as $pluginName) { // If the plugin is not core and looks bogus, do not load - if($this->isPluginThirdPartyAndBogus($pluginName)) - { + if ($this->isPluginThirdPartyAndBogus($pluginName)) { $info = array( 'invalid' => true, 'activated' => false, @@ -408,8 +408,8 @@ class PluginsManager $pluginsBundledWithPiwik = $pluginsBundledWithPiwik['Plugins']; return (!empty($pluginsBundledWithPiwik) - && in_array($name, $pluginsBundledWithPiwik)) - || in_array($name, $this->corePluginsDisabledByDefault); + && in_array($name, $pluginsBundledWithPiwik)) + || in_array($name, $this->corePluginsDisabledByDefault); } protected function isPluginThirdPartyAndBogus($pluginName) @@ -424,7 +424,7 @@ class PluginsManager /** * Load the specified plugins * - * @param array $pluginsToLoad Array of plugins to load + * @param array $pluginsToLoad Array of plugins to load */ public function loadPlugins(array $pluginsToLoad) { @@ -455,7 +455,7 @@ class PluginsManager /** * Load translations for loaded plugins * - * @param bool|string $language Optional language code + * @param bool|string $language Optional language code */ public function loadPluginTranslations($language = false) { @@ -534,7 +534,8 @@ class PluginsManager foreach ($this->pluginsToLoad as $pluginName) { if (!$this->isPluginLoaded($pluginName) - && !$this->isPluginThirdPartyAndBogus($pluginName)) { + && !$this->isPluginThirdPartyAndBogus($pluginName) + ) { $newPlugin = $this->loadPlugin($pluginName); if ($newPlugin === null) { continue; @@ -546,8 +547,8 @@ class PluginsManager public function getIgnoredBogusPlugins() { $ignored = array(); - foreach($this->pluginsToLoad as $pluginName) { - if($this->isPluginThirdPartyAndBogus($pluginName)) { + foreach ($this->pluginsToLoad as $pluginName) { + if ($this->isPluginThirdPartyAndBogus($pluginName)) { $ignored[] = $pluginName; } } @@ -603,7 +604,7 @@ class PluginsManager require_once $path; $namespacedClass = $this->getClassNamePlugin($pluginName); - if(!class_exists($namespacedClass, false)) { + if (!class_exists($namespacedClass, false)) { throw new \Exception("The class $pluginClassName couldn't be found in the file '$path'"); } $newPlugin = new $namespacedClass; @@ -617,7 +618,7 @@ class PluginsManager protected function getClassNamePlugin($pluginName) { $className = $pluginName; - if($pluginName == 'API') { + if ($pluginName == 'API') { $className = 'Plugin'; } return "\\Piwik\\Plugins\\$pluginName\\$className"; @@ -683,7 +684,7 @@ class PluginsManager /** * Add a plugin in the loaded plugins array * - * @param string $pluginName plugin name without prefix (eg. 'UserCountry') + * @param string $pluginName plugin name without prefix (eg. 'UserCountry') * @param Plugin $newPlugin */ private function addLoadedPlugin($pluginName, Plugin $newPlugin) @@ -723,7 +724,7 @@ class PluginsManager return false; } - if(isset($translations[$pluginName])) { + if (isset($translations[$pluginName])) { // only merge translations of plugin - prevents overwritten strings Translate::getInstance()->mergeTranslationArray(array($pluginName => $translations[$pluginName])); } @@ -816,7 +817,7 @@ class PluginsManager { $name = basename($path); return file_exists($path . "/" . $name . ".php") - || self::isManifestFileFound($path); + || self::isManifestFileFound($path); } /** diff --git a/core/Profiler.php b/core/Profiler.php index c29117f49f..bce7da3d33 100644 --- a/core/Profiler.php +++ b/core/Profiler.php @@ -11,7 +11,6 @@ namespace Piwik; - /** * Class Profiler helps with measuring memory, and profiling the database. * To enable set in your config.ini.php diff --git a/core/ProxyHeaders.php b/core/ProxyHeaders.php index 7411d34897..8f10087bd6 100644 --- a/core/ProxyHeaders.php +++ b/core/ProxyHeaders.php @@ -11,7 +11,6 @@ namespace Piwik; - /** * Proxy headers * diff --git a/core/ProxyHttp.php b/core/ProxyHttp.php index 030443d801..b35d749342 100644 --- a/core/ProxyHttp.php +++ b/core/ProxyHttp.php @@ -199,7 +199,7 @@ class ProxyHttp * @see http://support.microsoft.com/kb/316431/ * @see RFC2616 * - * @param string $override One of "public", "private", "no-cache", or "no-store". (optional) + * @param string $override One of "public", "private", "no-cache", or "no-store". (optional) */ public static function overrideCacheControlHeaders($override = null) { diff --git a/core/QuickForm2.php b/core/QuickForm2.php index 19d5edcaef..bbdc39e4c5 100644 --- a/core/QuickForm2.php +++ b/core/QuickForm2.php @@ -63,9 +63,9 @@ abstract class QuickForm2 extends HTML_QuickForm2 * * @param string|HTML_QuickForm2_Node $elementOrType Either type name (treated * case-insensitively) or an element instance - * @param mixed $name Element name - * @param mixed $attributes Element attributes - * @param array $data Element-specific data + * @param mixed $name Element name + * @param mixed $attributes Element attributes + * @param array $data Element-specific data * @return HTML_QuickForm2_Node Added element * @throws HTML_QuickForm2_InvalidArgumentException * @throws HTML_QuickForm2_NotFoundException diff --git a/core/Registry.php b/core/Registry.php index 8081989b7c..5fe90370b9 100644 --- a/core/Registry.php +++ b/core/Registry.php @@ -20,45 +20,54 @@ class Registry private static $instance; private $data; - private function __construct() { + private function __construct() + { $this->data = array(); } - public static function getInstance() { - if(self::$instance == null) { + public static function getInstance() + { + if (self::$instance == null) { self::$instance = new Registry(); } return self::$instance; } - public static function isRegistered($key) { + public static function isRegistered($key) + { return self::getInstance()->hasKey($key); } - public static function get($key) { + public static function get($key) + { return self::getInstance()->getKey($key); } - public static function set($key, $value) { + public static function set($key, $value) + { self::getInstance()->setKey($key, $value); } - public static function unsetInstance() { + public static function unsetInstance() + { self::$instance = null; } - public function setKey($key, $value) { + public function setKey($key, $value) + { $this->data[$key] = $value; } - public function getKey($key) { - if(!$this->hasKey($key)) { + public function getKey($key) + { + if (!$this->hasKey($key)) { throw new \Exception(sprintf("Key '%s' doesn't exist in Registry", $key)); } return $this->data[$key]; } - public function hasKey($key) { + public function hasKey($key) + { return array_key_exists($key, $this->data); } } diff --git a/core/ReportRenderer/Pdf.php b/core/ReportRenderer/Pdf.php index de5c52770e..76a5d650c0 100644 --- a/core/ReportRenderer/Pdf.php +++ b/core/ReportRenderer/Pdf.php @@ -238,14 +238,14 @@ class Pdf extends ReportRenderer ( // it is the first report $this->currentPage == 0 - // or, it is a graph-only report and it is the first of a series of self::MAX_GRAPH_REPORTS - || ($graphOnlyReport && $graphOnlyReportCount == 0) - // or, it is a table-only 2-column report and it is the first of a series of self::MAX_2COL_TABLE_REPORTS - || ($tableOnly2ColumnReport && $tableOnly2ColumnReportCount == 0) - // or it is a table-only report with more than 2 columns and it is the first of its series or there isn't enough space left on the page - || ($tableOnlyManyColumnReport && ($tableOnlyManyColumnReportRowCount == 0 || $tableOnlyManyColumnReportRowCount + $rowCount >= self::MAX_ROW_COUNT)) - // or it is a report with both a table and a graph - || !$graphOnlyReport && !$tableOnlyReport + // or, it is a graph-only report and it is the first of a series of self::MAX_GRAPH_REPORTS + || ($graphOnlyReport && $graphOnlyReportCount == 0) + // or, it is a table-only 2-column report and it is the first of a series of self::MAX_2COL_TABLE_REPORTS + || ($tableOnly2ColumnReport && $tableOnly2ColumnReportCount == 0) + // or it is a table-only report with more than 2 columns and it is the first of its series or there isn't enough space left on the page + || ($tableOnlyManyColumnReport && ($tableOnlyManyColumnReportRowCount == 0 || $tableOnlyManyColumnReportRowCount + $rowCount >= self::MAX_ROW_COUNT)) + // or it is a report with both a table and a graph + || !$graphOnlyReport && !$tableOnlyReport ) ) { $this->currentPage++; diff --git a/core/Segment.php b/core/Segment.php index 508afbdd11..b7ba2c7bbb 100644 --- a/core/Segment.php +++ b/core/Segment.php @@ -9,6 +9,7 @@ * @package Piwik */ namespace Piwik; + use Exception; use Piwik\Plugins\API\API; @@ -154,12 +155,12 @@ class Segment /** * Extend SQL query with segment expressions * - * @param string $select select clause - * @param array $from array of table names (without prefix) - * @param bool|string $where (optional )where clause - * @param array|string $bind (optional) params to bind - * @param bool|string $orderBy (optional) order by clause - * @param bool|string $groupBy (optional) group by clause + * @param string $select select clause + * @param array $from array of table names (without prefix) + * @param bool|string $where (optional )where clause + * @param array|string $bind (optional) params to bind + * @param bool|string $orderBy (optional) order by clause + * @param bool|string $groupBy (optional) group by clause * @return string entire select query */ public function getSelectQuery($select, $from, $where = false, $bind = array(), $orderBy = false, $groupBy = false) @@ -207,7 +208,7 @@ class Segment /** * Generate the join sql based on the needed tables - * @param array $tables tables to join + * @param array $tables tables to join * @throws Exception if tables can't be joined * @return array */ @@ -307,11 +308,11 @@ class Segment /** * Build select query the normal way - * @param string $select fieldlist to be selected - * @param string $from tablelist to select from - * @param string $where where clause - * @param string $orderBy order by clause - * @param string $groupBy group by clause + * @param string $select fieldlist to be selected + * @param string $from tablelist to select from + * @param string $where where clause + * @param string $orderBy order by clause + * @param string $groupBy group by clause * @return string */ private function buildSelectQuery($select, $from, $where, $orderBy, $groupBy) diff --git a/core/SegmentExpression.php b/core/SegmentExpression.php index 6434044808..93a366778c 100644 --- a/core/SegmentExpression.php +++ b/core/SegmentExpression.php @@ -10,6 +10,7 @@ */ namespace Piwik; + use Exception; /** diff --git a/core/Session.php b/core/Session.php index c51de9b91e..b9d1601e6f 100644 --- a/core/Session.php +++ b/core/Session.php @@ -33,13 +33,13 @@ class Session extends Zend_Session { $config = Config::getInstance(); return !isset($config->General['session_save_handler']) - || $config->General['session_save_handler'] === 'files'; + || $config->General['session_save_handler'] === 'files'; } /** * Start the session * - * @param array|bool $options An array of configuration options; the auto-start (bool) setting is ignored + * @param array|bool $options An array of configuration options; the auto-start (bool) setting is ignored * @return void */ public static function start($options = false) diff --git a/core/Session/SaveHandler/DbTable.php b/core/Session/SaveHandler/DbTable.php index 60f5c77d9d..746f05b845 100644 --- a/core/Session/SaveHandler/DbTable.php +++ b/core/Session/SaveHandler/DbTable.php @@ -133,7 +133,7 @@ class DbTable implements Zend_Session_SaveHandler_Interface * Garbage Collection - remove old session data older * than $maxlifetime (in seconds) * - * @param int $maxlifetime timestamp in seconds + * @param int $maxlifetime timestamp in seconds * @return bool always true */ public function gc($maxlifetime) diff --git a/core/SettingsPiwik.php b/core/SettingsPiwik.php index d4ef3d788e..a8e9b2e4e9 100644 --- a/core/SettingsPiwik.php +++ b/core/SettingsPiwik.php @@ -160,7 +160,7 @@ class SettingsPiwik * -> Always process for day/week/month periods * For Year and Range, only process if it was enabled in the config file, * - * @param string $periodLabel Period label (e.g., 'day') + * @param string $periodLabel Period label (e.g., 'day') * @return bool */ public static function isUniqueVisitorsEnabled($periodLabel) @@ -190,15 +190,15 @@ class SettingsPiwik { try { $configByHost = Config::getInstance()->getConfigHostnameIfSet(); - } catch(Exception $e) { + } catch (Exception $e) { // Config file not found } - if(empty($configByHost)) { + if (empty($configByHost)) { return $path; } $tmp = '/tmp/'; - if(($posTmp = strrpos($path, $tmp)) === false) { + if (($posTmp = strrpos($path, $tmp)) === false) { throw new Exception("The path $path was expected to contain the string /tmp/ "); } diff --git a/core/SettingsServer.php b/core/SettingsServer.php index 8f0f9d80bd..0d7f122c2a 100644 --- a/core/SettingsServer.php +++ b/core/SettingsServer.php @@ -184,7 +184,7 @@ class SettingsServer /** * Set maximum script execution time. * - * @param int $executionTime max execution time in seconds (0 = no limit) + * @param int $executionTime max execution time in seconds (0 = no limit) */ public static function setMaxExecutionTime($executionTime) { diff --git a/core/Site.php b/core/Site.php index 262795076f..5d1df0a4f3 100644 --- a/core/Site.php +++ b/core/Site.php @@ -46,7 +46,7 @@ class Site * Sets the cached Site data with an array that associates site IDs with * individual site data. * - * @param array $sites The array of sites data. Indexed by site ID. + * @param array $sites The array of sites data. Indexed by site ID. */ public static function setSites($sites) { @@ -56,7 +56,7 @@ class Site /** * Sets the cached Site data with a non-associated array of site data. * - * @param array $sites The array of sites data. + * @param array $sites The array of sites data. */ public static function setSitesFromArray($sites) { @@ -113,7 +113,7 @@ class Site /** * Returns a site property - * @param string $name property to return + * @param string $name property to return * @return mixed * @throws Exception */ @@ -247,9 +247,9 @@ class Site * Utility function. Returns the value of the specified field for the * site with the specified ID. * - * @param int|string $idsite The ID of the site whose data is being + * @param int|string $idsite The ID of the site whose data is being * accessed. - * @param string $field The name of the field to get. + * @param string $field The name of the field to get. * @return mixed */ static protected function getFor($idsite, $field) @@ -266,7 +266,7 @@ class Site /** * Returns the name of the site with the specified ID. * - * @param int $idsite The site ID. + * @param int $idsite The site ID. * @return string */ static public function getNameFor($idsite) @@ -277,7 +277,7 @@ class Site /** * Returns the timezone of the site with the specified ID. * - * @param int $idsite The site ID. + * @param int $idsite The site ID. * @return string */ static public function getTimezoneFor($idsite) @@ -288,7 +288,7 @@ class Site /** * Returns the creation date of the site with the specified ID. * - * @param int $idsite The site ID. + * @param int $idsite The site ID. * @return string */ static public function getCreationDateFor($idsite) @@ -299,7 +299,7 @@ class Site /** * Returns the url for the site with the specified ID. * - * @param int $idsite The site ID. + * @param int $idsite The site ID. * @return string */ static public function getMainUrlFor($idsite) @@ -310,7 +310,7 @@ class Site /** * Returns whether the site with the specified ID is ecommerce enabled * - * @param int $idsite The site ID. + * @param int $idsite The site ID. * @return string */ static public function isEcommerceEnabledFor($idsite) @@ -321,7 +321,7 @@ class Site /** * Returns whether the site with the specified ID is Site Search enabled * - * @param int $idsite The site ID. + * @param int $idsite The site ID. * @return string */ static public function isSiteSearchEnabledFor($idsite) @@ -332,7 +332,7 @@ class Site /** * Returns the currency of the site with the specified ID. * - * @param int $idsite The site ID. + * @param int $idsite The site ID. * @return string */ static public function getCurrencyFor($idsite) @@ -343,7 +343,7 @@ class Site /** * Returns the excluded IP addresses of the site with the specified ID. * - * @param int $idsite The site ID. + * @param int $idsite The site ID. * @return string */ static public function getExcludedIpsFor($idsite) @@ -354,7 +354,7 @@ class Site /** * Returns the excluded query parameters for the site with the specified ID. * - * @param int $idsite The site ID. + * @param int $idsite The site ID. * @return string */ static public function getExcludedQueryParametersFor($idsite) diff --git a/core/TaskScheduler.php b/core/TaskScheduler.php index e06484f7be..2b529566d9 100644 --- a/core/TaskScheduler.php +++ b/core/TaskScheduler.php @@ -151,7 +151,7 @@ class TaskScheduler { $forceTaskExecution = (isset($GLOBALS['PIWIK_TRACKER_DEBUG_FORCE_SCHEDULED_TASKS']) && $GLOBALS['PIWIK_TRACKER_DEBUG_FORCE_SCHEDULED_TASKS']) - || DEBUG_FORCE_SCHEDULED_TASKS; + || DEBUG_FORCE_SCHEDULED_TASKS; return $forceTaskExecution || (self::taskHasBeenScheduledOnce($taskName, $timetable) && time() >= $timetable[$taskName]); } diff --git a/core/Tracker.php b/core/Tracker.php index 333aff4d7b..b541129ae3 100644 --- a/core/Tracker.php +++ b/core/Tracker.php @@ -156,7 +156,7 @@ class Tracker /** * Update Tracker config * - * @param string $name Setting name + * @param string $name Setting name * @param mixed $value Value */ static private function updateTrackerConfig($name, $value) @@ -212,12 +212,13 @@ class Tracker // We need to check access for each single request if (isset($request['idsite']) - && !in_array($request['idsite'], $idSitesForAuthentication)) { + && !in_array($request['idsite'], $idSitesForAuthentication) + ) { $idSitesForAuthentication[] = $request['idsite']; } } - foreach($idSitesForAuthentication as $idSiteForAuthentication) { + foreach ($idSitesForAuthentication as $idSiteForAuthentication) { // a Bulk Tracking request that is not authenticated should fail if (!Request::authenticateSuperUserOrAdmin($tokenAuth, $idSiteForAuthentication)) { throw new Exception("token_auth specified does not have Admin permission for site " . intval($idSiteForAuthentication)); @@ -316,7 +317,7 @@ class Tracker // don't run scheduled tasks in CLI mode from Tracker, this is the case // where we bulk load logs & don't want to lose time with tasks return !Common::isPhpCliMode() - && $this->getState() != self::STATE_LOGGING_DISABLE; + && $this->getState() != self::STATE_LOGGING_DISABLE; } /** @@ -422,12 +423,13 @@ class Tracker if ($this->usingBulkTracking) { // when doing bulk tracking we return JSON so the caller will know how many succeeded $result = array( - 'status' => 'error', - 'tracked' => $this->countOfLoggedRequests + 'status' => 'error', + 'tracked' => $this->countOfLoggedRequests ); // send error when in debug mode or when authenticated (which happens when doing log importing, - if (( isset($GLOBALS['PIWIK_TRACKER_DEBUG']) && $GLOBALS['PIWIK_TRACKER_DEBUG']) - || $authenticated) { + if ((isset($GLOBALS['PIWIK_TRACKER_DEBUG']) && $GLOBALS['PIWIK_TRACKER_DEBUG']) + || $authenticated + ) { $result['message'] = $this->getMessageFromException($e); } Common::sendHeader('Content-Type: application/json'); @@ -482,10 +484,10 @@ class Tracker */ protected function end() { - if($this->usingBulkTracking) { + if ($this->usingBulkTracking) { $result = array( - 'status' => 'success', - 'tracked' => $this->countOfLoggedRequests + 'status' => 'success', + 'tracked' => $this->countOfLoggedRequests ); Common::sendHeader('Content-Type: application/json'); echo Common::json_encode($result); @@ -636,11 +638,12 @@ class Tracker protected function outputTransparentGif() { if (isset($GLOBALS['PIWIK_TRACKER_DEBUG']) - && $GLOBALS['PIWIK_TRACKER_DEBUG']) { + && $GLOBALS['PIWIK_TRACKER_DEBUG'] + ) { return; } - if(strlen( $this->getOutputBuffer() ) > 0) { + if (strlen($this->getOutputBuffer()) > 0) { // If there was an error during tracker, return so errors can be flushed return; } @@ -655,7 +658,7 @@ class Tracker protected function isVisitValid() { return $this->stateValid !== self::STATE_LOGGING_DISABLE - && $this->stateValid !== self::STATE_EMPTY_REQUEST; + && $this->stateValid !== self::STATE_EMPTY_REQUEST; } protected function getState() diff --git a/core/Tracker/Action.php b/core/Tracker/Action.php index a5a5553e94..1555b95f8f 100644 --- a/core/Tracker/Action.php +++ b/core/Tracker/Action.php @@ -10,6 +10,7 @@ */ namespace Piwik\Tracker; + use Exception; use Piwik\Common; use Piwik\Config; @@ -630,9 +631,9 @@ class Action implements ActionInterface $this->idLinkVisitAction = Tracker::getDatabase()->lastInsertId(); $info = array( - 'idSite' => $this->request->getIdSite(), - 'idLinkVisitAction' => $this->idLinkVisitAction, - 'idVisit' => $idVisit, + 'idSite' => $this->request->getIdSite(), + 'idLinkVisitAction' => $this->idLinkVisitAction, + 'idVisit' => $idVisit, 'idReferrerActionUrl' => $idReferrerActionUrl, 'idReferrerActionName' => $idReferrerActionName, 'timeSpentReferrerAction' => $timeSpentReferrerAction, @@ -951,7 +952,7 @@ class Action implements ActionInterface * being stored. * * @param array $queryParameters Name/value mapping of query parameters. - * @param bool|string $encoding of the HTML page the URL is for. Used to workaround + * @param bool|string $encoding of the HTML page the URL is for. Used to workaround * browser bugs & mis-coded webapps. See #3450. * * @return array diff --git a/core/Tracker/Cache.php b/core/Tracker/Cache.php index 5d7827e442..de62ad590b 100644 --- a/core/Tracker/Cache.php +++ b/core/Tracker/Cache.php @@ -105,8 +105,8 @@ class Cache Tracker::initCorePiwikInTrackerMode(); $cacheContent = array( - 'isBrowserTriggerEnabled' => Rules::isBrowserTriggerEnabled(), - 'lastTrackerCronRun' => Piwik_GetOption('lastTrackerCronRun'), + 'isBrowserTriggerEnabled' => Rules::isBrowserTriggerEnabled(), + 'lastTrackerCronRun' => Piwik_GetOption('lastTrackerCronRun'), ); /** @@ -135,7 +135,7 @@ class Cache /** * Regenerate Tracker cache files * - * @param array|int $idSites Array of idSites to clear cache for + * @param array|int $idSites Array of idSites to clear cache for */ static public function regenerateCacheWebsiteAttributes($idSites = array()) { @@ -151,7 +151,7 @@ class Cache /** * Delete existing Tracker cache * - * @param string $idSite (website ID of the site to clear cache for + * @param string $idSite (website ID of the site to clear cache for */ static public function deleteCacheWebsiteAttributes($idSite) { diff --git a/core/Tracker/Db.php b/core/Tracker/Db.php index 6ba7737005..7e04d1c7d5 100644 --- a/core/Tracker/Db.php +++ b/core/Tracker/Db.php @@ -133,8 +133,8 @@ abstract class Db /** * Returns an array containing all the rows of a query result, using optional bound parameters. * - * @param string $query Query - * @param array $parameters Parameters to bind + * @param string $query Query + * @param array $parameters Parameters to bind * @see query() * @throws \Piwik\Tracker\Db\DbException if an exception occurred */ @@ -143,8 +143,8 @@ abstract class Db /** * Returns the first row of a query result, using optional bound parameters. * - * @param string $query Query - * @param array $parameters Parameters to bind + * @param string $query Query + * @param array $parameters Parameters to bind * @see also query() * * @throws DbException if an exception occurred @@ -155,8 +155,8 @@ abstract class Db * This function is a proxy to fetch(), used to maintain compatibility with Zend_Db interface * * @see fetch() - * @param string $query Query - * @param array $parameters Parameters to bind + * @param string $query Query + * @param array $parameters Parameters to bind * @return */ public function fetchRow($query, $parameters = array()) @@ -168,8 +168,8 @@ abstract class Db * This function is a proxy to fetch(), used to maintain compatibility with Zend_Db interface * * @see fetch() - * @param string $query Query - * @param array $parameters Parameters to bind + * @param string $query Query + * @param array $parameters Parameters to bind * @return bool|mixed */ public function fetchOne($query, $parameters = array()) @@ -182,8 +182,8 @@ abstract class Db * This function is a proxy to fetch(), used to maintain compatibility with Zend_Db + PDO interface * * @see fetch() - * @param string $query Query - * @param array $parameters Parameters to bind + * @param string $query Query + * @param array $parameters Parameters to bind * @return */ public function exec($query, $parameters = array()) @@ -194,7 +194,7 @@ abstract class Db /** * Return number of affected rows in last query * - * @param mixed $queryResult Result from query() + * @param mixed $queryResult Result from query() * @return int */ abstract public function rowCount($queryResult); @@ -202,8 +202,8 @@ abstract class Db /** * Executes a query, using optional bound parameters. * - * @param string $query Query - * @param array $parameters Parameters to bind array('idsite'=> 1) + * @param string $query Query + * @param array $parameters Parameters to bind array('idsite'=> 1) * * @return PDOStatement or false if failed * @throws DbException if an exception occurred diff --git a/core/Tracker/Db/Mysqli.php b/core/Tracker/Db/Mysqli.php index 77805b47b9..5ed07244a7 100644 --- a/core/Tracker/Db/Mysqli.php +++ b/core/Tracker/Db/Mysqli.php @@ -106,8 +106,8 @@ class Mysqli extends Db * * @see query() * - * @param string $query Query - * @param array $parameters Parameters to bind + * @param string $query Query + * @param array $parameters Parameters to bind * @return array * @throws Exception|DbException if an exception occured */ @@ -144,8 +144,8 @@ class Mysqli extends Db * * @see query() * - * @param string $query Query - * @param array $parameters Parameters to bind + * @param string $query Query + * @param array $parameters Parameters to bind * * @return array * @@ -179,8 +179,8 @@ class Mysqli extends Db /** * Executes a query, using optional bound parameters. * - * @param string $query Query - * @param array|string $parameters Parameters to bind array('idsite'=> 1) + * @param string $query Query + * @param array|string $parameters Parameters to bind array('idsite'=> 1) * * @return bool|resource false if failed * @throws DbException if an exception occurred @@ -273,7 +273,7 @@ class Mysqli extends Db /** * Return number of affected rows in last query * - * @param mixed $queryResult Result from query() + * @param mixed $queryResult Result from query() * @return int */ public function rowCount($queryResult) diff --git a/core/Tracker/Db/Pdo/Mysql.php b/core/Tracker/Db/Pdo/Mysql.php index f42ebdc70c..b3695a2f80 100644 --- a/core/Tracker/Db/Pdo/Mysql.php +++ b/core/Tracker/Db/Pdo/Mysql.php @@ -103,8 +103,8 @@ class Mysql extends Db /** * Returns an array containing all the rows of a query result, using optional bound parameters. * - * @param string $query Query - * @param array $parameters Parameters to bind + * @param string $query Query + * @param array $parameters Parameters to bind * @return array|bool * @see query() * @throws Exception|DbException if an exception occurred @@ -147,8 +147,8 @@ class Mysql extends Db /** * Executes a query, using optional bound parameters. * - * @param string $query Query - * @param array|string $parameters Parameters to bind array('idsite'=> 1) + * @param string $query Query + * @param array|string $parameters Parameters to bind array('idsite'=> 1) * @return PDOStatement|bool PDOStatement or false if failed * @throws DbException if an exception occured */ @@ -209,7 +209,7 @@ class Mysql extends Db /** * Return number of affected rows in last query * - * @param mixed $queryResult Result from query() + * @param mixed $queryResult Result from query() * @return int */ public function rowCount($queryResult) diff --git a/core/Tracker/Db/Pdo/Pgsql.php b/core/Tracker/Db/Pdo/Pgsql.php index 03abcabd22..7733fb9450 100644 --- a/core/Tracker/Db/Pdo/Pgsql.php +++ b/core/Tracker/Db/Pdo/Pgsql.php @@ -110,7 +110,7 @@ class Pgsql extends Mysql /** * Return number of affected rows in last query * - * @param mixed $queryResult Result from query() + * @param mixed $queryResult Result from query() * @return int */ public function rowCount($queryResult) diff --git a/core/Tracker/Request.php b/core/Tracker/Request.php index 92350dbe7d..795f9a04f3 100644 --- a/core/Tracker/Request.php +++ b/core/Tracker/Request.php @@ -285,7 +285,7 @@ class Request protected function isTimestampValid($time) { return $time <= $this->getCurrentTimestamp() - && $time > $this->getCurrentTimestamp() - 10 * 365 * 86400; + && $time > $this->getCurrentTimestamp() - 10 * 365 * 86400; } public function getIdSite() @@ -460,7 +460,7 @@ class Request public function setForceIp($ip) { - if(!empty($ip)) { + if (!empty($ip)) { $this->enforcedIp = $ip; } } @@ -470,14 +470,14 @@ class Request if (!is_numeric($dateTime)) { $dateTime = strtotime($dateTime); } - if(!empty($dateTime)) { + if (!empty($dateTime)) { $this->timestamp = $dateTime; } } public function setForcedVisitorId($visitorId) { - if(!empty($visitorId)) { + if (!empty($visitorId)) { $this->forcedVisitorId = $visitorId; } } diff --git a/core/Tracker/Visit.php b/core/Tracker/Visit.php index 4f45fdf137..df0f9f86b5 100644 --- a/core/Tracker/Visit.php +++ b/core/Tracker/Visit.php @@ -14,8 +14,8 @@ namespace Piwik\Tracker; use Exception; use Piwik\Common; use Piwik\Config; -use Piwik\IP; +use Piwik\IP; use Piwik\Tracker; use UserAgentParser; @@ -289,9 +289,9 @@ class Visit implements VisitInterface // therefore the request below throws exception, instead we make sure the UPDATE will affect the row $valuesToUpdate['visit_total_time'] = self::cleanupVisitTotalTime( $valuesToUpdate['visit_total_time'] - + $this->goalManager->idGoal - // +2 to offset idgoal=-1 and idgoal=0 - + 2); + + $this->goalManager->idGoal + // +2 to offset idgoal=-1 and idgoal=0 + + 2); } // Might update the idvisitor when it was forced or overwritten for this visit @@ -347,7 +347,7 @@ class Visit implements VisitInterface Common::printDebug($sqlBind); throw new VisitorNotFoundInDb( "The visitor with idvisitor=" . bin2hex($this->visitorInfo['idvisitor']) . " and idvisit=" . $this->visitorInfo['idvisit'] - . " wasn't found in the DB, we fallback to a new visitor"); + . " wasn't found in the DB, we fallback to a new visitor"); } /** @@ -432,11 +432,11 @@ class Visit implements VisitInterface 'visit_exit_idaction_url' => (int)$idActionUrl, 'visit_exit_idaction_name' => (int)$idActionName, 'visit_total_actions' => in_array($actionType, - array(Action::TYPE_ACTION_URL, - Action::TYPE_DOWNLOAD, - Action::TYPE_OUTLINK, - Action::TYPE_SITE_SEARCH)) - ? 1 : 0, // if visit starts with something else (e.g. ecommerce order), don't record as an action + array(Action::TYPE_ACTION_URL, + Action::TYPE_DOWNLOAD, + Action::TYPE_OUTLINK, + Action::TYPE_SITE_SEARCH)) + ? 1 : 0, // if visit starts with something else (e.g. ecommerce order), don't record as an action 'visit_total_searches' => $actionType == Action::TYPE_SITE_SEARCH ? 1 : 0, 'visit_total_time' => self::cleanupVisitTotalTime($defaultTimeOnePageVisit), 'visit_goal_converted' => $visitIsConverted ? 1 : 0, @@ -879,8 +879,8 @@ class Visit implements VisitInterface protected function isLastActionInTheSameVisit() { return isset($this->visitorInfo['visit_last_action_time']) - && ($this->visitorInfo['visit_last_action_time'] - > ($this->request->getCurrentTimestamp() - Config::getInstance()->Tracker['visit_standard_length'])); + && ($this->visitorInfo['visit_last_action_time'] + > ($this->request->getCurrentTimestamp() - Config::getInstance()->Tracker['visit_standard_length'])); } /** diff --git a/core/Tracker/VisitExcluded.php b/core/Tracker/VisitExcluded.php index bcb5595732..2374e31b91 100644 --- a/core/Tracker/VisitExcluded.php +++ b/core/Tracker/VisitExcluded.php @@ -125,8 +125,8 @@ class VisitExcluded { return (isset($_SERVER["HTTP_X_PURPOSE"]) && in_array($_SERVER["HTTP_X_PURPOSE"], array("preview", "instant"))) - || (isset($_SERVER['HTTP_X_MOZ']) - && $_SERVER['HTTP_X_MOZ'] == "prefetch"); + || (isset($_SERVER['HTTP_X_MOZ']) + && $_SERVER['HTTP_X_MOZ'] == "prefetch"); } /** @@ -140,15 +140,15 @@ class VisitExcluded { $allowBots = $this->request->getParam('bots'); return !$allowBots - && (strpos($this->userAgent, 'Googlebot') !== false // Googlebot - || strpos($this->userAgent, 'Google Web Preview') !== false // Google Instant - || strpos($this->userAgent, 'Google Page Speed Insights') !== false // #4049 - || strpos($this->userAgent, 'Google (+https://developers.google.com') !== false // Google Snippet https://developers.google.com/+/web/snippet/ - || strpos($this->userAgent, 'facebookexternalhit') !== false // http://www.facebook.com/externalhit_uatext.php - || strpos($this->userAgent, 'bingbot') !== false // Bingbot - || strpos($this->userAgent, 'YottaaMonitor') !== false // Yottaa - || strpos($this->userAgent, 'CloudFlare') !== false // CloudFlare-AlwaysOnline - || IP::isIpInRange($this->ip, $this->getBotIpRanges())); + && (strpos($this->userAgent, 'Googlebot') !== false // Googlebot + || strpos($this->userAgent, 'Google Web Preview') !== false // Google Instant + || strpos($this->userAgent, 'Google Page Speed Insights') !== false // #4049 + || strpos($this->userAgent, 'Google (+https://developers.google.com') !== false // Google Snippet https://developers.google.com/+/web/snippet/ + || strpos($this->userAgent, 'facebookexternalhit') !== false // http://www.facebook.com/externalhit_uatext.php + || strpos($this->userAgent, 'bingbot') !== false // Bingbot + || strpos($this->userAgent, 'YottaaMonitor') !== false // Yottaa + || strpos($this->userAgent, 'CloudFlare') !== false // CloudFlare-AlwaysOnline + || IP::isIpInRange($this->ip, $this->getBotIpRanges())); } protected function getBotIpRanges() diff --git a/core/Translate.php b/core/Translate.php index 98e80139be..6c03b88236 100644 --- a/core/Translate.php +++ b/core/Translate.php @@ -9,6 +9,7 @@ * @package Piwik */ namespace Piwik; + use Exception; /** @@ -147,7 +148,7 @@ class Translate */ public function getJavascriptTranslations() { - $translations = &$GLOBALS['Piwik_translations']; + $translations = & $GLOBALS['Piwik_translations']; $clientSideTranslations = array(); foreach ($this->getClientSideTranslationKeys() as $key) { diff --git a/core/Translate/Filter/ByBaseTranslations.php b/core/Translate/Filter/ByBaseTranslations.php index a62879af11..ff173b03d7 100644 --- a/core/Translate/Filter/ByBaseTranslations.php +++ b/core/Translate/Filter/ByBaseTranslations.php @@ -12,7 +12,6 @@ namespace Piwik\Translate\Filter; - /** * @package Piwik * @subpackage Piwik_Translate @@ -26,7 +25,7 @@ class ByBaseTranslations extends FilterAbstract * * @param array $baseTranslations */ - public function __construct($baseTranslations=array()) + public function __construct($baseTranslations = array()) { $this->baseTranslations = $baseTranslations; } @@ -34,7 +33,7 @@ class ByBaseTranslations extends FilterAbstract /** * Removes all translations that aren't present in the base translations set in constructor * - * @param array $translations + * @param array $translations * * @return array filtered translations */ diff --git a/core/Translate/Filter/ByParameterCount.php b/core/Translate/Filter/ByParameterCount.php index cfcfc7f6af..2a0069b795 100644 --- a/core/Translate/Filter/ByParameterCount.php +++ b/core/Translate/Filter/ByParameterCount.php @@ -12,7 +12,6 @@ namespace Piwik\Translate\Filter; - /** * @package Piwik * @subpackage Piwik_Translate @@ -26,7 +25,7 @@ class ByParameterCount extends FilterAbstract * * @param array $baseTranslations */ - public function __construct($baseTranslations=array()) + public function __construct($baseTranslations = array()) { $this->baseTranslations = $baseTranslations; } @@ -34,7 +33,7 @@ class ByParameterCount extends FilterAbstract /** * Removes all translations where the placeholder parameter count differs to base translation * - * @param array $translations + * @param array $translations * * @return array filtered translations * @@ -48,16 +47,16 @@ class ByParameterCount extends FilterAbstract foreach ($pluginTranslations AS $key => $translation) { if (isset($this->baseTranslations[$pluginName][$key])) { - $baseTranslation = $this->baseTranslations[$pluginName][$key]; + $baseTranslation = $this->baseTranslations[$pluginName][$key]; } else { $baseTranslation = ''; } // ensure that translated strings have the same number of %s as the english source strings - $baseCount = $this->_getParametersCountToReplace($baseTranslation); + $baseCount = $this->_getParametersCountToReplace($baseTranslation); $translationCount = $this->_getParametersCountToReplace($translation); - if ($baseCount != $translationCount) { + if ($baseCount != $translationCount) { $this->filteredData[$pluginName][$key] = $translation; continue; @@ -76,7 +75,7 @@ class ByParameterCount extends FilterAbstract * @param string $string * @return array */ - protected function _getParametersCountToReplace($string) + protected function _getParametersCountToReplace($string) { $sprintfParameters = array('%s', '%1$s', '%2$s', '%3$s', '%4$s', '%5$s', '%6$s', '%7$s', '%8$s', '%9$s'); $count = array(); diff --git a/core/Translate/Filter/EmptyTranslations.php b/core/Translate/Filter/EmptyTranslations.php index d6b9786735..be3f470aac 100644 --- a/core/Translate/Filter/EmptyTranslations.php +++ b/core/Translate/Filter/EmptyTranslations.php @@ -12,7 +12,6 @@ namespace Piwik\Translate\Filter; - /** * @package Piwik * @subpackage Piwik_Translate @@ -33,7 +32,7 @@ class EmptyTranslations extends FilterAbstract foreach ($translations AS $plugin => &$pluginTranslations) { - $pluginTranslations = array_filter($pluginTranslations, function($value) { + $pluginTranslations = array_filter($pluginTranslations, function ($value) { return !empty($value) && '' != trim($value); }); @@ -44,7 +43,7 @@ class EmptyTranslations extends FilterAbstract } // remove plugins without translations - $translations = array_filter($translations, function($value) { + $translations = array_filter($translations, function ($value) { return !empty($value) && count($value); }); diff --git a/core/Translate/Filter/UnnecassaryWhitespaces.php b/core/Translate/Filter/UnnecassaryWhitespaces.php index 900bac5327..f72f32ce5a 100644 --- a/core/Translate/Filter/UnnecassaryWhitespaces.php +++ b/core/Translate/Filter/UnnecassaryWhitespaces.php @@ -12,7 +12,6 @@ namespace Piwik\Translate\Filter; - /** * @package Piwik * @subpackage Piwik_Translate @@ -26,7 +25,7 @@ class UnnecassaryWhitespaces extends FilterAbstract * * @param array $baseTranslations */ - public function __construct($baseTranslations=array()) + public function __construct($baseTranslations = array()) { $this->baseTranslations = $baseTranslations; } @@ -46,7 +45,7 @@ class UnnecassaryWhitespaces extends FilterAbstract $baseTranslation = ''; if (isset($this->baseTranslations[$pluginName][$key])) { - $baseTranslation = $this->baseTranslations[$pluginName][$key]; + $baseTranslation = $this->baseTranslations[$pluginName][$key]; } // remove excessive line breaks (and leading/trailing whitespace) from translations diff --git a/core/Translate/Validate/CoreTranslations.php b/core/Translate/Validate/CoreTranslations.php index 5a7c0ebc11..160f09b1e9 100644 --- a/core/Translate/Validate/CoreTranslations.php +++ b/core/Translate/Validate/CoreTranslations.php @@ -23,14 +23,14 @@ class CoreTranslations extends ValidateAbstract /** * Error States */ - const ERRORSTATE_MINIMUMTRANSLATIONS = 'At least 250 translations required'; - const ERRORSTATE_LOCALEREQUIRED = 'Locale required'; - const ERRORSTATE_TRANSLATORINFOREQUIRED = 'Translator info required'; - const ERRORSTATE_TRANSLATOREMAILREQUIRED = 'Translator email required'; - const ERRORSTATE_LAYOUTDIRECTIONINVALID = 'Layout direction must be rtl or ltr'; - const ERRORSTATE_LOCALEINVALID = 'Locale is invalid'; - const ERRORSTATE_LOCALEINVALIDLANGUAGE = 'Locale is invalid - invalid language code'; - const ERRORSTATE_LOCALEINVALIDCOUNTRY = 'Locale is invalid - invalid country code'; + const ERRORSTATE_MINIMUMTRANSLATIONS = 'At least 250 translations required'; + const ERRORSTATE_LOCALEREQUIRED = 'Locale required'; + const ERRORSTATE_TRANSLATORINFOREQUIRED = 'Translator info required'; + const ERRORSTATE_TRANSLATOREMAILREQUIRED = 'Translator email required'; + const ERRORSTATE_LAYOUTDIRECTIONINVALID = 'Layout direction must be rtl or ltr'; + const ERRORSTATE_LOCALEINVALID = 'Locale is invalid'; + const ERRORSTATE_LOCALEINVALIDLANGUAGE = 'Locale is invalid - invalid language code'; + const ERRORSTATE_LOCALEINVALIDCOUNTRY = 'Locale is invalid - invalid country code'; protected $baseTranslations = array(); @@ -39,7 +39,7 @@ class CoreTranslations extends ValidateAbstract * * @param array $baseTranslations */ - public function __construct($baseTranslations=array()) + public function __construct($baseTranslations = array()) { $this->baseTranslations = $baseTranslations; } diff --git a/core/Translate/Writer.php b/core/Translate/Writer.php index 4360b1ecbf..800bbf7d47 100644 --- a/core/Translate/Writer.php +++ b/core/Translate/Writer.php @@ -74,8 +74,8 @@ class Writer */ protected $filterMessages = array(); - const UNFILTERED = 'unfiltered'; - const FILTERED = 'filtered'; + const UNFILTERED = 'unfiltered'; + const FILTERED = 'filtered'; protected $currentState = self::UNFILTERED; @@ -83,11 +83,11 @@ class Writer * If $pluginName is given, Writer will be initialized for the given plugin if it exists * Otherwise it will be initialized for core translations * - * @param string $language ISO 639-1 alpha-2 language code - * @param string $pluginName optional plugin name + * @param string $language ISO 639-1 alpha-2 language code + * @param string $pluginName optional plugin name * @throws \Exception */ - public function __construct($language, $pluginName=null) + public function __construct($language, $pluginName = null) { $this->setLanguage($language); @@ -104,7 +104,7 @@ class Writer } /** - * @param string $language ISO 639-1 alpha-2 language code + * @param string $language ISO 639-1 alpha-2 language code * * @throws \Exception */ @@ -149,7 +149,7 @@ class Writer /** * Get translations from file * - * @param string $lang ISO 639-1 alpha-2 language code + * @param string $lang ISO 639-1 alpha-2 language code * @throws Exception * @return array Array of translations ( plugin => ( key => translated string ) ) */ @@ -189,11 +189,11 @@ class Writer * Get translation file path based on given params * * @param string $base Optional base directory (either 'lang' or 'tmp') - * @param string|null $lang forced language + * @param string|null $lang forced language * @throws \Exception * @return string path */ - protected function getTranslationPathBaseDirectory($base, $lang=null) + protected function getTranslationPathBaseDirectory($base, $lang = null) { if (empty($lang)) { $lang = $this->getLanguage(); @@ -371,7 +371,7 @@ class Writer $cleanedTranslations = $filter->filter($cleanedTranslations); $filteredData = $filter->getFilteredData(); if (!empty($filteredData)) { - $this->filterMessages[] = get_class($filter) . " changed: " .var_export($filteredData, 1); + $this->filterMessages[] = get_class($filter) . " changed: " . var_export($filteredData, 1); } } diff --git a/core/Twig.php b/core/Twig.php index 3155f5b0d8..8ec3fa5bee 100644 --- a/core/Twig.php +++ b/core/Twig.php @@ -30,7 +30,7 @@ class Twig { const SPARKLINE_TEMPLATE = '<img alt="" data-src="%s" width="%d" height="%d" /> <script type="text/javascript">$(function() { piwik.initSparklines(); });</script>'; - + /** * @var Twig_Environment */ diff --git a/core/Unzip.php b/core/Unzip.php index d3bb716caf..8a26de2e2e 100644 --- a/core/Unzip.php +++ b/core/Unzip.php @@ -26,8 +26,8 @@ class Unzip /** * Factory method to create an unarchiver * - * @param string $name Name of unarchiver - * @param string $filename Name of .zip archive + * @param string $name Name of unarchiver + * @param string $filename Name of .zip archive * @return \Piwik\Unzip\UncompressInterface */ static public function factory($name, $filename) diff --git a/core/Unzip/Gzip.php b/core/Unzip/Gzip.php index 1aa45fa633..bc9a21bc35 100755 --- a/core/Unzip/Gzip.php +++ b/core/Unzip/Gzip.php @@ -12,7 +12,6 @@ namespace Piwik\Unzip; - /** * Unzip implementation for .gz files. * diff --git a/core/Unzip/PclZip.php b/core/Unzip/PclZip.php index 2d4771c617..046086fd3a 100644 --- a/core/Unzip/PclZip.php +++ b/core/Unzip/PclZip.php @@ -11,7 +11,6 @@ namespace Piwik\Unzip; - /** * @see libs/PclZip */ @@ -37,7 +36,7 @@ class PclZip implements UncompressInterface /** * Constructor * - * @param string $filename Name of the .zip archive + * @param string $filename Name of the .zip archive */ public function __construct($filename) { @@ -48,7 +47,7 @@ class PclZip implements UncompressInterface /** * Extract files from archive to target directory * - * @param string $pathExtracted Absolute path of target directory + * @param string $pathExtracted Absolute path of target directory * @return mixed Array of filenames if successful; or 0 if an error occurred */ public function extract($pathExtracted) @@ -76,7 +75,7 @@ class PclZip implements UncompressInterface PCLZIP_OPT_PATH, $pathExtracted, PCLZIP_OPT_STOP_ON_ERROR, PCLZIP_OPT_REPLACE_NEWER, - PCLZIP_CB_PRE_EXTRACT, function($p_event, &$p_header) use ($pathExtracted) { + PCLZIP_CB_PRE_EXTRACT, function ($p_event, &$p_header) use ($pathExtracted) { return strncmp($p_header['filename'], $pathExtracted, strlen($pathExtracted)) ? 0 : 1; } ); diff --git a/core/Unzip/UncompressInterface.php b/core/Unzip/UncompressInterface.php index 36a95143d2..521a6e5013 100644 --- a/core/Unzip/UncompressInterface.php +++ b/core/Unzip/UncompressInterface.php @@ -22,14 +22,14 @@ interface UncompressInterface /** * Constructor * - * @param string $filename Name of the .zip archive + * @param string $filename Name of the .zip archive */ public function __construct($filename); /** * Extract files from archive to target directory * - * @param string $pathExtracted Absolute path of target directory + * @param string $pathExtracted Absolute path of target directory * @return mixed Array of filenames if successful; or 0 if an error occurred */ public function extract($pathExtracted); diff --git a/core/Unzip/ZipArchive.php b/core/Unzip/ZipArchive.php index 7a058ae902..0e8e27e171 100644 --- a/core/Unzip/ZipArchive.php +++ b/core/Unzip/ZipArchive.php @@ -32,7 +32,7 @@ class ZipArchive implements UncompressInterface /** * Constructor * - * @param string $filename Name of the .zip archive + * @param string $filename Name of the .zip archive * @throws Exception */ public function __construct($filename) @@ -47,7 +47,7 @@ class ZipArchive implements UncompressInterface /** * Extract files from archive to target directory * - * @param string $pathExtracted Absolute path of target directory + * @param string $pathExtracted Absolute path of target directory * @return mixed Array of filenames if successful; or 0 if an error occurred */ public function extract($pathExtracted) diff --git a/core/UpdateCheck.php b/core/UpdateCheck.php index 45e0c02370..a677abdd43 100644 --- a/core/UpdateCheck.php +++ b/core/UpdateCheck.php @@ -29,8 +29,8 @@ class UpdateCheck /** * Check for a newer version * - * @param bool $force Force check - * @param int $interval Interval used for update checks + * @param bool $force Force check + * @param int $interval Interval used for update checks */ public static function check($force = false, $interval = null) { diff --git a/core/Updater.php b/core/Updater.php index 3566ecc5c0..775398ce13 100644 --- a/core/Updater.php +++ b/core/Updater.php @@ -92,7 +92,7 @@ class Updater public function hasNewVersion($componentName) { return isset($this->componentsWithNewVersion) && - isset($this->componentsWithNewVersion[$componentName]); + isset($this->componentsWithNewVersion[$componentName]); } /** @@ -145,7 +145,7 @@ class Updater if ($componentName == 'core') { return '\\Piwik\\Updates\\' . $className; } - return '\\Piwik\\Plugins\\' . $componentName . '\\'. $className; + return '\\Piwik\\Plugins\\' . $componentName . '\\' . $className; } /** diff --git a/core/Updates.php b/core/Updates.php index a0b1204a0c..acfeb03d00 100644 --- a/core/Updates.php +++ b/core/Updates.php @@ -21,7 +21,7 @@ abstract class Updates /** * Return SQL to be executed in this update * - * @param string $schema Schema name + * @param string $schema Schema name * @return array( * 'ALTER .... ' => '1234', // if the query fails, it will be ignored if the error code is 1234 * 'ALTER .... ' => false, // if an error occurs, the update will stop and fail diff --git a/core/Updates/0.2.10.php b/core/Updates/0.2.10.php index 6d4a571889..b3f3cfcc54 100644 --- a/core/Updates/0.2.10.php +++ b/core/Updates/0.2.10.php @@ -29,7 +29,7 @@ class Updates_0_2_10 extends Updates option_name VARCHAR( 64 ) NOT NULL , option_value LONGTEXT NOT NULL , PRIMARY KEY ( idoption , option_name ) - )' => false, + )' => false, // 0.1.7 [463] 'ALTER IGNORE TABLE `' . Common::prefixTable('log_visit') . '` diff --git a/core/Updates/0.2.12.php b/core/Updates/0.2.12.php index 2037906faa..17b23319a6 100644 --- a/core/Updates/0.2.12.php +++ b/core/Updates/0.2.12.php @@ -24,7 +24,7 @@ class Updates_0_2_12 extends Updates { return array( 'ALTER TABLE `' . Common::prefixTable('site') . '` - CHANGE `ts_created` `ts_created` TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL' => false, + CHANGE `ts_created` `ts_created` TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL' => false, 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` DROP `config_color_depth`' => false, diff --git a/core/Updates/0.2.27.php b/core/Updates/0.2.27.php index 55accb705a..adafc426ec 100644 --- a/core/Updates/0.2.27.php +++ b/core/Updates/0.2.27.php @@ -25,7 +25,7 @@ class Updates_0_2_27 extends Updates { $sqlarray = array( 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` - ADD `visit_goal_converted` VARCHAR( 1 ) NOT NULL AFTER `visit_total_time`' => false, + ADD `visit_goal_converted` VARCHAR( 1 ) NOT NULL AFTER `visit_total_time`' => false, // 0.2.27 [826] 'ALTER IGNORE TABLE `' . Common::prefixTable('log_visit') . '` CHANGE `visit_goal_converted` `visit_goal_converted` TINYINT(1) NOT NULL' => false, diff --git a/core/Updates/0.2.32.php b/core/Updates/0.2.32.php index 4e4257bbbc..0b4b7fad33 100644 --- a/core/Updates/0.2.32.php +++ b/core/Updates/0.2.32.php @@ -25,7 +25,7 @@ class Updates_0_2_32 extends Updates return array( // 0.2.32 [941] 'ALTER TABLE `' . Common::prefixTable('access') . '` - CHANGE `login` `login` VARCHAR( 100 ) NOT NULL' => false, + CHANGE `login` `login` VARCHAR( 100 ) NOT NULL' => false, 'ALTER TABLE `' . Common::prefixTable('user') . '` CHANGE `login` `login` VARCHAR( 100 ) NOT NULL' => false, 'ALTER TABLE `' . Common::prefixTable('user_dashboard') . '` diff --git a/core/Updates/0.2.33.php b/core/Updates/0.2.33.php index 8d3a328cd2..c42a519d1e 100644 --- a/core/Updates/0.2.33.php +++ b/core/Updates/0.2.33.php @@ -26,7 +26,7 @@ class Updates_0_2_33 extends Updates $sqlarray = array( // 0.2.33 [1020] 'ALTER TABLE `' . Common::prefixTable('user_dashboard') . '` - CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci ' => '1146', + CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci ' => '1146', 'ALTER TABLE `' . Common::prefixTable('user_language') . '` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci ' => '1146', ); diff --git a/core/Updates/0.4.1.php b/core/Updates/0.4.1.php index 4a1231f7d1..110a082f3b 100644 --- a/core/Updates/0.4.1.php +++ b/core/Updates/0.4.1.php @@ -24,7 +24,7 @@ class Updates_0_4_1 extends Updates { return array( 'ALTER TABLE `' . Common::prefixTable('log_conversion') . '` - CHANGE `idlink_va` `idlink_va` INT(11) DEFAULT NULL' => false, + CHANGE `idlink_va` `idlink_va` INT(11) DEFAULT NULL' => false, 'ALTER TABLE `' . Common::prefixTable('log_conversion') . '` CHANGE `idaction` `idaction` INT(11) DEFAULT NULL' => '1054', ); diff --git a/core/Updates/0.4.2.php b/core/Updates/0.4.2.php index 363976a980..b3efa86497 100644 --- a/core/Updates/0.4.2.php +++ b/core/Updates/0.4.2.php @@ -24,7 +24,7 @@ class Updates_0_4_2 extends Updates { return array( 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` - ADD `config_java` TINYINT(1) NOT NULL AFTER `config_flash`' => '1060', + ADD `config_java` TINYINT(1) NOT NULL AFTER `config_flash`' => '1060', 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` ADD `config_quicktime` TINYINT(1) NOT NULL AFTER `config_director`' => '1060', 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` diff --git a/core/Updates/0.4.php b/core/Updates/0.4.php index 0e903c131b..58ff867d5f 100644 --- a/core/Updates/0.4.php +++ b/core/Updates/0.4.php @@ -25,7 +25,7 @@ class Updates_0_4 extends Updates return array( // 0.4 [1140] 'UPDATE `' . Common::prefixTable('log_visit') . '` - SET location_ip=location_ip+CAST(POW(2,32) AS UNSIGNED) WHERE location_ip < 0' => false, + SET location_ip=location_ip+CAST(POW(2,32) AS UNSIGNED) WHERE location_ip < 0' => false, 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` CHANGE `location_ip` `location_ip` BIGINT UNSIGNED NOT NULL' => false, 'UPDATE `' . Common::prefixTable('logger_api_call') . '` diff --git a/core/Updates/0.6.3.php b/core/Updates/0.6.3.php index 12e4451b6a..169acd4061 100644 --- a/core/Updates/0.6.3.php +++ b/core/Updates/0.6.3.php @@ -25,7 +25,7 @@ class Updates_0_6_3 extends Updates { return array( 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` - CHANGE `location_ip` `location_ip` INT UNSIGNED NOT NULL' => false, + CHANGE `location_ip` `location_ip` INT UNSIGNED NOT NULL' => false, 'ALTER TABLE `' . Common::prefixTable('logger_api_call') . '` CHANGE `caller_ip` `caller_ip` INT UNSIGNED' => false, ); diff --git a/core/Updates/0.9.1.php b/core/Updates/0.9.1.php index a1fa17e23b..5f9908c828 100644 --- a/core/Updates/0.9.1.php +++ b/core/Updates/0.9.1.php @@ -42,7 +42,7 @@ class Updates_0_9_1 extends Updates return array( 'UPDATE ' . Common::prefixTable('site') . ' SET timezone = "UTC" - WHERE timezone IN (' . $timezoneList . ')' => false, + WHERE timezone IN (' . $timezoneList . ')' => false, 'UPDATE `' . Common::prefixTable('option') . '` SET option_value = "UTC" diff --git a/core/Updates/1.10.2-b1.php b/core/Updates/1.10.2-b1.php index 129c5d49d5..c76af3a382 100755 --- a/core/Updates/1.10.2-b1.php +++ b/core/Updates/1.10.2-b1.php @@ -25,7 +25,7 @@ class Updates_1_10_2_b1 extends Updates return array( // ignore existing column name error (1060) 'ALTER TABLE ' . Common::prefixTable('report') - . " ADD COLUMN hour tinyint NOT NULL default 0 AFTER period" => 1060, + . " ADD COLUMN hour tinyint NOT NULL default 0 AFTER period" => 1060, ); } diff --git a/core/Updates/1.10.2-b2.php b/core/Updates/1.10.2-b2.php index d5f6ef460b..2a009c5f79 100644 --- a/core/Updates/1.10.2-b2.php +++ b/core/Updates/1.10.2-b2.php @@ -25,7 +25,7 @@ class Updates_1_10_2_b2 extends Updates return array( // ignore existing column name error (1060) 'ALTER TABLE ' . Common::prefixTable('site') - . " ADD COLUMN `keep_url_fragment` TINYINT NOT NULL DEFAULT 0 AFTER `group`" => 1060, + . " ADD COLUMN `keep_url_fragment` TINYINT NOT NULL DEFAULT 0 AFTER `group`" => 1060, ); } diff --git a/core/Updates/1.12-b16.php b/core/Updates/1.12-b16.php index 973107adc0..ec69b950b7 100644 --- a/core/Updates/1.12-b16.php +++ b/core/Updates/1.12-b16.php @@ -25,7 +25,7 @@ class Updates_1_12_b16 extends Updates return array( // ignore existing column name error (1060) 'ALTER TABLE ' . Common::prefixTable('report') - . " ADD COLUMN idsegment INT(11) AFTER description" => 1060, + . " ADD COLUMN idsegment INT(11) AFTER description" => 1060, ); } diff --git a/core/Updates/1.2-rc1.php b/core/Updates/1.2-rc1.php index 361da47295..0536fd72a5 100644 --- a/core/Updates/1.2-rc1.php +++ b/core/Updates/1.2-rc1.php @@ -48,14 +48,14 @@ class Updates_1_2_rc1 extends Updates ADD custom_var_v4 VARCHAR(100) DEFAULT NULL, ADD custom_var_k5 VARCHAR(100) DEFAULT NULL, ADD custom_var_v5 VARCHAR(100) DEFAULT NULL - ' => false, + ' => false, 'ALTER TABLE `' . Common::prefixTable('log_link_visit_action') . '` ADD `idsite` INT( 10 ) UNSIGNED NOT NULL AFTER `idlink_va` , ADD `server_time` DATETIME AFTER `idsite`, ADD `idvisitor` BINARY(8) NOT NULL AFTER `idsite`, ADD `idaction_name_ref` INT UNSIGNED NOT NULL AFTER `idaction_name`, ADD INDEX `index_idsite_servertime` ( `idsite` , `server_time` ) - ' => false, + ' => false, 'ALTER TABLE `' . Common::prefixTable('log_conversion') . '` DROP `referer_idvisit`, @@ -72,30 +72,30 @@ class Updates_1_2_rc1 extends Updates ADD custom_var_v4 VARCHAR(100) DEFAULT NULL, ADD custom_var_k5 VARCHAR(100) DEFAULT NULL, ADD custom_var_v5 VARCHAR(100) DEFAULT NULL - ' => false, + ' => false, // Migrate 128bits IDs inefficiently stored as 8bytes (256 bits) into 64bits 'UPDATE ' . Common::prefixTable('log_visit') . ' SET idvisitor = binary(unhex(substring(visitor_idcookie,1,16))), config_id = binary(unhex(substring(config_md5config,1,16))) - ' => false, + ' => false, 'UPDATE ' . Common::prefixTable('log_conversion') . ' SET idvisitor = binary(unhex(substring(visitor_idcookie,1,16))) - ' => false, + ' => false, // Drop migrated fields 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` DROP visitor_idcookie, DROP config_md5config - ' => false, + ' => false, 'ALTER TABLE `' . Common::prefixTable('log_conversion') . '` DROP visitor_idcookie - ' => false, + ' => false, // Recreate INDEX on new field 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` ADD INDEX `index_idsite_datetime_config` (idsite, visit_last_action_time, config_id) - ' => false, + ' => false, // Backfill action logs as best as we can 'UPDATE ' . Common::prefixTable('log_link_visit_action') . ' as action, @@ -108,13 +108,13 @@ class Updates_1_2_rc1 extends Updates 'ALTER TABLE `' . Common::prefixTable('log_link_visit_action') . '` CHANGE `server_time` `server_time` DATETIME NOT NULL - ' => false, + ' => false, // New index used max once per request, in case this table grows significantly in the future - 'ALTER TABLE `' . Common::prefixTable('option') . '` ADD INDEX ( `autoload` ) ' => false, + 'ALTER TABLE `' . Common::prefixTable('option') . '` ADD INDEX ( `autoload` ) ' => false, // new field for websites - 'ALTER TABLE `' . Common::prefixTable('site') . '` ADD `group` VARCHAR( 250 ) NOT NULL' => false, + 'ALTER TABLE `' . Common::prefixTable('site') . '` ADD `group` VARCHAR( 250 ) NOT NULL' => false, ); } diff --git a/core/Updates/1.2.5-rc1.php b/core/Updates/1.2.5-rc1.php index 19e29173ee..5212d67e7e 100644 --- a/core/Updates/1.2.5-rc1.php +++ b/core/Updates/1.2.5-rc1.php @@ -24,7 +24,7 @@ class Updates_1_2_5_rc1 extends Updates { return array( 'ALTER TABLE `' . Common::prefixTable('goal') . '` - ADD `allow_multiple` tinyint(4) NOT NULL AFTER case_sensitive' => false, + ADD `allow_multiple` tinyint(4) NOT NULL AFTER case_sensitive' => false, 'ALTER TABLE `' . Common::prefixTable('log_conversion') . '` ADD buster int unsigned NOT NULL AFTER revenue, DROP PRIMARY KEY, diff --git a/core/Updates/1.4-rc1.php b/core/Updates/1.4-rc1.php index dfb7335baa..a96d3af22d 100644 --- a/core/Updates/1.4-rc1.php +++ b/core/Updates/1.4-rc1.php @@ -24,7 +24,7 @@ class Updates_1_4_rc1 extends Updates { return array( 'UPDATE `' . Common::prefixTable('pdf') . '` - SET format = "pdf"' => '42S22', + SET format = "pdf"' => '42S22', 'ALTER TABLE `' . Common::prefixTable('pdf') . '` ADD COLUMN `format` VARCHAR(10)' => '42S22', ); diff --git a/core/Updates/1.4-rc2.php b/core/Updates/1.4-rc2.php index 053514047b..1c1f182efd 100644 --- a/core/Updates/1.4-rc2.php +++ b/core/Updates/1.4-rc2.php @@ -23,7 +23,7 @@ class Updates_1_4_rc2 extends Updates static function getSql($schema = 'Myisam') { return array( - "SET sql_mode=''" => false, + "SET sql_mode=''" => false, // this converts the 32-bit UNSIGNED INT column to a 16 byte VARBINARY; // _but_ MySQL does string conversion! (e.g., integer 1 is converted to 49 -- the ASCII code for "1") 'ALTER TABLE ' . Common::prefixTable('log_visit') . ' diff --git a/core/Updates/1.5-b1.php b/core/Updates/1.5-b1.php index 2933c978d3..235a55305e 100644 --- a/core/Updates/1.5-b1.php +++ b/core/Updates/1.5-b1.php @@ -40,7 +40,7 @@ class Updates_1_5_b1 extends Updates PRIMARY KEY(idvisit, idorder, idaction_sku), INDEX index_idsite_servertime ( idsite, server_time ) - ) DEFAULT CHARSET=utf8 ' => false, + ) DEFAULT CHARSET=utf8 ' => false, 'ALTER IGNORE TABLE `' . Common::prefixTable('log_visit') . '` ADD visitor_days_since_order SMALLINT(5) UNSIGNED NOT NULL AFTER visitor_days_since_last, diff --git a/core/Updates/1.5-b3.php b/core/Updates/1.5-b3.php index be7c73efc2..6f9be090e1 100644 --- a/core/Updates/1.5-b3.php +++ b/core/Updates/1.5-b3.php @@ -33,7 +33,7 @@ class Updates_1_5_b3 extends Updates CHANGE custom_var_k4 custom_var_k4 VARCHAR(100) DEFAULT NULL, CHANGE custom_var_v4 custom_var_v4 VARCHAR(100) DEFAULT NULL, CHANGE custom_var_k5 custom_var_k5 VARCHAR(100) DEFAULT NULL, - CHANGE custom_var_v5 custom_var_v5 VARCHAR(100) DEFAULT NULL' => false, + CHANGE custom_var_v5 custom_var_v5 VARCHAR(100) DEFAULT NULL' => false, 'ALTER TABLE `' . Common::prefixTable('log_conversion') . '` CHANGE custom_var_k1 custom_var_k1 VARCHAR(100) DEFAULT NULL, CHANGE custom_var_v1 custom_var_v1 VARCHAR(100) DEFAULT NULL, diff --git a/core/Updates/1.6-b1.php b/core/Updates/1.6-b1.php index ba3cd3b778..84ca9a278e 100644 --- a/core/Updates/1.6-b1.php +++ b/core/Updates/1.6-b1.php @@ -27,7 +27,7 @@ class Updates_1_6_b1 extends Updates ADD idaction_category2 INTEGER(10) UNSIGNED NOT NULL AFTER idaction_category, ADD idaction_category3 INTEGER(10) UNSIGNED NOT NULL, ADD idaction_category4 INTEGER(10) UNSIGNED NOT NULL, - ADD idaction_category5 INTEGER(10) UNSIGNED NOT NULL' => false, + ADD idaction_category5 INTEGER(10) UNSIGNED NOT NULL' => false, 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` CHANGE custom_var_k1 custom_var_k1 VARCHAR(200) DEFAULT NULL, CHANGE custom_var_v1 custom_var_v1 VARCHAR(200) DEFAULT NULL, diff --git a/core/Updates/1.7-b1.php b/core/Updates/1.7-b1.php index 3240204d18..2e95a79e46 100644 --- a/core/Updates/1.7-b1.php +++ b/core/Updates/1.7-b1.php @@ -24,7 +24,7 @@ class Updates_1_7_b1 extends Updates { return array( 'ALTER TABLE `' . Common::prefixTable('pdf') . '` - ADD COLUMN `aggregate_reports_format` TINYINT(1) NOT NULL AFTER `reports`' => false, + ADD COLUMN `aggregate_reports_format` TINYINT(1) NOT NULL AFTER `reports`' => false, 'UPDATE `' . Common::prefixTable('pdf') . '` SET `aggregate_reports_format` = 1' => false, ); diff --git a/core/Updates/1.8.3-b1.php b/core/Updates/1.8.3-b1.php index 92d5062879..654a53c6d3 100644 --- a/core/Updates/1.8.3-b1.php +++ b/core/Updates/1.8.3-b1.php @@ -27,7 +27,7 @@ class Updates_1_8_3_b1 extends Updates { return array( 'ALTER TABLE `' . Common::prefixTable('site') . '` - CHANGE `excluded_parameters` `excluded_parameters` TEXT NOT NULL' => false, + CHANGE `excluded_parameters` `excluded_parameters` TEXT NOT NULL' => false, 'CREATE TABLE `' . Common::prefixTable('report') . '` ( `idreport` INT(11) NOT NULL AUTO_INCREMENT, diff --git a/core/Updates/1.9-b16.php b/core/Updates/1.9-b16.php index 63d4b2c981..a15e029cb1 100755 --- a/core/Updates/1.9-b16.php +++ b/core/Updates/1.9-b16.php @@ -41,7 +41,7 @@ class Updates_1_9_b16 extends Updates ADD sitesearch TINYINT DEFAULT 1 AFTER `excluded_parameters`, ADD sitesearch_keyword_parameters TEXT NOT NULL AFTER `sitesearch`, ADD sitesearch_category_parameters TEXT NOT NULL AFTER `sitesearch_keyword_parameters`' - => 1060, + => 1060, // enable Site Search for all websites, users can manually disable the setting 'UPDATE `' . Common::prefixTable('site') . '` diff --git a/core/Updates/1.9.3-b8.php b/core/Updates/1.9.3-b8.php index b588855846..1cfaf2f6c5 100755 --- a/core/Updates/1.9.3-b8.php +++ b/core/Updates/1.9.3-b8.php @@ -25,7 +25,7 @@ class Updates_1_9_3_b8 extends Updates return array( // ignore existing column name error (1060) 'ALTER TABLE ' . Common::prefixTable('site') - . " ADD COLUMN excluded_user_agents TEXT NOT NULL AFTER excluded_parameters" => 1060, + . " ADD COLUMN excluded_user_agents TEXT NOT NULL AFTER excluded_parameters" => 1060, ); } diff --git a/core/Updates/2.0-a12.php b/core/Updates/2.0-a12.php index de9815cfec..588cde544c 100644 --- a/core/Updates/2.0-a12.php +++ b/core/Updates/2.0-a12.php @@ -22,7 +22,7 @@ class Updates_2_0_a12 extends Updates { public static function getSql($schema = 'Myisam') { - $result = array( + $result = array( 'ALTER TABLE ' . Common::prefixTable('logger_message') . ' MODIFY level VARCHAR(16) NULL' => false ); diff --git a/core/Updates/2.0-a13.php b/core/Updates/2.0-a13.php index b2168967ee..fac9982240 100644 --- a/core/Updates/2.0-a13.php +++ b/core/Updates/2.0-a13.php @@ -68,11 +68,11 @@ class Updates_2_0_a13 extends Updates try { \Piwik\PluginsManager::getInstance()->activatePlugin('Referrers'); - } catch(\Exception $e) { + } catch (\Exception $e) { } try { \Piwik\PluginsManager::getInstance()->activatePlugin('ScheduledReports'); - } catch(\Exception $e) { + } catch (\Exception $e) { } } diff --git a/core/Updates/2.0-a7.php b/core/Updates/2.0-a7.php index 1086997540..c19a54819f 100644 --- a/core/Updates/2.0-a7.php +++ b/core/Updates/2.0-a7.php @@ -25,10 +25,10 @@ class Updates_2_0_a7 extends Updates return array( // ignore existing column name error (1060) 'ALTER TABLE ' . Common::prefixTable('logger_message') - . " ADD COLUMN tag VARCHAR(50) NULL AFTER idlogger_message" => 1060, + . " ADD COLUMN tag VARCHAR(50) NULL AFTER idlogger_message" => 1060, 'ALTER TABLE ' . Common::prefixTable('logger_message') - . " ADD COLUMN level TINYINT AFTER timestamp" => 1060, + . " ADD COLUMN level TINYINT AFTER timestamp" => 1060, ); } diff --git a/core/Url.php b/core/Url.php index 3f597e5386..6a4f4a4ad7 100644 --- a/core/Url.php +++ b/core/Url.php @@ -35,9 +35,9 @@ class Url static public function getCurrentUrl() { return self::getCurrentScheme() . '://' - . self::getCurrentHost() - . self::getCurrentScriptName() - . self::getCurrentQueryString(); + . self::getCurrentHost() + . self::getCurrentScriptName() + . self::getCurrentQueryString(); } /** @@ -51,8 +51,8 @@ class Url static public function getCurrentUrlWithoutQueryString($checkTrustedHost = true) { return self::getCurrentScheme() . '://' - . self::getCurrentHost($default = 'unknown', $checkTrustedHost) - . self::getCurrentScriptName(); + . self::getCurrentHost($default = 'unknown', $checkTrustedHost) + . self::getCurrentScriptName(); } /** @@ -64,8 +64,8 @@ class Url static public function getCurrentUrlWithoutFileName() { return self::getCurrentScheme() . '://' - . self::getCurrentHost() - . self::getCurrentScriptPath(); + . self::getCurrentHost() + . self::getCurrentScriptPath(); } /** @@ -451,8 +451,8 @@ class Url $parsedUrl = @parse_url($url); $host = IP::sanitizeIp(@$parsedUrl['host']); return !empty($host) - && ($disableHostCheck || in_array($host, $hosts)) - && !empty($parsedUrl['scheme']) - && in_array($parsedUrl['scheme'], array('http', 'https')); + && ($disableHostCheck || in_array($host, $hosts)) + && !empty($parsedUrl['scheme']) + && in_array($parsedUrl['scheme'], array('http', 'https')); } } diff --git a/core/UrlHelper.php b/core/UrlHelper.php index 3c6eda5b0d..bbb4dbb2d7 100644 --- a/core/UrlHelper.php +++ b/core/UrlHelper.php @@ -197,7 +197,7 @@ class UrlHelper /** * Returns the value of a GET parameter $parameter in an URL query $urlQuery * - * @param string $urlQuery result of parse_url()['query'] and htmlentitied (& is &) eg. module=test&action=toto or ?page=test + * @param string $urlQuery result of parse_url()['query'] and htmlentitied (& is &) eg. module=test&action=toto or ?page=test * @param string $parameter * @return string|bool Parameter value if found (can be the empty string!), null if not found */ @@ -214,7 +214,7 @@ class UrlHelper * Returns the path and query part from a URL. * Eg. http://piwik.org/test/index.php?module=CoreHome will return /test/index.php?module=CoreHome * - * @param string $url either http://piwik.org/test or / + * @param string $url either http://piwik.org/test or / * @return string */ public static function getPathAndQueryFromUrl($url) @@ -245,7 +245,7 @@ class UrlHelper * as the google keyword parameter couldn't be found. * * @see unit tests in /tests/core/Common.test.php - * @param string $referrerUrl URL referrer URL, eg. $_SERVER['HTTP_REFERER'] + * @param string $referrerUrl URL referrer URL, eg. $_SERVER['HTTP_REFERER'] * @return array|bool false if a keyword couldn't be extracted, * or array( * 'name' => 'Google', diff --git a/core/View.php b/core/View.php index 4b593103f9..ce4a85d10d 100644 --- a/core/View.php +++ b/core/View.php @@ -59,7 +59,7 @@ class View implements ViewInterface /** * Returns the template filename. - * + * * @return string */ public function getTemplateFile() @@ -69,7 +69,7 @@ class View implements ViewInterface /** * Returns the variables to bind to the template when rendering. - * + * * @return array */ public function getTemplateVars() @@ -123,7 +123,7 @@ class View implements ViewInterface $count = SettingsPiwik::getWebsitesCountToDisplay(); $sites = APISitesManager::getInstance()->getSitesWithAtLeastViewAccess($count); - usort($sites, function($site1, $site2) { + usort($sites, function ($site1, $site2) { return strcasecmp($site1["name"], $site2["name"]); }); $this->sites = $sites; diff --git a/core/ViewDataTable.php b/core/ViewDataTable.php index 4edacabea4..c37b067ba2 100644 --- a/core/ViewDataTable.php +++ b/core/ViewDataTable.php @@ -117,14 +117,14 @@ class ViewDataTable /** * The class name of the visualization to use. - * + * * @var string|null */ private $visualizationClass; /** * Cache for getAllReportDisplayProperties result. - * + * * @var array */ public static $reportPropertiesCache = null; @@ -228,7 +228,7 @@ class ViewDataTable /** * Returns the API method that will be called to obatin the report data. - * + * * @return string e.g. 'Actions.getPageUrls' */ public function getReportApiMethod() @@ -238,7 +238,7 @@ class ViewDataTable /** * Returns the view's associated visualization class name. - * + * * @return string */ public function getVisualizationClass() @@ -248,7 +248,7 @@ class ViewDataTable /** * Gets a view property by reference. - * + * * @param string $name A valid view property name. @see Properties for all * valid view properties. * @return mixed @@ -262,7 +262,7 @@ class ViewDataTable /** * Sets a view property. - * + * * @param string $name A valid view property name. @see Properties for all * valid view properties. * @param mixed $value @@ -301,10 +301,10 @@ class ViewDataTable * If defaultType is specified and if there is no 'viewDataTable' in the URL, a ViewDataTable of this $defaultType will be returned. * If force is set to true, a ViewDataTable of the $defaultType will be returned in all cases. * - * @param string $defaultType Any of these: table, cloud, graphPie, graphVerticalBar, graphEvolution, sparkline, generateDataChart* + * @param string $defaultType Any of these: table, cloud, graphPie, graphVerticalBar, graphEvolution, sparkline, generateDataChart* * @param string|bool $apiAction * @param string|bool $controllerAction - * @param bool $forceDefault + * @param bool $forceDefault * * @return ViewDataTable */ @@ -321,7 +321,7 @@ class ViewDataTable $defaultType = $defaultProperties['default_view_type']; } - $type = Common::getRequestVar('viewDataTable', $defaultType ?: 'table', 'string'); + $type = Common::getRequestVar('viewDataTable', $defaultType ? : 'table', 'string'); if ($type == 'sparkline') { $result = new ViewDataTable\Sparkline($controllerAction, $apiAction, $defaultProperties); @@ -357,7 +357,7 @@ class ViewDataTable /** * Returns the list of view properties that can be overriden by query parameters. - * + * * @return array */ public function getOverridableProperties() @@ -418,7 +418,7 @@ class ViewDataTable /** * Returns the list of display properties for all available reports. - * + * * @return array */ private static function getAllReportDisplayProperties() @@ -590,7 +590,7 @@ class ViewDataTable || $haveNbUniqVisitors ) { $columnsToDisplay = array('label'); - + // if unique visitors data is available, show it, otherwise just visits if ($haveNbUniqVisitors) { $columnsToDisplay[] = 'nb_uniq_visitors'; @@ -692,7 +692,7 @@ class ViewDataTable private function areQueuedFiltersDisabled() { return isset($this->viewProperties['disable_queued_filters']) - && $this->viewProperties['disable_queued_filters']; + && $this->viewProperties['disable_queued_filters']; } /** @@ -749,9 +749,9 @@ class ViewDataTable $requestArray[$varToSet] = $value; } } - + $segment = Request::getRawSegmentFromRequest(); - if(!empty($segment)) { + if (!empty($segment)) { $requestArray['segment'] = $segment; } @@ -850,7 +850,7 @@ class ViewDataTable } $rawSegment = Request::getRawSegmentFromRequest(); - if(!empty($rawSegment)) { + if (!empty($rawSegment)) { $javascriptVariablesToSet['segment'] = $rawSegment; } @@ -860,7 +860,7 @@ class ViewDataTable /** * Returns array of properties that should be visible to client side JavaScript. The data * will be available in the data-props HTML attribute of the .dataTable div. - * + * * @return array Maps property names w/ property values. */ private function getClientSidePropertiesToSet() @@ -982,7 +982,8 @@ class ViewDataTable if ($strPeriod !== false && $strDate !== false && (is_null($this->dataTable) - || (!empty($this->dataTable) && $this->dataTable->getRowsCount() == 0))) { + || (!empty($this->dataTable) && $this->dataTable->getRowsCount() == 0)) + ) { // if range, only look at the first date if ($strPeriod == 'range') { $idSite = Common::getRequestVar('idSite', ''); @@ -1045,10 +1046,10 @@ class ViewDataTable if (!method_exists($namespacedApiClassName::getInstance(), $apiAction)) { throw new \Exception("$namespacedApiClassName Invalid action name '$apiAction' for '$pluginName' plugin."); } - - $view = self::factory(null, $pluginName.'.'.$apiAction); + + $view = self::factory(null, $pluginName . '.' . $apiAction); $rendered = $view->render(); - + if ($fetch) { return $rendered; } else { @@ -1058,7 +1059,7 @@ class ViewDataTable /** * Convenience function. Calls main() & renders the view that gets built. - * + * * @return string The result of rendering. */ public function render() @@ -1066,7 +1067,7 @@ class ViewDataTable $this->buildView(); return $this->view->render(); } - + /** * Returns whether the DataTable result will have to be expanded for the * current request before rendering. @@ -1078,8 +1079,8 @@ class ViewDataTable // if filter_column_recursive & filter_pattern_recursive are supplied, and flat isn't supplied // we have to load all the child subtables. return Common::getRequestVar('filter_column_recursive', false) !== false - && Common::getRequestVar('filter_pattern_recursive', false) !== false - && Common::getRequestVar('flat', false) === false; + && Common::getRequestVar('filter_pattern_recursive', false) !== false + && Common::getRequestVar('flat', false) === false; } protected function overrideViewProperties() @@ -1107,7 +1108,7 @@ class ViewDataTable */ Piwik_PostEvent(self::CONFIGURE_VIEW_EVENT, array($viewDataTable = $this)); $this->overrideViewProperties(); - + try { $this->loadDataTableFromAPI(); $this->postDataTableLoadedFromAPI(); @@ -1168,23 +1169,23 @@ class ViewDataTable // add normal view icons (eg, normal table, all columns, goals) $normalViewIcons = array( - 'class' => 'tableAllColumnsSwitch', + 'class' => 'tableAllColumnsSwitch', 'buttons' => array(), ); if ($this->show_table) { $normalViewIcons['buttons'][] = array( - 'id' => 'table', + 'id' => 'table', 'title' => Piwik_Translate('General_DisplaySimpleTable'), - 'icon' => 'plugins/Zeitgeist/images/table.png', + 'icon' => 'plugins/Zeitgeist/images/table.png', ); } if ($this->show_table_all_columns) { $normalViewIcons['buttons'][] = array( - 'id' => 'tableAllColumns', + 'id' => 'tableAllColumns', 'title' => Piwik_Translate('General_DisplayTableWithMoreMetrics'), - 'icon' => 'plugins/Zeitgeist/images/table_more.png' + 'icon' => 'plugins/Zeitgeist/images/table_more.png' ); } @@ -1194,27 +1195,27 @@ class ViewDataTable } else { $icon = 'plugins/Zeitgeist/images/goal.png'; } - + $normalViewIcons['buttons'][] = array( - 'id' => 'tableGoals', + 'id' => 'tableGoals', 'title' => Piwik_Translate('General_DisplayTableWithGoalMetrics'), - 'icon' => $icon + 'icon' => $icon ); } if ($this->show_ecommerce) { $normalViewIcons['buttons'][] = array( - 'id' => 'ecommerceOrder', + 'id' => 'ecommerceOrder', 'title' => Piwik_Translate('General_EcommerceOrders'), - 'icon' => 'plugins/Zeitgeist/images/ecommerceOrder.gif', - 'text' => Piwik_Translate('General_EcommerceOrders') + 'icon' => 'plugins/Zeitgeist/images/ecommerceOrder.gif', + 'text' => Piwik_Translate('General_EcommerceOrders') ); $normalViewIcons['buttons'][] = array( - 'id' => 'ecommerceAbandonedCart', + 'id' => 'ecommerceAbandonedCart', 'title' => Piwik_Translate('General_AbandonedCarts'), - 'icon' => 'plugins/Zeitgeist/images/ecommerceAbandonedCart.gif', - 'text' => Piwik_Translate('General_AbandonedCarts') + 'icon' => 'plugins/Zeitgeist/images/ecommerceAbandonedCart.gif', + 'text' => Piwik_Translate('General_AbandonedCarts') ); } @@ -1224,32 +1225,32 @@ class ViewDataTable // add graph views $graphViewIcons = array( - 'class' => 'tableGraphViews tableGraphCollapsed', + 'class' => 'tableGraphViews tableGraphCollapsed', 'buttons' => array(), ); if ($this->show_all_views_icons) { if ($this->show_bar_chart) { $graphViewIcons['buttons'][] = array( - 'id' => 'graphVerticalBar', + 'id' => 'graphVerticalBar', 'title' => Piwik_Translate('General_VBarGraph'), - 'icon' => 'plugins/Zeitgeist/images/chart_bar.png' + 'icon' => 'plugins/Zeitgeist/images/chart_bar.png' ); } if ($this->show_pie_chart) { $graphViewIcons['buttons'][] = array( - 'id' => 'graphPie', + 'id' => 'graphPie', 'title' => Piwik_Translate('General_Piechart'), - 'icon' => 'plugins/Zeitgeist/images/chart_pie.png' + 'icon' => 'plugins/Zeitgeist/images/chart_pie.png' ); } if ($this->show_tag_cloud) { $graphViewIcons['buttons'][] = array( - 'id' => 'cloud', + 'id' => 'cloud', 'title' => Piwik_Translate('General_TagCloud'), - 'icon' => 'plugins/Zeitgeist/images/tagcloud.png' + 'icon' => 'plugins/Zeitgeist/images/tagcloud.png' ); } @@ -1259,9 +1260,9 @@ class ViewDataTable foreach ($nonCoreVisualizationInfo as $format => $info) { $graphViewIcons['buttons'][] = array( - 'id' => $format, + 'id' => $format, 'title' => Piwik_Translate($info['title']), - 'icon' => $info['table_icon'] + 'icon' => $info['table_icon'] ); } } @@ -1299,7 +1300,7 @@ class ViewDataTable * ``` */ Piwik_PostEvent(self::CONFIGURE_FOOTER_ICONS_EVENT, array(&$result, $viewDataTable = $this)); - + return $result; } diff --git a/core/ViewDataTable/Graph.php b/core/ViewDataTable/Graph.php index fceb66a197..518fff6edf 100644 --- a/core/ViewDataTable/Graph.php +++ b/core/ViewDataTable/Graph.php @@ -25,30 +25,30 @@ abstract class Graph extends Visualization /** * Whether the series picker should allow picking more than one series or not. - * + * * Default value: true */ const ALLOW_MULTI_SELECT_SERIES_PICKER = 'allow_multi_select_series_picker'; /** * The maximum number of rows to render. All other rows will be aggregated in an 'Others' row. - * + * * Default value: false (no limit) */ const MAX_GRAPH_ELEMENTS = 'max_graph_elements'; /** * Array property that contains the names of columns that can be selected in the Series Picker. - * + * * Default value: false */ const SELECTABLE_COLUMNS = 'selectable_columns'; /** * Contains the column (if any) of the values used in the Row Picker. - * + * * @see self::ROWS_TO_DISPLAY - * + * * Default value: false */ const ROW_PICKER_VALUE_COLUMN = 'row_picker_match_rows_by'; @@ -56,9 +56,9 @@ abstract class Graph extends Visualization /** * Contains the list of values identifying rows that should be displayed as separate series. * The values are of a specific column determined by the row_picker_match_rows_by column. - * + * * @see self::ROW_PICKER_VALUE_COLUMN - * + * * Default value: false */ const ROWS_TO_DISPLAY = 'rows_to_display'; @@ -66,21 +66,21 @@ abstract class Graph extends Visualization /** * Contains the list of values available for the Row Picker. Currently set to be all visible * rows, if the row_picker_match_rows_by property is set. - * + * * @see self::ROW_PICKER_VALUE_COLUMN */ const SELECTABLE_ROWS = 'selectable_rows'; /** * Controls whether all ticks & labels are shown on a graph's x-axis or just some. - * + * * Default value: false */ const SHOW_ALL_TICKS = 'show_all_ticks'; /** * If true, a row with totals of each DataTable column is added. - * + * * Default value: false */ const ADD_TOTAL_ROW = 'add_total_row'; @@ -88,7 +88,7 @@ abstract class Graph extends Visualization /** * Controls whether the Series Picker is shown or not. The Series Picker allows users to * choose between displaying data of different columns. - * + * * Default value: true */ const SHOW_SERIES_PICKER = 'show_series_picker'; @@ -96,11 +96,11 @@ abstract class Graph extends Visualization /** * Controls whether the percentage of the total is displayed as a tooltip when hovering over * data points. - * + * * NOTE: Sometimes this percentage is meaningless (when the total of the column values is * not the total number of elements in the set). In this case the tooltip should not be * displayed. - * + * * Default value: true */ const DISPLAY_PERCENTAGE_IN_TOOLTIP = 'display_percentage_in_tooltip'; @@ -124,14 +124,14 @@ abstract class Graph extends Visualization /** * Constructor. - * + * * @param \Piwik\ViewDataTable $view * @param string $template */ public function __construct($view, $template) { parent::__construct($template); - + if ($view->show_goals) { $view->translations['nb_conversions'] = Piwik_Translate('Goals_ColumnConversions'); $view->translations['revenue'] = Piwik_Translate('General_TotalRevenue'); @@ -152,19 +152,19 @@ abstract class Graph extends Visualization public static function getDefaultPropertyValues() { return array( - 'show_limit_control' => false, + 'show_limit_control' => false, 'visualization_properties' => array( 'graph' => array( - 'add_total_row' => false, - 'show_all_ticks' => false, + 'add_total_row' => false, + 'show_all_ticks' => false, 'allow_multi_select_series_picker' => true, - 'max_graph_elements' => false, - 'selectable_columns' => false, - 'show_series_picker' => true, - 'display_percentage_in_tooltip' => true, - 'row_picker_match_rows_by' => false, - 'rows_to_display' => false, - 'selectable_rows' => false + 'max_graph_elements' => false, + 'selectable_columns' => false, + 'show_series_picker' => true, + 'display_percentage_in_tooltip' => true, + 'row_picker_match_rows_by' => false, + 'rows_to_display' => false, + 'selectable_rows' => false ) ) ); diff --git a/core/ViewDataTable/Properties.php b/core/ViewDataTable/Properties.php index 4f5886a327..a72497b114 100644 --- a/core/ViewDataTable/Properties.php +++ b/core/ViewDataTable/Properties.php @@ -13,8 +13,8 @@ namespace Piwik\ViewDataTable; use Exception; use Piwik\Config; -use Piwik\Metrics; +use Piwik\Metrics; use ReflectionClass; /** @@ -29,7 +29,7 @@ class Properties * This property is only valid for reports whose properties are determined by the * Visualization.getReportDisplayProperties event. When manually creating ViewDataTables, * setting this property will have no effect. - * + * * Default value: 'table' */ const DEFAULT_VIEW_TYPE = 'default_view_type'; @@ -39,7 +39,7 @@ class Properties * The value of this property must be an array of footer icon groups. Footer icon groups * have set of properties, including an array of arrays describing footer icons. See * this example to get a clear idea of what is required: - * + * * array( * array( // footer icon group 1 * 'class' => 'footerIconGroup1CssClass', @@ -54,12 +54,12 @@ class Properties * 'buttons' => array(...) * ) * ) - * + * * By default, when a user clicks on a footer icon, Piwik will assume the 'id' is * a viewDataTable ID and try to reload the DataTable w/ the new viewDataTable. You * can provide your own footer icon behavior by adding an appropriate handler via * DataTable.registerFooterIconHandler in your JavaScript. - * + * * Default value: The default value will show the 'Normal Table' icon, the 'All Columns' * icon, the 'Goals Columns' icon and all jqPlot graph columns, unless other properties * tell the view to exclude them. @@ -69,31 +69,31 @@ class Properties /** * Controls whether the buttons and UI controls around the visualization or shown or * if just the visualization alone is shown. - * + * * Default value: false */ const SHOW_VISUALIZATION_ONLY = 'show_visualization_only'; /** * Controls whether the goals footer icon is shown. - * + * * Default value: false */ const SHOW_GOALS = 'show_goals'; /** * Array property mapping DataTable column names with their internationalized names. - * + * * The value you specify for this property is merged with the default value so you * don't have to specify translations that already exist in the default value. - * + * * Default value: Array containing translations of common metrics. */ const COLUMN_NAME_TRANSLATIONS = 'translations'; /** * Controls which column to sort the DataTable by before truncating and displaying. - * + * * Default value: If the report contains nb_uniq_visitors and nb_uniq_visitors is a * displayed column, then the default value is 'nb_uniq_visitors'. * Otherwise, it is 'nb_visits'. @@ -102,27 +102,27 @@ class Properties /** * Controls the sort order. Either 'asc' or 'desc'. - * + * * Default value: 'desc' - * + * * @see self::SORTED_COLUMN */ const SORT_ORDER = 'filter_sort_order'; /** * The number of items to truncate the data set to before rendering the DataTable view. - * + * * Default value: false - * + * * @see self::OFFSET */ const LIMIT = 'filter_limit'; /** * The number of items from the start of the data set that should be ignored. - * + * * Default value: 0 - * + * * @see self::LIMIT */ const OFFSET = 'filter_offset'; @@ -130,7 +130,7 @@ class Properties /** * Controls whether the 'Exclude Low Population' option (visible in the popup that displays after * clicking the 'cog' icon) is shown. - * + * * Default value: true */ const SHOW_EXCLUDE_LOW_POPULATION = 'show_exclude_low_population'; @@ -138,7 +138,7 @@ class Properties /** * Whether to show the 'Flatten' option (visible in the popup that displays after clicking the * 'cog' icon). - * + * * Default value: true */ const SHOW_FLATTEN_TABLE = 'show_flatten_table'; @@ -146,28 +146,28 @@ class Properties /** * Controls whether the footer icon that allows user to switch to the 'normal' DataTable view * is shown. - * + * * Default value: true */ const SHOW_NORMAL_TABLE_VIEW = 'show_table'; /** * Controls whether the 'All Columns' footer icon is shown. - * + * * Default value: true */ const SHOW_ALL_TABLE_VIEW = 'show_table_all_columns'; /** * Controls whether the entire view footer is shown. - * + * * Default value: true */ const SHOW_FOOTER = 'show_footer'; /** * Controls whether the row that contains all footer icons & the limit selector is shown. - * + * * Default value: true */ const SHOW_FOOTER_ICONS = 'show_footer_icons'; @@ -177,7 +177,7 @@ class Properties * should not appear in ViewDataTable visualizations. * * Example: array('label', 'nb_visits', 'nb_uniq_visitors') - * + * * Default value: array('label', 'nb_visits') or array('label', 'nb_uniq_visitors') if * the report contains a nb_uniq_visitors column. */ @@ -186,14 +186,14 @@ class Properties /** * Controls whether the footer icons that change the ViewDataTable type of a view are shown * or not. - * + * * Default value: true */ const SHOW_ALL_VIEW_ICONS = 'show_all_views_icons'; /** * Controls whether to display a tiny upside-down caret over the currently active view icon. - * + * * Default value: true */ const SHOW_ACTIVE_VIEW_ICON = 'show_active_view_icon'; @@ -202,9 +202,9 @@ class Properties * Related reports are listed below a datatable view. When clicked, the original report will * change to the clicked report and the list will change so the original report can be * navigated back to. - * + * * @see also self::TITLE. Both must be set if associating related reports. - * + * * Default value: array() */ const RELATED_REPORTS = 'related_reports'; @@ -212,23 +212,23 @@ class Properties /** * The report title. Used with related reports so report headings can be changed when switching * reports. - * + * * @see also self::RELATED_REPORTS. This must be set if related reports are added. - * + * * Default value: '' */ const TITLE = 'title'; /** * Controls whether a report's related reports are listed with the view or not. - * + * * Default value: true */ const SHOW_RELATED_REPORTS = 'show_related_reports'; /** * Contains the documentation for a report. - * + * * Default value: false */ const REPORT_DOCUMENTATION = 'documentation'; @@ -236,27 +236,27 @@ class Properties /** * An array property that contains query parameter name/value overrides for API requests made * by ViewDataTable. - * + * * E.g. array('idSite' => ..., 'period' => 'month') - * + * * Default value: array() */ const REQUEST_PARAMETERS_TO_MODIFY = 'request_parameters_to_modify'; /** * A regex pattern to use to filter the DataTable before it is shown. - * + * * @see also self::FILTER_PATTERN_COLUMN - * + * * Default value: false */ const FILTER_PATTERN = 'filter_pattern'; /** * The column to apply a filter pattern to. - * + * * @see also self::FILTER_PATTERN - * + * * Default value: false */ const FILTER_PATTERN_COLUMN = 'filter_column'; @@ -264,27 +264,27 @@ class Properties /** * Array property containing custom data to be saved in JSON in the data-params HTML attribute * of a data table div. This data can be used by JavaScript DataTable classes. - * + * * e.g. array('typeReferrer' => ...) - * + * * Default value: array() */ const CUSTOM_PARAMETERS = 'custom_parameters'; /** * Whether to run generic filters on the DataTable before rendering or not. - * + * * @see Piwik_API_DataTableGenericFilter - * + * * Default value: false */ const DISABLE_GENERIC_FILTERS = 'disable_generic_filters'; /** * Whether to run ViewDataTable's list of queued filters or not. - * + * * NOTE: Priority queued filters are always run. - * + * * Default value: false */ const DISABLE_QUEUED_FILTERS = 'disable_queued_filters'; @@ -292,99 +292,99 @@ class Properties /** * Controls whether the limit dropdown (which allows users to change the number of data shown) * is always shown or not. - * + * * Normally shown only if pagination is enabled. - * + * * Default value: true */ const ALWAYS_SHOW_LIMIT_DROPDOWN = 'show_limit_control'; /** * Controls whether the search box under the datatable is shown. - * + * * Default value: true */ const SHOW_SEARCH_BOX = 'show_search'; /** * Controls whether the user can sort DataTables by clicking on table column headings. - * + * * Default value: true */ const ENABLE_SORT = 'enable_sort'; /** * Controls whether the footer icon that allows users to view data as a bar chart is shown. - * + * * Default value: true */ const SHOW_BAR_CHART_ICON = 'show_bar_chart'; /** * Controls whether the footer icon that allows users to view data as a pie chart is shown. - * + * * Default value: true */ const SHOW_PIE_CHART_ICON = 'show_pie_chart'; /** * Controls whether the footer icon that allows users to view data as a tag cloud is shown. - * + * * Default value: true */ const SHOW_TAG_CLOUD = 'show_tag_cloud'; /** * Controls whether the user is allowed to export data as an RSS feed or not. - * + * * Default value: true */ const SHOW_EXPORT_AS_RSS_FEED = 'show_export_as_rss_feed'; /** * Controls whether the 'Ecoommerce Orders'/'Abandoned Cart' footer icons are shown or not. - * + * * Default value: false */ const SHOW_ECOMMERCE_FOOTER_ICONS = 'show_ecommerce'; /** * Stores the column name to filter when filtering out rows with low values. - * + * * @see also self::EXCLUDE_LOW_POPULATION_VALUE - * + * * Default value: false */ const EXCLUDE_LOW_POPULATION_COLUMN = 'filter_excludelowpop'; /** * Stores the value considered 'low' when filtering out rows w/ low values. - * + * * @see also self::EXCLUDE_LOW_POPULATION_COLUMN - * + * * Default value: false */ const EXCLUDE_LOW_POPULATION_VALUE = 'filter_excludelowpop_value'; /** * Stores an HTML message (if any) to display under the datatable view. - * + * * Default value: false */ const FOOTER_MESSAGE = 'show_footer_message'; /** * Array property that stores documentation for individual metrics. - * + * * E.g. array('nb_visits' => '...', ...) - * + * * Default: Set to values retrieved from report metadata (via API.getReportMetadata API method). */ const METRIC_DOCUMENTATION = 'metrics_documentation'; /** * Row metadata name that contains the tooltip for the specific row. - * + * * Default value: false */ const TOOLTIP_METADATA_NAME = 'tooltip_metadata_name'; @@ -393,16 +393,16 @@ class Properties * The URL to the report the view is displaying. Modifying this means clicking back to this report * from a Related Report will go to a different URL. Can be used to load an entire page instead * of a single report when going back to the original report. - * + * * @see also self::RELATED_REPORTS - * + * * Default value: The URL used to request the report without generic filters. */ const THIS_REPORT_URL = 'self_url'; /** * Special property that holds the properties for DataTable Visualizations. - * + * * @see Piwik\ViewDataTable\VisualizationProperties */ const VISUALIZATION_PROPERTIES = 'visualization_properties'; @@ -410,7 +410,7 @@ class Properties /** * CSS class to use in the output HTML div. This is added in addition to the visualization CSS * class. - * + * * Default value: false */ const DATATABLE_CSS_CLASS = 'datatable_css_class'; @@ -418,30 +418,30 @@ class Properties /** * The JavaScript class to instantiate after the result HTML is obtained. This class handles all * interactive behavior for the DataTable view. - * + * * Default value: 'DataTable' */ const DATATABLE_JS_TYPE = 'datatable_js_type'; /** * If true, searching through the DataTable will search through all subtables. - * + * * @see also self::FILTER_PATTERN - * + * * Default value: false */ const DO_RECURSIVE_SEARCH = 'search_recursive'; /** * The unit of the displayed column. Valid if only one non-label column is displayed. - * + * * Default value: false */ const DISPLAYED_COLUMN_UNIT = 'y_axis_unit'; /** * Controls whether to show the 'Export as Image' footer icon. - * + * * Default value: false */ const SHOW_EXPORT_AS_IMAGE_ICON = 'show_export_as_image_icon'; @@ -452,12 +452,12 @@ class Properties * - the filter name (or a closure) * - an array of filter parameters * - a boolean indicating if the filter is a priority filter or not - * + * * Priority filters are run before queued filters. These filters should be filters that * add/delete rows. - * + * * If a closure is used, the view is appended as a parameter. - * + * * Default value: array() */ const FILTERS = 'filters'; @@ -466,19 +466,19 @@ class Properties * Array of callbacks that are called after the data for a ViewDataTable is successfully * loaded. Each callback is invoked with the DataTable instance obtained from the API * and the ViewDatable instance that loaded it. - * + * * Functions can be appended to this array property when it's necessary to configure * a ViewDataTable after data has been loaded. If you need to use properties that are * only set after data is loaded (like 'columns_to_display'), you'll have to use this * property. - * + * * Default value: array() */ const AFTER_DATA_LOADED_FUNCTIONS = 'after_data_loaded_functions'; /** * Contains the controller action to call when requesting subtables of the current report. - * + * * Default value: The controller action used to request the report. */ const SUBTABLE_CONTROLLER_ACTION = 'subtable_controller_action'; @@ -486,48 +486,48 @@ class Properties /** * Controls whether the 'prev'/'next' links are shown in the DataTable footer. These links * change the 'filter_offset' query parameter, thus allowing pagination. - * + * * TODO: pagination/offset is only valid for HtmlTables... should only display for those visualizations. - * + * * @see self::SHOW_OFFSET_INFORMATION - * + * * Default value: true */ const SHOW_PAGINATION_CONTROL = 'show_pagination_control'; /** - * Controls whether offset information (ie, '5-10 of 20') is shown under the datatable. - * + * Controls whether offset information (ie, '5-10 of 20') is shown under the datatable. + * * @see self::SHOW_PAGINATION_CONTROL - * + * * Default value: true */ const SHOW_OFFSET_INFORMATION = 'show_offset_information'; /** * Controls whether annotations are shown or not. - * + * * Default value: true */ const HIDE_ANNOTATIONS_VIEW = 'hide_annotations_view'; /** * The filter_limit query parameter value to use in export links. - * + * * Default value: The value of the 'API_datatable_default_limit' config option. */ const EXPORT_LIMIT = 'export_limit'; /** * Controls whether non-Core DataTable visualizations are shown or not. - * + * * Default value: true */ const SHOW_NON_CORE_VISUALIZATIONS = 'show_non_core_visualizations'; /** * The list of ViewDataTable properties that are 'Client Side Parameters'. - * + * * @see Piwik\ViewDataTable\Visualization::getClientSideParameters */ public static $clientSideParameters = array( @@ -539,7 +539,7 @@ class Properties /** * The list of ViewDataTable properties that are 'Client Side Properties'. - * + * * @see Piwik\ViewDataTable\Visualization::getClientSideProperties */ public static $clientSideProperties = array( @@ -548,7 +548,7 @@ class Properties /** * The list of ViewDataTable properties that can be overriden by query parameters. - * + * * @see Piwik\ViewDataTable\Visualization::getOverridableProperties */ public static $overridableProperties = array( @@ -610,7 +610,7 @@ class Properties * Returns the set of all valid properties for the given visualization class. The result is an * array with property names as keys. Values of the array are undefined. * - * @param string $visualizationClass + * @param string $visualizationClass * * @return array */ @@ -638,7 +638,7 @@ class Properties /** * Returns true if $name is a core ViewDataTable property, false if not. - * + * * @param string $name * @return bool */ @@ -673,7 +673,7 @@ class Properties /** * Checks if a property is a valid visualization property for the given visualization class, * and if not, throws an exception. - * + * * @param string $visualizationClass * @param string $name The property name. * @throws Exception @@ -687,66 +687,66 @@ class Properties /** * Returns the default values for each core view property. - * + * * @return array */ public static function getDefaultPropertyValues() { return array( - 'footer_icons' => false, - 'show_visualization_only' => false, - 'datatable_js_type' => 'DataTable', - 'show_goals' => false, - 'show_ecommerce' => false, - 'show_search' => true, - 'show_table' => true, - 'show_table_all_columns' => true, - 'show_all_views_icons' => true, - 'show_active_view_icon' => true, - 'show_bar_chart' => true, - 'show_pie_chart' => true, - 'show_tag_cloud' => true, - 'show_export_as_image_icon' => false, - 'show_export_as_rss_feed' => true, - 'show_exclude_low_population' => true, - 'show_flatten_table' => true, - 'show_offset_information' => true, - 'show_pagination_control' => true, - 'show_limit_control' => true, - 'show_footer' => true, - 'show_footer_icons' => true, - 'show_footer_message' => false, - 'show_related_reports' => true, + 'footer_icons' => false, + 'show_visualization_only' => false, + 'datatable_js_type' => 'DataTable', + 'show_goals' => false, + 'show_ecommerce' => false, + 'show_search' => true, + 'show_table' => true, + 'show_table_all_columns' => true, + 'show_all_views_icons' => true, + 'show_active_view_icon' => true, + 'show_bar_chart' => true, + 'show_pie_chart' => true, + 'show_tag_cloud' => true, + 'show_export_as_image_icon' => false, + 'show_export_as_rss_feed' => true, + 'show_exclude_low_population' => true, + 'show_flatten_table' => true, + 'show_offset_information' => true, + 'show_pagination_control' => true, + 'show_limit_control' => true, + 'show_footer' => true, + 'show_footer_icons' => true, + 'show_footer_message' => false, + 'show_related_reports' => true, 'show_non_core_visualizations' => true, - 'export_limit' => Config::getInstance()->General['API_datatable_default_limit'], - 'related_reports' => array(), - 'title' => '', - 'tooltip_metadata_name' => false, - 'enable_sort' => true, - 'disable_generic_filters' => false, - 'disable_queued_filters' => false, - 'search_recursive' => false, - 'filter_excludelowpop' => false, - 'filter_excludelowpop_value' => false, - 'filter_pattern' => false, - 'filter_column' => false, - 'filter_limit' => false, - 'filter_offset' => 0, - 'filter_sort_column' => false, - 'filter_sort_order' => 'desc', - 'custom_parameters' => array(), - 'translations' => array_merge( + 'export_limit' => Config::getInstance()->General['API_datatable_default_limit'], + 'related_reports' => array(), + 'title' => '', + 'tooltip_metadata_name' => false, + 'enable_sort' => true, + 'disable_generic_filters' => false, + 'disable_queued_filters' => false, + 'search_recursive' => false, + 'filter_excludelowpop' => false, + 'filter_excludelowpop_value' => false, + 'filter_pattern' => false, + 'filter_column' => false, + 'filter_limit' => false, + 'filter_offset' => 0, + 'filter_sort_column' => false, + 'filter_sort_order' => 'desc', + 'custom_parameters' => array(), + 'translations' => array_merge( Metrics::getDefaultMetrics(), Metrics::getDefaultProcessedMetrics() ), 'request_parameters_to_modify' => array(), - 'documentation' => false, - 'datatable_css_class' => false, - 'filters' => array(), - 'after_data_loaded_functions' => array(), - 'hide_annotations_view' => true, - 'columns_to_display' => array(), - 'y_axis_unit' => false + 'documentation' => false, + 'datatable_css_class' => false, + 'filters' => array(), + 'after_data_loaded_functions' => array(), + 'hide_annotations_view' => true, + 'columns_to_display' => array(), + 'y_axis_unit' => false ); } @@ -754,7 +754,7 @@ class Properties { $klass = new ReflectionClass($klass); $constants = $klass->getConstants(); - + unset($constants['ID']); unset($constants['FOOTER_ICON']); unset($constants['FOOTER_ICON_TITLE']); diff --git a/core/ViewDataTable/Visualization.php b/core/ViewDataTable/Visualization.php index c2b7cbe096..a25bf52c9c 100644 --- a/core/ViewDataTable/Visualization.php +++ b/core/ViewDataTable/Visualization.php @@ -18,7 +18,7 @@ use Piwik\View; * Base class for all DataTable visualizations. Different visualizations are used to * handle different values of the viewDataTable query parameter. Each one will display * DataTable data in a different way. - * + * * TODO: must be more in depth */ abstract class Visualization extends View @@ -28,7 +28,7 @@ abstract class Visualization extends View /** * Default implementation of getDefaultPropertyValues static function. - * + * * @return array */ public static function getDefaultPropertyValues() @@ -40,11 +40,11 @@ abstract class Visualization extends View * Returns the array of view properties that a DataTable visualization will require * to be both visible to client side JavaScript, and passed along as query parameters * in every AJAX request. - * + * * Derived Visualizations can specify client side parameters by declaring * a static $clientSideParameters field that contains a list of view property * names. - * + * * @return array */ public static function getClientSideParameters() @@ -56,11 +56,11 @@ abstract class Visualization extends View * Returns an array of view property names that a DataTable visualization will * require to be visible to client side JavaScript. Unlike 'client side parameters', * these will not be passed with AJAX requests as query parameters. - * + * * Derived Visualizations can specify client side properties by declaring * a static $clientSideProperties field that contains a list of view property * names. - * + * * @return array */ public static function getClientSideProperties() @@ -72,7 +72,7 @@ abstract class Visualization extends View * Returns an array of view property names that can be overriden by query parameters. * If a query parameter is sent with the same name as a view property, the view * property will be set to the value of the query parameter. - * + * * Derived Visualizations can specify overridable properties by declaring * a static $overridableProperties field that contains a list of view property * names. @@ -85,7 +85,7 @@ abstract class Visualization extends View /** * Returns the viewDataTable ID for this DataTable visualization. Derived classes * should declare a const ID field with the viewDataTable ID. - * + * * @return string */ public static function getViewDataTableId() @@ -100,7 +100,7 @@ abstract class Visualization extends View /** * Returns the list of parents for a Visualization class excluding the * Visualization class and above. - * + * * @param string $klass The class name of the Visualization. * @return Visualization[] The list of parent classes in order from highest * ancestor to the descended class. @@ -119,9 +119,9 @@ abstract class Visualization extends View /** * Returns the viewDataTable IDs of a visualization's class lineage. - * + * * @see self::getVisualizationClassLineage - * + * * @param string $klass The visualization class. * * @return array @@ -140,7 +140,7 @@ abstract class Visualization extends View /** * Returns all registered visualization classes. Uses the 'Visualization.getAvailable' * event to retrieve visualizations. - * + * * @return array Array mapping visualization IDs with their associated visualization classes. * @throws \Exception If a visualization class does not exist or if a duplicate visualization ID * is found. @@ -155,7 +155,7 @@ abstract class Visualization extends View * should add visualization class names to the incoming array. */ Piwik_PostEvent(self::GET_AVAILABLE_EVENT, array(&$visualizations)); - + $result = array(); foreach ($visualizations as $viz) { if (!class_exists($viz)) { @@ -177,7 +177,7 @@ abstract class Visualization extends View /** * Returns all available visualizations that are not part of the CoreVisualizations plugin. - * + * * @return array Array mapping visualization IDs with their associated visualization classes. */ public static function getNonCoreVisualizations() @@ -194,7 +194,7 @@ abstract class Visualization extends View /** * Returns an array mapping visualization IDs with information necessary for adding the * visualizations to the footer of DataTable views. - * + * * @param array $visualizations An array mapping visualization IDs w/ their associated classes. * @return array */ @@ -209,7 +209,7 @@ abstract class Visualization extends View /** * Returns the visualization class by it's viewDataTable ID. - * + * * @param string $id The visualization ID. * @return string The visualization class name. If $id is not a valid ID, the HtmlTable visualization * is returned. diff --git a/core/ViewDataTable/VisualizationPropertiesProxy.php b/core/ViewDataTable/VisualizationPropertiesProxy.php index 25c8abe865..55da01b80b 100644 --- a/core/ViewDataTable/VisualizationPropertiesProxy.php +++ b/core/ViewDataTable/VisualizationPropertiesProxy.php @@ -12,7 +12,6 @@ namespace Piwik\ViewDataTable; - /** * Proxy object used to get/set visualization properties. Used to check that property * names are valid. @@ -21,21 +20,21 @@ class VisualizationPropertiesProxy { /** * The visualization class name. - * + * * @var string */ private $visualizationClass; /** * Stores visualization properties. - * + * * @var array */ private $visualizationProperties = array(); /** * Constructor. - * + * * @param string $visualizationClass The visualization class to get/set properties of. */ public function __construct($visualizationClass) @@ -53,7 +52,7 @@ class VisualizationPropertiesProxy /** * Gets a reference to a visualization property. - * + * * @param string $name A valid property name for the current visualization. * @return mixed * @throws \Exception if the property name is invalid. @@ -63,13 +62,13 @@ class VisualizationPropertiesProxy if ($this->visualizationClass !== null) { Properties::checkValidVisualizationProperty($this->visualizationClass, $name); } - + return $this->visualizationProperties[$name]; } /** * Sets a visualization property. - * + * * @param string $name A valid property name for the current visualization. * @param mixed $value * @return mixed Returns $value. @@ -80,14 +79,14 @@ class VisualizationPropertiesProxy if ($this->visualizationClass !== null) { Properties::checkValidVisualizationProperty($this->visualizationClass, $name); } - + return $this->visualizationProperties[$name] = $value; } /** * Sets a visualization property, but only if the visualization is an instance of a * certain class. - * + * * @param string $forClass The visualization class to check for. * @param string $name A valid property name for the current visualization. * @param mixed $value diff --git a/core/Visualization/Sparkline.php b/core/Visualization/Sparkline.php index c029d91ab7..fbeeea0a89 100644 --- a/core/Visualization/Sparkline.php +++ b/core/Visualization/Sparkline.php @@ -165,10 +165,10 @@ class Sparkline implements ViewInterface if (empty($colors)) { // quick fix so row evolution sparklines will have color in widgetize's iframes $colors = array( 'backgroundColor' => '#ffffff', - 'lineColor' => '#162C4A', - 'minPointColor' => '#ff7f7f', - 'lastPointColor' => '#55AAFF', - 'maxPointColor' => '#75BF7C' + 'lineColor' => '#162C4A', + 'minPointColor' => '#ff7f7f', + 'lastPointColor' => '#55AAFF', + 'maxPointColor' => '#75BF7C' ); } diff --git a/core/WidgetsList.php b/core/WidgetsList.php index 40c531721c..6e219acabf 100644 --- a/core/WidgetsList.php +++ b/core/WidgetsList.php @@ -133,7 +133,7 @@ class WidgetsList 'uniqueId' => $widgetUniqueId, 'parameters' => array('module' => $controllerName, 'action' => $controllerAction - ) + $customParameters + ) + $customParameters ); } diff --git a/core/functions.php b/core/functions.php index ca8a34d7c0..68fe8829a4 100644 --- a/core/functions.php +++ b/core/functions.php @@ -21,7 +21,7 @@ namespace { /** * Post an event to the dispatcher which will notice the observers. * - * @param string $eventName The event name. + * @param string $eventName The event name. * @param array $params The parameter array to forward to observer callbacks. * @param bool $pending * @param null $plugins @@ -36,8 +36,8 @@ namespace { /** * Register an action to execute for a given event * - * @param string $eventName Name of event - * @param callable $function Callback hook + * @param string $eventName Name of event + * @param callable $function Callback hook * @api */ function Piwik_AddAction($eventName, $function) @@ -70,7 +70,7 @@ namespace { $args = array($args); } - if(strpos($string, "_") !== FALSE) { + if (strpos($string, "_") !== false) { list($plugin, $key) = explode("_", $string, 2); if (isset($GLOBALS['Piwik_translations'][$plugin]) && isset($GLOBALS['Piwik_translations'][$plugin][$key])) { $string = $GLOBALS['Piwik_translations'][$plugin][$key]; @@ -104,7 +104,7 @@ namespace { /** * Returns the option value for the requested option $name * - * @param string $name Key + * @param string $name Key * @return string|bool Value or false, if not found * @api */ @@ -118,7 +118,7 @@ namespace { * * @param string $name * @param string $value - * @param int $autoLoad if set to 1, this option value will be automatically loaded; should be set to 1 for options that will always be used in the Piwik request. + * @param int $autoLoad if set to 1, this option value will be automatically loaded; should be set to 1 for options that will always be used in the Piwik request. * @api */ function Piwik_SetOption($name, $value, $autoLoad = 0) @@ -241,11 +241,11 @@ namespace { /** * Adds a new entry to the TopMenu. * - * @param string $topMenuName - * @param string $data - * @param boolean $displayedForCurrentUser - * @param int $order - * @param bool $isHTML + * @param string $topMenuName + * @param string $data + * @param boolean $displayedForCurrentUser + * @param int $order + * @param bool $isHTML * @param bool|string $tooltip Tooltip to display. * @api */ @@ -272,11 +272,13 @@ namespace { // Bridge between pre Piwik2 serialized format and namespaced classes // Do not need to define these classes in tracker or archive - if(class_exists('\\Piwik\\DataTable\\Row\\DataTableSummaryRow')) { - class Piwik_DataTable_Row_DataTableSummary extends \Piwik\DataTable\Row\DataTableSummaryRow { + if (class_exists('\\Piwik\\DataTable\\Row\\DataTableSummaryRow')) { + class Piwik_DataTable_Row_DataTableSummary extends \Piwik\DataTable\Row\DataTableSummaryRow + { } - class Piwik_DataTable_Row extends \Piwik\DataTable\Row { + class Piwik_DataTable_Row extends \Piwik\DataTable\Row + { } } diff --git a/core/testMinimumPhpVersion.php b/core/testMinimumPhpVersion.php index 727d24052b..340e73258c 100644 --- a/core/testMinimumPhpVersion.php +++ b/core/testMinimumPhpVersion.php @@ -48,16 +48,16 @@ if ($minimumPhpInvalid) { $autoloadPath = '/vendor/autoload.php'; $autoloader = PIWIK_INCLUDE_PATH . $autoloadPath; - if(!file_exists($autoloader)) { + if (!file_exists($autoloader)) { $composerInstall = "In the piwik directory, run in the command line the following (eg. via ssh): " - . "<pre> curl -sS https://getcomposer.org/installer | php \n php composer.phar install</pre> "; - if(DIRECTORY_SEPARATOR === '\\' /* ::isWindows() */) { + . "<pre> curl -sS https://getcomposer.org/installer | php \n php composer.phar install</pre> "; + if (DIRECTORY_SEPARATOR === '\\' /* ::isWindows() */) { $composerInstall = "Download and run <a href=\"https://getcomposer.org/Composer-Setup.exe\"><b>Composer-Setup.exe</b></a>, it will install the latest Composer version and set up your PATH so that you can just call composer from any directory in your command line. " - ." <br>Then run this command in a terminal in the piwik directory: <br> $ php composer update "; + . " <br>Then run this command in a terminal in the piwik directory: <br> $ php composer update "; } $piwik_errorMessage .= "<p>It appears the <a href='https://getcomposer.org/' target='_blank'>composer</a> tool is not yet installed. You can install Composer in a few easy steps: <br/>" . $composerInstall - . " This will initialize composer for Piwik and download libraries we use in vendor/* directory. + . " This will initialize composer for Piwik and download libraries we use in vendor/* directory. <br/><br/>Then reload this page to access your analytics reports. <br/><br/>Note: if for some reasons you cannot installer composer, instead install the latest Piwik release from <a href='http://builds.piwik.org/latest.zip'>builds.piwik.org</a>.</p>"; @@ -67,15 +67,15 @@ if ($minimumPhpInvalid) { if (!function_exists('Piwik_ExitWithMessage')) { /** * Returns true if Piwik should print the backtrace with error messages. - * + * * To make sure the backtrace is printed, define PIWIK_PRINT_ERROR_BACKTRACE. - * - * @return bool + * + * @return bool */ function Piwik_ShouldPrintBackTraceWithMessage() { $bool = (defined('PIWIK_PRINT_ERROR_BACKTRACE') && PIWIK_PRINT_ERROR_BACKTRACE) - || (defined('PIWIK_TRACKER_DEBUG') && PIWIK_TRACKER_DEBUG); + || (defined('PIWIK_TRACKER_DEBUG') && PIWIK_TRACKER_DEBUG); return $bool; } @@ -102,7 +102,7 @@ if (!function_exists('Piwik_ExitWithMessage')) { <li><a target="_blank" href="http://demo.piwik.org">Piwik Online Demo</a></li> </ul>'; } - if($optionalLinkBack) { + if ($optionalLinkBack) { $optionalLinkBack = '<a href="javascript:window.back();">Go Back</a><br/>'; } $headerPage = file_get_contents(PIWIK_INCLUDE_PATH . '/plugins/Zeitgeist/templates/simpleLayoutHeader.tpl'); @@ -111,12 +111,12 @@ if (!function_exists('Piwik_ExitWithMessage')) { $headerPage = str_replace('{$HTML_TITLE}', 'Piwik › Error', $headerPage); $content = '<p>' . $message . '</p> <p>' - . $optionalLinkBack - . '<a href="index.php">Go to Piwik</a><br/> + . $optionalLinkBack + . '<a href="index.php">Go to Piwik</a><br/> <a href="index.php?module=Login">Login</a>' - . '</p>' - . ' ' . (Piwik_ShouldPrintBackTraceWithMessage() ? $optionalTrace : '') - . ' ' . $optionalLinks; + . '</p>' + . ' ' . (Piwik_ShouldPrintBackTraceWithMessage() ? $optionalTrace : '') + . ' ' . $optionalLinks; echo $headerPage . $content . $footerPage; exit; diff --git a/misc/others/phpstorm-codestyles/Piwik_codestyle.xml b/misc/others/phpstorm-codestyles/Piwik_codestyle.xml index eea2435491..8e8743f448 100644 --- a/misc/others/phpstorm-codestyles/Piwik_codestyle.xml +++ b/misc/others/phpstorm-codestyles/Piwik_codestyle.xml @@ -21,129 +21,129 @@ <rules> <rule> <match> - <TYPE>CONST</TYPE> + <CONST /> </match> </rule> <rule> <match> <AND> - <TYPE>FIELD</TYPE> - <MODIFIER>PUBLIC</MODIFIER> - <MODIFIER>STATIC</MODIFIER> + <FIELD /> + <PUBLIC /> + <STATIC /> </AND> </match> </rule> <rule> <match> <AND> - <TYPE>FIELD</TYPE> - <MODIFIER>PROTECTED</MODIFIER> - <MODIFIER>STATIC</MODIFIER> + <FIELD /> + <PROTECTED /> + <STATIC /> </AND> </match> </rule> <rule> <match> <AND> - <TYPE>FIELD</TYPE> - <MODIFIER>PRIVATE</MODIFIER> - <MODIFIER>STATIC</MODIFIER> + <FIELD /> + <PRIVATE /> + <STATIC /> </AND> </match> </rule> <rule> <match> <AND> - <TYPE>FIELD</TYPE> - <MODIFIER>PUBLIC</MODIFIER> + <FIELD /> + <PUBLIC /> </AND> </match> </rule> <rule> <match> <AND> - <TYPE>FIELD</TYPE> - <MODIFIER>PROTECTED</MODIFIER> + <FIELD /> + <PROTECTED /> </AND> </match> </rule> <rule> <match> <AND> - <TYPE>FIELD</TYPE> - <MODIFIER>PRIVATE</MODIFIER> + <FIELD /> + <PRIVATE /> </AND> </match> </rule> <rule> <match> - <TYPE>CONSTRUCTOR</TYPE> + <CONSTRUCTOR /> </match> </rule> <rule> <match> <AND> - <TYPE>METHOD</TYPE> - <MODIFIER>PUBLIC</MODIFIER> - <MODIFIER>STATIC</MODIFIER> + <METHOD /> + <PUBLIC /> + <STATIC /> </AND> </match> </rule> <rule> <match> <AND> - <TYPE>METHOD</TYPE> - <MODIFIER>PROTECTED</MODIFIER> - <MODIFIER>STATIC</MODIFIER> + <METHOD /> + <PROTECTED /> + <STATIC /> </AND> </match> </rule> <rule> <match> <AND> - <TYPE>METHOD</TYPE> - <MODIFIER>PRIVATE</MODIFIER> - <MODIFIER>STATIC</MODIFIER> + <METHOD /> + <PRIVATE /> + <STATIC /> </AND> </match> </rule> <rule> <match> <AND> - <TYPE>METHOD</TYPE> - <MODIFIER>PUBLIC</MODIFIER> + <METHOD /> + <PUBLIC /> </AND> </match> </rule> <rule> <match> <AND> - <TYPE>METHOD</TYPE> - <MODIFIER>PROTECTED</MODIFIER> + <METHOD /> + <PROTECTED /> </AND> </match> </rule> <rule> <match> <AND> - <TYPE>METHOD</TYPE> - <MODIFIER>PRIVATE</MODIFIER> + <METHOD /> + <PRIVATE /> </AND> </match> </rule> <rule> <match> - <TYPE>TRAIT</TYPE> + <TRAIT /> </match> </rule> <rule> <match> - <TYPE>INTERFACE</TYPE> + <INTERFACE /> </match> </rule> <rule> <match> - <TYPE>CLASS</TYPE> + <CLASS /> </match> </rule> </rules> diff --git a/misc/others/phpstorm-codestyles/README.md b/misc/others/phpstorm-codestyles/README.md index 26d33d80b3..5f910b0a5d 100644 --- a/misc/others/phpstorm-codestyles/README.md +++ b/misc/others/phpstorm-codestyles/README.md @@ -7,6 +7,9 @@ Steps: * Use latest Phpstorm * Copy this Piwik_codestyle.xml file in your ~/.WebIde60/config/codestyles/ * If you use Windows or Mac see which path to copy at: http://intellij-support.jetbrains.com/entries/23358108 + * To automatically link to the file in Piwik: + `$ ln -s ~/dev/piwik-master/misc/others/phpstorm-codestyles/Piwik_codestyle.xml ~/.WebIde70/config/codestyles/Piwik_codestyle.xml` + * Restart PhpStorm. * Select this coding in Settings>Code style. |