Permalink
Browse files

refs #8565 #8503 #8567 refactored/removed some code to not use deprec…

…ated APIs / events for 3.0
  • Loading branch information...
1 parent c983e4f commit 65353d7bac8a90bf05545c0ecd693d81b684f9e2 @tsteur tsteur committed Sep 9, 2015
Showing with 132 additions and 115 deletions.
  1. +2 −0 CHANGELOG.md
  2. +13 −3 core/Plugin.php
  3. +0 −4 core/ViewDataTable/Factory.php
  4. +2 −2 plugins/API/API.php
  5. +2 −2 plugins/Actions/Actions.php
  6. +2 −2 plugins/Annotations/Annotations.php
  7. +2 −2 plugins/BulkTracking/BulkTracking.php
  8. +3 −3 plugins/BulkTracking/tests/Integration/BulkTrackingTest.php
  9. +2 −2 plugins/Contents/Contents.php
  10. +2 −2 plugins/CoreAdminHome/CoreAdminHome.php
  11. +2 −2 plugins/CoreHome/CoreHome.php
  12. +1 −1 plugins/CoreHome/templates/_dataTableFooter.twig
  13. +2 −2 plugins/CorePluginsAdmin/CorePluginsAdmin.php
  14. +2 −2 plugins/CoreUpdater/CoreUpdater.php
  15. +2 −2 plugins/CoreVisualizations/CoreVisualizations.php
  16. +2 −2 plugins/CustomVariables/CustomVariables.php
  17. +2 −2 plugins/DBStats/DBStats.php
  18. +2 −0 plugins/Dashboard/Controller.php
  19. +2 −2 plugins/Dashboard/Dashboard.php
  20. +2 −2 plugins/DevicePlugins/DevicePlugins.php
  21. +2 −2 plugins/DevicesDetection/DevicesDetection.php
  22. +2 −2 plugins/Events/Events.php
  23. +2 −2 plugins/ExampleRssWidget/ExampleRssWidget.php
  24. +2 −2 plugins/Feedback/Feedback.php
  25. +2 −2 plugins/Goals/Goals.php
  26. +2 −2 plugins/ImageGraph/ImageGraph.php
  27. +2 −2 plugins/Insights/Insights.php
  28. +2 −2 plugins/Installation/Installation.php
  29. +2 −2 plugins/LanguagesManager/LanguagesManager.php
  30. +1 −1 plugins/LeftMenu/LeftMenu.php
  31. +2 −4 plugins/Live/Live.php
  32. +1 −1 plugins/Live/Reports/GetLastVisitsDetails.php
  33. +0 −1 plugins/Live/Reports/GetSimpleLastVisitCount.php
  34. +0 −1 plugins/Live/Visitor.php
  35. +10 −2 plugins/Live/{ → Visualizations}/VisitorLog.php
  36. +1 −1 plugins/Live/{ → Visualizations}/VisitorLog/Config.php
  37. +2 −2 plugins/Login/Login.php
  38. +2 −2 plugins/MobileMessaging/MobileMessaging.php
  39. +2 −2 plugins/MultiSites/MultiSites.php
  40. +2 −2 plugins/Overlay/Overlay.php
  41. +2 −2 plugins/PrivacyManager/PrivacyManager.php
  42. +2 −2 plugins/Provider/Provider.php
  43. +5 −3 plugins/Referrers/Controller.php
  44. +2 −2 plugins/Referrers/Referrers.php
  45. +2 −2 plugins/Resolution/Resolution.php
  46. +2 −2 plugins/ScheduledReports/ScheduledReports.php
  47. +2 −2 plugins/SegmentEditor/SegmentEditor.php
  48. +2 −2 plugins/SitesManager/SitesManager.php
  49. +2 −2 plugins/Transitions/Transitions.php
  50. +2 −2 plugins/UserCountry/UserCountry.php
  51. +1 −1 plugins/UserCountryMap/UserCountryMap.php
  52. +2 −2 plugins/UserLanguage/UserLanguage.php
  53. +2 −2 plugins/UsersManager/UsersManager.php
  54. +2 −2 plugins/VisitFrequency/VisitFrequency.php
  55. +2 −2 plugins/VisitTime/VisitTime.php
  56. +2 −2 plugins/VisitorInterest/VisitorInterest.php
  57. +2 −2 plugins/VisitsSummary/VisitsSummary.php
  58. +2 −2 plugins/Widgetize/Widgetize.php
  59. +2 −2 plugins/ZenMode/ZenMode.php
  60. +1 −1 tests/PHPUnit/Unit/AssetManager/PluginMock.php
  61. +1 −0 tests/PHPUnit/Unit/DeprecatedMethodsTest.php
View
@@ -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'])`
View
@@ -56,7 +56,7 @@
*
* class MyPlugin extends Plugin
* {
- * public function getListHooksRegistered()
+ * public function registerEvents()
* {
* return array(
* 'API.getReportMetadata' => 'getReportMetadata',
@@ -192,7 +192,7 @@ public function getInformation()
}
/**
- * 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 @@ public function getInformation()
* '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.
*/
@@ -146,10 +146,6 @@ public static function build($defaultType = null, $apiAction = false, $controlle
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);
}
View
@@ -589,9 +589,9 @@ public function __construct()
}
/**
- * @see Piwik\Plugin::getListHooksRegistered
+ * @see Piwik\Plugin::registerEvents
*/
- public function getListHooksRegistered()
+ public function registerEvents()
{
return array(
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles'
@@ -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',
@@ -16,9 +16,9 @@
class Annotations extends \Piwik\Plugin
{
/**
- * @see Piwik\Plugin::getListHooksRegistered
+ * @see Piwik\Plugin::registerEvents
*/
- public function getListHooksRegistered()
+ public function registerEvents()
{
return array(
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
@@ -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',
@@ -118,7 +118,7 @@ public function test_setHandlerIfBulkRequest_shouldNotSetAHandler_IfItIsNotABulk
$this->assertNull($handler);
}
- public function test_getListHooksRegistered_shouldListenToNewTrackerEventAndCreateBulkHandler_IfBulkRequest()
+ public function test_registerEvents_shouldListenToNewTrackerEventAndCreateBulkHandler_IfBulkRequest()
{
$this->injectRawDataToBulk($this->getDummyRequest());
@@ -127,14 +127,14 @@ public function test_getListHooksRegistered_shouldListenToNewTrackerEventAndCrea
$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());
@@ -11,9 +11,9 @@
class Contents extends \Piwik\Plugin
{
/**
- * @see Piwik\Plugin::getListHooksRegistered
+ * @see Piwik\Plugin::registerEvents
*/
- public function getListHooksRegistered()
+ public function registerEvents()
{
return array(
'Metrics.getDefaultMetricTranslations' => 'addMetricTranslations',
@@ -18,9 +18,9 @@
class CoreAdminHome extends \Piwik\Plugin
{
/**
- * @see Piwik\Plugin::getListHooksRegistered
+ * @see Piwik\Plugin::registerEvents
*/
- public function getListHooksRegistered()
+ public function registerEvents()
{
return array(
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
@@ -14,9 +14,9 @@
class CoreHome extends \Piwik\Plugin
{
/**
- * @see Piwik\Plugin::getListHooksRegistered
+ * @see Piwik\Plugin::registerEvents
*/
- public function getListHooksRegistered()
+ public function registerEvents()
{
return array(
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
@@ -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)) %}
@@ -14,9 +14,9 @@
class CorePluginsAdmin extends \Piwik\Plugin
{
/**
- * @see Piwik\Plugin::getListHooksRegistered
+ * @see Piwik\Plugin::registerEvents
*/
- public function getListHooksRegistered()
+ public function registerEvents()
{
return array(
'AssetManager.getJavaScriptFiles' => 'getJsFiles',
@@ -26,9 +26,9 @@
class CoreUpdater extends \Piwik\Plugin
{
/**
- * @see Piwik\Plugin::getListHooksRegistered
+ * @see Piwik\Plugin::registerEvents
*/
- public function getListHooksRegistered()
+ public function registerEvents()
{
return array(
'Request.dispatchCoreAndPluginUpdatesScreen' => 'dispatch',
@@ -21,9 +21,9 @@
class CoreVisualizations extends \Piwik\Plugin
{
/**
- * @see Piwik\Plugin::getListHooksRegistered
+ * @see Piwik\Plugin::registerEvents
*/
- public function getListHooksRegistered()
+ public function registerEvents()
{
return array(
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
@@ -16,9 +16,9 @@
class CustomVariables extends \Piwik\Plugin
{
/**
- * @see Piwik\Plugin::getListHooksRegistered
+ * @see Piwik\Plugin::registerEvents
*/
- public function getListHooksRegistered()
+ public function registerEvents()
{
return array(
'API.getSegmentDimensionMetadata' => 'getSegmentsMetadata',
@@ -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',
@@ -212,6 +212,7 @@ public function saveLayout()
$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 @@ public function saveLayoutAsDefault()
if (Piwik::hasUserSuperUserAccess()) {
$layout = Common::unsanitizeInputValue(Common::getRequestVar('layout'));
+ $layout = strip_tags($layout);
$this->getModel()->createOrUpdateDashboard('', '1', $layout);
}
}
@@ -18,9 +18,9 @@
class Dashboard extends \Piwik\Plugin
{
/**
- * @see Piwik\Plugin::getListHooksRegistered
+ * @see Piwik\Plugin::registerEvents
*/
- public function getListHooksRegistered()
+ public function registerEvents()
{
return array(
'AssetManager.getJavaScriptFiles' => 'getJsFiles',
@@ -18,9 +18,9 @@
class DevicePlugins extends \Piwik\Plugin
{
/**
- * @see Piwik\Plugin::getListHooksRegistered
+ * @see Piwik\Plugin::registerEvents
*/
- public function getListHooksRegistered()
+ public function registerEvents()
{
return array(
'Metrics.getDefaultMetricTranslations' => 'addMetricTranslations',
@@ -18,9 +18,9 @@
class DevicesDetection extends \Piwik\Plugin
{
/**
- * @see Piwik\Plugin::getListHooksRegistered
+ * @see Piwik\Plugin::registerEvents
*/
- public function getListHooksRegistered()
+ public function registerEvents()
{
return array(
'Live.getAllVisitorDetails' => 'extendVisitorDetails'
@@ -16,9 +16,9 @@
class Events extends \Piwik\Plugin
{
/**
- * @see Piwik\Plugin::getListHooksRegistered
+ * @see Piwik\Plugin::registerEvents
*/
- public function getListHooksRegistered()
+ public function registerEvents()
{
return array(
'Metrics.getDefaultMetricDocumentationTranslations' => 'addMetricDocumentationTranslations',
@@ -14,9 +14,9 @@
class ExampleRssWidget extends \Piwik\Plugin
{
/**
- * @see Piwik\Plugin::getListHooksRegistered
+ * @see Piwik\Plugin::registerEvents
*/
- public function getListHooksRegistered()
+ public function registerEvents()
{
return array(
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles'
@@ -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',
View
@@ -86,9 +86,9 @@ public static function getGoalColumns($idGoal)
}
/**
- * @see Piwik\Plugin::getListHooksRegistered
+ * @see Piwik\Plugin::registerEvents
*/
- public function getListHooksRegistered()
+ public function registerEvents()
{
$hooks = array(
'AssetManager.getJavaScriptFiles' => 'getJsFiles',
@@ -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',
@@ -13,9 +13,9 @@
class Insights extends \Piwik\Plugin
{
/**
- * @see Piwik\Plugin::getListHooksRegistered
+ * @see Piwik\Plugin::registerEvents
*/
- public function getListHooksRegistered()
+ public function registerEvents()
{
return array(
'AssetManager.getJavaScriptFiles' => 'getJsFiles',
@@ -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',
@@ -27,9 +27,9 @@
class LanguagesManager extends \Piwik\Plugin
{
/**
- * @see Piwik\Plugin::getListHooksRegistered
+ * @see Piwik\Plugin::registerEvents
*/
- public function getListHooksRegistered()
+ public function registerEvents()
{
return array(
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
Oops, something went wrong.

0 comments on commit 65353d7

Please sign in to comment.