ms_site_check()

最后更新于:2021-11-27 16:28:23

ms_site_check()

Checks status of current blog.

响应

(true|string) 响应s true on success, or drop-in file to include.

源文件

文件: gc-includes/ms-load.php

function ms_site_check() {

	/**
	 * Filters checking the status of the current blog.
	 *
	 * @since 3.0.0
	 *
	 * @param bool|null $check Whether to skip the blog status check. Default null.
	 */
	$check = apply_filters( 'ms_site_check', null );
	if ( null !== $check ) {
		return true;
	}

	// Allow super admins to see blocked sites.
	if ( is_super_admin() ) {
		return true;
	}

	$blog = get_site();

	if ( '1' == $blog->deleted ) {
		if ( file_exists( GC_CONTENT_DIR . '/blog-deleted.php' ) ) {
			return GC_CONTENT_DIR . '/blog-deleted.php';
		} else {
			gc_die( __( 'This site is no longer available.' ), '', array( 'response' => 410 ) );
		}
	}

	if ( '2' == $blog->deleted ) {
		if ( file_exists( GC_CONTENT_DIR . '/blog-inactive.php' ) ) {
			return GC_CONTENT_DIR . '/blog-inactive.php';
		} else {
			$admin_email = str_replace( '@', ' AT ', get_site_option( 'admin_email', 'support@' . get_network()->domain ) );
			gc_die(
				sprintf(
					/* translators: %s: Admin email link. */
					__( 'This site has not been activated yet. If you are having problems activating your site, please contact %s.' ),
					sprintf( '<a href="https://docs.gechiui.com/functions/ms_site_check/%1$s">%1$s</a>', $admin_email )
				)
			);
		}
	}

	if ( '1' == $blog->archived || '1' == $blog->spam ) {
		if ( file_exists( GC_CONTENT_DIR . '/blog-suspended.php' ) ) {
			return GC_CONTENT_DIR . '/blog-suspended.php';
		} else {
			gc_die( __( 'This site has been archived or suspended.' ), '', array( 'response' => 410 ) );
		}
	}

	return true;
}