Plugin Directory

Changeset 1928419


Ignore:
Timestamp:
08/22/2018 04:59:23 AM (7 years ago)
Author:
bhoot
Message:

Release version 1.0.1

Location:
wp-restaurant-listings/trunk
Files:
54 edited

Legend:

Unmodified
Added
Removed
  • wp-restaurant-listings/trunk/assets/js/ajax-filters.js

    r1851196 r1928419  
    11/* global restaurant_listings_ajax_filters */
    2 jQuery( document ).ready( function ( $ ) {
     2jQuery(document).ready(function ($) {
    33
    44    var xhr = [];
    55
    6     $( '.restaurant_listings' ).on( 'update_results', function ( event, page, append, loading_previous ) {
    7         var data         = '';
    8         var target       = $( this );
    9         var form         = target.find( '.restaurant_filters' );
    10         var showing      = target.find( '.showing_restaurants' );
    11         var results      = target.find( '.restaurant_listings' );
    12         var per_page     = target.data( 'per_page' );
    13         var orderby      = target.data( 'orderby' );
    14         var order        = target.data( 'order' );
    15         var featured     = target.data( 'featured' );
    16         var restaurant_types    = target.data( 'restaurant_types' );
    17         var post_status  = target.data( 'post_status' );
    18         var index        = $( 'div.restaurant_listings' ).index(this);
     6    $('.restaurant_listings').on('update_results', function (event, page, append, loading_previous) {
     7        var data = '';
     8        var target = $(this);
     9        var form = target.find('.restaurant_filters');
     10        var showing = target.find('.showing_restaurants');
     11        var results = target.find('.restaurant_listings');
     12        var per_page = target.data('per_page');
     13        var orderby = target.data('orderby');
     14        var order = target.data('order');
     15        var featured = target.data('featured');
     16        var restaurant_types = target.data('restaurant_types');
     17        var post_status = target.data('post_status');
     18        var index = $('div.restaurant_listings').index(this);
    1919        var categories, keywords, location, price_range;
    2020
    21         if ( index < 0 ) {
     21        if(index < 0) {
    2222            return;
    2323        }
    2424
    25         if ( xhr[index] ) {
     25        if(xhr[index]) {
    2626            xhr[index].abort();
    2727        }
    2828
    29         if ( ! append ) {
    30             $( results ).addClass( 'loading' );
    31             $( 'li.restaurant_listings, li.no_restaurant_listings_found', results ).css( 'visibility', 'hidden' );
     29        if(!append) {
     30            $(results).addClass('loading');
     31            $('li.restaurant_listings, li.no_restaurant_listings_found', results).css('visibility', 'hidden');
    3232
    3333            // Not appending. If page > 1, we should show a load previous button so the user can get to earlier-page listings if needed
    34             if ( page > 1 && true !== target.data( 'show_pagination' ) ) {
    35                 $( results ).before( '<a class="load_more_restaurants load_previous" href="#"><strong>' + restaurant_listings_ajax_filters.i18n_load_prev_listings + '</strong></a>' );
     34            if(page > 1 && true !== target.data('show_pagination')) {
     35                $(results).before('<a class="load_more_restaurants load_previous" href="#"><strong>' + restaurant_listings_ajax_filters.i18n_load_prev_listings + '</strong></a>');
    3636            } else {
    37                 target.find( '.load_previous' ).remove();
    38             }
    39 
    40             target.find( '.load_more_restaurants' ).data( 'page', page );
    41         }
    42 
    43         if ( true === target.data( 'show_filters' ) ) {
     37                target.find('.load_previous').remove();
     38            }
     39
     40            target.find('.load_more_restaurants').data('page', page);
     41        }
     42
     43        if(true === target.data('show_filters')) {
    4444
    4545            var filter_restaurant_type = [];
    4646
    47             $( ':input[name="filter_restaurant_type[]"]:checked, :input[name="filter_restaurant_type[]"][type="hidden"], :input[name="filter_restaurant_type"]', form ).each( function () {
    48                 filter_restaurant_type.push( $( this ).val() );
    49             } );
    50 
    51             categories = form.find( ':input[name^="search_categories"]' ).map( function () {
    52                 return $( this ).val();
    53             } ).get();
    54             keywords   = '';
    55             location   = '';
    56             price_range = form.find( ':input[name="search_price_range"]' ).val();
    57             var $keywords  = form.find( ':input[name="search_keywords"]' );
    58             var $location  = form.find( ':input[name="search_location"]' );
     47            $(':input[name="filter_restaurant_type[]"]:checked, :input[name="filter_restaurant_type[]"][type="hidden"], :input[name="filter_restaurant_type"]', form).each(function () {
     48                filter_restaurant_type.push($(this).val());
     49            });
     50
     51            categories = form.find(':input[name^="search_categories"]').map(function () {
     52                return $(this).val();
     53            }).get();
     54            keywords = '';
     55            location = '';
     56            price_range = form.find(':input[name="search_price_range"]').val();
     57            var $keywords = form.find(':input[name="search_keywords"]');
     58            var $location = form.find(':input[name="search_location"]');
    5959
    6060            // Workaround placeholder scripts
    61             if ( $keywords.val() !== $keywords.attr( 'placeholder' ) ) {
     61            if($keywords.val() !== $keywords.attr('placeholder')) {
    6262                keywords = $keywords.val();
    6363            }
    6464
    65             if ( $location.val() !== $location.attr( 'placeholder' ) ) {
     65            if($location.val() !== $location.attr('placeholder')) {
    6666                location = $location.val();
    6767            }
     
    8080                page: page,
    8181                featured: featured,
    82                 show_pagination: target.data( 'show_pagination' ),
     82                show_pagination: target.data('show_pagination'),
    8383                form_data: form.serialize()
    8484            };
     
    8686        } else {
    8787
    88             categories  = target.data( 'categories' );
    89             keywords    = target.data( 'keywords' );
    90             location    = target.data( 'location' );
     88            categories = target.data('categories');
     89            keywords = target.data('keywords');
     90            location = target.data('location');
    9191            price_range = target.data('price_range');
    9292
    93             if ( categories ) {
    94                 categories = categories.split( ',' );
     93            if(categories) {
     94                categories = categories.split(',');
    9595            }
    9696
     
    108108                page: page,
    109109                featured: featured,
    110                 show_pagination: target.data( 'show_pagination' )
     110                show_pagination: target.data('show_pagination')
    111111            };
    112112
    113113        }
    114114
    115         xhr[index] = $.ajax( {
     115        xhr[index] = $.ajax({
    116116            type: 'POST',
    117             url: restaurant_listings_ajax_filters.ajax_url.toString().replace( '%%endpoint%%', 'get_listings' ),
     117            url: restaurant_listings_ajax_filters.ajax_url.toString().replace('%%endpoint%%', 'get_listings'),
    118118            data: data,
    119             success: function ( result ) {
    120                 if ( result ) {
     119            success: function (result) {
     120                if(result) {
    121121                    try {
    122                         if ( result.showing ) {
    123                             $( showing ).show().html( '<span>' + result.showing + '</span>' + result.showing_links );
     122                        if(result.showing) {
     123                            $(showing).show().html('<span>' + result.showing + '</span>' + result.showing_links);
    124124                        } else {
    125                             $( showing ).hide();
    126                         }
    127 
    128                         if ( result.showing_all ) {
    129                             $( showing ).addClass( 'wp-restaurant-listings-showing-all' );
     125                            $(showing).hide();
     126                        }
     127
     128                        if(result.showing_all) {
     129                            $(showing).addClass('wp-restaurant-listings-showing-all');
    130130                        } else {
    131                             $( showing ).removeClass( 'wp-restaurant-listings-showing-all' );
    132                         }
    133 
    134                         if ( result.html ) {
    135                             if ( append && loading_previous ) {
    136                                 $( results ).prepend( result.html );
    137                             } else if ( append ) {
    138                                 $( results ).append( result.html );
     131                            $(showing).removeClass('wp-restaurant-listings-showing-all');
     132                        }
     133
     134                        if(result.html) {
     135                            if(append && loading_previous) {
     136                                $(results).prepend(result.html);
     137                            } else if(append) {
     138                                $(results).append(result.html);
    139139                            } else {
    140                                 $( results ).html( result.html );
     140                                $(results).html(result.html);
    141141                            }
    142142                        }
    143143
    144                         if ( true === target.data( 'show_pagination' ) ) {
     144                        if(true === target.data('show_pagination')) {
    145145                            target.find('.restaurant-listings-pagination').remove();
    146146
    147                             if ( result.pagination ) {
    148                                 target.append( result.pagination );
     147                            if(result.pagination) {
     148                                target.append(result.pagination);
    149149                            }
    150150                        } else {
    151                             if ( ! result.found_restaurants || result.max_num_pages <= page ) {
    152                                 $( '.load_more_restaurants:not(.load_previous)', target ).hide();
    153                             } else if ( ! loading_previous ) {
    154                                 $( '.load_more_restaurants', target ).show();
     151                            if(!result.found_restaurants || result.max_num_pages <= page) {
     152                                $('.load_more_restaurants:not(.load_previous)', target).hide();
     153                            } else if(!loading_previous) {
     154                                $('.load_more_restaurants', target).show();
    155155                            }
    156                             $( '.load_more_restaurants', target ).removeClass( 'loading' );
    157                             $( 'li.restaurant_listings', results ).css( 'visibility', 'visible' );
    158                         }
    159 
    160                         $( results ).removeClass( 'loading' );
    161 
    162                         target.triggerHandler( 'updated_results', result );
    163 
    164                     } catch ( err ) {
    165                         if ( window.console ) {
    166                             window.console.log( err );
     156                            $('.load_more_restaurants', target).removeClass('loading');
     157                            $('li.restaurant_listings', results).css('visibility', 'visible');
     158                        }
     159
     160                        $(results).removeClass('loading');
     161
     162                        target.triggerHandler('updated_results', result);
     163
     164                    } catch(err) {
     165                        if(window.console) {
     166                            window.console.log(err);
    167167                        }
    168168                    }
    169169                }
    170170            },
    171             error: function ( jqXHR, textStatus, error ) {
    172                 if ( window.console && 'abort' !== textStatus ) {
    173                     window.console.log( textStatus + ': ' + error );
     171            error: function (jqXHR, textStatus, error) {
     172                if(window.console && 'abort' !== textStatus) {
     173                    window.console.log(textStatus + ': ' + error);
    174174                }
    175175            },
    176176            statusCode: {
    177                 404: function() {
    178                     if ( window.console ) {
    179                         window.console.log( 'Error 404: Ajax Endpoint cannot be reached. Go to Settings > Permalinks and save to resolve.' );
     177                404: function () {
     178                    if(window.console) {
     179                        window.console.log('Error 404: Ajax Endpoint cannot be reached. Go to Settings > Permalinks and save to resolve.');
    180180                    }
    181181                }
    182182            }
    183         } );
    184     } );
    185 
    186     $( '#search_keywords, #search_location, .restaurant_types :input, #search_categories, .restaurant-listings-filter, input[name="search_price_range"]' ).change( function() {
    187         var target   = $( this ).closest( 'div.restaurant_listings' );
    188         target.triggerHandler( 'update_results', [ 1, false ] );
    189         restaurant_listings_store_state( target, 1 );
    190     } )
    191 
    192     .on( 'keyup', function(e) {
    193         if ( e.which === 13 ) {
    194             $( this ).trigger( 'change' );
    195         }
    196     } );
    197 
    198     $( '.restaurant_filters' ).on( 'click', '.reset', function () {
    199         var target = $( this ).closest( 'div.restaurant_listings' );
    200         var form = $( this ).closest( 'form' );
    201 
    202         form.find( ':input[name="search_keywords"], :input[name="search_location"], .restaurant-listings-filter' ).not(':input[type="hidden"]').val( '' ).trigger( 'chosen:updated' );
    203         form.find( ':input[name^="search_categories"]' ).not(':input[type="hidden"]').val( 0 ).trigger( 'chosen:updated' );
    204         $( ':input[name="filter_restaurant_type[]"]', form ).not(':input[type="hidden"]').attr( 'checked', 'checked' );
     183        });
     184    });
     185
     186    $('#search_keywords, #search_location, .restaurant_types :input, #search_categories, .restaurant-listings-filter, input[name="search_price_range"]').change(function () {
     187            var target = $(this).closest('div.restaurant_listings');
     188            target.triggerHandler('update_results', [1, false]);
     189            restaurant_listings_store_state(target, 1);
     190        })
     191
     192        .on('keyup', function (e) {
     193            if(e.which === 13) {
     194                $(this).trigger('change');
     195            }
     196        });
     197
     198    $('.restaurant_filters').on('click', '.reset', function () {
     199        var target = $(this).closest('div.restaurant_listings');
     200        var form = $(this).closest('form');
     201
     202        form.find(':input[name="search_keywords"], :input[name="search_location"], .restaurant-listings-filter').not(':input[type="hidden"]').val('').trigger('chosen:updated');
     203        form.find(':input[name^="search_categories"]').not(':input[type="hidden"]').val('').trigger('chosen:updated');
     204        $(':input[name="filter_restaurant_type[]"]', form).not(':input[type="hidden"]').attr('checked', 'checked');
    205205        form.find(':input[name="search_price_range"]').val('');
    206         form.find('.price_range_filter li').attr('style', ''); // Reset button style
    207 
    208         target.triggerHandler( 'reset' );
    209         target.triggerHandler( 'update_results', [ 1, false ] );
    210         restaurant_listings_store_state( target, 1 );
     206        form.find('.price_range_filter li').attr('style', ''); // Reset button style
     207
     208        target.triggerHandler('reset');
     209        target.triggerHandler('update_results', [1, false]);
     210        restaurant_listings_store_state(target, 1);
    211211
    212212        return false;
    213     } );
    214 
    215     $( document.body ).on( 'click', '.load_more_restaurants', function() {
    216         var target           = $( this ).closest( 'div.restaurant_listings' );
    217         var page             = parseInt( ( $( this ).data( 'page' ) || 1 ), 10 );
     213    });
     214
     215    $(document.body).on('click', '.load_more_restaurants', function () {
     216        var target = $(this).closest('div.restaurant_listings');
     217        var page = parseInt(($(this).data('page') || 1), 10);
    218218        var loading_previous = false;
    219219
    220         $(this).addClass( 'loading' );
    221 
    222         if ( $(this).is('.load_previous') ) {
    223             page             = page - 1;
     220        $(this).addClass('loading');
     221
     222        if($(this).is('.load_previous')) {
     223            page = page - 1;
    224224            loading_previous = true;
    225             if ( page === 1 ) {
     225            if(page === 1) {
    226226                $(this).remove();
    227227            } else {
    228                 $( this ).data( 'page', page );
     228                $(this).data('page', page);
    229229            }
    230230        } else {
    231231            page = page + 1;
    232             $( this ).data( 'page', page );
    233             restaurant_listings_store_state( target, page );
    234         }
    235 
    236         target.triggerHandler( 'update_results', [ page, true, loading_previous ] );
     232            $(this).data('page', page);
     233            restaurant_listings_store_state(target, page);
     234        }
     235
     236        target.triggerHandler('update_results', [page, true, loading_previous]);
    237237        return false;
    238     } );
    239 
    240     $('.price_range_filter').on( 'click', 'li', function () {
    241         $('.price_range_filter li').attr('style', ''); // Reset button style
     238    });
     239
     240    $('.price_range_filter').on('click', 'li', function () {
     241        $('.price_range_filter li').attr('style', ''); // Reset button style
    242242        var $clickedLi = $(this);
    243         $('input[name="search_price_range"]').attr( 'value', $clickedLi.attr('data-price_range') );
    244         $('input[name="search_price_range"]').triggerHandler('change');
    245         $clickedLi.css({'background-color': '#c4f3a4', 'border': '1px solid #41a700', 'color': '#348c42' });
    246     });
    247 
    248     $( 'div.restaurant_listings' ).on( 'click', '.restaurant-listings-pagination a', function() {
    249         var target = $( this ).closest( 'div.restaurant_listings' );
    250         var page   = $( this ).data( 'page' );
    251 
    252         restaurant_listings_store_state( target, page );
    253 
    254         target.triggerHandler( 'update_results', [ page, false ] );
    255 
    256         $( 'body, html' ).animate({
     243        $('input[name="search_price_range"]').attr('value', $clickedLi.attr('data-price_range'));
     244        $('input[name="search_price_range"]').triggerHandler('change');
     245        $clickedLi.css({ 'background-color': '#c4f3a4', 'border': '1px solid #41a700', 'color': '#348c42' });
     246    });
     247
     248    $('div.restaurant_listings').on('click', '.restaurant-listings-pagination a', function () {
     249        var target = $(this).closest('div.restaurant_listings');
     250        var page = $(this).data('page');
     251
     252        restaurant_listings_store_state(target, page);
     253
     254        target.triggerHandler('update_results', [page, false]);
     255
     256        $('body, html').animate({
    257257            scrollTop: target.offset().top
    258         }, 600 );
     258        }, 600);
    259259
    260260        return false;
    261     } );
    262 
    263     if ( $.isFunction( $.fn.chosen ) ) {
    264         if ( restaurant_listings_ajax_filters.is_rtl === 1 ) {
    265             $( 'select[name^="search_categories"]' ).addClass( 'chosen-rtl' );
    266         }
    267         $( 'select[name^="search_categories"]' ).chosen({ search_contains: true });
     261    });
     262
     263    if($.isFunction($.fn.chosen)) {
     264        if(restaurant_listings_ajax_filters.is_rtl === 1) {
     265            $('select[name^="search_categories"]').addClass('chosen-rtl');
     266        }
     267        $('select[name^="search_categories"]').chosen({ search_contains: true });
    268268    }
    269269
    270270    var $supports_html5_history = false;
    271     if ( window.history && window.history.pushState ) {
     271    if(window.history && window.history.pushState) {
    272272        $supports_html5_history = true;
    273273    }
     
    275275    var location = document.location.href.split('#')[0];
    276276
    277     function restaurant_listings_store_state( target, page ) {
    278         if ( $supports_html5_history ) {
    279             var form  = target.find( '.restaurant_filters' );
    280             var data  = $( form ).serialize();
    281             var index = $( 'div.restaurant_listings' ).index( target );
    282             window.history.replaceState( { id: 'restaurant_listings_state', page: page, data: data, index: index }, '', location + '#s=1' );
     277    function restaurant_listings_store_state(target, page) {
     278        if($supports_html5_history) {
     279            var form = target.find('.restaurant_filters');
     280            var data = $(form).serialize();
     281            var index = $('div.restaurant_listings').index(target);
     282            window.history.replaceState({ id: 'restaurant_listings_state', page: page, data: data, index: index }, '', location + '#s=1');
    283283        }
    284284    }
    285285
    286286    // Inital restaurant and form population
    287     $(window).on( 'load', function() {
    288         $( '.restaurant_filters' ).each( function() {
    289             var target      = $( this ).closest( 'div.restaurant_listings' );
    290             var form        = target.find( '.restaurant_filters' );
     287    $(window).on('load', function () {
     288        $('.restaurant_filters').each(function () {
     289            var target = $(this).closest('div.restaurant_listings');
     290            var form = target.find('.restaurant_filters');
    291291            var inital_page = 1;
    292             var index       = $( 'div.restaurant_listings' ).index( target );
    293 
    294             if ( window.history.state && window.location.hash ) {
     292            var index = $('div.restaurant_listings').index(target);
     293
     294            if(window.history.state && window.location.hash) {
    295295                var state = window.history.state;
    296                 if ( state.id && 'restaurant_listings_state' === state.id && index === state.index ) {
     296                if(state.id && 'restaurant_listings_state' === state.id && index === state.index) {
    297297                    inital_page = state.page;
    298                     form.deserialize( state.data );
    299                     form.find( ':input[name^="search_categories"]' ).not(':input[type="hidden"]').trigger( 'chosen:updated' );
     298                    form.deserialize(state.data);
     299                    form.find(':input[name^="search_categories"]').not(':input[type="hidden"]').trigger('chosen:updated');
    300300                }
    301301            }
    302302
    303             target.triggerHandler( 'update_results', [ inital_page, false ] );
     303            target.triggerHandler('update_results', [inital_page, false]);
    304304        });
    305305    });
    306 } );
     306});
  • wp-restaurant-listings/trunk/assets/js/ajax-filters.min.js

    r1839196 r1928419  
    1 jQuery(document).ready(function(t){var a=[];t(".restaurant_listings").on("update_results",function(e,r,s,i){var n,o,l,d,_="",c=t(this),u=c.find(".restaurant_filters"),g=c.find(".showing_restaurants"),p=c.find(".restaurant_listings"),h=c.data("per_page"),f=c.data("orderby"),w=c.data("order"),v=c.data("featured"),m=c.data("restaurant_types"),y=c.data("post_status"),k=t("div.restaurant_listings").index(this);if(!(k<0)){if(a[k]&&a[k].abort(),s||(t(p).addClass("loading"),t("li.restaurant_listings, li.no_restaurant_listings_found",p).css("visibility","hidden"),r>1&&!0!==c.data("show_pagination")?t(p).before('<a class="load_more_restaurants load_previous" href="#"><strong>'+restaurant_listings_ajax_filters.i18n_load_prev_listings+"</strong></a>"):c.find(".load_previous").remove(),c.find(".load_more_restaurants").data("page",r)),!0===c.data("show_filters")){var x=[];t(':input[name="filter_restaurant_type[]"]:checked, :input[name="filter_restaurant_type[]"][type="hidden"], :input[name="filter_restaurant_type"]',u).each(function(){x.push(t(this).val())}),n=u.find(':input[name^="search_categories"]').map(function(){return t(this).val()}).get(),o="",l="",d=u.find(':input[name="search_price_range"]').val();var b=u.find(':input[name="search_keywords"]'),j=u.find(':input[name="search_location"]');b.val()!==b.attr("placeholder")&&(o=b.val()),j.val()!==j.attr("placeholder")&&(l=j.val()),_={lang:restaurant_listings_ajax_filters.lang,search_keywords:o,search_location:l,search_categories:n,filter_restaurant_type:x,search_price_range:d,filter_post_status:y,per_page:h,orderby:f,order:w,page:r,featured:v,show_pagination:c.data("show_pagination"),form_data:u.serialize()}}else n=c.data("categories"),o=c.data("keywords"),l=c.data("location"),d=c.data("price_range"),n&&(n=n.split(",")),_={lang:restaurant_listings_ajax_filters.lang,search_categories:n,search_keywords:o,search_location:l,filter_post_status:y,search_price_range:d,filter_restaurant_type:m,per_page:h,orderby:f,order:w,page:r,featured:v,show_pagination:c.data("show_pagination")};a[k]=t.ajax({type:"POST",url:restaurant_listings_ajax_filters.ajax_url.toString().replace("%%endpoint%%","get_listings"),data:_,success:function(a){if(a)try{a.showing?t(g).show().html("<span>"+a.showing+"</span>"+a.showing_links):t(g).hide(),a.showing_all?t(g).addClass("wp-restaurant-listings-showing-all"):t(g).removeClass("wp-restaurant-listings-showing-all"),a.html&&(s&&i?t(p).prepend(a.html):s?t(p).append(a.html):t(p).html(a.html)),!0===c.data("show_pagination")?(c.find(".restaurant-listings-pagination").remove(),a.pagination&&c.append(a.pagination)):(!a.found_restaurants||a.max_num_pages<=r?t(".load_more_restaurants:not(.load_previous)",c).hide():i||t(".load_more_restaurants",c).show(),t(".load_more_restaurants",c).removeClass("loading"),t("li.restaurant_listings",p).css("visibility","visible")),t(p).removeClass("loading"),c.triggerHandler("updated_results",a)}catch(t){window.console&&window.console.log(t)}},error:function(t,a,e){window.console&&"abort"!==a&&window.console.log(a+": "+e)},statusCode:{404:function(){window.console&&window.console.log("Error 404: Ajax Endpoint cannot be reached. Go to Settings > Permalinks and save to resolve.")}}})}}),t('#search_keywords, #search_location, .restaurant_types :input, #search_categories, .restaurant-listings-filter, input[name="search_price_range"]').change(function(){var a=t(this).closest("div.restaurant_listings");a.triggerHandler("update_results",[1,!1]),s(a,1)}).on("keyup",function(a){13===a.which&&t(this).trigger("change")}),t(".restaurant_filters").on("click",".reset",function(){var a=t(this).closest("div.restaurant_listings"),e=t(this).closest("form");return e.find(':input[name="search_keywords"], :input[name="search_location"], .restaurant-listings-filter').not(':input[type="hidden"]').val("").trigger("chosen:updated"),e.find(':input[name^="search_categories"]').not(':input[type="hidden"]').val(0).trigger("chosen:updated"),t(':input[name="filter_restaurant_type[]"]',e).not(':input[type="hidden"]').attr("checked","checked"),e.find(':input[name="search_price_range"]').val(""),e.find(".price_range_filter li").attr("style",""),a.triggerHandler("reset"),a.triggerHandler("update_results",[1,!1]),s(a,1),!1}),t(document.body).on("click",".load_more_restaurants",function(){var a=t(this).closest("div.restaurant_listings"),e=parseInt(t(this).data("page")||1,10),r=!1;return t(this).addClass("loading"),t(this).is(".load_previous")?(r=!0,1===(e-=1)?t(this).remove():t(this).data("page",e)):(e+=1,t(this).data("page",e),s(a,e)),a.triggerHandler("update_results",[e,!0,r]),!1}),t(".price_range_filter").on("click","li",function(){t(".price_range_filter li").attr("style","");var a=t(this);t('input[name="search_price_range"]').attr("value",a.attr("data-price_range")),t('input[name="search_price_range"]').triggerHandler("change"),a.css({"background-color":"#c4f3a4",border:"1px solid #41a700",color:"#348c42"})}),t("div.restaurant_listings").on("click",".restaurant-listings-pagination a",function(){var a=t(this).closest("div.restaurant_listings"),e=t(this).data("page");return s(a,e),a.triggerHandler("update_results",[e,!1]),t("body, html").animate({scrollTop:a.offset().top},600),!1}),t.isFunction(t.fn.chosen)&&(1===restaurant_listings_ajax_filters.is_rtl&&t('select[name^="search_categories"]').addClass("chosen-rtl"),t('select[name^="search_categories"]').chosen({search_contains:!0}));var e=!1;window.history&&window.history.pushState&&(e=!0);var r=document.location.href.split("#")[0];function s(a,s){if(e){var i=a.find(".restaurant_filters"),n=t(i).serialize(),o=t("div.restaurant_listings").index(a);window.history.replaceState({id:"restaurant_listings_state",page:s,data:n,index:o},"",r+"#s=1")}}t(window).on("load",function(){t(".restaurant_filters").each(function(){var a=t(this).closest("div.restaurant_listings"),e=a.find(".restaurant_filters"),r=1,s=t("div.restaurant_listings").index(a);if(window.history.state&&window.location.hash){var i=window.history.state;i.id&&"restaurant_listings_state"===i.id&&s===i.index&&(r=i.page,e.deserialize(i.data),e.find(':input[name^="search_categories"]').not(':input[type="hidden"]').trigger("chosen:updated"))}a.triggerHandler("update_results",[r,!1])})})});
     1jQuery(document).ready(function(t){var a=[];t(".restaurant_listings").on("update_results",function(e,r,s,i){var n,o,l,d,_="",c=t(this),u=c.find(".restaurant_filters"),g=c.find(".showing_restaurants"),p=c.find(".restaurant_listings"),h=c.data("per_page"),f=c.data("orderby"),w=c.data("order"),v=c.data("featured"),m=c.data("restaurant_types"),y=c.data("post_status"),k=t("div.restaurant_listings").index(this);if(!(k<0)){if(a[k]&&a[k].abort(),s||(t(p).addClass("loading"),t("li.restaurant_listings, li.no_restaurant_listings_found",p).css("visibility","hidden"),r>1&&!0!==c.data("show_pagination")?t(p).before('<a class="load_more_restaurants load_previous" href="#"><strong>'+restaurant_listings_ajax_filters.i18n_load_prev_listings+"</strong></a>"):c.find(".load_previous").remove(),c.find(".load_more_restaurants").data("page",r)),!0===c.data("show_filters")){var x=[];t(':input[name="filter_restaurant_type[]"]:checked, :input[name="filter_restaurant_type[]"][type="hidden"], :input[name="filter_restaurant_type"]',u).each(function(){x.push(t(this).val())}),n=u.find(':input[name^="search_categories"]').map(function(){return t(this).val()}).get(),o="",l="",d=u.find(':input[name="search_price_range"]').val();var b=u.find(':input[name="search_keywords"]'),j=u.find(':input[name="search_location"]');b.val()!==b.attr("placeholder")&&(o=b.val()),j.val()!==j.attr("placeholder")&&(l=j.val()),_={lang:restaurant_listings_ajax_filters.lang,search_keywords:o,search_location:l,search_categories:n,filter_restaurant_type:x,search_price_range:d,filter_post_status:y,per_page:h,orderby:f,order:w,page:r,featured:v,show_pagination:c.data("show_pagination"),form_data:u.serialize()}}else n=c.data("categories"),o=c.data("keywords"),l=c.data("location"),d=c.data("price_range"),n&&(n=n.split(",")),_={lang:restaurant_listings_ajax_filters.lang,search_categories:n,search_keywords:o,search_location:l,filter_post_status:y,search_price_range:d,filter_restaurant_type:m,per_page:h,orderby:f,order:w,page:r,featured:v,show_pagination:c.data("show_pagination")};a[k]=t.ajax({type:"POST",url:restaurant_listings_ajax_filters.ajax_url.toString().replace("%%endpoint%%","get_listings"),data:_,success:function(a){if(a)try{a.showing?t(g).show().html("<span>"+a.showing+"</span>"+a.showing_links):t(g).hide(),a.showing_all?t(g).addClass("wp-restaurant-listings-showing-all"):t(g).removeClass("wp-restaurant-listings-showing-all"),a.html&&(s&&i?t(p).prepend(a.html):s?t(p).append(a.html):t(p).html(a.html)),!0===c.data("show_pagination")?(c.find(".restaurant-listings-pagination").remove(),a.pagination&&c.append(a.pagination)):(!a.found_restaurants||a.max_num_pages<=r?t(".load_more_restaurants:not(.load_previous)",c).hide():i||t(".load_more_restaurants",c).show(),t(".load_more_restaurants",c).removeClass("loading"),t("li.restaurant_listings",p).css("visibility","visible")),t(p).removeClass("loading"),c.triggerHandler("updated_results",a)}catch(t){window.console&&window.console.log(t)}},error:function(t,a,e){window.console&&"abort"!==a&&window.console.log(a+": "+e)},statusCode:{404:function(){window.console&&window.console.log("Error 404: Ajax Endpoint cannot be reached. Go to Settings > Permalinks and save to resolve.")}}})}}),t('#search_keywords, #search_location, .restaurant_types :input, #search_categories, .restaurant-listings-filter, input[name="search_price_range"]').change(function(){var a=t(this).closest("div.restaurant_listings");a.triggerHandler("update_results",[1,!1]),s(a,1)}).on("keyup",function(a){13===a.which&&t(this).trigger("change")}),t(".restaurant_filters").on("click",".reset",function(){var a=t(this).closest("div.restaurant_listings"),e=t(this).closest("form");return e.find(':input[name="search_keywords"], :input[name="search_location"], .restaurant-listings-filter').not(':input[type="hidden"]').val("").trigger("chosen:updated"),e.find(':input[name^="search_categories"]').not(':input[type="hidden"]').val("").trigger("chosen:updated"),t(':input[name="filter_restaurant_type[]"]',e).not(':input[type="hidden"]').attr("checked","checked"),e.find(':input[name="search_price_range"]').val(""),e.find(".price_range_filter li").attr("style",""),a.triggerHandler("reset"),a.triggerHandler("update_results",[1,!1]),s(a,1),!1}),t(document.body).on("click",".load_more_restaurants",function(){var a=t(this).closest("div.restaurant_listings"),e=parseInt(t(this).data("page")||1,10),r=!1;return t(this).addClass("loading"),t(this).is(".load_previous")?(r=!0,1===(e-=1)?t(this).remove():t(this).data("page",e)):(e+=1,t(this).data("page",e),s(a,e)),a.triggerHandler("update_results",[e,!0,r]),!1}),t(".price_range_filter").on("click","li",function(){t(".price_range_filter li").attr("style","");var a=t(this);t('input[name="search_price_range"]').attr("value",a.attr("data-price_range")),t('input[name="search_price_range"]').triggerHandler("change"),a.css({"background-color":"#c4f3a4",border:"1px solid #41a700",color:"#348c42"})}),t("div.restaurant_listings").on("click",".restaurant-listings-pagination a",function(){var a=t(this).closest("div.restaurant_listings"),e=t(this).data("page");return s(a,e),a.triggerHandler("update_results",[e,!1]),t("body, html").animate({scrollTop:a.offset().top},600),!1}),t.isFunction(t.fn.chosen)&&(1===restaurant_listings_ajax_filters.is_rtl&&t('select[name^="search_categories"]').addClass("chosen-rtl"),t('select[name^="search_categories"]').chosen({search_contains:!0}));var e=!1;window.history&&window.history.pushState&&(e=!0);var r=document.location.href.split("#")[0];function s(a,s){if(e){var i=a.find(".restaurant_filters"),n=t(i).serialize(),o=t("div.restaurant_listings").index(a);window.history.replaceState({id:"restaurant_listings_state",page:s,data:n,index:o},"",r+"#s=1")}}t(window).on("load",function(){t(".restaurant_filters").each(function(){var a=t(this).closest("div.restaurant_listings"),e=a.find(".restaurant_filters"),r=1,s=t("div.restaurant_listings").index(a);if(window.history.state&&window.location.hash){var i=window.history.state;i.id&&"restaurant_listings_state"===i.id&&s===i.index&&(r=i.page,e.deserialize(i.data),e.find(':input[name^="search_categories"]').not(':input[type="hidden"]').trigger("chosen:updated"))}a.triggerHandler("update_results",[r,!1])})})});
  • wp-restaurant-listings/trunk/includes/3rd-party/polylang.php

    r1851196 r1928419  
    1212    add_filter( 'wprl_lang', 'polylang_wprl_get_restaurant_listings_lang' );
    1313    add_filter( 'wprl_page_id', 'polylang_wprl_page_id' );
     14    add_action( 'get_restaurant_listings_query_args', 'polylang_wprl_query_language' );
    1415}
    1516add_action( 'pll_init', 'polylang_wprl_init' );
     17
     18/**
     19 * Sets the current language when running restaurant listings query.
     20 *
     21 * @since 1.0.1
     22 *
     23 * @param array $query_args
     24 * @return array
     25 */
     26function polylang_wprl_query_language( $query_args ) {
     27    if ( isset( $_POST['lang'] ) ) {
     28        $query_args['lang'] = $_POST['lang'];
     29    }
     30    return $query_args;
     31}
    1632
    1733/**
     
    4662    return absint( $page_id );
    4763}
    48 
  • wp-restaurant-listings/trunk/includes/abstracts/abstract-wp-restaurant-listings-form.php

    r1851196 r1928419  
    8585        ) {
    8686            delete_post_meta( $_COOKIE[ 'wp-restaurant-listings-submitting-restaurant-id' ], '_submitting_key' );
    87             setcookie( 'wp-restaurant-listings-submitting-restaurant-id', '', time() - 3600, COOKIEPATH, COOKIE_DOMAIN, false );
    88             setcookie( 'wp-restaurant-listings-submitting-restaurant-key', '', time() - 3600, COOKIEPATH, COOKIE_DOMAIN, false );
     87            setcookie( 'wp-restaurant-listings-submitting-restaurant-id', '', 0, COOKIEPATH, COOKIE_DOMAIN, false );
     88            setcookie( 'wp-restaurant-listings-submitting-restaurant-key', '', 0, COOKIEPATH, COOKIE_DOMAIN, false );
    8989            wp_redirect( remove_query_arg( array( 'new', 'key' ), $_SERVER[ 'REQUEST_URI' ] ) );
    9090        }
     
    237237     */
    238238    protected function sort_by_priority( $a, $b ) {
    239         if ( $a['priority'] == $b['priority'] ) {
    240             return 0;
    241         }
    242         return ( $a['priority'] < $b['priority'] ) ? -1 : 1;
     239        if ( $a['priority'] == $b['priority'] ) {
     240            return 0;
     241        }
     242        return ( $a['priority'] < $b['priority'] ) ? -1 : 1;
    243243    }
    244244
     
    284284     * Navigates through an array and sanitizes the field.
    285285     *
    286      * @param array|string $value The array or string to be sanitized.
    287      * @return array|string $value The sanitized array (or string from the callback).
    288      */
    289     protected function sanitize_posted_field( $value ) {
    290         // Santize value
    291         $value = is_array( $value ) ? array_map( array( $this, 'sanitize_posted_field' ), $value ) : sanitize_text_field( stripslashes( trim( $value ) ) );
    292 
    293         return $value;
     286     * @since 1.0.0
     287     * @since 1.0.1 Added the $sanitizer argument
     288     *
     289     * @param array|string    $value      The array or string to be sanitized.
     290     * @param string|callable $sanitizer  The sanitization method to use. Built in: `url`, `email`, `url_or_email`, or
     291     *                                    default (text). Custom single argument callable allowed.
     292     * @return array|string   $value      The sanitized array (or string from the callback).
     293     */
     294    protected function sanitize_posted_field( $value, $sanitizer = null ) {
     295        // Sanitize value.
     296        if ( is_array( $value ) ) {
     297            foreach ( $value as $key => $val ) {
     298                $value[ $key ] = $this->sanitize_posted_field( $val, $sanitizer );
     299            }
     300
     301            return $value;
     302        }
     303
     304        $value = trim( $value );
     305
     306        if ( 'url' === $sanitizer ) {
     307            return esc_url_raw( $value );
     308        } elseif ( 'email' === $sanitizer ) {
     309            return sanitize_email( $value );
     310        } elseif ( 'url_or_email' === $sanitizer ) {
     311            if ( null !== parse_url( $value, PHP_URL_HOST ) ) {
     312                // Sanitize as URL.
     313                return esc_url_raw( $value );
     314            }
     315            // Sanitize as email.
     316            return sanitize_email( $value );
     317        } elseif ( is_callable( $sanitizer ) ) {
     318            return call_user_func( $sanitizer, $value );
     319        }
     320
     321        // Use standard text sanitizer.
     322        return sanitize_text_field( stripslashes( $value ) );
    294323    }
    295324
     
    302331     */
    303332    protected function get_posted_field( $key, $field ) {
    304         return isset( $_POST[ $key ] ) ? $this->sanitize_posted_field( $_POST[ $key ] ) : '';
     333        // Allow custom sanitizers with standard text fields.
     334        if ( ! isset( $field['sanitizer'] ) ) {
     335            $field['sanitizer'] = null;
     336        }
     337        return isset( $_POST[ $key ] ) ? $this->sanitize_posted_field( $_POST[ $key ], $field['sanitizer'] ) : '';
    305338    }
    306339
  • wp-restaurant-listings/trunk/includes/admin/class-wp-restaurant-listings-admin.php

    r1851196 r1928419  
    3939        global $wp_version;
    4040
    41         include_once( 'class-wp-restaurant-listings-cpt.php' );
     41        include_once dirname( __FILE__ ) . '/class-wp-restaurant-listings-cpt.php';
    4242        if ( version_compare( $wp_version, '4.7.0', '<' ) ) {
    43             include_once( 'class-wp-restaurant-listings-cpt-legacy.php' );
     43            include_once dirname( __FILE__ ) . '/class-wp-restaurant-listings-cpt-legacy.php';
    4444            WP_Restaurant_Listings_CPT_Legacy::instance();
    4545        } else {
    4646            WP_Restaurant_Listings_CPT::instance();
    4747        }
    48         include_once( 'class-wp-restaurant-listings-settings.php' );
    49         include_once( 'class-wp-restaurant-listings-writepanels.php' );
    50         include_once( 'class-wp-restaurant-listings-setup.php' );
     48
     49        include_once dirname( __FILE__ ) . '/class-wp-restaurant-listings-settings.php';
     50        include_once dirname( __FILE__ ) . '/class-wp-restaurant-listings-writepanels.php';
     51        include_once dirname( __FILE__ ) . '/class-wp-restaurant-listings-setup.php';
    5152
    5253        $this->settings_page = WP_Restaurant_Listings_Settings::instance();
     
    6162     */
    6263    public function conditional_includes() {
    63         if ( ! $screen = get_current_screen() ) {
     64        $screen = get_current_screen();
     65        if ( ! $screen ) {
    6466            return;
    6567        }
     68
    6669        switch ( $screen->id ) {
    67             case 'options-permalink' :
    68                 include( 'class-wp-restaurant-listings-permalink-settings.php' );
     70            case 'options-permalink':
     71                include dirname( __FILE__ ) . '/class-wp-restaurant-listings-permalink-settings.php';
    6972                break;
    7073        }
  • wp-restaurant-listings/trunk/includes/admin/class-wp-restaurant-listings-setup.php

    r1858484 r1928419  
    157157            <?php if ( 1 === $step ) : ?>
    158158
    159                 <h3><?php _e( 'Setup Wizard Introduction', 'wp-restaurant-listings' ); ?></h3>
    160 
    161                 <p><?php _e( 'Thanks for installing <em>WP Restaurant Listings</em>!', 'wp-restaurant-listings' ); ?></p>
    162                 <p><?php _e( 'This setup wizard will help you get started by creating the pages for restaurant submission, restaurant listings, and listings your restaurants.', 'wp-restaurant-listings' ); ?></p>
    163                 <p><?php printf( __( 'If you want to skip the wizard and setup the pages and shortcodes yourself manually, the process is still relatively simple. Refer to the %sdocumentation%s for help.', 'wp-restaurant-listings' ), '<a href="https://wpdrift.com/docs/restaurants/">', '</a>' ); ?></p>
     159                <h3><?php _e( 'Welcome to the Setup Wizard!', 'wp-restaurant-listings' ); ?></h3>
     160
     161                <p><?php _e( 'Thanks for installing <em>WP Restaurant Listings</em>! Let\'s get your site ready to accept restaurant listings.', 'wp-restaurant-listings' ); ?></p>
     162                <p><?php _e( 'This setup wizard will walk you through the process of creating the pages for restaurant submissions, management, and listings.', 'wp-restaurant-listings' ); ?></p>
     163                <p><?php printf( __( 'If you\'d prefer to skip this and set up your pages manually, our %sdocumentation%s will walk you through each step.', 'wp-restaurant-listings' ), '<a href="https://wpdrift.com/docs/restaurants/">', '</a>' ); ?></p>
    164164
    165165                <p class="submit">
    166                     <a href="<?php echo esc_url( add_query_arg( 'step', 2 ) ); ?>" class="button button-primary"><?php _e( 'Continue to page setup', 'wp-restaurant-listings' ); ?></a>
    167                     <a href="<?php echo esc_url( add_query_arg( 'skip-restaurant-listings-setup', 1, admin_url( 'index.php?page=restaurant-listings-setup&step=3' ) ) ); ?>" class="button"><?php _e( 'Skip setup. I will setup the plugin manually', 'wp-restaurant-listings' ); ?></a>
     166                    <a href="<?php echo esc_url( add_query_arg( 'step', 2 ) ); ?>" class="button button-primary"><?php _e( 'Start setup', 'wp-restaurant-listings' ); ?></a>
     167                    <a href="<?php echo esc_url( add_query_arg( 'skip-restaurant-listings-setup', 1, admin_url( 'index.php?page=restaurant-listings-setup&step=3' ) ) ); ?>" class="button"><?php _e( 'Skip setup. I will set up the plugin manually.', 'wp-restaurant-listings' ); ?></a>
    168168                </p>
    169169
     
    173173                <h3><?php _e( 'Page Setup', 'wp-restaurant-listings' ); ?></h3>
    174174
    175                 <p><?php printf( __( '<em>WP Restaurant Listings</em> includes %1$sshortcodes%2$s which can be used within your %3$spages%2$s to output content. These can be created for you below. For more information on the restaurant shortcodes view the %4$sshortcode documentation%2$s.', 'wp-restaurant-listings' ), '<a href="http://codex.wordpress.org/Shortcode" title="What is a shortcode?" target="_blank" class="help-page-link">', '</a>', '<a href="http://codex.wordpress.org/Pages" target="_blank" class="help-page-link">', '<a href="https://wpdrift.com/docs/restaurants/shortcode-reference/" target="_blank" class="help-page-link">' ); ?></p>
     175                <p><?php _e( 'WP Restaurant Listings, users can post, manage, and browse restaurant listings right on your website. Tell us which of these common pages you\'d like your site to have and we\'ll create and configure them for you.', 'wp-restaurant-listings' ); ?></p>
     176                <p><?php printf( __( '(These pages are created using %1$sshortcodes%2$s, which we take care of in this step. If you\'d like to build these pages yourself or want to add one of these options to an existing page on your site, you can skip this step and take a look at %4$sshortcode documentation%2$s for detailed instructions.)', 'wp-restaurant-listings' ), '<a href="http://codex.wordpress.org/Shortcode" title="What is a shortcode?" target="_blank" class="help-page-link">', '</a>', '<a href="http://codex.wordpress.org/Pages" target="_blank" class="help-page-link">', '<a href="https://wpdrift.com/docs/restaurants/shortcode-reference/" target="_blank" class="help-page-link">' ); ?></p>
    176177
    177178                <form action="<?php echo esc_url( add_query_arg( 'step', 3 ) ); ?>" method="post">
     
    191192                                <td><input type="text" value="<?php echo esc_attr( _x( 'Post a Restaurant', 'Default page title (wizard)', 'wp-restaurant-listings' ) ); ?>" name="wp-restaurant-listings-page-title[submit_restaurant_form]" /></td>
    192193                                <td>
    193                                     <p><?php _e( 'This page allows employers to post restaurants to your website from the front-end.', 'wp-restaurant-listings' ); ?></p>
    194 
    195                                     <p><?php _e( 'If you do not want to accept submissions from users in this way (for example you just want to post restaurants from the admin dashboard) you can skip creating this page.', 'wp-restaurant-listings' ); ?></p>
     194                                    <p><?php _e( 'Creates a page that allows users to post new restaurants directly from a page on your website, instead of requiring them to log in to an admin area. If you\'d rather not allow this -- for example, if you want users to use the admin dashboard only -- you can uncheck this setting.', 'wp-restaurant-listings' ); ?></p>
    196195                                </td>
    197196                                <td><code>[submit_restaurant_form]</code></td>
     
    201200                                <td><input type="text" value="<?php echo esc_attr( _x( 'Restaurant Dashboard', 'Default page title (wizard)', 'wp-restaurant-listings' ) ); ?>" name="wp-restaurant-listings-page-title[restaurant_dashboard]" /></td>
    202201                                <td>
    203                                     <p><?php _e( 'This page allows employers to manage and edit their own restaurants from the front-end.', 'wp-restaurant-listings' ); ?></p>
    204 
    205                                     <p><?php _e( 'If you plan on managing all listings from the admin dashboard you can skip creating this page.', 'wp-restaurant-listings' ); ?></p>
     202                                    <p><?php _e( 'Creates a page that allows users to manage their restaurant listings directly from a page on your website, instead of requiring them to log in to an admin area. If you want to manage all restaurant listings from the admin dashboard only, you can uncheck this setting.', 'wp-restaurant-listings' ); ?></p>
    206203                                </td>
    207204                                <td><code>[restaurant_dashboard]</code></td>
     
    210207                                <td><input type="checkbox" checked="checked" name="wp-restaurant-listings-create-page[restaurants]" /></td>
    211208                                <td><input type="text" value="<?php echo esc_attr( _x( 'Restaurants', 'Default page title (wizard)', 'wp-restaurant-listings' ) ); ?>" name="wp-restaurant-listings-page-title[restaurants]" /></td>
    212                                 <td><?php _e( 'This page allows users to browse, search, and filter restaurant listings on the front-end of your site.', 'wp-restaurant-listings' ); ?></td>
     209                                <td><?php _e( 'Creates a page where visitors can browse, search, and filter restaurant listings.', 'wp-restaurant-listings' ); ?></td>
    213210                                <td><code>[restaurants]</code></td>
    214211                            </tr>
     
    234231            <?php if ( 3 === $step ) : ?>
    235232
    236                 <h3><?php _e( 'All Done!', 'wp-restaurant-listings' ); ?></h3>
    237 
    238                 <p><?php _e( 'Looks like you\'re all set to start using the plugin. In case you\'re wondering where to go next:', 'wp-restaurant-listings' ); ?></p>
     233                <h3><?php _e( 'You\'re ready to start using WP Restaurant Listings!', 'wp-restaurant-listings' ); ?></h3>
     234
     235                <p><?php _e( 'Wondering what to do now? Here are some of the most common next steps:', 'wp-restaurant-listings' ); ?></p>
    239236
    240237                <ul class="wp-restaurant-listings-next-steps">
    241                     <li><a href="<?php echo admin_url( 'edit.php?post_type=restaurant_listings&page=restaurant-listings-settings' ); ?>"><?php _e( 'Tweak the plugin settings', 'wp-restaurant-listings' ); ?></a></li>
    242                     <li><a href="<?php echo admin_url( 'post-new.php?post_type=restaurant_listings' ); ?>"><?php _e( 'Add a restaurant via the back-end', 'wp-restaurant-listings' ); ?></a></li>
     238                    <li><a href="<?php echo admin_url( 'edit.php?post_type=restaurant_listings&page=restaurant-listings-settings' ); ?>"><?php _e( 'Tweak your settings', 'wp-restaurant-listings' ); ?></a></li>
     239                    <li><a href="<?php echo admin_url( 'post-new.php?post_type=restaurant_listings' ); ?>"><?php _e( 'Add a restaurant using the admin dashboard', 'wp-restaurant-listings' ); ?></a></li>
     240
     241                    <?php if ( $permalink = restaurant_listings_get_permalink( 'restaurants' ) ) : ?>
     242                        <li><a href="<?php echo esc_url( $permalink ); ?>"><?php _e( 'View submitted restaurant listings', 'wp-restaurant-listings' ); ?></a></li>
     243                    <?php else : ?>
     244                        <li><a href="https://wpdrift.com/docs/restaurants/shortcode-reference/#section-1"><?php _e( 'Add restaurant listings to a page using the [restaurants] shortcode', 'wp-restaurant-listings' ); ?></a></li>
     245                    <?php endif; ?>
    243246
    244247                    <?php if ( $permalink = restaurant_listings_get_permalink( 'submit_restaurant_form' ) ) : ?>
    245248                        <li><a href="<?php echo esc_url( $permalink ); ?>"><?php _e( 'Add a restaurant via the front-end', 'wp-restaurant-listings' ); ?></a></li>
    246249                    <?php else : ?>
    247                         <li><a href="https://wpdrift.com/docs/restaurants/the-restaurant-submission-form/"><?php _e( 'Find out more about the front-end restaurant submission form', 'wp-restaurant-listings' ); ?></a></li>
    248                     <?php endif; ?>
    249 
    250                     <?php if ( $permalink = restaurant_listings_get_permalink( 'restaurants' ) ) : ?>
    251                         <li><a href="<?php echo esc_url( $permalink ); ?>"><?php _e( 'View submitted restaurant listings', 'wp-restaurant-listings' ); ?></a></li>
    252                     <?php else : ?>
    253                         <li><a href="https://wpdrift.com/docs/restaurants/shortcode-reference/#section-1"><?php _e( 'Add the [restaurants] shortcode to a page to list restaurants', 'wp-restaurant-listings' ); ?></a></li>
     250                        <li><a href="https://wpdrift.com/docs/restaurants/the-restaurant-submission-form/"><?php _e( 'Learn to use the front-end restaurant submission board', 'wp-restaurant-listings' ); ?></a></li>
    254251                    <?php endif; ?>
    255252
     
    257254                        <li><a href="<?php echo esc_url( $permalink ); ?>"><?php _e( 'View the restaurant dashboard', 'wp-restaurant-listings' ); ?></a></li>
    258255                    <?php else : ?>
    259                         <li><a href="https://wpdrift.com/docs/restaurants/the-restaurant-dashboard/"><?php _e( 'Find out more about the front-end restaurant dashboard', 'wp-restaurant-listings' ); ?></a></li>
     256                        <li><a href="https://wpdrift.com/docs/restaurants/the-restaurant-dashboard/"><?php _e( 'Learn to use the front-end restaurant dashboard', 'wp-restaurant-listings' ); ?></a></li>
    260257                    <?php endif; ?>
    261258                </ul>
    262259
    263                 <p><?php printf( __( 'And don\'t forget, if you need any more help using <em>WP Restaurant Listings</em> you can consult the %1$sdocumentation%2$s or %3$spost on the forums%2$s!', 'wp-restaurant-listings' ), '<a href="https://wpdrift.com/docs/restaurants/">', '</a>', '<a href="https://wordpress.org/support/plugin/wp-restaurant-listings">' ); ?></p>
     260                <p><?php printf( __( 'If you need help, you can find more detail in our %1$ssupport documentation%2$s or post your question on the %3$sWP Restaurant Listings support forums%2$s.', 'wp-restaurant-listings' ), '<a href="https://wpdrift.com/docs/restaurants/">', '</a>', '<a href="https://wordpress.org/support/plugin/wp-restaurant-listings">' ); ?></p>
    264261
    265262                <div class="wp-restaurant-listings-support-the-plugin">
    266                     <h3><?php _e( 'Support the Ongoing Development of this Plugin', 'wp-restaurant-listings' ); ?></h3>
    267                     <p><?php _e( 'There are many ways to support open-source projects such as WP Restaurant Listings, for example code contribution, translation, or even telling your friends how awesome the plugin (hopefully) is. Thanks in advance for your support - it is much appreciated!', 'wp-restaurant-listings' ); ?></p>
     263                    <h3><?php _e( 'Support WP Restaurant Listings\'s Ongoing Development', 'wp-restaurant-listings' ); ?></h3>
     264                    <p><?php _e( 'There are lots of ways you can support open source software projects like this one: contributing code, fixing a bug, assisting with non-English translation, or just telling your friends about WP Restaurant Listings to help spread the word. We appreciate your support!', 'wp-restaurant-listings' ); ?></p>
    268265                    <ul>
    269266                        <li class="icon-review"><a href="https://wordpress.org/support/view/plugin-reviews/wp-restaurant-listings#postform"><?php _e( 'Leave a positive review', 'wp-restaurant-listings' ); ?></a></li>
  • wp-restaurant-listings/trunk/includes/admin/class-wp-restaurant-listings-writepanels.php

    r1851196 r1928419  
    269269        ?>
    270270        <p class="form-field">
    271             <label for="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $field['label'] ) ; ?>: <?php if ( ! empty( $field['description'] ) ) : ?><span class="tips" data-tip="<?php echo esc_attr( $field['description'] ); ?>">[?]</span><?php endif; ?></label>
     271            <label for="<?php echo esc_attr( $key ); ?>"><?php echo wp_strip_all_tags( $field['label'] ) ; ?>: <?php if ( ! empty( $field['description'] ) ) : ?><span class="tips" data-tip="<?php echo esc_attr( $field['description'] ); ?>">[?]</span><?php endif; ?></label>
    272272            <?php
    273273            if ( ! empty( $field['multiple'] ) ) {
     
    311311        ?>
    312312        <p class="form-field">
    313             <label for="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $field['label'] ) ; ?>: <?php if ( ! empty( $field['description'] ) ) : ?><span class="tips" data-tip="<?php echo esc_attr( $field['description'] ); ?>">[?]</span><?php endif; ?></label>
     313            <label for="<?php echo esc_attr( $key ); ?>"><?php echo wp_strip_all_tags( $field['label'] ) ; ?>: <?php if ( ! empty( $field['description'] ) ) : ?><span class="tips" data-tip="<?php echo esc_attr( $field['description'] ); ?>">[?]</span><?php endif; ?></label>
    314314            <?php
    315315            if ( ! empty( $field['multiple'] ) ) {
     
    354354        ?>
    355355        <p class="form-field">
    356             <label for="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $field['label'] ) ; ?>: <?php if ( ! empty( $field['description'] ) ) : ?><span class="tips" data-tip="<?php echo esc_attr( $field['description'] ); ?>">[?]</span><?php endif; ?></label>
     356            <label for="<?php echo esc_attr( $key ); ?>"><?php echo wp_strip_all_tags( $field['label'] ) ; ?>: <?php if ( ! empty( $field['description'] ) ) : ?><span class="tips" data-tip="<?php echo esc_attr( $field['description'] ); ?>">[?]</span><?php endif; ?></label>
    357357            <input type="text" autocomplete="off" name="<?php echo esc_attr( $name ); ?>" class="<?php echo esc_attr( $classes ); ?>" id="<?php echo esc_attr( $key ); ?>" placeholder="<?php echo esc_attr( $field['placeholder'] ); ?>" value="<?php echo esc_attr( $field['value'] ); ?>" />
    358358        </p>
     
    406406        ?>
    407407        <p class="form-field">
    408             <label for="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $field['label'] ) ; ?>: <?php if ( ! empty( $field['description'] ) ) : ?><span class="tips" data-tip="<?php echo esc_attr( $field['description'] ); ?>">[?]</span><?php endif; ?></label>
     408            <label for="<?php echo esc_attr( $key ); ?>"><?php echo wp_strip_all_tags( $field['label'] ) ; ?>: <?php if ( ! empty( $field['description'] ) ) : ?><span class="tips" data-tip="<?php echo esc_attr( $field['description'] ); ?>">[?]</span><?php endif; ?></label>
    409409            <?php if ( ! empty( $field['information'] ) ) : ?><span class="information"><?php echo wp_kses( $field['information'], array( 'a' => array( 'href' => array() ) ) ); ?></span><?php endif; ?>
    410410            <?php echo $hidden_input; ?>
     
    432432        ?>
    433433        <p class="form-field">
    434             <label for="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $field['label'] ) ; ?>: <?php if ( ! empty( $field['description'] ) ) : ?><span class="tips" data-tip="<?php echo esc_attr( $field['description'] ); ?>">[?]</span><?php endif; ?></label>
     434            <label for="<?php echo esc_attr( $key ); ?>"><?php echo wp_strip_all_tags( $field['label'] ) ; ?>: <?php if ( ! empty( $field['description'] ) ) : ?><span class="tips" data-tip="<?php echo esc_attr( $field['description'] ); ?>">[?]</span><?php endif; ?></label>
    435435            <textarea name="<?php echo esc_attr( $name ); ?>" id="<?php echo esc_attr( $key ); ?>" placeholder="<?php echo esc_attr( $field['placeholder'] ); ?>"><?php echo esc_html( $field['value'] ); ?></textarea>
    436436        </p>
     
    457457        ?>
    458458        <p class="form-field">
    459             <label for="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $field['label'] ) ; ?>: <?php if ( ! empty( $field['description'] ) ) : ?><span class="tips" data-tip="<?php echo esc_attr( $field['description'] ); ?>">[?]</span><?php endif; ?></label>
     459            <label for="<?php echo esc_attr( $key ); ?>"><?php echo wp_strip_all_tags( $field['label'] ) ; ?>: <?php if ( ! empty( $field['description'] ) ) : ?><span class="tips" data-tip="<?php echo esc_attr( $field['description'] ); ?>">[?]</span><?php endif; ?></label>
    460460            <select name="<?php echo esc_attr( $name ); ?>" id="<?php echo esc_attr( $key ); ?>">
    461461                <?php foreach ( $field['options'] as $key => $value ) : ?>
     
    486486        ?>
    487487        <p class="form-field">
    488             <label for="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $field['label'] ) ; ?>: <?php if ( ! empty( $field['description'] ) ) : ?><span class="tips" data-tip="<?php echo esc_attr( $field['description'] ); ?>">[?]</span><?php endif; ?></label>
     488            <label for="<?php echo esc_attr( $key ); ?>"><?php echo wp_strip_all_tags( $field['label'] ) ; ?>: <?php if ( ! empty( $field['description'] ) ) : ?><span class="tips" data-tip="<?php echo esc_attr( $field['description'] ); ?>">[?]</span><?php endif; ?></label>
    489489            <select multiple="multiple" name="<?php echo esc_attr( $name ); ?>[]" id="<?php echo esc_attr( $key ); ?>">
    490490                <?php foreach ( $field['options'] as $key => $value ) : ?>
     
    515515        ?>
    516516        <p class="form-field form-field-checkbox">
    517             <label for="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $field['label'] ) ; ?></label>
     517            <label for="<?php echo esc_attr( $key ); ?>"><?php echo wp_strip_all_tags( $field['label'] ) ; ?></label>
    518518            <input type="checkbox" class="checkbox" name="<?php echo esc_attr( $name ); ?>" id="<?php echo esc_attr( $key ); ?>" value="1" <?php checked( $field['value'], 1 ); ?> />
    519519            <?php if ( ! empty( $field['description'] ) ) : ?><span class="description"><?php echo $field['description']; ?></span><?php endif; ?>
     
    543543        ?>
    544544        <p class="form-field form-field-author">
    545             <label for="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $field['label'] ) ; ?>:</label>
     545            <label for="<?php echo esc_attr( $key ); ?>"><?php echo wp_strip_all_tags( $field['label'] ) ; ?>:</label>
    546546            <span class="current-author">
    547547                <?php
     
    580580        ?>
    581581        <p class="form-field form-field-checkbox">
    582             <label><?php echo esc_html( $field['label'] ) ; ?></label>
     582            <label><?php echo wp_strip_all_tags( $field['label'] ) ; ?></label>
    583583            <?php foreach ( $field['options'] as $option_key => $value ) : ?>
    584584                <label><input type="radio" class="radio" name="<?php echo esc_attr( isset( $field['name'] ) ? $field['name'] : $key ); ?>" value="<?php echo esc_attr( $option_key ); ?>" <?php checked( $field['value'], $option_key ); ?> /> <?php echo esc_html( $value ); ?></label>
     
    629629
    630630            <?php if ( ! is_admin() ) : ?>
    631                 <label for="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $field['label'] ) ; ?>:</label>
     631                <label for="<?php echo esc_attr( $key ); ?>"><?php echo wp_strip_all_tags( $field['label'] ) ; ?>:</label>
    632632            <?php endif; ?>
    633633
  • wp-restaurant-listings/trunk/includes/class-wp-restaurant-listings.php

    r1851196 r1928419  
    2222     * @var string
    2323     */
    24     public $version = '1.0.0';
     24    public $version = '1.0.1';
    2525
    2626    /**
     
    119119        add_action( 'admin_init', array( $this, 'updater' ) );
    120120        add_action( 'wp_logout', array( $this, 'cleanup_restaurant_posting_cookies' ) );
     121
     122        // Defaults for WPRL core actions.
     123        add_action( 'wprl_notify_new_user', 'wp_restaurant_listings_notify_new_user', 10, 2 );
    121124    }
    122125
  • wp-restaurant-listings/trunk/includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php

    r1851196 r1928419  
    139139        }
    140140
    141         $currency_symbol = get_option('restaurant_listings_currency');
     141        $currency_symbol = get_option('restaurant_listings_currency');
    142142
    143143        $this->fields = apply_filters( 'submit_restaurant_form_fields', array(
    144144            'basic' => array(
    145                 'restaurant_name' => array(
    146                     'label'       => __( 'Restaurant name', 'wp-restaurant-listings' ),
    147                     'type'        => 'text',
    148                     'required'    => true,
    149                     'placeholder' => __( 'Enter the name of the restaurant', 'wp-restaurant-listings' ),
    150                     'priority'    => 1
    151                 ),
     145                'restaurant_name' => array(
     146                    'label'       => __( 'Restaurant name', 'wp-restaurant-listings' ),
     147                    'type'        => 'text',
     148                    'required'    => true,
     149                    'placeholder' => __( 'Enter the name of the restaurant', 'wp-restaurant-listings' ),
     150                    'priority'    => 1
     151                ),
    152152                'restaurant_location' => array(
    153153                    'label'       => __( 'Address', 'wp-restaurant-listings' ),
     
    177177                ),
    178178                'restaurant_price_range' => array(
    179                     'label'       => __( 'Price Range', 'wp-restaurant-listings' ),
    180                     'type'        => 'select',
    181                     'default'     => 1,
    182                     'options'     => array(
    183                         1 => str_repeat( $currency_symbol, 1 ),
    184                         2 => str_repeat( $currency_symbol, 2 ),
    185                         3 => str_repeat( $currency_symbol, 3 ),
    186                         4 => str_repeat( $currency_symbol, 4 ),
    187                     ),
    188                     'required'    => true,
    189                     'priority'    => 5,
    190                     'default'     => '',
    191                 ),
     179                    'label'       => __( 'Price Range', 'wp-restaurant-listings' ),
     180                    'type'        => 'select',
     181                    'default'     => 1,
     182                    'options'     => array(
     183                        1 => str_repeat( $currency_symbol, 1 ),
     184                        2 => str_repeat( $currency_symbol, 2 ),
     185                        3 => str_repeat( $currency_symbol, 3 ),
     186                        4 => str_repeat( $currency_symbol, 4 ),
     187                    ),
     188                    'required'    => true,
     189                    'priority'    => 5,
     190                    'default'     => '',
     191                ),
    192192                'restaurant_description' => array(
    193193                    'label'       => __( 'Description', 'wp-restaurant-listings' ),
     
    200200                    'label'       => __( 'Restaurant email', 'wp-restaurant-listings' ),
    201201                    'type'        => 'text',
     202                    'sanitizer'   => 'url_or_email',
    202203                    'required'    => true,
    203204                    'placeholder' => __( 'Enter an email address or website URL', 'wp-restaurant-listings' ),
     
    213214                    'priority'    => 1
    214215                ),
    215                 'restaurant_website' => array(
     216                'restaurant_website' => array(
    216217                    'label'       => __( 'Website', 'wp-restaurant-listings' ),
    217218                    'type'        => 'text',
     219                    'sanitizer'   => 'url',
    218220                    'required'    => false,
    219221                    'placeholder' => __( 'http://', 'wp-restaurant-listings' ),
     
    230232                    'label'       => __( 'Video', 'wp-restaurant-listings' ),
    231233                    'type'        => 'text',
     234                    'sanitizer'   => 'url',
    232235                    'required'    => false,
    233236                    'placeholder' => __( 'A link to a video about your restaurant', 'wp-restaurant-listings' ),
     
    256259                    )
    257260                ),
    258                 'restaurant_image_gallery' => array(
    259                     'label'       => __( 'Gallery Images',  'wp-restaurant-listings' ),
    260                     'type'        => 'file',
    261                     'multiple'    => true,
    262                     'required'    => false,
    263                     'placeholder' => '',
    264                     'priority'    => 7,
    265                     'ajax'        => true,
    266                     'allowed_mime_types' => array(
    267                         'jpg'  => 'image/jpeg',
    268                         'jpeg' => 'image/jpeg',
    269                         'gif'  => 'image/gif',
    270                         'png'  => 'image/png'
    271                     )
    272                 ),
    273                 'restaurant_menu' => array(
    274                     'label'       => __( 'Menu',  'wp-restaurant-listings' ),
    275                     'type'        => 'file',
    276                     'multiple'    => true,
    277                     'required'    => false,
    278                     'placeholder' => '',
    279                     'priority'    => 8,
    280                     'ajax'        => true,
    281                     'allowed_mime_types' => array(
    282                         'jpg'  => 'image/jpeg',
    283                         'jpeg' => 'image/jpeg',
    284                         'gif'  => 'image/gif',
    285                         'png'  => 'image/png'
    286                     )
    287                 ),
    288                 'restaurant_hours' => array(
    289                     'label'       => __( 'Hours of Operation', 'wp-restaurant-listings' ),
    290                     'type'        => 'business-hours',
    291                     'required'    => false,
    292                     'placeholder' => '',
    293                     'priority'    => 9,
    294                     'default'     => ''
    295                 ),
     261                'restaurant_image_gallery' => array(
     262                    'label'       => __( 'Gallery Images',  'wp-restaurant-listings' ),
     263                    'type'        => 'file',
     264                    'multiple'    => true,
     265                    'required'    => false,
     266                    'placeholder' => '',
     267                    'priority'    => 7,
     268                    'ajax'        => true,
     269                    'allowed_mime_types' => array(
     270                        'jpg'  => 'image/jpeg',
     271                        'jpeg' => 'image/jpeg',
     272                        'gif'  => 'image/gif',
     273                        'png'  => 'image/png'
     274                    )
     275                ),
     276                'restaurant_menu' => array(
     277                    'label'       => __( 'Menu',  'wp-restaurant-listings' ),
     278                    'type'        => 'file',
     279                    'multiple'    => true,
     280                    'required'    => false,
     281                    'placeholder' => '',
     282                    'priority'    => 8,
     283                    'ajax'        => true,
     284                    'allowed_mime_types' => array(
     285                        'jpg'  => 'image/jpeg',
     286                        'jpeg' => 'image/jpeg',
     287                        'gif'  => 'image/gif',
     288                        'png'  => 'image/png'
     289                    )
     290                ),
     291                'restaurant_hours' => array(
     292                    'label'       => __( 'Hours of Operation', 'wp-restaurant-listings' ),
     293                    'type'        => 'business-hours',
     294                    'required'    => false,
     295                    'placeholder' => '',
     296                    'priority'    => 9,
     297                    'default'     => ''
     298                ),
    296299            )
    297300        ) );
     
    413416                            $this->fields[ $group_key ][ $key ]['value'] = has_post_thumbnail( $restaurant->ID ) ? get_post_thumbnail_id( $restaurant->ID ) : get_post_meta( $restaurant->ID, '_' . $key, true );
    414417                        break;
    415                         case 'restaurant_image_gallery' :
    416                             $this->fields[ $group_key ][ $key ]['value'] = explode( ',', $restaurant->_restaurant_image_gallery );
    417                             break;
    418                         case 'restaurant_menu' :
    419                             $this->fields[ $group_key ][ $key ]['value'] = explode( ',', $restaurant->_restauruant_menu );
    420                             break;
     418                        case 'restaurant_image_gallery' :
     419                            $this->fields[ $group_key ][ $key ]['value'] = explode( ',', $restaurant->_restaurant_image_gallery );
     420                            break;
     421                        case 'restaurant_menu' :
     422                            $this->fields[ $group_key ][ $key ]['value'] = explode( ',', $restaurant->_restauruant_menu );
     423                            break;
    421424                        default:
    422425                            $this->fields[ $group_key ][ $key ]['value'] = get_post_meta( $restaurant->ID, '_' . $key, true );
     
    444447        wp_enqueue_script( 'wp-restaurant-listings-restaurant-submission' );
    445448
    446         wp_localize_script( 'wp-restaurant-listings-restaurant-submission', 'restaurant_listings_restaurant_submission', array(
    447             'time_format' => str_replace( '\\', '\\\\', get_option( 'time_format' ) ),
    448             'i18n_closed' => __( 'Closed','wp-restaurant-listings' ),
    449         ) );
     449        wp_localize_script( 'wp-restaurant-listings-restaurant-submission', 'restaurant_listings_restaurant_submission', array(
     450            'time_format' => str_replace( '\\', '\\\\', get_option( 'time_format' ) ),
     451            'i18n_closed' => __( 'Closed','wp-restaurant-listings' ),
     452        ) );
    450453
    451454        get_restaurant_listings_template( 'restaurant-submit.php', array(
     
    612615                $submitting_key = uniqid();
    613616
    614                 setcookie( 'wp-restaurant-listings-submitting-restaurant-id', $this->restaurant_id, false, COOKIEPATH, COOKIE_DOMAIN, false );
    615                 setcookie( 'wp-restaurant-listings-submitting-restaurant-key', $submitting_key, false, COOKIEPATH, COOKIE_DOMAIN, false );
     617                setcookie( 'wp-restaurant-listings-submitting-restaurant-id', $this->restaurant_id, 0, COOKIEPATH, COOKIE_DOMAIN, false );
     618                setcookie( 'wp-restaurant-listings-submitting-restaurant-key', $submitting_key, 0, COOKIEPATH, COOKIE_DOMAIN, false );
    616619
    617620                update_post_meta( $this->restaurant_id, '_submitting_key', $submitting_key );
     
    685688                // Restaurant logo is a featured image
    686689                } elseif ( 'restaurant_logo' === $key ) {
    687                     $attachment_id = is_numeric($values[$group_key][$key]) ? absint($values[$group_key][$key]) : $this->create_attachment($values[$group_key][$key]);
    688                     if (empty($attachment_id)) {
    689                         delete_post_thumbnail($this->restaurant_id);
    690                     } else {
    691                         set_post_thumbnail($this->restaurant_id, $attachment_id);
    692                     }
    693                     update_user_meta(get_current_user_id(), '_restaurant_logo', $attachment_id);
    694 
    695 
    696                 // Restaurant image gallery
     690                    $attachment_id = is_numeric($values[$group_key][$key]) ? absint($values[$group_key][$key]) : $this->create_attachment($values[$group_key][$key]);
     691                    if (empty($attachment_id)) {
     692                        delete_post_thumbnail($this->restaurant_id);
     693                    } else {
     694                        set_post_thumbnail($this->restaurant_id, $attachment_id);
     695                    }
     696                    update_user_meta(get_current_user_id(), '_restaurant_logo', $attachment_id);
     697
     698
     699                // Restaurant image gallery
    697700                } elseif ( 'restaurant_image_gallery' === $key ) {
    698701
    699                     $field_values = $values[$group_key][$key];
    700 
    701                     if (is_array($field_values) && sizeof($field_values) >0 ) {
    702 
    703                         foreach ( $field_values as $image ) {
    704                             $attachment_id = is_numeric( $image ) ? absint( $image ) : $this->create_attachment( $image );
    705                             if ( !empty( $attachment_id ) ) {
    706                                 $image_gallery[] = $attachment_id;
    707                             }
    708                         }
    709 
    710                         $image_gallery = array_filter( $image_gallery );
    711 
    712                         if ( sizeof( $image_gallery ) ) {
    713                             $this->fields['extra']['restaurant_image_gallery']['value'] = $image_gallery;
    714                             update_post_meta( $this->restaurant_id, '_restaurant_image_gallery', join( ',', $image_gallery ) );
    715                         }
    716                     }
    717 
    718                     // Restaurant menu
    719                 } elseif ( 'restaurant_menu' === $key ) {
    720 
    721                     $field_values = $values[$group_key][$key];
    722 
    723                     if ( is_array($field_values) && sizeof($field_values) > 0 ) {
    724                         foreach ( $field_values as $image ) {
    725                             $attachment_id = is_numeric( $image ) ? absint( $image ) : $this->create_attachment( $image );
    726                             if ( !empty( $attachment_id ) ) {
    727                                 $menu[] = $attachment_id;
    728                             }
    729                         }
    730 
    731                         $menu = array_filter( $menu );
    732 
    733                         if ( sizeof( $menu ) ) {
    734                             $this->fields['extra']['restaurant_menu']['value'] = $menu;
    735                             update_post_meta( $this->restaurant_id, '_restaurant_menu', join( ',', $menu ) );
    736                         }
    737                     }
    738 
    739                     // Save meta data
    740                 } else {
    741 
    742                     if (  'restaurant_image_gallery' !== $key ) {
    743                         update_post_meta( $this->restaurant_id, '_' . $key, $values[ $group_key ][ $key ] );
    744                     }
     702                    $field_values = $values[$group_key][$key];
     703
     704                    if (is_array($field_values) && sizeof($field_values) >0 ) {
     705
     706                        foreach ( $field_values as $image ) {
     707                            $attachment_id = is_numeric( $image ) ? absint( $image ) : $this->create_attachment( $image );
     708                            if ( !empty( $attachment_id ) ) {
     709                                $image_gallery[] = $attachment_id;
     710                            }
     711                        }
     712
     713                        $image_gallery = array_filter( $image_gallery );
     714
     715                        if ( sizeof( $image_gallery ) ) {
     716                            $this->fields['extra']['restaurant_image_gallery']['value'] = $image_gallery;
     717                            update_post_meta( $this->restaurant_id, '_restaurant_image_gallery', join( ',', $image_gallery ) );
     718                        }
     719                    }
     720
     721                    // Restaurant menu
     722                } elseif ( 'restaurant_menu' === $key ) {
     723
     724                    $field_values = $values[$group_key][$key];
     725
     726                    if ( is_array($field_values) && sizeof($field_values) > 0 ) {
     727                        foreach ( $field_values as $image ) {
     728                            $attachment_id = is_numeric( $image ) ? absint( $image ) : $this->create_attachment( $image );
     729                            if ( !empty( $attachment_id ) ) {
     730                                $menu[] = $attachment_id;
     731                            }
     732                        }
     733
     734                        $menu = array_filter( $menu );
     735
     736                        if ( sizeof( $menu ) ) {
     737                            $this->fields['extra']['restaurant_menu']['value'] = $menu;
     738                            update_post_meta( $this->restaurant_id, '_restaurant_menu', join( ',', $menu ) );
     739                        }
     740                    }
     741
     742                    // Save meta data
     743                } else {
     744
     745                    if (  'restaurant_image_gallery' !== $key ) {
     746                        update_post_meta( $this->restaurant_id, '_' . $key, $values[ $group_key ][ $key ] );
     747                    }
    745748
    746749                    // Handle attachments
     
    763766        if ( sizeof( $maybe_attach ) && apply_filters( 'restaurant_listings_attach_uploaded_files', true ) ) {
    764767            // Get attachments
    765             $attachments     = get_posts( 'post_parent=' . $this->restaurant_id . '&post_type=attachment&fields=ids&post_mime_type=image&numberposts=-1' );
     768            $attachments     = get_posts( 'post_parent=' . $this->restaurant_id . '&post_type=attachment&fields=ids&numberposts=-1' );
    766769            $attachment_urls = array();
    767770            $attachment_ids  = array();
     
    774777            foreach ( $maybe_attach as $attachment_url ) {
    775778                if ( ! in_array( $attachment_url, $attachment_urls ) ) {
    776                     $this->create_attachment( $attachment_url );
     779                    $this->create_attachment( $attachment_url );
    777780                }
    778781            }
  • wp-restaurant-listings/trunk/includes/widgets/class-wp-restaurant-listings-widget-featured-restaurants.php

    r1851196 r1928419  
    5959        $title  = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
    6060        $number = absint( $instance['number'] );
    61         $restaurants   = get_restaurant_listings( array(
     61
     62        $title_instance = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
     63        $number         = isset( $instance['number'] ) ? absint( $instance['number'] ) : '';
     64        $title          = apply_filters( 'widget_title', $title_instance, $instance, $this->id_base );
     65        $restaurants    = get_restaurant_listings( array(
    6266            'posts_per_page' => $number,
    6367            'orderby'        => 'date',
     
    8892            <?php get_restaurant_listings_template_part( 'content-widget', 'no-restaurants-found' ); ?>
    8993
    90         <?php endif;
     94        <?php
     95        endif;
    9196
    9297        wp_reset_postdata();
  • wp-restaurant-listings/trunk/includes/widgets/class-wp-restaurant-listings-widget-recent-restaurants.php

    r1851196 r1928419  
    7777        ) );
    7878
     79        /**
     80         * Runs before Recent Restaurants widget content.
     81         *
     82         * @since 1.0.1
     83         *
     84         * @param array    $args
     85         * @param array    $instance
     86         * @param WP_Query $restaurants
     87         */
     88        do_action( 'restaurant_listings_recent_restaurants_widget_before', $args, $instance, $restaurants );
     89
    7990        if ( $restaurants->have_posts() ) : ?>
    8091
     
    101112        <?php endif;
    102113
     114        /**
     115         * Runs after Recent Restaurants widget content.
     116         *
     117         * @since 1.29.1
     118         *
     119         * @param array    $args
     120         * @param array    $instance
     121         * @param WP_Query $restaurants
     122         */
     123        do_action( 'restaurant_listings_recent_restaurants_widget_after', $args, $instance, $restaurants );
     124
    103125        wp_reset_postdata();
    104126
  • wp-restaurant-listings/trunk/languages/wp-restaurant-listings.pot

    r1851196 r1928419  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: WP Restaurant Listings 1.0.0\n"
     5"Project-Id-Version: WP Restaurant Listings 1.0.1\n"
    66"Report-Msgid-Bugs-To: "
    77"https://github.com/wpdrift/WP-Restaurant-Listings/issues\n"
    8 "POT-Creation-Date: 2018-02-21 10:53:25+00:00\n"
     8"POT-Creation-Date: 2018-08-13 13:28:27+00:00\n"
    99"MIME-Version: 1.0\n"
    1010"Content-Type: text/plain; charset=utf-8\n"
     
    1515"X-Generator: grunt-wp-i18n 0.5.4\n"
    1616
    17 #: includes/admin/class-wp-restaurant-listings-admin.php:93
     17#: includes/admin/class-wp-restaurant-listings-admin.php:96
    1818#: includes/forms/class-wp-restaurant-listings-form-edit-restaurant.php:105
    19 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:441
    20 #: wp-restaurant-listings-template.php:991
    21 #: wp-restaurant-listings-template.php:992
     19#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:451
     20#: wp-restaurant-listings-template.php:999
     21#: wp-restaurant-listings-template.php:1000
    2222msgid "Closed"
    2323msgstr ""
    2424
    25 #: includes/admin/class-wp-restaurant-listings-admin.php:104
     25#: includes/admin/class-wp-restaurant-listings-admin.php:107
    2626msgid "Settings"
    2727msgstr ""
     
    4141#: includes/admin/class-wp-restaurant-listings-cpt.php:247
    4242#: includes/admin/class-wp-restaurant-listings-cpt.php:292
    43 #: templates/single-restaurant_listings-reviews.php:69
     43#: templates/single-restaurant_listings-reviews.php:77
    4444msgid "Name"
    4545msgstr ""
     
    9797#: includes/admin/class-wp-restaurant-listings-cpt.php:294
    9898#: includes/widgets/class-wp-restaurant-listings-widget-recent-restaurants.php:38
    99 #: templates/restaurant-filters.php:17 templates/restaurant-filters.php:18
     99#: templates/restaurant-filters.php:35 templates/restaurant-filters.php:36
    100100msgid "Location"
    101101msgstr ""
     
    150150#: includes/admin/class-wp-restaurant-listings-cpt.php:399
    151151#: includes/class-wp-restaurant-listings-post-types.php:214
    152 #: templates/restaurant-dashboard.php:33 templates/restaurant-dashboard.php:40
     152#: templates/restaurant-dashboard.php:50 templates/restaurant-dashboard.php:57
    153153msgid "Edit"
    154154msgstr ""
     
    157157#: includes/admin/class-wp-restaurant-listings-meta-box-gallery.php:50
    158158#: includes/admin/class-wp-restaurant-listings-meta-box-gallery.php:70
    159 #: templates/restaurant-dashboard.php:45
     159#: templates/restaurant-dashboard.php:62
    160160msgid "Delete"
    161161msgstr ""
     
    504504
    505505#: includes/admin/class-wp-restaurant-listings-setup.php:159
    506 msgid "Setup Wizard Introduction"
     506msgid "Welcome to the Setup Wizard!"
    507507msgstr ""
    508508
    509509#: includes/admin/class-wp-restaurant-listings-setup.php:161
    510 msgid "Thanks for installing <em>WP Restaurant Listings</em>!"
     510msgid ""
     511"Thanks for installing <em>WP Restaurant Listings</em>! Let's get your site "
     512"ready to accept restaurant listings."
    511513msgstr ""
    512514
    513515#: includes/admin/class-wp-restaurant-listings-setup.php:162
    514516msgid ""
    515 "This setup wizard will help you get started by creating the pages for "
    516 "restaurant submission, restaurant listings, and listings your restaurants."
     517"This setup wizard will walk you through the process of creating the pages "
     518"for restaurant submissions, management, and listings."
    517519msgstr ""
    518520
    519521#: includes/admin/class-wp-restaurant-listings-setup.php:163
    520522msgid ""
    521 "If you want to skip the wizard and setup the pages and shortcodes yourself "
    522 "manually, the process is still relatively simple. Refer to the "
    523 "%sdocumentation%s for help."
     523"If you'd prefer to skip this and set up your pages manually, our "
     524"%sdocumentation%s will walk you through each step."
    524525msgstr ""
    525526
    526527#: includes/admin/class-wp-restaurant-listings-setup.php:166
    527 msgid "Continue to page setup"
     528msgid "Start setup"
    528529msgstr ""
    529530
    530531#: includes/admin/class-wp-restaurant-listings-setup.php:167
    531 msgid "Skip setup. I will setup the plugin manually"
     532msgid "Skip setup. I will set up the plugin manually."
    532533msgstr ""
    533534
     
    538539#: includes/admin/class-wp-restaurant-listings-setup.php:175
    539540msgid ""
    540 "<em>WP Restaurant Listings</em> includes %1$sshortcodes%2$s which can be "
    541 "used within your %3$spages%2$s to output content. These can be created for "
    542 "you below. For more information on the restaurant shortcodes view the "
    543 "%4$sshortcode documentation%2$s."
    544 msgstr ""
    545 
    546 #: includes/admin/class-wp-restaurant-listings-setup.php:183
     541"WP Restaurant Listings, users can post, manage, and browse restaurant "
     542"listings right on your website. Tell us which of these common pages you'd "
     543"like your site to have and we'll create and configure them for you."
     544msgstr ""
     545
     546#: includes/admin/class-wp-restaurant-listings-setup.php:176
     547msgid ""
     548"(These pages are created using %1$sshortcodes%2$s, which we take care of in "
     549"this step. If you'd like to build these pages yourself or want to add one "
     550"of these options to an existing page on your site, you can skip this step "
     551"and take a look at %4$sshortcode documentation%2$s for detailed "
     552"instructions.)"
     553msgstr ""
     554
     555#: includes/admin/class-wp-restaurant-listings-setup.php:184
    547556msgid "Page Title"
    548557msgstr ""
    549558
    550 #: includes/admin/class-wp-restaurant-listings-setup.php:184
     559#: includes/admin/class-wp-restaurant-listings-setup.php:185
    551560msgid "Page Description"
    552561msgstr ""
    553562
    554 #: includes/admin/class-wp-restaurant-listings-setup.php:185
     563#: includes/admin/class-wp-restaurant-listings-setup.php:186
    555564msgid "Content Shortcode"
    556565msgstr ""
    557566
    558 #: includes/admin/class-wp-restaurant-listings-setup.php:193
    559 msgid ""
    560 "This page allows employers to post restaurants to your website from the "
    561 "front-end."
    562 msgstr ""
    563 
    564 #: includes/admin/class-wp-restaurant-listings-setup.php:195
    565 msgid ""
    566 "If you do not want to accept submissions from users in this way (for "
    567 "example you just want to post restaurants from the admin dashboard) you can "
    568 "skip creating this page."
    569 msgstr ""
    570 
    571 #: includes/admin/class-wp-restaurant-listings-setup.php:203
    572 msgid ""
    573 "This page allows employers to manage and edit their own restaurants from "
    574 "the front-end."
    575 msgstr ""
    576 
    577 #: includes/admin/class-wp-restaurant-listings-setup.php:205
    578 msgid ""
    579 "If you plan on managing all listings from the admin dashboard you can skip "
    580 "creating this page."
    581 msgstr ""
    582 
    583 #: includes/admin/class-wp-restaurant-listings-setup.php:212
    584 msgid ""
    585 "This page allows users to browse, search, and filter restaurant listings on "
    586 "the front-end of your site."
    587 msgstr ""
    588 
    589 #: includes/admin/class-wp-restaurant-listings-setup.php:218
     567#: includes/admin/class-wp-restaurant-listings-setup.php:194
     568msgid ""
     569"Creates a page that allows users to post new restaurants directly from a "
     570"page on your website, instead of requiring them to log in to an admin area. "
     571"If you'd rather not allow this -- for example, if you want users to use the "
     572"admin dashboard only -- you can uncheck this setting."
     573msgstr ""
     574
     575#: includes/admin/class-wp-restaurant-listings-setup.php:202
     576msgid ""
     577"Creates a page that allows users to manage their restaurant listings "
     578"directly from a page on your website, instead of requiring them to log in "
     579"to an admin area. If you want to manage all restaurant listings from the "
     580"admin dashboard only, you can uncheck this setting."
     581msgstr ""
     582
     583#: includes/admin/class-wp-restaurant-listings-setup.php:209
     584msgid ""
     585"Creates a page where visitors can browse, search, and filter restaurant "
     586"listings."
     587msgstr ""
     588
     589#: includes/admin/class-wp-restaurant-listings-setup.php:215
    590590msgid ""
    591591"This page allows users to locate near by restaurants on the front-end of "
     
    593593msgstr ""
    594594
    595 #: includes/admin/class-wp-restaurant-listings-setup.php:226
     595#: includes/admin/class-wp-restaurant-listings-setup.php:223
    596596msgid "Skip this step"
    597597msgstr ""
    598598
    599 #: includes/admin/class-wp-restaurant-listings-setup.php:236
    600 msgid "All Done!"
     599#: includes/admin/class-wp-restaurant-listings-setup.php:233
     600msgid "You're ready to start using WP Restaurant Listings!"
     601msgstr ""
     602
     603#: includes/admin/class-wp-restaurant-listings-setup.php:235
     604msgid "Wondering what to do now? Here are some of the most common next steps:"
    601605msgstr ""
    602606
    603607#: includes/admin/class-wp-restaurant-listings-setup.php:238
    604 msgid ""
    605 "Looks like you're all set to start using the plugin. In case you're "
    606 "wondering where to go next:"
    607 msgstr ""
    608 
    609 #: includes/admin/class-wp-restaurant-listings-setup.php:241
    610 msgid "Tweak the plugin settings"
     608msgid "Tweak your settings"
     609msgstr ""
     610
     611#: includes/admin/class-wp-restaurant-listings-setup.php:239
     612msgid "Add a restaurant using the admin dashboard"
    611613msgstr ""
    612614
    613615#: includes/admin/class-wp-restaurant-listings-setup.php:242
    614 msgid "Add a restaurant via the back-end"
    615 msgstr ""
    616 
    617 #: includes/admin/class-wp-restaurant-listings-setup.php:245
     616msgid "View submitted restaurant listings"
     617msgstr ""
     618
     619#: includes/admin/class-wp-restaurant-listings-setup.php:244
     620msgid "Add restaurant listings to a page using the [restaurants] shortcode"
     621msgstr ""
     622
     623#: includes/admin/class-wp-restaurant-listings-setup.php:248
    618624msgid "Add a restaurant via the front-end"
    619625msgstr ""
    620626
    621 #: includes/admin/class-wp-restaurant-listings-setup.php:247
    622 msgid "Find out more about the front-end restaurant submission form"
    623 msgstr ""
    624 
    625 #: includes/admin/class-wp-restaurant-listings-setup.php:251
    626 msgid "View submitted restaurant listings"
    627 msgstr ""
    628 
    629 #: includes/admin/class-wp-restaurant-listings-setup.php:253
    630 msgid "Add the [restaurants] shortcode to a page to list restaurants"
    631 msgstr ""
    632 
    633 #: includes/admin/class-wp-restaurant-listings-setup.php:257
     627#: includes/admin/class-wp-restaurant-listings-setup.php:250
     628msgid "Learn to use the front-end restaurant submission board"
     629msgstr ""
     630
     631#: includes/admin/class-wp-restaurant-listings-setup.php:254
    634632msgid "View the restaurant dashboard"
    635633msgstr ""
    636634
    637 #: includes/admin/class-wp-restaurant-listings-setup.php:259
    638 msgid "Find out more about the front-end restaurant dashboard"
     635#: includes/admin/class-wp-restaurant-listings-setup.php:256
     636msgid "Learn to use the front-end restaurant dashboard"
     637msgstr ""
     638
     639#: includes/admin/class-wp-restaurant-listings-setup.php:260
     640msgid ""
     641"If you need help, you can find more detail in our %1$ssupport "
     642"documentation%2$s or post your question on the %3$sWP Restaurant Listings "
     643"support forums%2$s."
    639644msgstr ""
    640645
    641646#: includes/admin/class-wp-restaurant-listings-setup.php:263
    642 msgid ""
    643 "And don't forget, if you need any more help using <em>WP Restaurant "
    644 "Listings</em> you can consult the %1$sdocumentation%2$s or %3$spost on the "
    645 "forums%2$s!"
     647msgid "Support WP Restaurant Listings's Ongoing Development"
     648msgstr ""
     649
     650#: includes/admin/class-wp-restaurant-listings-setup.php:264
     651msgid ""
     652"There are lots of ways you can support open source software projects like "
     653"this one: contributing code, fixing a bug, assisting with non-English "
     654"translation, or just telling your friends about WP Restaurant Listings to "
     655"help spread the word. We appreciate your support!"
    646656msgstr ""
    647657
    648658#: includes/admin/class-wp-restaurant-listings-setup.php:266
    649 msgid "Support the Ongoing Development of this Plugin"
     659msgid "Leave a positive review"
    650660msgstr ""
    651661
    652662#: includes/admin/class-wp-restaurant-listings-setup.php:267
    653 msgid ""
    654 "There are many ways to support open-source projects such as WP Restaurant "
    655 "Listings, for example code contribution, translation, or even telling your "
    656 "friends how awesome the plugin (hopefully) is. Thanks in advance for your "
    657 "support - it is much appreciated!"
     663msgid "Contribute a localization"
     664msgstr ""
     665
     666#: includes/admin/class-wp-restaurant-listings-setup.php:268
     667msgid "Contribute code or report a bug"
    658668msgstr ""
    659669
    660670#: includes/admin/class-wp-restaurant-listings-setup.php:269
    661 msgid "Leave a positive review"
    662 msgstr ""
    663 
    664 #: includes/admin/class-wp-restaurant-listings-setup.php:270
    665 msgid "Contribute a localization"
    666 msgstr ""
    667 
    668 #: includes/admin/class-wp-restaurant-listings-setup.php:271
    669 msgid "Contribute code or report a bug"
    670 msgstr ""
    671 
    672 #: includes/admin/class-wp-restaurant-listings-setup.php:272
    673671msgid "Help other users on the forums"
    674672msgstr ""
     
    693691#: includes/admin/class-wp-restaurant-listings-writepanels.php:67
    694692#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:179
    695 #: templates/restaurant-filters.php:37
     693#: templates/restaurant-filters.php:55
    696694#: templates/single-restaurant_listings/tabs/overview.php:24
    697695#: templates/single-restaurants_listings/tabs/overview.php:24
     
    730728
    731729#: includes/admin/class-wp-restaurant-listings-writepanels.php:102
     730#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:228
    732731msgid "Brief description about the restaurant"
    733732msgstr ""
     
    772771
    773772#: includes/admin/class-wp-restaurant-listings-writepanels.php:176
    774 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:282
     773#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:292
    775774msgid "Hours of Operation"
    776775msgstr ""
     
    986985msgstr ""
    987986
    988 #: includes/class-wp-restaurant-listings.php:204
     987#: includes/class-wp-restaurant-listings.php:207
    989988msgid "Load previous listings"
    990989msgstr ""
    991990
    992 #: includes/class-wp-restaurant-listings.php:255
     991#: includes/class-wp-restaurant-listings.php:258
    993992msgid "Invalid file type. Accepted types:"
    994993msgstr ""
    995994
    996 #: includes/class-wp-restaurant-listings.php:291
     995#: includes/class-wp-restaurant-listings.php:294
    997996msgid "Are you sure you want to delete this listings?"
    998997msgstr ""
    999998
    1000 #: includes/class-wp-restaurant-listings.php:302
    1001 #: templates/form-fields/business-hours-field.php:18
     999#: includes/class-wp-restaurant-listings.php:305
     1000#: templates/form-fields/business-hours-field.php:34
    10021001msgid "Close"
    10031002msgstr ""
     
    10251024
    10261025#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:69
    1027 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:452
    1028 #: templates/restaurant-preview.php:5
     1026#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:462
     1027#: templates/restaurant-preview.php:22
    10291028msgid "Preview"
    10301029msgstr ""
     
    10581057msgstr ""
    10591058
    1060 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:203
     1059#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:204
    10611060msgid "Enter an email address or website URL"
    10621061msgstr ""
    10631062
    1064 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:209
     1063#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:210
    10651064msgid "Phone"
    10661065msgstr ""
    10671066
    1068 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:212
     1067#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:213
    10691068msgid "(877) 273-3049"
    10701069msgstr ""
    10711070
    1072 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:216
    1073 #: templates/content-single-restaurant_listings-restaurant.php:19
     1071#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:217
     1072#: templates/content-single-restaurant_listings-restaurant.php:30
    10741073msgid "Website"
    10751074msgstr ""
    10761075
    1077 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:219
     1076#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:221
    10781077msgid "http://"
    10791078msgstr ""
    10801079
    1081 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:223
     1080#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:225
     1081msgid "Tagline"
     1082msgstr ""
     1083
     1084#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:232
    10821085msgid "Video"
    10831086msgstr ""
    10841087
    1085 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:226
     1088#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:236
    10861089msgid "A link to a video about your restaurant"
    10871090msgstr ""
    10881091
    1089 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:230
     1092#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:240
    10901093msgid "Twitter username"
    10911094msgstr ""
    10921095
    1093 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:233
     1096#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:243
    10941097msgid "@yourcompany"
    10951098msgstr ""
    10961099
    1097 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:237
     1100#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:247
    10981101msgid "Logo"
    10991102msgstr ""
    11001103
    1101 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:252
     1104#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:262
    11021105msgid "Gallery Images"
    11031106msgstr ""
    11041107
    1105 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:267
    1106 #: wp-restaurant-listings-functions.php:1102
     1108#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:277
     1109#: wp-restaurant-listings-functions.php:1177
    11071110msgid "Menu"
    11081111msgstr ""
    11091112
    1110 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:311
     1113#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:321
    11111114msgid "%s is a required field"
    11121115msgstr ""
    11131116
    1114 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:321
     1117#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:331
    11151118msgid "%s is invalid"
    11161119msgstr ""
    11171120
    1118 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:337
    1119 #: wp-restaurant-listings-functions.php:907
     1121#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:347
     1122#: wp-restaurant-listings-functions.php:982
    11201123msgid "\"%s\" (filetype %s) needs to be one of the following file types: %s"
    11211124msgstr ""
    11221125
    1123 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:355
     1126#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:365
    11241127msgid "Please enter a valid application email address or URL"
    11251128msgstr ""
    11261129
    1127 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:483
     1130#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:493
    11281131msgid "Please enter a username."
    11291132msgstr ""
    11301133
    1131 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:487
     1134#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:497
    11321135msgid "Please enter a password."
    11331136msgstr ""
    11341137
    1135 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:491
     1138#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:501
    11361139msgid "Please enter your email address."
    11371140msgstr ""
    11381141
    1139 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:497
     1142#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:507
    11401143msgid "Passwords must match."
    11411144msgstr ""
    11421145
    1143 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:502
     1146#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:512
    11441147msgid "Invalid Password: %s"
    11451148msgstr ""
    11461149
    1147 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:504
     1150#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:514
    11481151msgid "Password is not valid."
    11491152msgstr ""
    11501153
    1151 #: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:525
     1154#: includes/forms/class-wp-restaurant-listings-form-submit-restaurant.php:535
    11521155msgid "You must be signed in to post a new listings."
    11531156msgstr ""
     
    12401243msgstr ""
    12411244
    1242 #: templates/account-signin.php:4
     1245#: templates/account-signin.php:21
    12431246msgid "Your account"
    12441247msgstr ""
    12451248
    1246 #: templates/account-signin.php:8
     1249#: templates/account-signin.php:25
    12471250msgid "You are currently signed in as <strong>%s</strong>."
    12481251msgstr ""
    12491252
    1250 #: templates/account-signin.php:11
     1253#: templates/account-signin.php:28
    12511254msgid "Sign out"
    12521255msgstr ""
    12531256
    1254 #: templates/account-signin.php:21
     1257#: templates/account-signin.php:39
    12551258msgid "Have an account?"
    12561259msgstr ""
    12571260
    1258 #: templates/account-signin.php:23 templates/restaurant-dashboard-login.php:3
     1261#: templates/account-signin.php:41 templates/restaurant-dashboard-login.php:20
    12591262msgid "Sign in"
    12601263msgstr ""
    12611264
    1262 #: templates/account-signin.php:27
     1265#: templates/account-signin.php:45
    12631266msgid ""
    12641267"If you don&rsquo;t have an account you can %screate one below by entering "
    1265 "your email address/username. Your account details will be confirmed via "
    1266 "email."
    1267 msgstr ""
    1268 
    1269 #: templates/account-signin.php:27
     1268"your email address/username."
     1269msgstr ""
     1270
     1271#: templates/account-signin.php:45
    12701272msgid "optionally"
    12711273msgstr ""
    12721274
    1273 #: templates/account-signin.php:31
     1275#: templates/account-signin.php:47
     1276msgid "Your account details will be confirmed via email."
     1277msgstr ""
     1278
     1279#: templates/account-signin.php:52
    12741280msgid "You must sign in to create a new listings."
    12751281msgstr ""
    12761282
    1277 #: templates/account-signin.php:42 templates/restaurant-submit.php:32
    1278 #: templates/restaurant-submit.php:49
     1283#: templates/account-signin.php:63 templates/restaurant-submit.php:43
     1284#: templates/restaurant-submit.php:60
    12791285msgid "(optional)"
    12801286msgstr ""
    12811287
    1282 #: templates/content-no-restaurants-found.php:2
     1288#: templates/content-no-restaurants-found.php:19
     1289#: templates/content-widget-no-restaurants-found.php:19
    12831290msgid "There are no listings matching your search."
    12841291msgstr ""
    12851292
    1286 #: templates/content-no-restaurants-found.php:4
    1287 msgid "There are currently no vacancies."
    1288 msgstr ""
    1289 
    1290 #: templates/form-fields/business-hours-field.php:17
     1293#: templates/content-no-restaurants-found.php:21
     1294#: templates/content-widget-no-restaurants-found.php:21
     1295msgid "There are currently no restaurants."
     1296msgstr ""
     1297
     1298#: templates/form-fields/business-hours-field.php:33
    12911299msgid "Open"
    12921300msgstr ""
    12931301
    1294 #: templates/form-fields/file-field.php:29
     1302#: templates/form-fields/file-field.php:45
    12951303msgid "Maximum file size: %s."
    12961304msgstr ""
    12971305
    1298 #: templates/form-fields/multiselect-field.php:3
    1299 #: wp-restaurant-listings-functions.php:724
     1306#: templates/form-fields/multiselect-field.php:20
     1307#: wp-restaurant-listings-functions.php:799
    13001308msgid "No results match"
    13011309msgstr ""
    13021310
    1303 #: templates/form-fields/multiselect-field.php:3
    1304 #: wp-restaurant-listings-functions.php:725
     1311#: templates/form-fields/multiselect-field.php:20
     1312#: wp-restaurant-listings-functions.php:800
    13051313msgid "Select Some Options"
    13061314msgstr ""
    13071315
    1308 #: templates/form-fields/uploaded-file-html.php:12
    1309 #: templates/form-fields/uploaded-file-html.php:14
     1316#: templates/form-fields/uploaded-file-html.php:29
     1317#: templates/form-fields/uploaded-file-html.php:31
    13101318msgid "remove"
    13111319msgstr ""
    13121320
    1313 #: templates/restaurant-dashboard-login.php:3
     1321#: templates/restaurant-dashboard-login.php:20
    13141322msgid "You need to be signed in to manage your listings."
    13151323msgstr ""
    13161324
    1317 #: templates/restaurant-dashboard.php:2
     1325#: templates/restaurant-dashboard.php:19
    13181326msgid "Your listings are shown in the table below."
    13191327msgstr ""
    13201328
    1321 #: templates/restaurant-dashboard.php:14
     1329#: templates/restaurant-dashboard.php:31
    13221330msgid "You do not have any active listings."
    13231331msgstr ""
    13241332
    1325 #: templates/restaurant-dashboard.php:35
     1333#: templates/restaurant-dashboard.php:52
    13261334msgid "Duplicate"
    13271335msgstr ""
    13281336
    1329 #: templates/restaurant-filters.php:12
     1337#: templates/restaurant-filters.php:30
    13301338msgid "Keywords"
    13311339msgstr ""
    13321340
    1333 #: templates/restaurant-filters.php:13
     1341#: templates/restaurant-filters.php:31
    13341342msgid "Search for restaurants or cuisines..."
    13351343msgstr ""
    13361344
    1337 #: templates/restaurant-filters.php:27
     1345#: templates/restaurant-filters.php:45
    13381346msgid "Category"
    13391347msgstr ""
    13401348
    1341 #: templates/restaurant-filters.php:31
     1349#: templates/restaurant-filters.php:49
    13421350msgid "Any category"
    13431351msgstr ""
    13441352
    1345 #: templates/restaurant-filters.php:54
     1353#: templates/restaurant-filters.php:72
    13461354msgid ""
    13471355"Your browser does not support JavaScript, or it is disabled. JavaScript "
     
    13491357msgstr ""
    13501358
    1351 #: templates/restaurant-gallery-photoswipe.php:38
     1359#: templates/restaurant-gallery-photoswipe.php:46
    13521360msgid "Close (Esc)"
    13531361msgstr ""
    13541362
    1355 #: templates/restaurant-gallery-photoswipe.php:40
     1363#: templates/restaurant-gallery-photoswipe.php:48
    13561364msgid "Share"
    13571365msgstr ""
    13581366
    1359 #: templates/restaurant-gallery-photoswipe.php:42
     1367#: templates/restaurant-gallery-photoswipe.php:50
    13601368msgid "Toggle fullscreen"
    13611369msgstr ""
    13621370
    1363 #: templates/restaurant-gallery-photoswipe.php:44
     1371#: templates/restaurant-gallery-photoswipe.php:52
    13641372msgid "Zoom in/out"
    13651373msgstr ""
    13661374
    1367 #: templates/restaurant-gallery-photoswipe.php:61
     1375#: templates/restaurant-gallery-photoswipe.php:69
    13681376msgid "Previous (arrow left)"
    13691377msgstr ""
    13701378
    1371 #: templates/restaurant-gallery-photoswipe.php:63
     1379#: templates/restaurant-gallery-photoswipe.php:71
    13721380msgid "Next (arrow right)"
    13731381msgstr ""
    13741382
    1375 #: templates/restaurant-preview.php:3
     1383#: templates/restaurant-preview.php:20
    13761384msgid "Submit Listings"
    13771385msgstr ""
    13781386
    1379 #: templates/restaurant-preview.php:4
     1387#: templates/restaurant-preview.php:21
    13801388msgid "Edit listings"
    13811389msgstr ""
    13821390
    1383 #: templates/restaurant-submit.php:13
     1391#: templates/restaurant-submit.php:24
    13841392msgid "You are editing an existing restaurant. %s"
    13851393msgstr ""
    13861394
    1387 #: templates/restaurant-submit.php:13
     1395#: templates/restaurant-submit.php:24
    13881396msgid "Create A New Restaurant"
    13891397msgstr ""
    13901398
    1391 #: templates/restaurant-submit.php:43
     1399#: templates/restaurant-submit.php:54
    13921400msgid "Restaurant Details"
    13931401msgstr ""
    13941402
    1395 #: templates/restaurant-submitted.php:6
     1403#: templates/restaurant-submitted.php:22
    13961404msgid "%s listed successfully. To view your listings <a href=\"%s\">click here</a>."
    13971405msgstr ""
    13981406
    1399 #: templates/restaurant-submitted.php:9
     1407#: templates/restaurant-submitted.php:25
    14001408msgid "%s submitted successfully. Your listings will be visible once approved."
    14011409msgstr ""
     
    14261434msgstr ""
    14271435
    1428 #: templates/single-restaurant_listings-reviews.php:28
     1436#: templates/single-restaurant_listings-reviews.php:36
    14291437#. translators: 1: reviews count 2: name
    14301438msgid "%1$s review for %2$s"
     
    14331441msgstr[1] ""
    14341442
    1435 #: templates/single-restaurant_listings-reviews.php:50
     1443#: templates/single-restaurant_listings-reviews.php:58
    14361444msgid "There are no reviews yet."
    14371445msgstr ""
    14381446
    1439 #: templates/single-restaurant_listings-reviews.php:63
     1447#: templates/single-restaurant_listings-reviews.php:71
    14401448msgid "Add a review"
    14411449msgstr ""
    14421450
    1443 #: templates/single-restaurant_listings-reviews.php:63
     1451#: templates/single-restaurant_listings-reviews.php:71
    14441452msgid "Be the first to review &ldquo;%s&rdquo;"
    14451453msgstr ""
    14461454
    1447 #: templates/single-restaurant_listings-reviews.php:64
     1455#: templates/single-restaurant_listings-reviews.php:72
    14481456msgid "Leave a Reply to %s"
    14491457msgstr ""
    14501458
    1451 #: templates/single-restaurant_listings-reviews.php:71
     1459#: templates/single-restaurant_listings-reviews.php:79
    14521460msgid "Email"
    14531461msgstr ""
    14541462
    1455 #: templates/single-restaurant_listings-reviews.php:74
     1463#: templates/single-restaurant_listings-reviews.php:82
    14561464msgid "Submit"
    14571465msgstr ""
    14581466
    1459 #: templates/single-restaurant_listings-reviews.php:81
     1467#: templates/single-restaurant_listings-reviews.php:89
    14601468msgid "Your rating"
    14611469msgstr ""
    14621470
    1463 #: templates/single-restaurant_listings-reviews.php:82
     1471#: templates/single-restaurant_listings-reviews.php:90
    14641472msgid "Rate&hellip;"
    14651473msgstr ""
    14661474
    1467 #: templates/single-restaurant_listings-reviews.php:83
     1475#: templates/single-restaurant_listings-reviews.php:91
    14681476msgid "Perfect"
    14691477msgstr ""
    14701478
    1471 #: templates/single-restaurant_listings-reviews.php:84
     1479#: templates/single-restaurant_listings-reviews.php:92
    14721480msgid "Good"
    14731481msgstr ""
    14741482
    1475 #: templates/single-restaurant_listings-reviews.php:85
     1483#: templates/single-restaurant_listings-reviews.php:93
    14761484msgid "Average"
    14771485msgstr ""
    14781486
    1479 #: templates/single-restaurant_listings-reviews.php:86
     1487#: templates/single-restaurant_listings-reviews.php:94
    14801488msgid "Not that bad"
    14811489msgstr ""
    14821490
    1483 #: templates/single-restaurant_listings-reviews.php:87
     1491#: templates/single-restaurant_listings-reviews.php:95
    14841492msgid "Very poor"
    14851493msgstr ""
    14861494
    1487 #: templates/single-restaurant_listings-reviews.php:91
     1495#: templates/single-restaurant_listings-reviews.php:99
    14881496msgid "Your review"
    14891497msgstr ""
    14901498
    1491 #: wp-restaurant-listings-functions.php:358
     1499#: wp-restaurant-listings-functions.php:418
    14921500msgid "Reset"
    14931501msgstr ""
    14941502
    1495 #: wp-restaurant-listings-functions.php:362
     1503#: wp-restaurant-listings-functions.php:422
    14961504msgid "RSS"
    14971505msgstr ""
    14981506
    1499 #: wp-restaurant-listings-functions.php:457
     1507#: wp-restaurant-listings-functions.php:517
    15001508msgid "Invalid email address."
    15011509msgstr ""
    15021510
    1503 #: wp-restaurant-listings-functions.php:465
     1511#: wp-restaurant-listings-functions.php:525
    15041512msgid "Your email address isn&#8217;t correct."
    15051513msgstr ""
    15061514
    1507 #: wp-restaurant-listings-functions.php:469
     1515#: wp-restaurant-listings-functions.php:529
    15081516msgid "This email is already registered, please choose another one."
    15091517msgstr ""
    15101518
    1511 #: wp-restaurant-listings-functions.php:641
     1519#: wp-restaurant-listings-functions.php:716
    15121520msgid "Passwords must be at least 8 characters long."
    15131521msgstr ""
    15141522
    1515 #: wp-restaurant-listings-functions.php:723
     1523#: wp-restaurant-listings-functions.php:798
    15161524msgid "Choose a category&hellip;"
    15171525msgstr ""
    15181526
    1519 #: wp-restaurant-listings-functions.php:909
     1527#: wp-restaurant-listings-functions.php:984
    15201528msgid "Uploaded files need to be one of the following file types: %s"
    15211529msgstr ""
    15221530
    1523 #: wp-restaurant-listings-functions.php:1096
     1531#: wp-restaurant-listings-functions.php:1171
    15241532msgid "Overview"
    15251533msgstr ""
    15261534
    1527 #: wp-restaurant-listings-functions.php:1112
     1535#: wp-restaurant-listings-functions.php:1187
    15281536msgid "Reviews (%d)"
    15291537msgstr ""
     
    15331541msgstr ""
    15341542
    1535 #: wp-restaurant-listings-template.php:321
     1543#: wp-restaurant-listings-template.php:329
    15361544msgid "Username"
    15371545msgstr ""
    15381546
    1539 #: wp-restaurant-listings-template.php:329
     1547#: wp-restaurant-listings-template.php:337
    15401548msgid "Password"
    15411549msgstr ""
    15421550
    1543 #: wp-restaurant-listings-template.php:339
     1551#: wp-restaurant-listings-template.php:347
    15441552msgid "Verify Password"
    15451553msgstr ""
    15461554
    1547 #: wp-restaurant-listings-template.php:346
     1555#: wp-restaurant-listings-template.php:354
    15481556msgid "Your email"
    15491557msgstr ""
    15501558
    1551 #: wp-restaurant-listings-template.php:347
     1559#: wp-restaurant-listings-template.php:355
    15521560msgid "[email protected]"
    15531561msgstr ""
    15541562
    1555 #: wp-restaurant-listings-template.php:373
     1563#: wp-restaurant-listings-template.php:381
    15561564msgid "Posted on "
    15571565msgstr ""
    15581566
    1559 #: wp-restaurant-listings-template.php:375
    1560 #: wp-restaurant-listings-template.php:395
     1567#: wp-restaurant-listings-template.php:383
     1568#: wp-restaurant-listings-template.php:403
    15611569msgid "Posted %s ago"
    15621570msgstr ""
    15631571
    1564 #: wp-restaurant-listings-template.php:418
     1572#: wp-restaurant-listings-template.php:426
    15651573msgid "Anywhere"
    15661574msgstr ""
    15671575
    1568 #: wp-restaurant-listings-template.php:925
     1576#: wp-restaurant-listings-template.php:933
    15691577msgid "%s customer review"
    15701578msgid_plural "%s customer reviews"
     
    15721580msgstr[1] ""
    15731581
    1574 #: wp-restaurant-listings-template.php:936
    1575 #: wp-restaurant-listings-template.php:1314
     1582#: wp-restaurant-listings-template.php:944
     1583#: wp-restaurant-listings-template.php:1322
    15761584#. translators: 1: rating 2: rating count
    15771585msgid "Rated %1$s out of 5 based on %2$s customer rating"
     
    15801588msgstr[1] ""
    15811589
    1582 #: wp-restaurant-listings-template.php:939
    1583 #: wp-restaurant-listings-template.php:1317
     1590#: wp-restaurant-listings-template.php:947
     1591#: wp-restaurant-listings-template.php:1325
    15841592#. translators: %s: rating
    15851593msgid "Rated %s out of 5"
    15861594msgstr ""
    15871595
    1588 #: wp-restaurant-listings-template.php:1002
     1596#: wp-restaurant-listings-template.php:1010
    15891597msgid "Today"
    15901598msgstr ""
    15911599
    1592 #: wp-restaurant-listings-template.php:1007
     1600#: wp-restaurant-listings-template.php:1015
    15931601msgid "See more"
    15941602msgstr ""
    15951603
    1596 #: wp-restaurant-listings-template.php:1028
     1604#: wp-restaurant-listings-template.php:1036
    15971605msgid "Get Directions"
    15981606msgstr ""
     
    16201628msgstr ""
    16211629
    1622 #: includes/admin/class-wp-restaurant-listings-admin.php:91
     1630#: includes/admin/class-wp-restaurant-listings-admin.php:94
    16231631#. translators: jQuery date format, see
    16241632#. http:api.jqueryui.com/datepicker/#utility-formatDate
     
    16451653msgstr ""
    16461654
    1647 #: includes/admin/class-wp-restaurant-listings-setup.php:191
     1655#: includes/admin/class-wp-restaurant-listings-setup.php:192
    16481656msgctxt "Default page title (wizard)"
    16491657msgid "Post a Restaurant"
    16501658msgstr ""
    16511659
    1652 #: includes/admin/class-wp-restaurant-listings-setup.php:201
     1660#: includes/admin/class-wp-restaurant-listings-setup.php:200
    16531661msgctxt "Default page title (wizard)"
    16541662msgid "Restaurant Dashboard"
    16551663msgstr ""
    16561664
    1657 #: includes/admin/class-wp-restaurant-listings-setup.php:211
     1665#: includes/admin/class-wp-restaurant-listings-setup.php:208
    16581666msgctxt "Default page title (wizard)"
    16591667msgid "Restaurants"
    16601668msgstr ""
    16611669
    1662 #: includes/admin/class-wp-restaurant-listings-setup.php:217
     1670#: includes/admin/class-wp-restaurant-listings-setup.php:214
    16631671msgctxt "Default page title (wizard)"
    16641672msgid "Restaurants Locator"
     
    16711679
    16721680#: includes/class-wp-restaurant-listings-post-types.php:253
    1673 #: wp-restaurant-listings-functions.php:254
     1681#: wp-restaurant-listings-functions.php:314
    16741682msgctxt "post status"
    16751683msgid "Preview"
    16761684msgstr ""
    16771685
    1678 #: wp-restaurant-listings-functions.php:253
     1686#: wp-restaurant-listings-functions.php:313
    16791687msgctxt "post status"
    16801688msgid "Draft"
    16811689msgstr ""
    16821690
    1683 #: wp-restaurant-listings-functions.php:255
     1691#: wp-restaurant-listings-functions.php:315
    16841692msgctxt "post status"
    16851693msgid "Pending approval"
    16861694msgstr ""
    16871695
    1688 #: wp-restaurant-listings-functions.php:256
     1696#: wp-restaurant-listings-functions.php:316
    16891697msgctxt "post status"
    16901698msgid "Pending payment"
    16911699msgstr ""
    16921700
    1693 #: wp-restaurant-listings-functions.php:257
     1701#: wp-restaurant-listings-functions.php:317
    16941702msgctxt "post status"
    16951703msgid "Active"
  • wp-restaurant-listings/trunk/license.txt

    r1851196 r1928419  
    2020permission notices:
    2121
    22   WP Restaurant Listing is Copyright (c) 2017 WPdrift Ltd.
    23   https://wpdrift.com/
    24 
    25   WP Restaurant Listing is released under the GPL
     22  WP Job Manager is Copyright (c) 2017 Automattic.
     23  http://automattic.com - https://wpjobmanager.com
     24
     25  WP Job Manager is released under the GPL
     26
     27  and
     28
     29  WP Restaurant Listings is Copyright (c) 2017 upnrunn technologies.
     30  https://upnrunn.com - https://wpdrift.com
     31
     32  WP Restaurant Listings is released under the GPL
    2633
    2734=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  • wp-restaurant-listings/trunk/package.json

    r1839196 r1928419  
    22  "name": "wp-restaurant-listings",
    33  "title": "WP Restaurant Listings",
    4   "version": "1.27.0",
     4  "version": "1.0.0",
    55  "homepage": "http://wordpress.org/plugins/wp-restaurant-listings/",
    66  "license": "GPL-2.0+",
    7   "repository": "automattic/wp-restaurant-listings",
     7  "repository": "wpdrift/wp-restaurant-listings",
    88  "main": "Gruntfile.js",
    99  "devDependencies": {
    10     "grunt": "~1.0.1",
     10    "grunt": "^1.0.2",
    1111    "grunt-checkbranch": "^1.0.4",
    1212    "grunt-checkrepo": "^0.1.0",
  • wp-restaurant-listings/trunk/readme.txt

    r1851196 r1928419  
    6666**Note when using shortcodes**, if the content looks blown up/spaced out/poorly styled, edit your page and above the visual editor click on the 'text' tab. Then remove any 'pre' or 'code' tags wrapping your shortcode.
    6767
    68 For more information, [read the documentation](https://wpdrift.com/docs/restaurants/).
     68For more information, [read the documentation](https://wpdrift.com/docs/article-categories/restaurants/).
    6969
    7070== Frequently Asked Questions ==
    7171
    7272= How do I setup WP Restaurant Listings? =
    73 View the getting [installation](https://wpdrift.com/docs/restaurants/installation/) and [setup](https://wpdrift.com/docs/restaurants/setting-up-wp-job-manager/) guide for advice getting started with the plugin. In most cases it's just a case of adding some shortcodes to your pages!
     73View the getting [installation](https://wpdrift.com/docs/knowledge-base/installation-guide/) and [setup](https://wpdrift.com/docs/knowledge-base/setting-up-wp-restaurant-listings/) guide for advice getting started with the plugin. In most cases it's just a case of adding some shortcodes to your pages!
    7474
    7575= Can I use WP Restaurant Listings without frontend restaurant submission? =
     
    8080
    81811. For simple text changes, using a localisation file or a plugin such as https://wordpress.org/plugins/say-what/
    82 2. For field changes, or adding new fields, using functions/filters inside your theme's functions.php file: [https://wpdrift.com/docs/restaurants/editing-job-submission-fields/](https://wpdrift.com/docs/restaurants/editing-job-submission-fields/)
     822. For field changes, or adding new fields, using functions/filters inside your theme's functions.php file: [https://wpdrift.com/docs/knowledge-base/editing-restaurant-submission-fields/](https://wpdrift.com/docs/knowledge-base/editing-restaurant-submission-fields/)
    83833. Use a 3rd party plugin which has a UI for field editing.
    8484
     
    9696== Changelog ==
    9797
     98= 1.0.1 =
     99* Enhancement: In WP Admin just strip tags from custom field labels instead of escaping them.
     100* Fix: When using Polylang, only the active language's restaurant listings will be displayed in the [restaurants] shortcode.
     101* Enhancement: Sanitize field input using different strategies.
     102* Change: Updates account-signin.php template to warn users email will be confirmed only if that is enabled.
     103* Enhancement: When retrieving listings in [restaurants] shortcode, setting orderby to rand_featured will still place featured listings at the top.
     104* Dev: Runs new actions (restaurant_listings_recent_restaurants_widget_before and restaurant_listings_recent_restaurants_widget_after) inside Recent Restaurants widget.
     105* Dev: Change get_the_restaurant_types() to return an empty array when restaurant types are disabled.
     106* Enhancement: Update language for setup wizard with more clear descriptions.
     107* Fix: Prevent duplicate attachments to restaurant listing posts for non-image media.
     108* Fix: PHP error on registration form due to missing placeholder text.
     109* Fix: Properly reset category selector on [restaurants] shortcode
     110* Fix: Show restaurant listing's published date in localized format
     111* Dev: Adds versions to template files so it is easier to tell when they are updated.
     112* Dev: Adds a new `wprl_notify_new_user` action that allows you to override default behavior.
     113
    98114= 1.0.0 =
    99115* First stable release.
  • wp-restaurant-listings/trunk/templates/account-signin.php

    r1851196 r1928419  
     1<?php
     2/**
     3 * In restaurant listing creation flow, this template shows above the restaurant creation form.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/account-signin.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17?>
    118<?php if ( is_user_logged_in() ) : ?>
    219
     
    1431
    1532<?php else :
    16     $account_required      = restaurant_listings_user_requires_account();
    17     $registration_enabled  = restaurant_listings_enable_registration();
    18     $registration_fields   = wprl_get_registration_fields();
     33    $account_required            = restaurant_listings_user_requires_account();
     34    $registration_enabled        = restaurant_listings_enable_registration();
     35    $registration_fields         = wprl_get_registration_fields();
     36    $use_standard_password_email = wprl_use_standard_password_setup_email();
    1937    ?>
    2038    <fieldset>
     
    2543            <?php if ( $registration_enabled ) : ?>
    2644
    27                 <?php printf( __( 'If you don&rsquo;t have an account you can %screate one below by entering your email address/username. Your account details will be confirmed via email.', 'wp-restaurant-listings' ), $account_required ? '' : __( 'optionally', 'wp-restaurant-listings' ) . ' ' ); ?>
     45                <?php printf( __( 'If you don&rsquo;t have an account you can %screate one below by entering your email address/username.', 'wp-restaurant-listings' ), $account_required ? '' : __( 'optionally', 'wp-restaurant-listings' ) . ' ' ); ?>
     46                <?php if ( $use_standard_password_email ) : ?>
     47                    <?php printf( __( 'Your account details will be confirmed via email.', 'wp-restaurant-listings' ) ); ?>
     48                <?php endif; ?>
    2849
    2950            <?php elseif ( $account_required ) : ?>
  • wp-restaurant-listings/trunk/templates/content-no-restaurants-found.php

    r1851196 r1928419  
     1<?php
     2/**
     3 * Notice when no restaurants were found in `[restaurants]` shortcode.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/content-no-restaurants-found.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17?>
    118<?php if ( defined( 'DOING_AJAX' ) ) : ?>
    219    <li class="no_restaurant_listings_found"><?php _e( 'There are no listings matching your search.', 'wp-restaurant-listings' ); ?></li>
    320<?php else : ?>
    4     <p class="no_restaurant_listings_found"><?php _e( 'There are currently no vacancies.', 'wp-restaurant-listings' ); ?></p>
     21    <p class="no_restaurant_listings_found"><?php _e( 'There are currently no restaurants.', 'wp-restaurant-listings' ); ?></p>
    522<?php endif; ?>
  • wp-restaurant-listings/trunk/templates/content-restaurant_listings.php

    r1851196 r1928419  
    11<?php
    22/**
    3  * Restaurant listings in the loop.
     3 * Restaurant listing in the loop.
    44 *
    5  * @since 1.0.0
    6  * @version 1.27.0
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/content-restaurant_listing.php.
    76 *
    8  * @package RestaurantListings
    9  * @category Template
    10  * @author Automattic
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @since       1.0.0
     12 * @version     1.0.1
    1113 */
    1214
    13 global $post; ?>
     15if ( ! defined( 'ABSPATH' ) ) {
     16    exit; // Exit if accessed directly.
     17}
     18
     19global $post;
     20?>
    1421
    1522<li <?php restaurant_listings_class(); ?> data-longitude="<?php echo esc_attr( $post->geolocation_lat ); ?>" data-latitude="<?php echo esc_attr( $post->geolocation_long ); ?>">
  • wp-restaurant-listings/trunk/templates/content-single-restaurant_listings-meta.php

    r1851196 r1928419  
    11<?php
    22/**
    3  * Single view Restaurant meta box
     3 * Single view restaurant meta box
    44 *
    55 * Hooked into single_restaurant_listings_start priority 20
    66 *
    7  * @since 1.0.0
    8  * @version 1.27.0
     7 * This template can be overridden by copying it to yourtheme/restaurant_listings/content-single-restaurant_listings-meta.php.
    98 *
    10  * @package RestaurantListings
    11  * @category Template
    12  * @author Automattic
     9 * @see         https://wpdrift.com/document/template-overrides/
     10 * @author      WPdrift
     11 * @package     WP Restaurant Listings
     12 * @category    Template
     13 * @since       1.0.0
     14 * @version     1.0.1
    1315 */
     16
     17if ( ! defined( 'ABSPATH' ) ) {
     18    exit; // Exit if accessed directly.
     19}
    1420
    1521global $post;
  • wp-restaurant-listings/trunk/templates/content-single-restaurant_listings-restaurant.php

    r1851196 r1928419  
    55 * Hooked into single_restaurant_listings_start priority 30
    66 *
    7  * @since 1.0.0
     7 * This template can be overridden by copying it to yourtheme/restaurant_listings/content-single-restaurant_listings-restaurant.php.
     8 *
     9 * @see         https://wpdrift.com/document/template-overrides/
     10 * @author      WPdrift
     11 * @package     WP Restaurant Listings
     12 * @category    Template
     13 * @since       1.0.0
     14 * @version     1.0.1
    815 */
     16
     17if ( ! defined( 'ABSPATH' ) ) {
     18    exit; // Exit if accessed directly.
     19}
    920
    1021if ( ! get_the_restaurant_name() ) {
  • wp-restaurant-listings/trunk/templates/content-single-restaurant_listings.php

    r1851196 r1928419  
    1 <?php global $post; ?>
     1<?php
     2/**
     3 * Single restaurant listing.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/content-single-restaurant_listings.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17
     18global $post;
     19?>
    220<div class="single_restaurant_listing" itemscope itemtype="http://schema.org/RestaurantPosting">
    321    <meta itemprop="title" content="<?php echo esc_attr( get_the_restaurant_title( $post ) ); ?>" />
  • wp-restaurant-listings/trunk/templates/content-summary-restaurant_listings.php

    r1851196 r1928419  
     1<?php
     2/**
     3 * Restaurant listing summary
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/content-summary-restaurant_listings.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17?>
    118<?php global $restaurant_listings; ?>
    219
  • wp-restaurant-listings/trunk/templates/content-widget-no-restaurants-found.php

    r1839196 r1928419  
    1 <?php /** Intentionally empty - override to modify the content **/ ?>
     1<?php
     2/**
     3 * Notice when no restaurants were found in `[restaurants]` shortcode.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/content-widget-no-restaurants-found.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17?>
     18<?php if ( defined( 'DOING_AJAX' ) ) : ?>
     19    <li class="no_restaurant_listings_found"><?php _e( 'There are no listings matching your search.', 'wp-restaurant-listings' ); ?></li>
     20<?php else : ?>
     21    <p class="no_restaurant_listings_found"><?php _e( 'There are currently no restaurants.', 'wp-restaurant-listings' ); ?></p>
     22<?php endif; ?>
  • wp-restaurant-listings/trunk/templates/content-widget-restaurant_listings.php

    r1851196 r1928419  
     1<?php
     2/**
     3 * Single restaurant listing widget content.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/content-widget-restaurant_listings.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17?>
    118<li <?php restaurant_listings_class(); ?>>
    219    <a href="<?php the_restaurant_permalink(); ?>">
  • wp-restaurant-listings/trunk/templates/form-fields/business-hours-field.php

    r1851196 r1928419  
    11<?php
     2/**
     3 * Shows `select` form fields in a list from a list on restaurant listing hours.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/form-fields/business-hours-field.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17
    218wp_enqueue_script( 'jquey-timepicker' );
    319wp_enqueue_style( 'jquery-timepicker' );
  • wp-restaurant-listings/trunk/templates/form-fields/checkbox-field.php

    r1851196 r1928419  
     1<?php
     2/**
     3 * Shows the `checkbox` form field on restaurant listing forms.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/form-fields/checkbox-field.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17?>
    118<input type="checkbox" class="input-checkbox" name="<?php echo esc_attr( isset( $field['name'] ) ? $field['name'] : $key ); ?>" id="<?php echo esc_attr( $key ); ?>" <?php checked( ! empty( $field['value'] ), true ); ?> value="1" <?php if ( ! empty( $field['required'] ) ) echo 'required'; ?> />
    219<?php if ( ! empty( $field['description'] ) ) : ?><small class="description"><?php echo $field['description']; ?></small><?php endif; ?>
  • wp-restaurant-listings/trunk/templates/form-fields/file-field.php

    r1851196 r1928419  
    11<?php
     2/**
     3 * Shows the `file` form field on restaurant listing forms.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/form-fields/file-field.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17
    218$classes            = array( 'input-text' );
    319$allowed_mime_types = array_keys( ! empty( $field['allowed_mime_types'] ) ? $field['allowed_mime_types'] : get_allowed_mime_types() );
  • wp-restaurant-listings/trunk/templates/form-fields/multiselect-field.php

    r1851196 r1928419  
    1 <?php wp_enqueue_script( 'wp-restaurant-listings-multiselect' ); ?>
     1<?php
     2/**
     3 * Shows the `select` (multiple) form field on restaurant listing forms.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/form-fields/multiselect-field.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
    213
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17
     18wp_enqueue_script( 'wp-restaurant-listings-multiselect' );
     19?>
    320<select multiple="multiple" name="<?php echo esc_attr( isset( $field['name'] ) ? $field['name'] : $key ); ?>[]" id="<?php echo esc_attr( $key ); ?>" class="restaurant-listings-multiselect" <?php if ( ! empty( $field['required'] ) ) echo 'required'; ?> data-no_results_text="<?php _e( 'No results match', 'wp-restaurant-listings' ); ?>" data-multiple_text="<?php _e( 'Select Some Options', 'wp-restaurant-listings' ); ?>">
    421    <?php foreach ( $field['options'] as $key => $value ) : ?>
  • wp-restaurant-listings/trunk/templates/form-fields/password-field.php

    r1851196 r1928419  
    1 <input type="password" class="input-text"<?php if ( isset( $field['autocomplete'] ) && false === $field['autocomplete'] ) { echo ' autocomplete="off"'; } ?> name="<?php echo esc_attr( isset( $field['name'] ) ? $field['name'] : $key ); ?>" id="<?php echo esc_attr( $key ); ?>" placeholder="<?php echo esc_attr( $field['placeholder'] ); ?>" value="<?php echo isset( $field['value'] ) ? esc_attr( $field['value'] ) : ''; ?>" maxlength="<?php echo ! empty( $field['maxlength'] ) ? $field['maxlength'] : ''; ?>" <?php if ( ! empty( $field['required'] ) ) echo 'required'; ?> />
     1<?php
     2/**
     3 * Shows the `password` form field on restaurant listing forms.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/form-fields/password-field.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17?>
     18<input type="password" class="input-text"<?php if ( isset( $field['autocomplete'] ) && false === $field['autocomplete'] ) { echo ' autocomplete="off"'; } ?> name="<?php echo esc_attr( isset( $field['name'] ) ? $field['name'] : $key ); ?>" id="<?php echo esc_attr( $key ); ?>" placeholder="<?php echo empty( $field['placeholder'] ) ? '' : esc_attr( $field['placeholder'] ); ?>" value="<?php echo isset( $field['value'] ) ? esc_attr( $field['value'] ) : ''; ?>" maxlength="<?php echo ! empty( $field['maxlength'] ) ? $field['maxlength'] : ''; ?>" <?php if ( ! empty( $field['required'] ) ) echo 'required'; ?> />
    219<?php if ( ! empty( $field['description'] ) ) : ?><small class="description"><?php echo $field['description']; ?></small><?php endif; ?>
  • wp-restaurant-listings/trunk/templates/form-fields/radio-field.php

    r1851196 r1928419  
    11<?php
    22/**
     3 * Shows the `radio` form field on restaurant listing forms.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/form-fields/radio-field.php.
     6 *
    37 * Radio Field. Example definition:
    48 *
     
    1418 *      )
    1519 *  )
     20 *
     21 * @see         https://wpdrift.com/document/template-overrides/
     22 * @author      WPdrift
     23 * @package     WP Restaurant Listings
     24 * @category    Template
     25 * @version     1.0.1
    1626 */
     27
     28if ( ! defined( 'ABSPATH' ) ) {
     29    exit; // Exit if accessed directly.
     30}
    1731
    1832$field['default'] = empty( $field['default'] ) ? current( array_keys( $field['options'] ) ) : $field['default'];
  • wp-restaurant-listings/trunk/templates/form-fields/select-field.php

    r1851196 r1928419  
     1<?php
     2/**
     3 * Shows the `select` form field on restaurant listing forms.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/form-fields/select-field.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17?>
    118<select name="<?php echo esc_attr( isset( $field['name'] ) ? $field['name'] : $key ); ?>" id="<?php echo esc_attr( $key ); ?>" <?php if ( ! empty( $field['required'] ) ) echo 'required'; ?>>
    219    <?php foreach ( $field['options'] as $key => $value ) : ?>
  • wp-restaurant-listings/trunk/templates/form-fields/term-checklist-field.php

    r1851196 r1928419  
     1<?php
     2/**
     3 * Shows `checkbox` form fields in a list from a list on restaurant listing forms.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/form-fields/term-checklist-field.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17?>
    118<ul class="restaurant-listings-term-checklist restaurant-listings-term-checklist-<?php echo $key ?>">
    219<?php
  • wp-restaurant-listings/trunk/templates/form-fields/term-multiselect-field.php

    r1851196 r1928419  
    11<?php
     2/**
     3 * Shows term `select` (multiple) form field on restaurant listing forms.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/form-fields/term-multiselect-field.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17
    218// Get selected value
    319if ( isset( $field['value'] ) ) {
  • wp-restaurant-listings/trunk/templates/form-fields/term-select-field.php

    r1851196 r1928419  
    11<?php
     2/**
     3 * Shows term `select` form field on restaurant listing forms.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/form-fields/term-select-field.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17
    218// Get selected value
    319if ( isset( $field['value'] ) ) {
  • wp-restaurant-listings/trunk/templates/form-fields/text-field.php

    r1851196 r1928419  
    1 <input type="text" class="input-text" name="<?php echo esc_attr( isset( $field['name'] ) ? $field['name'] : $key ); ?>"<?php if ( isset( $field['autocomplete'] ) && false === $field['autocomplete'] ) { echo ' autocomplete="off"'; } ?> id="<?php echo esc_attr( $key ); ?>" placeholder="<?php echo esc_attr( $field['placeholder'] ); ?>" value="<?php echo isset( $field['value'] ) ? esc_attr( $field['value'] ) : ''; ?>" maxlength="<?php echo ! empty( $field['maxlength'] ) ? $field['maxlength'] : ''; ?>" <?php if ( ! empty( $field['required'] ) ) echo 'required'; ?> />
     1<?php
     2/**
     3 * Shows the `text` form field on restaurant listing forms.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/form-fields/text-field.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17?>
     18<input type="text" class="input-text" name="<?php echo esc_attr( isset( $field['name'] ) ? $field['name'] : $key ); ?>"<?php if ( isset( $field['autocomplete'] ) && false === $field['autocomplete'] ) { echo ' autocomplete="off"'; } ?> id="<?php echo esc_attr( $key ); ?>" placeholder="<?php echo empty( $field['placeholder'] ) ? '' : esc_attr( $field['placeholder'] ); ?>" value="<?php echo isset( $field['value'] ) ? esc_attr( $field['value'] ) : ''; ?>" maxlength="<?php echo ! empty( $field['maxlength'] ) ? $field['maxlength'] : ''; ?>" <?php if ( ! empty( $field['required'] ) ) echo 'required'; ?> />
    219<?php if ( ! empty( $field['description'] ) ) : ?><small class="description"><?php echo $field['description']; ?></small><?php endif; ?>
  • wp-restaurant-listings/trunk/templates/form-fields/textarea-field.php

    r1851196 r1928419  
    1 <textarea cols="20" rows="3" class="input-text" name="<?php echo esc_attr( isset( $field['name'] ) ? $field['name'] : $key ); ?>" id="<?php echo esc_attr( $key ); ?>" placeholder="<?php echo esc_attr( $field['placeholder'] ); ?>" maxlength="<?php echo ! empty( $field['maxlength'] ) ? $field['maxlength'] : ''; ?>" <?php if ( ! empty( $field['required'] ) ) echo 'required'; ?>><?php echo isset( $field['value'] ) ? esc_textarea( $field['value'] ) : ''; ?></textarea>
     1<?php
     2/**
     3 * Shows the `textarea` form field on restaurant listing forms.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/form-fields/textarea-field.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17?>
     18<textarea cols="20" rows="3" class="input-text" name="<?php echo esc_attr( isset( $field['name'] ) ? $field['name'] : $key ); ?>" id="<?php echo esc_attr( $key ); ?>" placeholder="<?php echo empty( $field['placeholder'] ) ? '' : esc_attr( $field['placeholder'] ); ?>" maxlength="<?php echo ! empty( $field['maxlength'] ) ? $field['maxlength'] : ''; ?>" <?php if ( ! empty( $field['required'] ) ) echo 'required'; ?>><?php echo isset( $field['value'] ) ? esc_textarea( $field['value'] ) : ''; ?></textarea>
    219<?php if ( ! empty( $field['description'] ) ) : ?><small class="description"><?php echo $field['description']; ?></small><?php endif; ?>
  • wp-restaurant-listings/trunk/templates/form-fields/uploaded-file-html.php

    r1851196 r1928419  
     1<?php
     2/**
     3 * Shows info for an uploaded file on restaurant listing forms.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/form-fields/uploaded-file-html.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17?>
    118<div class="restaurant-listings-uploaded-file">
    219    <?php
  • wp-restaurant-listings/trunk/templates/form-fields/wp-editor-field.php

    r1851196 r1928419  
    11<?php
     2/**
     3 * Shows the right `textarea` form field with WP Editor on restaurant listing forms.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/form-fields/wp-editor-field.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17
    218$editor = apply_filters( 'submit_restaurant_form_wp_editor_args', array(
    319    'textarea_name' => isset( $field['name'] ) ? $field['name'] : $key,
  • wp-restaurant-listings/trunk/templates/pagination.php

    r1851196 r1928419  
    22/**
    33 * Pagination - Show numbered pagination for catalog pages.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/pagination.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
    412 */
    5 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
    617
    718if ( $max_num_pages <= 1 ) {
  • wp-restaurant-listings/trunk/templates/restaurant-dashboard-login.php

    r1851196 r1928419  
     1<?php
     2/**
     3 * Restaurant dashboard shortcode content if user is not logged in.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/restaurant-dashboard-login.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17?>
    118<div id="restaurant-listings-restaurant-dashboard">
    219
  • wp-restaurant-listings/trunk/templates/restaurant-dashboard.php

    r1851196 r1928419  
     1<?php
     2/**
     3 * Restaurant dashboard shortcode content.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/restaurant-dashboard.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17?>
    118<div id="restaurant-listings-restaurant-dashboard">
    219    <p><?php _e( 'Your listings are shown in the table below.', 'wp-restaurant-listings' ); ?></p>
  • wp-restaurant-listings/trunk/templates/restaurant-filter-restaurant-types.php

    r1851196 r1928419  
     1<?php
     2/**
     3 * Filter in `[restaurants]` shortcode for restaurant types.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/restaurant-filter-restaurant-types.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17?>
    118<?php if ( ! is_tax( 'restaurant_listings_type' ) && empty( $restaurant_types ) ) : ?>
    219    <ul class="restaurant_types">
  • wp-restaurant-listings/trunk/templates/restaurant-filters.php

    r1851196 r1928419  
    1 <?php wp_enqueue_script( 'wp-restaurant-listings-ajax-filters' ); ?>
     1<?php
     2/**
     3 * Filters in `[restaurants]` shortcode.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/restaurant-filters.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
    213
    3 <?php do_action( 'restaurant_listings_restaurant_filters_before', $atts ); ?>
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17
     18wp_enqueue_script( 'wp-restaurant-listings-ajax-filters' );
     19
     20do_action( 'restaurant_listings_restaurant_filters_before', $atts );
     21?>
    422
    523<form class="restaurant_filters">
  • wp-restaurant-listings/trunk/templates/restaurant-gallery-photoswipe.php

    r1851196 r1928419  
    22/**
    33 * Photoswipe markup
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/restaurant-gallery-photoswipe.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
    412 */
    513
  • wp-restaurant-listings/trunk/templates/restaurant-listings-end.php

    r1839196 r1928419  
     1<?php
     2/**
     3 * Content shown after restaurant listings in `[restaurants]` shortcode.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/restaurant-listings-end.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17?>
    118</ul>
  • wp-restaurant-listings/trunk/templates/restaurant-listings-start.php

    r1839196 r1928419  
     1<?php
     2/**
     3 * Content shown before restaurant listings in `[restaurants]` shortcode.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/restaurant-listings-start.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17?>
    118<ul class="restaurant_listings">
  • wp-restaurant-listings/trunk/templates/restaurant-pagination.php

    r1851196 r1928419  
    22/**
    33 * Pagination - Show numbered pagination for the [restaurants] shortcode
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/restaurant-pagination.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
    412 */
    5 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
    617
    718if ( $max_num_pages <= 1 ) {
  • wp-restaurant-listings/trunk/templates/restaurant-preview.php

    r1851196 r1928419  
     1<?php
     2/**
     3 * Restaurant listing preview when submitting restaurant listings.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/restaurant-preview.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17?>
    118<form method="post" id="restaurant_preview" action="<?php echo esc_url( $form->get_action() ); ?>">
    219    <div class="restaurant_listings_preview_title">
  • wp-restaurant-listings/trunk/templates/restaurant-submit.php

    r1851196 r1928419  
    22/**
    33 * Restaurant Submission Form
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/restaurant-submit.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
    412 */
    5 if ( ! defined( 'ABSPATH' ) ) exit;
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
    617
    718global $restaurant_listings;
  • wp-restaurant-listings/trunk/templates/restaurant-submitted.php

    r1851196 r1928419  
    11<?php
     2/**
     3 * Notice when restaurant has been submitted.
     4 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/restaurant-submitted.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
     12 */
     13
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit; // Exit if accessed directly.
     16}
     17
    218global $wp_post_types;
    319
  • wp-restaurant-listings/trunk/templates/single-restaurant_listings-reviews.php

    r1851196 r1928419  
    33 * Display single reviews (comments)
    44 *
     5 * This template can be overridden by copying it to yourtheme/restaurant_listings/single-restaurant_listings-reviews.php.
     6 *
     7 * @see         https://wpdrift.com/document/template-overrides/
     8 * @author      WPdrift
     9 * @package     WP Restaurant Listings
     10 * @category    Template
     11 * @version     1.0.1
    512 */
    613
  • wp-restaurant-listings/trunk/wp-restaurant-listings-functions.php

    r1851196 r1928419  
    11<?php
    22if ( ! function_exists( 'get_restaurant_listings' ) ) :
    3 /**
    4  * Queries restaurant listings with certain criteria and returns them.
    5  *
    6  * @since 1.0.0
    7  * @param string|array|object $args Arguments used to retrieve restaurant listings.
    8  * @return WP_Query
    9  */
    10 function get_restaurant_listings( $args = array() ) {
    11     global $wpdb, $restaurant_listings_keyword;
    12 
    13     $args = wp_parse_args( $args, array(
    14         'search_location'   => '',
    15         'search_keywords'   => '',
    16         'search_categories' => array(),
    17         'restaurant_types'  => array(),
    18         'search_price_range'=> '',
    19         'post_status'       => array(),
    20         'offset'            => 0,
    21         'posts_per_page'    => 20,
    22         'orderby'           => 'date',
    23         'order'             => 'DESC',
    24         'featured'          => null,
    25         'fields'            => 'all'
    26     ) );
    27 
    28     /**
    29      * Perform actions that need to be done prior to the start of the restaurant listings query.
     3    /**
     4     * Queries restaurant listings with certain criteria and returns them.
    305     *
    316     * @since 1.0.0
    32      *
    33      * @param array $args Arguments used to retrieve restaurant listings.
    34      */
    35     do_action( 'get_restaurant_listings_init', $args );
    36 
    37     if ( ! empty( $args['post_status'] ) ) {
    38         $post_status = $args['post_status'];
    39     } else {
    40         $post_status = 'publish';
    41     }
    42 
    43     $query_args = array(
    44         'post_type'              => 'restaurant_listings',
    45         'post_status'            => $post_status,
    46         'ignore_sticky_posts'    => 1,
    47         'offset'                 => absint( $args['offset'] ),
    48         'posts_per_page'         => intval( $args['posts_per_page'] ),
    49         'orderby'                => $args['orderby'],
    50         'order'                  => $args['order'],
    51         'tax_query'              => array(),
    52         'meta_query'             => array(),
    53         'update_post_term_cache' => false,
    54         'update_post_meta_cache' => false,
    55         'cache_results'          => false,
    56         'fields'                 => $args['fields']
    57     );
    58 
    59     if ( $args['posts_per_page'] < 0 ) {
    60         $query_args['no_found_rows'] = true;
    61     }
    62 
    63     if ( ! empty( $args['search_location'] ) ) {
    64         $location_meta_keys = array( 'geolocation_formatted_address', '_restaurant_location', 'geolocation_state_long' );
    65         $location_search    = array( 'relation' => 'OR' );
    66         foreach ( $location_meta_keys as $meta_key ) {
    67             $location_search[] = array(
    68                 'key'     => $meta_key,
    69                 'value'   => $args['search_location'],
    70                 'compare' => 'like'
     7     * @param string|array|object $args Arguments used to retrieve restaurant listings.
     8     * @return WP_Query
     9     */
     10    function get_restaurant_listings( $args = array() ) {
     11        global $wpdb, $restaurant_listings_keyword;
     12
     13        $args = wp_parse_args( $args, array(
     14            'search_location'    => '',
     15            'search_keywords'    => '',
     16            'search_categories'  => array(),
     17            'restaurant_types'   => array(),
     18            'search_price_range' => '',
     19            'post_status'        => array(),
     20            'offset'             => 0,
     21            'posts_per_page'     => 20,
     22            'orderby'            => 'date',
     23            'order'              => 'DESC',
     24            'featured'           => null,
     25            'fields'             => 'all',
     26        ) );
     27
     28        /**
     29         * Perform actions that need to be done prior to the start of the restaurant listings query.
     30         *
     31         * @since 1.0.0
     32         *
     33         * @param array $args Arguments used to retrieve restaurant listings.
     34         */
     35        do_action( 'get_restaurant_listings_init', $args );
     36
     37        if ( ! empty( $args['post_status'] ) ) {
     38            $post_status = $args['post_status'];
     39        } else {
     40            $post_status = 'publish';
     41        }
     42
     43        $query_args = array(
     44            'post_type'              => 'restaurant_listings',
     45            'post_status'            => $post_status,
     46            'ignore_sticky_posts'    => 1,
     47            'offset'                 => absint( $args['offset'] ),
     48            'posts_per_page'         => intval( $args['posts_per_page'] ),
     49            'orderby'                => $args['orderby'],
     50            'order'                  => $args['order'],
     51            'tax_query'              => array(),
     52            'meta_query'             => array(),
     53            'update_post_term_cache' => false,
     54            'update_post_meta_cache' => false,
     55            'cache_results'          => false,
     56            'fields'                 => $args['fields'],
     57        );
     58
     59        if ( $args['posts_per_page'] < 0 ) {
     60            $query_args['no_found_rows'] = true;
     61        }
     62
     63        if ( ! empty( $args['search_location'] ) ) {
     64            $location_meta_keys = array( 'geolocation_formatted_address', '_restaurant_location', 'geolocation_state_long' );
     65            $location_search    = array( 'relation' => 'OR' );
     66            foreach ( $location_meta_keys as $meta_key ) {
     67                $location_search[] = array(
     68                    'key'     => $meta_key,
     69                    'value'   => $args['search_location'],
     70                    'compare' => 'like',
     71                );
     72            }
     73            $query_args['meta_query'][] = $location_search;
     74        }
     75
     76        if ( ! is_null( $args['featured'] ) ) {
     77            $query_args['meta_query'][] = array(
     78                'key'     => '_featured',
     79                'value'   => '1',
     80                'compare' => $args['featured'] ? '=' : '!=',
    7181            );
    7282        }
    73         $query_args['meta_query'][] = $location_search;
    74     }
    75 
    76     if ( ! is_null( $args['featured'] ) ) {
    77         $query_args['meta_query'][] = array(
    78             'key'     => '_featured',
    79             'value'   => '1',
    80             'compare' => $args['featured'] ? '=' : '!='
    81         );
    82     }
    83 
    84     if ( ! empty( $args['restaurant_types'] ) ) {
    85         $query_args['tax_query'][] = array(
    86             'taxonomy' => 'restaurant_listings_type',
    87             'field'    => 'slug',
    88             'terms'    => $args['restaurant_types']
    89         );
    90     }
    91 
    92     if ( ! empty( $args['search_price_range'] ) ) {
    93         $query_args['meta_query'][] = array(
    94             'key'       => '_restaurant_price_range',
    95             'value'     => (int)$args['search_price_range'],
    96             'compare'   => '=',
    97         );
    98     }
    99 
    100     if ( ! empty( $args['search_categories'] ) ) {
    101         $field    = is_numeric( $args['search_categories'][0] ) ? 'term_id' : 'slug';
    102         $operator = 'all' === get_option( 'restaurant_listings_category_filter_type', 'all' ) && sizeof( $args['search_categories'] ) > 1 ? 'AND' : 'IN';
    103         $query_args['tax_query'][] = array(
    104             'taxonomy'         => 'restaurant_listings_category',
    105             'field'            => $field,
    106             'terms'            => array_values( $args['search_categories'] ),
    107             'include_children' => $operator !== 'AND' ,
    108             'operator'         => $operator
    109         );
    110     }
    111 
    112     if ( 'featured' === $args['orderby'] ) {
    113         $query_args['orderby'] = array(
    114             'menu_order' => 'ASC',
    115             'date'       => 'DESC'
    116         );
    117     }
    118 
    119     $restaurant_listings_keyword = sanitize_text_field( $args['search_keywords'] );
    120 
    121     if ( ! empty( $restaurant_listings_keyword ) && strlen( $restaurant_listings_keyword ) >= apply_filters( 'restaurant_listings_get_listings_keyword_length_threshold', 2 ) ) {
    122         $query_args['s'] = $restaurant_listings_keyword;
    123         add_filter( 'posts_search', 'get_restaurant_listings_keyword_search' );
    124     }
    125 
    126     $query_args = apply_filters( 'restaurant_listings_get_listings', $query_args, $args );
    127 
    128     if ( empty( $query_args['meta_query'] ) ) {
    129         unset( $query_args['meta_query'] );
    130     }
    131 
    132     if ( empty( $query_args['tax_query'] ) ) {
    133         unset( $query_args['tax_query'] );
    134     }
    135 
    136     /** This filter is documented in wp-restaurant-listings.php */
    137     $query_args['lang'] = apply_filters( 'wprl_lang', null );
    138 
    139     // Filter args
    140     $query_args = apply_filters( 'get_restaurant_listings_query_args', $query_args, $args );
    141 
    142     // Generate hash
    143     $to_hash         = json_encode( $query_args );
    144     $query_args_hash = 'jm_' . md5( $to_hash ) . WP_Restaurant_Listings_Cache_Helper::get_transient_version( 'get_restaurant_listings' );
    145 
    146     do_action( 'before_get_restaurant_listings', $query_args, $args );
    147 
    148     // Cache results
    149     if ( apply_filters( 'get_restaurant_listings_cache_results', true ) ) {
    150 
    151         if ( false === ( $result = get_transient( $query_args_hash ) ) ) {
     83
     84        if ( ! empty( $args['restaurant_types'] ) ) {
     85            $query_args['tax_query'][] = array(
     86                'taxonomy' => 'restaurant_listings_type',
     87                'field'    => 'slug',
     88                'terms'    => $args['restaurant_types'],
     89            );
     90        }
     91
     92        if ( ! empty( $args['search_price_range'] ) ) {
     93            $query_args['meta_query'][] = array(
     94                'key'       => '_restaurant_price_range',
     95                'value'     => (int)$args['search_price_range'],
     96                'compare'   => '=',
     97            );
     98        }
     99
     100        if ( ! empty( $args['search_categories'] ) ) {
     101            $field                     = is_numeric( $args['search_categories'][0] ) ? 'term_id' : 'slug';
     102            $operator                  = 'all' === get_option( 'restaurant_listings_category_filter_type', 'all' ) && sizeof( $args['search_categories'] ) > 1 ? 'AND' : 'IN';
     103            $query_args['tax_query'][] = array(
     104                'taxonomy'         => 'restaurant_listings_category',
     105                'field'            => $field,
     106                'terms'            => array_values( $args['search_categories'] ),
     107                'include_children' => 'AND' !== $operator,
     108                'operator'         => $operator,
     109            );
     110        }
     111
     112        if ( 'featured' === $args['orderby'] ) {
     113            $query_args['orderby'] = array(
     114                'menu_order' => 'ASC',
     115                'date'       => 'DESC',
     116            );
     117        }
     118
     119        if ( 'rand_featured' === $args['orderby'] ) {
     120            $query_args['orderby'] = array(
     121                'menu_order' => 'ASC',
     122                'rand'       => 'ASC',
     123            );
     124        }
     125
     126        $restaurant_listings_keyword = sanitize_text_field( $args['search_keywords'] );
     127
     128        if ( ! empty( $restaurant_listings_keyword ) && strlen( $restaurant_listings_keyword ) >= apply_filters( 'restaurant_listings_get_listings_keyword_length_threshold', 2 ) ) {
     129            $query_args['s'] = $restaurant_listings_keyword;
     130            add_filter( 'posts_search', 'get_restaurant_listings_keyword_search' );
     131        }
     132
     133        $query_args = apply_filters( 'restaurant_listings_get_listings', $query_args, $args );
     134
     135        if ( empty( $query_args['meta_query'] ) ) {
     136            unset( $query_args['meta_query'] );
     137        }
     138
     139        if ( empty( $query_args['tax_query'] ) ) {
     140            unset( $query_args['tax_query'] );
     141        }
     142
     143        /** This filter is documented in wp-restaurant-listings.php */
     144        $query_args['lang'] = apply_filters( 'wprl_lang', null );
     145
     146        // Filter args.
     147        $query_args = apply_filters( 'get_restaurant_listings_query_args', $query_args, $args );
     148
     149        do_action( 'before_get_restaurant_listings', $query_args, $args );
     150
     151        // Cache results.
     152        if ( apply_filters( 'get_restaurant_listings_cache_results', true ) ) {
     153
     154            // Generate hash.
     155            $to_hash              = json_encode( $query_args );
     156            $query_args_hash      = 'jm_' . md5( $to_hash ) . WP_Restaurant_Listings_Cache_Helper::get_transient_version( 'get_restaurant_listings' );
     157            $result               = false;
     158            $cached_query_results = false;
     159            $cached_query_posts   = get_transient( $query_args_hash );
     160
     161            if ( is_string( $cached_query_posts ) ) {
     162                $cached_query_posts = json_decode( $cached_query_posts, false );
     163                if ( $cached_query_posts
     164                    && is_object( $cached_query_posts )
     165                    && isset( $cached_query_posts->max_num_pages )
     166                    && isset( $cached_query_posts->found_posts )
     167                    && isset( $cached_query_posts->posts )
     168                    && is_array( $cached_query_posts->posts )
     169                ) {
     170                    $posts  = array_map( 'get_post', $cached_query_posts->posts );
     171                    $result = new WP_Query();
     172                    $result->parse_query( $query_args );
     173                    $result->posts         = $posts;
     174                    $result->found_posts   = intval( $cached_query_posts->found_posts );
     175                    $result->max_num_pages = intval( $cached_query_posts->max_num_pages );
     176                    $result->post_count    = count( $posts );
     177                }
     178            }
     179
     180            if ( false === $result ) {
     181                $result                            = new WP_Query( $query_args );
     182                $cached_query_results              = false;
     183                $cacheable_result                  = array();
     184                $cacheable_result['posts']         = array_values( $result->posts );
     185                $cacheable_result['found_posts']   = $result->found_posts;
     186                $cacheable_result['max_num_pages'] = $result->max_num_pages;
     187                set_transient( $query_args_hash, json_encode( $cacheable_result ), DAY_IN_SECONDS );
     188            }
     189
     190            if ( $cached_query_results ) {
     191                // random order is cached so shuffle them.
     192                if ( 'rand_featured' === $args['orderby'] ) {
     193                    usort( $result->posts, '_wprl_shuffle_featured_post_results_helper' );
     194                } elseif ( 'rand' === $args['orderby'] ) {
     195                    shuffle( $result->posts );
     196                }
     197            }
     198        } else {
    152199            $result = new WP_Query( $query_args );
    153             set_transient( $query_args_hash, $result, DAY_IN_SECONDS );
    154         }
    155 
    156         // random order is cached so shuffle them
    157         if ( $query_args[ 'orderby' ] == 'rand' ) {
    158             shuffle( $result->posts );
    159         }
    160 
    161     }
    162     else {
    163         $result = new WP_Query( $query_args );
    164     }
    165 
    166     do_action( 'after_get_restaurant_listings', $query_args, $args );
    167 
    168     remove_filter( 'posts_search', 'get_restaurant_listings_keyword_search' );
    169 
    170     return $result;
    171 }
     200        }
     201
     202        do_action( 'after_get_restaurant_listings', $query_args, $args );
     203
     204        remove_filter( 'posts_search', 'get_restaurant_listings_keyword_search' );
     205
     206        return $result;
     207    }
     208endif;
     209
     210if ( ! function_exists( '_wprl_shuffle_featured_post_results_helper' ) ) :
     211    /**
     212     * Helper function to maintain featured status when shuffling results.
     213     *
     214     * @param WP_Post $a
     215     * @param WP_Post $b
     216     *
     217     * @return bool
     218     */
     219    function _wprl_shuffle_featured_post_results_helper( $a, $b ) {
     220        if ( -1 === $a->menu_order || -1 === $b->menu_order ) {
     221            // Left is featured.
     222            if ( 0 === $b->menu_order ) {
     223                return -1;
     224            }
     225            // Right is featured.
     226            if ( 0 === $a->menu_order ) {
     227                return 1;
     228            }
     229        }
     230        return rand( -1, 1 );
     231    }
    172232endif;
    173233
     
    208268                $conditions[] = "{$wpdb->posts}.ID IN ( SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key IN ( '" . implode( "','", array_map( 'esc_sql', $searchable_meta_keys ) ) . "' ) AND meta_value LIKE '%" . esc_sql( $restaurant_listings_keyword ) . "%' )";
    209269            } else {
    210                 // No meta keys defined, search all post meta value
     270                // No meta keys defined, search all post meta value
    211271                $conditions[] = "{$wpdb->posts}.ID IN ( SELECT post_id FROM {$wpdb->postmeta} WHERE meta_value LIKE '%" . esc_sql( $restaurant_listings_keyword ) . "%' )";
    212272            }
     
    322382    return get_terms( "restaurant_listings_category", array(
    323383        'orderby'       => 'name',
    324         'order'         => 'ASC',
    325         'hide_empty'    => false,
     384        'order'         => 'ASC',
     385        'hide_empty'    => false,
    326386    ) );
    327387}
     
    508568    }
    509569
    510     // Notify
    511     wp_restaurant_listings_notify_new_user( $user_id, $password, $new_user );
     570    /**
     571     * Send notification to new users.
     572     *
     573     * @since 1.28.0
     574     *
     575     * @param  int         $user_id
     576     * @param  string|bool $password
     577     * @param  array       $new_user {
     578     *     Information about the new user.
     579     *
     580     *     @type string $user_login Username for the user.
     581     *     @type string $user_pass  Password for the user (may be blank).
     582     *     @type string $user_email Email for the new user account.
     583     *     @type string $role       New user's role.
     584     * }
     585     */
     586    do_action( 'wprl_notify_new_user', $user_id, $password, $new_user );
    512587
    513588    // Login
     
    10391114 */
    10401115function restaurant_listings_get_days_of_week() {
    1041     $days = array(0, 1, 2, 3, 4, 5, 6);
    1042     $start = get_option( 'start_of_week' );
    1043 
    1044     $first = array_splice( $days, $start, count( $days ) - $start );
    1045     $second = array_splice( $days, 0, $start );
    1046     $days = array_merge( $first, $second );
    1047 
    1048     return $days;
     1116    $days = array(0, 1, 2, 3, 4, 5, 6);
     1117    $start = get_option( 'start_of_week' );
     1118
     1119    $first = array_splice( $days, $start, count( $days ) - $start );
     1120    $second = array_splice( $days, 0, $start );
     1121    $days = array_merge( $first, $second );
     1122
     1123    return $days;
    10491124}
    10501125
     
    10591134 */
    10601135function restaurant_listings_category_list( $restaurant_id, $sep = ', ', $before = '', $after = '' ) {
    1061     return get_the_term_list( $restaurant_id, 'restaurant_listings_category', $before, $sep, $after );
     1136    return get_the_term_list( $restaurant_id, 'restaurant_listings_category', $before, $sep, $after );
    10621137}
    10631138
     
    10691144 */
    10701145function restaurant_listings_get_review_count( $post_id ) {
    1071     global $wpdb;
    1072 
    1073     $count = $wpdb->get_var( $wpdb->prepare("
     1146    global $wpdb;
     1147
     1148    $count = $wpdb->get_var( $wpdb->prepare("
    10741149            SELECT COUNT(*) FROM $wpdb->comments
    10751150            WHERE comment_parent = 0
     
    10781153        ", $post_id ) );
    10791154
    1080     return $count;
     1155    return $count;
    10811156}
    10821157
     
    10841159if ( ! function_exists( 'restaurant_listings_default_tabs' ) ) {
    10851160
    1086     /**
    1087     * Add default restaurant tabs to restaurant pages.
    1088     *
    1089     * @param array $tabs
    1090     * @return array
    1091     */
    1092     function restaurant_listings_default_tabs( $tabs = array() ) {
    1093         global  $post;
    1094 
    1095         $tabs['overview'] = array(
    1096             'title'    => sprintf( __( 'Overview', 'wp-restaurant-listings' ) ),
    1097             'priority' => 20,
    1098             'callback' => 'restaurant_listings_overview_tab',
    1099         );
    1100 
    1101         $tabs['menu'] = array(
    1102             'title'    => sprintf( __( 'Menu', 'wp-restaurant-listings' ) ),
    1103             'priority' => 30,
    1104             'callback' => 'restaurant_listings_menu_tab',
    1105         );
    1106 
    1107 
    1108         // Reviews tab - shows comments
    1109         if ( comments_open() ) {
    1110 
    1111             $tabs['reviews'] = array(
    1112                 'title'    => sprintf( __( 'Reviews (%d)', 'wp-restaurant-listings' ), restaurant_listings_get_review_count( $post->ID ) ),
    1113                 'priority' => 30,
    1114                 'callback' => 'comments_template',
    1115             );
    1116         }
    1117 
    1118         return $tabs;
    1119     }
    1120 }
     1161    /**
     1162    * Add default restaurant tabs to restaurant pages.
     1163    *
     1164    * @param array $tabs
     1165    * @return array
     1166    */
     1167    function restaurant_listings_default_tabs( $tabs = array() ) {
     1168        global  $post;
     1169
     1170        $tabs['overview'] = array(
     1171            'title'    => sprintf( __( 'Overview', 'wp-restaurant-listings' ) ),
     1172            'priority' => 20,
     1173            'callback' => 'restaurant_listings_overview_tab',
     1174        );
     1175
     1176        $tabs['menu'] = array(
     1177            'title'    => sprintf( __( 'Menu', 'wp-restaurant-listings' ) ),
     1178            'priority' => 30,
     1179            'callback' => 'restaurant_listings_menu_tab',
     1180        );
     1181
     1182
     1183        // Reviews tab - shows comments
     1184        if ( comments_open() ) {
     1185
     1186            $tabs['reviews'] = array(
     1187                'title'    => sprintf( __( 'Reviews (%d)', 'wp-restaurant-listings' ), restaurant_listings_get_review_count( $post->ID ) ),
     1188                'priority' => 30,
     1189                'callback' => 'comments_template',
     1190            );
     1191        }
     1192
     1193        return $tabs;
     1194    }
     1195}
  • wp-restaurant-listings/trunk/wp-restaurant-listings-template.php

    r1851196 r1928419  
    264264
    265265    $types = get_the_terms( $post->ID, 'restaurant_listings_type' );
     266
     267    if ( empty( $types ) || is_wp_error( $types ) ) {
     268        $types = array();
     269    }
    266270
    267271    // Return single if not enabled.
     
    374378    $date_format = get_option( 'restaurant_listings_date_format' );
    375379
    376     if ( $date_format === 'default' ) {
    377         $display_date = __( 'Posted on ', 'wp-restaurant-listings' ) . get_post_time( get_option( 'date_format' ) );
     380    if ( 'default' === $date_format ) {
     381        $display_date = __( 'Posted on ', 'wp-restaurant-listings' ) . date_i18n( get_option( 'date_format' ), get_post_time( 'U' ) );
    378382    } else {
    379383        $display_date = sprintf( __( 'Posted %s ago', 'wp-restaurant-listings' ), human_time_diff( get_post_time( 'U' ), current_time( 'timestamp' ) ) );
  • wp-restaurant-listings/trunk/wp-restaurant-listings.php

    r1851196 r1928419  
    44 * Plugin URI: http://restaurants.wpdrift.com/
    55 * Description: Manage restaurant listings from the WordPress admin panel, and allow users to post restaurants directly to your site.
    6  * Version: 1.0.0
     6 * Version: 1.0.1
    77 * Author: WPdrift
    88 * Author URI: https://wpdrift.com/
Note: See TracChangeset for help on using the changeset viewer.