PluginProbe ʕ •ᴥ•ʔ
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization / 1.17.6
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization v1.17.6
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 / admin.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 safemode.php 2 years ago system-report.php 1 year ago
admin.php
220 lines
1 <script>
2 let nitroNonce = '<?php echo wp_create_nonce(NITROPACK_NONCE); ?>';
3 </script>
4 <div id="nitropack-container">
5 <nav class="nitro-navigation">
6 <div class="nitro-navigation-inner">
7 <img src="<?php echo plugin_dir_url(__FILE__) . 'images/nitropack_logo.svg'; ?>" height="25" alt="NitroPack" />
8 </div>
9 </nav>
10
11 <main id="main">
12 <div class="container">
13 <?php
14 if (count(get_nitropack()->Notifications->get('system')) > 0) { ?>
15 <ul class="notifications-list" id="app-notifications">
16 <?php foreach (get_nitropack()->Notifications->get('system') as $notification) :
17 $icons = array('danger' => 'alert-triangle', 'success' => 'check', 'warning' => 'info', 'info' => 'bell', 'promo' => 'bell');
18 $icon = $icons[$notification['type']];
19 if (!$icon) $icon = 'check';
20 ?>
21 <li class="nitro-notification notification-<?php echo $notification['type']; ?>">
22 <div class="notification-inner">
23 <div class="title-msg">
24 <div class="title-wrapper">
25 <img src="<?php echo plugin_dir_url(__FILE__) . 'images/' . $icon . '.svg'; ?>" alt="alert" class="icon">
26 <h5 class="title"><?php echo $notification['type']; ?></h5>
27 </div>
28 <div class="msg">
29 <?php echo $notification['message']; ?>
30 </div>
31 </div>
32 <div class="col-span-4 ml-auto actions">
33 <a class="btn btn-secondary btn-dismiss rml_btn" data-notification_end="<?php echo $notification['end_date']; ?>" data-notification_id="<?php echo $notification['id']; ?>"><?php _e('Dismiss', 'nitropack'); ?></a>
34 </div>
35 </div>
36 </li>
37 <?php endforeach; ?>
38 </ul>
39 <?php } ?>
40 <?php if (!isset($_GET['subpage'])) : ?>
41 <?php require_once NITROPACK_PLUGIN_DIR . "view/dashboard.php";
42 ?>
43 <?php endif; ?>
44 <?php if (isset($_GET['subpage']) && $_GET['subpage'] == 'system-report') : ?>
45 <?php require_once NITROPACK_PLUGIN_DIR . "view/system-report.php";
46 ?>
47 <?php endif; ?>
48 </div>
49 </main>
50 <?php require_once NITROPACK_PLUGIN_DIR . 'view/templates/template-toast.php'; ?>
51 </div>
52
53 <?php if (NITROPACK_SUPPORT_BUBBLE_VISIBLE) { ?>
54 <div class="support-widget">
55 <!-- support widget -->
56 <script>
57 window.intercomSettings = {
58 api_base: "https://api-iam.intercom.io",
59 app_id: "d5v9p9vg"
60 };
61
62 (function() {
63 var w = window;
64 var ic = w.Intercom;
65 if (typeof ic === "function") {
66 ic('reattach_activator');
67 ic('update', w.intercomSettings);
68 } else {
69 var d = document;
70 var i = function() {
71 i.c(arguments);
72 };
73 i.q = [];
74 i.c = function(args) {
75 i.q.push(args);
76 };
77 w.Intercom = i;
78 var l = function() {
79 var s = d.createElement('script');
80 s.type = 'text/javascript';
81 s.async = true;
82 s.src = 'https://widget.intercom.io/widget/d5v9p9vg';
83 var x = d.getElementsByTagName('script')[0];
84 x.parentNode.insertBefore(s, x);
85 };
86 if (document.readyState === 'complete') {
87 l();
88 } else if (w.attachEvent) {
89 w.attachEvent('onload', l);
90 } else {
91 w.addEventListener('load', l, false);
92 }
93 }
94 })();
95 </script>
96 <!-- end support widget -->
97 </div>
98 <?php } ?>
99 <script>
100 (function($) {
101 window.Notification = (_ => {
102 var timeout;
103
104 var display = (msg, type) => {
105 clearTimeout(timeout);
106 $('#nitropack-notification').remove();
107
108 $('[name="form"]').prepend('<div id="nitropack-notification" class="notice notice-' + type + '" is-dismissible"><p>' + msg + '</p></div>');
109
110 timeout = setTimeout(_ => {
111 $('#nitropack-notification').remove();
112 }, 10000);
113 loadDismissibleNotices();
114 }
115
116 return {
117 success: msg => {
118 display(msg, 'success');
119 },
120 error: msg => {
121 display(msg, 'error');
122 },
123 info: msg => {
124 display(msg, 'info');
125 },
126 warning: msg => {
127 display(msg, 'warning');
128 }
129 }
130 })();
131
132 const clearCacheHandler = clearCacheAction => {
133 return function(success, error) {
134 $.ajax({
135 url: ajaxurl,
136 type: 'GET',
137 data: {
138 action: "nitropack_" + clearCacheAction + "_cache",
139 nonce: nitroNonce
140 },
141 dataType: 'json',
142 beforeSend: function() {
143 $('#optimizations-purge-cache').attr('disabled', true);
144 },
145 success: function(data) {
146 if (data.type === 'success') {
147 NitropackUI.triggerToast('success', data.message);
148 cacheEvent = new Event("cache." + clearCacheAction + ".success");
149 } else {
150 NitropackUI.triggerToast('error', data.message);
151 cacheEvent = new Event("cache." + clearCacheAction + ".error");
152 }
153 window.dispatchEvent(cacheEvent);
154 },
155 error: function(data) {
156
157 NitropackUI.triggerToast('error', data.message);
158 cacheEvent = new Event("cache." + clearCacheAction + ".error");
159 window.dispatchEvent(cacheEvent);
160 },
161 complete: function() {
162 setTimeout(function() {
163 $('#optimizations-purge-cache').attr('disabled', false);
164 }, 3000);
165 }
166 });
167 };
168 }
169
170 window.addEventListener("cache.purge.success", function() {
171 setTimeout(function() {
172 document.cookie = "nitropack_apwarning=1; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=<?php echo nitropack_cookiepath(); ?>";
173 window.location.reload()
174 }, 1500)
175 });
176
177 $(window).on("load", _ => {
178 //Remove styles from jobcareer and jobhunt plugins since they break our layout. They should not be loaded on our options page anyway.
179 $('link[href*="jobcareer"').remove();
180 $('link[href*="jobhunt"').remove();
181
182 $("#dashboard").addClass("show active");
183 window.addEventListener('cache.invalidate.request', clearCacheHandler("invalidate"));
184 window.addEventListener('cache.purge.request', clearCacheHandler("purge"));
185
186 });
187 const loading_icon = '<img src="<?php echo plugin_dir_url(__FILE__); ?>/images/loading.svg" width="14" class="icon loading"/>',
188 success_icon = '<img src="<?php echo plugin_dir_url(__FILE__); ?>/images/check.svg" width="16" class="icon success"/>';
189
190 $("#nitro-restore-connection-btn").on("click", function() {
191 $.ajax({
192 url: ajaxurl,
193 type: 'GET',
194 data: {
195 action: "nitropack_reconfigure_webhooks",
196 nonce: nitroNonce
197 },
198 dataType: 'json',
199 beforeSend: function() {
200 $("#nitro-restore-connection-btn").attr("disabled", true).html(loading_icon);
201 },
202 success: function(data) {
203 if (!data.status || data.status != "success") {
204 if (data.message) {
205 alert("<?php esc_html_e('Error:', 'nitropack'); ?> " + data.message);
206 } else {
207 alert("<?php esc_html_e('Error: We were unable to restore the connection. Please contact our support team to get this resolved.', 'nitropack'); ?>");
208 }
209 } else {
210 $("#nitro-restore-connection-btn").attr("disabled", true).html(success_icon);
211 NitropackUI.triggerToast('success', data.message);
212 }
213 },
214 complete: function() {
215 location.reload();
216 }
217 });
218 });
219 })(jQuery);
220 </script>