diff --git a/plugins/API/API.php b/plugins/API/API.php index 4fb8ee1ec0e..e571d71ab06 100644 --- a/plugins/API/API.php +++ b/plugins/API/API.php @@ -156,7 +156,9 @@ public function getSegmentsMetadata($idSites = array(), $_hideImplementationData 'segment' => 'visitorType', 'acceptedValues' => 'new, returning, returningCustomer' . ". " . Piwik_Translate('General_VisitTypeExample', '"&segment=visitorType==returning,visitorType==returningCustomer"'), 'sqlSegment' => 'log_visit.visitor_returning', - 'sqlFilter' => function($type) { return $type == "new" ? 0 : ($type == "returning" ? 1 : 2); } + 'sqlFilter' => function ($type) { + return $type == "new" ? 0 : ($type == "returning" ? 1 : 2); + } ); $segments[] = array( 'type' => 'metric', diff --git a/plugins/API/RowEvolution.php b/plugins/API/RowEvolution.php index acd1254acca..67070f4f7a5 100644 --- a/plugins/API/RowEvolution.php +++ b/plugins/API/RowEvolution.php @@ -79,7 +79,7 @@ public function getRowEvolution($idSite, $period, $date, $apiModule, $apiAction, } /** - * @param array $labels + * @param array $labels * @param DataTable\Map $dataTable * @return mixed */ @@ -99,8 +99,8 @@ protected function enrichRowAddMetadataLabelIndex($labels, $dataTable) } /** - * @param DataTable\Map $dataTable - * @param array $labels + * @param DataTable\Map $dataTable + * @param array $labels * @return array */ protected function getLabelsFromDataTable($dataTable, $labels) @@ -186,10 +186,10 @@ private function getSingleRowEvolution($dataTable, $metadata, $apiModule, $apiAc } /** - * @param Row $row - * @param string $apiModule - * @param string $apiAction - * @param bool $labelUseAbsoluteUrl + * @param Row $row + * @param string $apiModule + * @param string $apiAction + * @param bool $labelUseAbsoluteUrl * @return bool|string */ private function getRowUrlForEvolutionLabel($row, $apiModule, $apiAction, $labelUseAbsoluteUrl) diff --git a/plugins/Actions/API.php b/plugins/Actions/API.php index 14cbfaeb749..e9c9d4c810b 100644 --- a/plugins/Actions/API.php +++ b/plugins/Actions/API.php @@ -15,11 +15,11 @@ use Piwik\Common; use Piwik\DataTable; use Piwik\Date; -use Piwik\Metrics; +use Piwik\Metrics; use Piwik\Piwik; -use Piwik\Plugins\CustomVariables\API as APICustomVariables; +use Piwik\Plugins\CustomVariables\API as APICustomVariables; use Piwik\Tracker\Action; /** @@ -119,11 +119,11 @@ public function get($idSite, $period, $date, $segment = false, $columns = false) } /** - * @param int $idSite - * @param string $period - * @param Date $date - * @param bool $segment - * @param bool $expanded + * @param int $idSite + * @param string $period + * @param Date $date + * @param bool $segment + * @param bool $expanded * @param bool|int $idSubtable * @param bool|int $depth * @@ -181,7 +181,9 @@ protected function keepPagesFollowingSearch($dataTable) // Keep only pages which are following site search $dataTable->filter('ColumnCallbackDeleteRow', array( 'nb_hits_following_search', - function($value) { return $value > 0; } + function ($value) { + return $value > 0; + } )); } @@ -321,7 +323,9 @@ public function getSiteSearchNoResultKeywords($idSite, $period, $date, $segment $dataTable->filter('ColumnCallbackDeleteRow', array( Metrics::INDEX_SITE_SEARCH_HAS_NO_RESULT, - function($value) { return $value >= 1; } + function ($value) { + return $value >= 1; + } )); $dataTable->deleteRow(DataTable::ID_SUMMARY_ROW); $dataTable->deleteColumn(Metrics::INDEX_SITE_SEARCH_HAS_NO_RESULT); diff --git a/plugins/Actions/Actions.php b/plugins/Actions/Actions.php index a33153df278..f97c1333a40 100644 --- a/plugins/Actions/Actions.php +++ b/plugins/Actions/Actions.php @@ -54,7 +54,7 @@ public function __construct() public function getListHooksRegistered() { $hooks = array( - 'ArchiveProcessor.Day.compute' => 'archiveDay', + 'ArchiveProcessor.Day.compute' => 'archiveDay', 'ArchiveProcessor.Period.compute' => 'archivePeriod', 'WidgetsList.addWidgets' => 'addWidgets', 'Menu.Reporting.addItems' => 'addMenus', @@ -76,7 +76,7 @@ public function getJsFiles(&$jsFiles) { $jsFiles[] = "plugins/Actions/javascripts/actionsDataTable.js"; } - + public function getSegmentsMetadata(&$segments) { $sqlFilter = array($this, 'getIdActionFromSegment'); @@ -673,7 +673,7 @@ private function addBaseDisplayProperties(&$result) if (ViewDataTable::shouldLoadExpanded()) { $result['visualization_properties']['table']['show_expanded'] = true; - + $result['filters'][] = function ($dataTable) { Actions::setDataTableRowLevels($dataTable); }; @@ -876,17 +876,17 @@ public function getDisplayPropertiesForSiteSearchNoResultKeywords() public function getDisplayPropertiesForSiteSearchCategories() { return array( - 'translations' => array( + 'translations' => array( 'label' => Piwik_Translate('Actions_ColumnSearchCategory'), 'nb_visits' => Piwik_Translate('Actions_ColumnSearches'), 'nb_pages_per_search' => Piwik_Translate('Actions_ColumnPagesPerSearch') ), - 'columns_to_display' => array('label', 'nb_visits', 'nb_pages_per_search'), - 'show_table_all_columns' => false, - 'show_bar_chart' => false, + 'columns_to_display' => array('label', 'nb_visits', 'nb_pages_per_search'), + 'show_table_all_columns' => false, + 'show_bar_chart' => false, 'visualization_properties' => array( 'table' => array( - 'disable_row_evolution' => false, + 'disable_row_evolution' => false, ) ) ); diff --git a/plugins/Actions/ArchivingHelper.php b/plugins/Actions/ArchivingHelper.php index 8c08171f31f..fae4380d683 100644 --- a/plugins/Actions/ArchivingHelper.php +++ b/plugins/Actions/ArchivingHelper.php @@ -506,7 +506,7 @@ private static function createSummaryRow() { return new Row(array( Row::COLUMNS => - array('label' => DataTable::LABEL_SUMMARY_ROW) + self::getDefaultRowColumns() + array('label' => DataTable::LABEL_SUMMARY_ROW) + self::getDefaultRowColumns() )); } } diff --git a/plugins/Annotations/API.php b/plugins/Annotations/API.php index d574ebd76d9..6f4b603b79f 100755 --- a/plugins/Annotations/API.php +++ b/plugins/Annotations/API.php @@ -12,9 +12,9 @@ use Exception; use Piwik\Date; + use Piwik\Period; use Piwik\Period\Range; - use Piwik\Piwik; use Piwik\Plugins\CoreVisualizations\Visualizations\JqplotGraph\Evolution as EvolutionViz; use Piwik\ViewDataTable; @@ -308,7 +308,7 @@ private static function checkUserCanAddNotesFor($idSite) * @param string|bool $date The start date of the period (or the date range of a range * period). * @param string $period The period type ('day', 'week', 'month', 'year' or 'range'). - * @param bool|int $lastN Whether to include the last N periods in the range or not. + * @param bool|int $lastN Whether to include the last N periods in the range or not. * Ignored if period == range. * * @return Date[] array of Date objects or array(false, false) diff --git a/plugins/Annotations/AnnotationList.php b/plugins/Annotations/AnnotationList.php index 93b38f0b6b6..9f114608e68 100755 --- a/plugins/Annotations/AnnotationList.php +++ b/plugins/Annotations/AnnotationList.php @@ -421,7 +421,7 @@ public function compareAnnotationDate($lhs, $rhs) public static function canUserAddNotesFor($idSite) { return Piwik::isUserHasViewAccess($idSite) - && !Piwik::isUserIsAnonymous($idSite); + && !Piwik::isUserIsAnonymous($idSite); } /** diff --git a/plugins/Annotations/Controller.php b/plugins/Annotations/Controller.php index e31c0b7044b..2cfe7d04bab 100755 --- a/plugins/Annotations/Controller.php +++ b/plugins/Annotations/Controller.php @@ -11,7 +11,6 @@ namespace Piwik\Plugins\Annotations; use Piwik\API\Request; - use Piwik\Common; use Piwik\View; diff --git a/plugins/AnonymizeIP/AnonymizeIP.php b/plugins/AnonymizeIP/AnonymizeIP.php index 1339b76e49d..6996119091d 100644 --- a/plugins/AnonymizeIP/AnonymizeIP.php +++ b/plugins/AnonymizeIP/AnonymizeIP.php @@ -55,7 +55,7 @@ public function getListHooksRegistered() public static function applyIPMask($ip, $maskLength) { // IPv4 or mapped IPv4 in IPv6 - if(IP::isIPv4($ip)) { + if (IP::isIPv4($ip)) { $i = Common::strlen($ip); if ($maskLength > $i) { $maskLength = $i; diff --git a/plugins/CoreAdminHome/Controller.php b/plugins/CoreAdminHome/Controller.php index 7479da39f4a..77ed3e8f95d 100644 --- a/plugins/CoreAdminHome/Controller.php +++ b/plugins/CoreAdminHome/Controller.php @@ -72,8 +72,7 @@ public function generalSettings() $directoryWritable = is_writable(PIWIK_DOCUMENT_ROOT . '/misc/user/'); $logoFilesWriteable = is_writeable(PIWIK_DOCUMENT_ROOT . '/misc/user/logo.png') && is_writeable(PIWIK_DOCUMENT_ROOT . '/misc/user/logo.svg') - && is_writeable(PIWIK_DOCUMENT_ROOT . '/misc/user/logo-header.png'); - ; + && is_writeable(PIWIK_DOCUMENT_ROOT . '/misc/user/logo-header.png');; $view->logosWriteable = ($logoFilesWriteable || $directoryWritable) && ini_get('file_uploads') == 1; $trustedHosts = array(); diff --git a/plugins/CoreConsole/GenerateApi.php b/plugins/CoreConsole/GenerateApi.php index 1760c6ca3e0..f9d68db4211 100644 --- a/plugins/CoreConsole/GenerateApi.php +++ b/plugins/CoreConsole/GenerateApi.php @@ -23,8 +23,8 @@ class GenerateApi extends GeneratePluginBase protected function configure() { $this->setName('generate:api') - ->setDescription('Adds an API to an existing plugin') - ->addOption('pluginname', null, InputOption::VALUE_REQUIRED, 'The name of an existing plugin which does not have an API yet'); + ->setDescription('Adds an API to an existing plugin') + ->addOption('pluginname', null, InputOption::VALUE_REQUIRED, 'The name of an existing plugin which does not have an API yet'); } protected function execute(InputInterface $input, OutputInterface $output) @@ -34,10 +34,10 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->copyTemplateToPlugin('api', $pluginName); $this->writeSuccessMessage($output, array( - sprintf('API.php for %s generated.', $pluginName), - 'You can now start adding API methods', - 'Enjoy!' - )); + sprintf('API.php for %s generated.', $pluginName), + 'You can now start adding API methods', + 'Enjoy!' + )); } /** @@ -61,7 +61,7 @@ private function getPluginName(InputInterface $input, OutputInterface $output) $pluginName = $input->getOption('pluginname'); if (empty($pluginName)) { - $dialog = $this->getHelperSet()->get('dialog'); + $dialog = $this->getHelperSet()->get('dialog'); $pluginName = $dialog->askAndValidate($output, 'Enter the name of your plugin: ', $validate, false, null, $pluginNames); } else { $validate($pluginName); diff --git a/plugins/CoreConsole/GenerateController.php b/plugins/CoreConsole/GenerateController.php index bedbbbd1749..f62a49d1956 100644 --- a/plugins/CoreConsole/GenerateController.php +++ b/plugins/CoreConsole/GenerateController.php @@ -23,8 +23,8 @@ class GenerateController extends GeneratePluginBase protected function configure() { $this->setName('generate:controller') - ->setDescription('Adds a Controller to an existing plugin') - ->addOption('pluginname', null, InputOption::VALUE_REQUIRED, 'The name of an existing plugin which does not have a Controller yet'); + ->setDescription('Adds a Controller to an existing plugin') + ->addOption('pluginname', null, InputOption::VALUE_REQUIRED, 'The name of an existing plugin which does not have a Controller yet'); } protected function execute(InputInterface $input, OutputInterface $output) @@ -34,10 +34,10 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->copyTemplateToPlugin('controller', $pluginName); $this->writeSuccessMessage($output, array( - sprintf('Controller for %s generated.', $pluginName), - 'You can now start adding Controller actions', - 'Enjoy!' - )); + sprintf('Controller for %s generated.', $pluginName), + 'You can now start adding Controller actions', + 'Enjoy!' + )); } /** @@ -61,7 +61,7 @@ private function getPluginName(InputInterface $input, OutputInterface $output) $pluginName = $input->getOption('pluginname'); if (empty($pluginName)) { - $dialog = $this->getHelperSet()->get('dialog'); + $dialog = $this->getHelperSet()->get('dialog'); $pluginName = $dialog->askAndValidate($output, 'Enter the name of your plugin: ', $validate, false, null, $pluginNames); } else { $validate($pluginName); diff --git a/plugins/CoreConsole/GeneratePlugin.php b/plugins/CoreConsole/GeneratePlugin.php index 1dbe50a2fcd..6ec8cfd995a 100644 --- a/plugins/CoreConsole/GeneratePlugin.php +++ b/plugins/CoreConsole/GeneratePlugin.php @@ -26,20 +26,20 @@ class GeneratePlugin extends GeneratePluginBase protected function configure() { $this->setName('generate:plugin') - ->setAliases(array('generate:theme')) - ->setDescription('Generates a new plugin/theme including all needed files') - ->addOption('name', null, InputOption::VALUE_REQUIRED, 'Plugin name ([a-Z0-9_-])') - ->addOption('description', null, InputOption::VALUE_REQUIRED, 'Plugin description, max 150 characters') - ->addOption('pluginversion', null, InputOption::VALUE_OPTIONAL, 'Plugin version') - ->addOption('full', null, InputOption::VALUE_OPTIONAL, 'If a value is set, an API and a Controller will be created as well. Option is only available for creating plugins, not for creating themes.'); + ->setAliases(array('generate:theme')) + ->setDescription('Generates a new plugin/theme including all needed files') + ->addOption('name', null, InputOption::VALUE_REQUIRED, 'Plugin name ([a-Z0-9_-])') + ->addOption('description', null, InputOption::VALUE_REQUIRED, 'Plugin description, max 150 characters') + ->addOption('pluginversion', null, InputOption::VALUE_OPTIONAL, 'Plugin version') + ->addOption('full', null, InputOption::VALUE_OPTIONAL, 'If a value is set, an API and a Controller will be created as well. Option is only available for creating plugins, not for creating themes.'); } protected function execute(InputInterface $input, OutputInterface $output) { - $isTheme = $this->isTheme($input); - $pluginName = $this->getPluginName($input, $output); + $isTheme = $this->isTheme($input); + $pluginName = $this->getPluginName($input, $output); $description = $this->getPluginDescription($input, $output); - $version = $this->getPluginVersion($input, $output); + $version = $this->getPluginVersion($input, $output); $createFullPlugin = !$isTheme && $this->getCreateFullPlugin($input, $output); $this->generatePluginFolder($pluginName); @@ -53,9 +53,9 @@ protected function execute(InputInterface $input, OutputInterface $output) } $this->writeSuccessMessage($output, array( - sprintf('%s %s %s generated.', $isTheme ? 'Theme' : 'Plugin', $pluginName, $version), - 'Enjoy!' - )); + sprintf('%s %s %s generated.', $isTheme ? 'Theme' : 'Plugin', $pluginName, $version), + 'Enjoy!' + )); if ($createFullPlugin) { $this->executePluginCommand($output, 'generate:api', $pluginName); @@ -65,7 +65,7 @@ protected function execute(InputInterface $input, OutputInterface $output) private function executePluginCommand(OutputInterface $output, $commandName, $pluginName) { - $command = $this->getApplication()->find($commandName); + $command = $this->getApplication()->find($commandName); $arguments = array( 'command' => $commandName, '--pluginname' => $pluginName @@ -153,7 +153,7 @@ private function getPluginName(InputInterface $input, OutputInterface $output) $pluginName = $input->getOption('name'); if (empty($pluginName)) { - $dialog = $this->getHelperSet()->get('dialog'); + $dialog = $this->getHelperSet()->get('dialog'); $pluginName = $dialog->askAndValidate($output, 'Enter a plugin name: ', $validate); } else { $validate($pluginName); @@ -186,7 +186,7 @@ private function getPluginDescription(InputInterface $input, OutputInterface $ou $description = $input->getOption('description'); if (empty($description)) { - $dialog = $this->getHelperSet()->get('dialog'); + $dialog = $this->getHelperSet()->get('dialog'); $description = $dialog->askAndValidate($output, 'Enter a plugin description: ', $validate); } else { $validate($description); @@ -205,7 +205,7 @@ protected function getPluginVersion(InputInterface $input, OutputInterface $outp $version = $input->getOption('pluginversion'); if (is_null($version)) { - $dialog = $this->getHelperSet()->get('dialog'); + $dialog = $this->getHelperSet()->get('dialog'); $version = $dialog->ask($output, 'Enter a plugin version number (default to 0.1.0): ', '0.1.0'); } @@ -223,7 +223,7 @@ protected function getCreateFullPlugin(InputInterface $input, OutputInterface $o if (is_null($full)) { $dialog = $this->getHelperSet()->get('dialog'); - $full = $dialog->askConfirmation($output, 'Shall we also create an API and a Controller? (y/N)', false); + $full = $dialog->askConfirmation($output, 'Shall we also create an API and a Controller? (y/N)', false); } return !empty($full); diff --git a/plugins/CoreConsole/GeneratePluginBase.php b/plugins/CoreConsole/GeneratePluginBase.php index 220e24030c9..9f0b86e2447 100644 --- a/plugins/CoreConsole/GeneratePluginBase.php +++ b/plugins/CoreConsole/GeneratePluginBase.php @@ -44,7 +44,7 @@ protected function createFileWithinPluginIfNotExists($pluginName, $fileName, $co } /** - * @param string $templateName eg. 'controller' or 'api' + * @param string $templateName eg. 'controller' or 'api' * @param string $pluginName */ protected function copyTemplateToPlugin($templateName, $pluginName) diff --git a/plugins/CoreConsole/RunTests.php b/plugins/CoreConsole/RunTests.php index 052af2ac9dd..4176ab1dcc9 100644 --- a/plugins/CoreConsole/RunTests.php +++ b/plugins/CoreConsole/RunTests.php @@ -33,11 +33,11 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output) { $options = $input->getOption('options'); - $group = $input->getArgument('group'); + $group = $input->getArgument('group'); if (!empty($group)) { - $groups = explode(',', $group); - $groups = array_map('ucfirst', $groups); + $groups = explode(',', $group); + $groups = array_map('ucfirst', $groups); $options = '--group ' . implode(',', $groups) . ' ' . $options; } diff --git a/plugins/CoreConsole/templates/controller/Controller.php b/plugins/CoreConsole/templates/controller/Controller.php index 05895dec11c..c27a7de9bbe 100644 --- a/plugins/CoreConsole/templates/controller/Controller.php +++ b/plugins/CoreConsole/templates/controller/Controller.php @@ -9,6 +9,7 @@ * @package PLUGINNAME */ namespace Piwik\Plugins\PLUGINNAME; + use Piwik\View; /** diff --git a/plugins/CoreHome/CoreHome.php b/plugins/CoreHome/CoreHome.php index 23e276791fa..e89f2e0eb7f 100644 --- a/plugins/CoreHome/CoreHome.php +++ b/plugins/CoreHome/CoreHome.php @@ -24,10 +24,10 @@ class CoreHome extends \Piwik\Plugin public function getListHooksRegistered() { return array( - 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', - 'AssetManager.getJavaScriptFiles' => 'getJsFiles', - 'WidgetsList.addWidgets' => 'addWidgets', - 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys' + 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', + 'AssetManager.getJavaScriptFiles' => 'getJsFiles', + 'WidgetsList.addWidgets' => 'addWidgets', + 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys' ); } diff --git a/plugins/CorePluginsAdmin/Controller.php b/plugins/CorePluginsAdmin/Controller.php index 7e32b924adb..5814ee25d50 100644 --- a/plugins/CorePluginsAdmin/Controller.php +++ b/plugins/CorePluginsAdmin/Controller.php @@ -25,13 +25,13 @@ */ class Controller extends \Piwik\Controller\Admin { - const UPDATE_NONCE = 'CorePluginsAdmin.updatePlugin'; - const INSTALL_NONCE = 'CorePluginsAdmin.installPlugin'; - const ACTIVATE_NONCE = 'CorePluginsAdmin.activatePlugin'; + const UPDATE_NONCE = 'CorePluginsAdmin.updatePlugin'; + const INSTALL_NONCE = 'CorePluginsAdmin.installPlugin'; + const ACTIVATE_NONCE = 'CorePluginsAdmin.activatePlugin'; const DEACTIVATE_NONCE = 'CorePluginsAdmin.deactivatePlugin'; - const UNINSTALL_NONCE = 'CorePluginsAdmin.uninstallPlugin'; + const UNINSTALL_NONCE = 'CorePluginsAdmin.uninstallPlugin'; - private $validSortMethods = array('popular', 'newest', 'alpha'); + private $validSortMethods = array('popular', 'newest', 'alpha'); private $defaultSortMethod = 'popular'; private function createUpdateOrInstallView($template, $nonceName) @@ -51,7 +51,7 @@ private function createUpdateOrInstallView($template, $nonceName) return $view; } - $marketplace = new Marketplace(); + $marketplace = new Marketplace(); $view->plugin = $marketplace->getPluginInfo($pluginName); return $view; @@ -99,13 +99,13 @@ public function uploadPlugin() $view = $this->configureView('@CorePluginsAdmin/uploadPlugin'); $pluginInstaller = new PluginInstaller('uploaded'); - $pluginMetadata = $pluginInstaller->installOrUpdatePluginFromFile($file); + $pluginMetadata = $pluginInstaller->installOrUpdatePluginFromFile($file); - $view->nonce = Nonce::getNonce(static::ACTIVATE_NONCE); + $view->nonce = Nonce::getNonce(static::ACTIVATE_NONCE); $view->plugin = array( - 'name' => $pluginMetadata->name, - 'version' => $pluginMetadata->version, - 'isTheme' => !empty($pluginMetadata->theme), + 'name' => $pluginMetadata->name, + 'version' => $pluginMetadata->version, + 'isTheme' => !empty($pluginMetadata->theme), 'isActivated' => PluginsManager::getInstance()->isPluginActivated($pluginMetadata->name) ); @@ -119,7 +119,7 @@ public function pluginDetails() $view = $this->configureView('@CorePluginsAdmin/pluginDetails'); try { - $marketplace = new Marketplace(); + $marketplace = new Marketplace(); $view->plugin = $marketplace->getPluginInfo($pluginName); } catch (\Exception $e) { $view->errorMessage = $e->getMessage(); @@ -131,7 +131,7 @@ public function pluginDetails() private function createBrowsePluginsOrThemesView($template, $themesOnly) { $query = Common::getRequestVar('query', '', 'string', $_POST); - $sort = Common::getRequestVar('sort', $this->defaultSortMethod, 'string'); + $sort = Common::getRequestVar('sort', $this->defaultSortMethod, 'string'); if (!in_array($sort, $this->validSortMethods)) { $sort = $this->defaultSortMethod; @@ -139,14 +139,14 @@ private function createBrowsePluginsOrThemesView($template, $themesOnly) $view = $this->configureView('@CorePluginsAdmin/' . $template); - $marketplace = new Marketplace(); + $marketplace = new Marketplace(); $view->plugins = $marketplace->searchPlugins($query, $sort, $themesOnly); - $view->query = $query; - $view->sort = $sort; + $view->query = $query; + $view->sort = $sort; $view->installNonce = Nonce::getNonce(static::INSTALL_NONCE); - $view->updateNonce = Nonce::getNonce(static::UPDATE_NONCE); - $view->isSuperUser = Piwik::isUserIsSuperUser(); + $view->updateNonce = Nonce::getNonce(static::UPDATE_NONCE); + $view->isSuperUser = Piwik::isUserIsSuperUser(); return $view; } @@ -167,7 +167,7 @@ function extend() { $view = $this->configureView('@CorePluginsAdmin/extend'); $view->installNonce = Nonce::getNonce(static::INSTALL_NONCE); - $view->isSuperUser = Piwik::isUserIsSuperUser(); + $view->isSuperUser = Piwik::isUserIsSuperUser(); echo $view->render(); } @@ -176,7 +176,7 @@ private function createPluginsOrThemesView($template, $themesOnly) { Piwik::checkUserIsSuperUser(); - $activated = Common::getRequestVar('activated', false, 'integer', $_GET); + $activated = Common::getRequestVar('activated', false, 'integer', $_GET); $pluginName = Common::getRequestVar('pluginName', '', 'string'); $view = $this->configureView('@CorePluginsAdmin/' . $template); @@ -186,11 +186,11 @@ private function createPluginsOrThemesView($template, $themesOnly) $view->activatedPluginName = $pluginName; } - $view->updateNonce = Nonce::getNonce(static::UPDATE_NONCE); - $view->activateNonce = Nonce::getNonce(static::ACTIVATE_NONCE); - $view->uninstallNonce = Nonce::getNonce(static::UNINSTALL_NONCE); + $view->updateNonce = Nonce::getNonce(static::UPDATE_NONCE); + $view->activateNonce = Nonce::getNonce(static::ACTIVATE_NONCE); + $view->uninstallNonce = Nonce::getNonce(static::UNINSTALL_NONCE); $view->deactivateNonce = Nonce::getNonce(static::DEACTIVATE_NONCE); - $view->pluginsInfo = $this->getPluginsInfo($themesOnly); + $view->pluginsInfo = $this->getPluginsInfo($themesOnly); $users = \Piwik\Plugins\UsersManager\API::getInstance()->getUsers(); $view->otherUsersCount = count($users) - 1; @@ -233,11 +233,11 @@ protected function getPluginsInfo($themesOnly = false) foreach ($plugins as $pluginName => &$plugin) { if (!isset($plugin['info'])) { - $description = '' - . Piwik_Translate('CorePluginsAdmin_PluginNotCompatibleWith', array($pluginName, self::getPiwikVersion())) - . '
' - . Piwik_Translate('CorePluginsAdmin_PluginAskDevToUpdate') - . '
'; + $description = '' + . Piwik_Translate('CorePluginsAdmin_PluginNotCompatibleWith', array($pluginName, self::getPiwikVersion())) + . '
' + . Piwik_Translate('CorePluginsAdmin_PluginAskDevToUpdate') + . '
'; $plugin['info'] = array( 'description' => $description, 'version' => Piwik_Translate('General_Unknown'), @@ -249,7 +249,7 @@ protected function getPluginsInfo($themesOnly = false) $pluginsFiltered = $this->keepPluginsOrThemes($themesOnly, $plugins); return $pluginsFiltered; } - + protected function keepPluginsOrThemes($themesOnly, $plugins) { $pluginsFiltered = array(); @@ -319,7 +319,7 @@ public function activate($redirectAfter = true) public function uninstall($redirectAfter = true) { - $pluginName = $this->initPluginModification(static::UNINSTALL_NONCE); + $pluginName = $this->initPluginModification(static::UNINSTALL_NONCE); $uninstalled = \Piwik\PluginsManager::getInstance()->uninstallPlugin($pluginName); diff --git a/plugins/CorePluginsAdmin/CorePluginsAdmin.php b/plugins/CorePluginsAdmin/CorePluginsAdmin.php index 3dc96467ac4..f5aa54aed29 100644 --- a/plugins/CorePluginsAdmin/CorePluginsAdmin.php +++ b/plugins/CorePluginsAdmin/CorePluginsAdmin.php @@ -26,10 +26,10 @@ class CorePluginsAdmin extends \Piwik\Plugin public function getListHooksRegistered() { return array( - 'Menu.Admin.addItems' => 'addMenu', - 'AssetManager.getJavaScriptFiles' => 'getJsFiles', - 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', - 'TaskScheduler.getScheduledTasks' => 'getScheduledTasks', + 'Menu.Admin.addItems' => 'addMenu', + 'AssetManager.getJavaScriptFiles' => 'getJsFiles', + 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', + 'TaskScheduler.getScheduledTasks' => 'getScheduledTasks', 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys' ); } @@ -56,12 +56,12 @@ public function getStylesheetFiles(&$stylesheets) function addMenu() { $pluginsUpdateMessage = ''; - $themesUpdateMessage = ''; + $themesUpdateMessage = ''; if (Piwik::isUserIsSuperUser()) { $marketplace = new Marketplace(); $pluginsHavingUpdate = $marketplace->getPluginsHavingUpdate($themesOnly = false); - $themesHavingUpdate = $marketplace->getPluginsHavingUpdate($themesOnly = true); + $themesHavingUpdate = $marketplace->getPluginsHavingUpdate($themesOnly = true); if (!empty($pluginsHavingUpdate)) { $pluginsUpdateMessage = sprintf(' (%d)', count($pluginsHavingUpdate)); diff --git a/plugins/CorePluginsAdmin/Marketplace.php b/plugins/CorePluginsAdmin/Marketplace.php index 7540a3df195..efdb890fd37 100644 --- a/plugins/CorePluginsAdmin/Marketplace.php +++ b/plugins/CorePluginsAdmin/Marketplace.php @@ -48,8 +48,8 @@ public function searchPlugins($query, $sort, $themesOnly) foreach ($plugins as &$plugin) { $plugin['canBeUpdated'] = $this->hasPluginUpdate($plugin); - $plugin['isInstalled'] = PluginsManager::getInstance()->isPluginLoaded($plugin['name']); - $plugin['lastUpdated'] = Date::factory($plugin['lastUpdated'])->getLocalized($dateFormat); + $plugin['isInstalled'] = PluginsManager::getInstance()->isPluginLoaded($plugin['name']); + $plugin['lastUpdated'] = Date::factory($plugin['lastUpdated'])->getLocalized($dateFormat); } return $plugins; @@ -93,10 +93,11 @@ public function getPluginsHavingUpdate($themesOnly) foreach ($loadedPlugins as $loadedPlugin) { if (!empty($updatePlugin['name']) - && $loadedPlugin->getPluginName() == $updatePlugin['name']) { + && $loadedPlugin->getPluginName() == $updatePlugin['name'] + ) { $updatePlugin['currentVersion'] = $loadedPlugin->getVersion(); - $updatePlugin['isActivated'] = $pluginManager->isPluginActivated($updatePlugin['name']); + $updatePlugin['isActivated'] = $pluginManager->isPluginActivated($updatePlugin['name']); break; } } diff --git a/plugins/CorePluginsAdmin/MarketplaceApiClient.php b/plugins/CorePluginsAdmin/MarketplaceApiClient.php index 76499675f68..a8049b681d5 100644 --- a/plugins/CorePluginsAdmin/MarketplaceApiClient.php +++ b/plugins/CorePluginsAdmin/MarketplaceApiClient.php @@ -9,8 +9,8 @@ * @package CorePluginsAdmin */ namespace Piwik\Plugins\CorePluginsAdmin; -use Piwik\CacheFile; +use Piwik\CacheFile; use Piwik\Http; use Piwik\PluginsManager; use Piwik\Version; @@ -71,7 +71,7 @@ public function checkUpdates($plugins) $params = array(); foreach ($plugins as $plugin) { - $pluginName = $plugin->getPluginName(); + $pluginName = $plugin->getPluginName(); if (!PluginsManager::getInstance()->isPluginBundledWithCore($pluginName)) { $params[] = array('name' => $plugin->getPluginName(), 'version' => $plugin->getVersion()); } @@ -90,7 +90,7 @@ public function checkUpdates($plugins) /** * @param \Piwik\Plugin[] $plugins - * @param bool $themesOnly + * @param bool $themesOnly * @return array */ public function getInfoOfPluginsHavingUpdate($plugins, $themesOnly) @@ -135,18 +135,18 @@ public function searchForThemes($keywords, $query, $sort) private function fetch($action, $params) { ksort($params); - $query = http_build_query($params); + $query = http_build_query($params); $result = $this->getCachedResult($action, $query); if (false === $result) { $endpoint = $this->domain . '/api/1.0/'; - $url = sprintf('%s%s?%s', $endpoint, $action, $query); + $url = sprintf('%s%s?%s', $endpoint, $action, $query); $response = Http::sendHttpRequest($url, static::HTTP_REQUEST_TIMEOUT); - $result = json_decode($response, true); + $result = json_decode($response, true); if (is_null($result)) { $message = sprintf('There was an error reading the response from the Marketplace: %s. Please try again later.', - substr($response, 0, 50)); + substr($response, 0, 50)); throw new MarketplaceApiException($message); } @@ -193,7 +193,7 @@ public function getDownloadUrl($pluginOrThemeName) } $latestVersion = array_pop($plugin['versions']); - $downloadUrl = $latestVersion['download']; + $downloadUrl = $latestVersion['download']; return $this->domain . $downloadUrl . '?coreVersion=' . Version::VERSION; } diff --git a/plugins/CorePluginsAdmin/PluginInstaller.php b/plugins/CorePluginsAdmin/PluginInstaller.php index 10d7b454bda..b517b91b739 100644 --- a/plugins/CorePluginsAdmin/PluginInstaller.php +++ b/plugins/CorePluginsAdmin/PluginInstaller.php @@ -9,8 +9,8 @@ * @package CorePluginsAdmin */ namespace Piwik\Plugins\CorePluginsAdmin; -use Piwik\Filechecks; +use Piwik\Filechecks; use Piwik\Filesystem; use Piwik\SettingsPiwik; use Piwik\Unzip; @@ -22,7 +22,7 @@ class PluginInstaller { const PATH_TO_DOWNLOAD = '/tmp/latest/plugins/'; - const PATH_TO_EXTRACT = '/plugins/'; + const PATH_TO_EXTRACT = '/plugins/'; private $pluginName; @@ -33,7 +33,7 @@ public function __construct($pluginName) public function installOrUpdatePluginFromMarketplace() { - $tmpPluginZip = PIWIK_USER_PATH . self::PATH_TO_DOWNLOAD . $this->pluginName . '.zip'; + $tmpPluginZip = PIWIK_USER_PATH . self::PATH_TO_DOWNLOAD . $this->pluginName . '.zip'; $tmpPluginFolder = PIWIK_USER_PATH . self::PATH_TO_DOWNLOAD . $this->pluginName; $tmpPluginZip = SettingsPiwik::rewriteTmpPathWithHostname($tmpPluginZip); @@ -87,7 +87,7 @@ private function downloadPluginFromMarketplace($pluginZipTargetFile) } catch (\Exception $e) { try { - $downloadUrl = $marketplace->getDownloadUrl($this->pluginName); + $downloadUrl = $marketplace->getDownloadUrl($this->pluginName); $errorMessage = sprintf('Failed to download plugin from %s: %s', $downloadUrl, $e->getMessage()); } catch (\Exception $ex) { @@ -144,7 +144,7 @@ private function getPluginMetadataIfValid($tmpPluginFolder) if (!preg_match('/^[a-zA-Z0-9_-]+$/', $metadata->name)) { throw new PluginInstallerException('The plugin name specified in plugin.json contains illegal characters. ' . - 'Plugin name can only contain following characters: [a-zA-Z0-9-_].'); + 'Plugin name can only contain following characters: [a-zA-Z0-9-_].'); } if (empty($metadata->version)) { @@ -201,7 +201,7 @@ private function fixPluginFolderIfNeeded($tmpPluginFolder) } $from = $tmpPluginFolder . DIRECTORY_SEPARATOR . $firstSubFolder; - $to = $tmpPluginFolder . DIRECTORY_SEPARATOR . $this->pluginName; + $to = $tmpPluginFolder . DIRECTORY_SEPARATOR . $this->pluginName; rename($from, $to); } @@ -238,7 +238,7 @@ private function removeFileIfExists($targetTmpFile) private function makeSurePluginNameIsValid() { try { - $marketplace = new MarketplaceApiClient(); + $marketplace = new MarketplaceApiClient(); $pluginDetails = $marketplace->getPluginInfo($this->pluginName); } catch (\Exception $e) { throw new PluginInstallerException($e->getMessage()); diff --git a/plugins/CoreVisualizations/CoreVisualizations.php b/plugins/CoreVisualizations/CoreVisualizations.php index bc175aa36bc..06db725f513 100644 --- a/plugins/CoreVisualizations/CoreVisualizations.php +++ b/plugins/CoreVisualizations/CoreVisualizations.php @@ -28,10 +28,10 @@ class CoreVisualizations extends \Piwik\Plugin public function getListHooksRegistered() { return array( - 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', - 'AssetManager.getJavaScriptFiles' => 'getJsFiles', - 'Visualization.addVisualizations' => 'getAvailableDataTableVisualizations', - 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys' + 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', + 'AssetManager.getJavaScriptFiles' => 'getJsFiles', + 'Visualization.addVisualizations' => 'getAvailableDataTableVisualizations', + 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys' ); } diff --git a/plugins/CoreVisualizations/JqplotDataGenerator.php b/plugins/CoreVisualizations/JqplotDataGenerator.php index 73eba013674..7c1a638f9af 100644 --- a/plugins/CoreVisualizations/JqplotDataGenerator.php +++ b/plugins/CoreVisualizations/JqplotDataGenerator.php @@ -13,8 +13,8 @@ use Exception; use Piwik\Common; -use Piwik\DataTable; +use Piwik\DataTable; use Piwik\Metrics; use Piwik\Plugins\CoreVisualizations\JqplotDataGenerator\Chart; @@ -61,7 +61,7 @@ public static function factory($type, $properties) /** * Constructor. * - * @param array $properties + * @param array $properties * @param string $graphType * * @internal param \Piwik\ViewDataTable\Visualization\ $visualization diff --git a/plugins/CoreVisualizations/JqplotDataGenerator/Chart.php b/plugins/CoreVisualizations/JqplotDataGenerator/Chart.php index 9590c7ef047..902cbf7f5ec 100644 --- a/plugins/CoreVisualizations/JqplotDataGenerator/Chart.php +++ b/plugins/CoreVisualizations/JqplotDataGenerator/Chart.php @@ -63,7 +63,9 @@ public function setAxisYValues(&$values) 'internalLabel' => $label ); - array_walk($data, function(&$v) { $v = (float)$v; }); + array_walk($data, function (&$v) { + $v = (float)$v; + }); $this->data[] = & $data; } } @@ -110,11 +112,11 @@ public function render() // See http://www.jqplot.com/docs/files/jqPlotOptions-txt.html $data = array( - 'params' => array( + 'params' => array( 'axes' => &$this->axes, 'series' => &$this->series ), - 'data' => &$this->data + 'data' => &$this->data ); return $data; diff --git a/plugins/CoreVisualizations/JqplotDataGenerator/Evolution.php b/plugins/CoreVisualizations/JqplotDataGenerator/Evolution.php index 3b1eeccab8e..342bd1bdb02 100644 --- a/plugins/CoreVisualizations/JqplotDataGenerator/Evolution.php +++ b/plugins/CoreVisualizations/JqplotDataGenerator/Evolution.php @@ -47,9 +47,9 @@ protected function initChartObjectData($dataTable, $visualization) // if rows to display are not specified, default to all rows (TODO: perhaps this should be done elsewhere?) $rowsToDisplay = $this->properties['visualization_properties']->rows_to_display - ?: array_unique($dataTable->getColumn('label')) - ?: array(false) // make sure that a series is plotted even if there is no data - ; + ? : array_unique($dataTable->getColumn('label')) + ? : array(false) // make sure that a series is plotted even if there is no data + ; // collect series data to show. each row-to-display/column-to-display permutation creates a series. $allSeriesData = array(); @@ -93,9 +93,9 @@ protected function initChartObjectData($dataTable, $visualization) } $link = 'index.php?' . Url::getQueryStringFromParameters(array( - 'module' => 'CoreHome', - 'action' => 'index', - ) + $parameters) + 'module' => 'CoreHome', + 'action' => 'index', + ) + $parameters) . $hash; $axisXOnClick[] = $link; } @@ -118,7 +118,7 @@ private function getSeriesData($rowLabel, $columnName, DataTable\Map $dataTable) if ($row === false) { $seriesData[] = 0; } else { - $seriesData[] = $row->getColumn($columnName) ?: 0; + $seriesData[] = $row->getColumn($columnName) ? : 0; } } return $seriesData; diff --git a/plugins/CoreVisualizations/Visualizations/Cloud.php b/plugins/CoreVisualizations/Visualizations/Cloud.php index 36b98c3816f..13ea33feac8 100644 --- a/plugins/CoreVisualizations/Visualizations/Cloud.php +++ b/plugins/CoreVisualizations/Visualizations/Cloud.php @@ -27,11 +27,11 @@ class Cloud extends Visualization { const ID = 'cloud'; - + /** * Whether to display the logo assocatied with a DataTable row (stored as 'logo' row metadata) * instead of the label in Tag Clouds. - * + * * Default value: false */ const DISPLAY_LOGO_INSTEAD_OF_LABEL = 'display_logo_instead_of_label'; @@ -53,7 +53,7 @@ public function __construct($view) if ($dataTable->getRowsCount() == 0) { return; } - + $columnToDisplay = isset($view->columns_to_display[1]) ? $view->columns_to_display[1] : 'nb_visits'; $labelMetadata = array(); @@ -85,10 +85,10 @@ public function __construct($view) public static function getDefaultPropertyValues() { return array( - 'show_offset_information' => false, + 'show_offset_information' => false, 'show_exclude_low_population' => false, - 'show_limit_control' => false, - 'visualization_properties' => array( + 'show_limit_control' => false, + 'visualization_properties' => array( 'cloud' => array( 'display_logo_instead_of_label' => false, ) diff --git a/plugins/CoreVisualizations/Visualizations/HtmlTable.php b/plugins/CoreVisualizations/Visualizations/HtmlTable.php index a15274e40f0..223c1fb9d45 100644 --- a/plugins/CoreVisualizations/Visualizations/HtmlTable.php +++ b/plugins/CoreVisualizations/Visualizations/HtmlTable.php @@ -34,7 +34,7 @@ class HtmlTable extends Visualization /** * If this property is set to true, subtables will be shown as embedded in the original table. * If false, subtables will be shown as whole tables between rows. - * + * * Default value: false */ const SHOW_EMBEDDED_SUBTABLE = 'show_embedded_subtable'; @@ -42,7 +42,7 @@ class HtmlTable extends Visualization /** * Controls whether the entire DataTable should be rendered (including subtables) or just one * specific table in the tree. - * + * * Default value: false */ const SHOW_EXPANDED = 'show_expanded'; @@ -50,7 +50,7 @@ class HtmlTable extends Visualization /** * When showing an expanded datatable, this property controls whether rows with subtables are * replaced with their subtables, or if they are shown alongside their subtables. - * + * * Default value: false */ const REPLACE_ROW_WITH_SUBTABLE = 'replace_row_with_subtable'; @@ -59,7 +59,7 @@ class HtmlTable extends Visualization * Controls whether any DataTable Row Action icons are shown. If true, no icons are shown. * * @see also self::DISABLE_ROW_EVOLUTION - * + * * Default value: false */ const DISABLE_ROW_ACTIONS = 'disable_row_actions'; @@ -68,7 +68,7 @@ class HtmlTable extends Visualization * Controls whether the row evolution DataTable Row Action icon is shown or not. * * @see also self::DISABLE_ROW_ACTIONS - * + * * Default value: false */ const DISABLE_ROW_EVOLUTION = 'disable_row_evolution'; @@ -77,7 +77,7 @@ class HtmlTable extends Visualization * If true, the 'label', 'nb_visits', 'nb_uniq_visitors' (if present), 'nb_actions', * 'nb_actions_per_visit', 'avg_time_on_site', 'bounce_rate' and 'conversion_rate' (if * goals view is not allowed) are displayed. - * + * * Default value: false */ const SHOW_EXTRA_COLUMNS = 'show_extra_columns'; @@ -85,7 +85,7 @@ class HtmlTable extends Visualization /** * If true, conversions for each existing goal will be displayed for the visits in * each row. - * + * * Default value: false */ const SHOW_GOALS_COLUMNS = 'show_goals_columns'; @@ -95,7 +95,7 @@ class HtmlTable extends Visualization * 'show_goals_columns' property is also true. * * @see also self::SHOW_GOALS_COLUMNS - * + * * Default value: false */ const DISABLE_SUBTABLE_IN_GOALS_VIEW = 'disable_subtable_when_show_goals'; @@ -104,16 +104,16 @@ class HtmlTable extends Visualization * Controls whether the summary row is displayed on every page of the datatable view or not. * If false, the summary row will be treated as the last row of the dataset and will only visible * when viewing the last rows. - * + * * Default value: false */ const KEEP_SUMMARY_ROW = 'keep_summary_row'; /** * If true, the summary row will be colored differently than all other DataTable rows. - * + * * @see also self::KEEP_SUMMARY_ROW - * + * * Default value: false */ const HIGHLIGHT_SUMMARY_ROW = 'highlight_summary_row'; @@ -172,20 +172,20 @@ public function __construct($view) public static function getDefaultPropertyValues() { $defaults = array( - 'enable_sort' => true, - 'datatable_js_type' => 'DataTable', - 'filter_limit' => Config::getInstance()->General['datatable_default_limit'], + 'enable_sort' => true, + 'datatable_js_type' => 'DataTable', + 'filter_limit' => Config::getInstance()->General['datatable_default_limit'], 'visualization_properties' => array( 'table' => array( - 'disable_row_evolution' => false, - 'disable_row_actions' => false, - 'show_extra_columns' => false, - 'show_goals_columns' => false, + 'disable_row_evolution' => false, + 'disable_row_actions' => false, + 'show_extra_columns' => false, + 'show_goals_columns' => false, 'disable_subtable_when_show_goals' => false, - 'keep_summary_row' => false, - 'highlight_summary_row' => false, - 'show_expanded' => false, - 'show_embedded_subtable' => false + 'keep_summary_row' => false, + 'highlight_summary_row' => false, + 'show_expanded' => false, + 'show_embedded_subtable' => false ), ), ); @@ -236,10 +236,10 @@ private function setShowGoalsColumnsProperties($view) $view->show_exclude_low_population = true; $view->show_goals = true; $view->translations += array( - 'nb_conversions' => Piwik_Translate('Goals_ColumnConversions'), - 'conversion_rate' => Piwik_Translate('General_ColumnConversionRate'), - 'revenue' => Piwik_Translate('General_ColumnRevenue'), - 'revenue_per_visit' => Piwik_Translate('General_ColumnValuePerVisit'), + 'nb_conversions' => Piwik_Translate('Goals_ColumnConversions'), + 'conversion_rate' => Piwik_Translate('General_ColumnConversionRate'), + 'revenue' => Piwik_Translate('General_ColumnRevenue'), + 'revenue_per_visit' => Piwik_Translate('General_ColumnValuePerVisit'), ); $view->metrics_documentation['nb_visits'] = Piwik_Translate('Goals_ColumnVisits'); @@ -270,14 +270,16 @@ private function setShowGoalsColumnsProperties($view) 'AddColumnsProcessedMetricsGoal', array($ignore = true, $idGoal), $priority = true); // prettify columns - $setRatePercent = function ($rate, $thang = false) { return $rate == 0 ? "0%" : $rate; }; + $setRatePercent = function ($rate, $thang = false) { + return $rate == 0 ? "0%" : $rate; + }; foreach ($view->columns_to_display as $columnName) { if (strpos($columnName, 'conversion_rate') !== false) { $view->filters[] = array('ColumnCallbackReplace', array($columnName, $setRatePercent)); } } - $formatPercent = function ($value) use($idSite) { + $formatPercent = function ($value) use ($idSite) { return MetricsFormatter::getPrettyMoney(sprintf("%.1f", $value), $idSite); }; @@ -288,7 +290,9 @@ private function setShowGoalsColumnsProperties($view) } // this ensures that the value is set to zero for all rows where the value was not set (no conversion) - $identityFunction = function ($value) { return $value; }; + $identityFunction = function ($value) { + return $value; + }; foreach ($view->columns_to_display as $columnName) { if (!$this->isRevenueColumn($columnName)) { $view->filters[] = array('ColumnCallbackReplace', array($columnName, $identityFunction)); @@ -341,7 +345,7 @@ private function setPropertiesForGoalsOverview($view, $idSite) $view->columns_to_display[] = $column; $view->translations[$column] = Piwik_Translate('Goals_ConversionRate', $goal['name']); $view->metrics_documentation[$column] - = Piwik_Translate('Goals_ColumnConversionRateDocumentation', $goal['quoted_name'] ?: $goal['name']); + = Piwik_Translate('Goals_ColumnConversionRateDocumentation', $goal['quoted_name'] ? : $goal['name']); } $view->columns_to_display[] = 'revenue_per_visit'; @@ -382,23 +386,23 @@ private function setPropertiesForGoals($view, $idSite, $idGoals) // set translations & metric docs for goal specific metrics foreach ($idGoals as $idGoal) { $goalName = $allGoals[$idGoal]['name']; - $quotedGoalName = $allGoals[$idGoal]['quoted_name'] ?: $goalName; + $quotedGoalName = $allGoals[$idGoal]['quoted_name'] ? : $goalName; $view->translations += array( - 'goal_' . $idGoal . '_nb_conversions' => Piwik_Translate('Goals_Conversions', $goalName), - 'goal_' . $idGoal . '_conversion_rate' => Piwik_Translate('Goals_ConversionRate', $goalName), - 'goal_' . $idGoal . '_revenue' => - Piwik_Translate('%s ' . Piwik_Translate('General_ColumnRevenue'), $goalName), + 'goal_' . $idGoal . '_nb_conversions' => Piwik_Translate('Goals_Conversions', $goalName), + 'goal_' . $idGoal . '_conversion_rate' => Piwik_Translate('Goals_ConversionRate', $goalName), + 'goal_' . $idGoal . '_revenue' => + Piwik_Translate('%s ' . Piwik_Translate('General_ColumnRevenue'), $goalName), 'goal_' . $idGoal . '_revenue_per_visit' => - Piwik_Translate('%s ' . Piwik_Translate('General_ColumnValuePerVisit'), $goalName), + Piwik_Translate('%s ' . Piwik_Translate('General_ColumnValuePerVisit'), $goalName), ); $view->metrics_documentation += array( - 'goal_' . $idGoal . '_nb_conversions' => Piwik_Translate('Goals_ColumnConversionsDocumentation', $quotedGoalName), - 'goal_' . $idGoal . '_conversion_rate' => Piwik_Translate('Goals_ColumnConversionRateDocumentation', $quotedGoalName), - 'goal_' . $idGoal . '_revenue' => Piwik_Translate('Goals_ColumnRevenueDocumentation', $quotedGoalName), + 'goal_' . $idGoal . '_nb_conversions' => Piwik_Translate('Goals_ColumnConversionsDocumentation', $quotedGoalName), + 'goal_' . $idGoal . '_conversion_rate' => Piwik_Translate('Goals_ColumnConversionRateDocumentation', $quotedGoalName), + 'goal_' . $idGoal . '_revenue' => Piwik_Translate('Goals_ColumnRevenueDocumentation', $quotedGoalName), 'goal_' . $idGoal . '_revenue_per_visit' => - Piwik_Translate('Goals_ColumnRevenuePerVisitDocumentation', Piwik_Translate('Goals_EcommerceAndGoalsMenu')), + Piwik_Translate('Goals_ColumnRevenuePerVisitDocumentation', Piwik_Translate('Goals_EcommerceAndGoalsMenu')), ); } @@ -413,8 +417,8 @@ private function getGoals($idSite) // add the ecommerce goal if ecommerce is enabled for the site if (Site::isEcommerceEnabledFor($idSite)) { $ecommerceGoal = array( - 'idgoal' => Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER, - 'name' => Piwik_Translate('Goals_EcommerceOrder'), + 'idgoal' => Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER, + 'name' => Piwik_Translate('Goals_EcommerceOrder'), 'quoted_name' => false ); $allGoals[$ecommerceGoal['idgoal']] = $ecommerceGoal; diff --git a/plugins/CoreVisualizations/Visualizations/HtmlTable/AllColumns.php b/plugins/CoreVisualizations/Visualizations/HtmlTable/AllColumns.php index 20d31e82708..57e3dcef95b 100644 --- a/plugins/CoreVisualizations/Visualizations/HtmlTable/AllColumns.php +++ b/plugins/CoreVisualizations/Visualizations/HtmlTable/AllColumns.php @@ -22,7 +22,7 @@ class AllColumns extends HtmlTable /** * Constructor. - * + * * @param \Piwik\ViewDataTable $view */ public function __construct($view) diff --git a/plugins/CoreVisualizations/Visualizations/HtmlTable/Goals.php b/plugins/CoreVisualizations/Visualizations/HtmlTable/Goals.php index e6dd8abbc3e..138478fce0b 100644 --- a/plugins/CoreVisualizations/Visualizations/HtmlTable/Goals.php +++ b/plugins/CoreVisualizations/Visualizations/HtmlTable/Goals.php @@ -22,7 +22,7 @@ class Goals extends HtmlTable /** * Constructor. - * + * * @param \Piwik\ViewDataTable $view */ public function __construct($view) diff --git a/plugins/CoreVisualizations/Visualizations/JqplotGraph.php b/plugins/CoreVisualizations/Visualizations/JqplotGraph.php index 42a2fcf1f6f..e283920774d 100644 --- a/plugins/CoreVisualizations/Visualizations/JqplotGraph.php +++ b/plugins/CoreVisualizations/Visualizations/JqplotGraph.php @@ -27,25 +27,25 @@ class JqplotGraph extends Graph /** * The name of the JavaScript class to use as this graph's external series toggle. The class * must be a subclass of JQPlotExternalSeriesToggle. - * + * * @see self::EXTERNAL_SERIES_TOGGLE_SHOW_ALL - * + * * Default value: false */ const EXTERNAL_SERIES_TOGGLE = 'external_series_toggle'; /** * Whether the graph should show all loaded series upon initial display. - * + * * @see self::EXTERNAL_SERIES_TOGGLE - * + * * Default value: false */ const EXTERNAL_SERIES_TOGGLE_SHOW_ALL = 'external_series_toggle_show_all'; /** * The number of x-axis ticks for each x-axis label. - * + * * Default: 2 */ const X_AXIS_STEP_SIZE = 'x_axis_step_size'; @@ -59,13 +59,13 @@ class JqplotGraph extends Graph /** * Constructor. - * + * * @param \Piwik\ViewDataTable $view */ public function __construct($view) { parent::__construct($view, $template = "@CoreVisualizations/_dataTableViz_jqplotGraph.twig"); - + // do not sort if sorted column was initially "label" or eg. it would make "Visits by Server time" not pretty if ($view->filter_sort_column != 'label') { $columns = $view->columns_to_display; @@ -82,27 +82,27 @@ public function __construct($view) /** * Returns an array mapping property names with default values for this visualization. - * + * * @return array */ public static function getDefaultPropertyValues() { $result = parent::getDefaultPropertyValues(); return array_merge_recursive($result, array( - 'show_offset_information' => false, - 'show_pagination_control' => false, - 'show_exclude_low_population' => false, - 'show_search' => false, - 'show_export_as_image_icon' => true, - 'y_axis_unit' => '', - 'visualization_properties' => array( - 'jqplot_graph' => array( - 'external_series_toggle' => false, - 'external_series_toggle_show_all' => false, - 'x_axis_step_size' => 2 - ) - ) - )); + 'show_offset_information' => false, + 'show_pagination_control' => false, + 'show_exclude_low_population' => false, + 'show_search' => false, + 'show_export_as_image_icon' => true, + 'y_axis_unit' => '', + 'visualization_properties' => array( + 'jqplot_graph' => array( + 'external_series_toggle' => false, + 'external_series_toggle_show_all' => false, + 'x_axis_step_size' => 2 + ) + ) + )); } public function getGraphData($dataTable, $properties) diff --git a/plugins/CoreVisualizations/Visualizations/JqplotGraph/Evolution.php b/plugins/CoreVisualizations/Visualizations/JqplotGraph/Evolution.php index 75200251431..e125f6e7578 100644 --- a/plugins/CoreVisualizations/Visualizations/JqplotGraph/Evolution.php +++ b/plugins/CoreVisualizations/Visualizations/JqplotGraph/Evolution.php @@ -28,13 +28,13 @@ class Evolution extends JqplotGraph /** * Whether to show a line graph or a bar graph. - * + * * Default value: true */ const SHOW_LINE_GRAPH = 'show_line_graph'; public static $clientSideProperties = array('show_line_graph'); - + public static $overridableProperties = array('show_line_graph'); public function __construct($view) diff --git a/plugins/CoreVisualizations/Visualizations/JqplotGraph/Pie.php b/plugins/CoreVisualizations/Visualizations/JqplotGraph/Pie.php index b051439d3d7..e9bffcbe730 100644 --- a/plugins/CoreVisualizations/Visualizations/JqplotGraph/Pie.php +++ b/plugins/CoreVisualizations/Visualizations/JqplotGraph/Pie.php @@ -33,7 +33,7 @@ public function __construct($view) if ($metricColumn == 'label') { $metricColumn = next($view->columns_to_display); } - $view->columns_to_display = array($metricColumn ?: 'nb_visits'); + $view->columns_to_display = array($metricColumn ? : 'nb_visits'); }; } diff --git a/plugins/CustomVariables/API.php b/plugins/CustomVariables/API.php index 1420d438028..5bd918f14d2 100644 --- a/plugins/CustomVariables/API.php +++ b/plugins/CustomVariables/API.php @@ -112,10 +112,10 @@ public function getCustomVariablesValuesFromNameId($idSite, $period, $date, $idS // Hack Ecommerce product price tracking to display correctly $dataTable->renameColumn('price_viewed', 'price'); } - $dataTable->queueFilter('ColumnCallbackReplace', array('label', function($label) { - return $label == \Piwik\Plugins\CustomVariables\Archiver::LABEL_CUSTOM_VALUE_NOT_DEFINED - ? Piwik_Translate('General_NotDefined', Piwik_Translate('CustomVariables_ColumnCustomVariableValue')) - : $label; + $dataTable->queueFilter('ColumnCallbackReplace', array('label', function ($label) { + return $label == \Piwik\Plugins\CustomVariables\Archiver::LABEL_CUSTOM_VALUE_NOT_DEFINED + ? Piwik_Translate('General_NotDefined', Piwik_Translate('CustomVariables_ColumnCustomVariableValue')) + : $label; })); return $dataTable; } diff --git a/plugins/CustomVariables/Archiver.php b/plugins/CustomVariables/Archiver.php index 0c5cfea0a6b..dff481db66c 100644 --- a/plugins/CustomVariables/Archiver.php +++ b/plugins/CustomVariables/Archiver.php @@ -13,8 +13,8 @@ use Piwik\Common; use Piwik\Config; use Piwik\DataAccess\LogAggregator; -use Piwik\DataArray; +use Piwik\DataArray; use Piwik\Metrics; use Piwik\PluginsArchiver; use Piwik\Tracker; @@ -86,7 +86,7 @@ protected function aggregateCustomVariable($slot) protected function getSelectAveragePrice() { return LogAggregator::getSqlRevenue("AVG(log_link_visit_action.custom_var_v2)") - . " as `" . Metrics::INDEX_ECOMMERCE_ITEM_PRICE_VIEWED . "`"; + . " as `" . Metrics::INDEX_ECOMMERCE_ITEM_PRICE_VIEWED . "`"; } protected function aggregateFromVisits($query, $keyField, $valueField) diff --git a/plugins/DBStats/DBStats.php b/plugins/DBStats/DBStats.php index 34427e8e0e1..7a042565b65 100644 --- a/plugins/DBStats/DBStats.php +++ b/plugins/DBStats/DBStats.php @@ -11,8 +11,8 @@ namespace Piwik\Plugins\DBStats; use Piwik\Common; -use Piwik\Date; +use Piwik\Date; use Piwik\Piwik; use Piwik\ScheduledTask; use Piwik\ScheduledTime\Weekly; @@ -149,7 +149,7 @@ private function getDisplayPropertiesForGetMetricDataSummary() $result['title'] = Piwik_Translate('DBStats_MetricTables'); $result['related_reports'] = array( - 'DBStats.getMetricDataSummaryByYear' => Piwik_Translate('DBStats_MetricDataByYear') + 'DBStats.getMetricDataSummaryByYear' => Piwik_Translate('DBStats_MetricDataByYear') ); return $result; @@ -163,8 +163,8 @@ private function getDisplayPropertiesForGetMetricDataSummaryByYear() $result['translations']['label'] = Piwik_Translate('CoreHome_PeriodYear'); $result['title'] = Piwik_Translate('DBStats_MetricDataByYear'); - $result['related_reports'] = array( - 'DBStats.getMetricDataSummary' => Piwik_Translate('DBStats_MetricTables') + $result['related_reports'] = array( + 'DBStats.getMetricDataSummary' => Piwik_Translate('DBStats_MetricTables') ); return $result; @@ -193,7 +193,7 @@ private function getDisplayPropertiesForGetReportDataSummaryByYear() $result['translations']['label'] = Piwik_Translate('CoreHome_PeriodYear'); $result['title'] = Piwik_Translate('DBStats_ReportDataByYear'); $result['related_reports'] = array( - 'DBStats.getReportDataSummary' => Piwik_Translate('DBStats_ReportTables') + 'DBStats.getReportDataSummary' => Piwik_Translate('DBStats_ReportTables') ); return $result; diff --git a/plugins/DevicesDetection/DevicesDetection.php b/plugins/DevicesDetection/DevicesDetection.php index 9fe65c79515..a2f2c60de31 100644 --- a/plugins/DevicesDetection/DevicesDetection.php +++ b/plugins/DevicesDetection/DevicesDetection.php @@ -13,8 +13,8 @@ use Exception; use Piwik\ArchiveProcessor; -use Piwik\Common; +use Piwik\Common; use Piwik\Config; use Piwik\Db; use Piwik\WidgetsList; @@ -335,9 +335,9 @@ private function getDisplayPropertiesForGetOsFamilies() return array( 'show_search' => false, 'show_exclude_low_population' => false, - 'translations' => array('label' => Piwik_Translate("DevicesDetection_dataTableLabelSystemFamily")), - 'title' => Piwik_Translate('DevicesDetection_OperatingSystemFamilies'), - 'related_reports' => $this->getOsRelatedReports() + 'translations' => array('label' => Piwik_Translate("DevicesDetection_dataTableLabelSystemFamily")), + 'title' => Piwik_Translate('DevicesDetection_OperatingSystemFamilies'), + 'related_reports' => $this->getOsRelatedReports() ); } @@ -346,9 +346,9 @@ private function getDisplayPropertiesForGetOsVersions() return array( 'show_search' => false, 'show_exclude_low_population' => false, - 'translations' => array('label' => Piwik_Translate("DevicesDetection_dataTableLabelSystemVersion")), - 'title' => Piwik_Translate('DevicesDetection_OperatingSystemVersions'), - 'related_reports' => $this->getOsRelatedReports() + 'translations' => array('label' => Piwik_Translate("DevicesDetection_dataTableLabelSystemVersion")), + 'title' => Piwik_Translate('DevicesDetection_OperatingSystemVersions'), + 'related_reports' => $this->getOsRelatedReports() ); } @@ -357,9 +357,9 @@ private function getDisplayPropertiesForGetBrowserFamilies() return array( 'show_search' => false, 'show_exclude_low_population' => false, - 'translations' => array('label' => Piwik_Translate("DevicesDetection_dataTableLabelBrowserFamily")), - 'title' => Piwik_Translate('DevicesDetection_BrowsersFamily'), - 'related_reports' => $this->getBrowserRelatedReports() + 'translations' => array('label' => Piwik_Translate("DevicesDetection_dataTableLabelBrowserFamily")), + 'title' => Piwik_Translate('DevicesDetection_BrowsersFamily'), + 'related_reports' => $this->getBrowserRelatedReports() ); } @@ -368,8 +368,8 @@ private function getDisplayPropertiesForGetBrowserVersions() return array( 'show_search' => false, 'show_exclude_low_population' => false, - 'translations' => array('label' => Piwik_Translate("DevicesDetection_dataTableLabelBrowserVersion")), - 'related_reports' => $this->getBrowserRelatedReports() + 'translations' => array('label' => Piwik_Translate("DevicesDetection_dataTableLabelBrowserVersion")), + 'related_reports' => $this->getBrowserRelatedReports() ); } diff --git a/plugins/DevicesDetection/UserAgentParserEnhanced/UserAgentParserEnhanced.php b/plugins/DevicesDetection/UserAgentParserEnhanced/UserAgentParserEnhanced.php index a8ec8e22042..aea7f6bfc1b 100644 --- a/plugins/DevicesDetection/UserAgentParserEnhanced/UserAgentParserEnhanced.php +++ b/plugins/DevicesDetection/UserAgentParserEnhanced/UserAgentParserEnhanced.php @@ -10,11 +10,11 @@ * @package DevicesDetection */ //yml parser -require_once(PIWIK_INCLUDE_PATH.'/libs/spyc.php'); +require_once(PIWIK_INCLUDE_PATH . '/libs/spyc.php'); class UserAgentParserEnhanced { - public static $deviceTypes = array( 'desktop', 'smartphone', 'tablet', 'feature phone', 'console', 'tv', 'car browser' ); + public static $deviceTypes = array('desktop', 'smartphone', 'tablet', 'feature phone', 'console', 'tv', 'car browser'); public static $deviceBrands = array( 'AC' => 'Acer', @@ -124,118 +124,118 @@ class UserAgentParserEnhanced 'ZT' => 'ZTE', ); public static $osShorts = array( - 'AIX' => 'AIX', - 'Android' => 'AND', - 'Apple TV' => 'ATV', - 'Arch Linux' => 'ARL', - 'BackTrack' => 'BTR', - 'Bada' => 'SBA', - 'BlackBerry OS' => 'BLB', + 'AIX' => 'AIX', + 'Android' => 'AND', + 'Apple TV' => 'ATV', + 'Arch Linux' => 'ARL', + 'BackTrack' => 'BTR', + 'Bada' => 'SBA', + 'BlackBerry OS' => 'BLB', 'BlackBerry Tablet OS' => 'QNX', - 'Bot' => 'BOT', - 'Brew' => 'BMP', - 'CentOS' => 'CES', - 'Chrome OS' => 'COS', - 'Debian' => 'DEB', - 'DragonFly' => 'DFB', - 'Fedora' => 'FED', - 'Firefox OS' => 'FOS', - 'FreeBSD' => 'BSD', - 'Gentoo' => 'GNT', - 'Google TV' => 'GTV', - 'HP-UX' => 'HPX', - 'IRIX' => 'IRI', - 'Knoppix' => 'KNO', - 'Kubuntu' => 'KBT', - 'Linux' => 'LIN', - 'Lubuntu' => 'LBT', - 'Mac' => 'MAC', - 'Mandriva' => 'MDR', - 'MeeGo' => 'SMG', - 'Mint' => 'MIN', - 'NetBSD' => 'NBS', - 'Nintendo' => 'WII', - 'Nintendo Mobile' => 'NDS', - 'OS/2' => 'OS2', - 'OSF1' => 'T64', - 'OpenBSD' => 'OBS', - 'PlayStation' => 'PSP', - 'PlayStation 3' => 'PS3', - 'Presto' => 'PRS', - 'Puppy' => 'PPY', - 'Red Hat' => 'RHT', - 'SUSE' => 'SSE', - 'Slackware' => 'SLW', - 'Solaris' => 'SOS', - 'Syllable' => 'SYL', - 'Symbian' => 'SYM', - 'Symbian OS' => 'SYS', + 'Bot' => 'BOT', + 'Brew' => 'BMP', + 'CentOS' => 'CES', + 'Chrome OS' => 'COS', + 'Debian' => 'DEB', + 'DragonFly' => 'DFB', + 'Fedora' => 'FED', + 'Firefox OS' => 'FOS', + 'FreeBSD' => 'BSD', + 'Gentoo' => 'GNT', + 'Google TV' => 'GTV', + 'HP-UX' => 'HPX', + 'IRIX' => 'IRI', + 'Knoppix' => 'KNO', + 'Kubuntu' => 'KBT', + 'Linux' => 'LIN', + 'Lubuntu' => 'LBT', + 'Mac' => 'MAC', + 'Mandriva' => 'MDR', + 'MeeGo' => 'SMG', + 'Mint' => 'MIN', + 'NetBSD' => 'NBS', + 'Nintendo' => 'WII', + 'Nintendo Mobile' => 'NDS', + 'OS/2' => 'OS2', + 'OSF1' => 'T64', + 'OpenBSD' => 'OBS', + 'PlayStation' => 'PSP', + 'PlayStation 3' => 'PS3', + 'Presto' => 'PRS', + 'Puppy' => 'PPY', + 'Red Hat' => 'RHT', + 'SUSE' => 'SSE', + 'Slackware' => 'SLW', + 'Solaris' => 'SOS', + 'Syllable' => 'SYL', + 'Symbian' => 'SYM', + 'Symbian OS' => 'SYS', 'Symbian OS Series 40' => 'S40', 'Symbian OS Series 60' => 'S60', - 'Symbian^3' => 'SY3', - 'Talkatone' => 'TKT', - 'Tizen' => 'TIZ', - 'Ubuntu' => 'UBT', - 'WebTV' => 'WTV', - 'WinWAP' => 'WWP', - 'Windows' => 'WIN', - 'Windows 2000' => 'W2K', - 'Windows 3.1' => 'W31', - 'Windows 7' => 'WI7', - 'Windows 8' => 'WI8', - 'Windows 95' => 'W95', - 'Windows 98' => 'W98', - 'Windows CE' => 'WCE', - 'Windows ME' => 'WME', - 'Windows Mobile' => 'WMO', - 'Windows NT' => 'WNT', - 'Windows Phone' => 'WPH', - 'Windows RT' => 'WRT', - 'Windows Server 2003' => 'WS3', - 'Windows Vista' => 'WVI', - 'Windows XP' => 'WXP', - 'Xbox' => 'XBX', - 'Xubuntu' => 'XBT', - 'YunOs' => 'YNS', - 'iOS' => 'IOS', - 'palmOS' => 'POS', - 'webOS' => 'WOS' + 'Symbian^3' => 'SY3', + 'Talkatone' => 'TKT', + 'Tizen' => 'TIZ', + 'Ubuntu' => 'UBT', + 'WebTV' => 'WTV', + 'WinWAP' => 'WWP', + 'Windows' => 'WIN', + 'Windows 2000' => 'W2K', + 'Windows 3.1' => 'W31', + 'Windows 7' => 'WI7', + 'Windows 8' => 'WI8', + 'Windows 95' => 'W95', + 'Windows 98' => 'W98', + 'Windows CE' => 'WCE', + 'Windows ME' => 'WME', + 'Windows Mobile' => 'WMO', + 'Windows NT' => 'WNT', + 'Windows Phone' => 'WPH', + 'Windows RT' => 'WRT', + 'Windows Server 2003' => 'WS3', + 'Windows Vista' => 'WVI', + 'Windows XP' => 'WXP', + 'Xbox' => 'XBX', + 'Xubuntu' => 'XBT', + 'YunOs' => 'YNS', + 'iOS' => 'IOS', + 'palmOS' => 'POS', + 'webOS' => 'WOS' ); protected static $desktopOsArray = array('IBM', 'Linux', 'Mac', 'Unix', 'Windows'); public static $osFamilies = array( - 'Android' => array('AND'), - 'Apple TV' => array('ATV'), - 'BlackBerry' => array('BLB'), - 'Bot' => array('BOT'), - 'Brew' => array('BMP'), - 'Chrome OS' => array('COS'), - 'Firefox OS' => array('FOS'), - 'Gaming Console' => array('WII', 'PS3'), - 'Google TV' => array('GTV'), - 'IBM' => array('OS2'), - 'iOS' => array('IOS'), - 'Linux' => array('LIN', 'ARL', 'DEB', 'KNO', 'MIN', 'UBT', 'KBT', 'XBT', 'LBT', 'FED', 'RHT', 'MDR', 'GNT', 'SLW', 'SSE', 'PPY', 'CES', 'BTR', 'YNS', 'PRS'), - 'Mac' => array('MAC'), + 'Android' => array('AND'), + 'Apple TV' => array('ATV'), + 'BlackBerry' => array('BLB'), + 'Bot' => array('BOT'), + 'Brew' => array('BMP'), + 'Chrome OS' => array('COS'), + 'Firefox OS' => array('FOS'), + 'Gaming Console' => array('WII', 'PS3'), + 'Google TV' => array('GTV'), + 'IBM' => array('OS2'), + 'iOS' => array('IOS'), + 'Linux' => array('LIN', 'ARL', 'DEB', 'KNO', 'MIN', 'UBT', 'KBT', 'XBT', 'LBT', 'FED', 'RHT', 'MDR', 'GNT', 'SLW', 'SSE', 'PPY', 'CES', 'BTR', 'YNS', 'PRS'), + 'Mac' => array('MAC'), 'Mobile Gaming Console' => array('PSP', 'NDS', 'XBX'), - 'Other Mobile' => array('WOS', 'POS', 'QNX', 'SBA', 'TIZ'), - 'Simulator' => array('TKT', 'WWP'), - 'Symbian' => array('SYM', 'SYS', 'SY3', 'S60', 'S40', 'SMG'), - 'Unix' => array('SOS', 'AIX', 'HPX', 'BSD', 'NBS', 'OBS', 'DFB', 'SYL', 'IRI', 'T64'), - 'WebTV' => array('WTV'), - 'Windows' => array('WI8', 'WI7', 'WVI', 'WS3', 'WXP', 'W2K', 'WNT', 'WME', 'W98', 'W95', 'WRT', 'W31', 'WIN'), - 'Windows Mobile' => array('WPH', 'WMO', 'WCE') + 'Other Mobile' => array('WOS', 'POS', 'QNX', 'SBA', 'TIZ'), + 'Simulator' => array('TKT', 'WWP'), + 'Symbian' => array('SYM', 'SYS', 'SY3', 'S60', 'S40', 'SMG'), + 'Unix' => array('SOS', 'AIX', 'HPX', 'BSD', 'NBS', 'OBS', 'DFB', 'SYL', 'IRI', 'T64'), + 'WebTV' => array('WTV'), + 'Windows' => array('WI8', 'WI7', 'WVI', 'WS3', 'WXP', 'W2K', 'WNT', 'WME', 'W98', 'W95', 'WRT', 'W31', 'WIN'), + 'Windows Mobile' => array('WPH', 'WMO', 'WCE') ); public static $browserFamilies = array( - 'Android Browser' => array('AN'), + 'Android Browser' => array('AN'), 'BlackBerry Browser' => array('BB'), - 'Chrome' => array('CH', 'CM', 'CI', 'CF', 'CR', 'RM'), - 'Firefox' => array('FF', 'FE', 'SX', 'FB', 'PX', 'MB'), - 'Internet Explorer' => array('IE', 'IM'), - 'Konqueror' => array('KO'), - 'NetFront' => array('NF'), - 'Nokia Browser' => array('NB'), - 'Opera' => array('OP', 'OM', 'OI'), - 'Safari' => array('SF', 'MF') + 'Chrome' => array('CH', 'CM', 'CI', 'CF', 'CR', 'RM'), + 'Firefox' => array('FF', 'FE', 'SX', 'FB', 'PX', 'MB'), + 'Internet Explorer' => array('IE', 'IM'), + 'Konqueror' => array('KO'), + 'NetFront' => array('NF'), + 'Nokia Browser' => array('NB'), + 'Opera' => array('OP', 'OM', 'OI'), + 'Safari' => array('SF', 'MF') ); public static $browsers = array( 'AB' => 'ABrowse', @@ -384,9 +384,9 @@ protected function parseOs() } $this->os = array( - 'name' => $this->buildOsName($osRegex['name'], $matches), + 'name' => $this->buildOsName($osRegex['name'], $matches), 'short_name' => $short, - 'version' => $this->buildOsVersion($osRegex['version'], $matches) + 'version' => $this->buildOsVersion($osRegex['version'], $matches) ); if (array_key_exists($this->os['name'], self::$osShorts)) { @@ -412,9 +412,9 @@ protected function parseBrowser() } $this->browser = array( - 'name' => $this->buildBrowserName($browserRegex['name'], $matches), + 'name' => $this->buildBrowserName($browserRegex['name'], $matches), 'short_name' => $short, - 'version' => $this->buildBrowserVersion($browserRegex['version'], $matches) + 'version' => $this->buildBrowserVersion($browserRegex['version'], $matches) ); } @@ -439,7 +439,7 @@ protected function parseBrand($mobileRegexes) $this->fullName = $brand; if (isset($mobileRegex['device'])) { - $this->device = array_search($mobileRegex['device'],self::$deviceTypes); + $this->device = array_search($mobileRegex['device'], self::$deviceTypes); } if (isset($mobileRegex['model'])) { diff --git a/plugins/DevicesDetection/functions.php b/plugins/DevicesDetection/functions.php index 92a4b3e84ee..56be9c7a0ee 100644 --- a/plugins/DevicesDetection/functions.php +++ b/plugins/DevicesDetection/functions.php @@ -85,12 +85,12 @@ function getDeviceTypeLabel($label) function getDeviceTypeLogo($label) { $deviceTypeLogos = Array( - "Desktop" => "normal.gif", - "Smartphone" => "smartphone.png", - "Tablet" => "tablet.png", - "Tv" => "tv.png", + "Desktop" => "normal.gif", + "Smartphone" => "smartphone.png", + "Tablet" => "tablet.png", + "Tv" => "tv.png", "Feature phone" => "mobile.gif", - "Console" => "console.gif"); + "Console" => "console.gif"); if (!array_key_exists($label, $deviceTypeLogos) || $label == "Unknown") { $label = 'unknown.gif'; @@ -135,7 +135,7 @@ function getOsFullNameExtended($label) $os = substr($label, 0, 3); $ver = substr($label, 4, 15); $name = UserAgentParserEnhanced::getOsNameFromId($os, $ver); - if(!empty($name)) { + if (!empty($name)) { return $name; } } @@ -143,7 +143,6 @@ function getOsFullNameExtended($label) } - function getOsLogoExtended($label) { $short = substr($label, 0, 3); diff --git a/plugins/ExamplePlugin/config/local.config.php b/plugins/ExamplePlugin/config/local.config.php index cf846146e41..5dc4e74add6 100644 --- a/plugins/ExamplePlugin/config/local.config.php +++ b/plugins/ExamplePlugin/config/local.config.php @@ -1,10 +1,10 @@ 1, - 1 => 'mixed', - 2 => - array ( - 0 => 'a', - ), - 'b' => 'c', +return array( + 0 => 1, + 1 => 'mixed', + 2 => + array( + 0 => 'a', + ), + 'b' => 'c', ); diff --git a/plugins/ExampleUI/API.php b/plugins/ExampleUI/API.php index 3555a76776f..5827acac67d 100644 --- a/plugins/ExampleUI/API.php +++ b/plugins/ExampleUI/API.php @@ -53,7 +53,7 @@ public function getTemperaturesEvolution($date, $period) $server2 = mt_rand(40, 110); } - $value = array('server1' => $server1, 'server2' => $server2); + $value = array('server1' => $server1, 'server2' => $server2); $temperatures[$subPeriod->getLocalizedShortString()] = $value; } @@ -103,7 +103,7 @@ public function getPlanetRatiosWithLogos() foreach ($planetsDataTable->getRows() as $row) { $logo = sprintf('plugins/ExampleUI/images/icons-planet/%s.png', strtolower($row->getColumn('label'))); - $url = sprintf('http://en.wikipedia.org/wiki/%s', $row->getColumn('label')); + $url = sprintf('http://en.wikipedia.org/wiki/%s', $row->getColumn('label')); $row->addMetadata('logo', $logo); $row->addMetadata('url', $url); diff --git a/plugins/ExampleUI/Controller.php b/plugins/ExampleUI/Controller.php index d6cbdf316ab..0b607682bca 100644 --- a/plugins/ExampleUI/Controller.php +++ b/plugins/ExampleUI/Controller.php @@ -23,7 +23,7 @@ class Controller extends \Piwik\Controller public function dataTables() { $controllerAction = $this->pluginName . '.' . __FUNCTION__; - $apiAction = 'ExampleUI.getTemperatures'; + $apiAction = 'ExampleUI.getTemperatures'; /** * this is an example how you can make a custom visualization reusable. @@ -76,9 +76,9 @@ public function pieGraph() $view = ViewDataTable::factory( 'graphPie', 'ExampleUI.getPlanetRatios', $controllerAction = 'ExampleUI.pieGraph'); - $view->columns_to_display = array('value'); + $view->columns_to_display = array('value'); $view->translations['value'] = "times the diameter of Earth"; - $view->show_footer_icons = false; + $view->show_footer_icons = false; $view->visualization_properties->selectable_columns = array("value"); $view->visualization_properties->max_graph_elements = 10; @@ -103,9 +103,9 @@ public function echoSimpleTagClouds() $view = ViewDataTable::factory( 'cloud', 'ExampleUI.getPlanetRatios', $controllerAction = 'ExampleUI.echoSimpleTagClouds'); - $view->columns_to_display = array('label', 'value'); + $view->columns_to_display = array('label', 'value'); $view->translations['value'] = "times the diameter of Earth"; - $view->show_footer = false; + $view->show_footer = false; echo $view->render(); } @@ -120,7 +120,7 @@ public function echoAdvancedTagClouds() 'display_logo_instead_of_label', true ); - $view->columns_to_display = array('label', 'value'); + $view->columns_to_display = array('label', 'value'); $view->translations['value'] = "times the diameter of Earth"; echo $view->render(); diff --git a/plugins/ExampleUI/CustomDataTable.php b/plugins/ExampleUI/CustomDataTable.php index 1d921e6bcd2..bfda92a7042 100644 --- a/plugins/ExampleUI/CustomDataTable.php +++ b/plugins/ExampleUI/CustomDataTable.php @@ -22,12 +22,12 @@ public function render($value, $label, $apiAction, $controllerAction) $view->translations['value'] = $value; $view->translations['label'] = $label; - $view->filter_sort_column = 'label'; - $view->filter_sort_order = 'asc'; - $view->filter_limit = 24; - $view->y_axis_unit = '°C'; // useful if the user requests the bar graph + $view->filter_sort_column = 'label'; + $view->filter_sort_order = 'asc'; + $view->filter_limit = 24; + $view->y_axis_unit = '°C'; // useful if the user requests the bar graph $view->show_exclude_low_population = false; - $view->show_table_all_columns = false; + $view->show_table_all_columns = false; $view->visualization_properties->setForVisualization( 'Piwik\\Plugins\\CoreVisualizations\\Visualizations\\HtmlTable', 'disable_row_evolution', diff --git a/plugins/Goals/Goals.php b/plugins/Goals/Goals.php index 1cff5d83967..cdd67b6cea9 100644 --- a/plugins/Goals/Goals.php +++ b/plugins/Goals/Goals.php @@ -12,8 +12,8 @@ use Piwik\ArchiveProcessor; use Piwik\Common; -use Piwik\Db; +use Piwik\Db; use Piwik\Piwik; use Piwik\Site; use Piwik\Tracker\GoalManager; @@ -87,17 +87,17 @@ public function getInformation() public function getListHooksRegistered() { $hooks = array( - 'AssetManager.getJavaScriptFiles' => 'getJsFiles', - 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', - 'Site.getSiteAttributes' => 'fetchGoalsFromDb', - 'ArchiveProcessor.Day.compute' => 'archiveDay', - 'ArchiveProcessor.Period.compute' => 'archivePeriod', - 'API.getReportMetadata.end' => 'getReportMetadata', - 'API.getSegmentsMetadata' => 'getSegmentsMetadata', - 'WidgetsList.addWidgets' => 'addWidgets', - 'Menu.Reporting.addItems' => 'addMenus', - 'SitesManager.deleteSite.end' => 'deleteSiteGoals', - 'Goals.getReportsWithGoalMetrics' => 'getActualReportsWithGoalMetrics', + 'AssetManager.getJavaScriptFiles' => 'getJsFiles', + 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', + 'Site.getSiteAttributes' => 'fetchGoalsFromDb', + 'ArchiveProcessor.Day.compute' => 'archiveDay', + 'ArchiveProcessor.Period.compute' => 'archivePeriod', + 'API.getReportMetadata.end' => 'getReportMetadata', + 'API.getSegmentsMetadata' => 'getSegmentsMetadata', + 'WidgetsList.addWidgets' => 'addWidgets', + 'Menu.Reporting.addItems' => 'addMenus', + 'SitesManager.deleteSite.end' => 'deleteSiteGoals', + 'Goals.getReportsWithGoalMetrics' => 'getActualReportsWithGoalMetrics', 'Visualization.getReportDisplayProperties' => 'getReportDisplayProperties', 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys' ); diff --git a/plugins/ImageGraph/API.php b/plugins/ImageGraph/API.php index e9a85905a4f..4ee71fde95e 100644 --- a/plugins/ImageGraph/API.php +++ b/plugins/ImageGraph/API.php @@ -76,7 +76,7 @@ class API ); static private $DEFAULT_GRAPH_TYPE_OVERRIDE = array( - 'UserSettings_getPlugin' => array( + 'UserSettings_getPlugin' => array( false // override if !$isMultiplePeriod => StaticGraph::GRAPH_TYPE_HORIZONTAL_BAR, ), diff --git a/plugins/ImageGraph/ImageGraph.php b/plugins/ImageGraph/ImageGraph.php index 7240159a74b..ee8358985e0 100644 --- a/plugins/ImageGraph/ImageGraph.php +++ b/plugins/ImageGraph/ImageGraph.php @@ -30,7 +30,7 @@ class ImageGraph extends \Piwik\Plugin public function getInformation() { $suffix = ' Debug: All images'; + array('module' => 'ImageGraph', 'action' => 'index')) . '">All images'; $info = parent::getInformation(); $info['description'] .= ' ' . $suffix; return $info; diff --git a/plugins/ImageGraph/StaticGraph.php b/plugins/ImageGraph/StaticGraph.php index 1b908794fda..bdc59dc629f 100644 --- a/plugins/ImageGraph/StaticGraph.php +++ b/plugins/ImageGraph/StaticGraph.php @@ -13,8 +13,8 @@ use Exception; use pData; -use pImage; +use pImage; use Piwik\Loader; use Piwik\SettingsPiwik; diff --git a/plugins/ImageGraph/StaticGraph/Evolution.php b/plugins/ImageGraph/StaticGraph/Evolution.php index 39eb88cabd1..f1b1240364b 100644 --- a/plugins/ImageGraph/StaticGraph/Evolution.php +++ b/plugins/ImageGraph/StaticGraph/Evolution.php @@ -11,7 +11,6 @@ namespace Piwik\Plugins\ImageGraph\StaticGraph; - /** * * @package StaticGraph diff --git a/plugins/ImageGraph/StaticGraph/HorizontalBar.php b/plugins/ImageGraph/StaticGraph/HorizontalBar.php index 49fc5c642bf..cc3133dbe56 100644 --- a/plugins/ImageGraph/StaticGraph/HorizontalBar.php +++ b/plugins/ImageGraph/StaticGraph/HorizontalBar.php @@ -11,7 +11,6 @@ namespace Piwik\Plugins\ImageGraph\StaticGraph; - /** * * @package StaticGraph @@ -117,10 +116,10 @@ public function renderGraph() $gridLeftMarginWithoutLabels = $this->getGridLeftMargin($horizontalGraph = true, $withLabel = false); $labelWidthLimit = $this->width - - $gridLeftMarginWithoutLabels - - $gridRightMargin - - $paddingWidth - - $minGraphSize; + - $gridLeftMarginWithoutLabels + - $gridRightMargin + - $paddingWidth + - $minGraphSize; // truncate labels if needed foreach ($this->abscissaSeries as &$label) { @@ -170,10 +169,10 @@ public function renderGraph() $logoYPosition = ($logoInterleave * $i) - + $this->getGridTopMargin(true, $verticalLegend) - + $graphData['Axis'][1]['Margin'] - - $logoHeight / 2 - + 1; + + $this->getGridTopMargin(true, $verticalLegend) + + $graphData['Axis'][1]['Margin'] + - $logoHeight / 2 + + 1; if (method_exists($this->pImage, $drawingFunction)) { $this->pImage->$drawingFunction( diff --git a/plugins/ImageGraph/StaticGraph/Pie.php b/plugins/ImageGraph/StaticGraph/Pie.php index 200b2732930..0f4b4cec9bd 100644 --- a/plugins/ImageGraph/StaticGraph/Pie.php +++ b/plugins/ImageGraph/StaticGraph/Pie.php @@ -11,7 +11,6 @@ namespace Piwik\Plugins\ImageGraph\StaticGraph; - /** * * @package StaticGraph diff --git a/plugins/ImageGraph/StaticGraph/VerticalBar.php b/plugins/ImageGraph/StaticGraph/VerticalBar.php index 273ade455ba..a6456df02b1 100644 --- a/plugins/ImageGraph/StaticGraph/VerticalBar.php +++ b/plugins/ImageGraph/StaticGraph/VerticalBar.php @@ -11,7 +11,6 @@ namespace Piwik\Plugins\ImageGraph\StaticGraph; - /** * * @package StaticGraph diff --git a/plugins/Installation/Controller.php b/plugins/Installation/Controller.php index 298cb0d7916..2f9fdcba376 100644 --- a/plugins/Installation/Controller.php +++ b/plugins/Installation/Controller.php @@ -243,7 +243,7 @@ function databaseCheck() $error = true; } - if (!DbHelper::isDatabaseConnectionUTF8()) { + if (!DbHelper::isDatabaseConnectionUTF8()) { $dbInfos = $this->session->db_infos; $dbInfos['charset'] = 'utf8'; $this->session->db_infos = $dbInfos; @@ -484,7 +484,7 @@ public function finished() $configPath = Config::getLocalConfigPath(); if (!file_exists($configPath)) { - $this->addTrustedHosts(); + $this->addTrustedHosts(); $this->writeConfigFileFromSession(); } diff --git a/plugins/Installation/FormDatabaseSetup.php b/plugins/Installation/FormDatabaseSetup.php index a2551f1e6e2..920e33bff3e 100644 --- a/plugins/Installation/FormDatabaseSetup.php +++ b/plugins/Installation/FormDatabaseSetup.php @@ -55,7 +55,7 @@ function init() $requiredPrivileges = Rule_checkUserPrivileges::getRequiredPrivilegesPretty(); $user->addRule('checkUserPrivileges', Piwik_Translate('Installation_InsufficientPrivilegesMain', $requiredPrivileges . '

') . - Piwik_Translate('Installation_InsufficientPrivilegesHelp')); + Piwik_Translate('Installation_InsufficientPrivilegesHelp')); $this->addElement('password', 'password') ->setLabel(Piwik_Translate('General_Password')); @@ -310,7 +310,7 @@ function validateOwner() { $prefix = $this->owner->getValue(); return empty($prefix) - || Filesystem::isValidFilename($prefix); + || Filesystem::isValidFilename($prefix); } } diff --git a/plugins/Installation/FormFirstWebsiteSetup.php b/plugins/Installation/FormFirstWebsiteSetup.php index 39b7c0ad70d..e509c3096f4 100644 --- a/plugins/Installation/FormFirstWebsiteSetup.php +++ b/plugins/Installation/FormFirstWebsiteSetup.php @@ -10,6 +10,7 @@ */ namespace Piwik\Plugins\Installation; + use HTML_QuickForm2_DataSource_Array; use HTML_QuickForm2_Factory; use HTML_QuickForm2_Rule; diff --git a/plugins/Installation/Installation.php b/plugins/Installation/Installation.php index 114352f2328..18095125fc1 100644 --- a/plugins/Installation/Installation.php +++ b/plugins/Installation/Installation.php @@ -63,7 +63,7 @@ public function dispatch($exception = null) $step = Common::getRequestVar('action', 'welcome', 'string'); $controller = $this->getInstallationController(); - $isActionWhiteListed = in_array($step, array( 'saveLanguage', 'getBaseCss')); + $isActionWhiteListed = in_array($step, array('saveLanguage', 'getBaseCss')); if (in_array($step, array_keys($controller->getInstallationSteps())) || $isActionWhiteListed ) { diff --git a/plugins/LanguagesManager/API.php b/plugins/LanguagesManager/API.php index 2bc178d054a..64a58ccdf21 100644 --- a/plugins/LanguagesManager/API.php +++ b/plugins/LanguagesManager/API.php @@ -55,8 +55,8 @@ static public function getInstance() public function isLanguageAvailable($languageCode) { return $languageCode !== false - && Filesystem::isValidFilename($languageCode) - && in_array($languageCode, $this->getAvailableLanguages()); + && Filesystem::isValidFilename($languageCode) + && in_array($languageCode, $this->getAvailableLanguages()); } /** @@ -97,10 +97,10 @@ public function getAvailableLanguagesInfo() $data = file_get_contents(sprintf('%s/lang/%s.json', PIWIK_INCLUDE_PATH, $filename)); $translations = json_decode($data, true); - $intersect = function($array, $array2) { + $intersect = function ($array, $array2) { $res = $array; - foreach($array as $module => $keys) { - if(!isset($array2[$module])) { + foreach ($array as $module => $keys) { + if (!isset($array2[$module])) { unset($res[$module]); } else { $res[$module] = array_intersect_key($res[$module], array_filter($array2[$module], 'strlen')); @@ -164,7 +164,7 @@ public function getTranslationsForLanguage($languageCode) $translations = json_decode($data, true); $languageInfo = array(); foreach ($translations as $module => $keys) { - foreach($keys as $key => $value) { + foreach ($keys as $key => $value) { $languageInfo[] = array( 'label' => sprintf("%s_%s", $module, $key), 'value' => $value @@ -199,7 +199,7 @@ public function getPluginTranslationsForLanguage($pluginName, $languageCode) $translations = json_decode($data, true); $languageInfo = array(); foreach ($translations as $module => $keys) { - foreach($keys as $key => $value) { + foreach ($keys as $key => $value) { $languageInfo[] = array( 'label' => sprintf("%s_%s", $module, $key), 'value' => $value @@ -239,9 +239,9 @@ public function setLanguageForUser($login, $languageCode) } $paramsBind = array($login, $languageCode, $languageCode); Db::query('INSERT INTO ' . Common::prefixTable('user_language') . - ' (login, language) - VALUES (?,?) - ON DUPLICATE KEY UPDATE language=?', + ' (login, language) + VALUES (?,?) + ON DUPLICATE KEY UPDATE language=?', $paramsBind); return true; } diff --git a/plugins/LanguagesManager/LanguagesManager.php b/plugins/LanguagesManager/LanguagesManager.php index 2a4690016c7..f46ddacfe63 100644 --- a/plugins/LanguagesManager/LanguagesManager.php +++ b/plugins/LanguagesManager/LanguagesManager.php @@ -15,8 +15,8 @@ use Piwik\Common; use Piwik\Config; use Piwik\Cookie; -use Piwik\Db; +use Piwik\Db; use Piwik\Piwik; use Piwik\Translate; use Piwik\View; diff --git a/plugins/Live/API.php b/plugins/Live/API.php index cc9e055b4ed..065521a2635 100644 --- a/plugins/Live/API.php +++ b/plugins/Live/API.php @@ -62,7 +62,7 @@ class API const VISITOR_PROFILE_MAX_VISITS_TO_AGGREGATE = 100; const VISITOR_PROFILE_MAX_VISITS_TO_SHOW = 10; const VISITOR_PROFILE_DATE_FORMAT = '%day% %shortMonth% %longYear%'; - + static private $instance = null; /** @@ -168,7 +168,7 @@ public function getLastVisitsDetails($idSite, $period = false, $date = false, $s /** * Returns an array describing a visitor using her last visits (uses a maximum of 100). - * + * * @param int $idSite Site ID * @param string|false $visitorId The ID of the visitor whose profile to retrieve. * @param string|false $segment @@ -185,9 +185,9 @@ public function getVisitorProfile($idSite, $visitorId = false, $segment = false, $newSegment = ($segment === false ? '' : $segment . ';') . 'visitorId==' . $visitorId; $visits = $this->getLastVisitsDetails($idSite, $period = false, $date = false, $newSegment, - $filter_limit = self::VISITOR_PROFILE_MAX_VISITS_TO_AGGREGATE, - $filter_offset = false, $overrideVisitorId = false, - $minTimestamp = false); + $filter_limit = self::VISITOR_PROFILE_MAX_VISITS_TO_AGGREGATE, + $filter_offset = false, $overrideVisitorId = false, + $minTimestamp = false); if ($visits->getRowsCount() == 0) { return array(); } @@ -244,13 +244,13 @@ public function getVisitorProfile($idSite, $visitorId = false, $segment = false, $result['totalRevenueByGoal'][$idGoalKey] += $action['revenue']; } } else if ($action['type'] == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER // handle ecommerce order - && $isEcommerceEnabled + && $isEcommerceEnabled ) { ++$result['totalEcommerceConversions']; $result['totalEcommerceRevenue'] += $action['revenue']; $result['totalEcommerceItems'] += $action['items']; } else if ($action['type'] == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART // handler abandoned cart - && $isEcommerceEnabled + && $isEcommerceEnabled ) { ++$result['totalAbandonedCarts']; $result['totalAbandonedCartsRevenue'] += $action['revenue']; @@ -294,18 +294,18 @@ public function getVisitorProfile($idSite, $visitorId = false, $segment = false, // transform country/continents/search keywords into something that will look good in XML $result['countries'] = $result['continents'] = $result['searches'] = array(); foreach ($countries as $countryCode => $nbVisits) { - $result['countries'][] = array('country' => $countryCode, - 'nb_visits' => $nbVisits, - 'flag' => \Piwik\Plugins\UserCountry\getFlagFromCode($countryCode), + $result['countries'][] = array('country' => $countryCode, + 'nb_visits' => $nbVisits, + 'flag' => \Piwik\Plugins\UserCountry\getFlagFromCode($countryCode), 'prettyName' => \Piwik\Plugins\UserCountry\countryTranslate($countryCode)); } foreach ($continents as $continentCode => $nbVisits) { - $result['continents'][] = array('continent' => $continentCode, - 'nb_visits' => $nbVisits, + $result['continents'][] = array('continent' => $continentCode, + 'nb_visits' => $nbVisits, 'prettyName' => \Piwik\Plugins\UserCountry\continentTranslate($continentCode)); } foreach ($siteSearchKeywords as $keyword => $searchCount) { - $result['searches'][] = array('keyword' => $keyword, + $result['searches'][] = array('keyword' => $keyword, 'searches' => $searchCount); } @@ -377,7 +377,7 @@ public function getVisitorProfile($idSite, $visitorId = false, $segment = false, /** * Returns the visitor ID of the most recent visit. - * + * * @param int $idSite * @param string|false $segment * @return string @@ -402,7 +402,7 @@ public function getMostRecentVisitorId($idSite, $segment = false) /** * Returns the ID of a visitor that is adjacent to another visitor (by time of last action) * in the log_visit table. - * + * * @param int $idSite The ID of the site whose visits should be looked at. * @param string $visitorId The ID of the visitor to get an adjacent visitor for. * @param string $visitLastActionTime The last action time of the latest visit for $visitorId. @@ -448,7 +448,7 @@ private function getAdjacentVisitorId($idSite, $visitorId, $visitLastActionTime, /** * Returns a summary for an important visit. Used to describe the first & last visits of a visitor. - * + * * @param Row $visit * @return array */ @@ -458,17 +458,17 @@ private function getVisitorProfileVisitSummary($visit) $serverDate = $visit->getColumn('serverDate'); return array( - 'date' => $serverDate, - 'prettyDate' => Date::factory($serverDate)->getLocalized(self::VISITOR_PROFILE_DATE_FORMAT), - 'daysAgo' => (int)Date::secondsToDays($today->getTimestamp() - Date::factory($serverDate)->getTimestamp()), - 'referrerType' => $visit->getColumn('referrerType'), + 'date' => $serverDate, + 'prettyDate' => Date::factory($serverDate)->getLocalized(self::VISITOR_PROFILE_DATE_FORMAT), + 'daysAgo' => (int)Date::secondsToDays($today->getTimestamp() - Date::factory($serverDate)->getTimestamp()), + 'referrerType' => $visit->getColumn('referrerType'), 'referralSummary' => self::getReferrerSummaryForVisit($visit), ); } /** * Returns a summary for a visit's referral. - * + * * @param Row $visit * @return bool|mixed|string * @ignore diff --git a/plugins/Live/Controller.php b/plugins/Live/Controller.php index 1ed4bf9c3e8..3c87d8897b4 100644 --- a/plugins/Live/Controller.php +++ b/plugins/Live/Controller.php @@ -165,10 +165,10 @@ public function getSingleVisitSummary() { $view = new View('@Live/getSingleVisitSummary.twig'); $visits = Request::processRequest('Live.getLastVisitsDetails', array( - 'segment' => 'visitId==' . Common::getRequestVar('visitId'), - 'period' => false, - 'date' => false - )); + 'segment' => 'visitId==' . Common::getRequestVar('visitId'), + 'period' => false, + 'date' => false + )); $view->visitData = $visits->getFirstRow()->getColumns(); $view->visitReferralSummary = API::getReferrerSummaryForVisit($visits->getFirstRow()); $view->showLocation = true; @@ -180,12 +180,12 @@ public function getSingleVisitSummary() public function getVisitList() { $nextVisits = Request::processRequest('Live.getLastVisitsDetails', array( - 'segment' => self::getSegmentWithVisitorId(), - 'filter_limit' => API::VISITOR_PROFILE_MAX_VISITS_TO_SHOW, - 'disable_generic_filters' => 1, - 'period' => false, - 'date' => false - )); + 'segment' => self::getSegmentWithVisitorId(), + 'filter_limit' => API::VISITOR_PROFILE_MAX_VISITS_TO_SHOW, + 'disable_generic_filters' => 1, + 'period' => false, + 'date' => false + )); if (empty($nextVisits)) { return; @@ -201,38 +201,38 @@ public function getVisitList() private function getVisitorProfileExportLink() { return Url::getCurrentQueryStringWithParametersModified(array( - 'module' => 'API', - 'action' => 'index', - 'method' => 'Live.getVisitorProfile', - 'format' => 'XML', - 'expanded' => 1 - )); + 'module' => 'API', + 'action' => 'index', + 'method' => 'Live.getVisitorProfile', + 'format' => 'XML', + 'expanded' => 1 + )); } private function setWidgetizedVisitorProfileUrl($view) { if (PluginsManager::getInstance()->isPluginLoaded('Widgetize')) { $view->widgetizedLink = Url::getCurrentQueryStringWithParametersModified(array( - 'module' => 'Widgetize', - 'action' => 'iframe', - 'moduleToWidgetize' => 'Live', - 'actionToWidgetize' => 'getVisitorProfilePopup' - )); + 'module' => 'Widgetize', + 'action' => 'iframe', + 'moduleToWidgetize' => 'Live', + 'actionToWidgetize' => 'getVisitorProfilePopup' + )); } } private function getUserCountryMapUrlForVisitorProfile() { $params = array( - 'module' => 'UserCountryMap', - 'action' => 'realtimeMap', - 'segment' => self::getSegmentWithVisitorId(), - 'visitorId' => false, - 'changeVisitAlpha' => 0, - 'removeOldVisits' => 0, - 'realtimeWindow' => 'false', - 'showFooterMessage' => 0, - 'showDateTime' => 0, + 'module' => 'UserCountryMap', + 'action' => 'realtimeMap', + 'segment' => self::getSegmentWithVisitorId(), + 'visitorId' => false, + 'changeVisitAlpha' => 0, + 'removeOldVisits' => 0, + 'realtimeWindow' => 'false', + 'showFooterMessage' => 0, + 'showDateTime' => 0, 'doNotRefreshVisits' => 1 ); return Url::getCurrentQueryStringWithParametersModified($params); diff --git a/plugins/Live/Live.php b/plugins/Live/Live.php index 47c97990764..09d6f092c31 100644 --- a/plugins/Live/Live.php +++ b/plugins/Live/Live.php @@ -101,12 +101,12 @@ private function getDisplayPropertiesForGetLastVisitsDetails() ), 'footer_icons' => array( array( - 'class' => 'tableAllColumnsSwitch', + 'class' => 'tableAllColumnsSwitch', 'buttons' => array( array( - 'id' => 'Piwik\\Plugins\\Live\\VisitorLog', + 'id' => 'Piwik\\Plugins\\Live\\VisitorLog', 'title' => Piwik_Translate('Live_LinkVisitorLog'), - 'icon' => 'plugins/Zeitgeist/images/table.png' + 'icon' => 'plugins/Zeitgeist/images/table.png' ) ) ) diff --git a/plugins/Login/Controller.php b/plugins/Login/Controller.php index 1bcbc1a84ce..5b761724c62 100644 --- a/plugins/Login/Controller.php +++ b/plugins/Login/Controller.php @@ -49,7 +49,7 @@ private function generateHash($userInfo, $password) $passwordLen = strlen($password) / 2; $hash = Common::hash( $userInfo . substr($password, 0, $passwordLen) - . SettingsPiwik::getSalt() . substr($password, $passwordLen) + . SettingsPiwik::getSalt() . substr($password, $passwordLen) ); return $hash; } @@ -287,10 +287,10 @@ private function sendEmailConfirmationLink($user) $mail->addTo($email, $login); $mail->setSubject(Piwik_Translate('Login_MailTopicPasswordChange')); $bodyText = str_replace( - '\n', - "\n", - sprintf(Piwik_Translate('Login_MailPasswordChangeBody'), $login, $ip, $url) - ) . "\n"; + '\n', + "\n", + sprintf(Piwik_Translate('Login_MailPasswordChangeBody'), $login, $ip, $url) + ) . "\n"; $mail->setBodyText($bodyText); $fromEmailName = Config::getInstance()->General['login_password_recovery_email_name']; diff --git a/plugins/Login/Login.php b/plugins/Login/Login.php index 7e21c339f55..5a55e33f5e8 100644 --- a/plugins/Login/Login.php +++ b/plugins/Login/Login.php @@ -32,10 +32,10 @@ class Login extends \Piwik\Plugin public function getListHooksRegistered() { $hooks = array( - 'Request.initAuthenticationObject' => 'initAuthenticationObject', - 'User.isNotAuthorized' => 'noAccess', - 'API.Request.authenticate' => 'ApiRequestAuthenticate', - 'Login.initSession' => 'initSession', + 'Request.initAuthenticationObject' => 'initAuthenticationObject', + 'User.isNotAuthorized' => 'noAccess', + 'API.Request.authenticate' => 'ApiRequestAuthenticate', + 'Login.initSession' => 'initSession', ); return $hooks; } diff --git a/plugins/MobileMessaging/API.php b/plugins/MobileMessaging/API.php index 38bd6265cc9..538cbee1cc0 100644 --- a/plugins/MobileMessaging/API.php +++ b/plugins/MobileMessaging/API.php @@ -11,7 +11,6 @@ namespace Piwik\Plugins\MobileMessaging; use Piwik\Common; - use Piwik\Piwik; use Piwik\Plugins\MobileMessaging\SMSProvider; use Piwik\Plugins\ScheduledReports\API as APIScheduledReports; @@ -69,9 +68,9 @@ private function getSMSAPICredential() $settings = $this->getCredentialManagerSettings(); return array( MobileMessaging::PROVIDER_OPTION => - isset($settings[MobileMessaging::PROVIDER_OPTION]) ? $settings[MobileMessaging::PROVIDER_OPTION] : null, + isset($settings[MobileMessaging::PROVIDER_OPTION]) ? $settings[MobileMessaging::PROVIDER_OPTION] : null, MobileMessaging::API_KEY_OPTION => - isset($settings[MobileMessaging::API_KEY_OPTION]) ? $settings[MobileMessaging::API_KEY_OPTION] : null, + isset($settings[MobileMessaging::API_KEY_OPTION]) ? $settings[MobileMessaging::API_KEY_OPTION] : null, ); } diff --git a/plugins/MobileMessaging/MobileMessaging.php b/plugins/MobileMessaging/MobileMessaging.php index 5139235b8cf..bca9f4a2e9a 100644 --- a/plugins/MobileMessaging/MobileMessaging.php +++ b/plugins/MobileMessaging/MobileMessaging.php @@ -67,9 +67,9 @@ class MobileMessaging extends \Piwik\Plugin public function getListHooksRegistered() { return array( - 'Menu.Admin.addItems' => 'addMenu', - 'AssetManager.getJavaScriptFiles' => 'getJsFiles', - 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', + 'Menu.Admin.addItems' => 'addMenu', + 'AssetManager.getJavaScriptFiles' => 'getJsFiles', + 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', 'ScheduledReports.getReportParameters' => 'getReportParameters', 'ScheduledReports.validateReportParameters' => 'validateReportParameters', 'ScheduledReports.getReportMetadata' => 'getReportMetadata', diff --git a/plugins/MobileMessaging/ReportRenderer/Sms.php b/plugins/MobileMessaging/ReportRenderer/Sms.php index 6e2ede2c94b..887ae15fe92 100644 --- a/plugins/MobileMessaging/ReportRenderer/Sms.php +++ b/plugins/MobileMessaging/ReportRenderer/Sms.php @@ -70,21 +70,21 @@ public function renderReport($processedReport) $evolutionMetrics[] = $metricSettings[API::METRIC_EVOLUTION_COL_NAME_KEY]; } - $floatRegex = self::FLOAT_REGEXP; + $floatRegex = self::FLOAT_REGEXP; // no decimal for all metrics to shorten SMS content (keeps the monetary sign for revenue metrics) $reportData->filter( 'ColumnCallbackReplace', array( - array_merge(array_keys($multiSitesAPIMetrics), $evolutionMetrics), - function($value) use ($floatRegex) { - return preg_replace_callback( - $floatRegex, - function($matches) { - return round($matches[0]); - }, - $value - ); - } + array_merge(array_keys($multiSitesAPIMetrics), $evolutionMetrics), + function ($value) use ($floatRegex) { + return preg_replace_callback( + $floatRegex, + function ($matches) { + return round($matches[0]); + }, + $value + ); + } ) ); @@ -95,11 +95,11 @@ function($matches) { $reportData->filter( 'ColumnCallbackReplace', array( - $evolutionMetrics, - function($value) use ($floatRegex) { - $matched = preg_match($floatRegex, $value, $matches); - return $matched ? sprintf("%+d",$matches[0]) : $value; - } + $evolutionMetrics, + function ($value) use ($floatRegex) { + $matched = preg_match($floatRegex, $value, $matches); + return $matched ? sprintf("%+d", $matches[0]) : $value; + } ) ); diff --git a/plugins/MultiSites/API.php b/plugins/MultiSites/API.php index 4fb01d3fbfe..d92af8e82c6 100755 --- a/plugins/MultiSites/API.php +++ b/plugins/MultiSites/API.php @@ -314,7 +314,9 @@ private function buildDataTable($sites, $period, $date, $segment, $_restrictSite 'ColumnCallbackDeleteRow', array( self::NB_VISITS_METRIC, - function($value) { return $value != 0; } + function ($value) { + return $value != 0; + } ) ); } diff --git a/plugins/MultiSites/MultiSites.php b/plugins/MultiSites/MultiSites.php index 760b10ae50c..54071e129b2 100644 --- a/plugins/MultiSites/MultiSites.php +++ b/plugins/MultiSites/MultiSites.php @@ -11,7 +11,6 @@ namespace Piwik\Plugins\MultiSites; - /** * * @package MultiSites diff --git a/plugins/Overlay/Controller.php b/plugins/Overlay/Controller.php index 1ce95ee6cc0..5abfcd29f89 100644 --- a/plugins/Overlay/Controller.php +++ b/plugins/Overlay/Controller.php @@ -67,11 +67,11 @@ public function renderSidebar() $label = implode('>', $path); $request = new Request( 'method=Actions.getPageUrls' - . '&idSite=' . urlencode($idSite) - . '&date=' . urlencode($date) - . '&period=' . urlencode($period) - . '&label=' . urlencode($label) - . '&format=original' + . '&idSite=' . urlencode($idSite) + . '&date=' . urlencode($date) + . '&period=' . urlencode($period) + . '&label=' . urlencode($label) + . '&format=original' ); $dataTable = $request->process(); diff --git a/plugins/PrivacyManager/LogDataPurger.php b/plugins/PrivacyManager/LogDataPurger.php index 5c3247e7e4e..5ebabd9113e 100755 --- a/plugins/PrivacyManager/LogDataPurger.php +++ b/plugins/PrivacyManager/LogDataPurger.php @@ -11,8 +11,8 @@ namespace Piwik\Plugins\PrivacyManager; use Piwik\Common; -use Piwik\Date; +use Piwik\Date; use Piwik\Db; use Piwik\Log; diff --git a/plugins/PrivacyManager/PrivacyManager.php b/plugins/PrivacyManager/PrivacyManager.php index baf451c7a5f..006afd77cd5 100644 --- a/plugins/PrivacyManager/PrivacyManager.php +++ b/plugins/PrivacyManager/PrivacyManager.php @@ -16,8 +16,8 @@ use Piwik\Date; use Piwik\Db; use Piwik\Metrics; -use Piwik\Piwik; +use Piwik\Piwik; use Piwik\Plugins\Goals\Archiver; use Piwik\ScheduledTask; use Piwik\ScheduledTime\Daily; diff --git a/plugins/PrivacyManager/ReportsPurger.php b/plugins/PrivacyManager/ReportsPurger.php index df023999d4a..b21c06fb4f3 100755 --- a/plugins/PrivacyManager/ReportsPurger.php +++ b/plugins/PrivacyManager/ReportsPurger.php @@ -248,7 +248,7 @@ public static function shouldReportBePurged($reportDateYear, $reportDateMonth, $ $toRemoveMonth = (int)$toRemoveDate->toString('m'); return $reportDateYear < $toRemoveYear - || ($reportDateYear == $toRemoveYear && $reportDateMonth <= $toRemoveMonth); + || ($reportDateYear == $toRemoveYear && $reportDateMonth <= $toRemoveMonth); } private function getNumericTableDeleteCount($table) diff --git a/plugins/Provider/Provider.php b/plugins/Provider/Provider.php index 61e65faa93e..cce4cb85336 100644 --- a/plugins/Provider/Provider.php +++ b/plugins/Provider/Provider.php @@ -14,8 +14,8 @@ use Piwik\ArchiveProcessor; use Piwik\Common; use Piwik\Db; -use Piwik\FrontController; +use Piwik\FrontController; use Piwik\IP; use Piwik\WidgetsList; diff --git a/plugins/Provider/functions.php b/plugins/Provider/functions.php index 51a85e15d19..480cfbe3e07 100644 --- a/plugins/Provider/functions.php +++ b/plugins/Provider/functions.php @@ -65,15 +65,15 @@ function getHostnameUrl($in) * @param string $in hostname * @return string Real ISP name, IP (if IP address didn't resolve), or Unknown */ -function getPrettyProviderName( $in ) +function getPrettyProviderName($in) { $providerName = getHostnameName($in); $prettyNames = Common::getProviderNames(); - if(is_array($prettyNames) - && array_key_exists(strtolower($providerName), $prettyNames)) - { + if (is_array($prettyNames) + && array_key_exists(strtolower($providerName), $prettyNames) + ) { $providerName = $prettyNames[strtolower($providerName)]; } diff --git a/plugins/Referrers/API.php b/plugins/Referrers/API.php index 32d5c03db9e..57983497f54 100644 --- a/plugins/Referrers/API.php +++ b/plugins/Referrers/API.php @@ -81,7 +81,7 @@ protected function getDataTable($name, $idSite, $period, $date, $segment, $expan * @return DataTable */ public function getReferrerType($idSite, $period, $date, $segment = false, $typeReferrer = false, - $idSubtable = false, $expanded = false) + $idSubtable = false, $expanded = false) { // if idSubtable is supplied, interpret idSubtable as referrer type and return correct report if ($idSubtable !== false) { @@ -305,7 +305,9 @@ public function getUrlsFromWebsiteId($idSite, $period, $date, $idSubtable, $segm $dataTable = $this->getDataTable(Archiver::WEBSITES_RECORD_NAME, $idSite, $period, $date, $segment, $expanded = false, $idSubtable); // the htmlspecialchars_decode call is for BC for before 1.1 // as the Referrer URL was previously encoded in the log tables, but is now recorded raw - $dataTable->queueFilter('ColumnCallbackAddMetadata', array('label', 'url', function($label) { return htmlspecialchars_decode($label); })); + $dataTable->queueFilter('ColumnCallbackAddMetadata', array('label', 'url', function ($label) { + return htmlspecialchars_decode($label); + })); $dataTable->queueFilter('ColumnCallbackReplace', array('label', __NAMESPACE__ . '\getPathFromUrl')); return $dataTable; } diff --git a/plugins/Referrers/Archiver.php b/plugins/Referrers/Archiver.php index 8601ff18c83..9255efc9d8d 100644 --- a/plugins/Referrers/Archiver.php +++ b/plugins/Referrers/Archiver.php @@ -29,7 +29,7 @@ class Archiver extends PluginsArchiver const METRIC_DISTINCT_CAMPAIGN_RECORD_NAME = 'Referrers_distinctCampaigns'; const METRIC_DISTINCT_WEBSITE_RECORD_NAME = 'Referrers_distinctWebsites'; const METRIC_DISTINCT_URLS_RECORD_NAME = 'Referrers_distinctWebsitesUrls'; - + protected $columnToSortByBeforeTruncation; protected $maximumRowsInDataTableLevelZero; protected $maximumRowsInSubDataTable; @@ -45,7 +45,7 @@ function __construct($processor) // Reading pre 2.0 config file settings $this->maximumRowsInDataTableLevelZero = @Config::getInstance()->General['datatable_archiving_maximum_rows_referers']; $this->maximumRowsInSubDataTable = @Config::getInstance()->General['datatable_archiving_maximum_rows_subtable_referers']; - if(empty($this->maximumRowsInDataTableLevelZero)) { + if (empty($this->maximumRowsInDataTableLevelZero)) { $this->maximumRowsInDataTableLevelZero = Config::getInstance()->General['datatable_archiving_maximum_rows_referrers']; $this->maximumRowsInSubDataTable = Config::getInstance()->General['datatable_archiving_maximum_rows_subtable_referrers']; } @@ -239,25 +239,25 @@ public function archivePeriod() $mappingFromArchiveName = array( self::METRIC_DISTINCT_SEARCH_ENGINE_RECORD_NAME => - array('typeCountToUse' => 'level0', - 'nameTableToUse' => self::SEARCH_ENGINES_RECORD_NAME, - ), + array('typeCountToUse' => 'level0', + 'nameTableToUse' => self::SEARCH_ENGINES_RECORD_NAME, + ), self::METRIC_DISTINCT_KEYWORD_RECORD_NAME => - array('typeCountToUse' => 'level0', - 'nameTableToUse' => self::KEYWORDS_RECORD_NAME, - ), + array('typeCountToUse' => 'level0', + 'nameTableToUse' => self::KEYWORDS_RECORD_NAME, + ), self::METRIC_DISTINCT_CAMPAIGN_RECORD_NAME => - array('typeCountToUse' => 'level0', - 'nameTableToUse' => self::CAMPAIGNS_RECORD_NAME, - ), + array('typeCountToUse' => 'level0', + 'nameTableToUse' => self::CAMPAIGNS_RECORD_NAME, + ), self::METRIC_DISTINCT_WEBSITE_RECORD_NAME => - array('typeCountToUse' => 'level0', - 'nameTableToUse' => self::WEBSITES_RECORD_NAME, - ), + array('typeCountToUse' => 'level0', + 'nameTableToUse' => self::WEBSITES_RECORD_NAME, + ), self::METRIC_DISTINCT_URLS_RECORD_NAME => - array('typeCountToUse' => 'recursive', - 'nameTableToUse' => self::WEBSITES_RECORD_NAME, - ), + array('typeCountToUse' => 'recursive', + 'nameTableToUse' => self::WEBSITES_RECORD_NAME, + ), ); foreach ($mappingFromArchiveName as $name => $infoMapping) { diff --git a/plugins/Referrers/Controller.php b/plugins/Referrers/Controller.php index 240dafb55ec..559c9c69180 100644 --- a/plugins/Referrers/Controller.php +++ b/plugins/Referrers/Controller.php @@ -486,8 +486,8 @@ private function getReferrerUrlSparkline($referrerType) $totalRow = Piwik_Translate('General_Total'); return $this->getUrlSparkline( 'getEvolutionGraph', - array('columns' => array('nb_visits'), - 'rows' => array(self::getTranslatedReferrerTypeLabel($referrerType), $totalRow), + array('columns' => array('nb_visits'), + 'rows' => array(self::getTranslatedReferrerTypeLabel($referrerType), $totalRow), 'typeReferrer' => $referrerType) ); } diff --git a/plugins/Referrers/Referrers.php b/plugins/Referrers/Referrers.php index 79b06e326e4..30bef2a1dd7 100644 --- a/plugins/Referrers/Referrers.php +++ b/plugins/Referrers/Referrers.php @@ -56,11 +56,11 @@ public function getReportMetadata(&$reports) 'documentation' => Piwik_Translate('Referrers_TypeReportDocumentation') . '
' . '' . Piwik_Translate('Referrers_DirectEntry') . ': ' . Piwik_Translate('Referrers_DirectEntryDocumentation') . '
' . '' . Piwik_Translate('Referrers_SearchEngines') . ': ' . Piwik_Translate('Referrers_SearchEnginesDocumentation', - array('
', '"' . Piwik_Translate('Referrers_SubmenuSearchEngines') . '"')) . '
' + array('
', '"' . Piwik_Translate('Referrers_SubmenuSearchEngines') . '"')) . '
' . '' . Piwik_Translate('Referrers_Websites') . ': ' . Piwik_Translate('Referrers_WebsitesDocumentation', - array('
', '"' . Piwik_Translate('Referrers_SubmenuWebsites') . '"')) . '
' + array('
', '"' . Piwik_Translate('Referrers_SubmenuWebsites') . '"')) . '
' . '' . Piwik_Translate('Referrers_Campaigns') . ': ' . Piwik_Translate('Referrers_CampaignsDocumentation', - array('
', '"' . Piwik_Translate('Referrers_Campaigns') . '"')), + array('
', '"' . Piwik_Translate('Referrers_Campaigns') . '"')), 'order' => 1, ), array( @@ -328,16 +328,16 @@ private function getDisplayPropertiesForGetReferrerType() } return array( - 'default_view_type' => 'tableAllColumns', - 'show_search' => false, - 'show_offset_information' => false, - 'show_pagination_control' => false, - 'show_limit_control' => false, + 'default_view_type' => 'tableAllColumns', + 'show_search' => false, + 'show_offset_information' => false, + 'show_pagination_control' => false, + 'show_limit_control' => false, 'show_exclude_low_population' => false, - 'show_goals' => true, - 'filter_limit' => 10, - 'translations' => array('label' => $labelColumnTitle), - 'visualization_properties' => array( + 'show_goals' => true, + 'filter_limit' => 10, + 'translations' => array('label' => $labelColumnTitle), + 'visualization_properties' => array( 'table' => array( 'disable_subtable_when_show_goals' => true, ) @@ -350,15 +350,15 @@ private function getDisplayPropertiesForGetAll() $setGetAllHtmlPrefix = array($this, 'setGetAllHtmlPrefix'); return array( 'show_exclude_low_population' => false, - 'translations' => array('label' => Piwik_Translate('Referrers_Referrer')), - 'show_goals' => true, - 'filter_limit' => 20, - 'visualization_properties' => array( + 'translations' => array('label' => Piwik_Translate('Referrers_Referrer')), + 'show_goals' => true, + 'filter_limit' => 20, + 'visualization_properties' => array( 'table' => array( 'disable_row_actions' => true ) ), - 'filters' => array( + 'filters' => array( array('MetadataCallbackAddMetadata', array('referer_type', 'html_label_prefix', $setGetAllHtmlPrefix)) ) ); @@ -367,12 +367,12 @@ private function getDisplayPropertiesForGetAll() private function getDisplayPropertiesForGetKeywords() { return array( - 'subtable_controller_action' => 'getSearchEnginesFromKeywordId', + 'subtable_controller_action' => 'getSearchEnginesFromKeywordId', 'show_exclude_low_population' => false, - 'translations' => array('label' => Piwik_Translate('General_ColumnKeyword')), - 'show_goals' => true, - 'filter_limit' => 25, - 'visualization_properties' => array( + 'translations' => array('label' => Piwik_Translate('General_ColumnKeyword')), + 'show_goals' => true, + 'filter_limit' => 25, + 'visualization_properties' => array( 'table' => array( 'disable_subtable_when_show_goals' => true, ) @@ -392,13 +392,13 @@ private function getDisplayPropertiesForGetSearchEnginesFromKeywordId() private function getDisplayPropertiesForGetSearchEngines() { return array( - 'subtable_controller_action' => 'getKeywordsFromSearchEngineId', - 'show_search' => false, + 'subtable_controller_action' => 'getKeywordsFromSearchEngineId', + 'show_search' => false, 'show_exclude_low_population' => false, - 'show_goals' => true, - 'filter_limit' => 25, - 'translations' => array('label' => Piwik_Translate('Referrers_ColumnSearchEngine')), - 'visualization_properties' => array( + 'show_goals' => true, + 'filter_limit' => 25, + 'translations' => array('label' => Piwik_Translate('Referrers_ColumnSearchEngine')), + 'visualization_properties' => array( 'table' => array( 'disable_subtable_when_show_goals' => true, ) @@ -418,12 +418,12 @@ private function getDisplayPropertiesForGetKeywordsFromSearchEngineId() private function getDisplayPropertiesForGetWebsites() { return array( - 'subtable_controller_action' => 'getUrlsFromWebsiteId', + 'subtable_controller_action' => 'getUrlsFromWebsiteId', 'show_exclude_low_population' => false, - 'show_goals' => true, - 'filter_limit' => 25, - 'translations' => array('label' => Piwik_Translate('Referrers_ColumnWebsite')), - 'visualization_properties' => array( + 'show_goals' => true, + 'filter_limit' => 25, + 'translations' => array('label' => Piwik_Translate('Referrers_ColumnWebsite')), + 'visualization_properties' => array( 'table' => array( 'disable_subtable_when_show_goals' => true, ) @@ -434,13 +434,13 @@ private function getDisplayPropertiesForGetWebsites() private function getDisplayPropertiesForGetSocials() { $result = array( - 'default_view_type' => 'graphPie', - 'subtable_controller_action' => 'getUrlsForSocial', + 'default_view_type' => 'graphPie', + 'subtable_controller_action' => 'getUrlsForSocial', 'show_exclude_low_population' => false, - 'filter_limit' => 10, - 'show_goals' => true, - 'translations' => array('label' => Piwik_Translate('Referrers_ColumnSocial')), - 'visualization_properties' => array( + 'filter_limit' => 10, + 'show_goals' => true, + 'translations' => array('label' => Piwik_Translate('Referrers_ColumnSocial')), + 'visualization_properties' => array( 'table' => array( 'disable_subtable_when_show_goals' => true, ) diff --git a/plugins/SEO/RankChecker.php b/plugins/SEO/RankChecker.php index a99978de969..5b5a69de9c5 100644 --- a/plugins/SEO/RankChecker.php +++ b/plugins/SEO/RankChecker.php @@ -12,8 +12,8 @@ use Exception; use Piwik\Http; -use Piwik\Log; +use Piwik\Log; use Piwik\MetricsFormatter; /** diff --git a/plugins/ScheduledReports/ScheduledReports.php b/plugins/ScheduledReports/ScheduledReports.php index 748dcf48c86..b63663fc10e 100644 --- a/plugins/ScheduledReports/ScheduledReports.php +++ b/plugins/ScheduledReports/ScheduledReports.php @@ -78,23 +78,23 @@ class ScheduledReports extends \Piwik\Plugin public function getListHooksRegistered() { return array( - 'Menu.Top.addItems' => 'addTopMenu', - 'TaskScheduler.getScheduledTasks' => 'getScheduledTasks', - 'AssetManager.getJavaScriptFiles' => 'getJsFiles', - 'ScheduledReports.getReportParameters' => 'getReportParameters', - 'ScheduledReports.validateReportParameters' => 'validateReportParameters', - 'ScheduledReports.getReportMetadata' => 'getReportMetadata', - 'ScheduledReports.getReportTypes' => 'getReportTypes', - 'ScheduledReports.getReportFormats' => 'getReportFormats', - 'ScheduledReports.getRendererInstance' => 'getRendererInstance', - 'ScheduledReports.getReportRecipients' => 'getReportRecipients', - 'ScheduledReports.processReports' => 'processReports', - 'ScheduledReports.allowMultipleReports' => 'allowMultipleReports', - 'ScheduledReports.sendReport' => 'sendReport', - 'Template.reportParametersScheduledReports' => 'template_reportParametersScheduledReports', - 'UsersManager.deleteUser' => 'deleteUserReport', - 'SitesManager.deleteSite.end' => 'deleteSiteReport', - APISegmentEditor::DEACTIVATE_SEGMENT_EVENT => 'segmentDeactivation', + 'Menu.Top.addItems' => 'addTopMenu', + 'TaskScheduler.getScheduledTasks' => 'getScheduledTasks', + 'AssetManager.getJavaScriptFiles' => 'getJsFiles', + 'ScheduledReports.getReportParameters' => 'getReportParameters', + 'ScheduledReports.validateReportParameters' => 'validateReportParameters', + 'ScheduledReports.getReportMetadata' => 'getReportMetadata', + 'ScheduledReports.getReportTypes' => 'getReportTypes', + 'ScheduledReports.getReportFormats' => 'getReportFormats', + 'ScheduledReports.getRendererInstance' => 'getRendererInstance', + 'ScheduledReports.getReportRecipients' => 'getReportRecipients', + 'ScheduledReports.processReports' => 'processReports', + 'ScheduledReports.allowMultipleReports' => 'allowMultipleReports', + 'ScheduledReports.sendReport' => 'sendReport', + 'Template.reportParametersScheduledReports' => 'template_reportParametersScheduledReports', + 'UsersManager.deleteUser' => 'deleteUserReport', + 'SitesManager.deleteSite.end' => 'deleteSiteReport', + APISegmentEditor::DEACTIVATE_SEGMENT_EVENT => 'segmentDeactivation', ); } @@ -219,9 +219,9 @@ public function processReports(&$processedReports, $notificationInfo) $displayFormat == self::DISPLAY_FORMAT_GRAPHS_ONLY || $displayFormat == self::DISPLAY_FORMAT_TABLES_AND_GRAPHS : $displayFormat != self::DISPLAY_FORMAT_TABLES_ONLY) - && \Piwik\SettingsServer::isGdExtensionEnabled() - && \Piwik\PluginsManager::getInstance()->isPluginActivated('ImageGraph') - && !empty($metadata['imageGraphUrl']); + && \Piwik\SettingsServer::isGdExtensionEnabled() + && \Piwik\PluginsManager::getInstance()->isPluginActivated('ImageGraph') + && !empty($metadata['imageGraphUrl']); $processedReport['evolutionGraph'] = $evolutionGraph; diff --git a/plugins/SegmentEditor/API.php b/plugins/SegmentEditor/API.php index 1f9dea9d7a1..13aa48ca55d 100644 --- a/plugins/SegmentEditor/API.php +++ b/plugins/SegmentEditor/API.php @@ -148,9 +148,9 @@ public function delete($idSegment) * Modifies an existing stored segment. * * @param int $idSegment The ID of the stored segment to modify. - * @param string $name The new name of the segment. - * @param string $definition The new definition of the segment. - * @param bool $idSite If supplied, associates the stored segment with as single site. + * @param string $name The new name of the segment. + * @param string $definition The new definition of the segment. + * @param bool $idSite If supplied, associates the stored segment with as single site. * @param bool $autoArchive Whether to automatically archive data with the segment or not. * @param bool $enabledAllUsers Whether the stored segment is viewable by all users or just the one that created it. * @@ -167,7 +167,7 @@ public function update($idSegment, $name, $definition, $idSite = false, $autoArc $enabledAllUsers = $this->checkEnabledAllUsers($enabledAllUsers); $autoArchive = $this->checkAutoArchive($autoArchive, $idSite); - if($this->segmentVisibilityIsReduced($idSite, $enabledAllUsers, $segment)) { + if ($this->segmentVisibilityIsReduced($idSite, $enabledAllUsers, $segment)) { $this->sendSegmentDeactivationEvent($idSegment); } @@ -191,9 +191,9 @@ public function update($idSegment, $name, $definition, $idSite = false, $autoArc /** * Adds a new stored segment. * - * @param string $name The new name of the segment. - * @param string $definition The new definition of the segment. - * @param bool $idSite If supplied, associates the stored segment with as single site. + * @param string $name The new name of the segment. + * @param string $definition The new definition of the segment. + * @param bool $idSite If supplied, associates the stored segment with as single site. * @param bool $autoArchive Whether to automatically archive data with the segment or not. * @param bool $enabledAllUsers Whether the stored segment is viewable by all users or just the one that created it. * @@ -245,7 +245,7 @@ public function get($idSegment) } try { - if(!$segment['enable_all_users']) { + if (!$segment['enable_all_users']) { Piwik::checkUserIsSuperUserOrTheUser($segment['login']); } @@ -263,7 +263,7 @@ public function get($idSegment) /** * Returns all stored segments. * - * @param bool $idSite Whether to return stored segments that are only auto-archived for a specific idSite, or all of them. If supplied, must be a valid site ID. + * @param bool $idSite Whether to return stored segments that are only auto-archived for a specific idSite, or all of them. If supplied, must be a valid site ID. * @param bool $returnOnlyAutoArchived Whether to only return stored segments that are auto-archived or not. * @return array */ diff --git a/plugins/SegmentEditor/SegmentEditor.php b/plugins/SegmentEditor/SegmentEditor.php index b8fa8361055..949475691e9 100644 --- a/plugins/SegmentEditor/SegmentEditor.php +++ b/plugins/SegmentEditor/SegmentEditor.php @@ -11,7 +11,6 @@ namespace Piwik\Plugins\SegmentEditor; use Exception; - use Piwik\Common; use Piwik\Db; use Piwik\Version; diff --git a/plugins/SitesManager/API.php b/plugins/SitesManager/API.php index 1bb184f44ac..b85789a5ebb 100644 --- a/plugins/SitesManager/API.php +++ b/plugins/SitesManager/API.php @@ -397,9 +397,9 @@ public function getSitesIdFromSiteUrl($url) 'SELECT idsite FROM ' . Common::prefixTable('site') . ' WHERE (main_url = ? OR main_url = ?) ' . - 'UNION - SELECT idsite - FROM ' . Common::prefixTable('site_url') . ' + 'UNION + SELECT idsite + FROM ' . Common::prefixTable('site_url') . ' WHERE (url = ? OR url = ?) ', array($url, $urlBis, $url, $urlBis)); } else { $login = Piwik::getCurrentUserLogin(); @@ -407,12 +407,12 @@ public function getSitesIdFromSiteUrl($url) 'SELECT idsite FROM ' . Common::prefixTable('site') . ' WHERE (main_url = ? OR main_url = ?)' . - 'AND idsite IN (' . Access::getSqlAccessSite('idsite') . ') ' . - 'UNION - SELECT idsite - FROM ' . Common::prefixTable('site_url') . ' + 'AND idsite IN (' . Access::getSqlAccessSite('idsite') . ') ' . + 'UNION + SELECT idsite + FROM ' . Common::prefixTable('site_url') . ' WHERE (url = ? OR url = ?)' . - 'AND idsite IN (' . Access::getSqlAccessSite('idsite') . ')', + 'AND idsite IN (' . Access::getSqlAccessSite('idsite') . ')', array($url, $urlBis, $login, $url, $urlBis, $login)); } @@ -1080,7 +1080,9 @@ private function checkAndReturnCommaSeparatedStringList($parameters) public function getCurrencyList() { $currencies = MetricsFormatter::getCurrencyList(); - return array_map(function($a) { return $a[1]." (".$a[0].")"; }, $currencies); + return array_map(function ($a) { + return $a[1] . " (" . $a[0] . ")"; + }, $currencies); } /** @@ -1091,7 +1093,9 @@ public function getCurrencyList() public function getCurrencySymbols() { $currencies = MetricsFormatter::getCurrencyList(); - return array_map(function($a) { return $a[0]; }, $currencies); + return array_map(function ($a) { + return $a[0]; + }, $currencies); } /** diff --git a/plugins/UserCountry/API.php b/plugins/UserCountry/API.php index 094e893f40a..910d8bb796c 100644 --- a/plugins/UserCountry/API.php +++ b/plugins/UserCountry/API.php @@ -14,8 +14,8 @@ use Piwik\Archive; use Piwik\DataTable; use Piwik\Metrics; -use Piwik\Piwik; +use Piwik\Piwik; use Piwik\Plugins\UserCountry\LocationProvider; use Piwik\Tracker\Visit; @@ -132,7 +132,13 @@ public function getCity($idSite, $period, $date, $segment = false) array('label', 'city_name', __NAMESPACE__ . '\getElementFromStringArray', array($separator, 0, $strUnknown))); $dataTable->filter('MetadataCallbackAddMetadata', - array('city_name', 'city', function($city) use ($strUnknown) { if ($city == $strUnknown) { return "xx"; } else { return false; } })); + array('city_name', 'city', function ($city) use ($strUnknown) { + if ($city == $strUnknown) { + return "xx"; + } else { + return false; + } + })); $dataTable->filter('ColumnCallbackAddMetadata', array('label', 'region', __NAMESPACE__ . '\getElementFromStringArray', array($separator, 1, $unk))); $dataTable->filter('ColumnCallbackAddMetadata', diff --git a/plugins/UserCountry/Controller.php b/plugins/UserCountry/Controller.php index cfe3eb72e10..99605e5ddf9 100644 --- a/plugins/UserCountry/Controller.php +++ b/plugins/UserCountry/Controller.php @@ -17,10 +17,10 @@ use Piwik\Http; use Piwik\IP; use Piwik\Piwik; -use Piwik\Plugins\UserCountry\LocationProvider; use Piwik\Plugins\UserCountry\LocationProvider\DefaultProvider; -use Piwik\Plugins\UserCountry\LocationProvider\GeoIp; use Piwik\Plugins\UserCountry\LocationProvider\GeoIp\Pecl; +use Piwik\Plugins\UserCountry\LocationProvider; +use Piwik\Plugins\UserCountry\LocationProvider\GeoIp; use Piwik\Plugins\UserCountry\LocationProvider\GeoIp\ServerBased; use Piwik\View; use Piwik\ViewDataTable; diff --git a/plugins/UserCountry/GeoIPAutoUpdater.php b/plugins/UserCountry/GeoIPAutoUpdater.php index 99c91f6f172..ec1627a5fb3 100755 --- a/plugins/UserCountry/GeoIPAutoUpdater.php +++ b/plugins/UserCountry/GeoIPAutoUpdater.php @@ -531,7 +531,7 @@ protected function performRedundantDbChecks() if (self::$unzipPhpError !== null) { list($errno, $errstr, $errfile, $errline) = self::$unzipPhpError; Log::warning("GeoIPAutoUpdater: Encountered PHP error when performing redundant tests on GeoIP " - . "%s database: %s: %s on line %s of %s.", $type, $errno, $errstr, $errline, $errfile); + . "%s database: %s: %s on line %s of %s.", $type, $errno, $errstr, $errline, $errfile); // get the current filename for the DB and an available new one to rename it to list($oldPath, $newPath) = $this->getOldAndNewPathsForBrokenDb($customNames[$type]); @@ -605,7 +605,7 @@ public static function getLastRunTime() /** * Removes the &date=... query parameter if present in the URL. This query parameter * is in MaxMind URLs by default and will force the download of an old database. - * + * * @param string $url * @return string */ diff --git a/plugins/UserCountry/LocationProvider/GeoIp.php b/plugins/UserCountry/LocationProvider/GeoIp.php index b40783d7c40..8e26cb86e24 100755 --- a/plugins/UserCountry/LocationProvider/GeoIp.php +++ b/plugins/UserCountry/LocationProvider/GeoIp.php @@ -234,8 +234,8 @@ private static function getTestIpAndResult() public static function isDatabaseInstalled() { return self::getPathToGeoIpDatabase(self::$dbNames['loc']) - || self::getPathToGeoIpDatabase(self::$dbNames['isp']) - || self::getPathToGeoIpDatabase(self::$dbNames['org']); + || self::getPathToGeoIpDatabase(self::$dbNames['isp']) + || self::getPathToGeoIpDatabase(self::$dbNames['org']); } /** diff --git a/plugins/UserCountry/LocationProvider/GeoIp/Pecl.php b/plugins/UserCountry/LocationProvider/GeoIp/Pecl.php index c4113fd9e87..aaf1d7a1b7a 100755 --- a/plugins/UserCountry/LocationProvider/GeoIp/Pecl.php +++ b/plugins/UserCountry/LocationProvider/GeoIp/Pecl.php @@ -269,8 +269,8 @@ public function getInfo() public static function isLocationDatabaseAvailable() { return self::isCityDatabaseAvailable() - || self::isRegionDatabaseAvailable() - || self::isCountryDatabaseAvailable(); + || self::isRegionDatabaseAvailable() + || self::isCountryDatabaseAvailable(); } /** @@ -281,7 +281,7 @@ public static function isLocationDatabaseAvailable() public static function isCityDatabaseAvailable() { return geoip_db_avail(GEOIP_CITY_EDITION_REV0) - || geoip_db_avail(GEOIP_CITY_EDITION_REV1); + || geoip_db_avail(GEOIP_CITY_EDITION_REV1); } /** @@ -292,7 +292,7 @@ public static function isCityDatabaseAvailable() public static function isRegionDatabaseAvailable() { return geoip_db_avail(GEOIP_REGION_EDITION_REV0) - || geoip_db_avail(GEOIP_REGION_EDITION_REV1); + || geoip_db_avail(GEOIP_REGION_EDITION_REV1); } /** diff --git a/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php b/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php index 746bfa9d15d..c279fddaa88 100755 --- a/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php +++ b/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php @@ -217,11 +217,11 @@ public function getInfo() array('', '', '', '')); $installDocs = '' - . Piwik_Translate('UserCountry_HowToInstallApacheModule') - . '
' - . '' - . Piwik_Translate('UserCountry_HowToInstallNginxModule') - . ''; + . Piwik_Translate('UserCountry_HowToInstallApacheModule') + . '
' + . '' + . Piwik_Translate('UserCountry_HowToInstallNginxModule') + . ''; $geoipServerVars = array(); foreach ($_SERVER as $key => $value) { diff --git a/plugins/UserCountry/UserCountry.php b/plugins/UserCountry/UserCountry.php index cb07290e990..a58b968e787 100644 --- a/plugins/UserCountry/UserCountry.php +++ b/plugins/UserCountry/UserCountry.php @@ -14,11 +14,11 @@ use Piwik\Common; use Piwik\IP; use Piwik\Piwik; -use Piwik\Plugins\UserCountry\LocationProvider; use Piwik\Plugins\UserCountry\LocationProvider\DefaultProvider; +use Piwik\Plugins\UserCountry\LocationProvider; use Piwik\Plugins\UserCountry\LocationProvider\GeoIp; -use Piwik\Url; +use Piwik\Url; use Piwik\WidgetsList; /** @@ -84,7 +84,7 @@ public function getVisitorLocation(&$visitorInfo, $extraInfo) $userInfo = array( 'lang' => $visitorInfo['location_browser_lang'], - 'ip' => IP::N2P($visitorInfo['location_ip']) + 'ip' => IP::N2P($visitorInfo['location_ip']) ); $location = array(); @@ -382,8 +382,8 @@ private function getDisplayPropertiesForGetCountry() if (LocationProvider::getCurrentProviderId() == DefaultProvider::ID) { // if we're using the default location provider, add a note explaining how it works $footerMessage = Piwik_Translate("General_Note") . ': ' - . Piwik_Translate('UserCountry_DefaultLocationProviderExplanation', - array('', '')); + . Piwik_Translate('UserCountry_DefaultLocationProviderExplanation', + array('', '')); $result['show_footer_message'] = $footerMessage; } @@ -461,13 +461,13 @@ private function checkIfNoDataForGeoIpReport(&$properties) if (!$self->isGeoIPWorking()) { $params = array('module' => 'UserCountry', 'action' => 'adminIndex'); $footerMessage .= ' ' . Piwik_Translate('UserCountry_NoDataForGeoIPReport2', - array('', - '', - '', - '')); + array('', + '', + '', + '')); } else { $footerMessage .= ' ' . Piwik_Translate('UserCountry_ToGeolocateOldVisits', - array('', '')); + array('', '')); } $view->show_footer_message = $footerMessage; @@ -484,8 +484,8 @@ public function isGeoIPWorking() { $provider = LocationProvider::getCurrentProvider(); return $provider instanceof GeoIp - && $provider->isAvailable() === true - && $provider->isWorking() === true; + && $provider->isAvailable() === true + && $provider->isWorking() === true; } public function getClientSideTranslationKeys(&$translationKeys) diff --git a/plugins/UserCountryMap/Controller.php b/plugins/UserCountryMap/Controller.php index 670131069c0..8b868c406e4 100644 --- a/plugins/UserCountryMap/Controller.php +++ b/plugins/UserCountryMap/Controller.php @@ -39,7 +39,7 @@ public function visitorMap($fetch = false, $segmentOverride = false) $period = Common::getRequestVar('period'); $date = Common::getRequestVar('date'); - $segment = $segmentOverride ?: Request::getRawSegmentFromRequest() ?: ''; + $segment = $segmentOverride ? : Request::getRawSegmentFromRequest() ? : ''; $token_auth = Piwik::getCurrentUserTokenAuth(); $view = new View('@UserCountryMap/visitorMap'); @@ -47,12 +47,12 @@ public function visitorMap($fetch = false, $segmentOverride = false) // request visits summary $request = new Request( 'method=VisitsSummary.get&format=PHP' - . '&idSite=' . $idSite - . '&period=' . $period - . '&date=' . $date - . '&segment=' . $segment - . '&token_auth=' . $token_auth - . '&filter_limit=-1' + . '&idSite=' . $idSite + . '&period=' . $period + . '&date=' . $date + . '&segment=' . $segment + . '&token_auth=' . $token_auth + . '&filter_limit=-1' ); $config = array(); $config['visitsSummary'] = unserialize($request->process()); @@ -158,7 +158,7 @@ public function realtimeMap($standalone = false, $fetch = false, $segmentOverrid 'goal_conversions' => Piwik_Translate('UserCountryMap_GoalConversions'), ); - $segment = $segmentOverride ?: Request::getRawSegmentFromRequest() ?: ''; + $segment = $segmentOverride ? : Request::getRawSegmentFromRequest() ? : ''; $params = array( 'period' => 'range', 'idSite' => $idSite, @@ -174,17 +174,17 @@ public function realtimeMap($standalone = false, $fetch = false, $segmentOverrid $reqParams = $this->getEnrichedRequest($params, $encode = false); $view->config = array( - 'metrics' => array(), - 'svgBasePath' => $view->piwikUrl . 'plugins/UserCountryMap/svg/', + 'metrics' => array(), + 'svgBasePath' => $view->piwikUrl . 'plugins/UserCountryMap/svg/', 'liveRefreshAfterMs' => $liveRefreshAfterMs, - '_' => $locale, - 'reqParams' => $reqParams, - 'siteHasGoals' => $hasGoals, - 'maxVisits' => $maxVisits, - 'changeVisitAlpha' => Common::getRequestVar('changeVisitAlpha', true, 'int'), - 'removeOldVisits' => Common::getRequestVar('removeOldVisits', true, 'int'), - 'showFooterMessage' => Common::getRequestVar('showFooterMessage', true, 'int'), - 'showDateTime' => Common::getRequestVar('showDateTime', true, 'int'), + '_' => $locale, + 'reqParams' => $reqParams, + 'siteHasGoals' => $hasGoals, + 'maxVisits' => $maxVisits, + 'changeVisitAlpha' => Common::getRequestVar('changeVisitAlpha', true, 'int'), + 'removeOldVisits' => Common::getRequestVar('removeOldVisits', true, 'int'), + 'showFooterMessage' => Common::getRequestVar('showFooterMessage', true, 'int'), + 'showDateTime' => Common::getRequestVar('showDateTime', true, 'int'), 'doNotRefreshVisits' => Common::getRequestVar('doNotRefreshVisits', false, 'int') ); @@ -223,12 +223,12 @@ private function getMetrics($idSite, $period, $date, $token_auth) { $request = new Request( 'method=API.getMetadata&format=PHP' - . '&apiModule=UserCountry&apiAction=getCountry' - . '&idSite=' . $idSite - . '&period=' . $period - . '&date=' . $date - . '&token_auth=' . $token_auth - . '&filter_limit=-1' + . '&apiModule=UserCountry&apiAction=getCountry' + . '&idSite=' . $idSite + . '&period=' . $period + . '&date=' . $date + . '&token_auth=' . $token_auth + . '&filter_limit=-1' ); $metaData = $request->process(); @@ -253,7 +253,7 @@ private function getApiRequestUrl($module, $action, $idSite, $period, $date, $to . "&period=" . $period . "&date=" . $date . "&token_auth=" . $token_auth - . "&segment=" . ($segmentOverride ?: Request::getRawSegmentFromRequest()) + . "&segment=" . ($segmentOverride ? : Request::getRawSegmentFromRequest()) . "&enable_filter_excludelowpop=1" . "&showRawMetrics=1"; @@ -271,6 +271,6 @@ private function getApiRequestUrl($module, $action, $idSite, $period, $date, $to private function _report($module, $action, $idSite, $period, $date, $token_auth, $filter_by_country = false, $segmentOverride = false) { return $this->getApiRequestUrl('API', 'getProcessedReport&apiModule=' . $module . '&apiAction=' . $action, - $idSite, $period, $date, $token_auth, $filter_by_country, $segmentOverride); + $idSite, $period, $date, $token_auth, $filter_by_country, $segmentOverride); } } diff --git a/plugins/UserSettings/UserSettings.php b/plugins/UserSettings/UserSettings.php index cc9a683181b..309e769fb2f 100644 --- a/plugins/UserSettings/UserSettings.php +++ b/plugins/UserSettings/UserSettings.php @@ -192,43 +192,43 @@ public function getReportDisplayProperties(&$properties) private function getDisplayPropertiesForGetResolution() { return array_merge($this->getBasicUserSettingsDisplayProperties(), array( - 'translations' => array('label' => Piwik_Translate('UserSettings_ColumnResolution')) - )); + 'translations' => array('label' => Piwik_Translate('UserSettings_ColumnResolution')) + )); } private function getDisplayPropertiesForGetConfiguration() { return array_merge($this->getBasicUserSettingsDisplayProperties(), array( - 'filter_limit' => 3, - 'translations' => array('label' => Piwik_Translate('UserSettings_ColumnConfiguration')) - )); + 'filter_limit' => 3, + 'translations' => array('label' => Piwik_Translate('UserSettings_ColumnConfiguration')) + )); } private function getDisplayPropertiesForGetOS() { return array_merge($this->getBasicUserSettingsDisplayProperties(), array( - 'translations' => array('label' => Piwik_Translate('UserSettings_ColumnOperatingSystem')), - 'title' => Piwik_Translate('UserSettings_OperatingSystems'), - 'related_reports' => $this->getOsRelatedReports() - )); + 'translations' => array('label' => Piwik_Translate('UserSettings_ColumnOperatingSystem')), + 'title' => Piwik_Translate('UserSettings_OperatingSystems'), + 'related_reports' => $this->getOsRelatedReports() + )); } private function getDisplayPropertiesForGetOSFamily() { return array_merge($this->getBasicUserSettingsDisplayProperties(), array( - 'translations' => array('label' => Piwik_Translate('UserSettings_OperatingSystemFamily')), - 'title' => Piwik_Translate('UserSettings_OperatingSystemFamily'), - 'related_reports' => $this->getOsRelatedReports() - )); + 'translations' => array('label' => Piwik_Translate('UserSettings_OperatingSystemFamily')), + 'title' => Piwik_Translate('UserSettings_OperatingSystemFamily'), + 'related_reports' => $this->getOsRelatedReports() + )); } private function getDisplayPropertiesForGetBrowserVersion() { $result = array_merge($this->getBasicUserSettingsDisplayProperties(), array( - 'translations' => array('label' => Piwik_Translate('UserSettings_ColumnBrowserVersion')), - 'title' => Piwik_Translate('UserSettings_ColumnBrowserVersion'), - 'related_reports' => $this->getBrowserRelatedReports() - )); + 'translations' => array('label' => Piwik_Translate('UserSettings_ColumnBrowserVersion')), + 'title' => Piwik_Translate('UserSettings_ColumnBrowserVersion'), + 'related_reports' => $this->getBrowserRelatedReports() + )); $result['visualization_properties']['graph']['max_graph_elements'] = 7; return $result; } @@ -236,10 +236,10 @@ private function getDisplayPropertiesForGetBrowserVersion() private function getDisplayPropertiesForGetBrowser() { $result = array_merge($this->getBasicUserSettingsDisplayProperties(), array( - 'translations' => array('label' => Piwik_Translate('UserSettings_ColumnBrowser')), - 'title' => Piwik_Translate('UserSettings_Browsers'), - 'related_reports' => $this->getBrowserRelatedReports() - )); + 'translations' => array('label' => Piwik_Translate('UserSettings_ColumnBrowser')), + 'title' => Piwik_Translate('UserSettings_Browsers'), + 'related_reports' => $this->getBrowserRelatedReports() + )); $result['visualization_properties']['graph']['max_graph_elements'] = 7; return $result; } @@ -247,60 +247,60 @@ private function getDisplayPropertiesForGetBrowser() private function getDisplayPropertiesForGetBrowserType() { return array_merge($this->getBasicUserSettingsDisplayProperties(), array( - 'translations' => array('label' => Piwik_Translate('UserSettings_ColumnBrowserFamily')), - 'show_offset_information' => false, - 'show_pagination_control' => false, - 'show_limit_control' => false, - 'default_view_type' => 'graphPie', - )); + 'translations' => array('label' => Piwik_Translate('UserSettings_ColumnBrowserFamily')), + 'show_offset_information' => false, + 'show_pagination_control' => false, + 'show_limit_control' => false, + 'default_view_type' => 'graphPie', + )); } private function getDisplayPropertiesForGetWideScreen() { return array_merge($this->getBasicUserSettingsDisplayProperties(), array( - 'translations' => array('label' => Piwik_Translate('UserSettings_ColumnTypeOfScreen')), - 'show_offset_information' => false, - 'show_pagination_control' => false, - 'show_limit_control' => false, - 'title' => Piwik_Translate('UserSettings_ColumnTypeOfScreen'), - 'related_reports' => $this->getWideScreenDeviceTypeRelatedReports() - )); + 'translations' => array('label' => Piwik_Translate('UserSettings_ColumnTypeOfScreen')), + 'show_offset_information' => false, + 'show_pagination_control' => false, + 'show_limit_control' => false, + 'title' => Piwik_Translate('UserSettings_ColumnTypeOfScreen'), + 'related_reports' => $this->getWideScreenDeviceTypeRelatedReports() + )); } private function getDisplayPropertiesForGetMobileVsDesktop() { return array_merge($this->getBasicUserSettingsDisplayProperties(), array( - 'translations' => array('label' => Piwik_Translate('UserSettings_MobileVsDesktop')), - 'title' => Piwik_Translate('UserSettings_MobileVsDesktop'), - 'related_reports' => $this->getWideScreenDeviceTypeRelatedReports() - )); + 'translations' => array('label' => Piwik_Translate('UserSettings_MobileVsDesktop')), + 'title' => Piwik_Translate('UserSettings_MobileVsDesktop'), + 'related_reports' => $this->getWideScreenDeviceTypeRelatedReports() + )); } private function getDisplayPropertiesForGetPlugin() { return array_merge($this->getBasicUserSettingsDisplayProperties(), array( - 'translations' => array( - 'label' => Piwik_Translate('General_Plugin'), - 'nb_visits_percentage' => - str_replace(' ', ' ', Piwik_Translate('General_ColumnPercentageVisits')) - ), - 'show_offset_information' => false, - 'show_pagination_control' => false, - 'show_limit_control' => false, - 'show_all_views_icons' => false, - 'show_table_all_columns' => false, - 'columns_to_display' => array('label', 'nb_visits_percentage', 'nb_visits'), - 'filter_sort_column' => 'nb_visits_percentage', - 'filter_sort_order' => 'desc', - 'filter_limit' => 10, - 'show_footer_message' => Piwik_Translate('UserSettings_PluginDetectionDoesNotWorkInIE'), - )); + 'translations' => array( + 'label' => Piwik_Translate('General_Plugin'), + 'nb_visits_percentage' => + str_replace(' ', ' ', Piwik_Translate('General_ColumnPercentageVisits')) + ), + 'show_offset_information' => false, + 'show_pagination_control' => false, + 'show_limit_control' => false, + 'show_all_views_icons' => false, + 'show_table_all_columns' => false, + 'columns_to_display' => array('label', 'nb_visits_percentage', 'nb_visits'), + 'filter_sort_column' => 'nb_visits_percentage', + 'filter_sort_order' => 'desc', + 'filter_limit' => 10, + 'show_footer_message' => Piwik_Translate('UserSettings_PluginDetectionDoesNotWorkInIE'), + )); } private function getDisplayPropertiesForGetLanguage() { return array( - 'translations' => array('label' => Piwik_Translate('General_Language')), + 'translations' => array('label' => Piwik_Translate('General_Language')), 'filter_sort_column' => 'nb_visits', 'filter_sort_order' => 'desc', 'show_search' => false, @@ -313,14 +313,14 @@ private function getWideScreenDeviceTypeRelatedReports() { return array( 'UserSettings.getMobileVsDesktop' => Piwik_Translate('UserSettings_MobileVsDesktop'), - 'UserSettings.getWideScreen' => Piwik_Translate('UserSettings_ColumnTypeOfScreen') + 'UserSettings.getWideScreen' => Piwik_Translate('UserSettings_ColumnTypeOfScreen') ); } private function getBrowserRelatedReports() { return array( - 'UserSettings.getBrowser' => Piwik_Translate('UserSettings_Browsers'), + 'UserSettings.getBrowser' => Piwik_Translate('UserSettings_Browsers'), 'UserSettings.getBrowserVersion' => Piwik_Translate('UserSettings_ColumnBrowserVersion') ); } @@ -339,7 +339,7 @@ private function getBasicUserSettingsDisplayProperties() 'show_search' => false, 'show_exclude_low_population' => false, 'filter_limit' => 5, - 'visualization_properties' => array( + 'visualization_properties' => array( 'graph' => array( 'max_graph_elements' => 5 ) diff --git a/plugins/UserSettings/functions.php b/plugins/UserSettings/functions.php index 0075f634fb5..f2ae5f4f7a5 100644 --- a/plugins/UserSettings/functions.php +++ b/plugins/UserSettings/functions.php @@ -22,7 +22,7 @@ function getPluginsLogo($oldLabel) { - if($oldLabel == Piwik_Translate('General_Others')) { + if ($oldLabel == Piwik_Translate('General_Others')) { return false; } return 'plugins/UserSettings/images/plugins/' . $oldLabel . '.gif'; @@ -161,11 +161,11 @@ function getBrowserVersion($str) function getLogoImageFromId($dir, $id) { - $path = $dir.'/'.$id.'.gif'; + $path = $dir . '/' . $id . '.gif'; if (file_exists(PIWIK_INCLUDE_PATH . '/' . $path)) { return $path; } else { - return $dir.'/UNK.gif'; + return $dir . '/UNK.gif'; } } diff --git a/plugins/UsersManager/API.php b/plugins/UsersManager/API.php index 37e249a8e2e..e4356bf373f 100644 --- a/plugins/UsersManager/API.php +++ b/plugins/UsersManager/API.php @@ -117,7 +117,7 @@ private function getDefaultUserPreference($preferenceName, $login) /** * Returns the list of all the users * - * @param string $userLogins Comma separated list of users to select. If not specified, will return all users + * @param string $userLogins Comma separated list of users to select. If not specified, will return all users * @return array the list of all the users */ public function getUsers($userLogins = '') @@ -508,7 +508,7 @@ public function userEmailExists($userEmail) FROM " . Common::prefixTable("user") . " WHERE email = ?", $userEmail); return $count != 0 - || Config::getInstance()->superuser['email'] == $userEmail; + || Config::getInstance()->superuser['email'] == $userEmail; } /** @@ -659,12 +659,12 @@ private function deleteUserAccess($userLogin, $idSites = null) if (is_null($idSites)) { $db->query("DELETE FROM " . Common::prefixTable("access") . - " WHERE login = ?", + " WHERE login = ?", array($userLogin)); } else { foreach ($idSites as $idsite) { $db->query("DELETE FROM " . Common::prefixTable("access") . - " WHERE idsite = ? AND login = ?", + " WHERE idsite = ? AND login = ?", array($idsite, $userLogin) ); } diff --git a/plugins/VisitFrequency/API.php b/plugins/VisitFrequency/API.php index dfebebad126..18142916d7f 100644 --- a/plugins/VisitFrequency/API.php +++ b/plugins/VisitFrequency/API.php @@ -35,11 +35,11 @@ static public function getInstance() } /** - * @param int $idSite - * @param string $period - * @param string $date + * @param int $idSite + * @param string $period + * @param string $date * @param bool|string $segment - * @param bool|array $columns + * @param bool|array $columns * @return mixed */ public function get($idSite, $period, $date, $segment = false, $columns = false) diff --git a/plugins/VisitTime/API.php b/plugins/VisitTime/API.php index 3fb9c056b70..f87708e4efe 100644 --- a/plugins/VisitTime/API.php +++ b/plugins/VisitTime/API.php @@ -44,7 +44,7 @@ protected function getDataTable($name, $idSite, $period, $date, $segment) $archive = Archive::build($idSite, $period, $date, $segment); $dataTable = $archive->getDataTable($name); $dataTable->filter('Sort', array('label', 'asc', true)); - $dataTable->queueFilter('ColumnCallbackReplace', array('label', __NAMESPACE__ .'\getTimeLabel')); + $dataTable->queueFilter('ColumnCallbackReplace', array('label', __NAMESPACE__ . '\getTimeLabel')); $dataTable->queueFilter('ReplaceColumnNames'); return $dataTable; } @@ -131,9 +131,9 @@ public function getByDayOfWeek($idSite, $period, $date, $segment = false) /** * @param DataTable $table - * @param int $idSite - * @param string $period - * @param string $date + * @param int $idSite + * @param string $period + * @param string $date * @return mixed */ protected function removeHoursInFuture($table, $idSite, $period, $date) diff --git a/plugins/VisitTime/VisitTime.php b/plugins/VisitTime/VisitTime.php index f0f19f86853..5397ddd37a7 100644 --- a/plugins/VisitTime/VisitTime.php +++ b/plugins/VisitTime/VisitTime.php @@ -12,8 +12,8 @@ use Exception; use Piwik\ArchiveProcessor; -use Piwik\Common; +use Piwik\Common; use Piwik\Period; use Piwik\Site; use Piwik\WidgetsList; @@ -134,41 +134,41 @@ public function getReportDisplayProperties(&$properties) ); $properties['VisitTime.getVisitInformationPerServerTime'] = array_merge($commonProperties, array( - 'filter_limit' => 24, - 'show_goals' => true, - 'translations' => array('label' => Piwik_Translate('VisitTime_ColumnServerTime')), - 'request_parameters_to_modify' => array('hideFutureHoursWhenToday' => 1), - 'visualization_properties' => array( - 'graph' => array( - 'max_graph_elements' => false, - ) - ) - )); - + 'filter_limit' => 24, + 'show_goals' => true, + 'translations' => array('label' => Piwik_Translate('VisitTime_ColumnServerTime')), + 'request_parameters_to_modify' => array('hideFutureHoursWhenToday' => 1), + 'visualization_properties' => array( + 'graph' => array( + 'max_graph_elements' => false, + ) + ) + )); + $properties['VisitTime.getVisitInformationPerLocalTime'] = array_merge($commonProperties, array( - 'filter_limit' => 24, - 'title' => Piwik_Translate('VisitTime_ColumnLocalTime'), - 'translations' => array('label' => Piwik_Translate('VisitTime_LocalTime')), - 'visualization_properties' => array( - 'graph' => array( - 'max_graph_elements' => false, - ) - ) - )); - + 'filter_limit' => 24, + 'title' => Piwik_Translate('VisitTime_ColumnLocalTime'), + 'translations' => array('label' => Piwik_Translate('VisitTime_LocalTime')), + 'visualization_properties' => array( + 'graph' => array( + 'max_graph_elements' => false, + ) + ) + )); + $properties['VisitTime.getByDayOfWeek'] = array_merge($commonProperties, array( - 'filter_limit' => 7, - 'enable_sort' => false, - 'show_footer_message' => - Piwik_Translate('General_ReportGeneratedFrom', self::getDateRangeForFooterMessage()), - 'translations' => array('label' => Piwik_Translate('VisitTime_DayOfWeek')), - 'visualization_properties' => array( - 'graph' => array( - 'show_all_ticks' => true, - 'max_graph_elements' => false, - ) - ) - )); + 'filter_limit' => 7, + 'enable_sort' => false, + 'show_footer_message' => + Piwik_Translate('General_ReportGeneratedFrom', self::getDateRangeForFooterMessage()), + 'translations' => array('label' => Piwik_Translate('VisitTime_DayOfWeek')), + 'visualization_properties' => array( + 'graph' => array( + 'show_all_ticks' => true, + 'max_graph_elements' => false, + ) + ) + )); // add the visits by day of week as a related report, if the current period is not 'day' if (Common::getRequestVar('period', 'day') != 'day') { diff --git a/plugins/VisitorInterest/VisitorInterest.php b/plugins/VisitorInterest/VisitorInterest.php index 5806d150dc5..01207200042 100644 --- a/plugins/VisitorInterest/VisitorInterest.php +++ b/plugins/VisitorInterest/VisitorInterest.php @@ -11,8 +11,8 @@ namespace Piwik\Plugins\VisitorInterest; use Piwik\ArchiveProcessor; -use Piwik\FrontController; +use Piwik\FrontController; use Piwik\Metrics; use Piwik\WidgetsList; @@ -164,18 +164,18 @@ public function getReportDisplayProperties(&$properties) private function getDisplayPropertiesForGetNumberOfVisitsPerVisitDuration() { return array( - 'default_view_type' => 'cloud', - 'filter_sort_column' => 'label', - 'filter_sort_order' => 'asc', - 'translations' => array('label' => Piwik_Translate('VisitorInterest_ColumnVisitDuration')), - 'enable_sort' => false, + 'default_view_type' => 'cloud', + 'filter_sort_column' => 'label', + 'filter_sort_order' => 'asc', + 'translations' => array('label' => Piwik_Translate('VisitorInterest_ColumnVisitDuration')), + 'enable_sort' => false, 'show_exclude_low_population' => false, - 'show_offset_information' => false, - 'show_pagination_control' => false, - 'show_limit_control' => false, - 'show_search' => false, - 'show_table_all_columns' => false, - 'visualization_properties' => array( + 'show_offset_information' => false, + 'show_pagination_control' => false, + 'show_limit_control' => false, + 'show_search' => false, + 'show_table_all_columns' => false, + 'visualization_properties' => array( 'graph' => array( 'max_graph_elements' => 10 ) @@ -186,18 +186,18 @@ private function getDisplayPropertiesForGetNumberOfVisitsPerVisitDuration() private function getDisplayPropertiesForGetNumberOfVisitsPerPage() { return array( - 'default_view_type' => 'cloud', - 'filter_sort_column' => 'label', - 'filter_sort_order' => 'asc', - 'translations' => array('label' => Piwik_Translate('VisitorInterest_ColumnPagesPerVisit')), - 'enable_sort' => false, + 'default_view_type' => 'cloud', + 'filter_sort_column' => 'label', + 'filter_sort_order' => 'asc', + 'translations' => array('label' => Piwik_Translate('VisitorInterest_ColumnPagesPerVisit')), + 'enable_sort' => false, 'show_exclude_low_population' => false, - 'show_offset_information' => false, - 'show_pagination_control' => false, - 'show_limit_control' => false, - 'show_search' => false, - 'show_table_all_columns' => false, - 'visualization_properties' => array( + 'show_offset_information' => false, + 'show_pagination_control' => false, + 'show_limit_control' => false, + 'show_search' => false, + 'show_table_all_columns' => false, + 'visualization_properties' => array( 'graph' => array( 'max_graph_elements' => 10 ) diff --git a/plugins/VisitsSummary/API.php b/plugins/VisitsSummary/API.php index a0685029e37..3578d8f411b 100644 --- a/plugins/VisitsSummary/API.php +++ b/plugins/VisitsSummary/API.php @@ -40,7 +40,7 @@ public function get($idSite, $period, $date, $segment = false, $columns = false) { Piwik::checkUserHasViewAccess($idSite); $archive = Archive::build($idSite, $period, $date, $segment); - + // array values are comma separated $columns = Piwik::getArrayFromApiParameter($columns); $tempColumns = array();