is a network admin! Use capability checks to * tell if the user should be accessing a section or not. * * @since 3.1.0 * * @return bool True if inside WordPress network administration pages. */ function is_network_admin() { if ( isset( $GLOBALS['current_screen'] ) ) return $GLOBALS['current_screen']->in_admin( 'network' ); elseif ( defined( 'WP_NETWORK_ADMIN' ) ) return WP_NETWORK_ADMIN; return false; } /** * Whether the current request is for a user admin screen /wp-admin/user/ * * Does not inform on whether the user is an admin! Use capability checks to * tell if the user should be accessing a section or not. * * @since 3.1.0 * * @return bool True if inside WordPress user administration pages. */ function is_user_admin() { if ( isset( $GLOBALS['current_screen'] ) ) return $GLOBALS['current_screen']->in_admin( 'user' ); elseif ( defined( 'WP_USER_ADMIN' ) ) return WP_USER_ADMIN; return false; } /** * Whether Multisite support is enabled * * @since 3.0.0 * * @return bool True if multisite is enabled, false otherwise. */ function is_multisite() { if ( defined( 'MULTISITE' ) ) return MULTISITE; if ( defined( 'SUBDOMAIN_INSTALL' ) || defined( 'VHOST' ) || defined( 'SUNRISE' ) ) return true; return false; } /** * Retrieve the current blog id * * @since 3.1.0 * * @return int Blog id */ function get_current_blog_id() { global $blog_id; return absint($blog_id); } /** * Attempts 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 */ 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(); } if ( !defined('WPMU_PLUGIN_URL') ) define( 'WPMU_PLUGIN_URL', WP_CONTENT_URL . '/mu-plugins' ); // full url, no trailing slash /** * Allows for the mu-plugins directory to be moved from the default location. * * @since 2.8.0 * @deprecated */ if ( !defined( 'MUPLUGINDIR' ) ) define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat. } /** * Defines cookie related WordPress constants * * Defines constants after multisite is loaded. Cookie-related constants may be overridden in ms_network_cookies(). * @since 3.0.0 */ function wp_cookie_constants() { /** * Used to guarantee unique hash cookies * @since 1.5 */ if ( !defined( 'COOKIEHASH' ) ) { $siteurl = get_site_option( 'siteurl' ); if ( $siteurl ) define( 'COOKIEHASH', md5( $siteurl ) ); else define( 'COOKIEHASH', '' ); } /** * @since 2.0.0 */ if ( !defined('USER_COOKIE') ) define('USER_COOKIE', 'wordpressuser_' . COOKIEHASH); /** * @since 2.0.0 */ if ( !defined('PASS_COOKIE') ) define('PASS_COOKIE', 'wordpresspass_' . COOKIEHASH); /** * @since 2.5.0 */ if ( !defined('AUTH_COOKIE') ) define('AUTH_COOKIE', 'wordpress_' . COOKIEHASH); /** * @since 2.6.0 */ if ( !defined('SECURE_AUTH_COOKIE') ) define('SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH); /** * @since 2.6.0 */ if ( !defined('LOGGED_IN_COOKIE') ) define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH); /** * @since 2.3.0 */ if ( !defined('TEST_COOKIE') ) define('TEST_COOKIE', 'wordpress_test_cookie'); /** * @since 1.2.0 */ if ( !defined('COOKIEPATH') ) define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) ); /** * @since 1.5.0 */ if ( !defined('SITECOOKIEPATH') ) define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) ); /** * @since 2.6.0 */ if ( !defined('ADMIN_COOKIE_PATH') ) define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' ); /** * @since 2.6.0 */ if ( !defined('PLUGINS_COOKIE_PATH') ) define( 'PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL) ); /** * @since 2.0.0 */ if ( !defined('COOKIE_DOMAIN') ) define('COOKIE_DOMAIN', false); } /** * Defines cookie related WordPress constants * * @since 3.0.0 */ function wp_ssl_constants() { /** * @since 2.6.0 */ if ( !defined('FORCE_SSL_ADMIN') ) define('FORCE_SSL_ADMIN', false); force_ssl_admin(FORCE_SSL_ADMIN); /** * @since 2.6.0 */ if ( !defined('FORCE_SSL_LOGIN') ) define('FORCE_SSL_LOGIN', false); force_ssl_login(FORCE_SSL_LOGIN); } /** * Defines functionality related WordPress constants * * @since 3.0.0 */ function wp_functionality_constants() { /** * @since 2.5.0 */ if ( !defined( 'AUTOSAVE_INTERVAL' ) ) define( 'AUTOSAVE_INTERVAL', 60 ); /** * @since 2.9.0 */ if ( !defined( 'EMPTY_TRASH_DAYS' ) ) define( 'EMPTY_TRASH_DAYS', 30 ); if ( !defined('WP_POST_REVISIONS') ) define('WP_POST_REVISIONS', true); /** * @since 3.3.0 */ if ( !defined( 'WP_CRON_LOCK_TIMEOUT' ) ) define('WP_CRON_LOCK_TIMEOUT', 60); // In seconds } /** * Defines templating related WordPress constants * * @since 3.0.0 */ function wp_templating_constants() { /** * Filesystem path to the current active template directory * @since 1.5.0 */ define('TEMPLATEPATH', get_template_directory()); /** * Filesystem path to the current active template stylesheet directory * @since 2.1.0 */ define('STYLESHEETPATH', get_stylesheet_directory()); /** * Slug of the default theme for this install. * Used as the default theme when installing new sites. * Will be used as the fallback if the current theme doesn't exist. * @since 3.0.0 */ if ( !defined('WP_DEFAULT_THEME') ) define( 'WP_DEFAULT_THEME', 'twentyfourteen' ); }