当前位置: 首页>>代码示例>>PHP>>正文


PHP W3_Config::import方法代码示例

本文整理汇总了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);
 }
开发者ID:Supreme007,项目名称:bestilblomster,代码行数:27,代码来源:ConfigActionsAdmin.php

示例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);*/
 }
开发者ID:hoangsoft90,项目名称:wordpress-hw-cli-plugins-settings,代码行数:39,代码来源:W3cache.php

示例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);
}
开发者ID:elsantor,项目名称:brooklyn-social-apps,代码行数:21,代码来源:save-config.php


注:本文中的W3_Config::import方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。