diff --git a/plugins/PrivacyManager/tests/Integration/DataPurgingTest.php b/plugins/PrivacyManager/tests/Integration/DataPurgingTest.php index 2f9cd86bb05..af058533a77 100644 --- a/plugins/PrivacyManager/tests/Integration/DataPurgingTest.php +++ b/plugins/PrivacyManager/tests/Integration/DataPurgingTest.php @@ -528,7 +528,8 @@ public function testPurgeLogDataConcurrency() $this->unusedIdAction = Db::fetchOne( "SELECT idaction FROM " . Common::prefixTable('log_action') . " WHERE name = ?", - array('whatever.com/_40')); + array('whatever.com/_40') + ); $this->assertTrue($this->unusedIdAction > 0); // purge data @@ -541,7 +542,8 @@ public function testPurgeLogDataConcurrency() // check that the unused action still exists $count = Db::fetchOne( "SELECT COUNT(*) FROM " . Common::prefixTable('log_action') . " WHERE idaction = ?", - array($this->unusedIdAction)); + array($this->unusedIdAction) + ); $this->assertEquals(1, $count); $this->unusedIdAction = null; // so the hook won't get executed twice @@ -680,10 +682,21 @@ protected static function _addLogData() $t->doTrackContentImpression('SugarTransportAd', '/path/ad.jpg', 'http://www.satsumaprovince.jp'); $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.2)); - $t->addEcommerceItem($sku = 'SKU2', $name = 'Canon SLR', $category = 'Electronics & Cameras', - $price = 1500, $quantity = 1); - $t->doTrackEcommerceOrder($orderId = '937nsjusu ' . $dateTime, $grandTotal = 1111.11, $subTotal = 1000, - $tax = 111, $shipping = 0.11, $discount = 666); + $t->addEcommerceItem( + $sku = 'SKU2', + $name = 'Canon SLR', + $category = 'Electronics & Cameras', + $price = 1500, + $quantity = 1 + ); + $t->doTrackEcommerceOrder( + $orderId = '937nsjusu ' . $dateTime, + $grandTotal = 1111.11, + $subTotal = 1000, + $tax = 111, + $shipping = 0.11, + $discount = 666 + ); } Fixture::checkBulkTrackingResponse($t->doBulkTrack()); @@ -720,7 +733,10 @@ protected static function _addReportData() $archive->getNumeric('nb_visits'); APIVisitorInterest::getInstance()->getNumberOfVisitsPerVisitDuration( - self::$idSite, 'week', $dateTime); + self::$idSite, + 'week', + $dateTime + ); } // add segment for one day @@ -728,7 +744,11 @@ protected static function _addReportData() $archive->getNumeric('nb_visits', 'nb_hits'); APIVisitorInterest::getInstance()->getNumberOfVisitsPerVisitDuration( - self::$idSite, 'day', '2012-01-14', 'browserCode==FF'); + self::$idSite, + 'day', + '2012-01-14', + 'browserCode==FF' + ); // add range within January $rangeEnd = Date::factory('2012-01-29'); @@ -784,16 +804,24 @@ protected static function _addReportData() VALUES (10000,?,1,?,?,?,?,?)"; // one metric for jan & one for feb - Db::query(sprintf($sql, Common::prefixTable($archiveTables['numeric'][0])), - array(self::GARBAGE_FIELD, $janDate1, $janDate1, 1, $janDate1, 100)); - Db::query(sprintf($sql, Common::prefixTable($archiveTables['numeric'][1])), - array(self::GARBAGE_FIELD, $febDate1, $febDate1, 1, $febDate1, 200)); + Db::query( + sprintf($sql, Common::prefixTable($archiveTables['numeric'][0])), + array(self::GARBAGE_FIELD, $janDate1, $janDate1, 1, $janDate1, 100) + ); + Db::query( + sprintf($sql, Common::prefixTable($archiveTables['numeric'][1])), + array(self::GARBAGE_FIELD, $febDate1, $febDate1, 1, $febDate1, 200) + ); // add garbage reports - Db::query(sprintf($sql, Common::prefixTable($archiveTables['blob'][0])), - array(self::GARBAGE_FIELD, $janDate1, $janDate1, 10, $janDate1, 'blobval')); - Db::query(sprintf($sql, Common::prefixTable($archiveTables['blob'][1])), - array(self::GARBAGE_FIELD, $febDate1, $febDate1, 20, $febDate1, 'blobval')); + Db::query( + sprintf($sql, Common::prefixTable($archiveTables['blob'][0])), + array(self::GARBAGE_FIELD, $janDate1, $janDate1, 10, $janDate1, 'blobval') + ); + Db::query( + sprintf($sql, Common::prefixTable($archiveTables['blob'][1])), + array(self::GARBAGE_FIELD, $febDate1, $febDate1, 20, $febDate1, 'blobval') + ); } protected function _checkNoDataChanges() diff --git a/plugins/PrivacyManager/tests/System/PurgeDataTest.php b/plugins/PrivacyManager/tests/System/PurgeDataTest.php index 0f5a56056e1..5b15b16f1f7 100644 --- a/plugins/PrivacyManager/tests/System/PurgeDataTest.php +++ b/plugins/PrivacyManager/tests/System/PurgeDataTest.php @@ -201,8 +201,14 @@ private function purgeData($deleteReportsOlderThan, $reportPeriodsToKeep, $keepB $metricsToKeep = PrivacyManager::getAllMetricsToKeep(); $maxRowsToDeletePerQuery = 100000; - $purger = new ReportsPurger($deleteReportsOlderThan, $keepBasicMetrics, $reportPeriodsToKeep, - $keepSegmentReports, $metricsToKeep, $maxRowsToDeletePerQuery); + $purger = new ReportsPurger( + $deleteReportsOlderThan, + $keepBasicMetrics, + $reportPeriodsToKeep, + $keepSegmentReports, + $metricsToKeep, + $maxRowsToDeletePerQuery + ); $purger->getPurgeEstimate(); $purger->purgeData(); } diff --git a/plugins/Referrers/Categories/SearchEnginesSubcategory.php b/plugins/Referrers/Categories/SearchEnginesSubcategory.php index 65dad28d2c9..c15f29e6495 100644 --- a/plugins/Referrers/Categories/SearchEnginesSubcategory.php +++ b/plugins/Referrers/Categories/SearchEnginesSubcategory.php @@ -21,10 +21,13 @@ class SearchEnginesSubcategory extends Subcategory public function getHelp() { return '

' . Piwik::translate('Referrers_SearchEnginesSubcategoryHelp1') . '

' - . '

' . Piwik::translate('Referrers_SearchEnginesSubcategoryHelp2', + . '

' . Piwik::translate( + 'Referrers_SearchEnginesSubcategoryHelp2', ['', '', '', '']) . '

'; + . '" rel="noreferrer noopener" target="_blank">', + ''] + ) . '

'; } } diff --git a/plugins/Referrers/Reports/GetKeywordsFromCampaignId.php b/plugins/Referrers/Reports/GetKeywordsFromCampaignId.php index f97c216ea50..53d3ca745a6 100644 --- a/plugins/Referrers/Reports/GetKeywordsFromCampaignId.php +++ b/plugins/Referrers/Reports/GetKeywordsFromCampaignId.php @@ -20,8 +20,10 @@ protected function init() parent::init(); $this->dimension = new Keyword(); $this->name = Piwik::translate('Referrers_Campaigns'); - $this->documentation = Piwik::translate('Referrers_CampaignsReportDocumentation', - ['
', '', '']); + $this->documentation = Piwik::translate( + 'Referrers_CampaignsReportDocumentation', + ['
', '', ''] + ); $this->isSubtableReport = true; $this->order = 10; } diff --git a/plugins/Referrers/Reports/GetReferrerType.php b/plugins/Referrers/Reports/GetReferrerType.php index 5d41bd334ad..e2c2b04e386 100644 --- a/plugins/Referrers/Reports/GetReferrerType.php +++ b/plugins/Referrers/Reports/GetReferrerType.php @@ -27,12 +27,18 @@ protected function init() $this->name = Piwik::translate('Referrers_Type'); $this->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') . '"')) . '
' - . '' . Piwik::translate('Referrers_Websites') . ': ' . Piwik::translate('Referrers_WebsitesDocumentation', - array('
', '"' . Piwik::translate('Referrers_SubmenuWebsitesOnly') . '"')) . '
' - . '' . Piwik::translate('Referrers_Campaigns') . ': ' . Piwik::translate('Referrers_CampaignsDocumentation', - array('
', '"' . Piwik::translate('Referrers_Campaigns') . '"')); + . '' . Piwik::translate('Referrers_SearchEngines') . ': ' . Piwik::translate( + 'Referrers_SearchEnginesDocumentation', + array('
', '"' . Piwik::translate('Referrers_SubmenuSearchEngines') . '"') + ) . '
' + . '' . Piwik::translate('Referrers_Websites') . ': ' . Piwik::translate( + 'Referrers_WebsitesDocumentation', + array('
', '"' . Piwik::translate('Referrers_SubmenuWebsitesOnly') . '"') + ) . '
' + . '' . Piwik::translate('Referrers_Campaigns') . ': ' . Piwik::translate( + 'Referrers_CampaignsDocumentation', + array('
', '"' . Piwik::translate('Referrers_Campaigns') . '"') + ); $this->constantRowsCount = true; $this->hasGoalMetrics = true; $this->order = 1; diff --git a/plugins/ScheduledReports/Menu.php b/plugins/ScheduledReports/Menu.php index d6df3fd265d..5c8c443aa4a 100644 --- a/plugins/ScheduledReports/Menu.php +++ b/plugins/ScheduledReports/Menu.php @@ -22,7 +22,8 @@ public function configureAdminMenu(MenuAdmin $menu) { $tooltip = Piwik::translate( \Piwik\Plugin\Manager::getInstance()->isPluginActivated('MobileMessaging') - ? 'MobileMessaging_TopLinkTooltip' : 'ScheduledReports_TopLinkTooltip'); + ? 'MobileMessaging_TopLinkTooltip' : 'ScheduledReports_TopLinkTooltip' + ); $menu->addPersonalItem( $this->getTopMenuTranslationKey(), diff --git a/plugins/ScheduledReports/tests/Integration/ApiTest.php b/plugins/ScheduledReports/tests/Integration/ApiTest.php index 9bbeca63c1d..781fd9a3cf0 100644 --- a/plugins/ScheduledReports/tests/Integration/ApiTest.php +++ b/plugins/ScheduledReports/tests/Integration/ApiTest.php @@ -116,8 +116,15 @@ public function getAttachments($report, $processedReports, $prettyDate) }); $idReport = APIScheduledReports::getInstance()->addReport( - $this->idSite, 'send report', 'never', 6, 'dummyreporttype', 'dummyreportformat', - $reportIds, [ScheduledReports::DISPLAY_FORMAT_PARAMETER => ScheduledReports::DISPLAY_FORMAT_TABLES_ONLY]); + $this->idSite, + 'send report', + 'never', + 6, + 'dummyreporttype', + 'dummyreportformat', + $reportIds, + [ScheduledReports::DISPLAY_FORMAT_PARAMETER => ScheduledReports::DISPLAY_FORMAT_TABLES_ONLY] + ); $eventCalledWith = []; Piwik::addAction(APIScheduledReports::SEND_REPORT_EVENT, function ( @@ -436,7 +443,8 @@ public function testGetScheduledTasks() ->disableOriginalConstructor() ->getMock(); $stubbedAPIScheduledReports->expects($this->any())->method('getReports')->will($this->returnValue( - array($report1, $report2, $report3, $report4, $report5, $report6))); + array($report1, $report2, $report3, $report4, $report5, $report6) + )); \Piwik\Plugins\ScheduledReports\API::setSingletonInstance($stubbedAPIScheduledReports); // initialize sites 1 and 2 @@ -498,7 +506,8 @@ public function getGetReportSubjectAndReportTitleTestCases() public function testGetReportSubjectAndReportTitle($expectedReportSubject, $expectedReportTitle, $websiteName, $reports) { $getReportSubjectAndReportTitle = new ReflectionMethod( - '\\Piwik\\Plugins\\ScheduledReports\\API', 'getReportSubjectAndReportTitle' + '\\Piwik\\Plugins\\ScheduledReports\\API', + 'getReportSubjectAndReportTitle' ); $getReportSubjectAndReportTitle->setAccessible(true); @@ -549,8 +558,12 @@ public function test_generateReport_CatchesIndividualReportProcessExceptions_Wit ); ob_start(); - $result = APIScheduledReports::getInstance()->generateReport($idReport, Date::factory('now')->toString(), - $language = false, $outputType = APIScheduledReports::OUTPUT_RETURN); + $result = APIScheduledReports::getInstance()->generateReport( + $idReport, + Date::factory('now')->toString(), + $language = false, + $outputType = APIScheduledReports::OUTPUT_RETURN + ); ob_end_clean(); self::assertStringContainsString('id="VisitsSummary_get"', $result); @@ -578,8 +591,12 @@ public function test_generateReport_throwsIfMultiplePeriodsRequested() array(ScheduledReports::DISPLAY_FORMAT_PARAMETER => ScheduledReports::DISPLAY_FORMAT_TABLES_ONLY) ); - APIScheduledReports::getInstance()->generateReport($idReport, '2012-03-03,2012-03-23', - $language = false, $outputType = APIScheduledReports::OUTPUT_RETURN); + APIScheduledReports::getInstance()->generateReport( + $idReport, + '2012-03-03,2012-03-23', + $language = false, + $outputType = APIScheduledReports::OUTPUT_RETURN + ); } public function test_generateReport_throwsIfInvalidDateRequested(): void @@ -1002,7 +1019,8 @@ private static function updateReport($idReport, $data) $data['type'], $data['format'], $data['reports'], - $data['parameters']); + $data['parameters'] + ); return $idReport; } diff --git a/plugins/SegmentEditor/SegmentQueryDecorator.php b/plugins/SegmentEditor/SegmentQueryDecorator.php index 0d045833a30..1caa1671ab9 100644 --- a/plugins/SegmentEditor/SegmentQueryDecorator.php +++ b/plugins/SegmentEditor/SegmentQueryDecorator.php @@ -43,8 +43,16 @@ public function getSelectQueryString( $orderBy, $limit ) { - $result = parent::getSelectQueryString($segmentExpression, $select, $from, $where, $bind, $groupBy, $orderBy, - $limit); + $result = parent::getSelectQueryString( + $segmentExpression, + $select, + $from, + $where, + $bind, + $groupBy, + $orderBy, + $limit + ); $prefixParts = array(); diff --git a/plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php b/plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php index 35d2d875d99..49219149f7c 100644 --- a/plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php +++ b/plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php @@ -156,7 +156,8 @@ public function test_UpdateSegment() 'login' => Piwik::getCurrentUserLogin(), 'deleted' => '0', ); - API::getInstance()->update($idSegment2, + API::getInstance()->update( + $idSegment2, $updatedSegment['name'], $updatedSegment['definition'], $updatedSegment['enable_only_idsite'], diff --git a/plugins/SegmentEditor/tests/Integration/SegmentQueryDecoratorTest.php b/plugins/SegmentEditor/tests/Integration/SegmentQueryDecoratorTest.php index 7cc9158cd0b..3cd8bec568f 100644 --- a/plugins/SegmentEditor/tests/Integration/SegmentQueryDecoratorTest.php +++ b/plugins/SegmentEditor/tests/Integration/SegmentQueryDecoratorTest.php @@ -35,13 +35,15 @@ public function setUp(): void Fixture::createWebsite('2011-01-01'); $this->segmentQueryDecorator = self::$fixture->piwikEnvironment->getContainer()->get( - 'Piwik\Plugins\SegmentEditor\SegmentQueryDecorator'); + 'Piwik\Plugins\SegmentEditor\SegmentQueryDecorator' + ); Rules::setBrowserTriggerArchiving(false); /** @var API $segmentEditorApi */ $segmentEditorApi = self::$fixture->piwikEnvironment->getContainer()->get( - 'Piwik\Plugins\SegmentEditor\API'); + 'Piwik\Plugins\SegmentEditor\API' + ); $segmentEditorApi->add('segment 1', 'visitCount<2', $idSite = false, $autoArchive = true); $segmentEditorApi->add('segment 2', 'countryCode==fr', $idSite = false, $autoArchive = true); $segmentEditorApi->add('segment 3', 'visitCount<2', 1, $autoArchive = true); diff --git a/plugins/SegmentEditor/tests/System/UnprocessedSegmentsTest.php b/plugins/SegmentEditor/tests/System/UnprocessedSegmentsTest.php index b6627a9e26a..a8c0ed89d33 100644 --- a/plugins/SegmentEditor/tests/System/UnprocessedSegmentsTest.php +++ b/plugins/SegmentEditor/tests/System/UnprocessedSegmentsTest.php @@ -118,8 +118,12 @@ public function test_apiOutput_whenPreprocessedSegmentUsed_WithBrowserArchivingD $this->assertNotEmpty($storedSegment); Rules::setBrowserTriggerArchiving(true); - VisitsSummary\API::getInstance()->get(self::$fixture->idSite, 'week', - Date::factory(self::$fixture->dateTime)->toString(), self::TEST_SEGMENT); // archive (make sure there's data for actual test) + VisitsSummary\API::getInstance()->get( + self::$fixture->idSite, + 'week', + Date::factory(self::$fixture->dateTime)->toString(), + self::TEST_SEGMENT + ); // archive (make sure there's data for actual test) Rules::setBrowserTriggerArchiving(false); $segments = Rules::getSegmentsToProcess([self::$fixture->idSite]); @@ -135,8 +139,12 @@ public function test_apiOutput_whenPreprocessedSegmentUsed_WithBrowserArchivingD public function test_apiOutput_whenPreprocessedCustomSegmentUsed_WithBrowserArchivingDisabled() { - VisitsSummary\API::getInstance()->get(self::$fixture->idSite, 'week', - Date::factory(self::$fixture->dateTime)->toString(), self::TEST_SEGMENT); // archive + VisitsSummary\API::getInstance()->get( + self::$fixture->idSite, + 'week', + Date::factory(self::$fixture->dateTime)->toString(), + self::TEST_SEGMENT + ); // archive Rules::setBrowserTriggerArchiving(false); @@ -162,8 +170,12 @@ public function test_apiOutput_whenPreprocessedSegmentUsed_WithNoData_AndBrowser $storedSegment = API::getInstance()->get($idSegment); $this->assertNotEmpty($storedSegment); - VisitsSummary\API::getInstance()->get(self::$fixture->idSite, 'week', - Date::factory(self::$fixture->dateTime)->toString(), self::TEST_SEGMENT); // archive + VisitsSummary\API::getInstance()->get( + self::$fixture->idSite, + 'week', + Date::factory(self::$fixture->dateTime)->toString(), + self::TEST_SEGMENT + ); // archive $segments = Rules::getSegmentsToProcess([self::$fixture->idSite]); self::assertTrue(in_array(self::TEST_SEGMENT, $segments)); diff --git a/plugins/SitesManager/Controller.php b/plugins/SitesManager/Controller.php index ce75d784763..4bf24aa974d 100644 --- a/plugins/SitesManager/Controller.php +++ b/plugins/SitesManager/Controller.php @@ -289,8 +289,10 @@ private function getGoogleAnalyticsImporterInstruction() 'id' => 'GoogleAnalyticsImporter', 'name' => Piwik::translate('CoreAdminHome_ImportFromGoogleAnalytics'), 'type' => SiteContentDetectionAbstract::TYPE_OTHER, - 'othersInstruction' => Piwik::translate('CoreAdminHome_ImportFromGoogleAnalyticsDescription', - ['', '']), + 'othersInstruction' => Piwik::translate( + 'CoreAdminHome_ImportFromGoogleAnalyticsDescription', + ['', ''] + ), ]; } @@ -321,29 +323,37 @@ private function renderOthersTab($othersInstructions): string 'id' => 'ImageTracking', 'name' => Piwik::translate('CoreAdminHome_ImageTracking'), 'type' => SiteContentDetectionAbstract::TYPE_OTHER, - 'othersInstruction' => Piwik::translate('SitesManager_ImageTrackingDescription', - ['', '']), + 'othersInstruction' => Piwik::translate( + 'SitesManager_ImageTrackingDescription', + ['', ''] + ), ], [ 'id' => 'LogAnalytics', 'name' => Piwik::translate('SitesManager_LogAnalytics'), 'type' => SiteContentDetectionAbstract::TYPE_OTHER, - 'othersInstruction' => Piwik::translate('SitesManager_LogAnalyticsDescription', - ['', '']), + 'othersInstruction' => Piwik::translate( + 'SitesManager_LogAnalyticsDescription', + ['', ''] + ), ], [ 'id' => 'MobileAppsAndSDKs', 'name' => Piwik::translate('SitesManager_MobileAppsAndSDKs'), 'type' => SiteContentDetectionAbstract::TYPE_OTHER, - 'othersInstruction' => Piwik::translate('SitesManager_MobileAppsAndSDKsDescription', - ['', '']), + 'othersInstruction' => Piwik::translate( + 'SitesManager_MobileAppsAndSDKsDescription', + ['', ''] + ), ], [ 'id' => 'HttpTrackingApi', 'name' => Piwik::translate('CoreAdminHome_HttpTrackingApi'), 'type' => SiteContentDetectionAbstract::TYPE_OTHER, - 'othersInstruction' => Piwik::translate('CoreAdminHome_HttpTrackingApiDescription', - ['', '']), + 'othersInstruction' => Piwik::translate( + 'CoreAdminHome_HttpTrackingApiDescription', + ['', ''] + ), ] ); diff --git a/plugins/SitesManager/Model.php b/plugins/SitesManager/Model.php index a2e472b7265..dc1b33d4369 100644 --- a/plugins/SitesManager/Model.php +++ b/plugins/SitesManager/Model.php @@ -151,10 +151,11 @@ public function getSitesIdFromSiteUrlHavingAccess($login, $urls) WHERE url IN ( ' . Common::getSqlStringFieldsArray($urls) . ')' . 'AND idsite IN (' . $sqlAccessSite . ')', // Bind - array_merge( $urls, - array( $login ), - $urls, - array( $login ) + array_merge( + $urls, + array( $login ), + $urls, + array( $login ) ) ); diff --git a/plugins/SitesManager/SiteContentDetection/MatomoTagManager.php b/plugins/SitesManager/SiteContentDetection/MatomoTagManager.php index d6654e59f94..42028ce54ee 100644 --- a/plugins/SitesManager/SiteContentDetection/MatomoTagManager.php +++ b/plugins/SitesManager/SiteContentDetection/MatomoTagManager.php @@ -51,7 +51,9 @@ public function isDetected(?string $data = null, ?array $headers = null): bool public function renderInstructionsTab(SiteContentDetector $detector): string { return '

' . Piwik::translate('SitesManager_SiteWithoutDataMatomoTagManager') . '

-

' . Piwik::translate( 'SitesManager_SiteWithoutDataMatomoTagManagerNotActive', - ['', '']) . '

'; +

' . Piwik::translate( + 'SitesManager_SiteWithoutDataMatomoTagManagerNotActive', + ['', ''] + ) . '

'; } } diff --git a/plugins/TestRunner/Commands/CodeCoverage.php b/plugins/TestRunner/Commands/CodeCoverage.php index f6916994c7d..674c32b6472 100644 --- a/plugins/TestRunner/Commands/CodeCoverage.php +++ b/plugins/TestRunner/Commands/CodeCoverage.php @@ -66,10 +66,12 @@ protected function doExecute(): int $xdebugFile = trim($extensionDir) . DIRECTORY_SEPARATOR . 'xdebug.so'; if (!file_exists($xdebugFile)) { - $xdebugFile = $this->askAndValidate('xdebug not found. Please provide path to xdebug.so', + $xdebugFile = $this->askAndValidate( + 'xdebug not found. Please provide path to xdebug.so', function ($xdebugFile) { return file_exists($xdebugFile); - }); + } + ); } else { $output->writeln('xdebug extension found in extension path.'); diff --git a/plugins/TestRunner/Commands/TestsRun.php b/plugins/TestRunner/Commands/TestsRun.php index c3b43424fe7..8624ab31b8a 100644 --- a/plugins/TestRunner/Commands/TestsRun.php +++ b/plugins/TestRunner/Commands/TestsRun.php @@ -74,10 +74,12 @@ protected function doExecute(): int $xdebugFile = trim($extensionDir) . DIRECTORY_SEPARATOR . 'xdebug.so'; if (!file_exists($xdebugFile)) { - $xdebugFile = $this->askAndValidate('xdebug not found. Please provide path to xdebug.so', + $xdebugFile = $this->askAndValidate( + 'xdebug not found. Please provide path to xdebug.so', function ($xdebugFile) { return file_exists($xdebugFile); - }); + } + ); } else { $output->writeln('xdebug extension found in extension path.'); diff --git a/plugins/TestRunner/Commands/TestsSetupFixture.php b/plugins/TestRunner/Commands/TestsSetupFixture.php index a4b7013eafa..202347fc52f 100644 --- a/plugins/TestRunner/Commands/TestsSetupFixture.php +++ b/plugins/TestRunner/Commands/TestsSetupFixture.php @@ -49,41 +49,82 @@ protected function configure() $this->setName('tests:setup-fixture'); $this->setDescription('Create a database and fill it with data using a Piwik test fixture.'); - $this->addRequiredArgument('fixture', + $this->addRequiredArgument( + 'fixture', "The class name of the fixture to apply. Doesn't need to have a namespace if it exists in the " . - "Piwik\\Tests\\Fixtures namespace."); - - $this->addRequiredValueOption('db-name', null, - "The name of the database that will contain the fixture data. This option is required to be set."); - $this->addRequiredValueOption('file', null, - "The file location of the fixture. If this option is included the file will be required explicitly."); - $this->addRequiredValueOption('db-host', null, - "The hostname of the MySQL database to use. Uses the default config value if not specified."); - $this->addRequiredValueOption('db-user', null, - "The name of the MySQL user to use. Uses the default config value if not specified."); - $this->addRequiredValueOption('db-pass', null, - "The MySQL user password to use. Uses the default config value if not specified."); - $this->addNoValueOption('teardown', null, + "Piwik\\Tests\\Fixtures namespace." + ); + + $this->addRequiredValueOption( + 'db-name', + null, + "The name of the database that will contain the fixture data. This option is required to be set." + ); + $this->addRequiredValueOption( + 'file', + null, + "The file location of the fixture. If this option is included the file will be required explicitly." + ); + $this->addRequiredValueOption( + 'db-host', + null, + "The hostname of the MySQL database to use. Uses the default config value if not specified." + ); + $this->addRequiredValueOption( + 'db-user', + null, + "The name of the MySQL user to use. Uses the default config value if not specified." + ); + $this->addRequiredValueOption( + 'db-pass', + null, + "The MySQL user password to use. Uses the default config value if not specified." + ); + $this->addNoValueOption( + 'teardown', + null, "If specified, the fixture will be torn down and the database deleted. Won't work if the --db-name " . - "option isn't supplied."); - $this->addNoValueOption('persist-fixture-data', null, + "option isn't supplied." + ); + $this->addNoValueOption( + 'persist-fixture-data', + null, "If specified, the database will not be dropped after the fixture is setup. If the database already " . - "and the fixture was successfully setup before, nothing will happen."); - $this->addNoValueOption('drop', null, + "and the fixture was successfully setup before, nothing will happen." + ); + $this->addNoValueOption( + 'drop', + null, "Forces the database to be dropped before setting up the fixture. Should be used in conjunction with" . - " --persist-fixture-data when updating a pre-existing test database."); - $this->addRequiredValueOption('sqldump', null, - "Creates an SQL dump after setting up the fixture and outputs the dump to the file specified by this option."); - $this->addNoValueOption('save-config', null, + " --persist-fixture-data when updating a pre-existing test database." + ); + $this->addRequiredValueOption( + 'sqldump', + null, + "Creates an SQL dump after setting up the fixture and outputs the dump to the file specified by this option." + ); + $this->addNoValueOption( + 'save-config', + null, "Saves the current configuration file as a config for a new Piwik domain. For example save-config --matomo-domain=mytest.localhost.com will create " - . "a mytest.config.ini.php file in the config/ directory. Using /etc/hosts you can redirect to 127.0.0.1 and use the saved " - . "config."); - $this->addNoValueOption('set-symlinks', null, - "Used by UI tests. Creates symlinks to root directory in tests/PHPUnit/proxy."); - $this->addRequiredValueOption('server-global', null, - "Used by UI tests. Sets the \$_SERVER global variable from a JSON string."); - $this->addRequiredValueOption('plugins', null, - "Used by UI tests. Comma separated list of plugin names to activate and install when setting up a fixture."); + . "a mytest.config.ini.php file in the config/ directory. Using /etc/hosts you can redirect to 127.0.0.1 and use the saved " + . "config." + ); + $this->addNoValueOption( + 'set-symlinks', + null, + "Used by UI tests. Creates symlinks to root directory in tests/PHPUnit/proxy." + ); + $this->addRequiredValueOption( + 'server-global', + null, + "Used by UI tests. Sets the \$_SERVER global variable from a JSON string." + ); + $this->addRequiredValueOption( + 'plugins', + null, + "Used by UI tests. Comma separated list of plugin names to activate and install when setting up a fixture." + ); $this->addNoValueOption('enable-logging', null, 'If enabled, tests will log to the configured log file.'); } diff --git a/plugins/Transitions/API.php b/plugins/Transitions/API.php index f3a3881e461..5c054c8b307 100644 --- a/plugins/Transitions/API.php +++ b/plugins/Transitions/API.php @@ -243,7 +243,12 @@ private function addFollowingActions($logAggregator, &$report, $idaction, $actio { $data = $this->queryFollowingActions( - $idaction, $actionType, $logAggregator, $limitBeforeGrouping, $includeLoops); + $idaction, + $actionType, + $logAggregator, + $limitBeforeGrouping, + $includeLoops + ); foreach ($data as $tableName => $table) { $report[$tableName] = $table; @@ -587,7 +592,11 @@ protected function getTotalTransitionsToFollowingActions() private function addExternalReferrers($logAggregator, &$report, $idaction, $actionType, $limitBeforeGrouping) { $data = $this->queryExternalReferrers( - $idaction, $actionType, $logAggregator, $limitBeforeGrouping); + $idaction, + $actionType, + $logAggregator, + $limitBeforeGrouping + ); $report['pageMetrics']['entries'] = 0; $report['referrers'] = array(); diff --git a/plugins/Transitions/tests/Integration/TransitionsMaxAllowedPeriodTest.php b/plugins/Transitions/tests/Integration/TransitionsMaxAllowedPeriodTest.php index f430ad8f189..81603377f65 100644 --- a/plugins/Transitions/tests/Integration/TransitionsMaxAllowedPeriodTest.php +++ b/plugins/Transitions/tests/Integration/TransitionsMaxAllowedPeriodTest.php @@ -52,8 +52,13 @@ public function test_ShouldThrowException_IfPeriodNotAllowed() Config::setSetting('Transitions_1', 'max_period_allowed', $period); foreach ($invalids as $ip) { try { - $this->api->getTransitionsForAction('http://example.org/page/one.html', 'url', - 1, $ip, '2012-08-09'); + $this->api->getTransitionsForAction( + 'http://example.org/page/one.html', + 'url', + 1, + $ip, + '2012-08-09' + ); $this->fail("Failed asserting that exception 'PeriodNotAllowed' was thrown"); } catch (\Exception $e) { $this->assertEquals('PeriodNotAllowed', $e->getMessage()); @@ -74,8 +79,13 @@ public function test_ShouldReturnData_IfPeriodAllowed() foreach ($validPeriods as $period => $valids) { Config::setSetting('Transitions_1', 'max_period_allowed', $period); foreach ($valids as $vp) { - $r = $this->api->getTransitionsForAction('http://example.org/page/one.html', 'url', - 1, $vp, '2012-08-09'); + $r = $this->api->getTransitionsForAction( + 'http://example.org/page/one.html', + 'url', + 1, + $vp, + '2012-08-09' + ); self::assertEquals(1, $r['pageMetrics']['pageviews']); } } @@ -85,14 +95,28 @@ public function test_ShouldThrowException_IfInvalidLimitBeforeGroup() { $this->expectException(\Exception::class); $this->expectExceptionMessage('limitBeforeGrouping has to be an integer.'); - $this->api->getTransitionsForAction('http://example.org/page/one.html', 'url', 1, - 'range', '2012-08-09,2012-08-10', false, 'all'); + $this->api->getTransitionsForAction( + 'http://example.org/page/one.html', + 'url', + 1, + 'range', + '2012-08-09,2012-08-10', + false, + 'all' + ); } public function test_ShouldPass_IfLimitBeforeGroupPassingIntAsString() { - $report = $this->api->getTransitionsForAction('http://example.org/page/one.html', 'url', 1, - 'range', '2012-08-09,2012-08-10', false, '100'); + $report = $this->api->getTransitionsForAction( + 'http://example.org/page/one.html', + 'url', + 1, + 'range', + '2012-08-09,2012-08-10', + false, + '100' + ); $this->assertIsArray($report); } @@ -101,8 +125,13 @@ public function test_ShouldThrowException_IfRangeDayCountIsLargerThanDayPeriod() Config::setSetting('Transitions_1', 'max_period_allowed', 'day'); $this->expectException(\Exception::class); $this->expectExceptionMessage('PeriodNotAllowed'); - $this->api->getTransitionsForAction('http://example.org/page/one.html', 'url', 1, - 'range', '2012-08-09,2012-08-10'); + $this->api->getTransitionsForAction( + 'http://example.org/page/one.html', + 'url', + 1, + 'range', + '2012-08-09,2012-08-10' + ); } public function test_ShouldThrowException_IfRangeDayCountIsLargerThanWeekPeriod() @@ -110,8 +139,13 @@ public function test_ShouldThrowException_IfRangeDayCountIsLargerThanWeekPeriod( Config::setSetting('Transitions_1', 'max_period_allowed', 'day'); $this->expectException(\Exception::class); $this->expectExceptionMessage('PeriodNotAllowed'); - $this->api->getTransitionsForAction('http://example.org/page/one.html', 'url', 1, - 'range', '2012-08-09,2012-08-17'); + $this->api->getTransitionsForAction( + 'http://example.org/page/one.html', + 'url', + 1, + 'range', + '2012-08-09,2012-08-17' + ); } public function test_ShouldThrowException_IfRangeDayCountIsLargerThanMonthPeriod() @@ -119,8 +153,13 @@ public function test_ShouldThrowException_IfRangeDayCountIsLargerThanMonthPeriod Config::setSetting('Transitions_1', 'max_period_allowed', 'day'); $this->expectException(\Exception::class); $this->expectExceptionMessage('PeriodNotAllowed'); - $this->api->getTransitionsForAction('http://example.org/page/one.html', 'url', 1, - 'range', '2012-08-09,2012-09-10'); + $this->api->getTransitionsForAction( + 'http://example.org/page/one.html', + 'url', + 1, + 'range', + '2012-08-09,2012-09-10' + ); } public function test_ShouldThrowException_IfRangeDayCountIsLargerThanYearPeriod() @@ -128,8 +167,13 @@ public function test_ShouldThrowException_IfRangeDayCountIsLargerThanYearPeriod( Config::setSetting('Transitions_1', 'max_period_allowed', 'day'); $this->expectException(\Exception::class); $this->expectExceptionMessage('PeriodNotAllowed'); - $this->api->getTransitionsForAction('http://example.org/page/one.html', 'url', 1, - 'range', '2012-08-09,2013-08-10'); + $this->api->getTransitionsForAction( + 'http://example.org/page/one.html', + 'url', + 1, + 'range', + '2012-08-09,2013-08-10' + ); } public function test_ShouldUseSiteConfigInsteadOfGeneral_IfSiteConfigExists() diff --git a/plugins/TwoFactorAuth/Controller.php b/plugins/TwoFactorAuth/Controller.php index 877db981398..da80ab6d6e8 100644 --- a/plugins/TwoFactorAuth/Controller.php +++ b/plugins/TwoFactorAuth/Controller.php @@ -284,8 +284,10 @@ public function showRecoveryCodes() $this->validator->check2FaEnabled(); $regenerateNonce = Common::getRequestVar('regenerateNonce', '', 'string', $_POST); - $postedValidNonce = !empty($regenerateNonce) && Nonce::verifyNonce(self::REGENERATE_CODES_2FA_NONCE, - $regenerateNonce); + $postedValidNonce = !empty($regenerateNonce) && Nonce::verifyNonce( + self::REGENERATE_CODES_2FA_NONCE, + $regenerateNonce + ); $regenerateSuccess = false; $regenerateError = false; diff --git a/plugins/TwoFactorAuth/FormTwoFactorAuthCode.php b/plugins/TwoFactorAuth/FormTwoFactorAuthCode.php index e621d7846ee..0abd0dae803 100644 --- a/plugins/TwoFactorAuth/FormTwoFactorAuthCode.php +++ b/plugins/TwoFactorAuth/FormTwoFactorAuthCode.php @@ -23,8 +23,10 @@ function __construct($id = 'login_form', $method = 'post', $attributes = null, $ function init() { $this->addElement('text', 'form_authcode') - ->addRule('required', - Piwik::translate('General_Required', 'Authentication code')); + ->addRule( + 'required', + Piwik::translate('General_Required', 'Authentication code') + ); $this->addElement('hidden', 'form_nonce'); diff --git a/plugins/TwoFactorAuth/tests/Fixtures/TwoFactorFixture.php b/plugins/TwoFactorAuth/tests/Fixtures/TwoFactorFixture.php index ad62829d44d..9d38705bdc2 100644 --- a/plugins/TwoFactorAuth/tests/Fixtures/TwoFactorFixture.php +++ b/plugins/TwoFactorAuth/tests/Fixtures/TwoFactorFixture.php @@ -70,8 +70,11 @@ public function setUpWebsite() public function setUpUsers() { - \Piwik\Plugins\UsersManager\API::getInstance()->addUser($this->superUserWith2Fa, $this->userPassword, - $this->superUserWith2Fa . '@matomo.org'); + \Piwik\Plugins\UsersManager\API::getInstance()->addUser( + $this->superUserWith2Fa, + $this->userPassword, + $this->superUserWith2Fa . '@matomo.org' + ); $userUpdater = new UserUpdater(); $userUpdater->setSuperUserAccessWithoutCurrentPassword($this->superUserWith2Fa, true); diff --git a/plugins/UserCountry/API.php b/plugins/UserCountry/API.php index dce75bbe7bf..05ae0ab50c2 100644 --- a/plugins/UserCountry/API.php +++ b/plugins/UserCountry/API.php @@ -107,8 +107,11 @@ function ($label) use ($separator, $unk) { $regionCode = getElementFromStringArray($label, $separator, 0, ''); $countryCode = getElementFromStringArray($label, $separator, 1, ''); - list($countryCode, $regionCode) = GeoIp2::convertRegionCodeToIso($countryCode, - $regionCode, true); + list($countryCode, $regionCode) = GeoIp2::convertRegionCodeToIso( + $countryCode, + $regionCode, + true + ); $splitLabel = explode($separator, $label); @@ -140,19 +143,27 @@ function ($label) { $dataTable->filter('AddSegmentByLabel', array($segments, Archiver::LOCATION_SEPARATOR)); // split the label and put the elements into the 'region' and 'country' metadata fields - $dataTable->filter('ColumnCallbackAddMetadata', - array('label', 'region', __NAMESPACE__ . '\getElementFromStringArray', array($separator, 0, $unk))); - $dataTable->filter('ColumnCallbackAddMetadata', - array('label', 'country', __NAMESPACE__ . '\getElementFromStringArray', array($separator, 1, $unk))); + $dataTable->filter( + 'ColumnCallbackAddMetadata', + array('label', 'region', __NAMESPACE__ . '\getElementFromStringArray', array($separator, 0, $unk)) + ); + $dataTable->filter( + 'ColumnCallbackAddMetadata', + array('label', 'country', __NAMESPACE__ . '\getElementFromStringArray', array($separator, 1, $unk)) + ); // add country name metadata - $dataTable->filter('MetadataCallbackAddMetadata', - array('country', 'country_name', __NAMESPACE__ . '\CountryTranslate', $applyToSummaryRow = false)); + $dataTable->filter( + 'MetadataCallbackAddMetadata', + array('country', 'country_name', __NAMESPACE__ . '\CountryTranslate', $applyToSummaryRow = false) + ); // get the region name of each row and put it into the 'region_name' metadata - $dataTable->filter('ColumnCallbackAddMetadata', + $dataTable->filter( + 'ColumnCallbackAddMetadata', array('label', 'region_name', __NAMESPACE__ . '\getRegionName', $params = null, - $applyToSummaryRow = false)); + $applyToSummaryRow = false) + ); // add the country flag as a url to the 'logo' metadata field $dataTable->filter('MetadataCallbackAddMetadata', array('country', 'logo', __NAMESPACE__ . '\getFlagFromCode')); @@ -192,8 +203,11 @@ function ($label) use ($separator, $unk) { $regionCode = getElementFromStringArray($label, $separator, 1, ''); $countryCode = getElementFromStringArray($label, $separator, 2, ''); - list($countryCode, $regionCode) = GeoIp2::convertRegionCodeToIso($countryCode, - $regionCode, true); + list($countryCode, $regionCode) = GeoIp2::convertRegionCodeToIso( + $countryCode, + $regionCode, + true + ); $splitLabel = explode($separator, $label); @@ -227,31 +241,45 @@ function ($label) { // split the label and put the elements into the 'city_name', 'region', 'country', // 'lat' & 'long' metadata fields $strUnknown = Piwik::translate('General_Unknown'); - $dataTable->filter('ColumnCallbackAddMetadata', + $dataTable->filter( + 'ColumnCallbackAddMetadata', array('label', 'city_name', __NAMESPACE__ . '\getElementFromStringArray', - array($separator, 0, $strUnknown))); - $dataTable->filter('MetadataCallbackAddMetadata', + array($separator, 0, $strUnknown)) + ); + $dataTable->filter( + 'MetadataCallbackAddMetadata', 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', - array('label', 'country', __NAMESPACE__ . '\getElementFromStringArray', array($separator, 2, $unk))); + }) + ); + $dataTable->filter( + 'ColumnCallbackAddMetadata', + array('label', 'region', __NAMESPACE__ . '\getElementFromStringArray', array($separator, 1, $unk)) + ); + $dataTable->filter( + 'ColumnCallbackAddMetadata', + array('label', 'country', __NAMESPACE__ . '\getElementFromStringArray', array($separator, 2, $unk)) + ); // backwards compatibility: for reports that have lat|long in label - $dataTable->filter('ColumnCallbackAddMetadata', - array('label', 'lat', __NAMESPACE__ . '\getElementFromStringArray', array($separator, 3, false))); - $dataTable->filter('ColumnCallbackAddMetadata', - array('label', 'long', __NAMESPACE__ . '\getElementFromStringArray', array($separator, 4, false))); + $dataTable->filter( + 'ColumnCallbackAddMetadata', + array('label', 'lat', __NAMESPACE__ . '\getElementFromStringArray', array($separator, 3, false)) + ); + $dataTable->filter( + 'ColumnCallbackAddMetadata', + array('label', 'long', __NAMESPACE__ . '\getElementFromStringArray', array($separator, 4, false)) + ); // add country name & region name metadata - $dataTable->filter('MetadataCallbackAddMetadata', - array('country', 'country_name', __NAMESPACE__ . '\countryTranslate', $applyToSummaryRow = false)); + $dataTable->filter( + 'MetadataCallbackAddMetadata', + array('country', 'country_name', __NAMESPACE__ . '\countryTranslate', $applyToSummaryRow = false) + ); $getRegionName = '\\Piwik\\Plugins\\UserCountry\\getRegionNameFromCodes'; $dataTable->filter('MetadataCallbackAddMetadata', array( diff --git a/plugins/UserCountry/Commands/AttributeHistoricalDataWithLocations.php b/plugins/UserCountry/Commands/AttributeHistoricalDataWithLocations.php index d84c2e5bafc..b819b967dbb 100644 --- a/plugins/UserCountry/Commands/AttributeHistoricalDataWithLocations.php +++ b/plugins/UserCountry/Commands/AttributeHistoricalDataWithLocations.php @@ -71,9 +71,13 @@ protected function configure() $this->setName('usercountry:attribute'); $this->setDescription("Re-attribute existing raw data (visits & conversions) with geolocated location data, using the specified or configured location provider."); $this->addRequiredArgument(self::DATES_RANGE_ARGUMENT, 'Attribute visits in this date range. Eg, 2012-01-01,2013-01-01'); - $this->addOptionalValueOption(self::PERCENT_STEP_ARGUMENT, null, + $this->addOptionalValueOption( + self::PERCENT_STEP_ARGUMENT, + null, 'How often to display the command progress. A status update will be printed after N percent of visits are processed, ' - . 'where N is the value of this option.', self::PERCENT_STEP_ARGUMENT_DEFAULT); + . 'where N is the value of this option.', + self::PERCENT_STEP_ARGUMENT_DEFAULT + ); $this->addRequiredValueOption(self::PROVIDER_ARGUMENT, null, 'Provider id which should be used to attribute visits. If empty then' . ' Piwik will use the currently configured provider. If no provider is configured, the default provider is used.'); $this->addOptionalValueOption(self::SEGMENT_LIMIT_OPTION, null, 'Number of visits to process at a time.', self::SEGMENT_LIMIT_OPTION_DEFAULT); @@ -96,8 +100,13 @@ protected function doExecute(): int $this->amountOfVisits = $this->dao->countVisitsWithDatesLimit($from, $to); $output->writeln( - sprintf('Re-attribution for date range: %s to %s. %d visits to process with provider "%s".', - $from, $to, $this->amountOfVisits, $this->visitorGeolocator->getProvider()->getId()) + sprintf( + 'Re-attribution for date range: %s to %s. %d visits to process with provider "%s".', + $from, + $to, + $this->amountOfVisits, + $this->visitorGeolocator->getProvider()->getId() + ) ); $this->timer = new Timer(); diff --git a/plugins/UserCountry/Controller.php b/plugins/UserCountry/Controller.php index 6bbce30544e..7217d833039 100644 --- a/plugins/UserCountry/Controller.php +++ b/plugins/UserCountry/Controller.php @@ -124,7 +124,10 @@ public function getLocationUsingProvider() 'lang' => Common::getBrowserLanguage(), 'disable_fallbacks' => true)); $location = LocationProvider::prettyFormatLocation( - $location, $newline = '
', $includeExtra = true); + $location, + $newline = '
', + $includeExtra = true + ); return $location; } diff --git a/plugins/UserCountry/LocationProvider.php b/plugins/UserCountry/LocationProvider.php index 2f0a804fe52..9a4777f87b5 100644 --- a/plugins/UserCountry/LocationProvider.php +++ b/plugins/UserCountry/LocationProvider.php @@ -369,7 +369,8 @@ public static function setCurrentProvider($providerId) $provider = self::getProviderById($providerId); if (empty($provider)) { throw new Exception( - "Invalid provider ID '$providerId'. The provider either does not exist or is not available"); + "Invalid provider ID '$providerId'. The provider either does not exist or is not available" + ); } $provider->activate(); diff --git a/plugins/UserCountry/Menu.php b/plugins/UserCountry/Menu.php index c7890875314..b211ab519e6 100644 --- a/plugins/UserCountry/Menu.php +++ b/plugins/UserCountry/Menu.php @@ -16,9 +16,11 @@ class Menu extends \Piwik\Plugin\Menu public function configureAdminMenu(MenuAdmin $menu) { if (UserCountry::isGeoLocationAdminEnabled() && Piwik::hasUserSuperUserAccess()) { - $menu->addSystemItem('UserCountry_Geolocation', - $this->urlForAction('adminIndex'), - $order = 30); + $menu->addSystemItem( + 'UserCountry_Geolocation', + $this->urlForAction('adminIndex'), + $order = 30 + ); } } } diff --git a/plugins/UserCountry/Reports/Base.php b/plugins/UserCountry/Reports/Base.php index 3439df484c3..5c506f4a268 100644 --- a/plugins/UserCountry/Reports/Base.php +++ b/plugins/UserCountry/Reports/Base.php @@ -22,7 +22,8 @@ protected function init() protected function getGeoIPReportDocSuffix() { - return Piwik::translate('UserCountry_GeoIPDocumentationSuffix', + return Piwik::translate( + 'UserCountry_GeoIPDocumentationSuffix', array('', '', '', @@ -47,14 +48,18 @@ protected function checkIfNoDataForGeoIpReport(ViewDataTable $view) // if GeoIP is working, don't display this part of the message if (!$userCountry->isGeoIPWorking()) { $params = array('module' => 'UserCountry', 'action' => 'adminIndex'); - $footerMessage .= ' ' . Piwik::translate('UserCountry_NoDataForGeoIPReport2', - array('', + $footerMessage .= ' ' . Piwik::translate( + 'UserCountry_NoDataForGeoIPReport2', + array('', '', '', - '')); + '') + ); } else { - $footerMessage .= ' ' . Piwik::translate('UserCountry_ToGeolocateOldVisits', - array('', '')); + $footerMessage .= ' ' . Piwik::translate( + 'UserCountry_ToGeolocateOldVisits', + array('', '') + ); } $view->config->show_footer_message = $footerMessage; diff --git a/plugins/UserCountry/Reports/GetCountry.php b/plugins/UserCountry/Reports/GetCountry.php index af843a153d0..e93dd17ba90 100644 --- a/plugins/UserCountry/Reports/GetCountry.php +++ b/plugins/UserCountry/Reports/GetCountry.php @@ -38,8 +38,10 @@ public function configureView(ViewDataTable $view) if (LocationProvider::getCurrentProviderId() == LocationProvider\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', - ['', '']); + . Piwik::translate( + 'UserCountry_DefaultLocationProviderExplanation', + ['', ''] + ); $view->config->show_footer_message = $footerMessage; } diff --git a/plugins/UserCountry/VisitorDetails.php b/plugins/UserCountry/VisitorDetails.php index f3b04f589ed..3fae5146817 100644 --- a/plugins/UserCountry/VisitorDetails.php +++ b/plugins/UserCountry/VisitorDetails.php @@ -70,7 +70,9 @@ protected function getRegionName() $region = $this->getRegionCode(); if ($region != '' && $region != Visit::UNKNOWN_CODE) { return getRegionNameFromCodes( - $this->details['location_country'], $region); + $this->details['location_country'], + $region + ); } return null;