Commit Graph

735 Commits

Author SHA1 Message Date
Boone Gorges 1eee61f31a Do not run certain cache-hit tests on multisite.
These tests fail on multisite if run after a test that creates
`wpmu_create_blog()`, because `wpmu_create_blog()` defines `WP_INSTALLING`,
which results in unexpected cache misses. See [28965] for a similar fix.

git-svn-id: https://develop.svn.wordpress.org/trunk@31280 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-25 12:59:00 +00:00
Andrew Nacin 4857c6996c Allow $autoload in add_option() to receive false.
props dllh.
fixes #31119.


git-svn-id: https://develop.svn.wordpress.org/trunk@31278 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-25 07:50:31 +00:00
Boone Gorges 4e3e98698f In `Tests_Ajax_ReplytoComment::test_blocked_comment()`, don't stop blocking comments until test is complete.
The test uses the `_block_comments()` method to prevent comment inserts from
happening. Since [31263], failed comment inserts lead to the comment content's
being stripped of invalid characters and inserted again. By immediately
unhooking itself after first being run, `_block_comments()` was causing the
INSERT block to work only for the first attempt, while the second attempt was
going through, causing the test to fail. As a fix, we move the
`remove_filter()` call to the class's `tearDown()` method - sufficient for
cleanup, but late enough that *all* comment inserts will be blocked for the
test method in question.

See #21212.
Since [31263], comment INSERT queries that were pseudo-bl

git-svn-id: https://develop.svn.wordpress.org/trunk@31277 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-25 03:38:10 +00:00
Boone Gorges 5bcee9e939 In `get_terms()`, check hierarchy for all `$taxonomies` before bailing early from 'parent' or 'child_of'.
There is a pre-check in `get_terms()` that prevents an unnecessary database
query if the 'parent' or 'child_of' parameter is not found in the cached term
hierarchy (since a term without an index in the hierarchy cache has no
descendants). Previously, only the first item in the `$taxonomies` array was
being checked, with the result that an empty array was being erroneously
returned in cases where the 'parent' or 'child_of' term is in a subsequent
taxonomy.

See #31118.

git-svn-id: https://develop.svn.wordpress.org/trunk@31276 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-25 02:45:11 +00:00
Boone Gorges c67e5da8c9 Introduce 'childless' parameter to `get_terms()`.
This new parameter allows developers to limit queried terms to terminal nodes -
ie, those without any descendants.

As part of the improvement, some internal logic in `get_terms()` has been
consolidated. Parameters that resolve to a NOT IN clause containing term IDs
('exclude', 'exclude_tree', and 'childless') are now parsed into a single
"exclusions" array before the SQL clause is generated.

Props theMikeD, horike.
Fixes #29839.

git-svn-id: https://develop.svn.wordpress.org/trunk@31275 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-24 18:47:30 +00:00
Boone Gorges 8ec0792557 Add classes for custom taxonomy terms in `get_post_class()`.
Props sillybean.
Fixes #16223.

git-svn-id: https://develop.svn.wordpress.org/trunk@31271 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-23 15:40:31 +00:00
Boone Gorges 10d3b42211 Introduce 'parent' parameter to `wp_get_object_terms()`.
Props mikeschinkel.
Fixes #15675.

git-svn-id: https://develop.svn.wordpress.org/trunk@31270 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-23 14:56:04 +00:00
Boone Gorges be28a2c9c5 A few more wordpress.com https assets in unit tests.
See #31091.

git-svn-id: https://develop.svn.wordpress.org/trunk@31259 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-21 18:57:17 +00:00
Boone Gorges cabab6c140 Use https URLs for wordpress.com assets in `Tests_HTTP_Functions`.
The http->https redirects were breaking some of the tests.

Fixes #31091.

git-svn-id: https://develop.svn.wordpress.org/trunk@31258 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-21 18:43:03 +00:00
Boone Gorges ab551d8dac Move GD-specific resize test to GD-specific resize test file.
This makes it so that we don't have to mark the test as skipped when running
through Imagick tests.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@31257 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-21 18:27:44 +00:00
Boone Gorges 4dd59fd9ce Remove skipped unit tests related to proposed `map_deep()`.
The tests have been added as a patch to #22300.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@31256 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-21 17:57:15 +00:00
Boone Gorges 5fdc8a8364 Remove `WP_Post_IDs_Iterator` tests.
The tests have been moved to a patch on the ticket where the class has been
proposed, #22435.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@31254 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-20 21:59:24 +00:00
Boone Gorges 70eee8514b Remove skipped tests related to the proposed Export API.
These tests have been added as a patch to #22435.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@31253 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-20 20:57:08 +00:00
Boone Gorges f1771073dc `WP_Date_Query` date validation should not fail for hour = 0.
Props ChriCo, tyxla.
Fixes #31067 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@31251 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-20 19:12:48 +00:00
Gary Pendergast 3a87ef36e2 Texturize: Add "em" as a cockney term, so that "'em" is texturized with an apostrophe, instead of an open quote.
Fixes #29813.

Props miqrogroove.



git-svn-id: https://develop.svn.wordpress.org/trunk@31249 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-20 18:43:30 +00:00
Boone Gorges d80ca82693 Better loop detection for `_pad_term_counts()`.
The `$ancestors` check must be reset for each term in order for term counts
to be correct.

Fixes #20635.

git-svn-id: https://develop.svn.wordpress.org/trunk@31248 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-19 16:51:44 +00:00
Sergey Biryukov a036114a4d attachment_url_to_postid() should always return an integer.
props nathan_dawson, ashfame.
fixes #31044.

git-svn-id: https://develop.svn.wordpress.org/trunk@31239 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-18 20:32:50 +00:00
Boone Gorges 9501fb3213 Additional 'orderby' values for `wp_get_object_terms()`.
Adds support for ordering by 'taxonomy', 'term_taxonomy_id', and 'parent'.

Props ChriCo.
Fixes #28688.

git-svn-id: https://develop.svn.wordpress.org/trunk@31236 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-18 18:56:38 +00:00
Boone Gorges 68283f5fb3 Add unit tests for 'orderby' and 'order' param of `wp_get_object_terms()`.
git-svn-id: https://develop.svn.wordpress.org/trunk@31233 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-17 20:38:25 +00:00
Boone Gorges 108e85314b Move `wp_get_object_terms()` tests into their own file.
See #26999.

git-svn-id: https://develop.svn.wordpress.org/trunk@31230 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-17 20:08:04 +00:00
Andrew Ozz f18854e866 Add support for IE conditional comments for WP_Scripts to match the functionality of WP_Styles, including unit tests. Props filosofo, aaroncampbell, ethitter, georgestephanis, valendesigns. Fixes #16024.
git-svn-id: https://develop.svn.wordpress.org/trunk@31223 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-17 01:36:55 +00:00
Boone Gorges 60f2983b2e Bail out of hierarchy loops in `_get_term_children()`.
This prevents infinite loops that lead to PHP nesting limit fatal errors.

Props boonebgorges, sgrant.
Fixes #24461.

git-svn-id: https://develop.svn.wordpress.org/trunk@31207 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-16 17:09:11 +00:00
Boone Gorges 8ae64f6384 Bail out of hierarchy loops in `_pad_term_counts()`.
Taxonomy hierarchy loops should not occur naturally, but when they do, the
logic of `_pad_term_counts()` could result in infinite loops, leading to
timeouts. We avoid this by breaking when a loop is detected.

Fixes #20635.

git-svn-id: https://develop.svn.wordpress.org/trunk@31206 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-16 16:45:21 +00:00
Boone Gorges af146fef8c In `paginate_links()`, don't override custom format arguments when setting up default 'add_args'.
Since 4.1 [29780], the default value of the 'add_args' argument in
`paginate_links()` has been determined by parsing the current URL. This change
had the side effect of overriding custom values of 'format' that changed the
pagination query var, with the result that plugins using `paginate_links()`
with a custom format generated the incorrect links unless explicitly
declaring 'add_args=false' to prevent the default values from overriding. We
fix this behavior by parsing URL query vars into the 'add_args' array only
after the explicit function params have been parsed, and by skipping the
current page's pagination query var when doing this parsing (to avoid the
override).

Props obenland.
Fixes #30831 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@31203 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-16 15:48:24 +00:00
Gary Pendergast c8c8b66bae When a hyphen `-` or double hyphen `--` was at the start or the end of a string, it wasn't texturized correctly.
Fixes #31030



git-svn-id: https://develop.svn.wordpress.org/trunk@31199 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-16 03:54:00 +00:00
Gary Pendergast 58d931dfc7 Allow `comment_post_ID` to be passed to `wp_update_comment()`, so that a comment can be moved to a different post.
Props tyxla, rachelbaker

Fixes #30946



git-svn-id: https://develop.svn.wordpress.org/trunk@31195 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-16 02:38:30 +00:00
Scott Taylor acbf60c9a6 After [31186], remove `figcaption` from the list of inline elements that are autop'd in `Tests_Formatting_Autop::test_that_wpautop_treats_inline_elements_as_inline()`.
See #29219.


git-svn-id: https://develop.svn.wordpress.org/trunk@31191 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-16 01:50:47 +00:00
Scott Taylor bcc7f9e093 In `WP_User`, `->get_role_caps()` and `->update_user_level_from_caps()` must be called inside `->add_cap()` and `->remove_cap()` after updating user meta. `->has_cap()` checks are currently failing directly after calling `->add_cap()`.
Adds unit test.

Props rachelbaker.
Fixes #28374.


git-svn-id: https://develop.svn.wordpress.org/trunk@31190 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-16 01:48:36 +00:00
Boone Gorges 4b6957c852 Support array values in `WP_Date_Query::validate_date_values()`.
Introduced in [29925], `validate_date_values()` throws `_doing_it_wrong()`
notices when values passed as part of a `WP_Date_Query` do not reflect actual
dates. However, the validation did not account properly for the case where an
array of multiple values is passed, as when doing IN or BETWEEN queries.

Props dlh.
Fixes #31001 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@31179 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-14 16:50:09 +00:00
Sergey Biryukov 819a53be46 Add 'user_id' to the list of fields wp_update_comment() can update.
props jphase.
fixes #30307.

git-svn-id: https://develop.svn.wordpress.org/trunk@31172 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-13 06:47:33 +00:00
Sergey Biryukov a744bb9a5f Add 'comment_type' to the list of fields wp_update_comment() can update.
props desaiuditd.
fixes #30627.

git-svn-id: https://develop.svn.wordpress.org/trunk@31171 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-13 06:41:19 +00:00
Jeremy Felt 0eb9f7e414 Use a less complex approach for enforcing path slashes in `update_blog_details()`
Ensure leading and traling slashes are in place and don't touch anything in the middle. Validating with `array_filter()` would have missed a possible valid falsy path - `/my-path/0/`.

Props nacin.

Fixes #18117.


git-svn-id: https://develop.svn.wordpress.org/trunk@31158 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-12 04:20:47 +00:00
Jeremy Felt d759c0ef23 Check for existence of data from `get_blogaddress_by_id()` before returning a URL
* Prevent a notice when an invalid ID is used with `get_blogaddres_by_id()`.
* Return a falsy empty string rather than the previous "http://".
* Add unit tests for `get_blogaddress_by_id()`.

Props nerrad.

Fixes #30566.


git-svn-id: https://develop.svn.wordpress.org/trunk@31157 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-12 02:23:43 +00:00
Jeremy Felt f9e9287875 Enforce leading and trailing slashes on paths updated with `update_blog_details()`
In multisite, core expects the stored value for a site's path to have leading and trailing slashes. When these slashes are missing, it becomes impossible to visit the site.

This enforces proper `/path/` creation in `update_blog_details()`, most likely used when updating an existing site through `site-info.php`.

Props earnjam, simonwheatley.

Fixes #18117. Fixes #23865.


git-svn-id: https://develop.svn.wordpress.org/trunk@31155 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-12 01:42:46 +00:00
Gary Pendergast 69f8b26d89 In `get_avatar_data()`, there's no need to return `false` if we couldn't find an avatar, as Gravatar can handle being given an empty email hash. This allows the default avatar to show when no email address is given.
See #21195



git-svn-id: https://develop.svn.wordpress.org/trunk@31153 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-12 00:19:34 +00:00
Gary Pendergast d0fab598e7 In `get_avatar()`, revert the `<img>` tag attributes to using single quotes, instead of double quotes. This behaviour was changed in [31107], but caused problems for code that attempted to parse the `<img>` tag.
See #21195



git-svn-id: https://develop.svn.wordpress.org/trunk@31152 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-12 00:02:31 +00:00
Boone Gorges 77128eb048 Default `$parent` in `category_exists()` should default to null rather than 0.
[29863] made the corresponding change in `term_exists()`. Failure to change the
default value in `category_exists()` meant that an unspecified value for
`$parent` would limit results to top-level categories.

Includes unit tests and corrected function documentation.

Props hissy.
Fixes #30975 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@31140 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-11 01:25:19 +00:00
Boone Gorges d5c9eb41d7 In `get_permalink()`, don't resolve to pretty permalink if post has 'future' status.
We already do this for other non-public statuses, to prevent leaking non-public
information about unpublished posts.

Props e.mazovetskiy, CalEvans.
Fixes #30910.

git-svn-id: https://develop.svn.wordpress.org/trunk@31114 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-09 16:39:56 +00:00
Gary Pendergast dec1cba410 Add `get_avatar_url()`, for retrieving just the URL of an avatar, rather than the entire `<img>` tag that `get_avatar()` produces.
Unlike `get_avatar()`, `get_avatar_url()` is not pluggable. It can be extended/or modified through the new filters included.

Fixes #21195.

Props mdawaffe, pento, pathawks, DrewAPicture



git-svn-id: https://develop.svn.wordpress.org/trunk@31107 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-09 04:42:48 +00:00
Sergey Biryukov 907be55276 Pass post type to count_user_posts() in get_the_author_posts().
props Caspie, tyxla.
fixes #30904.

git-svn-id: https://develop.svn.wordpress.org/trunk@31098 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-08 19:52:52 +00:00
Sergey Biryukov d5b99d560e Use home_url() instead of hardcoded domain in Tests_Link_GetAdjacentPostLink.
props CalEvans.
fixes #30955.

git-svn-id: https://develop.svn.wordpress.org/trunk@31097 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-08 18:44:18 +00:00
Sergey Biryukov 4fdc7c7a0b Don't force newlines around URLs in WP_Embed::autoembed().
props chipx86, sgrant.
fixes #23776.

git-svn-id: https://develop.svn.wordpress.org/trunk@31066 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-07 07:50:58 +00:00
Sergey Biryukov 2fcd588983 Fix typo in a comment in slashing tests.
git-svn-id: https://develop.svn.wordpress.org/trunk@31065 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-07 07:08:47 +00:00
Gary Pendergast eb4d356e29 `size_format()` incorrectly included a trailing space for `B` values: less than 1024 bytes.
Also add a unit test to check for this, so we don't do it again.

Fixes #30908.

Props tillkruess.
 


git-svn-id: https://develop.svn.wordpress.org/trunk@31052 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-05 13:12:06 +00:00
Boone Gorges 969808e7bb Add tests for the 'post_status' behavior of `WP_Query`.
See #29167.

git-svn-id: https://develop.svn.wordpress.org/trunk@31047 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-04 20:35:12 +00:00
Boone Gorges 04eef529b0 Remove non-built-in post statuses during each unit test teardown.
See #29167.

git-svn-id: https://develop.svn.wordpress.org/trunk@31046 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-04 20:05:53 +00:00
Scott Taylor 3d3e1fb72a Preserve alpha transparency when rotating a PNG while GD is the active image editor.
Adds unit tests.

Props frankpw, voldemortensen.
Fixes #30596.


git-svn-id: https://develop.svn.wordpress.org/trunk@31040 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-03 22:01:54 +00:00
Scott Taylor d699ce8b13 Ensure that inline styles attached to conditional stylesheets are also conditional.
Adds unit test.

Props georgestephanis.
Fixes #29180.


git-svn-id: https://develop.svn.wordpress.org/trunk@31031 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-03 04:09:12 +00:00
Boone Gorges 3da394f499 Add tests for `wp_list_categories()` CSS class generation.
See #16497.

git-svn-id: https://develop.svn.wordpress.org/trunk@31026 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-03 02:22:54 +00:00
Boone Gorges fd8b7faff6 In `Walker_Category`, don't generate list elements for empty cat names.
This change allows the 'list_cats' filter to be used to suppress certain
items in category lists, without creating invalid or superfluous markup.

Props samo9789.
Fixes #16792.

git-svn-id: https://develop.svn.wordpress.org/trunk@31025 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-03 02:04:17 +00:00