get_settings(); $nonce = wp_create_nonce( 'aiforya_fg_nonce' ); $position = (string) $settings['position']; $layout = (string) $settings['layout']; $default_title = (string) $settings['default_title']; $color_primary = (string) $settings['color_primary']; $color_bg = (string) $settings['color_bg']; $color_text = (string) $settings['color_text']; $color_question = (string) $settings['color_question']; $positions = [ 'manual' => __( 'Manual — only where the shortcode or the block is placed', 'aiforya-faq-generator' ), 'after' => __( 'Automatic — after the post content', 'aiforya-faq-generator' ), 'before' => __( 'Automatic — before the post content', 'aiforya-faq-generator' ), ]; $layouts = [ 'accordion' => __( 'Accordion — clickable question, expandable answer (recommended)', 'aiforya-faq-generator' ), 'cards' => __( 'Cards — grid of Q&A cards', 'aiforya-faq-generator' ), 'list' => __( 'List — all answers shown', 'aiforya-faq-generator' ), 'numbered' => __( 'Numbered list', 'aiforya-faq-generator' ), 'minimal' => __( 'Minimal — no borders or background', 'aiforya-faq-generator' ), ]; $colors = [ 'color_primary' => [ __( 'Accent (borders)', 'aiforya-faq-generator' ), $color_primary ], 'color_bg' => [ __( 'Block background', 'aiforya-faq-generator' ), $color_bg ], 'color_question' => [ __( 'Question text', 'aiforya-faq-generator' ), $color_question ], 'color_text' => [ __( 'Answer text', 'aiforya-faq-generator' ), $color_text ], ]; // Helper D2 : pastille d'aide « ? » charte (AiforyaTooltip). $text déjà traduit. $tip = static function ( $text ) { printf( '', esc_attr( $text ) ); }; ?>

$conf ) : ?>

[aiforya_faq]

[aiforya_faq post_id="42"]

[aiforya_faq title="Your questions"]

__( 'Saving…', 'aiforya-faq-generator' ), 'enregistre' => __( 'Saved.', 'aiforya-faq-generator' ), 'reglagesEnregistres' => __( 'Settings saved.', 'aiforya-faq-generator' ), 'echecDeLEnregistrement' => __( 'Saving failed.', 'aiforya-faq-generator' ), 'erreurReseau' => __( 'Network error.', 'aiforya-faq-generator' ), ) ); $js = <<<'JS' var L = window.aiforyaFaqGeneratorTabSettingsL10n || {}; (function () { if (typeof jQuery === 'undefined') { return; } jQuery(function ($) { var $form = $('#aiforya-fg-settings-form'); var $result = $('#aiforya-fg-settings-result'); $form.on('submit', function (e) { e.preventDefault(); $result.css('color', '#94a3b8').text(L.enregistrement); $.post(ajaxurl, $form.serialize(), function (response) { if (response && response.success) { $result.css('color', '#4ade80').text(L.enregistre); if (window.AiforyaToast) { window.AiforyaToast.success(L.reglagesEnregistres); } } else { var msg = (response && response.data && response.data.message) || L.echecDeLEnregistrement; $result.css('color', '#f87171').text(msg); if (window.AiforyaToast) { window.AiforyaToast.error(msg); } } }).fail(function (xhr) { var msg = L.erreurReseau + ' ' + xhr.status; $result.css('color', '#f87171').text(msg); if (window.AiforyaToast) { window.AiforyaToast.error(msg); } }); }); }); })(); JS; wp_add_inline_script( $handle, $js ); ?>