/**
 * On plugins_loaded: load the minimum amount of essential files for this plugin
 */
function YMBESEO_init()
{
    require_once YMBESEO_PATH . 'inc/ymbeseo-functions.php';
    // Make sure our option and meta value validation routines and default values are always registered and available.
    YMBESEO_Options::get_instance();
    YMBESEO_Meta::init();
    $options = YMBESEO_Options::get_all();
    if (version_compare($options['version'], YMBESEO_VERSION, '<')) {
        new YMBESEO_Upgrade();
        // Get a cleaned up version of the $options.
        $options = YMBESEO_Options::get_all();
    }
    if ($options['stripcategorybase'] === true) {
        $GLOBALS['YMBESEO_rewrite'] = new YMBESEO_Rewrite();
    }
    if ($options['enablexmlsitemap'] === true) {
        $GLOBALS['YMBESEO_sitemaps'] = new YMBESEO_Sitemaps();
    }
    if (!defined('DOING_AJAX') || !DOING_AJAX) {
        require_once YMBESEO_PATH . 'inc/ymbeseo-non-ajax-functions.php';
    }
    // Init it here because the filter must be present on the frontend as well or it won't work in the customizer.
    new YMBESEO_Customizer();
}