diff --git a/.gitignore b/.gitignore index ac561c35ed37a4706b17fa35fc6fc77db46d6b49..0ae42c673e40900dfeacb95ca0f2af71a7b45e9c 100644 --- a/.gitignore +++ b/.gitignore @@ -23,7 +23,6 @@ tmp/* *.buildpath config/config.ini.php .DS_Store -tests/PHPUnit/Integration/processed/ js/yui* misc/*.dat tests/javascript/enable_sqlite diff --git a/core/Common.php b/core/Common.php index e9a4625573d29edf4f808d76d7bb79b8573df2b0..5eeb94ffaf46af3ea85e57a49494ae10d7614426 100644 --- a/core/Common.php +++ b/core/Common.php @@ -970,7 +970,7 @@ class Piwik_Common /** * Returns the browser language code, eg. "en-gb,en;q=0.5" * - * @param string $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) @@ -1075,8 +1075,8 @@ class Piwik_Common /** * Returns the visitor language based only on the Browser 'accepted language' information * - * @param $browserLanguage Browser's accepted langauge header - * @param $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) diff --git a/core/DataAccess/ArchiveWriter.php b/core/DataAccess/ArchiveWriter.php index 3f36252fdcf15df6a2cf53ff9b3c29799e0ed73a..bb10fe7a44ddb6bac640db4c76cf2a8328be1aa9 100644 --- a/core/DataAccess/ArchiveWriter.php +++ b/core/DataAccess/ArchiveWriter.php @@ -231,7 +231,7 @@ class Piwik_DataAccess_ArchiveWriter if (is_numeric($value)) { return $this->getTableNumeric(); } - return Piwik_DataAccess_ArchiveTableCreator::getBlobTable($this->dateStart);; + return Piwik_DataAccess_ArchiveTableCreator::getBlobTable($this->dateStart); } protected function getTableNumeric() diff --git a/core/Db/Adapter/Pdo/Mssql.php b/core/Db/Adapter/Pdo/Mssql.php index 6754962e6de6f5fd3bfb0e81aed40045d0085110..54a156295bc7a4d1cda7d88792eb5b38cae4e988 100644 --- a/core/Db/Adapter/Pdo/Mssql.php +++ b/core/Db/Adapter/Pdo/Mssql.php @@ -246,7 +246,7 @@ class Piwik_Db_Pdo_Mssql extends Zend_Db_Adapter_Pdo_Mssql implements Piwik_Db_A $version = $this->_connection->getAttribute(PDO::ATTR_CLIENT_VERSION); $requiredVersion = Piwik_Config::getInstance()->General['minimum_mssql_client_version']; if (version_compare($version['DriverVer'], $requiredVersion) === -1) { - throw new Exception(Piwik_TranslateException('General_ExceptionDatabaseVersion', array('MSSQL', $serverVersion, $requiredVersion))); + throw new Exception(Piwik_TranslateException('General_ExceptionDatabaseVersion', array('MSSQL', $version['DriverVer'], $requiredVersion))); } else { return $version['DriverVer']; } diff --git a/core/EventDispatcher.php b/core/EventDispatcher.php index b1bc3daa1cb4c50e6d2ee79d9fda161a812c51dd..f11107d56e42d1824086121234f100e3f74a6f56 100644 --- a/core/EventDispatcher.php +++ b/core/EventDispatcher.php @@ -117,7 +117,7 @@ class Piwik_EventDispatcher * name. * * @param string $eventName - * @param array $callback This can be a normal PHP callback or an array + * @param array|callable $callback This can be a normal PHP callback or an array * that looks like this: * array( * 'function' => $callback, @@ -200,7 +200,7 @@ function Piwik_PostEvent($eventName, $params = array(), $pending = false, $plugi * Register an action to execute for a given event * * @param string $eventName Name of event - * @param function $function Callback hook + * @param callable $function Callback hook */ function Piwik_AddAction($eventName, $function) { diff --git a/core/Period/Range.php b/core/Period/Range.php index c73f10b4fe2cccc93a79c541be9785024c2576c6..27ef4bd01520aa8365054e0022b286c5fa719108 100644 --- a/core/Period/Range.php +++ b/core/Period/Range.php @@ -19,6 +19,12 @@ class Piwik_Period_Range extends Piwik_Period { protected $label = 'range'; + /** + * @param string $strPeriod + * @param string $strDate + * @param string $timezone + * @param bool|Piwik_Date $today + */ public function __construct($strPeriod, $strDate, $timezone = 'UTC', $today = false) { $this->strPeriod = $strPeriod; diff --git a/core/PluginsManager.php b/core/PluginsManager.php index f003859a39082ba773244aae03c7034396e25506..c09988452f3904ce575c34eeecfb61d8a6cd07cc 100644 --- a/core/PluginsManager.php +++ b/core/PluginsManager.php @@ -424,7 +424,7 @@ class Piwik_PluginsManager /** * Unload plugin * - * @param Piwik_Plugin $plugin + * @param Piwik_Plugin|string $plugin * @throws Exception */ public function unloadPlugin($plugin) diff --git a/core/Tracker/Cache.php b/core/Tracker/Cache.php index d277d94f847775a0b21718dd04b76cc0c11aee23..f529b1d874e34afb00ada78c6f25f8dedd4b7901 100644 --- a/core/Tracker/Cache.php +++ b/core/Tracker/Cache.php @@ -119,7 +119,7 @@ class Piwik_Tracker_Cache /** * Regenerate Tracker cache files * - * @param array $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()) { diff --git a/core/Translate.php b/core/Translate.php index 807638357c562b41e5274b2fd60b131feab3392d..d2b95e700b67e031cdc4583a180b1e6ef34f04c7 100644 --- a/core/Translate.php +++ b/core/Translate.php @@ -69,6 +69,7 @@ class Piwik_Translate private function loadTranslation($language) { + $translations = array(); $path = PIWIK_INCLUDE_PATH . '/lang/' . $language . '.php'; if (!Piwik_Common::isValidFilename($language) || !is_readable($path)) { throw new Exception(Piwik_TranslateException('General_ExceptionLanguageFileNotFound', array($language))); @@ -181,7 +182,7 @@ class Piwik_Translate * Returns translated string or given message if translation is not found. * * @param string $string Translation string index - * @param array $args sprintf arguments + * @param array|string|int $args sprintf arguments * @return string */ function Piwik_Translate($string, $args = array()) diff --git a/core/TranslationWriter.php b/core/TranslationWriter.php index e2fbb9578c5149fae7d63d09ee8440de197dd527..e47ae10f896709b1e3491c70b2ad12bfefb42bad 100644 --- a/core/TranslationWriter.php +++ b/core/TranslationWriter.php @@ -69,6 +69,7 @@ class Piwik_TranslationWriter */ static public function loadTranslation($lang) { + $translations = array(); $path = self::getTranslationPath($lang); if (!is_readable($path)) { throw new Exception(Piwik_TranslateException('General_ExceptionLanguageFileNotFound', array($lang))); diff --git a/plugins/CoreAdminHome/API.php b/plugins/CoreAdminHome/API.php index 27a2293bcd87bb27f064d11b45b114b7a0d46b7f..a2e272ffb3ff61310c4d292015967b0e1cc0f4c9 100644 --- a/plugins/CoreAdminHome/API.php +++ b/plugins/CoreAdminHome/API.php @@ -129,8 +129,8 @@ class Piwik_CoreAdminHome_API // but also weeks overlapping several months stored in the month where the week is starting /* @var $week Piwik_Period_Week */ $week = Piwik_Period::factory('week', $date); - $week = $week->getDateStart()->toString('Y_m'); - $datesByMonth[$week][] = $date->toString(); + $weekAsString = $week->getDateStart()->toString('Y_m'); + $datesByMonth[$weekAsString][] = $date->toString(); // Keep track of the minimum date for each website if ($minDate === false diff --git a/plugins/CoreHome/Controller.php b/plugins/CoreHome/Controller.php index 724bb1f4729469df4e6a13a01e30cb5ad1f8a864..fe9875c3d03d3b845e61933f407b71b9ba91a60a 100644 --- a/plugins/CoreHome/Controller.php +++ b/plugins/CoreHome/Controller.php @@ -226,7 +226,7 @@ class Piwik_CoreHome_Controller extends Piwik_Controller public function redirectToPaypal() { $parameters = Piwik_API_Request::getRequestArrayFromString($request = null); - foreach ($paramaters as $name => $param) { + foreach ($parameters as $name => $param) { if ($name == 'idSite' || $name == 'module' || $name == 'action' diff --git a/plugins/LanguagesManager/API.php b/plugins/LanguagesManager/API.php index 484065f4e14854d87c83a487a47124b357b2f24d..658deb886c3cbc438430f3ab7e4b8b3407679f36 100644 --- a/plugins/LanguagesManager/API.php +++ b/plugins/LanguagesManager/API.php @@ -116,7 +116,7 @@ class Piwik_LanguagesManager_API } $filenames = $this->getAvailableLanguages(); - $languagesInfo = array(); + $translations = $languagesInfo = array(); foreach ($filenames as $filename) { require PIWIK_INCLUDE_PATH . "/lang/$filename.php"; $languagesInfo[] = array( @@ -140,6 +140,7 @@ class Piwik_LanguagesManager_API if (!$this->isLanguageAvailable($languageCode)) { return false; } + $translations = array(); require PIWIK_INCLUDE_PATH . "/lang/$languageCode.php"; $languageInfo = array(); foreach ($translations as $key => $value) { diff --git a/plugins/Live/API.php b/plugins/Live/API.php index 62c0b5c7be36e7a6c1ea6bee1630c8cfe8d48d62..074f1f7a0591277b693963a05743dc7db564c612 100644 --- a/plugins/Live/API.php +++ b/plugins/Live/API.php @@ -84,8 +84,12 @@ class Piwik_Live_API $data = Piwik_FetchAll($query['sql'], $query['bind']); // These could be unset for some reasons, ensure they are set to 0 - empty($data[0]['actions']) ? $data[0]['actions'] = 0 : ''; - empty($data[0]['visitsConverted']) ? $data[0]['visitsConverted'] = 0 : ''; + if (empty($data[0]['actions'])) { + $data[0]['actions'] = 0; + } + if (empty($data[0]['visitsConverted'])) { + $data[0]['visitsConverted'] = 0; + } return $data; } diff --git a/plugins/UserCountry/Archiver.php b/plugins/UserCountry/Archiver.php index 2fa2573d55850945ea5131e252a60c3d7122e7ed..deac72405c3d7d59b26194e2bd2710dc81ad4ead 100644 --- a/plugins/UserCountry/Archiver.php +++ b/plugins/UserCountry/Archiver.php @@ -21,8 +21,6 @@ class Piwik_UserCountry_Archiver extends Piwik_PluginsArchiver private $latLongForCities = array(); - private $dataArrays = array(); - protected $maximumRows; const COUNTRY_FIELD = 'location_country'; diff --git a/plugins/UserCountry/LocationProvider/GeoIp.php b/plugins/UserCountry/LocationProvider/GeoIp.php index f7a9029797dd42cbd72330dc6198cfb39dfbb414..5cf139ac120cb9eff57d016128dbc6ea7f957ec7 100755 --- a/plugins/UserCountry/LocationProvider/GeoIp.php +++ b/plugins/UserCountry/LocationProvider/GeoIp.php @@ -168,6 +168,7 @@ abstract class Piwik_UserCountry_LocationProvider_GeoIp extends Piwik_UserCountr public static function getRegionNames() { if (is_null(self::$regionNames)) { + $GEOIP_REGION_NAME = array(); require_once PIWIK_INCLUDE_PATH . '/libs/MaxMindGeoIP/geoipregionvars.php'; self::$regionNames = $GEOIP_REGION_NAME; } diff --git a/plugins/Zeitgeist/templates/_jsGlobalVariables.twig b/plugins/Zeitgeist/templates/_jsGlobalVariables.twig index 3667f2169f527a7a9a333a1278c66dd3a38b27f6..0ec9e5478dd3a57b2d85ab05c3ce7122ff0ac8ee 100644 --- a/plugins/Zeitgeist/templates/_jsGlobalVariables.twig +++ b/plugins/Zeitgeist/templates/_jsGlobalVariables.twig @@ -1,5 +1,5 @@ <script type="text/javascript"> - var piwik = {} + var piwik = {}; piwik.token_auth = "{{ token_auth }}"; piwik.piwik_url = "{{ piwikUrl }}"; {% if userLogin %}piwik.userLogin = "{{ userLogin|e('js')}}";