本文整理汇总了PHP中w3_is_multisite函数的典型用法代码示例。如果您正苦于以下问题:PHP w3_is_multisite函数的具体用法?PHP w3_is_multisite怎么用?PHP w3_is_multisite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了w3_is_multisite函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fix_in_wpadmin
function fix_in_wpadmin($config, $force_all_checks = false)
{
$exs = new SelfTestExceptions();
$fix_on_event = false;
if (w3_is_multisite() && w3_get_blog_id() != 0) {
if (get_transient('w3tc_config_changes') != ($md5_string = $config->get_md5())) {
$fix_on_event = true;
set_transient('w3tc_config_changes', $md5_string, 3600);
}
}
// call plugin-related handlers
foreach ($this->get_handlers($config) as $h) {
try {
$h->fix_on_wpadmin_request($config, $force_all_checks);
if ($fix_on_event) {
$this->fix_on_event($config, 'admin_request');
}
} catch (SelfTestExceptions $ex) {
$exs->push($ex);
}
}
if (count($exs->exceptions()) > 0) {
throw $exs;
}
}
示例2: run
/**
* Runs plugin
*/
function run()
{
add_action('publish_phone', array(&$this, 'on_post_edit'), 20);
add_action('wp_trash_post', array(&$this, 'on_post_change'), 20);
add_action('save_post', array(&$this, 'on_post_change'), 20);
global $wp_version;
if (version_compare($wp_version, '3.5', '>=')) {
add_action('clean_post_cache', array(&$this, 'on_post_change'), 20, 2);
}
add_action('comment_post', array(&$this, 'on_comment_change'), 20);
add_action('edit_comment', array(&$this, 'on_comment_change'), 20);
add_action('delete_comment', array(&$this, 'on_comment_change'), 0);
add_action('wp_set_comment_status', array(&$this, 'on_comment_status'), 20, 2);
add_action('trackback_post', array(&$this, 'on_comment_change'), 20);
add_action('pingback_post', array(&$this, 'on_comment_change'), 20);
add_action('switch_theme', array(&$this, 'on_change'), 20);
add_action('wp_update_nav_menu', array(&$this, 'on_change'), 20);
add_action('edit_user_profile_update', array(&$this, 'on_change'), 20);
add_action('w3tc_purge_from_pgcache', array(&$this, 'on_post_change'), 20);
add_action('delete_post', array(&$this, 'on_post_edit'), 20);
if (w3_is_multisite()) {
add_action('delete_blog', array(&$this, 'on_change'), 20);
}
add_filter('wp_redirect', array(&$this, 'on_redirect_cleanup'), 20, 1);
add_action('sns_actions_executed', array(&$this, 'flush_post_cleanup'), 20);
}
示例3: run
/**
* Runs plugin
*/
function run()
{
add_filter('cron_schedules', array(&$this, 'cron_schedules'));
if ($this->_config->get_string('dbcache.engine') == 'file') {
add_action('w3_dbcache_cleanup', array(&$this, 'cleanup'));
}
add_action('publish_phone', array(&$this, 'on_change'), 0);
add_action('wp_trash_post', array(&$this, 'on_post_change'), 0);
add_action('save_post', array(&$this, 'on_post_change'), 0);
global $wp_version;
if (version_compare($wp_version, '3.5', '>=')) {
add_action('clean_post_cache', array(&$this, 'on_post_change'), 0, 2);
}
add_action('comment_post', array(&$this, 'on_comment_change'), 0);
add_action('edit_comment', array(&$this, 'on_comment_change'), 0);
add_action('delete_comment', array(&$this, 'on_comment_change'), 0);
add_action('wp_set_comment_status', array(&$this, 'on_comment_status'), 0, 2);
add_action('trackback_post', array(&$this, 'on_comment_change'), 0);
add_action('pingback_post', array(&$this, 'on_comment_change'), 0);
add_action('switch_theme', array(&$this, 'on_change'), 0);
add_action('edit_user_profile_update', array(&$this, 'on_change'), 0);
if (w3_is_multisite()) {
add_action('delete_blog', array(&$this, 'on_change'), 0);
}
add_action('delete_post', array(&$this, 'on_post_change'), 0);
}
示例4: view
/**
* General tab
*
* @return void
*/
function view()
{
w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/ui.php');
global $current_user;
$config_master = $this->_config_master;
/**
* @var $modules W3_ModuleStatus
*/
$modules = w3_instance('W3_ModuleStatus');
$pgcache_enabled = $modules->is_enabled('pgcache');
$dbcache_enabled = $modules->is_enabled('dbcache');
$objectcache_enabled = $modules->is_enabled('objectcache');
$browsercache_enabled = $modules->is_enabled('browsercache');
$minify_enabled = $modules->is_enabled('minify');
$cdn_enabled = $modules->is_enabled('cdn');
$varnish_enabled = $modules->is_enabled('varnish');
$fragmentcache_enabled = $modules->is_enabled('fragmentcache');
$enabled = $modules->plugin_is_enabled();
$enabled_checkbox = $modules->all_modules_enabled();
$check_rules = w3_can_check_rules();
$check_apc = function_exists('apc_store');
$check_eaccelerator = function_exists('eaccelerator_put');
$check_xcache = function_exists('xcache_set');
$check_wincache = function_exists('wincache_ucache_set');
$check_curl = function_exists('curl_init');
$check_memcached = class_exists('Memcache');
$check_ftp = function_exists('ftp_connect');
$check_tidy = class_exists('tidy');
$disc_enhanced_enabled = !(!$check_rules || !$this->is_master() && w3_is_network() && $config_master->get_string('pgcache.engine') != 'file_generic');
$can_empty_file = $modules->can_empty_file();
$can_empty_varnish = $modules->can_empty_varnish();
$cdn_mirror_purge = w3_cdn_can_purge_all($modules->get_module_engine('cdn'));
$file_nfs = $this->_config->get_boolean('pgcache.file.nfs') || $this->_config->get_boolean('minify.file.nfs');
$file_locking = $this->_config->get_boolean('dbcache.file.locking') || $this->_config->get_boolean('objectcache.file.locking') || $this->_config->get_boolean('pgcache.file.locking') || $this->_config->get_boolean('minify.file.locking');
w3_require_once(W3TC_LIB_NEWRELIC_DIR . '/NewRelicWrapper.php');
$newrelic_conf_appname = NewRelicWrapper::get_wordpress_appname($this->_config, $this->_config_master, false);
$newrelic_applications = array();
$nerser = w3_instance('W3_NewRelicService');
$new_relic_installed = $nerser->module_is_enabled();
$new_relic_running = true;
if ($this->_config->get_boolean('newrelic.enabled')) {
$new_relic_configured = $this->_config->get_string('newrelic.api_key') && $this->_config->get_string('newrelic.account_id');
$newrelic_prefix = '';
if ($new_relic_configured) {
if (w3_is_network()) {
$newrelic_prefix = $this->_config->get_string('newrelic.appname_prefix');
}
try {
$newrelic_applications = $nerser->get_applications();
} catch (Exception $ex) {
}
$newrelic_application = $this->_config->get_string('newrelic.application_id');
}
}
$licensing_visible = (!w3_is_multisite() || is_network_admin()) && !ini_get('w3tc.license_key') && get_transient('w3tc_license_status') != 'host_valid';
$custom_areas = apply_filters("{$this->_page}_anchors", array());
include W3TC_INC_DIR . '/options/general.php';
}
示例5: admin_init
/**
* Setup notices actions
*/
function admin_init()
{
if (current_user_can('manage_options')) {
if (is_admin() && isset($_GET['page']) && strpos($_GET['page'], 'w3tc_') !== false) {
/**
* Only admin can see W3TC notices and errors
*/
if (!w3_is_multisite()) {
add_action('admin_notices', array(&$this, 'admin_notices'));
}
add_action('network_admin_notices', array(&$this, 'admin_notices'));
}
}
}
示例6: admin_init
/**
* Setup notices actions
*/
function admin_init()
{
if (current_user_can('manage_options')) {
w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin.php');
if (is_admin() && is_w3tc_admin_page()) {
/**
* Only admin can see W3TC notices and errors
*/
if (!w3_is_multisite()) {
add_action('admin_notices', array(&$this, 'admin_notices'));
}
add_action('network_admin_notices', array(&$this, 'admin_notices'));
}
}
}
示例7: view
/**
* Page cache tab
*
* @return void
*/
function view()
{
global $wp_rewrite;
$feeds = $wp_rewrite->feeds;
$feed_key = array_search('feed', $feeds);
if ($feed_key !== false) {
unset($feeds[$feed_key]);
}
$default_feed = get_default_feed();
$pgcache_enabled = $this->_config->get_boolean('pgcache.enabled');
$permalink_structure = get_option('permalink_structure');
$varnish_enabled = $this->_config->get_boolean('varnish.enabled');
$cdn_mirror_purge_enabled = w3_is_cdn_mirror($this->_config->get_string('cdn.engine')) && $this->_config->get_string('cdn.engine') != 'mirror' && $this->_config->get_boolean('cdncache.enabled') && w3tc_edge_mode() && w3_is_pro($this->_config) || w3_is_enterprise();
$disable_check_domain = w3_is_multisite() && w3_force_master();
include W3TC_INC_DIR . '/options/pgcache.php';
}
示例8: print_script
function print_script()
{
?>
<script type="text/javascript">
var w3_use_network_link = <?php
echo is_network_admin() || w3_is_multisite() && w3_force_master() ? 'true' : 'false';
?>
;
function w3tc_start_minify_try_solve() {
var testUrl = '<?php
echo w3_filename_to_url(w3_cache_blog_dir('minify') . '/', w3_get_domain(w3_get_home_url()) != w3_get_domain(w3_get_site_url()));
?>
';
w3tc_filename_auto_solve(testUrl);
}
</script>
<?php
}
示例9: run
/**
* Runs plugin
*/
function run()
{
add_filter('cron_schedules', array(&$this, 'cron_schedules'));
if ($this->_config->get_string('pgcache.engine') == 'file' || $this->_config->get_string('pgcache.engine') == 'file_generic') {
add_action('w3_pgcache_cleanup', array(&$this, 'cleanup'));
}
add_action('w3_pgcache_prime', array(&$this, 'prime'));
add_action('publish_phone', array(&$this, 'on_post_edit'), 0);
add_action('wp_trash_post', array(&$this, 'on_post_change'), 0);
add_action('save_post', array(&$this, 'on_post_change'), 0);
global $wp_version;
if (version_compare($wp_version, '3.5', '>=')) {
add_action('clean_post_cache', array(&$this, 'on_post_change'), 0, 2);
}
add_action('comment_post', array(&$this, 'on_comment_change'), 0);
add_action('edit_comment', array(&$this, 'on_comment_change'), 0);
add_action('delete_comment', array(&$this, 'on_comment_change'), 0);
add_action('wp_set_comment_status', array(&$this, 'on_comment_status'), 0, 2);
add_action('trackback_post', array(&$this, 'on_comment_change'), 0);
add_action('pingback_post', array(&$this, 'on_comment_change'), 0);
add_action('switch_theme', array(&$this, 'on_change'), 0);
add_action('wp_update_nav_menu', array(&$this, 'on_change'), 0);
add_action('edit_user_profile_update', array(&$this, 'on_change'), 0);
add_filter('comment_cookie_lifetime', array(&$this, 'comment_cookie_lifetime'));
add_action('w3tc_purge_from_pgcache', array(&$this, 'on_post_change'), 0);
if (w3_is_multisite()) {
add_action('delete_blog', array(&$this, 'on_change'), 0);
}
add_action('delete_post', array(&$this, 'on_post_edit'), 0);
if ($this->_config->get_string('pgcache.engine') == 'file_generic') {
add_action('wp_logout', array(&$this, 'on_logout'), 0);
add_action('wp_login', array(&$this, 'on_login'), 0);
}
add_filter('wp_redirect', array(&$this, 'on_redirect_cleanup'), 0, 1);
add_action('sns_actions_executed', array(&$this, 'flush_post_cleanup'), 0);
if ($this->_config->get_boolean('pgcache.prime.post.enabled', false)) {
add_action('publish_post', array(&$this, 'prime_post'), 30);
}
if ($this->_config->get_boolean('pgcache.late_init') && !is_admin()) {
add_action('init', array($this, 'delayed_cache_print'), 99999);
}
}
示例10: run
public function run()
{
$this->_config = w3_instance('W3_Config');
$this->_config_admin = w3_instance('W3_ConfigAdmin');
w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin.php');
w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin_ui.php');
$this->_page = w3tc_get_current_page();
if (is_network_admin() || !w3_is_multisite()) {
$this->edge_notification();
}
if (is_w3tc_admin_page()) {
add_action('admin_head', array($this, 'admin_head'));
add_action('w3tc_hide_button_custom-edge_mode', array($this, 'hide_edge_mode_notification'));
$support_reminder = $this->_config->get_boolean('notes.support_us') && $this->_config_admin->get_integer('common.install') < time() - W3TC_SUPPORT_US_TIMEOUT && $this->_config->get_string('common.support') == '' && !$this->_config->get_boolean('common.tweeted');
if ($support_reminder || w3tc_show_notification('support_us_popup')) {
add_action('w3tc-dashboard-head', array($this, 'support_us_nag'));
}
add_action('w3tc-dashboard-head', array($this, 'edge_nag'));
}
}
示例11: admin_init
/**
* Setups actions
*/
public function admin_init()
{
if (current_user_can('manage_options')) {
/**
* @var W3_ConfigCompatibility $config_comp
*/
$config_comp = w3_instance('W3_ConfigCompatibility');
if ($config_comp->get_old_version() && isset($_GET['page'])) {
w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin.php');
if (is_w3tc_admin_page() || isset($GLOBALS['pagenow']) && 'plugins.php' === $GLOBALS['pagenow']) {
if (!w3_is_multisite() || !w3_force_master()) {
add_action('admin_notices', array($this, 'admin_notices'));
} else {
add_action('network_admin_notices', array($this, 'admin_notices'));
}
}
$config_comp->setup_settings();
}
}
}
示例12: run
/**
* Called on plugin instantiation
*/
function run()
{
add_filter('w3tc_compatibility_test', array($this, 'verify_compatibility'));
if (is_admin()) {
add_action('wp_ajax_admin_w3tc_verify_newrelic_api_key', array($this, 'verify_newrelic_api_key'));
add_action('wp_ajax_w3tc_verify_newrelic_api_key', array($this, 'verify_newrelic_api_key'));
add_action('wp_ajax_admin_w3tc_get_newrelic_applications', array($this, 'get_newrelic_applications'));
add_action('wp_ajax_w3tc_get_newrelic_applications', array($this, 'get_newrelic_applications'));
$new_relic_enabled = $this->_config->get_boolean('newrelic.enabled');
if ($new_relic_enabled) {
global $pagenow;
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
$page = W3_Request::get_string('page');
if ($pagenow == 'plugins.php' || strpos($page, 'w3tc_') !== false) {
if (!w3_is_multisite() || w3_is_multisite() && !$this->_config->get_boolean('common.force_master')) {
add_action('admin_notices', array($this, 'admin_notices'));
} else {
add_action('network_admin_notices', array($this, 'admin_notices'));
}
}
}
}
}
示例13: get_groups
/**
* Returns minify groups
*
* @param string $theme
* @param string $template
* @param string $type
* @return array
*/
function get_groups($theme, $template, $type)
{
$result = array();
switch ($type) {
case 'css':
$groups = $this->_config->get_array('minify.css.groups');
break;
case 'js':
$groups = $this->_config->get_array('minify.js.groups');
break;
default:
return $result;
}
if (isset($groups[$theme]['default'])) {
$locations = (array) $groups[$theme]['default'];
} else {
$locations = array();
}
if ($template != 'default' && isset($groups[$theme][$template])) {
$locations = array_merge_recursive($locations, (array) $groups[$theme][$template]);
}
foreach ($locations as $location => $config) {
if (!empty($config['files'])) {
foreach ((array) $config['files'] as $file) {
$file = w3_normalize_file_minify2($file);
if (w3_is_url($file)) {
$precached_file = $this->_precache_file($file, $type);
if ($precached_file) {
$result[$location][$file] = $precached_file;
} else {
$this->error(sprintf('Unable to cache remote file: "%s"', $file));
}
} else {
if (!w3_is_multisite() && strpos(trailingslashit(WP_CONTENT_DIR), trailingslashit(w3_get_site_root())) !== false) {
$file = ltrim(w3_get_site_path(), '/') . str_replace(ltrim(w3_get_site_path(), '/'), '', $file);
}
$path = w3_get_document_root() . '/' . $file;
if (file_exists($path)) {
$result[$location][$file] = '//' . $file;
} else {
$this->error(sprintf('File "%s" doesn\'t exist', $path));
}
}
}
}
}
return $result;
}
示例14: w3_force_master
/**
* @return bool
*/
function w3_force_master()
{
global $w3_force_master;
if (!is_null($w3_force_master)) {
return $w3_force_master;
}
if (!w3_is_multisite()) {
$w3_force_master = false;
} else {
$blog_data = w3_blogmap_get_blog_data();
if (is_null($blog_data) || $blog_data[0] != 'm' && $blog_data[0] != 'c') {
$w3_force_master = true;
} else {
$w3_force_master = $blog_data[0] == 'm';
}
}
return $w3_force_master;
}
示例15: on_change_profile
/**
* Flush cache when user profile is updated
* @param int $user_id
*/
function on_change_profile($user_id)
{
static $flushed = false;
if (!$flushed) {
if (w3_is_multisite()) {
$blogs = get_blogs_of_user($user_id, true);
if ($blogs) {
global $w3_multisite_blogs;
$w3_multisite_blogs = $blogs;
}
}
$flush = w3_instance('W3_CacheFlush');
$flush->objectcache_flush();
$flushed = true;
}
}