本文整理汇总了PHP中wp_cache_add_global_groups函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_cache_add_global_groups函数的具体用法?PHP wp_cache_add_global_groups怎么用?PHP wp_cache_add_global_groups使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_cache_add_global_groups函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: bootstrap
/**
* Bootstrap the plugin and get it started!
*/
function bootstrap()
{
wp_cache_add_global_groups(array('cavalcade'));
if (!is_installed()) {
create_tables();
}
}
开发者ID:pewresearch,项目名称:Cavalcade,代码行数:10,代码来源:plugin.php
示例2: startup
/**
* 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');
}
开发者ID:tholu,项目名称:Mercator,代码行数:31,代码来源:mercator.php
示例3: __construct
/**
* 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]);
}
}
开发者ID:frozzare,项目名称:digster,代码行数:14,代码来源:class-wordpress-cache-adapter.php
示例4: __construct
/**
* 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));
}
}
开发者ID:khromov,项目名称:mustache-wordpress-cache,代码行数:19,代码来源:Mustache_Cache_WordPressCache.php
示例5: add_global_groups
/**
* 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);
}
开发者ID:rpeterson,项目名称:wp-cli,代码行数:18,代码来源:cache.php
示例6: __construct
/**
* 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');
}
开发者ID:jflowers45,项目名称:pressbooks,代码行数:13,代码来源:class-pb-pressbooks.php
示例7: configure_groups
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));
}
}
开发者ID:nb,项目名称:batcache,代码行数:12,代码来源:advanced-cache.php
示例8: flush_cache
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' ) );
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:13,代码来源:testcase.php
示例9: flush_cache
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'));
}
开发者ID:rmccue,项目名称:glotpress-plugin,代码行数:13,代码来源:testcase.php
示例10: startup
/**
* 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);
}
开发者ID:Tarendai,项目名称:Mercator,代码行数:18,代码来源:mercator.php
示例11: init
/**
* 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();
}
}
开发者ID:hack4reno2011,项目名称:BetaReno,代码行数:21,代码来源:geo-mashup-db.php
示例12: init
/**
* 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();
}
}
开发者ID:pioneerskies,项目名称:geobeni,代码行数:26,代码来源:geo-mashup-db.php
示例13: ga_init
/**
* 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'));
}
}
开发者ID:felixarntz,项目名称:global-admin,代码行数:44,代码来源:global-admin.php
示例14: wp_start_object_cache
/**
* 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'));
}
}
开发者ID:laiello,项目名称:qinhan,代码行数:43,代码来源:load.php
示例15: restore_current_blog
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;
}
开发者ID:junxuan,项目名称:wordpress,代码行数:54,代码来源:ms-blogs.php
示例16: 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_last_activity', 'bp_member_type'));
parent::setup_cache_groups();
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:11,代码来源:bp-members-loader.php
示例17: version_compare
$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';
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:31,代码来源:wp-settings.php
示例18: setup_cache_groups
/**
* 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();
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:11,代码来源:class-bp-notifications-component.php
示例19: 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();
}
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:11,代码来源:bp-activity-loader.php
示例20: bp_core_add_global_group
/**
* 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'));
}
开发者ID:hornetalcala,项目名称:trunk,代码行数:10,代码来源:bp-core-cache.php
注:本文中的wp_cache_add_global_groups函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论