/** * Bootstrap the plugin and get it started! */ function bootstrap() { wp_cache_add_global_groups(array('cavalcade')); if (!is_installed()) { create_tables(); } }
/** * Attach Mercator into WordPress * * Imagine this as attaching the strings to the puppet. */ function startup() { // Define the table variables if (empty($GLOBALS['wpdb']->dmtable)) { $GLOBALS['wpdb']->dmtable = $GLOBALS['wpdb']->base_prefix . 'domain_mapping'; $GLOBALS['wpdb']->ms_global_tables[] = 'domain_mapping'; } // Ensure cache is shared wp_cache_add_global_groups(array('domain_mapping', 'network_mapping')); // Actually hook in! add_filter('pre_get_site_by_path', __NAMESPACE__ . '\\check_domain_mapping', 10, 2); add_action('admin_init', __NAMESPACE__ . '\\load_admin', -100); add_action('delete_blog', __NAMESPACE__ . '\\clear_mappings_on_delete'); add_action('muplugins_loaded', __NAMESPACE__ . '\\register_mapped_filters', -10); // Add CLI commands if (defined('WP_CLI') && WP_CLI) { WP_CLI::add_command('mercator mapping', __NAMESPACE__ . '\\CLI\\Mapping_Command'); WP_CLI::add_command('mercator network-mapping', __NAMESPACE__ . '\\CLI\\Network_Mapping_Command'); } /** * Fired after Mercator core has been loaded * * Hook into this to handle any add-on functionality. */ do_action('mercator_load'); }
/** * Constructor. * * @param string $key_prefix * @param string $group */ public function __construct($key_prefix = '', $group = '') { $this->key_prefix = $key_prefix; $this->group = $group; if (function_exists('wp_cache_add_global_groups')) { wp_cache_add_global_groups([$group]); } }
/** * Constructor. Allows you to set a key prefix and * the Object Cache group to use. * * Setting a custom prefix or group isn't required, see: * https://github.com/bobthecow/mustache.php/issues/246 * * @param string $key_prefix * @param string $group */ public function __construct($key_prefix = '', $group = 'mustache-cache') { $this->key_prefix = $key_prefix; $this->group = $group; //Add to global cache group so that we do not cache the same templates multiple times on multisite if (function_exists('wp_cache_add_global_groups')) { wp_cache_add_global_groups(array($group)); } }
/** * Add global cache groups. * * @uses wp_cache_add_global_groups * * @param array $args Function arguments. * @param array $assoc_args Function arguments with parameter key. * @return void */ public function add_global_groups($args, $assoc_args) { if (empty($args)) { WP_CLI::line('usage: wp cache add_global_groups <group>'); exit; } $group = $args[0]; wp_cache_add_global_groups($group); }
/** * Constructor. */ function __construct() { /** /* Memcached Object Cache v2.0.2 doesn't like when we loop on switch_to_blog() /* We "fix" this by storing our cached items in global group 'pb' */ wp_cache_add_global_groups(array('pb')); $this->registerThemeDirectories(); do_action('pressbooks_loaded'); }
function configure_groups() { // Configure the memcached client if (!$this->remote) { if (function_exists('wp_cache_add_no_remote_groups')) { wp_cache_add_no_remote_groups(array($this->group)); } } if (function_exists('wp_cache_add_global_groups')) { wp_cache_add_global_groups(array($this->group)); } }
function flush_cache() { global $wp_object_cache; $wp_object_cache->group_ops = array(); $wp_object_cache->stats = array(); $wp_object_cache->memcache_debug = array(); $wp_object_cache->cache = array(); if ( method_exists( $wp_object_cache, '__remoteset' ) ) { $wp_object_cache->__remoteset(); } wp_cache_flush(); wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache' ) ); wp_cache_add_non_persistent_groups( array( 'comment', 'counts', 'plugins' ) ); }
function flush_cache() { global $wp_object_cache; $wp_object_cache->group_ops = array(); $wp_object_cache->stats = array(); $wp_object_cache->memcache_debug = array(); $wp_object_cache->cache = array(); if (method_exists($wp_object_cache, '__remoteset')) { $wp_object_cache->__remoteset(); } wp_cache_flush(); wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'usermail', 'usernicename')); }
/** * Attach Mercator into WordPress * * Imagine this as attaching the strings to the puppet. */ function startup() { // Define the table variables if (empty($GLOBALS['wpdb']->dmtable)) { $GLOBALS['wpdb']->dmtable = $GLOBALS['wpdb']->base_prefix . 'domain_mapping'; $GLOBALS['wpdb']->ms_global_tables[] = 'domain_mapping'; } // Ensure cache is shared wp_cache_add_global_groups(array('domain_mapping')); // Actually hook in! add_filter('pre_get_site_by_path', __NAMESPACE__ . '\\check_domain_mapping', 10, 2); add_action('admin_init', __NAMESPACE__ . '\\load_admin', -100); }
/** * WordPress action to set up data-related WordPress hooks. * * @since 1.4 * @usedby do_action() init */ public static function init() { global $geo_mashup_options; // Some caching plugins don't implement this if (function_exists('wp_cache_add_global_groups')) { wp_cache_add_global_groups(array('geo_mashup_object_locations', 'geo_mashup_locations')); } // Avoid orphans add_action('delete_post', array('GeoMashupDB', 'delete_post')); add_action('delete_comment', array('GeoMashupDB', 'delete_comment')); add_action('delete_user', array('GeoMashupDB', 'delete_user')); if ('true' == $geo_mashup_options->get('overall', 'copy_geodata')) { self::add_geodata_sync_hooks(); } }
/** * WordPress action to set up data-related WordPress hooks. * * @since 1.4 */ public static function init() { global $geo_mashup_options; // Enable the geo_mashup_query var add_filter('query_vars', array('GeoMashupDB', 'query_vars')); add_filter('posts_fields', array('GeoMashupDB', 'posts_fields'), 10, 2); add_filter('posts_join', array('GeoMashupDB', 'posts_join'), 10, 2); add_filter('posts_where', array('GeoMashupDB', 'posts_where'), 10, 2); add_action('parse_query', array('GeoMashupDB', 'parse_query')); // Some caching plugins don't implement this if (function_exists('wp_cache_add_global_groups')) { wp_cache_add_global_groups(array('geo_mashup_object_locations', 'geo_mashup_locations')); } // Avoid orphans add_action('delete_post', array('GeoMashupDB', 'delete_post')); add_action('delete_comment', array('GeoMashupDB', 'delete_comment')); add_action('delete_user', array('GeoMashupDB', 'delete_user')); if ('true' == $geo_mashup_options->get('overall', 'copy_geodata') or '' != $geo_mashup_options->get('overall', 'import_custom_field')) { self::add_geodata_sync_hooks(); } }
/** * Initializes the plugin. * * Loads the required files, registers the new DB table, global cache groups and global capabilities. * * @since 1.0.0 */ function ga_init() { if (!function_exists('wp_network_roles')) { add_action('admin_notices', 'ga_requirements_notice_network_roles'); add_action('network_admin_notices', 'ga_requirements_notice_network_roles'); return; } define('GA_PATH', plugin_dir_path(__FILE__)); define('GA_URL', plugin_dir_url(__FILE__)); require_once GA_PATH . 'global-admin/wp-includes/load.php'; require_once GA_PATH . 'global-admin/wp-includes/option.php'; require_once GA_PATH . 'global-admin/wp-includes/class-wp-global-role.php'; require_once GA_PATH . 'global-admin/wp-includes/class-wp-global-roles.php'; require_once GA_PATH . 'global-admin/wp-includes/capabilities.php'; require_once GA_PATH . 'global-admin/wp-includes/class-wp-user-with-network-and-global-roles.php'; require_once GA_PATH . 'global-admin/wp-includes/user.php'; require_once GA_PATH . 'global-admin/wp-includes/link-template.php'; require_once GA_PATH . 'global-admin/wp-includes/admin-bar.php'; require_once GA_PATH . 'global-admin/wp-includes/ms-functions.php'; require_once GA_PATH . 'global-admin/wp-includes/ms-default-filters.php'; require_once GA_PATH . 'global-admin/wp-admin/includes/schema.php'; require_once GA_PATH . 'global-admin/wp-admin/includes/hacks.php'; require_once ABSPATH . 'wp-admin/includes/plugin.php'; if (is_plugin_active('wp-multi-network/wpmn-loader.php')) { require_once GA_PATH . 'global-admin/multi-network-compat.php'; } if (is_plugin_active('wp-user-signups/wp-user-signups.php')) { require_once GA_PATH . 'global-admin/user-signups-compat.php'; } if (is_multinetwork()) { ga_register_table(); add_action('setup_theme', 'ga_setup_wp_global_roles', 1); } if (function_exists('wp_cache_add_global_groups')) { wp_cache_add_global_groups(array('global-options', 'global-transient')); } }
/** * 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')); } }
function restore_current_blog() { global $table_prefix, $wpdb, $blog_id, $switched, $switched_stack, $wp_roles, $wp_object_cache; if (!$switched) { return false; } if (!is_array($switched_stack)) { return false; } $blog = array_pop($switched_stack); if ($blog_id == $blog) { do_action('switch_blog', $blog, $blog); /* If we still have items in the switched stack, consider ourselves still 'switched' */ $switched = is_array($switched_stack) && count($switched_stack) > 0; return true; } $wpdb->set_blog_id($blog); $prev_blog_id = $blog_id; $blog_id = $blog; $table_prefix = $wpdb->prefix; if (is_object($wp_roles)) { $wpdb->suppress_errors(); if (method_exists($wp_roles, '_init')) { $wp_roles->_init(); } elseif (method_exists($wp_roles, '__construct')) { $wp_roles->__construct(); } $wpdb->suppress_errors(false); } if (did_action('init')) { $current_user = wp_get_current_user(); if (is_object($current_user)) { $current_user->for_blog($blog_id); } } if (is_object($wp_object_cache) && isset($wp_object_cache->global_groups)) { $global_groups = $wp_object_cache->global_groups; } else { $global_groups = false; } wp_cache_init(); if (function_exists('wp_cache_add_global_groups')) { if (is_array($global_groups)) { wp_cache_add_global_groups($global_groups); } else { 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')); } do_action('switch_blog', $blog_id, $prev_blog_id); /* If we still have items in the switched stack, consider ourselves still 'switched' */ $switched = is_array($switched_stack) && count($switched_stack) > 0; return true; }
/** * Setup cache groups * * @since BuddyPress (2.2.0) */ public function setup_cache_groups() { // Global groups wp_cache_add_global_groups(array('bp_last_activity', 'bp_member_type')); parent::setup_cache_groups(); }
$can_clone = version_compare( phpversion(), '5.0', '>=' ); } return $can_clone ? clone( $object ) : $object; } 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; } wp_cache_init(); if ( function_exists('wp_cache_add_global_groups') ) { wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta')); wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' )); } require (ABSPATH . WPINC . '/plugin.php'); require (ABSPATH . WPINC . '/default-filters.php'); include_once(ABSPATH . WPINC . '/pomo/mo.php'); require_once (ABSPATH . WPINC . '/l10n.php'); if ( !is_blog_installed() && (strpos($_SERVER['PHP_SELF'], 'install.php') === false && !defined('WP_INSTALLING')) ) { if ( defined('WP_SITEURL') ) $link = WP_SITEURL . '/wp-admin/install.php'; elseif (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $link = preg_replace('|/wp-admin/?.*?$|', '/', $_SERVER['PHP_SELF']) . 'wp-admin/install.php'; else $link = preg_replace('|/[^/]+?$|', '/', $_SERVER['PHP_SELF']) . 'wp-admin/install.php';
/** * Setup cache groups. * * @since 2.2.0 */ public function setup_cache_groups() { // Global groups. wp_cache_add_global_groups(array('bp_notifications', 'notification_meta')); parent::setup_cache_groups(); }
/** * Setup cache groups. * * @since 2.2.0 */ public function setup_cache_groups() { // Global groups. wp_cache_add_global_groups(array('bp_activity', 'bp_activity_comments', 'activity_meta')); parent::setup_cache_groups(); }
/** * Add's 'bp' to global group of network wide cachable objects * * @package BuddyPress Core */ function bp_core_add_global_group() { wp_cache_init(); wp_cache_add_global_groups(array('bp')); }
/** * Setup cache groups * * @since 2.2.0 */ public function setup_cache_groups() { // Global groups wp_cache_add_global_groups(array('bp_messages', 'bp_messages_threads', 'bp_messages_unread_count', 'message_meta')); parent::setup_cache_groups(); }
/** * Setup cache groups * * @since 2.2.0 */ public function setup_cache_groups() { // Global groups. wp_cache_add_global_groups(array('bp_groups', 'bp_group_admins', 'bp_group_invite_count', 'group_meta')); parent::setup_cache_groups(); }
/** * Setup cache groups * * @since BuddyPress (2.2.0) */ public function setup_cache_groups() { // Global groups wp_cache_add_global_groups(array('bp_xprofile', 'bp_xprofile_data', 'bp_xprofile_groups', 'xprofile_meta')); parent::setup_cache_groups(); }
/** * Setup cache groups. * * @since 2.2.0 */ public function setup_cache_groups() { // Global groups. wp_cache_add_global_groups(array('bp_friends_requests')); parent::setup_cache_groups(); }
/** * Restore the current blog, after calling switch_to_blog() * * @see switch_to_blog() * @since MU * * @return bool True on success, false if we're already on the current blog */ function restore_current_blog() { global $wpdb, $wp_roles; if (empty($GLOBALS['_wp_switched_stack'])) { return false; } $blog = array_pop($GLOBALS['_wp_switched_stack']); if ($GLOBALS['blog_id'] == $blog) { /** This filter is documented in wp-includes/ms-blogs.php */ do_action('switch_blog', $blog, $blog); // If we still have items in the switched stack, consider ourselves still 'switched' $GLOBALS['switched'] = !empty($GLOBALS['_wp_switched_stack']); return true; } $wpdb->set_blog_id($blog); $prev_blog_id = $GLOBALS['blog_id']; $GLOBALS['blog_id'] = $blog; $GLOBALS['table_prefix'] = $wpdb->get_blog_prefix(); if (function_exists('wp_cache_switch_to_blog')) { wp_cache_switch_to_blog($blog); } else { global $wp_object_cache; if (is_object($wp_object_cache) && isset($wp_object_cache->global_groups)) { $global_groups = $wp_object_cache->global_groups; } else { $global_groups = false; } wp_cache_init(); if (function_exists('wp_cache_add_global_groups')) { if (is_array($global_groups)) { wp_cache_add_global_groups($global_groups); } else { wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts', ' blog-id-cache')); } wp_cache_add_non_persistent_groups(array('comment', 'counts', 'plugins')); } } if (did_action('init')) { $wp_roles->reinit(); $current_user = wp_get_current_user(); $current_user->for_blog($blog); } /** This filter is documented in wp-includes/ms-blogs.php */ do_action('switch_blog', $blog, $prev_blog_id); // If we still have items in the switched stack, consider ourselves still 'switched' $GLOBALS['switched'] = !empty($GLOBALS['_wp_switched_stack']); return true; }
* Note: This file should live in wp-content, next to the advanced-cache * drop-in. * * This file is included from within the advanced-cache.php drop-in, * before the object cache has been initialised, so we have to * initialise it manually. */ global $batcache; if (!(include_once WP_CONTENT_DIR . '/object-cache.php')) { return; } wp_cache_init(); if (!is_object($wp_object_cache)) { return; } wp_cache_add_global_groups(array('batcache')); /** * The cache group is in the format <group>_<incrementor>, where <group> * is the value of the defined batcache group and <incrementor> is a * generated integer value which we increment to invalidate the cache. */ $batcache = is_array($batcache) ? $batcache : array('group' => 'batcache'); $prefix = isset($batcache['group']) ? $batcache['group'] : 'batcache'; $batcache['group'] = $prefix . '_' . batcache_get_incr(); /** * Increment the batcache group incrementor value, invalidating the cache. * @return false|int False on failure, the item's new value on success. */ function batcache_flush_all() { return wp_cache_incr('cache_incrementors', 1, 'batcache');
/** * Start 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. * * @since 3.0.0 * @access private * * @global int $blog_id Blog ID. */ function wp_start_object_cache() { global $blog_id; $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'; if (function_exists('wp_cache_init')) { wp_using_ext_object_cache(true); } } $first_init = true; } elseif (!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 (!wp_using_ext_object_cache()) { require_once ABSPATH . WPINC . '/cache.php'; } /* * 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_switch_to_blog')) { wp_cache_switch_to_blog($blog_id); } elseif (function_exists('wp_cache_init')) { wp_cache_init(); } if (function_exists('wp_cache_add_global_groups')) { wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache')); wp_cache_add_non_persistent_groups(array('comment', 'counts', 'plugins')); } }
require_once GP_PATH . GP_INC . 'cli.php'; /** * Define the full path to the object cache functions include */ if (!defined('GP_OBJECT_CACHE_FUNCTIONS_INCLUDE')) { define('GP_OBJECT_CACHE_FUNCTIONS_INCLUDE', BACKPRESS_PATH . 'loader.wp-object-cache.php'); } // Load the database class if (GP_OBJECT_CACHE_FUNCTIONS_INCLUDE && !function_exists('wp_cache_init')) { require_once GP_OBJECT_CACHE_FUNCTIONS_INCLUDE; } // Instantiate the $wp_object_cache object using wp_cache_init() if (!isset($wp_object_cache) && function_exists('wp_cache_init')) { wp_cache_init(); if (function_exists('wp_cache_add_global_groups')) { wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'usermail', 'usernicename')); } } require_once GP_PATH . GP_INC . 'class.bp-options.php'; require_once BACKPRESS_PATH . 'functions.bp-options.php'; require_once BACKPRESS_PATH . 'class.wp-http.php'; require_once BACKPRESS_PATH . 'class.wp-dependencies.php'; require_once BACKPRESS_PATH . 'class.wp-styles.php'; require_once BACKPRESS_PATH . 'functions.wp-styles.php'; require_once BACKPRESS_PATH . 'class.wp-scripts.php'; require_once BACKPRESS_PATH . 'functions.wp-scripts.php'; require_once GP_PATH . GP_INC . 'assets-loader.php'; require_once GP_PATH . GP_INC . 'default-filters.php'; require_once BACKPRESS_PATH . 'functions.kses.php'; require_once GP_POMO_PATH . 'mo.php'; require_once GP_POMO_PATH . 'po.php';
/** * Constructor for WP_Theme. * * @param string $theme_dir Directory of the theme within the theme_root. * @param string $theme_root Theme root. * @param WP_Error|null $child If this theme is a parent theme, the child may be passed for validation purposes. */ public function __construct($theme_dir, $theme_root, $child = null) { // Initialize caching on first run. if (!isset(self::$persistently_cache)) { self::$persistently_cache = apply_filters('wp_cache_themes_persistently', false, 'WP_Theme'); if (self::$persistently_cache) { wp_cache_add_global_groups('themes'); if (is_int(self::$persistently_cache)) { self::$cache_expiration = self::$persistently_cache; } } else { wp_cache_add_non_persistent_groups('themes'); } } $this->theme_root = $theme_root; $this->stylesheet = $theme_dir; $theme_file = $this->stylesheet . '/style.css'; $cache = $this->cache_get('theme'); if (is_array($cache)) { foreach (array('errors', 'headers', 'template') as $key) { if (isset($cache[$key])) { $this->{$key} = $cache[$key]; } } if ($this->errors) { return; } if (isset($cache['theme_root_template'])) { $theme_root_template = $cache['theme_root_template']; } } elseif (!file_exists($this->theme_root . '/' . $theme_file)) { $this->headers['Name'] = $this->stylesheet; $this->errors = new WP_Error('theme_no_stylesheet', __('Stylesheet is missing.')); $this->cache_add('theme', array('headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet)); if (!file_exists($this->theme_root)) { // Don't cache this one. $this->errors->add('theme_root_missing', __('ERROR: The themes directory is either empty or doesn’t exist. Please check your installation.')); } return; } elseif (!is_readable($this->theme_root . '/' . $theme_file)) { $this->headers['Name'] = $this->stylesheet; $this->errors = new WP_Error('theme_stylesheet_not_readable', __('Stylesheet is not readable.')); $this->cache_add('theme', array('headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet)); return; } else { $this->headers = get_file_data($this->theme_root . '/' . $theme_file, self::$file_headers, 'theme'); // Default themes always trump their pretenders. // Properly identify default themes that are inside a directory within wp-content/themes. if ($default_theme_slug = array_search($this->headers['Name'], self::$default_themes)) { if (basename($this->stylesheet) != $default_theme_slug) { $this->headers['Name'] .= '/' . $this->stylesheet; } } } // (If template is set from cache, we know it's good.) if (!$this->template && !($this->template = $this->headers['Template'])) { if (file_exists($this->theme_root . '/' . $this->stylesheet . '/index.php')) { $this->template = $this->stylesheet; } else { $this->errors = new WP_Error('theme_no_index', __('Template is missing.')); $this->cache_add('theme', array('headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet)); return; } } // If we got our data from cache, we can assume that 'template' is pointing to the right place. if (!is_array($cache) && $this->template != $this->stylesheet && !file_exists($this->theme_root . '/' . $this->template . '/index.php')) { // If we're in a directory of themes inside /themes, look for the parent nearby. // wp-content/themes/directory-of-themes/* $parent_dir = dirname($this->stylesheet); if ('.' != $parent_dir && file_exists($this->theme_root . '/' . $parent_dir . '/' . $this->template . '/index.php')) { $this->template = $parent_dir . '/' . $this->template; } elseif (($directories = search_theme_directories()) && isset($directories[$this->template])) { // Look for the template in the search_theme_directories() results, in case it is in another theme root. // We don't look into directories of themes, just the theme root. $theme_root_template = $directories[$this->template]['theme_root']; } else { // Parent theme is missing. $this->errors = new WP_Error('theme_no_parent', sprintf(__('The parent theme is missing. Please install the "%s" parent theme.'), $this->template)); $this->cache_add('theme', array('headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template)); return; } } // Set the parent, if we're a child theme. if ($this->template != $this->stylesheet) { // If we are a parent, then there is a problem. Only two generations allowed! Cancel things out. if (is_a($child, 'WP_Theme') && $child->template == $this->stylesheet) { $child->parent = null; $child->errors = new WP_Error('theme_parent_invalid', sprintf(__('The "%s" theme is not a valid parent theme.'), $child->template)); $child->cache_add('theme', array('headers' => $child->headers, 'errors' => $child->errors, 'stylesheet' => $child->stylesheet, 'template' => $child->template)); // The two themes actually reference each other with the Template header. if ($child->stylesheet == $this->template) { $this->errors = new WP_Error('theme_parent_invalid', sprintf(__('The "%s" theme is not a valid parent theme.'), $this->template)); $this->cache_add('theme', array('headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template)); } return; } // Set the parent. Pass the current instance so we can do the crazy checks above and assess errors. $this->parent = new WP_Theme($this->template, isset($theme_root_template) ? $theme_root_template : $this->theme_root, $this); } // We're good. If we didn't retrieve from cache, set it. if (!is_array($cache)) { $cache = array('headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template); // If the parent theme is in another root, we'll want to cache this. Avoids an entire branch of filesystem calls above. if (isset($theme_root_template)) { $cache['theme_root_template'] = $theme_root_template; } $this->cache_add('theme', $cache); } }
require_once ABSPATH . 'wpmu-settings.php'; $wpdb->blogid = $current_blog->blog_id; $wpdb->siteid = $current_blog->site_id; $wpdb->set_prefix($table_prefix); // set up blog tables $table_prefix = $table_prefix . $blog_id . '_'; // Fix empty PHP_SELF $PHP_SELF = $_SERVER['PHP_SELF']; if (empty($PHP_SELF) || empty($PHP_SELF) && constant('VHOST') == 'no' && $current_blog->path != '/') { $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\\?.*)?\$/", '', $_SERVER["REQUEST_URI"]); } wp_cache_init(); // need to init cache again after blog_id is set if (function_exists('wp_cache_add_global_groups')) { // need to add these again. Yes, it's an ugly hack wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss')); wp_cache_add_non_persistent_groups(array('comment', 'counts', 'plugins')); } if (!defined("UPLOADBLOGSDIR")) { define("UPLOADBLOGSDIR", 'wp-content/blogs.dir'); } if (!defined("UPLOADS")) { define("UPLOADS", UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/"); } if (!defined("BLOGUPLOADDIR")) { define("BLOGUPLOADDIR", WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/"); } require ABSPATH . WPINC . '/plugin.php'; require ABSPATH . WPINC . '/default-filters.php'; include_once ABSPATH . WPINC . '/pomo/mo.php'; /**