PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 8.8.0
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v8.8.0
8.8.0 8.7.9 8.7.8 8.7.7 8.7.6 8.7.5 8.7.4 8.7.3 8.7.2 8.7.1 8.7.0 8.6.9 8.6.8 8.6.7 8.6.6 8.6.5 8.6.4 8.6.2 8.6.1 8.6.0 8.5.9 8.5.8 8.5.7 8.5.6 8.5.5 All 536 releases
← All changes | includes/admin/templates/common-ai-settings.php +129 -129 8.7.3 → 8.8.0 View file →
@@ -1,129 +1,129 @@
1 -<?php
2 -if (!defined('ABSPATH')) exit; // Exit if accessed directly
3 -/**
4 - * AI settings Template for OpenAI, Gemini, OpenRouter and Grok
5 - * @package Botmaster
6 - */
7 -
8 -$wpchatbot_license_valid = get_option('wpchatbot_license_valid');
9 -// $wpchatbot_license_valid = 'starter';
10 -
11 -?>
12 -<style>
13 -.qcl-openai .qcld-row {
14 - margin-right: 0;
15 - margin-left: 0;
16 - display: flex;
17 - flex-wrap: wrap;
18 -}
19 -</style>
20 - <div class="qcl-openai">
21 - <h2 class="nav-tab-wrapper">
22 - <a href="#qcld-rate-settings-tab" class="qcld-tab-content active"><?php esc_html_e('Rate Limit', 'chatbot'); ?></a>
23 -
24 - </h2>
25 - <div id="qcld-rate-settings-tab" class="qcld-tab-content active">
26 - <div class="wrap my-4">
27 - <div class="qcld-row g-0">
28 - <div class="form-check form-switch my-4">
29 - <input class="form-check-input" type="checkbox" <?php echo ( get_option( 'is_rate_limiting_enabled' ) == 1 ) ? esc_attr( 'checked', 'chatbot') : ''; ?> role="switch" value="" id="is_rate_limiting_enabled">
30 - <label class="form-check-label" for="is_rate_limiting_enabled">
31 - <?php esc_html_e( 'Enable Rate Limiting', 'chatbot'); ?>
32 - </label>
33 - </div>
34 - </div>
35 - <div class="qcld-row g-0">
36 - <p class="text-muted">
37 - <?php esc_html_e( 'Set the maximum number of requests each user of a particular role can make to the OpenAI API within a specific period. Leave the field empty or set it to 0 for unlimited requests.', 'chatbot'); ?>
38 - </p>
39 - </div>
40 - <hr>
41 - <div class="qcld-row g-0">
42 - <div id="rate_limit_settings" <?php echo ( get_option( 'is_rate_limiting_enabled' ) != 1 ) ? esc_attr( 'style="display:none;"', 'chatbot') : ''; ?>>
43 - <p class="text-muted">
44 - <?php esc_html_e( 'Set the rate limit for each user role:', 'chatbot'); ?>
45 - </p>
46 - </div>
47 - </div>
48 - <div id="rate_limit_settings" <?php echo ( get_option( 'is_rate_limiting_enabled' ) != 1 ) ? esc_attr( 'style="display:none;"', 'chatbot') : ''; ?>> </div>
49 - <?php
50 - global $wp_roles;
51 - // Check if the global object exists and has the roles property
52 - if ( $wp_roles && property_exists( $wp_roles, 'roles' ) ) {
53 - // Loop through each role in the 'roles' array
54 - foreach ( $wp_roles->roles as $role_key => $role_details ) {
55 - $option_name = 'rate_limit_' . $role_key;
56 - $rate_limit_value = get_option( $option_name, '' );
57 - ?>
58 - <div class="qcld-row mb-4" style="margin-bottom:20px;">
59 - <div class="col-md-6">
60 - <div class="mb-3">
61 - <label for="<?php echo esc_attr( $option_name ); ?>" class="form-label">
62 - <?php
63 - /* translators: %s: Role name */
64 - printf( esc_html__( 'Rate limit for %s', 'chatbot'), esc_html( $role_details['name'] ) );
65 - ?>
66 - </label>
67 - <input type="number" class="form-control rate-limit-input" id="<?php echo esc_attr( $option_name ); ?>" value="<?php echo esc_attr( $rate_limit_value ); ?>" min="0" <?php echo ( get_option( 'is_rate_limiting_enabled' ) != 1 ) ? esc_attr( 'disabled', 'chatbot') : ''; ?>>
68 - </div>
69 - </div>
70 - <div class="col-md-6">
71 - <div class="mb-3">
72 - <label for="<?php echo esc_attr( 'Timeframe:' ); ?>" class="form-label">
73 - <?php
74 - $timeframe = get_option( 'rate_limit_timeframe_' . $role_key, '24_hours' );
75 - esc_html_e( 'Timeframe:', 'chatbot');
76 - $timeframe = intval( $timeframe ) / 3600 ; // Convert seconds back to hours for display
77 - ?>
78 - </label></br>
79 - <select class="form-select rate-limit-timeframe" id="<?php echo esc_attr( 'rate_limit_timeframe_' . $role_key ); ?>" <?php echo ( get_option( 'is_rate_limiting_enabled' ) != 1 ) ? esc_attr( 'disabled', 'chatbot') : ''; ?>>
80 - <option value="48" <?php if ( $timeframe == '48' ) echo 'selected'; ?>><?php esc_html_e( '48 Hours', 'chatbot'); ?></option>
81 - <option value="24" <?php if ( $timeframe == '24' ) echo 'selected'; ?>><?php esc_html_e( '24 Hours', 'chatbot'); ?></option>
82 - <option value="12" <?php if ( $timeframe == '12' ) echo 'selected'; ?>><?php esc_html_e( '12 Hours', 'chatbot'); ?></option>
83 - <option value="6" <?php if ( $timeframe == '6' ) echo 'selected'; ?>><?php esc_html_e( '6 Hours', 'chatbot'); ?></option>
84 - </select>
85 - </div>
86 - </div>
87 - </div>
88 - <?php
89 - }
90 - }
91 - ?>
92 - <div class="qcld-row mb-4" style="margin-bottom:20px;">
93 - <div class="col-md-6">
94 - <div class="mb-3">
95 - <label for="<?php echo esc_attr( '' ); ?>" class="form-label">
96 - <?php
97 - printf( esc_html__( 'Rate limit for ', 'chatbot') . esc_html__( 'Guest Users', 'chatbot') );
98 - ?>
99 - </label>
100 - <input type="number" class="form-control rate-limit-input" id="<?php echo esc_attr( 'rate_limit_guest' ); ?>" value="<?php echo esc_attr( get_option( 'rate_limit_guest', '' ) ); ?>" min="0" <?php echo ( get_option( 'is_rate_limiting_enabled' ) != 1 ) ? esc_attr( 'disabled', 'chatbot') : ''; ?>>
101 - </div>
102 - </div>
103 - <div class="col-md-6">
104 - <div class="mb-3">
105 - <label for="<?php echo esc_attr( 'Timeframe:' ); ?>" class="form-label">
106 - <?php
107 - esc_html_e( 'Timeframe:', 'chatbot');
108 - ?>
109 - </label></br>
110 - <select class="form-select" <?php echo ( get_option( 'is_rate_limiting_enabled' ) != 1 ) ? esc_attr( 'disabled', 'chatbot') : ''; ?>>
111 - <option value="48" disabled><?php esc_html_e( '48 Hours', 'chatbot'); ?></option>
112 - <option value="24" selected><?php esc_html_e( '24 Hours', 'chatbot'); ?></option>
113 - <option value="6" disabled><?php esc_html_e( '6 Hours', 'chatbot'); ?></option>
114 - <option value="12" disabled><?php esc_html_e( '12 Hours', 'chatbot'); ?></option>
115 - </select>
116 - </div>
117 - </div>
118 - </div>
119 -
120 - </div>
121 - <div class="wrap">
122 - <button class="qcld-btn-primary" id="qcld_openai_rate_limit_save_setting">Save Settings</button>
123 - </div>
124 - </div>
125 - <!-- <div id="qcld-other-common-tab" class="qcld-tab-content">
126 - <div class="wrap my-4">
127 - </div>
128 - </div> -->
129 -
1 +<?php
2 +if (!defined('ABSPATH')) exit; // Exit if accessed directly
3 +/**
4 + * AI settings Template for OpenAI, Gemini, OpenRouter and Grok
5 + * @package Botmaster
6 + */
7 +
8 +$wpchatbot_license_valid = get_option('wpchatbot_license_valid');
9 +// $wpchatbot_license_valid = 'starter';
10 +
11 +?>
12 +<style>
13 +.qcl-openai .qcld-row {
14 + margin-right: 0;
15 + margin-left: 0;
16 + display: flex;
17 + flex-wrap: wrap;
18 +}
19 +</style>
20 + <div class="qcl-openai">
21 + <h2 class="nav-tab-wrapper">
22 + <a href="#qcld-rate-settings-tab" class="qcld-tab-content active"><?php esc_html_e('Rate Limit', 'chatbot'); ?></a>
23 +
24 + </h2>
25 + <div id="qcld-rate-settings-tab" class="qcld-tab-content active">
26 + <div class="wrap my-4">
27 + <div class="qcld-row g-0">
28 + <div class="form-check form-switch my-4">
29 + <input class="form-check-input" type="checkbox" <?php echo ( get_option( 'is_rate_limiting_enabled' ) == 1 ) ? esc_attr( 'checked', 'chatbot') : ''; ?> role="switch" value="" id="is_rate_limiting_enabled">
30 + <label class="form-check-label" for="is_rate_limiting_enabled">
31 + <?php esc_html_e( 'Enable Rate Limiting', 'chatbot'); ?>
32 + </label>
33 + </div>
34 + </div>
35 + <div class="qcld-row g-0">
36 + <p class="text-muted">
37 + <?php esc_html_e( 'Set the maximum number of requests each user of a particular role can make to the OpenAI API within a specific period. Leave the field empty or set it to 0 for unlimited requests.', 'chatbot'); ?>
38 + </p>
39 + </div>
40 + <hr>
41 + <div class="qcld-row g-0">
42 + <div id="rate_limit_settings" <?php echo ( get_option( 'is_rate_limiting_enabled' ) != 1 ) ? esc_attr( 'style="display:none;"', 'chatbot') : ''; ?>>
43 + <p class="text-muted">
44 + <?php esc_html_e( 'Set the rate limit for each user role:', 'chatbot'); ?>
45 + </p>
46 + </div>
47 + </div>
48 + <div id="rate_limit_settings" <?php echo ( get_option( 'is_rate_limiting_enabled' ) != 1 ) ? esc_attr( 'style="display:none;"', 'chatbot') : ''; ?>> </div>
49 + <?php
50 + global $wp_roles;
51 + // Check if the global object exists and has the roles property
52 + if ( $wp_roles && property_exists( $wp_roles, 'roles' ) ) {
53 + // Loop through each role in the 'roles' array
54 + foreach ( $wp_roles->roles as $role_key => $role_details ) {
55 + $option_name = 'rate_limit_' . $role_key;
56 + $rate_limit_value = get_option( $option_name, '' );
57 + ?>
58 + <div class="qcld-row mb-4" style="margin-bottom:20px;">
59 + <div class="col-md-6">
60 + <div class="mb-3">
61 + <label for="<?php echo esc_attr( $option_name ); ?>" class="form-label">
62 + <?php
63 + /* translators: %s: Role name */
64 + printf( esc_html__( 'Rate limit for %s', 'chatbot'), esc_html( $role_details['name'] ) );
65 + ?>
66 + </label>
67 + <input type="number" class="form-control rate-limit-input" id="<?php echo esc_attr( $option_name ); ?>" value="<?php echo esc_attr( $rate_limit_value ); ?>" min="0" <?php echo ( get_option( 'is_rate_limiting_enabled' ) != 1 ) ? esc_attr( 'disabled', 'chatbot') : ''; ?>>
68 + </div>
69 + </div>
70 + <div class="col-md-6">
71 + <div class="mb-3">
72 + <label for="<?php echo esc_attr( 'Timeframe:' ); ?>" class="form-label">
73 + <?php
74 + $timeframe = get_option( 'rate_limit_timeframe_' . $role_key, '24_hours' );
75 + esc_html_e( 'Timeframe:', 'chatbot');
76 + $timeframe = intval( $timeframe ) / 3600 ; // Convert seconds back to hours for display
77 + ?>
78 + </label></br>
79 + <select class="form-select rate-limit-timeframe" id="<?php echo esc_attr( 'rate_limit_timeframe_' . $role_key ); ?>" <?php echo ( get_option( 'is_rate_limiting_enabled' ) != 1 ) ? esc_attr( 'disabled', 'chatbot') : ''; ?>>
80 + <option value="48" <?php if ( $timeframe == '48' ) echo 'selected'; ?>><?php esc_html_e( '48 Hours', 'chatbot'); ?></option>
81 + <option value="24" <?php if ( $timeframe == '24' ) echo 'selected'; ?>><?php esc_html_e( '24 Hours', 'chatbot'); ?></option>
82 + <option value="12" <?php if ( $timeframe == '12' ) echo 'selected'; ?>><?php esc_html_e( '12 Hours', 'chatbot'); ?></option>
83 + <option value="6" <?php if ( $timeframe == '6' ) echo 'selected'; ?>><?php esc_html_e( '6 Hours', 'chatbot'); ?></option>
84 + </select>
85 + </div>
86 + </div>
87 + </div>
88 + <?php
89 + }
90 + }
91 + ?>
92 + <div class="qcld-row mb-4" style="margin-bottom:20px;">
93 + <div class="col-md-6">
94 + <div class="mb-3">
95 + <label for="<?php echo esc_attr( '' ); ?>" class="form-label">
96 + <?php
97 + printf( esc_html__( 'Rate limit for ', 'chatbot') . esc_html__( 'Guest Users', 'chatbot') );
98 + ?>
99 + </label>
100 + <input type="number" class="form-control rate-limit-input" id="<?php echo esc_attr( 'rate_limit_guest' ); ?>" value="<?php echo esc_attr( get_option( 'rate_limit_guest', '' ) ); ?>" min="0" <?php echo ( get_option( 'is_rate_limiting_enabled' ) != 1 ) ? esc_attr( 'disabled', 'chatbot') : ''; ?>>
101 + </div>
102 + </div>
103 + <div class="col-md-6">
104 + <div class="mb-3">
105 + <label for="<?php echo esc_attr( 'Timeframe:' ); ?>" class="form-label">
106 + <?php
107 + esc_html_e( 'Timeframe:', 'chatbot');
108 + ?>
109 + </label></br>
110 + <select class="form-select" <?php echo ( get_option( 'is_rate_limiting_enabled' ) != 1 ) ? esc_attr( 'disabled', 'chatbot') : ''; ?>>
111 + <option value="48" disabled><?php esc_html_e( '48 Hours', 'chatbot'); ?></option>
112 + <option value="24" selected><?php esc_html_e( '24 Hours', 'chatbot'); ?></option>
113 + <option value="6" disabled><?php esc_html_e( '6 Hours', 'chatbot'); ?></option>
114 + <option value="12" disabled><?php esc_html_e( '12 Hours', 'chatbot'); ?></option>
115 + </select>
116 + </div>
117 + </div>
118 + </div>
119 +
120 + </div>
121 + <div class="wrap">
122 + <button class="qcld-btn-primary" id="qcld_openai_rate_limit_save_setting">Save Settings</button>
123 + </div>
124 + </div>
125 + <!-- <div id="qcld-other-common-tab" class="qcld-tab-content">
126 + <div class="wrap my-4">
127 + </div>
128 + </div> -->
129 +