| 1 | <?php |
|---|
| 2 | declare( strict_types = 1 ); |
|---|
| 3 | |
|---|
| 4 | //phpcs:disable VariableAnalysis |
|---|
| 5 | // There are "undefined" variables here because they're defined in the code that includes this file as a template. |
|---|
| 6 | |
|---|
| 7 | $user_status = $akismet_user->status ?? null; |
|---|
| 8 | ?> |
|---|
| 9 | <div class="akismet-setup__connection"> |
|---|
| 10 | <?php if ( ! empty( $akismet_user->user_email ) && ! empty( $akismet_user->user_login ) ) : ?> |
|---|
| 11 | <div class="akismet-setup__connection-user"> |
|---|
| 12 | <div class="akismet-setup__connection-avatar"> |
|---|
| 13 | <?php |
|---|
| 14 | // Decorative avatar; empty alt for screen readers. |
|---|
| 15 | echo get_avatar( |
|---|
| 16 | $akismet_user->user_email, |
|---|
| 17 | 48, |
|---|
| 18 | '', |
|---|
| 19 | '', |
|---|
| 20 | array( |
|---|
| 21 | 'class' => 'akismet-setup__connection-avatar-image', |
|---|
| 22 | 'alt' => '', |
|---|
| 23 | ) |
|---|
| 24 | ); |
|---|
| 25 | ?> |
|---|
| 26 | <div class="akismet-setup__connection-account"> |
|---|
| 27 | <div class="akismet-setup__connection-account-name"> |
|---|
| 28 | <?php |
|---|
| 29 | printf( |
|---|
| 30 | /* translators: %s is the WordPress.com username */ |
|---|
| 31 | esc_html__( 'Signed in as %s', 'akismet' ), |
|---|
| 32 | '<strong>' . esc_html( $akismet_user->user_login ) . '</strong>' |
|---|
| 33 | ); |
|---|
| 34 | ?> |
|---|
| 35 | </div> |
|---|
| 36 | <div class="akismet-setup__connection-account-email"><?php echo esc_html( $akismet_user->user_email ); ?></div> |
|---|
| 37 | </div> |
|---|
| 38 | </div> |
|---|
| 39 | </div> |
|---|
| 40 | <?php endif; ?> |
|---|
| 41 | <div class="akismet-setup__connection-action"> |
|---|
| 42 | <?php if ( in_array( $user_status, array( Akismet::USER_STATUS_CANCELLED, Akismet::USER_STATUS_MISSING, Akismet::USER_STATUS_NO_SUB ) ) ) : ?> |
|---|
| 43 | |
|---|
| 44 | <p class="akismet-setup__connection-action-intro"> |
|---|
| 45 | <?php esc_html_e( "Your Jetpack account is connected, but it doesn't have an active Akismet subscription yet. To continue, please choose a plan on Akismet.com.", 'akismet' ); ?> |
|---|
| 46 | </p> |
|---|
| 47 | |
|---|
| 48 | <a href="https://akismet.com/get?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=jetpack_flow_<?php echo esc_attr( str_replace( '-', '_', $user_status ) ); ?>" class="akismet-setup__connection-button akismet-button"> |
|---|
| 49 | <?php esc_html_e( 'Choose a plan on Akismet.com', 'akismet' ); ?> |
|---|
| 50 | </a> |
|---|
| 51 | |
|---|
| 52 | <p class="akismet-setup__connection-action-description"> |
|---|
| 53 | <?php esc_html_e( "Once you've chosen a plan, return here to complete your setup.", 'akismet' ); ?> |
|---|
| 54 | </p> |
|---|
| 55 | |
|---|
| 56 | <?php elseif ( $user_status === Akismet::USER_STATUS_SUSPENDED ) : ?> |
|---|
| 57 | <p class="akismet-setup__connection-action-intro"> |
|---|
| 58 | <?php esc_html_e( "Your Akismet account appears to be suspended. This sometimes happens if there's a billing or verification issue. Please contact our support team so we can help you get it sorted.", 'akismet' ); ?> |
|---|
| 59 | </p> |
|---|
| 60 | |
|---|
| 61 | <a href="https://akismet.com/contact?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=jetpack_flow_suspended" class="akismet-setup__connection-button akismet-button"> |
|---|
| 62 | <?php esc_html_e( 'Contact support', 'akismet' ); ?> |
|---|
| 63 | </a> |
|---|
| 64 | <?php else : ?> |
|---|
| 65 | <form name="akismet_use_wpcom_key" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-activate"> |
|---|
| 66 | <input type="hidden" name="key" value="<?php echo esc_attr( $akismet_user->api_key ); ?>"/> |
|---|
| 67 | <input type="hidden" name="action" value="enter-key"> |
|---|
| 68 | <?php wp_nonce_field( Akismet_Admin::NONCE ); ?> |
|---|
| 69 | <input type="submit" class="akismet-setup__connection-button akismet-button" value="<?php esc_attr_e( 'Connect with Jetpack', 'akismet' ); ?>"/> |
|---|
| 70 | </form> |
|---|
| 71 | |
|---|
| 72 | <p class="akismet-setup__connection-action-description"> |
|---|
| 73 | <?php esc_html_e( "By connecting, we'll use your Jetpack account to activate Akismet on this site.", 'akismet' ); ?> |
|---|
| 74 | </p> |
|---|
| 75 | <?php endif; ?> |
|---|
| 76 | |
|---|
| 77 | <?php if ( ! in_array( $user_status, array( Akismet::USER_STATUS_CANCELLED, Akismet::USER_STATUS_MISSING, Akismet::USER_STATUS_NO_SUB ) ) ) : ?> |
|---|
| 78 | <p class="akismet-setup__connection-action-description"> |
|---|
| 79 | <?php |
|---|
| 80 | echo wp_kses( |
|---|
| 81 | sprintf( |
|---|
| 82 | /* translators: The placeholder is a URL. */ |
|---|
| 83 | __( 'Want to use a different account? <a href="%s" class="akismet-external-link">Visit akismet.com</a> to set it up and get your API key.', 'akismet' ), |
|---|
| 84 | esc_url( 'https://akismet.com/get?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=jetpack_flow_different_account' ) |
|---|
| 85 | ), |
|---|
| 86 | array( |
|---|
| 87 | 'a' => array( |
|---|
| 88 | 'href' => array(), |
|---|
| 89 | 'class' => array(), |
|---|
| 90 | ), |
|---|
| 91 | ) |
|---|
| 92 | ); |
|---|
| 93 | ?> |
|---|
| 94 | </p> |
|---|
| 95 | <?php endif; ?> |
|---|
| 96 | </div> |
|---|
| 97 | </div> |
|---|