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
path: root/core
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@googlemail.com>2014-06-06 07:50:06 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-06-06 07:50:06 +0400
commitbedfa1c9de069801d58de9642c92f8681c69d7bb (patch)
tree7abafc84eb446736dbe9df5f6c5e8d7b4d7aaf1f /core
parentb457fcc96885ae6a33896be4f1e98aec9efaf0fa (diff)
working on simplifying widgets. Pushing into a branch since I am not 100% happy with it yet.
Diffstat (limited to 'core')
-rw-r--r--core/Menu/MenuAdmin.php1
-rw-r--r--core/Menu/MenuReporting.php1
-rw-r--r--core/Menu/MenuTop.php1
-rw-r--r--core/Plugin/Widgets.php29
-rw-r--r--core/TaskScheduler.php1
-rw-r--r--core/WidgetsList.php26
6 files changed, 46 insertions, 13 deletions
diff --git a/core/Menu/MenuAdmin.php b/core/Menu/MenuAdmin.php
index 792905cf9b..f0c38c0a0c 100644
--- a/core/Menu/MenuAdmin.php
+++ b/core/Menu/MenuAdmin.php
@@ -59,6 +59,7 @@ class MenuAdmin extends MenuAbstract
/**
* @ignore
+ * @deprecated
*/
Piwik::postEvent('Menu.Admin.addItems', array());
diff --git a/core/Menu/MenuReporting.php b/core/Menu/MenuReporting.php
index 2c5ae297da..08dcc23e82 100644
--- a/core/Menu/MenuReporting.php
+++ b/core/Menu/MenuReporting.php
@@ -63,6 +63,7 @@ class MenuReporting extends MenuAbstract
/**
* @ignore
+ * @deprecated
*/
Piwik::postEvent('Menu.Reporting.addItems', array());
diff --git a/core/Menu/MenuTop.php b/core/Menu/MenuTop.php
index 7a860ef7d6..774fbd652d 100644
--- a/core/Menu/MenuTop.php
+++ b/core/Menu/MenuTop.php
@@ -96,6 +96,7 @@ class MenuTop extends MenuAbstract
/**
* @ignore
+ * @deprecated
*/
Piwik::postEvent('Menu.Top.addItems', array());
diff --git a/core/Plugin/Widgets.php b/core/Plugin/Widgets.php
new file mode 100644
index 0000000000..c2ea16f7cf
--- /dev/null
+++ b/core/Plugin/Widgets.php
@@ -0,0 +1,29 @@
+<?php
+/**
+ * Piwik - Open source web analytics
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ */
+namespace Piwik\Plugin;
+
+use Piwik\WidgetsList;
+
+/**
+ * Base class of all plugin widget providers. Plugins that define their own widgets can extend this class to easily
+ * add new widgets, to remove or to rename existing items.
+ *
+ * For an example, see the {@link https://github.com/piwik/piwik/blob/master/plugins/ExampleRssWidget/Widget.php} plugin.
+ *
+ * @api
+ */
+class Widgets
+{
+ /**
+ * Configures the widgets. Here you can for instance add or remove widgets.
+ */
+ public function configure(WidgetsList $widgetsList)
+ {
+ }
+}
diff --git a/core/TaskScheduler.php b/core/TaskScheduler.php
index 85c71c9ef8..497de8c299 100644
--- a/core/TaskScheduler.php
+++ b/core/TaskScheduler.php
@@ -90,6 +90,7 @@ class TaskScheduler extends Singleton
/**
* @ignore
+ * @deprecated
*/
Piwik::postEvent(self::GET_TASKS_EVENT, array(&$tasks));
diff --git a/core/WidgetsList.php b/core/WidgetsList.php
index bb85a37349..75c75937d8 100644
--- a/core/WidgetsList.php
+++ b/core/WidgetsList.php
@@ -8,6 +8,8 @@
*/
namespace Piwik;
+use Piwik\Plugin\Manager as PluginManager;
+
/**
* Manages the global list of reports that can be displayed as dashboard widgets.
*
@@ -15,8 +17,9 @@ namespace Piwik;
* event. Observers for this event should call the {@link add()} method to add reports.
*
* @api
+ * @method static \Piwik\WidgetsList getInstance()
*/
-class WidgetsList
+class WidgetsList extends Singleton
{
/**
* List of widgets
@@ -71,20 +74,17 @@ class WidgetsList
self::$hookCalled = true;
/**
- * Used to collect all available dashboard widgets.
- *
- * Subscribe to this event to make your plugin's reports or other controller actions available
- * as dashboard widgets. Event handlers should call the {@link WidgetsList::add()} method for each
- * new dashboard widget.
- *
- * **Example**
- *
- * public function addWidgets()
- * {
- * WidgetsList::add('General_Actions', 'General_Pages', 'Actions', 'getPageUrls');
- * }
+ * @ignore
+ * @deprecated
*/
Piwik::postEvent('WidgetsList.addWidgets');
+
+ /** @var \Piwik\Plugin\Widgets[] $widgets */
+ $widgets = PluginManager::getInstance()->findComponents('Widgets', 'Piwik\\Plugin\\Widgets');
+
+ foreach ($widgets as $widget) {
+ $widget->configure(WidgetsList::getInstance());
+ }
}
}