NextGEN Gallery – WordPress Gallery Plugin - Version 2.1.57

Version Description

  • 11.14.2016 =
  • Changed: Display type icons are now clickable in the Insert Gallery Window
  • Changed: Include backup image files when coping/moving a gallery
  • Changed: Show gallery name in upload notification
  • Changed: Added placeholder text to gallery name field on Add Gallery / Upload Images page
  • Fixed: Custom sortorder not preserved in shortcode
  • Fixed: Shortcodes added via Insert Gallery Window displayed as []
  • Fixed: Uncaught TypeError: Cannot read property 'replace' of undefined
  • Fixed: Use of deprecated Yoast SEO (aka WPSEO) filter
  • Fixed: Conflict with Easy Digital Downloads
  • Fixed: Misc invalid HTML tags in admin pages (thanks to kniebremser)
  • Fixed: Change display:hidden to visibility:hidden in various places
  • Fixed: Escaping of quotes in gallery titles and urls
  • Fixed: Untranslatable strings
Download this release

Release Info

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

Code changes from version 2.1.56 to 2.1.57

Files changed (31) hide show
  1. changelog.txt +15 -0
  2. nggallery.php +2 -2
  3. products/photocrati_nextgen/modules/attach_to_post/module.attach_to_post.php +10 -4
  4. products/photocrati_nextgen/modules/attach_to_post/static/display_tab.js +4 -4
  5. products/photocrati_nextgen/modules/attach_to_post/static/display_tab.min.js +1 -1
  6. products/photocrati_nextgen/modules/attach_to_post/static/igw.js +0 -13
  7. products/photocrati_nextgen/modules/attach_to_post/static/igw.min.js +1 -1
  8. products/photocrati_nextgen/modules/i18n/lang/nggallery.po +28 -0
  9. products/photocrati_nextgen/modules/i18n/module.i18n.php +1 -1
  10. products/photocrati_nextgen/modules/nextgen_addgallery_page/module.nextgen_addgallery_page.php +1 -1
  11. products/photocrati_nextgen/modules/nextgen_addgallery_page/package.module.nextgen_addgallery_page.php +1 -1
  12. products/photocrati_nextgen/modules/nextgen_addgallery_page/templates/import_media_library.php +1 -1
  13. products/photocrati_nextgen/modules/nextgen_addgallery_page/templates/upload_images.php +4 -2
  14. products/photocrati_nextgen/modules/nextgen_basic_album/module.nextgen_basic_album.php +1 -1
  15. products/photocrati_nextgen/modules/nextgen_basic_album/package.module.nextgen_basic_album.php +4 -2
  16. products/photocrati_nextgen/modules/nextgen_data/module.nextgen_data.php +1 -1
  17. products/photocrati_nextgen/modules/nextgen_data/package.module.nextgen_data.php +4 -1
  18. products/photocrati_nextgen/modules/nextgen_gallery_display/module.nextgen_gallery_display.php +1 -1
  19. products/photocrati_nextgen/modules/nextgen_gallery_display/package.module.nextgen_gallery_display.php +4 -1
  20. products/photocrati_nextgen/modules/nextgen_gallery_display/templates/no_images_found.php +1 -1
  21. products/photocrati_nextgen/modules/nextgen_gallery_display/templates/show_altview_link.php +1 -1
  22. products/photocrati_nextgen/modules/nextgen_gallery_display/templates/show_return_link.php +1 -1
  23. products/photocrati_nextgen/modules/nextgen_other_options/package.module.nextgen_other_options.php +2 -1
  24. products/photocrati_nextgen/modules/nextgen_other_options/templates/watermarks_tab.php +1 -1
  25. products/photocrati_nextgen/modules/ngglegacy/admin/manage-images.php +1 -1
  26. products/photocrati_nextgen/modules/ngglegacy/admin/media-upload.php +1 -1
  27. products/photocrati_nextgen/modules/ngglegacy/module.ngglegacy.php +1 -1
  28. products/photocrati_nextgen/modules/router/module.router.php +1 -1
  29. products/photocrati_nextgen/modules/router/package.module.router.php +1 -1
  30. products/photocrati_nextgen/modules/third_party_compat/module.third_party_compat.php +38 -60
  31. readme.txt +17 -1
changelog.txt CHANGED
@@ -1,6 +1,21 @@
1
  NextGEN Gallery
2
  by Imagely
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  = V2.1.56 - 10.27.2016 =
5
  * Fixed: Shortcode parsing was affecting third-party shortcodes
6
 
1
  NextGEN Gallery
2
  by Imagely
3
 
4
+ = V2.1.57 - 11.14.2016 =
5
+ * Changed: Display type icons are now clickable in the Insert Gallery Window
6
+ * Changed: Include backup image files when coping/moving a gallery
7
+ * Changed: Show gallery name in upload notification
8
+ * Changed: Added placeholder text to gallery name field on Add Gallery / Upload Images page
9
+ * Fixed: Custom sortorder not preserved in shortcode
10
+ * Fixed: Shortcodes added via Insert Gallery Window displayed as []
11
+ * Fixed: Uncaught TypeError: Cannot read property 'replace' of undefined
12
+ * Fixed: Use of deprecated Yoast SEO (aka WPSEO) filter
13
+ * Fixed: Conflict with Easy Digital Downloads
14
+ * Fixed: Misc invalid HTML tags in admin pages (thanks to kniebremser)
15
+ * Fixed: Change display:hidden to visibility:hidden in various places
16
+ * Fixed: Escaping of quotes in gallery titles and urls
17
+ * Fixed: Untranslatable strings
18
+
19
  = V2.1.56 - 10.27.2016 =
20
  * Fixed: Shortcode parsing was affecting third-party shortcodes
21
 
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 15 million downloads.
7
- * Version: 2.1.56
8
  * Author: Imagely
9
  * Plugin URI: https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/
10
  * Author URI: https://www.imagely.com
@@ -596,7 +596,7 @@ class C_NextGEN_Bootstrap
596
  define('NGG_PRODUCT_URL', path_join(str_replace("\\", '/', NGG_PLUGIN_URL), 'products'));
597
  define('NGG_MODULE_URL', path_join(str_replace("\\", '/', NGG_PRODUCT_URL), 'photocrati_nextgen/modules'));
598
  define('NGG_PLUGIN_STARTED_AT', microtime());
599
- define('NGG_PLUGIN_VERSION', '2.1.56');
600
 
601
  if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG)
602
  define('NGG_SCRIPT_VERSION', (string)mt_rand(0, mt_getrandmax()));
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 15 million downloads.
7
+ * Version: 2.1.57
8
  * Author: Imagely
9
  * Plugin URI: https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/
10
  * Author URI: https://www.imagely.com
596
  define('NGG_PRODUCT_URL', path_join(str_replace("\\", '/', NGG_PLUGIN_URL), 'products'));
597
  define('NGG_MODULE_URL', path_join(str_replace("\\", '/', NGG_PRODUCT_URL), 'photocrati_nextgen/modules'));
598
  define('NGG_PLUGIN_STARTED_AT', microtime());
599
+ define('NGG_PLUGIN_VERSION', '2.1.57');
600
 
601
  if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG)
602
  define('NGG_SCRIPT_VERSION', (string)mt_rand(0, mt_getrandmax()));
products/photocrati_nextgen/modules/attach_to_post/module.attach_to_post.php CHANGED
@@ -18,7 +18,7 @@ class M_Attach_To_Post extends C_Base_Module
18
  'photocrati-attach_to_post',
19
  'Attach To Post',
20
  'Provides the "Attach to Post" interface for displaying galleries and albums',
21
- '0.16',
22
  'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
23
  'Photocrati Media',
24
  'https://www.imagely.com',
@@ -109,8 +109,10 @@ class M_Attach_To_Post extends C_Base_Module
109
  add_action('admin_init', array(&$this, 'fix_ie11'), PHP_INT_MAX-1);
110
  add_action('admin_enqueue_scripts', array(&$this, 'fix_ie11'), 1);
111
  add_action('admin_enqueue_scripts', array(&$this, 'fix_ie11'), PHP_INT_MAX-1);
112
- add_filter('wpseo_pre_analysis_post_content', array(&$this, 'remove_preview_images_from_yoast_opengraph'));
113
- add_filter('wpseo_sitemap_urlimages', array(&$this, 'remove_preview_images_from_yoast_sitemap'), NULL, 2);
 
 
114
 
115
  // Emit frame communication events
116
  if ($this->does_request_require_frame_communication()) {
@@ -147,7 +149,11 @@ class M_Attach_To_Post extends C_Base_Module
147
  */
148
  function print_tinymce_placeholder_template()
149
  {
150
- include_once('templates/tinymce_placeholder.php');
 
 
 
 
151
  }
152
 
153
  /**
18
  'photocrati-attach_to_post',
19
  'Attach To Post',
20
  'Provides the "Attach to Post" interface for displaying galleries and albums',
21
+ '0.17',
22
  'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
23
  'Photocrati Media',
24
  'https://www.imagely.com',
109
  add_action('admin_init', array(&$this, 'fix_ie11'), PHP_INT_MAX-1);
110
  add_action('admin_enqueue_scripts', array(&$this, 'fix_ie11'), 1);
111
  add_action('admin_enqueue_scripts', array(&$this, 'fix_ie11'), PHP_INT_MAX-1);
112
+
113
+ if (defined('WPSEO_VERSION') && version_compare(WPSEO_VERSION, '3.0', '>='))
114
+ add_filter('wpseo_pre_analysis_post_content', array(&$this, 'remove_preview_images_from_yoast_opengraph'));
115
+ add_filter('wpseo_sitemap_urlimages', array(&$this, 'remove_preview_images_from_yoast_sitemap'), NULL, 2);
116
 
117
  // Emit frame communication events
118
  if ($this->does_request_require_frame_communication()) {
149
  */
150
  function print_tinymce_placeholder_template()
151
  {
152
+ readfile(C_Fs::get_instance()->join_paths(
153
+ $this->get_registry()->get_module_dir('photocrati-attach_to_post'),
154
+ 'templates',
155
+ 'tinymce_placeholder.php'
156
+ ));
157
  }
158
 
159
  /**
products/photocrati_nextgen/modules/attach_to_post/static/display_tab.js CHANGED
@@ -356,7 +356,7 @@ jQuery(function($){
356
  'id_field'
357
  ];
358
 
359
- if (skipped.includes(key)) continue;
360
  else if (key == 'display_settings') {
361
  for (var display_key in obj[key]) {
362
  if ((val = get_shortcode_attr(obj[key], display_key))) snippet += ' ' + val;
@@ -405,7 +405,7 @@ jQuery(function($){
405
 
406
  find_by_name_or_alias: function(name) {
407
  return this.find(function(source) {
408
- return source.get('name') == name || (_.isArray(source.get('aliases')) && source.get('aliases').includes(name));
409
  });
410
  }
411
  });
@@ -533,7 +533,7 @@ jQuery(function($){
533
 
534
  find_by_name_or_alias: function(name){
535
  return this.find(function(display_type){
536
- return display_type.get('name') == name || (_.isArray(display_type.get('aliases')) && display_type.get('aliases').includes(name));
537
  });
538
  }
539
  });
@@ -837,7 +837,7 @@ jQuery(function($){
837
 
838
  render: function() {
839
  // Create all elements
840
- var image_container = $('<div/>').addClass('image_container');
841
 
842
  // 2.0.66 did not support plugins_url, 2.0.66.3+ does
843
  var installed_at_version = this.model.get('installed_at_version');
356
  'id_field'
357
  ];
358
 
359
+ if (skipped.indexOf(key) > -1) continue;
360
  else if (key == 'display_settings') {
361
  for (var display_key in obj[key]) {
362
  if ((val = get_shortcode_attr(obj[key], display_key))) snippet += ' ' + val;
405
 
406
  find_by_name_or_alias: function(name) {
407
  return this.find(function(source) {
408
+ return source.get('name') == name || (_.isArray(source.get('aliases')) && source.get('aliases').indexOf(name) > -1);
409
  });
410
  }
411
  });
533
 
534
  find_by_name_or_alias: function(name){
535
  return this.find(function(display_type){
536
+ return display_type.get('name') == name || (_.isArray(display_type.get('aliases')) && display_type.get('aliases').indexOf(name) > -1);
537
  });
538
  }
539
  });
837
 
838
  render: function() {
839
  // Create all elements
840
+ var image_container = $('<label style="display: block; cursor: pointer;"/>').addClass('image_container');
841
 
842
  // 2.0.66 did not support plugins_url, 2.0.66.3+ does
843
  var installed_at_version = this.model.get('installed_at_version');
products/photocrati_nextgen/modules/attach_to_post/static/display_tab.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(e){var t={Models:{},Views:{}};t.Models.SelectableItems=Backbone.Collection.extend({selected:function(){return this.filter(function(e){return 1==e.get("selected")})},deselect_all:function(){this.each(function(e){e.set("selected",!1)})},selected_ids:function(){return _.pluck(this.selected(),"id")},select:function(e){_.isArray(e)||(e=[e]),this.each(function(t){_.indexOf(e,t.id)>=0&&t.set("selected",!0)}),this.trigger("selected")}}),t.Views.SelectTag=Backbone.View.extend({tagName:"select",collection:null,multiple:!1,value_field:"id",text_field:"title",initialize:function(e){this.options=e||{},_.each(this.options,function(e,t){this[t]=e},this),this.collection.on("add",this.render_new_option,this),this.collection.on("remove",this.remove_existing_option,this),this.collection.on("reset",this.empty_list,this)},events:{change:"selection_changed"},empty_list:function(){this.$el.empty()},render_new_option:function(e){this.$el.append(new this.Option({model:e,value_field:this.value_field,text_field:this.text_field}).render().el)},remove_existing_option:function(e){this.$el.find("option[value='"+e.id+"']").remove()},selection_changed:function(){var t=_.map(this.$el.find(":selected"),function(t){return e(t).val()});this.collection.each(function(e){_.indexOf(t,e.id)>=0||_.indexOf(t,e.id.toString())>=0?e.set("selected",!0):e.set("selected",!1)}),this.collection.trigger("selected")},render:function(){return this.$el.empty(),this.options.include_blank&&this.$el.append("<option></option>"),this.collection.each(function(e){var t=new this.Option({model:e,value_field:this.value_field,text_field:this.text_field});this.$el.append(t.render().el)},this),this.multiple&&this.$el.prop("multiple",!0).attr("multiple","multiple"),this.width&&this.$el.width(this.width),this},Option:Backbone.View.extend({tagName:"option",model:null,initialize:function(e){this.options=e||{},_.each(this.options,function(e,t){this[t]=e},this),this.model.on("change",this.render,this)},render:function(){var e=this;return this.$el.html(this.model.get(this.text_field).replace(/\\&/g,"&").replace(/\\'/g,"'")),this.$el.prop({value:"id"==this.value_field?this.model.id:this.model.get(this.value_field)}),1==e.model.get("selected")&&this.$el.prop("selected",!0).attr("selected","selected"),this}})}),t.Views.Chosen=Backbone.View.extend({tagName:"span",initialize:function(e){this.options=e||{},this.collection=this.options.collection,this.options.include_blank=!0,this.select_tag=new t.Views.SelectTag(this.options),this.collection.on("change",this.selection_changed,this)},selection_changed:function(e){_.isUndefined(e.changed.selected)&&this.render()},render:function(){if(this.$el.append(this.select_tag.render().$el),this.options.width&&this.select_tag.$el.width(this.options.width),this.select2_opts={placeholder:this.options.placeholder},0==this.$el.parent().length){e("body").append(this.$el),this.select_tag.$el.select2(this.select2_opts);var t=this.select_tag.$el.select2("container").detach();this.$el.append(t),this.$el.detach()}else this.select_tag.$el.select2(this.select2_opts);if(this.options.multiple){var i=[];_.each(this.collection.selected_ids(),function(e){i.push(e.toString())}),0==i.length&&(i=""),this.select_tag.$el.select2("val",i)}return this.$el.find(".select2-input").width(this.options.width-20),this}}),t.DisplayTab={Models:{},Views:{},App:{}},t.Models.Remote_Collection=t.Models.SelectableItems.extend({fetch_limit:5e3,in_progress:!1,fetch_url:photocrati_ajax.url,action:"",extra_data:{},_create_request:function(e,t){var i=_.extend({},igw_data.sec_token,{action:this.action,limit:e?e:this.fetch_limit,offset:t?t:0});for(var s in this.extra_data){var l=this.extra_data[s];"undefined"==typeof i[s]&&(i[s]={}),"undefined"!=typeof l.toJSON&&(l=l.toJSON()),i[s]=_.extend(i[s],l)}return i},_add_item:function(e){this.push(e)},fetch:function(t,i){var s=this;this.in_progress=!0,e.post(this.fetch_url,this._create_request(t,i),function(e){"undefined"!=typeof _&&(_.isObject(e)||(e=JSON.parse(e)),e.items&&(_.each(e.items,function(e){s._add_item(e)}),e.total>=e.limit+e.offset?s.fetch(e.limit,e.offset+e.limit):(s.in_progress=!1,s.trigger("finished_fetching"))))})}}),t.DisplayTab.Models.Displayed_Gallery=Backbone.Model.extend({defaults:{source:null,container_ids:[],entity_ids:[],display_type:null,display_settings:{},exclusions:[],sortorder:[],slug:null},to_shortcode:function(){retval=null;var e=function(e,t){var i=e[t];if(_.isArray(i)&&(i=i.length>0?i.join(","):null),i)return i=i.toString().replace("[","&#91;"),i=i.toString().replace("]","&#93;"),t+'="'+i+'"'},i=t.DisplayTab.instance.display_types.find_by_name_or_alias(this.get("display_type")),s=this.toJSON();s.display_type=i.get_shortcode_value();var l="[ngg_images",n=null;(n=e(s,"source"))&&(l+=" "+n),(n=e(s,"container_ids"))&&(l+=" "+n),(n=e(s,"entity_ids"))&&(l+=" "+n),(n=e(s,"exclusions"))&&(l+=" "+n),(n=e(s,"sortorder"))&&(l+=" "+n);for(var a in s){var o=["source","container_ids","entity_ids","exclusions","sortorder","__defaults_set","id_field"];if(!o.includes(a))if("display_settings"==a)for(var r in s[a])(n=e(s[a],r))&&(l+=" "+n);else n=e(s,a),n&&(l+=" "+n)}return l+="]"}}),t.DisplayTab.Models.Source=Backbone.Model.extend({idAttribute:"name",defaults:{title:"",name:"",selected:!1}}),t.DisplayTab.Models.Source_Collection=t.Models.SelectableItems.extend({model:t.DisplayTab.Models.Source,selected_value:function(){var e=null,t=this.selected();return t.length>0&&(e=t[0].get("name")),e},find_by_name_or_alias:function(e){return this.find(function(t){return t.get("name")==e||_.isArray(t.get("aliases"))&&t.get("aliases").includes(e)})}}),t.DisplayTab.Models.Gallery=Backbone.Model.extend({idAttribute:igw_data.gallery_primary_key,defaults:{title:"",name:""}}),t.DisplayTab.Models.Gallery_Collection=t.Models.Remote_Collection.extend({model:t.DisplayTab.Models.Gallery,action:"get_existing_galleries"}),t.DisplayTab.Models.Album=Backbone.Model.extend({defaults:{title:"",name:""}}),t.DisplayTab.Models.Album_Collection=t.Models.Remote_Collection.extend({model:t.DisplayTab.Models.Album,action:"get_existing_albums"}),t.DisplayTab.Models.Tag=Backbone.Model.extend({defaults:{title:""}}),t.DisplayTab.Models.Tag_Collection=t.Models.Remote_Collection.extend({model:t.DisplayTab.Models.Tag,action:"get_existing_image_tags"}),t.DisplayTab.Models.Display_Type=Backbone.Model.extend({idAttribute:"name",defaults:{title:""},is_compatible_with_source:function(e){var t=!0;for(index in e.get("returns")){var i=e.get("returns")[index];if(_.indexOf(this.get("entity_types"),i)<0){t=!1;break}}return t},get_shortcode_value:function(){var e=this.id;return e}}),t.DisplayTab.Models.Display_Type_Collection=t.Models.SelectableItems.extend({model:t.DisplayTab.Models.Display_Type,selected_value:function(){var e=null,t=this.selected();return t.length>0?t[0].get("name"):e},find_by_name_or_alias:function(e){return this.find(function(t){return t.get("name")==e||_.isArray(t.get("aliases"))&&t.get("aliases").includes(e)})}}),t.DisplayTab.Models.Entity=Backbone.Model.extend({entity_id:function(){return this.get(this.get("id_field"))},is_excluded:function(){return current_value=this.get("exclude"),!_.isUndefined(current_value)&&(_.isBoolean(current_value)?current_value:0!=parseInt(current_value))},is_included:function(){return!this.is_excluded()},is_gallery:function(){return retval=!1,1==this.get("is_gallery")&&(retval=!0),retval},is_album:function(){return retval=!1,1==this.get("is_album")&&(retval=!0),retval},is_image:function(){return!this.is_album()&&!this.is_gallery()},alttext:function(){return this.is_image()?this.get("alttext"):this.is_gallery()?this.get("title"):this.is_album()?this.get("name"):void 0}}),t.DisplayTab.Models.Entity_Collection=t.Models.Remote_Collection.extend({model:t.DisplayTab.Models.Entity,action:"get_displayed_gallery_entities",_add_item:function(e){e.exclude=1==parseInt(e.exclude),e.is_gallery=1==parseInt(e.is_gallery),e.is_album=1==parseInt(e.is_album),this.push(e)},entity_ids:function(){return this.map(function(e){return e.entity_id()})},included_ids:function(){return _.compact(this.map(function(e){if(e.is_included())return e.entity_id()}))},excluded_ids:function(){return _.compact(this.map(function(e){if(!e.is_included())return e.entity_id()}))}}),t.DisplayTab.Models.SortOrder=Backbone.Model.extend({}),t.DisplayTab.Models.SortOrder_Options=t.Models.SelectableItems.extend({model:t.DisplayTab.Models.SortOrder}),t.DisplayTab.Models.SortDirection=Backbone.Model.extend({}),t.DisplayTab.Models.SortDirection_Options=Backbone.Collection.extend({model:t.DisplayTab.Models.SortDirection}),t.DisplayTab.Models.Slug=Backbone.Model.extend({}),t.DisplayTab.Views.Source_Config=Backbone.View.extend({el:"#source_configuration",selected_view:null,initialize:function(){this.sources=t.DisplayTab.instance.sources,this.sources.on("selected",this.render,this),_.bindAll(this,"render"),this.render()},render:function(){var e=new t.Views.Chosen({id:"source_select",collection:this.sources,placeholder:"Select a source",width:500}),i=_.template('<tr><td><label><%- sources %></label></td><td id="source_column"></td></tr>');this.$el.html(i(igw_data.i18n)),this.$el.find("#source_column").append(e.render().el);var s=this.sources.selected();if(s.length){var l=_.str.capitalize(s.pop().id)+"Source";if("undefined"!=typeof t.DisplayTab.Views[l]){var n=new t.DisplayTab.Views[l];this.$el.append(n.render().el)}}return this}}),t.DisplayTab.Views.Slug_Config=Backbone.View.extend({el:"#slug_configuration",selected_view:null,initialize:function(){this.displayed_gallery=t.DisplayTab.instance.displayed_gallery,this.slug=t.DisplayTab.instance.displayed_gallery.get("slug"),this.render()},render:function(){var t=this,i=e("<input>").prop({type:"text",name:"slug",value:this.slug,placeholder:igw_data.i18n.optional,id:"field_slug"});i.on("input",function(){e(this).val(e(this).val().replace(/\s|\?|\\|\/|&|=|\[|]|#/gm,"-")),t.displayed_gallery.set("slug",e(this).val())}),i.on("change",function(){e(this).val(e(this).val().replace(/^-*/gm,"").replace(/-*$/gm,"")),t.displayed_gallery.set("slug",e(this).val())});var s=_.template('<tr><td id="slug_label"><label for="field_slug" class="tooltip" title="<%- slug_tooltip %><"><<%- slug_label %></label></td><td id="slug_column"></td></tr>');return this.$el.append(s(igw_data.i18n)),this.$el.find("#slug_column").append(i),this}}),t.DisplayTab.Views.Display_Type_Selector=Backbone.View.extend({el:"#display_type_selector",initialize:function(){this.display_types=t.DisplayTab.instance.display_types,this.display_type_order_base=t.DisplayTab.instance.display_type_order_base,this.display_type_order_step=t.DisplayTab.instance.display_type_order_step,this.sources=t.DisplayTab.instance.sources,this.render()},selection_changed:function(t){var i=null;if(this.display_types.each(function(e){e.get("name")==t?(i=e,e.set("selected",!0)):e.set("selected",!1)}),i){var s=this.sources.selected_value(),l=i.get("default_source");l&&s!=l&&(l=this.sources.where({name:l}),l.length>0&&(l=l[0],this.sources.deselect_all(),this.sources.select(l.id)))}e(".display_settings_form").each(function(){$this=e(this),$this.attr("rel")==t?$this.removeClass("hidden"):$this.addClass("hidden")})},render:function(){var t=this.sources.selected(),i=0;t=t.length>0&&t[0],this.$el.empty();var s=this.display_type_order_base,l=this.display_type_order_step;return this.display_types.each(function(n){if(t&&!n.is_compatible_with_source(t)){var a=e("#display_type_tab_content:visible");if(0==a.length)return;if("hidden"==a.css("visibility"))return}var o=new this.DisplayType;o.model=n,o.on("selected",this.selection_changed,this),this.display_types.selected_value()||(n.set("selected",!0),this.selection_changed(n.id));var r=n.get("view_order");r||(r=s);var d=Math.floor(r/l);i>0&&d>i&&this.$el.append('<li class="clear" style="height: 10px" />'),i=d,this.$el.append(o.render().el)},this),this},DisplayType:Backbone.View.extend({className:"display_type_preview",events:{click:"clicked"},clicked:function(e){this.trigger("selected",this.model.get("name"))},render:function(){var t=e("<div/>").addClass("image_container"),i=this.model.get("installed_at_version"),s=photocrati_ajax.wp_plugins_url,l=this.model.get("preview_image_relpath");"undefined"==typeof i&&(s=photocrati_ajax.wp_site_url,s=s.replace(/(.*)\/index\.php$/i,"$1"),0==l.indexOf("/nextgen-gallery")&&(s=photocrati_ajax.wp_plugins_url));var n=e("<img/>").attr({src:s+"/"+l,title:this.model.get("title"),alt:this.model.get("alt")}),a=e("<div/>"),o=e("<input/>").prop({type:"radio",value:this.model.get("name"),title:this.model.get("title"),name:"display_type",checked:this.model.get("selected")});return t.append(a),t.append(n),a.append(o),a.append(this.model.get("title")),this.$el.append(t),this}})}),t.DisplayTab.Views.Preview_Area=Backbone.View.extend({el:"#preview_area",initialize:function(){this.entities=t.DisplayTab.instance.entities,this.sources=t.DisplayTab.instance.sources,this.displayed_gallery=t.DisplayTab.instance.displayed_gallery,this.entity_list=e("<ul/>").attr("id","entity_list").append('<li class="clear"/>'),this.entities.on("add",this.render_entity,this),this.entities.on("remove",this.remove_entity,this),this.entities.on("reset",this.entities_reset,this),this.entities.on("change:sortorder",function(e){this.entities.remove(e,{silent:!0}),this.entities.add(e,{at:e.changed.sortorder,silent:!0}),this.displayed_gallery.set("sortorder",this.entities.entity_ids()),"undefined"!=typeof console&&"undefined"!=typeof console.log&&console.log(this.entities.entity_ids()),this.displayed_gallery.set("order_by","sortorder")},this),this.sources.on("selected",this.render,this),this.render()},events:{opened:"entities_reset"},entities_reset:function(e){this.entities.reset(null,{silent:!0}),this.entity_list.empty().append('<li class="clear"/>'),this.entities.in_progress||this.entities.fetch()},render_entity:function(e){var t=new this.EntityElement({model:e});this.entity_list.find(".clear").before(t.render().$el),t.$el.css("visibility","hidden"),setTimeout(function(){t.$el.css("visibility","visible")},0),1==this.$el.find(".no_entities").length?this.render():this.entities.length>1&&this.entity_list.sortable("refresh")},remove_entity:function(e){var t=this.id=e.get("id_field")+"_"+e.entity_id();this.entity_list.find("#"+t).remove();this.entity_list.sortable("refresh"),0==this.entities.length&&this.render_no_images_notice()},render_no_images_notice:function(){this.$el.empty(),this.$el.append("<p class='no_entities'>"+igw_data.i18n.no_entities+"</p>")},render:function(){return this.$el.empty(),this.entities.length>0&&this.displayed_gallery.get("container_ids").length>0?(this.$el.append(new this.RefreshButton({entities:this.entities}).render().el),this.$el.append(new this.SortButtons({entities:this.entities,displayed_gallery:this.displayed_gallery,sources:this.sources}).render().el),this.$el.append(new this.ExcludeButtons({entities:this.entities}).render().el),this.$el.append(this.entity_list),this.entity_list.sortable({placeholder:"placeholder",forcePlaceholderSize:!0,containment:"parent",opacity:.7,revert:!0,dropOnEmpty:!0,start:function(e,t){return t.placeholder.css({height:t.item.height()}),!0},stop:function(e,t){t.item.trigger("drop",t.item.index())}}),this.entity_list.disableSelection()):this.render_no_images_notice(),this},RefreshButton:Backbone.View.extend({className:"refresh_button",tagName:"input",label:"Refresh",events:{click:"clicked"},clicked:function(){this.entities.reset()},initialize:function(e){this.options=e||{},_.each(this.options,function(e,t){this[t]=e},this)},render:function(){return this.$el.attr({value:this.label,type:"button"}),this}}),ExcludeButtons:Backbone.View.extend({className:"header_row",initialize:function(e){this.options=e||{},_.each(this.options,function(e,t){this[t]=e},this)},render:function(){this.$el.empty(),this.$el.append("<strong>Exclude:</strong>");var e=new this.Button({value:!0,text:"All",entities:this.entities});this.$el.append(e.render().el),this.$el.append('<span class="separator">|</span>');var t=new this.Button({value:!1,text:"None",entities:this.entities});return this.$el.append(t.render().el),this},Button:Backbone.View.extend({tagName:"a",value:1,text:"",events:{click:"clicked"},initialize:function(e){this.options=e||{},_.each(this.options,function(e,t){this[t]=e},this)},clicked:function(e){e.preventDefault(),this.entities.each(function(e){e.set("exclude",this.value)},this)},render:function(){return this.$el.text(this.text).attr("href","#"),this}})}),SortButtons:Backbone.View.extend({className:"header_row",initialize:function(e){this.options=e||{},_.each(this.options,function(e,t){this[t]=e},this),this.sortorder_options=new t.DisplayTab.Models.SortOrder_Options,this.sortorder_options.on("change:selected",this.sortoption_changed,this),this.sortdirection_options=new t.DisplayTab.Models.SortDirection_Options([{value:"ASC",title:"Ascending",selected:"ASC"==this.displayed_gallery.get("order_direction")},{value:"DESC",title:"Descending",selected:"DESC"==this.displayed_gallery.get("order_direction")}]),this.sortdirection_options.on("change:selected",this.sortdirection_changed,this),this.displayed_gallery.on("change:order_by",this.displayed_gallery_order_changed,this),this.displayed_gallery.on("change.order_direction",this.displayed_gallery_order_dir_changed,this)},populate_sorting_fields:function(){var e=this.sources.selected().pop().get("returns");_.indexOf(e,"image")!==-1?this.fill_image_sortorder_options():this.fill_gallery_sortorder_options()},create_sortorder_option:function(e,i){return new t.DisplayTab.Models.SortOrder({name:e,title:i,value:e,selected:this.displayed_gallery.get("order_by")==e})},fill_image_sortorder_options:function(){this.sortorder_options.reset(),this.sortorder_options.push(this.create_sortorder_option("","None")),this.sortorder_options.push(this.create_sortorder_option("sortorder","Custom")),this.sortorder_options.push(this.create_sortorder_option(t.DisplayTab.instance.image_key,"Image ID")),this.sortorder_options.push(this.create_sortorder_option("filename","Filename")),this.sortorder_options.push(this.create_sortorder_option("alttext","Alt/Title Text")),this.sortorder_options.push(this.create_sortorder_option("imagedate","Date/Time"))},fill_gallery_sortorder_options:function(){this.sortorder_options.reset(),this.sortorder_options.push(this.create_sortorder_option("","None")),this.sortorder_options.push(this.create_sortorder_option("sortorder","Custom")),this.sortorder_options.push(this.create_sortorder_option("name","Name")),this.sortorder_options.push(this.create_sortorder_option("galdesc","Description"))},displayed_gallery_order_changed:function(e){this.sortorder_options.findWhere({value:e.get("order_by")}).set("selected",!0)},displayed_gallery_order_dir_changed:function(e){this.sortdirection_options.findWhere({value:e.get("order_direction")}).set("selected",!0)},sortoption_changed:function(t){this.sortorder_options.each(function(e){e.set("selected",t.get("value")==e.get("value"),{silent:!0})}),this.displayed_gallery.set("sortorder",[]);var i=t.get("value");0==t.get("value").length&&(i="sortorder"),this.displayed_gallery.set("order_by",i),this.entities.reset(),this.$el.find("a.sortorder").each(function(){var i=e(this);i.attr("value")==t.get("value")?i.addClass("selected"):i.removeClass("selected")})},sortdirection_changed:function(t){this.sortdirection_options.each(function(e){e.set("selected",t.get("value")==e.get("value"),{silent:!0})}),this.displayed_gallery.set("order_direction",t.get("value")),this.entities.reset(),this.$el.find("a.sortdirection").each(function(){var i=e(this);i.attr("value")==t.get("value")?i.addClass("selected"):i.removeClass("selected")})},render:function(){return this.$el.empty(),this.populate_sorting_fields(),this.$el.append("<strong>Sort By:</strong>"),this.sortorder_options.each(function(e,t){var i=new this.Button({model:e,className:"sortorder"});this.$el.append(i.render().el),this.sortorder_options.length-1>t&&this.$el.append('<span class="separator">|</span>')},this),this.$el.append('<strong style="margin-left: 30px;">Order By:</strong>'),this.sortdirection_options.each(function(e,t){var i=new this.Button({model:e,className:"sortdirection"});this.$el.append(i.render().el),this.sortdirection_options.length-1>t&&this.$el.append('<span class="separator">|</span>')},this),this},Button:Backbone.View.extend({tagName:"a",initialize:function(e){this.options=e||{},_.each(this.options,function(e,t){this[t]=e},this)},events:{click:"clicked"},clicked:function(e){e.preventDefault(),this.model.set("selected",!0)},render:function(){return this.$el.prop({value:this.model.get("value"),href:"#"}),this.$el.text(this.model.get("title")),this.model.get("selected")&&this.$el.addClass("selected"),this}})}),EntityElement:Backbone.View.extend({tagName:"li",events:{drop:"item_dropped"},initialize:function(e){this.options=e||{},_.each(this.options,function(e,t){this[t]=e},this),this.initTime=(new Date).getTime(),this.model.on("change",this.render,this),0==this.model.get("sortorder")&&this.model.set("sortorder",-1,{silent:!0}),this.id=this.model.get("id_field")+"_"+this.model.entity_id()},item_dropped:function(e,i){t.DisplayTab.instance.displayed_gallery.set("order_by","sortorder"),this.model.set("sortorder",i)},render:function(){this.$el.empty();var t=e("<div/>").addClass("preview_item"),i=e("<div/>").addClass("image_container"),s=this.model.alttext().replace(/\\&/g,"&").replace(/\\'/g,"'"),l=this.initTime;i.attr({title:s,style:"background-image: url('"+this.model.get("thumb_url")+"?timestamp"+l+"')"}),this.$el.append(t).addClass("ui-state-default"),t.append(i);var n=e("<div/>").addClass("exclude_container"),a=e("<label/>");a.append(igw_data.i18n.exclude_question);var o=new this.ExcludeCheckbox({model:this.model});return a.append(o.render().el),n.append(a),t.append(n),this},ExcludeCheckbox:Backbone.View.extend({tagName:"input",events:{change:"entity_excluded"},type_set:!1,entity_excluded:function(e){this.model.set("exclude",e.target.checked)},initialize:function(e){this.options=e||{},_.each(this.options,function(e,t){this[t]=e},this),this.model.on("change:exclude",this.render,this)},render:function(){return this.type_set||(this.$el.attr("type","checkbox"),this.type_set=!0),this.model.is_excluded()?this.$el.prop("checked",!0):this.$el.prop("checked",!1),this}})})}),t.DisplayTab.Views.GalleriesSource=Backbone.View.extend({tagName:"tbody",initialize:function(){this.galleries=t.DisplayTab.instance.galleries},render:function(){var i=new t.Views.Chosen({collection:this.galleries,placeholder:igw_data.i18n.select_gallery,multiple:!0,width:500}),s=e("<tr><td><label>"+igw_data.i18n.galleries+'</label></td><td class="galleries_column"></td></tr>');return this.$el.empty(),this.$el.append(s),this.$el.find(".galleries_column").append(i.render().el),this}}),t.DisplayTab.Views.AlbumsSource=Backbone.View.extend({tagName:"tbody",initialize:function(){this.albums=t.DisplayTab.instance.albums},render:function(){var e=new t.Views.Chosen({collection:this.albums,multiple:!0,placeholder:"Select an album",text_field:"name",width:500});return this.$el.empty(),this.$el.append("<tr><td><label>"+igw_data.i18n.albums+'</label></td><td class="albums_column"></td></tr>'),this.$el.find(".albums_column").append(e.render().el),this}}),t.DisplayTab.Views.TagsSource=Backbone.View.extend({tagName:"tbody",initialize:function(){this.tags=t.DisplayTab.instance.tags},render:function(){var e=new t.Views.Chosen({collection:this.tags,multiple:!0,placeholder:"Select a tag",text_field:"name",width:500});return this.$el.empty(),this.$el.append('<tr><td><label>Tags</label></td><td class="tags_column"></td></tr>'),this.$el.find(".tags_column").append(e.render().el),this}}),t.DisplayTab.Views.Recent_imagesSource=Backbone.View.extend({tagName:"tbody",initialize:function(){this.displayed_gallery=t.DisplayTab.instance.displayed_gallery,this.maximum_entity_count=t.DisplayTab.instance.displayed_gallery.get("maximum_entity_count"),this.displayed_gallery.set("container_ids",[])},render:function(){var t=this,i=e("<input/>").prop({type:"text",value:this.maximum_entity_count,name:"maximum_entity_count"});return i.change(function(){t.displayed_gallery.set("maximum_entity_count",e(this).val())}),this.$el.empty(),this.$el.append('<tr><td><label># of Images To Display</label></td><td class="recent_images_column"></td></tr>'),this.$el.find(".recent_images_column").append(i),this}}),t.DisplayTab.Views.Random_imagesSource=Backbone.View.extend({tagName:"tbody",initialize:function(){this.displayed_gallery=t.DisplayTab.instance.displayed_gallery,this.maximum_entity_count=t.DisplayTab.instance.displayed_gallery.get("maximum_entity_count"),this.displayed_gallery.set("container_ids",[])},render:function(){var t=this,i=e("<input/>").prop({type:"text",value:this.maximum_entity_count,name:"maximum_entity_count"});return i.change(function(){t.displayed_gallery.set("maximum_entity_count",e(this).val())}),this.$el.empty(),this.$el.append('<tr><td><label># of Images To Display</label></td><td class="random_images_column"></td></tr>'),this.$el.find(".random_images_column").append(i),this}}),t.DisplayTab.Views.SaveButton=Backbone.View.extend({el:"#save_displayed_gallery",errors_el:"#errors",displayed_gallery:null,events:{click:"clicked"},initialize:function(){this.displayed_gallery=t.DisplayTab.instance.displayed_gallery,this.entities=t.DisplayTab.instance.entities,this.render()},clicked:function(){this.set_display_settings(),insert_into_editor(this.displayed_gallery.to_shortcode(),this.displayed_gallery.id?this.displayed_gallery.id:igw_data.shortcode_ref),close_attach_to_post_window()},set_display_settings:function(){var t=this.displayed_gallery.get("display_type");if(t){var i=e("form[rel='"+t+"']"),s=function(t){var i={};return e.each(t.serializeArray(),function(e,t){for(var s=t.name.split("["),l=i,n=0;n<s.length;n++){var a=s[n].replace(/\]$/,"");l[a]||(n==s.length-1?l[a]=t.value:l[a]={}),l=l[a]}}),i}(i);this.displayed_gallery.set("display_settings",s[t])}},render:function(){return this.$el.css("z-index",1e3),this}}),t.DisplayTab.App=Backbone.View.extend({initialize:function(){if(this.displayed_gallery=new t.DisplayTab.Models.Displayed_Gallery(igw_data.displayed_gallery),this.original_displayed_gallery=new t.DisplayTab.Models.Displayed_Gallery(igw_data.displayed_gallery),this.galleries=new t.DisplayTab.Models.Gallery_Collection(igw_data.galleries),this.albums=new t.DisplayTab.Models.Album_Collection(igw_data.albums),this.tags=new t.DisplayTab.Models.Tag_Collection(igw_data.tags),this.sources=new t.DisplayTab.Models.Source_Collection(igw_data.sources),this.display_types=new t.DisplayTab.Models.Display_Type_Collection(igw_data.display_types),this.display_type_order_base=igw_data.display_type_priority_base,this.display_type_order_step=igw_data.display_type_priority_step,this.entities=new t.DisplayTab.Models.Entity_Collection,this.entities.extra_data.displayed_gallery=this.displayed_gallery,this.image_key=igw_data.image_primary_key,this.displayed_gallery.get("source")){if(this.displayed_gallery.get("source")){var e=this.sources.find_by_name_or_alias(this.displayed_gallery.get("source"));e&&e.set("selected",!0)}if(this.displayed_gallery.get("container_ids")&&_.each(this.displayed_gallery.get("container_ids"),function(e){var t=this[this.displayed_gallery.get("source")].find(function(t){return t.id==e},this);t&&t.set("selected",!0)},this),this.displayed_gallery.get("display_type")){var i=this.display_types.find_by_name_or_alias(this.displayed_gallery.get("display_type"));i&&(i.set("selected",!0),this.displayed_gallery.set("display_type",i.get("name")))}}if(collections=["galleries","albums","tags"],_.each(collections,function(e){this[e].on("selected",function(){this.update_selected_containers(e)},this)},this),this.display_types.on("change:selected",function(){this.displayed_gallery.set("display_type",this.display_types.selected_value())},this),this.sources.on("selected",function(){this.displayed_gallery.set("source",this.sources.selected_value()),this.sources.selected_value()!=this.original_displayed_gallery.get("source")?this.displayed_gallery.set("exclusions",this.entities.excluded_ids()):this.displayed_gallery.set("exclusions",this.original_displayed_gallery.get("exclusions")),"random_images"!=this.sources.selected_value()&&"recent_images"!=this.sources.selected_value()||this.displayed_gallery.set("maximum_entity_count",20),this.galleries.deselect_all(),this.albums.deselect_all(),this.tags.deselect_all();var e=this.display_types.selected(),t=this.sources.selected();e.length>0&&t.length>0&&(e=e[0],t=t[0],e.is_compatible_with_source(t)||this.display_types.deselect_all(),this.display_type_selector&&this.display_type_selector.render()),this.preview_area&&this.preview_area.render()},this),this.entities.on("change:exclude finished_fetching",function(){this.displayed_gallery.set("exclusions",this.entities.excluded_ids())},this),window.Frame_Event_Publisher){var s=this;Frame_Event_Publisher.listen_for("attach_to_post:new_gallery",function(){s.galleries.reset(),s.galleries.fetch()}),Frame_Event_Publisher.listen_for("attach_to_post:manage_galleries attach_to_post:manage_images",function(e){s.galleries.reset(),s.galleries.fetch();var t=s.sources.selected().pop();t&&(_.indexOf(t.get("returns"),"image")>=0||_.indexOf(t.get("returns"),"gallery"))&&s.entities.reset()}),Frame_Event_Publisher.listen_for("attach_to_post:manage_album",function(e){s.albums.reset(),s.albums.fetch();var t=s.sources.selected().pop();t&&_.indexOf(t.get("returns"),"album")>=0&&s.entities.reset()}),Frame_Event_Publisher.listen_for("attach_to_post:manage_tags attach_to_post:manage_images",function(e){s.tags.reset(),s.tags.fetch();var t=s.sources.selected().pop();t&&(_.indexOf(t.get("returns"),"image")>=0||_.indexOf(t.get("returns"),"gallery"))&&s.entities.reset()}),Frame_Event_Publisher.listen_for("attach_to_post:thumbnail_modified",function(e){var t=s.sources.selected().pop(),i=e.image[e.image.id_field];if(t)if(_.indexOf(t.get("returns"),"image")>=0){var l=s.entities.find(function(e){return parseInt(e.entity_id())==parseInt(i)},this);l&&l.set("thumb_url",e.image.thumb_url)}else{var n=s.entities.find(function(e){return parseInt(e.get("previewpic"))==i},this);n&&n.trigger("change")}})}},update_selected_containers:function(e){this.displayed_gallery.set("container_ids",this[e].selected_ids())},render:function(){this.display_type_selector=new t.DisplayTab.Views.Display_Type_Selector,new t.DisplayTab.Views.Source_Config,new t.DisplayTab.Views.Slug_Config,this.preview_area=new t.DisplayTab.Views.Preview_Area,new t.DisplayTab.Views.SaveButton}}),t.DisplayTab.instance=new t.DisplayTab.App,t.DisplayTab.instance.render(),window.Ngg=t,e("span.tooltip, label.tooltip").tooltip()});
1
+ jQuery(function(e){var t={Models:{},Views:{}};t.Models.SelectableItems=Backbone.Collection.extend({selected:function(){return this.filter(function(e){return 1==e.get("selected")})},deselect_all:function(){this.each(function(e){e.set("selected",!1)})},selected_ids:function(){return _.pluck(this.selected(),"id")},select:function(e){_.isArray(e)||(e=[e]),this.each(function(t){_.indexOf(e,t.id)>=0&&t.set("selected",!0)}),this.trigger("selected")}}),t.Views.SelectTag=Backbone.View.extend({tagName:"select",collection:null,multiple:!1,value_field:"id",text_field:"title",initialize:function(e){this.options=e||{},_.each(this.options,function(e,t){this[t]=e},this),this.collection.on("add",this.render_new_option,this),this.collection.on("remove",this.remove_existing_option,this),this.collection.on("reset",this.empty_list,this)},events:{change:"selection_changed"},empty_list:function(){this.$el.empty()},render_new_option:function(e){this.$el.append(new this.Option({model:e,value_field:this.value_field,text_field:this.text_field}).render().el)},remove_existing_option:function(e){this.$el.find("option[value='"+e.id+"']").remove()},selection_changed:function(){var t=_.map(this.$el.find(":selected"),function(t){return e(t).val()});this.collection.each(function(e){_.indexOf(t,e.id)>=0||_.indexOf(t,e.id.toString())>=0?e.set("selected",!0):e.set("selected",!1)}),this.collection.trigger("selected")},render:function(){return this.$el.empty(),this.options.include_blank&&this.$el.append("<option></option>"),this.collection.each(function(e){var t=new this.Option({model:e,value_field:this.value_field,text_field:this.text_field});this.$el.append(t.render().el)},this),this.multiple&&this.$el.prop("multiple",!0).attr("multiple","multiple"),this.width&&this.$el.width(this.width),this},Option:Backbone.View.extend({tagName:"option",model:null,initialize:function(e){this.options=e||{},_.each(this.options,function(e,t){this[t]=e},this),this.model.on("change",this.render,this)},render:function(){var e=this;return this.$el.html(this.model.get(this.text_field).replace(/\\&/g,"&").replace(/\\'/g,"'")),this.$el.prop({value:"id"==this.value_field?this.model.id:this.model.get(this.value_field)}),1==e.model.get("selected")&&this.$el.prop("selected",!0).attr("selected","selected"),this}})}),t.Views.Chosen=Backbone.View.extend({tagName:"span",initialize:function(e){this.options=e||{},this.collection=this.options.collection,this.options.include_blank=!0,this.select_tag=new t.Views.SelectTag(this.options),this.collection.on("change",this.selection_changed,this)},selection_changed:function(e){_.isUndefined(e.changed.selected)&&this.render()},render:function(){if(this.$el.append(this.select_tag.render().$el),this.options.width&&this.select_tag.$el.width(this.options.width),this.select2_opts={placeholder:this.options.placeholder},0==this.$el.parent().length){e("body").append(this.$el),this.select_tag.$el.select2(this.select2_opts);var t=this.select_tag.$el.select2("container").detach();this.$el.append(t),this.$el.detach()}else this.select_tag.$el.select2(this.select2_opts);if(this.options.multiple){var i=[];_.each(this.collection.selected_ids(),function(e){i.push(e.toString())}),0==i.length&&(i=""),this.select_tag.$el.select2("val",i)}return this.$el.find(".select2-input").width(this.options.width-20),this}}),t.DisplayTab={Models:{},Views:{},App:{}},t.Models.Remote_Collection=t.Models.SelectableItems.extend({fetch_limit:5e3,in_progress:!1,fetch_url:photocrati_ajax.url,action:"",extra_data:{},_create_request:function(e,t){var i=_.extend({},igw_data.sec_token,{action:this.action,limit:e?e:this.fetch_limit,offset:t?t:0});for(var s in this.extra_data){var l=this.extra_data[s];"undefined"==typeof i[s]&&(i[s]={}),"undefined"!=typeof l.toJSON&&(l=l.toJSON()),i[s]=_.extend(i[s],l)}return i},_add_item:function(e){this.push(e)},fetch:function(t,i){var s=this;this.in_progress=!0,e.post(this.fetch_url,this._create_request(t,i),function(e){"undefined"!=typeof _&&(_.isObject(e)||(e=JSON.parse(e)),e.items&&(_.each(e.items,function(e){s._add_item(e)}),e.total>=e.limit+e.offset?s.fetch(e.limit,e.offset+e.limit):(s.in_progress=!1,s.trigger("finished_fetching"))))})}}),t.DisplayTab.Models.Displayed_Gallery=Backbone.Model.extend({defaults:{source:null,container_ids:[],entity_ids:[],display_type:null,display_settings:{},exclusions:[],sortorder:[],slug:null},to_shortcode:function(){retval=null;var e=function(e,t){var i=e[t];if(_.isArray(i)&&(i=i.length>0?i.join(","):null),i)return i=i.toString().replace("[","&#91;"),i=i.toString().replace("]","&#93;"),t+'="'+i+'"'},i=t.DisplayTab.instance.display_types.find_by_name_or_alias(this.get("display_type")),s=this.toJSON();s.display_type=i.get_shortcode_value();var l="[ngg_images",n=null;(n=e(s,"source"))&&(l+=" "+n),(n=e(s,"container_ids"))&&(l+=" "+n),(n=e(s,"entity_ids"))&&(l+=" "+n),(n=e(s,"exclusions"))&&(l+=" "+n),(n=e(s,"sortorder"))&&(l+=" "+n);for(var a in s){var o=["source","container_ids","entity_ids","exclusions","sortorder","__defaults_set","id_field"];if(!(o.indexOf(a)>-1))if("display_settings"==a)for(var r in s[a])(n=e(s[a],r))&&(l+=" "+n);else n=e(s,a),n&&(l+=" "+n)}return l+="]"}}),t.DisplayTab.Models.Source=Backbone.Model.extend({idAttribute:"name",defaults:{title:"",name:"",selected:!1}}),t.DisplayTab.Models.Source_Collection=t.Models.SelectableItems.extend({model:t.DisplayTab.Models.Source,selected_value:function(){var e=null,t=this.selected();return t.length>0&&(e=t[0].get("name")),e},find_by_name_or_alias:function(e){return this.find(function(t){return t.get("name")==e||_.isArray(t.get("aliases"))&&t.get("aliases").indexOf(e)>-1})}}),t.DisplayTab.Models.Gallery=Backbone.Model.extend({idAttribute:igw_data.gallery_primary_key,defaults:{title:"",name:""}}),t.DisplayTab.Models.Gallery_Collection=t.Models.Remote_Collection.extend({model:t.DisplayTab.Models.Gallery,action:"get_existing_galleries"}),t.DisplayTab.Models.Album=Backbone.Model.extend({defaults:{title:"",name:""}}),t.DisplayTab.Models.Album_Collection=t.Models.Remote_Collection.extend({model:t.DisplayTab.Models.Album,action:"get_existing_albums"}),t.DisplayTab.Models.Tag=Backbone.Model.extend({defaults:{title:""}}),t.DisplayTab.Models.Tag_Collection=t.Models.Remote_Collection.extend({model:t.DisplayTab.Models.Tag,action:"get_existing_image_tags"}),t.DisplayTab.Models.Display_Type=Backbone.Model.extend({idAttribute:"name",defaults:{title:""},is_compatible_with_source:function(e){var t=!0;for(index in e.get("returns")){var i=e.get("returns")[index];if(_.indexOf(this.get("entity_types"),i)<0){t=!1;break}}return t},get_shortcode_value:function(){var e=this.id;return e}}),t.DisplayTab.Models.Display_Type_Collection=t.Models.SelectableItems.extend({model:t.DisplayTab.Models.Display_Type,selected_value:function(){var e=null,t=this.selected();return t.length>0?t[0].get("name"):e},find_by_name_or_alias:function(e){return this.find(function(t){return t.get("name")==e||_.isArray(t.get("aliases"))&&t.get("aliases").indexOf(e)>-1})}}),t.DisplayTab.Models.Entity=Backbone.Model.extend({entity_id:function(){return this.get(this.get("id_field"))},is_excluded:function(){return current_value=this.get("exclude"),!_.isUndefined(current_value)&&(_.isBoolean(current_value)?current_value:0!=parseInt(current_value))},is_included:function(){return!this.is_excluded()},is_gallery:function(){return retval=!1,1==this.get("is_gallery")&&(retval=!0),retval},is_album:function(){return retval=!1,1==this.get("is_album")&&(retval=!0),retval},is_image:function(){return!this.is_album()&&!this.is_gallery()},alttext:function(){return this.is_image()?this.get("alttext"):this.is_gallery()?this.get("title"):this.is_album()?this.get("name"):void 0}}),t.DisplayTab.Models.Entity_Collection=t.Models.Remote_Collection.extend({model:t.DisplayTab.Models.Entity,action:"get_displayed_gallery_entities",_add_item:function(e){e.exclude=1==parseInt(e.exclude),e.is_gallery=1==parseInt(e.is_gallery),e.is_album=1==parseInt(e.is_album),this.push(e)},entity_ids:function(){return this.map(function(e){return e.entity_id()})},included_ids:function(){return _.compact(this.map(function(e){if(e.is_included())return e.entity_id()}))},excluded_ids:function(){return _.compact(this.map(function(e){if(!e.is_included())return e.entity_id()}))}}),t.DisplayTab.Models.SortOrder=Backbone.Model.extend({}),t.DisplayTab.Models.SortOrder_Options=t.Models.SelectableItems.extend({model:t.DisplayTab.Models.SortOrder}),t.DisplayTab.Models.SortDirection=Backbone.Model.extend({}),t.DisplayTab.Models.SortDirection_Options=Backbone.Collection.extend({model:t.DisplayTab.Models.SortDirection}),t.DisplayTab.Models.Slug=Backbone.Model.extend({}),t.DisplayTab.Views.Source_Config=Backbone.View.extend({el:"#source_configuration",selected_view:null,initialize:function(){this.sources=t.DisplayTab.instance.sources,this.sources.on("selected",this.render,this),_.bindAll(this,"render"),this.render()},render:function(){var e=new t.Views.Chosen({id:"source_select",collection:this.sources,placeholder:"Select a source",width:500}),i=_.template('<tr><td><label><%- sources %></label></td><td id="source_column"></td></tr>');this.$el.html(i(igw_data.i18n)),this.$el.find("#source_column").append(e.render().el);var s=this.sources.selected();if(s.length){var l=_.str.capitalize(s.pop().id)+"Source";if("undefined"!=typeof t.DisplayTab.Views[l]){var n=new t.DisplayTab.Views[l];this.$el.append(n.render().el)}}return this}}),t.DisplayTab.Views.Slug_Config=Backbone.View.extend({el:"#slug_configuration",selected_view:null,initialize:function(){this.displayed_gallery=t.DisplayTab.instance.displayed_gallery,this.slug=t.DisplayTab.instance.displayed_gallery.get("slug"),this.render()},render:function(){var t=this,i=e("<input>").prop({type:"text",name:"slug",value:this.slug,placeholder:igw_data.i18n.optional,id:"field_slug"});i.on("input",function(){e(this).val(e(this).val().replace(/\s|\?|\\|\/|&|=|\[|]|#/gm,"-")),t.displayed_gallery.set("slug",e(this).val())}),i.on("change",function(){e(this).val(e(this).val().replace(/^-*/gm,"").replace(/-*$/gm,"")),t.displayed_gallery.set("slug",e(this).val())});var s=_.template('<tr><td id="slug_label"><label for="field_slug" class="tooltip" title="<%- slug_tooltip %><"><<%- slug_label %></label></td><td id="slug_column"></td></tr>');return this.$el.append(s(igw_data.i18n)),this.$el.find("#slug_column").append(i),this}}),t.DisplayTab.Views.Display_Type_Selector=Backbone.View.extend({el:"#display_type_selector",initialize:function(){this.display_types=t.DisplayTab.instance.display_types,this.display_type_order_base=t.DisplayTab.instance.display_type_order_base,this.display_type_order_step=t.DisplayTab.instance.display_type_order_step,this.sources=t.DisplayTab.instance.sources,this.render()},selection_changed:function(t){var i=null;if(this.display_types.each(function(e){e.get("name")==t?(i=e,e.set("selected",!0)):e.set("selected",!1)}),i){var s=this.sources.selected_value(),l=i.get("default_source");l&&s!=l&&(l=this.sources.where({name:l}),l.length>0&&(l=l[0],this.sources.deselect_all(),this.sources.select(l.id)))}e(".display_settings_form").each(function(){$this=e(this),$this.attr("rel")==t?$this.removeClass("hidden"):$this.addClass("hidden")})},render:function(){var t=this.sources.selected(),i=0;t=t.length>0&&t[0],this.$el.empty();var s=this.display_type_order_base,l=this.display_type_order_step;return this.display_types.each(function(n){if(t&&!n.is_compatible_with_source(t)){var a=e("#display_type_tab_content:visible");if(0==a.length)return;if("hidden"==a.css("visibility"))return}var o=new this.DisplayType;o.model=n,o.on("selected",this.selection_changed,this),this.display_types.selected_value()||(n.set("selected",!0),this.selection_changed(n.id));var r=n.get("view_order");r||(r=s);var d=Math.floor(r/l);i>0&&d>i&&this.$el.append('<li class="clear" style="height: 10px" />'),i=d,this.$el.append(o.render().el)},this),this},DisplayType:Backbone.View.extend({className:"display_type_preview",events:{click:"clicked"},clicked:function(e){this.trigger("selected",this.model.get("name"))},render:function(){var t=e('<label style="display: block; cursor: pointer;"/>').addClass("image_container"),i=this.model.get("installed_at_version"),s=photocrati_ajax.wp_plugins_url,l=this.model.get("preview_image_relpath");"undefined"==typeof i&&(s=photocrati_ajax.wp_site_url,s=s.replace(/(.*)\/index\.php$/i,"$1"),0==l.indexOf("/nextgen-gallery")&&(s=photocrati_ajax.wp_plugins_url));var n=e("<img/>").attr({src:s+"/"+l,title:this.model.get("title"),alt:this.model.get("alt")}),a=e("<div/>"),o=e("<input/>").prop({type:"radio",value:this.model.get("name"),title:this.model.get("title"),name:"display_type",checked:this.model.get("selected")});return t.append(a),t.append(n),a.append(o),a.append(this.model.get("title")),this.$el.append(t),this}})}),t.DisplayTab.Views.Preview_Area=Backbone.View.extend({el:"#preview_area",initialize:function(){this.entities=t.DisplayTab.instance.entities,this.sources=t.DisplayTab.instance.sources,this.displayed_gallery=t.DisplayTab.instance.displayed_gallery,this.entity_list=e("<ul/>").attr("id","entity_list").append('<li class="clear"/>'),this.entities.on("add",this.render_entity,this),this.entities.on("remove",this.remove_entity,this),this.entities.on("reset",this.entities_reset,this),this.entities.on("change:sortorder",function(e){this.entities.remove(e,{silent:!0}),this.entities.add(e,{at:e.changed.sortorder,silent:!0}),this.displayed_gallery.set("sortorder",this.entities.entity_ids()),"undefined"!=typeof console&&"undefined"!=typeof console.log&&console.log(this.entities.entity_ids()),this.displayed_gallery.set("order_by","sortorder")},this),this.sources.on("selected",this.render,this),this.render()},events:{opened:"entities_reset"},entities_reset:function(e){this.entities.reset(null,{silent:!0}),this.entity_list.empty().append('<li class="clear"/>'),this.entities.in_progress||this.entities.fetch()},render_entity:function(e){var t=new this.EntityElement({model:e});this.entity_list.find(".clear").before(t.render().$el),t.$el.css("visibility","hidden"),setTimeout(function(){t.$el.css("visibility","visible")},0),1==this.$el.find(".no_entities").length?this.render():this.entities.length>1&&this.entity_list.sortable("refresh")},remove_entity:function(e){var t=this.id=e.get("id_field")+"_"+e.entity_id();this.entity_list.find("#"+t).remove();this.entity_list.sortable("refresh"),0==this.entities.length&&this.render_no_images_notice()},render_no_images_notice:function(){this.$el.empty(),this.$el.append("<p class='no_entities'>"+igw_data.i18n.no_entities+"</p>")},render:function(){return this.$el.empty(),this.entities.length>0&&this.displayed_gallery.get("container_ids").length>0?(this.$el.append(new this.RefreshButton({entities:this.entities}).render().el),this.$el.append(new this.SortButtons({entities:this.entities,displayed_gallery:this.displayed_gallery,sources:this.sources}).render().el),this.$el.append(new this.ExcludeButtons({entities:this.entities}).render().el),this.$el.append(this.entity_list),this.entity_list.sortable({placeholder:"placeholder",forcePlaceholderSize:!0,containment:"parent",opacity:.7,revert:!0,dropOnEmpty:!0,start:function(e,t){return t.placeholder.css({height:t.item.height()}),!0},stop:function(e,t){t.item.trigger("drop",t.item.index())}}),this.entity_list.disableSelection()):this.render_no_images_notice(),this},RefreshButton:Backbone.View.extend({className:"refresh_button",tagName:"input",label:"Refresh",events:{click:"clicked"},clicked:function(){this.entities.reset()},initialize:function(e){this.options=e||{},_.each(this.options,function(e,t){this[t]=e},this)},render:function(){return this.$el.attr({value:this.label,type:"button"}),this}}),ExcludeButtons:Backbone.View.extend({className:"header_row",initialize:function(e){this.options=e||{},_.each(this.options,function(e,t){this[t]=e},this)},render:function(){this.$el.empty(),this.$el.append("<strong>Exclude:</strong>");var e=new this.Button({value:!0,text:"All",entities:this.entities});this.$el.append(e.render().el),this.$el.append('<span class="separator">|</span>');var t=new this.Button({value:!1,text:"None",entities:this.entities});return this.$el.append(t.render().el),this},Button:Backbone.View.extend({tagName:"a",value:1,text:"",events:{click:"clicked"},initialize:function(e){this.options=e||{},_.each(this.options,function(e,t){this[t]=e},this)},clicked:function(e){e.preventDefault(),this.entities.each(function(e){e.set("exclude",this.value)},this)},render:function(){return this.$el.text(this.text).attr("href","#"),this}})}),SortButtons:Backbone.View.extend({className:"header_row",initialize:function(e){this.options=e||{},_.each(this.options,function(e,t){this[t]=e},this),this.sortorder_options=new t.DisplayTab.Models.SortOrder_Options,this.sortorder_options.on("change:selected",this.sortoption_changed,this),this.sortdirection_options=new t.DisplayTab.Models.SortDirection_Options([{value:"ASC",title:"Ascending",selected:"ASC"==this.displayed_gallery.get("order_direction")},{value:"DESC",title:"Descending",selected:"DESC"==this.displayed_gallery.get("order_direction")}]),this.sortdirection_options.on("change:selected",this.sortdirection_changed,this),this.displayed_gallery.on("change:order_by",this.displayed_gallery_order_changed,this),this.displayed_gallery.on("change.order_direction",this.displayed_gallery_order_dir_changed,this)},populate_sorting_fields:function(){var e=this.sources.selected().pop().get("returns");_.indexOf(e,"image")!==-1?this.fill_image_sortorder_options():this.fill_gallery_sortorder_options()},create_sortorder_option:function(e,i){return new t.DisplayTab.Models.SortOrder({name:e,title:i,value:e,selected:this.displayed_gallery.get("order_by")==e})},fill_image_sortorder_options:function(){this.sortorder_options.reset(),this.sortorder_options.push(this.create_sortorder_option("","None")),this.sortorder_options.push(this.create_sortorder_option("sortorder","Custom")),this.sortorder_options.push(this.create_sortorder_option(t.DisplayTab.instance.image_key,"Image ID")),this.sortorder_options.push(this.create_sortorder_option("filename","Filename")),this.sortorder_options.push(this.create_sortorder_option("alttext","Alt/Title Text")),this.sortorder_options.push(this.create_sortorder_option("imagedate","Date/Time"))},fill_gallery_sortorder_options:function(){this.sortorder_options.reset(),this.sortorder_options.push(this.create_sortorder_option("","None")),this.sortorder_options.push(this.create_sortorder_option("sortorder","Custom")),this.sortorder_options.push(this.create_sortorder_option("name","Name")),this.sortorder_options.push(this.create_sortorder_option("galdesc","Description"))},displayed_gallery_order_changed:function(e){this.sortorder_options.findWhere({value:e.get("order_by")}).set("selected",!0)},displayed_gallery_order_dir_changed:function(e){this.sortdirection_options.findWhere({value:e.get("order_direction")}).set("selected",!0)},sortoption_changed:function(t){this.sortorder_options.each(function(e){e.set("selected",t.get("value")==e.get("value"),{silent:!0})}),this.displayed_gallery.set("sortorder",[]);var i=t.get("value");0==t.get("value").length&&(i="sortorder"),this.displayed_gallery.set("order_by",i),this.entities.reset(),this.$el.find("a.sortorder").each(function(){var i=e(this);i.attr("value")==t.get("value")?i.addClass("selected"):i.removeClass("selected")})},sortdirection_changed:function(t){this.sortdirection_options.each(function(e){e.set("selected",t.get("value")==e.get("value"),{silent:!0})}),this.displayed_gallery.set("order_direction",t.get("value")),this.entities.reset(),this.$el.find("a.sortdirection").each(function(){var i=e(this);i.attr("value")==t.get("value")?i.addClass("selected"):i.removeClass("selected")})},render:function(){return this.$el.empty(),this.populate_sorting_fields(),this.$el.append("<strong>Sort By:</strong>"),this.sortorder_options.each(function(e,t){var i=new this.Button({model:e,className:"sortorder"});this.$el.append(i.render().el),this.sortorder_options.length-1>t&&this.$el.append('<span class="separator">|</span>')},this),this.$el.append('<strong style="margin-left: 30px;">Order By:</strong>'),this.sortdirection_options.each(function(e,t){var i=new this.Button({model:e,className:"sortdirection"});this.$el.append(i.render().el),this.sortdirection_options.length-1>t&&this.$el.append('<span class="separator">|</span>')},this),this},Button:Backbone.View.extend({tagName:"a",initialize:function(e){this.options=e||{},_.each(this.options,function(e,t){this[t]=e},this)},events:{click:"clicked"},clicked:function(e){e.preventDefault(),this.model.set("selected",!0)},render:function(){return this.$el.prop({value:this.model.get("value"),href:"#"}),this.$el.text(this.model.get("title")),this.model.get("selected")&&this.$el.addClass("selected"),this}})}),EntityElement:Backbone.View.extend({tagName:"li",events:{drop:"item_dropped"},initialize:function(e){this.options=e||{},_.each(this.options,function(e,t){this[t]=e},this),this.initTime=(new Date).getTime(),this.model.on("change",this.render,this),0==this.model.get("sortorder")&&this.model.set("sortorder",-1,{silent:!0}),this.id=this.model.get("id_field")+"_"+this.model.entity_id()},item_dropped:function(e,i){t.DisplayTab.instance.displayed_gallery.set("order_by","sortorder"),this.model.set("sortorder",i)},render:function(){this.$el.empty();var t=e("<div/>").addClass("preview_item"),i=e("<div/>").addClass("image_container"),s=this.model.alttext().replace(/\\&/g,"&").replace(/\\'/g,"'"),l=this.initTime;i.attr({title:s,style:"background-image: url('"+this.model.get("thumb_url")+"?timestamp"+l+"')"}),this.$el.append(t).addClass("ui-state-default"),t.append(i);var n=e("<div/>").addClass("exclude_container"),a=e("<label/>");a.append(igw_data.i18n.exclude_question);var o=new this.ExcludeCheckbox({model:this.model});return a.append(o.render().el),n.append(a),t.append(n),this},ExcludeCheckbox:Backbone.View.extend({tagName:"input",events:{change:"entity_excluded"},type_set:!1,entity_excluded:function(e){this.model.set("exclude",e.target.checked)},initialize:function(e){this.options=e||{},_.each(this.options,function(e,t){this[t]=e},this),this.model.on("change:exclude",this.render,this)},render:function(){return this.type_set||(this.$el.attr("type","checkbox"),this.type_set=!0),this.model.is_excluded()?this.$el.prop("checked",!0):this.$el.prop("checked",!1),this}})})}),t.DisplayTab.Views.GalleriesSource=Backbone.View.extend({tagName:"tbody",initialize:function(){this.galleries=t.DisplayTab.instance.galleries},render:function(){var i=new t.Views.Chosen({collection:this.galleries,placeholder:igw_data.i18n.select_gallery,multiple:!0,width:500}),s=e("<tr><td><label>"+igw_data.i18n.galleries+'</label></td><td class="galleries_column"></td></tr>');return this.$el.empty(),this.$el.append(s),this.$el.find(".galleries_column").append(i.render().el),this}}),t.DisplayTab.Views.AlbumsSource=Backbone.View.extend({tagName:"tbody",initialize:function(){this.albums=t.DisplayTab.instance.albums},render:function(){var e=new t.Views.Chosen({collection:this.albums,multiple:!0,placeholder:"Select an album",text_field:"name",width:500});return this.$el.empty(),this.$el.append("<tr><td><label>"+igw_data.i18n.albums+'</label></td><td class="albums_column"></td></tr>'),this.$el.find(".albums_column").append(e.render().el),this}}),t.DisplayTab.Views.TagsSource=Backbone.View.extend({tagName:"tbody",initialize:function(){this.tags=t.DisplayTab.instance.tags},render:function(){var e=new t.Views.Chosen({collection:this.tags,multiple:!0,placeholder:"Select a tag",text_field:"name",width:500});return this.$el.empty(),this.$el.append('<tr><td><label>Tags</label></td><td class="tags_column"></td></tr>'),this.$el.find(".tags_column").append(e.render().el),this}}),t.DisplayTab.Views.Recent_imagesSource=Backbone.View.extend({tagName:"tbody",initialize:function(){this.displayed_gallery=t.DisplayTab.instance.displayed_gallery,this.maximum_entity_count=t.DisplayTab.instance.displayed_gallery.get("maximum_entity_count"),this.displayed_gallery.set("container_ids",[])},render:function(){var t=this,i=e("<input/>").prop({type:"text",value:this.maximum_entity_count,name:"maximum_entity_count"});return i.change(function(){t.displayed_gallery.set("maximum_entity_count",e(this).val())}),this.$el.empty(),this.$el.append('<tr><td><label># of Images To Display</label></td><td class="recent_images_column"></td></tr>'),this.$el.find(".recent_images_column").append(i),this}}),t.DisplayTab.Views.Random_imagesSource=Backbone.View.extend({tagName:"tbody",initialize:function(){this.displayed_gallery=t.DisplayTab.instance.displayed_gallery,this.maximum_entity_count=t.DisplayTab.instance.displayed_gallery.get("maximum_entity_count"),this.displayed_gallery.set("container_ids",[])},render:function(){var t=this,i=e("<input/>").prop({type:"text",value:this.maximum_entity_count,name:"maximum_entity_count"});return i.change(function(){t.displayed_gallery.set("maximum_entity_count",e(this).val())}),this.$el.empty(),this.$el.append('<tr><td><label># of Images To Display</label></td><td class="random_images_column"></td></tr>'),this.$el.find(".random_images_column").append(i),this}}),t.DisplayTab.Views.SaveButton=Backbone.View.extend({el:"#save_displayed_gallery",errors_el:"#errors",displayed_gallery:null,events:{click:"clicked"},initialize:function(){this.displayed_gallery=t.DisplayTab.instance.displayed_gallery,this.entities=t.DisplayTab.instance.entities,this.render()},clicked:function(){this.set_display_settings(),insert_into_editor(this.displayed_gallery.to_shortcode(),this.displayed_gallery.id?this.displayed_gallery.id:igw_data.shortcode_ref),close_attach_to_post_window()},set_display_settings:function(){var t=this.displayed_gallery.get("display_type");if(t){var i=e("form[rel='"+t+"']"),s=function(t){var i={};return e.each(t.serializeArray(),function(e,t){for(var s=t.name.split("["),l=i,n=0;n<s.length;n++){var a=s[n].replace(/\]$/,"");l[a]||(n==s.length-1?l[a]=t.value:l[a]={}),l=l[a]}}),i}(i);this.displayed_gallery.set("display_settings",s[t])}},render:function(){return this.$el.css("z-index",1e3),this}}),t.DisplayTab.App=Backbone.View.extend({initialize:function(){if(this.displayed_gallery=new t.DisplayTab.Models.Displayed_Gallery(igw_data.displayed_gallery),this.original_displayed_gallery=new t.DisplayTab.Models.Displayed_Gallery(igw_data.displayed_gallery),this.galleries=new t.DisplayTab.Models.Gallery_Collection(igw_data.galleries),this.albums=new t.DisplayTab.Models.Album_Collection(igw_data.albums),this.tags=new t.DisplayTab.Models.Tag_Collection(igw_data.tags),this.sources=new t.DisplayTab.Models.Source_Collection(igw_data.sources),this.display_types=new t.DisplayTab.Models.Display_Type_Collection(igw_data.display_types),this.display_type_order_base=igw_data.display_type_priority_base,this.display_type_order_step=igw_data.display_type_priority_step,this.entities=new t.DisplayTab.Models.Entity_Collection,this.entities.extra_data.displayed_gallery=this.displayed_gallery,this.image_key=igw_data.image_primary_key,this.displayed_gallery.get("source")){if(this.displayed_gallery.get("source")){var e=this.sources.find_by_name_or_alias(this.displayed_gallery.get("source"));e&&e.set("selected",!0)}if(this.displayed_gallery.get("container_ids")&&_.each(this.displayed_gallery.get("container_ids"),function(e){var t=this[this.displayed_gallery.get("source")].find(function(t){return t.id==e},this);t&&t.set("selected",!0)},this),this.displayed_gallery.get("display_type")){var i=this.display_types.find_by_name_or_alias(this.displayed_gallery.get("display_type"));i&&(i.set("selected",!0),this.displayed_gallery.set("display_type",i.get("name")))}}if(collections=["galleries","albums","tags"],_.each(collections,function(e){this[e].on("selected",function(){this.update_selected_containers(e)},this)},this),this.display_types.on("change:selected",function(){this.displayed_gallery.set("display_type",this.display_types.selected_value())},this),this.sources.on("selected",function(){this.displayed_gallery.set("source",this.sources.selected_value()),this.sources.selected_value()!=this.original_displayed_gallery.get("source")?this.displayed_gallery.set("exclusions",this.entities.excluded_ids()):this.displayed_gallery.set("exclusions",this.original_displayed_gallery.get("exclusions")),"random_images"!=this.sources.selected_value()&&"recent_images"!=this.sources.selected_value()||this.displayed_gallery.set("maximum_entity_count",20),this.galleries.deselect_all(),this.albums.deselect_all(),this.tags.deselect_all();var e=this.display_types.selected(),t=this.sources.selected();e.length>0&&t.length>0&&(e=e[0],t=t[0],e.is_compatible_with_source(t)||this.display_types.deselect_all(),this.display_type_selector&&this.display_type_selector.render()),this.preview_area&&this.preview_area.render()},this),this.entities.on("change:exclude finished_fetching",function(){this.displayed_gallery.set("exclusions",this.entities.excluded_ids())},this),window.Frame_Event_Publisher){var s=this;Frame_Event_Publisher.listen_for("attach_to_post:new_gallery",function(){s.galleries.reset(),s.galleries.fetch()}),Frame_Event_Publisher.listen_for("attach_to_post:manage_galleries attach_to_post:manage_images",function(e){s.galleries.reset(),s.galleries.fetch();var t=s.sources.selected().pop();t&&(_.indexOf(t.get("returns"),"image")>=0||_.indexOf(t.get("returns"),"gallery"))&&s.entities.reset()}),Frame_Event_Publisher.listen_for("attach_to_post:manage_album",function(e){s.albums.reset(),s.albums.fetch();var t=s.sources.selected().pop();t&&_.indexOf(t.get("returns"),"album")>=0&&s.entities.reset()}),Frame_Event_Publisher.listen_for("attach_to_post:manage_tags attach_to_post:manage_images",function(e){s.tags.reset(),s.tags.fetch();var t=s.sources.selected().pop();t&&(_.indexOf(t.get("returns"),"image")>=0||_.indexOf(t.get("returns"),"gallery"))&&s.entities.reset()}),Frame_Event_Publisher.listen_for("attach_to_post:thumbnail_modified",function(e){var t=s.sources.selected().pop(),i=e.image[e.image.id_field];if(t)if(_.indexOf(t.get("returns"),"image")>=0){var l=s.entities.find(function(e){return parseInt(e.entity_id())==parseInt(i)},this);l&&l.set("thumb_url",e.image.thumb_url)}else{var n=s.entities.find(function(e){return parseInt(e.get("previewpic"))==i},this);n&&n.trigger("change")}})}},update_selected_containers:function(e){this.displayed_gallery.set("container_ids",this[e].selected_ids())},render:function(){this.display_type_selector=new t.DisplayTab.Views.Display_Type_Selector,new t.DisplayTab.Views.Source_Config,new t.DisplayTab.Views.Slug_Config,this.preview_area=new t.DisplayTab.Views.Preview_Area,new t.DisplayTab.Views.SaveButton}}),t.DisplayTab.instance=new t.DisplayTab.App,t.DisplayTab.instance.render(),window.Ngg=t,e("span.tooltip, label.tooltip").tooltip()});
products/photocrati_nextgen/modules/attach_to_post/static/igw.js CHANGED
@@ -28,19 +28,6 @@
28
  };
29
  };
30
 
31
-
32
- window.fix_tb_dimensions = function(){
33
- var $button = $('.ngg-add-gallery');
34
- var href = $button.attr('href');
35
- var dimensions = get_igw_dimensions();
36
- href = href.replace(/width=\d+/, 'width='+dimensions.width.toString());
37
- href = href.replace(/height=\d+/, 'height='+dimensions.height.toString());
38
-
39
- $button.attr('href', href);
40
- };
41
- fix_tb_dimensions();
42
-
43
-
44
  // Restore Thickbox functionality
45
  window.wp_tb_position = window.tb_position;
46
  window.tb_position = function(){
28
  };
29
  };
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  // Restore Thickbox functionality
32
  window.wp_tb_position = window.tb_position;
33
  window.tb_position = function(){
products/photocrati_nextgen/modules/attach_to_post/static/igw.min.js CHANGED
@@ -1 +1 @@
1
- !function(t){setTimeout(function(){t(function(){window.get_igw_dimensions=function(){var i=t(".ngg-add-gallery"),n=(i.attr("href"),jQuery(top)),o=n.width(),e=n.height(),w=1200,h=600,d=800,r=600,g=o-.05*o,s=e-.05*e;return g<d&&(g=o-10),s<r&&(s=e-10),w>g&&(w=g),h>s&&(h=s),{width:w,height:h,top:(e-h)/2,left:(o-w)/2}},window.fix_tb_dimensions=function(){var i=t(".ngg-add-gallery"),n=i.attr("href"),o=get_igw_dimensions();n=n.replace(/width=\d+/,"width="+o.width.toString()),n=n.replace(/height=\d+/,"height="+o.height.toString()),i.attr("href",n)},fix_tb_dimensions(),window.wp_tb_position=window.tb_position,window.tb_position=function(){var i=t("#TB_window iframe").attr("src");if(i&&i.match("attach_to_post")){var n=get_igw_dimensions();t("#TB_window").css({width:n.width.toString()+"px",height:n.height.toString()+"px",top:n.top.toString()+"px",left:n.left.toString()+"px"}),t("#TB_window iframe").css({width:"100%",height:"93%"})}else window.wp_tb_position()}})})}(jQuery);
1
+ !function(t){setTimeout(function(){t(function(){window.get_igw_dimensions=function(){var i=t(".ngg-add-gallery"),o=(i.attr("href"),jQuery(top)),n=o.width(),w=o.height(),e=1200,h=600,r=800,d=600,g=n-.05*n,s=w-.05*w;return g<r&&(g=n-10),s<d&&(s=w-10),e>g&&(e=g),h>s&&(h=s),{width:e,height:h,top:(w-h)/2,left:(n-e)/2}},window.wp_tb_position=window.tb_position,window.tb_position=function(){var i=t("#TB_window iframe").attr("src");if(i&&i.match("attach_to_post")){var o=get_igw_dimensions();t("#TB_window").css({width:o.width.toString()+"px",height:o.height.toString()+"px",top:o.top.toString()+"px",left:o.left.toString()+"px"}),t("#TB_window iframe").css({width:"100%",height:"93%"})}else window.wp_tb_position()}})})}(jQuery);
products/photocrati_nextgen/modules/i18n/lang/nggallery.po CHANGED
@@ -404,6 +404,26 @@ msgstr ""
404
  msgid "Upload Images"
405
  msgstr ""
406
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
407
  #: products/photocrati_nextgen/modules/nextgen_addgallery_page/templates/import_folder.php:1
408
  msgid "Select a folder to import. The folder name will be used as the title of the gallery."
409
  msgstr ""
@@ -451,6 +471,10 @@ msgstr[1] ""
451
  msgid "Create a new gallery"
452
  msgstr ""
453
 
 
 
 
 
454
  #: products/photocrati_nextgen/modules/nextgen_addgallery_page/templates/upload_images.php:13
455
  msgid "Your browser doesn't have Flash, Silverlight, HTML5, or HTML4 support."
456
  msgstr ""
@@ -1147,6 +1171,10 @@ msgstr ""
1147
  msgid "link text"
1148
  msgstr ""
1149
 
 
 
 
 
1150
  #: products/photocrati_nextgen/modules/nextgen_other_options/adapter.image_options_form.php:12
1151
  msgid "Image Options"
1152
  msgstr ""
404
  msgid "Upload Images"
405
  msgstr ""
406
 
407
+ #: products/photocrati_nextgen/modules/nextgen_addgallery_page/adapter.upload_images_form.php:13
408
+ msgid "No images were uploaded successfully."
409
+ msgstr ""
410
+
411
+ #: products/photocrati_nextgen/modules/nextgen_addgallery_page/adapter.upload_images_form.php:14
412
+ msgid "1 image was uploaded successfully."
413
+ msgstr ""
414
+
415
+ #: products/photocrati_nextgen/modules/nextgen_addgallery_page/adapter.upload_images_form.php:15
416
+ msgid "{count} images were uploaded successfully."
417
+ msgstr ""
418
+
419
+ #: products/photocrati_nextgen/modules/nextgen_addgallery_page/adapter.upload_images_form.php:16
420
+ msgid "The following errors occured:"
421
+ msgstr ""
422
+
423
+ #: products/photocrati_nextgen/modules/nextgen_addgallery_page/adapter.upload_images_form.php:17
424
+ msgid "Manage gallery {name}"
425
+ msgstr ""
426
+
427
  #: products/photocrati_nextgen/modules/nextgen_addgallery_page/templates/import_folder.php:1
428
  msgid "Select a folder to import. The folder name will be used as the title of the gallery."
429
  msgstr ""
471
  msgid "Create a new gallery"
472
  msgstr ""
473
 
474
+ #: products/photocrati_nextgen/modules/nextgen_addgallery_page/templates/upload_images.php:9
475
+ msgid "Gallery title"
476
+ msgstr ""
477
+
478
  #: products/photocrati_nextgen/modules/nextgen_addgallery_page/templates/upload_images.php:13
479
  msgid "Your browser doesn't have Flash, Silverlight, HTML5, or HTML4 support."
480
  msgstr ""
1171
  msgid "link text"
1172
  msgstr ""
1173
 
1174
+ #: products/photocrati_nextgen/modules/nextgen_gallery_display/templates/no_images_found.php:1
1175
+ msgid "no images were found"
1176
+ msgstr ""
1177
+
1178
  #: products/photocrati_nextgen/modules/nextgen_other_options/adapter.image_options_form.php:12
1179
  msgid "Image Options"
1180
  msgstr ""
products/photocrati_nextgen/modules/i18n/module.i18n.php CHANGED
@@ -13,7 +13,7 @@ class M_I18N extends C_Base_Module
13
  'photocrati-i18n',
14
  'Internationalization',
15
  "Adds I18N resources and methods",
16
- '0.2',
17
  'https://www.imagely.com/languages/',
18
  'Photocrati Media',
19
  'https://www.imagely.com'
13
  'photocrati-i18n',
14
  'Internationalization',
15
  "Adds I18N resources and methods",
16
+ '0.3',
17
  'https://www.imagely.com/languages/',
18
  'Photocrati Media',
19
  'https://www.imagely.com'
products/photocrati_nextgen/modules/nextgen_addgallery_page/module.nextgen_addgallery_page.php CHANGED
@@ -15,7 +15,7 @@ class M_NextGen_AddGallery_Page extends C_Base_Module
15
  'photocrati-nextgen_addgallery_page',
16
  'NextGEN Add Gallery Page',
17
  'Provides admin page for adding a gallery and uploading images',
18
- '0.8',
19
  'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
20
  'Photocrati Media',
21
  'https://www.imagely.com'
15
  'photocrati-nextgen_addgallery_page',
16
  'NextGEN Add Gallery Page',
17
  'Provides admin page for adding a gallery and uploading images',
18
+ '0.9',
19
  'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
20
  'Photocrati Media',
21
  'https://www.imagely.com'
products/photocrati_nextgen/modules/nextgen_addgallery_page/package.module.nextgen_addgallery_page.php CHANGED
@@ -385,7 +385,7 @@ class A_Upload_Images_Form extends Mixin
385
  }
386
  function get_i18n_strings()
387
  {
388
- return array('no_image_uploaded' => __('No images were uploaded successfully.', 'nggallery'), 'one_image_uploaded' => __('1 image was uploaded successfully.', 'nggallery'), 'x_images_uploaded' => __('{count} images were uploaded successfully.', 'nggallery'), 'image_errors' => __('The following errors occured:', 'nggallery'), 'manage_gallery' => __('Manage gallery', 'nggallery'));
389
  }
390
  /**
391
  * Plupload stores its i18n JS *mostly* as "en.js" or "ar.js" - but some as zh_CN.js so we must check both if the
385
  }
386
  function get_i18n_strings()
387
  {
388
+ return array('no_image_uploaded' => __('No images were uploaded successfully.', 'nggallery'), 'one_image_uploaded' => __('1 image was uploaded successfully.', 'nggallery'), 'x_images_uploaded' => __('{count} images were uploaded successfully.', 'nggallery'), 'image_errors' => __('The following errors occured:', 'nggallery'), 'manage_gallery' => __('Manage gallery {name}', 'nggallery'));
389
  }
390
  /**
391
  * Plupload stores its i18n JS *mostly* as "en.js" or "ar.js" - but some as zh_CN.js so we must check both if the
products/photocrati_nextgen/modules/nextgen_addgallery_page/templates/import_media_library.php CHANGED
@@ -7,7 +7,7 @@
7
  <option value="<?php echo esc_attr($gallery->{$gallery->id_field}) ?>"><?php echo esc_attr($gallery->title) ?></option>
8
  <?php endforeach ?>
9
  </select>
10
- <input type="text" id="ngg-importML-gallery-name" name="gallery_name"/>
11
  </div>
12
 
13
  <button id='ngg-importML-select-opener'
7
  <option value="<?php echo esc_attr($gallery->{$gallery->id_field}) ?>"><?php echo esc_attr($gallery->title) ?></option>
8
  <?php endforeach ?>
9
  </select>
10
+ <input type="text" id="ngg-importML-gallery-name" name="gallery_name" placeholder="<?php _e('Gallery title', 'nggallery'); ?>"/>
11
  </div>
12
 
13
  <button id='ngg-importML-select-opener'
products/photocrati_nextgen/modules/nextgen_addgallery_page/templates/upload_images.php CHANGED
@@ -6,7 +6,7 @@
6
  <option value="<?php echo esc_attr($gallery->{$gallery->id_field}) ?>"><?php echo esc_attr($gallery->title) ?></option>
7
  <?php endforeach ?>
8
  </select>
9
- <input type="text" id="gallery_name" name="gallery_name"/>
10
  </div>
11
 
12
  <div id="uploader">
@@ -173,6 +173,8 @@
173
  msg = NggUploadImages_i18n.no_images_uploaded;
174
  }
175
  else {
 
 
176
  msg = upload_count == 1 ? NggUploadImages_i18n.one_image_uploaded : NggUploadImages_i18n.x_images_uploaded;
177
  msg = msg.replace('{count}', upload_count);
178
 
@@ -192,7 +194,7 @@
192
  href: gallery_url,
193
  target: '_blank'
194
  });
195
- $link.text(NggUploadImages_i18n.manage_gallery);
196
  msg = msg + ' ' + $link[0].outerHTML;
197
  }
198
  }
6
  <option value="<?php echo esc_attr($gallery->{$gallery->id_field}) ?>"><?php echo esc_attr($gallery->title) ?></option>
7
  <?php endforeach ?>
8
  </select>
9
+ <input type="text" id="gallery_name" name="gallery_name" placeholder="<?php _e('Gallery title', 'nggallery'); ?>"/>
10
  </div>
11
 
12
  <div id="uploader">
173
  msg = NggUploadImages_i18n.no_images_uploaded;
174
  }
175
  else {
176
+
177
+
178
  msg = upload_count == 1 ? NggUploadImages_i18n.one_image_uploaded : NggUploadImages_i18n.x_images_uploaded;
179
  msg = msg.replace('{count}', upload_count);
180
 
194
  href: gallery_url,
195
  target: '_blank'
196
  });
197
+ $link.text(NggUploadImages_i18n.manage_gallery.replace('{name}', $gallery_name.val()));
198
  msg = msg + ' ' + $link[0].outerHTML;
199
  }
200
  }
products/photocrati_nextgen/modules/nextgen_basic_album/module.nextgen_basic_album.php CHANGED
@@ -18,7 +18,7 @@ class M_NextGen_Basic_Album extends C_Base_Module
18
  'photocrati-nextgen_basic_album',
19
  'NextGEN Basic Album',
20
  "Provides support for NextGEN's Basic Album",
21
- '0.16',
22
  'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
23
  'Photocrati Media',
24
  'https://www.imagely.com'
18
  'photocrati-nextgen_basic_album',
19
  'NextGEN Basic Album',
20
  "Provides support for NextGEN's Basic Album",
21
+ '0.17',
22
  'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
23
  'Photocrati Media',
24
  'https://www.imagely.com'
products/photocrati_nextgen/modules/nextgen_basic_album/package.module.nextgen_basic_album.php CHANGED
@@ -152,8 +152,10 @@ class A_NextGen_Album_Breadcrumbs extends Mixin
152
  }
153
  if (!$gallery_found) {
154
  $gallery = C_Gallery_Mapper::get_instance()->find($gallery_id);
155
- $found[] = $gallery;
156
- $this->breadcrumb_cache[$gallery->{$gallery->id_field}] = $gallery;
 
 
157
  }
158
  }
159
  $crumbs = array();
152
  }
153
  if (!$gallery_found) {
154
  $gallery = C_Gallery_Mapper::get_instance()->find($gallery_id);
155
+ if ($gallery != null) {
156
+ $found[] = $gallery;
157
+ $this->breadcrumb_cache[$gallery->{$gallery->id_field}] = $gallery;
158
+ }
159
  }
160
  }
161
  $crumbs = array();
products/photocrati_nextgen/modules/nextgen_data/module.nextgen_data.php CHANGED
@@ -15,7 +15,7 @@ class M_NextGen_Data extends C_Base_Module
15
  'photocrati-nextgen-data',
16
  'NextGEN Data Tier',
17
  "Provides a data tier for NextGEN gallery based on the DataMapper module",
18
- '0.13',
19
  'https://www.imagely.com',
20
  'Photocrati Media',
21
  'https://www.imagely.com'
15
  'photocrati-nextgen-data',
16
  'NextGEN Data Tier',
17
  "Provides a data tier for NextGEN gallery based on the DataMapper module",
18
+ '0.14',
19
  'https://www.imagely.com',
20
  'Photocrati Media',
21
  'https://www.imagely.com'
products/photocrati_nextgen/modules/nextgen_data/package.module.nextgen_data.php CHANGED
@@ -3720,8 +3720,11 @@ class Mixin_NggLegacy_GalleryStorage_Driver extends Mixin
3720
  echo sprintf(__('Failed to copy database row for picture %s', 'nggallery'), $old_pid) . '<br />';
3721
  continue;
3722
  }
 
 
 
3723
  // Copy each image size
3724
- foreach ($this->object->get_image_sizes() as $size) {
3725
  // if backups are off there's no backup file to copy
3726
  if (!C_NextGen_Settings::get_instance()->imgBackup && $size == 'backup') {
3727
  continue;
3720
  echo sprintf(__('Failed to copy database row for picture %s', 'nggallery'), $old_pid) . '<br />';
3721
  continue;
3722
  }
3723
+ // 'backup' is not included in get_image_sizes()
3724
+ $sizes = $this->object->get_image_sizes();
3725
+ $sizes[] = 'backup';
3726
  // Copy each image size
3727
+ foreach ($sizes as $size) {
3728
  // if backups are off there's no backup file to copy
3729
  if (!C_NextGen_Settings::get_instance()->imgBackup && $size == 'backup') {
3730
  continue;
products/photocrati_nextgen/modules/nextgen_gallery_display/module.nextgen_gallery_display.php CHANGED
@@ -16,7 +16,7 @@ class M_Gallery_Display extends C_Base_Module
16
  'photocrati-nextgen_gallery_display',
17
  'Gallery Display',
18
  'Provides the ability to display gallery of images',
19
- '0.15',
20
  'https://www.imagely.com',
21
  'Photocrati Media',
22
  'https://www.imagely.com'
16
  'photocrati-nextgen_gallery_display',
17
  'Gallery Display',
18
  'Provides the ability to display gallery of images',
19
+ '0.16',
20
  'https://www.imagely.com',
21
  'Photocrati Media',
22
  'https://www.imagely.com'
products/photocrati_nextgen/modules/nextgen_gallery_display/package.module.nextgen_gallery_display.php CHANGED
@@ -1523,7 +1523,7 @@ class Mixin_Displayed_Gallery_Renderer extends Mixin
1523
  // Get the NextGEN settings to provide some defaults
1524
  $settings = C_NextGen_Settings::get_instance();
1525
  // Configure the arguments
1526
- $defaults = array('id' => NULL, 'source' => '', 'container_ids' => array(), 'gallery_ids' => array(), 'album_ids' => array(), 'tag_ids' => array(), 'display_type' => '', 'exclusions' => array(), 'order_by' => $settings->galSort, 'order_direction' => $settings->galSortOrder, 'image_ids' => array(), 'entity_ids' => array(), 'tagcloud' => FALSE, 'returns' => 'included', 'slug' => NULL);
1527
  $args = shortcode_atts($defaults, $params);
1528
  // Are we loading a specific displayed gallery that's persisted?
1529
  $mapper = C_Displayed_Gallery_Mapper::get_instance();
@@ -1570,6 +1570,9 @@ class Mixin_Displayed_Gallery_Renderer extends Mixin
1570
  if (!is_array($args['entity_ids'])) {
1571
  $args['entity_ids'] = preg_split("/,|\\|/", $args['entity_ids']);
1572
  }
 
 
 
1573
  // Get the display settings
1574
  foreach (array_keys($defaults) as $key) {
1575
  unset($params[$key]);
1523
  // Get the NextGEN settings to provide some defaults
1524
  $settings = C_NextGen_Settings::get_instance();
1525
  // Configure the arguments
1526
+ $defaults = array('id' => NULL, 'source' => '', 'container_ids' => array(), 'gallery_ids' => array(), 'album_ids' => array(), 'tag_ids' => array(), 'display_type' => '', 'exclusions' => array(), 'order_by' => $settings->galSort, 'order_direction' => $settings->galSortOrder, 'image_ids' => array(), 'entity_ids' => array(), 'tagcloud' => FALSE, 'returns' => 'included', 'slug' => NULL, 'sortorder' => array());
1527
  $args = shortcode_atts($defaults, $params);
1528
  // Are we loading a specific displayed gallery that's persisted?
1529
  $mapper = C_Displayed_Gallery_Mapper::get_instance();
1570
  if (!is_array($args['entity_ids'])) {
1571
  $args['entity_ids'] = preg_split("/,|\\|/", $args['entity_ids']);
1572
  }
1573
+ if (!is_array($args['sortorder'])) {
1574
+ $args['sortorder'] = preg_split("/,|\\|/", $args['sortorder']);
1575
+ }
1576
  // Get the display settings
1577
  foreach (array_keys($defaults) as $key) {
1578
  unset($params[$key]);
products/photocrati_nextgen/modules/nextgen_gallery_display/templates/no_images_found.php CHANGED
@@ -1 +1 @@
1
- <p>no images were found</p>
1
+ <p><?php esc_html_e('no images were found', 'nextgen-gallery'); ?></p>
products/photocrati_nextgen/modules/nextgen_gallery_display/templates/show_altview_link.php CHANGED
@@ -13,7 +13,7 @@
13
  name='<?php echo esc_attr($display_type_name); ?>[show_alternative_view_link]'
14
  class='show_altview_link'
15
  value='1'
16
- <?php echo checked(1, intval($show_alternative_view_link)); ?>'>
17
  <label for='<?php echo esc_attr($display_type_name); ?>_show_altview_link'>Yes</label>
18
  &nbsp;
19
  <input type="radio"
13
  name='<?php echo esc_attr($display_type_name); ?>[show_alternative_view_link]'
14
  class='show_altview_link'
15
  value='1'
16
+ <?php echo checked(1, intval($show_alternative_view_link)); ?>>
17
  <label for='<?php echo esc_attr($display_type_name); ?>_show_altview_link'>Yes</label>
18
  &nbsp;
19
  <input type="radio"
products/photocrati_nextgen/modules/nextgen_gallery_display/templates/show_return_link.php CHANGED
@@ -13,7 +13,7 @@
13
  name='<?php echo esc_attr($display_type_name); ?>[show_return_link]'
14
  class='show_return_link'
15
  value='1'
16
- <?php echo checked(1, intval($show_return_link)); ?>'>
17
  <label for='<?php echo esc_attr($display_type_name); ?>_show_return_link'>Yes</label>
18
  &nbsp;
19
  <input type="radio"
13
  name='<?php echo esc_attr($display_type_name); ?>[show_return_link]'
14
  class='show_return_link'
15
  value='1'
16
+ <?php echo checked(1, intval($show_return_link)); ?>>
17
  <label for='<?php echo esc_attr($display_type_name); ?>_show_return_link'>Yes</label>
18
  &nbsp;
19
  <input type="radio"
products/photocrati_nextgen/modules/nextgen_other_options/package.module.nextgen_other_options.php CHANGED
@@ -510,7 +510,8 @@ class A_Stylesheet_Ajax_Actions extends Mixin
510
  $retval = array();
511
  if ($this->object->_authorized_for_stylesheet_action()) {
512
  $styles = C_NextGen_Style_Manager::get_instance();
513
- $abspath = $styles->find_selected_stylesheet_abspath($this->object->param('cssfile'));
 
514
  $writepath = $styles->get_selected_stylesheet_saved_abspath($this->object->param('cssfile'));
515
  if (is_readable($abspath)) {
516
  $retval['contents'] = file_get_contents($abspath);
510
  $retval = array();
511
  if ($this->object->_authorized_for_stylesheet_action()) {
512
  $styles = C_NextGen_Style_Manager::get_instance();
513
+ $cssfile = str_replace('..', '', $this->object->param('cssfile'));
514
+ $abspath = $styles->find_selected_stylesheet_abspath($cssfile);
515
  $writepath = $styles->get_selected_stylesheet_saved_abspath($this->object->param('cssfile'));
516
  if (is_readable($abspath)) {
517
  $retval['contents'] = file_get_contents($abspath);
products/photocrati_nextgen/modules/nextgen_other_options/templates/watermarks_tab.php CHANGED
@@ -41,7 +41,7 @@
41
  <td><input type="radio" name="watermark_options[wmPos]" value="botRight" <?php checked('botRight', $position); ?>/></td>
42
  </tr>
43
  </table>
44
- </td
45
  </tr>
46
 
47
  <tr class="watermark_field hidden">
41
  <td><input type="radio" name="watermark_options[wmPos]" value="botRight" <?php checked('botRight', $position); ?>/></td>
42
  </tr>
43
  </table>
44
+ </td>
45
  </tr>
46
 
47
  <tr class="watermark_field hidden">
products/photocrati_nextgen/modules/ngglegacy/admin/manage-images.php CHANGED
@@ -163,7 +163,7 @@ jQuery(function (){
163
  jQuery('#spinner').fadeIn();
164
  jQuery('#spinner').position({ my: "center", at: "center", of: container });
165
 
166
- var dialog = jQuery('<div class="ngg-overlay-dialog" style="display:hidden"></div>').appendTo('body');
167
  // load the remote content
168
  dialog.load(
169
  this.href,
163
  jQuery('#spinner').fadeIn();
164
  jQuery('#spinner').position({ my: "center", at: "center", of: container });
165
 
166
+ var dialog = jQuery('<div class="ngg-overlay-dialog"></div>').appendTo('body');
167
  // load the remote content
168
  dialog.load(
169
  this.href,
products/photocrati_nextgen/modules/ngglegacy/admin/media-upload.php CHANGED
@@ -190,7 +190,7 @@ if ($chromeless)
190
  ?>
191
 
192
  <div class="alignleft actions">
193
- <select id="select_gal" name="select_gal" style="width:120px;">;
194
  <option value="0" <?php selected('0', $galleryID); ?> ><?php esc_attr( _e('No gallery',"nggallery") ); ?></option>
195
  <?php
196
  // Show gallery selection
190
  ?>
191
 
192
  <div class="alignleft actions">
193
+ <select id="select_gal" name="select_gal" style="width:120px;">
194
  <option value="0" <?php selected('0', $galleryID); ?> ><?php esc_attr( _e('No gallery',"nggallery") ); ?></option>
195
  <?php
196
  // Show gallery selection
products/photocrati_nextgen/modules/ngglegacy/module.ngglegacy.php CHANGED
@@ -16,7 +16,7 @@ class M_NggLegacy extends C_Base_Module
16
  'photocrati-nextgen-legacy',
17
  'NextGEN Legacy',
18
  'Embeds the original version of NextGEN 1.9.3 by Alex Rabe',
19
- '0.17',
20
  'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
21
  'Photocrati Media',
22
  'https://www.imagely.com'
16
  'photocrati-nextgen-legacy',
17
  'NextGEN Legacy',
18
  'Embeds the original version of NextGEN 1.9.3 by Alex Rabe',
19
+ '0.18',
20
  'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
21
  'Photocrati Media',
22
  'https://www.imagely.com'
products/photocrati_nextgen/modules/router/module.router.php CHANGED
@@ -8,7 +8,7 @@ class M_Router extends C_Base_Module
8
  'photocrati-router',
9
  'Router for Pope',
10
  'Provides routing capabilities for Pope modules',
11
- '0.8',
12
  'https://www.imagely.com',
13
  'Photocrati Media',
14
  'https://www.imagely.com'
8
  'photocrati-router',
9
  'Router for Pope',
10
  'Provides routing capabilities for Pope modules',
11
+ '0.9',
12
  'https://www.imagely.com',
13
  'Photocrati Media',
14
  'https://www.imagely.com'
products/photocrati_nextgen/modules/router/package.module.router.php CHANGED
@@ -731,7 +731,7 @@ class Mixin_Routing_App extends Mixin
731
  if ($segment) {
732
  $retval = array('segment' => $matches[0], 'source' => $source_name);
733
  } else {
734
- $retval = $matches['value'];
735
  }
736
  $found = TRUE;
737
  break;
731
  if ($segment) {
732
  $retval = array('segment' => $matches[0], 'source' => $source_name);
733
  } else {
734
+ $retval = $this->object->recursive_stripslashes($matches['value']);
735
  }
736
  $found = TRUE;
737
  break;
products/photocrati_nextgen/modules/third_party_compat/module.third_party_compat.php CHANGED
@@ -7,7 +7,7 @@ class M_Third_Party_Compat extends C_Base_Module
7
  'photocrati-third_party_compat',
8
  'Third Party Compatibility',
9
  "Adds Third party compatibility hacks, adjustments, and modifications",
10
- '0.5',
11
  'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
12
  'Photocrati Media',
13
  'https://www.imagely.com'
@@ -97,7 +97,7 @@ class M_Third_Party_Compat extends C_Base_Module
97
  add_action('init', array(&$this, 'flattr'), PHP_INT_MAX);
98
  add_action('wp', array(&$this, 'bjlazyload'), PHP_INT_MAX);
99
 
100
- add_action('admin_init', array($this, 'excellent_themes_admin'), -10);
101
 
102
  add_action('plugins_loaded', array(&$this, 'wpml'), PHP_INT_MAX);
103
  add_action('plugins_loaded', array(&$this, 'wpml_translation_management'), PHP_INT_MAX);
@@ -111,11 +111,8 @@ class M_Third_Party_Compat extends C_Base_Module
111
  add_filter('get_the_excerpt', array($this, 'enable_galleries_in_excerpts'), PHP_INT_MAX-1);
112
  add_action('debug_bar_enqueue_scripts', array($this, 'no_debug_bar'));
113
  add_filter('ngg_non_minified_modules', array($this, 'dont_minify_nextgen_pro_cssjs'));
114
- add_filter('run_ngg_resource_manager', array($this, 'check_woocommerce_download'));
115
- add_filter('run_ngg_resource_manager', array($this, 'check_wpecommerce_download'));
116
- add_filter('run_ngg_resource_manager', array($this, 'check_mafs_download'));
117
- add_filter('run_ngg_resource_manager', array($this, 'check_wps_download'));
118
  add_filter('ngg_atp_show_display_type', array($this, 'atp_check_pro_albums'), 10, 2);
 
119
 
120
  // WPML fix
121
  if (class_exists('SitePress')) {
@@ -128,6 +125,41 @@ class M_Third_Party_Compat extends C_Base_Module
128
  add_action('the_post', array(&$this, 'add_ngg_pro_page_parameter'));
129
  }
130
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  /**
132
  * This style causes problems with Excellent Themes admin settings
133
  */
@@ -153,60 +185,6 @@ class M_Third_Party_Compat extends C_Base_Module
153
  return $available;
154
  }
155
 
156
- /**
157
- * Determine if the requested URL is a WP-Photo-Seller download and adjust the resource manager
158
- *
159
- * @param bool $valid_request
160
- * @return bool
161
- */
162
- function check_wps_download($valid_request = TRUE)
163
- {
164
- if (class_exists('WPS') && isset($_REQUEST['wps_file_dl']) && $_REQUEST['wps_file_dl'] == '1')
165
- $valid_request = FALSE;
166
- return $valid_request;
167
- }
168
-
169
- /**
170
- * Determine if the requested URL is a Multiverso Advanced File Sharing download and adjust the resource manager
171
- *
172
- * @param bool $valid_request
173
- * @return bool
174
- */
175
- function check_mafs_download($valid_request = TRUE)
176
- {
177
- if (function_exists('mv_install') && isset($_GET['upf']) && isset($_GET['id']))
178
- $valid_request = FALSE;
179
- return $valid_request;
180
- }
181
-
182
- /**
183
- * Determine if the requested URL is a WooCommerce download and adjust the resource manager
184
- *
185
- * Our resource manager's output buffers conflict with Woo's use of output buffers to handle chunked reading of
186
- * large files in WC_Download_Handler::readfile_chunked()
187
- * @param bool $valid_request
188
- * @return bool
189
- */
190
- function check_woocommerce_download($valid_request = TRUE)
191
- {
192
- if (class_exists('WC_Download_Handler') && isset($_GET['download_file']) && isset($_GET['order']) && isset($_GET['email']))
193
- $valid_request = FALSE;
194
- return $valid_request;
195
- }
196
-
197
- /**
198
- * Determine if the requested URL is a WPE-Commerce download and adjust the resource manager
199
- *
200
- * @param bool $valid_request
201
- * @return bool
202
- */
203
- function check_wpecommerce_download($valid_request = TRUE)
204
- {
205
- if (function_exists('wpsc_download_file') && isset($_GET['downloadid']))
206
- $valid_request = FALSE;
207
- return $valid_request;
208
- }
209
-
210
  function no_debug_bar()
211
  {
212
  if (M_Attach_To_Post::is_atp_url()) {
7
  'photocrati-third_party_compat',
8
  'Third Party Compatibility',
9
  "Adds Third party compatibility hacks, adjustments, and modifications",
10
+ '0.6',
11
  'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
12
  'Photocrati Media',
13
  'https://www.imagely.com'
97
  add_action('init', array(&$this, 'flattr'), PHP_INT_MAX);
98
  add_action('wp', array(&$this, 'bjlazyload'), PHP_INT_MAX);
99
 
100
+ add_action('admin_init', array($this, 'excellent_themes_admin'), -10);
101
 
102
  add_action('plugins_loaded', array(&$this, 'wpml'), PHP_INT_MAX);
103
  add_action('plugins_loaded', array(&$this, 'wpml_translation_management'), PHP_INT_MAX);
111
  add_filter('get_the_excerpt', array($this, 'enable_galleries_in_excerpts'), PHP_INT_MAX-1);
112
  add_action('debug_bar_enqueue_scripts', array($this, 'no_debug_bar'));
113
  add_filter('ngg_non_minified_modules', array($this, 'dont_minify_nextgen_pro_cssjs'));
 
 
 
 
114
  add_filter('ngg_atp_show_display_type', array($this, 'atp_check_pro_albums'), 10, 2);
115
+ add_filter('run_ngg_resource_manager', array($this, 'run_ngg_resource_manager'));
116
 
117
  // WPML fix
118
  if (class_exists('SitePress')) {
125
  add_action('the_post', array(&$this, 'add_ngg_pro_page_parameter'));
126
  }
127
 
128
+ /**
129
+ * Some other plugins output content and die(); this causes problems with our resource manager which uses output buffering
130
+ *
131
+ * @param bool $valid_request
132
+ * @return bool
133
+ */
134
+ function run_ngg_resource_manager($valid_request = TRUE)
135
+ {
136
+ // WP-Post-To-PDF-Enhanced
137
+ if (class_exists('wpptopdfenh') && !empty($_GET['format']))
138
+ $valid_request = FALSE;
139
+
140
+ // WP-Photo-Seller download
141
+ if (class_exists('WPS') && isset($_REQUEST['wps_file_dl']) && $_REQUEST['wps_file_dl'] == '1')
142
+ $valid_request = FALSE;
143
+
144
+ // Multiverso Advanced File Sharing download
145
+ if (function_exists('mv_install') && isset($_GET['upf']) && isset($_GET['id']))
146
+ $valid_request = FALSE;
147
+
148
+ // WooCommerce downloads
149
+ if (class_exists('WC_Download_Handler') && isset($_GET['download_file']) && isset($_GET['order']) && isset($_GET['email']))
150
+ $valid_request = FALSE;
151
+
152
+ // WP-E-Commerce
153
+ if (isset($_GET['wpsc_download_id']) || (function_exists('wpsc_download_file') && isset($_GET['downloadid'])))
154
+ $valid_request = FALSE;
155
+
156
+ // Easy Digital Downloads
157
+ if (function_exists('edd_process_download') && (isset($_GET['download_id']) || isset($_GET['download'])))
158
+ $valid_request = FALSE;
159
+
160
+ return $valid_request;
161
+ }
162
+
163
  /**
164
  * This style causes problems with Excellent Themes admin settings
165
  */
185
  return $available;
186
  }
187
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188
  function no_debug_bar()
189
  {
190
  if (M_Attach_To_Post::is_atp_url()) {
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: photocrati, imagely
3
  Tags: nextgen, nextgen gallery, gallery, galleries, image, images, image gallery, photo, photos, photo gallery, picture, pictures, picture gallery, album, albums, photo albums, image album, media, media gallery, thumbnails, thumbnail gallery, thumbnail galleries, slideshow, slideshows, slideshow gallery, slideshow galleries, fancybox, lightbox, responsive, responsive gallery, responsive galleries, wordpress responsive gallery, nextcellent, wordpress gallery plugin, wordpress photo gallery plugin, wp gallery, wp gallery plugins, best gallery plugin, free photo gallery, singlepic, image captions imagebrowser, watermarks, watermarking, photography, photographer
4
  Requires at least: 4.0.0
5
- Stable tag: 2.1.56
6
  Tested up to: 4.6.1
7
  License: GPLv2
8
 
@@ -187,6 +187,22 @@ For more information, feel free to visit the official website for the NextGEN Ga
187
 
188
  == Changelog ==
189
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
  = V2.1.56 - 10.27.2016 =
191
  * Fixed: Shortcode parsing was affecting third-party shortcodes
192
 
2
  Contributors: photocrati, imagely
3
  Tags: nextgen, nextgen gallery, gallery, galleries, image, images, image gallery, photo, photos, photo gallery, picture, pictures, picture gallery, album, albums, photo albums, image album, media, media gallery, thumbnails, thumbnail gallery, thumbnail galleries, slideshow, slideshows, slideshow gallery, slideshow galleries, fancybox, lightbox, responsive, responsive gallery, responsive galleries, wordpress responsive gallery, nextcellent, wordpress gallery plugin, wordpress photo gallery plugin, wp gallery, wp gallery plugins, best gallery plugin, free photo gallery, singlepic, image captions imagebrowser, watermarks, watermarking, photography, photographer
4
  Requires at least: 4.0.0
5
+ Stable tag: 2.1.57
6
  Tested up to: 4.6.1
7
  License: GPLv2
8
 
187
 
188
  == Changelog ==
189
 
190
+ = V2.1.57 - 11.14.2016 =
191
+ * Changed: Display type icons are now clickable in the Insert Gallery Window
192
+ * Changed: Include backup image files when coping/moving a gallery
193
+ * Changed: Show gallery name in upload notification
194
+ * Changed: Added placeholder text to gallery name field on Add Gallery / Upload Images page
195
+ * Fixed: Custom sortorder not preserved in shortcode
196
+ * Fixed: Shortcodes added via Insert Gallery Window displayed as []
197
+ * Fixed: Uncaught TypeError: Cannot read property 'replace' of undefined
198
+ * Fixed: Use of deprecated Yoast SEO (aka WPSEO) filter
199
+ * Fixed: Conflict with Easy Digital Downloads
200
+ * Fixed: Misc invalid HTML tags in admin pages (thanks to kniebremser)
201
+ * Fixed: Change display:hidden to visibility:hidden in various places
202
+ * Fixed: Escaping of quotes in gallery titles and urls
203
+ * Fixed: Untranslatable strings
204
+
205
+
206
  = V2.1.56 - 10.27.2016 =
207
  * Fixed: Shortcode parsing was affecting third-party shortcodes
208