Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2013-07-20 08:49:26 +0400
committermattab <matthieu.aubry@gmail.com>2013-07-20 08:49:26 +0400
commit6e38973acc12e9f7fa2d02edee3f8bbbfdbb9694 (patch)
tree603ff550b4302bd88a2a73f413b59cf61ef9e372
parent03b4953f008c1063e6d7166143ba844e8c6e89cc (diff)
Removing extra namespace \Core
-rw-r--r--core/API/DataTableGenericFilter.php2
-rw-r--r--core/API/DataTableManipulator/LabelFilter.php2
-rw-r--r--core/API/DocumentationGenerator.php4
-rw-r--r--core/API/Proxy.php2
-rw-r--r--core/API/Request.php4
-rw-r--r--core/API/ResponseBuilder.php4
-rw-r--r--core/Access.php4
-rw-r--r--core/Archive.php2
-rw-r--r--core/ArchiveProcessor.php4
-rw-r--r--core/ArchiveProcessor/Period.php5
-rw-r--r--core/ArchiveProcessor/Rules.php6
-rw-r--r--core/AssetManager.php6
-rw-r--r--core/CacheFile.php4
-rw-r--r--core/Common.php2917
-rw-r--r--core/Config.php4
-rw-r--r--core/Controller.php6
-rw-r--r--core/Controller/Admin.php4
-rw-r--r--core/Cookie.php2
-rw-r--r--core/DataAccess/ArchiveSelector.php4
-rw-r--r--core/DataAccess/ArchiveTableCreator.php4
-rw-r--r--core/DataAccess/ArchiveWriter.php6
-rw-r--r--core/DataAccess/LogAggregator.php2
-rw-r--r--core/DataTable.php43
-rw-r--r--core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php2
-rw-r--r--core/DataTable/Filter/ColumnCallbackAddColumnPercentage.php2
-rw-r--r--core/DataTable/Filter/ReplaceColumnNames.php2
-rw-r--r--core/DataTable/Manager.php4
-rw-r--r--core/DataTable/Renderer.php2
-rw-r--r--core/DataTable/Renderer/Csv.php4
-rw-r--r--core/DataTable/Renderer/Json.php4
-rw-r--r--core/DataTable/Renderer/Php.php2
-rw-r--r--core/DataTable/Renderer/Rss.php2
-rw-r--r--core/DataTable/Renderer/Xml.php2
-rw-r--r--core/Db/Adapter/Mysqli.php2
-rw-r--r--core/Db/Adapter/Pdo/Mssql.php2
-rw-r--r--core/Db/Adapter/Pdo/Mysql.php2
-rw-r--r--core/Db/Adapter/Pdo/Pgsql.php2
-rw-r--r--core/Db/Schema.php2
-rw-r--r--core/Db/Schema/Myisam.php6
-rw-r--r--core/ExceptionHandler.php2
-rw-r--r--core/FrontController.php9
-rw-r--r--core/Http.php6
-rw-r--r--core/IP.php4
-rw-r--r--core/Log.php6
-rw-r--r--core/Log/Exception.php2
-rw-r--r--core/Log/Message.php4
-rw-r--r--core/Mail.php4
-rw-r--r--core/Menu/Abstract.php2
-rw-r--r--core/Menu/Admin.php2
-rw-r--r--core/Metrics.php2
-rw-r--r--core/Nonce.php2
-rw-r--r--core/Option.php2
-rw-r--r--core/Period.php2
-rw-r--r--core/Period/Range.php2
-rw-r--r--core/Piwik.php11
-rw-r--r--core/Plugin.php2
-rw-r--r--core/Plugin/MetadataLoader.php2
-rw-r--r--core/PluginsArchiver.php4
-rw-r--r--core/PluginsFunctions/Sql.php2
-rw-r--r--core/PluginsManager.php6
-rw-r--r--core/ProxyHeaders.php2
-rw-r--r--core/ReportRenderer.php2
-rw-r--r--core/ReportRenderer/Html.php2
-rw-r--r--core/ReportRenderer/Pdf.php2
-rw-r--r--core/Segment.php4
-rw-r--r--core/Session.php6
-rw-r--r--core/Session/Namespace.php2
-rw-r--r--core/Timer.php2
-rw-r--r--core/Tracker.php36
-rw-r--r--core/Tracker/Action.php36
-rw-r--r--core/Tracker/Cache.php4
-rw-r--r--core/Tracker/Config.php2
-rw-r--r--core/Tracker/Db.php2
-rw-r--r--core/Tracker/GoalManager.php48
-rw-r--r--core/Tracker/IgnoreCookie.php2
-rw-r--r--core/Tracker/Referer.php2
-rw-r--r--core/Tracker/Request.php18
-rw-r--r--core/Tracker/Visit.php38
-rw-r--r--core/Tracker/VisitExcluded.php22
-rw-r--r--core/Translate.php4
-rw-r--r--core/TranslationWriter.php2
-rw-r--r--core/Twig.php4
-rw-r--r--core/UpdateCheck.php4
-rw-r--r--core/Updater.php2
-rw-r--r--core/Updates.php2
-rw-r--r--core/Updates/0.2.10.php4
-rw-r--r--core/Updates/0.2.12.php2
-rw-r--r--core/Updates/0.2.13.php2
-rw-r--r--core/Updates/0.2.24.php2
-rw-r--r--core/Updates/0.2.27.php4
-rw-r--r--core/Updates/0.2.32.php2
-rw-r--r--core/Updates/0.2.33.php4
-rw-r--r--core/Updates/0.2.34.php2
-rw-r--r--core/Updates/0.2.35.php2
-rw-r--r--core/Updates/0.2.37.php2
-rw-r--r--core/Updates/0.4.1.php2
-rw-r--r--core/Updates/0.4.2.php2
-rw-r--r--core/Updates/0.4.php2
-rw-r--r--core/Updates/0.5.4.php4
-rw-r--r--core/Updates/0.5.5.php4
-rw-r--r--core/Updates/0.5.php2
-rw-r--r--core/Updates/0.6-rc1.php2
-rw-r--r--core/Updates/0.6.2.php2
-rw-r--r--core/Updates/0.6.3.php4
-rw-r--r--core/Updates/0.7.php2
-rw-r--r--core/Updates/0.9.1.php4
-rw-r--r--core/Updates/1.1.php4
-rwxr-xr-xcore/Updates/1.10.2-b1.php2
-rw-r--r--core/Updates/1.10.2-b2.php2
-rw-r--r--core/Updates/1.12-b1.php2
-rw-r--r--core/Updates/1.12-b16.php2
-rw-r--r--core/Updates/1.2-rc1.php2
-rw-r--r--core/Updates/1.2.3.php4
-rw-r--r--core/Updates/1.2.5-rc1.php2
-rw-r--r--core/Updates/1.2.5-rc7.php2
-rw-r--r--core/Updates/1.4-rc1.php2
-rw-r--r--core/Updates/1.4-rc2.php2
-rw-r--r--core/Updates/1.5-b1.php2
-rw-r--r--core/Updates/1.5-b2.php2
-rw-r--r--core/Updates/1.5-b3.php2
-rw-r--r--core/Updates/1.5-b4.php2
-rw-r--r--core/Updates/1.5-b5.php2
-rw-r--r--core/Updates/1.6-b1.php2
-rw-r--r--core/Updates/1.7-b1.php2
-rw-r--r--core/Updates/1.7.2-rc5.php2
-rwxr-xr-xcore/Updates/1.7.2-rc7.php2
-rw-r--r--core/Updates/1.8.3-b1.php2
-rw-r--r--core/Updates/1.8.4-b1.php2
-rwxr-xr-xcore/Updates/1.9-b16.php2
-rwxr-xr-xcore/Updates/1.9-b19.php2
-rwxr-xr-xcore/Updates/1.9-b9.php2
-rw-r--r--core/Updates/1.9.1-b2.php2
-rwxr-xr-xcore/Updates/1.9.3-b8.php2
-rw-r--r--core/Url.php6
-rw-r--r--core/View.php6
-rw-r--r--core/ViewDataTable.php6
-rw-r--r--core/ViewDataTable/GenerateGraphData.php4
-rw-r--r--core/ViewDataTable/GenerateGraphData/ChartEvolution.php4
-rw-r--r--core/ViewDataTable/GenerateGraphHTML.php4
-rw-r--r--core/ViewDataTable/GenerateGraphHTML/ChartEvolution.php2
-rw-r--r--core/ViewDataTable/HtmlTable.php6
-rw-r--r--core/ViewDataTable/HtmlTable/Goals.php4
-rw-r--r--core/ViewDataTable/Sparkline.php2
-rw-r--r--core/Visualization/Chart.php4
-rw-r--r--core/Visualization/Cloud.php2
-rw-r--r--js/index.php2
-rw-r--r--misc/cron/archive.php6
-rwxr-xr-xmisc/others/geoipUpdateRows.php6
-rw-r--r--misc/others/iframeWidget_localhost.php2
-rw-r--r--misc/others/test_cookies_GenerateHundredsWebsitesAndVisits.php4
-rw-r--r--misc/others/test_generateLotsVisitsWebsites.php6
-rw-r--r--piwik.php8
-rw-r--r--plugins/API/API.php11
-rw-r--r--plugins/API/Controller.php4
-rw-r--r--plugins/API/ProcessedReport.php4
-rw-r--r--plugins/API/RowEvolution.php4
-rw-r--r--plugins/Actions/API.php4
-rw-r--r--plugins/Actions/Actions.php4
-rw-r--r--plugins/Actions/Archiver.php2
-rw-r--r--plugins/Actions/ArchivingHelper.php2
-rwxr-xr-xplugins/Annotations/API.php2
-rwxr-xr-xplugins/Annotations/AnnotationList.php2
-rwxr-xr-xplugins/Annotations/Controller.php2
-rw-r--r--plugins/AnonymizeIP/AnonymizeIP.php4
-rw-r--r--plugins/CoreAdminHome/API.php4
-rw-r--r--plugins/CoreAdminHome/Controller.php6
-rw-r--r--plugins/CoreAdminHome/CoreAdminHome.php2
-rw-r--r--plugins/CoreHome/Controller.php4
-rw-r--r--plugins/CoreHome/DataTableRowAction/MultiRowEvolution.php2
-rw-r--r--plugins/CoreHome/DataTableRowAction/RowEvolution.php2
-rw-r--r--plugins/CorePluginsAdmin/Controller.php4
-rw-r--r--plugins/CorePluginsAdmin/CorePluginsAdmin.php2
-rw-r--r--plugins/CoreUpdater/Controller.php6
-rw-r--r--plugins/CoreUpdater/CoreUpdater.php4
-rw-r--r--plugins/CustomVariables/Archiver.php4
-rw-r--r--plugins/DBStats/API.php4
-rw-r--r--plugins/DBStats/Controller.php2
-rw-r--r--plugins/DBStats/DBStats.php2
-rwxr-xr-xplugins/DBStats/MySQLMetadataProvider.php4
-rw-r--r--plugins/Dashboard/API.php2
-rw-r--r--plugins/Dashboard/Controller.php4
-rw-r--r--plugins/Dashboard/Dashboard.php4
-rw-r--r--plugins/DevicesDetection/API.php2
-rw-r--r--plugins/DevicesDetection/Controller.php4
-rw-r--r--plugins/DevicesDetection/DevicesDetection.php8
-rw-r--r--plugins/DoNotTrack/DoNotTrack.php4
-rw-r--r--plugins/ExampleAPI/API.php2
-rw-r--r--plugins/ExamplePlugin/Controller.php4
-rw-r--r--plugins/ExampleUI/Controller.php2
-rw-r--r--plugins/Feedback/Controller.php6
-rw-r--r--plugins/Goals/API.php4
-rw-r--r--plugins/Goals/Controller.php4
-rw-r--r--plugins/Goals/Goals.php4
-rw-r--r--plugins/ImageGraph/API.php4
-rw-r--r--plugins/ImageGraph/Controller.php4
-rw-r--r--plugins/ImageGraph/ImageGraph.php2
-rw-r--r--plugins/Installation/Controller.php4
-rw-r--r--plugins/Installation/FormDatabaseSetup.php4
-rw-r--r--plugins/Installation/FormGeneralSetup.php2
-rw-r--r--plugins/Installation/Installation.php4
-rw-r--r--plugins/LanguagesManager/API.php4
-rw-r--r--plugins/LanguagesManager/Controller.php4
-rw-r--r--plugins/LanguagesManager/LanguagesManager.php6
-rw-r--r--plugins/Live/API.php6
-rw-r--r--plugins/Live/Controller.php4
-rw-r--r--plugins/Live/Visitor.php4
-rw-r--r--plugins/Login/Auth.php4
-rw-r--r--plugins/Login/Controller.php6
-rw-r--r--plugins/Login/Login.php4
-rw-r--r--plugins/MobileMessaging/API.php4
-rw-r--r--plugins/MobileMessaging/Controller.php4
-rw-r--r--plugins/MobileMessaging/MobileMessaging.php2
-rw-r--r--plugins/MobileMessaging/ReportRenderer/Sms.php2
-rwxr-xr-xplugins/MultiSites/API.php4
-rw-r--r--plugins/MultiSites/Controller.php5
-rw-r--r--plugins/Overlay/API.php4
-rw-r--r--plugins/Overlay/Controller.php4
-rw-r--r--plugins/PDFReports/API.php4
-rw-r--r--plugins/PDFReports/Controller.php4
-rw-r--r--plugins/PDFReports/PDFReports.php4
-rw-r--r--plugins/PrivacyManager/Controller.php6
-rwxr-xr-xplugins/PrivacyManager/LogDataPurger.php4
-rw-r--r--plugins/PrivacyManager/PrivacyManager.php6
-rwxr-xr-xplugins/PrivacyManager/ReportsPurger.php2
-rw-r--r--plugins/Provider/API.php2
-rw-r--r--plugins/Provider/Provider.php4
-rw-r--r--plugins/Provider/functions.php2
-rw-r--r--plugins/Proxy/Controller.php4
-rw-r--r--plugins/Referers/API.php4
-rw-r--r--plugins/Referers/Archiver.php3
-rw-r--r--plugins/Referers/Controller.php4
-rw-r--r--plugins/Referers/Referers.php2
-rw-r--r--plugins/Referers/functions.php2
-rw-r--r--plugins/SEO/API.php2
-rw-r--r--plugins/SEO/Controller.php2
-rw-r--r--plugins/SEO/MajesticClient.php2
-rw-r--r--plugins/SEO/RankChecker.php2
-rw-r--r--plugins/SecurityInfo/Controller.php2
-rw-r--r--plugins/SecurityInfo/SecurityInfo.php2
-rw-r--r--plugins/SegmentEditor/API.php4
-rw-r--r--plugins/SegmentEditor/Controller.php4
-rw-r--r--plugins/SegmentEditor/SegmentEditor.php2
-rw-r--r--plugins/SitesManager/API.php4
-rw-r--r--plugins/SitesManager/Controller.php4
-rw-r--r--plugins/SitesManager/SitesManager.php2
-rw-r--r--plugins/Transitions/API.php4
-rw-r--r--plugins/UserCountry/API.php2
-rw-r--r--plugins/UserCountry/Controller.php4
-rwxr-xr-xplugins/UserCountry/GeoIPAutoUpdater.php4
-rwxr-xr-xplugins/UserCountry/LocationProvider.php2
-rwxr-xr-xplugins/UserCountry/LocationProvider/Default.php4
-rwxr-xr-xplugins/UserCountry/LocationProvider/GeoIp/Php.php2
-rwxr-xr-xplugins/UserCountry/LocationProvider/GeoIp/ServerBased.php6
-rw-r--r--plugins/UserCountry/UserCountry.php10
-rw-r--r--plugins/UserCountryMap/Controller.php4
-rw-r--r--plugins/UserSettings/API.php2
-rw-r--r--plugins/UserSettings/Archiver.php2
-rw-r--r--plugins/UserSettings/functions.php2
-rw-r--r--plugins/UsersManager/API.php6
-rw-r--r--plugins/UsersManager/Controller.php4
-rw-r--r--plugins/UsersManager/UsersManager.php2
-rw-r--r--plugins/VisitFrequency/API.php2
-rw-r--r--plugins/VisitFrequency/Controller.php4
-rw-r--r--plugins/VisitTime/API.php2
-rw-r--r--plugins/VisitTime/VisitTime.php2
-rw-r--r--plugins/VisitorGenerator/Controller.php4
-rw-r--r--plugins/VisitorGenerator/VisitorGenerator.php2
-rw-r--r--plugins/VisitorInterest/API.php2
-rw-r--r--plugins/VisitsSummary/API.php2
-rw-r--r--plugins/VisitsSummary/Controller.php4
-rw-r--r--plugins/Widgetize/Controller.php2
271 files changed, 2016 insertions, 2014 deletions
diff --git a/core/API/DataTableGenericFilter.php b/core/API/DataTableGenericFilter.php
index 9561c26ee5..22f691c505 100644
--- a/core/API/DataTableGenericFilter.php
+++ b/core/API/DataTableGenericFilter.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Piwik
diff --git a/core/API/DataTableManipulator/LabelFilter.php b/core/API/DataTableManipulator/LabelFilter.php
index 43f43ce056..20ba5b273f 100644
--- a/core/API/DataTableManipulator/LabelFilter.php
+++ b/core/API/DataTableManipulator/LabelFilter.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* This class is responsible for handling the label parameter that can be
diff --git a/core/API/DocumentationGenerator.php b/core/API/DocumentationGenerator.php
index 0f40826e22..76c7b2f156 100644
--- a/core/API/DocumentationGenerator.php
+++ b/core/API/DocumentationGenerator.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* @package Piwik
diff --git a/core/API/Proxy.php b/core/API/Proxy.php
index ae07892e3d..723820e1ee 100644
--- a/core/API/Proxy.php
+++ b/core/API/Proxy.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* To differentiate between "no value" and default value of null
diff --git a/core/API/Request.php b/core/API/Request.php
index 184a566d09..503481f185 100644
--- a/core/API/Request.php
+++ b/core/API/Request.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* An API request is the object used to make a call to the API and get the result.
diff --git a/core/API/ResponseBuilder.php b/core/API/ResponseBuilder.php
index f826319fca..3935f267f7 100644
--- a/core/API/ResponseBuilder.php
+++ b/core/API/ResponseBuilder.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* @package Piwik
diff --git a/core/Access.php b/core/Access.php
index 10f798e937..715b96aae0 100644
--- a/core/Access.php
+++ b/core/Access.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Common;
/**
* Class to handle User Access:
diff --git a/core/Archive.php b/core/Archive.php
index 9afd5870f1..3e661b7a9e 100644
--- a/core/Archive.php
+++ b/core/Archive.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* The archive object is used to query specific data for a day or a period of statistics for a given website.
diff --git a/core/ArchiveProcessor.php b/core/ArchiveProcessor.php
index bb42ca1b58..bcbfcc1de2 100644
--- a/core/ArchiveProcessor.php
+++ b/core/ArchiveProcessor.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
+use Piwik\Config;
+use Piwik\Piwik;
/**
* The ArchiveProcessor class is used by the Archive object to make sure the given Archive is processed and available in the DB.
diff --git a/core/ArchiveProcessor/Period.php b/core/ArchiveProcessor/Period.php
index 8a25b5d385..a53182a2af 100644
--- a/core/ArchiveProcessor/Period.php
+++ b/core/ArchiveProcessor/Period.php
@@ -8,7 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* This class provides generic methods to archive data for a period (week / month / year).
@@ -85,7 +86,7 @@ class Piwik_ArchiveProcessor_Period extends Piwik_ArchiveProcessor
$nameToCount[$recordName]['recursive'] = $table->getRowsCountRecursive();
$blob = $table->getSerialized($maximumRowsInDataTableLevelZero, $maximumRowsInSubDataTable, $columnToSortByBeforeTruncation);
- destroy($table);
+ Common::destroy($table);
$this->insertBlobRecord($recordName, $blob);
}
Piwik_DataTable_Manager::getInstance()->deleteAll($latestUsedTableId);
diff --git a/core/ArchiveProcessor/Rules.php b/core/ArchiveProcessor/Rules.php
index 34abbec536..a4ddd03e35 100644
--- a/core/ArchiveProcessor/Rules.php
+++ b/core/ArchiveProcessor/Rules.php
@@ -8,9 +8,9 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* This class contains Archiving rules/logic which are used in several places
diff --git a/core/AssetManager.php b/core/AssetManager.php
index 1c50f69ce6..322ab4ab20 100644
--- a/core/AssetManager.php
+++ b/core/AssetManager.php
@@ -8,9 +8,9 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* @see libs/jsmin/jsmin.php
diff --git a/core/CacheFile.php b/core/CacheFile.php
index 21dafedf65..7458588dc3 100644
--- a/core/CacheFile.php
+++ b/core/CacheFile.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Code originally inspired from OpenX
diff --git a/core/Common.php b/core/Common.php
index bad3bf28ed..2f12f3e488 100644
--- a/core/Common.php
+++ b/core/Common.php
@@ -1,1580 +1,1568 @@
<?php
-namespace Piwik\Core {
- use Exception;
- use Piwik_IP;
- use Piwik_PluginsManager;
- use Piwik_Tracker;
- use Piwik_Tracker_Cache;
- use Piwik_UserCountry_LocationProvider_Default;
-
- /**
- * Static class providing functions used by both the CORE of Piwik and the visitor Tracking engine.
- *
- * This is the only external class loaded by the /piwik.php file.
- * This class should contain only the functions that are used in
- * both the CORE and the piwik.php statistics logging engine.
- *
- * @package Piwik
- */
- class Common
- {
- const CLASSES_PREFIX = 'Piwik_';
-
- /**
- * Const used to map the referer type to an integer in the log_visit table
- */
- const REFERER_TYPE_DIRECT_ENTRY = 1;
- const REFERER_TYPE_SEARCH_ENGINE = 2;
- const REFERER_TYPE_WEBSITE = 3;
- const REFERER_TYPE_CAMPAIGN = 6;
-
- /**
- * Flag used with htmlspecialchar
- * See php.net/htmlspecialchars
- */
- const HTML_ENCODING_QUOTE_STYLE = ENT_QUOTES;
-
- /*
- * Database
- */
-
- /**
- * Hashes a string into an integer which should be very low collision risks
- * @param string $string String to hash
- * @return int Resulting int hash
- */
- public static function hashStringToInt($string)
- {
- $stringHash = substr(md5($string), 0, 8);
- return base_convert($stringHash, 16, 10);
- }
-
- public static $cachedTablePrefix = null;
-
- /**
- * Returns the table name prefixed by the table prefix.
- * Works in both Tracker and UI mode.
- *
- * @param string $table The table name to prefix, ie "log_visit"
- * @return string The table name prefixed, ie "piwik-production_log_visit"
- */
- public static function prefixTable($table)
- {
- $prefix = Config::getInstance()->database['tables_prefix'];
- return $prefix . $table;
- }
-
- /**
- * Returns an array containing the prefixed table names of every passed argument.
- *
- * @param string ... The table names to prefix, ie "log_visit"
- * @return array The prefixed names in an array.
- */
- public static function prefixTables()
- {
- $result = array();
- foreach (func_get_args() as $table) {
- $result[] = \Piwik\Core\self::prefixTable($table);
- }
- return $result;
+namespace Piwik;
+
+use Exception;
+use Piwik_IP;
+use Piwik_PluginsManager;
+use Piwik_Tracker;
+use Piwik_Tracker_Cache;
+use Piwik_UserCountry_LocationProvider_Default;
+
+/**
+ * Static class providing functions used by both the CORE of Piwik and the visitor Tracking engine.
+ *
+ * This is the only external class loaded by the /piwik.php file.
+ * This class should contain only the functions that are used in
+ * both the CORE and the piwik.php statistics logging engine.
+ *
+ * @package Piwik
+ */
+class Common
+{
+ const CLASSES_PREFIX = 'Piwik_';
+
+ /**
+ * Const used to map the referer type to an integer in the log_visit table
+ */
+ const REFERER_TYPE_DIRECT_ENTRY = 1;
+ const REFERER_TYPE_SEARCH_ENGINE = 2;
+ const REFERER_TYPE_WEBSITE = 3;
+ const REFERER_TYPE_CAMPAIGN = 6;
+
+ /**
+ * Flag used with htmlspecialchar
+ * See php.net/htmlspecialchars
+ */
+ const HTML_ENCODING_QUOTE_STYLE = ENT_QUOTES;
+
+ /*
+ * Database
+ */
+
+ /**
+ * Hashes a string into an integer which should be very low collision risks
+ * @param string $string String to hash
+ * @return int Resulting int hash
+ */
+ public static function hashStringToInt($string)
+ {
+ $stringHash = substr(md5($string), 0, 8);
+ return base_convert($stringHash, 16, 10);
+ }
+
+ public static $cachedTablePrefix = null;
+
+ /**
+ * Returns the table name prefixed by the table prefix.
+ * Works in both Tracker and UI mode.
+ *
+ * @param string $table The table name to prefix, ie "log_visit"
+ * @return string The table name prefixed, ie "piwik-production_log_visit"
+ */
+ public static function prefixTable($table)
+ {
+ $prefix = Config::getInstance()->database['tables_prefix'];
+ return $prefix . $table;
+ }
+
+ /**
+ * Returns an array containing the prefixed table names of every passed argument.
+ *
+ * @param string ... The table names to prefix, ie "log_visit"
+ * @return array The prefixed names in an array.
+ */
+ public static function prefixTables()
+ {
+ $result = array();
+ foreach (func_get_args() as $table) {
+ $result[] = self::prefixTable($table);
}
+ return $result;
+ }
- /**
- * Returns the table name, after removing the table prefix
- *
- * @param string $table
- * @return string
- */
- public static function unprefixTable($table)
- {
- static $prefixTable = null;
- if (is_null($prefixTable)) {
- $prefixTable = Config::getInstance()->database['tables_prefix'];
- }
- if (empty($prefixTable)
- || strpos($table, $prefixTable) !== 0
- ) {
- return $table;
- }
- $count = 1;
- return str_replace($prefixTable, '', $table, $count);
- }
-
- /*
- * Tracker
- */
- public static function isGoalPluginEnabled()
- {
- return Piwik_PluginsManager::getInstance()->isPluginActivated('Goals');
- }
-
- /*
- * URLs
- */
-
- /**
- * Returns the path and query part from a URL.
- * Eg. http://piwik.org/test/index.php?module=CoreHome will return /test/index.php?module=CoreHome
- *
- * @param string $url either http://piwik.org/test or /
- * @return string
- */
- public static function getPathAndQueryFromUrl($url)
- {
- $parsedUrl = parse_url($url);
- $result = '';
- if (isset($parsedUrl['path'])) {
- $result .= substr($parsedUrl['path'], 1);
- }
- if (isset($parsedUrl['query'])) {
- $result .= '?' . $parsedUrl['query'];
- }
- return $result;
+ /**
+ * Returns the table name, after removing the table prefix
+ *
+ * @param string $table
+ * @return string
+ */
+ public static function unprefixTable($table)
+ {
+ static $prefixTable = null;
+ if (is_null($prefixTable)) {
+ $prefixTable = Config::getInstance()->database['tables_prefix'];
+ }
+ if (empty($prefixTable)
+ || strpos($table, $prefixTable) !== 0
+ ) {
+ return $table;
}
+ $count = 1;
+ return str_replace($prefixTable, '', $table, $count);
+ }
- /**
- * Returns the value of a GET parameter $parameter in an URL query $urlQuery
- *
- * @param string $urlQuery result of parse_url()['query'] and htmlentitied (& is &amp;) eg. module=test&amp;action=toto or ?page=test
- * @param string $parameter
- * @return string|bool Parameter value if found (can be the empty string!), null if not found
- */
- public static function getParameterFromQueryString($urlQuery, $parameter)
- {
- $nameToValue = \Piwik\Core\self::getArrayFromQueryString($urlQuery);
- if (isset($nameToValue[$parameter])) {
- return $nameToValue[$parameter];
- }
- return null;
- }
-
- /**
- * Returns an URL query string in an array format
- *
- * @param string $urlQuery
- * @return array array( param1=> value1, param2=>value2)
- */
- public static function getArrayFromQueryString($urlQuery)
- {
- if (strlen($urlQuery) == 0) {
- return array();
- }
- if ($urlQuery[0] == '?') {
- $urlQuery = substr($urlQuery, 1);
- }
- $separator = '&';
+ /*
+ * Tracker
+ */
+ public static function isGoalPluginEnabled()
+ {
+ return Piwik_PluginsManager::getInstance()->isPluginActivated('Goals');
+ }
- $urlQuery = $separator . $urlQuery;
- // $urlQuery = str_replace(array('%20'), ' ', $urlQuery);
- $refererQuery = trim($urlQuery);
+ /*
+ * URLs
+ */
- $values = explode($separator, $refererQuery);
+ /**
+ * Returns the path and query part from a URL.
+ * Eg. http://piwik.org/test/index.php?module=CoreHome will return /test/index.php?module=CoreHome
+ *
+ * @param string $url either http://piwik.org/test or /
+ * @return string
+ */
+ public static function getPathAndQueryFromUrl($url)
+ {
+ $parsedUrl = parse_url($url);
+ $result = '';
+ if (isset($parsedUrl['path'])) {
+ $result .= substr($parsedUrl['path'], 1);
+ }
+ if (isset($parsedUrl['query'])) {
+ $result .= '?' . $parsedUrl['query'];
+ }
+ return $result;
+ }
- $nameToValue = array();
+ /**
+ * Returns the value of a GET parameter $parameter in an URL query $urlQuery
+ *
+ * @param string $urlQuery result of parse_url()['query'] and htmlentitied (& is &amp;) eg. module=test&amp;action=toto or ?page=test
+ * @param string $parameter
+ * @return string|bool Parameter value if found (can be the empty string!), null if not found
+ */
+ public static function getParameterFromQueryString($urlQuery, $parameter)
+ {
+ $nameToValue = self::getArrayFromQueryString($urlQuery);
+ if (isset($nameToValue[$parameter])) {
+ return $nameToValue[$parameter];
+ }
+ return null;
+ }
- foreach ($values as $value) {
- $pos = strpos($value, '=');
- if ($pos !== false) {
- $name = substr($value, 0, $pos);
- $value = substr($value, $pos + 1);
- if ($value === false) {
- $value = '';
- }
- } else {
- $name = $value;
- $value = false;
- }
- if (!empty($name)) {
- $name = \Piwik\Core\Common::sanitizeInputValue($name);
- }
- if (!empty($value)) {
- $value = \Piwik\Core\Common::sanitizeInputValue($value);
- }
+ /**
+ * Returns an URL query string in an array format
+ *
+ * @param string $urlQuery
+ * @return array array( param1=> value1, param2=>value2)
+ */
+ public static function getArrayFromQueryString($urlQuery)
+ {
+ if (strlen($urlQuery) == 0) {
+ return array();
+ }
+ if ($urlQuery[0] == '?') {
+ $urlQuery = substr($urlQuery, 1);
+ }
+ $separator = '&';
- // if array without indexes
- $count = 0;
- $tmp = preg_replace('/(\[|%5b)(]|%5d)$/i', '', $name, -1, $count);
- if (!empty($tmp) && $count) {
- $name = $tmp;
- if (isset($nameToValue[$name]) == false || is_array($nameToValue[$name]) == false) {
- $nameToValue[$name] = array();
- }
- array_push($nameToValue[$name], $value);
- } else if (!empty($name)) {
- $nameToValue[$name] = $value;
+ $urlQuery = $separator . $urlQuery;
+ // $urlQuery = str_replace(array('%20'), ' ', $urlQuery);
+ $refererQuery = trim($urlQuery);
+
+ $values = explode($separator, $refererQuery);
+
+ $nameToValue = array();
+
+ foreach ($values as $value) {
+ $pos = strpos($value, '=');
+ if ($pos !== false) {
+ $name = substr($value, 0, $pos);
+ $value = substr($value, $pos + 1);
+ if ($value === false) {
+ $value = '';
}
+ } else {
+ $name = $value;
+ $value = false;
}
- return $nameToValue;
- }
-
- /**
- * Builds a URL from the result of parse_url function
- * Copied from the PHP comments at http://php.net/parse_url
- * @param array $parsed
- * @return bool|string
- */
- public static function getParseUrlReverse($parsed)
- {
- if (!is_array($parsed)) {
- return false;
+ if (!empty($name)) {
+ $name = self::sanitizeInputValue($name);
}
-
- $uri = !empty($parsed['scheme']) ? $parsed['scheme'] . ':' . (!strcasecmp($parsed['scheme'], 'mailto') ? '' : '//') : '';
- $uri .= !empty($parsed['user']) ? $parsed['user'] . (!empty($parsed['pass']) ? ':' . $parsed['pass'] : '') . '@' : '';
- $uri .= !empty($parsed['host']) ? $parsed['host'] : '';
- $uri .= !empty($parsed['port']) ? ':' . $parsed['port'] : '';
-
- if (!empty($parsed['path'])) {
- $uri .= (!strncmp($parsed['path'], '/', 1))
- ? $parsed['path']
- : ((!empty($uri) ? '/' : '') . $parsed['path']);
+ if (!empty($value)) {
+ $value = self::sanitizeInputValue($value);
}
- $uri .= !empty($parsed['query']) ? '?' . $parsed['query'] : '';
- $uri .= !empty($parsed['fragment']) ? '#' . $parsed['fragment'] : '';
- return $uri;
- }
-
- /**
- * Returns true if the string passed may be a URL.
- * We don't need a precise test here because the value comes from the website
- * tracked source code and the URLs may look very strange.
- *
- * @param string $url
- * @return bool
- */
- public static function isLookLikeUrl($url)
- {
- return preg_match('~^(ftp|news|http|https)?://(.*)$~D', $url, $matches) !== 0
- && strlen($matches[2]) > 0;
- }
-
- /*
- * File operations
- */
-
- /**
- * ending WITHOUT slash
- *
- * @return string
- */
- public static function getPathToPiwikRoot()
- {
- return realpath(dirname(__FILE__) . "/..");
- }
-
- /**
- * Create directory if permitted
- *
- * @param string $path
- * @param bool $denyAccess
- */
- public static function mkdir($path, $denyAccess = true)
- {
- if (!is_dir($path)) {
- // the mode in mkdir is modified by the current umask
- @mkdir($path, $mode = 0755, $recursive = true);
+ // if array without indexes
+ $count = 0;
+ $tmp = preg_replace('/(\[|%5b)(]|%5d)$/i', '', $name, -1, $count);
+ if (!empty($tmp) && $count) {
+ $name = $tmp;
+ if (isset($nameToValue[$name]) == false || is_array($nameToValue[$name]) == false) {
+ $nameToValue[$name] = array();
+ }
+ array_push($nameToValue[$name], $value);
+ } else if (!empty($name)) {
+ $nameToValue[$name] = $value;
}
+ }
+ return $nameToValue;
+ }
+
+ /**
+ * Builds a URL from the result of parse_url function
+ * Copied from the PHP comments at http://php.net/parse_url
+ * @param array $parsed
+ * @return bool|string
+ */
+ public static function getParseUrlReverse($parsed)
+ {
+ if (!is_array($parsed)) {
+ return false;
+ }
+
+ $uri = !empty($parsed['scheme']) ? $parsed['scheme'] . ':' . (!strcasecmp($parsed['scheme'], 'mailto') ? '' : '//') : '';
+ $uri .= !empty($parsed['user']) ? $parsed['user'] . (!empty($parsed['pass']) ? ':' . $parsed['pass'] : '') . '@' : '';
+ $uri .= !empty($parsed['host']) ? $parsed['host'] : '';
+ $uri .= !empty($parsed['port']) ? ':' . $parsed['port'] : '';
+
+ if (!empty($parsed['path'])) {
+ $uri .= (!strncmp($parsed['path'], '/', 1))
+ ? $parsed['path']
+ : ((!empty($uri) ? '/' : '') . $parsed['path']);
+ }
+
+ $uri .= !empty($parsed['query']) ? '?' . $parsed['query'] : '';
+ $uri .= !empty($parsed['fragment']) ? '#' . $parsed['fragment'] : '';
+ return $uri;
+ }
+
+ /**
+ * Returns true if the string passed may be a URL.
+ * We don't need a precise test here because the value comes from the website
+ * tracked source code and the URLs may look very strange.
+ *
+ * @param string $url
+ * @return bool
+ */
+ public static function isLookLikeUrl($url)
+ {
+ return preg_match('~^(ftp|news|http|https)?://(.*)$~D', $url, $matches) !== 0
+ && strlen($matches[2]) > 0;
+ }
+
+ /*
+ * File operations
+ */
+
+ /**
+ * ending WITHOUT slash
+ *
+ * @return string
+ */
+ public static function getPathToPiwikRoot()
+ {
+ return realpath(dirname(__FILE__) . "/..");
+ }
+
+ /**
+ * Create directory if permitted
+ *
+ * @param string $path
+ * @param bool $denyAccess
+ */
+ public static function mkdir($path, $denyAccess = true)
+ {
+ if (!is_dir($path)) {
+ // the mode in mkdir is modified by the current umask
+ @mkdir($path, $mode = 0755, $recursive = true);
+ }
- // try to overcome restrictive umask (mis-)configuration
+ // try to overcome restrictive umask (mis-)configuration
+ if (!is_writable($path)) {
+ @chmod($path, 0755);
if (!is_writable($path)) {
- @chmod($path, 0755);
- if (!is_writable($path)) {
- @chmod($path, 0775);
+ @chmod($path, 0775);
- // enough! we're not going to make the directory world-writeable
- }
+ // enough! we're not going to make the directory world-writeable
}
+ }
- if ($denyAccess) {
- \Piwik\Core\self::createHtAccess($path, $overwrite = false);
- }
+ if ($denyAccess) {
+ self::createHtAccess($path, $overwrite = false);
}
+ }
- /**
- * Create .htaccess file in specified directory
- *
- * Apache-specific; for IIS @see web.config
- *
- * @param string $path without trailing slash
- * @param bool $overwrite whether to overwrite an existing file or not
- * @param string $content
- */
- public static function createHtAccess($path, $overwrite = true, $content = "<Files \"*\">\n<IfModule mod_access.c>\nDeny from all\n</IfModule>\n<IfModule !mod_access_compat>\n<IfModule mod_authz_host.c>\nDeny from all\n</IfModule>\n</IfModule>\n<IfModule mod_access_compat>\nDeny from all\n</IfModule>\n</Files>\n")
- {
- if (\Piwik\Core\self::isApache()) {
- $file = $path . '/.htaccess';
- if ($overwrite || !file_exists($file)) {
- @file_put_contents($file, $content);
- }
+ /**
+ * Create .htaccess file in specified directory
+ *
+ * Apache-specific; for IIS @see web.config
+ *
+ * @param string $path without trailing slash
+ * @param bool $overwrite whether to overwrite an existing file or not
+ * @param string $content
+ */
+ public static function createHtAccess($path, $overwrite = true, $content = "<Files \"*\">\n<IfModule mod_access.c>\nDeny from all\n</IfModule>\n<IfModule !mod_access_compat>\n<IfModule mod_authz_host.c>\nDeny from all\n</IfModule>\n</IfModule>\n<IfModule mod_access_compat>\nDeny from all\n</IfModule>\n</Files>\n")
+ {
+ if (self::isApache()) {
+ $file = $path . '/.htaccess';
+ if ($overwrite || !file_exists($file)) {
+ @file_put_contents($file, $content);
}
}
+ }
- /**
- * Get canonicalized absolute path
- * See http://php.net/realpath
- *
- * @param string $path
- * @return string canonicalized absolute path
- */
- public static function realpath($path)
- {
- if (file_exists($path)) {
- return realpath($path);
- }
- return $path;
- }
-
- /**
- * Returns true if the string is a valid filename
- * File names that start with a-Z or 0-9 and contain a-Z, 0-9, underscore(_), dash(-), and dot(.) will be accepted.
- * File names beginning with anything but a-Z or 0-9 will be rejected (including .htaccess for example).
- * File names containing anything other than above mentioned will also be rejected (file names with spaces won't be accepted).
- *
- * @param string $filename
- * @return bool
- *
- */
- public static function isValidFilename($filename)
- {
- return (0 !== preg_match('/(^[a-zA-Z0-9]+([a-zA-Z_0-9.-]*))$/D', $filename));
- }
-
- /*
- * String operations
- */
-
- /**
- * byte-oriented substr() - ASCII
- *
- * @param string $string
- * @param int $start
- * @param int ... optional length
- * @return string
- */
- public static function substr($string, $start)
- {
- // in case mbstring overloads substr function
- $substr = function_exists('mb_orig_substr') ? 'mb_orig_substr' : 'substr';
-
- $length = func_num_args() > 2
- ? func_get_arg(2)
- : \Piwik\Core\self::strlen($string);
-
- return $substr($string, $start, $length);
- }
-
- /**
- * byte-oriented strlen() - ASCII
- *
- * @param string $string
- * @return int
- */
- public static function strlen($string)
- {
- // in case mbstring overloads strlen function
- $strlen = function_exists('mb_orig_strlen') ? 'mb_orig_strlen' : 'strlen';
- return $strlen($string);
- }
-
- /**
- * multi-byte substr() - UTF-8
- *
- * @param string $string
- * @param int $start
- * @param int ... optional length
- * @return string
- */
- public static function mb_substr($string, $start)
- {
- $length = func_num_args() > 2
- ? func_get_arg(2)
- : \Piwik\Core\self::mb_strlen($string);
-
- if (function_exists('mb_substr')) {
- return mb_substr($string, $start, $length, 'UTF-8');
- }
+ /**
+ * Get canonicalized absolute path
+ * See http://php.net/realpath
+ *
+ * @param string $path
+ * @return string canonicalized absolute path
+ */
+ public static function realpath($path)
+ {
+ if (file_exists($path)) {
+ return realpath($path);
+ }
+ return $path;
+ }
+
+ /**
+ * Returns true if the string is a valid filename
+ * File names that start with a-Z or 0-9 and contain a-Z, 0-9, underscore(_), dash(-), and dot(.) will be accepted.
+ * File names beginning with anything but a-Z or 0-9 will be rejected (including .htaccess for example).
+ * File names containing anything other than above mentioned will also be rejected (file names with spaces won't be accepted).
+ *
+ * @param string $filename
+ * @return bool
+ *
+ */
+ public static function isValidFilename($filename)
+ {
+ return (0 !== preg_match('/(^[a-zA-Z0-9]+([a-zA-Z_0-9.-]*))$/D', $filename));
+ }
+
+ /*
+ * String operations
+ */
+
+ /**
+ * byte-oriented substr() - ASCII
+ *
+ * @param string $string
+ * @param int $start
+ * @param int ... optional length
+ * @return string
+ */
+ public static function substr($string, $start)
+ {
+ // in case mbstring overloads substr function
+ $substr = function_exists('mb_orig_substr') ? 'mb_orig_substr' : 'substr';
+
+ $length = func_num_args() > 2
+ ? func_get_arg(2)
+ : self::strlen($string);
+
+ return $substr($string, $start, $length);
+ }
+
+ /**
+ * byte-oriented strlen() - ASCII
+ *
+ * @param string $string
+ * @return int
+ */
+ public static function strlen($string)
+ {
+ // in case mbstring overloads strlen function
+ $strlen = function_exists('mb_orig_strlen') ? 'mb_orig_strlen' : 'strlen';
+ return $strlen($string);
+ }
+
+ /**
+ * multi-byte substr() - UTF-8
+ *
+ * @param string $string
+ * @param int $start
+ * @param int ... optional length
+ * @return string
+ */
+ public static function mb_substr($string, $start)
+ {
+ $length = func_num_args() > 2
+ ? func_get_arg(2)
+ : self::mb_strlen($string);
- return substr($string, $start, $length);
+ if (function_exists('mb_substr')) {
+ return mb_substr($string, $start, $length, 'UTF-8');
}
- /**
- * multi-byte strlen() - UTF-8
- *
- * @param string $string
- * @return int
- */
- public static function mb_strlen($string)
- {
- if (function_exists('mb_strlen')) {
- return mb_strlen($string, 'UTF-8');
- }
+ return substr($string, $start, $length);
+ }
- return strlen($string);
+ /**
+ * multi-byte strlen() - UTF-8
+ *
+ * @param string $string
+ * @return int
+ */
+ public static function mb_strlen($string)
+ {
+ if (function_exists('mb_strlen')) {
+ return mb_strlen($string, 'UTF-8');
}
- /**
- * multi-byte strtolower() - UTF-8
- *
- * @param string $string
- * @return string
- */
- public static function mb_strtolower($string)
- {
- if (function_exists('mb_strtolower')) {
- return mb_strtolower($string, 'UTF-8');
- }
+ return strlen($string);
+ }
- return strtolower($string);
- }
-
- /*
- * Escaping input
- */
-
- /**
- * Returns the variable after cleaning operations.
- * NB: The variable still has to be escaped before going into a SQL Query!
- *
- * If an array is passed the cleaning is done recursively on all the sub-arrays.
- * The array's keys are filtered as well!
- *
- * How this method works:
- * - The variable returned has been htmlspecialchars to avoid the XSS security problem.
- * - The single quotes are not protected so "Piwik's amazing" will still be "Piwik's amazing".
- *
- * - Transformations are:
- * - '&' (ampersand) becomes '&amp;'
- * - '"'(double quote) becomes '&quot;'
- * - '<' (less than) becomes '&lt;'
- * - '>' (greater than) becomes '&gt;'
- * - It handles the magic_quotes setting.
- * - A non string value is returned without modification
- *
- * @param mixed $value The variable to be cleaned
- * @param bool $alreadyStripslashed
- * @throws Exception
- * @return mixed The variable after cleaning
- */
- public static function sanitizeInputValues($value, $alreadyStripslashed = false)
- {
- if (is_numeric($value)) {
- return $value;
- } elseif (is_string($value)) {
- $value = \Piwik\Core\self::sanitizeInputValue($value);
-
- if (!$alreadyStripslashed) // a JSON array was already stripslashed, don't do it again for each value
- {
- $value = \Piwik\Core\self::undoMagicQuotes($value);
- }
- } elseif (is_array($value)) {
- foreach (array_keys($value) as $key) {
- $newKey = $key;
- $newKey = \Piwik\Core\self::sanitizeInputValues($newKey, $alreadyStripslashed);
- if ($key != $newKey) {
- $value[$newKey] = $value[$key];
- unset($value[$key]);
- }
+ /**
+ * multi-byte strtolower() - UTF-8
+ *
+ * @param string $string
+ * @return string
+ */
+ public static function mb_strtolower($string)
+ {
+ if (function_exists('mb_strtolower')) {
+ return mb_strtolower($string, 'UTF-8');
+ }
+
+ return strtolower($string);
+ }
+
+ /*
+ * Escaping input
+ */
- $value[$newKey] = \Piwik\Core\self::sanitizeInputValues($value[$newKey], $alreadyStripslashed);
+ /**
+ * Returns the variable after cleaning operations.
+ * NB: The variable still has to be escaped before going into a SQL Query!
+ *
+ * If an array is passed the cleaning is done recursively on all the sub-arrays.
+ * The array's keys are filtered as well!
+ *
+ * How this method works:
+ * - The variable returned has been htmlspecialchars to avoid the XSS security problem.
+ * - The single quotes are not protected so "Piwik's amazing" will still be "Piwik's amazing".
+ *
+ * - Transformations are:
+ * - '&' (ampersand) becomes '&amp;'
+ * - '"'(double quote) becomes '&quot;'
+ * - '<' (less than) becomes '&lt;'
+ * - '>' (greater than) becomes '&gt;'
+ * - It handles the magic_quotes setting.
+ * - A non string value is returned without modification
+ *
+ * @param mixed $value The variable to be cleaned
+ * @param bool $alreadyStripslashed
+ * @throws Exception
+ * @return mixed The variable after cleaning
+ */
+ public static function sanitizeInputValues($value, $alreadyStripslashed = false)
+ {
+ if (is_numeric($value)) {
+ return $value;
+ } elseif (is_string($value)) {
+ $value = self::sanitizeInputValue($value);
+
+ if (!$alreadyStripslashed) // a JSON array was already stripslashed, don't do it again for each value
+ {
+ $value = self::undoMagicQuotes($value);
+ }
+ } elseif (is_array($value)) {
+ foreach (array_keys($value) as $key) {
+ $newKey = $key;
+ $newKey = self::sanitizeInputValues($newKey, $alreadyStripslashed);
+ if ($key != $newKey) {
+ $value[$newKey] = $value[$key];
+ unset($value[$key]);
}
- } elseif (!is_null($value)
- && !is_bool($value)
- ) {
- throw new Exception("The value to escape has not a supported type. Value = " . var_export($value, true));
+
+ $value[$newKey] = self::sanitizeInputValues($value[$newKey], $alreadyStripslashed);
}
- return $value;
+ } elseif (!is_null($value)
+ && !is_bool($value)
+ ) {
+ throw new Exception("The value to escape has not a supported type. Value = " . var_export($value, true));
}
+ return $value;
+ }
+
+ /**
+ * Sanitize a single input value
+ *
+ * @param string $value
+ * @return string sanitized input
+ */
+ public static function sanitizeInputValue($value)
+ {
+ // $_GET and $_REQUEST already urldecode()'d
+ // decode
+ // note: before php 5.2.7, htmlspecialchars() double encodes &#x hex items
+ $value = html_entity_decode($value, \Piwik\Common::HTML_ENCODING_QUOTE_STYLE, 'UTF-8');
+
+ // filter
+ $value = str_replace(array("\n", "\r", "\0"), '', $value);
+
+ // escape
+ $tmp = @htmlspecialchars($value, self::HTML_ENCODING_QUOTE_STYLE, 'UTF-8');
+
+ // note: php 5.2.5 and above, htmlspecialchars is destructive if input is not UTF-8
+ if ($value != '' && $tmp == '') {
+ // convert and escape
+ $value = utf8_encode($value);
+ $tmp = htmlspecialchars($value, self::HTML_ENCODING_QUOTE_STYLE, 'UTF-8');
+ }
+ return $tmp;
+ }
+
+ /**
+ * Unsanitize a single input value
+ *
+ * @param string $value
+ * @return string unsanitized input
+ */
+ public static function unsanitizeInputValue($value)
+ {
+ return htmlspecialchars_decode($value, self::HTML_ENCODING_QUOTE_STYLE);
+ }
- /**
- * Sanitize a single input value
- *
- * @param string $value
- * @return string sanitized input
- */
- public static function sanitizeInputValue($value)
- {
- // $_GET and $_REQUEST already urldecode()'d
- // decode
- // note: before php 5.2.7, htmlspecialchars() double encodes &#x hex items
- $value = html_entity_decode($value, \Piwik\Core\Common::HTML_ENCODING_QUOTE_STYLE, 'UTF-8');
-
- // filter
- $value = str_replace(array("\n", "\r", "\0"), '', $value);
-
- // escape
- $tmp = @htmlspecialchars($value, \Piwik\Core\self::HTML_ENCODING_QUOTE_STYLE, 'UTF-8');
-
- // note: php 5.2.5 and above, htmlspecialchars is destructive if input is not UTF-8
- if ($value != '' && $tmp == '') {
- // convert and escape
- $value = utf8_encode($value);
- $tmp = htmlspecialchars($value, \Piwik\Core\self::HTML_ENCODING_QUOTE_STYLE, 'UTF-8');
+ /**
+ * Unsanitize one or more values.
+ *
+ * @param string|array $value
+ * @return string|array unsanitized input
+ */
+ public static function unsanitizeInputValues($value)
+ {
+ if (is_array($value)) {
+ $result = array();
+ foreach ($value as $key => $arrayValue) {
+ $result[$key] = self::unsanitizeInputValues($arrayValue);
}
- return $tmp;
- }
-
- /**
- * Unsanitize a single input value
- *
- * @param string $value
- * @return string unsanitized input
- */
- public static function unsanitizeInputValue($value)
- {
- return htmlspecialchars_decode($value, \Piwik\Core\self::HTML_ENCODING_QUOTE_STYLE);
- }
-
- /**
- * Unsanitize one or more values.
- *
- * @param string|array $value
- * @return string|array unsanitized input
- */
- public static function unsanitizeInputValues($value)
- {
- if (is_array($value)) {
- $result = array();
- foreach ($value as $key => $arrayValue) {
- $result[$key] = \Piwik\Core\self::unsanitizeInputValues($arrayValue);
- }
- return $result;
+ return $result;
+ } else {
+ return self::unsanitizeInputValue($value);
+ }
+ }
+
+ /**
+ * Undo the damage caused by magic_quotes; deprecated in php 5.3 but not removed until php 5.4
+ *
+ * @param string
+ * @return string modified or not
+ */
+ public static function undoMagicQuotes($value)
+ {
+ return version_compare(PHP_VERSION, '5.4', '<')
+ && get_magic_quotes_gpc()
+ ? stripslashes($value)
+ : $value;
+ }
+
+ /**
+ * Returns a sanitized variable value from the $_GET and $_POST superglobal.
+ * If the variable doesn't have a value or an empty value, returns the defaultValue if specified.
+ * If the variable doesn't have neither a value nor a default value provided, an exception is raised.
+ *
+ * @see sanitizeInputValues() for the applied sanitization
+ *
+ * @param string $varName name of the variable
+ * @param string $varDefault default value. If '', and if the type doesn't match, exit() !
+ * @param string $varType Expected type, the value must be one of the following: array, int, integer, string, json
+ * @param array $requestArrayToUse
+ *
+ * @throws Exception if the variable type is not known
+ * or if the variable we want to read doesn't have neither a value nor a default value specified
+ *
+ * @return mixed The variable after cleaning
+ */
+ public static function getRequestVar($varName, $varDefault = null, $varType = null, $requestArrayToUse = null)
+ {
+ if (is_null($requestArrayToUse)) {
+ $requestArrayToUse = $_GET + $_POST;
+ }
+ $varDefault = self::sanitizeInputValues($varDefault);
+ if ($varType === 'int') {
+ // settype accepts only integer
+ // 'int' is simply a shortcut for 'integer'
+ $varType = 'integer';
+ }
+
+ // there is no value $varName in the REQUEST so we try to use the default value
+ if (empty($varName)
+ || !isset($requestArrayToUse[$varName])
+ || (!is_array($requestArrayToUse[$varName])
+ && strlen($requestArrayToUse[$varName]) === 0
+ )
+ ) {
+ if (is_null($varDefault)) {
+ throw new Exception("The parameter '$varName' isn't set in the Request, and a default value wasn't provided.");
} else {
- return \Piwik\Core\self::unsanitizeInputValue($value);
+ if (!is_null($varType)
+ && in_array($varType, array('string', 'integer', 'array'))
+ ) {
+ settype($varDefault, $varType);
+ }
+ return $varDefault;
}
}
- /**
- * Undo the damage caused by magic_quotes; deprecated in php 5.3 but not removed until php 5.4
- *
- * @param string
- * @return string modified or not
- */
- public static function undoMagicQuotes($value)
- {
- return version_compare(PHP_VERSION, '5.4', '<')
- && get_magic_quotes_gpc()
- ? stripslashes($value)
- : $value;
- }
-
- /**
- * Returns a sanitized variable value from the $_GET and $_POST superglobal.
- * If the variable doesn't have a value or an empty value, returns the defaultValue if specified.
- * If the variable doesn't have neither a value nor a default value provided, an exception is raised.
- *
- * @see sanitizeInputValues() for the applied sanitization
- *
- * @param string $varName name of the variable
- * @param string $varDefault default value. If '', and if the type doesn't match, exit() !
- * @param string $varType Expected type, the value must be one of the following: array, int, integer, string, json
- * @param array $requestArrayToUse
- *
- * @throws Exception if the variable type is not known
- * or if the variable we want to read doesn't have neither a value nor a default value specified
- *
- * @return mixed The variable after cleaning
- */
- public static function getRequestVar($varName, $varDefault = null, $varType = null, $requestArrayToUse = null)
- {
- if (is_null($requestArrayToUse)) {
- $requestArrayToUse = $_GET + $_POST;
- }
- $varDefault = \Piwik\Core\self::sanitizeInputValues($varDefault);
- if ($varType === 'int') {
- // settype accepts only integer
- // 'int' is simply a shortcut for 'integer'
- $varType = 'integer';
+ // Normal case, there is a value available in REQUEST for the requested varName:
+
+ // we deal w/ json differently
+ if ($varType == 'json') {
+ $value = self::undoMagicQuotes($requestArrayToUse[$varName]);
+ $value = self::json_decode($value, $assoc = true);
+ return self::sanitizeInputValues($value, $alreadyStripslashed = true);
+ }
+
+ $value = self::sanitizeInputValues($requestArrayToUse[$varName]);
+ if (!is_null($varType)) {
+ $ok = false;
+
+ if ($varType === 'string') {
+ if (is_string($value)) $ok = true;
+ } elseif ($varType === 'integer') {
+ if ($value == (string)(int)$value) $ok = true;
+ } elseif ($varType === 'float') {
+ if ($value == (string)(float)$value) $ok = true;
+ } elseif ($varType === 'array') {
+ if (is_array($value)) $ok = true;
+ } else {
+ throw new Exception("\$varType specified is not known. It should be one of the following: array, int, integer, float, string");
}
- // there is no value $varName in the REQUEST so we try to use the default value
- if (empty($varName)
- || !isset($requestArrayToUse[$varName])
- || (!is_array($requestArrayToUse[$varName])
- && strlen($requestArrayToUse[$varName]) === 0
- )
- ) {
- if (is_null($varDefault)) {
- throw new Exception("The parameter '$varName' isn't set in the Request, and a default value wasn't provided.");
- } else {
- if (!is_null($varType)
- && in_array($varType, array('string', 'integer', 'array'))
- ) {
- settype($varDefault, $varType);
- }
+ // The type is not correct
+ if ($ok === false) {
+ if ($varDefault === null) {
+ throw new Exception("The parameter '$varName' doesn't have a correct type, and a default value wasn't provided.");
+ } // we return the default value with the good type set
+ else {
+ settype($varDefault, $varType);
return $varDefault;
}
}
+ settype($value, $varType);
+ }
+ return $value;
+ }
- // Normal case, there is a value available in REQUEST for the requested varName:
+ /*
+ * Generating unique strings
+ */
- // we deal w/ json differently
- if ($varType == 'json') {
- $value = \Piwik\Core\self::undoMagicQuotes($requestArrayToUse[$varName]);
- $value = \Piwik\Core\Common::json_decode($value, $assoc = true);
- return \Piwik\Core\self::sanitizeInputValues($value, $alreadyStripslashed = true);
- }
+ /**
+ * Returns a 32 characters long uniq ID
+ *
+ * @return string 32 chars
+ */
+ public static function generateUniqId()
+ {
+ return md5(uniqid(rand(), true));
+ }
- $value = \Piwik\Core\self::sanitizeInputValues($requestArrayToUse[$varName]);
- if (!is_null($varType)) {
- $ok = false;
-
- if ($varType === 'string') {
- if (is_string($value)) $ok = true;
- } elseif ($varType === 'integer') {
- if ($value == (string)(int)$value) $ok = true;
- } elseif ($varType === 'float') {
- if ($value == (string)(float)$value) $ok = true;
- } elseif ($varType === 'array') {
- if (is_array($value)) $ok = true;
- } else {
- throw new Exception("\$varType specified is not known. It should be one of the following: array, int, integer, float, string");
- }
+ /**
+ * Get salt from [superuser] section
+ *
+ * @return string
+ */
+ public static function getSalt()
+ {
+ static $salt = null;
+ if (is_null($salt)) {
+ $salt = @Config::getInstance()->superuser['salt'];
+ }
+ return $salt;
+ }
- // The type is not correct
- if ($ok === false) {
- if ($varDefault === null) {
- throw new Exception("The parameter '$varName' doesn't have a correct type, and a default value wasn't provided.");
- } // we return the default value with the good type set
- else {
- settype($varDefault, $varType);
- return $varDefault;
- }
- }
- settype($value, $varType);
- }
- return $value;
+ /**
+ * Configureable hash() algorithm (defaults to md5)
+ *
+ * @param string $str String to be hashed
+ * @param bool $raw_output
+ * @return string Hash string
+ */
+ public static function hash($str, $raw_output = false)
+ {
+ static $hashAlgorithm = null;
+ if (is_null($hashAlgorithm)) {
+ $hashAlgorithm = @Config::getInstance()->General['hash_algorithm'];
}
- /*
- * Generating unique strings
- */
-
- /**
- * Returns a 32 characters long uniq ID
- *
- * @return string 32 chars
- */
- public static function generateUniqId()
- {
- return md5(uniqid(rand(), true));
- }
-
- /**
- * Get salt from [superuser] section
- *
- * @return string
- */
- public static function getSalt()
- {
- static $salt = null;
- if (is_null($salt)) {
- $salt = @Config::getInstance()->superuser['salt'];
- }
- return $salt;
- }
-
- /**
- * Configureable hash() algorithm (defaults to md5)
- *
- * @param string $str String to be hashed
- * @param bool $raw_output
- * @return string Hash string
- */
- public static function hash($str, $raw_output = false)
- {
- static $hashAlgorithm = null;
- if (is_null($hashAlgorithm)) {
- $hashAlgorithm = @Config::getInstance()->General['hash_algorithm'];
- }
+ if ($hashAlgorithm) {
+ $hash = @hash($hashAlgorithm, $str, $raw_output);
+ if ($hash !== false)
+ return $hash;
+ }
- if ($hashAlgorithm) {
- $hash = @hash($hashAlgorithm, $str, $raw_output);
- if ($hash !== false)
- return $hash;
- }
+ return md5($str, $raw_output);
+ }
- return md5($str, $raw_output);
+ /**
+ * Generate random string
+ *
+ * @param int $length string length
+ * @param string $alphabet characters allowed in random string
+ * @return string random string with given length
+ */
+ public static function getRandomString($length = 16, $alphabet = "abcdefghijklmnoprstuvwxyz0123456789")
+ {
+ $chars = $alphabet;
+ $str = '';
+
+ list($usec, $sec) = explode(" ", microtime());
+ $seed = ((float)$sec + (float)$usec) * 100000;
+ mt_srand($seed);
+
+ for ($i = 0; $i < $length; $i++) {
+ $rand_key = mt_rand(0, strlen($chars) - 1);
+ $str .= substr($chars, $rand_key, 1);
}
+ return str_shuffle($str);
+ }
- /**
- * Generate random string
- *
- * @param int $length string length
- * @param string $alphabet characters allowed in random string
- * @return string random string with given length
- */
- public static function getRandomString($length = 16, $alphabet = "abcdefghijklmnoprstuvwxyz0123456789")
- {
- $chars = $alphabet;
- $str = '';
+ /*
+ * Conversions
+ */
- list($usec, $sec) = explode(" ", microtime());
- $seed = ((float)$sec + (float)$usec) * 100000;
- mt_srand($seed);
+ /**
+ * Convert hexadecimal representation into binary data.
+ * !! Will emit warning if input string is not hex!!
+ *
+ * @see http://php.net/bin2hex
+ *
+ * @param string $str Hexadecimal representation
+ * @return string
+ */
+ public static function hex2bin($str)
+ {
+ return pack("H*", $str);
+ }
- for ($i = 0; $i < $length; $i++) {
- $rand_key = mt_rand(0, strlen($chars) - 1);
- $str .= substr($chars, $rand_key, 1);
- }
- return str_shuffle($str);
- }
-
- /*
- * Conversions
- */
-
- /**
- * Convert hexadecimal representation into binary data.
- * !! Will emit warning if input string is not hex!!
- *
- * @see http://php.net/bin2hex
- *
- * @param string $str Hexadecimal representation
- * @return string
- */
- public static function hex2bin($str)
- {
- return pack("H*", $str);
- }
-
- /**
- * This function will convert the input string to the binary representation of the ID
- * but it will throw an Exception if the specified input ID is not correct
- *
- * This is used when building segments containing visitorId which could be an invalid string
- * therefore throwing Unexpected PHP error [pack(): Type H: illegal hex digit i] severity [E_WARNING]
- *
- * It would be simply to silent fail the pack() call above but in all other cases, we don't expect an error,
- * so better be safe and get the php error when something unexpected is happening
- * @param string $id
- * @throws Exception
- * @return string binary string
- */
- public static function convertVisitorIdToBin($id)
- {
- if (strlen($id) !== Piwik_Tracker::LENGTH_HEX_ID_STRING
- || @bin2hex(\Piwik\Core\self::hex2bin($id)) != $id
- ) {
- throw new Exception("visitorId is expected to be a " . Piwik_Tracker::LENGTH_HEX_ID_STRING . " hex char string");
- }
- return \Piwik\Core\self::hex2bin($id);
- }
-
- /**
- * Convert IP address (in network address format) to presentation format.
- * This is a backward compatibility function for code that only expects
- * IPv4 addresses (i.e., doesn't support IPv6).
- *
- * @see Piwik_IP::N2P()
- *
- * This function does not support the long (or its string representation)
- * returned by the built-in ip2long() function, from Piwik 1.3 and earlier.
- *
- * @deprecated 1.4
- *
- * @param string $ip IP address in network address format
- * @return string
- */
- public static function long2ip($ip)
- {
- return Piwik_IP::long2ip($ip);
- }
-
- /**
- * Should we use the replacement json_encode/json_decode functions?
- *
- * @return bool True if broken; false otherwise
- */
- private static function useJsonLibrary()
- {
- static $useLib;
-
- if (!isset($useLib)) {
- /*
- * 5.1.x - doesn't have json extension; we use lib/upgradephp instead
- * 5.2 to 5.2.4 - broken in various ways, including:
- *
- * @see https://bugs.php.net/bug.php?id=38680 'json_decode cannot decode basic types'
- * @see https://bugs.php.net/bug.php?id=41403 'json_decode cannot decode floats'
- * @see https://bugs.php.net/bug.php?id=42785 'json_encode outputs numbers according to locale'
- */
- $useLib = false;
- if (version_compare(PHP_VERSION, '5.2.1') < 0) {
- $useLib = true;
- } else if (version_compare(PHP_VERSION, '5.2.5') < 0) {
- $info = localeconv();
- $useLib = $info['decimal_point'] != '.';
- }
- }
+ /**
+ * This function will convert the input string to the binary representation of the ID
+ * but it will throw an Exception if the specified input ID is not correct
+ *
+ * This is used when building segments containing visitorId which could be an invalid string
+ * therefore throwing Unexpected PHP error [pack(): Type H: illegal hex digit i] severity [E_WARNING]
+ *
+ * It would be simply to silent fail the pack() call above but in all other cases, we don't expect an error,
+ * so better be safe and get the php error when something unexpected is happening
+ * @param string $id
+ * @throws Exception
+ * @return string binary string
+ */
+ public static function convertVisitorIdToBin($id)
+ {
+ if (strlen($id) !== Piwik_Tracker::LENGTH_HEX_ID_STRING
+ || @bin2hex(self::hex2bin($id)) != $id
+ ) {
+ throw new Exception("visitorId is expected to be a " . Piwik_Tracker::LENGTH_HEX_ID_STRING . " hex char string");
+ }
+ return self::hex2bin($id);
+ }
+
+ /**
+ * Convert IP address (in network address format) to presentation format.
+ * This is a backward compatibility function for code that only expects
+ * IPv4 addresses (i.e., doesn't support IPv6).
+ *
+ * @see Piwik_IP::N2P()
+ *
+ * This function does not support the long (or its string representation)
+ * returned by the built-in ip2long() function, from Piwik 1.3 and earlier.
+ *
+ * @deprecated 1.4
+ *
+ * @param string $ip IP address in network address format
+ * @return string
+ */
+ public static function long2ip($ip)
+ {
+ return Piwik_IP::long2ip($ip);
+ }
- return $useLib;
+ /**
+ * Should we use the replacement json_encode/json_decode functions?
+ *
+ * @return bool True if broken; false otherwise
+ */
+ private static function useJsonLibrary()
+ {
+ static $useLib;
+
+ if (!isset($useLib)) {
+ /*
+ * 5.1.x - doesn't have json extension; we use lib/upgradephp instead
+ * 5.2 to 5.2.4 - broken in various ways, including:
+ *
+ * @see https://bugs.php.net/bug.php?id=38680 'json_decode cannot decode basic types'
+ * @see https://bugs.php.net/bug.php?id=41403 'json_decode cannot decode floats'
+ * @see https://bugs.php.net/bug.php?id=42785 'json_encode outputs numbers according to locale'
+ */
+ $useLib = false;
+ if (version_compare(PHP_VERSION, '5.2.1') < 0) {
+ $useLib = true;
+ } else if (version_compare(PHP_VERSION, '5.2.5') < 0) {
+ $info = localeconv();
+ $useLib = $info['decimal_point'] != '.';
+ }
+ }
+
+ return $useLib;
+ }
+
+ /**
+ * JSON encode wrapper
+ * - missing or broken in some php 5.x versions
+ *
+ * @param mixed $value
+ * @return string
+ */
+ public static function json_encode($value)
+ {
+ if (self::useJsonLibrary()) {
+ return _json_encode($value);
}
- /**
- * JSON encode wrapper
- * - missing or broken in some php 5.x versions
- *
- * @param mixed $value
- * @return string
- */
- public static function json_encode($value)
- {
- if (\Piwik\Core\self::useJsonLibrary()) {
- return _json_encode($value);
- }
+ return @json_encode($value);
+ }
- return @json_encode($value);
- }
-
- /**
- * JSON decode wrapper
- * - missing or broken in some php 5.x versions
- *
- * @param string $json
- * @param bool $assoc
- * @return mixed
- */
- public static function json_decode($json, $assoc = false)
- {
- if (\Piwik\Core\self::useJsonLibrary()) {
- return _json_decode($json, $assoc);
- }
+ /**
+ * JSON decode wrapper
+ * - missing or broken in some php 5.x versions
+ *
+ * @param string $json
+ * @param bool $assoc
+ * @return mixed
+ */
+ public static function json_decode($json, $assoc = false)
+ {
+ if (self::useJsonLibrary()) {
+ return _json_decode($json, $assoc);
+ }
- return json_decode($json, $assoc);
- }
-
- /*
- * DataFiles
- */
-
- /**
- * Returns list of continent codes
- *
- * @see core/DataFiles/Countries.php
- *
- * @return array Array of 3 letter continent codes
- */
- public static function getContinentsList()
- {
- require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/Countries.php';
-
- $continentsList = $GLOBALS['Piwik_ContinentList'];
- return $continentsList;
- }
-
- /**
- * Returns list of valid country codes
- *
- * @see core/DataFiles/Countries.php
- *
- * @param bool $includeInternalCodes
- * @return array Array of (2 letter ISO codes => 3 letter continent code)
- */
- public static function getCountriesList($includeInternalCodes = false)
- {
- require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/Countries.php';
-
- $countriesList = $GLOBALS['Piwik_CountryList'];
- $extras = $GLOBALS['Piwik_CountryList_Extras'];
-
- if ($includeInternalCodes) {
- return array_merge($countriesList, $extras);
- }
- return $countriesList;
- }
-
- /**
- * Returns list of valid language codes
- *
- * @see core/DataFiles/Languages.php
- *
- * @return array Array of 2 letter ISO codes => Language name (in English)
- */
- public static function getLanguagesList()
- {
- require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/Languages.php';
-
- $languagesList = $GLOBALS['Piwik_LanguageList'];
- return $languagesList;
- }
-
- /**
- * Returns list of language to country mappings
- *
- * @see core/DataFiles/LanguageToCountry.php
- *
- * @return array Array of ( 2 letter ISO language codes => 2 letter ISO country codes )
- */
- public static function getLanguageToCountryList()
- {
- require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/LanguageToCountry.php';
-
- $languagesList = $GLOBALS['Piwik_LanguageToCountry'];
- return $languagesList;
- }
-
- /**
- * Returns list of search engines by URL
- *
- * @see core/DataFiles/SearchEngines.php
- *
- * @return array Array of ( URL => array( searchEngineName, keywordParameter, path, charset ) )
- */
- public static function getSearchEngineUrls()
- {
- require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/SearchEngines.php';
-
- $searchEngines = $GLOBALS['Piwik_SearchEngines'];
- return $searchEngines;
- }
-
- /**
- * Returns list of search engines by name
- *
- * @see core/DataFiles/SearchEngines.php
- *
- * @return array Array of ( searchEngineName => URL )
- */
- public static function getSearchEngineNames()
- {
- require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/SearchEngines.php';
-
- $searchEngines = $GLOBALS['Piwik_SearchEngines_NameToUrl'];
- return $searchEngines;
- }
-
- /**
- * Returns list of provider names
- *
- * @see core/DataFiles/Providers.php
- *
- * @return array Array of ( dnsName => providerName )
- */
- public static function getProviderNames()
- {
- require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/Providers.php';
-
- $providers = $GLOBALS['Piwik_ProviderNames'];
- return $providers;
- }
-
- /*
- * Language, country, continent
- */
-
- /**
- * Returns the browser language code, eg. "en-gb,en;q=0.5"
- *
- * @param string|null $browserLang Optional browser language, otherwise taken from the request header
- * @return string
- */
- public static function getBrowserLanguage($browserLang = NULL)
- {
- static $replacementPatterns = array(
- // extraneous bits of RFC 3282 that we ignore
- '/(\\\\.)/', // quoted-pairs
- '/(\s+)/', // CFWcS white space
- '/(\([^)]*\))/', // CFWS comments
- '/(;q=[0-9.]+)/', // quality
-
- // found in the LANG environment variable
- '/\.(.*)/', // charset (e.g., en_CA.UTF-8)
- '/^C$/', // POSIX 'C' locale
- );
-
- if (is_null($browserLang)) {
- $browserLang = \Piwik\Core\self::sanitizeInputValues(@$_SERVER['HTTP_ACCEPT_LANGUAGE']);
- if (empty($browserLang) && \Piwik\Core\self::isPhpCliMode()) {
- $browserLang = @getenv('LANG');
- }
- }
+ return json_decode($json, $assoc);
+ }
- if (is_null($browserLang)) {
- // a fallback might be to infer the language in HTTP_USER_AGENT (i.e., localized build)
- $browserLang = "";
- } else {
- // language tags are case-insensitive per HTTP/1.1 s3.10 but the region may be capitalized per ISO3166-1;
- // underscores are not permitted per RFC 4646 or 4647 (which obsolete RFC 1766 and 3066),
- // but we guard against a bad user agent which naively uses its locale
- $browserLang = strtolower(str_replace('_', '-', $browserLang));
+ /*
+ * DataFiles
+ */
- // filters
- $browserLang = preg_replace($replacementPatterns, '', $browserLang);
+ /**
+ * Returns list of continent codes
+ *
+ * @see core/DataFiles/Countries.php
+ *
+ * @return array Array of 3 letter continent codes
+ */
+ public static function getContinentsList()
+ {
+ require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/Countries.php';
- $browserLang = preg_replace('/((^|,)chrome:.*)/', '', $browserLang, 1); // Firefox bug
- $browserLang = preg_replace('/(,)(?:en-securid,)|(?:(^|,)en-securid(,|$))/', '$1', $browserLang, 1); // unregistered language tag
+ $continentsList = $GLOBALS['Piwik_ContinentList'];
+ return $continentsList;
+ }
- $browserLang = str_replace('sr-sp', 'sr-rs', $browserLang); // unofficial (proposed) code in the wild
- }
+ /**
+ * Returns list of valid country codes
+ *
+ * @see core/DataFiles/Countries.php
+ *
+ * @param bool $includeInternalCodes
+ * @return array Array of (2 letter ISO codes => 3 letter continent code)
+ */
+ public static function getCountriesList($includeInternalCodes = false)
+ {
+ require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/Countries.php';
- return $browserLang;
- }
-
- /**
- * Returns the visitor country based on the Browser 'accepted language'
- * information, but provides a hook for geolocation via IP address.
- *
- * @param string $lang browser lang
- * @param bool $enableLanguageToCountryGuess If set to true, some assumption will be made and detection guessed more often, but accuracy could be affected
- * @param string $ip
- * @return string 2 letter ISO code
- */
- public static function getCountry($lang, $enableLanguageToCountryGuess, $ip)
- {
- $country = null;
- Piwik_PostEvent('Common.getCountry', array(&$country, $ip));
- if (!empty($country)) {
- return strtolower($country);
- }
+ $countriesList = $GLOBALS['Piwik_CountryList'];
+ $extras = $GLOBALS['Piwik_CountryList_Extras'];
+
+ if ($includeInternalCodes) {
+ return array_merge($countriesList, $extras);
+ }
+ return $countriesList;
+ }
+
+ /**
+ * Returns list of valid language codes
+ *
+ * @see core/DataFiles/Languages.php
+ *
+ * @return array Array of 2 letter ISO codes => Language name (in English)
+ */
+ public static function getLanguagesList()
+ {
+ require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/Languages.php';
+
+ $languagesList = $GLOBALS['Piwik_LanguageList'];
+ return $languagesList;
+ }
+
+ /**
+ * Returns list of language to country mappings
+ *
+ * @see core/DataFiles/LanguageToCountry.php
+ *
+ * @return array Array of ( 2 letter ISO language codes => 2 letter ISO country codes )
+ */
+ public static function getLanguageToCountryList()
+ {
+ require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/LanguageToCountry.php';
+
+ $languagesList = $GLOBALS['Piwik_LanguageToCountry'];
+ return $languagesList;
+ }
+
+ /**
+ * Returns list of search engines by URL
+ *
+ * @see core/DataFiles/SearchEngines.php
+ *
+ * @return array Array of ( URL => array( searchEngineName, keywordParameter, path, charset ) )
+ */
+ public static function getSearchEngineUrls()
+ {
+ require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/SearchEngines.php';
+
+ $searchEngines = $GLOBALS['Piwik_SearchEngines'];
+ return $searchEngines;
+ }
+
+ /**
+ * Returns list of search engines by name
+ *
+ * @see core/DataFiles/SearchEngines.php
+ *
+ * @return array Array of ( searchEngineName => URL )
+ */
+ public static function getSearchEngineNames()
+ {
+ require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/SearchEngines.php';
+
+ $searchEngines = $GLOBALS['Piwik_SearchEngines_NameToUrl'];
+ return $searchEngines;
+ }
+
+ /**
+ * Returns list of provider names
+ *
+ * @see core/DataFiles/Providers.php
+ *
+ * @return array Array of ( dnsName => providerName )
+ */
+ public static function getProviderNames()
+ {
+ require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/Providers.php';
+
+ $providers = $GLOBALS['Piwik_ProviderNames'];
+ return $providers;
+ }
+
+ /*
+ * Language, country, continent
+ */
+
+ /**
+ * Returns the browser language code, eg. "en-gb,en;q=0.5"
+ *
+ * @param string|null $browserLang Optional browser language, otherwise taken from the request header
+ * @return string
+ */
+ public static function getBrowserLanguage($browserLang = NULL)
+ {
+ static $replacementPatterns = array(
+ // extraneous bits of RFC 3282 that we ignore
+ '/(\\\\.)/', // quoted-pairs
+ '/(\s+)/', // CFWcS white space
+ '/(\([^)]*\))/', // CFWS comments
+ '/(;q=[0-9.]+)/', // quality
- if (empty($lang) || strlen($lang) < 2 || $lang == 'xx') {
- return 'xx';
+ // found in the LANG environment variable
+ '/\.(.*)/', // charset (e.g., en_CA.UTF-8)
+ '/^C$/', // POSIX 'C' locale
+ );
+
+ if (is_null($browserLang)) {
+ $browserLang = self::sanitizeInputValues(@$_SERVER['HTTP_ACCEPT_LANGUAGE']);
+ if (empty($browserLang) && self::isPhpCliMode()) {
+ $browserLang = @getenv('LANG');
}
+ }
- $validCountries = \Piwik\Core\self::getCountriesList();
- return \Piwik\Core\self::extractCountryCodeFromBrowserLanguage($lang, $validCountries, $enableLanguageToCountryGuess);
- }
-
- /**
- * Returns list of valid country codes
- *
- * @param string $browserLanguage
- * @param array $validCountries Array of valid countries
- * @param bool $enableLanguageToCountryGuess (if true, will guess country based on language that lacks region information)
- * @return array Array of 2 letter ISO codes
- */
- public static function extractCountryCodeFromBrowserLanguage($browserLanguage, $validCountries, $enableLanguageToCountryGuess)
- {
- $langToCountry = \Piwik\Core\self::getLanguageToCountryList();
-
- if ($enableLanguageToCountryGuess) {
- if (preg_match('/^([a-z]{2,3})(?:,|;|$)/', $browserLanguage, $matches)) {
- // match language (without region) to infer the country of origin
- if (array_key_exists($matches[1], $langToCountry)) {
- return $langToCountry[$matches[1]];
- }
+ if (is_null($browserLang)) {
+ // a fallback might be to infer the language in HTTP_USER_AGENT (i.e., localized build)
+ $browserLang = "";
+ } else {
+ // language tags are case-insensitive per HTTP/1.1 s3.10 but the region may be capitalized per ISO3166-1;
+ // underscores are not permitted per RFC 4646 or 4647 (which obsolete RFC 1766 and 3066),
+ // but we guard against a bad user agent which naively uses its locale
+ $browserLang = strtolower(str_replace('_', '-', $browserLang));
+
+ // filters
+ $browserLang = preg_replace($replacementPatterns, '', $browserLang);
+
+ $browserLang = preg_replace('/((^|,)chrome:.*)/', '', $browserLang, 1); // Firefox bug
+ $browserLang = preg_replace('/(,)(?:en-securid,)|(?:(^|,)en-securid(,|$))/', '$1', $browserLang, 1); // unregistered language tag
+
+ $browserLang = str_replace('sr-sp', 'sr-rs', $browserLang); // unofficial (proposed) code in the wild
+ }
+
+ return $browserLang;
+ }
+
+ /**
+ * Returns the visitor country based on the Browser 'accepted language'
+ * information, but provides a hook for geolocation via IP address.
+ *
+ * @param string $lang browser lang
+ * @param bool $enableLanguageToCountryGuess If set to true, some assumption will be made and detection guessed more often, but accuracy could be affected
+ * @param string $ip
+ * @return string 2 letter ISO code
+ */
+ public static function getCountry($lang, $enableLanguageToCountryGuess, $ip)
+ {
+ $country = null;
+ Piwik_PostEvent('Common.getCountry', array(&$country, $ip));
+ if (!empty($country)) {
+ return strtolower($country);
+ }
+
+ if (empty($lang) || strlen($lang) < 2 || $lang == 'xx') {
+ return 'xx';
+ }
+
+ $validCountries = self::getCountriesList();
+ return self::extractCountryCodeFromBrowserLanguage($lang, $validCountries, $enableLanguageToCountryGuess);
+ }
+
+ /**
+ * Returns list of valid country codes
+ *
+ * @param string $browserLanguage
+ * @param array $validCountries Array of valid countries
+ * @param bool $enableLanguageToCountryGuess (if true, will guess country based on language that lacks region information)
+ * @return array Array of 2 letter ISO codes
+ */
+ public static function extractCountryCodeFromBrowserLanguage($browserLanguage, $validCountries, $enableLanguageToCountryGuess)
+ {
+ $langToCountry = self::getLanguageToCountryList();
+
+ if ($enableLanguageToCountryGuess) {
+ if (preg_match('/^([a-z]{2,3})(?:,|;|$)/', $browserLanguage, $matches)) {
+ // match language (without region) to infer the country of origin
+ if (array_key_exists($matches[1], $langToCountry)) {
+ return $langToCountry[$matches[1]];
}
}
+ }
- if (!empty($validCountries) && preg_match_all('/[-]([a-z]{2})/', $browserLanguage, $matches, PREG_SET_ORDER)) {
- foreach ($matches as $parts) {
- // match location; we don't make any inferences from the language
- if (array_key_exists($parts[1], $validCountries)) {
- return $parts[1];
- }
+ if (!empty($validCountries) && preg_match_all('/[-]([a-z]{2})/', $browserLanguage, $matches, PREG_SET_ORDER)) {
+ foreach ($matches as $parts) {
+ // match location; we don't make any inferences from the language
+ if (array_key_exists($parts[1], $validCountries)) {
+ return $parts[1];
}
}
- return 'xx';
}
+ return 'xx';
+ }
- /**
- * Returns the visitor language based only on the Browser 'accepted language' information
- *
- * @param string $browserLanguage Browser's accepted langauge header
- * @param array $validLanguages array of valid language codes
- * @return string 2 letter ISO 639 code
- */
- public static function extractLanguageCodeFromBrowserLanguage($browserLanguage, $validLanguages)
- {
- // assumes language preference is sorted;
- // does not handle language-script-region tags or language range (*)
- if (!empty($validLanguages) && preg_match_all('/(?:^|,)([a-z]{2,3})([-][a-z]{2})?/', $browserLanguage, $matches, PREG_SET_ORDER)) {
- foreach ($matches as $parts) {
- if (count($parts) == 3) {
- // match locale (language and location)
- if (in_array($parts[1] . $parts[2], $validLanguages)) {
- return $parts[1] . $parts[2];
- }
- }
- // match language only (where no region provided)
- if (in_array($parts[1], $validLanguages)) {
- return $parts[1];
+ /**
+ * Returns the visitor language based only on the Browser 'accepted language' information
+ *
+ * @param string $browserLanguage Browser's accepted langauge header
+ * @param array $validLanguages array of valid language codes
+ * @return string 2 letter ISO 639 code
+ */
+ public static function extractLanguageCodeFromBrowserLanguage($browserLanguage, $validLanguages)
+ {
+ // assumes language preference is sorted;
+ // does not handle language-script-region tags or language range (*)
+ if (!empty($validLanguages) && preg_match_all('/(?:^|,)([a-z]{2,3})([-][a-z]{2})?/', $browserLanguage, $matches, PREG_SET_ORDER)) {
+ foreach ($matches as $parts) {
+ if (count($parts) == 3) {
+ // match locale (language and location)
+ if (in_array($parts[1] . $parts[2], $validLanguages)) {
+ return $parts[1] . $parts[2];
}
}
+ // match language only (where no region provided)
+ if (in_array($parts[1], $validLanguages)) {
+ return $parts[1];
+ }
}
- return 'xx';
}
+ return 'xx';
+ }
- /**
- * Returns the continent of a given country
- *
- * @param string $country 2 letters isocode
- *
- * @return string Continent (3 letters code : afr, asi, eur, amn, ams, oce)
- */
- public static function getContinent($country)
- {
- $countryList = \Piwik\Core\self::getCountriesList();
- if (isset($countryList[$country])) {
- return $countryList[$country];
- }
- return 'unk';
- }
-
- /*
- * Campaign
- */
-
- /**
- * Returns the list of Campaign parameter names that will be read to classify
- * a visit as coming from a Campaign
- *
- * @return array array(
- * 0 => array( ... ) // campaign names parameters
- * 1 => array( ... ) // campaign keyword parameters
- * );
- */
- public static function getCampaignParameters()
- {
- $return = array(
- Config::getInstance()->Tracker['campaign_var_name'],
- Config::getInstance()->Tracker['campaign_keyword_var_name'],
- );
-
- foreach ($return as &$list) {
- if (strpos($list, ',') !== false) {
- $list = explode(',', $list);
- } else {
- $list = array($list);
- }
- }
+ /**
+ * Returns the continent of a given country
+ *
+ * @param string $country 2 letters isocode
+ *
+ * @return string Continent (3 letters code : afr, asi, eur, amn, ams, oce)
+ */
+ public static function getContinent($country)
+ {
+ $countryList = self::getCountriesList();
+ if (isset($countryList[$country])) {
+ return $countryList[$country];
+ }
+ return 'unk';
+ }
- array_walk_recursive($return, 'trim');
- return $return;
- }
-
- /*
- * Referrer
- */
-
- /**
- * Reduce URL to more minimal form. 2 letter country codes are
- * replaced by '{}', while other parts are simply removed.
- *
- * Examples:
- * www.example.com -> example.com
- * search.example.com -> example.com
- * m.example.com -> example.com
- * de.example.com -> {}.example.com
- * example.de -> example.{}
- * example.co.uk -> example.{}
- *
- * @param string $url
- * @return string
- */
- public static function getLossyUrl($url)
- {
- static $countries;
- if (!isset($countries)) {
- $countries = implode('|', array_keys(\Piwik\Core\self::getCountriesList(true)));
- }
+ /*
+ * Campaign
+ */
- return preg_replace(
- array(
- '/^(w+[0-9]*|search)\./',
- '/(^|\.)m\./',
- '/(\.(com|org|net|co|it|edu))?\.(' . $countries . ')(\/|$)/',
- '/(^|\.)(' . $countries . ')\./',
- ),
- array(
- '',
- '$1',
- '.{}$4',
- '$1{}.',
- ),
- $url);
- }
-
- /**
- * Extracts a keyword from a raw not encoded URL.
- * Will only extract keyword if a known search engine has been detected.
- * Returns the keyword:
- * - in UTF8: automatically converted from other charsets when applicable
- * - strtolowered: "QUErY test!" will return "query test!"
- * - trimmed: extra spaces before and after are removed
- *
- * Lists of supported search engines can be found in /core/DataFiles/SearchEngines.php
- * The function returns false when a keyword couldn't be found.
- * eg. if the url is "http://www.google.com/partners.html" this will return false,
- * as the google keyword parameter couldn't be found.
- *
- * @see unit tests in /tests/core/Common.test.php
- * @param string $referrerUrl URL referer URL, eg. $_SERVER['HTTP_REFERER']
- * @return array|false false if a keyword couldn't be extracted,
- * or array(
- * 'name' => 'Google',
- * 'keywords' => 'my searched keywords')
- */
- public static function extractSearchEngineInformationFromUrl($referrerUrl)
- {
- $refererParsed = @parse_url($referrerUrl);
- $refererHost = '';
- if (isset($refererParsed['host'])) {
- $refererHost = $refererParsed['host'];
- }
- if (empty($refererHost)) {
- return false;
- }
- // some search engines (eg. Bing Images) use the same domain
- // as an existing search engine (eg. Bing), we must also use the url path
- $refererPath = '';
- if (isset($refererParsed['path'])) {
- $refererPath = $refererParsed['path'];
+ /**
+ * Returns the list of Campaign parameter names that will be read to classify
+ * a visit as coming from a Campaign
+ *
+ * @return array array(
+ * 0 => array( ... ) // campaign names parameters
+ * 1 => array( ... ) // campaign keyword parameters
+ * );
+ */
+ public static function getCampaignParameters()
+ {
+ $return = array(
+ Config::getInstance()->Tracker['campaign_var_name'],
+ Config::getInstance()->Tracker['campaign_keyword_var_name'],
+ );
+
+ foreach ($return as &$list) {
+ if (strpos($list, ',') !== false) {
+ $list = explode(',', $list);
+ } else {
+ $list = array($list);
}
+ }
- // no search query
- if (!isset($refererParsed['query'])) {
- $refererParsed['query'] = '';
- }
- $query = $refererParsed['query'];
+ array_walk_recursive($return, 'trim');
+ return $return;
+ }
- // Google Referrers URLs sometimes have the fragment which contains the keyword
- if (!empty($refererParsed['fragment'])) {
- $query .= '&' . $refererParsed['fragment'];
+ /*
+ * Referrer
+ */
+
+ /**
+ * Reduce URL to more minimal form. 2 letter country codes are
+ * replaced by '{}', while other parts are simply removed.
+ *
+ * Examples:
+ * www.example.com -> example.com
+ * search.example.com -> example.com
+ * m.example.com -> example.com
+ * de.example.com -> {}.example.com
+ * example.de -> example.{}
+ * example.co.uk -> example.{}
+ *
+ * @param string $url
+ * @return string
+ */
+ public static function getLossyUrl($url)
+ {
+ static $countries;
+ if (!isset($countries)) {
+ $countries = implode('|', array_keys(self::getCountriesList(true)));
+ }
+
+ return preg_replace(
+ array(
+ '/^(w+[0-9]*|search)\./',
+ '/(^|\.)m\./',
+ '/(\.(com|org|net|co|it|edu))?\.(' . $countries . ')(\/|$)/',
+ '/(^|\.)(' . $countries . ')\./',
+ ),
+ array(
+ '',
+ '$1',
+ '.{}$4',
+ '$1{}.',
+ ),
+ $url);
+ }
+
+ /**
+ * Extracts a keyword from a raw not encoded URL.
+ * Will only extract keyword if a known search engine has been detected.
+ * Returns the keyword:
+ * - in UTF8: automatically converted from other charsets when applicable
+ * - strtolowered: "QUErY test!" will return "query test!"
+ * - trimmed: extra spaces before and after are removed
+ *
+ * Lists of supported search engines can be found in /core/DataFiles/SearchEngines.php
+ * The function returns false when a keyword couldn't be found.
+ * eg. if the url is "http://www.google.com/partners.html" this will return false,
+ * as the google keyword parameter couldn't be found.
+ *
+ * @see unit tests in /tests/core/Common.test.php
+ * @param string $referrerUrl URL referer URL, eg. $_SERVER['HTTP_REFERER']
+ * @return array|false false if a keyword couldn't be extracted,
+ * or array(
+ * 'name' => 'Google',
+ * 'keywords' => 'my searched keywords')
+ */
+ public static function extractSearchEngineInformationFromUrl($referrerUrl)
+ {
+ $refererParsed = @parse_url($referrerUrl);
+ $refererHost = '';
+ if (isset($refererParsed['host'])) {
+ $refererHost = $refererParsed['host'];
+ }
+ if (empty($refererHost)) {
+ return false;
+ }
+ // some search engines (eg. Bing Images) use the same domain
+ // as an existing search engine (eg. Bing), we must also use the url path
+ $refererPath = '';
+ if (isset($refererParsed['path'])) {
+ $refererPath = $refererParsed['path'];
+ }
+
+ // no search query
+ if (!isset($refererParsed['query'])) {
+ $refererParsed['query'] = '';
+ }
+ $query = $refererParsed['query'];
+
+ // Google Referrers URLs sometimes have the fragment which contains the keyword
+ if (!empty($refererParsed['fragment'])) {
+ $query .= '&' . $refererParsed['fragment'];
+ }
+
+ $searchEngines = self::getSearchEngineUrls();
+
+ $hostPattern = self::getLossyUrl($refererHost);
+ if (array_key_exists($refererHost . $refererPath, $searchEngines)) {
+ $refererHost = $refererHost . $refererPath;
+ } elseif (array_key_exists($hostPattern . $refererPath, $searchEngines)) {
+ $refererHost = $hostPattern . $refererPath;
+ } elseif (array_key_exists($hostPattern, $searchEngines)) {
+ $refererHost = $hostPattern;
+ } elseif (!array_key_exists($refererHost, $searchEngines)) {
+ if (!strncmp($query, 'cx=partner-pub-', 15)) {
+ // Google custom search engine
+ $refererHost = 'google.com/cse';
+ } elseif (!strncmp($refererPath, '/pemonitorhosted/ws/results/', 28)) {
+ // private-label search powered by InfoSpace Metasearch
+ $refererHost = 'wsdsold.infospace.com';
+ } elseif (strpos($refererHost, '.images.search.yahoo.com') != false) {
+ // Yahoo! Images
+ $refererHost = 'images.search.yahoo.com';
+ } elseif (strpos($refererHost, '.search.yahoo.com') != false) {
+ // Yahoo!
+ $refererHost = 'search.yahoo.com';
+ } else {
+ return false;
}
+ }
+ $searchEngineName = $searchEngines[$refererHost][0];
+ $variableNames = null;
+ if (isset($searchEngines[$refererHost][1])) {
+ $variableNames = $searchEngines[$refererHost][1];
+ }
+ if (!$variableNames) {
+ $searchEngineNames = self::getSearchEngineNames();
+ $url = $searchEngineNames[$searchEngineName];
+ $variableNames = $searchEngines[$url][1];
+ }
+ if (!is_array($variableNames)) {
+ $variableNames = array($variableNames);
+ }
- $searchEngines = \Piwik\Core\self::getSearchEngineUrls();
-
- $hostPattern = \Piwik\Core\self::getLossyUrl($refererHost);
- if (array_key_exists($refererHost . $refererPath, $searchEngines)) {
- $refererHost = $refererHost . $refererPath;
- } elseif (array_key_exists($hostPattern . $refererPath, $searchEngines)) {
- $refererHost = $hostPattern . $refererPath;
- } elseif (array_key_exists($hostPattern, $searchEngines)) {
- $refererHost = $hostPattern;
- } elseif (!array_key_exists($refererHost, $searchEngines)) {
- if (!strncmp($query, 'cx=partner-pub-', 15)) {
- // Google custom search engine
- $refererHost = 'google.com/cse';
- } elseif (!strncmp($refererPath, '/pemonitorhosted/ws/results/', 28)) {
- // private-label search powered by InfoSpace Metasearch
- $refererHost = 'wsdsold.infospace.com';
- } elseif (strpos($refererHost, '.images.search.yahoo.com') != false) {
- // Yahoo! Images
- $refererHost = 'images.search.yahoo.com';
- } elseif (strpos($refererHost, '.search.yahoo.com') != false) {
- // Yahoo!
- $refererHost = 'search.yahoo.com';
- } else {
- return false;
- }
+ $key = null;
+ if ($searchEngineName === 'Google Images'
+ || ($searchEngineName === 'Google' && strpos($referrerUrl, '/imgres') !== false)
+ ) {
+ if (strpos($query, '&prev') !== false) {
+ $query = urldecode(trim(self::getParameterFromQueryString($query, 'prev')));
+ $query = str_replace('&', '&amp;', strstr($query, '?'));
}
- $searchEngineName = $searchEngines[$refererHost][0];
- $variableNames = null;
- if (isset($searchEngines[$refererHost][1])) {
- $variableNames = $searchEngines[$refererHost][1];
+ $searchEngineName = 'Google Images';
+ } else if ($searchEngineName === 'Google'
+ && (strpos($query, '&as_') !== false || strpos($query, 'as_') === 0)
+ ) {
+ $keys = array();
+ $key = self::getParameterFromQueryString($query, 'as_q');
+ if (!empty($key)) {
+ array_push($keys, $key);
}
- if (!$variableNames) {
- $searchEngineNames = \Piwik\Core\self::getSearchEngineNames();
- $url = $searchEngineNames[$searchEngineName];
- $variableNames = $searchEngines[$url][1];
+ $key = self::getParameterFromQueryString($query, 'as_oq');
+ if (!empty($key)) {
+ array_push($keys, str_replace('+', ' OR ', $key));
}
- if (!is_array($variableNames)) {
- $variableNames = array($variableNames);
+ $key = self::getParameterFromQueryString($query, 'as_epq');
+ if (!empty($key)) {
+ array_push($keys, "\"$key\"");
}
-
- $key = null;
- if ($searchEngineName === 'Google Images'
- || ($searchEngineName === 'Google' && strpos($referrerUrl, '/imgres') !== false)
- ) {
- if (strpos($query, '&prev') !== false) {
- $query = urldecode(trim(\Piwik\Core\self::getParameterFromQueryString($query, 'prev')));
- $query = str_replace('&', '&amp;', strstr($query, '?'));
- }
- $searchEngineName = 'Google Images';
- } else if ($searchEngineName === 'Google'
- && (strpos($query, '&as_') !== false || strpos($query, 'as_') === 0)
- ) {
- $keys = array();
- $key = \Piwik\Core\self::getParameterFromQueryString($query, 'as_q');
- if (!empty($key)) {
- array_push($keys, $key);
- }
- $key = \Piwik\Core\self::getParameterFromQueryString($query, 'as_oq');
- if (!empty($key)) {
- array_push($keys, str_replace('+', ' OR ', $key));
- }
- $key = \Piwik\Core\self::getParameterFromQueryString($query, 'as_epq');
- if (!empty($key)) {
- array_push($keys, "\"$key\"");
- }
- $key = \Piwik\Core\self::getParameterFromQueryString($query, 'as_eq');
- if (!empty($key)) {
- array_push($keys, "-$key");
- }
- $key = trim(urldecode(implode(' ', $keys)));
+ $key = self::getParameterFromQueryString($query, 'as_eq');
+ if (!empty($key)) {
+ array_push($keys, "-$key");
}
+ $key = trim(urldecode(implode(' ', $keys)));
+ }
- if ($searchEngineName === 'Google') {
- // top bar menu
- $tbm = \Piwik\Core\self::getParameterFromQueryString($query, 'tbm');
- switch ($tbm) {
- case 'isch':
- $searchEngineName = 'Google Images';
- break;
- case 'vid':
- $searchEngineName = 'Google Video';
- break;
- case 'shop':
- $searchEngineName = 'Google Shopping';
- break;
- }
+ if ($searchEngineName === 'Google') {
+ // top bar menu
+ $tbm = self::getParameterFromQueryString($query, 'tbm');
+ switch ($tbm) {
+ case 'isch':
+ $searchEngineName = 'Google Images';
+ break;
+ case 'vid':
+ $searchEngineName = 'Google Video';
+ break;
+ case 'shop':
+ $searchEngineName = 'Google Shopping';
+ break;
}
+ }
- if (empty($key)) {
- foreach ($variableNames as $variableName) {
- if ($variableName[0] == '/') {
- // regular expression match
- if (preg_match($variableName, $referrerUrl, $matches)) {
- $key = trim(urldecode($matches[1]));
- break;
- }
- } else {
- // search for keywords now &vname=keyword
- $key = \Piwik\Core\self::getParameterFromQueryString($query, $variableName);
- $key = trim(urldecode($key));
-
- // Special case: Google & empty q parameter
- if (empty($key)
- && $variableName == 'q'
-
- && (
- // Google search with no keyword
- ($searchEngineName == 'Google'
- && ( // First, they started putting an empty q= parameter
- strpos($query, '&q=') !== false
- || strpos($query, '?q=') !== false
- // then they started sending the full host only (no path/query string)
- || (empty($query) && (empty($refererPath) || $refererPath == '/') && empty($refererParsed['fragment']))
- )
+ if (empty($key)) {
+ foreach ($variableNames as $variableName) {
+ if ($variableName[0] == '/') {
+ // regular expression match
+ if (preg_match($variableName, $referrerUrl, $matches)) {
+ $key = trim(urldecode($matches[1]));
+ break;
+ }
+ } else {
+ // search for keywords now &vname=keyword
+ $key = self::getParameterFromQueryString($query, $variableName);
+ $key = trim(urldecode($key));
+
+ // Special case: Google & empty q parameter
+ if (empty($key)
+ && $variableName == 'q'
+
+ && (
+ // Google search with no keyword
+ ($searchEngineName == 'Google'
+ && ( // First, they started putting an empty q= parameter
+ strpos($query, '&q=') !== false
+ || strpos($query, '?q=') !== false
+ // then they started sending the full host only (no path/query string)
+ || (empty($query) && (empty($refererPath) || $refererPath == '/') && empty($refererParsed['fragment']))
)
- // search engines with no keyword
- || $searchEngineName == 'Google Images'
- || $searchEngineName == 'DuckDuckGo')
- ) {
- $key = false;
- }
- if (!empty($key)
- || $key === false
- ) {
- break;
- }
+ )
+ // search engines with no keyword
+ || $searchEngineName == 'Google Images'
+ || $searchEngineName == 'DuckDuckGo')
+ ) {
+ $key = false;
+ }
+ if (!empty($key)
+ || $key === false
+ ) {
+ break;
}
}
}
+ }
- // $key === false is the special case "No keyword provided" which is a Search engine match
- if ($key === null
- || $key === ''
- ) {
- return false;
- }
+ // $key === false is the special case "No keyword provided" which is a Search engine match
+ if ($key === null
+ || $key === ''
+ ) {
+ return false;
+ }
- if (!empty($key)) {
- if (function_exists('iconv')
- && isset($searchEngines[$refererHost][3])
- ) {
- // accepts string, array, or comma-separated list string in preferred order
- $charsets = $searchEngines[$refererHost][3];
- if (!is_array($charsets)) {
- $charsets = explode(',', $charsets);
- }
+ if (!empty($key)) {
+ if (function_exists('iconv')
+ && isset($searchEngines[$refererHost][3])
+ ) {
+ // accepts string, array, or comma-separated list string in preferred order
+ $charsets = $searchEngines[$refererHost][3];
+ if (!is_array($charsets)) {
+ $charsets = explode(',', $charsets);
+ }
- if (!empty($charsets)) {
- $charset = $charsets[0];
- if (count($charsets) > 1
- && function_exists('mb_detect_encoding')
- ) {
- $charset = mb_detect_encoding($key, $charsets);
- if ($charset === false) {
- $charset = $charsets[0];
- }
+ if (!empty($charsets)) {
+ $charset = $charsets[0];
+ if (count($charsets) > 1
+ && function_exists('mb_detect_encoding')
+ ) {
+ $charset = mb_detect_encoding($key, $charsets);
+ if ($charset === false) {
+ $charset = $charsets[0];
}
+ }
- $newkey = @iconv($charset, 'UTF-8//IGNORE', $key);
- if (!empty($newkey)) {
- $key = $newkey;
- }
+ $newkey = @iconv($charset, 'UTF-8//IGNORE', $key);
+ if (!empty($newkey)) {
+ $key = $newkey;
}
}
-
- $key = \Piwik\Core\self::mb_strtolower($key);
}
- return array(
- 'name' => $searchEngineName,
- 'keywords' => $key,
- );
- }
-
- /*
- * System environment
- */
-
- /**
- * Returns true if PHP was invoked from command-line interface (shell)
- *
- * @since added in 0.4.4
- * @return bool true if PHP invoked as a CGI or from CLI
- */
- public static function isPhpCliMode()
- {
- $remoteAddr = @$_SERVER['REMOTE_ADDR'];
- return PHP_SAPI == 'cli' ||
- (!strncmp(PHP_SAPI, 'cgi', 3) && empty($remoteAddr));
- }
-
- /**
- * Is the current script execution triggered by misc/cron/archive.php ?
- *
- * Helpful for error handling: directly throw error without HTML (eg. when DB is down)
- * @return bool
- */
- public static function isArchivePhpTriggered()
- {
- return !empty($_GET['trigger'])
- && $_GET['trigger'] == 'archivephp';
- }
-
- /**
- * Assign CLI parameters as if they were REQUEST or GET parameters.
- * You can trigger Piwik from the command line by
- * # /usr/bin/php5 /path/to/piwik/index.php -- "module=API&method=Actions.getActions&idSite=1&period=day&date=previous8&format=php"
- */
- public static function assignCliParametersToRequest()
- {
- if (isset($_SERVER['argc'])
- && $_SERVER['argc'] > 0
- ) {
- for ($i = 1; $i < $_SERVER['argc']; $i++) {
- parse_str($_SERVER['argv'][$i], $tmp);
- $_GET = array_merge($_GET, $tmp);
- }
- }
+ $key = self::mb_strtolower($key);
}
- /**
- * Returns true if running on a Windows operating system
- *
- * @since 0.6.5
- * @return bool true if PHP detects it is running on Windows; else false
- */
- public static function isWindows()
- {
- return DIRECTORY_SEPARATOR === '\\';
- }
-
- /**
- * Returns true if running on MacOS
- *
- * @return bool true if PHP detects it is running on MacOS; else false
- */
- public static function isMacOS()
- {
- return PHP_OS === 'Darwin';
- }
-
- /**
- * Returns true if running on an Apache web server
- *
- * @return bool
- */
- public static function isApache()
- {
- $apache = isset($_SERVER['SERVER_SOFTWARE']) &&
- !strncmp($_SERVER['SERVER_SOFTWARE'], 'Apache', 6);
-
- return $apache;
- }
-
- /**
- * Returns true if running on Microsoft IIS 7 (or above)
- *
- * @return bool
- */
- public static function isIIS()
- {
- $iis = isset($_SERVER['SERVER_SOFTWARE']) &&
- preg_match('/^Microsoft-IIS\/(.+)/', $_SERVER['SERVER_SOFTWARE'], $matches) &&
- version_compare($matches[1], '7') >= 0;
-
- return $iis;
- }
-
- /**
- * Takes a list of fields defining numeric values and returns the corresponding
- * unnamed parameters to be bound to the field names in the where clause of a SQL query
- *
- * @param array|string $fields array( fieldName1, fieldName2, fieldName3) Names of the mysql table fields to load
- * @return string "?, ?, ?"
- */
- public static function getSqlStringFieldsArray($fields)
- {
- if (is_string($fields)) {
- $fields = array($fields);
- }
- $count = count($fields);
- if ($count == 0) {
- return "''";
- }
- return '?' . str_repeat(',?', $count - 1);
- }
-
- /**
- * Sets outgoing header.
- *
- * @param string $header The header.
- * @param bool $replace Whether to replace existing or not.
- */
- public static function sendHeader($header, $replace = true)
- {
- if (isset($GLOBALS['PIWIK_TRACKER_LOCAL_TRACKING']) && $GLOBALS['PIWIK_TRACKER_LOCAL_TRACKING']) {
- @header($header, $replace);
- } else {
- header($header, $replace);
+ return array(
+ 'name' => $searchEngineName,
+ 'keywords' => $key,
+ );
+ }
+
+ /*
+ * System environment
+ */
+
+ /**
+ * Returns true if PHP was invoked from command-line interface (shell)
+ *
+ * @since added in 0.4.4
+ * @return bool true if PHP invoked as a CGI or from CLI
+ */
+ public static function isPhpCliMode()
+ {
+ $remoteAddr = @$_SERVER['REMOTE_ADDR'];
+ return PHP_SAPI == 'cli' ||
+ (!strncmp(PHP_SAPI, 'cgi', 3) && empty($remoteAddr));
+ }
+
+ /**
+ * Is the current script execution triggered by misc/cron/archive.php ?
+ *
+ * Helpful for error handling: directly throw error without HTML (eg. when DB is down)
+ * @return bool
+ */
+ public static function isArchivePhpTriggered()
+ {
+ return !empty($_GET['trigger'])
+ && $_GET['trigger'] == 'archivephp';
+ }
+
+ /**
+ * Assign CLI parameters as if they were REQUEST or GET parameters.
+ * You can trigger Piwik from the command line by
+ * # /usr/bin/php5 /path/to/piwik/index.php -- "module=API&method=Actions.getActions&idSite=1&period=day&date=previous8&format=php"
+ */
+ public static function assignCliParametersToRequest()
+ {
+ if (isset($_SERVER['argc'])
+ && $_SERVER['argc'] > 0
+ ) {
+ for ($i = 1; $i < $_SERVER['argc']; $i++) {
+ parse_str($_SERVER['argv'][$i], $tmp);
+ $_GET = array_merge($_GET, $tmp);
}
}
+ }
- /**
- * Returns the ID of the current LocationProvider (see UserCountry plugin code) from
- * the Tracker cache.
- */
- public static function getCurrentLocationProviderId()
- {
- $cache = Piwik_Tracker_Cache::getCacheGeneral();
- return empty($cache['currentLocationProviderId'])
- ? Piwik_UserCountry_LocationProvider_Default::ID
- : $cache['currentLocationProviderId'];
- }
-
- /**
- * Unprefix class name (if needed)
- *
- * @param string $class
- * @return string
- */
- public static function unprefixClass($class)
- {
- $lenPrefix = strlen(\Piwik\Core\self::CLASSES_PREFIX);
- if (!strncmp($class, \Piwik\Core\self::CLASSES_PREFIX, $lenPrefix)) {
- return substr($class, $lenPrefix);
- }
- return $class;
+ /**
+ * Returns true if running on a Windows operating system
+ *
+ * @since 0.6.5
+ * @return bool true if PHP detects it is running on Windows; else false
+ */
+ public static function isWindows()
+ {
+ return DIRECTORY_SEPARATOR === '\\';
+ }
+
+ /**
+ * Returns true if running on MacOS
+ *
+ * @return bool true if PHP detects it is running on MacOS; else false
+ */
+ public static function isMacOS()
+ {
+ return PHP_OS === 'Darwin';
+ }
+
+ /**
+ * Returns true if running on an Apache web server
+ *
+ * @return bool
+ */
+ public static function isApache()
+ {
+ $apache = isset($_SERVER['SERVER_SOFTWARE']) &&
+ !strncmp($_SERVER['SERVER_SOFTWARE'], 'Apache', 6);
+
+ return $apache;
+ }
+
+ /**
+ * Returns true if running on Microsoft IIS 7 (or above)
+ *
+ * @return bool
+ */
+ public static function isIIS()
+ {
+ $iis = isset($_SERVER['SERVER_SOFTWARE']) &&
+ preg_match('/^Microsoft-IIS\/(.+)/', $_SERVER['SERVER_SOFTWARE'], $matches) &&
+ version_compare($matches[1], '7') >= 0;
+
+ return $iis;
+ }
+
+ /**
+ * Takes a list of fields defining numeric values and returns the corresponding
+ * unnamed parameters to be bound to the field names in the where clause of a SQL query
+ *
+ * @param array|string $fields array( fieldName1, fieldName2, fieldName3) Names of the mysql table fields to load
+ * @return string "?, ?, ?"
+ */
+ public static function getSqlStringFieldsArray($fields)
+ {
+ if (is_string($fields)) {
+ $fields = array($fields);
}
+ $count = count($fields);
+ if ($count == 0) {
+ return "''";
+ }
+ return '?' . str_repeat(',?', $count - 1);
}
-}
-namespace {
+
/**
- * Piwik - Open source web analytics
+ * Sets outgoing header.
*
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ * @param string $header The header.
+ * @param bool $replace Whether to replace existing or not.
+ */
+ public static function sendHeader($header, $replace = true)
+ {
+ if (isset($GLOBALS['PIWIK_TRACKER_LOCAL_TRACKING']) && $GLOBALS['PIWIK_TRACKER_LOCAL_TRACKING']) {
+ @header($header, $replace);
+ } else {
+ header($header, $replace);
+ }
+ }
+
+ /**
+ * Returns the ID of the current LocationProvider (see UserCountry plugin code) from
+ * the Tracker cache.
+ */
+ public static function getCurrentLocationProviderId()
+ {
+ $cache = Piwik_Tracker_Cache::getCacheGeneral();
+ return empty($cache['currentLocationProviderId'])
+ ? Piwik_UserCountry_LocationProvider_Default::ID
+ : $cache['currentLocationProviderId'];
+ }
+
+ /**
+ * Unprefix class name (if needed)
*
- * @category Piwik
- * @package Piwik
+ * @param string $class
+ * @return string
*/
- use Piwik\Core\Config;
+ public static function unprefixClass($class)
+ {
+ $lenPrefix = strlen(self::CLASSES_PREFIX);
+ if (!strncmp($class, self::CLASSES_PREFIX, $lenPrefix)) {
+ return substr($class, $lenPrefix);
+ }
+ return $class;
+ }
/**
@@ -1583,7 +1571,7 @@ namespace {
* For more information: @link http://dev.piwik.org/trac/ticket/374
* @param $var
*/
- function destroy(&$var)
+ static public function destroy(&$var)
{
if (is_object($var) && method_exists($var, '__destruct')) {
$var->__destruct();
@@ -1592,18 +1580,17 @@ namespace {
$var = null;
}
- if (!function_exists('printDebug')) {
- function printDebug($info = '')
- {
- if (isset($GLOBALS['PIWIK_TRACKER_DEBUG']) && $GLOBALS['PIWIK_TRACKER_DEBUG']) {
- if (is_array($info) || is_object($info)) {
- print("<pre>");
- print(htmlspecialchars(var_export($info, true), ENT_QUOTES));
- print("</pre>");
- } else {
- print(htmlspecialchars($info, ENT_QUOTES) . "<br />\n");
- }
+ static public function printDebug($info = '')
+ {
+ if (isset($GLOBALS['PIWIK_TRACKER_DEBUG']) && $GLOBALS['PIWIK_TRACKER_DEBUG']) {
+ if (is_array($info) || is_object($info)) {
+ print("<pre>");
+ print(htmlspecialchars(var_export($info, true), ENT_QUOTES));
+ print("</pre>");
+ } else {
+ print(htmlspecialchars($info, ENT_QUOTES) . "<br />\n");
}
}
}
}
+
diff --git a/core/Config.php b/core/Config.php
index b5c5fb05fd..542b518a6f 100644
--- a/core/Config.php
+++ b/core/Config.php
@@ -9,7 +9,7 @@
* @package Piwik
*/
-namespace Piwik\Core;
+namespace Piwik;
use Exception;
/**
@@ -48,7 +48,7 @@ class Config
/**
* Returns the singleton Piwik_Config
*
- * @return \Piwik\Core\Config
+ * @return \Piwik\Config
*/
public static function getInstance()
{
diff --git a/core/Controller.php b/core/Controller.php
index 651351be5f..999e7488b3 100644
--- a/core/Controller.php
+++ b/core/Controller.php
@@ -8,9 +8,9 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Parent class of all plugins Controllers (located in /plugins/PluginName/Controller.php
diff --git a/core/Controller/Admin.php b/core/Controller/Admin.php
index 91341107f5..7e62499cd1 100644
--- a/core/Controller/Admin.php
+++ b/core/Controller/Admin.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
+use Piwik\Config;
+use Piwik\Piwik;
/**
* Parent class of all plugins Controllers with admin functions
diff --git a/core/Cookie.php b/core/Cookie.php
index d68d97a28e..24bd7c8ba2 100644
--- a/core/Cookie.php
+++ b/core/Cookie.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* Simple class to handle the cookies:
diff --git a/core/DataAccess/ArchiveSelector.php b/core/DataAccess/ArchiveSelector.php
index f0241bd06f..1eac19955c 100644
--- a/core/DataAccess/ArchiveSelector.php
+++ b/core/DataAccess/ArchiveSelector.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Data Access object used to query archives
diff --git a/core/DataAccess/ArchiveTableCreator.php b/core/DataAccess/ArchiveTableCreator.php
index cbcb25c8ac..d36206d1fe 100644
--- a/core/DataAccess/ArchiveTableCreator.php
+++ b/core/DataAccess/ArchiveTableCreator.php
@@ -1,6 +1,6 @@
<?php
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Piwik - Open source web analytics
diff --git a/core/DataAccess/ArchiveWriter.php b/core/DataAccess/ArchiveWriter.php
index edf6c1ffac..f864af9ae1 100644
--- a/core/DataAccess/ArchiveWriter.php
+++ b/core/DataAccess/ArchiveWriter.php
@@ -8,9 +8,9 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* This class is used to create a new Archive.
diff --git a/core/DataAccess/LogAggregator.php b/core/DataAccess/LogAggregator.php
index 1378a59c3f..8be8a516f2 100644
--- a/core/DataAccess/LogAggregator.php
+++ b/core/DataAccess/LogAggregator.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* This class queries the Visitor logs tables (visits, actions, conversions, ecommerce)
diff --git a/core/DataTable.php b/core/DataTable.php
index 370dc8b35d..c92935868c 100644
--- a/core/DataTable.php
+++ b/core/DataTable.php
@@ -9,8 +9,10 @@
* @package Piwik
*/
+use Piwik\Common;
+
/**
- * @see destroy()
+ * @see Common::destroy()
*/
require_once PIWIK_INCLUDE_PATH . '/core/Common.php';
@@ -249,7 +251,7 @@ class Piwik_DataTable
/**
* The operations that should be used when aggregating columns from multiple rows.
- * @see self::addDataTable() and Piwik_DataTable_Row::sumRow()
+ * @see self::addDataTable() and Piwik_DataTable_Row::sumRow()
*/
protected $columnAggregationOperations = array();
@@ -277,7 +279,7 @@ class Piwik_DataTable
) {
$depth++;
foreach ($this->getRows() as $row) {
- destroy($row);
+ Common::destroy($row);
}
unset($this->rows);
Piwik_DataTable_Manager::getInstance()->setTableDeleted($this->getId());
@@ -371,7 +373,7 @@ class Piwik_DataTable
$className($this);
return;
}
-
+
if (!class_exists($className, false)) {
$className = "Piwik_DataTable_Filter_" . $className;
}
@@ -686,19 +688,19 @@ class Piwik_DataTable
$columnValues = array();
foreach ($this->getRows() as $row) {
$columns = $row->getColumns();
- foreach($columns as $column => $value) {
- if(strpos($column, $name) === 0) {
+ foreach ($columns as $column => $value) {
+ if (strpos($column, $name) === 0) {
$columnValues[] = $row->getColumn($column);
}
}
}
return $columnValues;
}
-
+
/**
* Returns the list of columns the rows in this datatable contain. This will return the
* columns of the first row with data and assume they occur in every other row as well.
- *
+ *
* @return array
*/
public function getColumns()
@@ -857,7 +859,7 @@ class Piwik_DataTable
/**
* Deletes the ith row
*
- * @param int $id
+ * @param int $id
*
* @throws Exception if the row $id cannot be found
* @return void
@@ -1122,7 +1124,6 @@ class Piwik_DataTable
"; you will get the original php data structure serialized." .
" The data structure looks like this: \n \$data = " . var_export($array, true) . "; ");
-
// first pass to see if the array has the structure
// array(col1_name => val1, col2_name => val2, etc.)
// with val* that are never arrays (only strings/numbers/bool/etc.)
@@ -1296,12 +1297,12 @@ class Piwik_DataTable
* a subtable is encountered w/o the queried label, a new row is created
* with the label, and a subtable is added to the row.
*
- * @param array $path The path to walk. An array of label values.
- * @param array|bool $missingRowColumns
+ * @param array $path The path to walk. An array of label values.
+ * @param array|bool $missingRowColumns
* The default columns to use when creating new arrays.
* If this parameter is supplied, new rows will be
* created if labels cannot be found.
- * @param int $maxSubtableRows The maximum number of allowed rows in new
+ * @param int $maxSubtableRows The maximum number of allowed rows in new
* subtables.
*
* @return array First element is the found row or false. Second element is
@@ -1363,11 +1364,11 @@ class Piwik_DataTable
/**
* Returns a new DataTable that contains the rows of each of this table's subtables.
*
- * @param string|bool $labelColumn If supplied the label of the parent row will be
+ * @param string|bool $labelColumn If supplied the label of the parent row will be
* added to a new column in each subtable row. If set to,
* 'label' each subtable row's label will be prepended w/
* the parent row's label.
- * @param bool $useMetadataColumn If true and if $labelColumn is supplied, the parent row's
+ * @param bool $useMetadataColumn If true and if $labelColumn is supplied, the parent row's
* label will be added as metadata.
*
* @return Piwik_DataTable
@@ -1430,11 +1431,11 @@ class Piwik_DataTable
$dataTable->addRowsFromSimpleArray($array);
return $dataTable;
}
-
+
/**
* Set the aggregation operation for a column, e.g. "min".
* @see self::addDataTable() and Piwik_DataTable_Row::sumRow()
- *
+ *
* @param string $columnName
* @param string $operation
*/
@@ -1442,7 +1443,7 @@ class Piwik_DataTable
{
$this->columnAggregationOperations[$columnName] = $operation;
}
-
+
/**
* Set multiple aggregation operations at once.
* @param array $operations format: column name => operation
@@ -1453,7 +1454,7 @@ class Piwik_DataTable
$this->setColumnAggregationOperation($columnName, $operation);
}
}
-
+
/**
* Get the configured column aggregation operations
*/
@@ -1461,10 +1462,10 @@ class Piwik_DataTable
{
return $this->columnAggregationOperations;
}
-
+
/**
* Creates a new DataTable instance from a serialize()'d array of rows.
- *
+ *
* @param string $data
* @return Piwik_DataTable
*/
diff --git a/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php b/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php
index b2fd046254..21468628f6 100644
--- a/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php
+++ b/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* @package Piwik
diff --git a/core/DataTable/Filter/ColumnCallbackAddColumnPercentage.php b/core/DataTable/Filter/ColumnCallbackAddColumnPercentage.php
index 191f9146b3..5ac99ce678 100644
--- a/core/DataTable/Filter/ColumnCallbackAddColumnPercentage.php
+++ b/core/DataTable/Filter/ColumnCallbackAddColumnPercentage.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* Add a new column to the table which is a percentage based on the value resulting
diff --git a/core/DataTable/Filter/ReplaceColumnNames.php b/core/DataTable/Filter/ReplaceColumnNames.php
index 85fb633194..f0255a8086 100644
--- a/core/DataTable/Filter/ReplaceColumnNames.php
+++ b/core/DataTable/Filter/ReplaceColumnNames.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* This filter replaces column names using a mapping table that maps from the old name to the new name.
diff --git a/core/DataTable/Manager.php b/core/DataTable/Manager.php
index eab94df8f8..21dc600481 100644
--- a/core/DataTable/Manager.php
+++ b/core/DataTable/Manager.php
@@ -9,6 +9,8 @@
* @package Piwik
*/
+use Piwik\Common;
+
/**
* The DataTable_Manager registers all the instanciated DataTable and provides an
* easy way to access them. This is used to store all the DataTable during the archiving process.
@@ -112,7 +114,7 @@ class Piwik_DataTable_Manager
public function deleteTable($id)
{
if (isset($this->tables[$id])) {
- destroy($this->tables[$id]);
+ Common::destroy($this->tables[$id]);
$this->setTableDeleted($id);
}
}
diff --git a/core/DataTable/Renderer.php b/core/DataTable/Renderer.php
index 74f4785e90..c8f353a64e 100644
--- a/core/DataTable/Renderer.php
+++ b/core/DataTable/Renderer.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* A DataTable Renderer can produce an output given a DataTable object.
diff --git a/core/DataTable/Renderer/Csv.php b/core/DataTable/Renderer/Csv.php
index 38c97fa2fc..0e1a3f39d4 100644
--- a/core/DataTable/Renderer/Csv.php
+++ b/core/DataTable/Renderer/Csv.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* CSV export
diff --git a/core/DataTable/Renderer/Json.php b/core/DataTable/Renderer/Json.php
index 2d408d7fda..92e0830316 100644
--- a/core/DataTable/Renderer/Json.php
+++ b/core/DataTable/Renderer/Json.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* JSON export.
diff --git a/core/DataTable/Renderer/Php.php b/core/DataTable/Renderer/Php.php
index 1dc7ee501b..ec66701cbe 100644
--- a/core/DataTable/Renderer/Php.php
+++ b/core/DataTable/Renderer/Php.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* Returns the equivalent PHP array for a given DataTable.
diff --git a/core/DataTable/Renderer/Rss.php b/core/DataTable/Renderer/Rss.php
index 662ad0ad82..2c1fd05114 100644
--- a/core/DataTable/Renderer/Rss.php
+++ b/core/DataTable/Renderer/Rss.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* RSS Feed.
diff --git a/core/DataTable/Renderer/Xml.php b/core/DataTable/Renderer/Xml.php
index adbe5e7206..ba00e6d39e 100644
--- a/core/DataTable/Renderer/Xml.php
+++ b/core/DataTable/Renderer/Xml.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* XML export of a given DataTable.
diff --git a/core/Db/Adapter/Mysqli.php b/core/Db/Adapter/Mysqli.php
index c20800e2ea..38495a2357 100644
--- a/core/Db/Adapter/Mysqli.php
+++ b/core/Db/Adapter/Mysqli.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
+use Piwik\Config;
/**
* @package Piwik
diff --git a/core/Db/Adapter/Pdo/Mssql.php b/core/Db/Adapter/Pdo/Mssql.php
index 2e9def1834..458a99fcc5 100644
--- a/core/Db/Adapter/Pdo/Mssql.php
+++ b/core/Db/Adapter/Pdo/Mssql.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
+use Piwik\Config;
/**
* @package Piwik
diff --git a/core/Db/Adapter/Pdo/Mysql.php b/core/Db/Adapter/Pdo/Mysql.php
index 33f52df232..c2ad0ea2d8 100644
--- a/core/Db/Adapter/Pdo/Mysql.php
+++ b/core/Db/Adapter/Pdo/Mysql.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
+use Piwik\Config;
/**
* @package Piwik
diff --git a/core/Db/Adapter/Pdo/Pgsql.php b/core/Db/Adapter/Pdo/Pgsql.php
index 1b67103633..f4e68dfde9 100644
--- a/core/Db/Adapter/Pdo/Pgsql.php
+++ b/core/Db/Adapter/Pdo/Pgsql.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
+use Piwik\Config;
/**
* @package Piwik
diff --git a/core/Db/Schema.php b/core/Db/Schema.php
index ad972e910d..fed20dfe28 100644
--- a/core/Db/Schema.php
+++ b/core/Db/Schema.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
+use Piwik\Config;
/**
* Schema abstraction
diff --git a/core/Db/Schema/Myisam.php b/core/Db/Schema/Myisam.php
index 1758ee384b..a0eb2a7038 100644
--- a/core/Db/Schema/Myisam.php
+++ b/core/Db/Schema/Myisam.php
@@ -8,9 +8,9 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* MySQL schema
diff --git a/core/ExceptionHandler.php b/core/ExceptionHandler.php
index 105caf9058..c06bc3d5af 100644
--- a/core/ExceptionHandler.php
+++ b/core/ExceptionHandler.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* Exception handler used to display nicely exceptions in Piwik
diff --git a/core/FrontController.php b/core/FrontController.php
index 6836578670..a90f4b8554 100644
--- a/core/FrontController.php
+++ b/core/FrontController.php
@@ -8,9 +8,9 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* @see core/PluginsManager.php
@@ -20,6 +20,7 @@ use Piwik\Core\Common;
require_once PIWIK_INCLUDE_PATH . '/core/PluginsManager.php';
require_once PIWIK_INCLUDE_PATH . '/core/Translate.php';
require_once PIWIK_INCLUDE_PATH . '/core/Option.php';
+require_once PIWIK_INCLUDE_PATH . '/core/Piwik.php';
/**
* Front controller.
@@ -275,7 +276,7 @@ class Piwik_FrontController
Piwik_PluginsManager::getInstance()->installLoadedPlugins();
// ensure the current Piwik URL is known for later use
- if (method_exists('Piwik\Core\Piwik', 'getPiwikUrl')) {
+ if (method_exists('Piwik\Piwik', 'getPiwikUrl')) {
$host = Piwik::getPiwikUrl();
}
diff --git a/core/Http.php b/core/Http.php
index cc536477f2..de30bf3b2f 100644
--- a/core/Http.php
+++ b/core/Http.php
@@ -8,9 +8,9 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Server-side http client to retrieve content from remote servers, and optionally save to a local file.
diff --git a/core/IP.php b/core/IP.php
index 64ca6072ff..2fa60ca33d 100644
--- a/core/IP.php
+++ b/core/IP.php
@@ -9,8 +9,8 @@
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Common;
if (Common::isWindows() || !function_exists('inet_ntop')) {
function _inet_ntop($in_addr)
diff --git a/core/Log.php b/core/Log.php
index 6f0dee2047..2228ec9dae 100644
--- a/core/Log.php
+++ b/core/Log.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Common;
/**
*
@@ -176,7 +176,7 @@ class Piwik_Log_Formatter_ScreenFormatter implements Zend_Log_Formatter_Interfac
function formatEvent($event)
{
// no injection in error messages, backtrace when displayed on screen
- return array_map(array('Piwik\Core\Common', 'sanitizeInputValue'), $event);
+ return array_map(array('Piwik\Common', 'sanitizeInputValue'), $event);
}
function format($string)
diff --git a/core/Log/Exception.php b/core/Log/Exception.php
index b86a3dd6c7..b71479e575 100644
--- a/core/Log/Exception.php
+++ b/core/Log/Exception.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* Class used to log an exception event.
diff --git a/core/Log/Message.php b/core/Log/Message.php
index cc425116be..eb200a3b68 100644
--- a/core/Log/Message.php
+++ b/core/Log/Message.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Class used to log a standard message event.
diff --git a/core/Mail.php b/core/Mail.php
index b907f4c63d..d9f917e464 100644
--- a/core/Mail.php
+++ b/core/Mail.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
+use Piwik\Config;
+use Piwik\Piwik;
/**
* Class for sending mails, for more information see:
diff --git a/core/Menu/Abstract.php b/core/Menu/Abstract.php
index 35e677875d..14574847bf 100644
--- a/core/Menu/Abstract.php
+++ b/core/Menu/Abstract.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik_Menu
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Piwik_Menu
diff --git a/core/Menu/Admin.php b/core/Menu/Admin.php
index 0ee8965a24..7af69b3255 100644
--- a/core/Menu/Admin.php
+++ b/core/Menu/Admin.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik_Menu
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* @package Piwik_Menu
diff --git a/core/Metrics.php b/core/Metrics.php
index 4ba6759582..90560e17d0 100644
--- a/core/Metrics.php
+++ b/core/Metrics.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* This class holds the various mappings we use to internally store and manipulate metrics.
diff --git a/core/Nonce.php b/core/Nonce.php
index 49f52a29b5..23e447f949 100644
--- a/core/Nonce.php
+++ b/core/Nonce.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* Nonce class.
diff --git a/core/Option.php b/core/Option.php
index 424d9e1a05..11f541bd55 100644
--- a/core/Option.php
+++ b/core/Option.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* Piwik_Option provides a very simple mechanism to save/retrieve key-values pair
diff --git a/core/Period.php b/core/Period.php
index a086711e1f..01705ccbe7 100644
--- a/core/Period.php
+++ b/core/Period.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* Creating a new Piwik_Period subclass:
diff --git a/core/Period/Range.php b/core/Period/Range.php
index f23e3dce69..f69a0d304e 100644
--- a/core/Period/Range.php
+++ b/core/Period/Range.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* from a starting date to an ending date
diff --git a/core/Piwik.php b/core/Piwik.php
index 6f9ceb3bce..f788d50f89 100644
--- a/core/Piwik.php
+++ b/core/Piwik.php
@@ -8,15 +8,14 @@
* @category Piwik
* @package Piwik
*/
-namespace Piwik\Core;
+namespace Piwik;
+
use Exception;
-use false;
-use Manifest;
-use Piwik\Core\Config;
+use Piwik\Config;
use Piwik_Access;
use Piwik_Access_NoAccessException;
use Piwik_AssetManager;
-use Piwik\Core\Common;
+use Piwik\Common;
use Piwik_Db_Adapter;
use Piwik_Db_Schema;
use Piwik_Log_APICall;
@@ -41,6 +40,8 @@ use Zend_Registry;
* @see core/Translate.php
*/
require_once PIWIK_INCLUDE_PATH . '/core/Translate.php';
+require_once PIWIK_INCLUDE_PATH . '/core/Common.php';
+require_once PIWIK_INCLUDE_PATH . '/core/Config.php';
/**
* Main piwik helper class.
diff --git a/core/Plugin.php b/core/Plugin.php
index 51a21b6049..bec854cd9e 100644
--- a/core/Plugin.php
+++ b/core/Plugin.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @see core/Plugin/MetadataLoader.php
diff --git a/core/Plugin/MetadataLoader.php b/core/Plugin/MetadataLoader.php
index 5b514b8610..6e8e16ebb4 100644
--- a/core/Plugin/MetadataLoader.php
+++ b/core/Plugin/MetadataLoader.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @see core/Version.php
diff --git a/core/PluginsArchiver.php b/core/PluginsArchiver.php
index ad0579e332..aac3b936da 100644
--- a/core/PluginsArchiver.php
+++ b/core/PluginsArchiver.php
@@ -9,8 +9,8 @@
* @category Piwik
* @package Piwik_PluginArchiver
*/
-use Piwik\Core\Config;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Common;
/**
* Plugins that archive metrics for websites can implement an Archiver that extends this class
diff --git a/core/PluginsFunctions/Sql.php b/core/PluginsFunctions/Sql.php
index fef08121e1..2a0d3665ba 100644
--- a/core/PluginsFunctions/Sql.php
+++ b/core/PluginsFunctions/Sql.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package PluginsFunctions
*/
-use Piwik\Core\Config;
+use Piwik\Config;
/**
* SQL wrapper
diff --git a/core/PluginsManager.php b/core/PluginsManager.php
index ffad1670c2..5147ed2178 100644
--- a/core/PluginsManager.php
+++ b/core/PluginsManager.php
@@ -8,9 +8,9 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* @see core/Menu/Abstract.php
diff --git a/core/ProxyHeaders.php b/core/ProxyHeaders.php
index ae319b986d..5b18bcfbc3 100644
--- a/core/ProxyHeaders.php
+++ b/core/ProxyHeaders.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* Proxy headers
diff --git a/core/ReportRenderer.php b/core/ReportRenderer.php
index da27590652..e4125cf18f 100644
--- a/core/ReportRenderer.php
+++ b/core/ReportRenderer.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* A Report Renderer produces user friendly renderings of any given Piwik report.
diff --git a/core/ReportRenderer/Html.php b/core/ReportRenderer/Html.php
index 0edf422dab..0f72de2aaf 100644
--- a/core/ReportRenderer/Html.php
+++ b/core/ReportRenderer/Html.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik_ReportRenderer
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
diff --git a/core/ReportRenderer/Pdf.php b/core/ReportRenderer/Pdf.php
index 2b20ecb169..7e7e6069f0 100644
--- a/core/ReportRenderer/Pdf.php
+++ b/core/ReportRenderer/Pdf.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik_ReportRenderer
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @see libs/tcpdf
diff --git a/core/Segment.php b/core/Segment.php
index 1e2da61f2d..35ada3d878 100644
--- a/core/Segment.php
+++ b/core/Segment.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
*
diff --git a/core/Session.php b/core/Session.php
index 5f2d362b6b..1db8458cb7 100644
--- a/core/Session.php
+++ b/core/Session.php
@@ -8,9 +8,9 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Session initialization.
diff --git a/core/Session/Namespace.php b/core/Session/Namespace.php
index 22199fdfd6..f2fb04b131 100644
--- a/core/Session/Namespace.php
+++ b/core/Session/Namespace.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* Session namespace.
diff --git a/core/Timer.php b/core/Timer.php
index 43edaa78ec..236787db67 100644
--- a/core/Timer.php
+++ b/core/Timer.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
*
diff --git a/core/Tracker.php b/core/Tracker.php
index e82e88f053..d3d9a765b6 100644
--- a/core/Tracker.php
+++ b/core/Tracker.php
@@ -8,9 +8,9 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Class used by the logging script piwik.php called by the javascript tag.
@@ -227,10 +227,10 @@ class Piwik_Tracker
$visit->handle();
unset($visit);
} else {
- printDebug("The request is invalid: empty request, or maybe tracking is disabled in the config.ini.php via record_statistics=0");
+ Common::printDebug("The request is invalid: empty request, or maybe tracking is disabled in the config.ini.php via record_statistics=0");
}
} catch (Piwik_Tracker_Db_Exception $e) {
- printDebug("<b>" . $e->getMessage() . "</b>");
+ Common::printDebug("<b>" . $e->getMessage() . "</b>");
$this->exitWithException($e, $isAuthenticated);
} catch (Piwik_Tracker_Visit_Excluded $e) {
} catch (Exception $e) {
@@ -290,7 +290,7 @@ class Piwik_Tracker
if ($minimumInterval <= 0
|| empty($cache['isBrowserTriggerArchivingEnabled'])
) {
- printDebug("-> Scheduled tasks not running in Tracker: Browser archiving is disabled.");
+ Common::printDebug("-> Scheduled tasks not running in Tracker: Browser archiving is disabled.");
return;
}
$nextRunTime = $cache['lastTrackerCronRun'] + $minimumInterval;
@@ -302,7 +302,7 @@ class Piwik_Tracker
Piwik_Tracker_Cache::setCacheGeneral($cache);
self::initCorePiwikInTrackerMode();
Piwik_SetOption('lastTrackerCronRun', $cache['lastTrackerCronRun']);
- printDebug('-> Scheduled Tasks: Starting...');
+ Common::printDebug('-> Scheduled Tasks: Starting...');
// save current user privilege and temporarily assume super user privilege
$isSuperUser = Piwik::isUserIsSuperUser();
@@ -319,12 +319,12 @@ class Piwik_Tracker
// restore original user privilege
Piwik::setUserIsSuperUser($isSuperUser);
- printDebug($resultTasks);
- printDebug('Finished Scheduled Tasks.');
+ Common::printDebug($resultTasks);
+ Common::printDebug('Finished Scheduled Tasks.');
} else {
- printDebug("-> Scheduled tasks not triggered.");
+ Common::printDebug("-> Scheduled tasks not triggered.");
}
- printDebug("Next run will be from: " . date('Y-m-d H:i:s', $nextRunTime) . ' UTC');
+ Common::printDebug("Next run will be from: " . date('Y-m-d H:i:s', $nextRunTime) . ' UTC');
}
static public $initTrackerMode = false;
@@ -417,7 +417,7 @@ class Piwik_Tracker
$this->handleDisabledTracker();
$this->handleEmptyRequest($request);
- printDebug("Current datetime: " . date("Y-m-d H:i:s", $request->getCurrentTimestamp()));
+ Common::printDebug("Current datetime: " . date("Y-m-d H:i:s", $request->getCurrentTimestamp()));
}
/**
@@ -428,11 +428,11 @@ class Piwik_Tracker
switch ($this->getState()) {
case self::STATE_LOGGING_DISABLE:
$this->outputTransparentGif();
- printDebug("Logging disabled, display transparent logo");
+ Common::printDebug("Logging disabled, display transparent logo");
break;
case self::STATE_EMPTY_REQUEST:
- printDebug("Empty request => Piwik page");
+ Common::printDebug("Empty request => Piwik page");
echo "<a href='/'>Piwik</a> is a free open source web <a href='http://piwik.org'>analytics</a> that lets you keep control of your data.";
break;
@@ -440,10 +440,10 @@ class Piwik_Tracker
case self::STATE_NOTHING_TO_NOTICE:
default:
$this->outputTransparentGif();
- printDebug("Nothing to notice => default behaviour");
+ Common::printDebug("Nothing to notice => default behaviour");
break;
}
- printDebug("End of the page.");
+ Common::printDebug("End of the page.");
if ($GLOBALS['PIWIK_TRACKER_DEBUG'] === true) {
if (isset(self::$db)) {
@@ -606,10 +606,10 @@ class Piwik_Tracker
Piwik_PluginsManager::getInstance()->loadPlugins($pluginsTracker);
- printDebug("Loading plugins: { " . implode(",", $pluginsTracker) . " }");
+ Common::printDebug("Loading plugins: { " . implode(",", $pluginsTracker) . " }");
}
} catch (Exception $e) {
- printDebug("ERROR: " . $e->getMessage());
+ Common::printDebug("ERROR: " . $e->getMessage());
}
}
diff --git a/core/Tracker/Action.php b/core/Tracker/Action.php
index ddba2c0dcc..1fee863928 100644
--- a/core/Tracker/Action.php
+++ b/core/Tracker/Action.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Common;
/**
* Interface of the Action object.
@@ -388,7 +388,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
: array();
if (!empty($excludedParameters)) {
- printDebug('Excluding parameters "' . implode(',', $excludedParameters) . '" from URL');
+ Common::printDebug('Excluding parameters "' . implode(',', $excludedParameters) . '" from URL');
}
$parametersToExclude = array_merge($excludedParameters,
@@ -446,8 +446,8 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
$info['url'] = self::excludeQueryParametersFromUrl($originalUrl, $this->request->getIdSite());
if ($originalUrl != $info['url']) {
- printDebug(' Before was "' . $originalUrl . '"');
- printDebug(' After is "' . $info['url'] . '"');
+ Common::printDebug(' Before was "' . $originalUrl . '"');
+ Common::printDebug(' After is "' . $info['url'] . '"');
}
// Set Final attributes for this Action (Pageview, Search, etc.)
@@ -547,7 +547,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
Piwik_Tracker::getDatabase()->query($sql, array($name, $name, $type, $urlPrefix));
$actionId = Piwik_Tracker::getDatabase()->lastInsertId();
- printDebug("Recorded a new action (" . self::getActionTypeName($type) . ") in the lookup table: " . $name . " (idaction = " . $actionId . ")");
+ Common::printDebug("Recorded a new action (" . self::getActionTypeName($type) . ") in the lookup table: " . $name . " (idaction = " . $actionId . ")");
$actionNamesAndTypes[$actionToInsert][] = $actionId;
}
@@ -706,7 +706,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
'idRefererActionName' => $idRefererActionName,
'timeSpentRefererAction' => $timeSpentRefererAction,
);
- printDebug($insertWithoutNulls);
+ Common::printDebug($insertWithoutNulls);
/*
* send the Action object ($this) and the list of ids ($info) as arguments to the event
@@ -721,22 +721,22 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
// Enrich Site Search actions with Custom Variables, overwriting existing values
if (!empty($this->searchCategory)) {
if (!empty($customVariables['custom_var_k' . self::CVAR_INDEX_SEARCH_CATEGORY])) {
- printDebug("WARNING: Overwriting existing Custom Variable in slot " . self::CVAR_INDEX_SEARCH_CATEGORY . " for this page view");
+ Common::printDebug("WARNING: Overwriting existing Custom Variable in slot " . self::CVAR_INDEX_SEARCH_CATEGORY . " for this page view");
}
$customVariables['custom_var_k' . self::CVAR_INDEX_SEARCH_CATEGORY] = self::CVAR_KEY_SEARCH_CATEGORY;
$customVariables['custom_var_v' . self::CVAR_INDEX_SEARCH_CATEGORY] = Piwik_Tracker_Request::truncateCustomVariable($this->searchCategory);
}
if ($this->searchCount !== false) {
if (!empty($customVariables['custom_var_k' . self::CVAR_INDEX_SEARCH_COUNT])) {
- printDebug("WARNING: Overwriting existing Custom Variable in slot " . self::CVAR_INDEX_SEARCH_COUNT . " for this page view");
+ Common::printDebug("WARNING: Overwriting existing Custom Variable in slot " . self::CVAR_INDEX_SEARCH_COUNT . " for this page view");
}
$customVariables['custom_var_k' . self::CVAR_INDEX_SEARCH_COUNT] = self::CVAR_KEY_SEARCH_COUNT;
$customVariables['custom_var_v' . self::CVAR_INDEX_SEARCH_COUNT] = (int)$this->searchCount;
}
if (!empty($customVariables)) {
- printDebug("Page level Custom Variables: ");
- printDebug($customVariables);
+ Common::printDebug("Page level Custom Variables: ");
+ Common::printDebug($customVariables);
}
return $customVariables;
}
@@ -805,7 +805,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
$url = self::cleanupString($url);
if (!Common::isLookLikeUrl($url)) {
- printDebug("WARNING: URL looks invalid and is discarded");
+ Common::printDebug("WARNING: URL looks invalid and is discarded");
$url = '';
}
@@ -833,7 +833,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
{
$website = Piwik_Tracker_Cache::getCacheWebsiteAttributes($this->request->getIdSite());
if (empty($website['sitesearch'])) {
- printDebug("Internal 'Site Search' tracking is not enabled for this site. ");
+ Common::printDebug("Internal 'Site Search' tracking is not enabled for this site. ");
return false;
}
$actionName = $url = $categoryName = $count = false;
@@ -873,19 +873,19 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
}
if (empty($actionName)) {
- printDebug("(this is not a Site Search request)");
+ Common::printDebug("(this is not a Site Search request)");
return false;
}
- printDebug("Detected Site Search keyword '$actionName'. ");
+ Common::printDebug("Detected Site Search keyword '$actionName'. ");
if (!empty($categoryName)) {
- printDebug("- Detected Site Search Category '$categoryName'. ");
+ Common::printDebug("- Detected Site Search Category '$categoryName'. ");
}
if ($count !== false) {
- printDebug("- Search Results Count was '$count'. ");
+ Common::printDebug("- Search Results Count was '$count'. ");
}
if ($url != $originalUrl) {
- printDebug("NOTE: The Page URL was changed / removed, during the Site Search detection, was '$originalUrl', now is '$url'");
+ Common::printDebug("NOTE: The Page URL was changed / removed, during the Site Search detection, was '$originalUrl', now is '$url'");
}
if (!empty($categoryName) || $count !== false) {
diff --git a/core/Tracker/Cache.php b/core/Tracker/Cache.php
index eb0b90cd86..4f7e5809f3 100644
--- a/core/Tracker/Cache.php
+++ b/core/Tracker/Cache.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
+use Piwik\Config;
+use Piwik\Piwik;
/**
* Simple cache mechanism used in Tracker to avoid requesting settings from mysql on every request
diff --git a/core/Tracker/Config.php b/core/Tracker/Config.php
index 1ce66aaa55..e3e35fd7e0 100644
--- a/core/Tracker/Config.php
+++ b/core/Tracker/Config.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
+use Piwik\Config;
/**
* Backward compatibility layer
diff --git a/core/Tracker/Db.php b/core/Tracker/Db.php
index 6d33bc39c5..5b7cbde2cc 100644
--- a/core/Tracker/Db.php
+++ b/core/Tracker/Db.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* Simple database wrapper.
diff --git a/core/Tracker/GoalManager.php b/core/Tracker/GoalManager.php
index fb22e339e7..719639619d 100644
--- a/core/Tracker/GoalManager.php
+++ b/core/Tracker/GoalManager.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Common;
/**
* @package Piwik
@@ -355,7 +355,7 @@ class Piwik_Tracker_GoalManager
);
if ($this->isThereExistingCartInVisit) {
- printDebug("There is an existing cart for this visit");
+ Common::printDebug("There is an existing cart for this visit");
}
if ($this->isGoalAnOrder) {
$orderIdNumeric = Common::hashStringToInt($this->orderId);
@@ -376,7 +376,7 @@ class Piwik_Tracker_GoalManager
}
$goal['revenue'] = $this->getRevenue($this->request->getGoalRevenue( $defaultRevenue = 0));
- printDebug($debugMessage . ':' . var_export($goal, true));
+ Common::printDebug($debugMessage . ':' . var_export($goal, true));
// INSERT or Sync items in the Cart / Order for this visit & order
$items = $this->getEcommerceItemsFromRequest();
@@ -409,13 +409,13 @@ class Piwik_Tracker_GoalManager
{
$items = Common::unsanitizeInputValue($this->request->getParam('ec_items'));
if (empty($items)) {
- printDebug("There are no Ecommerce items in the request");
+ Common::printDebug("There are no Ecommerce items in the request");
// we still record an Ecommerce order without any item in it
return array();
}
$items = Common::json_decode($items, $assoc = true);
if (!is_array($items)) {
- printDebug("Error while json_decode the Ecommerce items = " . var_export($items, true));
+ Common::printDebug("Error while json_decode the Ecommerce items = " . var_export($items, true));
return false;
}
@@ -451,8 +451,8 @@ class Piwik_Tracker_GoalManager
$itemsInDb = Piwik_Tracker::getDatabase()->fetchAll($sql, $bind);
- printDebug("Items found in current cart, for conversion_item (visit,idorder)=" . var_export($bind, true));
- printDebug($itemsInDb);
+ Common::printDebug("Items found in current cart, for conversion_item (visit,idorder)=" . var_export($bind, true));
+ Common::printDebug($itemsInDb);
// Look at which items need to be deleted, which need to be added or updated, based on the SKU
$skuFoundInDb = $itemsToUpdate = array();
foreach ($itemsInDb as $itemInDb) {
@@ -475,8 +475,8 @@ class Piwik_Tracker_GoalManager
);
$itemsToUpdate[] = $itemToUpdate;
- printDebug("Item found in the previous Cart, but no in the current cart/order");
- printDebug($itemToUpdate);
+ Common::printDebug("Item found in the previous Cart, but no in the current cart/order");
+ Common::printDebug($itemToUpdate);
continue;
}
@@ -484,14 +484,14 @@ class Piwik_Tracker_GoalManager
$newItem = $this->getItemRowCast($newItem);
if (count($itemInDb) != count($newItem)) {
- printDebug("ERROR: Different format in items from cart and DB");
+ Common::printDebug("ERROR: Different format in items from cart and DB");
throw new Exception(" Item in DB and Item in cart have a different format, this is not expected... " . var_export($itemInDb, true) . var_export($newItem, true));
}
- printDebug("Item has changed since the last cart. Previous item stored in cart in database:");
- printDebug($itemInDb);
- printDebug("New item to UPDATE the previous row:");
+ Common::printDebug("Item has changed since the last cart. Previous item stored in cart in database:");
+ Common::printDebug($itemInDb);
+ Common::printDebug("New item to UPDATE the previous row:");
$newItem['idorder_original_value'] = $itemInDbOriginal['idorder_original_value'];
- printDebug($newItem);
+ Common::printDebug($newItem);
$itemsToUpdate[] = $newItem;
}
@@ -649,12 +649,12 @@ class Piwik_Tracker_GoalManager
if (empty($itemsToUpdate)) {
return;
}
- printDebug("Goal data used to update ecommerce items:");
- printDebug($goal);
+ Common::printDebug("Goal data used to update ecommerce items:");
+ Common::printDebug($goal);
foreach ($itemsToUpdate as $item) {
$newRow = $this->getItemRowEnriched($goal, $item);
- printDebug($newRow);
+ Common::printDebug($newRow);
$updateParts = $sqlBind = array();
foreach ($newRow AS $name => $value) {
$updateParts[] = $name . " = ?";
@@ -686,8 +686,8 @@ class Piwik_Tracker_GoalManager
if (empty($itemsToInsert)) {
return;
}
- printDebug("Ecommerce items that are added to the cart/order");
- printDebug($itemsToInsert);
+ Common::printDebug("Ecommerce items that are added to the cart/order");
+ Common::printDebug($itemsToInsert);
$sql = "INSERT INTO " . Common::prefixTable('log_conversion_item') . "
(idaction_sku, idaction_name, idaction_category, idaction_category2, idaction_category3, idaction_category4, idaction_category5, price, quantity, deleted,
@@ -705,8 +705,8 @@ class Piwik_Tracker_GoalManager
$bind = array_merge($bind, $newRow);
}
Piwik_Tracker::getDatabase()->query($sql, $bind);
- printDebug($sql);
- printDebug($bind);
+ Common::printDebug($sql);
+ Common::printDebug($bind);
}
protected function getItemRowEnriched($goal, $item)
@@ -741,7 +741,7 @@ class Piwik_Tracker_GoalManager
protected function recordStandardGoals($goal, $action, $visitorInformation)
{
foreach ($this->convertedGoals as $convertedGoal) {
- printDebug("- Goal " . $convertedGoal['idgoal'] . " matched. Recording...");
+ Common::printDebug("- Goal " . $convertedGoal['idgoal'] . " matched. Recording...");
$newGoal = $goal;
$newGoal['idgoal'] = $convertedGoal['idgoal'];
$newGoal['url'] = $convertedGoal['url'];
@@ -775,7 +775,7 @@ class Piwik_Tracker_GoalManager
{
$newGoalDebug = $newGoal;
$newGoalDebug['idvisitor'] = bin2hex($newGoalDebug['idvisitor']);
- printDebug($newGoalDebug);
+ Common::printDebug($newGoalDebug);
$fields = implode(", ", array_keys($newGoal));
$bindFields = Common::getSqlStringFieldsArray($newGoal);
diff --git a/core/Tracker/IgnoreCookie.php b/core/Tracker/IgnoreCookie.php
index 7fd2cc9fb3..7253c25520 100644
--- a/core/Tracker/IgnoreCookie.php
+++ b/core/Tracker/IgnoreCookie.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
+use Piwik\Config;
/**
* Tracking cookies.
diff --git a/core/Tracker/Referer.php b/core/Tracker/Referer.php
index 1c8469f3f0..b1389c256b 100644
--- a/core/Tracker/Referer.php
+++ b/core/Tracker/Referer.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Piwik
diff --git a/core/Tracker/Request.php b/core/Tracker/Request.php
index e27e2eaded..c27ebe6b9a 100644
--- a/core/Tracker/Request.php
+++ b/core/Tracker/Request.php
@@ -1,6 +1,6 @@
<?php
-use Piwik\Core\Config;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Common;
/**
* Piwik - Open source web analytics
@@ -69,10 +69,10 @@ class Piwik_Tracker_Request
if (!$this->isAuthenticated) {
return;
}
- printDebug("token_auth is authenticated!");
+ Common::printDebug("token_auth is authenticated!");
} else {
$this->isAuthenticated = true;
- printDebug("token_auth authentication not required");
+ Common::printDebug("token_auth authentication not required");
}
}
@@ -97,7 +97,7 @@ class Piwik_Tracker_Request
return true;
}
}
- printDebug("WARNING! token_auth = $tokenAuth is not valid, Super User / Admin was NOT authenticated");
+ Common::printDebug("WARNING! token_auth = $tokenAuth is not valid, Super User / Admin was NOT authenticated");
return false;
}
@@ -296,7 +296,7 @@ class Piwik_Tracker_Request
|| count($keyValue) != 2
|| (!is_string($keyValue[0]) && !is_numeric($keyValue[0]))
) {
- printDebug("Invalid custom variables detected (id=$id)");
+ Common::printDebug("Invalid custom variables detected (id=$id)");
continue;
}
if (strlen($keyValue[1]) == 0) {
@@ -332,7 +332,7 @@ class Piwik_Tracker_Request
if (!$this->shouldUseThirdPartyCookie()) {
return;
}
- printDebug("We manage the cookie...");
+ Common::printDebug("We manage the cookie...");
$cookie = $this->makeThirdPartyCookie();
// idcookie has been generated in handleNewVisit or we simply propagate the old value
@@ -346,7 +346,7 @@ class Piwik_Tracker_Request
$this->getCookieName(),
$this->getCookieExpire(),
$this->getCookiePath());
- printDebug($cookie);
+ Common::printDebug($cookie);
return $cookie;
}
@@ -379,7 +379,7 @@ class Piwik_Tracker_Request
if (strlen($idVisitor) != Piwik_Tracker::LENGTH_HEX_ID_STRING) {
throw new Exception("Visitor ID (cid) $idVisitor must be " . Piwik_Tracker::LENGTH_HEX_ID_STRING . " characters long");
}
- printDebug("Request will be recorded for this idvisitor = " . $idVisitor);
+ Common::printDebug("Request will be recorded for this idvisitor = " . $idVisitor);
$found = true;
}
diff --git a/core/Tracker/Visit.php b/core/Tracker/Visit.php
index c04d7f5a00..d2d87d121e 100644
--- a/core/Tracker/Visit.php
+++ b/core/Tracker/Visit.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Common;
/**
* @package Piwik
@@ -95,8 +95,8 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
$this->visitorCustomVariables = $this->request->getCustomVariables($scope = 'visit');
if (!empty($this->visitorCustomVariables)) {
- printDebug("Visit level Custom Variables: ");
- printDebug($this->visitorCustomVariables);
+ Common::printDebug("Visit level Custom Variables: ");
+ Common::printDebug($this->visitorCustomVariables);
}
$this->goalManager = new Piwik_Tracker_GoalManager($this->request);
@@ -120,7 +120,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
$visitIsConverted = $someGoalsConverted;
// if we find a idgoal in the URL, but then the goal is not valid, this is most likely a fake request
if (!$someGoalsConverted) {
- printDebug('Invalid goal tracking request for goal id = ' . $this->goalManager->idGoal);
+ Common::printDebug('Invalid goal tracking request for goal id = ' . $this->goalManager->idGoal);
unset($this->goalManager);
return;
}
@@ -129,11 +129,11 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
$action = $this->newAction();
if ($this->detectActionIsOutlinkOnAliasHost($action)) {
- printDebug("INFO: The outlink URL host is one of the known host for this website. ");
+ Common::printDebug("INFO: The outlink URL host is one of the known host for this website. ");
}
if (isset($GLOBALS['PIWIK_TRACKER_DEBUG']) && $GLOBALS['PIWIK_TRACKER_DEBUG']) {
$type = Piwik_Tracker_Action::getActionTypeName($action->getActionType());
- printDebug("Action is a $type,
+ Common::printDebug("Action is a $type,
Action name = " . $action->getActionName() . ",
Action URL = " . $action->getActionUrl());
}
@@ -155,7 +155,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
$isLastActionInTheSameVisit = $this->isLastActionInTheSameVisit();
if (!$isLastActionInTheSameVisit) {
- printDebug("Visitor detected, but last action was more than 30 minutes ago...");
+ Common::printDebug("Visitor detected, but last action was more than 30 minutes ago...");
}
// Known visit when:
// ( - the visitor has the Piwik cookie with the idcookie ID used by Piwik to match the visitor
@@ -268,7 +268,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
if ($incrementActions) {
$sqlActionUpdate .= "visit_total_actions = visit_total_actions + 1, ";
}
- printDebug("Visit is known (IP = " . Piwik_IP::N2P($this->getVisitorIp()) . ")");
+ Common::printDebug("Visit is known (IP = " . Piwik_IP::N2P($this->getVisitorIp()) . ")");
$datetimeServer = Piwik_Tracker::getDatetimeFromTimestamp($this->request->getCurrentTimestamp());
$valuesToUpdate['visit_last_action_time'] = $datetimeServer;
@@ -332,12 +332,12 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
if (isset($valuesToUpdate['idvisitor'])) {
$valuesToUpdate['idvisitor'] = bin2hex($valuesToUpdate['idvisitor']);
}
- printDebug('Updating existing visit: ' . var_export($valuesToUpdate, true));
+ Common::printDebug('Updating existing visit: ' . var_export($valuesToUpdate, true));
if (Piwik_Tracker::getDatabase()->rowCount($result) == 0) {
- printDebug("Visitor with this idvisit wasn't found in the DB.");
- printDebug("$sqlQuery --- ");
- printDebug($sqlBind);
+ Common::printDebug("Visitor with this idvisit wasn't found in the DB.");
+ Common::printDebug("$sqlQuery --- ");
+ Common::printDebug($sqlBind);
throw new Piwik_Tracker_Visit_VisitorNotFoundInDatabase(
"The visitor with idvisitor=" . bin2hex($this->visitorInfo['idvisitor']) . " and idvisit=" . $this->visitorInfo['idvisit']
. " wasn't found in the DB, we fallback to a new visitor");
@@ -373,7 +373,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
*/
protected function handleNewVisit($idActionUrl, $idActionName, $actionType, $visitIsConverted)
{
- printDebug("New Visit (IP = " . Piwik_IP::N2P($this->getVisitorIp()) . ")");
+ Common::printDebug("New Visit (IP = " . Piwik_IP::N2P($this->getVisitorIp()) . ")");
$daysSinceFirstVisit = $this->request->getDaysSinceFirstVisit();
$visitCount = $this->request->getVisitCount();
@@ -468,7 +468,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
$debugVisitInfo = $this->visitorInfo;
$debugVisitInfo['idvisitor'] = bin2hex($debugVisitInfo['idvisitor']);
$debugVisitInfo['config_id'] = bin2hex($debugVisitInfo['config_id']);
- printDebug($debugVisitInfo);
+ Common::printDebug($debugVisitInfo);
$this->saveVisitorInformation();
}
@@ -643,9 +643,9 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
if ($isVisitorIdToLookup) {
$this->visitorInfo['idvisitor'] = $idVisitor;
- printDebug("Matching visitors with: visitorId=" . bin2hex($this->visitorInfo['idvisitor']) . " OR configId=" . bin2hex($configId));
+ Common::printDebug("Matching visitors with: visitorId=" . bin2hex($this->visitorInfo['idvisitor']) . " OR configId=" . bin2hex($configId));
} else {
- printDebug("Visitor doesn't have the piwik cookie...");
+ Common::printDebug("Visitor doesn't have the piwik cookie...");
}
$selectCustomVariables = '';
@@ -813,14 +813,14 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
}
$this->visitorKnown = true;
- printDebug("The visitor is known (idvisitor = " . bin2hex($this->visitorInfo['idvisitor']) . ",
+ Common::printDebug("The visitor is known (idvisitor = " . bin2hex($this->visitorInfo['idvisitor']) . ",
config_id = " . bin2hex($configId) . ",
idvisit = {$this->visitorInfo['idvisit']},
last action = " . date("r", $this->visitorInfo['visit_last_action_time']) . ",
first action = " . date("r", $this->visitorInfo['visit_first_action_time']) . ",
visit_goal_buyer' = " . $this->visitorInfo['visit_goal_buyer'] . ")");
} else {
- printDebug("The visitor was not matched with an existing visitor...");
+ Common::printDebug("The visitor was not matched with an existing visitor...");
}
}
diff --git a/core/Tracker/VisitExcluded.php b/core/Tracker/VisitExcluded.php
index b405d435cf..fc9fbfe52f 100644
--- a/core/Tracker/VisitExcluded.php
+++ b/core/Tracker/VisitExcluded.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* This class contains the logic to exclude some visitors from being tracked as per user settings
@@ -45,7 +45,7 @@ class Piwik_Tracker_VisitExcluded
$excluded = false;
if ($this->isNonHumanBot()) {
- printDebug('Search bot detected, visit excluded');
+ Common::printDebug('Search bot detected, visit excluded');
$excluded = true;
}
@@ -57,9 +57,9 @@ class Piwik_Tracker_VisitExcluded
if (!$excluded) {
$toRecord = $this->request->getParam($parameterForceRecord = 'rec');
if (!$toRecord) {
- printDebug(@$_SERVER['REQUEST_METHOD'] . ' parameter ' . $parameterForceRecord . ' not found in URL, request excluded');
+ Common::printDebug(@$_SERVER['REQUEST_METHOD'] . ' parameter ' . $parameterForceRecord . ' not found in URL, request excluded');
$excluded = true;
- printDebug("'$parameterForceRecord' parameter not found.");
+ Common::printDebug("'$parameterForceRecord' parameter not found.");
}
}
@@ -75,7 +75,7 @@ class Piwik_Tracker_VisitExcluded
if (!$excluded) {
$excluded = $this->isIgnoreCookieFound();
if ($excluded) {
- printDebug("Ignore cookie found.");
+ Common::printDebug("Ignore cookie found.");
}
}
@@ -83,7 +83,7 @@ class Piwik_Tracker_VisitExcluded
if (!$excluded) {
$excluded = $this->isVisitorIpExcluded();
if ($excluded) {
- printDebug("IP excluded.");
+ Common::printDebug("IP excluded.");
}
}
@@ -91,19 +91,19 @@ class Piwik_Tracker_VisitExcluded
if (!$excluded) {
$excluded = $this->isUserAgentExcluded();
if ($excluded) {
- printDebug("User agent excluded.");
+ Common::printDebug("User agent excluded.");
}
}
if (!$excluded) {
if ($this->isPrefetchDetected()) {
$excluded = true;
- printDebug("Prefetch request detected, not a real visit so we Ignore this visit/pageview");
+ Common::printDebug("Prefetch request detected, not a real visit so we Ignore this visit/pageview");
}
}
if ($excluded) {
- printDebug("Visitor excluded.");
+ Common::printDebug("Visitor excluded.");
return true;
}
@@ -167,7 +167,7 @@ class Piwik_Tracker_VisitExcluded
protected function isIgnoreCookieFound()
{
if (Piwik_Tracker_IgnoreCookie::isIgnoreCookieFound()) {
- printDebug('Piwik ignore cookie was found, visit not tracked.');
+ Common::printDebug('Piwik ignore cookie was found, visit not tracked.');
return true;
}
return false;
@@ -183,7 +183,7 @@ class Piwik_Tracker_VisitExcluded
$websiteAttributes = Piwik_Tracker_Cache::getCacheWebsiteAttributes($this->idSite);
if (!empty($websiteAttributes['excluded_ips'])) {
if (Piwik_IP::isIpInRange($this->ip, $websiteAttributes['excluded_ips'])) {
- printDebug('Visitor IP ' . Piwik_IP::N2P($this->ip) . ' is excluded from being tracked');
+ Common::printDebug('Visitor IP ' . Piwik_IP::N2P($this->ip) . ' is excluded from being tracked');
return true;
}
}
diff --git a/core/Translate.php b/core/Translate.php
index 95a2f58771..ce736265e9 100644
--- a/core/Translate.php
+++ b/core/Translate.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Common;
/**
* @package Piwik
diff --git a/core/TranslationWriter.php b/core/TranslationWriter.php
index 5cec03e006..a103799d33 100644
--- a/core/TranslationWriter.php
+++ b/core/TranslationWriter.php
@@ -9,7 +9,7 @@
* @package Piwik
*
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* Write translations to file
diff --git a/core/Twig.php b/core/Twig.php
index 57f1b00ee6..57e2c67605 100644
--- a/core/Twig.php
+++ b/core/Twig.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
diff --git a/core/UpdateCheck.php b/core/UpdateCheck.php
index 0f35a966d9..85d1716f29 100644
--- a/core/UpdateCheck.php
+++ b/core/UpdateCheck.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Common;
/**
* Class to check if a newer version of Piwik is available
diff --git a/core/Updater.php b/core/Updater.php
index b048dc6d0a..bc62eca147 100644
--- a/core/Updater.php
+++ b/core/Updater.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @see core/Option.php
diff --git a/core/Updates.php b/core/Updates.php
index 16e5f0d7e9..e4387d0634 100644
--- a/core/Updates.php
+++ b/core/Updates.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
+use Piwik\Config;
/**
* Abstract class for update scripts
diff --git a/core/Updates/0.2.10.php b/core/Updates/0.2.10.php
index bb4358e411..a85bcb88a8 100644
--- a/core/Updates/0.2.10.php
+++ b/core/Updates/0.2.10.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/0.2.12.php b/core/Updates/0.2.12.php
index 5712a132ff..378ad1c724 100644
--- a/core/Updates/0.2.12.php
+++ b/core/Updates/0.2.12.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/0.2.13.php b/core/Updates/0.2.13.php
index d548761222..15c510bb25 100644
--- a/core/Updates/0.2.13.php
+++ b/core/Updates/0.2.13.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/0.2.24.php b/core/Updates/0.2.24.php
index 4533832d90..e6515309b1 100644
--- a/core/Updates/0.2.24.php
+++ b/core/Updates/0.2.24.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/0.2.27.php b/core/Updates/0.2.27.php
index 92a738f903..e88ab68ffb 100644
--- a/core/Updates/0.2.27.php
+++ b/core/Updates/0.2.27.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/0.2.32.php b/core/Updates/0.2.32.php
index f14b5a5892..b13a40ad18 100644
--- a/core/Updates/0.2.32.php
+++ b/core/Updates/0.2.32.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/0.2.33.php b/core/Updates/0.2.33.php
index c203db12d4..50d6a2eea3 100644
--- a/core/Updates/0.2.33.php
+++ b/core/Updates/0.2.33.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/0.2.34.php b/core/Updates/0.2.34.php
index 4af164a129..bfefb5b501 100644
--- a/core/Updates/0.2.34.php
+++ b/core/Updates/0.2.34.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* @package Updates
diff --git a/core/Updates/0.2.35.php b/core/Updates/0.2.35.php
index 90f1b8fd6d..c5377fb43f 100644
--- a/core/Updates/0.2.35.php
+++ b/core/Updates/0.2.35.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/0.2.37.php b/core/Updates/0.2.37.php
index 1b3e9ad28e..a415ebbe58 100644
--- a/core/Updates/0.2.37.php
+++ b/core/Updates/0.2.37.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/0.4.1.php b/core/Updates/0.4.1.php
index 17d5b27910..1e06dd7fb3 100644
--- a/core/Updates/0.4.1.php
+++ b/core/Updates/0.4.1.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/0.4.2.php b/core/Updates/0.4.2.php
index ac931d6357..f03b443163 100644
--- a/core/Updates/0.4.2.php
+++ b/core/Updates/0.4.2.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/0.4.php b/core/Updates/0.4.php
index 2ccecc2c16..9e9e1ee0b0 100644
--- a/core/Updates/0.4.php
+++ b/core/Updates/0.4.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/0.5.4.php b/core/Updates/0.5.4.php
index f5fc2fb90a..2a48de630f 100644
--- a/core/Updates/0.5.4.php
+++ b/core/Updates/0.5.4.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Config;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/0.5.5.php b/core/Updates/0.5.5.php
index 1cba67d7a9..8ad736b81d 100644
--- a/core/Updates/0.5.5.php
+++ b/core/Updates/0.5.5.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/0.5.php b/core/Updates/0.5.php
index d465f9c225..f38c38aa46 100644
--- a/core/Updates/0.5.php
+++ b/core/Updates/0.5.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/0.6-rc1.php b/core/Updates/0.6-rc1.php
index bde19cff94..505df64ab2 100644
--- a/core/Updates/0.6-rc1.php
+++ b/core/Updates/0.6-rc1.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/0.6.2.php b/core/Updates/0.6.2.php
index d00ed5c91c..a3625a479c 100644
--- a/core/Updates/0.6.2.php
+++ b/core/Updates/0.6.2.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* @package Updates
diff --git a/core/Updates/0.6.3.php b/core/Updates/0.6.3.php
index 7b2c21accc..b20fd75627 100644
--- a/core/Updates/0.6.3.php
+++ b/core/Updates/0.6.3.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Config;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/0.7.php b/core/Updates/0.7.php
index d50796fc20..6e00fc9f7f 100644
--- a/core/Updates/0.7.php
+++ b/core/Updates/0.7.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/0.9.1.php b/core/Updates/0.9.1.php
index f76928c314..4bc4aab764 100644
--- a/core/Updates/0.9.1.php
+++ b/core/Updates/0.9.1.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.1.php b/core/Updates/1.1.php
index cae7b1f407..de74d8c713 100644
--- a/core/Updates/1.1.php
+++ b/core/Updates/1.1.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
+use Piwik\Config;
+use Piwik\Piwik;
/**
* @package Updates
diff --git a/core/Updates/1.10.2-b1.php b/core/Updates/1.10.2-b1.php
index f6c09c6e47..e2d9f2130f 100755
--- a/core/Updates/1.10.2-b1.php
+++ b/core/Updates/1.10.2-b1.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.10.2-b2.php b/core/Updates/1.10.2-b2.php
index fd0907ab97..8e57c75297 100644
--- a/core/Updates/1.10.2-b2.php
+++ b/core/Updates/1.10.2-b2.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.12-b1.php b/core/Updates/1.12-b1.php
index 44c9eccd9d..75c69e3839 100644
--- a/core/Updates/1.12-b1.php
+++ b/core/Updates/1.12-b1.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.12-b16.php b/core/Updates/1.12-b16.php
index 29cfa88489..b3956fc6ce 100644
--- a/core/Updates/1.12-b16.php
+++ b/core/Updates/1.12-b16.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.2-rc1.php b/core/Updates/1.2-rc1.php
index beb3b97034..02101697e7 100644
--- a/core/Updates/1.2-rc1.php
+++ b/core/Updates/1.2-rc1.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.2.3.php b/core/Updates/1.2.3.php
index c7cc2ce03c..f479dff100 100644
--- a/core/Updates/1.2.3.php
+++ b/core/Updates/1.2.3.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Config;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.2.5-rc1.php b/core/Updates/1.2.5-rc1.php
index 7eafdd9ad9..14d4e29a60 100644
--- a/core/Updates/1.2.5-rc1.php
+++ b/core/Updates/1.2.5-rc1.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.2.5-rc7.php b/core/Updates/1.2.5-rc7.php
index f1b8805228..dc613a7f83 100644
--- a/core/Updates/1.2.5-rc7.php
+++ b/core/Updates/1.2.5-rc7.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.4-rc1.php b/core/Updates/1.4-rc1.php
index 794c512e67..6a1029a455 100644
--- a/core/Updates/1.4-rc1.php
+++ b/core/Updates/1.4-rc1.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.4-rc2.php b/core/Updates/1.4-rc2.php
index a25e69ffc7..c1b52dd079 100644
--- a/core/Updates/1.4-rc2.php
+++ b/core/Updates/1.4-rc2.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.5-b1.php b/core/Updates/1.5-b1.php
index a8c7b76d31..71670a7c6e 100644
--- a/core/Updates/1.5-b1.php
+++ b/core/Updates/1.5-b1.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.5-b2.php b/core/Updates/1.5-b2.php
index 9544271bce..26ca5fdd38 100644
--- a/core/Updates/1.5-b2.php
+++ b/core/Updates/1.5-b2.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.5-b3.php b/core/Updates/1.5-b3.php
index 6f72eb6ac5..48af21fc13 100644
--- a/core/Updates/1.5-b3.php
+++ b/core/Updates/1.5-b3.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.5-b4.php b/core/Updates/1.5-b4.php
index 5a869301ed..5f0c46dfec 100644
--- a/core/Updates/1.5-b4.php
+++ b/core/Updates/1.5-b4.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.5-b5.php b/core/Updates/1.5-b5.php
index 76729f4270..bea0539c39 100644
--- a/core/Updates/1.5-b5.php
+++ b/core/Updates/1.5-b5.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.6-b1.php b/core/Updates/1.6-b1.php
index ef54c76b44..992e5b01ee 100644
--- a/core/Updates/1.6-b1.php
+++ b/core/Updates/1.6-b1.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.7-b1.php b/core/Updates/1.7-b1.php
index 2b4567e978..04fb74269c 100644
--- a/core/Updates/1.7-b1.php
+++ b/core/Updates/1.7-b1.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.7.2-rc5.php b/core/Updates/1.7.2-rc5.php
index 648c2c6b04..42af42e7c8 100644
--- a/core/Updates/1.7.2-rc5.php
+++ b/core/Updates/1.7.2-rc5.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.7.2-rc7.php b/core/Updates/1.7.2-rc7.php
index 51d1bfa887..cb1d96851c 100755
--- a/core/Updates/1.7.2-rc7.php
+++ b/core/Updates/1.7.2-rc7.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.8.3-b1.php b/core/Updates/1.8.3-b1.php
index ca8c0a1c70..3f3d579e58 100644
--- a/core/Updates/1.8.3-b1.php
+++ b/core/Updates/1.8.3-b1.php
@@ -8,7 +8,7 @@
* @category Piwik‚
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.8.4-b1.php b/core/Updates/1.8.4-b1.php
index e36349e8d1..f230d13da6 100644
--- a/core/Updates/1.8.4-b1.php
+++ b/core/Updates/1.8.4-b1.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.9-b16.php b/core/Updates/1.9-b16.php
index 096e7eadf8..380a75a808 100755
--- a/core/Updates/1.9-b16.php
+++ b/core/Updates/1.9-b16.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.9-b19.php b/core/Updates/1.9-b19.php
index de201fcb8d..bb08141de3 100755
--- a/core/Updates/1.9-b19.php
+++ b/core/Updates/1.9-b19.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.9-b9.php b/core/Updates/1.9-b9.php
index b67304d93d..737454231e 100755
--- a/core/Updates/1.9-b9.php
+++ b/core/Updates/1.9-b9.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.9.1-b2.php b/core/Updates/1.9.1-b2.php
index f2bcb81f42..81347c0844 100644
--- a/core/Updates/1.9.1-b2.php
+++ b/core/Updates/1.9.1-b2.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Updates/1.9.3-b8.php b/core/Updates/1.9.3-b8.php
index 3a0db01948..52938bd166 100755
--- a/core/Updates/1.9.3-b8.php
+++ b/core/Updates/1.9.3-b8.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Updates
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Updates
diff --git a/core/Url.php b/core/Url.php
index ab7b7c65e1..7ae67c1c94 100644
--- a/core/Url.php
+++ b/core/Url.php
@@ -8,9 +8,9 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Class to retrieve absolute URL or URI components of the current URL,
diff --git a/core/View.php b/core/View.php
index c8ee8c3089..6d01d36329 100644
--- a/core/View.php
+++ b/core/View.php
@@ -8,9 +8,9 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Transition for pre-Piwik 0.4.4
diff --git a/core/ViewDataTable.php b/core/ViewDataTable.php
index e8026c916a..b8195c5311 100644
--- a/core/ViewDataTable.php
+++ b/core/ViewDataTable.php
@@ -8,9 +8,9 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* This class is used to load (from the API) and customize the output of a given DataTable.
diff --git a/core/ViewDataTable/GenerateGraphData.php b/core/ViewDataTable/GenerateGraphData.php
index 91a1d889b7..af5f9ef132 100644
--- a/core/ViewDataTable/GenerateGraphData.php
+++ b/core/ViewDataTable/GenerateGraphData.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Reads data from the API and prepares data to give to the renderer Piwik_Visualization_Chart.
diff --git a/core/ViewDataTable/GenerateGraphData/ChartEvolution.php b/core/ViewDataTable/GenerateGraphData/ChartEvolution.php
index 5a51049c8e..3ce1de2d54 100644
--- a/core/ViewDataTable/GenerateGraphData/ChartEvolution.php
+++ b/core/ViewDataTable/GenerateGraphData/ChartEvolution.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Piwik_ViewDataTable_GenerateGraphData for the Evolution graph (eg. Last 30 days visits) using Piwik_Visualization_Chart_Evolution
diff --git a/core/ViewDataTable/GenerateGraphHTML.php b/core/ViewDataTable/GenerateGraphHTML.php
index 501f7fc558..dc7eacdc04 100644
--- a/core/ViewDataTable/GenerateGraphHTML.php
+++ b/core/ViewDataTable/GenerateGraphHTML.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* This class generates the HTML code to embed graphs in the page.
diff --git a/core/ViewDataTable/GenerateGraphHTML/ChartEvolution.php b/core/ViewDataTable/GenerateGraphHTML/ChartEvolution.php
index 00c5079760..638937dc05 100644
--- a/core/ViewDataTable/GenerateGraphHTML/ChartEvolution.php
+++ b/core/ViewDataTable/GenerateGraphHTML/ChartEvolution.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* Generates HTML embed for the Evolution graph
diff --git a/core/ViewDataTable/HtmlTable.php b/core/ViewDataTable/HtmlTable.php
index e1bfe37f10..e7d409b853 100644
--- a/core/ViewDataTable/HtmlTable.php
+++ b/core/ViewDataTable/HtmlTable.php
@@ -8,9 +8,9 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Outputs an AJAX Table for a given DataTable.
diff --git a/core/ViewDataTable/HtmlTable/Goals.php b/core/ViewDataTable/HtmlTable/Goals.php
index 6e1ddb535d..dbe8fc8338 100644
--- a/core/ViewDataTable/HtmlTable/Goals.php
+++ b/core/ViewDataTable/HtmlTable/Goals.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* @package Piwik
diff --git a/core/ViewDataTable/Sparkline.php b/core/ViewDataTable/Sparkline.php
index f20d3bc1ec..ae85101a78 100644
--- a/core/ViewDataTable/Sparkline.php
+++ b/core/ViewDataTable/Sparkline.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* Reads the requested DataTable from the API and prepare data for the Sparkline view.
diff --git a/core/Visualization/Chart.php b/core/Visualization/Chart.php
index 3c6374e852..cee6b08ab7 100644
--- a/core/Visualization/Chart.php
+++ b/core/Visualization/Chart.php
@@ -8,8 +8,8 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Generates the data in the Open Flash Chart format, from the given data.
diff --git a/core/Visualization/Cloud.php b/core/Visualization/Cloud.php
index 9d37bf9423..781973340c 100644
--- a/core/Visualization/Cloud.php
+++ b/core/Visualization/Cloud.php
@@ -8,7 +8,7 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* Generates a tag cloud from a given data array.
diff --git a/js/index.php b/js/index.php
index c0a3a00d0d..6c67ffdc81 100644
--- a/js/index.php
+++ b/js/index.php
@@ -5,7 +5,7 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* Tracker proxy
diff --git a/misc/cron/archive.php b/misc/cron/archive.php
index 88dfb56851..280574ac64 100644
--- a/misc/cron/archive.php
+++ b/misc/cron/archive.php
@@ -1,7 +1,7 @@
<?php
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+use Piwik\Common;
$USAGE = "
Usage:
diff --git a/misc/others/geoipUpdateRows.php b/misc/others/geoipUpdateRows.php
index 3f42dc3855..979ff5e8f7 100755
--- a/misc/others/geoipUpdateRows.php
+++ b/misc/others/geoipUpdateRows.php
@@ -1,7 +1,7 @@
<?php
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+use Piwik\Common;
ini_set("memory_limit", "512M");
error_reporting(E_ALL | E_NOTICE);
diff --git a/misc/others/iframeWidget_localhost.php b/misc/others/iframeWidget_localhost.php
index 4e7c4b72ad..ef22366cf8 100644
--- a/misc/others/iframeWidget_localhost.php
+++ b/misc/others/iframeWidget_localhost.php
@@ -1,5 +1,5 @@
<?php
-use Piwik\Core\Common;
+use Piwik\Common;
exit;
$date = date('Y-m-d');
diff --git a/misc/others/test_cookies_GenerateHundredsWebsitesAndVisits.php b/misc/others/test_cookies_GenerateHundredsWebsitesAndVisits.php
index 5af16983d6..2af3cab420 100644
--- a/misc/others/test_cookies_GenerateHundredsWebsitesAndVisits.php
+++ b/misc/others/test_cookies_GenerateHundredsWebsitesAndVisits.php
@@ -1,8 +1,8 @@
<?php
// Script that creates 100 websites, then outputs a IMG that records a pageview in each website
// Used initially to test how to handle cookies for this use case (see http://dev.piwik.org/trac/ticket/409)
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
exit;
diff --git a/misc/others/test_generateLotsVisitsWebsites.php b/misc/others/test_generateLotsVisitsWebsites.php
index a2e11deb78..abc4115ea6 100644
--- a/misc/others/test_generateLotsVisitsWebsites.php
+++ b/misc/others/test_generateLotsVisitsWebsites.php
@@ -1,7 +1,7 @@
<?php
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+use Piwik\Common;
define('PIWIK_INCLUDE_PATH', realpath(dirname(__FILE__) . "/../.."));
define('PIWIK_ENABLE_DISPATCH', false);
diff --git a/piwik.php b/piwik.php
index 3a8ded1202..65fcd55083 100644
--- a/piwik.php
+++ b/piwik.php
@@ -7,7 +7,7 @@
*
* @package Piwik
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
$GLOBALS['PIWIK_TRACKER_DEBUG'] = false;
$GLOBALS['PIWIK_TRACKER_DEBUG_FORCE_SCHEDULED_TASKS'] = false;
@@ -66,7 +66,7 @@ if ($GLOBALS['PIWIK_TRACKER_DEBUG'] === true) {
$timer = new Piwik_Timer();
set_error_handler('Piwik_ErrorHandler');
set_exception_handler('Piwik_ExceptionHandler');
- printDebug("Debug enabled - Input parameters: <br/>" . var_export($_GET, true));
+ Common::printDebug("Debug enabled - Input parameters: <br/>" . var_export($_GET, true));
Piwik_Tracker_Db::enableProfiling();
Piwik::createConfigObject();
Piwik::createLogObject();
@@ -81,7 +81,7 @@ if (!defined('PIWIK_ENABLE_TRACKING') || PIWIK_ENABLE_TRACKING) {
}
ob_end_flush();
if ($GLOBALS['PIWIK_TRACKER_DEBUG'] === true) {
- printDebug($_COOKIE);
- printDebug($timer);
+ Common::printDebug($_COOKIE);
+ Common::printDebug($timer);
}
}
diff --git a/plugins/API/API.php b/plugins/API/API.php
index 16cba3ce4e..2dc0ce766d 100644
--- a/plugins/API/API.php
+++ b/plugins/API/API.php
@@ -8,8 +8,11 @@
* @category Piwik_Plugins
* @package Piwik_API
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
+use Piwik\Config;
+
+require_once PIWIK_INCLUDE_PATH . '/core/Config.php';
/**
* @package Piwik_API
@@ -553,7 +556,7 @@ class Piwik_API_API
}
$urls = array_map('urldecode', $urls);
- $urls = array_map(array('Piwik\Core\Common', 'unsanitizeInputValue'), $urls);
+ $urls = array_map(array('Piwik\Common', 'unsanitizeInputValue'), $urls);
$result = array();
foreach ($urls as $url) {
@@ -629,7 +632,7 @@ class Piwik_API_API
arsort($values);
$values = array_keys($values);
- $values = array_map(array('Piwik\Core\Common', 'unsanitizeInputValue'), $values);
+ $values = array_map(array('Piwik\Common', 'unsanitizeInputValue'), $values);
$values = array_slice($values, 0, $maxSuggestionsToReturn);
return $values;
diff --git a/plugins/API/Controller.php b/plugins/API/Controller.php
index c18bfc3e85..16d8f9dd1f 100644
--- a/plugins/API/Controller.php
+++ b/plugins/API/Controller.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_API
*/
-use Piwik\Core\Config;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Common;
/**
*
diff --git a/plugins/API/ProcessedReport.php b/plugins/API/ProcessedReport.php
index 2417a558ab..70b51f91a5 100644
--- a/plugins/API/ProcessedReport.php
+++ b/plugins/API/ProcessedReport.php
@@ -1,6 +1,6 @@
<?php
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Piwik - Open source web analytics
diff --git a/plugins/API/RowEvolution.php b/plugins/API/RowEvolution.php
index f0eca1b190..ba6a63bdb8 100644
--- a/plugins/API/RowEvolution.php
+++ b/plugins/API/RowEvolution.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_API
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* This class generates a Row evolution dataset, from input request
diff --git a/plugins/Actions/API.php b/plugins/Actions/API.php
index 0f81d9d148..695e8f5a90 100644
--- a/plugins/Actions/API.php
+++ b/plugins/Actions/API.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_Actions
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* The Actions API lets you request reports for all your Visitor Actions: Page URLs, Page titles (Piwik Events),
diff --git a/plugins/Actions/Actions.php b/plugins/Actions/Actions.php
index 2ab5dfb2d1..103672f37b 100644
--- a/plugins/Actions/Actions.php
+++ b/plugins/Actions/Actions.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_Actions
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Actions plugin
diff --git a/plugins/Actions/Archiver.php b/plugins/Actions/Archiver.php
index 0fa1f4f0e2..c4a2bf24af 100644
--- a/plugins/Actions/Archiver.php
+++ b/plugins/Actions/Archiver.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_Actions
*/
-use Piwik\Core\Config;
+use Piwik\Config;
/**
* Class encapsulating logic to process Day/Period Archiving for the Actions reports
diff --git a/plugins/Actions/ArchivingHelper.php b/plugins/Actions/ArchivingHelper.php
index 37e9e99122..72342adff7 100644
--- a/plugins/Actions/ArchivingHelper.php
+++ b/plugins/Actions/ArchivingHelper.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_Actions
*/
-use Piwik\Core\Config;
+use Piwik\Config;
/**
* This static class provides:
diff --git a/plugins/Annotations/API.php b/plugins/Annotations/API.php
index a8b0508e0b..92dd4f18e4 100755
--- a/plugins/Annotations/API.php
+++ b/plugins/Annotations/API.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_Annotations
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* @see plugins/Annotations/AnnotationList.php
diff --git a/plugins/Annotations/AnnotationList.php b/plugins/Annotations/AnnotationList.php
index 7201b180bb..0b0ca1ea44 100755
--- a/plugins/Annotations/AnnotationList.php
+++ b/plugins/Annotations/AnnotationList.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_Annotations
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* This class can be used to query & modify annotations for multiple sites
diff --git a/plugins/Annotations/Controller.php b/plugins/Annotations/Controller.php
index 08defbc614..f632ab5ae8 100755
--- a/plugins/Annotations/Controller.php
+++ b/plugins/Annotations/Controller.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_Annotations
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* Controller for the Annotations plugin.
diff --git a/plugins/AnonymizeIP/AnonymizeIP.php b/plugins/AnonymizeIP/AnonymizeIP.php
index 7194a055fa..a835a91d8a 100644
--- a/plugins/AnonymizeIP/AnonymizeIP.php
+++ b/plugins/AnonymizeIP/AnonymizeIP.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_AnonymizeIP
*/
-use Piwik\Core\Config;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Common;
/**
* Anonymize visitor IP addresses to comply with the privacy laws/guidelines in countries, such as Germany.
diff --git a/plugins/CoreAdminHome/API.php b/plugins/CoreAdminHome/API.php
index 697ad3ca47..d192c17ca7 100644
--- a/plugins/CoreAdminHome/API.php
+++ b/plugins/CoreAdminHome/API.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_CoreAdminHome
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* @package Piwik_CoreAdminHome
diff --git a/plugins/CoreAdminHome/Controller.php b/plugins/CoreAdminHome/Controller.php
index 41e7898611..1cc8afb6c4 100644
--- a/plugins/CoreAdminHome/Controller.php
+++ b/plugins/CoreAdminHome/Controller.php
@@ -8,9 +8,9 @@
* @category Piwik_Plugins
* @package Piwik_CoreAdminHome
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+use Piwik\Common;
/**
*
diff --git a/plugins/CoreAdminHome/CoreAdminHome.php b/plugins/CoreAdminHome/CoreAdminHome.php
index 41bf84048a..110feb03b6 100644
--- a/plugins/CoreAdminHome/CoreAdminHome.php
+++ b/plugins/CoreAdminHome/CoreAdminHome.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_CoreAdminHome
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
*
diff --git a/plugins/CoreHome/Controller.php b/plugins/CoreHome/Controller.php
index 2dbe933fe5..d6afe9e354 100644
--- a/plugins/CoreHome/Controller.php
+++ b/plugins/CoreHome/Controller.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_CoreHome
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
*
diff --git a/plugins/CoreHome/DataTableRowAction/MultiRowEvolution.php b/plugins/CoreHome/DataTableRowAction/MultiRowEvolution.php
index c617a77ff3..e8625a2e07 100644
--- a/plugins/CoreHome/DataTableRowAction/MultiRowEvolution.php
+++ b/plugins/CoreHome/DataTableRowAction/MultiRowEvolution.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_CoreHome
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* MULTI ROW EVOLUTION
diff --git a/plugins/CoreHome/DataTableRowAction/RowEvolution.php b/plugins/CoreHome/DataTableRowAction/RowEvolution.php
index 7b15f9c887..4ca8bb6af3 100644
--- a/plugins/CoreHome/DataTableRowAction/RowEvolution.php
+++ b/plugins/CoreHome/DataTableRowAction/RowEvolution.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_CoreHome
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* ROW EVOLUTION
diff --git a/plugins/CorePluginsAdmin/Controller.php b/plugins/CorePluginsAdmin/Controller.php
index b5bce55327..85f8143063 100644
--- a/plugins/CorePluginsAdmin/Controller.php
+++ b/plugins/CorePluginsAdmin/Controller.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_CorePluginsAdmin
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
*
diff --git a/plugins/CorePluginsAdmin/CorePluginsAdmin.php b/plugins/CorePluginsAdmin/CorePluginsAdmin.php
index 5cf7824d3d..c7e856b91e 100644
--- a/plugins/CorePluginsAdmin/CorePluginsAdmin.php
+++ b/plugins/CorePluginsAdmin/CorePluginsAdmin.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_CorePluginsAdmin
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
*
diff --git a/plugins/CoreUpdater/Controller.php b/plugins/CoreUpdater/Controller.php
index 8744d4e651..98f7d968fb 100644
--- a/plugins/CoreUpdater/Controller.php
+++ b/plugins/CoreUpdater/Controller.php
@@ -8,9 +8,9 @@
* @category Piwik_Plugins
* @package Piwik_CoreUpdater
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+use Piwik\Common;
/**
*
diff --git a/plugins/CoreUpdater/CoreUpdater.php b/plugins/CoreUpdater/CoreUpdater.php
index 6f14121fba..efc971908a 100644
--- a/plugins/CoreUpdater/CoreUpdater.php
+++ b/plugins/CoreUpdater/CoreUpdater.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_CoreUpdater
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
*
diff --git a/plugins/CustomVariables/Archiver.php b/plugins/CustomVariables/Archiver.php
index 1e2c6c74ba..89eaf7821a 100644
--- a/plugins/CustomVariables/Archiver.php
+++ b/plugins/CustomVariables/Archiver.php
@@ -1,5 +1,7 @@
<?php
-use Piwik\Core\Common;
+use Piwik\Common;
+use Piwik\Config;
+
/**
* Piwik - Open source web analytics
diff --git a/plugins/DBStats/API.php b/plugins/DBStats/API.php
index 0610b4573d..0c4a4d1e53 100644
--- a/plugins/DBStats/API.php
+++ b/plugins/DBStats/API.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_DBStats
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* @see plugins/DBStats/MySQLMetadataProvider.php
diff --git a/plugins/DBStats/Controller.php b/plugins/DBStats/Controller.php
index e6c93ef5e0..ebad0c031e 100644
--- a/plugins/DBStats/Controller.php
+++ b/plugins/DBStats/Controller.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_DBStats
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
*
diff --git a/plugins/DBStats/DBStats.php b/plugins/DBStats/DBStats.php
index 03e4409af4..fd649d5b1e 100644
--- a/plugins/DBStats/DBStats.php
+++ b/plugins/DBStats/DBStats.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_DBStats
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
*
diff --git a/plugins/DBStats/MySQLMetadataProvider.php b/plugins/DBStats/MySQLMetadataProvider.php
index 75ca12e6ac..9641d2d788 100755
--- a/plugins/DBStats/MySQLMetadataProvider.php
+++ b/plugins/DBStats/MySQLMetadataProvider.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_DBStats
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Utility class that provides general information about databases, including the size of
diff --git a/plugins/Dashboard/API.php b/plugins/Dashboard/API.php
index dea5f45526..83a5c0b804 100644
--- a/plugins/Dashboard/API.php
+++ b/plugins/Dashboard/API.php
@@ -7,7 +7,7 @@
* @category Piwik_Plugins
* @package Piwik_Dashboard
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
diff --git a/plugins/Dashboard/Controller.php b/plugins/Dashboard/Controller.php
index 309b7a73a7..f91718d097 100644
--- a/plugins/Dashboard/Controller.php
+++ b/plugins/Dashboard/Controller.php
@@ -7,8 +7,8 @@
* @category Piwik_Plugins
* @package Piwik_Dashboard
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Dashboard Controller
diff --git a/plugins/Dashboard/Dashboard.php b/plugins/Dashboard/Dashboard.php
index 972804a950..6c8a4830b1 100644
--- a/plugins/Dashboard/Dashboard.php
+++ b/plugins/Dashboard/Dashboard.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_Dashboard
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* @package Piwik_Dashboard
diff --git a/plugins/DevicesDetection/API.php b/plugins/DevicesDetection/API.php
index 9548a53764..789afccc96 100644
--- a/plugins/DevicesDetection/API.php
+++ b/plugins/DevicesDetection/API.php
@@ -9,7 +9,7 @@
* @category Piwik_Plugins
* @package Piwik_DevicesDetection
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* The DevicesDetection API lets you access reports on your visitors devices, brands, models, Operating system, Browsers.
diff --git a/plugins/DevicesDetection/Controller.php b/plugins/DevicesDetection/Controller.php
index 6aac50450c..ae94f95375 100644
--- a/plugins/DevicesDetection/Controller.php
+++ b/plugins/DevicesDetection/Controller.php
@@ -1,6 +1,6 @@
<?php
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Piwik - Open source web analytics
diff --git a/plugins/DevicesDetection/DevicesDetection.php b/plugins/DevicesDetection/DevicesDetection.php
index 74ee758854..2a734b24e4 100644
--- a/plugins/DevicesDetection/DevicesDetection.php
+++ b/plugins/DevicesDetection/DevicesDetection.php
@@ -9,8 +9,8 @@
* @category Piwik_Plugins
* @package Piwik_DevicesDetection
*/
-use Piwik\Core\Config;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Common;
require_once PIWIK_INCLUDE_PATH . "/plugins/DevicesDetection/UserAgentParserEnhanced/UserAgentParserEnhanced.php";
require_once PIWIK_INCLUDE_PATH . '/plugins/DevicesDetection/functions.php';
@@ -225,8 +225,8 @@ class Piwik_DevicesDetection extends Piwik_Plugin
}
$visitorInfo = array_merge($visitorInfo, $deviceInfo);
- printDebug("Device Detection:");
- printDebug($deviceInfo);
+ Common::printDebug("Device Detection:");
+ Common::printDebug($deviceInfo);
}
public function archiveDay(Piwik_ArchiveProcessor_Day $archiveProcessor)
diff --git a/plugins/DoNotTrack/DoNotTrack.php b/plugins/DoNotTrack/DoNotTrack.php
index 59c2ee95db..2b8409d394 100644
--- a/plugins/DoNotTrack/DoNotTrack.php
+++ b/plugins/DoNotTrack/DoNotTrack.php
@@ -36,12 +36,12 @@ class Piwik_DoNotTrack extends Piwik_Plugin
$request = new Piwik_Tracker_Request($_REQUEST);
$ua = $request->getUserAgent();
if (strpos($ua, 'MSIE 10') !== false) {
- printDebug("INTERNET EXPLORER 10 Enables DNT by default, so Piwik ignores DNT for all IE10 browsers...");
+ Common::printDebug("INTERNET EXPLORER 10 Enables DNT by default, so Piwik ignores DNT for all IE10 browsers...");
return;
}
$exclude = true;
- printDebug("DoNotTrack found.");
+ Common::printDebug("DoNotTrack found.");
$trackingCookie = Piwik_Tracker_IgnoreCookie::getTrackingCookie();
$trackingCookie->delete();
diff --git a/plugins/ExampleAPI/API.php b/plugins/ExampleAPI/API.php
index 185aa2174d..163d265c27 100644
--- a/plugins/ExampleAPI/API.php
+++ b/plugins/ExampleAPI/API.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_ExampleAPI
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* The ExampleAPI is useful to developers building a custom Piwik plugin.
diff --git a/plugins/ExamplePlugin/Controller.php b/plugins/ExamplePlugin/Controller.php
index 45857cbc0b..1bcb01479b 100644
--- a/plugins/ExamplePlugin/Controller.php
+++ b/plugins/ExamplePlugin/Controller.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_ExamplePlugin
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
*
diff --git a/plugins/ExampleUI/Controller.php b/plugins/ExampleUI/Controller.php
index 597dea4c0f..5ee8ffddd7 100644
--- a/plugins/ExampleUI/Controller.php
+++ b/plugins/ExampleUI/Controller.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_ExampleUI
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Piwik_ExampleUI
diff --git a/plugins/Feedback/Controller.php b/plugins/Feedback/Controller.php
index 3ba8fa5b5a..243a36bacd 100644
--- a/plugins/Feedback/Controller.php
+++ b/plugins/Feedback/Controller.php
@@ -8,9 +8,9 @@
* @category Piwik_Plugins
* @package Piwik_Feedback
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+use Piwik\Common;
/**
*
diff --git a/plugins/Goals/API.php b/plugins/Goals/API.php
index bddaf7b98e..3249a3ac1e 100644
--- a/plugins/Goals/API.php
+++ b/plugins/Goals/API.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_Goals
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Goals API lets you Manage existing goals, via "updateGoal" and "deleteGoal", create new Goals via "addGoal",
diff --git a/plugins/Goals/Controller.php b/plugins/Goals/Controller.php
index ea38907bae..93bdd66b89 100644
--- a/plugins/Goals/Controller.php
+++ b/plugins/Goals/Controller.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_Goals
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
*
diff --git a/plugins/Goals/Goals.php b/plugins/Goals/Goals.php
index 9549dc2fb1..e612295dc1 100644
--- a/plugins/Goals/Goals.php
+++ b/plugins/Goals/Goals.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_Goals
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
*
diff --git a/plugins/ImageGraph/API.php b/plugins/ImageGraph/API.php
index c240a04ecc..4087b7a18d 100644
--- a/plugins/ImageGraph/API.php
+++ b/plugins/ImageGraph/API.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_ImageGraph
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* The ImageGraph.get API call lets you generate beautiful static PNG Graphs for any existing Piwik report.
diff --git a/plugins/ImageGraph/Controller.php b/plugins/ImageGraph/Controller.php
index 4cabcd9633..cd7700ef23 100644
--- a/plugins/ImageGraph/Controller.php
+++ b/plugins/ImageGraph/Controller.php
@@ -1,6 +1,6 @@
<?php
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Piwik - Open source web analytics
diff --git a/plugins/ImageGraph/ImageGraph.php b/plugins/ImageGraph/ImageGraph.php
index dfccc799bb..60ff3dc27c 100644
--- a/plugins/ImageGraph/ImageGraph.php
+++ b/plugins/ImageGraph/ImageGraph.php
@@ -1,5 +1,5 @@
<?php
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* Piwik - Open source web analytics
diff --git a/plugins/Installation/Controller.php b/plugins/Installation/Controller.php
index cf676dbd7f..7e24ebc155 100644
--- a/plugins/Installation/Controller.php
+++ b/plugins/Installation/Controller.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_Installation
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Installation controller
diff --git a/plugins/Installation/FormDatabaseSetup.php b/plugins/Installation/FormDatabaseSetup.php
index 0136c1a20e..d10f3b5a49 100644
--- a/plugins/Installation/FormDatabaseSetup.php
+++ b/plugins/Installation/FormDatabaseSetup.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_Installation
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
*
diff --git a/plugins/Installation/FormGeneralSetup.php b/plugins/Installation/FormGeneralSetup.php
index 61267e390a..23f1dbce94 100644
--- a/plugins/Installation/FormGeneralSetup.php
+++ b/plugins/Installation/FormGeneralSetup.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_Installation
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
*
diff --git a/plugins/Installation/Installation.php b/plugins/Installation/Installation.php
index 20af4fb892..1d81de1393 100644
--- a/plugins/Installation/Installation.php
+++ b/plugins/Installation/Installation.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_Installation
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
*
diff --git a/plugins/LanguagesManager/API.php b/plugins/LanguagesManager/API.php
index 14fb3ea7f5..bda2419908 100644
--- a/plugins/LanguagesManager/API.php
+++ b/plugins/LanguagesManager/API.php
@@ -9,8 +9,8 @@
* @package Piwik_LanguagesManager
*
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* The LanguagesManager API lets you access existing Piwik translations, and change Users languages preferences.
diff --git a/plugins/LanguagesManager/Controller.php b/plugins/LanguagesManager/Controller.php
index 53dd6494c5..6685b511e4 100644
--- a/plugins/LanguagesManager/Controller.php
+++ b/plugins/LanguagesManager/Controller.php
@@ -9,8 +9,8 @@
* @package Piwik_LanguagesManager
*
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* @package Piwik_LanguagesManager
diff --git a/plugins/LanguagesManager/LanguagesManager.php b/plugins/LanguagesManager/LanguagesManager.php
index 073e7a1231..da096266b5 100644
--- a/plugins/LanguagesManager/LanguagesManager.php
+++ b/plugins/LanguagesManager/LanguagesManager.php
@@ -9,9 +9,9 @@
* @package Piwik_LanguagesManager
*
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+use Piwik\Common;
/**
*
diff --git a/plugins/Live/API.php b/plugins/Live/API.php
index 6c4e7ba046..27652141d1 100644
--- a/plugins/Live/API.php
+++ b/plugins/Live/API.php
@@ -8,9 +8,9 @@
* @category Piwik_Plugins
* @package Piwik_Live
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* @see plugins/Referers/functions.php
diff --git a/plugins/Live/Controller.php b/plugins/Live/Controller.php
index 13e02a5d7d..bad3a1bcbf 100644
--- a/plugins/Live/Controller.php
+++ b/plugins/Live/Controller.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_Live
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* @package Piwik_Live
diff --git a/plugins/Live/Visitor.php b/plugins/Live/Visitor.php
index 800e8ec914..e10b1ea331 100644
--- a/plugins/Live/Visitor.php
+++ b/plugins/Live/Visitor.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_Live
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* @see plugins/Referers/functions.php
diff --git a/plugins/Login/Auth.php b/plugins/Login/Auth.php
index 20eae5f377..e8de6d3c38 100644
--- a/plugins/Login/Auth.php
+++ b/plugins/Login/Auth.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_Login
*/
-use Piwik\Core\Config;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Common;
/**
*
diff --git a/plugins/Login/Controller.php b/plugins/Login/Controller.php
index 6e429788eb..013658b419 100644
--- a/plugins/Login/Controller.php
+++ b/plugins/Login/Controller.php
@@ -8,8 +8,10 @@
* @category Piwik_Plugins
* @package Piwik_Login
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+
+require_once PIWIK_INCLUDE_PATH . '/core/Config.php';
/**
* Login controller
diff --git a/plugins/Login/Login.php b/plugins/Login/Login.php
index 59f9d63f8f..a46bf6e387 100644
--- a/plugins/Login/Login.php
+++ b/plugins/Login/Login.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_Login
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
+use Piwik\Config;
+use Piwik\Piwik;
/**
*
diff --git a/plugins/MobileMessaging/API.php b/plugins/MobileMessaging/API.php
index 52073993b0..491bb46f86 100644
--- a/plugins/MobileMessaging/API.php
+++ b/plugins/MobileMessaging/API.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_MobileMessaging
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* The MobileMessaging API lets you manage and access all the MobileMessaging plugin features including :
diff --git a/plugins/MobileMessaging/Controller.php b/plugins/MobileMessaging/Controller.php
index 84893cb172..a97641ed0c 100644
--- a/plugins/MobileMessaging/Controller.php
+++ b/plugins/MobileMessaging/Controller.php
@@ -9,8 +9,8 @@
* @package Piwik_MobileMessaging
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
require_once PIWIK_INCLUDE_PATH . '/plugins/UserCountry/functions.php';
diff --git a/plugins/MobileMessaging/MobileMessaging.php b/plugins/MobileMessaging/MobileMessaging.php
index 62debf52e6..22ae5f0d40 100644
--- a/plugins/MobileMessaging/MobileMessaging.php
+++ b/plugins/MobileMessaging/MobileMessaging.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_MobileMessaging
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
*
diff --git a/plugins/MobileMessaging/ReportRenderer/Sms.php b/plugins/MobileMessaging/ReportRenderer/Sms.php
index c871e6632a..d752b50e84 100644
--- a/plugins/MobileMessaging/ReportRenderer/Sms.php
+++ b/plugins/MobileMessaging/ReportRenderer/Sms.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_MobileMessaging_ReportRenderer
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
diff --git a/plugins/MultiSites/API.php b/plugins/MultiSites/API.php
index 433263ebb8..cb83dd2112 100755
--- a/plugins/MultiSites/API.php
+++ b/plugins/MultiSites/API.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_MultiSites
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* The MultiSites API lets you request the key metrics (visits, page views, revenue) for all Websites in Piwik.
diff --git a/plugins/MultiSites/Controller.php b/plugins/MultiSites/Controller.php
index a6634df68f..107f1923ce 100644
--- a/plugins/MultiSites/Controller.php
+++ b/plugins/MultiSites/Controller.php
@@ -8,8 +8,9 @@
* @category Piwik_Plugins
* @package Piwik_MultiSites
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
+use Piwik\Config;
/**
*
diff --git a/plugins/Overlay/API.php b/plugins/Overlay/API.php
index 812a792e14..83db709503 100644
--- a/plugins/Overlay/API.php
+++ b/plugins/Overlay/API.php
@@ -1,6 +1,6 @@
<?php
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
+use Piwik\Config;
+use Piwik\Piwik;
/**
* Piwik - Open source web analytics
diff --git a/plugins/Overlay/Controller.php b/plugins/Overlay/Controller.php
index e08218a23f..d875fa97a7 100644
--- a/plugins/Overlay/Controller.php
+++ b/plugins/Overlay/Controller.php
@@ -1,6 +1,6 @@
<?php
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Piwik - Open source web analytics
diff --git a/plugins/PDFReports/API.php b/plugins/PDFReports/API.php
index f63225450c..f177eaf4e7 100644
--- a/plugins/PDFReports/API.php
+++ b/plugins/PDFReports/API.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_PDFReports
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* The PDFReports API lets you manage Scheduled Email reports, as well as generate, download or email any existing report.
diff --git a/plugins/PDFReports/Controller.php b/plugins/PDFReports/Controller.php
index 2f8a5a9d83..4e7e8c1644 100644
--- a/plugins/PDFReports/Controller.php
+++ b/plugins/PDFReports/Controller.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_PDFReports
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
*
diff --git a/plugins/PDFReports/PDFReports.php b/plugins/PDFReports/PDFReports.php
index 9332020010..9130c2e291 100644
--- a/plugins/PDFReports/PDFReports.php
+++ b/plugins/PDFReports/PDFReports.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_PDFReports
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
*
diff --git a/plugins/PrivacyManager/Controller.php b/plugins/PrivacyManager/Controller.php
index 049f3a1ec8..d7191339da 100644
--- a/plugins/PrivacyManager/Controller.php
+++ b/plugins/PrivacyManager/Controller.php
@@ -8,9 +8,9 @@
* @category Piwik_Plugins
* @package Piwik_PrivacyManager
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+use Piwik\Common;
/**
*
diff --git a/plugins/PrivacyManager/LogDataPurger.php b/plugins/PrivacyManager/LogDataPurger.php
index 692d8435e2..ac899a6ce4 100755
--- a/plugins/PrivacyManager/LogDataPurger.php
+++ b/plugins/PrivacyManager/LogDataPurger.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_PrivacyManager
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Purges the log_visit, log_conversion and related tables of old visit data.
diff --git a/plugins/PrivacyManager/PrivacyManager.php b/plugins/PrivacyManager/PrivacyManager.php
index 9553275c8a..59836dae9a 100644
--- a/plugins/PrivacyManager/PrivacyManager.php
+++ b/plugins/PrivacyManager/PrivacyManager.php
@@ -8,9 +8,9 @@
* @category Piwik_Plugins
* @package Piwik_PrivacyManager
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* @see plugins/PrivacyManager/LogDataPurger.php
diff --git a/plugins/PrivacyManager/ReportsPurger.php b/plugins/PrivacyManager/ReportsPurger.php
index 49938dd33d..db4e5cafe3 100755
--- a/plugins/PrivacyManager/ReportsPurger.php
+++ b/plugins/PrivacyManager/ReportsPurger.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_PrivacyManager
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* Purges archived reports and metrics that are considered old.
diff --git a/plugins/Provider/API.php b/plugins/Provider/API.php
index 687527d571..20408c70b8 100644
--- a/plugins/Provider/API.php
+++ b/plugins/Provider/API.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_Provider
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* @see plugins/Provider/functions.php
diff --git a/plugins/Provider/Provider.php b/plugins/Provider/Provider.php
index b785229214..ca7c05ae8d 100644
--- a/plugins/Provider/Provider.php
+++ b/plugins/Provider/Provider.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_Provider
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
*
@@ -111,7 +111,7 @@ class Piwik_Provider extends Piwik_Plugin
// In case the IP was anonymized, we should not continue since the DNS reverse lookup will fail and this will slow down tracking
if (substr($ip, -2, 2) == '.0') {
- printDebug("IP Was anonymized so we skip the Provider DNS reverse lookup...");
+ Common::printDebug("IP Was anonymized so we skip the Provider DNS reverse lookup...");
return;
}
diff --git a/plugins/Provider/functions.php b/plugins/Provider/functions.php
index 36dc488a99..a09ec1ab36 100644
--- a/plugins/Provider/functions.php
+++ b/plugins/Provider/functions.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_Provider
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* Return hostname portion of a domain name
diff --git a/plugins/Proxy/Controller.php b/plugins/Proxy/Controller.php
index b97e61471c..f7f71bb8a8 100644
--- a/plugins/Proxy/Controller.php
+++ b/plugins/Proxy/Controller.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_Proxy
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Controller for proxy services
diff --git a/plugins/Referers/API.php b/plugins/Referers/API.php
index 39ad371b43..7620cfd668 100644
--- a/plugins/Referers/API.php
+++ b/plugins/Referers/API.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_Referers
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* The Referrers API lets you access reports about Websites, Search engines, Keywords, Campaigns used to access your website.
diff --git a/plugins/Referers/Archiver.php b/plugins/Referers/Archiver.php
index 8dd540a478..42af90b320 100644
--- a/plugins/Referers/Archiver.php
+++ b/plugins/Referers/Archiver.php
@@ -1,5 +1,6 @@
<?php
-use Piwik\Core\Common;
+use Piwik\Common;
+use Piwik\Config;
/**
* Piwik - Open source web analytics
diff --git a/plugins/Referers/Controller.php b/plugins/Referers/Controller.php
index df592528c1..8abcfb7062 100644
--- a/plugins/Referers/Controller.php
+++ b/plugins/Referers/Controller.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_Referers
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
*
diff --git a/plugins/Referers/Referers.php b/plugins/Referers/Referers.php
index e4feb4d186..c96ca7927d 100644
--- a/plugins/Referers/Referers.php
+++ b/plugins/Referers/Referers.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_Referers
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* @see plugins/Referers/functions.php
diff --git a/plugins/Referers/functions.php b/plugins/Referers/functions.php
index 7ba0b6f776..b7038fb360 100644
--- a/plugins/Referers/functions.php
+++ b/plugins/Referers/functions.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_Referers
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* Returns path component from a URL
diff --git a/plugins/SEO/API.php b/plugins/SEO/API.php
index 9e1d8c1713..b7826f30d5 100644
--- a/plugins/SEO/API.php
+++ b/plugins/SEO/API.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_SEO
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* @see plugins/Referers/functions.php
diff --git a/plugins/SEO/Controller.php b/plugins/SEO/Controller.php
index 9e9945de83..c09ce235d1 100644
--- a/plugins/SEO/Controller.php
+++ b/plugins/SEO/Controller.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_SEO
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Piwik_SEO
diff --git a/plugins/SEO/MajesticClient.php b/plugins/SEO/MajesticClient.php
index 2e0b2ee5e6..250fa0025b 100644
--- a/plugins/SEO/MajesticClient.php
+++ b/plugins/SEO/MajesticClient.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_SEO
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* Client for Majestic SEO's HTTP API.
diff --git a/plugins/SEO/RankChecker.php b/plugins/SEO/RankChecker.php
index fabd770118..ddc3f5117d 100644
--- a/plugins/SEO/RankChecker.php
+++ b/plugins/SEO/RankChecker.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_SEO
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* The functions below are derived/adapted from GetRank.org's
diff --git a/plugins/SecurityInfo/Controller.php b/plugins/SecurityInfo/Controller.php
index fd66acc99a..c9b307bba4 100644
--- a/plugins/SecurityInfo/Controller.php
+++ b/plugins/SecurityInfo/Controller.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_SecurityInfo
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* @package Piwik_SecurityInfo
diff --git a/plugins/SecurityInfo/SecurityInfo.php b/plugins/SecurityInfo/SecurityInfo.php
index 04537325cf..ecd8d2e5f6 100644
--- a/plugins/SecurityInfo/SecurityInfo.php
+++ b/plugins/SecurityInfo/SecurityInfo.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_SecurityInfo
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
*
diff --git a/plugins/SegmentEditor/API.php b/plugins/SegmentEditor/API.php
index 7d90bee310..c3c04a054e 100644
--- a/plugins/SegmentEditor/API.php
+++ b/plugins/SegmentEditor/API.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_SegmentEditor
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* The SegmentEditor API lets you add, update, delete custom Segments, and list saved segments.a
diff --git a/plugins/SegmentEditor/Controller.php b/plugins/SegmentEditor/Controller.php
index b48374deb1..bafab7ac46 100644
--- a/plugins/SegmentEditor/Controller.php
+++ b/plugins/SegmentEditor/Controller.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_SegmentEditor
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* @package Piwik_SegmentEditor
diff --git a/plugins/SegmentEditor/SegmentEditor.php b/plugins/SegmentEditor/SegmentEditor.php
index 41b79dcd1d..94eefc117d 100644
--- a/plugins/SegmentEditor/SegmentEditor.php
+++ b/plugins/SegmentEditor/SegmentEditor.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_SegmentEditor
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @package Piwik_SegmentEditor
diff --git a/plugins/SitesManager/API.php b/plugins/SitesManager/API.php
index 19a8db3d2e..1400d50008 100644
--- a/plugins/SitesManager/API.php
+++ b/plugins/SitesManager/API.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_SitesManager
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* The SitesManager API gives you full control on Websites in Piwik (create, update and delete), and many methods to retrieve websites based on various attributes.
diff --git a/plugins/SitesManager/Controller.php b/plugins/SitesManager/Controller.php
index eca7970aca..c6e518dbc9 100644
--- a/plugins/SitesManager/Controller.php
+++ b/plugins/SitesManager/Controller.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_SitesManager
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
*
diff --git a/plugins/SitesManager/SitesManager.php b/plugins/SitesManager/SitesManager.php
index 79fa7f7701..8fbad87b00 100644
--- a/plugins/SitesManager/SitesManager.php
+++ b/plugins/SitesManager/SitesManager.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_SitesManager
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
*
diff --git a/plugins/Transitions/API.php b/plugins/Transitions/API.php
index 2b35a6e271..739d07af7d 100644
--- a/plugins/Transitions/API.php
+++ b/plugins/Transitions/API.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_Transitions
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* @package Piwik_Transitions
diff --git a/plugins/UserCountry/API.php b/plugins/UserCountry/API.php
index b89b557448..4c146e879b 100644
--- a/plugins/UserCountry/API.php
+++ b/plugins/UserCountry/API.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_UserCountry
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* @see plugins/UserCountry/functions.php
diff --git a/plugins/UserCountry/Controller.php b/plugins/UserCountry/Controller.php
index 355f771e68..bda89e927b 100644
--- a/plugins/UserCountry/Controller.php
+++ b/plugins/UserCountry/Controller.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_UserCountry
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
*
diff --git a/plugins/UserCountry/GeoIPAutoUpdater.php b/plugins/UserCountry/GeoIPAutoUpdater.php
index febeccdee0..6b63142cfa 100755
--- a/plugins/UserCountry/GeoIPAutoUpdater.php
+++ b/plugins/UserCountry/GeoIPAutoUpdater.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_UserCountry
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* Used to automatically update installed GeoIP databases, and manages the updater's
diff --git a/plugins/UserCountry/LocationProvider.php b/plugins/UserCountry/LocationProvider.php
index d05fbfba76..153247a252 100755
--- a/plugins/UserCountry/LocationProvider.php
+++ b/plugins/UserCountry/LocationProvider.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_UserCountry
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
* @see plugins/UserCountry/LocationProvider/Default.php
diff --git a/plugins/UserCountry/LocationProvider/Default.php b/plugins/UserCountry/LocationProvider/Default.php
index 18ef73ce3e..a7798a5ca0 100755
--- a/plugins/UserCountry/LocationProvider/Default.php
+++ b/plugins/UserCountry/LocationProvider/Default.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_UserCountry
*/
-use Piwik\Core\Config;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Common;
/**
* The default LocationProvider, this LocationProvider guesses a visitor's country
diff --git a/plugins/UserCountry/LocationProvider/GeoIp/Php.php b/plugins/UserCountry/LocationProvider/GeoIp/Php.php
index 5e2e1f71e8..001b7f8c4e 100755
--- a/plugins/UserCountry/LocationProvider/GeoIp/Php.php
+++ b/plugins/UserCountry/LocationProvider/GeoIp/Php.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_UserCountry
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* A LocationProvider that uses the PHP implementation of GeoIP.
diff --git a/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php b/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php
index cdafeefa6a..a26217bac2 100755
--- a/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php
+++ b/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php
@@ -69,7 +69,7 @@ class Piwik_UserCountry_LocationProvider_GeoIp_ServerBased extends Piwik_UserCou
&& (!isset($info['disable_fallbacks'])
|| !$info['disable_fallbacks'])
) {
- printDebug("The request is for IP address: " . $info['ip'] . " but your IP is: $myIP. GeoIP Server Module (apache/nginx) does not support this use case... ");
+ Common::printDebug("The request is for IP address: " . $info['ip'] . " but your IP is: $myIP. GeoIP Server Module (apache/nginx) does not support this use case... ");
$fallbacks = array(
Piwik_UserCountry_LocationProvider_GeoIp_Pecl::ID,
Piwik_UserCountry_LocationProvider_GeoIp_Php::ID
@@ -77,11 +77,11 @@ class Piwik_UserCountry_LocationProvider_GeoIp_ServerBased extends Piwik_UserCou
foreach ($fallbacks as $fallbackProviderId) {
$otherProvider = Piwik_UserCountry_LocationProvider::getProviderById($fallbackProviderId);
if ($otherProvider) {
- printDebug("Used $fallbackProviderId to detect this visitor IP");
+ Common::printDebug("Used $fallbackProviderId to detect this visitor IP");
return $otherProvider->getLocation($info);
}
}
- printDebug("FAILED to lookup the geo location of this IP address, as no fallback location providers is configured. We recommend to configure Geolocation PECL module to fix this error.");
+ Common::printDebug("FAILED to lookup the geo location of this IP address, as no fallback location providers is configured. We recommend to configure Geolocation PECL module to fix this error.");
return false;
}
diff --git a/plugins/UserCountry/UserCountry.php b/plugins/UserCountry/UserCountry.php
index 3171a92e7c..d6e673e697 100644
--- a/plugins/UserCountry/UserCountry.php
+++ b/plugins/UserCountry/UserCountry.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_UserCountry
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* @see plugins/UserCountry/GeoIPAutoUpdater.php
@@ -69,7 +69,7 @@ class Piwik_UserCountry extends Piwik_Plugin
if ($provider === false) {
$id = Piwik_UserCountry_LocationProvider_Default::ID;
$provider = Piwik_UserCountry_LocationProvider::getProviderById($id);
- printDebug("GEO: no current location provider sent, falling back to default '$id' one.");
+ Common::printDebug("GEO: no current location provider sent, falling back to default '$id' one.");
}
$location = $provider->getLocation($visitorInfo);
@@ -79,10 +79,10 @@ class Piwik_UserCountry extends Piwik_Plugin
$defaultId = Piwik_UserCountry_LocationProvider_Default::ID;
$provider = Piwik_UserCountry_LocationProvider::getProviderById($defaultId);
$location = $provider->getLocation($visitorInfo);
- printDebug("GEO: couldn't find a location with Geo Module '$id', using Default '$defaultId' provider as fallback...");
+ Common::printDebug("GEO: couldn't find a location with Geo Module '$id', using Default '$defaultId' provider as fallback...");
$id = $defaultId;
}
- printDebug("GEO: Found IP location (provider '" . $id . "'): " . var_export($location, true));
+ Common::printDebug("GEO: Found IP location (provider '" . $id . "'): " . var_export($location, true));
}
function addWidgets()
diff --git a/plugins/UserCountryMap/Controller.php b/plugins/UserCountryMap/Controller.php
index 6eee81eed6..08989db237 100644
--- a/plugins/UserCountryMap/Controller.php
+++ b/plugins/UserCountryMap/Controller.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_UserCountryMap
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
*
diff --git a/plugins/UserSettings/API.php b/plugins/UserSettings/API.php
index 23a538e7f1..2a8c7584de 100644
--- a/plugins/UserSettings/API.php
+++ b/plugins/UserSettings/API.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_UserSettings
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* @see plugins/UserSettings/functions.php
diff --git a/plugins/UserSettings/Archiver.php b/plugins/UserSettings/Archiver.php
index 95f7f5f107..cdfd893faf 100644
--- a/plugins/UserSettings/Archiver.php
+++ b/plugins/UserSettings/Archiver.php
@@ -9,7 +9,7 @@
* @package Piwik_UserSettings
*/
-use Piwik\Core\Common;
+use Piwik\Common;
require_once PIWIK_INCLUDE_PATH . '/plugins/UserSettings/functions.php';
diff --git a/plugins/UserSettings/functions.php b/plugins/UserSettings/functions.php
index 8adc92b245..86164eb5a1 100644
--- a/plugins/UserSettings/functions.php
+++ b/plugins/UserSettings/functions.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_UserSettings
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* @see libs/UserAgentParser/UserAgentParser.php
diff --git a/plugins/UsersManager/API.php b/plugins/UsersManager/API.php
index 0ed1aaf7aa..3a804c70f0 100644
--- a/plugins/UsersManager/API.php
+++ b/plugins/UsersManager/API.php
@@ -8,9 +8,9 @@
* @category Piwik_Plugins
* @package Piwik_UsersManager
*/
-use Piwik\Core\Config;
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Config;
+use Piwik\Piwik;
+use Piwik\Common;
/**
* The UsersManager API lets you Manage Users and their permissions to access specific websites.
diff --git a/plugins/UsersManager/Controller.php b/plugins/UsersManager/Controller.php
index ac3aaab360..9c8cae77ca 100644
--- a/plugins/UsersManager/Controller.php
+++ b/plugins/UsersManager/Controller.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_UsersManager
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
*
diff --git a/plugins/UsersManager/UsersManager.php b/plugins/UsersManager/UsersManager.php
index 82d02f36bf..58f585da67 100644
--- a/plugins/UsersManager/UsersManager.php
+++ b/plugins/UsersManager/UsersManager.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_UsersManager
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* Manage Piwik users
diff --git a/plugins/VisitFrequency/API.php b/plugins/VisitFrequency/API.php
index 5b7161b7be..49473b5192 100644
--- a/plugins/VisitFrequency/API.php
+++ b/plugins/VisitFrequency/API.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_VisitFrequency
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* VisitFrequency API lets you access a list of metrics related to Returning Visitors.
diff --git a/plugins/VisitFrequency/Controller.php b/plugins/VisitFrequency/Controller.php
index 6cac26d504..c9362959cc 100644
--- a/plugins/VisitFrequency/Controller.php
+++ b/plugins/VisitFrequency/Controller.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_VisitFrequency
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
*
diff --git a/plugins/VisitTime/API.php b/plugins/VisitTime/API.php
index f473ae6ab3..05dad866b9 100644
--- a/plugins/VisitTime/API.php
+++ b/plugins/VisitTime/API.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_VisitTime
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* VisitTime API lets you access reports by Hour (Server time), and by Hour Local Time of your visitors.
diff --git a/plugins/VisitTime/VisitTime.php b/plugins/VisitTime/VisitTime.php
index 990bf350e3..dad9c46fec 100644
--- a/plugins/VisitTime/VisitTime.php
+++ b/plugins/VisitTime/VisitTime.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_VisitTime
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
*
diff --git a/plugins/VisitorGenerator/Controller.php b/plugins/VisitorGenerator/Controller.php
index 813984b2ed..606e8784c7 100644
--- a/plugins/VisitorGenerator/Controller.php
+++ b/plugins/VisitorGenerator/Controller.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_VisitorGenerator
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
*
diff --git a/plugins/VisitorGenerator/VisitorGenerator.php b/plugins/VisitorGenerator/VisitorGenerator.php
index dc23e4f60d..7423f3a900 100644
--- a/plugins/VisitorGenerator/VisitorGenerator.php
+++ b/plugins/VisitorGenerator/VisitorGenerator.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_VisitorGenerator
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
*
diff --git a/plugins/VisitorInterest/API.php b/plugins/VisitorInterest/API.php
index 35e89c9896..33251a7232 100644
--- a/plugins/VisitorInterest/API.php
+++ b/plugins/VisitorInterest/API.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_VisitorInterest
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* VisitorInterest API lets you access two Visitor Engagement reports: number of visits per number of pages,
diff --git a/plugins/VisitsSummary/API.php b/plugins/VisitsSummary/API.php
index a7c0ecda71..6e4399c384 100644
--- a/plugins/VisitsSummary/API.php
+++ b/plugins/VisitsSummary/API.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_VisitsSummary
*/
-use Piwik\Core\Piwik;
+use Piwik\Piwik;
/**
* VisitsSummary API lets you access the core web analytics metrics (visits, unique visitors,
diff --git a/plugins/VisitsSummary/Controller.php b/plugins/VisitsSummary/Controller.php
index 02ab257ac5..8a4552f473 100644
--- a/plugins/VisitsSummary/Controller.php
+++ b/plugins/VisitsSummary/Controller.php
@@ -8,8 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_VisitsSummary
*/
-use Piwik\Core\Piwik;
-use Piwik\Core\Common;
+use Piwik\Piwik;
+use Piwik\Common;
/**
*
diff --git a/plugins/Widgetize/Controller.php b/plugins/Widgetize/Controller.php
index be6b56a37b..dad2506936 100644
--- a/plugins/Widgetize/Controller.php
+++ b/plugins/Widgetize/Controller.php
@@ -8,7 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_Widgetize
*/
-use Piwik\Core\Common;
+use Piwik\Common;
/**
*