Business Directory Plugin - Version 4.0.5

Version Description

Download this release

Release Info

Developer businessdirectoryplugin
Plugin Icon 128x128 Business Directory Plugin
Version 4.0.5
Comparing to
See all releases

Code changes from version 4.0.4 to 4.0.5

README.TXT CHANGED
@@ -4,8 +4,8 @@ Donate link: http://businessdirectoryplugin.com/premium-modules/
4
  Tags: address book, business directory, chamber of commerce business directory, church directory, company business directory, contact directory, custom business directory, directory, listings directory, local business directory, link directory, member directory, staff directory, directory plugin
5
  Requires at least: 4.1
6
  Tested up to: 4.5
7
- Last Updated: 2016-May-31
8
- Stable tag: tags/4.0.4
9
  License: GPLv2 or later
10
 
11
  Build any kind of local directory, directory of business providers, a Yellow-Pages business directory, Yelp-like review directory and much more!
@@ -130,6 +130,20 @@ If you are having problems please visit [support forum](http://www.businessdirec
130
 
131
  == Changelog ==
132
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  = Version 4.0.4 =
134
  * Add compatibility mode that disables CPT integration for setups having issues or theme conflicts.
135
  * Try single and singular templates along with page.php for improved theme compatibility.
4
  Tags: address book, business directory, chamber of commerce business directory, church directory, company business directory, contact directory, custom business directory, directory, listings directory, local business directory, link directory, member directory, staff directory, directory plugin
5
  Requires at least: 4.1
6
  Tested up to: 4.5
7
+ Last Updated: 2016-June-7
8
+ Stable tag: tags/4.0.5
9
  License: GPLv2 or later
10
 
11
  Build any kind of local directory, directory of business providers, a Yellow-Pages business directory, Yelp-like review directory and much more!
130
 
131
  == Changelog ==
132
 
133
+ = Version 4.0.5 =
134
+ * Atahualpa theme compatibility fixes.
135
+ * Use an auto-complete field instead of a dropdown for the users field on the CSV import screen to avoid performance problems.
136
+ * Several fixes for encoding detection and handling during CSV imports.
137
+ * Longevity theme compatibility fixes.
138
+ * Divi theme compatibility fixes.
139
+ * Do not show any sortbar filters when sortbar is disabled.
140
+ * Additional fixes for the Genesis theme
141
+ * Fix sorting and other query problems when in CPT compatibility mode.
142
+ * Fix search query integration with sortbar.
143
+ * Restore pre-4.0 behavior (regarding Regions and Maps) of the listings shortcode.
144
+ * Add redirects for old submit listing URLs.
145
+ * Restore tag functionality for the listings shortcode.
146
+
147
  = Version 4.0.4 =
148
  * Add compatibility mode that disables CPT integration for setups having issues or theme conflicts.
149
  * Try single and singular templates along with page.php for improved theme compatibility.
admin/class-admin.php CHANGED
@@ -484,9 +484,15 @@ class WPBDP_Admin {
484
 
485
  $this->displayed_warnings[] = $msg_sha1;
486
 
487
- $class = is_array( $msg ) ? $msg[1] : 'updated';
488
- $text = is_array( $msg ) ? $msg[0] : $msg;
489
- $extra = ( is_array( $msg ) && is_array( $msg[2] ) ) ? $msg[2] : array();
 
 
 
 
 
 
490
 
491
  echo '<div class="wpbdp-notice ' . $class . '">';
492
  echo '<p>' . $text . '</p>';
484
 
485
  $this->displayed_warnings[] = $msg_sha1;
486
 
487
+ if ( is_array( $msg ) ) {
488
+ $class = isset( $msg[1] ) ? $msg[1] : 'updated';
489
+ $text = isset( $msg[0] ) ? $msg[0] : '';
490
+ $extra = isset( $msg[2] ) && is_array( $msg[2] ) ? $msg[2] : array();
491
+ } else {
492
+ $class = 'updated';
493
+ $text = $msg;
494
+ $extra = array();
495
+ }
496
 
497
  echo '<div class="wpbdp-notice ' . $class . '">';
498
  echo '<p>' . $text . '</p>';
admin/csv-import.php CHANGED
@@ -12,6 +12,7 @@ class WPBDP_CSVImportAdmin {
12
 
13
  add_action( 'admin_enqueue_scripts', array( &$this, 'enqueue_scripts' ) );
14
  add_action( 'wp_ajax_wpbdp-csv-import', array( &$this, 'ajax_csv_import' ) );
 
15
  }
16
 
17
  function enqueue_scripts() {
@@ -20,7 +21,7 @@ class WPBDP_CSVImportAdmin {
20
  if ( 'wpbdp-csv-import' != $plugin_page )
21
  return;
22
 
23
- wp_enqueue_script( 'wpbdp-admin-import-js', WPBDP_URL . 'admin/js/csv-import.js', array( 'wpbdp-admin-js' ) );
24
  wp_enqueue_style( 'wpbdp-admin-import-css', WPBDP_URL . 'admin/css/csv-import.css' );
25
  }
26
 
@@ -71,6 +72,19 @@ class WPBDP_CSVImportAdmin {
71
  $res->send();
72
  }
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  function dispatch() {
75
  $action = wpbdp_getv( $_REQUEST, 'action' );
76
 
12
 
13
  add_action( 'admin_enqueue_scripts', array( &$this, 'enqueue_scripts' ) );
14
  add_action( 'wp_ajax_wpbdp-csv-import', array( &$this, 'ajax_csv_import' ) );
15
+ add_action( 'wp_ajax_wpbdp-autocomplete-user', array( &$this, 'ajax_autocomplete_user' ) );
16
  }
17
 
18
  function enqueue_scripts() {
21
  if ( 'wpbdp-csv-import' != $plugin_page )
22
  return;
23
 
24
+ wp_enqueue_script( 'wpbdp-admin-import-js', WPBDP_URL . 'admin/js/csv-import.js', array( 'wpbdp-admin-js', 'jquery-ui-autocomplete' ) );
25
  wp_enqueue_style( 'wpbdp-admin-import-css', WPBDP_URL . 'admin/css/csv-import.css' );
26
  }
27
 
72
  $res->send();
73
  }
74
 
75
+ public function ajax_autocomplete_user() {
76
+ $users = get_users( array( 'search' => "*{$_REQUEST['term']}*" ) );
77
+
78
+ foreach ( $users as $user ) {
79
+ $return[] = array(
80
+ 'label' => "{$user->display_name} ({$user->user_login})",
81
+ 'value' => $user->ID,
82
+ );
83
+ }
84
+
85
+ wp_die( wp_json_encode( $return ) );
86
+ }
87
+
88
  function dispatch() {
89
  $action = wpbdp_getv( $_REQUEST, 'action' );
90
 
admin/js/csv-import.js CHANGED
@@ -187,4 +187,49 @@ jQuery(function( $ ) {
187
  }
188
  });
189
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
  });
187
  }
188
  });
189
 
190
+ // Default User field in Import config. page.
191
+ (function() {
192
+ var $form = $( 'form#wpbdp-csv-import-form' ),
193
+ $use_default_user_checkbox = $form.find( 'input.use-default-listing-user' ),
194
+ $default_user_field;
195
+
196
+ $form.find( 'input.assign-listings-to-user').change(function(e){
197
+ if ( $(this).is(':checked') ) {
198
+ $form.find( '.default-user-selection' ).show();
199
+ } else {
200
+ $form.find( '.default-user-selection' ).hide();
201
+ }
202
+
203
+ $use_default_user_checkbox.change();
204
+ }).change();
205
+
206
+ $use_default_user_checkbox.change(function(){
207
+ if ( $(this).is(':checked') ) {
208
+ $form.find( 'select.default-user, input.default-user' ).closest( 'tr' ).show();
209
+ } else {
210
+ $form.find( 'select.default-user, input.default-user' ).closest( 'tr' ).hide();
211
+ }
212
+ }).change();
213
+
214
+ function update_textfield_value( event, ui ) {
215
+ event.preventDefault();
216
+
217
+ if ( typeof ui.item == 'undefined' ) {
218
+ return;
219
+ }
220
+
221
+ $default_user_field.val( ui.item.label );
222
+ $default_user_field.siblings( '#' + $default_user_field.attr( 'data-hidden-field' ) )
223
+ .val( ui.item.value );
224
+ }
225
+
226
+ $default_user_field = $form.find( '.wpbdp-user-autocomplete' ).autocomplete({
227
+ source: ajaxurl + '?action=wpbdp-autocomplete-user',
228
+ delay: 500,
229
+ minLength: 2,
230
+ select: update_textfield_value,
231
+ focus: update_textfield_value
232
+ });
233
+ })();
234
+
235
  });
admin/js/csv-import.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function($){var csvimport={};csvimport.CSV_Import=function(){this.import_id=$("#wpbdp-csv-import-state").attr("data-import-id");this.in_progress=false;this.canceled=false;this.processed_rows=0;this.total_rows=0;this.imported_rows=0;this.rejected_rows=0;this.warnings=[];this.$state=$("#wpbdp-csv-import-state");this.$success=$("#wpbdp-csv-import-summary");this.$progress_bar=new WPBDP_Admin.ProgressBar($(".import-progress"));this._setup_events()};$.extend(csvimport.CSV_Import.prototype,{_setup_events:function(){var t=this;$("a.cancel-import").click(function(e){e.preventDefault();t.cancel()});$("a.resume-import").click(function(e){e.preventDefault();t.start_or_resume()})},_advance:function(){var t=this;if(!t.in_progress){return}if(t.in_progress&&t.canceled){t.in_progress=false}$.ajax({url:ajaxurl,type:"POST",dataType:"json",data:{action:"wpbdp-csv-import",import_id:t.import_id},success:function(res){if(!res||!res.success){return t._fatal_error(res.error)}t.processed_rows=res.data.progress;t.total_rows=res.data.total;t.imported_rows=res.data.imported;t.rejected_rows=res.data.rejected;t.$progress_bar.set(t.processed_rows,t.total_rows);if(res.data.done){t.in_progress=false;t.warnings=res.data.warnings;t._show_success_screen()}else{t._advance()}},error:function(){return t._fatal_error()}})},_show_success_screen:function(){var t=this;t.$state.fadeOut(function(){t.$state.remove();t.$success.find(".placeholder-imported-rows").html(t.imported_rows);t.$success.find(".placeholder-rejected-rows").html(t.rejected_rows);if(0==t.warnings.length){t.$success.find(".no-warnings").show();t.$success.fadeIn("fast");return}var $warnings_table=t.$success.find(".wpbdp-csv-import-warnings tbody");var $template_row=$warnings_table.find(".row-template");$.each(t.warnings,function(i,v){var $r=$template_row.clone();$r.find(".col-line-no").html(v.line);$r.find(".col-line-content").html(v.content);$r.find(".col-warning").html(v.error);$warnings_table.append($r.show())});t.$success.find(".with-warnings").show();t.$success.find(".wpbdp-csv-import-warnings").show();t.$success.fadeIn("fast")})},_fatal_error:function(msg){var t=this;var $fatal_error=$("#wpbdp-csv-import-fatal-error");var $with_reason=$fatal_error.find(".with-reason");var $no_reason=$fatal_error.find(".no-reason");if(t.processed_rows>0){var $last_line=$fatal_error.find(".last-imported-line");$last_line.find(".placeholder").html(t.processed_rows)}if(msg){$with_reason.html($with_reason.html().replace("%s",msg)).show()}else{$no_reason.show()}$fatal_error.show();$("html, body").animate({scrollTop:0},"medium");t.cancel()},start_or_resume:function(){if(this.in_progress||this.canceled){return}this.in_progress=true;$("a.resume-import").css("opacity","0.4");$(".status-msg .not-started").hide();$(".status-msg .in-progress").show();this._advance()},cancel:function(){var t=this;t.canceled=true;$(".canceled-import").show();t.$state.remove();$.ajax({url:ajaxurl,type:"POST",dataType:"json",data:{action:"wpbdp-csv-import",import_id:t.import_id,cleanup:1}})}});if($("#wpbdp-csv-import-state").length>0){var import_in_page=new csvimport.CSV_Import();return}$(".wpbdp-page-csv-import .file-local-selection a.toggle-selection").click(function(e){e.preventDefault();var $files=$(this).siblings("ul");$files.toggle();if(!$files.is(":visible")){$files.find('input[type="radio"]').prop("checked",false)}});$('.wpbdp-page-csv-import .file-local-selection input[type="radio"]').change(function(e){var sel=$(this).filter(":checked").val();if(""==sel){$(this).prop("checked",false);$(this).parents(".file-local-selection").hide()}})});
1
+ jQuery(function($){var csvimport={};csvimport.CSV_Import=function(){this.import_id=$("#wpbdp-csv-import-state").attr("data-import-id");this.in_progress=false;this.canceled=false;this.processed_rows=0;this.total_rows=0;this.imported_rows=0;this.rejected_rows=0;this.warnings=[];this.$state=$("#wpbdp-csv-import-state");this.$success=$("#wpbdp-csv-import-summary");this.$progress_bar=new WPBDP_Admin.ProgressBar($(".import-progress"));this._setup_events()};$.extend(csvimport.CSV_Import.prototype,{_setup_events:function(){var t=this;$("a.cancel-import").click(function(e){e.preventDefault();t.cancel()});$("a.resume-import").click(function(e){e.preventDefault();t.start_or_resume()})},_advance:function(){var t=this;if(!t.in_progress){return}if(t.in_progress&&t.canceled){t.in_progress=false}$.ajax({url:ajaxurl,type:"POST",dataType:"json",data:{action:"wpbdp-csv-import",import_id:t.import_id},success:function(res){if(!res||!res.success){return t._fatal_error(res.error)}t.processed_rows=res.data.progress;t.total_rows=res.data.total;t.imported_rows=res.data.imported;t.rejected_rows=res.data.rejected;t.$progress_bar.set(t.processed_rows,t.total_rows);if(res.data.done){t.in_progress=false;t.warnings=res.data.warnings;t._show_success_screen()}else{t._advance()}},error:function(){return t._fatal_error()}})},_show_success_screen:function(){var t=this;t.$state.fadeOut(function(){t.$state.remove();t.$success.find(".placeholder-imported-rows").html(t.imported_rows);t.$success.find(".placeholder-rejected-rows").html(t.rejected_rows);if(0==t.warnings.length){t.$success.find(".no-warnings").show();t.$success.fadeIn("fast");return}var $warnings_table=t.$success.find(".wpbdp-csv-import-warnings tbody");var $template_row=$warnings_table.find(".row-template");$.each(t.warnings,function(i,v){var $r=$template_row.clone();$r.find(".col-line-no").html(v.line);$r.find(".col-line-content").html(v.content);$r.find(".col-warning").html(v.error);$warnings_table.append($r.show())});t.$success.find(".with-warnings").show();t.$success.find(".wpbdp-csv-import-warnings").show();t.$success.fadeIn("fast")})},_fatal_error:function(msg){var t=this;var $fatal_error=$("#wpbdp-csv-import-fatal-error");var $with_reason=$fatal_error.find(".with-reason");var $no_reason=$fatal_error.find(".no-reason");if(t.processed_rows>0){var $last_line=$fatal_error.find(".last-imported-line");$last_line.find(".placeholder").html(t.processed_rows)}if(msg){$with_reason.html($with_reason.html().replace("%s",msg)).show()}else{$no_reason.show()}$fatal_error.show();$("html, body").animate({scrollTop:0},"medium");t.cancel()},start_or_resume:function(){if(this.in_progress||this.canceled){return}this.in_progress=true;$("a.resume-import").css("opacity","0.4");$(".status-msg .not-started").hide();$(".status-msg .in-progress").show();this._advance()},cancel:function(){var t=this;t.canceled=true;$(".canceled-import").show();t.$state.remove();$.ajax({url:ajaxurl,type:"POST",dataType:"json",data:{action:"wpbdp-csv-import",import_id:t.import_id,cleanup:1}})}});if($("#wpbdp-csv-import-state").length>0){var import_in_page=new csvimport.CSV_Import();return}$(".wpbdp-page-csv-import .file-local-selection a.toggle-selection").click(function(e){e.preventDefault();var $files=$(this).siblings("ul");$files.toggle();if(!$files.is(":visible")){$files.find('input[type="radio"]').prop("checked",false)}});$('.wpbdp-page-csv-import .file-local-selection input[type="radio"]').change(function(e){var sel=$(this).filter(":checked").val();if(""==sel){$(this).prop("checked",false);$(this).parents(".file-local-selection").hide()}});(function(){var $form=$("form#wpbdp-csv-import-form"),$use_default_user_checkbox=$form.find("input.use-default-listing-user"),$default_user_field;$form.find("input.assign-listings-to-user").change(function(e){if($(this).is(":checked")){$form.find(".default-user-selection").show()}else{$form.find(".default-user-selection").hide()}$use_default_user_checkbox.change()}).change();$use_default_user_checkbox.change(function(){if($(this).is(":checked")){$form.find("select.default-user, input.default-user").closest("tr").show()}else{$form.find("select.default-user, input.default-user").closest("tr").hide()}}).change();function update_textfield_value(event,ui){event.preventDefault();if(typeof ui.item=="undefined"){return}$default_user_field.val(ui.item.label);$default_user_field.siblings("#"+$default_user_field.attr("data-hidden-field")).val(ui.item.value)}$default_user_field=$form.find(".wpbdp-user-autocomplete").autocomplete({source:ajaxurl+"?action=wpbdp-autocomplete-user",delay:500,minLength:2,select:update_textfield_value,focus:update_textfield_value})})()});
admin/resources/admin.js CHANGED
@@ -266,18 +266,6 @@ jQuery(document).ready(function($){
266
  alert('This form is just a preview. It doesn\'t work.');
267
  });
268
 
269
- /* CSV import */
270
- $('form#wpbdp-csv-import-form input.assign-listings-to-user').change(function(e){
271
- if ( $(this).is(':checked') ) {
272
- $('form#wpbdp-csv-import-form .default-user-selection').show();
273
- //$('form#wpbdp-csv-import-form select.default-user').hide('disabled');
274
- } else {
275
- $('form#wpbdp-csv-import-form .default-user-selection').hide();
276
- //$('form#wpbdp-csv-import-form select.default-user').attr('disabled', 'disabled');
277
- }
278
-
279
- }).change();
280
-
281
  /* Debug info page */
282
  $('#wpbdp-admin-debug-info-page a.nav-tab').click(function(e){
283
  e.preventDefault();
266
  alert('This form is just a preview. It doesn\'t work.');
267
  });
268
 
 
 
 
 
 
 
 
 
 
 
 
 
269
  /* Debug info page */
270
  $('#wpbdp-admin-debug-info-page a.nav-tab').click(function(e){
271
  e.preventDefault();
admin/resources/admin.min.js CHANGED
@@ -1 +1 @@
1
- var WPBDP_associations_fieldtypes={};(function($){var WPBDPAdmin_FormFields={$f_association:null,$f_fieldtype:null,init:function(){WPBDPAdmin_FormFields.$f_association=$("form#wpbdp-formfield-form select#field-association");WPBDPAdmin_FormFields.$f_association.change(WPBDPAdmin_FormFields.onAssociationChange);WPBDPAdmin_FormFields.$f_fieldtype=$("form#wpbdp-formfield-form select#field-type");WPBDPAdmin_FormFields.$f_fieldtype.change(WPBDPAdmin_FormFields.onFieldTypeChange);$("#wpbdp-fieldsettings .iframe-confirm a").click(function(e){e.preventDefault();if($(this).hasClass("yes")){$(this).parents(".iframe-confirm").hide()}else{$('#wpbdp-fieldsettings input[name="field[allow_iframes]"]').removeAttr("checked");$(this).parents(".iframe-confirm").hide()}});$('#wpbdp-fieldsettings input[name="field[allow_iframes]"]').change(function(){if($(this).is(":checked")){$(".iframe-confirm").show()}else{$(".iframe-confirm").hide()}});$("table.formfields tbody").sortable({placeholder:"wpbdp-draggable-highlight",handle:".wpbdp-drag-handle",axis:"y",cursor:"move",opacity:0.9,update:function(event,ui){var sorted_items=[];$(this).find(".wpbdp-drag-handle").each(function(i,v){sorted_items.push($(v).attr("data-field-id"))});if(sorted_items){$.post(ajaxurl,{action:"wpbdp-formfields-reorder",order:sorted_items})}}})},onFieldTypeChange:function(){var $field_type=$(this).find("option:selected");if(!$field_type.length){return}var field_type=$field_type.val();if("url"==field_type){$("select#field-validator option").not('[value="url"]').attr("disabled","disabled").removeAttr("selected");$('select#field-validator option[value="url"]').attr("selected","selected")}else{$("select#field-validator option").removeAttr("disabled")}var request_data={action:"wpbdp-renderfieldsettings",association:WPBDPAdmin_FormFields.$f_association.find("option:selected").val(),field_type:field_type,field_id:$('#wpbdp-formfield-form input[name="field[id]"]').val()};$.post(ajaxurl,request_data,function(response){if(response.ok&&response.html){$("#wpbdp-fieldsettings-html").html(response.html);$("#wpbdp-fieldsettings").show()}else{$("#wpbdp-fieldsettings-html").empty();$("#wpbdp-fieldsettings").hide()}},"json")},onAssociationChange:function(){$f_fieldtype=WPBDPAdmin_FormFields.$f_fieldtype;var association=$(this).find("option:selected").val();var valid_types=WPBDP_associations_fieldtypes[association];$f_fieldtype.find("option").removeAttr("disabled");$f_fieldtype.find("option").each(function(i,v){if($.inArray($(v).val(),valid_types)<0){$(v).attr("disabled","disabled")}});if($f_fieldtype.find("option:selected").attr("disabled")=="disabled"){$f_fieldtype.find("option").removeAttr("selected");$f_fieldtype.find('option[value="'+valid_types[0]+'"]').attr("selected","selected")}}};$(document).ready(function(){WPBDPAdmin_FormFields.init()})})(jQuery);jQuery(document).ready(function($){$('form#wpbdp-fee-form input[name="_days"]').change(function(){var value=$(this).val();if(value==0){$("form input#wpbdp-fee-form-days-n").attr("disabled",true);$('form input[name="fee[days]"]').val("0")}else{$("form input#wpbdp-fee-form-days-n").removeAttr("disabled");$('form input[name="fee[days]"]').val($("form input#wpbdp-fee-form-days-n").val());$("form input#wpbdp-fee-form-days-n").focus()}return true});$(".wpbdp-page-admin-fees .wp-list-table.fees tbody").sortable({placeholder:"wpbdp-draggable-highlight",handle:".wpbdp-drag-handle",axis:"y",cursor:"move",opacity:0.9,update:function(event,ui){var rel_rows=$(".free-fee-related-tr").remove();$("tr.free-fee").after(rel_rows);var sorted_items=[];$(this).find(".wpbdp-drag-handle").each(function(i,v){sorted_items.push($(v).attr("data-fee-id"))});if(sorted_items){$.post(ajaxurl,{action:"wpbdp-admin-fees-reorder",order:sorted_items})}}});$("form#wpbdp-fee-form").submit(function(){$('form input[name="fee[days]"]').removeAttr("disabled");return true});$('select[name="fee_order[method]"], select[name="fee_order[order]"]').change(function(e){$.ajax({url:ajaxurl,data:$(this).parent("form").serialize(),dataType:"json",type:"POST",success:function(res){if(res.success){location.reload()}}})});if("custom"==$('select[name="fee_order[method]"]').val()){$(".wpbdp-page-admin-fees .wp-list-table .wpbdp-drag-handle").show()}$("#BusinessDirectory_listinginfo .listing-metabox-tabs a").click(function(e){e.preventDefault();var href=$(this).attr("href");var $selected=$(this).parent("li").siblings(".selected");if($selected.length>0){if($selected.find("a:first").attr("href")==href){return}else{$selected.removeClass("selected");$($selected.find("a:first").attr("href")).hide()}}$(this).parent("li").addClass("selected");$(href).show();$(".listing-fee-expiration-datepicker").hide()});var url_tab=$(location).attr("hash");if(url_tab&&$(url_tab).length>0){$('#BusinessDirectory_listinginfo a[href="'+url_tab+'"]').click()}else{$("#BusinessDirectory_listinginfo .listing-metabox-tabs li.selected a").click()}$("#listing-metabox-fees a.assignfee-link").click(function(e){e.preventDefault();$(this).siblings(".assignfee").show()});$("#listing-metabox-fees .assignfee .close-handle").click(function(e){e.preventDefault();$(this).parent(".assignfee").hide()});$(".wpbdp-ajax-placeholder").each(function(i,v){wpbdp_load_placeholder($(v))});$("input#doaction, input#doaction2").click(function(e){var action_name=("doaction"==$(this).attr("id"))?"action":"action2";var $selected_option=$('select[name="'+action_name+'"] option:selected');var action_val=$selected_option.val();if(action_val.split("-")[0]=="listing"){var action=action_val.split("-")[1];if(action!="sep0"&&action!="sep1"&&action!="sep2"){var $checked_posts=$('input[name="post[]"]:checked');var uri=$selected_option.attr("data-uri");$checked_posts.each(function(i,v){uri+="&post[]="+$(v).val()});window.location.href=uri;return false}}return true});$('.wpbdp-admin.wpbdp-page-formfields-preview form input[type="submit"]').click(function(e){e.preventDefault();alert("This form is just a preview. It doesn't work.")});$("form#wpbdp-csv-import-form input.assign-listings-to-user").change(function(e){if($(this).is(":checked")){$("form#wpbdp-csv-import-form .default-user-selection").show()}else{$("form#wpbdp-csv-import-form .default-user-selection").hide()}}).change();$("#wpbdp-admin-debug-info-page a.nav-tab").click(function(e){e.preventDefault();$("#wpbdp-admin-debug-info-page a.nav-tab").not(this).removeClass("nav-tab-active");var $selected_tab=$(this);$selected_tab.addClass("nav-tab-active");$(".wpbdp-debug-section").hide();$('.wpbdp-debug-section[data-id="'+$(this).attr("href")+'"]').show()});if($("#wpbdp-admin-debug-info-page a.nav-tab").length>0){$("#wpbdp-admin-debug-info-page a.nav-tab").get(0).click()}$(".wpbdp-page-admin-transactions .column-actions a.details-link").click(function(e){e.preventDefault();var $tr=$(this).parents("tr");var $details=$tr.find("div.more-details");var $tr_details=$tr.next("tr.more-details-row");if($tr_details.length>0){$tr_details.remove();$(this).text($(this).text().replace("-","+"));return}else{$(this).text($(this).text().replace("+","-"))}$tr.after('<tr class="more-details-row"><td colspan="7">'+$details.html()+"</td></tr>").show()})});function wpbdp_load_placeholder($v){var action=$v.attr("data-action");var post_id=$v.attr("data-post_id");var baseurl=$v.attr("data-baseurl");$v.load(ajaxurl,{action:action,post_id:post_id,baseurl:baseurl})}var WPBDP_Admin={};WPBDP_Admin.payments={};WPBDP_Admin.listingMetabox={};WPBDP_Admin.ProgressBar=function($item,settings){$item.empty();$item.html('<div class="wpbdp-progress-bar"><span class="progress-text">0%</span><div class="progress-bar"><div class="progress-bar-outer"><div class="progress-bar-inner" style="width: 0%;"></div></div></div>');this.$item=$item;this.$text=$item.find(".progress-text");this.$bar=$item.find(".progress-bar");this.set=function(completed,total){var pcg=Math.round(100*parseInt(completed)/parseInt(total));this.$text.text(pcg+"%");this.$bar.find(".progress-bar-inner").attr("style","width: "+pcg+"%;")}};(function($){WPBDP_Admin.dialog={};var dialog=WPBDP_Admin.dialog})(jQuery);(function($){var payments=WPBDP_Admin.payments;payments._initialize=function(){$("#BusinessDirectory_listinginfo a.payment-details-link").click(function(e){e.preventDefault();payments.viewPaymentDetails($(this).attr("data-id"))});if($("#wpbdp-modal-dialog").length==0){$("body").append($('<div id="wpbdp-modal-dialog"></div>'))}};payments.viewPaymentDetails=function(id){$.get(ajaxurl,{action:"wpbdp-payment-details",id:id},function(res){if(res&&res.success){if($("#wpbdp-modal-dialog").length==0){$("body").append($('<div id="wpbdp-modal-dialog"></div>'))}$("#wpbdp-modal-dialog").html(res.data.html);tb_show("","#TB_inline?inlineId=wpbdp-modal-dialog");$("#TB_window").width($("#TB_ajaxContent").outerWidth());if($("#TB_window").height()>$("#TB_ajaxContent").outerHeight()){$("#TB_ajaxContent").height($("#TB_window").height())}$("#wpbdp-modal-dialog").remove()}},"json")};$(document).ready(function(){payments._initialize()})})(jQuery);(function($){var metabox=WPBDP_Admin.listingMetabox;metabox._initialize=function(){$.extend($.datepicker,{_inlineDatepicker2:$.datepicker._inlineDatepicker,_inlineDatepicker:function(target,inst){this._inlineDatepicker2(target,inst);var beforeShow=$.datepicker._get(inst,"beforeShow");if(beforeShow){beforeShow.apply(target,[target,inst])}}});var _addNeverButton=function(instance){setTimeout(function(){var $buttonPane=$(instance).find(".ui-datepicker-buttonpane");if($buttonPane.find(".ui-datepicker-never").length>0){return}var $button=$("<button>",{text:"Never Expires",click:function(){_updateExpiration($(instance),"never");return false}}).addClass("ui-datepicker-never ui-state-default ui-priority-primary ui-corner-all");$buttonPane.append($button)},1)};var _updateExpiration=function($instance,newDate){if(!newDate){return}var $changeLink=$instance.siblings("a.expiration-change-link");var $expirationDate=$instance.siblings(".expiration-date");var $spinner=$instance.parents(".listing-category").find(".spinner:first");$expirationDate.text("--");$spinner.show();$instance.hide();_addNeverButton($instance.get(0));$.post(ajaxurl,{action:"wpbdp-listing_set_expiration",renewal_id:$changeLink.attr("data-renewal_id"),expiration_date:newDate},function(res){if(res&&res.success){$spinner.hide();$expirationDate.text(res.data.formattedExpirationDate).show()}},"json")};$("#listing-metabox-generalinfo, #listing-metabox-fees").each(function(i,v){var $tab=$(v);$tab.find(".expiration-date-info .datepicker").each(function(i,v){var $dp=$(v);var $changeLink=$dp.siblings("a.expiration-change-link");$dp.hide().datepicker({dateFormat:"yy-mm-dd",defaultDate:$changeLink.attr("data-date"),showButtonPanel:true,beforeShow:function(input){_addNeverButton(input)},onChangeMonthYear:function(year,month,instance){_addNeverButton(instance.input)},onSelect:function(newDate){_updateExpiration($(this),newDate)}})});$tab.find("a.expiration-change-link").click(function(e){e.preventDefault();var renewal_id=$(this).attr("data-renewal_id");$(".expiration-date-info .datepicker").not(".renewal-"+renewal_id).hide();$(".expiration-date-info .datepicker.renewal-"+renewal_id).toggle()})});$(".listing-category a.category-delete").click(function(e){e.preventDefault();var listingID=$(this).attr("data-listing");var categoryID=$(this).attr("data-category");if(!listingID||!categoryID){return}var $category=$(".listing-category-"+categoryID);$.post(ajaxurl,{action:"wpbdp-listing_remove_category",listing:listingID,category:categoryID},function(res){if(res&&res.success){$('input[name="tax_input[wpbdp_category][]"][value="'+categoryID+'"]').attr("checked",false);$category.fadeOut(function(){$(this).remove()})}},"json")});$(".listing-category a.category-change-fee").click(function(e){e.preventDefault();if($("#wpbdp-modal-dialog").length==0){$("body").append($('<div id="wpbdp-modal-dialog"></div>'))}$.post(ajaxurl,{action:"wpbdp-listing_change_fee",renewal:$(this).attr("data-renewal")},function(res){if(res&&res.success){$("#wpbdp-modal-dialog").html(res.data.html);tb_show("","#TB_inline?inlineId=wpbdp-modal-dialog");$("#wpbdp-modal-dialog").remove()}},"json")})};$(document).ready(function(){if($("#listing-metabox-fees").length>0){metabox._initialize()}})})(jQuery);(function($){var s=WPBDP_Admin.settings={_whenTrueActivateChilds:{},init:function(){var t=this;$(".wpbdp-settings-email").each(function(i,v){var $email=$(v);var $preview=$email.find(".short-preview");var $editor=$email.find(".editor");var $subject=$editor.find(".subject-text");var $body=$editor.find(".body-text");var data={subject:"",body:""};$preview.click(function(e){data.subject=$subject.val();data.body=$body.val();$preview.hide();$editor.show()});$(".cancel",$editor).click(function(e){e.preventDefault();$subject.val(data.subject);$body.val(data.body);$editor.hide();$preview.show()});$(".save",$editor).click(function(e){e.preventDefault();$("form#wpbdp-admin-settings #submit").click()});$(".preview-email",$editor).click(function(e){e.preventDefault();var subject=$subject.val();var body=$body.val();$.ajax({url:ajaxurl,data:{action:"wpbdp-admin-settings-email-preview",nonce:$editor.attr("data-preview-nonce"),setting:$email.attr("data-setting"),subject:subject,body:body},dataType:"json",type:"POST",success:function(res){if(!res.success){return}if(0==$("#wpbdp-modal-dialog").length){$("body").append('<div id="wpbdp-modal-dialog" style="display: none;"></div>')}$("#wpbdp-modal-dialog").html(res.data.html);tb_show("","#TB_inline?inlineId=wpbdp-modal-dialog");$("#wpbdp-modal-dialog").remove()}})})});$("select#quick-search-fields").change(function(){var selected=$(this).find("option.textfield:selected").length;if(selected>0){$("span.text-fields-warning").fadeIn("fast")}else{$("span.text-fields-warning").fadeOut("fast")}});$.each(this._whenTrueActivateChilds,function(p,chs){$('input[name="wpbdp-'+p+'"]').change(function(e){t.handleToggle(p)});t.handleToggle(p)})},handleToggle:function(setting){var childs=this._whenTrueActivateChilds[setting];if("undefined"===typeof(childs)){return}var checked=$('input[name="wpbdp-'+setting+'"]').is(":checked");$.each(this._whenTrueActivateChilds[setting],function(i,c){var $c=$('[name="wpbdp-'+c+'"], [name="wpbdp-'+c+'[]"]');var $row=$c.parents("tr");if(checked){$c.removeAttr("contenteditable");$row.removeClass("disabled")}else{$c.attr("contenteditable","false");$row.addClass("disabled")}})},add_requirement:function(setting,parent_,req){if("undefined"===typeof this._whenTrueActivateChilds[parent_]){this._whenTrueActivateChilds[parent_]=[]}this._whenTrueActivateChilds[parent_].push(setting)}};$(document).ready(function(){if(0==$(".wpbdp-page-admin-settings").length){return}s.init()})})(jQuery);(function($){var u=WPBDP_Admin.uninstall={init:function(){$('form#wpbdp-uninstall-capture-form input[name="uninstall[reason_id]"]').change(function(e){var val=$(this).val();if("0"==val){$('form#wpbdp-uninstall-capture-form textarea[name="uninstall[reason_text]"]').fadeIn()}else{$('form#wpbdp-uninstall-capture-form textarea[name="uninstall[reason_text]"]').fadeOut("fast",function(){$(this).val("")})}})}};$(document).ready(function(){if($(".wpbdp-page-admin-uninstall").length>0){u.init()}})})(jQuery);(function($){$(document).ready(function(){if($("body.wp-admin.widgets-php").length==0){return}$("body.wp-admin.widgets-php").on("change","input.wpbdp-toggle-images",function(){var checked=$(this).is(":checked");if(checked){$(this).parents(".widget").find(".thumbnail-width-config, .thumbnail-height-config").fadeIn("fast")}else{$(this).parents(".widget").find(".thumbnail-width-config, .thumbnail-height-config").fadeOut("fast")}})})})(jQuery);(function($){$(document).ready(function(){$("a.wpbdp-create-main-page-button").click(function(e){e.preventDefault();var $msg=$(this).parents("div.error");$.ajax({url:ajaxurl,data:{action:"wpbdp-create-main-page",_wpnonce:$(this).attr("data-nonce")},dataType:"json",success:function(res){if(!res.success){return}$msg.fadeOut("fast",function(){$(this).html("<p>"+res.message+"</p>");$(this).removeClass("error");$(this).addClass("updated");$(this).fadeIn("fast")})}})})})})(jQuery);(function($){var l=WPBDP_Admin.licensing={init:function(){$("input.license-activate").click(function(){var module=$(this).parent(".license-activation").attr("data-module-id");var license=$('input[type="text"]#license-key-'+module).val();l.activation_change(module,license,"activate")});$("input.license-deactivate").click(function(){var module=$(this).parent(".license-activation").attr("data-module-id");var license=$('input[type="text"]#license-key-'+module);l.activation_change(module,"","deactivate")})},activation_change:function(module,license,action){var $container=$('.license-activation[data-module-id="'+module+'"]');var $msg=$(".status-message",$container);var nonce=$('input[name="nonce"]',$container).val();$msg.removeClass("ok error");$msg.html($("input.license-"+action,$container).attr("data-L10n"));$.post(ajaxurl,{action:"wpbdp-"+action+"-license",module:module,key:license,nonce:nonce},function(res){if(res.success){$msg.hide().html(res.message).removeClass("error").addClass("ok").show();$("input.license-"+action,$container).hide();$('input[type="button"]',$container).not(".license-"+action).show();if("activate"==action){$('input[type="text"]#license-key-'+module).attr("readonly","readonly")}else{$('input[type="text"]#license-key-'+module).removeAttr("readonly")}}else{$msg.hide().html(res.error).removeClass("ok").addClass("error").show();if("deactivate"==action){$('input[type="text"]#license-key-'+module).removeAttr("readonly")}}},"json")}};$(document).ready(function(){if($("input.license-activate, input.license-deactivate").length>0){l.init()}if($(".wpbdp-license-expired-warning").length>0){$(".wpbdp-license-expired-warning .dismiss").click(function(e){e.preventDefault();var module_id=$(this).attr("data-module");var nonce=$(this).attr("data-nonce");var $warning=$(this).parents(".wpbdp-license-expired-warning");$.post(ajaxurl,{action:"wpbdp-license-expired-warning-dismiss",nonce:nonce,module:module_id},function(res){if(res.success){$warning.fadeOut("fast")}},"json")})}})})(jQuery);(function($){$(function(){$(".wpbdp-notice.dismissible > .notice-dismiss").click(function(e){e.preventDefault();var $notice=$(this).parent(".wpbdp-notice");var dismissible_id=$(this).data("dismissible-id");var nonce=$(this).data("nonce");$.post(ajaxurl,{action:"wpbdp_dismiss_notification",id:dismissible_id,nonce:nonce},function(){$notice.fadeOut("fast",function(){$notice.remove()})})})})})(jQuery);
1
+ var WPBDP_associations_fieldtypes={};(function($){var WPBDPAdmin_FormFields={$f_association:null,$f_fieldtype:null,init:function(){WPBDPAdmin_FormFields.$f_association=$("form#wpbdp-formfield-form select#field-association");WPBDPAdmin_FormFields.$f_association.change(WPBDPAdmin_FormFields.onAssociationChange);WPBDPAdmin_FormFields.$f_fieldtype=$("form#wpbdp-formfield-form select#field-type");WPBDPAdmin_FormFields.$f_fieldtype.change(WPBDPAdmin_FormFields.onFieldTypeChange);$("#wpbdp-fieldsettings .iframe-confirm a").click(function(e){e.preventDefault();if($(this).hasClass("yes")){$(this).parents(".iframe-confirm").hide()}else{$('#wpbdp-fieldsettings input[name="field[allow_iframes]"]').removeAttr("checked");$(this).parents(".iframe-confirm").hide()}});$('#wpbdp-fieldsettings input[name="field[allow_iframes]"]').change(function(){if($(this).is(":checked")){$(".iframe-confirm").show()}else{$(".iframe-confirm").hide()}});$("table.formfields tbody").sortable({placeholder:"wpbdp-draggable-highlight",handle:".wpbdp-drag-handle",axis:"y",cursor:"move",opacity:0.9,update:function(event,ui){var sorted_items=[];$(this).find(".wpbdp-drag-handle").each(function(i,v){sorted_items.push($(v).attr("data-field-id"))});if(sorted_items){$.post(ajaxurl,{action:"wpbdp-formfields-reorder",order:sorted_items})}}})},onFieldTypeChange:function(){var $field_type=$(this).find("option:selected");if(!$field_type.length){return}var field_type=$field_type.val();if("url"==field_type){$("select#field-validator option").not('[value="url"]').attr("disabled","disabled").removeAttr("selected");$('select#field-validator option[value="url"]').attr("selected","selected")}else{$("select#field-validator option").removeAttr("disabled")}var request_data={action:"wpbdp-renderfieldsettings",association:WPBDPAdmin_FormFields.$f_association.find("option:selected").val(),field_type:field_type,field_id:$('#wpbdp-formfield-form input[name="field[id]"]').val()};$.post(ajaxurl,request_data,function(response){if(response.ok&&response.html){$("#wpbdp-fieldsettings-html").html(response.html);$("#wpbdp-fieldsettings").show()}else{$("#wpbdp-fieldsettings-html").empty();$("#wpbdp-fieldsettings").hide()}},"json")},onAssociationChange:function(){$f_fieldtype=WPBDPAdmin_FormFields.$f_fieldtype;var association=$(this).find("option:selected").val();var valid_types=WPBDP_associations_fieldtypes[association];$f_fieldtype.find("option").removeAttr("disabled");$f_fieldtype.find("option").each(function(i,v){if($.inArray($(v).val(),valid_types)<0){$(v).attr("disabled","disabled")}});if($f_fieldtype.find("option:selected").attr("disabled")=="disabled"){$f_fieldtype.find("option").removeAttr("selected");$f_fieldtype.find('option[value="'+valid_types[0]+'"]').attr("selected","selected")}}};$(document).ready(function(){WPBDPAdmin_FormFields.init()})})(jQuery);jQuery(document).ready(function($){$('form#wpbdp-fee-form input[name="_days"]').change(function(){var value=$(this).val();if(value==0){$("form input#wpbdp-fee-form-days-n").attr("disabled",true);$('form input[name="fee[days]"]').val("0")}else{$("form input#wpbdp-fee-form-days-n").removeAttr("disabled");$('form input[name="fee[days]"]').val($("form input#wpbdp-fee-form-days-n").val());$("form input#wpbdp-fee-form-days-n").focus()}return true});$(".wpbdp-page-admin-fees .wp-list-table.fees tbody").sortable({placeholder:"wpbdp-draggable-highlight",handle:".wpbdp-drag-handle",axis:"y",cursor:"move",opacity:0.9,update:function(event,ui){var rel_rows=$(".free-fee-related-tr").remove();$("tr.free-fee").after(rel_rows);var sorted_items=[];$(this).find(".wpbdp-drag-handle").each(function(i,v){sorted_items.push($(v).attr("data-fee-id"))});if(sorted_items){$.post(ajaxurl,{action:"wpbdp-admin-fees-reorder",order:sorted_items})}}});$("form#wpbdp-fee-form").submit(function(){$('form input[name="fee[days]"]').removeAttr("disabled");return true});$('select[name="fee_order[method]"], select[name="fee_order[order]"]').change(function(e){$.ajax({url:ajaxurl,data:$(this).parent("form").serialize(),dataType:"json",type:"POST",success:function(res){if(res.success){location.reload()}}})});if("custom"==$('select[name="fee_order[method]"]').val()){$(".wpbdp-page-admin-fees .wp-list-table .wpbdp-drag-handle").show()}$("#BusinessDirectory_listinginfo .listing-metabox-tabs a").click(function(e){e.preventDefault();var href=$(this).attr("href");var $selected=$(this).parent("li").siblings(".selected");if($selected.length>0){if($selected.find("a:first").attr("href")==href){return}else{$selected.removeClass("selected");$($selected.find("a:first").attr("href")).hide()}}$(this).parent("li").addClass("selected");$(href).show();$(".listing-fee-expiration-datepicker").hide()});var url_tab=$(location).attr("hash");if(url_tab&&$(url_tab).length>0){$('#BusinessDirectory_listinginfo a[href="'+url_tab+'"]').click()}else{$("#BusinessDirectory_listinginfo .listing-metabox-tabs li.selected a").click()}$("#listing-metabox-fees a.assignfee-link").click(function(e){e.preventDefault();$(this).siblings(".assignfee").show()});$("#listing-metabox-fees .assignfee .close-handle").click(function(e){e.preventDefault();$(this).parent(".assignfee").hide()});$(".wpbdp-ajax-placeholder").each(function(i,v){wpbdp_load_placeholder($(v))});$("input#doaction, input#doaction2").click(function(e){var action_name=("doaction"==$(this).attr("id"))?"action":"action2";var $selected_option=$('select[name="'+action_name+'"] option:selected');var action_val=$selected_option.val();if(action_val.split("-")[0]=="listing"){var action=action_val.split("-")[1];if(action!="sep0"&&action!="sep1"&&action!="sep2"){var $checked_posts=$('input[name="post[]"]:checked');var uri=$selected_option.attr("data-uri");$checked_posts.each(function(i,v){uri+="&post[]="+$(v).val()});window.location.href=uri;return false}}return true});$('.wpbdp-admin.wpbdp-page-formfields-preview form input[type="submit"]').click(function(e){e.preventDefault();alert("This form is just a preview. It doesn't work.")});$("#wpbdp-admin-debug-info-page a.nav-tab").click(function(e){e.preventDefault();$("#wpbdp-admin-debug-info-page a.nav-tab").not(this).removeClass("nav-tab-active");var $selected_tab=$(this);$selected_tab.addClass("nav-tab-active");$(".wpbdp-debug-section").hide();$('.wpbdp-debug-section[data-id="'+$(this).attr("href")+'"]').show()});if($("#wpbdp-admin-debug-info-page a.nav-tab").length>0){$("#wpbdp-admin-debug-info-page a.nav-tab").get(0).click()}$(".wpbdp-page-admin-transactions .column-actions a.details-link").click(function(e){e.preventDefault();var $tr=$(this).parents("tr");var $details=$tr.find("div.more-details");var $tr_details=$tr.next("tr.more-details-row");if($tr_details.length>0){$tr_details.remove();$(this).text($(this).text().replace("-","+"));return}else{$(this).text($(this).text().replace("+","-"))}$tr.after('<tr class="more-details-row"><td colspan="7">'+$details.html()+"</td></tr>").show()})});function wpbdp_load_placeholder($v){var action=$v.attr("data-action");var post_id=$v.attr("data-post_id");var baseurl=$v.attr("data-baseurl");$v.load(ajaxurl,{action:action,post_id:post_id,baseurl:baseurl})}var WPBDP_Admin={};WPBDP_Admin.payments={};WPBDP_Admin.listingMetabox={};WPBDP_Admin.ProgressBar=function($item,settings){$item.empty();$item.html('<div class="wpbdp-progress-bar"><span class="progress-text">0%</span><div class="progress-bar"><div class="progress-bar-outer"><div class="progress-bar-inner" style="width: 0%;"></div></div></div>');this.$item=$item;this.$text=$item.find(".progress-text");this.$bar=$item.find(".progress-bar");this.set=function(completed,total){var pcg=Math.round(100*parseInt(completed)/parseInt(total));this.$text.text(pcg+"%");this.$bar.find(".progress-bar-inner").attr("style","width: "+pcg+"%;")}};(function($){WPBDP_Admin.dialog={};var dialog=WPBDP_Admin.dialog})(jQuery);(function($){var payments=WPBDP_Admin.payments;payments._initialize=function(){$("#BusinessDirectory_listinginfo a.payment-details-link").click(function(e){e.preventDefault();payments.viewPaymentDetails($(this).attr("data-id"))});if($("#wpbdp-modal-dialog").length==0){$("body").append($('<div id="wpbdp-modal-dialog"></div>'))}};payments.viewPaymentDetails=function(id){$.get(ajaxurl,{action:"wpbdp-payment-details",id:id},function(res){if(res&&res.success){if($("#wpbdp-modal-dialog").length==0){$("body").append($('<div id="wpbdp-modal-dialog"></div>'))}$("#wpbdp-modal-dialog").html(res.data.html);tb_show("","#TB_inline?inlineId=wpbdp-modal-dialog");$("#TB_window").width($("#TB_ajaxContent").outerWidth());if($("#TB_window").height()>$("#TB_ajaxContent").outerHeight()){$("#TB_ajaxContent").height($("#TB_window").height())}$("#wpbdp-modal-dialog").remove()}},"json")};$(document).ready(function(){payments._initialize()})})(jQuery);(function($){var metabox=WPBDP_Admin.listingMetabox;metabox._initialize=function(){$.extend($.datepicker,{_inlineDatepicker2:$.datepicker._inlineDatepicker,_inlineDatepicker:function(target,inst){this._inlineDatepicker2(target,inst);var beforeShow=$.datepicker._get(inst,"beforeShow");if(beforeShow){beforeShow.apply(target,[target,inst])}}});var _addNeverButton=function(instance){setTimeout(function(){var $buttonPane=$(instance).find(".ui-datepicker-buttonpane");if($buttonPane.find(".ui-datepicker-never").length>0){return}var $button=$("<button>",{text:"Never Expires",click:function(){_updateExpiration($(instance),"never");return false}}).addClass("ui-datepicker-never ui-state-default ui-priority-primary ui-corner-all");$buttonPane.append($button)},1)};var _updateExpiration=function($instance,newDate){if(!newDate){return}var $changeLink=$instance.siblings("a.expiration-change-link");var $expirationDate=$instance.siblings(".expiration-date");var $spinner=$instance.parents(".listing-category").find(".spinner:first");$expirationDate.text("--");$spinner.show();$instance.hide();_addNeverButton($instance.get(0));$.post(ajaxurl,{action:"wpbdp-listing_set_expiration",renewal_id:$changeLink.attr("data-renewal_id"),expiration_date:newDate},function(res){if(res&&res.success){$spinner.hide();$expirationDate.text(res.data.formattedExpirationDate).show()}},"json")};$("#listing-metabox-generalinfo, #listing-metabox-fees").each(function(i,v){var $tab=$(v);$tab.find(".expiration-date-info .datepicker").each(function(i,v){var $dp=$(v);var $changeLink=$dp.siblings("a.expiration-change-link");$dp.hide().datepicker({dateFormat:"yy-mm-dd",defaultDate:$changeLink.attr("data-date"),showButtonPanel:true,beforeShow:function(input){_addNeverButton(input)},onChangeMonthYear:function(year,month,instance){_addNeverButton(instance.input)},onSelect:function(newDate){_updateExpiration($(this),newDate)}})});$tab.find("a.expiration-change-link").click(function(e){e.preventDefault();var renewal_id=$(this).attr("data-renewal_id");$(".expiration-date-info .datepicker").not(".renewal-"+renewal_id).hide();$(".expiration-date-info .datepicker.renewal-"+renewal_id).toggle()})});$(".listing-category a.category-delete").click(function(e){e.preventDefault();var listingID=$(this).attr("data-listing");var categoryID=$(this).attr("data-category");if(!listingID||!categoryID){return}var $category=$(".listing-category-"+categoryID);$.post(ajaxurl,{action:"wpbdp-listing_remove_category",listing:listingID,category:categoryID},function(res){if(res&&res.success){$('input[name="tax_input[wpbdp_category][]"][value="'+categoryID+'"]').attr("checked",false);$category.fadeOut(function(){$(this).remove()})}},"json")});$(".listing-category a.category-change-fee").click(function(e){e.preventDefault();if($("#wpbdp-modal-dialog").length==0){$("body").append($('<div id="wpbdp-modal-dialog"></div>'))}$.post(ajaxurl,{action:"wpbdp-listing_change_fee",renewal:$(this).attr("data-renewal")},function(res){if(res&&res.success){$("#wpbdp-modal-dialog").html(res.data.html);tb_show("","#TB_inline?inlineId=wpbdp-modal-dialog");$("#wpbdp-modal-dialog").remove()}},"json")})};$(document).ready(function(){if($("#listing-metabox-fees").length>0){metabox._initialize()}})})(jQuery);(function($){var s=WPBDP_Admin.settings={_whenTrueActivateChilds:{},init:function(){var t=this;$(".wpbdp-settings-email").each(function(i,v){var $email=$(v);var $preview=$email.find(".short-preview");var $editor=$email.find(".editor");var $subject=$editor.find(".subject-text");var $body=$editor.find(".body-text");var data={subject:"",body:""};$preview.click(function(e){data.subject=$subject.val();data.body=$body.val();$preview.hide();$editor.show()});$(".cancel",$editor).click(function(e){e.preventDefault();$subject.val(data.subject);$body.val(data.body);$editor.hide();$preview.show()});$(".save",$editor).click(function(e){e.preventDefault();$("form#wpbdp-admin-settings #submit").click()});$(".preview-email",$editor).click(function(e){e.preventDefault();var subject=$subject.val();var body=$body.val();$.ajax({url:ajaxurl,data:{action:"wpbdp-admin-settings-email-preview",nonce:$editor.attr("data-preview-nonce"),setting:$email.attr("data-setting"),subject:subject,body:body},dataType:"json",type:"POST",success:function(res){if(!res.success){return}if(0==$("#wpbdp-modal-dialog").length){$("body").append('<div id="wpbdp-modal-dialog" style="display: none;"></div>')}$("#wpbdp-modal-dialog").html(res.data.html);tb_show("","#TB_inline?inlineId=wpbdp-modal-dialog");$("#wpbdp-modal-dialog").remove()}})})});$("select#quick-search-fields").change(function(){var selected=$(this).find("option.textfield:selected").length;if(selected>0){$("span.text-fields-warning").fadeIn("fast")}else{$("span.text-fields-warning").fadeOut("fast")}});$.each(this._whenTrueActivateChilds,function(p,chs){$('input[name="wpbdp-'+p+'"]').change(function(e){t.handleToggle(p)});t.handleToggle(p)})},handleToggle:function(setting){var childs=this._whenTrueActivateChilds[setting];if("undefined"===typeof(childs)){return}var checked=$('input[name="wpbdp-'+setting+'"]').is(":checked");$.each(this._whenTrueActivateChilds[setting],function(i,c){var $c=$('[name="wpbdp-'+c+'"], [name="wpbdp-'+c+'[]"]');var $row=$c.parents("tr");if(checked){$c.removeAttr("contenteditable");$row.removeClass("disabled")}else{$c.attr("contenteditable","false");$row.addClass("disabled")}})},add_requirement:function(setting,parent_,req){if("undefined"===typeof this._whenTrueActivateChilds[parent_]){this._whenTrueActivateChilds[parent_]=[]}this._whenTrueActivateChilds[parent_].push(setting)}};$(document).ready(function(){if(0==$(".wpbdp-page-admin-settings").length){return}s.init()})})(jQuery);(function($){var u=WPBDP_Admin.uninstall={init:function(){$('form#wpbdp-uninstall-capture-form input[name="uninstall[reason_id]"]').change(function(e){var val=$(this).val();if("0"==val){$('form#wpbdp-uninstall-capture-form textarea[name="uninstall[reason_text]"]').fadeIn()}else{$('form#wpbdp-uninstall-capture-form textarea[name="uninstall[reason_text]"]').fadeOut("fast",function(){$(this).val("")})}})}};$(document).ready(function(){if($(".wpbdp-page-admin-uninstall").length>0){u.init()}})})(jQuery);(function($){$(document).ready(function(){if($("body.wp-admin.widgets-php").length==0){return}$("body.wp-admin.widgets-php").on("change","input.wpbdp-toggle-images",function(){var checked=$(this).is(":checked");if(checked){$(this).parents(".widget").find(".thumbnail-width-config, .thumbnail-height-config").fadeIn("fast")}else{$(this).parents(".widget").find(".thumbnail-width-config, .thumbnail-height-config").fadeOut("fast")}})})})(jQuery);(function($){$(document).ready(function(){$("a.wpbdp-create-main-page-button").click(function(e){e.preventDefault();var $msg=$(this).parents("div.error");$.ajax({url:ajaxurl,data:{action:"wpbdp-create-main-page",_wpnonce:$(this).attr("data-nonce")},dataType:"json",success:function(res){if(!res.success){return}$msg.fadeOut("fast",function(){$(this).html("<p>"+res.message+"</p>");$(this).removeClass("error");$(this).addClass("updated");$(this).fadeIn("fast")})}})})})})(jQuery);(function($){var l=WPBDP_Admin.licensing={init:function(){$("input.license-activate").click(function(){var module=$(this).parent(".license-activation").attr("data-module-id");var license=$('input[type="text"]#license-key-'+module).val();l.activation_change(module,license,"activate")});$("input.license-deactivate").click(function(){var module=$(this).parent(".license-activation").attr("data-module-id");var license=$('input[type="text"]#license-key-'+module);l.activation_change(module,"","deactivate")})},activation_change:function(module,license,action){var $container=$('.license-activation[data-module-id="'+module+'"]');var $msg=$(".status-message",$container);var nonce=$('input[name="nonce"]',$container).val();$msg.removeClass("ok error");$msg.html($("input.license-"+action,$container).attr("data-L10n"));$.post(ajaxurl,{action:"wpbdp-"+action+"-license",module:module,key:license,nonce:nonce},function(res){if(res.success){$msg.hide().html(res.message).removeClass("error").addClass("ok").show();$("input.license-"+action,$container).hide();$('input[type="button"]',$container).not(".license-"+action).show();if("activate"==action){$('input[type="text"]#license-key-'+module).attr("readonly","readonly")}else{$('input[type="text"]#license-key-'+module).removeAttr("readonly")}}else{$msg.hide().html(res.error).removeClass("ok").addClass("error").show();if("deactivate"==action){$('input[type="text"]#license-key-'+module).removeAttr("readonly")}}},"json")}};$(document).ready(function(){if($("input.license-activate, input.license-deactivate").length>0){l.init()}if($(".wpbdp-license-expired-warning").length>0){$(".wpbdp-license-expired-warning .dismiss").click(function(e){e.preventDefault();var module_id=$(this).attr("data-module");var nonce=$(this).attr("data-nonce");var $warning=$(this).parents(".wpbdp-license-expired-warning");$.post(ajaxurl,{action:"wpbdp-license-expired-warning-dismiss",nonce:nonce,module:module_id},function(res){if(res.success){$warning.fadeOut("fast")}},"json")})}})})(jQuery);(function($){$(function(){$(".wpbdp-notice.dismissible > .notice-dismiss").click(function(e){e.preventDefault();var $notice=$(this).parent(".wpbdp-notice");var dismissible_id=$(this).data("dismissible-id");var nonce=$(this).data("nonce");$.post(ajaxurl,{action:"wpbdp_dismiss_notification",id:dismissible_id,nonce:nonce},function(){$notice.fadeOut("fast",function(){$notice.remove()})})})})})(jQuery);
admin/templates/csv-import.tpl.php CHANGED
@@ -188,18 +188,24 @@ echo str_replace(
188
  value="1" <?php echo _defaults_or( $defaults, 'assign-listings-to-user', 1 ) ? 'checked="checked"' : ''; ?> /> <?php _ex('Assign listings to a user.', 'admin csv-import', 'WPBDM'); ?></label>
189
  </td>
190
  </tr>
 
 
 
 
 
 
 
 
 
 
 
191
  <tr class="form-required default-user-selection">
192
  <th scope="row">
193
  <label> <?php _ex('Default listing user', 'admin csv-import', 'WPBDM'); ?></label>
194
  </th>
195
  <td>
196
  <label>
197
- <select name="settings[default-user]" class="default-user">
198
- <option value="0"><?php _ex('Use spreadsheet information only.', 'admin csv-import', 'WPBDM'); ?></option>
199
- <?php foreach (get_users('orderby=display_name') as $user): ?>
200
- <option value="<?php echo $user->ID; ?>" <?php echo ( _defaults_or( $defaults, 'default-user', '' ) == $user->ID ) ? 'selected="selected"' : ''; ?> ><?php echo $user->display_name; ?> (<?php echo $user->user_login; ?>)</option>
201
- <?php endforeach; ?>
202
- </select>
203
  </label>
204
  <span class="description"><?php _ex('This user will be used if the username column is not present in the CSV file.', 'admin csv-import', 'WPBDM'); ?></span>
205
  </td>
188
  value="1" <?php echo _defaults_or( $defaults, 'assign-listings-to-user', 1 ) ? 'checked="checked"' : ''; ?> /> <?php _ex('Assign listings to a user.', 'admin csv-import', 'WPBDM'); ?></label>
189
  </td>
190
  </tr>
191
+ <tr class="form-required default-user-selection">
192
+ <th scope="row">
193
+ <label> <?php _ex( 'Use a default user for listings?', 'admin csv-import', 'WPBDM' ); ?></label>
194
+ </th>
195
+ <td>
196
+ <label><input
197
+ type="checkbox"
198
+ class="use-default-listing-user"
199
+ value="1" <?php echo _defaults_or( $defaults, 'default-user', '' ) ? 'checked="checked"' : ''; ?> /> <?php _ex( 'Select a default user to be used if the username column is not present in the CSV file.', 'admin csv-import', 'WPBDM' ); ?></label>
200
+ </td>
201
+ </tr>
202
  <tr class="form-required default-user-selection">
203
  <th scope="row">
204
  <label> <?php _ex('Default listing user', 'admin csv-import', 'WPBDM'); ?></label>
205
  </th>
206
  <td>
207
  <label>
208
+ <?php echo wpbdp_render_user_field( array( 'class' => 'default-user', 'name' => 'settings[default-user]', 'value' => _defaults_or( $defaults, 'default-user', '' ) ) ); ?>
 
 
 
 
 
209
  </label>
210
  <span class="description"><?php _ex('This user will be used if the username column is not present in the CSV file.', 'admin csv-import', 'WPBDM'); ?></span>
211
  </td>
business-directory-plugin.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Business Directory Plugin
4
  * Plugin URI: http://www.businessdirectoryplugin.com
5
  * Description: Provides the ability to maintain a free or paid business directory on your WordPress powered site.
6
- * Version: 4.0.4
7
  * Author: D. Rodenbaugh
8
  * Author URI: http://businessdirectoryplugin.com
9
  * Text Domain: WPBDM
@@ -31,7 +31,7 @@
31
  if( preg_match( '#' . basename( __FILE__ ) . '#', $_SERVER['PHP_SELF'] ) )
32
  exit();
33
 
34
- define( 'WPBDP_VERSION', '4.0.4' );
35
 
36
  define( 'WPBDP_PATH', plugin_dir_path( __FILE__ ) );
37
  define( 'WPBDP_URL', trailingslashit( plugins_url( '/', __FILE__ ) ) );
@@ -463,6 +463,24 @@ class WPBDP_Plugin {
463
  // }
464
  //
465
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
466
  // Handle login URL for some views.
467
  if ( in_array( wpbdp_current_view(), array( 'edit_listing', 'submit_listing', 'delete_listing', 'renew_listing' ), true )
468
  && wpbdp_get_option( 'require-login' )
@@ -1344,9 +1362,6 @@ class WPBDP_Plugin {
1344
 
1345
  // {{ Sorting options.
1346
  public function sortbar_sort_options( $options ) {
1347
- if ( ! wpbdp_get_option( 'listings-sortbar-enabled' ) )
1348
- return $options;
1349
-
1350
  $sortbar_fields = $this->settings->sortbar_fields_cb();
1351
  $sortbar = wpbdp_get_option( 'listings-sortbar-fields' );
1352
 
3
  * Plugin Name: Business Directory Plugin
4
  * Plugin URI: http://www.businessdirectoryplugin.com
5
  * Description: Provides the ability to maintain a free or paid business directory on your WordPress powered site.
6
+ * Version: 4.0.5
7
  * Author: D. Rodenbaugh
8
  * Author URI: http://businessdirectoryplugin.com
9
  * Text Domain: WPBDM
31
  if( preg_match( '#' . basename( __FILE__ ) . '#', $_SERVER['PHP_SELF'] ) )
32
  exit();
33
 
34
+ define( 'WPBDP_VERSION', '4.0.5' );
35
 
36
  define( 'WPBDP_PATH', plugin_dir_path( __FILE__ ) );
37
  define( 'WPBDP_URL', trailingslashit( plugins_url( '/', __FILE__ ) ) );
463
  // }
464
  //
465
 
466
+ // Redirect some old views.
467
+ if ( 'main' == wpbdp_current_view() && ! empty( $_GET['action'] ) ) {
468
+ switch ( $_GET['action'] ) {
469
+ case 'submitlisting':
470
+ $newview = 'submit_listing';
471
+ break;
472
+ case 'search':
473
+ $newview = 'search';
474
+ break;
475
+ default:
476
+ $newview = '';
477
+ break;
478
+ }
479
+
480
+ wp_redirect( add_query_arg( 'wpbdp_view', $newview, remove_query_arg( 'action' ) ) );
481
+ exit();
482
+ }
483
+
484
  // Handle login URL for some views.
485
  if ( in_array( wpbdp_current_view(), array( 'edit_listing', 'submit_listing', 'delete_listing', 'renew_listing' ), true )
486
  && wpbdp_get_option( 'require-login' )
1362
 
1363
  // {{ Sorting options.
1364
  public function sortbar_sort_options( $options ) {
 
 
 
1365
  $sortbar_fields = $this->settings->sortbar_fields_cb();
1366
  $sortbar = wpbdp_get_option( 'listings-sortbar-fields' );
1367
 
core/class-csv-import.php CHANGED
@@ -96,10 +96,7 @@ class WPBDP_CSV_Import {
96
  break;
97
  }
98
 
99
- $line = $file->current();
100
-
101
- // Some code to circumvent limitations in str_getcsv() while PHP #46569 is fixed.
102
- $line = str_replace( '\n', "\n", $line );
103
 
104
  // We can't use fgetcsv() directly due to https://bugs.php.net/bug.php?id=46569.
105
  $line_data = str_getcsv( $line, $this->settings['csv-file-separator'] );
@@ -140,6 +137,25 @@ class WPBDP_CSV_Import {
140
  $this->state_persist();
141
  }
142
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  public function get_import_id() {
144
  return $this->state_id;
145
  }
96
  break;
97
  }
98
 
99
+ $line = $this->get_current_line( $file );
 
 
 
100
 
101
  // We can't use fgetcsv() directly due to https://bugs.php.net/bug.php?id=46569.
102
  $line_data = str_getcsv( $line, $this->settings['csv-file-separator'] );
137
  $this->state_persist();
138
  }
139
 
140
+ private function get_current_line( $file ) {
141
+ $line = $file->current();
142
+
143
+ if ( empty( $line ) ) {
144
+ return '';
145
+ }
146
+
147
+ $encoding = wpbdp_detect_encoding( $line );
148
+
149
+ if ( 'UTF-8' != $encoding ) {
150
+ $converted_line = iconv( $encoding, 'UTF-8', $line );
151
+ } else {
152
+ $converted_line = $line;
153
+ }
154
+
155
+ // Some code to circumvent limitations in str_getcsv() while PHP #46569 is fixed.
156
+ return str_replace( '\n', "\n", $converted_line );
157
+ }
158
+
159
  public function get_import_id() {
160
  return $this->state_id;
161
  }
core/class-query-integration.php CHANGED
@@ -39,12 +39,14 @@ class WPBDP__Query_Integration {
39
  }
40
 
41
  // Is this a category query?
42
- if ( ! empty( $query->query_vars[ WPBDP_CATEGORY_TAX ] ) ) {
 
43
  $query->wpbdp_is_category = true;
44
  $query->wpbdp_view = 'show_category';
45
  }
46
 
47
- if ( ! empty( $query->query_vars[ WPBDP_TAGS_TAX ] ) ) {
 
48
  $query->wpbdp_is_tag = true;
49
  $query->wpbdp_view = 'show_tag';
50
  }
39
  }
40
 
41
  // Is this a category query?
42
+ $category_slug = wpbdp_get_option( 'permalinks-category-slug' );
43
+ if ( ! empty( $query->query_vars[ WPBDP_CATEGORY_TAX ] ) || ! empty( $query->query_vars[ "_{$category_slug}" ] ) ) {
44
  $query->wpbdp_is_category = true;
45
  $query->wpbdp_view = 'show_category';
46
  }
47
 
48
+ $tags_slug = wpbdp_get_option( 'permalinks-tags-slug' );
49
+ if ( ! empty( $query->query_vars[ WPBDP_TAGS_TAX ] ) || ! empty( $query->query_vars[ "_{$tags_slug}" ] ) ) {
50
  $query->wpbdp_is_tag = true;
51
  $query->wpbdp_view = 'show_tag';
52
  }
core/class-settings.php CHANGED
@@ -1057,23 +1057,21 @@ EOF;
1057
  size="25"
1058
  ' . ( 'valid' == $license_status ? 'readonly="readonly"' : '' ) . '/>';
1059
 
1060
- if ( $value ) {
1061
- $html .= '<span class="license-activation" data-module-id="' . esc_attr( $module_id ) . '">';
1062
- $html .= wp_nonce_field( 'license activation', 'nonce', false, false );
1063
- $html .= '<input type="button"
1064
- value="' . _x( 'Deactivate License', 'settings', 'WPBDM' ) . '"
1065
- class="button-secondary license-deactivate"
1066
- data-L10n="' . esc_attr( _x( 'Deactivating license...', 'settings', 'WPBDM' ) ) . '"
1067
- style="' . ( 'valid' == $license_status ? '' : 'display: none;' ) . '" />';
1068
- $html .= '<input type="button"
1069
- value="' . _x( 'Activate License', 'settings', 'WPBDM' ) . '"
1070
- class="button-secondary license-activate"
1071
- data-L10n="' . esc_attr( _x( 'Activating license...', 'settings', 'WPBDM' ) ) . '"
1072
- style="' . ( 'valid' == $license_status ? 'display: none;' : '' ) . '" />';
1073
- $html .= '<br />';
1074
- $html .= '<span class="status-message"></span>';
1075
- $html .= '</span>';
1076
- }
1077
 
1078
  echo apply_filters( 'wpbdp_settings_render', $html, $setting, $args );
1079
  }
1057
  size="25"
1058
  ' . ( 'valid' == $license_status ? 'readonly="readonly"' : '' ) . '/>';
1059
 
1060
+ $html .= '<span class="license-activation" data-module-id="' . esc_attr( $module_id ) . '">';
1061
+ $html .= wp_nonce_field( 'license activation', 'nonce', false, false );
1062
+ $html .= '<input type="button"
1063
+ value="' . _x( 'Deactivate License', 'settings', 'WPBDM' ) . '"
1064
+ class="button-secondary license-deactivate"
1065
+ data-L10n="' . esc_attr( _x( 'Deactivating license...', 'settings', 'WPBDM' ) ) . '"
1066
+ style="' . ( 'valid' == $license_status ? '' : 'display: none;' ) . '" />';
1067
+ $html .= '<input type="button"
1068
+ value="' . _x( 'Activate License', 'settings', 'WPBDM' ) . '"
1069
+ class="button-secondary license-activate"
1070
+ data-L10n="' . esc_attr( _x( 'Activating license...', 'settings', 'WPBDM' ) ) . '"
1071
+ style="' . ( 'valid' == $license_status ? 'display: none;' : '' ) . '" />';
1072
+ $html .= '<br />';
1073
+ $html .= '<span class="status-message"></span>';
1074
+ $html .= '</span>';
 
 
1075
 
1076
  echo apply_filters( 'wpbdp_settings_render', $html, $setting, $args );
1077
  }
core/class-shortcodes.php CHANGED
@@ -108,7 +108,7 @@ class WPBDP__Shortcodes {
108
  $args['author'] = $u->ID;
109
  }
110
 
111
- $v = new WPBDP__Views__All_Listings( array( 'include_buttons' => false, 'query_args' => $args ) );
112
  return $v->dispatch();
113
  }
114
 
@@ -142,7 +142,7 @@ class WPBDP__Shortcodes {
142
  'terms' => $categories ) )
143
  );
144
 
145
- $v = new WPBDP__Views__All_Listings( array( 'include_buttons' => false, 'query_args' => $args ) );
146
  return $v->dispatch();
147
  } elseif ( $atts['tag'] || $atts['tags'] ) {
148
  $requested_tags = array();
@@ -156,11 +156,11 @@ class WPBDP__Shortcodes {
156
  $args = array( 'items_per_page' => $atts['items_per_page'],
157
  'tax_query' => array(
158
  array( 'taxonomy' => WPBDP_TAGS_TAX,
159
- 'field' => 'id',
160
  'terms' => $requested_tags ) )
161
  );
162
 
163
- $v = new WPBDP__Views__All_Listings( array( 'include_buttons' => false, 'query_args' => $args ) );
164
  return $v->dispatch();
165
  }
166
 
108
  $args['author'] = $u->ID;
109
  }
110
 
111
+ $v = new WPBDP__Views__All_Listings( array( 'include_buttons' => true, 'query_args' => $args ) );
112
  return $v->dispatch();
113
  }
114
 
142
  'terms' => $categories ) )
143
  );
144
 
145
+ $v = new WPBDP__Views__All_Listings( array( 'include_buttons' => true, 'query_args' => $args ) );
146
  return $v->dispatch();
147
  } elseif ( $atts['tag'] || $atts['tags'] ) {
148
  $requested_tags = array();
156
  $args = array( 'items_per_page' => $atts['items_per_page'],
157
  'tax_query' => array(
158
  array( 'taxonomy' => WPBDP_TAGS_TAX,
159
+ 'field' => 'slug',
160
  'terms' => $requested_tags ) )
161
  );
162
 
163
+ $v = new WPBDP__Views__All_Listings( array( 'include_buttons' => true, 'query_args' => $args ) );
164
  return $v->dispatch();
165
  }
166
 
core/class-wordpress-template-integration.php CHANGED
@@ -36,12 +36,30 @@ class WPBDP__WordPress_Template_Integration {
36
  add_filter( 'wp_title', array( $this, 'modify_global_post_title' ), 1000 );
37
  add_action( 'loop_start', array( $this, 'setup_post_hooks' ) );
38
 
39
- if ( $page_template = locate_template( array( 'page.php', 'single.php', 'singular.php' ) ) )
40
  $template = $page_template;
41
 
42
  return $template;
43
  }
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  public function setup_post_hooks( $query ) {
46
  if ( ! $this->wp_head_done )
47
  return;
@@ -51,6 +69,8 @@ class WPBDP__WordPress_Template_Integration {
51
 
52
  add_action( 'the_post', array( $this, 'spoof_post' ) );
53
  remove_filter( 'the_content', 'wpautop' );
 
 
54
  add_filter( 'the_content', array( $this, 'display_view_in_content' ), 5 );
55
  remove_action( 'loop_start', array( $this, 'setup_post_hooks' ) );
56
  }
36
  add_filter( 'wp_title', array( $this, 'modify_global_post_title' ), 1000 );
37
  add_action( 'loop_start', array( $this, 'setup_post_hooks' ) );
38
 
39
+ if ( $page_template = locate_template( $this->get_template_alternatives() ) )
40
  $template = $page_template;
41
 
42
  return $template;
43
  }
44
 
45
+ private function get_template_alternatives() {
46
+ $templates = array( 'page.php', 'single.php', 'singular.php' );
47
+
48
+ $main_page_id = wpbdp_get_page_id( 'main' );
49
+
50
+ if ( ! $main_page_id ) {
51
+ return $templates;
52
+ }
53
+
54
+ $main_page_template = get_page_template_slug( $main_page_id );
55
+
56
+ if ( $main_page_template ) {
57
+ array_unshift( $templates, $main_page_template );
58
+ }
59
+
60
+ return $templates;
61
+ }
62
+
63
  public function setup_post_hooks( $query ) {
64
  if ( ! $this->wp_head_done )
65
  return;
69
 
70
  add_action( 'the_post', array( $this, 'spoof_post' ) );
71
  remove_filter( 'the_content', 'wpautop' );
72
+ // TODO: we should probably be more clever here to avoid conflicts. Run last so other hooks don't break our
73
+ // output.
74
  add_filter( 'the_content', array( $this, 'display_view_in_content' ), 5 );
75
  remove_action( 'loop_start', array( $this, 'setup_post_hooks' ) );
76
  }
core/compatibility/class-cpt-compat-mode.php CHANGED
@@ -59,7 +59,7 @@ class WPBDP__CPT_Compat_Mode {
59
  $this->data['wp_query'] = $wp_query;
60
 
61
  $args = array( WPBDP_CATEGORY_TAX => get_query_var( '_' . wpbdp_get_option( 'permalinks-category-slug' ) ) );
62
- $wp_query = new WP_Query( $args );
63
 
64
  break;
65
 
@@ -67,7 +67,7 @@ class WPBDP__CPT_Compat_Mode {
67
  $this->data['wp_query'] = $wp_query;
68
 
69
  $args = array( WPBDP_TAGS_TAX => get_query_var( '_' . wpbdp_get_option( 'permalinks-tags-slug' ) ) );
70
- $wp_query = new WP_Query( $args );
71
 
72
  break;
73
  }
@@ -75,6 +75,16 @@ class WPBDP__CPT_Compat_Mode {
75
  // wpbdp_debug_e( $wp_query, $this->current_view );
76
  }
77
 
 
 
 
 
 
 
 
 
 
 
78
  public function after_dispatch() {
79
  global $wp_query;
80
 
59
  $this->data['wp_query'] = $wp_query;
60
 
61
  $args = array( WPBDP_CATEGORY_TAX => get_query_var( '_' . wpbdp_get_option( 'permalinks-category-slug' ) ) );
62
+ $wp_query = $this->get_archive_query( $args );
63
 
64
  break;
65
 
67
  $this->data['wp_query'] = $wp_query;
68
 
69
  $args = array( WPBDP_TAGS_TAX => get_query_var( '_' . wpbdp_get_option( 'permalinks-tags-slug' ) ) );
70
+ $wp_query = $this->get_archive_query( $args );
71
 
72
  break;
73
  }
75
  // wpbdp_debug_e( $wp_query, $this->current_view );
76
  }
77
 
78
+ private function get_archive_query( $args ) {
79
+ $args = wp_parse_args( $args, array(
80
+ 'posts_per_page' => get_query_var( 'posts_per_page' ),
81
+ 'order' => get_query_var( 'order' ),
82
+ 'orderby' => get_query_var( 'orderby' ),
83
+ ) );
84
+
85
+ return new WP_Query( $args );
86
+ }
87
+
88
  public function after_dispatch() {
89
  global $wp_query;
90
 
core/compatibility/class-themes-compat.php CHANGED
@@ -13,11 +13,11 @@ class WPBDP__Themes_Compat {
13
 
14
  $current_theme = wp_get_theme();
15
 
16
- $this->theme = $current_theme->get_stylesheet();
17
  $this->theme_version = $current_theme->get( 'Version' );
18
 
19
  if ( $parent = $current_theme->parent() ) {
20
- $this->parent_theme = $parent->get_stylesheet();
21
  $this->parent_theme_version = $parent->get( 'Version' );
22
  }
23
 
@@ -50,7 +50,10 @@ class WPBDP__Themes_Compat {
50
  }
51
 
52
  public function get_themes_with_fixes() {
53
- $themes_with_fixes = array( 'genesis', 'hmtpro5', 'customizr', 'customizr-pro' );
 
 
 
54
  return apply_filters( 'wpbdp_themes_with_fixes_list', $themes_with_fixes );
55
  }
56
 
@@ -59,14 +62,18 @@ class WPBDP__Themes_Compat {
59
  //
60
 
61
  public function theme_genesis() {
62
- if ( ! in_array( wpbdp_current_view(), array( 'show_listing', 'show_category', 'show_tag' ), true ) )
63
  return;
64
 
65
  // Workaround taken from https://theeventscalendar.com/knowledgebase/genesis-theme-framework-integration/.
66
  remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
67
  remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
68
  remove_action( 'genesis_after_entry', 'genesis_do_author_box_single', 8 );
 
 
 
69
  add_action( 'genesis_entry_content', 'the_content', 15 );
 
70
  }
71
 
72
  public function theme_hmtpro5() {
@@ -76,6 +83,12 @@ class WPBDP__Themes_Compat {
76
  add_action( 'wp_head', array( $this, 'theme_hmtpro5_after_head' ), 999 );
77
  }
78
 
 
 
 
 
 
 
79
  public function theme_hmtpro5_after_head() {
80
  global $wp_query;
81
 
@@ -86,19 +99,147 @@ class WPBDP__Themes_Compat {
86
  add_filter( 'tc_show_single_post_content', '__return_false', 999 );
87
  add_filter( 'tc_show_single_post_footer', '__return_false', 999 );
88
 
89
- if ( ! in_array( wpbdp_current_view(), array( 'show_category', 'show_tag' ), true ) )
 
 
 
 
 
 
 
90
  return;
91
 
92
  add_filter( 'tc_is_grid_enabled', '__return_false', 999 );
93
  add_filter( 'tc_show_excerpt', '__return_false', 999 );
94
  add_filter( 'tc_post_list_controller', '__return_true', 999 );
95
  add_filter( 'tc_show_tax_archive_title', '__return_false', 999 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  }
97
 
98
  public function theme_customizr_pro() {
99
  return $this->theme_customizr();
100
  }
101
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  //
103
  // }}
104
  //
13
 
14
  $current_theme = wp_get_theme();
15
 
16
+ $this->theme = strtolower( $current_theme->get_stylesheet() );
17
  $this->theme_version = $current_theme->get( 'Version' );
18
 
19
  if ( $parent = $current_theme->parent() ) {
20
+ $this->parent_theme = strtolower( $parent->get_stylesheet() );
21
  $this->parent_theme_version = $parent->get( 'Version' );
22
  }
23
 
50
  }
51
 
52
  public function get_themes_with_fixes() {
53
+ $themes_with_fixes = array(
54
+ 'atahualpa', 'genesis', 'hmtpro5', 'customizr', 'customizr-pro', 'canvas', 'builder', 'Divi', 'longevity'
55
+ );
56
+
57
  return apply_filters( 'wpbdp_themes_with_fixes_list', $themes_with_fixes );
58
  }
59
 
62
  //
63
 
64
  public function theme_genesis() {
65
+ if ( ! in_array( wpbdp_current_view(), array( 'all_listings', 'show_listing', 'show_category', 'show_tag' ), true ) )
66
  return;
67
 
68
  // Workaround taken from https://theeventscalendar.com/knowledgebase/genesis-theme-framework-integration/.
69
  remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
70
  remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
71
  remove_action( 'genesis_after_entry', 'genesis_do_author_box_single', 8 );
72
+ remove_action( 'genesis_post_content', 'genesis_do_post_image', 10 );
73
+ remove_action( 'genesis_post_content', 'genesis_do_post_content', 10 );
74
+ remove_action( 'genesis_after_post', 'genesis_do_author_box_single', 10 );
75
  add_action( 'genesis_entry_content', 'the_content', 15 );
76
+ add_action( 'genesis_post_content', 'the_content', 15 );
77
  }
78
 
79
  public function theme_hmtpro5() {
83
  add_action( 'wp_head', array( $this, 'theme_hmtpro5_after_head' ), 999 );
84
  }
85
 
86
+ public function theme_atahualpa() {
87
+ global $wp_query;
88
+
89
+ $wp_query->is_page = true;
90
+ }
91
+
92
  public function theme_hmtpro5_after_head() {
93
  global $wp_query;
94
 
99
  add_filter( 'tc_show_single_post_content', '__return_false', 999 );
100
  add_filter( 'tc_show_single_post_footer', '__return_false', 999 );
101
 
102
+ $current_view = wpbdp_current_view();
103
+
104
+ if ( $current_view == 'show_listing' ) {
105
+ $this->theme_customizr_hide_post_thumb();
106
+ $this->theme_customizr_disable_comments();
107
+ }
108
+
109
+ if ( ! in_array( $current_view, array( 'show_category', 'show_tag' ), true ) )
110
  return;
111
 
112
  add_filter( 'tc_is_grid_enabled', '__return_false', 999 );
113
  add_filter( 'tc_show_excerpt', '__return_false', 999 );
114
  add_filter( 'tc_post_list_controller', '__return_true', 999 );
115
  add_filter( 'tc_show_tax_archive_title', '__return_false', 999 );
116
+ add_filter( 'tc_show_breadcrumb_in_context', array( $this, 'theme_customizr_show_breadcrumb_in_context' ), 999 );
117
+ }
118
+
119
+ /**
120
+ * The code that setups the filter that this function attempts to remove,
121
+ * is attached to 'wp' hook, so it gets executed before any of the workarounds
122
+ * has a chance to do anything.
123
+ *
124
+ * Also, the filter is dynamically configured, so we need to duplicate the
125
+ * configuartion logic here, in order to figure out what filter to remove.
126
+ *
127
+ * @since 4.0.5dev
128
+ */
129
+ private function theme_customizr_hide_post_thumb() {
130
+ if ( ! class_exists( 'TC_post' ) ) {
131
+ return;
132
+ }
133
+
134
+ $post_thumb_location = $this->theme_customizr_get_option( 'tc_single_post_thumb_location' );
135
+
136
+ if ( $post_thumb_location == 'hide' ) {
137
+ return;
138
+ }
139
+
140
+ $location_parts = explode( '|', $post_thumb_location );
141
+ $hook = isset( $location_parts[0] ) ? $location_parts[0] : '__before_content';
142
+ $priority = isset( $location_parts[1] ) ? $location_parts[1] : 200;
143
+
144
+ remove_filter( $hook, array( TC_post::$instance, 'tc_single_post_prepare_thumb' ), $priority );
145
+ }
146
+
147
+ private function theme_customizr_get_option( $option_name ) {
148
+ if ( ! class_exists( 'TC_utils' ) ) {
149
+ return null;
150
+ }
151
+
152
+ if ( ! is_object( TC_utils::$inst ) || ! method_exists( TC_utils::$inst, 'tc_opt' ) ) {
153
+ return null;
154
+ }
155
+
156
+ return TC_utils::$inst->tc_opt( $option_name );
157
+ }
158
+
159
+ private function theme_customizr_disable_comments() {
160
+ if ( ! class_exists( 'TC_comments' ) ) {
161
+ return;
162
+ }
163
+
164
+ remove_action( '__after_loop', array( TC_comments::$instance , 'tc_comments' ), 10 );
165
+ }
166
+
167
+ public function theme_customizr_show_breadcrumb_in_context() {
168
+ return $this->theme_customizr_get_option( 'tc_show_breadcrumb_in_pages' );
169
  }
170
 
171
  public function theme_customizr_pro() {
172
  return $this->theme_customizr();
173
  }
174
 
175
+ public function theme_canvas() {
176
+ add_filter( 'woo_template_parts', array( $this, 'theme_canvas_set_template' ) );
177
+ add_filter( 'the_excerpt', array( $this, 'theme_canvas_the_excerpt' ), 999 );
178
+ }
179
+
180
+ public function theme_canvas_set_template( $templates ) {
181
+ $templates = array();
182
+ $templates[] = 'content-page.php';
183
+
184
+ return $templates;
185
+ }
186
+
187
+ public function theme_canvas_the_excerpt( $excerpt ) {
188
+ remove_filter( 'the_excerpt', array( $this, 'theme_canvas_the_excerpt' ) );
189
+
190
+ return wpbdp_current_view_output();
191
+ }
192
+
193
+ public function theme_divi() {
194
+ if ( ! in_array( wpbdp_current_view(), array( 'show_category', 'show_tag' ) ) ) {
195
+ return;
196
+ }
197
+
198
+ if ( 'et_full_width_page' != get_post_meta( wpbdp_get_page_id( 'main' ), '_et_pb_page_layout', true ) ) {
199
+ return;
200
+ }
201
+
202
+ add_filter( 'body_class', array( $this, 'theme_divi_add_full_with_page_body_class' ) );
203
+ add_filter( 'is_active_sidebar', array( $this, 'theme_divi_disable_sidebar' ), 999, 2 );
204
+ }
205
+
206
+ public function theme_divi_add_full_with_page_body_class( $classes ) {
207
+ $classes[] = 'et_full_width_page';
208
+ return $classes;
209
+ }
210
+
211
+ public function theme_divi_disable_sidebar( $is_active_sidebar, $index ) {
212
+ return $index == 'sidebar-1' ? false : $is_active_sidebar;
213
+ }
214
+
215
+ public function theme_longevity() {
216
+ if ( ! in_array( wpbdp_current_view(), array( 'show_category', 'show_tag' ) ) ) {
217
+ return;
218
+ }
219
+
220
+ add_filter( 'theme_mod_excerpt_content', array( $this, 'theme_longevity_excerpt_content_mod' ), 999 );
221
+ }
222
+
223
+ public function theme_longevity_excerpt_content_mod( $value ) {
224
+ return 'content';
225
+ }
226
+
227
+ public function theme_builder() {
228
+ global $wp_filter;
229
+
230
+ //builder_get_current_layout_id
231
+
232
+ // remove_all_actions( 'builder_layout_engine_render_content' );
233
+
234
+ //remove_action( 'builder_layout_engine_render_content', 'render_content' );
235
+ // add_filter( 'builder_get_current_layout_id', array( $this, 'theme_builder_change_layout' ), 999 );
236
+ // add_filter( 'builder_filter_current_layout', array( $this, 'theme_builder_change_layout' ), 999 );
237
+ }
238
+
239
+ public function theme_builder_change_layout( $layout_id = '' ) {
240
+ wpbdp_debug_e( $layout_id );
241
+ }
242
+
243
  //
244
  // }}
245
  //
core/css/wpbdp.css CHANGED
@@ -287,6 +287,12 @@ form#wpbdmsearchform a.advanced-search-link {
287
  padding: 5px 10px;
288
  }
289
 
 
 
 
 
 
 
290
  .wpbdp-bar .wpbdp-main-links {
291
  float: left;
292
  }
@@ -848,6 +854,19 @@ body.business-directory #TB_secondLine {
848
  display: none;
849
  }
850
 
 
 
 
 
 
 
 
 
 
 
 
 
 
851
  /*
852
  * }}
853
  */
287
  padding: 5px 10px;
288
  }
289
 
290
+ .wpbdp-bar:before, .wpbdp-bar:after {
291
+ content: " ";
292
+ display: table;
293
+ clear: both;
294
+ }
295
+
296
  .wpbdp-bar .wpbdp-main-links {
297
  float: left;
298
  }
854
  display: none;
855
  }
856
 
857
+ .wpbdp-wp-theme-atahualpa.wpbdp-view-show_category .post-footer,
858
+ .wpbdp-wp-theme-atahualpa.wpbdp-view-show_tag .post-footer,
859
+ .wpbdp-wp-theme-atahualpa.wpbdp-view-show_listing .post-footer
860
+ {
861
+ display: none;
862
+ }
863
+
864
+ .wpbdp-wp-theme-ultimate-silostorm-pro.wpbdp-view-show_category .entry-content .featured-image,
865
+ .wpbdp-wp-theme-ultimate-silostorm-pro.wpbdp-view-show_tag .entry-content .featured-image,
866
+ .wpbdp-wp-theme-ultimate-silostorm-pro.wpbdp-view-show_listing .entry-content .featured-image {
867
+ display: none;
868
+ }
869
+
870
  /*
871
  * }}
872
  */
core/css/wpbdp.min.css CHANGED
@@ -1 +1 @@
1
- form#wpbdmsearchform{padding:12px 0;text-align:center}form#wpbdmsearchform input{display:inline}form#wpbdmsearchform .wpbdmsearchbutton{margin-top:5px}form#wpbdmsearchform a.advanced-search-link{font-size:70%;display:block}#wpbdp-search-form{padding-left:10px}#wpbdp-search-form .wpbdp-search-filter{margin-bottom:10px;clear:both}#wpbdp-search-form .wpbdp-search-filter>.wpbdp-search-field-label{display:block;width:40%;float:left}#wpbdp-search-form .wpbdp-search-filter>div.field{display:block;width:60%;margin-left:40%;padding-left:5px}#wpbdp-search-form .wpbdp-search-filter>div.field>input[type="text"]{width:90%}#wpbdp-search-form .wpbdp-search-filter>div.field>select{width:90%}#wpbdp-search-form input[type="submit"]{width:100px;float:none;margin:auto}.cf:before,.cf:after{content:" ";display:table}.cf:after{clear:both}.cf{*zoom:1}.wpbdp-pagination{margin:25px 0 0 0}.wpbdp-pagination .next{float:right}.listing-actions form{margin:0;padding:0;display:inline}.listing-actions input{margin:0}.listing-actions input.delete-listing{margin-left:5px;margin-right:30px;color:#f00 !important}.listing-actions a.button{padding:5px 10px;font-size:11px;text-decoration:none;background-color:#e6e6e6;color:#7c7c7c;background-repeat:repeat-x;background-image:-moz-linear-gradient(top,#f4f4f4,#e6e6e6);background-image:-ms-linear-gradient(top,#f4f4f4,#e6e6e6);background-image:-webkit-linear-gradient(top,#f4f4f4,#e6e6e6);background-image:-o-linear-gradient(top,#f4f4f4,#e6e6e6);background-image:linear-gradient(top,#f4f4f4,#e6e6e6);border:1px solid #d2d2d2;border-radius:3px;box-shadow:0 1px 2px rgba(64,64,64,0.1);margin-right:3px}.listing-actions a.button:hover{color:#5e5e5e;background-color:#ebebeb;background-repeat:repeat-x;background-image:-moz-linear-gradient(top,#f9f9f9,#ebebeb);background-image:-ms-linear-gradient(top,#f9f9f9,#ebebeb);background-image:-webkit-linear-gradient(top,#f9f9f9,#ebebeb);background-image:-o-linear-gradient(top,#f9f9f9,#ebebeb);background-image:linear-gradient(top,#f9f9f9,#ebebeb)}.listing-actions a.delete-listing{margin-left:20px;color:red}.wpbdp-listing .listing-details .field-value{margin-bottom:10px;width:100%;float:none}.wpbdmsingledetails .singledetailsview .field-value{margin-bottom:10px}.field-value label{color:#444;font-weight:bold}.wpbdp-listing-excerpt{padding:10px;border-bottom:dotted 1px #ddd}.wpbdp-listing-excerpt.odd{background:#eee}.wpbdp-listing-excerpt.sticky{background:#fff0cf;border-bottom:solid 1px #b37800}.wpbdp-listing-excerpt .listing-thumbnail{float:right;margin:0 10px 0 0}.wpbdp-listing-excerpt .listing-actions{margin-top:15px}.wpbdp-listing-single .listing-actions{margin-bottom:25px}.wpbdp-listing-single .stickytag{float:right;margin-top:-68px}.wpbdp-listing-single .stickytag img{border:0;box-shadow:none;background:transparent}.wpbdp-listing-single .listing-title{padding:2px 8px;background:#efefef;border:dotted 1px #ddd;margin-bottom:7px}.wpbdp-listing-single .listing-title h2{clear:none;margin:0}.wpbdp-listing-single .main-image{float:right;margin-left:10px;padding:5px}.wpbdp-listing-single .main-image a{position:relative !important}.wpbdp-listing-single .main-image img{border:solid 1px #333}.wpbdp-listing-single .extra-images{margin-top:10px;clear:both}.wpbdp-listing-single .extra-images ul{margin:0 auto;width:100%}.wpbdp-listing-single .extra-images ul li{list-style-type:none;display:inline;margin-left:5px}.wpbdp-listing-single .extra-images ul li img{display:inline;vertical-align:top;margin:0 auto;max-width:150px;border:solid 1px #333}.wpbdp-listing .social-fields{margin:20px 0}.wpbdp-listing .social-field{margin:5px 0;height:20px;vertical-align:middle}.social-field.facebook .fb-like>span{overflow:visible !important;width:450px !important;vertical-align:top !important}@media screen and (max-width:500px){.social-field.facebook .fb-like>span{width:100% !important}}.wpbdp-listing-contact-form{margin-top:20px;border-top:dotted 1px #ddd;padding-top:20px;padding-left:10px}.wpbdp-listing-contact-form .send-message-button{margin-left:-10px}.wpbdp-listing-contact-form h3{margin-left:-10px}.wpbdp-listing-contact-form textarea{width:98% !important}.wpbdp-listing .comments{margin-top:20px}.wpbdp-bar{background:#f7f7f7;margin:10px 0 20px 0;padding:5px 10px}.wpbdp-bar .wpbdp-main-links{float:left}.wpbdp-bar .wpbdp-main-links #wpbdp-bar-view-listings-button,.wpbdp-bar .wpbdp-main-links #wpbdp-bar-show-directory-button{margin-right:5px}.wpbdp-bar .wpbdp-search-form{margin:0;padding:0 !important;margin-left:50%}.wpbdp-main-links a{margin-right:15px}.wpbdp-bar .left{float:left;text-align:center}.wpbdp-bar .right{width:300px;float:right}.wpbdp-listings-sort-options{font-size:90%;margin:5px 0;text-align:right}.wpbdp-listings-sort-options .current{font-weight:bold}.wpbdp-page-main_page #wpbdp-categories{clear:both;margin-bottom:20px}ul.wpbdp-categories{margin:0 0 10px 15px;padding:0 10px}ul.wpbdp-categories>li{width:50%;float:left;margin:0}@media screen and (max-width:704px){ul.wpbdp-categories>li{float:none;width:initial}}@media screen and (max-width:500px){ul.wpbdp-categories{font-size:90%}ul.wpbdp-categories ul.children li.cat-item{margin-left:10px;padding:0}}.wpbdp-submit-page h3{margin-bottom:10px}.wpbdp-submit-page .wpbdmp{margin:0}.wpbdp-submit-page legend{font-size:85%;margin-bottom:20px}.wpbdp-submit-page .wpbdp-form-field{margin-bottom:8px}.wpbdp-submit-page .wpbdp-form-field .wpbdmcheckboxclass checkbox{margin-left:0}.wpbdp-submit-page .wpbdp-form-field.required .wpbdp-form-field-label:after{content:' *';font-size:80%}.wpbdp-submit-page .wpbdp-form-field-type-textarea textarea{width:90%;min-height:50px}.wpbdp-submit-page .wpbdp-form-field-association-content textarea{min-height:80px}.wpbdp-form-field .field-description{font-size:90%;color:#696969;float:right}.wpbdp-form-field span.sublabel{font-size:90%;margin-left:10px;margin-right:10px}.wpbdp-form-field.image a.delete{margin-left:10px}ul.validation-errors{margin:15px 0 15px 0}ul.validation-errors li{color:red;margin:3px 0;list-style-position:inside}.wpbdp-submit-page.step-fees h4{background:#ddd;color:#333;padding:10px;margin-bottom:5px}.wpbdp-submit-page.step-images #image-upload-form{margin:15px 10px}.wpbdp-submit-page.step-images .wpbdp-image{float:left;border-bottom:dotted 1px #efefef;margin-right:10px;margin-bottom:10px;vertical-align:top}.wpbdp-submit-page.step-images .wpbdp-image img{vertical-align:top;text-align:center;max-width:150px;height:auto}.wpbdp-submit-page.step-images .wpbdp-image-draggable-highlight{width:160px;height:160px;margin:0 10px;background:red;float:left}.wpbdp-submit-page.step-images .area-and-conditions #image-upload-dnd-area{float:left;width:72%}.wpbdp-submit-page.step-images .area-and-conditions #image-upload-conditions{float:right;width:25%;color:#666}.wpbdp-submit-page.step-images .area-and-conditions #image-upload-conditions dl{margin:0}.wpbdp-submit-page.step-images #image-upload-form-no-js{width:0;height:0;overflow:hidden;visibility:hidden}.wpbdp-submit-page.step-images .wpbdp-image .delete-image{color:red}.wpbdp-submit-page .upgrade-to-featured-option{border:solid 1px #666;padding:5px 10px;margin:25px 0 25px 0;font-size:90%}.wpbdp-msg{font-size:85%;padding:.6em;border:solid 1px #e6db55;color:#555;margin:5px 0;background:#fffbcc;border-radius:3px}.wpbdp-msg.error{background-color:#ffebe8;border-color:#C00}.wpbdp-submit-page table.fee-options{width:100%}.wpbdp-submit-page table.fee-options th,.wpbdp-submit-page table.fee-options td{text-align:center}.wpbdp-submit-page table.fee-options .fee-selection{width:5%}.wpbdp-submit-page table.fee-options tr.fee-option td.fee-label{font-weight:bold}.wpbdp-submit-page table.fee-options td.fee-description{font-size:90%;color:#666}#wpbdp-renewal-page .do-not-renew-listing{margin:40px 0;border:solid 1px #eee;font-size:95%}#wpbdp-renewal-page .do-not-renew-listing .header{background:#bc0b0b;color:#fff;text-align:center;font-weight:bold;padding:2px 0}#wpbdp-renewal-page .do-not-renew-listing input[type="submit"]{color:#900000}.wpbdp-recaptcha-error{color:red}#wpbdp-delete-listing-page form.confirm-form{margin-top:30px}#wpbdp-delete-listing-page input.delete-listing-confirm{margin-left:20px;color:#c00}#googlewallet-buy img{border:0;box-shadow:none}.wpbdp-checkout input[type="image"]{padding:0;border:0;box-shadow:none;width:auto}table#wpbdp-manage-recurring th.listing-title,table#wpbdp-manage-recurring td.listing-title{min-width:200px}table#wpbdp-manage-recurring a.cancel-subscription{color:red}#wpbdp-manage-recurring-cancel dl dd{margin-left:10px}.wpbdp-cc-form{padding:0;width:90%}.wpbdp-cc-form h4{margin:0}.wpbdp-cc-field input{width:auto}.wpbdp-cc-field label{display:block;font-weight:bold;text-align:right;padding-right:10px}#wpbdp-billing-information .billing-info-section h4{margin-bottom:5px}#wpbdp-billing-information .billing-info-section table{margin:10px 0 0 20px}#wpbdp-billing-information .form-buttons{margin:15px 0}.wpbdp-show-on-mobile{display:none}@media screen and (max-width:500px){.wpbdp-show-on-mobile{display:inline !important}.wpbdp-hide-on-mobile{display:none}.wpbdp-bar .wpbdp-main-links{display:block;float:none;text-align:center}.wpbdp-bar .wpbdp-main-links #wpbdp-bar-submit-listing-button{margin-bottom:5px;display:inline-block}.wpbdp-bar .wpbdp-main-links #wpbdp-bar-view-listings-button{display:inline-block;float:left;margin-right:20px}.wpbdp-bar .wpbdp-main-links input[type="button"]{display:block;margin-bottom:2px}.wpbdp-bar form.wpbdp-search-form{display:block;margin-left:0;margin-top:10px}.wpbdp-bar form.wpbdp-search-form #intextbox{margin-bottom:5px;padding:4px}.wpbdp-bar form.wpbdp-search-form input[type="text"]{padding:4px 0;margin:0 0 2px 0}.wpbdp-listings-sort-options{font-size:90%}.wpbdp-listing.wpbdp-listing{font-size:90%}.wpbdp-listing.wpbdp-listing-excerpt .field-value>label{display:block}.wpbdp-listing.wpbdp-listing-excerpt .listing-thumbnail{padding:5px}.wpbdp-listing .listing-actions input{font-size:85%}.wpbdp-listing .listing-actions input.back-to-dir{float:right}.wpbdp-listing.wpbdp-listing-single .main-image{display:block;float:none;padding:0;margin:0 0 10px 0;text-align:center;max-width:90%}.wpbdp-listing.wpbdp-listing-single .field-value>label{display:block}.wpbdp-submit-page.step-images #image-upload-dnd-area{font-size:90%;float:none !important;width:100% !important}.wpbdp-submit-page.step-images .dnd-area-inside-error{margin-top:30px}.wpbdp-submit-page.step-images #image-upload-conditions{width:100% !important;float:none !important;font-size:90%}.wpbdp-submit-page.step-images #image-upload-conditions dl{margin:0;padding:0}.wpbdp-submit-page.step-images #image-upload-conditions dl dt{margin:0;margin-right:5px;padding:0;float:left}.wpbdp-submit-page.step-images #image-upload-conditions dl dd{margin:0;padding:0;display:block}.wpbdp-submit-page.step-images .wpbdp-image img{max-width:50%}.wpbdp-listings-sort-options.wpbdp-show-on-mobile{margin-bottom:10px}}body.business-directory #TB_ImageOff .screen-reader-text,body.business-directory #TB_closeWindowButton .screen-reader-text{visibility:hidden}body.business-directory #TB_next{float:right}body.business-directory #TB_prev{float:left}body.business-directory #TB_caption{float:none !important}body.business-directory #TB_closeWindow{padding:0;height:0}body.business-directory #TB_closeWindow .screen-reader-text{display:none}body.business-directory #TB_secondLine{text-align:center}.wpbdp-form-row label{display:block}.wpbdp-form-row.wpbdp-form-textfield input[type="text"]{width:400px}.single-wpbdp_listing header.entry-header,.wpbdp-view-show_category header.entry-header,.wpbdp-view-show_tag header.entry-header,.wpbdp-view-search header.entry-header,.wpbdp-view-submit_listing header.entry-header{display:none}.wpbdp-wp-theme-graphene.single-wpbdp_listing h1.post-title,.wpbdp-wp-theme-graphene.wpbdp-view-show_category h1.post-title,.wpbdp-wp-theme-graphene.wpbdp-view-show_tag h1.post-title,.wpbdp-wp-theme-graphene.wpbdp-view-search h1.post-title,.wpbdp-wp-theme-graphene.wpbdp-view-submit_listing h1.post-title{display:none}.wpbdp-wp-theme-genesis.wpbdp-view-show_category .archive-description,.wpbdp-wp-theme-genesis.wpbdp-view-show_tag .archive-description{display:none}.wpbdp-wp-theme-hmtpro5.wpbdp-view-show_category .post-details,.wpbdp-wp-theme-hmtpro5.wpbdp-view-show_tag .post-details{display:none}
1
+ form#wpbdmsearchform{padding:12px 0;text-align:center}form#wpbdmsearchform input{display:inline}form#wpbdmsearchform .wpbdmsearchbutton{margin-top:5px}form#wpbdmsearchform a.advanced-search-link{font-size:70%;display:block}#wpbdp-search-form{padding-left:10px}#wpbdp-search-form .wpbdp-search-filter{margin-bottom:10px;clear:both}#wpbdp-search-form .wpbdp-search-filter>.wpbdp-search-field-label{display:block;width:40%;float:left}#wpbdp-search-form .wpbdp-search-filter>div.field{display:block;width:60%;margin-left:40%;padding-left:5px}#wpbdp-search-form .wpbdp-search-filter>div.field>input[type="text"]{width:90%}#wpbdp-search-form .wpbdp-search-filter>div.field>select{width:90%}#wpbdp-search-form input[type="submit"]{width:100px;float:none;margin:auto}.cf:before,.cf:after{content:" ";display:table}.cf:after{clear:both}.cf{*zoom:1}.wpbdp-pagination{margin:25px 0 0 0}.wpbdp-pagination .next{float:right}.listing-actions form{margin:0;padding:0;display:inline}.listing-actions input{margin:0}.listing-actions input.delete-listing{margin-left:5px;margin-right:30px;color:#f00 !important}.listing-actions a.button{padding:5px 10px;font-size:11px;text-decoration:none;background-color:#e6e6e6;color:#7c7c7c;background-repeat:repeat-x;background-image:-moz-linear-gradient(top,#f4f4f4,#e6e6e6);background-image:-ms-linear-gradient(top,#f4f4f4,#e6e6e6);background-image:-webkit-linear-gradient(top,#f4f4f4,#e6e6e6);background-image:-o-linear-gradient(top,#f4f4f4,#e6e6e6);background-image:linear-gradient(top,#f4f4f4,#e6e6e6);border:1px solid #d2d2d2;border-radius:3px;box-shadow:0 1px 2px rgba(64,64,64,0.1);margin-right:3px}.listing-actions a.button:hover{color:#5e5e5e;background-color:#ebebeb;background-repeat:repeat-x;background-image:-moz-linear-gradient(top,#f9f9f9,#ebebeb);background-image:-ms-linear-gradient(top,#f9f9f9,#ebebeb);background-image:-webkit-linear-gradient(top,#f9f9f9,#ebebeb);background-image:-o-linear-gradient(top,#f9f9f9,#ebebeb);background-image:linear-gradient(top,#f9f9f9,#ebebeb)}.listing-actions a.delete-listing{margin-left:20px;color:red}.wpbdp-listing .listing-details .field-value{margin-bottom:10px;width:100%;float:none}.wpbdmsingledetails .singledetailsview .field-value{margin-bottom:10px}.field-value label{color:#444;font-weight:bold}.wpbdp-listing-excerpt{padding:10px;border-bottom:dotted 1px #ddd}.wpbdp-listing-excerpt.odd{background:#eee}.wpbdp-listing-excerpt.sticky{background:#fff0cf;border-bottom:solid 1px #b37800}.wpbdp-listing-excerpt .listing-thumbnail{float:right;margin:0 10px 0 0}.wpbdp-listing-excerpt .listing-actions{margin-top:15px}.wpbdp-listing-single .listing-actions{margin-bottom:25px}.wpbdp-listing-single .stickytag{float:right;margin-top:-68px}.wpbdp-listing-single .stickytag img{border:0;box-shadow:none;background:transparent}.wpbdp-listing-single .listing-title{padding:2px 8px;background:#efefef;border:dotted 1px #ddd;margin-bottom:7px}.wpbdp-listing-single .listing-title h2{clear:none;margin:0}.wpbdp-listing-single .main-image{float:right;margin-left:10px;padding:5px}.wpbdp-listing-single .main-image a{position:relative !important}.wpbdp-listing-single .main-image img{border:solid 1px #333}.wpbdp-listing-single .extra-images{margin-top:10px;clear:both}.wpbdp-listing-single .extra-images ul{margin:0 auto;width:100%}.wpbdp-listing-single .extra-images ul li{list-style-type:none;display:inline;margin-left:5px}.wpbdp-listing-single .extra-images ul li img{display:inline;vertical-align:top;margin:0 auto;max-width:150px;border:solid 1px #333}.wpbdp-listing .social-fields{margin:20px 0}.wpbdp-listing .social-field{margin:5px 0;height:20px;vertical-align:middle}.social-field.facebook .fb-like>span{overflow:visible !important;width:450px !important;vertical-align:top !important}@media screen and (max-width:500px){.social-field.facebook .fb-like>span{width:100% !important}}.wpbdp-listing-contact-form{margin-top:20px;border-top:dotted 1px #ddd;padding-top:20px;padding-left:10px}.wpbdp-listing-contact-form .send-message-button{margin-left:-10px}.wpbdp-listing-contact-form h3{margin-left:-10px}.wpbdp-listing-contact-form textarea{width:98% !important}.wpbdp-listing .comments{margin-top:20px}.wpbdp-bar{background:#f7f7f7;margin:10px 0 20px 0;padding:5px 10px}.wpbdp-bar:before,.wpbdp-bar:after{content:" ";display:table;clear:both}.wpbdp-bar .wpbdp-main-links{float:left}.wpbdp-bar .wpbdp-main-links #wpbdp-bar-view-listings-button,.wpbdp-bar .wpbdp-main-links #wpbdp-bar-show-directory-button{margin-right:5px}.wpbdp-bar .wpbdp-search-form{margin:0;padding:0 !important;margin-left:50%}.wpbdp-main-links a{margin-right:15px}.wpbdp-bar .left{float:left;text-align:center}.wpbdp-bar .right{width:300px;float:right}.wpbdp-listings-sort-options{font-size:90%;margin:5px 0;text-align:right}.wpbdp-listings-sort-options .current{font-weight:bold}.wpbdp-page-main_page #wpbdp-categories{clear:both;margin-bottom:20px}ul.wpbdp-categories{margin:0 0 10px 15px;padding:0 10px}ul.wpbdp-categories>li{width:50%;float:left;margin:0}@media screen and (max-width:704px){ul.wpbdp-categories>li{float:none;width:initial}}@media screen and (max-width:500px){ul.wpbdp-categories{font-size:90%}ul.wpbdp-categories ul.children li.cat-item{margin-left:10px;padding:0}}.wpbdp-submit-page h3{margin-bottom:10px}.wpbdp-submit-page .wpbdmp{margin:0}.wpbdp-submit-page legend{font-size:85%;margin-bottom:20px}.wpbdp-submit-page .wpbdp-form-field{margin-bottom:8px}.wpbdp-submit-page .wpbdp-form-field .wpbdmcheckboxclass checkbox{margin-left:0}.wpbdp-submit-page .wpbdp-form-field.required .wpbdp-form-field-label:after{content:' *';font-size:80%}.wpbdp-submit-page .wpbdp-form-field-type-textarea textarea{width:90%;min-height:50px}.wpbdp-submit-page .wpbdp-form-field-association-content textarea{min-height:80px}.wpbdp-form-field .field-description{font-size:90%;color:#696969;float:right}.wpbdp-form-field span.sublabel{font-size:90%;margin-left:10px;margin-right:10px}.wpbdp-form-field.image a.delete{margin-left:10px}ul.validation-errors{margin:15px 0 15px 0}ul.validation-errors li{color:red;margin:3px 0;list-style-position:inside}.wpbdp-submit-page.step-fees h4{background:#ddd;color:#333;padding:10px;margin-bottom:5px}.wpbdp-submit-page.step-images #image-upload-form{margin:15px 10px}.wpbdp-submit-page.step-images .wpbdp-image{float:left;border-bottom:dotted 1px #efefef;margin-right:10px;margin-bottom:10px;vertical-align:top}.wpbdp-submit-page.step-images .wpbdp-image img{vertical-align:top;text-align:center;max-width:150px;height:auto}.wpbdp-submit-page.step-images .wpbdp-image-draggable-highlight{width:160px;height:160px;margin:0 10px;background:red;float:left}.wpbdp-submit-page.step-images .area-and-conditions #image-upload-dnd-area{float:left;width:72%}.wpbdp-submit-page.step-images .area-and-conditions #image-upload-conditions{float:right;width:25%;color:#666}.wpbdp-submit-page.step-images .area-and-conditions #image-upload-conditions dl{margin:0}.wpbdp-submit-page.step-images #image-upload-form-no-js{width:0;height:0;overflow:hidden;visibility:hidden}.wpbdp-submit-page.step-images .wpbdp-image .delete-image{color:red}.wpbdp-submit-page .upgrade-to-featured-option{border:solid 1px #666;padding:5px 10px;margin:25px 0 25px 0;font-size:90%}.wpbdp-msg{font-size:85%;padding:.6em;border:solid 1px #e6db55;color:#555;margin:5px 0;background:#fffbcc;border-radius:3px}.wpbdp-msg.error{background-color:#ffebe8;border-color:#C00}.wpbdp-submit-page table.fee-options{width:100%}.wpbdp-submit-page table.fee-options th,.wpbdp-submit-page table.fee-options td{text-align:center}.wpbdp-submit-page table.fee-options .fee-selection{width:5%}.wpbdp-submit-page table.fee-options tr.fee-option td.fee-label{font-weight:bold}.wpbdp-submit-page table.fee-options td.fee-description{font-size:90%;color:#666}#wpbdp-renewal-page .do-not-renew-listing{margin:40px 0;border:solid 1px #eee;font-size:95%}#wpbdp-renewal-page .do-not-renew-listing .header{background:#bc0b0b;color:#fff;text-align:center;font-weight:bold;padding:2px 0}#wpbdp-renewal-page .do-not-renew-listing input[type="submit"]{color:#900000}.wpbdp-recaptcha-error{color:red}#wpbdp-delete-listing-page form.confirm-form{margin-top:30px}#wpbdp-delete-listing-page input.delete-listing-confirm{margin-left:20px;color:#c00}#googlewallet-buy img{border:0;box-shadow:none}.wpbdp-checkout input[type="image"]{padding:0;border:0;box-shadow:none;width:auto}table#wpbdp-manage-recurring th.listing-title,table#wpbdp-manage-recurring td.listing-title{min-width:200px}table#wpbdp-manage-recurring a.cancel-subscription{color:red}#wpbdp-manage-recurring-cancel dl dd{margin-left:10px}.wpbdp-cc-form{padding:0;width:90%}.wpbdp-cc-form h4{margin:0}.wpbdp-cc-field input{width:auto}.wpbdp-cc-field label{display:block;font-weight:bold;text-align:right;padding-right:10px}#wpbdp-billing-information .billing-info-section h4{margin-bottom:5px}#wpbdp-billing-information .billing-info-section table{margin:10px 0 0 20px}#wpbdp-billing-information .form-buttons{margin:15px 0}.wpbdp-show-on-mobile{display:none}@media screen and (max-width:500px){.wpbdp-show-on-mobile{display:inline !important}.wpbdp-hide-on-mobile{display:none}.wpbdp-bar .wpbdp-main-links{display:block;float:none;text-align:center}.wpbdp-bar .wpbdp-main-links #wpbdp-bar-submit-listing-button{margin-bottom:5px;display:inline-block}.wpbdp-bar .wpbdp-main-links #wpbdp-bar-view-listings-button{display:inline-block;float:left;margin-right:20px}.wpbdp-bar .wpbdp-main-links input[type="button"]{display:block;margin-bottom:2px}.wpbdp-bar form.wpbdp-search-form{display:block;margin-left:0;margin-top:10px}.wpbdp-bar form.wpbdp-search-form #intextbox{margin-bottom:5px;padding:4px}.wpbdp-bar form.wpbdp-search-form input[type="text"]{padding:4px 0;margin:0 0 2px 0}.wpbdp-listings-sort-options{font-size:90%}.wpbdp-listing.wpbdp-listing{font-size:90%}.wpbdp-listing.wpbdp-listing-excerpt .field-value>label{display:block}.wpbdp-listing.wpbdp-listing-excerpt .listing-thumbnail{padding:5px}.wpbdp-listing .listing-actions input{font-size:85%}.wpbdp-listing .listing-actions input.back-to-dir{float:right}.wpbdp-listing.wpbdp-listing-single .main-image{display:block;float:none;padding:0;margin:0 0 10px 0;text-align:center;max-width:90%}.wpbdp-listing.wpbdp-listing-single .field-value>label{display:block}.wpbdp-submit-page.step-images #image-upload-dnd-area{font-size:90%;float:none !important;width:100% !important}.wpbdp-submit-page.step-images .dnd-area-inside-error{margin-top:30px}.wpbdp-submit-page.step-images #image-upload-conditions{width:100% !important;float:none !important;font-size:90%}.wpbdp-submit-page.step-images #image-upload-conditions dl{margin:0;padding:0}.wpbdp-submit-page.step-images #image-upload-conditions dl dt{margin:0;margin-right:5px;padding:0;float:left}.wpbdp-submit-page.step-images #image-upload-conditions dl dd{margin:0;padding:0;display:block}.wpbdp-submit-page.step-images .wpbdp-image img{max-width:50%}.wpbdp-listings-sort-options.wpbdp-show-on-mobile{margin-bottom:10px}}body.business-directory #TB_ImageOff .screen-reader-text,body.business-directory #TB_closeWindowButton .screen-reader-text{visibility:hidden}body.business-directory #TB_next{float:right}body.business-directory #TB_prev{float:left}body.business-directory #TB_caption{float:none !important}body.business-directory #TB_closeWindow{padding:0;height:0}body.business-directory #TB_closeWindow .screen-reader-text{display:none}body.business-directory #TB_secondLine{text-align:center}.wpbdp-form-row label{display:block}.wpbdp-form-row.wpbdp-form-textfield input[type="text"]{width:400px}.single-wpbdp_listing header.entry-header,.wpbdp-view-show_category header.entry-header,.wpbdp-view-show_tag header.entry-header,.wpbdp-view-search header.entry-header,.wpbdp-view-submit_listing header.entry-header{display:none}.wpbdp-wp-theme-graphene.single-wpbdp_listing h1.post-title,.wpbdp-wp-theme-graphene.wpbdp-view-show_category h1.post-title,.wpbdp-wp-theme-graphene.wpbdp-view-show_tag h1.post-title,.wpbdp-wp-theme-graphene.wpbdp-view-search h1.post-title,.wpbdp-wp-theme-graphene.wpbdp-view-submit_listing h1.post-title{display:none}.wpbdp-wp-theme-genesis.wpbdp-view-show_category .archive-description,.wpbdp-wp-theme-genesis.wpbdp-view-show_tag .archive-description{display:none}.wpbdp-wp-theme-hmtpro5.wpbdp-view-show_category .post-details,.wpbdp-wp-theme-hmtpro5.wpbdp-view-show_tag .post-details{display:none}.wpbdp-wp-theme-atahualpa.wpbdp-view-show_category .post-footer,.wpbdp-wp-theme-atahualpa.wpbdp-view-show_tag .post-footer,.wpbdp-wp-theme-atahualpa.wpbdp-view-show_listing .post-footer{display:none}.wpbdp-wp-theme-ultimate-silostorm-pro.wpbdp-view-show_category .entry-content .featured-image,.wpbdp-wp-theme-ultimate-silostorm-pro.wpbdp-view-show_tag .entry-content .featured-image,.wpbdp-wp-theme-ultimate-silostorm-pro.wpbdp-view-show_listing .entry-content .featured-image{display:none}
core/licensing.php CHANGED
@@ -191,6 +191,9 @@ class WPBDP_Licensing {
191
  'name' => $name ? $name : $module_name,
192
  'version' => $version );
193
 
 
 
 
194
  // Keep modules sorted by name.
195
  uasort( $this->modules, array( &$this, 'sort_modules_by_name' ) );
196
  return in_array( $this->modules[ $module_name ]['license_status'], array( 'valid', 'expired' ), true );
191
  'name' => $name ? $name : $module_name,
192
  'version' => $version );
193
 
194
+ if ( ! $this->modules[ $module_name ]['license'] )
195
+ $this->modules[ $module_name ]['license_status'] = 'invalid';
196
+
197
  // Keep modules sorted by name.
198
  uasort( $this->modules, array( &$this, 'sort_modules_by_name' ) );
199
  return in_array( $this->modules[ $module_name ]['license_status'], array( 'valid', 'expired' ), true );
core/templates-ui.php CHANGED
@@ -240,8 +240,11 @@ function wpbdp_the_listing_excerpt() {
240
  }
241
 
242
  function wpbdp_listing_sort_options() {
243
- $sort_options = array();
244
- $sort_options = apply_filters('wpbdp_listing_sort_options', $sort_options);
 
 
 
245
 
246
  if (!$sort_options)
247
  return apply_filters( 'wpbdp_listing_sort_options_html', '' );
240
  }
241
 
242
  function wpbdp_listing_sort_options() {
243
+ if ( wpbdp_get_option( 'listings-sortbar-enabled' ) ) {
244
+ $sort_options = apply_filters( 'wpbdp_listing_sort_options', array() );
245
+ } else {
246
+ $sort_options = array();
247
+ }
248
 
249
  if (!$sort_options)
250
  return apply_filters( 'wpbdp_listing_sort_options_html', '' );
core/templates/page.tpl.php CHANGED
@@ -1,5 +1,8 @@
 
 
 
1
  <div id="wpbdp-page-<?php echo $_child->_id; ?>" class="wpbdp-page wpbdp-page-<?php echo $_child->_id; ?> <?php echo $_class; ?>">
2
- <?php if ( ! isset( $_bar ) || $_bar ): ?><?php echo wpbdp_x_render( 'bar' ); ?><?php endif; ?>
3
 
4
  <?php
5
  // TODO: Try to use blocks for this too, instead of actions.
1
+ <?php
2
+ $show_bar = ( isset( $_child->_bar ) ? $_child->_bar : ( isset( $_bar ) ? $_bar : true ) );
3
+ ?>
4
  <div id="wpbdp-page-<?php echo $_child->_id; ?>" class="wpbdp-page wpbdp-page-<?php echo $_child->_id; ?> <?php echo $_class; ?>">
5
+ <?php if ( $show_bar ): ?><?php echo wpbdp_x_render( 'bar' ); ?><?php endif; ?>
6
 
7
  <?php
8
  // TODO: Try to use blocks for this too, instead of actions.
core/utils.php CHANGED
@@ -617,3 +617,77 @@ if ( ! function_exists( 'str_getcsv' ) ) {
617
  return $res;
618
  }
619
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
617
  return $res;
618
  }
619
  }
620
+
621
+ /**
622
+ * @since 4.0.5dev
623
+ */
624
+ function wpbdp_detect_encoding( $content ) {
625
+ static $encodings = array(
626
+ 'UTF-8', 'ASCII',
627
+ 'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4', 'ISO-8859-5',
628
+ 'ISO-8859-6', 'ISO-8859-7', 'ISO-8859-8', 'ISO-8859-9', 'ISO-8859-10',
629
+ 'ISO-8859-13', 'ISO-8859-14', 'ISO-8859-15', 'ISO-8859-16',
630
+ 'Windows-1251', 'Windows-1252', 'Windows-1254',
631
+ );
632
+
633
+ if ( function_exists( 'mb_detect_encoding' ) ) {
634
+ return mb_detect_encoding( $content, $encodings, true );
635
+ } else {
636
+ return wpbdp_mb_detect_encoding( $content, $encodings );
637
+ }
638
+ }
639
+
640
+ /**
641
+ * Taken from http://php.net/manual/en/function.mb-detect-encoding.php#113983
642
+ * @since 4.0.5dev
643
+ */
644
+ function wpbdp_mb_detect_encoding( $content, $encodings ) {
645
+ foreach ( $encodings as $encoding ) {
646
+ $sample = iconv( $encoding, $encoding, $string );
647
+ if ( md5( $sample ) == md5( $string ) ) {
648
+ return $encoding;
649
+ }
650
+ }
651
+
652
+ return false;
653
+ }
654
+
655
+ function wpbdp_render_user_field( $args = array() ) {
656
+ $args = wp_parse_args( $args, array(
657
+ 'class' => '',
658
+ 'name' => 'user',
659
+ 'value' => null,
660
+ ) );
661
+
662
+ $users_query = new WP_User_Query( array( 'count_total' => true, 'fields' => 'ID', 'number' => 200 ) );
663
+
664
+ if ( $users_query->get_total() <= 200 ) {
665
+ $output = '<select class="' . esc_attr( $args['class'] ) . '" name="' . esc_attr( $args['name'] ) . '">';
666
+
667
+ foreach ( get_users( 'orderby=display_name' ) as $user ) {
668
+ $selected = $args['value'] == $user->ID ? ' selected="selected"' : '';
669
+
670
+ $output .= '<option value="' . $user->ID . '"' . $selected . '>';
671
+ $output .= "{$user->display_name} ({$user->user_login})";
672
+ $output .= '</option>';
673
+ }
674
+
675
+ $output .= '</select>';
676
+ } else {
677
+ if ( $args['value'] ) {
678
+ $user = get_user_by( 'ID', $args['value'] );
679
+ $text_value = "{$user->display_name} ({$user->user_login})";
680
+ $hidden_value = $user->ID;
681
+ } else {
682
+ $text_value = '';
683
+ $hidden_value = 0;
684
+ }
685
+
686
+ $hidden_field_id = 'autocomplete-value-' . uniqid();
687
+
688
+ $output = '<input class="wpbdp-user-autocomplete ' . esc_attr( $args['class'] ) . '" type="text" value="' . esc_attr( $text_value ) . '" data-hidden-field="' . $hidden_field_id . '" />';
689
+ $output.= '<input id="' . $hidden_field_id . '" name="' . esc_attr( $args['name'] ) . '" type="hidden" value="' . esc_attr( $hidden_value ) . '">';
690
+ }
691
+
692
+ return $output;
693
+ }
core/views/all_listings.php CHANGED
@@ -35,11 +35,12 @@ class WPBDP__Views__All_Listings extends WPBDP_NView {
35
  $q = new WP_Query( $args );
36
  wpbdp_push_query( $q );
37
 
38
- // TODO: review use of wpbdp_before_viewlistings_page, wpbdp_after_viewlistings_page.
39
- $html = wpbdp_x_render( 'listings', array( '_id' => $this->include_buttons ? 'all_listings' : 'listings',
40
- '_wrapper' => $this->include_buttons ? 'page' : '',
41
- '_bar' => $this->include_buttons ? true : false,
42
- 'query' => $q ) );
 
43
  wp_reset_postdata();
44
  wpbdp_pop_query( $q );
45
 
35
  $q = new WP_Query( $args );
36
  wpbdp_push_query( $q );
37
 
38
+ $template_args = array( '_id' => $this->include_buttons ? 'all_listings' : 'listings',
39
+ '_wrapper' => $this->include_buttons ? 'page' : '',
40
+ '_bar' => ( ! empty ( $args['tax_query'] ) ? false : ( $this->include_buttons ? true : false ) ),
41
+ 'query' => $q );
42
+
43
+ $html = wpbdp_x_render( 'listings', $template_args );
44
  wp_reset_postdata();
45
  wpbdp_pop_query( $q );
46
 
core/views/search.php CHANGED
@@ -44,7 +44,8 @@ class WPBDP__Views__Search extends WPBDP_NView {
44
  'paged' => get_query_var('paged') ? get_query_var('paged') : 1,
45
  'post__in' => $results ? $results : array(0),
46
  'orderby' => wpbdp_get_option( 'listings-order-by', 'date' ),
47
- 'order' => wpbdp_get_option( 'listings-sort', 'ASC' )
 
48
  );
49
  $args = apply_filters( 'wpbdp_search_query_posts_args', $args, $search_args );
50
  query_posts( $args );
44
  'paged' => get_query_var('paged') ? get_query_var('paged') : 1,
45
  'post__in' => $results ? $results : array(0),
46
  'orderby' => wpbdp_get_option( 'listings-order-by', 'date' ),
47
+ 'order' => wpbdp_get_option( 'listings-sort', 'ASC' ),
48
+ 'wpbdp_main_query' => true
49
  );
50
  $args = apply_filters( 'wpbdp_search_query_posts_args', $args, $search_args );
51
  query_posts( $args );
core/widget-search.php CHANGED
@@ -82,7 +82,7 @@ class WPBDP_SearchWidget extends WP_Widget {
82
  echo $before_widget;
83
  if ( ! empty( $title ) ) echo $before_title . $title . $after_title;
84
 
85
- echo sprintf('<form action="%s" method="GET">', wpbdp_url( '/' ) );
86
 
87
  if ( ! wpbdp_rewrite_on() )
88
  echo sprintf('<input type="hidden" name="page_id" value="%s" />', wpbdp_get_page_id('main'));
@@ -98,6 +98,8 @@ class WPBDP_SearchWidget extends WP_Widget {
98
  echo $field->render( null, 'search' );
99
  }
100
  }
 
 
101
  } else {
102
  echo '<input type="text" name="q" value="" />';
103
  }
82
  echo $before_widget;
83
  if ( ! empty( $title ) ) echo $before_title . $title . $after_title;
84
 
85
+ echo sprintf('<form action="%s" method="get">', wpbdp_url( '/' ) );
86
 
87
  if ( ! wpbdp_rewrite_on() )
88
  echo sprintf('<input type="hidden" name="page_id" value="%s" />', wpbdp_get_page_id('main'));
98
  echo $field->render( null, 'search' );
99
  }
100
  }
101
+
102
+ echo '<input type="hidden" name="q" value="" />';
103
  } else {
104
  echo '<input type="text" name="q" value="" />';
105
  }