Commit Graph

31927 Commits

Author SHA1 Message Date
Boone Gorges 8974a2bb33 Don't prime term meta cache in `is_object_in_term()`.
Term meta is not necessary in this case, so priming the cache wastes a query.

See #10142, #32044.

git-svn-id: https://develop.svn.wordpress.org/trunk@34811 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 21:07:01 +00:00
Drew Jaynes 0ea2acb720 Tests: Permalink Structures Phase II: DRY up logic for setting permalink structures in test methods.
Renames `reset_permalinks()` to `set_permalink_structure()` (mimicking `$wp_rewrite->set_permalink_structure()`) and allows it to accept an optional permalink structure. In this way, we can double dip using it to both set and reset the permalink structure from anywhere.

Removes alot of duplicated code from tests.

See #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@34810 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 20:54:11 +00:00
Boone Gorges eebe549408 When creating terms, avoid false dupe checks due to accented characters.
`wp_insert_term()` doesn't allow the creation of a term when the term `name`
is the same as another term in the same hierarchy level of the same taxonomy.
Previously, this duplicate check used `get_term_by( 'name' )`, which uses the
database collation to determine sameness. But common collations do not
distinguish between accented and non-accented versions of a character. As a
result, it was impossible to create a term 'Foo' if a sibling term with an
accented character existed.

We address this problem by using `get_terms()` to do the duplicate check. This
query returns all potentially matching terms. We then do a stricter check
for equivalence in PHP, before determining whether one of the matches is
indeed a duplicate.

Props boonebgorges, tyxla, geza.miklo, mehulkaklotar.
Fixes #33864.

git-svn-id: https://develop.svn.wordpress.org/trunk@34809 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 20:24:09 +00:00
Boone Gorges 8b8dcb2ae4 Introduce 'page_of_comment' filter.
This filter allows developers to modify the output of `get_page_of_comment()`.

As a side effect of this new filter, comment page numbers will always be
returned as integers. Previously, they would sometimes be returned as floats -
eg `float(2.0)` instead of `int(2)`.

Props laceous.
See #13939.

git-svn-id: https://develop.svn.wordpress.org/trunk@34808 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 19:38:49 +00:00
Drew Jaynes 01f25fa247 Tests: Last try: It's redundant to reset permalinks on `tearDown()` if we're already doing it on every `setUp()`.
Removes the restoration logic, which leveraged a static property initialized with `get_option()`.

See #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@34807 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 19:26:24 +00:00
Boone Gorges 3b89b3ca28 Use 'comments_per_page' option as fallback in `get_page_of_comment()`.
The function now uses the following order of precedence when calculating
comment pagination: 1. the 'per_page' value passed in the `$args` array,
2. the 'comments_per_page' query var in `$wp_query`, and 3. the
'comments_per_page' setting from options-discussion.php. This change allows
`get_page_of_comment()` to return an accurate value before the main query
has been run.

Props laceous.
See #13939.

git-svn-id: https://develop.svn.wordpress.org/trunk@34806 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 19:25:25 +00:00
Boone Gorges ddc75e22ee Only count top-level comments when calculating threaded pagination.
The change in [34535] did not properly account for threading.

See #13939, #11334.

git-svn-id: https://develop.svn.wordpress.org/trunk@34805 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 19:15:55 +00:00
Boone Gorges b240a2a939 Ensure that `WP_User_Query` vars are filled after 'pre_get_users'.
This prevents notices from being thrown when a 'pre_get_users' callback
removes required values from the list of `query_vars`.

For backward compatibility with previous uses of 'pre_get_users', default
values are parsed both before and after the action is fired.

Fixes #33449.

git-svn-id: https://develop.svn.wordpress.org/trunk@34804 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 18:44:40 +00:00
Drew Jaynes 9cdffaaed8 Tests: Move the global permalinks reset routine to only fire when running core tests.
Should fix intermittent mysqli response errors in the AJAX tests.

See #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@34803 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 18:35:58 +00:00
Drew Jaynes adffdab161 Tests: Introduce `WP_UnitTestCase::reset_permalinks()`, an attempt to DRY up logic for resetting and restoring default permalinks on `setUp()` and `tearDown()`.
See #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@34802 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 17:14:12 +00:00
Sergey Biryukov 4fc732d804 Add missing unit tests from [34799].
Props johnbillion.
See #34059.

git-svn-id: https://develop.svn.wordpress.org/trunk@34801 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 15:09:57 +00:00
Sergey Biryukov 02f76495c6 Add `single-{post_type}-{post_name}.php` to the top of the template hierarchy for single posts.
This is consistent with page and taxonomy templates, which support slugs as well.

Props ericjuden, johnbillion.
Fixes #18859.

git-svn-id: https://develop.svn.wordpress.org/trunk@34800 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 14:59:46 +00:00
Sergey Biryukov fb6b3313c7 Abstract functionality from `wp-comments-post.php` into a function, `wp_handle_comment_submission()`.
Add unit tests.

Props johnbillion.
Fixes #34059.

git-svn-id: https://develop.svn.wordpress.org/trunk@34799 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 14:46:09 +00:00
Sergey Biryukov ef1a428bd5 Merge some strings with the same meaning in `wp-includes/class-wp-xmlrpc-server.php`.
Props pavelevap.
Fixes #33644.

git-svn-id: https://develop.svn.wordpress.org/trunk@34798 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 14:08:43 +00:00
Sergey Biryukov ee0d153629 Merge some strings in `wp-admin/upload.php` with existing strings with the same meaning.
Props pavelevap.
Fixes #31727.

git-svn-id: https://develop.svn.wordpress.org/trunk@34797 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 13:56:05 +00:00
Drew Jaynes 433f6600c0 Users: Introduce the `users_list_table_query_args` filter, for modifying the `WP_User_Query` arguments used within the `prepare_items()` methods in the users list tables.
The current list table is passed as a second parameter, `$this`, and can take the form of either a `WP_Users_List_Table` or `WP_MS_Users_List_Table` instance depending on the context in which the filter was evaluated.

Props juliobox for the initial patch.
Fixes #25360.


git-svn-id: https://develop.svn.wordpress.org/trunk@34796 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 07:23:20 +00:00
Boone Gorges da083f165d Remove `search_terms` from `WP_Query` doc block.
It's not actually a query param.

Introduced in [28887].

git-svn-id: https://develop.svn.wordpress.org/trunk@34795 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 04:35:57 +00:00
Sergey Biryukov 68f5a79880 Respect the `force_delete` parameter of `get_delete_post_link()`.
Previously, it only worked if `EMPTY_TRASH_DAYS` was disabled.

Props johnbillion, chriscct7.
Fixes #26832.

git-svn-id: https://develop.svn.wordpress.org/trunk@34794 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 01:49:52 +00:00
John Blackbourn 96faf97a0f Adjust `_default_wp_die_handler()` formatting so it doesn't confuse Sublime Text's parsing and syntax highlighting.
Fixes #34135


git-svn-id: https://develop.svn.wordpress.org/trunk@34793 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 01:31:26 +00:00
Boone Gorges e677f26aa8 Remove dead code added to `get_comment_link()` in [34735].
See #34073.

git-svn-id: https://develop.svn.wordpress.org/trunk@34792 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 01:26:40 +00:00
Sergey Biryukov 217d44bd60 Twenty Fifteen: Document the `'twentyfifteen_color_schemes'` filter.
Props DrewAPicture.
Fixes #34119.

git-svn-id: https://develop.svn.wordpress.org/trunk@34791 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 01:09:20 +00:00
John Blackbourn 2212c0f858 Use `wp_login_url()` for login links when signing up for a new blog or activating a new blog on Multisite.
Fixes #31495
Props GregLone for the intial patch


git-svn-id: https://develop.svn.wordpress.org/trunk@34790 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 00:33:47 +00:00
Weston Ruter 2ef0449316 Customize: Fix `nav_menu_item` CSS `classes` array being incorrectly presented in input field as comma-delimited list.
Instead of using `Array.toString()` to serialize an array with comma delimiters, explicitly `join` the array using spaces instead. Also ensure that `xfn` is handled properly if it ever gets stored as an array. 

Props tyxla, westonruter.
Fixes #34111.


git-svn-id: https://develop.svn.wordpress.org/trunk@34788 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 00:14:22 +00:00
John Blackbourn 066eed4902 Introduce a `register_taxonomy_args` filter for filtering the arguments passed when calling `register_taxonomy()`. This is the taxonomy equivalent of the newly introduced `register_post_type_args` filter.
Fixes #33990
Props tyxla for initial patch


git-svn-id: https://develop.svn.wordpress.org/trunk@34787 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 23:56:16 +00:00
John Blackbourn 780460af28 Remove the unnecessary dynamic prefix used in the `plugin_action_links` filter name, and in those of its brethren. This way, `network_admin_plugin_action_links` gets listed as a separate filter.
Fixes #34117


git-svn-id: https://develop.svn.wordpress.org/trunk@34786 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 23:43:20 +00:00
John Blackbourn 337b94a0a5 Add VideoPress as a trusted oEmbed provider.
Fixes #34031
Props kraftbj


git-svn-id: https://develop.svn.wordpress.org/trunk@34785 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 23:19:18 +00:00
John Blackbourn 4703e75f31 `shttp` is not a protocol.
See #27115


git-svn-id: https://develop.svn.wordpress.org/trunk@34784 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 22:47:41 +00:00
John Blackbourn 3fee278cf4 Switch the remaining user-facing links to wordpress.org over to HTTPS.
Fixes #27115


git-svn-id: https://develop.svn.wordpress.org/trunk@34783 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 22:45:53 +00:00
Drew Jaynes bf22859e52 Docs: Fix the placement and ordering of some `@since` tags following [34780].
See #12133. See #32246.


git-svn-id: https://develop.svn.wordpress.org/trunk@34782 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 20:49:49 +00:00
Drew Jaynes e0c487bc61 Docs: Improve a variety of inline docs in wp-includes/l10n.php.
* Corrects phrasing used in the descriptions for and filters in `_n()` and `_nx()`, particularly with regard to the use of 'singular' instead of 'single' or '1', and 'plural' instead of 'not 1'.
* Adds example usage to `_n()`, `_nx()`, `_nx_noop()`, and `translate_nooped_plural()`.
* Adds hash notation `@return` doc for `_n_noop()` and `_nx_noop()`.
* Adds missing default values for the optional `$domain` parameter in several places.

Props johnbillion.
Fixes #34127.


git-svn-id: https://develop.svn.wordpress.org/trunk@34781 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 20:44:18 +00:00
John Blackbourn 48300f62b3 Introduce support for array format field names in `WP_Widget::get_field_name()` and `WP_Widget::get_field_id()`.
Fixes #12133
Props ch1902, welcher


git-svn-id: https://develop.svn.wordpress.org/trunk@34780 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 20:23:54 +00:00
Jeremy Felt d9031e0d51 Docs: Add deprecation note for `$use_cache` in `get_site_option()`.
Props johnbillion.
See #28290.


git-svn-id: https://develop.svn.wordpress.org/trunk@34779 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 19:31:04 +00:00
Jeremy Felt 3c177b8c6f MS: Use `*_network_option()` functions throughout core.
Replaces all uses of `*_site_option()` with the corresponding "network" function.

This excludes one usage in `wp-admin/admin-footer.php` that needs more investigation.

Props spacedmonkey.
See #28290.


git-svn-id: https://develop.svn.wordpress.org/trunk@34778 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 19:07:23 +00:00
Jeremy Felt 464f857316 MS: Introduce `*_network_option` functions.
Introduces `add_network_option()`, `update_network_option()`, `get_network_option()`, and `delete_network_option()`, which use the internals previously found in the `*_site_option()` functions and allow for a network ID to enable cross network storage and retrieval of network options.

* `*_site_option()` functions are now wrappers for `*_network_option()` and will interact with options for the current network in a multisite environment.
* All will continue to fallback to `*_option()` for non-multisite uses.
* Adds basic tests for cross network storage and retrieval.
* Existing tests for `*_site_option()` functions provide coverage for storage and retrieval of current network options.

Props spacedmonkey, DrewAPicture, jeremyfelt.
See #28290.


git-svn-id: https://develop.svn.wordpress.org/trunk@34777 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 18:00:30 +00:00
Aaron Jorbin f5276fcaa2 Add PHP Nightlies to the test suite
PHP branched master for 7, which means that nightly builds are now technically 7.1. The difference is minimal at the moment, but it's a good idea for us to test against the nightly build in part so that regressions can be reported upstream. Nightlies are allowed failure so that the build doesn't go red due to unstable versions. Additionally, nightlies are not officially supported by WordPress Core.

See #33410


git-svn-id: https://develop.svn.wordpress.org/trunk@34776 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 16:50:53 +00:00
Boone Gorges 44d021b686 More explicit tests for `image_get_intermediate_size()`.
After [33807], `Tests_Image_Intermediate_Size::test_get_intermediate_sizes_by_array_zero_width()`
was failing intermittently. This failure was due to the use of a random number
for the image height. When the height was sufficiently large - $height >= 202 -
to change the aspect ratio of the cropped image (based on WP's threshold of a
1px difference), the test passed. And when the height was exactly 200, the
medium image size was hit exactly. The failure occurred only with a height of
201, which is close enough to 200 so that WP determined that the aspect ratio
of the potential crop was close enough to match.

The current changeset splits the test into two, in order to demonstrate the
failure.

See #17626. Fixes #34087.

git-svn-id: https://develop.svn.wordpress.org/trunk@34775 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 14:13:15 +00:00
Boone Gorges 991feb7043 Pinking shears in shortcode test file.
git-svn-id: https://develop.svn.wordpress.org/trunk@34774 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 13:50:18 +00:00
Boone Gorges f408407620 Improvements to PCRE benchmarking tests.
* Add test file accidentally omitted from [34761].
* Bail properly from benchmarker when a `preg_last_error()` is found.

Props miqrogroove.
See #34121.

git-svn-id: https://develop.svn.wordpress.org/trunk@34773 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 13:50:12 +00:00
Boone Gorges 19df309491 Fix `preg_match_all()` syntax in PCRE benchmark test util.
In versions of PHP earlier than 5.4, the `$matches` parameter was required.
Excluding it here meant that PCRE benchmarking tests were erroring on older
versions of PHP without cleaning up the PCRE ini settings, causing various
problems on later tests.

Props miqrogroove, dd32, boonebgorges.

And to the cosmic forces that cause bugs like this. The best part of waking up
is diagnosing leakage between automated tests.

See #34121.

git-svn-id: https://develop.svn.wordpress.org/trunk@34772 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 13:50:04 +00:00
Dion Hulse b20695ed9f Skip two `wp_json_encode()` tests when mbstring is unavailable.
git-svn-id: https://develop.svn.wordpress.org/trunk@34771 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 08:54:52 +00:00
Drew Jaynes e2f61478de Docs: Remove documentation for a phantom parameter not actually passed to the `is_email` filter.
The documentation error was introduced in [26485].

Props chrisvendiadvertisingcom.
Fixes #34097.


git-svn-id: https://develop.svn.wordpress.org/trunk@34770 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 07:02:23 +00:00
Drew Jaynes 0fcc70b853 Introduce the `wp_add_nav_menu_item` action, fired immediately after a new nav menu item has been added.
This hook can be leveraged both for the legacy menus interface and the menus integration in the Customizer, as both use the containing function, `wp_update_nav_menu_item()`.

Props MikeHansenMe, tyxla.
Fixes #30983.


git-svn-id: https://develop.svn.wordpress.org/trunk@34769 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 06:45:32 +00:00
Drew Jaynes f6ce56219a Docs: Fix a few syntatical issues with inline documentation in wp-includes/post-template.php.
Props welcher.
See #30224.


git-svn-id: https://develop.svn.wordpress.org/trunk@34768 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 06:37:48 +00:00
Scott Taylor 79dc7efc73 Unit Tests: when `wp_using_ext_object_cache()`, mark some transient tests as skipped.
Props ocean90.
See #31491.


git-svn-id: https://develop.svn.wordpress.org/trunk@34767 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 05:09:03 +00:00
Scott Taylor c6571bcfad Unit Tests: tests that want to flush the cache should use their instance method instead of calling `wp_cache_flush()` - more properties need to be wiped out in between tests.
Props ocean90.
See #31491.


git-svn-id: https://develop.svn.wordpress.org/trunk@34766 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 05:08:13 +00:00
Scott Taylor cae64c5e13 Unit Tests: in `Tests_Cache::test_wp_cache_init()`, when `wp_using_ext_object_cache()`, just check that the global is an instance of `WP_Object_Cache`. External object cache instances of `WP_Object_Cache` will contain resources as props that will always have differing internal IDs, so strict comparison won't work.
See #31491.


git-svn-id: https://develop.svn.wordpress.org/trunk@34765 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 05:05:26 +00:00
Drew Jaynes 80e4265277 Docs: Also clarify the expected element types depending on the value of `$action` in the hook doc for the `plugins_api` filter.
See [34763] for context.

See #34035.


git-svn-id: https://develop.svn.wordpress.org/trunk@34764 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 04:51:39 +00:00
Drew Jaynes 4c6d50413b Docs: Clarify the expected replacement element type if replacing the object or array in `plugins_api()` via the `plugins_api` hook.
If the `$action` type is 'query_plugins' or 'plugin_information', the API will return an object, thus an object should be passed if replacing it. For 'hot_tags' and 'hot_categories', the same logic applies, but with arrays instead.

See #34035.


git-svn-id: https://develop.svn.wordpress.org/trunk@34763 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 04:47:14 +00:00
Scott Taylor a31e54344c Posts: In `wp_insert_post()`, don't set `post_date` to current time if it can be derived from a passed value for `post_date_gmt`.
Adds unit tests.

Props oso96_2000, kawauso.
Fixes #15946.


git-svn-id: https://develop.svn.wordpress.org/trunk@34762 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 04:35:34 +00:00
Scott Taylor 5a24a0a4f8 Shortcodes/Formatting: Add PCRE Performance Testing
* Move pattern from `wptexturize()` into a separate function.
* Move pattern from `wp_html_split()` into a separate function.
* Beautify code for `wp_html_split()`.
* Remove unnecessary instances of `/s` modifier in patterns that don't use dots.
* Add `tests/phpunit/data/formatting/whole-posts.php` for testing larger strings.
* Add function `benchmark_pcre_backtracking()`.
* Add tests for `wp_html_split()`.
* Add tests for `wptexturize()`.
* Add tests for `get_shortcode_regex()`.

Props miqrogroove.
Fixes #34121.


git-svn-id: https://develop.svn.wordpress.org/trunk@34761 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 04:25:40 +00:00