PluginProbe ʕ •ᴥ•ʔ
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization / 1.12.0
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization v1.12.0
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 2 years ago javascript 2 years ago stylesheet 2 years ago admin.php 2 years ago connect-oneclick.php 2 years ago connect.php 2 years ago dashboard-oneclick.php 2 years ago dashboard.php 2 years ago diag.php 2 years ago help.php 3 years ago oneclick.php 2 years ago safemode.php 2 years ago safemode.tpl 4 years ago
admin.php
161 lines
1 <script>
2 let nitroNonce = '<?php echo wp_create_nonce(NITROPACK_NONCE); ?>';
3 </script>
4 <div id="nitropack-container" class="wrap">
5 <div id="heading">
6 <h2><?php esc_html_e( 'NitroPack.io', 'nitropack' ); ?></h2>
7 </div>
8
9 <form method="post" action="options.php" name="form">
10 <?php settings_fields( NITROPACK_OPTION_GROUP ); ?>
11 <?php do_settings_sections( NITROPACK_OPTION_GROUP ); ?>
12
13 <ul class="nav nav-tabs nav-tab-wrapper">
14 <li><a class="nav-tab active" href="#dashboard" data-toggle="tab"><?php esc_html_e( 'Dashboard', 'nitropack' ); ?></a></li>
15 <li><a class="nav-tab" href="#help" data-toggle="tab"><?php esc_html_e( 'Help', 'nitropack' ); ?></a></li>
16 <li><a class="nav-tab" href="#diag" data-toggle="tab"><?php esc_html_e( 'Diagnostics', 'nitropack' ); ?></a></li>
17 </ul>
18 <div class="tab-content" style="display:block">
19 <div id="dashboard" class="tab-pane hidden">
20 <?php require_once NITROPACK_PLUGIN_DIR . "view/dashboard.php"; ?>
21 </div>
22 <div id="help" class="tab-pane hidden">
23 <?php require_once NITROPACK_PLUGIN_DIR . "view/help.php"; ?>
24 </div>
25 <div id="diag" class="tab-pane hidden">
26 <?php require_once NITROPACK_PLUGIN_DIR . "view/diag.php"; ?>
27 </div>
28 </div>
29 </form>
30 </div>
31 <?php if (NITROPACK_SUPPORT_BUBBLE_VISIBLE) { ?>
32 <div class="support-widget">
33 <!-- support widget -->
34 <script>
35 window.intercomSettings = {
36 api_base: "https://api-iam.intercom.io",
37 app_id: "d5v9p9vg"
38 };
39
40 (function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',w.intercomSettings);}else{var d=document;var i=function(){i.c(arguments);};i.q=[];i.c=function(args){i.q.push(args);};w.Intercom=i;var l=function(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/d5v9p9vg';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);};if(document.readyState==='complete'){l();}else if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})();
41 </script>
42 <!-- end support widget -->
43 </div>
44 <?php } ?>
45 <script>
46 (function($) {
47 window.Notification = (_ => {
48 var timeout;
49
50 var display = (msg, type) => {
51 clearTimeout(timeout);
52 $('#nitropack-notification').remove();
53
54 $('[name="form"]').prepend('<div id="nitropack-notification" class="notice notice-' + type + '" is-dismissible"><p>' + msg + '</p></div>');
55
56 timeout = setTimeout(_ => {
57 $('#nitropack-notification').remove();
58 }, 10000);
59 loadDismissibleNotices();
60 }
61
62 return {
63 success: msg => {
64 display(msg, 'success');
65 },
66 error: msg => {
67 display(msg, 'error');
68 },
69 info: msg => {
70 display(msg, 'info');
71 },
72 warning: msg => {
73 display(msg, 'warning');
74 }
75 }
76 })();
77
78 const clearCacheHandler = clearCacheAction => {
79 return function(success, error) {
80 $.ajax({
81 url: ajaxurl,
82 type: 'GET',
83 data: {
84 action: "nitropack_" + clearCacheAction + "_cache",
85 nonce: nitroNonce
86 },
87 dataType: 'json',
88 beforeSend: function() {
89 Notification.info("Loading. Please wait...");
90 $('#optimizations-purge-cache').hide();
91 $('#np-purge-cache-loading').show();
92 },
93 success: function(data) {
94 $('#np-purge-cache-loading').hide();
95 if (data.type === 'success') {
96 $('#np-purge-cache-success').show();
97 Notification[data.type](data.message);
98 cacheEvent = new Event("cache." + clearCacheAction + ".success");
99 } else {
100 $('#np-purge-cache-error').show();
101 Notification[data.type](data.message);
102 cacheEvent = new Event("cache." + clearCacheAction + ".error");
103 }
104 window.dispatchEvent(cacheEvent);
105 },
106 error: function(data) {
107 $('#np-purge-cache-loading').hide();
108 $('#np-purge-cache-error').show();
109 Notification[data.type](data.message);
110 cacheEvent = new Event("cache." + clearCacheAction + ".error");
111 window.dispatchEvent(cacheEvent);
112 },
113 complete: function() {
114 setTimeout(function(){$('#np-purge-cache-success').hide();$('#np-purge-cache-error').hide();$('#optimizations-purge-cache').show();}, 3000);
115 }
116 });
117 };
118 }
119
120 $(window).on("load", _ => {
121 //Remove styles from jobcareer and jobhunt plugins since they break our layout. They should not be loaded on our options page anyway.
122 $('link[href*="jobcareer"').remove();
123 $('link[href*="jobhunt"').remove();
124
125 $("#dashboard").addClass("show active");
126 window.addEventListener('cache.invalidate.request', clearCacheHandler("invalidate"));
127 window.addEventListener('cache.purge.request', clearCacheHandler("purge"));
128
129 });
130
131 $("#nitro-restore-connection-btn").on("click", function() {
132 $.ajax({
133 url: ajaxurl,
134 type: 'GET',
135 data: {
136 action: "nitropack_reconfigure_webhooks",
137 nonce: nitroNonce
138 },
139 dataType: 'json',
140 beforeSend: function() {
141 $("#nitro-restore-connection-btn").attr("disabled", true).html("<i class='fa fa-refresh fa-spin'></i>");
142 },
143 success: function(data) {
144 if (!data.status || data.status != "success") {
145 if (data.message) {
146 alert("<?php esc_html_e( 'Error:', 'nitropack' ); ?> " + data.message);
147 } else {
148 alert("<?php esc_html_e( 'Error: We were unable to restore the connection. Please contact our support team to get this resolved.', 'nitropack' ); ?>");
149 }
150 } else {
151 $("#nitro-restore-connection-btn").attr("disabled", true).html("<i class='fa fa-check'></i>");
152 }
153 },
154 complete: function() {
155 location.reload();
156 }
157 });
158 });
159 })(jQuery);
160 </script>
161