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/SEO
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/SEO')
-rw-r--r--plugins/SEO/SEO.php19
-rw-r--r--plugins/SEO/Widgets/GetRank.php14
2 files changed, 31 insertions, 2 deletions
diff --git a/plugins/SEO/SEO.php b/plugins/SEO/SEO.php
index f5db02ea46..5717aaed36 100644
--- a/plugins/SEO/SEO.php
+++ b/plugins/SEO/SEO.php
@@ -7,9 +7,28 @@
*
*/
namespace Piwik\Plugins\SEO;
+use Piwik\Plugins\SEO\Widgets\GetRank;
+use Piwik\SettingsPiwik;
+use Piwik\Widget\WidgetsList;
/**
*/
class SEO extends \Piwik\Plugin
{
+ public function registerEvents()
+ {
+ return [
+ 'Widget.filterWidgets' => 'filterWidgets'
+ ];
+ }
+
+ /**
+ * @param WidgetsList $list
+ */
+ public function filterWidgets($list)
+ {
+ if (!SettingsPiwik::isInternetEnabled()) {
+ $list->remove(GetRank::getCategory(), GetRank::getName());
+ }
+ }
}
diff --git a/plugins/SEO/Widgets/GetRank.php b/plugins/SEO/Widgets/GetRank.php
index b22a6683c9..3a673edd94 100644
--- a/plugins/SEO/Widgets/GetRank.php
+++ b/plugins/SEO/Widgets/GetRank.php
@@ -18,10 +18,20 @@ use Piwik\Plugins\SEO\API;
class GetRank extends \Piwik\Widget\Widget
{
+ public static function getCategory()
+ {
+ return 'SEO';
+ }
+
+ public static function getName()
+ {
+ return 'SEO_SeoRankings';
+ }
+
public static function configure(WidgetConfig $config)
{
- $config->setCategoryId('SEO');
- $config->setName('SEO_SeoRankings');
+ $config->setCategoryId(self::getCategory());
+ $config->setName(self::getName());
}
public function render()