Changeset 3487326
- Timestamp:
- 03/20/2026 04:12:34 PM (13 days ago)
- Location:
- selektable
- Files:
-
- 10 edited
- 1 copied
-
tags/v1.10.0 (copied) (copied from selektable/trunk)
-
tags/v1.10.0/assets/js/admin.js (modified) (5 diffs)
-
tags/v1.10.0/assets/js/onboarding.js (modified) (1 diff)
-
tags/v1.10.0/includes/class-selektable-admin.php (modified) (5 diffs)
-
tags/v1.10.0/includes/class-selektable-onboarding.php (modified) (4 diffs)
-
tags/v1.10.0/selektable.php (modified) (2 diffs)
-
trunk/assets/js/admin.js (modified) (5 diffs)
-
trunk/assets/js/onboarding.js (modified) (1 diff)
-
trunk/includes/class-selektable-admin.php (modified) (5 diffs)
-
trunk/includes/class-selektable-onboarding.php (modified) (4 diffs)
-
trunk/selektable.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
selektable/tags/v1.10.0/assets/js/admin.js
r3483715 r3487326 113 113 }); 114 114 115 // Widget ID change (update shortcode)115 // Widget ID change — strip prefix if pasted, update shortcode 116 116 $(document).on('input', '#selektable-widget-id', function () { 117 var $input = $(this); 118 var val = $input.val(); 119 if (val.indexOf('wgt_') === 0) { 120 $input.val(val.substring(4)); 121 } 117 122 self.updateShortcodePreview(); 118 123 }); … … 216 221 }, 217 222 223 /** 224 * Strip a known prefix (e.g. "wgt_", "store_") from a value. 225 */ 226 stripPrefix: function (value, prefix) { 227 if (value && value.indexOf(prefix) === 0) { 228 return value.substring(prefix.length); 229 } 230 return value; 231 }, 232 218 233 populateForm: function (integration) { 219 234 $('#selektable-int-id').val(integration.id); 220 235 $('#selektable-int-type').val(integration.type); 221 $('#selektable-widget-id').val( integration.widget_id || '');236 $('#selektable-widget-id').val(this.stripPrefix(integration.widget_id || '', 'wgt_')); 222 237 $('#selektable-button-text').val(integration.button_text || 'Try it on'); 223 238 $('#selektable-button-class').val(integration.button_class || 'button selektable-try-on'); … … 294 309 295 310 updateShortcodePreview: function () { 296 var widgetId = $('#selektable-widget-id').val(); 311 var rawVal = $.trim($('#selektable-widget-id').val()); 312 var widgetId = this.stripPrefix(rawVal, 'wgt_'); 297 313 var shortcode = '[selektable_button'; 298 314 if (widgetId) { 299 shortcode += ' widget_id=" ' + widgetId + '"';315 shortcode += ' widget_id="wgt_' + widgetId + '"'; 300 316 } 301 317 shortcode += ']'; … … 317 333 saveIntegration: function () { 318 334 var self = this; 319 var widgetId = $('#selektable-widget-id').val(); 335 var rawWidgetId = $.trim($('#selektable-widget-id').val()); 336 // Strip wgt_ prefix if pasted, server will re-add it. 337 var widgetId = self.stripPrefix(rawWidgetId, 'wgt_'); 320 338 321 339 if (!widgetId) { … … 485 503 SelektableAdmin.init(); 486 504 } 505 506 // Auto-strip store_ prefix if pasted into the settings store ID input 507 $('#selektable_store_id').on('input', function () { 508 var val = $(this).val(); 509 if (val.indexOf('store_') === 0) { 510 $(this).val(val.substring(6)); 511 } 512 }); 487 513 }); 488 514 -
selektable/tags/v1.10.0/assets/js/onboarding.js
r3483715 r3487326 173 173 174 174 // ------------------------------------------------------------------ // 175 // Auto-strip prefixes when pasted into prefixed inputs // 176 // ------------------------------------------------------------------ // 177 $('#slk-store-id').on('input', function () { 178 var val = $(this).val(); 179 if (val.indexOf('store_') === 0) { 180 $(this).val(val.substring(6)); 181 } 182 }); 183 184 $('#slk-widget-id').on('input', function () { 185 var val = $(this).val(); 186 if (val.indexOf('wgt_') === 0) { 187 $(this).val(val.substring(4)); 188 } else if (val.indexOf('widget_') === 0) { 189 $(this).val(val.substring(7)); 190 } 191 }); 192 193 // ------------------------------------------------------------------ // 175 194 // Focus styles for custom input wrappers // 176 195 // ------------------------------------------------------------------ // -
selektable/tags/v1.10.0/includes/class-selektable-admin.php
r3487227 r3487326 95 95 96 96 if ($section === 'general' && isset($_POST['selektable_store_id'])) { 97 update_option('selektable_store_id', sanitize_text_field(wp_unslash($_POST['selektable_store_id']))); 97 $store_id = sanitize_text_field(wp_unslash($_POST['selektable_store_id'])); 98 $store_id = preg_replace('/^store_/', '', $store_id); 99 if (!empty($store_id)) { 100 $store_id = 'store_' . $store_id; 101 } 102 update_option('selektable_store_id', $store_id); 98 103 } 99 104 … … 114 119 $categories = $wc_active ? $this->get_product_categories() : []; 115 120 $tags = $wc_active ? $this->get_product_tags() : []; 116 $store_id = get_option('selektable_store_id', ''); 121 $store_id_raw = get_option('selektable_store_id', ''); 122 $store_id = preg_replace('/^store_/', '', $store_id_raw); 117 123 $app_url = get_option('selektable_app_url', 'https://app.selektable.com'); 118 $is_connected = !empty($store_id );124 $is_connected = !empty($store_id_raw); 119 125 $int_count = count($integrations); 120 126 $wc_int_count = count(array_filter($integrations, fn($i) => $i['type'] === 'wc_product_page')); … … 534 540 <div class="selektable-form-row"> 535 541 <label for="selektable-widget-id"><?php esc_html_e('Widget ID', 'selektable'); ?> <span class="required">*</span></label> 536 <input type="text" id="selektable-widget-id" placeholder="wgt_abc123"> 542 <div class="slk-input-prefixed"> 543 <span class="slk-input-prefix" aria-hidden="true">wgt_</span> 544 <input type="text" id="selektable-widget-id" placeholder="abc123"> 545 </div> 537 546 <p class="description"><?php esc_html_e('Your Selektable widget ID. Find this in your Selektable dashboard.', 'selektable'); ?></p> 538 547 </div> … … 832 841 $widget_id = isset($_POST['widget_id']) ? sanitize_text_field(wp_unslash($_POST['widget_id'])) : ''; 833 842 843 // Normalise: strip wgt_ prefix if pasted, then prepend it. 844 $widget_id = preg_replace('/^wgt_/', '', $widget_id); 845 834 846 // Validation - allow wc_product_page only when WooCommerce is active 835 847 $valid_types = ['shortcode']; … … 845 857 wp_send_json_error(['message' => __('Widget ID is required.', 'selektable')]); 846 858 } 859 860 // Prepend wgt_ prefix. 861 $widget_id = 'wgt_' . $widget_id; 847 862 848 863 $integrations = get_option('selektable_integrations', []); -
selektable/tags/v1.10.0/includes/class-selektable-onboarding.php
r3483770 r3487326 329 329 <label class="slk-label" for="slk-widget-id"><?php esc_html_e( 'Widget ID', 'selektable' ); ?></label> 330 330 <div class="slk-input-wrap" id="slk-widget-id-wrap"> 331 <span class="slk-input-prefix">w idget_</span>331 <span class="slk-input-prefix">wgt_</span> 332 332 <input 333 333 type="text" … … 339 339 /> 340 340 </div> 341 <p class="slk-hint"><?php esc_html_e( 'Format: w idget_xxxxxxxxx · Selektable Dashboard → Widgets → Settings', 'selektable' ); ?></p>341 <p class="slk-hint"><?php esc_html_e( 'Format: wgt_xxxxxxxxx · Selektable Dashboard → Widgets → Settings', 'selektable' ); ?></p> 342 342 </div> 343 343 … … 515 515 } 516 516 517 // Normalise: prepend store_ if not already present. 518 if ( strpos( $store_id, 'store_' ) !== 0 ) { 519 $store_id = 'store_' . $store_id; 520 } 517 // Normalise: strip store_ prefix if pasted, then prepend it. 518 $store_id = preg_replace( '/^store_/', '', $store_id ); 519 $store_id = 'store_' . $store_id; 521 520 522 521 update_option( 'selektable_store_id', $store_id ); … … 560 559 } 561 560 562 // Normalise: prepend widget_ if not already present. 563 if ( strpos( $widget_id, 'widget_' ) !== 0 ) { 564 $widget_id = 'widget_' . $widget_id; 565 } 561 // Normalise: strip wgt_ / widget_ prefix if pasted, then prepend wgt_. 562 $widget_id = preg_replace( '/^(wgt_|widget_)/', '', $widget_id ); 563 $widget_id = 'wgt_' . $widget_id; 566 564 567 565 $wc_active = selektable_is_woocommerce_active(); -
selektable/tags/v1.10.0/selektable.php
r3487227 r3487326 4 4 * Plugin URI: https://selektable.com 5 5 * Description: Integrate the Selektable widget for virtual try-on and room visualization on your WordPress site. 6 * Version: 1. 9.06 * Version: 1.10.0 7 7 * Author: Selektable 8 8 * Author URI: https://selektable.com/about … … 22 22 23 23 // Plugin constants 24 define('SELEKTABLE_VERSION', '1. 9.0');24 define('SELEKTABLE_VERSION', '1.10.0'); 25 25 define('SELEKTABLE_DB_VERSION', '1.1.0'); 26 26 define('SELEKTABLE_PLUGIN_FILE', __FILE__); -
selektable/trunk/assets/js/admin.js
r3483715 r3487326 113 113 }); 114 114 115 // Widget ID change (update shortcode)115 // Widget ID change — strip prefix if pasted, update shortcode 116 116 $(document).on('input', '#selektable-widget-id', function () { 117 var $input = $(this); 118 var val = $input.val(); 119 if (val.indexOf('wgt_') === 0) { 120 $input.val(val.substring(4)); 121 } 117 122 self.updateShortcodePreview(); 118 123 }); … … 216 221 }, 217 222 223 /** 224 * Strip a known prefix (e.g. "wgt_", "store_") from a value. 225 */ 226 stripPrefix: function (value, prefix) { 227 if (value && value.indexOf(prefix) === 0) { 228 return value.substring(prefix.length); 229 } 230 return value; 231 }, 232 218 233 populateForm: function (integration) { 219 234 $('#selektable-int-id').val(integration.id); 220 235 $('#selektable-int-type').val(integration.type); 221 $('#selektable-widget-id').val( integration.widget_id || '');236 $('#selektable-widget-id').val(this.stripPrefix(integration.widget_id || '', 'wgt_')); 222 237 $('#selektable-button-text').val(integration.button_text || 'Try it on'); 223 238 $('#selektable-button-class').val(integration.button_class || 'button selektable-try-on'); … … 294 309 295 310 updateShortcodePreview: function () { 296 var widgetId = $('#selektable-widget-id').val(); 311 var rawVal = $.trim($('#selektable-widget-id').val()); 312 var widgetId = this.stripPrefix(rawVal, 'wgt_'); 297 313 var shortcode = '[selektable_button'; 298 314 if (widgetId) { 299 shortcode += ' widget_id=" ' + widgetId + '"';315 shortcode += ' widget_id="wgt_' + widgetId + '"'; 300 316 } 301 317 shortcode += ']'; … … 317 333 saveIntegration: function () { 318 334 var self = this; 319 var widgetId = $('#selektable-widget-id').val(); 335 var rawWidgetId = $.trim($('#selektable-widget-id').val()); 336 // Strip wgt_ prefix if pasted, server will re-add it. 337 var widgetId = self.stripPrefix(rawWidgetId, 'wgt_'); 320 338 321 339 if (!widgetId) { … … 485 503 SelektableAdmin.init(); 486 504 } 505 506 // Auto-strip store_ prefix if pasted into the settings store ID input 507 $('#selektable_store_id').on('input', function () { 508 var val = $(this).val(); 509 if (val.indexOf('store_') === 0) { 510 $(this).val(val.substring(6)); 511 } 512 }); 487 513 }); 488 514 -
selektable/trunk/assets/js/onboarding.js
r3483715 r3487326 173 173 174 174 // ------------------------------------------------------------------ // 175 // Auto-strip prefixes when pasted into prefixed inputs // 176 // ------------------------------------------------------------------ // 177 $('#slk-store-id').on('input', function () { 178 var val = $(this).val(); 179 if (val.indexOf('store_') === 0) { 180 $(this).val(val.substring(6)); 181 } 182 }); 183 184 $('#slk-widget-id').on('input', function () { 185 var val = $(this).val(); 186 if (val.indexOf('wgt_') === 0) { 187 $(this).val(val.substring(4)); 188 } else if (val.indexOf('widget_') === 0) { 189 $(this).val(val.substring(7)); 190 } 191 }); 192 193 // ------------------------------------------------------------------ // 175 194 // Focus styles for custom input wrappers // 176 195 // ------------------------------------------------------------------ // -
selektable/trunk/includes/class-selektable-admin.php
r3487227 r3487326 95 95 96 96 if ($section === 'general' && isset($_POST['selektable_store_id'])) { 97 update_option('selektable_store_id', sanitize_text_field(wp_unslash($_POST['selektable_store_id']))); 97 $store_id = sanitize_text_field(wp_unslash($_POST['selektable_store_id'])); 98 $store_id = preg_replace('/^store_/', '', $store_id); 99 if (!empty($store_id)) { 100 $store_id = 'store_' . $store_id; 101 } 102 update_option('selektable_store_id', $store_id); 98 103 } 99 104 … … 114 119 $categories = $wc_active ? $this->get_product_categories() : []; 115 120 $tags = $wc_active ? $this->get_product_tags() : []; 116 $store_id = get_option('selektable_store_id', ''); 121 $store_id_raw = get_option('selektable_store_id', ''); 122 $store_id = preg_replace('/^store_/', '', $store_id_raw); 117 123 $app_url = get_option('selektable_app_url', 'https://app.selektable.com'); 118 $is_connected = !empty($store_id );124 $is_connected = !empty($store_id_raw); 119 125 $int_count = count($integrations); 120 126 $wc_int_count = count(array_filter($integrations, fn($i) => $i['type'] === 'wc_product_page')); … … 534 540 <div class="selektable-form-row"> 535 541 <label for="selektable-widget-id"><?php esc_html_e('Widget ID', 'selektable'); ?> <span class="required">*</span></label> 536 <input type="text" id="selektable-widget-id" placeholder="wgt_abc123"> 542 <div class="slk-input-prefixed"> 543 <span class="slk-input-prefix" aria-hidden="true">wgt_</span> 544 <input type="text" id="selektable-widget-id" placeholder="abc123"> 545 </div> 537 546 <p class="description"><?php esc_html_e('Your Selektable widget ID. Find this in your Selektable dashboard.', 'selektable'); ?></p> 538 547 </div> … … 832 841 $widget_id = isset($_POST['widget_id']) ? sanitize_text_field(wp_unslash($_POST['widget_id'])) : ''; 833 842 843 // Normalise: strip wgt_ prefix if pasted, then prepend it. 844 $widget_id = preg_replace('/^wgt_/', '', $widget_id); 845 834 846 // Validation - allow wc_product_page only when WooCommerce is active 835 847 $valid_types = ['shortcode']; … … 845 857 wp_send_json_error(['message' => __('Widget ID is required.', 'selektable')]); 846 858 } 859 860 // Prepend wgt_ prefix. 861 $widget_id = 'wgt_' . $widget_id; 847 862 848 863 $integrations = get_option('selektable_integrations', []); -
selektable/trunk/includes/class-selektable-onboarding.php
r3483770 r3487326 329 329 <label class="slk-label" for="slk-widget-id"><?php esc_html_e( 'Widget ID', 'selektable' ); ?></label> 330 330 <div class="slk-input-wrap" id="slk-widget-id-wrap"> 331 <span class="slk-input-prefix">w idget_</span>331 <span class="slk-input-prefix">wgt_</span> 332 332 <input 333 333 type="text" … … 339 339 /> 340 340 </div> 341 <p class="slk-hint"><?php esc_html_e( 'Format: w idget_xxxxxxxxx · Selektable Dashboard → Widgets → Settings', 'selektable' ); ?></p>341 <p class="slk-hint"><?php esc_html_e( 'Format: wgt_xxxxxxxxx · Selektable Dashboard → Widgets → Settings', 'selektable' ); ?></p> 342 342 </div> 343 343 … … 515 515 } 516 516 517 // Normalise: prepend store_ if not already present. 518 if ( strpos( $store_id, 'store_' ) !== 0 ) { 519 $store_id = 'store_' . $store_id; 520 } 517 // Normalise: strip store_ prefix if pasted, then prepend it. 518 $store_id = preg_replace( '/^store_/', '', $store_id ); 519 $store_id = 'store_' . $store_id; 521 520 522 521 update_option( 'selektable_store_id', $store_id ); … … 560 559 } 561 560 562 // Normalise: prepend widget_ if not already present. 563 if ( strpos( $widget_id, 'widget_' ) !== 0 ) { 564 $widget_id = 'widget_' . $widget_id; 565 } 561 // Normalise: strip wgt_ / widget_ prefix if pasted, then prepend wgt_. 562 $widget_id = preg_replace( '/^(wgt_|widget_)/', '', $widget_id ); 563 $widget_id = 'wgt_' . $widget_id; 566 564 567 565 $wc_active = selektable_is_woocommerce_active(); -
selektable/trunk/selektable.php
r3487227 r3487326 4 4 * Plugin URI: https://selektable.com 5 5 * Description: Integrate the Selektable widget for virtual try-on and room visualization on your WordPress site. 6 * Version: 1. 9.06 * Version: 1.10.0 7 7 * Author: Selektable 8 8 * Author URI: https://selektable.com/about … … 22 22 23 23 // Plugin constants 24 define('SELEKTABLE_VERSION', '1. 9.0');24 define('SELEKTABLE_VERSION', '1.10.0'); 25 25 define('SELEKTABLE_DB_VERSION', '1.1.0'); 26 26 define('SELEKTABLE_PLUGIN_FILE', __FILE__);
Note: See TracChangeset
for help on using the changeset viewer.