PluginProbe ʕ •ᴥ•ʔ
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization / 1.5.19
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization v1.5.19
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 3 years ago javascript 3 years ago stylesheet 3 years ago admin.php 3 years ago connect.php 3 years ago dashboard.php 3 years ago diag.php 3 years ago help.php 3 years ago safemode.php 3 years ago safemode.tpl 4 years ago
admin.php
168 lines
1 <div id="nitropack-container" class="wrap">
2 <div id="heading">
3 <h2><?php esc_html_e( 'NitroPack.io', 'nitropack' ); ?></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"><?php esc_html_e( 'Dashboard', 'nitropack' ); ?></a></li>
12 <li><a class="nav-tab" href="#help" data-toggle="tab"><?php esc_html_e( 'Help', 'nitropack' ); ?></a></li>
13 <li><a class="nav-tab" href="#diag" data-toggle="tab"><?php esc_html_e( 'Diagnostics', 'nitropack' ); ?></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="support-widget">
30 <!-- zendesk widget -->
31 <script type="text/javascript">
32 jQuery(document).ready(function(){
33 window.zESettings = {
34 webWidget: {
35 offset: {
36 vertical: '24px',
37 mobile: {
38 vertical: '24px'
39 }
40 }
41 }
42 };
43
44 zE('webWidget', 'setLocale', 'en-US');
45 zE('webWidget', 'helpCenter:setSuggestions', { labels: ['wordpress_plugin_help'] });
46 });
47 </script>
48 <script id="ze-snippet" src="https://static.zdassets.com/ekr/snippet.js?key=6ba5e4cd-1924-45ee-b2fa-39317be2c2aa"></script>
49 <!-- end zendesk widget -->
50 <?php } ?>
51 <script>
52 (function($) {
53 window.Notification = (_ => {
54 var timeout;
55
56 var display = (msg, type) => {
57 clearTimeout(timeout);
58 $('#nitropack-notification').remove();
59
60 $('[name="form"]').prepend('<div id="nitropack-notification" class="notice notice-' + type + '" is-dismissible"><p>' + msg + '</p></div>');
61
62 timeout = setTimeout(_ => {
63 $('#nitropack-notification').remove();
64 }, 10000);
65 loadDismissibleNotices();
66 }
67
68 return {
69 success: msg => {
70 display(msg, 'success');
71 },
72 error: msg => {
73 display(msg, 'error');
74 },
75 info: msg => {
76 display(msg, 'info');
77 },
78 warning: msg => {
79 display(msg, 'warning');
80 }
81 }
82 })();
83
84 const clearCacheHandler = clearCacheAction => {
85 return function(success, error) {
86 $.ajax({
87 url: ajaxurl,
88 type: 'GET',
89 data: {
90 action: "nitropack_" + clearCacheAction + "_cache"
91 },
92 dataType: 'json',
93 beforeSend: function() {
94 Notification.info("Loading. Please wait...");
95 $('#optimizations-purge-cache').hide();
96 $('#np-purge-cache-loading').show();
97 },
98 success: function(data) {
99 $('#np-purge-cache-loading').hide();
100 if (data.type === 'success') {
101 $('#np-purge-cache-success').show();
102 Notification[data.type](data.message);
103 cacheEvent = new Event("cache." + clearCacheAction + ".success");
104 } else {
105 $('#np-purge-cache-error').show();
106 Notification[data.type](data.message);
107 cacheEvent = new Event("cache." + clearCacheAction + ".error");
108 }
109 window.dispatchEvent(cacheEvent);
110 },
111 error: function(data) {
112 $('#np-purge-cache-loading').hide();
113 $('#np-purge-cache-error').show();
114 Notification[data.type](data.message);
115 cacheEvent = new Event("cache." + clearCacheAction + ".error");
116 window.dispatchEvent(cacheEvent);
117 },
118 complete: function() {
119 setTimeout(function(){$('#np-purge-cache-success').hide();$('#np-purge-cache-error').hide();$('#optimizations-purge-cache').show();}, 3000);
120 }
121 });
122 };
123 }
124
125 $(window).on("load", _ => {
126 //Remove styles from jobcareer and jobhunt plugins since they break our layout. They should not be loaded on our options page anyway.
127 $('link[href*="jobcareer"').remove();
128 $('link[href*="jobhunt"').remove();
129
130 $("#dashboard").addClass("show active");
131 window.addEventListener('cache.invalidate.request', clearCacheHandler("invalidate"));
132 window.addEventListener('cache.purge.request', clearCacheHandler("purge"));
133
134 NitroPack.QuickSetup.setChangeHandler(async function(value, success, error) {
135 success(value);
136 });
137 });
138
139 $("#nitro-restore-connection-btn").on("click", function() {
140 $.ajax({
141 url: ajaxurl,
142 type: 'GET',
143 data: {
144 action: "nitropack_reconfigure_webhooks"
145 },
146 dataType: 'json',
147 beforeSend: function() {
148 $("#nitro-restore-connection-btn").attr("disabled", true).html("<i class='fa fa-refresh fa-spin'></i>");
149 },
150 success: function(data) {
151 if (!data.status || data.status != "success") {
152 if (data.message) {
153 alert("<?php esc_html_e( 'Error:', 'nitropack' ); ?> " + data.message);
154 } else {
155 alert("<?php esc_html_e( 'Error: We were unable to restore the connection. Please contact our support team to get this resolved.', 'nitropack' ); ?>");
156 }
157 } else {
158 $("#nitro-restore-connection-btn").attr("disabled", true).html("<i class='fa fa-check'></i>");
159 }
160 },
161 complete: function() {
162 location.reload();
163 }
164 });
165 });
166 })(jQuery);
167 </script>
168