Commit Graph

584 Commits

Author SHA1 Message Date
gziolo
c704057e0d Add fields to WP_Block_Type
As part of #47620 and the RFC for block registeration. Server registered blocks are missing some fields. These changeset includes them.

Props spacedmonkey, aduth.

Fixes #48529.


Built from https://develop.svn.wordpress.org/trunk@47875


git-svn-id: http://core.svn.wordpress.org/trunk@47649 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-01 12:27:08 +00:00
Sergey Biryukov
7932193708 Coding Standards: Use strict comparison where static strings are involved.
This reduces the number of `WordPress.PHP.StrictComparisons.LooseComparison` issues in half, from 1897 to 890.

Includes minor code layout fixes for better readability.

See #49542.
Built from https://develop.svn.wordpress.org/trunk@47808


git-svn-id: http://core.svn.wordpress.org/trunk@47584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-16 18:42:12 +00:00
Sergey Biryukov
856e1a27b8 Coding Standards: Use strict type check for in_array() and array_search().
This addresses all the remaining `WordPress.PHP.StrictInArray.MissingTrueStrict` issues in core.

Includes minor code layout fixes for better readability.

Follow-up to [47550].

See #49542.
Built from https://develop.svn.wordpress.org/trunk@47557


git-svn-id: http://core.svn.wordpress.org/trunk@47332 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-09 15:43:10 +00:00
Sergey Biryukov
38676936ba Coding Standards: Use strict type check for in_array() and array_search() where strings are involved.
This reduces the number of `WordPress.PHP.StrictInArray.MissingTrueStrict` issues from 486 to 50.

Includes minor code layout fixes for better readability.

See #49542.
Built from https://develop.svn.wordpress.org/trunk@47550


git-svn-id: http://core.svn.wordpress.org/trunk@47325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-05 03:02:11 +00:00
John Blackbourn
da52485cf1 Editor: Revert a fix for incorrect usage of ID attributes on custom fields.
This reverts [47222] due to compatibility issues with plugins which are using the `#poststuff` selector.

See #46964
Built from https://develop.svn.wordpress.org/trunk@47410


git-svn-id: http://core.svn.wordpress.org/trunk@47197 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-03-03 00:37:06 +00:00
John Blackbourn
251d77e1a1 Docs: Miscellaneous docs fixes and improvements.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@47398


git-svn-id: http://core.svn.wordpress.org/trunk@47185 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-03-01 10:40:07 +00:00
John Blackbourn
056dad9c2c Docs: Use more specific types in parameter descriptions in place of mixed.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@47397


git-svn-id: http://core.svn.wordpress.org/trunk@47184 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-03-01 10:38:07 +00:00
Sergey Biryukov
3a333ef030 Coding Standards: Use strict comparison for normalize_whitespace() checks when comparing revisions or autosaves.
Props dkarfa, itowhid06, TimothyBlynJacobs.
Fixes #47965.
Built from https://develop.svn.wordpress.org/trunk@47372


git-svn-id: http://core.svn.wordpress.org/trunk@47159 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-25 19:35:09 +00:00
joedolson
61ce35440c Editor: Fix incorrect usage of ID attributes on custom fields.
Repeated containers used for custom fields have duplicate ID attributes. Duplicate IDs are incorrect HTML, and will also cause unexpected results when trying to manipulate using JS. Duplicate IDs are changed to matching classes; CSS & JS updated to match. 

Props jankimoradiya, audrasjb, donmhico, afercia.
Fixes #46964.

Built from https://develop.svn.wordpress.org/trunk@47222


git-svn-id: http://core.svn.wordpress.org/trunk@47022 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-09 19:41:07 +00:00
Sergey Biryukov
641c632b0c Coding Standards: Use Yoda conditions where appropriate.
See #49222.
Built from https://develop.svn.wordpress.org/trunk@47219


git-svn-id: http://core.svn.wordpress.org/trunk@47019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-09 16:55:09 +00:00
John Blackbourn
1f1fd617f5 Posts, Post Types: Add a parameter to the post_locked_dialog action which contains a reference to the user who holds the lock.
Fixes #48443
Built from https://develop.svn.wordpress.org/trunk@47206


git-svn-id: http://core.svn.wordpress.org/trunk@47006 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-07 17:53:06 +00:00
Sergey Biryukov
9ed35cf902 Posts, Post Types: Change "Featured Image" post label to use sentence case: "Featured image".
This makes it more consistent with other UI elements in the block editor.

Props mcsf.
Fixes #49371.
Built from https://develop.svn.wordpress.org/trunk@47194


git-svn-id: http://core.svn.wordpress.org/trunk@46994 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-05 19:09:05 +00:00
Sergey Biryukov
037a736757 Docs: Improve comments in some wp-admin files per the documentation standards.
Follow-up to [47084].

Props passoniate, apedog.
Fixes #49223, #49227.
Built from https://develop.svn.wordpress.org/trunk@47119


git-svn-id: http://core.svn.wordpress.org/trunk@46919 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-29 00:35:08 +00:00
John Blackbourn
d53103ed62 Docs: Further docblock corrections and improvements.
See #48303
Built from https://develop.svn.wordpress.org/trunk@46826


git-svn-id: http://core.svn.wordpress.org/trunk@46626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-07 13:23:01 +00:00
John Blackbourn
f93ee2ca76 Docs: Increase the specificity of various docblock parameter types and return types.
See #48303
Built from https://develop.svn.wordpress.org/trunk@46823


git-svn-id: http://core.svn.wordpress.org/trunk@46623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-06 22:43:04 +00:00
Sergey Biryukov
4ec53dc54c Docs: Remove incorrect @return tags.
Props diddledan.
Fixes #48613, #48614.
Built from https://develop.svn.wordpress.org/trunk@46732


git-svn-id: http://core.svn.wordpress.org/trunk@46532 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-14 09:57:03 +00:00
John Blackbourn
eda6a9e111 Docs: Docs on docs. Further improve documentation of known return types, plus other docs fixes.
See #48303

Built from https://develop.svn.wordpress.org/trunk@46662


git-svn-id: http://core.svn.wordpress.org/trunk@46462 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-05 21:30:03 +00:00
John Blackbourn
d1b23193dd Docs: Correct some incorrect docblock tags.
See #48303

Built from https://develop.svn.wordpress.org/trunk@46623


git-svn-id: http://core.svn.wordpress.org/trunk@46420 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-31 17:51:01 +00:00
John Blackbourn
3caaa40fc6 Docs: Switch more docs over to typed array notation, plus some fixes.
See #48303, #41756

Built from https://develop.svn.wordpress.org/trunk@46596


git-svn-id: http://core.svn.wordpress.org/trunk@46393 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-26 21:09:04 +00:00
John Blackbourn
7c2b9f2a2e Docs: Miscellaneous docblock fixes and improvements.
See #48303

Built from https://develop.svn.wordpress.org/trunk@46594


git-svn-id: http://core.svn.wordpress.org/trunk@46391 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-26 20:43:04 +00:00
desrosj
abed60bb51 Editor: Add missing block data fields for blocks registered server side.
In [44122], the `styles` and `parent` block fields were omitted on accident. This change makes it possible to reuse them on the client.

Props gziolo.
Fixes #47017.
Built from https://develop.svn.wordpress.org/trunk@46091


git-svn-id: http://core.svn.wordpress.org/trunk@45903 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-11 14:52:56 +00:00
Sergey Biryukov
e199663322 I18N: Capitalize translator comments consistently, add trailing punctuation.
Includes minor code layout fixes.

See #44360.
Built from https://develop.svn.wordpress.org/trunk@45932


git-svn-id: http://core.svn.wordpress.org/trunk@45743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-03 00:41:05 +00:00
Sergey Biryukov
c26f1c5d90 Taxonomy: Fix deprecated calls to get_terms().
The taxonomy should be passed as part of `$args`, rather than as its own argument.

Props sgastard, mukesh27, SergeyBiryukov.
Fixes #47819.
Built from https://develop.svn.wordpress.org/trunk@45723


git-svn-id: http://core.svn.wordpress.org/trunk@45534 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-03 03:35:56 +00:00
Gary Pendergast
cf3fa9f7c8 Coding Standards: Fix the Squiz.PHP.DisallowMultipleAssignments violations in wp-admin.
See #47632.


Built from https://develop.svn.wordpress.org/trunk@45583


git-svn-id: http://core.svn.wordpress.org/trunk@45394 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-01 12:52:01 +00:00
Sergey Biryukov
c77e771c84 Date/Time: Replace all instances of date() with gmdate().
Use of `date()` in core depends on PHP timezone set to UTC and not changed by third party code (which cannot be guaranteed).

`gmdate()` is functionally equivalent, but is not affected by PHP timezone setting: it's always UTC, which is the exact behavior the core needs.

Props nielsdeblaauw, Rarst.
Fixes #46438. See #44491.
Built from https://develop.svn.wordpress.org/trunk@45424


git-svn-id: http://core.svn.wordpress.org/trunk@45235 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-05-26 00:12:54 +00:00
Adam Silverstein
8e9315f51e Media: move get_available_post_mime_types to wp-includes/post.php making it more generally available.
Address an issue since r44947 where calling `wp_enqueue_media` on the front-end would result in a PHP fatal.

Props david.binda.
Fixes #46795.

Built from https://develop.svn.wordpress.org/trunk@45219


git-svn-id: http://core.svn.wordpress.org/trunk@45028 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-16 20:30:51 +00:00
Sergey Biryukov
733ec3da48 Docs: Improve documentation for postbox_classes().
Rename `$page` and `$id` variables to `$screen_id` and `$box_id` for clarity.

Props sharifkiberu, DrewAPicture.
Fixes #45179.
Built from https://develop.svn.wordpress.org/trunk@45083


git-svn-id: http://core.svn.wordpress.org/trunk@44892 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-01 12:47:51 +00:00
desrosj
899e7d3800 Posts, Post Types: Add type parameter to post_exists().
This allows post exists checks scoped to a specific post type.

Props sgarza, birgire, swissspidy.
Fixes #37406.
Built from https://develop.svn.wordpress.org/trunk@44959


git-svn-id: http://core.svn.wordpress.org/trunk@44790 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-21 12:44:54 +00:00
Dominik Schilling
c32bc04fdc Meta Boxes: Use a unique name for the nonce of the meta box loader.
Fixes a case where saving in the block editor fails if there are two `_wpnonce` arguments in the request, one overriding the other so that `use_block_editor_for_post()` wasn't able to check the nonce properly.

Props Chouby.
See #45253.
Built from https://develop.svn.wordpress.org/trunk@44938


git-svn-id: http://core.svn.wordpress.org/trunk@44769 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-20 08:12:51 +00:00
Sergey Biryukov
e992ae3ea2 Post Formats: Prevent Bulk Edit from unintentionally changing post format to Standard even if set to "No change".
Correct the logic in [41187].

Props birgire, mukesh27, lanche86.
Fixes #44914. See #41396.
Built from https://develop.svn.wordpress.org/trunk@44670


git-svn-id: http://core.svn.wordpress.org/trunk@44501 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-21 18:05:50 +00:00
Gary Pendergast
7a617078fa Coding Standards: Upgrade WPCS to 1.2.1.
This upgrade fixes quite a few false positives, as well as auto-fixing some indenting issues.

Fixes #45956.


Built from https://develop.svn.wordpress.org/trunk@44574


git-svn-id: http://core.svn.wordpress.org/trunk@44405 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-12 06:41:52 +00:00
desrosj
ca36ed433b Docs: Correct since annotation for _wp_get_allowed_postdata().
This function was introduced in 5.0.1, not 4.9.9 as currently indicated. Introduced in [44047].
Built from https://develop.svn.wordpress.org/trunk@44540


git-svn-id: http://core.svn.wordpress.org/trunk@44371 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-10 03:31:49 +00:00
Boone Gorges
811be4779e Taxonomy: Update @since annotations for meta_box_sanitize_cb arg.
Introduced in [42211].

Fixes #36514.
Built from https://develop.svn.wordpress.org/trunk@44519


git-svn-id: http://core.svn.wordpress.org/trunk@44350 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-09 15:11:48 +00:00
Sergey Biryukov
b7ddbe94e7 Taxonomy: Fix typo in taxonomy_meta_box_sanitize_cb_checkboxes() argument name.
Props itowhid06.
Fixes #45756.
Built from https://develop.svn.wordpress.org/trunk@44367


git-svn-id: http://core.svn.wordpress.org/trunk@44197 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-28 18:04:50 +00:00
desrosj
921fd01582 Posts, Post Types: Correctly show hierarchical post type hierarchy in admin.
In [44185], a bug was introduced where hierarchical post types would not display in the correct default order (hierarchically).

This was caused by a `! isset()` check, which returned `false` after [44185], causing the correct default value to not be applied. This switches that conditional to use an `empty()` check, ignoring the new empty string assignment that was added to prevent a PHP notice when `compact()` is called.

Props davidbinda.
Fixes #45711.
Built from https://develop.svn.wordpress.org/trunk@44338


git-svn-id: http://core.svn.wordpress.org/trunk@44168 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-19 22:23:50 +00:00
desrosj
1a4d511696 Block Editor: Remove a deprecated notice being generated by the meta box compat functions.
Props pento.

Merges [44248] into trunk.

Fixes #45456.
Built from https://develop.svn.wordpress.org/trunk@44315


git-svn-id: http://core.svn.wordpress.org/trunk@44145 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-19 03:32:18 +00:00
desrosj
5a30da57c6 PHP 7.3 Compatibility: Fix compact related notices.
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. This fixes a few more instances of unset variables in the WordPress admin.

The full RFC can be viewed here: https://wiki.php.net/rfc/compact.

See #44416.

Merges [44185] into trunk.

Fixes #45483.
Built from https://develop.svn.wordpress.org/trunk@44297


git-svn-id: http://core.svn.wordpress.org/trunk@44127 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-19 03:17:37 +00:00
desrosj
43bdb0e193 Editor: Remove unwanted fields before saving posts.
The meta_input, file, and guid fields are not intended to be updated through user input.

Merges [44047] to trunk.
Built from https://develop.svn.wordpress.org/trunk@44295


git-svn-id: http://core.svn.wordpress.org/trunk@44125 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-18 21:32:48 +00:00
desrosj
7a97c31f4e Block Editor: Add a placeholder for meta boxes that don't work in the block editor.
If a meta box is registered with the `__block_editor_compatible_meta_box` set to `false`, it's indicating that it doesn't work in the block editor. If that's the case, we can add a place holder to inform the user that they'll need to use the classic interface to work with this meta box.

Props pento, jorgefilipecosta, peterwilsoncc, karmatosed, noisysocks, dd32, ocean90.

Merges [43941] and [43945] to trunk.

Fixes #45217.
Built from https://develop.svn.wordpress.org/trunk@44280


git-svn-id: http://core.svn.wordpress.org/trunk@44110 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-17 21:52:53 +00:00
desrosj
bbe9a37b6c Editor: Add custom fields meta box support in the block editor.
This brings support for the custom fields meta box into the new block editor.

The `webpack` and `copy-webpack-plugin` packages have also been updated.

This does not bump the `@wordpress` packages like in [43861] because of conflicts with package versions already installed in `trunk`. The packages will be brought up to date in a subsequent merge.

Merges [43861] and [43863] into trunk.

See #45145.
Fixes #45257.
Built from https://develop.svn.wordpress.org/trunk@44260


git-svn-id: http://core.svn.wordpress.org/trunk@44090 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-17 03:52:51 +00:00
Sergey Biryukov
223eb21b47 PHPCS: Fix errors introduced in [44241].
See #45283.
Built from https://develop.svn.wordpress.org/trunk@44243


git-svn-id: http://core.svn.wordpress.org/trunk@44073 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-17 03:20:29 +00:00
Sergey Biryukov
659ca2bd1e Tests: Fix tests broken in PHP 5.x after [43879].
Props pento.
Merges [43883] to trunk.
See #45290.
Built from https://develop.svn.wordpress.org/trunk@44242


git-svn-id: http://core.svn.wordpress.org/trunk@44072 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-17 03:19:38 +00:00
Sergey Biryukov
7f8d6eccd0 Meta Boxes: Add the block_editor_meta_box_hidden_fields action.
Lacking an appropriate action in the classic editor, plugins that add meta boxes have historically hooked into various actions in order to add hidden input fields.

This change also adds backwards compatibility for two of the most common: `edit_form_after_title`, and `edit_form_advanced`.

Props pento, danielbachhuber.
Merges [43882] to trunk.
Fixes #45283.
Built from https://develop.svn.wordpress.org/trunk@44241


git-svn-id: http://core.svn.wordpress.org/trunk@44071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-17 03:18:47 +00:00
Sergey Biryukov
eccc31aadf Block Editor: Prevent the meta box form from being accidentally submitted.
Meta boxes are loaded inside a wrapper form, that the block editor submits as part of the saving process. It shouldn't be submitted manually.

Props pento.
Merges [43880] to trunk.
Fixes #45284.
Built from https://develop.svn.wordpress.org/trunk@44240


git-svn-id: http://core.svn.wordpress.org/trunk@44070 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-17 03:17:56 +00:00
Jeremy Felt
7ffb7340f5 Editor: Cast the result of the default_content, default_title, and default_excerpt filters.
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.

Merges [43858] from the 5.0 branch to trunk.

Props dd32.
See #45236.

Built from https://develop.svn.wordpress.org/trunk@44224


git-svn-id: http://core.svn.wordpress.org/trunk@44054 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-17 03:04:29 +00:00
Jeremy Felt
c92118203b Block Editor: Don't show back compat or incompatible meta boxes in Options.
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.

Merges [43856] from the 5.0 branch to trunk.

Props noisysocks.
Fixes #45249.

Built from https://develop.svn.wordpress.org/trunk@44222


git-svn-id: http://core.svn.wordpress.org/trunk@44052 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-17 03:02:46 +00:00
atimmer
a603510b73 Build Tools: Upgrade @wordpress packages to the latest version.
This also includes the new @wordpress/format-library and @wordpress/notices packages.

package-lock.json has been completely regenerated in this commit.

Props pento.
Merges [43840] to trunk.
See #45145.

Built from https://develop.svn.wordpress.org/trunk@44177


git-svn-id: http://core.svn.wordpress.org/trunk@44007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-14 10:55:01 +00:00
desrosj
dd7e2243fa Meta: Allow empty strings to be set by Custom Fields meta box.
Because the REST API allows meta keys to have empty values, the Custom Fields meta box should permit the same behavior.

Props charlestonsw, soulseekah, danielbachhuber.

Merges [43811] to trunk.

Fixes #43559.
Built from https://develop.svn.wordpress.org/trunk@44153


git-svn-id: http://core.svn.wordpress.org/trunk@43983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-14 03:17:38 +00:00
Jeremy Felt
fe31e0adc5 Meta Boxes: Sync checks for valid meta boxes from do_meta_boxes() to the_block_editor_meta_boxes().
Merges [43792] from the 5.0 branch to trunk.

Props ocean90.
See #45112.

Built from https://develop.svn.wordpress.org/trunk@44141


git-svn-id: http://core.svn.wordpress.org/trunk@43971 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-14 01:56:17 +00:00
Gary Pendergast
a119d4561e Block Editor: Add helper functions to collect meta box information.
To allow the block editor to render meta boxes, it needs to collect information about how those meta boxes are registered, and format it for the block editor to make use of.

Merges [43778] from the 5.0 branch to trunk.

See #45112.


Built from https://develop.svn.wordpress.org/trunk@44131


git-svn-id: http://core.svn.wordpress.org/trunk@43961 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-14 01:11:37 +00:00