trailingslashit() will now remove any forward or backslashes from the end of a string before appending a forward slash.
props knutsp, willmot.
fixes#22267.
git-svn-id: https://develop.svn.wordpress.org/trunk@27344 602fd350-edb4-49c9-b593-d223f7449a82
did_action() returns true the moment a hook is initially run, leaving you no way to tell if the hook is still in progress. Hooks can be nested and this checks the entire stack, versus current_filter() which only identifies the final hook in the stack. This commit also introduces current_action() for parity.
To tell if a hook has completed, one can use did_action() and ! doing_action() together.
The functions do not require an argument. In that situation, they indicate whether the stack is empty.
props ericmann for the initial unit tests.
fixes#14994.
git-svn-id: https://develop.svn.wordpress.org/trunk@27294 602fd350-edb4-49c9-b593-d223f7449a82
Tries to get network detection under control by simplifying wpmu_current_site(). It now also pops off each subdomain to find a more general match. Adds unit tests for get_network_by_path() and a new network factory for unit tests.
Much of this is likely to change in 3.9 as more of ms-load.php and ms-settings.php gets hacked to bits.
props jeremyfelt.
see #27003.
git-svn-id: https://develop.svn.wordpress.org/trunk@27178 602fd350-edb4-49c9-b593-d223f7449a82
"The cache invalidation with static was introduced in r9102 with version 2.7. Multisite wasn't in core back then, so something like switch_to_blog() wasn't a concern, but now it breaks if you switch the blog in between calls to clean_term_cache."
This solution is simpler. All unit tests pass. Removes unnecessary tests linked to removed functions.
Props kovshenin.
Fixes#14485, #22526.
git-svn-id: https://develop.svn.wordpress.org/trunk@27163 602fd350-edb4-49c9-b593-d223f7449a82
This was broken through a change in [25163]. `_menu_item_object` in wp_get_associated_nav_menu_items() is not relevant for post types.
Adds unit tests.
props UmeshSingla for initial patch.
fixes#26795.
git-svn-id: https://develop.svn.wordpress.org/trunk@27150 602fd350-edb4-49c9-b593-d223f7449a82
In [27108], #26903 was fixed, but only because we were using the example in the ticket, leaving out infinite depth for hierarchical taxonomies.
Adds unit tests, including `Tests_Term_getTerms::test_get_terms_seven_levels_deep()`.
Fixes#26903. Again.
git-svn-id: https://develop.svn.wordpress.org/trunk@27125 602fd350-edb4-49c9-b593-d223f7449a82
In `_get_term_children()`, don't skip a top-level term without first including its children in the returned term list. Ironically, the call to `_get_term_children()` in `get_terms()` has a comment stating `"Make sure we show empty categories that have children."`, but it didn't work if you were retrieving top-level categories only.
All unit tests pass. Added a unit test based on the use case described in this ticket.
Fixes#26903.
git-svn-id: https://develop.svn.wordpress.org/trunk@27108 602fd350-edb4-49c9-b593-d223f7449a82
Introduces `taxonomy_hierarchy_is_fresh()`, which is only called in `_get_term_hierarchy()`. The taxonomy's `last_changed` value is checked against the value of `wp_cache_get( 'hierarchy_last_changed', $taxonomy )`.
Adds a unit test - `Tests_Term:test_hierachy_invalidation()`.
See [27101], which makes this type of cache invalidation possible.
Fixes#14485.
git-svn-id: https://develop.svn.wordpress.org/trunk@27102 602fd350-edb4-49c9-b593-d223f7449a82
Introduce `get_taxonomy_last_changed()`, `set_taxonomy_last_changed()`, and `post_taxonomy_is_fresh()`.
`post_taxonomy_is_fresh()` is only called in `get_object_term_cache()` - at which point the taxonomy's `last_changed` value is checked against the post's `{$taxonomy}_last_changed` value.
`set_taxonomy_last_changed()` is called whenever directory database queries are made that insert new terms or affect existing terms.
Fixes#22526.
git-svn-id: https://develop.svn.wordpress.org/trunk@27101 602fd350-edb4-49c9-b593-d223f7449a82
Disables NO_ZERO_DATE, ONLY_FULL_GROUP_BY, STRICT_TRANS_TABLES, STRICT_ALL_TABLES, TRADITIONAL. Introduces wpdb::set_sql_mode() with an incompatible_sql_modes filter so a plugin can alter the set mode after the fact.
props pento.
fixes#26847.
git-svn-id: https://develop.svn.wordpress.org/trunk@27072 602fd350-edb4-49c9-b593-d223f7449a82