Make WordPress Core

Ticket #49264: 49264.3.diff

File 49264.3.diff, 29.1 KB (added by xkon, 5 years ago)
  • src/js/_enqueues/admin/privacy-tools.js

    diff --git a/src/js/_enqueues/admin/privacy-tools.js b/src/js/_enqueues/admin/privacy-tools.js
    index 802ec88f4b..ee8dabf0ba 100644
    a b jQuery( document ).ready( function( $ ) { 
    7777
    7878                        appendResultsAfterRow( $requestRow, 'notice-success', summaryMessage, [] );
    7979                        $this.hide();
    80                        
     80
    8181                        if ( 'undefined' !== typeof zipUrl ) {
    8282                                window.location = zipUrl;
    8383                        } else if ( ! sendAsEmail ) {
    jQuery( document ).ready( function( $ ) { 
    259259                        }
    260260                }
    261261        });
     262
     263        /**
     264         * Handle the new JS for the revamped Policy Settings
     265         */
     266        $( 'body.options-privacy-php label[for=create-page]' ).on( 'click', function( e ) {
     267                e.preventDefault();
     268                $( 'input#create-page' ).focus();
     269        } );
     270
     271        // Accordion handling in various areas.
     272        $( '.privacy-settings-accordion' ).on( 'click', '.privacy-settings-accordion-trigger', function() {
     273                var isExpanded = ( 'true' === $( this ).attr( 'aria-expanded' ) );
     274
     275                if ( isExpanded ) {
     276                        $( this ).attr( 'aria-expanded', 'false' );
     277                        $( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', true );
     278                } else {
     279                        $( this ).attr( 'aria-expanded', 'true' );
     280                        $( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', false );
     281                }
     282        } );
    262283});
    263284
  • src/wp-admin/css/common.css

    diff --git a/src/wp-admin/css/common.css b/src/wp-admin/css/common.css
    index a8b8112b00..b3d78393ee 100644
    a b img { 
    40644064                text-align: left;
    40654065        }
    40664066}
     4067
     4068/**
     4069* Privacy Settings section
     4070*/
     4071
     4072/* General */
     4073.privacy-settings #wpcontent,
     4074.privacy-settings.auto-fold #wpcontent {
     4075        padding-left: 0;
     4076}
     4077
     4078.privacy-settings-header h1 {
     4079        display: inline-block;
     4080        font-weight: 600;
     4081        margin: 0 0.8rem 1rem;
     4082        font-size: 23px;
     4083        padding: 9px 0 4px 0;
     4084        line-height: 1.3;
     4085}
     4086
     4087.privacy-settings-body h2 {
     4088        padding: 1rem 0;
     4089        line-height: 1.4;
     4090}
     4091
     4092.privacy-settings-body h3 {
     4093        padding: 0;
     4094        font-weight: 400;
     4095}
     4096
     4097/* Header */
     4098.privacy-settings-header {
     4099        text-align: center;
     4100        margin: 0 0 1rem;
     4101        background: #fff;
     4102        border-bottom: 1px solid #e2e4e7;
     4103}
     4104
     4105.privacy-settings-title-section {
     4106        display: flex;
     4107        align-items: center;
     4108        justify-content: center;
     4109        clear: both;
     4110}
     4111
     4112.privacy-settings-tabs-wrapper {
     4113        /* IE 11 */
     4114        display: -ms-inline-grid;
     4115        -ms-grid-columns: 1fr 1fr;
     4116        vertical-align: top;
     4117        /* modern browsers */
     4118        display: inline-grid;
     4119        grid-template-columns: 1fr 1fr;
     4120}
     4121
     4122.privacy-settings-tab {
     4123        display: block; /* IE 11 */
     4124        text-decoration: none;
     4125        color: inherit;
     4126        padding: 0.5rem 1rem 1rem;
     4127        margin: 0 1rem;
     4128        transition: box-shadow 0.5s ease-in-out;
     4129}
     4130
     4131.privacy-settings-tab:nth-child(1) {
     4132        -ms-grid-column: 1; /* IE 11 */
     4133}
     4134
     4135.privacy-settings-tab:nth-child(2) {
     4136        -ms-grid-column: 2; /* IE 11 */
     4137}
     4138
     4139.privacy-settings-tab:focus {
     4140        color: #191e23;
     4141        outline: 1px solid #6c7781;
     4142        box-shadow: none;
     4143}
     4144
     4145.privacy-settings-tab.active {
     4146        box-shadow: inset 0 -3px #007cba;
     4147        font-weight: 600;
     4148}
     4149
     4150/* Body */
     4151.privacy-settings-body {
     4152        max-width: 800px;
     4153        margin: 0 auto;
     4154}
     4155
     4156.tools-privacy-policy-page th {
     4157        min-width: 230px;
     4158}
     4159
     4160.hr-separator {
     4161        margin-top: 20px;
     4162        margin-bottom: 15px;
     4163}
     4164
     4165/* Accordions */
     4166.privacy-settings-accordion {
     4167        border: 1px solid #ccd0d4;
     4168}
     4169
     4170.privacy-settings-accordion-heading {
     4171        margin: 0;
     4172        border-top: 1px solid #ccd0d4;
     4173        font-size: inherit;
     4174        line-height: inherit;
     4175        font-weight: 600;
     4176        color: inherit;
     4177}
     4178
     4179.privacy-settings-accordion-heading:first-child {
     4180        border-top: none;
     4181}
     4182
     4183.privacy-settings-accordion-trigger {
     4184        background: #fff;
     4185        border: 0;
     4186        color: #32373c;
     4187        cursor: pointer;
     4188        display: flex;
     4189        font-weight: 400;
     4190        margin: 0;
     4191        padding: 1em 3.5em 1em 1.5em;
     4192        min-height: 46px;
     4193        position: relative;
     4194        text-align: left;
     4195        width: 100%;
     4196        align-items: center;
     4197        justify-content: space-between;
     4198}
     4199
     4200.privacy-settings-accordion-trigger:hover,
     4201.privacy-settings-accordion-trigger:active {
     4202        background: #f8f9f9;
     4203}
     4204
     4205.privacy-settings-accordion-trigger:focus {
     4206        color: #191e23;
     4207        border: none;
     4208        box-shadow: none;
     4209        outline-offset: -2px;
     4210        outline: 1px dotted #555d66;
     4211}
     4212
     4213.privacy-settings-accordion-trigger .title {
     4214        pointer-events: none;
     4215        font-weight: 600;
     4216        flex-grow: 1;
     4217}
     4218
     4219.privacy-settings-accordion-trigger .icon,
     4220.privacy-settings-view-read .icon {
     4221        border: solid #555d66;
     4222        border-width: 0 2px 2px 0;
     4223        height: 0.5rem;
     4224        pointer-events: none;
     4225        position: absolute;
     4226        right: 1.5em;
     4227        top: 50%;
     4228        transform: translateY(-70%) rotate(45deg);
     4229        width: 0.5rem;
     4230}
     4231
     4232.privacy-settings-accordion-trigger .badge {
     4233        padding: 0.1rem 0.5rem 0.15rem;
     4234        color: #32373c;
     4235        font-weight: 600;
     4236        margin-left: 0.5rem;
     4237}
     4238
     4239.privacy-settings-accordion-trigger .badge.blue {
     4240        border: 1px solid #bfe7f3;
     4241}
     4242
     4243.privacy-settings-accordion-trigger .badge.orange {
     4244        border: 1px solid #ffb900;
     4245}
     4246
     4247.privacy-settings-accordion-trigger .badge.red {
     4248        border: 1px solid #dc3232;
     4249}
     4250
     4251.privacy-settings-accordion-trigger .badge.green {
     4252        border: 1px solid #46b450;
     4253}
     4254
     4255.privacy-settings-accordion-trigger .badge.purple {
     4256        border: 1px solid #826eb4;
     4257}
     4258
     4259.privacy-settings-accordion-trigger .badge.gray {
     4260        border: 1px solid #ccd0d4;
     4261}
     4262
     4263.privacy-settings-accordion-trigger[aria-expanded="true"] .icon,
     4264.privacy-settings-view-passed[aria-expanded="true"] .icon {
     4265        transform: translateY(-30%) rotate(-135deg)
     4266}
     4267
     4268.privacy-settings-accordion-panel {
     4269        margin: 0;
     4270        padding: 1em 1.5em;
     4271        background: #fff;
     4272}
     4273
     4274.privacy-settings-accordion-panel[hidden] {
     4275        display: none;
     4276}
     4277
     4278.privacy-settings-accordion-panel a .dashicons {
     4279        text-decoration: none;
     4280}
     4281
     4282.privacy-settings-accordion-actions {
     4283        text-align: right;
     4284        display: block;
     4285}
     4286
     4287/* Suggested text for privacy policy */
     4288.wp-suggested-text h1,
     4289.wp-suggested-text h2,
     4290.wp-suggested-text h3,
     4291.wp-suggested-text h4,
     4292.wp-suggested-text h5,
     4293.wp-suggested-text h6 {
     4294        font-weight: 600;
     4295}
     4296
     4297.wp-suggested-text .privacy-suggested-text {
     4298        font-weight: 600;
     4299}
     4300
     4301/* Media queries */
     4302@media screen and (max-width: 782px) {
     4303
     4304        .privacy-settings-body {
     4305                margin: 0 12px;
     4306                width: auto;
     4307        }
     4308
     4309        .privacy-settings .notice {
     4310                margin: 5px 10px 15px;
     4311        }
     4312
     4313        .privacy-settings .update-nag {
     4314                margin-right: 10px;
     4315                margin-left: 10px;
     4316        }
     4317
     4318        input#create-page {
     4319                margin-top: 10px;
     4320        }
     4321}
     4322
     4323@media only screen and (max-width: 1004px) {
     4324
     4325        .privacy-settings-body {
     4326                margin: 0 22px;
     4327                width: auto;
     4328        }
     4329}
     4330
     4331/**
     4332* End Privacy Settings section
     4333*/
  • src/wp-admin/css/edit.css

    diff --git a/src/wp-admin/css/edit.css b/src/wp-admin/css/edit.css
    index 20d4c4d27a..0a560cec77 100644
    a b form#tags-filter { 
    658658        min-height: 1.6923em;
    659659}
    660660
    661 /* Suggested text for privacy policy */
    662 .wp-privacy-policy-guide {
    663         max-width: 1000px;
    664 }
    665 
    666 .privacy-text-box {
    667         width: calc(100% - 260px);
    668 }
    669 
    670 .privacy-text-box-toc {
    671         float: right;
    672         width: 250px;
    673         background-color: #fff;
    674 }
    675 
    676 .privacy-text-box-toc p {
    677         margin: 0;
    678         padding: 0.7em 1em;
    679         border-bottom: 1px solid #eee;
    680 }
    681 
    682 .privacy-text-box-toc ol {
    683         margin-left: 2em;
    684 }
    685 
    686 .wp-privacy-policy-guide h3 {
    687         font-size: 1.2em;
    688         margin: 1em 0 0.5em;
    689 }
    690 
    691 .privacy-text-section .privacy-text-copy {
    692         float: right;
    693 }
    694 
    695 .privacy-text-section {
    696         position: relative;
    697         border-top: 1px solid #e3e3e3;
    698 }
    699 
    700 .privacy-text-box-head,
    701 .privacy-text-section.text-removed {
    702         padding-bottom: 12px;
    703 }
    704 
    705 .text-removed .policy-text {
    706         font-style: italic;
    707         color: #666;
    708         font-weight: 600;
    709 }
    710 
    711 .privacy-text-actions {
    712         height: 32px;
    713         line-height: 2.46153846;
    714         padding-bottom: 6px;
    715 }
    716 
    717 .wp-privacy-policy-guide .policy-text h2 {
    718         margin: 1.2em 0 1em;
    719         padding: 0;
    720 }
    721 
    722 .suggested-policy-content {
    723         font-style: italic;
    724 }
    725 
    726 .privacy-text-section a.return-to-top {
    727         float: right;
    728         margin-right: -250px;
    729         margin-top: 6px;
    730 }
    731 
    732 .hide-privacy-policy-tutorial .privacy-policy-tutorial {
    733         visibility: hidden;
    734 }
    735 
    736 .wp-suggested-text p {
    737         font-style: italic;
    738 }
    739 
    740 .wp-suggested-text p.privacy-policy-tutorial {
    741         font-style: normal;
    742 }
    743 
    744 .notice.wp-pp-notice {
    745         margin: 15px 0 3px;
    746 }
    747 
    748661/*------------------------------------------------------------------------------
    749662  11.1 - Custom Fields
    750663------------------------------------------------------------------------------*/
  • src/wp-admin/includes/admin-filters.php

    diff --git a/src/wp-admin/includes/admin-filters.php b/src/wp-admin/includes/admin-filters.php
    index c080fd0f24..a82ec8fd9f 100644
    a b add_action( 'admin_init', array( 'WP_Privacy_Policy_Content', 'text_change_check 
    140140// Show a "postbox" with the text suggestions for a privacy policy.
    141141add_action( 'admin_notices', array( 'WP_Privacy_Policy_Content', 'notice' ) );
    142142
    143 // Add the suggested policy text from WordPress.
    144 add_action( 'admin_init', array( 'WP_Privacy_Policy_Content', 'add_suggested_content' ), 1 );
    145 
    146143// Update the cached policy info when the policy page is updated.
    147144add_action( 'post_updated', array( 'WP_Privacy_Policy_Content', '_policy_page_updated' ) );
    148145
  • src/wp-admin/includes/class-wp-privacy-policy-content.php

    diff --git a/src/wp-admin/includes/class-wp-privacy-policy-content.php b/src/wp-admin/includes/class-wp-privacy-policy-content.php
    index 65f27470a3..d71e2a7bb9 100644
    a b final class WP_Privacy_Policy_Content { 
    142142                                printf(
    143143                                        /* translators: %s: Privacy Policy Guide URL. */
    144144                                        __( 'The suggested privacy policy text has changed. Please <a href="%s">review the guide</a> and update your privacy policy.' ),
    145                                         esc_url( admin_url( 'privacy-policy-guide.php' ) )
     145                                        esc_url( admin_url( 'options-privacy.php?tab=policyguide' ) )
    146146                                );
    147147                        ?>
    148148                        </p>
    final class WP_Privacy_Policy_Content { 
    325325                }
    326326
    327327                $message = __( 'Need help putting together your new Privacy Policy page? Check out our guide for recommendations on what content to include, along with policies suggested by your plugins and theme.' );
    328                 $url     = esc_url( admin_url( 'privacy-policy-guide.php' ) );
     328                $url     = esc_url( admin_url( 'options-privacy.php?tab=policyguide' ) );
    329329                $label   = __( 'View Privacy Policy Guide.' );
    330330
    331331                if ( get_current_screen()->is_block_editor() ) {
    final class WP_Privacy_Policy_Content { 
    373373                $content_array = self::get_suggested_policy_text();
    374374
    375375                $content       = '';
    376                 $toc           = array( '<li><a href="#wp-privacy-policy-guide-introduction">' . __( 'Introduction' ) . '</a></li>' );
    377376                $date_format   = __( 'F j, Y' );
    378                 $copy          = __( 'Copy this section to clipboard' );
    379                 $return_to_top = '<a href="#" class="return-to-top">' . __( '&uarr; Return to Top' ) . '</a>';
    380377
    381378                foreach ( $content_array as $section ) {
    382379                        $class   = '';
    final class WP_Privacy_Policy_Content { 
    384381                        $removed = '';
    385382
    386383                        if ( ! empty( $section['removed'] ) ) {
    387                                 $class = ' text-removed';
     384                                $badge_class = ' red';
     385
    388386                                $date  = date_i18n( $date_format, $section['removed'] );
     387
    389388                                /* translators: %s: Date of plugin deactivation. */
    390                                 $meta = sprintf( __( 'Removed %s.' ), $date );
     389                                $badge_title = sprintf( __( 'Removed %s.' ), $date );
    391390
    392391                                /* translators: %s: Date of plugin deactivation. */
    393392                                $removed = __( 'You deactivated this plugin on %s and may no longer need this policy.' );
    394393                                $removed = '<div class="error inline"><p>' . sprintf( $removed, $date ) . '</p></div>';
    395394                        } elseif ( ! empty( $section['updated'] ) ) {
    396                                 $class = ' text-updated';
     395                                $badge_class = ' blue';
     396
    397397                                $date  = date_i18n( $date_format, $section['updated'] );
    398                                 /* translators: %s: Date of privacy policy text update. */
    399                                 $meta = sprintf( __( 'Updated %s.' ), $date );
    400                         }
    401398
    402                         if ( $meta ) {
    403                                 $meta = '<br><span class="privacy-text-meta">' . $meta . '</span>';
     399                                /* translators: %s: Date of privacy policy text update. */
     400                                $badge_title = sprintf( __( 'Updated %s.' ), $date );
    404401                        }
    405402
    406403                        $plugin_name = esc_html( $section['plugin_name'] );
    407                         $toc_id      = 'wp-privacy-policy-guide-' . sanitize_title( $plugin_name );
    408                         $toc[]       = sprintf( '<li><a href="#%1$s">%2$s</a>' . $meta . '</li>', $toc_id, $plugin_name );
    409 
    410                         $content .= '<div class="privacy-text-section' . $class . '">';
    411                         $content .= '<a id="' . $toc_id . '">&nbsp;</a>';
    412                         /* translators: %s: Plugin name. */
    413                         $content .= '<h2>' . sprintf( __( 'Source: %s' ), $plugin_name ) . '</h2>';
    414                         $content .= $removed;
    415 
    416                         $content .= '<div class="policy-text">' . $section['policy_text'] . '</div>';
    417                         $content .= $return_to_top;
    418 
    419                         if ( empty( $section['removed'] ) ) {
    420                                 $content         .= '<div class="privacy-text-actions">';
    421                                         $content     .= '<button type="button" class="privacy-text-copy button">';
    422                                                 $content .= $copy;
    423                                                 $content .= '<span class="screen-reader-text">';
    424                                                 /* translators: %s: Plugin name. */
    425                                                 $content .= sprintf( __( 'Copy suggested policy text from %s.' ), $plugin_name );
    426                                                 $content .= '</span>';
    427                                         $content     .= '</button>';
    428                                 $content         .= '</div>';
    429                         }
    430 
    431                         $content .= "</div>\n"; // End of .privacy-text-section.
    432                 }
    433404
    434                 if ( count( $toc ) > 2 ) {
     405                        $sanitized_policy_name = sanitize_title_with_dashes( $plugin_name );
    435406                        ?>
    436                         <div  class="privacy-text-box-toc">
    437                                 <p><?php _e( 'Table of Contents' ); ?></p>
    438                                 <ol>
    439                                         <?php echo implode( "\n", $toc ); ?>
    440                                 </ol>
     407                        <h4 class="privacy-settings-accordion-heading">
     408                        <button aria-expanded="false" class="privacy-settings-accordion-trigger" aria-controls="privacy-settings-accordion-block-<?php echo $sanitized_policy_name; ?>" type="button">
     409                                <span class="title"><?php echo $plugin_name ?></span>
     410                                <?php if ( ! empty( $section['removed'] ) || ! empty( $section['updated'] ) ) : ?>
     411                                <span class="badge <?php echo $badge_class; ?>"> <?php echo $badge_title ?></span>
     412                                <?php endif; ?>
     413                                <span class="icon"></span>
     414                        </button>
     415                        </h4>
     416                        <div id="privacy-settings-accordion-block-<?php echo $sanitized_policy_name; ?>" class="privacy-settings-accordion-panel privacy-text-box-body" hidden="hidden">
     417                                <?php
     418                                echo $removed;
     419                                echo $section['policy_text'];
     420                                ?>
     421                                <?php if ( empty( $section['removed'] ) ) : ?>
     422                                <div class="privacy-settings-accordion-actions">
     423                                        <button type="button" class="privacy-text-copy button">
     424                                                <?php _e( 'Copy this section to clipboard' ); ?>
     425                                                <span class="screen-reader-text">
     426                                                        <?php
     427                                                        /* translators: %s: Plugin name. */
     428                                                        sprintf( __( 'Copy suggested policy text from %s.' ), $plugin_name );
     429                                                        ?>
     430                                                </span>
     431                                        </button>
     432                                </div>
     433                                <?php endif; ?>
    441434                        </div>
    442435                        <?php
    443436                }
    444 
    445                 ?>
    446                 <div class="privacy-text-box">
    447                         <div class="privacy-text-box-head">
    448                                 <a id="wp-privacy-policy-guide-introduction">&nbsp;</a>
    449                                 <h2><?php _e( 'Introduction' ); ?></h2>
    450                                 <p><?php _e( 'Hello,' ); ?></p>
    451                                 <p><?php _e( 'This text template will help you to create your web site&#8217;s privacy policy.' ); ?></p>
    452                                 <p><?php _e( 'We have suggested the sections you will need. Under each section heading you will find a short summary of what information you should provide, which will help you to get started. Some sections include suggested policy content, others will have to be completed with information from your theme and plugins.' ); ?></p>
    453                                 <p><?php _e( 'Please edit your privacy policy content, making sure to delete the summaries, and adding any information from your theme and plugins. Once you publish your policy page, remember to add it to your navigation menu.' ); ?></p>
    454                                 <p><?php _e( 'It is your responsibility to write a comprehensive privacy policy, to make sure it reflects all national and international legal requirements on privacy, and to keep your policy current and accurate.' ); ?></p>
    455                         </div>
    456 
    457                         <div class="privacy-text-box-body">
    458                                 <?php echo $content; ?>
    459                         </div>
    460                 </div>
    461                 <?php
    462437        }
    463438
    464439        /**
    final class WP_Privacy_Policy_Content { 
    712687                 */
    713688                return apply_filters( 'wp_get_default_privacy_policy_content', $content, $strings, $description, $blocks );
    714689        }
    715 
    716         /**
    717          * Add the suggested privacy policy text to the policy postbox.
    718          *
    719          * @since 4.9.6
    720          */
    721         public static function add_suggested_content() {
    722                 $content = self::get_default_content( true, false );
    723                 wp_add_privacy_policy_content( __( 'WordPress' ), $content );
    724         }
    725690}
  • src/wp-admin/options-privacy.php

    diff --git a/src/wp-admin/options-privacy.php b/src/wp-admin/options-privacy.php
    index 95492b326f..80c310612b 100644
    a b if ( ! current_user_can( 'manage_privacy_options' ) ) { 
    1313        wp_die( __( 'Sorry, you are not allowed to manage privacy on this site.' ) );
    1414}
    1515
     16if ( isset( $_GET['tab'] ) && 'policyguide' === $_GET['tab'] ) {
     17        require_once( dirname( __FILE__ ) . '/privacy-policy-guide.php' );
     18        return;
     19}
     20
     21add_filter(
     22        'admin_body_class',
     23        function( $body_class ) {
     24                $body_class .= ' privacy-settings ';
     25
     26                return $body_class;
     27        }
     28);
     29
    1630$action = isset( $_POST['action'] ) ? $_POST['action'] : '';
    1731
    1832if ( ! empty( $action ) ) {
    if ( ! empty( $privacy_policy_page_id ) ) { 
    112126        }
    113127}
    114128
    115 $title       = __( 'Privacy Settings' );
    116129$parent_file = 'options-general.php';
    117130
     131wp_enqueue_script( 'privacy-tools' );
     132
    118133require_once( ABSPATH . 'wp-admin/admin-header.php' );
    119134
    120135?>
    121 <div class="wrap">
    122         <h1><?php echo $title; ?></h1>
    123         <h2><?php _e( 'Privacy Policy Page' ); ?></h2>
     136<div class="privacy-settings-header">
     137        <div class="privacy-settings-title-section">
     138                <h1>
     139                        <?php _e( 'Privacy' ); ?>
     140                </h1>
     141        </div>
     142
     143        <nav class="privacy-settings-tabs-wrapper hide-if-no-js" aria-label="<?php esc_attr_e( 'Secondary menu' ); ?>">
     144                <a href="<?php echo esc_url( admin_url( 'options-privacy.php' ) ); ?>" class="privacy-settings-tab active" aria-current="true">
     145                        <?php
     146                        /* translators: Tab heading for Site Health Status page. */
     147                        _ex( 'Settings', 'Privacy Settings' );
     148                        ?>
     149                </a>
     150
     151                <a href="<?php echo esc_url( admin_url( 'options-privacy.php?tab=policyguide' ) ); ?>" class="privacy-settings-tab">
     152                        <?php
     153                        /* translators: Tab heading for Site Health Status page. */
     154                        _ex( 'Policy Guide', 'Privacy Settings' );
     155                        ?>
     156                </a>
     157        </nav>
     158</div>
     159
     160<hr class="wp-header-end">
     161
     162<div class="notice notice-error hide-if-js">
     163        <p><?php _e( 'The Privacy Settings require JavaScript.' ); ?></p>
     164</div>
     165
     166<div class="privacy-settings-body hide-if-no-js">
     167        <h2><?php _e( 'Privacy Settings' ); ?></h2>
    124168        <p>
    125169                <?php _e( 'As a website owner, you may need to follow national or international privacy laws. For example, you may need to create and display a Privacy Policy.' ); ?>
    126170                <?php _e( 'If you already have a Privacy Policy page, please select it below. If not, please create one.' ); ?>
    require_once( ABSPATH . 'wp-admin/admin-header.php' ); 
    133177                <?php _e( 'After your Privacy Policy page is set, we suggest that you edit it.' ); ?>
    134178                <?php _e( 'We would also suggest reviewing your Privacy Policy from time to time, especially after installing or updating any themes or plugins. There may be changes or new suggested information for you to consider adding to your policy.' ); ?>
    135179        </p>
    136         <?php
    137 
    138         if ( $privacy_policy_page_exists ) {
    139                 $edit_href = add_query_arg(
    140                         array(
    141                                 'post'   => $privacy_policy_page_id,
    142                                 'action' => 'edit',
    143                         ),
    144                         admin_url( 'post.php' )
    145                 );
    146 
    147                 $view_href = get_permalink( $privacy_policy_page_id );
    148                 ?>
    149                 <p class="tools-privacy-edit"><strong>
    150                         <?php
    151                         if ( 'publish' === get_post_status( $privacy_policy_page_id ) ) {
    152                                 printf(
    153                                         /* translators: 1: URL to edit Privacy Policy page, 2: URL to view Privacy Policy page. */
    154                                         __( '<a href="%1$s">Edit</a> or <a href="%2$s">view</a> your Privacy Policy page content.' ),
    155                                         esc_url( $edit_href ),
    156                                         esc_url( $view_href )
    157                                 );
    158                         } else {
    159                                 printf(
    160                                         /* translators: 1: URL to edit Privacy Policy page, 2: URL to preview Privacy Policy page. */
    161                                         __( '<a href="%1$s">Edit</a> or <a href="%2$s">preview</a> your Privacy Policy page content.' ),
    162                                         esc_url( $edit_href ),
    163                                         esc_url( $view_href )
    164                                 );
    165                         }
    166                         ?>
    167                 </strong></p>
    168                 <?php
    169         }
    170         ?>
    171180        <p>
    172181                <?php
     182                if ( $privacy_policy_page_exists ) {
     183                        $edit_href = add_query_arg(
     184                                array(
     185                                        'post'   => $privacy_policy_page_id,
     186                                        'action' => 'edit',
     187                                ),
     188                                admin_url( 'post.php' )
     189                        );
     190
     191                        $view_href = get_permalink( $privacy_policy_page_id );
     192                        ?>
     193                                <strong>
     194                                <?php
     195                                if ( 'publish' === get_post_status( $privacy_policy_page_id ) ) {
     196                                        printf(
     197                                                /* translators: 1: URL to edit Privacy Policy page, 2: URL to view Privacy Policy page. */
     198                                                __( '<a href="%1$s">Edit</a> or <a href="%2$s">view</a> your Privacy Policy page content.' ),
     199                                                esc_url( $edit_href ),
     200                                                esc_url( $view_href )
     201                                        );
     202                                } else {
     203                                        printf(
     204                                                /* translators: 1: URL to edit Privacy Policy page, 2: URL to preview Privacy Policy page. */
     205                                                __( '<a href="%1$s">Edit</a> or <a href="%2$s">preview</a> your Privacy Policy page content.' ),
     206                                                esc_url( $edit_href ),
     207                                                esc_url( $view_href )
     208                                        );
     209                                }
     210                                ?>
     211                                </strong>
     212                        <?php
     213                }
    173214                printf(
    174215                        /* translators: 1: Privacy Policy guide URL, 2: Additional link attributes, 3: Accessibility text. */
    175                         __( 'Need help putting together your new Privacy Policy page? <a href="%1$s" %2$s>Check out our guide%3$s</a> for recommendations on what content to include, along with policies suggested by your plugins and theme.' ),
    176                         esc_url( admin_url( 'privacy-policy-guide.php' ) ),
     216                        __( 'Need help putting together your new Privacy Policy page? <a href="%1$s" %2$s>Check out our Privacy Policy guide%3$s</a> for recommendations on what content to include, along with policies suggested by your plugins and theme.' ),
     217                        esc_url( admin_url( 'options-privacy.php?tab=policyguide' ) ),
    177218                        '',
    178219                        ''
    179220                );
    require_once( ABSPATH . 'wp-admin/admin-header.php' ); 
    181222        </p>
    182223
    183224        <hr>
     225
     226        <?php
     227        $has_pages = (bool) get_posts(
     228                array(
     229                        'post_type'      => 'page',
     230                        'posts_per_page' => 1,
     231                        'post_status'    => array(
     232                                'publish',
     233                                'draft',
     234                        ),
     235                )
     236        );
     237        ?>
     238
    184239        <table class="form-table tools-privacy-policy-page" role="presentation">
     240                <tr>
     241                        <th scope="row">
     242                                <label for="create-page">
     243                                <?php
     244                                if ( $has_pages ) {
     245                                        _e( 'Create a new Privacy Policy Page' );
     246                                } else {
     247                                        _e( 'There are no pages.' );
     248                                }
     249                                ?>
     250                                </label>
     251                        </td>
     252                        <td>
     253                                <form class="wp-create-privacy-page" method="post" action="">
     254                                        <input type="hidden" name="action" value="create-privacy-page" />
     255                                        <?php
     256                                        wp_nonce_field( 'create-privacy-page' );
     257
     258                                        submit_button( __( 'Create' ), 'secondary', 'submit', false, array( 'id' => 'create-page' ) );
     259                                        ?>
     260                                </form>
     261                        </td>
     262                </tr>
     263                <?php if ( $has_pages ) : ?>
    185264                <tr>
    186265                        <th scope="row">
    187266                                <label for="page_for_privacy_policy">
    require_once( ABSPATH . 'wp-admin/admin-header.php' ); 
    195274                                </label>
    196275                        </th>
    197276                        <td>
    198                                 <?php
    199                                 $has_pages = (bool) get_posts(
    200                                         array(
    201                                                 'post_type'      => 'page',
    202                                                 'posts_per_page' => 1,
    203                                                 'post_status'    => array(
    204                                                         'publish',
    205                                                         'draft',
    206                                                 ),
    207                                         )
    208                                 );
    209 
    210                                 if ( $has_pages ) :
    211                                         ?>
    212                                         <form method="post" action="">
    213                                                 <input type="hidden" name="action" value="set-privacy-page" />
    214                                                 <?php
    215                                                 wp_dropdown_pages(
    216                                                         array(
    217                                                                 'name'              => 'page_for_privacy_policy',
    218                                                                 'show_option_none'  => __( '&mdash; Select &mdash;' ),
    219                                                                 'option_none_value' => '0',
    220                                                                 'selected'          => $privacy_policy_page_id,
    221                                                                 'post_status'       => array( 'draft', 'publish' ),
    222                                                         )
    223                                                 );
    224 
    225                                                 wp_nonce_field( 'set-privacy-page' );
    226 
    227                                                 submit_button( __( 'Use This Page' ), 'primary', 'submit', false, array( 'id' => 'set-page' ) );
    228                                                 ?>
    229                                         </form>
    230                                 <?php endif; ?>
    231 
    232                                 <form class="wp-create-privacy-page" method="post" action="">
    233                                         <input type="hidden" name="action" value="create-privacy-page" />
    234                                         <span>
    235                                                 <?php
    236                                                 if ( $has_pages ) {
    237                                                         _e( 'Or:' );
    238                                                 } else {
    239                                                         _e( 'There are no pages.' );
    240                                                 }
    241                                                 ?>
    242                                         </span>
     277                                <form method="post" action="">
     278                                        <input type="hidden" name="action" value="set-privacy-page" />
    243279                                        <?php
    244                                         wp_nonce_field( 'create-privacy-page' );
     280                                        wp_dropdown_pages(
     281                                                array(
     282                                                        'name'              => 'page_for_privacy_policy',
     283                                                        'show_option_none'  => __( '&mdash; Select &mdash;' ),
     284                                                        'option_none_value' => '0',
     285                                                        'selected'          => $privacy_policy_page_id,
     286                                                        'post_status'       => array( 'draft', 'publish' ),
     287                                                )
     288                                        );
    245289
    246                                         submit_button( __( 'Create New Page' ), 'primary', 'submit', false, array( 'id' => 'create-page' ) );
     290                                        wp_nonce_field( 'set-privacy-page' );
     291
     292                                        submit_button( __( 'Use This Page' ), 'primary', 'submit', false, array( 'id' => 'set-page' ) );
    247293                                        ?>
    248294                                </form>
    249295                        </td>
    250296                </tr>
     297                <?php endif; ?>
    251298        </table>
     299
    252300</div>
    253301<?php
    254302
  • src/wp-admin/privacy-policy-guide.php

    diff --git a/src/wp-admin/privacy-policy-guide.php b/src/wp-admin/privacy-policy-guide.php
    index f3d8703f88..509b57d60e 100644
    a b if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) { 
    1717        include_once( ABSPATH . 'wp-admin/includes/class-wp-privacy-policy-content.php' );
    1818}
    1919
    20 $title = __( 'Privacy Policy Guide' );
     20add_filter(
     21        'admin_body_class',
     22        function( $body_class ) {
     23                $body_class .= ' privacy-settings ';
     24
     25                return $body_class;
     26        }
     27);
    2128
    2229wp_enqueue_script( 'privacy-tools' );
    2330
    2431require_once( ABSPATH . 'wp-admin/admin-header.php' );
    2532
    2633?>
    27 <div class="wrap">
    28         <h1><?php echo esc_html( $title ); ?></h1>
     34<div class="privacy-settings-header">
     35        <div class="privacy-settings-title-section">
     36                <h1>
     37                        <?php _e( 'Privacy' ); ?>
     38                </h1>
     39        </div>
     40
     41        <nav class="privacy-settings-tabs-wrapper hide-if-no-js" aria-label="<?php esc_attr_e( 'Secondary menu' ); ?>">
     42                <a href="<?php echo esc_url( admin_url( 'options-privacy.php' ) ); ?>" class="privacy-settings-tab">
     43                        <?php
     44                        /* translators: Tab heading for Site Health Status page. */
     45                        _ex( 'Settings', 'Privacy Settings' );
     46                        ?>
     47                </a>
     48
     49                <a href="<?php echo esc_url( admin_url( 'options-privacy.php?tab=policyguide' ) ); ?>" class="privacy-settings-tab active" aria-current="true">
     50                        <?php
     51                        /* translators: Tab heading for Site Health Status page. */
     52                        _ex( 'Policy Guide', 'Privacy Settings' );
     53                        ?>
     54                </a>
     55        </nav>
     56</div>
     57
     58<hr class="wp-header-end">
     59
     60<div class="notice notice-error hide-if-js">
     61        <p><?php _e( 'The Privacy Settings require JavaScript.' ); ?></p>
     62</div>
    2963
    30         <div class="wp-privacy-policy-guide">
     64<div class="privacy-settings-body hide-if-no-js">
     65        <h2><?php _e( 'Privacy Policy Guide' ); ?></h2>
     66        <h3 class="section-title"><?php _e( 'Introduction' ); ?></h3>
     67        <p><?php _e( 'This text template will help you to create your web site&#8217;s privacy policy.' ); ?></p>
     68        <p><?php _e( 'We have suggested the sections you will need. Under each section heading you will find a short summary of what information you should provide, which will help you to get started. Some sections include suggested policy content, others will have to be completed with information from your theme and plugins.' ); ?></p>
     69        <p><?php _e( 'Please edit your privacy policy content, making sure to delete the summaries, and adding any information from your theme and plugins. Once you publish your policy page, remember to add it to your navigation menu.' ); ?></p>
     70        <p><?php _e( 'It is your responsibility to write a comprehensive privacy policy, to make sure it reflects all national and international legal requirements on privacy, and to keep your policy current and accurate.' ); ?></p>
     71
     72        <div class="privacy-settings-accordion">
     73                <h4 class="privacy-settings-accordion-heading">
     74                        <button aria-expanded="false" class="privacy-settings-accordion-trigger" aria-controls="privacy-settings-accordion-block-wordpress" type="button">
     75                                <span class="title"><?php _e( 'WordPress' ); ?></span>
     76                                <span class="icon"></span>
     77                        </button>
     78                </h4>
     79                <div id="privacy-settings-accordion-block-wordpress" class="privacy-settings-accordion-panel" hidden="hidden">
     80                        <?php
     81                        $content = WP_Privacy_Policy_Content::get_default_content( true, false );
     82                        echo $content;
     83                        ?>
     84                        <div class="actions">
     85                                <p> Copy ! </p>
     86                        </div>
     87                </div>
     88        </div>
     89
     90        <hr class="hr-separator">
     91
     92        <h3 class="section-title"><?php _e( 'Policies' ); ?></h3>
     93
     94        <div class="privacy-settings-accordion wp-privacy-policy-guide">
    3195                <?php WP_Privacy_Policy_Content::privacy_policy_guide(); ?>
    3296        </div>
    33 </div>
     97</div> <!-- privacy-settings-body -->
     98
    3499<?php
    35100
    36101include( ABSPATH . 'wp-admin/admin-footer.php' );
  • src/wp-admin/tools.php

    diff --git a/src/wp-admin/tools.php b/src/wp-admin/tools.php
    index 447d6738ac..e7f87591da 100644
    a b require_once( dirname( __FILE__ ) . '/admin.php' ); 
    2323
    2424// The privacy policy guide used to be outputted from here. Since WP 5.3 it is in wp-admin/privacy-policy-guide.php.
    2525if ( isset( $_GET['wp-privacy-policy-guide'] ) ) {
    26         wp_redirect( admin_url( 'privacy-policy-guide.php' ), 301 );
     26        wp_redirect( admin_url( 'options-privacy.php?tab=policyguide' ), 301 );
    2727        exit;
    2828} elseif ( isset( $_GET['page'] ) ) {
    2929        // These were also moved to files in WP 5.3.