1<?php
2/**
3 * Matomo - free/libre analytics platform
4 *
5 * @link https://matomo.org
6 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
7 *
8 */
9namespace Piwik\Plugins\SEO;
10use Piwik\Plugins\SEO\Widgets\GetRank;
11use Piwik\SettingsPiwik;
12use Piwik\Widget\WidgetsList;
13
14/**
15 */
16class SEO extends \Piwik\Plugin
17{
18    public function registerEvents()
19    {
20        return [
21            'Widget.filterWidgets' => 'filterWidgets',
22            'AssetManager.getJavaScriptFiles' => 'getJsFiles',
23        ];
24    }
25
26    public function getJsFiles(&$jsFiles)
27    {
28        $jsFiles[] = "plugins/SEO/javascripts/rank.js";
29    }
30
31    /**
32     * @param WidgetsList $list
33     */
34    public function filterWidgets($list)
35    {
36        if (!SettingsPiwik::isInternetEnabled()) {
37            $list->remove(GetRank::getCategory(), GetRank::getName());
38        }
39    }
40}
41