Commit Graph

44632 Commits

Author SHA1 Message Date
Greg Ziółkowski
1918fe9e25 Build: Remove polyfills from block view scripts
Related changes in Gutenberg: https://github.com/WordPress/gutenberg/pull/35038.

When adding a block with a view.js script, the frontend loads an additional ~20kb of scripts that were previously not there. These are coming from polyfills that are defined as a dependency for view.js scripts.
Since WordPress dropped support for IE, these polyfills are no longer needed and can be removed.

Follow-up to [51501].
See #53690.
Props aristath.



git-svn-id: https://develop.svn.wordpress.org/trunk@52011 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-04 15:56:06 +00:00
Tonya Mork
40ac5de838 Coding Standards: Add visibility to methods in tests/phpunit/tests/.
Adds a `public` visibility to test fixtures, tests, data providers, and callbacks methods.

Adds a `private` visibility to helper methods within test classes.

Renames callbacks and helpers that previously started with a `_` prefix. Why? For consistency and to leverage using the method visibility. Further naming standardizations is beyond the scope of this commit.

Props costdev, jrf, hellofromTonya.
Fixes #54177.

git-svn-id: https://develop.svn.wordpress.org/trunk@52010 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-04 15:22:47 +00:00
Tonya Mork
80380cd374 Coding Standards: Add public visibility to methods in tests/phpunit/includes/.
This commit adds the `public` visibility keyword to each method which did not have an explicit visibility keyword.

Why `public`?

With no visibility previously declared, these methods are implicitly `public` and available for use. As these are part of the WordPress testing framework (for Core and extenders), changing them to anything else would be a backwards-compatibility break.

Props costdev, jrf, hellofromTonya.
See #54177.

git-svn-id: https://develop.svn.wordpress.org/trunk@52009 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-04 13:15:33 +00:00
Tonya Mork
93e6311612 REST API: Improve translations, comments, and readability in URL Details endpoint.
Improvements:
* Removes HTML tags from translatable strings. Uses `sprintf` with placeholder and translators comment.
* Spells out "OG" to "Open Graph" to help translators.
* Adds `@since` param to new filters.
* Improves comments for code standards and consistency.
* Improves readability by making multiple args multiline.
* Micro-optimizations to avoid unnecessary variable assignments.

Follow-up to [51973].

Props hellofromTonya, sergeybiryukov, swissspidy.
Fixes #54358.

git-svn-id: https://develop.svn.wordpress.org/trunk@52008 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-04 12:42:26 +00:00
David Baumwald
d782ee4c3c Comments: Add noopener noreferrer to author links in list table.
When viewing the listing of all comments, author links previously passed referrer information to untrusted URLs.  This change adds `noreferrer` to each author link, as well as `noopener` to prevent the passing of information about the parent window.

Props cybr, adam3128, erayalakese, andraganescu, audrasjb, joedolson, sabernhardt. 
Fixes #40916.

git-svn-id: https://develop.svn.wordpress.org/trunk@52007 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-03 20:00:36 +00:00
Sergey Biryukov
bf63e7ab46 External Libraries: Update the Iris color picker to version 1.1.1.
The latest version includes jQuery 3.x deprecation fixes:
* `$.isArray` → `Array.isArray`
* Event attachment/trigger shorthands → `.on()` and `.trigger()`

For a full list of changes in this update, see the PR on GitHub:
https://github.com/Automattic/Iris/pull/72

Follow-up to [22030], [22033], [22385], [22457], [22697], [22732], [23443], [26334], [30551], [30650], [38931], [50547].

Props Clorith, mattwiebe, Cybr.
Fixes #54224.

git-svn-id: https://develop.svn.wordpress.org/trunk@52006 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-03 19:38:33 +00:00
Sergey Biryukov
a88e82020c General: Remove the svn:executable property from wp-admin/_index.php.
The property appears to be added accidentally. The removing was mentioned but not included in the previous commit.

Follow-up to [38049], [42200], [46585], [51995], [52001].

See #54321.

git-svn-id: https://develop.svn.wordpress.org/trunk@52005 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-03 17:22:55 +00:00
John James Jacoby
b8564bdf9e Themes/TwentySixteen: correct invalid CSS font-style value.
This change swaps out `none` for `normal` in the `.wp-block-pullquote cite` styling of `blocks.css`.

Props malae, mukesh27, sabernhardt.

Fixes #46807.

git-svn-id: https://develop.svn.wordpress.org/trunk@52004 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-03 17:00:18 +00:00
Tonya Mork
e6e51414c9 Customize: Fix focus() to collapse child panels and show parent panel.
When a child panel is open, `wp.customize.panel('parent_panel').focus()` (e.g. `'parent_parent'` might be `'nav_menus'`) collapses the child panel(s) to show the parent panel. 

Follow-up to [30102], [31920], [38648].

Props celloexpressions, costdev, dlh, hareesh-pillai, hellofromTonya, westonruter, wpweaver. 
Fixes #34436.

git-svn-id: https://develop.svn.wordpress.org/trunk@52003 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-03 15:04:55 +00:00
Jonathan Desrosiers
9cfdfd4ecd Build/Test Tools: Pass workflow outcome to Slack Notifications.
When using a workflow as a callable workflow, the job status check functions do not take the called workflow into account. This has caused some failures to be incorrectly reported as successful.

This adds an input to the Slack notifications workflow for when the `workflow_call` event is used.

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@52002 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-03 14:54:20 +00:00
Sergey Biryukov
387269d5e5 Help/About: Improve typography in the Welcome to your WordPress Dashboard! text.
Per the general consensus in #8714 and similar tickets, user-facing strings should use “curly quotes” for better typography.

Remove the `svn:executable` property that appears to be added accidentally.

Follow-up to [38049], [42200], [46585], [51995].

See #54321.

git-svn-id: https://develop.svn.wordpress.org/trunk@52001 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-03 03:15:21 +00:00
Sergey Biryukov
213eb89650 Build/Test Tools: Restore the https URL for browserify-aes.
Follow-up to [51967], [51974].

See #54054.

git-svn-id: https://develop.svn.wordpress.org/trunk@52000 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-03 02:59:30 +00:00
Sergey Biryukov
8a4ffe3883 Tests: Clean up the $_REQUEST superglobal in WP_UnitTestCase_Base::clean_up_global_scope().
This resolves an issue where setting up `$_REQUEST['post_type']` and not clearing it afterwards in `Tests_Admin_IncludesScreen::setup_block_editor_test()` started affecting a few `WP_Comments_List_Table` tests after [51997]. It also ensures a similar issue does not inadvertently happen in other tests.

Follow-up to [760/tests], [51997].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51999 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-03 02:56:27 +00:00
Sergey Biryukov
b8dabaf249 Tests: Correct @covers tags in WP_Comments_List_Table tests.
Follow-up to [51993], [51997].

See #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@51998 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-03 00:54:47 +00:00
Sergey Biryukov
b849ae2685 Tests: Split WP_Posts_List_Table and WP_Comments_List_Table tests into two separate files for clarity.
These were previously combined in the `includesListTable.php` file. Since the tests were specific neither to the `_get_list_table()` function nor the parent `WP_List_Table` class, the naming was confusing, which should now be resolved.

Follow-up to [31730], [38854], [40297], [48151], [48521], [49190], [51993].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51997 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-03 00:48:42 +00:00
Tonya Mork
53f646d382 Customizer: Make range controls full width.
Adds CSS for range controls in the Customizer to be as wide as possible allowing for smaller increments to be more easily obtained by the user.

Follow-up to [28930].

Props domainsupport, dlh, sabernhardt, audrasjb.
Fixes #54329.

git-svn-id: https://develop.svn.wordpress.org/trunk@51996 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-02 23:18:46 +00:00
Tonya Mork
88835bea75 Help/About: Improve the Welcome text in wp-admin/_index.php.
Improves the `Welcome to your WordPress Dashboard!` copy in the `Overview` section of the help tab.

Follow-up to [18914], [19007], [37680].

Props webcommsat, marybaum, costdev, audrasjb.
Fixes #54321.

git-svn-id: https://develop.svn.wordpress.org/trunk@51995 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-02 22:53:54 +00:00
Tonya Mork
4e02784e4e Build/Test Tools: Add missing @covers and visibility for Tests_Admin_includesMisc.
Adds the `@covers` tag to the test DocBlock.
Adds missing `public` visibility to the test method.

Follow-up to [25002].

Props pbearne, jrf, hellofromTonya.
See #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@51994 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-02 22:07:49 +00:00
Tonya Mork
aa83121b9f Build/Test Tools: Add missing @covers tags for Tests_Admin_includesListTable.
Follow-up to [31730].

Props pbearne, jrf, hellofromTonya.
See #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@51993 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-02 22:00:44 +00:00
Tonya Mork
30fc5ec439 Build/Test Tools: Add missing @covers tags for Tests_Admin_includesFile.
Follow-up to [25002], [42773].

Props pbearne, jrf, hellofromTonya.
See #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@51992 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-02 21:56:10 +00:00
Tonya Mork
032b98dbdd Help/About: Simplifies WordPress version in "Help" sidebar.
Simplifies the logic for when not in alpha/beta/RC.

The changelog URL is translatable in a few other places in core. This commit uses the same pattern for consistency.

Follow-up to [51985].

Props sergeybiryukov.
Fixes #47848.

git-svn-id: https://develop.svn.wordpress.org/trunk@51991 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-02 21:42:44 +00:00
Tonya Mork
36ecafde11 Build/Test Tools: Add end-to-end (e2e) tests for edit posts page.
Adds e2e tests for 'Edit Posts':
* No posts found
* Shows a single post after publishing
* Edit existing post via Edit button
* Quick edit existing post via Quick Edit button
* Delete post

Props isabel_brison, azaozz, hellofromTonya, justinahinon, talldanwp, youknowriad.
Fixes #49507.

git-svn-id: https://develop.svn.wordpress.org/trunk@51990 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-02 21:25:53 +00:00
Tonya Mork
5da7a6f923 Build/Test Tools: Introduce local visual regression testing.
Adds the ability to ''locally'' run visual regression testing for wp-admin pages via `npm run test:visual`. Snapshots are stored on contributors' local machines.

Note:
Wiring to the CI is not included. Why? The challenges for the CI are storage of the artifacts and unreliability of testing these across different environments.

This commit is a first step towards visual regression testing. Running it locally provides a learning opportunity which could help to craft how to build it into the automated CI process.

Props isabel_brison, andraganescu, azaozz, danfarrow, desrosj, hellofromTonya, justinahinon, netweb, talldanwp.
Fixes #49606.

git-svn-id: https://develop.svn.wordpress.org/trunk@51989 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-02 21:03:10 +00:00
Sergey Biryukov
3e2ec6c215 Coding Standards: Fix some WPCS errors and warnings in wp-admin/user-edit.php:
* Add missing translators comment.
* Add missing space, correct indentation.
* Put opening and closing PHP tag on a line by itself.
* Remove unnecessary escaping for consistency with other strings.

Follow-up to [51980].

See #53658.

git-svn-id: https://develop.svn.wordpress.org/trunk@51988 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-02 20:18:09 +00:00
John James Jacoby
9007b1dd3a Help/About: add WordPress version to contextual "Help" sidebar area.
This change adds a new way for users to quickly identify what version of WordPress they are looking at, directly from the "Help" sidebar on the main "Dashboard" page.

* Stable versions will link to their respective support documents.
* Development versions (alpha/beta/RC) will not link anywhere.

Props audrasjb, costdev, donmhico, hellofromtonya, ipstenu, justinahinon, karmatosed, knutsp, marybaum, sergeybiryukov, webcommsat.

Fixes #47848.

git-svn-id: https://develop.svn.wordpress.org/trunk@51985 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-02 19:07:10 +00:00
John James Jacoby
8f9eea80f9 Permalinks: Sanitize non-visible characters inside sanitize_title_with_dashes().
This change prevents non-visible characters in titles from creating encoded values in permalinks, opting instead for the following replacement strategy:

* Non-visible non-zero-width characters are replaced with hyphens
* Non-visible zero-width characters are removed entirely

Included with this change are 64 additional PHPUnit assertions to confirm that only the targeted non-visible characters are sanitized as intended.

Before this change, URLs would unintentionally contain encoded values where these non-visible characters were. After this change, URLs intentionally strip out or hyphenate these non-visible characters.

Props costdev, dhanendran, hellofromtonya, paaljoachim, peterwilsoncc, poena, sergeybiryukov.

Fixes #47912.

git-svn-id: https://develop.svn.wordpress.org/trunk@51984 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-02 18:46:36 +00:00
Sergey Biryukov
d7518d1927 Media: Use WP_Query::get() method to retrieve the posts_per_page value in wp_ajax_query_attachments().
This avoids a PHP notice and ensures that a default value is always provided if none is set by the user.

Follow-up to [51145], [51485].

Props davidwebca, mukesh27.
Fixes #54129.

git-svn-id: https://develop.svn.wordpress.org/trunk@51982 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-02 18:28:23 +00:00
John James Jacoby
4440711bfb Application Passwords: display guiding text & link in user-edit.php when unavailable.
This change intends to avoid confusion around the requirements of the Application Passwords feature, specific to it requiring HTTPS and the `WP_ENVIRONMENT_TYPE` constant.

It does this by conditionally hiding the traditional UI and showing some insightful explanations instead, including a translatable link to the `WP_ENVIRONMENT_TYPE` documentation on the "Editing wp-config.php" support page.

Props ashfame, audrasjb, iluy, johnbillion.

Fixes  #53658.

git-svn-id: https://develop.svn.wordpress.org/trunk@51980 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-02 17:55:07 +00:00
John James Jacoby
8d26fccb10 Admin/UI-Copy: reword some "we" usages.
This changes some admin-area, user-facing text, to better match the guidelines and recommendations set forth in the make/core handbook, specifically:

> the word “we” should be avoided (...) unless its made very clear which group is speaking

(There are several more usages of "we" that will receive this same scrutiny in future commits/releases.)

Props audrasjb, johnbillion, marybaum, peterwilsoncc, sergeybiryukov, shital-patel.

Fixes  #46057.

git-svn-id: https://develop.svn.wordpress.org/trunk@51979 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-02 17:36:34 +00:00
John James Jacoby
e30e4b6f00 Themes: Introduce get_header_image_tag_attributes hook.
This change adds a filter inside of the `get_header_image_tag()` function allowing developers to filter the attributes of the header image HTML tag before they are escaped, concatenated, and returned.

Before this change, it was not possible to externally and preemptively intercept this array of attributes. After this change, these attributes can now be easily filtered, matching it nicely to the `wp_get_attachment_image_attributes` hook.

Props audrasjb, chaion07, junaidbhura, sabernhardt.

Fixes #38942.

git-svn-id: https://develop.svn.wordpress.org/trunk@51978 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-02 17:20:35 +00:00
John James Jacoby
df8a2b408b Admin/Menu: include 960 exact pixel width in collapse measurements.
This change removes a 1 pixel gap in the measurement of the viewport width when clicking the "Collapse menu" button (at the bottom of the admin menu UI) when already collapsed, causing the menu not to open as intended when exactly 960 pixels wide.

Before this change, the menu would be stuck in the collapsed position. After this change, the menu opens as expected.

Props abesell132, ankit-k-gupta, audrasjb, boniu91, mai21, sabernhardt, webaxones.

Fixes #54210.

git-svn-id: https://develop.svn.wordpress.org/trunk@51977 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-02 17:06:16 +00:00
John James Jacoby
dbf96aadab Admin/Discussion Settings: attempt to clarify intent of "Default post settings" section.
This changes the descriptive text underneath 3 settings that are frequently overridden by individual posts & pages, and are also often misunderstood to work differently than they do.

"(These settings may be overridden for individual posts.)"

...becomes...

"Individual posts may override these settings. Changes here will only be applied to new posts."

* Parenthesis were removed to improve text layout and flow for RTL languages.
* Original statement was reworded to emphasize "individual posts".
* New statement provides clarity to users about settings changes not being retroactive.

Props audrasjb, johnjamesjacoby, sabbirshouvo, sabernhardt, tobifjellner.

Fixes #54300.

git-svn-id: https://develop.svn.wordpress.org/trunk@51976 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-02 16:42:01 +00:00
John James Jacoby
4923d75fb1 Admin/Comments: remove bespoke truncation from search string HTML.
This change removes a call to `wp_html_excerpt()` used on the HTML output of the search string, supplied by the current user in the previous page request via the named `s` input in the search-box UI.

If the search string is extremely long, it wraps around the available empty space in a way that is not visually displeasing, confirming that truncation is not a requirement here.

This also addresses a small accessibility concern as the non-truncated string was not alternatively presented, and helps normalize the output of `$_REQUEST['s']` for more broad improvements in the future.

Props hareesh-pillai, jakubtyrcha, johnjamesjacoby, lukecavanagh, sabernhardt.

Fixes #17636.

git-svn-id: https://develop.svn.wordpress.org/trunk@51975 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-02 15:56:02 +00:00
Joe Dolson
605e7d1b00 Build/Test Tools: Restore changes to package.json.
Reverts changes to package.json and package-lock.json accidentally committed in [51967].

Props tobiasbg.
Fixes #54054.

git-svn-id: https://develop.svn.wordpress.org/trunk@51974 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-02 14:24:40 +00:00
Tonya Mork
1822d9875b REST API: Add URL Details endpoint.
Adds a new REST API endpoint (`/wp-block-editor/v1/url-details`) for retrieving information from an external URL.

Information retrieved:

* Title: content of the `<title>` element
* Icon: favicon image link
* Description: content of the `description` or `og:description` meta element
* Image: OG image link

This endpoint is used by the block editor for link previews.

Props get_dave, aduth, andraganescu, beaulebens, hellofromTonya, kevin940726, mamaduka, marekhrabe, mnelson4, noisysocks, obenland, ocean90, retrofox, shaunandrews, spacedmonkey, swissspidy, timothyblynjacobs, xknown, youknowriad.
Fixes #54358.

git-svn-id: https://develop.svn.wordpress.org/trunk@51973 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-02 12:46:01 +00:00
Joe Dolson
b45c85a405 Widgets: Remove unused CSS breaking wp_text_diff layout.
Remove CSS used in version of `wp_text_diff` prior to [50034]. Orphaned CSS breaks default layout of function output, but is overridden in the revisions screen.

Props mt8.biz, hareesh-pillai, mukesh27.
Fixes #54140.

git-svn-id: https://develop.svn.wordpress.org/trunk@51972 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-01 23:12:06 +00:00
Joe Dolson
93b2e8d9a6 Widgets: Use a text-based button to select location.
The WordPress Events and News widget used an icon-only button to select a location. The Pencil icon alone provided insufficient context and labeling for accessibility. Add text to clearly describe button action and change icon to represent a location marker. 

Props AmethystAnswers, sabernhardt.
Fixes #53311.

git-svn-id: https://develop.svn.wordpress.org/trunk@51971 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-01 22:53:19 +00:00
Tonya Mork
d9bb269a31 Site Health: Internationalizes count in the info section headings.
If a site health info section includes the `show_count` parameter, this commit internationalizes the count.

Follow-up to [45176].

Props johnbillion, swissspidy.
Fixes #54341.

git-svn-id: https://develop.svn.wordpress.org/trunk@51970 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-01 22:35:43 +00:00
Joe Dolson
054dac262f Editor: Include post's title in editor title element.
Include the current post title in the `title` element when editing a post. Improve accessibility by distinguishing between different edit screens in the browser tab list. 

Props skierpage, alexstine, audrasjb, sabernhardt.
Fixes #52314.

git-svn-id: https://develop.svn.wordpress.org/trunk@51969 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-01 22:31:56 +00:00
Tonya Mork
400982add8 Build/Test Tools: Ignore "null to nullable" deprecations for select tests.
Adds an expectation for PHP 8.1 "passing null to non-nullable" deprecation notice to select tests where the deprecation is generated by one of the functions in the `wp-includes/formatting.php` file, either via a filter hook callback or by a direct call.

Instead of haphazardly fixing these issues exposed by the tests, a more structural and all-encompassing solution for input validation should be architected and implemented as otherwise, we'll keep running into similar issues time and again with each new PHP version.

To discourage people from "fixing" these issues now anyway, this commit "hides" nearly all of these issues from the test runs.

Once a more structural solution is designed, these tests and the underlying functions causing the deprecation notices should be revisited and the structural solution put in place.

Includes a few minor other tweaks to select tests:
* Removing a stray `return` (twice) from assertion statements.
* Removing calls to `ob_*()` functions in favour of letting PHPUnit manage the output catching. This prevents warnings along the lines of `Test code or tested code did not (only) close its own output buffers`.

Props jrf, hellofromTonya.
See #53635.

git-svn-id: https://develop.svn.wordpress.org/trunk@51968 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-01 22:22:49 +00:00
Joe Dolson
162fda69c8 General: Remove role="navigation" from nav elements.
Role="navigation" was required for assistive technology to recognize HTML5 element's native ARIA roles while HTML5 and ARIA were being introduced. With the deprecation of IE11, the role attribute is only required when mapping elements that don't have native role.

Props costdev, mukesh27.
Fixes #54054.

git-svn-id: https://develop.svn.wordpress.org/trunk@51967 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-01 21:45:45 +00:00
Tonya Mork
23b4388bab Application Passwords: Add end-to-end (e2e) tests.
Adds end-to-end (e2e) tests for the following test scenarios:
* Create a new application password.
* Create an application password with an existing name.
* Revoke a single application password.
* Bulk revoke applications passwords.

Follow-up to [49109], [49276], [49562], [50001], [50367], [51463].

Props justinahinon, swissspidy, juhise, kevin940726, isabel_brison.
Fixes #54241.

git-svn-id: https://develop.svn.wordpress.org/trunk@51966 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-01 21:40:19 +00:00
Sergey Biryukov
175ad4c91c Docs: Add a @since note for the rest_namespace argument of register_post_type() and register_taxonomy().
Use 3-digit, x.x.x-style semantic versioning for `@since` tags of the `$rest_namespace` property in `WP_Post_Type` and `WP_Taxonomy`.

Add a `@since` note to `WP_REST_Taxonomies_Controller::get_item_schema()` for the `visibility` and `rest_namespace` properties.

The `rest_base` property was also added after the method was initially introduced, but that happened during the same release cycle, so it doesn't need a separate `@since` note.

Follow-up to [38832], [39191], [42729], [51959], [51961], [51962], [51964].

See #53399.

git-svn-id: https://develop.svn.wordpress.org/trunk@51965 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-01 14:29:42 +00:00
Timothy Jacobs
2cd084aeb0 REST API: Support custom namespaces for taxonomies.
While a taxonomy can define a custom route by using the rest_base argument, a namespace of wp/v2 was assumed. This commit introduces support for a rest_namespace argument.

A new rest_get_route_for_taxonomy_items function has been introduced and the rest_get_route_for_term function updated to facilitate getting the correct route for taxonomies.

For maximum compatibility sticking with the default wp/v2 namespace is recommended until the API functions see wider use.

Props spacedmonkey.
Fixes #54267.
See [51962].


git-svn-id: https://develop.svn.wordpress.org/trunk@51964 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-01 03:26:06 +00:00
Gary Pendergast
9ca3e8f36b KSES: Add options for restricting tags based upon their attributes.
This change adds two now attribute-related config options to KSES:
- An array of allowed values can be defined for attributes. If the attribute value doesn't fall into the list, the attribute will be removed from the tag.
- Attributes can be marked as required. If a required attribute is not present, KSES will remove all attributes from the tag. As KSES doesn't match opening and closing tags, it's not possible to safely remove the tag itself, the safest fallback is to strip all attributes from the tag, instead.

Included with this change is an implementation of these options, allowing the `<object>` tag to be stored in posts, but only when it has a `type` attribute set to `application/pdf`.

Props pento, swissspidy, peterwilsoncc, dd32, jorbin.
Fixes #54261.



git-svn-id: https://develop.svn.wordpress.org/trunk@51963 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-01 02:12:09 +00:00
Timothy Jacobs
bb6c5dbb8d REST API: Support custom namespaces for custom post types.
While a custom post type can define a custom route by using the `rest_base` argument, a namespace of `wp/v2` was assumed. This commit introduces support for a `rest_namespace` argument. 

A new `rest_get_route_for_post_type_items` function has been introduced and the `rest_get_route_for_post` function updated to facilitate getting the correct route for custom post types.

While the WordPress Core Block Editor bootstrap code has been updated to use these API functions, for maximum compatibility sticking with the default `wp/v2` namespace is recommended until the API functions see wider use.

Props spacedmonkey, swissspidy.
Fixes #53656.


git-svn-id: https://develop.svn.wordpress.org/trunk@51962 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-31 23:15:10 +00:00
Sergey Biryukov
045bec51a4 Docs: Add a @since note to WP_REST_Post_Types_Controller::get_item_schema() for the supports and visibility properties.
The `taxonomies` and `rest_base` properties were also added after the method was initially introduced, but that happened during the same release cycle, so they don't need a separate `@since` note.

Follow-up to [38832], [39097], [39191], [39647], [51959].

See #53399.

git-svn-id: https://develop.svn.wordpress.org/trunk@51961 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-31 20:26:07 +00:00
Timothy Jacobs
07ad6efdf7 REST API: Send a 500 status code when JSON encoding fails.
Previously, a 200 status code would be sent despite the 500 status code present in the response body.

Props hermpheus, lalitjalandhar.
Fixes #53056.


git-svn-id: https://develop.svn.wordpress.org/trunk@51960 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-31 06:06:02 +00:00
Timothy Jacobs
57ded3c85d REST API: Add visibility information to the Post Types controller.
Props spacedmonkey, peterwilsoncc.
Fixes #54055.


git-svn-id: https://develop.svn.wordpress.org/trunk@51959 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-31 05:17:53 +00:00
John Blackbourn
9f9c81f567 Application Passwords: Various docblock improvements.
See #53399, #42790


git-svn-id: https://develop.svn.wordpress.org/trunk@51958 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-30 20:25:19 +00:00