PluginProbe ʕ •ᴥ•ʔ
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization / 1.5.1
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization v1.5.1
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 6 years ago javascript 5 years ago stylesheet 5 years ago admin.php 5 years ago connect.php 5 years ago dashboard.php 5 years ago diag.php 5 years ago help.php 6 years ago
admin.php
131 lines
1 <div id="nitropack-container" class="wrap">
2 <div id="heading">
3 <h2>NitroPack.io</h2>
4 </div>
5
6 <form method="post" action="options.php" name="form">
7 <?php settings_fields( NITROPACK_OPTION_GROUP ); ?>
8 <?php do_settings_sections( NITROPACK_OPTION_GROUP ); ?>
9
10 <ul class="nav nav-tabs nav-tab-wrapper">
11 <li><a class="nav-tab active" href="#dashboard" data-toggle="tab">Dashboard</a></li>
12 <li><a class="nav-tab" href="#help" data-toggle="tab">Help</a></li>
13 <li><a class="nav-tab" href="#diag" data-toggle="tab">Diagnostics</a></li>
14 </ul>
15 <div class="tab-content" style="display:block">
16 <div id="dashboard" class="tab-pane hidden">
17 <?php require_once "dashboard.php"; ?>
18 </div>
19 <div id="help" class="tab-pane hidden">
20 <?php require_once "help.php"; ?>
21 </div>
22 <div id="diag" class="tab-pane hidden">
23 <?php require_once "diag.php"; ?>
24 </div>
25 </div>
26 </form>
27 </div>
28 <?php if (NITROPACK_SUPPORT_BUBBLE_VISIBLE) { ?>
29 <div class="nitropack-support-icon" data-toggle="tooltip" title="Get help">
30 <a href="<?php echo NITROPACK_SUPPORT_BUBBLE_URL; ?>" target="_blank" rel="noopener noreferrer"><i class="fa fa-life-ring"></i></a>
31 </div>
32 <?php } ?>
33 <script>
34 (function($) {
35 window.Notification = (_ => {
36 var timeout;
37
38 var display = (msg, type) => {
39 clearTimeout(timeout);
40 $('#nitropack-notification').remove();
41
42 $('[name="form"]').prepend('<div id="nitropack-notification" class="notice notice-' + type + '" is-dismissible"><p>' + msg + '</p></div>');
43
44 timeout = setTimeout(_ => {
45 $('#nitropack-notification').remove();
46 }, 10000);
47 loadDismissibleNotices();
48 }
49
50 return {
51 success: msg => {
52 display(msg, 'success');
53 },
54 error: msg => {
55 display(msg, 'error');
56 },
57 info: msg => {
58 display(msg, 'info');
59 },
60 warning: msg => {
61 display(msg, 'warning');
62 }
63 }
64 })();
65
66 const clearCacheHandler = clearCacheAction => {
67 return function(success, error) {
68 $.ajax({
69 url: ajaxurl,
70 type: 'GET',
71 data: {
72 action: "nitropack_" + clearCacheAction + "_cache"
73 },
74 dataType: 'json',
75 beforeSend: function() {
76 Notification.info("Loading. Please wait...");
77 },
78 success: function(data) {
79 Notification[data.type](data.message);
80
81 cacheEvent = new Event("cache." + clearCacheAction + ".success");
82 window.dispatchEvent(cacheEvent);
83 }
84 });
85 };
86 }
87
88 $(window).on("load", _ => {
89 //Remove styles from jobcareer and jobhunt plugins since they break our layout. They should not be loaded on our options page anyway.
90 $('link[href*="jobcareer"').remove();
91 $('link[href*="jobhunt"').remove();
92
93 $("#dashboard").addClass("show active");
94 window.addEventListener('cache.invalidate.request', clearCacheHandler("invalidate"));
95 window.addEventListener('cache.purge.request', clearCacheHandler("purge"));
96
97 NitroPack.QuickSetup.setChangeHandler(async function(value, success, error) {
98 success(value);
99 });
100 });
101
102 $("#nitro-restore-connection-btn").on("click", function() {
103 $.ajax({
104 url: ajaxurl,
105 type: 'GET',
106 data: {
107 action: "nitropack_reconfigure_webhooks"
108 },
109 dataType: 'json',
110 beforeSend: function() {
111 $("#nitro-restore-connection-btn").attr("disabled", true).html("<i class='fa fa-refresh fa-spin'></i>");
112 },
113 success: function(data) {
114 if (!data.status || data.status != "success") {
115 if (data.message) {
116 alert("Error: " + data.message);
117 } else {
118 alert("Error: We were unable to restore the connection. Please contact our support team to get this resolved.");
119 }
120 } else {
121 $("#nitro-restore-connection-btn").attr("disabled", true).html("<i class='fa fa-check'></i>");
122 }
123 },
124 complete: function() {
125 location.reload();
126 }
127 });
128 });
129 })(jQuery);
130 </script>
131