| @@ -7,13 +7,33 @@ | ||
| 7 | 7 | * @package ConvertKit |
| 8 | 8 | * @author ConvertKit |
| 9 | 9 | */ |
| 10 | 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 ); | |
| 11 | 14 | ?> |
| 12 | 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"> |
| 13 | 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' : '' ) ); ?>"> |
| 14 | 17 | <input type="email" name="convertkit_email" id="convertkit_email" value="" placeholder="<?php esc_attr_e( 'Email Address', 'convertkit' ); ?>" required /> |
| 15 | - <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' ) ); ?>" /> | |
| 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 | + ?> | |
| 16 | 36 | <input type="hidden" name="convertkit_resource_type" value="<?php echo esc_attr( $resource_type ); ?>" /> |
| 17 | 37 | <input type="hidden" name="convertkit_resource_id" value="<?php echo esc_attr( $resource_id ); ?>" /> |
| 18 | 38 | <input type="hidden" name="convertkit_post_id" value="<?php echo esc_attr( $post_id ); ?>" /> |
| 19 | 39 | <?php wp_nonce_field( 'convertkit_restrict_content_login' ); ?> |
| @@ -24,5 +44,5 @@ | ||
| 24 | 44 | // Output notices. |
| 25 | 45 | require 'notices.php'; |
| 26 | 46 | ?> |
| 27 | 47 | |
| 28 | -<small><?php echo esc_html( WP_ConvertKit()->get_class( 'output_restrict_content' )->restrict_content_settings->get_by_key( 'email_description_text' ) ); ?></small> | |
| 48 | +<small><?php echo esc_html( WP_ConvertKit()->get_class( 'output_restrict_content' )->restrict_content_settings->get_by_key( 'email_description_text' ) ); ?></small> | |