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


PHP wfConfig::getExportableOptionsKeys方法代码示例

本文整理汇总了PHP中wfConfig::getExportableOptionsKeys方法的典型用法代码示例。如果您正苦于以下问题:PHP wfConfig::getExportableOptionsKeys方法的具体用法?PHP wfConfig::getExportableOptionsKeys怎么用?PHP wfConfig::getExportableOptionsKeys使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wfConfig的用法示例。


在下文中一共展示了wfConfig::getExportableOptionsKeys方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: importSettings

 public static function importSettings($token)
 {
     /** @var wpdb $wpdb */
     global $wpdb;
     $api = new wfAPI(wfConfig::get('apiKey'), wfUtils::getWPVersion());
     $res = $api->call('import_options', array(), array('token' => $token));
     $totalSet = 0;
     if ($res['ok'] && $res['options']) {
         $keys = wfConfig::getExportableOptionsKeys();
         foreach ($keys as $key) {
             if (isset($res['options'][$key])) {
                 wfConfig::set($key, $res['options'][$key]);
                 $totalSet++;
             }
         }
         if (isset($res['options']['scanScheduleJSON']) && isset($res['options']['schedMode'])) {
             $scanSched = json_decode($res['options']['scanScheduleJSON']);
             wfConfig::set_ser('scanSched', $scanSched);
             wfConfig::set('schedMode', $res['options']['schedMode']);
             $totalSet += 2;
         }
         if (!empty($res['options']['_blockedIPs']) && is_array($res['options']['_blockedIPs'])) {
             foreach ($res['options']['_blockedIPs'] as $row) {
                 if (!empty($row['IP'])) {
                     $row['IP'] = pack('H*', $row['IP']);
                     if (!$wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM ' . $wpdb->base_prefix . 'wfBlocks WHERE IP = %s', $row['IP']))) {
                         $wpdb->insert($wpdb->base_prefix . 'wfBlocks', $row);
                     }
                 }
             }
         }
         if (!empty($res['options']['_advancedBlocking']) && is_array($res['options']['_advancedBlocking'])) {
             foreach ($res['options']['_advancedBlocking'] as $row) {
                 if (!empty($row['blockString']) && !$wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM ' . $wpdb->base_prefix . 'wfBlocksAdv WHERE blockString = %s', $row['blockString']))) {
                     unset($row['id']);
                     $wpdb->insert($wpdb->base_prefix . 'wfBlocksAdv', $row);
                 }
             }
         }
         return $totalSet;
     } else {
         if ($res['err']) {
             throw new Exception($res['err']);
         } else {
             throw new Exception("Invalid response from Wordfence servers during import.");
         }
     }
 }
开发者ID:ashenkar,项目名称:sanga,代码行数:48,代码来源:wordfenceClass.php

示例2: get_settings

 function get_settings()
 {
     $keys = wfConfig::getExportableOptionsKeys();
     $settings = array();
     foreach ($keys as $key) {
         $settings[$key] = wfConfig::get($key, '');
     }
     $settings['apiKey'] = wfConfig::get('apiKey');
     //get more apiKey
     $settings['isPaid'] = wfConfig::get('isPaid');
     return $settings;
 }
开发者ID:jexmex,项目名称:mainwp-child,代码行数:12,代码来源:class-mainwp-child-wordfence.php

示例3: importSettings

 public static function importSettings($token)
 {
     $api = new wfAPI(wfConfig::get('apiKey'), wfUtils::getWPVersion());
     $res = $api->call('import_options', array(), array('token' => $token));
     $totalSet = 0;
     if ($res['ok'] && $res['options']) {
         $keys = wfConfig::getExportableOptionsKeys();
         foreach ($keys as $key) {
             if (isset($res['options'][$key])) {
                 wfConfig::set($key, $res['options'][$key]);
                 $totalSet++;
             }
         }
         if (isset($res['options']['scanScheduleJSON']) && isset($res['options']['schedMode'])) {
             $scanSched = json_decode($res['options']['scanScheduleJSON']);
             wfConfig::set_ser('scanSched', $scanSched);
             wfConfig::set('schedMode', $res['options']['schedMode']);
             $totalSet += 2;
         }
         return $totalSet;
     } else {
         if ($res['err']) {
             throw new Exception($res['err']);
         } else {
             throw new Exception("Invalid response from Wordfence servers during import.");
         }
     }
 }
开发者ID:rinodung,项目名称:myfreetheme,代码行数:28,代码来源:wordfenceClass.php


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