Commit Graph

538 Commits

Author SHA1 Message Date
jorgefilipecosta d8fe393934 Add: Public functions for interacting with global styles & settings.
This commit ports the public functions to interact with the global styles & settings.

See #54336.
Props oandregal.
Built from https://develop.svn.wordpress.org/trunk@52054


git-svn-id: http://core.svn.wordpress.org/trunk@51646 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-08 21:45:58 +00:00
jorgefilipecosta db5d8b5e03 Add: Global Styles Rest endpoints.
This commit ports the global styles rest endpoints from the Gutenberg plugin into the core.

See #54336.
Props oandregal, aristath, timothyblynjacobs, spacedmonkey, youknowriad.
Built from https://develop.svn.wordpress.org/trunk@52051


git-svn-id: http://core.svn.wordpress.org/trunk@51643 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-08 21:00:07 +00:00
jorgefilipecosta 065c639a2a Update theme.json classes for WordPress 5.9.
This commit ports to core the changes to the classes that deal with theme.json code.

See #54336.
Props oandregal, spacedmonkey, noisysocks, hellofromtonya, youknowriad.
Built from https://develop.svn.wordpress.org/trunk@52049


git-svn-id: http://core.svn.wordpress.org/trunk@51641 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-08 19:19:58 +00:00
Sergey Biryukov 107d13bc28 Coding Standards: Move `wp-includes/class-http.php` to `wp-includes/class-wp-http.php`.
This renames the file containing the `WP_Http` class to conform to the coding standards.

This commit also includes:

- A new `class-http.php` that includes the new file, for anyone that may've been including the file directly.
- Replaces references to the old filename with the new filename.

Follow-up to [8516], [13274], [33748].

Fixes #54389. See #53359.
Built from https://develop.svn.wordpress.org/trunk@52026


git-svn-id: http://core.svn.wordpress.org/trunk@51618 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-07 01:36:57 +00:00
hellofromTonya cf0274e1ca 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.
Built from https://develop.svn.wordpress.org/trunk@51973


git-svn-id: http://core.svn.wordpress.org/trunk@51562 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-02 12:48:00 +00:00
Sergey Biryukov 033c742a4e Block Editor: Load the `WP_Theme_JSON_Resolver` class in `wp-admin/load-styles.php`.
This ensures correct load order when style concatenation is used, e.g. when `SCRIPT_DEBUG` is off.

Additionally, make sure the `WP_CONTENT_DIR` constant is defined for use in `get_theme_root()` via `get_stylesheet_directory()`.

Follow-up to [50992], [51001], [51013].

Props nosolosw.
See #53175.
Built from https://develop.svn.wordpress.org/trunk@51056


git-svn-id: http://core.svn.wordpress.org/trunk@50665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-01 23:09:58 +00:00
ryelle 56ca42b5d9 Block Editor: Add support for the pattern directory.
Add an endpoint for fetching block patterns from WordPress.org, and load the block patterns from this new API. Remove the block patterns that have already been moved to WordPress.org/patterns.

Props ryelle, iandunn, youknowriad, timothyblynjacobs.
Fixes #53246.


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


git-svn-id: http://core.svn.wordpress.org/trunk@50630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-26 01:11:59 +00:00
Sergey Biryukov 3c3a18a957 Block Editor: Only load the `WP_Theme_JSON_Resolver` class once.
Since the class is now loaded via `wp-includes/script-loader.php`, which is required earlier in `wp-settings.php`, loading it again in `wp-settings.php` is redundant.

Follow-up to [50992], [51001].

See #53175.
Built from https://develop.svn.wordpress.org/trunk@51013


git-svn-id: http://core.svn.wordpress.org/trunk@50622 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-25 21:40:57 +00:00
youknowriad 4ae0e4220f Block Editor: Introduce block templates for classic themes.
With this patch, users will be able to create custom block based templates
and assign them to specific pages/posts.

Themes can also opt-out of this feature

Props bernhard-reiter, carlomanf.
Fixes #53176.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50612 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-25 14:20:57 +00:00
youknowriad f6af848c72 Block Editor: Load theme resolver class in script loader.
script-loader.php is sometimes called directly and in these situations, the Theme_JSON_Resolver class was not defined.

Props nosolosw, noisysocks.
Fixes #53175.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50610 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-25 13:42:58 +00:00
noisysocks 1314542c50 REST API: Add widget endpoints
Adds the sidebars, widgets and widget-types REST API endpoints from the
Gutenberg plugin.

Fixes #41683.
Props TimothyBlynJacobs, spacedmonkey, zieladam, jorgefilipecosta, youknowriad, kevin940726.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-25 08:27:57 +00:00
noisysocks ed195fbd89 REST API: Revert widget endpoints
Reverts [50993] as it has missing props.

Reverts [50993].
See #41683.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50603 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-25 08:22:56 +00:00
noisysocks 2a4e1e0c04 REST API: Add widget endpoints
Adds the sidebars, widgets and widget-types REST API endpoints from the
Gutenberg plugin.

Fixes #41683.
Props TimothyBlynJacobs.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-25 07:52:55 +00:00
youknowriad 4e1dc7a28c Block Editor: Add Global Settings support using theme.json file.
This is the first piece of landing the theme.json processing in WordPress core. 
It allows themes to configure the different editor settings, allow cusomizations and define presets in theme.json file.
 
Props jorgefilipecosta, nosolosw.
See #53175.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50568 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-24 08:37:55 +00:00
gziolo 4ae98860b9 Editor: Extract `block_editor_rest_api_preload` method for use with different editor screens
It is going to be used on the new widgets editor screen. This patch also introduced a new class WP_Block_Editor_Context that is going to be used with revised block editor filters to let extenders to keep their existing behavior. It should also allow to provide more settings through the context class as new screens get introduced like the navigation editor.

Props azaozz, chrisvanpatten, timothyblynjacobs, youknowriad.
Fixes #52920.



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


git-svn-id: http://core.svn.wordpress.org/trunk@50565 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-24 07:32:55 +00:00
youknowriad a225c5cdc6 Block Editor: Updated the WordPress packages from Gutenberg 10.7.0 RC.
This also includes:

 - The removal of the Post Author block.
 - Renaming build_query_vars_from_query_block function.
 - Update the block supports.

Props gziolo.
See #52991. 
-This line, and those below, will be ignored--

M    package-lock.json
M    package.json
M    src/wp-includes/assets/script-loader-packages.php
M    src/wp-includes/block-supports/colors.php
AM   src/wp-includes/block-supports/elements.php
D    src/wp-includes/block-supports/padding.php
AM   src/wp-includes/block-supports/spacing.php
M    src/wp-includes/block-supports/typography.php
M    src/wp-includes/blocks/column/block.json
M    src/wp-includes/blocks/index.php
D    src/wp-includes/blocks/post-author
D    src/wp-includes/blocks/post-author.php
M    src/wp-includes/blocks/post-content.php
M    src/wp-includes/blocks/post-featured-image.php
M    src/wp-includes/blocks/query/block.json
M    src/wp-includes/blocks/query-loop/block.json
M    src/wp-includes/blocks/query-loop.php
M    src/wp-includes/blocks/query-pagination/block.json
M    src/wp-includes/blocks/query-pagination-next.php
M    src/wp-includes/blocks/query-pagination-numbers.php
M    src/wp-includes/blocks/site-tagline/block.json
M    src/wp-includes/blocks/site-title/block.json
M    src/wp-includes/blocks.php
M    src/wp-settings.php
M    tests/phpunit/tests/blocks/block.php
M    tools/webpack/packages.js

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


git-svn-id: http://core.svn.wordpress.org/trunk@50554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-21 10:14:23 +00:00
gziolo c3ea09ebb8 Editor: Update WordPress packages published for Gutenberg 10.6
It contains several changes in addition to regular update to WordPress packages:
- All newly exposed blocks are now registered on the server.
- Dutone block support was added.
- Border block support was updated.
- New shared function `construct_wp_query_args` was added for the family of Query blocks - it might need some further work.

Props youknowriad.
See #52991.



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


git-svn-id: http://core.svn.wordpress.org/trunk@50538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-19 15:09:27 +00:00
gziolo f4f125b869 Editor: Abstract block editor configuration
There are several WordPress hooks defined on the server that depend on $post object that isn’t present on the new screens like edit site, edit widgets, or edit navigation. This patch deprecates existing filters and introduces replacements that are context-aware.

Props azaozz, andraganescu, jeremyfelt, nosolosw, youknowriad.
See #52920.




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


git-svn-id: http://core.svn.wordpress.org/trunk@50385 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-04-21 05:12:05 +00:00
gziolo ad48a15387 Editor: Update WordPress packages to use with WordPress 5.8
In the response to the discussion during the Dev Chat, I'm doing a first pass to keep WordPress packages up to date in the WordPress 5.8 release cycle.

See https://github.com/WordPress/wordpress-develop/pull/1176 for more details.

Props youknowriad, aristath, andraganescu.
See #52991.


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


git-svn-id: http://core.svn.wordpress.org/trunk@50370 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-04-15 15:19:43 +00:00
Felix Arntz dbfbf5501a Security, Site Health: Make migrating a site to HTTPS a one-click interaction.
Switching a WordPress site from HTTP to HTTPS has historically been a tedious task. While on the surface the Site Address and WordPress Address have to be updated, existing content still remains using HTTP URLs where hard-coded in the database. Furthermore, updating _two_ URLs to migrate to HTTPS is still a fairly unintuitive step which is not clearly explained.

This changeset simplifies migration from HTTP to HTTPS and, where possible, makes it a one-click interaction.

* Automatically replace insecure versions of the Site Address (`home_url()`) with its HTTPS counterpart on the fly if the site has been migrated from HTTP to HTTPS. This is accomplished by introducing a `https_migration_required` option and enabling it when the `home_url()` is accordingly changed.
    * A new `wp_replace_insecure_home_url()` function is hooked into various pieces of content to replace URLs accordingly.
    * The migration only kicks in when the Site Address (`home_url()`) and WordPress Address (`site_url()`) match, which is the widely common case. Configurations where these differ are often maintained by more advanced users, where this migration routine would be less essential - something to potentially iterate on in the future though.
    * The migration does not actually update content in the database. More savvy users that prefer to do that can prevent the migration logic from running by either deleting the `https_migration_required` option or using the new `wp_should_replace_insecure_home_url` filter.
    * For fresh sites that do not have any content yet at the point of changing the URLs to HTTPS, the migration will also be skipped since it would not be relevant.
* Expose a primary action in the Site Health recommendation, if HTTPS is already supported by the environment, built on top of the HTTPS detection mechanism from [49904]. When clicked, the default behavior is to update `home_url()` and `site_url()` in one go to their HTTPS counterpart.
    * A new `wp_update_urls_to_https()` function takes care of the update routine.
    * A new `update_https` meta capability is introduced to control access.
    * If the site's URLs are controlled by constants, this update is not automatically possible, so in these scenarios the user is informed about that in the HTTPS status check in Site Health.
* Allow hosting providers to modify the URLs linked to in the HTTPS status check in Site Health, similar to how that is possible for the URLs around updating the PHP version.
    * A `WP_UPDATE_HTTPS_URL` environment variable or `wp_update_https_url` filter can be used to provide a custom URL with guidance about updating the site to use HTTPS.
    * A `WP_DIRECT_UPDATE_HTTPS_URL` environment variable or `wp_direct_update_https_url` filter can be used to provide a custom URL for the primary CTA to update the site to use HTTPS.

Props flixos90, timothyblynjacobs.
Fixes #51437.

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


git-svn-id: http://core.svn.wordpress.org/trunk@49810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-02 00:10:01 +00:00
Felix Arntz 3716c8c20f Robots: Introduce Robots API.
This changeset introduces a filter-based Robots API, providing central control over the `robots` meta tag.

* Introduces `wp_robots()` function which should be called anywhere a `robots` meta tag should be included.
* Introduces `wp_robots` filter which allows adding or modifying directives for the `robots` meta tag. The `wp_robots()` function is entirely filter-based, i.e. if no filter is added to `wp_robots`, no directives will be present, and therefore the entire `robots` meta tag will be omitted.
* Introduces the following `wp_robots` filter functions which replace similar existing functions that were manually rendering a `robots` meta tag:
    * `wp_robots_noindex()` replaces `noindex()`, which has been deprecated.
    * `wp_robots_no_robots()` replaces `wp_no_robots()`, which has been deprecated.
    * `wp_robots_sensitive_page()` replaces `wp_sensitive_page_meta()`, which has been deprecated. Its rendering of the `referrer` meta tag has been moved to another new function `wp_strict_cross_origin_referrer()`.

Migration to the new functions is straightforward. For example, a call to `add_action( 'wp_head', 'wp_no_robots' )` should be replaced with `add_filter( 'wp_robots', 'wp_robots_no_robots' )`.

Plugins and themes that render their own `robots` meta tags are encouraged to switch to rely on the `wp_robots` filter in order to use the central management layer now provided by WordPress core.

Props adamsilverstein, flixos90, timothyblynjacobs, westonruter.
See #51511.

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


git-svn-id: http://core.svn.wordpress.org/trunk@49693 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-21 01:37:00 +00:00
Felix Arntz c81db1f6e6 Security, Site Health: Detect HTTPS support and encourage switching.
This changeset modifies the Site Health panel for HTTPS to provide more accurate recommendations based on whether the environment is already set up for HTTPS.

* Introduces `wp_is_using_https()` to check whether the site is configured to use HTTPS (via its Site Address and WordPress Address).
* Introduces `wp_is_https_supported()` to check whether the environment supports HTTPS. This relies on a cron job which periodically checks support using a loopback request.

Props Clorith, flixos90, miinasikk, westonruter.
Fixes #47577.

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


git-svn-id: http://core.svn.wordpress.org/trunk@49603 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-23 19:13:04 +00:00
Dominik Schilling abc9d961d5 I18N: Revert [49236] for now to investigate alternative implementations.
See #39210, #51678, #26511.
Built from https://develop.svn.wordpress.org/trunk@49566


git-svn-id: http://core.svn.wordpress.org/trunk@49304 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-12 14:43:09 +00:00
Dominik Schilling 173b9aa122 I18N: Introduce `WP_Textdomain_Registry` to store text domains and their language directory paths.
Previously, when using `switch_to_locale()` all current loaded text domains were unloaded and added to the `$l10n_unloaded` global. This prevented the just-in-time loading for text domains after a switch. The just-in-time loading was also only possible if the translations were stored in `WP_LANG_DIR`. Both issues have been fixed.

* Adds `WP_Textdomain_Registry` to keep track of the language directory paths for all plugins and themes.
* Updates all `load_*_textdomain()`  functions to store the path in `WP_Textdomain_Registry`.
* Adds `$reloadable` parameter to `unload_textdomain()` to define whether a text domain can be loaded just-in-time again. This is used by `WP_Locale_Switcher::load_translations()`.
* Extends `_load_textdomain_just_in_time()` to also support text domains of plugins and themes with custom language directories.
* Fixes the incorrect `test_plugin_translation_after_switching_locale_twice()` test which should have catch this issue earlier.
* Adds a new test plugin/theme to test the loading of translations with a custom language directory.
* Deprecates the now unused and private `_get_path_to_translation()` and `_get_path_to_translation_from_lang_dir()` functions.

Props yoavf, swissspidy, dd32, ocean90.
See #26511.
Fixes #39210.
Built from https://develop.svn.wordpress.org/trunk@49236


git-svn-id: http://core.svn.wordpress.org/trunk@48998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-20 16:05:07 +00:00
youknowriad d6cff7965a Block Editor: Update the WordPress Packages to the latest version.
This includes the packages that match the Gutenberg 9.2 Release.
It is going to be the last block-editor features update for WordPress 5.6.
It also updates the block-supports code base to the latest APIs.

Props isabel_brison, noisysocks, desrosj.
Fixes #51570.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48988 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-20 13:36:16 +00:00
TimothyBlynJacobs 039ce3f16f Site Health, REST API: Move async tests to REST API endpoints.
This provides more flexibility when writing tests and benefits from running in a front-end context which is necessary for some tests like checking that updates are supported. Additionally, this provides a more robust interface for developers who want to integrate with Site Health tests.

Because the `wp/v2` endpoint is reserved for modeling core entities, site health is registered in its own `wp-site-health/v1` namespace.

The existing ajax actions have been maintained for backward compatibility.

Props Clorith, chrisvanpatten, afragen, pokhriyal, TimothyBlynJacobs.
Fixes #48105.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48916 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-15 02:00:08 +00:00
Sergey Biryukov 620c069fe8 General: Move `wp_array_get()` from a separate file to `wp-includes/functions.php`, for consistency.
Add missing `@since` tag, adjust the DocBlock per the documentation standards.

Follow-up to [49135].

Props isabel_brison, ocean90.
Fixes #51461.
Built from https://develop.svn.wordpress.org/trunk@49143


git-svn-id: http://core.svn.wordpress.org/trunk@48905 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-14 02:10:04 +00:00
jorgefilipecosta b667105f60 Editor: update packages; Port block supports to WordPress core.
The following package versions were changed:
@wordpress/a11y: 2.11.0 -> 2.13.0
@wordpress/annotations: 1.20.4 -> 1.22.0
@wordpress/api-fetch: 3.18.0 -> 3.20.0
@wordpress/autop: 2.9.0 -> 2.10.0
@wordpress/blob: 2.9.0 -> 2.10.0
@wordpress/block-directory: 1.13.7 -> 1.16.0
@wordpress/block-editor: 4.3.7 -> 5.0.0
@wordpress/block-library: 2.22.7 -> 2.25.0
@wordpress/block-serialization-default-parser: 3.7.0 -> 3.8.0
@wordpress/blocks: 6.20.3 -> 6.23.0
@wordpress/components: 10.0.6 -> 11.0.0
@wordpress/compose: 3.19.3 -> 3.21.0
@wordpress/core-data: 2.20.3 -> 2.23.0
@wordpress/data: 4.22.3 -> 4.24.0
@wordpress/data-controls: 1.16.3 -> 1.18.0
@wordpress/date: 3.10.0 -> 3.12.0
@wordpress/deprecated: 2.9.0 -> 2.10.0
@wordpress/dom: 2.13.1 -> 2.15.0
@wordpress/dom-ready: 2.10.0 -> 2.11.0
@wordpress/e2e-test-utils: 4.11.2 -> 4.14.0
@wordpress/edit-post: 3.21.7 -> 3.24.0
@wordpress/editor: 9.20.7 -> 9.23.0
@wordpress/element: 2.16.0 -> 2.18.0
@wordpress/escape-html: 1.9.0 -> 1.10.0
@wordpress/format-library: 1.22.7 -> 1.24.0
@wordpress/hooks: 2.9.0 -> 2.10.0
@wordpress/html-entities: 2.8.0 -> 2.9.0
@wordpress/i18n: 3.14.0 -> 3.16.0
@wordpress/icons: 2.4.0 -> 2.7.0
@wordpress/is-shallow-equal: 2.1.0 -> 2.3.0
@wordpress/keyboard-shortcuts: 1.9.3 -> 1.11.0
@wordpress/keycodes: 2.14.0 -> 2.16.0
@wordpress/library-export-default-webpack-plugin: 1.7.0 -> 1.9.0
@wordpress/list-reusable-blocks: 1.21.6 -> 1.23.0
@wordpress/media-utils: 1.15.0 -> 1.17.0
@wordpress/notices: 2.8.3 -> 2.10.0
@wordpress/nux: 3.20.6 -> 3.22.0
@wordpress/plugins: 2.20.3 -> 2.22.0
@wordpress/primitives: 1.7.0 -> 1.9.0
@wordpress/priority-queue: 1.7.0 -> 1.9.0
@wordpress/redux-routine: 3.10.0 -> 3.12.0
@wordpress/rich-text: 3.20.4 -> 3.22.0
@wordpress/scripts: 12.1.1 -> 12.3.0
@wordpress/server-side-render: 1.16.6 -> 1.18.0
@wordpress/shortcode: 2.9.0 -> 2.11.0
@wordpress/token-list: 1.11.0 -> 1.13.0
@wordpress/url: 2.17.0 -> 2.19.0
@wordpress/viewport: 2.21.3 -> 2.23.0
@wordpress/warning: 1.2.0 -> 1.3.0
@wordpress/wordcount: 2.10.0 -> 2.12.0

Props isabel_brison, youknowriad, mcsf.
Fixes #51461.
Built from https://develop.svn.wordpress.org/trunk@49135


git-svn-id: http://core.svn.wordpress.org/trunk@48897 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-13 13:10:30 +00:00
TimothyBlynJacobs 49a399db05 REST API: Introduce search post format handler.
This allows for clients to search the used post formats via the /wp/v2/search endpoint by using a type=post-format query parameter.
Fixes #51459.
Props andraganescu, zieladam, noisysocks, TimothyBlynJacobs.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-12 19:54:05 +00:00
TimothyBlynJacobs d5ebe12f11 REST API: Introduce Application Passwords for API authentication.
In WordPress 4.4 the REST API was first introduced. A few releases later in WordPress 4.7, the Content API endpoints were added, paving the way for Gutenberg and countless in-site experiences. In the intervening years, numerous plugins have built on top of the REST API. Many developers shared a common frustration, the lack of external authentication to the REST API.

This commit introduces Application Passwords to allow users to connect to external applications to their WordPress website. Users can generate individual passwords for each application, allowing for easy revocation and activity monitoring. An authorization flow is introduced to make the connection flow simple for users and application developers.

Application Passwords uses Basic Authentication, and by default is only available over an SSL connection.

Props georgestephanis, kasparsd, timothyblynjacobs, afercia, akkspro, andraganescu, arippberger, aristath, austyfrosty, ayesh, batmoo, bradyvercher, brianhenryie, helen, ipstenu, jeffmatson, jeffpaul, joostdevalk, joshlevinson, kadamwhite, kjbenk, koke, michael-arestad, Otto42, pekz0r, salzano, spacedmonkey, valendesigns.
Fixes #42790.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-08 22:14:06 +00:00
TimothyBlynJacobs f5c67c386f REST API: Introduce search term handler.
This allows for clients to search the available terms via the `/wp/v2/search` endpoint by using a `type=term` query parameter.

Fixes #51458.
Props andraganescu, zieladam, noisysocks, TimothyBlynJacobs.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48865 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-08 01:32:05 +00:00
youknowriad 777872bdb1 Block Editor: Add the initial set of block patterns.
Included patterns:

text-two-columns
two-buttons
two-images
text-two-columns-with-images
text-three-columns-buttons
large-header
large-header-paragraph
three-buttons
quote
testimonials

Props mcsf, nrqsnchz.
See #50550.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48103 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-06 10:50:02 +00:00
gziolo eafcf52d18 Editor: Register core blocks on the server
Exposes all core blocks (excluding embeds) on the server to be used with the REST API block types endpoint.

Props spacedmonkey, timothyblynjacobs.
Fixes #50263.


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


git-svn-id: http://core.svn.wordpress.org/trunk@48031 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-01 12:29:03 +00:00
TimothyBlynJacobs 083134f694 REST API: Introduce plugin management and block directory endpoints.
These endpoints facilitate the Block Directory Inserter feature in Gutenberg. Users can now install, activate, deactivate, and delete plugins over the REST API. The block directoryendpoint allows searching for available blocks from the WordPress.org block directory.

Props cklee, talldanwp, noisysocks, joen, soean, youknowriad, dufresnesteven, gziolo, dd32, tellyworth, ryelle, spacedmonkey, TimothyBlynJacobs.
Fixes #50321.


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


git-svn-id: http://core.svn.wordpress.org/trunk@48011 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-01 04:24:03 +00:00
TimothyBlynJacobs 9f14967ff0 REST API: Introduce Block Types endpoint.
This endpoint allows a user to retrieve the block type definition for all server-side registered block types.

Props spacedmonkey, aduth, gziolo, ocean90, TimothyBlynJacobs.
Fixes #47620.

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


git-svn-id: http://core.svn.wordpress.org/trunk@47942 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-26 00:46:07 +00:00
gziolo 3f2e7804c4 Editor: Introduce WP_Block and WP_Block_List classes
Backports functionality added in Gutenberg in the following PRs:
- https://github.com/WordPress/gutenberg/pull/21467
- https://github.com/WordPress/gutenberg/pull/21925
It's a few ideas related to block rendering and the provided block value, which is particularly impactful for work around block context.

Props aduth, TimothyBJacobs, noisysocks, epiqueras, youknowriad, talldanwp, zebulan.
Fixes #49926.


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


git-svn-id: http://core.svn.wordpress.org/trunk@47928 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-25 05:16:11 +00:00
youknowriad 6d927e494c Block Editor: Add the Block Patterns API.
Backport WP_Block_Pattern_Categories_Registry, WP_Block_Patterns_Registry
and block patterns registration functions from the Gutenberg repository.

Props ocean90, ellatrix
Fixes #50445.

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


git-svn-id: http://core.svn.wordpress.org/trunk@47925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-24 12:59:11 +00:00
Pascal Birchler 609dd1d14f Sitemaps: Add XML sitemaps functionality to WordPress.
While web crawlers are able to discover pages from links within the site and from other sites, XML sitemaps supplement this approach by allowing crawlers to quickly and comprehensively identify all URLs included in the sitemap and learn other signals about those URLs using the associated metadata.

See https://make.wordpress.org/core/2020/06/10/merge-announcement-extensible-core-sitemaps/ for more details.

This feature exposes the sitemap index via `/wp-sitemap.xml` and exposes a variety of new filters and hooks for developers to modify the behavior. Users can disable sitemaps completely by turning off search engine visibility in WordPress admin.

This change also introduces a new `esc_xml()` function to escape strings for output in XML, as well as XML support to `wp_kses_normalize_entities()`.

Props Adrian McShane, afragen, adamsilverstein, casiepa, flixos90, garrett-eclipse, joemcgill, kburgoine, kraftbj, milana_cap, pacifika, pbiron, pfefferle, Ruxandra Gradina, swissspidy, szepeviktor, tangrufus, tweetythierry.
Fixes #50117.
See #3670. See #19998.

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


git-svn-id: http://core.svn.wordpress.org/trunk@47839 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-17 15:24:07 +00:00
desrosj a753e44d4e Bootstrap/Load: Deprecate `wp_unregister_GLOBALS()`.
The `register_globals` directive in PHP was deprecated in version 5.3 and removed entirely in 5.4.

Now that WordPress only supports PHP 5.6.20 and newer, the `wp_unregister_GLOBALS()` function can be deprecated.

Props ayeshrajans, desrosj, SergeyBiryukov.
Fixes #49938.
Built from https://develop.svn.wordpress.org/trunk@47612


git-svn-id: http://core.svn.wordpress.org/trunk@47387 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-22 15:42:09 +00:00
whyisjake 92636d716a Site Health instantiation prevents use of some hooks by plugins.
As the WP_Site_Health class is instantiated prior to plugins being required and the `plugins_loaded` hook being fired, it prevents plugins from using the following hooks in the functions called by `maybe_create_scheduled_event()`.

Fixes #49824.
Props peterwilsoncc, whyisjake.


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


git-svn-id: http://core.svn.wordpress.org/trunk@47343 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-10 03:57:08 +00:00
Sergey Biryukov 78e62aa3e4 Coding Standards: Whitelist `date_default_timezone_set()` usage in `wp-settings.php`.
See #49542.
Built from https://develop.svn.wordpress.org/trunk@47552


git-svn-id: http://core.svn.wordpress.org/trunk@47327 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-06 09:06:12 +00:00
jorgefilipecosta 56906bcf59 Block Editor: Update WordPress Packages; Remove navigation block; Add social links block
The following package versions were changed:
@wordpress/annotations: 1.11.0 -> 1.12.0
@wordpress/api-fetch: 3.10.0 -> 3.11.0
@wordpress/block-directory: 1.4.0 -> 1.5.0
@wordpress/block-editor: 3.6.0 -> 3.7.0
@wordpress/block-library: 2.13.0 -> 2.14.0
@wordpress/blocks: 6.11.0 -> 6.12.0
@wordpress/components: 9.1.0 -> 9.2.0
@wordpress/core-data: 2.11.0 -> 2.12.0
@wordpress/data: 4.13.0 -> 4.14.0
@wordpress/data-controls: 1.7.0 -> 1.8.0
@wordpress/e2e-test-utils: 4.2.0 -> 4.3.0
@wordpress/edit-post: 3.12.0 -> 3.13.0
@wordpress/editor: 9.11.0 -> 9.12.0
@wordpress/format-library: 1.13.0 -> 1.14.0
@wordpress/icons: 1.0.0 -> 1.1.0
@wordpress/keyboard-shortcuts: 1.0.0 -> 1.1.0
@wordpress/list-reusable-blocks: 1.12.0 -> 1.13.0
@wordpress/media-utils: 1.6.0 -> 1.7.0
@wordpress/notices: 1.12.0 -> 2.0.0
@wordpress/nux: 3.11.0 -> 3.12.0
@wordpress/plugins: 2.11.0 -> 2.12.0
@wordpress/primitives: 1.0.0 -> 1.1.0
@wordpress/rich-text: 3.11.0 -> 3.12.0
@wordpress/server-side-render: 1.7.0 -> 1.8.0
@wordpress/url: 2.10.0 -> 2.11.0
@wordpress/viewport: 2.12.0 -> 2.13.0
The navigation block inclusion was reverted.
The social links block was included.

Props gziolo, youknowriad, mcsf, noisysocks.
Fixes #49397.
Built from https://develop.svn.wordpress.org/trunk@47250


git-svn-id: http://core.svn.wordpress.org/trunk@47050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-10 22:33:27 +00:00
Sergey Biryukov c1fb007ff3 Docs: Add documentation for globals in `wp-settings.php`.
Props chinteshprajapati.
Fixes #46253.
Built from https://develop.svn.wordpress.org/trunk@47231


git-svn-id: http://core.svn.wordpress.org/trunk@47031 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-10 03:34:05 +00:00
Sergey Biryukov 47ed56f38f Code Modernization: Replace `dirname( __FILE__ )` calls with `__DIR__` magic constant.
This avoids the performance overhead of the function call every time `dirname( __FILE__ )` was used instead of `__DIR__`.

This commit also includes:

* Removing unnecessary parentheses from `include`/`require` statements. These are language constructs, not function calls.
* Replacing `include` statements for several files with `require_once`, for consistency:
 * `wp-admin/admin-header.php`
 * `wp-admin/admin-footer.php`
 * `wp-includes/version.php`

Props ayeshrajans, desrosj, valentinbora, jrf, joostdevalk, netweb.
Fixes #48082.
Built from https://develop.svn.wordpress.org/trunk@47198


git-svn-id: http://core.svn.wordpress.org/trunk@46998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-06 06:33:11 +00:00
jorgefilipecosta d7e321c7c7 Block Editor: Include navigation block server logic.
Core did not include the navigation block PHP files.
This commit fixes the issue referred, and now the navigation block is executed on the frontend. The block still does not work as expected and throws an error during frontend execution. That problem is going to be fixed on the next WordPress package update.
This commit adds the file as it is on the npm package used.

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


git-svn-id: http://core.svn.wordpress.org/trunk@46976 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-04 20:16:04 +00:00
Sergey Biryukov 0aff1cf6bd Site Health: Rename `WP_Site_Health::initialize()` introduced in [47063] to `::get_instance()`, for clarity and consistency with other core classes.
Use `WP_Site_Health::get_instance()` where it's needed, instead of creating multiple instances of the class.

Props afercia, xkon, Clorith, SergeyBiryukov.
See #47606.
Built from https://develop.svn.wordpress.org/trunk@47149


git-svn-id: http://core.svn.wordpress.org/trunk@46949 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-01 00:39:09 +00:00
Sergey Biryukov 001ffe81fb Docs: Improve inline comments per the documentation standards.
Includes minor code layout fixes for better readability.

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47122


git-svn-id: http://core.svn.wordpress.org/trunk@46922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-29 00:45:18 +00:00
Sergey Biryukov 2c4480958b Site Health: Introduce Site Health Status dashboard widget.
The widget informs administrators of any potential issues that should be addressed to improve the performance or security of their website, and directs them to the Site Health screen for more details.

Props Clorith, hedgefield, guddu1315.
See #47606.
Built from https://develop.svn.wordpress.org/trunk@47063


git-svn-id: http://core.svn.wordpress.org/trunk@46863 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-12 13:33:05 +00:00
Sergey Biryukov d858656023 Bootstrap/Load: Make handling the `/favicon.ico` requests more flexible.
Previously, `wp_favicon_request()` was introduced in [13205] to avoid a performance hit of serving a full 404 page on every favicon request.

While working as intended, that implementation did not provide a way for theme or plugin authors to manage the behavior of favicon requests.

This changeset implements the following logic (only applied if WordPress is installed in the root directory):

* If there is a Site Icon set in Customizer, redirect `/favicon.ico` requests to that icon.
* Otherwise, use the WordPress logo as a default icon.
* If a physical `/favicon.ico` file exists, do nothing, let the server handle the request.

Handling `/favicon.ico` is now more consistent with handling `/robots.txt` requests.

New functions and hooks:

* Introduce `is_favicon()` conditional tag to complement `is_robots()`.
* Introduce `do_favicon` action to complement `do_robots` and use it in template loader.
* Introduce `do_favicon()` function, hooked to the above action by default, to complement `do_robots()`.
* Introduce `do_faviconico` action to complement `do_robotstxt`, for plugins to override the default behavior.
* Mark `wp_favicon_request()` as deprecated in favor of `do_favicon()`.

Props jonoaldersonwp, birgire, joostdevalk, mukesh27, SergeyBiryukov.
Fixes #47398.
Built from https://develop.svn.wordpress.org/trunk@47018


git-svn-id: http://core.svn.wordpress.org/trunk@46818 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-28 21:20:04 +00:00
gziolo aca0d9968f Block Editor: Remove experimental Social Links blocks
We decided to mark Social Links block as an experimental feature in Gutenberg. In effect, we are moving all related code from WordPress 5.3 release.

Props youknowriad.

Fixes #48263.


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


git-svn-id: http://core.svn.wordpress.org/trunk@46340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-15 15:37:08 +00:00