Commit Graph

251 Commits

Author SHA1 Message Date
Andrew Nacin 036cb74d46 Add unit tests for searching by relevance.
props wonderboymusic.
see #7394, #20044.


git-svn-id: https://develop.svn.wordpress.org/trunk@27474 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-08 21:26:26 +00:00
Andrew Nacin f225973b62 Allow $crop in add_image_size() to receive crop anchors (top, left, right, bottom, center).
This also applies to set_post_thumbnail_size() and image_resize_dimensions().

props bradt, wonderboymusic, DH-Shredder.
fixes #19393.


git-svn-id: https://develop.svn.wordpress.org/trunk@27472 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-08 06:13:27 +00:00
Scott Taylor 613b28cc81 Remove a cache-busting hack from `Tests_Term_getTerms::test_get_terms_exclude_tree()`. It is no longer necessary after #14485 and #25711.
See [27300].
Props SergeyBiryukov.
Fixes #27313.



git-svn-id: https://develop.svn.wordpress.org/trunk@27459 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-07 19:35:55 +00:00
Scott Taylor 3010c5aa20 In `get_terms()`, leverage `get_term_children()` over `_get_term_children()` when making sure to show empty terms that have children in a hierarchical taxonomy while avoiding duplicates.
Adds unit test for `child_of` param. Adjusts unit tests for `get_terms()`.

See [27108] and [27125].
Props SergeyBiryukov.
Fixes #27123.



git-svn-id: https://develop.svn.wordpress.org/trunk@27458 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-07 19:29:01 +00:00
Scott Taylor dfc11a170b On second thought, allow `posts_per_rss` to be set in `pre_get_posts` to override the `posts_per_rss` option. There are backwards compatibility concerns otherwise.
Props nacin.
Partially reverts [27455]. Updates the unit test. See #25380.



git-svn-id: https://develop.svn.wordpress.org/trunk@27456 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-07 18:58:33 +00:00
Scott Taylor 65932f71fd When setting `posts_per_page` in `WP_Query::get_posts()`, check for `is_feed()` in the same place where `posts_per_page` is set when it is not already set. Previously, when `is_feed()` was true, `posts_per_page` would be arbitrarily overwritten. This fix allows `posts_per_page` to be set during `pre_get_posts` when `is_feed()` is true and not be overwritten.
Adds unit test.

Props wokamoto.
Fixes #25380.



git-svn-id: https://develop.svn.wordpress.org/trunk@27455 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-07 18:32:40 +00:00
Andrew Nacin a14b999605 Always convert auto-drafts to drafts in edit_draft() and _wp_translate_postdata().
This regressed due to refactoring in [26995]. This commit fixes Quick Draft.

see #25272.


git-svn-id: https://develop.svn.wordpress.org/trunk@27405 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-05 06:25:31 +00:00
Andrew Nacin ed43f002b8 Add has_password and post_password query variables to WP_Query.
* has_password true means posts with passwords, false means posts without.
 * post_password can query for posts with a particular password.

props wonderboymusic, robmiller.
fixes #20308.


git-svn-id: https://develop.svn.wordpress.org/trunk@27395 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-04 07:44:28 +00:00
Andrew Nacin 5edec1d792 Don't default to current user for capability checks when dealing with a post without an author (post_author = 0).
Undoes [12053]. While it risks breakage, this is a far safer and saner default for these situations.

props danielbachhuber.
fixes #27020.


git-svn-id: https://develop.svn.wordpress.org/trunk@27390 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-04 03:08:54 +00:00
Andrew Ozz e5bed6707f TinyMCE: update to 4.0.18, see #24067
git-svn-id: https://develop.svn.wordpress.org/trunk@27387 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-04 01:56:57 +00:00
Andrew Nacin eef62a9d0d Update PHPMailer to 5.2.7 from 5.2.4.
Includes two trivial modifications for WordPress:
 * Doesn't use the autoloader, so the check to enforce the autoloader from the constructor is removed.
 * Requires class-smtp.php for backwards compatibility with direct (non-wp_mail()) uses of PHPMailer, as the autoloader isn't used.

props bpetty.
fixes #25560.


git-svn-id: https://develop.svn.wordpress.org/trunk@27385 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-03 20:24:31 +00:00
Andrew Nacin 260b7f08ca Let get_the_date() accept a post object.
props tanner-m, adamsilverstein, bigdawggi.
fixes #13771.


git-svn-id: https://develop.svn.wordpress.org/trunk@27380 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-03 17:59:11 +00:00
Mark Jaquith 7937358328 Eliminate some of our last remaining `create_function()` instances
* Moved some into private function callbacks
* Eliminated some that weren't necessary anymore

props obenland, markjaquith, nacin. fixes #14424

git-svn-id: https://develop.svn.wordpress.org/trunk@27373 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-03 16:20:12 +00:00
Sergey Biryukov 7f3c71eff3 Add missing word. props bassgang. fixes #27259.
git-svn-id: https://develop.svn.wordpress.org/trunk@27371 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-03 09:46:36 +00:00
Andrew Nacin 6869d203d0 Introduce get_site_by_path() and further rewrite the site detection process for multisite.
This is the first big step to supporting arbitrary domains and paths. In this new approach, sites are detected first where possible, then the network is inferred. Allows filtering for arbitrary path segments, smooths out some weirdness, and removes various restrictions. A sunrise plugin could do much of its work by adding filters, if those are even needed.

see #27003.


git-svn-id: https://develop.svn.wordpress.org/trunk@27359 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-02 22:24:50 +00:00
Sergey Biryukov 3038bdc80f Restore $content_width global value after changing it in test_constrain_size_for_editor_*().
props ericlewis, georgestephanis, salcode, jorbin.
fixes #27256.

git-svn-id: https://develop.svn.wordpress.org/trunk@27358 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-02 22:22:41 +00:00
Sergey Biryukov f213decc7e Skip import tests if WordPress Importer plugin is missing.
props mattheu.
fixes #27250.

git-svn-id: https://develop.svn.wordpress.org/trunk@27349 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-02 10:34:58 +00:00
Andrew Nacin 8a617607a7 Strip backslashes, not just forward slashes, from untrailingslashit().
trailingslashit() will now remove any forward or backslashes from the end of a string before appending a forward slash.

props knutsp, willmot.
fixes #22267.


git-svn-id: https://develop.svn.wordpress.org/trunk@27344 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-01 21:44:43 +00:00
Andrew Nacin 88f1b6e7ec Add a $default argument to get_query_var() and WP_Query::get(). fixes #16471.
git-svn-id: https://develop.svn.wordpress.org/trunk@27304 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-26 23:57:10 +00:00
Andrew Nacin 68c8b9cf0f Introduce doing_filter() and doing_action() to identify hooks in progress.
did_action() returns true the moment a hook is initially run, leaving you no way to tell if the hook is still in progress. Hooks can be nested and this checks the entire stack, versus current_filter() which only identifies the final hook in the stack. This commit also introduces current_action() for parity.

To tell if a hook has completed, one can use did_action() and ! doing_action() together.

The functions do not require an argument. In that situation, they indicate whether the stack is empty.

props ericmann for the initial unit tests.
fixes #14994.


git-svn-id: https://develop.svn.wordpress.org/trunk@27294 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-26 18:43:59 +00:00
Mark Jaquith 1d91296b3b Return 404 when querying author's posts who is not a member and has no posts on the site
fixes #20601. props yoavf, nacin, SergeyBiryukov, wonderboymusic, markjaquith.

git-svn-id: https://develop.svn.wordpress.org/trunk@27290 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-26 18:11:36 +00:00
Andrew Nacin 1d8d862e97 Make get_adjacent_post() wrap a new WP_Get_Adjacent_Post object that uses WP_Query.
git-svn-id: https://develop.svn.wordpress.org/trunk@27285 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-26 17:09:54 +00:00
Andrew Nacin a407ae2363 Allow user_id to be an array of IDs in WP_Comment_Query.
props mordauk.
fixes #27064.


git-svn-id: https://develop.svn.wordpress.org/trunk@27258 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-25 16:34:25 +00:00
Andrew Nacin f8af178264 Use ext/mysqli in PHP 5.5 or greater. Expect minor explosions.
props aaroncampbell, pento.
see #21663.


git-svn-id: https://develop.svn.wordpress.org/trunk@27250 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-25 00:39:28 +00:00
Andrew Nacin b74f222d33 Remove theme support for 'menus' in unregister_nav_menu() when there are no more menus.
props kovshenin.
fixes #26900.


git-svn-id: https://develop.svn.wordpress.org/trunk@27220 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-21 18:13:52 +00:00
Sergey Biryukov 1cda3b44cf Add @ticket references. see #26903.
git-svn-id: https://develop.svn.wordpress.org/trunk@27197 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-20 02:20:40 +00:00
Scott Taylor c2efafbddb Add some more assertions to `Tests_Query_Conditionals`, specifically for `is_single()`, `is_page()`, and `is_attachment()`.
See [27016].
Fixes #24257.



git-svn-id: https://develop.svn.wordpress.org/trunk@27187 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-17 22:10:57 +00:00
Scott Taylor 7bdca44b97 Make `WP_User_Query::prepare_query()` public by allowing it to be passed an array of args. Previously, if the `WP_User_Query` constructor was not passed args, the object was basically unusable. Adds unit tests, all other tests pass.
Props scribu, for the initial patch.
Fixes #21119.



git-svn-id: https://develop.svn.wordpress.org/trunk@27185 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-17 21:40:04 +00:00
Scott Taylor a31a167359 Reset `$wp_query` and `$post` during `WP_UnitTestCase::tearDown()` to avoid spillage of globals between tests.
See #26321.



git-svn-id: https://develop.svn.wordpress.org/trunk@27183 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-17 21:03:43 +00:00
Andrew Ozz 920a9799cf TinyMCE tests: remove 'coverage' for now, has unsatisfied dependencies. Tweak the test runner so it auto-starts. See #27014.
git-svn-id: https://develop.svn.wordpress.org/trunk@27180 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-15 21:25:15 +00:00
Andrew Nacin 31d3af406c Multisite: Add get_network_by_path() and wp_get_network() to begin cleanup of multisite load.
Tries to get network detection under control by simplifying wpmu_current_site(). It now also pops off each subdomain to find a more general match. Adds unit tests for get_network_by_path() and a new network factory for unit tests.

Much of this is likely to change in 3.9 as more of ms-load.php and ms-settings.php gets hacked to bits.

props jeremyfelt.
see #27003.


git-svn-id: https://develop.svn.wordpress.org/trunk@27178 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-13 23:06:12 +00:00
Andrew Nacin 36fe6c1c27 Don't use HTTPS in unit tests if OpenSSL isn't loaded.
props bpetty.
fixes #27114.


git-svn-id: https://develop.svn.wordpress.org/trunk@27168 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-12 20:39:21 +00:00
Scott Taylor fd8d6cddcd Don't iterate over `$wp_query->posts` in `update_post_thumbnail_cache()` if it is empty. Adds unit tests.
Props SergeyBiryukov, for the original patch.
Fixes #26321.
 


git-svn-id: https://develop.svn.wordpress.org/trunk@27166 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-12 04:48:14 +00:00
Scott Taylor 2e9d155703 Partially revert [27101], [27102], [27141], and [27142]. Those commits introduced new functions to sync up cache invalidation events. The current commit alters existing internals.
"The cache invalidation with static was introduced in r9102 with version 2.7. Multisite wasn't in core back then, so something like switch_to_blog() wasn't a concern, but now it breaks if you switch the blog in between calls to clean_term_cache."

This solution is simpler. All unit tests pass. Removes unnecessary tests linked to removed functions.

Props kovshenin.
Fixes #14485, #22526.



git-svn-id: https://develop.svn.wordpress.org/trunk@27163 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-11 16:49:11 +00:00
Andrew Ozz ce2dcccf86 Incorporate the TinyMCE tests into our JS tests:
- Modified the original tests so TinyMCE can be loaded from /src/wp-includes/js/tinymce.
- Added "WP" option to the UI to select only tests relevant to our integration (excludes most of the default plugins tests).
- Added tests for obsolete HTML elements and attributes (html4 back-compat).
See #27014.

git-svn-id: https://develop.svn.wordpress.org/trunk@27155 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-10 01:11:25 +00:00
Dominik Schilling (ocean90) 586cb2b140 Nav Menu: Remove post/page items from the Nav Menu when the post/page is deleted.
This was broken through a change in [25163]. `_menu_item_object` in wp_get_associated_nav_menu_items() is not relevant for post types.
Adds unit tests.

props UmeshSingla for initial patch.
fixes #26795.

git-svn-id: https://develop.svn.wordpress.org/trunk@27150 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-09 21:36:15 +00:00
Scott Taylor e966a23683 Reuse the `terms` cache group for taxonomy cache invalidation.
See #22526, #14485, [27101], [27102].



git-svn-id: https://develop.svn.wordpress.org/trunk@27142 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-09 17:41:07 +00:00
Andrew Nacin 522670cef2 Various JSHint fixes. see #26446.
git-svn-id: https://develop.svn.wordpress.org/trunk@27131 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-08 00:51:14 +00:00
Andrew Nacin baeadcfedc Add remove_image_size() and tests for it and has_image_size(), added in [27128].
props mordauk, markoheijnen.
fixes #26768. see #26951.


git-svn-id: https://develop.svn.wordpress.org/trunk@27129 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-08 00:40:15 +00:00
Scott Taylor 81679ef453 When a `term_id` matches in `_get_term_children()`, recurse through its children until there is no more depth in the hierarchy. Since `get_terms()` return terms with a `count` of `0` when their children are not empty, we must return all children so that `get_terms()` can check their count.
In [27108], #26903 was fixed, but only because we were using the example in the ticket, leaving out infinite depth for hierarchical taxonomies.

Adds unit tests, including `Tests_Term_getTerms::test_get_terms_seven_levels_deep()`.

Fixes #26903. Again.



git-svn-id: https://develop.svn.wordpress.org/trunk@27125 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-07 19:53:01 +00:00
Scott Taylor 8dad11bfe2 In `get_terms()`, don't set automatically `hierarchical` to `false` when `parent => 0` is passed. The default value for `parent` is `''`.
In `_get_term_children()`, don't skip a top-level term without first including its children in the returned term list. Ironically, the call to `_get_term_children()` in `get_terms()` has a comment stating `"Make sure we show empty categories that have children."`, but it didn't work if you were retrieving top-level categories only.

All unit tests pass. Added a unit test based on the use case described in this ticket.

Fixes #26903.



git-svn-id: https://develop.svn.wordpress.org/trunk@27108 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-06 17:44:50 +00:00
Scott Taylor 2127c9322d Move some cache related tests to the new `term/cache.php` from [27103].
git-svn-id: https://develop.svn.wordpress.org/trunk@27104 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-06 05:19:05 +00:00
Scott Taylor 324b2799b3 Add the unit test from #25711. The patch was unnecessary due to [27102], but the test is useful.
Props dd32.
See #25711.



git-svn-id: https://develop.svn.wordpress.org/trunk@27103 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-06 03:39:22 +00:00
Scott Taylor 50a96f165e Regenerate the term hierarchy cache (`{taxonomy}_children`) when it is out of sync with the passed taxonomy's `last_changed` value.
Introduces `taxonomy_hierarchy_is_fresh()`, which is only called in `_get_term_hierarchy()`. The taxonomy's `last_changed` value is checked against the value of `wp_cache_get( 'hierarchy_last_changed', $taxonomy )`.

Adds a unit test - `Tests_Term:test_hierachy_invalidation()`.

See [27101], which makes this type of cache invalidation possible.
Fixes #14485.



git-svn-id: https://develop.svn.wordpress.org/trunk@27102 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-06 01:58:01 +00:00
Scott Taylor e33ef0c6ac Add cache invalidation when updating a term, example: create a category, assign it to a post, edit the category. Currently, the post's term cache is not updated. When updating terms in a given taxonomy, invalidate the object term caches linked to that taxonomy.
Introduce `get_taxonomy_last_changed()`, `set_taxonomy_last_changed()`, and `post_taxonomy_is_fresh()`.

`post_taxonomy_is_fresh()` is only called in `get_object_term_cache()` - at which point the taxonomy's `last_changed` value is checked against the post's `{$taxonomy}_last_changed` value.

`set_taxonomy_last_changed()` is called whenever directory database queries are made that insert new terms or affect existing terms.

Fixes #22526.



git-svn-id: https://develop.svn.wordpress.org/trunk@27101 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-06 01:40:05 +00:00
Scott Taylor 9b85472ac9 The unit test for the video shortcode needs to mimic the default params for width and post ID.
See #26628.



git-svn-id: https://develop.svn.wordpress.org/trunk@27100 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-05 05:16:22 +00:00
Scott Taylor 22fef7cf4b Add a unit test demonstrating the failure to invalidate a post's term cache when the term is updated.
See #22526.



git-svn-id: https://develop.svn.wordpress.org/trunk@27099 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-05 03:49:48 +00:00
wonderboymusic 71947f18d3 When a video shortcode has content in its body, append it as inner HTML in the resulting `<video>`.
Reverts [27096].
Fixes #26628.
See #27016.



git-svn-id: https://develop.svn.wordpress.org/trunk@27097 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-05 01:42:02 +00:00
Scott Taylor 3ccf9e9d29 The video shortcode unit test shouldn't be expected to maintain HTML comments.
See #26864.



git-svn-id: https://develop.svn.wordpress.org/trunk@27096 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-05 01:24:58 +00:00
Andrew Ozz 6a0251847b Consolidate handling of <object>, <audio> and <video> in wpautop() and add unit tests for them. Part props wonderboymusic, see #26864
git-svn-id: https://develop.svn.wordpress.org/trunk@27094 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-05 00:45:53 +00:00