Commit Graph

1329 Commits

Author SHA1 Message Date
Scott Taylor e366584fae Unit Tests: after [34477], make `Tests_Link_GetPostCommentsFeedLink` more respectable.
See #33693.


git-svn-id: https://develop.svn.wordpress.org/trunk@34479 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 04:31:58 +00:00
Scott Taylor 158aecc3ec Feeds/Links: after [34336], use a different meat cleaver to fix Rewrite spillage across test cases.
Fixes #33693.


git-svn-id: https://develop.svn.wordpress.org/trunk@34477 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 04:19:56 +00:00
Scott Taylor bab2316129 Date/Time: Add unit tests for `the_date()`.
Props jubstuff.
Fixes #33750.


git-svn-id: https://develop.svn.wordpress.org/trunk@34474 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 03:33:21 +00:00
Gary Pendergast c47ef29b34 Tests: Remove a `var_dump()` added in [34373].
See #33070.



git-svn-id: https://develop.svn.wordpress.org/trunk@34468 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 03:07:20 +00:00
Scott Taylor d92723a33f Users: in `WP_User::__unset()`, don't reset the deprecated prop `id` to `ID`. Still throw the deprecated notice.
Update unit test.

Fixes #20043.


git-svn-id: https://develop.svn.wordpress.org/trunk@34466 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 00:48:23 +00:00
Scott Taylor c1c93f1e95 Widgets: when passing a string arg value to `dynamic_sidebar()`, don't reset `$index` when the arg's sanitized value matches the sanitized name of a sidebar.
Adds unit test.

Props tyxla, fjarrett.
Fixes #23423.


git-svn-id: https://develop.svn.wordpress.org/trunk@34465 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 00:29:54 +00:00
Boone Gorges daadd27ed4 Allow `comment_exists()` to match based on GMT date.
The `comment_date_gmt` field of the `wp_comments` table is indexed, which makes
`WHERE` matches against the field much faster than against the unindexed
`comment_date`. For bulk operations like data import, the speed difference can
be meaningful.

We continue to default to 'blog' for `$timezone`, to preserve compatibility
with existing uses.

Props apokalyptik.
Fixes #33871.

git-svn-id: https://develop.svn.wordpress.org/trunk@34460 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-23 18:15:39 +00:00
Boone Gorges cf3042389d Fix `comment_exists()` unit test introduced in [34456].
See #33871.

git-svn-id: https://develop.svn.wordpress.org/trunk@34457 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-23 14:46:36 +00:00
Boone Gorges 01c8e7a8e1 Add unit test for `comment_exists()`.
See #33871.

git-svn-id: https://develop.svn.wordpress.org/trunk@34456 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-23 14:34:37 +00:00
Boone Gorges e6b7c6b2d4 Bail early when invalid ID is passed to `get_comment_class()`.
This helps to avoid PHP notices later in the function.

Props walterebert, dipesh.kakadiya, DrewAPicture.
Fixes #33947.

git-svn-id: https://develop.svn.wordpress.org/trunk@34454 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-23 14:08:47 +00:00
Boone Gorges b23a1fc613 Add a few simple tests for `get_comment_class()`.
Props walterebert, dipesh.kakadiya.
See #33947.

git-svn-id: https://develop.svn.wordpress.org/trunk@34453 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-23 14:04:55 +00:00
John Blackbourn 9dd4680d2f Add tests for some missing capabilities, including `do_not_allow`.
See #32394.


git-svn-id: https://develop.svn.wordpress.org/trunk@34450 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-22 22:17:30 +00:00
John Blackbourn f1191d2e6e Correct a capability name in the roles and capabilities mapping. The `delete_others_pages` key was missing, and the `delete_others_posts` key was duplicated.
Introduced in [32812].

See #32394.


git-svn-id: https://develop.svn.wordpress.org/trunk@34449 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-22 22:15:18 +00:00
Aaron Jorbin dd25cc9a7c Add test image for test_exif_keywords test
[34374] added a test that relies on a new test image. This test image wasn't included in the commit.  This fixes the broken Tests_Image_Meta::test_exif_keywords test.

Props swissspidy, SteveHoneyNZ.
Fixes #33772.



git-svn-id: https://develop.svn.wordpress.org/trunk@34448 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-22 21:42:45 +00:00
johnbillion 50226ada19 Implement a test for capabilities for a custom post type that uses `capability_type => page`.
See #17253


git-svn-id: https://develop.svn.wordpress.org/trunk@34447 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-22 21:00:03 +00:00
Scott Taylor 0ad726ef4d Users: add `__unset` to `WP_User`.
Adds unit tests.

Props johnjamesjacoby, MikeHansenMe, wonderboymusic.
Fixes #20043.


git-svn-id: https://develop.svn.wordpress.org/trunk@34380 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-22 04:59:35 +00:00
wonderboymusic 70b90490fd Media: In `wp_read_image_metadata()`, include IPTC Keywords when available in `$meta`.
Adds unit test.

Props swissspidy, dbru, SteveHoneyNZ.
Fixes #33772.


git-svn-id: https://develop.svn.wordpress.org/trunk@34374 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-22 04:18:02 +00:00
Scott Taylor 1352d3473a Media: Add new functions, `get_the_post_thumbnail_url()` and `the_post_thumbnail_url()`.
Adds unit tests.

Props dipesh.kakadiya, swissspidy, atomicjack.
Fixes #33070.


git-svn-id: https://develop.svn.wordpress.org/trunk@34373 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-22 04:14:15 +00:00
Scott Taylor 3c0ecff16e Media: Add a new function, `wp_get_attachment_image_url()`, which is a shortcut for `wp_get_attachment_image_src()` - same function signature, but returns just the URL based on `$size`.
Adds unit test.

Props dipesh.kakadiya, swissspidy, sebastian.pisula.
Fixes #33878.


git-svn-id: https://develop.svn.wordpress.org/trunk@34372 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-22 04:12:44 +00:00
Scott Taylor f9d1856805 Help Tabs: when returning help tabs, return them in order of priority, but also return the items in each priority in the order that they were added.
Fixes #33941.


git-svn-id: https://develop.svn.wordpress.org/trunk@34370 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-22 03:36:27 +00:00
Scott Taylor e75c7651b2 HTTP: Add some new Cookie helper functions:
* `wp_remote_retrieve_cookies( $response )`
* `wp_remote_retrieve_cookie( $response, $name )`
* `wp_remote_retrieve_cookie_value( $response, $name )`

Adds unit tests.

Props johnbillion.
Fixes #33711.


git-svn-id: https://develop.svn.wordpress.org/trunk@34369 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-22 03:13:13 +00:00
Scott Taylor b55de4e5f8 Feeds/Links: fix feed links for unattached attachments.
Adds unit tests.

Props wonderboymusic, iworks.
Fixes #33693.


git-svn-id: https://develop.svn.wordpress.org/trunk@34336 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-19 20:09:05 +00:00
Scott Taylor d258115a28 After [34334], update unit tests.
See #33930.


git-svn-id: https://develop.svn.wordpress.org/trunk@34335 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-19 20:06:52 +00:00
Boone Gorges 2fd81992bc Split the comment query.
`WP_Comment_Query` now fetches comments in two stages: (1) a query to get the
IDs of comments matching the query vars, and (2) a query to populate the
objects corresponding to the matched IDs. The two queries are cached
separately, so that sites with persistent object caches will continue to have
complete cache coverage for normal comment queries.

Splitting the query allows our cache strategy to be more modest and precise, as
full comment data is only stored once per comment. It also makes it possible
to introduce logic for paginated threading, which is necessary to address
certain performance problems.

See #8071.
data is only stored once per comment, instead of along with

git-svn-id: https://develop.svn.wordpress.org/trunk@34310 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-18 19:27:39 +00:00
Scott Taylor d5e5ca8e93 Comments: in `wp_rel_nofollow_callback()`, account for the fact that a link might already have a `rel` attribute. Currently, if a link already has a `rel`, it will result it duplicate attributes on the element with conflicting values.
Adds unit tests.

Props junsuijin, wonderboymusic.
Fixes #9959.


git-svn-id: https://develop.svn.wordpress.org/trunk@34277 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-18 04:35:37 +00:00
Boone Gorges 504deb52fc Lazy-load comment meta on single post pages.
[34268] introduced cache priming for commentmeta, enabled by default. To
ensure performance on single post pages - where commentmeta is most likely
to cause performance issues - we disable up-front cache-priming. Instead, we
prime commentmeta caches for all comments in the loop the first time
`get_comment_meta()` is called on the page.

Props bradt, dd32, wonderboymusic, boonebgorges.
Fixes #16894.

git-svn-id: https://develop.svn.wordpress.org/trunk@34270 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-17 20:00:31 +00:00
Weston Ruter 5ea07785b3 Customize: Reduce peak memory usage by JSON-encoding settings and controls individually.
When there are hundreds of settings and controls (e.g. nav menu items and widget instances) the resulting object that is JSON-encoded can become very large, and `wp_json_encode()` can consume a lot of memory to serialize it. By breaking down the serialization into multiple calls the peak memory usage can be kept in line.

Moves logic out of `wp-admin/customize.php` into the `WP_Customize_Manager` class with new methods:

 * `is_ios()`
 * `get_document_title_template()`
 * `get_preview_url()`/`set_preview_url()`
 * `get_return_url()`/`set_return_url()`
 * `get_autofocus()`/`set_autofocus()`
 * `customize_pane_settings()`

Includes unit tests for these methods, for which the logic was formerly untestable in `customize.php`.

Fixes #33898.


git-svn-id: https://develop.svn.wordpress.org/trunk@34269 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-17 19:41:35 +00:00
Boone Gorges 12329f5ef8 Prime comment meta caches in `WP_Comment_Query`.
The new 'update_comment_meta_cache' parameter, which defaults to `true`, can
be used to disable this behavior.

`update_comment_cache()` has been updated to support an `$update_meta_cache`
parameter, which also updates to true; this matches the pattern we use for
priming post caches.

See #16894.

git-svn-id: https://develop.svn.wordpress.org/trunk@34268 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-17 19:29:46 +00:00
Scott Taylor 25710ecc67 In `wp_mime_type_icon()`, the length of the `$wilds` array varies depending on what is passed as `$mime`. Loop over `$wilds` instead of arbitrarily checking `$wilds[0]`.
Adds unit tests.

Fixes #33012.



git-svn-id: https://develop.svn.wordpress.org/trunk@34255 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-17 00:36:12 +00:00
Boone Gorges d26b868870 Don't notify post authors about spam comments.
[34106] moved post author notification to a hook, and in the process, missed
the 'spam' check. This changeset restores that check.

To make unit testing easier, the notification callbacks have been refactored
to return values: false when various conditions aren't met (eg, approved
comments should not trigger moderation emails), and the return value of the
`wp_notify_*()` function otherwise.

Props cfinke, kraftbj.
See #33587.

git-svn-id: https://develop.svn.wordpress.org/trunk@34250 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-16 21:59:16 +00:00
Boone Gorges 302e3d1116 Allow taxonomies to be non-public.
[13216] introduced the 'public' argument for `register_taxonomy()`. This param
was used to set defaults for 'show_ui' and a number of other params, but it
never did anything itself.

With this changeset, taxonomies registered with `public=false` will no longer
be queryable on the front end, ie via taxonomy archive queries.

Props wpsmith, ocean90, nacin, ericlewis, boonebgorges.
Fixes #21949.

git-svn-id: https://develop.svn.wordpress.org/trunk@34247 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-16 19:04:57 +00:00
Boone Gorges 1b016b6dc6 Failed `get_term_by()` lookups should always return `false`.
Previously, we sometimes returned `null`.

Props charlestonsw, tyxla.
Fixes #33281.

git-svn-id: https://develop.svn.wordpress.org/trunk@34246 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-16 18:49:28 +00:00
Drew Jaynes 7682e433fc Docs: Put "it's" in its place (again).
Props kitchin.
Fixes #33894.


git-svn-id: https://develop.svn.wordpress.org/trunk@34234 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-16 12:45:51 +00:00
Boone Gorges 0adb6877b2 Improve validation of `user_login` and `user_nicename` length.
The `user_login` field only allows 60 characters, and `user_nicename` allows
50. However, there are no protections in the interface, and few in the code,
that prevent the creation of users with values in excess of these limits. Prior
to recent changes in `$wpdb`, users were generally created anyway, MySQL
having performed the necessary truncation. More recently, the `INSERT`s and
`UPDATE`s simply fail, with no real feedback on the nature of the failure.

This changeset addresses the issue in a number of ways:
* On the user-new.php and network/user-new.php panels, don't allow input in excess of the maximum field length.
* In `wp_insert_user()`, throw an error if the value provided for `'user_login'` or `'user_nicename'` exceeds the maximum field length.
* In `wp_insert_user()`, when using `'user_login'` to generate a default value for `'user_nicename'`, ensure that the nicename is properly truncated, even when suffixed for uniqueness (username-2, etc).

Props dipesh.kakadiya, utkarshpatel, tommarshall, boonebgorges.
Fixes #33793.

git-svn-id: https://develop.svn.wordpress.org/trunk@34218 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-15 22:13:51 +00:00
Scott Taylor 28426c041c In `WP::parse_request()`, don't add query vars of non-viewable post types to `WP::public_query_vars`. In `register_post_type()`, don't add query vars of non-viewable post types to `WP::public_query_vars`.
In `_unregister_post_type()` (unit tests), don't add query vars of non-viewable post types to `WP::public_query_vars`.

Adds unit test.

Fixes #30018.


git-svn-id: https://develop.svn.wordpress.org/trunk@34215 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-15 18:53:12 +00:00
Scott Taylor 6493d211d2 After [34188], fix unit test for image header.
See #33319.


git-svn-id: https://develop.svn.wordpress.org/trunk@34214 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-15 18:43:51 +00:00
Scott Taylor 7b93c40830 `WP_Comment_Query`: add `comment__in` to allowed values for `$orderby`.
Adds unit tests.

Fixes #33883.


git-svn-id: https://develop.svn.wordpress.org/trunk@34212 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-15 16:34:14 +00:00
Scott Taylor 72bc9d3227 Add `parent__in` and `parent__not_in` query vars to `WP_Comment_Query`.
Adds unit tests.

Fixes #33882.


git-svn-id: https://develop.svn.wordpress.org/trunk@34205 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-15 16:22:34 +00:00
John Blackbourn 0402bac392 Missed files from [34172].
See #33877


git-svn-id: https://develop.svn.wordpress.org/trunk@34173 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-15 08:08:15 +00:00
John Blackbourn c29412abf9 Initialise `$_SERVER[ 'REMOTE_ADDR' ]` during the test bootstrap so individual tests need not.
Fixes #33877
Fixes #25162


git-svn-id: https://develop.svn.wordpress.org/trunk@34172 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-15 08:04:33 +00:00
Scott Taylor c702a71ad1 Update post thumbnail functions to allow a `WP_Post` to be passed.
Adds unit tests.

Props swissspidy, Rahe.
Fixes #33723.


git-svn-id: https://develop.svn.wordpress.org/trunk@34167 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-15 03:45:23 +00:00
Scott Taylor 5c85369bb6 In `_wp_ajax_delete_comment_response()`, read the new `'all'` prop returned by `get_comment_count()` via `wp_count_comments()` when setting `$total`. `'all'` doesn't include `spam` in its count.
Updates unit tests.

Props dipesh.kakadiya.
Fixes #32362.


git-svn-id: https://develop.svn.wordpress.org/trunk@34161 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-15 01:46:51 +00:00
Scott Taylor 8cb6843170 Ensure that the count cache for `all` is in sync with `comment-{$post_id}` values. These are the values most often relied-upon by the list table for comments.
Adds unit tests.

See #33875.


git-svn-id: https://develop.svn.wordpress.org/trunk@34136 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 22:38:02 +00:00
Scott Taylor 545da32217 The "counts" cache for comments by post id is never invalidated. Neither `wp_update_comment_count()` nor `wp_update_comment_count_now()` touch the cache.
Adds unit test.
See #33875.


git-svn-id: https://develop.svn.wordpress.org/trunk@34131 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 22:03:23 +00:00
John Blackbourn 0c38f660e1 Implement unit tests which use reflection to test functions in pluggable.php. This means any changes to these functions will need explicit changes to their corresponding tests, which helps prevent unintentional breakage.
Fixes #33867


git-svn-id: https://develop.svn.wordpress.org/trunk@34126 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 19:14:38 +00:00
Boone Gorges 974517d2bc Accept 'ID' as a valid `$field` in `get_user_by()`.
We already accept 'id'. `ID` more closely matches the database and
`WP_User` schemas.

Props Shelob9.
Fixes #33869.

git-svn-id: https://develop.svn.wordpress.org/trunk@34125 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 18:57:15 +00:00
Scott Taylor 2c91a4d1e0 Fix the case-sensitivity of some HTTP class usage.
See #33413.


git-svn-id: https://develop.svn.wordpress.org/trunk@34123 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 17:36:37 +00:00
John Blackbourn 811e538325 Update links to the user profile editing screen in the admin toolbar when the current logged in user has no role on the current site. Covers single site and Multisite and introduces tests.
Fixes #25162


git-svn-id: https://develop.svn.wordpress.org/trunk@34122 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 17:09:58 +00:00
Dominik Schilling (ocean90) 08098026ce Passwords: Deprecate second parameter of `wp_new_user_notification()`.
The second parameter `$plaintext_pass` was removed in [33023] and restored as `$notify` in [33620] with a different behavior. If you have a plugin overriding `wp_new_user_notification()` which hasn't been updated you would get a notification with your username and the password "both".
To prevent this the second parameter is now deprecated and reintroduced as the third parameter.

Adds unit tests.

Props kraftbj, adamsilverstein, welcher, ocean90.
Fixes #33654.

(Don't ask for new pluggables kthxbye)

git-svn-id: https://develop.svn.wordpress.org/trunk@34116 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 12:42:34 +00:00
Scott Taylor c16e8b5616 Add sanity checks in `map_meta_cap()`, return `'do_not_allow'` when posts don't exist.
Adds unit test.

Props ocean90, nerrad, filosofo.
Fixes #23162.


git-svn-id: https://develop.svn.wordpress.org/trunk@34113 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 04:43:48 +00:00
Dion Hulse 9555882e90 When running on windows systems, normalise the capitalisation of the drive letter for more reliable string comparisons.
Props tyxla
Fixes #33265


git-svn-id: https://develop.svn.wordpress.org/trunk@34104 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 01:58:03 +00:00
Scott Taylor 184e058681 Objects are passed by-reference since PHP 5. In `_get_custom_object_labels()`, cast `$object->labels` back to `object` before returning. This function is weird.
Adds unit test.

Props Toro_Unit.
Fixes #33023.


git-svn-id: https://develop.svn.wordpress.org/trunk@34102 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 01:22:23 +00:00
Scott Taylor 5d0bc76040 Check if the `$post_type` passed to `get_post_type_object()` is a `scalar` value. Non-scalars were producing PHP warnings.
Adds unit tests.

Props Kloon.
Fixes #30013.


git-svn-id: https://develop.svn.wordpress.org/trunk@34100 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 00:02:05 +00:00
Jeremy Felt 276fa7cd09 Tests: Update `Tests_Feed_RSS::test_items` to expect new comment permalink structure.
Introduced in [34075] for posts without comments.

Props netweb.
Fixes #19893.


git-svn-id: https://develop.svn.wordpress.org/trunk@34092 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 23:30:11 +00:00
Boone Gorges 829ae5f4ce Fail gracefully when checking mapped cap against unregistered post type.
Post type objects are reponsible for mapping their capabilities to core caps.
As a result, when the post type is no longer registered, the caps are no
longer mapped. This causes problems when a post is left in the database after
the post type is no longer present, and WP does an 'edit_post' or other cap
check against it: a PHP notice is thrown, and the cap check always fails.

As a more graceful fallback, we map all post-type-dependent caps onto
'edit_others_posts', which allows highly privileged users to be able to
access orphaned content (such as comments belonging to disabled post types),
while minimizing the possibility of unintended privilege escalation.

We also add a `_doing_it_wrong()` notice, so that developers and site
administrators are aware that the cap mapping is failing in the absence of
the registered post type.

Props mitchoyoshitaka, DrewAPicture, imath, codeelite, boonebgorges, nofearinc, SergeyBiryukov, jorbin, dlh.
Fixes #16956.

git-svn-id: https://develop.svn.wordpress.org/trunk@34091 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 21:26:57 +00:00
Boone Gorges dcbd8c6c3d Allow `setup_postdata()` to accept a post ID.
Previously, it accepted only a full post object.

Props sc0ttclark, mordauk, wonderboymusic.
Fixes #30970.

git-svn-id: https://develop.svn.wordpress.org/trunk@34089 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 20:57:06 +00:00
Boone Gorges 4ebab4dc16 Remove extraneous table join in `get_adjacent_post()`.
Since [29248], a table join has not been necessary to process the
`$excluded_terms` parameter of `get_adjacent_post()`. Aside from adding extra
overhead, this join meant that post records that don't have any corresponding
rows in `wp_term_relationships` were erroneously excluded from results.

Fixes #32833.

git-svn-id: https://develop.svn.wordpress.org/trunk@34088 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 20:33:07 +00:00
Scott Taylor db3a7133f2 In `wp_insert_post()`, when setting `$post_author`, use `isset()` instead of `! empty()` to allow `0` to be passed as the value for `$post_author`.
Adds unit tests.

Props ericdaams, wonderboymusic.
Fixes #32585.


git-svn-id: https://develop.svn.wordpress.org/trunk@34085 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 18:53:56 +00:00
Boone Gorges b7c8dbf4a2 Better default values in `WP_Query::get_queried_object()`.
Setting the default value of the `queried_object_id` property to `0` meant
that, when called early enough in the WP bootstrap, `get_queried_object()`
could short-circuit the normal query by fooling it into thinking that the
request was for a page with id 0. Setting the default value to `null` instead
avoids this problem.

Props gradyetc, jazbek.
Fixes #31355.

git-svn-id: https://develop.svn.wordpress.org/trunk@34073 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 03:36:12 +00:00
Boone Gorges 0546d4ea57 Add unit tests for `get_term()`.
These tests will be useful as we begin to refactor in favor of `WP_Term`.

See #14162.

git-svn-id: https://develop.svn.wordpress.org/trunk@34035 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 03:10:47 +00:00
Boone Gorges 5b9d9c7c07 Require numeric IDs in user deletion functions.
`wp_delete_user()` and `wpmu_delete_user()` both require an `$id` parameter.
Previously, the functions did not verify that the value passed was, in fact,
a number. As such, passing an object or any other entity that would be cast
to int `1` would result in user 1 being deleted. We fix this by enforcing
the requirement that `$id` be numeric.

Props dipesh.kakadiya, utkarshpatel, juliobox.
Fixes #33800.

git-svn-id: https://develop.svn.wordpress.org/trunk@34034 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 02:24:03 +00:00
Boone Gorges 40a0d1f3cb Move `wp_delete_user()` tests to their own file.
See #33800.


git-svn-id: https://develop.svn.wordpress.org/trunk@34033 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 01:50:40 +00:00
Scott Taylor ad163d3547 In `get_page_uri()`, do not add parent slugs to orphaned pages.
Adds unit test.

Props filosofo, MikeHansenMe, MikeHansenMe, chriscct7.
Fixes #15963. 


git-svn-id: https://develop.svn.wordpress.org/trunk@34001 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-10 16:53:52 +00:00
Jeremy Felt ef1f697564 Multisite: Allow users with `manage_network_users` to edit network users.
Other users in a network can now be given capabilities to manage users without also having global super admin privileges.

* Users with `manage_network_users` can not edit super admins.
* Users with `manage_network_users` can not promote users to super admin.
* Uses of `is_super_admin()` in `user-new.php` are now updated to `manage_network_users`.

Props daniellandau, chriscct7.
Fixes #16860.


git-svn-id: https://develop.svn.wordpress.org/trunk@33988 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-10 03:33:22 +00:00
Jeremy Felt c89822ebe0 Multisite: Test `edit_user` capabilities for multisite administrators
An administrator in multisite can not edit users other than itself.

Props daniellandau for the initial patch.
See #16860.


git-svn-id: https://develop.svn.wordpress.org/trunk@33987 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-10 03:20:11 +00:00
Scott Taylor 6bc498c0e6 Implement a priority system for Help Tabs to add them at specific positions.
Adds unit tests.

Props swissspidy.
Fixes #19828.


git-svn-id: https://develop.svn.wordpress.org/trunk@33985 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-10 01:26:26 +00:00
Andrew Ozz cc18f258cb TinyMCE: update to 4.2.5, changelog: http://www.tinymce.com/develop/changelog/?ctrl=version&act=index&pr_id=1.
Fixes #33782 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@33981 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-09 19:44:09 +00:00
Scott Taylor 9eefbd1999 Deprecate `wp_get_http()` - function isn't used anywhere (apart from itself).
Props swissspidy.
Fixes #33709.


git-svn-id: https://develop.svn.wordpress.org/trunk@33969 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-09 04:25:24 +00:00
Andrew Ozz bb6dee64ae Formatting: maintain the content of HTML comments when they contain `<object>` tags. Add more tests for wpaitop().
Props miqrogroove.
Fixes #33645 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@33955 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-08 22:54:08 +00:00
Scott Taylor 6d0c15836b After [33840], JS regex needs the `g` modifier.
Add another unit test case.

Props kitchin.
Fixes #22781.


git-svn-id: https://develop.svn.wordpress.org/trunk@33947 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-08 16:43:27 +00:00
Gary Pendergast f921391922 Tests: Check that `readme.html` is recommending an actively supported version of MySQL.
Per the MySQL support guidelines (https://www.mysql.com/support/), Oracle provides active support for MySQL releases for 5 years from the General Availality release.

See #33758.



git-svn-id: https://develop.svn.wordpress.org/trunk@33946 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-08 03:23:29 +00:00
Gary Pendergast 65156c6fc5 Tests: Add an extra warning message when checking the recommended PHP version.
See #33758.



git-svn-id: https://develop.svn.wordpress.org/trunk@33944 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-07 07:27:34 +00:00
Gary Pendergast 0b6454bac5 Readme: Update the recommended PHP version to 5.6.
This also includes a unit test to ensure we're only recommending actively supported versions of PHP in the future.

Fixes #33758.



git-svn-id: https://develop.svn.wordpress.org/trunk@33937 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-07 05:22:03 +00:00
Scott Taylor 2d68434dff After [33925], rename the unit test class to `Tests_Comment_Meta_Cache` to avoid collisions on the PHP 5.2 superhighway.
See #16894.


git-svn-id: https://develop.svn.wordpress.org/trunk@33926 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-05 22:29:59 +00:00
Scott Taylor 542ac152fc In `wp_list_comments()`, update the comment meta cache when the comments derive from `WP_Query` and the new `->comment_meta_cached` prop is `false`.
There are no uses of `wp_list_comments()` in Core where `$comments` are passed as the 2nd argument.

Adds unit tests.

Props wonderboymusic, bradt.
Fixes #16894.


git-svn-id: https://develop.svn.wordpress.org/trunk@33925 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-05 22:24:16 +00:00
John Blackbourn dd9722fac0 Bail out early from `esc_url()` if the URL becomes empty after stripping out disallowed characters.
Fixes #28015
Props jesin for the unit test


git-svn-id: https://develop.svn.wordpress.org/trunk@33923 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-05 21:28:50 +00:00
Scott Taylor 26dd8b5b08 Allow `wp_insert_post()` to accept a `meta_input` argument. Devs should use `register_meta()` to ensure that specific values specified by key are sanitized properly.
Adds unit test.

Props CoenJacobs, swissspidy.
Fixes #20451.


git-svn-id: https://develop.svn.wordpress.org/trunk@33910 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-05 19:49:53 +00:00
Sergey Biryukov dde7dc7145 Update `Tests_Sanitize_Option::test_sanitize_option()` after [33858].
See #23605.

git-svn-id: https://develop.svn.wordpress.org/trunk@33907 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-05 14:17:24 +00:00
Sergey Biryukov b0d3f5922e Update `Tests_Admin_includesPlugin::test_menu_page_url()` after [33858].
See #23605.

git-svn-id: https://develop.svn.wordpress.org/trunk@33906 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-05 14:15:51 +00:00
Sergey Biryukov b09823a1d3 Update `Tests_Formatting_GetUrlInContent::get_input_output()` after [33858].
Props gitlost.
Fixes #23605.

git-svn-id: https://develop.svn.wordpress.org/trunk@33905 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-05 14:05:05 +00:00
Boone Gorges 9dfc5551ee In `get_terms()`, allow terms to be ordered by 'term_id'.
[29128] introduced updated documentation for the `'orderby'` parameter of
`get_terms()`. The new documentation mistakenly said that 'term_id' was a valid
orderby value. The current changeset makes that fantasy...A REALITY.

Props ixkaito.
Fixes #33726.

git-svn-id: https://develop.svn.wordpress.org/trunk@33903 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-04 21:16:11 +00:00
John Blackbourn 65c7f9113d Correctly encode spaces in URLs passed to `esc_url()` instead of removing them.
Fixes #23605
Props enshrined, johnbillion


git-svn-id: https://develop.svn.wordpress.org/trunk@33858 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-02 17:19:29 +00:00
John Blackbourn f34a386916 More unit tests for `esc_url()` and `esc_url_raw()`.
See #23605, #20771, #16859


git-svn-id: https://develop.svn.wordpress.org/trunk@33855 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-02 16:50:02 +00:00
John Blackbourn 4720c6e482 Add some more passing unit tests for `esc_url()` in preparation for upcoming changes.
See #23605, #20771, #16859


git-svn-id: https://develop.svn.wordpress.org/trunk@33851 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-02 14:19:21 +00:00
Boone Gorges 7232be7dcd Remove `#` from `@ticket` annotation in a unit test.
This improper character was erroneously introduced in [33724].

Props netweb.
Fixes #33532.

git-svn-id: https://develop.svn.wordpress.org/trunk@33850 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-02 13:39:05 +00:00
Scott Taylor 42dcb586ee After [33807], fix unit tests for PHP 5.2
Fixes #17626.


git-svn-id: https://develop.svn.wordpress.org/trunk@33846 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-01 17:03:13 +00:00
Scott Taylor 99c34d57c1 User Settings: allow dashes in `get|set_user_setting()` in PHP and `get|setUserSetting()` in JS.
Add unit tests - there were none. Mock `set_user_setting()` since it won't run due to `headers_sent()` being `true`.

Fixes #22781.


git-svn-id: https://develop.svn.wordpress.org/trunk@33840 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-01 03:56:44 +00:00
Scott Taylor 48ae1fcc1d After [33822], really add those unit tests for `wp_count_comments()`.
See #19903. 


git-svn-id: https://develop.svn.wordpress.org/trunk@33823 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-31 18:51:00 +00:00
Scott Taylor 3028a096be Comments: `wp_count_comments()` can use `get_comment_count()` internally to makes its DB query, provided that `get_comment_count()` returns more properties.
Adds/updates unit tests. There were zero (0) unit tests for `wp_count_comments()`.

Fixes #19903. 


git-svn-id: https://develop.svn.wordpress.org/trunk@33822 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-31 18:50:12 +00:00
Konstantin Obenland 903b9af181 Themes: Get the correct theme when template and stylesheet were both passed as arguments.
Fixes a bug where `$new_theme` got set before the second argument was
appropriately handled, causing the `current_theme` option to later always be
updated to the parent theme's name.

Introduced in [21131].

Props obenland, wonderboymusic.
Fixes #32635.



git-svn-id: https://develop.svn.wordpress.org/trunk@33815 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-30 21:44:38 +00:00
Scott Taylor bddf7c76ec Add some theme mod unit tests.
Props MikeHansenMe.
See #28637.


git-svn-id: https://develop.svn.wordpress.org/trunk@33812 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-30 03:42:49 +00:00
Scott Taylor c4b8ad087f Improve the reliability of the crop returned by `image_get_intermediate_size()`.
Add a bunch of unit tests to `tests/image/intermediate_size.php`.

Props joemcgill, ericlewis, kitchin, SergeyBiryukov, chipbennett.
Fixes #17626.


git-svn-id: https://develop.svn.wordpress.org/trunk@33807 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-30 02:40:40 +00:00
Scott Taylor da0a823129 `get_comment_count()` currently increments `awaiting_moderation` when comments are in the trash. This occurs because `case 0:` will match any value passed to `switch` that is a string that isn't specified in the list of cases. This is terrifying.
* Cases for `0` and `1` should be `'1'` and `'0'`
* Add unit tests for `get_comment_count()`. Currently, there are none.

See #33414.


git-svn-id: https://develop.svn.wordpress.org/trunk@33806 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-30 02:18:18 +00:00
Boone Gorges 27c8977af9 In `wp_list_categories()`, 'current_category' should accept an array of values.
This allows the 'current-cat' or 'current-cat-parent' classes to be applied
to more than one item in the list.

Props vilkatis.
Fixes #33565.

git-svn-id: https://develop.svn.wordpress.org/trunk@33804 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-29 19:45:35 +00:00
Sergey Biryukov 28767e1bac In `get_post_type_labels()`, ensure that filtered labels contain all required default values.
fixes #33543.

git-svn-id: https://develop.svn.wordpress.org/trunk@33776 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-28 03:38:26 +00:00
John Blackbourn d89398f945 Don't change the View Post button permalink in the sample permalink HTML when updating the slug on a published or future post.
Fixes #32954
Props boonebgorges, johnbillion


git-svn-id: https://develop.svn.wordpress.org/trunk@33773 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-27 20:56:54 +00:00
John Blackbourn f312173db5 Improve the efficiency of `is_user_member_of_blog()` by removing its use of `get_blogs_of_user()`. Adds additional tests.
Fixes #32472
Props BinaryKitten, sammybeats, johnbillion


git-svn-id: https://develop.svn.wordpress.org/trunk@33771 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-27 20:01:37 +00:00
Boone Gorges 718787cd18 Rename param added to `wp_list_categories()` in [33764] to 'hide_title_if_empty'.
Props vilkatis, DrewAPicture.
Fixes #33565.

git-svn-id: https://develop.svn.wordpress.org/trunk@33767 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-27 02:08:31 +00:00
Boone Gorges a684d5d19d Introduce `hide_title_if_no_cats` parameter to `wp_list_categories()`.
When generating a `<ul>` using `wp_list_categories()`, a title `<li>` element
is put at the top of the term list. Current behavior is that this title `<li>`
appears even when no terms are found. The new `hide_title_if_no_cats` param
allows developers to specify that the title should be hidden when the term list
is empty.

Props vilkatis.
Fixes #33460.

git-svn-id: https://develop.svn.wordpress.org/trunk@33764 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-26 19:41:55 +00:00
Sergey Biryukov b935049f24 Add `'wp_verify_nonce_failed'` action that fires when nonce verification fails.
props johnbillion, garza, Shelob9.
fixes #24030.

git-svn-id: https://develop.svn.wordpress.org/trunk@33744 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-26 00:05:11 +00:00
Scott Taylor a0a351a75d Add some more data for Shortcode unit tests.
Props miqrogroove.
Fixes #33455.


git-svn-id: https://develop.svn.wordpress.org/trunk@33740 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-25 21:50:55 +00:00
Boone Gorges 32cd95e1c1 In `WP_Query::parse_tax_query()`, allow 'cat' and 'tag' querystrings to be formatted as arrays.
See [33095] #32454 for a previous fix related to custom taxonomies.

Props Veraxus.
Fixes #33532.

git-svn-id: https://develop.svn.wordpress.org/trunk@33724 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-24 21:21:49 +00:00
Gary Pendergast bf3d36e0b6 WPDB: `get_table_from_query()` didn't find table names with hyphens in them.
Props dustinbolton for the fix.

Fixes #33470.



git-svn-id: https://develop.svn.wordpress.org/trunk@33718 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-24 00:18:49 +00:00
Boone Gorges b01b3be23e In `wp_delete_term()`, the `$deleted_term` object passed to filters should be generated before term relationships are deleted.
This allows the `count` property to reflect the pre-delete state of affairs,
rather than always being 0.

Props nicholas_io.
Fixes #33485.

git-svn-id: https://develop.svn.wordpress.org/trunk@33711 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-22 19:42:30 +00:00
Scott Taylor 36a9be2af5 In `wp_sanitize_redirect()`, don't eat `@` characters. According to RFC 3986, "@" is a perfectly valid character in a URL path or query string.
Adds unit test.

Props markjaquith.
Fixes #18818.


git-svn-id: https://develop.svn.wordpress.org/trunk@33707 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-22 17:04:17 +00:00
Scott Taylor dc48f3d795 Query:
Add a query var, `title`, that allows you to query posts by `post_title`. To accomplish this now, you have to do something like:

{{{
$tacos = get_posts( [
  'post_type' => 'taco',
  's' => $name,
  'exact' => true,
  'sentence' => true,
  'post_status' => 'publish',
  'fields' => 'ids',
  'posts_per_page' => 1
] );
}}}

Adds unit tests.

Fixes #33074.


git-svn-id: https://develop.svn.wordpress.org/trunk@33706 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-22 16:58:21 +00:00
Scott Taylor a70e0183e5 Ensure that `attachment_url_to_postid()` matches cross-scheme when front-end and back-end schemes are different.
Adds unit test.

Props welcher.
Fixes #33109.


git-svn-id: https://develop.svn.wordpress.org/trunk@33705 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-22 16:38:09 +00:00
Dominik Schilling (ocean90) 918dd71257 Tests: Fix a typo in function names for `$autoload` tests.
Autoload is "no" if the `$autoload` param for `update_option()` is `'no'` or `false`.

see #26394.

git-svn-id: https://develop.svn.wordpress.org/trunk@33703 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-22 09:44:48 +00:00
Dominik Schilling (ocean90) cb4a9ea174 Tests: Skip some tests for the Transients API when an external object cache is in use.
`test_transient_data_with_timeout()`, `test_transient_add_timeout()`, `test_nonexistent_key_dont_delete_if_false()`, and `test_nonexistent_key_old_timeout` are testing option values which aren't available with an an external object cache like memcache.

see #31491.

git-svn-id: https://develop.svn.wordpress.org/trunk@33702 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-21 20:32:42 +00:00
Boone Gorges c1b8f1f72a In `Walker_CategoryDropdown::start_el()`, cast values to strings before deciding whether to append 'selected' attribute.
As of [32484], `wp_dropdown_categories()` uses the `$value_field` value to
decide whether a given `<option>` should be 'selected'. However, `$value_field`
can refer to a value that is a string, such as a category's slug. This causes
problems when doing a loose comparison (`==`) with the value of the `'selected'`
parameter, which defaults to `0`, because when doing a loose comparison
between an integer and a string, PHP will cast the string to an integer. This
creates false matches, resulting in `<option>` elements getting a 'selected'
attribute incorrectly.

We address the issue by casting the comparison values to strings, and then
using the strict comparison operator `===`.

Fixes #33452 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@33681 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-21 01:10:34 +00:00
Boone Gorges 5e9a216cf7 Introduce `post_name__in` parameter for `WP_Query`.
Props enshrined.
Fixes #33065.

git-svn-id: https://develop.svn.wordpress.org/trunk@33653 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-20 02:18:05 +00:00
Boone Gorges 9bb010f2a1 `wp_update_term()` should return a true integer for 'term_taxonomy_id'.
Props ipm-frommen.
Fixes #32876.

git-svn-id: https://develop.svn.wordpress.org/trunk@33652 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-19 19:32:04 +00:00
Boone Gorges 48beba441b When generating a fallback `post_name` using the post ID, `wp_insert_post()` should clear the post cache immediately.
If the post cache is not cleared at this point, the cache can become stale
for operations performed before the cache is cleared later in the function.
Specifically, the generation of a `guid` for new posts can use stale data,
resulting in non-unique values. [33262] introduced a call to `get_post()`
that introduced just such an invalidation problem.

Fixes #5305.

git-svn-id: https://develop.svn.wordpress.org/trunk@33630 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-18 02:50:23 +00:00
Andrew Ozz b30fcd7597 Fix creating of extra `<br />` tags in both PHP and JS variants of wpautop(). Add PHP tests to catch similar problems in the future.
Props valendesigns, azaozz. Fixes #33377.

git-svn-id: https://develop.svn.wordpress.org/trunk@33624 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-17 17:35:58 +00:00
Boone Gorges 6d5da327f5 Remove unit test related to pre-4.1 term splitting during `wp_update_term()`.
After [33615], `wp_update_term()` no longer checks `$wp_db_version` before
attempting a split. This is because pre-4.1 versions of WordPress must be
allowed to update to 4.3+.

See #30261.

git-svn-id: https://develop.svn.wordpress.org/trunk@33616 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-14 04:15:34 +00:00
Dominik Schilling (ocean90) 23eaa36145 Capabilities: Fall back to the `edit_posts` capability for orphaned comments.
Also avoid PHP notices because of orphaned comments in the comments list table.
Includes unit test.

props pento, dd32.
fixes #33154.

git-svn-id: https://develop.svn.wordpress.org/trunk@33614 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-13 22:30:26 +00:00
Scott Taylor df480edb24 After [33325], supply a missing `post_type` in `->mw_editPost()`.
Add unit test.

Props ocean90.
Fixes #20662.


git-svn-id: https://develop.svn.wordpress.org/trunk@33612 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-13 15:27:57 +00:00
Boone Gorges ee67bd08f9 When splitting a shared 'nav_menu' term, ensure that nav items and theme locations are retained.
Props boonebgorges, dd32.
Fixes #33187.

git-svn-id: https://develop.svn.wordpress.org/trunk@33611 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-12 14:06:21 +00:00
Konstantin Obenland 018cd0819e Tests: Update Site Icon tests to account for changes in [33605].
H/t jorbin.

Fixes #33325.



git-svn-id: https://develop.svn.wordpress.org/trunk@33607 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-11 18:41:01 +00:00
ocean90 239759914f Shortcodes: Trim whitespace after sanitizing the shortcode output.
props Ankit K Gupta, obenland, miqrogroove.
fixes #33259.

git-svn-id: https://develop.svn.wordpress.org/trunk@33600 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-09 20:48:02 +00:00
Dion Hulse 7a35bff916 Fix `do_shortcode('<[shortcode]')` edge case.
Props miqrogroove.
Merges [33499] trunk.
See #33116.


git-svn-id: https://develop.svn.wordpress.org/trunk@33594 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-07 02:49:31 +00:00
Ella Iseulde Van Dorpe aaf15cdde8 TinyMCE: wptextpattern: trim whitespace
Props iseulde and azaozz.
Fixes #33246.


git-svn-id: https://develop.svn.wordpress.org/trunk@33563 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-03 22:06:25 +00:00
Ella Iseulde Van Dorpe e30bd2f439 JSHint for [33528]: remove logging
See #32688.


git-svn-id: https://develop.svn.wordpress.org/trunk@33562 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-03 21:57:04 +00:00
Weston Ruter 7857be9cf0 Customizer: Add QUnit tests for menus.
Props adamsilverstein, westonruter, jorbin.
Fixes #32688.


git-svn-id: https://develop.svn.wordpress.org/trunk@33528 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-03 19:27:27 +00:00
Sergey Biryukov 0d51c50057 Customizer: Fix failing tests on PHP 5.2 after [33488].
`assertNotFalse()` is not included in PHPUnit 3.6.12, use `assertInternalType( 'int' )` instead.

fixes #32814.

git-svn-id: https://develop.svn.wordpress.org/trunk@33526 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-31 13:01:16 +00:00
Helen Hou-Sandi 3fd1376418 Menu customizer: More clearly separate search results from available items.
Available items now fade from view while you're searching, and there is an explicit way to clear search results. No results gives a better message, though still brief this time around.

props valendesigns, designsimply, DH-Shredder, helen.
fixes #32710.


git-svn-id: https://develop.svn.wordpress.org/trunk@33511 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-29 23:39:54 +00:00
Helen Hou-Sandi 1768c8c85a Fix a unit test failure after [33489].
see #33179.


git-svn-id: https://develop.svn.wordpress.org/trunk@33506 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-29 22:14:33 +00:00
Weston Ruter dbcb95c022 Customizer: Ensure that all existing menus are shown in the Custom Menu widget's dropdown.
* Ensure that a Custom Menu widget selecting a newly-inserted menu gets updated to use the new menu ID upon Save & Publish.
* Dynamically update the visibility of the Custom Menu widget's "no menus" message when the number of menus changes between 0 and 1+.
* Send all dirty Customized settings in `update-widget` Ajax request and `preview()` them so that the widget update/form callbacks have access to any data dependencies in the current Customizer session (such as newly created unsaved menus).
* Update link in Custom Menu widget to point to Menus panel as opposed to Menus admin page, when in the Customizer.
* Fix an issue with extra space at top immediately after creating new menu.
* Fix doubled `update-widget` Ajax requests when changing select dropdown; prevent initial from being aborted.
* Add missing `wp_get_nav_menus()` hooks to preview Customizer updates/inserts for `nav_menu` settings; includes tests.
* Update `wp_get_nav_menu_object()` to allow a menu object to be passed in (and thus passed through).

Props westonruter, adamsilverstein.
Fixes #32814.


git-svn-id: https://develop.svn.wordpress.org/trunk@33488 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-29 16:02:08 +00:00
Andrew Ozz 35acd9abf8 Use the `embed_maybe_make_link` filter to test WP_Embed::autoembed().
See #33106.

git-svn-id: https://develop.svn.wordpress.org/trunk@33470 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-29 00:01:22 +00:00
Scott Taylor 4f814ec9ae Protect newlines inside of `CDATA`. This was breaking things, notably inline JS that used comments for HTML standards compat.
* Tokenize newlines in `WP_Embed::autoembed()` before running `->autoembed_callback()`
* Tokenize newlines with placeholders in `wpautop()` 
* Introduce `wp_html_split()` to DRY the RegEx from `wp_replace_in_html_tags()` and `do_shortcodes_in_html_tags()`

Adds unit tests.

Props miqrogroove, kitchin, azaozz.
Fixes #33106.


git-svn-id: https://develop.svn.wordpress.org/trunk@33469 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-28 23:02:04 +00:00
Ella Iseulde Van Dorpe 34354fc3c0 TinyMCE: wptextpattern: headings on enter
Fixes #31441.


git-svn-id: https://develop.svn.wordpress.org/trunk@33452 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-27 23:15:15 +00:00
Aaron Jorbin b5f505d3dd Add Initial JS Unit Tests for Menu Customizer
While these two tests will help ensure we don't repeat our mistakes, they mostly help lay the foundation for more tests that still need to be written.

See #32688
Props adamsilverstein, jorbin



git-svn-id: https://develop.svn.wordpress.org/trunk@33451 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-27 22:07:27 +00:00
Ella Iseulde Van Dorpe aed9a8c5bc Editor: word count: better names for types.
Also fix it in wp_trim_words().

Fixes #30966.


git-svn-id: https://develop.svn.wordpress.org/trunk@33440 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-27 11:18:55 +00:00
Sergey Biryukov 16cc16da9e Remove `svn:executable` from test files.
git-svn-id: https://develop.svn.wordpress.org/trunk@33425 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-26 09:40:58 +00:00
Sergey Biryukov 4ed7d2d05e Update `Test_WP_Customize_Nav_Menus::test_available_items_template()` after [33413].
fixes #32715.

git-svn-id: https://develop.svn.wordpress.org/trunk@33424 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-26 09:14:06 +00:00
Gary Pendergast 2e74ecfc1c Tests: Add a new test file missed in [33359].
git-svn-id: https://develop.svn.wordpress.org/trunk@33391 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-23 05:17:19 +00:00
Andrew Ozz eee2fa493b TinyMCE: update to 4.2.2. Changelog: https://github.com/tinymce/tinymce/blob/master/changelog.txt.
Fixes #33033, #33042. See #33083.

git-svn-id: https://develop.svn.wordpress.org/trunk@33369 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-22 21:11:44 +00:00
Weston Ruter 9e383a560a Customizer: Introduce `customize_nav_menu_available_item_types` and `customize_nav_menu_available_items` filters.
Allows for new available menu item types/objects to be registered in addition to filtering the available items that are returned for each menu item type/object.

Props valendesigns, imath, westonruter.
See #32832.
Fixes #32708.


git-svn-id: https://develop.svn.wordpress.org/trunk@33366 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-22 20:28:03 +00:00
Gary Pendergast 7b41adf712 Shortcodes: Improve the reliablity of shortcodes inside HTML tags.
Props miqrogroove.

See #15694.



git-svn-id: https://develop.svn.wordpress.org/trunk@33359 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-22 05:14:50 +00:00
Gary Pendergast 7439dd7354 Capabilities: When creating an auto-draft, ensure that the current user still has permission to do so.
git-svn-id: https://develop.svn.wordpress.org/trunk@33357 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-22 04:01:53 +00:00
Ella Iseulde Van Dorpe e2fab60c51 Editor: word count: exclude HTML comments and entities
Also make sure `type` is one of the three allowed types and remove unnecessary regex flags.

See #30966.


git-svn-id: https://develop.svn.wordpress.org/trunk@33344 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-21 15:23:45 +00:00
Konstantin Obenland 358ab7b010 Tests: Remove test for `delete_site_icon()`.
Removed in [33329].
H/t wonderboymusic.

See #16434.


git-svn-id: https://develop.svn.wordpress.org/trunk@33335 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-20 20:52:39 +00:00
Weston Ruter 5c76979fb8 Customizer: Finish unit tests for nav menus.
Removes object_type restriction to allow for future extensibility. Refactors some methods to improve testability. Includes new tests for Ajax requests.

Fixes #32687.
Props valendesigns, welcher, westonruter.


git-svn-id: https://develop.svn.wordpress.org/trunk@33322 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-18 23:19:33 +00:00
Ella Iseulde Van Dorpe 16e22cd0aa Editor: word count: count astrals as one character
This makes sure an emoji, for example, is counted as one character.

See #30966.


git-svn-id: https://develop.svn.wordpress.org/trunk@33320 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-18 11:41:25 +00:00
Gary Pendergast 7217a4f6e5 WPDB: `::strip_text_from_query()` doesn't pass a length to `::strip_invalid_text()`, which was causing queries to fail when they contained characters that needed to be sanity checked by MySQL.
Props dd32, mdawaffe, pento.

Fixes #32279.



git-svn-id: https://develop.svn.wordpress.org/trunk@33310 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-17 07:06:33 +00:00
Gary Pendergast bea2bf1502 WPDB: Remove some of the complexities in `::strip_invalid_text()` associated with switching character sets between queries. Instead of trying to dynamically change connection character sets, we now rely on the value of `::charset`. This also fixes the case where queries were being blocked when `DB_CHARSET` was `utf8`, but the column character set was non-`utf8`.
Fixes #32165.



git-svn-id: https://develop.svn.wordpress.org/trunk@33308 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-17 06:33:36 +00:00
Ella Iseulde Van Dorpe c2c5c5ac27 Editor: word count: exclude shortcodes
Props desaiuditd, adamsilverstein, azaozz and iseulde.
Fixes #27386. See #30966.


git-svn-id: https://develop.svn.wordpress.org/trunk@33299 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-16 21:08:05 +00:00
Ella Iseulde Van Dorpe 129a3affe5 Editor: word count: exclude more characters
Also only exclude these characters for the `words` type. They should be counted for other types.
Add the ASCIIOnly option to the uglify config to preserve escaped unicode characters.

See #30966. Fixes #27391.



git-svn-id: https://develop.svn.wordpress.org/trunk@33292 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-16 09:44:43 +00:00
iseulde e1242b6979 Editor: word count: add `all` type
This type will count all characters including spaces.

See #30966.


git-svn-id: https://develop.svn.wordpress.org/trunk@33290 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-15 23:47:02 +00:00
Scott Taylor 3d1f8f292a After [33148]:
Don't nest `esc_attr()` and `htmlspecialchars()` when escaping the post title on the edit post screen.

Unrevert parts of [32851] and [32850].

Adds/alters unit tests.

Props miqrogroove.
Fixes #17780.


git-svn-id: https://develop.svn.wordpress.org/trunk@33271 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-14 17:55:07 +00:00
Boone Gorges ce4b40d794 In `wp_unique_post_slug()`, only prevent date archive conflicts when the slug is being changed.
This prevents existing posts with numeric slugs from having their permalinks
changed on update.

Fixes #5305.

git-svn-id: https://develop.svn.wordpress.org/trunk@33262 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-14 12:27:11 +00:00
Boone Gorges c718849baa When creating a new post with an empty `post_name` and `post_title`, don't generate a `post_name` that conflicts with a date archive permalink.
See #5305.

git-svn-id: https://develop.svn.wordpress.org/trunk@33261 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-14 12:27:03 +00:00
Gary Pendergast 7711b72639 WPDB: When extracting the table name from a query, we had a 1000 character limit on the SQL string that would be searched. This was a hangover from when the code was imported from HyperDB, and isn't appropriate for Core, where a wider range of queries are likely to be run.
Fixes #32763



git-svn-id: https://develop.svn.wordpress.org/trunk@33259 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-14 10:18:57 +00:00
Jeremy Felt 33be338e9f Tests: Use a data provider when testing site flags in `update_blog_details()`.
See #32988.


git-svn-id: https://develop.svn.wordpress.org/trunk@33255 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-14 06:38:19 +00:00
Jeremy Felt 76ef07903d Tests: Use a data provider when testing path slashing in `update_blog_details()`.
Trims down 11 tests to 1 clean area of testing and makes for a much saner read.

See #32988.


git-svn-id: https://develop.svn.wordpress.org/trunk@33254 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-14 05:51:05 +00:00
Jeremy Felt e3e828c608 Tests: Move `update_blog_details()` tests to their own file.
Reduce some of the clutter in `tests/multisite/site.php` and introduce `tests/multisite/updateBlogDetails.php`. Tests moved over are verbatum at this point.

See #32988.


git-svn-id: https://develop.svn.wordpress.org/trunk@33253 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-14 05:49:28 +00:00
Boone Gorges 04237900a6 Require dependencies when appropriate in some unit test files.
Previously, attempting to run certain test files in isolation would resultin
fatal errors, as the parent classes had not been loaded.

Props isaacchapman.
Fixes #32984.

git-svn-id: https://develop.svn.wordpress.org/trunk@33250 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-14 03:07:13 +00:00
Konstantin Obenland 804a008eb1 Site Icon: Add Android-specific app icon.
Falling back to Apple app icons is deprecated behavior and will not work
forever. 192px is the recommended size for that icon.

Props kraftbj.
Fixes #32964.



git-svn-id: https://develop.svn.wordpress.org/trunk@33202 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-13 17:57:19 +00:00
Jeremy Felt 77300bcc92 Tests: Check downsized images against dynamic rather than static filename when original is expected.
See #32971.


git-svn-id: https://develop.svn.wordpress.org/trunk@33188 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-13 03:33:38 +00:00
Jeremy Felt e223663d3d Add explicit testing for `pre_get_space_used()` filter.
See #30202.


git-svn-id: https://develop.svn.wordpress.org/trunk@33185 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-13 00:13:25 +00:00
Jeremy Felt 6df1337645 Exclude individual site directories when calculating space used for the main site.
* Add an `$exclude` parameter to `recurse_dirsize()`.
* Use this parameter in `get_dirsize()` to exclude `/sites` when on the main site.
* Add tests for main site and switched site.

Props @earnjam, @jeremyfelt.
Fixes #30202.


git-svn-id: https://develop.svn.wordpress.org/trunk@33184 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-13 00:06:39 +00:00
Aaron Jorbin b43acd115c Add Unit Tests for get_objects_in_term()
Props rodrigosprimo.
Fixes #32946.



git-svn-id: https://develop.svn.wordpress.org/trunk@33182 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-12 20:12:19 +00:00
Konstantin Obenland a9ca47a7be Site Icon: Unit tests for `WP_Site_Icon` and its API.
Props obenland, jorbin.
See #16434.



git-svn-id: https://develop.svn.wordpress.org/trunk@33181 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-12 20:06:10 +00:00
Aaron Jorbin c6e3b84c48 Add dbDelta insert test
Test to make sure that dbDelta properly inserts a value into the DB.

Props tryon, jtsternberg, ebinnion, JPry, avnarun, kevkoeh, salcode.
Fixes #29020.



git-svn-id: https://develop.svn.wordpress.org/trunk@33175 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-12 17:28:15 +00:00
Scott Taylor a9874b9416 Revert [32851] and [32850] for now, tl;dr encoding issues.
See #17780.



git-svn-id: https://develop.svn.wordpress.org/trunk@33148 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-09 20:55:26 +00:00
Jeremy Felt bb7f147703 Do not allow deletion of a super admin user through `wpmu_delete_user()`.
In step with the UI provided by `wp-admin/network/users.php`, super admin privileges must be removed before a user can be deleted through the API.

Props @johnjamesjacoby, @jeremyfelt.
Fixes #32935.


git-svn-id: https://develop.svn.wordpress.org/trunk@33143 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-09 16:15:30 +00:00
Weston Ruter 2a8973f117 Customizer: Remove additional wrapper element around `wp_nav_menu()` which broke some theme designs.
Also includes these related changes:
* Export `oldContainer` and `newContainer` among the `customize-preview-menu-refreshed` event params for themes to be able to more easily re-initialize the DOM elements.
* Improve performance for partial refresh by only sending settings related to the menu being previewed.
* Fix previewing of menu assigned to Custom Menu by exporting a menu `term_id` as opposed to an object, as the former is more stable for comparing in in args hashes.
* Do full refresh of preview when nav menu unassigned so that the layout can be updated.
* Harden conditions for when partial refresh is eligible for a `wp_nav_menu()` instance.

Fixes #32841.


git-svn-id: https://develop.svn.wordpress.org/trunk@33138 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-08 21:29:53 +00:00
Weston Ruter 3c0e4d3860 Customizer: Prevent loss of `walker` and `fallback_cb` args for `wp_nav_menu`.
These args only need to be cleared out when exported to JavaScript, when they are not JSON-serializable. So the filter now clears these when gathering args for exporting to JS, but otherwise now leaves the original values to be passed through to `wp_nav_menu()`.

Fixes #32781.


git-svn-id: https://develop.svn.wordpress.org/trunk@33131 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-08 20:17:52 +00:00
John Blackbourn 389fb33d76 Skip the `Tests_Option_Transient::test_nonexistent_key_old_timeout()` tests on multisite for now.
See #31130
Fixes #30380


git-svn-id: https://develop.svn.wordpress.org/trunk@33125 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-08 18:23:46 +00:00
ocean90 94e3540dcc Update PHPMailer to 5.2.10 from 5.2.7.
Includes two modifications for WordPress:
* Removes support for NTLM in `class-smtp.php` since the required client (`extras/ntlm_sasl_client.php`) is not distributed as part of WordPress.
* Requires `class-smtp.php` for backwards compatibility with direct (non-wp_mail()) uses of PHPMailer, as the autoloader isn't used. See [27385].

This also includes a change to our `MockMailer` for unit tests. It now overrides `postSend() instead of `send()`, and `preSend()`.
`preSend()` resets `$this->Encoding` because PHPMailer doesn't clean up after itself / presets all variables. This becomes an issue when `PHPMailer::createBody()` sets `$this->Encoding = 'quoted-printable'` (away from it's default of 8bit) when it encounters a line longer than 998 characters. `Tests_Comment::test_comment_field_lengths` is such a case.

props MattyRob, dd32.
fixes #28909.

git-svn-id: https://develop.svn.wordpress.org/trunk@33124 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-08 17:15:02 +00:00
Aaron Jorbin 08d5df5f44 Remove PHP4 constructors from Unit Tests
If you are subclassing these classes in your own tests, you'll need to update your code.

Props johnbillion
See #31982



git-svn-id: https://develop.svn.wordpress.org/trunk@33123 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-08 16:04:11 +00:00
Weston Ruter bde076cbfb Customizer: Prevent preview from loading during QUnit tests and causing an XHR cross-domain error.
Fixes #32666.


git-svn-id: https://develop.svn.wordpress.org/trunk@33120 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-08 05:37:37 +00:00
John Blackbourn 0888ce55b1 Introduce unit tests for `sanitize_option()`.
Props MikeHansenMe, welcher, johnbillion
See #32351


git-svn-id: https://develop.svn.wordpress.org/trunk@33119 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-08 00:05:17 +00:00
John Blackbourn 063637755b Allow shortcode parameter names (attributes) to contain dashes.
Props aaroncampbell, tyxla, izem
Fixes #9405


git-svn-id: https://develop.svn.wordpress.org/trunk@33118 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-07 23:58:49 +00:00
Scott Taylor 138d68a58a In `wp_insert_user()`, comparing an email address against the user's old email address should not be case-sensitive.
Adds unit tests.

Props tyxla.
Fixes #32158.


git-svn-id: https://develop.svn.wordpress.org/trunk@33115 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-07 19:28:46 +00:00
Dominik Schilling (ocean90) daa477e3b8 Transients: If `get_option( $transient_timeout )` returns false, don't bother trying to delete the transient in `get_transient()`.
props jamesgol, ericmann.
fixes #30380.

git-svn-id: https://develop.svn.wordpress.org/trunk@33110 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-07 16:44:08 +00:00
Boone Gorges 8e6997b652 Use `assertEqualSets()` in `WP_Query::parse_tax_query()` tests.
Props ocean90.
See #32454.

git-svn-id: https://develop.svn.wordpress.org/trunk@33102 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-07 00:57:04 +00:00
Konstantin Obenland 2cafc0d787 Check for all required caps before (un)sticking a post.
In cases where a user has the `edit_others_posts` capability but not
`publish_posts`, it was possible for that user to unstick a post after editing,
since the input field was never made available in that context.

Props ericmann, chriscct7.
Fixes #24153.



git-svn-id: https://develop.svn.wordpress.org/trunk@33096 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-06 22:40:59 +00:00
Boone Gorges 53021ef6fe In `WP_Query::parse_tax_query()`, allow taxonomy querystring to be formatted as an array.
Props Veraxus.
Fixes #32454.

git-svn-id: https://develop.svn.wordpress.org/trunk@33095 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-06 20:36:18 +00:00
Weston Ruter 1b02636793 Customizer: Ensure that a newly-added nav menu item gets the Original link populated in its control.
Props valendesigns.
Fixes #32858.



git-svn-id: https://develop.svn.wordpress.org/trunk@33089 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-06 05:52:59 +00:00
Jeremy Felt 14f39faab1 Usernames in multisite should be restricted to 60 characters or fewer.
Only 60 characters can be stored in the database for a username, which could cause lookup issues when attempting to use similar usernames of extreme length.

Props @DJPaul.
See #17904, Fixes #26784.


git-svn-id: https://develop.svn.wordpress.org/trunk@33083 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-04 05:52:46 +00:00
Weston Ruter a21c6e76d6 Customizer: Fix saving menus with empty names or names that are already used.
Adds validation for initially-supplied nav menu name, blocking empty names from being supplied. If later an empty name is supplied and the nav menu is saved, the name "(unnamed)" will be supplied instead and supplied back to the client. If a name is supplied for the menu which is currently used by another menu, then the name conflict is resolved by adding a numerical counter similar to how `post_name` conflicts are resolved. Includes unit tests.

Fixes #32760.



git-svn-id: https://develop.svn.wordpress.org/trunk@33071 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-03 20:46:48 +00:00
Aaron Jorbin a547d6fed1 Don't strip newline in esc_url() when protocol is mailto:
The mailto protocol is a bit different than the other protocols in that new lines are something you might realistically want to include. Includes tests to make sure that http protocol urls that contain mailto: aren't affected. Tests for stripping newlines in general already exist.

Fixes #31632
Props danielbachhuber



git-svn-id: https://develop.svn.wordpress.org/trunk@33064 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-03 14:27:11 +00:00
Sergey Biryukov 8a8fc13bd0 Update `test_filter_wp_nav_menu_args()` after [33035].
see #32781.

git-svn-id: https://develop.svn.wordpress.org/trunk@33043 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-02 01:17:58 +00:00
Konstantin Obenland efdce1da51 Turn of comments for pages by default.
Pages are static content, for which comments are not expected out of the box.

Props valendesigns, rachelbaker.
Fixes #31168.



git-svn-id: https://develop.svn.wordpress.org/trunk@33041 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-02 00:21:28 +00:00
Dominik Schilling (ocean90) caab22e5b2 l10n: Update `wp_get_installed_translations()` to support variants of a language.
* A variant of a language has its own locale, for example the locale of the formal variant of German is `de_DE_formal`.
* Update `remove_accents()` and some CSS rules to support `de_DE_formal`.
* Add tests for `get_bloginfo( 'language' )`.
* API changes will be deployed over the next few days.

see #28303.

git-svn-id: https://develop.svn.wordpress.org/trunk@33027 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-01 15:42:32 +00:00
Boone Gorges f7b8ff5a2e Don't allow `$field` param to be passed to `get_term_link()`.
The new parameter creates inconsistencies in the signatures of the various
functions for fetching term links (`get_term_feed_link()`,
`get_edit_term_link()`, etc.).

Reverts [32553].

See #14156.

git-svn-id: https://develop.svn.wordpress.org/trunk@33022 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-01 12:53:05 +00:00
Boone Gorges e8a16ec322 Allow 'comment_agent' and 'comment_author_IP' to be set via `wp_new_comment()`.
Props mrutz, wonderboymusic, rachelbaker.
Fixes #14601.

git-svn-id: https://develop.svn.wordpress.org/trunk@33021 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-01 12:07:28 +00:00
Dion Hulse 5b58664439 Expire password reset links after 24 hours (by default). This causes existing password reset links to become invalid.
Props markjaquith, voldemortensen, johnbillion, MikeHansenMe, dd32
See #32429


git-svn-id: https://develop.svn.wordpress.org/trunk@33019 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-01 06:32:07 +00:00
Andrew Ozz 58f914004d TinyMCE: update to 4.2.1. Changelog: https://github.com/tinymce/tinymce-dist/blob/master/changelog.txt.
Fixes #32801.

git-svn-id: https://develop.svn.wordpress.org/trunk@33013 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-01 00:51:22 +00:00
Boone Gorges 3a982b1590 Fix `Tests_Post_GetPostClass::test_taxonomy_classes_hit_cache()` after [32994].
[32994] results in an additional database query during automated testing, so
the query count being compared in this specific test must be incremented
manually.

See #16434.

git-svn-id: https://develop.svn.wordpress.org/trunk@32997 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-29 14:31:52 +00:00
Boone Gorges 10d81a3fe5 Introduce 'wp_generate_tag_cloud_data' filter.
This filter allows developers to modify the data that is used to create tag
clouds, without having to manipulate the tag cloud markup directly.

As part of the refactor, this changeset also adds a few unit tests for the way
`wp_generate_tag_cloud()` generates the 'title' attribute, as well as
improvements to output escaping.

Props flixos90, ysalame.
Fixes #24656.

git-svn-id: https://develop.svn.wordpress.org/trunk@32996 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-29 14:15:59 +00:00
Boone Gorges 85ce3f7eba Add some tests for `wp_generate_tag_cloud()`.
Props welcher.
See #24656.

git-svn-id: https://develop.svn.wordpress.org/trunk@32995 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-29 13:18:48 +00:00
Aaron Jorbin 4a60647ab7 Deprecate php4 style constructors
PHP7 is deprecating PHP4 style constructors, so we need to modify our code to have _construct methods that fire before the named PHP4 style constructors.  The PHP4 style constructors will call the PHP5 style constructor in case it is being called directly (usually via parent::METHOD).

This modifies external libraries to add PHP5 style constructors, but doesn't add a notice for when they are used.  In WordPress core code, PHP4 style constructors are being given a call to _deprecated_constructor. To the PHP4 style constructor I say "I know that I can't take no more | It ain't no lie | I wanna see you out that door | Baby, bye, bye, bye..."

Upstream: https://wiki.php.net/rfc/remove_php4_constructors

Props jdgrimes, netweb, jorbin
See #31982



git-svn-id: https://develop.svn.wordpress.org/trunk@32990 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-28 15:26:41 +00:00
Scott Taylor a796d187b3 When searching for users using the `search` arg in `get_users()`/`WP_User_Query`, also search the user's email, url, and display name.
Adds unit tests.

Props mordauk, wonderboymusic.
Fixes #27304.


git-svn-id: https://develop.svn.wordpress.org/trunk@32980 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-28 00:35:42 +00:00
Boone Gorges 4f60683623 Improve error checking in `get_edit_term_link()`.
The function should not throw notices when an improper term or taxonomy is
passed.

Props tmatsuur, MikeHansenMe.
Fixes #32786.

git-svn-id: https://develop.svn.wordpress.org/trunk@32954 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-26 14:12:27 +00:00
Boone Gorges da5c716009 Introduce `WP_UnitTestCase::delete_user()`.
This static method provides a multisite-agnostic way to delete users during
automated testing.

See #32796.

git-svn-id: https://develop.svn.wordpress.org/trunk@32953 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-26 12:58:29 +00:00
Scott Taylor dcd5b25395 After [32896], update `ConvertChars.php` unit tests and rename to `ConvertInvalidEntries.php`.
Props boonebgorges.
Fixes #32335.


git-svn-id: https://develop.svn.wordpress.org/trunk@32947 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-25 19:50:14 +00:00
Scott Taylor ac63fb4dc3 YouTube oEmbed parsing: support the `m` subdomain.
Adds unit tests.

Props Toru, johnbillion.
Fixes #32714.


git-svn-id: https://develop.svn.wordpress.org/trunk@32930 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-24 21:05:59 +00:00
John Blackbourn 447550ec7b Implement tests for the `upload_mimes` filter to ensure it prevents the upload of disallowed file types.
See #32693


git-svn-id: https://develop.svn.wordpress.org/trunk@32919 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-24 00:42:33 +00:00
John Blackbourn 8c22c526bd Implement canonical and `url_to_postid()` tests for child pages which share a post name with other child pages.
See #32759


git-svn-id: https://develop.svn.wordpress.org/trunk@32918 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-24 00:40:45 +00:00
Boone Gorges 2399de6870 Add `expectedDeprecated` flags to `wp_richedit_pre()` and `wp_htmledit_pre()` unit tests.
These functions were deprecated in [32899].

See #32425.

git-svn-id: https://develop.svn.wordpress.org/trunk@32912 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-23 14:41:39 +00:00
Boone Gorges 641e701865 In `WP_Comment_Query`, parse meta_query vars after the `pre_get_comments` hook.
[31467] included a change that involved generating meta_query SQL before the
`pre_get_comments` hook, with the result that `pre_get_comments` callbacks were
no longer able to modify comment meta queries. We fix the problem by moving the
SQL generation to after the hook.

This changeset also includes a second call to `meta_query->parse_query_vars()`,
to ensure that modifications to metadata-related query vars (such as `meta_key`
and `meta_value`) performed in `pre_get_comments` callbacks have the expected
effect on the comment query.

Fixes #32762.

git-svn-id: https://develop.svn.wordpress.org/trunk@32911 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-23 14:35:29 +00:00
Scott Taylor 9d0fe3958c After [32884], update the default value for `comment_shortcuts`.
Props dlh, rachelbaker, DrewAPicture.
Fixes #31588.


git-svn-id: https://develop.svn.wordpress.org/trunk@32904 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-22 20:43:58 +00:00
Scott Taylor ed8b9a8d27 `wptexturize()` improvements:
* Make sure that strings ending with a number and quotation mark get the proper smart quotes
* Introduce `wptexturize_primes()`, a logic tree to determine whether or not "7'." represents seven feet, then converts the special char into either a prime char or a closing quote char.

Adds unit tests.

Props miqrogroove.
Fixes #29256.


git-svn-id: https://develop.svn.wordpress.org/trunk@32863 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-19 20:05:52 +00:00
Scott Taylor a06f5f6d90 Don't strip `\0` (backslash+zero) from post content for users without "unfiltered_html"
Adds unit tests.

Props miqrogroove.
Fixes #28699.


git-svn-id: https://develop.svn.wordpress.org/trunk@32860 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-19 18:46:11 +00:00
Ella Iseulde Van Dorpe fa5ec5077b Editor: restructure word count
* The WordCounter should only do one thing: count words. This makes it also easier to test.
* Add some really basic unit tests.
* Instead of only refreshing the count on enter and delete, refresh the count when the user stops typing. Also look at paste and content changes in TinyMCE.
* Use `match` instead of `replace` when it is appropriate.
* More readable code.

See #30966. Fixes #26620.



git-svn-id: https://develop.svn.wordpress.org/trunk@32856 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-19 10:34:59 +00:00
Andrew Ozz 5cb9a4b019 Fix using `htmlspecialchars()` whit the `$double_encode` parameter. PHP < 5.4 doesn't validate the entities.
Props miqrogroove. Fixes #17780.

git-svn-id: https://develop.svn.wordpress.org/trunk@32851 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-19 01:52:48 +00:00
Scott Taylor 4d8c4295f3 Since PHP 5.2.3, the `htmlspecialchars()` function has an optional `$double_encode` parameter, which we can now use. This will save us a few expensive kses/html decoding calls.
Adds unit tests.

Props miqrogroove.
Fixes #17780.


git-svn-id: https://develop.svn.wordpress.org/trunk@32850 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-18 21:59:10 +00:00
Boone Gorges d7831ec94d Use `assertFalse()` rather than `assertNull()` in `Tests_WP_Customize_Setting::test_is_current_blog_previewed()`.
`is_current_blog_previewed()` returns a boolean.

See #31428.

git-svn-id: https://develop.svn.wordpress.org/trunk@32840 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-18 14:07:35 +00:00
Boone Gorges 9597066674 Make sure `$_SERVER['SERVER_NAME']` is set whenever `wp_mail()` is called in PHPUnit tests.
This eliminates PHP notices when `wp_mail()` needs to determine its own From header.

See [25381] for a previous fix, which focused only on the mail-specific tests.

Fixes #32702.

git-svn-id: https://develop.svn.wordpress.org/trunk@32839 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-18 13:52:29 +00:00
Ella Iseulde Van Dorpe fa1a214eb6 TinyMCE: wptextpattern: fix issue that removes content
* If the resulting text node is empty, don't remove all the content from the paragraph.
* If there's an empty text node at the start of the paragraph, ignore it and consider the next node to be the start.

See #31441.


git-svn-id: https://develop.svn.wordpress.org/trunk@32832 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-18 11:33:11 +00:00
John Blackbourn c98a9dd6d7 Correct a unit test name.
See #21212


git-svn-id: https://develop.svn.wordpress.org/trunk@32826 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-17 23:09:28 +00:00
John Blackbourn afd6dd79fe Comprehensive unit tests for every available capability, and for all roles.
Fixes #32394.


git-svn-id: https://develop.svn.wordpress.org/trunk@32812 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-17 00:04:08 +00:00
Dominik Schilling (ocean90) c0a66eba79 Add menu management to the Customizer.
This brings in the Menu Customizer plugin: https://wordpress.org/plugins/menu-customizer/.

props celloexpressions, westonruter, valendesigns, voldemortensen, ocean90, adamsilverstein, kucrut, jorbin, designsimply, afercia, davidakennedy, obenland.
see #32576.

git-svn-id: https://develop.svn.wordpress.org/trunk@32806 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-16 22:07:08 +00:00
Boone Gorges 8235387ee4 Clean up uploaded file after `test_media_handle_upload_sets_post_excerpt()`.
Props McGuive7.
Fixes #32534.

git-svn-id: https://develop.svn.wordpress.org/trunk@32794 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-16 12:37:30 +00:00
Scott Taylor 1e8fb99ebd Improve the consistency of punctuation matching in `wptexturize()`.
Adds unit tests.

Props miqrogroove.
Fixes #31886.


git-svn-id: https://develop.svn.wordpress.org/trunk@32789 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-16 00:49:45 +00:00
Scott Taylor 40bb9aa3d9 Allow 'Cockney' filter to be translated.
Updates unit test.

Props miqrogroove.
Fixes #31953.


git-svn-id: https://develop.svn.wordpress.org/trunk@32788 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-16 00:45:49 +00:00
Scott Taylor 7dd8a1364a In the `youtube_embed_url` embed handler, make `embed` a non-capturing group that alternately matches for `v` - YouTube supports both URL paths.
Add unit test cases.

Props dmchale for some patch work.
Fixes #32161.


git-svn-id: https://develop.svn.wordpress.org/trunk@32787 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-16 00:34:06 +00:00
Scott Taylor 2860548f5b Set `$_SERVER['REQUEST_METHOD']` for unit tests.
Props johnbillion.
Fixes #32636.


git-svn-id: https://develop.svn.wordpress.org/trunk@32785 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-16 00:03:25 +00:00
Jeremy Felt 7819ac5d16 Introduce get_main_network_id()
Expand on the logic previously available as part of `is_main_network()` and provide a way to obtain the ID of the main network. Most useful in multi-network configurations.

Props @johnjamesjacoby for the initial patch.
Fixes #30294.


git-svn-id: https://develop.svn.wordpress.org/trunk@32775 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-14 21:44:45 +00:00
Aaron Jorbin 7988f78e44 Improve dbDelta unit tests
Add new tests for more parts of dbDelta.  This was cleaned up and prepared for commit at #wcphilly contributor day.

Props jdgrimes, tryon, jtsternberg, ebinnion, JPry, avnarun, kevkoeh, jorbin, salcode.
Fixes #29020.



git-svn-id: https://develop.svn.wordpress.org/trunk@32770 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-14 19:22:20 +00:00
Scott Taylor 9c42e158bc `$status` shouldn't be loosely compared to `true` in `wp_xmlrpc_server::wp_deleteComment()`.
`$initial` shouldn't be loosely compared to `true` in `get_calendar()`.
`current_user_can()` shouldn't be loosely compared to `false` in `kses_init()`
`$get_all` shouldn't be loosely compared to `true` in `get_blog_details()`.
`is_array()` and `in_array()` shouldn't be loosely compared in `wpmu_validate_user_signup()`.
`$result` should by strictly compared in `check_ajax_referer()`.
`wp_verify_nonce()` should by strictly compared in `_show_post_preview()`.
`is_user_logged_in()` should not be loosly compared against `false` in `wp-signup.php`.

See #32444.


git-svn-id: https://develop.svn.wordpress.org/trunk@32733 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-12 17:47:16 +00:00
Boone Gorges dba2b6a9c0 Introduce `class` argument to `wp_dropdown_pages()`.
This new argument allows devs to specify the 'class' attribute of the select
element.

Props ramiy, voldemortensen.
Fixes #30082.

git-svn-id: https://develop.svn.wordpress.org/trunk@32727 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-12 13:04:04 +00:00
Boone Gorges c04185a1f2 Avoid returning duplicate matches when using a meta query in `WP_User_Query`.
A meta_query containing an `OR` relation can result in the same record matching
multiple clauses, leading to duplicate results. The previous prevention against
duplicates [18178] #17582 became unreliable in 4.1 when `WP_Meta_Query`
introduced support for nested clauses. The current changeset adds a new method
`WP_Meta_Query::has_or_relation()` for checking whether an `OR` relation
appears anywhere in the query, and uses the new method in `WP_User_Query` to
enforce distinct results as necessary.

Props maxxsnake.
Fixes #32592.

git-svn-id: https://develop.svn.wordpress.org/trunk@32713 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-09 17:41:35 +00:00
Dion Hulse 306d8b6a1e WP_HTTP: ensure that the temporary file is created within the temporary directly when `stream` is specified without a `filename` parameter.
Fixes #32549


git-svn-id: https://develop.svn.wordpress.org/trunk@32712 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-09 03:54:49 +00:00
Boone Gorges 036c33caaa Filter out empty object_types in `register_taxonomy_for_object_type()`.
This prevents weird edge bugs when registering an existing taxonomy with an
object type when the taxonomy was previously associated with no object types.

Fixes #32590.

git-svn-id: https://develop.svn.wordpress.org/trunk@32709 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-08 19:44:32 +00:00
Dominik Schilling (ocean90) b3660e2731 Parse request: Quote regular expression characters in home path.
Adds unit tests.

props akirk.
fixes #30438.

git-svn-id: https://develop.svn.wordpress.org/trunk@32708 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-08 13:28:44 +00:00
Ella Iseulde Van Dorpe 11de1cedaa TinyMCE: wptextpattern: make tests ~2x faster
* Reuse the same instance for all tests in the module.
* Run without CSS (skin).
* Less typing.

See #31441.


git-svn-id: https://develop.svn.wordpress.org/trunk@32706 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-07 22:15:47 +00:00
Ella Iseulde Van Dorpe 63183254c9 Customizer: hide controls on test page
Introduced in [30919].
See #32577 and #30701.


git-svn-id: https://develop.svn.wordpress.org/trunk@32701 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-07 09:03:03 +00:00
Ella Iseulde Van Dorpe b866b19a20 TinyMCE: wptextpattern: disable for IE 8 and lower
Props azaozz, iseulde.
See #31441.


git-svn-id: https://develop.svn.wordpress.org/trunk@32700 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-06 22:37:13 +00:00
Ella Iseulde Van Dorpe 5bac5f7ccd TinyMCE: add wptextpattern plugin
This plugin can automatically format text patterns as you type. It includes two patterns: unordered (`* ` and `- `) and ordered list (`1. ` and `1) `). If the transformation in unwanted, the user can undo the change by pressing backspace, using the undo shortcut, or the undo button in the toolbar.

This is the first TinyMCE plugin that has unit tests and there's some good groundwork for adding tests to existing plugins in the future.

First run. See #31441.


git-svn-id: https://develop.svn.wordpress.org/trunk@32699 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-06 20:07:00 +00:00
Boone Gorges 9747d9f611 In `wp_notify_moderator()`, don't throw notice when comment belongs to a post with no author.
Props Oxymoron.
Fixes #32566.

git-svn-id: https://develop.svn.wordpress.org/trunk@32692 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-04 17:28:07 +00:00
Boone Gorges 6e8fd2509e Introduce `'has_published_posts'` parameter for `WP_User_Query`.
This allows user query results to be limited to those users who have published
posts in at least one of the specified post types.

Props joehoyle, boonebgorges.
Fixes #32250.

git-svn-id: https://develop.svn.wordpress.org/trunk@32683 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-02 13:29:44 +00:00
Dominik Schilling (ocean90) 5ae2271098 Customizer: Improve JS templates for Panels and Sections added in [32658].
* Always fall back to using the default template if no custom template exists.
* Provide a set of default params when constructing new `Section` and `Panel` objects.

Includes QUnit tests.

Props celloexpressions, westonruter, ocean90.
Fixes #30737.

git-svn-id: https://develop.svn.wordpress.org/trunk@32681 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-01 22:46:56 +00:00
Boone Gorges a59ebc0ed4 Term unit test factory class should override `create_and_get()` method.
The override is necessary because the `get_term()` call, which fetches the
term object, needs the `'taxonomy'` argument passed to the factory method.

Props dlh.
Fixes #32536.

git-svn-id: https://develop.svn.wordpress.org/trunk@32659 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-30 13:03:07 +00:00
Weston Ruter cc19680774 Add JS templates for Customizer Panels and Sections.
This extends the approach taken for Customizer Controls in #29572.

Props celloexpressions, westonruter, ocean90.
See #30737.


git-svn-id: https://develop.svn.wordpress.org/trunk@32658 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-30 00:02:13 +00:00
Boone Gorges bb8999fb0e When parsing what appears to be a date archive request, check for a post with a clashing permalink before resolving to the archive.
A URL like `example.com/2015/05/15/` generally resolves to the May 15, 2015 date
archive. But in certain cases, it could also be the permalink of a post with
the slug `'2015'`. When a conflict of this sort is detected, resolve to the post
instead of the archive.

URL conflicts of this sort should no longer occur for new posts; see [32647].

Props valendesigns, boonebgorges, Denis-de-Bernardy.
Fixes #5305.

git-svn-id: https://develop.svn.wordpress.org/trunk@32648 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-29 13:09:26 +00:00
Boone Gorges 683ae35c33 Disallow post slugs that will result in permalinks that conflict with date archive URLs.
On certain permalink structures, a numeric post slug will result in a post
permalink that conflicts with a date archive URL. For example, with permastruct
`/%year%/%monthnum%/%postname%/`, a post published in May 2015 with slug
`'15'` will result in a URL (`/2015/05/15/`) that conflicts with the archive
for May 15, 2015.

To avoid this problem, `wp_unique_post_slug()` rejects a requested slug when it
would generate a conflict of this type. Thus, in our example, `'15'` would
become `'15-2'`.

Props valendesigns, boonebgorges, Denis-de-Bernardy, loushou.
See #5305.

git-svn-id: https://develop.svn.wordpress.org/trunk@32647 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-29 12:52:17 +00:00
Boone Gorges 25afc4b16a `is_email_address_unsafe()` tests should only be run on multisite.
See [32638].

git-svn-id: https://develop.svn.wordpress.org/trunk@32646 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-29 12:37:51 +00:00
Boone Gorges 8dced310b1 Improve tests for `is_email_address_unsafe()`.
* Move to a separate file for better organization and method names.
* Use a `dataProvider` when appropriate, for better readability.
* Add a test for splitting the banned domain list on line breaks.

See #20459, #21730.

git-svn-id: https://develop.svn.wordpress.org/trunk@32638 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-28 16:05:30 +00:00
Jeremy Felt c12e7d763c Use a dataProvider for network option sanitization tests.
Cleans up tests for sanitization of `illegal_names`, `illegal_email_domains`, and `banned_email_domains` network options.

Fixes #32517.


git-svn-id: https://develop.svn.wordpress.org/trunk@32634 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-28 06:37:44 +00:00
Andrew Nacin 7aef782aa8 Add unit test asserting that serializable objects will never pass is_serialized(). see #17375.
git-svn-id: https://develop.svn.wordpress.org/trunk@32631 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-28 05:22:14 +00:00
Jeremy Felt 9560fbdd77 Provide all site flag data in objects returned by `get_blogs_of_user()`
Previously, `archived`, `spam`, and `deleted` properties were forced to `0` when returned by `get_blogs_of_user()`. This was originally introduced in [21794] as a way to prevent notices when properties were expected.

Instead, we can properly fill these properties with those retrieved from `get_blog_details()`.

Props realloc.
Fixes #32281.


git-svn-id: https://develop.svn.wordpress.org/trunk@32626 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-27 21:22:09 +00:00
Boone Gorges d10ec28b01 Improve unit tests for `wp_unique_post_slug()`.
See #5305.

git-svn-id: https://develop.svn.wordpress.org/trunk@32604 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-26 18:07:17 +00:00
westonruter 6d34b6e075 Add support for `WP_Widget::get_settings()` returning `ArrayIterator`/`ArrayObject` instances.
Plugins can use `pre_option_widget_{$id_base}` filters to return `ArrayIterator`/`ArrayObject` instances instead of primitive arrays. This makes possible for widget instance data to be drawn from somewhere else than `wp_options`, such as a custom post type.

Add unit tests for widgets.

Fixes #32474.



git-svn-id: https://develop.svn.wordpress.org/trunk@32602 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-26 16:50:03 +00:00
Boone Gorges 94a9896b05 Introduced `$field` argument to `get_term_link()`.
This new argument allows developers to specify which term field should be
matched by the value of the `$term` parameter (in particular, 'name' and
'term_taxonomy_id' are now supported).

Props sudar, mordauk.
Fixes #14156.

git-svn-id: https://develop.svn.wordpress.org/trunk@32553 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-23 18:28:22 +00:00
Boone Gorges 6cb6f3916a Unit tests for `get_term_link()`.
See #14156.

git-svn-id: https://develop.svn.wordpress.org/trunk@32552 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-23 18:12:27 +00:00
Boone Gorges f0d6031d9b Streamline support for multiple post types in `get_posts_by_author_sql()`.
* Don't accept a comma-separated list, only a single post type or an array of post types. This is easier to document.
* Add changelog entries to all calling functions.

Props DrewAPicture.
Fixes #32243.

git-svn-id: https://develop.svn.wordpress.org/trunk@32524 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-21 19:48:19 +00:00
Boone Gorges e656053bce Support multiple post types in `count_user_posts()` and other functions that use `get_posts_by_author_sql()`.
Props nikonratm.
Fixes #32243.

git-svn-id: https://develop.svn.wordpress.org/trunk@32523 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-21 18:42:49 +00:00