Commit Graph

31626 Commits

Author SHA1 Message Date
Scott Taylor
a9e30d8e94 XML-RPC: Introduce the concept of unit testing to wp_xmlrpc_server::wp_newComment():
* Don't allow comments to be created for posts that have `comment_status` set to `'closed'`
* Set some magic props on `WP_User` to vars before passing them to `wp_xmlrpc_server::escape()`

Props wonderboymusic, jesin.
Fixes #27471.


git-svn-id: https://develop.svn.wordpress.org/trunk@34559 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 20:19:19 +00:00
Aaron Jorbin
8bf8320afd Fix tabs vs spaces in .travis.yml
Introduced in [34555] . Bad Jorbin.



git-svn-id: https://develop.svn.wordpress.org/trunk@34558 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 20:12:09 +00:00
Weston Ruter
6db8b9279e Customizer: Fix usage of jQuery.contains() allowing active state changes to again animate control visibility.
Aligns usage of `jQuery.contains()` in a control's `onChangeActive` method with the existing usage in the corresponding `onChangeActive` method for panels and sections.

Props nikeo.
Fixes #33509.


git-svn-id: https://develop.svn.wordpress.org/trunk@34557 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 19:54:00 +00:00
Helen Hou-Sandi
9490539e89 Shortlinks: Hide the Get Shortlink button by default.
Shortlinks had their day in the popular usage sun before all these services moved to their own shorteners and running your own custom one became a lot easier. Shortlinks are still useful in some contexts, such as analytics or when links need to be shared verbally or copied down by hand.

If any filters are hooked onto `pre_get_shortlink` or `get_shortlink` and produce a non-empty value (with an exception described below), the button will magically reappear. This allows any custom shortlinks to keep the button without hiccups.

If you're in need of the default shortlinks, the fastest way to reenable them is `add_filter( 'pre_get_shortlink', '__return_false' )`. Note that it must return false in order to continue on to the rest of `wp_get_shortlink()`.

props grvrulz for the initial patch.
fixes #33495.


git-svn-id: https://develop.svn.wordpress.org/trunk@34556 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 19:53:28 +00:00
Aaron Jorbin
7576089c46 Add Travis Notifications to the #core channel on Slack
This is hopefully the final attempt at adding notifications to the #core channel on Slack. By default, Travis spams the channel. In order to cut that down a bit, notifications are set as follows:
 - On Failure: Always (If the tests fail, the world needs to know)
 - On Success: Change (this means that the first green run after a red run aka, the world is happy again)
 - On Start: Never (Travis runs every time there is a commit. No need for a notification)

Props Netweb, samuelsidler
Fixes #30755



git-svn-id: https://develop.svn.wordpress.org/trunk@34555 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 19:42:53 +00:00
Weston Ruter
25c05ad6f2 Customizer: Flesh out phpdoc description for _wp_customize_include().
Also add brackets around single-statement inline `if` statement.

Fixes #33488.


git-svn-id: https://develop.svn.wordpress.org/trunk@34554 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 19:35:48 +00:00
Drew Jaynes
99e157bdd2 Docs: Add a missing summary, version, and tag descriptions to the DocBlock for WP_Widget_Text::widget().
See #32246.


git-svn-id: https://develop.svn.wordpress.org/trunk@34553 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 19:23:18 +00:00
Drew Jaynes
5a6a34fa95 Widgets: Pass $this to the widget_text filter to make targeting specific widget instances easier.
Also fixes docs errors in the type and description for the `$instance` parameter, introduced in [27697].

Fixes #24605.


git-svn-id: https://develop.svn.wordpress.org/trunk@34552 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 19:20:37 +00:00
John Blackbourn
a6a00a3625 Implement 'Recently Active' functionality for network-wide plugins in the Network Admin.
Fixes #20468
Thanks to WordCamp RI attendees for testing!


git-svn-id: https://develop.svn.wordpress.org/trunk@34551 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 19:15:08 +00:00
Boone Gorges
a6d1621736 Hierarchical comment query tests should be order-agnostic.
Travis-CI and other test environments can create weird race conditions.

See #8071.

git-svn-id: https://develop.svn.wordpress.org/trunk@34550 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 15:28:56 +00:00
Boone Gorges
465ff41d1b Remove debug cruft, introduced in [34546].
Props ocean90.
See #8071.

git-svn-id: https://develop.svn.wordpress.org/trunk@34549 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 15:25:19 +00:00
Boone Gorges
92da083c00 Normalize whitespace in WP_Comment_Query documentation.
git-svn-id: https://develop.svn.wordpress.org/trunk@34548 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 15:24:15 +00:00
Sergey Biryukov
3b9cb92c44 Plugin Editor: Don't split the strings with plugin file name and remove unnecessary context.
Partially reverts [34341].

Fixes #31862.

git-svn-id: https://develop.svn.wordpress.org/trunk@34547 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 15:18:58 +00:00
Boone Gorges
e1b44f5203 Introduce hierarchical query support to WP_Comment_Query.
Comments can be threaded. Now your query can be threaded too! Bonus: it's
not totally insane.

* The new `$hierarchical` parameter for `WP_Comment_Query` accepts three values:
  * `false` - Default value, and equivalent to current behavior. No descendants are fetched for matched comments.
  * `'flat'` - `WP_Comment_Query` will fetch the descendant tree for each comment matched by the query paramaters, and append them to the flat array of comments returned. Use this when you have a separate routine for constructing the tree - for example, when passing a list of comments to a `Walker` object.
  * `'threaded'` - `WP_Comment_Query` will fetch the descendant tree for each comment, and return it in a tree structure located in the `children` property of the `WP_Comment` objects.
* `WP_Comment` now has a few utility methods for fetching the descendant tree (`get_children()`), fetching a single direct descendant comment (`get_child()`), and adding anothing `WP_Comment` object as a direct descendant (`add_child()`). Note that `add_child()` only modifies the comment object - it does not touch the database.

Props boonebgorges, wonderboymusic.
See #8071.

git-svn-id: https://develop.svn.wordpress.org/trunk@34546 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 15:12:09 +00:00
Boone Gorges
27558ed678 Improve status checks when sending comment post author notification.
[34537] hooked `wp_new_comment_notify_postauthor()` to the
'wp_set_comment_status' when a comment had been approved. When performing
multiple actions on a comment in the same request (as happens in
`Tests_Ajax_DeleteComment::test_ajax_trash_double_action()`, and may happen
sometimes in real life too), and when one of those actions involves deleting
the comment, the `$comment_ID` passed to `wp_new_comment_notify_postauthor()`
can correspond to an already-deleted comment. The `comment_status` check should
account for this possibility.

See #14078.

git-svn-id: https://develop.svn.wordpress.org/trunk@34545 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 14:42:48 +00:00
Boone Gorges
8e955c4805 Improve pagination internals in WP_Comment_Query.
`WP_Comment_Query` will now report the total number of comments matching the
query params (`comments_found`), as well as the total number of pages required
to display these comments (`max_num_pages`). Because `SQL_CALC_FOUND_ROWS`
queries can introduce a lot of overhead in some cases, we disable the feature
by default. Pass `no_found_rows=false` to `WP_Comment_Query` to enable the
count. (We use the negative parameter name 'no_found_rows' for parity with
`WP_Query`.)

Props wonderboymusic, boonebgorges.
See #8071.

git-svn-id: https://develop.svn.wordpress.org/trunk@34544 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 14:34:20 +00:00
John Blackbourn
03515ca82d Introduce a send_update_notification_email which controls whether an update notification email is sent for background updates. This filter allows control over each of the update types (plugin, theme, translation) and compliments the automatic_updates_send_debug_email and send_core_update_notification_email filters.
Fixes #33932
Props ronalfy


git-svn-id: https://develop.svn.wordpress.org/trunk@34543 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 14:28:23 +00:00
Boone Gorges
a453e6aa6f Store SQL clauses in WP_Comment_Query property.
This small syntax change paves the way for some improvements related to #8071.

git-svn-id: https://develop.svn.wordpress.org/trunk@34542 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 14:08:50 +00:00
Scott Taylor
c8f167629d Revisions: add a 'wp_prepare_revision_for_js' filter.
Props jtsternberg, adamsilverstein.
Fixes #28627.


git-svn-id: https://develop.svn.wordpress.org/trunk@34541 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 14:03:30 +00:00
boonebgorges
4b83b005d2 Don't run get_page_of_comment() cache test on Multisite.
`get_page_of_comment()` uses `get_option()`, and WP_INSTALLING earlier in the
test suite causes `get_option()` to miss the cache. See #31130.

See #11334.

git-svn-id: https://develop.svn.wordpress.org/trunk@34540 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 13:54:02 +00:00
Scott Taylor
5e95cd1db5 Profile: when clicking "Generate Password", toggling visibility, then canceling, ensure that the UI resets properly for when the "Generate Password" button is clicked again.
Props umesh.nevase.
Fixes #33897.


git-svn-id: https://develop.svn.wordpress.org/trunk@34539 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 13:53:04 +00:00
Boone Gorges
a160be35b1 Bust term query cache when modifying term meta.
The 'last_changed' incrementor is used to invalidate the `get_terms()` query
cache. Since `get_terms()` queries may reference 'meta_query', changing term
metadata could change the results of the queries. So we invalidate the cache
on add, delete, and update.

See #10142.

git-svn-id: https://develop.svn.wordpress.org/trunk@34538 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 13:46:36 +00:00
Boone Gorges
3714a915a2 Send comment approval notification to post author via hook.
This is part of the project of #33587.

Moving this particular message to the
'wp_set_comment_status' action has the added bonus that the notification is
sent after the comment status has been updated in the database. Previously, a
database error could lead to a case where an approval notification is sent,
but the comment status change fails for some reason.

Props mrmist, NickDuncan.
Fixes #14078.

git-svn-id: https://develop.svn.wordpress.org/trunk@34537 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 05:36:32 +00:00
Boone Gorges
93d781343a Introduce 'duplicate_comment_id' filter.
`wp_allow_comment()` disallows a comment if it matches a comment on the same
post with the same content, author email, and parent. This new filter allows
developers to circumvent or modify this logic, making the duplicate check
more or less lenient, as they see fit.

Fixes #9775.

git-svn-id: https://develop.svn.wordpress.org/trunk@34536 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 05:22:53 +00:00
Boone Gorges
7e44a2fef7 Use WP_Comment_Query in get_page_of_comment().
This change allows `get_page_of_comment()` to use `WP_Comment_Query`'s native
caching mechanisms.

Props boonebgorges, Viper007Bond, wmertens, jeremyfelt.
Fixes #11334.

git-svn-id: https://develop.svn.wordpress.org/trunk@34535 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 05:10:40 +00:00
Boone Gorges
0c5bd75262 Pinking shears.
git-svn-id: https://develop.svn.wordpress.org/trunk@34534 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 04:43:57 +00:00
Boone Gorges
4da03f3cfc Allow metadata to be attached to comment at time of creation.
The new `$comment_meta` parameter of `wp_insert_comment()` allows an array of
key/value pairs to be passed when creating a comment. These pairs are then
stored as commentmeta when the comment has been created.

Props tellyworth, wonderboymusic.
Fixes #12431.

git-svn-id: https://develop.svn.wordpress.org/trunk@34533 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 04:40:30 +00:00
Boone Gorges
0dc1f270ec After [34529], fix multisite site creation test.
The test `Tests_Multisite_Site::test_created_site_details()` checks for tables
that should be empty on a newly created MS site. `termmeta` is now one of those
tables.

See #10142.

git-svn-id: https://develop.svn.wordpress.org/trunk@34532 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 04:31:52 +00:00
Boone Gorges
039955d5cd Introduce 'paged' parameter for WP_User_Query.
This is an alternative to using 'offset', and manually calculating pagination.
Note that 'paged' works only in conjunction with 'number', the latter of which
provides the per-page value.

Props sebastian.pisula.
Fixes #25145.

git-svn-id: https://develop.svn.wordpress.org/trunk@34531 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 04:25:20 +00:00
Boone Gorges
7757f84a69 After [34529], normalize documentation for get_terms() and wp_get_object_terms().
See #10142.

git-svn-id: https://develop.svn.wordpress.org/trunk@34530 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 04:04:06 +00:00
Boone Gorges
3425177325 Introduce metadata for taxonomy terms.
Adds a new table to the database schema (`wp_termmeta`), and a set of
`*_term_meta()` API functions. `get_terms()` and `wp_get_object_terms()`
now also support 'meta_query' parameters, with syntax identical to other
uses of `WP_Meta_Query`.

When fetching terms via `get_terms()` or `wp_get_object_terms()`, metadata for
matched terms is preloaded into the cache by default. Disable this behavior
by setting the new `$update_term_meta_cache` paramater to `false`.

To maximize performance, within `WP_Query` loops, the termmeta cache is *not*
primed by default. Instead, we use a lazy-loading technique: metadata for all
terms belonging to posts in the loop is loaded into the cache the first time
that `get_term_meta()` is called within the loop.

Props boonebgorges, sirzooro.
See #10142.

git-svn-id: https://develop.svn.wordpress.org/trunk@34529 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 03:58:59 +00:00
Scott Taylor
a98ca8b314 Links: in get_adjacent_post(), add a "get_{$adjacent}_post_excluded_terms" filter.
Props rmccue, Japh, MikeHansenMe.
Fixes #9571.


git-svn-id: https://develop.svn.wordpress.org/trunk@34528 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 02:37:29 +00:00
Scott Taylor
641150a87a Comments List Table: after [34179], scope the <th>s and <td>s as direct descendants of their parent row.
Fixes #33943.


git-svn-id: https://develop.svn.wordpress.org/trunk@34527 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 02:20:11 +00:00
John Blackbourn
53c3cd897a Update the oEmbed endpoint URL for Photobucket.
Fixes #33783


git-svn-id: https://develop.svn.wordpress.org/trunk@34526 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 22:02:16 +00:00
Scott Taylor
2300740fa2 Comments: In comment_form(), move the comment textarea to the top for logged-out users when replying, improves keyboard/focus navigation.
Rehabilitate errant tabbing and extra unnecessary `<?php ?>` toggling.

Props afercia, adamsilverstein.
Fixes #29974.


git-svn-id: https://develop.svn.wordpress.org/trunk@34525 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 21:59:39 +00:00
Scott Taylor
3e46dd8b92 Comments: In get_comment_statuses(), also return trash.
XML-RPC: In `wp_xmlrpc_server::wp_editComment()`, allow comments to be trashed.

Introduce unit tests for `wp_editComment` in `xmlrpc/*` #NeverForget

Props tyxla, wonderboymusic.
Fixes #30965.


git-svn-id: https://develop.svn.wordpress.org/trunk@34524 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 21:47:51 +00:00
Scott Taylor
15935e0aed Comments: in comment_form(), add args for cancel_reply_before and cancel_reply_after to eradicate remaining hard-coded HTML bits.
Props MikeHansenMe.
Fixes #23797.



git-svn-id: https://develop.svn.wordpress.org/trunk@34523 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 21:32:03 +00:00
Scott Taylor
9b55d4fecb Comments: in check_comment_flood_db(), don't throttle moderators. If the commenter is logged in, check against their user_id instead of comment_author_IP.
Throwback: "If you can edit comments on the post, 'Slow down Cowboy' shouldn't kick in."

Props garyc40, wonderboymusic.
Fixes #16219.


git-svn-id: https://develop.svn.wordpress.org/trunk@34522 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 21:21:16 +00:00
Dominik Schilling (ocean90)
d1fbe56dfc Plugins: Don't use _n() for singular/plural strings which have no placeholder for a number.
Fixes #33239.
See #28502.

git-svn-id: https://develop.svn.wordpress.org/trunk@34521 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 21:06:50 +00:00
Scott Taylor
55bb8b8c0b Comments: add a 'comment_excerpt_length' filter to get_comment_excerpt().
Create the first ever unit tests for `get_comment_excerpt()`.

Props dannydehaan, wonderboymusic.
Fixes #27526.


git-svn-id: https://develop.svn.wordpress.org/trunk@34520 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 21:04:16 +00:00
John Blackbourn
c5a336d664 Use WP_TESTS_DOMAIN where it should be used in tests in place of hard-coded uses of example.org.
Also corrects a test value in the data provider for `Tests_Sanitize_Option::test_sanitize_option()` which was only consequentially passing.

Fixes #34000


git-svn-id: https://develop.svn.wordpress.org/trunk@34519 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 21:01:10 +00:00
John Blackbourn
b415937e4a Another missed file from [34172].
See #33877


git-svn-id: https://develop.svn.wordpress.org/trunk@34518 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 20:32:49 +00:00
Scott Taylor
5b5b714694 Comments List Table JS: move the dynamic count functions into closure scope so that setCommentsList AND commentReply can access them. Update counts when replying inline.
Fixes #33403.


git-svn-id: https://develop.svn.wordpress.org/trunk@34517 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 20:15:54 +00:00
John Blackbourn
1e42aeb3c4 Add a @since entry for the implementation of the $public argument in register_taxonomy().
See #21949


git-svn-id: https://develop.svn.wordpress.org/trunk@34516 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 20:15:29 +00:00
Scott Taylor
e1d433a233 Edit Post: in the logic determining whether to display the Comments meta box, check for the current post status in get_post_stati( array( 'public' => true ) ) instead of just checking publish and private. Ensure that private is checked in both instances.
Props Thaicloud, wonderboymusic.
Fixes #24486.


git-svn-id: https://develop.svn.wordpress.org/trunk@34515 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 20:01:55 +00:00
Scott Taylor
395fc15df3 Widgets: use input[type="number"] for the number prop in the Recent Posts and Recent Comments widget forms.
Props helen, obenland, mordauk.
Fixes #22965.


git-svn-id: https://develop.svn.wordpress.org/trunk@34514 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 19:52:06 +00:00
John Blackbourn
075245d894 Convert the $args passed to register_post_type() into an array before passing them to the new register_post_type_args filter.
Fixes #17447


git-svn-id: https://develop.svn.wordpress.org/trunk@34513 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 19:38:11 +00:00
Drew Jaynes
2703af7691 Docs: Clarify the summary and optional $query parameter description for remove_query_arg().
Props johnbillion.
Fixes #33912.


git-svn-id: https://develop.svn.wordpress.org/trunk@34512 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 19:33:07 +00:00
Drew Jaynes
c406171d12 Docs: Overhaul the DocBlock for add_query_arg() to attempt to better explain the various call signatures it accepts.
Also adds a couple of in-DocBlock examples illustrating single key and value, and associative array usage. Retains the note about the unescaped return value.

Props johnbillion.
See #33912.


git-svn-id: https://develop.svn.wordpress.org/trunk@34511 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 19:31:40 +00:00
Drew Jaynes
a099621012 Docs: Convert the $args parameter description in the register_taxonomy() DocBlock to a hash notation.
Also standardizes the DocBlock summary.

Props johnbillion.
Fixes #33991.


git-svn-id: https://develop.svn.wordpress.org/trunk@34510 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 19:11:53 +00:00