Ticket #49603: #49603.patch
| File #49603.patch, 13.2 KB (added by , 6 years ago) |
|---|
-
wp-admin/admin-ajax.php
110 110 'heartbeat', 111 111 'get-revision-diffs', 112 112 'save-user-color-scheme', 113 'save-user-deletion-color', 113 114 'update-widget', 114 115 'query-themes', 115 116 'parse-embed', -
wp-admin/css/common.css
4065 4065 text-align: left; 4066 4066 } 4067 4067 } 4068 4069 4070 /* Admin Deletion Colors */ 4071 4072 .admin-deletion-color-automn { 4073 background-color: #fbe2ac !important; 4074 } 4075 4076 .admin-deletion-color-rose { 4077 background-color: #fee8db !important; 4078 } 4079 4080 .admin-deletion-color-sand { 4081 background-color: #fefeee !important; 4082 } 4083 4084 .admin-deletion-color-sky { 4085 background-color: #e7f7fc !important; 4086 } 4087 No newline at end of file -
wp-admin/includes/ajax-actions.php
3469 3469 ); 3470 3470 } 3471 3471 3472 3472 3473 /** 3474 * Ajax handler for auto-saving the selected deletion color for 3475 * a user's own profile. 3476 * 3477 * @since 5.5 3478 * 3479 * @global array $_wp_admin_deletion_colors 3480 */ 3481 function wp_ajax_save_user_deletion_color() { 3482 global $_wp_admin_deletion_colors; 3483 3484 check_ajax_referer( 'save-deletion-color', 'nonce' ); 3485 3486 $deletion_color = sanitize_key( $_POST['deletion_color'] ); 3487 3488 if ( ! isset( $_wp_admin_deletion_colors[ $deletion_color ] ) ) { 3489 wp_send_json_error(); 3490 } 3491 3492 $previous_deletion_color = get_user_meta( get_current_user_id(), 'admin_deletion_color', true ); 3493 3494 if ( 'fresh' == $deletion_color ) { 3495 delete_user_meta( get_current_user_id(), 'admin_deletion_color' ); 3496 } else { 3497 update_user_meta( get_current_user_id(), 'admin_deletion_color', $deletion_color ); 3498 } 3499 3500 wp_send_json_success( 3501 array( 3502 'previousDeletion' => 'admin-deletion-color-' . $previous_deletion_color, 3503 'currentDeletion' => 'admin-deletion-color-' . $deletion_color, 3504 ) 3505 ); 3506 } 3507 3508 /** 3473 3509 * Ajax handler for getting themes from themes_api(). 3474 3510 * 3475 3511 * @since 3.9.0 -
wp-admin/includes/misc.php
986 986 } 987 987 988 988 /** 989 * Display the default admin color deletion picker (Used in user-edit.php) 990 * 991 * @since 5.5 992 * 993 * @global array $_wp_admin_deletion_colors 994 * 995 * @param int $user_id User ID. 996 */ 997 function admin_deletion_color_picker( $user_id ) { 998 global $_wp_admin_deletion_colors; 999 1000 ksort( $_wp_admin_deletion_colors ); 1001 1002 if ( isset( $_wp_admin_deletion_colors['fresh'] ) ) { 1003 // Set Default ('fresh') and Light should go first. 1004 $_wp_admin_deletion_colors = array_filter( 1005 array_merge( 1006 array( 1007 'fresh' => '', 1008 ), 1009 $_wp_admin_deletion_colors 1010 ) 1011 ); 1012 } 1013 1014 $current_color = get_user_option( 'admin_deletion_color', $user_id ); 1015 1016 if ( empty( $current_color ) || ! isset( $_wp_admin_deletion_colors[ $current_color ] ) ) { 1017 $current_color = 'fresh'; 1018 } 1019 1020 ?> 1021 <fieldset id="deletion-color-picker" class="scheme-list"> 1022 <legend class="screen-reader-text"><span><?php _e( 'Admin Deletion Color Background' ); ?></span></legend> 1023 <?php 1024 wp_nonce_field( 'save-deletion-color', 'deletion-color-nonce', false ); 1025 foreach ( $_wp_admin_deletion_colors as $color => $color_info ) : 1026 1027 ?> 1028 <div class="color-option <?php echo ( $color == $current_color ) ? 'selected' : ''; ?>"> 1029 <input name="admin_deletion_color" id="admin_deletion_color_<?php echo esc_attr( $color ); ?>" type="radio" value="<?php echo esc_attr( $color ); ?>" class="tog" <?php checked( $color, $current_color ); ?> /> 1030 <input type="hidden" class="css_url" value="<?php echo esc_url( $color_info->url ); ?>" /> 1031 <input type="hidden" class="icon_colors" value="<?php echo esc_attr( wp_json_encode( array( 'icons' => $color_info->icon_colors ) ) ); ?>" /> 1032 <label for="admin_deletion_color_<?php echo esc_attr( $color ); ?>"><?php echo esc_html( $color_info->name ); ?></label> 1033 <table class="color-palette"> 1034 <tr> 1035 <?php 1036 1037 foreach ( $color_info->colors as $html_color ) { 1038 ?> 1039 <td style="background-color: <?php echo esc_attr( $html_color ); ?>;"> </td> 1040 <?php 1041 } 1042 1043 ?> 1044 </tr> 1045 </table> 1046 </div> 1047 <?php 1048 1049 endforeach; 1050 1051 ?> 1052 </fieldset> 1053 <?php 1054 } 1055 1056 /** 989 1057 * @since 3.3.0 990 1058 */ 991 1059 function _ipad_meta() { -
wp-admin/includes/user.php
116 116 $user->rich_editing = isset( $_POST['rich_editing'] ) && 'false' === $_POST['rich_editing'] ? 'false' : 'true'; 117 117 $user->syntax_highlighting = isset( $_POST['syntax_highlighting'] ) && 'false' === $_POST['syntax_highlighting'] ? 'false' : 'true'; 118 118 $user->admin_color = isset( $_POST['admin_color'] ) ? sanitize_text_field( $_POST['admin_color'] ) : 'fresh'; 119 $user->admin_deletion_color = isset( $_POST['admin_deletion_color'] ) ? sanitize_text_field( $_POST['admin_deletion_color'] ) : 'fresh'; 119 120 $user->show_admin_bar_front = isset( $_POST['admin_bar_front'] ) ? 'true' : 'false'; 120 121 $user->locale = ''; 121 122 -
wp-admin/js/user-profile.js
266 266 } 267 267 268 268 $(document).ready( function() { 269 var $colorpicker, $stylesheet, user_id, current_user_id, 269 var $colorpicker, $stylesheet, user_id, current_user_id, $deletion_colorpicker, 270 270 select = $( '#display_name' ), 271 271 current_name = select.val(), 272 272 greeting = $( '#wp-admin-bar-my-account' ).find( '.display-name' ); … … 376 376 } 377 377 }); 378 378 379 $deletion_colorpicker = $( '#deletion-color-picker' ); 380 381 $deletion_colorpicker.on( 'click.colorpicker', '.color-option', function() { 382 var colors, 383 $this = $(this); 384 385 if ( $this.hasClass( 'selected' ) ) { 386 return; 387 } 388 389 $this.siblings( '.selected' ).removeClass( 'selected' ); 390 $this.addClass( 'selected' ).find( 'input[type="radio"]' ).prop( 'checked', true ); 391 392 // Set color scheme. 393 if ( user_id === current_user_id ) { 394 // Update user option. 395 $.post( ajaxurl, { 396 action: 'save-user-deletion-color', 397 deletion_color: $this.children( 'input[name="admin_deletion_color"]' ).val(), 398 nonce: $('#deletion-color-nonce').val() 399 }).done( function( response ) { 400 if ( response.success ) {} 401 }); 402 } 403 }); 404 379 405 bindPasswordForm(); 380 406 }); 381 407 -
wp-admin/user-edit.php
47 47 } 48 48 49 49 $profile_help = '<p>' . __( 'Your profile contains information about you (your “account”) as well as some personal options related to using WordPress.' ) . '</p>' . 50 '<p>' . __( 'You can change your password, turn on keyboard shortcuts, change the color scheme of your WordPress administration screens, and turn off the WYSIWYG (Visual) editor, among other things. You can hide the Toolbar (formerly called the Admin Bar) from the front end of your site, however it cannot be disabled on the admin screens.' ) . '</p>' .50 '<p>' . __( 'You can change your password, turn on keyboard shortcuts, change the color scheme of your WordPress administration screens, change background color admin screens related to deletion and turn off the WYSIWYG (Visual) editor, among other things. You can hide the Toolbar (formerly called the Admin Bar) from the front end of your site, however it cannot be disabled on the admin screens.' ) . '</p>' . 51 51 '<p>' . __( 'You can select the language you wish to use while using the WordPress administration screen without affecting the language site visitors see.' ) . '</p>' . 52 52 '<p>' . __( 'Your username cannot be changed, but you can use other fields to enter your real name or a nickname, and change which name to display on your posts.' ) . '</p>' . 53 53 '<p>' . __( 'You can log out of other devices, such as your phone or a public computer, by clicking the Log Out Everywhere Else button.' ) . '</p>' . … … 335 335 </td> 336 336 </tr> 337 337 338 <tr class="user-admin-color-deletion-wrap"> 339 <th scope="row"><?php _e( 'Admin Color Deletion Background' ); ?></th> 340 <td> 341 <?php 342 do_action( 'admin_deletion_color_picker', $user_id ); 343 ?> 344 </td> 345 </tr> 346 338 347 <?php 339 348 $languages = get_available_languages(); 340 349 if ( $languages ) : -
wp-includes/default-filters.php
407 407 // Admin color schemes. 408 408 add_action( 'admin_init', 'register_admin_color_schemes', 1 ); 409 409 add_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' ); 410 add_action( 'admin_color_deletion_picker', 'admin_color_deletion_picker' ); 410 411 412 // Admin deletion color. 413 add_action( 'admin_init', 'register_admin_deletion_colors', 1 ); 414 add_action( 'admin_deletion_color_picker', 'admin_deletion_color_picker' ); 415 add_action( 'admin_deletion_color_deletion', 'admin_deletion_color_deletion' ); 416 add_filter( 'admin_body_class', 'admin_deletion_color_body_class' ); 417 411 418 // If the upgrade hasn't run yet, assume link manager is used. 412 419 add_filter( 'default_option_link_manager_enabled', '__return_true' ); 413 420 -
wp-includes/general-template.php
1 <?php1 <?php 2 2 /** 3 3 * General template tags that can go anywhere in a template. 4 4 * … … 4487 4487 } 4488 4488 4489 4489 /** 4490 * Registers an admin deletion color. 4491 * 4492 * Allows a plugin to register a new admin deletion color. For example: 4493 * 4494 * wp_admin_deletion_color( 'sky', _x( 'Sky', 'admin deletion color' ), false, array( '#a6eafd', ) ); 4495 * 4496 * @since 5.5 4497 * 4498 * @global array $_wp_admin_deletion_colors 4499 * 4500 * @param string $key The unique key for this theme. 4501 * @param string $name The name of the theme. 4502 * @param string $url currently with value false. 4503 * @param array $colors currently with value array(). 4504 * @param array $icons { 4505 * Optional. CSS color definitions used to color any SVG icons. 4506 * 4507 * @type string $base SVG icon base color. 4508 * @type string $focus SVG icon color on focus. 4509 * @type string $current SVG icon color of current admin menu link. 4510 * } 4511 */ 4512 function wp_admin_deletion_color( $key, $name, $url, $colors = array(), $icons = array() ) { 4513 global $_wp_admin_deletion_colors; 4514 4515 if ( ! isset( $_wp_admin_deletion_colors ) ) { 4516 $_wp_admin_deletion_colors = array(); 4517 } 4518 4519 $_wp_admin_deletion_colors[ $key ] = (object) array( 4520 'name' => $name, 4521 'url' => $url, 4522 'colors' => $colors, 4523 'icon_colors' => $icons, 4524 ); 4525 } 4526 4527 /** 4528 * Registers the default admin deletion color. 4529 * 4530 * Registers the initial set of deletion colors in the Profile section 4531 * of the dashboard which allows for styling the admin background screen related to deletion (trash, privacy erase). 4532 * 4533 * @see wp_admin_css_color() 4534 * 4535 * @since 5.5 4536 */ 4537 function register_admin_deletion_colors() { 4538 $suffix = is_rtl() ? '-rtl' : ''; 4539 $suffix .= SCRIPT_DEBUG ? '' : '.min'; 4540 4541 wp_admin_deletion_color( 4542 'fresh', 4543 _x( 'Default', 'admin deletion color' ), 4544 false, 4545 array( '#f1f1f1' ) 4546 ); 4547 4548 wp_admin_deletion_color( 4549 'automn', 4550 _x( 'Automn', 'admin deletion color' ), 4551 false, 4552 array( '#fbe2ac' ) 4553 ); 4554 4555 wp_admin_deletion_color( 4556 'rose', 4557 _x( 'Rose', 'admin deletion color' ), 4558 false, 4559 array( '#fee8db' ) 4560 ); 4561 /* 4562 wp_admin_deletion_color( 4563 'sand', 4564 _x( 'Sand', 'admin deletion color' ), 4565 false, 4566 array( '#fefeee' ) 4567 ); 4568 */ 4569 wp_admin_deletion_color( 4570 'sky', 4571 _x( 'Sky', 'admin deletion color' ), 4572 false, 4573 array( '#e7f7fc', ) 4574 ); 4575 4576 } 4577 4578 /** 4579 * Add deletion color class to body classes 4580 * 4581 * 4582 * @since 5.5 4583 */ 4584 function admin_deletion_color_body_class( $admin_body_classes = '' ) { 4585 $color = get_user_meta( get_current_user_id(), 'admin_deletion_color', true ); 4586 if ( !$color ) $color = 'fresh'; 4587 if ( 'fresh' == $color ) return $admin_body_classes; 4588 4589 global $hook_suffix; 4590 $hook_suffixes = array( 'erase-personal-data.php', ); 4591 4592 $change_color = false; 4593 if ( !$change_color ) $change_color = ( ( isset( $_REQUEST['post_status'] ) ) && ( 'trash' == $_REQUEST['post_status'] ) ); 4594 if ( !$change_color ) $change_color = in_array( $hook_suffix, $hook_suffixes ); 4595 if ( !$change_color ) return $admin_body_classes; 4596 4597 $admin_body_classes .= " admin-deletion-color-{$color} "; 4598 4599 return $admin_body_classes; 4600 } 4601 4602 /** 4490 4603 * Enqueues the default ThickBox js and css. 4491 4604 * 4492 4605 * If any of the settings need to be changed, this can be done with another js