Commit Graph

510 Commits

Author SHA1 Message Date
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 `—` with `–` 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
whyisjake 3c0f10e397 Themes: Docblock cleanup for `get_theme_root_uri()`
In the function docblock of `get_theme_root_uri()`, the argument types of `$stylesheet_or_template` and `$theme_root` do not match. Default values of arguments are boolean but in function doc they are stated as strings.

Props subrataemfluence, williampatton, garrett-eclipse.
Fixes #44397.

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


git-svn-id: http://core.svn.wordpress.org/trunk@46126 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-26 20:21:58 +00:00
Sergey Biryukov d363d85cce Themes: After [46164], make sure `$type_attr` is always defined in `_custom_background_cb()`.
Props davidbaumwald.
Fixes #48112.
Built from https://develop.svn.wordpress.org/trunk@46270


git-svn-id: http://core.svn.wordpress.org/trunk@46082 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-23 20:09:57 +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 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 e0311b76c7 Docs: Add missing description for `$wp_locale` global.
Props mukesh27.
See #45604, #47110.
Built from https://develop.svn.wordpress.org/trunk@45737


git-svn-id: http://core.svn.wordpress.org/trunk@45548 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:46:55 +00:00
Sergey Biryukov 29b072e706 Docs: Add missing description for `$wpdb`, `$wp_db_version`, and `$wp_current_db_version` globals.
Props mukesh27, utsav72640, immeet94, SergeyBiryukov.
See #45604.
Built from https://develop.svn.wordpress.org/trunk@45734


git-svn-id: http://core.svn.wordpress.org/trunk@45545 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:12:56 +00:00
Gary Pendergast 971814047f Coding Standards: Move wp-admin/custom-background.php to wp-admin/includes/class-custom-background.php
This renames the file containing the Custom_Background class to conform to the coding standards.

This commit also includes:

- A new custom-background.php that includes the new file, for anyone that may've been including the file directly.
- Replaces a reference to the old filename with the new filename.

See #47632.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-19 04:02:55 +00:00
Gary Pendergast 24d08a9463 Coding Standards: Move `wp-admin/custom-header.php` to `wp-admin/includes/class-custom-image-header.php`
This renames the file containing the `Custom_Image_Header` class to conform to the coding standards.

This commit also includes:
- A new `custom-header.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.

See #47632.


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


git-svn-id: http://core.svn.wordpress.org/trunk@45465 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-17 06:17:56 +00:00
Gary Pendergast a571a7d621 Code Modernisation: Fix known instances of array access on data types that can't be accessed as arrays.
PHP 7.4 addes a warning when trying access a null/bool/int/float/resource (everything but array, string and object) as if it were an array.

This change fixes all of these warnings visible in unit tests.

Props jrf.
See #47704.



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


git-svn-id: http://core.svn.wordpress.org/trunk@45450 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-15 06:25:57 +00:00
Gary Pendergast afdbf749d7 Code Modernisation: Introduce the spread operator in `theme.php`.
Rather than relying `func_get_args()` to retrieve arbitrary function arguments, we can now use the spread operator to assign them directly to a variable.

Props jrf, pento.
See #47678.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45439 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-12 00:10:56 +00:00
Andrew Ozz ff723a2fba Editor: Make registered editor stylesheets (editor-style.css) available to the front-end.
Props webmandesign, azaozz.
Fixes #34882.
Built from https://develop.svn.wordpress.org/trunk@45621


git-svn-id: http://core.svn.wordpress.org/trunk@45432 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-11 18:30:57 +00:00
Gary Pendergast a02b5cc2a8 Coding Standards: Mark the handful of hook names with uppercase characters or hyphens as ignored.
See #47632.


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


git-svn-id: http://core.svn.wordpress.org/trunk@45410 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-05 01:45:56 +00:00
Gary Pendergast 4803fc405e Coding Standards: Fix the `Squiz.PHP.DisallowMultipleAssignments` violations in `wp-includes`.
See #47632.


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


git-svn-id: http://core.svn.wordpress.org/trunk@45401 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-02 23:42:58 +00:00
John Blackbourn 17cc8cd0f8 Docs: Correct a theme feature name.
See #45134

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


git-svn-id: http://core.svn.wordpress.org/trunk@45234 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-05-25 23:46:52 +00:00
John Blackbourn 04bba79df9 Docs: Improve documentation for variadic functions relating to post type support and theme support.
See #37402

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


git-svn-id: http://core.svn.wordpress.org/trunk@45233 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-05-25 23:41:54 +00:00
John Blackbourn 9c6393e967 Docs: Switch to the more common syntax for variadic function documentation.
See #37402

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


git-svn-id: http://core.svn.wordpress.org/trunk@45229 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-05-25 21:59:51 +00:00
Sergey Biryukov d2ccaacedf Docs: Correct spelling in various comments and DocBlocks, per the conventions in Core Contributor Handbook.
Props man4toman, samanehmirrajabi.
Fixes #45857.
Built from https://develop.svn.wordpress.org/trunk@45232


git-svn-id: http://core.svn.wordpress.org/trunk@45041 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-17 13:26:51 +00:00
Felix Arntz 5d2c761568 Bootstrap/Load: Remove extension from the list of paused extensions when it is deactivated.
With this change, fatal errors recorded before a plugin was deactivated or a theme was switched away from do not persist. This ensures that re-enabling it re-checks for fatal errors correctly.

Props aandrewdixon, dhanukanuwan, henrywright.
Fixes #46812.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44924 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-05 15:33:52 +00:00
Sergey Biryukov 130495e1c4 Docs: Correct `@param` description for `remove_theme_support()`.
Add `@return` description for `current_theme_supports()`.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44898 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-01 16:21:50 +00:00
Sergey Biryukov 3f3593aa6c Customize: Only add `custom-background` to `body_class()` if the current theme supports custom background.
Props wido, swissspidy, ocean90, Mte90.
Fixes #38168.
Built from https://develop.svn.wordpress.org/trunk@45088


git-svn-id: http://core.svn.wordpress.org/trunk@44897 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-01 16:18:52 +00:00
desrosj 03240dd3f4 Docs: Correct various spelling mistakes.
Props man4toman.
Fixes #46339.
Built from https://develop.svn.wordpress.org/trunk@44894


git-svn-id: http://core.svn.wordpress.org/trunk@44725 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-13 19:32:53 +00:00
Gary Pendergast 19642fd0c9 Docs: Correct the `@return` type of `get_theme_mod()`.
This now matches the type of the `$value` parameter of `set_theme_mod()`.

Props mensmaximus.
Fixes #45319.


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


git-svn-id: http://core.svn.wordpress.org/trunk@44444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-16 05:32:48 +00:00
desrosj feb27516d0 Themes: Document the new theme features being added.
The add_theme_support() inline docs now includes the features that the block editor adds.

Props pento, desrosj.

Merges [43814] to trunk.

Fixes #45134.
Built from https://develop.svn.wordpress.org/trunk@44158


git-svn-id: http://core.svn.wordpress.org/trunk@43988 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-14 03:41:37 +00:00
Jeremy Felt c339798b49 Themes: Introduce responsive embeds support.
Responsive embeds is a way for a theme to opt in to WordPress dynamically scaling the width/height of an embed. When a theme supports responsive embeds, a `wp-embed-responsive` class is added to the `<body>` tag. This information is also presented through the REST API for clients to respect.

Merges [43790] and [43791] from the 5.0 branch to trunk.

Props desrosj, danielbachhuber, ocean90.
Fixes #45125.

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


git-svn-id: http://core.svn.wordpress.org/trunk@43968 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-14 01:50:37 +00:00
Gary Pendergast 56c162fbc9 Coding Standards: Upgrade WPCS to 1.0.0
WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues.

This change includes three notable additions:
- Multiline function calls must now put each parameter on a new line.
- Auto-formatting files is now part of the `grunt precommit` script. 
- Auto-fixable coding standards issues will now cause Travis failures.

Fixes #44600.


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


git-svn-id: http://core.svn.wordpress.org/trunk@43400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-08-17 01:51:36 +00:00
Sergey Biryukov 4b6794ba57 Themes: Avoid a PHP 7.2 warning in `get_theme_roots()` when `$wp_theme_directories` is an uncountable value.
See [41174] for `wp_get_themes()` and `get_raw_theme_root()`.

Props burlingtonbytes, teddytime, lbenicio, desrosj.
Fixes #43374. See #40109.
Built from https://develop.svn.wordpress.org/trunk@43039


git-svn-id: http://core.svn.wordpress.org/trunk@42868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-04-30 04:51:22 +00:00
John Blackbourn 1b5d6c6971 Docs: Document many more parameters and properties using typed array notation.
See #41756

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


git-svn-id: http://core.svn.wordpress.org/trunk@42701 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-22 20:27:32 +00:00
Sergey Biryukov 4848a09b35 I18N: Use the actual placeholder instead of a number in translator comments if the corresponding string does not use numbered placeholders.
Add missing translator comments in `WP_Theme_Install_List_Table` and `wp_notify_postauthor()`.
Add missing commas in some translator comments.

Fixes #43523.
Built from https://develop.svn.wordpress.org/trunk@42827


git-svn-id: http://core.svn.wordpress.org/trunk@42657 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-11 16:44:34 +00:00
John Blackbourn d1d60bb22c Themes: Revert [42788] as it breaks a lot of things.
See #43228

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


git-svn-id: http://core.svn.wordpress.org/trunk@42646 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-09 17:00:31 +00:00
John Blackbourn ea6360b47c Themes: Ensure the theme roots cache is cleared when registering a theme directory.
Props soulseekah, johnbillion

Fixes #43228

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


git-svn-id: http://core.svn.wordpress.org/trunk@42618 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-05 22:14:30 +00:00
Sergey Biryukov 68a3e7745a Docs: Add documentation for `header_video_settings` filter.
Props milana_cap.
Fixes #43300.
Built from https://develop.svn.wordpress.org/trunk@42707


git-svn-id: http://core.svn.wordpress.org/trunk@42535 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-12 22:39:31 +00:00
Sergey Biryukov abdea23275 Docs: Convert `$args` array description for `wp_get_themes()` to a hash notation.
Props milana_cap.
Fixes #43213.
Built from https://develop.svn.wordpress.org/trunk@42640


git-svn-id: http://core.svn.wordpress.org/trunk@42469 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-02 09:38:30 +00:00
Gary Pendergast aaf99e6913 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.


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


git-svn-id: http://core.svn.wordpress.org/trunk@42172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-30 23:11:00 +00:00