Commit Graph

3196 Commits

Author SHA1 Message Date
Dominik Schilling
41dc7c7365 I18N: Following [45688], remove test for removed method.
See #44865.

git-svn-id: https://develop.svn.wordpress.org/trunk@45689 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-27 14:29:28 +00:00
Dominik Schilling
84b977945c I18N: Add support for custom WP_PLUGIN_URL in load_script_textdomain().
Plugins may not be on the same host/path as the rest of the content. To support loading translations for this setup check if the script source matches `plugins_url()`.
Also fixes an undefined index notice when a custom content URL has no path.

Props odminstudios, ocean90.
Fixes #46336, #46387.

git-svn-id: https://develop.svn.wordpress.org/trunk@45685 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-27 12:43:56 +00:00
Gary Pendergast
4943b377ce Coding Standards: Move wp-includes/class-oembed.php to wp-includes/class-wp-oembed.php.
This renames the file containing the `WP_oEmbed` class to conform to the coding standards.

This commit also includes:

- A new `class-oembed.php` that includes the new file, for anyone that may've been including the file directly.
- Replaces references to the old filename with the new filename.

See #47632.



git-svn-id: https://develop.svn.wordpress.org/trunk@45663 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-19 04:31:40 +00:00
Sergey Biryukov
fd23000b11 Menus: Trim whitespace from custom link URLs.
Props majemedia, SergeyBiryukov.
Fixes #47723.

git-svn-id: https://develop.svn.wordpress.org/trunk@45655 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-17 18:44:56 +00:00
Gary Pendergast
8416a2b410 Coding Standards: Move wp-admin/custom-header.php to wp-admin/includes/class-custom-image-header.php
This renames the file containing the `Custom_Image_Header` class to conform to the coding standards.

This commit also includes:
- A new `custom-header.php` that includes the new file, for anyone that may've been including the file directly.
- Replaces references to the old filename with the new filename.

See #47632.



git-svn-id: https://develop.svn.wordpress.org/trunk@45654 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-17 06:16:27 +00:00
Sergey Biryukov
2ae276c44f Media: Add a unit test for wp_get_mime_types().
Props pbearne.
Fixes #47701.

git-svn-id: https://develop.svn.wordpress.org/trunk@45646 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-16 21:51:45 +00:00
Gary Pendergast
2da7f9f524 Code Modernisation: Fix known instances of array access on data types that can't be accessed as arrays.
PHP 7.4 addes a warning when trying access a null/bool/int/float/resource (everything but array, string and object) as if it were an array.

This change fixes all of these warnings visible in unit tests.

Props jrf.
See #47704.




git-svn-id: https://develop.svn.wordpress.org/trunk@45639 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-15 06:24:08 +00:00
Gary Pendergast
c6c78490e2 Coding Standards: Fix the remaining issues in /tests.
All PHP files in `/tests` now conform to the PHP coding standards, or have exceptions appropriately marked.

Travis now also runs `phpcs` on the `/tests` directory, any future changes to these files must conform entirely to the WordPress PHP coding standards. 🎉

See #47632.



git-svn-id: https://develop.svn.wordpress.org/trunk@45607 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-08 00:55:20 +00:00
Gary Pendergast
18ec05e23a Coding Standards: Fix all WordPress.DB.PreparedSQLPlaceholders issues.
See #47632.



git-svn-id: https://develop.svn.wordpress.org/trunk@45603 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-05 05:42:57 +00:00
Gary Pendergast
6acb0c6402 Coding Standards: Fix all WordPress.WhiteSpace.PrecisionAlignment issues.
See #47632.



git-svn-id: https://develop.svn.wordpress.org/trunk@45602 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-05 05:20:52 +00:00
Gary Pendergast
a00c69458b Formatting: Revert the changes to wpautop() in [45585,45587].
See #27350.


git-svn-id: https://develop.svn.wordpress.org/trunk@45589 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-02 11:21:53 +00:00
Gary Pendergast
fe28df65e3 Coding Standards: Fix the Squiz.PHP.DisallowMultipleAssignments violations in tests.
See #47632.



git-svn-id: https://develop.svn.wordpress.org/trunk@45588 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-02 04:43:01 +00:00
Gary Pendergast
8298f9dad0 Clean up stray <p> tags added by wpautop() inside block level tags.
`autop()` can sometimes get confused and not clean up stray `<p>` or `</p>` tags inside block level elements, which produces sub-optimal HTML. While browsers can generally handle it, there's no need to make things harder for them if we don't have to.

Props pento, ayubi, pbearne, jond, azaozz, 1994rstefan, dionysous, MikeHansenMe, jorbin, miqrogroove, niallkennedy.
Fixes #27350.




git-svn-id: https://develop.svn.wordpress.org/trunk@45585 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-02 01:30:15 +00:00
Adam Silverstein
b97899a07f Taxonomy: add a new 'terms_pre_query' filter to short circuit WP_Term_Query 'get_terms' queries.
Add a new `terms_pre_query` filter which returns null by default. Return a non-null value to bypass WordPress's default `get_terms` queries.

Props jarocks, boonebgorges, spacedmonkey.
Fixes #41246.



git-svn-id: https://develop.svn.wordpress.org/trunk@45584 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-01 20:47:21 +00:00
Gary Pendergast
ef5a9dfda6 Coding Standards: Fix/ignore the WordPress.NamingConventions.ValidFunctionName violations.
See #47632



git-svn-id: https://develop.svn.wordpress.org/trunk@45580 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-01 08:00:12 +00:00
Gary Pendergast
78e096fe98 Formatting: Trim leading whitespace in esc_url().
Props toszcze.
Fixes #36369.



git-svn-id: https://develop.svn.wordpress.org/trunk@45578 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-01 03:28:21 +00:00
Gary Pendergast
77f9bf0aeb Formatting: Don't add <p> tags inside <svg> tags.
Inline `<svg>`s should generally work, as browsers should just ignore `<p>` or `<br/>` tags that shouldn't be inside the `<svg>`. To keep things neat, however, it's better not add them in the first place.

Props jared_smith, nacin, pento.
Fixes #9437.



git-svn-id: https://develop.svn.wordpress.org/trunk@45577 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-01 03:18:28 +00:00
Riad Benguella
ed1233d05f Build/Test Tools: Fix the hello e2e test assertion.
The previous assertion was always valid because we assumed it returned a single object,
while in reality it was returning an array.

Props hideokamoto.
Fixes #47622.


git-svn-id: https://develop.svn.wordpress.org/trunk@45575 602fd350-edb4-49c9-b593-d223f7449a82
2019-06-28 11:33:13 +00:00
Gary Pendergast
77764a5754 Formatting: Add correct <p> tags near <hr> tags.
It can be tricky to know when `wpautop()` should add `<p>` tags, but one thing we can be certain about is that they really shouldn't be anywhere near `<hr>` tags.

Now they aren't.

Props solarissmoke, MattyRob, pento.
Fixes #14674.



git-svn-id: https://develop.svn.wordpress.org/trunk@45574 602fd350-edb4-49c9-b593-d223f7449a82
2019-06-28 07:15:31 +00:00
Gary Pendergast
b9cd66f483 Formatting: Add support for seconds to human_time_diff().
The web has gotten so much faster since `human_time_diff()` was created, we need to be able to measure time differences with much finer granularity. Now, we can.

Props johnjamesjacoby, pento.
Fixes #35655.



git-svn-id: https://develop.svn.wordpress.org/trunk@45573 602fd350-edb4-49c9-b593-d223f7449a82
2019-06-28 06:43:27 +00:00
Riad Benguella
42a8715471 Build/Test Tools: Add the e2e tests setup.
- Adds a local environment based on docker
 - Adds the e2e tests setup
 - Adds a "Hello World" e2e test to serve as a template

Props gziolo, herregroen, mcsf.
Fixes #45165.


git-svn-id: https://develop.svn.wordpress.org/trunk@45570 602fd350-edb4-49c9-b593-d223f7449a82
2019-06-27 11:26:58 +00:00
Gary Pendergast
3202f9f37e Formatting: Don't convert smilies in ignored tags that have attributes.
Smilies in ignored tags are not supposed to be converted to emoji, but this can malfunction if the tag has attributes. For example, the Preformatted block with add a `class` to the `<pre>` tag.

Props pento, jikamens.
Fixes #47489.



git-svn-id: https://develop.svn.wordpress.org/trunk@45569 602fd350-edb4-49c9-b593-d223f7449a82
2019-06-27 02:04:17 +00:00
Sergey Biryukov
e283457e45 Date/Time: Add more supported formats to wp_maybe_decline_date().
Props SergeyBiryukov, Rarst.
Fixes #37411.

git-svn-id: https://develop.svn.wordpress.org/trunk@45555 602fd350-edb4-49c9-b593-d223f7449a82
2019-06-20 13:46:20 +00:00
Peter Wilson
66f7cee321 Site health: Introduce view_site_health_checks capability.
Introduces the faux primitive capability `view_site_health_checks` available to single site admins and multisite super-admin to view the site health page within the admin.

The capability is mapped to the `install_plugins` capability without being dependent on the file system being writable. This fixes a bug where the feature couldn't be used by sites unable to write to the file system or managed through version control.

The capability is granted on the `user_has_cap` filter.

Props birgire, Clorith, palmiak, peterwilsoncc, spacedmonkey.
Fixes #46957.



git-svn-id: https://develop.svn.wordpress.org/trunk@45507 602fd350-edb4-49c9-b593-d223f7449a82
2019-06-10 07:41:12 +00:00
John Blackbourn
393960b182 I18N: Allow the length of automatically generated excerpts to be localized.
This introduces three new strings that can be used to control the maximum length of automatically generated excerpts for posts, comments, and draft post previews in the dashboard. Optionally combined with the existing word count type control this allows languages which include many multibyte characters to specify more appropriate maximum excerpt lengths.

Props miyauchi, birgire, johnbillion

Fixes #44541


git-svn-id: https://develop.svn.wordpress.org/trunk@45505 602fd350-edb4-49c9-b593-d223f7449a82
2019-06-08 18:41:08 +00:00
Andrea Fercia
ffe40885a1 Regenerate the REST API fixtures after [45443].
See #38517.


git-svn-id: https://develop.svn.wordpress.org/trunk@45498 602fd350-edb4-49c9-b593-d223f7449a82
2019-06-07 20:23:46 +00:00
Sergey Biryukov
af0c73b10b Build/Test Tools: Add $current_screen to the list of globals to unset in WP_UnitTestCase_Base::go_to().
Props mauteri.
Fixes #47439.

git-svn-id: https://develop.svn.wordpress.org/trunk@45486 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-31 14:06:27 +00:00
Andrew Ozz
3337e709ee Fix unit tests after [45456]. The query string is a bit different but the results are the same.
See #45346.

git-svn-id: https://develop.svn.wordpress.org/trunk@45458 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-28 04:18:53 +00:00
John Blackbourn
814aa7149f Build/Test Tools: Remove the dependency on a globally installed Grunt.
The existing `"grunt": "grunt"` script in `package.json` allows for the use of `npm run grunt ...` which uses the local `grunt` binary in the project's `node_modules`.

Fixes #47380


git-svn-id: https://develop.svn.wordpress.org/trunk@45445 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-26 19:34:24 +00:00
Sergey Biryukov
10855438ea Date/Time: Replace all instances of date() with gmdate().
Use of `date()` in core depends on PHP timezone set to UTC and not changed by third party code (which cannot be guaranteed).

`gmdate()` is functionally equivalent, but is not affected by PHP timezone setting: it's always UTC, which is the exact behavior the core needs.

Props nielsdeblaauw, Rarst.
Fixes #46438. See #44491.

git-svn-id: https://develop.svn.wordpress.org/trunk@45424 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-26 00:11:37 +00:00
John Blackbourn
b64f812a59 Docs: Switch to the more common syntax for variadic function documentation.
See #37402


git-svn-id: https://develop.svn.wordpress.org/trunk@45418 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-25 21:58:18 +00:00
Sergey Biryukov
cfd2e38db3 Docs: Remove full stop from ticket number.
See #46402.

git-svn-id: https://develop.svn.wordpress.org/trunk@45409 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-25 12:08:11 +00:00
Sergey Biryukov
bda3af14b0 Formatting: Don't run wp_targeted_link_rel() on entirely serialized content.
Props birgire, elliotcondon.
Fixes #46402.

git-svn-id: https://develop.svn.wordpress.org/trunk@45408 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-25 12:04:28 +00:00
Sergey Biryukov
2a163fa733 Date/Time: Return early from the_weekday() and the_weekday_date() if we're not in the loop.
Restore `$previousweekday` global usage in `the_weekday_date()`, so it could still be used simultaneously with `the_date()`.

Partially reverts [45378].
See #47354.

git-svn-id: https://develop.svn.wordpress.org/trunk@45379 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-23 00:37:56 +00:00
Sergey Biryukov
48fb69f013 Date/Time: Bring some consistency to the_date() and the_weekday_date():
* Make `the_date()` always apply the the filter and return a value.
* Use `is_new_day()` in `the_weekday_date()`.
* Add a unit test for `the_weekday_date()`.

Fixes #47354.

git-svn-id: https://develop.svn.wordpress.org/trunk@45378 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-22 21:57:29 +00:00
Sergey Biryukov
6491746559 Date/Time: Use strict comparison in is_new_day(), add a unit test.
Props pbearne.
Fixes #46627.

git-svn-id: https://develop.svn.wordpress.org/trunk@45375 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-22 17:52:22 +00:00
Jonathan Desrosiers
f9e4f60577 General: Add missing unit tests for wp_array_slice_assoc().
Props pbearne, desrosj.
Fixes #46638.

git-svn-id: https://develop.svn.wordpress.org/trunk@45371 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-21 14:47:58 +00:00
Peter Wilson
b9e6f18350 KSES: Add flex and related long form properties to safe CSS.
Allow `flex`, `flex-grow`, `flex-shrink` and `flex-basis` to be used in inline CSS. As of WordPress 5.3 the block editor is expected to use `flex-basis` inline to set the width in the column block.

Props aduth.
Fixes #47281.
See #37248.



git-svn-id: https://develop.svn.wordpress.org/trunk@45363 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-18 04:33:27 +00:00
Sergey Biryukov
a36aa1b078 Formatting: Adjust wp_targeted_link_rel() to ensure JSON format is preserved and correct quotes are used when adding the missing rel attribute.
Props birgire, TobiasBg, fierevere, audrasjb, SergeyBiryukov.
Fixes #46316, #47244.

git-svn-id: https://develop.svn.wordpress.org/trunk@45348 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-17 12:08:50 +00:00
Alex Shiels
85a90cb244 Upgrade/Install: Don't run signature verify on slow 32-bit systems.
The sodium_compat library can be very slow for certain operations on 32-bit architectures, which can lead to web server timeouts while attempting to verify an update. This adds a runtime speed check to skip signature verification on systems that would otherwise time out. Includes simple unit tests.

Props dd32, paragoninitiativeenterprises.
See #47186.


git-svn-id: https://develop.svn.wordpress.org/trunk@45345 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-17 11:05:45 +00:00
Andrew Ozz
96649a5ad1 Fix setup_postdata() to set the (inside the loop) globals before the_post action is fired. Follow-up from #42814 and [44941].
Props david.binda, spacedmonkey, boonebgorges, birgire, jorbin, azaozz.
Fixes #47114 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@45285 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-04 20:59:11 +00:00
Gary Pendergast
3491bfc7e5 Media: Revert [44947].
`get_available_post_mime_types()` uses a query that's extremely slow on sites with lots of posts. The original fix can be revisited after those performance issues are tackled.

See #43658.


git-svn-id: https://develop.svn.wordpress.org/trunk@45270 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-26 00:43:50 +00:00
Andrew Ozz
71832fe328 Fix parsing of inner blocks when auto-generating an excerpt. Helps to prevent cases where dynamic inner blocks may cause an infinite loop if trying to auto-generate an excerpt.
Props desrosj, pento, gziolo, azaozz.
Fixes #46133.

git-svn-id: https://develop.svn.wordpress.org/trunk@45265 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-24 21:38:21 +00:00
Andrew Ozz
361333e7e2 Remove the core/more block delimiters when splitting post_content on the <!--more--> tag.
Fixes:
- Parsing of blocks in the second half of post_content.
- Outputting malformed HTML when `the_content( null, true )` or  `<!--noteaser-->` is used.

Props lukecarbis, garrett-eclipse, birgire.
Fixes #46471.

git-svn-id: https://develop.svn.wordpress.org/trunk@45261 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-24 05:40:01 +00:00
Adam Silverstein
9e3c57c2ff Feeds: improve structure and naming of feed build date helper function.
Simplify overall code structure by passing the required format to the helper function.
Clarify functionality by renaming `get_last_build_date` to `get_feed_build_date`.

Props pento, spacedmonkey.
Fixes #4575.



git-svn-id: https://develop.svn.wordpress.org/trunk@45247 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-18 17:07:07 +00:00
Jonathan Desrosiers
d575d70fe9 Administration: Improve the accuracy of is_block_editor().
Currently, there are a number of scenarios where `is_block_editor()` (and `WP_Screen::is_block_editor`) would incorrectly indicate block editor support at different points of the loading process. Most notably, checking `is_block_editor` when hooking into the `current_screen` action will always result in `false`, even when the block editor is being loaded. This is because `is_block_editor` is not set to `true` until `edit-form-blocks.php` is included.

This change adds logic to `WP_Screen` to ensure the accuracy of `is_block_editor` on block editor pages earlier in the load process.

While edit screens will now be accurate 100% of the time from `current_screen` on, there are still a few edge cases where `is_block_editor` could contain an incorrect value when creating a new post.

Because a `WP_Post` object is a required parameter for the `replace_editor` filter and `use_block_editor_for_post()` function, `WP_Screen` will fall back to the value returned by `use_block_editor_for_post_type()` for the post being created. To eliminate these edge cases, the `use_block_editor_for_post_type` filter can be used to return the appropriate boolean value to indicate support.

Props Chouby, desrosj, aduth, johnbillion.
Fixes #46195.

git-svn-id: https://develop.svn.wordpress.org/trunk@45224 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-17 01:55:21 +00:00
Felix Arntz
aa377f582d Bootstrap/Load: Allow more than one recovery link to be valid at a time.
While currently a recovery link is only made available via the admin email address, this will be expanded in the future. In order to accomplish that, the mechanisms to store and validate recovery keys must support multiple keys to be valid at the same time.

This changeset adds that support, adding an additional token parameter which is part of a recovery link in addition to the key. A key itself is always associated with a token, so the two are only valid in combination. These associations are stored in a new `recovery_keys` option, which is regularly cleared in a new Cron hook, to prevent potential cluttering from unused recovery keys.

This changeset does not have any user-facing implications otherwise.

Props pbearne, timothyblynjacobs.
Fixes #46595. See #46130.


git-svn-id: https://develop.svn.wordpress.org/trunk@45211 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-16 05:08:16 +00:00
Sergey Biryukov
80817d3209 Bootstrap/Load: After [45016], make sure wp_die() does not cause _doing_it_wrong() notices if called before $wp_query global is set.
Props tmdesigned, TimothyBlynJacobs.
Fixes #46813.

git-svn-id: https://develop.svn.wordpress.org/trunk@45206 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-15 23:48:11 +00:00
John Blackbourn
dde307d4c9 Build/Test tools: Add some docs to the test functions.
Props andizer

Fixes #46501


git-svn-id: https://develop.svn.wordpress.org/trunk@45160 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-11 17:29:20 +00:00
Gary Pendergast
6dddce67fc Privacy: Only mark a personal data export as complete when the user downloads it.
An admin may download an export to check that it's all correct, but this action shouldn't mark the request as complete.

Props garrett-eclipse, JoshuaWold, birgire.
Fixes #44644.



git-svn-id: https://develop.svn.wordpress.org/trunk@45148 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-09 00:03:07 +00:00