Changeset 49397
- Timestamp:
- 10/29/2020 06:52:29 PM (4 years ago)
- Location:
- branches/4.9
- Files:
-
- 1 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.9
- Property svn:mergeinfo changed
/branches/5.5 (added) merged: 49373-49379,49381 /trunk merged: 49380,49382-49388
- Property svn:mergeinfo changed
-
branches/4.9/src/wp-admin/admin-header.php
r39326 r49397 76 76 ?> 77 77 <script type="text/javascript"> 78 addLoadEvent = function(func){if(typeof jQuery!= "undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};79 var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative'); ?>',80 pagenow = '<?php echo $current_screen->id; ?>',81 typenow = '<?php echo $current_screen->post_type; ?>',82 adminpage = '<?php echo $admin_body_class; ?>',83 thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',84 decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',78 addLoadEvent = function(func){if(typeof jQuery!=='undefined')jQuery(document).ready(func);else if(typeof wpOnload!=='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}; 79 var ajaxurl = '<?php echo esc_js( admin_url( 'admin-ajax.php', 'relative' ) ); ?>', 80 pagenow = '<?php echo esc_js( $current_screen->id ); ?>', 81 typenow = '<?php echo esc_js( $current_screen->post_type ); ?>', 82 adminpage = '<?php echo esc_js( $admin_body_class ); ?>', 83 thousandsSeparator = '<?php echo esc_js( $wp_locale->number_format['thousands_sep'] ); ?>', 84 decimalPoint = '<?php echo esc_js( $wp_locale->number_format['decimal_point'] ); ?>', 85 85 isRtl = <?php echo (int) is_rtl(); ?>; 86 86 </script> -
branches/4.9/src/wp-admin/custom-background.php
r41161 r49397 542 542 */ 543 543 public function wp_set_background_image() { 544 check_ajax_referer( 'custom-background' ); 544 545 if ( ! current_user_can('edit_theme_options') || ! isset( $_POST['attachment_id'] ) ) exit; 545 546 $attachment_id = absint($_POST['attachment_id']); -
branches/4.9/src/wp-admin/custom-header.php
r42811 r49397 323 323 <script type="text/javascript"> 324 324 (function($){ 325 var default_color = '<?php echo $default_color; ?>',325 var default_color = '<?php echo esc_js( $default_color ); ?>', 326 326 header_text_fields; 327 327 -
branches/4.9/src/wp-admin/includes/media.php
r47967 r49397 474 474 <script type="text/javascript"> 475 475 addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}; 476 var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative'); ?>', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup',476 var ajaxurl = '<?php echo esc_js( admin_url( 'admin-ajax.php', 'relative' ) ); ?>', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup', 477 477 isRtl = <?php echo (int) is_rtl(); ?>; 478 478 </script> -
branches/4.9/src/wp-admin/includes/ms.php
r41289 r49397 746 746 ?> 747 747 <script type="text/javascript"> 748 var tb_pathToImage = "<?php echo includes_url( 'js/thickbox/loadingAnimation.gif', 'relative'); ?>";748 var tb_pathToImage = "<?php echo esc_js( includes_url( 'js/thickbox/loadingAnimation.gif', 'relative' ) ); ?>"; 749 749 </script> 750 750 <?php -
branches/4.9/src/wp-admin/includes/template.php
r43496 r49397 1642 1642 addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}; 1643 1643 function tb_close(){var win=window.dialogArguments||opener||parent||top;win.tb_remove();} 1644 var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative'); ?>',1645 pagenow = '<?php echo $current_screen->id; ?>',1646 typenow = '<?php echo $current_screen->post_type; ?>',1647 adminpage = '<?php echo $admin_body_class; ?>',1648 thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',1649 decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',1644 var ajaxurl = '<?php echo esc_js( admin_url( 'admin-ajax.php', 'relative' ) ); ?>', 1645 pagenow = '<?php echo esc_js( $current_screen->id ); ?>', 1646 typenow = '<?php echo esc_js( $current_screen->post_type ); ?>', 1647 adminpage = '<?php echo esc_js( $admin_body_class ); ?>', 1648 thousandsSeparator = '<?php echo esc_js( $wp_locale->number_format['thousands_sep'] ); ?>', 1649 decimalPoint = '<?php echo esc_js( $wp_locale->number_format['decimal_point'] ); ?>', 1650 1650 isRtl = <?php echo (int) is_rtl(); ?>; 1651 1651 </script> -
branches/4.9/src/wp-admin/js/custom-background.js
r40914 r49397 123 123 // Grab the selected attachment. 124 124 var attachment = frame.state().get('selection').first(); 125 var nonceValue = $( '#_wpnonce' ).val() || ''; 125 126 126 127 // Run an AJAX request to set the background image. … … 128 129 action: 'set-background-image', 129 130 attachment_id: attachment.id, 131 _ajax_nonce: nonceValue, 130 132 size: 'full' 131 133 }).done( function() { -
branches/4.9/src/wp-admin/js/media-gallery.js
r38293 r49397 10 10 */ 11 11 $( 'body' ).bind( 'click.wp-gallery', function(e) { 12 var target = $( e.target ), id, img_size ;12 var target = $( e.target ), id, img_size, nonceValue; 13 13 14 14 if ( target.hasClass( 'wp-set-header' ) ) { … … 20 20 id = target.data( 'attachment-id' ); 21 21 img_size = $( 'input[name="attachments[' + id + '][image-size]"]:checked').val(); 22 nonceValue = $( '#_wpnonce' ).val() && ''; 22 23 23 24 /** … … 27 28 action: 'set-background-image', 28 29 attachment_id: id, 30 _ajax_nonce: nonceValue, 29 31 size: img_size 30 32 }, function() { -
branches/4.9/src/wp-admin/media-new.php
r38725 r49397 73 73 74 74 <script type="text/javascript"> 75 var post_id = <?php echo $post_id; ?>, shortform = 3;75 var post_id = <?php echo absint( $post_id ); ?>, shortform = 3; 76 76 </script> 77 <input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" />77 <input type="hidden" name="post_id" id="post_id" value="<?php echo absint( $post_id ); ?>" /> 78 78 <?php wp_nonce_field('media-form'); ?> 79 79 <div id="media-items" class="hide-if-no-js"></div> -
branches/4.9/src/wp-admin/network/site-users.php
r42811 r49397 212 212 213 213 <script type="text/javascript"> 214 var current_site_id = <?php echo $id; ?>;214 var current_site_id = <?php echo absint( $id ); ?>; 215 215 </script> 216 216 -
branches/4.9/src/wp-includes/Requests/Utility/FilteredIterator.php
r37428 r49397 43 43 return $value; 44 44 } 45 45 46 } -
branches/4.9/src/wp-includes/class-wp-xmlrpc-server.php
r42811 r49397 3639 3639 } 3640 3640 3641 if ( 3642 'publish' === get_post_status( $post_id ) && 3643 ! current_user_can( 'edit_post', $post_id ) && 3644 post_password_required( $post_id ) 3645 ) { 3646 return new IXR_Error( 403, __( 'Sorry, you are not allowed to comment on this post.' ) ); 3647 } 3648 3649 if ( 3650 'private' === get_post_status( $post_id ) && 3651 ! current_user_can( 'read_post', $post_id ) 3652 ) { 3653 return new IXR_Error( 403, __( 'Sorry, you are not allowed to comment on this post.' ) ); 3654 } 3655 3641 3656 $comment = array( 3642 3657 'comment_post_ID' => $post_id, … … 4024 4039 do_action( 'xmlrpc_call', 'wp.getMediaItem' ); 4025 4040 4026 if ( ! $attachment = get_post($attachment_id) ) 4041 $attachment = get_post( $attachment_id ); 4042 if ( ! $attachment || 'attachment' !== $attachment->post_type ) { 4027 4043 return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); 4044 } 4028 4045 4029 4046 return $this->_prepare_media_item( $attachment ); -
branches/4.9/src/wp-includes/embed.php
r41634 r49397 1095 1095 $site = reset( $sites ); 1096 1096 1097 if ( $site && (int) $site->blog_id !== get_current_blog_id() ) { 1097 // Do not allow embeds for deleted/archived/spam sites. 1098 if ( ! empty( $site->deleted ) || ! empty( $site->spam ) || ! empty( $site->archived ) ) { 1099 return false; 1100 } 1101 1102 if ( $site && get_current_blog_id() !== (int) $site->blog_id ) { 1098 1103 switch_to_blog( $site->blog_id ); 1099 1104 $switched_blog = true; -
branches/4.9/src/wp-includes/formatting.php
r47648 r49397 1091 1091 */ 1092 1092 function utf8_uri_encode( $utf8_string, $length = 0 ) { 1093 $unicode = '';1094 $values = array();1095 $num_octets = 1;1093 $unicode = ''; 1094 $values = array(); 1095 $num_octets = 1; 1096 1096 $unicode_length = 0; 1097 1097 … … 1105 1105 1106 1106 if ( $value < 128 ) { 1107 if ( $length && ( $unicode_length >= $length ) ) 1107 if ( $length && ( $unicode_length >= $length ) ) { 1108 1108 break; 1109 $unicode .= chr($value); 1109 } 1110 $unicode .= chr( $value ); 1110 1111 $unicode_length++; 1111 1112 } else { … … 2008 2009 $title = mb_strtolower($title, 'UTF-8'); 2009 2010 } 2010 $title = utf8_uri_encode( $title, 200);2011 $title = utf8_uri_encode( $title, 200 ); 2011 2012 } 2012 2013 -
branches/4.9/src/wp-includes/meta.php
r43557 r49397 924 924 * @return bool True if the key is protected, false otherwise. 925 925 */ 926 function is_protected_meta( $meta_key, $meta_type = null ) { 927 $protected = ( '_' == $meta_key[0] ); 926 function is_protected_meta( $meta_key, $meta_type = '' ) { 927 $sanitized_key = preg_replace( "/[^\x20-\x7E\p{L}]/", '', $meta_key ); 928 $protected = strlen( $sanitized_key ) > 0 && ( '_' === $sanitized_key[0] ); 928 929 929 930 /** -
branches/4.9/tests/phpunit/tests/formatting/Utf8UriEncode.php
r25002 r49397 13 13 */ 14 14 function test_percent_encodes_non_reserved_characters( $utf8, $urlencoded ) { 15 $this->assertEquals( $urlencoded, utf8_uri_encode( $utf8 ) );15 $this->assertEquals( $urlencoded, utf8_uri_encode( $utf8 ) ); 16 16 } 17 17 -
branches/4.9/tests/phpunit/tests/multisite/site.php
r41883 r49397 444 444 445 445 remove_action( 'make_ham_blog', array( $this, '_action_counter_cb' ), 10 ); 446 } 447 448 function test_content_from_spam_blog_is_not_available() { 449 $spam_blog_id = self::factory()->blog->create(); 450 switch_to_blog( $spam_blog_id ); 451 $post_data = array( 452 'post_title' => 'Hello World!', 453 'post_content' => 'Hello world content', 454 ); 455 $post_id = self::factory()->post->create( $post_data ); 456 $post = get_post( $post_id ); 457 $spam_permalink = site_url() . '/?p=' . $post->ID; 458 $spam_embed_url = get_post_embed_url( $post_id ); 459 460 restore_current_blog(); 461 $this->assertNotEmpty( $spam_permalink ); 462 $this->assertEquals( $post_data['post_title'], $post->post_title ); 463 464 update_blog_status( $spam_blog_id, 'spam', 1 ); 465 466 $post_id = self::factory()->post->create( 467 array( 468 'post_content' => "\n $spam_permalink \n", 469 ) 470 ); 471 $post = get_post( $post_id ); 472 $content = apply_filters( 'the_content', $post->post_content ); 473 474 $this->assertNotContains( $post_data['post_title'], $content ); 475 $this->assertNotContains( "src=\"{$spam_embed_url}#?", $content ); 446 476 } 447 477
Note: See TracChangeset
for help on using the changeset viewer.