X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/wordpress.git/blobdiff_plain/699231ae09f7057a4d0000cdf32e50a3df6a04ca..596d585e1dc1eb25bccd3781e37210a4e2504179:/wp-includes/ms-load.php
diff --git a/wp-includes/ms-load.php b/wp-includes/ms-load.php
index bcb075cd..58826e78 100644
--- a/wp-includes/ms-load.php
+++ b/wp-includes/ms-load.php
@@ -25,6 +25,36 @@ function is_subdomain_install() {
return false;
}
+/**
+ * Returns array of network plugin files to be included in global scope.
+ *
+ * The default directory is wp-content/plugins. To change the default directory
+ * manually, define WP_PLUGIN_DIR
and WP_PLUGIN_URL
+ * in wp-config.php.
+ *
+ * @access private
+ * @since 3.1.0
+ * @return array Files to include
+ */
+function wp_get_active_network_plugins() {
+ $active_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
+ if ( empty( $active_plugins ) )
+ return array();
+
+ $plugins = array();
+ $active_plugins = array_keys( $active_plugins );
+ sort( $active_plugins );
+
+ foreach ( $active_plugins as $plugin ) {
+ if ( ! validate_file( $plugin ) // $plugin must validate as file
+ && '.php' == substr( $plugin, -4 ) // $plugin must end with '.php'
+ && file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist
+ )
+ $plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
+ }
+ return $plugins;
+}
+
/**
* Checks status of current blog.
*
@@ -51,28 +81,24 @@ function ms_site_check() {
return true;
if ( '1' == $current_blog->deleted ) {
- if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) ) {
+ if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) )
return WP_CONTENT_DIR . '/blog-deleted.php';
- } else {
- header( 'HTTP/1.1 410 Gone' );
- wp_die( /*WP_I18N_USER_DELETED_BLOG*/'This user has elected to delete their account and the content is no longer available.'/*/WP_I18N_USER_DELETED_BLOG*/ );
- }
+ else
+ wp_die( __( 'This user has elected to delete their account and the content is no longer available.' ), '', array( 'response' => 410 ) );
}
if ( '2' == $current_blog->deleted ) {
if ( file_exists( WP_CONTENT_DIR . '/blog-inactive.php' ) )
return WP_CONTENT_DIR . '/blog-inactive.php';
else
- wp_die( sprintf( /*WP_I18N_BLOG_NOT_ACTIVATED*/'This site has not been activated yet. If you are having problems activating your site, please contact %1$s.'/*/WP_I18N_BLOG_NOT_ACTIVATED*/, str_replace( '@', ' AT ', get_site_option( 'admin_email', "support@{$current_site->domain}" ) ) ) );
+ wp_die( sprintf( __( 'This site has not been activated yet. If you are having problems activating your site, please contact %1$s.' ), str_replace( '@', ' AT ', get_site_option( 'admin_email', "support@{$current_site->domain}" ) ) ) );
}
if ( $current_blog->archived == '1' || $current_blog->spam == '1' ) {
- if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) ) {
+ if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) )
return WP_CONTENT_DIR . '/blog-suspended.php';
- } else {
- header( 'HTTP/1.1 410 Gone' );
- wp_die( /*WP_I18N_ARCHIVED*/'This site has been archived or suspended.'/*/WP_I18N_ARCHIVED*/ );
- }
+ else
+ wp_die( __( 'This site has been archived or suspended.' ), '', array( 'response' => 410 ) );
}
return true;
@@ -87,16 +113,15 @@ function ms_site_check() {
*/
function get_current_site_name( $current_site ) {
global $wpdb;
- $current_site->site_name = wp_cache_get( $current_site->id . ':current_site_name', 'site-options' );
+
+ $current_site->site_name = wp_cache_get( $current_site->id . ':site_name', 'site-options' );
if ( ! $current_site->site_name ) {
- $current_site->site_name = wp_cache_get( $current_site->id . ':site_name', 'site-options' );
- if ( ! $current_site->site_name ) {
- $current_site->site_name = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = %d AND meta_key = 'site_name'", $current_site->id ) );
- if ( ! $current_site->site_name )
- $current_site->site_name = ucfirst( $current_site->domain );
- }
- wp_cache_set( $current_site->id . ':current_site_name', $current_site->site_name, 'site-options' );
+ $current_site->site_name = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = %d AND meta_key = 'site_name'", $current_site->id ) );
+ if ( ! $current_site->site_name )
+ $current_site->site_name = ucfirst( $current_site->domain );
+ wp_cache_set( $current_site->id . ':site_name', $current_site->site_name, 'site-options' );
}
+
return $current_site;
}
@@ -109,6 +134,10 @@ function get_current_site_name( $current_site ) {
*/
function wpmu_current_site() {
global $wpdb, $current_site, $domain, $path, $sites, $cookie_domain;
+
+ if ( empty( $current_site ) )
+ $current_site = new stdClass;
+
if ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) {
$current_site->id = defined( 'SITE_ID_CURRENT_SITE' ) ? SITE_ID_CURRENT_SITE : 1;
$current_site->domain = DOMAIN_CURRENT_SITE;
@@ -182,11 +211,12 @@ function wpmu_current_site() {
}
// Still no dice.
- // @todo Update or remove WPMU codex link.
+ wp_load_translations_early();
+
if ( 1 == count( $sites ) )
- wp_die( sprintf( /*WP_I18N_BLOG_DOESNT_EXIST*/'That site does not exist. Please try %s.'/*/WP_I18N_BLOG_DOESNT_EXIST*/, $sites[0]->domain . $sites[0]->path ) );
+ wp_die( sprintf( __( 'That site does not exist. Please try %s.' ), 'http://' . $sites[0]->domain . $sites[0]->path ) );
else
- wp_die( /*WP_I18N_NO_SITE_DEFINED*/'No site defined on this host. If you are the owner of this site, please check Debugging WPMU for help.'/*/WP_I18N_NO_SITE_DEFINED*/ );
+ wp_die( __( 'No site defined on this host. If you are the owner of this site, please check Debugging a WordPress Network for help.' ) );
}
/**
@@ -194,27 +224,27 @@ function wpmu_current_site() {
*
* Used when a blog's tables do not exist. Checks for a missing $wpdb->site table as well.
*
- * @todo update Codex link for 3.0.0
- *
* @access private
* @since 3.0.0
*/
function ms_not_installed() {
global $wpdb, $domain, $path;
- $title = /*WP_I18N_FATAL_ERROR*/'Error establishing database connection'/*/WP_I18N_FATAL_ERROR*/;
+ wp_load_translations_early();
+
+ $title = __( 'Error establishing database connection' );
$msg = '
' . /*WP_I18N_CONTACT_OWNER*/'If your site does not display, please contact the owner of this network.'/*/WP_I18N_CONTACT_OWNER*/ . ''; - $msg .= ' ' . /*WP_I18N_CHECK_MYSQL*/'If you are the owner of this network please check that MySQL is running properly and all tables are error free.'/*/WP_I18N_CHECK_MYSQL*/ . '
'; + $msg .= '' . __( 'If your site does not display, please contact the owner of this network.' ) . ''; + $msg .= ' ' . __( 'If you are the owner of this network please check that MySQL is running properly and all tables are error free.' ) . '
'; if ( false && !$wpdb->get_var( "SHOW TABLES LIKE '$wpdb->site'" ) ) - $msg .= '' . sprintf( /*WP_I18N_TABLES_MISSING_LONG*/'Database tables are missing. This means that MySQL is not running, WordPress was not installed properly, or someone deleted %s
. You really should look at your database now.'/*/WP_I18N_TABLES_MISSING_LONG*/, $wpdb->site ) . '
' . sprintf( __( 'Database tables are missing. This means that MySQL is not running, WordPress was not installed properly, or someone deleted %s
. You really should look at your database now.' ), $wpdb->site ) . '
' . sprintf( /*WP_I18N_NO_SITE_FOUND*/'Could not find site %1$s
. Searched for table %2$s
in database %3$s
. Is that right?'/*/WP_I18N_NO_SITE_FOUND*/, rtrim( $domain . $path, '/' ), $wpdb->blogs, DB_NAME ) . '
' . /*WP_I18N_WHAT_DO_I_DO*/'What do I do now?'/*WP_I18N_WHAT_DO_I_DO*/ . ' '; - $msg .= /*WP_I18N_RTFM*/'Read the bug report page. Some of the guidelines there may help you figure out what went wrong.'/*/WP_I18N_RTFM*/; - $msg .= ' ' . /*WP_I18N_STUCK*/'If you’re still stuck with this message, then check that your database contains the following tables:'/*/WP_I18N_STUCK*/ . '
' . sprintf( __( 'Could not find site %1$s
. Searched for table %2$s
in database %3$s
. Is that right?' ), rtrim( $domain . $path, '/' ), $wpdb->blogs, DB_NAME ) . '
' . __( 'What do I do now?' ) . ' '; + $msg .= __( 'Read the bug report page. Some of the guidelines there may help you figure out what went wrong.' ); + $msg .= ' ' . __( 'If you’re still stuck with this message, then check that your database contains the following tables:' ) . '