Commit Graph

40864 Commits

Author SHA1 Message Date
Sergey Biryukov dbf6a0ba7c Media: Make sure `attachment_url_to_postid()` performs a case-sensitive search for the uploaded file name.
Previously, the first available match was returned, regardless of the case, which was not always the expected result.

Props archon810, ben.greeley, tristangemus, vsamoletov, SergeyBiryukov.
Fixes #39768.

git-svn-id: https://develop.svn.wordpress.org/trunk@47010 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-25 02:24:38 +00:00
Sergey Biryukov d56642ea57 Docs: Use a third-person singular verb for comment template function descriptions, per the documentation standards.
See #48303.

git-svn-id: https://develop.svn.wordpress.org/trunk@47009 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-24 16:17:17 +00:00
Sergey Biryukov 51b421a6d1 Docs: Improve documentation for `get_comment_author_url()`.
Props stevenlinx.
Fixes #49076.

git-svn-id: https://develop.svn.wordpress.org/trunk@47008 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-24 16:08:34 +00:00
Sergey Biryukov 67502b3dcd Docs: Correct the note about the `CORE_UPGRADE_SKIP_NEW_BUNDLED` constant in `$_new_bundled_files` global description.
In order to tell WordPress not to install new bundled themes on update, `CORE_UPGRADE_SKIP_NEW_BUNDLED` should be set to `true`, as the name suggests, not `false`.

Follow-up to [39064].

Props tomgreer, knutsp, crdunst.
See #49056.

git-svn-id: https://develop.svn.wordpress.org/trunk@47007 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-23 17:58:02 +00:00
Sergey Biryukov c273108570 Docs: Improve documentation for admin menu functions:
* `get_admin_page_parent()`
* `get_admin_page_title()`
* `get_plugin_page_hook()`
* `get_plugin_page_hookname()`
* `user_can_access_admin_page()`

Add missing descriptions and `@since` tags.

Props subrataemfluence, kennithnichol, stevenlinx, SergeyBiryukov.
Fixes #44253, #49067.

git-svn-id: https://develop.svn.wordpress.org/trunk@47006 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-23 14:34:10 +00:00
Sergey Biryukov 56e338c132 Upgrade/Install: When creating the `.htaccess` file in `insert_with_markers()`, make sure it has `0644` as a minimum set of permissions.
Props rcutmore, dd32, i3anaan.
Fixes #40572.

git-svn-id: https://develop.svn.wordpress.org/trunk@47005 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-22 02:43:30 +00:00
Sergey Biryukov 5c83f0630a Shortcodes: Introduce `apply_shortcodes()` as an alias for `do_shortcode()`.
This better aligns with the semantics of applying filters to the input and returning a result, rather than performing an action and outputting to the current buffer.

Props ljasinskipl, thefarlilacfield.
Fixes #37422.

git-svn-id: https://develop.svn.wordpress.org/trunk@47004 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-21 20:10:25 +00:00
Sergey Biryukov 7abc076e13 Shortcodes: Make sure `wp.shortcode.string()` accepts the `attrs` array keys in any order.
Props yale01, georgestephanis, adamsilverstein, zsusag, mircoraffinetti, SergeyBiryukov.
Fixes #36263.

git-svn-id: https://develop.svn.wordpress.org/trunk@47003 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-21 18:32:45 +00:00
Sergey Biryukov 939fbfa7d3 Administration: Add `doing_wp_cron` to `wp_removable_query_args()`.
It's a single-use URL parameter that does not need to be passed to canonical URLs in the admin.

Props dlh.
Fixes #49017.

git-svn-id: https://develop.svn.wordpress.org/trunk@47002 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-21 16:12:15 +00:00
Sergey Biryukov 2c15e0c286 Tests: Don't fail the test in `WP_UnitTestCase_Base::skipOnAutomatedBranches()` if Travis environment variables are unavailable, it prevents from running the test locally.
Follow-up to [47000].

See #49050.

git-svn-id: https://develop.svn.wordpress.org/trunk@47001 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-20 12:13:10 +00:00
Sergey Biryukov d697471bb1 Tests: Correct the check for pull requests in `WP_UnitTestCase_Base::skipOnAutomatedBranches()`.
Mark the test as failed if the environment variables are unavailable.

Fixes #49050.

git-svn-id: https://develop.svn.wordpress.org/trunk@47000 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-20 01:10:23 +00:00
Sergey Biryukov 2915793376 Build/Test Tools: Pass the `TRAVIS_BRANCH` and `TRAVIS_PULL_REQUEST` environment variables along to the Docker container.
This ensures that `WP_UnitTestCase::skipOnAutomatedBranches()` has access to these variables.

See #49050, #47767.

git-svn-id: https://develop.svn.wordpress.org/trunk@46999 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-20 00:01:33 +00:00
Sergey Biryukov 26cc3cfd19 Tests: Skip external HTTP test for recommended PHP and MySQL versions on 503 errors.
Fixes #49049.

git-svn-id: https://develop.svn.wordpress.org/trunk@46998 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-19 20:27:16 +00:00
Jake Spurlock 2fad299387 Editor: Add unit tests for v5.3.1 block serialization functions
r46896 was intended to have included unit tests for the block serialization functions added as part of the changeset.

Props: @aduth.
Fixes: #49048 



git-svn-id: https://develop.svn.wordpress.org/trunk@46997 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-19 18:48:49 +00:00
Sergey Biryukov 9fe4689f2d Tests: In `test_readme()`, if the HTTP request to `secure.php.net` or `dev.mysql.com` failed, include response code in the error message.
See #40533, #44613.

git-svn-id: https://develop.svn.wordpress.org/trunk@46996 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-19 15:43:33 +00:00
Sergey Biryukov 7cdb642610 Tests: Remove unused cache keys from `data_get_site_caches()`.
Follow-up to [46990].

See #40363.

git-svn-id: https://develop.svn.wordpress.org/trunk@46991 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-18 03:20:59 +00:00
Sergey Biryukov 0ff4f016fe Networks and Sites: Remove invalidation of unused cache keys in `clean_blog_cache()`.
Props spacedmonkey, flixos90, thamaraiselvam.
Fixes #40363.

git-svn-id: https://develop.svn.wordpress.org/trunk@46990 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-18 02:57:18 +00:00
Sergey Biryukov d592888f36 Users: When creating the first user on installation, populate the Website profile field with the site URL.
Skip setting the field if the user already exists, which is the case when the user tables are being shared among multiple sites.

Props EFAREM, eclare, darrenlambert, zachflauaus, viralsampat.
Fixes #35778.

git-svn-id: https://develop.svn.wordpress.org/trunk@46989 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-18 02:24:05 +00:00
Sergey Biryukov 38cfdae6e9 I18N: Make the minimum input length to start searching posts in the "Insert/edit link" modal localizable.
Props Toro_Unit, birgire, miyauchi, swissspidy, ocean90.
Fixes #44662.

git-svn-id: https://develop.svn.wordpress.org/trunk@46988 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-18 01:13:14 +00:00
Sergey Biryukov c8ac42b3dd Docs: Improve comments in `tests/formatting/redirect.php` per the documentation standards.
See #48303.

git-svn-id: https://develop.svn.wordpress.org/trunk@46987 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-18 00:26:23 +00:00
Sergey Biryukov 0d81dcbfb1 Docs: Add `@method` notation for `WP_UnitTest_Factory_For_Term::create_and_get()` for consistency with other factories.
See #48303.

git-svn-id: https://develop.svn.wordpress.org/trunk@46986 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-18 00:24:03 +00:00
Sergey Biryukov a3e674d4f9 Docs: Various documentation fixes for unit test factories.
See #48303.

git-svn-id: https://develop.svn.wordpress.org/trunk@46985 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-18 00:17:54 +00:00
Sergey Biryukov 99ddfa0195 Tests: Use delta comparison in `test_should_fall_back_to_last_post_modified()` to avoid race conditions.
See #48957.

git-svn-id: https://develop.svn.wordpress.org/trunk@46981 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-17 21:31:08 +00:00
Andrew Ozz a276995ff9 Upload: Run the final file name collision test in `wp_unique_filename()` for each existing file + 1.
Props pbiron.
See #48975.


git-svn-id: https://develop.svn.wordpress.org/trunk@46976 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-17 20:50:16 +00:00
Sergey Biryukov a4b65bfca8 Date/Time: Ensure that `get_feed_build_date()` correctly handles a modified post object with invalid date.
* Clarify in the documentation that the function returns `false` on failure.
* Consistently pass the return value through the `get_feed_build_date` filter.

Props Rarst, dd32, azaozz, tellyworth.
Fixes #48957.

git-svn-id: https://develop.svn.wordpress.org/trunk@46974 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-17 20:41:09 +00:00
Sergey Biryukov 9d69e005ea Docs: Clarify that `get_lastpostdate()` and `get_lastpostmodified()` can return `false` on failure.
The both use `_get_last_post_time()` internally.

Props Rarst.
See #48957.

git-svn-id: https://develop.svn.wordpress.org/trunk@46973 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-17 20:24:46 +00:00
Sergey Biryukov ed3e924683 Upgrade/Install: Remove unused global in `upgrade_430_fix_comments()`.
Props adnan.limdi.
Fixes #41970.

git-svn-id: https://develop.svn.wordpress.org/trunk@46972 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-17 16:43:22 +00:00
Sergey Biryukov 81a54a49d4 Login/Registration: Pass the error data to the `wp_login_failed` action.
Props hamedmoodi, rixeo.
Fixes #49007.

git-svn-id: https://develop.svn.wordpress.org/trunk@46971 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-17 15:34:49 +00:00
Sergey Biryukov 7261695f7d Docs: Correct `@type` for `timeout` argument in `WP_Http::request()`.
Props georgestephanis, benedictsinger.
Fixes #49005.

git-svn-id: https://develop.svn.wordpress.org/trunk@46970 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-17 15:23:33 +00:00
Sergey Biryukov 69ddf953bd Date/Time: Add a unit test for [46968].
See #48145.

git-svn-id: https://develop.svn.wordpress.org/trunk@46969 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-17 14:35:25 +00:00
Sergey Biryukov e8c854d2ce Date/Time: In `wp_insert_post()`, when checking the post date to set `future` or `publish` status, use a proper delta comparison.
[3525] allowed a difference up to 59 seconds between the post date/time and the current time to consider the post published instead of scheduled, but that didn't take start of a new minute into account.

Rapidly creating post fixtures in unit tests could encounter a one-second discrepancy between `current_time( 'mysql' )` and `gmdate( 'Y-m-d H:i:s' )`, returning values like `2019-12-16 23:43:00` vs. `2019-12-16 23:42:59`, respectively, and setting the post to a `future` status instead of `publish`.

[45851], while working as intended, made the issue somewhat more likely to occur.

This caused all sorts of occasional random failures in various tests on Travis, mostly on PHP 7.1.

Fixes #48145.

git-svn-id: https://develop.svn.wordpress.org/trunk@46968 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-17 02:23:51 +00:00
Andrew Ozz 5e813adcdc Fix the colors in all color schemes for the `.active` class for buttons.
Props ryelle, audrasjb.
Fixes #49003 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@46967 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-17 00:13:47 +00:00
Andrew Ozz 99ef48a585 Upload: Fix the final file name collision test in `wp_unique_filename()` when uploading a file with upper case extension. Add a unit test to catch that in the future.
Fixes #48975 for trunk.


git-svn-id: https://develop.svn.wordpress.org/trunk@46966 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-16 23:42:34 +00:00
Andrew Ozz 735b3543db Upload:
- Fix PHP warnings in `wp_unique_filename()` when the destination directory is unreadable.
- Run the final name collision test only for files that are saved to the uploads directory.
- Update the unit tests to match.

Props eden159, audrasjb, azaozz.
Fixes #48960 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@46965 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-16 23:22:00 +00:00
Sergey Biryukov 8a88cfac42 Coding Standards: Use strict comparison in `wp-admin/widgets.php`.
Props jenilk.
Fixes #49000.

git-svn-id: https://develop.svn.wordpress.org/trunk@46964 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-16 12:53:59 +00:00
Sergey Biryukov 2a8f0cb9e0 Coding Standards: Use strict comparison in `wp-admin/includes/network.php`.
Props ataurr.
Fixes #48994.

git-svn-id: https://develop.svn.wordpress.org/trunk@46963 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-16 12:35:26 +00:00
Sergey Biryukov 3b25bc4362 Coding Standards: Use strict comparison in `wp-admin/edit-tags.php`.
Props passoniate.
Fixes #48985.

git-svn-id: https://develop.svn.wordpress.org/trunk@46962 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-15 10:44:37 +00:00
Sergey Biryukov ee4f57d509 Coding Standards: Use strict comparison in `wp-admin/term.php`.
Props vinita29.
Fixes #48983.

git-svn-id: https://develop.svn.wordpress.org/trunk@46961 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-15 09:43:08 +00:00
Sergey Biryukov 49c6bc2a69 Coding Standards: Add missing braces to `if` conditions in `js/_enqueues/wp/util.js`.
Props ankitmaru.
Fixes #48980.

git-svn-id: https://develop.svn.wordpress.org/trunk@46960 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-15 08:43:42 +00:00
Sergey Biryukov b202cb423a Formatting: Return early from `wp_kses_attr_check()` if the element is not in the list of allowed elements and attributes.
Props krynes, tristanleboss.
Fixes #48549.

git-svn-id: https://develop.svn.wordpress.org/trunk@46959 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-14 15:51:33 +00:00
Sergey Biryukov 1440dab429 Docs: Clarify descriptions for `get_gmt_from_date()` and `get_date_from_gmt()`.
Props johnbillion, Rarst.
Fixes #48650.

git-svn-id: https://develop.svn.wordpress.org/trunk@46958 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-13 21:43:06 +00:00
Sergey Biryukov 5e840c755e I18N: Replace file names in translatable strings on Permalink Settings screen with placeholders.
Props ramiy.
Fixes #48863.

git-svn-id: https://develop.svn.wordpress.org/trunk@46957 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-13 21:25:14 +00:00
Ian Belanger b7b29ddfc9 Bundled Themes: Bump version number and update changelog in Twenty Twenty for WordPress 5.3.1.
This bumps the Twenty Twenty version number to `1.1` and update the `readme.txt` changelog.

Props audrasjb, sinatrateam, SergeyBiryukov
Fixes #48944.

git-svn-id: https://develop.svn.wordpress.org/trunk@46902 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-12 18:24:33 +00:00
Jake Spurlock 7c38cf178a Prevent stored XSS in the block editor.
Prevent escaped unicode characters become unescaped in unsafe HTML during JSON decoding.

Props: aduth, epiqueras, 


git-svn-id: https://develop.svn.wordpress.org/trunk@46896 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-12 18:00:45 +00:00
Jake Spurlock 39a8eacb5f Update `wp_kses_bad_protocol()` to recognize `:` on uri attributes,
`wp_kses_bad_protocol()` makes sure to validate that uri attributes don’t contain invalid/or not allowed protocols. While this works fine in most cases, there’s a risk that by using the colon html5 named entity, one is able to bypass this function.

Props: xknown, nickdaugherty, peterwilsoncc.


git-svn-id: https://develop.svn.wordpress.org/trunk@46895 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-12 17:52:18 +00:00
Jake Spurlock dcab984b1b Prevent stored XSS through wp_targeted_link_rel().
Props: vortfu, whyisjake, peterwilsoncc, xknown,  SergeyBiryukov, flaviozavan.



git-svn-id: https://develop.svn.wordpress.org/trunk@46894 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-12 17:51:35 +00:00
Jake Spurlock fb952b5ce0 Ensure that a user can publish_posts before making a post sticky.
Props: danielbachhuber, whyisjake, peterwilson, xknown.



git-svn-id: https://develop.svn.wordpress.org/trunk@46893 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-12 17:50:13 +00:00
Sergey Biryukov a69a2c241d Docs: Update description for `get_categories()` to avoid suggesting the deprecated `type` argument.
Follow-up to [13754].

Props dingo_d.
Fixes #48913.

git-svn-id: https://develop.svn.wordpress.org/trunk@46891 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-12 16:45:32 +00:00
Sergey Biryukov 2830c6869c Upgrade/Install: Improve the appearance of language selection on install:
* Remove a stray chevron.
* Improve focus and hover styles.

Props garrett-eclipse, audrasjb.
Fixes #48927.

git-svn-id: https://develop.svn.wordpress.org/trunk@46887 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-11 23:01:23 +00:00
Sergey Biryukov 3778b1eb82 Comments: Avoid a PHP notice in `comment_form()` if the `email` field is not set.
Follow-up to [46090].

Props mat-lipe.
Fixes #48943.

git-svn-id: https://develop.svn.wordpress.org/trunk@46885 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-11 22:12:09 +00:00