本文整理汇总了PHP中w3_force_master函数的典型用法代码示例。如果您正苦于以下问题:PHP w3_force_master函数的具体用法?PHP w3_force_master怎么用?PHP w3_force_master使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了w3_force_master函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate
function generate()
{
$pages = $this->generate_menu_array();
add_menu_page(__('Performance', 'w3-total-cache'), __('Performance', 'w3-total-cache'), 'manage_options', 'w3tc_dashboard', '', 'div');
$submenu_pages = array();
foreach ($pages as $slug => $titles) {
if ($this->_config_admin->get_boolean('common.visible_by_master_only') && $titles['network_show'] || (!$this->_config_admin->get_boolean('common.visible_by_master_only') || is_super_admin() && (!w3_force_master() || is_network_admin()))) {
$submenu_pages[] = add_submenu_page('w3tc_dashboard', $titles[0] . ' | W3 Total Cache', $titles[1], 'manage_options', $slug, array(&$this, 'options'));
}
}
return $submenu_pages;
}
示例2: 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';
}
示例3: 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
}
示例4: print_script
function print_script()
{
?>
<script type="text/javascript">
var w3_use_network_link = <?php
echo w3_force_master() ? 'true' : 'false';
?>
;
function w3tc_start_minify_try_solve() {
var testUrl = '<?php
echo w3_filename_to_url(w3_cache_blog_dir('minify') . '/');
?>
';
w3tc_filename_auto_solve(testUrl);
}
</script>
<?php
}
示例5: generate
function generate()
{
$pages = array('w3tc_dashboard' => array(__('Dashboard', 'w3-total-cache'), __('Dashboard', 'w3-total-cache'), 'network_show' => true), 'w3tc_general' => array(__('General Settings', 'w3-total-cache'), __('General Settings', 'w3-total-cache'), 'network_show' => false), 'w3tc_pgcache' => array(__('Page Cache', 'w3-total-cache'), __('Page Cache', 'w3-total-cache'), 'network_show' => false), 'w3tc_minify' => array(__('Minify', 'w3-total-cache'), __('Minify', 'w3-total-cache'), 'network_show' => false), 'w3tc_dbcache' => array(__('Database Cache', 'w3-total-cache'), __('Database Cache', 'w3-total-cache'), 'network_show' => false), 'w3tc_objectcache' => array(__('Object Cache', 'w3-total-cache'), __('Object Cache', 'w3-total-cache'), 'network_show' => false));
if (w3_is_pro($this->_config) || w3_is_enterprise($this->_config)) {
$pages['w3tc_fragmentcache'] = array(__('Fragment Cache', 'w3-total-cache'), __('Fragment Cache', 'w3-total-cache'), 'network_show' => false);
}
$pages = array_merge($pages, array('w3tc_browsercache' => array(__('Browser Cache', 'w3-total-cache'), __('Browser Cache', 'w3-total-cache'), 'network_show' => false), 'w3tc_mobile' => array(__('User Agent Groups', 'w3-total-cache'), __('User Agent Groups', 'w3-total-cache'), 'network_show' => false), 'w3tc_referrer' => array(__('Referrer Groups', 'w3-total-cache'), __('Referrer Groups', 'w3-total-cache'), 'network_show' => false), 'w3tc_cdn' => array(__('Content Delivery Network', 'w3-total-cache'), __('<acronym title="Content Delivery Network">CDN</acronym>', 'w3-total-cache'), 'network_show' => $this->_config->get_boolean('cdn.enabled')), 'w3tc_monitoring' => array(__('Monitoring', 'w3-total-cache'), __('Monitoring', 'w3-total-cache'), 'network_show' => false)));
$pages_tail = array('w3tc_faq' => array(__('FAQ', 'w3-total-cache'), __('FAQ', 'w3-total-cache'), 'network_show' => true), 'w3tc_support' => array(__('Support', 'w3-total-cache'), __('<span style="color: red;">Support</span>', 'w3-total-cache'), 'network_show' => true), 'w3tc_install' => array(__('Install', 'w3-total-cache'), __('Install', 'w3-total-cache'), 'network_show' => false), 'w3tc_about' => array(__('About', 'w3-total-cache'), __('About', 'w3-total-cache'), 'network_show' => true));
$pages = apply_filters('w3tc_menu', $pages, $this->_config, $this->_config_admin);
$pages = array_merge($pages, $pages_tail);
add_menu_page(__('Performance', 'w3-total-cache'), __('Performance', 'w3-total-cache'), 'manage_options', 'w3tc_dashboard', '', 'div');
$submenu_pages = array();
foreach ($pages as $slug => $titles) {
if ($this->_config_admin->get_boolean('common.visible_by_master_only') && $titles['network_show'] || (!$this->_config_admin->get_boolean('common.visible_by_master_only') || is_super_admin() && (!w3_force_master() || is_network_admin()))) {
$submenu_pages[] = add_submenu_page('w3tc_dashboard', $titles[0] . ' | W3 Total Cache', $titles[1], 'manage_options', $slug, array(&$this, 'options'));
}
}
return $submenu_pages;
}
示例6: 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();
}
}
}
示例7: _can_cache2
/**
* Checks if can we do cache logic
*
* @param string $buffer
* @return boolean
*/
function _can_cache2(&$buffer)
{
/**
* Skip if caching is disabled
*/
if (!$this->_caching) {
return false;
}
/**
* Check for database error
*/
if (w3_is_database_error($buffer)) {
$this->cache_reject_reason = 'Database error occurred';
return false;
}
/**
* Check for DONOTCACHEPAGE constant
*/
if (defined('DONOTCACHEPAGE') && DONOTCACHEPAGE) {
$this->cache_reject_reason = 'DONOTCACHEPAGE constant is defined';
return false;
}
/**
* Check hostname
*/
if ((!w3_is_multisite() || w3_is_multisite() && !w3_force_master()) && $this->_config->get_boolean('pgcache.check.domain') && w3_get_host() != w3_get_home_domain()) {
$this->cache_reject_reason = 'Hostname mismatch';
return false;
}
/**
* Don't cache 404 pages
*/
if (!$this->_config->get_boolean('pgcache.cache.404') && function_exists('is_404') && is_404()) {
$this->cache_reject_reason = 'Page is 404';
return false;
}
/**
* Don't cache homepage
*/
if (!$this->_config->get_boolean('pgcache.cache.home') && function_exists('is_home') && is_home()) {
$this->cache_reject_reason = is_front_page() && is_home() ? 'Page is front page' : 'Page is posts page';
return false;
}
/**
* Don't cache front page
*/
if ($this->_config->get_boolean('pgcache.reject.front_page') && function_exists('is_front_page') && is_front_page() && !is_home()) {
$this->cache_reject_reason = 'Page is front page';
return false;
}
/**
* Don't cache feed
*/
if (!$this->_config->get_boolean('pgcache.cache.feed') && function_exists('is_feed') && is_feed()) {
$this->cache_reject_reason = 'Page is feed';
return false;
}
/**
* Check if page contains dynamic tags
*/
if ($this->_enhanced_mode && $this->_has_dynamic($buffer)) {
$this->cache_reject_reason = 'Page contains dynamic tags (mfunc or mclude) can not be cached in enhanced mode';
return false;
}
return true;
}
示例8: selected
</optgroup>
<optgroup label="Multiple Servers:">
<option value="memcached"<?php
selected($this->_config->get_string('fragmentcache.engine'), 'memcached');
if (!$check_memcached) {
?>
disabled="disabled"<?php
}
?>
>Memcached</option>
</optgroup>
</select>
</td>
</tr>
<?php
if ($this->is_network_and_master() && !w3_force_master()) {
?>
<tr>
<th>Network policy:</th>
<td>
<?php
$this->checkbox_admin('fragmentcache.configuration_sealed');
?>
Apply the settings above to the entire network.</label>
</td>
</tr>
<?php
}
?>
</table>
示例9: w3tc_is_sealed
/**
* Returns true if config section is sealed
* @param string $section
* @return boolean
*/
function w3tc_is_sealed($section)
{
$config = w3_instance('W3_Config');
$config_master = new W3_Config(true);
$config_admin = w3_instance('W3_ConfigAdmin');
if ($config->is_master()) {
return false;
}
if (w3_is_network() && !$config->is_master() && w3_force_master()) {
return true;
}
// browsercache settings change rules, so not available in child settings
if ($section == 'browsercache') {
return true;
}
if ($section == 'minify' && !$config_master->get_boolean('minify.enabled')) {
return true;
}
return $config_admin->get_boolean($section . '.configuration_sealed');
}
示例10:
?>
<tr>
<th colspan="2">
<?php
$this->checkbox('cdn.canonical_header');
?>
Add canonical header</label><br />
<span class="description">Adds canonical <acronym title="Hypertext Transfer Protocol">HTTP</acronym> header to assets files.</span>
</th>
</tr>
<?php
}
?>
</table>
<?php
if (!$this->_config_admin->get_boolean('common.visible_by_master_only') || is_super_admin() && (!w3_force_master() || is_network_admin())) {
?>
<p class="submit">
<?php
echo $this->nonce_field('w3tc');
?>
<input type="submit" name="w3tc_save_options" class="w3tc-button-save button-primary" value="Save all settings" />
</p>
<?php
echo $this->postbox_footer();
?>
<?php
echo $this->postbox_header('Configuration', '', 'configuration');
?>
示例11: _e
</tr>
<?php
if ($this->is_network_and_master()) {
?>
<tr>
<th><?php
_e('Use above application name and ID for all sites in network:', 'w3-total-cache');
?>
</th>
<td><?php
$this->checkbox('newrelic.use_network_wide_id');
?>
</label></td>
</tr>
<?php
if (!w3_force_master()) {
?>
<tr>
<th><?php
_e('Network policy:', 'w3-total-cache');
?>
</th>
<td>
<?php
$this->checkbox_admin('newrelic.configuration_sealed', $this->_config->get_boolean('newrelic.use_network_wide_id'));
?>
<?php
_e('Apply the settings above to the entire network.', 'w3-total-cache');
?>
</label>
</td>
示例12: _get_config_filename
private function _get_config_filename($force_master = false)
{
if ($this->_blog_id <= 0 || $force_master || w3_force_master()) {
return W3TC_CONFIG_DIR . '/master-admin.php';
}
return W3TC_CONFIG_DIR . '/' . sprintf('%06d', $this->_blog_id) . '-admin.php';
}
示例13: is_sealed
/**
* Returns true if config section is sealed
* @param string $section
* @param W3_Config $config_master
* @param W3_ConfigAdmin $config_admin
* @return boolean
*/
private function is_sealed($section, $config_master, $config_admin)
{
if (w3_get_blog_id() == 0) {
return false;
}
if (w3_is_network() && w3_get_blog_id() != 0 && w3_force_master()) {
return true;
}
// browsercache settings change rules, so not available in child settings
if ($section == 'browsercache') {
return true;
}
if ($section == 'minify' && !$config_master->get_boolean('minify.enabled')) {
return true;
}
return $config_admin->get_boolean($section . '.configuration_sealed');
}
示例14: _get_config_filename
private function _get_config_filename($forced_preview = null)
{
$preview = is_null($forced_preview) ? $this->_preview : $forced_preview;
$postfix = ($preview ? '-preview' : '') . '.php';
if ($this->_blog_id <= 0 || w3_force_master()) {
return W3TC_CACHE_CONFIG_DIR . '/master' . $postfix;
}
return W3TC_CACHE_CONFIG_DIR . '/' . sprintf('%06d', $this->_blog_id) . $postfix;
}
示例15: get_config_filename
public static function get_config_filename()
{
$force_master = false;
if (w3_force_master()) {
$force_master = true;
}
$postfix = '.php';
if (w3_get_blog_id() <= 0 || $force_master) {
return W3TC_CONFIG_DIR . '/master' . $postfix;
}
return W3TC_CONFIG_DIR . '/' . sprintf('%06d', w3_get_blog_id()) . $postfix;
}