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:
authorStefan Giehl <stefan@piwik.org>2018-03-23 02:51:24 +0300
committerMatthieu Aubry <mattab@users.noreply.github.com>2018-03-23 02:51:24 +0300
commitc61018b5b4676b9e0f5b500cca592007c22c1153 (patch)
tree1b4b70ff84b632a6713507209da68c6b61b99861 /plugins/RssWidget
parent4ed366ae6ec2697c525943395499b3dcb51dc2aa (diff)
Hide widgets not working without internet connection if disabled in config (#12279)
* Hide SEO rankings widget if internet is disabled in config * Hide RSS widgets if internet is disabled in config * Remove more wirdgets when internet connection disabled * Adjust widgets to remove after rename to Matomo * Code improvements
Diffstat (limited to 'plugins/RssWidget')
-rw-r--r--plugins/RssWidget/RssWidget.php18
-rw-r--r--plugins/RssWidget/Widgets/RssChangelog.php14
-rw-r--r--plugins/RssWidget/Widgets/RssPiwik.php14
3 files changed, 41 insertions, 5 deletions
diff --git a/plugins/RssWidget/RssWidget.php b/plugins/RssWidget/RssWidget.php
index 03f2af97d9..45c49617bd 100644
--- a/plugins/RssWidget/RssWidget.php
+++ b/plugins/RssWidget/RssWidget.php
@@ -7,6 +7,10 @@
*
*/
namespace Piwik\Plugins\RssWidget;
+use Piwik\Plugins\RssWidget\Widgets\RssChangelog;
+use Piwik\Plugins\RssWidget\Widgets\RssPiwik;
+use Piwik\SettingsPiwik;
+use Piwik\Widget\WidgetsList;
/**
*
@@ -14,13 +18,14 @@ namespace Piwik\Plugins\RssWidget;
class RssWidget extends \Piwik\Plugin
{
/**
- * @see Piwik\Plugin::registerEvents
+ * @see \Piwik\Plugin::registerEvents
*/
public function registerEvents()
{
return array(
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
'Request.getRenamedModuleAndAction' => 'renameExampleRssWidgetModule',
+ 'Widget.filterWidgets' => 'filterWidgets'
);
}
@@ -35,4 +40,15 @@ class RssWidget extends \Piwik\Plugin
$module = 'RssWidget';
}
}
+
+ /**
+ * @param WidgetsList $list
+ */
+ public function filterWidgets($list)
+ {
+ if (!SettingsPiwik::isInternetEnabled()) {
+ $list->remove(RssChangelog::getCategory(), RssChangelog::getName());
+ $list->remove(RssPiwik::getCategory(), RssPiwik::getName());
+ }
+ }
}
diff --git a/plugins/RssWidget/Widgets/RssChangelog.php b/plugins/RssWidget/Widgets/RssChangelog.php
index 9a58d0c367..6b5d13e81d 100644
--- a/plugins/RssWidget/Widgets/RssChangelog.php
+++ b/plugins/RssWidget/Widgets/RssChangelog.php
@@ -14,10 +14,20 @@ use Piwik\Plugins\RssWidget\RssRenderer;
class RssChangelog extends \Piwik\Widget\Widget
{
+ public static function getCategory()
+ {
+ return 'About Matomo';
+ }
+
+ public static function getName()
+ {
+ return 'Matomo Changelog';
+ }
+
public static function configure(WidgetConfig $config)
{
- $config->setCategoryId('About Matomo');
- $config->setName('Matomo Changelog');
+ $config->setCategoryId(self::getCategory());
+ $config->setName(self::getName());
}
private function getFeed($URL) {
diff --git a/plugins/RssWidget/Widgets/RssPiwik.php b/plugins/RssWidget/Widgets/RssPiwik.php
index 2234488c49..68a1bf310c 100644
--- a/plugins/RssWidget/Widgets/RssPiwik.php
+++ b/plugins/RssWidget/Widgets/RssPiwik.php
@@ -14,10 +14,20 @@ use Piwik\Plugins\RssWidget\RssRenderer;
class RssPiwik extends \Piwik\Widget\Widget
{
+ public static function getCategory()
+ {
+ return 'About Matomo';
+ }
+
+ public static function getName()
+ {
+ return 'Matomo.org Blog';
+ }
+
public static function configure(WidgetConfig $config)
{
- $config->setCategoryId('About Matomo');
- $config->setName('Matomo.org Blog');
+ $config->setCategoryId(self::getCategory());
+ $config->setName(self::getName());
}
private function getFeed($URL){