/** * Function that outputs the redirect page */ public static function display() { // Licensing part. $license_manager = new Yoast_Plugin_License_Manager(new WPSEO_Product_Premium()); // Setup constant name. $license_manager->set_license_constant_name('WPSEO_LICENSE'); // Admin header. Yoast_Form::get_instance()->admin_header(false); if ($license_manager->license_is_valid()) { ?> <div class="wpseo_content_cell"> <iframe src="//fast.wistia.net/embed/playlists/5t35e24abt?media_0_0%5BautoPlay%5D=false&media_0_0%5BcontrolsVisibleOnLoad%5D=false&theme=bento&version=v1&videoOptions%5BautoPlay%5D=true&videoOptions%5BvideoHeight%5D=450&videoOptions%5BvideoWidth%5D=800&videoOptions%5BvolumeControl%5D=true" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_playlist" name="wistia_playlist" allowfullscreen mozallowfullscreen webkitallowfullscreen oallowfullscreen msallowfullscreen width="1107" height="450"></iframe> <br class="clear"> </div> <br class="clear"> <?php } else { echo '<div class="wpseo-warning">'; /* translators: %s: 'Yoast SEO Premium' */ echo '<h2>' . sprintf(__('%s is inactive.', 'wordpress-seo-premium'), 'Yoast SEO Premium') . '</h2>'; if (current_user_can('manage_options')) { /* translators: %s: 'Yoast SEO Premium' */ echo '<p>' . sprintf(__('Please activate %s to be able to see the videos.', 'wordpress-seo-premium'), 'Yoast SEO Premium') . '</p></div>'; } else { /* translators: %s: 'Yoast SEO Premium' */ echo '<p>' . sprintf(__('Please ask your site administrator to activate %s to be able to see the videos.', 'wordpress-seo-premium'), 'Yoast SEO Premium') . '</p></div>'; } } // Admin footer. Yoast_Form::get_instance()->admin_footer(false); }
/** * Function that outputs the redirect page */ public static function display() { global $wpseo_admin_pages; // Licensing part $license_manager = new Yoast_Plugin_License_Manager(new WPSEO_Product_Premium()); // Setup constant name $license_manager->set_license_constant_name('WPSEO_LICENSE'); // Admin header $wpseo_admin_pages->admin_header(false); if ($license_manager->license_is_valid()) { ?> <div class="wpseo_content_cell"> <iframe src="//fast.wistia.net/embed/playlists/anhtprp59b?media_0_0%5BautoPlay%5D=false&media_0_0%5BcontrolsVisibleOnLoad%5D=false&theme=bento&version=v1&videoOptions%5BautoPlay%5D=true&videoOptions%5BvideoHeight%5D=450&videoOptions%5BvideoWidth%5D=800&videoOptions%5BvolumeControl%5D=true" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_playlist" name="wistia_playlist" allowfullscreen mozallowfullscreen webkitallowfullscreen oallowfullscreen msallowfullscreen width="1107" height="488"></iframe> <br class="clear"> </div> <br class="clear"> <?php } else { echo '<div class="wpseo-warning">'; echo '<h2>' . __('WordPress SEO Premium is inactive.', 'wordpress-seo') . '</h2>'; if (current_user_can('manage_options')) { echo '<p>' . __('Please activate WordPress SEO Premium to be able to see the videos.', 'wordpress-seo') . '</p></div>'; } else { echo '<p>' . __('Please ask your site administrator to activate WordPress SEO Premium to be able to see the videos.', 'wordpress-seo') . '</p></div>'; } } // Admin footer $wpseo_admin_pages->admin_footer(false); }
/** * Setup the Yoast SEO premium plugin */ private function setup() { // Setup autoloader. require_once dirname(__FILE__) . '/classes/class-premium-autoloader.php'; $autoloader = new WPSEO_Premium_Autoloader(); spl_autoload_register(array($autoloader, 'load')); $this->load_textdomain(); $this->instantiate_redirects(); if (is_admin()) { // Disable Yoast SEO add_action('admin_init', array($this, 'disable_wordpress_seo'), 1); // Add Sub Menu page and add redirect page to admin page array. // This should be possible in one method in the future, see #535. add_filter('wpseo_submenu_pages', array($this, 'add_submenu_pages')); // Add Redirect page as admin page. add_filter('wpseo_admin_pages', array($this, 'add_admin_pages')); // Post to Get on search. add_action('admin_init', array($this, 'list_table_search_post_to_get')); // Add input fields to page meta post types. add_action('wpseo_admin_page_meta_post_types', array($this, 'admin_page_meta_post_types_checkboxes'), 10, 2); // Add page analysis fields to variable array key patterns. add_filter('wpseo_option_titles_variable_array_key_patterns', array($this, 'add_variable_array_key_pattern')); // Filter the Page Analysis content. add_filter('wpseo_pre_analysis_post_content', array($this, 'filter_page_analysis'), 10, 2); // Settings. add_action('admin_init', array($this, 'register_settings')); // Check if we need to save files after updating options. add_action('update_option_wpseo_redirect', array($this, 'save_redirect_files'), 10, 2); // Catch option save. add_action('admin_init', array($this, 'catch_option_redirect_save')); // Screen options $query_var = ($page = filter_input(INPUT_GET, 'page')) ? $page : ''; switch ($query_var) { case 'wpseo_redirects': add_filter('set-screen-option', array('WPSEO_Page_Redirect', 'set_screen_option'), 11, 3); break; } // Enqueue Post and Term overview script. add_action('admin_enqueue_scripts', array($this, 'enqueue_overview_script')); // Licensing part. $license_manager = new Yoast_Plugin_License_Manager(new WPSEO_Product_Premium()); // Setup constant name. $license_manager->set_license_constant_name('WPSEO_LICENSE'); // Setup license hooks. $license_manager->setup_hooks(); // Add this plugin to licensing form. add_action('wpseo_licenses_forms', array($license_manager, 'show_license_form')); if ($license_manager->license_is_valid()) { add_action('admin_head', array($this, 'admin_css')); } // Add Premium imports. $premium_import_manager = new WPSEO_Premium_Import_Manager(); // Allow option of importing from other 'other' plugins. add_filter('wpseo_import_other_plugins', array($premium_import_manager, 'filter_add_premium_import_options')); // Handle premium imports. add_action('wpseo_handle_import', array($premium_import_manager, 'do_premium_imports')); // Add htaccess import block. add_action('wpseo_import_tab_content', array($premium_import_manager, 'add_htaccess_import_block')); add_action('wpseo_import_tab_header', array($premium_import_manager, 'htaccess_import_header')); // Only activate post and term watcher if permalink structure is enabled. if (get_option('permalink_structure')) { add_action('admin_init', array($this, 'init_watchers')); // Check if we need to display an admin message if ($redirect_created = filter_input(INPUT_GET, 'yoast-redirect-created')) { // Message object $message = new WPSEO_Message_Redirect_Created($redirect_created); add_action('all_admin_notices', array($message, 'display')); } } } else { // Add 404 redirect link to WordPress toolbar. add_action('admin_bar_menu', array($this, 'admin_bar_menu'), 96); add_filter('redirect_canonical', array($this, 'redirect_canonical_fix'), 1, 2); } }
/** * Setup the premium WordPress SEO plugin */ private function setup() { // Setup autoloader require_once dirname(__FILE__) . '/classes/class-premium-autoloader.php'; $autoloader = new WPSEO_Premium_Autoloader(); spl_autoload_register(array($autoloader, 'load')); if (is_admin()) { // Upgrade Manager $plugin_updater = new WPSEO_Upgrade_Manager(); $plugin_updater->check_update(); // Create pages $this->page_gwt = new WPSEO_Page_GWT(); // Disable WordPress SEO add_action('admin_init', array($this, 'disable_wordpress_seo'), 1); // Add Sub Menu page and add redirect page to admin page array // This should be possible in one method in the future, see #535 add_filter('wpseo_submenu_pages', array($this, 'add_submenu_pages')); // Add Redirect page as admin page add_filter('wpseo_admin_pages', array($this, 'add_admin_pages')); // Post to Get on search add_action('admin_init', array($this, 'list_table_search_post_to_get')); // Add the GWT crawl error post type add_action('admin_init', array($this, 'register_gwt_crawl_error_post_type')); // Add input fields to page meta post types add_action('wpseo_admin_page_meta_post_types', array($this, 'admin_page_meta_post_types_checkboxes'), 10, 2); // Add page analysis fields to variable array key patterns add_filter('wpseo_option_titles_variable_array_key_patterns', array($this, 'add_variable_array_key_pattern')); // Filter the Page Analysis content add_filter('wpseo_pre_analysis_post_content', array($this, 'filter_page_analysis'), 10, 2); // Check if WPSEO_DISABLE_PHP_REDIRECTS is defined if (defined('WPSEO_DISABLE_PHP_REDIRECTS') && true === WPSEO_DISABLE_PHP_REDIRECTS) { // Change the normal redirect autoload option $normal_redirect_manager = new WPSEO_URL_Redirect_Manager(); $normal_redirect_manager->redirects_change_autoload(false); // Change the regex redirect autoload option $regex_redirect_manager = new WPSEO_REGEX_Redirect_Manager(); $regex_redirect_manager->redirects_change_autoload(false); } else { $options = WPSEO_Redirect_Manager::get_options(); // If the disable_php_redirect option is not enabled we should enable auto loading redirects if ('off' == $options['disable_php_redirect']) { // Change the normal redirect autoload option $normal_redirect_manager = new WPSEO_URL_Redirect_Manager(); $normal_redirect_manager->redirects_change_autoload(true); // Change the regex redirect autoload option $regex_redirect_manager = new WPSEO_REGEX_Redirect_Manager(); $regex_redirect_manager->redirects_change_autoload(true); } } // Settings add_action('admin_init', array($this, 'register_settings')); // Check if we need to save files after updating options add_action('update_option_wpseo_redirect', array($this, 'save_redirect_files'), 10, 2); // Catch option save add_action('admin_init', array($this, 'catch_option_redirect_save')); // Screen options $query_var = !empty($_GET['page']) ? $_GET['page'] : ''; switch ($query_var) { case 'wpseo_redirects': add_filter('set-screen-option', array('WPSEO_Page_Redirect', 'set_screen_option'), 11, 3); break; case 'wpseo_webmaster_tools': add_filter('set-screen-option', array($this->page_gwt, 'set_screen_option'), 11, 3); break; } // Enqueue Post and Term overview script add_action('admin_enqueue_scripts', array($this, 'enqueue_overview_script')); // Licensing part $license_manager = new Yoast_Plugin_License_Manager(new WPSEO_Product_Premium()); // Setup constant name $license_manager->set_license_constant_name('WPSEO_LICENSE'); // Setup license hooks $license_manager->setup_hooks(); // Add this plugin to licensing form add_action('wpseo_licenses_forms', array($license_manager, 'show_license_form')); if ($license_manager->license_is_valid()) { add_action('admin_head', array($this, 'admin_css')); } // Crawl Issue Manager AJAX hooks $crawl_issue_manager = new WPSEO_Crawl_Issue_Manager(); add_action('wp_ajax_wpseo_ignore_crawl_issue', array($crawl_issue_manager, 'ajax_ignore_crawl_issue')); add_action('wp_ajax_wpseo_unignore_crawl_issue', array($crawl_issue_manager, 'ajax_unignore_crawl_issue')); // Add Premium imports $premium_import_manager = new WPSEO_Premium_Import_Manager(); // Allow option of importing from other 'other' plugins add_filter('wpseo_import_other_plugins', array($premium_import_manager, 'filter_add_premium_import_options')); // Handle premium imports add_action('wpseo_handle_import', array($premium_import_manager, 'do_premium_imports')); // Add htaccess import block add_action('wpseo_import', array($premium_import_manager, 'add_htaccess_import_block')); // Only activate post and term watcher if permalink structure is enabled if (get_option('permalink_structure')) { // The Post Watcher $post_watcher = new WPSEO_Post_Watcher(); // Add old URL field to post edit screen add_action('edit_form_advanced', array($post_watcher, 'old_url_field'), 10, 1); add_action('edit_page_form', array($post_watcher, 'old_url_field'), 10, 1); // Detect a post slug change add_action('post_updated', array($post_watcher, 'detect_slug_change'), 12, 3); // Detect a post trash add_action('trashed_post', array($post_watcher, 'detect_post_trash')); // Detect a post untrash add_action('untrashed_post', array($post_watcher, 'detect_post_untrash')); // Detect a post delete add_action('delete_post', array($post_watcher, 'detect_post_delete')); // The Term Watcher $term_watcher = new WPSEO_Term_Watcher(); // Get all taxonomies $taxonomies = get_taxonomies(); // Loop through all taxonomies if (count($taxonomies) > 0) { foreach ($taxonomies as $taxonomy) { // Add old URL field to term edit screen add_action($taxonomy . '_edit_form_fields', array($term_watcher, 'old_url_field'), 10, 2); } } // Detect the term slug change add_action('edited_term', array($term_watcher, 'detect_slug_change'), 10, 3); // Detect a term delete add_action('delete_term_taxonomy', array($term_watcher, 'detect_term_delete')); // Check if we need to display an admin message if (isset($_GET['yoast-redirect-created'])) { // Message object $message = new WPSEO_Message_Redirect_Created($_GET['yoast-redirect-created']); add_action('all_admin_notices', array($message, 'display')); } } } else { // Catch redirect $normal_redirect_manager = new WPSEO_URL_Redirect_Manager(); add_action('template_redirect', array($normal_redirect_manager, 'do_redirects')); // Catch redirect $regex_redirect_manager = new WPSEO_REGEX_Redirect_Manager(); add_action('template_redirect', array($regex_redirect_manager, 'do_redirects')); // Add 404 redirect link to WordPress toolbar add_action('admin_bar_menu', array($this, 'admin_bar_menu'), 96); add_filter('redirect_canonical', array($this, 'redirect_canonical_fix'), 1, 2); } // Normal Redirect AJAX $redirect_manager = new WPSEO_URL_Redirect_Manager(); add_action('wp_ajax_wpseo_save_redirect_url', array($redirect_manager, 'ajax_handle_redirect_save')); add_action('wp_ajax_wpseo_delete_redirect_url', array($redirect_manager, 'ajax_handle_redirect_delete')); add_action('wp_ajax_wpseo_create_redirect_url', array($redirect_manager, 'ajax_handle_redirect_create')); // Regex Redirect AJAX $redirect_manager = new WPSEO_REGEX_Redirect_Manager(); add_action('wp_ajax_wpseo_save_redirect_regex', array($redirect_manager, 'ajax_handle_redirect_save')); add_action('wp_ajax_wpseo_delete_redirect_regex', array($redirect_manager, 'ajax_handle_redirect_delete')); add_action('wp_ajax_wpseo_create_redirect_regex', array($redirect_manager, 'ajax_handle_redirect_create')); // Add URL reponse code check AJAX add_action('wp_ajax_wpseo_check_url', array('WPSEO_Url_Checker', 'check_url')); }
/** * 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 ); }