Commit Graph

602 Commits

Author SHA1 Message Date
Andrew Ozz
e0d2de94e7 Privacy: docs fixes and improvements for wp_comments_personal_data_exporter().
Props desrosj.
See #43440.
Built from https://develop.svn.wordpress.org/trunk@43058


git-svn-id: http://core.svn.wordpress.org/trunk@42887 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-01 17:18:21 +00:00
John Blackbourn
cf02373b39 Comments: Update the inline docs following [42772].
See #43436

Built from https://develop.svn.wordpress.org/trunk@43042


git-svn-id: http://core.svn.wordpress.org/trunk@42871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-04-30 13:10:20 +00:00
Andrew Ozz
b044b4053e Privacy: add means to export personal data by username or email address. Generate a zipped export file containing all data. First run.
Props allendav.
See #43546.
Built from https://develop.svn.wordpress.org/trunk@43012


git-svn-id: http://core.svn.wordpress.org/trunk@42841 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-04-27 19:54:21 +00:00
Andrew Ozz
81668f8312 Privacy: add functionality to anonymize commenters.
Props xkon, fclaussen, allendav, birgire, azaozz.
See #43442.
Built from https://develop.svn.wordpress.org/trunk@42994


git-svn-id: http://core.svn.wordpress.org/trunk@42823 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-04-20 12:19:21 +00:00
Andrew Ozz
fbb51eafb0 Privacy: fix docs, formatting, white space, add tests for the personal data from comments exporter.
Props birgire.
See #43440.
Built from https://develop.svn.wordpress.org/trunk@42987


git-svn-id: http://core.svn.wordpress.org/trunk@42816 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-04-18 22:55:22 +00:00
Andrew Ozz
4fed9aa6bd Privacy: add functionality for exporting personal data from comments.
Props allendav, xkon.
Fixes #43440.
Built from https://develop.svn.wordpress.org/trunk@42888


git-svn-id: http://core.svn.wordpress.org/trunk@42718 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-28 17:25:31 +00:00
John Blackbourn
2361ca884f Docs: Document more parameters and properties using typed array notation.
See #41756

Built from https://develop.svn.wordpress.org/trunk@42876


git-svn-id: http://core.svn.wordpress.org/trunk@42706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-25 19:33:31 +00:00
Andrew Ozz
8ae59374f3 Add a checkbox to the comment form so logged out users can opt-out of commenter cookies.
Props lakenh, xkon, birgire, azaozz.
See #43436.
Built from https://develop.svn.wordpress.org/trunk@42772


git-svn-id: http://core.svn.wordpress.org/trunk@42602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-04 16:41:33 +00:00
John Blackbourn
91464bce65 Docs: Add missing code formatting to various @since entries.
See #42505

Built from https://develop.svn.wordpress.org/trunk@42678


git-svn-id: http://core.svn.wordpress.org/trunk@42506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-09 16:55:31 +00:00
Boone Gorges
355b6e80da Improve parameter description for 'allow_empty_comments'.
Introduced in [42661].

Props swissspidy.
See #16979.
Built from https://develop.svn.wordpress.org/trunk@42662


git-svn-id: http://core.svn.wordpress.org/trunk@42491 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-07 20:50:30 +00:00
Boone Gorges
6c11ac0c16 Comments: Introduce 'allow_empty_comment' filter.
This filter allows plugin authors to allow empty comments on a selective
basis during comment submission.

Props jpurdy647.
Fixes #16979.
Built from https://develop.svn.wordpress.org/trunk@42661


git-svn-id: http://core.svn.wordpress.org/trunk@42490 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-07 20:09:30 +00:00
Gary Pendergast
aaf99e6913 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.


Built from https://develop.svn.wordpress.org/trunk@42343


git-svn-id: http://core.svn.wordpress.org/trunk@42172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-30 23:11:00 +00:00
Gary Pendergast
c90cfa3b50 General: Fix some precision alignment formatting warnings.
The WPCS `WordPress.WhiteSpace.PrecisionAlignment` rule throws warnings for a bunch of code that will likely cause issues for `wpcbf`. Fixing these manually beforehand gives us better auto-fixed results later.

See #41057.


Built from https://develop.svn.wordpress.org/trunk@42228


git-svn-id: http://core.svn.wordpress.org/trunk@42057 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-26 23:57:55 +00:00
Peter Wilson
339d838475 Comments: Check if wp_new_comment() returns an error.
Adds checks throughout to allow for `wp_new_comment()` returning a `WP_Error` instance.

Updates the docs for the `pre_comment_approved` filter to include that it can be passed an error.

Props enrico.sorcinelli, ryotsun.
Fixes #39730.


Built from https://develop.svn.wordpress.org/trunk@41980


git-svn-id: http://core.svn.wordpress.org/trunk@41814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-23 22:12:51 +00:00
Sergey Biryukov
9c4fb24458 Docs: Reference WP_Comment_Query::__construct() as the source of information on accepted arguments in get_comments() and get_approved_comments().
See #41017.
Built from https://develop.svn.wordpress.org/trunk@41940


git-svn-id: http://core.svn.wordpress.org/trunk@41774 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-19 08:49:47 +00:00
Boone Gorges
0fce77da25 Invalidate comment query cache when modifying comment meta.
Comment queries are sensitive to comment meta due to the `meta_query`
parameter, so the cache must be invalidated when comment meta is changed,
added, or deleted.

Props spacedmonkey.
See #40669.
Built from https://develop.svn.wordpress.org/trunk@41848


git-svn-id: http://core.svn.wordpress.org/trunk@41682 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-12 14:59:47 +00:00
Sergey Biryukov
806b2a5af1 Comments: Change IP references in moderation option labels and email notifications to IP address for clarity.
Props mako09, gk.loveweb, bradparbs.
Fixes #40382.
Built from https://develop.svn.wordpress.org/trunk@41704


git-svn-id: http://core.svn.wordpress.org/trunk@41538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-03 13:09:47 +00:00
Sergey Biryukov
df0958697a Comments: Pass $comment object to comment actions:
* `delete_comment`
* `deleted_comment`
* `trash_comment`
* `trashed_comment`
* `untrash_comment`
* `untrashed_comment`
* `spam_comment`
* `spammed_comment`
* `unspam_comment`
* `unspammed_comment`

Props henry.wright.
Fixes #41228.
Built from https://develop.svn.wordpress.org/trunk@41689


git-svn-id: http://core.svn.wordpress.org/trunk@41523 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-02 22:15:33 +00:00
John Blackbourn
9fdbe6538e Docs: Remove & prefixes from parameter documentation to avoid doc parsing errors.
Props sudar for the original patch.

See #35974

Built from https://develop.svn.wordpress.org/trunk@41686


git-svn-id: http://core.svn.wordpress.org/trunk@41520 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-02 22:03:33 +00:00
Boone Gorges
6995731f12 Allow metadata to be updated via wp_update_comment().
Passing an array of `comment_meta` into `wp_update_comment()` will
now update corresponding metadata. Similar functionality already
exists in `wp_insert_comment()`.

Props dshanske, kraftbj.
Fixes #36784.
Built from https://develop.svn.wordpress.org/trunk@40981


git-svn-id: http://core.svn.wordpress.org/trunk@40831 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-01 13:36:41 +00:00
Rachel Baker
195b227357 Formatting: Increase minimum characters allowed in is_email() to 6.
Brings the minimum characters expected for a valid email address to six, which matches the expectations in `wp_handle_comment_submission()` and REST API email arguments.

Props rmccue, lukecavanagh, rachelbaker, desrosj, sudar.
Fixes #38708.

Built from https://develop.svn.wordpress.org/trunk@40667


git-svn-id: http://core.svn.wordpress.org/trunk@40530 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-14 04:20:43 +00:00
Rachel Baker
868312d995 Comments: Update arguments passed to the 'comment_text' filter in check_comment().
Pass null or empty values for the missing $comment and $args parameters of the 'check_comment' filter in `check_comment()`.

Props boonebgorges, vaishu.agola27, SergeyBiryukov.
Fixes #38314. 

Built from https://develop.svn.wordpress.org/trunk@40664


git-svn-id: http://core.svn.wordpress.org/trunk@40527 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-14 03:06:45 +00:00
John Blackbourn
76f44d242b Comments: When commenting on a draft post, display a friendly error message if the user can view the post.
This prevents the unhelpful white screen of death when a user who can view the post (eg. preview it) leaves a comment while the post is in draft.

Props sagarprajapati, milindmore22, mayurk, swissspidy
Fixes #39650

Built from https://develop.svn.wordpress.org/trunk@40128


git-svn-id: http://core.svn.wordpress.org/trunk@40065 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-27 00:23:40 +00:00
Boone Gorges
324e79a506 Ignore the 'comment_order' setting when determining comment pagination.
[38740] incorrectly introduced logic that changed a comment's page when
'comment_order' was set to 'desc'. This is in violation of the design
of the comment pagination system: a comment's page is designed not to
change when 'comment_order' or 'default_comment_page' are changed.
See #31101.

Props rachelbaker.
Fixes #39280.
Built from https://develop.svn.wordpress.org/trunk@39663


git-svn-id: http://core.svn.wordpress.org/trunk@39603 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-02 20:00:31 +00:00
Rachel Baker
82c7fd2493 Comments: Fix placement of the wp_update_comment_data filter to safeguard filtered data from triggering a database error.
Introduced in [38674], the `wp_update_comment_data` filter took place after the `$data` was sliced and prepared for the database update statement. The location of the filter assumed the result of anyone applying it would not change the data type or make structural modifications or additions to the $data array. 😅

This moves the `wp_update_comment_data` filter to take place before the `$data` is sliced and prepared for the database update statement.

Props dshanske for initial patch.

Fixes #39380.

Built from https://develop.svn.wordpress.org/trunk@39640


git-svn-id: http://core.svn.wordpress.org/trunk@39580 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-27 17:22:45 +00:00
Rachel Baker
697f079a19 Comments: Merge similar strings between comments.php and the REST API comments controller.
Props ramiy.
Fixes #39014.

Built from https://develop.svn.wordpress.org/trunk@39490


git-svn-id: http://core.svn.wordpress.org/trunk@39430 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-04 20:32:40 +00:00
John Blackbourn
b9033ad6a1 Docs: Improve the documentation for parameters which accept OBJECT, ARRAY_A, and ARRAY_N as parameters.
See #37770

Built from https://develop.svn.wordpress.org/trunk@39188


git-svn-id: http://core.svn.wordpress.org/trunk@39128 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-09 23:00:32 +00:00
Rachel Baker
94ab2f9b16 REST API: Return an error when the length of a comment field is too long.
Introduces `wp_check_comment_data_max_lengths()` which allows both the REST API comments endpoints and `wp_handle_comment_submission()` to check the length of the comment content, author name, author url, and author email fields against their respective database columns.

Props rachelbaker, mangeshp, salcode, pento.
Fixes #38477.
Built from https://develop.svn.wordpress.org/trunk@39101


git-svn-id: http://core.svn.wordpress.org/trunk@39043 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-03 01:12:31 +00:00
Rachel Baker
2f263fce99 Feeds: Always return a valid timestamp for the Last-Modified header of comment or post feeds.
Fixes bug where an invalid Last-Modified value would be returned in feed requests for sites that had 0 items to return. Comment or post feeds will now return the current timestamp as the Last-Modified header value.  Example: a request for the comments feed for a site without any comments.

Replaced use of the local static variable `$cache_lastcommentmodified` to store the modified date in `get_lastcommentmodified()` with the Object Cache API.  The `get_lastcommentmodified()` function returns early if there is a cached value and returns `false` if there where no comments found. Introduced `_clear_modified_cache_on_transition_comment_status()` to flush the `lastcommentmodified` cache key when a comment enters or leaves approval status. In `get_lastpostmodified()` return early if there is a cached value and return `false` if there are no posts found.

Props swissspidy, rachelbaker, dllh, leobaiano.
Fixes #38027.
Built from https://develop.svn.wordpress.org/trunk@38925


git-svn-id: http://core.svn.wordpress.org/trunk@38868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-25 20:48:29 +00:00
Gary Pendergast
16f0c6877e Pings: Allow ping functions to accept WP_Post objects as well as post IDs.
This removes the use of several `global $wpdb` instances, as well as bringing the ping functions into line with other post-related functions, which will accept a post ID or `WP_Post` object.

Props dshanke.
Fixes #38202.


Built from https://develop.svn.wordpress.org/trunk@38852


git-svn-id: http://core.svn.wordpress.org/trunk@38795 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-21 06:00:31 +00:00
Boone Gorges
9935b60e72 Comments: When checking comments, returned error object should include HTTP status code.
The status code in the `WP_Error` `data` array is needed to send
headers in wp-comments-post.php, and was erroneously not included in
[38778].

Props needle, websupporter.
Fixes #36901.
Built from https://develop.svn.wordpress.org/trunk@38783


git-svn-id: http://core.svn.wordpress.org/trunk@38726 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-12 13:50:30 +00:00
Boone Gorges
0bdfa2ab1e Comments: Abstract die() calls from comment submission routine.
Since 4.4, comment submission has been mostly abstracted into a function,
rather than being processed inline in wp-comments-post.php. This change
made it easier to write automated tests against the bulk of the comment
submission process. `wp_allow_comment()` remained untestable, however:
when a comment failed one of its checks (flooding, duplicates, etc),
`die()` or `wp_die()` would be called directly. This shortcoming posed
problems for any application attempting to use WP's comment verification
functions in an abstract way - from PHPUnit to the REST API.

The current changeset introduces a new parameter, `$avoid_die`, to the
`wp_new_comment()` stack. When set to `true`, `wp_new_comment()` and
`wp_allow_comment()` will return `WP_Error` objects when a comment check
fails. When set to `false` - the default, for backward compatibility -
a failed check will result in a `die()` or `wp_die()`, as appropriate.

Prior to this changeset, default comment flood checks took place in the
function `check_comment_flood_db()`, which was hooked to the
'check_comment_flood' action. This design allowed the default comment
flood routine to be bypassed or replaced using `remove_action()`.
In order to maintain backward compatibility with this usage, while
simultaneously converting the comment flood logic into something that
returns a value rather than calling `die()` directly,
`check_comment_flood_db()` has been changed into a wrapper function for
a call to `add_filter()`; this, in turn, adds the *actual* comment flood
check to a new filter, 'wp_is_comment_flood'. Note that direct calls
to `check_comment_flood_db()` will no longer do anything in isolation.

Props websupporter, rachelbaker.
Fixes #36901.
Built from https://develop.svn.wordpress.org/trunk@38778


git-svn-id: http://core.svn.wordpress.org/trunk@38721 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-11 03:43:28 +00:00
Dominik Schilling
fc79800fc5 Comments: Pass $comment to the comment_max_links_url filter.
Props rachelbaker.
Fixes #37955.
Built from https://develop.svn.wordpress.org/trunk@38748


git-svn-id: http://core.svn.wordpress.org/trunk@38691 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-07 18:32:29 +00:00
Rachel Baker
4ca1385b60 Comments: Account for the comment_order option in get_page_of_comment().
Use the value of the `comment_order` setting to determine the date_query key to pass to `WP_Comment_Query`.
Fixes a bug where sites that had comments ordered "newest" first would have the incorrect page number returned.

Props tyxla, boonebgorges.
Fixes #31101.
Built from https://develop.svn.wordpress.org/trunk@38740


git-svn-id: http://core.svn.wordpress.org/trunk@38683 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-06 17:42:29 +00:00
Rachel Baker
0438d27410 Comments: Improve check for previous comments for authenticated users in check_comment().
When the 'comment_whitelist' option is enabled and the commenter is an authenticated user, query for the existence of an approved comment with a matching `user_id`.  This allows authenticated users that have changed their email address to bypass having their comment held for moderation.

Props voldemortensen, rachelbaker.
Fixes #28603.
Built from https://develop.svn.wordpress.org/trunk@38738


git-svn-id: http://core.svn.wordpress.org/trunk@38681 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-06 15:51:31 +00:00
Rachel Baker
bf21f3f62f Comments: Introduce the wp_update_comment_data filter.
Filters the comment data immediately before it is updated in the database. 

Props frankiet, dshanske, DrewAPicture.
Fixes #36302.
Built from https://develop.svn.wordpress.org/trunk@38674


git-svn-id: http://core.svn.wordpress.org/trunk@38617 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-29 13:47:31 +00:00
Boone Gorges
0d1d1c4d06 Pass comment ID to get_page_of_comment filter.
Introduced in [34808].

Props zhildzik.
Fixes #38155.
Built from https://develop.svn.wordpress.org/trunk@38650


git-svn-id: http://core.svn.wordpress.org/trunk@38593 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-25 17:33:32 +00:00
Scott Taylor
a3ffebce30 Bootstrap: do not go gentle into that good night r38411, r38412, and parts of r38389.
See #36335.

Built from https://develop.svn.wordpress.org/trunk@38470


git-svn-id: http://core.svn.wordpress.org/trunk@38411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 16:31:29 +00:00
Scott Taylor
9383bf8f74 General: use get_bloginfo( 'version' ) instead of global $wp_version in several locations - excluding those locations which reload version.php mid-flight.
See #37699.

Built from https://develop.svn.wordpress.org/trunk@38459


git-svn-id: http://core.svn.wordpress.org/trunk@38400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 05:49:37 +00:00
Scott Taylor
390ceba6c7 Bootstrap: after r38409 and r38410, revert r38402 which reverted r38399.
This fixes the paths in `wp-vendor/` that were including `src`. I want to drop this in so we can find out what else will break.

See #36335.

Built from https://develop.svn.wordpress.org/trunk@38411


git-svn-id: http://core.svn.wordpress.org/trunk@38352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 22:32:37 +00:00
Dion Hulse
0e31a46161 Bootstrap: Revert [38399] as it's broken /build/ and subsequently core.svn.wordpress.org.
The generated classmaps reference `/src/` files and operates in the assumption that the base directory is one level above `wp-settings.php`, which it isn't after our build processes are run.

See #36335

Built from https://develop.svn.wordpress.org/trunk@38402


git-svn-id: http://core.svn.wordpress.org/trunk@38343 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 14:37:32 +00:00
Scott Taylor
6a529648cf Bootstrap: Autoload classes using a Composer-generated PHP 5.2-compatible Autoloader.
* `wp-admin` and `wp-includes` are scanned for classes to autoload
* Several 3rd-party and Ryan McCue-shaped libraries are excluded when the classmap is generated, see `composer.json`: `autoload.exclude-from-classmap`
* `wp-vendor/autoload_52.php` is included at the top of `wp-settings.php` - no changes need to be made to unit tests to include the autoloader
* An avalanche of `require()` and `require_once()` calls that loaded class files have been removed from the codebase.

The following files have been added to `svn:ignore` - they are not 5.2-compatible and fail during pre-commit:
* src/wp-vendor/autoload.php
* src/wp-vendor/composer/autoload_real.php
* src/wp-vendor/composer/autoload_static.php
* src/wp-vendor/composer/ClassLoader.php

We favor these files instead:
* src/wp-vendor/autoload_52.php
* src/wp-vendor/composer/autoload_real_52.php
* src/wp-vendor/composer/ClassLoader52.php

When new PHP classes are added to the codebase, simply run `composer install` or `composer update` from the project root to update the autoloader.

The future is now.

See #36335.

Built from https://develop.svn.wordpress.org/trunk@38399


git-svn-id: http://core.svn.wordpress.org/trunk@38340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 09:15:29 +00:00
Scott Taylor
b7812bd416 AJAX: add a new function, wp_doing_ajax(), which can replace... (wait for it...) DOING_AJAX checks via the constant.
Props Mte90, sebastian.pisula, swissspidy.
Fixes #25669.

Built from https://develop.svn.wordpress.org/trunk@38334


git-svn-id: http://core.svn.wordpress.org/trunk@38275 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-23 14:33:30 +00:00
Scott Taylor
dcb0261664 Comments: in wp_handle_comment_submission(), $_wp_unfiltered_html_comment is passed as part of $comment_data, but is not used locally.
See #37771.

Built from https://develop.svn.wordpress.org/trunk@38313


git-svn-id: http://core.svn.wordpress.org/trunk@38254 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-22 21:04:28 +00:00
Drew Jaynes
6cc13f0c54 Docs: Fix formatting, tense, verb conjugation, and other syntax for wp-includes/* elements introduced or changed in 4.6.
Part 1/2.

See #37318.

Built from https://develop.svn.wordpress.org/trunk@38121


git-svn-id: http://core.svn.wordpress.org/trunk@38062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-20 16:57:32 +00:00
Rachel Baker
093b16dfcd Docs: Correct comment_max_links_url filter and $url param descriptions to communicate values are found links.
`$num_links` is the number of link matches found within the comment_content, and that is the value that can be modified with the `comment_max_links_url` filter.

Props pbearne.
Fixes #37319.
Built from https://develop.svn.wordpress.org/trunk@38098


git-svn-id: http://core.svn.wordpress.org/trunk@38039 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-19 01:49:30 +00:00
Dominik Schilling
da88178148 Comments: Use wp_strip_all_tags() to strip HTML tags.
`wp_kses()` should only be used if you have a whitelist.

Props rachelbaker.
Fixes #37208.
Built from https://develop.svn.wordpress.org/trunk@38092


git-svn-id: http://core.svn.wordpress.org/trunk@38033 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-18 14:04:31 +00:00
Rachel Baker
2040186a5d Comments: Include comment_content with html and without in blacklist_keys comparison.
After [38047], also include the comment_content with html in the preg_match against blacklist keys to match urls.

Props ocean90.
Fixes #37208.
Built from https://develop.svn.wordpress.org/trunk@38048


git-svn-id: http://core.svn.wordpress.org/trunk@37989 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-13 14:05:29 +00:00
Rachel Baker
240e3ec683 Comments: Strip html tags from comment content before blacklist_keys comparison.
Use `wp_kses()` to clean comment_content for preg_match against the blacklist_keys. Also includes some initial unit tests for `wp_blacklist_check()`.
Previously, if a blacklisted key was used in comment_content split by an html tag the regex in `wp_blacklist_check()` would not find a match. Example: Where "springfield" was a blacklisted word, if the content of a comment included `spring<i>field</i>" `wp_blacklist_check()` would not return true.

Props cfinke.
Fixes #37208.
Built from https://develop.svn.wordpress.org/trunk@38047


git-svn-id: http://core.svn.wordpress.org/trunk@37988 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-13 13:48:39 +00:00
Sergey Biryukov
139387b7e5 Docs: Use 3-digit, x.x.x-style semantic versioning for _doing_it_wrong(), _deprecated_function(), _deprecated_argument(), and _deprecated_file() throughout core.
Props metodiew.
Fixes #36495.
Built from https://develop.svn.wordpress.org/trunk@37985


git-svn-id: http://core.svn.wordpress.org/trunk@37926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-06 12:40:29 +00:00
Rachel Baker
15b4fa81d2 Comments: Do not flag a comment as a duplicate if the comment_author_email is provided but not a match.
This reduces the strictness of the duplicate check a little, but does prevent false duplicates for emoji or +1 comments by authors with matching names. The current logic was introduced all the way back in [2894].

Fixes #37093.
Built from https://develop.svn.wordpress.org/trunk@37713


git-svn-id: http://core.svn.wordpress.org/trunk@37679 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 14:51:27 +00:00
Peter Wilson
47d26cd9fb DOCS: Replace HTTP links with HTTPS.
Replaces unsecure links in documentation and translator comments with their secure versions.

Props johnpgreen, netweb

Fixes #36993

Built from https://develop.svn.wordpress.org/trunk@37674


git-svn-id: http://core.svn.wordpress.org/trunk@37640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-10 04:50:33 +00:00
Boone Gorges
c70e3246e2 Use clean_comment_cache() in wp_insert_comment().
Previously, only the 'last_changed' incrementor was manually invalidated, since
the newly created comment did not yet exist in the cache. However, this created
an inconsistency with the other comment CRUD functions, which result in the
'clean_comment_cache' action firing.

Props spacedmonkey.
See #36906.
Built from https://develop.svn.wordpress.org/trunk@37614


git-svn-id: http://core.svn.wordpress.org/trunk@37582 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-01 21:56:27 +00:00
Drew Jaynes
da78aeffe9 Docs: Apply inline @see tags to hooks referenced in DocBlocks in a variety of wp-includes/* files.
Applying these specially-crafted `@see` tags allows the Code Reference parser to recognize and link these elements as actions and filters.

See #36921.

Built from https://develop.svn.wordpress.org/trunk@37542


git-svn-id: http://core.svn.wordpress.org/trunk@37510 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-23 18:59:27 +00:00
Drew Jaynes
fd96e90758 Docs: Standardize filter docs in wp-includes/comment.php to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

Built from https://develop.svn.wordpress.org/trunk@37512


git-svn-id: http://core.svn.wordpress.org/trunk@37480 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:41:29 +00:00
Drew Jaynes
f52a8cb1fa Docs: Remove/replace invalid inline @link tags in DocBlocks in wp-includes/*.
Fixes #36910.

Built from https://develop.svn.wordpress.org/trunk@37487


git-svn-id: http://core.svn.wordpress.org/trunk@37455 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 17:39:28 +00:00
Rachel Baker
00adb457d2 Comments: Add $data parameter to include the comment data in the edit_comment action.
Props dshanske.

Fixes #36427.


Built from https://develop.svn.wordpress.org/trunk@37423


git-svn-id: http://core.svn.wordpress.org/trunk@37389 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-12 15:37:27 +00:00
Drew Jaynes
fe3b007fdd Docs: Remove inline @see tags from function, class, and method references in inline docs.
Known functions, classes, and methods are now auto-linked in Code Reference pages following #meta1483.

Note: Hook references are still linked via inline `@see` tags due to the unlikelihood of reliably matching for known hooks based on a RegEx pattern.

See #32246.

Built from https://develop.svn.wordpress.org/trunk@37342


git-svn-id: http://core.svn.wordpress.org/trunk@37308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-02 04:00:28 +00:00
Dominik Schilling
d8f3325c14 Docs: Correct grammar when referring to "a URL" vs "an URL" in several places.
Fixes #36218.
Built from https://develop.svn.wordpress.org/trunk@36970


git-svn-id: http://core.svn.wordpress.org/trunk@36938 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-12 12:39:27 +00:00
Aaron Jorbin
1972aa2a2a Add grunt prerelease task
An unintended consequence of improving the precommit task is that when it's time to run a release, more tasks need to get run to verify things. This adds a prerelease task to help fix that situation. grunt prerelease should include tasks that verify the code base is ready to be released to the wild and find all the tears on the mausoleum floor and help Blood stain the Colosseum doors.

See #35557

Built from https://develop.svn.wordpress.org/trunk@36930


git-svn-id: http://core.svn.wordpress.org/trunk@36898 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-10 05:37:27 +00:00
Sergey Biryukov
74f707ff6b Comments: Pass comment data to the comment_post filter.
Props dshanske.
See #34141.
Built from https://develop.svn.wordpress.org/trunk@36660


git-svn-id: http://core.svn.wordpress.org/trunk@36627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-24 00:49:26 +00:00
Boone Gorges
b23b89c8a9 Docs: Correct param types on some filters in wp_filter_comment().
Introduced in [26491].

Props meitar, netweb.
Fixes #35908.
Built from https://develop.svn.wordpress.org/trunk@36626


git-svn-id: http://core.svn.wordpress.org/trunk@36593 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-23 03:06:26 +00:00
Andrew Ozz
2d94e025a2 Replace wp_upload_dir() with the new wp_get_upload_dir() in all cases where a file is not being uploaded. Deprecate _wp_upload_dir_baseurl(), and replace it with wp_get_upload_dir().
See #34359.
Built from https://develop.svn.wordpress.org/trunk@36569


git-svn-id: http://core.svn.wordpress.org/trunk@36536 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-18 00:24:27 +00:00
Boone Gorges
571e14f897 More performance improvements to metadata lazyloading.
Comment and term meta lazyloading for `WP_Query` loops, introduced in 4.4,
depended on filter callback methods belonging to `WP_Query` objects. This meant
storing `WP_Query` objects in the `$wp_filter` global (via `add_filter()`),
requiring that PHP retain the objects in memory, even when the local variables
would typically be expunged during normal garbage collection. In cases where a
large number of `WP_Query` objects were instantiated on a single pageload,
and/or where the contents of the `WP_Query` objects were quite large, serious
performance issues could result.

We skirt this problem by moving metadata lazyloading out of `WP_Query`. The
new `WP_Metadata_Lazyloader` class acts as a lazyload queue. Query instances
register items whose metadata should be lazyloaded - such as post terms, or
comments - and a `WP_Metadata_Lazyloader` method will intercept comment and
term meta requests to perform the cache priming. Since `WP_Metadata_Lazyloader`
instances are far smaller than `WP_Query` (containing only object IDs), and
clean up after themselves far better than the previous `WP_Query` methods (bp
only running their callbacks a single time for a given set of queued objects),
the resource use is decreased dramatically.

See [36525] for an earlier step in this direction.

Props lpawlik, stevegrunwell, boonebgorges.
Fixes #35816.
Built from https://develop.svn.wordpress.org/trunk@36566


git-svn-id: http://core.svn.wordpress.org/trunk@36533 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-17 22:58:26 +00:00
Andrew Ozz
0ff58701e0 Comments: look for wp_error when checking whether $wpdb->get_col_length() has failed.
See #10377.
Built from https://develop.svn.wordpress.org/trunk@36542


git-svn-id: http://core.svn.wordpress.org/trunk@36509 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-16 23:50:27 +00:00
Rachel Baker
8abd201a0b Comments: Change wp_get_comment_column_max_length() function to wp_get_comment_fields_max_lengths() for consolidation and better fallbacks.
Instead of returning a value for each of the related table column lengths, return an array of all of the column lengths used in the comment form.
Better fallback handling, where each field falls back to the expected max_length instead of an arbitrary number.

Props azaozz.

Fixes #10377.
Built from https://develop.svn.wordpress.org/trunk@36514


git-svn-id: http://core.svn.wordpress.org/trunk@36481 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-12 13:55:28 +00:00
Eric Lewis
0efd5b3d00 Comments: Fire an action after a comment is removed from object cache.
When a comment is removed from the object cache, the `clean_comment_cache` action is now fired. This provides plugin and theme developers a chance to perform secondary cache invalidation as needed.

Props spacedmonkey.
Fixes #35610.

Built from https://develop.svn.wordpress.org/trunk@36405


git-svn-id: http://core.svn.wordpress.org/trunk@36372 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-26 03:47:25 +00:00
Rachel Baker
f407e3a473 Comments: Use TEXT column type in fallback for wp_get_comment_column_max_length().
Fixes #10377.

Built from https://develop.svn.wordpress.org/trunk@36325


git-svn-id: http://core.svn.wordpress.org/trunk@36292 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-15 20:10:27 +00:00
Pascal Birchler
19d4304565 Comments: Add a new pre_wp_update_comment_count_now filter.
This allows filtering a post's comment count before it is queried and updated in the database.

Props peterwilsoncc for initial patch.
Fixes #35060.
Built from https://develop.svn.wordpress.org/trunk@36318


git-svn-id: http://core.svn.wordpress.org/trunk@36285 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-15 13:42:26 +00:00
Rachel Baker
87e7b4455d Comments: Restrict the maximum characters for input fields within the comments template.
Added hardcoded maxlength attributes on the author, author_email, author_url, and comment_field input markup. These can be modified via the comment_form_defaults filter. Added logic in wp_handle_comment_submission() to return a WP_Error when the comment_author, comment_author_url, or comment_content values exceed the max length of their columns. Introduces wp_get_comment_column_max_length() which returns the max column length for a given column name, and is filterable. Unit tests included for the error conditions in wp_handle_comment_submission()

Fixes #10377.

Props westonruter rachelbaker.

Built from https://develop.svn.wordpress.org/trunk@36272


git-svn-id: http://core.svn.wordpress.org/trunk@36239 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-13 01:25:26 +00:00
Boone Gorges
74f83e1016 Allow comment agent and author IP to be set via wp_update_comment().
Props adamsilverstein, welcher.
Fixes #35276.
Built from https://develop.svn.wordpress.org/trunk@36215


git-svn-id: http://core.svn.wordpress.org/trunk@36182 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-07 03:55:28 +00:00
Rachel Baker
2bdc6a5fd0 Docs: Add null to post_id param type, fix syntax, and descriptions in the DocBlock for wp_update_comment_count().
See #32246.


Built from https://develop.svn.wordpress.org/trunk@36139


git-svn-id: http://core.svn.wordpress.org/trunk@36105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-31 19:21:28 +00:00
Aaron Jorbin
09688bd59c Ensure only approved comments trigger post author notifications
Posts that are trashed shouldn't trigger post author notifications.  Adds unit tests to enforce this.

Props scottbrownconsulting, peterwilsoncc, swissspidy
Fixes #35006


Built from https://develop.svn.wordpress.org/trunk@36119


git-svn-id: http://core.svn.wordpress.org/trunk@36085 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-29 17:54:28 +00:00
Rachel Baker
a828b700fc Comments: Return early from wp_update_comment_count() if there is not a valid post.
Props ambrosey, juanfra. 
Fixes #34977


Built from https://develop.svn.wordpress.org/trunk@36115


git-svn-id: http://core.svn.wordpress.org/trunk@36080 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-28 22:58:28 +00:00
John Blackbourn
afc7f43ca0 Comments: When a comment is submitted, ensure the user_ID element in the array that's passed to the preprocess_comment filter gets populated.
Fixes #34997

Built from https://develop.svn.wordpress.org/trunk@36038


git-svn-id: http://core.svn.wordpress.org/trunk@36003 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-21 02:47:26 +00:00
Rachel Baker
719239ca1e Comments: Use an integer as the default value for comment_post_ID in wp_insert_comment to match database column.
Props MikeHansenMe, juanfra, rabmalin. 
Fixes #34956


Built from https://develop.svn.wordpress.org/trunk@35948


git-svn-id: http://core.svn.wordpress.org/trunk@35912 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-15 15:13:27 +00:00
Sergey Biryukov
fe131bacd1 I18N: Use better context for comment statuses.
See #35054.
Built from https://develop.svn.wordpress.org/trunk@35902


git-svn-id: http://core.svn.wordpress.org/trunk@35866 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-13 19:11:26 +00:00
Rachel Baker
9dd574bd99 Comments: Comments don’t need no Post ID when created, so they don’t be needing one to be edited.
In `wp_update_comment()` only check if the given `comment_post_ID` is valid if it isn’t `0`.  This allows comments that were created programmatically via `wp_insert_comment()` without the (optional) `comment_post_ID` parameter to be edited.

Props subharanjan for the initial patch.
Fixes #34954


Built from https://develop.svn.wordpress.org/trunk@35853


git-svn-id: http://core.svn.wordpress.org/trunk@35817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-10 15:17:29 +00:00
John Blackbourn
28c78799c3 Ensure the correct error message is returned when a user attempts to comment on a post to which they do not have access.
Adds more tests.

Built from https://develop.svn.wordpress.org/trunk@35745


git-svn-id: http://core.svn.wordpress.org/trunk@35709 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-28 18:29:32 +00:00
Sergey Biryukov
bc1e479fd0 After [35718], update the location of some files in This filter is documented in docs.
Partially reverts [33954].

Fixes #33413.
Built from https://develop.svn.wordpress.org/trunk@35725


git-svn-id: http://core.svn.wordpress.org/trunk@35689 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-22 03:51:28 +00:00
Andrew Nacin
1579e45d41 Simplify the include graph after work to split out classes.
see #33413. More details there.

Built from https://develop.svn.wordpress.org/trunk@35718


git-svn-id: http://core.svn.wordpress.org/trunk@35682 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-20 07:24:30 +00:00
Drew Jaynes
5f6cdc2c3b Docs: The Comment API is singular.
See #33701.

Built from https://develop.svn.wordpress.org/trunk@34410


git-svn-id: http://core.svn.wordpress.org/trunk@34374 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-22 13:44:25 +00:00
Scott Taylor
67f90df6a4 Walker_Comment should be in its own file. Loaded now via wp-includes/comment.php, which makes it 100% BC.
See #33413.

Built from https://develop.svn.wordpress.org/trunk@33962


git-svn-id: http://core.svn.wordpress.org/trunk@33931 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-09 02:41:24 +00:00
Drew Jaynes
bfe8b01ef2 Docs: Clarify the file header summary for wp-includes/comment.php, the top-level file for the core Comments API.
Also adds inline DocBlock for the `require_once()` calls that now bring in the `WP_Comment` and `WP_Comment_Query` classes, as well as core comments functionality.

See #33413. See #33701.

Built from https://develop.svn.wordpress.org/trunk@33900


git-svn-id: http://core.svn.wordpress.org/trunk@33869 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-04 01:47:25 +00:00
Scott Taylor
e73ee5ac98 Introduce WP_Comment class to model/strongly-type rows from the comments database table. Inclusion of this class is a pre-req for some more general comment cleanup and sanity.
* Takes inspiration from `WP_Post` and adds sanity to comment caching. 
* Clarifies when the current global value for `$comment` is returned. The current implementation in `get_comment()` introduces side effects and an occasion stale global value for `$comment` when comment caches are cleaned.
* Strongly-types `@param` docs
* This class is marked `final` for now

Props wonderboymusic, nacin.

See #32619.

Built from https://develop.svn.wordpress.org/trunk@33891


git-svn-id: http://core.svn.wordpress.org/trunk@33860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-03 18:17:24 +00:00
Scott Taylor
f07ab12359 Comments: move WP_Comment_Query into its own file. comment.php loads the new files, so this is 100% BC if someone is loading comment.php directly. New files created using svn cp.
Creates: 
`class-wp-comment-query.php` 
`comment-functions.php` 

`comment.php` contains only top-level code. Class file only contains the class. Functions file only contains functions.

See #33413.

Built from https://develop.svn.wordpress.org/trunk@33750


git-svn-id: http://core.svn.wordpress.org/trunk@33718 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-26 04:27:21 +00:00
Scott Taylor
ef87172270 foreach is a statement, not a function.
See #33491.

Built from https://develop.svn.wordpress.org/trunk@33734


git-svn-id: http://core.svn.wordpress.org/trunk@33702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-25 20:28:22 +00:00
Drew Jaynes
7aff9092c7 Docs: Document the default comment data arguments for wp_new_comment().
Props rachelbaker, DrewAPicture
Fixes #32369.

Built from https://develop.svn.wordpress.org/trunk@33730


git-svn-id: http://core.svn.wordpress.org/trunk@33698 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-25 17:03:21 +00:00
Scott Taylor
572a0a587a Comments shouldn't have more than one _wp_trash_meta_status entry. When deleting _wp_trash_meta_status, also delete _wp_trash_meta_time.
See #11200.

Built from https://develop.svn.wordpress.org/trunk@33654


git-svn-id: http://core.svn.wordpress.org/trunk@33621 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-20 02:45:26 +00:00
Drew Jaynes
536cdddbcd Fix inline documentation syntax for get_default_comment_status(), introduced in 4.3.
See [33122]. See #32891.

Built from https://develop.svn.wordpress.org/trunk@33223


git-svn-id: http://core.svn.wordpress.org/trunk@33195 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-13 21:23:25 +00:00
Helen Hou-Sandí
30e478b1fb Move get_default_comment_status() to wp-includes/comment.php to sit alongside get_comment_statuses().
props nacin.
see #31168.

Built from https://develop.svn.wordpress.org/trunk@33122


git-svn-id: http://core.svn.wordpress.org/trunk@33093 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-08 15:44:28 +00:00
Boone Gorges
ca390b2fb5 Allow 'comment_agent' and 'comment_author_IP' to be set via wp_new_comment().
Props mrutz, wonderboymusic, rachelbaker.
Fixes #14601.
Built from https://develop.svn.wordpress.org/trunk@33021


git-svn-id: http://core.svn.wordpress.org/trunk@32992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-01 12:08:25 +00:00
Scott Taylor
a0e373ef80 For doc block types, favor bool over the few remaining booleans
See #32444.

Built from https://develop.svn.wordpress.org/trunk@32964


git-svn-id: http://core.svn.wordpress.org/trunk@32935 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-27 01:03:25 +00:00
Boone Gorges
fdd0917471 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.
Built from https://develop.svn.wordpress.org/trunk@32911


git-svn-id: http://core.svn.wordpress.org/trunk@32882 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-23 14:36:27 +00:00
Scott Taylor
5e994cd6a1 Customizer et al, use elseif in PHP, not else if.
This was corrected via brute force in [31090].

See #32444.

Built from https://develop.svn.wordpress.org/trunk@32874


git-svn-id: http://core.svn.wordpress.org/trunk@32845 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-19 22:01:25 +00:00
Andrew Nacin
7080c8e24b Update comment caches in WP_Comment_Query, rather than comments template.
props dd32.
fixes #31081.

Built from https://develop.svn.wordpress.org/trunk@32769


git-svn-id: http://core.svn.wordpress.org/trunk@32740 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-14 19:21:25 +00:00
Scott Taylor
19a3aacc94 Add @static* annotations where they are missing.
Initialize all static vars that are not, most to `null`.

See #32444.

Built from https://develop.svn.wordpress.org/trunk@32650


git-svn-id: http://core.svn.wordpress.org/trunk@32620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-29 15:43:29 +00:00
Drew Jaynes
4c37f68b79 Fix inline documentation syntax in wp_xmlrpc_server.
See #32246.

Built from https://develop.svn.wordpress.org/trunk@32591


git-svn-id: http://core.svn.wordpress.org/trunk@32561 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-25 06:25:25 +00:00
Scott Taylor
1b960d56b6 Add missing doc blocks to class-wp-theme.php.
See #32444.

Built from https://develop.svn.wordpress.org/trunk@32547


git-svn-id: http://core.svn.wordpress.org/trunk@32517 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-22 17:31:27 +00:00
Drew Jaynes
2aa620b76a Update the DocBlock for wp_new_comment() to reference the wp_insert_comment() documentation for argument information.
Fixes #31747.

Built from https://develop.svn.wordpress.org/trunk@32500


git-svn-id: http://core.svn.wordpress.org/trunk@32470 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-13 02:54:26 +00:00
Drew Jaynes
4769bd2a4f Document the default arguments for wp_insert_comment() as a hash notation.
Props lamosty, rachelbaker.
See #31747.

Built from https://develop.svn.wordpress.org/trunk@32499


git-svn-id: http://core.svn.wordpress.org/trunk@32469 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-13 02:51:28 +00:00
Boone Gorges
3f642ba717 Use table prefix for comment__in and comment__not_in SQL clauses of WP_Comment_Query.
The prefix prevents ambiguity when joining against other tables.

Props willgladstone.
Fixes #32081.
Built from https://develop.svn.wordpress.org/trunk@32461


git-svn-id: http://core.svn.wordpress.org/trunk@32431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-08 19:45:26 +00:00
Gary Pendergast
364886a5be WPDB: When checking that a string can be sent to MySQL, we shouldn't use mb_convert_encoding(), as it behaves differently to MySQL's character encoding conversion.
Props mdawaffe, pento, nbachiyski, jorbin, johnjamesjacoby, jeremyfelt.

See #32165.


Built from https://develop.svn.wordpress.org/trunk@32364


git-svn-id: http://core.svn.wordpress.org/trunk@32335 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-06 03:00:25 +00:00
Dominik Schilling
64fc7294b6 Use HTTPS URLs for codex.wordpress.org.
see #27115.
Built from https://develop.svn.wordpress.org/trunk@32116


git-svn-id: http://core.svn.wordpress.org/trunk@32095 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-12 21:29:32 +00:00
Drew Jaynes
7bcbe0cce1 Remove an unnecessary inline @see tag and document the $wpdb global in two WP_Comment_Query methods.
See [31793]. See #31888.

Built from https://develop.svn.wordpress.org/trunk@32038


git-svn-id: http://core.svn.wordpress.org/trunk@32017 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-05 15:47:27 +00:00
Sergey Biryukov
46b5808530 Remove obsolete $wpdb reference from get_comments() docs.
props lamosty.
fixes #31748.
Built from https://develop.svn.wordpress.org/trunk@31870


git-svn-id: http://core.svn.wordpress.org/trunk@31849 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-24 15:43:30 +00:00
Drew Jaynes
04bfec64e4 Move the default arguments hash notation for WP_Comment_Query to the new constructor, where the argument definitions were moved in [31793].
Core style dictates that the default arguments should be documented in the same function or method where they are defined.

See [31793].
Fixes #24826.

Built from https://develop.svn.wordpress.org/trunk@31795


git-svn-id: http://core.svn.wordpress.org/trunk@31777 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-16 20:18:28 +00:00
Boone Gorges
0876c26025 Improve method consistency in WP_Comment_Query.
* Introduce a `__construct()` method, which can accept an array of query vars.
* Move query logic out of `query()` method and into a new `get_comments()` method.
* Ensure that `$this->comments` is set whenever `get_comments()` returns a value.
* Introduce a `parse_query()` method, where query vars are parsed with default values and the 'parse_comment_query' action is fired.

These changes bring `WP_Comment_Query` syntax closer to that of `WP_Query`.

Props westonruter, morganestes, boonebgorges.
Fixes #24826.
Built from https://develop.svn.wordpress.org/trunk@31793


git-svn-id: http://core.svn.wordpress.org/trunk@31775 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-16 14:24:32 +00:00
Boone Gorges
b3e11db20b Respect comment_date and comment_date_gmt params in wp_new_comment().
Props solarissmoke, oso96_2000.
Fixes #14279.
Built from https://develop.svn.wordpress.org/trunk@31615


git-svn-id: http://core.svn.wordpress.org/trunk@31596 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-05 03:00:26 +00:00
Scott Taylor
94bd0f93b8 wp_insert_comment() should be checking and setting $compacted, not the non-existent $post_data.
See [31263], #21212.

Built from https://develop.svn.wordpress.org/trunk@31553


git-svn-id: http://core.svn.wordpress.org/trunk@31534 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-26 05:38:24 +00:00
Boone Gorges
a224ff7d9b Improve 'orderby' syntax for WP_Comment_Query.
Since [29027], `WP_Query` has supported an array of values for the `$orderby`
parameter, with field names as array keys and ASC/DESC as the array values.
This changeset introduces the same syntax to `WP_Comment_Query`.

We leverage the new support for multiple ORDER BY clauses to fix a bug that
causes comments to be queried in an indeterminate order when sorting by the
default `comment_date_gmt` and comments share the same value for
`comment_date_gmt`. By always including a `comment_ID` subclause at the end of
the ORDER BY statement, we ensure that comments always have a unique fallback
for sorting.

This changeset also includes improvements paralleling those introduced to
`WP_Query` in [31312] and [31340], which allow `$orderby` to accept array keys
from specific `$meta_query` clauses. This change lets devs sort by multiple
clauses of an associated meta query. See #31045.

Fixes #30478. See #31265.
Built from https://develop.svn.wordpress.org/trunk@31467


git-svn-id: http://core.svn.wordpress.org/trunk@31448 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-16 14:10:27 +00:00
Gary Pendergast
dc0f9e0079 Comments: When a comment fails to insert, remove invalid characters from the email and URL fields, too.
See [31263], #21212


Built from https://develop.svn.wordpress.org/trunk@31264


git-svn-id: http://core.svn.wordpress.org/trunk@31245 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-21 23:18:22 +00:00
Gary Pendergast
8196266d26 Comments: When a comment fails to insert, remove any invalid characters and try again.
See #21212


Built from https://develop.svn.wordpress.org/trunk@31263


git-svn-id: http://core.svn.wordpress.org/trunk@31244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-21 23:04:23 +00:00
Gary Pendergast
b74f13511a 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


Built from https://develop.svn.wordpress.org/trunk@31195


git-svn-id: http://core.svn.wordpress.org/trunk@31176 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 02:39:23 +00:00
Sergey Biryukov
dcaa26c1de Add 'user_id' to the list of fields wp_update_comment() can update.
props jphase.
fixes #30307.
Built from https://develop.svn.wordpress.org/trunk@31172


git-svn-id: http://core.svn.wordpress.org/trunk@31153 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-13 06:48:22 +00:00
Sergey Biryukov
47b47c4980 Add 'comment_type' to the list of fields wp_update_comment() can update.
props desaiuditd.
fixes #30627.
Built from https://develop.svn.wordpress.org/trunk@31171


git-svn-id: http://core.svn.wordpress.org/trunk@31152 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-13 06:42:21 +00:00
Scott Taylor
61e12e00c1 In WP_Comment_Query, only allow __call() to run against ->get_search_sql().
See #30891.

Built from https://develop.svn.wordpress.org/trunk@31150


git-svn-id: http://core.svn.wordpress.org/trunk@31131 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-11 22:33:24 +00:00
Scott Taylor
60b0cd7943 The keyword elseif should be used instead of else if so that all control keywords look like single words.
This was a mess, is now standardized across the codebase, except for a few 3rd-party libs. 

See #30799.

Built from https://develop.svn.wordpress.org/trunk@31090


git-svn-id: http://core.svn.wordpress.org/trunk@31071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 07:05:25 +00:00
Boone Gorges
f1a4fd6e85 Support array values for post-related parameters in WP_Comment_Query.
Props nprasath002, c3mdigital, ianmjones.
Fixes #20006.
Built from https://develop.svn.wordpress.org/trunk@31015


git-svn-id: http://core.svn.wordpress.org/trunk@30996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-31 19:38:22 +00:00
Scott Taylor
e619abda6e Improve various @param docs for src/wp-includes/*.
See #30224.

Built from https://develop.svn.wordpress.org/trunk@30681


git-svn-id: http://core.svn.wordpress.org/trunk@30671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-01 01:34:24 +00:00
Drew Jaynes
bffe95d34c Docs Formatting: Backtick-escape inline code for all remaining dynamic hook docs in wp-includes/*.
Affects DocBlocks for the following hooks:
* `auth_post_meta_{$meta_key}`
* `term_links-$taxonomy`
* `customize_render_control_ . $this->id`
* `customize_render_panel_{$this->id}`
* `customize_render_section_{$this->id}`
* `customize_preview_{$this->id}`
* `customize_save_ . $this->id_data[ 'base' ]`
* `customize_update_ . $this->type`
* `customize_value_ . $this->id_data[ 'base' ]`
* `customize_sanitize_js_{$this->id}`
* `comment_form_field_{$name}`
* `comment_{$old_status}_to_{$new_status}`
* `comment_{$new_status}_{$comment->comment_type}`
* `extra_{$context}_headers`
* `get_template_part_{$slug}`
* `get_the_generator_{$type}`
* `get_{$adjacent}_post_join`
* `get_{$adjacent}_post_where`
* `get_{$adjacent}_post_sort`
* `{$adjacent}_post_rel_link`
* `{$adjacent}_post_link`
* `{$adjacent}_image_link`
* `blog_option_{$option}`
* `$permastructname . _rewrite_rules`
* `{$type}_template`
* `theme_mod_{$name}`
* `pre_set_theme_mod_$name`
* `current_theme_supports-{$feature}`
* `get_user_option_{$option}`
* `edit_user_{$field}`
* `pre_user_{$field}`
* `user_{$field}`

See #30552.

Built from https://develop.svn.wordpress.org/trunk@30656


git-svn-id: http://core.svn.wordpress.org/trunk@30646 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 12:10:23 +00:00
Dominik Schilling
7e0c893415 Comments: Use proper HTTP response codes for validation errors.
props miqrogroove, solarissmoke, mackensen.
fixes #11286.
Built from https://develop.svn.wordpress.org/trunk@30579


git-svn-id: http://core.svn.wordpress.org/trunk@30569 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-26 20:17:24 +00:00
Boone Gorges
e2339bdb1b Return an empty array from get_approved_comments() when $post_id is empty.
This behavior was broken when moving the internals to `WP_Comment_Query` in
[30098]. As a result, `get_approved_comments( 0 )` was fetching *all* approved
comments, causing performance issues.

Props dd32.
Fixes #30412.
Built from https://develop.svn.wordpress.org/trunk@30402


git-svn-id: http://core.svn.wordpress.org/trunk@30397 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-20 01:52:23 +00:00
Drew Jaynes
e7b465046a Cross-reference WP_Comment_Query::query() as the location for finding information on default arguments for WP_Comment_Query.
Also updates the return types on `get_comments()` and `get_approved_comments()`, as an integer can also be returned if the `$count` argument is true.

Fixes #30111.

Built from https://develop.svn.wordpress.org/trunk@30281


git-svn-id: http://core.svn.wordpress.org/trunk@30281 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-08 20:35:22 +00:00
Drew Jaynes
35e509b0c8 Document default arguments for WP_Comment_Query class as a hash notation.
Props boonebgorges, DrewAPicture.
See #30111.

Built from https://develop.svn.wordpress.org/trunk@30280


git-svn-id: http://core.svn.wordpress.org/trunk@30280 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-08 20:19:23 +00:00
Scott Taylor
7d7a8aa0eb Correct all @return unknown instances.
See #30224.

Built from https://develop.svn.wordpress.org/trunk@30202


git-svn-id: http://core.svn.wordpress.org/trunk@30202 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-03 06:17:22 +00:00
Scott Taylor
a23c230c01 In WP_Comment_Query, declare $query_vars and $comments as properties.
See #30224.

Built from https://develop.svn.wordpress.org/trunk@30182


git-svn-id: http://core.svn.wordpress.org/trunk@30182 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-03 03:08:22 +00:00
Drew Jaynes
66c47f29bb Correct references of @uses $wpdb in core documentation to use @global.
See #30191, [30105].
Fixes #30217.

Built from https://develop.svn.wordpress.org/trunk@30122


git-svn-id: http://core.svn.wordpress.org/trunk@30122 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-31 17:56:22 +00:00
Drew Jaynes
8fcc2b3dc8 Update the changelog for WP_Comment_Query::query() to reflect two more new arguments added in [30096].
[30096] introduced the `type__in` and `type__not_in` arguments. See #30111 for documentation on those new arguments.

Fixes #12668.

Built from https://develop.svn.wordpress.org/trunk@30110


git-svn-id: http://core.svn.wordpress.org/trunk@30110 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-30 03:06:24 +00:00
Drew Jaynes
54020268f7 Update the changelog for get_approved_comments() to reflect that the function was refactored to leverage WP_Comment_Query in [30098].
Also updates the `$args` parameter description with a reference to see `WP_Comment_Query` for argument information.

See #12668.

Built from https://develop.svn.wordpress.org/trunk@30109


git-svn-id: http://core.svn.wordpress.org/trunk@30109 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-30 02:51:23 +00:00
Drew Jaynes
f8657d5890 Remove redundant and erroneous @uses tag from most core inline documentation.
Per our inline documentation standards, no further use of the `@uses` tag is recommended as used and used-by relationships can be derived through other means. This removes most uses of the tag in core documentation, with remaining tags to be converted to `@global` or `@see` as they apply.

Fixes #30191.

Built from https://develop.svn.wordpress.org/trunk@30105


git-svn-id: http://core.svn.wordpress.org/trunk@30105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-30 01:05:24 +00:00
Boone Gorges
3be72a13de Use WP_Comment_Query to query comments in get_approved_comments().
Props dancameron.
See #12668.
Built from https://develop.svn.wordpress.org/trunk@30098


git-svn-id: http://core.svn.wordpress.org/trunk@30098 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-29 21:58:23 +00:00
Boone Gorges
56f55ea507 Better flexibility for 'type' in WP_Comment_Query.
* Add support for an array of values in 'type'.
* Introduce `type__in` parameter. This duplicates 'type' but is added for better consistency with other query classes.
* Introduce `type__not_in`.

Among other things, these changes will make it easier for plugin authors to
manage the appearance of custom comment types in various WP interfaces.

Props dancameron, mordauk.
See #12668.
Built from https://develop.svn.wordpress.org/trunk@30096


git-svn-id: http://core.svn.wordpress.org/trunk@30096 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-29 21:50:22 +00:00
Boone Gorges
beaa3f6928 Support an empty string passed as a status in WP_Comment_Query.
The changes in [30084] broke backward compatibility with interfaces that
manually passed an empty string for the value of 'status', such as on
wp-admin/edit-comments.php.

Fixes #29612.
Built from https://develop.svn.wordpress.org/trunk@30093


git-svn-id: http://core.svn.wordpress.org/trunk@30093 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-29 19:51:23 +00:00
Boone Gorges
3b90929c3e Support multiple 'status' values in WP_Comment_Query.
This change required turning the SQL concatenation into the generation of an
array, for greater flexibility.

Props karpstrucking, ebinnion.
Fixes #29612.
Built from https://develop.svn.wordpress.org/trunk@30084


git-svn-id: http://core.svn.wordpress.org/trunk@30084 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-29 02:22:23 +00:00
Boone Gorges
3179629853 Fix 'count' in WP_Comment_Query when using 'meta_query'.
Props heshiming, desaiuditd.
Fixes #23369.
Built from https://develop.svn.wordpress.org/trunk@30026


git-svn-id: http://core.svn.wordpress.org/trunk@30026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-26 16:46:19 +00:00
Boone Gorges
40ec420689 Allow ORDER BY in WP_Comment_Query::query() to be disabled.
Disable ORDER BY by passing boolean false, an empty array, or the string
'none' to the 'orderby parameter. This mirrors the behavior of `WP_Query`.

Props psycleuk.
Fixes #29902.
Built from https://develop.svn.wordpress.org/trunk@30004


git-svn-id: http://core.svn.wordpress.org/trunk@30004 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-24 02:51:19 +00:00
Boone Gorges
f780d0d09b Add unit tests for WP_Comment_Query 'orderby' param.
For better testability, the SQL string generated in `WP_Comment_Query::get_posts()`
is now stored as a 'request' property on the object.

See #29902.
Built from https://develop.svn.wordpress.org/trunk@30003


git-svn-id: http://core.svn.wordpress.org/trunk@30003 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-24 02:34:18 +00:00
Boone Gorges
304802d70d Use the comment API rather than direct SQL queries in comments_template().
`comments_template()` is used by most themes to display a post's comments. It
shows all comments that have been approved, and also shows all pending comments
by the current visitor (as determined by the comment cookies). However, the
comments API previously had no way of querying for "all comments that are
either approved, or are unapproved but written by foo@example.com". The
workaround was a direct SQL query: uncached, not subject to the same filters as
other comment queries, and just generally icky.

The new `include_unapproved` parameter for `WP_Comment_Query` accepts an array
of user IDs or email addresses. Pending comments associated with users in this
array will be included in query results, regardless of the value of the 'status'
parameter. In `comments_template()`, we leap from direct SQL queries to
`get_comments()` plus `include_unapproved', striving to put right what once
went wrong.

Props boonebgorges, simonwheatley, hardy101, jesin.
Fixes #19623.
Built from https://develop.svn.wordpress.org/trunk@29965


git-svn-id: http://core.svn.wordpress.org/trunk@29712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-19 19:39:20 +00:00
Boone Gorges
6c6a285091 Comment/post author in/not_in for WP_Comment_Query.
Props nofearinc, chriscct7.
Fixes #29885.
Built from https://develop.svn.wordpress.org/trunk@29935


git-svn-id: http://core.svn.wordpress.org/trunk@29687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-17 01:58:18 +00:00
Boone Gorges
7d8322aa65 WP_Comment_Query: comment__in, comment__not_in, post__in, post__not_in.
Props nofearinc, mordauk, boonebgorges

Fixes #25386
Built from https://develop.svn.wordpress.org/trunk@29808


git-svn-id: http://core.svn.wordpress.org/trunk@29574 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-02 01:41:16 +00:00
Mark Jaquith
0d3b83551f Use HTTPS URLs for core.trac.wordpress.org
see #27115
Built from https://develop.svn.wordpress.org/trunk@29788


git-svn-id: http://core.svn.wordpress.org/trunk@29560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-29 13:28:16 +00:00
Drew Jaynes
dd25a715b2 Improve and clarify inline commenting inside the check_comment() function.
Adds logical explanations of what some of the various comment checks are checking for, as well as some general cleanup and syntax fixes.

Fixes #29734.

Built from https://develop.svn.wordpress.org/trunk@29763


git-svn-id: http://core.svn.wordpress.org/trunk@29535 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-23 18:49:17 +00:00
Drew Jaynes
9824f40920 Improve documentation in the check_comments() docblock.
* Removes two duplicate sentences from the long description
* Tightens up phrasing elsewhere in the long description for specific checks
* Clarifies the parameter and return descriptions, and adds periods

See #29734.

Built from https://develop.svn.wordpress.org/trunk@29762


git-svn-id: http://core.svn.wordpress.org/trunk@29534 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-23 18:47:15 +00:00
Sergey Biryukov
c6b70a9320 Correct references to post-template.php in the inline docs.
props softmodeling.
fixes #29188.
Built from https://develop.svn.wordpress.org/trunk@29469


git-svn-id: http://core.svn.wordpress.org/trunk@29247 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-12 01:09:17 +00:00
Dominik Schilling
2e4be94288 Replace is_https_url() with 'https' === parse_url( $url, PHP_URL_SCHEME ).
see #28427, #28487.
Built from https://develop.svn.wordpress.org/trunk@29311


git-svn-id: http://core.svn.wordpress.org/trunk@29092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-27 17:46:17 +00:00
Drew Jaynes
3665b5a1a1 Add periods to short descriptions for magic methods added in [28501], [28521], and [28524].
See #22234 and #28885.

Built from https://develop.svn.wordpress.org/trunk@29165


git-svn-id: http://core.svn.wordpress.org/trunk@28949 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-14 01:12:14 +00:00
Drew Jaynes
c00e3d9a46 Fill out inline documentation for the __call() magic method added to the WP_Comment_Query class in [28519].
See #22234 and #28885.

Built from https://develop.svn.wordpress.org/trunk@29162


git-svn-id: http://core.svn.wordpress.org/trunk@28946 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-14 00:48:14 +00:00
Andrew Nacin
ba59fac708 WP_Comment_Query: Add fields => 'ids' query var.
props mordauk.
fixes #28434.

Built from https://develop.svn.wordpress.org/trunk@29045


git-svn-id: http://core.svn.wordpress.org/trunk@28833 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-09 18:16:15 +00:00
Sergey Biryukov
c8d8610a15 Avoid a PHP notice in wp_new_comment() if user ID is not passed.
see #23231.
Built from https://develop.svn.wordpress.org/trunk@28922


git-svn-id: http://core.svn.wordpress.org/trunk@28721 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-30 11:03:14 +00:00
Sergey Biryukov
c8adae8ec7 Normalize 'user_id' and 'user_ID' values in wp_new_comment() before passing the comment data to 'preprocess_comment' filter.
props dkotter.
fixes #23231.
Built from https://develop.svn.wordpress.org/trunk@28915


git-svn-id: http://core.svn.wordpress.org/trunk@28714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-30 00:41:16 +00:00
John Blackbourn
60ff3a61f9 Conditionally set the the secure flag on the test cookie, post password cookie, settings cookies, and comment author cookies depending on whether the front end and/or admin area are served over https. Fixes #28427
Built from https://develop.svn.wordpress.org/trunk@28895


git-svn-id: http://core.svn.wordpress.org/trunk@28694 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-29 13:25:16 +00:00
Scott Taylor
e5e8a83cf4 Don't use variable variables in WP_Comment_Query::query().
See #27881.

Built from https://develop.svn.wordpress.org/trunk@28738


git-svn-id: http://core.svn.wordpress.org/trunk@28552 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-11 17:58:14 +00:00
Scott Taylor
5219bbbbc9 In WP_Comment_Query::get_search_sql(), don't double-like-escape.
Props miqrogroove.
See #10041.

Built from https://develop.svn.wordpress.org/trunk@28720


git-svn-id: http://core.svn.wordpress.org/trunk@28534 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-10 02:20:16 +00:00
Scott Taylor
05eeb16e30 Replace all uses of like_escape() with $wpdb->esc_like().
Props miqrogroove.
See #10041.

Built from https://develop.svn.wordpress.org/trunk@28712


git-svn-id: http://core.svn.wordpress.org/trunk@28528 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-10 00:44:15 +00:00
Sergey Biryukov
02657dcd66 wp_insert_comment() and wp_new_comment() should check if the comment was successfully inserted into the database.
props pento.
fixes #28254.
Built from https://develop.svn.wordpress.org/trunk@28672


git-svn-id: http://core.svn.wordpress.org/trunk@28490 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-05 04:38:14 +00:00
Drew Jaynes
3724252959 Ensure $post_id is documented as optional where applicable.
See #28388.

Built from https://develop.svn.wordpress.org/trunk@28654


git-svn-id: http://core.svn.wordpress.org/trunk@28472 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-03 04:44:16 +00:00
Scott Taylor
40fab485aa Add missing access modifiers to methods in WP_Comment_Query. Add a magic __call() method for BC.
See #27881, #22234.

Built from https://develop.svn.wordpress.org/trunk@28519


git-svn-id: http://core.svn.wordpress.org/trunk@28345 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-19 06:19:14 +00:00
Scott Taylor
a39aecc9b1 The cache key for comments in WP_Comment_Query::query() needs to do wp_array_slice_assoc( $this->query_vars, array_keys( $defaults ) ) instead of compact( array_keys( $defaults ) ). The latter assumes all of those variables are still floating around.
See #22400.


Built from https://develop.svn.wordpress.org/trunk@28460


git-svn-id: http://core.svn.wordpress.org/trunk@28287 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-16 21:09:14 +00:00
Scott Taylor
0aafc8f874 (ACTUALLY) Eliminate use of extract() in WP_Comment_Query::query().
See #22400.

Built from https://develop.svn.wordpress.org/trunk@28459


git-svn-id: http://core.svn.wordpress.org/trunk@28286 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-16 20:52:14 +00:00
Scott Taylor
4f57a231c5 Eliminate use of extract() in WP_Comment_Query::query().
See #22400.

Built from https://develop.svn.wordpress.org/trunk@28458


git-svn-id: http://core.svn.wordpress.org/trunk@28285 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-16 19:33:14 +00:00
Scott Taylor
14ba67c38d Eliminate use of extract() in wp_insert_comment().
See #22400.

Built from https://develop.svn.wordpress.org/trunk@28457


git-svn-id: http://core.svn.wordpress.org/trunk@28284 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-16 18:52:16 +00:00
Scott Taylor
2a3548fe70 Eliminate use of extract() in wp_allow_comment().
See #22400.

Built from https://develop.svn.wordpress.org/trunk@28437


git-svn-id: http://core.svn.wordpress.org/trunk@28264 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-15 18:10:15 +00:00
Scott Taylor
a15d498d1a Eliminate the use of extract() in wp_update_comment(). All unit tests pass.
See #22400.

Built from https://develop.svn.wordpress.org/trunk@28427


git-svn-id: http://core.svn.wordpress.org/trunk@28254 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-15 06:37:15 +00:00
Scott Taylor
7eeafa3537 In wp_set_comment_status(), the default case returns, so no default value for $status is needed.
See #27882.


Built from https://develop.svn.wordpress.org/trunk@28324


git-svn-id: http://core.svn.wordpress.org/trunk@28152 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-06 21:17:15 +00:00
Drew Jaynes
8161668689 Ensure the wp_set_comment_status action hook is only documented once.
See #26869.

Built from https://develop.svn.wordpress.org/trunk@28214


git-svn-id: http://core.svn.wordpress.org/trunk@28044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-25 06:55:14 +00:00
Andrew Nacin
d24a109288 Revert [27115] and let cache backends handle the stripping of spaces in cache keys as necessary.
microtime() returns greater precision than microtime(true).

see #27000, #23448, #26903, #14485.

Built from https://develop.svn.wordpress.org/trunk@27300


git-svn-id: http://core.svn.wordpress.org/trunk@27153 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-26 22:05:13 +00:00
Drew Jaynes
cb8951b0b3 Remove all @package and @subpackage PHPDoc tags not at the file- or class-levels in core.
See #27200.

Built from https://develop.svn.wordpress.org/trunk@27262


git-svn-id: http://core.svn.wordpress.org/trunk@27119 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-25 17:14:14 +00:00
Andrew Nacin
7387504854 Allow user_id to be an array of IDs in WP_Comment_Query.
props mordauk.
fixes #27064.

Built from https://develop.svn.wordpress.org/trunk@27258


git-svn-id: http://core.svn.wordpress.org/trunk@27115 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-25 16:35:13 +00:00
Sergey Biryukov
ab8847316c Correct return values for update_metadata() and related functions.
fixes #21864.
Built from https://develop.svn.wordpress.org/trunk@27191


git-svn-id: http://core.svn.wordpress.org/trunk@27050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-18 21:36:14 +00:00
Andrew Nacin
084a7b50cd Use a float for last_changed microtime cache values.
microtime() by default returns a string with a space, which isn't allowed for keys in some cache backends.

props _jameslee, drozdz.
fixes #27000. see #23448.

Built from https://develop.svn.wordpress.org/trunk@27115


git-svn-id: http://core.svn.wordpress.org/trunk@26982 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-07 08:14:12 +00:00
Scott Taylor
a6b3bced06 get_comment(), wp_get_post_revision(), and get_term() all used to return by reference. Because of this, $null was set to null so the return value would be a variable where applicable. This has not been necessary since [21792], so the $nulls have been removed.
Props toszcze.
Fixes #24768.


Built from https://develop.svn.wordpress.org/trunk@27057


git-svn-id: http://core.svn.wordpress.org/trunk@26930 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-01-29 06:46:12 +00:00
Scott Taylor
ad211ca06a Add Unit Tests for get_comment_pages_count(). Fix a notice caused when $wp_query->comments is not set in that function.
Props mdbitz, markjaquith.
Fixes #20633.


Built from https://develop.svn.wordpress.org/trunk@27055


git-svn-id: http://core.svn.wordpress.org/trunk@26928 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-01-29 05:17:12 +00:00
Drew Jaynes
1f5f0fcd33 Remove some @uses references to apply_filters and do_action rendered redundant by hook documentation.
Built from https://develop.svn.wordpress.org/trunk@26867


git-svn-id: http://core.svn.wordpress.org/trunk@26753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-24 16:43:14 +00:00
Sergey Biryukov
16373e224d Correct @since values. see #25522.
Built from https://develop.svn.wordpress.org/trunk@26492


git-svn-id: http://core.svn.wordpress.org/trunk@26386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-01 01:25:10 +00:00
Drew Jaynes
e6d92061a1 Inline documentation for hooks in wp-includes/comment.php.
comment.php, a.k.a. "lots 'o hooks".

Props swissspidy for the initial patch. Props danieldudzic, kpdesign, and DrewAPicture.
Fixes #25522.

Built from https://develop.svn.wordpress.org/trunk@26491


git-svn-id: http://core.svn.wordpress.org/trunk@26385 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-01 01:12:11 +00:00
Drew Jaynes
223a2c7138 Inline documentation for the following filter hooks in wp-includes/pluggable.php:
* `comment_notification_recipients`
* `comment_notification_notify_author`

Also removes some generic `@uses` tags from various related doc blocks.

Props markjaquith.
Fixes #25699.

Built from https://develop.svn.wordpress.org/trunk@26388


git-svn-id: http://core.svn.wordpress.org/trunk@26288 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-26 04:10:09 +00:00
Mark Jaquith
c2cdbf9648 Fix comment_notification_recipients filter behavior so that it is still respected even on comments left by the post author
The code was bailing on this-is-a-comment-on-your-own-post detection, ignoring additional recipients. Now:

* Logic check is done within `wp_notify_postauthor()`
* Logic check is overridable via `comment_notification_notify_author` filter (default still false)
* The code doesn't bail on comment-on-own-post detection, but just removes the author from the array
* The code instead now bails if the recipients list is empty, so `comment_notification_recipients` works properly

props ethitter.
fixes #25699

Built from https://develop.svn.wordpress.org/trunk@26367


git-svn-id: http://core.svn.wordpress.org/trunk@26268 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-25 01:47:10 +00:00
Peter Westwood
bca9252522 Deprecate the second argument for wp_notify_postauthor because it is unecessary. Fixes #17862 props scribu and wonderboymusic.
Built from https://develop.svn.wordpress.org/trunk@26358


git-svn-id: http://core.svn.wordpress.org/trunk@26259 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-24 16:26:10 +00:00
Sergey Biryukov
8d659b278c Fix docblock formatting. fixes #25893.
Built from https://develop.svn.wordpress.org/trunk@26081


git-svn-id: http://core.svn.wordpress.org/trunk@26001 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-11 13:32:10 +00:00
Andrew Nacin
5361a8abca Spell out duplicate hook locations.
props DrewAPicture.
fixes #25658.

Built from https://develop.svn.wordpress.org/trunk@25868


git-svn-id: http://core.svn.wordpress.org/trunk@25868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-24 22:59:20 +00:00
Andrew Nacin
8ae8e01b67 Remove the old wp_auto_updates_maybe_update cron event. Schedule the new wp_maybe_auto_update event at 7 a.m. and 7 p.m. in the site's timezone.
see #27704.

Built from https://develop.svn.wordpress.org/trunk@25825


git-svn-id: http://core.svn.wordpress.org/trunk@25825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-24 22:53:14 +00:00
Andrew Nacin
74488bdcb0 Spell out duplicate hook locations.
props DrewAPicture.
fixes #25658.

Built from https://develop.svn.wordpress.org/trunk@25868


git-svn-id: http://core.svn.wordpress.org/trunk@25780 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-22 17:22:11 +00:00
Scott Taylor
daa4b531e8 Fix several esoteric errors related to AJAX unit tests for comments:
* `wp_ajax_get_comments()` relies on the `$post_id` global - even though `$_POST['p']` is passed to every action in the test methods. If `$post_id` is still lingering in between tests and doesn't match `p` in the request, the cap check might pass while the queries for comments will blow up. I added `unset( $GLOBALS['post_id'] )` to `Tests_Ajax_GetComments::setUp()`.
* If the global `$post_id` is empty, but `$_REQUEST['p']` is not, `$post_id` is now set to `absint( $_REQUEST['p'] )` and sanity-checked in `wp_ajax_get_comments()`.
* `map_meta_cap()` always assumes that `get_comment()` succeeds when checking for the `edit_comment` cap. It doesn't. I added sanity checks in a few places where it will break early if `get_post()` or `get_comment()` are empty.
* `wp_update_comment()` always assumes `get_comment()` succeeds. It doesn't. I added a check for empty.

All AJAX unit tests run and pass in debug mode. All general unit tests pass against these changes.

Fixes #25282.


Built from https://develop.svn.wordpress.org/trunk@25438


git-svn-id: http://core.svn.wordpress.org/trunk@25360 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-14 18:36:09 +00:00
Scott Taylor
a563a5b2fa Replace the ancient phpfreaks.com RegEx to extract urls to ping with a more robust matcher. URLs with commas and things like &amp; were not being pinged. The new matcher even works for most IDN URLs. Adds unit tests.
Fixes #9064.


Built from https://develop.svn.wordpress.org/trunk@25313


git-svn-id: http://core.svn.wordpress.org/trunk@25275 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-10 03:18:08 +00:00
Andrew Nacin
41f1cd687b WP_Date_Query.
props Viper007Bond.
see #18694.

Built from https://develop.svn.wordpress.org/trunk@25139


git-svn-id: http://core.svn.wordpress.org/trunk@25119 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-27 16:39:09 +00:00
Andrew Nacin
4493b8c97a Return 1 from get_comment_pages_count() when pagination is disabled.
props obenland.
fixes #17778.

Built from https://develop.svn.wordpress.org/trunk@25126


git-svn-id: http://core.svn.wordpress.org/trunk@25106 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-26 18:52:08 +00:00
Andrew Nacin
6bb179d880 Remove redundant sentence in the docblock of get_comment(). props jdgrimes, fixes #24904.
git-svn-id: http://core.svn.wordpress.org/trunk@24984 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-05 22:08:17 +00:00
Andrew Nacin
21a1fe8d4b Use wp_safe_remote_request() and friends instead of reject_unsafe_urls = true.
fixes #24646.



git-svn-id: http://core.svn.wordpress.org/trunk@24917 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-31 06:52:13 +00:00
Andrew Nacin
8d65dc2469 Use wp_slash() in places where we improperly used the DB API instead. see #21767.
git-svn-id: http://core.svn.wordpress.org/trunk@24713 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-16 14:19:03 +00:00
Sergey Biryukov
58c364947f PHPDoc fixes and additions. fixes #24616.
git-svn-id: http://core.svn.wordpress.org/trunk@24490 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-06-21 12:45:11 +00:00
Andrew Nacin
96ee267343 Better validation of the URL used in core HTTP requests.
git-svn-id: http://core.svn.wordpress.org/trunk@24480 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-06-21 06:07:47 +00:00
Ryan Boren
a2b4bc456f * Introduce wp_parse_post_content() and use it in setup_postdata(), get_the_content(), and get_the_remaining_content().
* Add a post ID argument to the_content(), get_the_content(), the_remaining_content(), and get_the_remaining_content().
* Pass the post ID to the the_content filter.
* Remove the format_pages global.
* Declare format_content and split_content as vars in WP_Post.
* phpdoc for the the_content filter that documents the new ID argument and denotes it as not-so-portable.

Props gcorne, DrewAPicture, duck_, aaroncampbell
see #24330


git-svn-id: http://core.svn.wordpress.org/trunk@24301 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-20 11:05:50 +00:00
Ryan Boren
7a1bc5769e Check for empty user agent to avoid notice.
Props sergej.mueller
fixes #22979


git-svn-id: http://core.svn.wordpress.org/trunk@24275 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-16 12:06:36 +00:00
Sergey Biryukov
415a5c60da * Pass ellipsis as a parameter to wp_html_excerpt() instead of appending it manually.
* Consolidate the logic to avoid appending ellipsis if the entire string is shown.
* Show ellipsis after truncated filenames and post titles.

props solarissmoke, bpetty, SergeyBiryukov. fixes #11446.

git-svn-id: http://core.svn.wordpress.org/trunk@24214 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-09 00:22:02 +00:00
Sergey Biryukov
57c10eadbb Use ellipsis instead of three dots. props tjsingleton, jordie23, wojtek.szkutnik, DrewAPicture, SergeyBiryukov. see #8714.
git-svn-id: http://core.svn.wordpress.org/trunk@24207 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-08 21:27:31 +00:00
Ryan Boren
375cb66409 Use prepare() for the duplicate comment query in wp_allow_comment().
see #21767


git-svn-id: http://core.svn.wordpress.org/trunk@23973 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-12 13:25:16 +00:00
Ryan Boren
15a06a35ab Use wp_unslash() instead of stripslashes() and stripslashes_deep(). Use wp_slash() instead of add_magic_quotes().
see #WP21767


git-svn-id: http://core.svn.wordpress.org/trunk@23591 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-03 16:30:38 +00:00
Sergey Biryukov
4847fe6efc Make sure the pings are only sent once per URL for a given post. props dllh. fixes #23217.
git-svn-id: http://core.svn.wordpress.org/trunk@23571 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-01 17:39:52 +00:00
Ryan Boren
43a7e695e9 Revert 23416, 23419, 23445 except for wp_reset_vars() changes. We are going a different direction with the slashing cleanup, so resetting to a clean slate. see #21767
git-svn-id: http://core.svn.wordpress.org/trunk@23554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-01 16:28:40 +00:00