]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/canonical.php
WordPress 4.3
[autoinstalls/wordpress.git] / wp-includes / canonical.php
index 5f4bda087e2bc823a8c2bcbbbf7485121e913df1..f75a72eea39197a5297f0633118bf9470ceaae9b 100644 (file)
  * or query in an attempt to figure the correct page to go to.
  *
  * @since 2.3.0
- * @uses $wp_rewrite
- * @uses $is_IIS
+ *
+ * @global WP_Rewrite $wp_rewrite
+ * @global bool $is_IIS
+ * @global WP_Query $wp_query
+ * @global wpdb $wpdb
  *
  * @param string $requested_url Optional. The URL that was requested, used to
  *             figure if redirect is needed.
  * @param bool $do_redirect Optional. Redirect to the new URL.
- * @return null|false|string Null, if redirect not needed. False, if redirect
- *             not needed or the string of the URL
+ * @return string|void The string of the URL, if redirect needed.
  */
 function redirect_canonical( $requested_url = null, $do_redirect = true ) {
        global $wp_rewrite, $is_IIS, $wp_query, $wpdb;
@@ -447,8 +449,9 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
                        $redirect_url .= '?' . $redirect['query'];
        }
 
-       if ( !$redirect_url || $redirect_url == $requested_url )
-               return false;
+       if ( ! $redirect_url || $redirect_url == $requested_url ) {
+               return;
+       }
 
        // Hex encoded octets are case-insensitive.
        if ( false !== strpos($requested_url, '%') ) {
@@ -472,8 +475,10 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
         */
        $redirect_url = apply_filters( 'redirect_canonical', $redirect_url, $requested_url );
 
-       if ( !$redirect_url || $redirect_url == $requested_url ) // yes, again -- in case the filter aborted the request
-               return false;
+       // yes, again -- in case the filter aborted the request
+       if ( ! $redirect_url || $redirect_url == $requested_url ) {
+               return;
+       }
 
        if ( $do_redirect ) {
                // protect against chained redirects
@@ -483,7 +488,7 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
                } else {
                        // Debug
                        // die("1: $redirect_url<br />2: " . redirect_canonical( $redirect_url, false ) );
-                       return false;
+                       return;
                }
        } else {
                return $redirect_url;
@@ -522,8 +527,9 @@ function _remove_qs_args_if_not_in_url( $query_string, Array $args_to_check, $ur
  * @since 2.3.0
  *
  * @global wpdb $wpdb WordPress database abstraction object.
+ * @global WP_Rewrite $wp_rewrite
  *
- * @return bool|string The correct URL if one is found. False on failure.
+ * @return false|string The correct URL if one is found. False on failure.
  */
 function redirect_guess_404_permalink() {
        global $wpdb, $wp_rewrite;
@@ -558,6 +564,10 @@ function redirect_guess_404_permalink() {
        return false;
 }
 
+/**
+ *
+ * @global WP_Rewrite $wp_rewrite
+ */
 function wp_redirect_admin_locations() {
        global $wp_rewrite;
        if ( ! ( is_404() && $wp_rewrite->using_permalinks() ) )