*/ namespace RankMath_Monitor\Admin; use RankMath_Monitor\Runner; use RankMath_Monitor\Helper; use RankMath_Monitor\Traits\Hooker; defined( 'ABSPATH' ) || exit; /** * Admin class. * * @codeCoverageIgnore */ class Admin implements Runner { use Hooker; /** * Register hooks. */ public function hooks() { $this->action( 'wp_dashboard_setup', 'add_dashboard_widgets' ); $this->action( 'admin_footer', 'rank_math_modal' ); } /** * Register dashboard widget. */ public function add_dashboard_widgets() { wp_add_dashboard_widget( 'rank_math_dashboard_widget', esc_html__( 'Rank Math', '404-monitor' ), [ $this, 'render_dashboard_widget' ] ); } /** * Render dashboard widget. */ public function render_dashboard_widget() { ?>
do_action( 'dashboard/widget' ); ?>
[ 'url' => '', 'args' => 'view=modules', 'cap' => 'manage_options', 'title' => esc_html__( 'Modules', '404-monitor' ), ], 'help' => [ 'url' => 'help', 'args' => '', 'cap' => 'manage_options', 'title' => esc_html__( 'Help', '404-monitor' ), ], 'import-export' => [ 'url' => 'import-export', 'args' => '', 'cap' => 'manage_options', 'title' => esc_html__( 'Import & Export', '404-monitor' ), ], ]; if ( Helper::is_plugin_active_for_network() ) { unset( $links['help'] ); } return $links; } /** * Activate Rank Math Modal. */ public function rank_math_modal() { $screen = get_current_screen(); // Early Bail! if ( ! in_array( $screen->id, array( 'toplevel_page_rank-math-monitor', 'rank-math_page_rank-math-404-monitor', 'rank-math_page_rank-math-options-general' ) ) ) { return; } if ( file_exists( WP_PLUGIN_DIR . '/seo-by-rank-math' ) ) { $text = __( 'Activate Now', '404-monitor' ); $path = 'seo-by-rank-math/rank-math.php'; $link = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=' . $path ), 'activate-plugin_' . $path ); } else { $text = __( 'Install for Free', '404-monitor' ); $link = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=seo-by-rank-math' ), 'install-plugin_seo-by-rank-math' ); } // Scripts. rank_math_monitor()->admin_assets->enqueue_style( 'plugin-modal' ); rank_math_monitor()->admin_assets->enqueue_script( 'plugin-modal' ); ?>

*/ ?>