wp/wp-includes/ms-deprecated.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
   143 function clear_global_post_cache( $post_id ) {
   143 function clear_global_post_cache( $post_id ) {
   144 	_deprecated_function( __FUNCTION__, '3.0.0', 'clean_post_cache()' );
   144 	_deprecated_function( __FUNCTION__, '3.0.0', 'clean_post_cache()' );
   145 }
   145 }
   146 
   146 
   147 /**
   147 /**
   148  * Deprecated functionality to determin if the current site is the main site.
   148  * Deprecated functionality to determine if the current site is the main site.
   149  *
   149  *
   150  * @since MU (3.0.0)
   150  * @since MU (3.0.0)
   151  * @deprecated 3.0.0 Use is_main_site()
   151  * @deprecated 3.0.0 Use is_main_site()
   152  * @see is_main_site()
   152  * @see is_main_site()
   153  */
   153  */
   176  * Deprecated functionality to retrieve a list of all sites.
   176  * Deprecated functionality to retrieve a list of all sites.
   177  *
   177  *
   178  * @since MU (3.0.0)
   178  * @since MU (3.0.0)
   179  * @deprecated 3.0.0 Use wp_get_sites()
   179  * @deprecated 3.0.0 Use wp_get_sites()
   180  * @see wp_get_sites()
   180  * @see wp_get_sites()
       
   181  *
       
   182  * @global wpdb $wpdb WordPress database abstraction object.
   181  *
   183  *
   182  * @param int    $start      Optional. Offset for retrieving the blog list. Default 0.
   184  * @param int    $start      Optional. Offset for retrieving the blog list. Default 0.
   183  * @param int    $num        Optional. Number of blogs to list. Default 10.
   185  * @param int    $num        Optional. Number of blogs to list. Default 10.
   184  * @param string $deprecated Unused.
   186  * @param string $deprecated Unused.
   185  */
   187  */
   291 
   293 
   292 	$url = wpmu_admin_redirect_add_updated_param( $url );
   294 	$url = wpmu_admin_redirect_add_updated_param( $url );
   293 	if ( isset( $_GET['redirect'] ) && isset( $_POST['redirect'] ) && $_GET['redirect'] !== $_POST['redirect'] ) {
   295 	if ( isset( $_GET['redirect'] ) && isset( $_POST['redirect'] ) && $_GET['redirect'] !== $_POST['redirect'] ) {
   294 		wp_die( __( 'A variable mismatch has been detected.' ), __( 'Sorry, you are not allowed to view this item.' ), 400 );
   296 		wp_die( __( 'A variable mismatch has been detected.' ), __( 'Sorry, you are not allowed to view this item.' ), 400 );
   295 	} elseif ( isset( $_GET['redirect'] ) ) {
   297 	} elseif ( isset( $_GET['redirect'] ) ) {
   296 		if ( 's_' === substr( $_GET['redirect'], 0, 2 ) )
   298 		if ( str_starts_with( $_GET['redirect'], 's_' ) )
   297 			$url .= '&action=blogs&s='. esc_html( substr( $_GET['redirect'], 2 ) );
   299 			$url .= '&action=blogs&s='. esc_html( substr( $_GET['redirect'], 2 ) );
   298 	} elseif ( isset( $_POST['redirect'] ) ) {
   300 	} elseif ( isset( $_POST['redirect'] ) ) {
   299 		$url = wpmu_admin_redirect_add_updated_param( $_POST['redirect'] );
   301 		$url = wpmu_admin_redirect_add_updated_param( $_POST['redirect'] );
   300 	}
   302 	}
   301 	wp_redirect( $url );
   303 	wp_redirect( $url );
   313  * @return string
   315  * @return string
   314  */
   316  */
   315 function wpmu_admin_redirect_add_updated_param( $url = '' ) {
   317 function wpmu_admin_redirect_add_updated_param( $url = '' ) {
   316 	_deprecated_function( __FUNCTION__, '3.3.0', 'add_query_arg()' );
   318 	_deprecated_function( __FUNCTION__, '3.3.0', 'add_query_arg()' );
   317 
   319 
   318 	if ( strpos( $url, 'updated=true' ) === false ) {
   320 	if ( ! str_contains( $url, 'updated=true' ) ) {
   319 		if ( strpos( $url, '?' ) === false )
   321 		if ( ! str_contains( $url, '?' ) )
   320 			return $url . '?updated=true';
   322 			return $url . '?updated=true';
   321 		else
   323 		else
   322 			return $url . '&updated=true';
   324 			return $url . '&updated=true';
   323 	}
   325 	}
   324 	return $url;
   326 	return $url;
   332  *
   334  *
   333  * @since MU (3.0.0)
   335  * @since MU (3.0.0)
   334  * @deprecated 3.6.0 Use get_user_by()
   336  * @deprecated 3.6.0 Use get_user_by()
   335  * @see get_user_by()
   337  * @see get_user_by()
   336  *
   338  *
   337  * @param string $string Either an email address or a login.
   339  * @param string $email_or_login Either an email address or a login.
   338  * @return int
   340  * @return int
   339  */
   341  */
   340 function get_user_id_from_string( $string ) {
   342 function get_user_id_from_string( $email_or_login ) {
   341 	_deprecated_function( __FUNCTION__, '3.6.0', 'get_user_by()' );
   343 	_deprecated_function( __FUNCTION__, '3.6.0', 'get_user_by()' );
   342 
   344 
   343 	if ( is_email( $string ) )
   345 	if ( is_email( $email_or_login ) )
   344 		$user = get_user_by( 'email', $string );
   346 		$user = get_user_by( 'email', $email_or_login );
   345 	elseif ( is_numeric( $string ) )
   347 	elseif ( is_numeric( $email_or_login ) )
   346 		return $string;
   348 		return $email_or_login;
   347 	else
   349 	else
   348 		$user = get_user_by( 'login', $string );
   350 		$user = get_user_by( 'login', $email_or_login );
   349 
   351 
   350 	if ( $user )
   352 	if ( $user )
   351 		return $user->ID;
   353 		return $user->ID;
   352 	return 0;
   354 	return 0;
   353 }
   355 }
   354 
   356 
   355 /**
   357 /**
   356  * Get a full blog URL, given a domain and a path.
   358  * Get a full site URL, given a domain and a path.
   357  *
   359  *
   358  * @since MU (3.0.0)
   360  * @since MU (3.0.0)
   359  * @deprecated 3.7.0
   361  * @deprecated 3.7.0
   360  *
   362  *
   361  * @param string $domain
   363  * @param string $domain
   376 				$url .= $blogname . '/';
   378 				$url .= $blogname . '/';
   377 		} else { // Main blog.
   379 		} else { // Main blog.
   378 			$url = 'http://' . $domain . $path;
   380 			$url = 'http://' . $domain . $path;
   379 		}
   381 		}
   380 	}
   382 	}
   381 	return esc_url_raw( $url );
   383 	return sanitize_url( $url );
   382 }
   384 }
   383 
   385 
   384 /**
   386 /**
   385  * Create an empty blog.
   387  * Create an empty blog.
   386  *
   388  *
   399 	if ( empty($path) )
   401 	if ( empty($path) )
   400 		$path = '/';
   402 		$path = '/';
   401 
   403 
   402 	// Check if the domain has been used already. We should return an error message.
   404 	// Check if the domain has been used already. We should return an error message.
   403 	if ( domain_exists($domain, $path, $site_id) )
   405 	if ( domain_exists($domain, $path, $site_id) )
   404 		return __( '<strong>Error</strong>: Site URL you&#8217;ve entered is already taken.' );
   406 		return __( '<strong>Error:</strong> Site URL you&#8217;ve entered is already taken.' );
   405 
   407 
   406 	/*
   408 	/*
   407 	 * Need to back up wpdb table names, and create a new wp_blogs entry for new blog.
   409 	 * Need to back up wpdb table names, and create a new wp_blogs entry for new blog.
   408 	 * Need to get blog_id from wp_blogs, and create new table names.
   410 	 * Need to get blog_id from wp_blogs, and create new table names.
   409 	 * Must restore table names at the end of function.
   411 	 * Must restore table names at the end of function.
   410 	 */
   412 	 */
   411 
   413 
   412 	if ( ! $blog_id = insert_blog($domain, $path, $site_id) )
   414 	if ( ! $blog_id = insert_blog($domain, $path, $site_id) )
   413 		return __( '<strong>Error</strong>: There was a problem creating site entry.' );
   415 		return __( '<strong>Error:</strong> There was a problem creating site entry.' );
   414 
   416 
   415 	switch_to_blog($blog_id);
   417 	switch_to_blog($blog_id);
   416 	install_blog($blog_id);
   418 	install_blog($blog_id);
   417 	restore_current_blog();
   419 	restore_current_blog();
   418 
   420 
   728 		}
   730 		}
   729 	}
   731 	}
   730 
   732 
   731 	return $value;
   733 	return $value;
   732 }
   734 }
       
   735 
       
   736 /**
       
   737  * Maintains a canonical list of terms by syncing terms created for each blog with the global terms table.
       
   738  *
       
   739  * @since 3.0.0
       
   740  * @since 6.1.0 This function no longer does anything.
       
   741  * @deprecated 6.1.0
       
   742  *
       
   743  * @param int    $term_id    An ID for a term on the current blog.
       
   744  * @param string $deprecated Not used.
       
   745  * @return int An ID from the global terms table mapped from $term_id.
       
   746  */
       
   747 function global_terms( $term_id, $deprecated = '' ) {
       
   748 	_deprecated_function( __FUNCTION__, '6.1.0' );
       
   749 
       
   750 	return $term_id;
       
   751 }