Ticket #49264: 49264.diff
File 49264.diff, 11.9 KB (added by , 5 years ago) |
---|
-
src/js/_enqueues/admin/privacy-tools.js
diff --git a/src/js/_enqueues/admin/privacy-tools.js b/src/js/_enqueues/admin/privacy-tools.js index 802ec88f4b..9d878e7c92 100644
a b jQuery( document ).ready( function( $ ) { 77 77 78 78 appendResultsAfterRow( $requestRow, 'notice-success', summaryMessage, [] ); 79 79 $this.hide(); 80 80 81 81 if ( 'undefined' !== typeof zipUrl ) { 82 82 window.location = zipUrl; 83 83 } else if ( ! sendAsEmail ) { … … jQuery( document ).ready( function( $ ) { 259 259 } 260 260 } 261 261 }); 262 263 $( 'body.options-privacy-php label[for=create-page]' ).on( 'click', function( e ) { 264 e.preventDefault(); 265 $( 'input#create-page' ).focus(); 266 } ); 262 267 }); 263 268 -
new file src/wp-admin/css/privacy-settings.css
diff --git a/src/wp-admin/css/privacy-settings.css b/src/wp-admin/css/privacy-settings.css new file mode 100644 index 0000000000..340b10ef89
- + 1 /* General */ 2 .options-privacy-php #wpcontent, 3 .options-privacy-php.auto-fold #wpcontent { 4 padding-left: 0; 5 } 6 7 .privacy-settings-header h1 { 8 display: inline-block; 9 font-weight: 600; 10 margin: 0 0.8rem 1rem; 11 font-size: 23px; 12 padding: 9px 0 4px 0; 13 line-height: 1.3; 14 } 15 16 .privacy-settings-body h2 { 17 padding: 1rem 0; 18 line-height: 1.4; 19 } 20 21 .privacy-settingsbody h3 { 22 padding: 0; 23 font-weight: 400; 24 } 25 26 /* Header */ 27 .privacy-settings-header { 28 text-align: center; 29 margin: 0 0 1rem; 30 background: #fff; 31 border-bottom: 1px solid #e2e4e7; 32 } 33 34 .privacy-settings-title-section { 35 display: flex; 36 align-items: center; 37 justify-content: center; 38 clear: both; 39 } 40 41 .privacy-settings-tabs-wrapper { 42 /* IE 11 */ 43 display: -ms-inline-grid; 44 -ms-grid-columns: 1fr 1fr; 45 vertical-align: top; 46 /* modern browsers */ 47 display: inline-grid; 48 grid-template-columns: 1fr 1fr 1fr; 49 } 50 51 .privacy-settings-tab { 52 display: block; /* IE 11 */ 53 text-decoration: none; 54 color: inherit; 55 padding: 0.5rem 1rem 1rem; 56 margin: 0 1rem; 57 transition: box-shadow 0.5s ease-in-out; 58 } 59 60 .privacy-settings-tab:nth-child(1) { 61 -ms-grid-column: 1; /* IE 11 */ 62 } 63 64 .privacy-settings-tab:nth-child(2) { 65 -ms-grid-column: 2; /* IE 11 */ 66 } 67 68 .privacy-settings-tab:nth-child(2) { 69 -ms-grid-column: 3; /* IE 11 */ 70 } 71 72 .privacy-settings-tab:focus { 73 color: #191e23; 74 outline: 1px solid #6c7781; 75 box-shadow: none; 76 } 77 78 .privacy-settings-tab.active { 79 box-shadow: inset 0 -3px #007cba; 80 font-weight: 600; 81 } 82 83 /* Body */ 84 .privacy-settings-body { 85 max-width: 800px; 86 margin: 0 auto; 87 } 88 89 .tools-privacy-policy-page th { 90 min-width: 230px; 91 } 92 93 /* Media queries */ 94 @media screen and (max-width: 782px) { 95 96 .privacy-settings-body { 97 margin: 0 12px; 98 width: auto; 99 } 100 101 .privacy-settings-tabs-wrapper { 102 grid-template-columns: 1fr; 103 } 104 105 input#create-page { 106 margin-top: 10px; 107 } 108 } -
src/wp-admin/options-privacy.php
diff --git a/src/wp-admin/options-privacy.php b/src/wp-admin/options-privacy.php index 95492b326f..a3dbca59af 100644
a b if ( ! empty( $privacy_policy_page_id ) ) { 112 112 } 113 113 } 114 114 115 $title = __( 'Privacy Settings' );116 115 $parent_file = 'options-general.php'; 117 116 117 wp_enqueue_style( 'privacy-settings' ); 118 wp_enqueue_script( 'privacy-tools' ); 119 118 120 require_once( ABSPATH . 'wp-admin/admin-header.php' ); 119 121 120 122 ?> 121 <div class="wrap"> 122 <h1><?php echo $title; ?></h1> 123 <h2><?php _e( 'Privacy Policy Page' ); ?></h2> 123 <div class="privacy-settings-header"> 124 <div class="privacy-settings-title-section"> 125 <h1> 126 <?php _e( 'Privacy' ); ?> 127 </h1> 128 </div> 129 130 <nav class="privacy-settings-tabs-wrapper hide-if-no-js" aria-label="<?php esc_attr_e( 'Secondary menu' ); ?>"> 131 <a href="<?php echo esc_url( admin_url( 'options-privacy.php' ) ); ?>" class="privacy-settings-tab active" aria-current="true"> 132 <?php 133 /* translators: Tab heading for Site Health Status page. */ 134 _ex( 'Settings', 'Privacy Settings' ); 135 ?> 136 </a> 137 138 <a href="<?php echo esc_url( admin_url( 'privacy-policy-guide.php' ) ); ?>" class="privacy-settings-tab"> 139 <?php 140 /* translators: Tab heading for Site Health Status page. */ 141 _ex( 'Policy Guide', 'Privacy Settings' ); 142 ?> 143 </a> 144 145 <a href="<?php echo esc_url( admin_url( 'disclosures-and-premissions.php' ) ); ?>" class="privacy-settings-tab"> 146 <?php 147 /* translators: Tab heading for Site Health Info page. */ 148 _ex( 'Disclosures & Permissions', 'Privacy Settings' ); 149 ?> 150 </a> 151 </nav> 152 </div> 153 154 <hr class="wp-header-end"> 155 156 <div class="notice notice-error hide-if-js"> 157 <p><?php _e( 'The Privacy Settings require JavaScript.' ); ?></p> 158 </div> 159 160 <div class="privacy-settings-body hide-if-no-js"> 161 <h2><?php _e( 'Privacy Settings' ); ?></h2> 124 162 <p> 125 163 <?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.' ); ?> 126 164 <?php _e( 'If you already have a Privacy Policy page, please select it below. If not, please create one.' ); ?> … … require_once( ABSPATH . 'wp-admin/admin-header.php' ); 133 171 <?php _e( 'After your Privacy Policy page is set, we suggest that you edit it.' ); ?> 134 172 <?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 173 </p> 136 <?php137 138 if ( $privacy_policy_page_exists ) {139 $edit_href = add_query_arg(140 array(141 'post' => $privacy_policy_page_id,142 'action' => 'edit',143 ),144 admin_url( 'post.php' )145 );146 147 $view_href = get_permalink( $privacy_policy_page_id );148 ?>149 <p class="tools-privacy-edit"><strong>150 <?php151 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 <?php169 }170 ?>171 174 <p> 172 175 <?php 176 if ( $privacy_policy_page_exists ) { 177 $edit_href = add_query_arg( 178 array( 179 'post' => $privacy_policy_page_id, 180 'action' => 'edit', 181 ), 182 admin_url( 'post.php' ) 183 ); 184 185 $view_href = get_permalink( $privacy_policy_page_id ); 186 ?> 187 <strong> 188 <?php 189 if ( 'publish' === get_post_status( $privacy_policy_page_id ) ) { 190 printf( 191 /* translators: 1: URL to edit Privacy Policy page, 2: URL to view Privacy Policy page. */ 192 __( '<a href="%1$s">Edit</a> or <a href="%2$s">view</a> your Privacy Policy page content.' ), 193 esc_url( $edit_href ), 194 esc_url( $view_href ) 195 ); 196 } else { 197 printf( 198 /* translators: 1: URL to edit Privacy Policy page, 2: URL to preview Privacy Policy page. */ 199 __( '<a href="%1$s">Edit</a> or <a href="%2$s">preview</a> your Privacy Policy page content.' ), 200 esc_url( $edit_href ), 201 esc_url( $view_href ) 202 ); 203 } 204 ?> 205 </strong> 206 <?php 207 } 173 208 printf( 174 209 /* 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.' ),210 __( '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.' ), 176 211 esc_url( admin_url( 'privacy-policy-guide.php' ) ), 177 212 '', 178 213 '' … … require_once( ABSPATH . 'wp-admin/admin-header.php' ); 181 216 </p> 182 217 183 218 <hr> 219 220 <?php 221 $has_pages = (bool) get_posts( 222 array( 223 'post_type' => 'page', 224 'posts_per_page' => 1, 225 'post_status' => array( 226 'publish', 227 'draft', 228 ), 229 ) 230 ); 231 ?> 232 184 233 <table class="form-table tools-privacy-policy-page" role="presentation"> 234 <tr> 235 <th scope="row"> 236 <label for="create-page"> 237 <?php 238 if ( $has_pages ) { 239 _e( 'Create a new Privacy Policy Page' ); 240 } else { 241 _e( 'There are no pages.' ); 242 } 243 ?> 244 </label> 245 </td> 246 <td> 247 <form class="wp-create-privacy-page" method="post" action=""> 248 <input type="hidden" name="action" value="create-privacy-page" /> 249 <?php 250 wp_nonce_field( 'create-privacy-page' ); 251 252 submit_button( __( 'Create' ), 'secondary', 'submit', false, array( 'id' => 'create-page' ) ); 253 ?> 254 </form> 255 </td> 256 </tr> 257 <?php if ( $has_pages ) : ?> 185 258 <tr> 186 259 <th scope="row"> 187 260 <label for="page_for_privacy_policy"> … … require_once( ABSPATH . 'wp-admin/admin-header.php' ); 195 268 </label> 196 269 </th> 197 270 <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> 271 <form method="post" action=""> 272 <input type="hidden" name="action" value="set-privacy-page" /> 243 273 <?php 244 wp_nonce_field( 'create-privacy-page' ); 274 wp_dropdown_pages( 275 array( 276 'name' => 'page_for_privacy_policy', 277 'show_option_none' => __( '— Select —' ), 278 'option_none_value' => '0', 279 'selected' => $privacy_policy_page_id, 280 'post_status' => array( 'draft', 'publish' ), 281 ) 282 ); 245 283 246 submit_button( __( 'Create New Page' ), 'primary', 'submit', false, array( 'id' => 'create-page' ) ); 284 wp_nonce_field( 'set-privacy-page' ); 285 286 submit_button( __( 'Use This Page' ), 'primary', 'submit', false, array( 'id' => 'set-page' ) ); 247 287 ?> 248 288 </form> 249 289 </td> 250 290 </tr> 291 <?php endif; ?> 251 292 </table> 293 252 294 </div> 253 295 <?php 254 296 -
src/wp-includes/script-loader.php
diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index 018cb777af..e30dfc7f84 100644
a b function wp_default_styles( &$styles ) { 1730 1730 $styles->add( 'l10n', "/wp-admin/css/l10n$suffix.css" ); 1731 1731 $styles->add( 'code-editor', "/wp-admin/css/code-editor$suffix.css", array( 'wp-codemirror' ) ); 1732 1732 $styles->add( 'site-health', "/wp-admin/css/site-health$suffix.css" ); 1733 $styles->add( 'privacy-settings', "/wp-admin/css/privacy-settings$suffix.css" ); 1733 1734 1734 1735 $styles->add( 'wp-admin', false, array( 'dashicons', 'common', 'forms', 'admin-menu', 'dashboard', 'list-tables', 'edit', 'revisions', 'media', 'themes', 'about', 'nav-menus', 'widgets', 'site-icon', 'l10n' ) ); 1735 1736