Skip to content

Commit

Permalink
Babble tests: Add compete copy of wp_installing function for WP ver…
Browse files Browse the repository at this point in the history
…sions which don't have it

See #339
  • Loading branch information
simonwheatley committed Oct 5, 2015
1 parent c109247 commit aa75910
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion tests/babble-compat.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,40 @@ function is_post_type_viewable( $post_type_object ) {
return $post_type_object->publicly_queryable || ( $post_type_object->_builtin && $post_type_object->public );
}

endif; // is_post_type_viewable
endif; // is_post_type_viewable


if ( ! function_exists( 'wp_installing' ) ) :

/**
* Check or set whether WordPress is in "installation" mode.
*
* If the `WP_INSTALLING` constant is defined during the bootstrap, `wp_installing()` will default to `true`.
*
* @since 4.4.0
*
* @staticvar bool $installing
*
* @param bool $is_installing Optional. True to set WP into Installing mode, false to turn Installing mode off.
* Omit this parameter if you only want to fetch the current status.
* @return bool True if WP is installing, otherwise false. When a `$is_installing` is passed, the function will
* report whether WP was in installing mode prior to the change to `$is_installing`.
*/
function wp_installing( $is_installing = null ) {
static $installing = null;

// Support for the `WP_INSTALLING` constant, defined before WP is loaded.
if ( is_null( $installing ) ) {
$installing = defined( 'WP_INSTALLING' ) && WP_INSTALLING;
}

if ( ! is_null( $is_installing ) ) {
$old_installing = $installing;
$installing = $is_installing;
return (bool) $old_installing;
}

return (bool) $installing;
}

endif; // wp_installing

0 comments on commit aa75910

Please sign in to comment.