NextGEN Gallery – WordPress Gallery Plugin - Version 3.24

Version Description

  • 03.23.2022 =
  • Fixed: A possible PHP warning could be generated if the global $post->content is an integer or boolean.
  • Fixed: Activating NextGEN for the first time generated a PHP warning when registering default settings.
  • Fixed: NextGEN widgets JS/CSS was enqueued on all frontend pages.
  • Fixed: Some errors generated while image uploading were not being displayed to the user.
Download this release

Release Info

Developer photocrati
Plugin Icon 128x128 NextGEN Gallery – WordPress Gallery Plugin
Version 3.24
Comparing to
See all releases

Code changes from version 3.23 to 3.24

changelog.txt CHANGED
@@ -1,6 +1,12 @@
1
  NextGEN Gallery
2
  by Imagely
3
 
 
 
 
 
 
 
4
  = V3.23 - 02.09.2022 =
5
  * Fixed: A potential PHP fatal error in C_Photocrati_Transient_Manager when using external object caching.
6
  * Fixed: Manage Gallery page could create a javascript error if the page loads quickly enough.
1
  NextGEN Gallery
2
  by Imagely
3
 
4
+ = V3.24 - 03.23.2022 =
5
+ * Fixed: A possible PHP warning could be generated if the global $post->content is an integer or boolean.
6
+ * Fixed: Activating NextGEN for the first time generated a PHP warning when registering default settings.
7
+ * Fixed: NextGEN widgets JS/CSS was enqueued on all frontend pages.
8
+ * Fixed: Some errors generated while image uploading were not being displayed to the user.
9
+
10
  = V3.23 - 02.09.2022 =
11
  * Fixed: A potential PHP fatal error in C_Photocrati_Transient_Manager when using external object caching.
12
  * Fixed: Manage Gallery page could create a javascript error if the page loads quickly enough.
nggallery.php CHANGED
@@ -4,7 +4,7 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
4
  /**
5
  * Plugin Name: NextGEN Gallery
6
  * Description: The most popular gallery plugin for WordPress and one of the most popular plugins of all time with over 30 million downloads.
7
- * Version: 3.23
8
  * Author: Imagely
9
  * Plugin URI: https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/
10
  * Author URI: https://www.imagely.com
@@ -683,7 +683,7 @@ class C_NextGEN_Bootstrap
683
  define('NGG_PRODUCT_URL', path_join(str_replace("\\" , '/', NGG_PLUGIN_URL), 'products'));
684
  define('NGG_MODULE_URL', path_join(str_replace("\\", '/', NGG_PRODUCT_URL), 'photocrati_nextgen/modules'));
685
  define('NGG_PLUGIN_STARTED_AT', microtime());
686
- define('NGG_PLUGIN_VERSION', '3.23');
687
 
688
  define(
689
  'NGG_SCRIPT_VERSION',
4
  /**
5
  * Plugin Name: NextGEN Gallery
6
  * Description: The most popular gallery plugin for WordPress and one of the most popular plugins of all time with over 30 million downloads.
7
+ * Version: 3.24
8
  * Author: Imagely
9
  * Plugin URI: https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/
10
  * Author URI: https://www.imagely.com
683
  define('NGG_PRODUCT_URL', path_join(str_replace("\\" , '/', NGG_PLUGIN_URL), 'products'));
684
  define('NGG_MODULE_URL', path_join(str_replace("\\", '/', NGG_PRODUCT_URL), 'photocrati_nextgen/modules'));
685
  define('NGG_PLUGIN_STARTED_AT', microtime());
686
+ define('NGG_PLUGIN_VERSION', '3.24');
687
 
688
  define(
689
  'NGG_SCRIPT_VERSION',
products/photocrati_nextgen/modules/nextgen_addgallery_page/templates/upload_images.php CHANGED
@@ -152,26 +152,22 @@
152
  }
153
  })
154
  .on('complete', (result) => {
155
- // There was at least one error: remove the successful images so users can find out what went wrong
156
- if (result.failed.length > 0) {
157
- uppy.getFiles().forEach((file) => {
158
- console.log("FILE", file);
159
- if ('undefined' === typeof file.error) {
160
- uppy.removeFile(file.id);
161
- }
162
- });
163
- } else {
164
- // All uploads were a success; clear the board and reset the game
165
- setTimeout(() => {
166
- uppy.reset();
167
- }, 2000);
168
- }
169
 
170
  const gallery_url = '<?php echo admin_url("/admin.php?page=nggallery-manage-gallery&mode=edit&gid=")?>' + gallery_select.value;
171
  const chosen_name = String(gallery_select.selectedOptions[0].dataset.originalValue);
172
 
173
  let upload_count = result.successful.length;
174
 
 
 
 
 
 
 
 
175
  // Adjust the upload count for images uploaded inside a zip file
176
  result.successful.forEach(function(uploaded_file) {
177
  if ('zip' === uploaded_file.extension) {
@@ -188,16 +184,18 @@
188
  message = NggUploadImages_i18n.one_image_uploaded;
189
  }
190
 
191
- if (upload_count >= 1) {
192
- message = message + ' ' + NggUploadImages_i18n.manage_gallery;
193
- }
194
-
195
- if (result.failed.length > 0) {
196
- uppy.getFiles().forEach((file) => {
197
  message = message + "<br/>" + NggUploadImages_i18n.image_failed;
198
  message = message.replace('{filename}', file.name)
199
- .replace('{error}', file.error);
200
- })
 
 
 
 
 
201
  }
202
 
203
  message = message.replace('{count}', String(upload_count))
152
  }
153
  })
154
  .on('complete', (result) => {
155
+ setTimeout(() => {
156
+ uppy.reset();
157
+ }, 2000);
 
 
 
 
 
 
 
 
 
 
 
158
 
159
  const gallery_url = '<?php echo admin_url("/admin.php?page=nggallery-manage-gallery&mode=edit&gid=")?>' + gallery_select.value;
160
  const chosen_name = String(gallery_select.selectedOptions[0].dataset.originalValue);
161
 
162
  let upload_count = result.successful.length;
163
 
164
+ // Modify the upload count so we can determine which message base to start with
165
+ uppy.getFiles().forEach((file) => {
166
+ if ('undefined' !== typeof file.response.body.error) {
167
+ upload_count--;
168
+ }
169
+ })
170
+
171
  // Adjust the upload count for images uploaded inside a zip file
172
  result.successful.forEach(function(uploaded_file) {
173
  if ('zip' === uploaded_file.extension) {
184
  message = NggUploadImages_i18n.one_image_uploaded;
185
  }
186
 
187
+ // Append warning messages for individual images
188
+ uppy.getFiles().forEach((file) => {
189
+ if ('undefined' !== typeof file.response.body.error) {
 
 
 
190
  message = message + "<br/>" + NggUploadImages_i18n.image_failed;
191
  message = message.replace('{filename}', file.name)
192
+ .replace('{error}', file.response.body.error);
193
+ uppy.removeFile(file.id);
194
+ }
195
+ })
196
+
197
+ if (upload_count >= 1) {
198
+ message = message + ' ' + NggUploadImages_i18n.manage_gallery;
199
  }
200
 
201
  message = message.replace('{count}', String(upload_count))
products/photocrati_nextgen/modules/nextgen_settings/module.nextgen_settings.php CHANGED
@@ -129,7 +129,7 @@ class C_NextGen_Settings_Installer
129
  'irRotatetime' => 5,
130
 
131
  // Misc
132
- 'dynamic_image_filename_separator_use_dash' => !$existing_options['gallerypath'],
133
 
134
  // It is known that WPEngine disables 'order by rand()' by default, but exposes it as an option to users
135
  'use_alternate_random_method' => (function_exists('is_wpe') && is_wpe()) ? TRUE : FALSE,
@@ -211,4 +211,4 @@ class C_NextGen_Settings_Installer
211
  }
212
  }
213
 
214
- new M_NextGen_Settings();
129
  'irRotatetime' => 5,
130
 
131
  // Misc
132
+ 'dynamic_image_filename_separator_use_dash' => !isset($existing_options['gallerypath']) ? TRUE : FALSE,
133
 
134
  // It is known that WPEngine disables 'order by rand()' by default, but exposes it as an option to users
135
  'use_alternate_random_method' => (function_exists('is_wpe') && is_wpe()) ? TRUE : FALSE,
211
  }
212
  }
213
 
214
+ new M_NextGen_Settings();
products/photocrati_nextgen/modules/third_party_compat/module.third_party_compat.php CHANGED
@@ -125,9 +125,6 @@ class M_Third_Party_Compat extends C_Base_Module
125
  M_WordPress_Routing::$_use_old_slugs = FALSE;
126
  add_action('template_redirect', array(&$this, 'fix_wpml_canonical_redirect'), 1);
127
  }
128
-
129
- // TODO: Only needed for NGG Pro 1.0.10 and lower
130
- add_action('the_post', array(&$this, 'add_ngg_pro_page_parameter'));
131
  }
132
 
133
  /**
@@ -476,23 +473,6 @@ class M_Third_Party_Compat extends C_Base_Module
476
  }
477
  }
478
 
479
- /**
480
- * NGG Pro 1.0.10 relies on the 'page' parameter for pagination, but that conflicts with
481
- * WordPress Post Pagination (<!-- nextpage -->). This was fixed in 1.0.11, so this code is
482
- * for backwards compatibility
483
- * TODO: This can be removed in a later release
484
- */
485
- function add_ngg_pro_page_parameter()
486
- {
487
- global $post;
488
-
489
- if ($post AND !is_array($post->content) AND (strpos($post->content, "<!--nextpage-->") === FALSE) AND (strpos($_SERVER['REQUEST_URI'], '/page/') !== FALSE)) {
490
- if (preg_match("#/page/(\\d+)#", $_SERVER['REQUEST_URI'], $match)) {
491
- $_REQUEST['page'] = $match[1];
492
- }
493
- }
494
- }
495
-
496
  /**
497
  * Headway themes offer gzip compression, but it causes problems with NextGEN output. Disable that feature while
498
  * NextGEN is active.
125
  M_WordPress_Routing::$_use_old_slugs = FALSE;
126
  add_action('template_redirect', array(&$this, 'fix_wpml_canonical_redirect'), 1);
127
  }
 
 
 
128
  }
129
 
130
  /**
473
  }
474
  }
475
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
476
  /**
477
  * Headway themes offer gzip compression, but it causes problems with NextGEN output. Disable that feature while
478
  * NextGEN is active.
products/photocrati_nextgen/modules/widget/package.module.widget.php CHANGED
@@ -73,6 +73,10 @@ class C_Widget_Gallery extends WP_Widget
73
  // and cache the resulting displayed gallery for later rendering to avoid the ID changing due to misc attributes
74
  // in $args being different now and at render time ($args is sidebar information that is not relevant)
75
  add_action('wp_enqueue_scripts', function () {
 
 
 
 
76
  global $wp_registered_sidebars;
77
  $sidebars = wp_get_sidebars_widgets();
78
  $options = $this->get_settings();
@@ -317,6 +321,10 @@ class C_Widget_Slideshow extends WP_Widget
317
  // and cache the resulting displayed gallery for later rendering to avoid the ID changing due to misc attributes
318
  // in $args being different now and at render time ($args is sidebar information that is not relevant)
319
  add_action('wp_enqueue_scripts', function () {
 
 
 
 
320
  global $wp_registered_sidebars;
321
  $sidebars = wp_get_sidebars_widgets();
322
  $options = $this->get_settings();
73
  // and cache the resulting displayed gallery for later rendering to avoid the ID changing due to misc attributes
74
  // in $args being different now and at render time ($args is sidebar information that is not relevant)
75
  add_action('wp_enqueue_scripts', function () {
76
+ // Prevent enqueueing resources if the widget is not in use
77
+ if (!is_active_widget(FALSE, FALSE, 'ngg-images', true)) {
78
+ return;
79
+ }
80
  global $wp_registered_sidebars;
81
  $sidebars = wp_get_sidebars_widgets();
82
  $options = $this->get_settings();
321
  // and cache the resulting displayed gallery for later rendering to avoid the ID changing due to misc attributes
322
  // in $args being different now and at render time ($args is sidebar information that is not relevant)
323
  add_action('wp_enqueue_scripts', function () {
324
+ // Prevent enqueueing resources if the widget is not in use
325
+ if (!is_active_widget(FALSE, FALSE, 'slideshow', true)) {
326
+ return;
327
+ }
328
  global $wp_registered_sidebars;
329
  $sidebars = wp_get_sidebars_widgets();
330
  $options = $this->get_settings();
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: photocrati, imagely
3
  Tags: wordpress gallery plugin, gallery, nextgen, nextgen gallery, photo gallery, image gallery, photography, slideshow, images, photo, photo album, watermark
4
  Requires at least: 5.5.4
5
- Stable tag: 3.23
6
  Tested up to: 5.9
7
  License: GPLv3
8
  Requires PHP: 5.6
@@ -179,6 +179,12 @@ For more information, feel free to visit the official website for the NextGEN Ga
179
 
180
  == Changelog ==
181
 
 
 
 
 
 
 
182
  = V3.23 - 02.09.2022 =
183
  * Fixed: A potential PHP fatal error in C_Photocrati_Transient_Manager when using external object caching.
184
  * Fixed: Manage Gallery page could create a javascript error if the page loads quickly enough.
2
  Contributors: photocrati, imagely
3
  Tags: wordpress gallery plugin, gallery, nextgen, nextgen gallery, photo gallery, image gallery, photography, slideshow, images, photo, photo album, watermark
4
  Requires at least: 5.5.4
5
+ Stable tag: 3.24
6
  Tested up to: 5.9
7
  License: GPLv3
8
  Requires PHP: 5.6
179
 
180
  == Changelog ==
181
 
182
+ = V3.24 - 03.23.2022 =
183
+ * Fixed: A possible PHP warning could be generated if the global $post->content is an integer or boolean.
184
+ * Fixed: Activating NextGEN for the first time generated a PHP warning when registering default settings.
185
+ * Fixed: NextGEN widgets JS/CSS was enqueued on all frontend pages.
186
+ * Fixed: Some errors generated while image uploading were not being displayed to the user.
187
+
188
  = V3.23 - 02.09.2022 =
189
  * Fixed: A potential PHP fatal error in C_Photocrati_Transient_Manager when using external object caching.
190
  * Fixed: Manage Gallery page could create a javascript error if the page loads quickly enough.