public static function validate_settings($input)
{
$output = array();
if (empty($input['tag-name'])) {
$output['tag-id'] = 0;
} else {
$term = get_term_by('name', $input['tag-name'], 'post_tag');
if ($term) {
$output['tag-id'] = $term->term_id;
} else {
$new_tag = wp_create_tag($input['tag-name']);
if (!is_wp_error($new_tag) && isset($new_tag['term_id'])) {
$output['tag-id'] = $new_tag['term_id'];
}
}
$output['tag-name'] = $input['tag-name'];
}
$output['hide-tag'] = isset($input['hide-tag']) && $input['hide-tag'] ? 1 : 0;
$output['show-all'] = isset($input['show-all']) && $input['show-all'] ? 1 : 0;
self::delete_transient();
return $output;
}