Save Contact Form 7 - Version 1.5

Version Description

Download this release

Release Info

Developer nimblechapps
Plugin Icon 128x128 Save Contact Form 7
Version 1.5
Comparing to
See all releases

Code changes from version 1.4 to 1.5

Readme.txt CHANGED
@@ -1,15 +1,15 @@
1
  === Save Contact Form 7 ===
2
  Contributors: nimblechapps
3
  Donate link: http://savecontactform7.com/donate
4
- Tags: Save Contact Enquiry, Save Contact Inquiry, Save Contact Entries, Save Forms Data, Contact Form Storage, Contact Form Entry Storage, Contact Enquiry Storage, Contact Form Save, Storage Contact Enquiry, ContactFormDB, JetPack Contact Form, Contact Form 7, CF7, Fast Secure Contact Form, FSCF, Gravity Forms, WR ContactForm, Quform, Ninja Forms, Caldera Forms, Enfold theme forms, contactform7, Contact Form Advanced Database, Storage for Contact Form 7, cfdb, contact form 7 extension, contact form db extension, contact form, save contact form 7 to database
5
  Requires at least: 3.0
6
  Tested up to: 4.5.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
- Stable tag: 1.4
10
 
11
 
12
- Save Contact Form 7 data. Sort, search & export it in CSV+PDF. Best UI. Fully tested with WP 3.0 + CF7 2.4.6 & above. Totally Supported.
13
 
14
  == Description ==
15
 
@@ -73,6 +73,10 @@ Select any form for which you want to download the entries, from the populated e
73
 
74
  == Changelog ==
75
 
 
 
 
 
76
  = 1.4 =
77
 
78
  * Given setting page option to view/hide Record created Date and Time column.
1
  === Save Contact Form 7 ===
2
  Contributors: nimblechapps
3
  Donate link: http://savecontactform7.com/donate
4
+ Tags: Save Contact Enquiry, Save Contact Inquiry, Save Contact Entries, Save Forms Data, Contact Form Storage, Contact Form Entry Storage, Contact Enquiry Storage, Contact Form Save, Storage Contact Enquiry, ContactFormDB, JetPack Contact Form, Contact Form 7, CF7, Fast Secure Contact Form, FSCF, Gravity Forms, WR ContactForm, Quform, Ninja Forms, Caldera Forms, Enfold theme forms, contactform7, Contact Form Advanced Database, Storage for Contact Form 7, cfdb, contact form 7 extension, contact form db extension, contact form, save contact form 7 to database, contact, AJAX, form, form database, contact form database, contact form plugin, contact forms plugin, contact forms, contact us form, best contact form plugin
5
  Requires at least: 3.0
6
  Tested up to: 4.5.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
+ Stable tag: 1.5
10
 
11
 
12
+ Save Contact Form 7 data. Sort, search & export it in CSV+PDF. Best UI. Fully tested with WP 4.5.3 + CF7 4.4.2 & Totally Supported.
13
 
14
  == Description ==
15
 
73
 
74
  == Changelog ==
75
 
76
+ = 1.5 =
77
+
78
+ * Corrected CSV title.
79
+
80
  = 1.4 =
81
 
82
  * Given setting page option to view/hide Record created Date and Time column.
assets/DataTables/media/js/buttons/buttons.html5.min.js CHANGED
@@ -1,261 +1,706 @@
1
- (function (g) {
2
- "function" === typeof define && define.amd ? define(["jquery", "datatables.net", "datatables.net-buttons"], function (d) {
3
- return g(d, window, document)
4
- }) : "object" === typeof exports ? module.exports = function (d, f) {
5
- d || (d = window);
6
- if (!f || !f.fn.dataTable)
7
- f = require("datatables.net")(d, f).$;
8
- f.fn.dataTable.Buttons || require("datatables.net-buttons")(d, f);
9
- return g(f, d, d.document)
10
- } : g(jQuery, window, document)
11
- })(function (g, d, f, k) {
12
- var l = g.fn.dataTable, j;
13
- if ("undefined" !== typeof navigator && /MSIE [1-9]\./.test(navigator.userAgent))
14
- j =
15
- void 0;
16
- else {
17
- var v = d.document, o = v.createElementNS("http://www.w3.org/1999/xhtml", "a"), D = "download"in o, p = d.webkitRequestFileSystem, w = d.requestFileSystem || p || d.mozRequestFileSystem, E = function (a) {
18
- (d.setImmediate || d.setTimeout)(function () {
19
- throw a;
20
- }, 0)
21
- }, q = 0, r = function (a) {
22
- var b = function () {
23
- "string" === typeof a ? (d.URL || d.webkitURL || d).revokeObjectURL(a) : a.remove()
24
- };
25
- d.chrome ? b() : setTimeout(b, 500)
26
- }, s = function (a, b, e) {
27
- for (var b = [].concat(b), c = b.length; c--; ) {
28
- var d = a["on" + b[c]];
29
- if ("function" === typeof d)
30
- try {
31
- d.call(a,
32
- e || a)
33
- } catch (h) {
34
- E(h)
35
- }
36
- }
37
- }, y = function (a) {
38
- return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type) ? new Blob(["", a], {type: a.type}) : a
39
- }, A = function (a, b) {
40
- var a = y(a), e = this, c = a.type, x = !1, h, g, z = function () {
41
- s(e, ["writestart", "progress", "write", "writeend"])
42
- }, f = function () {
43
- if (x || !h)
44
- h = (d.URL || d.webkitURL || d).createObjectURL(a);
45
- g ? g.location.href = h : d.open(h, "_blank") === k && "undefined" !== typeof safari && (d.location.href = h);
46
- e.readyState = e.DONE;
47
- z();
48
- r(h)
49
- }, n = function (a) {
50
- return function () {
51
- if (e.readyState !==
52
- e.DONE)
53
- return a.apply(this, arguments)
54
- }
55
- }, i = {create: !0, exclusive: !1}, j;
56
- e.readyState = e.INIT;
57
- b || (b = "download");
58
- if (D)
59
- h = (d.URL || d.webkitURL || d).createObjectURL(a), o.href = h, o.download = b, c = v.createEvent("MouseEvents"), c.initMouseEvent("click", !0, !1, d, 0, 0, 0, 0, 0, !1, !1, !1, !1, 0, null), o.dispatchEvent(c), e.readyState = e.DONE, z(), r(h);
60
- else {
61
- d.chrome && (c && "application/octet-stream" !== c) && (j = a.slice || a.webkitSlice, a = j.call(a, 0, a.size, "application/octet-stream"), x = !0);
62
- p && "download" !== b && (b += ".download");
63
- if ("application/octet-stream" ===
64
- c || p)
65
- g = d;
66
- w ? (q += a.size, w(d.TEMPORARY, q, n(function (c) {
67
- c.root.getDirectory("saved", i, n(function (c) {
68
- var d = function () {
69
- c.getFile(b, i, n(function (b) {
70
- b.createWriter(n(function (c) {
71
- c.onwriteend = function (a) {
72
- g.location.href = b.toURL();
73
- e.readyState = e.DONE;
74
- s(e, "writeend", a);
75
- r(b)
76
- };
77
- c.onerror = function () {
78
- var a = c.error;
79
- a.code !== a.ABORT_ERR && f()
80
- };
81
- ["writestart", "progress", "write", "abort"].forEach(function (a) {
82
- c["on" + a] = e["on" + a]
83
- });
84
- c.write(a);
85
- e.abort = function () {
86
- c.abort();
87
- e.readyState = e.DONE
88
- };
89
- e.readyState = e.WRITING
90
- }), f)
91
- }),
92
- f)
93
- };
94
- c.getFile(b, {create: false}, n(function (a) {
95
- a.remove();
96
- d()
97
- }), n(function (a) {
98
- a.code === a.NOT_FOUND_ERR ? d() : f()
99
- }))
100
- }), f)
101
- }), f)) : f()
102
- }
103
- }, i = A.prototype;
104
- "undefined" !== typeof navigator && navigator.msSaveOrOpenBlob ? j = function (a, b) {
105
- return navigator.msSaveOrOpenBlob(y(a), b)
106
- } : (i.abort = function () {
107
- this.readyState = this.DONE;
108
- s(this, "abort")
109
- }, i.readyState = i.INIT = 0, i.WRITING = 1, i.DONE = 2, i.error = i.onwritestart = i.onprogress = i.onwrite = i.onabort = i.onerror = i.onwriteend = null, j = function (a, b) {
110
- return new A(a, b)
111
- })
112
- }
113
- var t = function (a,
114
- b) {
115
- var e = "*" === a.filename && "*" !== a.title && a.title !== k ? a.title : a.filename;
116
- -1 !== e.indexOf("*") && (e = e.replace("*", g("title").text()));
117
- e = e.replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g, "");
118
- return b === k || !0 === b ? e + a.extension : e
119
- }, F = function (a) {
120
- a = a.title;
121
- return-1 !== a.indexOf("*") ? a.replace("*", g("title").text()) : a
122
- }, u = function (a) {
123
- return a.newline ? a.newline : navigator.userAgent.match(/Windows/) ? "\r\n" : "\n"
124
- }, B = function (a, b) {
125
-
126
-
127
- for (var e = u(b), c = a.buttons.exportData(b.exportOptions), d = b.fieldBoundary, h = b.fieldSeparator,
128
- f = RegExp(d, "g"), g = b.escapeChar !== k ? b.escapeChar : "\\", i = function (a) {
129
- for (var b = "", c = 0, e = a.length; c < e; c++)
130
- 0 < c && (b += h), b += d ? d + ("" + a[c]).replace(f, g + d) + d : a[c];
131
- return b
132
-
133
- }, n = b.header ? i(c.header) + e : "", j = b.footer ? e + i(c.footer) : "", l = [], m = 0, o = c.body.length; m < o; m++){
134
- l.push(i(c.body[m]));
135
-
136
- }
137
- return{str: n + l.join(e) + j, rows: l.length}
138
- }, C = function () {
139
- return-1 !== navigator.userAgent.indexOf("Safari") && -1 === navigator.userAgent.indexOf("Chrome") && -1 === navigator.userAgent.indexOf("Opera")
140
- }, m = {"_rels/.rels": '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">\t<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>',
141
- "xl/_rels/workbook.xml.rels": '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">\t<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/></Relationships>', "[Content_Types].xml": '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">\t<Default Extension="xml" ContentType="application/xml"/>\t<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>\t<Default Extension="jpeg" ContentType="image/jpeg"/>\t<Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>\t<Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/></Types>',
142
- "xl/workbook.xml": '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">\t<fileVersion appName="xl" lastEdited="5" lowestEdited="5" rupBuild="24816"/>\t<workbookPr showInkAnnotation="0" autoCompressPictures="0"/>\t<bookViews>\t\t<workbookView xWindow="0" yWindow="0" windowWidth="25600" windowHeight="19020" tabRatio="500"/>\t</bookViews>\t<sheets>\t\t<sheet name="Sheet1" sheetId="1" r:id="rId1"/>\t</sheets></workbook>',
143
- "xl/worksheets/sheet1.xml": '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac">\t<sheetData>\t\t__DATA__\t</sheetData></worksheet>'};
144
- l.ext.buttons.copyHtml5 = {className: "buttons-copy buttons-html5",
145
- text: function (a) {
146
- return a.i18n("buttons.copy", "Copy")
147
- }, action: function (a, b, d, c) {
148
- // console.log(Object.getOwnPropertyNames(b));
149
- a = B(b, c);
150
- c = a.str;
151
- d = g("<div/>").css({height: 1, width: 1, overflow: "hidden", position: "fixed", top: 0, left: 0});
152
- c = g("<textarea readonly/>").val(c).appendTo(d);
153
-
154
-
155
- if (f.queryCommandSupported("copy")) {
156
- d.appendTo("body");
157
- c[0].focus();
158
- c[0].select();
159
- try {
160
- f.execCommand("copy");
161
- d.remove();
162
- b.buttons.info(b.i18n("buttons.copyTitle", "Copy to clipboard"), b.i18n("buttons.copySuccess", {1: "Copied one row to clipboard", _: "Copied %d rows to clipboard"},
163
- a.rows), 2E3);
164
- return
165
- } catch (i) {
166
- }
167
- }
168
- a = g("<span>" + b.i18n("buttons.copyKeys", "Press <i>ctrl</i> or <i>⌘</i> + <i>C</i> to copy the table data<br>to your system clipboard.<br><br>To cancel, click this message or press escape.") + "</span>").append(d);
169
- b.buttons.info(b.i18n("buttons.copyTitle", "Copy to clipboard"), a, 0);
170
- c[0].focus();
171
- c[0].select();
172
- var h = g(a).closest(".dt-button-info"), j = function () {
173
- h.off("click.buttons-copy");
174
- g(f).off(".buttons-copy");
175
- b.buttons.info(!1)
176
- };
177
- h.on("click.buttons-copy", j);
178
- g(f).on("keydown.buttons-copy",
179
- function (a) {
180
- 27 === a.keyCode && j()
181
- }).on("copy.buttons-copy cut.buttons-copy", function () {
182
- j()
183
- })
184
- }, exportOptions: {}, fieldSeparator: "\t", fieldBoundary: "", header: !0, footer: !1};
185
-
186
- l.ext.buttons.csvHtml5 = {className: "buttons-csv buttons-html5", available: function () {
187
- return d.FileReader !== k && d.Blob
188
- }, text: function (a) {
189
- return a.i18n("buttons.csv", "CSV")
190
- }, action: function (a, b, d, c) {
191
- u(c);
192
- a = B(b, c).str;
193
- b = c.charset;
194
- !1 !== b ? (b || (b = f.characterSet || f.charset), b && (b = ";charset=" + b)) : b = "";
195
- j(new Blob([a], {type: "text/csv" + b}), t(c))
196
- },
197
- filename: "*", extension: ".csv", exportOptions: {}, fieldSeparator: ",", fieldBoundary: '', escapeChar: '', charset: null, header: !0, footer: !1};
198
-
199
- l.ext.buttons.excelHtml5 = {className: "buttons-excel buttons-html5", available: function () {
200
- return d.FileReader !== k && d.JSZip !== k && !C()
201
- }, text: function (a) {
202
- return a.i18n("buttons.excel", "Excel")
203
- },
204
- action: function (a, b, e, c) {
205
- a = "";
206
- b = b.buttons.exportData(c.exportOptions);
207
- e = function (a) {
208
- for (var b = [], c = 0, d = a.length; c < d; c++) {
209
- if (null === a[c] || a[c] === k)
210
- a[c] = "";
211
- b.push("number" === typeof a[c] ||
212
- a[c].match && a[c].match(/^-?[0-9\.]+$/) && "0" !== a[c].charAt(0) ? '<c t="n"><v>' + a[c] + "</v></c>" : '<c t="inlineStr"><is><t>' + (!a[c].replace ? a[c] : a[c].replace(/&(?!amp;)/g, "&amp;").replace(/[\x00-\x1F\x7F-\x9F]/g, "")) + "</t></is></c>")
213
- }
214
- return"<row>" + b.join("") + "</row>"
215
- };
216
- c.header && (a += e(b.header));
217
- for (var f = 0, h = b.body.length; f < h; f++)
218
- a += e(b.body[f]);
219
- c.footer && (a += e(b.footer));
220
- var b = new d.JSZip, e = b.folder("_rels"), f = b.folder("xl"), h = b.folder("xl/_rels"), g = b.folder("xl/worksheets");
221
- b.file("[Content_Types].xml",
222
- m["[Content_Types].xml"]);
223
- e.file(".rels", m["_rels/.rels"]);
224
- f.file("workbook.xml", m["xl/workbook.xml"]);
225
- h.file("workbook.xml.rels", m["xl/_rels/workbook.xml.rels"]);
226
- g.file("sheet1.xml", m["xl/worksheets/sheet1.xml"].replace("__DATA__", a));
227
- j(b.generate({type: "blob"}), t(c))
228
- }, filename: "*", extension: ".xlsx", exportOptions: {}, header: !0, footer: !1};
229
- l.ext.buttons.pdfHtml5 = {className: "buttons-pdf buttons-html5", available: function () {
230
- return d.FileReader !== k && d.pdfMake
231
- }, text: function (a) {
232
- return a.i18n("buttons.pdf",
233
- "PDF")
234
- }, action: function (a, b, e, c) {
235
- u(c);
236
- a = b.buttons.exportData(c.exportOptions);
237
- b = [];
238
- c.header && b.push(g.map(a.header, function (a) {
239
- return{text: "string" === typeof a ? a : a + "", style: "tableHeader"}
240
- }));
241
- for (var f = 0, e = a.body.length; f < e; f++)
242
- b.push(g.map(a.body[f], function (a) {
243
- return{text: "string" === typeof a ? a : a + "", style: f % 2 ? "tableBodyEven" : "tableBodyOdd"}
244
- }));
245
- c.footer && b.push(g.map(a.footer, function (a) {
246
- return{text: "string" === typeof a ? a : a + "", style: "tableFooter"}
247
- }));
248
- a = {pageSize: c.pageSize, pageOrientation: c.orientation,
249
- content: [{table: {headerRows: 1, body: b}, layout: "noBorders"}], styles: {tableHeader: {bold: !0, fontSize: 11, color: "white", fillColor: "#2d4154", alignment: "center"}, tableBodyEven: {}, tableBodyOdd: {fillColor: "#f3f3f3"}, tableFooter: {bold: !0, fontSize: 11, color: "white", fillColor: "#2d4154"}, title: {alignment: "center", fontSize: 15}, message: {}}, defaultStyle: {fontSize: 10}};
250
- c.message && a.content.unshift({text: c.message, style: "message", margin: [0, 0, 0, 12]});
251
- c.title && a.content.unshift({text: F(c, !1), style: "title", margin: [0, 0,
252
- 0, 12]});
253
- c.customize && c.customize(a);
254
- a = d.pdfMake.createPdf(a);
255
- "open" === c.download && !C() ? a.open() : a.getBuffer(function (a) {
256
- a = new Blob([a], {type: "application/pdf"});
257
- j(a, t(c))
258
- })
259
- }, title: "*", filename: "*", extension: ".pdf", exportOptions: {}, orientation: "portrait", pageSize: "A4", header: !0, footer: !1, message: null, customize: null, download: "download"};
260
- return l.Buttons
261
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * HTML5 export buttons for Buttons and DataTables.
3
+ * 2015 SpryMedia Ltd - datatables.net/license
4
+ *
5
+ * FileSaver.js (2015-05-07.2) - MIT license
6
+ * Copyright © 2015 Eli Grey - http://eligrey.com
7
+ */
8
+
9
+ (function($, DataTable) {
10
+ "use strict";
11
+
12
+
13
+ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
14
+ * FileSaver.js dependency
15
+ */
16
+
17
+ /*jslint bitwise: true, indent: 4, laxbreak: true, laxcomma: true, smarttabs: true, plusplus: true */
18
+
19
+ var _saveAs = (function(view) {
20
+ // IE <10 is explicitly unsupported
21
+ if (typeof navigator !== "undefined" && /MSIE [1-9]\./.test(navigator.userAgent)) {
22
+ return;
23
+ }
24
+ var
25
+ doc = view.document
26
+ // only get URL when necessary in case Blob.js hasn't overridden it yet
27
+ , get_URL = function() {
28
+ return view.URL || view.webkitURL || view;
29
+ }
30
+ , save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a")
31
+ , can_use_save_link = "download" in save_link
32
+ , click = function(node) {
33
+ var event = doc.createEvent("MouseEvents");
34
+ event.initMouseEvent(
35
+ "click", true, false, view, 0, 0, 0, 0, 0
36
+ , false, false, false, false, 0, null
37
+ );
38
+ node.dispatchEvent(event);
39
+ }
40
+ , webkit_req_fs = view.webkitRequestFileSystem
41
+ , req_fs = view.requestFileSystem || webkit_req_fs || view.mozRequestFileSystem
42
+ , throw_outside = function(ex) {
43
+ (view.setImmediate || view.setTimeout)(function() {
44
+ throw ex;
45
+ }, 0);
46
+ }
47
+ , force_saveable_type = "application/octet-stream"
48
+ , fs_min_size = 0
49
+ // See https://code.google.com/p/chromium/issues/detail?id=375297#c7 and
50
+ // https://github.com/eligrey/FileSaver.js/commit/485930a#commitcomment-8768047
51
+ // for the reasoning behind the timeout and revocation flow
52
+ , arbitrary_revoke_timeout = 500 // in ms
53
+ , revoke = function(file) {
54
+ var revoker = function() {
55
+ if (typeof file === "string") { // file is an object URL
56
+ get_URL().revokeObjectURL(file);
57
+ } else { // file is a File
58
+ file.remove();
59
+ }
60
+ };
61
+ if (view.chrome) {
62
+ revoker();
63
+ } else {
64
+ setTimeout(revoker, arbitrary_revoke_timeout);
65
+ }
66
+ }
67
+ , dispatch = function(filesaver, event_types, event) {
68
+ event_types = [].concat(event_types);
69
+ var i = event_types.length;
70
+ while (i--) {
71
+ var listener = filesaver["on" + event_types[i]];
72
+ if (typeof listener === "function") {
73
+ try {
74
+ listener.call(filesaver, event || filesaver);
75
+ } catch (ex) {
76
+ throw_outside(ex);
77
+ }
78
+ }
79
+ }
80
+ }
81
+ , auto_bom = function(blob) {
82
+ // prepend BOM for UTF-8 XML and text/* types (including HTML)
83
+ if (/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) {
84
+ return new Blob(["\ufeff", blob], {type: blob.type});
85
+ }
86
+ return blob;
87
+ }
88
+ , FileSaver = function(blob, name) {
89
+ blob = auto_bom(blob);
90
+ // First try a.download, then web filesystem, then object URLs
91
+ var
92
+ filesaver = this
93
+ , type = blob.type
94
+ , blob_changed = false
95
+ , object_url
96
+ , target_view
97
+ , dispatch_all = function() {
98
+ dispatch(filesaver, "writestart progress write writeend".split(" "));
99
+ }
100
+ // on any filesys errors revert to saving with object URLs
101
+ , fs_error = function() {
102
+ // don't create more object URLs than needed
103
+ if (blob_changed || !object_url) {
104
+ object_url = get_URL().createObjectURL(blob);
105
+ }
106
+ if (target_view) {
107
+ target_view.location.href = object_url;
108
+ } else {
109
+ var new_tab = view.open(object_url, "_blank");
110
+ if (new_tab === undefined && typeof safari !== "undefined") {
111
+ //Apple do not allow window.open, see http://bit.ly/1kZffRI
112
+ view.location.href = object_url;
113
+ }
114
+ }
115
+ filesaver.readyState = filesaver.DONE;
116
+ dispatch_all();
117
+ revoke(object_url);
118
+ }
119
+ , abortable = function(func) {
120
+ return function() {
121
+ if (filesaver.readyState !== filesaver.DONE) {
122
+ return func.apply(this, arguments);
123
+ }
124
+ };
125
+ }
126
+ , create_if_not_found = {create: true, exclusive: false}
127
+ , slice
128
+ ;
129
+ filesaver.readyState = filesaver.INIT;
130
+ if (!name) {
131
+ name = "download";
132
+ }
133
+ if (can_use_save_link) {
134
+ object_url = get_URL().createObjectURL(blob);
135
+ save_link.href = object_url;
136
+ save_link.download = name;
137
+ click(save_link);
138
+ filesaver.readyState = filesaver.DONE;
139
+ dispatch_all();
140
+ revoke(object_url);
141
+ return;
142
+ }
143
+ // Object and web filesystem URLs have a problem saving in Google Chrome when
144
+ // viewed in a tab, so I force save with application/octet-stream
145
+ // http://code.google.com/p/chromium/issues/detail?id=91158
146
+ // Update: Google errantly closed 91158, I submitted it again:
147
+ // https://code.google.com/p/chromium/issues/detail?id=389642
148
+ if (view.chrome && type && type !== force_saveable_type) {
149
+ slice = blob.slice || blob.webkitSlice;
150
+ blob = slice.call(blob, 0, blob.size, force_saveable_type);
151
+ blob_changed = true;
152
+ }
153
+ // Since I can't be sure that the guessed media type will trigger a download
154
+ // in WebKit, I append .download to the filename.
155
+ // https://bugs.webkit.org/show_bug.cgi?id=65440
156
+ if (webkit_req_fs && name !== "download") {
157
+ name += ".download";
158
+ }
159
+ if (type === force_saveable_type || webkit_req_fs) {
160
+ target_view = view;
161
+ }
162
+ if (!req_fs) {
163
+ fs_error();
164
+ return;
165
+ }
166
+ fs_min_size += blob.size;
167
+ req_fs(view.TEMPORARY, fs_min_size, abortable(function(fs) {
168
+ fs.root.getDirectory("saved", create_if_not_found, abortable(function(dir) {
169
+ var save = function() {
170
+ dir.getFile(name, create_if_not_found, abortable(function(file) {
171
+ file.createWriter(abortable(function(writer) {
172
+ writer.onwriteend = function(event) {
173
+ target_view.location.href = file.toURL();
174
+ filesaver.readyState = filesaver.DONE;
175
+ dispatch(filesaver, "writeend", event);
176
+ revoke(file);
177
+ };
178
+ writer.onerror = function() {
179
+ var error = writer.error;
180
+ if (error.code !== error.ABORT_ERR) {
181
+ fs_error();
182
+ }
183
+ };
184
+ "writestart progress write abort".split(" ").forEach(function(event) {
185
+ writer["on" + event] = filesaver["on" + event];
186
+ });
187
+ writer.write(blob);
188
+ filesaver.abort = function() {
189
+ writer.abort();
190
+ filesaver.readyState = filesaver.DONE;
191
+ };
192
+ filesaver.readyState = filesaver.WRITING;
193
+ }), fs_error);
194
+ }), fs_error);
195
+ };
196
+ dir.getFile(name, {create: false}, abortable(function(file) {
197
+ // delete file if it already exists
198
+ file.remove();
199
+ save();
200
+ }), abortable(function(ex) {
201
+ if (ex.code === ex.NOT_FOUND_ERR) {
202
+ save();
203
+ } else {
204
+ fs_error();
205
+ }
206
+ }));
207
+ }), fs_error);
208
+ }), fs_error);
209
+ }
210
+ , FS_proto = FileSaver.prototype
211
+ , saveAs = function(blob, name) {
212
+ return new FileSaver(blob, name);
213
+ }
214
+ ;
215
+ // IE 10+ (native saveAs)
216
+ if (typeof navigator !== "undefined" && navigator.msSaveOrOpenBlob) {
217
+ return function(blob, name) {
218
+ return navigator.msSaveOrOpenBlob(auto_bom(blob), name);
219
+ };
220
+ }
221
+
222
+ FS_proto.abort = function() {
223
+ var filesaver = this;
224
+ filesaver.readyState = filesaver.DONE;
225
+ dispatch(filesaver, "abort");
226
+ };
227
+ FS_proto.readyState = FS_proto.INIT = 0;
228
+ FS_proto.WRITING = 1;
229
+ FS_proto.DONE = 2;
230
+
231
+ FS_proto.error =
232
+ FS_proto.onwritestart =
233
+ FS_proto.onprogress =
234
+ FS_proto.onwrite =
235
+ FS_proto.onabort =
236
+ FS_proto.onerror =
237
+ FS_proto.onwriteend =
238
+ null;
239
+
240
+ return saveAs;
241
+ }(window));
242
+
243
+
244
+
245
+ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
246
+ * Local (private) functions
247
+ */
248
+
249
+ /**
250
+ * Get the title / file name for an exported file.
251
+ *
252
+ * @param {object} config Button configuration
253
+ * @param {boolean} incExtension Include the file name extension
254
+ */
255
+ var _filename = function ( config, incExtension )
256
+ {
257
+ var title = config.title;
258
+
259
+ if ( title.indexOf( '*' ) !== -1 ) {
260
+ title = title.replace( '*', $('title').text() );
261
+ }
262
+
263
+ // Strip characters which the OS will object to
264
+ title = title.replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g, "");
265
+
266
+ return incExtension === undefined || incExtension === true ?
267
+ title+config.extension :
268
+ title;
269
+ };
270
+
271
+ /**
272
+ * Get the newline character(s)
273
+ *
274
+ * @param {object} config Button configuration
275
+ * @return {string} Newline character
276
+ */
277
+ var _newLine = function ( config )
278
+ {
279
+ return config.newline ?
280
+ config.newline :
281
+ navigator.userAgent.match(/Windows/) ?
282
+ '\r\n' :
283
+ '\n';
284
+ };
285
+
286
+ /**
287
+ * Combine the data from the `buttons.exportData` method into a string that
288
+ * will be used in the export file.
289
+ *
290
+ * @param {DataTable.Api} dt DataTables API instance
291
+ * @param {object} config Button configuration
292
+ * @return {object} The data to export
293
+ */
294
+ var _exportData = function ( dt, config )
295
+ {
296
+ var newLine = _newLine( config );
297
+ var data = dt.buttons.exportData( config.exportOptions );
298
+ var join = function ( a ) {
299
+ return config.fieldBoundary +
300
+ a.join( config.fieldBoundary + config.fieldSeparator + config.fieldBoundary ) +
301
+ config.fieldBoundary;
302
+ };
303
+
304
+ var header = config.header ? join( data.header )+newLine : '';
305
+ var footer = config.footer ? newLine+join( data.footer ) : '';
306
+ var body = [];
307
+
308
+ for ( var i=0, ien=data.body.length ; i<ien ; i++ ) {
309
+ body.push( join( data.body[i] ) );
310
+ }
311
+
312
+ return {
313
+ str: header + body.join( newLine ) + footer,
314
+ rows: body.length
315
+ };
316
+ };
317
+
318
+ /**
319
+ * Safari's data: support for creating and downloading files is really poor, so
320
+ * various options need to be disabled in it. See
321
+ * https://bugs.webkit.org/show_bug.cgi?id=102914
322
+ *
323
+ * @return {Boolean} `true` if Safari
324
+ */
325
+ var _isSafari = function ()
326
+ {
327
+ return navigator.userAgent.indexOf('Safari') !== -1 &&
328
+ navigator.userAgent.indexOf('Chrome') === -1 &&
329
+ navigator.userAgent.indexOf('Opera') === -1;
330
+ };
331
+
332
+
333
+ // Excel - Pre-defined strings to build a minimal XLSX file
334
+ var excelStrings = {
335
+ "_rels/.rels": '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\
336
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">\
337
+ <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/>\
338
+ </Relationships>',
339
+
340
+ "xl/_rels/workbook.xml.rels": '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\
341
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">\
342
+ <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/>\
343
+ </Relationships>',
344
+
345
+ "[Content_Types].xml": '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\
346
+ <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">\
347
+ <Default Extension="xml" ContentType="application/xml"/>\
348
+ <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>\
349
+ <Default Extension="jpeg" ContentType="image/jpeg"/>\
350
+ <Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>\
351
+ <Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>\
352
+ </Types>',
353
+
354
+ "xl/workbook.xml": '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\
355
+ <workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">\
356
+ <fileVersion appName="xl" lastEdited="5" lowestEdited="5" rupBuild="24816"/>\
357
+ <workbookPr showInkAnnotation="0" autoCompressPictures="0"/>\
358
+ <bookViews>\
359
+ <workbookView xWindow="0" yWindow="0" windowWidth="25600" windowHeight="19020" tabRatio="500"/>\
360
+ </bookViews>\
361
+ <sheets>\
362
+ <sheet name="Sheet1" sheetId="1" r:id="rId1"/>\
363
+ </sheets>\
364
+ </workbook>',
365
+
366
+ "xl/worksheets/sheet1.xml": '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\
367
+ <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac">\
368
+ <sheetData>\
369
+ __DATA__\
370
+ </sheetData>\
371
+ </worksheet>'
372
+ };
373
+
374
+
375
+
376
+ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
377
+ * Buttons
378
+ */
379
+
380
+ //
381
+ // Copy to clipboard
382
+ //
383
+ DataTable.ext.buttons.copyHtml5 = {
384
+ className: 'buttons-copy buttons-html5',
385
+
386
+ text: function ( dt ) {
387
+ return dt.i18n( 'buttons.copy', 'Copy' );
388
+ },
389
+
390
+ action: function ( e, dt, button, config ) {
391
+ // This button is slightly sneaky as there is no HTML API to copy text
392
+ // to a clipboard, so what it does is use the buttons information
393
+ // element with an also completely hidden textarea that contains the
394
+ // data to be copied. That is pre-selected so the user just needs to
395
+ // activate their system clipboard.
396
+ var newLine = _newLine( config );
397
+ var output = _exportData( dt, config ).str;
398
+ var message = $('<span>'+dt.i18n( 'buttons.copyKeys',
399
+ 'Press <i>ctrl</i> or <i>\u2318</i> + <i>C</i> to copy the table data<br>to your system clipboard.<br><br>'+
400
+ 'To cancel, click this message or press escape.' )+'</span>'
401
+ )
402
+ .append( $('<div/>')
403
+ .css( {
404
+ height: 1,
405
+ width: 1,
406
+ overflow: 'hidden'
407
+ } )
408
+ .append(
409
+ $('<textarea readonly/>').val( output )
410
+ )
411
+ );
412
+
413
+ dt.buttons.info( dt.i18n( 'buttons.copyTitle', 'Copy to clipboard' ), message, 0 );
414
+
415
+ // Select the text so when the user activates their system clipboard
416
+ // it will copy that text
417
+ message.find('textarea')[0].focus();
418
+ message.find('textarea')[0].select();
419
+
420
+ // Event to hide the message when the user is done
421
+ var container = $(message).closest('.dt-button-info');
422
+ var close = function () {
423
+ container.off( 'click.buttons-copy' );
424
+ $(document).off( '.buttons-copy' );
425
+ dt.buttons.info( false );
426
+ };
427
+
428
+ container.on( 'click.buttons-copy', close );
429
+ $(document)
430
+ .on( 'keydown.buttons-copy', function (e) {
431
+ if ( e.keyCode === 27 ) { // esc
432
+ close();
433
+ }
434
+ } )
435
+ .on( 'copy.buttons-copy cut.buttons-copy', function () {
436
+ close();
437
+ } );
438
+ },
439
+
440
+ exportOptions: {},
441
+
442
+ fieldSeparator: '\t',
443
+
444
+ fieldBoundary: '',
445
+
446
+ header: true,
447
+
448
+ footer: false
449
+ };
450
+
451
+ //
452
+ // CSV export
453
+ //
454
+ DataTable.ext.buttons.csvHtml5 = {
455
+ className: 'buttons-csv buttons-html5',
456
+
457
+ available: function () {
458
+ return window.FileReader !== undefined && window.Blob;
459
+ },
460
+
461
+ text: function ( dt ) {
462
+ return dt.i18n( 'buttons.csv', 'CSV' );
463
+ },
464
+
465
+ action: function ( e, dt, button, config ) {
466
+ // Set the text
467
+ var newLine = _newLine( config );
468
+ var output = _exportData( dt, config ).str;
469
+
470
+ _saveAs(
471
+ new Blob( [output], {type : 'text/csv'} ),
472
+ _filename( config )
473
+ );
474
+ },
475
+
476
+ title: '*',
477
+
478
+ extension: '.csv',
479
+
480
+ exportOptions: {},
481
+
482
+ fieldSeparator: ',',
483
+
484
+ fieldBoundary: '',
485
+
486
+ header: true,
487
+
488
+ footer: false
489
+ };
490
+
491
+ //
492
+ // Excel (xlsx) export
493
+ //
494
+ DataTable.ext.buttons.excelHtml5 = {
495
+ className: 'buttons-excel buttons-html5',
496
+
497
+ available: function () {
498
+ return window.FileReader !== undefined && window.JSZip !== undefined && ! _isSafari();
499
+ },
500
+
501
+ text: function ( dt ) {
502
+ return dt.i18n( 'buttons.excel', 'Excel' );
503
+ },
504
+
505
+ action: function ( e, dt, button, config ) {
506
+ // Set the text
507
+ var xml = '';
508
+ var data = dt.buttons.exportData( config.exportOptions );
509
+ var addRow = function ( row ) {
510
+ var cells = [];
511
+
512
+ for ( var i=0, ien=row.length ; i<ien ; i++ ) {
513
+ cells.push( $.isNumeric( row[i] ) ?
514
+ '<c t="n"><v>'+row[i]+'</v></c>' :
515
+ '<c t="inlineStr"><is><t>'+row[i]+'</t></is></c>'
516
+ );
517
+ }
518
+
519
+ return '<row>'+cells.join('')+'</row>';
520
+ };
521
+
522
+ if ( config.header ) {
523
+ xml += addRow( data.header );
524
+ }
525
+
526
+ for ( var i=0, ien=data.body.length ; i<ien ; i++ ) {
527
+ xml += addRow( data.body[i] );
528
+ }
529
+
530
+ if ( config.footer ) {
531
+ xml += addRow( data.footer );
532
+ }
533
+
534
+ var zip = new window.JSZip();
535
+ var _rels = zip.folder("_rels");
536
+ var xl = zip.folder("xl");
537
+ var xl_rels = zip.folder("xl/_rels");
538
+ var xl_worksheets = zip.folder("xl/worksheets");
539
+
540
+ zip.file( '[Content_Types].xml', excelStrings['[Content_Types].xml'] );
541
+ _rels.file( '.rels', excelStrings['_rels/.rels'] );
542
+ xl.file( 'workbook.xml', excelStrings['xl/workbook.xml'] );
543
+ xl_rels.file( 'workbook.xml.rels', excelStrings['xl/_rels/workbook.xml.rels'] );
544
+ xl_worksheets.file( 'sheet1.xml', excelStrings['xl/worksheets/sheet1.xml'].replace( '__DATA__', xml ) );
545
+
546
+ _saveAs(
547
+ zip.generate( {type:"blob"} ),
548
+ _filename( config )
549
+ );
550
+ },
551
+
552
+ title: '*',
553
+
554
+ extension: '.xlsx',
555
+
556
+ exportOptions: {},
557
+
558
+ header: true,
559
+
560
+ footer: false
561
+ };
562
+
563
+ //
564
+ // PDF export - using pdfMake - http://pdfmake.org
565
+ //
566
+ DataTable.ext.buttons.pdfHtml5 = {
567
+ className: 'buttons-pdf buttons-html5',
568
+
569
+ available: function () {
570
+ return window.FileReader !== undefined && window.pdfMake;
571
+ },
572
+
573
+ text: function ( dt ) {
574
+ return dt.i18n( 'buttons.pdf', 'PDF' );
575
+ },
576
+
577
+ action: function ( e, dt, button, config ) {
578
+ var newLine = _newLine( config );
579
+ var data = dt.buttons.exportData( config.exportOptions );
580
+ var rows = [];
581
+
582
+ if ( config.header ) {
583
+ rows.push( $.map( data.header, function ( d ) {
584
+ return {
585
+ text: d,
586
+ style: 'tableHeader'
587
+ };
588
+ } ) );
589
+ }
590
+
591
+ for ( var i=0, ien=data.body.length ; i<ien ; i++ ) {
592
+ rows.push( $.map( data.body[i], function ( d ) {
593
+ return {
594
+ text: d,
595
+ style: i % 2 ? 'tableBodyEven' : 'tableBodyOdd'
596
+ };
597
+ } ) );
598
+ }
599
+
600
+ if ( config.footer ) {
601
+ rows.push( $.map( data.footer, function ( d ) {
602
+ return {
603
+ text: d,
604
+ style: 'tableFooter'
605
+ };
606
+ } ) );
607
+ }
608
+
609
+ var doc = {
610
+ pageSize: config.pageSize,
611
+ pageOrientation: config.orientation,
612
+ content: [
613
+ {
614
+ table: {
615
+ headerRows: 1,
616
+ body: rows
617
+ },
618
+ layout: 'noBorders'
619
+ }
620
+ ],
621
+ styles: {
622
+ tableHeader: {
623
+ bold: true,
624
+ fontSize: 11,
625
+ color: 'white',
626
+ fillColor: '#2d4154',
627
+ alignment: 'center'
628
+ },
629
+ tableBodyEven: {},
630
+ tableBodyOdd: {
631
+ fillColor: '#f3f3f3'
632
+ },
633
+ tableFooter: {
634
+ bold: true,
635
+ fontSize: 11,
636
+ color: 'white',
637
+ fillColor: '#2d4154'
638
+ },
639
+ title: {
640
+ alignment: 'center',
641
+ fontSize: 15
642
+ },
643
+ message: {}
644
+ },
645
+ defaultStyle: {
646
+ fontSize: 10
647
+ }
648
+ };
649
+
650
+ if ( config.message ) {
651
+ doc.content.unshift( {
652
+ text: config.message,
653
+ style: 'message',
654
+ margin: [ 0, 0, 0, 12 ]
655
+ } );
656
+ }
657
+
658
+ if ( config.title ) {
659
+ doc.content.unshift( {
660
+ text: _filename( config, false ),
661
+ style: 'title',
662
+ margin: [ 0, 0, 0, 12 ]
663
+ } );
664
+ }
665
+
666
+ if ( config.customize ) {
667
+ config.customize( doc );
668
+ }
669
+
670
+ var pdf = window.pdfMake.createPdf( doc );
671
+
672
+ if ( config.download === 'open' && ! _isSafari() ) {
673
+ pdf.open();
674
+ }
675
+ else {
676
+ pdf.getBuffer( function (buffer) {
677
+ var blob = new Blob( [buffer], {type:'application/pdf'} );
678
+
679
+ _saveAs( blob, _filename( config ) );
680
+ } );
681
+ }
682
+ },
683
+
684
+ title: '*',
685
+
686
+ extension: '.pdf',
687
+
688
+ exportOptions: {},
689
+
690
+ orientation: 'portrait',
691
+
692
+ pageSize: 'A4',
693
+
694
+ header: true,
695
+
696
+ footer: false,
697
+
698
+ message: null,
699
+
700
+ customize: null,
701
+
702
+ download: 'download'
703
+ };
704
+
705
+
706
+ })(jQuery, jQuery.fn.dataTable);
includes/ssp.class.php CHANGED
@@ -617,7 +617,8 @@ class SSP {
617
  foreach ($columns as $column) {
618
  if (strpos($column['db'], "CONCAT") !== false) {
619
  $col_name = explode("as ", $column['db']);
620
- $searchCols[] = array("db" => $col_name[1], "dt" => $column['dt']);
 
621
  } else {
622
  $searchCols[] = array("db" => $column['db'], "dt" => $column['dt']);
623
  }
617
  foreach ($columns as $column) {
618
  if (strpos($column['db'], "CONCAT") !== false) {
619
  $col_name = explode("as ", $column['db']);
620
+ $nimblecolname = isset($col_name[1]) ? $col_name[1] : null;
621
+ $searchCols[] = array("db" => $nimblecolname, "dt" => $column['dt']);
622
  } else {
623
  $searchCols[] = array("db" => $column['db'], "dt" => $column['dt']);
624
  }
save-contact-form-7.php CHANGED
@@ -6,7 +6,7 @@
6
  Description: A simple plugin to save contact form data to db.
7
  Author: Nimblechapps
8
  Author URI: http://nimblechapps.com
9
- Version: 1.4
10
  */
11
  //function to check dependencies for Contact Form 7 Plugin
12
 
@@ -321,11 +321,12 @@ if (is_admin()) {
321
  $dt_columnslist = "";
322
  $dt_columnslistCount = 0;
323
  $table = "SaveContactForm7_" . $id;
 
324
  $db_fields = nimble_getFields($table, $export, true);
325
  $nimble_date_options = get_option('nimble_scf7_display_created_date');
 
326
 
327
  if (!empty($db_fields)) {
328
-
329
  if($nimble_date_options != "")
330
  {
331
  $i=0;
@@ -377,7 +378,7 @@ if (is_admin()) {
377
  $dt_header .= '</tr></thead></table></div>';
378
  $data['dt_header'] = $dt_header;
379
  $data['dt_columnslist'] = rtrim($dt_columnslist, ",");
380
- $data['dt_column_target'] = $dt_column_target;
381
  echo json_encode($data);
382
  wp_die();
383
  }
@@ -392,6 +393,7 @@ if (is_admin()) {
392
  if (!function_exists("nimble_populate_datatable")) {
393
 
394
  function nimble_populate_datatable() {
 
395
  if (isset($_REQUEST['exportbutton'])) {
396
  $export = $_REQUEST['exportbutton'];
397
  }
@@ -443,6 +445,8 @@ if (is_admin()) {
443
  } else {
444
  $search = '';
445
  }
 
 
446
  if (isset($_REQUEST['column']) && $_REQUEST['column'] != '') {
447
  $columnorder = $_REQUEST['column'];
448
  $ordertype = $_REQUEST['ordertype'];
@@ -885,12 +889,14 @@ if (!function_exists("nimble_save_cf7_data")) {
885
  //insert image into plugin upload directory into wp-content/uploads... directory
886
  $id = $wpdb->insert_id; // last inserted row id from databasr table
887
  $fieldname = key($submited['uploaded_files']); // form input file field name
888
- if ($plugin_data['contact-form-7/wp-contact-form-7.php']['Version'] == "3.1" || $plugin_data['contact-form-7/wp-contact-form-7.php']['Version'] == "3.1.1") {
889
- $uploaded_file_info = pathinfo(implode("/", $fname)); //uploaded file info like basename,extension etc
890
- } else {
891
- $uploaded_file_info = pathinfo($submited['posted_data'][$fieldname]); //uploaded file info like basename,extension etc
892
- }
893
  if ($fieldname != "") {
 
 
 
 
 
 
 
894
  if (!file_exists($nimble_dir_pah['basedir'] . "/nimble_uploads")) {
895
  mkdir($nimble_dir_pah['basedir'] . "/nimble_uploads", 0777);
896
  $filepath = array_values($submited['uploaded_files']); // source location of the file
6
  Description: A simple plugin to save contact form data to db.
7
  Author: Nimblechapps
8
  Author URI: http://nimblechapps.com
9
+ Version: 1.5
10
  */
11
  //function to check dependencies for Contact Form 7 Plugin
12
 
321
  $dt_columnslist = "";
322
  $dt_columnslistCount = 0;
323
  $table = "SaveContactForm7_" . $id;
324
+ $export = "";
325
  $db_fields = nimble_getFields($table, $export, true);
326
  $nimble_date_options = get_option('nimble_scf7_display_created_date');
327
+
328
 
329
  if (!empty($db_fields)) {
 
330
  if($nimble_date_options != "")
331
  {
332
  $i=0;
378
  $dt_header .= '</tr></thead></table></div>';
379
  $data['dt_header'] = $dt_header;
380
  $data['dt_columnslist'] = rtrim($dt_columnslist, ",");
381
+ $data['dt_column_target'] = @$dt_column_target;
382
  echo json_encode($data);
383
  wp_die();
384
  }
393
  if (!function_exists("nimble_populate_datatable")) {
394
 
395
  function nimble_populate_datatable() {
396
+ $export ="";
397
  if (isset($_REQUEST['exportbutton'])) {
398
  $export = $_REQUEST['exportbutton'];
399
  }
445
  } else {
446
  $search = '';
447
  }
448
+ $ordertype ="";
449
+ $join="";
450
  if (isset($_REQUEST['column']) && $_REQUEST['column'] != '') {
451
  $columnorder = $_REQUEST['column'];
452
  $ordertype = $_REQUEST['ordertype'];
889
  //insert image into plugin upload directory into wp-content/uploads... directory
890
  $id = $wpdb->insert_id; // last inserted row id from databasr table
891
  $fieldname = key($submited['uploaded_files']); // form input file field name
 
 
 
 
 
892
  if ($fieldname != "") {
893
+ if ($plugin_data['contact-form-7/wp-contact-form-7.php']['Version'] == "3.1" || $plugin_data['contact-form-7/wp-contact-form-7.php']['Version'] == "3.1.1") {
894
+ $uploaded_file_info = pathinfo(implode("/", $fname)); //uploaded file info like basename,extension etc
895
+ } else {
896
+
897
+ $uploaded_file_info = pathinfo($submited['posted_data'][$fieldname]); //uploaded file info like basename,extension etc
898
+
899
+ }
900
  if (!file_exists($nimble_dir_pah['basedir'] . "/nimble_uploads")) {
901
  mkdir($nimble_dir_pah['basedir'] . "/nimble_uploads", 0777);
902
  $filepath = array_values($submited['uploaded_files']); // source location of the file