Changeset 3450006
- Timestamp:
- 01/29/2026 08:45:33 PM (2 months ago)
- Location:
- caseyak
- Files:
-
- 2 deleted
- 15 edited
- 2 copied
-
tags/1.8 (copied) (copied from caseyak/trunk)
-
tags/1.8/README.txt (copied) (copied from caseyak/trunk/README.txt) (2 diffs)
-
tags/1.8/admin/class-caseyak-admin.php (modified) (9 diffs)
-
tags/1.8/admin/partials/caseyak-admin-display.php (modified) (3 diffs)
-
tags/1.8/admin/partials/caseyak-admin-new.php (modified) (2 diffs)
-
tags/1.8/caseyak.php (modified) (2 diffs)
-
tags/1.8/includes/class-caseyak-activator.php (modified) (1 diff)
-
tags/1.8/public/class-caseyak-public.php (modified) (1 diff)
-
tags/1.8/public/css (deleted)
-
tags/1.8/public/js (deleted)
-
tags/1.8/public/partials/caseyak-script.php (modified) (1 diff)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/admin/class-caseyak-admin.php (modified) (9 diffs)
-
trunk/admin/partials/caseyak-admin-display.php (modified) (3 diffs)
-
trunk/admin/partials/caseyak-admin-new.php (modified) (2 diffs)
-
trunk/caseyak.php (modified) (2 diffs)
-
trunk/includes/class-caseyak-activator.php (modified) (1 diff)
-
trunk/public/class-caseyak-public.php (modified) (1 diff)
-
trunk/public/partials/caseyak-script.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
caseyak/tags/1.8/README.txt
r3269071 r3450006 4 4 Tags: legaltech, ai, mva, pi, chatbot, legal, accident, attorney 5 5 Requires at least: 5.0.0 6 Tested up to: 6. 86 Tested up to: 6.9 7 7 Requires PHP: 7.0 8 Stable tag: 1. 78 Stable tag: 1.8 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 80 80 * Bug fixes & misc improvements 81 81 82 = 1.8 = 83 * Add chat configuration controls and sync to server. 84 82 85 = 1.6 = 83 86 * Bug fixes & misc improvements -
caseyak/tags/1.8/admin/class-caseyak-admin.php
r3065572 r3450006 55 55 } 56 56 57 private function sanitizeChatConfig( $input ) { 58 $output = array(); 59 if ( !is_array( $input ) ) { 60 return $output; 61 } 62 foreach ( $input as $key => $value ) { 63 $safe_key = sanitize_key( $key ); 64 if ( is_array( $value ) ) { 65 $output[ $safe_key ] = $this->sanitizeChatConfig( $value ); 66 } else { 67 $output[ $safe_key ] = sanitize_text_field( $value ); 68 } 69 } 70 return $output; 71 } 72 57 73 /** 58 74 * Register the stylesheets for the admin area. … … 98 114 global $wpdb; 99 115 $caseyakTable = $wpdb->prefix . 'caseyak'; 116 self::ensureSchema( $caseyakTable ); 100 117 $result = $wpdb->get_results("SELECT * FROM $caseyakTable ORDER BY updated DESC"); 101 118 if (count($result) > 0) { … … 103 120 } 104 121 return null; 122 } 123 124 private static function ensureSchema( $caseyakTable ) { 125 global $wpdb; 126 $column = $wpdb->get_results( $wpdb->prepare( "SHOW COLUMNS FROM $caseyakTable LIKE %s", 'chatConfig' ) ); 127 if ( empty( $column ) ) { 128 $wpdb->query( "ALTER TABLE $caseyakTable ADD COLUMN chatConfig LONGTEXT NULL" ); 129 } 105 130 } 106 131 … … 136 161 } 137 162 138 function processFormSubmit() {163 function processFormSubmit() { 139 164 if ( isset($_POST['action']) && $_POST['action'] == 'yak_form_response' && isset($_POST['yak_nonce']) && wp_verify_nonce( sanitize_text_field( wp_unslash ( $_POST['yak_nonce'] ) ), 'yak_nonce') ) { 140 165 … … 164 189 } 165 190 191 $chatConfig = array(); 192 if ( isset( $_POST['chat_config'] ) && is_array( $_POST['chat_config'] ) ) { 193 $chatConfig = $this->sanitizeChatConfig( $_POST['chat_config'] ); 194 } 195 $chatConfigJson = wp_json_encode( $chatConfig ); 196 166 197 $wpdb->update($caseyakTable, 167 198 array( … … 170 201 'yakContainerID' => $containerID, 171 202 'yakEnabled' => $enabled, 203 'chatConfig' => $chatConfigJson, 172 204 'updated' => time() 173 205 ), 174 206 array('ID' => $instanceID )); 207 208 // sync chat config to server (best effort) 209 if ( isset( $instanceID ) ) { 210 $instance = self::getInstance(); 211 if ( $instance && isset( $instance->subscriptionID ) ) { 212 $api_base = defined( 'CASEYAK_API_BASE' ) ? CASEYAK_API_BASE : 'https://www.pakalapp.com'; 213 $api_base = rtrim( $api_base, '/' ); 214 $sync_body = array( 215 'subscriptionID' => $instance->subscriptionID, 216 'chat_config' => $chatConfig 217 ); 218 $sync_args = array( 219 'body' => wp_json_encode( $sync_body ), 220 'timeout' => '5', 221 'redirection' => '5', 222 'httpversion' => '1.0', 223 'blocking' => true, 224 'headers' => array ( 225 'Content-Type' => 'application/json', 226 'Accept' => 'application/json' 227 ), 228 'cookies' => array(), 229 ); 230 $sync_request = wp_remote_post( $api_base . '/v1/kesu_flimr_nubs_config_update', $sync_args ); 231 if ( is_wp_error( $sync_request ) ) { 232 error_log( 'CaseYak chat_config sync failed: ' . $sync_request->get_error_message() ); 233 } else { 234 $sync_code = wp_remote_retrieve_response_code( $sync_request ); 235 if ( $sync_code != 200 ) { 236 error_log( 'CaseYak chat_config sync failed (HTTP ' . $sync_code . '): ' . wp_remote_retrieve_body( $sync_request ) ); 237 } 238 } 239 } 240 } 175 241 176 242 // // redirect … … 197 263 ); 198 264 // execute! 199 $request = wp_remote_post( 'https://www.pakalapp.com/api/v1/kesu_flimr_nubs_config', $args ); 265 $api_base = defined( 'CASEYAK_API_BASE' ) ? CASEYAK_API_BASE : 'https://www.pakalapp.com'; 266 $api_base = rtrim( $api_base, '/' ); 267 $request = wp_remote_post( $api_base . '/v1/kesu_flimr_nubs_config', $args ); 200 268 $json = json_decode( wp_remote_retrieve_body( $request ), true ); 201 269 $httpcode = wp_remote_retrieve_response_code ( $request ); 202 if( $httpcode == 200) { 270 $error_message = null; 271 if ( is_wp_error( $request ) ) { 272 $error_message = $request->get_error_message(); 273 } elseif ( $httpcode != 200 ) { 274 $error_message = 'Subscription lookup failed (HTTP ' . $httpcode . ').'; 275 } elseif ( !is_array( $json ) || empty( $json['auth_token'] ) || empty( $json['firm_id'] ) || empty( $json['slide_position'] ) ) { 276 $error_message = 'Subscription lookup failed (invalid response).'; 277 } 278 279 if ( $error_message ) { 280 error_log( 'CaseYak subscription lookup error for ' . $manualSubID . ': ' . $error_message . ' | Response: ' . wp_remote_retrieve_body( $request ) ); 281 $transient_key = 'caseyak_admin_error_' . get_current_user_id(); 282 set_transient( $transient_key, $error_message, 60 ); 283 } else { 203 284 $yakToken = $json['auth_token']; 204 285 $slidePosition = $json['slide_position']; 205 286 $firmID = $json['firm_id']; 287 $chatConfig = array(); 288 if ( isset( $json['chat_config'] ) && is_array( $json['chat_config'] ) ) { 289 $chatConfig = $json['chat_config']; 290 } 206 291 $isActive = 1; 207 292 // save in DB! … … 215 300 'yakEnabled' => true, 216 301 'yakContainerID' => '', 302 'chatConfig' => wp_json_encode( $chatConfig ), 217 303 'updated' => time() 218 304 ); … … 239 325 $subscriptionID = $instance->subscriptionID; 240 326 $lastChanged = date('m/d/Y', $instance->updated); 327 $chatConfig = array(); 328 if ( isset( $instance->chatConfig ) ) { 329 $decoded = json_decode( $instance->chatConfig, true ); 330 if ( is_array( $decoded ) ) { 331 $chatConfig = $decoded; 332 } 333 } 241 334 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/partials/caseyak-admin-display.php'; 242 335 } else { 336 $transient_key = 'caseyak_admin_error_' . get_current_user_id(); 337 $admin_error = get_transient( $transient_key ); 338 if ( $admin_error ) { 339 delete_transient( $transient_key ); 340 $error = $admin_error; 341 } 243 342 $vertical_icon = plugin_dir_url( __FILE__ ) . '/images/cy.png'; 244 343 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/partials/caseyak-admin-new.php'; -
caseyak/tags/1.8/admin/partials/caseyak-admin-display.php
r3065572 r3450006 33 33 <li><strong>Container ID:</strong> Tells the plugin to embed itself in a standalone element with this ID. Useful for standalone pages.</li> 34 34 <li><strong>Enabled:</strong> Quickly disables or enables the plugin without uninstalling via WordPress.</li> 35 <li><strong>Chat Bubble:</strong> Customize the launch bubble (background, text, and typography).</li> 36 <li><strong>Locale:</strong> Sets the language/locale (experimental).</li> 37 <li><strong>Workflow ID:</strong> Optional workflow override (experimental).</li> 35 38 </ul> 36 <div class="notification is-primary is-light" style="padding:8px;margin-top: 8px;">37 Looking for more customization options? Email us! <strong>kenny@caseyak.com</strong>38 </div>39 39 </div> 40 40 </div> … … 42 42 <input type="hidden" name="action" value="yak_form_response"> 43 43 <input type="hidden" name="yak_nonce" value="<?php echo esc_attr( wp_create_nonce( 'yak_nonce' ) ); ?>" /> 44 <?php 45 $bubble = isset( $chatConfig['bubble'] ) && is_array( $chatConfig['bubble'] ) ? $chatConfig['bubble'] : array(); 46 $chatkit = isset( $chatConfig['chatkit'] ) && is_array( $chatConfig['chatkit'] ) ? $chatConfig['chatkit'] : array(); 47 $workflow_id = isset( $chatConfig['workflow_id'] ) ? $chatConfig['workflow_id'] : ''; 48 ?> 44 49 <div class="field" style="margin-top:20px"> 45 50 <label class="label" style="margin-bottom: 0px;">Slide Position</label> … … 77 82 </p> 78 83 </div> 84 <hr> 85 <div class="field" style="margin-top:20px"> 86 <label class="label" style="margin-bottom: 0px;">Chat Bubble</label> 87 <p class="is-size-7" style="margin-bottom:10px">Customize the launch bubble.</p> 88 <div class="columns is-multiline"> 89 <div class="column is-half"> 90 <label class="label is-size-7">Background</label> 91 <input class="input is-size-7" type="text" name="chat_config[bubble][background]" value="<?php echo esc_attr( isset( $bubble['background'] ) ? $bubble['background'] : '' ); ?>" placeholder="#000000"> 92 </div> 93 <div class="column is-half"> 94 <label class="label is-size-7">Color</label> 95 <input class="input is-size-7" type="text" name="chat_config[bubble][color]" value="<?php echo esc_attr( isset( $bubble['color'] ) ? $bubble['color'] : '' ); ?>" placeholder="#ffffff"> 96 </div> 97 <div class="column is-half"> 98 <label class="label is-size-7">Font Size</label> 99 <input class="input is-size-7" type="text" name="chat_config[bubble][fontSize]" value="<?php echo esc_attr( isset( $bubble['fontSize'] ) ? $bubble['fontSize'] : '' ); ?>" placeholder="14px"> 100 </div> 101 <div class="column is-half"> 102 <label class="label is-size-7">Font Family</label> 103 <input class="input is-size-7" type="text" name="chat_config[bubble][fontFamily]" value="<?php echo esc_attr( isset( $bubble['fontFamily'] ) ? $bubble['fontFamily'] : '' ); ?>" placeholder="Arial, sans-serif"> 104 </div> 105 <div class="column is-full"> 106 <label class="label is-size-7">Bubble Text</label> 107 <input class="input is-size-7" type="text" name="chat_config[bubble][bubbleText]" value="<?php echo esc_attr( isset( $bubble['bubbleText'] ) ? $bubble['bubbleText'] : '' ); ?>" placeholder="Chat with us"> 108 </div> 109 </div> 110 </div> 111 112 <div class="field" style="margin-top:20px"> 113 <label class="label" style="margin-bottom: 0px;">Chatbot</label> 114 <p class="is-size-7" style="margin-bottom:10px">Configure Chatbot settings.</p> 115 <div class="columns is-multiline"> 116 <div class="column is-half"> 117 <label class="label is-size-7">Locale</label> 118 <input class="input is-size-7" type="text" name="chat_config[chatkit][locale]" value="<?php echo esc_attr( isset( $chatkit['locale'] ) ? $chatkit['locale'] : '' ); ?>" placeholder="en"> 119 </div> 120 </div> 121 </div> 122 123 <div class="field" style="margin-top:20px"> 124 <label class="label" style="margin-bottom: 0px;">Workflow ID</label> 125 <p class="is-size-7" style="margin-bottom:5px">Optional workflow ID override.</p> 126 <input class="input is-size-7" type="text" name="chat_config[workflow_id]" value="<?php echo esc_attr( $workflow_id ); ?>" placeholder="workflow_id"> 127 </div> 79 128 <div class="field is-grouped" style="margin-top:30px;"> 80 129 <div class="control"> -
caseyak/tags/1.8/admin/partials/caseyak-admin-new.php
r3065572 r3450006 18 18 if (isset($error)) { ?> 19 19 <div class="notification is-danger is-light" style="margin:2em;"> 20 Oops, we e countered an error?>20 Oops, we encountered an error: <?php echo esc_html( $error ); ?> 21 21 </div> 22 22 <?php } … … 70 70 </section> 71 71 <?php } 72 -
caseyak/tags/1.8/caseyak.php
r3266658 r3450006 17 17 * Plugin URI: https://caseyak.com/wordpress 18 18 * Description: The CaseYak AI Case Value Calculator. 19 * Version: 1. 719 * Version: 1.8 20 20 * Author: CaseYak 21 21 * Author URI: https://caseyak.com … … 36 36 * Rename this for your plugin and update it as you release new versions. 37 37 */ 38 define( 'CASEYAK_VERSION', '1. 7' );38 define( 'CASEYAK_VERSION', '1.8' ); 39 39 40 40 /** -
caseyak/tags/1.8/includes/class-caseyak-activator.php
r3065572 r3450006 51 51 yakEnabled BOOLEAN NOT NULL, 52 52 yakContainerID VARCHAR(255) NOT NULL, 53 chatConfig LONGTEXT NULL, 53 54 updated VARCHAR(255) NOT NULL, 54 55 PRIMARY KEY (ID) -
caseyak/tags/1.8/public/class-caseyak-public.php
r3266658 r3450006 71 71 $slidePosition = $instance->slidePosition; 72 72 $container = $instance->yakContainerID; 73 $chatConfig = array(); 74 if ( isset( $instance->chatConfig ) ) { 75 $decoded = json_decode( $instance->chatConfig, true ); 76 if ( is_array( $decoded ) ) { 77 $chatConfig = $decoded; 78 } 79 } 73 80 if ($instance->yakEnabled) { 74 81 require_once $file; -
caseyak/tags/1.8/public/partials/caseyak-script.php
r3065572 r3450006 1 1 <?php 2 2 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 3 if($expanded && $container && $container != '') { ?> 4 <script caseyak-container-id="<?php echo esc_attr($container) ?>" yak-token="<?php echo esc_attr( $token ) ?>" src='<?php echo esc_url( $mvaScript ) ?>' expanded='true'></script> 5 <?php } else { ?> 6 <script yak-token="<?php echo esc_attr($token) ?>" src='<?php echo esc_url( $mvaScript ) ?>' slide-position="<?php echo esc_attr( $slidePosition) ?>"></script> 7 <?php } 3 $workflow_id = ''; 4 if ( isset( $chatConfig['workflow_id'] ) ) { 5 $workflow_id = $chatConfig['workflow_id']; 6 } 8 7 ?> 8 <script> 9 window.__CASEYAK_CHAT_CONFIG = <?php echo wp_json_encode( $chatConfig ); ?>; 10 </script> 11 <?php if($expanded && $container && $container != '') { ?> 12 <script caseyak-container-id="<?php echo esc_attr($container) ?>" yak-token="<?php echo esc_attr( $token ) ?>" src='<?php echo esc_url( $mvaScript ) ?>' expanded='true'<?php echo $workflow_id ? " workflow-id='" . esc_attr( $workflow_id ) . "'" : ""; ?>></script> 13 <?php } else { ?> 14 <script yak-token="<?php echo esc_attr($token) ?>" src='<?php echo esc_url( $mvaScript ) ?>' slide-position="<?php echo esc_attr( $slidePosition) ?>"<?php echo $workflow_id ? " workflow-id='" . esc_attr( $workflow_id ) . "'" : ""; ?>></script> 15 <?php } ?> 16 ?> -
caseyak/trunk/README.txt
r3269071 r3450006 4 4 Tags: legaltech, ai, mva, pi, chatbot, legal, accident, attorney 5 5 Requires at least: 5.0.0 6 Tested up to: 6. 86 Tested up to: 6.9 7 7 Requires PHP: 7.0 8 Stable tag: 1. 78 Stable tag: 1.8 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 80 80 * Bug fixes & misc improvements 81 81 82 = 1.8 = 83 * Add chat configuration controls and sync to server. 84 82 85 = 1.6 = 83 86 * Bug fixes & misc improvements -
caseyak/trunk/admin/class-caseyak-admin.php
r3065572 r3450006 55 55 } 56 56 57 private function sanitizeChatConfig( $input ) { 58 $output = array(); 59 if ( !is_array( $input ) ) { 60 return $output; 61 } 62 foreach ( $input as $key => $value ) { 63 $safe_key = sanitize_key( $key ); 64 if ( is_array( $value ) ) { 65 $output[ $safe_key ] = $this->sanitizeChatConfig( $value ); 66 } else { 67 $output[ $safe_key ] = sanitize_text_field( $value ); 68 } 69 } 70 return $output; 71 } 72 57 73 /** 58 74 * Register the stylesheets for the admin area. … … 98 114 global $wpdb; 99 115 $caseyakTable = $wpdb->prefix . 'caseyak'; 116 self::ensureSchema( $caseyakTable ); 100 117 $result = $wpdb->get_results("SELECT * FROM $caseyakTable ORDER BY updated DESC"); 101 118 if (count($result) > 0) { … … 103 120 } 104 121 return null; 122 } 123 124 private static function ensureSchema( $caseyakTable ) { 125 global $wpdb; 126 $column = $wpdb->get_results( $wpdb->prepare( "SHOW COLUMNS FROM $caseyakTable LIKE %s", 'chatConfig' ) ); 127 if ( empty( $column ) ) { 128 $wpdb->query( "ALTER TABLE $caseyakTable ADD COLUMN chatConfig LONGTEXT NULL" ); 129 } 105 130 } 106 131 … … 136 161 } 137 162 138 function processFormSubmit() {163 function processFormSubmit() { 139 164 if ( isset($_POST['action']) && $_POST['action'] == 'yak_form_response' && isset($_POST['yak_nonce']) && wp_verify_nonce( sanitize_text_field( wp_unslash ( $_POST['yak_nonce'] ) ), 'yak_nonce') ) { 140 165 … … 164 189 } 165 190 191 $chatConfig = array(); 192 if ( isset( $_POST['chat_config'] ) && is_array( $_POST['chat_config'] ) ) { 193 $chatConfig = $this->sanitizeChatConfig( $_POST['chat_config'] ); 194 } 195 $chatConfigJson = wp_json_encode( $chatConfig ); 196 166 197 $wpdb->update($caseyakTable, 167 198 array( … … 170 201 'yakContainerID' => $containerID, 171 202 'yakEnabled' => $enabled, 203 'chatConfig' => $chatConfigJson, 172 204 'updated' => time() 173 205 ), 174 206 array('ID' => $instanceID )); 207 208 // sync chat config to server (best effort) 209 if ( isset( $instanceID ) ) { 210 $instance = self::getInstance(); 211 if ( $instance && isset( $instance->subscriptionID ) ) { 212 $api_base = defined( 'CASEYAK_API_BASE' ) ? CASEYAK_API_BASE : 'https://www.pakalapp.com'; 213 $api_base = rtrim( $api_base, '/' ); 214 $sync_body = array( 215 'subscriptionID' => $instance->subscriptionID, 216 'chat_config' => $chatConfig 217 ); 218 $sync_args = array( 219 'body' => wp_json_encode( $sync_body ), 220 'timeout' => '5', 221 'redirection' => '5', 222 'httpversion' => '1.0', 223 'blocking' => true, 224 'headers' => array ( 225 'Content-Type' => 'application/json', 226 'Accept' => 'application/json' 227 ), 228 'cookies' => array(), 229 ); 230 $sync_request = wp_remote_post( $api_base . '/v1/kesu_flimr_nubs_config_update', $sync_args ); 231 if ( is_wp_error( $sync_request ) ) { 232 error_log( 'CaseYak chat_config sync failed: ' . $sync_request->get_error_message() ); 233 } else { 234 $sync_code = wp_remote_retrieve_response_code( $sync_request ); 235 if ( $sync_code != 200 ) { 236 error_log( 'CaseYak chat_config sync failed (HTTP ' . $sync_code . '): ' . wp_remote_retrieve_body( $sync_request ) ); 237 } 238 } 239 } 240 } 175 241 176 242 // // redirect … … 197 263 ); 198 264 // execute! 199 $request = wp_remote_post( 'https://www.pakalapp.com/api/v1/kesu_flimr_nubs_config', $args ); 265 $api_base = defined( 'CASEYAK_API_BASE' ) ? CASEYAK_API_BASE : 'https://www.pakalapp.com'; 266 $api_base = rtrim( $api_base, '/' ); 267 $request = wp_remote_post( $api_base . '/v1/kesu_flimr_nubs_config', $args ); 200 268 $json = json_decode( wp_remote_retrieve_body( $request ), true ); 201 269 $httpcode = wp_remote_retrieve_response_code ( $request ); 202 if( $httpcode == 200) { 270 $error_message = null; 271 if ( is_wp_error( $request ) ) { 272 $error_message = $request->get_error_message(); 273 } elseif ( $httpcode != 200 ) { 274 $error_message = 'Subscription lookup failed (HTTP ' . $httpcode . ').'; 275 } elseif ( !is_array( $json ) || empty( $json['auth_token'] ) || empty( $json['firm_id'] ) || empty( $json['slide_position'] ) ) { 276 $error_message = 'Subscription lookup failed (invalid response).'; 277 } 278 279 if ( $error_message ) { 280 error_log( 'CaseYak subscription lookup error for ' . $manualSubID . ': ' . $error_message . ' | Response: ' . wp_remote_retrieve_body( $request ) ); 281 $transient_key = 'caseyak_admin_error_' . get_current_user_id(); 282 set_transient( $transient_key, $error_message, 60 ); 283 } else { 203 284 $yakToken = $json['auth_token']; 204 285 $slidePosition = $json['slide_position']; 205 286 $firmID = $json['firm_id']; 287 $chatConfig = array(); 288 if ( isset( $json['chat_config'] ) && is_array( $json['chat_config'] ) ) { 289 $chatConfig = $json['chat_config']; 290 } 206 291 $isActive = 1; 207 292 // save in DB! … … 215 300 'yakEnabled' => true, 216 301 'yakContainerID' => '', 302 'chatConfig' => wp_json_encode( $chatConfig ), 217 303 'updated' => time() 218 304 ); … … 239 325 $subscriptionID = $instance->subscriptionID; 240 326 $lastChanged = date('m/d/Y', $instance->updated); 327 $chatConfig = array(); 328 if ( isset( $instance->chatConfig ) ) { 329 $decoded = json_decode( $instance->chatConfig, true ); 330 if ( is_array( $decoded ) ) { 331 $chatConfig = $decoded; 332 } 333 } 241 334 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/partials/caseyak-admin-display.php'; 242 335 } else { 336 $transient_key = 'caseyak_admin_error_' . get_current_user_id(); 337 $admin_error = get_transient( $transient_key ); 338 if ( $admin_error ) { 339 delete_transient( $transient_key ); 340 $error = $admin_error; 341 } 243 342 $vertical_icon = plugin_dir_url( __FILE__ ) . '/images/cy.png'; 244 343 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/partials/caseyak-admin-new.php'; -
caseyak/trunk/admin/partials/caseyak-admin-display.php
r3065572 r3450006 33 33 <li><strong>Container ID:</strong> Tells the plugin to embed itself in a standalone element with this ID. Useful for standalone pages.</li> 34 34 <li><strong>Enabled:</strong> Quickly disables or enables the plugin without uninstalling via WordPress.</li> 35 <li><strong>Chat Bubble:</strong> Customize the launch bubble (background, text, and typography).</li> 36 <li><strong>Locale:</strong> Sets the language/locale (experimental).</li> 37 <li><strong>Workflow ID:</strong> Optional workflow override (experimental).</li> 35 38 </ul> 36 <div class="notification is-primary is-light" style="padding:8px;margin-top: 8px;">37 Looking for more customization options? Email us! <strong>kenny@caseyak.com</strong>38 </div>39 39 </div> 40 40 </div> … … 42 42 <input type="hidden" name="action" value="yak_form_response"> 43 43 <input type="hidden" name="yak_nonce" value="<?php echo esc_attr( wp_create_nonce( 'yak_nonce' ) ); ?>" /> 44 <?php 45 $bubble = isset( $chatConfig['bubble'] ) && is_array( $chatConfig['bubble'] ) ? $chatConfig['bubble'] : array(); 46 $chatkit = isset( $chatConfig['chatkit'] ) && is_array( $chatConfig['chatkit'] ) ? $chatConfig['chatkit'] : array(); 47 $workflow_id = isset( $chatConfig['workflow_id'] ) ? $chatConfig['workflow_id'] : ''; 48 ?> 44 49 <div class="field" style="margin-top:20px"> 45 50 <label class="label" style="margin-bottom: 0px;">Slide Position</label> … … 77 82 </p> 78 83 </div> 84 <hr> 85 <div class="field" style="margin-top:20px"> 86 <label class="label" style="margin-bottom: 0px;">Chat Bubble</label> 87 <p class="is-size-7" style="margin-bottom:10px">Customize the launch bubble.</p> 88 <div class="columns is-multiline"> 89 <div class="column is-half"> 90 <label class="label is-size-7">Background</label> 91 <input class="input is-size-7" type="text" name="chat_config[bubble][background]" value="<?php echo esc_attr( isset( $bubble['background'] ) ? $bubble['background'] : '' ); ?>" placeholder="#000000"> 92 </div> 93 <div class="column is-half"> 94 <label class="label is-size-7">Color</label> 95 <input class="input is-size-7" type="text" name="chat_config[bubble][color]" value="<?php echo esc_attr( isset( $bubble['color'] ) ? $bubble['color'] : '' ); ?>" placeholder="#ffffff"> 96 </div> 97 <div class="column is-half"> 98 <label class="label is-size-7">Font Size</label> 99 <input class="input is-size-7" type="text" name="chat_config[bubble][fontSize]" value="<?php echo esc_attr( isset( $bubble['fontSize'] ) ? $bubble['fontSize'] : '' ); ?>" placeholder="14px"> 100 </div> 101 <div class="column is-half"> 102 <label class="label is-size-7">Font Family</label> 103 <input class="input is-size-7" type="text" name="chat_config[bubble][fontFamily]" value="<?php echo esc_attr( isset( $bubble['fontFamily'] ) ? $bubble['fontFamily'] : '' ); ?>" placeholder="Arial, sans-serif"> 104 </div> 105 <div class="column is-full"> 106 <label class="label is-size-7">Bubble Text</label> 107 <input class="input is-size-7" type="text" name="chat_config[bubble][bubbleText]" value="<?php echo esc_attr( isset( $bubble['bubbleText'] ) ? $bubble['bubbleText'] : '' ); ?>" placeholder="Chat with us"> 108 </div> 109 </div> 110 </div> 111 112 <div class="field" style="margin-top:20px"> 113 <label class="label" style="margin-bottom: 0px;">Chatbot</label> 114 <p class="is-size-7" style="margin-bottom:10px">Configure Chatbot settings.</p> 115 <div class="columns is-multiline"> 116 <div class="column is-half"> 117 <label class="label is-size-7">Locale</label> 118 <input class="input is-size-7" type="text" name="chat_config[chatkit][locale]" value="<?php echo esc_attr( isset( $chatkit['locale'] ) ? $chatkit['locale'] : '' ); ?>" placeholder="en"> 119 </div> 120 </div> 121 </div> 122 123 <div class="field" style="margin-top:20px"> 124 <label class="label" style="margin-bottom: 0px;">Workflow ID</label> 125 <p class="is-size-7" style="margin-bottom:5px">Optional workflow ID override.</p> 126 <input class="input is-size-7" type="text" name="chat_config[workflow_id]" value="<?php echo esc_attr( $workflow_id ); ?>" placeholder="workflow_id"> 127 </div> 79 128 <div class="field is-grouped" style="margin-top:30px;"> 80 129 <div class="control"> -
caseyak/trunk/admin/partials/caseyak-admin-new.php
r3065572 r3450006 18 18 if (isset($error)) { ?> 19 19 <div class="notification is-danger is-light" style="margin:2em;"> 20 Oops, we e countered an error?>20 Oops, we encountered an error: <?php echo esc_html( $error ); ?> 21 21 </div> 22 22 <?php } … … 70 70 </section> 71 71 <?php } 72 -
caseyak/trunk/caseyak.php
r3266658 r3450006 17 17 * Plugin URI: https://caseyak.com/wordpress 18 18 * Description: The CaseYak AI Case Value Calculator. 19 * Version: 1. 719 * Version: 1.8 20 20 * Author: CaseYak 21 21 * Author URI: https://caseyak.com … … 36 36 * Rename this for your plugin and update it as you release new versions. 37 37 */ 38 define( 'CASEYAK_VERSION', '1. 7' );38 define( 'CASEYAK_VERSION', '1.8' ); 39 39 40 40 /** -
caseyak/trunk/includes/class-caseyak-activator.php
r3065572 r3450006 51 51 yakEnabled BOOLEAN NOT NULL, 52 52 yakContainerID VARCHAR(255) NOT NULL, 53 chatConfig LONGTEXT NULL, 53 54 updated VARCHAR(255) NOT NULL, 54 55 PRIMARY KEY (ID) -
caseyak/trunk/public/class-caseyak-public.php
r3266658 r3450006 71 71 $slidePosition = $instance->slidePosition; 72 72 $container = $instance->yakContainerID; 73 $chatConfig = array(); 74 if ( isset( $instance->chatConfig ) ) { 75 $decoded = json_decode( $instance->chatConfig, true ); 76 if ( is_array( $decoded ) ) { 77 $chatConfig = $decoded; 78 } 79 } 73 80 if ($instance->yakEnabled) { 74 81 require_once $file; -
caseyak/trunk/public/partials/caseyak-script.php
r3065572 r3450006 1 1 <?php 2 2 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 3 if($expanded && $container && $container != '') { ?> 4 <script caseyak-container-id="<?php echo esc_attr($container) ?>" yak-token="<?php echo esc_attr( $token ) ?>" src='<?php echo esc_url( $mvaScript ) ?>' expanded='true'></script> 5 <?php } else { ?> 6 <script yak-token="<?php echo esc_attr($token) ?>" src='<?php echo esc_url( $mvaScript ) ?>' slide-position="<?php echo esc_attr( $slidePosition) ?>"></script> 7 <?php } 3 $workflow_id = ''; 4 if ( isset( $chatConfig['workflow_id'] ) ) { 5 $workflow_id = $chatConfig['workflow_id']; 6 } 8 7 ?> 8 <script> 9 window.__CASEYAK_CHAT_CONFIG = <?php echo wp_json_encode( $chatConfig ); ?>; 10 </script> 11 <?php if($expanded && $container && $container != '') { ?> 12 <script caseyak-container-id="<?php echo esc_attr($container) ?>" yak-token="<?php echo esc_attr( $token ) ?>" src='<?php echo esc_url( $mvaScript ) ?>' expanded='true'<?php echo $workflow_id ? " workflow-id='" . esc_attr( $workflow_id ) . "'" : ""; ?>></script> 13 <?php } else { ?> 14 <script yak-token="<?php echo esc_attr($token) ?>" src='<?php echo esc_url( $mvaScript ) ?>' slide-position="<?php echo esc_attr( $slidePosition) ?>"<?php echo $workflow_id ? " workflow-id='" . esc_attr( $workflow_id ) . "'" : ""; ?>></script> 15 <?php } ?> 16 ?>
Note: See TracChangeset
for help on using the changeset viewer.