Diagnostics Results
';
echo $ansa;
astound_errorsonoff('off');
exit;
}
function astound_show_cache() {
try {
$astound_opt=$_POST['astound_opt'];
$astound_opt=sanitize_text_field($astound_opt);
if (!wp_verify_nonce($astound_opt,'astound_options')) {
echo "Session timeout, please refresh the page";
exit;
}
//$astound_opt=$_POST['astound_opt'];
//$astound_opt=sanitize_text_field($astound_opt);
//$ansa="Got something?";
$ansa=astound_get_cache();
echo $ansa;
} catch (Exception $e) {
echo ("exception in show cache $e");
}
//return "show";
}
function astound_get_cache() {
try {
$cache=get_option('astound_cache');
$ansa="";
if (empty($cache) || !is_array($cache)) {
return "Cache is empty";
}
foreach($cache as $key => $value) {
$reason=$value['reason'];
$time=$value['time'];
$time = date ('Y-m-d H:i:s',$time);
$ansa.="$key - $time - $reason
";
}
// for testing
//$raw=print_r($cache,true);
//$raw=esc_textarea($raw);
//$ansa.="
".$raw;
if (empty($ansa) || strlen($ansa)<=10) {
$ansa="nothing in cache";
}
return $ansa;
} catch (Exception $e) {
return ("exception in show get $e");
}
}
function astound_update_option() {
// Handle request then generate response using WP_Ajax_Response
//astound_errorsonoff();
$name=$_POST['name'];
$name=sanitize_text_field($name);
$checked=$_POST['checked'];
$checked=sanitize_text_field($checked);
$astound_opt=$_POST['astound_opt'];
$astound_opt=sanitize_text_field($astound_opt);
if (!wp_verify_nonce($astound_opt,'astound_options')) {
echo "Session timeout, please refresh the page";
exit;
}
if ($checked=='true') {
$checked='Y';
} else {
$checked='N';
}
if (!function_exists('astound_set_option') ) {
echo "function not found????";
exit;
}
astound_set_option($name,$checked);
echo "I'm back";
//astound_errorsonoff('off');
exit;
}
function astound_update_spamwords() {
// Handle request then generate response using WP_Ajax_Response
//astound_errorsonoff();
$name='spamwords';
$astound_opt=$_POST['astound_opt'];
$astound_opt=sanitize_text_field($astound_opt);
if (!wp_verify_nonce($astound_opt,'astound_options')) {
echo "Session timeout, please refresh the page";
exit;
}
//convert the textarea to an array.
$spamwords=$_POST['spamwords'];
$spamwords=sanitize_textarea_field($spamwords);
if(empty($spamwords)) {
$spamwords=array();
} else {
$spamwords=esc_textarea($spamwords);
$spamwords=explode("\n",$spamwords);
}
$tblist=array();
foreach($spamwords as $bl) {
$bl=trim($bl);
if (!empty($bl)) $tblist[]=$bl;
}
$options['spamwords']=$tblist;
$spamwords=$tblist;
astound_set_option('spamwords',$spamwords);
echo "OK";
// close the textarea
//astound_errorsonoff('off');
exit;
}
function astound_update_wlist() {
// Handle request then generate response using WP_Ajax_Response
//astound_errorsonoff();
$name='wlist';
$astound_opt=$_POST['astound_opt'];
$astound_opt=sanitize_text_field($astound_opt);
if (!wp_verify_nonce($astound_opt,'astound_options')) {
echo "Session timeout, please refresh the page";
exit;
}
//convert the textarea to an array.
$wlist=$_POST['wlist'];
$wlist=sanitize_textarea_field($wlist);
if(empty($wlist)) {
$wlist=array();
} else {
$wlist=esc_textarea($wlist);
$wlist=explode("\n",$wlist);
}
$tblist=array();
foreach($wlist as $bl) {
$bl=trim($bl);
if (!empty($bl)) $tblist[]=$bl;
}
$options['wlist']=$tblist;
$wlist=$tblist;
astound_set_option('wlist',$wlist);
echo "OK";
// close the textarea
//astound_errorsonoff('off');
exit;
}
function astound_update_tldlist() {
// Handle request then generate response using WP_Ajax_Response
//astound_errorsonoff();
$name='tldlist';
$astound_opt=$_POST['astound_opt'];
$astound_opt=sanitize_text_field($astound_opt);
if (!wp_verify_nonce($astound_opt,'astound_options')) {
echo "Session timeout, please refresh the page";
exit;
}
//convert the textarea to an array.
$tldlist=$_POST['tldlist'];
$tldlist=sanitize_textarea_field($tldlist);
if(empty($tldlist)) {
$tldlist=array();
} else {
$tldlist=esc_textarea($tldlist);
$tldlist=explode("\n",$tldlist);
}
$tblist=array();
foreach($tldlist as $bl) {
$bl=trim($bl);
if (!empty($bl)) $tblist[]=$bl;
}
$options['tldlist']=$tblist;
$tldlist=$tblist;
astound_set_option('tldlist',$tldlist);
echo "OK";
// close the textarea
//astound_errorsonoff('off');
exit;
}
function astound_update_badtldlist() {
// Handle request then generate response using WP_Ajax_Response
//astound_errorsonoff();
$name='badtldlist';
$astound_opt=$_POST['astound_opt'];
$astound_opt=sanitize_text_field($astound_opt);
if (!wp_verify_nonce($astound_opt,'astound_options')) {
echo "Session timeout, please refresh the page";
exit;
}
//convert the textarea to an array.
$tldlist=$_POST['badtldlist'];
$tldlist=sanitize_textarea_field($tldlist);
if(empty($tldlist)) {
$tldlist=array();
} else {
$tldlist=esc_textarea($tldlist);
$tldlist=explode("\n",$tldlist);
}
$tblist=array();
foreach($tldlist as $bl) {
$bl=trim($bl);
if (!empty($bl)) $tblist[]=$bl;
}
$options['badtldlist']=$tblist;
$tldlist=$tblist;
astound_set_option('badtldlist',$tldlist);
echo "OK";
// close the textarea
//astound_errorsonoff('off');
exit;
}
function astound_control() {
// this is the display of information about the page.
if (array_key_exists('resetOptions',$_POST)) {
astound_force_reset_options();
}
$ip=astound_get_ip();
$nonce=wp_create_nonce('astound_options');
$options=astound_get_options();
extract($options);
?>
To turn an option on or off just click the button. The options are automatically saved.
Some options have a list associated with them. Click the edit button next to them and add or delete list items. Use a separate line for each item.