Plugin Directory

Changeset 3414721


Ignore:
Timestamp:
12/08/2025 09:21:52 PM (4 months ago)
Author:
ugoltsev
Message:

Updated for WordPress 6.9

Location:
ask-my-content/trunk
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • ask-my-content/trunk/ask-my-content.php

    r3387251 r3414721  
    44 * Plugin Name:       Ask My Content - AI Q&A Chatbot
    55 * Description:       AI-powered Q&A chatbot, allowing users to ask questions and receive answers sourced from the site’s own posts and pages.
    6  * Version:           0.5.1
     6 * Version:           0.6.0
    77 * Requires at least: 5.8
    88 * Requires PHP:      7.4
     
    9292    $settings_path = $base_dir . 'assets/js/askmyco-settings.js';
    9393
    94     $core_ver = file_exists($core_path) ? filemtime($core_path) : '0.5.1';
    95     $frontend_ver = file_exists($frontend_path) ? filemtime($frontend_path) : '0.5.1';
    96     $admin_init_ver = file_exists($admin_init_path) ? filemtime($admin_init_path) : '0.5.1';
    97     $style_ver = file_exists($style_path) ? filemtime($style_path) : '0.5.1';
    98     $settings_ver = file_exists($settings_path) ? filemtime($settings_path) : '0.5.1';
     94    $core_ver = file_exists($core_path) ? filemtime($core_path) : '0.6.0';
     95    $frontend_ver = file_exists($frontend_path) ? filemtime($frontend_path) : '0.6.0';
     96    $admin_init_ver = file_exists($admin_init_path) ? filemtime($admin_init_path) : '0.6.0';
     97    $style_ver = file_exists($style_path) ? filemtime($style_path) : '0.6.0';
     98    $settings_ver = file_exists($settings_path) ? filemtime($settings_path) : '0.6.0';
    9999
    100100    if (! wp_script_is($core_handle, 'registered')) {
     
    173173            'refreshAction' => 'askmyco_refresh_public_nonce',
    174174            'nonceIssuedAt' => time(),
     175            // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- core WP filter
    175176            'nonceLifetime' => (int) apply_filters('nonce_life', DAY_IN_SECONDS),
    176177            'i18n'    => [
     
    301302        'refreshAction' => 'askmyco_refresh_admin_nonce',
    302303        'nonceIssuedAt' => time(),
     304        // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- core WP filter
    303305        'nonceLifetime' => (int) apply_filters('nonce_life', DAY_IN_SECONDS),
    304306        'i18n' => [
  • ask-my-content/trunk/build/ask-my-content/block.json

    r3387251 r3414721  
    33  "apiVersion": 3,
    44  "name": "amc/ask-my-content",
    5   "version": "0.5.1",
     5  "version": "0.6.0",
    66  "title": "Ask My Content",
    77  "category": "widgets",
  • ask-my-content/trunk/build/ask-my-content/render.php

    r3384523 r3414721  
    1010}
    1111// Pull attributes (defaults handled by block.json)
    12 $title            = isset($attributes['title']) ? sanitize_text_field($attributes['title']) : 'Ask My Content AI Chat';
    13 $header_bg        = isset($attributes['headerBackground']) ? sanitize_hex_color($attributes['headerBackground']) : '#0d6186';
    14 $header_color    = isset($attributes['headerTextColor']) ? sanitize_hex_color($attributes['headerTextColor']) : '#ffffff';
    15 $chat_bg          = isset($attributes['chatBackground']) ? sanitize_hex_color($attributes['chatBackground']) : '#ffffff';
    16 $user_bg          = isset($attributes['chatUserBubble']) ? sanitize_hex_color($attributes['chatUserBubble']) : '#e9f5ff';
    17 $bot_bg           = isset($attributes['chatBotBubble']) ? sanitize_hex_color($attributes['chatBotBubble']) : '#f6f7f7';
    18 $input_bg         = isset($attributes['inputBackground']) ? sanitize_hex_color($attributes['inputBackground']) : '#ffffff';
    19 $input_color      = isset($attributes['inputTextColor']) ? sanitize_hex_color($attributes['inputTextColor']) : '#000000';
    20 $width           = isset($attributes['width']) ? sanitize_text_field($attributes['width']) : '640px';
    21 $height          = isset($attributes['height']) ? sanitize_text_field($attributes['height']) : '440px';
     12$askmyco_title        = isset($attributes['title']) ? sanitize_text_field($attributes['title']) : 'Ask My Content AI Chat';
     13$askmyco_header_bg    = isset($attributes['headerBackground']) ? sanitize_hex_color($attributes['headerBackground']) : '#0d6186';
     14$askmyco_header_color = isset($attributes['headerTextColor']) ? sanitize_hex_color($attributes['headerTextColor']) : '#ffffff';
     15$askmyco_chat_bg      = isset($attributes['chatBackground']) ? sanitize_hex_color($attributes['chatBackground']) : '#ffffff';
     16$askmyco_user_bg      = isset($attributes['chatUserBubble']) ? sanitize_hex_color($attributes['chatUserBubble']) : '#e9f5ff';
     17$askmyco_bot_bg       = isset($attributes['chatBotBubble']) ? sanitize_hex_color($attributes['chatBotBubble']) : '#f6f7f7';
     18$askmyco_input_bg     = isset($attributes['inputBackground']) ? sanitize_hex_color($attributes['inputBackground']) : '#ffffff';
     19$askmyco_input_color  = isset($attributes['inputTextColor']) ? sanitize_hex_color($attributes['inputTextColor']) : '#000000';
     20$askmyco_width        = isset($attributes['width']) ? sanitize_text_field($attributes['width']) : '640px';
     21$askmyco_height       = isset($attributes['height']) ? sanitize_text_field($attributes['height']) : '440px';
    2222
    23 $style_inline = sprintf(
     23$askmyco_style_inline = sprintf(
    2424    '--amc-header-bg:%1$s;--amc-header-color:%2$s;--amc-chat-bg:%3$s;--amc-user-bg:%4$s;--amc-bot-bg:%5$s;--amc-input-bg:%6$s;--amc-input-color:%7$s;--amc-chat-width:%8$s;--amc-chat-height:%9$s;',
    25     $header_bg,
    26     $header_color,
    27     $chat_bg,
    28     $user_bg,
    29     $bot_bg,
    30     $input_bg,
    31     $input_color,
    32     $width,
    33     $height
     25    $askmyco_header_bg,
     26    $askmyco_header_color,
     27    $askmyco_chat_bg,
     28    $askmyco_user_bg,
     29    $askmyco_bot_bg,
     30    $askmyco_input_bg,
     31    $askmyco_input_color,
     32    $askmyco_width,
     33    $askmyco_height
    3434);
    3535
    3636// get_block_wrapper_attributes handles escaping, but style value is sanitized above;
    3737// escape explicitly to satisfy Plugin Check.
    38 $attrs = get_block_wrapper_attributes(['style' => esc_attr($style_inline)]);
     38$askmyco_attrs = get_block_wrapper_attributes(['style' => esc_attr($askmyco_style_inline)]);
    3939// get_block_wrapper_attributes returns a safe attribute string; style is sanitized & escaped above.
    4040// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    41 echo '<div ' . $attrs . '>';
     41echo '<div ' . $askmyco_attrs . '>';
    4242if (function_exists('askmyco_get_chat_markup')) {
    4343    echo askmyco_get_chat_markup($attributes); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
  • ask-my-content/trunk/build/ask-my-content/view.asset.php

    r3384523 r3414721  
    1 <?php return array('dependencies' => array(), 'version' => '31d6cfe0d16ae931b73c');
     1<?php return array('dependencies' => array(), 'version' => 'cb91b5250a54e064162f');
  • ask-my-content/trunk/build/ask-my-content/view.js

    r3384523 r3414721  
     1/******/ (() => { // webpackBootstrap
     2/**
     3 * Use this file for JavaScript code that you want to run in the front-end
     4 * on posts/pages that contain this block.
     5 *
     6 * When this file is defined as the value of the `viewScript` property
     7 * in `block.json` it will be enqueued on the front end of the site.
     8 *
     9 * Example:
     10 *
     11 * ```js
     12 * {
     13 *   "viewScript": "file:./view.js"
     14 * }
     15 * ```
     16 *
     17 * If you're not making any changes to this file because your project doesn't need any
     18 * JavaScript running in the front-end, then you should delete this file and remove
     19 * the `viewScript` property from `block.json`.
     20 *
     21 * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#view-script
     22 */
     23
     24/* eslint-disable no-console */
     25// console.log( 'Hello World! (from amc-ask-my-content block)' );
     26/* eslint-enable no-console */
     27/******/ })()
     28;
  • ask-my-content/trunk/build/blocks-manifest.php

    r3387251 r3414721  
    66        'apiVersion' => 3,
    77        'name' => 'amc/ask-my-content',
    8         'version' => '0.5.1',
     8        'version' => '0.6.0',
    99        'title' => 'Ask My Content',
    1010        'category' => 'widgets',
  • ask-my-content/trunk/includes/api.php

    r3387251 r3414721  
    5050    // SIMU TEST for page/post embedding
    5151    if ($end_point == 'embed') {
    52         //return simulatedEmbedResponse($site_uuid, $json_array);
     52        //return askmyco_simulated_embed_response($site_uuid, $json_array);
    5353    }
    5454    // Normalize blocking flag (support 'blocking' | 'non_blocking' strings for convenience)
     
    185185        'nonce'     => wp_create_nonce('askmyco_public_query'),
    186186        'issuedAt'  => time(),
     187        // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- core WP filter
    187188        'lifetime'  => (int) apply_filters('nonce_life', DAY_IN_SECONDS),
    188189    ]);
     
    198199        'nonce'     => wp_create_nonce('askmyco_admin_query'),
    199200        'issuedAt'  => time(),
     201        // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- core WP filter
    200202        'lifetime'  => (int) apply_filters('nonce_life', DAY_IN_SECONDS),
    201203    ]);
     
    260262
    261263// Return simulated embed / query response (bypasses real backend call) ---
    262 function simulatedEmbedResponse($site_uuid, $json_array)
     264function askmyco_simulated_embed_response($site_uuid, $json_array)
    263265{
    264266    sleep(3);
  • ask-my-content/trunk/includes/db.php

    r3384523 r3414721  
    2121    global $wpdb;
    2222   
     23    // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery -- intentional cache bypass for cross-process flag
    2324    $wpdb->query(
    2425        $wpdb->prepare(
     
    4243    global $wpdb;
    4344   
     45    // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery -- intentional cache bypass for cross-process flag
    4446    $wpdb->query(
    4547        $wpdb->prepare(
     
    6870    wp_cache_delete('askmyco_stop_requested', 'options');
    6971   
     72    // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- intentional cache bypass
    7073    $stop_raw = $wpdb->get_var(
    7174        $wpdb->prepare(
     
    9598    global $wpdb;
    9699   
     100    // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery -- atomic increment to avoid race conditions
    97101    $wpdb->query(
    98102        $wpdb->prepare(
  • ask-my-content/trunk/includes/settings.php

    r3384523 r3414721  
    1111        'manage_options',
    1212        'ask-my-content',
    13         'ask_my_content_settings_page'
     13        'askmyco_settings_page'
    1414    );
    1515});
    1616
    17 function ask_my_content_settings_page()
     17function askmyco_settings_page()
    1818{
    19     do_action('qm/debug', 'Called: ask_my_content_settings_page()');
    2019
    2120?>
     
    5857        }
    5958        // Redirect to avoid resubmission
    60         wp_redirect(admin_url('admin.php?page=ask-my-content'));
     59        wp_safe_redirect(admin_url('admin.php?page=ask-my-content'));
    6160        exit;
    6261    }
  • ask-my-content/trunk/includes/settings_chat.php

    r3384523 r3414721  
    66
    77// Use utility to determine if last indexed timestamp exists and is parsable
    8 $needs_indexing = (askmyco_get_last_indexed_at_gmt_dt_for('pages') === null);
     8$askmyco_needs_indexing = (askmyco_get_last_indexed_at_gmt_dt_for('pages') === null);
    99
    10 $desc_text      = $needs_indexing ? __('Start indexing first.', 'ask-my-content') : __('Ask a question to test the backend response.', 'ask-my-content');
    11 $placeholder    = $needs_indexing ? __('Start indexing first.', 'ask-my-content') : __('Ask a question…', 'ask-my-content');
    12 $hint_text      = $needs_indexing ? __('Start indexing first.', 'ask-my-content') : __('Press Enter to send.', 'ask-my-content');
    13 $disabled_attr  = $needs_indexing ? ' disabled aria-disabled="true"' : '';
    14 $data_disabled  = $needs_indexing ? '1' : '0';
     10$askmyco_desc_text      = $askmyco_needs_indexing ? __('Start indexing first.', 'ask-my-content') : __('Ask a question to test the backend response.', 'ask-my-content');
     11$askmyco_placeholder    = $askmyco_needs_indexing ? __('Start indexing first.', 'ask-my-content') : __('Ask a question…', 'ask-my-content');
     12$askmyco_hint_text      = $askmyco_needs_indexing ? __('Start indexing first.', 'ask-my-content') : __('Press Enter to send.', 'ask-my-content');
     13$askmyco_disabled_attr  = $askmyco_needs_indexing ? ' disabled aria-disabled="true"' : '';
     14$askmyco_data_disabled  = $askmyco_needs_indexing ? '1' : '0';
    1515// data-amc-disabled semantics:
    1616// - Always present on the container, with value '1' when chat should be disabled (needs indexing),
     
    2121<hr>
    2222<h2><?php echo esc_html(__('Quick Admin Chat Test', 'ask-my-content')); ?></h2>
    23 <p class="description"><?php echo esc_html($desc_text); ?></p>
     23<p class="description"><?php echo esc_html($askmyco_desc_text); ?></p>
    2424
    25 <div id="amc-admin-chat" class="amc-chat" data-session-id="askmyco_admin_session" data-amc-disabled="<?php echo esc_attr($data_disabled); ?>" style="max-width: 720px;">
     25<div id="amc-admin-chat" class="amc-chat" data-session-id="askmyco_admin_session" data-amc-disabled="<?php echo esc_attr($askmyco_data_disabled); ?>" style="max-width: 720px;">
    2626    <div class="amc-chat-window" role="log" aria-live="polite" style="border: 1px solid #ccd0d4; padding: 12px; height: 180px; overflow:auto; background:#fff; margin-bottom:8px;"></div>
    2727    <div class="amc-chat-controls" style="display:flex; gap:8px; align-items:flex-start;">
    28         <textarea class="amc-user-question" rows="2" style="flex:1;" placeholder="<?php echo esc_attr($placeholder); ?>" <?php disabled($needs_indexing); ?> aria-disabled="<?php echo esc_attr($needs_indexing ? 'true' : 'false'); ?>"></textarea>
    29         <button class="amc-send-btn button button-primary" type="button" <?php disabled($needs_indexing); ?> aria-disabled="<?php echo esc_attr($needs_indexing ? 'true' : 'false'); ?>"><?php echo esc_html(__('Ask', 'ask-my-content')); ?></button>
     28        <textarea class="amc-user-question" rows="2" style="flex:1;" placeholder="<?php echo esc_attr($askmyco_placeholder); ?>" <?php disabled($askmyco_needs_indexing); ?> aria-disabled="<?php echo esc_attr($askmyco_needs_indexing ? 'true' : 'false'); ?>"></textarea>
     29        <button class="amc-send-btn button button-primary" type="button" <?php disabled($askmyco_needs_indexing); ?> aria-disabled="<?php echo esc_attr($askmyco_needs_indexing ? 'true' : 'false'); ?>"><?php echo esc_html(__('Ask', 'ask-my-content')); ?></button>
    3030    </div>
    3131    <p class="amc-error" id="amc-admin-chat-error" style="color:#b32d2e; margin-top:8px; display:none;"></p>
    32     <p id="amc-admin-chat-hint" class="description" style="margin-top:4px;">&nbsp;<?php echo esc_html($hint_text); ?></p>
     32    <p id="amc-admin-chat-hint" class="description" style="margin-top:4px;">&nbsp;<?php echo esc_html($askmyco_hint_text); ?></p>
    3333
    3434</div>
  • ask-my-content/trunk/includes/settings_embed.php

    r3384523 r3414721  
    1111update_option('askmyco_total_page_count', count(get_pages()));
    1212
    13 $total_posts = (int) get_option('askmyco_total_post_count');
    14 $total_pages = (int) get_option('askmyco_total_page_count');
     13$askmyco_total_posts = (int) get_option('askmyco_total_post_count');
     14$askmyco_total_pages = (int) get_option('askmyco_total_page_count');
    1515
    16 $embedded_posts = (int) get_option('askmyco_embedded_post_count', 0);
    17 $embedded_pages = (int) get_option('askmyco_embedded_page_count', 0);
     16$askmyco_embedded_posts = (int) get_option('askmyco_embedded_post_count', 0);
     17$askmyco_embedded_pages = (int) get_option('askmyco_embedded_page_count', 0);
    1818
    1919// One-off notice for this request
     
    5454            askmyco_safe_unschedule_single(ASKMYCO_CRON_HOOK);
    5555        } else {
    56             $ts = wp_next_scheduled(ASKMYCO_CRON_HOOK);
    57             if ($ts) {
    58                 wp_unschedule_event($ts, ASKMYCO_CRON_HOOK);
     56            $askmyco_ts = wp_next_scheduled(ASKMYCO_CRON_HOOK);
     57            if ($askmyco_ts) {
     58                wp_unschedule_event($askmyco_ts, ASKMYCO_CRON_HOOK);
    5959            }
    6060        }
     
    6464
    6565        // If no run is active and nothing is scheduled, normalize to stopped now
    66         $is_running = (get_option('askmyco_is_indexing', '0') === '1') || (bool) get_option('askmyco_indexing_lock');
     66        $askmyco_is_running = (get_option('askmyco_is_indexing', '0') === '1') || (bool) get_option('askmyco_indexing_lock');
    6767
    68         $next_event = wp_next_scheduled(ASKMYCO_CRON_HOOK);
     68        $askmyco_next_event = wp_next_scheduled(ASKMYCO_CRON_HOOK);
    6969
    70         if (! $is_running && ! $next_event) {
     70        if (! $askmyco_is_running && ! $askmyco_next_event) {
    7171            askmyco_db_clear_stop_requested();
    7272            update_option('askmyco_embedding_status', 'stopped');
     
    112112        <tr>
    113113            <td>Pages</td>
    114             <td id="amc-embedded-pages"><?php echo esc_html($embedded_pages); ?></td>
    115             <td id="amc-remaining-pages"><?php echo esc_html(number_format_i18n(max(0, $total_pages - $embedded_pages))); ?></td>
     114            <td id="amc-embedded-pages"><?php echo esc_html($askmyco_embedded_pages); ?></td>
     115            <td id="amc-remaining-pages"><?php echo esc_html(number_format_i18n(max(0, $askmyco_total_pages - $askmyco_embedded_pages))); ?></td>
    116116            <td id="amc-modified-pages">0</td>
    117117        </tr>
    118118        <tr>
    119119            <td>Posts</td>
    120             <td id="amc-embedded-posts"><?php echo esc_html($embedded_posts); ?></td>
    121             <td id="amc-remaining-posts"><?php echo esc_html(number_format_i18n(max(0, $total_posts - $embedded_posts))); ?></td>
     120            <td id="amc-embedded-posts"><?php echo esc_html($askmyco_embedded_posts); ?></td>
     121            <td id="amc-remaining-posts"><?php echo esc_html(number_format_i18n(max(0, $askmyco_total_posts - $askmyco_embedded_posts))); ?></td>
    122122            <td id="amc-modified-posts">0</td>
    123123        </tr>
     
    127127<?php
    128128// Per-type last indexed times
    129 $pages_dt = askmyco_get_last_indexed_at_gmt_dt_for('pages');
    130 $posts_dt = askmyco_get_last_indexed_at_gmt_dt_for('posts');
     129$askmyco_pages_dt = askmyco_get_last_indexed_at_gmt_dt_for('pages');
     130$askmyco_posts_dt = askmyco_get_last_indexed_at_gmt_dt_for('posts');
    131131
    132132function askmyco_format_local_dt(?DateTimeImmutable $dt): string
     
    136136    return function_exists('wp_date') ? wp_date('Y-m-d H:i:s', $ts) : date_i18n('Y-m-d H:i:s', $ts);
    137137}
    138 echo '<p><strong>Last fully indexed pages date:</strong> ' . esc_html(askmyco_format_local_dt($pages_dt)) . '</p>';
    139 echo '<p><strong>Last fully indexed posts date:</strong> ' . esc_html(askmyco_format_local_dt($posts_dt)) . '</p>';
     138echo '<p><strong>Last fully indexed pages date:</strong> ' . esc_html(askmyco_format_local_dt($askmyco_pages_dt)) . '</p>';
     139echo '<p><strong>Last fully indexed posts date:</strong> ' . esc_html(askmyco_format_local_dt($askmyco_posts_dt)) . '</p>';
    140140?>
    141141<p id="amc-status"><strong>Indexing status:</strong> <?php echo esc_html(get_option('askmyco_embedding_status', 'None')); ?></p>
    142142
    143143<?php
    144 $embed_count    = (int) get_option('askmyco_embed_count', 0);
    145 $chat_in_count  = (int) get_option('askmyco_chat_in_count', 0);
    146 $chat_out_count = (int) get_option('askmyco_chat_out_count', 0);
     144$askmyco_embed_count    = (int) get_option('askmyco_embed_count', 0);
     145$askmyco_chat_in_count  = (int) get_option('askmyco_chat_in_count', 0);
     146$askmyco_chat_out_count = (int) get_option('askmyco_chat_out_count', 0);
    147147?>
    148148<p id="amc-counters" style="display:flex; gap: 1.5rem; align-items:center;">
    149149    <span><strong>Total tokens:</strong></span>
    150     <span><strong>Indexed:</strong> <span id="amc-indexed-count"><?php echo esc_html(number_format_i18n($embed_count)); ?></span></span>
    151     <span><strong>Chat in:</strong> <span id="amc-chat-in-count"><?php echo esc_html(number_format_i18n($chat_in_count)); ?></span></span>
    152     <span><strong>Chat out:</strong> <span id="amc-chat-out-count"><?php echo esc_html(number_format_i18n($chat_out_count)); ?></span></span>
     150    <span><strong>Indexed:</strong> <span id="amc-indexed-count"><?php echo esc_html(number_format_i18n($askmyco_embed_count)); ?></span></span>
     151    <span><strong>Chat in:</strong> <span id="amc-chat-in-count"><?php echo esc_html(number_format_i18n($askmyco_chat_in_count)); ?></span></span>
     152    <span><strong>Chat out:</strong> <span id="amc-chat-out-count"><?php echo esc_html(number_format_i18n($askmyco_chat_out_count)); ?></span></span>
    153153    <button type="button" class="button" id="amc-refresh-counters">Refresh</button>
    154154    <span id="amc-counters-status" style="color:#666"></span>
  • ask-my-content/trunk/includes/utils.php

    r3384523 r3414721  
    3131        return;
    3232    }
     33    // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log -- intentional debug logging
    3334    error_log('[AMC][' . $level . '] ' . $text);
    3435}
     
    292293    ob_start();
    293294    if ($type === 'header') {
     295        // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- core WP action
    294296        do_action('wp_head');
    295297    } else {
     298        // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- core WP action
    296299        do_action('wp_footer');
    297300    }
  • ask-my-content/trunk/readme.txt

    r3392460 r3414721  
    44Requires at least: 5.8
    55Requires PHP: 7.4
    6 Tested up to: 6.8
    7 Stable tag: 0.5.1
     6Tested up to: 6.9
     7Stable tag: 0.6.0
    88License: GPL-2.0-or-later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    116116== Changelog ==
    117117
     118= 0.6.0 =
     119Tested with WordPress 6.9
     120Fixed new Plugin Check complaints.
     121
    118122= 0.5.1 =
    119123Improved chat error handling so the browser console surfaces the underlying API failure while the front-end shows a concise, user-friendly message.
     
    125129= 0.4.2 =
    126130Initial release – shortcode, block, automatic content sync, AI-powered answers.
    127 
    128 
    129 == Upgrade Notice ==
    130 
    131 = 0.5.1 =
    132 Improved chat error handling so the browser console surfaces the underlying API failure while the front-end shows a concise, user-friendly message.
    133 Chats now recover automatically when the 12-hour security token expires, so long conversations continue without forcing visitors to reload the page.
  • ask-my-content/trunk/src/ask-my-content/block.json

    r3387251 r3414721  
    33    "apiVersion": 3,
    44    "name": "amc/ask-my-content",
    5     "version": "0.5.1",
     5    "version": "0.6.0",
    66    "title": "Ask My Content",
    77    "category": "widgets",
  • ask-my-content/trunk/src/ask-my-content/render.php

    r3384523 r3414721  
    1010}
    1111// Pull attributes (defaults handled by block.json)
    12 $title            = isset($attributes['title']) ? sanitize_text_field($attributes['title']) : 'Ask My Content AI Chat';
    13 $header_bg        = isset($attributes['headerBackground']) ? sanitize_hex_color($attributes['headerBackground']) : '#0d6186';
    14 $header_color    = isset($attributes['headerTextColor']) ? sanitize_hex_color($attributes['headerTextColor']) : '#ffffff';
    15 $chat_bg          = isset($attributes['chatBackground']) ? sanitize_hex_color($attributes['chatBackground']) : '#ffffff';
    16 $user_bg          = isset($attributes['chatUserBubble']) ? sanitize_hex_color($attributes['chatUserBubble']) : '#e9f5ff';
    17 $bot_bg           = isset($attributes['chatBotBubble']) ? sanitize_hex_color($attributes['chatBotBubble']) : '#f6f7f7';
    18 $input_bg         = isset($attributes['inputBackground']) ? sanitize_hex_color($attributes['inputBackground']) : '#ffffff';
    19 $input_color      = isset($attributes['inputTextColor']) ? sanitize_hex_color($attributes['inputTextColor']) : '#000000';
    20 $width           = isset($attributes['width']) ? sanitize_text_field($attributes['width']) : '640px';
    21 $height          = isset($attributes['height']) ? sanitize_text_field($attributes['height']) : '440px';
     12$askmyco_title        = isset($attributes['title']) ? sanitize_text_field($attributes['title']) : 'Ask My Content AI Chat';
     13$askmyco_header_bg    = isset($attributes['headerBackground']) ? sanitize_hex_color($attributes['headerBackground']) : '#0d6186';
     14$askmyco_header_color = isset($attributes['headerTextColor']) ? sanitize_hex_color($attributes['headerTextColor']) : '#ffffff';
     15$askmyco_chat_bg      = isset($attributes['chatBackground']) ? sanitize_hex_color($attributes['chatBackground']) : '#ffffff';
     16$askmyco_user_bg      = isset($attributes['chatUserBubble']) ? sanitize_hex_color($attributes['chatUserBubble']) : '#e9f5ff';
     17$askmyco_bot_bg       = isset($attributes['chatBotBubble']) ? sanitize_hex_color($attributes['chatBotBubble']) : '#f6f7f7';
     18$askmyco_input_bg     = isset($attributes['inputBackground']) ? sanitize_hex_color($attributes['inputBackground']) : '#ffffff';
     19$askmyco_input_color  = isset($attributes['inputTextColor']) ? sanitize_hex_color($attributes['inputTextColor']) : '#000000';
     20$askmyco_width        = isset($attributes['width']) ? sanitize_text_field($attributes['width']) : '640px';
     21$askmyco_height       = isset($attributes['height']) ? sanitize_text_field($attributes['height']) : '440px';
    2222
    23 $style_inline = sprintf(
     23$askmyco_style_inline = sprintf(
    2424    '--amc-header-bg:%1$s;--amc-header-color:%2$s;--amc-chat-bg:%3$s;--amc-user-bg:%4$s;--amc-bot-bg:%5$s;--amc-input-bg:%6$s;--amc-input-color:%7$s;--amc-chat-width:%8$s;--amc-chat-height:%9$s;',
    25     $header_bg,
    26     $header_color,
    27     $chat_bg,
    28     $user_bg,
    29     $bot_bg,
    30     $input_bg,
    31     $input_color,
    32     $width,
    33     $height
     25    $askmyco_header_bg,
     26    $askmyco_header_color,
     27    $askmyco_chat_bg,
     28    $askmyco_user_bg,
     29    $askmyco_bot_bg,
     30    $askmyco_input_bg,
     31    $askmyco_input_color,
     32    $askmyco_width,
     33    $askmyco_height
    3434);
    3535
    3636// get_block_wrapper_attributes handles escaping, but style value is sanitized above;
    3737// escape explicitly to satisfy Plugin Check.
    38 $attrs = get_block_wrapper_attributes(['style' => esc_attr($style_inline)]);
     38$askmyco_attrs = get_block_wrapper_attributes(['style' => esc_attr($askmyco_style_inline)]);
    3939// get_block_wrapper_attributes returns a safe attribute string; style is sanitized & escaped above.
    4040// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    41 echo '<div ' . $attrs . '>';
     41echo '<div ' . $askmyco_attrs . '>';
    4242if (function_exists('askmyco_get_chat_markup')) {
    4343    echo askmyco_get_chat_markup($attributes); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
Note: See TracChangeset for help on using the changeset viewer.