PluginProbe ʕ •ᴥ•ʔ
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization / 1.15.1
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization v1.15.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 / connect.php
nitropack / view Last commit date
images 2 years ago javascript 2 years ago modals 2 years ago stylesheet 2 years ago templates 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 diagnostics.php 2 years ago oneclick.php 2 years ago safemode.php 2 years ago
connect.php
166 lines
1 <div id="nitropack-connect">
2 <header class="header">
3 <nav>
4 <ol>
5 <li class="step passed"><?php esc_html_e('Plugin activation', 'nitropack'); ?></li>
6 <li class="step current"><?php esc_html_e('Connect to NitroPack account', 'nitropack'); ?></li>
7 </ol>
8 </nav>
9 </header>
10 <main id="main">
11 <div class="logos">
12 <img src="<?php echo plugin_dir_url(__FILE__) . 'images/nitropack_logo.svg'; ?>" class="" width="116" height="44" alt="NitroPack" />
13 <img src="<?php echo plugin_dir_url(__FILE__) . 'images/plus.svg'; ?>" class="" width="32" height="32" alt="+" />
14 <img src="<?php echo plugin_dir_url(__FILE__) . 'images/wp_logo.svg'; ?>" class="" width="52" height="52" alt="WordPress" />
15 </div>
16 <div class="connect">
17 <div class="headline-container">
18 <h1><?php esc_html_e('Welcome to NitroPack for WordPress', 'nitropack'); ?></h1>
19 <p><?php esc_html_e('Let\'s boost your website\'s page load speed and improve your Core Web Vitals.', 'nitropack'); ?></p>
20 </div>
21 <div class="cta-container">
22 <form class="w-full" action="options.php" method="post" id="api-details-form">
23 <?php settings_fields(NITROPACK_OPTION_GROUP);
24 do_settings_sections(NITROPACK_OPTION_GROUP); ?>
25 <div id="manual-connect-fields" style="display: none">
26 <div class="form-row">
27 <label><span><?php esc_html_e('API Key', 'nitropack'); ?></span>
28 <div class="tooltip"><span class="tooltip-icon" data-tooltip-target="tooltip-api-key">
29 <img src="<?php echo plugin_dir_url(__FILE__) . 'images/info.svg'; ?>">
30 </span>
31 <div id="tooltip-api-key" role="tooltip" class="tooltip-container hidden">
32 <?php esc_html_e('API Key is a unique alphanumeric identifier assigned to each website using NitroPack.', 'nitropack');
33 ?>
34 <div class="tooltip-arrow" data-popper-arrow></div>
35 </div>
36 </div>
37 <input id="nitropack-siteid-input" name="nitropack-siteId" type="text" class="form-control" placeholder="<?php esc_html_e('API Key ', 'nitropack'); ?>">
38 </label>
39 </div>
40 <div class="form-row">
41 <label><span><?php esc_html_e('API Secret Key', 'nitropack'); ?></span>
42 <div class="tooltip"><span class="tooltip-icon" data-tooltip-target="tooltip-secret-key">
43 <img src="<?php echo plugin_dir_url(__FILE__) . 'images/info.svg'; ?>">
44 </span>
45 <div id="tooltip-secret-key" role="tooltip" class="tooltip-container hidden">
46 <?php esc_html_e('Site secret is a confidential alphanumeric key associated with your website, designed to ensure secure communication between NitroPack and your site.', 'nitropack');
47 ?>
48 <div class="tooltip-arrow" data-popper-arrow></div>
49 </div>
50 </div>
51 <input id="nitropack-sitesecret-input" name="nitropack-siteSecret" type="text" class="form-control" placeholder="<?php esc_html_e('API Secret Key', 'nitropack'); ?>">
52 <p class="text-smaller"><?php esc_html_e('Learn where to find your site\'s API details', 'nitropack'); ?> <a href="https://nitropack.io/blog/post/how-to-get-your-api-keys" target="_blank"><?php esc_html_e('here', 'nitropack'); ?></a></a>
53 </label>
54 </div>
55 </div>
56
57 <a href="#" class="btn btn-primary btn-xl w-100" id="connect-nitropack">
58 <img src="<?php echo plugin_dir_url(__FILE__) . 'images/loading.svg'; ?>" alt="loading" class="icon-left hidden">
59 <?php esc_html_e('Connect', 'nitropack'); ?>
60 </a>
61 </form>
62 <div class="help main"><?php _e('Having trouble connecting? Explore our <a href="#" class="btn-manual-connect">manual connect</a> option, browse our <a href="https://support.nitropack.io/en/collections/6175768-nitropack-for-wordpress-and-woocommerce" target="_blank">FAQ section</a>, or reach out to our <a href="https://support.nitropack.io/en/" target="_blank">support team</a>.', 'nitropack'); ?></div>
63 <div class="help manual" style="display: none"><?php esc_html_e('or', 'nitropack'); ?> <a href="#" class="btn-automatic-connect"><?php esc_html_e('connect automatically', 'nitropack'); ?></a></div>
64
65 </div>
66 </div>
67 <div class="success-container hidden">
68 <span class="bg-purple-100 btn-icon rounded-full mb-4" style="height: 36px;"><svg width="13" height="9" viewBox="0 0 13 9" fill="none" xmlns="http://www.w3.org/2000/svg">
69 <path d="M11.8334 1L4.50008 8.33333L1.16675 5" stroke="#1B004E" stroke-linecap="round" stroke-linejoin="round" />
70 </svg>
71 </span>
72 <h1><?php esc_html_e('All set!', 'nitropack'); ?></h1>
73 <p><?php esc_html_e('Your setup is complete – you\'re all set to experience a seamless journey ahead.', 'nitropack'); ?></p>
74 </div>
75 </main>
76 </div>
77 <script>
78 (function($) {
79
80 let connectPopup = null;
81 const homePageUrl = "<?php echo get_home_url(); ?>";
82 const nitroNonce = '<?php echo wp_create_nonce(NITROPACK_NONCE); ?>';
83
84 $(document).ready(function() {
85 function automaticConnect() {
86 if (!connectPopup || !connectPopup.window) {
87 let screenWidth = window.screen.availWidth;
88 let screenHeight = window.screen.availHeight;
89 let windowWidth = 800;
90 let windowHeight = 700;
91 let leftPos = window.top.outerWidth / 2 + window.top.screenX - (windowWidth / 2);
92 let topPos = window.top.outerHeight / 2 + window.top.screenY - (windowHeight / 2);
93
94 connectPopup = window.open("https://<?php echo NITROPACKIO_HOST; ?>/auth?website=" + homePageUrl, "QuickConnect", "width=" + windowWidth + ",height=" + windowHeight + ",left=" + leftPos + ",top=" + topPos);
95 } else if (connectPopup && connectPopup.window) {
96 connectPopup.focus();
97 }
98 }
99 $('.btn-manual-connect').click(function(e) {
100 $('#manual-connect-fields, .help').toggle();
101 });
102 $('.btn-automatic-connect').click(function() {
103 automaticConnect();
104 });
105 $("#connect-nitropack").on("click", function(e) {
106 e.preventDefault();
107 let siteId = $("#nitropack-siteid-input").val();
108 let siteSecret = $("#nitropack-sitesecret-input").val();
109 let loading_icon = $(this).find('.icon-left');
110 let isManualConnect = $("#manual-connect-fields").is(":visible");
111
112 loading_icon.removeClass('hidden');
113
114 if (isManualConnect || (siteId && siteSecret)) {
115 $.post(ajaxurl, {
116 action: 'nitropack_verify_connect',
117 siteId: siteId,
118 siteSecret: siteSecret,
119 nonce: nitroNonce
120 })
121 .done(function(response) {
122 let resp = JSON.parse(response);
123 if (resp.status == "success") {
124 $(".success-container").removeClass('hidden');
125 $(".header, .connect").addClass('hidden');
126 location.reload();
127 } else {
128 $("#nitropack-siteid-input, #nitropack-sitesecret-input").val("");
129 $("#main .notification").remove();
130 let errorMessage = resp.message ? resp.message : "<?php esc_html_e('Api details verification failed! Please check whether you entered correct details.', 'nitropack'); ?>";
131
132 if ($('#manual-connect-fields .nitro-notification').length) {
133 $('#manual-connect-fields .nitro-notification .notification-inner p').text(errorMessage);
134 } else {
135 $('#manual-connect-fields').prepend('<div class="nitro-notification notification-danger max-w-sm mb-8 ml-auto mr-auto"><div class="text-box text-center w-full"><div class="notification-inner"><p>' + errorMessage + '</p></div></div></div>');
136 }
137 }
138 })
139 .fail(function() {
140 console.error("An error occurred during the AJAX request.");
141 })
142 .always(function() {
143 loading_icon.addClass('hidden');
144 });
145 } else if (!isManualConnect) {
146 automaticConnect();
147
148 }
149 loading_icon.removeClass('hidden');
150 });
151 });
152
153 window.addEventListener("message", function(e) {
154 if (e.data.messageType == "nitropack-connect") {
155 $("#nitropack-siteid-input").val(e.data.api.key);
156 $("#nitropack-sitesecret-input").val(e.data.api.secret);
157 $("#connect-nitropack").click();
158 if (connectPopup && !connectPopup.closed) {
159 connectPopup.close();
160 connectPopup = null;
161 }
162 }
163 });
164
165 })(jQuery);
166 </script>