Commit Graph

386 Commits

Author SHA1 Message Date
Sergey Biryukov
2ec23a82ed Code Modernization: Replace usage of strpos() with str_starts_with().
`str_starts_with()` was introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) begins with the given substring (needle).

WordPress core includes a polyfill for `str_starts_with()` on PHP < 8.0 as of WordPress 5.9.

This commit replaces `0 === strpos( ... )` with `str_starts_with()` in core files, making the code more readable and consistent, as well as improving performance.

While `strpos()` is slightly faster than the polyfill on PHP < 8.0, `str_starts_with()` is noticeably faster on PHP 8.0+, as it is optimized to avoid unnecessarily searching along the whole haystack if it does not find the needle.

Follow-up to [52039], [52040], [52326].

Props spacedmonkey, costdev, sabernhardt, mukesh27, desrosj, jorbin, TobiasBg, ayeshrajans, lgadzhev, SergeyBiryukov.
Fixes #58012.
Built from https://develop.svn.wordpress.org/trunk@55703


git-svn-id: http://core.svn.wordpress.org/trunk@55215 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-02 15:45:22 +00:00
audrasjb
418a21fdbc Help/About: Use the new /documentation/ URLs for HelpHub links in WordPress Admin.
As `https://wordpress.org/support/` was redirected to `https://wordpress.org/documentation/`, this changeset replaces various `/support/article/*` links with `/documentation/article/*` to avoid an extra redirect.

This also updates links to Support Forums by replacing `https://wordpress.org/support/` URLs with `https://wordpress.org/support/forums/`.

Props SergeyBiryukov, audrasjb, dhrupo, hasanmisbah, sakibmd, sabernhardt.
See #57726.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54945 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-23 10:38:21 +00:00
Sergey Biryukov
9c5d4ca8d1 I18N: Mark screen reader strings as such with translator comments.
This aims to provide better context for translators and make it easier to determine that some strings contain hidden accessibility text and are not displayed in the UI.

Props kebbet, mercime, pavelevap, ocean90, swissspidy, Chouby, jipmoors, afercia, desrosj, costdev, audrasjb, SergeyBiryukov.
Fixes #29748.
Built from https://develop.svn.wordpress.org/trunk@55276


git-svn-id: http://core.svn.wordpress.org/trunk@54809 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 17:10:21 +00:00
Pascal Birchler
5edb22187d I18N: Introduce switch_to_user_locale().
This new function makes it easier to switch to a specific user’s locale by reducing duplicate code and storing the user’s ID as additional context for plugins to consume. Existing usage of `switch_to_locale()` in core has been replaced with `switch_to_user_locale()` where appropriate.

Also, this change ensures `WP_Locale_Switcher` properly filters `determine_locale` so that anyyone using the `determine_locale()` function will get the correct locale information when switching is in effect.

Props costdev.
Fixes #57123.
See #26511.
Built from https://develop.svn.wordpress.org/trunk@55161


git-svn-id: http://core.svn.wordpress.org/trunk@54694 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-30 10:27:16 +00:00
audrasjb
0164f0a85f Customize: Fix a wrong condition on WP_Customize_Manager::has_published_pages().
The Homepage Settings section on the customizer uses `WP_Customize_Manager::has_published_pages()` as `active_callback`. [53057] introduced an error on the logical check when the queried page is not a top-level page, which leads `has_published_pages` to incorrectly return an empty array.

This changeset fixes the issue by adding `'hierarchical' => 0` to `get_pages()` arguments.

Follow-up to [53057].

Props felipelavinz, dlh, costdev.
Fixes #57198.


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


git-svn-id: http://core.svn.wordpress.org/trunk@54487 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-12-05 21:31:11 +00:00
Sergey Biryukov
59e1077010 Code Modernization: Pass correct value to parse_url() in WP_Customize_Manager::get_return_url().
This particular code block only makes sense to run when `$this->return_url` is not null. Previously, it caused a "passing null to non-nullable" deprecation notice on PHP 8.1.

By moving the code into the `if ( $this->return_url )` condition block, the code will only be run when `$this->return_url` contains a non-falsey/non-null value.

No additional tests added as this issue was found via the existing tests for the function containing the bug.

This solves the following two PHP 8.1 test errors:
{{{
1) Tests_WP_Customize_Manager::test_return_url
parse_url(): Passing null to parameter #1 ($url) of type string is deprecated

/var/www/src/wp-includes/class-wp-customize-manager.php:4696
/var/www/tests/phpunit/tests/customize/manager.php:2975
/var/www/vendor/bin/phpunit:123

2) Tests_WP_Customize_Manager::test_customize_pane_settings
parse_url(): Passing null to parameter #1 ($url) of type string is deprecated

/var/www/src/wp-includes/class-wp-customize-manager.php:4696
/var/www/src/wp-includes/class-wp-customize-manager.php:4898
/var/www/tests/phpunit/tests/customize/manager.php:3085
/var/www/vendor/bin/phpunit:123
}}}

Follow-up to [46754].

Props jrf, costdev.
See #55656.
Built from https://develop.svn.wordpress.org/trunk@54135


git-svn-id: http://core.svn.wordpress.org/trunk@53694 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-12 21:50:14 +00:00
Sergey Biryukov
c03305852e Code Modernization: Add AllowDynamicProperties attribute to all (parent) classes.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

There are a number of ways to mitigate this:
* If it is an accidental typo for a declared property: fix the typo.
* For known properties: declare them on the class.
* For unknown properties: add the magic `__get()`, `__set()`, et al. methods to the class or let the class extend `stdClass` which has highly optimized versions of these magic methods built in.
* For unknown ''use'' of dynamic properties, the `#[AllowDynamicProperties]` attribute can be added to the class. The attribute will automatically be inherited by child classes.

Trac ticket #56034 is open to investigate and handle the third and fourth type of situations, however it has become clear this will need more time and will not be ready in time for WP 6.1.

To reduce “noise” in the meantime, both in the error logs of WP users moving onto PHP 8.2, in the test run logs of WP itself, in test runs of plugins and themes, as well as to prevent duplicate tickets from being opened for the same issue, this commit adds the `#[AllowDynamicProperties]` attribute to all “parent” classes in WP.

The logic used for this commit is as follows:
* If a class already has the attribute: no action needed.
* If a class does not `extend`: add the attribute.
* If a class does `extend`:
 - If it extends `stdClass`: no action needed (as `stdClass` supports dynamic properties).
 - If it extends a PHP native class: add the attribute.
 - If it extends a class from one of WP's external dependencies: add the attribute.
* In all other cases: no action — the attribute should not be needed as child classes inherit from the parent.

Whether or not a class contains magic methods has not been taken into account, as a review of the currently existing magic methods has shown that those are generally not sturdy enough and often even set dynamic properties (which they should not). See the [https://www.youtube.com/watch?v=vDZWepDQQVE live stream from August 16, 2022] for more details.

This commit only affects classes in the `src` directory of WordPress core.
* Tests should not get this attribute, but should be fixed to not use dynamic properties instead. Patches for this are already being committed under ticket #56033.
* While a number bundled themes (2014, 2019, 2020, 2021) contain classes, they are not a part of this commit and may be updated separately.

Reference: [https://wiki.php.net/rfc/deprecate_dynamic_properties PHP RFC: Deprecate dynamic properties].

Follow-up to [53922].

Props jrf, hellofromTonya, markjaquith, peterwilsoncc, costdev, knutsp, aristath.
See #56513, #56034.
Built from https://develop.svn.wordpress.org/trunk@54133


git-svn-id: http://core.svn.wordpress.org/trunk@53692 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-12 15:47:14 +00:00
Sergey Biryukov
87464289c3 Revisions: Update the "last revision" wording to "latest revision" in various files.
This aims to reduce ambiguity about what exactly is the "first" or "last" revision, and bring more consistency with similar wording elsewhere in core, e.g. latest posts, latest comments, etc.

This affects:
* `wp_save_post_revision()`
* `wp_prepare_revisions_for_js()`
* `WP_Customize_Manager::filter_revision_post_has_changed()`

Follow-up to [53759], [53769], [53778].

Props peterwilsoncc.
Fixes #55857.
Built from https://develop.svn.wordpress.org/trunk@53779


git-svn-id: http://core.svn.wordpress.org/trunk@53338 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-25 19:30:09 +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
2130878354 Docs: Replace Codex URL with a corresponding HelpHub article in the Additional CSS section in Customizer.
Follow-up to [45674-45677], [46740], [49912].

Props stevenlinx, audrasjb.
Fixes #55710. See #48987.
Built from https://develop.svn.wordpress.org/trunk@53393


git-svn-id: http://core.svn.wordpress.org/trunk@52982 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-12 17:57:17 +00:00
Sergey Biryukov
af5365ff02 Docs: Correct the expected parameter type for WP_Customize_Manager::remove_preview_signature().
Before the method was deprecated, the parameter contained the value passed through for the `wp_die_handler` filter, which expects a callable function. 

Follow-up to [20926], [32535], [34320], [38810], [53242], [53243].

See #54729.
Built from https://develop.svn.wordpress.org/trunk@53244


git-svn-id: http://core.svn.wordpress.org/trunk@52833 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-22 10:56:13 +00:00
Sergey Biryukov
2bc70fc658 Code Modernization: Rename parameters that use reserved keywords in wp-includes/class-wp-customize-manager.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit:
* Renames the `$default` parameter to `$default_value` in `WP_Customize_Manager::post_value()`.
* Renames the `$return` parameter to `$callback` in `WP_Customize_Manager::remove_preview_signature()`.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53242


git-svn-id: http://core.svn.wordpress.org/trunk@52831 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-22 10:31:15 +00:00
Sergey Biryukov
9fb5112732 Docs: Add missing description for $pagenow global in various functions.
See #54729, #55499.
Built from https://develop.svn.wordpress.org/trunk@53060


git-svn-id: http://core.svn.wordpress.org/trunk@52649 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-04 18:26:06 +00:00
Sergey Biryukov
955e2c007b Docs: Consistently document the $pagenow global in WP_Customize_Manage methods.
Follow-up to [41839].

Props jontyravi, bhrugesh12, kebbet.
Fixes #55499.
Built from https://develop.svn.wordpress.org/trunk@53059


git-svn-id: http://core.svn.wordpress.org/trunk@52648 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-04 12:03:03 +00:00
Peter Wilson
881e4f054b Customizer: Improve performance checking for published pages.
Improve the performance of `WP_Customize_Manager::has_published_pages()` by limiting the database query to a single published page, down from querying all published pages.

Props nagpai, dlh, tyxla.
Fixes #55425.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52646 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-04 01:25:08 +00:00
audrasjb
b7c74cd433 Docs: Use third-person singular verbs for function descriptions in WP_Customize_Manager class, per the documentation standards.
Props azouamauriac.
See #54729.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52643 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-02 16:21:05 +00:00
audrasjb
99bac7e17c Docs: Replace "Current theme" with "Active theme" in various DocBlocks.
This change replaces "Current theme" with "Active theme" in various DocBlocks for better consistency with user-facing strings.

Follow-up to [52580].

Props Presskopp, audrasjb, costdev.
Fixes #54831.
See #54770.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52198 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-01-20 23:53:05 +00:00
hellofromTonya
edf755823b Customize: Overlay incompatible banner for block themes.
Starting in 5.9, block themes are not compatible with (do not support) Customizer; rather, they use the Site Editor. Viewing installed themes in Customizer, this commit adds an overlay message to alert users and give them a way to activate the block theme. Clicking on the "Activate" button activates the block theme and redirects back to the Appearance > Themes interface, where the user can then enter the Site Editor for customization.

Non-block themes are not affected by this change and continue to work in Customizer.

Follow-up to [41648], [41893], [52279].

Props antonvlasenko, costdev, hellofromTonya, jffng, joyously, noisysocks, poena, shaunandrews.
Fixes #54549.
Built from https://develop.svn.wordpress.org/trunk@52371


git-svn-id: http://core.svn.wordpress.org/trunk@51963 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-14 15:33:01 +00:00
Sergey Biryukov
3beb1d25ab Docs: Correct the format of some comments per the documentation standards.
Follow-up to [10357], [10939], [43309], [51003], [51266], [51653], [51738], [52110].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@52352


git-svn-id: http://core.svn.wordpress.org/trunk@51944 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-10 20:30:05 +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
John Blackbourn
c9746ab584 Docs: Various corrections and improvements relating to types used in inline documentation.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@51796 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-18 13:50:05 +00:00
hellofromTonya
234877c9c3 Coding Standards: Add public visibility to methods in src directory.
This commit adds the `public` visibility keyword to each method which did not have an explicit visibility keyword.

Why `public`?

With no visibility previously declared, these methods are implicitly `public` and available for use. Changing them to anything else would be a backwards-compatibility break.

Props costdev, jrf.
See #54177.
Built from https://develop.svn.wordpress.org/trunk@51919


git-svn-id: http://core.svn.wordpress.org/trunk@51512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-18 17:52:58 +00:00
Sergey Biryukov
bd3465828e Docs: Fix typo in a comment in WP_Customize_Manager::get_return_url().
Follow-up to [46754].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@51730


git-svn-id: http://core.svn.wordpress.org/trunk@51336 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-04 00:39:04 +00:00
John Blackbourn
2cb4ebefe2 Docs: Replace $this in hook param docs with more appropriate names.
`$this` is a pseudo-variable that cannot be used as the name of a function parameter, so renaming these helps prevent errors when implementing hook callback functions.

Fixes #53457

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


git-svn-id: http://core.svn.wordpress.org/trunk@51129 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-30 19:35:58 +00:00
Sergey Biryukov
e05ffb46a5 Coding Standards: Remove a one-time $message variable in some _doing_it_wrong() calls.
This brings some consistency with most other calls.

Follow-up to [23378], [25605], [34745], [36219], [44108], [46111], [48156].

See #52627.
Built from https://develop.svn.wordpress.org/trunk@51154


git-svn-id: http://core.svn.wordpress.org/trunk@50763 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-15 15:22:58 +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
John Blackbourn
00680f2e89 REST API: Pass the previous state of the post as a parameter to the wp_after_insert_post hook.
This enables, for example, the previous post status to be used by this hook without the need to first capture it on an earlier hook.

This also fixes the value of the `$fire_after_hooks` parameter in `get_default_post_to_edit()` so the `wp_after_insert_post` action correctly fires just once on the new post screen.

Props Collizo4sky, peterwilsoncc, hellofromTonya, TimothyBlynJacobs, SergeyBiryukov

Fixes #45114

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


git-svn-id: http://core.svn.wordpress.org/trunk@49454 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-01 20:47:06 +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
Peter Wilson
32d193f96f REST API, Posts: Add a hook to fire once a post, its terms and meta update.
Introduces the action `wp_after_insert_post` inside a wrapper function of the same name. This hook allows plugin developers to access a posts full data (including its terms and meta data) regardless of the workflow used to save it.

A new parameter is introduced to `wp_insert_post()` to indicate whether the hook should be fired within the function call or will be fired afterward.

Props aristath, Collizo4sky, danielbachhuber, joyously, kadamwhite, kraftbj, markparnell, mikeschroder, noisysocks, peterwilsoncc, SergeyBiryukov, talldanwp, thewebprincess, TimothyBlynJacobs.
Fixes #45114.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48934 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-16 03:34:08 +00:00
Sergey Biryukov
897f004a9c General: Replace older-style PHP type conversion functions with type casts.
This improves performance, readability, and consistency throughout core.

* `intval()` → `(int)`
* `strval()` → `(string)`
* `floatval()` → `(float)`

Props ayeshrajans.
Fixes #42918.
Built from https://develop.svn.wordpress.org/trunk@49108


git-svn-id: http://core.svn.wordpress.org/trunk@48870 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-08 21:15:13 +00:00
Sergey Biryukov
829fc28a93 Code Modernization: Ignore the _multiwidget property when collecting widget numbers in WP_Customize_Manager::import_theme_starter_content().
PHP 8 changes the way string to number comparisons are performed: https://wiki.php.net/rfc/string_to_number_comparison

In particular, when calling `max()` on an array with numeric values and a non-numeric string, in PHP 8 the string is returned instead of a number.

For `::import_theme_starter_content()`, this resulted in retrieving the `_multiwidget` property instead of the maximum widget number for a particular type.

By explicitly ignoring the `_multiwidget` property, we make sure to retrieve the correct widget number value.

Follow-up to [48960], [49043].

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


git-svn-id: http://core.svn.wordpress.org/trunk@48838 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-30 15:46:08 +00:00
Sergey Biryukov
1a230a752a Customize: Add / character to <img> tag in WP_Customize_Manager and WP_Customize_Header_Image_Control JS templates.
While this has no effect on void elements in HTML5, it fixes a minor inconsistency with the rest of core.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48596 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-20 13:13:10 +00:00
Sergey Biryukov
1f85e7484f Docs: Consistently use third-person singular verbs for various filter descriptions, per the documentation standards.
See #50768.
Built from https://develop.svn.wordpress.org/trunk@48782


git-svn-id: http://core.svn.wordpress.org/trunk@48544 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-11 00:34:08 +00:00
Sergey Biryukov
08271f4192 I18N: Move code out of a translatable string in WP_Customize_Manager::customize_preview_init().
Props ramiy.
Fixes #50760.
Built from https://develop.svn.wordpress.org/trunk@48609


git-svn-id: http://core.svn.wordpress.org/trunk@48371 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-25 16:01:07 +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
57a3f803ae Docs: First pass at some inline docs fixes mostly made by PHPCBF.
See #49572, #50744
Built from https://develop.svn.wordpress.org/trunk@48586


git-svn-id: http://core.svn.wordpress.org/trunk@48348 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-23 20:01:04 +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
5a60d4b3b0 Customize: Do not allow changesets to be deleted when someone is editing them.
This makes the behavior consistent with that of locked posts, which can't be deleted via the list tables when another user is editing them.

Props dlh.
Fixes #50501.
Built from https://develop.svn.wordpress.org/trunk@48211


git-svn-id: http://core.svn.wordpress.org/trunk@47980 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-29 10:33:08 +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
John Blackbourn
1a77bb81d8 Docs: Remove unnecessary variables names from @return tags.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48100


git-svn-id: http://core.svn.wordpress.org/trunk@47869 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-19 22:55:12 +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
Sergey Biryukov
434bee9fc9 Coding Standards: Fix WPCS issues in wp-includes/class-wp-customize-manager.php.
Follow-up to [47819].

Props sorenbronsted.
See #49542.
Built from https://develop.svn.wordpress.org/trunk@47821


git-svn-id: http://core.svn.wordpress.org/trunk@47597 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-19 08:41:12 +00:00
Sergey Biryukov
307725883a Themes: Prevent installation of themes that require a higher version of PHP or WordPress.
Props afragen.
Fixes #49653. See #48491.
Built from https://develop.svn.wordpress.org/trunk@47819


git-svn-id: http://core.svn.wordpress.org/trunk@47595 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-18 16:03:09 +00:00
Sergey Biryukov
266b52513b Docs: Correct @since versions, remove duplicate comment.
Follow-up to [47633].
Built from https://develop.svn.wordpress.org/trunk@47663


git-svn-id: http://core.svn.wordpress.org/trunk@47440 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-29 17:25:10 +00:00
whyisjake
55cd633c37 Customize: Add additional filters to Customizer to prevent JSON corruption.
This solution extends the wp_insert_post_data filter to pass in addition to the slashed/sanitized/processed data, and the slashed/sanitized/unprocessed data, to also pass the initial slashed/unsanitized/unprocessed data which was passed into wp_insert_post(). This then allows plugins to have complete control over how sanitization is performed based on the post type.

Props westonruter, peterwilsoncc, sstoqnov, whyisjake, xknown.
 

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


git-svn-id: http://core.svn.wordpress.org/trunk@47408 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-29 15:14:10 +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
50afd0aa1b Docs: Add a reference to WP_Customize_Panel::__construct() for information on accepted arguments in WP_Customize_Manager::add_panel().
Synchronize the documentation between two places, use `WP_Customize_Panel::__construct()` as the canonical source.

Props iaaxpage, marekdedic.
Fixes #48344.
Built from https://develop.svn.wordpress.org/trunk@47387


git-svn-id: http://core.svn.wordpress.org/trunk@47174 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-27 20:36:07 +00:00
Sergey Biryukov
9043b9833f Docs: Add a reference to WP_Customize_Section::__construct() for information on accepted arguments in WP_Customize_Manager::add_section().
Synchronize the documentation between two places, use `WP_Customize_Section::__construct()` as the canonical source.

Props amolv, marekdedic.
Fixes #48346.
Built from https://develop.svn.wordpress.org/trunk@47386


git-svn-id: http://core.svn.wordpress.org/trunk@47173 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-27 20:29:06 +00:00
Sergey Biryukov
569319f553 Docs: Clarify the type of theme_supports argument in various Customizer classes.
Props marekdedic.
See #48347.
Built from https://develop.svn.wordpress.org/trunk@47385


git-svn-id: http://core.svn.wordpress.org/trunk@47172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-27 20:23:06 +00:00