John Blackbourn
0b2e31a7f8
Docs: Inline documentation improvements for media related functions and hooks.
...
See #47364 , #50768
Built from https://develop.svn.wordpress.org/trunk@49020
git-svn-id: http://core.svn.wordpress.org/trunk@48782 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 15:55:10 +00:00
Sergey Biryukov
2884b7b1b7
Media: Return a WP_Error
from WP_Image_Editor_GD::load()
if file contents could not be retrieved.
...
This avoids an error on PHP 8 caused by calling `imagecreatefromstring()` on an empty result.
See #50913 .
Built from https://develop.svn.wordpress.org/trunk@49019
git-svn-id: http://core.svn.wordpress.org/trunk@48781 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 14:28:05 +00:00
Sergey Biryukov
8752dbaaba
Tests: Correctly unset non-supported image editor engines in some image tests.
...
Follow-up to [49009], [49014].
See #50639 , #50640 .
Built from https://develop.svn.wordpress.org/trunk@49018
git-svn-id: http://core.svn.wordpress.org/trunk@48780 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 14:15:03 +00:00
John Blackbourn
43b11121de
Media: Correct some types for attachment ID parameters passed to functions and filters.
...
See #47364 , #50768
Built from https://develop.svn.wordpress.org/trunk@49017
git-svn-id: http://core.svn.wordpress.org/trunk@48779 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 14:05:05 +00:00
John Blackbourn
e22107ce4e
Media: Correct some types in docblocks for filters related to thumbnails.
...
Props dilipbheda
See #47364 , #50768
Built from https://develop.svn.wordpress.org/trunk@49016
git-svn-id: http://core.svn.wordpress.org/trunk@48778 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 13:40:04 +00:00
Sergey Biryukov
e6fd778208
Tests: Use more specific assertions in Tests_Image_Functions::test_load_directory()
.
...
This avoids an error on PHP 8 caused by calling `get_resource_type()` on a string.
See #50913 .
Built from https://develop.svn.wordpress.org/trunk@49015
git-svn-id: http://core.svn.wordpress.org/trunk@48777 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 13:33:04 +00:00
Sergey Biryukov
a29b071f80
Tests: Optimize some image tests to avoid checking for image editor engines availability twice.
...
Follow-up to [49009].
See #50639 , #50640 .
Built from https://develop.svn.wordpress.org/trunk@49014
git-svn-id: http://core.svn.wordpress.org/trunk@48776 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 13:27:05 +00:00
John Blackbourn
7d61c45afc
I18N: Add a language icon next to the Default Language network option.
...
Fixes #51359
Built from https://develop.svn.wordpress.org/trunk@49013
git-svn-id: http://core.svn.wordpress.org/trunk@48775 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 13:18:05 +00:00
John Blackbourn
ecfff6fe80
Media: Correct the image thumbnail logic in media templates.
...
This ensures the correct data properties are checked before displaying image thumbnails.
Props chetan200891
Fixes #49655
Built from https://develop.svn.wordpress.org/trunk@49012
git-svn-id: http://core.svn.wordpress.org/trunk@48774 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 13:15:04 +00:00
John Blackbourn
123806ff28
Themes: Remove the ability to delete themes from the single site Appearance screen on Multisite installations.
...
This brings theme deletion inline with plugin deletion and theme and plugin editing, which can only be performed from within Network Admin.
Props Mista-Flo, williampatton, johnbillion
Fixes #41441
Built from https://develop.svn.wordpress.org/trunk@49011
git-svn-id: http://core.svn.wordpress.org/trunk@48773 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 12:03:05 +00:00
Sergey Biryukov
e8f35359d7
Tests: Consistently require imagejpeg()
function in image_make_intermediate_size()
tests.
...
This outputs a proper message if the requirement is not met, instead of an obscure PHP error further in the test.
See #50639 , #50640 .
Built from https://develop.svn.wordpress.org/trunk@49010
git-svn-id: http://core.svn.wordpress.org/trunk@48772 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 03:33:05 +00:00
Sergey Biryukov
795e4ebd31
Tests: Skip some image tests if neither GD nor Imagick image editor engines are supported on the system.
...
The explicit message brings some consistency with other image editor tests, specifically the ones using the `WP_Image_UnitTestCase` class.
Previously, the tests were marked as "risky" in that scenario, due to performing no assertions.
See #50639 , #50640 .
Built from https://develop.svn.wordpress.org/trunk@49009
git-svn-id: http://core.svn.wordpress.org/trunk@48771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 02:47:05 +00:00
Sergey Biryukov
8791de899a
Coding Standards: Fix WPCS issue in [49007].
...
See #50913 .
Built from https://develop.svn.wordpress.org/trunk@49008
git-svn-id: http://core.svn.wordpress.org/trunk@48770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 01:18:04 +00:00
Sergey Biryukov
9e3b5d2f12
Tests: Fix the failures in REST API format
keyword validation tests on PHP 8.
...
The tests ensure that `rest_sanitize_value_from_schema()` and `rest_validate_value_from_schema()` throw an "undefined offset" notice when the required `type` schema keyword is not passed.
In PHP 8, that notice is now a warning, so the tests need to be adjusted accordingly.
Follow-up to [48300], [48993].
See #50913 .
Built from https://develop.svn.wordpress.org/trunk@49007
git-svn-id: http://core.svn.wordpress.org/trunk@48769 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 00:57:06 +00:00
Sergey Biryukov
4ae2bafafd
Tests: Add missing @covers
tags for files in phpunit/tests/functions/
.
...
Props pbearne, jrf.
See #39265 .
Built from https://develop.svn.wordpress.org/trunk@49006
git-svn-id: http://core.svn.wordpress.org/trunk@48768 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-19 15:54:03 +00:00
Sergey Biryukov
9bb4b76044
Tests: Speed up slashed data tests by reusing some more shared fixtures.
...
Follow-up to [35249], [49003].
See #51344 .
Built from https://develop.svn.wordpress.org/trunk@49005
git-svn-id: http://core.svn.wordpress.org/trunk@48767 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-19 11:12:04 +00:00
Sergey Biryukov
b27ebaa269
Coding Standards: Give the $id
variable in slashed data tests a more descriptive name.
...
See #50767 , #51344 .
Built from https://develop.svn.wordpress.org/trunk@49004
git-svn-id: http://core.svn.wordpress.org/trunk@48766 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-19 10:55:05 +00:00
Sergey Biryukov
54fe0e0698
Tests: Speed up slashed data tests by reusing shared fixtures.
...
Follow-up to [35249].
See #51344 .
Built from https://develop.svn.wordpress.org/trunk@49003
git-svn-id: http://core.svn.wordpress.org/trunk@48765 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-19 10:36:03 +00:00
Sergey Biryukov
c50c266e51
Tests: Speed up tests for wp_allow_comment()
by reusing shared fixtures.
...
Props frank-klein.
Fixes #51216 .
Built from https://develop.svn.wordpress.org/trunk@49002
git-svn-id: http://core.svn.wordpress.org/trunk@48764 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-19 09:27:06 +00:00
Sergey Biryukov
f2a2ffbf2c
Tests: Simplify the logic in WP_UnitTestCase_Base::setUpBeforeClass()
and ::tearDownAfterClass()
.
...
See #51344 .
Built from https://develop.svn.wordpress.org/trunk@49001
git-svn-id: http://core.svn.wordpress.org/trunk@48763 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-19 09:13:07 +00:00
Peter Wilson
b1505c2d9c
Posts, Post Types: Ensure default terms are added by wp_publish_post()
.
...
Transitioning posts from `auto-draft` to `publish` via `wp_publish_post()` could result in published posts without the default category or custom taxonomy default terms.
Props frank-klein, TimothyBlynJacobs, peterwilsoncc.
Fixes #51292 .
Built from https://develop.svn.wordpress.org/trunk@49000
git-svn-id: http://core.svn.wordpress.org/trunk@48762 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-19 01:22:08 +00:00
Sergey Biryukov
88ea2929b7
Tests: Simplify PluralFormsTest::test_exceptions()
.
...
Previously, the test had to use an older pattern for catching the generic `Exception` exceptions for compatibility with PHPUnit 3.6 on PHP 5.2.
Now that WordPress supports PHPUnit 5.4 as the minimum version, the `expectException()` method can be used directly.
Follow-up to [41725], [41730].
See #51344 .
Built from https://develop.svn.wordpress.org/trunk@48999
git-svn-id: http://core.svn.wordpress.org/trunk@48761 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 14:13:03 +00:00
Sergey Biryukov
0e0c620dee
Docs: Update the code example in WP_Ajax_UnitTestCase::dieHandler()
DocBlock to use expectException()
.
...
Follow-up to [48996], [48997].
See #51344 .
Built from https://develop.svn.wordpress.org/trunk@48998
git-svn-id: http://core.svn.wordpress.org/trunk@48760 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 13:55:04 +00:00
Sergey Biryukov
b69db72a08
Tests: Switch Ajax tests to use the expectException()
method directly, instead of the WP_UnitTestCase_Base::setExpectedException()
wrapper.
...
This brings some consistency with other tests.
Follow-up to [48996].
See #51344 .
Built from https://develop.svn.wordpress.org/trunk@48997
git-svn-id: http://core.svn.wordpress.org/trunk@48759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 13:50:04 +00:00
Sergey Biryukov
e42779f9a0
Tests: Consistently use the expectException()
method instead of the older @expectedException
annotation.
...
See https://thephp.cc/news/2016/02/questioning-phpunit-best-practices
The method is available since PHPUnit 5.2, and WordPress currently supports PHPUnit 5.4 as the minimum version.
Follow-up to [48993].
See #51344 .
Built from https://develop.svn.wordpress.org/trunk@48996
git-svn-id: http://core.svn.wordpress.org/trunk@48758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 13:24:07 +00:00
Sergey Biryukov
68d3c5ca56
Docs: Add a @since
note about adjacent_posts_rel_link_wp_head()
no longer being used in core.
...
Follow-up to [48966].
Props jnylen0.
See #39111 .
Built from https://develop.svn.wordpress.org/trunk@48995
git-svn-id: http://core.svn.wordpress.org/trunk@48757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 11:06:04 +00:00
Sergey Biryukov
0cdab6e91d
Docs: Add a @since
note for the recovery_mode_email
filter about the $email
argument now including the attachments
key.
...
Follow-up to [48964].
See #51276 .
Built from https://develop.svn.wordpress.org/trunk@48994
git-svn-id: http://core.svn.wordpress.org/trunk@48756 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 11:03:02 +00:00
Sergey Biryukov
6f4de5f31a
Tests: Fix the failure in test_get_weekday_undefined_index()
on PHP 8.
...
The test ensures that `WP_Locale::get_weekday()` throws an "undefined offset" notice when called with an incorrect `$weekday_number` parameter.
In PHP 8, that notice is now a warning, so the test needs to be adjusted accordingly.
See #50913 .
Built from https://develop.svn.wordpress.org/trunk@48993
git-svn-id: http://core.svn.wordpress.org/trunk@48755 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 10:58:03 +00:00
Sergey Biryukov
ddefc9ee9a
Twenty Twenty: Update the URL for PHP date formats table in translator comments.
...
Follow-up to [48991].
Props hareesh-pillai, mukesh27, iandunn.
Fixes #51335 . See #51332 .
Built from https://develop.svn.wordpress.org/trunk@48992
git-svn-id: http://core.svn.wordpress.org/trunk@48754 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 10:44:04 +00:00
Sergey Biryukov
d5b8d282e8
Docs: Update the URL for PHP date formats table in translator comments.
...
Props hareesh-pillai, iandunn.
Fixes #51332 .
Built from https://develop.svn.wordpress.org/trunk@48991
git-svn-id: http://core.svn.wordpress.org/trunk@48753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 10:37:08 +00:00
Sergey Biryukov
e1a05a42d3
Comments: Assign the array of comment data returned from the comments_pre_query
filter to the comments
property of the current WP_Comment_Query
instance.
...
This avoids the performance overhead of calling `WP_Comment_Query::get_comments()` twice: first when creating the object instance, then to retrieve the filtered results.
This also makes the filter a bit more consistent with other similar filters, e.g. `posts_pre_query`, `terms_pre_query`, or `users_pre_query`.
Follow-up to [46086].
Props dinhtungdu, imath, spacedmonkey, adamsilverstein, SergeyBiryukov.
Fixes #50521 .
Built from https://develop.svn.wordpress.org/trunk@48990
git-svn-id: http://core.svn.wordpress.org/trunk@48752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 19:55:08 +00:00
antpb
541796de46
Media: Allow contextually generated images to show in Media Library grid view.
...
In grid view, contextually generated or cropped media is filtered out causing page numbering to be offset and incorrect. This also impacted any media utilizing `media-models.js`.
Props webmandesign, audrasjb, afercia, pbiron, mista-flo.
Fixes #46127 , #50410 , #47215 .
Built from https://develop.svn.wordpress.org/trunk@48989
git-svn-id: http://core.svn.wordpress.org/trunk@48751 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 14:42:04 +00:00
Sergey Biryukov
359119a31e
Tests: Move the data_wp_site_query_meta_query()
data provider next to the test it's used in.
...
See #50767 .
Built from https://develop.svn.wordpress.org/trunk@48988
git-svn-id: http://core.svn.wordpress.org/trunk@48750 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 11:30:02 +00:00
Sergey Biryukov
226dc9fc2c
Docs: Correct comments in comments_pre_query
, networks_pre_query
, and sites_pre_query
tests.
...
Follow-up to [44983], [46086].
See #50768 .
Built from https://develop.svn.wordpress.org/trunk@48987
git-svn-id: http://core.svn.wordpress.org/trunk@48749 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 11:20:04 +00:00
Sergey Biryukov
e01409866e
Docs: Reformat comments_pre_query
, networks_pre_query
, sites_pre_query
DocBlocks for better readability.
...
See #50768 .
Built from https://develop.svn.wordpress.org/trunk@48986
git-svn-id: http://core.svn.wordpress.org/trunk@48748 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 11:10:03 +00:00
Sergey Biryukov
b66ff2f68d
Docs: Fix typo in *_pre_query
filter DocBlocks.
...
See #50768 .
Built from https://develop.svn.wordpress.org/trunk@48985
git-svn-id: http://core.svn.wordpress.org/trunk@48747 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 10:45:03 +00:00
Sergey Biryukov
06e53b90a1
Docs: Correct the parameter type for networks_pre_query
filter.
...
The filter should return the network count as an integer if `$this->query_vars['count']` is set.
Follow-up to [46100].
See #50768 , #47599 .
Built from https://develop.svn.wordpress.org/trunk@48984
git-svn-id: http://core.svn.wordpress.org/trunk@48746 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 10:37:05 +00:00
Sergey Biryukov
ac00862f44
Formatting: Make sure links_add_target()
adds the target
attribute to the correct tag.
...
Previously, the attribute could unintentionally be added to a tag that starts with the same characters, e.g. `<aside>` instead of `<a>`.
Props antonlukin.
Fixes #51313 .
Built from https://develop.svn.wordpress.org/trunk@48983
git-svn-id: http://core.svn.wordpress.org/trunk@48745 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 10:14:07 +00:00
Helen Hou-Sandí
75262781d9
i18n: Ensure block type strings in the REST API end with a full stop.
...
Props ramiy, justinahinon.
Fixes #50805 .
Built from https://develop.svn.wordpress.org/trunk@48982
git-svn-id: http://core.svn.wordpress.org/trunk@48744 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-16 19:23:07 +00:00
Sergey Biryukov
eef2e5c85c
Code Modernization: Return an empty string from wpdb::prepare()
if there are not enough arguments to match the placeholders.
...
This avoids a fatal error on PHP 8 caused by passing mismatched arguments to `vsprintf()`, and maintains the current behaviour.
Follow-up to [48979], [48980].
See #50913 , #50639 .
Built from https://develop.svn.wordpress.org/trunk@48981
git-svn-id: http://core.svn.wordpress.org/trunk@48743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-16 02:29:06 +00:00
Sergey Biryukov
9734ed5673
Code Modernization: Return an empty string from wpdb::_real_escape()
if a non-scalar value is passed.
...
This avoids a fatal error on PHP 8 caused by passing a non-string value to ` mysqli_real_escape_string()`, and maintains the current behaviour.
See #50913 , #50639 .
Built from https://develop.svn.wordpress.org/trunk@48980
git-svn-id: http://core.svn.wordpress.org/trunk@48742 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-16 01:48:10 +00:00
Sergey Biryukov
b37e0cec1b
Tests: Revert [48973].
...
These tests ensure that a `_doing_it_wrong()` notice is thrown when `wpdb::prepare()` is called incorrectly, but also that the function will still handle the provided input as correctly as possible.
Disabling these tests on PHP 8 hides a problem, i.e. the function will no longer throw a notice and handle things correctly, it will now cause a white screen of death due to a fatal error.
That is a backward compatibility break, and `wpdb::prepare()` should be updated instead to maintain the original behaviour on PHP 8.
Props jrf, ayeshrajans.
See #50913 , #50639 .
Built from https://develop.svn.wordpress.org/trunk@48979
git-svn-id: http://core.svn.wordpress.org/trunk@48741 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-16 01:35:09 +00:00
Sergey Biryukov
3838ecccdd
Build/Test Tools: Restore the QUnit
global in JSHint config for QUnit.
...
Follow-up to [47512], [48977].
See #51312 , #37117 .
Built from https://develop.svn.wordpress.org/trunk@48978
git-svn-id: http://core.svn.wordpress.org/trunk@48740 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-15 10:09:07 +00:00
Sergey Biryukov
79ab76f5d8
Build/Test Tools: Remove unused legacy globals from JSHint config for QUnit.
...
Follow-up to [47512].
Props TimoTijhof.
Fixes #51312 . See #37117 .
Built from https://develop.svn.wordpress.org/trunk@48977
git-svn-id: http://core.svn.wordpress.org/trunk@48739 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-15 10:04:05 +00:00
Sergey Biryukov
042bdf66fd
Docs: Document the usage of $wpdb
global in wp_delete_attachment_files()
.
...
Props jontyravi.
Fixes #51309 .
Built from https://develop.svn.wordpress.org/trunk@48976
git-svn-id: http://core.svn.wordpress.org/trunk@48738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-14 13:43:04 +00:00
Sergey Biryukov
d1dbc3c69d
Docs: Document the usage of $wpdb
global in wp_get_post_autosave()
.
...
Follow-up to [48422].
Props ravivaddweb.
Fixes #51308 . See #34560 .
Built from https://develop.svn.wordpress.org/trunk@48975
git-svn-id: http://core.svn.wordpress.org/trunk@48737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-14 13:37:06 +00:00
Sergey Biryukov
f851814996
Tests: Correct assertion in Tests_DB::test_prepare_incorrect_arg_count()
.
...
On failure, `wpdb::prepare()` returns either an empty string or `null`, not `false`.
The test only passed accidentally due to `assertEquals()` not performing a strict type check.
Follow-up to [41662].
See #38266 .
Built from https://develop.svn.wordpress.org/trunk@48974
git-svn-id: http://core.svn.wordpress.org/trunk@48736 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-13 15:21:06 +00:00
Sergey Biryukov
7e2c6d63b7
Tests: Require PHP less than 8.0 for some wpdb
tests.
...
These tests ensure that `wpdb::prepare()` throws a `_doing_it_wrong()` notice when called with an incorrect number of arguments, or with arguments of a wrong type.
PHP 8 introduces similar error messages natively, making these tests redundant on PHP 8.0 or later.
Follow-up to [41470], [41662].
See #50913 .
Built from https://develop.svn.wordpress.org/trunk@48973
git-svn-id: http://core.svn.wordpress.org/trunk@48735 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-13 02:49:06 +00:00
Sergey Biryukov
a2947f7054
Tests: Replace the native PHPUnit getMockForAbstractClass()
and getMockBuilder()
methods.
...
This avoids parse errors in PHPUnit internals due to `match` being a reserved keyword in PHP 8.
To run on PHP 8, the tests relying on these methods require PHPUnit 9.3 or later.
When the test suite is updated for compatibility with PHPUnit 9.x, these overrides can be removed.
See #50913 , #50902 .
Built from https://develop.svn.wordpress.org/trunk@48972
git-svn-id: http://core.svn.wordpress.org/trunk@48734 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-13 02:38:07 +00:00
Sergey Biryukov
282c813259
Coding Standards: Explicitly declare the $wp_version
global used in some core files.
...
Props jaydeep-rami, sabernhardt.
Fixes #44932 .
Built from https://develop.svn.wordpress.org/trunk@48971
git-svn-id: http://core.svn.wordpress.org/trunk@48733 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-12 00:12:08 +00:00