Business Directory Plugin - Version 4.0.1

Version Description

Download this release

Release Info

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

Code changes from version 4.0 to 4.0.1

README.TXT CHANGED
@@ -1,11 +1,11 @@
1
  === Business Directory Plugin ===
2
  Contributors: businessdirectoryplugin
3
  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 theme
5
  Requires at least: 4.1
6
  Tested up to: 4.5
7
- Last Updated: 2016-May-24
8
- Stable tag: tags/4.0
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,13 @@ If you are having problems please visit [support forum](http://www.businessdirec
130
 
131
  == Changelog ==
132
 
 
 
 
 
 
 
 
133
  = Version 4.0 =
134
  * NEW: Add support for theming the directory + 5 premium and 1 default themes.
135
  * NEW: Added listing categories shortcode `businessdirectory-categories`.
1
  === Business Directory Plugin ===
2
  Contributors: businessdirectoryplugin
3
  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-25
8
+ Stable tag: tags/4.0.1
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.1 =
134
+ * Fix some PHP warnings and errors
135
+ * Fix listings shortcode category support.
136
+ * Fix search issue in Featured Listings widget.
137
+ * Fix tag pages.
138
+ * Make "Pre-4.0 Template" the default theme for upgrades from 3.x.
139
+
140
  = Version 4.0 =
141
  * NEW: Add support for theming the directory + 5 premium and 1 default themes.
142
  * NEW: Added listing categories shortcode `businessdirectory-categories`.
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
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' );
35
 
36
  define( 'WPBDP_PATH', plugin_dir_path( __FILE__ ) );
37
  define( 'WPBDP_URL', trailingslashit( plugins_url( '/', __FILE__ ) ) );
@@ -313,8 +313,8 @@ class WPBDP_Plugin {
313
  $rules['(' . $rewrite_base . ')/' . $category_slug . '/(.+?)/?$'] = 'index.php?page_id=' . $page_id . '&category=$matches[2]';
314
  }
315
 
316
- $rules['(' . $rewrite_base . ')/' . $tags_slug . '/(.+?)/' . $wp_rewrite->pagination_base . '/?([0-9]{1,})/?$'] = 'index.php?page_id=' . $page_id . '&tag=$matches[2]&paged=$matches[3]';
317
- $rules['(' . $rewrite_base . ')/' . $tags_slug . '/(.+?)$'] = 'index.php?page_id=' . $page_id . '&tag=$matches[2]';
318
 
319
  if ( wpbdp_get_option( 'permalinks-no-id' ) ) {
320
  if ( ! wpbdp_get_option( 'disable-cpt' ) ) {
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.1
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.1' );
35
 
36
  define( 'WPBDP_PATH', plugin_dir_path( __FILE__ ) );
37
  define( 'WPBDP_URL', trailingslashit( plugins_url( '/', __FILE__ ) ) );
313
  $rules['(' . $rewrite_base . ')/' . $category_slug . '/(.+?)/?$'] = 'index.php?page_id=' . $page_id . '&category=$matches[2]';
314
  }
315
 
316
+ $rules['(' . $rewrite_base . ')/' . $tags_slug . '/(.+?)/' . $wp_rewrite->pagination_base . '/?([0-9]{1,})/?$'] = 'index.php?' . WPBDP_TAGS_TAX . '=$matches[2]&paged=$matches[3]';
317
+ $rules['(' . $rewrite_base . ')/' . $tags_slug . '/(.+?)$'] = 'index.php?' . WPBDP_TAGS_TAX . '=$matches[2]';
318
 
319
  if ( wpbdp_get_option( 'permalinks-no-id' ) ) {
320
  if ( ! wpbdp_get_option( 'disable-cpt' ) ) {
core/class-field-display-list.php CHANGED
@@ -150,6 +150,7 @@ class WPBDP_Field_Display_List implements IteratorAggregate {
150
  return $this->items[ $field_id ];
151
 
152
  wpbdp_debug( 'Invalid field key: ' . $key );
 
153
  return false;
154
  }
155
 
150
  return $this->items[ $field_id ];
151
 
152
  wpbdp_debug( 'Invalid field key: ' . $key );
153
+ return new WPBDP_NoopObject(); // FIXME: templates shouldn't rely on a field existing.
154
  return false;
155
  }
156
 
core/class-shortcodes.php CHANGED
@@ -157,7 +157,7 @@ class WPBDP__Shortcodes {
157
  'tax_query' => array(
158
  array( 'taxonomy' => WPBDP_TAGS_TAX,
159
  'field' => 'id',
160
- 'terms' => $categories ) )
161
  );
162
 
163
  $v = new WPBDP__Views__All_Listings( array( 'include_buttons' => false, 'query_args' => $args ) );
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 ) );
core/class-view.php CHANGED
@@ -57,11 +57,13 @@ class WPBDP_NView {
57
  }
58
 
59
  public final function _render() {
60
- return call_user_func_array( 'wpbdp_x_render', func_get_args() );
 
61
  }
62
 
63
  public final function _render_page() {
64
- return call_user_func_array( 'wpbdp_x_render_page', func_get_args() );
 
65
  }
66
 
67
  }
57
  }
58
 
59
  public final function _render() {
60
+ $args = func_get_args();
61
+ return call_user_func_array( 'wpbdp_x_render', $args );
62
  }
63
 
64
  public final function _render_page() {
65
+ $args = func_get_args();
66
+ return call_user_func_array( 'wpbdp_x_render_page', $args );
67
  }
68
 
69
  }
core/installer.php CHANGED
@@ -896,6 +896,8 @@ class WPBDP_Installer {
896
  }
897
 
898
  public function upgrade_to_11() {
 
 
899
  }
900
 
901
  // public function upgrade_to_12() {
896
  }
897
 
898
  public function upgrade_to_11() {
899
+ // Users upgrading from < 4.x get the pre-4.0 theme.
900
+ update_option( 'wpbdp-active-theme', 'no_theme' );
901
  }
902
 
903
  // public function upgrade_to_12() {
core/templates-ui.php CHANGED
@@ -212,7 +212,7 @@ function wpbdp_search_form() {
212
  $html = '';
213
  $html .= sprintf( '<form id="wpbdmsearchform" action="%s" method="GET" class="wpbdp-search-form">',
214
  wpbdp_url( 'search' ) );
215
- $html .= '<input type="hidden" name="action" value="search" />';
216
 
217
  if ( ! wpbdp_rewrite_on() ) {
218
  $html .= sprintf( '<input type="hidden" name="page_id" value="%d" />', wpbdp_get_page_id( 'main' ) );
212
  $html = '';
213
  $html .= sprintf( '<form id="wpbdmsearchform" action="%s" method="GET" class="wpbdp-search-form">',
214
  wpbdp_url( 'search' ) );
215
+ $html .= '<input type="hidden" name="wpbdp_view" value="search" />';
216
 
217
  if ( ! wpbdp_rewrite_on() ) {
218
  $html .= sprintf( '<input type="hidden" name="page_id" value="%d" />', wpbdp_get_page_id( 'main' ) );
core/themes.php CHANGED
@@ -44,6 +44,9 @@ class WPBDP_Themes {
44
  if ( ! $fname && file_exists( $theme->path . 'theme.php' ) )
45
  include_once( $theme->path . 'theme.php' );
46
 
 
 
 
47
  $theme_name = str_replace( array( '-' ), array( '_' ), $theme->id );
48
 
49
  $alternatives = array( 'wpbdp_themes__' . $theme_name . '_' . $fname,
44
  if ( ! $fname && file_exists( $theme->path . 'theme.php' ) )
45
  include_once( $theme->path . 'theme.php' );
46
 
47
+ if ( ! $fname )
48
+ return;
49
+
50
  $theme_name = str_replace( array( '-' ), array( '_' ), $theme->id );
51
 
52
  $alternatives = array( 'wpbdp_themes__' . $theme_name . '_' . $fname,
core/views/all_listings.php CHANGED
@@ -30,6 +30,8 @@ class WPBDP__Views__All_Listings extends WPBDP_NView {
30
  if ( ! empty( $args_['author'] ) )
31
  $args['author'] = $args_['author'];
32
 
 
 
33
  $q = new WP_Query( $args );
34
  wpbdp_push_query( $q );
35
 
30
  if ( ! empty( $args_['author'] ) )
31
  $args['author'] = $args_['author'];
32
 
33
+ $args = array_merge( $args, $args_ );
34
+
35
  $q = new WP_Query( $args );
36
  wpbdp_push_query( $q );
37
 
core/views/show_tag.php CHANGED
@@ -8,6 +8,7 @@ class WPBDP__Views__Show_Tag extends WPBDP_NView {
8
  wpbdp_push_query( $wp_query );
9
 
10
  $term = get_queried_object();
 
11
 
12
  $html = $this->_render( 'tag',
13
  array( 'title' => $term->name,
8
  wpbdp_push_query( $wp_query );
9
 
10
  $term = get_queried_object();
11
+ $term->is_tag = true;
12
 
13
  $html = $this->_render( 'tag',
14
  array( 'title' => $term->name,
core/widget-featured-listings.php CHANGED
@@ -37,7 +37,7 @@ class WPBDP_FeaturedListingsWidget extends WPBDP_Listings_Widget {
37
  $q = $wpdb->prepare(
38
  "SELECT DISTINCT {$wpdb->posts}.ID FROM {$wpdb->posts} JOIN {$wpdb->postmeta} pm ON pm.post_id = {$wpdb->posts}.ID
39
  JOIN {$wpdb->prefix}wpbdp_listing_fees lf ON lf.listing_id = {$wpdb->posts}.ID
40
- WHERE {$wpdb->posts}.post_status = %s AND wp_posts.post_type = %s AND ( lf.sticky = 1 OR ( pm.meta_key = %s AND pm.meta_value = %s ) )
41
  ORDER BY " . ( ( isset( $instance['random_order'] ) && $instance['random_order'] ) ? 'RAND' : $wpdb->posts . '.post_date' ) .
42
  " LIMIT %d",
43
  'publish', WPBDP_POST_TYPE, '_wpbdp[sticky]', 'sticky', $instance['number_of_listings'] );
37
  $q = $wpdb->prepare(
38
  "SELECT DISTINCT {$wpdb->posts}.ID FROM {$wpdb->posts} JOIN {$wpdb->postmeta} pm ON pm.post_id = {$wpdb->posts}.ID
39
  JOIN {$wpdb->prefix}wpbdp_listing_fees lf ON lf.listing_id = {$wpdb->posts}.ID
40
+ WHERE {$wpdb->posts}.post_status = %s AND {$wpdb->posts}.post_type = %s AND ( lf.sticky = 1 OR ( pm.meta_key = %s AND pm.meta_value = %s ) )
41
  ORDER BY " . ( ( isset( $instance['random_order'] ) && $instance['random_order'] ) ? 'RAND' : $wpdb->posts . '.post_date' ) .
42
  " LIMIT %d",
43
  'publish', WPBDP_POST_TYPE, '_wpbdp[sticky]', 'sticky', $instance['number_of_listings'] );
core/widget-search.php CHANGED
@@ -82,9 +82,12 @@ 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_get_page_link() );
86
- echo '<input type="hidden" name="action" value="search" />';
87
- echo sprintf('<input type="hidden" name="page_id" value="%s" />', wpbdp_get_page_id('main'));
 
 
 
88
  echo '<input type="hidden" name="dosrch" value="1" />';
89
 
90
  if (wpbdp_getv($instance, 'form_mode', 'basic') == 'advanced') {
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'));
89
+
90
+ echo '<input type="hidden" name="wpbdp_view" value="search" />';
91
  echo '<input type="hidden" name="dosrch" value="1" />';
92
 
93
  if (wpbdp_getv($instance, 'form_mode', 'basic') == 'advanced') {