Commit Graph

1405 Commits

Author SHA1 Message Date
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
Dion Hulse 75ab50c70e XMLRPC: Prevent authentication from occuring after a failed authentication attmept in any single XML-RPC call.
This hardens WordPress against a common vector which uses multiple user identifiers in a single `system.multicall` call. In the event that authentication fails, all following authentication attempts ''in that call'' will also fail.

Props dd32, johnbillion.
Fixes #34336


git-svn-id: https://develop.svn.wordpress.org/trunk@35366 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-23 04:45:10 +00:00
Scott Taylor 6a3b784104 Media: in `wp_get_attachment_image_sizes()`, to streamline and for performance:
* Change the 3rd arg from `args` to `width`
* Change `wp_image_sizes_args` filter to `wp_get_attachment_image_sizes`

Updates unit tests.

Props joemcgill.
Fixes #34379.


git-svn-id: https://develop.svn.wordpress.org/trunk@35355 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-22 16:45:37 +00:00
Scott Taylor a19a0e6e72 oEmbed: if `SimpleXMLElement` does not exist, return an `HTTP Error 501 Not implemented` response.
Props swissspidy.
Fixes #34274.


git-svn-id: https://develop.svn.wordpress.org/trunk@35354 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-22 16:37:31 +00:00
John Blackbourn 1691563872 Force the REST API URL to use `https` for its scheme when the current request is served over HTTPS and the host name matches that of the REST API URL.
This allows sites to use an admin area over HTTPS with the front end over HTTP, and not end up with a cross-protocol problem when using the REST API URL in the admin area.

Fixes #34299


git-svn-id: https://develop.svn.wordpress.org/trunk@35351 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-22 00:07:36 +00:00
John Blackbourn 82cb793355 Initialise `$_SERVER['SERVER_NAME']` during the test bootstrap to avoid individual tests having to do it.
Fixes #34394


git-svn-id: https://develop.svn.wordpress.org/trunk@35350 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 23:51:45 +00:00
John Blackbourn 5f8d0870a2 Remove the explicit Imagick extension test.
See #34087


git-svn-id: https://develop.svn.wordpress.org/trunk@35348 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 22:40:48 +00:00
John Blackbourn 2c3c286b84 Correctly use `WP_TESTS_EMAIL` in email tests.
See #761, #34000


git-svn-id: https://develop.svn.wordpress.org/trunk@35347 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 22:33:53 +00:00
John Blackbourn 20eb6402fd Correct some more tests which were using `example.org` instead of `WP_TESTS_DOMAIN`.
See #33641, #34000


git-svn-id: https://develop.svn.wordpress.org/trunk@35346 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 22:21:51 +00:00
John Blackbourn 63748f2d67 Provide a more helpful failure message when Imagick isn't installed. Skipping the tests isn't really an option because Imagick's presence affects several other tests too.
See #34087


git-svn-id: https://develop.svn.wordpress.org/trunk@35345 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 22:10:43 +00:00
John Blackbourn 289973f078 Remove the failing `test_rest_url_scheme()` test while it's investigated.
See #34299


git-svn-id: https://develop.svn.wordpress.org/trunk@35344 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 22:06:41 +00:00
John Blackbourn 672782f0a6 Force the REST API URL to use `https` for its scheme when the current request is served over HTTPS and the host name matches that of the REST API URL.
This allows sites to use an admin area over HTTPS with the front end over HTTP, and not end up with a cross-protocol problem when using the REST API URL in the admin area.

Fixes #34299


git-svn-id: https://develop.svn.wordpress.org/trunk@35342 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 20:37:56 +00:00
Drew Jaynes 1a7298861b Comments: Introduce two new filters, `notify_moderator` and `notify_post_author`, both of which make it possible to selectively override site notification email settings for new comments.
The `notify_moderator` filter makes it possible to override the value for the `moderation_notify` option, which controls whether to send new comment emails to "site moderators", that is to say, the owner of the admin email for the site and the post author if they have the ability to modify the comment.

The `notify_post_author` filter likewise makes it possible to override the value for the `comments_notify` option, which controls whether to send new comment emails to the post author. If the post author is the comment author, default behavior is not to send the notification. Note: enabling or disabling notifications via this hook could also affect other recipients added via the 'comment_notification_recipients' filter in `wp_notify_postauthor()`, if hooked.

Passing a falsey value to either of the new filters will prevent notifications from being sent, regardless of their corresponding option values.

Adds tests.

Props coffee2code, adamsilverstein, DrewAPicture.
Fixes #761.


git-svn-id: https://develop.svn.wordpress.org/trunk@35339 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 18:34:06 +00:00
Konstantin Obenland 52204f7b27 Tests: Use most specific function for document titles.
Adds tests specific to `_wp_render_title_tag()`.

See #31078.



git-svn-id: https://develop.svn.wordpress.org/trunk@35334 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 16:54:53 +00:00
Boone Gorges f492a81d70 Prevent non-public taxonomies from registering aquery var.
[34247] made the 'public' paramater of `register_taxonomy()` work by blocking
requests for non-public taxonomy archives during `parse_request()`. Blocking
taxonomy archive requests this late means that it's impossible to register an
independent query var that matches the slug of a non-public taxonomy. By
moving the block to `register_taxonomy()` - not allowing these taxonomies to
register their query vars in the first place - we free up the slug for other
use. In addition, we free up a bit of processing (no need to look for the query
var in `parse_request()` and better parallel the way non-public post types
work. See `register_post_type()`.

Non-public taxonomy archives that are requested using `?taxonomy=tax_name` are
still blocked during `parse_request`. It's only custom query vars -
`?tax_name=term` - that are affected by this change.

Props mboynes.
Fixes #21949.

git-svn-id: https://develop.svn.wordpress.org/trunk@35333 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 16:53:51 +00:00
Boone Gorges e4b72ad5ca Don't force comment pagination.
[34561] instituted the policy of forcing pagination for comments. This strategy
was intended to avert problems when 'page_comments' is set to 0 - as it is by
default - and the number of comments on a given post rises into the hundreds or
thousands. By forcing pagination in all cases, we ensured that WordPress would
not time out by processing unwieldy numbers of comments on a given pageload.

The strategy proves problematic, however, because comment permalinks are
generated using the page of the comment. Forcing pagination for posts that
were not previously paginated would change the URL of all comments that do not
appear on the default comment page.

This changeset reintroduces the 'page_comments' setting and its corresponding
checkbox on Settings > Discussion. A number of tests, which were written after
[34561], are modified to work now that 'page_comments' will, once again, be
disabled by default.

See #8071.

git-svn-id: https://develop.svn.wordpress.org/trunk@35331 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 16:25:31 +00:00
Boone Gorges 75887ec865 Document title tests should expect dynamic blogname.
Fixes #31078.

git-svn-id: https://develop.svn.wordpress.org/trunk@35329 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 16:14:06 +00:00
Scott Taylor 51637379a2 Formatting: move `url_shorten()` from `wp-admin/includes/misc.php` to `wp-includes/formatting.php` for more global access.
Adds unit tests.

Props mulvane, chriscct7.
Fixes #20166.


git-svn-id: https://develop.svn.wordpress.org/trunk@35314 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 03:47:23 +00:00
Scott Taylor 14893eb628 AJAX UNIT TESTS: Have you ever wondered why these take 600 forevers to run? They all eventually call `do_action( 'admin_init' )`, which has `_maybe_update_core`, `_maybe_update_plugins`, and `_maybe_update_themes` hooked to it. REMOVE THEM, and AJAX unit tests run like the wind. `Tests_Ajax_Response` is still slow.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35311 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 03:17:36 +00:00
Scott Taylor f5921a0c98 Unit Tests: consolidate the many separate implementations of `_make_attachment()` into a helper method on `WP_UnitTestCase`.
Fixes #34075.


git-svn-id: https://develop.svn.wordpress.org/trunk@35309 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 01:58:52 +00:00
Weston Ruter bde89adaf8 Customizer: Introduce `customize_loaded_components` filter to allow core components to be disabled.
Also move style rule from `customize-nav-menus.css` to `customize-controls.css` so that widgets button is properly styled when `nav_menus` component is excluded from loading. See [35304]. See #33327.

Props westonruter, DrewAPicture.
Fixes #33552.


git-svn-id: https://develop.svn.wordpress.org/trunk@35307 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 22:15:11 +00:00
Andrew Ozz 73d755b67a TinyMCE: update to 4.2.6. Changelog: http://www.tinymce.com/develop/changelog/?ctrl=version&act=view&pr_id=1&vr_id=887.
Fixes #34331.

git-svn-id: https://develop.svn.wordpress.org/trunk@35306 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 22:05:31 +00:00
Weston Ruter 261aa51182 Customizer: Allow new `option` settings to not be saved as autoloaded by passing an `autoload` arg value of `false`.
The `autoload` argument value is passed along to `update_option()` which has accepted an `$autoload` parameter since [31628].

Props westonruter, dlh.
See #26394.
Fixes #33499.


git-svn-id: https://develop.svn.wordpress.org/trunk@35305 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 21:18:04 +00:00
Weston Ruter 9724c7cdbd Customizer: Implement indicators for invalid nav menu items.
The same indicator on the nav menus admin page is now present for nav menu items in the Customizer. When a menu item is present for a post type that is no longer registered, the menu item will appear with the indicator.

Props kucrut, westonruter.
Fixes #33665.


git-svn-id: https://develop.svn.wordpress.org/trunk@35302 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 19:07:58 +00:00
Konstantin Obenland e9579b3ed5 Site Icon: Get site icon ID only when needed.
Cuts down on unnecessary queries, especially in environments that rely on
post meta a lot. Reverts [32997].

Props ap.koponen, swissspidy.
Fixes #34368.



git-svn-id: https://develop.svn.wordpress.org/trunk@35299 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 18:22:41 +00:00
Konstantin Obenland c7a86be42c Tests: Use updated filter names and oembed title for UT sanity.
See [35294], #31078.


git-svn-id: https://develop.svn.wordpress.org/trunk@35295 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 17:04:29 +00:00
Konstantin Obenland d625bd2428 Themes: Improve document title output.
Introduces more flexibility in filtering all parts of the document title,the
separator, and a way to short-circuit title generation. Plugins can now also
check for theme support and reliably filter the entire output. See #18548.
Deprecates `wp_title()`.

Fixes #31078.



git-svn-id: https://develop.svn.wordpress.org/trunk@35294 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 16:20:04 +00:00
Scott Taylor ea7e8314d2 Formatting: allow date strings to be passed to `get_gmt_from_date()`, instead of requiring `'Y-m-d H:i:s'`.
Adds unit tests.

Props pbearne.
Fixes #34279.


git-svn-id: https://develop.svn.wordpress.org/trunk@35284 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 06:07:45 +00:00
Scott Taylor 91d55f97c2 Users: when calling `wp_insert_user()` with an valid user ID, return `WP_Error` instead of arbitrarily updating user meta.
Adds unit test.

Props swissspidy, bilalcoder.
Fixes #28004.


git-svn-id: https://develop.svn.wordpress.org/trunk@35280 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 05:27:32 +00:00
Scott Taylor fdd8106001 Formatting: when making unique filenames in `wp_unique_filename()` by adding an incrementing number, prefix it with a dash to disambiguate from files that end in numbers.
Updates unit tests.

Props mikejolley, tyxla.
Fixes #21453.


git-svn-id: https://develop.svn.wordpress.org/trunk@35276 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 04:04:26 +00:00
Weston Ruter 42687da29c Widgets: Modify unit test assertion to be compatible with `widget_nav_menu` option being filtered by plugin to return `ArrayIterator`.
Modifies assertion added in [35100].

See #26876.
See #32474.


git-svn-id: https://develop.svn.wordpress.org/trunk@35272 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-19 21:26:24 +00:00
Drew Jaynes f03562b364 Tests: Add some more test coverage for `get_term_field()`.
See #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35270 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-19 03:28:49 +00:00
Boone Gorges 990eebf373 Bust object term cache in `wp_remove_object_terms()`.
Props tszming.
Fixes #34338.

git-svn-id: https://develop.svn.wordpress.org/trunk@35268 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-19 01:52:22 +00:00
John Blackbourn 39c6a77617 Some cleanup that was missed in [35259].
See #33728, #24853


git-svn-id: https://develop.svn.wordpress.org/trunk@35260 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-18 06:25:25 +00:00
John Blackbourn 219b56a6a4 Some rewrite endpoint tests in preparation for new endpoint masks. More to come.
See #33728, #24853


git-svn-id: https://develop.svn.wordpress.org/trunk@35259 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-18 06:23:48 +00:00
John Blackbourn a314c6c234 Preserve the public and private query var properties on the global `WP` instance when using `WP_UnitTestCase::go_to()`. These properties apply to the application state, not the current request.
See #34346


git-svn-id: https://develop.svn.wordpress.org/trunk@35258 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-18 05:00:40 +00:00
John Blackbourn 9fbff7f63a Add `is_embed()` to `WP_UnitTestCase::assertQueryTrue()` and update the relevant embed tests.
See #32522


git-svn-id: https://develop.svn.wordpress.org/trunk@35257 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-18 04:50:15 +00:00
John Blackbourn 6845b3cd4a Move the `test_is_home_should_be_false_when_visiting_custom_endpoint_without_a_registered_query_var_and_page_on_front_is_set()` test into a more appropriate place.
See #25143


git-svn-id: https://develop.svn.wordpress.org/trunk@35256 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-18 01:34:29 +00:00
John Blackbourn ab43e7362d Correct a test after r35253.
See #34272


git-svn-id: https://develop.svn.wordpress.org/trunk@35255 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-18 00:55:16 +00:00
John Blackbourn d5b31e6ba2 Introduce `map_deep()`, a utility function that recursively maps a callable function to every item in an array or object. Works like `array_walk_recursive()` but works with objects too.
Updates `rawurlencode_deep()`, `urlencode_deep()`, and `stripslashes_deep()` to use `map_deep()`. Introduces `urldecode_deep()` for completeness.

Props wpmuguru, nbachiyski, boonebgorges, MikeHansenMe, chriscct7, realloc, johnbillion
Fixes #22300


git-svn-id: https://develop.svn.wordpress.org/trunk@35252 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 23:25:21 +00:00