/**
  * Get the singleton instance of this class
  *
  * @return object
  */
 public static function get_instance()
 {
     if (!self::$instance instanceof self) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 /**
  * Constructor for the WPSEO_Video_Sitemap class.
  *
  * @todo  Deal with upgrade from license constant WPSEO_VIDEO_LICENSE
  * @since 0.1
  */
 public function __construct()
 {
     // Initialize the options
     $this->option_instance = WPSEO_Option_Video::get_instance();
     $options = get_option('wpseo_video');
     // run upgrade routine
     $this->upgrade();
     add_filter('wpseo_tax_meta_special_term_id_validation__video', array($this, 'validate_video_tax_meta'));
     if (!isset($GLOBALS['content_width']) && $options['content_width'] > 0) {
         $GLOBALS['content_width'] = $options['content_width'];
     }
     add_action('setup_theme', array($this, 'init'));
     add_action('admin_init', array($this, 'init'));
     add_action('init', array($this, 'register_sitemap'), 20);
     // Register sitemap after cpts have been added
     add_action('admin_bar_menu', array($this, 'add_admin_bar_item'), 97);
     add_filter('oembed_providers', array($this, 'sync_oembed_providers'));
     if (is_admin()) {
         add_action('admin_menu', array($this, 'register_settings_page'));
         add_filter('wpseo_admin_pages', array($this, 'style_admin'));
         add_action('save_post', array($this, 'update_video_post_meta'));
         if (in_array($GLOBALS['pagenow'], array('edit.php', 'post.php', 'post-new.php')) || apply_filters('wpseo_always_register_metaboxes_on_admin', false)) {
             $this->metabox_tab = new WPSEO_Video_Metabox();
         }
         // Licensing part
         $yoast_product = new Yoast_Product_WPSEO_Video();
         $license_manager = new Yoast_Plugin_License_Manager($yoast_product);
         // Setup constant name
         $license_manager->set_license_constant_name('WPSEO_VIDEO_LICENSE');
         // Setup hooks
         $license_manager->setup_hooks();
         // Add form
         add_action('wpseo_licenses_forms', array($license_manager, 'show_license_form'));
         add_action('admin_enqueue_scripts', array($this, 'admin_video_enqueue_scripts'));
         add_action('admin_init', array($this, 'admin_video_enqueue_styles'));
         add_action('wp_ajax_index_posts', array($this, 'index_posts_callback'));
         add_action('save_post', array($this, 'invalidate_sitemap'));
         // Setting action for removing the transient on update options
         if (method_exists('WPSEO_Utils', 'register_cache_clear_option')) {
             WPSEO_Utils::register_cache_clear_option('wpseo_video', $this->video_sitemap_basename());
         }
         // Maybe show 'Recommend re-index' admin notice
         if (get_transient('video_seo_recommend_reindex') === '1') {
             add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts_ignore'));
             add_action('all_admin_notices', array($this, 'recommend_force_index'));
             add_action('wp_ajax_videoseo_set_ignore', array($this, 'set_ignore'));
         }
     } else {
         // OpenGraph
         add_action('wpseo_opengraph', array($this, 'opengraph'));
         add_filter('wpseo_opengraph_type', array($this, 'opengraph_type'), 10, 1);
         add_filter('wpseo_opengraph_image', array($this, 'opengraph_image'), 5, 1);
         // XML Sitemap Index addition
         add_filter('wpseo_sitemap_index', array($this, 'add_to_index'));
         // Setting stylesheet for cached sitemap
         add_action('wpseo_sitemap_stylesheet_cache_video', array($this, 'set_stylesheet_cache'));
         // Content filter for non-detected videos
         add_filter('the_content', array($this, 'content_filter'), 5, 1);
         if ($options['fitvids'] === true) {
             // Fitvids scripting
             add_action('wp_head', array($this, 'fitvids'));
         }
         if ($options['disable_rss'] !== true) {
             // MRSS
             add_action('rss2_ns', array($this, 'mrss_namespace'));
             add_action('rss2_item', array($this, 'mrss_item'), 10, 1);
             add_filter('mrss_media', array($this, 'mrss_add_video'));
         }
     }
     // @todo Maybe enable ?
     // Run on low prio to allow other filters to add their extensions first
     //add_filter( 'wp_video_extensions', array( $this, 'filter_video_extensions' ), 99 );
 }