Commit Graph

1444 Commits

Author SHA1 Message Date
Scott Taylor 56d7611f09 Rewrite: alleviate conflicts between image attachment pages and posts when permalink structure is `/%postname%/`.
Adds unit test.

Props SergeyBiryukov.
Fixes #24612.


git-svn-id: https://develop.svn.wordpress.org/trunk@35679 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-18 19:58:01 +00:00
Scott Taylor 4aa34cf092 Media: when making images responsive, check if they already have a `sizes` attribute.
Adds unit test.

Props jaspermdegroot.
Fixes #34678.


git-svn-id: https://develop.svn.wordpress.org/trunk@35678 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-18 19:47:11 +00:00
John Blackbourn 355e768312 Update `WP_REST_Response::as_error()` to handle the new format error responses introduced in [35653].
Props danielbachhuber
Fixes #34551


git-svn-id: https://develop.svn.wordpress.org/trunk@35671 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-18 18:28:55 +00:00
Ryan McCue 52bdf9d6a5 REST API: Remove redundant "0" parameter.
This is just an artifact of how we parse the URL, and is already available
via $request->get_route()

Props danielbachhuber.
Fixes #34647.


git-svn-id: https://develop.svn.wordpress.org/trunk@35659 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-18 07:23:38 +00:00
Gary Pendergast d55c605242 WPDB: Fall back to the connection charset when sanity checking strings.
If `DB_CHARSET` isn't defined (or is empty), `wpdb::$charset` will be empty, too. `wpdb::strip_invalid_text()` assumes that it isn't empty, however, so we need to fall back to the connection character set when we're running our sanity checks.

Fixes #34708.



git-svn-id: https://develop.svn.wordpress.org/trunk@35655 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-17 06:12:08 +00:00
Ryan McCue 6ad5ee9786 REST API: Update tests for [35653]
See #34551.


git-svn-id: https://develop.svn.wordpress.org/trunk@35654 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-17 05:26:30 +00:00
Ryan McCue 0a501976db REST API: Require namespace when registering routes.
Props danielbachhuber.
Fixes #34416.


git-svn-id: https://develop.svn.wordpress.org/trunk@35651 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-17 02:38:31 +00:00
John Blackbourn 002b44dc08 Revert [35639] pending investigation into failures on PHP 5.2.
See #19455


git-svn-id: https://develop.svn.wordpress.org/trunk@35641 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-16 00:53:30 +00:00
John Blackbourn b32cf6875f On servers running PHP <= 5.4 which have `magic_quotes_sybase` enabled, the superglobals need to be magic-quoted before `magic_quotes_sybase` is subsequently disabled to avoid incorrect un-slashing. This must surely effect a miniscule number of servers, but so be it.
Fixes #19455
Props summerblue, kurtpayne, lucatume


git-svn-id: https://develop.svn.wordpress.org/trunk@35639 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-15 22:59:51 +00:00
Weston Ruter 0068d161b3 Customize: Exclude `referer` URL from being used for Close link if it is `customize.php`.
This fixes an edge case where the Close button could never link the user out of the Customizer, if the user initially accessed it without a `url` param and then clicked a link (provided by a plugin) that took them to another `customize.php` URL.

See #32637.


git-svn-id: https://develop.svn.wordpress.org/trunk@35635 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-13 05:24:28 +00:00
Sergey Biryukov 98cc2557ad Fix failing multisite test after [35629].
See #27317.

git-svn-id: https://develop.svn.wordpress.org/trunk@35631 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-12 17:11:46 +00:00
Sergey Biryukov 0cff629050 Users: After [35189], make `'illegal_user_logins'` check case-insensitive.
Props juliobox.
Fixes #27317.

git-svn-id: https://develop.svn.wordpress.org/trunk@35629 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-12 16:29:45 +00:00
Scott Taylor 688c155dd8 Users: in `wp_insert_user()`, when a password isn't provided and the user exists, ensure that the password isn't wiped out.
Adds unit test.

Props leewillis77.
Fixes #29880.


git-svn-id: https://develop.svn.wordpress.org/trunk@35618 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-11 22:30:27 +00:00
Scott Taylor 5462b6c6e9 Mail: after [33124], add unit tests.
Props mdawaffe.
Fixes #28039.


git-svn-id: https://develop.svn.wordpress.org/trunk@35617 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-11 22:04:59 +00:00
Boone Gorges c13a263830 When deleting a term, delete its metadata as well.
Props barryceelen.
Fixes #34626.

git-svn-id: https://develop.svn.wordpress.org/trunk@35585 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-09 03:35:56 +00:00
Weston Ruter 0e39b86500 Customize: Fix broken unit test for `WP_Customize_Nav_Menu_Item_Setting::value_as_wp_post_nav_menu_item()`.
Fixes issue in [35580] which caused unit tests to fail while run under multisite.

Fixes #32812.



git-svn-id: https://develop.svn.wordpress.org/trunk@35583 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-09 02:56:01 +00:00
Weston Ruter 2e2ea4876b Customize: Improve alignment of `WP_Customize_Nav_Menu_Item_Setting::sanitize()` behavior with `wp_update_nav_menu_item()`.
* Apply `title_save_pre`, `excerpt_save_pre`, and `content_save_pre` filters on a nav menu item's `title`, `attr_title`, and `description` properties respectively. This ensures that arbitrary markup can be supplied if the user has `unfiltered_html` cap, and for these fields to have markup stripped if not.
* Ensure a nav menu item's `post_status` is sanitized as `publish` or `draft` using the same conditions as `wp_update_nav_menu_item()`.
* Align `WP_Customize_Nav_Menu_Item_Setting::sanitize()` behavior for sanitizing `position` to be the same as `wp_update_nav_menu_item()`.
* Also apply `nav_menu_attr_title` and `nav_menu_description` filters in `WP_Customize_Nav_Menu_Item_Setting::value_as_wp_post_nav_menu_item()` to ensure that previewing markup entered into menu item description will preview the same way as when the nav menu item is saved.
* Add unit tests.

Fixes #32812.


git-svn-id: https://develop.svn.wordpress.org/trunk@35580 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-09 00:47:55 +00:00
Gary Pendergast 6b9ba5893f Embeds: Fix support for embedding in non-WordPress sites.
This moves the last of the iframe message code from PHP to JavaScript, so it can be included in any site, without needing to rely on any of WordPress' internal behaviour.

Props swissspidy.

Fixes #34451.



git-svn-id: https://develop.svn.wordpress.org/trunk@35577 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-09 00:07:03 +00:00
Andrew Ozz 71d22131e6 TinyMCE: update to 4.2.7. Changelog: http://www.tinymce.com/develop/changelog/?ctrl=version&act=view&pr_id=1&vr_id=888
Fixes #34620.

git-svn-id: https://develop.svn.wordpress.org/trunk@35574 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-08 02:31:31 +00:00
Jeremy Felt 9d48f6c7c3 Site Icon: Wrap site icon retrieval with `switch_to_blog()` as needed.
When the site icon for another site is requested, retrieving its ID via `get_blog_option()` is not enough. `switch_to_blog()` is used to set proper context when required.

Adds multsite tests for `has_site_icon()`.

Props imath.
Fixes #34312.


git-svn-id: https://develop.svn.wordpress.org/trunk@35572 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-08 02:03:34 +00:00
Andrew Ozz edf5d8bb36 Responsive images: make the new functions and filters signatures more consistent.
Props joemcgill.
Fixes #34612.

git-svn-id: https://develop.svn.wordpress.org/trunk@35569 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-07 21:35:34 +00:00
Andrew Ozz 3b5433eb2e Responsive images: omit full size images from srcset attributes when the original file is an intermediate sized GIF so we don't accidentally add animation to an otherwise flat image. Update the tests to cover this case.
Props joemcgill, H-Shredder, SergeyBiryukov.
Fixes #34528.

git-svn-id: https://develop.svn.wordpress.org/trunk@35561 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-07 02:09:56 +00:00
Andrew Ozz 3df03d1675 Responsive images: add test for invalid size name. Remove invalid size from other tests.
Props jaspermdegroot.
See #33641.

git-svn-id: https://develop.svn.wordpress.org/trunk@35560 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-07 01:32:41 +00:00
Weston Ruter 22135794a2 Customize: Fix typo in `WP_Customize_Manager::_cmp_priority()` which caused unstable sorting for same-priority constructs in PHP.
The issue, however, does not manifest in the UI because the UI is now built via JS and the `wp.customize.utils.prioritySort()` algorithm did not have the same typo.

Props bordoni, westonruter.
Fixes #34594.


git-svn-id: https://develop.svn.wordpress.org/trunk@35553 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-06 06:57:53 +00:00
Boone Gorges 5043f0c795 Make `get_term()` behave more consistently in the context of shared terms.
When `WP_Term` was introduced in [34997], the `$taxonomy` parameter for
`get_term()` was made optional. This meant that, when the optional param was
omitted, `get_term()` had no way of determining which term was intended when
the term_id was shared between multiple taxonomies. As a (somewhat sneaky) way
of fixing things, `get_term()` split any shared terms it found. But this could
cause problems with developer expectations: it's not clear why requesting a
term should result in a database update, much less a potential change in the
ID of a term.

In place of this technique, this changeset introduces a number of changes that
make the handling of shared terms a bit less insane:

* When a taxonomy is provided to `get_term()`, and a cached term is found matching the term_id, make sure the taxonomy also matches before returning it.
* When a taxonomy is not provided, ensure that the term is not shared before adding it to the cache.
* When a term is shared between taxonomies and no taxonomy is provided, return a `WP_Error` rather than splitting the term.
* When a term is shared between taxonomies, only one of which is valid, return the term from that taxonomy.

Props boonebgorges, dlh.
Fixes #34533.

git-svn-id: https://develop.svn.wordpress.org/trunk@35537 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-05 16:44:59 +00:00
Dominik Schilling (ocean90) 3effd276e0 After [35518] define `$_POST['post_view']` in `test_dont_process_terms_if_taxonomy_does_not_allow_show_on_quick_edit()`.
See #34577.

git-svn-id: https://develop.svn.wordpress.org/trunk@35531 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-04 23:05:03 +00:00
Andrew Ozz 611ddaf9bf Responsive images: do not generate `srcset` for GIFs that are inserted at full size. Prevents breaking animated GIFs.
Props joemcgill.
Fixes #34528.

git-svn-id: https://develop.svn.wordpress.org/trunk@35524 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-04 21:43:44 +00:00
Boone Gorges 7f79d26ca5 Don't allow term meta to be added to shared taxonomy terms.
`add_term_meta()` and `update_term_meta()` identify terms by `$term_id`. In
cases where a term is shared between taxonomies, `$term_id` is insufficient to
distinguish where the metadata belongs.

When attempting to add/update termmeta on a shared term, a `WP_Error` object
is returned. This gives developers enough information to decide whether they'd
like to force the term to be split and retry the save, or show an error in the
UI, or whatever.

Props boonebgorges, mboynes, DH-Shredder, jorbin, aaroncampbell.
Fixes #34544.

git-svn-id: https://develop.svn.wordpress.org/trunk@35515 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-04 21:23:28 +00:00
Boone Gorges c8dd2d480d `WP_Comment_Query`: Fill comment objects from database when cache is unavailable.
This fixes a bug where widgets loaded in a preview or the Customizer are
rendered inside of a `wp_suspend_cache_addition()` block and thus could not
find comment objects in the cache.

Props rommelxcastro, stevehenty.
Fixes #34138.

git-svn-id: https://develop.svn.wordpress.org/trunk@35512 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-04 21:09:01 +00:00
Scott Taylor ee98fd84bb Feeds: `<comments>` is optional in RSS2, so don't include it when comments aren't present or open. Same for `<wfw:commentRss>` and `<slash:comments>`
Adds unit test.

Props swissspidy, realloc, hakre, sivel.
Fixes #9134.


git-svn-id: https://develop.svn.wordpress.org/trunk@35506 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-04 17:46:41 +00:00
Sergey Biryukov 00ee9a62d1 Add missing `@group` to `Tests_Rel_No_Follow`.
See #9959.

git-svn-id: https://develop.svn.wordpress.org/trunk@35505 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-04 16:35:02 +00:00
Andrew Ozz 01e9de382e Responsive images:
- Fix `_wp_upload_dir_baseurl()` to cache by blog_id.
- Replace `path_join()` with `trailingslashit()`, it's much faster.
- Rename $image_url to $image_src for consistency (used at about 50 other places).
- Couple of tests fixes.

See #34430.

git-svn-id: https://develop.svn.wordpress.org/trunk@35498 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-04 00:21:23 +00:00
Sergey Biryukov 88c274fad8 Formatting: `wp_make_link_relative()` should return an empty string if no path is present in the link.
Props bcworkz, MikeHansenMe, chriscct7, SergeyBiryukov.
Fixes #26819.

git-svn-id: https://develop.svn.wordpress.org/trunk@35497 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-03 21:35:17 +00:00
Gary Pendergast c9f7e05f7b Upgrades: Add support for `FULLTEXT` indexes to `dbDelta()`.
Props edirect24, mdawaffe, pento.

Fixes #14445.



git-svn-id: https://develop.svn.wordpress.org/trunk@35487 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-01 23:09:49 +00:00
Weston Ruter 204bad4685 Customize: Return user to referring URL when leaving Customizer in absence of `return` query param.
When referring URL is not available, default returning user to frontend URL instead of admin URL. Themes page is updated to include the `return` path in Customizer links.

Props McGuive7, westonruter.
Fixes #32637.


git-svn-id: https://develop.svn.wordpress.org/trunk@35483 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-01 06:39:50 +00:00
Scott Taylor bd7bf83886 Media: add a new image size, `medium_large`. Bumps db version to add new options.
Adds unit tests.

Props DH-Shredder, joemcgill, azaozz.
Fixes #34196.


git-svn-id: https://develop.svn.wordpress.org/trunk@35479 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-31 20:49:26 +00:00
Scott Taylor 957a800bd3 Comments: don't auto-close comments on draft posts.
Adds unit tests.

Props solarissmoke, MikeHansenMe, nacin, rachelbaker.
Fixes #20262.


git-svn-id: https://develop.svn.wordpress.org/trunk@35475 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-31 20:12:16 +00:00
Sergey Biryukov fbd0b570fc Embeds: In `get_post_embed_html()`, move the optional `$post` argument after the required `$width` and `$height`.
Props swissspidy.
Fixes #34523.

git-svn-id: https://develop.svn.wordpress.org/trunk@35472 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-31 15:50:23 +00:00
Andrew Ozz 98a63f523f Responsive images:
- Merge `wp_image_srcset_attr()` into `wp_calculate_image_srcset()`.
- Remove the `wp_image_srcset` filter.
- Fix the tests for the above changes. 

See #34430.

git-svn-id: https://develop.svn.wordpress.org/trunk@35464 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-30 23:26:44 +00:00
John Blackbourn 3eb0e3a4bb Ensure that the scheme used in the URL returned by `get_blogaddress_by_id()` always reflects the blog's URL, instead of using `http`.
Props thomaswm
Fixes #14867


git-svn-id: https://develop.svn.wordpress.org/trunk@35446 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-30 02:01:32 +00:00
Gary Pendergast 63d9e9df96 Embeds: Provide a cached text fallback.
Sometimes, embedded sites might suffer from less than 100% uptime. Instead of leaving the embedding site with a big blank space where the embed should be, let's fall back to a link to the embedded post, so there's at least some context for the post.

Fixes #34462.



git-svn-id: https://develop.svn.wordpress.org/trunk@35437 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-29 23:10:46 +00:00
Gary Pendergast 4832d8d933 Embeds: Who put this REST API infrastructure in my WordPress?
Well, while it's here, we probably should make use of it. The oEmbed endpoint now uses the REST API infrastructure, instead of providing its own.

Props swissspidy.

Fixes #34207.



git-svn-id: https://develop.svn.wordpress.org/trunk@35436 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-29 22:50:13 +00:00
John Blackbourn 4b10def07e Correctly populate the `user_id` field for comments when a user submits a comment while logged in.
Props imath
Fixes #34493


git-svn-id: https://develop.svn.wordpress.org/trunk@35435 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-29 21:28:39 +00:00
Sergey Biryukov 391b67356a Embeds: Include post name in "Continue reading" links to provide a readable link for screenreaders.
Props swissspidy.
Fixes #34481.

git-svn-id: https://develop.svn.wordpress.org/trunk@35432 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-29 13:20:04 +00:00
Boone Gorges f1ca28c2ab Don't specify an `offset` default in `get_posts()`.
The default value should be a null offset. A `0` default overrides any value
of `paged` passed to `get_posts()`. See [34697].

Fixes #34060.

git-svn-id: https://develop.svn.wordpress.org/trunk@35417 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-28 18:17:27 +00:00
Andrew Ozz 855ba2518b Responsive images:
- Introduce `wp_calculate_image_srcset()` that replaces `wp_get_attachment_image_srcset_array()` and is used as lower level function for retrieving the srcset data as array.
- Use the new function when generating `srcset` and `sizes` on the front-end. This is faster as no (other) image API functions are used.
- Change the `wp_get_attachment_image_srcset()`. Now it is meant for use in templates and is no longer used in core.
- A few logic fixes and improvements.
- Some names changed to be (hopefully) more descriptive.
- Fixed/updated tests.

Props joemcgill, jaspermdegroot, azaozz.
See #34430.

git-svn-id: https://develop.svn.wordpress.org/trunk@35412 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-28 05:40:04 +00:00
Dominik Schilling (ocean90) 88cdbb6a49 Embeds: Replace hardcoded error messages with `get_status_header_desc( $http_code )`.
Fixes #34275.

git-svn-id: https://develop.svn.wordpress.org/trunk@35408 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-27 20:43:00 +00:00
Dion Hulse 8c33fe770e Use `wp_parse_url()` in `esc_url()` to avoid parsing bugs in < PHP 5.4.7.
Props johnbillion for unit tests
See #34408
Fixes #34202


git-svn-id: https://develop.svn.wordpress.org/trunk@35370 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-23 05:56:25 +00:00
Dion Hulse cacd015856 WP_HTTP: Promote the `WP_HTTP::parse_url()` method to a more generic `wp_parse_url()` function.
Fixes #34408


git-svn-id: https://develop.svn.wordpress.org/trunk@35369 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-23 05:53:05 +00:00
Dion Hulse f70e623991 XMLRPC: Revert the changes to `WP_XMLRPC_UnitTestCase` in [35366] as they weren't required.
See #34336


git-svn-id: https://develop.svn.wordpress.org/trunk@35367 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-23 04:49:08 +00:00