Make WordPress Core

Ticket #49264: 49264.7.diff

File 49264.7.diff, 55.7 KB (added by xkon, 4 years ago)
  • src/js/_enqueues/admin/privacy-tools.js

     
    275275        // Privacy Policy page, copy action.
    276276        $( document ).on( 'click', function( event ) {
    277277                var $parent,
    278                         $container,
    279278                        range,
    280279                        $target = $( event.target ),
    281280                        copiedNotice = $target.siblings( '.success' );
     
    283282                clearTimeout( copiedNoticeTimeout );
    284283
    285284                if ( $target.is( 'button.privacy-text-copy' ) ) {
    286                         $parent = $target.parent().parent();
    287                         $container = $parent.find( 'div.wp-suggested-text' );
     285                        $parent = $target.closest( '.privacy-settings-accordion-panel' );
    288286
    289                         if ( ! $container.length ) {
    290                                 $container = $parent.find( 'div.policy-text' );
    291                         }
    292 
    293                         if ( $container.length ) {
     287                        if ( $parent.length ) {
    294288                                try {
    295289                                        var documentPosition = document.documentElement.scrollTop,
    296290                                                bodyPosition     = document.body.scrollTop;
     
    300294
    301295                                        // Hide tutorial content to remove from copied content.
    302296                                        range = document.createRange();
    303                                         $container.addClass( 'hide-privacy-policy-tutorial' );
     297                                        $parent.addClass( 'copy-suggested-text' );
    304298
    305299                                        // Copy action.
    306                                         range.selectNodeContents( $container[0] );
     300                                        range.selectNodeContents( $parent[0] );
    307301                                        window.getSelection().addRange( range );
    308302                                        document.execCommand( 'copy' );
    309303
    310304                                        // Reset section.
    311                                         $container.removeClass( 'hide-privacy-policy-tutorial' );
     305                                        $parent.removeClass( 'copy-suggested-text' );
    312306                                        window.getSelection().removeAllRanges();
    313307
    314308                                        // Return scroll position - see #49540.
     
    320314
    321315                                        // Display and speak notice to indicate action complete.
    322316                                        copiedNotice.addClass( 'visible' );
    323                                         wp.a11y.speak( __( 'The section has been copied to your clipboard.' ) );
     317                                        wp.a11y.speak( __( 'The suggested policy text has been copied to your clipboard.' ) );
    324318
    325319                                        // Delay notice dismissal.
    326320                                        copiedNoticeTimeout = setTimeout( function() {
     
    330324                        }
    331325                }
    332326        });
     327
     328        // Label handling to focus the create page button on Privacy settings page.
     329        $( 'body.options-privacy-php label[for=create-page]' ).on( 'click', function( e ) {
     330                e.preventDefault();
     331                $( 'input#create-page' ).focus();
     332        } );
     333
     334        // Accordion handling in various new Privacy settings pages.
     335        $( '.privacy-settings-accordion' ).on( 'click', '.privacy-settings-accordion-trigger', function() {
     336                var isExpanded = ( 'true' === $( this ).attr( 'aria-expanded' ) );
     337
     338                if ( isExpanded ) {
     339                        $( this ).attr( 'aria-expanded', 'false' );
     340                        $( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', true );
     341                } else {
     342                        $( this ).attr( 'aria-expanded', 'true' );
     343                        $( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', false );
     344                }
     345        } );
    333346});
  • src/wp-admin/css/common.css

     
    37253725        text-decoration: none;
    37263726}
    37273727
     3728/**
     3729* Privacy Settings section
     3730*/
     3731
     3732/* General */
     3733.privacy-settings #wpcontent,
     3734.privacy-settings.auto-fold #wpcontent {
     3735        padding-left: 0;
     3736}
     3737
     3738.privacy-settings-header h1 {
     3739        display: inline-block;
     3740        font-weight: 600;
     3741        margin: 0 0.8rem 1rem;
     3742        font-size: 23px;
     3743        padding: 9px 0 4px 0;
     3744        line-height: 1.3;
     3745}
     3746
     3747/* Header */
     3748.privacy-settings-header {
     3749        text-align: center;
     3750        margin: 0 0 1rem;
     3751        background: #fff;
     3752        border-bottom: 1px solid #e2e4e7;
     3753}
     3754
     3755.privacy-settings-title-section {
     3756        display: flex;
     3757        align-items: center;
     3758        justify-content: center;
     3759        clear: both;
     3760}
     3761
     3762.privacy-settings-tabs-wrapper {
     3763        /* IE 11 */
     3764        display: -ms-inline-grid;
     3765        -ms-grid-columns: 1fr 1fr;
     3766        vertical-align: top;
     3767        /* modern browsers */
     3768        display: inline-grid;
     3769        grid-template-columns: 1fr 1fr;
     3770}
     3771
     3772.privacy-settings-tab {
     3773        display: block; /* IE 11 */
     3774        text-decoration: none;
     3775        color: inherit;
     3776        padding: 0.5rem 1rem 1rem;
     3777        margin: 0 1rem;
     3778        transition: box-shadow 0.5s ease-in-out;
     3779}
     3780
     3781.privacy-settings-tab:nth-child(1) {
     3782        -ms-grid-column: 1; /* IE 11 */
     3783}
     3784
     3785.privacy-settings-tab:nth-child(2) {
     3786        -ms-grid-column: 2; /* IE 11 */
     3787}
     3788
     3789.privacy-settings-tab:focus {
     3790        color: #191e23;
     3791        outline: 1px solid #6c7781;
     3792        box-shadow: none;
     3793}
     3794
     3795.privacy-settings-tab.active {
     3796        box-shadow: inset 0 -3px #007cba;
     3797        font-weight: 600;
     3798}
     3799
     3800/* Body */
     3801.privacy-settings-body {
     3802        max-width: 800px;
     3803        margin: 0 auto;
     3804}
     3805
     3806.tools-privacy-policy-page th {
     3807        min-width: 230px;
     3808}
     3809
     3810.hr-separator {
     3811        margin-top: 20px;
     3812        margin-bottom: 15px;
     3813}
     3814
     3815/* Accordions */
     3816.privacy-settings-accordion {
     3817        border: 1px solid #ccd0d4;
     3818}
     3819
     3820.privacy-settings-accordion-heading {
     3821        margin: 0;
     3822        border-top: 1px solid #ccd0d4;
     3823        font-size: inherit;
     3824        line-height: inherit;
     3825        font-weight: 600;
     3826        color: inherit;
     3827}
     3828
     3829.privacy-settings-accordion-heading:first-child {
     3830        border-top: none;
     3831}
     3832
     3833.privacy-settings-accordion-trigger {
     3834        background: #fff;
     3835        border: 0;
     3836        color: #32373c;
     3837        cursor: pointer;
     3838        display: flex;
     3839        font-weight: 400;
     3840        margin: 0;
     3841        padding: 1em 3.5em 1em 1.5em;
     3842        min-height: 46px;
     3843        position: relative;
     3844        text-align: left;
     3845        width: 100%;
     3846        align-items: center;
     3847        justify-content: space-between;
     3848}
     3849
     3850.privacy-settings-accordion-trigger:hover,
     3851.privacy-settings-accordion-trigger:active {
     3852        background: #f8f9f9;
     3853}
     3854
     3855.privacy-settings-accordion-trigger:focus {
     3856        color: #191e23;
     3857        border: none;
     3858        box-shadow: none;
     3859        outline-offset: -1px;
     3860        outline: 2px solid #0071a1;
     3861        background-color: #f8f9f9;
     3862}
     3863
     3864.privacy-settings-accordion-trigger .title {
     3865        pointer-events: none;
     3866        font-weight: 600;
     3867        flex-grow: 1;
     3868}
     3869
     3870.privacy-settings-accordion-trigger .icon,
     3871.privacy-settings-view-read .icon {
     3872        border: solid #555d66;
     3873        border-width: 0 2px 2px 0;
     3874        height: 0.5rem;
     3875        pointer-events: none;
     3876        position: absolute;
     3877        right: 1.5em;
     3878        top: 50%;
     3879        transform: translateY(-70%) rotate(45deg);
     3880        width: 0.5rem;
     3881}
     3882
     3883.privacy-settings-accordion-trigger .badge {
     3884        padding: 0.1rem 0.5rem 0.15rem;
     3885        color: #32373c;
     3886        font-weight: 600;
     3887        margin-left: 0.5rem;
     3888}
     3889
     3890.privacy-settings-accordion-trigger .badge.blue {
     3891        border: 1px solid #bfe7f3;
     3892}
     3893
     3894.privacy-settings-accordion-trigger .badge.orange {
     3895        border: 1px solid #ffb900;
     3896}
     3897
     3898.privacy-settings-accordion-trigger .badge.red {
     3899        border: 1px solid #dc3232;
     3900}
     3901
     3902.privacy-settings-accordion-trigger .badge.green {
     3903        border: 1px solid #46b450;
     3904}
     3905
     3906.privacy-settings-accordion-trigger .badge.purple {
     3907        border: 1px solid #826eb4;
     3908}
     3909
     3910.privacy-settings-accordion-trigger .badge.gray {
     3911        border: 1px solid #ccd0d4;
     3912}
     3913
     3914.privacy-settings-accordion-trigger[aria-expanded="true"] .icon,
     3915.privacy-settings-view-passed[aria-expanded="true"] .icon {
     3916        transform: translateY(-30%) rotate(-135deg)
     3917}
     3918
     3919.privacy-settings-accordion-panel {
     3920        margin: 0;
     3921        padding: 1em 1.5em;
     3922        background: #fff;
     3923}
     3924
     3925.privacy-settings-accordion-panel[hidden] {
     3926        display: none;
     3927}
     3928
     3929.privacy-settings-accordion-panel a .dashicons {
     3930        text-decoration: none;
     3931}
     3932
     3933.privacy-settings-accordion-actions {
     3934        text-align: right;
     3935        display: block;
     3936}
     3937
     3938.privacy-settings-accordion-actions .success {
     3939        display: none;
     3940        color: #40860a;
     3941        padding-right: 1em;
     3942        padding-top: 6px;
     3943}
     3944
     3945.privacy-settings-accordion-actions .success.visible {
     3946        display: inline-block;
     3947}
     3948
     3949/* Suggested text for privacy policy */
     3950.privacy-settings-accordion-panel.copy-suggested-text > * {
     3951        display: none;
     3952}
     3953
     3954.privacy-settings-accordion-panel.copy-suggested-text .privacy-policy-suggested-text,
     3955.privacy-settings-accordion-panel.copy-suggested-text .privacy-policy-suggested-text > * {
     3956        display: block;
     3957}
     3958
     3959.privacy-settings-accordion-panel .privacy-policy-suggested-text-header {
     3960        font-weight: 600;
     3961        margin-bottom: 10px;
     3962}
     3963
     3964.privacy-settings-accordion-panel .privacy-policy-suggested-text {
     3965        margin: 0;
     3966        padding: 10px;
     3967        border-left: 2px solid gray;
     3968}
     3969
     3970
     3971/* Media queries */
     3972@media screen and (max-width: 782px) {
     3973
     3974        .privacy-settings-body {
     3975                margin: 0 12px;
     3976                width: auto;
     3977        }
     3978
     3979        .privacy-settings .notice {
     3980                margin: 5px 10px 15px;
     3981        }
     3982
     3983        .privacy-settings .update-nag {
     3984                margin-right: 10px;
     3985                margin-left: 10px;
     3986        }
     3987
     3988        input#create-page {
     3989                margin-top: 10px;
     3990        }
     3991}
     3992
     3993@media only screen and (max-width: 1004px) {
     3994
     3995        .privacy-settings-body {
     3996                margin: 0 22px;
     3997                width: auto;
     3998        }
     3999}
     4000
     4001/**
     4002* End Privacy Settings section
     4003*/
     4004
    37284005/* =Media Queries
    37294006-------------------------------------------------------------- */
    37304007
  • src/wp-admin/css/edit.css

     
    695695        min-height: 1.6923em;
    696696}
    697697
    698 /* Suggested text for privacy policy */
    699 .wp-privacy-policy-guide {
    700         max-width: 1000px;
    701 }
    702 
    703 .privacy-text-box {
    704         width: calc(100% - 260px);
    705 }
    706 
    707 .privacy-text-box-toc {
    708         float: right;
    709         width: 250px;
    710         background-color: #fff;
    711 }
    712 
    713 .privacy-text-box-toc p {
    714         margin: 0;
    715         padding: 0.7em 1em;
    716         border-bottom: 1px solid #eee;
    717 }
    718 
    719 .privacy-text-box-toc ol {
    720         margin-left: 2em;
    721 }
    722 
    723 .wp-privacy-policy-guide h3 {
    724         font-size: 1.2em;
    725         margin: 1em 0 0.5em;
    726 }
    727 
    728 .privacy-text-section .privacy-text-copy {
    729         float: right;
    730 }
    731 
    732 .privacy-text-section {
    733         position: relative;
    734         border-top: 1px solid #e3e3e3;
    735 }
    736 
    737 .privacy-text-box-head,
    738 .privacy-text-section.text-removed {
    739         padding-bottom: 12px;
    740 }
    741 
    742 .text-removed .policy-text {
    743         color: #666;
    744         font-weight: 300;
    745         padding-left: 1em;
    746         border-left: 3px solid #ffb900;
    747 }
    748 
    749 .text-removed .policy-text h1,
    750 .text-removed .policy-text h2,
    751 .text-removed .policy-text h3,
    752 .text-removed .policy-text h4,
    753 .text-removed .policy-text h5,
    754 .text-removed .policy-text h6 {
    755         color: #39424a;
    756         font-weight: 500;
    757 }
    758 
    759 .privacy-text-actions {
    760         display: inline-block;
    761         width: 100%;
    762         height: 32px;
    763         line-height: 2.46153846;
    764         padding-bottom: 6px;
    765 }
    766 
    767 .privacy-text-actions .success {
    768         display: none;
    769         color: #40860a;
    770         float: right;
    771         padding-right: 1em;
    772 }
    773 
    774 .privacy-text-actions .success.visible {
    775         display: inline-block;
    776         height: 32px;
    777 }
    778 
    779 .wp-privacy-policy-guide .policy-text h2 {
    780         margin: 1.2em 0 1em;
    781         padding: 0;
    782 }
    783 
    784 .suggested-policy-content {
    785         font-style: italic;
    786 }
    787 
    788 .privacy-text-section .return-to-top {
    789         float: right;
    790         margin-right: -250px;
    791         margin-top: 6px;
    792 }
    793 
    794 #wpbody:target:before {
    795         content: "";
    796         display: block;
    797         padding-top: 50px;
    798         margin-top: -50px;
    799 }
    800 
    801 .hide-privacy-policy-tutorial {
    802         background-color: #fff;
    803 }
    804 
    805 .hide-privacy-policy-tutorial .wp-policy-help, /* For back-compat, see #49282 */
    806 .hide-privacy-policy-tutorial .privacy-policy-tutorial {
    807         display: none;
    808 }
    809 
    810 .policy-text {
    811         margin-bottom: 1em;
    812 }
    813 
    814 .policy-text > *:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help),
    815 .policy-text div > *:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help) {
    816         background-color: #fff;
    817         margin: 0;
    818         padding: 1em;
    819 }
    820 
    821 .policy-text > *:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help) + *:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help),
    822 .policy-text div > *:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help) + *:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help) {
    823         padding-top: 0;
    824 }
    825 
    826 .hide-privacy-policy-tutorial > *:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help) {
    827         margin: 1em 0;
    828         padding: 0;
    829 }
    830 
    831 .policy-text ul li,
    832 .policy-text ol li {
    833         margin-left: 2em;
    834 }
    835 
    836 .policy-text ul {
    837         list-style: disc;
    838 }
    839 
    840 strong.wp-policy-help, /* For back-compat, see #49282 */
    841 strong.privacy-policy-tutorial {
    842         display: block;
    843         margin: 0 0 1em;
    844 }
    845 
    846 .notice.wp-pp-notice {
    847         margin: 15px 0 3px;
    848 }
    849 
    850698/*------------------------------------------------------------------------------
    851699  11.1 - Custom Fields
    852700------------------------------------------------------------------------------*/
  • src/wp-admin/includes/class-wp-privacy-policy-content.php

     
    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( 'privacy-policy-guide.php?tab=policyguide' ) )
    146146                                );
    147147                        ?>
    148148                        </p>
     
    328328                }
    329329
    330330                $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.' );
    331                 $url     = esc_url( admin_url( 'privacy-policy-guide.php' ) );
     331                $url     = esc_url( admin_url( 'options-privacy.php?tab=policyguide' ) );
    332332                $label   = __( 'View Privacy Policy Guide.' );
    333333
    334334                if ( get_current_screen()->is_block_editor() ) {
     
    375375
    376376                $content_array = self::get_suggested_policy_text();
    377377                $content       = '';
    378                 $toc           = array( '<li><a href="#wp-privacy-policy-guide-introduction">' . __( 'Introduction' ) . '</a></li>' );
    379378                $date_format   = __( 'F j, Y' );
    380379
    381380                foreach ( $content_array as $section ) {
     
    384383                        $removed = '';
    385384
    386385                        if ( ! empty( $section['removed'] ) ) {
    387                                 $class = 'text-removed';
     386                                $badge_class = ' red';
    388387                                $date  = date_i18n( $date_format, $section['removed'] );
    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="notice notice-info inline"><p>' . sprintf( $removed, $date ) . '</p></div>';
    395394                        } elseif ( ! empty( $section['updated'] ) ) {
    396                                 $class = 'text-updated';
     395                                $badge_class = ' blue';
    397396                                $date  = date_i18n( $date_format, $section['updated'] );
    398397                                /* translators: %s: Date of privacy policy text update. */
    399                                 $meta = sprintf( __( 'Updated %s.' ), $date );
     398                                $badge_title = sprintf( __( 'Updated %s.' ), $date );
    400399                        }
    401400
    402                         if ( $meta ) {
    403                                 $meta = '<br><span class="privacy-text-meta">' . $meta . '</span>';
    404                         }
    405 
    406401                        $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 );
    409402
    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 
    418                         if ( empty( $section['removed'] ) ) {
    419                                 $content .= '<div class="privacy-text-actions">';
    420                                 $content .= '<button type="button" class="privacy-text-copy button">';
    421                                 $content .= __( 'Copy this section to clipboard' );
    422                                 $content .= '</button>';
    423                                 $content .= '<span class="success" aria-hidden="true">' . __( 'Copied!' ) . '</span>';
    424                                 $content .= '</div>';
    425                         }
    426 
    427                         $content .= '<a href="#wpbody" class="return-to-top"><span aria-hidden="true">&uarr; </span> ' . __( 'Go to top' ) . '</a>';
    428 
    429                         $content .= '</div>'; // End of .privacy-text-section.
    430                 }
    431 
    432                 if ( count( $toc ) > 2 ) {
     403                        $sanitized_policy_name = sanitize_title_with_dashes( $plugin_name );
    433404                        ?>
    434                         <div class="privacy-text-box-toc">
    435                                 <p><?php _e( 'Table of Contents' ); ?></p>
    436                                 <ol>
    437                                         <?php echo implode( $toc ); ?>
    438                                 </ol>
     405                        <h4 class="privacy-settings-accordion-heading">
     406                        <button aria-expanded="false" class="privacy-settings-accordion-trigger" aria-controls="privacy-settings-accordion-block-<?php echo $sanitized_policy_name; ?>" type="button">
     407                                <span class="title"><?php echo $plugin_name ?></span>
     408                                <?php if ( ! empty( $section['removed'] ) || ! empty( $section['updated'] ) ) : ?>
     409                                <span class="badge <?php echo $badge_class; ?>"> <?php echo $badge_title ?></span>
     410                                <?php endif; ?>
     411                                <span class="icon"></span>
     412                        </button>
     413                        </h4>
     414                        <div id="privacy-settings-accordion-block-<?php echo $sanitized_policy_name; ?>" class="privacy-settings-accordion-panel privacy-text-box-body" hidden="hidden">
     415                                <?php
     416                                echo $removed;
     417                                echo $section['policy_text'];
     418                                ?>
     419                                <?php if ( empty( $section['removed'] ) ) : ?>
     420                                <div class="privacy-settings-accordion-actions">
     421                                        <span class="success" aria-hidden="true"><?php _e( 'Copied!' ) ?></span>
     422                                        <button type="button" class="privacy-text-copy button">
     423                                                <?php _e( 'Copy suggested policy text to clipboard' ); ?>
     424                                                <span class="screen-reader-text">
     425                                                        <?php
     426                                                        /* translators: %s: Plugin name. */
     427                                                        sprintf( __( 'Copy suggested policy text from %s.' ), $plugin_name );
     428                                                        ?>
     429                                                </span>
     430                                        </button>
     431                                </div>
     432                                <?php endif; ?>
    439433                        </div>
    440434                        <?php
    441435                }
    442 
    443                 ?>
    444                 <div class="privacy-text-box">
    445                         <div class="privacy-text-box-head">
    446                                 <a id="wp-privacy-policy-guide-introduction">&nbsp;</a>
    447                                 <h2><?php _e( 'Introduction' ); ?></h2>
    448                                 <p><?php _e( 'Hello,' ); ?></p>
    449                                 <p><?php _e( 'This text template will help you to create your web site&#8217;s privacy policy.' ); ?></p>
    450                                 <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>
    451                                 <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>
    452                                 <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>
    453                         </div>
    454 
    455                         <div class="privacy-text-box-body">
    456                                 <?php echo $content; ?>
    457                         </div>
    458                 </div>
    459                 <?php
    460436        }
    461437
    462438        /**
     
    470446         * @return string The default policy content.
    471447         */
    472448        public static function get_default_content( $description = false, $blocks = true ) {
    473                 $suggested_text = $description ? '<strong class="privacy-policy-tutorial">' . __( 'Suggested text:' ) . ' </strong>' : '';
     449                $suggested_text = '<p class="privacy-policy-suggested-text-header">' . __( 'Suggested text:' ) . ' </p>';
    474450                $content        = '';
    475451                $strings        = array();
    476452
    477453                // Start of the suggested privacy policy text.
    478                 if ( $description ) {
    479                         $strings[] = '<div class="wp-suggested-text">';
    480                 }
    481454
    482455                /* translators: Default privacy policy heading. */
    483456                $strings[] = '<h2>' . __( 'Who we are' ) . '</h2>';
     
    487460                        $strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should note your site URL, as well as the name of the company, organization, or individual behind it, and some accurate contact information.' ) . '</p>';
    488461                        /* translators: Privacy policy tutorial. */
    489462                        $strings[] = '<p class="privacy-policy-tutorial">' . __( 'The amount of information you may be required to show will vary depending on your local or national business regulations. You may, for example, be required to display a physical address, a registered address, or your company registration number.' ) . '</p>';
     463                } else {
     464                        $strings[] = $suggested_text;
     465                        /* translators: Default privacy policy text. %s: Site URL. */
     466                        $strings[] = '<p class="privacy-policy-suggested-text">' . sprintf( __( 'Our website address is: %s.' ), get_bloginfo( 'url', 'display' ) ) . '</p>';
    490467                }
    491468
    492                 /* translators: Default privacy policy text. %s: Site URL. */
    493                 $strings[] = '<p>' . $suggested_text . sprintf( __( 'Our website address is: %s.' ), get_bloginfo( 'url', 'display' ) ) . '</p>';
    494 
    495                 /* translators: Default privacy policy heading. */
    496                 $strings[] = '<h2>' . __( 'What personal data we collect and why we collect it' ) . '</h2>';
    497 
    498469                if ( $description ) {
     470                        /* translators: Default privacy policy heading. */
     471                        $strings[] = '<h2>' . __( 'What personal data we collect and why we collect it' ) . '</h2>';
    499472                        /* translators: Privacy policy tutorial. */
    500473                        $strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should note what personal data you collect from users and site visitors. This may include personal data, such as name, email address, personal account preferences; transactional data, such as purchase information; and technical data, such as information about cookies.' ) . '</p>';
    501474                        /* translators: Privacy policy tutorial. */
     
    509482                }
    510483
    511484                /* translators: Default privacy policy heading. */
    512                 $strings[] = '<h3>' . __( 'Comments' ) . '</h3>';
     485                $strings[] = '<h2>' . __( 'Comments' ) . '</h2>';
    513486
    514487                if ( $description ) {
    515488                        /* translators: Privacy policy tutorial. */
    516489                        $strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should note what information is captured through comments. We have noted the data which WordPress collects by default.' ) . '</p>';
     490                } else {
     491                        $strings[] = $suggested_text;
     492                        /* translators: Default privacy policy text. */
     493                        $strings[] = '<p class="privacy-policy-suggested-text">' . __( 'When visitors leave comments on the site we collect the data shown in the comments form, and also the visitor&#8217;s IP address and browser user agent string to help spam detection.' ) . '</p>';
     494                        /* translators: Default privacy policy text. */
     495                        $strings[] = '<p class="privacy-policy-suggested-text">' . __( 'An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic.com/privacy/. After approval of your comment, your profile picture is visible to the public in the context of your comment.' ) . '</p>';
    517496                }
    518 
    519                 /* translators: Default privacy policy text. */
    520                 $strings[] = '<p>' . $suggested_text . __( 'When visitors leave comments on the site we collect the data shown in the comments form, and also the visitor&#8217;s IP address and browser user agent string to help spam detection.' ) . '</p>';
    521                 /* translators: Default privacy policy text. */
    522                 $strings[] = '<p>' . __( 'An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic.com/privacy/. After approval of your comment, your profile picture is visible to the public in the context of your comment.' ) . '</p>';
    523 
    524497                /* translators: Default privacy policy heading. */
    525                 $strings[] = '<h3>' . __( 'Media' ) . '</h3>';
     498                $strings[] = '<h2>' . __( 'Media' ) . '</h2>';
    526499
    527500                if ( $description ) {
    528501                        /* translators: Privacy policy tutorial. */
    529502                        $strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should note what information may be disclosed by users who can upload media files. All uploaded files are usually publicly accessible.' ) . '</p>';
     503                } else {
     504                        $strings[] = $suggested_text;
     505                        /* translators: Default privacy policy text. */
     506                        $strings[] = '<p class="privacy-policy-suggested-text">'  . __( 'If you upload images to the website, you should avoid uploading images with embedded location data (EXIF GPS) included. Visitors to the website can download and extract any location data from images on the website.' ) . '</p>';
    530507                }
    531508
    532                 /* translators: Default privacy policy text. */
    533                 $strings[] = '<p>' . $suggested_text . __( 'If you upload images to the website, you should avoid uploading images with embedded location data (EXIF GPS) included. Visitors to the website can download and extract any location data from images on the website.' ) . '</p>';
    534 
    535                 /* translators: Default privacy policy heading. */
    536                 $strings[] = '<h3>' . __( 'Contact forms' ) . '</h3>';
    537 
    538509                if ( $description ) {
     510                        /* translators: Default privacy policy heading. */
     511                        $strings[] = '<h2>' . __( 'Contact forms' ) . '</h2>';
    539512                        /* translators: Privacy policy tutorial. */
    540513                        $strings[] = '<p class="privacy-policy-tutorial">' . __( 'By default, WordPress does not include a contact form. If you use a contact form plugin, use this subsection to note what personal data is captured when someone submits a contact form, and how long you keep it. For example, you may note that you keep contact form submissions for a certain period for customer service purposes, but you do not use the information submitted through them for marketing purposes.' ) . '</p>';
    541514                }
    542515
    543516                /* translators: Default privacy policy heading. */
    544                 $strings[] = '<h3>' . __( 'Cookies' ) . '</h3>';
     517                $strings[] = '<h2>' . __( 'Cookies' ) . '</h2>';
    545518
    546519                if ( $description ) {
    547520                        /* translators: Privacy policy tutorial. */
    548521                        $strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should list the cookies your web site uses, including those set by your plugins, social media, and analytics. We have provided the cookies which WordPress installs by default.' ) . '</p>';
     522                } else {
     523                        $strings[] = $suggested_text;
     524                        /* translators: Default privacy policy text. */
     525                        $strings[] = '<p class="privacy-policy-suggested-text">' . __( 'If you leave a comment on our site you may opt-in to saving your name, email address and website in cookies. These are for your convenience so that you do not have to fill in your details again when you leave another comment. These cookies will last for one year.' ) . '</p>';
     526                        /* translators: Default privacy policy text. */
     527                        $strings[] = '<p class="privacy-policy-suggested-text">' . __( 'If you visit our login page, we will set a temporary cookie to determine if your browser accepts cookies. This cookie contains no personal data and is discarded when you close your browser.' ) . '</p>';
     528                        /* translators: Default privacy policy text. */
     529                        $strings[] = '<p class="privacy-policy-suggested-text">' . __( 'When you log in, we will also set up several cookies to save your login information and your screen display choices. Login cookies last for two days, and screen options cookies last for a year. If you select &quot;Remember Me&quot;, your login will persist for two weeks. If you log out of your account, the login cookies will be removed.' ) . '</p>';
     530                        /* translators: Default privacy policy text. */
     531                        $strings[] = '<p class="privacy-policy-suggested-text">' . __( 'If you edit or publish an article, an additional cookie will be saved in your browser. This cookie includes no personal data and simply indicates the post ID of the article you just edited. It expires after 1 day.' ) . '</p>';
    549532                }
     533                if ( ! $description ) {
     534                        /* translators: Default privacy policy heading. */
     535                        $strings[] = '<h2>' . __( 'Embedded content from other websites' ) . '</h2>';
     536                        $strings[] = $suggested_text;
     537                        /* translators: Default privacy policy text. */
     538                        $strings[] = '<p class="privacy-policy-suggested-text">' . __( 'Articles on this site may include embedded content (e.g. videos, images, articles, etc.). Embedded content from other websites behaves in the exact same way as if the visitor has visited the other website.' ) . '</p>';
     539                        /* translators: Default privacy policy text. */
     540                        $strings[] = '<p class="privacy-policy-suggested-text">' . __( 'These websites may collect data about you, use cookies, embed additional third-party tracking, and monitor your interaction with that embedded content, including tracking your interaction with the embedded content if you have an account and are logged in to that website.' ) . '</p>';
     541                }
    550542
    551                 /* translators: Default privacy policy text. */
    552                 $strings[] = '<p>' . $suggested_text . __( 'If you leave a comment on our site you may opt-in to saving your name, email address and website in cookies. These are for your convenience so that you do not have to fill in your details again when you leave another comment. These cookies will last for one year.' ) . '</p>';
    553                 /* translators: Default privacy policy text. */
    554                 $strings[] = '<p>' . __( 'If you visit our login page, we will set a temporary cookie to determine if your browser accepts cookies. This cookie contains no personal data and is discarded when you close your browser.' ) . '</p>';
    555                 /* translators: Default privacy policy text. */
    556                 $strings[] = '<p>' . __( 'When you log in, we will also set up several cookies to save your login information and your screen display choices. Login cookies last for two days, and screen options cookies last for a year. If you select &quot;Remember Me&quot;, your login will persist for two weeks. If you log out of your account, the login cookies will be removed.' ) . '</p>';
    557                 /* translators: Default privacy policy text. */
    558                 $strings[] = '<p>' . __( 'If you edit or publish an article, an additional cookie will be saved in your browser. This cookie includes no personal data and simply indicates the post ID of the article you just edited. It expires after 1 day.' ) . '</p>';
    559 
    560                 /* translators: Default privacy policy heading. */
    561                 $strings[] = '<h3>' . __( 'Embedded content from other websites' ) . '</h3>';
    562                 /* translators: Default privacy policy text. */
    563                 $strings[] = '<p>' . $suggested_text . __( 'Articles on this site may include embedded content (e.g. videos, images, articles, etc.). Embedded content from other websites behaves in the exact same way as if the visitor has visited the other website.' ) . '</p>';
    564                 /* translators: Default privacy policy text. */
    565                 $strings[] = '<p>' . __( 'These websites may collect data about you, use cookies, embed additional third-party tracking, and monitor your interaction with that embedded content, including tracking your interaction with the embedded content if you have an account and are logged in to that website.' ) . '</p>';
    566 
    567                 /* translators: Default privacy policy heading. */
    568                 $strings[] = '<h3>' . __( 'Analytics' ) . '</h3>';
    569 
    570543                if ( $description ) {
     544                        /* translators: Default privacy policy heading. */
     545                        $strings[] = '<h2>' . __( 'Analytics' ) . '</h2>';
    571546                        /* translators: Privacy policy tutorial. */
    572547                        $strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should note what analytics package you use, how users can opt out of analytics tracking, and a link to your analytics provider&#8217;s privacy policy, if any.' ) . '</p>';
    573548                        /* translators: Privacy policy tutorial. */
     
    582557                        $strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should name and list all third party providers with whom you share site data, including partners, cloud-based services, payment processors, and third party service providers, and note what data you share with them and why. Link to their own privacy policies if possible.' ) . '</p>';
    583558                        /* translators: Privacy policy tutorial. */
    584559                        $strings[] = '<p class="privacy-policy-tutorial">' . __( 'By default WordPress does not share any personal data with anyone.' ) . '</p>';
     560                } else {
     561                        /* translators: Default privacy policy text. */
     562                        $strings[] = '<p class="privacy-policy-suggested-text">' . __( 'If you request a password reset, your IP address will be included in the reset email.' ) . '</p>';
    585563                }
    586564
    587                 /* translators: Default privacy policy text. */
    588                 $strings[] = '<p>' . $suggested_text . __( 'If you request a password reset, your IP address will be included in the reset email.' ) . '</p>';
    589 
    590565                /* translators: Default privacy policy heading. */
    591566                $strings[] = '<h2>' . __( 'How long we retain your data' ) . '</h2>';
    592567
     
    593568                if ( $description ) {
    594569                        /* translators: Privacy policy tutorial. */
    595570                        $strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should explain how long you retain personal data collected or processed by the web site. While it is your responsibility to come up with the schedule of how long you keep each dataset for and why you keep it, that information does need to be listed here. For example, you may want to say that you keep contact form entries for six months, analytics records for a year, and customer purchase records for ten years.' ) . '</p>';
     571                } else {
     572                        $strings[] = $suggested_text;
     573                        /* translators: Default privacy policy text. */
     574                        $strings[] = '<p class="privacy-policy-suggested-text">' . __( 'If you leave a comment, the comment and its metadata are retained indefinitely. This is so we can recognize and approve any follow-up comments automatically instead of holding them in a moderation queue.' ) . '</p>';
     575                        /* translators: Default privacy policy text. */
     576                        $strings[] = '<p class="privacy-policy-suggested-text">' . __( 'For users that register on our website (if any), we also store the personal information they provide in their user profile. All users can see, edit, or delete their personal information at any time (except they cannot change their username). Website administrators can also see and edit that information.' ) . '</p>';
    596577                }
    597578
    598                 /* translators: Default privacy policy text. */
    599                 $strings[] = '<p>' . $suggested_text . __( 'If you leave a comment, the comment and its metadata are retained indefinitely. This is so we can recognize and approve any follow-up comments automatically instead of holding them in a moderation queue.' ) . '</p>';
    600                 /* translators: Default privacy policy text. */
    601                 $strings[] = '<p>' . __( 'For users that register on our website (if any), we also store the personal information they provide in their user profile. All users can see, edit, or delete their personal information at any time (except they cannot change their username). Website administrators can also see and edit that information.' ) . '</p>';
    602 
    603579                /* translators: Default privacy policy heading. */
    604580                $strings[] = '<h2>' . __( 'What rights you have over your data' ) . '</h2>';
    605581
     
    606582                if ( $description ) {
    607583                        /* translators: Privacy policy tutorial. */
    608584                        $strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should explain what rights your users have over their data and how they can invoke those rights.' ) . '</p>';
     585                } else {
     586                        $strings[] = $suggested_text;
     587                        /* translators: Default privacy policy text. */
     588                        $strings[] = '<p class="privacy-policy-suggested-text">' . __( 'If you have an account on this site, or have left comments, you can request to receive an exported file of the personal data we hold about you, including any data you have provided to us. You can also request that we erase any personal data we hold about you. This does not include any data we are obliged to keep for administrative, legal, or security purposes.' ) . '</p>';
    609589                }
    610590
    611                 /* translators: Default privacy policy text. */
    612                 $strings[] = '<p>' . $suggested_text . __( 'If you have an account on this site, or have left comments, you can request to receive an exported file of the personal data we hold about you, including any data you have provided to us. You can also request that we erase any personal data we hold about you. This does not include any data we are obliged to keep for administrative, legal, or security purposes.' ) . '</p>';
    613 
    614591                /* translators: Default privacy policy heading. */
    615592                $strings[] = '<h2>' . __( 'Where we send your data' ) . '</h2>';
    616593
     
    619596                        $strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should list all transfers of your site data outside the European Union and describe the means by which that data is safeguarded to European data protection standards. This could include your web hosting, cloud storage, or other third party services.' ) . '</p>';
    620597                        /* translators: Privacy policy tutorial. */
    621598                        $strings[] = '<p class="privacy-policy-tutorial">' . __( 'European data protection law requires data about European residents which is transferred outside the European Union to be safeguarded to the same standards as if the data was in Europe. So in addition to listing where data goes, you should describe how you ensure that these standards are met either by yourself or by your third party providers, whether that is through an agreement such as Privacy Shield, model clauses in your contracts, or binding corporate rules.' ) . '</p>';
     599                } else {
     600                        $strings[] = $suggested_text;
     601                        /* translators: Default privacy policy text. */
     602                        $strings[] = '<p class="privacy-policy-suggested-text">' . __( 'Visitor comments may be checked through an automated spam detection service.' ) . '</p>';
    622603                }
    623604
    624                 /* translators: Default privacy policy text. */
    625                 $strings[] = '<p>' . $suggested_text . __( 'Visitor comments may be checked through an automated spam detection service.' ) . '</p>';
    626 
    627                 /* translators: Default privacy policy heading. */
    628                 $strings[] = '<h2>' . __( 'Contact information' ) . '</h2>';
    629 
    630605                if ( $description ) {
     606                        /* translators: Default privacy policy heading. */
     607                        $strings[] = '<h2>' . __( 'Contact information' ) . '</h2>';
    631608                        /* translators: Privacy policy tutorial. */
    632609                        $strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should provide a contact method for privacy-specific concerns. If you are required to have a Data Protection Officer, list their name and full contact details here as well.' ) . '</p>';
    633610                }
    634611
    635                 /* translators: Default privacy policy heading. */
    636                 $strings[] = '<h2>' . __( 'Additional information' ) . '</h2>';
    637 
    638612                if ( $description ) {
     613                        /* translators: Default privacy policy heading. */
     614                        $strings[] = '<h2>' . __( 'Additional information' ) . '</h2>';
    639615                        /* translators: Privacy policy tutorial. */
    640616                        $strings[] = '<p class="privacy-policy-tutorial">' . __( 'If you use your site for commercial purposes and you engage in more complex collection or processing of personal data, you should note the following information in your privacy policy in addition to the information we have already discussed.' ) . '</p>';
    641617                }
    642618
    643                 /* translators: Default privacy policy heading. */
    644                 $strings[] = '<h3>' . __( 'How we protect your data' ) . '</h3>';
    645 
    646619                if ( $description ) {
     620                        /* translators: Default privacy policy heading. */
     621                        $strings[] = '<h2>' . __( 'How we protect your data' ) . '</h2>';
    647622                        /* translators: Privacy policy tutorial. */
    648623                        $strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should explain what measures you have taken to protect your users&#8217; data. This could include technical measures such as encryption; security measures such as two factor authentication; and measures such as staff training in data protection. If you have carried out a Privacy Impact Assessment, you can mention it here too.' ) . '</p>';
    649624                }
    650625
    651                 /* translators: Default privacy policy heading. */
    652                 $strings[] = '<h3>' . __( 'What data breach procedures we have in place' ) . '</h3>';
    653 
    654626                if ( $description ) {
     627                        /* translators: Default privacy policy heading. */
     628                        $strings[] = '<h2>' . __( 'What data breach procedures we have in place' ) . '</h2>';
    655629                        /* translators: Privacy policy tutorial. */
    656630                        $strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should explain what procedures you have in place to deal with data breaches, either potential or real, such as internal reporting systems, contact mechanisms, or bug bounties.' ) . '</p>';
    657631                }
    658632
    659                 /* translators: Default privacy policy heading. */
    660                 $strings[] = '<h3>' . __( 'What third parties we receive data from' ) . '</h3>';
    661 
    662633                if ( $description ) {
     634                        /* translators: Default privacy policy heading. */
     635                        $strings[] = '<h2>' . __( 'What third parties we receive data from' ) . '</h2>';
    663636                        /* translators: Privacy policy tutorial. */
    664637                        $strings[] = '<p class="privacy-policy-tutorial">' . __( 'If your web site receives data about users from third parties, including advertisers, this information must be included within the section of your privacy policy dealing with third party data.' ) . '</p>';
    665638                }
    666639
    667                 /* translators: Default privacy policy heading. */
    668                 $strings[] = '<h3>' . __( 'What automated decision making and/or profiling we do with user data' ) . '</h3>';
    669 
    670640                if ( $description ) {
     641                        /* translators: Default privacy policy heading. */
     642                        $strings[] = '<h2>' . __( 'What automated decision making and/or profiling we do with user data' ) . '</h2>';
    671643                        /* translators: Privacy policy tutorial. */
    672644                        $strings[] = '<p class="privacy-policy-tutorial">' . __( 'If your web site provides a service which includes automated decision making - for example, allowing customers to apply for credit, or aggregating their data into an advertising profile - you must note that this is taking place, and include information about how that information is used, what decisions are made with that aggregated data, and what rights users have over decisions made without human intervention.' ) . '</p>';
    673645                }
    674646
    675                 /* translators: Default privacy policy heading. */
    676                 $strings[] = '<h3>' . __( 'Industry regulatory disclosure requirements' ) . '</h3>';
    677 
    678647                if ( $description ) {
     648                        /* translators: Default privacy policy heading. */
     649                        $strings[] = '<h2>' . __( 'Industry regulatory disclosure requirements' ) . '</h2>';
    679650                        /* translators: Privacy policy tutorial. */
    680651                        $strings[] = '<p class="privacy-policy-tutorial">' . __( 'If you are a member of a regulated industry, or if you are subject to additional privacy laws, you may be required to disclose that information here.' ) . '</p>';
    681                         $strings[] = '</div>';
    682652                }
    683653
    684654                if ( $blocks ) {
     
    690660                                if ( 0 === strpos( $string, '<h2>' ) ) {
    691661                                        $strings[ $key ] = '<!-- wp:heading -->' . $string . '<!-- /wp:heading -->';
    692662                                }
    693 
    694                                 if ( 0 === strpos( $string, '<h3>' ) ) {
    695                                         $strings[ $key ] = '<!-- wp:heading {"level":3} -->' . $string . '<!-- /wp:heading -->';
    696                                 }
    697663                        }
    698664                }
    699665
     
    706672                 * @since 4.9.6
    707673                 * @since 5.0.0 Added the `$strings`, `$description`, and `$blocks` parameters.
    708674                 *
     675                 ** @deprecated 5.7.0 This filter has been deprecated.
     676                 *
    709677                 * @param string   $content     The default policy content.
    710678                 * @param string[] $strings     An array of privacy policy content strings.
    711679                 * @param bool     $description Whether policy descriptions should be included.
    712680                 * @param bool     $blocks      Whether the content should be formatted for the block editor.
    713681                 */
    714                 return apply_filters( 'wp_get_default_privacy_policy_content', $content, $strings, $description, $blocks );
     682                return apply_filters_deprecated( 'wp_get_default_privacy_policy_content', array( $content, $strings, $description, $blocks ), '5.4.0', false );
    715683        }
    716684
    717685        /**
     
    720688         * @since 4.9.6
    721689         */
    722690        public static function add_suggested_content() {
    723                 $content = self::get_default_content( true, false );
     691                $content = self::get_default_content( false, false );
    724692                wp_add_privacy_policy_content( __( 'WordPress' ), $content );
    725693        }
    726694}
  • src/wp-admin/options-privacy.php

     
    1313        wp_die( __( 'Sorry, you are not allowed to manage privacy options 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 ) ) {
     
    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.' ); ?>
     
    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                                $view_href = get_permalink( $privacy_policy_page_id );
     191                        ?>
     192                                <strong>
     193                                <?php
     194                                if ( 'publish' === get_post_status( $privacy_policy_page_id ) ) {
     195                                        printf(
     196                                                /* translators: 1: URL to edit Privacy Policy page, 2: URL to view Privacy Policy page. */
     197                                                __( '<a href="%1$s">Edit</a> or <a href="%2$s">view</a> your Privacy Policy page content.' ),
     198                                                esc_url( $edit_href ),
     199                                                esc_url( $view_href )
     200                                        );
     201                                } else {
     202                                        printf(
     203                                                /* translators: 1: URL to edit Privacy Policy page, 2: URL to preview Privacy Policy page. */
     204                                                __( '<a href="%1$s">Edit</a> or <a href="%2$s">preview</a> your Privacy Policy page content.' ),
     205                                                esc_url( $edit_href ),
     206                                                esc_url( $view_href )
     207                                        );
     208                                }
     209                                ?>
     210                                </strong>
     211                        <?php
     212                }
    173213                printf(
    174214                        /* 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' ) ),
     215                        __( '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.' ),
     216                        esc_url( admin_url( 'options-privacy.php?tab=policyguide' ) ),
    177217                        '',
    178218                        ''
    179219                );
     
    181221        </p>
    182222
    183223        <hr>
     224
     225        <?php
     226        $has_pages = (bool) get_posts(
     227                array(
     228                        'post_type'      => 'page',
     229                        'posts_per_page' => 1,
     230                        'post_status'    => array(
     231                                'publish',
     232                                'draft',
     233                        ),
     234                )
     235        );
     236        ?>
     237
    184238        <table class="form-table tools-privacy-policy-page" role="presentation">
    185239                <tr>
    186240                        <th scope="row">
     241                                <label for="create-page">
     242                                <?php
     243                                if ( $has_pages ) {
     244                                        _e( 'Create a new Privacy Policy Page' );
     245                                } else {
     246                                        _e( 'There are no pages.' );
     247                                }
     248                                ?>
     249                                </label>
     250                        </td>
     251                        <td>
     252                                <form class="wp-create-privacy-page" method="post" action="">
     253                                        <input type="hidden" name="action" value="create-privacy-page" />
     254                                        <?php
     255                                        wp_nonce_field( 'create-privacy-page' );
     256                                        submit_button( __( 'Create' ), 'secondary', 'submit', false, array( 'id' => 'create-page' ) );
     257                                        ?>
     258                                </form>
     259                        </td>
     260                </tr>
     261                <?php if ( $has_pages ) : ?>
     262                <tr>
     263                        <th scope="row">
    187264                                <label for="page_for_privacy_policy">
    188265                                        <?php
    189266                                        if ( $privacy_policy_page_exists ) {
     
    195272                                </label>
    196273                        </th>
    197274                        <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                                 );
     275                                <form method="post" action="">
     276                                        <input type="hidden" name="action" value="set-privacy-page" />
     277                                        <?php
     278                                        wp_dropdown_pages(
     279                                                array(
     280                                                        'name'              => 'page_for_privacy_policy',
     281                                                        'show_option_none'  => __( '&mdash; Select &mdash;' ),
     282                                                        'option_none_value' => '0',
     283                                                        'selected'          => $privacy_policy_page_id,
     284                                                        'post_status'       => array( 'draft', 'publish' ),
     285                                                )
     286                                        );
    209287
    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                                                 );
     288                                        wp_nonce_field( 'set-privacy-page' );
    224289
    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>
    243                                         <?php
    244                                         wp_nonce_field( 'create-privacy-page' );
    245 
    246                                         submit_button( __( 'Create New Page' ), 'primary', 'submit', false, array( 'id' => 'create-page' ) );
     290                                        submit_button( __( 'Use This Page' ), 'primary', 'submit', false, array( 'id' => 'set-page' ) );
    247291                                        ?>
    248292                                </form>
    249293                        </td>
    250294                </tr>
     295                <?php endif; ?>
    251296        </table>
    252297</div>
    253298<?php
  • src/wp-admin/privacy-policy-guide.php

     
    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 ';
    2124
     25                return $body_class;
     26        }
     27);
     28
    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>
    2940
    30         <div class="wp-privacy-policy-guide">
     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>
     63
     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        <div class="privacy-settings-accordion">
     72                <h4 class="privacy-settings-accordion-heading">
     73                        <button aria-expanded="false" class="privacy-settings-accordion-trigger" aria-controls="privacy-settings-accordion-block-privacy-policy-guide" type="button">
     74                                <span class="title"><?php _e( 'Privacy Policy Guide' ); ?></span>
     75                                <span class="icon"></span>
     76                        </button>
     77                </h4>
     78                <div id="privacy-settings-accordion-block-privacy-policy-guide" class="privacy-settings-accordion-panel" hidden="hidden">
     79                        <?php
     80                        $content = WP_Privacy_Policy_Content::get_default_content( true, false );
     81                        echo $content;
     82                        ?>
     83                </div>
     84        </div>
     85        <hr class="hr-separator">
     86        <h3 class="section-title"><?php _e( 'Policies' ); ?></h3>
     87        <div class="privacy-settings-accordion wp-privacy-policy-guide">
    3188                <?php WP_Privacy_Policy_Content::privacy_policy_guide(); ?>
    3289        </div>
    33 </div>
     90</div> <!-- privacy-settings-body -->
    3491<?php
    3592
    3693require_once ABSPATH . 'wp-admin/admin-footer.php';
  • src/wp-admin/tools.php

     
    2121// The privacy policy guide used to be outputted from here. Since WP 5.3 it is in wp-admin/privacy-policy-guide.php.
    2222if ( isset( $_GET['wp-privacy-policy-guide'] ) ) {
    2323        require_once dirname( __DIR__ ) . '/wp-load.php';
    24         wp_redirect( admin_url( 'privacy-policy-guide.php' ), 301 );
     24        wp_redirect( admin_url( 'options-privacy.php?tab=policyguide' ), 301 );
    2525        exit;
    2626} elseif ( isset( $_GET['page'] ) ) {
    2727        // These were also moved to files in WP 5.3.