'dashboard_pointer', 'titles' => 'titles_pointer', 'social' => 'social_pointer', 'xml' => 'xml_sitemaps_pointer', 'advanced' => 'advanced_pointer', 'licenses' => 'licenses_pointer', ); /** * Class constructor. */ private function __construct() { if ( current_user_can( 'manage_options' ) ) { if ( ! get_user_meta( get_current_user_id(), 'wpseo_ignore_tour' ) ) { wp_enqueue_style( 'wp-pointer' ); wp_enqueue_script( 'jquery-ui' ); wp_enqueue_script( 'wp-pointer' ); add_action( 'admin_print_footer_scripts', array( $this, 'intro_tour' ) ); } } } /** * 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; } /** * Load the introduction tour */ public function intro_tour() { global $pagenow; $page = preg_replace( '/^(wpseo_)/', '', filter_input( INPUT_GET, 'page' ) ); if ( 'admin.php' === $pagenow && array_key_exists( $page, $this->admin_pages ) ) { $this->do_page_pointer( $page ); } else { $this->start_tour_pointer(); } } /** * Prints the pointer script * * @param string $selector The CSS selector the pointer is attached to. * @param array $options The options for the pointer. */ public function print_scripts( $selector, $options ) { // Button1 is the close button, which always exists. $button_array_defaults = array( 'button2' => array( 'text' => false, 'function' => '', ), 'button3' => array( 'text' => false, 'function' => '', ), ); $this->button_array = wp_parse_args( $this->button_array, $button_array_defaults ); ?> button_array['button2']['text'] ) { ?> lastOpenedPointer.find( '#pointer-close' ).after('' + 'button_array['button2']['text']; ?>' + ''); lastOpenedPointer.find('#pointer-primary').click(function () { button_array['button2']['function']; ?> }); button_array['button3']['text'] ) { ?> lastOpenedPointer.find('#pointer-primary').after('' + 'button_array['button3']['text']; ?>' + ''); lastOpenedPointer.find('#pointer-ternary').click(function () { button_array['button3']['function']; ?> }); ' . __( 'Congratulations!', 'wordpress-seo' ) . '' /* translators: %1$s expands to Yoast SEO */ . '

' . sprintf( __( 'You’ve just installed %1$s! Click “Start Tour” to view a quick introduction of this plugin’s core functionality.', 'wordpress-seo' ), 'Yoast SEO' ) . '

'; $opt_arr = array( 'content' => $content, 'position' => array( 'edge' => 'bottom', 'align' => 'center' ), ); $this->button_array['button2']['text'] = __( 'Start Tour', 'wordpress-seo' ); $this->button_array['button2']['function'] = sprintf( 'document.location="%s";', admin_url( 'admin.php?page=' . WPSEO_Admin::PAGE_IDENTIFIER ) ); $this->print_scripts( $selector, $opt_arr ); } /** * Shows a pointer on the proper pages * * @param string $page Admin page key. */ private function do_page_pointer( $page ) { $selector = '#wpseo-title'; $pointer = call_user_func( array( $this, $this->admin_pages[ $page ] ) ); $opt_arr = array( 'content' => $pointer['content'], 'position' => array( 'edge' => 'top', 'align' => ( is_rtl() ) ? 'left' : 'right', ), 'pointerWidth' => 450, ); if ( isset( $pointer['next_page'] ) ) { $this->button_array['button2'] = array( 'text' => __( 'Next', 'wordpress-seo' ), 'function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_' . $pointer['next_page'] ) . '";', ); } if ( isset( $pointer['prev_page'] ) ) { $this->button_array['button3'] = array( 'text' => __( 'Previous', 'wordpress-seo' ), 'function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_' . $pointer['prev_page'] ) . '";', ); } $this->print_scripts( $selector, $opt_arr ); } /** * Returns the content of the General Settings page pointer * * @return array */ private function dashboard_pointer() { global $current_user; return array( 'content' => '

' . __( 'General settings', 'wordpress-seo' ) . '

' /* translators: %1$s expands to Yoast SEO */ . '

' . sprintf( __( 'These are the General settings for %1$s, here you can restart this tour or revert the %1$s settings to default.', 'wordpress-seo' ), 'Yoast SEO' ) . '

' . '

' . __( 'Tab: Your Info / Company Info', 'wordpress-seo' ) . '
' . __( 'Add some info here needed for Google\'s Knowledge Graph.', 'wordpress-seo' ) . '

' . '

' . __( 'Tab: Webmaster Tools', 'wordpress-seo' ) . '
' . __( 'You can add the verification codes for the different Webmaster Tools programs here. We highly encourage you to check out both Google and Bing’s Webmaster Tools.', 'wordpress-seo' ) . '

' . '

' . __( 'Tab: Security', 'wordpress-seo' ) . '
' . __( 'Determine who has access to the plugins advanced settings on the post edit screen.', 'wordpress-seo' ) . '

' /* translators: %1$s expands to Yoast SEO */ . '

' . sprintf( __( 'More %1$s', 'wordpress-seo' ), 'Yoast SEO' ) . '
' /* @todo What about this translation */ . sprintf( __( 'There’s more to learn about WordPress & SEO than just using this plugin. A great start is our article %1$sthe definitive guide to WordPress SEO%2$s.', 'wordpress-seo' ), '', '' ) . '

' . '

' . __( 'Subscribe to our Newsletter', 'wordpress-seo' ) . '
' /* translators: %1$s expands to Yoast SEO */ . sprintf( __( 'If you would like us to keep you up-to-date regarding %1$s and other plugins by Yoast, subscribe to our newsletter:', 'wordpress-seo' ), 'Yoast SEO' ) . '

' . '
' . '

' . '' . '' . '' . '

' . '
', 'next_page' => 'titles', ); } /** * Returns the content of the titles page pointer * * @return array */ private function titles_pointer() { return array( 'content' => '

' . __( 'Title & Metas settings', 'wordpress-seo' ) . '

' . '

' . __( 'This is where you set the titles and meta-information for all your post types, taxonomies, archives, special pages and for your homepage. The page is divided into different tabs. Make sure you check ’em all out!', 'wordpress-seo' ) . '

' . '

' . __( 'Sitewide settings', 'wordpress-seo' ) . '
' . __( 'The first tab will show you site-wide settings for titles, normally you\'ll only need to change the Title Separator.', 'wordpress-seo' ) . '

' . '

' . __( 'Templates and settings', 'wordpress-seo' ) . '
' . sprintf( __( 'Now click on the ‘%1$sPost Types%2$s’-tab, as this will be our example.', 'wordpress-seo' ), '', '' ) . '
' . __( 'The templates are built using variables. You can find all these variables in the help tab (in the top-right corner of the page). The settings allow you to set specific behavior for the post types.', 'wordpress-seo' ) . '

' . '

' . __( 'Archives', 'wordpress-seo' ) . '
' . __( 'On the archives tab you can set templates for specific pages like author archives, search results and more.', 'wordpress-seo' ) . '

' . __( 'Other', 'wordpress-seo' ) . '
' . __( 'On the Other tab you can change sitewide meta settings, like enable meta keywords.', 'wordpress-seo' ), 'next_page' => 'social', 'prev_page' => 'dashboard', ); } /** * Returns the content of the social page pointer * * @return array */ private function social_pointer() { return array( 'content' => '

' . __( 'Social settings', 'wordpress-seo' ) . '

' . '

' . __( 'Facebook', 'wordpress-seo' ) . '
' . sprintf( __( 'On this tab you can enable the %1$sFacebook Open Graph%2$s functionality from this plugin, as well as assign a Facebook user or Application to be the admin of your site, so you can view the Facebook insights.', 'wordpress-seo' ), '', '' ) . '

' . '

' . __( 'The frontpage settings allow you to set meta-data for your homepage, whereas the default settings allow you to set a fallback for all posts/pages without images. ', 'wordpress-seo' ) . '

' . '

' . __( 'Twitter', 'wordpress-seo' ) . '
' . sprintf( __( 'With %1$sTwitter Cards%2$s, you can attach rich photos, videos and media experience to tweets that drive traffic to your website. Simply check the box, sign up for the service, and users who Tweet links to your content will have a “Card” added to the tweet that’s visible to all of their followers.', 'wordpress-seo' ), '', '' ) . '

' . '

' . __( 'Pinterest', 'wordpress-seo' ) . '
' . __( 'On this tab you can verify your site with Pinterest and enter your Pinterest account.', 'wordpress-seo' ) . '

' . '

' . __( 'Google+', 'wordpress-seo' ) . '
' . sprintf( __( 'If you have a Google+ page for your business, add that URL here and link it on your %1$sGoogle+%2$s page’s about page.', 'wordpress-seo' ), '', '' ) . '

', 'next_page' => 'xml', 'prev_page' => 'titles', ); } /** * Returns the content of the social page pointer * * @return array */ private function xml_sitemaps_pointer() { return array( 'content' => '

' . __( 'XML Sitemaps', 'wordpress-seo' ) . '

' . '

' . __( 'What are XML sitemaps?', 'wordpress-seo' ) . '
' . __( 'A Sitemap is an XML file that lists the URLs for a site. It allows webmasters to include additional information about each URL: when it was last updated, how often it changes, and how important it is in relation to other URLs in the site. This allows search engines to crawl the site more intelligently.', 'wordpress-seo' ) . '

' . '

' . __( 'What does the plugin do with XML Sitemaps?', 'wordpress-seo' ) . '
' . __( 'This plugin adds XML sitemaps to your site. The sitemaps are automatically updated when you publish a new post, page or custom post and Google and Bing will be automatically notified.', 'wordpress-seo' ) . '

' . '

' . __( 'If you want to exclude certain post types and/or taxonomies, you can also set that on this page.', 'wordpress-seo' ) . '

' . '

' . __( 'Is your webserver low on memory? Decrease the entries per sitemap (default: 1000) to reduce load.', 'wordpress-seo' ) . '

', 'next_page' => 'advanced', 'prev_page' => 'social', ); } /** * Returns the content of the advanced page pointer * * @return array */ private function advanced_pointer() { return array( 'content' => '

' . __( 'Advanced Settings', 'wordpress-seo' ) . '

' . __( 'All of the options on these tabs are for advanced users only, if you don’t know whether you should check any, don’t touch them.', 'wordpress-seo' ) . '

', 'next_page' => 'licenses', 'prev_page' => 'xml', ); } /** * Returns the content of the extensions and licenses page pointer * * @return array */ private function licenses_pointer() { return array( 'content' => '

' . __( 'Extensions and Licenses', 'wordpress-seo' ) . '

' . '

' . __( 'Extensions', 'wordpress-seo' ) . '
' /* translators: %1$s expands to Yoast SEO, %2$s to Yoast SEO Premium, %3$s and %4$s to an anchor with link about our premium plugins */ . sprintf( __( 'The powerful functions of %1$s can be extended with %3$sYoast premium plugins%4$s. These premium plugins require the installation of %1$s or %2$s and add specific functionality. You can read all about the Yoast Premium Plugins %3$shere%4$s.', 'wordpress-seo' ), 'Yoast SEO', 'Yoast SEO Premium', '', '' ) . '

' . '

' . __( 'Licenses', 'wordpress-seo' ) . '
' /* translators: %1$s expands to Yoast SEO Premium */ . sprintf( __( 'Once you’ve purchased %1$s or any other premium Yoast plugin, you’ll have to enter a license key. You can do so on the Licenses-tab. Once you’ve activated your premium plugin, you can use all its powerful features.', 'wordpress-seo' ), 'Yoast SEO Premium' ) . '

' . '

' . __( 'Like this plugin?', 'wordpress-seo' ) . '
' . sprintf( __( 'So, we’ve come to the end of the tour. If you like the plugin, please %srate it 5 stars on WordPress.org%s!', 'wordpress-seo' ), '', '' ) . '

' . '

' . sprintf( __( 'Thank you for using our plugin and good luck with your SEO!

Best,
Team Yoast - %1$sYoast.com%2$s', 'wordpress-seo' ), '', '' ) . '

', 'prev_page' => 'advanced', ); } /** * Extending the current page URL with two params to be able to ignore the tour. * * @return mixed */ private function get_ignore_url() { $arr_params = array( 'wpseo_restart_tour' => false, 'wpseo_ignore_tour' => '1', 'nonce' => wp_create_nonce( 'wpseo-ignore-tour' ), ); return esc_url( add_query_arg( $arr_params ) ); } } /* End of class */