Commit Graph

19 Commits

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

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

This commit replaces `false !== strpos( ... )` with `str_contains()` in core files, making the code more readable and consistent, as well as better aligned with modern development practices.

Follow-up to [52039], [52040], [52326], [55703], [55710], [55987].

Props Soean, spacedmonkey, costdev, dingo_d, azaozz, mikeschroder, flixos90, peterwilsoncc, SergeyBiryukov.
Fixes #58206.
Built from https://develop.svn.wordpress.org/trunk@55988


git-svn-id: http://core.svn.wordpress.org/trunk@55500 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-22 14:36:26 +00:00
audrasjb 3ce7c7e435 Docs: Use third-person singular verbs in various function descriptions, as per docblocks standards.
Follow-up to [55911].

Props costdev, audrasjb.
See #57840.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55428 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-14 12:57:20 +00:00
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
Sergey Biryukov 2c84d63322 Help/About: Don't output empty `<span>` tags on Credits screen.
If the contributor does not have a title, the empty tags are not necessary.

Follow-up to [17877], [17909], [17942], [18162], [19143], [46709].

Props sayedulsayem, audrasjb, mukesh27.
Fixes #54275.
Built from https://develop.svn.wordpress.org/trunk@51920


git-svn-id: http://core.svn.wordpress.org/trunk@51513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-19 23:09:00 +00:00
ryelle aea10c0c44 Help/About: WordPress 5.8 About Page.
This is the start of the WordPress 5.8 about page, introducing new content and a first pass of the new style.

Props chanthaboune, cbringmann, webcommsat, marybaum, melchoyce, shaunandrews, desrosj, ryelle, oglekler, yvettesonneveld, nalininonstopnewsuk, meher, femkreations, alanjacobmathew, courane01, annezazu, matveb, milana_cap, javiarce, ryokuhi, audrasjb.
See #52775.


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


git-svn-id: http://core.svn.wordpress.org/trunk@50873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-29 19:06:57 +00:00
Sergey Biryukov 53c0882200 Coding Standards: Use strict comparison in `wp-admin/includes/credits.php`.
See #52627.
Built from https://develop.svn.wordpress.org/trunk@50665


git-svn-id: http://core.svn.wordpress.org/trunk@50277 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-04-06 13:47:02 +00:00
Sergey Biryukov e2c8e2fa5a Administration: Allow `wp_credits()` to accept `$version` and `$locale` parameters.
This can be helpful for plugin developers to get credits information for older versions or different locales.

Props ramiy.
Fixes #35910.
Built from https://develop.svn.wordpress.org/trunk@48715


git-svn-id: http://core.svn.wordpress.org/trunk@48477 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-03 12:53:08 +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 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 927aa4b44c Docs: Fix typo in `wp_credits_section_title()` description.
Switch descriptions for `wp_credits_section_title()` and `wp_credits_section_list()` to third-person singular verbs, per the documentation standards.

Props hareesh-pillai.
Fixes #48674.
Built from https://develop.svn.wordpress.org/trunk@46738


git-svn-id: http://core.svn.wordpress.org/trunk@46538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-16 21:04:01 +00:00
Sergey Biryukov 2265c36568 Help/About: Update the 5.3 About page.
* Remove extra padding on the Credits tab.

Previously [46556], [46572], [46616], [46705].
Props ryelle.
See #47708.
Built from https://develop.svn.wordpress.org/trunk@46709


git-svn-id: http://core.svn.wordpress.org/trunk@46509 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-11 20:45:04 +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
John Blackbourn 4a16295dc5 Docs: Standardise the format used for documenting parameters passed by reference.
See #35974, #41017

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


git-svn-id: http://core.svn.wordpress.org/trunk@41522 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-02 22:14:46 +00:00
Dion Hulse db86c635ba Standardise on performing api.WordPress.org requests over SSL when possible, falling back to non-SSL when appropriate.
This also standardises the `User-Agent` used when communicating with WordPress.org, allowing for more consistent version detection.

Fixes #42004.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41440 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-27 08:00:49 +00:00
Pascal Birchler 4a88d55054 I18N: Introduce a user-specific language setting.
By enabling the user to select their preferred locale when editing the profile, we allow for greater personalization of the WordPress admin and therefore a better user experience.

The back end will be displayed in the user's individual locale while the locale used on the front end equals the one set for the whole site. If the user didn't specify a locale, the site's locale will be used as a fallback. The new `locale` property of the `WP_User` class can be used to retrieve the user's locale setting.

Props ocean90, ipm-frommen, swissspidy.
Fixes #29783.
Built from https://develop.svn.wordpress.org/trunk@38705


git-svn-id: http://core.svn.wordpress.org/trunk@38648 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-03 07:04:29 +00:00
Scott Taylor 9383bf8f74 General: use `get_bloginfo( 'version' )` instead of `global $wp_version` in several locations - excluding those locations which reload `version.php` mid-flight.
See #37699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 05:49:37 +00:00
John Blackbourn 1402c3d8b4 Docs: Miscellaneous docblock corrections.
See #32246

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


git-svn-id: http://core.svn.wordpress.org/trunk@36034 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-23 06:31:27 +00:00
Pascal Birchler 54b8c3e53b Docs: Fix some minor DocBlock alignment issues.
See #32246.
Built from https://develop.svn.wordpress.org/trunk@35885


git-svn-id: http://core.svn.wordpress.org/trunk@35849 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-12 15:37:28 +00:00
Scott Taylor db9c5c81f5 Move ad hoc functions from `wp-admin/credits.php` to `wp-admin/includes/credits.php`, which is only included by the former.
See #33813.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34004 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-11 04:55:26 +00:00