Admin
2 months ago
Commands
2 years ago
Db
1 year ago
Ecommerce
3 months ago
Report
2 months ago
Site
2 months ago
TrackingCode
4 months ago
Updater
4 years ago
User
2 months ago
Workarounds
2 years ago
WpStatistics
5 months ago
views
4 years ago
AIBotTracking.php
4 months ago
API.php
2 months ago
Access.php
4 years ago
AjaxTracker.php
4 months ago
Annotations.php
2 months ago
Bootstrap.php
10 months ago
Capabilities.php
2 months ago
Compatibility.php
2 months ago
Email.php
2 years ago
ErrorNotice.php
2 months ago
Feature.php
2 months ago
Installer.php
5 months ago
Logger.php
1 year ago
OptOut.php
2 months ago
Paths.php
5 months ago
PluginActionLinks.php
2 months ago
PluginAdminOverrides.php
2 months ago
PluginInit.php
2 months ago
PrivacyBadge.php
4 years ago
RedirectOnActivation.php
2 months ago
Referral.php
2 months ago
Roles.php
2 months ago
ScheduledTasks.php
2 months ago
Settings.php
4 months ago
Site.php
3 years ago
TrackingCode.php
2 months ago
Uninstaller.php
5 months ago
Updater.php
10 months ago
User.php
4 years ago
PluginActionLinks.php
50 lines
| 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 | * @package matomo |
| 8 | */ |
| 9 | |
| 10 | namespace WpMatomo; |
| 11 | |
| 12 | use WpMatomo\Admin\Menu; |
| 13 | |
| 14 | if ( ! defined( 'ABSPATH' ) ) { |
| 15 | exit; // if accessed directly |
| 16 | } |
| 17 | |
| 18 | class PluginActionLinks extends Feature { |
| 19 | |
| 20 | /** |
| 21 | * @var Settings |
| 22 | */ |
| 23 | private $settings; |
| 24 | |
| 25 | public function __construct( Settings $settings ) { |
| 26 | $this->settings = $settings; |
| 27 | } |
| 28 | |
| 29 | public function register_hooks() { |
| 30 | add_filter( |
| 31 | 'plugin_action_links_' . plugin_basename( MATOMO_ANALYTICS_FILE ), |
| 32 | [ |
| 33 | $this, |
| 34 | 'add_settings_link', |
| 35 | ] |
| 36 | ); |
| 37 | } |
| 38 | public function add_settings_link( $links ) { |
| 39 | $get_started = new \WpMatomo\Admin\GetStarted( $this->settings ); |
| 40 | |
| 41 | if ( $this->settings->get_global_option( Settings::SHOW_GET_STARTED_PAGE ) && $get_started->can_user_manage() ) { |
| 42 | $links[] = '<a href="' . menu_page_url( Menu::SLUG_GET_STARTED, false ) . '">' . __( 'Get Started', 'matomo' ) . '</a>'; |
| 43 | } elseif ( current_user_can( Capabilities::KEY_SUPERUSER ) ) { |
| 44 | $links[] = '<a href="' . menu_page_url( Menu::SLUG_SETTINGS, false ) . '">' . __( 'Settings', 'matomo' ) . '</a>'; |
| 45 | } |
| 46 | |
| 47 | return $links; |
| 48 | } |
| 49 | } |
| 50 |