Commit Graph

35075 Commits

Author SHA1 Message Date
Joe McGill
a91e769e36 Media: Prevent image_get_intermediate_size() from returning cropped images.
When `$size` is passed to `image_get_intermediate_size()` as an array of width
and height values and an exact image size matching those values isn't available,
the function loops through the available attachment sizes and returns the
smallest image larger than the requested dimensions with the same aspect ratio.

The aspect ratio check is skipped for the 'thumbnail' size to provide a fallback
for small sizes when no other image option is available. This resulted in a poor
selection when the size requested was smaller than the 'thumbnail' dimensions
but a larger size matching the requested ratio existed.

This refactors the internals of `image_get_intermediate_size()` to ensure the
'thumbnail' size is only returned as a fallback to small sizes once all other
options have been considered, and makes the control flow easier to follow.

This also introduces a new helper function, `wp_image_matches_ratio()` for
testing whether the aspect ratios of two sets of dimensions match. This function
is also now used in `wp_calculate_image_srcset()` during the selection process.

Props flixos, joemcgill.
Fixes #34384, #34980.

git-svn-id: https://develop.svn.wordpress.org/trunk@38086 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-18 02:13:45 +00:00
Sergey Biryukov
38bcf065df Multisite: Correct default values for orderby and order in WP_Site_Query::__construct().
Add a unit test.

Props ramiy, SergeyBiryukov.
See #35791.

git-svn-id: https://develop.svn.wordpress.org/trunk@38085 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-17 23:29:11 +00:00
Andrea Fercia
7b833f38a6 Accessibility: Improve keyboard navigation on the themes browser modal window.
Improves the `containFocus()` function to always get the correct first and last
focusable elements, even when the theme browser shows the active theme details.
Also, when on the first and last theme, adds a `disabled` attribute on the
previous and next navigation buttons to make them not focusable.

Fixes #37383.

git-svn-id: https://develop.svn.wordpress.org/trunk@38084 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-17 22:18:35 +00:00
Weston Ruter
57fe32e081 Twenty Thirteen: Fix selective refresh of Masonry-laid out widgets by deferring initialization until DOM ready.
This ensures that the `wp.customize.selectiveRefresh` object will be available when in the Customizer preview.

Fixes #37390.
Props westonruter, celloexpressions.


git-svn-id: https://develop.svn.wordpress.org/trunk@38083 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-17 21:13:35 +00:00
Sergey Biryukov
b87911eccb I18N: Remove non-translatable link attributes from translatable strings in wp_plugin_update_row(), wp_theme_update_row(), and get_theme_update_available().
The resulting strings are much easier to translate.

See #36048.

git-svn-id: https://develop.svn.wordpress.org/trunk@38082 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-17 21:02:21 +00:00
Sergey Biryukov
fd19901336 Text Changes: Change Network deactivate %s to upper case, for consistency with Network Activate %s.
See #37290.

git-svn-id: https://develop.svn.wordpress.org/trunk@38081 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-17 17:03:24 +00:00
Sergey Biryukov
4c5165a8d0 I18N: Combine duplicate "Menu Locations" and "Menu Options" strings.
Props ramiy.
See #18218.

git-svn-id: https://develop.svn.wordpress.org/trunk@38080 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-17 16:46:25 +00:00
Sergey Biryukov
ad30724bb5 Taxonomy: Correct WP_Error usage in WP_Tax_Query::clean_query() and WP_Tax_Query::transform_query().
Fixes #37389.

git-svn-id: https://develop.svn.wordpress.org/trunk@38079 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-17 16:32:50 +00:00
Sergey Biryukov
59f15cdea9 Unit Tests: Account for the string changes in [38077].
See #18218.

git-svn-id: https://develop.svn.wordpress.org/trunk@38078 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-17 16:23:31 +00:00
Sergey Biryukov
776b3c3f1d Text Changes: Add a full stop to "Invalid taxonomy" and "Invalid term ID" strings, for consistency with similar post-related messages.
See #18218, #32329.

git-svn-id: https://develop.svn.wordpress.org/trunk@38077 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-17 16:14:27 +00:00
Sergey Biryukov
8d81483b5e I18N: Combine two duplicate "Invalid post type" strings.
Props @ramiy.
See #18218.

git-svn-id: https://develop.svn.wordpress.org/trunk@38076 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-17 16:04:50 +00:00
Dominik Schilling
8756f2912f Import: Enhance accessibility on the Import screen.
* Remove title attributes.
* Show "Install Now" and "Details" links if the importer isn't installed yet.
* Show a "Run Importer" link if the importer is installed. It also handles activation if the plugin isn't activated.
* Add `aria-label` attributes to each link.
* Unify the importer descriptions to make them independent from the plugin state. The API was changed in [meta3690].
* Adjust JavaScript callbacks for ajaxified importer installs.

Props afercia, swissspidy, ocean90.
See #24766.
Fixes #35191.

git-svn-id: https://develop.svn.wordpress.org/trunk@38075 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-17 15:31:29 +00:00
Sergey Biryukov
f160118827 I18N: Change unnecessary uppercased words in WP_Upgrader::generic_strings() to lower case.
See #18218.

git-svn-id: https://develop.svn.wordpress.org/trunk@38074 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-17 13:28:13 +00:00
Sergey Biryukov
bc2a58755f I18N: Combine two duplicate "Unable to locate WordPress Theme directory" strings.
See #18218.

git-svn-id: https://develop.svn.wordpress.org/trunk@38073 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-17 12:57:06 +00:00
Sergey Biryukov
751f76fbaf Text Changes: After [37297], replace two more instances of "WordPress.org Plugin Directory" with "WordPress Plugin Directory".
See #35938.

git-svn-id: https://develop.svn.wordpress.org/trunk@38072 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-17 12:49:12 +00:00
Sergey Biryukov
8308164a77 I18N: After [38057], consistently use a context for other instances of Activate %s, Network Activate %s, and Delete %s strings.
See #37290.

git-svn-id: https://develop.svn.wordpress.org/trunk@38071 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-16 23:19:05 +00:00
Sergey Biryukov
cd75368a3f I18N: Remove a stray translator comment added in [38057].
See #37290.

git-svn-id: https://develop.svn.wordpress.org/trunk@38070 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-16 23:10:49 +00:00
Boone Gorges
a33080dbf5 On term.php, use $taxnow when fetching currently edited term.
[36874] changed the `get_term()` call so that no `$taxonomy` parameter
was passed, as 4.4 made the parameter optional. This change made it
impossible to access a shared term that has not yet been splitr, since
passing an ambiguous `$term_id` to `get_term()` results in an error.
Restoring the `$taxonomy` parameter fixes the regression.

Props alleynoah, dlh.
Fixes #37205.

git-svn-id: https://develop.svn.wordpress.org/trunk@38069 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-16 18:36:15 +00:00
Sergey Biryukov
be12798c9a Docs: Correct $post parameter name and description for wp_attachment_is() and wp_attachment_is_image().
Props flixos90.
Fixes #37377.

git-svn-id: https://develop.svn.wordpress.org/trunk@38068 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-16 13:04:01 +00:00
Sergey Biryukov
cc4bc59293 Permalinks: Rename $usingpi to $using_index_permalinks for clarity.
See #37380.

git-svn-id: https://develop.svn.wordpress.org/trunk@38067 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-16 12:45:01 +00:00
Sergey Biryukov
d5ba63e6a5 Permalinks: After [37747], make sure $usingpi, $writable, and $update_required are defined before checking them on permalinks update.
Props Clorith.
Fixes #37380.

git-svn-id: https://develop.svn.wordpress.org/trunk@38066 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-16 12:43:16 +00:00
Joe McGill
9d0f2e27d0 Media: Always add alt attributes to images inserted from URLs
Previously, when inserting an image from a URL, leaving the `alt`
field blank in the media modal would result in an image being
inserted into the editor without an `alt` attribute, rather than
an empty `alt`. This happened because the `props.type` would not
get set in `wp.media.string.props()` — because `attachment` is
undefined in this case — causing the image fallbacks to get
skipped.

This fixes the issue by explicitly setting `props.type` to 'image'
in `wp.media.string.image()` before filling out the rest of the
properties.

Props ambrosey, dabnpits.
Fixes #36735.

git-svn-id: https://develop.svn.wordpress.org/trunk@38065 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-15 03:15:23 +00:00
Dominik Schilling
f24f22ce4c Users: Update help text for user-new.php to remove reference to sending passwords via email.
Props anneschmidt.
Fixes #36763.

git-svn-id: https://develop.svn.wordpress.org/trunk@38064 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-14 21:50:45 +00:00
John Blackbourn
6f31511f23 Canonical: Remove a duplicate test data entry.
Fixes #37370


git-svn-id: https://develop.svn.wordpress.org/trunk@38063 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-14 20:50:45 +00:00
Dominik Schilling
3baaffc5da Editor: Enqueue the wp-embed script to fix embed previews inside the media modal.
Props swissspidy.
Fixes #37334.

git-svn-id: https://develop.svn.wordpress.org/trunk@38062 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-14 13:28:36 +00:00
Drew Jaynes
6bfe8458aa Docs: Update a cross-reference in the DocBlock for wp_register_plugin_realpath() from plugin_basename() to wp_normalize_path().
Props zuige.
Fixes #37357.


git-svn-id: https://develop.svn.wordpress.org/trunk@38061 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-13 19:21:34 +00:00
Dominik Schilling
f71e683061 Post WordPress 4.6 Beta 3 version bump.
git-svn-id: https://develop.svn.wordpress.org/trunk@38060 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-13 18:57:14 +00:00
Dominik Schilling
e259c9497d WordPress 4.6 Beta 3.
git-svn-id: https://develop.svn.wordpress.org/trunk@38059 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-13 18:40:39 +00:00
Boone Gorges
af068cdbe0 Mail: Improve handling of UTF-8 address headers.
Previously, `wp_mail()` implemented Reply-To as a generic header, using
PHPMailer's `addCustomHeader()`. As such, the email address portion of
the header was being incorrectly encoded when the name portion
contained UTF-8 characters. Switching to PHPMailer's more specific
`addReplyTo()` method fixes the issue.

For greater readability, the handling of all address-related headers
(To, CC, BCC, Reply-To) has been standardized.

Props szepe.viktor, iandunn, bpetty, stephenharris.
Fixes #21659.

git-svn-id: https://develop.svn.wordpress.org/trunk@38058 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-13 18:03:52 +00:00
Dominik Schilling
94c2212de8 Update/Install: Give context to some install/update strings to allow for differentiation between theme and plugin translations.
Props swissspidy, SergeyBiryukov.
Fixes #37290.

git-svn-id: https://develop.svn.wordpress.org/trunk@38057 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-13 17:31:15 +00:00
Drew Jaynes
2c579e3909 Docs: Add an initial @since version to wp-includes/feed.php.
The file was introduced in 2.1.0 when it was moved from wp-includes/feed-functions.php in [3862].

See #32246. See #36295.


git-svn-id: https://develop.svn.wordpress.org/trunk@38056 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-13 17:03:54 +00:00
Drew Jaynes
41dc691fbd Docs: Update the default value for the optional $args parameter in get_networks() following [38042].
See #32504.


git-svn-id: https://develop.svn.wordpress.org/trunk@38055 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-13 16:04:00 +00:00
Dominik Schilling
7fccd0ba4f HTTP API: Pass proxy settings to Requests.
`WP_HTTP_Proxy()` is used directly in `WP_Http_Curl()` and `WP_Http_Streams()`. Since `WP_Http::request()` doesn't use them anymore we have to move the proxy handling into `WP_Http::request()` so the proxy data can be passed to `Requests::request()`.

Props rmccue.
See #33055.
Fixes #37107.

git-svn-id: https://develop.svn.wordpress.org/trunk@38054 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-13 15:50:58 +00:00
ocean90
26758ec22f HTTP API: Update Requests.
Fixes an issue where you couldn't set a `Requests_Proxy_HTTP` object as a proxy setting.

See https://github.com/rmccue/Requests/pull/223.
See #37107, #33055.

git-svn-id: https://develop.svn.wordpress.org/trunk@38053 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-13 15:43:02 +00:00
Joe McGill
94da293e5f Media: URL encode spaces in srcset attributes.
In some cases, images in the media library may contain spaces in
their filenames. This results in an invalid `srcset` attribute,
causing broken images on the front end. This change fixes the issue
by replacing spaces in URLs with URL encoded '%20' characters before
returning the `srcset` string.

Props underdude, joemcgill.
Fixes #36549.

git-svn-id: https://develop.svn.wordpress.org/trunk@38052 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-13 15:23:27 +00:00
Drew Jaynes
55692a6e6b Docs: Add and clarify changelog entries for elements that can now accept, use, or return WP_Post_Type objects.
Also adds a missing initial `@since` version for `wp_xmlrpc_server::_prepare_post_type()`.

See [37890]. See #36217.


git-svn-id: https://develop.svn.wordpress.org/trunk@38051 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-13 15:23:04 +00:00
Dominik Schilling
c7ac50ab9e Comments: After [37743], prevent a JavaScript error when wpAjax.parseAjaxResponse() returns an error or true.
Props rachelbaker.
Fixes 36742.

git-svn-id: https://develop.svn.wordpress.org/trunk@38050 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-13 15:02:59 +00:00
Dominik Schilling
a9d1e10161 Remove svn:executable property from Requests and some other files.
git-svn-id: https://develop.svn.wordpress.org/trunk@38049 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-13 14:38:21 +00:00
Rachel Baker
224aecf240 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@38048 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-13 14:04:10 +00:00
Rachel Baker
d6eac6593c 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@38047 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-13 13:47:49 +00:00
Dominik Schilling
e332cfbed8 Resource Hints: Increase priority of wp_resource_hints() so hints get printed before scripts and styles.
Also run `wp_resource_hints()` on the login screen and in the customizer. 

Props swissspidy.
Fixes #37317.

git-svn-id: https://develop.svn.wordpress.org/trunk@38046 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-13 12:53:06 +00:00
Dominik Schilling
2f89742973 WP Mail: Remove an unused variable.
Unused since [34864].

Props vishalkakadiya.
Fixes #37346.

git-svn-id: https://develop.svn.wordpress.org/trunk@38045 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-13 12:36:22 +00:00
Dominik Schilling
9eaab508ab Database: Add unit test to test that a column type change for a table name with a hyphen is working after [37583].
Fixes #31679.

git-svn-id: https://develop.svn.wordpress.org/trunk@38044 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-13 11:38:29 +00:00
John Blackbourn
967fcbdc61 HTTP API: Remove duplicate documentation for the http_api_debug hook.
Fixes #37081


git-svn-id: https://develop.svn.wordpress.org/trunk@38043 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-13 10:23:01 +00:00
Jeremy Felt
f51e0ae92a Multisite: Set default $args to an empty array in get_networks().
The empty string was not incorrect. Using `array()` here instead makes things a bit more consistent by aligning with `get_sites()`, `get_users()`, and `get_terms()`.

See #32504.


git-svn-id: https://develop.svn.wordpress.org/trunk@38042 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-13 05:29:02 +00:00
Jeremy Felt
da154081f6 Meta: Ensure filters are backwards compatible for pre-4.6 style meta registration.
When using `register_meta()` with the function signature from 4.5 and earlier, the `auth_{$type}_meta_{$key}` and `sanitize_{$type}_meta_{$key}` filters are used. Any calls to `register_meta()` expecting this behavior should continue to work. The new filters, which take advantage of object subtypes, should not be added unless the proper `$args` array is passed.

See #35658.


git-svn-id: https://develop.svn.wordpress.org/trunk@38041 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-13 04:45:50 +00:00
Jeremy Felt
6830e90949 Meta: Remove filters when meta is unregistered.
If auth and/or sanitize callbacks are specified in the arguments for
`register_meta()`, filters are added to handle these callbacks. These
should be removed when calling `unregister_meta_key()` to avoid
unintentional filtering.

See #35658.


git-svn-id: https://develop.svn.wordpress.org/trunk@38040 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-13 04:12:41 +00:00
Andrew Ozz
afea5ef3a7 TinyMCE: preserve <script> and <style> tags inside the editor.
Uses image placeholders for the tags and makes then visible. That way the tags can also be deleted from inside the editor.

Props iseulde, azaozz.
Fixes #32923.

git-svn-id: https://develop.svn.wordpress.org/trunk@38039 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-12 22:08:28 +00:00
John Blackbourn
a501d6c8be Meta: Add a missing @since param for wp_object_type_exists().
See #35658


git-svn-id: https://develop.svn.wordpress.org/trunk@38038 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-12 13:20:55 +00:00
Dominik Schilling
7083cd200a Text Changes: Unify/merge two more permission error messages.
Props ramiy.
Fixes #34521.

git-svn-id: https://develop.svn.wordpress.org/trunk@38037 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-12 11:44:33 +00:00