當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。