PluginProbe ʕ •ᴥ•ʔ
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization / 1.5.5
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization v1.5.5
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 5 years ago javascript 4 years ago stylesheet 4 years ago admin.php 4 years ago connect.php 5 years ago dashboard.php 4 years ago diag.php 4 years ago help.php 6 years ago safemode.tpl 4 years ago
admin.php
150 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 NITROPACK_PLUGIN_DIR . "view/dashboard.php"; ?>
18 </div>
19 <div id="help" class="tab-pane hidden">
20 <?php require_once NITROPACK_PLUGIN_DIR . "view/help.php"; ?>
21 </div>
22 <div id="diag" class="tab-pane hidden">
23 <?php require_once NITROPACK_PLUGIN_DIR . "view/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 $('#optimizations-purge-cache').hide();
78 $('#np-purge-cache-loading').show();
79 },
80 success: function(data) {
81 $('#np-purge-cache-loading').hide();
82 if (data.type === 'success') {
83 $('#np-purge-cache-success').show();
84 Notification[data.type](data.message);
85 cacheEvent = new Event("cache." + clearCacheAction + ".success");
86 } else {
87 $('#np-purge-cache-error').show();
88 Notification[data.type](data.message);
89 cacheEvent = new Event("cache." + clearCacheAction + ".error");
90 }
91 window.dispatchEvent(cacheEvent);
92 },
93 error: function(data) {
94 $('#np-purge-cache-loading').hide();
95 $('#np-purge-cache-error').show();
96 Notification[data.type](data.message);
97 cacheEvent = new Event("cache." + clearCacheAction + ".error");
98 window.dispatchEvent(cacheEvent);
99 },
100 complete: function() {
101 setTimeout(function(){$('#np-purge-cache-success').hide();$('#np-purge-cache-error').hide();$('#optimizations-purge-cache').show();}, 3000);
102 }
103 });
104 };
105 }
106
107 $(window).on("load", _ => {
108 //Remove styles from jobcareer and jobhunt plugins since they break our layout. They should not be loaded on our options page anyway.
109 $('link[href*="jobcareer"').remove();
110 $('link[href*="jobhunt"').remove();
111
112 $("#dashboard").addClass("show active");
113 window.addEventListener('cache.invalidate.request', clearCacheHandler("invalidate"));
114 window.addEventListener('cache.purge.request', clearCacheHandler("purge"));
115
116 NitroPack.QuickSetup.setChangeHandler(async function(value, success, error) {
117 success(value);
118 });
119 });
120
121 $("#nitro-restore-connection-btn").on("click", function() {
122 $.ajax({
123 url: ajaxurl,
124 type: 'GET',
125 data: {
126 action: "nitropack_reconfigure_webhooks"
127 },
128 dataType: 'json',
129 beforeSend: function() {
130 $("#nitro-restore-connection-btn").attr("disabled", true).html("<i class='fa fa-refresh fa-spin'></i>");
131 },
132 success: function(data) {
133 if (!data.status || data.status != "success") {
134 if (data.message) {
135 alert("Error: " + data.message);
136 } else {
137 alert("Error: We were unable to restore the connection. Please contact our support team to get this resolved.");
138 }
139 } else {
140 $("#nitro-restore-connection-btn").attr("disabled", true).html("<i class='fa fa-check'></i>");
141 }
142 },
143 complete: function() {
144 location.reload();
145 }
146 });
147 });
148 })(jQuery);
149 </script>
150