diff options
61 files changed, 132 insertions, 115 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 20ec83a735..5218540d6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ This is a changelog for Piwik platform developers. All changes for our HTTP API' ### Deprecations * The API method `SitesManager.getSitesIdWithVisits` has been deprecated and will be removed in Piwik 3.0 +* The API method `\Piwik\Plugin::getListHooksRegistered()` has been deprecated and will be removed in Piwik 3.0. Use `\Piwik\Plugin::registerEvents()` instead. * The following events have been deprecated and will be removed in Piwik 3.0. Use [dimensions](http://developer.piwik.org/guides/dimensions) instead. * `Tracker.existingVisitInformation` * `Tracker.getVisitFieldsToPersist` @@ -19,6 +20,7 @@ This is a changelog for Piwik platform developers. All changes for our HTTP API' * `Tracker.recordEcommerceGoal` * `Tracker.recordStandardGoals` + ### New APIs * The JavaScript Tracker `piwik.js` got a new method `logAllContentBlocksOnPage` to log all found content blocks within a page to the console. This is useful to debug / test content tracking. It can be triggered via `_paq.push(['logAllContentBlocksOnPage'])` diff --git a/core/Plugin.php b/core/Plugin.php index 560e7581b1..ff938a659f 100644 --- a/core/Plugin.php +++ b/core/Plugin.php @@ -56,7 +56,7 @@ require_once PIWIK_INCLUDE_PATH . '/core/Plugin/MetadataLoader.php'; * * class MyPlugin extends Plugin * { - * public function getListHooksRegistered() + * public function registerEvents() * { * return array( * 'API.getReportMetadata' => 'getReportMetadata', @@ -192,7 +192,7 @@ class Plugin } /** - * Returns a list of hooks with associated event observers. + * Returns a list of events with associated event observers. * * Derived classes should use this method to associate callbacks with events. * @@ -209,13 +209,23 @@ class Plugin * 'before' => true // execute before callbacks w/o ordering * ) * ) + * @since 2.15.0 */ - public function getListHooksRegistered() + public function registerEvents() { return array(); } /** + * @deprecated since 2.15.0 use {@link registerEvents()} instead. + * @return array + */ + public function getListHooksRegistered() + { + return $this->registerEvents(); + } + + /** * This method is executed after a plugin is loaded and translations are registered. * Useful for initialization code that uses translated strings. */ diff --git a/core/ViewDataTable/Factory.php b/core/ViewDataTable/Factory.php index 8822fd04b6..43db3161e9 100644 --- a/core/ViewDataTable/Factory.php +++ b/core/ViewDataTable/Factory.php @@ -146,10 +146,6 @@ class Factory return self::createViewDataTableInstance($visualizations[$type], $controllerAction, $apiAction, $params); } - if (class_exists($type)) { - return self::createViewDataTableInstance($type, $controllerAction, $apiAction, $params); - } - if (array_key_exists($defaultType, $visualizations)) { return self::createViewDataTableInstance($visualizations[$defaultType], $controllerAction, $apiAction, $params); } diff --git a/plugins/API/API.php b/plugins/API/API.php index 3c7d68c18e..7027756ccd 100644 --- a/plugins/API/API.php +++ b/plugins/API/API.php @@ -589,9 +589,9 @@ class Plugin extends \Piwik\Plugin } /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles' diff --git a/plugins/Actions/Actions.php b/plugins/Actions/Actions.php index 8cff52d8d7..557e4c77b8 100644 --- a/plugins/Actions/Actions.php +++ b/plugins/Actions/Actions.php @@ -26,9 +26,9 @@ class Actions extends \Piwik\Plugin const ACTIONS_REPORT_ROWS_DISPLAY = 100; /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'ViewDataTable.configure' => 'configureViewDataTable', diff --git a/plugins/Annotations/Annotations.php b/plugins/Annotations/Annotations.php index c560f56b9f..84fe6134a8 100755 --- a/plugins/Annotations/Annotations.php +++ b/plugins/Annotations/Annotations.php @@ -16,9 +16,9 @@ namespace Piwik\Plugins\Annotations; class Annotations extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', diff --git a/plugins/BulkTracking/BulkTracking.php b/plugins/BulkTracking/BulkTracking.php index b55a681030..c05f5dc513 100644 --- a/plugins/BulkTracking/BulkTracking.php +++ b/plugins/BulkTracking/BulkTracking.php @@ -19,9 +19,9 @@ class BulkTracking extends \Piwik\Plugin private $requests; /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'Tracker.newHandler' => 'setHandlerIfBulkRequest', diff --git a/plugins/BulkTracking/tests/Integration/BulkTrackingTest.php b/plugins/BulkTracking/tests/Integration/BulkTrackingTest.php index c495afcee1..3c3366ea9d 100644 --- a/plugins/BulkTracking/tests/Integration/BulkTrackingTest.php +++ b/plugins/BulkTracking/tests/Integration/BulkTrackingTest.php @@ -118,7 +118,7 @@ class BulkTrackingTest extends BulkTrackingTestCase $this->assertNull($handler); } - public function test_getListHooksRegistered_shouldListenToNewTrackerEventAndCreateBulkHandler_IfBulkRequest() + public function test_registerEvents_shouldListenToNewTrackerEventAndCreateBulkHandler_IfBulkRequest() { $this->injectRawDataToBulk($this->getDummyRequest()); @@ -127,14 +127,14 @@ class BulkTrackingTest extends BulkTrackingTestCase $this->assertTrue($handler instanceof Handler); } - public function test_getListHooksRegistered_shouldListenToNewTrackerEventAndNotCreateBulkHandler_IfNotBulkRequest() + public function test_registerEvents_shouldListenToNewTrackerEventAndNotCreateBulkHandler_IfNotBulkRequest() { $handler = DefaultHandler\Factory::make(); $this->assertTrue($handler instanceof DefaultHandler); } - public function test_getListHooksRegistered_shouldListenToInitRequestSetEventAndInit_IfBulkRequest() + public function test_registerEvents_shouldListenToInitRequestSetEventAndInit_IfBulkRequest() { $this->injectRawDataToBulk($this->getDummyRequest()); diff --git a/plugins/Contents/Contents.php b/plugins/Contents/Contents.php index 21bebd9c04..10536930af 100644 --- a/plugins/Contents/Contents.php +++ b/plugins/Contents/Contents.php @@ -11,9 +11,9 @@ namespace Piwik\Plugins\Contents; class Contents extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'Metrics.getDefaultMetricTranslations' => 'addMetricTranslations', diff --git a/plugins/CoreAdminHome/CoreAdminHome.php b/plugins/CoreAdminHome/CoreAdminHome.php index 4c0c1c3fc3..75f1230cd6 100644 --- a/plugins/CoreAdminHome/CoreAdminHome.php +++ b/plugins/CoreAdminHome/CoreAdminHome.php @@ -18,9 +18,9 @@ use Piwik\Settings\UserSetting; class CoreAdminHome extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', diff --git a/plugins/CoreHome/CoreHome.php b/plugins/CoreHome/CoreHome.php index f28a2c7f8e..45a3dde104 100644 --- a/plugins/CoreHome/CoreHome.php +++ b/plugins/CoreHome/CoreHome.php @@ -14,9 +14,9 @@ namespace Piwik\Plugins\CoreHome; class CoreHome extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', diff --git a/plugins/CoreHome/templates/_dataTableFooter.twig b/plugins/CoreHome/templates/_dataTableFooter.twig index 39ad2b0da0..7401baee10 100644 --- a/plugins/CoreHome/templates/_dataTableFooter.twig +++ b/plugins/CoreHome/templates/_dataTableFooter.twig @@ -31,7 +31,7 @@ {% for footerIconGroup in footerIcons %} <div class="tableIconsGroup"> <span class="{{ footerIconGroup.class }}"> - {% for footerIcon in footerIconGroup.buttons %} + {% for footerIcon in footerIconGroup.buttons if footerIcon.icon %} {% set isActiveEcommerceView = clientSideParameters.abandonedCarts is defined and ((footerIcon.id == 'ecommerceOrder' and clientSideParameters.abandonedCarts == 0) or (footerIcon.id == 'ecommerceAbandonedCart' and clientSideParameters.abandonedCarts == 1)) %} diff --git a/plugins/CorePluginsAdmin/CorePluginsAdmin.php b/plugins/CorePluginsAdmin/CorePluginsAdmin.php index f51e214785..6e03b3b46a 100644 --- a/plugins/CorePluginsAdmin/CorePluginsAdmin.php +++ b/plugins/CorePluginsAdmin/CorePluginsAdmin.php @@ -14,9 +14,9 @@ use Piwik\Plugin; class CorePluginsAdmin extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getJavaScriptFiles' => 'getJsFiles', diff --git a/plugins/CoreUpdater/CoreUpdater.php b/plugins/CoreUpdater/CoreUpdater.php index 8fc3f0d92f..737017d048 100644 --- a/plugins/CoreUpdater/CoreUpdater.php +++ b/plugins/CoreUpdater/CoreUpdater.php @@ -26,9 +26,9 @@ use Piwik\Version; class CoreUpdater extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'Request.dispatchCoreAndPluginUpdatesScreen' => 'dispatch', diff --git a/plugins/CoreVisualizations/CoreVisualizations.php b/plugins/CoreVisualizations/CoreVisualizations.php index da8fbe9f94..9a5f88e7ec 100644 --- a/plugins/CoreVisualizations/CoreVisualizations.php +++ b/plugins/CoreVisualizations/CoreVisualizations.php @@ -21,9 +21,9 @@ require_once PIWIK_INCLUDE_PATH . '/plugins/CoreVisualizations/JqplotDataGenerat class CoreVisualizations extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', diff --git a/plugins/CustomVariables/CustomVariables.php b/plugins/CustomVariables/CustomVariables.php index 7a37808909..b8a57ad6a6 100644 --- a/plugins/CustomVariables/CustomVariables.php +++ b/plugins/CustomVariables/CustomVariables.php @@ -16,9 +16,9 @@ use Piwik\Tracker; class CustomVariables extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'API.getSegmentDimensionMetadata' => 'getSegmentsMetadata', diff --git a/plugins/DBStats/DBStats.php b/plugins/DBStats/DBStats.php index 5f16ed8451..e5d6f85647 100644 --- a/plugins/DBStats/DBStats.php +++ b/plugins/DBStats/DBStats.php @@ -18,9 +18,9 @@ class DBStats extends \Piwik\Plugin const TIME_OF_LAST_TASK_RUN_OPTION = 'dbstats_time_of_last_cache_task_run'; /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', diff --git a/plugins/Dashboard/Controller.php b/plugins/Dashboard/Controller.php index afd5e4236e..d77c283273 100644 --- a/plugins/Dashboard/Controller.php +++ b/plugins/Dashboard/Controller.php @@ -212,6 +212,7 @@ class Controller extends \Piwik\Plugin\Controller $this->checkTokenInUrl(); $layout = Common::unsanitizeInputValue(Common::getRequestVar('layout')); + $layout = strip_tags($layout); $idDashboard = Common::getRequestVar('idDashboard', 1, 'int'); $name = Common::getRequestVar('name', '', 'string'); @@ -236,6 +237,7 @@ class Controller extends \Piwik\Plugin\Controller if (Piwik::hasUserSuperUserAccess()) { $layout = Common::unsanitizeInputValue(Common::getRequestVar('layout')); + $layout = strip_tags($layout); $this->getModel()->createOrUpdateDashboard('', '1', $layout); } } diff --git a/plugins/Dashboard/Dashboard.php b/plugins/Dashboard/Dashboard.php index 6febc9b8dd..9ccbb822e4 100644 --- a/plugins/Dashboard/Dashboard.php +++ b/plugins/Dashboard/Dashboard.php @@ -18,9 +18,9 @@ use Piwik\WidgetsList; class Dashboard extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getJavaScriptFiles' => 'getJsFiles', diff --git a/plugins/DevicePlugins/DevicePlugins.php b/plugins/DevicePlugins/DevicePlugins.php index afe8abf950..3ac882e8ce 100644 --- a/plugins/DevicePlugins/DevicePlugins.php +++ b/plugins/DevicePlugins/DevicePlugins.php @@ -18,9 +18,9 @@ use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable; class DevicePlugins extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'Metrics.getDefaultMetricTranslations' => 'addMetricTranslations', diff --git a/plugins/DevicesDetection/DevicesDetection.php b/plugins/DevicesDetection/DevicesDetection.php index 88478e6ff6..5385b29354 100644 --- a/plugins/DevicesDetection/DevicesDetection.php +++ b/plugins/DevicesDetection/DevicesDetection.php @@ -18,9 +18,9 @@ require_once PIWIK_INCLUDE_PATH . '/plugins/DevicesDetection/functions.php'; class DevicesDetection extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'Live.getAllVisitorDetails' => 'extendVisitorDetails' diff --git a/plugins/Events/Events.php b/plugins/Events/Events.php index bb784865f2..ba3e96465d 100644 --- a/plugins/Events/Events.php +++ b/plugins/Events/Events.php @@ -16,9 +16,9 @@ use Piwik\Plugin\ViewDataTable; class Events extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'Metrics.getDefaultMetricDocumentationTranslations' => 'addMetricDocumentationTranslations', diff --git a/plugins/ExampleRssWidget/ExampleRssWidget.php b/plugins/ExampleRssWidget/ExampleRssWidget.php index ec035f36d1..3fd348f80d 100644 --- a/plugins/ExampleRssWidget/ExampleRssWidget.php +++ b/plugins/ExampleRssWidget/ExampleRssWidget.php @@ -14,9 +14,9 @@ namespace Piwik\Plugins\ExampleRssWidget; class ExampleRssWidget extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles' diff --git a/plugins/Feedback/Feedback.php b/plugins/Feedback/Feedback.php index 0bf58287a8..99849ff277 100644 --- a/plugins/Feedback/Feedback.php +++ b/plugins/Feedback/Feedback.php @@ -15,9 +15,9 @@ class Feedback extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', diff --git a/plugins/Goals/Goals.php b/plugins/Goals/Goals.php index 6a2a41566b..d26e2cf77e 100644 --- a/plugins/Goals/Goals.php +++ b/plugins/Goals/Goals.php @@ -86,9 +86,9 @@ class Goals extends \Piwik\Plugin } /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { $hooks = array( 'AssetManager.getJavaScriptFiles' => 'getJsFiles', diff --git a/plugins/ImageGraph/ImageGraph.php b/plugins/ImageGraph/ImageGraph.php index 66c18b3477..5cb1be2e61 100644 --- a/plugins/ImageGraph/ImageGraph.php +++ b/plugins/ImageGraph/ImageGraph.php @@ -31,9 +31,9 @@ class ImageGraph extends \Piwik\Plugin ); /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { $hooks = array( 'API.getReportMetadata.end' => array('function' => 'getReportMetadata', diff --git a/plugins/Insights/Insights.php b/plugins/Insights/Insights.php index 82b515d2aa..9f02d7f17a 100644 --- a/plugins/Insights/Insights.php +++ b/plugins/Insights/Insights.php @@ -13,9 +13,9 @@ namespace Piwik\Plugins\Insights; class Insights extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getJavaScriptFiles' => 'getJsFiles', diff --git a/plugins/Installation/Installation.php b/plugins/Installation/Installation.php index 6a53bec277..47602c8543 100644 --- a/plugins/Installation/Installation.php +++ b/plugins/Installation/Installation.php @@ -26,9 +26,9 @@ class Installation extends \Piwik\Plugin protected $installationControllerName = '\\Piwik\\Plugins\\Installation\\Controller'; /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { $hooks = array( 'Config.NoConfigurationFile' => 'dispatch', diff --git a/plugins/LanguagesManager/LanguagesManager.php b/plugins/LanguagesManager/LanguagesManager.php index 882545f0d8..012de9cd50 100644 --- a/plugins/LanguagesManager/LanguagesManager.php +++ b/plugins/LanguagesManager/LanguagesManager.php @@ -27,9 +27,9 @@ use Piwik\View; class LanguagesManager extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', diff --git a/plugins/LeftMenu/LeftMenu.php b/plugins/LeftMenu/LeftMenu.php index 00b40d9a6f..522965e6b8 100755 --- a/plugins/LeftMenu/LeftMenu.php +++ b/plugins/LeftMenu/LeftMenu.php @@ -11,7 +11,7 @@ namespace Piwik\Plugins\LeftMenu; class LeftMenu extends \Piwik\Plugin { - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getStylesheetFiles' => array('function' => 'getStylesheetFiles', 'after' => true), diff --git a/plugins/Live/Live.php b/plugins/Live/Live.php index 3dbe242b78..93e8d67881 100644 --- a/plugins/Live/Live.php +++ b/plugins/Live/Live.php @@ -10,8 +10,6 @@ namespace Piwik\Plugins\Live; use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable; -require_once PIWIK_INCLUDE_PATH . '/plugins/Live/VisitorLog.php'; - /** * */ @@ -19,9 +17,9 @@ class Live extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getJavaScriptFiles' => 'getJsFiles', diff --git a/plugins/Live/Reports/GetLastVisitsDetails.php b/plugins/Live/Reports/GetLastVisitsDetails.php index c54c97e924..8cf2268d28 100644 --- a/plugins/Live/Reports/GetLastVisitsDetails.php +++ b/plugins/Live/Reports/GetLastVisitsDetails.php @@ -10,7 +10,7 @@ namespace Piwik\Plugins\Live\Reports; use Piwik\Menu\MenuReporting; use Piwik\Plugin\Report; -use Piwik\Plugins\Live\VisitorLog; +use Piwik\Plugins\Live\Visualizations\VisitorLog; use Piwik\WidgetsList; class GetLastVisitsDetails extends Base diff --git a/plugins/Live/Reports/GetSimpleLastVisitCount.php b/plugins/Live/Reports/GetSimpleLastVisitCount.php index d018f83f0d..9b0db30769 100644 --- a/plugins/Live/Reports/GetSimpleLastVisitCount.php +++ b/plugins/Live/Reports/GetSimpleLastVisitCount.php @@ -13,7 +13,6 @@ use Piwik\Metrics\Formatter; use Piwik\Piwik; use Piwik\Plugin\Report; use Piwik\Plugins\Live\Controller; -use Piwik\Plugins\Live\VisitorLog; use Piwik\API\Request; use Piwik\View; diff --git a/plugins/Live/Visitor.php b/plugins/Live/Visitor.php index edafacd896..341ac590c9 100644 --- a/plugins/Live/Visitor.php +++ b/plugins/Live/Visitor.php @@ -383,7 +383,6 @@ class Visitor implements VisitorInterface } $actions = array_merge($actionDetails, $goalDetails, $ecommerceDetails); - usort($actions, array('static', 'sortByServerTime')); foreach ($actions as &$action) { diff --git a/plugins/Live/VisitorLog.php b/plugins/Live/Visualizations/VisitorLog.php index 6c817f5b2d..8c8c1e8139 100644 --- a/plugins/Live/VisitorLog.php +++ b/plugins/Live/Visualizations/VisitorLog.php @@ -6,10 +6,11 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later * */ -namespace Piwik\Plugins\Live; +namespace Piwik\Plugins\Live\Visualizations; use Piwik\Common; use Piwik\Piwik; +use Piwik\Plugin\ViewDataTable; use Piwik\Plugin\Visualization; use Piwik\View; @@ -20,8 +21,10 @@ use Piwik\View; */ class VisitorLog extends Visualization { - const ID = 'Piwik\Plugins\Live\VisitorLog'; + const ID = 'VisitorLog'; const TEMPLATE_FILE = "@Live/_dataTableViz_visitorLog.twig"; + const FOOTER_ICON_TITLE = ''; + const FOOTER_ICON = ''; public static function getDefaultConfig() { @@ -90,4 +93,9 @@ class VisitorLog extends Visualization ) ); } + + public static function canDisplayViewDataTable(ViewDataTable $view) + { + return ($view->requestConfig->getApiModuleToRequest() === 'Live'); + } } diff --git a/plugins/Live/VisitorLog/Config.php b/plugins/Live/Visualizations/VisitorLog/Config.php index 42a09b50ca..e7bc817a00 100644 --- a/plugins/Live/VisitorLog/Config.php +++ b/plugins/Live/Visualizations/VisitorLog/Config.php @@ -7,7 +7,7 @@ * */ -namespace Piwik\Plugins\Live\VisitorLog; +namespace Piwik\Plugins\Live\Visualizations\VisitorLog; use Piwik\ViewDataTable\Config as VisualizationConfig; diff --git a/plugins/Login/Login.php b/plugins/Login/Login.php index b054b567b0..8ee66623eb 100644 --- a/plugins/Login/Login.php +++ b/plugins/Login/Login.php @@ -23,9 +23,9 @@ use Piwik\Session; class Login extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { $hooks = array( 'Request.initAuthenticationObject' => 'initAuthenticationObject', diff --git a/plugins/MobileMessaging/MobileMessaging.php b/plugins/MobileMessaging/MobileMessaging.php index ed57c259f9..5db3a3a571 100644 --- a/plugins/MobileMessaging/MobileMessaging.php +++ b/plugins/MobileMessaging/MobileMessaging.php @@ -61,9 +61,9 @@ class MobileMessaging extends \Piwik\Plugin ); /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getJavaScriptFiles' => 'getJsFiles', diff --git a/plugins/MultiSites/MultiSites.php b/plugins/MultiSites/MultiSites.php index 60828e2df2..1fb90cfeae 100644 --- a/plugins/MultiSites/MultiSites.php +++ b/plugins/MultiSites/MultiSites.php @@ -13,9 +13,9 @@ use Piwik\Piwik; class MultiSites extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', diff --git a/plugins/Overlay/Overlay.php b/plugins/Overlay/Overlay.php index af13ae2f6c..329db936eb 100644 --- a/plugins/Overlay/Overlay.php +++ b/plugins/Overlay/Overlay.php @@ -12,9 +12,9 @@ namespace Piwik\Plugins\Overlay; class Overlay extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - function getListHooksRegistered() + function registerEvents() { return array( 'AssetManager.getJavaScriptFiles' => 'getJsFiles', diff --git a/plugins/PrivacyManager/PrivacyManager.php b/plugins/PrivacyManager/PrivacyManager.php index b04799a934..5c4ec03ad2 100644 --- a/plugins/PrivacyManager/PrivacyManager.php +++ b/plugins/PrivacyManager/PrivacyManager.php @@ -130,9 +130,9 @@ class PrivacyManager extends Plugin } /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getJavaScriptFiles' => 'getJsFiles', diff --git a/plugins/Provider/Provider.php b/plugins/Provider/Provider.php index 38707c5cb1..1fb5385651 100644 --- a/plugins/Provider/Provider.php +++ b/plugins/Provider/Provider.php @@ -18,9 +18,9 @@ use Piwik\Piwik; class Provider extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'Live.getAllVisitorDetails' => 'extendVisitorDetails' diff --git a/plugins/Referrers/Controller.php b/plugins/Referrers/Controller.php index efd1820d44..c628af7a83 100644 --- a/plugins/Referrers/Controller.php +++ b/plugins/Referrers/Controller.php @@ -310,7 +310,7 @@ class Controller extends \Piwik\Plugin\Controller // HTML $api = SettingsPiwik::getPiwikUrl() . '?module=API&method=Referrers.getKeywordsForPageUrl' - . '&format=php' + . '&format=json' . '&filter_limit=10' . '&token_auth=' . Piwik::getCurrentUserTokenAuth(); @@ -325,7 +325,8 @@ function DisplayTopKeywords($url = "") // Get the Keywords data $url = empty($url) ? "http://". $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] : $url; $api = "' . $api . '&url=" . urlencode($url); - $keywords = @unserialize(file_get_contents($api)); + $keywords = @json_decode(file_get_contents($api), $assoc = true); + Common::sendHeader(\'Content-Type: text/html; charset=utf-8\', true); if ($keywords === false || isset($keywords["result"])) { // DEBUG ONLY: uncomment for troubleshooting an empty output (the URL output reveals the token_auth) // echo "Error while fetching the <a href=\'$api\'>Top Keywords from Piwik</a>"; @@ -362,7 +363,8 @@ function DisplayTopKeywords($url = "") // Get the Keywords data $url = empty($url) ? "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] : $url; $api = $api . "&url=" . urlencode($url); - $keywords = @unserialize(file_get_contents($api)); + $keywords = @json_decode(file_get_contents($api), $assoc = true); + Common::sendHeader('Content-Type: text/html; charset=utf-8', true); if ($keywords === false || isset($keywords["result"])) { // DEBUG ONLY: uncomment for troubleshooting an empty output (the URL output reveals the token_auth) //echo "Error while fetching the <a href=\'".$api."\'>Top Keywords from Piwik</a>"; diff --git a/plugins/Referrers/Referrers.php b/plugins/Referrers/Referrers.php index cefa27bef8..ce8667929b 100644 --- a/plugins/Referrers/Referrers.php +++ b/plugins/Referrers/Referrers.php @@ -23,9 +23,9 @@ require_once PIWIK_INCLUDE_PATH . '/plugins/Referrers/functions.php'; class Referrers extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'Insights.addReportToOverview' => 'addReportToInsightsOverview', diff --git a/plugins/Resolution/Resolution.php b/plugins/Resolution/Resolution.php index 49b2d3a9a6..5ab7692ccf 100644 --- a/plugins/Resolution/Resolution.php +++ b/plugins/Resolution/Resolution.php @@ -17,9 +17,9 @@ use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable; class Resolution extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'Live.getAllVisitorDetails' => 'extendVisitorDetails', diff --git a/plugins/ScheduledReports/ScheduledReports.php b/plugins/ScheduledReports/ScheduledReports.php index 9876ad0ed7..c66a6ad0d6 100644 --- a/plugins/ScheduledReports/ScheduledReports.php +++ b/plugins/ScheduledReports/ScheduledReports.php @@ -71,9 +71,9 @@ class ScheduledReports extends \Piwik\Plugin const OPTION_KEY_LAST_SENT_DATERANGE = 'report_last_sent_daterange_'; /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getJavaScriptFiles' => 'getJsFiles', diff --git a/plugins/SegmentEditor/SegmentEditor.php b/plugins/SegmentEditor/SegmentEditor.php index 4ed59a4a7b..9107935e73 100644 --- a/plugins/SegmentEditor/SegmentEditor.php +++ b/plugins/SegmentEditor/SegmentEditor.php @@ -18,9 +18,9 @@ use Piwik\Version; class SegmentEditor extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'Segments.getKnownSegmentsToArchiveForSite' => 'getKnownSegmentsToArchiveForSite', diff --git a/plugins/SitesManager/SitesManager.php b/plugins/SitesManager/SitesManager.php index 16c330d6c1..cd37b6e63b 100644 --- a/plugins/SitesManager/SitesManager.php +++ b/plugins/SitesManager/SitesManager.php @@ -26,9 +26,9 @@ class SitesManager extends \Piwik\Plugin const KEEP_URL_FRAGMENT_NO = 2; /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getJavaScriptFiles' => 'getJsFiles', diff --git a/plugins/Transitions/Transitions.php b/plugins/Transitions/Transitions.php index 473ab7c647..c1c10d8b81 100644 --- a/plugins/Transitions/Transitions.php +++ b/plugins/Transitions/Transitions.php @@ -14,9 +14,9 @@ namespace Piwik\Plugins\Transitions; class Transitions extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', diff --git a/plugins/UserCountry/UserCountry.php b/plugins/UserCountry/UserCountry.php index d28e6ce601..d0ea7fab1b 100644 --- a/plugins/UserCountry/UserCountry.php +++ b/plugins/UserCountry/UserCountry.php @@ -28,9 +28,9 @@ require_once PIWIK_INCLUDE_PATH . '/plugins/UserCountry/GeoIPAutoUpdater.php'; class UserCountry extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', diff --git a/plugins/UserCountryMap/UserCountryMap.php b/plugins/UserCountryMap/UserCountryMap.php index d351054b45..c7819f7f8c 100644 --- a/plugins/UserCountryMap/UserCountryMap.php +++ b/plugins/UserCountryMap/UserCountryMap.php @@ -29,7 +29,7 @@ class UserCountryMap extends \Piwik\Plugin $out .= FrontController::getInstance()->fetchDispatch('UserCountryMap', 'visitorMap'); } - public function getListHooksRegistered() + public function registerEvents() { $hooks = array( 'AssetManager.getJavaScriptFiles' => 'getJsFiles', diff --git a/plugins/UserLanguage/UserLanguage.php b/plugins/UserLanguage/UserLanguage.php index a28bfa6eca..be892d4196 100644 --- a/plugins/UserLanguage/UserLanguage.php +++ b/plugins/UserLanguage/UserLanguage.php @@ -17,9 +17,9 @@ use Piwik\FrontController; class UserLanguage extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'Live.getAllVisitorDetails' => 'extendVisitorDetails' diff --git a/plugins/UsersManager/UsersManager.php b/plugins/UsersManager/UsersManager.php index 8bfd20c2fc..340f081b5f 100644 --- a/plugins/UsersManager/UsersManager.php +++ b/plugins/UsersManager/UsersManager.php @@ -24,9 +24,9 @@ class UsersManager extends \Piwik\Plugin const PASSWORD_MAX_LENGTH = 80; /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getJavaScriptFiles' => 'getJsFiles', diff --git a/plugins/VisitFrequency/VisitFrequency.php b/plugins/VisitFrequency/VisitFrequency.php index ad7451e0ce..b8c01a9568 100644 --- a/plugins/VisitFrequency/VisitFrequency.php +++ b/plugins/VisitFrequency/VisitFrequency.php @@ -14,9 +14,9 @@ use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable; class VisitFrequency extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'Metrics.getDefaultMetricTranslations' => 'addMetricTranslations' diff --git a/plugins/VisitTime/VisitTime.php b/plugins/VisitTime/VisitTime.php index 08b7ad36e5..5b1c256ce7 100644 --- a/plugins/VisitTime/VisitTime.php +++ b/plugins/VisitTime/VisitTime.php @@ -12,9 +12,9 @@ namespace Piwik\Plugins\VisitTime; class VisitTime extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'Live.getAllVisitorDetails' => 'extendVisitorDetails', diff --git a/plugins/VisitorInterest/VisitorInterest.php b/plugins/VisitorInterest/VisitorInterest.php index 11d5f717c4..f135e12923 100644 --- a/plugins/VisitorInterest/VisitorInterest.php +++ b/plugins/VisitorInterest/VisitorInterest.php @@ -19,9 +19,9 @@ class VisitorInterest extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'Live.getAllVisitorDetails' => 'extendVisitorDetails', diff --git a/plugins/VisitsSummary/VisitsSummary.php b/plugins/VisitsSummary/VisitsSummary.php index f0e7215aac..9bb86de374 100644 --- a/plugins/VisitsSummary/VisitsSummary.php +++ b/plugins/VisitsSummary/VisitsSummary.php @@ -21,9 +21,9 @@ use Piwik\Plugins\VisitsSummary\Reports\Get; class VisitsSummary extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', diff --git a/plugins/Widgetize/Widgetize.php b/plugins/Widgetize/Widgetize.php index 02a520dcd2..750686c6f9 100644 --- a/plugins/Widgetize/Widgetize.php +++ b/plugins/Widgetize/Widgetize.php @@ -13,9 +13,9 @@ namespace Piwik\Plugins\Widgetize; class Widgetize extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getJavaScriptFiles' => 'getJsFiles', diff --git a/plugins/ZenMode/ZenMode.php b/plugins/ZenMode/ZenMode.php index d22ad4af9d..bbacb157c3 100644 --- a/plugins/ZenMode/ZenMode.php +++ b/plugins/ZenMode/ZenMode.php @@ -13,9 +13,9 @@ namespace Piwik\Plugins\ZenMode; class ZenMode extends \Piwik\Plugin { /** - * @see Piwik\Plugin::getListHooksRegistered + * @see Piwik\Plugin::registerEvents */ - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getJavaScriptFiles' => 'getJsFiles', diff --git a/tests/PHPUnit/Unit/AssetManager/PluginMock.php b/tests/PHPUnit/Unit/AssetManager/PluginMock.php index c29c03dd67..9755facf49 100644 --- a/tests/PHPUnit/Unit/AssetManager/PluginMock.php +++ b/tests/PHPUnit/Unit/AssetManager/PluginMock.php @@ -45,7 +45,7 @@ class PluginMock extends Plugin $this->pluginName = $name; } - public function getListHooksRegistered() + public function registerEvents() { return array( 'AssetManager.getJavaScriptFiles' => 'getJsFiles', diff --git a/tests/PHPUnit/Unit/DeprecatedMethodsTest.php b/tests/PHPUnit/Unit/DeprecatedMethodsTest.php index a35a260b7c..442280cb8d 100644 --- a/tests/PHPUnit/Unit/DeprecatedMethodsTest.php +++ b/tests/PHPUnit/Unit/DeprecatedMethodsTest.php @@ -69,6 +69,7 @@ class DeprecatedMethodsTest extends \PHPUnit_Framework_TestCase $this->assertDeprecatedMethodIsRemovedInPiwik3('\Piwik\Menu\MenuAbstract', 'add'); $this->assertDeprecatedMethodIsRemovedInPiwik3('\Piwik\Archive', 'getDataTableFromArchive'); + $this->assertDeprecatedMethodIsRemovedInPiwik3('\Piwik\Plugin', 'getListHooksRegistered'); } private function assertDeprecatedMethodIsRemoved($className, $method, $removalDate) |