connect-jp.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. //phpcs:disable VariableAnalysis
  3. // There are "undefined" variables here because they're defined in the code that includes this file as a template.
  4. ?>
  5. <div class="akismet-box">
  6. <?php Akismet::view( 'title' ); ?>
  7. <div class="akismet-jp-connect">
  8. <h3><?php esc_html_e( 'Connect with Jetpack', 'akismet' ); ?></h3><?php
  9. if ( in_array( $akismet_user->status, array( 'no-sub', 'missing' ) ) ) {?>
  10. <p><?php esc_html_e( 'Use your Jetpack connection to set up Akismet.', 'akismet' ); ?></p>
  11. <form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="akismet-right" target="_blank">
  12. <input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
  13. <input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
  14. <input type="hidden" name="auto-connect" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/>
  15. <input type="hidden" name="redirect" value="plugin-signup"/>
  16. <input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/>
  17. </form>
  18. <?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>
  19. <p><?php
  20. /* translators: %s is the WordPress.com username */
  21. echo sprintf( esc_html( __( 'You are connected as %s.', 'akismet' ) ), '<b>' . esc_html( $akismet_user->user_login ) . '</b>' ); ?><br /><span class="akismet-jetpack-email"><?php echo esc_html( $akismet_user->user_email ); ?></span></p>
  22. <?php } elseif ( $akismet_user->status == 'cancelled' ) { ?>
  23. <p><?php esc_html_e( 'Use your Jetpack connection to set up Akismet.', 'akismet' ); ?></p>
  24. <form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="akismet-right" target="_blank">
  25. <input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
  26. <input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
  27. <input type="hidden" name="user_id" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/>
  28. <input type="hidden" name="redirect" value="upgrade"/>
  29. <input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/>
  30. </form>
  31. <?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>
  32. <p><?php
  33. /* translators: %s is the WordPress.com email address */
  34. echo esc_html( sprintf( __( 'Your subscription for %s is cancelled.' , 'akismet' ), $akismet_user->user_email ) ); ?><br /><span class="akismet-jetpack-email"><?php echo esc_html( $akismet_user->user_email ); ?></span></p>
  35. <?php } elseif ( $akismet_user->status == 'suspended' ) { ?>
  36. <div class="akismet-right">
  37. <p><a href="https://akismet.com/contact" class="akismet-button akismet-is-primary"><?php esc_html_e( 'Contact Akismet support' , 'akismet' ); ?></a></p>
  38. </div>
  39. <p>
  40. <span class="akismet-alert-text"><?php
  41. /* translators: %s is the WordPress.com email address */
  42. echo esc_html( sprintf( __( 'Your subscription for %s is suspended.' , 'akismet' ), $akismet_user->user_email ) ); ?></span>
  43. <?php esc_html_e( 'No worries! Get in touch and we&#8217;ll sort this out.', 'akismet' ); ?>
  44. </p>
  45. <?php } else { // ask do they want to use akismet account found using jetpack wpcom connection ?>
  46. <p><?php esc_html_e( 'Use your Jetpack connection to set up Akismet.', 'akismet' ); ?></p>
  47. <form name="akismet_use_wpcom_key" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-activate" class="akismet-right">
  48. <input type="hidden" name="key" value="<?php echo esc_attr( $akismet_user->api_key );?>"/>
  49. <input type="hidden" name="action" value="enter-key">
  50. <?php wp_nonce_field( Akismet_Admin::NONCE ) ?>
  51. <input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/>
  52. </form>
  53. <?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>
  54. <p><?php
  55. /* translators: %s is the WordPress.com username */
  56. echo sprintf( esc_html( __( 'You are connected as %s.', 'akismet' ) ), '<b>' . esc_html( $akismet_user->user_login ) . '</b>' ); ?><br /><span class="akismet-jetpack-email"><?php echo esc_html( $akismet_user->user_email ); ?></span></p>
  57. <?php } ?>
  58. </div>
  59. <div class="akismet-ak-connect">
  60. <?php Akismet::view( 'setup' );?>
  61. </div>
  62. <div class="centered akismet-toggles">
  63. <a href="#" class="toggle-jp-connect"><?php esc_html_e( 'Connect with Jetpack' ); ?></a>
  64. <a href="#" class="toggle-ak-connect"><?php esc_html_e( 'Set up a different account' ); ?></a>
  65. </div>
  66. </div>
  67. <br/>
  68. <div class="akismet-box">
  69. <?php Akismet::view( 'enter' );?>
  70. </div>