NextGEN Gallery – WordPress Gallery Plugin - Version 2.0.27

Version Description

  • 09.18.2013 =
  • Fixed: Reduce performance impact of purging displayed gallery transients
Download this release

Release Info

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

Code changes from version 2.0.25 to 2.0.27

Files changed (36) hide show
  1. changelog.txt +23 -1
  2. nggallery.php +19 -2
  3. non_pope/class.photocrati_cache.php +53 -12
  4. non_pope/class.photocrati_installer.php +22 -0
  5. non_pope/class.photocrati_resource_manager.php +1 -1
  6. products/photocrati_nextgen/modules/datamapper/class.datamapper_driver_base.php +10 -4
  7. products/photocrati_nextgen/modules/datamapper/module.datamapper.php +22 -12
  8. products/photocrati_nextgen/modules/fs/class.fs.php +4 -2
  9. products/photocrati_nextgen/modules/lightbox/class.lightbox_installer.php +2 -2
  10. products/photocrati_nextgen/modules/lightbox/static/highslide/nextgen_highslide_init.js +15 -2
  11. products/photocrati_nextgen/modules/nextgen_basic_album/adapter.nextgen_basic_album_controller.php +15 -6
  12. products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.ajax_pagination_actions.php +1 -0
  13. products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_gallery_mapper.php +2 -1
  14. products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_slideshow_controller.php +1 -0
  15. products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_thumbnails_controller.php +9 -7
  16. products/photocrati_nextgen/modules/nextgen_basic_gallery/module.nextgen_basic_gallery.php +1 -1
  17. products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/adapter.nextgen_basic_imagebrowser_controller.php +2 -1
  18. products/photocrati_nextgen/modules/nextgen_basic_templates/adapter.nextgen_basic_template_form.php +8 -2
  19. products/photocrati_nextgen/modules/nextgen_data/class.image_mapper.php +13 -2
  20. products/photocrati_nextgen/modules/nextgen_data/class.image_wrapper.php +4 -21
  21. products/photocrati_nextgen/modules/nextgen_data/class.nextgen_data_installer.php +2 -0
  22. products/photocrati_nextgen/modules/nextgen_gallery_display/class.display_type_controller.php +1 -1
  23. products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery.php +22 -5
  24. products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery_mapper.php +1 -0
  25. products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery_renderer.php +5 -3
  26. products/photocrati_nextgen/modules/nextgen_gallery_display/module.nextgen_gallery_display.php +11 -3
  27. products/photocrati_nextgen/modules/nextgen_other_options/adapter.image_options_form.php +3 -1
  28. products/photocrati_nextgen/modules/nextgen_other_options/adapter.other_options_forms.php +13 -10
  29. products/photocrati_nextgen/modules/nextgen_other_options/adapter.reset_form.php +24 -6
  30. products/photocrati_nextgen/modules/nextgen_other_options/templates/image_options_tab.php +43 -30
  31. products/photocrati_nextgen/modules/nextgen_other_options/templates/reset_tab.php +2 -0
  32. products/photocrati_nextgen/modules/nextgen_settings/class.nextgen_settings_installer.php +39 -37
  33. products/photocrati_nextgen/modules/ngglegacy/nggallery.php +2 -0
  34. products/photocrati_nextgen/modules/router/class.routing_app.php +3 -3
  35. products/photocrati_nextgen/product.photocrati_nextgen.php +1 -1
  36. readme.txt +18 -0
changelog.txt CHANGED
@@ -1,8 +1,30 @@
1
  NextGEN Gallery
2
  by Photocrati Media
3
 
 
 
 
4
  = V2.0.25 - 09.18.2013 =
5
- * Reverting to the 2.0.21 codebase, due to major performance issues in 2.0.23 and 2.0.24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
  = V2.0.21 - 09.09.2013 =
8
  * NEW: Multisite support
1
  NextGEN Gallery
2
  by Photocrati Media
3
 
4
+ = V2.0.27 - 09.18.2013 =
5
+ * Fixed: Reduce performance impact of purging displayed gallery transients
6
+
7
  = V2.0.25 - 09.18.2013 =
8
+ * Changed: Reverting to the 2.0.21 codebase, due to major performance issues in 2.0.23 and 2.0.24
9
+
10
+ = V2.0.24 - 09.18.2013 =
11
+ * WARNING: Broken release. Uses wp_clear_scheduled_hooks() to purge cron records
12
+
13
+ = V2.0.23 - 09.12.2013 =
14
+ * WARNING: Broken release. Major bug creates redundant cron jobs
15
+ * NEW: WP-Cron job to periodically clean-up displayed gallery transients
16
+ * NEW: Added "excluded_container_ids" as parameter for ngg_images shortcode
17
+ * Fixed: Lightbox effect is honoured by all display types
18
+ * Fixed: Highslide displays images from the correct displayed galleries
19
+ * Fixed: Ensure that sub-albums display correctly when the word "album" is part of a slug
20
+ * Fixed: Ensure that sub-albums display correctly when numerical slugs are used
21
+ * Fixed: Related images heading only added when Related Images functionality is enabled
22
+ * Fixed: PHP Warning about undefined index when viewing basic albums
23
+ * Fixed: AJAX handling is third-party compatible
24
+ * Fixed: Image date is no longer overwritten when an image is modified
25
+ * Fixed: Fixed issue with displayed galleries using source='tags'
26
+ * Fixed: Problem with transient cache not getting flushed properly from Other Options page
27
+ * Fixed: Use correct gallery/transient ID when ajax pagination is used
28
 
29
  = V2.0.21 - 09.09.2013 =
30
  * NEW: Multisite support
nggallery.php CHANGED
@@ -4,7 +4,7 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
4
  /**
5
  * Plugin Name: NextGEN Gallery by Photocrati
6
  * Description: The most popular gallery plugin for WordPress and one of the most popular plugins of all time with over 7 million downloads.
7
- * Version: 2.0.25
8
  * Author: Photocrati Media
9
  * Plugin URI: http://www.nextgen-gallery.com
10
  * Author URI: http://www.photocrati.com
@@ -82,6 +82,8 @@ class C_NextGEN_Bootstrap
82
 
83
  // Load caching component
84
  include_once('non_pope/class.photocrati_cache.php');
 
 
85
  C_Photocrati_Cache::$enabled = TRUE;
86
 
87
  if (isset($_REQUEST['ngg_flush'])) {
@@ -93,6 +95,10 @@ class C_NextGEN_Bootstrap
93
  C_Photocrati_Cache::$force_update = TRUE;
94
  $_SERVER['QUERY_STRING'] = str_replace('ngg_force_update=1', '', $_SERVER['QUERY_STRING']);
95
  }
 
 
 
 
96
 
97
  // Load Settings Manager
98
  include_once('non_pope/class.photocrati_settings_manager.php');
@@ -192,6 +198,12 @@ class C_NextGEN_Bootstrap
192
  add_action('all_admin_notices', array(&$this, 'display_stylesheet_notice'));
193
  }
194
 
 
 
 
 
 
 
195
  // Update modules
196
  add_action('init', array(&$this, 'update'), PHP_INT_MAX);
197
 
@@ -199,6 +211,11 @@ class C_NextGEN_Bootstrap
199
  add_action('init', array(&$this, 'route'), PHP_INT_MAX);
200
  }
201
 
 
 
 
 
 
202
  /**
203
  * Ensure that C_Photocrati_Settings_Manager gets persisted as an array
204
  * @param $settings
@@ -315,7 +332,7 @@ class C_NextGEN_Bootstrap
315
  define('NEXTGEN_GALLERY_MODULE_URL', path_join(NEXTGEN_GALLERY_PRODUCT_URL, 'photocrati_nextgen/modules'));
316
  define('NEXTGEN_GALLERY_PLUGIN_CLASS', path_join(NEXTGEN_GALLERY_PLUGIN_DIR, 'module.NEXTGEN_GALLERY_PLUGIN.php'));
317
  define('NEXTGEN_GALLERY_PLUGIN_STARTED_AT', microtime());
318
- define('NEXTGEN_GALLERY_PLUGIN_VERSION', '2.0.25');
319
  }
320
 
321
 
4
  /**
5
  * Plugin Name: NextGEN Gallery by Photocrati
6
  * Description: The most popular gallery plugin for WordPress and one of the most popular plugins of all time with over 7 million downloads.
7
+ * Version: 2.0.27
8
  * Author: Photocrati Media
9
  * Plugin URI: http://www.nextgen-gallery.com
10
  * Author URI: http://www.photocrati.com
82
 
83
  // Load caching component
84
  include_once('non_pope/class.photocrati_cache.php');
85
+ C_Photocrati_Cache::get_instance();
86
+ C_Photocrati_Cache::get_instance('displayed_galleries');
87
  C_Photocrati_Cache::$enabled = TRUE;
88
 
89
  if (isset($_REQUEST['ngg_flush'])) {
95
  C_Photocrati_Cache::$force_update = TRUE;
96
  $_SERVER['QUERY_STRING'] = str_replace('ngg_force_update=1', '', $_SERVER['QUERY_STRING']);
97
  }
98
+ elseif (isset($_REQUEST['ngg_flush_expired'])) {
99
+ C_Photocrati_Cache::flush('all', TRUE);
100
+ $_SERVER['QUERY_STRING'] = str_replace('ngg_flush_expired=1', '', $_SERVER['QUERY_STRING']);
101
+ }
102
 
103
  // Load Settings Manager
104
  include_once('non_pope/class.photocrati_settings_manager.php');
198
  add_action('all_admin_notices', array(&$this, 'display_stylesheet_notice'));
199
  }
200
 
201
+ // Delete displayed gallery transients periodically
202
+ add_action('ngg_delete_expired_transients', array(&$this, 'delete_expired_transients'));
203
+ if (!wp_next_scheduled('ngg_delete_expired_transients')) {
204
+ wp_schedule_event(time(), 'hourly', 'ngg_delete_expired_transients');
205
+ }
206
+
207
  // Update modules
208
  add_action('init', array(&$this, 'update'), PHP_INT_MAX);
209
 
211
  add_action('init', array(&$this, 'route'), PHP_INT_MAX);
212
  }
213
 
214
+ function delete_expired_transients()
215
+ {
216
+ C_Photocrati_Cache::flush('displayed_galleries', TRUE);
217
+ }
218
+
219
  /**
220
  * Ensure that C_Photocrati_Settings_Manager gets persisted as an array
221
  * @param $settings
332
  define('NEXTGEN_GALLERY_MODULE_URL', path_join(NEXTGEN_GALLERY_PRODUCT_URL, 'photocrati_nextgen/modules'));
333
  define('NEXTGEN_GALLERY_PLUGIN_CLASS', path_join(NEXTGEN_GALLERY_PLUGIN_DIR, 'module.NEXTGEN_GALLERY_PLUGIN.php'));
334
  define('NEXTGEN_GALLERY_PLUGIN_STARTED_AT', microtime());
335
+ define('NEXTGEN_GALLERY_PLUGIN_VERSION', '2.0.27');
336
  }
337
 
338
 
non_pope/class.photocrati_cache.php CHANGED
@@ -85,7 +85,7 @@ class C_Photocrati_Cache
85
  /**
86
  * Flush the entire cache
87
  */
88
- static function flush($group=NULL)
89
  {
90
  $retval = 0;
91
 
@@ -94,36 +94,77 @@ class C_Photocrati_Cache
94
  // Delete all caches
95
  if ($group == 'all') {
96
  foreach (self::$_instances as $cache) {
97
- $retval += self::flush($cache->group);
98
  }
99
  }
100
 
101
  // Delete items from a single cache in particular
102
  else {
103
- foreach (self::get_key_list($group) as $key) {
104
- self::delete($key, FALSE, $group);
 
 
 
 
 
 
 
 
 
105
  }
106
 
107
- // Delete list of cached items
108
- global $wpdb;
109
- $cache = self::get_instance($group);
110
- $sql = $wpdb->prepare("DELETE FROM {$wpdb->options} WHERE option_name LIKE %s", '%'.$cache->group.'%');
111
- $retval = $wpdb->query($sql);
 
 
 
 
 
 
 
 
 
 
 
112
  }
113
  }
114
 
115
  return $retval;
116
  }
117
 
118
- static function get_key_list($group=NULL)
119
  {
120
  global $wpdb;
121
 
122
  $cache = self::get_instance($group);
123
- $sql = $wpdb->prepare("SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE %s", '%'.$cache->group.'%');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  return $wpdb->get_col($sql);
125
  }
126
 
 
 
 
 
 
127
 
128
  /**
129
  * Gets an item using a particular key
@@ -156,7 +197,7 @@ class C_Photocrati_Cache
156
  if (is_array($key)) $key = self::generate_key($key);
157
  if (self::$force_update OR $this->lookup($key, FALSE) === FALSE) {
158
  set_transient($key, $value, $ttl);
159
- update_option($this->group.$key, 1);
160
  $retval = $key;
161
  }
162
  }
85
  /**
86
  * Flush the entire cache
87
  */
88
+ static function flush($group=NULL, $expired_only=FALSE)
89
  {
90
  $retval = 0;
91
 
94
  // Delete all caches
95
  if ($group == 'all') {
96
  foreach (self::$_instances as $cache) {
97
+ $retval += self::flush($cache->group, $expired_only);
98
  }
99
  }
100
 
101
  // Delete items from a single cache in particular
102
  else {
103
+ $cache = self::get_instance($group);
104
+
105
+ // Determine if the object cache is external, and not stored in the DB
106
+ // If it's external, we have to delete each transient, one by one
107
+ global $_wp_using_ext_object_cache, $wpdb;
108
+ if ($_wp_using_ext_object_cache) {
109
+ $keys = ($expired_only ? self::get_expired_key_list($group) : self::get_key_list($group));
110
+ foreach ($keys as $key) $cache->delete($key, FALSE);
111
+ $sql = $wpdb->prepare("DELETE FROM {$wpdb->prefix} WHERE option_name LIKE %s", "%%{$cache->group}%%");
112
+ if ($expired_only) $sql .= " AND option_value < ".time();
113
+ $retval = $wpdb->query($sql);
114
  }
115
 
116
+ // Transients are stored in the database
117
+ else {
118
+ $keys = ($expired_only ? self::get_expired_key_list($group) : self::get_key_list($group));
119
+ if ($keys) {
120
+ $all_keys = array();
121
+ foreach ($keys as $value) {
122
+ $all_keys[] = "'{$cache->group}{$value}'";
123
+ $all_keys[] = "'_transient_timeout_{$value}'";
124
+ $all_keys[] = "'_transient_{$value}'";
125
+ }
126
+ unset($keys);
127
+ $all_keys = implode(',', $all_keys);
128
+ $sql = "DELETE FROM {$wpdb->options} WHERE option_name IN (". $all_keys. ')';
129
+ $retval = $wpdb->query($sql);
130
+ }
131
+ }
132
  }
133
  }
134
 
135
  return $retval;
136
  }
137
 
138
+ static function get_key_list($group=NULL, $strip_group_name=TRUE, $expired_only=FALSE)
139
  {
140
  global $wpdb;
141
 
142
  $cache = self::get_instance($group);
143
+
144
+ $sql = '';
145
+ if ($strip_group_name) {
146
+ $sql = $wpdb->prepare(
147
+ "SELECT REPLACE(option_name, %s, '') FROM {$wpdb->options} WHERE option_name LIKE %s",
148
+ $cache->group, '%'.$cache->group.'%'
149
+ );
150
+ }
151
+ else {
152
+ $sql = $wpdb->prepare(
153
+ "SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE %s",
154
+ '%'.$cache->group.'%'
155
+ );
156
+ }
157
+
158
+ if ($expired_only) $sql .= " AND option_value < ".time();
159
+
160
  return $wpdb->get_col($sql);
161
  }
162
 
163
+ static function get_expired_key_list($group=NULL, $strip_group_name=TRUE)
164
+ {
165
+ return self::get_key_list($group, $strip_group_name, TRUE);
166
+ }
167
+
168
 
169
  /**
170
  * Gets an item using a particular key
197
  if (is_array($key)) $key = self::generate_key($key);
198
  if (self::$force_update OR $this->lookup($key, FALSE) === FALSE) {
199
  set_transient($key, $value, $ttl);
200
+ update_option($this->group.$key, time()+$ttl);
201
  $retval = $key;
202
  }
203
  }
non_pope/class.photocrati_installer.php CHANGED
@@ -104,6 +104,9 @@ if (!class_exists('C_Photocrati_Installer'))
104
  // The cache should be flushed
105
  C_Photocrati_Cache::flush();
106
 
 
 
 
107
  // Delete auto-update cache
108
  update_option('photocrati_auto_update_admin_update_list', null);
109
  update_option('photocrati_auto_update_admin_check_date', '');
@@ -154,5 +157,24 @@ if (!class_exists('C_Photocrati_Installer'))
154
  }
155
  return $retval;
156
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  }
158
  }
104
  // The cache should be flushed
105
  C_Photocrati_Cache::flush();
106
 
107
+ // Remove all NGG created cron jobs
108
+ self::refresh_cron();
109
+
110
  // Delete auto-update cache
111
  update_option('photocrati_auto_update_admin_update_list', null);
112
  update_option('photocrati_auto_update_admin_check_date', '');
157
  }
158
  return $retval;
159
  }
160
+
161
+ static function refresh_cron()
162
+ {
163
+ @ini_set('memory_limit', -1);
164
+
165
+ // Remove all cron jobs created by NextGEN Gallery
166
+ $cron = _get_cron_array();
167
+ if (is_array($cron)) {
168
+ foreach ($cron as $timestamp => $job) {
169
+ if (is_array($job)) {
170
+ unset($cron[$timestamp]['ngg_delete_expired_transients']);
171
+ if (empty($cron[$timestamp])) {
172
+ unset($cron[$timestamp]);
173
+ }
174
+ }
175
+ }
176
+ }
177
+ _set_cron_array($cron);
178
+ }
179
  }
180
  }
non_pope/class.photocrati_resource_manager.php CHANGED
@@ -129,7 +129,7 @@ class C_Photocrati_Resource_Manager
129
  // If W3TC is installed and activated, we can't output the
130
  // scripts and manipulate the buffer, so we can only provide a warning
131
  if (defined('W3TC') && defined('WP_DEBUG') && WP_DEBUG) {
132
- define('DONOTCACHEPAGE', TRUE);
133
  if (!did_action('wp_footer')) {
134
  error_log("We're sorry, but your theme's page template didn't make a call to wp_footer(), which is required by NextGEN Gallery. Please add this call to your page templates.");
135
  }
129
  // If W3TC is installed and activated, we can't output the
130
  // scripts and manipulate the buffer, so we can only provide a warning
131
  if (defined('W3TC') && defined('WP_DEBUG') && WP_DEBUG) {
132
+ if (defined('DONOTCACHEPAGE')) define('DONOTCACHEPAGE', TRUE);
133
  if (!did_action('wp_footer')) {
134
  error_log("We're sorry, but your theme's page template didn't make a call to wp_footer(), which is required by NextGEN Gallery. Please add this call to your page templates.");
135
  }
products/photocrati_nextgen/modules/datamapper/class.datamapper_driver_base.php CHANGED
@@ -267,9 +267,10 @@ class Mixin_DataMapper_Driver_Base extends Mixin
267
  // A bind could be an array, used for the 'IN' operator
268
  // or a simple scalar value. We need to convert arrays
269
  // into scalar values
270
- if (is_object($bind)) $bind = (array)$bind;
271
- if (is_array($bind)) {
272
- if (empty($bind)) return FALSE;
 
273
  foreach ($bind as &$val) {
274
  if (!is_numeric($val)) {
275
  $val = '"'.addslashes($val).'"';
@@ -278,7 +279,12 @@ class Mixin_DataMapper_Driver_Base extends Mixin
278
  }
279
  $bind = implode(',', $bind);
280
  }
281
- elseif(!is_numeric($bind)) $numeric = FALSE;
 
 
 
 
 
282
  }
283
  $condition = $wpdb->prepare($condition, $binds);
284
 
267
  // A bind could be an array, used for the 'IN' operator
268
  // or a simple scalar value. We need to convert arrays
269
  // into scalar values
270
+ if (is_object($bind))
271
+ $bind = (array)$bind;
272
+
273
+ if (is_array($bind) && !empty($bind)) {
274
  foreach ($bind as &$val) {
275
  if (!is_numeric($val)) {
276
  $val = '"'.addslashes($val).'"';
279
  }
280
  $bind = implode(',', $bind);
281
  }
282
+ else if (is_array($bind) && empty($bind)) {
283
+ $bind = 'NULL';
284
+ }
285
+ else if(!is_numeric($bind)) {
286
+ $numeric = FALSE;
287
+ }
288
  }
289
  $condition = $wpdb->prepare($condition, $binds);
290
 
products/photocrati_nextgen/modules/datamapper/module.datamapper.php CHANGED
@@ -48,14 +48,16 @@ class M_DataMapper extends C_Base_Module
48
  */
49
  function set_custom_wp_query($sql, &$wp_query)
50
  {
51
- // Set the custom query
52
- if (($custom_sql = $wp_query->get('custom_sql'))) {
53
- $sql = $custom_sql;
54
- }
55
-
56
- // Perhaps we're to initiate a delete query instead?
57
- elseif ($wp_query->get('is_delete')) {
58
- $sql = preg_replace("/^SELECT.*FROM/i", "DELETE FROM", $sql);
 
 
59
  }
60
 
61
  return $sql;
@@ -69,8 +71,13 @@ class M_DataMapper extends C_Base_Module
69
  */
70
  function set_custom_wp_query_fields($fields, &$wp_query)
71
  {
72
- $custom_fields = $wp_query->get('fields');
73
- return $custom_fields ? $custom_fields : $fields;
 
 
 
 
 
74
  }
75
 
76
 
@@ -82,8 +89,11 @@ class M_DataMapper extends C_Base_Module
82
  */
83
  function set_custom_wp_query_where($where, &$wp_query)
84
  {
85
- $this->add_post_title_where_clauses($where, $wp_query);
86
- $this->add_post_name_where_clauses($where, $wp_query);
 
 
 
87
  return $where;
88
  }
89
 
48
  */
49
  function set_custom_wp_query($sql, &$wp_query)
50
  {
51
+ if ($wp_query->get('datamapper')) {
52
+ // Set the custom query
53
+ if (($custom_sql = $wp_query->get('custom_sql'))) {
54
+ $sql = $custom_sql;
55
+ }
56
+
57
+ // Perhaps we're to initiate a delete query instead?
58
+ elseif ($wp_query->get('is_delete')) {
59
+ $sql = preg_replace("/^SELECT.*FROM/i", "DELETE FROM", $sql);
60
+ }
61
  }
62
 
63
  return $sql;
71
  */
72
  function set_custom_wp_query_fields($fields, &$wp_query)
73
  {
74
+ if ($wp_query->get('datmapper')) {
75
+ if (($custom_fields = $wp_query->get('fields'))) {
76
+ $fields = $custom_fields;
77
+ }
78
+ }
79
+
80
+ return $fields;
81
  }
82
 
83
 
89
  */
90
  function set_custom_wp_query_where($where, &$wp_query)
91
  {
92
+ if ($wp_query->get('datamapper')) {
93
+ $this->add_post_title_where_clauses($where, $wp_query);
94
+ $this->add_post_name_where_clauses($where, $wp_query);
95
+ }
96
+
97
  return $where;
98
  }
99
 
products/photocrati_nextgen/modules/fs/class.fs.php CHANGED
@@ -295,11 +295,13 @@ class Mixin_Fs_Instance_Methods extends Mixin
295
  $one = (FALSE === $one ? 0 : count($one) + 1);
296
  $two = (FALSE === $two ? 0 : count($two) + 1);
297
  if (!empty($protocol)) {
298
- if (@$retval[$ndx] !== $val || $two >= $one)
 
299
  $retval[] = $val;
300
  }
301
  else {
302
- if (@$retval[$ndx] !== $val && $two >= $one)
 
303
  $retval[] = $val;
304
  }
305
  }
295
  $one = (FALSE === $one ? 0 : count($one) + 1);
296
  $two = (FALSE === $two ? 0 : count($two) + 1);
297
  if (!empty($protocol)) {
298
+ $existing_val = isset($retval[$ndx]) ? $retval[$ndx] : NULL;
299
+ if ($existing_val !== $val || $two >= $one)
300
  $retval[] = $val;
301
  }
302
  else {
303
+ $existing_val = isset($retval[$ndx]) ? $retval[$ndx] : NULL;
304
+ if ($existing_val !== $val && $two >= $one)
305
  $retval[] = $val;
306
  }
307
  }
products/photocrati_nextgen/modules/lightbox/class.lightbox_installer.php CHANGED
@@ -128,7 +128,7 @@ class C_Lightbox_Installer
128
  $this->install_lightbox(
129
  'highslide',
130
  'Highslide',
131
- 'class="highslide" onclick="return hs.expand(this, galleryOptions);"',
132
  array('photocrati-lightbox#highslide/highslide.css'),
133
  array('photocrati-lightbox#highslide/highslide-full.packed.js', 'photocrati-lightbox#highslide/nextgen_highslide_init.js'),
134
  array('nextgen_highslide_graphics_dir' => $this->router->get_static_url('photocrati-lightbox#highslide/graphics'))
@@ -171,6 +171,6 @@ class C_Lightbox_Installer
171
  */
172
  function uninstall($hard = FALSE)
173
  {
174
- if ($hard) $this->mapper->delete()->run_query();
175
  }
176
  }
128
  $this->install_lightbox(
129
  'highslide',
130
  'Highslide',
131
+ 'class="highslide" onclick="return hs.expand(this, {slideshowGroup: ' . "'%GALLERY_NAME%'" . '});"',
132
  array('photocrati-lightbox#highslide/highslide.css'),
133
  array('photocrati-lightbox#highslide/highslide-full.packed.js', 'photocrati-lightbox#highslide/nextgen_highslide_init.js'),
134
  array('nextgen_highslide_graphics_dir' => $this->router->get_static_url('photocrati-lightbox#highslide/graphics'))
171
  */
172
  function uninstall($hard = FALSE)
173
  {
174
+ $this->mapper->delete()->run_query();
175
  }
176
  }
products/photocrati_nextgen/modules/lightbox/static/highslide/nextgen_highslide_init.js CHANGED
@@ -1,3 +1,4 @@
 
1
  var galleryOptions = {
2
  align: 'center',
3
  dimmingOpacity: 0.8,
@@ -7,10 +8,22 @@ var galleryOptions = {
7
  numberPosition: 'caption',
8
  slideshowGroup: 'gallery',
9
  transitions: ['expand', 'crossfade'],
10
- wrapperClassName: 'dark borderless floating-caption'
 
11
  };
12
 
13
- hs.graphicsDir = nextgen_highslide_graphics_dir + '/';
 
 
 
 
 
 
 
 
 
 
 
14
  hs.addSlideshow({
15
  fixedControls: true,
16
  interval: 5000,
1
+ // Apply default settings
2
  var galleryOptions = {
3
  align: 'center',
4
  dimmingOpacity: 0.8,
8
  numberPosition: 'caption',
9
  slideshowGroup: 'gallery',
10
  transitions: ['expand', 'crossfade'],
11
+ wrapperClassName: 'dark borderless floating-caption',
12
+ graphicsDir: nextgen_highslide_graphics_dir + '/'
13
  };
14
 
15
+ hs.align = galleryOptions['align'];
16
+ hs.dimmingOpacity = galleryOptions['dimmingOpacity'];
17
+ hs.fadeInOut = galleryOptions['fadeInOut'];
18
+ hs.marginBottom = galleryOptions['marginBottom'];
19
+ hs.marginLeft = galleryOptions['marginLeft'];
20
+ hs.numberPosition = galleryOptions['numberPosition'];
21
+ hs.transitions = galleryOptions['transitions'];
22
+ hs.showCredits = galleryOptions['showCredits'];
23
+ hs.graphicsDir = galleryOptions['graphicsDir'];
24
+ hs.wrapperClassName = galleryOptions['wrapperClassName'];
25
+
26
+ // Enable slideshows
27
  hs.addSlideshow({
28
  fixedControls: true,
29
  interval: 5000,
products/photocrati_nextgen/modules/nextgen_basic_album/adapter.nextgen_basic_album_controller.php CHANGED
@@ -57,11 +57,14 @@ class A_NextGen_Basic_Album_Controller extends Mixin
57
  else if (($album = $this->param('album'))) {
58
 
59
  // Are we to display a sub-album?
60
- if (!is_numeric($album))
61
  {
62
  $mapper = $this->object->get_registry()->get_utility('I_Album_Mapper');
63
  $result = array_pop($mapper->select()->where(array('slug = %s', $album))->limit(1)->run_query());
64
- $album = $result->{$result->id_field};
 
 
 
 
65
  }
66
  $displayed_gallery->entity_ids = array();
67
  $displayed_gallery->sortorder = array();
@@ -150,7 +153,7 @@ class A_NextGen_Basic_Album_Controller extends Mixin
150
  $storage = $this->object->get_registry()->get_utility('I_Gallery_Storage');
151
  $image_gen = $this->object->get_registry()->get_utility('I_Dynamic_Thumbnails_Manager');
152
 
153
- if (!$displayed_gallery->display_settings['override_thumbnail_settings'])
154
  {
155
  // legacy templates expect these dimensions
156
  $image_gen_params = array(
@@ -223,6 +226,9 @@ class A_NextGen_Basic_Album_Controller extends Mixin
223
  || $displayed_gallery->container_ids === array('')) {
224
  $pagelink = $this->object->set_param_for($pagelink, 'album', 'all');
225
  }
 
 
 
226
  $gallery->pagelink = $this->object->set_param_for(
227
  $pagelink,
228
  'gallery',
@@ -254,15 +260,18 @@ class A_NextGen_Basic_Album_Controller extends Mixin
254
  function prettify_pagelink($pagelink)
255
  {
256
  $param_separator = C_NextGen_Settings::get_instance()->get('router_param_separator');
 
257
  $regex = implode('', array(
258
  '#',
259
  '/(gallery|album)',
260
- preg_quote($param_separator),
261
  '([^/?]+)',
262
  '#'
263
  ));
264
-
265
- return preg_replace($regex, '/\2', $pagelink);
 
 
266
  }
267
 
268
 
57
  else if (($album = $this->param('album'))) {
58
 
59
  // Are we to display a sub-album?
 
60
  {
61
  $mapper = $this->object->get_registry()->get_utility('I_Album_Mapper');
62
  $result = array_pop($mapper->select()->where(array('slug = %s', $album))->limit(1)->run_query());
63
+ $album_sub = $result ? $result->{$result->id_field} : null;
64
+
65
+ if ($album_sub != null) {
66
+ $album = $album_sub;
67
+ }
68
  }
69
  $displayed_gallery->entity_ids = array();
70
  $displayed_gallery->sortorder = array();
153
  $storage = $this->object->get_registry()->get_utility('I_Gallery_Storage');
154
  $image_gen = $this->object->get_registry()->get_utility('I_Dynamic_Thumbnails_Manager');
155
 
156
+ if (empty($displayed_gallery->display_settings['override_thumbnail_settings']))
157
  {
158
  // legacy templates expect these dimensions
159
  $image_gen_params = array(
226
  || $displayed_gallery->container_ids === array('')) {
227
  $pagelink = $this->object->set_param_for($pagelink, 'album', 'all');
228
  }
229
+ else {
230
+ $pagelink = $this->object->set_param_for($pagelink, 'album', 'album');
231
+ }
232
  $gallery->pagelink = $this->object->set_param_for(
233
  $pagelink,
234
  'gallery',
260
  function prettify_pagelink($pagelink)
261
  {
262
  $param_separator = C_NextGen_Settings::get_instance()->get('router_param_separator');
263
+
264
  $regex = implode('', array(
265
  '#',
266
  '/(gallery|album)',
267
+ preg_quote($param_separator, '#'),
268
  '([^/?]+)',
269
  '#'
270
  ));
271
+
272
+ $pagelink = preg_replace($regex, '/\2', $pagelink);
273
+
274
+ return $pagelink;
275
  }
276
 
277
 
products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.ajax_pagination_actions.php CHANGED
@@ -13,6 +13,7 @@ class A_Ajax_Pagination_Actions extends Mixin
13
  $factory = $this->object->get_registry()->get_utility('I_Component_Factory');
14
  $displayed_gallery = $factory->create('displayed_gallery', $mapper);
15
  $displayed_gallery->apply_transient($id);
 
16
 
17
  // Prevent future "show slideshow" links from using the AJAX request URI
18
  if ($displayed_gallery->display_settings['ajax_pagination'])
13
  $factory = $this->object->get_registry()->get_utility('I_Component_Factory');
14
  $displayed_gallery = $factory->create('displayed_gallery', $mapper);
15
  $displayed_gallery->apply_transient($id);
16
+ $displayed_gallery->transient_id = $id;
17
 
18
  // Prevent future "show slideshow" links from using the AJAX request URI
19
  if ($displayed_gallery->display_settings['ajax_pagination'])
products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_gallery_mapper.php CHANGED
@@ -72,6 +72,7 @@ class Hook_NextGen_Basic_Gallery_Defaults extends Hook
72
  $this->object->_set_default_value($entity, 'settings', 'show_all_in_lightbox', $settings->galHiddenImg);
73
  $this->object->_set_default_value($entity, 'settings', 'ajax_pagination', $settings->galAjaxNav);
74
  $this->object->_set_default_value($entity, 'settings', 'template', '');
 
75
 
76
  // TODO: Should this be called enable pagination?
77
  $this->object->_set_default_value($entity, 'settings', 'disable_pagination', 0);
@@ -97,4 +98,4 @@ class Hook_NextGen_Basic_Gallery_Defaults extends Hook
97
  // Part of the pro-modules
98
  $this->object->_set_default_value($entity, 'settings', 'ngg_triggers_display', 'never');
99
  }
100
- }
72
  $this->object->_set_default_value($entity, 'settings', 'show_all_in_lightbox', $settings->galHiddenImg);
73
  $this->object->_set_default_value($entity, 'settings', 'ajax_pagination', $settings->galAjaxNav);
74
  $this->object->_set_default_value($entity, 'settings', 'template', '');
75
+ $this->object->_set_default_value($entity, 'settings', 'display_no_images_error', 1);
76
 
77
  // TODO: Should this be called enable pagination?
78
  $this->object->_set_default_value($entity, 'settings', 'disable_pagination', 0);
98
  // Part of the pro-modules
99
  $this->object->_set_default_value($entity, 'settings', 'ngg_triggers_display', 'never');
100
  }
101
+ }
products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_slideshow_controller.php CHANGED
@@ -12,6 +12,7 @@ class A_NextGen_Basic_Slideshow_Controller extends Mixin_NextGen_Basic_Gallery_C
12
  // Get the images to be displayed
13
  $current_page = (int)$this->param('page', 1);
14
 
 
15
  $limit = FALSE;
16
  if (in_array($displayed_gallery->source, array('random_images', 'recent_images')))
17
  $limit = $displayed_gallery->display_settings['images_per_page'];
12
  // Get the images to be displayed
13
  $current_page = (int)$this->param('page', 1);
14
 
15
+ // TODO: Shouldn't we be using maximum_entity_count instead?
16
  $limit = FALSE;
17
  if (in_array($displayed_gallery->source, array('random_images', 'recent_images')))
18
  $limit = $displayed_gallery->display_settings['images_per_page'];
products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_thumbnails_controller.php CHANGED
@@ -20,15 +20,20 @@ class A_NextGen_Basic_Thumbnails_Controller extends Mixin_NextGen_Basic_Gallery_
20
  {
21
  $display_settings = $displayed_gallery->display_settings;
22
 
23
- if(!$display_settings['disable_pagination'])
24
- $current_page = (int)$this->param('page', $displayed_gallery->id(), 1);
 
 
 
 
 
 
25
  else
26
  $current_page = 1;
27
 
28
  $offset = $display_settings['images_per_page'] * ($current_page - 1);
29
  $storage = $this->object->get_registry()->get_utility('I_Gallery_Storage');
30
  $total = $displayed_gallery->get_entity_count();
31
- $gallery_id = $displayed_gallery->id();
32
 
33
  // Get the images to be displayed
34
  if ($display_settings['images_per_page'] > 0 && $display_settings['show_all_in_lightbox'])
@@ -76,9 +81,6 @@ class A_NextGen_Basic_Thumbnails_Controller extends Mixin_NextGen_Basic_Gallery_
76
  list($pagination_prev, $pagination_next, $pagination) = array(NULL, NULL, NULL);
77
  }
78
 
79
- if ($display_settings['show_piclens_link'] || $display_settings['ajax_pagination'])
80
- $gallery_id = $displayed_gallery->transient_id;
81
-
82
  $thumbnail_size_name = 'thumbnail';
83
 
84
  if ($display_settings['override_thumbnail_settings'])
@@ -161,7 +163,7 @@ class A_NextGen_Basic_Thumbnails_Controller extends Mixin_NextGen_Basic_Gallery_
161
  return $this->object->render_view('photocrati-nextgen_basic_gallery#thumbnails/index', $params, $return);
162
  }
163
  }
164
- else {
165
  return $this->object->render_partial("photocrati-nextgen_gallery_display#no_images_found", array(), $return);
166
  }
167
  }
20
  {
21
  $display_settings = $displayed_gallery->display_settings;
22
 
23
+ // If these options are on we must use the transient_id to identify the gallery
24
+ if ($display_settings['show_piclens_link'] || $display_settings['ajax_pagination'])
25
+ $gallery_id = $displayed_gallery->transient_id;
26
+ else
27
+ $gallery_id = $displayed_gallery->id();
28
+
29
+ if (!$display_settings['disable_pagination'])
30
+ $current_page = (int)$this->param('page', $gallery_id, 1);
31
  else
32
  $current_page = 1;
33
 
34
  $offset = $display_settings['images_per_page'] * ($current_page - 1);
35
  $storage = $this->object->get_registry()->get_utility('I_Gallery_Storage');
36
  $total = $displayed_gallery->get_entity_count();
 
37
 
38
  // Get the images to be displayed
39
  if ($display_settings['images_per_page'] > 0 && $display_settings['show_all_in_lightbox'])
81
  list($pagination_prev, $pagination_next, $pagination) = array(NULL, NULL, NULL);
82
  }
83
 
 
 
 
84
  $thumbnail_size_name = 'thumbnail';
85
 
86
  if ($display_settings['override_thumbnail_settings'])
163
  return $this->object->render_view('photocrati-nextgen_basic_gallery#thumbnails/index', $params, $return);
164
  }
165
  }
166
+ else if ($display_settings['display_no_images_error']) {
167
  return $this->object->render_partial("photocrati-nextgen_gallery_display#no_images_found", array(), $return);
168
  }
169
  }
products/photocrati_nextgen/modules/nextgen_basic_gallery/module.nextgen_basic_gallery.php CHANGED
@@ -25,7 +25,7 @@ class M_NextGen_Basic_Gallery extends C_Base_Module
25
  'photocrati-nextgen_basic_gallery',
26
  'NextGEN Basic Gallery',
27
  "Provides NextGEN Gallery's basic thumbnail/slideshow integrated gallery",
28
- '0.3',
29
  'http://www.nextgen-gallery.com',
30
  'Photocrati Media',
31
  'http://www.photocrati.com'
25
  'photocrati-nextgen_basic_gallery',
26
  'NextGEN Basic Gallery',
27
  "Provides NextGEN Gallery's basic thumbnail/slideshow integrated gallery",
28
+ '0.4',
29
  'http://www.nextgen-gallery.com',
30
  'Photocrati Media',
31
  'http://www.photocrati.com'
products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/adapter.nextgen_basic_imagebrowser_controller.php CHANGED
@@ -98,7 +98,8 @@ class A_NextGen_Basic_ImageBrowser_Controller extends Mixin
98
  $picture_list_pos = $key + 1;
99
 
100
  // our image to display
101
- $picture = new C_Image_Wrapper($imap->find($numeric_pid), NULL, TRUE);
 
102
 
103
  // determine URI to the next & previous images
104
  $back_pid = ($key >= 1) ? $picture_array[$key - 1] : end($picture_array);
98
  $picture_list_pos = $key + 1;
99
 
100
  // our image to display
101
+ $picture = new C_Image_Wrapper($imap->find($numeric_pid), $displayed_gallery, TRUE);
102
+ $picture = apply_filters('ngg_image_object', $picture, $numeric_pid);
103
 
104
  // determine URI to the next & previous images
105
  $back_pid = ($key >= 1) ? $picture_array[$key - 1] : end($picture_array);
products/photocrati_nextgen/modules/nextgen_basic_templates/adapter.nextgen_basic_template_form.php CHANGED
@@ -133,14 +133,20 @@ class A_NextGen_Basic_Template_Form extends Mixin
133
 
134
  // create the 'gallery' object
135
  $gallery = new stdclass;
136
- $gallery->ID = $orig_gallery->$gallery_key;
137
  $gallery->show_slideshow = FALSE;
138
  $gallery->show_piclens = FALSE;
139
  $gallery->name = stripslashes($orig_gallery->name);
140
  $gallery->title = stripslashes($orig_gallery->title);
141
  $gallery->description = html_entity_decode(stripslashes($orig_gallery->galdesc));
142
  $gallery->pageid = $orig_gallery->pageid;
143
- $gallery->anchor = 'ngg-gallery-' . $orig_gallery->$gallery_key . '-' . $current_page;
 
 
 
 
 
 
144
  $gallery->displayed_gallery = &$displayed_gallery;
145
  $gallery->columns = @intval($displayed_gallery->display_settings['number_of_columns']);
146
  $gallery->imagewidth = ($gallery->columns > 0) ? 'style="width:' . floor(100 / $gallery->columns) . '%;"' : '';
133
 
134
  // create the 'gallery' object
135
  $gallery = new stdclass;
136
+ $gallery->ID = $displayed_gallery->id();
137
  $gallery->show_slideshow = FALSE;
138
  $gallery->show_piclens = FALSE;
139
  $gallery->name = stripslashes($orig_gallery->name);
140
  $gallery->title = stripslashes($orig_gallery->title);
141
  $gallery->description = html_entity_decode(stripslashes($orig_gallery->galdesc));
142
  $gallery->pageid = $orig_gallery->pageid;
143
+
144
+ if ($displayed_gallery->display_settings['ajax_pagination'])
145
+ $gallery_id = $displayed_gallery->transient_id;
146
+ else
147
+ $gallery_id = $displayed_gallery->id();
148
+
149
+ $gallery->anchor = 'ngg-gallery-' . $gallery_id . '-' . $current_page;
150
  $gallery->displayed_gallery = &$displayed_gallery;
151
  $gallery->columns = @intval($displayed_gallery->display_settings['number_of_columns']);
152
  $gallery->imagewidth = ($gallery->columns > 0) ? 'style="width:' . floor(100 / $gallery->columns) . '%;"' : '';
products/photocrati_nextgen/modules/nextgen_data/class.image_mapper.php CHANGED
@@ -58,12 +58,23 @@ class Mixin_Gallery_Image_Mapper extends Mixin
58
 
59
  function _save_entity($entity)
60
  {
 
 
 
 
 
61
  // If successfully saved, then import metadata and
62
  $retval = $this->call_parent('_save_entity', $entity);
63
  if ($retval) {
64
  include_once(NGGALLERY_ABSPATH.'/admin/functions.php');
65
- $image_id = $this->get_id($entity);;
66
- nggAdmin::import_MetaData($image_id);
 
 
 
 
 
 
67
  C_Photocrati_Cache::flush();
68
  }
69
  return $retval;
58
 
59
  function _save_entity($entity)
60
  {
61
+ $exists = false;
62
+ $primary_key = $this->object->get_primary_key_column();
63
+ if (isset($entity->$primary_key)) {
64
+ $exists = true;
65
+ }
66
  // If successfully saved, then import metadata and
67
  $retval = $this->call_parent('_save_entity', $entity);
68
  if ($retval) {
69
  include_once(NGGALLERY_ABSPATH.'/admin/functions.php');
70
+ $image_id = $this->get_id($entity);
71
+
72
+ if ($exists) {
73
+ // do nothing...
74
+ }
75
+ else {
76
+ nggAdmin::import_MetaData($image_id);
77
+ }
78
  C_Photocrati_Cache::flush();
79
  }
80
  return $retval;
products/photocrati_nextgen/modules/nextgen_data/class.image_wrapper.php CHANGED
@@ -13,6 +13,7 @@ class C_Image_Wrapper
13
  public $_orig_image_id; // original image ID
14
  public $_cache_overrides; // allow for forcing variable values
15
  public $_legacy = FALSE;
 
16
 
17
  /**
18
  * Constructor. Converts the image class into an array and fills from defaults any missing values
@@ -86,6 +87,7 @@ class C_Image_Wrapper
86
  $this->_cache = (array) apply_filters('ngg_image_object', (object) $image, $image[$id_field]);
87
  $this->_orig_image_id = $image[$id_field];
88
  $this->_legacy = $legacy;
 
89
  }
90
 
91
  public function __set($name, $value)
@@ -401,27 +403,8 @@ class C_Image_Wrapper
401
  */
402
  function get_thumbcode($gallery_name = '')
403
  {
404
- $settings = $this->get_settings();
405
-
406
- // clean up the name
407
- $gallery_name = sanitize_title($gallery_name);
408
-
409
- // get the effect code
410
- if ('none' != $settings->get('thumbEffect'))
411
- {
412
- $this->_cache['thumbcode'] = stripslashes($settings->get('thumbCode'));
413
- }
414
-
415
- // for highslide to a different approach
416
- if ('highslide' == $settings->get('thumbEffect'))
417
- {
418
- $this->_cache['thumbcode'] = str_replace('%GALLERY_NAME%', "'{$gallery_name}'", $this->_cache['thumbcode']);
419
- }
420
- else {
421
- $this->_cache['thumbcode'] = str_replace('%GALLERY_NAME%', $gallery_name, $this->_cache['thumbcode']);
422
- }
423
-
424
- return apply_filters('ngg_get_thumbcode', $this->_cache['thumbcode'], $this);
425
  }
426
 
427
  /**
13
  public $_orig_image_id; // original image ID
14
  public $_cache_overrides; // allow for forcing variable values
15
  public $_legacy = FALSE;
16
+ public $_displayed_gallery; // cached object
17
 
18
  /**
19
  * Constructor. Converts the image class into an array and fills from defaults any missing values
87
  $this->_cache = (array) apply_filters('ngg_image_object', (object) $image, $image[$id_field]);
88
  $this->_orig_image_id = $image[$id_field];
89
  $this->_legacy = $legacy;
90
+ $this->_displayed_gallery = $displayed_gallery;
91
  }
92
 
93
  public function __set($name, $value)
403
  */
404
  function get_thumbcode($gallery_name = '')
405
  {
406
+ $controller = C_Component_Registry::get_instance()->get_utility('I_Display_Type_Controller');
407
+ return $controller->get_effect_code($this->_displayed_gallery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
408
  }
409
 
410
  /**
products/photocrati_nextgen/modules/nextgen_data/class.nextgen_data_installer.php CHANGED
@@ -10,6 +10,7 @@ class C_NextGen_Data_Installer
10
  function uninstall($hard = FALSE)
11
  {
12
  if ($hard) {
 
13
  // TODO for now never delete galleries/albums/content
14
  # $mappers = array(
15
  # $this->get_registry()->get_utility('I_Album_Mapper'),
@@ -25,6 +26,7 @@ class C_NextGen_Data_Installer
25
  # global $wpdb;
26
  # $wpdb->query("DELETE FROM {$wpdb->terms} WHERE term_id IN (SELECT term_id FROM {$wpdb->term_taxonomy} WHERE taxonomy='ngg_tag')");
27
  # $wpdb->query("DELETE FROM {$wpdb->term_taxonomy} WHERE taxonomy='ngg_tag'");
 
28
  }
29
  }
30
  }
10
  function uninstall($hard = FALSE)
11
  {
12
  if ($hard) {
13
+ /* Yes: this is commented twice.
14
  // TODO for now never delete galleries/albums/content
15
  # $mappers = array(
16
  # $this->get_registry()->get_utility('I_Album_Mapper'),
26
  # global $wpdb;
27
  # $wpdb->query("DELETE FROM {$wpdb->terms} WHERE term_id IN (SELECT term_id FROM {$wpdb->term_taxonomy} WHERE taxonomy='ngg_tag')");
28
  # $wpdb->query("DELETE FROM {$wpdb->term_taxonomy} WHERE taxonomy='ngg_tag'");
29
+ */
30
  }
31
  }
32
  }
products/photocrati_nextgen/modules/nextgen_gallery_display/class.display_type_controller.php CHANGED
@@ -75,7 +75,7 @@ class Mixin_Display_Type_Controller extends Mixin
75
  $this->object->_add_script_data(
76
  'ngg_common',
77
  'nextgen_lightbox_settings',
78
- array('static_path' => $this->object->get_static_relpath('', 'lightbox')),
79
  TRUE,
80
  FALSE
81
  );
75
  $this->object->_add_script_data(
76
  'ngg_common',
77
  'nextgen_lightbox_settings',
78
+ array('static_path' => $this->object->get_static_relpath('', 'photocrati-lightbox')),
79
  TRUE,
80
  FALSE
81
  );
products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery.php CHANGED
@@ -281,9 +281,7 @@ class Mixin_Displayed_Gallery_Queries extends Mixin
281
  // Container ids are tags
282
  if ($source_obj->name == 'tags') {
283
  $term_ids = $this->object->get_term_ids_for_tags($this->object->container_ids);
284
- if ($term_ids) {
285
- $mapper->where(array("{$image_key} IN %s",get_objects_in_term($term_ids, 'ngg_tag')));
286
- }
287
  }
288
 
289
  // Container ids are gallery ids
@@ -292,6 +290,23 @@ class Mixin_Displayed_Gallery_Queries extends Mixin
292
  }
293
  }
294
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
  // Adjust the query more based on what source was selected
296
  if ($this->object->source == 'recent_images') {
297
  $sort_direction = 'DESC';
@@ -565,7 +580,7 @@ class Mixin_Displayed_Gallery_Queries extends Mixin
565
  unset($counts[$id]);
566
  }
567
  }
568
-
569
  $retval[] = $gallery;
570
  }
571
  }
@@ -875,7 +890,9 @@ class Mixin_Displayed_Gallery_Instance_Methods extends Mixin
875
 
876
  $group = 'displayed_galleries';
877
  $key = C_Photocrati_Cache::generate_key($this->object->get_entity(), $group);
878
- C_Photocrati_Cache::set($key, $this->object->get_entity(), $group);
 
 
879
 
880
  return $key;
881
  }
281
  // Container ids are tags
282
  if ($source_obj->name == 'tags') {
283
  $term_ids = $this->object->get_term_ids_for_tags($this->object->container_ids);
284
+ $mapper->where(array("{$image_key} IN %s",get_objects_in_term($term_ids, 'ngg_tag')));
 
 
285
  }
286
 
287
  // Container ids are gallery ids
290
  }
291
  }
292
 
293
+ // Filter based on excluded container ids
294
+ if ($this->object->excluded_container_ids) {
295
+
296
+ // Container ids are tags
297
+ if ($source_obj->name == 'tags') {
298
+ $term_ids = $this->object->get_term_ids_for_tags($this->object->excluded_container_ids);
299
+ if ($term_ids) {
300
+ $mapper->where(array("{$image_key} NOT IN %s",get_objects_in_term($term_ids, 'ngg_tag')));
301
+ }
302
+ }
303
+
304
+ // Container ids are gallery ids
305
+ else {
306
+ $mapper->where(array("galleryid NOT IN %s", $this->object->excluded_container_ids));
307
+ }
308
+ }
309
+
310
  // Adjust the query more based on what source was selected
311
  if ($this->object->source == 'recent_images') {
312
  $sort_direction = 'DESC';
580
  unset($counts[$id]);
581
  }
582
  }
583
+
584
  $retval[] = $gallery;
585
  }
586
  }
890
 
891
  $group = 'displayed_galleries';
892
  $key = C_Photocrati_Cache::generate_key($this->object->get_entity(), $group);
893
+ if (is_null(C_Photocrati_Cache::get($key, NULL, $group))) {
894
+ C_Photocrati_Cache::set($key, $this->object->get_entity(), $group, 1800);
895
+ }
896
 
897
  return $key;
898
  }
products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery_mapper.php CHANGED
@@ -90,6 +90,7 @@ class Mixin_Displayed_Gallery_Defaults extends Mixin
90
 
91
  // Ensure other properties exist
92
  $this->object->_set_default_value($entity, 'container_ids', array());
 
93
  $this->object->_seT_default_value($entity, 'sortorder', array());
94
  $this->object->_set_default_value($entity, 'entity_ids', array());
95
  $this->object->_set_default_value($entity, 'returns', 'included');
90
 
91
  // Ensure other properties exist
92
  $this->object->_set_default_value($entity, 'container_ids', array());
93
+ $this->object->_set_default_value($entity, 'excluded_container_ids', array());
94
  $this->object->_seT_default_value($entity, 'sortorder', array());
95
  $this->object->_set_default_value($entity, 'entity_ids', array());
96
  $this->object->_set_default_value($entity, 'returns', 'included');
products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery_renderer.php CHANGED
@@ -221,9 +221,11 @@ class Mixin_Displayed_Gallery_Renderer extends Mixin
221
  {
222
  $mode = 'normal';
223
  }
224
-
225
- // Save the displayed gallery as a transient
226
- $displayed_gallery->transient_id = $displayed_gallery->to_transient();
 
 
227
 
228
  // Get the display type controller
229
  $controller = $this->get_registry()->get_utility(
221
  {
222
  $mode = 'normal';
223
  }
224
+
225
+ // Save the displayed gallery as a transient if it hasn't already. Allows for ajax operations
226
+ // to add or modify the gallery without losing a retrievable ID
227
+ if (empty($displayed_gallery->transient_id))
228
+ $displayed_gallery->transient_id = $displayed_gallery->to_transient();
229
 
230
  // Get the display type controller
231
  $controller = $this->get_registry()->get_utility(
products/photocrati_nextgen/modules/nextgen_gallery_display/module.nextgen_gallery_display.php CHANGED
@@ -149,7 +149,8 @@ class M_Gallery_Display extends C_Base_Module
149
  'template' => $view->get_template_abspath('photocrati-nextgen_gallery_display#related'),
150
  'show_all_in_lightbox' => FALSE,
151
  'show_slideshow_link' => FALSE,
152
- 'disable_pagination' => TRUE
 
153
  ));
154
 
155
  return apply_filters('ngg_show_related_gallery_content', $retval, $taglist);
@@ -157,8 +158,15 @@ class M_Gallery_Display extends C_Base_Module
157
 
158
  function _render_related_images($content)
159
  {
160
- if (C_NextGen_Settings::get_instance()->get('activateTags')) {
161
- $content .= $this->_render_related_string();
 
 
 
 
 
 
 
162
  }
163
 
164
  return $content;
149
  'template' => $view->get_template_abspath('photocrati-nextgen_gallery_display#related'),
150
  'show_all_in_lightbox' => FALSE,
151
  'show_slideshow_link' => FALSE,
152
+ 'disable_pagination' => TRUE,
153
+ 'display_no_images_error' => FALSE
154
  ));
155
 
156
  return apply_filters('ngg_show_related_gallery_content', $retval, $taglist);
158
 
159
  function _render_related_images($content)
160
  {
161
+ $settings = C_NextGen_Settings::get_instance();
162
+
163
+ if ($settings->get('activateTags')) {
164
+ $related = $this->_render_related_string();
165
+
166
+ if ($related != null) {
167
+ $heading = $settings->relatedHeading;
168
+ $content .= $heading . $related;
169
+ }
170
  }
171
 
172
  return $content;
products/photocrati_nextgen/modules/nextgen_other_options/adapter.image_options_form.php CHANGED
@@ -90,7 +90,7 @@ class A_Image_Options_Form extends Mixin
90
  'delete_image_files_help' => _('When enabled, image files will be removed after a Gallery has been deleted'),
91
  'delete_image_files' => $settings->deleteImg,
92
  'show_related_images_label' => _('Show Related Images on Posts?'),
93
- 'show_related_images_help' => _('When enabled, related images will be appended to each post'),
94
  'show_related_images' => $settings->activateTags,
95
  'related_images_hidden_label' => _('(Show Customization Settings)'),
96
  'related_images_active_label' => _('(Hide Customization Settings)'),
@@ -99,6 +99,8 @@ class A_Image_Options_Form extends Mixin
99
  'match_related_image_options' => $this->object->_get_related_image_match_options(),
100
  'max_related_images_label' => _('Maximum # of related images to display'),
101
  'max_related_images' => $settings->maxImages,
 
 
102
  'sorting_order_label' => _("What's the default sorting method?"),
103
  'sorting_order_options' => $this->object->_get_image_sorting_options(),
104
  'sorting_order' => $settings->galSort,
90
  'delete_image_files_help' => _('When enabled, image files will be removed after a Gallery has been deleted'),
91
  'delete_image_files' => $settings->deleteImg,
92
  'show_related_images_label' => _('Show Related Images on Posts?'),
93
+ 'show_related_images_help' => _('When enabled, related images will be appended to each post by matching the posts tags/categories to image tags'),
94
  'show_related_images' => $settings->activateTags,
95
  'related_images_hidden_label' => _('(Show Customization Settings)'),
96
  'related_images_active_label' => _('(Hide Customization Settings)'),
99
  'match_related_image_options' => $this->object->_get_related_image_match_options(),
100
  'max_related_images_label' => _('Maximum # of related images to display'),
101
  'max_related_images' => $settings->maxImages,
102
+ 'related_images_heading_label' => _('Heading for related images'),
103
+ 'related_images_heading' => $settings->relatedHeading,
104
  'sorting_order_label' => _("What's the default sorting method?"),
105
  'sorting_order_options' => $this->object->_get_image_sorting_options(),
106
  'sorting_order' => $settings->galSort,
products/photocrati_nextgen/modules/nextgen_other_options/adapter.other_options_forms.php CHANGED
@@ -9,19 +9,22 @@ class A_Other_Options_Forms extends Mixin
9
  'thumbnail_options' => 'A_Thumbnail_Options_Form',
10
  'lightbox_effects' => 'A_Lightbox_Manager_Form',
11
  'watermarks' => 'A_Watermarks_Form'
12
- );
13
 
14
- if (!is_multisite() || (is_multisite() && C_NextGen_Settings::get_instance()->get('wpmuStyle')))
15
  $forms['styles'] = 'A_Styles_Form';
16
 
17
- if (is_super_admin() && (!is_multisite() || (is_multisite() && C_NextGen_Settings::get_instance()->get('wpmuRoles'))))
18
- $forms['roles_and_capabilities'] = 'A_Roles_Form';
19
-
20
- $forms += array(
21
- 'miscellaneous' => 'A_Miscellaneous_Form'
22
- // NOTE & TODO: the following line must do some authentication to prevent sub-sites admins
23
- // from affecting others on the network
24
- // 'reset_and_uninstall' => 'A_Reset_Form'
 
 
 
25
  );
26
 
27
  $registry = $this->object->get_registry();
9
  'thumbnail_options' => 'A_Thumbnail_Options_Form',
10
  'lightbox_effects' => 'A_Lightbox_Manager_Form',
11
  'watermarks' => 'A_Watermarks_Form'
12
+ );
13
 
14
+ if (!is_multisite() || (is_multisite() && C_NextGen_Settings::get_instance()->get('wpmuStyle')))
15
  $forms['styles'] = 'A_Styles_Form';
16
 
17
+ if (is_super_admin() && (!is_multisite() || (is_multisite() && C_NextGen_Settings::get_instance()->get('wpmuRoles'))))
18
+ $forms['roles_and_capabilities'] = 'A_Roles_Form';
19
+
20
+ $forms += array(
21
+ 'image_options' => 'A_Image_Options_Form',
22
+ 'thumbnail_options' => 'A_Thumbnail_Options_Form',
23
+ 'lightbox_effects' => 'A_Lightbox_Manager_Form',
24
+ 'watermarks' => 'A_Watermarks_Form',
25
+ 'styles' => 'A_Styles_Form',
26
+ 'roles_and_capabilities'=> 'A_Roles_Form',
27
+ 'miscellaneous' => 'A_Miscellaneous_Form'
28
  );
29
 
30
  $registry = $this->object->get_registry();
products/photocrati_nextgen/modules/nextgen_other_options/adapter.reset_form.php CHANGED
@@ -4,7 +4,7 @@ class A_Reset_Form extends Mixin
4
  {
5
  function get_title()
6
  {
7
- return 'Reset & Uninstall';
8
  }
9
 
10
  function render()
@@ -15,9 +15,9 @@ class A_Reset_Form extends Mixin
15
  'reset_value' => _('Reset all options to default settings'),
16
  'reset_warning' => _('Replace all existing options and gallery options with their default settings'),
17
  'reset_label' => _('Reset settings'),
18
- 'reset_confirmation' => _("Reset all options to default settings?\n\nChoose [Cancel] to Stop, [OK] to proceed."),
19
- 'uninstall_label' => _('Deactivate & Uninstall'),
20
- 'uninstall_confirmation'=>_("Completely uninstall NextGEN Gallery (will reset settings and de-activate)?\n\nChoose [Cancel] to Stop, [OK] to proceed."),
21
  ),
22
  TRUE
23
  );
@@ -25,12 +25,29 @@ class A_Reset_Form extends Mixin
25
 
26
  function reset_action()
27
  {
 
 
28
  $installer = C_Photocrati_Installer::get_instance();
29
- // TODO right now we pass $hard = TRUE because many modules only delete settings in that specific case
30
- $installer->uninstall(NEXTGEN_GALLERY_PLUGIN_BASENAME, TRUE);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  $installer->update(TRUE);
32
  }
33
 
 
34
  function uninstall_action()
35
  {
36
  $installer = C_Photocrati_Installer::get_instance();
@@ -38,4 +55,5 @@ class A_Reset_Form extends Mixin
38
  deactivate_plugins(NEXTGEN_GALLERY_PLUGIN_BASENAME);
39
  wp_redirect(admin_url('/plugins.php'));
40
  }
 
41
  }
4
  {
5
  function get_title()
6
  {
7
+ return 'Reset Options';
8
  }
9
 
10
  function render()
15
  'reset_value' => _('Reset all options to default settings'),
16
  'reset_warning' => _('Replace all existing options and gallery options with their default settings'),
17
  'reset_label' => _('Reset settings'),
18
+ 'reset_confirmation' => _("Reset all options to default settings?\n\nChoose [Cancel] to Stop, [OK] to proceed.")
19
+ // 'uninstall_label' => _('Deactivate & Uninstall'),
20
+ // 'uninstall_confirmation'=>_("Completely uninstall NextGEN Gallery (will reset settings and de-activate)?\n\nChoose [Cancel] to Stop, [OK] to proceed."),
21
  ),
22
  TRUE
23
  );
25
 
26
  function reset_action()
27
  {
28
+ global $wpdb;
29
+
30
  $installer = C_Photocrati_Installer::get_instance();
31
+ $settings = C_NextGen_Settings::get_instance();
32
+
33
+ // removes lightbox, display type, and source settings
34
+ $installer->uninstall(NEXTGEN_GALLERY_PLUGIN_BASENAME);
35
+
36
+ // removes ngg_options entry in wp_options
37
+ $settings->destroy();
38
+ $settings->save();
39
+
40
+ // TODO: remove this sometime after 2.0.21
41
+ //
42
+ // Some installations of NextGen that upgraded from 1.9x to 2.0x have duplicate display types installed,
43
+ // so for now (as of 2.0.21) we explicitly remove all display types from the db as a way of fixing this
44
+ $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->posts} WHERE post_type = %s", 'display_type'));
45
+
46
+ // trigger the install routine
47
  $installer->update(TRUE);
48
  }
49
 
50
+ /*
51
  function uninstall_action()
52
  {
53
  $installer = C_Photocrati_Installer::get_instance();
55
  deactivate_plugins(NEXTGEN_GALLERY_PLUGIN_BASENAME);
56
  wp_redirect(admin_url('/plugins.php'));
57
  }
58
+ */
59
  }
products/photocrati_nextgen/modules/nextgen_other_options/templates/image_options_tab.php CHANGED
@@ -212,34 +212,47 @@
212
  ><?php echo_h($related_images_hidden_label) ?></a>
213
  </td>
214
  </tr>
215
- <tr id="related_images_advanced_form" class="hidden">
216
- <td>
217
- <label for="match_related_images">
218
- <?php echo_h($match_related_images_label) ?>
219
- </label>
220
- </td>
221
- <td>
222
- <select id="match_related_images" name="image_options[appendType]">
223
- <?php foreach ($match_related_image_options as $label => $value): ?>
224
- <option
225
- value="<?php echo esc_attr($value)?>"
226
- <?php selected($value, $match_related_images)?>
227
- >
228
- <?php echo_h($label) ?>
229
- </option>
230
- <?php endforeach ?>
231
- </select>
232
- </td>
233
- <td class="column3">
234
- <label for="max_related_images">
235
- <?php echo_h($max_related_images_label)?>
236
- </label>
237
- <input
238
- id="max_related_images"
239
- type="text"
240
- name="image_options[maxImages]"
241
- value="<?php echo esc_attr($max_related_images)?>"
242
- />
243
- </td>
244
- </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
245
  </table>
212
  ><?php echo_h($related_images_hidden_label) ?></a>
213
  </td>
214
  </tr>
215
+ <tbody id="related_images_advanced_form" class="hidden">
216
+ <tr>
217
+ <td>
218
+ <label for="match_related_images">
219
+ <?php echo_h($match_related_images_label) ?>
220
+ </label>
221
+ </td>
222
+ <td>
223
+ <select id="match_related_images" name="image_options[appendType]">
224
+ <?php foreach ($match_related_image_options as $label => $value): ?>
225
+ <option
226
+ value="<?php echo esc_attr($value)?>"
227
+ <?php selected($value, $match_related_images)?>
228
+ >
229
+ <?php echo_h($label) ?>
230
+ </option>
231
+ <?php endforeach ?>
232
+ </select>
233
+ </td>
234
+ <td class="column3">
235
+ <label for="max_related_images">
236
+ <?php echo_h($max_related_images_label)?>
237
+ </label>
238
+ <input
239
+ id="max_related_images"
240
+ type="text"
241
+ name="image_options[maxImages]"
242
+ value="<?php echo esc_attr($max_related_images)?>"
243
+ />
244
+ </td>
245
+ </tr>
246
+ <tr>
247
+ <td>
248
+ <label for="related_images_heading">
249
+ <?php echo_h($related_images_heading_label) ?>
250
+ </label>
251
+ </td>
252
+ <td>
253
+ <input id="related_images_heading" type="text" name="image_options[relatedHeading]"
254
+ value="<?php echo esc_attr($related_images_heading)?>"/>
255
+ </td>
256
+ </tr>
257
+ </tbody>
258
  </table>
products/photocrati_nextgen/modules/nextgen_other_options/templates/reset_tab.php CHANGED
@@ -15,6 +15,7 @@
15
  />
16
  </td>
17
  </tr>
 
18
  <tr>
19
  <td class='column1'>
20
  <?php echo $uninstall_label; ?>
@@ -29,4 +30,5 @@
29
  />
30
  </td>
31
  </tr>
 
32
  </table>
15
  />
16
  </td>
17
  </tr>
18
+ <?php /*
19
  <tr>
20
  <td class='column1'>
21
  <?php echo $uninstall_label; ?>
30
  />
31
  </td>
32
  </tr>
33
+ */ ?>
34
  </table>
products/photocrati_nextgen/modules/nextgen_settings/class.nextgen_settings_installer.php CHANGED
@@ -8,18 +8,19 @@ class C_NextGen_Settings_Installer
8
  function __construct()
9
  {
10
  $this->blog_settings = C_NextGen_Settings::get_instance();
11
- $this->site_settings = C_NextGen_Global_Settings::get_instance();
12
 
13
  $this->_global_settings = array(
14
  'gallerypath' => 'wp-content/blogs.dir/%BLOG_ID%/files/',
15
  'wpmuCSSfile' => 'nggallery.css',
16
  'wpmuStyle' => FALSE,
17
- 'wpmuRoles' => FALSE,
18
- 'wpmuImportFolder' => FALSE,
19
- 'wpmuZipUpload' => FALSE,
20
  'datamapper_driver' => 'custom_table_datamapper',
21
  'gallerystorage_driver' => 'ngglegacy_gallery_storage',
22
- 'maximum_entity_count' => 500
 
23
  );
24
 
25
  $this->_local_settings = array(
@@ -37,6 +38,7 @@ class C_NextGen_Settings_Installer
37
  'activateTags' => 0, // append related images
38
  'appendType' => 'tags', // look for category or tags
39
  'maxImages' => 7, // number of images toshow
 
40
 
41
  // Thumbnail Settings
42
  'thumbwidth' => 120, // Thumb Width
@@ -125,22 +127,22 @@ class C_NextGen_Settings_Installer
125
  $this->blog_settings->set_default_value($key, $value);
126
  }
127
 
128
- if (is_multisite())
129
- {
130
- // If this is already network activated we just need to use the existing setting
131
- // Note: attempting to use C_NextGen_Global_Settings here may result in an infinite loop,
132
- // so get_site_option() is used to check
133
- if ($options = get_site_option('ngg_options'))
134
- $gallerypath = $options['gallerypath'];
135
- else
136
- $gallerypath = $this->_global_settings['gallerypath'];
137
-
138
- $gallerypath = $this->gallerypath_replace($gallerypath);
139
-
140
- // a gallerypath setting has already been set, so we explicitly set a default AND set a new value
141
- $this->blog_settings->set_default_value('gallerypath', $gallerypath);
142
- $this->blog_settings->set('gallerypath', $gallerypath);
143
- }
144
  }
145
 
146
  function install($reset=FALSE)
@@ -149,20 +151,20 @@ class C_NextGen_Settings_Installer
149
  $this->install_local_settings($reset);
150
  }
151
 
152
- function get_global_defaults()
153
- {
154
- return $this->_global_settings;
155
- }
156
-
157
- function get_local_defaults()
158
- {
159
- return $this->_local_settings;
160
- }
161
-
162
- function gallerypath_replace($gallerypath)
163
- {
164
- $gallerypath = str_replace('%BLOG_NAME%', get_bloginfo('name'), $gallerypath);
165
- $gallerypath = str_replace('%BLOG_ID%', get_current_blog_id(), $gallerypath);
166
- return $gallerypath;
167
- }
168
  }
8
  function __construct()
9
  {
10
  $this->blog_settings = C_NextGen_Settings::get_instance();
11
+ $this->site_settings = C_NextGen_Global_Settings::get_instance();
12
 
13
  $this->_global_settings = array(
14
  'gallerypath' => 'wp-content/blogs.dir/%BLOG_ID%/files/',
15
  'wpmuCSSfile' => 'nggallery.css',
16
  'wpmuStyle' => FALSE,
17
+ 'wpmuRoles' => FALSE,
18
+ 'wpmuImportFolder' => FALSE,
19
+ 'wpmuZipUpload' => FALSE,
20
  'datamapper_driver' => 'custom_table_datamapper',
21
  'gallerystorage_driver' => 'ngglegacy_gallery_storage',
22
+ 'maximum_entity_count' => 500,
23
+ 'router_param_slug' => 'nggallery'
24
  );
25
 
26
  $this->_local_settings = array(
38
  'activateTags' => 0, // append related images
39
  'appendType' => 'tags', // look for category or tags
40
  'maxImages' => 7, // number of images toshow
41
+ 'relatedHeading' => __('<h3>Related Images:</h3>', 'nggallery'), // subheading for related images
42
 
43
  // Thumbnail Settings
44
  'thumbwidth' => 120, // Thumb Width
127
  $this->blog_settings->set_default_value($key, $value);
128
  }
129
 
130
+ if (is_multisite())
131
+ {
132
+ // If this is already network activated we just need to use the existing setting
133
+ // Note: attempting to use C_NextGen_Global_Settings here may result in an infinite loop,
134
+ // so get_site_option() is used to check
135
+ if ($options = get_site_option('ngg_options'))
136
+ $gallerypath = $options['gallerypath'];
137
+ else
138
+ $gallerypath = $this->_global_settings['gallerypath'];
139
+
140
+ $gallerypath = $this->gallerypath_replace($gallerypath);
141
+
142
+ // a gallerypath setting has already been set, so we explicitly set a default AND set a new value
143
+ $this->blog_settings->set_default_value('gallerypath', $gallerypath);
144
+ $this->blog_settings->set('gallerypath', $gallerypath);
145
+ }
146
  }
147
 
148
  function install($reset=FALSE)
151
  $this->install_local_settings($reset);
152
  }
153
 
154
+ function get_global_defaults()
155
+ {
156
+ return $this->_global_settings;
157
+ }
158
+
159
+ function get_local_defaults()
160
+ {
161
+ return $this->_local_settings;
162
+ }
163
+
164
+ function gallerypath_replace($gallerypath)
165
+ {
166
+ $gallerypath = str_replace('%BLOG_NAME%', get_bloginfo('name'), $gallerypath);
167
+ $gallerypath = str_replace('%BLOG_ID%', get_current_blog_id(), $gallerypath);
168
+ return $gallerypath;
169
+ }
170
  }
products/photocrati_nextgen/modules/ngglegacy/nggallery.php CHANGED
@@ -119,6 +119,8 @@ if (!class_exists('nggLoader')) {
119
  case 'image':
120
  require_once (dirname (__FILE__) . '/nggshow.php');
121
  break;
 
 
122
  }
123
  C_NextGEN_Bootstrap::shutdown();
124
  }
119
  case 'image':
120
  require_once (dirname (__FILE__) . '/nggshow.php');
121
  break;
122
+ default:
123
+ return;
124
  }
125
  C_NextGEN_Bootstrap::shutdown();
126
  }
products/photocrati_nextgen/modules/router/class.routing_app.php CHANGED
@@ -50,11 +50,11 @@ class Mixin_Routing_App extends Mixin
50
  );
51
 
52
  // We treat wildcards much differently then normal rewrites
53
- if (preg_match("/\{[\.\\\*]/", $src)) {
54
  $pattern = str_replace('{*}', '(.*?)', $src);
55
  $pattern = str_replace('{.*}', '(.*?)', $pattern);
56
- $pattern = str_replace('{\w}', '([\w-_]*)', $pattern);
57
- $pattern = str_replace('{\d}', '(\d*)', $pattern);
58
  $src = '#'.(strpos($src, '/') === 0 ? '^':'').$pattern.'/?$#';
59
  $definition['wildcards'] = TRUE;
60
  }
50
  );
51
 
52
  // We treat wildcards much differently then normal rewrites
53
+ if (preg_match("/\\{[\.\\\*]/", $src)) {
54
  $pattern = str_replace('{*}', '(.*?)', $src);
55
  $pattern = str_replace('{.*}', '(.*?)', $pattern);
56
+ $pattern = str_replace('{\\w}', '([\\w-_]*)', $pattern);
57
+ $pattern = str_replace('{\\d}', '(\\d*)', $pattern);
58
  $src = '#'.(strpos($src, '/') === 0 ? '^':'').$pattern.'/?$#';
59
  $definition['wildcards'] = TRUE;
60
  }
products/photocrati_nextgen/product.photocrati_nextgen.php CHANGED
@@ -52,7 +52,7 @@ class P_Photocrati_NextGen extends C_Base_Product
52
  'photocrati-nextgen',
53
  'Photocrati NextGen',
54
  'Photocrati NextGen',
55
- '2.0.25',
56
  'http://www.nextgen-gallery.com',
57
  'Photocrati Media',
58
  'http://www.photocrati.com'
52
  'photocrati-nextgen',
53
  'Photocrati NextGen',
54
  'Photocrati NextGen',
55
+ '2.0.27',
56
  'http://www.nextgen-gallery.com',
57
  'Photocrati Media',
58
  'http://www.photocrati.com'
readme.txt CHANGED
@@ -195,9 +195,27 @@ For more information, feel free to visit the official website for the NextGEN Ga
195
 
196
  == Changelog ==
197
 
 
 
 
198
  = V2.0.25 - 09.18.2013 =
199
  * Reverting to the 2.0.21 codebase, due to major performance issues in 2.0.23 and 2.0.24
200
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
  = V2.0.21 - 09.09.2013 =
202
  * NEW: Multisite support
203
  * Changed: Default image quality set to 100 for generated images
195
 
196
  == Changelog ==
197
 
198
+ = V2.0.27 - 09.18.2013 =
199
+ * Fixed: Reduce performance impact of purging displayed gallery transients
200
+
201
  = V2.0.25 - 09.18.2013 =
202
  * Reverting to the 2.0.21 codebase, due to major performance issues in 2.0.23 and 2.0.24
203
 
204
+ = V2.0.23 - 09.16.2013 =
205
+ * NEW: WP-Cron job to periodically clean-up displayed gallery transients
206
+ * NEW: Added "excluded_container_ids" as parameter for ngg_images shortcode
207
+ * Fixed: Lightbox effect is honoured by all display types
208
+ * Fixed: Highslide displays images from the correct displayed galleries
209
+ * Fixed: Ensure that sub-albums display correctly when the word "album" is part of a slug
210
+ * Fixed: Ensure that sub-albums display correctly when numerical slugs are used
211
+ * Fixed: Related images heading only added when Related Images functionality is enabled
212
+ * Fixed: PHP Warning about undefined index when viewing basic albums
213
+ * Fixed: AJAX handling is third-party compatible
214
+ * Fixed: Image date is no longer overwritten when an image is modified
215
+ * Fixed: Fixed issue with displayed galleries using source='tags'
216
+ * Fixed: Problem with transient cache not getting flushed properly from Other Options page
217
+ * Fixed: Use correct gallery/transient ID when ajax pagination is used
218
+
219
  = V2.0.21 - 09.09.2013 =
220
  * NEW: Multisite support
221
  * Changed: Default image quality set to 100 for generated images