Business Directory Plugin - Version 3.6.2

Version Description

Download this release

Release Info

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

Code changes from version 3.6.1 to 3.6.2

README.TXT CHANGED
@@ -4,8 +4,8 @@ Donate link: http://businessdirectoryplugin.com/premium-modules/
4
  Tags: wordpress directory,wordpress directory plugin, wordpress directory theme,wordpress business directory,business directory,classified ads,classifieds,directory plugin,business directory plugin,directory widget,church directory,address book,address,member directory,members directory,city portal,city portal plugin,city guide plugin,city guide
5
  Requires at least: 3.7
6
  Tested up to: 4.1.1
7
- Last Updated: 2015-Apr-8
8
- Stable tag: tags/3.6.1
9
  License: GPLv2 or later
10
 
11
  Build local directories, business provider listings, Yellow-Pages directories, Yelp-like review sections and much more!
@@ -113,6 +113,9 @@ If you are having problems please visit [support forum](http://www.businessdirec
113
 
114
  == Changelog ==
115
 
 
 
 
116
  = Version 3.6.1 =
117
  * Fixed issue where View/Edit/Delete showed up at the wrong times and places
118
  * Added workaround for known Facebook CSS bug during share popups
4
  Tags: wordpress directory,wordpress directory plugin, wordpress directory theme,wordpress business directory,business directory,classified ads,classifieds,directory plugin,business directory plugin,directory widget,church directory,address book,address,member directory,members directory,city portal,city portal plugin,city guide plugin,city guide
5
  Requires at least: 3.7
6
  Tested up to: 4.1.1
7
+ Last Updated: 2015-Apr-9
8
+ Stable tag: tags/3.6.2
9
  License: GPLv2 or later
10
 
11
  Build local directories, business provider listings, Yellow-Pages directories, Yelp-like review sections and much more!
113
 
114
  == Changelog ==
115
 
116
+ = Version 3.6.2 =
117
+ * Fixed WP thumbnail issue where "close enough" sizes were not exactly sized to requested size (thumbnail issue)
118
+
119
  = Version 3.6.1 =
120
  * Fixed issue where View/Edit/Delete showed up at the wrong times and places
121
  * Added workaround for known Facebook CSS bug during share popups
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: 3.6.1
7
  * Author: D. Rodenbaugh
8
  * Author URI: http://businessdirectoryplugin.com
9
  * License: GPLv2 or any later version
@@ -30,7 +30,7 @@
30
  if( preg_match( '#' . basename( __FILE__ ) . '#', $_SERVER['PHP_SELF'] ) )
31
  exit();
32
 
33
- define( 'WPBDP_VERSION', '3.6.1' );
34
 
35
  define( 'WPBDP_PATH', plugin_dir_path( __FILE__ ) );
36
  define( 'WPBDP_URL', trailingslashit( plugins_url( '/', __FILE__ ) ) );
@@ -702,8 +702,10 @@ class WPBDP_Plugin {
702
  $max_width = absint( wpbdp_get_option('image-max-width') );
703
  $max_height = absint( wpbdp_get_option('image-max-height') );
704
 
 
 
705
  // thumbnail size
706
- add_image_size( 'wpbdp-thumb', $thumbnail_width, $thumbnail_height, (bool) wpbdp_get_option( 'thumbnail-crop' ) );
707
  add_image_size( 'wpbdp-large', $max_width, $max_height, false );
708
  }
709
 
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: 3.6.2
7
  * Author: D. Rodenbaugh
8
  * Author URI: http://businessdirectoryplugin.com
9
  * License: GPLv2 or any later version
30
  if( preg_match( '#' . basename( __FILE__ ) . '#', $_SERVER['PHP_SELF'] ) )
31
  exit();
32
 
33
+ define( 'WPBDP_VERSION', '3.6.2' );
34
 
35
  define( 'WPBDP_PATH', plugin_dir_path( __FILE__ ) );
36
  define( 'WPBDP_URL', trailingslashit( plugins_url( '/', __FILE__ ) ) );
702
  $max_width = absint( wpbdp_get_option('image-max-width') );
703
  $max_height = absint( wpbdp_get_option('image-max-height') );
704
 
705
+ $crop = (bool) wpbdp_get_option( 'thumbnail-crop' );
706
+
707
  // thumbnail size
708
+ add_image_size( 'wpbdp-thumb', $thumbnail_width, $crop ? $thumbnail_height : 9999, $crop );
709
  add_image_size( 'wpbdp-large', $max_width, $max_height, false );
710
  }
711
 
core/api.php CHANGED
@@ -292,15 +292,38 @@ function wpbdp_get_current_sort_option() {
292
  function _wpbdp_resize_image_if_needed($id) {
293
  require_once( ABSPATH . 'wp-admin/includes/image.php' );
294
 
295
- if ( $metadata = wp_get_attachment_metadata( $id ) ) {
296
- if ( !isset( $metadata['sizes']['wpbdp-thumb'] ) || !isset( $metadata['sizes']['wpbdp-thumb'] ) ||
297
- (isset($metadata['sizes']['wpbdp-thumb']) && (abs( intval($metadata['sizes']['wpbdp-thumb']['width']) - intval( wpbdp_get_option( 'thumbnail-width' ) ) ) >= 15) ) ) {
298
- wpbdp_log( sprintf( 'Re-creating thumbnails for attachment %d', $id ) );
299
- $filename = get_attached_file($id, true);
300
- $attach_data = wp_generate_attachment_metadata( $id, $filename );
301
- wp_update_attachment_metadata( $id, $attach_data );
302
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
303
  }
 
 
 
 
 
 
304
  }
305
 
306
  /*
292
  function _wpbdp_resize_image_if_needed($id) {
293
  require_once( ABSPATH . 'wp-admin/includes/image.php' );
294
 
295
+ $metadata = wp_get_attachment_metadata( $id );
296
+
297
+ if ( ! $metadata )
298
+ return;
299
+
300
+ $crop = (bool) wpbdp_get_option( 'thumbnail-crop' );
301
+ $def_width = absint( wpbdp_get_option( 'thumbnail-width' ) );
302
+
303
+ $width = absint( isset( $metadata['width'] ) ? $metadata['width'] : 0 );
304
+
305
+ if ( $width < $def_width )
306
+ return;
307
+
308
+ $thumb_info = isset( $metadata['sizes']['wpbdp-thumb'] ) ? $metadata['sizes']['wpbdp-thumb'] : false;
309
+
310
+ if ( ! $width )
311
+ return;
312
+
313
+ if ( $thumb_info ) {
314
+ $thumb_width = absint( $thumb_info['width'] );
315
+ $def_width = absint( wpbdp_get_option( 'thumbnail-width' ) );
316
+
317
+ // 10px of tolerance.
318
+ if ( abs( $thumb_width - $def_width ) < 10 )
319
+ return;
320
  }
321
+
322
+ $filename = get_attached_file( $id, true );
323
+ $attach_data = wp_generate_attachment_metadata( $id, $filename );
324
+ wp_update_attachment_metadata( $id, $attach_data );
325
+
326
+ wpbdp_log( sprintf( 'Resized image "%s" [ID: %d] to match updated size constraints.', $filename, $id ) );
327
  }
328
 
329
  /*
core/templates-listings.php CHANGED
@@ -140,7 +140,6 @@ function _wpbdp_render_excerpt() {
140
  $listing_fields = implode( '', WPBDP_ListingFieldDisplayItem::walk_set( 'html', $d->fields ) );
141
  $social_fields = implode( '', WPBDP_ListingFieldDisplayItem::walk_set( 'html', $d->social ) );
142
 
143
-
144
  $vars = array(
145
  'is_sticky' => $sticky_status == 'sticky',
146
  'thumbnail' => ( wpbdp_get_option( 'allow-images' ) && wpbdp_get_option( 'show-thumbnail' ) ) ? wpbdp_listing_thumbnail( null, 'link=listing&class=wpbdmthumbs wpbdp-excerpt-thumbnail' ) : '',
140
  $listing_fields = implode( '', WPBDP_ListingFieldDisplayItem::walk_set( 'html', $d->fields ) );
141
  $social_fields = implode( '', WPBDP_ListingFieldDisplayItem::walk_set( 'html', $d->social ) );
142
 
 
143
  $vars = array(
144
  'is_sticky' => $sticky_status == 'sticky',
145
  'thumbnail' => ( wpbdp_get_option( 'allow-images' ) && wpbdp_get_option( 'show-thumbnail' ) ) ? wpbdp_listing_thumbnail( null, 'link=listing&class=wpbdmthumbs wpbdp-excerpt-thumbnail' ) : '',
core/templates-ui.php CHANGED
@@ -376,6 +376,7 @@ function wpbdp_listing_thumbnail( $listing_id=null, $args=array() ) {
376
  );
377
  $image_link = $args['link'] == 'picture' ? WPBDP_URL . 'core/images/default-image-big.gif' : '';
378
  } elseif ( $main_image ) {
 
379
  $image_img = wp_get_attachment_image( $main_image->ID,
380
  'wpbdp-thumb',
381
  false,
376
  );
377
  $image_link = $args['link'] == 'picture' ? WPBDP_URL . 'core/images/default-image-big.gif' : '';
378
  } elseif ( $main_image ) {
379
+ _wpbdp_resize_image_if_needed( $main_image->ID );
380
  $image_img = wp_get_attachment_image( $main_image->ID,
381
  'wpbdp-thumb',
382
  false,