Plugin Directory

Changeset 3014181


Ignore:
Timestamp:
12/26/2023 01:17:48 AM (2 years ago)
Author:
dshanske
Message:

Update to version 5.0.22 from GitHub

Location:
simple-location
Files:
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • simple-location/tags/5.0.22/includes/class-location-taxonomy.php

    r3011070 r3014181  
    102102                'id' => 'location',
    103103                'show_option_none' => $type->labels->all_items,
     104                'option_none_value' => '',
    104105                'hierarchical' => true,
    105106                'taxonomy' => 'location',
  • simple-location/tags/5.0.22/includes/class-rest-geo.php

    r2974027 r3014181  
    239239                            'sanitize_callback' => 'sanitize_text_field',
    240240                        ),
     241                        'select' => array(
     242                            'sanitize_callback' => 'sanitize_text_field'
     243                        )
    241244                    ),
    242245                    'permission_callback' => function ( $request ) {
     
    446449        // We dont need to check the nonce like with admin-ajax.
    447450        $params   = $request->get_params();
     451        $select = empty( $params['select'] ) ? null : $params['select'];
    448452        $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        }
    449482        if ( ! empty( $params['longitude'] ) && ! empty( $params['latitude'] ) ) {
    450483            $venue = Loc_Config::venue_provider( $provider );
  • simple-location/tags/5.0.22/js/location.js

    r2823980 r3014181  
    5656            getCurrentPosition();
    5757            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            } );
    5887        }
    5988    }
     
    290319            event.preventDefault();
    291320        } )
     321        .on( 'change', '#location_dropdown', function( event ) {
     322            updateVenues();
     323            event.preventDefault();
     324        } )
    292325        .on( 'click', '.save-venue-button', function() {
    293326            $.ajax( {
  • simple-location/tags/5.0.22/readme.txt

    r3013759 r3014181  
    44Requires at least: 4.9
    55Tested up to: 6.4
    6 Stable tag: 5.0.21
     6Stable tag: 5.0.22
    77Requires PHP: 5.6
    88License: GPLv2 or later
     
    288288
    289289== 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.
    290294
    291295= 5.0.21 ( 2023-12-23 ) =
  • simple-location/tags/5.0.22/simple-location.php

    r3013759 r3014181  
    44 * Plugin URI: https://wordpress.org/plugins/simple-location/
    55 * Description: Adds Location to WordPress
    6  * Version: 5.0.21
     6 * Version: 5.0.22
    77 * Requires at least: 4.9
    88 * Requires PHP: 7.0
  • simple-location/trunk/includes/class-location-taxonomy.php

    r3011070 r3014181  
    102102                'id' => 'location',
    103103                'show_option_none' => $type->labels->all_items,
     104                'option_none_value' => '',
    104105                'hierarchical' => true,
    105106                'taxonomy' => 'location',
  • simple-location/trunk/includes/class-rest-geo.php

    r2974027 r3014181  
    239239                            'sanitize_callback' => 'sanitize_text_field',
    240240                        ),
     241                        'select' => array(
     242                            'sanitize_callback' => 'sanitize_text_field'
     243                        )
    241244                    ),
    242245                    'permission_callback' => function ( $request ) {
     
    446449        // We dont need to check the nonce like with admin-ajax.
    447450        $params   = $request->get_params();
     451        $select = empty( $params['select'] ) ? null : $params['select'];
    448452        $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        }
    449482        if ( ! empty( $params['longitude'] ) && ! empty( $params['latitude'] ) ) {
    450483            $venue = Loc_Config::venue_provider( $provider );
  • simple-location/trunk/js/location.js

    r2823980 r3014181  
    5656            getCurrentPosition();
    5757            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            } );
    5887        }
    5988    }
     
    290319            event.preventDefault();
    291320        } )
     321        .on( 'change', '#location_dropdown', function( event ) {
     322            updateVenues();
     323            event.preventDefault();
     324        } )
    292325        .on( 'click', '.save-venue-button', function() {
    293326            $.ajax( {
  • simple-location/trunk/readme.txt

    r3013759 r3014181  
    44Requires at least: 4.9
    55Tested up to: 6.4
    6 Stable tag: 5.0.21
     6Stable tag: 5.0.22
    77Requires PHP: 5.6
    88License: GPLv2 or later
     
    288288
    289289== 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.
    290294
    291295= 5.0.21 ( 2023-12-23 ) =
  • simple-location/trunk/simple-location.php

    r3013759 r3014181  
    44 * Plugin URI: https://wordpress.org/plugins/simple-location/
    55 * Description: Adds Location to WordPress
    6  * Version: 5.0.21
     6 * Version: 5.0.22
    77 * Requires at least: 4.9
    88 * Requires PHP: 7.0
Note: See TracChangeset for help on using the changeset viewer.