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