get_styles();
if (isset($_POST['sf_rsubmit']) && isset($_POST['_wpnonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['_wpnonce'])))) {
$AjaxyLiveSearch->clear_styles();
$AjaxyLiveSearch->remove_template('more');
} elseif (isset($_POST['sf_submit']) && isset($_POST['_wpnonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['_wpnonce'])))) {
$styles = $_POST['sf']['style'];
$templates = $_POST['sf']['template'];
$values = array_replace($values, [
'search_label' => $styles['label'] ?? 'Search',
'input_id' => $styles['input_id'],
'width' => (int)$styles['width'],
'credits' => (int)$styles['credits'] ?? 1,
'aspect_ratio' => (int)$styles['aspect_ratio'] ?? 0,
'hook_search_form' => (int)$styles['hook_form'] ?? 0,
'rtl_theme' => (int)$styles['rtl'] ?? 0,
'delay' => (int)$styles['delay'],
'border-width' => (int)$styles['b_width'] ?? 0,
'border-type' => $styles['b_type'] ?? 'none',
'border-color' => $styles['b_color'] ?? '000000',
'search_url' => $styles['url'] ?? '',
'results_width' => (int)$styles['results_width'] ?? 0,
'results_width_unit' => $styles['results_width_unit'] ?? 'px',
'excerpt' => (int)$styles['excerpt'] ?? 10,
'css' => $styles['css'] ?? '',
'thumb_width' => (int)$styles['thumb_width'] ?? 50,
'thumb_height' => (int)$styles['thumb_height'] ?? 50,
]);
$AjaxyLiveSearch->set_styles($values);
$AjaxyLiveSearch->set_templates('more', $templates['more_results']);
$message = esc_html__("Settings saved", AJAXY_SF_PLUGIN_TEXT_DOMAIN);
}
?>