403 ) ); } // ___________________________________________________________________________________________ \\ // === PREPARE =============================================================================== \\ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ \\ global $ai4seo_settings; global $ai4seo_fallback_allowed_user_roles; ai4seo_register_wpml_metadata_affixes(); // Prepare variable for the user-roles. $ai4seo_allowed_user_roles = ai4seo_get_all_possible_user_roles(); // fallback for user-roles. if ( ! $ai4seo_allowed_user_roles ) { $ai4seo_allowed_user_roles = $ai4seo_fallback_allowed_user_roles; } $ai4seo_setting_meta_tag_output_mode_allowed_values = ai4seo_get_setting_meta_tag_output_mode_allowed_values(); $ai4seo_focus_keyphrase_behavior_options = ai4seo_get_focus_keyphrase_behavior_options(); $ai4seo_wordpress_language = ai4seo_get_wordpress_language(); $ai4seo_language_options = ai4seo_get_translated_generation_language_options(); if ( isset( $ai4seo_language_options[ $ai4seo_wordpress_language ] ) ) { $ai4seo_wordpress_language = $ai4seo_language_options[ $ai4seo_wordpress_language ]; } $ai4seo_user_has_basic_plan_or_higher = ai4seo_user_has_at_least_plan( 's' ); $ai4seo_user_has_pro_plan_or_higher = ai4seo_user_has_at_least_plan( 'm' ); $ai4seo_user_has_premium_plan_or_higher = ai4seo_user_has_at_least_plan( 'l' ); // ___________________________________________________________________________________________ \\ // === OUTPUT ================================================================================ \\ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ \\ // HEADLINE. echo "
"; ai4seo_echo_wp_kses( ai4seo_get_settings_form_state_tag() ); // ___________________________________________________________________________________________ \\ // === TOP BUTTON ROW ======================================================================== \\ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ \\ echo "
"; ai4seo_echo_wp_kses( ai4seo_get_small_icon_button_tag( 'download', esc_html__( 'Export/Import', 'ai-for-seo' ), 'ai4seo-lockable', 'ai4seo_open_modal_from_schema("export-import-settings", {modal_size: "small", unsaved_changes_warnings: true});' ) ); ai4seo_echo_wp_kses( ai4seo_get_small_icon_button_tag( 'rotate', esc_html__( 'Restore Default', 'ai-for-seo' ), 'ai4seo-lockable', 'ai4seo_restore_default_settings();' ) ); // === ADVANCED SETTINGS TOGGLE ============================================================================= \\ // Derive the no-JavaScript presentation from the saved preference so the first paint is accurate. $ai4seo_this_setting_name = AI4SEO_SETTING_SHOW_ADVANCED_SETTINGS; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_setting( $ai4seo_this_setting_name ); $ai4seo_are_advanced_settings_shown = 'show' === $ai4seo_this_setting_input_value; $ai4seo_show_advanced_label = __( 'Show Advanced Settings', 'ai-for-seo' ); $ai4seo_hide_advanced_label = __( 'Hide Advanced Settings', 'ai-for-seo' ); $ai4seo_advanced_toggle_label = $ai4seo_are_advanced_settings_shown ? $ai4seo_hide_advanced_label : $ai4seo_show_advanced_label; $ai4seo_advanced_toggle_classes = 'ai4seo-button ai4seo-lockable ai4seo-small-button'; $ai4seo_advanced_toggle_classes .= $ai4seo_are_advanced_settings_shown ? ' ai4seo-advanced-settings-highlight' : ''; $ai4seo_show_advanced_icon_classes = 'ai4seo-button-icon-left ai4seo-advanced-settings-show-icon'; $ai4seo_show_advanced_icon_classes .= $ai4seo_are_advanced_settings_shown ? ' ai4seo-display-none' : ''; $ai4seo_hide_advanced_icon_classes = 'ai4seo-button-icon-left ai4seo-advanced-settings-hide-icon'; $ai4seo_hide_advanced_icon_classes .= $ai4seo_are_advanced_settings_shown ? '' : ' ai4seo-display-none'; $ai4seo_show_advanced_icon = ai4seo_get_svg_tag( 'eye', '', $ai4seo_show_advanced_icon_classes, true ); $ai4seo_hide_advanced_icon = ai4seo_get_svg_tag( 'eye-slash', '', $ai4seo_hide_advanced_icon_classes, true ); // Keep both icon states in one disclosure so scripts can update labels and ARIA without replacing the control. echo ""; echo "
"; echo "'; echo '
'; echo '
'; // Keep native hash targets, translated labels, and existing advanced-setting visibility on one shared navigation map. $ai4seo_settings_section_navigation_items = array( 'ai4seo-settings-section-general' => array( 'label' => __( 'General', 'ai-for-seo' ), 'is_advanced' => false, ), 'ai4seo-settings-section-metadata' => array( 'label' => __( 'Metadata', 'ai-for-seo' ), 'is_advanced' => false, ), 'ai4seo-settings-section-media-attributes' => array( 'label' => __( 'Media attributes', 'ai-for-seo' ), 'is_advanced' => false, ), 'ai4seo-settings-section-user-management' => array( 'label' => __( 'User Management', 'ai-for-seo' ), 'is_advanced' => true, ), 'ai4seo-settings-section-troubleshooting' => array( 'label' => __( 'Troubleshooting', 'ai-for-seo' ), 'is_advanced' => true, ), ); // Render native links so browser hash/history behavior remains available when JavaScript is unavailable. echo "'; // ___________________________________________________________________________________________ \\ // === GENERAL =============================================================================== \\ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ \\ echo "
"; echo "

"; ai4seo_echo_wp_kses( ai4seo_get_dashicon_tag( 'admin-generic', 'ai4seo-menu-item-icon', true ) ); echo esc_html__( 'General', 'ai-for-seo' ); echo '

'; // === AI4SEO_SETTING_GLOBAL_CUSTOM_INSTRUCTIONS ========================================== \\ $ai4seo_this_setting_name = AI4SEO_SETTING_GLOBAL_CUSTOM_INSTRUCTIONS; $ai4seo_this_setting_description = esc_html__( 'These instructions are added to every metadata and media attribute generation prompt.', 'ai-for-seo' ); // Render the setting through the shared wrapper so save-anything names and counters stay aligned. ai4seo_echo_wp_kses( ai4seo_get_custom_instructions_setting_form_item_tag( $ai4seo_this_setting_name, esc_html__( 'Global Custom Instructions', 'ai-for-seo' ) . ':', $ai4seo_this_setting_description, esc_html__( 'Global Custom Instructions', 'ai-for-seo' ), '', '', 'global' ) ); // === AI4SEO_SETTING_DEFAULT_EDITOR_VIEW_MODE =========================================== \\ $ai4seo_this_setting_name = AI4SEO_SETTING_DEFAULT_EDITOR_VIEW_MODE; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_editor_default_view_mode(); // Keep this global choice beside the instructions shared by both entry editors. echo "
"; echo "
"; echo "'; echo "
"; echo "'; echo "

" . esc_html__( 'Choose whether Preview or Editor mode opens first in both the Metadata and Media Attributes editors. You can switch modes at any time inside an editor.', 'ai-for-seo' ) . '

'; echo '
'; echo '
'; // === AI4SEO_SETTING_ENABLE_NATIVE_BULK_ACTIONS ========================================== \\ $ai4seo_this_setting_name = AI4SEO_SETTING_ENABLE_NATIVE_BULK_ACTIONS; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = (bool) ai4seo_get_setting( $ai4seo_this_setting_name ); // Resolve plugin-name text once so native-list integration copy stays aligned; escape at output boundaries. $ai4seo_plugin_name = ai4seo_get_plugin_name(); $ai4seo_this_setting_checkbox_label = sprintf( /* translators: %s: Plugin name. */ __( 'Show %s bulk actions in native WordPress lists', 'ai-for-seo' ), $ai4seo_plugin_name ); $ai4seo_this_setting_description = sprintf( /* translators: %1$s: Plugin name, %2$s: Plugin name. */ __( 'Enable this to add %1$s bulk actions to native WordPress post, page, product, and Media Library tables. When disabled, bulk actions remain available only inside %2$s plugin pages.', 'ai-for-seo' ), $ai4seo_plugin_name, $ai4seo_plugin_name ); // Separate this site-integration toggle from the global prompt instructions above it. echo "
"; // Render as a normal boolean setting so the shared save-anything handler can persist the checkbox value. echo "
"; echo "'; echo "
"; echo "'; echo "

"; echo esc_html( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; echo '
'; // ___________________________________________________________________________________________ \\ // === METADATA ============================================================================== \\ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ \\ echo "
"; // Headline. echo "

"; ai4seo_echo_wp_kses( ai4seo_get_dashicon_tag( 'admin-site', 'ai4seo-menu-item-icon', true ) ); echo esc_html__( 'Metadata', 'ai-for-seo' ) . " (" . esc_html__( 'for pages/posts/products etc.', 'ai-for-seo' ) . ')'; echo '

'; // === AI4SEO_SETTING_ACTIVE_META_TAGS ========================================================== \\ $ai4seo_this_setting_name = AI4SEO_SETTING_ACTIVE_META_TAGS; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_setting( $ai4seo_this_setting_name ); $ai4seo_this_setting_description = esc_html__( 'Select which meta tags to include or exclude from plugin generation. Does not affect meta tags from other plugins.', 'ai-for-seo' ); // Divider // echo "
";. // Display form elements. echo "
"; echo ""; echo esc_html__( 'Active Meta Tags:', 'ai-for-seo' ); echo ''; echo "
"; // Define variable for the selected user-roles based on plugin-settings. $ai4seo_this_checked_values = ( $ai4seo_this_setting_input_value && is_array( $ai4seo_this_setting_input_value ) ? $ai4seo_this_setting_input_value : array() ); // Identify the metadata group when navigating select-all controls by accessible name. ai4seo_echo_wp_kses( ai4seo_get_select_all_checkbox( $ai4seo_this_setting_input_name, 'auto', __( 'Active Meta Tags:', 'ai-for-seo' ) ) ); echo "
"; // Loop through all available user-roles and display checkboxes for each of them. foreach ( $ai4seo_metadata_field_descriptors as $ai4seo_this_metadata_identifier => $ai4seo_this_metadata_details ) { $ai4seo_this_translated_checkbox_label = $ai4seo_this_metadata_details['name'] ?? $ai4seo_this_metadata_identifier; $ai4seo_this_checkbox_id = "{$ai4seo_this_setting_input_name}-{$ai4seo_this_metadata_identifier}"; // Match only canonical metadata identifiers so type-confused values remain unchecked. $ai4seo_is_this_checkbox_checked = in_array( $ai4seo_this_metadata_identifier, $ai4seo_this_checked_values, true ); echo "'; } echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; // Reuse the active SEO plugin details for the external metadata button copy and the third-party sync settings below. $ai4seo_active_third_party_seo_plugin_details = ai4seo_get_active_third_party_seo_plugin_details(); // === AI4SEO_SETTING_ENABLE_EXTERNAL_METADATA_GENERATE_BUTTONS ======================================= \\ $ai4seo_this_setting_name = AI4SEO_SETTING_ENABLE_EXTERNAL_METADATA_GENERATE_BUTTONS; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = (bool) ai4seo_get_setting( $ai4seo_this_setting_name ); $ai4seo_external_metadata_generate_button_location_names = array(); // List only SEO integrations where external metadata buttons can appear on this site. $ai4seo_external_metadata_generate_button_seo_plugin_identifiers = array( AI4SEO_THIRD_PARTY_PLUGIN_YOAST_SEO, AI4SEO_THIRD_PARTY_PLUGIN_RANK_MATH, AI4SEO_THIRD_PARTY_PLUGIN_SEO_KEY, ); foreach ( $ai4seo_external_metadata_generate_button_seo_plugin_identifiers as $ai4seo_this_external_metadata_generate_button_seo_plugin_identifier ) { if ( empty( $ai4seo_active_third_party_seo_plugin_details[ $ai4seo_this_external_metadata_generate_button_seo_plugin_identifier ] ) ) { continue; } $ai4seo_this_external_metadata_generate_button_seo_plugin_details = $ai4seo_active_third_party_seo_plugin_details[ $ai4seo_this_external_metadata_generate_button_seo_plugin_identifier ]; $ai4seo_external_metadata_generate_button_location_names[] = $ai4seo_this_external_metadata_generate_button_seo_plugin_details['name'] ?? $ai4seo_this_external_metadata_generate_button_seo_plugin_identifier; } // Add page-builder locations separately because they do not live in the active SEO plugin details map. if ( ai4seo_is_plugin_or_theme_active( AI4SEO_THIRD_PARTY_PLUGIN_ELEMENTOR ) ) { $ai4seo_external_metadata_generate_button_location_names[] = 'Elementor'; } if ( ai4seo_is_plugin_or_theme_active( AI4SEO_THIRD_PARTY_PLUGIN_BETHEME ) ) { $ai4seo_external_metadata_generate_button_location_names[] = 'BeBuilder (BeTheme)'; } $ai4seo_external_metadata_generate_button_location_names = array_unique( $ai4seo_external_metadata_generate_button_location_names ); $ai4seo_this_setting_description = esc_html__( 'Show "Generate with SOOZ" buttons and Metadata Editor shortcuts in supported third-party SEO plugins and page builders.', 'ai-for-seo' ); if ( $ai4seo_external_metadata_generate_button_location_names ) { $ai4seo_this_setting_description .= ' '; // Wrap active location names after de-duplication so the dynamic list can be safely passed through KSES. $ai4seo_external_metadata_generate_button_location_name_tags = array_map( function ( $ai4seo_this_external_metadata_generate_button_location_name ) { return '' . esc_html( $ai4seo_this_external_metadata_generate_button_location_name ) . ''; }, $ai4seo_external_metadata_generate_button_location_names ); /* translators: %s: comma-separated list of active third-party plugins and page builders */ $ai4seo_this_setting_description .= sprintf( esc_html__( 'Supported third-party SEO plugins and page builders where additional metadata buttons and shortcuts can be displayed: %s.', 'ai-for-seo' ), implode( ', ', $ai4seo_external_metadata_generate_button_location_name_tags ) ); } else { $ai4seo_this_setting_description .= ' ' . esc_html__( 'No supported third-party SEO plugin or page builder was found where our additional metadata buttons or shortcuts can be displayed.', 'ai-for-seo' ); } // Build logo-aware labels manually because the visible copy includes the sanitized SOOZ SVG. $ai4seo_this_setting_description .= ' ' . esc_html__( 'Disable this to keep external metadata editors unchanged while keeping the Metadata Editor available from the top bar.', 'ai-for-seo' ); $ai4seo_sooz_logo_tag = ai4seo_get_svg_tag( 'sooz', 'SOOZ', 'ai4seo-sooz-logo' ); /* translators: %s: SOOZ logo */ $ai4seo_generate_with_sooz_buttons_label = sprintf( esc_html__( '"Generate with %s" buttons', 'ai-for-seo' ), $ai4seo_sooz_logo_tag ); /* translators: %s: SOOZ logo */ $ai4seo_generate_with_sooz_buttons_toggle_label = sprintf( esc_html__( 'Show additional "Generate with %s" buttons in external editors', 'ai-for-seo' ), $ai4seo_sooz_logo_tag ); echo "
"; echo "
"; echo "'; echo "
"; echo "'; echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; // === AI4SEO_SETTING_METADATA_CUSTOM_INSTRUCTIONS ======================================== \\ $ai4seo_this_setting_name = AI4SEO_SETTING_METADATA_CUSTOM_INSTRUCTIONS; $ai4seo_this_setting_description = esc_html__( 'These instructions are added to every metadata generation prompt.', 'ai-for-seo' ); echo "
"; // Render the setting through the shared wrapper so save-anything names and counters stay aligned. ai4seo_echo_wp_kses( ai4seo_get_custom_instructions_setting_form_item_tag( $ai4seo_this_setting_name, esc_html__( 'Metadata Custom Instructions', 'ai-for-seo' ) . ':', $ai4seo_this_setting_description, esc_html__( 'Metadata Custom Instructions', 'ai-for-seo' ), '', '', 'metadata' ) ); // === METADATA PROMPT SLIDER SETTINGS ================================================== \\ // Keep prompt-control ordering explicit while sharing the same slider form-item renderer. $ai4seo_metadata_prompt_slider_settings = array( array( 'setting_name' => AI4SEO_SETTING_METADATA_TONE_VARIANT, 'label' => esc_html__( 'Metadata Tone Variant:', 'ai-for-seo' ), ), array( 'setting_name' => AI4SEO_SETTING_METADATA_COMMERCIAL_TONE, 'label' => esc_html__( 'CTA / Commercial Tone:', 'ai-for-seo' ), ), array( 'setting_name' => AI4SEO_SETTING_METADATA_FOCUS_KEYPHRASE_INFLUENCE, 'label' => esc_html__( 'Focus Keyphrase Influence:', 'ai-for-seo' ), 'is_advanced_setting' => true, ), array( 'setting_name' => AI4SEO_SETTING_METADATA_SEO_KEYWORD_INTENSITY, 'label' => esc_html__( 'SEO Keyword Intensity:', 'ai-for-seo' ), 'is_advanced_setting' => true, ), array( 'setting_name' => AI4SEO_SETTING_METADATA_SOCIAL_VARIATION, 'label' => esc_html__( 'Social Metadata Variation:', 'ai-for-seo' ), 'is_advanced_setting' => true, ), array( 'setting_name' => AI4SEO_SETTING_METADATA_WEBSITE_BRAND_CONTEXT_INFLUENCE, 'label' => esc_html__( 'Website / Brand Context Influence:', 'ai-for-seo' ), 'is_advanced_setting' => true, ), array( 'setting_name' => AI4SEO_SETTING_METADATA_EXISTING_VALUES_REFERENCE_STRENGTH, 'label' => esc_html__( 'Existing Values Reference Strength:', 'ai-for-seo' ), ), ); foreach ( $ai4seo_metadata_prompt_slider_settings as $ai4seo_this_prompt_slider_setting ) { // Render each saved slider through the reusable radio-group helper so save-anything stays unchanged. ai4seo_echo_wp_kses( ai4seo_get_prompt_slider_setting_form_item_tag( $ai4seo_this_prompt_slider_setting['setting_name'], $ai4seo_this_prompt_slider_setting['label'], ! empty( $ai4seo_this_prompt_slider_setting['is_advanced_setting'] ), esc_html__( 'Metadata', 'ai-for-seo' ) ) ); } // === METADATA GENERATION LENGTH SETTINGS ================================================ \\ $ai4seo_metadata_generation_length_settings = array( AI4SEO_SETTING_METADATA_META_TITLE_GENERATION_LENGTH => esc_html__( 'Meta Title Generation Length:', 'ai-for-seo' ), AI4SEO_SETTING_METADATA_META_DESCRIPTION_GENERATION_LENGTH => esc_html__( 'Meta Description Generation Length:', 'ai-for-seo' ), AI4SEO_SETTING_METADATA_FACEBOOK_TITLE_GENERATION_LENGTH => esc_html__( 'Facebook / Open Graph Title Generation Length:', 'ai-for-seo' ), AI4SEO_SETTING_METADATA_FACEBOOK_DESCRIPTION_GENERATION_LENGTH => esc_html__( 'Facebook / Open Graph Description Generation Length:', 'ai-for-seo' ), AI4SEO_SETTING_METADATA_TWITTER_TITLE_GENERATION_LENGTH => esc_html__( 'Twitter / X Title Generation Length:', 'ai-for-seo' ), AI4SEO_SETTING_METADATA_TWITTER_DESCRIPTION_GENERATION_LENGTH => esc_html__( 'Twitter / X Description Generation Length:', 'ai-for-seo' ), ); foreach ( $ai4seo_metadata_generation_length_settings as $ai4seo_this_setting_name => $ai4seo_this_setting_label ) { ai4seo_echo_wp_kses( ai4seo_get_prompt_slider_setting_form_item_tag( $ai4seo_this_setting_name, $ai4seo_this_setting_label, true, esc_html__( 'Metadata', 'ai-for-seo' ) ) ); } // === AI4SEO_SETTING_DISABLED_POST_TYPES ===================================================== \\ $ai4seo_this_setting_name = AI4SEO_SETTING_DISABLED_POST_TYPES; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_disabled_post_types = ai4seo_get_setting( $ai4seo_this_setting_name ); $ai4seo_disabled_post_types = is_array( $ai4seo_disabled_post_types ) ? $ai4seo_disabled_post_types : array(); $ai4seo_all_supported_post_types = ai4seo_get_supported_post_types( false ); $ai4seo_active_post_types = array_values( array_diff( $ai4seo_all_supported_post_types, $ai4seo_disabled_post_types ) ); /* translators: %s: plugin name */ $ai4seo_this_setting_description = sprintf( esc_html__( 'Uncheck any post type you want to hide from %s dashboards, widgets, and automations. Newly detected post types stay active by default.', 'ai-for-seo' ), esc_html( AI4SEO_PLUGIN_NAME ) ); echo "
"; echo "
"; echo ""; echo esc_html__( 'Active Post Types:', 'ai-for-seo' ); echo ''; echo "
"; if ( $ai4seo_all_supported_post_types ) { // Identify the post-type group when navigating select-all controls by accessible name. ai4seo_echo_wp_kses( ai4seo_get_select_all_checkbox( $ai4seo_this_setting_input_name, 'auto', __( 'Active Post Types:', 'ai-for-seo' ) ) ); echo "
"; foreach ( $ai4seo_all_supported_post_types as $ai4seo_this_post_type ) { $ai4seo_this_checkbox_id = "{$ai4seo_this_setting_input_name}-{$ai4seo_this_post_type}"; $ai4seo_is_checkbox_checked = in_array( $ai4seo_this_post_type, $ai4seo_active_post_types, true ); // Use the shared label formatter so custom post type names follow existing dashboard naming. $ai4seo_post_type_label = ai4seo_get_post_type_translation( $ai4seo_this_post_type, true ); $ai4seo_post_type_label = ai4seo_get_nice_label( $ai4seo_post_type_label ); echo "'; } } else { echo "

"; echo esc_html__( 'No supported post types detected.', 'ai-for-seo' ); echo '

'; } // Keep instruction examples off this activation selector because they govern the textareas below. echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; // === AI4SEO_SETTING_METADATA_POST_TYPE_CUSTOM_INSTRUCTIONS =============================== \\ $ai4seo_this_setting_name = AI4SEO_SETTING_METADATA_POST_TYPE_CUSTOM_INSTRUCTIONS; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_setting( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = is_array( $ai4seo_this_setting_input_value ) ? $ai4seo_this_setting_input_value : array(); $ai4seo_metadata_custom_instructions_post_types = ai4seo_get_supported_metadata_custom_instructions_post_types(); $ai4seo_this_setting_description = esc_html__( 'These instructions are added only when metadata is generated for the selected post type.', 'ai-for-seo' ); echo "
"; // Render nested post-type instruction inputs manually because each textarea saves into one setting map. echo "
"; echo ""; echo esc_html__( 'Post Type Custom Instructions:', 'ai-for-seo' ); echo ''; echo "
"; if ( $ai4seo_metadata_custom_instructions_post_types ) { // Keep one textarea per active metadata-capable post type so removed post types cannot be edited. foreach ( $ai4seo_metadata_custom_instructions_post_types as $ai4seo_this_post_type ) { // Keep instruction labels aligned with the active-post-type checkbox labels above. $ai4seo_this_post_type_label = ai4seo_get_post_type_translation( $ai4seo_this_post_type, true ); $ai4seo_this_post_type_label = ai4seo_get_nice_label( $ai4seo_this_post_type_label ); $ai4seo_this_post_type_input_name = $ai4seo_this_setting_input_name . '[' . $ai4seo_this_post_type . ']'; $ai4seo_this_post_type_input_id = $ai4seo_this_setting_input_name . '-' . $ai4seo_this_post_type; $ai4seo_this_post_type_input_value = $ai4seo_this_setting_input_value[ $ai4seo_this_post_type ] ?? ''; echo "
"; echo "'; ai4seo_echo_wp_kses( ai4seo_get_custom_instructions_textarea_tag( $ai4seo_this_post_type_input_id, $ai4seo_this_post_type_input_name, $ai4seo_this_post_type_input_value, '', sprintf( /* translators: %s: Post type label. */ esc_html__( 'Custom Instructions for %s', 'ai-for-seo' ), $ai4seo_this_post_type_label ) ) ); ai4seo_echo_wp_kses( ai4seo_get_custom_instructions_character_counter_tag( $ai4seo_this_post_type_input_id ) ); echo '
'; // Separate repeated post-type instruction editors without adding a trailing divider after the final one. if ( end( $ai4seo_metadata_custom_instructions_post_types ) !== $ai4seo_this_post_type ) { echo "
"; echo "
"; echo "
"; } } } else { echo "

"; echo esc_html__( 'No supported post types detected.', 'ai-for-seo' ); echo '

'; } // Place the shared examples and limits beside the post-type instruction controls they govern. echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description . ' ' . ai4seo_get_custom_instructions_examples_tooltip_tag( 'metadata-post-type' ) ); echo '

'; echo '
'; echo '
'; // === AI4SEO_SETTING_DISABLED_POST_AUTHORS =================================================== \\ $ai4seo_this_setting_name = AI4SEO_SETTING_DISABLED_POST_AUTHORS; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_disabled_post_author_ids = ai4seo_get_disabled_post_author_ids(); $ai4seo_available_post_authors = ai4seo_get_available_post_authors(); $ai4seo_available_post_author_ids = array_map( 'intval', array_keys( $ai4seo_available_post_authors ) ); $ai4seo_active_post_author_ids = array_values( array_diff( $ai4seo_available_post_author_ids, $ai4seo_disabled_post_author_ids ) ); /* translators: %s: plugin name */ $ai4seo_this_setting_description = esc_html__( 'Uncheck any author if you don’t want their posts to be included in the dashboard and the SEO Autopilot. Newly detected authors remain enabled by default.', 'ai-for-seo' ); echo "
"; echo "
"; echo ""; echo esc_html__( 'Active Authors:', 'ai-for-seo' ); echo ''; echo "
"; if ( $ai4seo_available_post_authors ) { // Distinguish metadata authors from the separate media-author selection below. ai4seo_echo_wp_kses( ai4seo_get_select_all_checkbox( $ai4seo_this_setting_input_name, 'auto', __( 'Active Authors:', 'ai-for-seo' ) ) ); echo "
"; foreach ( $ai4seo_available_post_authors as $ai4seo_this_post_author_id => $ai4seo_this_post_author_label ) { $ai4seo_this_checkbox_id = "{$ai4seo_this_setting_input_name}-{$ai4seo_this_post_author_id}"; $ai4seo_is_checkbox_checked = in_array( (int) $ai4seo_this_post_author_id, $ai4seo_active_post_author_ids, true ); echo "'; } } else { echo "

"; echo esc_html__( 'No authors with supported posts detected.', 'ai-for-seo' ); echo '

'; } echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; // === AI4SEO_SETTING_DISABLED_TAXONOMY_TERMS ================================================ \\ $ai4seo_this_setting_name = AI4SEO_SETTING_DISABLED_TAXONOMY_TERMS; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_disabled_taxonomy_terms = ai4seo_get_disabled_taxonomy_terms(); $ai4seo_supported_taxonomy_terms = ai4seo_get_supported_taxonomy_terms(); /* translators: %s: plugin name */ $ai4seo_this_setting_description = esc_html__( 'Uncheck any categories if you don’t want their content to be included in the dashboard and the SEO Autopilot. Categories (taxonomy terms) are grouped by taxonomy, and newly detected entries remain enabled by default.', 'ai-for-seo' ); echo "
"; echo "
"; echo ""; echo esc_html__( 'Active Categories (taxonomy terms):', 'ai-for-seo' ); echo ''; echo "
"; if ( $ai4seo_supported_taxonomy_terms ) { $ai4seo_taxonomy_group_index = 0; foreach ( $ai4seo_supported_taxonomy_terms as $ai4seo_this_taxonomy_name => $ai4seo_this_supported_taxonomy ) { $ai4seo_this_taxonomy_terms = (array) ( $ai4seo_this_supported_taxonomy['terms'] ?? array() ); if ( ! $ai4seo_this_taxonomy_terms ) { continue; } $ai4seo_this_taxonomy_label = sanitize_text_field( $ai4seo_this_supported_taxonomy['label'] ?? $ai4seo_this_taxonomy_name ); $ai4seo_this_taxonomy_input_name = $ai4seo_this_setting_input_name . '[' . $ai4seo_this_taxonomy_name . ']'; $ai4seo_this_disabled_term_ids = array_map( 'intval', (array) ( $ai4seo_disabled_taxonomy_terms[ $ai4seo_this_taxonomy_name ] ?? array() ) ); $ai4seo_this_supported_term_ids = array_map( 'intval', array_keys( $ai4seo_this_taxonomy_terms ) ); $ai4seo_this_active_term_ids = array_values( array_diff( $ai4seo_this_supported_term_ids, $ai4seo_this_disabled_term_ids ) ); if ( $ai4seo_taxonomy_group_index > 0 ) { echo "
"; } // Reuse the visible taxonomy label to distinguish each group's select-all control. echo '' . esc_html( $ai4seo_this_taxonomy_label ) . ''; echo "
"; ai4seo_echo_wp_kses( ai4seo_get_select_all_checkbox( $ai4seo_this_taxonomy_input_name, 'auto', $ai4seo_this_taxonomy_label ) ); echo "
"; $ai4seo_visible_taxonomy_terms = array_slice( $ai4seo_this_taxonomy_terms, 0, 10, true ); $ai4seo_hidden_taxonomy_terms = array_slice( $ai4seo_this_taxonomy_terms, 10, null, true ); foreach ( $ai4seo_visible_taxonomy_terms as $ai4seo_this_term_id => $ai4seo_this_term_name ) { $ai4seo_this_checkbox_id = "{$ai4seo_this_setting_input_name}-{$ai4seo_this_taxonomy_name}-{$ai4seo_this_term_id}"; $ai4seo_is_checkbox_checked = in_array( (int) $ai4seo_this_term_id, $ai4seo_this_active_term_ids, true ); echo "'; } if ( $ai4seo_hidden_taxonomy_terms ) { echo "
"; echo '' . esc_html__( 'See more entries', 'ai-for-seo' ) . ''; foreach ( $ai4seo_hidden_taxonomy_terms as $ai4seo_this_term_id => $ai4seo_this_term_name ) { $ai4seo_this_checkbox_id = "{$ai4seo_this_setting_input_name}-{$ai4seo_this_taxonomy_name}-{$ai4seo_this_term_id}"; $ai4seo_is_checkbox_checked = in_array( (int) $ai4seo_this_term_id, $ai4seo_this_active_term_ids, true ); echo "'; } echo '
'; } ++$ai4seo_taxonomy_group_index; } } else { echo "

"; echo esc_html__( 'No supported categories (taxonomy terms) detected.', 'ai-for-seo' ); echo '

'; } echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; // === AI4SEO_SETTING_EXCLUDE_POSTS_IF_ANY_DISABLED_TAXONOMY_TERM ======================= \\ $ai4seo_this_setting_name = AI4SEO_SETTING_EXCLUDE_POSTS_IF_ANY_DISABLED_TAXONOMY_TERM; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_setting( $ai4seo_this_setting_name ); $ai4seo_this_setting_description = __( 'Keep this disabled to exclude entries only when all assigned categories (taxonomy terms) covered by the filter are disabled.', 'ai-for-seo' ); $ai4seo_this_setting_description .= '

' . esc_html__( 'Enable it if a single disabled category (taxonomy term) should always exclude the entry, even when additional active categories are assigned.', 'ai-for-seo' ); echo "
"; echo "
"; echo "'; echo "
"; echo "'; echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; // === AI4SEO_SETTING_DISABLED_METADATA_WPML_LANGUAGES ===================================== \\ if ( ai4seo_is_plugin_or_theme_active( AI4SEO_THIRD_PARTY_PLUGIN_WPML ) ) { $ai4seo_this_setting_name = AI4SEO_SETTING_DISABLED_METADATA_WPML_LANGUAGES; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_disabled_metadata_wpml_language_codes = ai4seo_get_disabled_metadata_wpml_language_codes(); $ai4seo_available_wpml_languages = ai4seo_get_available_wpml_languages(); $ai4seo_available_wpml_language_codes = array_keys( $ai4seo_available_wpml_languages ); $ai4seo_active_metadata_wpml_language_codes = array_values( array_diff( $ai4seo_available_wpml_language_codes, $ai4seo_disabled_metadata_wpml_language_codes ) ); $ai4seo_this_setting_description = esc_html__( 'Uncheck any WPML language if you do not want posts WPML assigns to that language to be included in the dashboard and the SEO Autopilot. Newly detected WPML languages stay active by default.', 'ai-for-seo' ); echo "
"; echo "
"; echo ""; ai4seo_echo_wp_kses( ai4seo_get_svg_tag( 'wpml', 'WPML', 'ai4seo-medium-icon' ) ); echo ' '; echo esc_html__( 'Active Languages:', 'ai-for-seo' ); echo ''; echo "
"; if ( $ai4seo_available_wpml_languages ) { // Distinguish metadata languages from the separate media-language selection below. ai4seo_echo_wp_kses( ai4seo_get_select_all_checkbox( $ai4seo_this_setting_input_name, 'auto', __( 'Active Metadata Languages (WPML):', 'ai-for-seo' ) ) ); echo "
"; // WPML language checkboxes submit active languages; save normalization stores only unchecked codes. foreach ( $ai4seo_available_wpml_languages as $ai4seo_this_wpml_language_code => $ai4seo_this_wpml_language_label ) { $ai4seo_this_checkbox_id = "{$ai4seo_this_setting_input_name}-{$ai4seo_this_wpml_language_code}"; $ai4seo_is_checkbox_checked = in_array( $ai4seo_this_wpml_language_code, $ai4seo_active_metadata_wpml_language_codes, true ); echo "'; } } else { echo "

"; echo esc_html__( 'No WPML languages detected.', 'ai-for-seo' ); echo '

'; } echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; } // === AI4SEO_SETTING_METADATA_GENERATION_LANGUAGE =========================================== \\ $ai4seo_this_setting_name = AI4SEO_SETTING_METADATA_GENERATION_LANGUAGE; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_setting( $ai4seo_this_setting_name ); $ai4seo_this_setting_description = ''; if ( ai4seo_is_plugin_or_theme_active( AI4SEO_THIRD_PARTY_PLUGIN_WPML ) ) { $ai4seo_this_setting_description .= sprintf( /* translators: 1: WPML (plugin name), 2: WPML (plugin name) */ esc_html__( '%1$s detected. Use “Automatic” to determine which language to use based on %2$s.', 'ai-for-seo' ), 'WPML', 'WPML' ); } else { $ai4seo_this_setting_description .= esc_html__( "Select a specific language or choose 'Automatic' to let AI determine the best language for each content entry.", 'ai-for-seo' ); } // Divider. echo "
"; echo "
"; echo "'; echo "
"; echo "'; echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; // === AI4SEO_SETTING_METADATA_FALLBACKS ========================================================= \\ echo "
"; echo "
"; echo ""; echo esc_html__( 'Meta Tag Fallbacks:', 'ai-for-seo' ); echo ''; echo "
"; foreach ( AI4SEO_METADATA_FALLBACK_MAPPING as $ai4seo_this_metadata_identifier => $ai4seo_this_fallback_setting_name ) { if ( ! isset( $ai4seo_metadata_field_descriptors[ $ai4seo_this_metadata_identifier ] ) ) { continue; } $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_fallback_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_setting( $ai4seo_this_fallback_setting_name ); $ai4seo_this_allowed_options = ai4seo_get_metadata_fallback_allowed_values( $ai4seo_this_metadata_identifier ); $ai4seo_this_label = $ai4seo_metadata_field_descriptors[ $ai4seo_this_metadata_identifier ]['name'] ?? $ai4seo_this_metadata_identifier; echo "
"; echo "'; echo "'; echo '
'; } echo "

"; echo esc_html__( 'Choose how each meta tag should behave when no value is available or has not been generated.', 'ai-for-seo' ); echo '

'; echo '
'; echo '
'; // === AI4SEO_SETTING_METADATA_PREFIXES & AI4SEO_SETTING_METADATA_SUFFIXES =================== \\ $ai4seo_metadata_prefix_setting_name = AI4SEO_SETTING_METADATA_PREFIXES; $ai4seo_metadata_suffix_setting_name = AI4SEO_SETTING_METADATA_SUFFIXES; // Prefix. $ai4seo_metadata_prefix_setting_input_name = "ai4seo_{$ai4seo_metadata_prefix_setting_name}"; $ai4seo_metadata_prefix_setting_input_value = ai4seo_get_setting( $ai4seo_metadata_prefix_setting_name ); // Suffix. $ai4seo_metadata_suffix_setting_input_name = "ai4seo_{$ai4seo_metadata_suffix_setting_name}"; $ai4seo_metadata_suffix_setting_input_value = ai4seo_get_setting( $ai4seo_metadata_suffix_setting_name ); // Description for both prefix and suffix. $ai4seo_this_setting_description = esc_html__( "Add prefix and suffix text to metadata fields. Applied only when 'Meta Tag Output Mode' is set to 'Replace' or 'Force'. Useful for including website name or branding elements consistently across all metadata.", 'ai-for-seo' ); $ai4seo_metadata_placeholders_tooltip = __( 'Available placeholders (case-insensitive; supports {PLACEHOLDER}, [PLACEHOLDER], or %%placeholder%% formats):
WEBSITE_URL - Site URL.
WEBSITE_NAME - Site name.
POST_ID - Current entry ID.
TITLE - Current entry title.
PRODUCT_NAME - WooCommerce product title (products only).
PRODUCT_PRICE - WooCommerce product price (products only).

Placeholders are replaced automatically when meta tags are injected on the frontend.', 'ai-for-seo' ); // Divider. echo "
"; // Display form elements. echo "
"; echo ""; echo esc_html__( 'Prefix / Suffix:', 'ai-for-seo' ); ai4seo_echo_wp_kses( ai4seo_get_icon_with_tooltip_tag( $ai4seo_metadata_placeholders_tooltip, '', 'circle-question', __( 'Placeholder help for Metadata Prefix / Suffix', 'ai-for-seo' ) ) ); echo ''; echo "
"; // Loop through all available metadata-details and display input-fields for each of them. foreach ( $ai4seo_metadata_field_descriptors as $ai4seo_this_metadata_identifier => $ai4seo_this_metadata_details ) { // Prefixes and suffixes apply only to metadata fields rendered in the document head. if ( in_array( $ai4seo_this_metadata_identifier, array( 'focus-keyphrase', 'keywords' ), true ) ) { continue; } $ai4seo_this_translated_setting_label = $ai4seo_this_metadata_details['name'] ?? $ai4seo_this_metadata_identifier; $ai4seo_this_metadata_prefix_setting_input_name = "{$ai4seo_metadata_prefix_setting_input_name}[{$ai4seo_this_metadata_identifier}]"; $ai4seo_this_metadata_suffix_setting_input_name = "{$ai4seo_metadata_suffix_setting_input_name}[{$ai4seo_this_metadata_identifier}]"; $ai4seo_this_metadata_prefix_setting_input_value = $ai4seo_metadata_prefix_setting_input_value[ $ai4seo_this_metadata_identifier ] ?? ''; $ai4seo_this_metadata_suffix_setting_input_value = $ai4seo_metadata_suffix_setting_input_value[ $ai4seo_this_metadata_identifier ] ?? ''; // Display translated headline for this setting. echo "
"; echo "
"; echo esc_html( $ai4seo_this_translated_setting_label ) . ':'; echo '
'; // Display input for prefix. /* translators: %s: Metadata or media attribute field name. */ echo ""; echo ' {' . esc_html__( 'TEXT', 'ai-for-seo' ) . '} '; // Display input for suffix. /* translators: %s: Metadata or media attribute field name. */ echo ""; echo '
'; } echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; // === AI4SEO_SETTING_APPLY_CHANGES_TO_THIRD_PARTY_SEO_PLUGIN ============================================= \\ $ai4seo_this_setting_name = AI4SEO_SETTING_APPLY_CHANGES_TO_THIRD_PARTY_SEO_PLUGINS; $ai4seo_sync_activated_third_party_seo_plugins = array(); $ai4seo_uses_workarounds_for_third_party_seo_plugins = false; $ai4seo_inbound_sync_third_party_seo_plugin_identifiers = array(); $ai4seo_sync_workaround_plugin_identifiers = array( AI4SEO_THIRD_PARTY_PLUGIN_SLIM_SEO, AI4SEO_THIRD_PARTY_PLUGIN_ALL_IN_ONE_SEO, AI4SEO_THIRD_PARTY_PLUGIN_SQUIRRLY_SEO, ); // Derive warning and reverse-sync presentation state from the active integration registry in one pass. foreach ( $ai4seo_active_third_party_seo_plugin_details as $ai4seo_active_third_party_seo_plugin_identifier => $ai4seo_active_third_party_seo_plugin_detail ) { if ( in_array( $ai4seo_active_third_party_seo_plugin_identifier, $ai4seo_sync_workaround_plugin_identifiers, true ) ) { $ai4seo_uses_workarounds_for_third_party_seo_plugins = true; } $ai4seo_supports_inbound_sync = ai4seo_does_third_party_seo_plugin_support_inbound_sync( $ai4seo_active_third_party_seo_plugin_detail ); if ( $ai4seo_supports_inbound_sync ) { $ai4seo_inbound_sync_third_party_seo_plugin_identifiers[] = $ai4seo_active_third_party_seo_plugin_identifier; } } $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_setting( $ai4seo_this_setting_name ); // Resolve reverse-sync names through the shared registry naming helper used by operation reporting. $ai4seo_inbound_sync_third_party_seo_plugin_names = ai4seo_get_third_party_seo_plugin_names( $ai4seo_inbound_sync_third_party_seo_plugin_identifiers ); // Mention active reverse-capable integrations only when the registry supplies at least one display name. if ( $ai4seo_inbound_sync_third_party_seo_plugin_names ) { $ai4seo_this_setting_description = sprintf( /* translators: %1$s: AI for SEO plugin name, %2$s: comma-separated third-party SEO plugin names. */ esc_html__( 'Sync %1$s changes to selected third-party SEO plugins. Saved changes in supported integrations (%2$s) also sync back to %1$s for the metadata selected below.', 'ai-for-seo' ), esc_html( AI4SEO_PLUGIN_NAME ), esc_html( implode( ', ', $ai4seo_inbound_sync_third_party_seo_plugin_names ) ) ); } else { // Keep the description accurate when no active integration currently supports reverse synchronization. $ai4seo_this_setting_description = sprintf( /* translators: %s: AI for SEO plugin name. */ esc_html__( 'Sync %s changes to selected third-party SEO plugins for the metadata selected below.', 'ai-for-seo' ), esc_html( AI4SEO_PLUGIN_NAME ) ); } if ( $ai4seo_uses_workarounds_for_third_party_seo_plugins ) { $ai4seo_this_setting_description .= '

'; $ai4seo_this_setting_description .= __( 'WARNING: May permanently change third-party plugin data. Backup recommended.', 'ai-for-seo' ); } // Divider. echo "
"; // Form element. echo "
"; echo ""; echo esc_html__( 'Synchronize Metadata:', 'ai-for-seo' ); echo ''; echo "
"; if ( $ai4seo_active_third_party_seo_plugin_details ) { // Define variable for the selected user-roles based on plugin-settings. $ai4seo_sync_activated_third_party_seo_plugins = ( $ai4seo_this_setting_input_value && is_array( $ai4seo_this_setting_input_value ) ? $ai4seo_this_setting_input_value : array() ); // Name the synchronization group when multiple provider choices need a select-all control. if ( count( $ai4seo_active_third_party_seo_plugin_details ) > 1 ) { ai4seo_echo_wp_kses( ai4seo_get_select_all_checkbox( $ai4seo_this_setting_input_name, 'auto', __( 'Synchronize Metadata:', 'ai-for-seo' ) ) ); echo "
"; } // Loop through all available user-roles and display checkboxes for each of them. foreach ( $ai4seo_active_third_party_seo_plugin_details as $ai4seo_this_third_party_seo_plugin_identifier => $ai4seo_this_third_party_seo_plugin_details ) { // Restore whether this integration is enabled in the saved synchronization setting. $ai4seo_is_this_checkbox_checked = in_array( $ai4seo_this_third_party_seo_plugin_identifier, $ai4seo_sync_activated_third_party_seo_plugins, true ); $ai4seo_this_checkbox_id = "{$ai4seo_this_setting_input_name}-{$ai4seo_this_third_party_seo_plugin_identifier}"; echo "'; } echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; } else { echo '' . esc_html__( 'No supported and active third-party SEO plugins found.', 'ai-for-seo' ) . ''; } echo '
'; echo '
'; // === AI4SEO_SETTING_SYNC_ONLY_THESE_METADATA ========================================================== \\ $ai4seo_this_setting_name = AI4SEO_SETTING_SYNC_ONLY_THESE_METADATA; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_setting( $ai4seo_this_setting_name ); $ai4seo_this_setting_description = __( 'Choose which metadata to sync with selected third-party SEO plugins.', 'ai-for-seo' ); echo '"; // Divider. echo "
"; // Display form elements. echo "
"; echo ""; echo esc_html__( 'Metadata to Sync with Third-Party Plugins:', 'ai-for-seo' ); echo ''; echo "
"; // Define variable for the selected user-roles based on plugin-settings. $ai4seo_this_checked_values = ( $ai4seo_this_setting_input_value && is_array( $ai4seo_this_setting_input_value ) ? $ai4seo_this_setting_input_value : array() ); // Distinguish synchronized fields from the provider-selection group above. ai4seo_echo_wp_kses( ai4seo_get_select_all_checkbox( $ai4seo_this_setting_input_name, 'auto', __( 'Metadata to Sync with Third-Party Plugins:', 'ai-for-seo' ) ) ); echo "
"; // Loop through all available user-roles and display checkboxes for each of them. foreach ( $ai4seo_metadata_field_descriptors as $ai4seo_this_metadata_identifier => $ai4seo_this_metadata_details ) { $ai4seo_this_translated_checkbox_label = $ai4seo_this_metadata_details['name'] ?? $ai4seo_this_metadata_identifier; $ai4seo_this_checkbox_id = "{$ai4seo_this_setting_input_name}-{$ai4seo_this_metadata_identifier}"; // Restore whether this metadata field is enabled for synchronization. $ai4seo_is_this_checkbox_checked = in_array( $ai4seo_this_metadata_identifier, $ai4seo_this_checked_values, true ); echo "'; } echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; echo '
'; // === AI4SEO_SETTING_INCLUDE_PRODUCT_PRICE_IN_METADATA ===================================== \\ if ( ai4seo_is_plugin_or_theme_active( AI4SEO_THIRD_PARTY_PLUGIN_WOOCOMMERCE ) ) { $ai4seo_this_setting_name = AI4SEO_SETTING_INCLUDE_PRODUCT_PRICE_IN_METADATA; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_setting( $ai4seo_this_setting_name ); $ai4seo_this_setting_options = ai4seo_get_setting_include_product_price_in_metadata_allowed_values(); if ( ! is_string( $ai4seo_this_setting_input_value ) || ! array_key_exists( $ai4seo_this_setting_input_value, $ai4seo_this_setting_options ) ) { $ai4seo_this_setting_input_value = AI4SEO_DEFAULT_SETTINGS[ $ai4seo_this_setting_name ] ?? 'never'; } // Divider. echo "
"; echo "
"; echo "'; echo "
"; echo "'; echo "

"; echo esc_html__( 'Choose how WooCommerce product prices should be handled in generated metadata: never include them, store a fixed price, or use a dynamic placeholder that updates at render time.', 'ai-for-seo' ); echo '

'; echo '
'; echo '
'; } // === AI4SEO_SETTING_OVERWRITE_EXISTING_META_TAGS ========================================================== \\ $ai4seo_this_setting_name = AI4SEO_SETTING_OVERWRITE_EXISTING_METADATA; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_setting( $ai4seo_this_setting_name ); $ai4seo_this_setting_description = __( 'Overwrite existing metadata when using SEO Autopilot. If disabled, only missing metadata will be generated.', 'ai-for-seo' ); $ai4seo_this_setting_description .= "

"; $ai4seo_this_setting_description .= __( 'Warning: Permanently overwrites existing metadata. Backup recommended before activating SEO Autopilot.', 'ai-for-seo' ); $ai4seo_this_setting_description .= '
'; // Divider. echo "
"; // Display form elements. echo "
"; echo ""; echo esc_html__( 'SEO Autopilot: Overwrite Existing Metadata:', 'ai-for-seo' ); echo ''; echo "
"; // Define variable for the selected user-roles based on plugin-settings. $ai4seo_this_checked_values = ( $ai4seo_this_setting_input_value && is_array( $ai4seo_this_setting_input_value ) ? $ai4seo_this_setting_input_value : array() ); // Distinguish overwrite permissions from the active-metadata selection above. ai4seo_echo_wp_kses( ai4seo_get_select_all_checkbox( $ai4seo_this_setting_input_name, 'auto', __( 'SEO Autopilot: Overwrite Existing Metadata:', 'ai-for-seo' ) ) ); echo "
"; // Loop through all available user-roles and display checkboxes for each of them. foreach ( $ai4seo_metadata_field_descriptors as $ai4seo_this_metadata_identifier => $ai4seo_this_metadata_details ) { $ai4seo_this_translated_checkbox_label = $ai4seo_this_metadata_details['name'] ?? $ai4seo_this_metadata_identifier; $ai4seo_this_checkbox_id = "{$ai4seo_this_setting_input_name}-{$ai4seo_this_metadata_identifier}"; // Restore whether SEO Autopilot may overwrite this metadata field. $ai4seo_is_this_checkbox_checked = in_array( $ai4seo_this_metadata_identifier, $ai4seo_this_checked_values, true ); echo "'; } echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; // === AI4SEO_SETTING_GENERATE_METADATA_FOR_FULLY_COVERED_ENTRIES ========================================================== \\ $ai4seo_this_setting_name = AI4SEO_SETTING_GENERATE_METADATA_FOR_FULLY_COVERED_ENTRIES; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_setting( $ai4seo_this_setting_name ); $ai4seo_this_setting_description = __( 'Generate metadata for entries that already have a complete set of metadata. Disable this option to generate metadata only for entries with at least one missing field.', 'ai-for-seo' ); $ai4seo_has_active_overwrite = ! empty( ai4seo_get_active_overwrite_existing_metadata() ); $ai4seo_overwrite_requirement_id = $ai4seo_this_setting_input_name . '-requirement'; // Divider. echo "
"; // Display form elements. echo "
"; echo "'; echo "
"; echo "'; echo "

'; echo esc_html__( 'Select at least one active field under Overwrite Existing Metadata to enable this option.', 'ai-for-seo' ); echo '

'; echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; // === AI4SEO_SETTING_FOCUS_KEYPHRASE_BEHAVIOR_ON_EXISTING_METADATA ============================ \\ echo "
"; $ai4seo_this_setting_name = AI4SEO_SETTING_FOCUS_KEYPHRASE_BEHAVIOR_ON_EXISTING_METADATA; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_setting( $ai4seo_this_setting_name ); if ( ! is_string( $ai4seo_this_setting_input_value ) || ! array_key_exists( $ai4seo_this_setting_input_value, $ai4seo_focus_keyphrase_behavior_options ) ) { $ai4seo_this_setting_input_value = AI4SEO_DEFAULT_SETTINGS[ $ai4seo_this_setting_name ]; } echo "
"; echo "'; echo "
"; echo "'; echo "

"; ai4seo_echo_wp_kses( __( 'Control how focus keyphrases are generated when a meta title and meta description already exist for an entry. This only affects SEO Autopilot (bulk generation).', 'ai-for-seo' ) ); echo '

'; echo "

"; ai4seo_echo_wp_kses( __( 'Attention: For "Regenerate metadata", make sure that Meta Title and Meta Description are checked in the "Overwrite Existing Metadata" setting.', 'ai-for-seo' ) ); echo '

'; echo '
'; echo '
'; // === AI4SEO_SETTING_META_TAG_OUTPUT_MODE ================================================================================= \\ $ai4seo_this_setting_name = AI4SEO_SETTING_META_TAG_OUTPUT_MODE; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_setting( $ai4seo_this_setting_name ); // Divider. echo "
"; echo "
"; echo "'; echo "
"; echo "'; echo "

"; // Disable 'AI for SEO' Meta Tags. ai4seo_echo_wp_kses( __( 'Disable: Disables all plugin meta tags. Only useful when completely syncing to other SEO plugins.', 'ai-for-seo' ) ); echo '

'; // Force 'AI for SEO' Meta Tags. ai4seo_echo_wp_kses( __( 'Force: Outputs plugin meta tags regardless of other plugins. May create duplicates.', 'ai-for-seo' ) ); echo '

'; // Replace Existing Meta Tags. ai4seo_echo_wp_kses( __( 'Replace (Recommended): Replaces existing meta tags, preventing duplicates and cleaning HTML header.', 'ai-for-seo' ) ); echo '

'; // Complement Existing Meta Tags. ai4seo_echo_wp_kses( __( 'Complement: Adds missing meta tags without overwriting existing ones.', 'ai-for-seo' ) ); echo '

'; echo '
'; echo '
'; echo '
'; // ___________________________________________________________________________________________ \\ // === MEDIA ATTRIBUTES ====================================================================== \\ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ \\ echo "
"; // Headline. echo "

"; ai4seo_echo_wp_kses( ai4seo_get_dashicon_tag( 'admin-media', 'ai4seo-menu-item-icon', true ) ); echo esc_html__( 'Media attributes', 'ai-for-seo' ) . " (" . esc_html__( 'for images', 'ai-for-seo' ) . ')'; echo '

'; // Generation eligibility is separate from viewing and editing existing media attributes. $ai4seo_file_types_input = ai4seo_get_prefixed_input_name( AI4SEO_SETTING_ENABLED_ATTACHMENT_FILE_TYPES ); $ai4seo_enabled_file_types = ai4seo_get_setting( AI4SEO_SETTING_ENABLED_ATTACHMENT_FILE_TYPES ); echo "
" . esc_html__( 'Enabled File Types:', 'ai-for-seo' ) . ''; echo "
"; ai4seo_echo_wp_kses( ai4seo_get_select_all_checkbox( $ai4seo_file_types_input, 'auto', __( 'Enabled File Types:', 'ai-for-seo' ) ) ); echo "
"; foreach ( AI4SEO_ATTACHMENT_FILE_TYPE_MIME_TYPES as $ai4seo_file_type => $ai4seo_file_mime ) { $ai4seo_file_type_id = $ai4seo_file_types_input . '-' . $ai4seo_file_type; echo "'; } echo "

" . esc_html__( 'Applies to manual generation, bulk actions and SEO Autopilot. Selecting none stops all media generation. Existing attributes remain editable. SVG supports already uploaded, static files up to 1 MiB.', 'ai-for-seo' ) . '

'; if ( ! ai4seo_robhub_api()->supports_svg_static_v1() ) { echo "

" . esc_html( ai4seo_get_svg_unavailability_message() ) . '

'; } echo '
'; // === AI4SEO_SETTING_ACTIVE_ATTACHMENT_ATTRIBUTES ========================================================== \\ $ai4seo_this_setting_name = AI4SEO_SETTING_ACTIVE_ATTACHMENT_ATTRIBUTES; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_setting( $ai4seo_this_setting_name ); $ai4seo_this_setting_description = esc_html__( 'Select which media attributes to include or exclude from plugin generation. Does not affect existing attributes.', 'ai-for-seo' ); // Divider // echo "
";. // Display form elements. echo "
"; echo ""; echo esc_html__( 'Active Media Attributes:', 'ai-for-seo' ); echo ''; echo "
"; // Define variable for the selected user-roles based on plugin-settings. $ai4seo_this_checked_values = ( $ai4seo_this_setting_input_value && is_array( $ai4seo_this_setting_input_value ) ? $ai4seo_this_setting_input_value : array() ); // Identify the media-attribute group when navigating select-all controls by accessible name. ai4seo_echo_wp_kses( ai4seo_get_select_all_checkbox( $ai4seo_this_setting_input_name, 'auto', __( 'Active Media Attributes:', 'ai-for-seo' ) ) ); echo "
"; // Loop through all available user-roles and display checkboxes for each of them. foreach ( $ai4seo_attachment_field_descriptors as $ai4seo_this_media_attribute_identifier => $ai4seo_this_media_attribute_details ) { $ai4seo_this_translated_checkbox_label = $ai4seo_this_media_attribute_details['name'] ?? $ai4seo_this_media_attribute_identifier; $ai4seo_this_checkbox_id = "{$ai4seo_this_setting_input_name}-{$ai4seo_this_media_attribute_identifier}"; // Restore whether this media attribute is enabled for generation. $ai4seo_is_this_checkbox_checked = in_array( $ai4seo_this_media_attribute_identifier, $ai4seo_this_checked_values, true ); echo "'; } echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; // === AI4SEO_SETTING_ENABLE_EXTERNAL_MEDIA_GENERATE_BUTTONS ======================================= \\ $ai4seo_this_setting_name = AI4SEO_SETTING_ENABLE_EXTERNAL_MEDIA_GENERATE_BUTTONS; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = (bool) ai4seo_get_setting( $ai4seo_this_setting_name ); $ai4seo_this_setting_description = esc_html__( 'Show "Generate with SOOZ" buttons in WordPress media editing screens outside the plugin, including the Media Library, media upload sidebar, attachment edit screen, and Gutenberg image sidebar.', 'ai-for-seo' ); // Build logo-aware labels manually because the visible copy includes the sanitized SOOZ SVG. $ai4seo_sooz_logo_tag = ai4seo_get_svg_tag( 'sooz', 'SOOZ', 'ai4seo-sooz-logo' ); /* translators: %s: SOOZ logo */ $ai4seo_generate_with_sooz_buttons_label = sprintf( esc_html__( '"Generate with %s" buttons', 'ai-for-seo' ), $ai4seo_sooz_logo_tag ); /* translators: %s: SOOZ logo */ $ai4seo_generate_with_sooz_buttons_toggle_label = sprintf( esc_html__( 'Show additional "Generate with %s" buttons in external editors', 'ai-for-seo' ), $ai4seo_sooz_logo_tag ); echo "
"; echo "
"; echo "'; echo "
"; echo "'; echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; // === AI4SEO_SETTING_ATTACHMENT_ATTRIBUTES_CUSTOM_INSTRUCTIONS ============================ \\ $ai4seo_this_setting_name = AI4SEO_SETTING_ATTACHMENT_ATTRIBUTES_CUSTOM_INSTRUCTIONS; $ai4seo_this_setting_description = esc_html__( 'These instructions are added to every media attribute generation prompt.', 'ai-for-seo' ); echo "
"; // Render the setting through the shared wrapper so save-anything names and counters stay aligned. ai4seo_echo_wp_kses( ai4seo_get_custom_instructions_setting_form_item_tag( $ai4seo_this_setting_name, esc_html__( 'Media Attribute Custom Instructions', 'ai-for-seo' ) . ':', $ai4seo_this_setting_description, esc_html__( 'Media Attribute Custom Instructions', 'ai-for-seo' ), '', '', 'media-attributes' ) ); // === MEDIA ATTRIBUTE PROMPT SLIDER SETTINGS ============================================ \\ // Keep media prompt-control ordering explicit while sharing the same slider form-item renderer. $ai4seo_attachment_attributes_prompt_slider_settings = array( array( 'setting_name' => AI4SEO_SETTING_ATTACHMENT_ATTRIBUTES_TONE_VARIANT, 'label' => esc_html__( 'Media Attribute Tone Variant:', 'ai-for-seo' ), ), array( 'setting_name' => AI4SEO_SETTING_ATTACHMENT_ATTRIBUTES_SURROUNDING_CONTEXT_INFLUENCE, 'label' => esc_html__( 'Surrounding / Page Context Influence:', 'ai-for-seo' ), ), array( 'setting_name' => AI4SEO_SETTING_ATTACHMENT_ATTRIBUTES_FILE_NAME_INFLUENCE, 'label' => esc_html__( 'File Name Influence:', 'ai-for-seo' ), ), array( 'setting_name' => AI4SEO_SETTING_ATTACHMENT_ATTRIBUTES_SEO_KEYWORD_INTENSITY, 'label' => esc_html__( 'SEO Keyword Intensity:', 'ai-for-seo' ), 'is_advanced_setting' => true, ), array( 'setting_name' => AI4SEO_SETTING_ATTACHMENT_ATTRIBUTES_RECOGNIZABLE_ENTITY_INCLUSION, 'label' => esc_html__( 'Include Recognizable Names:', 'ai-for-seo' ), 'is_advanced_setting' => true, ), array( 'setting_name' => AI4SEO_SETTING_ATTACHMENT_ATTRIBUTES_WEBSITE_BRAND_CONTEXT_INFLUENCE, 'label' => esc_html__( 'Website / Brand Context Influence:', 'ai-for-seo' ), 'is_advanced_setting' => true, ), array( 'setting_name' => AI4SEO_SETTING_ATTACHMENT_ATTRIBUTES_EXISTING_VALUES_REFERENCE_STRENGTH, 'label' => esc_html__( 'Existing Values Reference Strength:', 'ai-for-seo' ), ), ); foreach ( $ai4seo_attachment_attributes_prompt_slider_settings as $ai4seo_this_prompt_slider_setting ) { // Render each saved slider through the reusable radio-group helper so save-anything stays unchanged. ai4seo_echo_wp_kses( ai4seo_get_prompt_slider_setting_form_item_tag( $ai4seo_this_prompt_slider_setting['setting_name'], $ai4seo_this_prompt_slider_setting['label'], ! empty( $ai4seo_this_prompt_slider_setting['is_advanced_setting'] ), esc_html__( 'Media Attributes', 'ai-for-seo' ) ) ); } // === ALT TEXT GENERATION LENGTH SETTING ================================================= \\ ai4seo_echo_wp_kses( ai4seo_get_prompt_slider_setting_form_item_tag( AI4SEO_SETTING_ATTACHMENT_ATTRIBUTES_ALT_TEXT_GENERATION_LENGTH, esc_html__( 'Alt Text Generation Length:', 'ai-for-seo' ), true, esc_html__( 'Media Attributes', 'ai-for-seo' ) ) ); // === AI4SEO_SETTING_DISABLED_ATTACHMENT_POST_AUTHORS =============================================== \\ $ai4seo_this_setting_name = AI4SEO_SETTING_DISABLED_ATTACHMENT_POST_AUTHORS; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_disabled_attachment_post_author_ids = ai4seo_get_disabled_attachment_post_author_ids(); $ai4seo_available_attachment_post_authors = ai4seo_get_available_attachment_post_authors(); $ai4seo_available_attachment_post_author_ids = array_map( 'intval', array_keys( $ai4seo_available_attachment_post_authors ) ); $ai4seo_active_attachment_post_author_ids = array_values( array_diff( $ai4seo_available_attachment_post_author_ids, $ai4seo_disabled_attachment_post_author_ids ) ); $ai4seo_this_setting_description = esc_html__( 'Uncheck any author whose media files you want to exclude from the dashboard and the SEO Autopilot. Newly detected authors stay active by default.', 'ai-for-seo' ); echo "
"; echo "
"; echo ""; echo esc_html__( 'Active Media Authors:', 'ai-for-seo' ); echo ''; echo "
"; if ( $ai4seo_available_attachment_post_authors ) { // Distinguish media authors from the separate metadata-author selection above. ai4seo_echo_wp_kses( ai4seo_get_select_all_checkbox( $ai4seo_this_setting_input_name, 'auto', __( 'Active Media Authors:', 'ai-for-seo' ) ) ); echo "
"; foreach ( $ai4seo_available_attachment_post_authors as $ai4seo_this_post_author_id => $ai4seo_this_post_author_label ) { $ai4seo_this_checkbox_id = "{$ai4seo_this_setting_input_name}-{$ai4seo_this_post_author_id}"; $ai4seo_is_checkbox_checked = in_array( (int) $ai4seo_this_post_author_id, $ai4seo_active_attachment_post_author_ids, true ); echo "'; } } else { echo "

"; echo esc_html__( 'No authors with supported media files detected.', 'ai-for-seo' ); echo '

'; } echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; // === AI4SEO_SETTING_DISABLED_ATTACHMENT_ATTRIBUTES_WPML_LANGUAGES =========================== \\ if ( ai4seo_is_plugin_or_theme_active( AI4SEO_THIRD_PARTY_PLUGIN_WPML ) ) { $ai4seo_this_setting_name = AI4SEO_SETTING_DISABLED_ATTACHMENT_ATTRIBUTES_WPML_LANGUAGES; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_disabled_attachment_attributes_wpml_language_codes = ai4seo_get_disabled_attachment_attributes_wpml_language_codes(); $ai4seo_available_wpml_languages = ai4seo_get_available_wpml_languages(); $ai4seo_available_wpml_language_codes = array_keys( $ai4seo_available_wpml_languages ); $ai4seo_active_attachment_attributes_wpml_language_codes = array_values( array_diff( $ai4seo_available_wpml_language_codes, $ai4seo_disabled_attachment_attributes_wpml_language_codes ) ); $ai4seo_this_setting_description = esc_html__( 'Uncheck any WPML language if you do not want media entries WPML assigns to that language to be included in the dashboard and the SEO Autopilot. Newly detected WPML languages stay active by default.', 'ai-for-seo' ); echo "
"; echo "
"; echo ""; ai4seo_echo_wp_kses( ai4seo_get_svg_tag( 'wpml', 'WPML', 'ai4seo-medium-icon' ) ); echo ' '; echo esc_html__( 'Active Languages:', 'ai-for-seo' ); echo ''; echo "
"; if ( $ai4seo_available_wpml_languages ) { // Distinguish media languages from the separate metadata-language selection above. ai4seo_echo_wp_kses( ai4seo_get_select_all_checkbox( $ai4seo_this_setting_input_name, 'auto', __( 'Active Media Languages (WPML):', 'ai-for-seo' ) ) ); echo "
"; // WPML language checkboxes submit active languages; save normalization stores only unchecked codes. foreach ( $ai4seo_available_wpml_languages as $ai4seo_this_wpml_language_code => $ai4seo_this_wpml_language_label ) { $ai4seo_this_checkbox_id = "{$ai4seo_this_setting_input_name}-{$ai4seo_this_wpml_language_code}"; $ai4seo_is_checkbox_checked = in_array( $ai4seo_this_wpml_language_code, $ai4seo_active_attachment_attributes_wpml_language_codes, true ); echo "'; } } else { echo "

"; echo esc_html__( 'No WPML languages detected.', 'ai-for-seo' ); echo '

'; } echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; } // === AI4SEO_SETTING_ATTACHMENT_ATTRIBUTES_GENERATION_LANGUAGE ============================== \\ $ai4seo_this_setting_name = AI4SEO_SETTING_ATTACHMENT_ATTRIBUTES_GENERATION_LANGUAGE; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_setting( $ai4seo_this_setting_name ); if ( ai4seo_is_plugin_or_theme_active( AI4SEO_THIRD_PARTY_PLUGIN_WPML ) ) { $ai4seo_this_setting_description = sprintf( /* translators: %s: WordPress language */ esc_html__( 'WPML detected. Use "Automatic" to detect the language from the image usage context. If the context is unavailable or unclear, it falls back to the WPML language first and then the system language (%s).', 'ai-for-seo' ), '' . $ai4seo_wordpress_language . '', ); } else { $ai4seo_this_setting_description = sprintf( /* translators: %s: WordPress language */ esc_html__( 'Select a specific language, or choose "- Automatic -" to let the plugin detect the language from the context where the image is used. If the context is unavailable or unclear, it will fall back to the system language (%s).', 'ai-for-seo' ), '' . $ai4seo_wordpress_language . '', ); } // Divider. echo "
"; // Form element. echo "
"; echo "'; echo "
"; echo "'; echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; // === AI4SEO_SETTING_ATTACHMENT_ATTRIBUTES_PREFIXES & AI4SEO_SETTING_ATTACHMENT_ATTRIBUTES_SUFFIXES =================== \\ $ai4seo_attachment_attributes_prefix_setting_name = AI4SEO_SETTING_ATTACHMENT_ATTRIBUTES_PREFIXES; $ai4seo_attachment_attributes_suffix_setting_name = AI4SEO_SETTING_ATTACHMENT_ATTRIBUTES_SUFFIXES; // Prefix. $ai4seo_attachment_attributes_prefix_setting_input_name = "ai4seo_{$ai4seo_attachment_attributes_prefix_setting_name}"; $ai4seo_attachment_attributes_prefix_setting_input_value = ai4seo_get_setting( $ai4seo_attachment_attributes_prefix_setting_name ); // Suffix. $ai4seo_attachment_attributes_suffix_setting_input_name = "ai4seo_{$ai4seo_attachment_attributes_suffix_setting_name}"; $ai4seo_attachment_attributes_suffix_setting_input_value = ai4seo_get_setting( $ai4seo_attachment_attributes_suffix_setting_name ); // Description for both prefix and suffix. $ai4seo_this_setting_description = esc_html__( 'Add prefix and suffix text to media attributes for consistent branding. Note: Only applied to newly generated attributes, not existing ones.', 'ai-for-seo' ); $ai4seo_attachment_placeholders_tooltip = __( 'Available placeholders (case-insensitive):
{WEBSITE_URL} - Site URL.
{WEBSITE_NAME} - Site name.
{FILE_NAME} - File name without extension.
{FILE_TYPE} - File extension.
{FILE_SIZE} - File size in kilobytes.
{IMAGE_DIMENSIONS} - Image width x height.

Placeholders are replaced when attributes are saved or injected into the frontend.', 'ai-for-seo' ); // Divider. echo "
"; // Display form elements. echo "
"; echo ""; echo esc_html__( 'Prefix / Suffix:', 'ai-for-seo' ); ai4seo_echo_wp_kses( ai4seo_get_icon_with_tooltip_tag( $ai4seo_attachment_placeholders_tooltip, '', 'circle-question', __( 'Placeholder help for Media Attributes Prefix / Suffix', 'ai-for-seo' ) ) ); echo ''; echo "
"; // Loop through all available attachment-attributes-details and display input-fields for each of them. foreach ( $ai4seo_attachment_field_descriptors as $ai4seo_this_attachment_attributes_identifier => $ai4seo_this_attachment_attributes_details ) { $ai4seo_this_translated_setting_label = $ai4seo_this_attachment_attributes_details['name'] ?? $ai4seo_this_attachment_attributes_identifier; $ai4seo_this_attachment_attributes_prefix_setting_input_name = "{$ai4seo_attachment_attributes_prefix_setting_input_name}[{$ai4seo_this_attachment_attributes_identifier}]"; $ai4seo_this_attachment_attributes_suffix_setting_input_name = "{$ai4seo_attachment_attributes_suffix_setting_input_name}[{$ai4seo_this_attachment_attributes_identifier}]"; $ai4seo_this_attachment_attributes_prefix_setting_input_value = $ai4seo_attachment_attributes_prefix_setting_input_value[ $ai4seo_this_attachment_attributes_identifier ] ?? ''; $ai4seo_this_attachment_attributes_suffix_setting_input_value = $ai4seo_attachment_attributes_suffix_setting_input_value[ $ai4seo_this_attachment_attributes_identifier ] ?? ''; // Display translated headline for this setting. echo "
"; echo "
"; echo esc_html( $ai4seo_this_translated_setting_label ) . ':'; echo '
'; // Display input for prefix. /* translators: %s: Metadata or media attribute field name. */ echo ""; echo ' {' . esc_html__( 'TEXT', 'ai-for-seo' ) . '} '; // Display input for suffix. /* translators: %s: Metadata or media attribute field name. */ echo ""; echo '
'; } echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; // === AI4SEO_SETTING_ENABLE_ENHANCED_CELEBRITY_RECOGNITION ======================================================== \\ echo "
"; $ai4seo_this_setting_name = AI4SEO_SETTING_ENABLE_ENHANCED_CELEBRITY_RECOGNITION; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = (bool) ai4seo_get_setting( $ai4seo_this_setting_name ); $ai4seo_this_setting_description = esc_html__( 'Helps identify public figures in images using enhanced recognition. Recognition is not guaranteed; review generated names before publishing.', 'ai-for-seo' ); $ai4seo_premium_plan_html = ''; $ai4seo_upgrade_to_premium_html = ''; // Paid users keep the compact badge, while lower tiers see the shared direct-pricing upgrade prompt. if ( ! $ai4seo_user_has_premium_plan_or_higher ) { $ai4seo_upgrade_to_premium_html = ai4seo_get_subscription_upgrade_prompt_tag( 'l', 'use_this_feature', 'ai4seo-setting-upgrade-prompt' ); } else { $ai4seo_premium_plan_html = ai4seo_get_plan_badge( 'l' ); } echo "
"; echo "'; echo "
"; // Keep active Premium accounts visually compact and use the upgrade prompt only when the setting is disabled. if ( $ai4seo_user_has_premium_plan_or_higher ) { echo ' '; ai4seo_echo_wp_kses( $ai4seo_premium_plan_html ); } else { ai4seo_echo_wp_kses( $ai4seo_upgrade_to_premium_html ); } echo '
'; echo "'; echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; // === AI4SEO_SETTING_OVERWRITE_EXISTING_ATTACHMENT_ATTRIBUTES ========================================================== \\ $ai4seo_this_setting_name = AI4SEO_SETTING_OVERWRITE_EXISTING_ATTACHMENT_ATTRIBUTES; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_setting( $ai4seo_this_setting_name ); $ai4seo_this_setting_description = __( 'Overwrite existing media attributes when using SEO Autopilot. If disabled, only missing attributes will be generated.', 'ai-for-seo' ); $ai4seo_this_setting_description .= "

"; $ai4seo_this_setting_description .= __( 'Warning: Permanently overwrites existing media attributes. Backup recommended before activating SEO Autopilot.', 'ai-for-seo' ); $ai4seo_this_setting_description .= '
'; // Divider. echo "
"; // Display form elements. echo "
"; echo ""; echo esc_html__( 'SEO Autopilot: Overwrite Existing Media Attributes:', 'ai-for-seo' ); echo ''; echo "
"; // Define variable for the selected user-roles based on plugin-settings. $ai4seo_this_checked_values = ( $ai4seo_this_setting_input_value && is_array( $ai4seo_this_setting_input_value ) ? $ai4seo_this_setting_input_value : array() ); // Distinguish overwrite permissions from the active-media-attribute selection above. ai4seo_echo_wp_kses( ai4seo_get_select_all_checkbox( $ai4seo_this_setting_input_name, 'auto', __( 'SEO Autopilot: Overwrite Existing Media Attributes:', 'ai-for-seo' ) ) ); echo "
"; // Loop through all available user-roles and display checkboxes for each of them. foreach ( $ai4seo_attachment_field_descriptors as $ai4seo_attachment_attribute_name => $ai4seo_attachment_attribute_details ) { $ai4seo_this_translated_checkbox_label = $ai4seo_attachment_attribute_details['name'] ?? $ai4seo_attachment_attribute_name; $ai4seo_this_checkbox_id = "{$ai4seo_this_setting_input_name}-{$ai4seo_attachment_attribute_name}"; // Restore whether SEO Autopilot may overwrite this media attribute. $ai4seo_is_this_checkbox_checked = in_array( $ai4seo_attachment_attribute_name, $ai4seo_this_checked_values, true ); echo "'; } echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; // === AI4SEO_SETTING_GENERATE_ATTACHMENT_ATTRIBUTES_FOR_FULLY_COVERED_ENTRIES =========================================== \\ $ai4seo_this_setting_name = AI4SEO_SETTING_GENERATE_ATTACHMENT_ATTRIBUTES_FOR_FULLY_COVERED_ENTRIES; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_setting( $ai4seo_this_setting_name ); $ai4seo_this_setting_description = __( 'Generate media attributes for entries that already have a complete set of attributes. Disable this option to generate media attributes only for entries with missing attributes.', 'ai-for-seo' ); $ai4seo_has_active_overwrite = ! empty( ai4seo_get_active_overwrite_existing_attachment_attributes() ); $ai4seo_overwrite_requirement_id = $ai4seo_this_setting_input_name . '-requirement'; // Divider. echo "
"; // Display form elements. echo "
"; echo "'; echo "
"; echo "'; echo "

'; echo esc_html__( 'Select at least one active attribute under Overwrite Existing Media Attributes to enable this option.', 'ai-for-seo' ); echo '

'; echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; echo '
'; // ___________________________________________________________________________________________ \\ // === USER MANAGEMENT ======================================================================= \\ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ \\ echo "
"; // Headline. echo "

"; ai4seo_echo_wp_kses( ai4seo_get_dashicon_tag( 'admin-users', 'ai4seo-menu-item-icon', true ) ); echo esc_html__( 'User Management', 'ai-for-seo' ); echo '

'; // === ALLOWED USER ROLES =========================================================================== \\ $ai4seo_this_setting_name = AI4SEO_SETTING_ALLOWED_USER_ROLES; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_setting( $ai4seo_this_setting_name ); $ai4seo_this_setting_description = esc_html__( "Select user roles that should have access to this plugin. Only roles with 'edit_posts' capability are listed.", 'ai-for-seo' ); // Display form elements. echo "
"; echo ""; echo esc_html__( 'Allowed User Roles:', 'ai-for-seo' ); echo ''; echo "
"; // Define variable for the selected user-roles based on plugin-settings. $ai4seo_this_checked_values = ( $ai4seo_this_setting_input_value && is_array( $ai4seo_this_setting_input_value ) ? $ai4seo_this_setting_input_value : array() ); // Identify the permissions group when navigating select-all controls by accessible name. ai4seo_echo_wp_kses( ai4seo_get_select_all_checkbox( $ai4seo_this_setting_input_name, 'auto', __( 'Allowed User Roles:', 'ai-for-seo' ) ) ); echo "
"; // Loop through all available user-roles and display checkboxes for each of them. foreach ( $ai4seo_allowed_user_roles as $ai4seo_this_user_role_identifier => $ai4seo_this_user_role ) { // Keep numeric-only WordPress role keys aligned with their string form and JSON setting values. $ai4seo_this_user_role_identifier = (string) $ai4seo_this_user_role_identifier; $ai4seo_this_translated_checkbox_label = translate_user_role( $ai4seo_this_user_role ); if ( $ai4seo_this_translated_checkbox_label ) { $ai4seo_this_user_role = $ai4seo_this_translated_checkbox_label; } $ai4seo_this_checkbox_id = "{$ai4seo_this_setting_input_name}-{$ai4seo_this_user_role_identifier}"; // Keep administrators enabled while restoring every other saved role selection. $ai4seo_is_this_checkbox_checked = ( in_array( $ai4seo_this_user_role_identifier, $ai4seo_this_checked_values, true ) || 'administrator' === $ai4seo_this_user_role_identifier ); echo "'; } echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; echo '
'; // ___________________________________________________________________________________________ \\ // === TROUBLESHOOTING ========================================================================== \\ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ \\ echo "
"; // Headline. echo "

"; ai4seo_echo_wp_kses( ai4seo_get_dashicon_tag( 'sos', 'ai4seo-menu-item-icon', true ) ); echo esc_html__( 'Troubleshooting & Experimental', 'ai-for-seo' ); echo '

'; // === BULK GENERATION DURATION ================================================================================= \\ $ai4seo_this_setting_name = AI4SEO_SETTING_BULK_GENERATION_DURATION; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_setting( $ai4seo_this_setting_name ); $ai4seo_this_setting_description = ''; if ( ai4seo_is_wordpress_cron_disabled() ) { $ai4seo_this_setting_description = __( 'Set duration to match your cron job frequency. Best performance: server cron every minute with 1-minute duration.', 'ai-for-seo' ); } else { $ai4seo_this_setting_description = '' . __( 'Attention:', 'ai-for-seo' ) . ' '; $ai4seo_this_setting_description .= __( 'WordPress cron is enabled, which may limit SEO Autopilot efficiency. Recommend setting up server cron (every minute) or gradually increase duration.', 'ai-for-seo' ); } $ai4seo_this_setting_description .= '

'; $ai4seo_this_setting_description .= __( 'Reduce duration if server experiences performance issues during bulk generation.', 'ai-for-seo' ); echo "
"; echo "'; echo "
"; // Bulk generation duration select field, containing 10, 20, 30, 40, 50, 60, 120, 180, 240 and 300. echo "'; echo "
"; echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; // Divider. echo "
"; // === AI4SEO_SETTING_ENABLE_FRONTEND_CACHE_PURGE ===================================================== \\ $ai4seo_this_setting_name = AI4SEO_SETTING_ENABLE_FRONTEND_CACHE_PURGE; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_setting( $ai4seo_this_setting_name ); $ai4seo_this_setting_description = __( 'Trigger a best-effort frontend cache purge (LiteSpeed, WP Rocket, W3 Total Cache, WP Super Cache, SiteGround Optimizer, Cache Enabler) after metadata updates.', 'ai-for-seo' ); $ai4seo_this_setting_description .= '

' . __( 'Keep disabled unless you need automatic cache purging for your setup. Default remains off for safer debugging.', 'ai-for-seo' ); echo "
"; echo "'; echo "
"; echo "'; echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; // Divider. echo "
"; // === AI4SEO_SETTING_DEEP_CONTEXT_SEARCH_FOR_IMAGES ===================================================== \\ $ai4seo_this_setting_name = AI4SEO_SETTING_DEEP_CONTEXT_SEARCH_FOR_IMAGES; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_setting( $ai4seo_this_setting_name ); $ai4seo_deep_context_search_site_support_status = ai4seo_get_deep_context_search_site_support_status(); $ai4seo_is_deep_context_search_supported = (bool) ( $ai4seo_deep_context_search_site_support_status['is_supported'] ?? false ); $ai4seo_deep_context_search_blocking_reasons = isset( $ai4seo_deep_context_search_site_support_status['blocking_reasons'] ) && is_array( $ai4seo_deep_context_search_site_support_status['blocking_reasons'] ) ? $ai4seo_deep_context_search_site_support_status['blocking_reasons'] : array(); $ai4seo_are_deep_context_search_counts_unavailable = in_array( 'posts_count_unavailable', $ai4seo_deep_context_search_blocking_reasons, true ) || in_array( 'postmeta_count_unavailable', $ai4seo_deep_context_search_blocking_reasons, true ); if ( ! $ai4seo_is_deep_context_search_supported ) { ai4seo_maybe_disable_deep_context_search_for_large_site(); $ai4seo_this_setting_input_value = false; } $ai4seo_this_setting_description = ''; if ( ! $ai4seo_is_deep_context_search_supported ) { $ai4seo_this_setting_description .= '' . esc_html__( 'Note:', 'ai-for-seo' ) . ' '; if ( $ai4seo_are_deep_context_search_counts_unavailable ) { $ai4seo_this_setting_description .= esc_html__( 'We could not verify the current database size, so this function is unavailable for safety.', 'ai-for-seo' ); } else { $ai4seo_this_setting_description .= sprintf( /* translators: 1: posts table entry limit, 2: postmeta table entry limit. */ esc_html__( 'We currently do not support this function for large websites. It is unavailable when the posts table has at least %1$s entries or the postmeta table has at least %2$s entries.', 'ai-for-seo' ), esc_html( ai4seo_format_number_i18n( AI4SEO_LARGE_SITE_POSTS_THRESHOLD ) ), esc_html( ai4seo_format_number_i18n( AI4SEO_DEEP_CONTEXT_SEARCH_POSTMETA_THRESHOLD ) ) ); } $ai4seo_this_setting_description .= '

'; } $ai4seo_this_setting_description .= esc_html__( 'Enable this option to allow deeper database searches to determine the usage context of images. This can improve the relevance of generated image metadata, especially when context is missing.', 'ai-for-seo' ); $ai4seo_this_setting_description .= '

' . esc_html__( 'On large websites, these extended searches may increase database load during generation. Use this setting if many images lack context and you are comfortable with potential performance impact while content is being processed.', 'ai-for-seo' ); echo "
"; echo "'; echo "
"; echo "'; echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; // === AI4SEO_SETTING_ENABLE_RENDER_LEVEL_ALT_TEXT_INJECTION ========================================================== \\ $ai4seo_this_setting_name = AI4SEO_SETTING_ENABLE_RENDER_LEVEL_ALT_TEXT_INJECTION; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_setting( $ai4seo_this_setting_name ); $ai4seo_this_setting_description = __( 'Inject alt text at render time and dynamically via JavaScript so images always include the correct alt text, even when themes or page builders omit it.', 'ai-for-seo' ); $ai4seo_this_setting_description .= '

' . __( 'Enable this setting if your theme or page builder does not display alt text generated by the plugin (or omits alt text entirely).', 'ai-for-seo' ); // Divider. echo "
"; // Display form elements. echo "
"; echo "'; echo "
"; echo "'; echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; $ai4seo_alt_injection_enabled = (bool) $ai4seo_this_setting_input_value; // === AI4SEO_SETTING_ENABLE_JS_ALT_TEXT_INJECTION ===================================================== \\ $ai4seo_this_setting_name = AI4SEO_SETTING_ENABLE_JS_ALT_TEXT_INJECTION; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_setting( $ai4seo_this_setting_name ); $ai4seo_this_setting_description = __( 'Load a JavaScript fallback that injects alt text on the frontend after the page loads. Disable if another script handles this or if only server-side injection should be used. Attention: Can cause slower page loads on some setups.', 'ai-for-seo' ); $ai4seo_potential_js_alt_text_setting_hidden_class = $ai4seo_alt_injection_enabled ? '' : ' ai4seo-js-alt-text-setting-hidden'; echo "
"; echo "'; echo "
"; echo "'; echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; // === AI4SEO_SETTING_ENABLE_RENDER_LEVEL_IMAGE_TITLE_INJECTION ============================================= \\ $ai4seo_this_setting_name = AI4SEO_SETTING_IMAGE_TITLE_INJECTION_MODE; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_setting( $ai4seo_this_setting_name ); $ai4seo_this_setting_description = __( 'Choose what to inject as the title attribute of image elements. Provides hover information for images.', 'ai-for-seo' ); // Divider. echo "
"; // Display form elements. echo "
"; echo "'; echo "
"; $ai4seo_title_injection_options = ai4seo_get_setting_render_level_title_injection_allowed_values(); echo "'; echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; // === AI4SEO_SETTING_QUERY_IDS_CHUNK_SIZE ===================================================== \ $ai4seo_this_setting_name = AI4SEO_SETTING_QUERY_IDS_CHUNK_SIZE; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = (int) ai4seo_get_setting( $ai4seo_this_setting_name ); $ai4seo_this_setting_description = __( 'Controls how many IDs are grouped per database query when processing large batches.', 'ai-for-seo' ); $ai4seo_this_setting_description .= '

' . __( 'Depending on your MySQL configuration, lowering this value can help resolve query or packet size issues. Higher values can improve performance when your MySQL limits allow larger queries.', 'ai-for-seo' ); // Divider. echo "
"; echo "
"; echo "'; echo "
"; $ai4seo_query_ids_chunk_size_options = ai4seo_get_query_ids_chunk_size_options(); if ( ! isset( $ai4seo_query_ids_chunk_size_options[ $ai4seo_this_setting_input_value ] ) ) { $ai4seo_this_setting_input_value = (int) AI4SEO_DEFAULT_SETTINGS[ AI4SEO_SETTING_QUERY_IDS_CHUNK_SIZE ]; } echo "'; echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; // === AI4SEO_SETTING_IMAGE_UPLOAD_METHOD ============================== \\ $ai4seo_this_setting_name = AI4SEO_SETTING_IMAGE_UPLOAD_METHOD; $ai4seo_this_setting_input_name = ai4seo_get_prefixed_input_name( $ai4seo_this_setting_name ); $ai4seo_this_setting_input_value = ai4seo_get_setting( $ai4seo_this_setting_name ); $ai4seo_this_setting_description = __( 'Choose how images are sent to our server: Auto (recommended): Selects method based on accessibility. URL: Always sends image URL. Data: Always sends full image data.', 'ai-for-seo' ); $ai4seo_this_setting_description .= '

'; // Explain why generation can change Auto to Data while preserving an explicit URL preference. $ai4seo_this_setting_description .= __( 'Auto switches to Data after three consecutive URL requests fail and each retry with image data succeeds. You can change the method again at any time. A manually selected URL method stays unchanged.', 'ai-for-seo' ); $ai4seo_this_setting_description .= '

'; // Keep the manual recovery advice alongside the automatic transport explanation. $ai4seo_this_setting_description .= __( "Try 'Data' if you experience generation issues. Slower but more reliable in some situations.", 'ai-for-seo' ); // Divider. echo "
"; // Display form elements. echo "
"; echo "'; echo "
"; $ai4seo_image_upload_method_options = array( 'auto' => __( 'Auto (default & recommended)', 'ai-for-seo' ), 'url' => __( 'URL', 'ai-for-seo' ), 'base64' => __( 'Data', 'ai-for-seo' ), ); echo "'; echo "

"; ai4seo_echo_wp_kses( $ai4seo_this_setting_description ); echo '

'; echo '
'; echo '
'; echo '
'; // Submit button. echo "
"; echo "
"; ai4seo_echo_wp_kses( ai4seo_get_submit_button_tag( esc_html__( 'Save changes', 'ai-for-seo' ), 'ai4seo-start-inactive ai4seo-big-button ai4seo-save-settings-button', 'ai4seo_save_anything(jQuery(this), ai4seo_validate_settings_inputs);' ) ); echo '
'; echo '
'; echo '';