Changeset 64588
- Timestamp:
- 10/20/2026 05:02:48 AM (8 hours ago)
- Location:
- trunk
- Files:
-
- 15 added
- 11 edited
-
Gruntfile.js (modified) (2 diffs)
-
package-lock.json (modified) (2 diffs)
-
package.json (modified) (1 diff)
-
src/js/_enqueues/admin/media-frame-upload.js (added)
-
src/js/_enqueues/admin/media-new-upload.js (added)
-
src/js/_enqueues/admin/media-upload-pipeline.js (added)
-
src/wp-admin/media-new.php (modified) (1 diff)
-
src/wp-includes/default-filters.php (modified) (1 diff)
-
src/wp-includes/functions.php (modified) (6 diffs)
-
src/wp-includes/media.php (modified) (9 diffs)
-
src/wp-includes/rest-api/class-wp-rest-server.php (modified) (1 diff)
-
src/wp-includes/script-loader.php (modified) (1 diff)
-
tests/e2e/assets/test-audio.wav (added)
-
tests/e2e/assets/test-image.jpg (added)
-
tests/e2e/specs/media-library-client-side-upload.test.js (added)
-
tests/e2e/specs/media-modal-client-side-upload.test.js (added)
-
tests/e2e/specs/media-new-client-side-upload.test.js (added)
-
tests/phpunit/tests/media/wpEnqueueMediaFrameUpload.php (added)
-
tests/phpunit/tests/media/wpEnqueueMediaNewUpload.php (added)
-
tests/phpunit/tests/media/wpIsDocumentIsolationPolicySupported.php (added)
-
tests/phpunit/tests/media/wpMediaLibraryCrossOriginIsolation.php (added)
-
tests/phpunit/tests/media/wpMediaNewCrossOriginIsolation.php (added)
-
tsconfig.json (modified) (2 diffs)
-
typings/media-uploads (added)
-
typings/media-uploads/index.d.ts (added)
-
typings/wp-globals/index.d.ts (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Gruntfile.js
r64581 r64588 532 532 [ WORKING_DIR + 'wp-admin/js/link.js' ]: [ './src/js/_enqueues/admin/link.js' ], 533 533 [ WORKING_DIR + 'wp-admin/js/media-gallery.js' ]: [ './src/js/_enqueues/deprecated/media-gallery.js' ], 534 [ WORKING_DIR + 'wp-admin/js/media-frame-upload.js' ]: [ './src/js/_enqueues/admin/media-frame-upload.js' ], 535 [ WORKING_DIR + 'wp-admin/js/media-new-upload.js' ]: [ './src/js/_enqueues/admin/media-new-upload.js' ], 536 [ WORKING_DIR + 'wp-admin/js/media-upload-pipeline.js' ]: [ './src/js/_enqueues/admin/media-upload-pipeline.js' ], 534 537 [ WORKING_DIR + 'wp-admin/js/media-upload.js' ]: [ './src/js/_enqueues/admin/media-upload.js' ], 535 538 [ WORKING_DIR + 'wp-admin/js/media.js' ]: [ './src/js/_enqueues/admin/media.js' ], … … 1326 1329 'src/wp-admin/js/link.js': 'src/js/_enqueues/admin/link.js', 1327 1330 'src/wp-admin/js/media-gallery.js': 'src/js/_enqueues/deprecated/media-gallery.js', 1331 'src/wp-admin/js/media-frame-upload.js': 'src/js/_enqueues/admin/media-frame-upload.js', 1332 'src/wp-admin/js/media-new-upload.js': 'src/js/_enqueues/admin/media-new-upload.js', 1333 'src/wp-admin/js/media-upload-pipeline.js': 'src/js/_enqueues/admin/media-upload-pipeline.js', 1328 1334 'src/wp-admin/js/media-upload.js': 'src/js/_enqueues/admin/media-upload.js', 1329 1335 'src/wp-admin/js/media.js': 'src/js/_enqueues/admin/media.js', -
trunk/package-lock.json
r64349 r64588 47 47 "@playwright/test": "1.61.1", 48 48 "@pmmmwh/react-refresh-webpack-plugin": "0.6.2", 49 "@types/backbone": "1.4.23", 49 50 "@types/codemirror": "5.60.17", 50 51 "@types/espree": "10.1.0", … … 5876 5877 } 5877 5878 }, 5879 "node_modules/@types/backbone": { 5880 "version": "1.4.23", 5881 "resolved": "https://registry.npmjs.org/@types/backbone/-/backbone-1.4.23.tgz", 5882 "integrity": "sha512-B/hN/DAJdWFOusEkEoa5xgfVuxJJPOR/6JQ2uwURPDyKL24PuC76IR6EcSRJ6lvGWtxHRQYMJQhJYm6KpMDtGQ==", 5883 "dev": true, 5884 "license": "MIT", 5885 "dependencies": { 5886 "@types/jquery": "*", 5887 "@types/underscore": "*" 5888 } 5889 }, 5878 5890 "node_modules/@types/body-parser": { 5879 5891 "version": "1.19.5", -
trunk/package.json
r64587 r64588 45 45 "@playwright/test": "1.61.1", 46 46 "@pmmmwh/react-refresh-webpack-plugin": "0.6.2", 47 "@types/backbone": "1.4.23", 47 48 "@types/codemirror": "5.60.17", 48 49 "@types/espree": "10.1.0", -
trunk/src/wp-admin/media-new.php
r61569 r64588 18 18 19 19 wp_enqueue_script( 'plupload-handlers' ); 20 wp_enqueue_media_new_upload(); 20 21 21 22 $post_id = 0; -
trunk/src/wp-includes/default-filters.php
r64567 r64588 719 719 add_action( 'load-site-editor.php', 'wp_set_up_cross_origin_isolation' ); 720 720 add_action( 'load-widgets.php', 'wp_set_up_cross_origin_isolation' ); 721 add_action( 'load-upload.php', 'wp_set_up_cross_origin_isolation' ); 722 add_action( 'load-media-new.php', 'wp_set_up_cross_origin_isolation' ); 721 723 // Nav menu. 722 724 add_filter( 'nav_menu_item_id', '_nav_menu_item_id_use_once', 10, 2 ); -
trunk/src/wp-includes/functions.php
r64436 r64588 3510 3510 * @since 6.8.0 Support was added for `audio/x-wav`. 3511 3511 * 3512 * @return string[]Array of mime types keyed by the file extension regex corresponding to those types.3512 * @return array<string, string> Array of mime types keyed by the file extension regex corresponding to those types. 3513 3513 */ 3514 3514 function wp_get_mime_types() { … … 3521 3521 * @since 3.5.0 3522 3522 * 3523 * @param string[]$wp_get_mime_types Mime types keyed by the file extension regex3524 * corresponding to those types.3523 * @param array<string, string> $wp_get_mime_types Mime types keyed by the file extension regex 3524 * corresponding to those types. 3525 3525 */ 3526 3526 return apply_filters( … … 3646 3646 * @since 4.6.0 3647 3647 * 3648 * @return array []Multi-dimensional array of file extensions types keyed by the type of file.3648 * @return array<string, string[]> Multi-dimensional array of file extensions types keyed by the type of file. 3649 3649 */ 3650 3650 function wp_get_ext_types() { … … 3657 3657 * @see wp_ext2type() 3658 3658 * 3659 * @param array []$ext2type Multi-dimensional array of file extensions types keyed by the type of file.3659 * @param array<string, string[]> $ext2type Multi-dimensional array of file extensions types keyed by the type of file. 3660 3660 */ 3661 3661 return apply_filters( … … 3731 3731 * 3732 3732 * @param int|WP_User $user Optional. User to check. Defaults to current user. 3733 * @return string[] Array of mime types keyed by the file extension regex corresponding 3734 * to those types. 3733 * @return array<string, string> Array of mime types keyed by the file extension regex corresponding to those types. 3735 3734 */ 3736 3735 function get_allowed_mime_types( $user = null ) { … … 3751 3750 * @since 2.0.0 3752 3751 * 3753 * @param array $t Mime types keyed by the file extension regex corresponding to those types.3754 * @param int|WP_User|null $user User ID, User object or null if not provided (indicates current user).3752 * @param array<string, string> $t Mime types keyed by the file extension regex corresponding to those types. 3753 * @param int|WP_User|null $user User ID, User object or null if not provided (indicates current user). 3755 3754 */ 3756 3755 return apply_filters( 'upload_mimes', $t, $user ); -
trunk/src/wp-includes/media.php
r64489 r64588 4914 4914 * 4915 4915 * @since 3.5.0 4916 * @since 7.2.0 Also enqueues the client-side upload integration for the media frame on cross-origin isolated screens. 4916 4917 * 4917 4918 * @global int $content_width … … 5303 5304 */ 5304 5305 wp_enqueue_script( 'media-editor' ); 5306 wp_enqueue_media_frame_upload(); 5305 5307 wp_localize_script( 'media-views', '_wpMediaViewsL10n', $strings ); 5306 5308 … … 6611 6613 wp_add_inline_script( 'wp-block-editor', 'window.__clientSideMediaProcessing = true;', 'before' ); 6612 6614 6613 $chromium_version = wp_get_chromium_major_version(); 6614 6615 if ( null !== $chromium_version && $chromium_version >= 137 ) { 6615 if ( wp_is_document_isolation_policy_supported() ) { 6616 6616 wp_add_inline_script( 'wp-block-editor', 'window.__documentIsolationPolicy = true;', 'before' ); 6617 6617 } … … 6638 6638 6639 6639 /** 6640 * Enables cross-origin isolation in the block editor. 6640 * Determines whether the current request's browser honors the 6641 * Document-Isolation-Policy header. 6642 * 6643 * Document-Isolation-Policy is how WordPress makes a page cross-origin 6644 * isolated for client-side media processing. Chromium 137+ is the only 6645 * engine that implements it; other browsers ignore the header, so the 6646 * page never becomes isolated and the client-side pipeline cannot run. 6647 * 6648 * @since 7.2.0 6649 * 6650 * @return bool True when the browser is Chromium 137 or newer. 6651 */ 6652 function wp_is_document_isolation_policy_supported(): bool { 6653 $chromium_version = wp_get_chromium_major_version(); 6654 6655 return null !== $chromium_version && $chromium_version >= 137; 6656 } 6657 6658 /** 6659 * Enables cross-origin isolation on screens that upload media client-side. 6641 6660 * 6642 6661 * Required for enabling SharedArrayBuffer for WebAssembly-based 6643 * media processing in the editor. Uses Document-Isolation-Policy 6662 * media processing in the block editor, the Media Library grid, and 6663 * the "Add New Media File" screen. Uses Document-Isolation-Policy 6644 6664 * on supported browsers (Chromium 137+). 6665 * 6666 * The Media Library is only isolated in grid mode: list mode has no 6667 * client-side pipeline integration, its uploads go through the 6668 * "Add New Media File" screen. 6645 6669 * 6646 6670 * Skips setup when a third-party page builder overrides the block … … 6649 6673 * 6650 6674 * @since 7.1.0 6651 * @since 7.2.0 Returns whether the header was sent. 6675 * @since 7.2.0 Also isolates the Media Library grid and the "Add New Media File" screen. 6676 * Returns whether the header was sent. 6652 6677 * 6653 6678 * @return bool Whether the Document-Isolation-Policy header was sent. … … 6664 6689 } 6665 6690 6666 if ( ! $screen->is_block_editor() && 'site-editor' !== $screen->id && ! ( 'widgets' === $screen->id && wp_use_widgets_block_editor() ) ) { 6691 $is_media_screen = 'media' === $screen->id || ( 'upload' === $screen->id && 'grid' === wp_get_media_library_mode() ); 6692 6693 if ( 6694 ! $is_media_screen && 6695 ! $screen->is_block_editor() && 6696 'site-editor' !== $screen->id && 6697 ! ( 'widgets' === $screen->id && wp_use_widgets_block_editor() ) 6698 ) { 6667 6699 return false; 6668 6700 } … … 6689 6721 * which blocks same-origin iframe access that these editors rely on. 6690 6722 */ 6691 if ( isset( $_GET['action'] ) && 'edit' !== $_GET['action'] ) {6723 if ( ! $is_media_screen && isset( $_GET['action'] ) && 'edit' !== $_GET['action'] ) { 6692 6724 return false; 6693 6725 } … … 6699 6731 6700 6732 return wp_send_document_isolation_policy_header(); 6733 } 6734 6735 /** 6736 * Returns the current Media Library mode (grid or list). 6737 * 6738 * Replicates the mode resolution in wp-admin/upload.php, which runs after 6739 * the `load-upload.php` hook, without updating the saved user option. 6740 * 6741 * upload.php falls back to grid mode for any falsey saved value and renders 6742 * grid mode only for the exact value 'grid'. A truthy saved value outside the 6743 * two known modes - one a plugin stored, say - therefore renders list mode 6744 * there and resolves to 'list' here, so callers do not isolate a page that 6745 * the Media Library renders in list mode. 6746 * 6747 * @since 7.2.0 6748 * 6749 * @return string The Media Library mode, 'grid' when none is saved. 6750 * @phpstan-return 'grid'|'list' 6751 */ 6752 function wp_get_media_library_mode(): string { 6753 $valid_modes = array( 'grid', 'list' ); 6754 6755 // phpcs:ignore WordPress.Security.NonceVerification.Recommended 6756 if ( isset( $_GET['mode'] ) && in_array( $_GET['mode'], $valid_modes, true ) ) { 6757 // phpcs:ignore WordPress.Security.NonceVerification.Recommended 6758 return $_GET['mode']; 6759 } 6760 6761 $mode = get_user_option( 'media_library_mode', get_current_user_id() ); 6762 6763 if ( in_array( $mode, $valid_modes, true ) ) { 6764 return $mode; 6765 } 6766 6767 // As in upload.php: nothing saved renders the grid, any other value the list. 6768 return $mode ? 'list' : 'grid'; 6769 } 6770 6771 /** 6772 * Returns the image processing settings for client-side media processing. 6773 * 6774 * Shared by the REST API index, which the block editor reads, and 6775 * wp_get_media_library_upload_settings(), so both pipelines apply the 6776 * same filters. 6777 * 6778 * @since 7.2.0 6779 * @access private 6780 * 6781 * @return array<string, mixed> Image processing settings. 6782 * 6783 * @phpstan-return array{ 6784 * image_sizes: array<string, array{ 6785 * width: non-negative-int, 6786 * height: non-negative-int, 6787 * crop: array{ 'left'|'center'|'right', 'top'|'center'|'bottom' }|bool, 6788 * }>, 6789 * image_size_threshold: non-negative-int, 6790 * image_strip_meta: bool, 6791 * image_max_bit_depth: non-negative-int, 6792 * generate_animated_image_subsizes: bool, 6793 * } 6794 */ 6795 function _wp_get_client_side_media_image_settings(): array { 6796 /** This filter is documented in wp-admin/includes/image.php */ 6797 $image_size_threshold = max( 0, (int) apply_filters( 'big_image_size_threshold', 2560, array( 0, 0 ), '', 0 ) ); 6798 6799 /** This filter is documented in wp-includes/class-wp-image-editor-imagick.php */ 6800 $image_strip_meta = (bool) apply_filters( 'image_strip_meta', true ); 6801 6802 /* 6803 * On the server, this filter receives the decoded image's actual bit depth. 6804 * The client path never decodes the image on the server, so the filter is 6805 * applied with 16 (the maximum depth the client encoder can produce) as 6806 * both the value and the current depth. The client caps its output bit 6807 * depth at the filtered value, so a plugin lowering it (e.g. to 8) takes 6808 * effect on client-generated images too. 6809 */ 6810 /** This filter is documented in wp-includes/class-wp-image-editor-imagick.php */ 6811 $image_max_bit_depth = max( 0, (int) apply_filters( 'image_max_bit_depth', 16, 16 ) ); 6812 6813 /** 6814 * Filters whether client-side media processing preserves animation in image sub-sizes. 6815 * 6816 * By default, sub-sizes of animated GIF and WebP images retain animation, 6817 * including cropped sizes. Return false to generate static sub-sizes using 6818 * only the first frame, reducing processing time in the browser. 6819 * 6820 * This setting applies only to client-side media processing. Server-side 6821 * processing continues to generate static sub-sizes. 6822 * 6823 * @since 7.2.0 6824 * 6825 * @param bool $generate_animated_image_subsizes Whether to preserve animation in image sub-sizes. 6826 * Default true. 6827 */ 6828 $generate_animated_image_subsizes = (bool) apply_filters( 'wp_generate_animated_image_subsizes', true ); 6829 6830 return array( 6831 'image_sizes' => wp_get_registered_image_subsizes(), 6832 'image_size_threshold' => $image_size_threshold, 6833 'image_strip_meta' => $image_strip_meta, 6834 'image_max_bit_depth' => $image_max_bit_depth, 6835 'generate_animated_image_subsizes' => $generate_animated_image_subsizes, 6836 ); 6837 } 6838 6839 /** 6840 * Returns the settings for the client-side media processing pipeline 6841 * in the Media Library. 6842 * 6843 * These mirror the values the block editor consumes for the same 6844 * pipeline: the REST index (the image processing settings, shared through 6845 * _wp_get_client_side_media_image_settings()) and get_block_editor_settings() 6846 * (max upload size and allowed mime types). 6847 * 6848 * @since 7.2.0 6849 * 6850 * @return array<string, mixed> Settings for the client-side media processing pipeline. 6851 * 6852 * @phpstan-return array{ 6853 * maxUploadFileSize: non-negative-int, // Maximum upload file size in bytes. 6854 * allowedMimeTypes: array<string, string>, // Allowed mime types keyed by file extension. 6855 * allImageSizes: array<string, array{ // All registered image sub-sizes. 6856 * width: non-negative-int, 6857 * height: non-negative-int, 6858 * crop: array{ 'left'|'center'|'right', 'top'|'center'|'bottom' }|bool, 6859 * }>, 6860 * bigImageSizeThreshold: non-negative-int, // Threshold above which originals are scaled down. 6861 * imageStripMeta: bool, // Whether metadata is stripped from generated images. 6862 * imageMaxBitDepth: non-negative-int, // Maximum bit depth for generated images. 6863 * generateAnimatedImageSubsizes: bool, // Whether sub-sizes of animated images stay animated. 6864 * } 6865 */ 6866 function wp_get_media_library_upload_settings(): array { 6867 $image_settings = _wp_get_client_side_media_image_settings(); 6868 6869 return array( 6870 'maxUploadFileSize' => max( 0, (int) wp_max_upload_size() ), 6871 'allowedMimeTypes' => get_allowed_mime_types(), 6872 'allImageSizes' => $image_settings['image_sizes'], 6873 'bigImageSizeThreshold' => $image_settings['image_size_threshold'], 6874 'imageStripMeta' => $image_settings['image_strip_meta'], 6875 'imageMaxBitDepth' => $image_settings['image_max_bit_depth'], 6876 'generateAnimatedImageSubsizes' => $image_settings['generate_animated_image_subsizes'], 6877 ); 6878 } 6879 6880 /** 6881 * Enqueues a screen's client-side upload integration script along with the 6882 * shared pipeline glue and its settings. 6883 * 6884 * Nothing is enqueued unless client-side media processing is enabled and the 6885 * browser honors Document-Isolation-Policy: without isolation the page never 6886 * becomes cross-origin isolated, the script would no-op, and the whole 6887 * wp-upload-media dependency chain would be loaded for nothing. The same 6888 * goes for a screen wp_set_up_cross_origin_isolation() did not isolate, 6889 * such as the Customizer or the Site Icon picker: the media frame loads 6890 * there too, but its uploads stay on the classic path. 6891 * 6892 * The screen script self-guards at runtime too: when the browser turns out 6893 * not to be isolated or lacks client-side media support, it no-ops and the 6894 * classic plupload flow keeps handling uploads. 6895 * 6896 * @since 7.2.0 6897 * @access private 6898 * 6899 * @param string $handle The screen script to enqueue. 6900 * 6901 * @phpstan-param non-empty-string $handle 6902 */ 6903 function _wp_enqueue_media_upload_pipeline_script( string $handle ): void { 6904 if ( 6905 ! wp_is_client_side_media_processing_enabled() || 6906 ! wp_is_document_isolation_policy_supported() || 6907 ! wp_is_cross_origin_isolated_request() 6908 ) { 6909 return; 6910 } 6911 6912 wp_enqueue_script( $handle ); 6913 6914 // Both screen scripts share the pipeline script, so add its settings once. 6915 if ( wp_scripts()->get_data( 'media-upload-pipeline', 'settings_added' ) ) { 6916 return; 6917 } 6918 wp_scripts()->add_data( 'media-upload-pipeline', 'settings_added', true ); 6919 6920 $settings = wp_get_media_library_upload_settings(); 6921 6922 // wp_enqueue_media() can run on the front end, where there is no screen. 6923 $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null; 6924 6925 // The block editor configures the upload-media store itself; the pipeline waits for it. 6926 $settings['isBlockEditor'] = $screen && $screen->is_block_editor(); 6927 6928 $js_function = <<<'JS' 6929 ( settings ) => { 6930 window._wpMediaUploadPipelineSettings = settings; 6931 } 6932 JS; 6933 6934 wp_add_inline_script( 6935 'media-upload-pipeline', 6936 sprintf( '( %s )( %s );', $js_function, wp_json_encode( $settings, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ), 6937 'before' 6938 ); 6939 } 6940 6941 /** 6942 * Enqueues the script that routes uploads started from a media frame 6943 * through the client-side media processing pipeline. 6944 * 6945 * Covers every `wp.media` frame that uploads through `wp.Uploader`: the 6946 * Media Library grid and the media modal the block editor, the site editor 6947 * and the block widgets screen open. wp_enqueue_media() calls this on any 6948 * screen that was cross-origin isolated, so it rarely needs calling directly. 6949 * 6950 * @since 7.2.0 6951 */ 6952 function wp_enqueue_media_frame_upload(): void { 6953 _wp_enqueue_media_upload_pipeline_script( 'media-frame-upload' ); 6954 } 6955 6956 /** 6957 * Enqueues the script that routes "Add New Media File" screen uploads 6958 * through the client-side media processing pipeline. 6959 * 6960 * @since 7.2.0 6961 */ 6962 function wp_enqueue_media_new_upload(): void { 6963 _wp_enqueue_media_upload_pipeline_script( 'media-new-upload' ); 6701 6964 } 6702 6965 … … 6712 6975 * @since 7.2.0 6713 6976 * 6977 * @global bool $_wp_cross_origin_isolated Whether the Document-Isolation-Policy header was sent. 6978 * 6714 6979 * @return bool Whether the header was sent. False if the browser does not 6715 6980 * support Document-Isolation-Policy or headers were already sent. 6716 6981 */ 6717 6982 function wp_send_document_isolation_policy_header(): bool { 6718 if ( headers_sent() ) { 6983 global $_wp_cross_origin_isolated; 6984 6985 if ( headers_sent() || ! wp_is_document_isolation_policy_supported() ) { 6719 6986 return false; 6720 6987 } 6721 6988 6722 $chromium_version = wp_get_chromium_major_version();6723 6724 if ( null === $chromium_version || $chromium_version < 137 ) {6725 return false;6726 }6727 6728 6989 header( 'Document-Isolation-Policy: isolate-and-credentialless' ); 6729 6990 6991 $_wp_cross_origin_isolated = true; 6992 6730 6993 return true; 6731 6994 } 6732 6995 6996 /** 6997 * Whether the current request has been set up for cross-origin isolation. 6998 * 6999 * True once wp_set_up_cross_origin_isolation() has sent the 7000 * Document-Isolation-Policy header for the screen being rendered, which is 7001 * what lets scripts that need a cross-origin isolated page, such as the 7002 * client-side media upload integration, decide whether to load at all. 7003 * 7004 * A plugin can isolate a screen on its own by sending the header directly, 7005 * as the Gutenberg plugin does on the block editor screens, so a header 7006 * already queued for the response counts too. 7007 * 7008 * @since 7.2.0 7009 * 7010 * @global bool $_wp_cross_origin_isolated Whether the Document-Isolation-Policy header was sent. 7011 * 7012 * @return bool True when the response will be cross-origin isolated. 7013 */ 7014 function wp_is_cross_origin_isolated_request(): bool { 7015 global $_wp_cross_origin_isolated; 7016 7017 if ( true === $_wp_cross_origin_isolated ) { 7018 return true; 7019 } 7020 7021 foreach ( headers_list() as $header ) { 7022 if ( 0 === stripos( $header, 'Document-Isolation-Policy:' ) ) { 7023 return true; 7024 } 7025 } 7026 7027 return false; 7028 } 7029 -
trunk/src/wp-includes/rest-api/class-wp-rest-server.php
r64527 r64588 1466 1466 // Add media processing settings for users who can upload files. 1467 1467 if ( wp_is_client_side_media_processing_enabled() && current_user_can( 'upload_files' ) ) { 1468 // Image sizes keyed by name for client-side media processing. 1469 $available['image_sizes'] = array(); 1470 foreach ( wp_get_registered_image_subsizes() as $name => $size ) { 1471 $available['image_sizes'][ $name ] = $size; 1472 } 1473 1474 /** This filter is documented in wp-admin/includes/image.php */ 1475 $available['image_size_threshold'] = (int) apply_filters( 'big_image_size_threshold', 2560, array( 0, 0 ), '', 0 ); 1476 1477 /** This filter is documented in wp-includes/class-wp-image-editor-imagick.php */ 1478 $available['image_strip_meta'] = (bool) apply_filters( 'image_strip_meta', true ); 1479 1480 /* 1481 * On the server, this filter receives the decoded image's actual bit depth. 1482 * The client path never decodes the image on the server, so the filter is 1483 * applied with 16 (the maximum depth the client encoder can produce) as 1484 * both the value and the current depth. The client caps its output bit 1485 * depth at the filtered value, so a plugin lowering it (e.g. to 8) takes 1486 * effect on client-generated images too. 1487 */ 1488 /** This filter is documented in wp-includes/class-wp-image-editor-imagick.php */ 1489 $available['image_max_bit_depth'] = (int) apply_filters( 'image_max_bit_depth', 16, 16 ); 1490 1491 /** 1492 * Filters whether client-side media processing preserves animation in image sub-sizes. 1493 * 1494 * By default, sub-sizes of animated GIF and WebP images retain animation, 1495 * including cropped sizes. Return false to generate static sub-sizes using 1496 * only the first frame, reducing processing time in the browser. 1497 * 1498 * This setting applies only to client-side media processing. Server-side 1499 * processing continues to generate static sub-sizes. 1500 * 1501 * @since 7.2.0 1502 * 1503 * @param bool $generate_animated_image_subsizes Whether to preserve animation in image sub-sizes. 1504 * Default true. 1505 */ 1506 $available['generate_animated_image_subsizes'] = (bool) apply_filters( 'wp_generate_animated_image_subsizes', true ); 1468 $available = array_merge( $available, _wp_get_client_side_media_image_settings() ); 1507 1469 } 1508 1470 -
trunk/src/wp-includes/script-loader.php
r64585 r64588 1496 1496 $scripts->set_translations( 'media' ); 1497 1497 1498 $scripts->add( 'media-upload-pipeline', "/wp-admin/js/media-upload-pipeline$suffix.js", array( 'plupload', 'wp-upload-media', 'wp-media-utils', 'wp-api-fetch', 'wp-data', 'wp-element', 'wp-i18n' ), false, 1 ); 1499 $scripts->set_translations( 'media-upload-pipeline' ); 1500 1501 $scripts->add( 'media-frame-upload', "/wp-admin/js/media-frame-upload$suffix.js", array( 'media-views', 'media-upload-pipeline' ), false, 1 ); 1502 1503 $scripts->add( 'media-new-upload', "/wp-admin/js/media-new-upload$suffix.js", array( 'plupload-handlers', 'media-upload-pipeline', 'wp-a11y', 'wp-i18n' ), false, 1 ); 1504 $scripts->set_translations( 'media-new-upload' ); 1505 1498 1506 $scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array( 'jquery', 'jquery-ui-core', 'imgareaselect', 'wp-a11y' ), false, 1 ); 1499 1507 $scripts->set_translations( 'image-edit' ); -
trunk/tsconfig.json
r64297 r64588 22 22 "types": [ 23 23 "node", 24 "backbone", 24 25 "wp-globals", 26 "media-uploads", 25 27 "browser-globals", 26 28 "wp-emoji", … … 31 33 "include": [], 32 34 "files": [ 35 "src/js/_enqueues/admin/media-frame-upload.js", 36 "src/js/_enqueues/admin/media-new-upload.js", 37 "src/js/_enqueues/admin/media-upload-pipeline.js", 33 38 "src/js/_enqueues/lib/accordion.js", 34 39 "src/js/_enqueues/lib/codemirror/htmlhint-kses.js", -
trunk/typings/wp-globals/index.d.ts
r61800 r64588 2 2 declare var jQuery: import('jquery').JQueryStatic; 3 3 declare var _: import('underscore'); 4 declare var Backbone: any;5 4 declare var HTMLHint: import('htmlhint').HTMLHint;
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)