本文整理汇总了PHP中W3_Config::import_legacy_config方法的典型用法代码示例。如果您正苦于以下问题:PHP W3_Config::import_legacy_config方法的具体用法?PHP W3_Config::import_legacy_config怎么用?PHP W3_Config::import_legacy_config使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类W3_Config
的用法示例。
在下文中一共展示了W3_Config::import_legacy_config方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* Options save action
*
* @return void
*/
function action_save_options()
{
/**
* Redirect params
*/
$params = array();
/**
* Store error message regarding permalink not enabled
*/
$redirect_permalink_error = '';
/**
* Read config
* We should use new instance of WP_Config object here
*/
$config = new W3_Config();
if (!$this->_config->own_config_exists()) {
$config->import_legacy_config();
}
$this->read_request($config);
$config_admin = new W3_ConfigAdmin();
$this->read_request($config_admin);
if ($this->_page == 'w3tc_dashboard') {
if (W3_Request::get_boolean('maxcdn')) {
$config->set('cdn.enabled', true);
$config->set('cdn.engine', 'maxcdn');
}
}
/**
* General tab
*/
if ($this->_page == 'w3tc_general') {
$file_nfs = W3_Request::get_boolean('file_nfs');
$file_locking = W3_Request::get_boolean('file_locking');
$config->set('pgcache.file.nfs', $file_nfs);
$config->set('minify.file.nfs', $file_nfs);
$config->set('dbcache.file.locking', $file_locking);
$config->set('objectcache.file.locking', $file_locking);
$config->set('pgcache.file.locking', $file_locking);
$config->set('minify.file.locking', $file_locking);
if ($this->is_network_and_master()) {
if ($this->_config->get_boolean('common.force_master') !== $config->get_boolean('common.force_master') || !w3_force_master() && $this->_config->get_boolean('common.force_master') && $config->get_boolean('common.force_master') || w3_force_master() && !$this->_config->get_boolean('common.force_master') && !$config->get_boolean('common.force_master')) {
@unlink(W3TC_CACHE_BLOGMAP_FILENAME);
$blogmap_dir = dirname(W3TC_CACHE_BLOGMAP_FILENAME) . '/' . basename(W3TC_CACHE_BLOGMAP_FILENAME, '.php') . '/';
if (@is_dir($blogmap_dir)) {
w3_rmdir($blogmap_dir);
}
}
if ($config->get_boolean('common.force_master')) {
$config_admin->set('common.visible_by_master_only', true);
}
}
/**
* Check permalinks for page cache
*/
if ($config->get_boolean('pgcache.enabled') && $config->get_string('pgcache.engine') == 'file_generic' && !get_option('permalink_structure')) {
$config->set('pgcache.enabled', false);
$redirect_permalink_error = 'fancy_permalinks_disabled_pgcache';
}
$w3_cloudflare = w3_instance('W3_CloudFlare');
$w3_cloudflare->reset_settings_cache();
if ($config->get_boolean('cloudflare.enabled') && $w3_cloudflare->minify_enabled() && $config->get_boolean('minify.enabled')) {
$config->set('minify.enabled', false);
}
/**
* Get New Relic application id
*/
if ($config->get_boolean('newrelic.enabled')) {
$method = W3_Request::get_string('application_id_method');
$newrelic_prefix = '';
if (w3_is_network() && w3_get_blog_id() != 0) {
$newrelic_prefix = $this->_config->get_string('newrelic.appname_prefix');
}
if (($newrelic_api_key = $config->get_string('newrelic.api_key')) && !$config->get_string('newrelic.account_id')) {
$nerser = w3_instance('W3_NewRelicService');
$account_id = $nerser->get_account_id($newrelic_api_key);
$config->set('newrelic.account_id', $account_id);
}
if ($method == 'dropdown' && $config->get_string('newrelic.application_id')) {
$application_id = $config->get_string('newrelic.application_id');
if ($config->get_string('newrelic.api_key') && $config->get_string('newrelic.account_id')) {
w3_require_once(W3TC_LIB_W3_DIR . '/NewRelicService.php');
$nerser = new W3_NewRelicService($config->get_string('newrelic.api_key'), $config->get_string('newrelic.account_id'));
$appname = $nerser->get_application_name($application_id);
$config->set('newrelic.appname', $appname);
}
} else {
if ($method == 'manual' && $config->get_string('newrelic.appname')) {
if ($newrelic_prefix != '' && strpos($config->get_string('newrelic.appname'), $newrelic_prefix) === false) {
$application_name = $newrelic_prefix . $config->get_string('newrelic.appname');
$config->set('newrelic.appname', $application_name);
} else {
$application_name = $config->get_string('newrelic.appname');
}
if ($config->get_string('newrelic.api_key') && $config->get_string('newrelic.account_id')) {
w3_require_once(W3TC_LIB_W3_DIR . '/NewRelicService.php');
//.........这里部分代码省略.........