Photo Gallery by WD – Responsive Photo Gallery - Version 1.3.14

Version Description

  • Fixed: Social Bulk Embed bug for facebook.
  • Fixed: Add facebook album bug.
  • Added: Tag select from shortcode.
  • Fixed: Improved tag search.
Download this release

Release Info

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

Code changes from version 1.3.13 to 1.3.14

addons/style.css CHANGED
@@ -17,9 +17,13 @@
17
 
18
  #settings-content .ecwd_coming_soon {
19
  position: absolute;
20
- top: 44px;
21
  left: 0;
22
- height: 100%;
 
 
 
 
23
  }
24
 
25
  #settings-content .add-on a {
@@ -27,11 +31,12 @@
27
  }
28
 
29
  #settings-content .add-on h2 {
30
- color: #229DBF;
31
  font-size: 16px;
32
- margin-bottom: 9px;
33
- padding: 0 0 7px;
34
  line-height: 1.2;
 
 
35
  }
36
 
37
  #settings-content .addon-descr {
17
 
18
  #settings-content .ecwd_coming_soon {
19
  position: absolute;
20
+ top: 38px;
21
  left: 0;
22
+ height: 232px;
23
+ }
24
+
25
+ #settings-content .ecwd_coming_soon img {
26
+ padding-top: 11px;
27
  }
28
 
29
  #settings-content .add-on a {
31
  }
32
 
33
  #settings-content .add-on h2 {
34
+ color: #229dbf;
35
  font-size: 16px;
36
+ height: 20px;
 
37
  line-height: 1.2;
38
+ margin: 9px 0;
39
+ padding: 0;
40
  }
41
 
42
  #settings-content .addon-descr {
admin/models/BWGModelBWGShortcode.php CHANGED
@@ -45,20 +45,20 @@ class BWGModelBWGShortcode {
45
  return $rows;
46
  }
47
 
48
- public function get_option_row_data() {
49
  global $wpdb;
50
- $query = "SELECT * FROM " . $wpdb->prefix . "bwg_option WHERE id=1";
51
- $rows = $wpdb->get_row($query);
52
  return $rows;
53
  }
54
 
55
- public function get_theme_rows_data() {
56
  global $wpdb;
57
- $query = "SELECT * FROM " . $wpdb->prefix . "bwg_theme ORDER BY name";
58
  $rows = $wpdb->get_results($query);
59
  return $rows;
60
  }
61
-
62
  ////////////////////////////////////////////////////////////////////////////////////////
63
  // Getters & Setters //
64
  ////////////////////////////////////////////////////////////////////////////////////////
45
  return $rows;
46
  }
47
 
48
+ public function get_theme_rows_data() {
49
  global $wpdb;
50
+ $query = "SELECT * FROM " . $wpdb->prefix . "bwg_theme ORDER BY name";
51
+ $rows = $wpdb->get_results($query);
52
  return $rows;
53
  }
54
 
55
+ public function get_tag_rows_data() {
56
  global $wpdb;
57
+ $query ="SELECT * FROM ".$wpdb->prefix."terms as A LEFT JOIN ".$wpdb->prefix ."term_taxonomy as B ON A.term_id = B.term_id WHERE B.taxonomy='bwg_tag'";
58
  $rows = $wpdb->get_results($query);
59
  return $rows;
60
  }
61
+
62
  ////////////////////////////////////////////////////////////////////////////////////////
63
  // Getters & Setters //
64
  ////////////////////////////////////////////////////////////////////////////////////////
admin/models/BWGModelGalleries_bwg.php CHANGED
@@ -160,12 +160,6 @@ class BWGModelGalleries_bwg {
160
  return $page_nav;
161
  }
162
 
163
- public function get_option_row_data() {
164
- global $wpdb;
165
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_option WHERE id="%d"', 1));
166
- return $row;
167
- }
168
-
169
  public function get_images_count($gallery_id) {
170
  global $wpdb;
171
  if (!current_user_can('manage_options') && $wpdb->get_var("SELECT image_role FROM " . $wpdb->prefix . "bwg_option")) {
160
  return $page_nav;
161
  }
162
 
 
 
 
 
 
 
163
  public function get_images_count($gallery_id) {
164
  global $wpdb;
165
  if (!current_user_can('manage_options') && $wpdb->get_var("SELECT image_role FROM " . $wpdb->prefix . "bwg_option")) {
admin/models/BWGModelWidgetSlideshow.php CHANGED
@@ -32,12 +32,6 @@ class BWGModelWidgetSlideshow {
32
  $rows = $wpdb->get_results($query);
33
  return $rows;
34
  }
35
-
36
- public function get_options_row_data() {
37
- global $wpdb;
38
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_option WHERE id="%d"', 1));
39
- return $row;
40
- }
41
 
42
  ////////////////////////////////////////////////////////////////////////////////////////
43
  // Getters & Setters //
32
  $rows = $wpdb->get_results($query);
33
  return $rows;
34
  }
 
 
 
 
 
 
35
 
36
  ////////////////////////////////////////////////////////////////////////////////////////
37
  // Getters & Setters //
admin/views/BWGViewBWGShortcode.php CHANGED
@@ -25,11 +25,12 @@ class BWGViewBWGShortcode {
25
  public function display() {
26
  $gallery_rows = $this->model->get_gallery_rows_data();
27
  $album_rows = $this->model->get_album_rows_data();
28
- $option_row = $this->model->get_option_row_data();
29
  $theme_rows = $this->model->get_theme_rows_data();
30
  $from_menu = ((isset($_GET['page']) && (esc_html($_GET['page']) == 'BWGShortcode')) ? TRUE : FALSE);
31
  $shortcodes = $this->model->get_shortcode_data();
32
  $shortcode_max_id = $this->model->get_shortcode_max_id();
 
33
  $effects = array(
34
  'none' => __('None','bwg_back'),
35
  'cubeH' => __('Cube Horizontal','bwg_back'),
@@ -219,6 +220,21 @@ class BWGViewBWGShortcode {
219
  <option value="random"><?php _e("Random", 'bwg_back'); ?></option>
220
  </select>
221
  </td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222
  </tr>
223
  <tr id="tr_order_by">
224
  <td class="spider_label"><label><?php _e("Order images", 'bwg_back'); ?>: </label></td>
@@ -1126,6 +1142,7 @@ class BWGViewBWGShortcode {
1126
  case 'thumbnails': {
1127
  jQuery("select[id=gallery] option[value='" + short_code['gallery_id'] + "']").attr('selected', 'selected');
1128
  jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
 
1129
  if (short_code['order_by'] == 'asc') {
1130
  jQuery("#order_by_1").attr('checked', 'checked');
1131
  }
@@ -1179,6 +1196,7 @@ class BWGViewBWGShortcode {
1179
  case 'slideshow': {
1180
  jQuery("select[id=gallery] option[value='" + short_code['gallery_id'] + "']").attr('selected', 'selected');
1181
  jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
 
1182
  if (short_code['order_by'] == 'asc') {
1183
  jQuery("#order_by_1").attr('checked', 'checked');
1184
  }
@@ -1246,6 +1264,7 @@ class BWGViewBWGShortcode {
1246
  case 'image_browser': {
1247
  jQuery("select[id=gallery] option[value='" + short_code['gallery_id'] + "']").attr('selected', 'selected');
1248
  jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
 
1249
  if (short_code['order_by'] == 'asc') {
1250
  jQuery("#order_by_1").attr('checked', 'checked');
1251
  }
@@ -1670,6 +1689,7 @@ class BWGViewBWGShortcode {
1670
  title = ' gal_title="' + jQuery.trim(jQuery('#gallery option:selected').text().replace("'", "").replace('"', '')) + '"';
1671
  tagtext += ' load_more_image_count="' + jQuery("#load_more_image_count").val() + '"';
1672
  tagtext += ' show_tag_box="' + jQuery("input[name=show_tag_box]:checked").val() + '"';
 
1673
  break;
1674
 
1675
  }
@@ -1695,6 +1715,7 @@ class BWGViewBWGShortcode {
1695
  tagtext += ' slideshow_music_url="' + jQuery("#slideshow_music_url").val() + '"';
1696
  title = ' gal_title="' + jQuery.trim(jQuery('#gallery option:selected').text().replace("'", "").replace('"', '')) + '"';
1697
  tagtext += ' slideshow_effect_duration="' + jQuery("#slideshow_effect_duration").val() + '"';
 
1698
  break;
1699
 
1700
  }
@@ -1708,6 +1729,7 @@ class BWGViewBWGShortcode {
1708
  tagtext += ' image_browser_title_enable="' + jQuery("input[name=image_browser_title_enable]:checked").val() + '"';
1709
  tagtext += ' image_browser_description_enable="' + jQuery("input[name=image_browser_description_enable]:checked").val() + '"';
1710
  title = ' gal_title="' + jQuery.trim(jQuery('#gallery option:selected').text().replace("'", "").replace('"', '')) + '"';
 
1711
  break;
1712
 
1713
  }
25
  public function display() {
26
  $gallery_rows = $this->model->get_gallery_rows_data();
27
  $album_rows = $this->model->get_album_rows_data();
28
+ $option_row = WDWLibrary::get_options_row_data();
29
  $theme_rows = $this->model->get_theme_rows_data();
30
  $from_menu = ((isset($_GET['page']) && (esc_html($_GET['page']) == 'BWGShortcode')) ? TRUE : FALSE);
31
  $shortcodes = $this->model->get_shortcode_data();
32
  $shortcode_max_id = $this->model->get_shortcode_max_id();
33
+ $tag_rows = $this->model->get_tag_rows_data();
34
  $effects = array(
35
  'none' => __('None','bwg_back'),
36
  'cubeH' => __('Cube Horizontal','bwg_back'),
220
  <option value="random"><?php _e("Random", 'bwg_back'); ?></option>
221
  </select>
222
  </td>
223
+ </tr>
224
+ <tr id="tr_tag">
225
+ <td class="spider_label"><label for="gallery"><?php echo __('Tag:', 'bwg_back'); ?> </label></td>
226
+ <td>
227
+ <select name="tag" id="tag" class="select_icon" style="width:150px;">
228
+ <option value="0" selected="selected"><?php echo __('Select Tag', 'bwg_back'); ?></option>
229
+ <?php
230
+ foreach ($tag_rows as $tag_row) {
231
+ ?>
232
+ <option value="<?php echo $tag_row->term_id; ?>"><?php echo $tag_row->name; ?></option>
233
+ <?php
234
+ }
235
+ ?>
236
+ </select>
237
+ </td>
238
  </tr>
239
  <tr id="tr_order_by">
240
  <td class="spider_label"><label><?php _e("Order images", 'bwg_back'); ?>: </label></td>
1142
  case 'thumbnails': {
1143
  jQuery("select[id=gallery] option[value='" + short_code['gallery_id'] + "']").attr('selected', 'selected');
1144
  jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
1145
+ jQuery("select[id=tag] option[value='" + short_code['tag'] + "']").attr('selected', 'selected');
1146
  if (short_code['order_by'] == 'asc') {
1147
  jQuery("#order_by_1").attr('checked', 'checked');
1148
  }
1196
  case 'slideshow': {
1197
  jQuery("select[id=gallery] option[value='" + short_code['gallery_id'] + "']").attr('selected', 'selected');
1198
  jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
1199
+ jQuery("select[id=tag] option[value='" + short_code['tag'] + "']").attr('selected', 'selected');
1200
  if (short_code['order_by'] == 'asc') {
1201
  jQuery("#order_by_1").attr('checked', 'checked');
1202
  }
1264
  case 'image_browser': {
1265
  jQuery("select[id=gallery] option[value='" + short_code['gallery_id'] + "']").attr('selected', 'selected');
1266
  jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
1267
+ jQuery("select[id=tag] option[value='" + short_code['tag'] + "']").attr('selected', 'selected');
1268
  if (short_code['order_by'] == 'asc') {
1269
  jQuery("#order_by_1").attr('checked', 'checked');
1270
  }
1689
  title = ' gal_title="' + jQuery.trim(jQuery('#gallery option:selected').text().replace("'", "").replace('"', '')) + '"';
1690
  tagtext += ' load_more_image_count="' + jQuery("#load_more_image_count").val() + '"';
1691
  tagtext += ' show_tag_box="' + jQuery("input[name=show_tag_box]:checked").val() + '"';
1692
+ tagtext += ' tag="' + jQuery("#tag").val() + '"';
1693
  break;
1694
 
1695
  }
1715
  tagtext += ' slideshow_music_url="' + jQuery("#slideshow_music_url").val() + '"';
1716
  title = ' gal_title="' + jQuery.trim(jQuery('#gallery option:selected').text().replace("'", "").replace('"', '')) + '"';
1717
  tagtext += ' slideshow_effect_duration="' + jQuery("#slideshow_effect_duration").val() + '"';
1718
+ tagtext += ' tag="' + jQuery("#tag").val() + '"';
1719
  break;
1720
 
1721
  }
1729
  tagtext += ' image_browser_title_enable="' + jQuery("input[name=image_browser_title_enable]:checked").val() + '"';
1730
  tagtext += ' image_browser_description_enable="' + jQuery("input[name=image_browser_description_enable]:checked").val() + '"';
1731
  title = ' gal_title="' + jQuery.trim(jQuery('#gallery option:selected').text().replace("'", "").replace('"', '')) + '"';
1732
+ tagtext += ' tag="' + jQuery("#tag").val() + '"';
1733
  break;
1734
 
1735
  }
admin/views/BWGViewGalleries_bwg.php CHANGED
@@ -218,8 +218,8 @@ class BWGViewGalleries_bwg {
218
  public function edit($id) {
219
  global $WD_BWG_UPLOAD_DIR;
220
  $row = $this->model->get_row_data($id);
221
- $option_row = $this->model->get_option_row_data();
222
- $page_title = (($id != 0) ? __("Edit gallery ", 'bwg_back'). $row->name : __("Create new gallery", 'bwg_back'));
223
  $per_page = $this->model->per_page();
224
  $images_count = $this->model->get_images_count($id);
225
  ?>
@@ -697,7 +697,7 @@ class BWGViewGalleries_bwg {
697
  global $WD_BWG_UPLOAD_DIR;
698
  $rows_data = $this->model->get_image_rows_data($id);
699
  $page_nav = $this->model->image_page_nav($id);
700
- $option_row = $this->model->get_option_row_data();
701
  $search_value = ((isset($_POST['search_value'])) ? esc_html(stripslashes($_POST['search_value'])) : '');
702
  $image_asc_or_desc = ((isset($_POST['image_asc_or_desc'])) ? esc_html(stripslashes($_POST['image_asc_or_desc'])) : ((isset($_COOKIE['bwg_image_asc_or_desc'])) ? esc_html(stripslashes($_COOKIE['bwg_image_asc_or_desc'])) : 'asc'));
703
  $image_order_by = ((isset($_POST['image_order_by'])) ? esc_html(stripslashes($_POST['image_order_by'])) : ((isset($_COOKIE['bwg_image_order_by'])) ? esc_html(stripslashes($_COOKIE['bwg_image_order_by'])) : 'order'));
218
  public function edit($id) {
219
  global $WD_BWG_UPLOAD_DIR;
220
  $row = $this->model->get_row_data($id);
221
+ $option_row = WDWLibrary::get_options_row_data();
222
+ $page_title = (($id != 0) ? __('Edit gallery','bwg_back') . $row->name : __('Create new gallery','bwg_back'));
223
  $per_page = $this->model->per_page();
224
  $images_count = $this->model->get_images_count($id);
225
  ?>
697
  global $WD_BWG_UPLOAD_DIR;
698
  $rows_data = $this->model->get_image_rows_data($id);
699
  $page_nav = $this->model->image_page_nav($id);
700
+ $option_row = WDWLibrary::get_options_row_data();
701
  $search_value = ((isset($_POST['search_value'])) ? esc_html(stripslashes($_POST['search_value'])) : '');
702
  $image_asc_or_desc = ((isset($_POST['image_asc_or_desc'])) ? esc_html(stripslashes($_POST['image_asc_or_desc'])) : ((isset($_COOKIE['bwg_image_asc_or_desc'])) ? esc_html(stripslashes($_COOKIE['bwg_image_asc_or_desc'])) : 'asc'));
703
  $image_order_by = ((isset($_POST['image_order_by'])) ? esc_html(stripslashes($_POST['image_order_by'])) : ((isset($_COOKIE['bwg_image_order_by'])) ? esc_html(stripslashes($_COOKIE['bwg_image_order_by'])) : 'order'));
admin/views/BWGViewWidgetSlideshow.php CHANGED
@@ -101,7 +101,7 @@ class BWGViewWidgetSlideshow {
101
  $instance = wp_parse_args((array) $instance, $defaults);
102
  $gallery_rows = $this->model->get_gallery_rows_data();
103
  $theme_rows = $this->model->get_theme_rows_data();
104
- $options_row = $this->model->get_options_row_data();
105
  ?>
106
  <p>
107
  <label for="<?php echo $id_title; ?>"><?php _e("Title:", 'bwg_back'); ?></label>
101
  $instance = wp_parse_args((array) $instance, $defaults);
102
  $gallery_rows = $this->model->get_gallery_rows_data();
103
  $theme_rows = $this->model->get_theme_rows_data();
104
+ $options_row = WDWLibrary::get_options_row_data();
105
  ?>
106
  <p>
107
  <label for="<?php echo $id_title; ?>"><?php _e("Title:", 'bwg_back'); ?></label>
framework/WDWLibrary.php CHANGED
@@ -871,7 +871,7 @@ class WDWLibrary {
871
  <option <?php if ($sort_by == 'default') echo 'selected'; ?> value="default"><?php echo __('Default', 'bwg'); ?></option>
872
  <option <?php if ($sort_by == 'filename') echo 'selected'; ?> value="filename"><?php echo __('Filename', 'bwg'); ?></option>
873
  <option <?php if ($sort_by == 'size') echo 'selected'; ?> value="size"><?php echo __('Size', 'bwg'); ?></option>
874
- <option <?php if ($sort_by == 'RAND()') echo 'selected'; ?> value="random"><?php echo __('Random', 'bwg'); ?></option>
875
  </select>
876
  </div>
877
  <?php
@@ -910,7 +910,6 @@ class WDWLibrary {
910
  */
911
 
912
  public static function delimit_wd_output($data) {
913
-
914
  if(is_string ( $data )){
915
  return "WD_delimiter_start". $data . "WD_delimiter_end";
916
  }
@@ -961,6 +960,172 @@ class WDWLibrary {
961
  return $escaped_value;
962
  }
963
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
964
  ////////////////////////////////////////////////////////////////////////////////////////
965
  // Private Methods //
966
  ////////////////////////////////////////////////////////////////////////////////////////
871
  <option <?php if ($sort_by == 'default') echo 'selected'; ?> value="default"><?php echo __('Default', 'bwg'); ?></option>
872
  <option <?php if ($sort_by == 'filename') echo 'selected'; ?> value="filename"><?php echo __('Filename', 'bwg'); ?></option>
873
  <option <?php if ($sort_by == 'size') echo 'selected'; ?> value="size"><?php echo __('Size', 'bwg'); ?></option>
874
+ <option <?php if ($sort_by == 'random' || $sort_by == 'RAND()') echo 'selected'; ?> value="random"><?php echo __('Random', 'bwg'); ?></option>
875
  </select>
876
  </div>
877
  <?php
910
  */
911
 
912
  public static function delimit_wd_output($data) {
 
913
  if(is_string ( $data )){
914
  return "WD_delimiter_start". $data . "WD_delimiter_end";
915
  }
960
  return $escaped_value;
961
  }
962
 
963
+ public static function get_theme_row_data($id) {
964
+ global $wpdb;
965
+ if ($id) {
966
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_theme WHERE id="%d"', $id));
967
+ }
968
+ else {
969
+ $row = $wpdb->get_row('SELECT * FROM ' . $wpdb->prefix . 'bwg_theme WHERE default_theme=1');
970
+ }
971
+ if (isset($row->options)) {
972
+ $row = (object) array_merge((array) $row, (array) json_decode($row->options));
973
+ }
974
+ return $row;
975
+ }
976
+
977
+ public static function get_gallery_row_data($id, $from = '') {
978
+ global $wpdb;
979
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_gallery WHERE published=1 AND id="%d"', $id));
980
+ if ($row) {
981
+ if ($from != '') {
982
+ $row->permalink = self::bwg_create_post($row->name, $row->slug, array("type" => "gallery", "mode" => $from), $id);
983
+ }
984
+ }
985
+ else {
986
+ $row = new stdClass();
987
+ $row->name = '';
988
+ }
989
+ return $row;
990
+ }
991
+
992
+ public static function get_options_row_data() {
993
+ global $wpdb;
994
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_option WHERE id="%d"', 1));
995
+ return $row;
996
+ }
997
+
998
+ public static function get_tags_rows_data($gallery_id) {
999
+ global $wpdb;
1000
+ $row = $wpdb->get_results('Select t1.* FROM ' . $wpdb->prefix . 'terms AS t1 LEFT JOIN ' . $wpdb->prefix . 'term_taxonomy AS t2 ON t1.term_id = t2.term_id' . ($gallery_id ? ' LEFT JOIN (SELECT DISTINCT tag_id , gallery_id FROM ' . $wpdb->prefix . 'bwg_image_tag) AS t3 ON t1.term_id=t3.tag_id' : '') . ' WHERE taxonomy="bwg_tag"' . ($gallery_id ? ' AND t3.gallery_id="' . $gallery_id . '"' : ''));
1001
+ return $row;
1002
+ }
1003
+
1004
+ public static function bwg_create_post($title, $slug, $type, $id) {
1005
+ $post_type = 'bwg_' . $type['type'];
1006
+ $bwg_post_id = get_page_by_title($title, OBJECT, $post_type);
1007
+ $options_row = self::get_options_row_data();
1008
+ $theme_row = self::get_theme_row_data(0);
1009
+ switch ($type['mode']) {
1010
+ case 'compact':
1011
+ $shortecode_string = '[Best_Wordpress_Gallery type="' . $type['type'] . '" gallery_type="album_compact_preview" theme_id="' . $theme_row->id . '" album_id="' . $id . '" sort_by="order" order_by="asc" compuct_album_column_number="' . $options_row->album_column_number . '" compuct_albums_per_page="' . $options_row->albums_per_page . '" compuct_album_title="' . $options_row->album_title_show_hover . '" compuct_album_view_type="' . $options_row->album_view_type . '" compuct_album_thumb_width="' . $options_row->album_thumb_width . '" compuct_album_thumb_height="' . $options_row->album_thumb_height . '" compuct_album_image_column_number="' . $options_row->image_column_number . '" compuct_album_images_per_page="' . $options_row->images_per_page . '" compuct_album_image_title="' . $options_row->image_title_show_hover . '" compuct_album_image_thumb_width="' . $options_row->thumb_width . '" compuct_album_image_thumb_height="' . $options_row->thumb_height . '" compuct_album_enable_page="' . $options_row->album_enable_page . '" popup_fullscreen="' . $options_row->popup_fullscreen . '" popup_autoplay="' . $options_row->popup_autoplay . '" popup_width="' . $options_row->popup_width . '" popup_height="' . $options_row->popup_height . '" popup_effect="' . $options_row->popup_type . '" popup_interval="' . $options_row->popup_interval . '" popup_enable_filmstrip="' . $options_row->popup_enable_filmstrip . '" popup_filmstrip_height="' . $options_row->popup_filmstrip_height . '" popup_enable_ctrl_btn="' . $options_row->popup_enable_ctrl_btn . '" popup_enable_fullscreen="' . $options_row->popup_enable_fullscreen . '" popup_enable_comment="' . $options_row->popup_enable_comment . '" popup_enable_facebook="' . $options_row->popup_enable_facebook . '" popup_enable_twitter="' . $options_row->popup_enable_twitter . '" popup_enable_google="' . $options_row->popup_enable_google . '" popup_enable_pinterest="' . $options_row->popup_enable_pinterest . '" popup_enable_tumblr="' . $options_row->popup_enable_tumblr . '" watermark_type="' . $options_row->watermark_type . '" watermark_link="' . $options_row->watermark_link . '" watermark_text="' . $options_row->watermark_text . '" watermark_font_size="' . $options_row->watermark_font_size . '" watermark_font="' . $options_row->watermark_font . '" watermark_color="' . $options_row->watermark_color . '" watermark_opacity="' . $options_row->watermark_opacity . '" watermark_position="' . $options_row->watermark_position . '" watermark_url="' . $options_row->watermark_url . '" watermark_width="' . $options_row->watermark_width . '" watermark_height="' . $options_row->watermark_height . '" show_search_box="' . $options_row->show_search_box . '" search_box_width="' . $options_row->search_box_width . '" popup_enable_info="' . $options_row->popup_enable_info . '" popup_info_always_show="' . $options_row->popup_info_always_show . '" popup_enable_rate="' . $options_row->popup_enable_rate . '" popup_hit_counter="' . $options_row->popup_hit_counter . '"]';
1012
+ break;
1013
+ case 'masonry':
1014
+ $shortecode_string = '[Best_Wordpress_Gallery type="' . $type['type'] . '" gallery_type="album_masonry_preview" theme_id="' . $theme_row->id . '" album_id="' . $id . '" sort_by="order" order_by="asc" masonry_album_column_number="' . $options_row->album_column_number . '" masonry_albums_per_page="' . $options_row->albums_per_page . '" masonry_album_title="' . $options_row->album_title_show_hover . '" masonry_album_thumb_width="' . $options_row->album_thumb_width . '" masonry_album_thumb_height="' . $options_row->album_thumb_height . '" masonry_album_image_column_number="' . $options_row->image_column_number . '" masonry_album_images_per_page="' . $options_row->images_per_page . '" masonry_album_image_title="' . $options_row->image_title_show_hover . '" masonry_album_image_thumb_width="' . $options_row->thumb_width . '" masonry_album_image_thumb_height="' . $options_row->thumb_height . '" masonry_album_enable_page="' . $options_row->album_enable_page . '" popup_fullscreen="' . $options_row->popup_fullscreen . '" popup_autoplay="' . $options_row->popup_autoplay . '" popup_width="' . $options_row->popup_width . '" popup_height="' . $options_row->popup_height . '" popup_effect="' . $options_row->popup_type . '" popup_interval="' . $options_row->popup_interval . '" popup_enable_filmstrip="' . $options_row->popup_enable_filmstrip . '" popup_filmstrip_height="' . $options_row->popup_filmstrip_height . '" popup_enable_ctrl_btn="' . $options_row->popup_enable_ctrl_btn . '" popup_enable_fullscreen="' . $options_row->popup_enable_fullscreen . '" popup_enable_comment="' . $options_row->popup_enable_comment . '" popup_enable_facebook="' . $options_row->popup_enable_facebook . '" popup_enable_twitter="' . $options_row->popup_enable_twitter . '" popup_enable_google="' . $options_row->popup_enable_google . '" popup_enable_pinterest="' . $options_row->popup_enable_pinterest . '" popup_enable_tumblr="' . $options_row->popup_enable_tumblr . '" watermark_type="' . $options_row->watermark_type . '" watermark_link="' . $options_row->watermark_link . '" watermark_text="' . $options_row->watermark_text . '" watermark_font_size="' . $options_row->watermark_font_size . '" watermark_font="' . $options_row->watermark_font . '" watermark_color="' . $options_row->watermark_color . '" watermark_opacity="' . $options_row->watermark_opacity . '" watermark_position="' . $options_row->watermark_position . '" watermark_url="' . $options_row->watermark_url . '" watermark_width="' . $options_row->watermark_width . '" watermark_height="' . $options_row->watermark_height . '" show_search_box="' . $options_row->show_search_box . '" search_box_width="' . $options_row->search_box_width . '" popup_enable_info="' . $options_row->popup_enable_info . '" popup_info_always_show="' . $options_row->popup_info_always_show . '" popup_enable_rate="' . $options_row->popup_enable_rate . '" popup_hit_counter="' . $options_row->popup_hit_counter . '"]';
1015
+ break;
1016
+ case 'tag':
1017
+ $shortecode_string = '[Best_Wordpress_Gallery type="' . $type['type'] . '" gallery_type="thumbnails" theme_id="' . $theme_row->id . '" gallery_id="" tag="' . $id . '" sort_by="date" order_by="asc" image_column_number="' . $options_row->image_column_number . '" images_per_page="' . $options_row->images_per_page . '" image_title="' . $options_row->image_title_show_hover . '" image_enable_page="' . $options_row->image_enable_page . '" thumb_width="' . $options_row->thumb_width . '" thumb_height="' . $options_row->thumb_height . '" popup_fullscreen="' . $options_row->popup_fullscreen . '" popup_autoplay="' . $options_row->popup_autoplay . '" popup_width="' . $options_row->popup_width . '" popup_height="' . $options_row->popup_height . '" popup_effect="' . $options_row->popup_type . '" popup_interval="' . $options_row->popup_interval . '" popup_enable_filmstrip="' . $options_row->popup_enable_filmstrip . '" popup_filmstrip_height="' . $options_row->popup_filmstrip_height . '" popup_enable_ctrl_btn="' . $options_row->popup_enable_ctrl_btn . '" popup_enable_fullscreen="' . $options_row->popup_enable_fullscreen . '" popup_enable_comment="' . $options_row->popup_enable_comment . '" popup_enable_facebook="' . $options_row->popup_enable_facebook . '" popup_enable_twitter="' . $options_row->popup_enable_twitter . '" popup_enable_google="' . $options_row->popup_enable_google . '" popup_enable_pinterest="' . $options_row->popup_enable_pinterest . '" popup_enable_tumblr="' . $options_row->popup_enable_tumblr . '" watermark_type="' . $options_row->watermark_type . '" watermark_link="' . $options_row->watermark_link . '" watermark_text="' . $options_row->watermark_text . '" watermark_font_size="' . $options_row->watermark_font_size . '" watermark_font="' . $options_row->watermark_font . '" watermark_color="' . $options_row->watermark_color . '" watermark_opacity="' . $options_row->watermark_opacity . '" watermark_position="' . $options_row->watermark_position . '" watermark_url="' . $options_row->watermark_url . '" watermark_width="' . $options_row->watermark_width . '" watermark_height="' . $options_row->watermark_height . '" show_search_box="' . $options_row->show_search_box . '" search_box_width="' . $options_row->search_box_width . '" popup_enable_info="' . $options_row->popup_enable_info . '" popup_info_always_show="' . $options_row->popup_info_always_show . '" popup_enable_rate="' . $options_row->popup_enable_rate . '" popup_hit_counter="' . $options_row->popup_hit_counter . '" thumb_click_action="' . $options_row->thumb_click_action . '" thumb_link_target="' . $options_row->thumb_link_target . '"]';
1018
+ break;
1019
+ default:
1020
+ $shortecode_string = '[Best_Wordpress_Gallery type="' . $type['type'] . '" gallery_type="thumbnails" theme_id="' . $theme_row->id . '" gallery_id="' . $id . '" sort_by="date" order_by="asc" image_column_number="' . $options_row->image_column_number . '" images_per_page="' . $options_row->images_per_page . '" image_title="' . $options_row->image_title_show_hover . '" image_enable_page="' . $options_row->image_enable_page . '" thumb_width="' . $options_row->thumb_width . '" thumb_height="' . $options_row->thumb_height . '" popup_fullscreen="' . $options_row->popup_fullscreen . '" popup_autoplay="' . $options_row->popup_autoplay . '" popup_width="' . $options_row->popup_width . '" popup_height="' . $options_row->popup_height . '" popup_effect="' . $options_row->popup_type . '" popup_interval="' . $options_row->popup_interval . '" popup_enable_filmstrip="' . $options_row->popup_enable_filmstrip . '" popup_filmstrip_height="' . $options_row->popup_filmstrip_height . '" popup_enable_ctrl_btn="' . $options_row->popup_enable_ctrl_btn . '" popup_enable_fullscreen="' . $options_row->popup_enable_fullscreen . '" popup_enable_comment="' . $options_row->popup_enable_comment . '" popup_enable_facebook="' . $options_row->popup_enable_facebook . '" popup_enable_twitter="' . $options_row->popup_enable_twitter . '" popup_enable_google="' . $options_row->popup_enable_google . '" popup_enable_pinterest="' . $options_row->popup_enable_pinterest . '" popup_enable_tumblr="' . $options_row->popup_enable_tumblr . '" watermark_type="' . $options_row->watermark_type . '" watermark_link="' . $options_row->watermark_link . '" watermark_text="' . $options_row->watermark_text . '" watermark_font_size="' . $options_row->watermark_font_size . '" watermark_font="' . $options_row->watermark_font . '" watermark_color="' . $options_row->watermark_color . '" watermark_opacity="' . $options_row->watermark_opacity . '" watermark_position="' . $options_row->watermark_position . '" watermark_url="' . $options_row->watermark_url . '" watermark_width="' . $options_row->watermark_width . '" watermark_height="' . $options_row->watermark_height . '" show_search_box="' . $options_row->show_search_box . '" search_box_width="' . $options_row->search_box_width . '" popup_enable_info="' . $options_row->popup_enable_info . '" popup_info_always_show="' . $options_row->popup_info_always_show . '" popup_enable_rate="' . $options_row->popup_enable_rate . '" popup_hit_counter="' . $options_row->popup_hit_counter . '" thumb_click_action="' . $options_row->thumb_click_action . '" thumb_link_target="' . $options_row->thumb_link_target . '"]';
1021
+ break;
1022
+ }
1023
+ if (!$bwg_post_id) {
1024
+ $post = array(
1025
+ 'post_content' => $shortecode_string,
1026
+ 'post_name' => $slug,
1027
+ 'post_status' => 'publish',
1028
+ 'post_title' => $title,
1029
+ 'post_type' => $post_type
1030
+ );
1031
+ wp_insert_post($post);
1032
+ }
1033
+ else {
1034
+ $bwg_post_id->post_name = $slug;
1035
+ $bwg_post_id->post_content = $shortecode_string;
1036
+ wp_update_post($bwg_post_id);
1037
+ }
1038
+ $bwg_post_id = get_page_by_title($title, OBJECT, $post_type);
1039
+ return get_permalink($bwg_post_id->ID);
1040
+ }
1041
+
1042
+ public static function get_image_rows_data($gallery_id, $bwg, $type, $tag_input_name, $tag, $images_per_page, $load_more_image_count, $sort_by, $sort_direction = 'ASC') {
1043
+ $gallery_id = (int) $gallery_id;
1044
+ $tag = (int) $tag;
1045
+ global $wpdb;
1046
+ $bwg_search = ((isset($_POST['bwg_search_' . $bwg]) && esc_html($_POST['bwg_search_' . $bwg]) != '') ? esc_html($_POST['bwg_search_' . $bwg]) : '');
1047
+ $join = '';
1048
+ $where = '';
1049
+ if ($bwg_search) {
1050
+ $where = 'AND (image.alt LIKE "%%' . $bwg_search . '%%" OR image.description LIKE "%%' . $bwg_search . '%%")';
1051
+ }
1052
+ if ($sort_by == 'size' || $sort_by == 'resolution') {
1053
+ $sort_by = ' CAST(image.' . $sort_by . ' AS SIGNED) ';
1054
+ }
1055
+ elseif ($sort_by == 'random' || $sort_by == 'RAND()') {
1056
+ $sort_by = 'RAND()';
1057
+ }
1058
+ elseif (($sort_by != 'alt') && ($sort_by != 'date') && ($sort_by != 'filetype') && ($sort_by != 'RAND()') && ($sort_by != 'filename')) {
1059
+ $sort_by = 'image.`order`';
1060
+ }
1061
+ else {
1062
+ $sort_by = 'image.' . $sort_by;
1063
+ }
1064
+ $items_in_page = $images_per_page;
1065
+ $limit = 0;
1066
+ if (isset($_REQUEST['page_number_' . $bwg]) && $_REQUEST['page_number_' . $bwg]) {
1067
+ if ($_REQUEST['page_number_' . $bwg] > 1) {
1068
+ $items_in_page = $load_more_image_count;
1069
+ }
1070
+ $limit = (((int) $_REQUEST['page_number_' . $bwg] - 2) * $items_in_page) + $images_per_page;
1071
+ }
1072
+ $limit_str = '';
1073
+ if ($images_per_page) {
1074
+ $limit_str = 'LIMIT ' . $limit . ',' . $items_in_page;
1075
+ }
1076
+
1077
+ $where .= ($gallery_id ? ' AND image.gallery_id = "' . $gallery_id . '" ' : '') . ($tag ? ' AND tag.tag_id = "' . $tag . '" ' : '');
1078
+ $join = $tag ? 'LEFT JOIN ' . $wpdb->prefix . 'bwg_image_tag as tag ON image.id=tag.image_id' : '';
1079
+
1080
+ if (isset($_REQUEST[$tag_input_name]) && $_REQUEST[$tag_input_name]){
1081
+ $join .= ' LEFT JOIN (SELECT GROUP_CONCAT(tag_id SEPARATOR ",") AS tags_combined, image_id FROM ' . $wpdb->prefix . 'bwg_image_tag' . ($gallery_id ? ' WHERE gallery_id="' . $gallery_id . '"' : '') . ' GROUP BY image_id) AS tags ON image.id=tags.image_id';
1082
+ $where .= ' AND CONCAT(",", tags.tags_combined, ",") REGEXP ",(' . implode("|", $_REQUEST[$tag_input_name]) . ')," ';
1083
+ }
1084
+
1085
+ $row = $wpdb->get_results('SELECT image.* FROM ' . $wpdb->prefix . 'bwg_image as image ' . $join . ' WHERE image.published=1 ' . $where . ' ORDER BY ' . $sort_by . ' ' . $sort_direction . ' ' . $limit_str);
1086
+ $total = $wpdb->get_var('SELECT COUNT(*) FROM ' . $wpdb->prefix . 'bwg_image as image ' . $join . ' WHERE image.published=1 ' . $where);
1087
+
1088
+ $page_nav['total'] = $total;
1089
+ $page_nav['limit'] = 1;
1090
+ if (isset($_REQUEST['page_number_' . $bwg]) && $_REQUEST['page_number_' . $bwg]) {
1091
+ $page_nav['limit'] = (int) $_REQUEST['page_number_' . $bwg];
1092
+ }
1093
+ return array('images' => $row, 'page_nav' => $page_nav);
1094
+ }
1095
+
1096
+ public static function get_album_row_data($id, $create_post) {
1097
+ global $wpdb;
1098
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_album WHERE published=1 AND id="%d"', $id));
1099
+ if ($row && $create_post) {
1100
+ $row->permalink = WDWLibrary::bwg_create_post($row->name, $row->slug, array("type" => "album", "mode" => "masonry"), $id);
1101
+ }
1102
+ return $row;
1103
+ }
1104
+
1105
+ public static function get_alb_gals_row($id, $albums_per_page, $sort_by, $bwg, $sort_direction = ' ASC ') {
1106
+ global $wpdb;
1107
+ $limit = 0;
1108
+ if (isset($_REQUEST['page_number_' . $bwg]) && $_REQUEST['page_number_' . $bwg]) {
1109
+ $limit = ((int) $_REQUEST['page_number_' . $bwg] - 1) * $albums_per_page;
1110
+ }
1111
+ $limit_str = '';
1112
+ if ($albums_per_page) {
1113
+ $limit_str = 'LIMIT ' . $limit . ',' . $albums_per_page;
1114
+ }
1115
+ if ($sort_by != "RAND()") {
1116
+ $sort_by = '`' . $sort_by . '`';
1117
+ }
1118
+ $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));
1119
+
1120
+ $total = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM ' . $wpdb->prefix . 'bwg_album_gallery WHERE album_id="%d"', $id));
1121
+ $page_nav['total'] = $total;
1122
+ $page_nav['limit'] = 1;
1123
+ if (isset($_REQUEST['page_number_' . $bwg]) && $_REQUEST['page_number_' . $bwg]) {
1124
+ $page_nav['limit'] = (int) $_REQUEST['page_number_' . $bwg];
1125
+ }
1126
+
1127
+ return array('rows' => $row, 'page_nav' => $page_nav);
1128
+ }
1129
  ////////////////////////////////////////////////////////////////////////////////////////
1130
  // Private Methods //
1131
  ////////////////////////////////////////////////////////////////////////////////////////
frontend/controllers/BWGControllerGalleryBox.php CHANGED
@@ -41,7 +41,7 @@ class BWGControllerGalleryBox {
41
  public function save() {
42
  require_once WD_BWG_DIR . "/frontend/models/BWGModelGalleryBox.php";
43
  $model = new BWGModelGalleryBox();
44
- $option_row = $model->get_option_row_data();
45
  if ($option_row->popup_enable_email) {
46
  // Email validation.
47
  $email = (isset($_POST['bwg_email']) ? is_email(stripslashes($_POST['bwg_email'])) : FALSE);
41
  public function save() {
42
  require_once WD_BWG_DIR . "/frontend/models/BWGModelGalleryBox.php";
43
  $model = new BWGModelGalleryBox();
44
+ $option_row = WDWLibrary::get_options_row_data();
45
  if ($option_row->popup_enable_email) {
46
  // Email validation.
47
  $email = (isset($_POST['bwg_email']) ? is_email(stripslashes($_POST['bwg_email'])) : FALSE);
frontend/models/BWGModelAlbum_compact_preview.php CHANGED
@@ -1,191 +1,3 @@
1
  <?php
2
-
3
  class BWGModelAlbum_compact_preview {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
- public function __construct() {
17
- }
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Public Methods //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
- public function get_theme_row_data($id) {
22
- global $wpdb;
23
- if ($id) {
24
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_theme WHERE id="%d"', $id));
25
- }
26
- else {
27
- $row = $wpdb->get_row('SELECT * FROM ' . $wpdb->prefix . 'bwg_theme WHERE default_theme=1');
28
- }
29
- if (isset($row->options)) {
30
- $row = (object) array_merge((array) $row, (array) json_decode($row->options));
31
- }
32
- return $row;
33
- }
34
-
35
- public function get_alb_gals_row($id, $albums_per_page, $sort_by, $bwg, $sort_direction = ' ASC ') {
36
- global $wpdb;
37
- if (isset($_REQUEST['page_number_' . $bwg]) && $_REQUEST['page_number_' . $bwg]) {
38
- $limit = ((int) $_REQUEST['page_number_' . $bwg] - 1) * $albums_per_page;
39
- }
40
- else {
41
- $limit = 0;
42
- }
43
- if ($albums_per_page) {
44
- $limit_str = 'LIMIT ' . $limit . ',' . $albums_per_page;
45
- }
46
- else {
47
- $limit_str = '';
48
- }
49
- $row = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_album_gallery WHERE album_id="%d" ORDER BY ' . ($sort_by == "RAND()" ? '' : '`') . $sort_by . ($sort_by == "RAND()" ? '' : '`') . $sort_direction . $limit_str, $id));
50
- return $row;
51
- }
52
-
53
- public function get_album_row_data($id) {
54
- global $wpdb;
55
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_album WHERE published=1 AND id="%d"', $id));
56
- if ($row) {
57
- $row->permalink = $this->bwg_create_post($row->name, $row->slug, "album", $id);
58
- }
59
- return $row;
60
- }
61
-
62
- public function get_gallery_row_data($id) {
63
- global $wpdb;
64
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_gallery WHERE published=1 AND id="%d"', $id));
65
- if ($row) {
66
- $row->permalink = $this->bwg_create_post($row->name, $row->slug, "gallery", $id);
67
- }
68
- return $row;
69
- }
70
-
71
- public function get_image_rows_data($id, $images_per_page, $sort_by, $bwg, $sort_direction = ' ASC ') {
72
- global $wpdb;
73
- if (isset($_REQUEST['page_number_' . $bwg]) && $_REQUEST['page_number_' . $bwg]) {
74
- $limit = ((int) $_REQUEST['page_number_' . $bwg] - 1) * $images_per_page;
75
- }
76
- else {
77
- $limit = 0;
78
- }
79
- if ($images_per_page) {
80
- $limit_str = 'LIMIT ' . $limit . ',' . $images_per_page;
81
- }
82
- else {
83
- $limit_str = '';
84
- }
85
- $bwg_search = ((isset($_POST['bwg_search_' . $bwg])) ? esc_html($_POST['bwg_search_' . $bwg]) : '');
86
- if ($bwg_search != '') {
87
- $where = 'AND (alt LIKE "%%' . $bwg_search . '%%" OR description LIKE "%%' . $bwg_search . '%%")';
88
- }
89
- else {
90
- $where = '';
91
- }
92
- if ($sort_by == 'random' || $sort_by == 'RAND()') {
93
- $sort_by = 'RAND()';
94
- }
95
- else {
96
- $sort_by = 'image.`' . $sort_by . '`';
97
- }
98
- if (isset($_REQUEST['bwg_tag_id_bwg_album_compact_' . $bwg]) && $_REQUEST['bwg_tag_id_bwg_album_compact_' . $bwg]) {
99
- $row = $wpdb->get_results($wpdb->prepare('SELECT image.* FROM ' . $wpdb->prefix . 'bwg_image AS image INNER JOIN
100
- (SELECT GROUP_CONCAT( tag_id SEPARATOR ",") AS tags, image_id FROM ' . $wpdb->prefix . 'bwg_image_tag WHERE gallery_id="' . $id . '" GROUP BY image_id) AS tag ON image.id=tag.image_id WHERE image.published=1 ' . $where . ' AND CONCAT(",", tag.tags, ",") REGEXP ",('.implode("|",$_REQUEST['bwg_tag_id_bwg_album_compact_' . $bwg]).')," AND image.gallery_id="%d" ORDER BY ' . $sort_by . ' ' . $sort_direction . ' ' . $limit_str,$id));
101
- }
102
- else {
103
- $row = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_image AS image WHERE published=1 ' . $where . ' AND gallery_id="%d" ORDER BY ' . $sort_by . ' ' . $sort_direction . $limit_str, $id));
104
- }
105
- return $row;
106
- }
107
-
108
- public function gallery_page_nav($id, $bwg) {
109
- global $wpdb;
110
- $bwg_search = ((isset($_POST['bwg_search_' . $bwg]) && esc_html($_POST['bwg_search_' . $bwg]) != '') ? esc_html($_POST['bwg_search_' . $bwg]) : '');
111
- if ($bwg_search != '') {
112
- $where = 'AND (alt LIKE "%%' . $bwg_search . '%%" OR description LIKE "%%' . $bwg_search . '%%")';
113
- }
114
- else {
115
- $where = '';
116
- }
117
- if (isset($_REQUEST['bwg_tag_id_bwg_album_compact_' . $bwg]) && $_REQUEST['bwg_tag_id_bwg_album_compact_' . $bwg]) {
118
- $total = $wpdb->get_var('SELECT COUNT(*) FROM ' . $wpdb->prefix . 'bwg_image as image INNER JOIN (SELECT GROUP_CONCAT( tag_id SEPARATOR ",") AS tags, image_id FROM ' . $wpdb->prefix . 'bwg_image_tag WHERE gallery_id="' . $id . '" GROUP BY image_id) AS tag ON image.id=tag.image_id WHERE image.published=1 ' . $where . ' AND CONCAT(",", tag.tags, ",") REGEXP ",('.implode("|",$_REQUEST['bwg_tag_id_bwg_album_compact_' . $bwg]).')," ');
119
- }
120
- else {
121
- $total = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM ' . $wpdb->prefix . 'bwg_image WHERE published=1 ' . $where . ' AND gallery_id="%d"', $id));
122
- }
123
- $page_nav['total'] = $total;
124
- if (isset($_REQUEST['page_number_' . $bwg]) && $_REQUEST['page_number_' . $bwg]) {
125
- $page_nav['limit'] = (int) $_REQUEST['page_number_' . $bwg];
126
- }
127
- else {
128
- $page_nav['limit'] = 1;
129
- }
130
- return $page_nav;
131
- }
132
-
133
- public function album_page_nav($id, $bwg) {
134
- global $wpdb;
135
- $total = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM ' . $wpdb->prefix . 'bwg_album_gallery WHERE album_id="%d"', $id));
136
- $page_nav['total'] = $total;
137
- if (isset($_REQUEST['page_number_' . $bwg]) && $_REQUEST['page_number_' . $bwg]) {
138
- $page_nav['limit'] = (int) $_REQUEST['page_number_' . $bwg];
139
- }
140
- else {
141
- $page_nav['limit'] = 1;
142
- }
143
- return $page_nav;
144
- }
145
-
146
- public function get_options_row_data() {
147
- global $wpdb;
148
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_option WHERE id="%d"', 1));
149
- return $row;
150
- }
151
-
152
- public function bwg_create_post($title, $slug, $type, $id) {
153
- $post_type = 'bwg_' . $type;
154
- $bwg_post_id = get_page_by_title($title, OBJECT, $post_type);
155
- $options_row = $this->get_options_row_data();
156
- $theme_row = $this->get_theme_row_data(0);
157
- $shortecode_string = '[Best_Wordpress_Gallery type="' . $type . '" gallery_type="album_compact_preview" theme_id="' . $theme_row->id . '" album_id="' . $id . '" sort_by="order" order_by="asc" compuct_album_column_number="' . $options_row->album_column_number . '" compuct_albums_per_page="' . $options_row->albums_per_page . '" compuct_album_title="' . $options_row->album_title_show_hover . '" compuct_album_view_type="' . $options_row->album_view_type . '" compuct_album_thumb_width="' . $options_row->album_thumb_width . '" compuct_album_thumb_height="' . $options_row->album_thumb_height . '" compuct_album_image_column_number="' . $options_row->image_column_number . '" compuct_album_images_per_page="' . $options_row->images_per_page . '" compuct_album_image_title="' . $options_row->image_title_show_hover . '" compuct_album_image_thumb_width="' . $options_row->thumb_width . '" compuct_album_image_thumb_height="' . $options_row->thumb_height . '" compuct_album_enable_page="' . $options_row->album_enable_page . '" popup_fullscreen="' . $options_row->popup_fullscreen . '" popup_autoplay="' . $options_row->popup_autoplay . '" popup_width="' . $options_row->popup_width . '" popup_height="' . $options_row->popup_height . '" popup_effect="' . $options_row->popup_type . '" popup_interval="' . $options_row->popup_interval . '" popup_enable_filmstrip="' . $options_row->popup_enable_filmstrip . '" popup_filmstrip_height="' . $options_row->popup_filmstrip_height . '" popup_enable_ctrl_btn="' . $options_row->popup_enable_ctrl_btn . '" popup_enable_fullscreen="' . $options_row->popup_enable_fullscreen . '" popup_enable_comment="' . $options_row->popup_enable_comment . '" popup_enable_facebook="' . $options_row->popup_enable_facebook . '" popup_enable_twitter="' . $options_row->popup_enable_twitter . '" popup_enable_google="' . $options_row->popup_enable_google . '" popup_enable_pinterest="' . $options_row->popup_enable_pinterest . '" popup_enable_tumblr="' . $options_row->popup_enable_tumblr . '" watermark_type="' . $options_row->watermark_type . '" watermark_link="' . $options_row->watermark_link . '" watermark_text="' . $options_row->watermark_text . '" watermark_font_size="' . $options_row->watermark_font_size . '" watermark_font="' . $options_row->watermark_font . '" watermark_color="' . $options_row->watermark_color . '" watermark_opacity="' . $options_row->watermark_opacity . '" watermark_position="' . $options_row->watermark_position . '" watermark_url="' . $options_row->watermark_url . '" watermark_width="' . $options_row->watermark_width . '" watermark_height="' . $options_row->watermark_height . '" show_search_box="' . $options_row->show_search_box . '" search_box_width="' . $options_row->search_box_width . '" popup_enable_info="' . $options_row->popup_enable_info . '" popup_info_always_show="' . $options_row->popup_info_always_show . '" popup_enable_rate="' . $options_row->popup_enable_rate . '" popup_hit_counter="' . $options_row->popup_hit_counter . '"]';
158
- if (!$bwg_post_id) {
159
- $post = array(
160
- 'post_content' => $shortecode_string,
161
- 'post_name' => $slug,
162
- 'post_status' => 'publish', //'custom_registered_status'
163
- 'post_title' => $title,
164
- 'post_type' => $post_type
165
- );
166
- wp_insert_post($post);
167
- }
168
- else {
169
- $bwg_post_id->post_name = $slug;
170
- $bwg_post_id->post_content = $shortecode_string;
171
- wp_update_post($bwg_post_id);
172
- }
173
- $bwg_post_id = get_page_by_title($title, OBJECT, $post_type);
174
- return get_permalink($bwg_post_id->ID);
175
- }
176
-
177
- public function get_tags_rows_data($gallery_id) {
178
- global $wpdb;
179
- $row = $wpdb->get_results('Select t1.* FROM ' . $wpdb->prefix . 'terms AS t1 LEFT JOIN ' . $wpdb->prefix . 'term_taxonomy AS t2 ON t1.term_id = t2.term_id LEFT JOIN ( SELECT DISTINCT tag_id , gallery_id FROM ' . $wpdb->prefix . 'bwg_image_tag) AS t3 ON t1.term_id=t3.tag_id WHERE taxonomy = "bwg_tag" AND t3.gallery_id="' . $gallery_id . '"');
180
- return $row;
181
- }
182
- ////////////////////////////////////////////////////////////////////////////////////////
183
- // Getters & Setters //
184
- ////////////////////////////////////////////////////////////////////////////////////////
185
- ////////////////////////////////////////////////////////////////////////////////////////
186
- // Private Methods //
187
- ////////////////////////////////////////////////////////////////////////////////////////
188
- ////////////////////////////////////////////////////////////////////////////////////////
189
- // Listeners //
190
- ////////////////////////////////////////////////////////////////////////////////////////
191
  }
1
  <?php
 
2
  class BWGModelAlbum_compact_preview {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  }
frontend/models/BWGModelAlbum_extended_preview.php CHANGED
@@ -1,159 +1,3 @@
1
  <?php
2
-
3
  class BWGModelAlbum_extended_preview {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
- public function __construct() {
17
- }
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Public Methods //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
- public function get_theme_row_data($id) {
22
- global $wpdb;
23
- if ($id) {
24
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_theme WHERE id="%d"', $id));
25
- }
26
- else {
27
- $row = $wpdb->get_row('SELECT * FROM ' . $wpdb->prefix . 'bwg_theme WHERE default_theme=1');
28
- }
29
- if (isset($row->options)) {
30
- $row = (object) array_merge((array) $row, (array) json_decode($row->options));
31
- }
32
- return $row;
33
- }
34
-
35
- public function get_alb_gals_row($id, $albums_per_page, $sort_by, $bwg, $sort_direction = ' ASC ') {
36
- global $wpdb;
37
- if (isset($_REQUEST['page_number_' . $bwg]) && $_REQUEST['page_number_' . $bwg]) {
38
- $limit = ((int) $_REQUEST['page_number_' . $bwg] - 1) * $albums_per_page;
39
- }
40
- else {
41
- $limit = 0;
42
- }
43
- if ($albums_per_page) {
44
- $limit_str = 'LIMIT ' . $limit . ',' . $albums_per_page;
45
- }
46
- else {
47
- $limit_str = '';
48
- }
49
- $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));
50
- return $row;
51
- }
52
-
53
- public function get_album_row_data($id) {
54
- global $wpdb;
55
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_album WHERE published=1 AND id="%d"', $id));
56
- return $row;
57
- }
58
-
59
- public function get_gallery_row_data($id) {
60
- global $wpdb;
61
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_gallery WHERE published=1 AND id="%d"', $id));
62
- return $row;
63
- }
64
-
65
- public function get_image_rows_data($id, $images_per_page, $sort_by, $bwg, $sort_direction = ' ASC ') {
66
- global $wpdb;
67
- $bwg_search = ((isset($_POST['bwg_search_' . $bwg]) && esc_html($_POST['bwg_search_' . $bwg]) != '') ? esc_html($_POST['bwg_search_' . $bwg]) : '');
68
- if ($bwg_search != '') {
69
- $where = 'AND (alt LIKE "%%' . $bwg_search . '%%" OR description LIKE "%%' . $bwg_search . '%%")';
70
- }
71
- else {
72
- $where = '';
73
- }
74
- if (isset($_REQUEST['page_number_' . $bwg]) && $_REQUEST['page_number_' . $bwg]) {
75
- $limit = ((int) $_REQUEST['page_number_' . $bwg] - 1) * $images_per_page;
76
- }
77
- else {
78
- $limit = 0;
79
- }
80
- if ($images_per_page) {
81
- $limit_str = 'LIMIT ' . $limit . ',' . $images_per_page;
82
- }
83
- else {
84
- $limit_str = '';
85
- }
86
- if ($sort_by == 'random' || $sort_by == 'RAND()') {
87
- $sort_by = 'RAND()';
88
- }
89
- else {
90
- $sort_by = 'image.`' . $sort_by . '`';
91
- }
92
- if (isset($_REQUEST['bwg_tag_id_bwg_album_extended_' . $bwg]) && $_REQUEST['bwg_tag_id_bwg_album_extended_' . $bwg]) {
93
- $row = $wpdb->get_results($wpdb->prepare('SELECT image.* FROM ' . $wpdb->prefix . 'bwg_image as image INNER JOIN
94
- (SELECT GROUP_CONCAT( tag_id SEPARATOR ",") AS tags, image_id FROM ' . $wpdb->prefix . 'bwg_image_tag WHERE gallery_id="' . $id . '" GROUP BY image_id) AS tag ON image.id=tag.image_id WHERE image.published=1 ' . $where . ' AND CONCAT(",", tag.tags, ",") REGEXP ",('.implode("|",$_REQUEST['bwg_tag_id_bwg_album_extended_' . $bwg]).')," AND image.gallery_id="%d" ORDER BY ' . $sort_by . ' ' . $sort_direction . ' ' . $limit_str, $id));
95
- }
96
- else {
97
- $row = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_image as image WHERE published=1 ' . $where . ' AND gallery_id="%d" ORDER BY ' . $sort_by . ' ' . $sort_direction . $limit_str, $id));
98
- }
99
- return $row;
100
- }
101
-
102
- public function gallery_page_nav($id, $bwg) {
103
- global $wpdb;
104
- $bwg_search = ((isset($_POST['bwg_search_' . $bwg]) && esc_html($_POST['bwg_search_' . $bwg]) != '') ? esc_html($_POST['bwg_search_' . $bwg]) : '');
105
- if ($bwg_search != '') {
106
- $where = 'AND (alt LIKE "%%' . $bwg_search . '%%" OR description LIKE "%%' . $bwg_search . '%%")';
107
- }
108
- else {
109
- $where = '';
110
- }
111
- if (isset($_REQUEST['bwg_tag_id_bwg_album_extended_' . $bwg]) && $_REQUEST['bwg_tag_id_bwg_album_extended_' . $bwg]) {
112
- $total = $wpdb->get_var('SELECT COUNT(*) FROM ' . $wpdb->prefix . 'bwg_image as image INNER JOIN (SELECT GROUP_CONCAT( tag_id SEPARATOR ",") AS tags, image_id FROM ' . $wpdb->prefix . 'bwg_image_tag WHERE gallery_id="' . $id . '" GROUP BY image_id) AS tag ON image.id=tag.image_id WHERE image.published=1 ' . $where . ' AND CONCAT(",", tag.tags, ",") REGEXP ",('.implode("|",$_REQUEST['bwg_tag_id_bwg_album_extended_' . $bwg]).')," ');
113
- }
114
- else {
115
- $total = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM ' . $wpdb->prefix . 'bwg_image WHERE published=1 ' . $where . ' AND gallery_id="%d"', $id));
116
- }
117
- $page_nav['total'] = $total;
118
- if (isset($_REQUEST['page_number_' . $bwg]) && $_REQUEST['page_number_' . $bwg]) {
119
- $page_nav['limit'] = (int) $_REQUEST['page_number_' . $bwg];
120
- }
121
- else {
122
- $page_nav['limit'] = 1;
123
- }
124
- return $page_nav;
125
- }
126
-
127
- public function album_page_nav($id, $bwg) {
128
- global $wpdb;
129
- $total = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM ' . $wpdb->prefix . 'bwg_album_gallery WHERE album_id="%d"', $id));
130
- $page_nav['total'] = $total;
131
- if (isset($_REQUEST['page_number_' . $bwg]) && $_REQUEST['page_number_' . $bwg]) {
132
- $page_nav['limit'] = (int) $_REQUEST['page_number_' . $bwg];
133
- }
134
- else {
135
- $page_nav['limit'] = 1;
136
- }
137
- return $page_nav;
138
- }
139
- public function get_options_row_data() {
140
- global $wpdb;
141
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_option WHERE id="%d"', 1));
142
- return $row;
143
- }
144
-
145
- public function get_tags_rows_data($gallery_id) {
146
- global $wpdb;
147
- $row = $wpdb->get_results('Select t1.* FROM ' . $wpdb->prefix . 'terms AS t1 LEFT JOIN ' . $wpdb->prefix . 'term_taxonomy AS t2 ON t1.term_id = t2.term_id LEFT JOIN ( SELECT DISTINCT tag_id , gallery_id FROM ' . $wpdb->prefix . 'bwg_image_tag) AS t3 ON t1.term_id=t3.tag_id WHERE taxonomy = "bwg_tag" AND t3.gallery_id="' . $gallery_id . '"');
148
- return $row;
149
- }
150
- ////////////////////////////////////////////////////////////////////////////////////////
151
- // Getters & Setters //
152
- ////////////////////////////////////////////////////////////////////////////////////////
153
- ////////////////////////////////////////////////////////////////////////////////////////
154
- // Private Methods //
155
- ////////////////////////////////////////////////////////////////////////////////////////
156
- ////////////////////////////////////////////////////////////////////////////////////////
157
- // Listeners //
158
- ////////////////////////////////////////////////////////////////////////////////////////
159
  }
1
  <?php
 
2
  class BWGModelAlbum_extended_preview {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  }
frontend/models/BWGModelGalleryBox.php CHANGED
@@ -1,75 +1,40 @@
1
  <?php
2
-
3
  class BWGModelGalleryBox {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
- public function __construct() {
17
- }
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Public Methods //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
- public function get_theme_row_data($id) {
22
- global $wpdb;
23
- if ($id) {
24
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_theme WHERE id="%d"', $id));
25
- }
26
- else {
27
- $row = $wpdb->get_row('SELECT * FROM ' . $wpdb->prefix . 'bwg_theme WHERE default_theme=1');
28
- }
29
- if (isset($row->options)) {
30
- $row = (object) array_merge((array) $row, (array) json_decode($row->options));
31
- }
32
- return $row;
33
- }
34
-
35
- public function get_option_row_data() {
36
- global $wpdb;
37
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_option WHERE id="%d"', 1));
38
- return $row;
39
- }
40
-
41
  public function get_comment_rows_data($image_id) {
42
  global $wpdb;
43
  $row = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_image_comment WHERE image_id="%d" AND published=1 ORDER BY `id` DESC', $image_id));
44
  return $row;
45
  }
46
 
47
- public function get_image_rows_data($gallery_id, $bwg, $sort_by, $order_by = 'asc') {
48
  global $wpdb;
49
  if ($sort_by == 'size' || $sort_by == 'resolution') {
50
- $sort_by = ' CAST(t1.' . $sort_by . ' AS SIGNED) ';
51
  }
52
  elseif (($sort_by != 'alt') && ($sort_by != 'date') && ($sort_by != 'filetype') && ($sort_by != 'filename')) {
53
- $sort_by = 't1.`order`';
54
  }
55
  if (preg_replace('/\s+/', '', $order_by) != 'asc') {
56
  $order_by = 'desc';
57
  }
58
 
59
- $filter_tags = (isset($_REQUEST['filter_tag_'. $bwg]) && $_REQUEST['filter_tag_'. $bwg] ) ? explode(",",$_REQUEST['filter_tag_'. $bwg]) : array();
60
  $filter_search_name = (isset($_REQUEST['filter_search_name_'. $bwg])) ? esc_html($_REQUEST['filter_search_name_'. $bwg]) : '';
 
61
  if ($filter_search_name != '') {
62
- $where = ' AND (t1.alt LIKE "%%' . $filter_search_name . '%%" OR t1.description LIKE "%%' . $filter_search_name . '%%")';
63
- }
64
- else {
65
- $where = '';
66
  }
67
- if ($filter_tags) {
68
- $row = $wpdb->get_results($wpdb->prepare('SELECT t1.*,t2.rate FROM ' . $wpdb->prefix . 'bwg_image as t1 LEFT JOIN (SELECT rate, image_id FROM ' . $wpdb->prefix . 'bwg_image_rate WHERE ip="%s") as t2 ON t1.id=t2.image_id INNER JOIN (SELECT GROUP_CONCAT( tag_id SEPARATOR ",") AS tags, image_id FROM ' . $wpdb->prefix . 'bwg_image_tag WHERE gallery_id="' . $gallery_id . '" GROUP BY image_id) AS tag ON t1.id=tag.image_id WHERE t1.published=1 AND CONCAT(",", tag.tags, ",") REGEXP ",('.implode("|",$filter_tags).')," AND t1.gallery_id="%d"' . $where . ' ORDER BY ' . $sort_by . ' ' . $order_by, $_SERVER['REMOTE_ADDR'], $gallery_id));
69
- }
70
- else {
71
- $row = $wpdb->get_results($wpdb->prepare('SELECT t1.*,t2.rate FROM ' . $wpdb->prefix . 'bwg_image as t1 LEFT JOIN (SELECT rate, image_id FROM ' . $wpdb->prefix . 'bwg_image_rate WHERE ip="%s") as t2 ON t1.id=t2.image_id WHERE t1.published=1 AND t1.gallery_id="%d"' . $where . ' ORDER BY ' . $sort_by . ' ' . $order_by, $_SERVER['REMOTE_ADDR'], $gallery_id));
 
 
72
  }
 
 
 
73
  return $row;
74
  }
75
 
1
  <?php
 
2
  class BWGModelGalleryBox {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  public function get_comment_rows_data($image_id) {
4
  global $wpdb;
5
  $row = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_image_comment WHERE image_id="%d" AND published=1 ORDER BY `id` DESC', $image_id));
6
  return $row;
7
  }
8
 
9
+ public function get_image_rows_data($gallery_id, $bwg, $sort_by, $order_by = 'asc', $tag = 0) {
10
  global $wpdb;
11
  if ($sort_by == 'size' || $sort_by == 'resolution') {
12
+ $sort_by = ' CAST(image.' . $sort_by . ' AS SIGNED) ';
13
  }
14
  elseif (($sort_by != 'alt') && ($sort_by != 'date') && ($sort_by != 'filetype') && ($sort_by != 'filename')) {
15
+ $sort_by = 'image.`order`';
16
  }
17
  if (preg_replace('/\s+/', '', $order_by) != 'asc') {
18
  $order_by = 'desc';
19
  }
20
 
21
+ $filter_tags = (isset($_REQUEST['filter_tag_'. $bwg]) && $_REQUEST['filter_tag_'. $bwg]) ? explode(",", $_REQUEST['filter_tag_'. $bwg]) : array();
22
  $filter_search_name = (isset($_REQUEST['filter_search_name_'. $bwg])) ? esc_html($_REQUEST['filter_search_name_'. $bwg]) : '';
23
+ $where = '';
24
  if ($filter_search_name != '') {
25
+ $where = ' AND (image.alt LIKE "%%' . $filter_search_name . '%%" OR image.description LIKE "%%' . $filter_search_name . '%%")';
 
 
 
26
  }
27
+
28
+ $where .= ($gallery_id ? ' AND image.gallery_id = "' . $gallery_id . '" ' : '') . ($tag ? ' AND tag.tag_id = "' . $tag . '" ' : '');
29
+ $join = $tag ? 'LEFT JOIN ' . $wpdb->prefix . 'bwg_image_tag as tag ON image.id=tag.image_id' : '';
30
+
31
+ if ($filter_tags){
32
+ $join .= ' LEFT JOIN (SELECT GROUP_CONCAT(tag_id SEPARATOR ",") AS tags_combined, image_id FROM ' . $wpdb->prefix . 'bwg_image_tag' . ($gallery_id ? ' WHERE gallery_id="' . $gallery_id . '"' : '') . ' GROUP BY image_id) AS tags ON image.id=tags.image_id';
33
+ $where .= ' AND CONCAT(",", tags.tags_combined, ",") REGEXP ",(' . implode("|", $filter_tags) . ')," ';
34
  }
35
+
36
+ $row = $wpdb->get_results('SELECT image.*, rates.rate FROM ' . $wpdb->prefix . 'bwg_image as image LEFT JOIN (SELECT rate, image_id FROM ' . $wpdb->prefix . 'bwg_image_rate WHERE ip="%s") as rates ON image.id=rates.image_id ' . $join . ' WHERE image.published=1 ' . $where . ' ORDER BY ' . $sort_by);
37
+
38
  return $row;
39
  }
40
 
frontend/models/BWGModelImage_browser.php CHANGED
@@ -1,111 +1,3 @@
1
  <?php
2
-
3
  class BWGModelImage_browser {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
- public function __construct() {
17
- }
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Public Methods //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
- public function get_theme_row_data($id) {
22
- global $wpdb;
23
- if ($id) {
24
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_theme WHERE id="%d"', $id));
25
- }
26
- else {
27
- $row = $wpdb->get_row('SELECT * FROM ' . $wpdb->prefix . 'bwg_theme WHERE default_theme=1');
28
- }
29
- if (isset($row->options)) {
30
- $row = (object) array_merge((array) $row, (array) json_decode($row->options));
31
- }
32
- return $row;
33
- }
34
-
35
- public function get_gallery_row_data($id) {
36
- global $wpdb;
37
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_gallery WHERE published=1 AND id="%d"', $id));
38
- return $row;
39
- }
40
-
41
- public function get_image_rows_data($id, $images_per_page, $sort_by, $order_by = 'asc', $bwg) {
42
- global $wpdb;
43
- $bwg_search = ((isset($_POST['bwg_search_' . $bwg]) && esc_html($_POST['bwg_search_' . $bwg]) != '') ? esc_html($_POST['bwg_search_' . $bwg]) : '');
44
- if ($bwg_search != '') {
45
- $where = 'AND (alt LIKE "%%' . $bwg_search . '%%" OR description LIKE "%%' . $bwg_search . '%%")';
46
- }
47
- else {
48
- $where = '';
49
- }
50
- if ($sort_by == 'size' || $sort_by == 'resolution') {
51
- $sort_by = ' CAST(' . $sort_by . ' AS SIGNED) ';
52
- }
53
- elseif ($sort_by == 'random') {
54
- $sort_by = 'RAND()';
55
- }
56
- elseif (($sort_by != 'alt') && ($sort_by != 'date') && ($sort_by != 'filetype') && ($sort_by != 'filename')) {
57
- $sort_by = '`order`';
58
- }
59
- if (isset($_REQUEST['page_number_' . $bwg]) && $_REQUEST['page_number_' . $bwg]) {
60
- $limit = ((int) $_REQUEST['page_number_' . $bwg] - 1) * $images_per_page;
61
- }
62
- else {
63
- $limit = 0;
64
- }
65
- if ($images_per_page) {
66
- $limit_str = 'LIMIT ' . $limit . ',' . $images_per_page;
67
- }
68
- else {
69
- $limit_str = '';
70
- }
71
- $row = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_image WHERE published=1 ' . $where . ' AND gallery_id="%d" ORDER BY ' . $sort_by . ' ' . $order_by . ' ' . $limit_str, $id));
72
- return $row;
73
- }
74
-
75
- public function get_option_row_data() {
76
- global $wpdb;
77
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_option WHERE id="%d"', 1));
78
- return $row;
79
- }
80
-
81
- public function page_nav($id, $images_per_page, $bwg) {
82
- global $wpdb;
83
- $bwg_search = ((isset($_POST['bwg_search_' . $bwg]) && esc_html($_POST['bwg_search_' . $bwg]) != '') ? esc_html($_POST['bwg_search_' . $bwg]) : '');
84
- if ($bwg_search != '') {
85
- $where = 'AND (alt LIKE "%%' . $bwg_search . '%%" OR description LIKE "%%' . $bwg_search . '%%")';
86
- }
87
- else {
88
- $where = '';
89
- }
90
- $total = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM ' . $wpdb->prefix . 'bwg_image WHERE published=1 ' . $where . ' AND gallery_id="%d"', $id));
91
- $page_nav['total'] = $total;
92
- if (isset($_REQUEST['page_number_' . $bwg]) && $_REQUEST['page_number_' . $bwg]) {
93
- $limit = ((int) $_REQUEST['page_number_' . $bwg] - 1) * $images_per_page;
94
- }
95
- else {
96
- $limit = 0;
97
- }
98
- $page_nav['limit'] = (int) ($limit / $images_per_page + 1);
99
- return $page_nav;
100
- }
101
-
102
- ////////////////////////////////////////////////////////////////////////////////////////
103
- // Getters & Setters //
104
- ////////////////////////////////////////////////////////////////////////////////////////
105
- ////////////////////////////////////////////////////////////////////////////////////////
106
- // Private Methods //
107
- ////////////////////////////////////////////////////////////////////////////////////////
108
- ////////////////////////////////////////////////////////////////////////////////////////
109
- // Listeners //
110
- ////////////////////////////////////////////////////////////////////////////////////////
111
  }
1
  <?php
 
2
  class BWGModelImage_browser {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  }
frontend/models/BWGModelSlideshow.php CHANGED
@@ -1,70 +1,3 @@
1
  <?php
2
-
3
  class BWGModelSlideshow {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
- public function __construct() {
17
- }
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Public Methods //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
- public function get_theme_row_data($id) {
22
- global $wpdb;
23
- if ($id) {
24
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_theme WHERE id="%d"', $id));
25
- }
26
- else {
27
- $row = $wpdb->get_row('SELECT * FROM ' . $wpdb->prefix . 'bwg_theme WHERE default_theme=1');
28
- }
29
- if (isset($row->options)) {
30
- $row = (object) array_merge((array) $row, (array) json_decode($row->options));
31
- }
32
- return $row;
33
- }
34
-
35
- public function get_gallery_row_data($id) {
36
- global $wpdb;
37
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_gallery WHERE published=1 AND id="%d"', $id));
38
- return $row;
39
- }
40
-
41
- public function get_image_rows_data($id, $sort_by, $order_by = 'asc', $bwg) {
42
- global $wpdb;
43
- if ($sort_by == 'size' || $sort_by == 'resolution') {
44
- $sort_by = ' CAST(' . $sort_by . ' AS SIGNED) ';
45
- }
46
- elseif ($sort_by == 'random') {
47
- $sort_by = 'RAND()';
48
- }
49
- elseif (($sort_by != 'alt') && ($sort_by != 'date') && ($sort_by != 'filetype') && ($sort_by != 'filename')) {
50
- $sort_by = '`order`';
51
- }
52
- $row = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_image WHERE published=1 AND gallery_id="%d" ORDER BY ' . $sort_by . ' ' . $order_by, $id));
53
- return $row;
54
- }
55
-
56
- public function get_options_row_data() {
57
- global $wpdb;
58
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_option WHERE id="%d"', 1));
59
- return $row;
60
- }
61
- ////////////////////////////////////////////////////////////////////////////////////////
62
- // Getters & Setters //
63
- ////////////////////////////////////////////////////////////////////////////////////////
64
- ////////////////////////////////////////////////////////////////////////////////////////
65
- // Private Methods //
66
- ////////////////////////////////////////////////////////////////////////////////////////
67
- ////////////////////////////////////////////////////////////////////////////////////////
68
- // Listeners //
69
- ////////////////////////////////////////////////////////////////////////////////////////
70
  }
1
  <?php
 
2
  class BWGModelSlideshow {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  }
frontend/models/BWGModelThumbnails.php CHANGED
@@ -1,160 +1,3 @@
1
  <?php
2
-
3
  class BWGModelThumbnails {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
- public function __construct() {
17
- }
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Public Methods //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
- public function get_theme_row_data($id) {
22
- global $wpdb;
23
- if ($id) {
24
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_theme WHERE id="%d"', $id));
25
- }
26
- else {
27
- $row = $wpdb->get_row('SELECT * FROM ' . $wpdb->prefix . 'bwg_theme WHERE default_theme=1');
28
- }
29
- if (isset($row->options)) {
30
- $row = (object) array_merge((array) $row, (array) json_decode($row->options));
31
- }
32
- return $row;
33
- }
34
-
35
- public function get_gallery_row_data($id) {
36
- global $wpdb;
37
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_gallery WHERE published=1 AND id="%d"', $id));
38
- return $row;
39
- }
40
-
41
- public function get_image_rows_data($params, $bwg, $type, $sort_direction = ' ASC ') {
42
- $id = $params['gallery_id'];
43
- $images_per_page = $params['images_per_page'];
44
- $sort_by = $params['sort_by'];
45
- global $wpdb;
46
- $bwg_search = ((isset($_POST['bwg_search_' . $bwg]) && esc_html($_POST['bwg_search_' . $bwg]) != '') ? esc_html($_POST['bwg_search_' . $bwg]) : '');
47
- if ($type == 'tag') {
48
- if ($bwg_search != '') {
49
- $where = 'AND (image.alt LIKE "%%' . $bwg_search . '%%" OR image.description LIKE "%%' . $bwg_search . '%%")';
50
- }
51
- else {
52
- $where = '';
53
- }
54
- }
55
- else {
56
- if ($bwg_search != '') {
57
- $where = 'AND (alt LIKE "%%' . $bwg_search . '%%" OR description LIKE "%%' . $bwg_search . '%%")';
58
- }
59
- else {
60
- $where = '';
61
- }
62
- }
63
- if ($sort_by == 'size' || $sort_by == 'resolution') {
64
- $sort_by = ' CAST(' . $sort_by . ' AS SIGNED) ';
65
- }
66
- elseif ($sort_by == 'random') {
67
- $sort_by = 'RAND()';
68
- }
69
- elseif (($sort_by != 'alt') && ($sort_by != 'date') && ($sort_by != 'filetype') && ($sort_by != 'RAND()') && ($sort_by != 'filename')) {
70
- $sort_by = '`order`';
71
- }
72
- $items_in_page = $images_per_page;
73
- if (isset($_REQUEST['page_number_' . $bwg]) && $_REQUEST['page_number_' . $bwg]) {
74
- if ($_REQUEST['page_number_' . $bwg] > 1) {
75
- $items_in_page = $params['load_more_image_count'];
76
- }
77
- $limit = (((int) $_REQUEST['page_number_' . $bwg] - 2) * $items_in_page) + $images_per_page;
78
- }
79
- else {
80
- $limit = 0;
81
- }
82
- if ($images_per_page) {
83
- $limit_str = 'LIMIT ' . $limit . ',' . $items_in_page;
84
- }
85
- else {
86
- $limit_str = '';
87
- }
88
-
89
- if( isset($_REQUEST['bwg_tag_id_bwg_standart_thumbnails_' . $bwg]) && $_REQUEST['bwg_tag_id_bwg_standart_thumbnails_' . $bwg] ){
90
- $row = $wpdb->get_results('SELECT image.* FROM ' . $wpdb->prefix . 'bwg_image as image INNER JOIN
91
- (SELECT GROUP_CONCAT( tag_id SEPARATOR ",") AS tags, image_id FROM ' . $wpdb->prefix . 'bwg_image_tag WHERE gallery_id="' . $id . '" GROUP BY image_id) AS tag ON image.id=tag.image_id WHERE image.published=1 ' . $where . ' AND CONCAT(",", tag.tags, ",") REGEXP ",('.implode("|",$_REQUEST['bwg_tag_id_bwg_standart_thumbnails_' . $bwg]).')," ORDER BY ' . $sort_by . ' ' . $sort_direction . ' ' . $limit_str);
92
- }
93
- elseif($type == 'tag') {
94
- $row = $wpdb->get_results($wpdb->prepare('SELECT image.* FROM ' . $wpdb->prefix . 'bwg_image as image INNER JOIN ' . $wpdb->prefix . 'bwg_image_tag as tag ON image.id=tag.image_id WHERE image.published=1 ' . $where . ' AND tag.tag_id="%d" ORDER BY ' . $sort_by . ' ' . $sort_direction . ' ' . $limit_str, $id));
95
- }
96
- else {
97
- $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));
98
- }
99
- return $row;
100
- }
101
-
102
- public function page_nav($id, $bwg, $type) {
103
- global $wpdb;
104
- $bwg_search = ((isset($_POST['bwg_search_' . $bwg]) && esc_html($_POST['bwg_search_' . $bwg]) != '') ? esc_html($_POST['bwg_search_' . $bwg]) : '');
105
- if ($type == 'tag') {
106
- if ($bwg_search != '') {
107
- $where = 'AND (image.alt LIKE "%%' . $bwg_search . '%%" OR image.description LIKE "%%' . $bwg_search . '%%")';
108
- }
109
- else {
110
- $where = '';
111
- }
112
- }
113
- else {
114
- if ($bwg_search != '') {
115
- $where = 'AND (alt LIKE "%%' . $bwg_search . '%%" OR description LIKE "%%' . $bwg_search . '%%")';
116
- }
117
- else {
118
- $where = '';
119
- }
120
- }
121
- if( isset($_REQUEST['bwg_tag_id_bwg_standart_thumbnails_' . $bwg]) && $_REQUEST['bwg_tag_id_bwg_standart_thumbnails_' . $bwg] ){
122
- $total = $wpdb->get_var('SELECT COUNT(*) FROM ' . $wpdb->prefix . 'bwg_image as image INNER JOIN (SELECT GROUP_CONCAT( tag_id SEPARATOR ",") AS tags, image_id FROM ' . $wpdb->prefix . 'bwg_image_tag WHERE gallery_id="' . $id . '" GROUP BY image_id) AS tag ON image.id=tag.image_id WHERE image.published=1 ' . $where . ' AND CONCAT(",", tag.tags, ",") REGEXP ",('.implode("|",$_REQUEST['bwg_tag_id_bwg_standart_thumbnails_' . $bwg]).')," ');
123
- }
124
- elseif ($type == 'tag') {
125
- $total = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM ' . $wpdb->prefix . 'bwg_image as image INNER JOIN ' . $wpdb->prefix . 'bwg_image_tag as tag ON image.id=tag.image_id WHERE image.published=1 ' . $where . ' AND tag.tag_id="%d"', $id));
126
- }
127
- else {
128
- $total = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM ' . $wpdb->prefix . 'bwg_image WHERE published=1 ' . $where . ' AND gallery_id="%d"', $id));
129
- }
130
- $page_nav['total'] = $total;
131
- if (isset($_REQUEST['page_number_' . $bwg]) && $_REQUEST['page_number_' . $bwg]) {
132
- $page_nav['limit'] = (int) $_REQUEST['page_number_' . $bwg];
133
- }
134
- else {
135
- $page_nav['limit'] = 1;
136
- }
137
- return $page_nav;
138
- }
139
-
140
- public function get_options_row_data() {
141
- global $wpdb;
142
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_option WHERE id="%d"', 1));
143
- return $row;
144
- }
145
-
146
- public function get_tags_rows_data($gallery_id) {
147
- global $wpdb;
148
- $row = $wpdb->get_results('Select t1.* FROM ' . $wpdb->prefix . 'terms AS t1 LEFT JOIN ' . $wpdb->prefix . 'term_taxonomy AS t2 ON t1.term_id = t2.term_id LEFT JOIN ( SELECT DISTINCT tag_id , gallery_id FROM ' . $wpdb->prefix . 'bwg_image_tag) AS t3 ON t1.term_id=t3.tag_id WHERE taxonomy = "bwg_tag" AND t3.gallery_id="' . $gallery_id . '"');
149
- return $row;
150
- }
151
- ////////////////////////////////////////////////////////////////////////////////////////
152
- // Getters & Setters //
153
- ////////////////////////////////////////////////////////////////////////////////////////
154
- ////////////////////////////////////////////////////////////////////////////////////////
155
- // Private Methods //
156
- ////////////////////////////////////////////////////////////////////////////////////////
157
- ////////////////////////////////////////////////////////////////////////////////////////
158
- // Listeners //
159
- ////////////////////////////////////////////////////////////////////////////////////////
160
  }
1
  <?php
 
2
  class BWGModelThumbnails {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  }
frontend/models/BWGModelWidget.php CHANGED
@@ -1,83 +1,11 @@
1
  <?php
2
-
3
  class BWGModelWidgetFrontEnd {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
- public function __construct() {
17
- }
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Public Methods //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
  public function get_tags_data($count) {
22
  global $wpdb;
23
  $rows = $wpdb->get_results('SELECT image.thumb_url as thumb_url, image.id as image_id, tags.name, tags.slug, tags.term_id, image.filetype FROM ' . $wpdb->prefix . 'terms AS tags INNER JOIN ' . $wpdb->prefix . 'term_taxonomy AS taxonomy ON taxonomy.term_id=tags.term_id INNER JOIN (SELECT image.thumb_url, tag.tag_id, image.id, image.filetype FROM ' . $wpdb->prefix . 'bwg_image AS image INNER JOIN ' . $wpdb->prefix . 'bwg_image_tag AS tag ON image.id=tag.image_id ORDER BY RAND()) AS image ON image.tag_id=tags.term_id WHERE taxonomy.taxonomy="bwg_tag" GROUP BY tags.term_id' . ($count ? ' LIMIT ' . $count : ""));
24
  foreach ($rows as $row) {
25
- $row->permalink = $this->bwg_create_post($row->name, $row->slug, "tag", $row->term_id);
26
  }
27
  return $rows;
28
  }
29
-
30
- public function get_theme_row_data($id) {
31
- global $wpdb;
32
- if ($id) {
33
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_theme WHERE id="%d"', $id));
34
- }
35
- else {
36
- $row = $wpdb->get_row('SELECT * FROM ' . $wpdb->prefix . 'bwg_theme WHERE default_theme=1');
37
- }
38
- if (isset($row->options)) {
39
- $row = (object) array_merge((array) $row, (array) json_decode($row->options));
40
- }
41
- return $row;
42
- }
43
-
44
- public function get_options_row_data() {
45
- global $wpdb;
46
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_option WHERE id="%d"', 1));
47
- return $row;
48
- }
49
-
50
- public function bwg_create_post($title, $slug, $type, $id) {
51
- $bwg_post_id = get_page_by_title($title, OBJECT, 'bwg_tag');
52
- $options_row = $this->get_options_row_data();
53
- $theme_row = $this->get_theme_row_data(0);
54
- $shortecode_string = '[Best_Wordpress_Gallery type="' . $type . '" gallery_type="thumbnails" theme_id="' . $theme_row->id . '" gallery_id="' . $id . '" sort_by="date" order_by="asc" image_column_number="' . $options_row->image_column_number . '" images_per_page="' . $options_row->images_per_page . '" image_title="' . $options_row->image_title_show_hover . '" image_enable_page="' . $options_row->image_enable_page . '" thumb_width="' . $options_row->thumb_width . '" thumb_height="' . $options_row->thumb_height . '" popup_fullscreen="' . $options_row->popup_fullscreen . '" popup_autoplay="' . $options_row->popup_autoplay . '" popup_width="' . $options_row->popup_width . '" popup_height="' . $options_row->popup_height . '" popup_effect="' . $options_row->popup_type . '" popup_interval="' . $options_row->popup_interval . '" popup_enable_filmstrip="' . $options_row->popup_enable_filmstrip . '" popup_filmstrip_height="' . $options_row->popup_filmstrip_height . '" popup_enable_ctrl_btn="' . $options_row->popup_enable_ctrl_btn . '" popup_enable_fullscreen="' . $options_row->popup_enable_fullscreen . '" popup_enable_comment="' . $options_row->popup_enable_comment . '" popup_enable_facebook="' . $options_row->popup_enable_facebook . '" popup_enable_twitter="' . $options_row->popup_enable_twitter . '" popup_enable_google="' . $options_row->popup_enable_google . '" popup_enable_pinterest="' . $options_row->popup_enable_pinterest . '" popup_enable_tumblr="' . $options_row->popup_enable_tumblr . '" watermark_type="' . $options_row->watermark_type . '" watermark_link="' . $options_row->watermark_link . '" watermark_text="' . $options_row->watermark_text . '" watermark_font_size="' . $options_row->watermark_font_size . '" watermark_font="' . $options_row->watermark_font . '" watermark_color="' . $options_row->watermark_color . '" watermark_opacity="' . $options_row->watermark_opacity . '" watermark_position="' . $options_row->watermark_position . '" watermark_url="' . $options_row->watermark_url . '" watermark_width="' . $options_row->watermark_width . '" watermark_height="' . $options_row->watermark_height . '" show_search_box="' . $options_row->show_search_box . '" search_box_width="' . $options_row->search_box_width . '" popup_enable_info="' . $options_row->popup_enable_info . '" popup_info_always_show="' . $options_row->popup_info_always_show . '" popup_enable_rate="' . $options_row->popup_enable_rate . '" popup_hit_counter="' . $options_row->popup_hit_counter . '" thumb_click_action="' . $options_row->thumb_click_action . '" thumb_link_target="' . $options_row->thumb_link_target . '"]';
55
- if (!$bwg_post_id) {
56
- $post = array(
57
- 'post_content' => $shortecode_string,
58
- 'post_name' => $slug,
59
- 'post_status' => 'publish', //'custom_registered_status'
60
- 'post_title' => $title,
61
- 'post_type' => 'bwg_tag'
62
- );
63
- wp_insert_post($post);
64
- }
65
- else {
66
- $bwg_post_id->post_name = $slug;
67
- $bwg_post_id->post_content = $shortecode_string;
68
- wp_update_post($bwg_post_id);
69
- }
70
- $bwg_post_id = get_page_by_title($title, OBJECT, 'bwg_tag');
71
- return get_permalink($bwg_post_id->ID);
72
- }
73
-
74
- ////////////////////////////////////////////////////////////////////////////////////////
75
- // Getters & Setters //
76
- ////////////////////////////////////////////////////////////////////////////////////////
77
- ////////////////////////////////////////////////////////////////////////////////////////
78
- // Private Methods //
79
- ////////////////////////////////////////////////////////////////////////////////////////
80
- ////////////////////////////////////////////////////////////////////////////////////////
81
- // Listeners //
82
- ////////////////////////////////////////////////////////////////////////////////////////
83
  }
1
  <?php
 
2
  class BWGModelWidgetFrontEnd {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  public function get_tags_data($count) {
4
  global $wpdb;
5
  $rows = $wpdb->get_results('SELECT image.thumb_url as thumb_url, image.id as image_id, tags.name, tags.slug, tags.term_id, image.filetype FROM ' . $wpdb->prefix . 'terms AS tags INNER JOIN ' . $wpdb->prefix . 'term_taxonomy AS taxonomy ON taxonomy.term_id=tags.term_id INNER JOIN (SELECT image.thumb_url, tag.tag_id, image.id, image.filetype FROM ' . $wpdb->prefix . 'bwg_image AS image INNER JOIN ' . $wpdb->prefix . 'bwg_image_tag AS tag ON image.id=tag.image_id ORDER BY RAND()) AS image ON image.tag_id=tags.term_id WHERE taxonomy.taxonomy="bwg_tag" GROUP BY tags.term_id' . ($count ? ' LIMIT ' . $count : ""));
6
  foreach ($rows as $row) {
7
+ $row->permalink = WDWLibrary::bwg_create_post($row->name, $row->slug, array("type" => "gallery", "mode" => "tag"), $row->term_id);
8
  }
9
  return $rows;
10
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  }
frontend/views/BWGViewAlbum_compact_preview.php CHANGED
@@ -1,27 +1,5 @@
1
  <?php
2
-
3
  class BWGViewAlbum_compact_preview {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- private $model;
14
-
15
-
16
- ////////////////////////////////////////////////////////////////////////////////////////
17
- // Constructor & Destructor //
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- public function __construct($model) {
20
- $this->model = $model;
21
- }
22
- ////////////////////////////////////////////////////////////////////////////////////////
23
- // Public Methods //
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
  public function display($params, $from_shortcode = 0, $bwg = 0) {
26
  global $WD_BWG_UPLOAD_DIR;
27
  require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
@@ -86,7 +64,7 @@ class BWGViewAlbum_compact_preview {
86
  if (!isset($params['show_tag_box'])) {
87
  $params['show_tag_box'] = 0;
88
  }
89
- $options_row = $this->model->get_options_row_data();
90
  $placeholder = isset($options_row->placeholder) ? $options_row->placeholder : '';
91
  if (!isset($params['show_album_name'])) {
92
  $params['show_album_name'] = $options_row->show_album_name;
@@ -146,13 +124,13 @@ class BWGViewAlbum_compact_preview {
146
  $params['popup_effect_duration'] = isset($options_row->popup_effect_duration) ? $options_row->popup_effect_duration : 1;
147
  }
148
 
149
- $theme_row = $this->model->get_theme_row_data($params['theme_id']);
150
  if (!$theme_row) {
151
  echo WDWLibrary::message(__('There is no theme selected or the theme was deleted.', 'bwg'), 'wd_error');
152
  return;
153
  }
154
  $album_gallery_id = (isset($_REQUEST['album_gallery_id_' . $bwg]) ? esc_html($_REQUEST['album_gallery_id_' . $bwg]) : $params['album_id']);
155
- $album_row_data = $this->model->get_album_row_data($album_gallery_id);
156
 
157
  if (!$album_gallery_id || ($type == 'album' && !$album_row_data)) {
158
  echo WDWLibrary::message(__('There is no album selected or the album was deleted.', 'bwg'), 'wd_error');
@@ -174,12 +152,13 @@ class BWGViewAlbum_compact_preview {
174
  $params['sort_by'] = $sort_by;
175
  }
176
  }
177
- $image_rows = $this->model->get_image_rows_data($album_gallery_id, $items_per_page, $params['sort_by'], $bwg, $sort_direction);
 
 
178
  $images_count = count($image_rows);
179
- if (!$image_rows) {
180
  echo WDWLibrary::message(__('There are no images in this gallery.', 'bwg'), 'wd_error');
181
  }
182
- $page_nav = $this->model->gallery_page_nav($album_gallery_id, $bwg);
183
  $album_gallery_div_id = 'bwg_album_compact_' . $bwg;
184
  $album_gallery_div_class = 'bwg_standart_thumbnails_' . $bwg;
185
  }
@@ -188,12 +167,13 @@ class BWGViewAlbum_compact_preview {
188
  $items_per_page_arr = array('images_per_page' => $params['compuct_albums_per_page'], 'load_more_image_count' => $params['compuct_albums_per_page']);
189
  $items_col_num = $params['compuct_album_column_number'];
190
  $sort_by = $from === "widget" && $params['show'] == 'random' ? 'RAND()' : 'order';
191
- $album_galleries_row = $this->model->get_alb_gals_row($album_gallery_id, $items_per_page, $sort_by, $bwg, ' ASC ');
 
 
192
  if (!$album_galleries_row) {
193
  echo WDWLibrary::message(__('There is no album selected or the album was deleted.', 'bwg'), 'wd_error');
194
  return;
195
  }
196
- $page_nav = $this->model->album_page_nav($album_gallery_id, $bwg);
197
  $album_gallery_div_id = 'bwg_album_compact_' . $bwg;
198
  $album_gallery_div_class = 'bwg_album_thumbnails_' . $bwg;
199
  }
@@ -271,7 +251,7 @@ class BWGViewAlbum_compact_preview {
271
  $params_array['watermark_height'] = $params['watermark_height'];
272
  }
273
  $params_array_hash = $params_array;
274
- $tags_rows = $this->model->get_tags_rows_data($album_gallery_id);
275
  $image_right_click = $options_row->image_right_click;
276
  ?>
277
  <style>
@@ -570,7 +550,7 @@ class BWGViewAlbum_compact_preview {
570
  }
571
  </style>
572
  <?php
573
- $album_row = $this->model->get_album_row_data($album_gallery_id);
574
  ?>
575
  <div id="bwg_container1_<?php echo $bwg; ?>">
576
  <div id="bwg_container2_<?php echo $bwg; ?>">
@@ -629,7 +609,7 @@ class BWGViewAlbum_compact_preview {
629
  }
630
  foreach ($album_galleries_row as $album_galallery_row) {
631
  if ($album_galallery_row->is_album) {
632
- $album_row = $this->model->get_album_row_data($album_galallery_row->alb_gal_id);
633
  if (!$album_row) {
634
  continue;
635
  }
@@ -642,7 +622,7 @@ class BWGViewAlbum_compact_preview {
642
  $permalink = $album_row->permalink;
643
  }
644
  else {
645
- $gallery_row = $this->model->get_gallery_row_data($album_galallery_row->alb_gal_id);
646
  if (!$gallery_row) {
647
  continue;
648
  }
@@ -906,14 +886,4 @@ class BWGViewAlbum_compact_preview {
906
  die();
907
  }
908
  }
909
-
910
- ////////////////////////////////////////////////////////////////////////////////////////
911
- // Getters & Setters //
912
- ////////////////////////////////////////////////////////////////////////////////////////
913
- ////////////////////////////////////////////////////////////////////////////////////////
914
- // Private Methods //
915
- ////////////////////////////////////////////////////////////////////////////////////////
916
- ////////////////////////////////////////////////////////////////////////////////////////
917
- // Listeners //
918
- ////////////////////////////////////////////////////////////////////////////////////////
919
  }
1
  <?php
 
2
  class BWGViewAlbum_compact_preview {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  public function display($params, $from_shortcode = 0, $bwg = 0) {
4
  global $WD_BWG_UPLOAD_DIR;
5
  require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
64
  if (!isset($params['show_tag_box'])) {
65
  $params['show_tag_box'] = 0;
66
  }
67
+ $options_row = WDWLibrary::get_options_row_data();
68
  $placeholder = isset($options_row->placeholder) ? $options_row->placeholder : '';
69
  if (!isset($params['show_album_name'])) {
70
  $params['show_album_name'] = $options_row->show_album_name;
124
  $params['popup_effect_duration'] = isset($options_row->popup_effect_duration) ? $options_row->popup_effect_duration : 1;
125
  }
126
 
127
+ $theme_row = WDWLibrary::get_theme_row_data($params['theme_id']);
128
  if (!$theme_row) {
129
  echo WDWLibrary::message(__('There is no theme selected or the theme was deleted.', 'bwg'), 'wd_error');
130
  return;
131
  }
132
  $album_gallery_id = (isset($_REQUEST['album_gallery_id_' . $bwg]) ? esc_html($_REQUEST['album_gallery_id_' . $bwg]) : $params['album_id']);
133
+ $album_row_data = WDWLibrary::get_album_row_data($album_gallery_id, true);
134
 
135
  if (!$album_gallery_id || ($type == 'album' && !$album_row_data)) {
136
  echo WDWLibrary::message(__('There is no album selected or the album was deleted.', 'bwg'), 'wd_error');
152
  $params['sort_by'] = $sort_by;
153
  }
154
  }
155
+ $image_rows = WDWLibrary::get_image_rows_data($album_gallery_id, $bwg, 'album_compact', 'bwg_tag_id_bwg_album_compact_' . $bwg, '', $items_per_page, $params['compuct_album_images_per_page'], $params['sort_by'], $sort_direction);
156
+ $page_nav = $image_rows['page_nav'];
157
+ $image_rows = $image_rows['images'];
158
  $images_count = count($image_rows);
159
+ if (!$images_count) {
160
  echo WDWLibrary::message(__('There are no images in this gallery.', 'bwg'), 'wd_error');
161
  }
 
162
  $album_gallery_div_id = 'bwg_album_compact_' . $bwg;
163
  $album_gallery_div_class = 'bwg_standart_thumbnails_' . $bwg;
164
  }
167
  $items_per_page_arr = array('images_per_page' => $params['compuct_albums_per_page'], 'load_more_image_count' => $params['compuct_albums_per_page']);
168
  $items_col_num = $params['compuct_album_column_number'];
169
  $sort_by = $from === "widget" && $params['show'] == 'random' ? 'RAND()' : 'order';
170
+ $album_galleries_row = WDWLibrary::get_alb_gals_row($album_gallery_id, $items_per_page, $sort_by, $bwg, ' ASC ');
171
+ $page_nav = $album_galleries_row['page_nav'];
172
+ $album_galleries_row = $album_galleries_row['rows'];
173
  if (!$album_galleries_row) {
174
  echo WDWLibrary::message(__('There is no album selected or the album was deleted.', 'bwg'), 'wd_error');
175
  return;
176
  }
 
177
  $album_gallery_div_id = 'bwg_album_compact_' . $bwg;
178
  $album_gallery_div_class = 'bwg_album_thumbnails_' . $bwg;
179
  }
251
  $params_array['watermark_height'] = $params['watermark_height'];
252
  }
253
  $params_array_hash = $params_array;
254
+ $tags_rows = WDWLibrary::get_tags_rows_data($album_gallery_id);
255
  $image_right_click = $options_row->image_right_click;
256
  ?>
257
  <style>
550
  }
551
  </style>
552
  <?php
553
+ $album_row = WDWLibrary::get_album_row_data($album_gallery_id, true);
554
  ?>
555
  <div id="bwg_container1_<?php echo $bwg; ?>">
556
  <div id="bwg_container2_<?php echo $bwg; ?>">
609
  }
610
  foreach ($album_galleries_row as $album_galallery_row) {
611
  if ($album_galallery_row->is_album) {
612
+ $album_row = WDWLibrary::get_album_row_data($album_galallery_row->alb_gal_id, true);
613
  if (!$album_row) {
614
  continue;
615
  }
622
  $permalink = $album_row->permalink;
623
  }
624
  else {
625
+ $gallery_row = WDWLibrary::get_gallery_row_data($album_galallery_row->alb_gal_id, "compact");
626
  if (!$gallery_row) {
627
  continue;
628
  }
886
  die();
887
  }
888
  }
 
 
 
 
 
 
 
 
 
 
889
  }
frontend/views/BWGViewAlbum_extended_preview.php CHANGED
@@ -1,31 +1,9 @@
1
  <?php
2
-
3
  class BWGViewAlbum_extended_preview {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- private $model;
14
-
15
-
16
- ////////////////////////////////////////////////////////////////////////////////////////
17
- // Constructor & Destructor //
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- public function __construct($model) {
20
- $this->model = $model;
21
- }
22
- ////////////////////////////////////////////////////////////////////////////////////////
23
- // Public Methods //
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
  public function display($params, $from_shortcode = 0, $bwg = 0) {
26
  global $WD_BWG_UPLOAD_DIR;
27
  require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
28
- $options_row = $this->model->get_options_row_data();
29
  $placeholder = isset($options_row->placeholder) ? $options_row->placeholder : '';
30
  $play_icon = $options_row->play_icon;
31
 
@@ -90,7 +68,7 @@ class BWGViewAlbum_extended_preview {
90
  $params['extended_album_enable_page'] = 1;
91
  }
92
  $sort_direction = ' ' . $params['order_by'] . ' ';
93
- $theme_row = $this->model->get_theme_row_data($params['theme_id']);
94
  if (!$theme_row) {
95
  echo WDWLibrary::message(__('There is no theme selected or the theme was deleted.', 'bwg'), 'wd_error');
96
  return;
@@ -98,7 +76,7 @@ class BWGViewAlbum_extended_preview {
98
  $type = (isset($_REQUEST['type_' . $bwg]) ? esc_html($_REQUEST['type_' . $bwg]) : 'album');
99
  $bwg_search = ((isset($_POST['bwg_search_' . $bwg]) && esc_html($_POST['bwg_search_' . $bwg]) != '') ? esc_html($_POST['bwg_search_' . $bwg]) : '');
100
  $album_gallery_id = (isset($_REQUEST['album_gallery_id_' . $bwg]) ? esc_html($_REQUEST['album_gallery_id_' . $bwg]) : $params['album_id']);
101
- if (!$album_gallery_id || ($type == 'album' && !$this->model->get_album_row_data($album_gallery_id))) {
102
  echo WDWLibrary::message(__('There is no album selected or the album was deleted.', 'bwg'), 'wd_error');
103
  return;
104
  }
@@ -118,12 +96,13 @@ class BWGViewAlbum_extended_preview {
118
  $params['sort_by'] = $sort_by;
119
  }
120
  }
121
- $image_rows = $this->model->get_image_rows_data($album_gallery_id, $items_per_page, $params['sort_by'], $bwg, $sort_direction);
 
 
122
  $images_count = count($image_rows);
123
- if (!$image_rows) {
124
  echo WDWLibrary::message(__('There are no images in this gallery.', 'bwg'), 'wd_error');
125
  }
126
- $page_nav = $this->model->gallery_page_nav($album_gallery_id, $bwg);
127
  $album_gallery_div_id = 'bwg_album_extended_' . $bwg;
128
  $album_gallery_div_class = 'bwg_standart_thumbnails_' . $bwg;
129
  }
@@ -131,12 +110,13 @@ class BWGViewAlbum_extended_preview {
131
  $items_per_page = $params['extended_albums_per_page'];
132
  $items_per_page_arr = array('images_per_page' => $params['extended_albums_per_page'], 'load_more_image_count' => $params['extended_albums_per_page']);
133
  $items_col_num = 1;
134
- $album_galleries_row = $this->model->get_alb_gals_row($album_gallery_id, $items_per_page, 'order', $bwg, ' asc ');
 
 
135
  if (!$album_galleries_row) {
136
  echo WDWLibrary::message(__('There is no album selected or the album was deleted.', 'bwg'), 'wd_error');
137
  return;
138
  }
139
- $page_nav = $this->model->album_page_nav($album_gallery_id, $bwg);
140
  $album_gallery_div_id = 'bwg_album_extended_' . $bwg;
141
  $album_gallery_div_class = 'bwg_album_extended_thumbnails_' . $bwg;
142
  }
@@ -213,7 +193,7 @@ class BWGViewAlbum_extended_preview {
213
  $params_array['watermark_width'] = $params['watermark_width'];
214
  $params_array['watermark_height'] = $params['watermark_height'];
215
  }
216
- $tags_rows = $this->model->get_tags_rows_data($album_gallery_id);
217
  $image_right_click = $options_row->image_right_click;
218
  ?>
219
  <style>
@@ -596,7 +576,7 @@ class BWGViewAlbum_extended_preview {
596
  }
597
  foreach ($album_galleries_row as $album_galallery_row) {
598
  if ($album_galallery_row->is_album) {
599
- $album_row = $this->model->get_album_row_data($album_galallery_row->alb_gal_id);
600
  if (!$album_row) {
601
  continue;
602
  }
@@ -609,7 +589,7 @@ class BWGViewAlbum_extended_preview {
609
  $description = wpautop($album_row->description);
610
  }
611
  else {
612
- $gallery_row = $this->model->get_gallery_row_data($album_galallery_row->alb_gal_id);
613
  if (!$gallery_row) {
614
  continue;
615
  }
@@ -887,14 +867,4 @@ class BWGViewAlbum_extended_preview {
887
  die();
888
  }
889
  }
890
-
891
- ////////////////////////////////////////////////////////////////////////////////////////
892
- // Getters & Setters //
893
- ////////////////////////////////////////////////////////////////////////////////////////
894
- ////////////////////////////////////////////////////////////////////////////////////////
895
- // Private Methods //
896
- ////////////////////////////////////////////////////////////////////////////////////////
897
- ////////////////////////////////////////////////////////////////////////////////////////
898
- // Listeners //
899
- ////////////////////////////////////////////////////////////////////////////////////////
900
  }
1
  <?php
 
2
  class BWGViewAlbum_extended_preview {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  public function display($params, $from_shortcode = 0, $bwg = 0) {
4
  global $WD_BWG_UPLOAD_DIR;
5
  require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
6
+ $options_row = WDWLibrary::get_options_row_data();
7
  $placeholder = isset($options_row->placeholder) ? $options_row->placeholder : '';
8
  $play_icon = $options_row->play_icon;
9
 
68
  $params['extended_album_enable_page'] = 1;
69
  }
70
  $sort_direction = ' ' . $params['order_by'] . ' ';
71
+ $theme_row = WDWLibrary::get_theme_row_data($params['theme_id']);
72
  if (!$theme_row) {
73
  echo WDWLibrary::message(__('There is no theme selected or the theme was deleted.', 'bwg'), 'wd_error');
74
  return;
76
  $type = (isset($_REQUEST['type_' . $bwg]) ? esc_html($_REQUEST['type_' . $bwg]) : 'album');
77
  $bwg_search = ((isset($_POST['bwg_search_' . $bwg]) && esc_html($_POST['bwg_search_' . $bwg]) != '') ? esc_html($_POST['bwg_search_' . $bwg]) : '');
78
  $album_gallery_id = (isset($_REQUEST['album_gallery_id_' . $bwg]) ? esc_html($_REQUEST['album_gallery_id_' . $bwg]) : $params['album_id']);
79
+ if (!$album_gallery_id || ($type == 'album' && !WDWLibrary::get_album_row_data($album_gallery_id, false))) {
80
  echo WDWLibrary::message(__('There is no album selected or the album was deleted.', 'bwg'), 'wd_error');
81
  return;
82
  }
96
  $params['sort_by'] = $sort_by;
97
  }
98
  }
99
+ $image_rows = WDWLibrary::get_image_rows_data($album_gallery_id, $bwg, 'album_extended', 'bwg_tag_id_bwg_album_extended_' . $bwg, '', $items_per_page, $params['extended_album_images_per_page'], $params['sort_by'], $sort_direction);
100
+ $page_nav = $image_rows['page_nav'];
101
+ $image_rows = $image_rows['images'];
102
  $images_count = count($image_rows);
103
+ if (!$images_count) {
104
  echo WDWLibrary::message(__('There are no images in this gallery.', 'bwg'), 'wd_error');
105
  }
 
106
  $album_gallery_div_id = 'bwg_album_extended_' . $bwg;
107
  $album_gallery_div_class = 'bwg_standart_thumbnails_' . $bwg;
108
  }
110
  $items_per_page = $params['extended_albums_per_page'];
111
  $items_per_page_arr = array('images_per_page' => $params['extended_albums_per_page'], 'load_more_image_count' => $params['extended_albums_per_page']);
112
  $items_col_num = 1;
113
+ $album_galleries_row = WDWLibrary::get_alb_gals_row($album_gallery_id, $items_per_page, 'order', $bwg, ' ASC ');
114
+ $page_nav = $album_galleries_row['page_nav'];
115
+ $album_galleries_row = $album_galleries_row['rows'];
116
  if (!$album_galleries_row) {
117
  echo WDWLibrary::message(__('There is no album selected or the album was deleted.', 'bwg'), 'wd_error');
118
  return;
119
  }
 
120
  $album_gallery_div_id = 'bwg_album_extended_' . $bwg;
121
  $album_gallery_div_class = 'bwg_album_extended_thumbnails_' . $bwg;
122
  }
193
  $params_array['watermark_width'] = $params['watermark_width'];
194
  $params_array['watermark_height'] = $params['watermark_height'];
195
  }
196
+ $tags_rows = WDWLibrary::get_tags_rows_data($album_gallery_id);
197
  $image_right_click = $options_row->image_right_click;
198
  ?>
199
  <style>
576
  }
577
  foreach ($album_galleries_row as $album_galallery_row) {
578
  if ($album_galallery_row->is_album) {
579
+ $album_row = WDWLibrary::get_album_row_data($album_galallery_row->alb_gal_id, false);
580
  if (!$album_row) {
581
  continue;
582
  }
589
  $description = wpautop($album_row->description);
590
  }
591
  else {
592
+ $gallery_row = WDWLibrary::get_gallery_row_data($album_galallery_row->alb_gal_id);
593
  if (!$gallery_row) {
594
  continue;
595
  }
867
  die();
868
  }
869
  }
 
 
 
 
 
 
 
 
 
 
870
  }
frontend/views/BWGViewGalleryBox.php CHANGED
@@ -23,7 +23,7 @@ class BWGViewGalleryBox {
23
  public function display() {
24
  global $WD_BWG_UPLOAD_DIR;
25
  require_once(WD_BWG_DIR . '/framework/WDWLibraryEmbed.php');
26
- $tag_id = (isset($_GET['tag_id']) ? esc_html($_GET['tag_id']) : 0);
27
  $gallery_id = WDWLibrary::esc_script('get', 'gallery_id', 0, 'int');
28
  $bwg = (isset($_GET['current_view']) ? esc_html($_GET['current_view']) : 0);
29
  $current_image_id = WDWLibrary::esc_script('get', 'image_id', 0, 'int');
@@ -66,18 +66,13 @@ class BWGViewGalleryBox {
66
  $watermark_width = (isset($_GET['watermark_width']) ? esc_html($_GET['watermark_width']) : 90);
67
  $watermark_height = (isset($_GET['watermark_height']) ? esc_html($_GET['watermark_height']) : 90);
68
 
69
- $theme_row = $this->model->get_theme_row_data($theme_id);
70
- $option_row = $this->model->get_option_row_data();
71
  $image_right_click = $option_row->image_right_click;
72
  $image_filmstrip_height = 0;
73
  $image_filmstrip_width = 0;
74
 
75
- if ($tag_id != 0) {
76
- $image_rows = $this->model->get_image_rows_data_tag($tag_id, $sort_by, $order_by);
77
- }
78
- else {
79
- $image_rows = $this->model->get_image_rows_data($gallery_id, $bwg, $sort_by, $order_by);
80
- }
81
  $image_id = (isset($_POST['image_id']) ? (int) $_POST['image_id'] : $current_image_id);
82
  $filmstrip_thumb_margin = $theme_row->lightbox_filmstrip_thumb_margin;
83
  $margins_split = explode(" ", $filmstrip_thumb_margin);
23
  public function display() {
24
  global $WD_BWG_UPLOAD_DIR;
25
  require_once(WD_BWG_DIR . '/framework/WDWLibraryEmbed.php');
26
+ $tag = (isset($_GET['tag']) ? esc_html($_GET['tag']) : 0);
27
  $gallery_id = WDWLibrary::esc_script('get', 'gallery_id', 0, 'int');
28
  $bwg = (isset($_GET['current_view']) ? esc_html($_GET['current_view']) : 0);
29
  $current_image_id = WDWLibrary::esc_script('get', 'image_id', 0, 'int');
66
  $watermark_width = (isset($_GET['watermark_width']) ? esc_html($_GET['watermark_width']) : 90);
67
  $watermark_height = (isset($_GET['watermark_height']) ? esc_html($_GET['watermark_height']) : 90);
68
 
69
+ $theme_row = WDWLibrary::get_theme_row_data($theme_id);
70
+ $option_row = WDWLibrary::get_options_row_data();
71
  $image_right_click = $option_row->image_right_click;
72
  $image_filmstrip_height = 0;
73
  $image_filmstrip_width = 0;
74
 
75
+ $image_rows = $this->model->get_image_rows_data($gallery_id, $bwg, $sort_by, $order_by, $tag);
 
 
 
 
 
76
  $image_id = (isset($_POST['image_id']) ? (int) $_POST['image_id'] : $current_image_id);
77
  $filmstrip_thumb_margin = $theme_row->lightbox_filmstrip_thumb_margin;
78
  $margins_split = explode(" ", $filmstrip_thumb_margin);
frontend/views/BWGViewImage_browser.php CHANGED
@@ -1,32 +1,10 @@
1
  <?php
2
-
3
  class BWGViewImage_browser {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- private $model;
14
-
15
-
16
- ////////////////////////////////////////////////////////////////////////////////////////
17
- // Constructor & Destructor //
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- public function __construct($model) {
20
- $this->model = $model;
21
- }
22
- ////////////////////////////////////////////////////////////////////////////////////////
23
- // Public Methods //
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
  public function display($params, $from_shortcode = 0, $bwg = 0) {
26
  global $WD_BWG_UPLOAD_DIR;
27
  require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
28
  require_once(WD_BWG_DIR . '/framework/WDWLibraryEmbed.php');
29
- $theme_row = $this->model->get_theme_row_data($params['theme_id']);
30
  if (!isset($params['order_by'])) {
31
  $order_by = 'asc';
32
  }
@@ -66,27 +44,36 @@ class BWGViewImage_browser {
66
  if (!isset($params['popup_hit_counter'])) {
67
  $params['popup_hit_counter'] = 0;
68
  }
 
 
 
69
  if (!$theme_row) {
70
  echo WDWLibrary::message(__('There is no theme selected or the theme was deleted.', 'bwg'), 'wd_error');
71
  return;
72
  }
73
- $gallery_row = $this->model->get_gallery_row_data($params['gallery_id']);
74
- if (!$gallery_row) {
75
  echo WDWLibrary::message(__('There is no gallery selected or the gallery was deleted.', 'bwg'), 'wd_error');
76
  return;
77
  }
78
- $image_rows = $this->model->get_image_rows_data($params['gallery_id'], 1, $params['sort_by'], $order_by, $bwg);
79
- $images_count = count($image_rows);
 
 
80
  if (!$image_rows) {
81
- echo WDWLibrary::message(__('There are no images in this gallery.', 'bwg'), 'wd_error');
 
 
 
 
 
82
  }
83
- $page_nav = $this->model->page_nav($params['gallery_id'], 1, $bwg);
84
  $rgb_page_nav_font_color = WDWLibrary::spider_hex2rgb($theme_row->page_nav_font_color);
85
  $image_browser_images_conteiner = WDWLibrary::spider_hex2rgb($theme_row->image_browser_full_bg_color);
86
  $bwg_image_browser_image = WDWLibrary::spider_hex2rgb($theme_row->image_browser_bg_color);
87
  $image_title = $params['image_browser_title_enable'];
88
  $enable_image_description = $params['image_browser_description_enable'];
89
- $option_row = $this->model->get_option_row_data();
90
  $placeholder = isset($option_row->placeholder) ? $option_row->placeholder : '';
91
  $image_right_click = $option_row->image_right_click;
92
  if (!isset($params['popup_fullscreen'])) {
@@ -124,7 +111,8 @@ class BWGViewImage_browser {
124
  'enable_image_pinterest' => $params['popup_enable_pinterest'],
125
  'enable_image_tumblr' => $params['popup_enable_tumblr'],
126
  'watermark_type' => $params['watermark_type'],
127
- 'slideshow_effect_duration' => isset($params['popup_effect_duration']) ? $params['popup_effect_duration'] : 1
 
128
  );
129
  $items_per_page = array('images_per_page' => 1, 'load_more_image_count' => 1);
130
  if ($params['watermark_type'] == 'none') {
@@ -639,13 +627,4 @@ class BWGViewImage_browser {
639
  die();
640
  }
641
  }
642
- ////////////////////////////////////////////////////////////////////////////////////////
643
- // Getters & Setters //
644
- ////////////////////////////////////////////////////////////////////////////////////////
645
- ////////////////////////////////////////////////////////////////////////////////////////
646
- // Private Methods //
647
- ////////////////////////////////////////////////////////////////////////////////////////
648
- ////////////////////////////////////////////////////////////////////////////////////////
649
- // Listeners //
650
- ////////////////////////////////////////////////////////////////////////////////////////
651
  }
1
  <?php
 
2
  class BWGViewImage_browser {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  public function display($params, $from_shortcode = 0, $bwg = 0) {
4
  global $WD_BWG_UPLOAD_DIR;
5
  require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
6
  require_once(WD_BWG_DIR . '/framework/WDWLibraryEmbed.php');
7
+ $theme_row = WDWLibrary::get_theme_row_data($params['theme_id']);
8
  if (!isset($params['order_by'])) {
9
  $order_by = 'asc';
10
  }
44
  if (!isset($params['popup_hit_counter'])) {
45
  $params['popup_hit_counter'] = 0;
46
  }
47
+ if (!isset($params['tag'])) {
48
+ $params['tag'] = 0;
49
+ }
50
  if (!$theme_row) {
51
  echo WDWLibrary::message(__('There is no theme selected or the theme was deleted.', 'bwg'), 'wd_error');
52
  return;
53
  }
54
+ $gallery_row = WDWLibrary::get_gallery_row_data($params['gallery_id']);
55
+ if (!$gallery_row && $params["tag"] == 0) {
56
  echo WDWLibrary::message(__('There is no gallery selected or the gallery was deleted.', 'bwg'), 'wd_error');
57
  return;
58
  }
59
+ $image_rows = WDWLibrary::get_image_rows_data($params['gallery_id'], $bwg, 'image_browser', '', $params['tag'], 1, 1, $params['sort_by'], $params['order_by']);
60
+ $page_nav = $image_rows['page_nav'];
61
+ $image_rows = $image_rows['images'];
62
+ $images_count = count($image_rows);
63
  if (!$image_rows) {
64
+ if ($params['tag']) {
65
+ echo WDWLibrary::message(__('There are no images.', 'bwg'), 'wd_error');
66
+ }
67
+ else {
68
+ echo WDWLibrary::message(__('There are no images in this gallery.', 'bwg'), 'wd_error');
69
+ }
70
  }
 
71
  $rgb_page_nav_font_color = WDWLibrary::spider_hex2rgb($theme_row->page_nav_font_color);
72
  $image_browser_images_conteiner = WDWLibrary::spider_hex2rgb($theme_row->image_browser_full_bg_color);
73
  $bwg_image_browser_image = WDWLibrary::spider_hex2rgb($theme_row->image_browser_bg_color);
74
  $image_title = $params['image_browser_title_enable'];
75
  $enable_image_description = $params['image_browser_description_enable'];
76
+ $option_row = WDWLibrary::get_options_row_data();
77
  $placeholder = isset($option_row->placeholder) ? $option_row->placeholder : '';
78
  $image_right_click = $option_row->image_right_click;
79
  if (!isset($params['popup_fullscreen'])) {
111
  'enable_image_pinterest' => $params['popup_enable_pinterest'],
112
  'enable_image_tumblr' => $params['popup_enable_tumblr'],
113
  'watermark_type' => $params['watermark_type'],
114
+ 'slideshow_effect_duration' => isset($params['popup_effect_duration']) ? $params['popup_effect_duration'] : 1,
115
+ 'tag' => (isset($params['tag']) ? $params['tag'] : 0)
116
  );
117
  $items_per_page = array('images_per_page' => 1, 'load_more_image_count' => 1);
118
  if ($params['watermark_type'] == 'none') {
627
  die();
628
  }
629
  }
 
 
 
 
 
 
 
 
 
630
  }
frontend/views/BWGViewSlideshow.php CHANGED
@@ -1,34 +1,12 @@
1
  <?php
2
-
3
  class BWGViewSlideshow {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- private $model;
14
-
15
-
16
- ////////////////////////////////////////////////////////////////////////////////////////
17
- // Constructor & Destructor //
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- public function __construct($model) {
20
- $this->model = $model;
21
- }
22
- ////////////////////////////////////////////////////////////////////////////////////////
23
- // Public Methods //
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
  public function display($params, $from_shortcode = 0, $bwg = 0) {
26
  require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
27
  require_once(WD_BWG_DIR . '/framework/WDWLibraryEmbed.php');
28
 
29
  global $WD_BWG_UPLOAD_DIR;
30
  $from = (isset($params['from']) ? esc_html($params['from']) : 0);
31
- $options_row = $this->model->get_options_row_data();
32
  if (!isset($params['order_by'])) {
33
  $order_by = 'asc';
34
  }
@@ -38,10 +16,13 @@ class BWGViewSlideshow {
38
  if (!isset($params['slideshow_title_full_width'])) {
39
  $params['slideshow_title_full_width'] = 0;
40
  }
 
 
 
41
  $image_right_click = $options_row->image_right_click;
42
  if (!$from) {
43
  $theme_id = (isset($params['theme_id']) ? esc_html($params['theme_id']) : 1);
44
- $theme_row = $this->model->get_theme_row_data($theme_id);
45
  if (!$theme_row) {
46
  echo WDWLibrary::message(__('There is no theme selected or the theme was deleted.', 'bwg'), 'wd_error');
47
  return;
@@ -82,7 +63,7 @@ class BWGViewSlideshow {
82
  }
83
  else {
84
  $theme_id = (isset($params['theme_id']) ? esc_html($params['theme_id']) : 0);
85
- $theme_row = $this->model->get_theme_row_data($theme_id);
86
  if (!$theme_row) {
87
  echo WDWLibrary::message(__('There is no theme selected or the theme was deleted.', 'bwg'), 'wd_error');
88
  return;
@@ -121,14 +102,21 @@ class BWGViewSlideshow {
121
  $watermark_width = $options_row->watermark_width;
122
  $watermark_height = $options_row->watermark_height;
123
  }
124
- $gallery_row = $this->model->get_gallery_row_data($gallery_id);
125
- if (!$gallery_row) {
126
  echo WDWLibrary::message(__('There is no gallery selected or the gallery was deleted.', 'bwg'), 'wd_error');
127
  return;
128
  }
129
- $image_rows = $this->model->get_image_rows_data($gallery_id, $sort_by, $order_by, $bwg);
130
- if (!$image_rows) {
131
- echo WDWLibrary::message(__('There are no images in this gallery.', 'bwg'), 'wd_error');
 
 
 
 
 
 
 
132
  }
133
  $current_image_id = ($image_rows ? $image_rows[0]->id : 0);
134
  $play_pause_button_display = 'undefined';
@@ -1535,14 +1523,4 @@ class BWGViewSlideshow {
1535
  die();
1536
  }
1537
  }
1538
-
1539
- ////////////////////////////////////////////////////////////////////////////////////////
1540
- // Getters & Setters //
1541
- ////////////////////////////////////////////////////////////////////////////////////////
1542
- ////////////////////////////////////////////////////////////////////////////////////////
1543
- // Private Methods //
1544
- ////////////////////////////////////////////////////////////////////////////////////////
1545
- ////////////////////////////////////////////////////////////////////////////////////////
1546
- // Listeners //
1547
- ////////////////////////////////////////////////////////////////////////////////////////
1548
  }
1
  <?php
 
2
  class BWGViewSlideshow {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  public function display($params, $from_shortcode = 0, $bwg = 0) {
4
  require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
5
  require_once(WD_BWG_DIR . '/framework/WDWLibraryEmbed.php');
6
 
7
  global $WD_BWG_UPLOAD_DIR;
8
  $from = (isset($params['from']) ? esc_html($params['from']) : 0);
9
+ $options_row = WDWLibrary::get_options_row_data();
10
  if (!isset($params['order_by'])) {
11
  $order_by = 'asc';
12
  }
16
  if (!isset($params['slideshow_title_full_width'])) {
17
  $params['slideshow_title_full_width'] = 0;
18
  }
19
+ if (!isset($params['tag'])) {
20
+ $params['tag'] = 0;
21
+ }
22
  $image_right_click = $options_row->image_right_click;
23
  if (!$from) {
24
  $theme_id = (isset($params['theme_id']) ? esc_html($params['theme_id']) : 1);
25
+ $theme_row = WDWLibrary::get_theme_row_data($theme_id);
26
  if (!$theme_row) {
27
  echo WDWLibrary::message(__('There is no theme selected or the theme was deleted.', 'bwg'), 'wd_error');
28
  return;
63
  }
64
  else {
65
  $theme_id = (isset($params['theme_id']) ? esc_html($params['theme_id']) : 0);
66
+ $theme_row = WDWLibrary::get_theme_row_data($theme_id);
67
  if (!$theme_row) {
68
  echo WDWLibrary::message(__('There is no theme selected or the theme was deleted.', 'bwg'), 'wd_error');
69
  return;
102
  $watermark_width = $options_row->watermark_width;
103
  $watermark_height = $options_row->watermark_height;
104
  }
105
+ $gallery_row = WDWLibrary::get_gallery_row_data($gallery_id);
106
+ if (!$gallery_row && $params["tag"] == 0) {
107
  echo WDWLibrary::message(__('There is no gallery selected or the gallery was deleted.', 'bwg'), 'wd_error');
108
  return;
109
  }
110
+ $image_rows = WDWLibrary::get_image_rows_data($gallery_id, $bwg, 'slideshow', '', $params['tag'], '', '', $sort_by, $order_by);
111
+ $image_rows = $image_rows['images'];
112
+ $images_count = count($image_rows);
113
+ if (!$images_count) {
114
+ if ($params['tag']) {
115
+ echo WDWLibrary::message(__('There are no images.', 'bwg'), 'wd_error');
116
+ }
117
+ else {
118
+ echo WDWLibrary::message(__('There are no images in this gallery.', 'bwg'), 'wd_error');
119
+ }
120
  }
121
  $current_image_id = ($image_rows ? $image_rows[0]->id : 0);
122
  $play_pause_button_display = 'undefined';
1523
  die();
1524
  }
1525
  }
 
 
 
 
 
 
 
 
 
 
1526
  }
frontend/views/BWGViewThumbnails.php CHANGED
@@ -1,27 +1,5 @@
1
  <?php
2
-
3
  class BWGViewThumbnails {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- private $model;
14
-
15
-
16
- ////////////////////////////////////////////////////////////////////////////////////////
17
- // Constructor & Destructor //
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- public function __construct($model) {
20
- $this->model = $model;
21
- }
22
- ////////////////////////////////////////////////////////////////////////////////////////
23
- // Public Methods //
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
  public function display($params, $from_shortcode = 0, $bwg = 0) {
26
  global $WD_BWG_UPLOAD_DIR;
27
  require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
@@ -80,9 +58,12 @@ class BWGViewThumbnails {
80
  if (!isset($params['show_tag_box'])) {
81
  $params['show_tag_box'] = 0;
82
  }
 
 
 
83
  $from = (isset($params['from']) ? esc_html($params['from']) : 0);
84
  $sort_direction = ' ' . $params['order_by'] . ' ';
85
- $options_row = $this->model->get_options_row_data();
86
  $placeholder = isset($options_row->placeholder) ? $options_row->placeholder : '';
87
  $play_icon = $options_row->play_icon;
88
  if ($from) {
@@ -148,7 +129,7 @@ class BWGViewThumbnails {
148
  $params['sort_by'] = $sort_by;
149
  }
150
  }
151
- $theme_row = $this->model->get_theme_row_data($params['theme_id']);
152
  if (!$theme_row) {
153
  echo WDWLibrary::message(__('There is no theme selected or the theme was deleted.', 'bwg'), 'wd_error');
154
  return;
@@ -159,24 +140,30 @@ class BWGViewThumbnails {
159
  else {
160
  $type = "";
161
  }
162
- $gallery_row = $this->model->get_gallery_row_data($params['gallery_id']);
163
- if (!$gallery_row && ($type == '')) {
164
  echo WDWLibrary::message(__('There is no gallery selected or the gallery was deleted.', 'bwg'), 'wd_error');
165
  return;
166
  }
167
  $params['load_more_image_count'] = (isset($params['load_more_image_count']) && ($params['image_enable_page'] == 2)) ? $params['load_more_image_count'] : $params['images_per_page'];
168
  $items_per_page = array('images_per_page' => $params['images_per_page'], 'load_more_image_count' => $params['load_more_image_count']);
169
- $image_rows = $this->model->get_image_rows_data($params, $bwg, $type, $sort_direction);
170
- $images_count = count($image_rows);
171
- if (!$image_rows) {
172
- echo WDWLibrary::message(__('There are no images in this gallery.', 'bwg'), 'wd_error');
173
- }
174
  if ($params['image_enable_page'] && $params['images_per_page']) {
175
- $page_nav = $this->model->page_nav($params['gallery_id'], $bwg, $type);
 
 
 
 
 
 
 
 
 
 
176
  }
177
  $rgb_page_nav_font_color = WDWLibrary::spider_hex2rgb($theme_row->page_nav_font_color);
178
  $rgb_thumbs_bg_color = WDWLibrary::spider_hex2rgb($theme_row->thumbs_bg_color);
179
- $tags_rows = $this->model->get_tags_rows_data($params['gallery_id']);
180
  $image_right_click = $options_row->image_right_click;
181
  ?>
182
  <style>
@@ -508,7 +495,7 @@ class BWGViewThumbnails {
508
  <script>
509
  <?php
510
  $params_array = array(
511
- 'tag_id' => (isset($params['type']) ? $params['gallery_id'] : 0),
512
  'action' => 'GalleryBox',
513
  'current_view' => $bwg,
514
  'gallery_id' => $params['gallery_id'],
@@ -597,14 +584,4 @@ class BWGViewThumbnails {
597
  die();
598
  }
599
  }
600
-
601
- ////////////////////////////////////////////////////////////////////////////////////////
602
- // Getters & Setters //
603
- ////////////////////////////////////////////////////////////////////////////////////////
604
- ////////////////////////////////////////////////////////////////////////////////////////
605
- // Private Methods //
606
- ////////////////////////////////////////////////////////////////////////////////////////
607
- ////////////////////////////////////////////////////////////////////////////////////////
608
- // Listeners //
609
- ////////////////////////////////////////////////////////////////////////////////////////
610
  }
1
  <?php
 
2
  class BWGViewThumbnails {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  public function display($params, $from_shortcode = 0, $bwg = 0) {
4
  global $WD_BWG_UPLOAD_DIR;
5
  require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
58
  if (!isset($params['show_tag_box'])) {
59
  $params['show_tag_box'] = 0;
60
  }
61
+ if (!isset($params['tag'])) {
62
+ $params['tag'] = 0;
63
+ }
64
  $from = (isset($params['from']) ? esc_html($params['from']) : 0);
65
  $sort_direction = ' ' . $params['order_by'] . ' ';
66
+ $options_row = WDWLibrary::get_options_row_data();
67
  $placeholder = isset($options_row->placeholder) ? $options_row->placeholder : '';
68
  $play_icon = $options_row->play_icon;
69
  if ($from) {
129
  $params['sort_by'] = $sort_by;
130
  }
131
  }
132
+ $theme_row = WDWLibrary::get_theme_row_data($params['theme_id']);
133
  if (!$theme_row) {
134
  echo WDWLibrary::message(__('There is no theme selected or the theme was deleted.', 'bwg'), 'wd_error');
135
  return;
140
  else {
141
  $type = "";
142
  }
143
+ $gallery_row = WDWLibrary::get_gallery_row_data($params['gallery_id']);
144
+ if (!$gallery_row && ($type == '') && $params["tag"] == 0) {
145
  echo WDWLibrary::message(__('There is no gallery selected or the gallery was deleted.', 'bwg'), 'wd_error');
146
  return;
147
  }
148
  $params['load_more_image_count'] = (isset($params['load_more_image_count']) && ($params['image_enable_page'] == 2)) ? $params['load_more_image_count'] : $params['images_per_page'];
149
  $items_per_page = array('images_per_page' => $params['images_per_page'], 'load_more_image_count' => $params['load_more_image_count']);
150
+ $image_rows = WDWLibrary::get_image_rows_data($params['gallery_id'], $bwg, $type, 'bwg_tag_id_bwg_standart_thumbnails_' . $bwg, $params['tag'], $params['images_per_page'], $params['load_more_image_count'], $params['sort_by'], $sort_direction);
 
 
 
 
151
  if ($params['image_enable_page'] && $params['images_per_page']) {
152
+ $page_nav = $image_rows['page_nav'];
153
+ }
154
+ $image_rows = $image_rows['images'];
155
+ $images_count = count($image_rows);
156
+ if (!$images_count) {
157
+ if ($params['tag']) {
158
+ echo WDWLibrary::message(__('There are no images.', 'bwg'), 'wd_error');
159
+ }
160
+ else {
161
+ echo WDWLibrary::message(__('There are no images in this gallery.', 'bwg'), 'wd_error');
162
+ }
163
  }
164
  $rgb_page_nav_font_color = WDWLibrary::spider_hex2rgb($theme_row->page_nav_font_color);
165
  $rgb_thumbs_bg_color = WDWLibrary::spider_hex2rgb($theme_row->thumbs_bg_color);
166
+ $tags_rows = WDWLibrary::get_tags_rows_data($params['gallery_id']);
167
  $image_right_click = $options_row->image_right_click;
168
  ?>
169
  <style>
495
  <script>
496
  <?php
497
  $params_array = array(
498
+ 'tag' => (isset($params['tag']) ? $params['tag'] : 0),
499
  'action' => 'GalleryBox',
500
  'current_view' => $bwg,
501
  'gallery_id' => $params['gallery_id'],
584
  die();
585
  }
586
  }
 
 
 
 
 
 
 
 
 
 
587
  }
photo-gallery.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Photo Gallery
5
  * Plugin URI: https://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.3.13
8
  * Author: WebDorado
9
  * Author URI: https://web-dorado.com/
10
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
@@ -558,6 +558,7 @@ add_filter('mce_buttons', 'bwg_add_button', 0);
558
 
559
  // Photo Gallery Widget.
560
  if (class_exists('WP_Widget')) {
 
561
  require_once(WD_BWG_DIR . '/admin/controllers/BWGControllerWidget.php');
562
  add_action('widgets_init', create_function('', 'return register_widget("BWGControllerWidget");'));
563
  require_once(WD_BWG_DIR . '/admin/controllers/BWGControllerWidgetSlideshow.php');
@@ -1923,7 +1924,7 @@ function bwg_activate() {
1923
  ));
1924
  }
1925
  $version = WD_BWG_VERSION;
1926
- $new_version = '1.3.13';
1927
  if ($version && version_compare($version, $new_version, '<')) {
1928
  require_once WD_BWG_DIR . "/update/bwg_update.php";
1929
  bwg_update($version);
@@ -1975,7 +1976,7 @@ wp_oembed_add_provider( '#https://instagr(\.am|am\.com)/p/.*#i', 'https://api.in
1975
 
1976
  function bwg_update_hook() {
1977
  $version = WD_BWG_VERSION;
1978
- $new_version = '1.3.13';
1979
  if ($version && version_compare($version, $new_version, '<')) {
1980
  require_once WD_BWG_DIR . "/update/bwg_update.php";
1981
  bwg_update($version);
4
  * Plugin Name: Photo Gallery
5
  * Plugin URI: https://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.3.14
8
  * Author: WebDorado
9
  * Author URI: https://web-dorado.com/
10
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
558
 
559
  // Photo Gallery Widget.
560
  if (class_exists('WP_Widget')) {
561
+ require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
562
  require_once(WD_BWG_DIR . '/admin/controllers/BWGControllerWidget.php');
563
  add_action('widgets_init', create_function('', 'return register_widget("BWGControllerWidget");'));
564
  require_once(WD_BWG_DIR . '/admin/controllers/BWGControllerWidgetSlideshow.php');
1924
  ));
1925
  }
1926
  $version = WD_BWG_VERSION;
1927
+ $new_version = '1.3.14';
1928
  if ($version && version_compare($version, $new_version, '<')) {
1929
  require_once WD_BWG_DIR . "/update/bwg_update.php";
1930
  bwg_update($version);
1976
 
1977
  function bwg_update_hook() {
1978
  $version = WD_BWG_VERSION;
1979
+ $new_version = '1.3.14';
1980
  if ($version && version_compare($version, $new_version, '<')) {
1981
  require_once WD_BWG_DIR . "/update/bwg_update.php";
1982
  bwg_update($version);
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://web-dorado.com/products/wordpress-photo-gallery-plugin.html
4
  Tags: album, image gallery, gallery, image, images, lightbox, photo, photo gallery, photos, responsive, thumbnail, widget
5
  Requires at least: 3.4
6
  Tested up to: 4.6
7
- Stable tag: 1.3.13
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -224,6 +224,12 @@ To enable the feature of adding Media Library images, go to Photo Gallery > Opti
224
 
225
  == Changelog ==
226
 
 
 
 
 
 
 
227
  = 1.3.13 =
228
  * Fixed: Instagram gallery autoupdate.
229
  * Fixed: Add images and videos in French sites.
4
  Tags: album, image gallery, gallery, image, images, lightbox, photo, photo gallery, photos, responsive, thumbnail, widget
5
  Requires at least: 3.4
6
  Tested up to: 4.6
7
+ Stable tag: 1.3.14
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
224
 
225
  == Changelog ==
226
 
227
+ = 1.3.14 =
228
+ * Fixed: Social Bulk Embed bug for facebook.
229
+ * Fixed: Add facebook album bug.
230
+ * Added: Tag select from shortcode.
231
+ * Fixed: Improved tag search.
232
+
233
  = 1.3.13 =
234
  * Fixed: Instagram gallery autoupdate.
235
  * Fixed: Add images and videos in French sites.