Commit Graph

543 Commits

Author SHA1 Message Date
John Blackbourn
391fc25eed Docs: Various docblock corrections and improvements.
See #51800

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


git-svn-id: http://core.svn.wordpress.org/trunk@50006 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-20 17:10:11 +00:00
Sergey Biryukov
7ced0efbf4 Docs: Use more consistent descriptions for void|false return values.
See #51800.
Built from https://develop.svn.wordpress.org/trunk@49935


git-svn-id: http://core.svn.wordpress.org/trunk@49634 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-05 16:48:07 +00:00
John Blackbourn
dfe1f9b322 Docs: Promote many bool types to true or false where only that value is used.
See #51800

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


git-svn-id: http://core.svn.wordpress.org/trunk@49626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-03 22:04:04 +00:00
Sergey Biryukov
bb0b36a905 Themes: Clarify the _doing_it_wrong() message for post formats in add_theme_support().
Follow-up to [49344], [49354], [49365].

See #51390.
Built from https://develop.svn.wordpress.org/trunk@49367


git-svn-id: http://core.svn.wordpress.org/trunk@49126 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-29 00:08:06 +00:00
Sergey Biryukov
d0268b2b69 Themes: Move the test for post-formats theme support to a more appropriate place.
Follow-up to [49344].

See #51390.
Built from https://develop.svn.wordpress.org/trunk@49354


git-svn-id: http://core.svn.wordpress.org/trunk@49114 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-28 15:14:10 +00:00
Helen Hou-Sandí
3fc623c202 Post Formats: You have to pass an array of supported post formats.
This shows a `_doing_it_wrong()` message and also returns false instead of true if no array of formats is passed in `add_theme_support()`, avoiding a PHP error.

Post formats maintainership comes full circle. 🙃

Props Mista-Flo, sproutchris, garrett-eclipse.
Fixes #51390.

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


git-svn-id: http://core.svn.wordpress.org/trunk@49104 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-27 20:00:06 +00:00
Sergey Biryukov
caa75a04a8 Themes: Add a return value to set_theme_mod() to allow for error handling.
Props latifi, hareesh-pillai.
Fixes #51296.
Built from https://develop.svn.wordpress.org/trunk@49214


git-svn-id: http://core.svn.wordpress.org/trunk@48976 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-19 22:45:03 +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
Sergey Biryukov
12a36355e6 Code Modernization: Remove a single trailing percent sign before calling sprintf() on the $default parameter in get_theme_mod().
This avoids a "Missing format specifier at end of string" fatal error on PHP 8, and maintains the current behaviour.

See #50913.
Built from https://develop.svn.wordpress.org/trunk@49068


git-svn-id: http://core.svn.wordpress.org/trunk@48830 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-29 10:03:08 +00:00
Sergey Biryukov
7690f48cec Themes: Add unlink-homepage-logo to the create_initial_theme_features() registration for the custom-logo theme feature.
Follow-up to [48039], [48283], [48749].

Props TimothyBlynJacobs.
Fixes #37011.
Built from https://develop.svn.wordpress.org/trunk@48757


git-svn-id: http://core.svn.wordpress.org/trunk@48519 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-07 19:43:05 +00:00
Sergey Biryukov
df6e548b14 Accessibility: Themes: Only unlink custom logo on the home page if the theme declares support for that.
To accommodate for the change, the `custom-logo` theme feature now accepts the `unlink-homepage-logo` parameter.

If and when the logo is linked on the home page, the link has the `aria-current` attribute for better accessibility.

Follow-up to [48039], [48283].

Props sabernhardt, audrasjb, johnstonphilip, demetris.
Fixes #37011.
Built from https://develop.svn.wordpress.org/trunk@48749


git-svn-id: http://core.svn.wordpress.org/trunk@48511 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-07 15:26:03 +00:00
Sergey Biryukov
92f66488a3 I18N: Remove <code> tags in invalid_rest_prepare_callback error message in register_theme_feature() for consistency with other strings.
Follow-up to [48611].

See #50758.
Built from https://develop.svn.wordpress.org/trunk@48612


git-svn-id: http://core.svn.wordpress.org/trunk@48374 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-25 16:39:05 +00:00
Sergey Biryukov
ac0b77f33c I18N: Move code out of a translatable string in register_theme_feature().
Props ramiy.
Fixes #50758.
Built from https://develop.svn.wordpress.org/trunk@48611


git-svn-id: http://core.svn.wordpress.org/trunk@48373 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-25 16:31:05 +00:00
Sergey Biryukov
4fcbb1ee5d Docs: Add a mention of core-block-patterns as a possible value for add_theme_support().
Follow-up to [48492].

See #50669.
Built from https://develop.svn.wordpress.org/trunk@48598


git-svn-id: http://core.svn.wordpress.org/trunk@48360 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-24 01:21:01 +00:00
John Blackbourn
9bc7d0a776 Docs: Another pass at some inline docs fixes mostly made by PHPCBF.
See #49572, #50744
Built from https://develop.svn.wordpress.org/trunk@48590


git-svn-id: http://core.svn.wordpress.org/trunk@48352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-23 21:11:05 +00:00
John Blackbourn
124972f2c6 Docs: Further corrections and improvements to various inline docblocks.
See #49572
Built from https://develop.svn.wordpress.org/trunk@48576


git-svn-id: http://core.svn.wordpress.org/trunk@48338 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-23 07:39:02 +00:00
John Blackbourn
1fbcdb2213 Docs: Various corrections to inline docblocks.
See #49572
Built from https://develop.svn.wordpress.org/trunk@48573


git-svn-id: http://core.svn.wordpress.org/trunk@48335 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-23 00:48:06 +00:00
Sergey Biryukov
4d8ef49618 Docs: Add return value description for register_theme_directory().
Props stevenlinx.
Fixes #50665.
Built from https://develop.svn.wordpress.org/trunk@48491


git-svn-id: http://core.svn.wordpress.org/trunk@48253 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-15 12:10:06 +00:00
Sergey Biryukov
9515141741 Docs: Link to add_theme_support() for the list of supported theme features in current_theme_supports() and related functions.
Props stevenlinx.
Fixes #50657.
Built from https://develop.svn.wordpress.org/trunk@48490


git-svn-id: http://core.svn.wordpress.org/trunk@48252 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-15 11:23:06 +00:00
Sergey Biryukov
5aa7f46a4f Docs: Improve DocBlocks in wp-includes/theme.php per the documentation standards.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48189


git-svn-id: http://core.svn.wordpress.org/trunk@47958 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-27 12:02:03 +00:00
TimothyBlynJacobs
9dc7058be9 Themes: Introduce register_theme_feature API.
Currently themes can declare support for a given feature by using add_theme_support(). This commit adds a register_theme_feature() API that allows plugins and WordPress Core to declare a list of available features that themes can support.

The REST API uses this to expose a theme's supported features if the feature has been registered with "show_in_rest" set to true.

Props kadamwhite, spacedmonkey, williampatton, desrosj, TimothyBlynJacobs.
Fixes #49406.

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


git-svn-id: http://core.svn.wordpress.org/trunk@47940 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-25 22:13:10 +00:00
desrosj
b83d6bd777 Docs: Remove the custom-header-uploads feature from docs.
This was deprecated in [20212] in favor of passing `”uploads” => true` to the `custom-header` feature, so it should not be specified as an available feature in the parameter documentation.

See #49572.
Built from https://develop.svn.wordpress.org/trunk@48169


git-svn-id: http://core.svn.wordpress.org/trunk@47938 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-25 17:41:08 +00:00
Sergey Biryukov
f1e9bdd9b5 Docs: Add missing @return description for some theme functions:
* `get_stylesheet_directory_uri()`
* `get_stylesheet_uri()`
* `get_locale_stylesheet_uri()`

Props stevenlinx.
Fixes #50450.
Built from https://develop.svn.wordpress.org/trunk@48138


git-svn-id: http://core.svn.wordpress.org/trunk@47907 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-23 10:48:09 +00:00
Sergey Biryukov
0a2d2b93e6 Docs: Synchronize descriptions for some theme functions:
* `get_stylesheet_directory()`
* `get_stylesheet_directory_uri()`
* `get_template_directory()`
* `get_template_directory_uri()`

See #49572.
Built from https://develop.svn.wordpress.org/trunk@48137


git-svn-id: http://core.svn.wordpress.org/trunk@47906 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-23 10:43:09 +00:00
desrosj
4b60af1a6a General: Remove “whitelist” and “blacklist” in favor of more clear and inclusive language.
“The WordPress open source community cares about diversity. We strive to maintain a welcoming environment where everyone can feel included.”

With this commit, all occurrences of “whitelist” and “blacklist” (with the single exception of the `$new_whitelist_options` global variable) are removed. A new ticket has been opened to explore renaming the `$new_whitelist_options` variable (#50434).

Changing to more specific names or rewording sentences containing these terms not only makes the code more inclusive, but also helps provide clarity. These terms are often ambiguous. What is being blocked or allowed is not always immediately clear. This can make it more difficult for non-native English speakers to read through the codebase.

Words matter. If one contributor feels more welcome because these terms are removed, this was worth the effort.

Props strangerstudios, jorbin, desrosj, joemcgill, timothyblynjacobs, ocean90, ayeshrajans, davidbaumwald, earnjam.
See #48900, #50434.
Fixes #50413.
Built from https://develop.svn.wordpress.org/trunk@48121


git-svn-id: http://core.svn.wordpress.org/trunk@47890 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-22 17:26:13 +00:00
Andrea Fercia
ae447adaf4 I18N: Restore the "Error:" prefix for error messages.
Partially reverts [48059] as there's no full consensus on the removal of the text prefix. Further actions should be taken to improve consistency and accessibility of the admin notices. Keeps some improvements to the translatable strings from [48059].

Fixes #47656.

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


git-svn-id: http://core.svn.wordpress.org/trunk@47884 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-21 14:00:09 +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
e13c363b17 Docs: Capitalize "ID", when referring to a post ID, term ID, etc. in a more consistent way.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48104


git-svn-id: http://core.svn.wordpress.org/trunk@47873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 12:02:12 +00:00
desrosj
019bc2d244 Docs: Add missing return type for _remove_theme_support().
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48091


git-svn-id: http://core.svn.wordpress.org/trunk@47858 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-19 14:46:10 +00:00
Sergey Biryukov
de59ad23a4 Docs: Consistently include an empty line between @since tag and @see, @link, or @global, per the documentation standards.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48067


git-svn-id: http://core.svn.wordpress.org/trunk@47834 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-16 21:07:14 +00:00
Andrea Fercia
f83c504b88 I18N: Remove the "Error:" prefix from error messages.
For a number of years, most of the WordPress error messages have been prefixed with "Error:". However, these messages appear in a context where it's already clear an error occurred. Whether it's an error, a warning, or any other classification, that's not so relevant for users. The content of the message is the relevant part. The "Error:" prefix doesn't add great value while it does add unnecessary complexity for the message readability.

Also, revises some of these messages to improve clarity and removes HTML from translatable strings.

Props garrett-eclipse, ramiy, SergeyBiryukov, afercia, sabernhardt, quadthemes, audrasjb. 
See #47003, #43037, #42945, #15887.
Fixes #47656.

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


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

Includes minor code layout fixes for better readability.

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


git-svn-id: http://core.svn.wordpress.org/trunk@47584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-16 18:42:12 +00:00
Dominik Schilling
7ded6c2d2a Administration: Remove any CSS related to Internet Explorer versions 6 – 10.
In WordPress 3.2 support for IE6 was dropped, IE7 followed a few versions later. With the 4.8 release, WordPress officially ended support for Internet Explorer versions 8, 9, and 10. Yet, we still have shipped CSS for the unsupported IE versions....until now! Goodbye to ie.css and star hacks!

* Removes ie.css and `ie` style handle.
* Removes IE specific class names and any related CSS.
* Drops support for IE8 and older in `wp_customize_support_script()`.
* Updates compatibility mode for CSS minification to `ie11`.

Props ayeshrajans, isabel_brison, afercia, netweb, peterwilsoncc, ocean90.
Fixes #17232, #46015.
Built from https://develop.svn.wordpress.org/trunk@47771


git-svn-id: http://core.svn.wordpress.org/trunk@47547 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-06 20:15:07 +00:00
Sergey Biryukov
d341f20fb1 Themes: Block theme activation if it requires a higher version of PHP or WordPress.
Introduce `validate_theme_requirements()` for validating a theme's WordPress and PHP version requirements.

Follow-up to [44978] and [45546] for plugins.

Props afragen, audrasjb, SergeyBiryukov.
See #43992.
Built from https://develop.svn.wordpress.org/trunk@47573


git-svn-id: http://core.svn.wordpress.org/trunk@47348 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-13 15:28:11 +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
5bf387bb07 Customize: Avoid unnecessary get_theme_mod() call and premature escaping in get_header_video_url().
The result is still escaped with `esc_url_raw()` for retrieval, and with `esc_url()` for display in `the_header_video_url()`.

Props dlh, Tkama.
Fixes #40044.
Built from https://develop.svn.wordpress.org/trunk@47267


git-svn-id: http://core.svn.wordpress.org/trunk@47067 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-11 16:36:06 +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
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
Sergey Biryukov
46a08859d0 Themes: Replace &mdash; with &ndash; as a separator between Monday and Friday in theme starter content.
The `ndash` standardly is the "through" indicator for showing inclusive dates and numbers, while the `mdash` is an interruptor and used as an aside.

Props mikejdent, garrett-eclipse.
Fixes #48286.
Built from https://develop.svn.wordpress.org/trunk@47134


git-svn-id: http://core.svn.wordpress.org/trunk@46934 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-30 19:17:06 +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
2900bb8ea7 Docs: Update links to https://secure.php.net/, they now redirect to https://www.php.net/.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@47088


git-svn-id: http://core.svn.wordpress.org/trunk@46888 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-20 03:14:06 +00:00
John Blackbourn
aa1fdcbd52 Docs: Correct various docblocks documentation.
See #48303
Built from https://develop.svn.wordpress.org/trunk@46821


git-svn-id: http://core.svn.wordpress.org/trunk@46621 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-06 22:23:04 +00:00
Sergey Biryukov
3d623995a8 Docs: In various @return tags, list the expected type first, instead of WP_Error.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@46696


git-svn-id: http://core.svn.wordpress.org/trunk@46496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-11 02:43:03 +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
John Blackbourn
c8f91f77ac Docs: Correct invalid hook docblocks.
See #48303

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


git-svn-id: http://core.svn.wordpress.org/trunk@46400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-27 19:11:02 +00:00
Dominik Schilling
c621d4fb3f Themes: Convert core-provided starter content to block content.
Props Clorith.
Fixes #48130.
Built from https://develop.svn.wordpress.org/trunk@46457


git-svn-id: http://core.svn.wordpress.org/trunk@46255 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-10 19:07:05 +00:00
Sergey Biryukov
8d1e51e9c7 Docs: Add a @since note about new parameters with the spread operator added to function signatures.
Props jrf.
See #47678.
Built from https://develop.svn.wordpress.org/trunk@46451


git-svn-id: http://core.svn.wordpress.org/trunk@46249 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-09 04:28:02 +00:00
Sergey Biryukov
83edc24762 Themes: In get_theme_mod(), only run the sprintf() replacement on the default value if there's a string format pattern found in the value.
This prevents standalone percent symbols from being stripped out, e.g. in a default value like `100%`.

Props aristath, kuus, moonomo, westonruter, davetgreen, daviedR, katielgc, noisysocks, SergeyBiryukov.
Fixes #34290.
Built from https://develop.svn.wordpress.org/trunk@46395


git-svn-id: http://core.svn.wordpress.org/trunk@46194 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-05 00:54:58 +00:00
Sergey Biryukov
5fd25a6944 Docs: Improve documentation for get_theme_mod() and set_theme_mod().
See #47110.
Built from https://develop.svn.wordpress.org/trunk@46394


git-svn-id: http://core.svn.wordpress.org/trunk@46193 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-05 00:40:58 +00:00
Sergey Biryukov
5241f4c2dd Themes: Bring default values for get_theme_root(), get_theme_root_uri(), wp_get_theme(), and wp_customize_url() in line with the documentation.
Reverts [46327].

Fixes #44397.
Built from https://develop.svn.wordpress.org/trunk@46392


git-svn-id: http://core.svn.wordpress.org/trunk@46191 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-04 23:20:58 +00:00