Commit Graph

2868 Commits

Author SHA1 Message Date
Andrew Ozz cf7865a91f Privacy: fix docs, formatting, white space, add tests for the personal data from comments exporter.
Props birgire.
See #43440.

git-svn-id: https://develop.svn.wordpress.org/trunk@42987 602fd350-edb4-49c9-b593-d223f7449a82
2018-04-18 22:54:23 +00:00
Felix Arntz 63eda3b3a4 Multisite: Verify the signup nonce using `wp_verify_nonce()` in `signup_nonce_check()`.
Prior to this change, the nonce passed from `wp-signup.php` was verified with a simple comparison. Furthermore in case of failures, `wp_die()` would be called right during the HTML markup being already printed. Now the error message is returned properly, modifying the `WP_Error` object in the passed `$result`.

Props herregroen.
Fixes #43667.


git-svn-id: https://develop.svn.wordpress.org/trunk@42976 602fd350-edb4-49c9-b593-d223f7449a82
2018-04-13 15:29:52 +00:00
Gary Pendergast 30354e5a9b Tests: Update the REST API fixtures.
[42967] included new post statii, but didn't add them to the REST API tests.

See #43481.



git-svn-id: https://develop.svn.wordpress.org/trunk@42972 602fd350-edb4-49c9-b593-d223f7449a82
2018-04-13 00:53:31 +00:00
Andrew Ozz 43b5e9ac20 Privacy: add helper function for anonymizing data in a standardized way.
Props jesperher, allendav, iandunn, birgire, azaozz.
Fixes #43545.

git-svn-id: https://develop.svn.wordpress.org/trunk@42971 602fd350-edb4-49c9-b593-d223f7449a82
2018-04-12 21:19:24 +00:00
Ian Dunn ede824e3cd Dashboard: Strip more extraneous IP parts to prevent PHP warnings.
This iterates on earlier versions of the code, in order to handle more edge cases. An arbitrary string like `or=\"` will now be stripped, as well as reachability scopes like `%eth0`.

Props eamax, soulseekah, iandunn.
Fixes #41083.


git-svn-id: https://develop.svn.wordpress.org/trunk@42968 602fd350-edb4-49c9-b593-d223f7449a82
2018-04-10 23:18:04 +00:00
Adam Silverstein 495ac15555 REST API: Handle api-request query parameters with plain permalinks.
When constructing the request URL, ensure that  `?` is replaced with `&` when the API root  already contains a `?`. Fixes an issue where requests were broken when sites had permalinks set to plain.

Props aduth.
Fixes #42382.



git-svn-id: https://develop.svn.wordpress.org/trunk@42965 602fd350-edb4-49c9-b593-d223f7449a82
2018-04-09 13:09:41 +00:00
Sergey Biryukov c8fa6497aa Formatting: Permit use of `text-transform` in `safecss_filter_attr()`.
Add unit tests for `safecss_filter_attr()`.

Props birgire, juiiee8487, danielbachhuber.
Fixes #42729.

git-svn-id: https://develop.svn.wordpress.org/trunk@42880 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-27 00:53:20 +00:00
John Blackbourn 3bb3d7a6c7 Build/Test Tools: Implement `assertNotWPError()` in appropriate places in the test suite.
Props birgire

Fixes #42065


git-svn-id: https://develop.svn.wordpress.org/trunk@42863 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-20 22:34:11 +00:00
Sergey Biryukov db606c9bb2 Formatting: Avoid a PHP 7.2 warning in `wp_kses_attr()` when one of `$allowedtags` elements is an uncountable value.
Props andrei0x309, soulseekah, SergeyBiryukov.
Fixes #43312.

git-svn-id: https://develop.svn.wordpress.org/trunk@42860 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-20 21:34:15 +00:00
Jeremy Felt 4902da091c Multisite: Use case-insensitive check on email domain whitelist.
Props greatislander.
Fixes #43148.


git-svn-id: https://develop.svn.wordpress.org/trunk@42858 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-20 19:06:09 +00:00
Dominik Schilling (ocean90) 877a59a843 Users: Use `promote_users` for role updates in `edit_user()`.
`edit_user()` can also update user roles but was still using the `edit_users` capability instead of the newer `promote_users` capability introduced in [14176].
This makes the role handling consistent with the bulk dropdown menu for role changes.

Props flixos90, johnjamesjacoby, ocean90.
Fixes #42564.

git-svn-id: https://develop.svn.wordpress.org/trunk@42855 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-19 20:28:28 +00:00
Dominik Schilling (ocean90) 8df8cf2df1 Pinking shears.
See #41057.

git-svn-id: https://develop.svn.wordpress.org/trunk@42843 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-18 14:22:09 +00:00
Joe McGill 9f9ff6afed Update unit test following r42839.
This updates the expected version number for Hello Dolly in `Tests_Ajax_Update_Plugin::test_update_plugin` following [42839].

See #43555.


git-svn-id: https://develop.svn.wordpress.org/trunk@42841 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-17 20:57:00 +00:00
Joe McGill 860b45216e Revert max-width styles on caption shortcodes.
This is a partial revert of [41724], so image captions include an
inline `width` style instead of `max-width`.

This returns the caption shortcode to the pre-4.9.0 behavior, while
retaining the extra unit test coverage added in [41724].

Fixes #43123. See #33981.


git-svn-id: https://develop.svn.wordpress.org/trunk@42837 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-16 20:06:41 +00:00
Felix Arntz 8e4bd924d2 Multisite: Introduce metadata for sites.
A new global multisite table `wp_blogmeta` is added to the database schema, and a set of `*_site_meta()` API functions are introduced.

The implementation fails gracefully when the new table is not yet available, which may happen especially shortly after the core update, before the network has been upgraded to the new database schema. The presence of the table is detected once and stored as a global setting on the main network.

Core does not yet use site metadata, but there are several use-cases to be implemented or explored in the near future, and it allows plugins to extend sites with arbitrary data, which will come in particularly handy with the upcoming REST API endpoint for sites.

Props spacedmonkey, johnjamesjacoby, jeremyfelt, flixos90.
Fixes #37923.


git-svn-id: https://develop.svn.wordpress.org/trunk@42836 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-16 02:14:04 +00:00
Felix Arntz a7b3f5f759 Multisite: Add missing group annotations to tests included in [42833].
This ensures tests are skipped correctly when not using multisite.

See #43506.


git-svn-id: https://develop.svn.wordpress.org/trunk@42834 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-13 17:56:05 +00:00
Felix Arntz 52a77e5254 Multisite: Ensure the `{$network_id}:notoptions` array is set in cache in `get_network_option()`.
Prior to this change, the `{$network_id}:notoptions` cache would only be fetched, but not set, unless the actual database lookup would be unsuccessful. This enhancement slightly improves performance by preventing unnecessary external object cache lookups if one is used.

Fixes #43506.


git-svn-id: https://develop.svn.wordpress.org/trunk@42833 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-13 15:36:14 +00:00
Felix Arntz 5f56921131 General: Introduce dashboard widget to inform administrators about outdated PHP versions.
This new dashboard widget is shown on WordPress sites which are powered by a PHP version which WordPress considers outdated, in order to inform site owners about the resulting problems and to explain how to upgrade to a supported version. An education page for that purpose has been previously created that the widget links to. The link is translatable so that localized versions of the page can be referred to as they become available.

The nag follows the example of the Browse Happy dashboard widget and is only visible for administrators, or network administrators when using multisite. To determine whether it needs to be displayed, a new wordpress.org API introduced prior is called that handles the version logic in a centralized location.

Props flixos90, hedgefield, schlessera.
Fixes #41191.


git-svn-id: https://develop.svn.wordpress.org/trunk@42832 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-12 16:42:11 +00:00
Sergey Biryukov 1e54b5a2ae Link Template: Apply `get_{$adjacent}_post_excluded_terms` filter to an empty `excluded_terms` parameter as well.
Props soulseekah, zottto.
Fixes #43521.

git-svn-id: https://develop.svn.wordpress.org/trunk@42828 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-11 17:31:04 +00:00
Sergey Biryukov 9b713c6d12 Tests: Skip symlinked theme file tests if `symlink()` is not available, e.g. in PHP 5.2.x on Windows.
See #43508.

git-svn-id: https://develop.svn.wordpress.org/trunk@42819 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-09 17:47:39 +00:00
John Blackbourn 5816caddcf Themes: Revert [42788] as it breaks a lot of things.
See #43228


git-svn-id: https://develop.svn.wordpress.org/trunk@42816 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-09 16:59:57 +00:00
Sergey Biryukov 94e44cd9ed Tests: Skip symlinked theme file tests if the links could not be created.
Fixes #43508.

git-svn-id: https://develop.svn.wordpress.org/trunk@42812 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-09 01:09:17 +00:00
Sergey Biryukov 257048ac71 Tests: Correct assertion in `Tests_WP_Customize_Setting::test_constructor_with_args()`.
Props jipmoors.
See #30988, #43218.

git-svn-id: https://develop.svn.wordpress.org/trunk@42799 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-08 16:37:59 +00:00
Mike Schroder 3a46cba430 Media: Correctly allow changing PDF thumbnail crop value.
Corrects logic that keeping plugins from setting crop value of intermediate image sizes for rendered PDFs.

Adds test.

Props leemon, SergeyBiryukov, chetan200891, birgire.
Fixes #43226.

git-svn-id: https://develop.svn.wordpress.org/trunk@42792 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-07 01:18:08 +00:00
John Blackbourn d83f786d3c Themes: Ensure the theme roots cache is cleared when registering a theme directory.
Props soulseekah, johnbillion

Fixes #43228


git-svn-id: https://develop.svn.wordpress.org/trunk@42788 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-05 22:13:36 +00:00
Sergey Biryukov 007a7caad4 Media: Recognize `.ico` files as displayable images on PHP 5.3+ and allow attachment meta data to be generated for them.
Props remyvv, Guido07111975.
Fixes #43458.

git-svn-id: https://develop.svn.wordpress.org/trunk@42780 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-05 01:02:20 +00:00
Sergey Biryukov 4edda96383 Filesystem API: Allow `download_url()` to return the response code and body on error as an additional `WP_Error` object data.
The error response body size is limited to 1 KB by default to avoid taking up too much memory. The size can be increased using `download_url_error_max_body_size` filter.

Props soulseekah, campusboy1987, mihdan, SergeyBiryukov.
Fixes #43329.

git-svn-id: https://develop.svn.wordpress.org/trunk@42773 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-04 17:13:35 +00:00
Andrew Ozz 6d094f61bb Add pre-save content filter to make target=_blank always secure.
Props notnownikki, iseulde, azaozz
Fixes #43187

git-svn-id: https://develop.svn.wordpress.org/trunk@42770 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-02 14:41:04 +00:00
Boone Gorges e840759df5 Allow `LIKE` queries against the 'key' value in meta queries.
The new `compare_key=LIKE` parameter works in conjunction with `key` in a
similar way to the `compare=LIKE` and `value`: by doing a "compares" `LIKE`
query. This allows developers to do partial matches against keys when
doing meta queries.

Props mariovalney, chasewg.
Fixes #42409.

git-svn-id: https://develop.svn.wordpress.org/trunk@42768 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-01 04:02:41 +00:00
Ian Dunn c896326c55 External Libraries: Test for MEjs files in `src` instead of `build`.
The `build` task doesn't get run during TravisCI jobs, so the `build` folder doesn't exist in that context. Because of that, the test added in r42762 was failling.

Checking for the files in `src` instead achieves the same goal as that commit, but should pass in Travis.

See #43101
See https://wordpress.slack.com/archives/C02RQBWTW/p1519742993000615


git-svn-id: https://develop.svn.wordpress.org/trunk@42763 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-28 00:25:08 +00:00
Ian Dunn fde455a89f External Libraries: Test that MediaElement SWF files remain deleted.
The files were removed from Core in r42462 because they're no longer necessary, and have a history of security issues. They remain upstream, though, so this test makes it explicitly clear that they should not be added back in the future without careful consideration and discussion with the Security team.

`Tests_Admin_IncludesUpdateCore::test_new_files_are_not_in_old_files_array_compiled()` would already catch files with the exact same name, but this test will also catch files with new names, just to be extra cautious.

Props iandunn, ocean90, SergeyBiryukov
Fixes 43101


git-svn-id: https://develop.svn.wordpress.org/trunk@42762 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-27 14:37:15 +00:00
Sergey Biryukov 1cc516f2e8 General: Introduce `WP_Error::has_errors()` method and use it where appropriate.
Props robdxw, DrewAPicture, SergeyBiryukov.
Fixes #42742.

git-svn-id: https://develop.svn.wordpress.org/trunk@42761 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-27 02:30:46 +00:00
Sergey Biryukov c95b962b77 Tests: Correct a "false positive" assertion in `test_media_handle_upload_ignores_page_parent_for_directory_date()`.
Props birgire.
Fixes #42736.

git-svn-id: https://develop.svn.wordpress.org/trunk@42743 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-25 18:46:44 +00:00
Sergey Biryukov 557103ede6 Tests: Avoid hardcoded domain name in `test_media_handle_upload_uses_post_parent_for_directory_date()`.
Props birgire.
See #42736.

git-svn-id: https://develop.svn.wordpress.org/trunk@42742 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-25 18:42:26 +00:00
Adam Silverstein d8a4215abb Unit Tests: add a DIR_TESTROOT constant to avoid relative paths.
Fix an issue that prevents tests from running correctly when run outside their normal context.

Props PressLabs, johnbillion.
Fixes #40071.



git-svn-id: https://develop.svn.wordpress.org/trunk@42741 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-25 18:06:49 +00:00
Adam Silverstein 74ccb68c56 Taxonomy: restore TagSearch unit tests and correct deprecated version string.
Reverts unit test removal, instead changing them to expect the function to be deprecated.
Correct the version the ajax callback was deprecated.

Amends [42614].

Props dlh, ocean90.
Fixes #38922.



git-svn-id: https://develop.svn.wordpress.org/trunk@42737 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-25 16:27:57 +00:00
Sergey Biryukov 3f4fe54b43 Menus: When checking if a Custom Link matches the current URL to add the `current-menu-item` class, check for decoded URL as well.
Props soulseekah, campusboy1987.
Fixes #43401.

git-svn-id: https://develop.svn.wordpress.org/trunk@42732 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-24 13:43:07 +00:00
Gary Pendergast 1e3781cd71 REST API: Show taxonomy visibility settings.
For Gutenberg and other admin-type interfaces, it's useful to be able to see the visibility settings for taxonomies.

Props joehoyle, pento.
Fixes #42707.



git-svn-id: https://develop.svn.wordpress.org/trunk@42729 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-22 00:24:00 +00:00
Aaron Jorbin 53a61339e4 Community Events Dashboard: Always show a WordCamp if one is coming up
WordCamps are celebrations of the local WordPress Community and once a local one is scheduled, people in that community should know it is coming. This adjusts the WordPress Events in the dashboard widgets to always display a WordCamp, even if there are multiple Meetups happening first.

Props iandunn, metalandcoffee, warmlaundry, alejandroxlopez, jorbin.
Fixes #41112.



git-svn-id: https://develop.svn.wordpress.org/trunk@42726 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-21 23:00:50 +00:00
Sergey Biryukov 9e31509293 Tests: Replace use of `$this->server` with `rest_get_server()` for better memory recycling.
Props danielbachhuber.
Fixes #41641.

git-svn-id: https://develop.svn.wordpress.org/trunk@42724 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-21 16:24:30 +00:00
Sergey Biryukov 0711e585fb Media: After [42693], update HTML4 markup in `img_caption_shortcode()` to avoid an empty ID attribute as well.
Add a unit test for `aria-describedby` in `img_caption_shortcode()`.

See #34595.

git-svn-id: https://develop.svn.wordpress.org/trunk@42694 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-11 15:39:20 +00:00
Helen Hou-Sandi 05b37069a4 Options: Use strings in the test suite that follow community guidelines.
Also somewhat explain to future maintainers why this pairing of strings was chosen, besides this committer's musical preferences. Social opinions on cancer are fairly clear, as are commonly accepted definitions of profanity and family-friendly language.

Shout out to the close contender, which would have been particularly appropriate here: "You could be the king // But watch the queen conquer".

see #43207, #38176


git-svn-id: https://develop.svn.wordpress.org/trunk@42667 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-07 22:41:48 +00:00
Aaron Jorbin 2c6f1b18f4 Options: Use most appropriate language in the test suite.
The test suite's opinion of cancer should be clear.

Reverts r42659.

See #43207, #38176




git-svn-id: https://develop.svn.wordpress.org/trunk@42663 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-07 20:58:21 +00:00
John Blackbourn 9b46512501 Options: Use more appropriate language in the test suite.
See #43207, #38176


git-svn-id: https://develop.svn.wordpress.org/trunk@42659 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-07 18:51:55 +00:00
Felix Arntz ea13c56d7f Options: Unhook default option filter when setting is unregistered.
Fixes #43207.


git-svn-id: https://develop.svn.wordpress.org/trunk@42655 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-06 14:48:46 +00:00
John Blackbourn d512973c84 Canonical: Add `$x_redirect_by` parameter to `wp_safe_redirect()`.
See [42633] and [42408].

Fixes #42313.


git-svn-id: https://develop.svn.wordpress.org/trunk@42647 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-04 16:04:10 +00:00
Drew Jaynes 311531a964 Tests: Simplify `@covers` annotations for `WP_Error` test coverage. Also fix a typo in a test method name.
See #42742.


git-svn-id: https://develop.svn.wordpress.org/trunk@42646 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-03 17:37:51 +00:00
Drew Jaynes 86d486d67d Tests: Fix two typos introduced for a get_term_field() test in [35270].
See #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@42645 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-03 17:10:51 +00:00
Sergey Biryukov 59e1b7318d Tests: Correct erroneous `@covers` and `@use` tags.
Props jipmoors.
Fixes #43203.

git-svn-id: https://develop.svn.wordpress.org/trunk@42636 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-01 16:08:04 +00:00
Sergey Biryukov 07bff5d8bd Tests: Improve tests for `wp_get_post_parent_id()` added in [42397].
Props frank-klein.
Fixes #42797.

git-svn-id: https://develop.svn.wordpress.org/trunk@42635 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-01 16:02:26 +00:00