diff -r 34716fd837a4 -r be944660c56a wp/wp-includes/script-loader.php --- a/wp/wp-includes/script-loader.php Tue Dec 15 15:52:01 2020 +0100 +++ b/wp/wp-includes/script-loader.php Wed Sep 21 18:19:35 2022 +0200 @@ -80,8 +80,9 @@ $suffix = wp_scripts_get_suffix(); $vendor_scripts = array( - 'react' => array( 'wp-polyfill' ), - 'react-dom' => array( 'react' ), + 'react' => array( 'wp-polyfill' ), + 'react-dom' => array( 'react' ), + 'regenerator-runtime', 'moment', 'lodash', 'wp-polyfill-fetch', @@ -90,21 +91,24 @@ 'wp-polyfill-url', 'wp-polyfill-dom-rect', 'wp-polyfill-element-closest', - 'wp-polyfill', + 'wp-polyfill-object-fit', + 'wp-polyfill' => array( 'regenerator-runtime' ), ); $vendor_scripts_versions = array( - 'react' => '16.9.0', - 'react-dom' => '16.9.0', - 'moment' => '2.26.0', - 'lodash' => '4.17.15', + 'react' => '16.13.1', + 'react-dom' => '16.13.1', + 'regenerator-runtime' => '0.13.7', + 'moment' => '2.29.1', + 'lodash' => '4.17.19', 'wp-polyfill-fetch' => '3.0.0', - 'wp-polyfill-formdata' => '3.0.12', - 'wp-polyfill-node-contains' => '3.42.0', + 'wp-polyfill-formdata' => '4.0.0', + 'wp-polyfill-node-contains' => '3.105.0', 'wp-polyfill-url' => '3.6.4', - 'wp-polyfill-dom-rect' => '3.42.0', + 'wp-polyfill-dom-rect' => '3.104.0', 'wp-polyfill-element-closest' => '2.0.2', - 'wp-polyfill' => '7.4.4', + 'wp-polyfill-object-fit' => '2.3.5', + 'wp-polyfill' => '3.15.0', ); foreach ( $vendor_scripts as $handle => $dependencies ) { @@ -119,22 +123,6 @@ $scripts->add( $handle, $path, $dependencies, $version, 1 ); } - $scripts->add( 'wp-polyfill', null, array( 'wp-polyfill' ) ); - did_action( 'init' ) && $scripts->add_inline_script( - 'wp-polyfill', - wp_get_script_polyfill( - $scripts, - array( - '\'fetch\' in window' => 'wp-polyfill-fetch', - 'document.contains' => 'wp-polyfill-node-contains', - 'window.DOMRect' => 'wp-polyfill-dom-rect', - 'window.URL && window.URL.prototype && window.URLSearchParams' => 'wp-polyfill-url', - 'window.FormData && window.FormData.prototype.keys' => 'wp-polyfill-formdata', - 'Element.prototype.matches && Element.prototype.closest' => 'wp-polyfill-element-closest', - ) - ) - ); - did_action( 'init' ) && $scripts->add_inline_script( 'lodash', 'window.lodash = _.noConflict();' ); did_action( 'init' ) && $scripts->add_inline_script( @@ -152,11 +140,11 @@ 'dow' => (int) get_option( 'start_of_week', 0 ), ), 'longDateFormat' => array( - 'LT' => get_option( 'time_format', __( 'g:i a', 'default' ) ), + 'LT' => get_option( 'time_format', __( 'g:i a' ) ), 'LTS' => null, 'L' => null, - 'LL' => get_option( 'date_format', __( 'F j, Y', 'default' ) ), - 'LLL' => __( 'F j, Y g:i a', 'default' ), + 'LL' => get_option( 'date_format', __( 'F j, Y' ) ), + 'LLL' => __( 'F j, Y g:i a' ), 'LLLL' => null, ), ) @@ -264,6 +252,20 @@ if ( in_array( 'wp-i18n', $dependencies, true ) ) { $scripts->set_translations( $handle ); } + + /* + * Manually set the text direction localization after wp-i18n is printed. + * This ensures that wp.i18n.isRTL() returns true in RTL languages. + * We cannot use $scripts->set_translations( 'wp-i18n' ) to do this + * because WordPress prints a script's translations *before* the script, + * which means, in the case of wp-i18n, that wp.i18n.setLocaleData() + * is called before wp.i18n is defined. + */ + if ( 'wp-i18n' === $handle ) { + $ltr = _x( 'ltr', 'text direction' ); + $script = sprintf( "wp.i18n.setLocaleData( { 'text direction\u0004ltr': [ '%s' ] } );", $ltr ); + $scripts->add_inline_script( $handle, $script, 'after' ); + } } } @@ -323,6 +325,15 @@ ) ); + // Calculate the timezone abbr (EDT, PST) if possible. + $timezone_string = get_option( 'timezone_string', 'UTC' ); + $timezone_abbr = ''; + + if ( ! empty( $timezone_string ) ) { + $timezone_date = new DateTime( null, new DateTimeZone( $timezone_string ) ); + $timezone_abbr = $timezone_date->format( 'T' ); + } + $scripts->add_inline_script( 'wp-date', sprintf( @@ -344,18 +355,19 @@ ), ), 'formats' => array( - /* translators: Time format, see https://www.php.net/date */ + /* translators: Time format, see https://www.php.net/manual/datetime.format.php */ 'time' => get_option( 'time_format', __( 'g:i a' ) ), - /* translators: Date format, see https://www.php.net/date */ + /* translators: Date format, see https://www.php.net/manual/datetime.format.php */ 'date' => get_option( 'date_format', __( 'F j, Y' ) ), - /* translators: Date/Time format, see https://www.php.net/date */ + /* translators: Date/Time format, see https://www.php.net/manual/datetime.format.php */ 'datetime' => __( 'F j, Y g:i a' ), - /* translators: Abbreviated date/time format, see https://www.php.net/date */ + /* translators: Abbreviated date/time format, see https://www.php.net/manual/datetime.format.php */ 'datetimeAbbreviated' => __( 'M j, Y g:i a' ), ), 'timezone' => array( 'offset' => get_option( 'gmt_offset', 0 ), - 'string' => get_option( 'timezone_string', 'UTC' ), + 'string' => $timezone_string, + 'abbr' => $timezone_abbr, ), ) ) @@ -369,6 +381,18 @@ 'window.wp.oldEditor = window.wp.editor;', 'after' ); + + /* + * wp-editor module is exposed as window.wp.editor. + * Problem: there is quite some code expecting window.wp.oldEditor object available under window.wp.editor. + * Solution: fuse the two objects together to maintain backward compatibility. + * For more context, see https://github.com/WordPress/gutenberg/issues/33203. + */ + $scripts->add_inline_script( + 'wp-editor', + 'Object.assign( window.wp.editor, window.wp.oldEditor );', + 'after' + ); } /** @@ -680,7 +704,7 @@ ) ); - $scripts->add( 'wp-pointer', "/wp-includes/js/wp-pointer$suffix.js", array( 'jquery-ui-widget', 'jquery-ui-position' ), false, 1 ); + $scripts->add( 'wp-pointer', "/wp-includes/js/wp-pointer$suffix.js", array( 'jquery-ui-core' ), false, 1 ); $scripts->set_translations( 'wp-pointer' ); $scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array( 'heartbeat' ), false, 1 ); @@ -719,50 +743,65 @@ $scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array( 'scriptaculous-dragdrop' ) ); // jQuery. - $scripts->add( 'jquery', false, array( 'jquery-core' ), '1.12.4-wp' ); - $scripts->add( 'jquery-core', '/wp-includes/js/jquery/jquery.js', array(), '1.12.4-wp' ); - $scripts->add( 'jquery-migrate', "/wp-includes/js/jquery/jquery-migrate$suffix.js", array(), '1.4.1' ); + // The unminified jquery.js and jquery-migrate.js are included to facilitate debugging. + $scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ), '3.6.0' ); + $scripts->add( 'jquery-core', "/wp-includes/js/jquery/jquery$suffix.js", array(), '3.6.0' ); + $scripts->add( 'jquery-migrate', "/wp-includes/js/jquery/jquery-migrate$suffix.js", array(), '3.3.2' ); // Full jQuery UI. - $scripts->add( 'jquery-ui-core', "/wp-includes/js/jquery/ui/core$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 ); - $scripts->add( 'jquery-effects-core', "/wp-includes/js/jquery/ui/effect$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 ); - - $scripts->add( 'jquery-effects-blind', "/wp-includes/js/jquery/ui/effect-blind$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 ); - $scripts->add( 'jquery-effects-bounce', "/wp-includes/js/jquery/ui/effect-bounce$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 ); - $scripts->add( 'jquery-effects-clip', "/wp-includes/js/jquery/ui/effect-clip$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 ); - $scripts->add( 'jquery-effects-drop', "/wp-includes/js/jquery/ui/effect-drop$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 ); - $scripts->add( 'jquery-effects-explode', "/wp-includes/js/jquery/ui/effect-explode$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 ); - $scripts->add( 'jquery-effects-fade', "/wp-includes/js/jquery/ui/effect-fade$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 ); - $scripts->add( 'jquery-effects-fold', "/wp-includes/js/jquery/ui/effect-fold$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 ); - $scripts->add( 'jquery-effects-highlight', "/wp-includes/js/jquery/ui/effect-highlight$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 ); - $scripts->add( 'jquery-effects-puff', "/wp-includes/js/jquery/ui/effect-puff$dev_suffix.js", array( 'jquery-effects-core', 'jquery-effects-scale' ), '1.11.4', 1 ); - $scripts->add( 'jquery-effects-pulsate', "/wp-includes/js/jquery/ui/effect-pulsate$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 ); - $scripts->add( 'jquery-effects-scale', "/wp-includes/js/jquery/ui/effect-scale$dev_suffix.js", array( 'jquery-effects-core', 'jquery-effects-size' ), '1.11.4', 1 ); - $scripts->add( 'jquery-effects-shake', "/wp-includes/js/jquery/ui/effect-shake$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 ); - $scripts->add( 'jquery-effects-size', "/wp-includes/js/jquery/ui/effect-size$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 ); - $scripts->add( 'jquery-effects-slide', "/wp-includes/js/jquery/ui/effect-slide$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 ); - $scripts->add( 'jquery-effects-transfer', "/wp-includes/js/jquery/ui/effect-transfer$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 ); - - $scripts->add( 'jquery-ui-accordion', "/wp-includes/js/jquery/ui/accordion$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.4', 1 ); - $scripts->add( 'jquery-ui-autocomplete', "/wp-includes/js/jquery/ui/autocomplete$dev_suffix.js", array( 'jquery-ui-menu', 'wp-a11y' ), '1.11.4', 1 ); - $scripts->add( 'jquery-ui-button', "/wp-includes/js/jquery/ui/button$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.4', 1 ); - $scripts->add( 'jquery-ui-datepicker', "/wp-includes/js/jquery/ui/datepicker$dev_suffix.js", array( 'jquery-ui-core' ), '1.11.4', 1 ); - $scripts->add( 'jquery-ui-dialog', "/wp-includes/js/jquery/ui/dialog$dev_suffix.js", array( 'jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-button', 'jquery-ui-position' ), '1.11.4', 1 ); - $scripts->add( 'jquery-ui-draggable', "/wp-includes/js/jquery/ui/draggable$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.11.4', 1 ); - $scripts->add( 'jquery-ui-droppable', "/wp-includes/js/jquery/ui/droppable$dev_suffix.js", array( 'jquery-ui-draggable' ), '1.11.4', 1 ); - $scripts->add( 'jquery-ui-menu', "/wp-includes/js/jquery/ui/menu$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position' ), '1.11.4', 1 ); - $scripts->add( 'jquery-ui-mouse', "/wp-includes/js/jquery/ui/mouse$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.4', 1 ); - $scripts->add( 'jquery-ui-position', "/wp-includes/js/jquery/ui/position$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 ); - $scripts->add( 'jquery-ui-progressbar', "/wp-includes/js/jquery/ui/progressbar$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.4', 1 ); - $scripts->add( 'jquery-ui-resizable', "/wp-includes/js/jquery/ui/resizable$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.11.4', 1 ); - $scripts->add( 'jquery-ui-selectable', "/wp-includes/js/jquery/ui/selectable$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.11.4', 1 ); - $scripts->add( 'jquery-ui-selectmenu', "/wp-includes/js/jquery/ui/selectmenu$dev_suffix.js", array( 'jquery-ui-menu' ), '1.11.4', 1 ); - $scripts->add( 'jquery-ui-slider', "/wp-includes/js/jquery/ui/slider$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.11.4', 1 ); - $scripts->add( 'jquery-ui-sortable', "/wp-includes/js/jquery/ui/sortable$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.11.4', 1 ); - $scripts->add( 'jquery-ui-spinner', "/wp-includes/js/jquery/ui/spinner$dev_suffix.js", array( 'jquery-ui-button' ), '1.11.4', 1 ); - $scripts->add( 'jquery-ui-tabs', "/wp-includes/js/jquery/ui/tabs$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.4', 1 ); - $scripts->add( 'jquery-ui-tooltip', "/wp-includes/js/jquery/ui/tooltip$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position' ), '1.11.4', 1 ); - $scripts->add( 'jquery-ui-widget', "/wp-includes/js/jquery/ui/widget$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 ); + // The build process in 1.12.1 has changed significantly. + // In order to keep backwards compatibility, and to keep the optimized loading, + // the source files were flattened and included with some modifications for AMD loading. + // A notable change is that 'jquery-ui-core' now contains 'jquery-ui-position' and 'jquery-ui-widget'. + $scripts->add( 'jquery-ui-core', "/wp-includes/js/jquery/ui/core$suffix.js", array( 'jquery' ), '1.12.1', 1 ); + $scripts->add( 'jquery-effects-core', "/wp-includes/js/jquery/ui/effect$suffix.js", array( 'jquery' ), '1.12.1', 1 ); + + $scripts->add( 'jquery-effects-blind', "/wp-includes/js/jquery/ui/effect-blind$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 ); + $scripts->add( 'jquery-effects-bounce', "/wp-includes/js/jquery/ui/effect-bounce$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 ); + $scripts->add( 'jquery-effects-clip', "/wp-includes/js/jquery/ui/effect-clip$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 ); + $scripts->add( 'jquery-effects-drop', "/wp-includes/js/jquery/ui/effect-drop$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 ); + $scripts->add( 'jquery-effects-explode', "/wp-includes/js/jquery/ui/effect-explode$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 ); + $scripts->add( 'jquery-effects-fade', "/wp-includes/js/jquery/ui/effect-fade$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 ); + $scripts->add( 'jquery-effects-fold', "/wp-includes/js/jquery/ui/effect-fold$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 ); + $scripts->add( 'jquery-effects-highlight', "/wp-includes/js/jquery/ui/effect-highlight$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 ); + $scripts->add( 'jquery-effects-puff', "/wp-includes/js/jquery/ui/effect-puff$suffix.js", array( 'jquery-effects-core', 'jquery-effects-scale' ), '1.12.1', 1 ); + $scripts->add( 'jquery-effects-pulsate', "/wp-includes/js/jquery/ui/effect-pulsate$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 ); + $scripts->add( 'jquery-effects-scale', "/wp-includes/js/jquery/ui/effect-scale$suffix.js", array( 'jquery-effects-core', 'jquery-effects-size' ), '1.12.1', 1 ); + $scripts->add( 'jquery-effects-shake', "/wp-includes/js/jquery/ui/effect-shake$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 ); + $scripts->add( 'jquery-effects-size', "/wp-includes/js/jquery/ui/effect-size$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 ); + $scripts->add( 'jquery-effects-slide', "/wp-includes/js/jquery/ui/effect-slide$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 ); + $scripts->add( 'jquery-effects-transfer', "/wp-includes/js/jquery/ui/effect-transfer$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 ); + + // Widgets + $scripts->add( 'jquery-ui-accordion', "/wp-includes/js/jquery/ui/accordion$suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 ); + $scripts->add( 'jquery-ui-autocomplete', "/wp-includes/js/jquery/ui/autocomplete$suffix.js", array( 'jquery-ui-menu', 'wp-a11y' ), '1.12.1', 1 ); + $scripts->add( 'jquery-ui-button', "/wp-includes/js/jquery/ui/button$suffix.js", array( 'jquery-ui-core', 'jquery-ui-controlgroup', 'jquery-ui-checkboxradio' ), '1.12.1', 1 ); + $scripts->add( 'jquery-ui-datepicker', "/wp-includes/js/jquery/ui/datepicker$suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 ); + $scripts->add( 'jquery-ui-dialog', "/wp-includes/js/jquery/ui/dialog$suffix.js", array( 'jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-button' ), '1.12.1', 1 ); + $scripts->add( 'jquery-ui-menu', "/wp-includes/js/jquery/ui/menu$suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 ); + $scripts->add( 'jquery-ui-mouse', "/wp-includes/js/jquery/ui/mouse$suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 ); + $scripts->add( 'jquery-ui-progressbar', "/wp-includes/js/jquery/ui/progressbar$suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 ); + $scripts->add( 'jquery-ui-selectmenu', "/wp-includes/js/jquery/ui/selectmenu$suffix.js", array( 'jquery-ui-menu' ), '1.12.1', 1 ); + $scripts->add( 'jquery-ui-slider', "/wp-includes/js/jquery/ui/slider$suffix.js", array( 'jquery-ui-mouse' ), '1.12.1', 1 ); + $scripts->add( 'jquery-ui-spinner', "/wp-includes/js/jquery/ui/spinner$suffix.js", array( 'jquery-ui-button' ), '1.12.1', 1 ); + $scripts->add( 'jquery-ui-tabs', "/wp-includes/js/jquery/ui/tabs$suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 ); + $scripts->add( 'jquery-ui-tooltip', "/wp-includes/js/jquery/ui/tooltip$suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 ); + + // New in 1.12.1 + $scripts->add( 'jquery-ui-checkboxradio', "/wp-includes/js/jquery/ui/checkboxradio$suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 ); + $scripts->add( 'jquery-ui-controlgroup', "/wp-includes/js/jquery/ui/controlgroup$suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 ); + + // Interactions + $scripts->add( 'jquery-ui-draggable', "/wp-includes/js/jquery/ui/draggable$suffix.js", array( 'jquery-ui-mouse' ), '1.12.1', 1 ); + $scripts->add( 'jquery-ui-droppable', "/wp-includes/js/jquery/ui/droppable$suffix.js", array( 'jquery-ui-draggable' ), '1.12.1', 1 ); + $scripts->add( 'jquery-ui-resizable', "/wp-includes/js/jquery/ui/resizable$suffix.js", array( 'jquery-ui-mouse' ), '1.12.1', 1 ); + $scripts->add( 'jquery-ui-selectable', "/wp-includes/js/jquery/ui/selectable$suffix.js", array( 'jquery-ui-mouse' ), '1.12.1', 1 ); + $scripts->add( 'jquery-ui-sortable', "/wp-includes/js/jquery/ui/sortable$suffix.js", array( 'jquery-ui-mouse' ), '1.12.1', 1 ); + + // As of 1.12.1 `jquery-ui-position` and `jquery-ui-widget` are part of `jquery-ui-core`. + // Listed here for back-compat. + $scripts->add( 'jquery-ui-position', false, array( 'jquery-ui-core' ), '1.12.1', 1 ); + $scripts->add( 'jquery-ui-widget', false, array( 'jquery-ui-core' ), '1.12.1', 1 ); // Strings for 'jquery-ui-autocomplete' live region messages. did_action( 'init' ) && $scripts->localize( @@ -779,16 +818,16 @@ ); // Deprecated, not used in core, most functionality is included in jQuery 1.3. - $scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array( 'jquery' ), '4.2.1', 1 ); + $scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array( 'jquery' ), '4.3.0', 1 ); // jQuery plugins. $scripts->add( 'jquery-color', '/wp-includes/js/jquery/jquery.color.min.js', array( 'jquery' ), '2.1.2', 1 ); $scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array( 'jquery' ), '20m', 1 ); $scripts->add( 'jquery-query', '/wp-includes/js/jquery/jquery.query.js', array( 'jquery' ), '2.1.7', 1 ); - $scripts->add( 'jquery-serialize-object', '/wp-includes/js/jquery/jquery.serialize-object.js', array( 'jquery' ), '0.2', 1 ); + $scripts->add( 'jquery-serialize-object', '/wp-includes/js/jquery/jquery.serialize-object.js', array( 'jquery' ), '0.2-wp', 1 ); $scripts->add( 'jquery-hotkeys', "/wp-includes/js/jquery/jquery.hotkeys$suffix.js", array( 'jquery' ), '0.0.2m', 1 ); $scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array( 'jquery', 'jquery-hotkeys' ), false, 1 ); - $scripts->add( 'jquery-touch-punch', '/wp-includes/js/jquery/jquery.ui.touch-punch.js', array( 'jquery-ui-widget', 'jquery-ui-mouse' ), '0.2.2', 1 ); + $scripts->add( 'jquery-touch-punch', '/wp-includes/js/jquery/jquery.ui.touch-punch.js', array( 'jquery-ui-core', 'jquery-ui-mouse' ), '0.2.2', 1 ); // Not used any more, registered for backward compatibility. $scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array( 'jquery' ), '1.1-20110113', 1 ); @@ -797,7 +836,7 @@ // It sets jQuery as a dependency, as the theme may have been implicitly loading it this way. $scripts->add( 'imagesloaded', '/wp-includes/js/imagesloaded.min.js', array(), '4.1.4', 1 ); $scripts->add( 'masonry', '/wp-includes/js/masonry.min.js', array( 'imagesloaded' ), '4.2.2', 1 ); - $scripts->add( 'jquery-masonry', "/wp-includes/js/jquery/jquery.masonry$dev_suffix.js", array( 'jquery', 'masonry' ), '3.1.2b', 1 ); + $scripts->add( 'jquery-masonry', '/wp-includes/js/jquery/jquery.masonry.min.js', array( 'jquery', 'masonry' ), '3.1.2b', 1 ); $scripts->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.js', array( 'jquery' ), '3.1-20121105', 1 ); did_action( 'init' ) && $scripts->localize( @@ -848,6 +887,8 @@ /* translators: %s: File name. */ 'error_uploading' => __( '“%s” has failed to upload.' ), 'unsupported_image' => __( 'This image cannot be displayed in a web browser. For best results convert it to JPEG before uploading.' ), + 'noneditable_image' => __( 'This image cannot be processed by the web server. Convert it to JPEG or PNG before uploading.' ), + 'file_url_copied' => __( 'The file URL has been copied to your clipboard' ), ); $scripts->add( 'moxiejs', "/wp-includes/js/plupload/moxie$suffix.js", array(), '1.3.5' ); @@ -857,7 +898,7 @@ $scripts->add( "plupload-$handle", false, array( 'plupload' ), '2.1.1' ); } - $scripts->add( 'plupload-handlers', "/wp-includes/js/plupload/handlers$suffix.js", array( 'plupload', 'jquery' ) ); + $scripts->add( 'plupload-handlers', "/wp-includes/js/plupload/handlers$suffix.js", array( 'clipboard', 'jquery', 'plupload', 'underscore', 'wp-a11y', 'wp-i18n' ) ); did_action( 'init' ) && $scripts->localize( 'plupload-handlers', 'pluploadL10n', $uploader_l10n ); $scripts->add( 'wp-plupload', "/wp-includes/js/plupload/wp-plupload$suffix.js", array( 'plupload', 'jquery', 'json2', 'media-models' ), false, 1 ); @@ -874,7 +915,7 @@ $scripts->add( 'json2', "/wp-includes/js/json2$suffix.js", array(), '2015-05-03' ); did_action( 'init' ) && $scripts->add_data( 'json2', 'conditional', 'lt IE 8' ); - $scripts->add( 'underscore', "/wp-includes/js/underscore$dev_suffix.js", array(), '1.8.3', 1 ); + $scripts->add( 'underscore', "/wp-includes/js/underscore$dev_suffix.js", array(), '1.13.1', 1 ); $scripts->add( 'backbone', "/wp-includes/js/backbone$dev_suffix.js", array( 'underscore', 'jquery' ), '1.4.0', 1 ); $scripts->add( 'wp-util', "/wp-includes/js/wp-util$suffix.js", array( 'underscore', 'jquery' ), false, 1 ); @@ -894,8 +935,8 @@ $scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array( 'jquery' ), false, 1 ); - $scripts->add( 'mediaelement', false, array( 'jquery', 'mediaelement-core', 'mediaelement-migrate' ), '4.2.13-9993131', 1 ); - $scripts->add( 'mediaelement-core', "/wp-includes/js/mediaelement/mediaelement-and-player$suffix.js", array(), '4.2.13-9993131', 1 ); + $scripts->add( 'mediaelement', false, array( 'jquery', 'mediaelement-core', 'mediaelement-migrate' ), '4.2.16', 1 ); + $scripts->add( 'mediaelement-core', "/wp-includes/js/mediaelement/mediaelement-and-player$suffix.js", array(), '4.2.16', 1 ); $scripts->add( 'mediaelement-migrate', "/wp-includes/js/mediaelement/mediaelement-migrate$suffix.js", array(), false, 1 ); did_action( 'init' ) && $scripts->add_inline_script( @@ -985,7 +1026,7 @@ 'before' ); - $scripts->add( 'mediaelement-vimeo', '/wp-includes/js/mediaelement/renderers/vimeo.min.js', array( 'mediaelement' ), '4.2.13-9993131', 1 ); + $scripts->add( 'mediaelement-vimeo', '/wp-includes/js/mediaelement/renderers/vimeo.min.js', array( 'mediaelement' ), '4.2.16', 1 ); $scripts->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement$suffix.js", array( 'mediaelement' ), false, 1 ); $mejs_settings = array( 'pluginPath' => includes_url( 'js/mediaelement/', 'relative' ), @@ -1042,8 +1083,23 @@ ); $scripts->set_translations( 'password-strength-meter' ); + $scripts->add( 'application-passwords', "/wp-admin/js/application-passwords$suffix.js", array( 'jquery', 'wp-util', 'wp-api-request', 'wp-date', 'wp-i18n', 'wp-hooks' ), false, 1 ); + $scripts->set_translations( 'application-passwords' ); + + $scripts->add( 'auth-app', "/wp-admin/js/auth-app$suffix.js", array( 'jquery', 'wp-api-request', 'wp-i18n', 'wp-hooks' ), false, 1 ); + $scripts->set_translations( 'auth-app' ); + $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter', 'wp-util' ), false, 1 ); $scripts->set_translations( 'user-profile' ); + $user_id = isset( $_GET['user_id'] ) ? (int) $_GET['user_id'] : 0; + did_action( 'init' ) && $scripts->localize( + 'user-profile', + 'userProfileL10n', + array( + 'user_id' => $user_id, + 'nonce' => ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'reset-password-for-' . $user_id ), + ) + ); $scripts->add( 'language-chooser', "/wp-admin/js/language-chooser$suffix.js", array( 'jquery' ), false, 1 ); @@ -1074,7 +1130,7 @@ $scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox', 'shortcode' ), false, 1 ); - $scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array( 'jquery' ), '1.8.1', 1 ); + $scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array( 'jquery' ), '1.10.1', 1 ); // JS-only version of hoverintent (no dependencies). $scripts->add( 'hoverintent-js', '/wp-includes/js/hoverintent-js.min.js', array(), '2.2.1', 1 ); @@ -1255,7 +1311,7 @@ $scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery', 'jquery-ui-core', 'thickbox' ), false, 1 ); $scripts->set_translations( 'plugin-install' ); - $scripts->add( 'site-health', "/wp-admin/js/site-health$suffix.js", array( 'clipboard', 'jquery', 'wp-util', 'wp-a11y' ), false, 1 ); + $scripts->add( 'site-health', "/wp-admin/js/site-health$suffix.js", array( 'clipboard', 'jquery', 'wp-util', 'wp-a11y', 'wp-api-request', 'wp-url', 'wp-i18n', 'wp-hooks' ), false, 1 ); $scripts->set_translations( 'site-health' ); $scripts->add( 'privacy-tools', "/wp-admin/js/privacy-tools$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 ); @@ -1277,7 +1333,8 @@ $scripts->add( 'wp-color-picker', "/wp-admin/js/color-picker$suffix.js", array( 'iris' ), false, 1 ); $scripts->set_translations( 'wp-color-picker' ); - $scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox', 'wp-util', 'wp-a11y' ), false, 1 ); + $scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox', 'wp-util', 'wp-a11y', 'wp-date' ), false, 1 ); + $scripts->set_translations( 'dashboard' ); $scripts->add( 'list-revisions', "/wp-includes/js/wp-list-revisions$suffix.js" ); @@ -1418,7 +1475,7 @@ // External libraries and friends. $styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.8' ); $styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array( 'dashicons' ) ); - $styles->add( 'mediaelement', '/wp-includes/js/mediaelement/mediaelementplayer-legacy.min.css', array(), '4.2.13-9993131' ); + $styles->add( 'mediaelement', '/wp-includes/js/mediaelement/mediaelementplayer-legacy.min.css', array(), '4.2.16' ); $styles->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement$suffix.css", array( 'mediaelement' ) ); $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array( 'dashicons' ) ); $styles->add( 'wp-codemirror', '/wp-includes/js/codemirror/codemirror.min.css', array(), '5.29.1-alpha-ee20357' ); @@ -1430,7 +1487,7 @@ $styles->add( 'colors-fresh', false, array( 'wp-admin', 'buttons' ) ); // Old handle. $styles->add( 'open-sans', $open_sans_font_url ); // No longer used in core as of 4.6. - // Packages styles. + // Noto Serif is no longer used by core, but may be relied upon by themes and plugins. $fonts_url = ''; /* @@ -1442,27 +1499,52 @@ if ( 'off' !== $font_family ) { $fonts_url = 'https://fonts.googleapis.com/css?family=' . urlencode( $font_family ); } - $styles->add( 'wp-editor-font', $fonts_url ); - - $styles->add( 'wp-block-library-theme', "/wp-includes/css/dist/block-library/theme$suffix.css" ); + $styles->add( 'wp-editor-font', $fonts_url ); // No longer used in core as of 5.7. + $block_library_theme_path = WPINC . "/css/dist/block-library/theme$suffix.css"; + $styles->add( 'wp-block-library-theme', "/$block_library_theme_path" ); + $styles->add_data( 'wp-block-library-theme', 'path', ABSPATH . $block_library_theme_path ); + + $styles->add( + 'wp-reset-editor-styles', + "/wp-includes/css/dist/block-library/reset$suffix.css", + array( 'common', 'forms' ) // Make sure the reset is loaded after the default WP Admin styles. + ); + + $styles->add( + 'wp-editor-classic-layout-styles', + "/wp-includes/css/dist/edit-post/classic$suffix.css", + array() + ); + + $wp_edit_blocks_dependencies = array( + 'wp-components', + 'wp-editor', + // This need to be added before the block library styles, + // The block library styles override the "reset" styles. + 'wp-reset-editor-styles', + 'wp-block-library', + 'wp-reusable-blocks', + ); + + // Only load the default layout and margin styles for themes without theme.json file. + if ( ! WP_Theme_JSON_Resolver::theme_has_support() ) { + $wp_edit_blocks_dependencies[] = 'wp-editor-classic-layout-styles'; + } + + global $editor_styles; + if ( ! is_array( $editor_styles ) || count( $editor_styles ) === 0 ) { + // Include opinionated block styles if no $editor_styles are declared, so the editor never appears broken. + $wp_edit_blocks_dependencies[] = 'wp-block-library-theme'; + } $styles->add( 'wp-edit-blocks', "/wp-includes/css/dist/block-library/editor$suffix.css", - array( - 'wp-components', - 'wp-editor', - 'wp-block-library', - // Always include visual styles so the editor never appears broken. - 'wp-block-library-theme', - ) + $wp_edit_blocks_dependencies ); $package_styles = array( - 'block-editor' => array( - 'wp-components', - 'wp-editor-font', - ), + 'block-editor' => array( 'wp-components' ), 'block-library' => array(), 'block-directory' => array(), 'components' => array(), @@ -1478,17 +1560,40 @@ 'wp-components', 'wp-block-editor', 'wp-nux', + 'wp-reusable-blocks', ), 'format-library' => array(), 'list-reusable-blocks' => array( 'wp-components' ), + 'reusable-blocks' => array( 'wp-components' ), 'nux' => array( 'wp-components' ), + 'widgets' => array( + 'wp-components', + ), + 'edit-widgets' => array( + 'wp-widgets', + 'wp-block-editor', + 'wp-edit-blocks', + 'wp-block-library', + 'wp-reusable-blocks', + ), + 'customize-widgets' => array( + 'wp-widgets', + 'wp-block-editor', + 'wp-edit-blocks', + 'wp-block-library', + 'wp-reusable-blocks', + ), ); foreach ( $package_styles as $package => $dependencies ) { $handle = 'wp-' . $package; $path = "/wp-includes/css/dist/$package/style$suffix.css"; + if ( 'block-library' === $package && wp_should_load_separate_core_block_assets() ) { + $path = "/wp-includes/css/dist/$package/common$suffix.css"; + } $styles->add( $handle, $path, $dependencies ); + $styles->add_data( $handle, 'path', ABSPATH . $path ); } // RTL CSS. @@ -1525,17 +1630,23 @@ 'wp-pointer', 'wp-jquery-ui-dialog', // Package styles. + 'wp-reset-editor-styles', + 'wp-editor-classic-layout-styles', 'wp-block-library-theme', 'wp-edit-blocks', 'wp-block-editor', 'wp-block-library', 'wp-block-directory', 'wp-components', + 'wp-customize-widgets', 'wp-edit-post', + 'wp-edit-widgets', 'wp-editor', 'wp-format-library', 'wp-list-reusable-blocks', + 'wp-reusable-blocks', 'wp-nux', + 'wp-widgets', // Deprecated CSS. 'deprecated-media', 'farbtastic', @@ -1713,7 +1824,7 @@ */ if ( $saved_ip_address && $current_ip_address && $current_ip_address !== $saved_ip_address ) { $saved_location['ip'] = $current_ip_address; - update_user_option( $user_id, 'community-events-location', $saved_location, true ); + update_user_meta( $user_id, 'community-events-location', $saved_location ); } $events_client = new WP_Community_Events( $user_id, $saved_location ); @@ -1722,36 +1833,9 @@ 'dashboard', 'communityEventsData', array( - 'nonce' => wp_create_nonce( 'community_events' ), - 'cache' => $events_client->get_cached_events(), - - 'l10n' => array( - 'enter_closest_city' => __( 'Enter your closest city to find nearby events.' ), - 'error_occurred_please_try_again' => __( 'An error occurred. Please try again.' ), - 'attend_event_near_generic' => __( 'Attend an upcoming event near you.' ), - - /* - * These specific examples were chosen to highlight the fact that a - * state is not needed, even for cities whose name is not unique. - * It would be too cumbersome to include that in the instructions - * to the user, so it's left as an implication. - */ - /* - * translators: %s is the name of the city we couldn't locate. - * Replace the examples with cities related to your locale. Test that - * they match the expected location and have upcoming events before - * including them. If no cities related to your locale have events, - * then use cities related to your locale that would be recognizable - * to most users. Use only the city name itself, without any region - * or country. Use the endonym (native locale name) instead of the - * English name if possible. - */ - 'could_not_locate_city' => __( 'We couldn’t locate %s. Please try another nearby city. For example: Kansas City; Springfield; Portland.' ), - - // This one is only used with wp.a11y.speak(), so it can/should be more brief. - /* translators: %s: The name of a city. */ - 'city_updated' => __( 'City updated. Listing events near %s.' ), - ), + 'nonce' => wp_create_nonce( 'community_events' ), + 'cache' => $events_client->get_cached_events(), + 'time_format' => get_option( 'time_format' ), ) ); } @@ -2160,9 +2244,7 @@ * @global WP_Screen $current_screen WordPress current screen object. */ function wp_common_block_scripts_and_styles() { - global $current_screen; - - if ( is_admin() && ( $current_screen instanceof WP_Screen ) && ! $current_screen->is_block_editor() ) { + if ( is_admin() && ! wp_should_load_block_editor_scripts_and_styles() ) { return; } @@ -2186,6 +2268,126 @@ } /** + * Enqueues the global styles defined via theme.json. + * + * @since 5.8.0 + */ +function wp_enqueue_global_styles() { + if ( ! WP_Theme_JSON_Resolver::theme_has_support() ) { + return; + } + + $separate_assets = wp_should_load_separate_core_block_assets(); + + /* + * Global styles should be printed in the head when loading all styles combined. + * The footer should only be used to print global styles for classic themes with separate core assets enabled. + * + * See https://core.trac.wordpress.org/ticket/53494. + */ + if ( ( ! $separate_assets && doing_action( 'wp_footer' ) ) || ( $separate_assets && doing_action( 'wp_enqueue_scripts' ) ) ) { + return; + } + + $can_use_cache = ( + ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) && + ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ) && + ( ! defined( 'REST_REQUEST' ) || ! REST_REQUEST ) && + ! is_admin() + ); + + $stylesheet = null; + if ( $can_use_cache ) { + $cache = get_transient( 'global_styles' ); + if ( $cache ) { + $stylesheet = $cache; + } + } + + if ( null === $stylesheet ) { + $settings = get_default_block_editor_settings(); + $theme_json = WP_Theme_JSON_Resolver::get_merged_data( $settings ); + $stylesheet = $theme_json->get_stylesheet(); + + if ( $can_use_cache ) { + set_transient( 'global_styles', $stylesheet, MINUTE_IN_SECONDS ); + } + } + + if ( empty( $stylesheet ) ) { + return; + } + + wp_register_style( 'global-styles', false, array(), true, true ); + wp_add_inline_style( 'global-styles', $stylesheet ); + wp_enqueue_style( 'global-styles' ); +} + +/** + * Checks if the editor scripts and styles for all registered block types + * should be enqueued on the current screen. + * + * @since 5.6.0 + * + * @return bool Whether scripts and styles should be enqueued. + */ +function wp_should_load_block_editor_scripts_and_styles() { + global $current_screen; + + $is_block_editor_screen = ( $current_screen instanceof WP_Screen ) && $current_screen->is_block_editor(); + + /** + * Filters the flag that decides whether or not block editor scripts and styles + * are going to be enqueued on the current screen. + * + * @since 5.6.0 + * + * @param bool $is_block_editor_screen Current value of the flag. + */ + return apply_filters( 'should_load_block_editor_scripts_and_styles', $is_block_editor_screen ); +} + +/** + * Checks whether separate styles should be loaded for core blocks on-render. + * + * When this function returns true, other functions ensure that core blocks + * only load their assets on-render, and each block loads its own, individual + * assets. Third-party blocks only load their assets when rendered. + * + * When this function returns false, all core block assets are loaded regardless + * of whether they are rendered in a page or not, because they are all part of + * the `block-library/style.css` file. Assets for third-party blocks are always + * enqueued regardless of whether they are rendered or not. + * + * This only affects front end and not the block editor screens. + * + * @see wp_enqueue_registered_block_scripts_and_styles() + * @see register_block_style_handle() + * + * @since 5.8.0 + * + * @return bool Whether separate assets will be loaded. + */ +function wp_should_load_separate_core_block_assets() { + if ( is_admin() || is_feed() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) { + return false; + } + + /** + * Filters whether block styles should be loaded separately. + * + * Returning false loads all core block assets, regardless of whether they are rendered + * in a page or not. Returning true loads core block assets only when they are rendered. + * + * @since 5.8.0 + * + * @param bool $load_separate_assets Whether separate assets will be loaded. + * Default false (all block assets are loaded, even when not used). + */ + return apply_filters( 'should_load_separate_core_block_assets', false ); +} + +/** * Enqueues registered block scripts and styles, depending on current rendered * context (only enqueuing editor scripts while in context of the editor). * @@ -2196,7 +2398,11 @@ function wp_enqueue_registered_block_scripts_and_styles() { global $current_screen; - $is_editor = ( ( $current_screen instanceof WP_Screen ) && $current_screen->is_block_editor() ); + if ( wp_should_load_separate_core_block_assets() ) { + return; + } + + $load_editor_scripts = is_admin() && wp_should_load_block_editor_scripts_and_styles(); $block_registry = WP_Block_Type_Registry::get_instance(); foreach ( $block_registry->get_all_registered() as $block_name => $block_type ) { @@ -2211,12 +2417,12 @@ } // Editor styles. - if ( $is_editor && ! empty( $block_type->editor_style ) ) { + if ( $load_editor_scripts && ! empty( $block_type->editor_style ) ) { wp_enqueue_style( $block_type->editor_style ); } // Editor script. - if ( $is_editor && ! empty( $block_type->editor_script ) ) { + if ( $load_editor_scripts && ! empty( $block_type->editor_script ) ) { wp_enqueue_script( $block_type->editor_script ); } } @@ -2230,13 +2436,39 @@ function enqueue_block_styles_assets() { $block_styles = WP_Block_Styles_Registry::get_instance()->get_all_registered(); - foreach ( $block_styles as $styles ) { + foreach ( $block_styles as $block_name => $styles ) { foreach ( $styles as $style_properties ) { if ( isset( $style_properties['style_handle'] ) ) { - wp_enqueue_style( $style_properties['style_handle'] ); + + // If the site loads separate styles per-block, enqueue the stylesheet on render. + if ( wp_should_load_separate_core_block_assets() ) { + add_filter( + 'render_block', + function( $html, $block ) use ( $style_properties ) { + wp_enqueue_style( $style_properties['style_handle'] ); + return $html; + } + ); + } else { + wp_enqueue_style( $style_properties['style_handle'] ); + } } if ( isset( $style_properties['inline_style'] ) ) { - wp_add_inline_style( 'wp-block-library', $style_properties['inline_style'] ); + + // Default to "wp-block-library". + $handle = 'wp-block-library'; + + // If the site loads separate styles per-block, check if the block has a stylesheet registered. + if ( wp_should_load_separate_core_block_assets() ) { + $block_stylesheet_handle = generate_block_asset_handle( $block_name, 'style' ); + global $wp_styles; + if ( isset( $wp_styles->registered[ $block_stylesheet_handle ] ) ) { + $handle = $block_stylesheet_handle; + } + } + + // Add inline styles to the calculated handle. + wp_add_inline_style( $handle, $style_properties['inline_style'] ); } } } @@ -2253,15 +2485,17 @@ $register_script_lines = array( '( function() {' ); foreach ( $block_styles as $block_name => $styles ) { foreach ( $styles as $style_properties ) { + $block_style = array( + 'name' => $style_properties['name'], + 'label' => $style_properties['label'], + ); + if ( isset( $style_properties['is_default'] ) ) { + $block_style['isDefault'] = $style_properties['is_default']; + } $register_script_lines[] = sprintf( ' wp.blocks.registerBlockStyle( \'%s\', %s );', $block_name, - wp_json_encode( - array( - 'name' => $style_properties['name'], - 'label' => $style_properties['label'], - ) - ) + wp_json_encode( $block_style ) ); } } @@ -2282,3 +2516,278 @@ wp_enqueue_script( 'wp-block-directory' ); wp_enqueue_style( 'wp-block-directory' ); } + +/** + * Enqueues the assets required for the format library within the block editor. + * + * @since 5.8.0 + */ +function wp_enqueue_editor_format_library_assets() { + wp_enqueue_script( 'wp-format-library' ); + wp_enqueue_style( 'wp-format-library' ); +} + +/** + * Sanitizes an attributes array into an attributes string to be placed inside a `\n", wp_sanitize_script_attributes( $attributes ) ); +} + +/** + * Prints formatted `\n", wp_sanitize_script_attributes( $attributes ), $javascript ); +} + +/** + * Prints inline JavaScript wrapped in `"; +}