Changeset 3414721
- Timestamp:
- 12/08/2025 09:21:52 PM (4 months ago)
- Location:
- ask-my-content/trunk
- Files:
-
- 15 edited
-
ask-my-content.php (modified) (4 diffs)
-
build/ask-my-content/block.json (modified) (1 diff)
-
build/ask-my-content/render.php (modified) (1 diff)
-
build/ask-my-content/view.asset.php (modified) (1 diff)
-
build/ask-my-content/view.js (modified) (1 diff)
-
build/blocks-manifest.php (modified) (1 diff)
-
includes/api.php (modified) (4 diffs)
-
includes/db.php (modified) (4 diffs)
-
includes/settings.php (modified) (2 diffs)
-
includes/settings_chat.php (modified) (2 diffs)
-
includes/settings_embed.php (modified) (6 diffs)
-
includes/utils.php (modified) (2 diffs)
-
readme.txt (modified) (3 diffs)
-
src/ask-my-content/block.json (modified) (1 diff)
-
src/ask-my-content/render.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ask-my-content/trunk/ask-my-content.php
r3387251 r3414721 4 4 * Plugin Name: Ask My Content - AI Q&A Chatbot 5 5 * 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.16 * Version: 0.6.0 7 7 * Requires at least: 5.8 8 8 * Requires PHP: 7.4 … … 92 92 $settings_path = $base_dir . 'assets/js/askmyco-settings.js'; 93 93 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'; 99 99 100 100 if (! wp_script_is($core_handle, 'registered')) { … … 173 173 'refreshAction' => 'askmyco_refresh_public_nonce', 174 174 'nonceIssuedAt' => time(), 175 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- core WP filter 175 176 'nonceLifetime' => (int) apply_filters('nonce_life', DAY_IN_SECONDS), 176 177 'i18n' => [ … … 301 302 'refreshAction' => 'askmyco_refresh_admin_nonce', 302 303 'nonceIssuedAt' => time(), 304 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- core WP filter 303 305 'nonceLifetime' => (int) apply_filters('nonce_life', DAY_IN_SECONDS), 304 306 'i18n' => [ -
ask-my-content/trunk/build/ask-my-content/block.json
r3387251 r3414721 3 3 "apiVersion": 3, 4 4 "name": "amc/ask-my-content", 5 "version": "0. 5.1",5 "version": "0.6.0", 6 6 "title": "Ask My Content", 7 7 "category": "widgets", -
ask-my-content/trunk/build/ask-my-content/render.php
r3384523 r3414721 10 10 } 11 11 // 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'; 22 22 23 $ style_inline = sprintf(23 $askmyco_style_inline = sprintf( 24 24 '--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 $ height25 $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 34 34 ); 35 35 36 36 // get_block_wrapper_attributes handles escaping, but style value is sanitized above; 37 37 // escape explicitly to satisfy Plugin Check. 38 $a ttrs = get_block_wrapper_attributes(['style' => esc_attr($style_inline)]);38 $askmyco_attrs = get_block_wrapper_attributes(['style' => esc_attr($askmyco_style_inline)]); 39 39 // get_block_wrapper_attributes returns a safe attribute string; style is sanitized & escaped above. 40 40 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 41 echo '<div ' . $a ttrs . '>';41 echo '<div ' . $askmyco_attrs . '>'; 42 42 if (function_exists('askmyco_get_chat_markup')) { 43 43 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 6 6 'apiVersion' => 3, 7 7 'name' => 'amc/ask-my-content', 8 'version' => '0. 5.1',8 'version' => '0.6.0', 9 9 'title' => 'Ask My Content', 10 10 'category' => 'widgets', -
ask-my-content/trunk/includes/api.php
r3387251 r3414721 50 50 // SIMU TEST for page/post embedding 51 51 if ($end_point == 'embed') { 52 //return simulatedEmbedResponse($site_uuid, $json_array);52 //return askmyco_simulated_embed_response($site_uuid, $json_array); 53 53 } 54 54 // Normalize blocking flag (support 'blocking' | 'non_blocking' strings for convenience) … … 185 185 'nonce' => wp_create_nonce('askmyco_public_query'), 186 186 'issuedAt' => time(), 187 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- core WP filter 187 188 'lifetime' => (int) apply_filters('nonce_life', DAY_IN_SECONDS), 188 189 ]); … … 198 199 'nonce' => wp_create_nonce('askmyco_admin_query'), 199 200 'issuedAt' => time(), 201 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- core WP filter 200 202 'lifetime' => (int) apply_filters('nonce_life', DAY_IN_SECONDS), 201 203 ]); … … 260 262 261 263 // Return simulated embed / query response (bypasses real backend call) --- 262 function simulatedEmbedResponse($site_uuid, $json_array)264 function askmyco_simulated_embed_response($site_uuid, $json_array) 263 265 { 264 266 sleep(3); -
ask-my-content/trunk/includes/db.php
r3384523 r3414721 21 21 global $wpdb; 22 22 23 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery -- intentional cache bypass for cross-process flag 23 24 $wpdb->query( 24 25 $wpdb->prepare( … … 42 43 global $wpdb; 43 44 45 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery -- intentional cache bypass for cross-process flag 44 46 $wpdb->query( 45 47 $wpdb->prepare( … … 68 70 wp_cache_delete('askmyco_stop_requested', 'options'); 69 71 72 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- intentional cache bypass 70 73 $stop_raw = $wpdb->get_var( 71 74 $wpdb->prepare( … … 95 98 global $wpdb; 96 99 100 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery -- atomic increment to avoid race conditions 97 101 $wpdb->query( 98 102 $wpdb->prepare( -
ask-my-content/trunk/includes/settings.php
r3384523 r3414721 11 11 'manage_options', 12 12 'ask-my-content', 13 'ask _my_content_settings_page'13 'askmyco_settings_page' 14 14 ); 15 15 }); 16 16 17 function ask _my_content_settings_page()17 function askmyco_settings_page() 18 18 { 19 do_action('qm/debug', 'Called: ask_my_content_settings_page()');20 19 21 20 ?> … … 58 57 } 59 58 // 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')); 61 60 exit; 62 61 } -
ask-my-content/trunk/includes/settings_chat.php
r3384523 r3414721 6 6 7 7 // 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); 9 9 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'; 15 15 // data-amc-disabled semantics: 16 16 // - Always present on the container, with value '1' when chat should be disabled (needs indexing), … … 21 21 <hr> 22 22 <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> 24 24 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;"> 26 26 <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> 27 27 <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> 30 30 </div> 31 31 <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;"> <?php echo esc_html($ hint_text); ?></p>32 <p id="amc-admin-chat-hint" class="description" style="margin-top:4px;"> <?php echo esc_html($askmyco_hint_text); ?></p> 33 33 34 34 </div> -
ask-my-content/trunk/includes/settings_embed.php
r3384523 r3414721 11 11 update_option('askmyco_total_page_count', count(get_pages())); 12 12 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'); 15 15 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); 18 18 19 19 // One-off notice for this request … … 54 54 askmyco_safe_unschedule_single(ASKMYCO_CRON_HOOK); 55 55 } 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); 59 59 } 60 60 } … … 64 64 65 65 // 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'); 67 67 68 $ next_event = wp_next_scheduled(ASKMYCO_CRON_HOOK);68 $askmyco_next_event = wp_next_scheduled(ASKMYCO_CRON_HOOK); 69 69 70 if (! $ is_running && ! $next_event) {70 if (! $askmyco_is_running && ! $askmyco_next_event) { 71 71 askmyco_db_clear_stop_requested(); 72 72 update_option('askmyco_embedding_status', 'stopped'); … … 112 112 <tr> 113 113 <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> 116 116 <td id="amc-modified-pages">0</td> 117 117 </tr> 118 118 <tr> 119 119 <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> 122 122 <td id="amc-modified-posts">0</td> 123 123 </tr> … … 127 127 <?php 128 128 // 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'); 131 131 132 132 function askmyco_format_local_dt(?DateTimeImmutable $dt): string … … 136 136 return function_exists('wp_date') ? wp_date('Y-m-d H:i:s', $ts) : date_i18n('Y-m-d H:i:s', $ts); 137 137 } 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>';138 echo '<p><strong>Last fully indexed pages date:</strong> ' . esc_html(askmyco_format_local_dt($askmyco_pages_dt)) . '</p>'; 139 echo '<p><strong>Last fully indexed posts date:</strong> ' . esc_html(askmyco_format_local_dt($askmyco_posts_dt)) . '</p>'; 140 140 ?> 141 141 <p id="amc-status"><strong>Indexing status:</strong> <?php echo esc_html(get_option('askmyco_embedding_status', 'None')); ?></p> 142 142 143 143 <?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); 147 147 ?> 148 148 <p id="amc-counters" style="display:flex; gap: 1.5rem; align-items:center;"> 149 149 <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> 153 153 <button type="button" class="button" id="amc-refresh-counters">Refresh</button> 154 154 <span id="amc-counters-status" style="color:#666"></span> -
ask-my-content/trunk/includes/utils.php
r3384523 r3414721 31 31 return; 32 32 } 33 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log -- intentional debug logging 33 34 error_log('[AMC][' . $level . '] ' . $text); 34 35 } … … 292 293 ob_start(); 293 294 if ($type === 'header') { 295 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- core WP action 294 296 do_action('wp_head'); 295 297 } else { 298 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- core WP action 296 299 do_action('wp_footer'); 297 300 } -
ask-my-content/trunk/readme.txt
r3392460 r3414721 4 4 Requires at least: 5.8 5 5 Requires PHP: 7.4 6 Tested up to: 6. 87 Stable tag: 0. 5.16 Tested up to: 6.9 7 Stable tag: 0.6.0 8 8 License: GPL-2.0-or-later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 116 116 == Changelog == 117 117 118 = 0.6.0 = 119 Tested with WordPress 6.9 120 Fixed new Plugin Check complaints. 121 118 122 = 0.5.1 = 119 123 Improved chat error handling so the browser console surfaces the underlying API failure while the front-end shows a concise, user-friendly message. … … 125 129 = 0.4.2 = 126 130 Initial 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 3 3 "apiVersion": 3, 4 4 "name": "amc/ask-my-content", 5 "version": "0. 5.1",5 "version": "0.6.0", 6 6 "title": "Ask My Content", 7 7 "category": "widgets", -
ask-my-content/trunk/src/ask-my-content/render.php
r3384523 r3414721 10 10 } 11 11 // 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'; 22 22 23 $ style_inline = sprintf(23 $askmyco_style_inline = sprintf( 24 24 '--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 $ height25 $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 34 34 ); 35 35 36 36 // get_block_wrapper_attributes handles escaping, but style value is sanitized above; 37 37 // escape explicitly to satisfy Plugin Check. 38 $a ttrs = get_block_wrapper_attributes(['style' => esc_attr($style_inline)]);38 $askmyco_attrs = get_block_wrapper_attributes(['style' => esc_attr($askmyco_style_inline)]); 39 39 // get_block_wrapper_attributes returns a safe attribute string; style is sanitized & escaped above. 40 40 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 41 echo '<div ' . $a ttrs . '>';41 echo '<div ' . $askmyco_attrs . '>'; 42 42 if (function_exists('askmyco_get_chat_markup')) { 43 43 echo askmyco_get_chat_markup($attributes); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
Note: See TracChangeset
for help on using the changeset viewer.