PluginProbe ʕ •ᴥ•ʔ
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization / 1.16.8
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization v1.16.8
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 / dashboard-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 2 years ago dashboard.php 1 year ago oneclick.php 2 years ago safemode.php 2 years ago system-report.php 1 year ago
dashboard-oneclick.php
146 lines
1 <?php nitropack_display_admin_notices(); ?>
2 <div class="grid grid-cols-2 gap-6 grid-col-1-tablet items-start">
3 <div class="col-span-1">
4 <!-- Optimized Pages Card -->
5 <div class="card card-optimized-pages">
6 <div class="card-header">
7 <h3><?php esc_html_e('Optimized pages', 'nitropack'); ?></h3>
8 <div class="flex flex-row items-center" style="display: none;" id="pending-optimizations-section">
9 <img src="<?php echo plugin_dir_url(__FILE__) . 'images/loading.svg'; ?>" alt="loading" class="w-4 h-4">
10 <span class="ml-2 mr-1 text-primary"> <?php esc_html_e('Processing', 'nitropack'); ?>
11 <span id="pending-optimizations-count">X</span> <?php esc_html_e('page(s) in the background', 'nitropack'); ?></span>
12 </div>
13 </div>
14 <div class="card-body">
15 <div class="flex flex-row items-center">
16 <div class="optimized-pages"><span data-optimized-pages-total>0</span></div>
17 <div class="text-box mr-2">
18 <p class="text-md"><?php esc_html_e('Last cache purge', 'nitropack'); ?>: <span data-last-cache-purge><?php esc_html_e('Never', 'nitropack'); ?></span> </br>
19 <?php esc_html_e('Reason', 'nitropack'); ?>: <span data-purge-reason><?php esc_html_e('Unknown', 'nitropack'); ?></span></p>
20 </div>
21 <button id="optimizations-purge-cache" type="button" class="ml-auto btn btn-secondary flex-shrink-0" data-modal-target="modal-purge-cache" data-modal-toggle="modal-purge-cache">
22 <?php esc_html_e('Purge Cache', 'nitropack'); ?></button>
23 </div>
24 </div>
25 <?php require_once NITROPACK_PLUGIN_DIR . 'view/modals/modal-purge-cache.php'; ?>
26 </div>
27 <!-- Optimized Pages Card End -->
28
29 </div>
30 <div class="col-span-1">
31 <!-- WP Engine Content Card -->
32 <div class="card card-vendor">
33 <?php if (empty($oneClickVendorWidget)) { ?>
34 <div class="card-header">
35 <h3><?php esc_html_e('What is NitroPack OneClick?', 'nitropack'); ?></h3>
36 <img src="<?php echo plugin_dir_url(__FILE__) . 'images/info.svg'; ?>">
37 </div>
38 <div class="card-body">
39 <p><?php esc_html_e('NitroPack OneClick is technically a one-click version of NitroPack preconfigured with essential features for immediate use. Activate is effortlessly and enjoy an instant boost in page speed.', 'nitropack'); ?> <a href="https://wpengine.com/page-speed-boost" target="_blank" class="link mt-5"><?php esc_html_e('Learn More', 'nitropack'); ?></a></p>
40 <a href="https://my.wpengine.com/products/page_speed_boost" target="_blank" class="btn btn-primary btn-manage mt-5"><?php esc_html_e('Manage', 'nitropack'); ?></a>
41 </div>
42 <?php } else { ?>
43 <?php echo $oneClickVendorWidget; ?>
44 <?php } ?>
45 </div>
46 <!-- WP Engine Content Card End -->
47 </div>
48 </div>
49
50 <script>
51 ($ => {
52 var getOptimizationsTimeout = null;
53 let isClearing = false;
54
55 $(window).on("load", function() {
56 getOptimizations();
57 });
58 let purgeCache = () => {
59 let purgeEvent = new Event("cache.purge.request");
60 window.dispatchEvent(purgeEvent);
61 }
62 var getOptimizations = _ => {
63 var url = '<?php echo $optimizationDetailsUrl; ?>';
64 ((s, e, f) => {
65 if (window.fetch) {
66 fetch(url)
67 .then(resp => resp.json())
68 .then(s)
69 .catch(e)
70 .finally(f);
71 } else {
72 $.ajax({
73 url: url,
74 type: 'GET',
75 dataType: 'json',
76 success: s,
77 error: e,
78 complete: f
79 })
80 }
81 })(data => {
82 $('[data-last-cache-purge]').text(data.last_cache_purge.timeAgo);
83 if (data.last_cache_purge.reason) {
84 $('[data-purge-reason]').text(data.last_cache_purge.reason);
85 $('#last-cache-purge-reason').show();
86 } else {
87 $('#last-cache-purge-reason').hide();
88 }
89
90 if (data.pending_count) {
91 $("#pending-optimizations-count").text(data.pending_count);
92 $("#pending-optimizations-section").show();
93 } else {
94 $("#pending-optimizations-section").hide();
95 }
96
97 $('[data-optimized-pages-total]').text(data.optimized_pages.total);
98 }, __ => {
99 console.error("An error occurred while fetching data for optimized pages");
100 }, __ => {
101 if (!getOptimizationsTimeout) {
102 getOptimizationsTimeout = setTimeout(function() {
103 getOptimizationsTimeout = null;
104 getOptimizations();
105 }, 60000);
106 }
107 });
108 }
109
110 var loadSafemodeStatus = function() {
111 $.ajax({
112 url: ajaxurl,
113 type: "POST",
114 data: {
115 action: "nitropack_safemode_status",
116 nonce: nitroNonce
117 },
118 dataType: "json",
119 success: function(resp) {
120 if (resp.type == "success") {
121 $("#nitropack-smenabled-notice").length && !!resp.isEnabled ? $("#nitropack-smenabled-notice").parent().show() : $("#nitropack-smenabled-notice").parent().hide();
122 } else {
123 setTimeout(loadSafemodeStatus, 500);
124 }
125 }
126 });
127 }
128 loadSafemodeStatus();
129
130 window.addEventListener("cache.invalidate.success", getOptimizations);
131 if ($('#np-onstate-cache-purge').length) {
132 window.addEventListener("cache.purge.success", function() {
133 setTimeout(function() {
134 document.cookie = "nitropack_apwarning=1; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=<?php echo nitropack_cookiepath(); ?>";
135 window.location.reload()
136 }, 1500)
137 });
138 } else {
139 window.addEventListener("cache.purge.success", getOptimizations);
140 }
141
142 window.performCachePurge = () => {
143 purgeCache();
144 }
145 })(jQuery);
146 </script>