Commit Graph

31615 Commits

Author SHA1 Message Date
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
Drew Jaynes
45b8138b97 Docs: Improve the summary and description for the pre_http_request filter docs to better illustrate expected values.
The filter explicitly expects one of three passed value types:

*  An array containing 'headers', 'body', 'response', 'cookies', and 'filename' elements
*  A `WP_Error` instance
*  Boolean false (to avoid short-circuiting the response)

Props johnbillion.
Fixes #33995.


git-svn-id: https://develop.svn.wordpress.org/trunk@34509 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 18:51:13 +00:00
Andrea Fercia
5852971d3c Comments List Table: fix the translators comment for all count after [34506].
See #17275.

git-svn-id: https://develop.svn.wordpress.org/trunk@34508 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 18:39:04 +00:00
John Blackbourn
133993389e Add $depth as a parameter in the nav_menu_item_args filter.
Fixes #29417


git-svn-id: https://develop.svn.wordpress.org/trunk@34507 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 17:58:20 +00:00
Scott Taylor
d7a59c4661 Comments List Table: include count for "All". Dynamically update.
Fixes #17275.


git-svn-id: https://develop.svn.wordpress.org/trunk@34506 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 17:56:50 +00:00
John Blackbourn
3d97e9a53b Correctly present an error to the user if the nickname field is empty when updating a user profile. It's strange that this field is required, but it is, so be it.
Fixes #33310
Props prasad-nevase, metodiew


git-svn-id: https://develop.svn.wordpress.org/trunk@34505 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 17:48:10 +00:00
Scott Taylor
821821c8b5 Comments: add date column to WP_Comments_List_Table to allow sorting and to break out the date/time from the comment content column.
Props jshreve.
Fixes #15520.


git-svn-id: https://develop.svn.wordpress.org/trunk@34504 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 17:26:54 +00:00
Scott Taylor
ba2842f326 Comments: In comments_template(), set $wp_query->comments_by_type to empty array if not separating comments. The value becomes stale otherwise. Edge case.
Props jakub.tyrcha.
Fixes #14809.


git-svn-id: https://develop.svn.wordpress.org/trunk@34503 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 16:30:12 +00:00
Drew Jaynes
057ba76b2c Docs: Add more explicit optional parameter types and return descriptions in the DocBlocks for is_page(), is_single(), is_singular().
Also adds explicit types and return descriptions to the corresponding `WP_Query` methods: `WP_Query::is_page()`, `WP_Query::is_single()`, and `WP_Query::is_singular()`.

Props Shelob9 for the initial patch.
Fixes #33907.


git-svn-id: https://develop.svn.wordpress.org/trunk@34502 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 16:17:23 +00:00
Dominik Schilling (ocean90)
9d4d1a7572 Twenty Fifteen: Add a missing comma in rtl.css.
Props Toro_Unit.
Fixes #33985.

git-svn-id: https://develop.svn.wordpress.org/trunk@34501 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 16:02:19 +00:00
Scott Taylor
c0ebd3b5e2 Comments: update Comment counts dynamically in the Right Now widget based on moderation actions in the Activity widget.
Fixes #10422.


git-svn-id: https://develop.svn.wordpress.org/trunk@34500 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 15:52:41 +00:00
Drew Jaynes
b408cd37fb Docs: Standardize and clarify class DocBlocks for all of the Upgrade API classes.
Standardizes summaries and tags for the following classes:

* `WP_Upgrader`
* `Plugin_Upgrader`
* `Theme_Upgrader`
* `Language_Pack_Upgrader`
* `Core_Upgrader`
* `File_Upload_Upgrader`
* `WP_Automatic_Updater`

See #32246.


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