<?php

namespace ProudNerds\Plugins;

/**
 * Class: Yoast
 *
 * Add changes to the functionality of Yoast SEO.
 */
class Yoast {
    /**
     * Yoast constructor.
     */
    public function __construct() {
        if(defined('WPSEO_VERSION')) {
            $this->addActions();
            $this->removeRoles();
        }
    }

    /**
     * Add actions.
     */
    private function addActions() {
        add_action('wp_dashboard_setup', array(__CLASS__, 'removeDashboardWidgets'), 10, 0);
    }

    /**
     * Remove dashboard widget.
     */
    static function removeDashboardWidgets() {
        remove_meta_box('wpseo-dashboard-overview', 'dashboard', 'side');
    }

    /**
     * Remove unnecessary user roles.
     */
    private function removeRoles() {
        remove_role('wpseo_manager');
        remove_role('wpseo_editor');
    }
}