Commit Graph

99 Commits

Author SHA1 Message Date
Weston Ruter 9702c2e265 Embeds: Enable lazy-loading of post embeds and fix keyboard a11y for hidden iframes.
Chrome unreliably loads a lazy-loaded iframe when it is hidden using `clip: rect(1px, 1px, 1px, 1px)`. Instead of using `clip`, a lazy-loaded iframe can also be hidden with `visibility:hidden` which results in it loading not only in Chrome but all other browsers. With this change applied, the hard-coded check to prevent lazy-loading post embeds is now removed. An added benefit to using `visibility:hidden` is that the entire iframe in this case is not interactable, meaning that users navigating the document with the keyboard will not unexpectedly encounter tab stops inside of the hidden iframe, as can happen now with `clip` when the JS fails to reveal the loaded iframe. Note also that the `clip` property is deprecated.

Lastly, when such a post embed iframe is rendered in an RSS feed, the `style` attribute is now removed using the HTML Tag Processor as opposed to using string replacement.

Fixes #58773.
Props westonruter, joemcgill, swissspidy, joedolson, adamsilverstein.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57608 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-13 22:39:16 +00:00
John Blackbourn 9feb8a6925 Bootstrap/Load: Add support for custom ports in multisite site addresses.
This allows a Multisite network to use an address that includes a port name, such as `example.com:1234`, and adds support for this to the local development environment too. You can now run a Multisite installation on the local development environment, for example at `localhost:8889`.

This also fixes some bugs with running a single site installation on a port, and updates the testing infrastructure so that the whole test suite runs both with and without a port number.

Props djzone, scribu, nacin, ipstenu, F J Kaiser, jeremyfelt, johnjamesjacoby, spacedmonkey, PerS, Clorith, Blackbam, enrico.sorcinelli, Jules Colle, obliviousharmony, desrosj, johnbillion

Fixes #21077, #52088
Built from https://develop.svn.wordpress.org/trunk@58097


git-svn-id: http://core.svn.wordpress.org/trunk@57562 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-04 19:25:10 +00:00
Pascal Birchler 00d06db33d Docs: Fix various typos and spelling mistakes.
Props swissspidy, jucaduca, sergeybiryukov.
See #60699.
Built from https://develop.svn.wordpress.org/trunk@57987


git-svn-id: http://core.svn.wordpress.org/trunk@57473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-12 17:47:13 +00:00
Sergey Biryukov 4d6941a48b Docs: Add a description for the `$wp_embed` global.
Follow-up to [57748].

See #60699.
Built from https://develop.svn.wordpress.org/trunk@57785


git-svn-id: http://core.svn.wordpress.org/trunk@57286 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-03-06 05:05:12 +00:00
Pascal Birchler f97698702d General: Consistently cast return value to `int` in functions that use `ceil()`.
The return value of `ceil()` is still of type `float` as the value range of `float` is usually bigger than that of `int`.

Props crstauf, audrasjb.
Fixes #58683.
Built from https://develop.svn.wordpress.org/trunk@57648


git-svn-id: http://core.svn.wordpress.org/trunk@57149 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-17 15:24:08 +00:00
spacedmonkey 72f19abd94 Script Loader: Replace hardcoded output of style tags with calls to `wp_add_inline_style`.
In this commit, enhancements have been made by replacing manually constructed style tags with calls to `wp_add_inline_style`. Previously, numerous style tags were generated and output directly in the header, resulting in redundant code and bypassing the core's style enqueueing system. This approach made it challenging for third-party developers to manage and control the output of these style tags.

To ensure backward compatibility, the following functions have been deprecated and replaced:

- print_embed_styles
- print_emoji_styles
- wp_admin_bar_header
- _admin_bar_bump_cb

Backward compatibility shims have also been added, ensuring that if these functions were previously unhooked from there actions, they will continue to not output a style tag.

However, for the following functions, conversion to use inline styles was not feasible due to the potential disruption it might cause by changing the style tag IDs, potentially breaking JavaScript functionality for a number of plugins in the repository:

- custom-background
- wp-custom

These changes improve code maintainability and enhance the flexibility and control available to developers when managing style outputs within WordPress core.

Props spacedmonkey, hlunter, westonruter, flixos90.
Fixes #58775.
Built from https://develop.svn.wordpress.org/trunk@56682


git-svn-id: http://core.svn.wordpress.org/trunk@56194 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-25 17:06:34 +00:00
audrasjb 8c76c6d58c Docs: Replace multiple single line comments with multi-line comments.
This changeset updates various comments as per WordPress PHP Inline Documentation Standards.
See https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#5-inline-comments.

Follow-up to [56174], [56175], [56176], [56177], [56178], [56179].

Props costdev, audrasjb.
See #58459.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55692 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-09 21:48:22 +00:00
joedolson 82f3535083 Embeds: Fix missing labels and duplicate IDs.
Add `aria-label` and `aria-describedby` to provide embed form fields with accessible names and ensure each embed has a unique ID attribute to prevent duplicate IDs.

Props afercia, swissspidy.
Fixes #55664.
Built from https://develop.svn.wordpress.org/trunk@53912


git-svn-id: http://core.svn.wordpress.org/trunk@53471 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-19 22:06:09 +00:00
Sergey Biryukov 1069ac4afd Posts, Post Types: Standardize on `$post` parameter name where appropriate.
This renames the `$post_id` or `$id` parameters to `$post` for functions that accept a post ID or post object:

* `get_sample_permalink()`
* `get_sample_permalink_html()`
* `wp_check_post_lock()`
* `wp_set_post_lock()`
* `get_the_tags()`
* `comment_class()`
* `get_comment_class()`
* `get_comments_link()`
* `get_comments_number()`
* `comments_number()`
* `get_comments_number_text()`
* `comments_open()`
* `pings_open()`
* `comment_form()`
* `do_trackbacks()`
* `pingback()`
* `post_permalink()`
* `get_post_permalink()`
* `get_edit_post_link()`
* `edit_post_link()`
* `get_delete_post_link()`
* `post_class()`
* `get_post_class()`
* `the_attachment_link()`
* `wp_get_attachment_link()`
* `wp_list_post_revisions()`
* `check_and_publish_future_post()`
* `add_ping()`
* `get_pung()`
* `get_to_ping()`
* `wp_get_post_revisions()`
* `wp_get_post_revisions_url()`

Additionally, `$revision_id` is renamed to `$revision` in:

* `wp_restore_post_revision()`
* `wp_delete_post_revision()`

Includes minor documentation improvements for consistency and code layout fixes for better readability.

Follow-up to [1599], [1794], [2881], [3303], [3851], [5302], [6633], [6716], [6985], [7103], [7149], [7747], [8011], [8638], [8643], [8695], [9138], [9273], [11425], [11922], [11956], [12284], [12810], [12923], [13023], [13171], [25567], [27156], [27473], [28558], [28602], [33659], [38852], [47276], [47366], [48622], [49544], [49597], [52095].

See #56243, #55647.
Built from https://develop.svn.wordpress.org/trunk@53715


git-svn-id: http://core.svn.wordpress.org/trunk@53274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-18 17:37:17 +00:00
Sergey Biryukov 01d172b581 General: Replace all `esc_url_raw()` calls in core with `sanitize_url()`.
This aims to improve performance by calling `sanitize_url()` directly, instead of the `esc_url_raw()` wrapper. As of WordPress 6.1, `sanitize_url()` is the recommended function for sanitizing a URL for database or redirect usage.

Follow-up to [11383], [13096], [51597], [53452].

Props benjgrolleau, peterwilsoncc, SergeyBiryukov.
Fixes #55852.
Built from https://develop.svn.wordpress.org/trunk@53455


git-svn-id: http://core.svn.wordpress.org/trunk@53044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-01 18:14:10 +00:00
Sergey Biryukov 521db02647 Docs: Further remove HTML markup from various function summaries.
Per the [https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#summary-formerly-short-description WordPress PHP documentation standards], no HTML markup or Markdown of any kind should be used in the summary. This ensures that the summary is displayed correctly in the [https://developer.wordpress.org/reference/ WordPress Code Reference].

This commit also improves formatting of HTML special characters in descriptions in `wp-includes/formatting.php`.

Follow-up to [53048].

Props johnbillion, mukesh27.
Fixes #55506.
Built from https://develop.svn.wordpress.org/trunk@53053


git-svn-id: http://core.svn.wordpress.org/trunk@52642 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-02 13:55:11 +00:00
audrasjb 90100ff883 Embeds: Fix oEmbed host script enqueueing on block-based themes.
This change fixes oEmbed host script enqueueing on front-end when using block themes.

It deprecates `wp_oembed_add_host_js` in favor of `wp_maybe_enqueue_oembed_host_js`. The action is still triggered in `default-filters.php` to ensure backward compatibility for websites that are removing the action. There is now a `has_action()` check in `wp_maybe_enqueue_oembed_host_js()` to see if `wp_oembed_add_host_js()` has not been unhooked from running at the `wp_head` action.

Follow-up to [52132], [52151], [52153], [52325].

Props swissspidy, westonruter, flixos90, kafleg.
Fixes #44632.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-01-04 15:23:59 +00:00
John Blackbourn 39bff93b6b Docs: Various inline documentation corrections and improvements.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@51924 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-07 12:20:02 +00:00
Weston Ruter 718adc4c9d Embeds: Fix parsing of post embeds in `wp_filter_oembed_result()` by appending `wp-embed` script instead of prepending it in `get_post_embed_html()`.
Due to the way that the `blockquote` and `iframe` are being parsed with a regular expression in `wp_filter_oembed_result()`, if there is any content at all before the `blockquote` start tag then it will fail to be included in the first matching group. By appending the `wp-embed` script instead of prepending it in `get_post_embed_html()`, then the parsing issue is avoided.

Also use non-greedy match `wp_maybe_enqueue_oembed_host_js()`.

Amends [52132].
Fixes #44632.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51745 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-13 07:28:00 +00:00
Weston Ruter b665eab47e Embeds: Fix inclusion of `wp-embed-template` script and style when `SCRIPT_DEBUG` is disabled.
Amends [52132].
See #44632.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-13 00:58:59 +00:00
Weston Ruter 9038612705 Embeds: Conditionally enqueue `wp-embed` only if needed and send `ready` message in case script loads after post embed windows.
* Prevent loading `wp-embed` script unconditionally on every page in favor of conditionally enqueueing when a post embed is detected. The `wp-embed` script is also explicitly marked as being in the footer group. Sites which currently disable post embed scripts from being enqueued via `remove_action( 'wp_head', 'wp_oembed_add_host_js' )` will continue to do so.
* Send a `ready` message from the host page to each post embed window in case the `iframe` loads before the `wp-embed` script does. When the `ready` message is received by the post embed window, it sends the same `height` message as it sends when it loads.
* Eliminate use of `grunt-include` to inject emoji script and the post embed script. Instead obtain the script contents via `file_get_contents()` (as is done elsewhere in core) and utilize `wp_print_inline_script_tag()`/`wp_get_inline_script_tag()` to construct out the script. This simplifies the logic and allows the running of src without `SCRIPT_DEBUG` enabled.
* For the embed code that users are provided to copy for embedding outside of WP, add the `secret` on the `blockquote` and `iframe`. This ensures the `blockquote` will be hidden when the `iframe` loads. The embed code in question is accessed here via `get_post_embed_html()`.

Props westonruter, swissspidy, pento, flixos90, ocean90.
Fixes #44632, #44306.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51724 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-11 02:49:18 +00:00
ryelle c11fbdc7ae Coding Standards: Apply coding standards on CSS.
Remove units when the value is zero. Combine redundant values in shorthand declarations.
This was generated with `stylelint --fix` and a custom config (see #53866).

Props ankitmaru, audrasjb, pbiron, ayeshrajans, hareesh-pillai, netweb, mukesh27.
Fixes #53866.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51333 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-02 22:18:00 +00:00
John Blackbourn 79685db062 Docs: Corrections and improvements to types used in docblocks for symbols, properties, and filters.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@50907 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 21:02:57 +00:00
Sergey Biryukov d3d78e755b Coding Standards: Add a space before `/` character in some self-closing HTML tags.
While this has no effect on the code, it fixes a minor inconsistency with the rest of core.

Props laxman-prajapati.
Fixes #52870.
Built from https://develop.svn.wordpress.org/trunk@50556


git-svn-id: http://core.svn.wordpress.org/trunk@50169 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-03-20 18:30:08 +00:00
Sergey Biryukov a088b586ec Embeds: Allow posts with a public custom post status to be embedded.
Previously, only posts with the `publish` status could be embedded.

Props goaroundagain, peterwilsoncc, poena.
Fixes #47574.
Built from https://develop.svn.wordpress.org/trunk@50401


git-svn-id: http://core.svn.wordpress.org/trunk@50012 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-22 13:23:04 +00:00
Sergey Biryukov a9d04adf20 Robots: Rename `wp_embed_no_robots` to `wp_robots_noindex_embeds()`.
This brings the naming in line with `wp_robots_noindex_search()`.

Follow-up to [49992], [50370].

See #51511, #52457.
Built from https://develop.svn.wordpress.org/trunk@50371


git-svn-id: http://core.svn.wordpress.org/trunk@49982 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-17 10:51:04 +00:00
ryelle fed21a9863 Administration: Standardize colors used in CSS to a single palette.
This is part of a larger project in cleaning up core's admin CSS. This collapses all colors used in the CSS to one of 12 blues, greens, reds, and yellows, 13 grays, pure black, and pure white. The colors are perceptually uniform from light to dark, half of each range has a 4.5 or higher contrast against white, the other half has a 4.5 or higher contrast against black.

Standardizing on this set of colors will help contributors make consistent, accessible design decisions. The full color palette can be seen here: https://codepen.io/ryelle/full/WNGVEjw

Props notlaura, danfarrow, kburgoine, drw158, audrasjb, Joen, hedgefield, ibdz, melchoyce.
See #49999.


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


git-svn-id: http://core.svn.wordpress.org/trunk@49726 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-26 18:54:59 +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
desrosj ebeaae9de0 Build/Test Tools: Update the `uglify-js` package.
This updates the `uglify-js` package from version `3.12.4` to `3.12.5`.

See #51801.
Built from https://develop.svn.wordpress.org/trunk@49989


git-svn-id: http://core.svn.wordpress.org/trunk@49690 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-20 13:35:18 +00:00
desrosj 05f174acf6 Build/Test Tools: Update UglifyJS to the latest version.
This updates the `uglify-js` package from version `3.6.0` to `3.12.4`.

See #51801.
Built from https://develop.svn.wordpress.org/trunk@49940


git-svn-id: http://core.svn.wordpress.org/trunk@49639 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-06 15:29:24 +00:00
John Blackbourn b59c0f307b Docs: Corrections and improvements to types used in various docblocks.
See #51800, #52217

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


git-svn-id: http://core.svn.wordpress.org/trunk@49635 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-05 17:16:11 +00:00
Sergey Biryukov 82d074fb0a Docs: Use typed array notation for the `$size` parameter of `embed_defaults` filter.
Previously committed in [42876], accidentally reverted in [44154].

See #51800.
Built from https://develop.svn.wordpress.org/trunk@49698


git-svn-id: http://core.svn.wordpress.org/trunk@49421 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-25 12:14:05 +00:00
Sergey Biryukov 1642f9bb1d Docs: Document the `$args` parameter of `wp_oembed_get()`.
Link to `wp_oembed_get()` as the canonical source when documenting additional arguments in various `WP_oEmbed` methods.

Follow-up to [49620].

See #51269.
Built from https://develop.svn.wordpress.org/trunk@49626


git-svn-id: http://core.svn.wordpress.org/trunk@49364 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-17 10:11:11 +00:00
desrosj 025f5a62a2 Embeds: Disable embeds on deactivated Multisite sites.
Props xknown, whyisjake, zieladam, peterwilsoncc.
Merges [49374] to trunk.
Built from https://develop.svn.wordpress.org/trunk@49383


git-svn-id: http://core.svn.wordpress.org/trunk@49142 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-29 18:02:05 +00:00
Sergey Biryukov 272df00b17 Embeds: Only catch clicks from the primary mouse button in the click handler, without any modifier keys.
This ensures that Ctrl/Cmd + click to open a link in the embed iframe in a new tab works as expected.

Props timhavinga, garrett-eclipse, smerriman, swissspidy, johnbillion, Mte90, iandunn, azaozz, afercia, audrasjb, SergeyBiryukov.
Fixes #39097.
Built from https://develop.svn.wordpress.org/trunk@49202


git-svn-id: http://core.svn.wordpress.org/trunk@48964 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-19 13:36:08 +00:00
Sergey Biryukov 0e3147c40e Coding Standards: Replace alias PHP functions with the canonical names.
Using the canonical function name for PHP functions is strongly recommended, as aliases may be deprecated or removed without (much) warning.

This replaces all uses of the following:
* `join()` with `implode()`
* `sizeof()` with `count()`
* `is_writeable()` with `is_writable()`
* `doubleval()` with a `(float)` cast

In part, this is a follow-up to #47746.

Props jrf.
See #50767.
Built from https://develop.svn.wordpress.org/trunk@49193


git-svn-id: http://core.svn.wordpress.org/trunk@48955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-18 17:27:06 +00:00
John Blackbourn 782f05d2c5 Docs: Various fixes and improvements to inline documentation.
See #49572
Built from https://develop.svn.wordpress.org/trunk@48695


git-svn-id: http://core.svn.wordpress.org/trunk@48457 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-30 19:14:03 +00:00
John Blackbourn 0bf9b04c53 Docs: Various formatting improvements to inline docblocks.
See #49572
Built from https://develop.svn.wordpress.org/trunk@48574


git-svn-id: http://core.svn.wordpress.org/trunk@48336 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-23 00:52:05 +00:00
Sergey Biryukov b16368c268 Docs: Remove `@staticvar` tags from core.
The tag was supported in phpDocumentor 1.x, but is no longer supported in 2.x and 3.x.

Usage of static variables is considered an internal implementation detail and has no information value for someone reading the docs.

Props alishanvr, jrf.
Fixes #50426.
Built from https://develop.svn.wordpress.org/trunk@48109


git-svn-id: http://core.svn.wordpress.org/trunk@47878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 12:40:12 +00:00
Sergey Biryukov a576a13246 Docs: Remove an empty line between `@param` and `@return` tags, per the documentation standards.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48102


git-svn-id: http://core.svn.wordpress.org/trunk@47871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 11:18:09 +00:00
whyisjake 2ae3b3b801 Embeds: Ensure that the title attribute is set correctly on embeds.
Props xknown.

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


git-svn-id: http://core.svn.wordpress.org/trunk@47719 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-10 17:20:10 +00:00
Sergey Biryukov 23c4fbeaa0 Customize: Load the default site icon from the `wp-includes` directory.
Files inside the `wp-admin` directory may not be publicly available.

Follow-up to [36635], [47018].

Props whyisjake, finomeno, ocean90.
Fixes #50131.
Built from https://develop.svn.wordpress.org/trunk@47832


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

Includes minor code layout fixes for better readability.

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


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


git-svn-id: http://core.svn.wordpress.org/trunk@47019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-09 16:55:09 +00:00
Sergey Biryukov dd4d98a368 Docs: In various `@return` tags, list the expected type first, instead of `false`.
Follow-up to [46696].

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


git-svn-id: http://core.svn.wordpress.org/trunk@46860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-11 18:32:05 +00:00
John Blackbourn f545bb3f63 Docs: Improve documentation of known return types, plus other docs fixes.
See #48303

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


git-svn-id: http://core.svn.wordpress.org/trunk@46460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-05 21:23:02 +00:00
Sergey Biryukov 8b76312eb3 Docs: Correct some array hash notations added in [46644].
See #48303.
Built from https://develop.svn.wordpress.org/trunk@46647


git-svn-id: http://core.svn.wordpress.org/trunk@46447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-04 09:37:02 +00:00
John Blackbourn b3d6acd6a4 Docs: Fix some incorrect return tags in docblocks.
See #48303

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


git-svn-id: http://core.svn.wordpress.org/trunk@46444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-03 22:23:01 +00:00
Sergey Biryukov 49007e52bc Build/Test Tools: Add banner to RTL CSS and minified JS files.
Patches occasionally come in on generated files. We should be kind to new contributors and give them a hint that these files are auto-generated.

This is a follow-up to [41271], which added the banner to minified CSS files.

Fixes #48424. See #30666.
Built from https://develop.svn.wordpress.org/trunk@46589


git-svn-id: http://core.svn.wordpress.org/trunk@46386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-26 00:17:07 +00:00
Aaron Jorbin 0e21d32900 Build/Test: Bump devDependencies for WordPress 5.3
This upgrades a number of devDependencies.  Some of these include changes to how the tasks are configured.

Uglify: There are deprecated options from 2.x to 4.x, see: https://github.com/gruntjs/grunt-contrib-uglify#options

Autoprefixer: Browserslist now warns when passing in the browser list, so that is put into package.json

As with most changes to uglify, this changes every minified JS file.

Fixes #48203.



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


git-svn-id: http://core.svn.wordpress.org/trunk@46206 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-05 19:49:10 +00:00
Sergey Biryukov 252628652e 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.
Built from https://develop.svn.wordpress.org/trunk@46164


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

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


git-svn-id: http://core.svn.wordpress.org/trunk@45743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-03 00:41:05 +00:00
Sergey Biryukov 16b8d91baa I18N: Improve translator comments.
* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.

Includes minor code layout fixes.

Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!

Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926


git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 17:13:59 +00:00
Sergey Biryukov 90b2092ab6 CSS Coding Standards: Use unitless values for `line-height` in `wp-includes/css/wp-embed-template.css`.
Props ianbelanger, pbiron, afercia.
Fixes #46524. See #44643.
Built from https://develop.svn.wordpress.org/trunk@45474


git-svn-id: http://core.svn.wordpress.org/trunk@45285 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-05-30 12:40:52 +00:00
John Blackbourn 27365c4ec4 Build/Test Tools: Remove the dependency on a globally installed Grunt.
The existing `"grunt": "grunt"` script in `package.json` allows for the use of `npm run grunt ...` which uses the local `grunt` binary in the project's `node_modules`.

Fixes #47380

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


git-svn-id: http://core.svn.wordpress.org/trunk@45256 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-05-26 19:35:51 +00:00