PluginProbe
Manage – Centralized site maintenance and monitoring / trunk
Manage – Centralized site maintenance and monitoring vtrunk
1.0.9 1.0.8 1.0.7 1.0.6 1.0.5 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4
manage / modules / core / module.php

module.php in Manage – Centralized site maintenance and monitoring trunk, at modules/core/module.php

56 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Manage\Modules\Core;
4
5 use Manage\Classes\Module_Base;
6 use Manage\Modules\Connect\Module as Connect;
7 use Manage\Modules\Settings\Module as Settings;
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit; // Exit if accessed directly.
11 }
12
13 class Module extends Module_Base {
14
15 public function get_name(): string {
16 return 'core';
17 }
18
19 public function add_plugin_links( $links, $plugin_file_name ): array {
20 if ( ! str_ends_with( $plugin_file_name, '/manage.php' ) ) {
21 return (array) $links;
22 }
23
24 $custom_links = [
25 'dashboard' => sprintf(
26 '<a href="%s">%s</a>',
27 admin_url( 'admin.php?page=' . Settings::SETTING_BASE_SLUG ),
28 esc_html__( 'Dashboard', 'manage' )
29 ),
30 ];
31
32 if ( ! Connect::is_connected() ) {
33 $custom_links['connect'] = sprintf(
34 '<a href="%s" style="color: #524CFF; font-weight: 700;">%s</a>',
35 admin_url( 'admin.php?page=' . Settings::SETTING_BASE_SLUG ),
36 esc_html__( 'Connect', 'manage' )
37 );
38 }
39
40 return array_merge( $custom_links, $links );
41 }
42
43 /**
44 * Module constructor.
45 */
46 public function __construct() {
47 $this->register_components( [
48 'Not_Connected',
49 'Pointers',
50 'Dashboard_Widget',
51 ] );
52
53 add_filter( 'plugin_action_links', [ $this, 'add_plugin_links' ], 10, 2 );
54 }
55 }
56