Boone Gorges
829ae5f4ce
Fail gracefully when checking mapped cap against unregistered post type.
...
Post type objects are reponsible for mapping their capabilities to core caps.
As a result, when the post type is no longer registered, the caps are no
longer mapped. This causes problems when a post is left in the database after
the post type is no longer present, and WP does an 'edit_post' or other cap
check against it: a PHP notice is thrown, and the cap check always fails.
As a more graceful fallback, we map all post-type-dependent caps onto
'edit_others_posts', which allows highly privileged users to be able to
access orphaned content (such as comments belonging to disabled post types),
while minimizing the possibility of unintended privilege escalation.
We also add a `_doing_it_wrong()` notice, so that developers and site
administrators are aware that the cap mapping is failing in the absence of
the registered post type.
Props mitchoyoshitaka, DrewAPicture, imath, codeelite, boonebgorges, nofearinc, SergeyBiryukov, jorbin, dlh.
Fixes #16956 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34091 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 21:26:57 +00:00
Boone Gorges
4fdfdb6078
Use stricter sanitization for meta query clause keys.
...
By forcing all clause keys to be strings, we make it possible to use strict
comparison when validating values of 'orderby' as passed to `WP_Query`. This
eliminates situations where the presence of numeric clause keys could result
in an improperly validated 'orderby' value.
Props nikolov.tmw.
Fixes #32937 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34090 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 21:05:14 +00:00
Boone Gorges
dcbd8c6c3d
Allow `setup_postdata()` to accept a post ID.
...
Previously, it accepted only a full post object.
Props sc0ttclark, mordauk, wonderboymusic.
Fixes #30970 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34089 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 20:57:06 +00:00
Boone Gorges
4ebab4dc16
Remove extraneous table join in `get_adjacent_post()`.
...
Since [29248], a table join has not been necessary to process the
`$excluded_terms` parameter of `get_adjacent_post()`. Aside from adding extra
overhead, this join meant that post records that don't have any corresponding
rows in `wp_term_relationships` were erroneously excluded from results.
Fixes #32833 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34088 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 20:33:07 +00:00
Dominik Schilling (ocean90)
ed36c88b73
Revert [34013] and parts of [33970].
...
* `_WP_Editors::wp_mce_translation()` can't be changed without changing strings in TinyMCE and plugins.
* `\u2026` is escaped by `json_encode()` to `\\u2026`, makes `\u2026` visible in our UI.
See #32875 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34087 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 20:02:43 +00:00
Dominik Schilling (ocean90)
07ea6a2334
Themes: Don't use HTML entities for placeholders.
...
See #32875 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34086 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 19:47:53 +00:00
Scott Taylor
db3a7133f2
In `wp_insert_post()`, when setting `$post_author`, use `isset()` instead of `! empty()` to allow `0` to be passed as the value for `$post_author`.
...
Adds unit tests.
Props ericdaams, wonderboymusic.
Fixes #32585 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34085 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 18:53:56 +00:00
Scott Taylor
ad20c3db4a
`WP_Posts_List_Table`: there are a cadre of `edit.php` URLs that are generated by string-building instead of using our handy functions. Create a helper method, `->get_edit_link()` that standardizes the generation and escaping of these URLs.
...
Props BdN3504 for the initial patch on the ticket.
Fixes #32376 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34084 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 17:12:25 +00:00
Scott Taylor
2a72a1f959
Use `table-layout: auto` (instead of `fixed`) on `table.fixed` to ensure that things like date/time don't horrendously wrap on small screens. Before/After screenshots attached to the ticket.
...
Props gaelan.
Fixes #32691 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34083 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 16:03:17 +00:00
Scott Taylor
9eb5abbccb
`wp_delete_post()`: add a filter, 'pre_delete_post', to allow bailout from the function if the filter returns a non-null value.
...
Props boonebgorges.
Fixes #32933 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34082 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 15:58:09 +00:00
Scott Taylor
8ef82f4792
`sanitize_post()`: the default value for `$context` is 'display'. The documentation says the default for `sanitize_post_field()` is 'display', but there is no default for the arg. Make the argument: `$context = 'default'`.
...
Props morganestes.
Fixes #33117 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34081 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 15:45:15 +00:00
Scott Taylor
0b8101849e
`sanitize_post()` is polymorphic, add an `is_array()` check for `$post` before operating on it as an array.
...
Props morganestes.
Fixes #33118 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34080 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 15:37:50 +00:00
Dominik Schilling (ocean90)
250c8a0224
Bundled Themes: Update `Tested up to`.
...
Props mercime.
Fixes #33794 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34079 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 12:46:26 +00:00
Scott Taylor
faf87c2ca6
After [34076], fix the logic for `post_status` in months dropdown.
...
See #21015 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34077 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 08:18:18 +00:00
Scott Taylor
927ad00bab
List Tables: don't render "extra tablenav" if there are no posts. This includes Bulk Actions, Dates Dropdown, Category Dropdowns, Pagination.
...
Also ensure that the Months dropdown, when it is shown, shows months from the proper set of posts.
Props egower, CoenJacobs, MikeHansenMe, mehulkaklotar.
Fixes #33824 , #21015 , #21856 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34076 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 08:12:43 +00:00
Scott Taylor
b76864660c
Comments: `get_comments_link()` should return a link with `#respond` as the hash instead of `#comments` if `get_comments_number()` returns `0`.
...
Props cgrymala, wonderboymusic.
Fixes #19893 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34075 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 07:35:05 +00:00
Scott Taylor
9831fa216c
AJAX Reply to Comment: check the `edit_comment` cap when parent comment will be auto-approved.
...
Props rachelbaker.
Fixes #23939 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34074 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 07:18:36 +00:00
Boone Gorges
b7c8dbf4a2
Better default values in `WP_Query::get_queried_object()`.
...
Setting the default value of the `queried_object_id` property to `0` meant
that, when called early enough in the WP bootstrap, `get_queried_object()`
could short-circuit the normal query by fooling it into thinking that the
request was for a page with id 0. Setting the default value to `null` instead
avoids this problem.
Props gradyetc, jazbek.
Fixes #31355 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34073 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 03:36:12 +00:00
Scott Taylor
3cbec930bb
Edit Comment screen: remove the "View Comment" button (actually a link) from the publish meta box. Mimic the "Edit URL/Permalink" UI from the Edit Post screen to show the comment link below the screen title, but make it an actual link, not a button.
...
Props ocean90, DrewAPicture, wonderboymusic.
Fixes #19168 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34072 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 03:19:21 +00:00
Scott Taylor
dd55363884
Comments: `comment_link()` currently takes no arguments, yet `get_comment_link()` does. Allow `comment_link()` to optionally take the same arguments.
...
See #33638 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34071 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 03:15:14 +00:00
Scott Taylor
6a262bd6ce
Quick Edit: fix an ID attribute name collision by renaming one of the author fields `author-name`.
...
Props afercia.
Fixes #33770 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34070 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 02:34:52 +00:00
Scott Taylor
0f2078bc9e
When clicking "Show More Comments" in the Comments meta box on the Edit Post screen, change the click behavior to call a new class method on `commentsBox`, `->load()`, that resets `st` (cool name) to the number of visible `<tr>`s before calling `->get()`. This will account for spam'd and trash'd comments when returning comments at the proper offset.
...
Props utkarshpatel.
Fixes #33829 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34069 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 02:27:50 +00:00
Andrew Ozz
f855ddb134
Settings, password field: fix placement of the error icon and removal of the error class.
...
Props liljimmi, adamsilverstein.
Fixes #33406 for trunk.
git-svn-id: https://develop.svn.wordpress.org/trunk@34068 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 00:09:09 +00:00
Andrea Fercia
1a333bd537
Bump H3 headings to H2 on the Plugin Editor screen for better accessibility.
...
Fixes #33839 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34067 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 00:07:23 +00:00
Andrea Fercia
41c74b9bf6
Bump H3 headings to H2 on the Theme Editor screen for better accessibility.
...
Props mrahmadawais.
Fixes #33660 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34066 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 23:59:30 +00:00
Andrea Fercia
c492832e6a
Nav Menus: fix the quick search spinner position on Operating Systems that show scrollbars.
...
Fixes #33290 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34065 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 23:51:53 +00:00
Andrea Fercia
bc8e3599e6
Quick Edit: fix the Tags auto-suggest tooltip visibility.
...
Be sure to hide the `jquery.suggest` Tags textarea tooltip also when using the keyboard to Save/Cancel.
Props rommelxcastro for the initial patch.
Fixes #32580 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34064 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 23:33:43 +00:00
Andrew Ozz
e5324c4c91
Settings: properly set the password field label on loading.
...
See #33778 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34062 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 23:04:53 +00:00
Andrew Ozz
504d75e4c1
Settings: reassign the label when switching password fields so it always highlights the visible field.
...
Props umesh.nevase.
Fixes #33778 for trunk.
git-svn-id: https://develop.svn.wordpress.org/trunk@34061 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 22:51:17 +00:00
Dominik Schilling (ocean90)
28c4ddae7c
Passwords: Refresh password fields when content is pasted into fields.
...
Use feature detection to determine whether password inputs should use the `keyup` or `input` event.
Props peterwilsoncc, adamsilverstein.
Fixes #33398 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34060 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 21:51:31 +00:00
Scott Taylor
33953cb392
Introduce `wp_validate_action( $action = '' )`, a helper function that checks `$_REQUEST` for `action` and returns it, or empty string if not present. If `$action` is passed, it checks to make sure they match before returning it, or an empty string. Strings are always returned to avoid returning multiple types.
...
Implementing this removes 27 uses of direct superglobal access in the admin.
For more reading:
https://codeclimate.com/github/WordPress/WordPress/wp-admin/edit-comments.php
See #33837 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34059 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 21:07:45 +00:00
Dominik Schilling (ocean90)
9805723e3d
Site Icon: For preview fall back to `full` size URL when `thumbnail` size doesn't exist.
...
Prevents a JavaScript error for rare cases when cropping is skipped and the image is smaller than `thumbnail`.
Props tyxla.
Fixes #33417 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34056 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 20:12:50 +00:00
Dominik Schilling (ocean90)
f30a1c86b1
About: Remove period from placeholder.
...
The position of periods is different in some languages, like Japanese. This removes the period from the last placeholder for the Template Hierarchy section. It doesn't include a new period to avoid a string change in a minor release.
Props extendwings, chriscct7.
Fixes #33429 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34054 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 19:26:02 +00:00
Dominik Schilling (ocean90)
1fc0462bac
Users: Import the global var `$wp_hasher` in `wp_new_user_notification()`.
...
Adds `@global` entries to the DocBlock.
Fixes #33826 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34052 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 19:09:12 +00:00
Dominik Schilling (ocean90)
a870132949
Docs: Fix DocBlock formatting for `wp_insert_term()`.
...
git-svn-id: https://develop.svn.wordpress.org/trunk@34051 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 18:47:03 +00:00
Scott Taylor
d595fa4223
Upgrade MediaElement to 2.18.1 - monkey-patches to allow H264 in Chromium.
...
Changelog: https://github.com/johndyer/mediaelement/compare/2.17.0...2.18.1
See #33798 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34050 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 18:34:40 +00:00
Scott Taylor
882eef809e
After [34048], restore the `else` statement for `h` (height of video) in `wp_underscore_video_template()`.
...
See #33798 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34049 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 18:29:26 +00:00
Scott Taylor
9a80acf25d
In [30082], hardcoded heights were removed on the front end for videos rendered via shortcode. These values were not removed from the admin, which was an oversight.
...
See #33798 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34048 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 18:26:53 +00:00
Scott Taylor
523550c223
Revert [34009], broke uploads.
...
See #24934 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34047 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 18:03:22 +00:00
Sergey Biryukov
5b89e70f16
Use `_x()` instead of string hacks for weekday and month abbreviations.
...
Props johnbillion.
Fixes #33716 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34046 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 15:35:26 +00:00
Sergey Biryukov
38b4099237
Update the length limit in `set_transient()` docs after [34030].
...
Props OriginalEXE.
Fixes #13310 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34045 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 15:09:13 +00:00
Sergey Biryukov
f4f1ed43e7
Document `@return` value for `wp_unschedule_event()`.
...
See #33475 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34044 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 11:34:52 +00:00
Sergey Biryukov
a01c10a3b9
Better align table headers with table cells on success screen after installing.
...
Props umesh.nevase.
Fixes #33796 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34043 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 11:25:30 +00:00
Scott Taylor
5cce4a3262
After [33961], pass `$comment` to `get_comment_link()` where possible to avoid extra cache/db lookups.
...
See #33638 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34042 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 06:20:56 +00:00
Scott Taylor
4a6a7edf55
After [33961], pass `$comment` to `get_comment_date()` where possible to avoid extra cache/db lookups.
...
See #33638 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34041 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 06:14:04 +00:00
Scott Taylor
9ab431873c
After [33961], pass `$comment` to `comment_class()` where possible to avoid extra cache/db lookups.
...
See #33638 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34040 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 06:11:35 +00:00
Scott Taylor
db702bc3ea
After [33961], pass `$comment` to `get_comment_author_link()` where possible to avoid extra cache/db lookups.
...
See #33638 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34039 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 06:04:22 +00:00
Scott Taylor
4cd30ede79
After [34015], handle orphaned comments in the Dashboard comments widget. Pass full `$comment` versus just passing the comment ID when possible.
...
See #33710 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34038 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 05:55:27 +00:00
Scott Taylor
3f557063be
Create a new file, `wp-admin/includes/noop.php`, which loads all of the noop functions for `load-script|styles.php` and is only loaded by those files. DRYs in the process.
...
See #33813 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34037 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 05:03:55 +00:00
Scott Taylor
da65ac0471
Move ad hoc functions from `wp-admin/credits.php` to `wp-admin/includes/credits.php`, which is only included by the former.
...
See #33813 .
git-svn-id: https://develop.svn.wordpress.org/trunk@34036 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-11 04:54:20 +00:00