This commit is contained in:
KhaiNguyen
2020-02-13 10:39:37 +07:00
commit 59401cb805
12867 changed files with 4646216 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views
*/
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
// To improve readability, this tab has been divided into separate blocks, included below.
require dirname( __FILE__ ) . '/archives/help.php';
$wpseo_archives = [
[
'title' => esc_html__( 'Author archives settings', 'wordpress-seo' ),
'view_file' => 'paper-content/author-archive-settings.php',
'paper_id' => 'settings-author-archives',
],
[
'title' => esc_html__( 'Date archives settings', 'wordpress-seo' ),
'view_file' => 'paper-content/date-archives-settings.php',
'paper_id' => 'settings-date-archives',
],
[
'title' => esc_html__( 'Special Pages', 'wordpress-seo' ),
'view_file' => 'paper-content/special-pages.php',
'paper_id' => 'settings-special-pages',
],
];
$recommended_replace_vars = new WPSEO_Admin_Recommended_Replace_Vars();
$editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();
foreach ( $wpseo_archives as $wpseo_archive_index => $wpseo_archive ) {
$wpseo_archive_presenter = new WPSEO_Paper_Presenter(
$wpseo_archive['title'],
dirname( __FILE__ ) . '/' . $wpseo_archive['view_file'],
[
'collapsible' => true,
'expanded' => ( $wpseo_archive_index === 0 ),
'paper_id' => $wpseo_archive['paper_id'],
'recommended_replace_vars' => $recommended_replace_vars,
'editor_specific_replace_vars' => $editor_specific_replace_vars,
'class' => 'search-appearance',
]
);
echo $wpseo_archive_presenter->get_output();
}
unset( $wpseo_archives, $wpseo_archive_presenter, $wpseo_archive_index );

View File

@@ -0,0 +1,32 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\Archive
*/
$archives_help_content = [
sprintf(
/* translators: %1$s / %2$s: links to an article about duplicate content on yoast.com */
esc_html__( 'If you\'re running a one author blog, the author archive will be exactly the same as your homepage. This is what\'s called a %1$sduplicate content problem%2$s.', 'wordpress-seo' ),
'<a target="_blank" href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/duplicate-content' ) ) . '">',
'</a>'
),
sprintf(
/* translators: %s expands to <code>noindex, follow</code> */
esc_html__( 'If this is the case on your site, you can choose to either disable it (which makes it redirect to the homepage), or to add %s to it so it doesn\'t show up in the search results.', 'wordpress-seo' ),
'<code>noindex,follow</code>'
),
esc_html__( 'Note that links to archives might be still output by your theme and you would need to remove them separately.', 'wordpress-seo' ),
esc_html__( 'Date-based archives could in some cases also be seen as duplicate content.', 'wordpress-seo' ),
];
$archives_help = new WPSEO_Admin_Help_Panel(
'search-appearance-archives',
__( 'Learn more about the archives setting', 'wordpress-seo' ),
implode( ' ', $archives_help_content ),
'has-wrapper'
);
echo '<p class="help-button-inline"><strong>' . esc_html__( 'Archives settings help', 'wordpress-seo' ) . $archives_help->get_button_html() . '</strong><p>';
echo $archives_help->get_panel_html();

View File

@@ -0,0 +1,22 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin
*/
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
$wpseo_breadcrumbs_presenter = new WPSEO_Paper_Presenter(
esc_html__( 'Breadcrumbs settings', 'wordpress-seo' ),
dirname( __FILE__ ) . '/paper-content/breadcrumbs-content.php',
[
'paper_id' => 'settings-breadcrumbs',
'class' => 'search-appearance',
]
);
echo $wpseo_breadcrumbs_presenter->get_output();

View File

@@ -0,0 +1,23 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views
*/
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
$wpseo_general_presenter = new WPSEO_Paper_Presenter(
'',
dirname( __FILE__ ) . '/paper-content/general-content.php',
[
'paper_id' => 'settings-general',
'class' => 'search-appearance',
]
);
echo $wpseo_general_presenter->get_output();

View File

@@ -0,0 +1,29 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views
*/
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
$wpseo_media_presenter = new WPSEO_Paper_Presenter(
esc_html__( 'Media & attachment URLs', 'wordpress-seo' ),
dirname( __FILE__ ) . '/paper-content/media-content.php',
[
'help_text' => new WPSEO_Admin_Help_Panel(
'search-appearance-media',
__( 'Learn more about the Media and attachment URLs setting', 'wordpress-seo' ),
__( 'When you upload media (an image or video for example) to WordPress, it doesn\'t just save the media, it creates an attachment URL for it. These attachment pages are quite empty: they contain the media item and maybe a title if you entered one. Because of that, if you never use these attachment URLs, it\'s better to disable them, and redirect them to the media item itself.', 'wordpress-seo' ),
'has-wrapper'
),
'paper_id' => 'settings-media-attachment-url',
'class' => 'search-appearance',
]
);
echo $wpseo_media_presenter->get_output();

View File

@@ -0,0 +1,85 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\Archive
*
* @uses Yoast_Form $yform Form object.
*/
$yform->toggle_switch(
'disable-author',
[
'off' => __( 'Enabled', 'wordpress-seo' ),
'on' => __( 'Disabled', 'wordpress-seo' ),
],
__( 'Author archives', 'wordpress-seo' )
);
?>
<div id='author-archives-titles-metas-content' class='archives-titles-metas-content'>
<?php
$author_archives_help = new WPSEO_Admin_Help_Panel(
'noindex-author-wpseo',
esc_html__( 'Help on the author archives search results setting', 'wordpress-seo' ),
sprintf(
/* translators: 1: expands to <code>noindex</code>; 2: link open tag; 3: link close tag. */
esc_html__( 'Not showing the archive for authors in the search results technically means those will have a %1$s robots meta and will be excluded from XML sitemaps. %2$sMore info on the search results settings%3$s.', 'wordpress-seo' ),
'<code>noindex</code>',
'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/show-x' ) ) . '" target="_blank" rel="noopener noreferrer">',
'</a>'
)
);
$yform->index_switch(
'noindex-author-wpseo',
__( 'author archives', 'wordpress-seo' ),
$author_archives_help->get_button_html() . $author_archives_help->get_panel_html()
);
?>
<div id='noindex-author-noposts-wpseo-container'>
<?php
$author_archives_no_posts_help = new WPSEO_Admin_Help_Panel(
'noindex-author-noposts-wpseo',
esc_html__( 'Help on the authors without posts archive search results setting', 'wordpress-seo' ),
sprintf(
/* translators: 1: expands to <code>noindex</code>; 2: link open tag; 3: link close tag. */
esc_html__( 'Not showing the archives for authors without posts in the search results technically means those will have a %1$s robots meta and will be excluded from XML sitemaps. %2$sMore info on the search results settings%3$s.', 'wordpress-seo' ),
'<code>noindex</code>',
'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/show-x' ) ) . '" target="_blank" rel="noopener noreferrer">',
'</a>'
)
);
$yform->index_switch(
'noindex-author-noposts-wpseo',
__( 'archives for authors without posts', 'wordpress-seo' ),
$author_archives_no_posts_help->get_button_html() . $author_archives_no_posts_help->get_panel_html()
);
?>
</div>
<?php
$recommended_replace_vars = new WPSEO_Admin_Recommended_Replace_Vars();
$editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();
$editor = new WPSEO_Replacevar_Editor(
$yform,
[
'title' => 'title-author-wpseo',
'description' => 'metadesc-author-wpseo',
'page_type_recommended' => $recommended_replace_vars->determine_for_archive( 'author' ),
'page_type_specific' => $editor_specific_replace_vars->determine_for_archive( 'author' ),
'paper_style' => false,
]
);
$editor->render();
?>
</div>

View File

@@ -0,0 +1,112 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\Breadcrumbs
*
* @uses Yoast_Form $yform Form object.
*/
if ( ! current_theme_supports( 'yoast-seo-breadcrumbs' ) ) {
$yform->light_switch( 'breadcrumbs-enable', __( 'Enable Breadcrumbs', 'wordpress-seo' ) );
echo '<br/>';
}
echo '<div id="breadcrumbsinfo">';
$yform->textinput( 'breadcrumbs-sep', __( 'Separator between breadcrumbs', 'wordpress-seo' ) );
$yform->textinput( 'breadcrumbs-home', __( 'Anchor text for the Homepage', 'wordpress-seo' ) );
$yform->textinput( 'breadcrumbs-prefix', __( 'Prefix for the breadcrumb path', 'wordpress-seo' ) );
$yform->textinput( 'breadcrumbs-archiveprefix', __( 'Prefix for Archive breadcrumbs', 'wordpress-seo' ) );
$yform->textinput( 'breadcrumbs-searchprefix', __( 'Prefix for Search Page breadcrumbs', 'wordpress-seo' ) );
$yform->textinput( 'breadcrumbs-404crumb', __( 'Breadcrumb for 404 Page', 'wordpress-seo' ) );
echo '<br/>';
if ( get_option( 'show_on_front' ) === 'page' && get_option( 'page_for_posts' ) > 0 ) {
$yform->show_hide_switch( 'breadcrumbs-display-blog-page', __( 'Show Blog page', 'wordpress-seo' ) );
}
$yoast_free_breadcrumb_bold_texts = [
'on' => __( 'Bold', 'wordpress-seo' ),
'off' => __( 'Regular', 'wordpress-seo' ),
];
$yform->toggle_switch(
'breadcrumbs-boldlast',
$yoast_free_breadcrumb_bold_texts,
__( 'Bold the last page', 'wordpress-seo' )
);
echo '<br/><br/>';
/*
* WPSEO_Post_Type::get_accessible_post_types() should *not* be used here.
* Even posts that are not indexed, should be able to get breadcrumbs for accessibility/usability.
*/
$post_types = get_post_types( [ 'public' => true ], 'objects' );
if ( is_array( $post_types ) && $post_types !== [] ) {
echo '<h2>' . esc_html__( 'Taxonomy to show in breadcrumbs for content types', 'wordpress-seo' ) . '</h2>';
foreach ( $post_types as $pt ) {
$taxonomies = get_object_taxonomies( $pt->name, 'objects' );
if ( is_array( $taxonomies ) && $taxonomies !== [] ) {
$values = [ 0 => __( 'None', 'wordpress-seo' ) ];
foreach ( $taxonomies as $tax ) {
if ( ! $tax->public ) {
continue;
}
$values[ $tax->name ] = $tax->labels->singular_name;
}
$label = $pt->labels->name . ' (<code>' . $pt->name . '</code>)';
$yform->select( 'post_types-' . $pt->name . '-maintax', $label, $values );
unset( $values, $tax );
}
unset( $taxonomies );
}
unset( $pt );
}
echo '<br/>';
$taxonomies = get_taxonomies(
[
'public' => true,
],
'objects'
);
if ( is_array( $taxonomies ) && $taxonomies !== [] ) {
echo '<h2>' . esc_html__( 'Content type archive to show in breadcrumbs for taxonomies', 'wordpress-seo' ) . '</h2>';
foreach ( $taxonomies as $tax ) {
$values = [ 0 => __( 'None', 'wordpress-seo' ) ];
if ( get_option( 'show_on_front' ) === 'page' && get_option( 'page_for_posts' ) > 0 ) {
$values['post'] = __( 'Blog', 'wordpress-seo' );
}
if ( is_array( $post_types ) && $post_types !== [] ) {
foreach ( $post_types as $pt ) {
if ( WPSEO_Post_Type::has_archive( $pt ) ) {
$values[ $pt->name ] = $pt->labels->name;
}
}
unset( $pt );
}
$label = $tax->labels->singular_name . ' (<code>' . $tax->name . '</code>)';
$yform->select( 'taxonomy-' . $tax->name . '-ptparent', $label, $values );
unset( $values, $tax );
}
}
unset( $taxonomies, $post_types );
?>
<br class="clear"/>
</div>
<h2><?php esc_html_e( 'How to insert breadcrumbs in your theme', 'wordpress-seo' ); ?></h2>
<p>
<?php
printf(
/* translators: %1$s / %2$s: links to the breadcrumbs implementation page on the Yoast knowledgebase */
esc_html__( 'Usage of this breadcrumbs feature is explained in %1$sour knowledge-base article on breadcrumbs implementation%2$s.', 'wordpress-seo' ),
'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/breadcrumbs' ) ) . '" target="_blank">',
'</a>'
);
?>
</p>

View File

@@ -0,0 +1,55 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\Archive
*
* @uses Yoast_Form $yform Form object.
*/
$yform->toggle_switch(
'disable-date',
[
'off' => __( 'Enabled', 'wordpress-seo' ),
'on' => __( 'Disabled', 'wordpress-seo' ),
],
__( 'Date archives', 'wordpress-seo' )
);
?>
<div id='date-archives-titles-metas-content' class='archives-titles-metas-content'>
<?php
$date_archives_help = new WPSEO_Admin_Help_Panel(
'noindex-archive-wpseo',
esc_html__( 'Help on the date archives search results setting', 'wordpress-seo' ),
sprintf(
/* translators: 1: expands to <code>noindex</code>; 2: link open tag; 3: link close tag. */
esc_html__( 'Not showing the date archives in the search results technically means those will have a %1$s robots meta. %2$sMore info on the search results settings%3$s.', 'wordpress-seo' ),
'<code>noindex</code>',
'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/show-x' ) ) . '" target="_blank" rel="noopener noreferrer">',
'</a>'
)
);
$yform->index_switch(
'noindex-archive-wpseo',
__( 'date archives', 'wordpress-seo' ),
$date_archives_help->get_button_html() . $date_archives_help->get_panel_html()
);
$recommended_replace_vars = new WPSEO_Admin_Recommended_Replace_Vars();
$editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();
$editor = new WPSEO_Replacevar_Editor(
$yform,
[
'title' => 'title-archive-wpseo',
'description' => 'metadesc-archive-wpseo',
'page_type_recommended' => $recommended_replace_vars->determine_for_archive( 'date' ),
'page_type_specific' => $editor_specific_replace_vars->determine_for_archive( 'date' ),
'paper_style' => false,
]
);
$editor->render();
?>
</div>

View File

@@ -0,0 +1,12 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\Media
*/
// To improve readability, this tab has been divided into separate blocks, included below.
require dirname( __FILE__ ) . '/general/force-rewrite-title.php';
require dirname( __FILE__ ) . '/general/title-separator.php';
require dirname( __FILE__ ) . '/general/homepage.php';
require dirname( __FILE__ ) . '/general/knowledge-graph.php';

View File

@@ -0,0 +1,25 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\General
*
* @uses Yoast_Form $yform Form object.
*/
if ( ! current_theme_supports( 'title-tag' ) ) {
?>
<div class="tab-block">
<?php
$yform->light_switch( 'forcerewritetitle', __( 'Force rewrite titles', 'wordpress-seo' ) );
echo '<p class="description">';
printf(
/* translators: %1$s expands to Yoast SEO */
esc_html__( '%1$s has auto-detected whether it needs to force rewrite the titles for your pages, if you think it\'s wrong and you know what you\'re doing, you can change the setting here.', 'wordpress-seo' ),
'Yoast SEO'
);
echo '</p>';
?>
</div>
<?php
}

View File

@@ -0,0 +1,58 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\General
*
* @uses Yoast_Form $yform Form object.
*/
?>
<div class="tab-block">
<?php
if ( get_option( 'show_on_front' ) === 'posts' ) {
$homepage_help = new WPSEO_Admin_Help_Panel(
'search-appearance-homepage',
__( 'Learn more about the homepage setting', 'wordpress-seo' ),
__( 'This is what shows in the search results when people find your homepage. This means this is probably what they see when they search for your brand name.', 'wordpress-seo' ),
'has-wrapper'
);
echo '<h2 class="help-button-inline">', esc_html__( 'Homepage', 'wordpress-seo' ), $homepage_help->get_button_html(), '</h2>';
echo $homepage_help->get_panel_html();
$editor = new WPSEO_Replacevar_Editor(
$yform,
[
'title' => 'title-home-wpseo',
'description' => 'metadesc-home-wpseo',
'page_type_recommended' => 'homepage',
'page_type_specific' => 'page',
'paper_style' => false,
]
);
$editor->render();
}
else {
echo '<h2>', esc_html__( 'Homepage &amp; Front page', 'wordpress-seo' ), '</h2>';
echo '<p>';
printf(
/* translators: 1: link open tag; 2: link close tag. */
esc_html__( 'You can determine the title and description for the front page by %1$sediting the front page itself%2$s.', 'wordpress-seo' ),
'<a href="' . esc_url( get_edit_post_link( get_option( 'page_on_front' ) ) ) . '">',
'</a>'
);
echo '</p>';
if ( get_option( 'page_for_posts' ) > 0 ) {
echo '<p>';
printf(
/* translators: 1: link open tag; 2: link close tag. */
esc_html__( 'You can determine the title and description for the blog page by %1$sediting the blog page itself%2$s.', 'wordpress-seo' ),
'<a href="' . esc_url( get_edit_post_link( get_option( 'page_for_posts' ) ) ) . '">',
'</a>'
);
echo '</p>';
}
}
?>
</div>

View File

@@ -0,0 +1,75 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\General
*
* @uses Yoast_Form $yform Form object.
*/
$knowledge_graph_help = new WPSEO_Admin_Help_Panel(
'search-appearance-knowledge-graph',
__( 'Learn more about the knowledge graph setting', 'wordpress-seo' ),
sprintf(
/* translators: %1$s opens the link to the Yoast.com article about Google's Knowledge Graph, %2$s closes the link, */
__( 'This data is shown as metadata in your site. It is intended to appear in %1$sGoogle\'s Knowledge Graph%2$s. You can be either an organization, or a person.', 'wordpress-seo' ),
'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/1-p' ) ) . '" target="_blank" rel="noopener noreferrer">',
'</a>'
),
'has-wrapper'
);
?>
<div class="tab-block">
<h2 class="help-button-inline"><?php echo esc_html__( 'Knowledge Graph & Schema.org', 'wordpress-seo' ) . $knowledge_graph_help->get_button_html(); ?></h2>
<?php
echo $knowledge_graph_help->get_panel_html();
/**
* Filter: 'wpseo_knowledge_graph_setting_msg' - Allows adding a message above these settings.
*
* @api string unsigned Message.
*/
$message = apply_filters( 'wpseo_knowledge_graph_setting_msg', '' );
if ( ! empty( $message ) ) {
echo '<p><strong>', esc_html( $message ), '</strong></p>';
}
?>
<p>
<?php esc_html_e( 'Choose whether the site represents an organization or a person.', 'wordpress-seo' ); ?>
</p>
<?php
$yoast_free_kg_select_options = [
'company' => __( 'Organization', 'wordpress-seo' ),
'person' => __( 'Person', 'wordpress-seo' ),
];
$yform->select( 'company_or_person', __( 'Organization or person', 'wordpress-seo' ), $yoast_free_kg_select_options, 'styled', false );
?>
<div id="knowledge-graph-company">
<?php
/*
* Render the `knowledge-graph-company-warning` div when the company name or logo are not set.
* This div is used as React render root in `js/src/search-appearance.js`.
*/
$yoast_seo_company_name = WPSEO_Options::get( 'company_name', '' );
$yoast_seo_company_logo = WPSEO_Options::get( 'company_logo', '' );
if ( empty( $yoast_seo_company_name ) || empty( $yoast_seo_company_logo ) ) :
?>
<div id="knowledge-graph-company-warning"></div>
<?php endif; ?>
<h3><?php esc_html_e( 'Organization', 'wordpress-seo' ); ?></h3>
<?php
$yform->textinput( 'company_name', __( 'Organization name', 'wordpress-seo' ), [ 'autocomplete' => 'organization' ] );
$yform->media_input( 'company_logo', __( 'Organization logo', 'wordpress-seo' ) );
?>
<div id="wpseo-local-seo-upsell"></div>
</div>
<div id="knowledge-graph-person">
<h3><?php esc_html_e( 'Personal info', 'wordpress-seo' ); ?></h3>
<?php
echo '<div id="wpseo-person-selector"></div>';
$yform->media_input( 'person_logo', __( 'Person logo / avatar', 'wordpress-seo' ) );
$yform->hidden( 'company_or_person_user_id', 'person_id' );
?>
</div>
</div>

View File

@@ -0,0 +1,25 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\General
*
* @uses Yoast_Form $yform Form object.
*/
$title_separator_help = new WPSEO_Admin_Help_Panel(
'search-appearance-title-separator',
__( 'Learn more about the title separator setting', 'wordpress-seo' ),
__( 'Choose the symbol to use as your title separator. This will display, for instance, between your post title and site name. Symbols are shown in the size they\'ll appear in the search results.', 'wordpress-seo' ),
'has-wrapper'
);
?>
<div class="tab-block">
<h2 class="help-button-inline"><?php echo esc_html__( 'Title Separator', 'wordpress-seo' ) . $title_separator_help->get_button_html(); ?></h2>
<?php
echo $title_separator_help->get_panel_html();
$legend = __( 'Title separator symbol', 'wordpress-seo' );
$legend_attr = [ 'class' => 'radiogroup screen-reader-text' ];
$yform->radio( 'separator', WPSEO_Option_Titles::get_instance()->get_separator_options_for_display(), $legend, $legend_attr );
?>
</div>

View File

@@ -0,0 +1,51 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\Media
*
* @uses Yoast_Form $yform Form object.
*/
$wpseo_post_type = get_post_type_object( 'attachment' );
$recommended_replace_vars = new WPSEO_Admin_Recommended_Replace_Vars();
$editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();
$view_utils = new Yoast_View_Utils();
?>
<p><strong><?php esc_html_e( 'We recommend you set this to Yes.', 'wordpress-seo' ); ?></strong></p>
<?php
$yoast_free_disable_attachments_texts = [
'on' => __( 'Yes', 'wordpress-seo' ),
'off' => __( 'No', 'wordpress-seo' ),
];
$yform->toggle_switch(
'disable-attachment',
$yoast_free_disable_attachments_texts,
__( 'Redirect attachment URLs to the attachment itself?', 'wordpress-seo' )
);
?>
<div id="media_settings">
<br/>
<br/>
<?php
$noindex_option_name = 'noindex-' . $wpseo_post_type->name;
if ( WPSEO_Options::get( 'is-media-purge-relevant' ) && WPSEO_Options::get( $noindex_option_name ) === false ) {
$description =
esc_html__( 'By enabling this option, attachment URLs become visible to both your visitors and Google. To add value to your website, they should contain useful information, or they might have a negative impact on your ranking.', 'wordpress-seo' ) . ' ' .
sprintf(
/* translators: %1$s expands to the link to the article, %2$s closes the link to the article */
esc_html__( 'Please carefully consider the implications and %1$sread this post%2$s if you want more information about the impact of showing media in search results.', 'wordpress-seo' ),
'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/2r8' ) ) . '" rel="noopener noreferrer" target="_blank">',
'</a>'
);
echo '<div style="clear:both; background-color: #ffeb3b; color: #000000; padding: 16px; max-width: 450px; margin-bottom: 32px;">' . $description . '</div>';
}
require dirname( __FILE__ ) . '/post_type/post-type.php';
?>
</div>

View File

@@ -0,0 +1,73 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\Taxonomies
*
* @uses Yoast_Form $yform Form object.
* @uses WP_Post_Type $wpseo_post_type
* @uses Yoast_View_Utils $view_utils
* @uses WPSEO_Admin_Recommended_Replace_Vars $recommended_replace_vars
* @uses WPSEO_Admin_Editor_Specific_Replace_Vars $editor_specific_replace_vars
*/
$single_label = $wpseo_post_type->labels->singular_name;
$paper_style = false;
/* translators: %s is the singular version of the post type's name. */
echo '<h3>' . esc_html( sprintf( __( 'Settings for single %s URLs', 'wordpress-seo' ), $wpseo_post_type->labels->singular_name ) ) . '</h3>';
require dirname( __FILE__ ) . '/post_type/post-type.php';
if ( $wpseo_post_type->name === 'product' && WPSEO_Utils::is_woocommerce_active() ) {
require dirname( __FILE__ ) . '/post_type/woocommerce-shop-page.php';
return;
}
if ( WPSEO_Post_Type::has_archive( $wpseo_post_type ) ) {
$plural_label = $wpseo_post_type->labels->name;
/* translators: %s is the plural version of the post type's name. */
echo '<h3>' . esc_html( sprintf( __( 'Settings for %s archive', 'wordpress-seo' ), $plural_label ) ) . '</h3>';
$custom_post_type_archive_help = $view_utils->search_results_setting_help( $wpseo_post_type, 'archive' );
$yform->index_switch(
'noindex-ptarchive-' . $wpseo_post_type->name,
sprintf(
/* translators: %s expands to the post type's name. */
__( 'the archive for %s', 'wordpress-seo' ),
$plural_label
),
$custom_post_type_archive_help->get_button_html() . $custom_post_type_archive_help->get_panel_html()
);
$page_type = $recommended_replace_vars->determine_for_archive( $wpseo_post_type->name );
$editor = new WPSEO_Replacevar_Editor(
$yform,
[
'title' => 'title-ptarchive-' . $wpseo_post_type->name,
'description' => 'metadesc-ptarchive-' . $wpseo_post_type->name,
'page_type_recommended' => $recommended_replace_vars->determine_for_archive( $wpseo_post_type->name ),
'page_type_specific' => $editor_specific_replace_vars->determine_for_archive( $wpseo_post_type->name ),
'paper_style' => false,
]
);
$editor->render();
if ( WPSEO_Options::get( 'breadcrumbs-enable' ) === true ) {
/* translators: %s is the plural version of the post type's name. */
echo '<h4>' . esc_html( sprintf( __( 'Breadcrumb settings for %s archive', 'wordpress-seo' ), $plural_label ) ) . '</h4>';
$yform->textinput( 'bctitle-ptarchive-' . $wpseo_post_type->name, __( 'Breadcrumbs title', 'wordpress-seo' ) );
}
}
/**
* Allow adding a custom checkboxes to the admin meta page - Post Types tab.
*
* @api WPSEO_Admin_Pages $yform The WPSEO_Admin_Pages object
* @api String $name The post type name
*/
do_action( 'wpseo_admin_page_meta_post_types', $yform, $wpseo_post_type->name );

View File

@@ -0,0 +1,45 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\PaperContent
*
* @uses Yoast_Form $yform Form object.
* @uses WP_Taxonomy $wpseo_post_type
* @uses Yoast_View_Utils $view_utils
* @uses WPSEO_Admin_Recommended_Replace_Vars $recommended_replace_vars
* @uses WPSEO_Admin_Editor_Specific_Replace_Vars $editor_specific_replace_vars
*/
$show_post_type_help = $view_utils->search_results_setting_help( $wpseo_post_type );
$noindex_option_name = 'noindex-' . $wpseo_post_type->name;
$yform->index_switch(
$noindex_option_name,
$wpseo_post_type->labels->name,
$show_post_type_help->get_button_html() . $show_post_type_help->get_panel_html()
);
$yform->show_hide_switch(
'showdate-' . $wpseo_post_type->name,
__( 'Date in Google Preview', 'wordpress-seo' )
);
$yform->show_hide_switch(
'display-metabox-pt-' . $wpseo_post_type->name,
/* translators: %1$s expands to Yoast SEO */
sprintf( __( '%1$s Meta Box', 'wordpress-seo' ), 'Yoast SEO' )
);
$editor = new WPSEO_Replacevar_Editor(
$yform,
[
'title' => 'title-' . $wpseo_post_type->name,
'description' => 'metadesc-' . $wpseo_post_type->name,
'page_type_recommended' => $recommended_replace_vars->determine_for_post_type( $wpseo_post_type->name ),
'page_type_specific' => $editor_specific_replace_vars->determine_for_post_type( $wpseo_post_type->name ),
'paper_style' => false,
]
);
$editor->render();

View File

@@ -0,0 +1,24 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\General
*
* @uses WP_Post_Type $wpseo_post_type
*/
$woocommerce_shop_page = new WPSEO_WooCommerce_Shop_Page();
$description = __( 'You haven\'t set a Shop page in your WooCommerce settings. Please do this first.', 'wordpress-seo' );
if ( $woocommerce_shop_page->get_shop_page_id() !== -1 ) {
$description = sprintf(
/* translators: %1$s expands to an opening anchor tag, %2$s expands to a closing anchor tag. */
__( 'You can edit the SEO meta-data for this custom type on the %1$sShop page%2$s.', 'wordpress-seo' ),
'<a href="' . get_edit_post_link( $woocommerce_shop_page->get_shop_page_id() ) . '">',
'</a>'
);
}
/* translators: %s expands to the post type name. */
echo '<h3>' . esc_html( sprintf( __( 'Settings for %s archive', 'wordpress-seo' ), $wpseo_post_type->labels->name ) ) . '</h3>';
echo '<p>' . $description . '</p>';

View File

@@ -0,0 +1,52 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\Rss
*
* @uses Yoast_Form $yform Form object.
*/
$textarea_atts = [
'cols' => '50',
'rows' => '5',
];
$yform->textarea( 'rssbefore', __( 'Content to put before each post in the feed', 'wordpress-seo' ), $textarea_atts );
$yform->textarea( 'rssafter', __( 'Content to put after each post in the feed', 'wordpress-seo' ), $textarea_atts );
$rss_variables_help = new WPSEO_Admin_Help_Panel(
'search-appearance-rss-variables',
__( 'Learn more about the available variables', 'wordpress-seo' ),
__( 'You can use the following variables within the content, they will be replaced by the value on the right.', 'wordpress-seo' ),
'has-wrapper'
);
echo '<h2 class="help-button-inline">' . esc_html__( 'Available variables', 'wordpress-seo' ) . $rss_variables_help->get_button_html() . '</h2>';
echo $rss_variables_help->get_panel_html();
?>
<table class="wpseo yoast_help yoast-table-scrollable">
<thead>
<tr>
<th scope="col"><?php esc_html_e( 'Variable', 'wordpress-seo' ); ?></th>
<th scope="col"><?php esc_html_e( 'Description', 'wordpress-seo' ); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td class="yoast-variable-name">%%AUTHORLINK%%</td>
<td class="yoast-variable-desc"><?php esc_html_e( 'A link to the archive for the post author, with the authors name as anchor text.', 'wordpress-seo' ); ?></td>
</tr>
<tr>
<td class="yoast-variable-name">%%POSTLINK%%</td>
<td class="yoast-variable-desc"><?php esc_html_e( 'A link to the post, with the title as anchor text.', 'wordpress-seo' ); ?></td>
</tr>
<tr>
<td class="yoast-variable-name">%%BLOGLINK%%</td>
<td class="yoast-variable-desc"><?php esc_html_e( "A link to your site, with your site's name as anchor text.", 'wordpress-seo' ); ?></td>
</tr>
<tr>
<td class="yoast-variable-name">%%BLOGDESCLINK%%</td>
<td class="yoast-variable-desc"><?php esc_html_e( "A link to your site, with your site's name and description as anchor text.", 'wordpress-seo' ); ?></td>
</tr>
</tbody>
</table>

View File

@@ -0,0 +1,27 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\Archive
*
* @uses Yoast_Form $yform Form object.
*/
$special_pages_help = new WPSEO_Admin_Help_Panel(
'search-appearance-special-pages',
__( 'Learn more about the special pages setting', 'wordpress-seo' ),
sprintf(
/* translators: %s expands to <code>noindex, follow</code>. */
__( 'These pages will be %s by default, so they will never show up in search results.', 'wordpress-seo' ),
'<code>noindex, follow</code>'
),
'has-wrapper'
);
$editor = new WPSEO_Replacevar_Field( $yform, 'title-search-wpseo', __( 'Search pages', 'wordpress-seo' ), 'search', 'search' );
$editor->render();
echo '<br/>';
$editor = new WPSEO_Replacevar_Field( $yform, 'title-404-wpseo', __( '404 pages', 'wordpress-seo' ), '404', '404' );
$editor->render();

View File

@@ -0,0 +1,63 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\Taxonomies
*
* @uses Yoast_Form $yform Form object.
* @uses WP_Taxonomy $wpseo_taxonomy
* @uses Yoast_View_Utils $view_utils
* @uses string $title
* @uses WPSEO_Admin_Recommended_Replace_Vars $recommended_replace_vars
* @uses WPSEO_Admin_Editor_Specific_Replace_Vars $editor_specific_replace_vars
*/
if ( $wpseo_taxonomy->name === 'post_format' ) {
$yform->light_switch(
'disable-post_format',
__( 'Format-based archives', 'wordpress-seo' ),
[ __( 'Enabled', 'wordpress-seo' ), __( 'Disabled', 'wordpress-seo' ) ],
false
);
}
echo "<div id='" . esc_attr( $wpseo_taxonomy->name ) . "-titles-metas'>";
$taxonomies_help = $view_utils->search_results_setting_help( $wpseo_taxonomy );
$yform->index_switch(
'noindex-tax-' . $wpseo_taxonomy->name,
$title,
$taxonomies_help->get_button_html() . $taxonomies_help->get_panel_html()
);
// Determine the page type for the term, this is needed for the recommended replacement variables.
$page_type = $recommended_replace_vars->determine_for_term( $wpseo_taxonomy->name );
$editor = new WPSEO_Replacevar_Editor(
$yform,
[
'title' => 'title-tax-' . $wpseo_taxonomy->name,
'description' => 'metadesc-tax-' . $wpseo_taxonomy->name,
'page_type_recommended' => $recommended_replace_vars->determine_for_term( $wpseo_taxonomy->name ),
'page_type_specific' => $editor_specific_replace_vars->determine_for_term( $wpseo_taxonomy->name ),
'paper_style' => false,
]
);
$editor->render();
if ( $wpseo_taxonomy->name !== 'post_format' ) {
/* translators: %1$s expands to Yoast SEO */
$yform->show_hide_switch( 'display-metabox-tax-' . $wpseo_taxonomy->name, sprintf( __( '%1$s Meta Box', 'wordpress-seo' ), 'Yoast SEO' ) );
}
/**
* Allow adding custom checkboxes to the admin meta page - Taxonomies tab.
*
* @api WPSEO_Admin_Pages $yform The WPSEO_Admin_Pages object
* @api Object $tax The taxonomy
*/
do_action( 'wpseo_admin_page_meta_taxonomies', $yform, $wpseo_taxonomy );
echo '</div>';

View File

@@ -0,0 +1,55 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views
*/
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
/*
* WPSEO_Post_Type::get_accessible_post_types() should *not* be used here.
* Otherwise setting a post-type to `noindex` will remove it from the list,
* making it very hard to restore the setting again.
*/
$wpseo_post_types = get_post_types( [ 'public' => true ], 'objects' );
// We'll show attachments on the Media tab.
$wpseo_post_types = WPSEO_Post_Type::filter_attachment_post_type( $wpseo_post_types );
echo '<p>';
esc_html_e( 'The settings on this page allow you to specify what the default search appearance should be for any type of content you have. You can choose which content types appear in search results and what their default description should be.', 'wordpress-seo' );
echo '</p>';
if ( is_array( $wpseo_post_types ) && $wpseo_post_types !== [] ) {
$view_utils = new Yoast_View_Utils();
$recommended_replace_vars = new WPSEO_Admin_Recommended_Replace_Vars();
$editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();
foreach ( array_values( $wpseo_post_types ) as $wpseo_post_type_index => $post_type ) {
$wpseo_post_type_presenter = new WPSEO_Paper_Presenter(
$post_type->labels->name,
dirname( __FILE__ ) . '/paper-content/post-type-content.php',
[
'collapsible' => true,
'expanded' => ( $wpseo_post_type_index === 0 ),
'paper_id' => 'settings-' . $post_type->name,
'view_data' => [
'wpseo_post_type' => $post_type,
'view_utils' => $view_utils,
'recommended_replace_vars' => $recommended_replace_vars,
'editor_specific_replace_vars' => $editor_specific_replace_vars,
],
'title' => $post_type->labels->name,
'title_after' => ' (<code>' . esc_html( $post_type->name ) . '</code>)',
'class' => 'search-appearance',
]
);
echo $wpseo_post_type_presenter->get_output();
}
}

View File

@@ -0,0 +1,29 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin
*/
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
$wpseo_rss_presenter = new WPSEO_Paper_Presenter(
esc_html__( 'RSS feed settings', 'wordpress-seo' ),
dirname( __FILE__ ) . '/paper-content/rss-content.php',
[
'help_text' => new WPSEO_Admin_Help_Panel(
'search-appearance-rss',
__( 'Learn more about the RSS feed setting', 'wordpress-seo' ),
__( 'This feature is used to automatically add content to your RSS, more specifically, it\'s meant to add links back to your blog and your blog posts, so dumb scrapers will automatically add these links too, helping search engines identify you as the original source of the content.', 'wordpress-seo' ),
'has-wrapper'
),
'paper_id' => 'settings-rss-feed',
'class' => 'search-appearance',
]
);
echo $wpseo_rss_presenter->get_output();

View File

@@ -0,0 +1,50 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views
*/
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
$wpseo_taxonomies = get_taxonomies( [ 'public' => true ], 'objects' );
if ( is_array( $wpseo_taxonomies ) && $wpseo_taxonomies !== [] ) {
$view_utils = new Yoast_View_Utils();
$recommended_replace_vars = new WPSEO_Admin_Recommended_Replace_Vars();
$editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();
// Explicitly hide all the core taxonomies we never want to do stuff for.
$wpseo_taxonomies = array_diff_key( $wpseo_taxonomies, array_flip( [ 'link_category', 'nav_menu' ] ) );
foreach ( array_values( $wpseo_taxonomies ) as $wpseo_taxonomy_index => $wpseo_taxonomy ) {
$wpseo_taxonomy_presenter = new WPSEO_Paper_Presenter(
$wpseo_taxonomy->labels->name,
dirname( __FILE__ ) . '/paper-content/taxonomy-content.php',
[
'collapsible' => true,
'expanded' => ( $wpseo_taxonomy_index === 0 ),
'paper_id' => 'settings-' . $wpseo_taxonomy->name,
'view_data' => [
'wpseo_taxonomy' => $wpseo_taxonomy,
'view_utils' => $view_utils,
'recommended_replace_vars' => $recommended_replace_vars,
'editor_specific_replace_vars' => $editor_specific_replace_vars,
],
'title_after' => ' (<code>' . esc_html( $wpseo_taxonomy->name ) . '</code>)',
'class' => 'search-appearance',
]
);
echo $wpseo_taxonomy_presenter->get_output();
}
unset( $wpseo_taxonomy_index, $wpseo_taxonomy_presenter, $view_utils, $recommended_replace_vars );
}
unset( $wpseo_taxonomies );
printf( '<h2>%s</h2>', esc_html__( 'Category URLs', 'wordpress-seo' ) );
require dirname( __FILE__ ) . '/taxonomies/category-url.php';

View File

@@ -0,0 +1,28 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Views\Taxonomies
*
* @uses Yoast_Form $yform Form object.
*/
$remove_buttons = [ __( 'Keep', 'wordpress-seo' ), __( 'Remove', 'wordpress-seo' ) ];
$stripcategorybase_help = new WPSEO_Admin_Help_Panel(
'opengraph',
esc_html__( 'Help on the category prefix setting', 'wordpress-seo' ),
sprintf(
/* translators: %s expands to <code>/category/</code> */
esc_html__( 'Category URLs in WordPress contain a prefix, usually %s, this feature removes that prefix, for categories only.', 'wordpress-seo' ),
'<code>/category/</code>'
)
);
$yform->light_switch(
'stripcategorybase',
__( 'Remove the categories prefix', 'wordpress-seo' ),
$remove_buttons,
false,
$stripcategorybase_help->get_button_html() . $stripcategorybase_help->get_panel_html()
);