PluginProbe ʕ •ᴥ•ʔ
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization / 1.18.0
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization v1.18.0
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 / system-report.php
nitropack / view Last commit date
images 1 year ago javascript 1 year ago modals 1 year ago stylesheet 1 year ago templates 2 years ago admin.php 1 year ago connect-oneclick.php 1 year ago connect.php 2 years ago dashboard-oneclick.php 1 year ago dashboard.php 1 year ago oneclick.php 1 year ago system-report.php 1 year ago
system-report.php
187 lines
1 <?php
2 $settings = new \NitroPack\WordPress\Settings();
3 $diagnostic_settings = array(
4 array(
5 'name' => esc_html__('Include NitroPack info (version, methods, environment)', 'nitropack'),
6 'desc' => '',
7 'id' => 'general-info-status',
8 'class' => 'diagnostic-option',
9 'setting' => 'include_info'
10 ),
11 array(
12 'name' => esc_html__('Include active plugins list', 'nitropack'),
13 'desc' => '',
14 'id' => 'active-plugins-status',
15 'class' => 'diagnostic-option',
16 'setting' => 'active_plugins'
17 ),
18 array(
19 'name' => esc_html__('Include conflicting plugins list', 'nitropack'),
20 'desc' => '',
21 'id' => 'conflicting-plugins-status',
22 'class' => 'diagnostic-option',
23 'setting' => 'conflicting_plugins'
24 ),
25 array(
26 'name' => esc_html__('Include plugin config', 'nitropack'),
27 'desc' => '',
28 'id' => 'user-config-status',
29 'class' => 'diagnostic-option',
30 'setting' => 'user_conflict'
31 ),
32 array(
33 'name' => esc_html__('Include directory status', 'nitropack'),
34 'desc' => '',
35 'id' => 'dir-info-status',
36 'class' => 'diagnostic-option',
37 'setting' => 'dir_info_status'
38 ),
39 );
40 ?>
41
42 <div class="grid grid-cols-1 gap-6">
43 <div class="col-span-1">
44 <div class="card">
45 <div class="flex">
46 <div class="" style="flex-basis: 80%;">
47 <h3><?php esc_html_e('System Info Report', 'nitropack'); ?></h3>
48 <p><?php esc_html_e('This report gives a clear picture of how NitroPack is set up on your site. It checks for anything that might cause problems, like plugins that don’t work well with NitroPack or server issues. If something isn’t working as expected, share this report with support to help them fix it quickly.', 'nitropack'); ?></p>
49 </div>
50 <div class="ml-auto">
51 <a id="gen-report-btn" href="javascript:void(0);" class="btn btn-secondary"><img src="<?php echo plugin_dir_url(__FILE__) . 'images/download.svg'; ?> " class="icon-left" /> <span class="btn-text"><?php esc_html_e('Download', 'nitropack'); ?></span></a>
52 </div>
53 </div>
54 <div class="card-body">
55 <div>
56 <div id="accordion-collapse" data-accordion="collapse" class="mt-4" data-active-classes="active" data-inactive-classes="not-active">
57 <div id="accordion-collapse-heading-1" class="text-center">
58 <a class="btn btn-link" data-accordion-target="#accordion-collapse-body-1" aria-expanded="false" aria-controls="accordion-collapse-body-1">
59 <span><?php esc_html_e('Customize Report', 'nitropack'); ?></span>
60 <svg width="9" height="6" data-accordion-icon class="w-3 h-3 rotate-180 shrink-0 icon-right" aria-hidden="false" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 10 6">
61 <path d="M8.5 5L4.5 1L0.5 5" stroke="#4600CC" stroke-linecap="round" stroke-linejoin="round" />
62 </svg>
63 </a>
64 </div>
65 <div id="accordion-collapse-body-1" class="accordion-body hidden" aria-labelledby="accordion-collapse-heading-1">
66 <div class="options-container">
67 <?php foreach ($diagnostic_settings as $setting) : ?>
68 <div class="nitro-option">
69 <div class="nitro-option-main">
70 <h6><?php echo $setting['name']; ?></h6>
71 <label class="inline-flex items-center cursor-pointer ml-auto">
72 <input type="checkbox" value="" id="<?php echo $setting['id']; ?>" class="sr-only peer <?php echo $setting['class']; ?>" name="<?php echo $setting['setting']; ?>" checked>
73 <div class="toggle"></div>
74 </label>
75 </div>
76 </div>
77 <?php endforeach; ?>
78 </div>
79 </div>
80 </div>
81 </div>
82 </div>
83 </div>
84 <div class="card">
85 <div class="card-body">
86 <div class="nitro-option" id="minimum-log-level-widget">
87 <div class="nitro-option-main">
88 <?php $settings->logger->render(); ?>
89 </div>
90 </div>
91 </div>
92 </div>
93 </div>
94 </div>
95
96
97 <script>
98 ($ => {
99 let isReportGenerating = false;
100
101 $("#gen-report-btn").on("click", function(e) {
102 if (isReportGenerating) return;
103
104 $.ajax({
105 url: ajaxurl,
106 type: "POST",
107 dataType: "text",
108 data: {
109 action: 'nitropack_generate_report',
110 nonce: nitroNonce,
111 toggled: {
112 "general-info-status": $("#general-info-status:checked").length,
113 "active-plugins-status": $("#active-plugins-status:checked").length,
114 "conflicting-plugins-status": $("#conflicting-plugins-status:checked").length,
115 "user-config-status": $("#user-config-status:checked").length,
116 "dir-info-status": $("#dir-info-status:checked").length
117 }
118 },
119 beforeSend: function(xhr, sett) {
120 if ($(".diagnostic-option:checked").length > 0) {
121 $("#diagnostics-loader").show();
122 isReportGenerating = true;
123 return true;
124 } else {
125 alert("<?php esc_html_e('Please select at least one of the report options', 'nitropack'); ?>");
126 return false;
127 }
128 },
129 success: function(response, status, xhr) {
130 if (response.length > 1) {
131 var filename = "";
132 var disposition = xhr.getResponseHeader('Content-Disposition');
133 if (disposition && disposition.indexOf('attachment') !== -1) {
134 var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
135 var matches = filenameRegex.exec(disposition);
136 if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
137 }
138
139 var type = xhr.getResponseHeader('Content-Type');
140 var blob = new Blob([response], {
141 type: type
142 });
143
144 if (typeof window.navigator.msSaveBlob !== 'undefined') {
145 // 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."
146 window.navigator.msSaveBlob(blob, filename);
147 } else {
148 var URL = window.URL || window.webkitURL;
149 var downloadUrl = URL.createObjectURL(blob);
150
151 if (filename) {
152 // use HTML5 a[download] attribute to specify filename
153 var a = document.createElement("a");
154 // safari doesn't support this yet
155 if (typeof a.download === 'undefined') {
156 window.location.href = downloadUrl;
157 } else {
158 a.href = downloadUrl;
159 a.download = filename;
160 document.body.appendChild(a);
161 a.click();
162 }
163 } else {
164 window.location.href = downloadUrl;
165 }
166
167 setTimeout(function() {
168 URL.revokeObjectURL(downloadUrl);
169 }, 100);
170 }
171 NitropackUI.triggerToast('success', "<?php esc_html_e('Report generated successfully.', 'nitropack'); ?>");
172 } else {
173 NitropackUI.triggerToast('error', "<?php esc_html_e('Response is empty. Report generation failed.', 'nitropack'); ?>");
174 }
175 },
176 error: function() {
177 NitropackUI.triggerToast('error', "<?php esc_html_e('There was an error while generating the report.', 'nitropack'); ?>");
178 },
179 complete: function() {
180 $("#diagnostics-loader").hide();
181 isReportGenerating = false;
182 }
183 });
184 });
185
186 })(jQuery);
187 </script>