esc_url_raw( rest_url( 'aiss/v1/' ) ), 'restNonce' => wp_create_nonce( 'wp_rest' ), 'adminNonce' => wp_create_nonce( 'aiss_admin_nonce' ), 'nonce' => wp_create_nonce( 'aiss_admin_nonce' ), 'ajaxUrl' => admin_url( 'admin-ajax.php' ), 'adminUrl' => admin_url(), 'siteName' => get_bloginfo( 'name' ), 'vigiaActive' => is_plugin_active( 'vigia/vigia.php' ) ? '1' : '0', 'strings' => array( 'loading' => __( 'Loading...', 'ai-share-summarize' ), 'noData' => __( 'No data yet.', 'ai-share-summarize' ), 'loadMore' => __( 'Load more', 'ai-share-summarize' ), /* translators: %1$s = current count, %2$s = total count */ 'showingOf' => __( 'Showing %1$s of %2$s', 'ai-share-summarize' ), 'clicks' => __( 'Clicks', 'ai-share-summarize' ), 'aiCrawls' => __( 'AI Crawls', 'ai-share-summarize' ), 'edit' => __( 'Edit', 'ai-share-summarize' ), 'allTime' => __( 'All time', 'ai-share-summarize' ), 'today' => __( 'Today', 'ai-share-summarize' ), /* translators: %d = number of days */ 'lastDays' => __( 'Last %d days', 'ai-share-summarize' ), 'confirmDeleteAll' => __( 'Are you sure you want to delete ALL analytics data? This action cannot be undone.', 'ai-share-summarize' ), 'deleting' => __( 'Deleting...', 'ai-share-summarize' ), 'deleteSuccess' => __( 'All analytics data has been deleted.', 'ai-share-summarize' ), 'deleteError' => __( 'Error deleting data. Please try again.', 'ai-share-summarize' ), /* Translatable type labels for platforms table (v1.7.0) */ 'typeAI' => __( 'AI', 'ai-share-summarize' ), 'typeSocial' => __( 'Social', 'ai-share-summarize' ), /* Comparison and export strings (v1.7.0) */ 'previousPeriod' => __( 'Previous period', 'ai-share-summarize' ), 'currentPeriod' => __( 'Current period', 'ai-share-summarize' ), 'exportError' => __( 'Export failed. Please try again.', 'ai-share-summarize' ), /* translators: %1$s = range start, %2$s = range end, %3$s = total */ 'pagerRange' => __( '%1$sā%2$s of %3$s', 'ai-share-summarize' ), 'vs' => __( 'vs', 'ai-share-summarize' ), ), ) ); // Inline script for activation notice dismissal. wp_add_inline_script( 'jquery', ' jQuery(document).ready(function($) { $(document).on("click", ".notice[data-notice=\"ayudawp-aiss-activation\"] .notice-dismiss", function() { $.post(ajaxurl, { action: "ayudawp_dismiss_activation_notice", nonce: "' . esc_js( wp_create_nonce( 'ayudawp_dismiss_notice' ) ) . '" }); }); $(document).on("click", ".aiss-dismiss-ai-error", function() { var btn = $(this); var notice = btn.closest(".aiss-ai-error-notice"); $.post(ajaxurl, { action: "ayudawp_aiss_dismiss_ai_error", nonce: btn.data("nonce") }, function(response) { if (response && response.success) { notice.slideUp(180, function() { notice.remove(); }); } }); }); }); ' ); } /** * Add settings link to plugins page * * @param array $links Plugin action links. * @return array Modified links. */ public function ayudawp_add_settings_link( $links ) { // Add Analytics link. $analytics_link = '' . esc_html__( 'Analytics', 'ai-share-summarize' ) . ''; array_unshift( $links, $analytics_link ); // Add Settings link (appears first / leftmost). $settings_link = '' . esc_html__( 'Settings', 'ai-share-summarize' ) . ''; array_unshift( $links, $settings_link ); return $links; } /** * Show activation notice */ public function ayudawp_activation_notice() { if ( get_current_screen()->id !== 'plugins' || get_option( 'ayudawp_aiss_activation_notice_dismissed' ) ) { return; } if ( get_transient( 'ayudawp_aiss_just_activated' ) ) { ?>
ayudawp_register_settings_fields(); } /** * Register settings fields */ private function ayudawp_register_settings_fields() { $fields = array( 'default_prompt' => esc_html__( 'AIs Default Prompt', 'ai-share-summarize' ), 'enabled_buttons' => esc_html__( 'Enabled buttons', 'ai-share-summarize' ), 'display_locations' => esc_html__( 'Where to display the buttons', 'ai-share-summarize' ), 'auto_insert_position' => esc_html__( 'Automatic insertion position', 'ai-share-summarize' ), 'auto_insert_content_types' => esc_html__( 'Automatic insertion by content type', 'ai-share-summarize' ), 'seo_integration' => esc_html__( 'SEO Integration', 'ai-share-summarize' ), 'twitter_handle' => esc_html__( 'X handle to mention', 'ai-share-summarize' ), 'mastodon_instance' => esc_html__( 'Mastodon instance', 'ai-share-summarize' ), 'custom_text' => esc_html__( 'Custom text in prompts', 'ai-share-summarize' ), 'title_text' => esc_html__( 'Title text before buttons', 'ai-share-summarize' ), 'section_titles' => esc_html__( 'Section titles', 'ai-share-summarize' ), 'title_style' => esc_html__( 'Title style', 'ai-share-summarize' ), 'button_order' => esc_html__( 'Buttons order', 'ai-share-summarize' ), 'button_alignment' => esc_html__( 'Button alignment', 'ai-share-summarize' ), 'button_colors' => esc_html__( 'Button style', 'ai-share-summarize' ), 'dark_mode_adaptation' => esc_html__( 'Dark mode adaptation', 'ai-share-summarize' ), 'button_size' => esc_html__( 'Button size', 'ai-share-summarize' ), 'show_icons' => esc_html__( 'Show icons', 'ai-share-summarize' ), 'icon_style' => esc_html__( 'Icons only style', 'ai-share-summarize' ), 'seo_button_type' => esc_html__( 'Button HTML Type', 'ai-share-summarize' ), 'data_retention' => esc_html__( 'Data retention', 'ai-share-summarize' ), ); foreach ( $fields as $field_id => $field_title ) { add_settings_field( $field_id, $field_title, array( $this, 'ayudawp_' . $field_id . '_callback' ), 'ayudawp_aiss_settings', 'ayudawp_aiss_main' ); } // AI Summary section fields (v2.0.0). $summary_fields = array( 'ai_summary_mode' => esc_html__( 'AI Summary generation', 'ai-share-summarize' ), 'ai_summary_model' => esc_html__( 'AI model', 'ai-share-summarize' ), 'ai_summary_content_types' => esc_html__( 'Summaries by content type', 'ai-share-summarize' ), 'ai_summary_position' => esc_html__( 'Summary position', 'ai-share-summarize' ), 'ai_summary_collapsed_default' => esc_html__( 'Collapsed by default', 'ai-share-summarize' ), 'ai_summary_label' => esc_html__( 'Summary block label', 'ai-share-summarize' ), 'ai_summary_style' => esc_html__( 'Summary block style', 'ai-share-summarize' ), 'ai_summary_icon_position' => esc_html__( 'Summary icon position', 'ai-share-summarize' ), 'ai_summary_sentences' => esc_html__( 'Summary sentence count', 'ai-share-summarize' ), 'ai_summary_frontend_button' => esc_html__( 'Frontend generation button', 'ai-share-summarize' ), 'ai_summary_generate_button_label' => esc_html__( 'Frontend button label', 'ai-share-summarize' ), 'ai_summary_frontend_force_extractive' => esc_html__( 'Frontend uses extractive only', 'ai-share-summarize' ), ); foreach ( $summary_fields as $field_id => $field_title ) { add_settings_field( $field_id, $field_title, array( $this, 'ayudawp_' . $field_id . '_callback' ), 'ayudawp_aiss_settings', 'ayudawp_aiss_ai_summary' ); } } /** * Admin page content with tabs */ public function ayudawp_admin_page() { $active_tab = isset( $_GET['tab'] ) ? sanitize_key( $_GET['tab'] ) : 'analytics'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended $page_url = admin_url( 'options-general.php?page=ai-share-summarize' ); // Dynamic page title based on active tab. $page_title = 'AI Share & Summarize'; if ( 'analytics' === $active_tab ) { $page_title .= ' ā ' . esc_html__( 'Analytics', 'ai-share-summarize' ); } ?>' . esc_html__( 'Configure how and where to display share buttons and generate summaries with AI.', 'ai-share-summarize' ); echo ' (' . esc_html__( 'You can also customize display using shortcodes as described in the', 'ai-share-summarize' ) . ' ' . esc_html__( 'plugin page', 'ai-share-summarize' ) . ')'; echo '
'; } // ========================================== // Settings field callbacks // ========================================== /** * Default prompt field */ public function ayudawp_default_prompt_callback() { $options = get_option( 'ayudawp_aiss_options' ); $value = isset( $options['default_prompt'] ) ? $options['default_prompt'] : ayudawp_aiss_get_default_prompt(); ?> '; foreach ( $buttons as $key => $label ) { $checked = in_array( $key, $enabled, true ) ? 'checked="checked"' : ''; $icon_preview = AyudaWP_AISS_Icons::ayudawp_get_icon( $key, 16 ); echo ''; } echo ''; echo '' . esc_html__( 'Select which buttons to display on the frontend.', 'ai-share-summarize' ) . '
'; } /** * Display locations field */ public function ayudawp_display_locations_callback() { $options = get_option( 'ayudawp_aiss_options' ); $locations = isset( $options['display_locations'] ) ? $options['display_locations'] : array(); if ( ! is_array( $locations ) ) { $locations = array(); } $available_locations = array( 'posts' => esc_html__( 'Posts', 'ai-share-summarize' ), 'pages' => esc_html__( 'Pages', 'ai-share-summarize' ), 'archives' => esc_html__( 'Archives', 'ai-share-summarize' ), 'home' => esc_html__( 'Home', 'ai-share-summarize' ), 'cpt' => esc_html__( 'Custom Post Types', 'ai-share-summarize' ), ); echo '' . esc_html__( 'Select in which types of content to display the buttons:', 'ai-share-summarize' ) . '
'; foreach ( $available_locations as $key => $label ) { $checked = in_array( $key, $locations, true ) ? 'checked="checked"' : ''; echo ''; } } /** * Auto insert position field */ public function ayudawp_auto_insert_position_callback() { $options = get_option( 'ayudawp_aiss_options' ); $position = isset( $options['auto_insert_position'] ) ? $options['auto_insert_position'] : 'after_content'; $positions = array( 'disabled' => esc_html__( 'Disabled (shortcode only mode)', 'ai-share-summarize' ), 'before_content' => esc_html__( 'Before the content', 'ai-share-summarize' ), 'after_content' => esc_html__( 'After the content', 'ai-share-summarize' ), 'both' => esc_html__( 'Before and after the content', 'ai-share-summarize' ), ); echo '' . esc_html__( 'Select where to automatically insert the buttons:', 'ai-share-summarize' ) . '
'; foreach ( $positions as $key => $label ) { $checked = ( $position === $key ) ? 'checked="checked"' : ''; echo ''; } echo '' . esc_html__( 'Note:', 'ai-share-summarize' ) . ' ' . esc_html__( 'When disabled, it will only be displayed using the shortcode [ayudawp_share_buttons].', 'ai-share-summarize' ) . '
'; } /** * Auto insert content types field */ public function ayudawp_auto_insert_content_types_callback() { $options = get_option( 'ayudawp_aiss_options' ); $content_types = isset( $options['auto_insert_content_types'] ) ? $options['auto_insert_content_types'] : array(); if ( ! is_array( $content_types ) ) { $content_types = array(); } $post_types = get_post_types( array( 'public' => true ), 'objects' ); echo '' . esc_html__( 'Select the types of content in which to automatically insert the buttons:', 'ai-share-summarize' ) . '
'; echo '' . esc_html__( 'It will only be applied to singular content (not to lists or files).', 'ai-share-summarize' ) . '
'; } /** * SEO Integration callback */ public function ayudawp_seo_integration_callback() { $options = get_option( 'ayudawp_aiss_options' ); $exclude_noindex = isset( $options['exclude_noindex'] ) ? $options['exclude_noindex'] : true; $seo_plugin = AyudaWP_AISS_SEO_Integration::ayudawp_detect_seo_plugin(); $has_noindexer = class_exists( 'Noindexer_Frontend' ); ?>
Yoast SEO, Rank Math, All in One SEO, SEOPress, The SEO Framework, NoIndexer
' . esc_html__( 'Select the HTML element for the title:', 'ai-share-summarize' ) . '
'; foreach ( $styles as $key => $label ) { $checked = ( $style === $key ) ? 'checked="checked"' : ''; echo ''; } } /** * Button order field */ public function ayudawp_button_order_callback() { $options = get_option( 'ayudawp_aiss_options' ); $order = isset( $options['button_order'] ) ? $options['button_order'] : 'ayudawp_ai_first'; $orders = array( 'ayudawp_social_first' => esc_html__( 'Social media first', 'ai-share-summarize' ), 'ayudawp_ai_first' => esc_html__( 'AIs first', 'ai-share-summarize' ), 'ayudawp_mixed' => esc_html__( 'Mixed', 'ai-share-summarize' ), ); foreach ( $orders as $key => $label ) { $checked = ( $order === $key ) ? 'checked="checked"' : ''; echo ''; } // Two-column sortable for custom internal order within each group (v1.6.0). $custom_order_ai = isset( $options['button_custom_order_ai'] ) ? $options['button_custom_order_ai'] : array(); $custom_order_social = isset( $options['button_custom_order_social'] ) ? $options['button_custom_order_social'] : array(); $enabled = isset( $options['enabled_buttons'] ) ? $options['enabled_buttons'] : array(); $all_buttons = ayudawp_aiss_get_available_buttons(); $social_keys = ayudawp_aiss_get_social_buttons(); $ai_keys = ayudawp_aiss_get_ai_buttons(); // Build sorted lists per group. $sorted_ai = self::ayudawp_build_sorted_list( $custom_order_ai, $enabled, $ai_keys, $all_buttons ); $sorted_social = self::ayudawp_build_sorted_list( $custom_order_social, $enabled, $social_keys, $all_buttons ); $svg_kses = array( 'svg' => array( 'width' => array(), 'height' => array(), 'viewBox' => array(), 'fill' => array(), 'role' => array(), 'class' => array(), 'aria-hidden' => array() ), 'path' => array( 'd' => array(), 'fill' => array(), 'stroke' => array() ), 'circle' => array( 'cx' => array(), 'cy' => array(), 'r' => array(), 'fill' => array() ), 'rect' => array( 'x' => array(), 'y' => array(), 'width' => array(), 'height' => array(), 'rx' => array(), 'ry' => array() ), 'span' => array( 'class' => array() ), ); echo '' . esc_html__( 'Drag and drop to reorder within each group:', 'ai-share-summarize' ) . '
'; echo '' . esc_html__( 'This setting does not affect mobile devices, where buttons adapt automatically for better usability.', 'ai-share-summarize' ) . '
'; } /** * Button colors field */ public function ayudawp_button_colors_callback() { $options = get_option( 'ayudawp_aiss_options' ); $style = isset( $options['button_colors'] ) ? $options['button_colors'] : 'brand'; $styles = array( 'minimal' => esc_html__( 'Minimal (default)', 'ai-share-summarize' ), 'brand' => esc_html__( 'Brand colors', 'ai-share-summarize' ), 'outline' => esc_html__( 'Outline (brand borders)', 'ai-share-summarize' ), 'dark' => esc_html__( 'For dark backgrounds', 'ai-share-summarize' ), 'custom' => esc_html__( 'Custom colors', 'ai-share-summarize' ), 'icons-only' => esc_html__( 'Icons only', 'ai-share-summarize' ), ); foreach ( $styles as $key => $label ) { $checked = ( $style === $key ) ? 'checked="checked"' : ''; echo ''; } // Custom color picker fields. $custom_bg = isset( $options['custom_color_bg'] ) ? $options['custom_color_bg'] : '#333333'; $custom_text = isset( $options['custom_color_text'] ) ? $options['custom_color_text'] : '#ffffff'; ?> ' . esc_html__( 'Select the visual style for the buttons. Icons only style shows only icons without text.', 'ai-share-summarize' ) . ''; } /** * Dark mode adaptation field */ public function ayudawp_dark_mode_adaptation_callback() { $options = get_option( 'ayudawp_aiss_options' ); $mode = isset( $options['dark_mode_adaptation'] ) ? $options['dark_mode_adaptation'] : 'disabled'; $modes = array( 'disabled' => esc_html__( 'Disabled (default)', 'ai-share-summarize' ), 'auto' => esc_html__( 'Auto: detect dark backgrounds and adapt buttons', 'ai-share-summarize' ), ); foreach ( $modes as $key => $label ) { $checked = ( $mode === $key ) ? 'checked="checked"' : ''; echo ''; } echo '' . esc_html__( 'Off by default since most themes don\'t offer a dark mode. Enable "Auto" if your theme does: a tiny script measures the real background of the buttons container and, only when it is dark, switches X, Threads and Grok to legible colors and adapts the Minimal/Outline text. The "Custom" and "For dark backgrounds" styles are never overridden (they are explicit choices).', 'ai-share-summarize' ) . '
'; } /** * Show icons field */ public function ayudawp_show_icons_callback() { $options = get_option( 'ayudawp_aiss_options' ); $show_icons = isset( $options['show_icons'] ) ? $options['show_icons'] : false; ?> esc_html__( 'Square corners', 'ai-share-summarize' ), 'circular' => esc_html__( 'Circular', 'ai-share-summarize' ), ); echo '' . esc_html__( 'Select the corner style for icons-only buttons:', 'ai-share-summarize' ) . '
'; foreach ( $styles as $key => $label ) { $checked = ( $icon_style === $key ) ? 'checked="checked"' : ''; echo ''; } echo '' . esc_html__( 'This setting only affects the "Icons only" button style.', 'ai-share-summarize' ) . '
'; } /** * SEO button type field */ public function ayudawp_seo_button_type_callback() { $options = get_option( 'ayudawp_aiss_options' ); $seo_type = isset( $options['seo_button_type'] ) ? $options['seo_button_type'] : 'link'; ?>__( '1 month', 'ai-share-summarize' ), '3_months' => __( '3 months', 'ai-share-summarize' ), '6_months' => __( '6 months', 'ai-share-summarize' ), '1_year' => __( '1 year', 'ai-share-summarize' ), 'forever' => __( 'Forever', 'ai-share-summarize' ), ); ?>
' . esc_html__( 'Fluid mode makes buttons expand to fill the available space instead of using a fixed width.', 'ai-share-summarize' ) . '
'; } /** * AJAX handler: Delete all analytics data */ public function ayudawp_ajax_delete_all_data() { check_ajax_referer( 'aiss_admin_nonce', 'nonce' ); if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( array( 'message' => 'Permission denied.' ) ); } AyudaWP_AISS_Database::ayudawp_delete_all_data(); wp_send_json_success(); } /** * AJAX handler: Dismiss the "Last AI generation error" notice on Settings (v2.0.0) */ public function ayudawp_ajax_dismiss_ai_error() { check_ajax_referer( 'aiss_admin_nonce', 'nonce' ); if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( array( 'message' => 'Permission denied.' ) ); } if ( class_exists( 'AyudaWP_AISS_AI_Summary' ) ) { AyudaWP_AISS_AI_Summary::store_last_ai_error( null ); } else { delete_option( 'ayudawp_aiss_last_ai_error' ); } wp_send_json_success(); } // ========================================== // AI Summary section (v2.0.0) // ========================================== /** * AI Summary section callback ā explains the feature and AI client status * * Carries a stable anchor ID (#ayudawp-aiss-ai-summary) so the subnav, * the command palette, the Abilities API and external docs can deep-link * straight here. */ public function ayudawp_ai_summary_section_callback() { echo ''; echo '' . esc_html__( 'Automatically generate a short summary of each post and display it inline alongside the share buttons.', 'ai-share-summarize' ) . '
'; echo '' . esc_html__( 'WP AI Client is available.', 'ai-share-summarize' ) . ' ' . sprintf( /* translators: %s is a link to the Connectors settings screen. */ esc_html__( 'Configure your AI provider in %s to enable high-quality summaries.', 'ai-share-summarize' ), '' . esc_html__( 'Settings > Connectors', 'ai-share-summarize' ) . '' ) . '
'; // Surface the last AI Client error (if any) so the admin can act on it. // The optional "Possible cause" hint lives inside the same notice // so the dismiss button removes both lines together ā keeping a // floating hint visible after the user has dismissed its parent // error would be confusing. if ( class_exists( 'AyudaWP_AISS_AI_Summary' ) ) { $last_error = AyudaWP_AISS_AI_Summary::get_last_ai_error(); if ( $last_error ) { $nonce = wp_create_nonce( 'aiss_admin_nonce' ); $show_hint = ayudawp_aiss_is_canonical_ai_plugin_active(); $approvals_url = admin_url( 'tools.php?page=ai-connector-approval' ); echo ''
. '' . esc_html__( 'Last AI generation error:', 'ai-share-summarize' ) . ' '
. esc_html( $last_error['message'] )
. ' ' . esc_html( $last_error['code'] ) . ''
. '
' . '' . esc_html__( 'Possible cause:', 'ai-share-summarize' ) . ' ' . sprintf( /* translators: %1$s/%2$s wrap a link to Tools > Connector Approvals. */ esc_html__( 'The canonical AI plugin is active. Its Connector Approval system can silently block calls from plugins it has not approved yet. Open %1$sTools > Connector Approvals%2$s and enable the toggle next to "AI Share & Summarize".', 'ai-share-summarize' ), '', '' ) . '
'; } echo '' . esc_html__( 'WP AI Client not detected.', 'ai-share-summarize' ) . ' ' . esc_html__( 'Requires WordPress 7.0 or later. Without it, only the basic extractive fallback will be used.', 'ai-share-summarize' ) . '
'; } echo '' . esc_html__( 'Summaries are generated asynchronously when a post is published or updated, on the post types selected in "Automatic insertion by content type".', 'ai-share-summarize' ) . '
'; } /** * AI summary generation mode field (v2.2.0) * * Single explicit selector that replaces the former "Enable AI Summary" + * "Use extractive fallback" checkbox pair. */ public function ayudawp_ai_summary_mode_callback() { $mode = ayudawp_aiss_get_summary_mode(); $modes = array( 'ai_fallback' => esc_html__( 'AI with extractive fallback (recommended)', 'ai-share-summarize' ), 'ai_only' => esc_html__( 'AI only (no fallback)', 'ai-share-summarize' ), 'extractive_only' => esc_html__( 'Extractive only (never contacts an AI provider)', 'ai-share-summarize' ), 'disabled' => esc_html__( 'Disabled', 'ai-share-summarize' ), ); $descriptions = array( 'ai_fallback' => esc_html__( 'Generate with your AI provider; if it is unavailable, fall back to the on-server extractive summary.', 'ai-share-summarize' ), 'ai_only' => esc_html__( 'Generate with your AI provider only. If it fails, no summary is produced.', 'ai-share-summarize' ), 'extractive_only' => esc_html__( 'Always use the on-server extractive summarizer. Zero cost, never contacts an AI provider.', 'ai-share-summarize' ), 'disabled' => esc_html__( 'Do not generate summaries at all.', 'ai-share-summarize' ), ); foreach ( $modes as $key => $label ) { ?>Connectors when no provider is configured. */ public function ayudawp_ai_summary_model_callback() { $options = get_option( 'ayudawp_aiss_options' ); $selected = isset( $options['ai_summary_model'] ) ? (string) $options['ai_summary_model'] : ''; $available = ayudawp_aiss_get_available_models(); if ( empty( $available ) ) { $connectors_url = admin_url( 'options-connectors.php' ); ?>
Connectors', 'ai-share-summarize' ); ?>
esc_html__( 'Right before the share buttons', 'ai-share-summarize' ), 'after_buttons' => esc_html__( 'Right after the share buttons', 'ai-share-summarize' ), 'before_content' => esc_html__( 'Before the content', 'ai-share-summarize' ), 'disabled' => esc_html__( 'Do not display (still generates the summary)', 'ai-share-summarize' ), ); echo '' . esc_html__( 'Choose where to render the summary in the post:', 'ai-share-summarize' ) . '
'; foreach ( $positions as $key => $label ) { $checked = ( $position === $key ) ? 'checked="checked"' : ''; echo ''; } } /** * AI summary collapsed default field */ public function ayudawp_ai_summary_collapsed_default_callback() { $options = get_option( 'ayudawp_aiss_options' ); $collapsed = isset( $options['ai_summary_collapsed_default'] ) ? (bool) $options['ai_summary_collapsed_default'] : true; ?> true ), 'objects' ); echo '' . esc_html__( 'Select the post types where summaries should be generated and displayed:', 'ai-share-summarize' ) . '
'; echo '' . esc_html__( 'This has its own list, but while it is left empty, summaries fall back to the content types used by the share buttons. Select at least one type here to control summaries independently.', 'ai-share-summarize' ) . '
'; } /** * Frontend generation button field (v2.0.0) */ public function ayudawp_ai_summary_frontend_button_callback() { $options = get_option( 'ayudawp_aiss_options' ); $enabled = isset( $options['ai_summary_frontend_button'] ) ? (bool) $options['ai_summary_frontend_button'] : false; ?> esc_html__( 'Minimal (default)', 'ai-share-summarize' ), 'outline' => esc_html__( 'Outline', 'ai-share-summarize' ), 'brand' => esc_html__( 'Brand (filled)', 'ai-share-summarize' ), 'dark' => esc_html__( 'Dark', 'ai-share-summarize' ), 'custom' => esc_html__( 'Custom colors', 'ai-share-summarize' ), ); foreach ( $styles as $key => $label ) { $checked = ( $style === $key ) ? 'checked="checked"' : ''; echo ''; } $custom_bg = isset( $options['ai_summary_custom_bg'] ) ? $options['ai_summary_custom_bg'] : '#ffffff'; $custom_text = isset( $options['ai_summary_custom_text'] ) ? $options['ai_summary_custom_text'] : '#1a1a1a'; ?> ' . esc_html__( 'Visual style for the inline summary block and its Generate button. "Custom colors" uses the colors chosen above.', 'ai-share-summarize' ) . ''; } /** * AI summary icon position field (v2.1.0) */ public function ayudawp_ai_summary_icon_position_callback() { $options = get_option( 'ayudawp_aiss_options' ); $position = isset( $options['ai_summary_icon_position'] ) ? $options['ai_summary_icon_position'] : 'left'; $positions = array( 'left' => esc_html__( 'Left (default)', 'ai-share-summarize' ), 'right' => esc_html__( 'Right', 'ai-share-summarize' ), 'hidden' => esc_html__( 'Hidden', 'ai-share-summarize' ), ); foreach ( $positions as $key => $label ) { $checked = ( $position === $key ) ? 'checked="checked"' : ''; echo ''; } echo '' . esc_html__( 'Where the summary icon appears in the block header.', 'ai-share-summarize' ) . '
'; } /** * AI summary frontend button label field (v2.1.0) */ public function ayudawp_ai_summary_generate_button_label_callback() { $options = get_option( 'ayudawp_aiss_options' ); $value = isset( $options['ai_summary_generate_button_label'] ) ? $options['ai_summary_generate_button_label'] : ''; ?>