Make WordPress Core


Ignore:
Timestamp:
05/26/2019 10:56:18 PM (7 years ago)
Author:
azaozz
Message:

Privacy tools: restore privacy.php to its "proper" use to output the Privacy tab on the About screen, see [42814]. Then add the Privacy tab updates from freedoms.php.

See #43895.

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/privacy.php

    • Property svn:mergeinfo set to
      /branches/3.1/src/wp-admin/privacy.php18031
      /branches/3.3/src/wp-admin/privacy.php20543
      /branches/3.4/src/wp-admin/privacy.php21757
      /branches/4.9/src/wp-admin/privacy.php43557,​43622
      /branches/5.0/src/wp-admin/privacy.php43681-43682,​43684-43688,​43719-43720,​43723,​43726-43727,​43729-43731,​43734-43744,​43747,​43751-43754,​43758,​43760-43765,​43767-43770,​43772,​43774-43781,​43783,​43785,​43790-43806,​43808-43821,​43825,​43828,​43830-43834,​43836-43843,​43846-43863,​43867-43889,​43891-43894,​43897-43905,​43908-43909,​43911-43929,​43931-43942,​43946-43947,​43949-43956,​43959-43964,​43967-43969,​43988,​43994,​44014,​44017,​44047,​44183,​44185,​44187-44206,​44208-44213,​44231-44232,​44235,​44248,​44284,​44287-44288
    r45447 r45451  
    11<?php
    22/**
    3  * Privacy Settings Screen.
     3 * Privacy administration panel.
    44 *
    55 * @package WordPress
     
    1010require_once( dirname( __FILE__ ) . '/admin.php' );
    1111
    12 if ( ! current_user_can( 'manage_privacy_options' ) ) {
    13         wp_die( __( 'Sorry, you are not allowed to manage privacy on this site.' ) );
    14 }
     12$title = __( 'Privacy' );
    1513
    16 $action = isset( $_POST['action'] ) ? $_POST['action'] : '';
     14list( $display_version ) = explode( '-', get_bloginfo( 'version' ) );
    1715
    18 if ( ! empty( $action ) ) {
    19         check_admin_referer( $action );
     16include( ABSPATH . 'wp-admin/admin-header.php' );
     17?>
     18<div class="wrap about-wrap full-width-layout">
    2019
    21         if ( 'set-privacy-page' === $action ) {
    22                 $privacy_policy_page_id = isset( $_POST['page_for_privacy_policy'] ) ? (int) $_POST['page_for_privacy_policy'] : 0;
    23                 update_option( 'wp_page_for_privacy_policy', $privacy_policy_page_id );
     20<h1>
     21        <?php
     22        /* translators: %s: The current WordPress version number */
     23        printf( __( 'Welcome to WordPress&nbsp;%s' ), $display_version );
     24        ?>
     25</h1>
    2426
    25                 $privacy_page_updated_message = __( 'Privacy Policy page updated successfully.' );
     27<p class="about-text">
     28        <?php
     29        printf(
     30                /* translators: %s: The current WordPress version number */
     31                __( 'Congratulations on updating to WordPress %s! This update makes it easier than ever to fix your site if something goes wrong.' ),
     32                $display_version
     33        );
     34        ?>
     35</p>
    2636
    27                 if ( $privacy_policy_page_id ) {
    28                         /*
    29                          * Don't always link to the menu customizer:
    30                          *
    31                          * - Unpublished pages can't be selected by default.
    32                          * - `WP_Customize_Nav_Menus::__construct()` checks the user's capabilities.
    33                          * - Themes might not "officially" support menus.
    34                          */
    35                         if (
    36                                 'publish' === get_post_status( $privacy_policy_page_id )
    37                                 && current_user_can( 'edit_theme_options' )
    38                                 && current_theme_supports( 'menus' )
    39                         ) {
    40                                 $privacy_page_updated_message = sprintf(
    41                                         /* translators: %s: URL to Customizer -> Menus */
    42                                         __( 'Privacy Policy page setting updated successfully. Remember to <a href="%s">update your menus</a>!' ),
    43                                         esc_url( add_query_arg( 'autofocus[panel]', 'nav_menus', admin_url( 'customize.php' ) ) )
    44                                 );
    45                         }
    46                 }
     37<div class="wp-badge">
     38        <?php
     39        /* translators: %s: The current WordPress version number */
     40        printf( __( 'Version %s' ), $display_version );
     41        ?>
     42</div>
    4743
    48                 add_settings_error(
    49                         'page_for_privacy_policy',
    50                         'page_for_privacy_policy',
    51                         $privacy_page_updated_message,
    52                         'updated'
    53                 );
    54         } elseif ( 'create-privacy-page' === $action ) {
     44<nav class="nav-tab-wrapper wp-clearfix" aria-label="<?php esc_attr_e( 'Secondary menu' ); ?>">
     45        <a href="about.php" class="nav-tab"><?php _e( 'What&#8217;s New' ); ?></a>
     46        <a href="credits.php" class="nav-tab"><?php _e( 'Credits' ); ?></a>
     47        <a href="freedoms.php" class="nav-tab"><?php _e( 'Freedoms' ); ?></a>
     48        <a href="privacy.php" class="nav-tab nav-tab-active" aria-current="page"><?php _e( 'Privacy' ); ?></a>
     49</nav>
    5550
    56                 if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) {
    57                         require_once( ABSPATH . 'wp-admin/includes/misc.php' );
    58                 }
     51<div class="about-wrap-content">
     52        <p class="about-description"><?php _e( 'From time to time, your WordPress site may send data to WordPress.org &#8212; including, but not limited to &#8212; the version of WordPress you are using, and a list of installed plugins and themes.' ); ?></p>
    5953
    60                 $privacy_policy_page_content = WP_Privacy_Policy_Content::get_default_content();
    61                 $privacy_policy_page_id      = wp_insert_post(
    62                         array(
    63                                 'post_title'   => __( 'Privacy Policy' ),
    64                                 'post_status'  => 'draft',
    65                                 'post_type'    => 'page',
    66                                 'post_content' => $privacy_policy_page_content,
    67                         ),
    68                         true
    69                 );
    70 
    71                 if ( is_wp_error( $privacy_policy_page_id ) ) {
    72                         add_settings_error(
    73                                 'page_for_privacy_policy',
    74                                 'page_for_privacy_policy',
    75                                 __( 'Unable to create a Privacy Policy page.' ),
    76                                 'error'
    77                         );
    78                 } else {
    79                         update_option( 'wp_page_for_privacy_policy', $privacy_policy_page_id );
    80 
    81                         wp_redirect( admin_url( 'post.php?post=' . $privacy_policy_page_id . '&action=edit' ) );
    82                         exit;
    83                 }
    84         }
    85 }
    86 
    87 // If a Privacy Policy page ID is available, make sure the page actually exists. If not, display an error.
    88 $privacy_policy_page_exists = false;
    89 $privacy_policy_page_id     = (int) get_option( 'wp_page_for_privacy_policy' );
    90 
    91 if ( ! empty( $privacy_policy_page_id ) ) {
    92 
    93         $privacy_policy_page = get_post( $privacy_policy_page_id );
    94 
    95         if ( ! $privacy_policy_page instanceof WP_Post ) {
    96                 add_settings_error(
    97                         'page_for_privacy_policy',
    98                         'page_for_privacy_policy',
    99                         __( 'The currently selected Privacy Policy page does not exist. Please create or select a new page.' ),
    100                         'error'
    101                 );
    102         } else {
    103                 if ( 'trash' === $privacy_policy_page->post_status ) {
    104                         add_settings_error(
    105                                 'page_for_privacy_policy',
    106                                 'page_for_privacy_policy',
    107                                 sprintf(
    108                                         /* translators: URL to Pages Trash */
    109                                         __( 'The currently selected Privacy Policy page is in the trash. Please create or select a new Privacy Policy page or <a href="%s">restore the current page</a>.' ),
    110                                         'edit.php?post_status=trash&post_type=page'
    111                                 ),
    112                                 'error'
    113                         );
    114                 } else {
    115                         $privacy_policy_page_exists = true;
    116                 }
    117         }
    118 }
    119 
    120 $title       = __( 'Privacy Settings' );
    121 $parent_file = 'options-general.php';
    122 
    123 require_once( ABSPATH . 'wp-admin/admin-header.php' );
    124 
    125 ?>
    126 <div class="wrap">
    127         <h1><?php echo $title; ?></h1>
    128         <h2><?php _e( 'Privacy Policy Page' ); ?></h2>
    129         <p>
    130                 <?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.' ); ?>
    131                 <?php _e( 'If you already have a Privacy Policy page, please select it below. If not, please create one.' ); ?>
    132         </p>
    133         <p>
    134                 <?php _e( 'The new page will include help and suggestions for your Privacy Policy.' ); ?>
    135                 <?php _e( 'However, it is your responsibility to use those resources correctly, to provide the information that your Privacy Policy requires, and to keep that information current and accurate.' ); ?>
    136         </p>
    137         <p>
    138                 <?php _e( 'After your Privacy Policy page is set, we suggest that you edit it.' ); ?>
    139                 <?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.' ); ?>
    140         </p>
    141         <?php
    142 
    143         if ( $privacy_policy_page_exists ) {
    144                 $edit_href = add_query_arg(
    145                         array(
    146                                 'post'   => $privacy_policy_page_id,
    147                                 'action' => 'edit',
    148                         ),
    149                         admin_url( 'post.php' )
    150                 );
    151 
    152                 $view_href = get_permalink( $privacy_policy_page_id );
    153 
    154                 ?>
    155                 <p class="tools-privacy-edit"><strong>
    156                         <?php
    157 
    158                         if ( 'publish' === get_post_status( $privacy_policy_page_id ) ) {
    159                                 printf(
    160                                         /* translators: 1: URL to edit Privacy Policy page, 2: URL to view Privacy Policy page */
    161                                         __( '<a href="%1$s">Edit</a> or <a href="%2$s">view</a> your Privacy Policy page content.' ),
    162                                         esc_url( $edit_href ),
    163                                         esc_url( $view_href )
    164                                 );
    165                         } else {
    166                                 printf(
    167                                         /* translators: 1: URL to edit Privacy Policy page, 2: URL to preview Privacy Policy page */
    168                                         __( '<a href="%1$s">Edit</a> or <a href="%2$s">preview</a> your Privacy Policy page content.' ),
    169                                         esc_url( $edit_href ),
    170                                         esc_url( $view_href )
    171                                 );
    172                         }
    173 
    174                         ?>
    175                 </strong></p>
    176                 <?php
    177         }
    178         ?>
    17954        <p>
    18055                <?php
    181 
    182                 printf(
    183                         /* translators: 1: Privacy Policy guide URL, 2: additional link attributes, 3: accessibility text */
    184                         __( '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.' ),
    185                         esc_url( admin_url( 'tools.php?wp-privacy-policy-guide=1' ) ),
    186                         '',
    187                         ''
    188                 );
    189 
     56                /* translators: %s: https://wordpress.org/about/stats/ */
     57                printf( __( 'This data is used to provide general enhancements to WordPress, which includes helping to protect your site by finding and automatically installing new updates. It is also used to calculate statistics, such as those shown on the <a href="%s">WordPress.org stats page</a>.' ), 'https://wordpress.org/about/stats/' );
    19058                ?>
    19159        </p>
    19260
    193         <hr>
    194         <table class="form-table tools-privacy-policy-page" role="presentation">
    195                 <tr>
    196                         <th scope="row"><label for="page_for_privacy_policy">
    197                                 <?php
    198                                 if ( $privacy_policy_page_exists ) {
    199                                         _e( 'Change your Privacy Policy page' );
    200                                 } else {
    201                                         _e( 'Select a Privacy Policy page' );
    202                                 }
    203                                 ?>
    204                         </label></th>
    205                         <td>
    206                                 <?php
    207                                 $has_pages = (bool) get_posts(
    208                                         array(
    209                                                 'post_type'      => 'page',
    210                                                 'posts_per_page' => 1,
    211                                                 'post_status'    => array(
    212                                                         'publish',
    213                                                         'draft',
    214                                                 ),
    215                                         )
    216                                 );
     61        <p>
     62                <?php
     63                /* translators: %s: https://wordpress.org/about/privacy/ */
     64                printf( __( 'We take privacy and transparency very seriously. To learn more about what data we collect, and how we use it, please visit <a href="%s">WordPress.org/about/privacy</a>.' ), 'https://wordpress.org/about/privacy/' );
     65                ?>
     66        </p>
     67</div>
    21768
    218                                 if ( $has_pages ) :
    219                                         ?>
    220                                         <form method="post" action="">
    221                                                 <input type="hidden" name="action" value="set-privacy-page" />
    222                                                 <?php
    223                                                 wp_dropdown_pages(
    224                                                         array(
    225                                                                 'name'              => 'page_for_privacy_policy',
    226                                                                 'show_option_none'  => __( '&mdash; Select &mdash;' ),
    227                                                                 'option_none_value' => '0',
    228                                                                 'selected'          => $privacy_policy_page_id,
    229                                                                 'post_status'       => array( 'draft', 'publish' ),
    230                                                         )
    231                                                 );
    232 
    233                                                 wp_nonce_field( 'set-privacy-page' );
    234 
    235                                                 submit_button( __( 'Use This Page' ), 'primary', 'submit', false, array( 'id' => 'set-page' ) );
    236                                                 ?>
    237                                         </form>
    238                                 <?php endif; ?>
    239 
    240                                 <form class="wp-create-privacy-page" method="post" action="">
    241                                         <input type="hidden" name="action" value="create-privacy-page" />
    242                                         <span>
    243                                                 <?php
    244                                                 if ( $has_pages ) {
    245                                                         _e( 'Or:' );
    246                                                 } else {
    247                                                         _e( 'There are no pages.' );
    248                                                 }
    249                                                 ?>
    250                                         </span>
    251                                         <?php
    252                                         wp_nonce_field( 'create-privacy-page' );
    253 
    254                                         submit_button( __( 'Create New Page' ), 'primary', 'submit', false, array( 'id' => 'create-page' ) );
    255                                         ?>
    256                                 </form>
    257                         </td>
    258                 </tr>
    259         </table>
    26069</div>
    261 <?php
    262 
    263 include( ABSPATH . 'wp-admin/admin-footer.php' );
     70<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
Note: See TracChangeset for help on using the changeset viewer.