Commit Graph

38 Commits

Author SHA1 Message Date
John Blackbourn 9ac95f7650 Docs: Improve the documentation for parameters which accept `OBJECT`, `ARRAY_A`, and `ARRAY_N` as parameters.
See #37770


git-svn-id: https://develop.svn.wordpress.org/trunk@39188 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-09 22:59:02 +00:00
Joe McGill 142fefb269 Post Thumbnails: Prevent post thumbnail previews from spilling into other images.
After [38118], when previewing a page with a secondary loop, all post
thumbnails would be filtered to display the post thumbnail for the
page being previewed. This ensures `_wp_preview_post_thumbnail_filter()`
is only applied if the `$post_id` of the post meta being filtered is
equal to the post or page being previewed.

Props swisspidy, joemcgill.
Fixes #37697.

git-svn-id: https://develop.svn.wordpress.org/trunk@38433 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-29 12:24:09 +00:00
Joe McGill 2586eeeeca Post Thumbnails: Only update featured images when saving a post.
Previously, changing the post thumbnail of a published post in the edit screen
would immediately apply the change, rather than waiting for the post to be
saved before applying the update. This could lead to someone unintentionally
editing the post thumbnail on a published post, and made it impossible to
preview changes to post thumbnails on published posts before saving the change.

This introduces a new Ajax handler, `wp_ajax_get_post_thumbnail_html()` to
retrieve the HTML for the post thumbnail meta box without updating the post
meta value for `_thumbnail_id`. It also allows post thumbnail changes to be
previewed by passing the `_thumbnail_id` as a query variable to the preview
screen and adding a new filter, `_wp_preview_post_thumbnail_filter()`, which
gets applied to `get_post_metadata` during the post preview process.

Props flixos90.
Fixes #12922.

git-svn-id: https://develop.svn.wordpress.org/trunk@38118 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-20 16:23:36 +00:00
Dominik Schilling (ocean90) 206380180e Text Changes: Unify permission error messages.
The new format looks like "Sorry, you are not allowed to <action>.". This provides a consistent experience for all error messages related to missing permissions. It also reduces the number of similar strings and allows translators to provide a consistent style in their language.

Props ramiy, Presskopp.
Fixes #34521.

git-svn-id: https://develop.svn.wordpress.org/trunk@37914 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-29 15:15:40 +00:00
Pascal Birchler 048bb7b250 Revisions: Remove unused post meta data during database upgrade.
Introduced in [23811], WordPress displayed some additional information for restored revisions for a short period of time. This was removed again in [25194], but the meta data was still being saved unnecessarily.

After 3 years and no plugins ever using this meta data, it's time to stop collecting it.

Fixes #36526.

git-svn-id: https://develop.svn.wordpress.org/trunk@37854 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-23 14:31:15 +00:00
Drew Jaynes 9531107084 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.

Fixes #36921.


git-svn-id: https://develop.svn.wordpress.org/trunk@37544 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-23 19:01:40 +00:00
Drew Jaynes d11f7ed391 Docs: Standardize filter docs in remaining wp-includes/* files to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.


git-svn-id: https://develop.svn.wordpress.org/trunk@37518 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-22 18:49:05 +00:00
Sergey Biryukov 45017abf02 Revisions: Clean up `_wp_post_revision_fields()`:
* Move the array processing to a new function, `_wp_post_revision_data()`.
* Make both functions accept a post array or a `WP_Post` object. 
* Always apply the `_wp_post_revision_fields` filter and pass the post data to it.

Fixes #13382.

git-svn-id: https://develop.svn.wordpress.org/trunk@36659 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-24 00:43:31 +00:00
Drew Jaynes e635606cc1 Docs: Add a missing notation for the `$args` parameter in the DocBlock for `wp_get_post_revisions()`.
See #32246.


git-svn-id: https://develop.svn.wordpress.org/trunk@35981 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-16 23:17:39 +00:00
Gary Pendergast 3025e87fa2 The the Docs: Fix the the dittography
Sometimes, it's easy to to type the the same word twice, especially if if it's a simple word. We probably shouldn't do do do (do do do doo) it, though.

(I've excluded external libs from this change.)

Fixes #34885.



git-svn-id: https://develop.svn.wordpress.org/trunk@35793 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-06 21:22:10 +00:00
Sergey Biryukov 54c840dc04 Docs: Correct description for `_wp_post_revision_fields()` arguments.
See #13382.

git-svn-id: https://develop.svn.wordpress.org/trunk@35352 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-22 12:16:48 +00:00
Drew Jaynes 0cb7c0bd9f Docs: Add missing descriptions for the `$wpdb` global in DocBlocks all the places.
See #32246.


git-svn-id: https://develop.svn.wordpress.org/trunk@35170 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-14 23:43:10 +00:00
John Blackbourn 88779c7b67 Revert [34917] until the broken test is fixed.
See #13382


git-svn-id: https://develop.svn.wordpress.org/trunk@34925 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-08 01:03:39 +00:00
John Blackbourn ee251924b3 Pass the `$post` parameter to the `_wp_post_revision_fields` filter. This provides more context to the filter, which allows for different fields to be displayed on the revisions screen depending on the post.
The `_wp_post_revision_fields()` function now also accepts a `WP_Post` object (in addition to an array of post fields) to facilitate this change.

Fixes #13382
Props adamsilverstein


git-svn-id: https://develop.svn.wordpress.org/trunk@34917 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 21:52:18 +00:00
Scott Taylor 3b8c5529cb `foreach` is a statement, not a function.
See #33491.


git-svn-id: https://develop.svn.wordpress.org/trunk@33734 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-25 20:27:56 +00:00
Scott Taylor 296c559baf `if` is a statment, not a function.
See #32444.


git-svn-id: https://develop.svn.wordpress.org/trunk@32800 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-16 20:00:15 +00:00
Scott Taylor 9c42e158bc `$status` shouldn't be loosely compared to `true` in `wp_xmlrpc_server::wp_deleteComment()`.
`$initial` shouldn't be loosely compared to `true` in `get_calendar()`.
`current_user_can()` shouldn't be loosely compared to `false` in `kses_init()`
`$get_all` shouldn't be loosely compared to `true` in `get_blog_details()`.
`is_array()` and `in_array()` shouldn't be loosely compared in `wpmu_validate_user_signup()`.
`$result` should by strictly compared in `check_ajax_referer()`.
`wp_verify_nonce()` should by strictly compared in `_show_post_preview()`.
`is_user_logged_in()` should not be loosly compared against `false` in `wp-signup.php`.

See #32444.


git-svn-id: https://develop.svn.wordpress.org/trunk@32733 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-12 17:47:16 +00:00
Scott Taylor c8a44d437a Add `@static*` annotations where they are missing.
Initialize all static vars that are not, most to `null`.

See #32444.


git-svn-id: https://develop.svn.wordpress.org/trunk@32650 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-29 15:42:40 +00:00
Scott Taylor 496b36db35 Add missing doc blocks to `revision.php`.
Clarify `@return` values where necessary.
In `wp_delete_post_revision()`, `wp_delete_post()` doesn't return `WP_Error`, so that check can be removed.
`wp_revisions_to_keep()` always returns an `int`, so `wp_revisions_enabled()` can use strict comparison.
 
See #32444.


git-svn-id: https://develop.svn.wordpress.org/trunk@32621 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-27 18:37:29 +00:00
Dominik Schilling (ocean90) cfa32bc1d7 Merge similar error strings for invalid data.
props pavelevap.
fixes #32329.

git-svn-id: https://develop.svn.wordpress.org/trunk@32477 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-09 21:08:57 +00:00
Scott Taylor ee388b9852 Improve various `@param` docs.
See #30224.


git-svn-id: https://develop.svn.wordpress.org/trunk@30673 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-30 22:55:08 +00:00
Drew Jaynes (DrewAPicture) 67322ab8f7 4.1 Docs Audit: Remove a duplicate word from a parameter description in the DocBlock for the `wp_save_post_revision_post_has_changed` hook.
See #30469.


git-svn-id: https://develop.svn.wordpress.org/trunk@30621 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-28 12:18:49 +00:00
Drew Jaynes (DrewAPicture) 72cc949b5d Fix the syntax for some status-related documentation introduced in [30155].
* Variables in DocBlocks should be backtick-escaped
* Parameter and return types should be as specific as possible
* `@param` types and variables should align with each other, but not intentionally with the `@return` description

See #30230.


git-svn-id: https://develop.svn.wordpress.org/trunk@30284 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-08 20:55:14 +00:00
Scott Taylor c8acddfdc8 Improve some `post_status`-related documentation.
Props ericlewis.
See #30230.


git-svn-id: https://develop.svn.wordpress.org/trunk@30155 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 20:19:26 +00:00
Drew Jaynes (DrewAPicture) c614b0f91a Correct two parameter types in the `wp_save_post_revision_check_for_changes` hook documentation.
Props johnbillion.
Fixes #30185.


git-svn-id: https://develop.svn.wordpress.org/trunk@30119 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-30 23:49:43 +00:00
Drew Jaynes (DrewAPicture) 3cc10d77a0 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.


git-svn-id: https://develop.svn.wordpress.org/trunk@30105 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-30 01:04:55 +00:00
John Blackbourn 32d38fc080 Introduce some actions and filters which aid plugins in revisioning post meta.
* `wp_save_post_revision_post_has_changed` filter which can be used to determine if a post has been changed, and therefore if a revision should be created for a post.
 * `wp_get_revision_ui_diff` filter which can be used to filter the fields displayed in the post revision diff UI.
 * `wp_creating_autosave` action which is fired just before an autosave is created.

See #20564.
Props mattheu, adamsilverstein.


git-svn-id: https://develop.svn.wordpress.org/trunk@30091 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 19:01:15 +00:00
Drew Jaynes (DrewAPicture) b1b454c7a0 Remove backticks on `$post` variables in some short parameter descriptions.
See [28653], [28654].
See #28388.


git-svn-id: https://develop.svn.wordpress.org/trunk@28976 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-03 19:27:54 +00:00
Drew Jaynes (DrewAPicture) d068c888f3 Ensure `$post_id` is documented as optional where applicable.
See #28388.


git-svn-id: https://develop.svn.wordpress.org/trunk@28654 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-03 04:43:47 +00:00
Sergey Biryukov 5edb7a633f Remove unnecessary array_reverse() from wp_get_post_revisions().
WP_Query properly handles multiple 'orderby' values since [28541].

fixes #26042.

git-svn-id: https://develop.svn.wordpress.org/trunk@28543 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-22 18:50:11 +00:00
Scott Taylor 0baa73f2e4 Apply `order` to each passed value for `orderby` in `WP_Query`:
* Since `orderby` in `WP_Query` can accept space-delimited sets, yet only one `order` value: when multiple values are passed (and `DESC` is the order), the default sort order `ASC` is being applied to all values before the last in the set.
* There is a unit test that sporadically fails since 3.6 in `tests/post/revision` due to multiple posts having the same `post_date` from being added so rapidly
* When ordering revisions in `wp_get_post_revisions()`, order by `post_date ID`
* Change the `order` value in `wp_get_post_revisions()` to `ASC`. This will produce SQL like: `ORDER BY $wpdb->posts.post_date ASC, $wpdb->posts.ID ASC`. Previously, this would have produced SQL like: `ORDER BY $wpdb->posts.post_date DESC`, and with the addition of ` ID`: `ORDER BY $wpdb->posts.post_date ASC, $wpdb->posts.ID DESC`. Clearly, wrong. The original SQL produced: `ORDER BY $wpdb->posts.post_date DESC`. As such, return the reversions in reverse order using `array_reverse()`. Not doing so would break "Preview Changes."
* Add unit tests to assert that all of this works.
* All existing unit tests pass with the change to ordering multiple `orderby`s in `WP_Query`.
* In the future, we should support independent `order` for each `orderby`, see #17065.

Props SergeyBiryukov, wonderboymusic.
Fixes #26042.


git-svn-id: https://develop.svn.wordpress.org/trunk@28541 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-22 18:18:11 +00:00
Scott Taylor f63b6cde3a In `wp-includes/revision.php` - remove dead code:
* In `wp_get_post_autosave()`, `break` is unreachable after `return`
* In `_wp_put_post_revision()`, `$post_id` is set then never used.

See #27882.


git-svn-id: https://develop.svn.wordpress.org/trunk@28334 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-07 03:37:45 +00:00
Drew Jaynes (DrewAPicture) 16feaee19a Inline documentation for hooks in wp-includes/revision.php.
Props adamsilverstein, DrewAPicture.
Fixes #26979.


git-svn-id: https://develop.svn.wordpress.org/trunk@27699 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-25 08:59:55 +00:00
Scott Taylor 2583c954b9 Revert [27184] until `WP_Query` is patched to apply `order` to each space-delimited `orderby` value properly.
See #26042.



git-svn-id: https://develop.svn.wordpress.org/trunk@27683 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-24 14:45:44 +00:00
Scott Taylor db1c44bc42 `wp_get_post_revisions()` should have a default `orderby` of `date ID` to tie-break rapidly added revisions - namely, when unit tests are run. There is a test that occasionally fails when running all tests, and always fails when running `phpunit tests/phpunit/tests/post/revisions.php `. This fixes that.
Fixes #26042.



git-svn-id: https://develop.svn.wordpress.org/trunk@27184 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-17 21:22:25 +00:00
Scott Taylor 13c1dd0004 `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 `$null`s have been removed.
Props toszcze.
Fixes #24768.



git-svn-id: https://develop.svn.wordpress.org/trunk@27057 602fd350-edb4-49c9-b593-d223f7449a82
2014-01-29 06:45:54 +00:00
Andrew Ozz 9aba880b53 Autosave: refactor autosave.js, use heartbeat for transport and move all "Add/Edit Post" related functionality to post.js. See #25272.
git-svn-id: https://develop.svn.wordpress.org/trunk@26995 602fd350-edb4-49c9-b593-d223f7449a82
2014-01-22 04:55:37 +00:00
Andrew Nacin b43712e0f7 New develop.svn.wordpress.org repository based on the old core.svn repository.
* All WordPress files move to a src/ directory.
 * New task runner (Grunt), configured to copy a built WordPress to build/.
 * svn:ignore and .gitignore for Gruntfile.js, wp-config.php, and node.js.
 * Remove Akismet external from develop.svn. Still exists in core.svn.
 * Drop minified files from src/. The build process will now generate these.

props koop.
see #24976.

and see http://wp.me/p2AvED-1AI.



git-svn-id: https://develop.svn.wordpress.org/trunk@25001 602fd350-edb4-49c9-b593-d223f7449a82
2013-08-07 05:25:25 +00:00