"Arrow Color","AndroCaptcha_line_color"=>"Line Color","AndroCaptcha_inner_circle_color"=>"Inner Circle Color","AndroCaptcha_outer_circle_color"=>"Outer Circle Color","AndroCaptcha_init_circle_color"=>"Initial Circle Color","AndroCaptcha_bg_color"=>"Background Color");
$current_user = wp_get_current_user();
$id=$current_user->ID;
if(!empty($_POST))
{
$error_list="
";
foreach ($_POST as $key => $value)
{
if(empty($value))
{
$error_list.="ERROR: $label[$key] cannot be empty!
";
$error=true;
continue;
}
$result=preg_match('/^rgb\([0-9]{1,3}\,[0-9]{1,3}\,[0-9]{1,3}\)$|^rgba\([0-9]{1,3}\,[0-9]{1,3}\,[0-9]{1,3}\,[0-1]\.*[0-9]*\)$/i', $value,$matches);
if($result!=1) //to check if the submitted color is a valid rgb/rgba color
{
$error_list.="ERROR: There is something wrong with $label[$key]
";
$error=true;
}
}
$error_list.="
";
if($error===true)
echo $error_list;
if($error===false && current_user_can( 'manage_options' )) //options can be added with permissions and if there is no error!
{
$options=array();
foreach ($_POST as $key => $value) {
$options[$key]=$value;
}
if(update_option('AndroCaptcha_options', $options ))
echo "Options Updated Successfully!
";
else
echo "Sorry!!! There was something wrong in updating the options
";
}
show_options_page();
}
else
{
if ( 0 == $id) {
// Not logged in.
}
else {
show_options_page();
}
}
function show_options_page()
{
echo '
Android Captcha Options Menu
';
}
?>