Ticket #22234: 22234.3.diff
File 22234.3.diff, 10.2 KB (added by , 10 years ago) |
---|
-
src/wp-admin/custom-background.php
22 22 * @since 3.0.0 23 23 * @access private 24 24 */ 25 var$admin_header_callback;25 private $admin_header_callback; 26 26 27 27 /** 28 28 * Callback for header div. … … 31 31 * @since 3.0.0 32 32 * @access private 33 33 */ 34 var$admin_image_div_callback;34 private $admin_image_div_callback; 35 35 36 36 /** 37 37 * Holds the page menu hook. … … 40 40 * @since 3.0.0 41 41 * @access private 42 42 */ 43 var$page = '';43 private $page = ''; 44 44 45 45 /** 46 46 * Constructor - Register administration header callback. … … 50 50 * @param callback $admin_image_div_callback Optional custom image div output callback. 51 51 * @return Custom_Background 52 52 */ 53 function __construct($admin_header_callback = '', $admin_image_div_callback = '') {53 public function __construct($admin_header_callback = '', $admin_image_div_callback = '') { 54 54 $this->admin_header_callback = $admin_header_callback; 55 55 $this->admin_image_div_callback = $admin_image_div_callback; 56 56 … … 59 59 } 60 60 61 61 /** 62 * Make private properties readable for backwards compatibility 63 * 64 * @since 4.0.0 65 * @param string $name 66 * @return mixed 67 */ 68 public function __get( $name ) { 69 return $this->$name; 70 } 71 72 /** 62 73 * Set up the hooks for the Custom Background admin page. 63 74 * 64 75 * @since 3.0.0 65 76 */ 66 function init() {77 public function init() { 67 78 if ( ! current_user_can('edit_theme_options') ) 68 79 return; 69 80 … … 82 93 * 83 94 * @since 3.0.0 84 95 */ 85 function admin_load() {96 public function admin_load() { 86 97 get_current_screen()->add_help_tab( array( 87 98 'id' => 'overview', 88 99 'title' => __('Overview'), … … 109 120 * 110 121 * @since 3.0.0 111 122 */ 112 function take_action() {123 public function take_action() { 113 124 114 125 if ( empty($_POST) ) 115 126 return; … … 176 187 * 177 188 * @since 3.0.0 178 189 */ 179 function admin_page() {190 public function admin_page() { 180 191 ?> 181 192 <div class="wrap" id="custom-background"> 182 193 <h2><?php _e( 'Custom Background' ); ?></h2> … … 343 354 * 344 355 * @since 3.0.0 345 356 */ 346 function handle_upload() {357 public function handle_upload() { 347 358 348 359 if ( empty($_FILES) ) 349 360 return; … … 397 408 * 398 409 * @since 3.4.0 399 410 */ 400 function attachment_fields_to_edit( $form_fields ) {411 public function attachment_fields_to_edit( $form_fields ) { 401 412 return $form_fields; 402 413 } 403 414 … … 406 417 * 407 418 * @since 3.4.0 408 419 */ 409 function filter_upload_tabs( $tabs ) {420 public function filter_upload_tabs( $tabs ) { 410 421 return $tabs; 411 422 } 412 423 -
src/wp-admin/custom-header.php
22 22 * @since 2.1.0 23 23 * @access private 24 24 */ 25 var$admin_header_callback;25 private $admin_header_callback; 26 26 27 27 /** 28 28 * Callback for header div. … … 31 31 * @since 3.0.0 32 32 * @access private 33 33 */ 34 var$admin_image_div_callback;34 private $admin_image_div_callback; 35 35 36 36 /** 37 37 * Holds default headers. … … 40 40 * @since 3.0.0 41 41 * @access private 42 42 */ 43 var$default_headers = array();43 private $default_headers = array(); 44 44 45 45 /** 46 46 * Holds custom headers uploaded by the user. … … 49 49 * @since 3.2.0 50 50 * @access private 51 51 */ 52 var$uploaded_headers = array();52 private $uploaded_headers = array(); 53 53 54 54 /** 55 55 * Holds the page menu hook. … … 58 58 * @since 3.0.0 59 59 * @access private 60 60 */ 61 var$page = '';61 private $page = ''; 62 62 63 63 /** 64 64 * Constructor - Register administration header callback. … … 68 68 * @param callback $admin_image_div_callback Optional custom image div output callback. 69 69 * @return Custom_Image_Header 70 70 */ 71 function __construct($admin_header_callback, $admin_image_div_callback = '') {71 public function __construct($admin_header_callback, $admin_image_div_callback = '') { 72 72 $this->admin_header_callback = $admin_header_callback; 73 73 $this->admin_image_div_callback = $admin_image_div_callback; 74 74 … … 81 81 } 82 82 83 83 /** 84 * Make private properties readable for backwards compatibility 85 * 86 * @since 4.0.0 87 * @param string $name 88 * @return mixed 89 */ 90 public function __get( $name ) { 91 return $this->$name; 92 } 93 94 /** 84 95 * Set up the hooks for the Custom Header admin page. 85 96 * 86 97 * @since 2.1.0 87 98 */ 88 function init() {99 public function init() { 89 100 if ( ! current_user_can('edit_theme_options') ) 90 101 return; 91 102 … … 106 117 * 107 118 * @since 3.0.0 108 119 */ 109 function help() {120 public function help() { 110 121 get_current_screen()->add_help_tab( array( 111 122 'id' => 'overview', 112 123 'title' => __('Overview'), … … 148 159 * 149 160 * @return int Current step 150 161 */ 151 function step() {162 public function step() { 152 163 if ( ! isset( $_GET['step'] ) ) 153 164 return 1; 154 165 … … 167 178 * 168 179 * @since 2.1.0 169 180 */ 170 function js_includes() {181 public function js_includes() { 171 182 $step = $this->step(); 172 183 173 184 if ( ( 1 == $step || 3 == $step ) ) { … … 185 196 * 186 197 * @since 2.7.0 187 198 */ 188 function css_includes() {199 public function css_includes() { 189 200 $step = $this->step(); 190 201 191 202 if ( ( 1 == $step || 3 == $step ) && current_theme_supports( 'custom-header', 'header-text' ) ) … … 199 210 * 200 211 * @since 2.6.0 201 212 */ 202 function take_action() {213 public function take_action() { 203 214 if ( ! current_user_can('edit_theme_options') ) 204 215 return; 205 216 … … 245 256 * 246 257 * @since 3.0.0 247 258 */ 248 function process_default_headers() {259 public function process_default_headers() { 249 260 global $_wp_default_headers; 250 261 251 262 if ( !empty($this->headers) ) … … 275 286 * 276 287 * @since 3.0.0 277 288 */ 278 function show_header_selector( $type = 'default' ) {289 public function show_header_selector( $type = 'default' ) { 279 290 if ( 'default' == $type ) { 280 291 $headers = $this->default_headers; 281 292 } else { … … 312 323 * 313 324 * @since 2.1.0 314 325 */ 315 function js() {326 public function js() { 316 327 $step = $this->step(); 317 328 if ( ( 1 == $step || 3 == $step ) && current_theme_supports( 'custom-header', 'header-text' ) ) 318 329 $this->js_1(); … … 325 336 * 326 337 * @since 2.6.0 327 338 */ 328 function js_1() {339 public function js_1() { 329 340 $default_color = ''; 330 341 if ( current_theme_supports( 'custom-header', 'default-text-color' ) ) { 331 342 $default_color = get_theme_support( 'custom-header', 'default-text-color' ); … … 341 352 var default_color = '<?php echo $default_color; ?>', 342 353 header_text_fields; 343 354 344 function pickColor(color) {355 public function pickColor(color) { 345 356 $('#name').css('color', color); 346 357 $('#desc').css('color', color); 347 358 $('#text-color').val(color); 348 359 } 349 360 350 function toggle_text() {361 public function toggle_text() { 351 362 var checked = $('#display-header-text').prop('checked'), 352 363 text_color; 353 364 header_text_fields.toggle( checked ); … … 389 400 * 390 401 * @since 2.6.0 391 402 */ 392 function js_2() { ?>403 public function js_2() { ?> 393 404 <script type="text/javascript"> 394 405 /* <![CDATA[ */ 395 function onEndCrop( coords ) {406 public function onEndCrop( coords ) { 396 407 jQuery( '#x1' ).val(coords.x); 397 408 jQuery( '#y1' ).val(coords.y); 398 409 jQuery( '#width' ).val(coords.w); … … 441 452 <?php 442 453 } 443 454 ?> 444 onInit: function () {455 onInit: public function () { 445 456 jQuery('#width').val(xinit); 446 457 jQuery('#height').val(yinit); 447 458 }, … … 463 474 * 464 475 * @since 2.1.0 465 476 */ 466 function step_1() {477 public function step_1() { 467 478 $this->process_default_headers(); 468 479 ?> 469 480 … … 681 692 * 682 693 * @since 2.1.0 683 694 */ 684 function step_2() {695 public function step_2() { 685 696 check_admin_referer('custom-header-upload', '_wpnonce-custom-header-upload'); 686 697 if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) 687 698 wp_die( __( 'Cheatin’ uh?' ) ); … … 795 806 * 796 807 * @since 3.4.0 797 808 */ 798 function step_2_manage_upload() {809 public function step_2_manage_upload() { 799 810 $overrides = array('test_form' => false); 800 811 801 812 $uploaded_file = $_FILES['import']; … … 832 843 * 833 844 * @since 2.1.0 834 845 */ 835 function step_3() {846 public function step_3() { 836 847 check_admin_referer( 'custom-header-crop-image' ); 837 848 838 849 if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) … … 908 919 * 909 920 * @since 2.1.0 910 921 */ 911 function finished() {922 public function finished() { 912 923 $this->updated = true; 913 924 $this->step_1(); 914 925 } … … 918 929 * 919 930 * @since 2.1.0 920 931 */ 921 function admin_page() {932 public function admin_page() { 922 933 if ( ! current_user_can('edit_theme_options') ) 923 934 wp_die(__('You do not have permission to customize headers.')); 924 935 $step = $this->step(); … … 935 946 * 936 947 * @since 3.4.0 937 948 */ 938 function attachment_fields_to_edit( $form_fields ) {949 public function attachment_fields_to_edit( $form_fields ) { 939 950 return $form_fields; 940 951 } 941 952 … … 944 955 * 945 956 * @since 3.4.0 946 957 */ 947 function filter_upload_tabs( $tabs ) {958 public function filter_upload_tabs( $tabs ) { 948 959 return $tabs; 949 960 } 950 961 … … 1147 1158 * Gets attachment uploaded by Media Manager, crops it, then saves it as a 1148 1159 * new object. Returns JSON-encoded object details. 1149 1160 */ 1150 function ajax_header_crop() {1161 public function ajax_header_crop() { 1151 1162 check_ajax_referer( 'image_editor-' . $_POST['id'], 'nonce' ); 1152 1163 1153 1164 if ( ! current_user_can( 'edit_theme_options' ) ) { … … 1204 1215 * Triggered when the user tries adds a new header image from the 1205 1216 * Media Manager, even if s/he doesn't save that change. 1206 1217 */ 1207 function ajax_header_add() {1218 public function ajax_header_add() { 1208 1219 check_ajax_referer( 'header-add', 'nonce' ); 1209 1220 1210 1221 if ( ! current_user_can( 'edit_theme_options' ) ) { … … 1230 1241 * Triggered when the user clicks the overlay "X" button next to each image 1231 1242 * choice in the Customizer's Header tool. 1232 1243 */ 1233 function ajax_header_remove() {1244 public function ajax_header_remove() { 1234 1245 check_ajax_referer( 'header-remove', 'nonce' ); 1235 1246 1236 1247 if ( ! current_user_can( 'edit_theme_options' ) ) { … … 1249 1260 wp_send_json_success(); 1250 1261 } 1251 1262 1252 function customize_set_last_used( $wp_customize ) {1263 public function customize_set_last_used( $wp_customize ) { 1253 1264 $data = $wp_customize->get_setting( 'header_image_data' )->post_value(); 1254 1265 1255 1266 if ( ! isset( $data['attachment_id'] ) ) {