diff --git a/admin/class-collapsible-presenter.php b/admin/class-collapsible-presenter.php index 6d6459ffba7..8d9eb99444f 100644 --- a/admin/class-collapsible-presenter.php +++ b/admin/class-collapsible-presenter.php @@ -22,7 +22,7 @@ public function __construct( $title, $view_file = '', array $settings = [] ) { $defaults = [ 'paper_id' => null, 'paper_id_prefix' => 'wpseo-', - 'collapsible' => false, + 'collapsible' => true, 'collapsible_header_class' => '', 'expanded' => false, 'help_button' => '', diff --git a/admin/class-premium-upsell-admin-block.php b/admin/class-premium-upsell-admin-block.php index 47eeb588a42..362cd0972fb 100644 --- a/admin/class-premium-upsell-admin-block.php +++ b/admin/class-premium-upsell-admin-block.php @@ -75,7 +75,7 @@ public function render() { $button_text ); - echo '
'; + echo '
'; echo '
'; echo '

' . diff --git a/admin/class-yoast-form.php b/admin/class-yoast-form.php index ad37916ccb7..91f3a4aff01 100644 --- a/admin/class-yoast-form.php +++ b/admin/class-yoast-form.php @@ -75,7 +75,7 @@ public function admin_header( $form = true, $option = 'wpseo', $contains_files = */ require_once ABSPATH . 'wp-admin/options-head.php'; ?> -

+

'; - submit_button( __( 'Save changes', 'wordpress-seo' ), 'yoast-button yoast-button--primary' ); - $settings_changed_listener->show_success_message(); + + submit_button( __( 'Save changes', 'wordpress-seo' ), 'yoast-button yoast-button--primary' ); echo '
'; echo PHP_EOL . ''; @@ -224,7 +224,9 @@ public function legend( $text, $attr ) { $attr = wp_parse_args( $attr, $defaults ); $id = ( $attr['id'] === '' ) ? '' : ' id="' . esc_attr( $attr['id'] ) . '"'; + echo '
'; echo '' . $text . ''; + echo '
'; } /** @@ -307,9 +309,12 @@ public function light_switch( $var, $label, $buttons = [], $help = '', $inverse $class .= '--inverse'; } - if ( empty( $buttons ) ) { $buttons = [ __( 'Disabled', 'wordpress-seo' ), __( 'Enabled', 'wordpress-seo' ) ]; + + if ( $inverse ) { + $buttons = array_reverse( $buttons ); + } } list( $off_button, $on_button ) = $buttons; @@ -358,7 +363,7 @@ public function light_switch_disabled( $var, $label, $buttons = [], $help = '', '', '', '
', - '', __( 'Upgrade to premium', 'wordpress-seo' ) ,'', + '', __( 'Upgrade to Premium', 'wordpress-seo' ) ,'', '
'; } @@ -410,12 +415,19 @@ public function textinput( $var, $label, $attr = [] ) { Yoast_Input_Validation::set_error_descriptions(); $aria_attributes .= Yoast_Input_Validation::get_the_aria_describedby_attribute( $var ); - echo 'is_control_disabled( $var ), true, false ), '/>', '
'; + echo 'is_control_disabled( $var ), true, false ), '/>'; + + if ( ! empty( $attr['html_after'] ) ) { + echo $attr['html_after']; + } + + echo '
'; echo Yoast_Input_Validation::get_the_error_description( $var ); } @@ -622,7 +634,6 @@ public function media_input( $var, $label ) { ' value="', esc_attr( $id_value ), '"', ' />'; echo ''; - echo '
'; } /** @@ -643,7 +654,7 @@ public function radio( $var, $values, $legend = '', $legend_attr = [] ) { $var_esc = esc_attr( $var ); - echo '
'; + echo '
'; if ( is_string( $legend ) && $legend !== '' ) { @@ -667,15 +678,10 @@ public function radio( $var, $values, $legend = '', $legend_attr = [] ) { } $key_esc = esc_attr( $key ); + echo '
'; echo 'is_control_disabled( $var ), true, false ) . ' />'; - $this->label( - $label, - [ - 'for' => $var_esc . '-' . $key_esc, - 'class' => 'radio', - 'aria_label' => $aria_label, - ] - ); + echo ''; + echo '
'; } echo '
'; } @@ -823,21 +829,15 @@ public function toggle_switch( $var, $values, $label, $help = '' ) { * @return void */ public function index_switch( $var, $label, $help = '' ) { - $index_switch_values = [ - __( 'Yes', 'wordpress-seo' ), - __( 'No', 'wordpress-seo' ), - ]; - - $this->light_switch( + $this->show_hide_switch( $var, sprintf( /* translators: %s expands to an indexable object's name, like a post type or taxonomy */ esc_html__( 'Show %s in search results?', 'wordpress-seo' ), esc_html( $label ) ), - $index_switch_values, - $help, - true + true, + $help ); } @@ -852,12 +852,16 @@ public function index_switch( $var, $label, $help = '' ) { * @return void */ public function show_hide_switch( $var, $label, $inverse_keys = false, $help = '' ) { - $show_hide_switch = [ + $labels = [ __( 'Hide', 'wordpress-seo' ), __( 'Show', 'wordpress-seo' ), ]; - $this->light_switch( $var, $label, $show_hide_switch, $help, $inverse_keys ); + if ( $inverse_keys ) { + $labels = array_reverse( $labels ); + } + + $this->light_switch( $var, $label, $labels, $help, $inverse_keys ); } /** diff --git a/admin/pages/tools.php b/admin/pages/tools.php index 143bcc692a7..199ffaf9554 100644 --- a/admin/pages/tools.php +++ b/admin/pages/tools.php @@ -12,67 +12,30 @@ } $tool_page = (string) filter_input( INPUT_GET, 'tool' ); +$admin_url = admin_url( 'admin.php?page=wpseo_tools' ); -$yform = Yoast_Form::get_instance(); -$yform->admin_header( false, 'tools' ); - -if ( $tool_page === '' ) { - - $tools = []; - - $tools['import-export'] = [ - 'title' => __( 'Import and Export', 'wordpress-seo' ), - 'desc' => __( 'Import settings from other SEO plugins and export your settings for re-use on (another) blog.', 'wordpress-seo' ), - ]; - - if ( WPSEO_Utils::allow_system_file_edit() === true && ! is_multisite() ) { - $tools['file-editor'] = [ - 'title' => __( 'File editor', 'wordpress-seo' ), - 'desc' => __( 'This tool allows you to quickly change important files for your SEO, like your robots.txt and, if you have one, your .htaccess file.', 'wordpress-seo' ), - ]; - } - - $tools['bulk-editor'] = [ - 'title' => __( 'Bulk editor', 'wordpress-seo' ), - 'desc' => __( 'This tool allows you to quickly change titles and descriptions of your posts and pages without having to go into the editor for each page.', 'wordpress-seo' ), - ]; - - echo '

'; - printf( - /* translators: %1$s expands to Yoast SEO */ - esc_html__( '%1$s comes with some very powerful built-in tools:', 'wordpress-seo' ), - 'Yoast SEO' - ); - echo '

'; - - echo ''; +$yform = Yoast_Form::get_instance(); +$yform->admin_header( false, 'tools' ); - echo ''; -} -else { - echo '', esc_html__( '« Back to Tools page', 'wordpress-seo' ), ''; +require_once WPSEO_PATH . 'admin/views/tools-navigation.php'; +if ( ! empty( $tool_page ) ) { $tool_pages = [ 'bulk-editor', 'import-export' ]; - if ( WPSEO_Utils::allow_system_file_edit() === true && ! is_multisite() ) { $tool_pages[] = 'file-editor'; } @@ -80,6 +43,27 @@ if ( in_array( $tool_page, $tool_pages, true ) ) { require_once WPSEO_PATH . 'admin/views/tool-' . $tool_page . '.php'; } + + $yform->admin_footer( false ); + + return; } +echo '
'; + +echo ''; + +echo ''; + +echo '
'; // yoast-paper. + $yform->admin_footer( false ); diff --git a/admin/views/class-view-utils.php b/admin/views/class-view-utils.php index 0c908e89d63..0c009623a4f 100644 --- a/admin/views/class-view-utils.php +++ b/admin/views/class-view-utils.php @@ -58,7 +58,7 @@ public function show_post_type_settings( $post_type, $paper_style = false ) { $this->form->show_hide_switch( 'showdate-' . $post_type->name, - __( 'Date in Google Preview', 'wordpress-seo' ) + __( 'Show date in Google Preview', 'wordpress-seo' ) ); $this->form->show_hide_switch( diff --git a/admin/views/class-yoast-feature-toggles.php b/admin/views/class-yoast-feature-toggles.php index fd88b427fb1..780e2183734 100644 --- a/admin/views/class-yoast-feature-toggles.php +++ b/admin/views/class-yoast-feature-toggles.php @@ -129,6 +129,17 @@ protected function load_toggles() { 'read_more_url' => 'https://yoa.st/40r', 'order' => 90, ], + (object) [ + 'name' => __( 'Usage tracking', 'wordpress-seo' ), + 'setting' => 'tracking', + 'read_more_label' => sprintf( + /* translators: 1: Yoast SEO */ + __( 'Allow us to track some data about your site to improve our plugin.', 'wordpress-seo' ), + 'Yoast SEO' + ), + 'read_more_url' => 'https://yoa.st/usage-tracking', + 'order' => 95, + ], (object) [ 'name' => __( 'REST API: Head endpoint', 'wordpress-seo' ), 'setting' => 'enable_headless_rest_endpoints', diff --git a/admin/views/partial-notifications-template.php b/admin/views/partial-notifications-template.php index 2c9d1d27bf9..f4355903621 100644 --- a/admin/views/partial-notifications-template.php +++ b/admin/views/partial-notifications-template.php @@ -30,7 +30,6 @@ function _yoast_display_notifications( $list, $status ) { $notifications = ''; foreach ( $list as $notification ) { - switch ( $status ) { case 'active': $button = sprintf( @@ -76,12 +75,11 @@ function _yoast_display_notifications( $list, $status ) {
-
- -
+ + +


-
-
-

- -

-
- - - + +
+

+ +

+
+ - +
+ + + + + - + +

-

- - " target="_blank"> - -

+ printf( esc_html__( 'Check out %1$s', 'wordpress-seo' ), 'Yoast SEO academy' ); ?>

+ diff --git a/admin/views/tabs/dashboard/dashboard.php b/admin/views/tabs/dashboard/dashboard.php index 0f8055fd324..137f34d0539 100644 --- a/admin/views/tabs/dashboard/dashboard.php +++ b/admin/views/tabs/dashboard/dashboard.php @@ -25,11 +25,10 @@ ?> -
- -
- -
+
+
+ +
@@ -37,8 +36,10 @@
-

-

- -

+
+

+

+ +

+
diff --git a/admin/views/tabs/dashboard/features.php b/admin/views/tabs/dashboard/features.php index 73b69081958..0a58b729eab 100644 --- a/admin/views/tabs/dashboard/features.php +++ b/admin/views/tabs/dashboard/features.php @@ -17,8 +17,8 @@ $yoast_features = new WPSEO_Features(); ?> -

-
+
+

'; +echo '

'; echo '

' . esc_html__( 'Webmaster Tools verification', 'wordpress-seo' ) . $webmaster_tools_help . '

'; $msverify_link = 'https://www.bing.com/toolbox/webmaster/#/Dashboard/?url=' . @@ -32,9 +32,7 @@ 'https://www.google.com/webmasters/verification/verification' ); -$yform->textinput( 'baiduverify', __( 'Baidu verification code', 'wordpress-seo' ) ); -echo '

'; -printf( +$context = '

' . sprintf( /* translators: %1$s expands to a link start tag to the Baidu Webmaster Tools site add page, %2$s is the link closing tag. */ esc_html__( 'Get your Baidu verification code in %1$sBaidu Webmaster Tools%2$s.', 'wordpress-seo' ), /** @@ -44,36 +42,33 @@ */ '', '' -); -echo '

'; +) . '

'; +$yform->textinput( 'baiduverify', __( 'Baidu verification code', 'wordpress-seo' ), [ 'html_after' => $context ] ); + -$yform->textinput( 'msverify', __( 'Bing verification code', 'wordpress-seo' ) ); -echo '

'; -printf( +$context = '

' . +sprintf( /* translators: 1: link open tag; 2: link close tag. */ esc_html__( 'Get your Bing verification code in %1$sBing Webmaster Tools%2$s.', 'wordpress-seo' ), '', '' -); -echo '

'; +) . '

'; +$yform->textinput( 'msverify', __( 'Bing verification code', 'wordpress-seo' ), [ 'html_after' => $context ] ); -$yform->textinput( 'googleverify', __( 'Google verification code', 'wordpress-seo' ) ); -echo '

'; -printf( +$context = '

' . sprintf( /* translators: 1: link open tag; 2: link close tag. */ esc_html__( 'Get your Google verification code in %1$sGoogle Search Console%2$s.', 'wordpress-seo' ), '', '' -); -echo '

'; +) . '

'; +$yform->textinput( 'googleverify', __( 'Google verification code', 'wordpress-seo' ), [ 'html_after' => $context ] ); -$yform->textinput( 'yandexverify', __( 'Yandex verification code', 'wordpress-seo' ) ); -echo '

'; -printf( +$context = '

' . sprintf( /* translators: 1: link open tag; 2: link close tag. */ esc_html__( 'Get your Yandex verification code in %1$sYandex Webmaster Tools%2$s.', 'wordpress-seo' ), '', '' -); -echo '

'; +) . '

'; +$yform->textinput( 'yandexverify', __( 'Yandex verification code', 'wordpress-seo' ), [ 'html_after' => $context ] ); + echo '
'; diff --git a/admin/views/tabs/metas/archives.php b/admin/views/tabs/metas/archives.php index 16d96ff6304..50374bef397 100644 --- a/admin/views/tabs/metas/archives.php +++ b/admin/views/tabs/metas/archives.php @@ -38,11 +38,11 @@ __DIR__ . '/' . $wpseo_archive['view_file'], [ 'collapsible' => true, - 'expanded' => ( $wpseo_archive_index === 0 ), + 'expanded' => false, 'paper_id' => $wpseo_archive['paper_id'], 'recommended_replace_vars' => $recommended_replace_vars, 'editor_specific_replace_vars' => $editor_specific_replace_vars, - 'class' => 'search-appearance', + 'class' => 'search-appearance search-appearance--bottom', ] ); diff --git a/admin/views/tabs/metas/paper-content/author-archive-settings.php b/admin/views/tabs/metas/paper-content/author-archive-settings.php index 0daa6eaaacb..3895b9a5b6e 100644 --- a/admin/views/tabs/metas/paper-content/author-archive-settings.php +++ b/admin/views/tabs/metas/paper-content/author-archive-settings.php @@ -10,19 +10,13 @@ $yform->light_switch( 'disable-author', __( 'Author archives', 'wordpress-seo' ), - [ - __( 'Enabled', 'wordpress-seo' ), - __( 'Disabled', 'wordpress-seo' ), - ], + [], false, true ); -?> - -
+echo '
'; - - -
-'; $author_archives_no_posts_help = new WPSEO_Admin_Help_Button( 'https://yoast.com/show-x-in-search-results/', @@ -50,10 +41,7 @@ $author_archives_no_posts_help ); -?> -
- -'; // noindex-container. $recommended_replace_vars = new WPSEO_Admin_Recommended_Replace_Vars(); $editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars(); @@ -69,5 +57,5 @@ ); $editor->render(); -?> -
+ +echo '
'; // author-archives. diff --git a/admin/views/tabs/metas/paper-content/breadcrumbs-content.php b/admin/views/tabs/metas/paper-content/breadcrumbs-content.php index 72303db5f28..257f0653528 100644 --- a/admin/views/tabs/metas/paper-content/breadcrumbs-content.php +++ b/admin/views/tabs/metas/paper-content/breadcrumbs-content.php @@ -23,7 +23,10 @@ echo '
'; 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' ) ); + $yform->show_hide_switch( + 'breadcrumbs-display-blog-page', + __( 'Show Blog page', 'wordpress-seo' ) + ); } $yoast_free_breadcrumb_bold_texts = [ @@ -33,7 +36,7 @@ $yform->light_switch( 'breadcrumbs-boldlast', __( 'Bold the last page', 'wordpress-seo' ), $yoast_free_breadcrumb_bold_texts ); -echo '

'; +echo '
'; /* * WPSEO_Post_Type::get_accessible_post_types() should *not* be used here. @@ -61,7 +64,6 @@ } unset( $pt ); } -echo '
'; $taxonomies = get_taxonomies( [ @@ -94,8 +96,9 @@ unset( $taxonomies, $post_types ); ?> -
+

+

light_switch( 'disable-date', __( 'Date archives', 'wordpress-seo' ), - [ - __( 'Enabled', 'wordpress-seo' ), - __( 'Disabled', 'wordpress-seo' ), - ], + [], false, true ); -?> -

- index_switch( - 'noindex-archive-wpseo', - __( 'date archives', 'wordpress-seo' ), - $date_archives_help - ); - - $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(); - ?> -
+echo '
'; + +echo '
'; + +$date_archives_help = new WPSEO_Admin_Help_Button( + 'https://yoa.st/show-x', + esc_html__( 'Help on the date archives search results setting', 'wordpress-seo' ) +); + +$yform->index_switch( + 'noindex-archive-wpseo', + __( 'date archives', 'wordpress-seo' ), + $date_archives_help +); + +echo '
'; // space-after. + +$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(); + +echo '
'; // archives-content. + diff --git a/admin/views/tabs/metas/paper-content/general/force-rewrite-title.php b/admin/views/tabs/metas/paper-content/general/force-rewrite-title.php index fb9a36d0667..98b82676d37 100644 --- a/admin/views/tabs/metas/paper-content/general/force-rewrite-title.php +++ b/admin/views/tabs/metas/paper-content/general/force-rewrite-title.php @@ -9,7 +9,7 @@ if ( ! current_theme_supports( 'title-tag' ) ) { ?> -
+
light_switch( 'forcerewritetitle', __( 'Force rewrite titles', 'wordpress-seo' ) ); echo '

'; diff --git a/admin/views/tabs/metas/paper-content/general/homepage.php b/admin/views/tabs/metas/paper-content/general/homepage.php index 333f66279e5..5521392eb29 100644 --- a/admin/views/tabs/metas/paper-content/general/homepage.php +++ b/admin/views/tabs/metas/paper-content/general/homepage.php @@ -8,7 +8,7 @@ */ ?> -

+
-
diff --git a/admin/views/tabs/metas/paper-content/general/knowledge-graph.php b/admin/views/tabs/metas/paper-content/general/knowledge-graph.php index 9952c16d66b..84e2b3d30d5 100644 --- a/admin/views/tabs/metas/paper-content/general/knowledge-graph.php +++ b/admin/views/tabs/metas/paper-content/general/knowledge-graph.php @@ -12,7 +12,7 @@ __( 'Learn more about the knowledge graph setting', 'wordpress-seo' ) ); ?> -
+

__( 'Organization', 'wordpress-seo' ), 'person' => __( 'Person', 'wordpress-seo' ), ]; - $yform->select( 'company_or_person', __( 'Organization or person', 'wordpress-seo' ), $yoast_free_kg_select_options, 'styled', false ); + + $yform->radio( + 'company_or_person', + $yoast_free_kg_select_options, + __( 'Organization or person', 'wordpress-seo' ) + ); ?> +

-
+

title_separator( 'separator', WPSEO_Option_Titles::get_instance()->get_separator_options_for_display(), $legend, $legend_attr ); ?>
-
diff --git a/admin/views/tabs/metas/paper-content/media-content.php b/admin/views/tabs/metas/paper-content/media-content.php index dd2fe192460..faebe2e6f01 100644 --- a/admin/views/tabs/metas/paper-content/media-content.php +++ b/admin/views/tabs/metas/paper-content/media-content.php @@ -18,27 +18,28 @@ ); ?> -
+

-

+

', + '' + ); ?>

light_switch( 'disable-attachment', __( 'Redirect attachment URLs to the attachment itself?', 'wordpress-seo' ), - $yoast_free_disable_attachments_texts, - false, - true + [ + __( 'No', 'wordpress-seo' ), + __( 'Yes', 'wordpress-seo' ), + ] ); ?> -
+
name; diff --git a/admin/views/tabs/metas/paper-content/post-type-archive-content.php b/admin/views/tabs/metas/paper-content/post-type-archive-content.php new file mode 100644 index 00000000000..11003336264 --- /dev/null +++ b/admin/views/tabs/metas/paper-content/post-type-archive-content.php @@ -0,0 +1,48 @@ +labels->singular_name; +$paper_style = false; +$has_archive = WPSEO_Post_Type::has_archive( $wpseo_post_type ); + + +$plural_label = $wpseo_post_type->labels->name; + +$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 + ), + $view_utils->search_results_setting_help() +); + +$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 ) { + echo '

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

'; + $yform->textinput( 'bctitle-ptarchive-' . $wpseo_post_type->name, __( 'Breadcrumbs title', 'wordpress-seo' ) ); +} diff --git a/admin/views/tabs/metas/paper-content/post-type-content.php b/admin/views/tabs/metas/paper-content/post-type-content.php index 0184a089140..a3c284d53ec 100644 --- a/admin/views/tabs/metas/paper-content/post-type-content.php +++ b/admin/views/tabs/metas/paper-content/post-type-content.php @@ -13,9 +13,7 @@ $single_label = $wpseo_post_type->labels->singular_name; $paper_style = false; - -/* translators: %s is the singular version of the post type's name. */ -echo '

' . esc_html( sprintf( __( 'Settings for single %s URLs', 'wordpress-seo' ), $wpseo_post_type->labels->singular_name ) ) . '

'; +$has_archive = WPSEO_Post_Type::has_archive( $wpseo_post_type ); require __DIR__ . '/post_type/post-type.php'; @@ -25,43 +23,6 @@ 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 '

' . esc_html( sprintf( __( 'Settings for %s archive', 'wordpress-seo' ), $plural_label ) ) . '

'; - - $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 - ), - $view_utils->search_results_setting_help() - ); - - $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 '

' . esc_html( sprintf( __( 'Breadcrumb settings for %s archive', 'wordpress-seo' ), $plural_label ) ) . '

'; - $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. * diff --git a/admin/views/tabs/metas/paper-content/post_type/post-type.php b/admin/views/tabs/metas/paper-content/post_type/post-type.php index e7abee5bd5e..0ffb3a69d3d 100644 --- a/admin/views/tabs/metas/paper-content/post_type/post-type.php +++ b/admin/views/tabs/metas/paper-content/post_type/post-type.php @@ -21,7 +21,7 @@ $yform->show_hide_switch( 'showdate-' . $wpseo_post_type->name, - __( 'Date in Google Preview', 'wordpress-seo' ) + __( 'Show date in Google Preview', 'wordpress-seo' ) ); $yform->show_hide_switch( diff --git a/admin/views/tabs/metas/paper-content/rss-content.php b/admin/views/tabs/metas/paper-content/rss-content.php index 5cfcfaf72a8..b83bcbac052 100644 --- a/admin/views/tabs/metas/paper-content/rss-content.php +++ b/admin/views/tabs/metas/paper-content/rss-content.php @@ -7,6 +7,15 @@ * @uses Yoast_Form $yform Form object. */ +echo '
'; + +$rss_help = new WPSEO_Admin_Help_Button( + 'https://yoa.st/3ym', + __( 'Learn more about the RSS feed setting', 'wordpress-seo' ) +); + +echo '

' . esc_html__( 'RSS feed settings', 'wordpress-seo' ) . $rss_help . '

'; + $textarea_atts = [ 'cols' => '50', 'rows' => '5', @@ -19,9 +28,13 @@ __( 'Learn more about the available variables', 'wordpress-seo' ) ); +echo '
'; // yoast-paper. + +echo '
'; + echo '

' . esc_html__( 'Available variables', 'wordpress-seo' ) . $rss_variables_help . '

'; ?> - +
@@ -47,3 +60,5 @@
+ +
diff --git a/admin/views/tabs/metas/paper-content/special-pages.php b/admin/views/tabs/metas/paper-content/special-pages.php index d839a5bcaf8..63f78d0392e 100644 --- a/admin/views/tabs/metas/paper-content/special-pages.php +++ b/admin/views/tabs/metas/paper-content/special-pages.php @@ -21,7 +21,7 @@ $editor = new WPSEO_Replacevar_Field( $yform, 'title-search-wpseo', __( 'Search pages', 'wordpress-seo' ), 'search', 'search' ); $editor->render(); -echo '
'; - $editor = new WPSEO_Replacevar_Field( $yform, 'title-404-wpseo', __( '404 pages', 'wordpress-seo' ), '404', '404' ); $editor->render(); + +echo '
'; diff --git a/admin/views/tabs/metas/paper-content/taxonomy-content.php b/admin/views/tabs/metas/paper-content/taxonomy-content.php index b3330c60698..cb814d1cbc0 100644 --- a/admin/views/tabs/metas/paper-content/taxonomy-content.php +++ b/admin/views/tabs/metas/paper-content/taxonomy-content.php @@ -16,7 +16,7 @@ $yform->light_switch( 'disable-post_format', __( 'Format-based archives', 'wordpress-seo' ), - [ __( 'Enabled', 'wordpress-seo' ), __( 'Disabled', 'wordpress-seo' ) ], + [], false, false ); @@ -30,6 +30,13 @@ $view_utils->search_results_setting_help() ); +if ( $wpseo_taxonomy->name !== 'post_format' ) { + $yform->show_hide_switch( + 'display-metabox-tax-' . $wpseo_taxonomy->name, + /* translators: %s expands to an indexable object's name, like a post type or taxonomy */ + sprintf( __( 'Show SEO settings for %1$s', 'wordpress-seo' ), $title ) + ); +} // 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 ); @@ -46,14 +53,6 @@ ); $editor->render(); -if ( $wpseo_taxonomy->name !== 'post_format' ) { - $yform->show_hide_switch( - 'display-metabox-tax-' . $wpseo_taxonomy->name, - /* translators: %s expands to an indexable object's name, like a post type or taxonomy */ - sprintf( __( 'Show SEO settings for %1$s', 'wordpress-seo' ), $title ) - ); -} - /** * Allow adding custom checkboxes to the admin meta page - Taxonomies tab. * diff --git a/admin/views/tabs/metas/post-types.php b/admin/views/tabs/metas/post-types.php index 50c569c66d5..bcb8b9a6d17 100644 --- a/admin/views/tabs/metas/post-types.php +++ b/admin/views/tabs/metas/post-types.php @@ -32,7 +32,7 @@ __DIR__ . '/paper-content/post-type-content.php', [ 'collapsible' => true, - 'expanded' => ( $wpseo_post_type_index === 0 ), + 'expanded' => false, 'paper_id' => 'settings-' . $post_type->name, 'view_data' => [ 'wpseo_post_type' => $post_type, @@ -42,10 +42,39 @@ ], 'title' => $post_type->labels->name, 'title_after' => ' (' . esc_html( $post_type->name ) . ')', - 'class' => 'search-appearance', + 'class' => 'search-appearance search-appearance--bottom', ] ); echo $wpseo_post_type_presenter->get_output(); + + // We're done if there is no archive. + if ( ! WPSEO_Post_Type::has_archive( $post_type ) ) { + continue; + } + + /* translators: %s is the plural version of the post type's name. */ + $label = sprintf( __( '%1$s archives', 'wordpress-seo' ), $post_type->labels->name ); + + $wpseo_post_type_archive_presenter = new WPSEO_Collapsible_Presenter( + $label, + __DIR__ . '/paper-content/post-type-archive-content.php', + [ + 'collapsible' => true, + 'expanded' => false, + 'paper_id' => 'archive-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' => $label, + 'title_after' => ' (' . esc_html( $post_type->name ) . ')', + 'class' => 'search-appearance search-appearance--bottom', + ] + ); + + echo $wpseo_post_type_archive_presenter->get_output(); } } diff --git a/admin/views/tabs/metas/taxonomies.php b/admin/views/tabs/metas/taxonomies.php index d53edc08da5..6fbf7e09324 100644 --- a/admin/views/tabs/metas/taxonomies.php +++ b/admin/views/tabs/metas/taxonomies.php @@ -26,7 +26,7 @@ __DIR__ . '/paper-content/taxonomy-content.php', [ 'collapsible' => true, - 'expanded' => ( $wpseo_taxonomy_index === 0 ), + 'expanded' => false, 'paper_id' => 'settings-' . $wpseo_taxonomy->name, 'view_data' => [ 'wpseo_taxonomy' => $wpseo_taxonomy, @@ -35,7 +35,7 @@ 'editor_specific_replace_vars' => $editor_specific_replace_vars, ], 'title_after' => ' (' . esc_html( $wpseo_taxonomy->name ) . ')', - 'class' => 'search-appearance', + 'class' => 'search-appearance search-appearance--bottom', ] ); echo $wpseo_taxonomy_presenter->get_output(); @@ -46,7 +46,14 @@ unset( $wpseo_taxonomies ); -echo '
'; -printf( '

%s

', esc_html__( 'Category URLs', 'wordpress-seo' ) ); -require __DIR__ . '/taxonomies/category-url.php'; -echo '
'; + +$wpseo_taxonomy_presenter = new WPSEO_Collapsible_Presenter( + __( 'Category URLs', 'wordpress-seo' ), + __DIR__ . '/taxonomies/category-url.php', + [ + 'collapsible' => true, + 'expanded' => false, + 'paper_id' => 'taxonomies-category-urls', + ] +); +echo $wpseo_taxonomy_presenter->get_output(); diff --git a/admin/views/tabs/social/accounts.php b/admin/views/tabs/social/accounts.php index 1db14efb6dc..e1b81f4f5be 100644 --- a/admin/views/tabs/social/accounts.php +++ b/admin/views/tabs/social/accounts.php @@ -12,7 +12,7 @@ header( 'HTTP/1.1 403 Forbidden' ); exit(); } -echo '
'; +echo '
'; $social_profiles_help = new WPSEO_Admin_Help_Button( 'https://yoa.st/3yo', __( 'Learn more about your social profiles settings', 'wordpress-seo' ) @@ -103,4 +103,5 @@ } do_action( 'wpseo_admin_other_section' ); + echo '
'; diff --git a/admin/views/tabs/social/facebook.php b/admin/views/tabs/social/facebook.php index 4652b170c40..a1c3d691b88 100644 --- a/admin/views/tabs/social/facebook.php +++ b/admin/views/tabs/social/facebook.php @@ -12,7 +12,7 @@ header( 'HTTP/1.1 403 Forbidden' ); exit(); } -echo '
'; +echo '
'; echo '

' . esc_html__( 'Facebook settings', 'wordpress-seo' ) . '

'; $yform->light_switch( 'opengraph', __( 'Add Open Graph meta data', 'wordpress-seo' ) ); @@ -63,6 +63,7 @@ $yform->media_input( 'og_default_image', __( 'Image URL', 'wordpress-seo' ) ); ?> +

diff --git a/admin/views/tabs/social/pinterest.php b/admin/views/tabs/social/pinterest.php index 8973ab9b077..37860a6b25f 100644 --- a/admin/views/tabs/social/pinterest.php +++ b/admin/views/tabs/social/pinterest.php @@ -13,7 +13,7 @@ exit(); } -echo '
'; +echo '
'; echo '

' . esc_html__( 'Pinterest settings', 'wordpress-seo' ) . '

'; printf( diff --git a/admin/views/tabs/social/twitterbox.php b/admin/views/tabs/social/twitterbox.php index 3a0dc9630b2..73495ce5f7d 100644 --- a/admin/views/tabs/social/twitterbox.php +++ b/admin/views/tabs/social/twitterbox.php @@ -13,7 +13,7 @@ header( 'HTTP/1.1 403 Forbidden' ); exit(); } -echo '
'; +echo '
'; echo '

' . esc_html__( 'Twitter settings', 'wordpress-seo' ) . '

'; printf( @@ -21,15 +21,23 @@ esc_html__( 'Twitter uses Open Graph metadata just like Facebook, so be sure to keep the "Add Open Graph meta data" setting on the Facebook tab enabled if you want to optimize your site for Twitter.', 'wordpress-seo' ) ); -$yform->light_switch( 'twitter', __( 'Add Twitter card meta data', 'wordpress-seo' ) ); - echo '

'; esc_html_e( 'Enable this feature if you want Twitter to display a preview with images and a text excerpt when a link to your site is shared.', 'wordpress-seo' ); echo '

'; -echo '
'; +$yform->light_switch( + 'twitter', + __( 'Twitter card meta data', 'wordpress-seo' ) +); + +echo '
'; +$yform->radio( + 'twitter_card_type', + WPSEO_Option_Social::$twitter_card_types, + __( 'The default card type to use', 'wordpress-seo' ) +); +echo '
'; // twitter-settings. -$yform->select( 'twitter_card_type', __( 'The default card type to use', 'wordpress-seo' ), WPSEO_Option_Social::$twitter_card_types ); echo '
'; do_action( 'wpseo_admin_twitter_section' ); diff --git a/admin/views/tabs/tool/bulk-editor-table.php b/admin/views/tabs/tool/bulk-editor-table.php new file mode 100644 index 00000000000..946a732558e --- /dev/null +++ b/admin/views/tabs/tool/bulk-editor-table.php @@ -0,0 +1,26 @@ + +
+ show_page(); + ?> +
+ 0 ) { + $contentht = fread( $f, filesize( $ht_access_file ) ); + } + + if ( ! is_writable( $ht_access_file ) ) { + echo '

'; + printf( + /* translators: %s expands to ".htaccess". */ + esc_html__( 'If your %s were writable, you could edit it from here.', 'wordpress-seo' ), + '.htaccess' + ); + echo '

'; + echo '
'; + } + else { + echo '
'; + wp_nonce_field( 'wpseo-htaccess', '_wpnonce', true, true ); + echo '
'; + echo ''; + echo '
'; + echo '
'; + printf( + '

', + sprintf( + /* translators: %s expands to ".htaccess". */ + esc_attr__( 'Save changes to %s', 'wordpress-seo' ), + '.htaccess' + ) + ); + echo '
'; + } +} +else { + echo '

'; + printf( + /* translators: %s expands to ".htaccess". */ + esc_html__( 'If you had a %s file and it was editable, you could edit it from here.', 'wordpress-seo' ), + '.htaccess' + ); + echo '

'; +} diff --git a/admin/views/tabs/tool/file-editor-robots.php b/admin/views/tabs/tool/file-editor-robots.php new file mode 100644 index 00000000000..299c2bdabf3 --- /dev/null +++ b/admin/views/tabs/tool/file-editor-robots.php @@ -0,0 +1,85 @@ +'; + +if ( ! file_exists( $robots_file ) ) { + if ( is_writable( get_home_path() ) ) { + echo '
'; + wp_nonce_field( 'wpseo_create_robots', '_wpnonce', true, true ); + echo '

'; + printf( + /* translators: %s expands to robots.txt. */ + esc_html__( 'You don\'t have a %s file, create one here:', 'wordpress-seo' ), + 'robots.txt' + ); + echo '

'; + + printf( + '

', + sprintf( + /* translators: %s expands to robots.txt. */ + esc_attr__( 'Create %s file', 'wordpress-seo' ), + 'robots.txt' + ) + ); + echo '
'; + } + else { + echo '

'; + printf( + /* translators: %s expands to robots.txt. */ + esc_html__( 'If you had a %s file and it was editable, you could edit it from here.', 'wordpress-seo' ), + 'robots.txt' + ); + echo '

'; + } +} +else { + $f = fopen( $robots_file, 'r' ); + + $content = ''; + if ( filesize( $robots_file ) > 0 ) { + $content = fread( $f, filesize( $robots_file ) ); + } + + if ( ! is_writable( $robots_file ) ) { + echo '

'; + printf( + /* translators: %s expands to robots.txt. */ + esc_html__( 'If your %s were writable, you could edit it from here.', 'wordpress-seo' ), + 'robots.txt' + ); + echo '

'; + echo '
'; + } + else { + echo '
'; + wp_nonce_field( 'wpseo-robotstxt', '_wpnonce', true, true ); + echo '
'; + echo ''; + echo '
'; + echo '
'; + printf( + '

', + sprintf( + /* translators: %s expands to robots.txt. */ + esc_attr__( 'Save changes to %s', 'wordpress-seo' ), + 'robots.txt' + ) + ); + echo '
'; + } +} + +echo '
'; // yoast-field-group. diff --git a/admin/views/tabs/tool/import-seo.php b/admin/views/tabs/tool/import-seo.php index 76e4828718d..fcb6f7e2a79 100644 --- a/admin/views/tabs/tool/import-seo.php +++ b/admin/views/tabs/tool/import-seo.php @@ -15,13 +15,13 @@ $import_check = new WPSEO_Import_Plugins_Detector(); $import_check->detect(); if ( count( $import_check->needs_import ) === 0 ) { - echo '

', esc_html__( 'Import from other SEO plugins', 'wordpress-seo' ), '

'; echo '

'; printf( /* translators: %s expands to Yoast SEO */ esc_html__( '%s did not detect any plugin data from plugins it can import from.', 'wordpress-seo' ), 'Yoast SEO' ); + echo '

'; return; @@ -48,81 +48,78 @@ function wpseo_import_external_select( $name, $plugins ) { } ?> -

-
+

+ +

+ +
+

- +

+
-
-

-

- -

-
- -
-

-

+

+

+

+ +

+
+
+ needs_import ); + ?> -

- -
- needs_import ); - ?> - - -
- -
+ +
+ +
-
-

-

- -

-
+
+

+

+ +

+
-
-

-

+

+

+

+ ', + '' + ); + ?> +

+
+ +
+

+

+ +

+
+
', - '' - ); + wp_nonce_field( 'wpseo-clean-plugins', '_wpnonce', true, true ); + wpseo_import_external_select( 'clean_external_plugin', $import_check->needs_import ); ?> -

-
- -
-

-

- -

- -
- needs_import ); - ?> - -
- -
+ +
+
diff --git a/admin/views/tabs/tool/wpseo-export.php b/admin/views/tabs/tool/wpseo-export.php index 47834567124..78c40e58e92 100644 --- a/admin/views/tabs/tool/wpseo-export.php +++ b/admin/views/tabs/tool/wpseo-export.php @@ -14,8 +14,6 @@ /* translators: %1$s expands to Yoast SEO */ $submit_button_value = sprintf( __( 'Export your %1$s settings', 'wordpress-seo' ), 'Yoast SEO' ); -echo '
'; - if ( filter_input( INPUT_POST, 'do_export' ) ) { $export = new WPSEO_Export(); $export->export(); @@ -29,15 +27,14 @@ ); ?> -

-
- - -

- -

-
-
+

+
+ + +

+ +

+
diff --git a/admin/views/tabs/tool/wpseo-import.php b/admin/views/tabs/tool/wpseo-import.php index 88540530b4f..ea4e06a50cb 100644 --- a/admin/views/tabs/tool/wpseo-import.php +++ b/admin/views/tabs/tool/wpseo-import.php @@ -16,39 +16,39 @@ return; } ?> -
-

- -

-
-
- -
- -
- +

+ +

+ + +
+ +
+
-

- -

- -
+ +
+
+

+ +

+ diff --git a/admin/views/tool-bulk-editor.php b/admin/views/tool-bulk-editor.php index 87c2d137560..b6e4e3ee60a 100644 --- a/admin/views/tool-bulk-editor.php +++ b/admin/views/tool-bulk-editor.php @@ -76,22 +76,6 @@ function yoast_free_bulk_sanitize_input_fields() { exit; } -/** - * Renders a bulk editor tab. - * - * @param WPSEO_Bulk_List_Table $table The table to render. - * @param string $id The id for the tab. - */ -function wpseo_get_rendered_tab( $table, $id ) { - ?> -
- show_page(); - ?> -
-