- Fix parsing of the init array in script-loader.
- Do not JSON encode the options object when outputting it from PHP.
- Remove JSON decoding of TinyMCE's `style_formats` option.
Fixes#45221.
git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43867 602fd350-edb4-49c9-b593-d223f7449a82
This was causing the custom meta box to be incorrectly added to post types that don't support it.
Props ocean90, epointal.
Fixes#45257,
git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43863 602fd350-edb4-49c9-b593-d223f7449a82
This brings support for the custom fields meta box to the block editor.
The `webpack` and `copy-webpack-plugin` packages have also been updated.
See #45145.
Fixes#45257.
git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43861 602fd350-edb4-49c9-b593-d223f7449a82
Improves upon [43825] by adding unit tests to cover additional use-cases and changes loading translations to only occur when outputting the script to allow setting translations on dependencies.
Props atimmer, omarreiss, nerrad, swissspidy, ocean90.
Fixes#45103.
git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43859 602fd350-edb4-49c9-b593-d223f7449a82
If a plugin returns a non-string value (or returns `null`) on these filters, it can cause errors in the block editor. Casting them as a string prevents these errors.
Props dd32.
See #45236.
git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43858 602fd350-edb4-49c9-b593-d223f7449a82
Meta boxes that exist for back compat, or that are incompatible with the block editor aren't displayed, so they don't need an option to display or hide them in the Options dialog.
Props noisysocks.
Fixes#45249.
git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43856 602fd350-edb4-49c9-b593-d223f7449a82
This is a followup to [43728], which added the same check, but using the `publicly_queryable` option. This behaviour is incorrect for `_builtin` post types, which go by the logic in `is_post_type_viewable()`, instead.
See #43278.
git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43855 602fd350-edb4-49c9-b593-d223f7449a82
Ensures `wp_read_video_metadata()`/`wp_read_audio_metadata()` functions are available when uploading video and audio. Fixes error introduced in [43589].
Props ocean90.
See #43757.
git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43850 602fd350-edb4-49c9-b593-d223f7449a82
- `ftp_base::glob()` used `each()`, which is deprecated as of PHP 7.2.
- `ftp_base::fget()` was missing the decleration of its third parameter, `$rest`.
Props itowhid06.
See #44489.
git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43848 602fd350-edb4-49c9-b593-d223f7449a82
`is_user_logged_in()` is a pluggable function, and loaded after plugins are loaded. If a plugin calls `__()` too early, `is_user_logged_in()` is missing and WordPress will fatal. `get_user_locale()` already handles this scenario for us, so it's safe to rely on exclusively.
See #44758.
Fixes#45235.
git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43846 602fd350-edb4-49c9-b593-d223f7449a82
This also includes the new `@wordpress/format-library` and `@wordpress/notices` packages.
`package-lock.json` has been completely regenerated in this commit.
See #45145.
git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43840 602fd350-edb4-49c9-b593-d223f7449a82
We should only be showing this message in the classic editor interface, for meta boxes that are marked as being incompatible with the block editor.
Fixes#45207.
git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43839 602fd350-edb4-49c9-b593-d223f7449a82
While the documentation for `add_meta_box()` specifices that `$callback_args` should be an array, this has never been enforced, and we have workarounds in place for when it's passed as something other than an array.
Rather than break sites that are passing unexpected data, we can quietly just allow for it, instead.
Props johnjamesjacoby, birgire.
Fixes#45206.
git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43838 602fd350-edb4-49c9-b593-d223f7449a82
The block editor needs to duplicate the classic meta box behaviour, so it can extract the registered meta boxes, and import them into the block editor.
To match the classic editor behaviour as closely as possible, this moves the relevant code from the classic editor, into a new function, so it can be called by both.
Props pento, peterwilsoncc.
Fixes#45172.
git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43837 602fd350-edb4-49c9-b593-d223f7449a82
Rather than needing to install grunt globally, this allows running grunt from `node_modules`, instead.
`npm run grunt ...` is effectively the equivalent of running `grunt ...`.
Props andrew.taylor.
See #45214.
git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43836 602fd350-edb4-49c9-b593-d223f7449a82
Grabbing the packages directly from the Gutenberg repo was an interesting experiment, but it causes significant workflow issues, particular for folks using Windows.
See #45145.
git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43835 602fd350-edb4-49c9-b593-d223f7449a82
The `get_compact_response_links()` method was introduced in WP 4.5, and this conditional is no longer necessary.
Props schlessera, timothyblynjacobs.
Fixes#45189.
git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43834 602fd350-edb4-49c9-b593-d223f7449a82
Also introduces a `block_editor_preload_paths` filter for plugins and themes to preload additional data.
Props imath, mattheu.
Fixes#45194.
git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43833 602fd350-edb4-49c9-b593-d223f7449a82
In PHP 7.3, the compact() function has been changed to issue an E_NOTICE level error if a passed string refers to an unset variable. In previous versions of PHP, this notice was silently skipped. The full RFC can be viewed here: https://wiki.php.net/rfc/compact
By initializing these variables, they can be compacted.
Previously [43819].
See #44416.
Props desrosj.
git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43832 602fd350-edb4-49c9-b593-d223f7449a82
When `WP_DEBUG` is set, ensure that a static method callback is passed to `ReflectionMethod`, instead of `ReflectionFunction`.
Props DrewAPicture.
Fixes#45192.
git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43830 602fd350-edb4-49c9-b593-d223f7449a82
Label elements should only be used for labelable elements.
- `Uploaded By` and `Uploaded To` aren't form controls and shouldn't be associated with labels
- changes the labels for media source, alternate sources, poster image, and tracks to solve a layout issue and explicitly associate the labels to their form fields (previously, the labels were wrapping also the Remove buttons)
Merges [42444] to the 5.0 branch.
Props Presskopp, afercia.
Fixes#38759, #40468.
git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43829 602fd350-edb4-49c9-b593-d223f7449a82
Adds the `wp_set_script_translations` function which registers translations for a JavaScript file. This function takes a handle, domain and optionally a path and ensures JavaScript translation files are loaded if they exist.
Props atimmer, omarreiss, nerrad, swissspidy, ocean90.
Fixes#45103.
git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43825 602fd350-edb4-49c9-b593-d223f7449a82
Instead of requiring the packages individually this commit changes it so the packages are used from the packages repository (gutenberg). This is a solution that makes updating the packages easier, as long as we don't have a monorepo to manage both WordPress & the JavaScript packages together.
Props youknowriad, gziolo, omarreiss, herregroen.
See #45145.
git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43824 602fd350-edb4-49c9-b593-d223f7449a82
In PHP 7.3, the compact() function has been changed to issue an E_NOTICE level error if a passed string refers to an unset variable. In previous versions of PHP, this notice was silently skipped. The full RFC can be viewed here: https://wiki.php.net/rfc/compact
This fixes all unit tested code that uses compact.
Props desrosj.
Fixes#44416.
git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43819 602fd350-edb4-49c9-b593-d223f7449a82