Changeset 49396
- Timestamp:
- 10/29/2020 06:50:55 PM (5 years ago)
- Location:
- branches/5.0
- Files:
-
- 1 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.0
- Property svn:mergeinfo changed
/branches/5.5 (added) merged: 49373-49379,49381 /trunk merged: 49380,49382-49388
- Property svn:mergeinfo changed
-
branches/5.0/src/wp-admin/admin-header.php
r43780 r49396 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/5.0/src/wp-admin/custom-background.php
r41161 r49396 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/5.0/src/wp-admin/custom-header.php
r42811 r49396 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/5.0/src/wp-admin/includes/media.php
r47964 r49396 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/5.0/src/wp-admin/includes/ms.php
r41289 r49396 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/5.0/src/wp-admin/includes/template.php
r43945 r49396 1784 1784 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();}}}; 1785 1785 function tb_close(){var win=window.dialogArguments||opener||parent||top;win.tb_remove();} 1786 var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative'); ?>',1787 pagenow = '<?php echo $current_screen->id; ?>',1788 typenow = '<?php echo $current_screen->post_type; ?>',1789 adminpage = '<?php echo $admin_body_class; ?>',1790 thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',1791 decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',1786 var ajaxurl = '<?php echo esc_js( admin_url( 'admin-ajax.php', 'relative' ) ); ?>', 1787 pagenow = '<?php echo esc_js( $current_screen->id ); ?>', 1788 typenow = '<?php echo esc_js( $current_screen->post_type ); ?>', 1789 adminpage = '<?php echo esc_js( $admin_body_class ); ?>', 1790 thousandsSeparator = '<?php echo esc_js( $wp_locale->number_format['thousands_sep'] ); ?>', 1791 decimalPoint = '<?php echo esc_js( $wp_locale->number_format['decimal_point'] ); ?>', 1792 1792 isRtl = <?php echo (int) is_rtl(); ?>; 1793 1793 </script> -
branches/5.0/src/wp-admin/js/custom-background.js
r40914 r49396 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/5.0/src/wp-admin/js/media-gallery.js
r38293 r49396 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/5.0/src/wp-admin/media-new.php
r38725 r49396 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/5.0/src/wp-admin/network/site-users.php
r42811 r49396 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/5.0/src/wp-includes/Requests/Utility/FilteredIterator.php
r37428 r49396 43 43 return $value; 44 44 } 45 45 46 } -
branches/5.0/src/wp-includes/class-wp-xmlrpc-server.php
r43819 r49396 3645 3645 } 3646 3646 3647 if ( 3648 'publish' === get_post_status( $post_id ) && 3649 ! current_user_can( 'edit_post', $post_id ) && 3650 post_password_required( $post_id ) 3651 ) { 3652 return new IXR_Error( 403, __( 'Sorry, you are not allowed to comment on this post.' ) ); 3653 } 3654 3655 if ( 3656 'private' === get_post_status( $post_id ) && 3657 ! current_user_can( 'read_post', $post_id ) 3658 ) { 3659 return new IXR_Error( 403, __( 'Sorry, you are not allowed to comment on this post.' ) ); 3660 } 3661 3647 3662 $comment = array( 3648 3663 'comment_post_ID' => $post_id, … … 4030 4045 do_action( 'xmlrpc_call', 'wp.getMediaItem' ); 4031 4046 4032 if ( ! $attachment = get_post($attachment_id) ) 4047 $attachment = get_post( $attachment_id ); 4048 if ( ! $attachment || 'attachment' !== $attachment->post_type ) { 4033 4049 return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); 4050 } 4034 4051 4035 4052 return $this->_prepare_media_item( $attachment ); -
branches/5.0/src/wp-includes/embed.php
r43810 r49396 590 590 $site = reset( $sites ); 591 591 592 if ( $site && (int) $site->blog_id !== get_current_blog_id() ) { 592 // Do not allow embeds for deleted/archived/spam sites. 593 if ( ! empty( $site->deleted ) || ! empty( $site->spam ) || ! empty( $site->archived ) ) { 594 return false; 595 } 596 597 if ( $site && get_current_blog_id() !== (int) $site->blog_id ) { 593 598 switch_to_blog( $site->blog_id ); 594 599 $switched_blog = true; -
branches/5.0/src/wp-includes/formatting.php
r47647 r49396 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/5.0/src/wp-includes/meta.php
r43729 r49396 994 994 * @return bool True if the key is protected, false otherwise. 995 995 */ 996 function is_protected_meta( $meta_key, $meta_type = null ) { 997 $protected = ( '_' == $meta_key[0] ); 996 function is_protected_meta( $meta_key, $meta_type = '' ) { 997 $sanitized_key = preg_replace( "/[^\x20-\x7E\p{L}]/", '', $meta_key ); 998 $protected = strlen( $sanitized_key ) > 0 && ( '_' === $sanitized_key[0] ); 998 999 999 1000 /** -
branches/5.0/tests/phpunit/tests/formatting/Utf8UriEncode.php
r25002 r49396 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/5.0/tests/phpunit/tests/multisite/site.php
r41883 r49396 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.