/**
     * Outputs the admin panel for the Video Sitemaps on the XML Sitemaps page with the WP SEO admin
     *
     * @since 0.1
     */
    public function admin_panel()
    {
        $options = get_option('wpseo_video');
        $xmlopt = get_option('wpseo_xml');
        WPSEO_Video_Wrappers::admin_header(true, $this->option_instance->group_name, $this->option_instance->option_name, false);
        if (isset($_POST['reindex'])) {
            /**
             * Load the reindex page, shows a progressbar and sents ajax calls to the server with
             * small amounts of posts to reindex.
             */
            require plugin_dir_path(__FILE__) . 'views/reindex_page.php';
        } else {
            if ($xmlopt['enablexmlsitemap'] !== true) {
                echo '<p>' . sprintf(esc_html__('Please enable the XML sitemap under the SEO -> %sXML Sitemaps settings%s', 'yoast-video-seo'), '<a href="' . esc_url(add_query_arg(array('page' => 'wpseo_xml'), admin_url('admin.php'))) . '">', '</a>') . '</p>';
            } else {
                echo '<h2>' . esc_html__('General Settings', 'yoast-video-seo') . '</h2>';
                if (is_array($options['videositemap_posttypes']) && $options['videositemap_posttypes'] !== array()) {
                    // Use fields => ids to limit the overhead of fetching entire post objects,
                    // fetch only an array of ids instead to count
                    $args = array('post_type' => $options['videositemap_posttypes'], 'post_status' => 'publish', 'posts_per_page' => -1, 'meta_key' => '_yoast_wpseo_video_meta', 'meta_compare' => '!=', 'meta_value' => 'none', 'fields' => 'ids');
                    $video_ids = get_posts($args);
                    $count = count($video_ids);
                    $n = $count > $this->max_entries ? (int) ceil($count / $this->max_entries) : '';
                    $video_lastest = str_replace('sitemap.xml', 'sitemap' . $n . '.xml', $this->sitemap_url());
                    echo '<p>' . esc_html__('Please find your video sitemap here:', 'yoast-video-seo') . ' <a class="button" target="_blank" href="' . esc_url($video_lastest) . '">' . esc_html__('Video Sitemap', 'yoast-video-seo') . '</a></p>';
                } else {
                    echo '<p>' . esc_html__('Select at least one post type to enable the video sitemap', 'yoast-video-seo') . '</p>';
                }
                echo WPSEO_Video_Wrappers::checkbox('cloak_sitemap', esc_html__('Hide the sitemap from normal visitors?', 'yoast-video-seo'));
                echo WPSEO_Video_Wrappers::checkbox('disable_rss', esc_html__('Disable Media RSS Enhancement', 'yoast-video-seo'));
                echo WPSEO_Video_Wrappers::textinput('custom_fields', esc_html__('Custom fields', 'yoast-video-seo'));
                echo '<p class="clear description">' . esc_html__('Custom fields the plugin should check for video content (comma separated)', 'yoast-video-seo') . '</p>';
                echo WPSEO_Video_Wrappers::textinput('embedly_api_key', esc_html__('(Optional) Embedly API Key', 'yoast-video-seo'));
                echo '<p class="clear description">' . sprintf(esc_html__('The video SEO plugin provides where possible enriched information about your videos. A lot of %1$svideo services%2$s are supported by default. For those services which aren\'t supported, we can try to retrieve enriched video information using %3$sEmbedly%2$s. If you want to use this option, you\'ll need to sign up for a (free) %3$sEmbedly%2$s account and provide the API key you receive.', 'yoast-video-seo'), '<a href="http://kb.yoast.com/article/95-supported-video-hosting-platforms-for-video-seo-plugin">', '</a>', '<a href="http://embed.ly/">') . '</p>';
                echo '<br class="clear"/>';
                echo '<h2>' . esc_html__('Embed Settings', 'yoast-video-seo') . '</h2>';
                echo WPSEO_Video_Wrappers::checkbox('facebook_embed', esc_html__('Allow videos to be played directly on Facebook.', 'yoast-video-seo'));
                echo WPSEO_Video_Wrappers::checkbox('fitvids', sprintf(esc_html__('Try to make videos responsive using %sFitVids.js%s?', 'yoast-video-seo'), '<a href="http://fitvidsjs.com/">', '</a>'));
                echo WPSEO_Video_Wrappers::textinput('content_width', esc_html__('Content width', 'yoast-video-seo'));
                echo '<p class="clear description">' . esc_html__('This defaults to your themes content width, but if it\'s empty, setting a value here will make sure videos are embedded in the right width.', 'yoast-video-seo') . '</p>';
                echo WPSEO_Video_Wrappers::textinput('vzaar_domain', esc_html__('Vzaar domain', 'yoast-video-seo'));
                echo '<p class="clear description">' . esc_html__('If you use Vzaar, set this to the domain name you use for your Vzaar videos, no http: or slashes needed.', 'yoast-video-seo') . '</p>';
                echo WPSEO_Video_Wrappers::textinput('wistia_domain', esc_html__('Wistia domain', 'yoast-video-seo'));
                echo '<p class="clear description">' . esc_html__('If you use Wistia in combination with a custom domain, set this to the domain name you use for your Wistia videos, no http: or slashes needed.', 'yoast-video-seo') . '</p>';
                echo '<br class="clear"/>';
                echo '<h2>' . esc_html__('Post Types to include in XML Video Sitemap', 'yoast-video-seo') . '</h2>';
                echo '<p>' . esc_html__('Determine which post types on your site might contain video.', 'yoast-video-seo') . '</p>';
                $post_types = get_post_types(array('public' => true), 'objects');
                if (is_array($post_types) && $post_types !== array()) {
                    foreach ($post_types as $posttype) {
                        $sel = '';
                        if (is_array($options['videositemap_posttypes']) && in_array($posttype->name, $options['videositemap_posttypes'])) {
                            $sel = 'checked="checked" ';
                        }
                        echo '<input class="checkbox double" id="' . esc_attr('include' . $posttype->name) . '" type="checkbox" ' . 'name="wpseo_video[videositemap_posttypes][' . esc_attr($posttype->name) . ']" ' . $sel . 'value="' . esc_attr($posttype->name) . '"/> ' . '<label for="' . esc_attr('include' . $posttype->name) . '">' . esc_html($posttype->labels->name) . '</label><br class="clear">';
                    }
                }
                unset($post_types);
                echo '<h2>' . esc_html__('Taxonomies to include in XML Video Sitemap', 'yoast-video-seo') . '</h2>';
                echo '<p>' . esc_html__('You can also include your taxonomy archives, for instance, if you have videos on a category page.', 'yoast-video-seo') . '</p>';
                $taxonomies = get_taxonomies(array('public' => true), 'objects');
                if (is_array($taxonomies) && $taxonomies !== array()) {
                    foreach ($taxonomies as $tax) {
                        $sel = '';
                        if (is_array($options['videositemap_taxonomies']) && in_array($tax->name, $options['videositemap_taxonomies'])) {
                            $sel = 'checked="checked" ';
                        }
                        echo '<input class="checkbox double" id="' . esc_attr('include' . $tax->name) . '" type="checkbox" ' . 'name="wpseo_video[videositemap_taxonomies][' . esc_attr($tax->name) . ']" ' . $sel . 'value="' . esc_attr($tax->name) . '"/> ' . '<label for="' . esc_attr('include' . $tax->name) . '">' . esc_html($tax->labels->name) . '</label><br class="clear">';
                    }
                }
                unset($taxonomies);
            }
            echo '<br class="clear"/>';
            ?>

			<div class="submit">
				<input type="submit" class="button-primary" name="submit"
					   value="<?php 
            esc_attr_e('Save Settings', 'yoast-video-seo');
            ?>
" />
			</div>
			</form>

			<h2><?php 
            esc_html_e('Indexation of videos in your content', 'yoast-video-seo');
            ?>
</h2>

			<p style="max-width: 600px;"><?php 
            esc_html_e('This process goes through all the post types specified by you, as well as the terms of each taxonomy, to check for videos in the content. If the plugin finds a video, it updates the meta data for that piece of content, so it can add that meta data and content to the XML Video Sitemap.', 'yoast-video-seo');
            ?>
</p>

			<p style="max-width: 600px;"><?php 
            esc_html_e('By default the plugin only checks content that hasn\'t been checked yet. However, if you check \'Force Re-Index\', it will re-check all content. This is particularly interesting if you want to check for a video embed code that wasn\'t supported before, of if you want to update thumbnail images en masse.', 'yoast-video-seo');
            ?>
</p>

			<form method="post" action="">
				<input class="checkbox double" type="checkbox" name="force" id="force">
				<label for="force"><?php 
            esc_html_e("Force reindex of already indexed videos.", 'yoast-video-seo');
            ?>
</label><br />
				<br />
				<input type="submit" class="button" name="reindex"
					   value="<?php 
            esc_html_e('Re-Index Videos', 'yoast-video-seo');
            ?>
" />
			</form>
		<?php 
        }
        // Add debug info
        WPSEO_Video_Wrappers::admin_footer(false, false);
    }