Document Gallery - Version 4.4

Version Description

  • Enhancement: Document Gallery updated to support integration with WP Real Media Library. Simply install the RML/DG helper plugin to use your RML folders right from Document Gallery!
Download this release

Release Info

Developer dan.rossiter
Plugin Icon 128x128 Document Gallery
Version 4.4
Comparing to
See all releases

Code changes from version 4.3.2 to 4.4

CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
  # Changelog
2
 
 
 
 
 
 
 
3
  ## 4.3.2
4
  * **Bug Fix:** Bug in editing gallery from post editor has been resolved.
5
  * **Note:** Minimum WordPress version has been bumped from 4.1 to 4.2.
1
  # Changelog
2
 
3
+ ## 4.4
4
+ * **Enhancement:** Document Gallery updated to support integration with
5
+ [WP Real Media Library](https://codecanyon.net/item/wordpress-real-media-library-media-categories-folders/13155134).
6
+ Simply install the [RML/DG helper plugin](https://wordpress.org/plugins/dg-real-media-library/) to use your RML
7
+ folders right from Document Gallery!
8
+
9
  ## 4.3.2
10
  * **Bug Fix:** Bug in editing gallery from post editor has been resolved.
11
  * **Note:** Minimum WordPress version has been bumped from 4.1 to 4.2.
README.txt CHANGED
@@ -4,7 +4,7 @@ Tags: attachments, library, thumbnail, documents, gallery, word, pdf
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=EE5LWRLG933EN&lc=US&item_name=Document%20Gallery%20Plugin&item_number=document%2dgallery&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
5
  Requires at least: 4.2
6
  Tested up to: 4.7
7
- Stable tag: 4.3.2
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -22,6 +22,11 @@ Watch the following video for a brief demonstration of Document Gallery in actio
22
 
23
  Read more in the **Installation** tab!
24
 
 
 
 
 
 
25
  = Translation =
26
 
27
  Document Gallery has to-date been translated into **6** languages, listed below.
@@ -352,6 +357,18 @@ CSS being loaded by returning false in `dg_use_default_gallery_style` filter, li
352
  *NOTE: By design, this will **NOT** disable inclusion of any custom CSS set at
353
  `Dashboard -> Settings -> Document Gallery`*
354
 
 
 
 
 
 
 
 
 
 
 
 
 
355
  == Frequently Asked Questions ==
356
 
357
 
@@ -422,6 +439,12 @@ To see a list of features planned for the future as well as to propose your own
422
  ideas for future Document Gallery development, take a look at our
423
  [issue tracker](https://github.com/thenadz/document-gallery/issues).
424
 
 
 
 
 
 
 
425
  = 4.3.2 =
426
  * **Bug Fix:** Bug in editing gallery from post editor has been resolved.
427
  * **Note:** Minimum WordPress version has been bumped from 4.1 to 4.2.
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=EE5LWRLG933EN&lc=US&item_name=Document%20Gallery%20Plugin&item_number=document%2dgallery&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
5
  Requires at least: 4.2
6
  Tested up to: 4.7
7
+ Stable tag: 4.4
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
22
 
23
  Read more in the **Installation** tab!
24
 
25
+ = Partners =
26
+
27
+ * **WP Real Media Library**: Document Gallery seamlessly integrates with RML by way of a
28
+ [helper plugin](https://wordpress.org/plugins/dg-real-media-library/).
29
+
30
  = Translation =
31
 
32
  Document Gallery has to-date been translated into **6** languages, listed below.
357
  *NOTE: By design, this will **NOT** disable inclusion of any custom CSS set at
358
  `Dashboard -> Settings -> Document Gallery`*
359
 
360
+ **Modify Gallery Query**
361
+
362
+ If you wish to modify the query used by Document Gallery to retrieve attachments to be included in a gallery then
363
+ the `dg_query` action allows you to do exactly that. The signature for the action
364
+ is `function dg_query(&$query, $taxa, &$excluded_keys, &$errs)`. Each parameter is described below:
365
+
366
+ * **&$query**: This is the query to be modified as documented in [WordPress Codex](https://codex.wordpress.org/Class_Reference/WP_Query).
367
+ * **$taxa**: The list of key/value pairs for arguments passed into `[dg]` that do not match known keys.
368
+ * **&$excluded_keys**: The list of keys to not be processed by DG. If your extension uses a key and is not intended for
369
+ DG to process, then the key should be added to this list.
370
+ * **&$errs**: The list of errors. If something goes wrong, this list should be appended with a description of what happened.
371
+
372
  == Frequently Asked Questions ==
373
 
374
 
439
  ideas for future Document Gallery development, take a look at our
440
  [issue tracker](https://github.com/thenadz/document-gallery/issues).
441
 
442
+ = 4.4 =
443
+ * **Enhancement:** Document Gallery updated to support integration with
444
+ [WP Real Media Library](https://codecanyon.net/item/wordpress-real-media-library-media-categories-folders/13155134).
445
+ Simply install the [RML/DG helper plugin](https://wordpress.org/plugins/dg-real-media-library/) to use your RML
446
+ folders right from Document Gallery!
447
+
448
  = 4.3.2 =
449
  * **Bug Fix:** Bug in editing gallery from post editor has been resolved.
450
  * **Note:** Minimum WordPress version has been bumped from 4.1 to 4.2.
assets/js/admin.min.js CHANGED
@@ -1,19 +1,21 @@
1
- jQuery(document).ready(function(){function l(a){a=a||event;if(a.dataTransfer.types)for(var b=0;b<a.dataTransfer.types.length;b++)if("Files"==a.dataTransfer.types[b]){a.stopPropagation();a.preventDefault();a.dataTransfer.dropEffect="none";break}}function p(a){a=a||event;if(a.originalEvent.dataTransfer.types)for(var b=0;b<a.originalEvent.dataTransfer.types.length;b++)if("Files"==a.originalEvent.dataTransfer.types[b])return a.stopPropagation(),a.preventDefault(),a.originalEvent.dataTransfer.dropEffect=
2
- "move",!1}function q(a){a=a||event;if(a.originalEvent.dataTransfer.types)for(var b=0;b<a.originalEvent.dataTransfer.types.length;b++)if("Files"==a.originalEvent.dataTransfer.types[b]){this.classList.add("dragover");c[jQuery(this).data("entry")]=c[jQuery(this).data("entry")].add(jQuery(a.target));break}}function r(a){a=a||event;if(a.originalEvent.dataTransfer.types)for(var b=0;b<a.originalEvent.dataTransfer.types.length;b++)if("Files"==a.originalEvent.dataTransfer.types[b]){c[jQuery(this).data("entry")]=
3
- c[jQuery(this).data("entry")].not(a.target);0===c[jQuery(this).data("entry")].length&&this.classList.remove("dragover");break}}function t(a){a=a||event;if(a.originalEvent.dataTransfer.types)for(var b=0;b<a.originalEvent.dataTransfer.types.length;b++)if("Files"==a.originalEvent.dataTransfer.types[b]){a.stopPropagation();a.preventDefault();m(a.originalEvent.dataTransfer.files,jQuery(this).data("entry"));c[jQuery(this).data("entry")]=jQuery();this.classList.remove("dragover");break}}function u(a){a=
4
- a||event;m(a.target.files,jQuery(this).closest("tr").data("entry"))}function m(a,b){for(var g=0,f;f=a[g];g++)if(0==f.type.indexOf("image/")&&"undefined"!=typeof dg_admin_vars.upload_limit&&f.size<=parseInt(dg_admin_vars.upload_limit)){var e,k=jQuery("[data-entry="+b+"]"),g=new FormData(k.closest("form")[0]);e=jQuery("#thumbnail-management-tab");e.length?e=e.attr("action"):(e=ajaxurl,g.append("action","dg_upload_thumb"));g.append("document_gallery[entry]",b);g.append("document_gallery[ajax]","true");
5
- g.append("document_gallery[upload]","true");g.append("file",f);var d=new XMLHttpRequest;d.open("POST",e);var c=k.find(".column-icon img"),h=k.find(".progress > *:first");d.onreadystatechange=function(){if(4==d.readyState){if(200==d.status&&-1==d.responseText.indexOf("\n")){jQuery(h).parent().addClass("success");var a=jQuery.parseJSON(d.responseText);a.result&&(a.url===c.attr("src")?c.attr("src",c.attr("src")+"?"+(new Date).getTime()):c.attr("src",a.url))}else jQuery(h).parent().addClass("fail"),console.log("Invalid response from server:"),
6
- console.log(d.responseText);setTimeout(function(){k.find(".column-thumbupload > *").toggleClass("invis");jQuery(h).parent().removeClass("success fail")},5E3)}};d.onload=function(){h.width("100%")};d.upload.onprogress=function(a){a.lengthComputable&&h.width((a.loaded/a.total*100|0)+"%")};h.width(0);k.find(".column-thumbupload > *").toggleClass("invis");d.send(g);break}else console.log("Attempt to upload improper file %c"+f.name+":","font-weight:bold;"),0!=f.type.indexOf("image/")&&console.log("\tIs not an image - "+
7
- f.type),"undefined"!=typeof dg_admin_vars.upload_limit&&f.size>parseInt(dg_admin_vars.upload_limit)&&console.log("\tIs too big - "+f.size+"b; (Limit is "+dg_admin_vars.upload_limit+"b)")}function n(a){for(var b=4,g=0;6>g;g++)a.animate({"margin-left":"+="+(b=-b)+"px"},50)}jQuery(".cb-ids").change(function(){jQuery(this).is(":checked")?jQuery(this).closest("tr").addClass("selected"):jQuery(this).closest("tr").removeClass("selected")});jQuery("th input:checkbox").change(function(){jQuery(this).is(":checked")?
 
 
8
  jQuery("#ThumbsTable tbody tr").addClass("selected"):jQuery("#ThumbsTable tbody tr").removeClass("selected")});jQuery("input.current-page").bind("keypress",{},function(a){13==(a.keyCode?a.keyCode:a.which)&&(a.preventDefault(),jQuery(location).attr("href","?"+jQuery.param(jQuery.extend(URL_params,{sheet:this.value}))))});jQuery("select.limit_per_page").change(function(){jQuery(location).attr("href","?"+jQuery.param(jQuery.extend(URL_params,{limit:this.value})))});jQuery("#thumbnail-management-tab").submit(function(a){a.preventDefault();
9
  if(0<jQuery(".cb-ids:checked").length){a=jQuery(this).attr("action");var b=jQuery(this).serialize()+"&document_gallery%5Bajax%5D=true&document_gallery%5Bcleanup%5D=true";jQuery(".deleteSelected").addClass("waiting").attr("disabled","disabled");jQuery.post(a,b,function(a){if(a.result){a=a.deleted;for(var b in a)jQuery("input[type=checkbox][value="+a[b]+"]").closest("tr").fadeOut("slow",0,function(){jQuery(this).slideUp("slow",function(){jQuery(this).remove()})})}jQuery(".deleteSelected").removeClass("waiting").removeAttr("disabled")}).fail(function(){console.log("Problem in reaching the server");
10
  jQuery(".deleteSelected").removeClass("waiting").removeAttr("disabled")})}return!1});jQuery("#advanced-tab #options-dump").click(function(){jQuery(this).select()});jQuery(".expander").click(function(){getSelection().toString()||(jQuery(this).next().slideToggle("slow"),jQuery(this).find(".dashicons").toggleClass("dashicons-arrow-down-alt2 dashicons-arrow-up-alt2"),jQuery(this).toggleClass("expander collapser"),jQuery(this).attr("title",jQuery(this).hasClass("expander")?"Click to Expand":"Click to Collapse"))});
11
  jQuery(".spoiler-body").length&&(jQuery(".expandAll, .collapseAll").addClass("button"),jQuery(".expandAll").click(function(a){a.preventDefault();jQuery(".expander").trigger("click")}),jQuery(".collapseAll").click(function(a){a.preventDefault();jQuery(".collapser").trigger("click")}));jQuery(".levelSelector input").change(function(){"all"==jQuery(this).val()?(jQuery(".levelSelector input").not("[value='all']").prop("checked",jQuery(this).is(":checked")),jQuery(this).is(":checked")?jQuery("#LogTable tbody tr").show():
12
  jQuery("#LogTable tbody tr").hide()):(jQuery(this).is(":checked")?jQuery("#LogTable tbody tr:has(span."+jQuery(this).val()+")").show():jQuery("#LogTable tbody tr:has(span."+jQuery(this).val()+")").hide(),jQuery(".levelSelector input:checked").not("[value='all']").length+1==jQuery('.levelSelector input[type="checkbox"]').length?jQuery('.levelSelector input[value="all"]').prop("checked",!0):jQuery('.levelSelector input[value="all"]').prop("checked",!1))});jQuery("#LogTable .manage-column.column-date").click(function(){jQuery(this).toggleClass("asc desc");
13
- var a=jQuery("#LogTable > tbody"),b=a.children("tr");a.append(b.get().reverse())});window.addEventListener("dragover",l,!1);window.addEventListener("drop",l,!1);var c={};jQuery("#ThumbsTable tbody tr").each(function(){jQuery(this).on("dragenter",q).on("dragover",p).on("dragleave",r).on("drop",t);c[jQuery(this).data("entry")]=jQuery();jQuery(this).find("input:button").on("click",function(){jQuery(this).prevAll("input:file").click()});jQuery(this).find("input:file").on("change",u)});"draggable"in document.createElement("span")||
14
  jQuery(".html5dndmarker").hide();jQuery("td .dashicons-edit").click(function(){var a=jQuery(this).closest("td");if(a.hasClass("column-title")){if("none"==a.find("a").css("display"))return;a.find("a").hide().after('<input type="text" value="'+a.find(".editable-title").text()+'">');a.find("input").focus()}else if(a.hasClass("column-description")){if("none"==a.find(".editable-description").css("display"))return;a.find(".editable-description").hide().after("<textarea>"+a.find(".editable-description").html()+
15
  "</textarea>");a.find("textarea").focus()}else return;jQuery(this).css("visibility","hidden");a.find(".edit-controls").show()});jQuery(".edit-controls .dashicons-no").click(function(){var a=jQuery(this).closest("td");if(a.hasClass("column-title")){if("none"!=a.find("a").css("display"))return;a.find("input").fadeOut("fast",function(){jQuery(this).remove();a.find("a").fadeIn("fast")})}else if(a.hasClass("column-description")){if("none"!=a.find(".editable-description").css("display"))return;a.find("textarea").fadeOut("fast",
16
- function(){jQuery(this).remove();a.find(".editable-description").fadeIn("fast")})}else return;jQuery(this).closest(".edit-controls").hide();a.find(".dashicons-edit").css("visibility","visible")});jQuery(".edit-controls .dashicons-yes").click(function(){var a=jQuery(this).closest("td"),b=jQuery(this).closest("tr").data("entry"),g=jQuery("#thumbnail-management-tab").attr("action"),f=new FormData(jQuery("[data-entry="+b+"]").closest("form")[0]);f.append("document_gallery[entry]",b);f.append("document_gallery[ajax]",
17
- "true");var e,c;if(a.hasClass("column-title"))e=a.find("input"),c=a.find(".editable-title"),f.append("document_gallery[title]",encodeURIComponent(e.val()));else if(a.hasClass("column-description"))e=a.find("textarea"),c=a.find(".editable-description"),f.append("document_gallery[description]",encodeURIComponent(e.val()));else return;if(e.val()==c.text()||a.hasClass("column-description")&&e.val()==c.html())jQuery(this).next(".dashicons-no").click();else{var d=new XMLHttpRequest;d.open("POST",g);d.onreadystatechange=
18
- function(){4==d.readyState&&(a.addClass("trans"),a.find(".edit-controls").removeClass("waiting"),-1==d.responseText.indexOf("\n")?jQuery.parseJSON(d.responseText).result?(a.hasClass("column-description")?c.html(e.val()):c.text(e.val()),a.find(".dashicons-no").click(),a.addClass("responseSuccess").delay(2E3).queue(function(){jQuery(this).removeClass("responseSuccess").dequeue()}).delay(1100).queue(function(){jQuery(this).removeClass("trans").dequeue()})):(n(e),a.addClass("responseFail").delay(1100).queue(function(){jQuery(this).removeClass("responseFail").dequeue()}).delay(1100).queue(function(){jQuery(this).removeClass("trans").dequeue()})):
19
- (n(e),a.addClass("responseFail").delay(1100).queue(function(){jQuery(this).removeClass("responseFail").dequeue()}).delay(1100).queue(function(){jQuery(this).removeClass("trans").dequeue()}),console.log("Invalid response from server:"),console.log(d.responseText)))};jQuery(this).closest(".edit-controls").addClass("waiting");d.send(f)}})});
1
+ var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(b,e,d){b instanceof String&&(b=String(b));for(var f=b.length,c=0;c<f;c++){var m=b[c];if(e.call(d,m,c,b))return{i:c,v:m}}return{i:-1,v:void 0}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(b,e,d){b!=Array.prototype&&b!=Object.prototype&&(b[e]=d.value)};$jscomp.getGlobal=function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global&&null!=global?global:b};
2
+ $jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(b,e,d,f){if(e){d=$jscomp.global;b=b.split(".");for(f=0;f<b.length-1;f++){var c=b[f];c in d||(d[c]={});d=d[c]}b=b[b.length-1];f=d[b];e=e(f);e!=f&&null!=e&&$jscomp.defineProperty(d,b,{configurable:!0,writable:!0,value:e})}};$jscomp.polyfill("Array.prototype.find",function(b){return b?b:function(b,d){return $jscomp.findInternal(this,b,d).v}},"es6-impl","es3");
3
+ jQuery(document).ready(function(){function b(a){a=a||event;if(a.dataTransfer.types)for(var b=0;b<a.dataTransfer.types.length;b++)if("Files"==a.dataTransfer.types[b]){a.stopPropagation();a.preventDefault();a.dataTransfer.dropEffect="none";break}}function e(a){a=a||event;if(a.originalEvent.dataTransfer.types)for(var b=0;b<a.originalEvent.dataTransfer.types.length;b++)if("Files"==a.originalEvent.dataTransfer.types[b])return a.stopPropagation(),a.preventDefault(),a.originalEvent.dataTransfer.dropEffect=
4
+ "move",!1}function d(a){a=a||event;if(a.originalEvent.dataTransfer.types)for(var b=0;b<a.originalEvent.dataTransfer.types.length;b++)if("Files"==a.originalEvent.dataTransfer.types[b]){this.classList.add("dragover");l[jQuery(this).data("entry")]=l[jQuery(this).data("entry")].add(jQuery(a.target));break}}function f(a){a=a||event;if(a.originalEvent.dataTransfer.types)for(var b=0;b<a.originalEvent.dataTransfer.types.length;b++)if("Files"==a.originalEvent.dataTransfer.types[b]){l[jQuery(this).data("entry")]=
5
+ l[jQuery(this).data("entry")].not(a.target);0===l[jQuery(this).data("entry")].length&&this.classList.remove("dragover");break}}function c(a){a=a||event;if(a.originalEvent.dataTransfer.types)for(var b=0;b<a.originalEvent.dataTransfer.types.length;b++)if("Files"==a.originalEvent.dataTransfer.types[b]){a.stopPropagation();a.preventDefault();n(a.originalEvent.dataTransfer.files,jQuery(this).data("entry"));l[jQuery(this).data("entry")]=jQuery();this.classList.remove("dragover");break}}function m(a){a=
6
+ a||event;n(a.target.files,jQuery(this).closest("tr").data("entry"))}function n(a,b){for(var h=0,k;k=a[h];h++)if(0==k.type.indexOf("image/")&&"undefined"!=typeof dg_admin_vars.upload_limit&&k.size<=parseInt(dg_admin_vars.upload_limit)){var d=jQuery("[data-entry="+b+"]"),h=new FormData(d.closest("form")[0]);var e=jQuery("#thumbnail-management-tab");e.length?e=e.attr("action"):(e=ajaxurl,h.append("action","dg_upload_thumb"));h.append("document_gallery[entry]",b);h.append("document_gallery[ajax]","true");
7
+ h.append("document_gallery[upload]","true");h.append("file",k);var g=new XMLHttpRequest;g.open("POST",e);var f=d.find(".column-icon img"),c=d.find(".progress > *:first");g.onreadystatechange=function(){if(4==g.readyState){if(200==g.status&&-1==g.responseText.indexOf("\n")){jQuery(c).parent().addClass("success");var a=jQuery.parseJSON(g.responseText);a.result&&(a.url===f.attr("src")?f.attr("src",f.attr("src")+"?"+(new Date).getTime()):f.attr("src",a.url))}else jQuery(c).parent().addClass("fail"),console.log("Invalid response from server:"),
8
+ console.log(g.responseText);setTimeout(function(){d.find(".column-thumbupload > *").toggleClass("invis");jQuery(c).parent().removeClass("success fail")},5E3)}};g.onload=function(){c.width("100%")};g.upload.onprogress=function(a){a.lengthComputable&&c.width((a.loaded/a.total*100|0)+"%")};c.width(0);d.find(".column-thumbupload > *").toggleClass("invis");g.send(h);break}else console.log("Attempt to upload improper file %c"+k.name+":","font-weight:bold;"),0!=k.type.indexOf("image/")&&console.log("\tIs not an image - "+
9
+ k.type),"undefined"!=typeof dg_admin_vars.upload_limit&&k.size>parseInt(dg_admin_vars.upload_limit)&&console.log("\tIs too big - "+k.size+"b; (Limit is "+dg_admin_vars.upload_limit+"b)")}function p(a){for(var b=4,d=0;6>d;d++)a.animate({"margin-left":"+="+(b=-b)+"px"},50)}jQuery(".cb-ids").change(function(){jQuery(this).is(":checked")?jQuery(this).closest("tr").addClass("selected"):jQuery(this).closest("tr").removeClass("selected")});jQuery("th input:checkbox").change(function(){jQuery(this).is(":checked")?
10
  jQuery("#ThumbsTable tbody tr").addClass("selected"):jQuery("#ThumbsTable tbody tr").removeClass("selected")});jQuery("input.current-page").bind("keypress",{},function(a){13==(a.keyCode?a.keyCode:a.which)&&(a.preventDefault(),jQuery(location).attr("href","?"+jQuery.param(jQuery.extend(URL_params,{sheet:this.value}))))});jQuery("select.limit_per_page").change(function(){jQuery(location).attr("href","?"+jQuery.param(jQuery.extend(URL_params,{limit:this.value})))});jQuery("#thumbnail-management-tab").submit(function(a){a.preventDefault();
11
  if(0<jQuery(".cb-ids:checked").length){a=jQuery(this).attr("action");var b=jQuery(this).serialize()+"&document_gallery%5Bajax%5D=true&document_gallery%5Bcleanup%5D=true";jQuery(".deleteSelected").addClass("waiting").attr("disabled","disabled");jQuery.post(a,b,function(a){if(a.result){a=a.deleted;for(var b in a)jQuery("input[type=checkbox][value="+a[b]+"]").closest("tr").fadeOut("slow",0,function(){jQuery(this).slideUp("slow",function(){jQuery(this).remove()})})}jQuery(".deleteSelected").removeClass("waiting").removeAttr("disabled")}).fail(function(){console.log("Problem in reaching the server");
12
  jQuery(".deleteSelected").removeClass("waiting").removeAttr("disabled")})}return!1});jQuery("#advanced-tab #options-dump").click(function(){jQuery(this).select()});jQuery(".expander").click(function(){getSelection().toString()||(jQuery(this).next().slideToggle("slow"),jQuery(this).find(".dashicons").toggleClass("dashicons-arrow-down-alt2 dashicons-arrow-up-alt2"),jQuery(this).toggleClass("expander collapser"),jQuery(this).attr("title",jQuery(this).hasClass("expander")?"Click to Expand":"Click to Collapse"))});
13
  jQuery(".spoiler-body").length&&(jQuery(".expandAll, .collapseAll").addClass("button"),jQuery(".expandAll").click(function(a){a.preventDefault();jQuery(".expander").trigger("click")}),jQuery(".collapseAll").click(function(a){a.preventDefault();jQuery(".collapser").trigger("click")}));jQuery(".levelSelector input").change(function(){"all"==jQuery(this).val()?(jQuery(".levelSelector input").not("[value='all']").prop("checked",jQuery(this).is(":checked")),jQuery(this).is(":checked")?jQuery("#LogTable tbody tr").show():
14
  jQuery("#LogTable tbody tr").hide()):(jQuery(this).is(":checked")?jQuery("#LogTable tbody tr:has(span."+jQuery(this).val()+")").show():jQuery("#LogTable tbody tr:has(span."+jQuery(this).val()+")").hide(),jQuery(".levelSelector input:checked").not("[value='all']").length+1==jQuery('.levelSelector input[type="checkbox"]').length?jQuery('.levelSelector input[value="all"]').prop("checked",!0):jQuery('.levelSelector input[value="all"]').prop("checked",!1))});jQuery("#LogTable .manage-column.column-date").click(function(){jQuery(this).toggleClass("asc desc");
15
+ var a=jQuery("#LogTable > tbody"),b=a.children("tr");a.append(b.get().reverse())});window.addEventListener("dragover",b,!1);window.addEventListener("drop",b,!1);var l={};jQuery("#ThumbsTable tbody tr").each(function(){jQuery(this).on("dragenter",d).on("dragover",e).on("dragleave",f).on("drop",c);l[jQuery(this).data("entry")]=jQuery();jQuery(this).find("input:button").on("click",function(){jQuery(this).prevAll("input:file").click()});jQuery(this).find("input:file").on("change",m)});"draggable"in document.createElement("span")||
16
  jQuery(".html5dndmarker").hide();jQuery("td .dashicons-edit").click(function(){var a=jQuery(this).closest("td");if(a.hasClass("column-title")){if("none"==a.find("a").css("display"))return;a.find("a").hide().after('<input type="text" value="'+a.find(".editable-title").text()+'">');a.find("input").focus()}else if(a.hasClass("column-description")){if("none"==a.find(".editable-description").css("display"))return;a.find(".editable-description").hide().after("<textarea>"+a.find(".editable-description").html()+
17
  "</textarea>");a.find("textarea").focus()}else return;jQuery(this).css("visibility","hidden");a.find(".edit-controls").show()});jQuery(".edit-controls .dashicons-no").click(function(){var a=jQuery(this).closest("td");if(a.hasClass("column-title")){if("none"!=a.find("a").css("display"))return;a.find("input").fadeOut("fast",function(){jQuery(this).remove();a.find("a").fadeIn("fast")})}else if(a.hasClass("column-description")){if("none"!=a.find(".editable-description").css("display"))return;a.find("textarea").fadeOut("fast",
18
+ function(){jQuery(this).remove();a.find(".editable-description").fadeIn("fast")})}else return;jQuery(this).closest(".edit-controls").hide();a.find(".dashicons-edit").css("visibility","visible")});jQuery(".edit-controls .dashicons-yes").click(function(){var a=jQuery(this).closest("td"),b=jQuery(this).closest("tr").data("entry"),d=jQuery("#thumbnail-management-tab").attr("action"),e=new FormData(jQuery("[data-entry="+b+"]").closest("form")[0]);e.append("document_gallery[entry]",b);e.append("document_gallery[ajax]",
19
+ "true");if(a.hasClass("column-title")){var c=a.find("input");var f=a.find(".editable-title");e.append("document_gallery[title]",encodeURIComponent(c.val()))}else if(a.hasClass("column-description"))c=a.find("textarea"),f=a.find(".editable-description"),e.append("document_gallery[description]",encodeURIComponent(c.val()));else return;if(c.val()==f.text()||a.hasClass("column-description")&&c.val()==f.html())jQuery(this).next(".dashicons-no").click();else{var g=new XMLHttpRequest;g.open("POST",d);g.onreadystatechange=
20
+ function(){4==g.readyState&&(a.addClass("trans"),a.find(".edit-controls").removeClass("waiting"),-1==g.responseText.indexOf("\n")?jQuery.parseJSON(g.responseText).result?(a.hasClass("column-description")?f.html(c.val()):f.text(c.val()),a.find(".dashicons-no").click(),a.addClass("responseSuccess").delay(2E3).queue(function(){jQuery(this).removeClass("responseSuccess").dequeue()}).delay(1100).queue(function(){jQuery(this).removeClass("trans").dequeue()})):(p(c),a.addClass("responseFail").delay(1100).queue(function(){jQuery(this).removeClass("responseFail").dequeue()}).delay(1100).queue(function(){jQuery(this).removeClass("trans").dequeue()})):
21
+ (p(c),a.addClass("responseFail").delay(1100).queue(function(){jQuery(this).removeClass("responseFail").dequeue()}).delay(1100).queue(function(){jQuery(this).removeClass("trans").dequeue()}),console.log("Invalid response from server:"),console.log(g.responseText)))};jQuery(this).closest(".edit-controls").addClass("waiting");g.send(e)}})});
assets/js/gallery.min.js CHANGED
@@ -1,4 +1,6 @@
1
- (function(b){function h(a){(a||b(".document-gallery[data-icon-width]")).each(function(){var a=b(this).data("icon-width");"undefined"!==typeof a&&b(this).find(".document-icon").width(a+"%")})}function p(){g&&tinymce.PluginManager.add("dg",function(a,d){a.on("LoadContent update.dg undo",function(a){b(a.target.contentDocument).find('[data-wpview-type="dg"] [data-shortcode]').each(function(){k("object"===typeof b(this).data("shortcode")?b(this).data("shortcode"):JSON.parse(decodeURIComponent(b(this).data("shortcode"))),
2
- b(this))})})})}function q(){b("body").delegate(".dg-paginate-wrapper .paginate a","click",function(a){var d=b(this).closest(".dg-paginate-wrapper"),e=d.data("shortcode");e.skip=0;var c=b(this).attr("href").split("#")[1].split("=");2<=c.length&&(e.skip=e.limit*(c.pop()-1));k(e,d);a.preventDefault()})}function l(){c=[];f=0;b(".document-gallery img[data-id]").each(function(){var a=b(this).data("id");-1===b.inArray(a,c)&&c.push(a)});m()}function k(a,d){"undefined"===typeof a.id&&(a.id=wp.media.dgDefaults.id);
3
- b.post(ajaxurl,{action:"dg_generate_gallery",atts:a},function(a){a=b(b.parseHTML(a));g&&!n&&a.find(r).length&&(n=!0,b("#insert-media-button").trigger("ready.dg"));d.replaceWith(a);h(a);l()})}function m(){for(var a=[];f<c.length&&4!==a.length;f++)a.push(c[f]);0!=a.length&&b.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"dg_generate_icons",ids:a},success:t,error:function(a){console.error(a.responseText)}})}function t(a){for(var d in a)if(a.hasOwnProperty(d)){var c=b('.document-gallery img[data-id="'+
4
- d+'"]');c.removeAttr("data-id");(function(c,d){d.fadeOut("fast",function(){b(this).attr("src",a[c]);b(this).fadeIn("fast")})})(d,c)}m()}var c,f,g,r='.document-gallery [data-ext="'+"doc docx ppt pptx xls xlsx pub vsd vsdx".split(" ").join('"],[data-ext="')+'"]',n=!1;b(document).ready(function(){g="undefined"!==typeof tinymce;h();l();p();q()})})(jQuery);
 
 
1
+ var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,d,c){a instanceof String&&(a=String(a));for(var f=a.length,e=0;e<f;e++){var g=a[e];if(d.call(c,g,e,a))return{i:e,v:g}}return{i:-1,v:void 0}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(a,d,c){a!=Array.prototype&&a!=Object.prototype&&(a[d]=c.value)};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};
2
+ $jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,d,c,f){if(d){c=$jscomp.global;a=a.split(".");for(f=0;f<a.length-1;f++){var e=a[f];e in c||(c[e]={});c=c[e]}a=a[a.length-1];f=c[a];d=d(f);d!=f&&null!=d&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:d})}};$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,c){return $jscomp.findInternal(this,a,c).v}},"es6-impl","es3");
3
+ (function(a){function d(b){(b||a(".document-gallery[data-icon-width]")).each(function(){var b=a(this).data("icon-width");"undefined"!==typeof b&&a(this).find(".document-icon").width(b+"%")})}function c(){l&&tinymce.PluginManager.add("dg",function(b,c){b.on("LoadContent update.dg undo",function(b){a(b.target.contentDocument).find('[data-wpview-type="dg"] [data-shortcode]').each(function(){g("object"===typeof a(this).data("shortcode")?a(this).data("shortcode"):JSON.parse(decodeURIComponent(a(this).data("shortcode"))),
4
+ a(this))})})})}function f(){a("body").delegate(".dg-paginate-wrapper .paginate a","click",function(b){var c=a(this).closest(".dg-paginate-wrapper"),d=c.data("shortcode");d.skip=0;var e=a(this).attr("href").split("#")[1].split("=");2<=e.length&&(d.skip=d.limit*(e.pop()-1));g(d,c);b.preventDefault()})}function e(){h=[];k=0;a(".document-gallery img[data-id]").each(function(){var b=a(this).data("id");-1===a.inArray(b,h)&&h.push(b)});m()}function g(b,c){"undefined"===typeof b.id&&(b.id=wp.media.dgDefaults.id);
5
+ a.post(ajaxurl,{action:"dg_generate_gallery",atts:b},function(b){b=a(a.parseHTML(b));l&&!n&&b.find(p).length&&(n=!0,a("#insert-media-button").trigger("ready.dg"));c.replaceWith(b);d(b);e()})}function m(){for(var b=[];k<h.length&&4!==b.length;k++)b.push(h[k]);0!=b.length&&a.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"dg_generate_icons",ids:b},success:q,error:function(a){console.error(a.responseText)}})}function q(b){for(var c in b)if(b.hasOwnProperty(c)){var d=a('.document-gallery img[data-id="'+
6
+ c+'"]');d.removeAttr("data-id");(function(c,d){d.fadeOut("fast",function(){a(this).attr("src",b[c]);a(this).fadeIn("fast")})})(c,d)}m()}var h,k,l,p='.document-gallery [data-ext="'+"doc docx ppt pptx xls xlsx pub vsd vsdx".split(" ").join('"],[data-ext="')+'"]',n=!1;a(document).ready(function(){l="undefined"!==typeof tinymce;d();e();c();f()})})(jQuery);
assets/js/media_manager.min.js CHANGED
@@ -1,15 +1,17 @@
1
- (function(h,g){if("function"===typeof wp.media.collection){var d,a=wp.media;d=a.view.l10n="undefined"===typeof _wpMediaViewsL10n?{}:_wpMediaViewsL10n;jQuery.extend(d,DGl10n);a.controller.dgEdit=a.controller.Library.extend({defaults:{id:"dg-edit",title:d.editdgTitle,multiple:!1,searchable:!1,date:!1,sortable:!0,display:!1,content:"browse",toolbar:"dg-edit",describe:!0,displaySettings:!0,dragInfo:!0,idealColumnWidth:170,editing:!1,priority:60,syncSelection:!1},initialize:function(){this.get("library")||
 
 
2
  this.set("library",new a.model.Selection);this.get("AttachmentView")||this.set("AttachmentView",a.view.Attachment.EditLibrary);a.controller.Library.prototype.initialize.apply(this,arguments)},activate:function(){this.get("library");this.get("library").observe(wp.Uploader.queue);this.frame.on("content:render:browse",this.dgSettings,this);a.controller.Library.prototype.activate.apply(this,arguments)},deactivate:function(){this.get("library").unobserve(wp.Uploader.queue);this.frame.off("content:render:browse",
3
- this.dgSettings,this);a.controller.Library.prototype.deactivate.apply(this,arguments)},dgSettings:function(c){if(this.get("displaySettings")){var b=this.get("library");b&&c&&(b.dg=b.dg||new Backbone.Model,c.sidebar.set({dg:new a.view.Settings.dg({controller:this,model:b.dg,priority:40})}),c.toolbar.set("reverse",{text:d.reverseOrder,priority:80,click:function(){b.reset(b.toArray().reverse())}}))}}});a.controller.dgAdd=a.controller.Library.extend({defaults:g.defaults({id:"dg-library",title:d.addTodgTitle,
4
- multiple:"add",filterable:"uploaded",menu:"dg",toolbar:"dg-add",priority:100,syncSelection:!1},a.controller.Library.prototype.defaults),initialize:function(){this.get("library")||this.set("library",a.query());a.controller.Library.prototype.initialize.apply(this,arguments)},activate:function(){var c=this.get("library"),b=this.frame.state("dg-edit").get("library");this.editLibrary&&this.editLibrary!==b&&c.unobserve(this.editLibrary);c.validator=function(c){return!!this.mirroring.get(c.cid)&&!b.get(c.cid)&&
5
- a.model.Selection.prototype.validator.apply(this,arguments)};c.reset(c.mirroring.models,{silent:!0});c.observe(b);this.editLibrary=b;a.controller.Library.prototype.activate.apply(this,arguments)}});a.view.Settings.dg=a.view.Settings.extend({update:function(c){var b=this.model.get(c),e=this.$('[data-setting="'+c+'"]');e.length&&(e.is("select")?(b=e.find('[value="'+b+'"]'),b.length?(e.find("option").prop("selected",!1),b.prop("selected",!0)):this.model.set(c,e.find(":selected").val())):e.hasClass("button-group")?
6
- (c=e.find("button").removeClass("active"),c.filter('[value="'+b+'"]').addClass("active")):e.is('input[type="text"], input[type="number"], textarea')?e.is(":focus")||e.val(b):e.is('input[type="checkbox"]')&&e.prop("checked",!!b&&"false"!==b))},className:"collection-settings dg-settings",template:a.template("dg-settings")});var f=wp.media.view.MediaFrame.Post;wp.media.view.MediaFrame.Post=f.extend({initialize:function(){f.prototype.initialize.apply(this,arguments);this.states.add([new a.controller.Library({id:"dg",
7
- title:d.dgMenuTitle,priority:50,toolbar:"main-dg",filterable:"all",multiple:"add",editable:!1,library:a.query(this.options.library)}),new a.controller.dgEdit({library:this.options.selection,editing:this.options.editing,menu:"dg"}),new a.controller.dgAdd]);this.on("menu:create:dg",this.createMenu,this);this.on("toolbar:create:main-dg",this.createToolbar,this);this.on("menu:render:dg",this.dgMenu,this);this.on("toolbar:render:main-dg",this.maindgToolbar,this);this.on("toolbar:render:dg-edit",this.dgEditToolbar,
8
- this);this.on("toolbar:render:dg-add",this.dgAddToolbar,this)},dgMenu:function(c){var b=this.lastState(),e=b&&b.id,f=this;c.set({cancel:{text:d.canceldgTitle,priority:20,click:function(){e?f.setState(e):f.close();this.controller.modal.focusManager.focus()}},separateCancel:new a.View({className:"separator",priority:40})})},maindgToolbar:function(c){var b=this;this.selectionStatusToolbar(c);c.set("dg",{style:"primary",text:d.dgButton,priority:60,requires:{selection:!0},click:function(){var c=b.state().get("selection");
9
- b.state("dg-edit").set("library",new a.model.Selection(c.models,{props:c.props.toJSON(),multiple:!0}));this.controller.setState("dg-edit");this.controller.modal.focusManager.focus()}})},dgEditToolbar:function(){var c=this.state().get("editing");this.toolbar.set(new a.view.Toolbar({controller:this,items:{insert:{style:"primary",text:c?d.updatedg:d.insertdg,priority:80,requires:{library:!0},click:function(){var b=this.controller,a=b.state();b.close();c?a.trigger("update",a.get("library")):wp.media.editor.insert(wp.media.dg.shortcode(a.get("library")).string().replace(/\sdgorder=/ig,
10
- " order=").replace(/\sdgorderby=/ig," orderby="));b.setState(b.options.state);b.reset();"undefined"!=typeof tinyMCE&&null!==tinyMCE.activeEditor&&tinyMCE.activeEditor.fire("update.dg")}}}}))},dgAddToolbar:function(){this.toolbar.set(new a.view.Toolbar({controller:this,items:{insert:{style:"primary",text:d.addTodg,priority:80,requires:{selection:!0},click:function(){var c=this.controller,b=c.state();c.state("dg-edit").get("library").add(b.get("selection").models);b.trigger("reset");c.setState("dg-edit")}}}}))}});
11
  wp.media._dgDefaults={id:wp.media.view.settings.post&&wp.media.view.settings.post.id,columns:dgDefaults.columns,fancy:dgDefaults.fancy,relation:dgDefaults.relation,limit:dgDefaults.limit,mime_types:dgDefaults.mime_types,post_status:dgDefaults.post_status,post_type:dgDefaults.post_type,attachment_pg:dgDefaults.attachment_pg,descriptions:dgDefaults.descriptions,new_window:dgDefaults.new_window,paginate:dgDefaults.paginate,dgorder:dgDefaults.order,dgorderby:dgDefaults.orderby};wp.media.dgDefaults=wp.media.view.settings.dgDefaults?
12
- g.extend({},wp.media._dgDefaults,wp.media.view.settings.dgDefaults):wp.media._dgDefaults;wp.media.dg=new wp.media.collection({tag:"dg",editTitle:wp.media.view.l10n.editdgTitle,defaults:wp.media.dgDefaults,setDefaults:function(c){var b=this,a=!g.isEqual(wp.media.dgDefaults,wp.media._dgDefaults);g.each(this.defaults,function(d,f){c[f]=b.coerce(c,f);d!==c[f]||a&&d!==wp.media._dgDefaults[f]||delete c[f]});return c}})}})(jQuery,_);
13
- "undefined"!==typeof window.wp.mce&&"undefined"!==typeof window.wp.mce.views&&function(h,g,d,a){base={state:[],edit:function(a,c){if(-1==a.search(/\sids\s*=/gi)||-1<a.search(/\s(?!(?:ids|attachment_pg|columns|new_window|descriptions|fancy|orderby|order|paginate|limit)\s*=)[\w\-]+\s*=/gi))tinyMCE.activeEditor.windowManager.alert(DGl10n.unfitSCalert);else{var b=this.type,e=d[b].edit(a.replace(/\sorder\s*=/ig," dgorder=").replace(/\sorderby\s*=/ig," dgorderby="));this.pausePlayers&&this.pausePlayers();
14
- _.each(this.state,function(a){e.state(a).on("update",function(a){c(d[b].shortcode(a).string().replace(/\sdgorder=/ig," order=").replace(/\sdgorderby=/ig," orderby="),"dg"===b)})});e.on("close",function(){e.detach()});e.open()}}};h=_.extend({},base,{state:["dg-edit"],template:d.template("editor-dg"),initialize:function(){d.dg.attachments(this.shortcode,d.view.settings.post.id);var a=this.shortcode.attrs.named,c=this.text,b={};for(prop in a)-1<c.indexOf(" "+prop+"=")&&(b[prop]=a[prop]);-1<c.indexOf(" dgorderby=")&&
15
- (b.orderby=a.dgorderby);-1<c.indexOf(" dgorder=")&&(b.order=a.dgorder);this.render('<div data-shortcode="'+encodeURIComponent(JSON.stringify(b))+'"><div class="loading-placeholder"><div class="dashicons dashicons-admin-media"></div><div class="wpview-loading"><ins></ins></div></div></div>')}});g.register("dg",_.extend({},h))}(window,window.wp.mce.views,window.wp.media,window.jQuery);
1
+ var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(b,g,a){b instanceof String&&(b=String(b));for(var f=b.length,e=0;e<f;e++){var c=b[e];if(g.call(a,c,e,b))return{i:e,v:c}}return{i:-1,v:void 0}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(b,g,a){b!=Array.prototype&&b!=Object.prototype&&(b[g]=a.value)};$jscomp.getGlobal=function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global&&null!=global?global:b};
2
+ $jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(b,g,a,f){if(g){a=$jscomp.global;b=b.split(".");for(f=0;f<b.length-1;f++){var e=b[f];e in a||(a[e]={});a=a[e]}b=b[b.length-1];f=a[b];g=g(f);g!=f&&null!=g&&$jscomp.defineProperty(a,b,{configurable:!0,writable:!0,value:g})}};$jscomp.polyfill("Array.prototype.find",function(b){return b?b:function(b,a){return $jscomp.findInternal(this,b,a).v}},"es6-impl","es3");
3
+ (function(b,g){if("function"===typeof wp.media.collection){var a=wp.media;var f=a.view.l10n="undefined"===typeof _wpMediaViewsL10n?{}:_wpMediaViewsL10n;jQuery.extend(f,DGl10n);a.controller.dgEdit=a.controller.Library.extend({defaults:{id:"dg-edit",title:f.editdgTitle,multiple:!1,searchable:!1,date:!1,sortable:!0,display:!1,content:"browse",toolbar:"dg-edit",describe:!0,displaySettings:!0,dragInfo:!0,idealColumnWidth:170,editing:!1,priority:60,syncSelection:!1},initialize:function(){this.get("library")||
4
  this.set("library",new a.model.Selection);this.get("AttachmentView")||this.set("AttachmentView",a.view.Attachment.EditLibrary);a.controller.Library.prototype.initialize.apply(this,arguments)},activate:function(){this.get("library");this.get("library").observe(wp.Uploader.queue);this.frame.on("content:render:browse",this.dgSettings,this);a.controller.Library.prototype.activate.apply(this,arguments)},deactivate:function(){this.get("library").unobserve(wp.Uploader.queue);this.frame.off("content:render:browse",
5
+ this.dgSettings,this);a.controller.Library.prototype.deactivate.apply(this,arguments)},dgSettings:function(c){if(this.get("displaySettings")){var d=this.get("library");d&&c&&(d.dg=d.dg||new Backbone.Model,c.sidebar.set({dg:new a.view.Settings.dg({controller:this,model:d.dg,priority:40})}),c.toolbar.set("reverse",{text:f.reverseOrder,priority:80,click:function(){d.reset(d.toArray().reverse())}}))}}});a.controller.dgAdd=a.controller.Library.extend({defaults:g.defaults({id:"dg-library",title:f.addTodgTitle,
6
+ multiple:"add",filterable:"uploaded",menu:"dg",toolbar:"dg-add",priority:100,syncSelection:!1},a.controller.Library.prototype.defaults),initialize:function(){this.get("library")||this.set("library",a.query());a.controller.Library.prototype.initialize.apply(this,arguments)},activate:function(){var c=this.get("library"),d=this.frame.state("dg-edit").get("library");this.editLibrary&&this.editLibrary!==d&&c.unobserve(this.editLibrary);c.validator=function(c){return!!this.mirroring.get(c.cid)&&!d.get(c.cid)&&
7
+ a.model.Selection.prototype.validator.apply(this,arguments)};c.reset(c.mirroring.models,{silent:!0});c.observe(d);this.editLibrary=d;a.controller.Library.prototype.activate.apply(this,arguments)}});a.view.Settings.dg=a.view.Settings.extend({update:function(a){var d=this.model.get(a),c=this.$('[data-setting="'+a+'"]');c.length&&(c.is("select")?(d=c.find('[value="'+d+'"]'),d.length?(c.find("option").prop("selected",!1),d.prop("selected",!0)):this.model.set(a,c.find(":selected").val())):c.hasClass("button-group")?
8
+ (a=c.find("button").removeClass("active"),a.filter('[value="'+d+'"]').addClass("active")):c.is('input[type="text"], input[type="number"], textarea')?c.is(":focus")||c.val(d):c.is('input[type="checkbox"]')&&c.prop("checked",!!d&&"false"!==d))},className:"collection-settings dg-settings",template:a.template("dg-settings")});var e=wp.media.view.MediaFrame.Post;wp.media.view.MediaFrame.Post=e.extend({initialize:function(){e.prototype.initialize.apply(this,arguments);this.states.add([new a.controller.Library({id:"dg",
9
+ title:f.dgMenuTitle,priority:50,toolbar:"main-dg",filterable:"all",multiple:"add",editable:!1,library:a.query(this.options.library)}),new a.controller.dgEdit({library:this.options.selection,editing:this.options.editing,menu:"dg"}),new a.controller.dgAdd]);this.on("menu:create:dg",this.createMenu,this);this.on("toolbar:create:main-dg",this.createToolbar,this);this.on("menu:render:dg",this.dgMenu,this);this.on("toolbar:render:main-dg",this.maindgToolbar,this);this.on("toolbar:render:dg-edit",this.dgEditToolbar,
10
+ this);this.on("toolbar:render:dg-add",this.dgAddToolbar,this)},dgMenu:function(c){var d=this.lastState(),b=d&&d.id,e=this;c.set({cancel:{text:f.canceldgTitle,priority:20,click:function(){b?e.setState(b):e.close();this.controller.modal.focusManager.focus()}},separateCancel:new a.View({className:"separator",priority:40})})},maindgToolbar:function(c){var d=this;this.selectionStatusToolbar(c);c.set("dg",{style:"primary",text:f.dgButton,priority:60,requires:{selection:!0},click:function(){var c=d.state().get("selection");
11
+ d.state("dg-edit").set("library",new a.model.Selection(c.models,{props:c.props.toJSON(),multiple:!0}));this.controller.setState("dg-edit");this.controller.modal.focusManager.focus()}})},dgEditToolbar:function(){var c=this.state().get("editing");this.toolbar.set(new a.view.Toolbar({controller:this,items:{insert:{style:"primary",text:c?f.updatedg:f.insertdg,priority:80,requires:{library:!0},click:function(){var a=this.controller,b=a.state();a.close();c?b.trigger("update",b.get("library")):wp.media.editor.insert(wp.media.dg.shortcode(b.get("library")).string().replace(/\sdgorder=/ig,
12
+ " order=").replace(/\sdgorderby=/ig," orderby="));a.setState(a.options.state);a.reset();"undefined"!=typeof tinyMCE&&null!==tinyMCE.activeEditor&&tinyMCE.activeEditor.fire("update.dg")}}}}))},dgAddToolbar:function(){this.toolbar.set(new a.view.Toolbar({controller:this,items:{insert:{style:"primary",text:f.addTodg,priority:80,requires:{selection:!0},click:function(){var a=this.controller,b=a.state();a.state("dg-edit").get("library").add(b.get("selection").models);b.trigger("reset");a.setState("dg-edit")}}}}))}});
13
  wp.media._dgDefaults={id:wp.media.view.settings.post&&wp.media.view.settings.post.id,columns:dgDefaults.columns,fancy:dgDefaults.fancy,relation:dgDefaults.relation,limit:dgDefaults.limit,mime_types:dgDefaults.mime_types,post_status:dgDefaults.post_status,post_type:dgDefaults.post_type,attachment_pg:dgDefaults.attachment_pg,descriptions:dgDefaults.descriptions,new_window:dgDefaults.new_window,paginate:dgDefaults.paginate,dgorder:dgDefaults.order,dgorderby:dgDefaults.orderby};wp.media.dgDefaults=wp.media.view.settings.dgDefaults?
14
+ g.extend({},wp.media._dgDefaults,wp.media.view.settings.dgDefaults):wp.media._dgDefaults;wp.media.dg=new wp.media.collection({tag:"dg",editTitle:wp.media.view.l10n.editdgTitle,defaults:wp.media.dgDefaults,setDefaults:function(a){var c=this,b=!g.isEqual(wp.media.dgDefaults,wp.media._dgDefaults);g.each(this.defaults,function(d,e){a[e]=c.coerce(a,e);d!==a[e]||b&&d!==wp.media._dgDefaults[e]||delete a[e]});return a}})}})(jQuery,_);
15
+ "undefined"!==typeof window.wp.mce&&"undefined"!==typeof window.wp.mce.views&&function(b,g,a,f){base={state:[],edit:function(b,c){if(-1==b.search(/\sids\s*=/gi)||-1<b.search(/\s(?!(?:ids|attachment_pg|columns|new_window|descriptions|fancy|orderby|order|paginate|limit)\s*=)[\w\-]+\s*=/gi))tinyMCE.activeEditor.windowManager.alert(DGl10n.unfitSCalert);else{var d=this.type,e=a[d].edit(b.replace(/\sorder\s*=/ig," dgorder=").replace(/\sorderby\s*=/ig," dgorderby="));this.pausePlayers&&this.pausePlayers();
16
+ _.each(this.state,function(b){e.state(b).on("update",function(b){c(a[d].shortcode(b).string().replace(/\sdgorder=/ig," order=").replace(/\sdgorderby=/ig," orderby="),"dg"===d)})});e.on("close",function(){e.detach()});e.open()}}};b=_.extend({},base,{state:["dg-edit"],template:a.template("editor-dg"),initialize:function(){a.dg.attachments(this.shortcode,a.view.settings.post.id);var b=this.shortcode.attrs.named,c=this.text,d={};for(prop in b)-1<c.indexOf(" "+prop+"=")&&(d[prop]=b[prop]);-1<c.indexOf(" dgorderby=")&&
17
+ (d.orderby=b.dgorderby);-1<c.indexOf(" dgorder=")&&(d.order=b.dgorder);this.render('<div data-shortcode="'+encodeURIComponent(JSON.stringify(d))+'"><div class="loading-placeholder"><div class="dashicons dashicons-admin-media"></div><div class="wpview-loading"><ins></ins></div></div></div>')}});g.register("dg",_.extend({},b))}(window,window.wp.mce.views,window.wp.media,window.jQuery);
document-gallery.php CHANGED
@@ -5,14 +5,14 @@ defined( 'WPINC' ) OR exit;
5
  Plugin Name: Document Gallery
6
  Plugin URI: https://wordpress.org/plugins/document-gallery/
7
  Description: Display non-images (and images) in gallery format on a page or post with the [dg] shortcode.
8
- Version: 4.3.2
9
  Author: Dan Rossiter
10
  Author URI: http://danrossiter.org/
11
  License: GPLv3
12
  Text Domain: document-gallery
13
  */
14
 
15
- define( 'DG_VERSION', '4.3.2' );
16
 
17
  if ( version_compare( PHP_VERSION, '5.3', '<' ) ) {
18
  add_action( 'admin_notices', 'dg_php_lt_three' );
5
  Plugin Name: Document Gallery
6
  Plugin URI: https://wordpress.org/plugins/document-gallery/
7
  Description: Display non-images (and images) in gallery format on a page or post with the [dg] shortcode.
8
+ Version: 4.4
9
  Author: Dan Rossiter
10
  Author URI: http://danrossiter.org/
11
  License: GPLv3
12
  Text Domain: document-gallery
13
  */
14
 
15
+ define( 'DG_VERSION', '4.4' );
16
 
17
  if ( version_compare( PHP_VERSION, '5.3', '<' ) ) {
18
  add_action( 'admin_notices', 'dg_php_lt_three' );
inc/class-gallery.php CHANGED
@@ -323,6 +323,10 @@ class DG_Gallery {
323
  }
324
  }
325
 
 
 
 
 
326
  // build tax query
327
  foreach ( $this->taxa as $taxon => $terms ) {
328
  if ( in_array( $taxon, $excluded_keys ) ) continue;
323
  }
324
  }
325
 
326
+ // TODO: Need to refactor this whole method to get this filter out of setTaxa
327
+ // implement with add_action with signature: function dg_query(&$query, $taxa, &$excluded_keys, &$errs)
328
+ do_action_ref_array( 'dg_query', array( &$query, $this->taxa, &$excluded_keys, &$this->errs ) );
329
+
330
  // build tax query
331
  foreach ( $this->taxa as $taxon => $terms ) {
332
  if ( in_array( $taxon, $excluded_keys ) ) continue;