Changeset 3534694
- Timestamp:
- 05/17/2026 05:26:27 PM (2 months ago)
- Location:
- autocomplete-google-address
- Files:
-
- 24 edited
- 1 copied
-
tags/5.4.0 (copied) (copied from autocomplete-google-address/trunk )
-
tags/5.4.0/admin/css/admin.css (modified) (4 diffs)
-
tags/5.4.0/admin/js/admin.js (modified) (2 diffs)
-
tags/5.4.0/admin/views/html-admin-page-form-edit.php (modified) (7 diffs)
-
tags/5.4.0/autocomplete-google-address.php (modified) (2 diffs)
-
tags/5.4.0/includes/class-aga-autocomplete.php (modified) (3 diffs)
-
tags/5.4.0/includes/class-aga-elementor.php (modified) (1 diff)
-
tags/5.4.0/includes/class-aga-forms.php (modified) (2 diffs)
-
tags/5.4.0/includes/class-aga-shortcode.php (modified) (3 diffs)
-
tags/5.4.0/includes/widgets/class-aga-elementor-form-field.php (modified) (2 diffs)
-
tags/5.4.0/includes/widgets/class-aga-elementor-widget.php (modified) (2 diffs)
-
tags/5.4.0/public/js/frontend.js (modified) (4 diffs)
-
tags/5.4.0/readme.txt (modified) (2 diffs)
-
trunk/admin/css/admin.css (modified) (4 diffs)
-
trunk/admin/js/admin.js (modified) (2 diffs)
-
trunk/admin/views/html-admin-page-form-edit.php (modified) (7 diffs)
-
trunk/autocomplete-google-address.php (modified) (2 diffs)
-
trunk/includes/class-aga-autocomplete.php (modified) (3 diffs)
-
trunk/includes/class-aga-elementor.php (modified) (1 diff)
-
trunk/includes/class-aga-forms.php (modified) (2 diffs)
-
trunk/includes/class-aga-shortcode.php (modified) (3 diffs)
-
trunk/includes/widgets/class-aga-elementor-form-field.php (modified) (2 diffs)
-
trunk/includes/widgets/class-aga-elementor-widget.php (modified) (2 diffs)
-
trunk/public/js/frontend.js (modified) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
autocomplete-google-address/tags/5.4.0/admin/css/admin.css
r3495638 r3534694 346 346 position: relative; 347 347 display: inline-block; 348 flex-shrink: 0; 348 349 width: 44px; 350 min-width: 44px; 349 351 height: 24px; 352 vertical-align: middle; 353 overflow: visible; 354 box-sizing: content-box; 350 355 } 351 356 352 357 .aga-switch input { 358 position: absolute; 353 359 opacity: 0; 354 360 width: 0; 355 361 height: 0; 356 } 357 358 .aga-slider { 362 margin: 0; 363 padding: 0; 364 pointer-events: none; 365 } 366 367 .aga-switch .aga-slider { 359 368 position: absolute; 360 369 cursor: pointer; … … 363 372 right: 0; 364 373 bottom: 0; 374 width: 44px; 375 height: 24px; 365 376 background-color: var(--aga-text-muted); 366 377 transition: background-color 0.3s ease; 367 378 border-radius: var(--aga-radius-full); 368 } 369 370 .aga-slider:before { 379 box-sizing: border-box; 380 } 381 382 .aga-switch .aga-slider:before { 371 383 position: absolute; 372 384 content: ""; … … 374 386 width: 18px; 375 387 left: 3px; 376 bottom: 3px; 377 background-color: var(--aga-bg-card); 388 top: 3px; 389 bottom: auto; 390 background-color: #fff; 378 391 transition: transform 0.3s ease; 379 392 border-radius: 50%; 380 393 box-shadow: var(--aga-shadow-sm); 381 } 382 383 input:checked + .aga-slider { 394 box-sizing: border-box; 395 } 396 397 .aga-switch input:checked + .aga-slider { 384 398 background-color: var(--aga-primary); 385 399 } 386 400 387 input:checked + .aga-slider:before {401 .aga-switch input:checked + .aga-slider:before { 388 402 transform: translateX(20px); 389 403 } 390 404 391 input:focus+ .aga-slider {405 .aga-switch input:focus-visible + .aga-slider { 392 406 box-shadow: 0 0 0 3px var(--aga-primary-light); 407 } 408 409 .aga-switch input:disabled + .aga-slider { 410 cursor: not-allowed; 411 opacity: 0.55; 393 412 } 394 413 … … 2701 2720 } 2702 2721 } 2722 2723 /* ========================================================================== 2724 Mapping Mode — Pro lock preview 2725 ========================================================================== */ 2726 2727 .aga-pro-inline-callout { 2728 display: flex; 2729 align-items: center; 2730 justify-content: space-between; 2731 gap: var(--aga-space-md); 2732 padding: var(--aga-space-md); 2733 margin-bottom: var(--aga-space-md); 2734 background: linear-gradient(135deg, rgba(var(--aga-primary-rgb), 0.08), rgba(var(--aga-primary-rgb), 0.02)); 2735 border: 1px solid rgba(var(--aga-primary-rgb), 0.25); 2736 border-radius: var(--aga-radius-md); 2737 } 2738 2739 .aga-pro-inline-callout__text { 2740 display: flex; 2741 flex-direction: column; 2742 gap: 2px; 2743 min-width: 0; 2744 } 2745 2746 .aga-pro-inline-callout__text strong { 2747 color: var(--aga-text); 2748 font-size: var(--aga-font-size-sm); 2749 } 2750 2751 .aga-pro-inline-callout__text span { 2752 color: var(--aga-text-muted); 2753 font-size: var(--aga-font-size-xs); 2754 } 2755 2756 .aga-pro-inline-callout .button-primary { 2757 flex-shrink: 0; 2758 } 2759 2760 /* Locked panel: disabled inputs styled as preview */ 2761 .aga-mode-panel--locked input[type="text"], 2762 .aga-mode-panel--locked select, 2763 .aga-mode-panel--locked .aga-vst-pick-btn { 2764 opacity: 0.6; 2765 cursor: not-allowed; 2766 background-color: var(--aga-bg-subtle, #f6f7f7); 2767 } 2768 2769 .aga-mode-panel--locked .aga-vst-pick-btn:hover { 2770 background: var(--aga-bg-subtle, #f6f7f7); 2771 color: inherit; 2772 border-color: var(--aga-border); 2773 transform: none; 2774 box-shadow: none; 2775 } 2776 2777 .aga-mode-panel--locked label { 2778 color: var(--aga-text-muted); 2779 } 2780 2781 /* Inline-row variant (used inside Mapping Mode panel — no full-width border) */ 2782 .aga-toggle-row--inline { 2783 border-bottom: none; 2784 padding: var(--aga-space-sm) 0; 2785 gap: var(--aga-space-md); 2786 } 2787 2788 @media screen and (max-width: 600px) { 2789 .aga-pro-inline-callout { 2790 flex-direction: column; 2791 align-items: flex-start; 2792 } 2793 } -
autocomplete-google-address/tags/5.4.0/admin/js/admin.js
r3493591 r3534694 12 12 } 13 13 14 // ---- Mode Toggling Logic ---- 15 var modeRadios = $('input[name="Nish_aga_mode"]'); 16 var modePanels = $('.aga-mode-panel'); 17 14 // ---- Mode Toggling Logic (single mode now — kept as no-op for legacy callers) ---- 18 15 function toggleModePanels() { 19 var selectedMode = modeRadios.filter(':checked').val(); 20 modePanels.removeClass('active'); 21 $('#aga-panel-' + selectedMode).addClass('active'); 22 } 23 16 $('.aga-mode-panel').addClass('active'); 17 } 24 18 toggleModePanels(); 25 modeRadios.on('change', toggleModePanels);26 19 27 20 // ---- Settings Page Tabs ---- … … 54 47 } 55 48 56 // Switch to smart mapping mode and toggle panel 57 $('#mode_smart_mapping').prop('checked', true); 58 toggleModePanels(); 49 // Smart mapping is now the only mode — nothing to switch. 59 50 60 51 // Fill smart mapping fields -
autocomplete-google-address/tags/5.4.0/admin/views/html-admin-page-form-edit.php
r3495096 r3534694 15 15 16 16 // Get saved values 17 $mode = get_post_meta( $post->ID, 'Nish_aga_mode', true ) ?: 'single_line';17 $mode = 'smart_mapping'; 18 18 $activate_globally = metadata_exists( 'post', $post->ID, 'Nish_aga_activate_globally' ) ? get_post_meta( $post->ID, 'Nish_aga_activate_globally', true ) : '1'; 19 19 $main_selector = get_post_meta( $post->ID, 'Nish_aga_main_selector', true ); … … 27 27 $map_picker = get_post_meta( $post->ID, 'Nish_aga_map_picker', true ); 28 28 29 // Single Line30 $lat_selector = get_post_meta( $post->ID, 'Nish_aga_lat_selector', true );31 $lng_selector = get_post_meta( $post->ID, 'Nish_aga_lng_selector', true );32 $place_id_selector = get_post_meta( $post->ID, 'Nish_aga_place_id_selector', true );33 34 29 // Smart Mapping 35 30 $street_selector = get_post_meta( $post->ID, 'Nish_aga_street_selector', true ); 31 $street_full_address = get_post_meta( $post->ID, 'Nish_aga_street_full_address', true ); 36 32 $city_selector = get_post_meta( $post->ID, 'Nish_aga_city_selector', true ); 37 33 $state_selector = get_post_meta( $post->ID, 'Nish_aga_state_selector', true ); … … 218 214 </div> 219 215 <div class="aga-card-body"> 220 <div class="aga-field-group"> 221 <div class="aga-mode-selector"> 222 <input type="radio" id="mode_single_line" name="Nish_aga_mode" value="single_line" <?php checked( $mode, 'single_line' ); ?>> 223 <label for="mode_single_line"><?php esc_html_e( 'Single Line', 'autocomplete-google-address' ); ?></label> 224 <input type="radio" id="mode_smart_mapping" name="Nish_aga_mode" value="smart_mapping" <?php checked( $mode, 'smart_mapping' ); ?>> 225 <label for="mode_smart_mapping"><?php esc_html_e( 'Smart Mapping', 'autocomplete-google-address' ); ?><?php if ( ! $is_paying ) echo ' <small>(Pro)</small>'; ?></label> 226 </div> 227 </div> 228 <!-- Single Line Panel --> 229 <div id="aga-panel-single_line" class="aga-mode-panel <?php echo 'single_line' === $mode ? 'active' : ''; ?>"> 230 <p><?php esc_html_e( 'The full address goes into the trigger field. Optionally capture extra data.', 'autocomplete-google-address' ); ?></p> 231 <div class="aga-field-group"> 232 <label for="aga_lat_selector"><?php esc_html_e( 'Latitude Selector', 'autocomplete-google-address' ); ?></label> 233 <div class="aga-vst-input-row"> 234 <input type="text" id="aga_lat_selector" name="Nish_aga_lat_selector" value="<?php echo esc_attr( $lat_selector ); ?>" class="widefat" placeholder="<?php esc_attr_e( 'Optional - e.g., #lat_field', 'autocomplete-google-address' ); ?>" /> 235 <button type="button" class="aga-vst-pick-btn" title="<?php esc_attr_e( 'Click to visually select a field from your page', 'autocomplete-google-address' ); ?>"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="22" y1="12" x2="18" y2="12"/><line x1="6" y1="12" x2="2" y2="12"/><line x1="12" y1="6" x2="12" y2="2"/><line x1="12" y1="22" x2="12" y2="18"/></svg><span class="aga-vst-pick-label"><?php esc_html_e( 'Pick', 'autocomplete-google-address' ); ?></span></button> 236 </div> 237 </div> 238 <div class="aga-field-group"> 239 <label for="aga_lng_selector"><?php esc_html_e( 'Longitude Selector', 'autocomplete-google-address' ); ?></label> 240 <div class="aga-vst-input-row"> 241 <input type="text" id="aga_lng_selector" name="Nish_aga_lng_selector" value="<?php echo esc_attr( $lng_selector ); ?>" class="widefat" placeholder="<?php esc_attr_e( 'Optional - e.g., #lng_field', 'autocomplete-google-address' ); ?>" /> 242 <button type="button" class="aga-vst-pick-btn" title="<?php esc_attr_e( 'Click to visually select a field from your page', 'autocomplete-google-address' ); ?>"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="22" y1="12" x2="18" y2="12"/><line x1="6" y1="12" x2="2" y2="12"/><line x1="12" y1="6" x2="12" y2="2"/><line x1="12" y1="22" x2="12" y2="18"/></svg><span class="aga-vst-pick-label"><?php esc_html_e( 'Pick', 'autocomplete-google-address' ); ?></span></button> 243 </div> 244 </div> 245 <div class="aga-field-group"> 246 <label for="aga_place_id_selector"><?php esc_html_e( 'Place ID Selector', 'autocomplete-google-address' ); ?></label> 247 <div class="aga-vst-input-row"> 248 <input type="text" id="aga_place_id_selector" name="Nish_aga_place_id_selector" value="<?php echo esc_attr( $place_id_selector ); ?>" class="widefat" placeholder="<?php esc_attr_e( 'Optional - e.g., #place_id_field', 'autocomplete-google-address' ); ?>" /> 249 <button type="button" class="aga-vst-pick-btn" title="<?php esc_attr_e( 'Click to visually select a field from your page', 'autocomplete-google-address' ); ?>"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="22" y1="12" x2="18" y2="12"/><line x1="6" y1="12" x2="2" y2="12"/><line x1="12" y1="6" x2="12" y2="2"/><line x1="12" y1="22" x2="12" y2="18"/></svg><span class="aga-vst-pick-label"><?php esc_html_e( 'Pick', 'autocomplete-google-address' ); ?></span></button> 250 </div> 251 </div> 252 </div> 216 <input type="hidden" name="Nish_aga_mode" value="smart_mapping"> 217 <?php $disabled_attr = $is_paying ? '' : 'disabled'; ?> 253 218 <!-- Smart Mapping Panel --> 254 <div id="aga-panel-smart_mapping" class="aga-mode-panel <?php echo 'smart_mapping' === $mode ? 'active' : ''; ?>">219 <div id="aga-panel-smart_mapping" class="aga-mode-panel active<?php echo $is_paying ? '' : ' aga-mode-panel--locked'; ?>"> 255 220 <?php if ( ! $is_paying ) : ?> 256 <div class="aga-pro-banner"> 257 <h3><?php esc_html_e( 'Unlock Smart Mapping', 'autocomplete-google-address' ); ?></h3> 258 <p><?php esc_html_e( 'Split addresses into Street, City, State, Zip, and Country fields automatically.', 'autocomplete-google-address' ); ?></p> 259 <a href="<?php echo esc_url( $checkout_url ); ?>" target="_blank" class="button"><?php esc_html_e( 'Upgrade to Pro', 'autocomplete-google-address' ); ?></a> 221 <div class="aga-pro-inline-callout"> 222 <div class="aga-pro-inline-callout__text"> 223 <strong><?php esc_html_e( 'Mapping Mode is a Pro feature.', 'autocomplete-google-address' ); ?></strong> 224 <span><?php esc_html_e( 'Preview the fields below — upgrade to enable them.', 'autocomplete-google-address' ); ?></span> 225 </div> 226 <a href="<?php echo esc_url( $checkout_url ); ?>" target="_blank" class="button button-primary"><?php esc_html_e( 'Upgrade to Pro', 'autocomplete-google-address' ); ?></a> 260 227 </div> 261 228 <?php else : ?> 262 229 <p><?php esc_html_e( 'Map each address component to your form fields.', 'autocomplete-google-address' ); ?></p> 230 <?php endif; ?> 231 232 <div class="aga-toggle-row aga-toggle-row--inline aga-mb-sm"> 233 <div class="aga-toggle-row-info"> 234 <strong><?php esc_html_e( 'Full Address in Street Field', 'autocomplete-google-address' ); ?></strong> 235 <span class="aga-toggle-desc"><?php esc_html_e( 'When enabled, the entire formatted address is written into the Street selector instead of only the street component.', 'autocomplete-google-address' ); ?></span> 236 </div> 237 <label class="aga-switch"> 238 <input type="checkbox" id="aga_street_full_address" name="Nish_aga_street_full_address" value="1" <?php checked( $street_full_address, '1' ); ?> <?php echo $disabled_attr; ?>> 239 <span class="aga-slider"></span> 240 </label> 241 </div> 242 263 243 <div class="aga-mapping-grid"> 264 244 <?php … … 277 257 <label for="<?php echo esc_attr( $field['id'] ); ?>"><?php echo esc_html( $field['label'] ); ?></label> 278 258 <div class="aga-vst-input-row"> 279 <input type="text" id="<?php echo esc_attr( $field['id'] ); ?>" name="<?php echo esc_attr( $field['name'] ); ?>" value="<?php echo esc_attr( $field['value'] ); ?>" class="widefat" placeholder="#id, .class, [name='field']" />280 <button type="button" class="aga-vst-pick-btn" title="<?php esc_attr_e( 'Click to visually select a field from your page', 'autocomplete-google-address' ); ?>" ><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="22" y1="12" x2="18" y2="12"/><line x1="6" y1="12" x2="2" y2="12"/><line x1="12" y1="6" x2="12" y2="2"/><line x1="12" y1="22" x2="12" y2="18"/></svg><span class="aga-vst-pick-label"><?php esc_html_e( 'Pick', 'autocomplete-google-address' ); ?></span></button>259 <input type="text" id="<?php echo esc_attr( $field['id'] ); ?>" name="<?php echo esc_attr( $field['name'] ); ?>" value="<?php echo esc_attr( $field['value'] ); ?>" class="widefat" placeholder="#id, .class, [name='field']" <?php echo $disabled_attr; ?> /> 260 <button type="button" class="aga-vst-pick-btn" title="<?php esc_attr_e( 'Click to visually select a field from your page', 'autocomplete-google-address' ); ?>" <?php echo $disabled_attr; ?>><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="22" y1="12" x2="18" y2="12"/><line x1="6" y1="12" x2="2" y2="12"/><line x1="12" y1="6" x2="12" y2="2"/><line x1="12" y1="22" x2="12" y2="18"/></svg><span class="aga-vst-pick-label"><?php esc_html_e( 'Pick', 'autocomplete-google-address' ); ?></span></button> 281 261 </div> 282 262 </div> … … 288 268 <div class="aga-field-group"> 289 269 <label for="aga_state_format"><?php esc_html_e( 'State Format', 'autocomplete-google-address' ); ?></label> 290 <select id="aga_state_format" name="Nish_aga_state_format" >270 <select id="aga_state_format" name="Nish_aga_state_format" <?php echo $disabled_attr; ?>> 291 271 <option value="long" <?php selected( $state_format, 'long' ); ?>><?php esc_html_e( 'Long Name (e.g., California)', 'autocomplete-google-address' ); ?></option> 292 272 <option value="short" <?php selected( $state_format, 'short' ); ?>><?php esc_html_e( 'Short Name (e.g., CA)', 'autocomplete-google-address' ); ?></option> … … 295 275 <div class="aga-field-group"> 296 276 <label for="aga_country_format"><?php esc_html_e( 'Country Format', 'autocomplete-google-address' ); ?></label> 297 <select id="aga_country_format" name="Nish_aga_country_format" >277 <select id="aga_country_format" name="Nish_aga_country_format" <?php echo $disabled_attr; ?>> 298 278 <option value="long" <?php selected( $country_format, 'long' ); ?>><?php esc_html_e( 'Long Name (e.g., United States)', 'autocomplete-google-address' ); ?></option> 299 279 <option value="short" <?php selected( $country_format, 'short' ); ?>><?php esc_html_e( 'Short Name (e.g., US)', 'autocomplete-google-address' ); ?></option> … … 301 281 </div> 302 282 </div> 303 <?php endif; ?>304 283 </div> 305 284 </div> -
autocomplete-google-address/tags/5.4.0/autocomplete-google-address.php
r3529084 r3534694 5 5 * Plugin URI: https://wordpress.org/plugins/autocomplete-google-address/ 6 6 * Description: Add Google Places address autocomplete to any existing form in WordPress using a selector-based mapping builder. 7 * Version: 5. 3.57 * Version: 5.4.0 8 8 * Author: Md Nishath Khandakar 9 9 * Author URI: https://profiles.wordpress.org/nishatbd31/ … … 58 58 * Currently plugin version. 59 59 */ 60 define( 'AGA_VERSION', '5. 3.5' );60 define( 'AGA_VERSION', '5.4.0' ); 61 61 /** 62 62 * Plugin directory path. -
autocomplete-google-address/tags/5.4.0/includes/class-aga-autocomplete.php
r3493591 r3534694 26 26 27 27 $mode = get_post_meta( $form_id, 'Nish_aga_mode', true ); 28 if ( 'smart_mapping' !== $mode ) { 29 $mode = 'smart_mapping'; 30 } 28 31 $main_selector = get_post_meta( $form_id, 'Nish_aga_main_selector', true ); 29 32 … … 38 41 $is_paying = function_exists( 'google_autocomplete' ) && google_autocomplete()->is_paying(); 39 42 40 if ( 'single_line' === $mode ) { 41 $config['selectors']['lat'] = get_post_meta( $form_id, 'Nish_aga_lat_selector', true ); 42 $config['selectors']['lng'] = get_post_meta( $form_id, 'Nish_aga_lng_selector', true ); 43 $config['selectors']['place_id'] = get_post_meta( $form_id, 'Nish_aga_place_id_selector', true ); 44 } elseif ( 'smart_mapping' === $mode && $is_paying ) { 43 if ( $is_paying ) { 45 44 $config['selectors']['street'] = get_post_meta( $form_id, 'Nish_aga_street_selector', true ); 46 45 $config['selectors']['city'] = get_post_meta( $form_id, 'Nish_aga_city_selector', true ); … … 51 50 $config['selectors']['lng'] = get_post_meta( $form_id, 'Nish_aga_map_lng_selector', true ); 52 51 $config['selectors']['place_id'] = get_post_meta( $form_id, 'Nish_aga_smart_place_id_selector', true ); 53 52 54 53 $config['formats'] = array( 55 54 'state' => get_post_meta( $form_id, 'Nish_aga_state_format', true ) ?: 'long', 56 55 'country' => get_post_meta( $form_id, 'Nish_aga_country_format', true ) ?: 'long', 57 56 ); 57 58 $config['street_full_address'] = ( '1' === get_post_meta( $form_id, 'Nish_aga_street_full_address', true ) ); 58 59 } 59 60 -
autocomplete-google-address/tags/5.4.0/includes/class-aga-elementor.php
r3488484 r3534694 160 160 var itemClasses = _.escape(item.css_classes) || ''; 161 161 var required = item.required ? 'required' : ''; 162 var mode = item.aga_mode || 's ingle_line';162 var mode = item.aga_mode || 'smart_mapping'; 163 163 164 164 var html = '<input size=\"1\" type=\"text\" class=\"elementor-field elementor-field-textual elementor-size-' + inputSize + ' ' + itemClasses + '\" name=\"form_field_' + i + '\" id=\"form_field_' + i + '\" ' + required + ' placeholder=\"' + placeholder + '\" autocomplete=\"off\">'; -
autocomplete-google-address/tags/5.4.0/includes/class-aga-forms.php
r3493591 r3534694 199 199 ); 200 200 201 update_post_meta( 202 $post_id, 203 'Nish_aga_street_full_address', 204 isset( $_POST['Nish_aga_street_full_address'] ) ? '1' : '' 205 ); 206 201 207 if ( isset( $_POST['Nish_aga_load_on_pages'] ) && is_array( $_POST['Nish_aga_load_on_pages'] ) ) { 202 208 update_post_meta( … … 289 295 290 296 if ( 'aga_mode' === $column ) { 291 $mode = get_post_meta( $post_id, 'Nish_aga_mode', true ); 292 echo esc_html( 293 $mode === 'single_line' 294 ? 'Single Line' 295 : ( $mode === 'smart_mapping' ? 'Smart Mapping' : 'None' ) 296 ); 297 $is_paying = function_exists( 'google_autocomplete' ) && google_autocomplete()->is_paying(); 298 echo esc_html( $is_paying ? 'Smart Mapping' : 'Smart Mapping (Pro)' ); 297 299 } 298 300 -
autocomplete-google-address/tags/5.4.0/includes/class-aga-shortcode.php
r3493591 r3534694 52 52 'placeholder' => 'Start typing an address...', 53 53 'label' => '', 54 'mode' => 's ingle_line',54 'mode' => 'smart_mapping', 55 55 'country' => '', 56 56 'show_map' => 'false', … … 98 98 99 99 // Build the HTML. 100 $mode = ! empty( $config['mode'] ) ? $config['mode'] : 's ingle_line';100 $mode = ! empty( $config['mode'] ) ? $config['mode'] : 'smart_mapping'; 101 101 $show_map = ! empty( $config['map_picker'] ); 102 102 $wrapper_class = 'aga-shortcode-wrapper'; … … 127 127 */ 128 128 private function render_standalone( $instance_id, $atts ) { 129 $mode = in_array( $atts['mode'], array( 'single_line', 'smart_mapping' ), true ) ? $atts['mode'] : 'single_line'; 129 $is_paying = function_exists( 'google_autocomplete' ) && google_autocomplete()->is_paying(); 130 // Smart Mapping is Pro-only — fall back to plain single-line for free users. 131 $mode = $is_paying ? 'smart_mapping' : 'single_line'; 130 132 $show_map = 'true' === strtolower( $atts['show_map'] ); 131 133 -
autocomplete-google-address/tags/5.4.0/includes/widgets/class-aga-elementor-form-field.php
r3493591 r3534694 53 53 'name' => 'aga_mode', 54 54 'label' => esc_html__( 'Mode', 'autocomplete-google-address' ), 55 'type' => \Elementor\Controls_Manager::SELECT, 56 'default' => 'single_line', 57 'options' => array( 58 'single_line' => esc_html__( 'Single Line', 'autocomplete-google-address' ), 59 'smart_mapping' => $is_paying 60 ? esc_html__( 'Smart Mapping', 'autocomplete-google-address' ) 61 : esc_html__( 'Smart Mapping (Pro)', 'autocomplete-google-address' ), 62 ), 55 'type' => \Elementor\Controls_Manager::HIDDEN, 56 'default' => 'smart_mapping', 63 57 'condition' => $condition, 64 58 ) ), … … 161 155 $is_paying = function_exists( 'google_autocomplete' ) && google_autocomplete()->is_paying(); 162 156 163 $mode = ! empty( $item['aga_mode'] ) ? $item['aga_mode'] : 'single_line'; 164 if ( 'smart_mapping' === $mode && ! $is_paying ) { 165 $mode = 'single_line'; 166 } 157 // Smart Mapping is Pro-only — fall back to plain single-line for free users. 158 $mode = $is_paying ? 'smart_mapping' : 'single_line'; 167 159 168 160 $input_size = ! empty( $item['input_size'] ) ? $item['input_size'] : 'sm'; -
autocomplete-google-address/tags/5.4.0/includes/widgets/class-aga-elementor-widget.php
r3493591 r3534694 92 92 ); 93 93 94 $mode_options = array(95 'single_line' => esc_html__( 'Single Line', 'autocomplete-google-address' ),96 );97 if ( $is_paying ) {98 $mode_options['smart_mapping'] = esc_html__( 'Smart Mapping', 'autocomplete-google-address' );99 } else {100 $mode_options['smart_mapping'] = esc_html__( 'Smart Mapping (Pro)', 'autocomplete-google-address' );101 }102 103 94 $this->add_control( 104 95 'mode', 105 96 array( 106 97 'label' => esc_html__( 'Mode', 'autocomplete-google-address' ), 107 'type' => \Elementor\Controls_Manager::SELECT, 108 'default' => 'single_line', 109 'options' => $mode_options, 98 'type' => \Elementor\Controls_Manager::HIDDEN, 99 'default' => 'smart_mapping', 110 100 ) 111 101 ); … … 375 365 $instance_id = 'aga-el-' . $widget_id; 376 366 377 // Determine effective mode — fall back to single_line for free users. 378 $mode = $settings['mode']; 379 if ( 'smart_mapping' === $mode && ! $is_paying ) { 380 $mode = 'single_line'; 381 } 367 // Smart Mapping is Pro-only — fall back to plain single-line for free users. 368 $mode = $is_paying ? 'smart_mapping' : 'single_line'; 382 369 383 370 $show_map = $is_paying && 'yes' === ( $settings['show_map'] ?? '' ); -
autocomplete-google-address/tags/5.4.0/public/js/frontend.js
r3529084 r3534694 1021 1021 if (config.mode === 'smart_mapping' && result.address_components) { 1022 1022 var components = aga.parseReverseComponents(result.address_components); 1023 aga.applyParsedComponents(components, config, mainInput );1023 aga.applyParsedComponents(components, config, mainInput, result.formatted_address || ''); 1024 1024 } 1025 1025 … … 1077 1077 }, 1078 1078 1079 applyParsedComponents: function (components, config, mainInput ) {1079 applyParsedComponents: function (components, config, mainInput, formattedAddress) { 1080 1080 var countryCode = components.country_short || ''; 1081 1081 var countryName = components.country_long || ''; … … 1104 1104 1105 1105 if (config.selectors.street) { 1106 aga.setFieldValue(config.selectors.street, (components.street_number + ' ' + components.route).trim(), undefined, mainInput); 1106 var streetValue = (config.street_full_address && formattedAddress) 1107 ? formattedAddress 1108 : (components.street_number + ' ' + components.route).trim(); 1109 aga.setFieldValue(config.selectors.street, streetValue, undefined, mainInput); 1107 1110 } 1108 1111 if (config.selectors.city) { … … 1288 1291 1289 1292 if (config.selectors.street) { 1290 aga.setFieldValue(config.selectors.street, (components.street_number + ' ' + components.route).trim(), undefined, mainInput); 1293 var streetValue = (config.street_full_address && place.formattedAddress) 1294 ? place.formattedAddress 1295 : (components.street_number + ' ' + components.route).trim(); 1296 aga.setFieldValue(config.selectors.street, streetValue, undefined, mainInput); 1291 1297 } 1292 1298 -
autocomplete-google-address/tags/5.4.0/readme.txt
r3529084 r3534694 4 4 Requires at least: 5.4 5 5 Tested up to: 6.9 6 Stable tag: 5. 3.56 Stable tag: 5.4.0 7 7 Requires PHP: 7.2 8 8 License: GPL-2.0-or-later … … 291 291 == Changelog == 292 292 293 = 5.4.0 = 294 * CHANGED: Mapping Mode is now a single unified Pro feature — the legacy "Single Line" option has been removed. Free users see a locked preview of all mapping fields with an upgrade prompt; Pro users get the full configurator. 295 * NEW: "Full Address in Street Field" toggle (Pro) — when enabled, the entire formatted address is written into the Street selector instead of only the street component. Useful when your form has a single visible address field but you still want all the structured data. 296 * IMPROVED: Mapping Mode card redesigned — disabled-input preview for free users so the available fields and toggle are visible at a glance. 297 * FIX: Toggle switches no longer overflow their track on the form-edit page; thumb stays inside the track in all admin themes. 298 293 299 = 5.3.5 = 294 300 * NEW: Country blocklist support — when WooCommerce is configured to sell only to specific countries, selecting an unsupported country address now shows a clear "We do not ship to [Country]" error badge and blocks checkout submission. -
autocomplete-google-address/trunk/admin/css/admin.css
r3495638 r3534694 346 346 position: relative; 347 347 display: inline-block; 348 flex-shrink: 0; 348 349 width: 44px; 350 min-width: 44px; 349 351 height: 24px; 352 vertical-align: middle; 353 overflow: visible; 354 box-sizing: content-box; 350 355 } 351 356 352 357 .aga-switch input { 358 position: absolute; 353 359 opacity: 0; 354 360 width: 0; 355 361 height: 0; 356 } 357 358 .aga-slider { 362 margin: 0; 363 padding: 0; 364 pointer-events: none; 365 } 366 367 .aga-switch .aga-slider { 359 368 position: absolute; 360 369 cursor: pointer; … … 363 372 right: 0; 364 373 bottom: 0; 374 width: 44px; 375 height: 24px; 365 376 background-color: var(--aga-text-muted); 366 377 transition: background-color 0.3s ease; 367 378 border-radius: var(--aga-radius-full); 368 } 369 370 .aga-slider:before { 379 box-sizing: border-box; 380 } 381 382 .aga-switch .aga-slider:before { 371 383 position: absolute; 372 384 content: ""; … … 374 386 width: 18px; 375 387 left: 3px; 376 bottom: 3px; 377 background-color: var(--aga-bg-card); 388 top: 3px; 389 bottom: auto; 390 background-color: #fff; 378 391 transition: transform 0.3s ease; 379 392 border-radius: 50%; 380 393 box-shadow: var(--aga-shadow-sm); 381 } 382 383 input:checked + .aga-slider { 394 box-sizing: border-box; 395 } 396 397 .aga-switch input:checked + .aga-slider { 384 398 background-color: var(--aga-primary); 385 399 } 386 400 387 input:checked + .aga-slider:before {401 .aga-switch input:checked + .aga-slider:before { 388 402 transform: translateX(20px); 389 403 } 390 404 391 input:focus+ .aga-slider {405 .aga-switch input:focus-visible + .aga-slider { 392 406 box-shadow: 0 0 0 3px var(--aga-primary-light); 407 } 408 409 .aga-switch input:disabled + .aga-slider { 410 cursor: not-allowed; 411 opacity: 0.55; 393 412 } 394 413 … … 2701 2720 } 2702 2721 } 2722 2723 /* ========================================================================== 2724 Mapping Mode — Pro lock preview 2725 ========================================================================== */ 2726 2727 .aga-pro-inline-callout { 2728 display: flex; 2729 align-items: center; 2730 justify-content: space-between; 2731 gap: var(--aga-space-md); 2732 padding: var(--aga-space-md); 2733 margin-bottom: var(--aga-space-md); 2734 background: linear-gradient(135deg, rgba(var(--aga-primary-rgb), 0.08), rgba(var(--aga-primary-rgb), 0.02)); 2735 border: 1px solid rgba(var(--aga-primary-rgb), 0.25); 2736 border-radius: var(--aga-radius-md); 2737 } 2738 2739 .aga-pro-inline-callout__text { 2740 display: flex; 2741 flex-direction: column; 2742 gap: 2px; 2743 min-width: 0; 2744 } 2745 2746 .aga-pro-inline-callout__text strong { 2747 color: var(--aga-text); 2748 font-size: var(--aga-font-size-sm); 2749 } 2750 2751 .aga-pro-inline-callout__text span { 2752 color: var(--aga-text-muted); 2753 font-size: var(--aga-font-size-xs); 2754 } 2755 2756 .aga-pro-inline-callout .button-primary { 2757 flex-shrink: 0; 2758 } 2759 2760 /* Locked panel: disabled inputs styled as preview */ 2761 .aga-mode-panel--locked input[type="text"], 2762 .aga-mode-panel--locked select, 2763 .aga-mode-panel--locked .aga-vst-pick-btn { 2764 opacity: 0.6; 2765 cursor: not-allowed; 2766 background-color: var(--aga-bg-subtle, #f6f7f7); 2767 } 2768 2769 .aga-mode-panel--locked .aga-vst-pick-btn:hover { 2770 background: var(--aga-bg-subtle, #f6f7f7); 2771 color: inherit; 2772 border-color: var(--aga-border); 2773 transform: none; 2774 box-shadow: none; 2775 } 2776 2777 .aga-mode-panel--locked label { 2778 color: var(--aga-text-muted); 2779 } 2780 2781 /* Inline-row variant (used inside Mapping Mode panel — no full-width border) */ 2782 .aga-toggle-row--inline { 2783 border-bottom: none; 2784 padding: var(--aga-space-sm) 0; 2785 gap: var(--aga-space-md); 2786 } 2787 2788 @media screen and (max-width: 600px) { 2789 .aga-pro-inline-callout { 2790 flex-direction: column; 2791 align-items: flex-start; 2792 } 2793 } -
autocomplete-google-address/trunk/admin/js/admin.js
r3493591 r3534694 12 12 } 13 13 14 // ---- Mode Toggling Logic ---- 15 var modeRadios = $('input[name="Nish_aga_mode"]'); 16 var modePanels = $('.aga-mode-panel'); 17 14 // ---- Mode Toggling Logic (single mode now — kept as no-op for legacy callers) ---- 18 15 function toggleModePanels() { 19 var selectedMode = modeRadios.filter(':checked').val(); 20 modePanels.removeClass('active'); 21 $('#aga-panel-' + selectedMode).addClass('active'); 22 } 23 16 $('.aga-mode-panel').addClass('active'); 17 } 24 18 toggleModePanels(); 25 modeRadios.on('change', toggleModePanels);26 19 27 20 // ---- Settings Page Tabs ---- … … 54 47 } 55 48 56 // Switch to smart mapping mode and toggle panel 57 $('#mode_smart_mapping').prop('checked', true); 58 toggleModePanels(); 49 // Smart mapping is now the only mode — nothing to switch. 59 50 60 51 // Fill smart mapping fields -
autocomplete-google-address/trunk/admin/views/html-admin-page-form-edit.php
r3495096 r3534694 15 15 16 16 // Get saved values 17 $mode = get_post_meta( $post->ID, 'Nish_aga_mode', true ) ?: 'single_line';17 $mode = 'smart_mapping'; 18 18 $activate_globally = metadata_exists( 'post', $post->ID, 'Nish_aga_activate_globally' ) ? get_post_meta( $post->ID, 'Nish_aga_activate_globally', true ) : '1'; 19 19 $main_selector = get_post_meta( $post->ID, 'Nish_aga_main_selector', true ); … … 27 27 $map_picker = get_post_meta( $post->ID, 'Nish_aga_map_picker', true ); 28 28 29 // Single Line30 $lat_selector = get_post_meta( $post->ID, 'Nish_aga_lat_selector', true );31 $lng_selector = get_post_meta( $post->ID, 'Nish_aga_lng_selector', true );32 $place_id_selector = get_post_meta( $post->ID, 'Nish_aga_place_id_selector', true );33 34 29 // Smart Mapping 35 30 $street_selector = get_post_meta( $post->ID, 'Nish_aga_street_selector', true ); 31 $street_full_address = get_post_meta( $post->ID, 'Nish_aga_street_full_address', true ); 36 32 $city_selector = get_post_meta( $post->ID, 'Nish_aga_city_selector', true ); 37 33 $state_selector = get_post_meta( $post->ID, 'Nish_aga_state_selector', true ); … … 218 214 </div> 219 215 <div class="aga-card-body"> 220 <div class="aga-field-group"> 221 <div class="aga-mode-selector"> 222 <input type="radio" id="mode_single_line" name="Nish_aga_mode" value="single_line" <?php checked( $mode, 'single_line' ); ?>> 223 <label for="mode_single_line"><?php esc_html_e( 'Single Line', 'autocomplete-google-address' ); ?></label> 224 <input type="radio" id="mode_smart_mapping" name="Nish_aga_mode" value="smart_mapping" <?php checked( $mode, 'smart_mapping' ); ?>> 225 <label for="mode_smart_mapping"><?php esc_html_e( 'Smart Mapping', 'autocomplete-google-address' ); ?><?php if ( ! $is_paying ) echo ' <small>(Pro)</small>'; ?></label> 226 </div> 227 </div> 228 <!-- Single Line Panel --> 229 <div id="aga-panel-single_line" class="aga-mode-panel <?php echo 'single_line' === $mode ? 'active' : ''; ?>"> 230 <p><?php esc_html_e( 'The full address goes into the trigger field. Optionally capture extra data.', 'autocomplete-google-address' ); ?></p> 231 <div class="aga-field-group"> 232 <label for="aga_lat_selector"><?php esc_html_e( 'Latitude Selector', 'autocomplete-google-address' ); ?></label> 233 <div class="aga-vst-input-row"> 234 <input type="text" id="aga_lat_selector" name="Nish_aga_lat_selector" value="<?php echo esc_attr( $lat_selector ); ?>" class="widefat" placeholder="<?php esc_attr_e( 'Optional - e.g., #lat_field', 'autocomplete-google-address' ); ?>" /> 235 <button type="button" class="aga-vst-pick-btn" title="<?php esc_attr_e( 'Click to visually select a field from your page', 'autocomplete-google-address' ); ?>"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="22" y1="12" x2="18" y2="12"/><line x1="6" y1="12" x2="2" y2="12"/><line x1="12" y1="6" x2="12" y2="2"/><line x1="12" y1="22" x2="12" y2="18"/></svg><span class="aga-vst-pick-label"><?php esc_html_e( 'Pick', 'autocomplete-google-address' ); ?></span></button> 236 </div> 237 </div> 238 <div class="aga-field-group"> 239 <label for="aga_lng_selector"><?php esc_html_e( 'Longitude Selector', 'autocomplete-google-address' ); ?></label> 240 <div class="aga-vst-input-row"> 241 <input type="text" id="aga_lng_selector" name="Nish_aga_lng_selector" value="<?php echo esc_attr( $lng_selector ); ?>" class="widefat" placeholder="<?php esc_attr_e( 'Optional - e.g., #lng_field', 'autocomplete-google-address' ); ?>" /> 242 <button type="button" class="aga-vst-pick-btn" title="<?php esc_attr_e( 'Click to visually select a field from your page', 'autocomplete-google-address' ); ?>"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="22" y1="12" x2="18" y2="12"/><line x1="6" y1="12" x2="2" y2="12"/><line x1="12" y1="6" x2="12" y2="2"/><line x1="12" y1="22" x2="12" y2="18"/></svg><span class="aga-vst-pick-label"><?php esc_html_e( 'Pick', 'autocomplete-google-address' ); ?></span></button> 243 </div> 244 </div> 245 <div class="aga-field-group"> 246 <label for="aga_place_id_selector"><?php esc_html_e( 'Place ID Selector', 'autocomplete-google-address' ); ?></label> 247 <div class="aga-vst-input-row"> 248 <input type="text" id="aga_place_id_selector" name="Nish_aga_place_id_selector" value="<?php echo esc_attr( $place_id_selector ); ?>" class="widefat" placeholder="<?php esc_attr_e( 'Optional - e.g., #place_id_field', 'autocomplete-google-address' ); ?>" /> 249 <button type="button" class="aga-vst-pick-btn" title="<?php esc_attr_e( 'Click to visually select a field from your page', 'autocomplete-google-address' ); ?>"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="22" y1="12" x2="18" y2="12"/><line x1="6" y1="12" x2="2" y2="12"/><line x1="12" y1="6" x2="12" y2="2"/><line x1="12" y1="22" x2="12" y2="18"/></svg><span class="aga-vst-pick-label"><?php esc_html_e( 'Pick', 'autocomplete-google-address' ); ?></span></button> 250 </div> 251 </div> 252 </div> 216 <input type="hidden" name="Nish_aga_mode" value="smart_mapping"> 217 <?php $disabled_attr = $is_paying ? '' : 'disabled'; ?> 253 218 <!-- Smart Mapping Panel --> 254 <div id="aga-panel-smart_mapping" class="aga-mode-panel <?php echo 'smart_mapping' === $mode ? 'active' : ''; ?>">219 <div id="aga-panel-smart_mapping" class="aga-mode-panel active<?php echo $is_paying ? '' : ' aga-mode-panel--locked'; ?>"> 255 220 <?php if ( ! $is_paying ) : ?> 256 <div class="aga-pro-banner"> 257 <h3><?php esc_html_e( 'Unlock Smart Mapping', 'autocomplete-google-address' ); ?></h3> 258 <p><?php esc_html_e( 'Split addresses into Street, City, State, Zip, and Country fields automatically.', 'autocomplete-google-address' ); ?></p> 259 <a href="<?php echo esc_url( $checkout_url ); ?>" target="_blank" class="button"><?php esc_html_e( 'Upgrade to Pro', 'autocomplete-google-address' ); ?></a> 221 <div class="aga-pro-inline-callout"> 222 <div class="aga-pro-inline-callout__text"> 223 <strong><?php esc_html_e( 'Mapping Mode is a Pro feature.', 'autocomplete-google-address' ); ?></strong> 224 <span><?php esc_html_e( 'Preview the fields below — upgrade to enable them.', 'autocomplete-google-address' ); ?></span> 225 </div> 226 <a href="<?php echo esc_url( $checkout_url ); ?>" target="_blank" class="button button-primary"><?php esc_html_e( 'Upgrade to Pro', 'autocomplete-google-address' ); ?></a> 260 227 </div> 261 228 <?php else : ?> 262 229 <p><?php esc_html_e( 'Map each address component to your form fields.', 'autocomplete-google-address' ); ?></p> 230 <?php endif; ?> 231 232 <div class="aga-toggle-row aga-toggle-row--inline aga-mb-sm"> 233 <div class="aga-toggle-row-info"> 234 <strong><?php esc_html_e( 'Full Address in Street Field', 'autocomplete-google-address' ); ?></strong> 235 <span class="aga-toggle-desc"><?php esc_html_e( 'When enabled, the entire formatted address is written into the Street selector instead of only the street component.', 'autocomplete-google-address' ); ?></span> 236 </div> 237 <label class="aga-switch"> 238 <input type="checkbox" id="aga_street_full_address" name="Nish_aga_street_full_address" value="1" <?php checked( $street_full_address, '1' ); ?> <?php echo $disabled_attr; ?>> 239 <span class="aga-slider"></span> 240 </label> 241 </div> 242 263 243 <div class="aga-mapping-grid"> 264 244 <?php … … 277 257 <label for="<?php echo esc_attr( $field['id'] ); ?>"><?php echo esc_html( $field['label'] ); ?></label> 278 258 <div class="aga-vst-input-row"> 279 <input type="text" id="<?php echo esc_attr( $field['id'] ); ?>" name="<?php echo esc_attr( $field['name'] ); ?>" value="<?php echo esc_attr( $field['value'] ); ?>" class="widefat" placeholder="#id, .class, [name='field']" />280 <button type="button" class="aga-vst-pick-btn" title="<?php esc_attr_e( 'Click to visually select a field from your page', 'autocomplete-google-address' ); ?>" ><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="22" y1="12" x2="18" y2="12"/><line x1="6" y1="12" x2="2" y2="12"/><line x1="12" y1="6" x2="12" y2="2"/><line x1="12" y1="22" x2="12" y2="18"/></svg><span class="aga-vst-pick-label"><?php esc_html_e( 'Pick', 'autocomplete-google-address' ); ?></span></button>259 <input type="text" id="<?php echo esc_attr( $field['id'] ); ?>" name="<?php echo esc_attr( $field['name'] ); ?>" value="<?php echo esc_attr( $field['value'] ); ?>" class="widefat" placeholder="#id, .class, [name='field']" <?php echo $disabled_attr; ?> /> 260 <button type="button" class="aga-vst-pick-btn" title="<?php esc_attr_e( 'Click to visually select a field from your page', 'autocomplete-google-address' ); ?>" <?php echo $disabled_attr; ?>><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="22" y1="12" x2="18" y2="12"/><line x1="6" y1="12" x2="2" y2="12"/><line x1="12" y1="6" x2="12" y2="2"/><line x1="12" y1="22" x2="12" y2="18"/></svg><span class="aga-vst-pick-label"><?php esc_html_e( 'Pick', 'autocomplete-google-address' ); ?></span></button> 281 261 </div> 282 262 </div> … … 288 268 <div class="aga-field-group"> 289 269 <label for="aga_state_format"><?php esc_html_e( 'State Format', 'autocomplete-google-address' ); ?></label> 290 <select id="aga_state_format" name="Nish_aga_state_format" >270 <select id="aga_state_format" name="Nish_aga_state_format" <?php echo $disabled_attr; ?>> 291 271 <option value="long" <?php selected( $state_format, 'long' ); ?>><?php esc_html_e( 'Long Name (e.g., California)', 'autocomplete-google-address' ); ?></option> 292 272 <option value="short" <?php selected( $state_format, 'short' ); ?>><?php esc_html_e( 'Short Name (e.g., CA)', 'autocomplete-google-address' ); ?></option> … … 295 275 <div class="aga-field-group"> 296 276 <label for="aga_country_format"><?php esc_html_e( 'Country Format', 'autocomplete-google-address' ); ?></label> 297 <select id="aga_country_format" name="Nish_aga_country_format" >277 <select id="aga_country_format" name="Nish_aga_country_format" <?php echo $disabled_attr; ?>> 298 278 <option value="long" <?php selected( $country_format, 'long' ); ?>><?php esc_html_e( 'Long Name (e.g., United States)', 'autocomplete-google-address' ); ?></option> 299 279 <option value="short" <?php selected( $country_format, 'short' ); ?>><?php esc_html_e( 'Short Name (e.g., US)', 'autocomplete-google-address' ); ?></option> … … 301 281 </div> 302 282 </div> 303 <?php endif; ?>304 283 </div> 305 284 </div> -
autocomplete-google-address/trunk/autocomplete-google-address.php
r3529084 r3534694 5 5 * Plugin URI: https://wordpress.org/plugins/autocomplete-google-address/ 6 6 * Description: Add Google Places address autocomplete to any existing form in WordPress using a selector-based mapping builder. 7 * Version: 5. 3.57 * Version: 5.4.0 8 8 * Author: Md Nishath Khandakar 9 9 * Author URI: https://profiles.wordpress.org/nishatbd31/ … … 58 58 * Currently plugin version. 59 59 */ 60 define( 'AGA_VERSION', '5. 3.5' );60 define( 'AGA_VERSION', '5.4.0' ); 61 61 /** 62 62 * Plugin directory path. -
autocomplete-google-address/trunk/includes/class-aga-autocomplete.php
r3493591 r3534694 26 26 27 27 $mode = get_post_meta( $form_id, 'Nish_aga_mode', true ); 28 if ( 'smart_mapping' !== $mode ) { 29 $mode = 'smart_mapping'; 30 } 28 31 $main_selector = get_post_meta( $form_id, 'Nish_aga_main_selector', true ); 29 32 … … 38 41 $is_paying = function_exists( 'google_autocomplete' ) && google_autocomplete()->is_paying(); 39 42 40 if ( 'single_line' === $mode ) { 41 $config['selectors']['lat'] = get_post_meta( $form_id, 'Nish_aga_lat_selector', true ); 42 $config['selectors']['lng'] = get_post_meta( $form_id, 'Nish_aga_lng_selector', true ); 43 $config['selectors']['place_id'] = get_post_meta( $form_id, 'Nish_aga_place_id_selector', true ); 44 } elseif ( 'smart_mapping' === $mode && $is_paying ) { 43 if ( $is_paying ) { 45 44 $config['selectors']['street'] = get_post_meta( $form_id, 'Nish_aga_street_selector', true ); 46 45 $config['selectors']['city'] = get_post_meta( $form_id, 'Nish_aga_city_selector', true ); … … 51 50 $config['selectors']['lng'] = get_post_meta( $form_id, 'Nish_aga_map_lng_selector', true ); 52 51 $config['selectors']['place_id'] = get_post_meta( $form_id, 'Nish_aga_smart_place_id_selector', true ); 53 52 54 53 $config['formats'] = array( 55 54 'state' => get_post_meta( $form_id, 'Nish_aga_state_format', true ) ?: 'long', 56 55 'country' => get_post_meta( $form_id, 'Nish_aga_country_format', true ) ?: 'long', 57 56 ); 57 58 $config['street_full_address'] = ( '1' === get_post_meta( $form_id, 'Nish_aga_street_full_address', true ) ); 58 59 } 59 60 -
autocomplete-google-address/trunk/includes/class-aga-elementor.php
r3488484 r3534694 160 160 var itemClasses = _.escape(item.css_classes) || ''; 161 161 var required = item.required ? 'required' : ''; 162 var mode = item.aga_mode || 's ingle_line';162 var mode = item.aga_mode || 'smart_mapping'; 163 163 164 164 var html = '<input size=\"1\" type=\"text\" class=\"elementor-field elementor-field-textual elementor-size-' + inputSize + ' ' + itemClasses + '\" name=\"form_field_' + i + '\" id=\"form_field_' + i + '\" ' + required + ' placeholder=\"' + placeholder + '\" autocomplete=\"off\">'; -
autocomplete-google-address/trunk/includes/class-aga-forms.php
r3493591 r3534694 199 199 ); 200 200 201 update_post_meta( 202 $post_id, 203 'Nish_aga_street_full_address', 204 isset( $_POST['Nish_aga_street_full_address'] ) ? '1' : '' 205 ); 206 201 207 if ( isset( $_POST['Nish_aga_load_on_pages'] ) && is_array( $_POST['Nish_aga_load_on_pages'] ) ) { 202 208 update_post_meta( … … 289 295 290 296 if ( 'aga_mode' === $column ) { 291 $mode = get_post_meta( $post_id, 'Nish_aga_mode', true ); 292 echo esc_html( 293 $mode === 'single_line' 294 ? 'Single Line' 295 : ( $mode === 'smart_mapping' ? 'Smart Mapping' : 'None' ) 296 ); 297 $is_paying = function_exists( 'google_autocomplete' ) && google_autocomplete()->is_paying(); 298 echo esc_html( $is_paying ? 'Smart Mapping' : 'Smart Mapping (Pro)' ); 297 299 } 298 300 -
autocomplete-google-address/trunk/includes/class-aga-shortcode.php
r3493591 r3534694 52 52 'placeholder' => 'Start typing an address...', 53 53 'label' => '', 54 'mode' => 's ingle_line',54 'mode' => 'smart_mapping', 55 55 'country' => '', 56 56 'show_map' => 'false', … … 98 98 99 99 // Build the HTML. 100 $mode = ! empty( $config['mode'] ) ? $config['mode'] : 's ingle_line';100 $mode = ! empty( $config['mode'] ) ? $config['mode'] : 'smart_mapping'; 101 101 $show_map = ! empty( $config['map_picker'] ); 102 102 $wrapper_class = 'aga-shortcode-wrapper'; … … 127 127 */ 128 128 private function render_standalone( $instance_id, $atts ) { 129 $mode = in_array( $atts['mode'], array( 'single_line', 'smart_mapping' ), true ) ? $atts['mode'] : 'single_line'; 129 $is_paying = function_exists( 'google_autocomplete' ) && google_autocomplete()->is_paying(); 130 // Smart Mapping is Pro-only — fall back to plain single-line for free users. 131 $mode = $is_paying ? 'smart_mapping' : 'single_line'; 130 132 $show_map = 'true' === strtolower( $atts['show_map'] ); 131 133 -
autocomplete-google-address/trunk/includes/widgets/class-aga-elementor-form-field.php
r3493591 r3534694 53 53 'name' => 'aga_mode', 54 54 'label' => esc_html__( 'Mode', 'autocomplete-google-address' ), 55 'type' => \Elementor\Controls_Manager::SELECT, 56 'default' => 'single_line', 57 'options' => array( 58 'single_line' => esc_html__( 'Single Line', 'autocomplete-google-address' ), 59 'smart_mapping' => $is_paying 60 ? esc_html__( 'Smart Mapping', 'autocomplete-google-address' ) 61 : esc_html__( 'Smart Mapping (Pro)', 'autocomplete-google-address' ), 62 ), 55 'type' => \Elementor\Controls_Manager::HIDDEN, 56 'default' => 'smart_mapping', 63 57 'condition' => $condition, 64 58 ) ), … … 161 155 $is_paying = function_exists( 'google_autocomplete' ) && google_autocomplete()->is_paying(); 162 156 163 $mode = ! empty( $item['aga_mode'] ) ? $item['aga_mode'] : 'single_line'; 164 if ( 'smart_mapping' === $mode && ! $is_paying ) { 165 $mode = 'single_line'; 166 } 157 // Smart Mapping is Pro-only — fall back to plain single-line for free users. 158 $mode = $is_paying ? 'smart_mapping' : 'single_line'; 167 159 168 160 $input_size = ! empty( $item['input_size'] ) ? $item['input_size'] : 'sm'; -
autocomplete-google-address/trunk/includes/widgets/class-aga-elementor-widget.php
r3493591 r3534694 92 92 ); 93 93 94 $mode_options = array(95 'single_line' => esc_html__( 'Single Line', 'autocomplete-google-address' ),96 );97 if ( $is_paying ) {98 $mode_options['smart_mapping'] = esc_html__( 'Smart Mapping', 'autocomplete-google-address' );99 } else {100 $mode_options['smart_mapping'] = esc_html__( 'Smart Mapping (Pro)', 'autocomplete-google-address' );101 }102 103 94 $this->add_control( 104 95 'mode', 105 96 array( 106 97 'label' => esc_html__( 'Mode', 'autocomplete-google-address' ), 107 'type' => \Elementor\Controls_Manager::SELECT, 108 'default' => 'single_line', 109 'options' => $mode_options, 98 'type' => \Elementor\Controls_Manager::HIDDEN, 99 'default' => 'smart_mapping', 110 100 ) 111 101 ); … … 375 365 $instance_id = 'aga-el-' . $widget_id; 376 366 377 // Determine effective mode — fall back to single_line for free users. 378 $mode = $settings['mode']; 379 if ( 'smart_mapping' === $mode && ! $is_paying ) { 380 $mode = 'single_line'; 381 } 367 // Smart Mapping is Pro-only — fall back to plain single-line for free users. 368 $mode = $is_paying ? 'smart_mapping' : 'single_line'; 382 369 383 370 $show_map = $is_paying && 'yes' === ( $settings['show_map'] ?? '' ); -
autocomplete-google-address/trunk/public/js/frontend.js
r3529084 r3534694 1021 1021 if (config.mode === 'smart_mapping' && result.address_components) { 1022 1022 var components = aga.parseReverseComponents(result.address_components); 1023 aga.applyParsedComponents(components, config, mainInput );1023 aga.applyParsedComponents(components, config, mainInput, result.formatted_address || ''); 1024 1024 } 1025 1025 … … 1077 1077 }, 1078 1078 1079 applyParsedComponents: function (components, config, mainInput ) {1079 applyParsedComponents: function (components, config, mainInput, formattedAddress) { 1080 1080 var countryCode = components.country_short || ''; 1081 1081 var countryName = components.country_long || ''; … … 1104 1104 1105 1105 if (config.selectors.street) { 1106 aga.setFieldValue(config.selectors.street, (components.street_number + ' ' + components.route).trim(), undefined, mainInput); 1106 var streetValue = (config.street_full_address && formattedAddress) 1107 ? formattedAddress 1108 : (components.street_number + ' ' + components.route).trim(); 1109 aga.setFieldValue(config.selectors.street, streetValue, undefined, mainInput); 1107 1110 } 1108 1111 if (config.selectors.city) { … … 1288 1291 1289 1292 if (config.selectors.street) { 1290 aga.setFieldValue(config.selectors.street, (components.street_number + ' ' + components.route).trim(), undefined, mainInput); 1293 var streetValue = (config.street_full_address && place.formattedAddress) 1294 ? place.formattedAddress 1295 : (components.street_number + ' ' + components.route).trim(); 1296 aga.setFieldValue(config.selectors.street, streetValue, undefined, mainInput); 1291 1297 } 1292 1298 -
autocomplete-google-address/trunk/readme.txt
r3529084 r3534694 4 4 Requires at least: 5.4 5 5 Tested up to: 6.9 6 Stable tag: 5. 3.56 Stable tag: 5.4.0 7 7 Requires PHP: 7.2 8 8 License: GPL-2.0-or-later … … 291 291 == Changelog == 292 292 293 = 5.4.0 = 294 * CHANGED: Mapping Mode is now a single unified Pro feature — the legacy "Single Line" option has been removed. Free users see a locked preview of all mapping fields with an upgrade prompt; Pro users get the full configurator. 295 * NEW: "Full Address in Street Field" toggle (Pro) — when enabled, the entire formatted address is written into the Street selector instead of only the street component. Useful when your form has a single visible address field but you still want all the structured data. 296 * IMPROVED: Mapping Mode card redesigned — disabled-input preview for free users so the available fields and toggle are visible at a glance. 297 * FIX: Toggle switches no longer overflow their track on the form-edit page; thumb stays inside the track in all admin themes. 298 293 299 = 5.3.5 = 294 300 * NEW: Country blocklist support — when WooCommerce is configured to sell only to specific countries, selecting an unsupported country address now shows a clear "We do not ship to [Country]" error badge and blocks checkout submission.
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](https://plugins.trac.wordpress.org/chrome/site/your_project_logo.png)