PluginProbe ʕ •ᴥ•ʔ
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization / 1.16.6
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization v1.16.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 / oneclick.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 2 years ago dashboard.php 1 year ago oneclick.php 2 years ago safemode.php 2 years ago system-report.php 1 year ago
oneclick.php
154 lines
1 <script>
2 let nitroNonce = '<?php echo wp_create_nonce(NITROPACK_NONCE); ?>';
3 </script>
4 <div id="nitropack-container">
5
6 <main id="main">
7 <div class="container">
8 <h1 class="mb-4"><?php esc_html_e('NitroPack OneClick™', 'nitropack'); ?></h1>
9 <?php if (count(get_nitropack()->Notifications->get('system')) > 0) { ?>
10 <div class="notification notification-danger" id="notifications">
11 <div class="text-box">
12 <div class="title-wrapper">
13 <img src="<?php echo plugin_dir_url(__FILE__) . 'images/alert-triangle.svg'; ?>" alt="alert" class="icon" />
14 <h5 class="title"><?php esc_html_e('Notifications', 'nitropack'); ?></h5>
15 </div>
16 <ul>
17 <?php foreach (get_nitropack()->Notifications->get('system') as $notification) : ?>
18 <li class="grid grid-cols-2 justify-between items-center">
19 <div class="col-span-8">
20 <?php echo $notification['message']; ?>
21 </div>
22 <div class="col-span-4 ml-auto">
23 <a class="btn btn-danger rml_btn" data-notification_end="<?php echo $notification['end_date']; ?>" data-notification_id="<?php echo $notification['id']; ?>">Remind me later</a>
24 </div>
25 </li>
26 <?php endforeach; ?>
27 </ul>
28 </div>
29 </div>
30 <?php } ?>
31 <?php if (!isset($_GET['subpage'])) : ?>
32 <?php require_once NITROPACK_PLUGIN_DIR . "view/dashboard-oneclick.php";
33 ?>
34 <?php endif; ?>
35 </div>
36 </main>
37 <?php require_once NITROPACK_PLUGIN_DIR . 'view/templates/template-toast.php'; ?>
38 </div>
39
40 <script>
41 (function($) {
42 window.Notification = (_ => {
43 var timeout;
44
45 var display = (msg, type) => {
46 clearTimeout(timeout);
47 $('#nitropack-notification').remove();
48
49 $('[name="form"]').prepend('<div id="nitropack-notification" class="notice notice-' + type + '" is-dismissible"><p>' + msg + '</p></div>');
50
51 timeout = setTimeout(_ => {
52 $('#nitropack-notification').remove();
53 }, 10000);
54 loadDismissibleNotices();
55 }
56
57 return {
58 success: msg => {
59 display(msg, 'success');
60 },
61 error: msg => {
62 display(msg, 'error');
63 },
64 info: msg => {
65 display(msg, 'info');
66 },
67 warning: msg => {
68 display(msg, 'warning');
69 }
70 }
71 })();
72
73 const clearCacheHandler = clearCacheAction => {
74 return function(success, error) {
75 $.ajax({
76 url: ajaxurl,
77 type: 'GET',
78 data: {
79 action: "nitropack_" + clearCacheAction + "_cache",
80 nonce: nitroNonce
81 },
82 dataType: 'json',
83 beforeSend: function() {
84 $('#optimizations-purge-cache').attr('disabled', true);
85 },
86 success: function(data) {
87 if (data.type === 'success') {
88 NitropackUI.triggerToast('success', data.message);
89 cacheEvent = new Event("cache." + clearCacheAction + ".success");
90 } else {
91 NitropackUI.triggerToast('error', data.message);
92 cacheEvent = new Event("cache." + clearCacheAction + ".error");
93 }
94 window.dispatchEvent(cacheEvent);
95 },
96 error: function(data) {
97 NitropackUI.triggerToast('error', data.message);
98 cacheEvent = new Event("cache." + clearCacheAction + ".error");
99 window.dispatchEvent(cacheEvent);
100 },
101 complete: function() {
102 setTimeout(function() {
103 $('#optimizations-purge-cache').attr('disabled', false);
104 }, 3000);
105 }
106 });
107 };
108 }
109
110 $(window).on("load", _ => {
111 //Remove styles from jobcareer and jobhunt plugins since they break our layout. They should not be loaded on our options page anyway.
112 $('link[href*="jobcareer"').remove();
113 $('link[href*="jobhunt"').remove();
114
115 $("#dashboard").addClass("show active");
116 window.addEventListener('cache.invalidate.request', clearCacheHandler("invalidate"));
117 window.addEventListener('cache.purge.request', clearCacheHandler("purge"));
118
119 });
120 const loading_icon = '<img src="<?php echo plugin_dir_url(__FILE__); ?>/images/loading.svg" width="14" class="icon loading"/>',
121 success_icon = '<img src="<?php echo plugin_dir_url(__FILE__); ?>/images/check.svg" width="16" class="icon success"/>';
122
123
124 $("#nitro-restore-connection-btn").on("click", function() {
125 $.ajax({
126 url: ajaxurl,
127 type: 'GET',
128 data: {
129 action: "nitropack_reconfigure_webhooks",
130 nonce: nitroNonce
131 },
132 dataType: 'json',
133 beforeSend: function() {
134 $("#nitro-restore-connection-btn").attr("disabled", true).html(loading_icon);
135 },
136 success: function(data) {
137 if (!data.status || data.status != "success") {
138 if (data.message) {
139 alert("<?php esc_html_e('Error:', 'nitropack'); ?> " + data.message);
140 } else {
141 alert("<?php esc_html_e('Error: We were unable to restore the connection. Please contact our support team to get this resolved.', 'nitropack'); ?>");
142 }
143 } else {
144 $("#nitro-restore-connection-btn").attr("disabled", true).html(success_icon);
145 NitropackUI.triggerToast('success', data.message);
146 }
147 },
148 complete: function() {
149 location.reload();
150 }
151 });
152 });
153 })(jQuery);
154 </script>