public function alert_auto_ssl_fail()
{
if (!current_user_can('manage_options')) {
return;
}
$ajax_nonce = wp_create_nonce('recheck-ssl');
?>
<div id="jetpack-ssl-warning" class="error jp-identity-crisis">
<div class="jp-banner__content">
<h2><?php
_e('Outbound HTTPS not working', 'jetpack');
?>
</h2>
<p><?php
_e('Your site could not connect to WordPress.com via HTTPS. This could be due to any number of reasons, including faulty SSL certificates, misconfigured or missing SSL libraries, or network issues.', 'jetpack');
?>
</p>
<p>
<?php
_e('Jetpack will re-test for HTTPS support once a day, but you can click here to try again immediately: ', 'jetpack');
?>
<a href="#" id="jetpack-recheck-ssl-button"><?php
_e('Try again', 'jetpack');
?>
</a>
<span id="jetpack-recheck-ssl-output"><?php
echo get_transient('jetpack_https_test_message');
?>
</span>
</p>
<p>
<?php
printf(__('For more help, try our <a href="%1$s">connection debugger</a> or <a href="%2$s" target="_blank">troubleshooting tips</a>.', 'jetpack'), esc_url(Jetpack::admin_url(array('page' => 'jetpack-debugger'))), esc_url('https://jetpack.com/support/getting-started-with-jetpack/troubleshooting-tips/'));
?>
</p>
</div>
</div>
<style>
#jetpack-recheck-ssl-output { margin-left: 5px; color: red; }
</style>
<script type="text/javascript">
jQuery( document ).ready( function( $ ) {
$( '#jetpack-recheck-ssl-button' ).click( function( e ) {
var $this = $( this );
$this.html( <?php
echo json_encode(__('Checking', 'jetpack'));
?>
);
$( '#jetpack-recheck-ssl-output' ).html( '' );
e.preventDefault();
var data = { action: 'jetpack-recheck-ssl', 'ajax-nonce': '<?php
echo $ajax_nonce;
?>
' };
$.post( ajaxurl, data )
.done( function( response ) {
if ( response.enabled ) {
$( '#jetpack-ssl-warning' ).hide();
} else {
this.html( <?php
echo json_encode(__('Try again', 'jetpack'));
?>
);
$( '#jetpack-recheck-ssl-output' ).html( 'SSL Failed: ' + response.message );
}
}.bind( $this ) );
} );
} );
</script>
<?php
}