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 | Document Gallery |
Version | 4.4 |
Comparing to | |
See all releases |
Code changes from version 4.3.2 to 4.4
- CHANGELOG.md +6 -0
- README.txt +24 -1
- assets/js/admin.min.js +14 -12
- assets/js/gallery.min.js +6 -4
- assets/js/media_manager.min.js +15 -13
- document-gallery.php +2 -2
- inc/class-gallery.php +4 -0
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¤cy_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.
|
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¤cy_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 |
-
|
2 |
-
|
3 |
-
|
4 |
-
a||event;
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
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",
|
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"),
|
17 |
-
"true");
|
18 |
-
function(){4==
|
19 |
-
(
|
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 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
|
|
|
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 |
-
|
|
|
|
|
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
|
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"),
|
5 |
-
a.model.Selection.prototype.validator.apply(this,arguments)};c.reset(c.mirroring.models,{silent:!0});c.observe(
|
6 |
-
(c
|
7 |
-
title:
|
8 |
-
this);this.on("toolbar:render:dg-add",this.dgAddToolbar,this)},dgMenu:function(c){var
|
9 |
-
|
10 |
-
" order=").replace(/\sdgorderby=/ig," orderby="));
|
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(
|
13 |
-
"undefined"!==typeof window.wp.mce&&"undefined"!==typeof window.wp.mce.views&&function(
|
14 |
-
_.each(this.state,function(
|
15 |
-
(
|
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.
|
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.
|
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;
|