X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/a6f44f0edcda2471c5a33e4156c1c9488c7f3210..refs/tags/wordpress-3.7:/wp-admin/includes/misc.php diff --git a/wp-admin/includes/misc.php b/wp-admin/includes/misc.php index 5b609e45..5a3b9706 100644 --- a/wp-admin/includes/misc.php +++ b/wp-admin/includes/misc.php @@ -7,17 +7,50 @@ */ /** - * {@internal Missing Short Description}} + * Returns whether the server is running Apache with the mod_rewrite module loaded. * * @since 2.0.0 * - * @return unknown + * @return bool */ function got_mod_rewrite() { $got_rewrite = apache_mod_loaded('mod_rewrite', true); + + /** + * Filter whether Apache and mod_rewrite are present. + * + * This filter was previously used to force URL rewriting for other servers, + * like nginx. Use the got_url_rewrite filter in got_url_rewrite() instead. + * + * @see got_url_rewrite() + * + * @since 2.5.0 + * @param bool $got_rewrite Whether Apache and mod_rewrite are present. + */ return apply_filters('got_rewrite', $got_rewrite); } +/** + * Returns whether the server supports URL rewriting. + * + * Detects Apache's mod_rewrite, IIS 7.0+ permalink support, and nginx. + * + * @since 3.7.0 + * + * @return bool Whether the server supports URL rewriting. + */ +function got_url_rewrite() { + $got_url_rewrite = ( got_mod_rewrite() || $GLOBALS['is_nginx'] || iis7_supports_permalinks() ); + + /** + * Filter whether URL rewriting is available. + * + * @since 3.7.0 + * @param bool $got_url_rewrite Whether URL rewriting is available. + */ + return apply_filters( 'got_url_rewrite', $got_url_rewrite ); +} + /** * {@internal Missing Short Description}} * @@ -263,7 +296,7 @@ function wp_reset_vars( $vars ) { */ function show_message($message) { if ( is_wp_error($message) ){ - if ( $message->get_error_data() ) + if ( $message->get_error_data() && is_string( $message->get_error_data() ) ) $message = $message->get_error_message() . ': ' . $message->get_error_data(); else $message = $message->get_error_message();