Changeset 41206
- Timestamp:
- 08/02/2017 04:44:05 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/widgets/media-video-widget.js
r40821 r41206 111 111 } 112 112 113 control.fetchEmbedDfd = jQuery.ajax({113 control.fetchEmbedDfd = wp.apiRequest({ 114 114 url: wp.media.view.settings.oEmbedProxyUrl, 115 115 data: { … … 117 117 maxwidth: control.model.get( 'width' ), 118 118 maxheight: control.model.get( 'height' ), 119 _wpnonce: wp.media.view.settings.nonce.wpRestApi,120 119 discover: false 121 120 }, -
trunk/src/wp-admin/js/widgets/media-widgets.js
r41179 r41206 201 201 } 202 202 203 embedLinkView.dfd = $.ajax({203 embedLinkView.dfd = wp.apiRequest({ 204 204 url: wp.media.view.settings.oEmbedProxyUrl, 205 205 data: { … … 207 207 maxwidth: embedLinkView.model.get( 'width' ), 208 208 maxheight: embedLinkView.model.get( 'height' ), 209 _wpnonce: wp.media.view.settings.nonce.wpRestApi,210 209 discover: false 211 210 }, -
trunk/src/wp-includes/js/media-views.js
r41179 r41206 4643 4643 } 4644 4644 4645 this.dfd = $.ajax({4645 this.dfd = wp.apiRequest({ 4646 4646 url: wp.media.view.settings.oEmbedProxyUrl, 4647 4647 data: { 4648 4648 url: url, 4649 4649 maxwidth: this.model.get( 'width' ), 4650 maxheight: this.model.get( 'height' ), 4651 _wpnonce: wp.media.view.settings.nonce.wpRestApi 4650 maxheight: this.model.get( 'height' ) 4652 4651 }, 4653 4652 type: 'GET', -
trunk/src/wp-includes/js/media/views/embed/link.js
r41179 r41206 54 54 } 55 55 56 this.dfd = $.ajax({56 this.dfd = wp.apiRequest({ 57 57 url: wp.media.view.settings.oEmbedProxyUrl, 58 58 data: { 59 59 url: url, 60 60 maxwidth: this.model.get( 'width' ), 61 maxheight: this.model.get( 'height' ), 62 _wpnonce: wp.media.view.settings.nonce.wpRestApi 61 maxheight: this.model.get( 'height' ) 63 62 }, 64 63 type: 'GET', -
trunk/src/wp-includes/media.php
r41198 r41206 3438 3438 'nonce' => array( 3439 3439 'sendToEditor' => wp_create_nonce( 'media-send-to-editor' ), 3440 'wpRestApi' => wp_create_nonce( 'wp_rest' ),3441 3440 ), 3442 3441 'post' => array( -
trunk/src/wp-includes/script-loader.php
r41198 r41206 132 132 'noPerm' => __('Sorry, you are not allowed to do that.'), 133 133 'broken' => __('An unidentified error has occurred.') 134 ) ); 135 136 $scripts->add( 'wp-api-request', "/wp-includes/js/api-request$suffix.js", array( 'jquery' ), false, 1 ); 137 // `wpApiSettings` is also used by `wp-api`, which depends on this script. 138 did_action( 'init' ) && $scripts->localize( 'wp-api-request', 'wpApiSettings', array( 139 'root' => esc_url_raw( get_rest_url() ), 140 'nonce' => ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'wp_rest' ), 141 'versionString' => 'wp/v2/', 134 142 ) ); 135 143 … … 567 575 // To enqueue media-views or media-editor, call wp_enqueue_media(). 568 576 // Both rely on numerous settings, styles, and templates to operate correctly. 569 $scripts->add( 'media-views', "/wp-includes/js/media-views$suffix.js", array( 'utils', 'media-models', 'wp-plupload', 'jquery-ui-sortable', 'wp-mediaelement' ), false, 1 );577 $scripts->add( 'media-views', "/wp-includes/js/media-views$suffix.js", array( 'utils', 'media-models', 'wp-plupload', 'jquery-ui-sortable', 'wp-mediaelement', 'wp-api-request' ), false, 1 ); 570 578 $scripts->add( 'media-editor', "/wp-includes/js/media-editor$suffix.js", array( 'shortcode', 'media-views' ), false, 1 ); 571 579 $scripts->add( 'media-audiovideo', "/wp-includes/js/media-audiovideo$suffix.js", array( 'media-editor' ), false, 1 ); 572 580 $scripts->add( 'mce-view', "/wp-includes/js/mce-view$suffix.js", array( 'shortcode', 'jquery', 'media-views', 'media-audiovideo' ), false, 1 ); 573 581 574 $scripts->add( 'wp-api', "/wp-includes/js/wp-api$suffix.js", array( 'jquery', 'backbone', 'underscore' ), false, 1 ); 575 did_action( 'init' ) && $scripts->localize( 'wp-api', 'wpApiSettings', array( 576 'root' => esc_url_raw( get_rest_url() ), 577 'nonce' => ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'wp_rest' ), 578 'versionString' => 'wp/v2/', 579 ) ); 582 $scripts->add( 'wp-api', "/wp-includes/js/wp-api$suffix.js", array( 'jquery', 'backbone', 'underscore', 'wp-api-request' ), false, 1 ); 580 583 581 584 if ( is_admin() ) { … … 670 673 671 674 $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), false, 1 ); 672 $scripts->add( 'media-widgets', "/wp-admin/js/widgets/media-widgets$suffix.js", array( 'jquery', 'media-models', 'media-views' ) );675 $scripts->add( 'media-widgets', "/wp-admin/js/widgets/media-widgets$suffix.js", array( 'jquery', 'media-models', 'media-views', 'wp-api-request' ) ); 673 676 $scripts->add_inline_script( 'media-widgets', 'wp.mediaWidgets.init();', 'after' ); 674 677 675 678 $scripts->add( 'media-audio-widget', "/wp-admin/js/widgets/media-audio-widget$suffix.js", array( 'media-widgets', 'media-audiovideo' ) ); 676 679 $scripts->add( 'media-image-widget', "/wp-admin/js/widgets/media-image-widget$suffix.js", array( 'media-widgets' ) ); 677 $scripts->add( 'media-video-widget', "/wp-admin/js/widgets/media-video-widget$suffix.js", array( 'media-widgets', 'media-audiovideo' ) );680 $scripts->add( 'media-video-widget', "/wp-admin/js/widgets/media-video-widget$suffix.js", array( 'media-widgets', 'media-audiovideo', 'wp-api-request' ) ); 678 681 $scripts->add( 'text-widgets', "/wp-admin/js/widgets/text-widgets$suffix.js", array( 'jquery', 'backbone', 'editor', 'wp-util', 'wp-a11y' ) ); 679 682 $scripts->add_inline_script( 'text-widgets', 'wp.textWidgets.init();', 'after' ); -
trunk/tests/qunit/index.html
r40784 r41206 20 20 <script> 21 21 var wpApiSettings = { 22 'root': 'http://localhost/wp-json/' 22 root: 'http://localhost/wp-json/', 23 nonce: 'not_a_real_nonce' 23 24 }; 24 25 </script> … … 78 79 <script src="../../src/wp-includes/js/shortcode.js"></script> 79 80 <script src="../../src/wp-admin/js/customize-controls.js"></script> 81 <script src="../../src/wp-includes/js/api-request.js"></script> 80 82 <script src="../../src/wp-includes/js/wp-api.js"></script> 81 83 … … 123 125 <script src="wp-admin/js/customize-header.js"></script> 124 126 <script src="wp-includes/js/shortcode.js"></script> 127 <script src="wp-includes/js/api-request.js"></script> 125 128 <script src="wp-includes/js/wp-api.js"></script> 126 129 <script src="wp-admin/js/customize-controls.js"></script>
Note: See TracChangeset
for help on using the changeset viewer.