Changeset 3014181
- Timestamp:
- 12/26/2023 01:17:48 AM (2 years ago)
- Location:
- simple-location
- Files:
-
- 10 edited
- 1 copied
-
tags/5.0.22 (copied) (copied from simple-location/trunk)
-
tags/5.0.22/includes/class-location-taxonomy.php (modified) (1 diff)
-
tags/5.0.22/includes/class-rest-geo.php (modified) (2 diffs)
-
tags/5.0.22/js/location.js (modified) (2 diffs)
-
tags/5.0.22/readme.txt (modified) (2 diffs)
-
tags/5.0.22/simple-location.php (modified) (1 diff)
-
trunk/includes/class-location-taxonomy.php (modified) (1 diff)
-
trunk/includes/class-rest-geo.php (modified) (2 diffs)
-
trunk/js/location.js (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/simple-location.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
simple-location/tags/5.0.22/includes/class-location-taxonomy.php
r3011070 r3014181 102 102 'id' => 'location', 103 103 'show_option_none' => $type->labels->all_items, 104 'option_none_value' => '', 104 105 'hierarchical' => true, 105 106 'taxonomy' => 'location', -
simple-location/tags/5.0.22/includes/class-rest-geo.php
r2974027 r3014181 239 239 'sanitize_callback' => 'sanitize_text_field', 240 240 ), 241 'select' => array( 242 'sanitize_callback' => 'sanitize_text_field' 243 ) 241 244 ), 242 245 'permission_callback' => function ( $request ) { … … 446 449 // We dont need to check the nonce like with admin-ajax. 447 450 $params = $request->get_params(); 451 $select = empty( $params['select'] ) ? null : $params['select']; 448 452 $provider = empty( $params['provider'] ) ? null : $params['provider']; 453 $location = empty( $params['location'] ) ? null : $params['location']; 454 if ( $select ) { 455 $venue_args = array( 456 'name' => 'venue_id', 457 'id' => 'venue_id', 458 'show_option_none' => __( 'No Venue', 'simple-location' ), 459 'option_none_value' => '0', 460 'hierarchical' => true, 461 'post_type' => 'venue', 462 'echo' => false, 463 ); 464 if ( is_numeric( $location ) && $location > 0 ) { 465 $venue_args['tax_query'] = array( 466 array( 467 'taxonomy' => 'location', 468 'terms' => $location, 469 ) 470 ); 471 } 472 $response = wp_dropdown_pages( $venue_args ); 473 if ( $response ) { 474 return array( 475 'venue_select' => $response 476 ); 477 } else { 478 return $venue_args; 479 } 480 return new WP_Error( 'no_venues_found', __( 'Venues Not Found', 'simple-location' ) ); 481 } 449 482 if ( ! empty( $params['longitude'] ) && ! empty( $params['latitude'] ) ) { 450 483 $venue = Loc_Config::venue_provider( $provider ); -
simple-location/tags/5.0.22/js/location.js
r2823980 r3014181 56 56 getCurrentPosition(); 57 57 reverseLookup(); 58 } 59 } 60 61 function updateVenues() { 62 if ( 0 !== $( 'location_dropdown' ).val() ) { 63 $.ajax( { 64 type: 'GET', 65 // Here we supply the endpoint url, as opposed to the action in the data object with the admin-ajax method 66 url: slocOptions.api_url + 'venue/', 67 beforeSend( xhr ) { 68 // Here we set a header 'X-WP-Nonce' with the nonce as opposed to the nonce in the data object with admin-ajax 69 xhr.setRequestHeader( 'X-WP-Nonce', slocOptions.api_nonce ); 70 }, 71 data: { 72 location: $( '#location_dropdown' ).val(), 73 select: 'true' 74 }, 75 success( response ) { 76 if ( window.console ) { 77 console.log( response ); 78 } 79 if ( 'undefined' === typeof response ) { 80 } else { 81 if ( ( 'venue_select' in response ) ) { 82 $( '#venue_id' ).replaceWith( response.venue_select); 83 } 84 } 85 } 86 } ); 58 87 } 59 88 } … … 290 319 event.preventDefault(); 291 320 } ) 321 .on( 'change', '#location_dropdown', function( event ) { 322 updateVenues(); 323 event.preventDefault(); 324 } ) 292 325 .on( 'click', '.save-venue-button', function() { 293 326 $.ajax( { -
simple-location/tags/5.0.22/readme.txt
r3013759 r3014181 4 4 Requires at least: 4.9 5 5 Tested up to: 6.4 6 Stable tag: 5.0.2 16 Stable tag: 5.0.22 7 7 Requires PHP: 5.6 8 8 License: GPLv2 or later … … 288 288 289 289 == Changelog == 290 291 = 5.0.22 ( 2023-12-25 ) = 292 * Fix issue where dropdown filter was not working when value set to no filter. 293 * Limit venues when you change location pulldown. 290 294 291 295 = 5.0.21 ( 2023-12-23 ) = -
simple-location/tags/5.0.22/simple-location.php
r3013759 r3014181 4 4 * Plugin URI: https://wordpress.org/plugins/simple-location/ 5 5 * Description: Adds Location to WordPress 6 * Version: 5.0.2 16 * Version: 5.0.22 7 7 * Requires at least: 4.9 8 8 * Requires PHP: 7.0 -
simple-location/trunk/includes/class-location-taxonomy.php
r3011070 r3014181 102 102 'id' => 'location', 103 103 'show_option_none' => $type->labels->all_items, 104 'option_none_value' => '', 104 105 'hierarchical' => true, 105 106 'taxonomy' => 'location', -
simple-location/trunk/includes/class-rest-geo.php
r2974027 r3014181 239 239 'sanitize_callback' => 'sanitize_text_field', 240 240 ), 241 'select' => array( 242 'sanitize_callback' => 'sanitize_text_field' 243 ) 241 244 ), 242 245 'permission_callback' => function ( $request ) { … … 446 449 // We dont need to check the nonce like with admin-ajax. 447 450 $params = $request->get_params(); 451 $select = empty( $params['select'] ) ? null : $params['select']; 448 452 $provider = empty( $params['provider'] ) ? null : $params['provider']; 453 $location = empty( $params['location'] ) ? null : $params['location']; 454 if ( $select ) { 455 $venue_args = array( 456 'name' => 'venue_id', 457 'id' => 'venue_id', 458 'show_option_none' => __( 'No Venue', 'simple-location' ), 459 'option_none_value' => '0', 460 'hierarchical' => true, 461 'post_type' => 'venue', 462 'echo' => false, 463 ); 464 if ( is_numeric( $location ) && $location > 0 ) { 465 $venue_args['tax_query'] = array( 466 array( 467 'taxonomy' => 'location', 468 'terms' => $location, 469 ) 470 ); 471 } 472 $response = wp_dropdown_pages( $venue_args ); 473 if ( $response ) { 474 return array( 475 'venue_select' => $response 476 ); 477 } else { 478 return $venue_args; 479 } 480 return new WP_Error( 'no_venues_found', __( 'Venues Not Found', 'simple-location' ) ); 481 } 449 482 if ( ! empty( $params['longitude'] ) && ! empty( $params['latitude'] ) ) { 450 483 $venue = Loc_Config::venue_provider( $provider ); -
simple-location/trunk/js/location.js
r2823980 r3014181 56 56 getCurrentPosition(); 57 57 reverseLookup(); 58 } 59 } 60 61 function updateVenues() { 62 if ( 0 !== $( 'location_dropdown' ).val() ) { 63 $.ajax( { 64 type: 'GET', 65 // Here we supply the endpoint url, as opposed to the action in the data object with the admin-ajax method 66 url: slocOptions.api_url + 'venue/', 67 beforeSend( xhr ) { 68 // Here we set a header 'X-WP-Nonce' with the nonce as opposed to the nonce in the data object with admin-ajax 69 xhr.setRequestHeader( 'X-WP-Nonce', slocOptions.api_nonce ); 70 }, 71 data: { 72 location: $( '#location_dropdown' ).val(), 73 select: 'true' 74 }, 75 success( response ) { 76 if ( window.console ) { 77 console.log( response ); 78 } 79 if ( 'undefined' === typeof response ) { 80 } else { 81 if ( ( 'venue_select' in response ) ) { 82 $( '#venue_id' ).replaceWith( response.venue_select); 83 } 84 } 85 } 86 } ); 58 87 } 59 88 } … … 290 319 event.preventDefault(); 291 320 } ) 321 .on( 'change', '#location_dropdown', function( event ) { 322 updateVenues(); 323 event.preventDefault(); 324 } ) 292 325 .on( 'click', '.save-venue-button', function() { 293 326 $.ajax( { -
simple-location/trunk/readme.txt
r3013759 r3014181 4 4 Requires at least: 4.9 5 5 Tested up to: 6.4 6 Stable tag: 5.0.2 16 Stable tag: 5.0.22 7 7 Requires PHP: 5.6 8 8 License: GPLv2 or later … … 288 288 289 289 == Changelog == 290 291 = 5.0.22 ( 2023-12-25 ) = 292 * Fix issue where dropdown filter was not working when value set to no filter. 293 * Limit venues when you change location pulldown. 290 294 291 295 = 5.0.21 ( 2023-12-23 ) = -
simple-location/trunk/simple-location.php
r3013759 r3014181 4 4 * Plugin URI: https://wordpress.org/plugins/simple-location/ 5 5 * Description: Adds Location to WordPress 6 * Version: 5.0.2 16 * Version: 5.0.22 7 7 * Requires at least: 4.9 8 8 * Requires PHP: 7.0
Note: See TracChangeset
for help on using the changeset viewer.