Photo Gallery by WD – Responsive Photo Gallery - Version 1.1.21

Version Description

  • added option for sorting gallery images within album
Download this release

Release Info

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

Code changes from version 1.1.20 to 1.1.21

admin/models/BWGModelAddAlbumsGalleries.php CHANGED
@@ -30,7 +30,7 @@ class BWGModelAddAlbumsGalleries {
30
  else {
31
  $limit = 0;
32
  }
33
- $query = "SELECT id, name, 1 as is_album FROM " . $wpdb->prefix . "bwg_album WHERE published=1 AND id<>" . $album_id . " " . $where . " UNION SELECT id, name, 0 as is_album FROM " . $wpdb->prefix . "bwg_gallery WHERE published=1 " . $where . $order_by . " LIMIT " . $limit . ",20";
34
  $rows = $wpdb->get_results($query);
35
  return $rows;
36
  }
@@ -38,7 +38,7 @@ class BWGModelAddAlbumsGalleries {
38
  public function page_nav($album_id) {
39
  global $wpdb;
40
  $where = ((isset($_POST['search_value']) && (esc_html(stripslashes($_POST['search_value'])) != '')) ? ' AND name LIKE "%' . esc_html(stripslashes($_POST['search_value'])) . '%"' : '');
41
- $query = "SELECT id FROM " . $wpdb->prefix . "bwg_album WHERE published=1 AND id<>" . $album_id . " " . $where . " UNION SELECT id FROM " . $wpdb->prefix . "bwg_gallery WHERE published=1 " . $where;
42
  $total = count($wpdb->get_col($query));
43
  $page_nav['total'] = $total;
44
  if (isset($_POST['page_number']) && $_POST['page_number']) {
30
  else {
31
  $limit = 0;
32
  }
33
+ $query = "SELECT id, name, 1 as is_album FROM " . $wpdb->prefix . "bwg_album WHERE published=1 AND id<>" . $album_id . " " . $where . " UNION ALL SELECT id, name, 0 as is_album FROM " . $wpdb->prefix . "bwg_gallery WHERE published=1 " . $where . $order_by . " LIMIT " . $limit . ",20";
34
  $rows = $wpdb->get_results($query);
35
  return $rows;
36
  }
38
  public function page_nav($album_id) {
39
  global $wpdb;
40
  $where = ((isset($_POST['search_value']) && (esc_html(stripslashes($_POST['search_value'])) != '')) ? ' AND name LIKE "%' . esc_html(stripslashes($_POST['search_value'])) . '%"' : '');
41
+ $query = "SELECT id FROM " . $wpdb->prefix . "bwg_album WHERE published=1 AND id<>" . $album_id . " " . $where . " UNION ALL SELECT id FROM " . $wpdb->prefix . "bwg_gallery WHERE published=1 " . $where;
42
  $total = count($wpdb->get_col($query));
43
  $page_nav['total'] = $total;
44
  if (isset($_POST['page_number']) && $_POST['page_number']) {
admin/views/BWGViewBWGShortcode.php CHANGED
@@ -186,7 +186,7 @@ class BWGViewBWGShortcode {
186
  </td>
187
  </tr>
188
  <tr id="tr_sort_by">
189
- <td class="spider_label"><label for="sort_by">Sort by: </label></td>
190
  <td>
191
  <select name="sort_by" id="sort_by" style="width:150px;">
192
  <option value="order" selected="selected">Order</option>
@@ -199,7 +199,7 @@ class BWGViewBWGShortcode {
199
  </td>
200
  </tr>
201
  <tr id="tr_order_by">
202
- <td class="spider_label"><label>Order: </label></td>
203
  <td>
204
  <input type="radio" name="order_by" id="order_by_1" value="asc" checked="checked" /><label for="order_by_1">Ascending</label>
205
  <input type="radio" name="order_by" id="order_by_0" value="desc" /><label for="order_by_0">Descending</label>
@@ -1035,6 +1035,12 @@ class BWGViewBWGShortcode {
1035
  case 'album_compact_preview': {
1036
  jQuery("select[id=album] option[value='" + short_code['album_id'] + "']").attr('selected', 'selected');
1037
  jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
 
 
 
 
 
 
1038
  if (short_code['show_search_box'] == 1) {
1039
  jQuery("#show_search_box_1").attr('checked', 'checked');
1040
  jQuery("#tr_search_box_width").css('display', '');
@@ -1074,6 +1080,12 @@ class BWGViewBWGShortcode {
1074
  case 'album_extended_preview': {
1075
  jQuery("select[id=album] option[value='" + short_code['album_id'] + "']").attr('selected', 'selected');
1076
  jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
 
 
 
 
 
 
1077
  if (short_code['show_search_box'] == 1) {
1078
  jQuery("#show_search_box_1").attr('checked', 'checked');
1079
  jQuery("#tr_search_box_width").css('display', '');
@@ -1344,8 +1356,8 @@ class BWGViewBWGShortcode {
1344
  }
1345
  case 'album_compact_preview': {
1346
  tagtext += ' album_id="' + jQuery("#album").val() + '"';
1347
- tagtext += ' sort_by="order"';
1348
- tagtext += ' order_by="asc"';
1349
  tagtext += ' show_search_box="' + jQuery("input[name=show_search_box]:checked").val() + '"';
1350
  tagtext += ' search_box_width="' + jQuery("#search_box_width").val() + '"';
1351
  tagtext += ' compuct_album_column_number="' + jQuery("#compuct_album_column_number").val() + '"';
@@ -1365,8 +1377,8 @@ class BWGViewBWGShortcode {
1365
  }
1366
  case 'album_extended_preview': {
1367
  tagtext += ' album_id="' + jQuery("#album").val() + '"';
1368
- tagtext += ' sort_by="order"';
1369
- tagtext += ' order_by="asc"';
1370
  tagtext += ' show_search_box="' + jQuery("input[name=show_search_box]:checked").val() + '"';
1371
  tagtext += ' search_box_width="' + jQuery("#search_box_width").val() + '"';
1372
  tagtext += ' extended_albums_per_page="' + jQuery("#extended_albums_per_page").val() + '"';
186
  </td>
187
  </tr>
188
  <tr id="tr_sort_by">
189
+ <td class="spider_label"><label for="sort_by">Sort images by: </label></td>
190
  <td>
191
  <select name="sort_by" id="sort_by" style="width:150px;">
192
  <option value="order" selected="selected">Order</option>
199
  </td>
200
  </tr>
201
  <tr id="tr_order_by">
202
+ <td class="spider_label"><label>Order images: </label></td>
203
  <td>
204
  <input type="radio" name="order_by" id="order_by_1" value="asc" checked="checked" /><label for="order_by_1">Ascending</label>
205
  <input type="radio" name="order_by" id="order_by_0" value="desc" /><label for="order_by_0">Descending</label>
1035
  case 'album_compact_preview': {
1036
  jQuery("select[id=album] option[value='" + short_code['album_id'] + "']").attr('selected', 'selected');
1037
  jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
1038
+ if (short_code['order_by'] == 'asc') {
1039
+ jQuery("#order_by_1").attr('checked', 'checked');
1040
+ }
1041
+ else {
1042
+ jQuery("#order_by_0").attr('checked', 'checked');
1043
+ }
1044
  if (short_code['show_search_box'] == 1) {
1045
  jQuery("#show_search_box_1").attr('checked', 'checked');
1046
  jQuery("#tr_search_box_width").css('display', '');
1080
  case 'album_extended_preview': {
1081
  jQuery("select[id=album] option[value='" + short_code['album_id'] + "']").attr('selected', 'selected');
1082
  jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
1083
+ if (short_code['order_by'] == 'asc') {
1084
+ jQuery("#order_by_1").attr('checked', 'checked');
1085
+ }
1086
+ else {
1087
+ jQuery("#order_by_0").attr('checked', 'checked');
1088
+ }
1089
  if (short_code['show_search_box'] == 1) {
1090
  jQuery("#show_search_box_1").attr('checked', 'checked');
1091
  jQuery("#tr_search_box_width").css('display', '');
1356
  }
1357
  case 'album_compact_preview': {
1358
  tagtext += ' album_id="' + jQuery("#album").val() + '"';
1359
+ tagtext += ' sort_by="' + jQuery("#sort_by").val() + '"';
1360
+ tagtext += ' order_by="' + jQuery("input[name=order_by]:checked").val() + '"';
1361
  tagtext += ' show_search_box="' + jQuery("input[name=show_search_box]:checked").val() + '"';
1362
  tagtext += ' search_box_width="' + jQuery("#search_box_width").val() + '"';
1363
  tagtext += ' compuct_album_column_number="' + jQuery("#compuct_album_column_number").val() + '"';
1377
  }
1378
  case 'album_extended_preview': {
1379
  tagtext += ' album_id="' + jQuery("#album").val() + '"';
1380
+ tagtext += ' sort_by="' + jQuery("#sort_by").val() + '"';
1381
+ tagtext += ' order_by="' + jQuery("input[name=order_by]:checked").val() + '"';
1382
  tagtext += ' show_search_box="' + jQuery("input[name=show_search_box]:checked").val() + '"';
1383
  tagtext += ' search_box_width="' + jQuery("#search_box_width").val() + '"';
1384
  tagtext += ' extended_albums_per_page="' + jQuery("#extended_albums_per_page").val() + '"';
frontend/models/BWGModelAlbum_extended_preview.php CHANGED
@@ -24,7 +24,7 @@ class BWGModelAlbum_extended_preview {
24
  return $row;
25
  }
26
 
27
- public function get_alb_gals_row($id, $albums_per_page, $sort_by, $bwg) {
28
  global $wpdb;
29
  if (isset($_POST['page_number_' . $bwg]) && $_POST['page_number_' . $bwg]) {
30
  $limit = ((int) $_POST['page_number_' . $bwg] - 1) * $albums_per_page;
@@ -38,7 +38,7 @@ class BWGModelAlbum_extended_preview {
38
  else {
39
  $limit_str = '';
40
  }
41
- $row = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_album_gallery WHERE album_id="%d" ORDER BY `' . $sort_by . '` ASC ' . $limit_str, $id));
42
  return $row;
43
  }
44
 
@@ -54,7 +54,7 @@ class BWGModelAlbum_extended_preview {
54
  return $row;
55
  }
56
 
57
- public function get_image_rows_data($id, $images_per_page, $sort_by, $bwg) {
58
  global $wpdb;
59
  $bwg_search = ((isset($_POST['bwg_search_' . $bwg]) && esc_html($_POST['bwg_search_' . $bwg]) != '') ? esc_html($_POST['bwg_search_' . $bwg]) : '');
60
  if ($bwg_search != '') {
@@ -75,7 +75,7 @@ class BWGModelAlbum_extended_preview {
75
  else {
76
  $limit_str = '';
77
  }
78
- $row = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_image WHERE published=1 ' . $where . ' AND gallery_id="%d" ORDER BY `' . $sort_by . '` ASC ' . $limit_str, $id));
79
  return $row;
80
  }
81
 
24
  return $row;
25
  }
26
 
27
+ public function get_alb_gals_row($id, $albums_per_page, $sort_by, $bwg, $sort_direction = ' ASC ') {
28
  global $wpdb;
29
  if (isset($_POST['page_number_' . $bwg]) && $_POST['page_number_' . $bwg]) {
30
  $limit = ((int) $_POST['page_number_' . $bwg] - 1) * $albums_per_page;
38
  else {
39
  $limit_str = '';
40
  }
41
+ $row = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_album_gallery WHERE album_id="%d" ORDER BY `' . $sort_by . '` ' . $sort_direction . $limit_str, $id));
42
  return $row;
43
  }
44
 
54
  return $row;
55
  }
56
 
57
+ public function get_image_rows_data($id, $images_per_page, $sort_by, $bwg, $sort_direction = ' ASC ') {
58
  global $wpdb;
59
  $bwg_search = ((isset($_POST['bwg_search_' . $bwg]) && esc_html($_POST['bwg_search_' . $bwg]) != '') ? esc_html($_POST['bwg_search_' . $bwg]) : '');
60
  if ($bwg_search != '') {
75
  else {
76
  $limit_str = '';
77
  }
78
+ $row = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_image WHERE published=1 ' . $where . ' AND gallery_id="%d" ORDER BY `' . $sort_by . '` ' . $sort_direction . $limit_str, $id));
79
  return $row;
80
  }
81
 
frontend/views/BWGViewAlbum_compact_preview.php CHANGED
@@ -73,10 +73,13 @@ class BWGViewAlbum_compact_preview {
73
  if (!isset($params['popup_hit_counter'])) {
74
  $params['popup_hit_counter'] = 0;
75
  }
 
 
 
76
  $from = (isset($params['from']) ? esc_html($params['from']) : 0);
77
  $type = (isset($_POST['type_' . $bwg]) ? esc_html($_POST['type_' . $bwg]) : (isset($params['type']) ? $params['type'] : 'album'));
78
  $bwg_search = ((isset($_POST['bwg_search_' . $bwg]) && esc_html($_POST['bwg_search_' . $bwg]) != '') ? esc_html($_POST['bwg_search_' . $bwg]) : '');
79
- $sort_direction = ' ASC ';
80
  if ($from === "widget") {
81
  $options_row = $this->model->get_options_row_data();
82
  $params['album_id'] = $params['id'];
@@ -149,7 +152,7 @@ class BWGViewAlbum_compact_preview {
149
  else {
150
  $items_per_page = $params['compuct_albums_per_page'];
151
  $items_col_num = $params['compuct_album_column_number'];
152
- $album_galleries_row = $this->model->get_alb_gals_row($album_gallery_id, $items_per_page, $params['sort_by'], $bwg, $sort_direction);
153
  if (!$album_galleries_row) {
154
  echo WDWLibrary::message(__('There is no album selected or the album was deleted.', 'bwg'), 'error');
155
  return;
73
  if (!isset($params['popup_hit_counter'])) {
74
  $params['popup_hit_counter'] = 0;
75
  }
76
+ if (!isset($params['order_by'])) {
77
+ $params['order_by'] = ' ASC ';
78
+ }
79
  $from = (isset($params['from']) ? esc_html($params['from']) : 0);
80
  $type = (isset($_POST['type_' . $bwg]) ? esc_html($_POST['type_' . $bwg]) : (isset($params['type']) ? $params['type'] : 'album'));
81
  $bwg_search = ((isset($_POST['bwg_search_' . $bwg]) && esc_html($_POST['bwg_search_' . $bwg]) != '') ? esc_html($_POST['bwg_search_' . $bwg]) : '');
82
+ $sort_direction = ' ' . $params['order_by'] . ' ';
83
  if ($from === "widget") {
84
  $options_row = $this->model->get_options_row_data();
85
  $params['album_id'] = $params['id'];
152
  else {
153
  $items_per_page = $params['compuct_albums_per_page'];
154
  $items_col_num = $params['compuct_album_column_number'];
155
+ $album_galleries_row = $this->model->get_alb_gals_row($album_gallery_id, $items_per_page, 'order', $bwg, ' ASC ');
156
  if (!$album_galleries_row) {
157
  echo WDWLibrary::message(__('There is no album selected or the album was deleted.', 'bwg'), 'error');
158
  return;
frontend/views/BWGViewAlbum_extended_preview.php CHANGED
@@ -73,6 +73,10 @@ class BWGViewAlbum_extended_preview {
73
  if (!isset($params['popup_hit_counter'])) {
74
  $params['popup_hit_counter'] = 0;
75
  }
 
 
 
 
76
  $theme_row = $this->model->get_theme_row_data($params['theme_id']);
77
  if (!$theme_row) {
78
  echo WDWLibrary::message(__('There is no theme selected or the theme was deleted.', 'bwg'), 'error');
@@ -88,7 +92,7 @@ class BWGViewAlbum_extended_preview {
88
  if ($type == 'gallery') {
89
  $items_per_page = $params['extended_album_images_per_page'];
90
  $items_col_num = $params['extended_album_image_column_number'];
91
- $image_rows = $this->model->get_image_rows_data($album_gallery_id, $items_per_page, $params['sort_by'], $bwg);
92
  $images_count = count($image_rows);
93
  if (!$image_rows) {
94
  echo WDWLibrary::message(__('There are no images in this gallery.', 'bwg'), 'error');
@@ -100,7 +104,7 @@ class BWGViewAlbum_extended_preview {
100
  else {
101
  $items_per_page = $params['extended_albums_per_page'];
102
  $items_col_num = 1;
103
- $album_galleries_row = $this->model->get_alb_gals_row($album_gallery_id, $items_per_page, $params['sort_by'], $bwg);
104
  if (!$album_galleries_row) {
105
  echo WDWLibrary::message(__('There is no album selected or the album was deleted.', 'bwg'), 'error');
106
  return;
73
  if (!isset($params['popup_hit_counter'])) {
74
  $params['popup_hit_counter'] = 0;
75
  }
76
+ if (!isset($params['order_by'])) {
77
+ $params['order_by'] = ' ASC ';
78
+ }
79
+ $sort_direction = ' ' . $params['order_by'] . ' ';
80
  $theme_row = $this->model->get_theme_row_data($params['theme_id']);
81
  if (!$theme_row) {
82
  echo WDWLibrary::message(__('There is no theme selected or the theme was deleted.', 'bwg'), 'error');
92
  if ($type == 'gallery') {
93
  $items_per_page = $params['extended_album_images_per_page'];
94
  $items_col_num = $params['extended_album_image_column_number'];
95
+ $image_rows = $this->model->get_image_rows_data($album_gallery_id, $items_per_page, $params['sort_by'], $bwg, $sort_direction);
96
  $images_count = count($image_rows);
97
  if (!$image_rows) {
98
  echo WDWLibrary::message(__('There are no images in this gallery.', 'bwg'), 'error');
104
  else {
105
  $items_per_page = $params['extended_albums_per_page'];
106
  $items_col_num = 1;
107
+ $album_galleries_row = $this->model->get_alb_gals_row($album_gallery_id, $items_per_page, 'order', $bwg, ' asc ');
108
  if (!$album_galleries_row) {
109
  echo WDWLibrary::message(__('There is no album selected or the album was deleted.', 'bwg'), 'error');
110
  return;
js/bwg_shortcode.js CHANGED
@@ -355,6 +355,8 @@ function bwg_gallery_type(gallery_type) {
355
  }
356
  case 'album_compact_preview': {
357
  jQuery("#tr_album").css('display', '');
 
 
358
  jQuery("#tr_show_search_box").css('display', '');
359
  jQuery("#tr_compuct_album_column_number").css('display', '');
360
  jQuery("#tr_compuct_albums_per_page").css('display', '');
@@ -376,6 +378,8 @@ function bwg_gallery_type(gallery_type) {
376
  }
377
  case 'album_extended_preview': {
378
  jQuery("#tr_album").css('display', '');
 
 
379
  jQuery("#tr_show_search_box").css('display', '');
380
  jQuery("#tr_extended_albums_per_page").css('display', '');
381
  jQuery("#tr_extended_album_height").css('display', '');
355
  }
356
  case 'album_compact_preview': {
357
  jQuery("#tr_album").css('display', '');
358
+ jQuery("#tr_sort_by").css('display', '');
359
+ jQuery("#tr_order_by").css('display', '');
360
  jQuery("#tr_show_search_box").css('display', '');
361
  jQuery("#tr_compuct_album_column_number").css('display', '');
362
  jQuery("#tr_compuct_albums_per_page").css('display', '');
378
  }
379
  case 'album_extended_preview': {
380
  jQuery("#tr_album").css('display', '');
381
+ jQuery("#tr_sort_by").css('display', '');
382
+ jQuery("#tr_order_by").css('display', '');
383
  jQuery("#tr_show_search_box").css('display', '');
384
  jQuery("#tr_extended_albums_per_page").css('display', '');
385
  jQuery("#tr_extended_album_height").css('display', '');
photo-gallery.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Photo Gallery
5
  * Plugin URI: http://web-dorado.com/products/wordpress-photo-gallery-plugin.html
6
  * 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.
7
- * Version: 1.1.20
8
  * Author: http://web-dorado.com/
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
10
  */
4
  * Plugin Name: Photo Gallery
5
  * Plugin URI: http://web-dorado.com/products/wordpress-photo-gallery-plugin.html
6
  * 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.
7
+ * Version: 1.1.21
8
  * Author: http://web-dorado.com/
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
10
  */
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://web-dorado.com/products/wordpress-photo-gallery-plugin.html
4
  Tags: photo, photo gallery, image gallery, video gallery, gallery, galleries, wordpress gallery plugin, images gallery, album, photo albums, Simple gallery, best gallery plugin, free photo gallery, wp gallery, wordpress gallery, website gallery, gallery shortcode, best gallery, picture, pictures, gallery slider, photo album, photogallery, widget gallery, image, images, photos, gallery lightbox, photoset, wordpress photo gallery plugin, wp gallery plugins, responsive wordpress photo gallery, media, image album, filterable gallery, banner rotator, fullscreen gallery, Fotogalerie, Galleria, galerie, galeri
5
  Requires at least: 3.0
6
  Tested up to: 3.9
7
- Stable tag: 1.1.20
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -169,6 +169,10 @@ If any problem occurs, please contact us at [info@web-dorado.com](mailto:info@w
169
  6. Photo Gallery - Edit Watermark
170
 
171
  == Changelog ==
 
 
 
 
172
  = 1.1.20 =
173
  * bug fixed on lightbox
174
 
4
  Tags: photo, photo gallery, image gallery, video gallery, gallery, galleries, wordpress gallery plugin, images gallery, album, photo albums, Simple gallery, best gallery plugin, free photo gallery, wp gallery, wordpress gallery, website gallery, gallery shortcode, best gallery, picture, pictures, gallery slider, photo album, photogallery, widget gallery, image, images, photos, gallery lightbox, photoset, wordpress photo gallery plugin, wp gallery plugins, responsive wordpress photo gallery, media, image album, filterable gallery, banner rotator, fullscreen gallery, Fotogalerie, Galleria, galerie, galeri
5
  Requires at least: 3.0
6
  Tested up to: 3.9
7
+ Stable tag: 1.1.21
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
169
  6. Photo Gallery - Edit Watermark
170
 
171
  == Changelog ==
172
+
173
+ = 1.1.21 =
174
+ * added option for sorting gallery images within album
175
+
176
  = 1.1.20 =
177
  * bug fixed on lightbox
178