| 1 |
<?php |
| 2 |
/** |
| 3 |
* Outputs the restricted content product email field |
| 4 |
* for the subscriber to enter their email address if |
| 5 |
* they've already subscribed to the ConvertKit Product. |
| 6 |
* |
| 7 |
* @package ConvertKit |
| 8 |
* @author ConvertKit |
| 9 |
*/ |
| 10 |
|
| 11 |
// Resource type and ID aren't defined when the Member Content Login block is used. |
| 12 |
$resource_type = ( isset( $resource_type ) ? $resource_type : '' ); |
| 13 |
$resource_id = ( isset( $resource_id ) ? $resource_id : 0 ); |
| 14 |
?> |
| 15 |
<form id="convertkit-restrict-content-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"> |
| 16 |
<div id="convertkit-restrict-content-email-field" class="<?php echo sanitize_html_class( ( is_wp_error( WP_ConvertKit()->get_class( 'output_restrict_content' )->error ) ? 'convertkit-restrict-content-error' : '' ) ); ?>"> |
| 17 |
<input type="email" name="convertkit_email" id="convertkit_email" value="" placeholder="<?php esc_attr_e( 'Email Address', 'convertkit' ); ?>" required /> |
| 18 |
<?php |
| 19 |
// Output the submit button. If a spam protection provider is active |
| 20 |
// it renders the button plus any accompanying widget div; otherwise a |
| 21 |
// plain submit button is output. |
| 22 |
$spam = new ConvertKit_Spam_Protection(); |
| 23 |
$spam_provider = $spam->get_active_provider(); |
| 24 |
if ( $spam_provider !== false ) { |
| 25 |
echo $spam_provider->get_submit_button_html( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 26 |
WP_ConvertKit()->get_class( 'output_restrict_content' )->restrict_content_settings->get_by_key( 'email_button_label' ), |
| 27 |
'convertkit_member_content_login', |
| 28 |
array( 'wp-block-button__link', 'wp-block-button__link' ) |
| 29 |
); |
| 30 |
} else { |
| 31 |
?> |
| 32 |
<input type="submit" class="wp-block-button__link wp-block-button__link" value="<?php echo esc_attr( WP_ConvertKit()->get_class( 'output_restrict_content' )->restrict_content_settings->get_by_key( 'email_button_label' ) ); ?>" /> |
| 33 |
<?php |
| 34 |
} |
| 35 |
?> |
| 36 |
<input type="hidden" name="convertkit_resource_type" value="<?php echo esc_attr( $resource_type ); ?>" /> |
| 37 |
<input type="hidden" name="convertkit_resource_id" value="<?php echo esc_attr( $resource_id ); ?>" /> |
| 38 |
<input type="hidden" name="convertkit_post_id" value="<?php echo esc_attr( $post_id ); ?>" /> |
| 39 |
<?php wp_nonce_field( 'convertkit_restrict_content_login' ); ?> |
| 40 |
</div> |
| 41 |
</form> |
| 42 |
|
| 43 |
<?php |
| 44 |
// Output notices. |
| 45 |
require 'notices.php'; |
| 46 |
?> |
| 47 |
|
| 48 |
<small><?php echo esc_html( WP_ConvertKit()->get_class( 'output_restrict_content' )->restrict_content_settings->get_by_key( 'email_description_text' ) ); ?></small> |
| 49 |
|