]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/ms-deprecated.php
Wordpress 3.6-scripts
[autoinstalls/wordpress.git] / wp-includes / ms-deprecated.php
index a7f7eb238ca90110da82982cc106ab4ad2f56ecc..9c6cad456e08391577603de78edf4183857eb6d1 100644 (file)
@@ -49,7 +49,7 @@ function is_site_admin( $user_login = '' ) {
                        return false;
        } else {
                $user = get_user_by( 'login', $user_login );
-               if ( empty( $user->ID ) )
+               if ( ! $user->exists() )
                        return false;
                $user_id = $user->ID;
        }
@@ -68,7 +68,7 @@ function graceful_fail( $message ) {
        _deprecated_function( __FUNCTION__, '3.0', 'wp_die()' );
        $message = apply_filters( 'graceful_fail', $message );
        $message_template = apply_filters( 'graceful_fail_template',
-'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+'<!DOCTYPE html>
 <html xmlns="http://www.w3.org/1999/xhtml"><head profile="http://gmpg.org/xfn/11">
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 <title>Error!</title>
@@ -200,4 +200,102 @@ function get_most_active_blogs( $num = 10, $display = true ) {
        }
        return array_slice( $most_active, 0, $num );
 }
-?>
+
+/**
+ * Redirect a user based on $_GET or $_POST arguments.
+ *
+ * The function looks for redirect arguments in the following order:
+ * 1) $_GET['ref']
+ * 2) $_POST['ref']
+ * 3) $_SERVER['HTTP_REFERER']
+ * 4) $_GET['redirect']
+ * 5) $_POST['redirect']
+ * 6) $url
+ *
+ * @since MU
+ * @deprecated 3.3.0
+ * @deprecated Use wp_redirect()
+ * @uses wpmu_admin_redirect_add_updated_param()
+ *
+ * @param string $url
+ */
+function wpmu_admin_do_redirect( $url = '' ) {
+       _deprecated_function( __FUNCTION__, '3.3' );
+
+       $ref = '';
+       if ( isset( $_GET['ref'] ) )
+               $ref = $_GET['ref'];
+       if ( isset( $_POST['ref'] ) )
+               $ref = $_POST['ref'];
+
+       if ( $ref ) {
+               $ref = wpmu_admin_redirect_add_updated_param( $ref );
+               wp_redirect( $ref );
+               exit();
+       }
+       if ( empty( $_SERVER['HTTP_REFERER'] ) == false ) {
+               wp_redirect( $_SERVER['HTTP_REFERER'] );
+               exit();
+       }
+
+       $url = wpmu_admin_redirect_add_updated_param( $url );
+       if ( isset( $_GET['redirect'] ) ) {
+               if ( substr( $_GET['redirect'], 0, 2 ) == 's_' )
+                       $url .= '&action=blogs&s='. esc_html( substr( $_GET['redirect'], 2 ) );
+       } elseif ( isset( $_POST['redirect'] ) ) {
+               $url = wpmu_admin_redirect_add_updated_param( $_POST['redirect'] );
+       }
+       wp_redirect( $url );
+       exit();
+}
+
+/**
+ * Adds an 'updated=true' argument to a URL.
+ *
+ * @since MU
+ * @deprecated 3.3.0
+ * @deprecated Use add_query_arg()
+ *
+ * @param string $url
+ * @return string
+ */
+function wpmu_admin_redirect_add_updated_param( $url = '' ) {
+       _deprecated_function( __FUNCTION__, '3.3' );
+
+       if ( strpos( $url, 'updated=true' ) === false ) {
+               if ( strpos( $url, '?' ) === false )
+                       return $url . '?updated=true';
+               else
+                       return $url . '&updated=true';
+       }
+       return $url;
+}
+
+/**
+ * Get a numeric user ID from either an email address or a login.
+ *
+ * A numeric string is considered to be an existing user ID
+ * and is simply returned as such.
+ *
+ * @since MU
+ * @deprecated 3.6.0
+ * @deprecated Use get_user_by()
+ * @uses get_user_by()
+ *
+ * @param string $string Either an email address or a login.
+ * @return int
+ */
+function get_user_id_from_string( $string ) {
+       _deprecated_function( __FUNCTION__, '3.6', 'get_user_by()' );
+
+       if ( is_email( $string ) )
+               $user = get_user_by( 'email', $string );
+       elseif ( is_numeric( $string ) )
+               return $string;
+       else
+               $user = get_user_by( 'login', $string );
+
+       if ( $user )
+               return $user->ID;
+       return 0;
+}