| 1 |
<?php |
| 2 |
/** |
| 3 |
* Outputs the restricted content tag message, |
| 4 |
* and a form for the subscriber to enter their |
| 5 |
* email address to subscribe to the tag, granting |
| 6 |
* them access. |
| 7 |
* |
| 8 |
* @package ConvertKit |
| 9 |
* @author ConvertKit |
| 10 |
*/ |
| 11 |
|
| 12 |
?> |
| 13 |
|
| 14 |
<div id="convertkit-restrict-content"> |
| 15 |
<div class="convertkit-restrict-content-actions"> |
| 16 |
<?php |
| 17 |
require 'header.php'; |
| 18 |
?> |
| 19 |
|
| 20 |
<form class="convertkit-restrict-content-form" action="<?php echo esc_attr( add_query_arg( array( 'convertkit_login' => 1 ), get_permalink( $post_id ) ) ); ?>#convertkit-restrict-content" method="post"> |
| 21 |
<div id="convertkit-restrict-content-email-field" class="<?php echo sanitize_html_class( ( is_wp_error( $this->error ) ? 'convertkit-restrict-content-error' : '' ) ); ?>"> |
| 22 |
<input type="email" name="convertkit_email" id="convertkit_email" value="" placeholder="<?php esc_attr_e( 'Email Address', 'convertkit' ); ?>" required /> |
| 23 |
<?php |
| 24 |
// Output the submit button. If a spam protection provider is active |
| 25 |
// it renders the button plus any accompanying widget div; otherwise a |
| 26 |
// plain submit button is output. |
| 27 |
$spam = new ConvertKit_Spam_Protection(); |
| 28 |
$spam_provider = $spam->get_active_provider(); |
| 29 |
if ( $spam_provider !== false ) { |
| 30 |
echo $spam_provider->get_submit_button_html( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 31 |
$this->restrict_content_settings->get_by_key( 'subscribe_button_label' ), |
| 32 |
'convertkit_restrict_content_tag', |
| 33 |
array( 'wp-block-button__link', 'wp-block-button__link' ) |
| 34 |
); |
| 35 |
} else { |
| 36 |
?> |
| 37 |
<input type="submit" class="wp-block-button__link wp-block-button__link" value="<?php echo esc_attr( $this->restrict_content_settings->get_by_key( 'subscribe_button_label' ) ); ?>" /> |
| 38 |
<?php |
| 39 |
} |
| 40 |
?> |
| 41 |
<input type="hidden" name="convertkit_resource_type" value="<?php echo esc_attr( $this->resource_type ); ?>" /> |
| 42 |
<input type="hidden" name="convertkit_resource_id" value="<?php echo esc_attr( $this->resource_id ); ?>" /> |
| 43 |
<input type="hidden" name="convertkit_post_id" value="<?php echo esc_attr( $this->post_id ); ?>" /> |
| 44 |
<?php wp_nonce_field( 'convertkit_restrict_content_login' ); ?> |
| 45 |
</div> |
| 46 |
</form> |
| 47 |
|
| 48 |
<?php |
| 49 |
// Output a login link or form if scripts are enabled. Login is always |
| 50 |
// required for tag-restricted content, matching form/product behaviour. |
| 51 |
if ( ! $this->settings->scripts_disabled() ) { |
| 52 |
require 'login.php'; |
| 53 |
} |
| 54 |
|
| 55 |
// Output notices. |
| 56 |
require 'notices.php'; |
| 57 |
?> |
| 58 |
</div> |
| 59 |
</div> |
| 60 |
|