Gallery by BestWebSoft - Version 4.6.1

Version Description

  • 09.05.2019 =
  • Update : The function for returning an array of objects has been added.
Download this release

Release Info

Developer bestwebsoft
Plugin Icon 128x128 Gallery by BestWebSoft
Version 4.6.1
Comparing to
See all releases

Code changes from version 4.6.0 to 4.6.1

Files changed (3) hide show
  1. gallery-plugin.php +79 -12
  2. readme.txt +8 -2
  3. screenshot-8.png +0 -0
gallery-plugin.php CHANGED
@@ -6,7 +6,7 @@ Description: Add beautiful galleries, albums & images to your Wordpress website
6
  Author: BestWebSoft
7
  Text Domain: gallery-plugin
8
  Domain Path: /languages
9
- Version: 4.6.0
10
  Author URI: https://bestwebsoft.com/
11
  License: GPLv2 or later
12
  */
@@ -131,7 +131,7 @@ if ( ! function_exists( 'gllr_admin_init' ) ) {
131
 
132
  /* add gallery to global $bws_shortcode_list */
133
  $bws_shortcode_list['gllr'] = array( 'name' => 'Gallery', 'js_function' => 'gllr_shortcode_init' );
134
-
135
  add_filter( 'manage_' . $gllr_options['post_type_name'] . '_posts_columns', 'gllr_change_columns' );
136
  add_action( 'manage_' . $gllr_options['post_type_name'] . '_posts_custom_column', 'gllr_custom_columns', 10, 2 );
137
  }
@@ -234,7 +234,9 @@ if ( ! function_exists( 'gllr_export_slider' ) ) {
234
 
235
  $data_slide = array();
236
  $data_relation = array();
237
- $slice = array_values( array_slice( $slider_id, -1 ) )[0];
 
 
238
  $i = 0;
239
 
240
  foreach ( $explode_meta_val as $val ) {
@@ -516,14 +518,14 @@ if ( ! function_exists( 'gllr_post_type_images' ) ) {
516
  }
517
  if ( is_array( $def_term_info ) )
518
  $def_term_id = ( array_shift( $def_term_info ) );
519
- }
520
  }
521
  $rewrite_rules = get_option( 'rewrite_rules' );
522
  if ( is_array( $rewrite_rules ) && ! empty( $rewrite_rules ) && ! in_array( 'bws-gallery', $rewrite_rules ) || $force_flush_rules || ( isset( $gllr_options["flush_rewrite_rules"] ) && 1 == $gllr_options["flush_rewrite_rules"] ) ) {
523
  flush_rewrite_rules();
524
- $gllr_options["flush_rewrite_rules"] = 0;
525
  update_option( 'gllr_options', $gllr_options );
526
- }
527
  }
528
  }
529
 
@@ -664,7 +666,7 @@ if ( ! function_exists( 'gllr_add_notice_below_table' ) ) {
664
  }
665
 
666
  if ( ! function_exists( 'gllr_additive_field_in_category' ) ) {
667
- function gllr_additive_field_in_category() {
668
  global $gllr_options, $gllr_plugin_info; ?>
669
  <tr valign="top">
670
  <th scope="row"><?php _e( 'Sort Galleries in Category by', 'gallery-plugin' ); ?></th>
@@ -687,7 +689,7 @@ if ( ! function_exists( 'gllr_additive_field_in_category' ) ) {
687
  }
688
 
689
  if ( ! function_exists( 'gllr_save_caegory_additive_field' ) ) {
690
- function gllr_save_caegory_additive_field() {
691
  global $gllr_options, $gllr_plugin_info;
692
  $gllr_options["album_order_by_category_option"] = esc_attr( $_POST['album_order_by_category_option'] );
693
  update_option( 'gllr_options', $gllr_options );
@@ -1154,7 +1156,7 @@ if ( ! function_exists( 'gllr_single_template_content' ) ) {
1154
  <a href="<?php echo $url_for_link; ?>" title="<?php echo $image_text; ?>" target="_blank">
1155
  <img <?php if ( $width ) echo 'width="' . $width . '"'; if ( $height ) echo 'height="' . $height . '"'; ?> style="<?php if ( $width ) echo 'width:' . $width . 'px;'; if ( $height ) echo 'height:' . $height . 'px;'; echo $border; ?>" alt="<?php echo $image_alt_tag; ?>" title="<?php echo $image_text; ?>" src="<?php echo $image_attributes[0]; ?>" />
1156
  </a>
1157
- <?php } else {
1158
  if( ! $gllr_options['enable_image_opening'] == 1 ) { ?>
1159
  <a data-fancybox="gallery_fancybox<?php if ( 0 == $gllr_options['single_lightbox_for_multiple_galleries'] ) echo '_' . $post->ID; ?>" href="<?php echo $image_attributes_large[0]; ?>" title="<?php echo $image_text; ?>" >
1160
  <img <?php if ( $width ) echo 'width="' . $width . '"'; if ( $height ) echo 'height="' . $height . '"'; ?> style="<?php if ( $width ) echo 'width:' . $width . 'px;'; if ( $height ) echo 'height:' . $height . 'px;'; echo $border; ?>" alt="<?php echo $image_alt_tag; ?>" title="<?php echo $image_text; ?>" src="<?php echo $image_attributes[0]; ?>" rel="<?php echo $image_attributes_full[0]; ?>" />
@@ -1980,7 +1982,7 @@ if ( ! function_exists ( 'gllr_shortcode' ) ) {
1980
  ob_start();
1981
  require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
1982
 
1983
- $galleries_order =
1984
  ( ! empty( $sort_by ) && 'default' != $sort_by )
1985
  ?
1986
  $sort_by
@@ -2493,7 +2495,7 @@ if ( ! function_exists ( 'gllr_image_resize' ) ) {
2493
 
2494
  if ( ! is_null( $dest_path ) and $_dest_path = realpath( $dest_path ) ) {
2495
  $dir = $_dest_path;
2496
- }
2497
  $destfilename = "{$dir}/{$name}-{$suffix}.{$ext}";
2498
 
2499
  if ( IMAGETYPE_GIF == $orig_type ) {
@@ -3032,7 +3034,7 @@ if ( ! class_exists( 'Gllr_Media_Table' ) ) {
3032
  $actions = array();
3033
 
3034
  if ( $this->detached ) {
3035
- if ( current_user_can( 'edit_post', $post->ID ) ) {
3036
  $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '">' . __( 'Edit', 'gallery-plugin' ) . '</a>';
3037
  }
3038
  if ( current_user_can( 'delete_post', $post->ID ) ) {
@@ -3466,6 +3468,71 @@ if ( ! function_exists ( 'gllr_admin_notices' ) ) {
3466
  }
3467
  }
3468
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3469
  /**
3470
  * Perform at uninstall
3471
  */
6
  Author: BestWebSoft
7
  Text Domain: gallery-plugin
8
  Domain Path: /languages
9
+ Version: 4.6.1
10
  Author URI: https://bestwebsoft.com/
11
  License: GPLv2 or later
12
  */
131
 
132
  /* add gallery to global $bws_shortcode_list */
133
  $bws_shortcode_list['gllr'] = array( 'name' => 'Gallery', 'js_function' => 'gllr_shortcode_init' );
134
+
135
  add_filter( 'manage_' . $gllr_options['post_type_name'] . '_posts_columns', 'gllr_change_columns' );
136
  add_action( 'manage_' . $gllr_options['post_type_name'] . '_posts_custom_column', 'gllr_custom_columns', 10, 2 );
137
  }
234
 
235
  $data_slide = array();
236
  $data_relation = array();
237
+ $slice = array_slice( $slider_id, -1 );
238
+ $slice = array_values( $slice );
239
+ $slice = $slice[0];
240
  $i = 0;
241
 
242
  foreach ( $explode_meta_val as $val ) {
518
  }
519
  if ( is_array( $def_term_info ) )
520
  $def_term_id = ( array_shift( $def_term_info ) );
521
+ }
522
  }
523
  $rewrite_rules = get_option( 'rewrite_rules' );
524
  if ( is_array( $rewrite_rules ) && ! empty( $rewrite_rules ) && ! in_array( 'bws-gallery', $rewrite_rules ) || $force_flush_rules || ( isset( $gllr_options["flush_rewrite_rules"] ) && 1 == $gllr_options["flush_rewrite_rules"] ) ) {
525
  flush_rewrite_rules();
526
+ $gllr_options["flush_rewrite_rules"] = 0;
527
  update_option( 'gllr_options', $gllr_options );
528
+ }
529
  }
530
  }
531
 
666
  }
667
 
668
  if ( ! function_exists( 'gllr_additive_field_in_category' ) ) {
669
+ function gllr_additive_field_in_category() {
670
  global $gllr_options, $gllr_plugin_info; ?>
671
  <tr valign="top">
672
  <th scope="row"><?php _e( 'Sort Galleries in Category by', 'gallery-plugin' ); ?></th>
689
  }
690
 
691
  if ( ! function_exists( 'gllr_save_caegory_additive_field' ) ) {
692
+ function gllr_save_caegory_additive_field() {
693
  global $gllr_options, $gllr_plugin_info;
694
  $gllr_options["album_order_by_category_option"] = esc_attr( $_POST['album_order_by_category_option'] );
695
  update_option( 'gllr_options', $gllr_options );
1156
  <a href="<?php echo $url_for_link; ?>" title="<?php echo $image_text; ?>" target="_blank">
1157
  <img <?php if ( $width ) echo 'width="' . $width . '"'; if ( $height ) echo 'height="' . $height . '"'; ?> style="<?php if ( $width ) echo 'width:' . $width . 'px;'; if ( $height ) echo 'height:' . $height . 'px;'; echo $border; ?>" alt="<?php echo $image_alt_tag; ?>" title="<?php echo $image_text; ?>" src="<?php echo $image_attributes[0]; ?>" />
1158
  </a>
1159
+ <?php } else {
1160
  if( ! $gllr_options['enable_image_opening'] == 1 ) { ?>
1161
  <a data-fancybox="gallery_fancybox<?php if ( 0 == $gllr_options['single_lightbox_for_multiple_galleries'] ) echo '_' . $post->ID; ?>" href="<?php echo $image_attributes_large[0]; ?>" title="<?php echo $image_text; ?>" >
1162
  <img <?php if ( $width ) echo 'width="' . $width . '"'; if ( $height ) echo 'height="' . $height . '"'; ?> style="<?php if ( $width ) echo 'width:' . $width . 'px;'; if ( $height ) echo 'height:' . $height . 'px;'; echo $border; ?>" alt="<?php echo $image_alt_tag; ?>" title="<?php echo $image_text; ?>" src="<?php echo $image_attributes[0]; ?>" rel="<?php echo $image_attributes_full[0]; ?>" />
1982
  ob_start();
1983
  require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
1984
 
1985
+ $galleries_order =
1986
  ( ! empty( $sort_by ) && 'default' != $sort_by )
1987
  ?
1988
  $sort_by
2495
 
2496
  if ( ! is_null( $dest_path ) and $_dest_path = realpath( $dest_path ) ) {
2497
  $dir = $_dest_path;
2498
+ }
2499
  $destfilename = "{$dir}/{$name}-{$suffix}.{$ext}";
2500
 
2501
  if ( IMAGETYPE_GIF == $orig_type ) {
3034
  $actions = array();
3035
 
3036
  if ( $this->detached ) {
3037
+ if ( current_user_can( 'edit_post', $post->ID ) ) {
3038
  $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '">' . __( 'Edit', 'gallery-plugin' ) . '</a>';
3039
  }
3040
  if ( current_user_can( 'delete_post', $post->ID ) ) {
3468
  }
3469
  }
3470
 
3471
+ /* Gallery data objects. Takes array of id or empty array, single id or 'all' */
3472
+ if ( ! function_exists( 'gllr_get_gallery_data' ) ) {
3473
+ function gllr_get_gallery_data( $gallery_id ) {
3474
+ global $gllr_options;
3475
+
3476
+ if ( empty( $gllr_options ) )
3477
+ gllr_settings();
3478
+
3479
+ $gallery_images = array();
3480
+ $gallery_posts = array();
3481
+
3482
+ /* Get the entire list of posts or the specified array */
3483
+ if ( 'all' == $gallery_id || is_array( $gallery_id ) ) {
3484
+
3485
+ /* Prepare args for get_posts */
3486
+ if ( is_array( $gallery_id ) && ! empty( $gallery_id ) ) {
3487
+ $gallery_id_list = $gallery_id;
3488
+ $args = array( 'post_type' => $gllr_options['post_type_name'], 'include' => $gallery_id_list );
3489
+ } else {
3490
+ $args = array( 'post_type' => $gllr_options['post_type_name'] );
3491
+ }
3492
+
3493
+ $gallery_posts = get_posts( $args );
3494
+
3495
+ } else if ( is_int( $gallery_id ) ) {
3496
+
3497
+ $gallery_int_id = intval( $gallery_id );
3498
+ $gallery_posts[] = get_post( $gallery_int_id );
3499
+
3500
+ }
3501
+
3502
+ /* Return false if there are no records */
3503
+ if ( ! $gallery_posts ) {
3504
+ return false;
3505
+ }
3506
+
3507
+ foreach ( (array)$gallery_posts as $gallery_post ) {
3508
+
3509
+ /* Get a id list of gallery pictures */
3510
+ $gallery_images_meta = get_post_meta( $gallery_post->ID, '_gallery_images', true );
3511
+ $gallery_images_id = explode( ',', $gallery_images_meta);
3512
+
3513
+ /* Add gallery data to resulting array from wp_posts */
3514
+ $gallery_images[ $gallery_post->ID ]['gallery_wp_post'] = $gallery_post;
3515
+
3516
+ foreach ( $gallery_images_id as $image_id ) {
3517
+
3518
+ /* Resulting array with images */
3519
+ $gallery_image_post_meta = array();
3520
+
3521
+ $image_post_meta = get_post_meta( $image_id, '', true );
3522
+ foreach ( $image_post_meta as $key => $value ) {
3523
+ $image_post_meta_item = get_post_meta( $image_id, $key, true );
3524
+ $gallery_image_post_meta[$key] = $image_post_meta_item;
3525
+ }
3526
+ $gallery_images[ $gallery_post->ID ]['gallery_images'][] = array( 'wp_post_image' => get_post( $image_id ), 'image_post_meta' => $gallery_image_post_meta );
3527
+ }
3528
+ }
3529
+
3530
+ $gallery_objects = $gallery_images;
3531
+
3532
+ return $gallery_objects;
3533
+ }
3534
+ }
3535
+
3536
  /**
3537
  * Perform at uninstall
3538
  */
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://bestwebsoft.com/donate/
4
  Tags: add album, add galleries, add images, add pictures, add albums, gallery, gallery plugin, gallery slider, fancy gallery, slideshow, lightbox, fullscreen gallery
5
  Requires at least: 4.0
6
  Tested up to: 5.1.1
7
- Stable tag: 4.6.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -27,7 +27,7 @@ https://www.youtube.com/watch?v=aydaTdOpaRM
27
  * Albums to gallery
28
  * Images to album
29
  * Gallery categories
30
- * Add Gallery to the [Slider](https://bestwebsoft.com/products/wordpress/plugins/slider/) [NEW]
31
  * Choose albums layout:
32
  * Column
33
  * Rows
@@ -227,6 +227,9 @@ Please make sure that the problem hasn't been discussed yet on our forum (<https
227
 
228
  == Changelog ==
229
 
 
 
 
230
  = V4.6.0 - 29.03.2019 =
231
  * NEW : Ability to add a gallery to the slider has been added.
232
  * Update : All functionality was updated for WordPress 5.1.1.
@@ -666,6 +669,9 @@ Please make sure that the problem hasn't been discussed yet on our forum (<https
666
 
667
  == Upgrade Notice ==
668
 
 
 
 
669
  = V4.6.0 =
670
  * New features added.
671
  * The compatibility with new WordPress version updated.
4
  Tags: add album, add galleries, add images, add pictures, add albums, gallery, gallery plugin, gallery slider, fancy gallery, slideshow, lightbox, fullscreen gallery
5
  Requires at least: 4.0
6
  Tested up to: 5.1.1
7
+ Stable tag: 4.6.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
27
  * Albums to gallery
28
  * Images to album
29
  * Gallery categories
30
+ * Add Gallery to the [Slider](https://bestwebsoft.com/products/wordpress/plugins/slider/)
31
  * Choose albums layout:
32
  * Column
33
  * Rows
227
 
228
  == Changelog ==
229
 
230
+ = V4.6.1 - 09.05.2019 =
231
+ * Update : The function for returning an array of objects has been added.
232
+
233
  = V4.6.0 - 29.03.2019 =
234
  * NEW : Ability to add a gallery to the slider has been added.
235
  * Update : All functionality was updated for WordPress 5.1.1.
669
 
670
  == Upgrade Notice ==
671
 
672
+ = V4.6.1 =
673
+ * Functionality improved.
674
+
675
  = V4.6.0 =
676
  * New features added.
677
  * The compatibility with new WordPress version updated.
screenshot-8.png CHANGED
Binary file