PluginProbe ʕ •ᴥ•ʔ
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization / 1.5.15
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization v1.5.15
1.19.8 1.19.7 1.19.6 1.19.5 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.11.0 1.12.0 1.13.0 1.14.0 1.15.0 1.15.1 1.15.2 1.15.3 1.16.0 1.16.1 1.16.2 1.16.3 1.16.4 1.16.5 1.16.6 1.16.7 1.16.8 1.17.0 1.17.6 1.17.7 1.17.8 1.17.9 1.18.0 1.18.1 1.18.2 1.18.3 1.18.4 1.18.5 1.18.6 1.18.7 1.18.8 1.18.9 1.19.0 1.19.1 1.19.2 1.19.3 1.19.4 1.3.19 1.3.20 1.4.0 1.4.1 1.5.0 1.5.1 1.5.10 1.5.11 1.5.12 1.5.13 1.5.14 1.5.15 1.5.16 1.5.17 1.5.18 1.5.19 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.7.0 1.7.1 1.8.0 1.8.1 1.8.3 1.9.0 1.9.1 1.9.2
nitropack / view / diag.php
nitropack / view Last commit date
images 5 years ago javascript 4 years ago stylesheet 4 years ago admin.php 3 years ago connect.php 4 years ago dashboard.php 4 years ago diag.php 4 years ago help.php 6 years ago safemode.tpl 4 years ago
diag.php
163 lines
1 <div>
2 <div class="row">
3 <div class="col-md-6 mb-3">
4 <div class="card-overlay-blurrable np-widget" id="diagnostic-widget">
5 <div class="card card-d-item">
6 <div class="card-body">
7 <h5 class="card-title">Diagnostics report</h5>
8 <ul class="list-group list-group-flush">
9 <li class="list-group-item px-0 d-flex justify-content-between align-items-center">
10 <span id="loading-general-info">
11 Include NitroPack info(version, methods, environment)
12 </span>
13 <span id="general-info-toggle">
14 <label id="general-info-slider" class="switch">
15 <input type="checkbox" class="diagnostic-option" id="general-info-status" checked>
16 <span class="slider"></span>
17 </label>
18 </span>
19 </li>
20 <li class="list-group-item px-0 d-flex justify-content-between align-items-center">
21 <span id="loading-plugins-status">
22 Include active plugins list
23 </span>
24 <span id="active-plugins-toggle">
25 <label id="active-plugins-slider" class="switch">
26 <input type="checkbox" class="diagnostic-option" id="active-plugins-status" checked>
27 <span class="slider"></span>
28 </label>
29 </span>
30 </li>
31 <li class="list-group-item px-0 d-flex justify-content-between align-items-center">
32 <span id="conflicting-plugins-info">
33 Include conflicting plugins list
34 </span>
35 <span id="conflicting-plugins-toggle">
36 <label id="conflicting-plugins-slider" class="switch">
37 <input type="checkbox" class="diagnostic-option" id="conflicting-plugins-status" checked>
38 <span class="slider"></span>
39 </label>
40 </span>
41 </li>
42 <li class="list-group-item px-0 d-flex justify-content-between align-items-center">
43 <span id="loading-user-config">
44 Include user config
45 </span>
46 <span id="user-config-toggle">
47 <label id="user-config-slider" class="switch">
48 <input type="checkbox" class="diagnostic-option" id="user-config-status" checked>
49 <span class="slider"></span>
50 </label>
51 </span>
52 </li>
53 <li class="list-group-item px-0 d-flex justify-content-between align-items-center">
54 <span id="loading-dir-info">
55 Include directory info(structure,permissions)
56 </span>
57 <span id="dir-info-toggle">
58 <label id="dir-info-slider" class="switch">
59 <input type="checkbox" class="diagnostic-option" id="dir-info-status" checked>
60 <span class="slider"></span>
61 </label>
62 </span>
63 </li>
64 <li class="list-group-item px-0 d-flex justify-content-between align-items-center">
65 <span>
66 <a id="gen-report-btn" href="javascript:void(0);" class="btn btn-light btn-outline-secondary"><i class="fa fa-refresh fa-spin" style="display:none" id="diagnostics-loader"></i>&nbsp;&nbsp;Generate&nbsp;Report</a>
67 </span>
68 </li>
69 </ul>
70 <p class="mb-0 mt-2"><i class="fa fa-info-circle text-primary" aria-hidden="true"></i> The generated report will be saved to your computer and can later be attached to your ticket.</p>
71 </div>
72 </div>
73 </div>
74 </div>
75 </div>
76 </div>
77 <script>
78
79 ($ => {
80 let isReportGenerating = false;
81
82 $("#gen-report-btn").on("click", function(e) {
83 if (isReportGenerating) return;
84
85 $.ajax({
86 url: ajaxurl,
87 type: "POST",
88 dataType: "text",
89 data: {
90 action: 'nitropack_generate_report',
91 toggled: {
92 "general-info-status": $("#general-info-status:checked").length,
93 "active-plugins-status": $("#active-plugins-status:checked").length,
94 "conflicting-plugins-status": $("#conflicting-plugins-status:checked").length,
95 "user-config-status": $("#user-config-status:checked").length,
96 "dir-info-status": $("#dir-info-status:checked").length
97 }
98 },
99 beforeSend: function (xhr,sett) {
100 if ($(".diagnostic-option:checked").length > 0) {
101 $("#diagnostics-loader").show();
102 isReportGenerating = true;
103 return true;
104 } else {
105 alert('Please select at least one of the report options');
106 return false;
107 }
108 },
109 success: function(response, status, xhr) {
110 if (response.length > 1) {
111 var filename = "";
112 var disposition = xhr.getResponseHeader('Content-Disposition');
113 if (disposition && disposition.indexOf('attachment') !== -1) {
114 var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
115 var matches = filenameRegex.exec(disposition);
116 if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
117 }
118
119 var type = xhr.getResponseHeader('Content-Type');
120 var blob = new Blob([response], { type: type });
121
122 if (typeof window.navigator.msSaveBlob !== 'undefined') {
123 // IE workaround for "HTML7007: One or more blob URLs were revoked by closing the blob for which they were created. These URLs will no longer resolve as the data backing the URL has been freed."
124 window.navigator.msSaveBlob(blob, filename);
125 } else {
126 var URL = window.URL || window.webkitURL;
127 var downloadUrl = URL.createObjectURL(blob);
128
129 if (filename) {
130 // use HTML5 a[download] attribute to specify filename
131 var a = document.createElement("a");
132 // safari doesn't support this yet
133 if (typeof a.download === 'undefined') {
134 window.location.href = downloadUrl;
135 } else {
136 a.href = downloadUrl;
137 a.download = filename;
138 document.body.appendChild(a);
139 a.click();
140 }
141 } else {
142 window.location.href = downloadUrl;
143 }
144
145 setTimeout(function () { URL.revokeObjectURL(downloadUrl); }, 100);
146 }
147 Notification.success('Report generated successfully.');
148 } else {
149 Notification.error('Response is empty. Report generation failed.');
150 }
151 },
152 error: function() {
153 Notification.error('There was an error while generating the report.');
154 },
155 complete: function() {
156 $("#diagnostics-loader").hide();
157 isReportGenerating = false;
158 }
159 });
160 });
161 })(jQuery);
162 </script>
163