Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
refs #8565 #8503 #8567 refactored/removed some code to not use deprec…
…ated APIs / events for 3.0
  • Loading branch information
tsteur committed Sep 9, 2015
1 parent c983e4f commit 65353d7
Show file tree
Hide file tree
Showing 61 changed files with 132 additions and 115 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -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`
Expand All @@ -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'])`
Expand Down
16 changes: 13 additions & 3 deletions core/Plugin.php
Expand Up @@ -56,7 +56,7 @@
*
* class MyPlugin extends Plugin
* {
* public function getListHooksRegistered()
* public function registerEvents()
* {
* return array(
* 'API.getReportMetadata' => 'getReportMetadata',
Expand Down Expand Up @@ -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.
*
Expand All @@ -209,12 +209,22 @@ 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.
Expand Down
4 changes: 0 additions & 4 deletions core/ViewDataTable/Factory.php
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/API/API.php
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions plugins/Actions/Actions.php
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions plugins/Annotations/Annotations.php
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions plugins/BulkTracking/BulkTracking.php
Expand Up @@ -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',
Expand Down
6 changes: 3 additions & 3 deletions plugins/BulkTracking/tests/Integration/BulkTrackingTest.php
Expand Up @@ -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());

Expand All @@ -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());

Expand Down
4 changes: 2 additions & 2 deletions plugins/Contents/Contents.php
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions plugins/CoreAdminHome/CoreAdminHome.php
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions plugins/CoreHome/CoreHome.php
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion plugins/CoreHome/templates/_dataTableFooter.twig
Expand Up @@ -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)) %}
Expand Down
4 changes: 2 additions & 2 deletions plugins/CorePluginsAdmin/CorePluginsAdmin.php
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions plugins/CoreUpdater/CoreUpdater.php
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions plugins/CoreVisualizations/CoreVisualizations.php
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions plugins/CustomVariables/CustomVariables.php
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions plugins/DBStats/DBStats.php
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions plugins/Dashboard/Controller.php
Expand Up @@ -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');

Expand All @@ -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);
}
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/Dashboard/Dashboard.php
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions plugins/DevicePlugins/DevicePlugins.php
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions plugins/DevicesDetection/DevicesDetection.php
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions plugins/Events/Events.php
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions plugins/ExampleRssWidget/ExampleRssWidget.php
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions plugins/Feedback/Feedback.php
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions plugins/Goals/Goals.php
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions plugins/ImageGraph/ImageGraph.php
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions plugins/Insights/Insights.php
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions plugins/Installation/Installation.php
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions plugins/LanguagesManager/LanguagesManager.php
Expand Up @@ -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',
Expand Down

0 comments on commit 65353d7

Please sign in to comment.