本文整理汇总了PHP中W3_Config::import方法的典型用法代码示例。如果您正苦于以下问题:PHP W3_Config::import方法的具体用法?PHP W3_Config::import怎么用?PHP W3_Config::import使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类W3_Config
的用法示例。
在下文中一共展示了W3_Config::import方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
/**
* Import config action
*
* @return void
*/
function action_config_import()
{
$error = '';
$config = new W3_Config();
if (!isset($_FILES['config_file']['error']) || $_FILES['config_file']['error'] == UPLOAD_ERR_NO_FILE) {
$error = 'config_import_no_file';
} elseif ($_FILES['config_file']['error'] != UPLOAD_ERR_OK) {
$error = 'config_import_upload';
} else {
ob_start();
$imported = $config->import($_FILES['config_file']['tmp_name']);
ob_end_clean();
if (!$imported) {
$error = 'config_import_import';
}
}
if ($error) {
w3_admin_redirect(array('w3tc_error' => $error), true);
}
w3_config_save($this->_config, $config, $this->_config_admin);
w3_admin_redirect(array('w3tc_note' => 'config_import'), true);
}
示例2: elseif
/**
* Import config action
* copy from :plugins/w3-total-cache/lib/W3/AdminActions/ConfigActionsAdmin.php
* @return void
*/
function action_w3cache_import()
{
if (!class_exists('W3_Config')) {
echo 'Sory W3 total cache inactive.';
return;
}
$error = '';
if (!function_exists('w3_config_save')) {
include_once WP_PLUGIN_DIR . '/w3-total-cache/inc/functions/admin.php';
}
$config = new W3_Config();
if (!isset($_FILES['config_file']['error']) || $_FILES['config_file']['error'] == UPLOAD_ERR_NO_FILE) {
$error = 'config_import_no_file';
} elseif ($_FILES['config_file']['error'] != UPLOAD_ERR_OK) {
$error = 'config_import_upload';
} else {
ob_start();
$imported = $config->import($_FILES['config_file']['tmp_name']);
ob_end_clean();
if (!$imported) {
$error = 'config_import_import';
}
}
if ($error) {
/*w3_admin_redirect(array(
'w3tc_error' => $error
), true);*/
echo $error;
}
w3_config_save(w3_instance('W3_Config'), $config, w3_instance('W3_ConfigAdmin'));
/*w3_admin_redirect(array(
'w3tc_note' => 'config_import'
), true);*/
}
示例3: exit
<?php
$wordpress_path = "/var/www/html";
require_once $wordpress_path . '/wp-load.php';
//not sure if this line is needed
require_once $wordpress_path . '/wp-admin/includes/plugin.php';
require_once $wordpress_path . '/wp-content/plugins/w3-total-cache/lib/W3/Plugin/TotalCacheAdmin.php';
echo "WordPress: Applying programmatic W3 Total Cache settings\n";
$config = new W3_Config();
$imported = $config->import('/tmp/w3-total-cache-settings.php');
if (!$imported) {
echo "WordPress: Failed to import W3 Total Cache settings\n";
exit(1);
}
$x = new W3_Plugin_TotalCacheAdmin();
$x->run();
$result = $x->config_save($config, $x->_config_admin);
if (!$result) {
echo "WordPress: Failed to save W3 Total Cache settings\n";
exit(1);
}