*/ namespace RankMath; use RankMath\KB; use RankMath\Helper; use RankMath\Traits\Hooker; defined( 'ABSPATH' ) || exit; /** * Dashboard_Widget class. * * @codeCoverageIgnore */ class Dashboard_Widget { use Hooker; /** * Constructor. */ public function __construct() { $this->action( 'wp_dashboard_setup', 'add_dashboard_widgets' ); $this->action( 'rank_math/dashboard/widget', 'dashboard_widget_feed', 98 ); $this->action( 'rank_math/dashboard/widget', 'dashboard_widget_footer', 99 ); } /** * Register dashboard widget. */ public function add_dashboard_widgets() { // Early Bail if action is not registered for the dashboard widget hook. if ( ( ! Helper::is_module_active( '404-monitor' ) || ! Helper::has_cap( '404_monitor' ) ) && ( ! Helper::is_module_active( 'redirections' ) || ! Helper::has_cap( 'redirections' ) ) && ( ! Helper::is_module_active( 'analytics' ) || ! Helper::has_cap( 'analytics' ) ) ) { return; } $icon = ''; wp_add_dashboard_widget( 'rank_math_dashboard_widget', $icon . esc_html__( 'Rank Math Overview', 'rank-math' ), [ $this, 'render_dashboard_widget' ], null, null, 'normal', 'high' ); } /** * Render dashboard widget. */ public function render_dashboard_widget() { echo '
'; } /** * Add Feed data in the admin dashboard widget. */ public function dashboard_widget_feed() { $posts = $this->get_feed(); ?> '; $posts = $this->filter_posts( $posts ); $label = $this->get_item_label( $posts ); foreach ( $posts as $index => $post ) : $link = $this->add_utm_params( $post['link'], $index ); ?>