WordPress.org

Make WordPress Core

Changeset 50161


Ignore:
Timestamp:
02/02/2021 08:12:39 PM (9 months ago)
Author:
TimothyBlynJacobs
Message:

Privacy: Redesign the Privacy settings pages.

The Privacy settings pages now use the same design patterns as the Site Health screen. Additionally, each privacy policy guide is now contained in an accordion to make the page easier to navigate when multiple plugins are in use.

Props xkon, hedgefield, garrett-eclipse, hellofromTonya, paaljoachim, joedolson.
Fixes #49264.

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/admin/privacy-tools.js

    r50001 r50161  
    276276    $( document ).on( 'click', function( event ) {
    277277        var $parent,
    278             $container,
    279278            range,
    280279            $target = $( event.target ),
     
    284283
    285284        if ( $target.is( 'button.privacy-text-copy' ) ) {
    286             $parent = $target.parent().parent();
    287             $container = $parent.find( 'div.wp-suggested-text' );
    288 
    289             if ( ! $container.length ) {
    290                 $container = $parent.find( 'div.policy-text' );
    291             }
    292 
    293             if ( $container.length ) {
     285            $parent = $target.closest( '.privacy-settings-accordion-panel' );
     286
     287            if ( $parent.length ) {
    294288                try {
    295289                    var documentPosition = document.documentElement.scrollTop,
     
    301295                    // Hide tutorial content to remove from copied content.
    302296                    range = document.createRange();
    303                     $container.addClass( 'hide-privacy-policy-tutorial' );
     297                    $parent.addClass( 'hide-privacy-policy-tutorial' );
    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( 'hide-privacy-policy-tutorial' );
    312306                    window.getSelection().removeAllRanges();
    313307
     
    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.
     
    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});
  • trunk/src/wp-admin/css/edit.css

    r50025 r50161  
    696696}
    697697
     698/**
     699* Privacy Settings section
     700*/
     701
     702/* General */
     703.privacy-settings #wpcontent,
     704.privacy-settings.auto-fold #wpcontent {
     705    padding-left: 0;
     706}
     707
     708.privacy-settings-header h1 {
     709    display: inline-block;
     710    font-weight: 600;
     711    margin: 0 0.8rem 1rem;
     712    font-size: 23px;
     713    padding: 9px 0 4px 0;
     714    line-height: 1.3;
     715}
     716
     717/* Header */
     718.privacy-settings-header {
     719    text-align: center;
     720    margin: 0 0 1rem;
     721    background: #fff;
     722    border-bottom: 1px solid #e2e4e7;
     723}
     724
     725.privacy-settings-title-section {
     726    display: flex;
     727    align-items: center;
     728    justify-content: center;
     729    clear: both;
     730}
     731
     732.privacy-settings-tabs-wrapper {
     733    /* IE 11 */
     734    display: -ms-inline-grid;
     735    -ms-grid-columns: 1fr 1fr;
     736    vertical-align: top;
     737    /* modern browsers */
     738    display: inline-grid;
     739    grid-template-columns: 1fr 1fr;
     740}
     741
     742.privacy-settings-tab {
     743    display: block; /* IE 11 */
     744    text-decoration: none;
     745    color: inherit;
     746    padding: 0.5rem 1rem 1rem;
     747    margin: 0 1rem;
     748    transition: box-shadow 0.5s ease-in-out;
     749}
     750
     751.privacy-settings-tab:nth-child(1) {
     752    -ms-grid-column: 1; /* IE 11 */
     753}
     754
     755.privacy-settings-tab:nth-child(2) {
     756    -ms-grid-column: 2; /* IE 11 */
     757}
     758
     759.privacy-settings-tab:focus {
     760    color: #191e23;
     761    outline: 1px solid #6c7781;
     762    box-shadow: none;
     763}
     764
     765.privacy-settings-tab.active {
     766    box-shadow: inset 0 -3px #007cba;
     767    font-weight: 600;
     768}
     769
     770/* Body */
     771.privacy-settings-body {
     772    max-width: 800px;
     773    margin: 0 auto;
     774}
     775
     776.tools-privacy-policy-page th {
     777    min-width: 230px;
     778}
     779
     780.hr-separator {
     781    margin-top: 20px;
     782    margin-bottom: 15px;
     783}
     784
     785/* Accordions */
     786.privacy-settings-accordion {
     787    border: 1px solid #ccd0d4;
     788}
     789
     790.privacy-settings-accordion-heading {
     791    margin: 0;
     792    border-top: 1px solid #ccd0d4;
     793    font-size: inherit;
     794    line-height: inherit;
     795    font-weight: 600;
     796    color: inherit;
     797}
     798
     799.privacy-settings-accordion-heading:first-child {
     800    border-top: none;
     801}
     802
     803.privacy-settings-accordion-trigger {
     804    background: #fff;
     805    border: 0;
     806    color: #32373c;
     807    cursor: pointer;
     808    display: flex;
     809    font-weight: 400;
     810    margin: 0;
     811    padding: 1em 3.5em 1em 1.5em;
     812    min-height: 46px;
     813    position: relative;
     814    text-align: left;
     815    width: 100%;
     816    align-items: center;
     817    justify-content: space-between;
     818}
     819
     820.privacy-settings-accordion-trigger:hover,
     821.privacy-settings-accordion-trigger:active {
     822    background: #f8f9f9;
     823}
     824
     825.privacy-settings-accordion-trigger:focus {
     826    color: #191e23;
     827    border: none;
     828    box-shadow: none;
     829    outline-offset: -1px;
     830    outline: 2px solid #0071a1;
     831    background-color: #f8f9f9;
     832}
     833
     834.privacy-settings-accordion-trigger .title {
     835    pointer-events: none;
     836    font-weight: 600;
     837    flex-grow: 1;
     838}
     839
     840.privacy-settings-accordion-trigger .icon,
     841.privacy-settings-view-read .icon {
     842    border: solid #555d66;
     843    border-width: 0 2px 2px 0;
     844    height: 0.5rem;
     845    pointer-events: none;
     846    position: absolute;
     847    right: 1.5em;
     848    top: 50%;
     849    transform: translateY(-70%) rotate(45deg);
     850    width: 0.5rem;
     851}
     852
     853.privacy-settings-accordion-trigger .badge {
     854    padding: 0.1rem 0.5rem 0.15rem;
     855    color: #32373c;
     856    font-weight: 600;
     857    margin-left: 0.5rem;
     858}
     859
     860.privacy-settings-accordion-trigger .badge.blue {
     861    border: 1px solid #bfe7f3;
     862}
     863
     864.privacy-settings-accordion-trigger .badge.orange {
     865    border: 1px solid #ffb900;
     866}
     867
     868.privacy-settings-accordion-trigger .badge.red {
     869    border: 1px solid #dc3232;
     870}
     871
     872.privacy-settings-accordion-trigger .badge.green {
     873    border: 1px solid #46b450;
     874}
     875
     876.privacy-settings-accordion-trigger .badge.purple {
     877    border: 1px solid #826eb4;
     878}
     879
     880.privacy-settings-accordion-trigger .badge.gray {
     881    border: 1px solid #ccd0d4;
     882}
     883
     884.privacy-settings-accordion-trigger[aria-expanded="true"] .icon,
     885.privacy-settings-view-passed[aria-expanded="true"] .icon {
     886    transform: translateY(-30%) rotate(-135deg)
     887}
     888
     889.privacy-settings-accordion-panel {
     890    margin: 0;
     891    padding: 1em 1.5em;
     892    background: #fff;
     893}
     894
     895.privacy-settings-accordion-panel[hidden] {
     896    display: none;
     897}
     898
     899.privacy-settings-accordion-panel a .dashicons {
     900    text-decoration: none;
     901}
     902
     903.privacy-settings-accordion-actions {
     904    text-align: right;
     905    display: block;
     906}
     907
     908.privacy-settings-accordion-actions .success {
     909    display: none;
     910    color: #40860a;
     911    padding-right: 1em;
     912    padding-top: 6px;
     913}
     914
     915.privacy-settings-accordion-actions .success.visible {
     916    display: inline-block;
     917}
     918
    698919/* 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 #f0f0f1;
    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 #dcdcde;
    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: #646970;
    744     font-weight: 300;
    745     padding-left: 1em;
    746     border-left: 3px solid #dba617;
    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: #3c434a;
    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 {
     920.privacy-settings-accordion-panel.hide-privacy-policy-tutorial .wp-policy-help, /* For back-compat, see #49282 */
     921.privacy-settings-accordion-panel.hide-privacy-policy-tutorial .privacy-policy-tutorial,
     922.privacy-settings-accordion-panel.hide-privacy-policy-tutorial .privacy-text-copy {
    768923    display: none;
    769     color: #008a20;
    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: "";
     924}
     925
     926.privacy-settings-accordion-panel strong.wp-policy-help, /* For back-compat, see #49282 */
     927.privacy-settings-accordion-panel strong.privacy-policy-tutorial {
    796928    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;
     929    margin: 0 0 1em;
     930}
     931
     932.privacy-settings-accordion-panel .wp-suggested-text > *:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help):not(.privacy-text-copy):not(span.success),
     933.privacy-settings-accordion-panel .wp-suggested-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(.privacy-text-copy):not(span.success),
     934.privacy-settings-accordion-panel > *:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help):not(.privacy-text-copy):not(span.success),
     935.privacy-settings-accordion-panel div > *:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help):not(.privacy-text-copy):not(span.success) {
    817936    margin: 0;
    818937    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 }
     938    border-left: 2px solid gray;
     939}
     940
     941/* Media queries */
     942@media screen and (max-width: 782px) {
     943
     944    .privacy-settings-body {
     945        margin: 0 12px;
     946        width: auto;
     947    }
     948
     949    .privacy-settings .notice {
     950        margin: 5px 10px 15px;
     951    }
     952
     953    .privacy-settings .update-nag {
     954        margin-right: 10px;
     955        margin-left: 10px;
     956    }
     957
     958    input#create-page {
     959        margin-top: 10px;
     960    }
     961}
     962
     963@media only screen and (max-width: 1004px) {
     964
     965    .privacy-settings-body {
     966        margin: 0 22px;
     967        width: auto;
     968    }
     969}
     970
     971/**
     972* End Privacy Settings section
     973*/
    849974
    850975/*------------------------------------------------------------------------------
  • trunk/src/wp-admin/includes/class-wp-privacy-policy-content.php

    r49956 r50161  
    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            ?>
     
    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
     
    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
     
    385384
    386385            if ( ! empty( $section['removed'] ) ) {
    387                 $class = 'text-removed';
    388                 $date  = date_i18n( $date_format, $section['removed'] );
     386                $badge_class = ' red';
     387                $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. */
     
    394393                $removed = '<div class="notice notice-info inline"><p>' . sprintf( $removed, $date ) . '</p></div>';
    395394            } elseif ( ! empty( $section['updated'] ) ) {
    396                 $class = 'text-updated';
    397                 $date  = date_i18n( $date_format, $section['updated'] );
     395                $badge_class = ' blue';
     396                $date        = date_i18n( $date_format, $section['updated'] );
    398397                /* translators: %s: Date of privacy policy text update. */
    399                 $meta = sprintf( __( 'Updated %s.' ), $date );
    400             }
    401 
    402             if ( $meta ) {
    403                 $meta = '<br><span class="privacy-text-meta">' . $meta . '</span>';
     398                $badge_title = sprintf( __( 'Updated %s.' ), $date );
    404399            }
    405400
    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 );
    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 
    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 ) {
     402
     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
     
    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 = '<strong class="privacy-policy-tutorial">' . __( 'Suggested text:' ) . ' </strong>';
    474450        $content        = '';
    475451        $strings        = array();
     
    488464            /* translators: Privacy policy tutorial. */
    489465            $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>';
    490         }
    491 
    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 
    498         if ( $description ) {
     466        } else {
     467            /* translators: Default privacy policy text. %s: Site URL. */
     468            $strings[] = '<p>' . $suggested_text . sprintf( __( 'Our website address is: %s.' ), get_bloginfo( 'url', 'display' ) ) . '</p>';
     469        }
     470
     471        if ( $description ) {
     472            /* translators: Default privacy policy heading. */
     473            $strings[] = '<h2>' . __( 'What personal data we collect and why we collect it' ) . '</h2>';
    499474            /* translators: Privacy policy tutorial. */
    500475            $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>';
     
    510485
    511486        /* translators: Default privacy policy heading. */
    512         $strings[] = '<h3>' . __( 'Comments' ) . '</h3>';
     487        $strings[] = '<h2>' . __( 'Comments' ) . '</h2>';
    513488
    514489        if ( $description ) {
    515490            /* translators: Privacy policy tutorial. */
    516491            $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>';
    517         }
    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 
    524         /* translators: Default privacy policy heading. */
    525         $strings[] = '<h3>' . __( 'Media' ) . '</h3>';
     492        } else {
     493            /* translators: Default privacy policy text. */
     494            $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>';
     495            /* translators: Default privacy policy text. */
     496            $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>';
     497        }
     498
     499        /* translators: Default privacy policy heading. */
     500        $strings[] = '<h2>' . __( 'Media' ) . '</h2>';
    526501
    527502        if ( $description ) {
    528503            /* translators: Privacy policy tutorial. */
    529504            $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>';
    530         }
    531 
    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 
    538         if ( $description ) {
     505        } else {
     506            /* translators: Default privacy policy text. */
     507            $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>';
     508        }
     509
     510        if ( $description ) {
     511            /* translators: Default privacy policy heading. */
     512            $strings[] = '<h2>' . __( 'Contact forms' ) . '</h2>';
    539513            /* translators: Privacy policy tutorial. */
    540514            $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>';
     
    542516
    543517        /* translators: Default privacy policy heading. */
    544         $strings[] = '<h3>' . __( 'Cookies' ) . '</h3>';
     518        $strings[] = '<h2>' . __( 'Cookies' ) . '</h2>';
    545519
    546520        if ( $description ) {
    547521            /* translators: Privacy policy tutorial. */
    548522            $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>';
    549         }
    550 
    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 
    570         if ( $description ) {
     523        } else {
     524            /* translators: Default privacy policy text. */
     525            $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>';
     526            /* translators: Default privacy policy text. */
     527            $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>';
     528            /* translators: Default privacy policy text. */
     529            $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>';
     530            /* translators: Default privacy policy text. */
     531            $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>';
     532        }
     533
     534        if ( ! $description ) {
     535            /* translators: Default privacy policy heading. */
     536            $strings[] = '<h2>' . __( 'Embedded content from other websites' ) . '</h2>';
     537            /* translators: Default privacy policy text. */
     538            $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>';
     539            /* translators: Default privacy policy text. */
     540            $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>';
     541        }
     542
     543        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>';
     
    583558            /* translators: Privacy policy tutorial. */
    584559            $strings[] = '<p class="privacy-policy-tutorial">' . __( 'By default WordPress does not share any personal data with anyone.' ) . '</p>';
    585         }
    586 
    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>';
     560        } else {
     561            /* translators: Default privacy policy text. */
     562            $strings[] = '<p>' . $suggested_text . __( 'If you request a password reset, your IP address will be included in the reset email.' ) . '</p>';
     563        }
    589564
    590565        /* translators: Default privacy policy heading. */
     
    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>';
    596         }
    597 
    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>';
     571        } else {
     572            /* translators: Default privacy policy text. */
     573            $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>';
     574            /* translators: Default privacy policy text. */
     575            $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>';
     576        }
    602577
    603578        /* translators: Default privacy policy heading. */
     
    607582            /* translators: Privacy policy tutorial. */
    608583            $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>';
    609         }
    610 
    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>';
     584        } else {
     585            /* translators: Default privacy policy text. */
     586            $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>';
     587        }
    613588
    614589        /* translators: Default privacy policy heading. */
     
    620595            /* translators: Privacy policy tutorial. */
    621596            $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>';
    622         }
    623 
    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 
    630         if ( $description ) {
     597        } else {
     598            /* translators: Default privacy policy text. */
     599            $strings[] = '<p>' . $suggested_text . __( 'Visitor comments may be checked through an automated spam detection service.' ) . '</p>';
     600        }
     601
     602        if ( $description ) {
     603            /* translators: Default privacy policy heading. */
     604            $strings[] = '<h2>' . __( 'Contact information' ) . '</h2>';
    631605            /* translators: Privacy policy tutorial. */
    632606            $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>';
    633607        }
    634608
    635         /* translators: Default privacy policy heading. */
    636         $strings[] = '<h2>' . __( 'Additional information' ) . '</h2>';
    637 
    638         if ( $description ) {
     609        if ( $description ) {
     610            /* translators: Default privacy policy heading. */
     611            $strings[] = '<h2>' . __( 'Additional information' ) . '</h2>';
    639612            /* translators: Privacy policy tutorial. */
    640613            $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>';
    641614        }
    642615
    643         /* translators: Default privacy policy heading. */
    644         $strings[] = '<h3>' . __( 'How we protect your data' ) . '</h3>';
    645 
    646         if ( $description ) {
     616        if ( $description ) {
     617            /* translators: Default privacy policy heading. */
     618            $strings[] = '<h2>' . __( 'How we protect your data' ) . '</h2>';
    647619            /* translators: Privacy policy tutorial. */
    648620            $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>';
    649621        }
    650622
    651         /* translators: Default privacy policy heading. */
    652         $strings[] = '<h3>' . __( 'What data breach procedures we have in place' ) . '</h3>';
    653 
    654         if ( $description ) {
     623        if ( $description ) {
     624            /* translators: Default privacy policy heading. */
     625            $strings[] = '<h2>' . __( 'What data breach procedures we have in place' ) . '</h2>';
    655626            /* translators: Privacy policy tutorial. */
    656627            $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>';
    657628        }
    658629
    659         /* translators: Default privacy policy heading. */
    660         $strings[] = '<h3>' . __( 'What third parties we receive data from' ) . '</h3>';
    661 
    662         if ( $description ) {
     630        if ( $description ) {
     631            /* translators: Default privacy policy heading. */
     632            $strings[] = '<h2>' . __( 'What third parties we receive data from' ) . '</h2>';
    663633            /* translators: Privacy policy tutorial. */
    664634            $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>';
    665635        }
    666636
    667         /* translators: Default privacy policy heading. */
    668         $strings[] = '<h3>' . __( 'What automated decision making and/or profiling we do with user data' ) . '</h3>';
    669 
    670         if ( $description ) {
     637        if ( $description ) {
     638            /* translators: Default privacy policy heading. */
     639            $strings[] = '<h2>' . __( 'What automated decision making and/or profiling we do with user data' ) . '</h2>';
    671640            /* translators: Privacy policy tutorial. */
    672641            $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>';
    673642        }
    674643
    675         /* translators: Default privacy policy heading. */
    676         $strings[] = '<h3>' . __( 'Industry regulatory disclosure requirements' ) . '</h3>';
    677 
    678         if ( $description ) {
     644        if ( $description ) {
     645            /* translators: Default privacy policy heading. */
     646            $strings[] = '<h2>' . __( 'Industry regulatory disclosure requirements' ) . '</h2>';
    679647            /* translators: Privacy policy tutorial. */
    680648            $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>';
     
    690658                if ( 0 === strpos( $string, '<h2>' ) ) {
    691659                    $strings[ $key ] = '<!-- wp:heading -->' . $string . '<!-- /wp:heading -->';
    692                 }
    693 
    694                 if ( 0 === strpos( $string, '<h3>' ) ) {
    695                     $strings[ $key ] = '<!-- wp:heading {"level":3} -->' . $string . '<!-- /wp:heading -->';
    696660                }
    697661            }
     
    707671         * @since 5.0.0 Added the `$strings`, `$description`, and `$blocks` parameters.
    708672         *
     673         * @deprecated 5.7.0 This filter has been deprecated.
     674         *
    709675         * @param string   $content     The default policy content.
    710676         * @param string[] $strings     An array of privacy policy content strings.
     
    712678         * @param bool     $blocks      Whether the content should be formatted for the block editor.
    713679         */
    714         return apply_filters( 'wp_get_default_privacy_policy_content', $content, $strings, $description, $blocks );
     680        return apply_filters_deprecated( 'wp_get_default_privacy_policy_content', array( $content, $strings, $description, $blocks ), '5.7.0', false );
    715681    }
    716682
     
    721687     */
    722688    public static function add_suggested_content() {
    723         $content = self::get_default_content( true, false );
     689        $content = self::get_default_content( false, false );
    724690        wp_add_privacy_policy_content( __( 'WordPress' ), $content );
    725691    }
  • trunk/src/wp-admin/options-privacy.php

    r49090 r50161  
    1313    wp_die( __( 'Sorry, you are not allowed to manage privacy options on this site.' ) );
    1414}
     15
     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);
    1529
    1630$action = isset( $_POST['action'] ) ? $_POST['action'] : '';
     
    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.' ); ?>
     
    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>
     180    <p>
     181        <?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>
    150211            <?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     ?>
    171     <p>
    172         <?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            ''
     
    180220        ?>
    181221    </p>
    182 
    183222    <hr>
     223    <?php
     224    $has_pages = (bool) get_posts(
     225        array(
     226            'post_type'      => 'page',
     227            'posts_per_page' => 1,
     228            'post_status'    => array(
     229                'publish',
     230                'draft',
     231            ),
     232        )
     233    );
     234    ?>
    184235    <table class="form-table tools-privacy-policy-page" role="presentation">
     236        <tr>
     237            <th scope="row">
     238                <label for="create-page">
     239                <?php
     240                if ( $has_pages ) {
     241                    _e( 'Create a new Privacy Policy Page' );
     242                } else {
     243                    _e( 'There are no pages.' );
     244                }
     245                ?>
     246                </label>
     247            </th>
     248            <td>
     249                <form class="wp-create-privacy-page" method="post" action="">
     250                    <input type="hidden" name="action" value="create-privacy-page" />
     251                    <?php
     252                    wp_nonce_field( 'create-privacy-page' );
     253                    submit_button( __( 'Create' ), 'secondary', 'submit', false, array( 'id' => 'create-page' ) );
     254                    ?>
     255                </form>
     256            </td>
     257        </tr>
     258        <?php if ( $has_pages ) : ?>
    185259        <tr>
    186260            <th scope="row">
     
    196270            </th>
    197271            <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>
     272                <form method="post" action="">
     273                    <input type="hidden" name="action" value="set-privacy-page" />
    243274                    <?php
    244                     wp_nonce_field( 'create-privacy-page' );
    245 
    246                     submit_button( __( 'Create New Page' ), 'primary', 'submit', false, array( 'id' => 'create-page' ) );
     275                    wp_dropdown_pages(
     276                        array(
     277                            'name'              => 'page_for_privacy_policy',
     278                            'show_option_none'  => __( '&mdash; Select &mdash;' ),
     279                            'option_none_value' => '0',
     280                            'selected'          => $privacy_policy_page_id,
     281                            'post_status'       => array( 'draft', 'publish' ),
     282                        )
     283                    );
     284
     285                    wp_nonce_field( 'set-privacy-page' );
     286
     287                    submit_button( __( 'Use This Page' ), 'primary', 'submit', false, array( 'id' => 'set-page' ) );
    247288                    ?>
    248289                </form>
    249290            </td>
    250291        </tr>
     292        <?php endif; ?>
    251293    </table>
    252294</div>
  • trunk/src/wp-admin/privacy-policy-guide.php

    r49090 r50161  
    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' );
     
    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>
  • trunk/src/wp-admin/tools.php

    r47412 r50161  
    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'] ) ) {
Note: See TracChangeset for help on using the changeset viewer.