Plugin Directory

Changeset 3352060


Ignore:
Timestamp:
08/28/2025 01:57:18 PM (7 months ago)
Author:
alphainterface
Message:

Added back settings which was missed

Location:
chat-bot-alpha-interface/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • chat-bot-alpha-interface/trunk/chat-bot-alpha_interface.php

    r3351949 r3352060  
    44 * Plugin URI: https://www.npmjs.com/package/alpha-interface
    55 * Description: Embeds the Alpha Interface chatbot into your site using a custom web component.
    6  * Version: 1.7.4
     6 * Version: 1.7.5
    77 * Author: alphainterface
    88 * Author URI: https://alphainterface.ai
     
    2020 */
    2121function ai_chatbot_enqueue_scripts() {
    22     // Register the external module script
    2322    wp_register_script(
    2423        'ai-chatbot-module',
     
    2928    );
    3029
    31     // Add type="module" attribute
     30    // Add type="module" for this script
    3231    add_filter( 'script_loader_tag', function( $tag, $handle, $src ) {
    3332        if ( 'ai-chatbot-module' === $handle ) {
     
    4241
    4342/**
    44  * Output chatbot element with saved settings.
     43 * Render chatbot in footer.
    4544 */
    4645function ai_chatbot_render() {
    47     $options = get_option( 'ai_chatbot_settings' );
     46    $options = get_option( 'ai_chatbot_settings', [] );
    4847
    4948    $apiurl        = esc_attr( $options['apiurl'] ?? 'https://hashbot.dev.clockhash.com' );
     
    6564
    6665/**
    67  * Add settings page.
     66 * Add settings page under Settings → Alpha Bot.
    6867 */
    69 function ai_chatbot_register_settings() {
     68function ai_chatbot_register_settings_page() {
    7069    add_options_page(
    7170        'Alpha Interface Bot Settings',
     
    7372        'manage_options',
    7473        'ai-chatbot-settings',
    75         'ai_chatbot_settings_page'
     74        'ai_chatbot_settings_page_html'
    7675    );
     76}
     77add_action( 'admin_menu', 'ai_chatbot_register_settings_page' );
    7778
     79/**
     80 * Register settings.
     81 */
     82function ai_chatbot_register_settings() {
    7883    register_setting( 'ai_chatbot_settings_group', 'ai_chatbot_settings' );
    7984}
    80 add_action( 'admin_menu', 'ai_chatbot_register_settings' );
     85add_action( 'admin_init', 'ai_chatbot_register_settings' );
    8186
    8287/**
    83  * Render settings page HTML.
     88 * Settings page HTML.
    8489 */
    85 function ai_chatbot_settings_page() {
     90function ai_chatbot_settings_page_html() {
     91    if ( ! current_user_can( 'manage_options' ) ) {
     92        return;
     93    }
     94
     95    $options = get_option( 'ai_chatbot_settings', [] );
    8696    ?>
    8797    <div class="wrap">
     
    8999        <form method="post" action="options.php">
    90100            <?php settings_fields( 'ai_chatbot_settings_group' ); ?>
    91             <?php $options = get_option( 'ai_chatbot_settings' ); ?>
    92101
    93             <table class="form-table">
    94                 <tr valign="top">
     102            <table class="form-table" role="presentation">
     103                <tr>
    95104                    <th scope="row">API URL</th>
    96105                    <td><input type="text" name="ai_chatbot_settings[apiurl]" value="<?php echo esc_attr( $options['apiurl'] ?? 'https://hashbot.dev.clockhash.com' ); ?>" class="regular-text" /></td>
    97106                </tr>
    98                 <tr valign="top">
     107                <tr>
    99108                    <th scope="row">Agent UUID</th>
    100109                    <td><input type="text" name="ai_chatbot_settings[agent_uuid]" value="<?php echo esc_attr( $options['agent_uuid'] ?? '' ); ?>" class="regular-text" /></td>
    101110                </tr>
    102                 <tr valign="top">
     111                <tr>
    103112                    <th scope="row">Chat ID</th>
    104113                    <td><input type="text" name="ai_chatbot_settings[chat_id]" value="<?php echo esc_attr( $options['chat_id'] ?? 'default' ); ?>" class="regular-text" /></td>
    105114                </tr>
    106                 <tr valign="top">
     115                <tr>
    107116                    <th scope="row">Icon Size</th>
    108117                    <td><input type="number" name="ai_chatbot_settings[iconsize]" value="<?php echo esc_attr( $options['iconsize'] ?? '70' ); ?>" /></td>
    109118                </tr>
    110                 <tr valign="top">
     119                <tr>
    111120                    <th scope="row">Chatbot Width</th>
    112121                    <td><input type="number" name="ai_chatbot_settings[chatbotwidth]" value="<?php echo esc_attr( $options['chatbotwidth'] ?? '300' ); ?>" /></td>
    113122                </tr>
    114                 <tr valign="top">
     123                <tr>
    115124                    <th scope="row">Chatbot Height</th>
    116125                    <td><input type="number" name="ai_chatbot_settings[chatbotheight]" value="<?php echo esc_attr( $options['chatbotheight'] ?? '400' ); ?>" /></td>
  • chat-bot-alpha-interface/trunk/readme.txt

    r3351949 r3352060  
    44Requires at least: 5.0
    55Tested up to: 6.8
    6 Stable tag: 1.7.4
     6Stable tag: 1.7.5
    77License: GPLv2 or later
    88License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    3030
    3131== Changelog ==
    32 = 1.7.4 =
     32= 1.7.5 =
    3333* Js declared as module.
    3434
Note: See TracChangeset for help on using the changeset viewer.