diff options
37 files changed, 87 insertions, 74 deletions
diff --git a/core/API/DocumentationGenerator.php b/core/API/DocumentationGenerator.php index f846fc0c3e..ae1b1557bf 100644 --- a/core/API/DocumentationGenerator.php +++ b/core/API/DocumentationGenerator.php @@ -15,6 +15,7 @@ use Piwik\Piwik; use Piwik\Common; use Piwik\API\Proxy; use Piwik\Url; +use Piwik\PluginsManager; /** * @package Piwik @@ -30,7 +31,7 @@ class DocumentationGenerator */ public function __construct() { - $plugins = \Piwik\PluginsManager::getInstance()->getLoadedPluginsName(); + $plugins = PluginsManager::getInstance()->getLoadedPluginsName(); foreach ($plugins as $plugin) { $plugin = Common::unprefixClass($plugin); try { diff --git a/core/API/Request.php b/core/API/Request.php index ce3f0ada18..91d664af56 100644 --- a/core/API/Request.php +++ b/core/API/Request.php @@ -19,6 +19,7 @@ use Piwik\Access; use Piwik\DataTable; use Piwik\Url; use Piwik\API\ResponseBuilder; +use Piwik\PluginsManager; use Piwik\PluginDeactivatedException; /** @@ -145,7 +146,7 @@ class Request list($module, $method) = $this->extractModuleAndMethod($moduleMethod); - if (!\Piwik\PluginsManager::getInstance()->isPluginActivated($module)) { + if (!PluginsManager::getInstance()->isPluginActivated($module)) { throw new PluginDeactivatedException($module); } $moduleClass = "Piwik_" . $module . "_API"; diff --git a/core/Access.php b/core/Access.php index 80922e30a2..7f1f89c616 100644 --- a/core/Access.php +++ b/core/Access.php @@ -213,7 +213,7 @@ class Access try { $allSitesId = \Piwik_SitesManager_API::getInstance()->getAllSitesId(); - } catch(Exception $e) { + } catch(\Exception $e) { $allSitesId = array(); } $this->idsitesByAccess['superuser'] = $allSitesId; diff --git a/core/Archive.php b/core/Archive.php index 0b726493bd..1d7d226f33 100644 --- a/core/Archive.php +++ b/core/Archive.php @@ -627,7 +627,7 @@ class Archive * Returns the name of the plugin that archives a given report. * * @param string $report Archive data name, ie, 'nb_visits', 'UserSettings_...', etc. - * @throws Exception + * @throws \Exception * @return string */ public static function getPluginForReport($report) @@ -645,7 +645,7 @@ class Archive || !\Piwik\PluginsManager::getInstance()->isPluginActivated($plugin) ) { $pluginStr = empty($plugin) ? '' : "($plugin)"; - throw new Exception("Error: The report '$report' was requested but it is not available " + throw new \Exception("Error: The report '$report' was requested but it is not available " . "at this stage. You may also disable the related plugin $pluginStr " . "to avoid this error."); } diff --git a/core/Archive/DataTableFactory.php b/core/Archive/DataTableFactory.php index 319db1d904..d571b06d60 100644 --- a/core/Archive/DataTableFactory.php +++ b/core/Archive/DataTableFactory.php @@ -107,12 +107,12 @@ class DataTableFactory * supplied subtable ID. * * @param int $idSubtable An in-database subtable ID. - * @throws Exception + * @throws \Exception */ public function useSubtable($idSubtable) { if (count($this->dataNames) !== 1) { - throw new Exception("DataTableFactory: Getting subtables for multiple records in one" + throw new \Exception("DataTableFactory: Getting subtables for multiple records in one" . " archive query is not currently supported."); } diff --git a/core/AssetManager.php b/core/AssetManager.php index 041ae5e86c..ed64a1121b 100644 --- a/core/AssetManager.php +++ b/core/AssetManager.php @@ -16,6 +16,7 @@ use Piwik\Config; use Piwik\Piwik; use Piwik\Common; use Piwik\Version; +use Piwik\PluginsManager; use lessc; /** @@ -87,7 +88,7 @@ class AssetManager */ public static function generateAssetsCacheBuster() { - $pluginList = md5(implode(",", \Piwik\PluginsManager::getInstance()->getLoadedPluginsName())); + $pluginList = md5(implode(",", PluginsManager::getInstance()->getLoadedPluginsName())); $cacheBuster = md5(Common::getSalt() . $pluginList . PHP_VERSION . Version::VERSION); return $cacheBuster; } diff --git a/core/Common.php b/core/Common.php index d80fc99b7c..0fbf8f8ddf 100644 --- a/core/Common.php +++ b/core/Common.php @@ -14,6 +14,7 @@ use Exception; use Piwik\IP; use Piwik\Tracker; use Piwik\Tracker\Cache; +use Piwik\PluginsManager; use Piwik_UserCountry_LocationProvider_Default; /** @@ -114,7 +115,7 @@ class Common */ public static function isGoalPluginEnabled() { - return \Piwik\PluginsManager::getInstance()->isPluginActivated('Goals'); + return PluginsManager::getInstance()->isPluginActivated('Goals'); } /* diff --git a/core/Controller.php b/core/Controller.php index 34233cdf56..1187b084d9 100644 --- a/core/Controller.php +++ b/core/Controller.php @@ -798,7 +798,7 @@ abstract class Controller * @param int $currentValue The value to calculate evolution to. * @param string $pastDate The date of past value. * @param int $pastValue The value in the past to calculate evolution from. - * @return string|false The HTML or false if the evolution is 0 and the current value is 0. + * @return string|bool The HTML or false if the evolution is 0 and the current value is 0. */ protected function getEvolutionHtml($date, $currentValue, $pastDate, $pastValue) { diff --git a/core/Controller/Admin.php b/core/Controller/Admin.php index be4bcd2741..57f5302cfe 100644 --- a/core/Controller/Admin.php +++ b/core/Controller/Admin.php @@ -15,6 +15,7 @@ use Piwik\Piwik; use Piwik\Controller; use Piwik\View; use Piwik\Url; +use Piwik\PluginsManager; /** * Parent class of all plugins Controllers with admin functions @@ -59,10 +60,10 @@ abstract class Admin extends Controller $view->isSuperUser = Piwik::isUserIsSuperUser(); // for old geoip plugin warning - $view->usingOldGeoIPPlugin = \Piwik\PluginsManager::getInstance()->isPluginActivated('GeoIP'); + $view->usingOldGeoIPPlugin = PluginsManager::getInstance()->isPluginActivated('GeoIP'); // for cannot find installed plugin warning - $missingPlugins = \Piwik\PluginsManager::getInstance()->getMissingPlugins(); + $missingPlugins = PluginsManager::getInstance()->getMissingPlugins(); if (!empty($missingPlugins)) { $pluginsLink = Url::getCurrentQueryStringWithParametersModified(array( 'module' => 'CorePluginsAdmin', 'action' => 'index' diff --git a/core/DataTable/Filter/AddColumnsProcessedMetrics.php b/core/DataTable/Filter/AddColumnsProcessedMetrics.php index dc41dacdc7..99503a522b 100644 --- a/core/DataTable/Filter/AddColumnsProcessedMetrics.php +++ b/core/DataTable/Filter/AddColumnsProcessedMetrics.php @@ -62,7 +62,7 @@ class AddColumnsProcessedMetrics extends Filter $conversionRate = round(100 * $nbVisitsConverted / $nbVisits, $this->roundPrecision); try { $row->addColumn('conversion_rate', $conversionRate . "%"); - } catch (Exception $e) { + } catch (\Exception $e) { // conversion_rate can be defined upstream apparently? FIXME } } @@ -83,12 +83,12 @@ class AddColumnsProcessedMetrics extends Filter $row->addColumn('avg_time_on_site', $averageTimeOnSite); // It could be useful for API users to have raw sum length value. //$row->addMetadata('sum_visit_length', $visitLength); - } catch (Exception $e) { + } catch (\Exception $e) { } try { $row->addColumn('bounce_rate', $bounceRate . "%"); - } catch (Exception $e) { + } catch (\Exception $e) { } $this->filterSubTable($row); diff --git a/core/DataTable/Filter/ExcludeLowPopulation.php b/core/DataTable/Filter/ExcludeLowPopulation.php index 07699ea2ea..47de3ed73e 100644 --- a/core/DataTable/Filter/ExcludeLowPopulation.php +++ b/core/DataTable/Filter/ExcludeLowPopulation.php @@ -40,7 +40,7 @@ class ExcludeLowPopulation extends Filter * * @param DataTable $table * @param string $columnToFilter column to filter - * @param number|Closure $minimumValue minimum value + * @param number|\Closure $minimumValue minimum value * @param bool $minimumPercentageThreshold */ public function __construct($table, $columnToFilter, $minimumValue, $minimumPercentageThreshold = false) diff --git a/core/DataTable/Renderer/Xml.php b/core/DataTable/Renderer/Xml.php index 4a9fdbdec5..bc5e34ad87 100644 --- a/core/DataTable/Renderer/Xml.php +++ b/core/DataTable/Renderer/Xml.php @@ -11,12 +11,12 @@ namespace Piwik\DataTable\Renderer; use Exception; +use Piwik\DataTable; +use Piwik\DataTable\Map; use Piwik\DataTable\Renderer\Php; use Piwik\DataTable\Simple; use Piwik\DataTable\Renderer; use Piwik\Piwik; -use Piwik\DataTable; -use DataTable\Map; /** * XML export of a given DataTable. @@ -92,7 +92,7 @@ class Xml extends Renderer protected function renderTable($table, $returnOnlyDataTableXml = false, $prefixLines = '') { $array = $this->getArrayFromDataTable($table); - if ($table instanceof DataTable\Map) { + if ($table instanceof Map) { $out = $this->renderDataTableArray($table, $array, $prefixLines); if ($returnOnlyDataTableXml) { @@ -200,13 +200,13 @@ class Xml extends Renderer $result .= $this->renderArray($value, $prefixLines . "\t"); $result .= $prefixLines . $suffix . "\n"; } else if ($value instanceof DataTable - || $value instanceof DataTable\Map + || $value instanceof Map ) { if ($value->getRowsCount() == 0) { $result .= $prefixLines . $emptyNode . "\n"; } else { $result .= $prefixLines . $prefix . "\n"; - if ($value instanceof DataTable\Map) { + if ($value instanceof Map) { $result .= $this->renderDataTableArray($value, $this->getArrayFromDataTable($value), $prefixLines); } else if ($value instanceof Simple) { $result .= $this->renderDataTableSimple($this->getArrayFromDataTable($value), $prefixLines); @@ -233,7 +233,7 @@ class Xml extends Renderer /** * Computes the output for the given data table array * - * @param DataTable\Map $table + * @param Map $table * @param array $array * @param string $prefixLines * @return string @@ -251,7 +251,7 @@ class Xml extends Renderer foreach ($array as $valueAttribute => $value) { if (empty($value)) { $xml .= $prefixLines . "\t<result $nameDescriptionAttribute=\"$valueAttribute\" />\n"; - } elseif ($value instanceof DataTable\Map) { + } elseif ($value instanceof Map) { $out = $this->renderTable($value, true); //TODO somehow this code is not tested, cover this case $xml .= "\t<result $nameDescriptionAttribute=\"$valueAttribute\">\n$out</result>\n"; @@ -333,7 +333,7 @@ class Xml extends Renderer return $xml; } - if ($firstTable instanceof DataTable\Map) { + if ($firstTable instanceof Map) { $xml = ''; $tables = $table->getArray(); $nameDescriptionAttribute = $table->getKeyName(); diff --git a/core/EventDispatcher.php b/core/EventDispatcher.php index 7c311e4dd4..641e654252 100644 --- a/core/EventDispatcher.php +++ b/core/EventDispatcher.php @@ -11,6 +11,7 @@ namespace Piwik; use Piwik\Plugin; +use Piwik\PluginsManager; /** * This class allows code to post events from anywhere in Piwik and for @@ -79,7 +80,7 @@ class EventDispatcher } if (empty($plugins)) { - $plugins = \Piwik\PluginsManager::getInstance()->getLoadedPlugins(); + $plugins = PluginsManager::getInstance()->getLoadedPlugins(); } $callbacks = array(); @@ -87,7 +88,7 @@ class EventDispatcher // collect all callbacks to execute foreach ($plugins as $plugin) { if (is_string($plugin)) { - $plugin = \Piwik\PluginsManager::getInstance()->getLoadedPlugin($plugin); + $plugin = PluginsManager::getInstance()->getLoadedPlugin($plugin); } $hooks = $plugin->getListHooksRegistered(); diff --git a/core/ExceptionHandler.php b/core/ExceptionHandler.php index 2d97cb06d6..c6d4f1d22b 100644 --- a/core/ExceptionHandler.php +++ b/core/ExceptionHandler.php @@ -10,6 +10,7 @@ */ use Piwik\Piwik; use Piwik\Log; +use Piwik\Log\ExceptionScreenFormatter; use Piwik\FrontController; /** diff --git a/core/FrontController.php b/core/FrontController.php index 6bc267e319..fc33f3eae2 100644 --- a/core/FrontController.php +++ b/core/FrontController.php @@ -17,6 +17,8 @@ use Piwik\API\ResponseBuilder; use Piwik\Session; use Piwik\Timer; use Piwik\Url; +use Piwik\Log; +use Piwik\PluginsManager; use Zend_Registry; /** @@ -93,7 +95,7 @@ class FrontController throw new Exception("Invalid module name '$module'"); } - if (!\Piwik\PluginsManager::getInstance()->isPluginActivated($module)) { + if (!PluginsManager::getInstance()->isPluginActivated($module)) { throw new PluginDeactivatedException($module); } @@ -242,7 +244,7 @@ class FrontController $this->handleMaintenanceMode(); $this->handleSSLRedirection(); - $pluginsManager = \Piwik\PluginsManager::getInstance(); + $pluginsManager = PluginsManager::getInstance(); $pluginsToLoad = Config::getInstance()->Plugins['Plugins']; $pluginsManager->loadPlugins($pluginsToLoad); @@ -261,14 +263,14 @@ class FrontController throw $e; } - \Piwik\Log::make(); + Log::make(); // Init the Access object, so that eg. core/Updates/* can enforce Super User and use some APIs Access::getInstance(); Piwik_PostEvent('FrontController.dispatchCoreAndPluginUpdatesScreen'); - \Piwik\PluginsManager::getInstance()->installLoadedPlugins(); + PluginsManager::getInstance()->installLoadedPlugins(); // ensure the current Piwik URL is known for later use if (method_exists('Piwik\Piwik', 'getPiwikUrl')) { diff --git a/core/JqplotDataGenerator.php b/core/JqplotDataGenerator.php index a3c6ce5fd4..8f9d48baea 100644 --- a/core/JqplotDataGenerator.php +++ b/core/JqplotDataGenerator.php @@ -50,7 +50,7 @@ class JqplotDataGenerator { switch ($type) { case 'evolution': - return new \Piwik\JqplotDataGenerator\Evolution($properties); + return new JqplotDataGenerator\Evolution($properties); case 'pie': $visualization = new Visualization\Chart\Pie(); return new JqplotDataGenerator($visualization, $properties); @@ -65,7 +65,7 @@ class JqplotDataGenerator /** * Constructor. * - * @param \Piwik\Visualization\ $visualization + * @param Visualization\ $visualization * @param array $properties */ public function __construct($visualization, $properties) @@ -180,7 +180,6 @@ class JqplotDataGenerator /** * Used in initChartObjectData to add the series picker config to the view object - * @param bool $multiSelect */ protected function addSeriesPickerToView() { diff --git a/core/Log.php b/core/Log.php index 18fe490f13..7d1348f172 100644 --- a/core/Log.php +++ b/core/Log.php @@ -95,7 +95,7 @@ abstract class Log extends \Zend_Log * @param string $event * @param int $priority * @param null $extras - * @throws Zend_Log_Exception + * @throws \Zend_Log_Exception * @return void */ public function log($event, $priority, $extras = null) @@ -180,7 +180,7 @@ abstract class Log extends \Zend_Log break; default: - throw new Exception("'$recordTo' is not a valid Log type. Valid logger types are: screen, database, file."); + throw new \Exception("'$recordTo' is not a valid Log type. Valid logger types are: screen, database, file."); break; } } diff --git a/core/Log/ErrorScreenFormatter.php b/core/Log/ErrorScreenFormatter.php index f3aee76c40..5bd2953f11 100644 --- a/core/Log/ErrorScreenFormatter.php +++ b/core/Log/ErrorScreenFormatter.php @@ -10,6 +10,7 @@ */ namespace Piwik\Log; use Piwik\Log; +use Piwik\Version; /** * Format an error event to be displayed on the screen. @@ -43,7 +44,7 @@ class ErrorScreenFormatter extends ScreenFormatter // is there any other case where the errno is zero at this point? if ($errno == 0) return ''; $strReturned .= "\n<div style='word-wrap: break-word; border: 3px solid red; padding:4px; width:70%; background-color:#FFFF96;'> - <strong>There is an error. Please report the message (Piwik " . (class_exists('Piwik\Version') ? \Piwik\Version::VERSION : '') . ") + <strong>There is an error. Please report the message (Piwik " . (class_exists('Piwik\Version') ? Version::VERSION : '') . ") and full backtrace in the <a href='?module=Proxy&action=redirect&url=http://forum.piwik.org' target='_blank'>Piwik forums</a> (please do a Search first as it might have been reported already!).<br /><br/> "; switch ($errno) { diff --git a/core/Log/Exception.php b/core/Log/Exception.php index 58a9881dda..e6b9ff0ec7 100644 --- a/core/Log/Exception.php +++ b/core/Log/Exception.php @@ -63,7 +63,7 @@ class Exception extends Log /** * Logs the given exception event * - * @param Exception $exception + * @param \Exception $exception */ public function logEvent(\Exception $exception) { diff --git a/core/Log/ExceptionScreenFormatter.php b/core/Log/ExceptionScreenFormatter.php index b344a2f2d1..0d789ef2aa 100644 --- a/core/Log/ExceptionScreenFormatter.php +++ b/core/Log/ExceptionScreenFormatter.php @@ -12,6 +12,7 @@ namespace Piwik\Log; use Piwik\Common; use Piwik\Log; +use Piwik\API\ResponseBuilder; /** * Format an exception event to be displayed on the screen. @@ -33,7 +34,7 @@ class ExceptionScreenFormatter extends ScreenFormatter $errstr = $event['message']; $outputFormat = strtolower(Common::getRequestVar('format', 'html', 'string')); - $response = new \Piwik\API\ResponseBuilder($outputFormat); + $response = new ResponseBuilder($outputFormat); $message = $response->getResponseException(new \Exception($errstr)); return parent::format($message); } diff --git a/core/Piwik.php b/core/Piwik.php index 7c70d2a5c0..de54f033ad 100644 --- a/core/Piwik.php +++ b/core/Piwik.php @@ -26,6 +26,7 @@ use Piwik\Tracker\GoalManager; use Piwik\Url; use Piwik_UsersManager_API; use Piwik\View; +use Piwik\Log\ScreenFormatter; use Zend_Registry; /** @@ -1053,7 +1054,7 @@ class Piwik "<p><img src='plugins/Zeitgeist/images/error_medium.png' style='vertical-align:middle; float:left;padding:20 20 20 20' />" . $message . "</p></div>"; - print(\Piwik\Log\Formatter_ScreenFormatter::getFormattedString($output)); + print(ScreenFormatter::getFormattedString($output)); exit; } diff --git a/core/Plugin/MetadataLoader.php b/core/Plugin/MetadataLoader.php index 6cec2615c4..8f4d969abd 100644 --- a/core/Plugin/MetadataLoader.php +++ b/core/Plugin/MetadataLoader.php @@ -13,6 +13,7 @@ namespace Piwik\Plugin; use Exception; use Piwik\Common; use Piwik\Version; +use Piwik\PluginsManager; /** * @see core/Version.php @@ -74,7 +75,7 @@ class MetadataLoader private function loadPluginInfoJson() { - $path = \Piwik\PluginsManager::getPluginsDirectory() . $this->pluginName . '/' . self::PLUGIN_JSON_FILENAME; + $path = PluginsManager::getPluginsDirectory() . $this->pluginName . '/' . self::PLUGIN_JSON_FILENAME; return $this->loadJsonMetadata($path); } diff --git a/core/QuickForm2.php b/core/QuickForm2.php index 23f0690e45..3de11b9c3a 100644 --- a/core/QuickForm2.php +++ b/core/QuickForm2.php @@ -62,11 +62,11 @@ abstract class QuickForm2 extends HTML_QuickForm2 /** * Wrapper around HTML_QuickForm2_Container's addElement() * - * @param string|HTML_QuickForm2_Node Either type name (treated + * @param string|HTML_QuickForm2_Node $elementOrType Either type name (treated * case-insensitively) or an element instance - * @param mixed Element name - * @param mixed Element attributes - * @param array 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/ReportRenderer.php b/core/ReportRenderer.php index 036ef72042..d2d51f1425 100644 --- a/core/ReportRenderer.php +++ b/core/ReportRenderer.php @@ -130,9 +130,9 @@ abstract class ReportRenderer * Append $extension to $filename * * @static - * @param $filename - * @param $extension - * @return filename with extension + * @param string $filename + * @param string $extension + * @return string filename with extension */ protected static function appendExtension($filename, $extension) { diff --git a/core/Session/SaveHandler/DbTable.php b/core/Session/SaveHandler/DbTable.php index ddff2c167f..3f1d53a08f 100644 --- a/core/Session/SaveHandler/DbTable.php +++ b/core/Session/SaveHandler/DbTable.php @@ -13,7 +13,6 @@ namespace Piwik\Session\SaveHandler; use Zend_Session; use Zend_Session_SaveHandler_Interface; -use true; /** * Database-backed session save handler diff --git a/core/Tracker/GoalManager.php b/core/Tracker/GoalManager.php index aa87b58b91..56c989ffa9 100644 --- a/core/Tracker/GoalManager.php +++ b/core/Tracker/GoalManager.php @@ -18,7 +18,6 @@ use Piwik\Tracker\Action; use Piwik\Tracker\Cache; use Piwik\Tracker\Referrer; use Piwik\Tracker\Request; -use false; /** * @package Piwik diff --git a/core/Tracker/Referrer.php b/core/Tracker/Referrer.php index c288e0fbeb..49cfd158fb 100644 --- a/core/Tracker/Referrer.php +++ b/core/Tracker/Referrer.php @@ -56,9 +56,9 @@ class Referrer * * - referer_url : the same for all the referer types * - * @param $refererUrl must be URL Encoded - * @param $currentUrl - * @param $idSite + * @param string $refererUrl must be URL Encoded + * @param string $currentUrl + * @param int $idSite * @return array */ public function getRefererInformation($refererUrl, $currentUrl, $idSite) diff --git a/core/Translate.php b/core/Translate.php index 23b1e26371..6ff5b3d6d8 100644 --- a/core/Translate.php +++ b/core/Translate.php @@ -51,7 +51,7 @@ class Translate $this->unloadEnglishTranslation(); $this->loadEnglishTranslation(); $this->loadCoreTranslation($language); - \Piwik\PluginsManager::getInstance()->loadPluginTranslations($language); + PluginsManager::getInstance()->loadPluginTranslations($language); } /** diff --git a/core/Twig.php b/core/Twig.php index 5a01f5650d..5a316c65ce 100644 --- a/core/Twig.php +++ b/core/Twig.php @@ -16,6 +16,7 @@ use Piwik\Common; use Piwik\AssetManager; use Piwik\Translate; use Piwik\Url; +use Piwik\PluginsManager; use Piwik\Visualization\Sparkline; use Twig_Environment; use Twig_Extension_Debug; @@ -150,7 +151,7 @@ class Twig private function getDefaultThemeLoader() { $themeLoader = new Twig_Loader_Filesystem(array( - sprintf("%s/plugins/%s/templates/", PIWIK_INCLUDE_PATH, \Piwik\PluginsManager::DEFAULT_THEME) + sprintf("%s/plugins/%s/templates/", PIWIK_INCLUDE_PATH, PluginsManager::DEFAULT_THEME) )); return $themeLoader; @@ -227,7 +228,7 @@ class Twig private function addPluginNamespaces(Twig_Loader_Filesystem $loader) { - $plugins = \Piwik\PluginsManager::getInstance()->getLoadedPluginsName(); + $plugins = PluginsManager::getInstance()->getLoadedPluginsName(); foreach ($plugins as $name) { $name = Common::unprefixClass($name); $path = sprintf("%s/plugins/%s/templates/", PIWIK_INCLUDE_PATH, $name); diff --git a/core/Updater.php b/core/Updater.php index 1da4f30a44..740bb2e031 100644 --- a/core/Updater.php +++ b/core/Updater.php @@ -56,7 +56,7 @@ class Updater { try { Piwik_SetOption($this->getNameInOptionTable($name), $version, $autoLoad = 1); - } catch (Exception $e) { + } catch (\Exception $e) { // case when the option table is not yet created (before 0.2.10) } } @@ -149,7 +149,7 @@ class Updater * Update the named component * * @param string $componentName 'core', or plugin name - * @throws Exception|Updater_UpdateErrorException + * @throws \Exception|Updater_UpdateErrorException * @return array of warning strings if applicable */ public function update($componentName) @@ -167,7 +167,7 @@ class Updater $this->recordComponentSuccessfullyUpdated($componentName, $fileVersion); } catch (Updater_UpdateErrorException $e) { throw $e; - } catch (Exception $e) { + } catch (\Exception $e) { $warningMessages[] = $e->getMessage(); } } @@ -225,7 +225,7 @@ class Updater /** * Construct list of outdated components * - * @throws Exception + * @throws \Exception * @return array array( componentName => array( oldVersion, newVersion), [...]) */ public function getComponentsWithNewVersion() @@ -242,9 +242,9 @@ class Updater foreach ($this->componentsToCheck as $name => $version) { try { $currentVersion = Piwik_GetOption('version_' . $name); - } catch (Exception $e) { + } catch (\Exception $e) { // mysql error 1146: table doesn't exist - if (Zend_Registry::get('db')->isErrNo($e, '1146')) { + if (\Zend_Registry::get('db')->isErrNo($e, '1146')) { // case when the option table is not yet created (before 0.2.10) $currentVersion = false; } else { @@ -287,9 +287,9 @@ class Updater foreach ($sqlarray as $update => $ignoreError) { try { Db::exec($update); - } catch (Exception $e) { + } catch (\Exception $e) { if (($ignoreError === false) - || !Zend_Registry::get('db')->isErrNo($e, $ignoreError) + || !\Zend_Registry::get('db')->isErrNo($e, $ignoreError) ) { $message = $file . ":\nError trying to execute the query '" . $update . "'.\nThe error was: " . $e->getMessage(); throw new Updater_UpdateErrorException($message); diff --git a/core/Updates/0.5.4.php b/core/Updates/0.5.4.php index 4fb0ef8488..9168a1ad5e 100644 --- a/core/Updates/0.5.4.php +++ b/core/Updates/0.5.4.php @@ -41,7 +41,7 @@ class Piwik_Updates_0_5_4 extends Updates throw new Exception('mandatory update failed'); } } catch (Exception $e) { - throw new Updater_UpdateErrorException("Please edit your config/config.ini.php file and add below <code>[superuser]</code> the following line: <br /><code>salt = $salt</code>"); + throw new \Piwik\Updater_UpdateErrorException("Please edit your config/config.ini.php file and add below <code>[superuser]</code> the following line: <br /><code>salt = $salt</code>"); } } diff --git a/core/Updates/0.6.3.php b/core/Updates/0.6.3.php index f2c4ed9f6a..db9d6d92e0 100644 --- a/core/Updates/0.6.3.php +++ b/core/Updates/0.6.3.php @@ -42,7 +42,7 @@ class Piwik_Updates_0_6_3 extends Updates throw new Exception('mandatory update failed'); } } catch (Exception $e) { - throw new Updater_UpdateErrorException("Please edit your config/config.ini.php file and add below <code>[database]</code> the following line: <br /><code>schema = Myisam</code>"); + throw new \Piwik\Updater_UpdateErrorException("Please edit your config/config.ini.php file and add below <code>[database]</code> the following line: <br /><code>schema = Myisam</code>"); } } diff --git a/core/ViewDataTable.php b/core/ViewDataTable.php index 8e457467d9..86a29eca33 100644 --- a/core/ViewDataTable.php +++ b/core/ViewDataTable.php @@ -123,7 +123,7 @@ abstract class ViewDataTable * This view should be an implementation of the Interface ViewInterface * The $view object should be created in the main() method. * - * @var ViewInterface + * @var \Piwik\View\ViewInterface */ protected $view = null; @@ -194,7 +194,7 @@ abstract class ViewDataTable * @param string $name A valid view property name. @see Properties for all * valid view properties. * @return mixed - * @throws Exception if the property name is invalid. + * @throws \Exception if the property name is invalid. */ public function &__get($name) { @@ -210,7 +210,7 @@ abstract class ViewDataTable * valid view properties. * @param mixed $value * @return mixed Returns $value. - * @throws Exception if the property name is invalid. + * @throws \Exception if the property name is invalid. */ public function __set($name, $value) { @@ -419,7 +419,7 @@ abstract class ViewDataTable // to avoid issuing unecessary requests when display properties are determined by metadata, // we allow it to be a closure. if (isset($this->viewProperties['filter_excludelowpop_value']) - && $this->viewProperties['filter_excludelowpop_value'] instanceof Closure + && $this->viewProperties['filter_excludelowpop_value'] instanceof \Closure ) { $function = $this->viewProperties['filter_excludelowpop_value']; $this->viewProperties['filter_excludelowpop_value'] = $function(); @@ -447,7 +447,7 @@ abstract class ViewDataTable * Returns the View_Interface. * You can then call render() on this object. * - * @return View\Interface + * @return View\ViewInterface * @throws \Exception if the view object was not created */ public function getView() @@ -664,7 +664,7 @@ abstract class ViewDataTable $filterName = $filter[0]; $filterParameters = $filter[1]; - if ($filterName instanceof Closure) { + if ($filterName instanceof \Closure) { $filterParameters[] = $this; } @@ -873,7 +873,7 @@ abstract class ViewDataTable foreach ($_GET as $name => $value) { try { $requestValue = Common::getRequestVar($name); - } catch (Exception $e) { + } catch (\Exception $e) { $requestValue = ''; } $javascriptVariablesToSet[$name] = $requestValue; diff --git a/core/ViewDataTable/Cloud.php b/core/ViewDataTable/Cloud.php index 56cef79b81..c798a00f3b 100644 --- a/core/ViewDataTable/Cloud.php +++ b/core/ViewDataTable/Cloud.php @@ -59,7 +59,7 @@ class Cloud extends ViewDataTable try { $this->loadDataTableFromAPI(); } catch (Exception $e) { - Piwik::log("Failed to get data from API: " . $e->getMessage()); + Piwik\Piwik::log("Failed to get data from API: " . $e->getMessage()); $this->loadingError = array('message' => $e->getMessage()); } diff --git a/core/ViewDataTable/GenerateGraphHTML.php b/core/ViewDataTable/GenerateGraphHTML.php index 680584f92f..d4d4a31800 100644 --- a/core/ViewDataTable/GenerateGraphHTML.php +++ b/core/ViewDataTable/GenerateGraphHTML.php @@ -216,6 +216,7 @@ abstract class GenerateGraphHTML extends ViewDataTable /** * @see ViewDataTable::main() + * @throws \Exception|\Piwik\NoAccessException * @return null */ public function main() diff --git a/core/Visualization/HtmlTable.php b/core/Visualization/HtmlTable.php index 2992f09495..a320011993 100644 --- a/core/Visualization/HtmlTable.php +++ b/core/Visualization/HtmlTable.php @@ -24,6 +24,7 @@ class HtmlTable * * @param DataTable $dataTable * @param array $properties View Properties. + * @return string */ public function render(DataTable $dataTable, $properties) { diff --git a/core/testMinimumPhpVersion.php b/core/testMinimumPhpVersion.php index 845ba6002a..8917bfad47 100644 --- a/core/testMinimumPhpVersion.php +++ b/core/testMinimumPhpVersion.php @@ -73,7 +73,7 @@ if (!function_exists('Piwik_ExitWithMessage')) { * @param string $message Main message, must be html encoded before calling * @param bool|string $optionalTrace Backtrace; will be displayed in lighter color * @param bool $optionalLinks If true, will show links to the Piwik website for help - * @param bool $goBack if true, displays a link to go back + * @param bool $optionalLinkBack If true, displays a link to go back */ function Piwik_ExitWithMessage($message, $optionalTrace = false, $optionalLinks = false, $optionalLinkBack = false) { |