
<?php
    if ( ! defined( 'ABSPATH' ) ) exit;
    $status = isset($_GET['status'])
    && isset($_GET['_wpnonce'])
    && wp_verify_nonce(wp_kses(wp_unslash($_GET['_wpnonce']), []), 'connected_site_redirect')
        ? wp_kses(wp_unslash($_GET['status']), [])
        : '';
?>

<div class="wrap">

    <div id="transferitoConnectedSiteScreen" class="transferito__one-column transferito__one-column-container transferito__one-column-container--no-width transferito__one-column-container--no-height">

        <?php if ($status == 'completed') : ?>
            <div id="connectedSiteCompletionMessage" class="notice notice-success connection-check-result is-dismissible">
                <p>The connected site has been added!</p>
            </div>
        <?php endif; ?>

        <?php if ($status == 'failed' ) : ?>
            <div id="connectedSiteFailureMessage" class="notice notice-error connection-check-result is-dismissible">
                <p>The connected site has not been added!</p>
            </div>
        <?php endif; ?>

        <div class="transferito__container">
            <div class="transferito-text__h1">Transferito Connected Sites</div>

            <form class="transferito-connected-sites_form" method="post" action="<?php echo esc_html(admin_url( 'admin-post.php' )); ?>">
                <input type="hidden" name="action" value="transferito_add_connected_site">
                <?php wp_nonce_field( 'add_connected_site_nonce', 'connected_site_nonce' ); ?>

                <div class="transferito-ftp-authentication__title transferito-text__p1--bold">URL</div>
                <div class="transferito-ftp-authentication__input">
                    <input type="text"
                       name="connected_site_url"
                       id="connectedSite__Url"
                       class="transferito-input__text-box transferito-form-element transferito-input__text-box--full-width transferito-input__text-box--max-width-800 transferito-input__text-box--thin">
                </div>

                <div class="transferito-ftp-authentication__title transferito-text__p1--bold">Filename</div>
                <div class="transferito-ftp-authentication__input">
                    <input type="text"
                       name="connected_site_filename"
                       id="connectedSite__Filename"
                       class="transferito-input__text-box transferito-form-element transferito-input__text-box--full-width transferito-input__text-box--max-width-800 transferito-input__text-box--thin">
                </div>

                <div class="transferito-ftp-authentication__title transferito-text__p1--bold">Token</div>
                <div class="transferito-ftp-authentication__input">
                    <input type="text"
                       name="connected_site_token"
                       id="connectedSite__Token"
                       class="transferito-input__text-box transferito-form-element transferito-input__text-box--full-width transferito-input__text-box--max-width-800 transferito-input__text-box--thin">
                </div>


                <div class="transfer-button-container">
                    <?php submit_button(
                    'Add Connected Site',
                    'transferito-button button-primary button-large',
                        'addConnectedSite',
                    ); ?>
                </div>
            </form>
        </div>

    </div>

</div>

