Commit Graph

464 Commits

Author SHA1 Message Date
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