ACF Photo Gallery Field - Version 1.7.1

Version Description

Download this release

Release Info

Developer navzme
Plugin Icon 128x128 ACF Photo Gallery Field
Version 1.7.1
Comparing to
See all releases

Code changes from version 1.7.6 to 1.7.1

includes/__construct.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
 
 
 
 
3
  // vars
4
  $this->name = 'photo_gallery';
5
  $this->label = __('Photo Gallery');
1
  <?php
2
 
3
+ // exit if accessed directly
4
+ if( ! defined( 'ABSPATH' ) ) exit;
5
+
6
  // vars
7
  $this->name = 'photo_gallery';
8
  $this->label = __('Photo Gallery');
includes/acf_photo_gallery.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
 
 
 
 
3
  //Helper function that makes the images into a resuable array
4
  function acf_photo_gallery_make_images($attachment_ids, $field, $post_id = null, $order = 'ASC', $orderby = 'post__in'){
5
  global $wpdb;
1
  <?php
2
 
3
+ // exit if accessed directly
4
+ if( ! defined( 'ABSPATH' ) ) exit;
5
+
6
  //Helper function that makes the images into a resuable array
7
  function acf_photo_gallery_make_images($attachment_ids, $field, $post_id = null, $order = 'ASC', $orderby = 'post__in'){
8
  global $wpdb;
includes/acf_photo_gallery_edit.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
 
 
 
 
3
  function acf_photo_gallery_edit($field, $nonce, $attachment, $url = null, $title = null, $caption = null, $target = 0, $acf_fieldkey = null){
4
  $args = array();
5
  $args['url'] = $url;
1
  <?php
2
 
3
+ // exit if accessed directly
4
+ if( ! defined( 'ABSPATH' ) ) exit;
5
+
6
  function acf_photo_gallery_edit($field, $nonce, $attachment, $url = null, $title = null, $caption = null, $target = 0, $acf_fieldkey = null){
7
  $args = array();
8
  $args['url'] = $url;
includes/acf_photo_gallery_edit_save.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
 
 
 
 
3
  //Fires off when ediitn the details of the photo
4
  function acf_photo_gallery_edit_save(){
5
  if( wp_verify_nonce( $_POST['acf-pg-hidden-nonce'], 'acf_photo_gallery_edit_save') and !empty($_POST['acf-pg-hidden-field']) and !empty($_POST['acf-pg-hidden-post']) and !empty($_POST['acf-pg-hidden-attachment']) ){
1
  <?php
2
 
3
+ // exit if accessed directly
4
+ if( ! defined( 'ABSPATH' ) ) exit;
5
+
6
  //Fires off when ediitn the details of the photo
7
  function acf_photo_gallery_edit_save(){
8
  if( wp_verify_nonce( $_POST['acf-pg-hidden-nonce'], 'acf_photo_gallery_edit_save') and !empty($_POST['acf-pg-hidden-field']) and !empty($_POST['acf-pg-hidden-post']) and !empty($_POST['acf-pg-hidden-attachment']) ){
includes/acf_photo_gallery_image_fields.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
 
 
 
 
3
  function acf_photo_gallery_image_fields( $args, $attachment_id, $field){
4
  return array(
5
  'url' => array(
1
  <?php
2
 
3
+ // exit if accessed directly
4
+ if( ! defined( 'ABSPATH' ) ) exit;
5
+
6
  function acf_photo_gallery_image_fields( $args, $attachment_id, $field){
7
  return array(
8
  'url' => array(
includes/acf_photo_gallery_metabox_edit.php CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  <div id="acf-photo-gallery-metabox-edit-<?php echo esc_attr($attachment); ?>" class="acf-edit-photo-gallery">
2
  <h3>Edit Image</h3>
3
  <input class="acf-photo-gallery-edit-field" type="hidden" name="acf-pg-hidden-field" value="<?php echo esc_attr($field); ?>"/>
@@ -14,7 +18,7 @@
14
  ?>
15
  <?php if( in_array($type, array('text', 'date', 'color', 'datetime-local', 'email', 'number', 'tel', 'time', 'url', 'week', 'range')) ){ ?>
16
  <label><?php echo esc_attr($label); ?></label>
17
- <input class="acf-photo-gallery-edit-field" type="<?php echo $type; ?>" name="<?php echo esc_attr($name); ?>" value="<?php echo esc_attr($value); ?>"/>
18
  <?php } ?>
19
  <?php if( $type == 'checkbox' ){ ?>
20
  <label>
@@ -36,7 +40,7 @@
36
  <label><?php echo esc_attr($label); ?></label>
37
  <select class="acf-photo-gallery-edit-field" name="<?php echo esc_attr($name); ?>">
38
  <?php foreach($value[0] as $key => $item){ ?>
39
- <option value="<?php echo esc_attr($key); ?>" <?php echo $key==$value[1]?'selected':''; ?>><?php echo esc_attr($item); ?></option>
40
  <?php } ?>
41
  </select>
42
  <?php } ?>
1
+ <?php
2
+ // exit if accessed directly
3
+ if( ! defined( 'ABSPATH' ) ) exit;
4
+ ?>
5
  <div id="acf-photo-gallery-metabox-edit-<?php echo esc_attr($attachment); ?>" class="acf-edit-photo-gallery">
6
  <h3>Edit Image</h3>
7
  <input class="acf-photo-gallery-edit-field" type="hidden" name="acf-pg-hidden-field" value="<?php echo esc_attr($field); ?>"/>
18
  ?>
19
  <?php if( in_array($type, array('text', 'date', 'color', 'datetime-local', 'email', 'number', 'tel', 'time', 'url', 'week', 'range')) ){ ?>
20
  <label><?php echo esc_attr($label); ?></label>
21
+ <input class="acf-photo-gallery-edit-field" type="<?php echo esc_attr($type); ?>" name="<?php echo esc_attr($name); ?>" value="<?php echo esc_attr($value); ?>"/>
22
  <?php } ?>
23
  <?php if( $type == 'checkbox' ){ ?>
24
  <label>
40
  <label><?php echo esc_attr($label); ?></label>
41
  <select class="acf-photo-gallery-edit-field" name="<?php echo esc_attr($name); ?>">
42
  <?php foreach($value[0] as $key => $item){ ?>
43
+ <option value="<?php echo esc_attr($key); ?>" <?php echo esc_attr($key==$value[1]?'selected':''); ?>><?php echo esc_attr($item); ?></option>
44
  <?php } ?>
45
  </select>
46
  <?php } ?>
includes/acf_photo_gallery_remove_photo.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
 
 
 
 
3
  //Helper function that will remove photo from the gallery
4
  function acf_photo_gallery_remove_photo(){
5
  if( wp_verify_nonce( $_GET['_wpnonce'], 'nonce_acf_photo_gallery') and !empty($_GET['post']) and !empty($_GET['photo']) ){
1
  <?php
2
 
3
+ // exit if accessed directly
4
+ if( ! defined( 'ABSPATH' ) ) exit;
5
+
6
  //Helper function that will remove photo from the gallery
7
  function acf_photo_gallery_remove_photo(){
8
  if( wp_verify_nonce( $_GET['_wpnonce'], 'nonce_acf_photo_gallery') and !empty($_GET['post']) and !empty($_GET['photo']) ){
includes/acf_photo_gallery_resize_image.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
 
 
 
 
3
  //Helper function that resizes the images from the specified args
4
  function acf_photo_gallery_resize_image( $img_url, $width = 150, $height = 150){
5
  if( !function_exists('aq_resize') ){
1
  <?php
2
 
3
+ // exit if accessed directly
4
+ if( ! defined( 'ABSPATH' ) ) exit;
5
+
6
  //Helper function that resizes the images from the specified args
7
  function acf_photo_gallery_resize_image( $img_url, $width = 150, $height = 150){
8
  if( !function_exists('aq_resize') ){
includes/acf_photo_gallery_save.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
 
 
 
 
3
  //Fires off when the WordPress update button is clicked
4
  function acf_photo_gallery_save( $post_id ){
5
 
@@ -9,15 +12,16 @@ function acf_photo_gallery_save( $post_id ){
9
  // unhook this function so it doesn't loop infinitely
10
  remove_action( 'save_post', 'acf_photo_gallery_save' );
11
 
12
- $field = !empty($_POST['acf-photo-gallery-groups'])? $_POST['acf-photo-gallery-groups']: null;
 
13
 
14
  if( !empty($field) ){
15
  $field_key = sanitize_text_field($_POST['acf-photo-gallery-field']);
16
  foreach($field as $k => $v ){
17
  $field_id = isset($_POST['acf-photo-gallery-groups'][$k])? sanitize_text_field($_POST['acf-photo-gallery-groups'][$k]): null;
18
  if (!empty($field_id)) {
19
- $ids = !empty($field) && isset($_POST[$field_id])? $_POST[$field_id]: null;
20
- if (!empty($ids)) {
21
  $ids = implode(',', $ids);
22
  update_post_meta($post_id, $field_id, $ids);
23
  acf_update_metadata($post_id, $field_id, $field_key, true);
1
  <?php
2
 
3
+ // exit if accessed directly
4
+ if( ! defined( 'ABSPATH' ) ) exit;
5
+
6
  //Fires off when the WordPress update button is clicked
7
  function acf_photo_gallery_save( $post_id ){
8
 
12
  // unhook this function so it doesn't loop infinitely
13
  remove_action( 'save_post', 'acf_photo_gallery_save' );
14
 
15
+ $field = !empty($_POST['acf-photo-gallery-groups'])? $_POST['acf-photo-gallery-groups']: array();
16
+ $field = array_map('sanitize_text_field', $field );
17
 
18
  if( !empty($field) ){
19
  $field_key = sanitize_text_field($_POST['acf-photo-gallery-field']);
20
  foreach($field as $k => $v ){
21
  $field_id = isset($_POST['acf-photo-gallery-groups'][$k])? sanitize_text_field($_POST['acf-photo-gallery-groups'][$k]): null;
22
  if (!empty($field_id)) {
23
+ $ids = !empty($_POST[$field_id])? array_map('sanitize_text_field', $_POST[$field_id]): null;
24
+ if (!empty($ids)) {
25
  $ids = implode(',', $ids);
26
  update_post_meta($post_id, $field_id, $ids);
27
  acf_update_metadata($post_id, $field_id, $field_key, true);
includes/elementor_register_tag.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
 
 
 
 
3
  use ElementorPro\Modules\DynamicTags\Tags\Base\Data_Tag;
4
 
5
  class register_tag extends Data_Tag {
1
  <?php
2
 
3
+ // exit if accessed directly
4
+ if( ! defined( 'ABSPATH' ) ) exit;
5
+
6
  use ElementorPro\Modules\DynamicTags\Tags\Base\Data_Tag;
7
 
8
  class register_tag extends Data_Tag {
includes/input_admin_enqueue_scripts.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
 
 
 
 
3
  // vars
4
  $url = $this->settings['url'];
5
  $version = $this->settings['version'];
1
  <?php
2
 
3
+ // exit if accessed directly
4
+ if( ! defined( 'ABSPATH' ) ) exit;
5
+
6
  // vars
7
  $url = $this->settings['url'];
8
  $version = $this->settings['version'];
includes/render_field.php CHANGED
@@ -1,5 +1,9 @@
1
  <?php
2
 
 
 
 
 
3
  global $pagenow;
4
  if( $pagenow == 'edit-tags.php'){
5
  echo 'ACF Photo Gallery Field is not supported on taxonomy.';
@@ -70,7 +74,7 @@
70
  <?php if($remove_delete_button != "Yes") { ?>
71
  <a class="dashicons dashicons-dismiss" href="#" data-id="<?php echo esc_attr($image); ?>" data-field="<?php echo esc_attr($key); ?>" title="Remove this photo from the gallery"></a>
72
  <?php } ?>
73
- <input type="hidden" name="<?php echo $field['_name']; ?>[]" value="<?php echo esc_attr($image); ?>"/>
74
  <img src="<?php echo wp_get_attachment_thumb_url( $image ); ?>"/>
75
  </li>
76
  <?php endforeach; else: ?><li class="acf-photo-gallery-media-box-placeholder"><span class="dashicons dashicons-format-image"></span></li><?php endif; ?>
1
  <?php
2
 
3
+ // exit if accessed directly
4
+ if( ! defined( 'ABSPATH' ) ) exit;
5
+
6
+
7
  global $pagenow;
8
  if( $pagenow == 'edit-tags.php'){
9
  echo 'ACF Photo Gallery Field is not supported on taxonomy.';
74
  <?php if($remove_delete_button != "Yes") { ?>
75
  <a class="dashicons dashicons-dismiss" href="#" data-id="<?php echo esc_attr($image); ?>" data-field="<?php echo esc_attr($key); ?>" title="Remove this photo from the gallery"></a>
76
  <?php } ?>
77
+ <input type="hidden" name="<?php echo esc_attr($field['_name']); ?>[]" value="<?php echo esc_attr($image); ?>"/>
78
  <img src="<?php echo wp_get_attachment_thumb_url( $image ); ?>"/>
79
  </li>
80
  <?php endforeach; else: ?><li class="acf-photo-gallery-media-box-placeholder"><span class="dashicons dashicons-format-image"></span></li><?php endif; ?>
includes/v4/create_options.php CHANGED
@@ -1,8 +1,12 @@
1
  <?php
 
 
 
 
2
  $field = array_merge($this->defaults, $field);
3
- $key = $field['name'];
4
  ?>
5
- <tr class="field_option field_option_<?php echo $this->name; ?>">
6
  <td class="label">
7
  <label><?php _e("Edit modal",'acf'); ?></label>
8
  <p class="description"><?php _e("Native lets you delete permanently or select another, but is heavier",'acf'); ?></p>
1
  <?php
2
+
3
+ // exit if accessed directly
4
+ if( ! defined( 'ABSPATH' ) ) exit;
5
+
6
  $field = array_merge($this->defaults, $field);
7
+ $key = esc_attr($field['name']);
8
  ?>
9
+ <tr class="field_option field_option_<?php echo esc_attr($this->name); ?>">
10
  <td class="label">
11
  <label><?php _e("Edit modal",'acf'); ?></label>
12
  <p class="description"><?php _e("Native lets you delete permanently or select another, but is heavier",'acf'); ?></p>
includes/v5/render_field_settings.php CHANGED
@@ -1,4 +1,8 @@
1
  <?php
 
 
 
 
2
  /*
3
  * acf_render_field_setting
4
  *
1
  <?php
2
+
3
+ // exit if accessed directly
4
+ if( ! defined( 'ABSPATH' ) ) exit;
5
+
6
  /*
7
  * acf_render_field_setting
8
  *
index.php CHANGED
@@ -1,2 +1,2 @@
1
  <?php
2
- // Silence is golden.
1
  <?php
2
+ // Silence is golden.
navz-photo-gallery.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: ACF Photo Gallery Field
5
  Plugin URI: http://www.navz.me/
6
  Description: An extension for Advance Custom Fields which lets you add photo gallery functionality on your websites.
7
- Version: 1.7.6
8
  Author: Navneil Naicker
9
  Author URI: http://www.navz.me/
10
  License: GPLv2 or later
4
  Plugin Name: ACF Photo Gallery Field
5
  Plugin URI: http://www.navz.me/
6
  Description: An extension for Advance Custom Fields which lets you add photo gallery functionality on your websites.
7
+ Version: 1.7.7
8
  Author: Navneil Naicker
9
  Author URI: http://www.navz.me/
10
  License: GPLv2 or later
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: navzme
3
  Tags: acf, advanced, custom, fields, photo, gallery, album, fancybox, litebox, lightbox
4
  Requires at least: 4.7.0
5
  Tested up to: 5.8.1
6
- Stable tag: 1.7.6
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -128,6 +128,9 @@ Just like any other WordPress plugin, this plugin can also cause issues with oth
128
  4. Please refer to the description for more info regarding the field type settings
129
 
130
  == Changelog ==
 
 
 
131
  =1.7.6=
132
  * [Bugfix] Sanitizing and escaping inputs
133
 
3
  Tags: acf, advanced, custom, fields, photo, gallery, album, fancybox, litebox, lightbox
4
  Requires at least: 4.7.0
5
  Tested up to: 5.8.1
6
+ Stable tag: 1.7.7
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
128
  4. Please refer to the description for more info regarding the field type settings
129
 
130
  == Changelog ==
131
+ =1.7.7=
132
+ * [Bugfix] Sanitizing and escaping inputs
133
+
134
  =1.7.6=
135
  * [Bugfix] Sanitizing and escaping inputs
136