function fb_options_validate_plugin($array, $label_prefix, $sanitize = true) { // TODO desperately needs to be driven from plugin definitions if ($sanitize) { foreach ($array as $key => $value) { $array[$key] = sanitize_text_field($value); } } if (!isset($array['enabled']) || !$array['enabled']) { return $array; } foreach ($array as $key => $value) { $label = ''; switch ($key) { case 'trigger': $label = "{$label_prefix} trigger"; break; case 'read_time': $label = "{$label_prefix} read time"; break; case 'width': $label = "{$label_prefix} width"; break; case 'num_posts': $label = "{$label_prefix} number of posts"; break; } if ($label != '' && fb_options_validate_present($value, $label)) { $value = fb_options_validate_integer($value, $label); } $array[$key] = $value; } return $array; }
function fb_options_validate_plugin($array, $label_prefix, $sanitize = true) { // TODO desperately needs to be driven from plugin definitions if ($sanitize) { $array = fb_sanitize_options($array); } if (!isset($array['enabled']) || !$array['enabled']) { return $array; } foreach ($array as $key => $value) { $label = ''; switch ($key) { case 'trigger': $label = sprintf(__('%s trigger', 'facebook'), $label_prefix); break; case 'read_time': $label = sprintf(__('%s read time', 'facebook'), $label_prefix); break; case 'width': $label = sprintf(__('%s width', 'facebook'), $label_prefix); break; case 'num_posts': $label = sprintf(__('%s number of posts', 'facebook'), $label_prefix); break; } if ($label != '' && fb_options_validate_present($value, $label)) { $value = fb_options_validate_integer($value, $label); } $array[$key] = $value; } return $array; }