'%d', 'blog_id' => '%d', 'meta_id' => '%d', 'post_id' => '%d', 'user_status' => '%d', 'umeta_id' => '%d', 'comment_karma' => '%d', 'comment_count' => '%d', // multisite: 'active' => '%d', 'cat_id' => '%d', 'deleted' => '%d', 'lang_id' => '%d', 'mature' => '%d', 'public' => '%d', 'site_id' => '%d', 'spam' => '%d', ); $prefix = $wpdb->set_prefix( $table_prefix ); if ( is_wp_error( $prefix ) ) wp_die( /*WP_I18N_BAD_PREFIX*/'ERROR: $table_prefix in wp-config.php can only contain numbers, letters, and underscores.'/*/WP_I18N_BAD_PREFIX*/ ); } /** * Starts the WordPress object cache. * * If an object-cache.php file exists in the wp-content directory, * it uses that drop-in as an external object cache. * * @access private * @since 3.0.0 */ function wp_start_object_cache() { global $_wp_using_ext_object_cache; $first_init = false; if ( ! function_exists( 'wp_cache_init' ) ) { if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) { require_once ( WP_CONTENT_DIR . '/object-cache.php' ); $_wp_using_ext_object_cache = true; } else { require_once ( ABSPATH . WPINC . '/cache.php' ); $_wp_using_ext_object_cache = false; } $first_init = true; } else if ( !$_wp_using_ext_object_cache && file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) { // Sometimes advanced-cache.php can load object-cache.php before it is loaded here. // This breaks the function_exists check above and can result in $_wp_using_ext_object_cache // being set incorrectly. Double check if an external cache exists. $_wp_using_ext_object_cache = true; } // If cache supports reset, reset instead of init if already initialized. // Reset signals to the cache that global IDs have changed and it may need to update keys // and cleanup caches. if ( !$first_init && function_exists('wp_cache_reset') ) wp_cache_reset(); else wp_cache_init(); if ( function_exists( 'wp_cache_add_global_groups' ) ) { wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts' ) ); wp_cache_add_non_persistent_groups( array( 'comment', 'counts', 'plugins' ) ); } } /** * Redirects to the installer if WordPress is not installed. * * Dies with an error message when multisite is enabled. * * @access private * @since 3.0.0 */ function wp_not_installed() { if ( is_multisite() ) { if ( ! is_blog_installed() && ! defined( 'WP_INSTALLING' ) ) wp_die( __( 'The site you have requested is not installed properly. Please contact the system administrator.' ) ); } elseif ( ! is_blog_installed() && false === strpos( $_SERVER['PHP_SELF'], 'install.php' ) && !defined( 'WP_INSTALLING' ) ) { $link = wp_guess_url() . '/wp-admin/install.php'; require( ABSPATH . WPINC . '/kses.php' ); require( ABSPATH . WPINC . '/pluggable.php' ); require( ABSPATH . WPINC . '/formatting.php' ); wp_redirect( $link ); die(); } } /** * Returns array of must-use plugin files to be included in global scope. * * The default directory is wp-content/mu-plugins. To change the default directory * manually, define WPMU_PLUGIN_DIR and WPMU_PLUGIN_URL * in wp-config.php. * * @access private * @since 3.0.0 * @return array Files to include */ function wp_get_mu_plugins() { $mu_plugins = array(); if ( !is_dir( WPMU_PLUGIN_DIR ) ) return $mu_plugins; if ( ! $dh = opendir( WPMU_PLUGIN_DIR ) ) return $mu_plugins; while ( ( $plugin = readdir( $dh ) ) !== false ) { if ( substr( $plugin, -4 ) == '.php' ) $mu_plugins[] = WPMU_PLUGIN_DIR . '/' . $plugin; } closedir( $dh ); sort( $mu_plugins ); return $mu_plugins; } /** * Returns array of 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.0.0 * @return array Files to include */ function wp_get_active_and_valid_plugins() { $plugins = array(); $active_plugins = (array) get_option( 'active_plugins', array() ); // Check for hacks file if the option is enabled if ( get_option( 'hack_file' ) && file_exists( ABSPATH . 'my-hacks.php' ) ) { _deprecated_file( 'my-hacks.php', '1.5' ); array_unshift( $plugins, ABSPATH . 'my-hacks.php' ); } if ( empty( $active_plugins ) || defined( 'WP_INSTALLING' ) ) return $plugins; $network_plugins = is_multisite() ? wp_get_active_network_plugins() : false; 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 // not already included as a network plugin && ( ! $network_plugins || ! in_array( WP_PLUGIN_DIR . '/' . $plugin, $network_plugins ) ) ) $plugins[] = WP_PLUGIN_DIR . '/' . $plugin; } return $plugins; } /** * Sets internal encoding using mb_internal_encoding(). * * In most cases the default internal encoding is latin1, which is of no use, * since we want to use the mb_ functions for utf-8 strings. * * @access private * @since 3.0.0 */ function wp_set_internal_encoding() { if ( function_exists( 'mb_internal_encoding' ) ) { if ( !@mb_internal_encoding( get_option( 'blog_charset' ) ) ) mb_internal_encoding( 'UTF-8' ); } } /** * Add magic quotes to $_GET, $_POST, $_COOKIE, and $_SERVER. * * Also forces $_REQUEST to be $_GET + $_POST. If $_SERVER, $_COOKIE, * or $_ENV are needed, use those superglobals directly. * * @access private * @since 3.0.0 */ function wp_magic_quotes() { // If already slashed, strip. if ( get_magic_quotes_gpc() ) { $_GET = stripslashes_deep( $_GET ); $_POST = stripslashes_deep( $_POST ); $_COOKIE = stripslashes_deep( $_COOKIE ); } // Escape with wpdb. $_GET = add_magic_quotes( $_GET ); $_POST = add_magic_quotes( $_POST ); $_COOKIE = add_magic_quotes( $_COOKIE ); $_SERVER = add_magic_quotes( $_SERVER ); // Force REQUEST to be GET + POST. $_REQUEST = array_merge( $_GET, $_POST ); } /** * Runs just before PHP shuts down execution. * * @access private * @since 1.2.0 */ function shutdown_action_hook() { do_action( 'shutdown' ); wp_cache_close(); } /** * Copy an object. * * @since 2.7.0 * @deprecated 3.2 * * @param object $object The object to clone * @return object The cloned object */ function wp_clone( $object ) { // Use parens for clone to accommodate PHP 4. See #17880 return clone( $object ); } /** * Whether the current request is for a network or blog admin page * * 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 1.5.1 * * @return bool True if inside WordPress administration pages. */ function is_admin() { if ( defined( 'WP_ADMIN' ) ) return WP_ADMIN; return false; } /** * Whether the current request is for a blog admin screen /wp-admin/ * * Does not inform on whether the user is a blog 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_blog_admin() { if ( defined( 'WP_BLOG_ADMIN' ) ) return WP_BLOG_ADMIN; return false; } /** * Whether the current request is for a network admin screen /wp-admin/network/ * * Does not inform on whether the user 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 ( 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 ( 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; } ?>