Photo Gallery by WD – Responsive Photo Gallery - Version 1.6.1

Version Description

  • Added: AMP compatibility.
  • Added: Order by date for Gallery groups.
  • Added: Title tag to image tags.
  • Fixed: Portrait images in filmstrip with fix count.
  • Fixed: More Extended gallery group.
  • Fixed: Adding tags to the newly added image.
Download this release

Release Info

Developer 10web
Plugin Icon 128x128 Photo Gallery by WD – Responsive Photo Gallery
Version 1.6.1
Comparing to
See all releases

Code changes from version 1.6.0 to 1.6.1

admin/models/Albums.php CHANGED
@@ -354,7 +354,20 @@ class AlbumsModel_bwg {
354
  $old_slug = WDWLibrary::get('old_slug');
355
  $published = WDWLibrary::get('published', 0, 'intval');
356
  $preview_image = WDWLibrary::get('preview_image', '', 'esc_url_raw');
357
- $description = WDWLibrary::strip_tags(htmlspecialchars_decode(WDWLibrary::get('description', '', 'wp_filter_post_kses')));
 
 
 
 
 
 
 
 
 
 
 
 
 
358
  $albumgallery_ids = WDWLibrary::get('albumgallery_ids');
359
  $modified_date = WDWLibrary::get('modified_date', time(),'intval');
360
  $data = array(
354
  $old_slug = WDWLibrary::get('old_slug');
355
  $published = WDWLibrary::get('published', 0, 'intval');
356
  $preview_image = WDWLibrary::get('preview_image', '', 'esc_url_raw');
357
+ $description = '';
358
+ // In description we allow the "<!--more-->" divider.
359
+ $tmp_description = htmlspecialchars_decode(WDWLibrary::get('description', '', 'wp_filter_post_kses'));
360
+ if ( !empty($tmp_description) ) {
361
+ if ( stripos($tmp_description, '<!--more-->') !== FALSE ) {
362
+ $desc_array = explode('<!--more-->', $tmp_description);
363
+ $desc_first = $desc_array[0];
364
+ $desc_second = $desc_array[1];
365
+ $description = WDWLibrary::strip_tags($desc_first) . '<!--more-->' . WDWLibrary::strip_tags($desc_second);
366
+ }
367
+ else {
368
+ $description = WDWLibrary::strip_tags($tmp_description);
369
+ }
370
+ }
371
  $albumgallery_ids = WDWLibrary::get('albumgallery_ids');
372
  $modified_date = WDWLibrary::get('modified_date', time(),'intval');
373
  $data = array(
admin/models/Galleries.php CHANGED
@@ -555,10 +555,25 @@ class GalleriesModel_bwg {
555
  if ( empty($random_preview_image) ) {
556
  $random_preview_image = '';
557
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
558
  $data = array(
559
  'name' => $name,
560
  'slug' => $slug,
561
- 'description' => WDWLibrary::strip_tags(htmlspecialchars_decode(WDWLibrary::get('description', '', FALSE))),
562
  'page_link' => '',
563
  'preview_image' => $preview_image,
564
  'random_preview_image' => $random_preview_image,
@@ -571,6 +586,7 @@ class GalleriesModel_bwg {
571
  'update_flag' => WDWLibrary::get('update_flag'),
572
  'modified_date' => WDWLibrary::get('modified_date', time(), 'intval'),
573
  );
 
574
  $format = array(
575
  '%s',
576
  '%s',
555
  if ( empty($random_preview_image) ) {
556
  $random_preview_image = '';
557
  }
558
+ $description = '';
559
+ // In description we allow the "<!--more-->" divider.
560
+ $tmp_description = htmlspecialchars_decode(WDWLibrary::get('description', '', FALSE));
561
+ if ( !empty($tmp_description) ) {
562
+ if ( stripos($tmp_description, '<!--more-->') !== FALSE ) {
563
+ $desc_array = explode('<!--more-->', $tmp_description);
564
+ $desc_first = $desc_array[0];
565
+ $desc_second = $desc_array[1];
566
+ $description = WDWLibrary::strip_tags($desc_first) . '<!--more-->' . WDWLibrary::strip_tags($desc_second);
567
+ }
568
+ else {
569
+ $description = WDWLibrary::strip_tags($tmp_description);
570
+ }
571
+ }
572
+
573
  $data = array(
574
  'name' => $name,
575
  'slug' => $slug,
576
+ 'description' => $description,
577
  'page_link' => '',
578
  'preview_image' => $preview_image,
579
  'random_preview_image' => $random_preview_image,
586
  'update_flag' => WDWLibrary::get('update_flag'),
587
  'modified_date' => WDWLibrary::get('modified_date', time(), 'intval'),
588
  );
589
+
590
  $format = array(
591
  '%s',
592
  '%s',
admin/views/AddTags.php CHANGED
@@ -44,7 +44,14 @@ class AddTagsView_bwg extends AdminView_bwg {
44
  ?>
45
  <div class="wd-table-container">
46
  <?php
47
- $image_id = WDWLibrary::get('image_id', 0, 'intval');
 
 
 
 
 
 
 
48
  echo $this->title( array(
49
  'title' => $params['page_title'],
50
  'title_class' => 'wd-header',
@@ -110,7 +117,7 @@ class AddTagsView_bwg extends AdminView_bwg {
110
  <div class="media-frame-toolbar">
111
  <div class="media-toolbar">
112
  <div class="media-toolbar-primary search-form">
113
- <button class="button media-button button button-large media-button-insert" type="button" onclick="<?php echo $image_id ? 'bwg_remove_tags(\'' . $image_id . '\')' : 'bwg_bulk_add_tags(\'' . '' . '\',\'' . 'remove' . '\')'; ?>"><?php _e('Remove from image', BWG()->prefix); ?></button>
114
  <button class="button media-button button-primary button-large media-button-insert" type="button" onclick="<?php echo $image_id ? 'bwg_add_tags(\'' . $image_id . '\')' : 'bwg_bulk_add_tags(\'' . '' . '\',\'' . 'add' . '\')'; ?>"><?php _e('Add to image', BWG()->prefix); ?></button>
115
  </div>
116
  </div>
44
  ?>
45
  <div class="wd-table-container">
46
  <?php
47
+ //for newly added images, id starts with pr_
48
+ //if Select all checked, id equal to 0
49
+ //for other cases id must be positive number
50
+ if ( str_contains(WDWLibrary::get('image_id', 0), 'pr_') ) {
51
+ $image_id = WDWLibrary::get('image_id', 0);
52
+ } else {
53
+ $image_id = WDWLibrary::get('image_id', 0, 'intval');
54
+ }
55
  echo $this->title( array(
56
  'title' => $params['page_title'],
57
  'title_class' => 'wd-header',
117
  <div class="media-frame-toolbar">
118
  <div class="media-toolbar">
119
  <div class="media-toolbar-primary search-form">
120
+ <button class="button media-button button button-large media-button-insert" type="button" onclick="<?php echo $image_id ? 'bwg_remove_tags(\'' . $image_id . '\')' : 'bwg_bulk_add_tags(\'' . '' . '\',\'' . 'remove' . '\')'; ?>"><?php _e('Remove from image', BWG()->prefix); ?></button>
121
  <button class="button media-button button-primary button-large media-button-insert" type="button" onclick="<?php echo $image_id ? 'bwg_add_tags(\'' . $image_id . '\')' : 'bwg_bulk_add_tags(\'' . '' . '\',\'' . 'add' . '\')'; ?>"><?php _e('Add to image', BWG()->prefix); ?></button>
122
  </div>
123
  </div>
admin/views/Options.php CHANGED
@@ -2784,6 +2784,7 @@ class OptionsView_bwg extends AdminView_bwg {
2784
  <select name="compact_album_sort_by" id="compact_album_sort_by">
2785
  <option value="order" <?php if ($row->compact_album_sort_by == 'order') echo 'selected="selected"'; ?>><?php _e('Default', BWG()->prefix); ?></option>
2786
  <option value="name" <?php if ($row->compact_album_sort_by == 'name') echo 'selected="selected"'; ?>><?php _e('Title', BWG()->prefix); ?></option>
 
2787
  <option value="random" <?php if ($row->compact_album_sort_by == 'random') echo 'selected="selected"'; ?>><?php _e('Random', BWG()->prefix); ?></option>
2788
  </select>
2789
  </div>
@@ -3079,6 +3080,7 @@ class OptionsView_bwg extends AdminView_bwg {
3079
  <select name="masonry_album_sort_by" id="masonry_album_sort_by">
3080
  <option value="order" <?php if ($row->masonry_album_sort_by == 'order') echo 'selected="selected"'; ?>><?php _e('Default', BWG()->prefix); ?></option>
3081
  <option value="name" <?php if ($row->masonry_album_sort_by == 'name') echo 'selected="selected"'; ?>><?php _e('Title', BWG()->prefix); ?></option>
 
3082
  <option value="random" <?php if ($row->masonry_album_sort_by == 'random') echo 'selected="selected"'; ?>><?php _e('Random', BWG()->prefix); ?></option>
3083
  </select>
3084
  </div>
@@ -3317,6 +3319,7 @@ class OptionsView_bwg extends AdminView_bwg {
3317
  <select name="extended_album_sort_by" id="extended_album_sort_by">
3318
  <option value="order" <?php if ($row->extended_album_sort_by == 'order') echo 'selected="selected"'; ?>><?php _e('Default', BWG()->prefix); ?></option>
3319
  <option value="name" <?php if ($row->extended_album_sort_by == 'name') echo 'selected="selected"'; ?>><?php _e('Title', BWG()->prefix); ?></option>
 
3320
  <option value="random" <?php if ($row->extended_album_sort_by == 'random') echo 'selected="selected"'; ?>><?php _e('Random', BWG()->prefix); ?></option>
3321
  </select>
3322
  </div>
2784
  <select name="compact_album_sort_by" id="compact_album_sort_by">
2785
  <option value="order" <?php if ($row->compact_album_sort_by == 'order') echo 'selected="selected"'; ?>><?php _e('Default', BWG()->prefix); ?></option>
2786
  <option value="name" <?php if ($row->compact_album_sort_by == 'name') echo 'selected="selected"'; ?>><?php _e('Title', BWG()->prefix); ?></option>
2787
+ <option value="modified_date" <?php if ($row->compact_album_sort_by == 'modified_date') echo 'selected="selected"'; ?>><?php _e('Date', BWG()->prefix); ?></option>
2788
  <option value="random" <?php if ($row->compact_album_sort_by == 'random') echo 'selected="selected"'; ?>><?php _e('Random', BWG()->prefix); ?></option>
2789
  </select>
2790
  </div>
3080
  <select name="masonry_album_sort_by" id="masonry_album_sort_by">
3081
  <option value="order" <?php if ($row->masonry_album_sort_by == 'order') echo 'selected="selected"'; ?>><?php _e('Default', BWG()->prefix); ?></option>
3082
  <option value="name" <?php if ($row->masonry_album_sort_by == 'name') echo 'selected="selected"'; ?>><?php _e('Title', BWG()->prefix); ?></option>
3083
+ <option value="modified_date" <?php if ($row->masonry_album_sort_by == 'modified_date') echo 'selected="selected"'; ?>><?php _e('Date', BWG()->prefix); ?></option>
3084
  <option value="random" <?php if ($row->masonry_album_sort_by == 'random') echo 'selected="selected"'; ?>><?php _e('Random', BWG()->prefix); ?></option>
3085
  </select>
3086
  </div>
3319
  <select name="extended_album_sort_by" id="extended_album_sort_by">
3320
  <option value="order" <?php if ($row->extended_album_sort_by == 'order') echo 'selected="selected"'; ?>><?php _e('Default', BWG()->prefix); ?></option>
3321
  <option value="name" <?php if ($row->extended_album_sort_by == 'name') echo 'selected="selected"'; ?>><?php _e('Title', BWG()->prefix); ?></option>
3322
+ <option value="modified_date" <?php if ($row->extended_album_sort_by == 'modified_date') echo 'selected="selected"'; ?>><?php _e('Date', BWG()->prefix); ?></option>
3323
  <option value="random" <?php if ($row->extended_album_sort_by == 'random') echo 'selected="selected"'; ?>><?php _e('Random', BWG()->prefix); ?></option>
3324
  </select>
3325
  </div>
framework/WDWLibrary.php CHANGED
@@ -1301,12 +1301,11 @@ class WDWLibrary {
1301
 
1302
  $limit_str = '';
1303
  if ( $images_per_page ) {
1304
- $limit_str .= 'LIMIT %d, %d';
1305
  $prepareArgs[] = $limit;
1306
  $prepareArgs[] = $items_in_page;
1307
  }
1308
-
1309
- $join = $tag ? 'LEFT JOIN ' . $wpdb->prefix . 'bwg_image_tag as tag ON image.id=tag.image_id' : '';
1310
 
1311
  $filter_tags_name = self::get($tag_input_name, '', 'esc_sql', 'REQUEST');
1312
 
@@ -1329,10 +1328,12 @@ class WDWLibrary {
1329
  $where .= ' AND gallery.published = 1 ';
1330
 
1331
  if ( !empty($prepareArgs) ) {
1332
- $rows = $wpdb->get_results($wpdb->prepare('SELECT image.* FROM ' . $wpdb->prefix . 'bwg_image as image ' . $join . ' WHERE image.published=1 ' . $where . ' ORDER BY ' . str_replace('RAND()', 'RAND(' . $bwg_random_seed . ')', $sort_by) . ' ' . $sort_direction . ', image.id asc ' . $limit_str, $prepareArgs));
 
1333
  }
1334
  else {
1335
- $rows = $wpdb->get_results('SELECT image.* FROM ' . $wpdb->prefix . 'bwg_image as image ' . $join . ' WHERE image.published=1 ' . $where . ' ORDER BY ' . str_replace('RAND()', 'RAND(' . $bwg_random_seed . ')', $sort_by) . ' ' . $sort_direction . ', image.id asc ' . $limit_str);
 
1336
  }
1337
  if ( $images_per_page ) {
1338
  array_splice($prepareArgs, -2);
@@ -1431,7 +1432,11 @@ class WDWLibrary {
1431
  if ( preg_match( '/EMBED/', $image->filetype ) == 1 ) {
1432
  continue;
1433
  }
1434
- self::set_text_watermark( BWG()->upload_dir . $image->image_url, BWG()->upload_dir . $image->image_url, html_entity_decode( $options->built_in_watermark_text ), $options->built_in_watermark_font, $options->built_in_watermark_font_size, '#' . $options->built_in_watermark_color, $options->built_in_watermark_opacity, $options->built_in_watermark_position );
 
 
 
 
1435
  }
1436
  break;
1437
  case 'image':
@@ -1459,6 +1464,9 @@ class WDWLibrary {
1459
 
1460
  $watermark_transparency = 127 - ($watermark_transparency * 1.27);
1461
  list($width, $height, $type) = getimagesize($original_filename);
 
 
 
1462
  $watermark_image = imagecreatetruecolor($width, $height);
1463
 
1464
  $watermark_color = self::bwg_hex2rgb($watermark_color);
@@ -1514,6 +1522,7 @@ class WDWLibrary {
1514
  }
1515
  imagedestroy($watermark_image);
1516
  @ini_restore('memory_limit');
 
1517
  }
1518
 
1519
  public static function set_image_watermark($original_filename, $dest_filename, $watermark_url, $watermark_height, $watermark_width, $watermark_position) {
1301
 
1302
  $limit_str = '';
1303
  if ( $images_per_page ) {
1304
+ $limit_str .= ' LIMIT %d, %d';
1305
  $prepareArgs[] = $limit;
1306
  $prepareArgs[] = $items_in_page;
1307
  }
1308
+ $join = $tag ? ' LEFT JOIN ' . $wpdb->prefix . 'bwg_image_tag as tag ON image.id=tag.image_id' : '';
 
1309
 
1310
  $filter_tags_name = self::get($tag_input_name, '', 'esc_sql', 'REQUEST');
1311
 
1328
  $where .= ' AND gallery.published = 1 ';
1329
 
1330
  if ( !empty($prepareArgs) ) {
1331
+ $sql = $wpdb->prepare('SELECT image.* FROM ' . $wpdb->prefix . 'bwg_image as image ' . $join . ' WHERE image.published=1 ' . $where . ' ORDER BY ' . str_replace('RAND()', 'RAND(' . $bwg_random_seed . ')', $sort_by) . ' ' . $sort_direction . ', image.id asc ' . $limit_str, $prepareArgs);
1332
+ $rows = $wpdb->get_results($sql);
1333
  }
1334
  else {
1335
+ $sql = 'SELECT image.* FROM ' . $wpdb->prefix . 'bwg_image as image ' . $join . ' WHERE image.published=1 ' . $where . ' ORDER BY ' . str_replace('RAND()', 'RAND(' . $bwg_random_seed . ')', $sort_by) . ' ' . $sort_direction . ', image.id asc ' . $limit_str;
1336
+ $rows = $wpdb->get_results($sql);
1337
  }
1338
  if ( $images_per_page ) {
1339
  array_splice($prepareArgs, -2);
1432
  if ( preg_match( '/EMBED/', $image->filetype ) == 1 ) {
1433
  continue;
1434
  }
1435
+ $set_text_watermark = self::set_text_watermark( BWG()->upload_dir . $image->image_url, BWG()->upload_dir . $image->image_url, html_entity_decode( $options->built_in_watermark_text ), $options->built_in_watermark_font, $options->built_in_watermark_font_size, '#' . $options->built_in_watermark_color, $options->built_in_watermark_opacity, $options->built_in_watermark_position );
1436
+ if( ! $set_text_watermark ) {
1437
+ $message_id = 6;
1438
+ return $message_id;
1439
+ }
1440
  }
1441
  break;
1442
  case 'image':
1464
 
1465
  $watermark_transparency = 127 - ($watermark_transparency * 1.27);
1466
  list($width, $height, $type) = getimagesize($original_filename);
1467
+ if( $width == 0 || $height == 0 ) {
1468
+ return FALSE;
1469
+ }
1470
  $watermark_image = imagecreatetruecolor($width, $height);
1471
 
1472
  $watermark_color = self::bwg_hex2rgb($watermark_color);
1522
  }
1523
  imagedestroy($watermark_image);
1524
  @ini_restore('memory_limit');
1525
+ return TRUE;
1526
  }
1527
 
1528
  public static function set_image_watermark($original_filename, $dest_filename, $watermark_url, $watermark_height, $watermark_width, $watermark_position) {
frontend/controllers/controller.php CHANGED
@@ -9,8 +9,13 @@ class BWGControllerSite {
9
  require_once BWG()->plugin_dir . "/frontend/models/model.php";
10
  $this->model = new BWGModelSite();
11
  require_once BWG()->plugin_dir . "/frontend/views/view.php";
12
- require_once BWG()->plugin_dir . '/frontend/views/BWGView' . $view . '.php';
13
- $view_class = 'BWGView' . $view;
 
 
 
 
 
14
  $this->view = new $view_class();
15
 
16
  do_action('bwg_before_init_gallery');
@@ -369,7 +374,12 @@ class BWGControllerSite {
369
 
370
  $params['params_array'] = $params_array;
371
  $params['theme_row'] = $theme_row;
372
-
 
 
 
 
 
373
  $this->display($params, $from_shortcode, $bwg);
374
  }
375
 
9
  require_once BWG()->plugin_dir . "/frontend/models/model.php";
10
  $this->model = new BWGModelSite();
11
  require_once BWG()->plugin_dir . "/frontend/views/view.php";
12
+ if ( function_exists('amp_is_request') && amp_is_request() ) {
13
+ require_once BWG()->plugin_dir . '/frontend/views/BWGViewThumbnails.php';
14
+ $view_class = 'BWGViewThumbnails';
15
+ } else {
16
+ require_once BWG()->plugin_dir . '/frontend/views/BWGView' . $view . '.php';
17
+ $view_class = 'BWGView' . $view;
18
+ }
19
  $this->view = new $view_class();
20
 
21
  do_action('bwg_before_init_gallery');
374
 
375
  $params['params_array'] = $params_array;
376
  $params['theme_row'] = $theme_row;
377
+ //For compatibility with AMP
378
+ if (function_exists('amp_is_request') && amp_is_request()) {
379
+ $params['image_column_number'] = !empty($params['image_column_number']) ? $params['image_column_number'] : 1;
380
+ $params['image_title'] = !empty($params['image_title']) ? $params['image_title'] : '';
381
+ $params['ecommerce_icon'] = !empty($params['ecommerce_icon']) ? $params['ecommerce_icon'] : '';
382
+ }
383
  $this->display($params, $from_shortcode, $bwg);
384
  }
385
 
frontend/views/BWGViewAlbum_compact_preview.php CHANGED
@@ -114,7 +114,8 @@ class BWGViewAlbum_compact_preview extends BWGViewSite {
114
  data-height="<?php echo esc_attr($image_thumb_height); ?>"
115
  data-src="<?php echo esc_attr($row->preview_image); ?>"
116
  src="<?php if( !$lazyload ) { echo esc_url($row->preview_image); } else { echo esc_url(BWG()->plugin_url."/images/lazy_placeholder.gif"); } ?>"
117
- alt="<?php echo esc_attr($row->name); ?>" />
 
118
  </div>
119
  <div class="<?php echo $theme_row->album_compact_thumb_hover_effect == 'zoom' && $params['compuct_album_title'] == 'hover' ? 'bwg-zoom-effect-overlay' : ''; ?>">
120
  <?php if ( $params['compuct_album_title'] == 'hover' ) { echo $title; } ?>
114
  data-height="<?php echo esc_attr($image_thumb_height); ?>"
115
  data-src="<?php echo esc_attr($row->preview_image); ?>"
116
  src="<?php if( !$lazyload ) { echo esc_url($row->preview_image); } else { echo esc_url(BWG()->plugin_url."/images/lazy_placeholder.gif"); } ?>"
117
+ alt="<?php echo esc_attr($row->name); ?>"
118
+ title="<?php echo esc_attr($row->name); ?>" />
119
  </div>
120
  <div class="<?php echo $theme_row->album_compact_thumb_hover_effect == 'zoom' && $params['compuct_album_title'] == 'hover' ? 'bwg-zoom-effect-overlay' : ''; ?>">
121
  <?php if ( $params['compuct_album_title'] == 'hover' ) { echo $title; } ?>
frontend/views/BWGViewAlbum_extended_preview.php CHANGED
@@ -121,7 +121,8 @@ class BWGViewAlbum_extended_preview extends BWGViewSite {
121
  data-height="<?php echo esc_attr($image_thumb_height); ?>"
122
  data-src="<?php echo esc_url($row->preview_image); ?>"
123
  src="<?php if( !$lazyload ) { echo esc_url($row->preview_image); } else { echo esc_url(BWG()->plugin_url."/images/lazy_placeholder.gif"); } ?>"
124
- alt="<?php echo esc_attr($row->name); ?>" />
 
125
  </div>
126
  </div>
127
  </div>
@@ -151,7 +152,7 @@ class BWGViewAlbum_extended_preview extends BWGViewSite {
151
  <span class="bwg_description_spun1_<?php echo sanitize_html_class($bwg); ?>">
152
  <span class="bwg_description_spun2_<?php echo sanitize_html_class($bwg); ?>">
153
  <span class="bwg_description_short_<?php echo sanitize_html_class($bwg); ?>">
154
- <?php WDWLibrary::strip_tags(stripslashes($row->description)); ?>
155
  </span>
156
  <span class="bwg_description_full">
157
  <?php echo WDWLibrary::strip_tags(stripslashes($description_full)); ?>
121
  data-height="<?php echo esc_attr($image_thumb_height); ?>"
122
  data-src="<?php echo esc_url($row->preview_image); ?>"
123
  src="<?php if( !$lazyload ) { echo esc_url($row->preview_image); } else { echo esc_url(BWG()->plugin_url."/images/lazy_placeholder.gif"); } ?>"
124
+ alt="<?php echo esc_attr($row->name); ?>"
125
+ title="<?php echo esc_attr($row->name); ?>" />
126
  </div>
127
  </div>
128
  </div>
152
  <span class="bwg_description_spun1_<?php echo sanitize_html_class($bwg); ?>">
153
  <span class="bwg_description_spun2_<?php echo sanitize_html_class($bwg); ?>">
154
  <span class="bwg_description_short_<?php echo sanitize_html_class($bwg); ?>">
155
+ <?php echo WDWLibrary::strip_tags(stripslashes($description_short)); ?>
156
  </span>
157
  <span class="bwg_description_full">
158
  <?php echo WDWLibrary::strip_tags(stripslashes($description_full)); ?>
frontend/views/BWGViewGalleryBox.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  class BWGViewGalleryBox {
3
 
4
  private $model;
@@ -44,7 +45,6 @@ class BWGViewGalleryBox {
44
  $params['enable_addthis'] = FALSE;
45
  $params['addthis_profile_id'] = FALSE;
46
  }
47
-
48
  $image_right_click = isset(BWG()->options->image_right_click) ? BWG()->options->image_right_click : 0;
49
  require_once BWG()->plugin_dir . "/frontend/models/model.php";
50
  $model_site = new BWGModelSite();
@@ -568,7 +568,7 @@ class BWGViewGalleryBox {
568
  $image_id_exist = FALSE;
569
  $has_embed = FALSE;
570
  $data = array();
571
- foreach ($image_rows as $key => $image_row) {
572
  if ($image_row->id == $image_id) {
573
  $current_avg_rating = $image_row->avg_rating;
574
  $current_rate = isset($image_row->rate) ? $image_row->rate : 0;
@@ -584,7 +584,7 @@ class BWGViewGalleryBox {
584
  $current_filetype = $image_row->filetype;
585
  $image_id_exist = TRUE;
586
  }
587
- $has_embed = $has_embed || preg_match('/EMBED/',$image_row->filetype) == 1;
588
  if ( BWG()->is_pro && function_exists('BWGEC') ) {
589
  $current_pricelist_id = $this->model->get_image_pricelist($image_row->id);
590
  $current_pricelist_id = $current_pricelist_id ? $current_pricelist_id : 0;
@@ -598,11 +598,9 @@ class BWGViewGalleryBox {
598
  $data[$key]["description"] = esc_html(str_replace(array("\r\n", "\n", "\r"), esc_html('<br />'), preg_replace('/[\x01-\x09\x0B-\x0C\x0E-\x1F]+/', '', $image_row->description)));
599
 
600
  $image_resolution = explode(' x ', $image_row->resolution);
601
- if (is_array($image_resolution)) {
602
  $instagram_post_width = $image_resolution[0];
603
- if (isset($image_resolution[1])) {
604
- $instagram_post_height = explode(' ', $image_resolution[1]);
605
- }
606
  $instagram_post_height = $instagram_post_height[0];
607
  }
608
 
@@ -627,7 +625,7 @@ class BWGViewGalleryBox {
627
  }
628
  }
629
 
630
- if (!$image_id_exist) {
631
  echo WDWLibrary::message(__('The image has been deleted.', BWG()->prefix), 'wd_error');
632
  die();
633
  }
1
  <?php
2
+
3
  class BWGViewGalleryBox {
4
 
5
  private $model;
45
  $params['enable_addthis'] = FALSE;
46
  $params['addthis_profile_id'] = FALSE;
47
  }
 
48
  $image_right_click = isset(BWG()->options->image_right_click) ? BWG()->options->image_right_click : 0;
49
  require_once BWG()->plugin_dir . "/frontend/models/model.php";
50
  $model_site = new BWGModelSite();
568
  $image_id_exist = FALSE;
569
  $has_embed = FALSE;
570
  $data = array();
571
+ foreach ( $image_rows as $key => $image_row ) {
572
  if ($image_row->id == $image_id) {
573
  $current_avg_rating = $image_row->avg_rating;
574
  $current_rate = isset($image_row->rate) ? $image_row->rate : 0;
584
  $current_filetype = $image_row->filetype;
585
  $image_id_exist = TRUE;
586
  }
587
+ $has_embed = $has_embed || preg_match('/EMBED/', $image_row->filetype) == 1;
588
  if ( BWG()->is_pro && function_exists('BWGEC') ) {
589
  $current_pricelist_id = $this->model->get_image_pricelist($image_row->id);
590
  $current_pricelist_id = $current_pricelist_id ? $current_pricelist_id : 0;
598
  $data[$key]["description"] = esc_html(str_replace(array("\r\n", "\n", "\r"), esc_html('<br />'), preg_replace('/[\x01-\x09\x0B-\x0C\x0E-\x1F]+/', '', $image_row->description)));
599
 
600
  $image_resolution = explode(' x ', $image_row->resolution);
601
+ if (is_array($image_resolution) && count($image_resolution) == 2) {
602
  $instagram_post_width = $image_resolution[0];
603
+ $instagram_post_height = explode(' ', $image_resolution[1]);
 
 
604
  $instagram_post_height = $instagram_post_height[0];
605
  }
606
 
625
  }
626
  }
627
 
628
+ if ( !$image_id_exist ) {
629
  echo WDWLibrary::message(__('The image has been deleted.', BWG()->prefix), 'wd_error');
630
  die();
631
  }
frontend/views/BWGViewImage_browser.php CHANGED
@@ -120,7 +120,8 @@ class BWGViewImage_browser extends BWGViewSite {
120
  <img class="skip-lazy bwg-item0 bwg_image_browser_img bwg_image_browser_img_<?php echo sanitize_html_class($bwg); ?> <?php if( $lazyload ) { ?> bwg_lazyload lazy_loader<?php } ?>"
121
  src="<?php if( !$lazyload ) { echo esc_url(BWG()->upload_url . $image_row->image_url); } else { echo esc_url(BWG()->plugin_url."/images/lazy_placeholder.gif"); } ?>"
122
  data-src="<?php echo esc_url(BWG()->upload_url . $image_row->image_url); ?>"
123
- alt="<?php echo esc_attr($image_row->alt); ?>" />
 
124
  </a>
125
  <?php
126
  }
120
  <img class="skip-lazy bwg-item0 bwg_image_browser_img bwg_image_browser_img_<?php echo sanitize_html_class($bwg); ?> <?php if( $lazyload ) { ?> bwg_lazyload lazy_loader<?php } ?>"
121
  src="<?php if( !$lazyload ) { echo esc_url(BWG()->upload_url . $image_row->image_url); } else { echo esc_url(BWG()->plugin_url."/images/lazy_placeholder.gif"); } ?>"
122
  data-src="<?php echo esc_url(BWG()->upload_url . $image_row->image_url); ?>"
123
+ alt="<?php echo esc_attr($image_row->alt); ?>"
124
+ title="<?php echo esc_attr($image_row->alt); ?>" />
125
  </a>
126
  <?php
127
  }
frontend/views/BWGViewSlideshow.php CHANGED
@@ -320,7 +320,8 @@ public function display($params = array(), $bwg = 0, $ajax = FALSE) {
320
  onclick="bwg_change_image(parseInt(jQuery('#bwg_current_image_key_<?php echo $bwg; ?>').val()), '<?php echo $key; ?>', '', '', '<?php echo $bwg; ?>')"
321
  image_id="<?php echo esc_attr($image_row->id); ?>"
322
  image_key="<?php echo esc_attr($key); ?>"
323
- alt="<?php echo esc_attr($image_row->alt); ?>" />
 
324
  </div>
325
  <?php
326
  }
320
  onclick="bwg_change_image(parseInt(jQuery('#bwg_current_image_key_<?php echo $bwg; ?>').val()), '<?php echo $key; ?>', '', '', '<?php echo $bwg; ?>')"
321
  image_id="<?php echo esc_attr($image_row->id); ?>"
322
  image_key="<?php echo esc_attr($key); ?>"
323
+ alt="<?php echo esc_attr($image_row->alt); ?>"
324
+ title="<?php echo esc_attr($image_row->alt); ?>" />
325
  </div>
326
  <?php
327
  }
frontend/views/BWGViewThumbnails.php CHANGED
@@ -82,7 +82,8 @@ class BWGViewThumbnails extends BWGViewSite {
82
  data-height="<?php echo esc_attr($image_thumb_height); ?>"
83
  data-src="<?php echo $bwg_thumb_url; ?>"
84
  src="<?php if( !$lazyload ) { echo $bwg_thumb_url; } else { echo esc_url(BWG()->plugin_url."/images/lazy_placeholder.gif"); } ?>"
85
- alt="<?php echo esc_attr($image_row->alt); ?>" />
 
86
  </div>
87
  <div class="<?php echo $theme_row->thumb_hover_effect == 'zoom' && $params['image_title'] == 'hover' ? 'bwg-zoom-effect-overlay' : ''; ?>">
88
  <?php if ( $params['image_title'] == 'hover' ) { echo $title; } ?>
82
  data-height="<?php echo esc_attr($image_thumb_height); ?>"
83
  data-src="<?php echo $bwg_thumb_url; ?>"
84
  src="<?php if( !$lazyload ) { echo $bwg_thumb_url; } else { echo esc_url(BWG()->plugin_url."/images/lazy_placeholder.gif"); } ?>"
85
+ alt="<?php echo esc_attr($image_row->alt); ?>"
86
+ title="<?php echo esc_attr($image_row->alt); ?>" />
87
  </div>
88
  <div class="<?php echo $theme_row->thumb_hover_effect == 'zoom' && $params['image_title'] == 'hover' ? 'bwg-zoom-effect-overlay' : ''; ?>">
89
  <?php if ( $params['image_title'] == 'hover' ) { echo $title; } ?>
frontend/views/view.php CHANGED
@@ -57,7 +57,37 @@ class BWGViewSite {
57
 
58
  $params_array = $params['params_array'];
59
  $theme_row = $params['theme_row'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  ?>
 
61
  <div id="bwg_container1_<?php echo sanitize_html_class($bwg); ?>"
62
  class="bwg_container bwg_thumbnail bwg_<?php echo sanitize_html_class($params['gallery_type']); ?>"
63
  data-right-click-protection="<?php echo esc_attr(BWG()->options->image_right_click); ?>"
@@ -71,9 +101,9 @@ class BWGViewSite {
71
  data-is-album="<?php echo esc_attr($params["view_type"]); ?>"
72
  data-buttons-position="<?php echo esc_attr($theme_row->lightbox_ctrl_btn_pos); ?>">
73
  <div id="bwg_container2_<?php echo sanitize_html_class($bwg); ?>">
74
- <?php $this->loading($bwg, $params["image_enable_page"], $params['gallery_type'] ); ?>
75
  <form id="gal_front_form_<?php echo sanitize_html_class($bwg); ?>"
76
- class="bwg-hidden"
77
  method="post"
78
  action="#"
79
  data-current="<?php echo esc_attr($bwg); ?>"
@@ -94,6 +124,7 @@ class BWGViewSite {
94
  $this->title_description($params, $bwg);
95
  }
96
  if ( (!isset($params['from']) || $params['from'] !== 'widget')
 
97
  && ((isset($params['show_sort_images']) && $params['show_sort_images'])
98
  || (isset($params['show_tag_box']) && $params['show_tag_box'])
99
  || (isset($params['show_search_box']) && $params['show_search_box'])) )
@@ -139,7 +170,7 @@ class BWGViewSite {
139
  ?>
140
  </div>
141
  </form>
142
- <?php
143
 
144
  if ( $params['thumb_click_action'] == 'open_lightbox' ) {
145
  ob_start();
57
 
58
  $params_array = $params['params_array'];
59
  $theme_row = $params['theme_row'];
60
+ if (function_exists('amp_is_request') && amp_is_request()) {
61
+ echo
62
+ '<style>
63
+ amp-img {
64
+ height: 100%!important;
65
+ }
66
+ #bwg_container1_' . sanitize_html_class($bwg) . ' #bwg_container2_' . sanitize_html_class($bwg) . ' .bwg-container-' . sanitize_html_class($bwg) . '.bwg-standard-thumbnails .bwg-item1 {
67
+ padding-top: 66%;
68
+ }
69
+ .bwg-container-' . sanitize_html_class($bwg) . ' {
70
+ width: 100%!important;
71
+ }
72
+ @media screen and (max-width: 485px) {
73
+ .bwg-item {
74
+ width:100%;
75
+ }
76
+ }
77
+ @media screen and (max-width: 768px) and (min-width: 486px) {
78
+ .bwg-item {
79
+ width:50%;
80
+ }
81
+ }
82
+ @media screen and (min-width: 769px) {
83
+ .bwg-item {
84
+ width:33.3%;
85
+ }
86
+ }
87
+ </style>';
88
+ }
89
  ?>
90
+
91
  <div id="bwg_container1_<?php echo sanitize_html_class($bwg); ?>"
92
  class="bwg_container bwg_thumbnail bwg_<?php echo sanitize_html_class($params['gallery_type']); ?>"
93
  data-right-click-protection="<?php echo esc_attr(BWG()->options->image_right_click); ?>"
101
  data-is-album="<?php echo esc_attr($params["view_type"]); ?>"
102
  data-buttons-position="<?php echo esc_attr($theme_row->lightbox_ctrl_btn_pos); ?>">
103
  <div id="bwg_container2_<?php echo sanitize_html_class($bwg); ?>">
104
+ <?php (function_exists('amp_is_request') && amp_is_request()) ? :$this->loading($bwg, $params["image_enable_page"], $params['gallery_type'] ); ?>
105
  <form id="gal_front_form_<?php echo sanitize_html_class($bwg); ?>"
106
+ <?php echo (function_exists('amp_is_request') && amp_is_request()) ? : 'class="bwg-hidden"' ?>
107
  method="post"
108
  action="#"
109
  data-current="<?php echo esc_attr($bwg); ?>"
124
  $this->title_description($params, $bwg);
125
  }
126
  if ( (!isset($params['from']) || $params['from'] !== 'widget')
127
+ && !(function_exists('amp_is_request') && amp_is_request())
128
  && ((isset($params['show_sort_images']) && $params['show_sort_images'])
129
  || (isset($params['show_tag_box']) && $params['show_tag_box'])
130
  || (isset($params['show_search_box']) && $params['show_search_box'])) )
170
  ?>
171
  </div>
172
  </form>
173
+ <?php
174
 
175
  if ( $params['thumb_click_action'] == 'open_lightbox' ) {
176
  ob_start();
js/bwg_gallery_box.js CHANGED
@@ -22,7 +22,6 @@ function gallery_box_ready() {
22
  preloadCount;
23
  filmstrip_thumbnail_width = jQuery(".bwg_filmstrip_thumbnail").width();
24
  filmstrip_thumbnail_height = jQuery(".bwg_filmstrip_thumbnail").height();
25
-
26
  if ( gallery_box_data['open_with_fullscreen'] == 1 ) {
27
  filmstrip_width = jQuery( window ).width();
28
  filmstrip_height = jQuery( window ).height();
22
  preloadCount;
23
  filmstrip_thumbnail_width = jQuery(".bwg_filmstrip_thumbnail").width();
24
  filmstrip_thumbnail_height = jQuery(".bwg_filmstrip_thumbnail").height();
 
25
  if ( gallery_box_data['open_with_fullscreen'] == 1 ) {
26
  filmstrip_width = jQuery( window ).width();
27
  filmstrip_height = jQuery( window ).height();
photo-gallery.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Photo Gallery
4
  * Plugin URI: https://10web.io/plugins/wordpress-photo-gallery/?utm_source=photo_gallery&utm_medium=free_plugin
5
  * Description: This plugin is a fully responsive gallery plugin with advanced functionality. It allows having different image galleries for your posts and pages. You can create unlimited number of galleries, combine them into albums, and provide descriptions and tags.
6
- * Version: 1.6.0
7
  * Author: Photo Gallery Team
8
  * Author URI: https://10web.io/plugins/?utm_source=photo_gallery&utm_medium=free_plugin
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
@@ -105,8 +105,8 @@ final class BWG {
105
  $this->plugin_url = plugins_url(plugin_basename(dirname(__FILE__)));
106
  $this->front_url = $this->plugin_url;
107
  $this->main_file = plugin_basename(__FILE__);
108
- $this->plugin_version = '1.6.0';
109
- $this->db_version = '1.6.0';
110
  $this->prefix = 'bwg';
111
  $this->nicename = __('Photo Gallery', $this->prefix);
112
  require_once($this->plugin_dir . '/framework/WDWLibrary.php');
3
  * Plugin Name: Photo Gallery
4
  * Plugin URI: https://10web.io/plugins/wordpress-photo-gallery/?utm_source=photo_gallery&utm_medium=free_plugin
5
  * Description: This plugin is a fully responsive gallery plugin with advanced functionality. It allows having different image galleries for your posts and pages. You can create unlimited number of galleries, combine them into albums, and provide descriptions and tags.
6
+ * Version: 1.6.1
7
  * Author: Photo Gallery Team
8
  * Author URI: https://10web.io/plugins/?utm_source=photo_gallery&utm_medium=free_plugin
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
105
  $this->plugin_url = plugins_url(plugin_basename(dirname(__FILE__)));
106
  $this->front_url = $this->plugin_url;
107
  $this->main_file = plugin_basename(__FILE__);
108
+ $this->plugin_version = '1.6.1';
109
+ $this->db_version = '1.6.1';
110
  $this->prefix = 'bwg';
111
  $this->nicename = __('Photo Gallery', $this->prefix);
112
  require_once($this->plugin_dir . '/framework/WDWLibrary.php');
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: webdorado,wdsupport,photogallerysupport,10web
3
  Tags: gallery, photo gallery, image gallery, responsive gallery, wordpress gallery plugin, photo albums, gallery slider, gallery lightbox, wordpress photo gallery plugin, fullscreen gallery, watermarking, video gallery
4
  Requires at least: 4.6
5
  Tested up to: 5.9
6
- Stable tag: 1.6.0
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -282,11 +282,19 @@ Choose whether to display random or the first/last specific number of images.
282
 
283
  == Changelog ==
284
 
 
 
 
 
 
 
 
 
285
  = 1.6.0 =
286
  * Added: Slideshow filmstrip with fix count of thumbnails.
287
  * Improved: Russian translation.
288
  * Fixed: Security issue.
289
- * Fixed: XSS vulnerability reported by Nikita Podotykin of Positive Technologies.
290
  * Fixed: Zoom functionality.
291
  * Fixed: Filmstrip images load with enabled lazy load.
292
  * Fixed: Tags count on image delete.
3
  Tags: gallery, photo gallery, image gallery, responsive gallery, wordpress gallery plugin, photo albums, gallery slider, gallery lightbox, wordpress photo gallery plugin, fullscreen gallery, watermarking, video gallery
4
  Requires at least: 4.6
5
  Tested up to: 5.9
6
+ Stable tag: 1.6.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
282
 
283
  == Changelog ==
284
 
285
+ = 1.6.1 =
286
+ * Added: AMP compatibility.
287
+ * Added: Order by date for Gallery groups.
288
+ * Added: Title tag to image tags.
289
+ * Fixed: Portrait images in filmstrip with fix count.
290
+ * Fixed: More Extended gallery group.
291
+ * Fixed: Adding tags to the newly added image.
292
+
293
  = 1.6.0 =
294
  * Added: Slideshow filmstrip with fix count of thumbnails.
295
  * Improved: Russian translation.
296
  * Fixed: Security issue.
297
+ * Fixed: XSS vulnerability reported by Alexey Solovyev of Positive Technologies.
298
  * Fixed: Zoom functionality.
299
  * Fixed: Filmstrip images load with enabled lazy load.
300
  * Fixed: Tags count on image delete.