+/**
+ * Retrieve the current blog ID.
+ *
+ * @since 3.1.0
+ *
+ * @global int $blog_id
+ *
+ * @return int Blog id
+ */
+function get_current_blog_id() {
+ global $blog_id;
+ return absint($blog_id);
+}
+
+/**
+ * Attempt an early load of translations.
+ *
+ * Used for errors encountered during the initial loading process, before
+ * the locale has been properly detected and loaded.
+ *
+ * Designed for unusual load sequences (like setup-config.php) or for when
+ * the script will then terminate with an error, otherwise there is a risk
+ * that a file can be double-included.
+ *
+ * @since 3.4.0
+ * @access private
+ *
+ * @global string $text_direction
+ * @global WP_Locale $wp_locale The WordPress date and time locale object.
+ *
+ * @staticvar bool $loaded
+ */
+function wp_load_translations_early() {
+ global $text_direction, $wp_locale;
+
+ static $loaded = false;
+ if ( $loaded )
+ return;
+ $loaded = true;
+
+ if ( function_exists( 'did_action' ) && did_action( 'init' ) )
+ return;
+
+ // We need $wp_local_package
+ require ABSPATH . WPINC . '/version.php';
+
+ // Translation and localization
+ require_once ABSPATH . WPINC . '/pomo/mo.php';
+ require_once ABSPATH . WPINC . '/l10n.php';
+ require_once ABSPATH . WPINC . '/locale.php';
+
+ // General libraries
+ require_once ABSPATH . WPINC . '/plugin.php';
+
+ $locales = $locations = array();
+
+ while ( true ) {
+ if ( defined( 'WPLANG' ) ) {
+ if ( '' == WPLANG )
+ break;
+ $locales[] = WPLANG;
+ }
+
+ if ( isset( $wp_local_package ) )
+ $locales[] = $wp_local_package;
+
+ if ( ! $locales )
+ break;
+
+ if ( defined( 'WP_LANG_DIR' ) && @is_dir( WP_LANG_DIR ) )
+ $locations[] = WP_LANG_DIR;
+
+ if ( defined( 'WP_CONTENT_DIR' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) )
+ $locations[] = WP_CONTENT_DIR . '/languages';
+
+ if ( @is_dir( ABSPATH . 'wp-content/languages' ) )
+ $locations[] = ABSPATH . 'wp-content/languages';
+
+ if ( @is_dir( ABSPATH . WPINC . '/languages' ) )
+ $locations[] = ABSPATH . WPINC . '/languages';
+
+ if ( ! $locations )
+ break;
+
+ $locations = array_unique( $locations );
+
+ foreach ( $locales as $locale ) {
+ foreach ( $locations as $location ) {
+ if ( file_exists( $location . '/' . $locale . '.mo' ) ) {
+ load_textdomain( 'default', $location . '/' . $locale . '.mo' );
+ if ( defined( 'WP_SETUP_CONFIG' ) && file_exists( $location . '/admin-' . $locale . '.mo' ) )
+ load_textdomain( 'default', $location . '/admin-' . $locale . '.mo' );
+ break 2;
+ }
+ }
+ }
+
+ break;
+ }
+
+ $wp_locale = new WP_Locale();
+}
+
+/**
+ * Check or set whether WordPress is in "installation" mode.
+ *
+ * If the `WP_INSTALLING` constant is defined during the bootstrap, `wp_installing()` will default to `true`.
+ *
+ * @since 4.4.0
+ *
+ * @staticvar bool $installing
+ *
+ * @param bool $is_installing Optional. True to set WP into Installing mode, false to turn Installing mode off.
+ * Omit this parameter if you only want to fetch the current status.
+ * @return bool True if WP is installing, otherwise false. When a `$is_installing` is passed, the function will
+ * report whether WP was in installing mode prior to the change to `$is_installing`.
+ */
+function wp_installing( $is_installing = null ) {
+ static $installing = null;
+
+ // Support for the `WP_INSTALLING` constant, defined before WP is loaded.
+ if ( is_null( $installing ) ) {
+ $installing = defined( 'WP_INSTALLING' ) && WP_INSTALLING;
+ }
+
+ if ( ! is_null( $is_installing ) ) {
+ $old_installing = $installing;
+ $installing = $is_installing;
+ return (bool) $old_installing;
+ }
+
+ return (bool) $installing;
+}