Commit Graph

1702 Commits

Author SHA1 Message Date
Boone Gorges 1bf73525e8 Order terms by 'name' when populating object term cache.
[34217] removed the `ORDER BY` clause from `update_object_term_cache()`, for
improved performance. But this proved to cause problems in cases where users
were expecting the results of `get_the_terms()` to be ordered by 'name'. Let's
revert the change for the time being, and look into more disciplined ordering
in a future release.

Props afercia.
See #28922. Fixes #35180.

git-svn-id: https://develop.svn.wordpress.org/trunk@36056 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-22 01:50:08 +00:00
Gary Pendergast d303221d08 Tests: Use the `default_storage_engine` MySQL option on newer MySQL versions.
In MySQL 5.5.3, `storage_engine` was deprecated in favour of `default_storage_engine`, and subsequently removed in MySQL 5.7. To avoid errors when running tests on MySQL 5.7, we need to switch between the options based on MySQL version.

Props skithund, jeremyfelt.

Fixes #34692.



git-svn-id: https://develop.svn.wordpress.org/trunk@36055 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-21 22:26:52 +00:00
John Blackbourn ec143694f7 Tests: Prevent role capability pollution in `Tests_Post_GetPostsByAuthorSql::test_user_has_access_only_to_private_posts_for_certain_post_types()`.
git-svn-id: https://develop.svn.wordpress.org/trunk@36050 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-21 07:15:33 +00:00
John Blackbourn b637e77c5a Tests: Fix all the things.
See #30017, #32394


git-svn-id: https://develop.svn.wordpress.org/trunk@36049 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-21 07:09:43 +00:00
johnbillion 8b5747a108 Query: Re-initialise any dynamically-added public query vars before running the public query vars test.
See #35115


git-svn-id: https://develop.svn.wordpress.org/trunk@36048 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-21 06:59:05 +00:00
John Blackbourn 8567d80ade Tests: Shave a second off the user capability tests by reusing its user fixtures.
See #30017, #32394


git-svn-id: https://develop.svn.wordpress.org/trunk@36047 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-21 06:56:57 +00:00
John Blackbourn da84910c8a Query: Introduce a unit test which will fail when new public query vars are introduced without also updating the test. This adds an extra layer of explicitness to introducing public query vars in order to avoid introducing unintentional clashes with URL query vars that are already in use.
See #35115 


git-svn-id: https://develop.svn.wordpress.org/trunk@36045 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-21 05:48:24 +00:00
Boone Gorges 817013978d Respect approval status when determining comment page count in `comments_template()`.
Since 4.4, when fetching the first page of comments and the 'newest' comments
are set to display first, `comments_template()` must perform arithmetic to
determine which comments to show. See #8071. This arithmetic requires the
total comment count for the current post, which is calculated with a separate
`WP_Comment_Query`. This secondary comment query did not properly account for
non-approved comment statuses; all unapproved comments should be part of the
comment count for admins, and individual users should have their own
unapproved comments included in the count. As a result, `comments_template()`
was, in some cases, being fooled into thinking that a post had fewer comments
available for pagination than it actually had, which resulted in empty pages
of comments.

We correct this problem by mirroring 'status' and 'include_unapproved' params
of the main comment query within the secondary query used to calculate
pagination.

Fixes #35068.

git-svn-id: https://develop.svn.wordpress.org/trunk@36040 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-21 03:06:41 +00:00
John Blackbourn 4024cb673a Comments: When a comment is submitted, ensure the `user_ID` element in the array that's passed to the `preprocess_comment` filter gets populated.
Fixes #34997


git-svn-id: https://develop.svn.wordpress.org/trunk@36038 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-21 02:46:44 +00:00
Gary Pendergast 59b8f0da7c Texturize: Transform `&` into `&` in tag attributes.
[35709] was overly broad, and stopped transforming `&` characters within tag attributes. So that sites aren't generating invalid HTML, we need to restore this functionality, while continuing to not transform `&` within blocked tags.

Fixes #35008 for trunk.



git-svn-id: https://develop.svn.wordpress.org/trunk@36036 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-21 02:42:30 +00:00
Andrew Ozz 58b7d3e136 Responsive images: fix calculations when determining whether to include particular image file in `srcset`.
Props joemcgill.
Fixes #34955 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@36031 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-20 02:38:34 +00:00
Boone Gorges aa38888d60 Add `current-cat-ancestor` class to ancestor items in `wp_list_categories()`.
Pairs nicely with `current-cat-parent`.

Props jrchamp, swisssipdy, ardathksheyna, wonderboymusic.
Fixes #10676.

git-svn-id: https://develop.svn.wordpress.org/trunk@36008 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-18 18:37:41 +00:00
Boone Gorges 6d9f50febd Ensure that `wp_list_categories()` supports comma-separated lists for 'exclude' and 'exclude_tree'.
[34696] introduced a regression whereby comma-separated values for 'exclude'
and 'exclude_tree' would be handled improperly when merging the two parameters,
resulting in category IDs being incorrectly dropped from the combined array.

Props gblsm, hnle.
Fixes #35156.

git-svn-id: https://develop.svn.wordpress.org/trunk@36005 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-18 18:11:44 +00:00
Boone Gorges fdeed90e77 Ensure `get_terms()` results are unique when using 'meta_query'.
The introduction of 'meta_query' to `get_terms()` in 4.4 made it possible for
`get_terms()` to erroneously return duplicate results. To address the issue,
we add the `DISTINCT` keyword to the SQL query when a 'meta_query' parameter
has been provided.

Props @jadpm.
Fixes #35137.

git-svn-id: https://develop.svn.wordpress.org/trunk@36003 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-18 17:43:46 +00:00
Boone Gorges ad8dc6395c Better focus in tag cloud tests.
We should avoid testing complete markup strings, unless we are specifically
testing for the format of the markup.

Fixes #35138.

git-svn-id: https://develop.svn.wordpress.org/trunk@35988 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-17 17:11:07 +00:00
Boone Gorges 5b2a8ed2a0 More focused test for post_type in tag cloud links.
We should not be testing the entire tag cloud markup, as it leads to collateral
damage wheneven `wp_generate_tag_cloud()` is touched. See [35984].

See #25566, #35138.

git-svn-id: https://develop.svn.wordpress.org/trunk@35987 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-17 16:55:23 +00:00
Boone Gorges 22b0cb2029 Introduce 'tag-link-position-x' class to tag cloud links.
The new class describes the cardinal position of a link in the cloud, allowing
more fine-grained CSS and JS targeting.

Props Mte90, chmac.
Fixes #5172.

git-svn-id: https://develop.svn.wordpress.org/trunk@35984 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-17 16:26:06 +00:00
Sergey Biryukov d727e3b516 KSES: Allow the `reversed` attribute for `<ol>`.
Props lancewillett.
Fixes #35079.

git-svn-id: https://develop.svn.wordpress.org/trunk@35960 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-16 09:53:18 +00:00
Sergey Biryukov 959f377c3e I18N: Add a unit test for `before_last_bar()`.
Props realloc.
Fixes #35073.

git-svn-id: https://develop.svn.wordpress.org/trunk@35959 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-16 08:03:38 +00:00
Dominik Schilling (ocean90) 019f7ec6b5 Revert [35949].
Passing an object to `wp_list_pluck()` throws also a fatal error, see https://3v4l.org/9YsaD.

See #35087.

git-svn-id: https://develop.svn.wordpress.org/trunk@35950 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-15 19:49:43 +00:00
Pascal Birchler 666d0736f4 Ensure `wp_list_pluck()` throws a warning when not being passed an array.
We should not paper over the code and hide warnings from developers by casting values to an array.

See #35087.

git-svn-id: https://develop.svn.wordpress.org/trunk@35949 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-15 18:28:55 +00:00
Boone Gorges 42fe7609c7 Omit `cpage` query var in comment link if comment pagination is disabled.
WP 4.4 changed the way comment pagination is calculated. See #8071. In the
context of `get_comment_link()`, these changes introduced a regression that
causes `cpage` (or its pretty-permalink correlate `comment-page-x`) to appear
in comment links when comment pagination is disabled. The current changeset
fixes the regression.

Fixes #34946.

git-svn-id: https://develop.svn.wordpress.org/trunk@35933 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-14 19:45:45 +00:00
Joe Hoyle a375d93001 REST API: Improve formatting of failed validation errors.
If a validation_callback returns a WP_Error it should give the same response format as if it returned `false`. This makes programmatically reading the validation errors better.

Props bradyvercher for initial patch.
Fixes #35028.


git-svn-id: https://develop.svn.wordpress.org/trunk@35890 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-12 18:22:02 +00:00
johnbillion 3348774d3a Ensure that all the capabilities that any users have are being tested. This ensures that if new capabilities are introduced in the future, tests will be required for them.
See #35024


git-svn-id: https://develop.svn.wordpress.org/trunk@35872 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-11 21:59:01 +00:00
John Blackbourn a7f713f45d Introduce tests for the `unfiltered_upload` capability, which no user should have (unless the `ALLOW_UNFILTERED_UPLOADS` constant is defined).
See #35024


git-svn-id: https://develop.svn.wordpress.org/trunk@35871 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-11 21:54:05 +00:00
John Blackbourn e76be26406 Add assertions for role names as capabilities in the capabilities tests. This ensures the role name is only available as a capability to the corresponding role.
See #35007


git-svn-id: https://develop.svn.wordpress.org/trunk@35863 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-11 11:06:28 +00:00
Boone Gorges 4c1c287413 Be sure to force-delete when cleaning up fixtures in `get_comment_link()` tests.
Introduced in [35857].

Mega-super-anti-props boonebgorges.

git-svn-id: https://develop.svn.wordpress.org/trunk@35858 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-11 02:46:37 +00:00
Boone Gorges 3626449004 Share fixtures in `get_comment_link()` tests.
See #30017.

git-svn-id: https://develop.svn.wordpress.org/trunk@35857 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-11 02:26:43 +00:00
Rachel Baker d13adcc9bf Comments: Comments don’t need no Post ID when created, so they don’t be needing one to be edited.
In `wp_update_comment()` only check if the given `comment_post_ID` is valid if it isn’t `0`.  This allows comments that were created programmatically via `wp_insert_comment()` without the (optional) `comment_post_ID` parameter to be edited.

Props subharanjan for the initial patch.
Fixes #34954



git-svn-id: https://develop.svn.wordpress.org/trunk@35853 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-10 15:16:51 +00:00
Boone Gorges 52384c2e6b Improve handling for `WP_Error` objects in `get_the_terms()`.
`wp_get_object_terms()` can return a `WP_Error` object. As such, the
`get_the_terms()` cache wrapper should handle them properly. To wit:

* Don't try to map an error object to `get_term()`. Introduced in [35032].
* Don't cache an error object as taxonomy relationships. Introduced in at least [16487], maybe earlier.

Props stephenharris.
Fixes #34723.

git-svn-id: https://develop.svn.wordpress.org/trunk@35850 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-10 03:34:51 +00:00
John Blackbourn ad338fb3d0 Comments: Commit tests missed in [35848].
See #28617


git-svn-id: https://develop.svn.wordpress.org/trunk@35849 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-10 03:15:44 +00:00
John Blackbourn c2f597280b Formatting: Don't make links inside `<script>` and `<style>` tags clickable.
Fixes #30162
Props ninos-ego, adamsilverstein


git-svn-id: https://develop.svn.wordpress.org/trunk@35847 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-09 23:54:24 +00:00
Mike Schroder 5b025834f9 Media: Don't generate responsive image attributes if `src` does not match ID in `wp-image-` class.
We rely on the `wp-image-` class to quickly find an attachment ID to add responsive image attributes.
To avoid incorrect images being displayed, do not add these attributes if the `src` does not match the
meta from the attachment ID in the class.

Props azaozz, kovshenin, joemcgill.
Fixes: #34898.


git-svn-id: https://develop.svn.wordpress.org/trunk@35820 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-07 20:07:37 +00:00
Joe Hoyle 0a2a83056c Prevent unnecessary $wpdb->update() when hierarchical post doesn't have children.
Props danielbachhuber.
Fixes #34896.


git-svn-id: https://develop.svn.wordpress.org/trunk@35817 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-07 17:46:35 +00:00
Weston Ruter f57e09f0fc Customizer: Apply `customize_dynamic_setting_class` and `customize_dynamic_setting_args` filters in calls to `WP_Customize_Manager::add_setting( $id, $args )`.
Ensure that plugin filters apply as expected for any settings registered statically without passing in an explicit class instance to `WP_Customize_Manager::add_setting()`.

Fixes #34597.


git-svn-id: https://develop.svn.wordpress.org/trunk@35810 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-06 23:21:46 +00:00
Eric Andrew Lewis a84227aab7 Posts: Don't modify post_name if it wasn't supplied to `wp_insert_post()`.
Previously when updating a post using wp_insert_post(), post_name was 
regenerated based on post_title every time if post_name was not passed in 
explicitly. This irons out the expectation that properties not passed into the 
function should not be modified.

Props jason_the_adams. 
Fixes #34865.


git-svn-id: https://develop.svn.wordpress.org/trunk@35800 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-06 21:57:59 +00:00
Boone Gorges ded2547b57 Show user_login in Dashboard user dropdowns.
User dropdowns in wp-admin have traditionally shown the users' display names.
However, this causes ambiguity when users share display names. To correct this,
we now show the unique user_login in parentheses after the display name.

The new `display_name_with_login` value for the `show` parameter of
`wp_dropdown_users()` enables this functionality. The default value of `show`
has not been changed, for backward compatibility, but all instances of
`wp_dropdown_users()` in core wp-admin have been switched.

This changeset also reduces some duplicated logic when assembling a user list
when `include_selected` is true.

Props krogsgard, boonebgorges.
Fixes #31251.

git-svn-id: https://develop.svn.wordpress.org/trunk@35790 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-06 20:56:11 +00:00
Konstantin Kovshenin 1aa7dda524 Allow usage of angle brackets in a site title or tagline.
The whole string is escaped with `esc_html()` anyway, so we don't
need to `wp_kses_post()`. This is a better experience for users who
want to use angle brackets in their site title or description.
Does not allow any HTML, adds unit tests.

props BandonRandon, pauldewouters.
fixes #27942.


git-svn-id: https://develop.svn.wordpress.org/trunk@35788 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-06 20:28:26 +00:00
Weston Ruter 1689948965 Customizer: Return added instances for panels, sections, controls, and settings when calling `WP_Customize_Manager::add_*()` methods.
Add missing phpDoc.

Props fusillicode, jubstuff.
Fixes #34596.


git-svn-id: https://develop.svn.wordpress.org/trunk@35781 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-06 18:09:42 +00:00
Scott Taylor f89c25a43d REST API: Core typically sends nocache headers on all auth'ed responses, as in `wp`, `admin-ajax`, etc. Because the REST API infrastructure is hooked in pre-wp, we should be setting this ourselves.
Adds unit tests.

Props joehoyle.
Fixes #34832.


git-svn-id: https://develop.svn.wordpress.org/trunk@35773 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-04 23:35:54 +00:00
Boone Gorges a1f89f4e86 Use 'invalid_username' error code when tripping 'illegal_user_logins'.
This gives us better compatibility with existing errors thrown by
`sanitize_user()`, especially in Multisite, where user_login has more
restrictions on allowed characters.

Props markjaquith.
Fixes #27317.

git-svn-id: https://develop.svn.wordpress.org/trunk@35772 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-04 23:24:56 +00:00
Dominik Schilling (ocean90) ec01033a2d Unit Tests: Implement `addWarning()` method in SpeedTrapListener.
The method was introduced in PHPUnit 5.1.0, released today.

Fixes #34846.

git-svn-id: https://develop.svn.wordpress.org/trunk@35767 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-04 16:40:10 +00:00
Andrew Nacin 12b1cc4410 Embeds: Enforce, via unit tests, the no-ampersand rule for wp-embed.js.
fixes #34698.


git-svn-id: https://develop.svn.wordpress.org/trunk@35762 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-04 05:45:29 +00:00
Mark Jaquith 2ddab3adf8 Route HEAD API requests through the GET callback method
fixes #34837
props danielbachhuber

git-svn-id: https://develop.svn.wordpress.org/trunk@35758 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-03 16:34:00 +00:00
Scott Taylor aad857409b Customize Unit Tests: also `remove_action( 'after_setup_theme', 'twentysixteen_setup' )`. TwentyFifteen is already removed.
See #31550.


git-svn-id: https://develop.svn.wordpress.org/trunk@35754 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-01 20:55:22 +00:00
Scott Taylor 69900349ca Media: don't use `get_media_embedded_in_content()` in `wp_make_content_images_responsive()`.
Adds unit test.

Props azaozz.
Fixes #34807.


git-svn-id: https://develop.svn.wordpress.org/trunk@35753 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-01 20:49:13 +00:00
Scott Taylor c8b7126cbf Unit Tests: fix responsive image unit tests. Correct the logic in video shortcode unit test for width.
Props joemcgill, wonderboymusic.
Fixes #34790.


git-svn-id: https://develop.svn.wordpress.org/trunk@35751 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-01 20:44:54 +00:00
John Blackbourn da2acf666a When a post is scheduled for publication, treat it the same as a published post when calculating the capabilities required to edit or delete it.
Fixes #33694


git-svn-id: https://develop.svn.wordpress.org/trunk@35747 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-29 02:24:15 +00:00
John Blackbourn a8ea7d98b5 Ensure the correct error message is returned when a user attempts to comment on a post to which they do not have access.
Adds more tests.


git-svn-id: https://develop.svn.wordpress.org/trunk@35745 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-28 18:28:54 +00:00
Scott Taylor 663b7f28ff Upgrade: New themes are not automatically installed on upgrade. This can still be explicitly asked for by defining `CORE_UPGRADE_SKIP_NEW_BUNDLED` as `false`.
In `populate_options()`, if the theme specified by `WP_DEFAULT_THEME` doesn't exist, fall back to the latest core default theme. If we can't find a core default theme, `WP_DEFAULT_THEME` is the best we can do. 

Props nacin, jeremyfelt, dd32.
See #34306.


git-svn-id: https://develop.svn.wordpress.org/trunk@35738 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-25 21:44:02 +00:00
Scott Taylor dc167a20e5 Add a unit test for `wp_nav_menu()` with `container => ''`
See #32464.



git-svn-id: https://develop.svn.wordpress.org/trunk@35736 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-25 18:18:37 +00:00
Dominik Schilling (ocean90) d1ec5b6ac3 Passwords: Support the pre-4.3 behavior of `wp_new_user_notification()`.
Hello, it's me again. A pluggable function named `wp_new_user_notification()`. A few months ago, after [33023], I have lost my second parameter `$plaintext_pass`. But thanks to [33620] I got a new one.
Bad idea - It hasn't had the same behavior as my previous parameter.
To solve that the second parameter got deprecated and reintroduced as the third parameter in [34116]. I was happy again, for a short time.
You remember my lost friend `$plaintext_pass`? No? Well, if its value was empty no notification was sent to the user. This behavior was still lost. And that's what this change is about: Don't notify a user if a plugin uses `wp_new_user_notification( $user_id )`.

You're asking if I'm happy now? Dunno, but maybe you have learned something about pluggable functions, have you?

Props danielbachhuber.
Fixes #34377.

git-svn-id: https://develop.svn.wordpress.org/trunk@35735 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-24 23:06:03 +00:00
Dominik Schilling (ocean90) 50c47fa78c HTTP Tests: Use `login.wordpress.org/wp-login.php` in `test_get_response_cookies()`.
The old URL redirects to `login.wordpress.org` because it's the new canonical URL for all logins on wordpress.org.

Fixes #34782.

git-svn-id: https://develop.svn.wordpress.org/trunk@35734 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-24 21:59:23 +00:00
Sergey Biryukov 6f310a775d Users: Move the tests added in [35116] and [35618] to a more appropriate place and give them a better name.
See #28435, #29880.

git-svn-id: https://develop.svn.wordpress.org/trunk@35732 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-23 18:39:20 +00:00
Weston Ruter 89f49aad80 Customize: Ensure that a setting (especially a multidimensional one) can still be previewed when the post value to preview is set after `preview()` is invoked.
* Introduce `customize_post_value_set_{$setting_id}` and `customize_post_value_set` actions which are done when `WP_Customize_Manager::set_post_value()` is called.
* Clear the `preview_applied` flag for aggregated multidimensional settings when a post value is set. This ensures the new value is used instead of a previously-cached previewed value.
* Move `$is_preview` property from subclasses to `WP_Customize_Setting` parent class.
* Deferred preview: Ensure that when `preview()` short-circuits due to not being applicable that it will be called again later when the post value is set.
* Populate post value for updated-widget with the (unsanitized) JS-value in `WP_Customize_Widgets::call_widget_update()` so that value will be properly sanitized when accessed in `WP_Customize_Manager::post_value()`.

Includes unit tests with assertions to check the reported issues and validate the fixes.

Fixes defect introduced in [35007].
See #32103.
Fixes #34738.


git-svn-id: https://develop.svn.wordpress.org/trunk@35724 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-21 02:51:57 +00:00
Gary Pendergast 274bb41c04 Texturize: Only convert `&` to `&#038;` within text nodes.
Previously, `&` would be converted everywhere, which caused problems when it was converted within a `<script>`, for example.

`convert_chars()` is now removed from the `the_content` filter, as it was doing the same job as `wptexturize()`.

KSES correctly handles converting `&` within HTML attributes, so there's no need for `wptexturize()` and `convert_chars()` to do the same job.

Fixes #34698.



git-svn-id: https://develop.svn.wordpress.org/trunk@35709 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-19 23:31:00 +00:00
John Blackbourn 71c0c35c24 Ensure the count for users with no role remains accurate when users with multiple roles are present.
See #34495


git-svn-id: https://develop.svn.wordpress.org/trunk@35707 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-19 17:10:47 +00:00
John Blackbourn 4920716b4d Clean up the `grammarian` role so it doesn't pollute other tests.
See #24153


git-svn-id: https://develop.svn.wordpress.org/trunk@35705 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-19 16:46:43 +00:00
Scott Taylor 56d7611f09 Rewrite: alleviate conflicts between image attachment pages and posts when permalink structure is `/%postname%/`.
Adds unit test.

Props SergeyBiryukov.
Fixes #24612.


git-svn-id: https://develop.svn.wordpress.org/trunk@35679 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-18 19:58:01 +00:00
Scott Taylor 4aa34cf092 Media: when making images responsive, check if they already have a `sizes` attribute.
Adds unit test.

Props jaspermdegroot.
Fixes #34678.


git-svn-id: https://develop.svn.wordpress.org/trunk@35678 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-18 19:47:11 +00:00
John Blackbourn 355e768312 Update `WP_REST_Response::as_error()` to handle the new format error responses introduced in [35653].
Props danielbachhuber
Fixes #34551


git-svn-id: https://develop.svn.wordpress.org/trunk@35671 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-18 18:28:55 +00:00
Ryan McCue 52bdf9d6a5 REST API: Remove redundant "0" parameter.
This is just an artifact of how we parse the URL, and is already available
via $request->get_route()

Props danielbachhuber.
Fixes #34647.


git-svn-id: https://develop.svn.wordpress.org/trunk@35659 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-18 07:23:38 +00:00
Gary Pendergast d55c605242 WPDB: Fall back to the connection charset when sanity checking strings.
If `DB_CHARSET` isn't defined (or is empty), `wpdb::$charset` will be empty, too. `wpdb::strip_invalid_text()` assumes that it isn't empty, however, so we need to fall back to the connection character set when we're running our sanity checks.

Fixes #34708.



git-svn-id: https://develop.svn.wordpress.org/trunk@35655 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-17 06:12:08 +00:00
Ryan McCue 6ad5ee9786 REST API: Update tests for [35653]
See #34551.


git-svn-id: https://develop.svn.wordpress.org/trunk@35654 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-17 05:26:30 +00:00
Ryan McCue 0a501976db REST API: Require namespace when registering routes.
Props danielbachhuber.
Fixes #34416.


git-svn-id: https://develop.svn.wordpress.org/trunk@35651 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-17 02:38:31 +00:00
John Blackbourn 002b44dc08 Revert [35639] pending investigation into failures on PHP 5.2.
See #19455


git-svn-id: https://develop.svn.wordpress.org/trunk@35641 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-16 00:53:30 +00:00
John Blackbourn b32cf6875f On servers running PHP <= 5.4 which have `magic_quotes_sybase` enabled, the superglobals need to be magic-quoted before `magic_quotes_sybase` is subsequently disabled to avoid incorrect un-slashing. This must surely effect a miniscule number of servers, but so be it.
Fixes #19455
Props summerblue, kurtpayne, lucatume


git-svn-id: https://develop.svn.wordpress.org/trunk@35639 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-15 22:59:51 +00:00
Weston Ruter 0068d161b3 Customize: Exclude `referer` URL from being used for Close link if it is `customize.php`.
This fixes an edge case where the Close button could never link the user out of the Customizer, if the user initially accessed it without a `url` param and then clicked a link (provided by a plugin) that took them to another `customize.php` URL.

See #32637.


git-svn-id: https://develop.svn.wordpress.org/trunk@35635 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-13 05:24:28 +00:00
Sergey Biryukov 98cc2557ad Fix failing multisite test after [35629].
See #27317.

git-svn-id: https://develop.svn.wordpress.org/trunk@35631 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-12 17:11:46 +00:00
Sergey Biryukov 0cff629050 Users: After [35189], make `'illegal_user_logins'` check case-insensitive.
Props juliobox.
Fixes #27317.

git-svn-id: https://develop.svn.wordpress.org/trunk@35629 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-12 16:29:45 +00:00
Scott Taylor 688c155dd8 Users: in `wp_insert_user()`, when a password isn't provided and the user exists, ensure that the password isn't wiped out.
Adds unit test.

Props leewillis77.
Fixes #29880.


git-svn-id: https://develop.svn.wordpress.org/trunk@35618 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-11 22:30:27 +00:00
Scott Taylor 5462b6c6e9 Mail: after [33124], add unit tests.
Props mdawaffe.
Fixes #28039.


git-svn-id: https://develop.svn.wordpress.org/trunk@35617 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-11 22:04:59 +00:00
Boone Gorges c13a263830 When deleting a term, delete its metadata as well.
Props barryceelen.
Fixes #34626.

git-svn-id: https://develop.svn.wordpress.org/trunk@35585 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-09 03:35:56 +00:00
Weston Ruter 0e39b86500 Customize: Fix broken unit test for `WP_Customize_Nav_Menu_Item_Setting::value_as_wp_post_nav_menu_item()`.
Fixes issue in [35580] which caused unit tests to fail while run under multisite.

Fixes #32812.



git-svn-id: https://develop.svn.wordpress.org/trunk@35583 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-09 02:56:01 +00:00
Weston Ruter 2e2ea4876b Customize: Improve alignment of `WP_Customize_Nav_Menu_Item_Setting::sanitize()` behavior with `wp_update_nav_menu_item()`.
* Apply `title_save_pre`, `excerpt_save_pre`, and `content_save_pre` filters on a nav menu item's `title`, `attr_title`, and `description` properties respectively. This ensures that arbitrary markup can be supplied if the user has `unfiltered_html` cap, and for these fields to have markup stripped if not.
* Ensure a nav menu item's `post_status` is sanitized as `publish` or `draft` using the same conditions as `wp_update_nav_menu_item()`.
* Align `WP_Customize_Nav_Menu_Item_Setting::sanitize()` behavior for sanitizing `position` to be the same as `wp_update_nav_menu_item()`.
* Also apply `nav_menu_attr_title` and `nav_menu_description` filters in `WP_Customize_Nav_Menu_Item_Setting::value_as_wp_post_nav_menu_item()` to ensure that previewing markup entered into menu item description will preview the same way as when the nav menu item is saved.
* Add unit tests.

Fixes #32812.


git-svn-id: https://develop.svn.wordpress.org/trunk@35580 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-09 00:47:55 +00:00
Gary Pendergast 6b9ba5893f Embeds: Fix support for embedding in non-WordPress sites.
This moves the last of the iframe message code from PHP to JavaScript, so it can be included in any site, without needing to rely on any of WordPress' internal behaviour.

Props swissspidy.

Fixes #34451.



git-svn-id: https://develop.svn.wordpress.org/trunk@35577 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-09 00:07:03 +00:00
Andrew Ozz 71d22131e6 TinyMCE: update to 4.2.7. Changelog: http://www.tinymce.com/develop/changelog/?ctrl=version&act=view&pr_id=1&vr_id=888
Fixes #34620.

git-svn-id: https://develop.svn.wordpress.org/trunk@35574 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-08 02:31:31 +00:00
Jeremy Felt 9d48f6c7c3 Site Icon: Wrap site icon retrieval with `switch_to_blog()` as needed.
When the site icon for another site is requested, retrieving its ID via `get_blog_option()` is not enough. `switch_to_blog()` is used to set proper context when required.

Adds multsite tests for `has_site_icon()`.

Props imath.
Fixes #34312.


git-svn-id: https://develop.svn.wordpress.org/trunk@35572 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-08 02:03:34 +00:00
Andrew Ozz edf5d8bb36 Responsive images: make the new functions and filters signatures more consistent.
Props joemcgill.
Fixes #34612.

git-svn-id: https://develop.svn.wordpress.org/trunk@35569 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-07 21:35:34 +00:00
Andrew Ozz 3b5433eb2e Responsive images: omit full size images from srcset attributes when the original file is an intermediate sized GIF so we don't accidentally add animation to an otherwise flat image. Update the tests to cover this case.
Props joemcgill, H-Shredder, SergeyBiryukov.
Fixes #34528.

git-svn-id: https://develop.svn.wordpress.org/trunk@35561 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-07 02:09:56 +00:00
Andrew Ozz 3df03d1675 Responsive images: add test for invalid size name. Remove invalid size from other tests.
Props jaspermdegroot.
See #33641.

git-svn-id: https://develop.svn.wordpress.org/trunk@35560 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-07 01:32:41 +00:00
Weston Ruter 22135794a2 Customize: Fix typo in `WP_Customize_Manager::_cmp_priority()` which caused unstable sorting for same-priority constructs in PHP.
The issue, however, does not manifest in the UI because the UI is now built via JS and the `wp.customize.utils.prioritySort()` algorithm did not have the same typo.

Props bordoni, westonruter.
Fixes #34594.


git-svn-id: https://develop.svn.wordpress.org/trunk@35553 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-06 06:57:53 +00:00
Boone Gorges 5043f0c795 Make `get_term()` behave more consistently in the context of shared terms.
When `WP_Term` was introduced in [34997], the `$taxonomy` parameter for
`get_term()` was made optional. This meant that, when the optional param was
omitted, `get_term()` had no way of determining which term was intended when
the term_id was shared between multiple taxonomies. As a (somewhat sneaky) way
of fixing things, `get_term()` split any shared terms it found. But this could
cause problems with developer expectations: it's not clear why requesting a
term should result in a database update, much less a potential change in the
ID of a term.

In place of this technique, this changeset introduces a number of changes that
make the handling of shared terms a bit less insane:

* When a taxonomy is provided to `get_term()`, and a cached term is found matching the term_id, make sure the taxonomy also matches before returning it.
* When a taxonomy is not provided, ensure that the term is not shared before adding it to the cache.
* When a term is shared between taxonomies and no taxonomy is provided, return a `WP_Error` rather than splitting the term.
* When a term is shared between taxonomies, only one of which is valid, return the term from that taxonomy.

Props boonebgorges, dlh.
Fixes #34533.

git-svn-id: https://develop.svn.wordpress.org/trunk@35537 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-05 16:44:59 +00:00
Dominik Schilling (ocean90) 3effd276e0 After [35518] define `$_POST['post_view']` in `test_dont_process_terms_if_taxonomy_does_not_allow_show_on_quick_edit()`.
See #34577.

git-svn-id: https://develop.svn.wordpress.org/trunk@35531 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-04 23:05:03 +00:00
Andrew Ozz 611ddaf9bf Responsive images: do not generate `srcset` for GIFs that are inserted at full size. Prevents breaking animated GIFs.
Props joemcgill.
Fixes #34528.

git-svn-id: https://develop.svn.wordpress.org/trunk@35524 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-04 21:43:44 +00:00
Boone Gorges 7f79d26ca5 Don't allow term meta to be added to shared taxonomy terms.
`add_term_meta()` and `update_term_meta()` identify terms by `$term_id`. In
cases where a term is shared between taxonomies, `$term_id` is insufficient to
distinguish where the metadata belongs.

When attempting to add/update termmeta on a shared term, a `WP_Error` object
is returned. This gives developers enough information to decide whether they'd
like to force the term to be split and retry the save, or show an error in the
UI, or whatever.

Props boonebgorges, mboynes, DH-Shredder, jorbin, aaroncampbell.
Fixes #34544.

git-svn-id: https://develop.svn.wordpress.org/trunk@35515 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-04 21:23:28 +00:00
Boone Gorges c8dd2d480d `WP_Comment_Query`: Fill comment objects from database when cache is unavailable.
This fixes a bug where widgets loaded in a preview or the Customizer are
rendered inside of a `wp_suspend_cache_addition()` block and thus could not
find comment objects in the cache.

Props rommelxcastro, stevehenty.
Fixes #34138.

git-svn-id: https://develop.svn.wordpress.org/trunk@35512 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-04 21:09:01 +00:00
Scott Taylor ee98fd84bb Feeds: `<comments>` is optional in RSS2, so don't include it when comments aren't present or open. Same for `<wfw:commentRss>` and `<slash:comments>`
Adds unit test.

Props swissspidy, realloc, hakre, sivel.
Fixes #9134.


git-svn-id: https://develop.svn.wordpress.org/trunk@35506 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-04 17:46:41 +00:00
Sergey Biryukov 00ee9a62d1 Add missing `@group` to `Tests_Rel_No_Follow`.
See #9959.

git-svn-id: https://develop.svn.wordpress.org/trunk@35505 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-04 16:35:02 +00:00
Andrew Ozz 01e9de382e Responsive images:
- Fix `_wp_upload_dir_baseurl()` to cache by blog_id.
- Replace `path_join()` with `trailingslashit()`, it's much faster.
- Rename $image_url to $image_src for consistency (used at about 50 other places).
- Couple of tests fixes.

See #34430.

git-svn-id: https://develop.svn.wordpress.org/trunk@35498 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-04 00:21:23 +00:00
Sergey Biryukov 88c274fad8 Formatting: `wp_make_link_relative()` should return an empty string if no path is present in the link.
Props bcworkz, MikeHansenMe, chriscct7, SergeyBiryukov.
Fixes #26819.

git-svn-id: https://develop.svn.wordpress.org/trunk@35497 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-03 21:35:17 +00:00
Gary Pendergast c9f7e05f7b Upgrades: Add support for `FULLTEXT` indexes to `dbDelta()`.
Props edirect24, mdawaffe, pento.

Fixes #14445.



git-svn-id: https://develop.svn.wordpress.org/trunk@35487 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-01 23:09:49 +00:00
Weston Ruter 204bad4685 Customize: Return user to referring URL when leaving Customizer in absence of `return` query param.
When referring URL is not available, default returning user to frontend URL instead of admin URL. Themes page is updated to include the `return` path in Customizer links.

Props McGuive7, westonruter.
Fixes #32637.


git-svn-id: https://develop.svn.wordpress.org/trunk@35483 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-01 06:39:50 +00:00
Scott Taylor bd7bf83886 Media: add a new image size, `medium_large`. Bumps db version to add new options.
Adds unit tests.

Props DH-Shredder, joemcgill, azaozz.
Fixes #34196.


git-svn-id: https://develop.svn.wordpress.org/trunk@35479 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-31 20:49:26 +00:00
Scott Taylor 957a800bd3 Comments: don't auto-close comments on draft posts.
Adds unit tests.

Props solarissmoke, MikeHansenMe, nacin, rachelbaker.
Fixes #20262.


git-svn-id: https://develop.svn.wordpress.org/trunk@35475 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-31 20:12:16 +00:00
Sergey Biryukov fbd0b570fc Embeds: In `get_post_embed_html()`, move the optional `$post` argument after the required `$width` and `$height`.
Props swissspidy.
Fixes #34523.

git-svn-id: https://develop.svn.wordpress.org/trunk@35472 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-31 15:50:23 +00:00
Andrew Ozz 98a63f523f Responsive images:
- Merge `wp_image_srcset_attr()` into `wp_calculate_image_srcset()`.
- Remove the `wp_image_srcset` filter.
- Fix the tests for the above changes. 

See #34430.

git-svn-id: https://develop.svn.wordpress.org/trunk@35464 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-30 23:26:44 +00:00
John Blackbourn 3eb0e3a4bb Ensure that the scheme used in the URL returned by `get_blogaddress_by_id()` always reflects the blog's URL, instead of using `http`.
Props thomaswm
Fixes #14867


git-svn-id: https://develop.svn.wordpress.org/trunk@35446 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-30 02:01:32 +00:00
Gary Pendergast 63d9e9df96 Embeds: Provide a cached text fallback.
Sometimes, embedded sites might suffer from less than 100% uptime. Instead of leaving the embedding site with a big blank space where the embed should be, let's fall back to a link to the embedded post, so there's at least some context for the post.

Fixes #34462.



git-svn-id: https://develop.svn.wordpress.org/trunk@35437 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-29 23:10:46 +00:00
Gary Pendergast 4832d8d933 Embeds: Who put this REST API infrastructure in my WordPress?
Well, while it's here, we probably should make use of it. The oEmbed endpoint now uses the REST API infrastructure, instead of providing its own.

Props swissspidy.

Fixes #34207.



git-svn-id: https://develop.svn.wordpress.org/trunk@35436 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-29 22:50:13 +00:00
John Blackbourn 4b10def07e Correctly populate the `user_id` field for comments when a user submits a comment while logged in.
Props imath
Fixes #34493


git-svn-id: https://develop.svn.wordpress.org/trunk@35435 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-29 21:28:39 +00:00
Sergey Biryukov 391b67356a Embeds: Include post name in "Continue reading" links to provide a readable link for screenreaders.
Props swissspidy.
Fixes #34481.

git-svn-id: https://develop.svn.wordpress.org/trunk@35432 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-29 13:20:04 +00:00
Boone Gorges f1ca28c2ab Don't specify an `offset` default in `get_posts()`.
The default value should be a null offset. A `0` default overrides any value
of `paged` passed to `get_posts()`. See [34697].

Fixes #34060.

git-svn-id: https://develop.svn.wordpress.org/trunk@35417 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-28 18:17:27 +00:00
Andrew Ozz 855ba2518b Responsive images:
- Introduce `wp_calculate_image_srcset()` that replaces `wp_get_attachment_image_srcset_array()` and is used as lower level function for retrieving the srcset data as array.
- Use the new function when generating `srcset` and `sizes` on the front-end. This is faster as no (other) image API functions are used.
- Change the `wp_get_attachment_image_srcset()`. Now it is meant for use in templates and is no longer used in core.
- A few logic fixes and improvements.
- Some names changed to be (hopefully) more descriptive.
- Fixed/updated tests.

Props joemcgill, jaspermdegroot, azaozz.
See #34430.

git-svn-id: https://develop.svn.wordpress.org/trunk@35412 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-28 05:40:04 +00:00
Dominik Schilling (ocean90) 88cdbb6a49 Embeds: Replace hardcoded error messages with `get_status_header_desc( $http_code )`.
Fixes #34275.

git-svn-id: https://develop.svn.wordpress.org/trunk@35408 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-27 20:43:00 +00:00
Dion Hulse 8c33fe770e Use `wp_parse_url()` in `esc_url()` to avoid parsing bugs in < PHP 5.4.7.
Props johnbillion for unit tests
See #34408
Fixes #34202


git-svn-id: https://develop.svn.wordpress.org/trunk@35370 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-23 05:56:25 +00:00
Dion Hulse cacd015856 WP_HTTP: Promote the `WP_HTTP::parse_url()` method to a more generic `wp_parse_url()` function.
Fixes #34408


git-svn-id: https://develop.svn.wordpress.org/trunk@35369 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-23 05:53:05 +00:00
Dion Hulse f70e623991 XMLRPC: Revert the changes to `WP_XMLRPC_UnitTestCase` in [35366] as they weren't required.
See #34336


git-svn-id: https://develop.svn.wordpress.org/trunk@35367 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-23 04:49:08 +00:00
Dion Hulse 75ab50c70e XMLRPC: Prevent authentication from occuring after a failed authentication attmept in any single XML-RPC call.
This hardens WordPress against a common vector which uses multiple user identifiers in a single `system.multicall` call. In the event that authentication fails, all following authentication attempts ''in that call'' will also fail.

Props dd32, johnbillion.
Fixes #34336


git-svn-id: https://develop.svn.wordpress.org/trunk@35366 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-23 04:45:10 +00:00
Scott Taylor 6a3b784104 Media: in `wp_get_attachment_image_sizes()`, to streamline and for performance:
* Change the 3rd arg from `args` to `width`
* Change `wp_image_sizes_args` filter to `wp_get_attachment_image_sizes`

Updates unit tests.

Props joemcgill.
Fixes #34379.


git-svn-id: https://develop.svn.wordpress.org/trunk@35355 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-22 16:45:37 +00:00
Scott Taylor a19a0e6e72 oEmbed: if `SimpleXMLElement` does not exist, return an `HTTP Error 501 Not implemented` response.
Props swissspidy.
Fixes #34274.


git-svn-id: https://develop.svn.wordpress.org/trunk@35354 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-22 16:37:31 +00:00
John Blackbourn 1691563872 Force the REST API URL to use `https` for its scheme when the current request is served over HTTPS and the host name matches that of the REST API URL.
This allows sites to use an admin area over HTTPS with the front end over HTTP, and not end up with a cross-protocol problem when using the REST API URL in the admin area.

Fixes #34299


git-svn-id: https://develop.svn.wordpress.org/trunk@35351 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-22 00:07:36 +00:00
John Blackbourn 82cb793355 Initialise `$_SERVER['SERVER_NAME']` during the test bootstrap to avoid individual tests having to do it.
Fixes #34394


git-svn-id: https://develop.svn.wordpress.org/trunk@35350 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 23:51:45 +00:00
John Blackbourn 5f8d0870a2 Remove the explicit Imagick extension test.
See #34087


git-svn-id: https://develop.svn.wordpress.org/trunk@35348 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 22:40:48 +00:00
John Blackbourn 2c3c286b84 Correctly use `WP_TESTS_EMAIL` in email tests.
See #761, #34000


git-svn-id: https://develop.svn.wordpress.org/trunk@35347 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 22:33:53 +00:00
John Blackbourn 20eb6402fd Correct some more tests which were using `example.org` instead of `WP_TESTS_DOMAIN`.
See #33641, #34000


git-svn-id: https://develop.svn.wordpress.org/trunk@35346 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 22:21:51 +00:00
John Blackbourn 63748f2d67 Provide a more helpful failure message when Imagick isn't installed. Skipping the tests isn't really an option because Imagick's presence affects several other tests too.
See #34087


git-svn-id: https://develop.svn.wordpress.org/trunk@35345 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 22:10:43 +00:00
John Blackbourn 289973f078 Remove the failing `test_rest_url_scheme()` test while it's investigated.
See #34299


git-svn-id: https://develop.svn.wordpress.org/trunk@35344 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 22:06:41 +00:00
John Blackbourn 672782f0a6 Force the REST API URL to use `https` for its scheme when the current request is served over HTTPS and the host name matches that of the REST API URL.
This allows sites to use an admin area over HTTPS with the front end over HTTP, and not end up with a cross-protocol problem when using the REST API URL in the admin area.

Fixes #34299


git-svn-id: https://develop.svn.wordpress.org/trunk@35342 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 20:37:56 +00:00
Drew Jaynes 1a7298861b Comments: Introduce two new filters, `notify_moderator` and `notify_post_author`, both of which make it possible to selectively override site notification email settings for new comments.
The `notify_moderator` filter makes it possible to override the value for the `moderation_notify` option, which controls whether to send new comment emails to "site moderators", that is to say, the owner of the admin email for the site and the post author if they have the ability to modify the comment.

The `notify_post_author` filter likewise makes it possible to override the value for the `comments_notify` option, which controls whether to send new comment emails to the post author. If the post author is the comment author, default behavior is not to send the notification. Note: enabling or disabling notifications via this hook could also affect other recipients added via the 'comment_notification_recipients' filter in `wp_notify_postauthor()`, if hooked.

Passing a falsey value to either of the new filters will prevent notifications from being sent, regardless of their corresponding option values.

Adds tests.

Props coffee2code, adamsilverstein, DrewAPicture.
Fixes #761.


git-svn-id: https://develop.svn.wordpress.org/trunk@35339 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 18:34:06 +00:00
Konstantin Obenland 52204f7b27 Tests: Use most specific function for document titles.
Adds tests specific to `_wp_render_title_tag()`.

See #31078.



git-svn-id: https://develop.svn.wordpress.org/trunk@35334 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 16:54:53 +00:00
Boone Gorges f492a81d70 Prevent non-public taxonomies from registering aquery var.
[34247] made the 'public' paramater of `register_taxonomy()` work by blocking
requests for non-public taxonomy archives during `parse_request()`. Blocking
taxonomy archive requests this late means that it's impossible to register an
independent query var that matches the slug of a non-public taxonomy. By
moving the block to `register_taxonomy()` - not allowing these taxonomies to
register their query vars in the first place - we free up the slug for other
use. In addition, we free up a bit of processing (no need to look for the query
var in `parse_request()` and better parallel the way non-public post types
work. See `register_post_type()`.

Non-public taxonomy archives that are requested using `?taxonomy=tax_name` are
still blocked during `parse_request`. It's only custom query vars -
`?tax_name=term` - that are affected by this change.

Props mboynes.
Fixes #21949.

git-svn-id: https://develop.svn.wordpress.org/trunk@35333 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 16:53:51 +00:00
Boone Gorges e4b72ad5ca Don't force comment pagination.
[34561] instituted the policy of forcing pagination for comments. This strategy
was intended to avert problems when 'page_comments' is set to 0 - as it is by
default - and the number of comments on a given post rises into the hundreds or
thousands. By forcing pagination in all cases, we ensured that WordPress would
not time out by processing unwieldy numbers of comments on a given pageload.

The strategy proves problematic, however, because comment permalinks are
generated using the page of the comment. Forcing pagination for posts that
were not previously paginated would change the URL of all comments that do not
appear on the default comment page.

This changeset reintroduces the 'page_comments' setting and its corresponding
checkbox on Settings > Discussion. A number of tests, which were written after
[34561], are modified to work now that 'page_comments' will, once again, be
disabled by default.

See #8071.

git-svn-id: https://develop.svn.wordpress.org/trunk@35331 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 16:25:31 +00:00
Boone Gorges 75887ec865 Document title tests should expect dynamic blogname.
Fixes #31078.

git-svn-id: https://develop.svn.wordpress.org/trunk@35329 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 16:14:06 +00:00
Scott Taylor 51637379a2 Formatting: move `url_shorten()` from `wp-admin/includes/misc.php` to `wp-includes/formatting.php` for more global access.
Adds unit tests.

Props mulvane, chriscct7.
Fixes #20166.


git-svn-id: https://develop.svn.wordpress.org/trunk@35314 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 03:47:23 +00:00
Scott Taylor 14893eb628 AJAX UNIT TESTS: Have you ever wondered why these take 600 forevers to run? They all eventually call `do_action( 'admin_init' )`, which has `_maybe_update_core`, `_maybe_update_plugins`, and `_maybe_update_themes` hooked to it. REMOVE THEM, and AJAX unit tests run like the wind. `Tests_Ajax_Response` is still slow.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35311 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 03:17:36 +00:00
Scott Taylor f5921a0c98 Unit Tests: consolidate the many separate implementations of `_make_attachment()` into a helper method on `WP_UnitTestCase`.
Fixes #34075.


git-svn-id: https://develop.svn.wordpress.org/trunk@35309 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 01:58:52 +00:00
Weston Ruter bde89adaf8 Customizer: Introduce `customize_loaded_components` filter to allow core components to be disabled.
Also move style rule from `customize-nav-menus.css` to `customize-controls.css` so that widgets button is properly styled when `nav_menus` component is excluded from loading. See [35304]. See #33327.

Props westonruter, DrewAPicture.
Fixes #33552.


git-svn-id: https://develop.svn.wordpress.org/trunk@35307 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 22:15:11 +00:00
Andrew Ozz 73d755b67a TinyMCE: update to 4.2.6. Changelog: http://www.tinymce.com/develop/changelog/?ctrl=version&act=view&pr_id=1&vr_id=887.
Fixes #34331.

git-svn-id: https://develop.svn.wordpress.org/trunk@35306 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 22:05:31 +00:00
Weston Ruter 261aa51182 Customizer: Allow new `option` settings to not be saved as autoloaded by passing an `autoload` arg value of `false`.
The `autoload` argument value is passed along to `update_option()` which has accepted an `$autoload` parameter since [31628].

Props westonruter, dlh.
See #26394.
Fixes #33499.


git-svn-id: https://develop.svn.wordpress.org/trunk@35305 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 21:18:04 +00:00
Weston Ruter 9724c7cdbd Customizer: Implement indicators for invalid nav menu items.
The same indicator on the nav menus admin page is now present for nav menu items in the Customizer. When a menu item is present for a post type that is no longer registered, the menu item will appear with the indicator.

Props kucrut, westonruter.
Fixes #33665.


git-svn-id: https://develop.svn.wordpress.org/trunk@35302 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 19:07:58 +00:00
Konstantin Obenland e9579b3ed5 Site Icon: Get site icon ID only when needed.
Cuts down on unnecessary queries, especially in environments that rely on
post meta a lot. Reverts [32997].

Props ap.koponen, swissspidy.
Fixes #34368.



git-svn-id: https://develop.svn.wordpress.org/trunk@35299 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 18:22:41 +00:00
Konstantin Obenland c7a86be42c Tests: Use updated filter names and oembed title for UT sanity.
See [35294], #31078.


git-svn-id: https://develop.svn.wordpress.org/trunk@35295 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 17:04:29 +00:00
Konstantin Obenland d625bd2428 Themes: Improve document title output.
Introduces more flexibility in filtering all parts of the document title,the
separator, and a way to short-circuit title generation. Plugins can now also
check for theme support and reliably filter the entire output. See #18548.
Deprecates `wp_title()`.

Fixes #31078.



git-svn-id: https://develop.svn.wordpress.org/trunk@35294 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 16:20:04 +00:00
Scott Taylor ea7e8314d2 Formatting: allow date strings to be passed to `get_gmt_from_date()`, instead of requiring `'Y-m-d H:i:s'`.
Adds unit tests.

Props pbearne.
Fixes #34279.


git-svn-id: https://develop.svn.wordpress.org/trunk@35284 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 06:07:45 +00:00
Scott Taylor 91d55f97c2 Users: when calling `wp_insert_user()` with an valid user ID, return `WP_Error` instead of arbitrarily updating user meta.
Adds unit test.

Props swissspidy, bilalcoder.
Fixes #28004.


git-svn-id: https://develop.svn.wordpress.org/trunk@35280 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 05:27:32 +00:00
Scott Taylor fdd8106001 Formatting: when making unique filenames in `wp_unique_filename()` by adding an incrementing number, prefix it with a dash to disambiguate from files that end in numbers.
Updates unit tests.

Props mikejolley, tyxla.
Fixes #21453.


git-svn-id: https://develop.svn.wordpress.org/trunk@35276 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 04:04:26 +00:00
Weston Ruter 42687da29c Widgets: Modify unit test assertion to be compatible with `widget_nav_menu` option being filtered by plugin to return `ArrayIterator`.
Modifies assertion added in [35100].

See #26876.
See #32474.


git-svn-id: https://develop.svn.wordpress.org/trunk@35272 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-19 21:26:24 +00:00
Drew Jaynes f03562b364 Tests: Add some more test coverage for `get_term_field()`.
See #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35270 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-19 03:28:49 +00:00
Boone Gorges 990eebf373 Bust object term cache in `wp_remove_object_terms()`.
Props tszming.
Fixes #34338.

git-svn-id: https://develop.svn.wordpress.org/trunk@35268 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-19 01:52:22 +00:00
John Blackbourn 39c6a77617 Some cleanup that was missed in [35259].
See #33728, #24853


git-svn-id: https://develop.svn.wordpress.org/trunk@35260 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-18 06:25:25 +00:00
John Blackbourn 219b56a6a4 Some rewrite endpoint tests in preparation for new endpoint masks. More to come.
See #33728, #24853


git-svn-id: https://develop.svn.wordpress.org/trunk@35259 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-18 06:23:48 +00:00
John Blackbourn a314c6c234 Preserve the public and private query var properties on the global `WP` instance when using `WP_UnitTestCase::go_to()`. These properties apply to the application state, not the current request.
See #34346


git-svn-id: https://develop.svn.wordpress.org/trunk@35258 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-18 05:00:40 +00:00
John Blackbourn 9fbff7f63a Add `is_embed()` to `WP_UnitTestCase::assertQueryTrue()` and update the relevant embed tests.
See #32522


git-svn-id: https://develop.svn.wordpress.org/trunk@35257 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-18 04:50:15 +00:00
John Blackbourn 6845b3cd4a Move the `test_is_home_should_be_false_when_visiting_custom_endpoint_without_a_registered_query_var_and_page_on_front_is_set()` test into a more appropriate place.
See #25143


git-svn-id: https://develop.svn.wordpress.org/trunk@35256 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-18 01:34:29 +00:00
John Blackbourn ab43e7362d Correct a test after r35253.
See #34272


git-svn-id: https://develop.svn.wordpress.org/trunk@35255 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-18 00:55:16 +00:00
John Blackbourn d5b31e6ba2 Introduce `map_deep()`, a utility function that recursively maps a callable function to every item in an array or object. Works like `array_walk_recursive()` but works with objects too.
Updates `rawurlencode_deep()`, `urlencode_deep()`, and `stripslashes_deep()` to use `map_deep()`. Introduces `urldecode_deep()` for completeness.

Props wpmuguru, nbachiyski, boonebgorges, MikeHansenMe, chriscct7, realloc, johnbillion
Fixes #22300


git-svn-id: https://develop.svn.wordpress.org/trunk@35252 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 23:25:21 +00:00
Scott Taylor 768958f7a0 Unit Tests: better fixtures for `Tests_Meta_Slashes` and `Tests_WP_Customize_Section`.
See #30017, #33968.



git-svn-id: https://develop.svn.wordpress.org/trunk@35249 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 21:28:43 +00:00
Scott Taylor 80b732819b Unit Tests: better fixtures for `Tests_User_WpSetCurrentUser`.
See #30017, #33968.



git-svn-id: https://develop.svn.wordpress.org/trunk@35248 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 21:18:38 +00:00
Scott Taylor 721d4c5a77 Unit Tests: better fixtures for `Tests_User`.
See #30017, #33968.



git-svn-id: https://develop.svn.wordpress.org/trunk@35247 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 21:14:28 +00:00
Scott Taylor c173dc5595 Unit Tests: better fixtures for `Tests_AdminBar`. Don't force-delete some posts: some filter callbacks are no-ops on Multisite if the post is vanquished.
See #30017, #33968.



git-svn-id: https://develop.svn.wordpress.org/trunk@35246 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 20:48:33 +00:00
Scott Taylor 8506f48d6b Unit Tests: better fixtures for `Tests_Admin_Includes_Post`.
See #30017, #33968.



git-svn-id: https://develop.svn.wordpress.org/trunk@35245 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 19:47:07 +00:00
Scott Taylor 613e88fe86 Unit Tests: `WP_UnitTest_Generator_Sequence` needs a static incrementer - otherwise, it assumes every test class is a reset, which it no longer is (it is now static).
While we're at it, remove unnecessary `tearDown()` code.

See #30017, #33968.



git-svn-id: https://develop.svn.wordpress.org/trunk@35244 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 19:24:20 +00:00
Scott Taylor ae226d66b6 Unit Tests: after [35242], declare some missing instance props on individual test classes.
See #30017, #33968.



git-svn-id: https://develop.svn.wordpress.org/trunk@35243 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 18:29:32 +00:00
Scott Taylor b757b37551 Unit Tests: after [35225], make `factory` a method/getter on `WP_UnitTestCase` and add magic methods for BC for every plugin that is extending `WP_UnitTestCase` and accessing the `$factory` instance prop.
Props nerrad, wonderboymusic.
See #30017, #33968.



git-svn-id: https://develop.svn.wordpress.org/trunk@35242 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 18:02:16 +00:00
Weston Ruter 0e81f51cac Customizer: Add unit test for `WP_Customize_Widgets::is_panel_active()`.
See #33052.


git-svn-id: https://develop.svn.wordpress.org/trunk@35236 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 04:43:27 +00:00
Sergey Biryukov 9b591d6b09 Embeds: Rename files, functions, and hooks added in [34903] to make it more clear what is oEmbed-specific and what isn't.
See https://core.trac.wordpress.org/ticket/34272#comment:7 for full list of renamed functions and hooks.

Props swissspidy.
Fixes #34272.

git-svn-id: https://develop.svn.wordpress.org/trunk@35235 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 01:20:19 +00:00
Weston Ruter 370057b5d7 Customizer: Always show Widgets panel initially if sidebars are registered; show notice to users in panel if no widget areas are in current preview.
Widgets panel will not wait to display until the preview loads.

Also fixes problems with `margin-top` in panels where other panels' `active` states change, as well as ensuring sections of deactivated panel collapse before panel is hidden to prevent the pane from becoming empty of controls.

Fixes #33052.
Fixes #33567.


git-svn-id: https://develop.svn.wordpress.org/trunk@35231 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-16 23:47:56 +00:00
Boone Gorges f22ba848df Return `null` from `get_term()` on taxonomy mismatch.
[34997] caused `get_term()` to return an error object in the case when
`$taxonomy` did not match the taxonomy of the located term. This was an
inadvertant change from the previous behavior, when `get_term()` would return
null in these cases.

Props dlh.
See #14162. Fixes #34332.

git-svn-id: https://develop.svn.wordpress.org/trunk@35227 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-16 21:41:51 +00:00
Scott Taylor 61edcd5021 Unit Tests: PHP 5.2, I Hate You and You Are Bringing Me Down.
#YOLOFriday

See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35226 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-16 21:14:52 +00:00
Scott Taylor e70ebea219 Unit Tests: one `$factory` to rule them all, and it shall be `static`.
Using more than one instance of `WP_UnitTest_Factory` causes all kinds of craziness, due to out-of-sync internal generator sequences. Since we want to use `setUpBeforeClass`, we were creating ad hoc instances. To avoid that, we were injecting one `static` instance via Dependency Injection in `wpSetUpBeforeClass`. All tests should really use the `static` instance, so we will remove the instance prop `$factory`.

Replace `$this->factory` with `self::$factory` over 2000 times.
Rewrite all of the tests that were hard-coding dynamic values. 

#YOLOFriday



git-svn-id: https://develop.svn.wordpress.org/trunk@35225 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-16 21:04:12 +00:00
Scott Taylor 84272ff8cd Unit Tests: since [32953], we can just use `self::delete_user()` instead of using `if` logic for Multisite.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35224 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-16 19:51:32 +00:00
Scott Taylor 2845280ffd Unit Tests: add `SpeedTrapListener` to `phpunit/includes` and add the config node to `phpunit.xml.dist`.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35214 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-16 00:27:28 +00:00
Dominik Schilling (ocean90) c6e2e6c1b5 Tests: Remove the `@runTestsInSeparateProcesses` annotation for Ajax tests.
They were added 3 years ago in [846/tests] because tests weren't excluded from the normal runs.

Reverts [35209] because it doesn't work with Xdebug.
`Tests_Ajax_Response::test_response_charset_in_header` is the only test which needs to run in a separate process, see [975/tests].

See #31491.

git-svn-id: https://develop.svn.wordpress.org/trunk@35211 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 21:30:52 +00:00
Dominik Schilling (ocean90) 666d07352e Tests: Don't preserve the global state for Ajax tests when using an external object cache.
Most of the Ajax tests are running in a separate PHP process, and thus PHPUnit attempts to preserve the global state from the parent process by serializing all globals. But this doesn't work for external object caches so we have to disable this "feature".

See #31491.

git-svn-id: https://develop.svn.wordpress.org/trunk@35209 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 20:34:08 +00:00
Boone Gorges 1b6a8019c3 Fix incorrect variable name introduced in [35197].
See #30017, #33968.

git-svn-id: https://develop.svn.wordpress.org/trunk@35206 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 18:47:11 +00:00
Scott Taylor 43d18b25b0 Unit Tests: add/upgrade the fixtures in `Tests_User_Query`.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35197 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 07:28:40 +00:00
Scott Taylor 32719bf251 Unit Tests: create fewer terms in `Tests_Term_getTerms::test_get_terms_parent_zero()`
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35196 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 06:52:19 +00:00
Sergey Biryukov 65390cd9cf In `WP::parse_request()` and `url_to_postid()`, if a post slug clashes with a trashed page, return the post instead of the page.
Props kovshenin, SergeyBiryukov, igmoweb.
Fixes #21970.

git-svn-id: https://develop.svn.wordpress.org/trunk@35195 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 06:48:22 +00:00
Scott Taylor 0cf7a91d3a Unit Tests: upgrade the fixtures in `Tests_Post_Thumbnail_Template`.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35194 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 06:39:43 +00:00
Scott Taylor a65f390db6 Unit Tests: upgrade the fixtures in `Tests_Post_Revisions`.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35193 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 06:31:16 +00:00
Scott Taylor 5fc726c222 Unit Tests: in `Tests_Comment_Query::test_get_comments_for_post()`, create fewer comments (5, instead of 10).
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35192 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 05:56:47 +00:00
Scott Taylor d424f690d2 Unit Tests: after [35186], "upgrade" the Canonical fixtures.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35191 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 05:50:40 +00:00
Sergey Biryukov e675e2ccf0 Users: Add `'illegal_user_logins'` filter to allow certain usernames to be blacklisted.
Props danielbachhuber, chriscct7, crazycoolcam, SergeyBiryukov.
Fixes #27317.

git-svn-id: https://develop.svn.wordpress.org/trunk@35189 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 05:42:05 +00:00
Scott Taylor 742082c042 Unit Tests: create more fixtures for `Tests_User`. When using a factory to create ad hoc users, use the inherited static prop `$static_factory` instead of the instance prop, `$factory`. If 2 factories are used out of sync, the generator sequences diverge and dupes can be created, causing an untold number of unforeseen errors. Yay.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35188 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 05:29:40 +00:00
Scott Taylor 16d98ebf73 Unit Tests: implement `setUpBeforeClass()` and `tearDownAfterClass()` on `WP_UnitTestCase`. Use late static binding (plus a gross fallback for PHP 5.2) to check if `wpSetUpBeforeClass()` or `wpTearDownAfterClass()` exist on the called class, and then call it and pass a static `WP_UnitTest_Factory` instance via Dependency Injection, if it exists.
This makes it way easier to add fixtures, and tear them down, without needing to instantiate `WP_UnitTest_Factory` in every class - removes the need to call `commit_transaction()` in each individual class.

See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35186 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 04:43:37 +00:00
Scott Taylor e1a09eff54 Unit Tests: in `Tests_Term`, create fixtures for posts.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35185 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 03:47:36 +00:00
Scott Taylor 8cc22363db Unit Tests: in `Tests_Post`, create fixtures for users.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35183 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 03:30:09 +00:00
Scott Taylor 3cc9adb890 Unit Tests: in `Tests_Media::test_wp_get_attachment_image_srcset_array_no_width()`, just toggle metadata, instead of creating a new attachment. Shaves 75ms off the test.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35181 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 02:54:20 +00:00
Scott Taylor 011c1a2e2c Unit Tests: make a fixture in `Tests_Media` to represent the large image, instead of creating it 10 times.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35179 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 01:42:27 +00:00
Scott Taylor 75e4de9671 Unit Tests: move some oEmbed tests that can trigger HTTP calls to `Tests_External_HTTP_OEmbed`.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35178 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 01:28:05 +00:00
Scott Taylor fc7efaf9b1 Unit Tests: `Tests_Canonical` doesn't need to call `wp_set_current_user()` or implement `tearDown` because its grandparent calls `wp_set_current_user( 0 )` in `tearDown()`.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35177 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 01:17:22 +00:00
Scott Taylor a270d619ad Unit Tests: `Tests_Comment` needs a `tearDownAfterClass` impl to avoid spillage.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35176 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 01:05:50 +00:00
Scott Taylor 9d5c7055e6 Unit Tests: `Tests_Auth` needs a `tearDownAfterClass` impl to avoid spillage.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35175 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 01:03:16 +00:00
Scott Taylor 5fc04e0e26 Unit Tests: call `commit_transaction()` in `Tests_Auth` set up.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35174 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 00:48:22 +00:00
Scott Taylor 5d91776307 Unit Tests: reuse fixtures in `Tests_Comment`.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35173 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 00:38:26 +00:00
Scott Taylor 6f80581b80 Unit Tests: move `->test_readme()` out of `Tests_Basic` and into `Tests_External_HTTP_Basic` in `tests/external-http/`.
I intend to move other `wp_remote_get()` tests into similar classes.

See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35172 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 00:22:50 +00:00
Scott Taylor c1b2a034d3 Unit Tests: wrestle performance out of `Tests_Auth` by cloning the same user for a majority of the tests.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35171 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 00:10:45 +00:00
Boone Gorges 734d3794ac Fix incorrect variable names from [35164].
Cool story - the tests appeared to pass with the typos.

See #30017, #33968.

git-svn-id: https://develop.svn.wordpress.org/trunk@35165 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-14 21:59:14 +00:00
Boone Gorges 8c7dc25bed Share fixtures in `Tests_Admin_includesListTable` tests.
See #30017, #33968.

git-svn-id: https://develop.svn.wordpress.org/trunk@35164 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-14 21:40:44 +00:00
Boone Gorges 9f7bfa9805 Share fixtures in `Tests_Get_Archives`.
See #30017, #33968.

git-svn-id: https://develop.svn.wordpress.org/trunk@35163 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-14 21:29:59 +00:00
Boone Gorges 6c28fe3853 Create fewer fixtures in some tests.
See #30017, #33968.

git-svn-id: https://develop.svn.wordpress.org/trunk@35162 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-14 21:23:03 +00:00
Boone Gorges 6c674cfe20 Create fewer fixtures in XML-RPC `getComments` tests.
See #30017, #33968.

git-svn-id: https://develop.svn.wordpress.org/trunk@35154 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-14 14:38:30 +00:00
Dominik Schilling (ocean90) 5fc2385b1a Improve [35146] to only skip pluggable function signature tests for `wp-includes/cache.php` when an external object cache is in use.
See #31491, #33867.

git-svn-id: https://develop.svn.wordpress.org/trunk@35148 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-13 20:44:16 +00:00
John Blackbourn b2fd51c648 Reinstate `wp_cache_get()` into the pluggable function tests. The signature tests are now skipped if an external object cache is in use.
See #31491


git-svn-id: https://develop.svn.wordpress.org/trunk@35147 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-13 19:32:27 +00:00
John Blackbourn 8c1781953c Skip the pluggable function signature tests when an external object cache is in use.
See #31491


git-svn-id: https://develop.svn.wordpress.org/trunk@35146 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-13 19:30:34 +00:00
John Blackbourn 9d23a7ff96 Remove `wp_cache_reset()` from the pluggable functions signature tests, as the function is deprecated and no longer used.
See #31491, #33867


git-svn-id: https://develop.svn.wordpress.org/trunk@35145 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-13 19:19:04 +00:00
Scott Taylor 16b02b6768 KSES: have you ever heard of the `<bdo>` HTML tag? Same. http://www.w3schools.com/tags/tag_bdo.asp
Adds unit test.

Props iandunn.
Fixes #34063.


git-svn-id: https://develop.svn.wordpress.org/trunk@35141 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-13 17:17:13 +00:00
Boone Gorges c067ef07ec Create fewer fixtures in some XML-RPC tests.
See #30017, #33968.

git-svn-id: https://develop.svn.wordpress.org/trunk@35137 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-13 15:31:26 +00:00
Boone Gorges e3f8b888ad In `WP_UnitTestCase`, only flush rewrite rules when they're set.
See [34810]. See #33968.

git-svn-id: https://develop.svn.wordpress.org/trunk@35136 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-13 15:21:20 +00:00
Scott Taylor c3d9dffae6 After [35122], update `test_wp_unique_filename()` to reflect the change.
See #16226.


git-svn-id: https://develop.svn.wordpress.org/trunk@35124 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-13 03:41:11 +00:00
Boone Gorges 0091665f1c Correct expected counts in `WP_User_Query` 'number' test.
The `create_many()` number should be padded by just one, to account for the
user created by the test suite. Introduced in [35114].

We also don't have to create so many fixtures to run this test.

See #28631.

git-svn-id: https://develop.svn.wordpress.org/trunk@35123 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-13 03:25:42 +00:00
Scott Taylor a6a0045460 Fotmatting: in `sanitize_file_name()`, escape `%` when uploads contain them, otherwise attachment URLs will unescape the char and break.
Adds unit tests.

Props mordauk, simonwheatley, dd32, solarissmoke.
Fixes #16226.


git-svn-id: https://develop.svn.wordpress.org/trunk@35122 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-13 03:21:13 +00:00
Boone Gorges f9094e546a In `get_terms()`, don't store `WP_Term` objects in cache.
Fixes #34282.

git-svn-id: https://develop.svn.wordpress.org/trunk@35117 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-13 02:57:21 +00:00
Scott Taylor 34cb01e2f1 Users: when passing a `WP_User` instance to `wp_update_user()`, ensure that the user password is not accidentally double-hashed. This is terrifying.
Adds unit tests.

Props tbcorr, salcode.
Fixes #28435.


git-svn-id: https://develop.svn.wordpress.org/trunk@35116 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-13 02:47:09 +00:00
Scott Taylor 4c0b89553a Users: allow `-1` (no limit, use with extreme caution on large sites) as the value for `number` in `WP_User_Query` - similar to `posts_per_page => -1` in `WP_Query`.
Adds unit tests.

Props mordauk, jesin, nofearinc.
Fixes #28631.


git-svn-id: https://develop.svn.wordpress.org/trunk@35114 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-13 02:39:05 +00:00
Scott Taylor 455392c531 Widgets: after [35106], ensure that the widget required by the unit test is registered.
See #19450.


git-svn-id: https://develop.svn.wordpress.org/trunk@35113 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-13 02:35:47 +00:00
Boone Gorges e31a0390b1 In term meta lazy-loading tests, force `WP_Query` to cache results.
By default, `WP_Query` will not cache query results when using a persistent
object cache. The lazyload tests, however, depend on the cache being set during
each `WP_Query`, because the object cache is cleared between tests.

See #31491.

git-svn-id: https://develop.svn.wordpress.org/trunk@35112 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-13 02:35:36 +00:00
Boone Gorges 20225eb62a In cache tests, determine cache class name dynamically.
Some cache backends may use a class name other than `WP_Object_Cache` for their
cache drop-in. For example, certain versions of the APC Object Cache plugin
have a shim called `APC_Object_Cache`.

See #31491.

git-svn-id: https://develop.svn.wordpress.org/trunk@35108 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-13 02:06:19 +00:00
Scott Taylor 65c8adc252 Widgets: When using `the_widget()`, the `$before_widget` argument only receives the widget class if using the default sidebar arguments. Run `sprintf` after parsing the args to fix this.
Adds unit test.

Props coffee2code.
Fixes #19450.


git-svn-id: https://develop.svn.wordpress.org/trunk@35106 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-13 01:48:41 +00:00
Boone Gorges 9f551a4630 Don't match partial roles in `WP_User_Query`.
Because 'role=ocean90' shouldn't match 'role=bocean901'.

Props bocean901, ocean90.
Fixes #22212.

git-svn-id: https://develop.svn.wordpress.org/trunk@35101 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-13 01:31:53 +00:00
Scott Taylor d936110f7c Widgets: when getting settings, and none exist, set them to empty to avoid extraneous database queries on subsequent requests.
Adds unit tests.

Props kovshenin, MikeHansenMe, dlh.
Fixes #26876.


git-svn-id: https://develop.svn.wordpress.org/trunk@35100 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-13 01:12:12 +00:00
Sergey Biryukov e85d9f1312 Correct the `post_date` format in `WP_Date_Query` tests.
It should be `'Y-m-d H:i:s'` in order to match the regex in `get_gmt_from_date()` if `'timezone_string'` option is not set.

Props pbearne.
Fixes #34277.

git-svn-id: https://develop.svn.wordpress.org/trunk@35091 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-12 23:39:50 +00:00
Boone Gorges ed4eee668e Don't cache `WP_Term` objects in `wp_get_object_cache()`.
The data stored in the cache should be raw database query results, not
`WP_Term` objects (which may be modified by plugins, and may contain additional
properties that shouldn't be cached).

If term relationships caches were handled in `wp_get_object_terms()` - where
a database query takes place - it would be straightforward to cache raw data.
See #34239. Since, in fact, `get_the_terms()` caches the value it gets from
`wp_get_object_terms()`, we need a technique that allows us to get raw data
from a `WP_Term` object. Mirroring `WP_User`, we introduce a `data` property
on term objects, which `get_the_terms()` uses to fetch cacheable term info.

Fixes #34262.

git-svn-id: https://develop.svn.wordpress.org/trunk@35032 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-12 15:12:29 +00:00
Boone Gorges e8b0d11989 Fix incorrect setup in 'tag' query var test.
The test, introduced in [33724], was intended to demonstrate the behavior of
`example.com?tag=foo` routing. But an error in the test setup meant that a
URL-encoded tag object was being set as the value of 'tag'. Due to a quirk in
the way that `parse_request()` parses query vars, an object value for 'tag'
would inadvertently produce correct results in certain cases. But it's not a
usage we actively support, and it's not what was meant to be tested.

See #33532, #34262.

git-svn-id: https://develop.svn.wordpress.org/trunk@35030 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-12 15:03:43 +00:00
Boone Gorges 8847a58443 Don't require a `$taxonomy` to be specified in `get_term_field()`.
After [34997], the `$taxonomy` parameter of `get_term()` is optional. This
changeset brings `get_term_field()` in line with the new usage.

Adds unit tests for `get_term_field()`.

Props DrewAPicture.
See #34245.

git-svn-id: https://develop.svn.wordpress.org/trunk@35028 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-12 04:13:25 +00:00
Jeremy Felt 3ee40d6652 MS: Reject truthy, non-numeric network ids in `_network_option()`.
A valid `$network_id` or `null`/`false` is expected as the first parameter for `_network_option()`. If something other than that is passed, we immediately return `false` rather than attempting to guess what network was intended.

See #28290.


git-svn-id: https://develop.svn.wordpress.org/trunk@35025 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-11 23:29:55 +00:00
Jeremy Felt 55122c1538 MS: Adjust `_network_option()` parameter order, `$network_id` is first.
This better aligns with expectations and matches the structure used by `_blog_option()`. The `_site_option()` functions remain as an appropriate method for working with the current network.

See #28290.


git-svn-id: https://develop.svn.wordpress.org/trunk@35024 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-11 22:43:59 +00:00
Jeremy Felt d5e572f992 MS: Handle the possibility of 0 when checking a user's upload quota.
Upload space of 0 is now more possible via r35016 and should be respected rather than modified to a default of 10MB.

Fixes #34037.


git-svn-id: https://develop.svn.wordpress.org/trunk@35017 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-10 23:17:01 +00:00
Jeremy Felt d9edf86faf MS: Allow for a `blog_upload_space` setting of 0 to restrict uploads.
Previously, an value matching `empty()` would have been bypassed in favor of the default setting for 100MB.

Related #19538, r19639, r19652, where we saw the bug, fixed the bug, and then unfixed the bug so that it was not a surprise in a point release.

See #34037.


git-svn-id: https://develop.svn.wordpress.org/trunk@35016 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-10 23:14:11 +00:00
Weston Ruter e158ff27de Customizer: Fix scalability performance problem for previewing multidimensional settings.
As the number of multidimensional settings (serialized options and theme mods) increase for a given ID base (e.g. a widget of a certain type), the number of calls to the `multidimensional` methods on `WP_Customize_Setting` increase exponentially, and the time for the preview to refresh grows in time exponentially as well.

To improve performance, this change reduces the number of filters needed to preview the settings off of a multidimensional root from N to 1. This improves performance from `O(n^2)` to `O(n)`, but the linear increase is so low that the performance is essentially `O(1)` in comparison. This is achieved by introducing the concept of an "aggregated multidimensional" setting, where the root value of the multidimensional serialized setting value gets cached in a static array variable shared across all settings.

Also improves performance by only adding preview filters if there is actually a need to do so: there is no need to add a filter if there is an initial value and if there is no posted value for a given setting (if it is not dirty).

Fixes #32103.


git-svn-id: https://develop.svn.wordpress.org/trunk@35007 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-10 09:05:04 +00:00
Boone Gorges d6748bd2cb Return `WP_Post` objects from `wp_get_object_terms()`.
A side effect of this change is that terms stored in the cache no longer have
an `object_id` associated with them. Previously, `object_id` had always been
cached when the term cache was populated via `wp_get_object_terms()`, a
strategy that was mostly harmless but still incorrect.

See #14162.

git-svn-id: https://develop.svn.wordpress.org/trunk@34999 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-10 03:38:41 +00:00
Boone Gorges 797ddb60ba Return `WP_Term` objects from `get_terms()`.
Props boonebgorges, flixos90, DrewAPicture.
See #14162.

git-svn-id: https://develop.svn.wordpress.org/trunk@34998 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-10 02:12:40 +00:00
Boone Gorges 134a7af0fc Introduce `WP_Term`.
`get_term()` now returns a `WP_Term` object, instead of a `stdClass` object.
Cache support and sanitization filters for individual terms are now more
centralized. For example, `get_term_by()` is able to cast results of its query
to a `WP_Term` object by passing it through `get_term()`.

The `$taxonomy` parameter for `get_term()` is now optional, as terms ought to
be unique to a taxonomy (ie, shared terms no longer exist). In cases where
`get_term()` detects that the term matching the specified term_id is from the
wrong taxonomy, it checks to see if you've requested a shared term, and if so,
it splits the term. This is used only for fallback purposes.

The elimination of shared terms allows the caching strategy for terms to be
simplified. Individual terms are now cached in a single 'terms' bucket.

Props flixos90, boonebgorges, scribu, dipesh.kakadiya.
See #14162.

git-svn-id: https://develop.svn.wordpress.org/trunk@34997 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-10 01:58:37 +00:00
Boone Gorges dc2b7c634d Ensure that `WP_Date_Query` accepts a value of `0` for 'hour'.
Props jim912.
Fixes #34228.

git-svn-id: https://develop.svn.wordpress.org/trunk@34989 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-09 16:32:59 +00:00
Drew Jaynes 6350d90339 Tests: Add basic DocBlocks for four helper methods in general/template.php used to assist testing the Site Icon feature.
All four helpers were introduced in the feature merge for 4.3.

See #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@34983 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-09 04:34:29 +00:00
John Blackbourn bc043c51e8 Introduce the ability to filter the Users admin listing screen by users with no role, if such users exist.
Fixes #22993
Props spmlucas, johnbillion


git-svn-id: https://develop.svn.wordpress.org/trunk@34965 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-08 22:06:46 +00:00
Boone Gorges fa1e061dac `WP_User_Query` role improvement redux.
It's back, and it's better than ever: an overhaul of role-related arguments
in `WP_User_Query`. This updated version of the previously-reverted [34875]
includes support for the use of `$blog_id` without specifying a `$role`, for
a 99.7% reduced chance of breaking wordpress.org and other large sites.

Props boonebgorges, swissspidy.
Fixes #22212.

git-svn-id: https://develop.svn.wordpress.org/trunk@34959 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-08 21:27:04 +00:00
Drew Jaynes a6e9d49467 Administration: Add the ability to pass an array of screen IDs to `add_meta_box()` and `remove_meta_box()`.
The `$screen` parameter in both functions can now accept a single screen ID, `WP_Screen` object, or an array of screen IDs.

Adds tests.

Props coffee2code, iamfriendly, madalinungureanu, mordauk, igmoweb, meloniq, DrewAPicture.
See #15000.


git-svn-id: https://develop.svn.wordpress.org/trunk@34951 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-08 19:06:32 +00:00
Konstantin Obenland 7e923cc0fe Template: Add fallback for empty containers.
Since [14031] the container can be omitted in `wp_nav_menu()`. It can not
however in `wp_page_menu()`, which creates a conflict if it is set as
the fallback, Let's make sure there is always a valid container tag.

Fixes #33974.



git-svn-id: https://develop.svn.wordpress.org/trunk@34950 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-08 18:26:13 +00:00
Boone Gorges a1389117b2 Allow a null `id` to do a `name` lookup in `wp_set_current_user()`.
Previously, the `name` fallback was failing in the case where the current user
was 0, due to a loose comparison between 0 (the current user) and `null` (the
value that is used to trigger the `name` fallback).

Props bobbingwide.
Fixes #20845.

git-svn-id: https://develop.svn.wordpress.org/trunk@34947 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-08 17:28:34 +00:00
Boone Gorges 5c496e841a Add tests for current behavior of `wp_set_current_user()`.
See #20845.

git-svn-id: https://develop.svn.wordpress.org/trunk@34945 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-08 17:19:00 +00:00
Boone Gorges 9c9cdf28ca Allow excluded keywords when searching posts.
Pass a keyword with a leading hyphen to exclude posts containing that keyword.
For example, 'taco -onions' will return posts that contain the word 'taco' but
do not contain the word 'onions'.

Props akibjorklund.
Fixes #33988.

git-svn-id: https://develop.svn.wordpress.org/trunk@34934 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-08 03:17:22 +00:00
John Blackbourn ba7dc01639 Abstract the shortcode attribute parsing regex into its own function, update the JavaScript counterpart, and introduce a test to ensure they do not diverge again.
Fixes #34191
Props miqrogroove, johnbillion


git-svn-id: https://develop.svn.wordpress.org/trunk@34933 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-08 03:11:59 +00:00
Ryan McCue b39211475d REST API: Introduce baby API to the world.
Baby API was born at 2.8KLOC on October 8th at 2:30 UTC. API has lots
of growing to do, so wish it the best of luck.

Thanks to everyone who helped along the way:

Props rmccue, rachelbaker, danielbachhuber, joehoyle, drewapicture,
adamsilverstein, netweb, tlovett1, shelob9, kadamwhite, pento,
westonruter, nikv, tobych, redsweater, alecuf, pollyplummer, hurtige,
bpetty, oso96_2000, ericlewis, wonderboymusic, joshkadis, mordauk,
jdgrimes, johnbillion, jeremyfelt, thiago-negri, jdolan, pkevan,
iseulde, thenbrent, maxcutler, kwight, markoheijnen, phh, natewr,
jjeaton, shprink, mattheu, quasel, jmusal, codebykat, hubdotcom,
tapsboy, QWp6t, pushred, jaredcobb, justinsainton, japh, matrixik,
jorbin, frozzare, codfish, michael-arestad, kellbot, ironpaperweight,
simonlampen, alisspers, eliorivero, davidbhayes, JohnDittmar, dimadin,
traversal, cmmarslender, Toddses, kokarn, welcher, and ericpedia.

Fixes #33982.


git-svn-id: https://develop.svn.wordpress.org/trunk@34928 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-08 02:30:18 +00:00
John Blackbourn 4046919a11 Avoid stripping square brackets from URLs, and instead correctly encode them. Square brackets must be encoded in the path, path parameters, query parameters, and fragment, but must not be encoded in anything up to the domain and port.
Adds tests.

Fixes #16859


git-svn-id: https://develop.svn.wordpress.org/trunk@34920 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 23:38:22 +00:00
Boone Gorges f9f92b223d Handle `WP_User` objects properly in `update_user_caches()`.
We should not be storing the `WP_User` object in the cache, as it may contain
usermeta and other data that's cache elsewhere.

Props dd32.
See #24635.

git-svn-id: https://develop.svn.wordpress.org/trunk@34919 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 22:41:07 +00:00
Boone Gorges e1d7108e79 Add tests for `update_user_caches()`.
See #24635.

git-svn-id: https://develop.svn.wordpress.org/trunk@34918 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 22:34:32 +00:00
John Blackbourn e40575aa99 Correctly set the scheme of the `home` and `siteurl` options when creating a new site on multisite that uses some combination of HTTPS in the admin area or on the front end.
Fixes #33620
Props tryon, johnbillion


git-svn-id: https://develop.svn.wordpress.org/trunk@34916 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 21:45:17 +00:00
John Blackbourn 6705184dcc Correctly encode the `url` parameter that gets passed to WordPress' own oEmbed endpoint URL.
Fixes #34193
Props ocean90


git-svn-id: https://develop.svn.wordpress.org/trunk@34915 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 21:42:36 +00:00
Gary Pendergast 43bd3d46c9 Embeds: Add oEmbed provider support.
For the past 6 years, WordPress has operated as an oEmbed consumer, allowing users to easily embed content from other sites. By adding oEmbed provider support, this allows any oEmbed consumer to embed posts from WordPress sites.

In addition to creating an oEmbed provider, WordPress' oEmbed consumer code has been enhanced to work with any site that provides oEmbed data (as long as it matches some strict security rules), and provides a preview from within the post editor.

For security, embeds appear within a sandboxed iframe - the iframe content is a template that can be styled or replaced entirely by the theme on the provider site.

Props swissspidy, pento, melchoyce, netweb, pfefferle, johnbillion, extendwings, davidbinda, danielbachhuber, SergeyBiryukov, afercia

Fixes #32522.



git-svn-id: https://develop.svn.wordpress.org/trunk@34903 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 10:35:18 +00:00
Jeremy Felt cce73768b3 Tests: Remove static capture of space used and space allowed.
Originally introduced in [34601], this was necessary to avoid test pollution. Now that things have been separated and written to play nicely, we can remove this.

See #34037.


git-svn-id: https://develop.svn.wordpress.org/trunk@34902 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 07:24:47 +00:00
Jeremy Felt dadd89575f Tests: Improve tests for `upload_is_user_over_quota()`.
* Move all tests to a new 'multisite/uploadIsUserOverQuota.php'
* Use `get_space_allowed` and `pre_get_space_used` filters to help avoid test pollution.

See #34037.


git-svn-id: https://develop.svn.wordpress.org/trunk@34901 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 07:20:45 +00:00
Jeremy Felt b41be4c55c Tests: Account for non-numeric strings in tests for `get_space_allowed()`.
Provides a specific test for a case where a non-numeric strings are assigned to `blog_upload_space` at both the site and network levels.

See #34037.


git-svn-id: https://develop.svn.wordpress.org/trunk@34900 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 06:16:58 +00:00
Jeremy Felt b947cad868 Tests: Improve tests for `is_upload_space_available()`.
* Move all tests to a new 'multisite/isUploadSpaceAvailable.php'
* Store original `blog_upload_space` values before the class is loaded.
* Restore these values after each test tear down to avoid pollution.

Commit to testing `is_upload_space_available()` itself by always filtering the amount of space used through `pre_get_space_used`. This allows us to sanely test without worrying about the local environment. In the future, we may be able to remove some of these tests as `get_upload_space_available()` tests are built out and reliable.

See #34037.


git-svn-id: https://develop.svn.wordpress.org/trunk@34899 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 06:14:14 +00:00
Jeremy Felt 8cf73c132d Tests: Improve tests for `get_space_allowed()`.
* Move all tests to a new `multisite/getSpaceAllowed.php`
* Store original `blog_upload_space` values before the class is loaded.
* Restore these values after each test tear down to avoid pollution.
* Add a comprehensive set of expectations and results via data provider.

See #34037.


git-svn-id: https://develop.svn.wordpress.org/trunk@34898 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 04:57:12 +00:00
Scott Taylor 84df5f067c Rewrite/Permalinks/Canonical: in `url_to_postid()`, call `set_url_scheme()` on the URL to combat mixed content issues and find posts cross-scheme.
Adds unit tests.

Props swissspidy.
Fixes #34144.


git-svn-id: https://develop.svn.wordpress.org/trunk@34890 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 01:06:58 +00:00
Aaron Jorbin 351beec384 Revert [34875] due to unintentional breaking change
WordPress.org was taken down due to as Otto42 describes:

The previous version of this function added the query piece for the meta key = blog_id.capabilities, regardless of whether or not a role was requested. This limits the users returned to those with some defined role on this particular multisite instance.

See #22212




git-svn-id: https://develop.svn.wordpress.org/trunk@34880 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-06 20:57:35 +00:00
Aaron Jorbin f17e457a16 Add message with status info to temperamental assertion.
The ajax delete comment tests are intermittently failing. Many of the assertions make it hard to tell why they are failing. This adds a message to one of those assertions that contains some info on what is being asserted with the goal that it helps developers understand why the failure is failing.

See #33968



git-svn-id: https://develop.svn.wordpress.org/trunk@34879 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-06 19:55:56 +00:00
Boone Gorges 1949734cf3 Improve role-related arguments in `WP_User_Query`.
* 'role' now accepts an array or comma-separated list of role names. When passing multiple values for 'role', `WP_User_Query` will only match users that have all of the specified roles.
* 'role__in' accepts an array of role names, and allow the filtering of matched users to those with at least one of the specified roles.
* 'role__not_in' accepts an array of role names, and allows the filtering of matched users to those who have none of the specified roles.

Props swissspidy, mordauk, barrykooij, sirbrillig.
Fixes #22212.

git-svn-id: https://develop.svn.wordpress.org/trunk@34875 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-06 17:39:23 +00:00