本文整理汇总了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.");
}
}
}
示例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;
}
示例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.");
}
}
}