Changeset 50161 for trunk/src/wp-admin/options-privacy.php
- Timestamp:
- 02/02/2021 08:12:39 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/options-privacy.php
r49090 r50161 13 13 wp_die( __( 'Sorry, you are not allowed to manage privacy options on this site.' ) ); 14 14 } 15 16 if ( isset( $_GET['tab'] ) && 'policyguide' === $_GET['tab'] ) { 17 require_once( dirname( __FILE__ ) . '/privacy-policy-guide.php' ); 18 return; 19 } 20 21 add_filter( 22 'admin_body_class', 23 function( $body_class ) { 24 $body_class .= ' privacy-settings '; 25 26 return $body_class; 27 } 28 ); 15 29 16 30 $action = isset( $_POST['action'] ) ? $_POST['action'] : ''; … … 113 127 } 114 128 115 $title = __( 'Privacy Settings' );116 129 $parent_file = 'options-general.php'; 117 130 131 wp_enqueue_script( 'privacy-tools' ); 132 118 133 require_once ABSPATH . 'wp-admin/admin-header.php'; 119 134 120 135 ?> 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> 124 168 <p> 125 169 <?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.' ); ?> … … 134 178 <?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.' ); ?> 135 179 </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> 150 211 <?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 } 173 213 printf( 174 214 /* 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' ) ), 177 217 '', 178 218 '' … … 180 220 ?> 181 221 </p> 182 183 222 <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 ?> 184 235 <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 ) : ?> 185 259 <tr> 186 260 <th scope="row"> … … 196 270 </th> 197 271 <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' => __( '— Select —' ), 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" /> 243 274 <?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' => __( '— Select —' ), 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' ) ); 247 288 ?> 248 289 </form> 249 290 </td> 250 291 </tr> 292 <?php endif; ?> 251 293 </table> 252 294 </div>
Note: See TracChangeset
for help on using the changeset viewer.