Commit Graph

3309 Commits

Author SHA1 Message Date
Sergey Biryukov 197d99a589 Twenty Twenty: Rename widget areas to `sidebar-1` and `sidebar-2`.
This ensures that widgets are mapped correctly and is consistent with the previous default themes.

See https://github.com/WordPress/twentytwenty/issues/481.

Reverts [46282].

Props ocean90, garrett-eclipse, desrosj, SergeyBiryukov.
See #48110.

git-svn-id: https://develop.svn.wordpress.org/trunk@46283 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 23:16:59 +00:00
Sergey Biryukov bb41a65acd Tests: Correct sidebar names for Twenty Twenty.
See #48110.

git-svn-id: https://develop.svn.wordpress.org/trunk@46282 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 22:03:53 +00:00
Sergey Biryukov 4b6a9f92ca REST API: Use delta comparison for floating date tests added in [46252] to avoid race conditions.
See #39953.

git-svn-id: https://develop.svn.wordpress.org/trunk@46280 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 21:17:04 +00:00
K. Adam White b7f36f7f56 Posts, Post Types: Build list of "date floating" post stati dynamically when inserting post.
Completes work begun in #39953 to expose "date floating" status information to frontend clients via the REST API.

Props TimothyBlynJacobs.
Fixes #48113.


git-svn-id: https://develop.svn.wordpress.org/trunk@46279 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 21:01:16 +00:00
Jonathan Desrosiers 0f1636c621 Bundled Themes: Make Twenty Twenty the new default theme.
After being imported in [46271], Twenty Twenty can now be set as the default theme in WordPress.

See #48110.
Props desrosj, ocean90.

git-svn-id: https://develop.svn.wordpress.org/trunk@46278 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 20:59:48 +00:00
K. Adam White 49155e679c REST API: Introduce WP_Post_Type::get_rest_controller() caching method to prevent unnecessary REST controller construction.
Cache REST controller references on their associated post type object to prevent unnecessary controller re-instantiation, which previously caused "rest_prepare_{$post_type}" and "rest_{$post_type}_query" to run twice per request.

Props TimothyBlynJacobs, patrelentlesstechnologycom.
Fixes #45677.


git-svn-id: https://develop.svn.wordpress.org/trunk@46272 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 20:24:59 +00:00
Sergey Biryukov f29fdab426 Coding Standards: Fix WPCS issue in [46262].
See #47952.

git-svn-id: https://develop.svn.wordpress.org/trunk@46266 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 19:28:43 +00:00
Sergey Biryukov 06868d4d12 Privacy: Introduce `wp_privacy_personal_data_email_to` and `wp_privacy_personal_data_email_subject` filters.
Pass email data to the `wp_privacy_personal_data_email_content` filter.

Props garrett-eclipse, thakkarhardik, birgire.
Fixes #46303.

git-svn-id: https://develop.svn.wordpress.org/trunk@46265 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 19:24:20 +00:00
John Blackbourn f3a268f58c Build/Test tools: Ensure the `create_and_get()` factory method returns the appropriate WP_Error when creating a term fails.
Fixes: #47952 


git-svn-id: https://develop.svn.wordpress.org/trunk@46262 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 18:54:16 +00:00
Andrea Fercia 5863bd30a0 Fix PHP coding standards after [46251].
git-svn-id: https://develop.svn.wordpress.org/trunk@46259 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 18:11:15 +00:00
K. Adam White 42e5e4d5d5 REST API: Introduce date_floating property on status endpoint response objects.
Expose a date_floating property on all status objects to permit clients (including the block editor) to make correct decisions about date handling for posts of varying status.

Props mnelson4, earnjam, kadamwhite, jnylen0, nerrad, pento.
See #39953.



git-svn-id: https://develop.svn.wordpress.org/trunk@46252 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 17:39:36 +00:00
John James Jacoby f2b03e208a Multisite/Sites: Add links to filter websites by status.
This commit brings the Network-Admin Sites list page up-to-speed with other similar list-table powered pages, by adding links to filter the results by Site Status.

Includes a single unit test for the newly introduced `wp_count_sites()` multisite function, named to match the `wp_count_` function pattern from other list tables.

Fixes #37392. Props mnelson4, spacedmonkey, pbiron.



git-svn-id: https://develop.svn.wordpress.org/trunk@46251 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 17:34:20 +00:00
K. Adam White 27a5302e7d REST API: Pass "null" as the post date property to reset post to initial "floating" date value.
Props TimothyBlynJacobs, adamsilverstein, jnylen0, mnelson4.
Fixes #44975.



git-svn-id: https://develop.svn.wordpress.org/trunk@46249 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 17:24:58 +00:00
Peter Wilson 123c17536f KSES: Add support for modern layout techniques in `style` attribute.
Adds support for `flex`, `grid` and `column` layout techniques to the list of CSS attributes considered safe for inline CSS. The `\` character and CSS functions, eg `minmax()` are not yet supported.

Extends support of `border` properties to include `border-radius` and individual `background` properties to include all those implicitly supported by the shorthand attribute.

Props mrahmadawais, marybaum, birgire, peterwilsoncc, azaozz.
Fixes #37248.
See #47367.


git-svn-id: https://develop.svn.wordpress.org/trunk@46235 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-22 22:16:19 +00:00
Sergey Biryukov 4d6ca5bfe5 Tests: Correct assertion in `test_wp_validate_boolean()` to make sure the return type is properly tested.
Props jrf.
Fixes #39868.

git-svn-id: https://develop.svn.wordpress.org/trunk@46224 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-21 10:28:53 +00:00
Sergey Biryukov 0bd3d78db1 Tests: Remove a workaround for `str_getcsv()`.
The `str_getcsv()` function was introduced in PHP 5.3.0, so no longer needs a polyfill.

Props jrf.
Fixes #48074.

git-svn-id: https://develop.svn.wordpress.org/trunk@46222 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-20 22:43:50 +00:00
Sergey Biryukov 5f0fb23a3b Tests: Remove a workaround for `get_called_class()`.
The `get_called_class()` function was introduced in PHP 5.3, so no longer needs a workaround.

Mark `WP_UnitTestCase_Base::get_called_class()` as deprecated. Leave it in place for now as plugins or themes using the WP unit test framework might still call this method.

Props jrf.
See #48074.

git-svn-id: https://develop.svn.wordpress.org/trunk@46221 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-20 22:39:23 +00:00
Sergey Biryukov 3a49864e41 Tests: Remove a test for `rest_preload_api_request()` only relevant for PHP 5.2.
Props dkarfa.
See #48074.

git-svn-id: https://develop.svn.wordpress.org/trunk@46219 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-20 22:26:18 +00:00
Sergey Biryukov 9fd60c9e57 Docs: Update a comment about `pcre.backtrack_limit` upper limit in `benchmark_pcre_backtracking()`.
See #48074.

git-svn-id: https://develop.svn.wordpress.org/trunk@46215 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-20 22:06:40 +00:00
Sergey Biryukov 099adc0243 Code Modernization: Remove all code using a `version_compare()` with a PHP version older than PHP 5.6.
Props jrf.
Fixes #48074.

git-svn-id: https://develop.svn.wordpress.org/trunk@46214 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-20 22:01:36 +00:00
Sergey Biryukov 92d70ed696 Tests: Replace "blog" reference in a comment about `DISABLE_WP_CRON` usage with "site".
Props davidbaumwald.
Fixes #48089.

git-svn-id: https://develop.svn.wordpress.org/trunk@46213 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-20 21:58:42 +00:00
Sergey Biryukov 6922b15e3a Privacy: Display group items count in the personal data export file if there's more than one item in the group.
Props birgire, garrett-eclipse, pputzer.
Fixes #46895.

git-svn-id: https://develop.svn.wordpress.org/trunk@46209 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-20 20:29:30 +00:00
Jonathan Desrosiers f6b8632508 Code Modernization: Remove JSON extension workarounds for PHP < 5.6.
The PHP native JSON extension has been bundled and compiled with PHP by default since version 5.2.0. Because the minimum version of PHP required by WordPress is now 5.6.20 (see #46594 and [45058]), JSON extension related polyfills and backwards compatibility code can now be removed.

This change removes code that supported JSON related functionality on older versions of PHP. This includes (but is not limited to) checks that `json_last_error()` exists, checking and setting the `JSON_UNESCAPED_SLASHES` and `JSON_PRETTY_PRINT` constants if not previously defined, and deprecating the `_wp_json_prepare_data()` function (which was 100% workaround code).

Follow up of [46205].

See #47699.
Props jrf, Clorith, pento.

git-svn-id: https://develop.svn.wordpress.org/trunk@46206 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-20 20:07:28 +00:00
Jonathan Desrosiers 080e7a609e Code Modernization: Deprecate the `Services_JSON` and `Services_JSON_Error` classes.
The PHP native JSON extension has been bundled and compiled with PHP by default since version 5.2.0. Because the minimum version of PHP required by WordPress is now 5.6.20 (see #46594 and [45058]), JSON extension related polyfills and backwards compatibility code can now be removed.

Since there are still some plugins and themes that utilize the `Services_JSON` class, these classes will remain for the time being, but including the `wp-includes/class-json.php` file and creating `Services_JSON` instances will now throw deprecated notices.

See #47699.
Props jrf, Clorith, pento.

git-svn-id: https://develop.svn.wordpress.org/trunk@46205 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-20 19:52:38 +00:00
Adam Silverstein 78e8100b6b Menus: add a position argument to `add_submenu_page` and the helper functions that use it.
Add a position argument to the `add_submenu_page` function similar to the one already in `add_menu_page`. When adding sub menus enables setting the position in the sub menu where the item should appear.

In addition, add the position argument to functions that call `add_submenu_page` under the hood: `add_management_page`, `add_options_page`, `add_theme_page`, `add_plugins_page`, `add_users_page`, `add_dashboard_page`, `add_posts_page`, `add_media_page`, `add_links_page`, `add_pages_page` and `add_comments_page`.

Props welcher, birgire, alexvorn2.
Fixes #39776.



git-svn-id: https://develop.svn.wordpress.org/trunk@46197 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-20 14:59:04 +00:00
Grzegorz (Greg) Ziółkowski 09e56c04ad Block Editor: Fixes failing unit tests related to Social Link blocks
Follow-up for #47843 - update the WordPress Packages to the ones used in the Gutenberg 6.5 release.

Props desrosj.

Fixes #47843.




git-svn-id: https://develop.svn.wordpress.org/trunk@46190 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-19 15:46:02 +00:00
Grzegorz (Greg) Ziółkowski 7178c62226 Block Editor: Update the WordPress Packages to the ones used in the Gutenberg 6.5 release
Updated Packages:

In version 6.2:

@wordpress/a11y@2.5.0
@wordpress/annotations@1.5.0
@wordpress/api-fetch@3.4.0
@wordpress/autop@2.4.0
@wordpress/babel-plugin-import-jsx-pragma@2.3.0
@wordpress/babel-plugin-makepot@3.2.0
@wordpress/babel-preset-default@4.4.0
@wordpress/blob@2.5.0
@wordpress/block-editor@3.0.0
@wordpress/block-library@2.7.0
@wordpress/block-serialization-default-parser@3.3.0
@wordpress/block-serialization-spec-parser@3.2.0
@wordpress/blocks@6.5.0
@wordpress/browserslist-config@2.6.0
@wordpress/components@8.1.0
@wordpress/compose@3.5.0
@wordpress/core-data@2.5.0
@wordpress/custom-templated-path-webpack-plugin@1.5.0
@wordpress/data-controls@1.1.0
@wordpress/data@4.7.0
@wordpress/date@3.4.0
@wordpress/dependency-extraction-webpack-plugin@1.1.0
@wordpress/deprecated@2.5.0
@wordpress/docgen@1.3.0
@wordpress/dom-ready@2.5.0
@wordpress/dom@2.4.0
@wordpress/e2e-test-utils@2.2.0
@wordpress/e2e-tests@1.4.0
@wordpress/edit-post@3.6.0
@wordpress/editor@9.5.0
@wordpress/element@2.6.0
@wordpress/escape-html@1.5.0
@wordpress/eslint-plugin@2.4.0
@wordpress/format-library@1.7.0
@wordpress/hooks@2.5.0
@wordpress/html-entities@2.5.0
@wordpress/i18n@3.6.0
@wordpress/is-shallow-equal@1.5.0
@wordpress/jest-console@3.2.0
@wordpress/jest-preset-default@4.3.0
@wordpress/jest-puppeteer-axe@1.2.0
@wordpress/keycodes@2.5.0
@wordpress/library-export-default-webpack-plugin@1.4.0
@wordpress/list-reusable-blocks@1.6.0
@wordpress/media-utils@1.0.0
@wordpress/notices@1.6.0
@wordpress/npm-package-json-lint-config@2.1.0
@wordpress/nux@3.5.0
@wordpress/plugins@2.5.0
@wordpress/postcss-themes@2.2.0
@wordpress/priority-queue@1.3.0
@wordpress/redux-routine@3.5.0
@wordpress/rich-text@3.5.0
@wordpress/scripts@3.4.0
@wordpress/server-side-render@1.1.0
@wordpress/shortcode@2.4.0
@wordpress/token-list@1.5.0
@wordpress/url@2.7.0
@wordpress/viewport@2.6.0
@wordpress/wordcount@2.5.0

In version 6.4:
@wordpress/annotations@1.6.0
@wordpress/api-fetch@3.5.0
@wordpress/autop@2.5.0
@wordpress/babel-preset-default@4.5.0
@wordpress/block-editor@3.1.0
@wordpress/block-library@2.8.0
@wordpress/block-serialization-default-parser@3.4.0
@wordpress/block-serialization-spec-parser@3.3.0
@wordpress/blocks@6.6.0
@wordpress/components@8.2.0
@wordpress/compose@3.6.0
@wordpress/core-data@2.6.0
@wordpress/data-controls@1.2.0
@wordpress/data@4.8.0
@wordpress/date@3.5.0
@wordpress/dependency-extraction-webpack-plugin@1.2.0
@wordpress/deprecated@2.6.0
@wordpress/docgen@1.4.0
@wordpress/dom@2.5.0
@wordpress/e2e-test-utils@2.3.0
@wordpress/e2e-tests@1.5.0
@wordpress/edit-post@3.7.0
@wordpress/editor@9.6.0
@wordpress/element@2.7.0
@wordpress/eslint-plugin@3.0.0
@wordpress/format-library@1.8.0
@wordpress/hooks@2.6.0
@wordpress/is-shallow-equal@1.6.0
@wordpress/jest-console@3.3.0
@wordpress/jest-preset-default@5.0.0
@wordpress/jest-puppeteer-axe@1.3.0
@wordpress/keycodes@2.6.0
@wordpress/list-reusable-blocks@1.7.0
@wordpress/media-utils@1.1.0
@wordpress/notices@1.7.0
@wordpress/nux@3.6.0
@wordpress/plugins@2.6.0
@wordpress/project-management-automation@1.0.0
@wordpress/redux-routine@3.6.0
@wordpress/rich-text@3.6.0
@wordpress/scripts@4.0.0
@wordpress/server-side-render@1.2.0
@wordpress/token-list@1.6.0
@wordpress/viewport@2.7.0
@wordpress/wordcount@2.6.0

In version 6.5:
@wordpress/annotations@1.7.0
@wordpress/api-fetch@3.6.0
@wordpress/babel-preset-default@4.6.0
@wordpress/block-directory@1.0.0
@wordpress/block-editor@3.2.0
@wordpress/block-library@2.9.0
@wordpress/blocks@6.7.0
@wordpress/components@8.3.0
@wordpress/compose@3.7.0
@wordpress/core-data@2.7.0
@wordpress/data-controls@1.3.0
@wordpress/data@4.9.0
@wordpress/dependency-extraction-webpack-plugin@2.0.0
@wordpress/e2e-test-utils@2.4.0
@wordpress/e2e-tests@1.7.0
@wordpress/edit-post@3.8.0
@wordpress/editor@9.7.0
@wordpress/element@2.8.0
@wordpress/eslint-plugin@3.1.0
@wordpress/format-library@1.9.0
@wordpress/list-reusable-blocks@1.8.0
@wordpress/media-utils@1.2.0
@wordpress/notices@1.8.0
@wordpress/nux@3.7.0
@wordpress/plugins@2.7.0
@wordpress/rich-text@3.7.0
@wordpress/scripts@5.0.0
@wordpress/server-side-render@1.3.0
@wordpress/url@2.8.0
@wordpress/viewport@2.8.0

Props youknowriad desrosj noisysocks pento jorgefilipecosta iseulde

Fixes: #47843



git-svn-id: https://develop.svn.wordpress.org/trunk@46189 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-19 15:17:39 +00:00
Boone Gorges 6eabc83b81 Query: Expand the list of operators available to `compare_key` in `WP_Meta_Query`.
`compare_key`, introduced in #42409, previously supported only `=` and `LIKE`
operators. This changeset introduces a number of other operators: `!=`, `IN`,
`NOT IN`, `NOT LIKE`, `RLIKE`, `REGEXP`, `NOT REGEXP`, `EXISTS`, and `NOT EXISTS`
(the latter two aliased to `=` and `!=`, respectively). To support case-sensitive
regular expression key comparisons, the new `type_key` parameter will force
a MySQL `CAST` when 'BINARY' is passed.

Props soulseekah.
Fixes #43346.

git-svn-id: https://develop.svn.wordpress.org/trunk@46188 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-19 15:02:20 +00:00
K. Adam White 84dfea907f REST API: Issue warning if array meta is registered without item schema.
The purpose of meta registration is to assert that the meta key will contain a predictable value conforming to a schema, so the schema is therefore considered to be required.

Props TimothyBlynJacobs, grapplerulrich.
Fixes #43392.


git-svn-id: https://develop.svn.wordpress.org/trunk@46186 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-19 14:35:47 +00:00
K. Adam White b926baa51d REST API: Support dot.nested hierarchical properties in _fields query parameter.
Enable clients to opt-in to receipt of one or more specific sub-properties within a response, and not other sub-properties.
Skip potentially expensive filtering and processing for post resources which were explicitly not requested.

Props kadamwhite, TimothyBlynJacobs, dlh.
Fixes #42094.


git-svn-id: https://develop.svn.wordpress.org/trunk@46184 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-19 14:04:51 +00:00
Sergey Biryukov a22920743b Tests: Replace `join()` with `implode()` in `do_enclose()` tests introduced in [46175], and ensure the arguments passed are in the correct order.
The `implode()` function accepts two parameters, `$glue` and `$pieces`. For historical reasons, these parameters have been accepted in any order, though it was recommended that the documented order of `$glue, $pieces` be used. It is also generally considered best practice to use the canonical function rather than an alias.

Starting in PHP 7.4, specifying the parameters in the reverse order will trigger a deprecation notice with the plan to remove this tolerance in PHP 8.0.

Props jrf.
Fixes #36824. See #47746.

git-svn-id: https://develop.svn.wordpress.org/trunk@46182 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-19 11:45:15 +00:00
Sergey Biryukov e5bee4ef68 Docs: Format multi-line comment in [46180] per the documentation standards.
See #45066.

git-svn-id: https://develop.svn.wordpress.org/trunk@46181 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-19 11:39:01 +00:00
Sergey Biryukov a87122688b Tests: Update unit tests to account for the removal of old `wp-a11y` from the loaded scripts in [46179].
Props sstoqnov.
See #45066, #48071.

git-svn-id: https://develop.svn.wordpress.org/trunk@46180 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-19 11:14:38 +00:00
Boone Gorges 48e280db32 Improve `do_enclose()` logic on post publish.
Removing the direct SQL query in `do_all_pings()` improves filterability.

As part of this change, the signature of `do_enclose()` is changed so that
a null `$content` parameter can be passed, with the `$content` then inferred
from the `$post` passed in the second parameter. In addition, the second
parameter was modified so that a post ID or a `WP_Post` object can be
provided. These changes make it possible to trigger enclosure checks with
a post ID alone (as in `do_all_pings()`) and also brings the function
signature in line with `do_trackbacks()` and `pingback()`.

Props dshanske, spacedmonkey, janw.oostendorp, mrmadhat, birgire.
See #36824.

git-svn-id: https://develop.svn.wordpress.org/trunk@46175 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-19 01:48:54 +00:00
Jake Spurlock 3d40bbeef5 Add SMS to the list of allowed protocols.
This commit expands the list of allowed protocols. It adds the `sms://` which can be used to open meessaging clients for mobile users.

Props rilwis, kraftbj

Fixes #39415


git-svn-id: https://develop.svn.wordpress.org/trunk@46172 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-18 23:37:08 +00:00
Jake Spurlock b8533a19b8 Accesibility: Replace wp-a11y.js with @wordpress/a11y package
Continuation of [46167]. This fixes the tests that ended up broken following the previous commit.

We've extracted wp-includes/wp-a11y.js to a reusable package wordpress/a11y which is published on NPM. Let's make sure this package is also 
used in WordPress core. Once all the JavaScript is built using webpack, we can also import this package wherever it is used and configure 
webpack to load is an external.

Props, garrett-eclipse

Fixes #45066



git-svn-id: https://develop.svn.wordpress.org/trunk@46169 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-18 22:29:53 +00:00
Jake Spurlock 8029e23ffe Accessibility: Replace wp-a11y.js with @wordpress/a11y package
We've extracted wp-includes/wp-a11y.js to a reusable package wordpress/a11y which is published on NPM. Let's make sure this package is also used in WordPress core. Once all the JavaScript is built using webpack, we can also import this package wherever it is used and configure webpack to load is an external.

Props omarreiss, herregroen, desrosj, ocean90, afercia, sstoqnov



git-svn-id: https://develop.svn.wordpress.org/trunk@46167 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-18 17:40:35 +00:00
Sergey Biryukov 5fdf48c0ec Script Loader: Introduce HTML5 support for scripts and styles.
When a theme declares HTML5 support for script and styles via `add_theme_support( 'html5', array( 'script', 'style' ) )`, the `type="text/javascript"` and `type="text/css"` attributes are omitted.

These attributes are unnecessary in HTML5 and cause warnings in the W3C Markup Validation Service.

Props sasiddiqui, swissspidy, knutsp, SergeyBiryukov.
See #42804.

git-svn-id: https://develop.svn.wordpress.org/trunk@46164 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-18 14:49:30 +00:00
Jonathan Desrosiers 65ec280a54 Posts, Post Types: Allow support arguments to be specified when registering post types.
The `add_post_type_support()` function accepts an optional third parameter that allows extra arguments to be supplied to configure post type support for a given feature. However, because of how `register_post_type()` and `WP_Post_Type->add_supports()` work, it is currently impossible to pass these additional arguments when initially registering a post type with `register_post_type()`.

This change makes it possible to supply additional arguments for a feature using the `supports` argument of `register_post_type()`.

Props MaximeCulea, seuser, desrosj, johnbillion.
Fixes #40413.

git-svn-id: https://develop.svn.wordpress.org/trunk@46160 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-17 19:57:18 +00:00
Jonathan Desrosiers 5e38f8219b Build/Test Tools: Improve test coverage for `wp_validate_boolean()`.
This change also reworks the test class to use a data provider.

Props pbearne, desrosj
Fixes #39868

git-svn-id: https://develop.svn.wordpress.org/trunk@46159 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-17 18:48:27 +00:00
Sergey Biryukov 5928234d05 Date/Time: Introduce `get_post_datetime()` to retrieve post published or modified time as a `DateTimeImmutable` object instance.
Introduce `get_post_timestamp()` to retrieve post published or modified time as a Unix timestamp.

Use `get_post_datetime()` in `get_post_time()` and `get_post_modified_time()` to return correct GMT time if default timezone is changed from UTC.

Props Rarst, johnregan3.
Fixes #25002.

git-svn-id: https://develop.svn.wordpress.org/trunk@46154 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-17 11:13:25 +00:00
Sergey Biryukov 802c23e059 Code Modernisation: Replace `call_user_func_array()` in `tests/phpunit/tests/db.php` with dynamic function calls.
Props jrf.
See #47678.

git-svn-id: https://develop.svn.wordpress.org/trunk@46145 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-15 11:55:42 +00:00
Sergey Biryukov fd05ea0de9 Code Modernisation: Replace `call_user_func_array()` in `wp-admin/includes/widgets.php` and associated unit tests with a direct function call.
Props jrf.
See #47678.

git-svn-id: https://develop.svn.wordpress.org/trunk@46138 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-15 11:40:08 +00:00
Sergey Biryukov 3ae54e84da Code Modernisation: Introduce the spread operator in `tests/phpunit/*`.
Rather than relying `func_get_args()` to retrieve arbitrary function arguments, we can now use the spread operator to assign them directly to a variable.

Props jrf.
See #47678.

git-svn-id: https://develop.svn.wordpress.org/trunk@46127 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-15 11:03:45 +00:00
Sergey Biryukov 7b8c666b72 Mail: Add a unit test to make sure `wp_mail()` does not duplicate the `MIME-Version` header added automatically by PHPMailer.
See #43542.

git-svn-id: https://develop.svn.wordpress.org/trunk@46118 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-14 21:34:51 +00:00
Sergey Biryukov a70be65d1f Coding Standards: Fix WPCS issue in [46107].
See #46631.

git-svn-id: https://develop.svn.wordpress.org/trunk@46108 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-14 15:18:10 +00:00
Sergey Biryukov 0b48fd2493 HTTP API: Add a unit test for `get_status_header_desc()`.
Props pbearne.
Fixes #46631.

git-svn-id: https://develop.svn.wordpress.org/trunk@46107 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-14 14:53:45 +00:00
Jonathan Desrosiers 50a0d6c7a9 Menus: Nav menu locations should not be integers.
When nav menu location slugs are integers, some hard to debug results can occur. `register_nav_menus()` utilizes `array_merge()` which renumbers numeric indexes, starting from 0. Because of this, numeric menu locations will almost always be changed.

This change introduces a `_doing_it_wrong()` notice to inform developers that nav menu locations should always be strings.

Props audrasjb, desrosj, welcher.
Fixes #45361.

git-svn-id: https://develop.svn.wordpress.org/trunk@46102 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-13 17:57:57 +00:00
Adam Silverstein 2b4cecf316 Multisite: improve `sites_pre_query` and `networks_pre_query` filters, avoiding db queries.
Improve the `pre_query` filters in multisite classes introduced in r44983. Return (non null) values immediately,
avoiding the database queries entirely, similar to other `pre_query` filters.

Props spacedmonkey, SergeyBiryukov, felipeelia.
Fixes #47599.



git-svn-id: https://develop.svn.wordpress.org/trunk@46100 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-12 22:16:08 +00:00
K. Adam White b979a99355 REST API: Accept string path in rest_ensure_request.
Update `rest_ensure_request()` to accept a string path, permitting a string path to be passed to `rest_do_request()` as is indicated (previously inaccurately) in that method's PHPDoc.

Props TimothyBlynJacobs, kadamwhite.
Fixes #40614.


git-svn-id: https://develop.svn.wordpress.org/trunk@46099 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-12 21:46:41 +00:00