Exemplo n.º 1
0
 /**
  * Class constructor
  */
 function __construct()
 {
     $this->options = YMBESEO_Options::get_all();
     if (is_multisite()) {
         YMBESEO_Options::maybe_set_multisite_defaults(false);
     }
     if ($this->options['stripcategorybase'] === true) {
         add_action('created_category', array($this, 'schedule_rewrite_flush'));
         add_action('edited_category', array($this, 'schedule_rewrite_flush'));
         add_action('delete_category', array($this, 'schedule_rewrite_flush'));
     }
     $this->page_gsc = new YMBESEO_GSC();
     $this->dashboard_widget = new Yoast_Dashboard_Widget();
     // Needs the lower than default priority so other plugins can hook underneath it without issue.
     add_action('admin_menu', array($this, 'register_settings_page'), 5);
     add_action('network_admin_menu', array($this, 'register_network_settings_page'));
     add_filter('plugin_action_links_' . YMBESEO_BASENAME, array($this, 'add_action_link'), 10, 2);
     add_action('admin_enqueue_scripts', array($this, 'config_page_scripts'));
     if ('0' == get_option('blog_public')) {
         add_action('admin_footer', array($this, 'blog_public_warning'));
     }
     if ((isset($this->options['theme_has_description']) && $this->options['theme_has_description'] === true || $this->options['theme_description_found'] !== '') && $this->options['ignore_meta_description_warning'] !== true) {
         add_action('admin_footer', array($this, 'meta_description_warning'));
     }
     if ($this->options['cleanslugs'] === true) {
         add_filter('name_save_pre', array($this, 'remove_stopwords_from_slug'), 0);
     }
     add_filter('user_contactmethods', array($this, 'update_contactmethods'), 10, 1);
     add_action('after_switch_theme', array($this, 'switch_theme'));
     add_action('switch_theme', array($this, 'switch_theme'));
     add_filter('set-screen-option', array($this, 'save_bulk_edit_options'), 10, 3);
     add_action('admin_init', array('YMBESEO_Plugin_Conflict', 'hook_check_for_plugin_conflicts'), 10, 1);
     YMBESEO_Utils::register_cache_clear_option('wpseo', '');
 }
Exemplo n.º 2
0
 /**
  * Class constructor
  */
 public function __construct()
 {
     $this->options = YMBESEO_Options::get_all();
     YMBESEO_Options::maybe_set_multisite_defaults(false);
     $this->init();
     if (version_compare($this->options['version'], '1.5.0', '<')) {
         $this->upgrade_15($this->options['version']);
     }
     if (version_compare($this->options['version'], '2.0', '<')) {
         $this->upgrade_20();
     }
     if (version_compare($this->options['version'], '2.1', '<')) {
         $this->upgrade_21();
     }
     if (version_compare($this->options['version'], '2.2', '<')) {
         $this->upgrade_22();
     }
     if (version_compare($this->options['version'], '2.3', '<')) {
         $this->upgrade_23();
     }
     /**
      * Filter: 'YMBESEO_run_upgrade' - Runs the upgrade hook which are dependent on Yoast SEO
      *
      * @api string - The current version of Yoast SEO
      */
     do_action('YMBESEO_run_upgrade', $this->options['version']);
     $this->finish_up();
 }
Exemplo n.º 3
0
/**
 * Runs on activation of the plugin.
 */
function _YMBESEO_activate()
{
    require_once YMBESEO_PATH . 'inc/ymbeseo-functions.php';
    YMBESEO_load_textdomain();
    // Make sure we have our translations available for the defaults.
    YMBESEO_Options::get_instance();
    if (!is_multisite()) {
        YMBESEO_Options::initialize();
    } else {
        YMBESEO_Options::maybe_set_multisite_defaults(true);
    }
    YMBESEO_Options::ensure_options_exist();
    add_action('shutdown', 'flush_rewrite_rules');
    YMBESEO_add_capabilities();
    // Clear cache so the changes are obvious.
    YMBESEO_Utils::clear_cache();
    do_action('YMBESEO_activate');
}