Ticket #43965: 43965.2.diff
File 43965.2.diff, 4.7 KB (added by , 7 years ago) |
---|
-
src/wp-admin/includes/admin-filters.php
139 139 // Privacy policy text changes check. 140 140 add_action( 'admin_init', array( 'WP_Privacy_Policy_Content', 'text_change_check' ), 20 ); 141 141 142 // Show a "postbox" with the text suggestions for a privacy policy. 143 add_action( 'edit_form_after_title', array( 'WP_Privacy_Policy_Content', 'privacy_policy_postbox' ) ); 142 // Show a "metabox" with the text suggestions for a privacy policy. 143 function add_privacy_policies_metabox( $post_type, $post ) { 144 $privacy_policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' ); 145 $post_id = $post->ID; 144 146 147 if ( ! empty( $privacy_policy_page_id ) && $post_id == $privacy_policy_page_id ) { 148 add_meta_box( 149 'Privacy Policies', 150 __( 'Privacy Policies' ), 151 array( 'WP_Privacy_Policy_Content', 'privacy_policy_postbox' ), 152 'page', 153 'normal', 154 'high' 155 ); 156 } 157 } 158 add_action( 'add_meta_boxes', 'add_privacy_policies_metabox', 10, 2 ); 159 145 160 // Add the suggested policy text from WordPress. 146 161 add_action( 'admin_init', array( 'WP_Privacy_Policy_Content', 'add_suggested_content' ), 15 ); 147 162 -
src/wp-admin/includes/misc.php
1611 1611 1612 1612 ?> 1613 1613 <div id="privacy-text-box" class="privacy-text-box postbox <?php echo postbox_classes( 'privacy-text-box', 'page' ); ?>"> 1614 <button type="button" class="handlediv" aria-expanded="true"> 1615 <span class="screen-reader-text"><?php _e( 'Toggle panel: Suggested privacy policy text' ); ?></span> 1616 <span class="toggle-indicator" aria-hidden="true"></span> 1617 </button> 1618 <div class="privacy-text-box-head hndle"> 1614 <div class="privacy-text-box-head"> 1619 1615 <h2><?php _e( 'This suggested privacy policy text comes from plugins and themes you have installed.' ); ?></h2> 1620 1616 <p> 1621 1617 <?php _e( 'We suggest reviewing this text then copying and pasting it into your privacy policy page.' ); ?> -
src/wp-admin/js/post.js
1269 1269 } ); 1270 1270 1271 1271 } )( jQuery, new wp.utils.WordCounter() ); 1272 1273 ( function( $ ) {1274 // Privacy policy postbox, copy button.1275 $( document ).on( 'click', function( event ) {1276 var $target = $( event.target );1277 var node, range;1278 1279 if ( $target.is( 'button.privacy-text-copy' ) ) {1280 node = $target.parent().parent().find( 'div.policy-text' )[0];1281 1282 if ( node ) {1283 try {1284 window.getSelection().removeAllRanges();1285 range = document.createRange();1286 range.selectNodeContents( node );1287 window.getSelection().addRange( range );1288 1289 document.execCommand( 'copy' );1290 window.getSelection().removeAllRanges();1291 } catch ( er ) {}1292 }1293 } else if ( $target.is( 'button.policy-text-more' ) ) {1294 $target.parents( '.privacy-text-section' ).removeClass( 'folded' )1295 .find( '.policy-text' ).attr( 'aria-expanded', 'true' );1296 } else if ( $target.is( 'button.policy-text-less' ) ) {1297 $target.parents( '.privacy-text-section' ).addClass( 'folded' )1298 .find( '.policy-text' ).attr( 'aria-expanded', 'false' );1299 }1300 });1301 1302 } )( jQuery ); -
src/wp-admin/js/postbox.js
444 444 }; 445 445 446 446 }(jQuery)); 447 448 ( function( $ ) { 449 // Privacy policy postbox, copy button. 450 $( document ).on( 'click', function( event ) { 451 var $target = $( event.target ); 452 var node, range; 453 454 if ( $target.is( 'button.privacy-text-copy' ) ) { 455 node = $target.parent().parent().find( 'div.policy-text' )[0]; 456 457 if ( node ) { 458 try { 459 window.getSelection().removeAllRanges(); 460 range = document.createRange(); 461 range.selectNodeContents( node ); 462 window.getSelection().addRange( range ); 463 464 document.execCommand( 'copy' ); 465 window.getSelection().removeAllRanges(); 466 } catch ( er ) {} 467 } 468 } else if ( $target.is( 'button.policy-text-more' ) ) { 469 $target.parents( '.privacy-text-section' ).removeClass( 'folded' ) 470 .find( '.policy-text' ).attr( 'aria-expanded', 'true' ); 471 } else if ( $target.is( 'button.policy-text-less' ) ) { 472 $target.parents( '.privacy-text-section' ).addClass( 'folded' ) 473 .find( '.policy-text' ).attr( 'aria-expanded', 'false' ); 474 } 475 }); 476 477 } )( jQuery ); 478 No newline at end of file