PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.1.6
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.1.6
6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 5.2.2 5.3 All 153 releases
mainwp / modules / api-backups / classes / class-api-backups-settings.php

class-api-backups-settings.php in MainWP Dashboard: Self-hosted WordPress Management for Agencies 6.1.6, at modules/api-backups/classes/class-api-backups-settings.php

1,467 lines 110.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * =======================================
4 * MainWP API Backups Admin
5 * =======================================
6 *
7 * @package MainWP\Dashboard
8 * @version 5.0
9 */
10
11 namespace MainWP\Dashboard\Module\ApiBackups;
12
13 use MainWP\Dashboard\MainWP_Credential_Render;
14 use MainWP\Dashboard\MainWP_UI;
15 use MainWP\Dashboard\MainWP_Settings_Indicator;
16 use MainWP\Dashboard\MainWP_Settings;
17
18 // Exit if accessed directly.
19 if ( ! defined( 'ABSPATH' ) ) {
20 exit;
21 }
22
23 /**
24 * MainWP API Backups Admin
25 */
26 class Api_Backups_Settings {
27
28 /**
29 * Static variable to hold the single instance of the class.
30 *
31 * @static
32 *
33 * @var mixed Default null
34 */
35 public static $instance = null;
36
37 /**
38 * Get Instance
39 *
40 * Creates public static instance.
41 *
42 * @static
43 *
44 * @return Api_Backups_Settings
45 */
46 public static function get_instance() {
47 if ( null === static::$instance ) {
48 static::$instance = new self();
49 }
50 return static::$instance;
51 }
52
53 /**
54 * Method get_class_name()
55 *
56 * Get Class Name.
57 *
58 * @return string __CLASS__
59 */
60 public static function get_class_name() {
61 return __CLASS__;
62 }
63
64 /**
65 * Constructor
66 *
67 * Runs each time the class is called.
68 */
69 public function __construct() {
70 add_action( 'admin_init', array( &$this, 'admin_init' ) );
71 add_action( 'mainwp_manage_sites_edit', array( &$this, 'hook_render_mainwp_manage_sites_edit' ), 10, 2 );
72 add_action( 'mainwp_update_site', array( &$this, 'hook_mainwp_update_site' ), 10, 2 );
73 }
74
75 /**
76 * Initiate Hooks
77 *
78 * Initiates hooks for the API Backups extension.
79 */
80 public function admin_init() {
81 }
82
83 /**
84 * Render settings
85 *
86 * Renders the settings page.
87 */
88 public function render_settings_page() {
89
90 if ( ! \mainwp_current_user_can( 'dashboard', 'manage_api_backups' ) ) {
91 \mainwp_do_not_have_permissions( esc_html__( 'manage api backups', 'mainwp' ) );
92 return;
93 }
94
95 do_action( 'mainwp_pageheader_settings', 'ApiBackups' );
96
97 ?>
98 <div id="mainwp-module-log-settings-wrapper">
99 <?php
100 if ( isset( $_GET['message'] ) && ! empty( $_GET['message'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
101 $message = esc_html__( 'Settings saved.', 'mainwp' );
102 ?>
103 <div class="ui green message" id="mainwp-module-api-backups-message-zone" >
104 <?php echo esc_html( $message ); ?>
105 <i class="ui close icon"></i>
106 </div>
107 <?php
108 }
109 ?>
110 <form id="mainwp-module-api-backups-settings-form" method="post" action="admin.php?page=SettingsApiBackups" class="ui form">
111 <?php $this->render_settings_content(); ?>
112 </form>
113 </div>
114 <?php
115 do_action( 'mainwp_pagefooter_settings', 'ApiBackups' );
116 }
117
118 /**
119 * Render settings
120 *
121 * Renders the extension settings page.
122 *
123 * @param bool $individual Individual settings True|False.
124 */
125 public function render_settings_content( $individual = false ) {
126 static::render_3rd_party_api_manager( $individual );
127 }
128
129 /**
130 * Render 3rd party api settings
131 *
132 * Renders the extension settings page.
133 *
134 * @param bool $individual Individual settings True|False.
135 */
136 public static function render_3rd_party_api_manager( $individual = false ) { //phpcs:ignore -- NOSONAR - complex method.
137 $_nonce_slug = $individual ? 'cloudways_api_form_individual' : 'cloudways_api_form_general';
138 ?>
139 <div id="3rd-party-api-manager">
140 <div class="ui padded segment">
141
142 <div class="ui stackable grid">
143 <div class="sixteen wide column">
144 <div class="ui secondary pointing fluid menu">
145
146 <a class="item active" data-tab="cloudways">
147 <?php esc_html_e( 'Cloudways', 'mainwp' ); ?>
148 </a>
149 <a class="item" data-tab="gridpane">
150 <?php esc_html_e( 'GridPane', 'mainwp' ); ?>
151 </a>
152 <a class="item" data-tab="vultr">
153 <?php echo esc_html__( 'Vultr', 'mainwp' ); ?>
154 </a>
155 <a class="item" data-tab="linode">
156 <?php echo esc_html__( 'Akamai (Linode)', 'mainwp' ); ?>
157 </a>
158 <a class="item" data-tab="digitalocean">
159 <?php echo esc_html__( 'DigitalOcean', 'mainwp' ); ?>
160 </a>
161 <a class="item" data-tab="cpanel">
162 <?php echo esc_html__( 'cPanel (WP Toolkit)', 'mainwp' ); ?>
163 </a>
164 <a class="item" data-tab="plesk">
165 <?php echo esc_html__( 'Plesk (WP Toolkit)', 'mainwp' ); ?>
166 </a>
167 <a class="item" data-tab="kinsta">
168 <?php echo esc_html__( 'Kinsta', 'mainwp' ); ?>
169 </a>
170 </div>
171 </div>
172 <div class="sixteen wide column">
173 <?php if ( Api_Backups_Utility::show_mainwp_message( 'mainwp-module-api-backups-manager-info-message' ) ) : ?>
174 <div class="ui blue message">
175 <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-module-api-backups-manager-info-message"></i>
176 <?php
177 printf(
178 /* translators: %1$s: Opening HTML anchor tag, %2$s: Closing HTML anchor tag with icon */
179 esc_html__(
180 'This feature allows you to trigger and restore backups only for sites hosted on supported providers via their API. Backups cannot be created for sites hosted elsewhere or stored on these services if your site is not hosted with them. Check this %1$shelp document%2$s to see all available services & the endpoints that MainWP currently supports.',
181 'mainwp'
182 ),
183 '<a href="https://docs.mainwp.com/sites/backups/manage-backups#api-backups" target="_blank">', // NOSONAR - noopener - open safe.
184 '</a> <i class="external alternate icon"></i>'
185 );
186 ?>
187 <div class="ui hidden divider"></div>
188 <strong><?php esc_html_e( 'Note: VHM (Virtual Host Manager) is not supported.', 'mainwp' ); ?></strong> <?php esc_html_e( 'The purpose of having these global cPanel settings is to save you time when setting up per-site cPanel settings, which is particularly useful if you manage multiple child sites on the same cPanel account.', 'mainwp' ); ?>
189 </div>
190 <?php endif; ?>
191
192 <?php
193
194 $saved_settings = false;
195
196 if ( isset( $_POST['submit'] ) ) {
197 $old_settings = MainWP_Settings::get_all_settings_values();
198 }
199
200 // Save CloudWays Data.
201 //phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
202 ?>
203 <?php if ( isset( $_POST['submit'] ) && isset( $_POST['wp_nonce_cloudways'] ) && wp_verify_nonce( sanitize_key( $_POST['wp_nonce_cloudways'] ), 'cloudways_api_form_general' ) ) : ?>
204 <?php Api_Backups_Utility::update_option( 'mainwp_enable_cloudways_api', ( ! isset( $_POST['mainwp_enable_cloudways_api'] ) ? 0 : 1 ) ); ?>
205 <?php Api_Backups_Utility::update_option( 'mainwp_cloudways_api_account_email', ( isset( $_POST['mainwp_cloudways_api_account_email'] ) ? wp_unslash( $_POST['mainwp_cloudways_api_account_email'] ) : '' ) ); ?>
206 <?php Api_Backups_Utility::get_instance()->update_api_key( 'cloudways', ( isset( $_POST['mainwp_cloudways_api_key'] ) ? wp_unslash( $_POST['mainwp_cloudways_api_key'] ) : '' ) ); ?>
207 <div class="ui green message"><i class="close icon"></i><?php esc_html_e( 'API credentials have been successfully saved.', 'mainwp' ); ?></div>
208 <?php
209 Api_Backups_3rd_Party::cloudways_action_update_ids();
210 $saved_settings = true;
211 ?>
212 <?php endif; ?>
213 <?php // END Save CloudWays Data. ?>
214 <?php // Save GridPane Data. ?>
215 <?php if ( isset( $_POST['submit'] ) && isset( $_POST['wp_nonce_gridpane'] ) && wp_verify_nonce( sanitize_key( $_POST['wp_nonce_gridpane'] ), 'cloudways_api_form_general' ) ) : ?>
216 <?php Api_Backups_Utility::update_option( 'mainwp_enable_gridpane_api', ( ! isset( $_POST['mainwp_enable_gridpane_api'] ) ? 0 : 1 ) ); ?>
217 <?php Api_Backups_Utility::get_instance()->update_api_key( 'gridpane', ( isset( $_POST['mainwp_gridpane_api_key'] ) ? wp_unslash( $_POST['mainwp_gridpane_api_key'] ) : '' ) ); ?>
218 <div class="ui green message"><i class="close icon"></i><?php esc_html_e( 'API credentials have been successfully saved.', 'mainwp' ); ?></div>
219 <?php
220 Api_Backups_3rd_Party::gridpane_action_update_ids();
221 $saved_settings = true;
222 ?>
223 <?php endif; ?>
224 <?php // END Save GridPane Data. ?>
225 <?php // Save Vultr Data. ?>
226 <?php if ( isset( $_POST['submit'] ) && isset( $_POST['wp_nonce_vultr'] ) && wp_verify_nonce( sanitize_key( $_POST['wp_nonce_vultr'] ), 'cloudways_api_form_general' ) ) : ?>
227 <?php Api_Backups_Utility::update_option( 'mainwp_enable_vultr_api', ( ! isset( $_POST['mainwp_enable_vultr_api'] ) ? 0 : 1 ) ); ?>
228 <?php
229 Api_Backups_Utility::get_instance()->update_api_key( 'vultr', ( isset( $_POST['mainwp_vultr_api_key'] ) ? wp_unslash( $_POST['mainwp_vultr_api_key'] ) : '' ) );
230 $saved_settings = true;
231 ?>
232 <div class="ui green message"><i class="close icon"></i><?php esc_html_e( 'API credentials have been successfully saved.', 'mainwp' ); ?></div>
233 <?php endif; ?>
234 <?php // END Save Vultr Data. ?>
235 <?php // Save Linode Data. ?>
236 <?php if ( isset( $_POST['submit'] ) && isset( $_POST['wp_nonce_linode'] ) && wp_verify_nonce( sanitize_key( $_POST['wp_nonce_linode'] ), 'cloudways_api_form_general' ) ) : ?>
237 <?php Api_Backups_Utility::update_option( 'mainwp_enable_linode_api', ( ! isset( $_POST['mainwp_enable_linode_api'] ) ? 0 : 1 ) ); ?>
238 <?php
239 Api_Backups_Utility::get_instance()->update_api_key( 'linode', ( isset( $_POST['mainwp_linode_api_key'] ) ? wp_unslash( $_POST['mainwp_linode_api_key'] ) : '' ) );
240 $saved_settings = true;
241 ?>
242 <div class="ui green message"><i class="close icon"></i><?php esc_html_e( 'API credentials have been successfully saved.', 'mainwp' ); ?></div>
243 <?php endif; ?>
244 <?php // END Save Linode Data. ?>
245 <?php // Save DigitalOcean Data. ?>
246 <?php if ( isset( $_POST['submit'] ) && isset( $_POST['wp_nonce_digitalocean'] ) && wp_verify_nonce( sanitize_key( $_POST['wp_nonce_digitalocean'] ), 'cloudways_api_form_general' ) ) : ?>
247 <?php Api_Backups_Utility::update_option( 'mainwp_enable_digitalocean_api', ( ! isset( $_POST['mainwp_enable_digitalocean_api'] ) ? 0 : 1 ) ); ?>
248 <?php
249 Api_Backups_Utility::get_instance()->update_api_key( 'digitalocean', ( isset( $_POST['mainwp_digitalocean_api_key'] ) ? wp_unslash( $_POST['mainwp_digitalocean_api_key'] ) : '' ) );
250 $saved_settings = true;
251 ?>
252 <div class="ui green message"><i class="close icon"></i><?php esc_html_e( 'API credentials have been successfully saved.', 'mainwp' ); ?></div>
253 <?php endif; ?>
254 <?php // END Save Linode Data. ?>
255 <?php // Save cPanel Data. ?>
256 <?php if ( isset( $_POST['submit'] ) && isset( $_POST['wp_nonce_cpanel'] ) && wp_verify_nonce( sanitize_key( $_POST['wp_nonce_cpanel'] ), 'cloudways_api_form_general' ) ) : ?>
257 <?php Api_Backups_Utility::update_option( 'mainwp_enable_cpanel_api', ( ! isset( $_POST['mainwp_enable_cpanel_api'] ) ? 0 : 1 ) ); ?>
258 <?php Api_Backups_Utility::update_option( 'mainwp_cpanel_url', ( isset( $_POST['mainwp_cpanel_url'] ) ? wp_unslash( $_POST['mainwp_cpanel_url'] ) : '' ) ); ?>
259 <?php Api_Backups_Utility::update_option( 'mainwp_cpanel_site_path', ( isset( $_POST['mainwp_cpanel_site_path'] ) ? wp_unslash( $_POST['mainwp_cpanel_site_path'] ) : '' ) ); ?>
260 <?php Api_Backups_Utility::update_option( 'mainwp_cpanel_account_username', ( isset( $_POST['mainwp_cpanel_account_username'] ) ? wp_unslash( $_POST['mainwp_cpanel_account_username'] ) : '' ) ); ?>
261 <?php
262 Api_Backups_Utility::get_instance()->update_api_key( 'cpanel', ( isset( $_POST['mainwp_cpanel_account_password'] ) ? wp_unslash( $_POST['mainwp_cpanel_account_password'] ) : '' ) );
263 $saved_settings = true;
264 ?>
265 <div class="ui green message"><i class="close icon"></i><?php esc_html_e( 'API credentials have been successfully saved.', 'mainwp' ); ?></div>
266 <?php endif; ?>
267 <?php // END Save cPanel Data. ?>
268 <?php // Save Plesk Data. ?>
269 <?php if ( isset( $_POST['submit'] ) && isset( $_POST['wp_nonce_plesk'] ) && wp_verify_nonce( sanitize_key( $_POST['wp_nonce_plesk'] ), 'cloudways_api_form_general' ) ) : ?>
270 <?php Api_Backups_Utility::update_option( 'mainwp_enable_plesk_api', ( ! isset( $_POST['mainwp_enable_plesk_api'] ) ? 0 : 1 ) ); ?>
271 <?php Api_Backups_Utility::update_option( 'mainwp_plesk_api_url', ( isset( $_POST['mainwp_plesk_api_url'] ) ? wp_unslash( $_POST['mainwp_plesk_api_url'] ) : '' ) ); ?>
272 <?php
273 Api_Backups_Utility::get_instance()->update_api_key( 'plesk', ( isset( $_POST['mainwp_plesk_api_key'] ) ? wp_unslash( $_POST['mainwp_plesk_api_key'] ) : '' ) );
274 $saved_settings = true;
275 ?>
276 <?php
277 if ( isset( $_POST['mainwp_plesk_installation_id'] ) ) {
278 Api_Backups_Utility::update_option( 'mainwp_plesk_installation_id', sanitize_text_field( wp_unslash( $_POST['mainwp_plesk_installation_id'] ) ) );
279 }
280 ?>
281 <div class="ui green message"><i class="close icon"></i><?php esc_html_e( 'API credentials have been successfully saved.', 'mainwp' ); ?></div>
282 <?php endif; ?>
283 <?php // END Save Plesk Data. ?>
284 <?php // Save Kinsta Data. ?>
285 <?php if ( isset( $_POST['submit'] ) && isset( $_POST['wp_nonce'] ) && wp_verify_nonce( sanitize_key( $_POST['wp_nonce'] ), 'kinsta_api_form' ) ) : ?>
286 <?php Api_Backups_Utility::update_option( 'mainwp_enable_kinsta_api', ( ! isset( $_POST['mainwp_enable_kinsta_api'] ) ? 0 : 1 ) ); ?>
287 <?php Api_Backups_Utility::get_instance()->update_api_key( 'kinsta', ! empty( $_POST['mainwp_kinsta_api_key'] ) ? wp_unslash( $_POST['mainwp_kinsta_api_key'] ) : '' ); ?>
288 <?php Api_Backups_Utility::update_option( 'mainwp_kinsta_api_account_email', ( isset( $_POST['mainwp_kinsta_api_account_email'] ) ? wp_unslash( $_POST['mainwp_kinsta_api_account_email'] ) : '' ) ); ?>
289 <?php
290 Api_Backups_Utility::update_option( 'mainwp_kinsta_company_id', ( isset( $_POST['mainwp_kinsta_company_id'] ) ? wp_unslash( $_POST['mainwp_kinsta_company_id'] ) : '' ) );
291 $saved_settings = true;
292 ?>
293 <div class="ui green message"><i class="close icon"></i><?php esc_html_e( 'API credentials have been successfully saved.', 'mainwp' ); ?></div>
294 <?php endif; ?>
295 <?php // END Save Kinsta Data. ?>
296
297 <?php
298
299 if ( $saved_settings ) {
300 $new_settings = MainWP_Settings::get_all_settings_values();
301 /**
302 * Action: mainwp_after_save_settings
303 *
304 * Fires after save settings.
305 *
306 * @since 6.0
307 *
308 * @param array $new_settings The new settings.
309 * @param array $old_settings The old settings.
310 */
311 do_action( 'mainwp_after_save_settings', $new_settings, $old_settings );
312 }
313
314 ?>
315
316 <?php // Build Cloudways API Form. ?>
317 <div class="ui tab segment active" data-tab="cloudways">
318 <h3 class="ui dividing header">
319 <?php MainWP_Settings_Indicator::render_indicator( 'header', 'settings-field-indicator-cloudways-settings' ); ?>
320 <?php esc_html_e( 'Cloudways API Settings', 'mainwp' ); ?></h3>
321 <ul>
322 <li><?php /* translators: %s: HTML anchor link */ printf( esc_html__( "1. If you don't already have one, get a %s", 'mainwp' ), '<a target="_blank" href="https://mainwp.com/go/cloudways-mainwp/">Cloudways account</a>' ); // NOSONAR - noopener - open safe. ?></li>
323 <li><?php /* translators: %s: HTML anchor link */ printf( esc_html__( '2. Get your API Key from here: %s', 'mainwp' ), '<a target="_blank" href="https://platform.cloudways.com/api">https://platform.cloudways.com/api</a>' ); // NOSONAR - noopener - open safe. ?></li>
324 <li><?php esc_html_e( '3. Enter in your account email address and API Key below.', 'mainwp' ); ?></li>
325 </ul>
326 <div class="ui hidden divider"></div>
327 <div class="ui form">
328 <form method="POST" action="">
329 <?php
330 MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' );
331 ?>
332 <input type="hidden" name="wp_nonce_cloudways" value="<?php echo esc_attr( wp_create_nonce( $_nonce_slug ) ); ?>" />
333 <?php
334 /**
335 * Action: cloudways_api_form_top
336 *
337 * Fires at the top of CloudWays API form.
338 *
339 * @since 4.1
340 */
341 do_action( 'cloudways_api_form_top' );
342 ?>
343 <div class="ui grid field settings-field-indicator-wrapper settings-field-indicator-cloudways-settings">
344 <label class="six wide column middle aligned">
345 <?php MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', get_option( 'mainwp_enable_cloudways_api', 0 ) ); ?>
346 <?php esc_html_e( 'Enable Cloudways API', 'mainwp' ); ?></label>
347 <div class="ten wide column ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'If enabled, the Cloudways API will be activated.', 'mainwp' ); ?>" data-inverted="" data-position="bottom left">
348 <input type="checkbox" class="settings-field-value-change-handler" name="mainwp_enable_cloudways_api" id="mainwp_enable_cloudways_api" <?php echo 1 === (int) get_option( 'mainwp_enable_cloudways_api', 0 ) ? 'checked="true"' : ''; ?> />
349 </div>
350 </div>
351 <div class="ui grid field settings-field-indicator-wrapper settings-field-indicator-cloudways-settings">
352 <label class="six wide column middle aligned">
353 <?php
354 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', get_option( 'mainwp_cloudways_api_account_email' ) );
355 esc_html_e( 'Account Email', 'mainwp' );
356 ?>
357 </label>
358 <div class="five wide column">
359 <input type="text" class="settings-field-value-change-handler" name="mainwp_cloudways_api_account_email" id="mainwp_cloudways_api_account_email" value="<?php echo false === get_option( 'mainwp_cloudways_api_account_email' ) ? '' : esc_attr( get_option( 'mainwp_cloudways_api_account_email' ) ); ?>" />
360 </div>
361 </div>
362 <?php
363 $_api_key = Api_Backups_3rd_Party::get_cloudways_api_key();
364 ?>
365 <div class="ui grid field settings-field-indicator-wrapper settings-field-indicator-cloudways-settings">
366 <label class="six wide column middle aligned">
367 <?php
368 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', $_api_key );
369 esc_html_e( 'API Key', 'mainwp' );
370 ?>
371 </label>
372 <div class="five wide column">
373 <input type="password" class="settings-field-value-change-handler" name="mainwp_cloudways_api_key" id="mainwp_cloudways_api_key" value="<?php echo esc_attr( MainWP_Credential_Render::value_for_input( ! empty( $_api_key ) ) ); ?>" autocomplete="new-password" />
374 </div>
375 </div>
376 <?php
377 /**
378 * Action: cloudways_api_form_bottom
379 *
380 * Fires at the bottom of CloudWays API form.
381 *
382 * @since 4.1
383 */
384 do_action( 'cloudways_api_form_bottom' );
385 $el_id_btn_sbm_1 = 'submit';
386 ?>
387 <div class="ui divider"></div>
388 <input type="submit" name="submit" id="<?php echo esc_attr( $el_id_btn_sbm_1 ); ?>" class="ui green big button" value="<?php esc_attr_e( 'Save Settings', 'mainwp' ); ?>"/>
389 <div style="clear:both"></div>
390 </form>
391 </div>
392 </div>
393
394 <div class="ui tab segment" data-tab="gridpane">
395 <h3 class="ui dividing header">
396 <?php MainWP_Settings_Indicator::render_indicator( 'header', 'settings-field-indicator-gridpane-settings' ); ?>
397 <?php esc_html_e( 'GridPane API Settings', 'mainwp' ); ?></h3>
398 <div class="ui info message"><?php /* translators: 1: Opening bold tag, 2: Closing bold tag */ printf( esc_html__( 'Must be the %1$sGridPane Owners Account%2$s &amp; have a %1$sDeveloper Plan or above%2$s in order to use this feature.', 'mainwp' ), '<b>', '</b>' ); ?></div>
399 <ul>
400 <li><?php /* translators: %s: HTML anchor link */ printf( esc_html__( "1. If you don't already have one, get a %s", 'mainwp' ), '<a target="_blank" href="https://mainwp.com/go/gridpane/">GridPane account</a>' ); // NOSONAR - noopener - open safe. ?></li>
401 <li><?php /* translators: 1: Opening bold tag, 2: Closing bold tag, 3: HTML anchor link */ printf( esc_html__( '2. Get your %1$sAPI Personal Access Token%2$s here: %3$s', 'mainwp' ), '<b>', '</b>', '<a target="_blank" href="https://my.gridpane.com/settings">https://my.gridpane.com/settings</a>' ); ?></li>
402 <li><?php /* translators: 1: Opening bold tag, 2: Closing bold tag */ printf( esc_html__( '3. %1$sClick GridPare API%2$s in the left hand menu &amp; %1$sCreate your Personal Access Token%2$s', 'mainwp' ), '<b>', '</b>' ); ?></li>
403 <li><?php /* translators: 1: Opening bold tag, 2: Closing bold tag */ printf( esc_html__( '4. Copy &amp; Paste your %1$sAPI Personal Access Token%2$s below', 'mainwp' ), '<b>', '</b>' ); ?></li>
404 </ul>
405 <div class="ui hidden divider settings-field-indicator-wrapper settings-field-indicator-gridpane-settings"></div>
406 <div class="ui form">
407 <form method="POST" action="">
408 <?php MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); ?>
409 <input type="hidden" name="wp_nonce_gridpane" value="<?php echo esc_attr( wp_create_nonce( $_nonce_slug ) ); ?>" />
410 <?php
411 /**
412 * Action: gridpane_api_form_top
413 *
414 * Fires at the top of GridPane API form.
415 *
416 * @since 4.1
417 */
418 do_action( 'gridpane_api_form_top' );
419 ?>
420 <div class="ui grid field settings-field-indicator-wrapper settings-field-indicator-gridpane-settings">
421 <label class="six wide column middle aligned">
422 <?php
423 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', get_option( 'mainwp_enable_gridpane_api', 0 ) );
424 esc_html_e( 'Enable GridPane API', 'mainwp' );
425 ?>
426 </label>
427 <div class="ten wide column ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'If enabled, the GridPane API will be activated.', 'mainwp' ); ?>" data-inverted="" data-position="bottom left">
428 <input type="checkbox" class="settings-field-value-change-handler" name="mainwp_enable_gridpane_api" id="mainwp_enable_gridpane_api" <?php echo 1 === (int) get_option( 'mainwp_enable_gridpane_api', 0 ) ? 'checked="true"' : ''; ?> />
429 </div>
430 </div>
431 <div class="ui grid field settings-field-indicator-wrapper settings-field-indicator-gridpane-settings">
432 <label class="six wide column middle aligned">
433 <?php
434 $_api_key = Api_Backups_3rd_Party::get_gridpane_api_key();
435 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', $_api_key );
436 esc_html_e( 'Personal Access Token', 'mainwp' );
437 ?>
438 </label>
439 <div class="five wide column">
440 <input type="password" class="settings-field-value-change-handler" name="mainwp_gridpane_api_key" id="mainwp_gridpane_api_key" value="<?php echo esc_attr( MainWP_Credential_Render::value_for_input( ! empty( $_api_key ) ) ); ?>" autocomplete="new-password" />
441 </div>
442 </div>
443 <?php
444 /**
445 * Action: gridpane_api_form_bottom
446 *
447 * Fires at the bottom of GridPane API form.
448 *
449 * @since 4.1
450 */
451 do_action( 'gridpane_api_form_bottom' );
452 $el_id_btn_sbm_2 = 'submit';
453 ?>
454 <div class="ui divider"></div>
455 <input type="submit" name="submit" id="<?php echo esc_attr( $el_id_btn_sbm_2 ); ?>" class="ui green big button" value="<?php esc_attr_e( 'Save Settings', 'mainwp' ); ?>"/>
456 <div style="clear:both"></div>
457 </form>
458 </div>
459 </div>
460
461 <div class="ui tab segment" data-tab="vultr">
462 <h3 class="ui dividing header">
463 <?php MainWP_Settings_Indicator::render_indicator( 'header', 'settings-field-indicator-vultr-settings' ); ?>
464 <?php esc_html_e( 'Vultr API Settings', 'mainwp' ); ?>
465 </h3>
466 <ul>
467 <li><?php /* translators: %s: HTML anchor link */ printf( esc_html__( "1. If you don't already have one, get a %s", 'mainwp' ), '<a target="_blank" href="https://mainwp.com/go/vultr/">Vultr account</a>' ); // NOSONAR - noopener - open safe. ?></li>
468 <li><?php /* translators: 1: Opening bold tag, 2: Closing bold tag, 3: HTML anchor link */ printf( esc_html__( '2. Use this %3$s to find your MainWP Dashboard IP Address %1$s"Mask Bits"%2$s', 'mainwp' ), '<b>', '</b>', '<a target="_blank" href="https://www.vultr.com/resources/subnet-calculator/">Subnet Calculator Tool</a>' ); ?></b></li>
469 <li><?php /* translators: 1: Opening bold tag, 2: Closing bold tag, 3: HTML anchor link */ printf( esc_html__( '3. Navigate to %3$s and Whitelist your MainWP Dashboard %1$sIP/Mask Bits%2$s and %1$sActivate/Copy%2$s your %1$sAPI Key%2$s', 'mainwp' ), '<b>', '</b>', '<a target="_blank" href="https://my.vultr.com/settings/#settingsapi">Vultr API Settings</a>' ); ?></li>
470 <li><?php esc_html_e( '4. Paste in your account API Key below and click the Save Settings button.', 'mainwp' ); ?></li>
471 <li><?php esc_html_e( '5. Once the API is connected, go to the Site Edit page (for all sites on this host) and set the correct Provider and Instance ID.', 'mainwp' ); ?></li>
472 </ul>
473 <div class="ui hidden divider"></div>
474 <div class="ui form">
475 <form method="POST" action="">
476 <?php MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); ?>
477 <input type="hidden" name="wp_nonce_vultr" value="<?php echo esc_attr( wp_create_nonce( $_nonce_slug ) ); ?>" />
478 <?php
479 /**
480 * Action: vultr_api_form_top
481 *
482 * Fires at the top of Vultr API form.
483 *
484 * @since 4.1
485 */
486 do_action( 'vultr_api_form_top' );
487 ?>
488 <div class="ui grid field settings-field-indicator-wrapper settings-field-indicator-vultr-settings">
489 <label class="six wide column middle aligned">
490 <?php
491 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', get_option( 'mainwp_enable_vultr_api', 0 ) );
492 esc_html_e( 'Enable Vultr API', 'mainwp' );
493 ?>
494 </label>
495 <div class="ten wide column ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'If enabled, the Vultr API will be activated.', 'mainwp' ); ?>" data-inverted="" data-position="bottom left">
496 <input type="checkbox" class="settings-field-value-change-handler" name="mainwp_enable_vultr_api" id="mainwp_enable_vultr_api" <?php echo 1 === (int) get_option( 'mainwp_enable_vultr_api', 0 ) ? 'checked="true"' : ''; ?> />
497 </div>
498 </div>
499 <div class="ui grid field settings-field-indicator-wrapper settings-field-indicator-vultr-settings">
500 <label class="six wide column middle aligned">
501 <?php
502 $_api_key = Api_Backups_3rd_Party::get_vultr_api_key();
503 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', $_api_key );
504 esc_html_e( 'API Key', 'mainwp' );
505 ?>
506 </label>
507 <div class="five wide column">
508 <input type="password" class="settings-field-value-change-handler" name="mainwp_vultr_api_key" id="mainwp_vultr_api_key" value="<?php echo esc_attr( MainWP_Credential_Render::value_for_input( ! empty( $_api_key ) ) ); ?>" autocomplete="new-password" />
509 </div>
510 </div>
511 <?php
512 /**
513 * Action: vultr_api_form_bottom
514 *
515 * Fires at the bottom of Vultr API form.
516 *
517 * @since 4.1
518 */
519 do_action( 'vultr_api_form_bottom' );
520 $el_id_sbm_btn_1 = 'submit';
521 ?>
522 <div class="ui divider"></div>
523 <input type="submit" name="submit" id="<?php echo esc_attr( $el_id_sbm_btn_1 ); ?>" class="ui green big button" value="<?php esc_attr_e( 'Save Settings', 'mainwp' ); ?>"/>
524 <div style="clear:both"></div>
525 </form>
526 </div>
527 </div>
528
529 <div class="ui tab segment" data-tab="linode">
530 <h3 class="ui dividing header">
531 <?php MainWP_Settings_Indicator::render_indicator( 'header', 'settings-field-indicator-linode-settings' ); ?>
532 <?php esc_html_e( 'Akamai (Linode) API Settings', 'mainwp' ); ?>
533 </h3>
534 <ul>
535 <li><?php /* translators: %s: HTML anchor link */ printf( esc_html__( "1. If you don't already have one, get a %s", 'mainwp' ), '<a target="_blank" href="https://mainwp.com/go/akamai-linode/">Akamai (Linode) account</a>' ); // NOSONAR - noopener - open safe. ?></li>
536 <li><?php /* translators: 1: Opening bold tag, 2: Closing bold tag, 3: HTML anchor link */ printf( esc_html__( '2. You may create a %1$sPersonal Access Token%2$s by navigating here: %3$s', 'mainwp' ), '<b>', '</b>', '<a target="_blank" href="https://cloud.linode.com/profile/tokens">https://cloud.linode.com/profile/tokens</a>' ); ?></b></li>
537 <li><?php /* translators: 1: Opening bold tag, 2: Closing bold tag */ printf( esc_html__( '3. Paste in your account %1$sPersonal Access Token%2$s below and click the Save Settings button.', 'mainwp' ), '<b>', '</b>' ); ?></li>
538 <li><?php esc_html_e( '4. Once the API is connected, go to the Site Edit page (for all sites on this host) and set the correct Provider and Instance ID.', 'mainwp' ); ?></li>
539 </ul>
540 <div class="ui hidden divider"></div>
541 <div class="ui form">
542 <form method="POST" action="">
543 <?php MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); ?>
544 <input type="hidden" name="wp_nonce_linode" value="<?php echo esc_attr( wp_create_nonce( $_nonce_slug ) ); ?>" />
545 <?php
546 /**
547 * Action: linode_api_form_top
548 *
549 * Fires at the top of Vultr API form.
550 *
551 * @since 4.1
552 */
553 do_action( 'linode_api_form_top' );
554 ?>
555 <div class="ui grid field settings-field-indicator-wrapper settings-field-indicator-linode-settings">
556 <label class="six wide column middle aligned">
557 <?php
558 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', get_option( 'mainwp_enable_linode_api', 0 ) );
559 esc_html_e( 'Enable Akamai (Linode) API', 'mainwp' );
560 ?>
561 </label>
562 <div class="ten wide column ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'If enabled, the Akamai (Linode) API will be activated.', 'mainwp' ); ?>" data-inverted="" data-position="bottom left">
563 <input type="checkbox" class="settings-field-value-change-handler" name="mainwp_enable_linode_api" id="mainwp_enable_linode_api" <?php echo 1 === (int) get_option( 'mainwp_enable_linode_api', 0 ) ? 'checked="true"' : ''; ?> />
564 </div>
565 </div>
566 <?php
567 $_api_key = Api_Backups_3rd_Party::get_linode_api_key();
568 ?>
569 <div class="ui grid field settings-field-indicator-wrapper settings-field-indicator-linode-settings">
570 <label class="six wide column middle aligned">
571 <?php
572 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', $_api_key );
573 esc_html_e( 'API Key', 'mainwp' );
574 ?>
575 </label>
576 <div class="five wide column">
577 <input type="password" class="settings-field-value-change-handler" name="mainwp_linode_api_key" id="mainwp_linode_api_key" value="<?php echo esc_attr( MainWP_Credential_Render::value_for_input( ! empty( $_api_key ) ) ); ?>" autocomplete="new-password" />
578 </div>
579 </div>
580 <?php
581 /**
582 * Action: linode_api_form_bottom
583 *
584 * Fires at the bottom of Vultr API form.
585 *
586 * @since 4.1
587 */
588 do_action( 'linode_api_form_bottom' );
589 $el_id_btn_sbm_3 = 'submit';
590 ?>
591 <div class="ui divider"></div>
592 <input type="submit" name="submit" id="<?php echo esc_attr( $el_id_btn_sbm_3 ); ?>" class="ui green big button" value="<?php esc_attr_e( 'Save Settings', 'mainwp' ); ?>"/>
593 <div style="clear:both"></div>
594 </form>
595 </div>
596 </div>
597
598 <div class="ui tab segment" data-tab="digitalocean">
599 <h3 class="ui dividing header">
600 <?php MainWP_Settings_Indicator::render_indicator( 'header', 'settings-field-indicator-digitalocean-settings' ); ?>
601 <?php esc_html_e( 'DigitalOcean', 'mainwp' ); ?>
602 </h3>
603 <ul>
604 <li><?php /* translators: %s: HTML anchor link */ printf( esc_html__( "1. If you don't already have one, get a %s", 'mainwp' ), '<a target="_blank" href="https://mainwp.com/go/digital-ocean/">DigitalOcean account</a>' ); // NOSONAR - noopener - open safe. ?></li>
605 <li><?php /* translators: 1: Opening bold tag, 2: Closing bold tag, 3: HTML anchor link */ printf( esc_html__( '2. You can generate a %1$sPersonal Access Token%2$s by visiting the %3$s section of the DigitalOcean control panel for your account.', 'mainwp' ), '<b>', '</b>', '<a target="_blank" href="https://cloud.digitalocean.com/account/api/tokens">Apps & API</a>' ); ?></b></li>
606 <li><?php /* translators: 1: Opening bold tag, 2: Closing bold tag */ printf( esc_html__( '3. Paste in your %1$sPersonal Access Token%2$s below and click the Save Settings button.', 'mainwp' ), '<b>', '</b>' ); ?></li>
607 <li><?php esc_html_e( '4. Once the API is connected, go to the Site Edit page (for all sites on this host) and set the correct Provider and Instance ID.', 'mainwp' ); ?></li>
608 </ul>
609 <div class="ui hidden divider"></div>
610 <div class="ui form">
611 <form method="POST" action="">
612 <?php MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); ?>
613 <input type="hidden" name="wp_nonce_digitalocean" value="<?php echo esc_attr( wp_create_nonce( $_nonce_slug ) ); ?>" />
614 <?php
615 /**
616 * Action: digitalocean_api_form_top
617 *
618 * Fires at the top of DigitalOcean API form.
619 *
620 * @since 4.1
621 */
622 do_action( 'digitalocean_api_form_top' );
623 ?>
624 <div class="ui grid field settings-field-indicator-wrapper settings-field-indicator-digitalocean-settings">
625 <label class="six wide column middle aligned">
626 <?php
627 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', get_option( 'mainwp_enable_digitalocean_api', 0 ) );
628 esc_html_e( 'Enable DigitalOcean API', 'mainwp' );
629 ?>
630 </label>
631 <div class="ten wide column ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'If enabled, the DigitalOcean API will be activated.', 'mainwp' ); ?>" data-inverted="" data-position="bottom left">
632 <input type="checkbox" class="settings-field-value-change-handler" name="mainwp_enable_digitalocean_api" id="mainwp_enable_digitalocean_api" <?php echo 1 === (int) get_option( 'mainwp_enable_digitalocean_api', 0 ) ? 'checked="true"' : ''; ?> />
633 </div>
634 </div>
635 <?php
636 $_api_key = Api_Backups_3rd_Party::get_digitalocean_api_key();
637 ?>
638 <div class="ui grid field settings-field-indicator-wrapper settings-field-indicator-digitalocean-settings">
639 <label class="six wide column middle aligned">
640 <?php
641 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', $_api_key );
642 esc_html_e( 'API Key', 'mainwp' );
643 ?>
644 </label>
645 <div class="five wide column">
646 <input type="password" class="settings-field-value-change-handler" name="mainwp_digitalocean_api_key" id="mainwp_digitalocean_api_key" value="<?php echo esc_attr( MainWP_Credential_Render::value_for_input( ! empty( $_api_key ) ) ); ?>" autocomplete="new-password" />
647 </div>
648 </div>
649 <?php
650 /**
651 * Action: digitalocean_api_form_bottom
652 *
653 * Fires at the bottom of DigitalOcean API form.
654 *
655 * @since 4.1
656 */
657 do_action( 'digitalocean_api_form_bottom' );
658 $el_id_btn_sbm_4 = 'submit';
659 ?>
660 <div class="ui divider"></div>
661 <input type="submit" name="submit" id="<?php echo esc_attr( $el_id_btn_sbm_4 ); ?>" class="ui green big button" value="<?php esc_attr_e( 'Save Settings', 'mainwp' ); ?>"/>
662 <div style="clear:both"></div>
663 </form>
664 </div>
665 </div>
666
667 <div class="ui tab segment" data-tab="cpanel">
668 <h3 class="ui dividing header">
669 <?php MainWP_Settings_Indicator::render_indicator( 'header', 'settings-field-indicator-cpanel-settings' ); ?>
670 <?php esc_html_e( 'cPanel (WP Toolkit)', 'mainwp' ); ?>
671 </h3>
672 <ul>
673 <li><?php esc_html_e( '1. Enter in your cPanel URL below. ( eg. https://my-site.com:2083 )', 'mainwp' ); ?></li>
674 <li><?php esc_html_e( '2. Enter in your cPanel account Username and Password below.', 'mainwp' ); ?></li>
675 <li><?php esc_html_e( 'This information can be provided by your Child Site&#39;s Host.', 'mainwp' ); ?></li>
676 </ul>
677 <div class="ui hidden divider"></div>
678 <div class="ui form">
679 <form method="POST" action="">
680 <?php MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); ?>
681 <input type="hidden" name="wp_nonce_cpanel" value="<?php echo esc_attr( wp_create_nonce( $_nonce_slug ) ); ?>" />
682 <?php
683 /**
684 * Action: cpanel_api_form
685 *
686 * Fires at the top of cPanel API form.
687 *
688 * @since 4.1
689 */
690 do_action( 'cpanel_api_form' );
691 ?>
692 <div class="ui grid field settings-field-indicator-wrapper settings-field-indicator-cpanel-settings">
693 <label class="six wide column middle aligned">
694 <?php
695 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', get_option( 'mainwp_enable_cpanel_api', 0 ) );
696 esc_html_e( 'Enable cPanel API', 'mainwp' );
697 ?>
698 </label>
699 <div class="ten wide column ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'If enabled, the cPanel API will be activated.', 'mainwp' ); ?>" data-inverted="" data-position="bottom left">
700 <input type="checkbox" class="settings-field-value-change-handler" name="mainwp_enable_cpanel_api" id="mainwp_enable_cpanel_api" <?php echo 1 === (int) get_option( 'mainwp_enable_cpanel_api', 0 ) ? 'checked="true"' : ''; ?> />
701 </div>
702 </div>
703 <div class="ui grid field settings-field-indicator-wrapper settings-field-indicator-cpanel-settings">
704 <label class="six wide column middle aligned">
705 <?php
706 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', get_option( 'mainwp_cpanel_url' ) );
707 esc_html_e( 'cPanel URL', 'mainwp' );
708 ?>
709 </label>
710 <div class="five wide column">
711 <input type="text" class="settings-field-value-change-handler" name="mainwp_cpanel_url" id="mainwp_cpanel_url" value="<?php echo false === get_option( 'mainwp_cpanel_url' ) ? '' : esc_attr( get_option( 'mainwp_cpanel_url' ) ); ?>" />
712 </div>
713 </div>
714 <div class="ui grid field settings-field-indicator-wrapper settings-field-indicator-cpanel-settings">
715 <label class="six wide column middle aligned">
716 <?php
717 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', get_option( 'mainwp_cpanel_account_username' ) );
718 esc_html_e( 'Username', 'mainwp' );
719 ?>
720 </label>
721
722 <div class="five wide column">
723 <input type="text" class="settings-field-value-change-handler" name="mainwp_cpanel_account_username" id="mainwp_cpanel_account_username" value="<?php echo false === get_option( 'mainwp_cpanel_account_username' ) ? '' : esc_attr( get_option( 'mainwp_cpanel_account_username' ) ); ?>" />
724 </div>
725 </div>
726 <div class="ui grid field settings-field-indicator-wrapper settings-field-indicator-cpanel-settings">
727 <label class="six wide column middle aligned">
728 <?php
729 $_api_key = Api_Backups_3rd_Party::get_cpanel_account_password();
730 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', $_api_key );
731 esc_html_e( 'Password', 'mainwp' );
732 ?>
733 </label>
734 <div class="five wide column">
735 <input type="password" class="settings-field-value-change-handler" name="mainwp_cpanel_account_password" id="mainwp_cpanel_account_password" value="<?php echo esc_attr( MainWP_Credential_Render::value_for_input( ! empty( $_api_key ) ) ); ?>" autocomplete="new-password" /><!-- NOSONAR -->
736 </div>
737 </div>
738 <div class="ui grid field settings-field-indicator-wrapper settings-field-indicator-cpanel-settings">
739 <label class="six wide column middle aligned">
740 <?php
741 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', get_option( 'mainwp_cpanel_site_path' ) );
742 esc_html_e( 'cPanel Site Path', 'mainwp' );
743 ?>
744 </label>
745 <div class="five wide column">
746 <input type="text" class="settings-field-value-change-handler" name="mainwp_cpanel_site_path" id="mainwp_cpanel_site_path" value="<?php echo false === get_option( 'mainwp_cpanel_site_path' ) ? '' : esc_attr( get_option( 'mainwp_cpanel_site_path' ) ); ?>" />
747 </div>
748 </div>
749 <?php
750 /**
751 * Action: cpanel_api_form_bottom
752 *
753 * Fires at the bottom of cPanel API form.
754 *
755 * @since 4.1
756 */
757 do_action( 'cpanel_api_form_bottom' );
758 $el_id_btn_sbm_5 = 'submit';
759 ?>
760 <div class="ui divider"></div>
761 <input type="submit" name="submit" id="<?php echo esc_attr( $el_id_btn_sbm_5 ); ?>" class="ui green big button" value="<?php esc_attr_e( 'Save Settings', 'mainwp' ); ?>"/>
762 <div style="clear:both"></div>
763 </form>
764 </div>
765 </div>
766
767 <div class="ui tab segment" data-tab="plesk">
768 <h3 class="ui dividing header">
769 <?php MainWP_Settings_Indicator::render_indicator( 'header', 'settings-field-indicator-plesk-settings' ); ?>
770 <?php esc_html_e( 'Plesk (WP Toolkit)', 'mainwp' ); ?>
771 </h3>
772 <ul>
773 <li><?php esc_html_e( '1. Login to your Plesk Account', 'mainwp' ); ?></li>
774 <li><?php esc_html_e( '2. Do a search for "Keychain for API Secret Keys" & install it.', 'mainwp' ); ?></li>
775 <li><?php esc_html_e( '3. Click Open > Click Add Secret Key > Add a description > Click OK', 'mainwp' ); ?></li>
776 <li><?php esc_html_e( '4. Copy & Paste your API Access Token below', 'mainwp' ); ?></li>
777 </ul>
778 <div class="ui hidden divider"></div>
779 <div class="ui form">
780 <form method="POST" action="">
781 <?php MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); ?>
782 <input type="hidden" name="wp_nonce_plesk" value="<?php echo esc_attr( wp_create_nonce( $_nonce_slug ) ); ?>" />
783 <?php
784 /**
785 * Action: plesk_api_form_top
786 *
787 * Fires at the top of Plesk API form.
788 *
789 * @since 4.1
790 */
791 do_action( 'plesk_api_form_top' );
792 ?>
793 <div class="ui grid field settings-field-indicator-wrapper settings-field-indicator-plesk-settings">
794 <label class="six wide column middle aligned">
795 <?php
796 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', get_option( 'mainwp_enable_plesk_api', 0 ) );
797 esc_html_e( 'Enable Plesk (WP Toolkit) API', 'mainwp' );
798 ?>
799 </label>
800 <div class="ten wide column ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'If enabled, the Plesk API will be activated.', 'mainwp' ); ?>" data-inverted="" data-position="bottom left">
801 <input type="checkbox" class="settings-field-value-change-handler" name="mainwp_enable_plesk_api" id="mainwp_enable_plesk_api" <?php echo 1 === (int) get_option( 'mainwp_enable_plesk_api', 0 ) ? 'checked="true"' : ''; ?> />
802 </div>
803 </div>
804 <div class="ui grid field settings-field-indicator-wrapper settings-field-indicator-plesk-settings">
805 <label class="six wide column middle aligned">
806 <?php
807 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', get_option( 'mainwp_plesk_api_url' ) );
808 esc_html_e( 'Plesk URL', 'mainwp' );
809 ?>
810 </label>
811 <div class="five wide column" data-tooltip="<?php esc_attr_e( 'eg.: https://epic-snyder.123-111-123-143.plesk.page:8443', 'mainwp' ); ?>">
812 <input type="text" class="settings-field-value-change-handler" name="mainwp_plesk_api_url" id="mainwp_plesk_api_url" value="<?php echo false === get_option( 'mainwp_plesk_api_url' ) ? '' : esc_attr( get_option( 'mainwp_plesk_api_url' ) ); ?>" />
813 </div>
814 </div>
815 <div class="ui grid field settings-field-indicator-wrapper settings-field-indicator-plesk-settings">
816 <label class="six wide column middle aligned">
817 <?php
818 $_api_key = Api_Backups_3rd_Party::get_plesk_api_key();
819 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', $_api_key );
820 esc_html_e( 'API Key', 'mainwp' );
821 ?>
822 </label>
823 <div class="five wide column">
824 <input type="password" class="settings-field-value-change-handler" name="mainwp_plesk_api_key" id="mainwp_plesk_api_key" value="<?php echo esc_attr( MainWP_Credential_Render::value_for_input( ! empty( $_api_key ) ) ); ?>" autocomplete="new-password" />
825 </div>
826 </div>
827 <?php
828 /**
829 * Action: plesk_api_form_bottom
830 *
831 * Fires at the bottom of Plesk API form.
832 *
833 * @since 4.1
834 */
835 do_action( 'plesk_api_form_bottom' );
836 $el_id_btn_sbm_7 = 'submit';
837 ?>
838 <div class="ui divider"></div>
839 <input type="submit" name="submit" id="<?php echo esc_attr( $el_id_btn_sbm_7 ); ?>" class="ui green big button" value="<?php esc_attr_e( 'Save Settings', 'mainwp' ); ?>"/>
840 <div style="clear:both"></div>
841 </form>
842 </div>
843 </div>
844
845 <div class="ui tab segment" data-tab="kinsta">
846 <h3 class="ui dividing header">
847 <?php MainWP_Settings_Indicator::render_indicator( 'header', 'settings-field-indicator-kinsta-settings' ); ?>
848 <?php esc_html_e( 'Kinsta', 'mainwp' ); ?>
849 </h3>
850 <ul>
851 <li><?php /* translators: %s: HTML anchor link */ printf( esc_html__( "1. If you don't already have one, get a %s", 'mainwp' ), '<a target="_blank" href="https://my.kinsta.com/">Kinsta account</a>' ); ?></li>
852 <li><?php /* translators: %1$s: HTML anchor link */ printf( esc_html__( '2. You can generate an API Key by visiting the %1$s tab of the Company Settings Page.', 'mainwp' ), '<a target="_blank" href="https://my.kinsta.com/company/apiKeys">API Keys</a>' ); ?></b></li>
853 <li><?php /* translators: 1: Opening bold tag, 2: Closing bold tag */ printf( esc_html__( '3. Paste in your %1$sCredentials%2$s below and click the Save Settings button.', 'mainwp' ), '<b>', '</b>' ); ?></li>
854 <li><?php esc_html_e( '4. Once the API is connected, go to the Site Edit page (for all sites on this host) and set the correct Provider and Environment ID.', 'mainwp' ); ?></li>
855 </ul>
856 <div class="ui hidden divider"></div>
857 <div class="ui form">
858 <form method="POST" action="">
859 <?php MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); ?>
860 <input type="hidden" name="wp_nonce" value="<?php echo esc_attr( wp_create_nonce( 'kinsta_api_form' ) ); ?>" />
861 <?php
862 /**
863 * Action: kinsta_api_form_top
864 *
865 * Fires at the top of Kinsta API form.
866 *
867 * @since 4.1
868 */
869 do_action( 'kinsta_api_form_top' );
870 ?>
871 <div class="ui grid field settings-field-indicator-wrapper settings-field-indicator-kinsta-settings">
872 <label class="six wide column middle aligned">
873 <?php
874 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', get_option( 'mainwp_enable_kinsta_api', 0 ) );
875 esc_html_e( 'Enable Kinsta API', 'mainwp' );
876 ?>
877 </label>
878 <div class="ten wide column ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'If enabled, the Kinsta API will be activated.', 'mainwp' ); ?>" data-inverted="" data-position="bottom left">
879 <input type="checkbox" name="mainwp_enable_kinsta_api" id="mainwp_enable_kinsta_api" <?php echo ( 1 === (int) get_option( 'mainwp_enable_kinsta_api', 0 ) ) ? 'checked="true"' : ''; ?> />
880 </div>
881 </div>
882 <div class="ui grid field settings-field-indicator-wrapper settings-field-indicator-cloudways-settings">
883 <label class="six wide column middle aligned">
884 <?php
885 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', get_option( 'mainwp_kinsta_api_account_email' ) );
886 esc_html_e( 'Account Email', 'mainwp' );
887 ?>
888 </label>
889 <div class="five wide column">
890 <input type="text" class="settings-field-value-change-handler" name="mainwp_kinsta_api_account_email" id="mainwp_kinsta_api_account_email" value="<?php echo false === get_option( 'mainwp_kinsta_api_account_email' ) ? '' : esc_attr( get_option( 'mainwp_kinsta_api_account_email' ) ); ?>" />
891 </div>
892 </div>
893 <div class="ui grid field settings-field-indicator-wrapper settings-field-indicator-kinsta-settings">
894 <label class="six wide column middle aligned">
895 <?php
896 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', get_option( 'mainwp_kinsta_company_id' ) );
897 esc_html_e( 'Company ID', 'mainwp' );
898 ?>
899 </label>
900 <div class="five wide column">
901 <input type="text" class="settings-field-value-change-handler" name="mainwp_kinsta_company_id" id="mainwp_kinsta_company_id" value="<?php echo false === get_option( 'mainwp_kinsta_company_id' ) ? '' : esc_attr( get_option( 'mainwp_kinsta_company_id' ) ); ?>" />
902 </div>
903 </div>
904 <div class="ui grid field settings-field-indicator-wrapper settings-field-indicator-kinsta-settings">
905 <label class="six wide column middle aligned">
906 <?php
907 $_api_key = Api_Backups_3rd_Party::get_kinsta_api_key();
908 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', $_api_key );
909 esc_html_e( 'API Key', 'mainwp' );
910 ?>
911 </label>
912 <div class="five wide column">
913 <input type="password" name="mainwp_kinsta_api_key" id="mainwp_kinsta_api_key" value="<?php echo esc_attr( MainWP_Credential_Render::value_for_input( ! empty( $_api_key ) ) ); ?>" autocomplete="new-password" />
914 </div>
915 </div>
916
917 <?php
918 /**
919 * Action: kinsta_api_form_bottom
920 *
921 * Fires at the bottom of Kinsta API form.
922 *
923 * @since 4.1
924 */
925 do_action( 'kinsta_api_form_bottom' );
926 $el_id_btn_sbm_6 = 'submit';
927 ?>
928 <div class="ui divider"></div>
929 <input type="submit" name="submit" id="<?php echo esc_attr( $el_id_btn_sbm_6 ); ?>" class="ui green big button" value="<?php esc_attr_e( 'Save Settings', 'mainwp' ); ?>"/>
930 <div style="clear:both"></div>
931 </form>
932 </div>
933 </div>
934 </div>
935 </div>
936 </div>
937 </div>
938 <?php
939 }
940
941 /**
942 * Method hook_mainwp_update_site().
943 *
944 * @param int $website_id Website ID.
945 *
946 * @return void
947 */
948 public function hook_mainwp_update_site( $website_id ) { //phpcs:ignore -- NOSONAR - complex method.
949 /**
950 * 3rd-Party Backup API Provider Settings.
951 *
952 * Update Backup API Provider Settings ( Individual Child Site Edit Page ),
953 */
954
955 //phpcs:disable WordPress.Security.NonceVerification.Missing
956 if ( ! isset( $_POST['mainwp_managesites_edit_module_api_backups_provider'] ) ) {
957 return;
958 }
959
960 $api_backup_provider = isset( $_POST['mainwp_managesites_edit_module_api_backups_provider'] ) && ! empty( $_POST['mainwp_managesites_edit_module_api_backups_provider'] ) ? intval( $_POST['mainwp_managesites_edit_module_api_backups_provider'] ) : '';
961 $api_backup_provider_name = '';
962
963 if ( ! empty( $api_backup_provider ) ) {
964 if ( 1 === $api_backup_provider ) {
965 $api_backup_provider_name = 'DigitalOcean';
966 } elseif ( 2 === $api_backup_provider ) {
967 $api_backup_provider_name = 'Linode';
968 } elseif ( 3 === $api_backup_provider ) {
969 $api_backup_provider_name = 'Vultr';
970 } elseif ( 4 === $api_backup_provider ) {
971 $api_backup_provider_name = 'cPanel';
972 } elseif ( 5 === $api_backup_provider ) {
973 $api_backup_provider_name = 'Plesk';
974 } elseif ( 6 === $api_backup_provider ) {
975 $api_backup_provider_name = 'Kinsta';
976 }
977 }
978
979 // Store the 3rd Party Backup Provider.
980 Api_Backups_Helper::update_website_option( $website_id, 'mainwp_3rd_party_api', $api_backup_provider_name );
981
982 // Store the 3rd Party Backup Provider Instance ID.
983 $api_backup_instance_id = isset( $_POST['edit_site_module_api_backups_provider_instance_id'] ) ? sanitize_text_field( wp_unslash( $_POST['edit_site_module_api_backups_provider_instance_id'] ) ) : '';
984 Api_Backups_Helper::update_website_option( $website_id, 'mainwp_3rd_party_instance_id', $api_backup_instance_id );
985
986 // Store the cPanel Individual API URL.
987 $cpanel_api_url = isset( $_POST['cpanel_api_url'] ) ? wp_unslash( $_POST['cpanel_api_url'] ) : ''; //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
988 Api_Backups_Helper::update_website_option( $website_id, 'cpanel_api_url', $cpanel_api_url );
989
990 // Store cPanel Individual or Global toggle.
991 $mainwp_enable_wp_toolkit = isset( $_POST['mainwp_enable_wp_toolkit'] ) ? wp_unslash( $_POST['mainwp_enable_wp_toolkit'] ) : '0'; //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
992 Api_Backups_Helper::update_website_option( $website_id, 'mainwp_enable_wp_toolkit', $mainwp_enable_wp_toolkit );
993
994 // Store cPanel Individual or Global toggle.
995 $enable_cpanel_individual = isset( $_POST['mainwp_enable_cpanel_individual'] ) ? wp_unslash( $_POST['mainwp_enable_cpanel_individual'] ) : '0';//phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
996 Api_Backups_Helper::update_website_option( $website_id, 'mainwp_enable_cpanel_individual', $enable_cpanel_individual );
997
998 // Store cPanel Individual Account Username.
999 $cpanel_account_username = isset( $_POST['mainwp_cpanel_account_username'] ) ? wp_unslash( $_POST['mainwp_cpanel_account_username'] ) : ''; //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1000 Api_Backups_Helper::update_website_option( $website_id, 'cpanel_account_username', $cpanel_account_username );
1001
1002 // Store cPanel Individual Account Password.
1003 $cpanel_account_password = isset( $_POST['mainwp_cpanel_account_password'] ) ? wp_unslash( $_POST['mainwp_cpanel_account_password'] ) : ''; //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1004 Api_Backups_Utility::get_instance()->update_child_api_key( $website_id, 'cpanel', $cpanel_account_password );
1005
1006 // Store cPanel Individual Site Path.
1007 $cpanel_site_path = isset( $_POST['cpanel_site_path'] ) ? wp_unslash( $_POST['cpanel_site_path'] ) : ''; //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1008 Api_Backups_Helper::update_website_option( $website_id, 'cpanel_site_path', $cpanel_site_path );
1009
1010 // Store Plesk Individual or Global toggle.
1011 $enable_plesk_individual = isset( $_POST['mainwp_enable_plesk_individual'] ) ? wp_unslash( $_POST['mainwp_enable_plesk_individual'] ) : '0'; //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1012 Api_Backups_Helper::update_website_option( $website_id, 'mainwp_enable_plesk_individual', $enable_plesk_individual );
1013
1014 // Store Plesk Individual API URL.
1015 $plesk_api_url = isset( $_POST['plesk_api_url'] ) ? wp_unslash( $_POST['plesk_api_url'] ) : ''; //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1016 Api_Backups_Helper::update_website_option( $website_id, 'plesk_api_url', rtrim( $plesk_api_url, '/' ) );
1017
1018 // Store Plesk Individual Installation ID.
1019 $plesk_installation_id = isset( $_POST['plesk_installation_id'] ) ? wp_unslash( $_POST['plesk_installation_id'] ) : ''; //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1020 Api_Backups_Helper::update_website_option( $website_id, 'mainwp_plesk_installation_id', $plesk_installation_id );
1021
1022 // Store Plesk Individual API Key.
1023 $plesk_api_key = isset( $_POST['mainwp_plesk_api_key'] ) ? wp_unslash( $_POST['mainwp_plesk_api_key'] ) : ''; //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1024 Api_Backups_Utility::get_instance()->update_child_api_key( $website_id, 'plesk', $plesk_api_key );
1025
1026 // Store Kinsta Individual or Global toggle.
1027 $enable_kinsta_individual = isset( $_POST['mainwp_enable_kinsta_individual'] ) ? wp_unslash( $_POST['mainwp_enable_kinsta_individual'] ) : '0';
1028 Api_Backups_Helper::update_website_option( $website_id, 'mainwp_enable_kinsta_individual', $enable_kinsta_individual );
1029
1030 // Store Kinsta Environment ID.
1031 $kinsta_environment_id = isset( $_POST['kinsta_environment_id'] ) ? wp_unslash( $_POST['kinsta_environment_id'] ) : '0';
1032 Api_Backups_Helper::update_website_option( $website_id, 'mainwp_kinsta_environment_id', $kinsta_environment_id );
1033
1034 // Store Kinsta Account Email.
1035 $kinsta_account_email = isset( $_POST['kinsta_account_email'] ) ? wp_unslash( $_POST['kinsta_account_email'] ) : '0';
1036 Api_Backups_Helper::update_website_option( $website_id, 'mainwp_kinsta_account_email', $kinsta_account_email );
1037
1038 // Store Kinsta Company ID.
1039 $kinsta_company_id = isset( $_POST['kinsta_company_id'] ) ? wp_unslash( $_POST['kinsta_company_id'] ) : '0';
1040 Api_Backups_Helper::update_website_option( $website_id, 'mainwp_kinsta_company_id', $kinsta_company_id );
1041
1042 // Store Kinsta Individual API Key.
1043 $kinsta_api_key = isset( $_POST['mainwp_kinsta_api_key'] ) ? wp_unslash( $_POST['mainwp_kinsta_api_key'] ) : '';
1044 Api_Backups_Utility::get_instance()->update_child_api_key( $website_id, 'kinsta', $kinsta_api_key );
1045 //phpcs:enable
1046 }
1047
1048 /**
1049 * Method hook_render_mainwp_manage_sites_edit().
1050 *
1051 * @param mixed $website Website.
1052 * @return mixed
1053 */
1054 public function hook_render_mainwp_manage_sites_edit( $website ) { //phpcs:ignore -- NOSONAR - complex method.
1055
1056 if ( empty( $website ) ) {
1057 return;
1058 }
1059
1060 $mainwp_3rd_party_api = '';
1061 $mainwp_3rd_party_instance_id = '';
1062 $mainwp_3rd_party_cloudways_app_id = '';
1063 $mainwp_3rd_party_cloudways_server_id = '';
1064 $mainwp_3rd_party_gridpane_site_id = '';
1065 $mainwp_cpanel_api_url = '';
1066 $mainwp_cpanel_site_path = '';
1067 $mainwp_cpanel_account_username = '';
1068 $mainwp_plesk_api_url = '';
1069
1070 $cpanel_account_password = '';
1071
1072 if ( is_object( $website ) && property_exists( $website, 'id' ) ) {
1073 $opts = Api_Backups_Helper::get_website_options(
1074 $website,
1075 array(
1076 'mainwp_3rd_party_api',
1077 'mainwp_3rd_party_instance_id',
1078 'mainwp_3rd_party_app_id',
1079 'mainwp_enable_wp_toolkit',
1080 'mainwp_enable_cpanel_individual',
1081 'mainwp_enable_plesk_individual',
1082 'mainwp_enable_kinsta_individual',
1083 'cpanel_api_url',
1084 'cpanel_site_path',
1085 'cpanel_account_username',
1086 'plesk_api_url',
1087 'mainwp_plesk_installation_id',
1088 'mainwp_kinsta_environment_id',
1089 'mainwp_kinsta_account_email',
1090 'mainwp_kinsta_company_id',
1091 )
1092 );
1093
1094 if ( is_array( $opts ) ) {
1095 $mainwp_3rd_party_api = isset( $opts['mainwp_3rd_party_api'] ) ? $opts['mainwp_3rd_party_api'] : '';
1096 $mainwp_3rd_party_instance_id = isset( $opts['mainwp_3rd_party_instance_id'] ) ? $opts['mainwp_3rd_party_instance_id'] : '';
1097 $mainwp_3rd_party_cloudways_app_id = isset( $opts['mainwp_3rd_party_app_id'] ) ? $opts['mainwp_3rd_party_app_id'] : '';
1098 $mainwp_3rd_party_cloudways_server_id = isset( $opts['mainwp_3rd_party_instance_id'] ) ? $opts['mainwp_3rd_party_instance_id'] : '';
1099 $mainwp_3rd_party_gridpane_site_id = isset( $opts['mainwp_3rd_party_instance_id'] ) ? $opts['mainwp_3rd_party_instance_id'] : '';
1100 $mainwp_enable_wp_toolkit = isset( $opts['mainwp_enable_wp_toolkit'] ) ? $opts['mainwp_enable_wp_toolkit'] : '0';
1101 $mainwp_enable_cpanel_individual = isset( $opts['mainwp_enable_cpanel_individual'] ) ? $opts['mainwp_enable_cpanel_individual'] : '0';
1102 $mainwp_enable_plesk_individual = isset( $opts['mainwp_enable_plesk_individual'] ) ? $opts['mainwp_enable_plesk_individual'] : '0';
1103 $mainwp_enable_kinsta_individual = isset( $opts['mainwp_enable_kinsta_individual'] ) ? $opts['mainwp_enable_kinsta_individual'] : '0';
1104 $mainwp_cpanel_api_url = isset( $opts['cpanel_api_url'] ) ? $opts['cpanel_api_url'] : '';
1105 $mainwp_cpanel_site_path = isset( $opts['cpanel_site_path'] ) ? $opts['cpanel_site_path'] : '';
1106 $mainwp_cpanel_account_username = isset( $opts['cpanel_account_username'] ) ? $opts['cpanel_account_username'] : '';
1107 $mainwp_plesk_api_url = isset( $opts['plesk_api_url'] ) ? $opts['plesk_api_url'] : '';
1108 $mainwp_plesk_installation_id = isset( $opts['mainwp_plesk_installation_id'] ) ? $opts['mainwp_plesk_installation_id'] : '';
1109 $mainwp_kinsta_environment_id = isset( $opts['mainwp_kinsta_environment_id'] ) ? $opts['mainwp_kinsta_environment_id'] : '';
1110 $mainwp_kinsta_account_email = isset( $opts['mainwp_kinsta_account_email'] ) ? $opts['mainwp_kinsta_account_email'] : '';
1111 $mainwp_kinsta_company_id = isset( $opts['mainwp_kinsta_company_id'] ) ? $opts['mainwp_kinsta_company_id'] : '';
1112 }
1113
1114 if ( empty( $mainwp_cpanel_api_url ) && ! empty( get_option( 'mainwp_cpanel_url' ) ) ) {
1115 $mainwp_cpanel_api_url = get_option( 'mainwp_cpanel_url' );
1116 }
1117
1118 if ( empty( $mainwp_cpanel_account_username ) && ! empty( get_option( 'mainwp_cpanel_account_username' ) ) ) {
1119 $mainwp_cpanel_account_username = get_option( 'mainwp_cpanel_account_username' );
1120 }
1121
1122 $cpanel_account_password = Api_Backups_Utility::get_instance()->get_child_api_key( $website, 'cpanel' );
1123 $_api_key = Api_Backups_3rd_Party::get_cpanel_account_password();
1124 if ( empty( $cpanel_account_password ) && ! empty( $_api_key ) ) {
1125 $cpanel_account_password = $_api_key;
1126 }
1127
1128 if ( empty( $mainwp_cpanel_site_path ) && ! empty( get_option( 'mainwp_cpanel_site_path' ) ) ) {
1129 $mainwp_cpanel_site_path = get_option( 'mainwp_cpanel_site_path' );
1130 }
1131 }
1132
1133 ?>
1134 <div class="ui basic accordion mainwp-blank-accordion mainwp-sidebar-accordion" id="mainwp-edit-site-backup-api-provider-settings-accordion">
1135 <h2 class="ui dividing header title">
1136 <i class="right dropdown icon"></i>
1137 <?php esc_html_e( 'Backup API Provider Settings', 'mainwp' ); ?>
1138 <div class="sub header"><?php esc_html_e( 'Use the provided settings to set your Backup API provider. Sites hosted on Cloudways and Gridpane do not require these settings.', 'mainwp' ); ?></div>
1139 <div class="sub header"><?php esc_html_e( 'Use these settings to select Provider and instance ID only if the site is hosted on DigitalOcean, Akamai (Linode), or Vultr hosting.', 'mainwp' ); ?></div>
1140 <div class="sub header"><?php esc_html_e( 'Sites hosted on Cloudways and GridPane do not require these settings to be added manually. All the necessary info for the feature will be obtained automatically so you can leave these settings blank.', 'mainwp' ); ?></div>
1141 </h2>
1142 <div class="content">
1143 <?php if ( '' === $mainwp_3rd_party_api || 'cPanel' === $mainwp_3rd_party_api || 'Plesk' === $mainwp_3rd_party_api || 'Kinsta' === $mainwp_3rd_party_api ) : ?>
1144 <div class="ui grid field settings-field-indicator-wrapper">
1145 <label class="six wide column middle aligned">
1146 <?php
1147 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', $mainwp_3rd_party_api );
1148 ?>
1149 <?php esc_html_e( 'Choose a provider', 'mainwp' ); ?></label>
1150 <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Detected provider', 'mainwp' ); ?>" data-inverted="" data-position="top left">
1151 <select class="ui dropdown settings-field-value-change-handler" id="mainwp_managesites_edit_module_api_backups_provider" name="mainwp_managesites_edit_module_api_backups_provider">
1152 <option <?php echo ( '' === $mainwp_3rd_party_api ) ? 'selected' : ''; ?> value="0"><?php esc_html_e( 'None', 'mainwp' ); ?></option>
1153 <option <?php echo ( 'DigitalOcean' === $mainwp_3rd_party_api ) ? 'selected' : ''; ?> value="1"><?php esc_html_e( 'DigitalOcean', 'mainwp' ); ?></option>
1154 <option <?php echo ( 'Linode' === $mainwp_3rd_party_api ) ? 'selected' : ''; ?> value="2"><?php esc_html_e( 'Akamai (Linode)', 'mainwp' ); ?></option>
1155 <option <?php echo ( 'Vultr' === $mainwp_3rd_party_api ) ? 'selected' : ''; ?> value="3"><?php esc_html_e( 'Vultr', 'mainwp' ); ?></option>
1156 <option <?php echo ( 'cPanel' === $mainwp_3rd_party_api ) ? 'selected' : ''; ?> value="4"><?php esc_html_e( 'cPanel (WP Toolkit)', 'mainwp' ); ?></option>
1157 <option <?php echo ( 'Plesk' === $mainwp_3rd_party_api ) ? 'selected' : ''; ?> value="5"><?php esc_html_e( 'Plesk (WP Toolkit)', 'mainwp' ); ?></option>
1158 <option <?php echo ( 'Kinsta' === $mainwp_3rd_party_api ) ? 'selected' : ''; ?> value="6"><?php esc_html_e( 'Kinsta', 'mainwp' ); ?></option>
1159 </select>
1160 </div>
1161 </div>
1162 <div class="mainwp_cpanel_menu_container" style="display:none;">
1163 <div class="ui grid field">
1164 <label class="six wide column middle aligned"><?php esc_html_e( 'Enable WP Toolkit API', 'mainwp' ); ?></label>
1165 <div id="enable_wp_toolkit_check" class="ten wide column ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'If enabled, the WP Toolkit API will also be active.', 'mainwp' ); ?>" data-inverted="" data-position="bottom left">
1166 <input type="checkbox" name="mainwp_enable_wp_toolkit" id="mainwp_enable_wp_toolkit" <?php echo 'on' === $mainwp_enable_wp_toolkit ? 'checked="true"' : 'off'; ?> />
1167 </div>
1168 </div>
1169 <div class="ui grid field">
1170 <label class="six wide column middle aligned"><?php esc_html_e( 'Overwrite cPanel Global Settings', 'mainwp' ); ?></label>
1171 <div id="individual_settings_check" class="ten wide column ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'If enabled, the cPanel Individual Settings will be used.', 'mainwp' ); ?>" data-inverted="" data-position="bottom left">
1172 <input type="checkbox" name="mainwp_enable_cpanel_individual" id="mainwp_enable_cpanel_individual" <?php echo 'on' === $mainwp_enable_cpanel_individual ? 'checked="true"' : 'off'; ?> />
1173 </div>
1174 </div>
1175 <div class="mainwp_cpanel_individual_container" style="display:none;">
1176 <div class="ui grid field">
1177 <label class="six wide column middle aligned"><?php esc_html_e( 'cPanel URL', 'mainwp' ); ?></label>
1178 <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Enter the cPanel API URL. eg.: https://yoursite.com:2083', 'mainwp' ); ?>" data-inverted="" data-position="top left">
1179 <div class="ui left labeled input">
1180 <input type="text" id="cpanel_api_url" name="cpanel_api_url" value="<?php echo empty( $mainwp_cpanel_api_url ) ? '' : esc_attr( $mainwp_cpanel_api_url ); ?>" />
1181 </div>
1182 </div>
1183 </div>
1184 <div class="ui grid field">
1185 <label class="six wide column middle aligned"><?php esc_html_e( 'Username', 'mainwp' ); ?></label>
1186 <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Enter the cPanel Account Username.', 'mainwp' ); ?>" data-inverted="" data-position="top left">
1187 <div class="ui left labeled input">
1188 <?php $el_id_int_un_1 = 'mainwp_cpanel_account_username'; ?>
1189 <input type="text" name="mainwp_cpanel_account_username" id="<?php echo esc_attr( $el_id_int_un_1 ); ?>" value="<?php echo empty( $mainwp_cpanel_account_username ) ? '' : esc_attr( $mainwp_cpanel_account_username ); ?>" />
1190 </div>
1191 </div>
1192 </div>
1193 <div class="ui grid field">
1194 <label class="six wide column middle aligned"><?php esc_html_e( 'Password', 'mainwp' ); ?></label>
1195 <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Enter the cPanel Account Password.', 'mainwp' ); ?>" data-inverted="" data-position="top left">
1196 <div class="ui left labeled input">
1197 <input type="password" name="mainwp_cpanel_account_password" id="mainwp_cpanel_account_password" value="<?php echo esc_attr( MainWP_Credential_Render::value_for_input( ! empty( $cpanel_account_password ) ) ); ?>" autocomplete="new-password" /> <?php // phpcs:ignore WordPress.Security.NonceVerification.Missing -- No action performed, just rendering a password field. ?><!-- NOSONAR -->
1198 </div>
1199 </div>
1200 </div>
1201 <div class="ui grid field">
1202 <label class="six wide column middle aligned"><?php esc_html_e( 'Site Path', 'mainwp' ); ?></label>
1203 <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Enter the directory the site is installed. eg.: /public_html/child/', 'mainwp' ); ?>" data-inverted="" data-position="top left">
1204 <div class="ui left labeled input">
1205 <input type="text" id="cpanel_site_path" name="cpanel_site_path" value="<?php echo empty( $mainwp_cpanel_site_path ) ? '' : esc_attr( $mainwp_cpanel_site_path ); ?>" />
1206 </div>
1207 </div>
1208 </div>
1209 </div>
1210 </div>
1211 <div class="mainwp_plesk_menu_container" style="display:none;">
1212 <div class="ui grid field">
1213 <label class="six wide column middle aligned"><?php esc_html_e( 'Installation ID', 'mainwp' ); ?></label>
1214 <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Enter the Plesk Installation ID. eg.: "1"', 'mainwp' ); ?>" data-inverted="" data-position="top left">
1215 <div class="ui left labeled input">
1216 <input type="text" id="plesk_installation_id" name="plesk_installation_id" value="<?php echo empty( $mainwp_plesk_installation_id ) ? '' : esc_html( $mainwp_plesk_installation_id ); ?>" />
1217 </div>
1218 </div>
1219 </div>
1220 <?php $el_id_ind_set_chk_1 = 'individual_settings_check'; ?>
1221 <div class="ui grid field">
1222 <label class="six wide column middle aligned"><?php esc_html_e( 'Overwrite Global Settings', 'mainwp' ); ?></label>
1223 <div id="<?php echo esc_attr( $el_id_ind_set_chk_1 ); ?>" class="ten wide column ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'If enabled, the Plesk (WP Toolkit) Individual Settings will be used.', 'mainwp' ); ?>" data-inverted="" data-position="bottom left">
1224 <input type="checkbox" name="mainwp_enable_plesk_individual" id="mainwp_enable_plesk_individual" <?php echo 'on' === $mainwp_enable_plesk_individual ? 'checked="true"' : 'off'; ?> />
1225 </div>
1226 </div>
1227 <div class="mainwp_plesk_individual_container" style="display:none;">
1228 <div class="ui grid field">
1229 <label class="six wide column middle aligned"><?php esc_html_e( 'Plesk URL', 'mainwp' ); ?></label>
1230 <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'eg.: https://epic-snyder.123-111-123-143.plesk.page:8443', 'mainwp' ); ?>" data-inverted="" data-position="top left">
1231 <div class="ui left labeled input">
1232 <input type="text" id="plesk_api_url" name="plesk_api_url" value="<?php echo empty( $mainwp_plesk_api_url ) ? '' : esc_attr( $mainwp_plesk_api_url ); ?>" />
1233 </div>
1234 </div>
1235 </div>
1236 <div class="ui grid field">
1237 <label class="six wide column middle aligned"><?php esc_html_e( 'API Key', 'mainwp' ); ?></label>
1238 <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Enter the Plesk API Key', 'mainwp' ); ?>" data-inverted="" data-position="top left">
1239 <div class="ui left labeled input">
1240 <?php
1241 $plesk_api_key = Api_Backups_Utility::get_instance()->get_child_api_key( $website, 'plesk' );
1242 ?>
1243 <?php // NOSONAR -- no duplicate id, it in 2 different screens. ?>
1244 <input type="password" name="mainwp_plesk_api_key" id="mainwp_plesk_api_key" value="<?php echo esc_attr( MainWP_Credential_Render::value_for_input( ! empty( $plesk_api_key ) ) ); ?>" autocomplete="new-password" /> <?php // phpcs:ignore WordPress.Security.NonceVerification.Missing -- NOSONAR - No action performed, just rendering a password field. ?>
1245 </div>
1246 </div>
1247 </div>
1248 </div>
1249 </div>
1250 <div class="mainwp_kinsta_menu_container" style="display:none;">
1251 <div class="ui grid field">
1252 <label class="six wide column middle aligned"><?php esc_html_e( 'Environment ID', 'mainwp' ); ?></label>
1253 <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Enter the Kinsta Environment ID.', 'mainwp' ); ?>" data-inverted="" data-position="top left">
1254 <div class="ui left labeled input">
1255 <input type="text" id="kinsta_environment_id" name="kinsta_environment_id" value="<?php echo empty( $mainwp_kinsta_environment_id ) ? '' : esc_html( $mainwp_kinsta_environment_id ); ?>" />
1256 </div>
1257 </div>
1258 </div>
1259 <?php $el_id_ind_set_chk_2 = 'kinsta_individual_settings_check'; ?>
1260 <div class="ui grid field">
1261 <label class="six wide column middle aligned"><?php esc_html_e( 'Overwrite Global Settings', 'mainwp' ); ?></label>
1262 <div id="<?php echo esc_attr( $el_id_ind_set_chk_2 ); ?>" class="ten wide column ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'If enabled, the Kinsta Individual Settings will be used.', 'mainwp' ); ?>" data-inverted="" data-position="bottom left">
1263 <input type="checkbox" name="mainwp_enable_kinsta_individual" id="mainwp_enable_kinsta_individual" <?php echo ( 'on' === $mainwp_enable_kinsta_individual ) ? 'checked="true"' : 'off'; ?> />
1264 </div>
1265 </div>
1266 <div class="mainwp_kinsta_individual_container" style="display:none;">
1267 <div class="ui grid field">
1268 <label class="six wide column middle aligned"><?php esc_html_e( 'Account Email', 'mainwp' ); ?></label>
1269 <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Enter the Kinsta Account Email.', 'mainwp' ); ?>" data-inverted="" data-position="top left">
1270 <div class="ui left labeled input">
1271 <input type="text" id="kinsta_account_email" name="kinsta_account_email" value="<?php echo empty( $mainwp_kinsta_account_email ) ? '' : esc_html( $mainwp_kinsta_account_email ); ?>" />
1272 </div>
1273 </div>
1274 </div>
1275 <div class="ui grid field">
1276 <label class="six wide column middle aligned"><?php esc_html_e( 'Company ID', 'mainwp' ); ?></label>
1277 <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Enter the Kinsta Company ID.', 'mainwp' ); ?>" data-inverted="" data-position="top left">
1278 <div class="ui left labeled input">
1279 <input type="text" id="kinsta_company_id" name="kinsta_company_id" value="<?php echo empty( $mainwp_kinsta_company_id ) ? '' : esc_html( $mainwp_kinsta_company_id ); ?>" />
1280 </div>
1281 </div>
1282 </div>
1283 <div class="ui grid field">
1284 <label class="six wide column middle aligned"><?php esc_html_e( 'API Key', 'mainwp' ); ?></label>
1285 <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Enter the Kinsta API Key', 'mainwp' ); ?>" data-inverted="" data-position="top left">
1286 <div class="ui left labeled input">
1287 <?php
1288 $kinsta_api_key = Api_Backups_Utility::get_instance()->get_child_api_key( $website, 'kinsta' );
1289 ?>
1290 <input type="password" name="mainwp_kinsta_api_key" id="mainwp_kinsta_api_key" value="<?php echo esc_attr( MainWP_Credential_Render::value_for_input( ! empty( $kinsta_api_key ) ) ); ?>" autocomplete="new-password" /> <?php // phpcs:ignore WordPress.Security.NonceVerification.Missing -- no action performed, just rendering a password field. ?><!-- NOSONAR -->
1291 </div>
1292 </div>
1293 </div>
1294 </div>
1295 </div>
1296 <div class="ui hidden divider"></div>
1297 <?php elseif ( 'DigitalOcean' === $mainwp_3rd_party_api || 'Linode' === $mainwp_3rd_party_api || 'Vultr' === $mainwp_3rd_party_api ) : ?>
1298 <div class="ui grid field settings-field-indicator-wrapper">
1299 <label class="six wide column middle aligned">
1300 <?php
1301 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', $mainwp_3rd_party_api );
1302
1303 $el_id_api_bk_prov_sl_1 = 'mainwp_managesites_edit_module_api_backups_provider';
1304 ?>
1305 <?php esc_html_e( 'Choose a provider', 'mainwp' ); ?></label>
1306 <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Detected provider', 'mainwp' ); ?>" data-inverted="" data-position="top left">
1307 <select class="ui dropdown settings-field-value-change-handler" id="<?php echo esc_attr( $el_id_api_bk_prov_sl_1 ); ?>" name="mainwp_managesites_edit_module_api_backups_provider">
1308 <option <?php echo ( '' === $mainwp_3rd_party_api ) ? 'selected' : ''; ?> value="0"><?php esc_html_e( 'None', 'mainwp' ); ?></option>
1309 <option <?php echo ( 'DigitalOcean' === $mainwp_3rd_party_api ) ? 'selected' : ''; ?> value="1"><?php esc_html_e( 'DigitalOcean', 'mainwp' ); ?></option>
1310 <option <?php echo ( 'Linode' === $mainwp_3rd_party_api ) ? 'selected' : ''; ?> value="2"><?php esc_html_e( 'Akamai (Linode)', 'mainwp' ); ?></option>
1311 <option <?php echo ( 'Vultr' === $mainwp_3rd_party_api ) ? 'selected' : ''; ?> value="3"><?php esc_html_e( 'Vultr', 'mainwp' ); ?></option>
1312 <option <?php echo ( 'cPanel' === $mainwp_3rd_party_api ) ? 'selected' : ''; ?> value="4"><?php esc_html_e( 'cPanel (WP Toolkit)', 'mainwp' ); ?></option>
1313 <option <?php echo ( 'Plesk' === $mainwp_3rd_party_api ) ? 'selected' : ''; ?> value="5"><?php esc_html_e( 'Plesk (WP Toolkit)', 'mainwp' ); ?></option>
1314 <option <?php echo ( 'Kinsta' === $mainwp_3rd_party_api ) ? 'selected' : ''; ?> value="6"><?php esc_html_e( 'Kinsta', 'mainwp' ); ?></option>
1315 </select>
1316 </div>
1317 </div>
1318 <?php $instance_id = $mainwp_3rd_party_instance_id; ?>
1319 <div class="ui grid field">
1320 <label class="six wide column middle aligned"><?php esc_html_e( 'Instance ID', 'mainwp' ); ?></label>
1321 <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Enter the Instance ID (Droplet ID). This information is available in your provider account.', 'mainwp' ); ?>" data-inverted="" data-position="top left">
1322 <div class="ui left labeled input">
1323 <input type="text" id="edit_site_module_api_backups_provider_instance_id" name="edit_site_module_api_backups_provider_instance_id" value="<?php echo empty( $instance_id ) ? '' : esc_attr( $instance_id ); ?>" />
1324 </div>
1325 </div>
1326 </div>
1327 <?php elseif ( 'Cloudways' === $mainwp_3rd_party_api ) : ?>
1328 <div class="ui grid field settings-field-indicator-wrapper">
1329 <label class="six wide column middle aligned">
1330 <?php
1331 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', $mainwp_3rd_party_api );
1332 ?>
1333 <?php esc_html_e( 'Choose a provider', 'mainwp' ); ?></label>
1334 <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Detected provider', 'mainwp' ); ?>" data-inverted="" data-position="top left">
1335 <select class="ui disabled dropdown settings-field-value-change-handler">
1336 <option><?php esc_html_e( 'Cloudways', 'mainwp' ); ?></option>
1337 </select>
1338 </div>
1339 </div>
1340 <?php $app_id = $mainwp_3rd_party_cloudways_app_id; ?>
1341 <?php $server_id = $mainwp_3rd_party_cloudways_server_id; ?>
1342 <div class="ui grid field settings-field-indicator-wrapper">
1343 <label class="six wide column middle aligned">
1344 <?php
1345 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', $app_id );
1346 ?>
1347 <?php esc_html_e( 'App ID', 'mainwp' ); ?></label>
1348 <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Detected Cloudways site ID.', 'mainwp' ); ?>" data-inverted="" data-position="top left">
1349 <div class="ui left labeled input">
1350 <input type="text" class="settings-field-value-change-handler" disabled value="<?php echo esc_attr( $app_id ); ?>" />
1351 </div>
1352 </div>
1353 </div>
1354 <div class="ui grid field">
1355 <label class="six wide column middle aligned"><?php esc_html_e( 'Instance ID', 'mainwp' ); ?></label>
1356 <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Detected Cloudways site ID.', 'mainwp' ); ?>" data-inverted="" data-position="top left">
1357 <div class="ui left labeled input">
1358 <input type="text" disabled value="<?php echo esc_attr( $server_id ); ?>" />
1359 </div>
1360 </div>
1361 </div>
1362 <?php elseif ( 'GridPane' === $mainwp_3rd_party_api ) : ?>
1363 <div class="ui grid field settings-field-indicator-wrapper">
1364 <label class="six wide column middle aligned">
1365 <?php
1366 MainWP_Settings_Indicator::render_not_default_indicator( 'none_preset_value', $mainwp_3rd_party_api );
1367 ?>
1368 <?php esc_html_e( 'Choose a provider', 'mainwp' ); ?></label>
1369 <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Detected provider', 'mainwp' ); ?>" data-inverted="" data-position="top left">
1370 <select class="ui disabled dropdown settings-field-value-change-handler">
1371 <option><?php esc_html_e( 'GridPane (Developer or higher)', 'mainwp' ); ?></option>
1372 </select>
1373 </div>
1374 </div>
1375 <?php $instance_id = $mainwp_3rd_party_gridpane_site_id; ?>
1376 <div class="ui grid field">
1377 <label class="six wide column middle aligned"><?php esc_html_e( 'Instance ID', 'mainwp' ); ?></label>
1378 <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Detected GridPane site ID.', 'mainwp' ); ?>" data-inverted="" data-position="top left">
1379 <div class="ui left labeled input">
1380 <input type="text" disabled value="<?php echo esc_attr( $instance_id ); ?>" />
1381 </div>
1382 </div>
1383 </div>
1384 <?php endif; ?>
1385 <script type="text/javascript">
1386 jQuery( document ).ready( function() {
1387
1388 // Check if cPanel or Plesk is selected when page loads.
1389 let dropdown_selection = jQuery("#mainwp_managesites_edit_module_api_backups_provider" ).val();
1390 if ( dropdown_selection === '4' ) {
1391 jQuery('.mainwp_cpanel_menu_container').show();
1392 jQuery('.mainwp_plesk_menu_container').hide();
1393 jQuery('.mainwp_kinsta_menu_container').hide();
1394 } else if ( dropdown_selection === '5' ) {
1395 jQuery('.mainwp_cpanel_menu_container').hide();
1396 jQuery('.mainwp_plesk_menu_container').show();
1397 jQuery('.mainwp_kinsta_menu_container').hide();
1398 } else if ( dropdown_selection === '6' ) {
1399 jQuery('.mainwp_cpanel_menu_container').hide();
1400 jQuery('.mainwp_plesk_menu_container').hide();
1401 jQuery('.mainwp_kinsta_menu_container').show();
1402 } else {
1403 jQuery('.mainwp_cpanel_menu_container').hide();
1404 jQuery('.mainwp_plesk_menu_container').hide();
1405 jQuery('.mainwp_kinsta_menu_container').hide();
1406 }
1407
1408 // Check if cPanel Individual Settings is :checked when page loads.
1409 if ( jQuery( "#mainwp_enable_cpanel_individual" ).is( ":checked" ) ) {
1410 jQuery('.mainwp_cpanel_individual_container').show();
1411 } else if ( jQuery( "#mainwp_enable_plesk_individual" ).is( ":checked" ) ) {
1412 jQuery('.mainwp_plesk_individual_container').show();
1413 } else if ( jQuery( "#mainwp_enable_kinsta_individual" ).is( ":checked" ) ) {
1414 jQuery('.mainwp_kinsta_individual_container').show();
1415 } else {
1416 jQuery('.mainwp_cpanel_individual_container').hide();
1417 jQuery('.mainwp_plesk_individual_container').hide();
1418 jQuery('.mainwp_kinsta_individual_container').hide();
1419 }
1420
1421 // Check which Provider is `selected` when using dropdown & show/hide the appropriate settings.
1422 jQuery( "#mainwp_managesites_edit_module_api_backups_provider" ).on( "change", function() {
1423
1424 let selected = jQuery(this).val();
1425
1426 if ( selected === '4' ) {
1427 jQuery('.mainwp_cpanel_menu_container').show();
1428 jQuery('.mainwp_plesk_menu_container').hide();
1429 jQuery('.mainwp_kinsta_menu_container').hide();
1430 } else if ( selected === '5' ) {
1431 jQuery('.mainwp_cpanel_menu_container').hide();
1432 jQuery('.mainwp_plesk_menu_container').show();
1433 jQuery('.mainwp_kinsta_menu_container').hide();
1434 } else if ( selected === '6' ) {
1435 jQuery('.mainwp_cpanel_menu_container').hide();
1436 jQuery('.mainwp_plesk_menu_container').hide();
1437 jQuery('.mainwp_kinsta_menu_container').show();
1438 } else {
1439 jQuery('.mainwp_cpanel_menu_container').hide();
1440 jQuery('.mainwp_plesk_menu_container').hide();
1441 jQuery('.mainwp_kinsta_menu_container').hide();
1442 }
1443 } );
1444
1445 // Toggle cPanel Individual Settings on/off when clicked.
1446 jQuery( "#mainwp_enable_cpanel_individual" ).on( "change", function() {
1447 jQuery('.mainwp_cpanel_individual_container').toggle();
1448 } );
1449
1450 // Toggle Plesk Individual Settings on/off when clicked.
1451 jQuery( "#mainwp_enable_plesk_individual" ).on( "change", function() {
1452 jQuery('.mainwp_plesk_individual_container').toggle();
1453 } );
1454
1455 // Toggle Plesk Individual Settings on/off when clicked.
1456 jQuery( "#mainwp_enable_kinsta_individual" ).on( "change", function() {
1457 jQuery('.mainwp_kinsta_individual_container').toggle();
1458 } );
1459
1460 } );
1461 </script>
1462 </div>
1463 </div>
1464 <?php
1465 } // [ END: hook_render_mainwp_manage_sites_edit ]
1466 } // [ END: class Api_Backups_Settings ]
1467