Photo Gallery by WD – Responsive Photo Gallery - Version 1.4.2

Version Description

  • Fixed: Unicode filenames.
  • Fixed: Deleting all images from gallery.
Download this release

Release Info

Developer webdorado
Plugin Icon 128x128 Photo Gallery by WD – Responsive Photo Gallery
Version 1.4.2
Comparing to
See all releases

Code changes from version 1.4.1 to 1.4.2

admin/models/Galleries.php CHANGED
@@ -563,7 +563,9 @@ class GalleriesModel_bwg {
563
  */
564
  public function image_delete( $id, $all = FALSE ) {
565
  global $wpdb;
566
- $where = ($all ? '' : ' WHERE id=' . $id);
 
 
567
  $image_where = ($all ? '' : ' WHERE image_id=' . $id);
568
 
569
  $delete = $wpdb->query('DELETE FROM `' . $wpdb->prefix . 'bwg_image`' . $where);
@@ -578,17 +580,16 @@ class GalleriesModel_bwg {
578
  }
579
  }
580
 
581
- $current_id = WDWLibrary::get('current_id', 0);
582
- if ( !empty($current_id) ) {
583
- // after deleted and empty image lists then update `preview_image` and `random_preview_image` colums.
584
- $row = $wpdb->get_row( 'SELECT * FROM `' . $wpdb->prefix . 'bwg_gallery` AS `g` INNER JOIN `' . $wpdb->prefix . 'bwg_image` AS `i` ON (`g`.`id` = `i`.`gallery_id`) WHERE `g`.`id` = ' . $current_id );
585
- if ( empty($row) ) {
586
- $wpdb->update($wpdb->prefix . 'bwg_gallery',
587
- array('preview_image' => '', 'random_preview_image' => ''),
588
- array('id' => $current_id)
589
- );
590
- }
591
- }
592
 
593
  $message = 2;
594
  if ( $delete ) {
@@ -612,10 +613,12 @@ class GalleriesModel_bwg {
612
  */
613
  public function image_publish( $id, $all = FALSE ) {
614
  global $wpdb;
615
- $where = ($all ? '' : ' WHERE id=' . $id);
 
 
616
  $updated = $wpdb->query('UPDATE `' . $wpdb->prefix . 'bwg_image` SET published=1' . $where);
617
 
618
- $message = 2;
619
  if ( $updated !== FALSE ) {
620
  $message = 9;
621
  }
@@ -632,9 +635,12 @@ class GalleriesModel_bwg {
632
  */
633
  public function image_unpublish( $id, $all = FALSE ) {
634
  global $wpdb;
635
- $where = ($all ? '' : ' WHERE id=' . $id);
 
 
636
  $updated = $wpdb->query('UPDATE `' . $wpdb->prefix . 'bwg_image` SET published=0' . $where);
637
- $message = 2;
 
638
  if ( $updated !== FALSE ) {
639
  $message = 10;
640
  }
@@ -718,7 +724,7 @@ class GalleriesModel_bwg {
718
  global $wpdb;
719
  $image_id = ($all ? 0 : $id);
720
  $gallery_id = (int) WDWLibrary::get('current_id', 0);
721
- $where = ( ($gallery_id) ? ' `gallery_id` = ' . $gallery_id . ($image_id ? ' AND `id` = ' . $image_id : '' ) : 1 );
722
  $images_data = $wpdb->get_results( 'SELECT id, image_url, thumb_url FROM `' . $wpdb->prefix . 'bwg_image` WHERE ' . $where );
723
  @ini_set('memory_limit', '-1');
724
  foreach ( $images_data as $image_data ) {
@@ -782,7 +788,8 @@ class GalleriesModel_bwg {
782
  }
783
  }
784
  WDWLibrary::update_image_modified_date( $where );
785
- return 22;
 
786
  }
787
 
788
  /**
@@ -797,7 +804,7 @@ class GalleriesModel_bwg {
797
  $image_id = ($all ? 0 : $id);
798
  global $wpdb;
799
  $gallery_id = (int) WDWLibrary::get('current_id', 0);
800
- $where = ( ($gallery_id) ? ' `gallery_id` = ' . $gallery_id . ( $image_id ? ' AND `id` = ' . $image_id : '' ) : 1 );
801
  $img_ids = $wpdb->get_results( 'SELECT id, thumb_url FROM `' . $wpdb->prefix . 'bwg_image` WHERE ' . $where );
802
  foreach ( $img_ids as $img_id ) {
803
  $file_path = str_replace("thumb", ".original", htmlspecialchars_decode(ABSPATH . BWG()->upload_dir . $img_id->thumb_url, ENT_COMPAT | ENT_QUOTES));
@@ -850,7 +857,8 @@ class GalleriesModel_bwg {
850
  @imagedestroy($new_img);
851
  @ini_restore('memory_limit');
852
  }
853
- WDWLibrary::update_image_modified_date( $where );
 
854
  return 23;
855
  }
856
 
@@ -868,14 +876,15 @@ class GalleriesModel_bwg {
868
  $gallery_id = (int) WDWLibrary::get('current_id', 0);
869
  $image_width = (int) WDWLibrary::get('image_width', 1600);
870
  $image_height = (int) WDWLibrary::get('image_height', 1200);
871
- $where = ( ($gallery_id) ? ' WHERE gallery_id=' . $gallery_id . ( $image_id ? ' AND id=' . $image_id : '' ) : '' );
872
  $images = $wpdb->get_results('SELECT * FROM `' . $wpdb->prefix . 'bwg_image` ' . $where );
873
  if ( !empty($images) ) {
874
- foreach ( $images as $image ) {
875
- $this->scaled_image(ABSPATH . BWG()->upload_dir . $image->image_url, $image_width, $image_height);
876
- }
877
- }
878
- WDWLibrary::update_image_modifie_date( $where );
 
879
  return 24;
880
  }
881
 
563
  */
564
  public function image_delete( $id, $all = FALSE ) {
565
  global $wpdb;
566
+ $current_id = WDWLibrary::get('current_id', 0);
567
+ $where = 'WHERE gallery_id=' . $current_id;
568
+ $where .= ($all ? '' : ' AND id=' . $id);
569
  $image_where = ($all ? '' : ' WHERE image_id=' . $id);
570
 
571
  $delete = $wpdb->query('DELETE FROM `' . $wpdb->prefix . 'bwg_image`' . $where);
580
  }
581
  }
582
 
583
+ if ( !empty($current_id) ) {
584
+ // after deleted and empty image lists then update `preview_image` and `random_preview_image` colums.
585
+ $row = $wpdb->get_row( 'SELECT * FROM `' . $wpdb->prefix . 'bwg_gallery` AS `g` INNER JOIN `' . $wpdb->prefix . 'bwg_image` AS `i` ON (`g`.`id` = `i`.`gallery_id`) WHERE `g`.`id` = ' . $current_id );
586
+ if ( empty($row) ) {
587
+ $wpdb->update($wpdb->prefix . 'bwg_gallery',
588
+ array('preview_image' => '', 'random_preview_image' => ''),
589
+ array('id' => $current_id)
590
+ );
591
+ }
592
+ }
 
593
 
594
  $message = 2;
595
  if ( $delete ) {
613
  */
614
  public function image_publish( $id, $all = FALSE ) {
615
  global $wpdb;
616
+ $current_id = WDWLibrary::get('current_id', 0);
617
+ $where = ' WHERE gallery_id=' . $current_id;
618
+ $where .= ($all ? '' : ' AND id=' . $id);
619
  $updated = $wpdb->query('UPDATE `' . $wpdb->prefix . 'bwg_image` SET published=1' . $where);
620
 
621
+ $message = 2;
622
  if ( $updated !== FALSE ) {
623
  $message = 9;
624
  }
635
  */
636
  public function image_unpublish( $id, $all = FALSE ) {
637
  global $wpdb;
638
+ $current_id = WDWLibrary::get('current_id', 0);
639
+ $where = ' WHERE gallery_id=' . $current_id;
640
+ $where .= ($all ? '' : ' AND id=' . $id);
641
  $updated = $wpdb->query('UPDATE `' . $wpdb->prefix . 'bwg_image` SET published=0' . $where);
642
+
643
+ $message = 2;
644
  if ( $updated !== FALSE ) {
645
  $message = 10;
646
  }
724
  global $wpdb;
725
  $image_id = ($all ? 0 : $id);
726
  $gallery_id = (int) WDWLibrary::get('current_id', 0);
727
+ $where = ( ($gallery_id) ? ' `gallery_id` = ' . $gallery_id . ($image_id ? ' AND `id` = ' . $image_id : '' ) : 1 );
728
  $images_data = $wpdb->get_results( 'SELECT id, image_url, thumb_url FROM `' . $wpdb->prefix . 'bwg_image` WHERE ' . $where );
729
  @ini_set('memory_limit', '-1');
730
  foreach ( $images_data as $image_data ) {
788
  }
789
  }
790
  WDWLibrary::update_image_modified_date( $where );
791
+
792
+ return 22;
793
  }
794
 
795
  /**
804
  $image_id = ($all ? 0 : $id);
805
  global $wpdb;
806
  $gallery_id = (int) WDWLibrary::get('current_id', 0);
807
+ $where = ( ($gallery_id) ? ' `gallery_id` = ' . $gallery_id . ( $image_id ? ' AND `id` = ' . $image_id : '' ) : 1 );
808
  $img_ids = $wpdb->get_results( 'SELECT id, thumb_url FROM `' . $wpdb->prefix . 'bwg_image` WHERE ' . $where );
809
  foreach ( $img_ids as $img_id ) {
810
  $file_path = str_replace("thumb", ".original", htmlspecialchars_decode(ABSPATH . BWG()->upload_dir . $img_id->thumb_url, ENT_COMPAT | ENT_QUOTES));
857
  @imagedestroy($new_img);
858
  @ini_restore('memory_limit');
859
  }
860
+ WDWLibrary::update_image_modified_date( $where );
861
+
862
  return 23;
863
  }
864
 
876
  $gallery_id = (int) WDWLibrary::get('current_id', 0);
877
  $image_width = (int) WDWLibrary::get('image_width', 1600);
878
  $image_height = (int) WDWLibrary::get('image_height', 1200);
879
+ $where = ( ($gallery_id) ? ' WHERE gallery_id=' . $gallery_id . ( $image_id ? ' AND id=' . $image_id : '' ) : '' );
880
  $images = $wpdb->get_results('SELECT * FROM `' . $wpdb->prefix . 'bwg_image` ' . $where );
881
  if ( !empty($images) ) {
882
+ foreach ( $images as $image ) {
883
+ $this->scaled_image(ABSPATH . BWG()->upload_dir . $image->image_url, $image_width, $image_height);
884
+ }
885
+ }
886
+ WDWLibrary::update_image_modifie_date( $where );
887
+
888
  return 24;
889
  }
890
 
framework/WDWLibrary.php CHANGED
@@ -1067,10 +1067,10 @@ class WDWLibrary {
1067
  $row->permalink = self::get_custom_post_permalink( array( 'slug' => $row->slug, 'post_type' => 'gallery' ) );
1068
  }
1069
  if ( !empty($row->preview_image) ) {
1070
- $row->preview_image = add_query_arg( array('bwg' => $row->modified_date), mb_convert_encoding($row->preview_image, "UTF-8", "HTML-ENTITIES") );
1071
  }
1072
  if ( !empty($row->random_preview_image) ) {
1073
- $row->random_preview_image = add_query_arg( array('bwg' => $row->modified_date), mb_convert_encoding($row->random_preview_image, "UTF-8", "HTML-ENTITIES") );
1074
  }
1075
  }
1076
  else if ( $id == 0 ) {
@@ -1349,8 +1349,8 @@ class WDWLibrary {
1349
  $images = array();
1350
  if ( !empty($rows) ) {
1351
  foreach ( $rows as $row ) {
1352
- $row->image_url = add_query_arg( array('bwg' => $row->modified_date), mb_convert_encoding($row->image_url, "UTF-8", "HTML-ENTITIES") );
1353
- $row->thumb_url = add_query_arg( array('bwg' => $row->modified_date), mb_convert_encoding($row->thumb_url, "UTF-8", "HTML-ENTITIES") );
1354
  $images[] = $row;
1355
  }
1356
  }
@@ -1370,12 +1370,12 @@ class WDWLibrary {
1370
  //var_dump($row[0]);
1371
  $row->permalink = WDWLibrary::get_custom_post_permalink(array( 'slug' => $row->slug, 'post_type' => 'album' ));
1372
  }
1373
- if ( !empty($row->preview_image) ) {
1374
- $row->preview_image = add_query_arg( array('bwg' => $row->modified_date), mb_convert_encoding($row->preview_image, "UTF-8", "HTML-ENTITIES") );
1375
- }
1376
- if ( !empty($row->random_preview_image) ) {
1377
- $row->random_preview_image = add_query_arg( array('bwg' => $row->modified_date), mb_convert_encoding($row->random_preview_image, "UTF-8", "HTML-ENTITIES") );
1378
- }
1379
  }
1380
  return $row;
1381
  }
1067
  $row->permalink = self::get_custom_post_permalink( array( 'slug' => $row->slug, 'post_type' => 'gallery' ) );
1068
  }
1069
  if ( !empty($row->preview_image) ) {
1070
+ $row->preview_image = $row->preview_image . '?bwg=' . $row->modified_date;
1071
  }
1072
  if ( !empty($row->random_preview_image) ) {
1073
+ $row->random_preview_image = $row->random_preview_image . '?bwg=' . $row->modified_date;
1074
  }
1075
  }
1076
  else if ( $id == 0 ) {
1349
  $images = array();
1350
  if ( !empty($rows) ) {
1351
  foreach ( $rows as $row ) {
1352
+ $row->image_url = $row->image_url . '?bwg=' . $row->modified_date;
1353
+ $row->thumb_url = $row->thumb_url . '?bwg=' . $row->modified_date;
1354
  $images[] = $row;
1355
  }
1356
  }
1370
  //var_dump($row[0]);
1371
  $row->permalink = WDWLibrary::get_custom_post_permalink(array( 'slug' => $row->slug, 'post_type' => 'album' ));
1372
  }
1373
+ if ( !empty($row->preview_image) ) {
1374
+ $row->preview_image = $row->preview_image . '?bwg=' . $row->modified_date;
1375
+ }
1376
+ if ( !empty($row->random_preview_image) ) {
1377
+ $row->random_preview_image = $row->random_preview_image . '?bwg=' . $row->modified_date;
1378
+ }
1379
  }
1380
  return $row;
1381
  }
frontend/models/BWGModelGalleryBox.php CHANGED
@@ -46,8 +46,8 @@ class BWGModelGalleryBox {
46
  foreach ( $rows as $row ) {
47
  $row->pure_image_url = $row->image_url;
48
  $row->pure_thumb_url = $row->thumb_url;
49
- $row->image_url = add_query_arg( array('bwg' => $row->modified_date), mb_convert_encoding($row->image_url, "UTF-8", "HTML-ENTITIES") );
50
- $row->thumb_url = add_query_arg( array('bwg' => $row->modified_date), mb_convert_encoding($row->thumb_url, "UTF-8", "HTML-ENTITIES") );
51
  $images[] = $row;
52
  }
53
  }
46
  foreach ( $rows as $row ) {
47
  $row->pure_image_url = $row->image_url;
48
  $row->pure_thumb_url = $row->thumb_url;
49
+ $row->image_url = $row->image_url . '?bwg=' . $row->modified_date;
50
+ $row->thumb_url = $row->thumb_url . '?bwg=' . $row->modified_date;
51
  $images[] = $row;
52
  }
53
  }
photo-gallery.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Photo Gallery
4
  * Plugin URI: https://web-dorado.com/products/wordpress-photo-gallery-plugin.html
5
  * Description: This plugin is a fully responsive gallery plugin with advanced functionality. It allows having different image galleries for your posts and pages. You can create unlimited number of galleries, combine them into albums, and provide descriptions and tags.
6
- * Version: 1.4.1
7
  * Author: Photo Gallery Team
8
  * Author URI: https://web-dorado.com/wordpress-plugins-bundle.html
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
@@ -83,8 +83,8 @@ final class BWG {
83
  $this->plugin_dir = WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__));
84
  $this->plugin_url = plugins_url(plugin_basename(dirname(__FILE__)));
85
  $this->main_file = plugin_basename(__FILE__);
86
- $this->plugin_version = '1.4.1';
87
- $this->db_version = '1.4.1';
88
  $this->prefix = 'bwg';
89
  $this->nicename = __('Photo Gallery', $this->prefix);
90
 
3
  * Plugin Name: Photo Gallery
4
  * Plugin URI: https://web-dorado.com/products/wordpress-photo-gallery-plugin.html
5
  * Description: This plugin is a fully responsive gallery plugin with advanced functionality. It allows having different image galleries for your posts and pages. You can create unlimited number of galleries, combine them into albums, and provide descriptions and tags.
6
+ * Version: 1.4.2
7
  * Author: Photo Gallery Team
8
  * Author URI: https://web-dorado.com/wordpress-plugins-bundle.html
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
83
  $this->plugin_dir = WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__));
84
  $this->plugin_url = plugins_url(plugin_basename(dirname(__FILE__)));
85
  $this->main_file = plugin_basename(__FILE__);
86
+ $this->plugin_version = '1.4.2';
87
+ $this->db_version = '1.4.2';
88
  $this->prefix = 'bwg';
89
  $this->nicename = __('Photo Gallery', $this->prefix);
90
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: webdorado,wdsupport,photogallerysupport
3
  Tags: gallery, photo gallery, image gallery, responsive gallery, wordpress gallery plugin, photo albums, gallery slider, gallery lightbox, wordpress photo gallery plugin, fullscreen gallery, watermarking, video gallery
4
  Requires at least: 3.4
5
  Tested up to: 4.9
6
- Stable tag: 1.4.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -17,7 +17,7 @@ https://www.youtube.com/watch?v=3u0O9ZdVsGc
17
  [Special Offer for all Premium Plugins](https://web-dorado.com/wordpress-plugins-bundle.html)
18
  [WordPress Photo Gallery](https://web-dorado.com/products/wordpress-photo-gallery-plugin.html)
19
  [Demo](http://wpdemo.web-dorado.com/photo-gallery/)
20
- [User Manual](https://web-dorado.com/wordpress-gallery-guide-step-1.html)
21
  [Support Forum](https://wordpress.org/support/plugin/photo-gallery)
22
 
23
 
@@ -279,6 +279,10 @@ Choose whether to display random or the first/last specific number of images.
279
 
280
  == Changelog ==
281
 
 
 
 
 
282
  = 1.4.1 =
283
  * Fixed: Bugs on php5.3.
284
 
3
  Tags: gallery, photo gallery, image gallery, responsive gallery, wordpress gallery plugin, photo albums, gallery slider, gallery lightbox, wordpress photo gallery plugin, fullscreen gallery, watermarking, video gallery
4
  Requires at least: 3.4
5
  Tested up to: 4.9
6
+ Stable tag: 1.4.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
17
  [Special Offer for all Premium Plugins](https://web-dorado.com/wordpress-plugins-bundle.html)
18
  [WordPress Photo Gallery](https://web-dorado.com/products/wordpress-photo-gallery-plugin.html)
19
  [Demo](http://wpdemo.web-dorado.com/photo-gallery/)
20
+ [User Manual](https://web-dorado.com/wordpress-gallery/installing.html)
21
  [Support Forum](https://wordpress.org/support/plugin/photo-gallery)
22
 
23
 
279
 
280
  == Changelog ==
281
 
282
+ = 1.4.2 =
283
+ * Fixed: Unicode filenames.
284
+ * Fixed: Deleting all images from gallery.
285
+
286
  = 1.4.1 =
287
  * Fixed: Bugs on php5.3.
288