コード例 #1
0
 /**
  * Shows the Yoast SEO metabox for the term.
  */
 public function display()
 {
     $content_sections = $this->get_content_sections();
     $product_title = 'Yoast SEO';
     if (file_exists(WPSEO_PATH . 'premium/')) {
         $product_title .= ' Premium';
     }
     printf('<div id="wpseo_meta" class="postbox yoast wpseo-taxonomy-metabox-postbox"><h2><span>%1$s</span></h2>', $product_title);
     echo '<div class="inside">';
     $helpcenter_tab = new WPSEO_Option_Tab('tax-metabox', 'Meta box', array('video_url' => 'https://yoa.st/metabox-taxonomy-screencast'));
     $helpcenter = new WPSEO_Help_Center('tax-metabox', $helpcenter_tab);
     $helpcenter->output_help_center();
     echo '<div id="taxonomy_overall"></div>';
     if (!defined('WPSEO_PREMIUM_FILE')) {
         echo $this->get_buy_premium_link();
     }
     echo '<div class="wpseo-metabox-sidebar"><ul>';
     foreach ($content_sections as $content_section) {
         if ($content_section->name === 'premium') {
             continue;
         }
         $content_section->display_link();
     }
     echo '</ul></div>';
     foreach ($content_sections as $content_section) {
         $content_section->display_content();
     }
     echo '</div></div>';
 }
コード例 #2
0
 /**
  * @param WPSEO_Option_Tabs $option_tabs Option Tabs to get tabs from.
  * @param Yoast_Form        $yform       Yoast Form which is being used in the views.
  * @param array             $options     Options which are being used in the views.
  */
 public function run(WPSEO_Option_Tabs $option_tabs, Yoast_Form $yform, $options = array())
 {
     echo '<h2 class="nav-tab-wrapper" id="wpseo-tabs">';
     foreach ($option_tabs->get_tabs() as $tab) {
         printf('<a class="nav-tab" id="%1$s-tab" href="#top#%1$s">%2$s</a>', $tab->get_name(), $tab->get_label());
     }
     echo '</h2>';
     foreach ($option_tabs->get_tabs() as $tab) {
         // Prepare the help center for each tab.
         $help_center = new WPSEO_Help_Center($option_tabs->get_base(), $tab);
         $identifier = $tab->get_name();
         printf('<div id="%s" class="wpseotab">', $identifier);
         // Output the help center.
         $help_center->output_help_center();
         // Output the settings view for all tabs.
         $tab_view = $this->get_tab_view($option_tabs, $tab);
         if (is_file($tab_view)) {
             require_once $tab_view;
         }
         echo '</div>';
     }
 }
コード例 #3
0
 /**
  * Loads the required scripts for the config page.
  */
 function config_page_scripts()
 {
     $this->asset_manager->enqueue_script('admin-script');
     wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'admin-script', 'wpseoAdminL10n', WPSEO_Help_Center::get_translated_texts());
     wp_enqueue_script('dashboard');
     wp_enqueue_script('thickbox');
     $page = filter_input(INPUT_GET, 'page');
     wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'admin-script', 'wpseoSelect2Locale', WPSEO_Utils::get_language(get_locale()));
     if (in_array($page, array('wpseo_social', WPSEO_Admin::PAGE_IDENTIFIER))) {
         wp_enqueue_media();
         $this->asset_manager->enqueue_script('admin-media');
         wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'admin-media', 'wpseoMediaL10n', $this->localize_media_script());
     }
     if ('wpseo_tools' === $page) {
         $this->enqueue_tools_scripts();
     }
 }
コード例 #4
0
    echo $tab['label'];
    ?>
</a>
		<?php 
}
?>

		<?php 
/**
 * Allow adding a custom import tab header
 */
do_action('wpseo_import_tab_header');
?>
	</h2>

<?php 
foreach ($tabs as $identifier => $tab) {
    printf('<div id="%s" class="wpseotab">', $identifier);
    if (!empty($tab['screencast_video_url'])) {
        $tab_video_url = $tab['screencast_video_url'];
        $helpcenter_tab = new WPSEO_Option_Tab($identifier, $tab['label'], array('video_url' => $tab['screencast_video_url']));
        $helpcenter = new WPSEO_Help_Center($identifier, $helpcenter_tab);
        $helpcenter->output_help_center();
    }
    require_once WPSEO_PATH . 'admin/views/tabs/tool/' . $identifier . '.php';
    echo '</div>';
}
/**
 * Allow adding a custom import tab
 */
do_action('wpseo_import_tab_content');
コード例 #5
0
 /**
  * Enqueues all the needed JS and CSS.
  *
  * @todo [JRF => whomever] create css/metabox-mp6.css file and add it to the below allowed colors array when done
  */
 public function enqueue()
 {
     global $pagenow;
     $asset_manager = new WPSEO_Admin_Asset_Manager();
     $is_editor = self::is_post_overview($pagenow) || self::is_post_edit($pagenow);
     /* Filter 'wpseo_always_register_metaboxes_on_admin' documented in wpseo-main.php */
     if (!$is_editor && apply_filters('wpseo_always_register_metaboxes_on_admin', false) === false || $this->is_metabox_hidden() === true) {
         return;
     }
     if (self::is_post_overview($pagenow)) {
         $asset_manager->enqueue_style('edit-page');
     } else {
         if (0 != get_queried_object_id()) {
             wp_enqueue_media(array('post' => get_queried_object_id()));
             // Enqueue files needed for upload functionality.
         }
         $asset_manager->enqueue_style('metabox-css');
         $asset_manager->enqueue_style('scoring');
         $asset_manager->enqueue_style('snippet');
         $asset_manager->enqueue_style('select2');
         $asset_manager->enqueue_style('kb-search');
         $asset_manager->enqueue_script('metabox');
         $asset_manager->enqueue_script('admin-media');
         $asset_manager->enqueue_script('post-scraper');
         $asset_manager->enqueue_script('replacevar-plugin');
         $asset_manager->enqueue_script('shortcode-plugin');
         wp_enqueue_script('jquery-ui-autocomplete');
         wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'admin-media', 'wpseoMediaL10n', $this->localize_media_script());
         wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'post-scraper', 'wpseoPostScraperL10n', $this->localize_post_scraper_script());
         wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'replacevar-plugin', 'wpseoReplaceVarsL10n', $this->localize_replace_vars_script());
         wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'shortcode-plugin', 'wpseoShortcodePluginL10n', $this->localize_shortcode_plugin_script());
         wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoAdminL10n', WPSEO_Help_Center::get_translated_texts());
         wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoSelect2Locale', WPSEO_Utils::get_language(get_locale()));
         if (post_type_supports(get_post_type(), 'thumbnail')) {
             $asset_manager->enqueue_style('featured-image');
             $asset_manager->enqueue_script('featured-image');
             $featured_image_l10 = array('featured_image_notice' => __('The featured image should be at least 200x200 pixels to be picked up by Facebook and other social media sites.', 'wordpress-seo'));
             wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoFeaturedImageL10n', $featured_image_l10);
         }
     }
 }
コード例 #6
0
/**
 * Outputs a help center.
 *
 * @param string $id The id for the tab.
 */
function render_help_center($id)
{
    $helpcenter_tab = new WPSEO_Option_Tab('bulk-' . $id, 'Bulk editor', array('video_url' => 'https://yoa.st/screencast-tools-bulk-editor'));
    $helpcenter = new WPSEO_Help_Center('bulk-editor' . $id, $helpcenter_tab);
    $helpcenter->output_help_center();
}
コード例 #7
0
 /**
  * Queue assets for taxonomy screens.
  *
  * @since 1.5.0
  */
 public function admin_enqueue_scripts()
 {
     $pagenow = $GLOBALS['pagenow'];
     if (!(self::is_term_edit($pagenow) || self::is_term_overview($pagenow))) {
         return;
     }
     $asset_manager = new WPSEO_Admin_Asset_Manager();
     $asset_manager->enqueue_style('scoring');
     $tag_id = filter_input(INPUT_GET, 'tag_ID');
     if (self::is_term_edit($pagenow) && !empty($tag_id)) {
         wp_enqueue_media();
         // Enqueue files needed for upload functionality.
         $asset_manager->enqueue_style('metabox-css');
         $asset_manager->enqueue_style('snippet');
         $asset_manager->enqueue_style('scoring');
         $asset_manager->enqueue_script('metabox');
         $asset_manager->enqueue_script('term-scraper');
         $asset_manager->enqueue_style('kb-search');
         wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'term-scraper', 'wpseoTermScraperL10n', $this->localize_term_scraper_script());
         wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'replacevar-plugin', 'wpseoReplaceVarsL10n', $this->localize_replace_vars_script());
         wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoSelect2Locale', WPSEO_Utils::get_language(get_locale()));
         wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoAdminL10n', WPSEO_Help_Center::get_translated_texts());
         $asset_manager->enqueue_script('admin-media');
         wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'admin-media', 'wpseoMediaL10n', array('choose_image' => __('Use Image', 'wordpress-seo')));
     }
 }
コード例 #8
0
ファイル: gsc-display.php プロジェクト: yoast/wordpress-seo
	<h2 class="nav-tab-wrapper" id="wpseo-tabs">
		<?php 
echo $platform_tabs = new WPSEO_GSC_Platform_Tabs();
?>
	</h2>

<?php 
// Video explains about the options when connected only.
if (null !== $this->service->get_client()->getAccessToken()) {
    $video_url = 'https://yoa.st/screencast-search-console';
} else {
    $video_url = 'https://yoa.st/screencast-connect-search-console';
}
$tab = new WPSEO_Option_Tab('GSC', __('Google Search Console'), array('video_url' => $video_url));
$GSCHelpCenter = new WPSEO_Help_Center('google-search-console', $tab);
$GSCHelpCenter->output_help_center();
switch ($platform_tabs->current_tab()) {
    case 'settings':
        // Check if there is an access token.
        if (null === $this->service->get_client()->getAccessToken()) {
            // Print auth screen.
            echo '<p>';
            /* Translators: %1$s: expands to 'Yoast SEO', %2$s expands to Google Search Console. */
            echo sprintf(__('To allow %1$s to fetch your %2$s information, please enter your Google Authorization Code. Clicking the button below will open a new window.', 'wordpress-seo'), 'Yoast SEO', 'Google Search Console');
            echo "</p>\n";
            echo '<input type="hidden" id="gsc_auth_url" value="', $this->service->get_client()->createAuthUrl(), '" />';
            echo "<button type='button' id='gsc_auth_code' class='button'>", __('Get Google Authorization Code', 'wordpress-seo'), "</button>\n";
            echo '<p id="gsc-enter-code-label">' . __('Enter your Google Authorization Code and press the Authenticate button.', 'wordpress-seo') . "</p>\n";
            echo "<form action='" . admin_url('admin.php?page=wpseo_search_console&tab=settings') . "' method='post'>\n";
            echo "<input type='text' name='gsc[authorization_code]' value='' class='textinput' aria-labelledby='gsc-enter-code-label' />";