email-copy.php
112 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Email copy section under the "unsubscribe" tab. |
| 4 | * |
| 5 | * @package Hustle |
| 6 | * @since 4.0.0 |
| 7 | */ |
| 8 | |
| 9 | ob_start(); |
| 10 | |
| 11 | require Opt_In::$plugin_path . 'assets/css/sui-editor.min.css'; |
| 12 | $editor_css = ob_get_clean(); |
| 13 | $editor_css = '<style>' . $editor_css . '</style>'; |
| 14 | $email_enabled = isset( $email['enabled'] ) && '0' !== (string) $email['enabled']; |
| 15 | $email_subject = isset( $email['email_subject'] ) ? $email['email_subject'] : ''; |
| 16 | $email_body = isset( $email['email_body'] ) ? $email['email_body'] : ''; |
| 17 | ?> |
| 18 | |
| 19 | <div class="sui-box-settings-row"> |
| 20 | |
| 21 | <div class="sui-box-settings-col-1"> |
| 22 | <span class="sui-settings-label"><?php esc_html_e( 'Unsubscribe Email Copy', 'hustle' ); ?></span> |
| 23 | <span class="sui-description"><?php esc_html_e( 'Customize the copy of the email that will be received by the visitors with the unsubscribe link.', 'hustle' ); ?></span> |
| 24 | </div> |
| 25 | |
| 26 | <div class="sui-box-settings-col-2"> |
| 27 | |
| 28 | <div class="sui-form-field"> |
| 29 | |
| 30 | <label for="hustle-unsub-edit-email" class="sui-toggle hustle-toggle-with-container" data-toggle-on="unsub-email"> |
| 31 | |
| 32 | <input |
| 33 | type="checkbox" |
| 34 | name="email_enabled" |
| 35 | value="1" |
| 36 | id="hustle-unsub-edit-email" |
| 37 | aria-labelledby="hustle-unsub-edit-email-label" |
| 38 | <?php checked( $email_enabled ); ?> |
| 39 | > |
| 40 | |
| 41 | <span class="sui-toggle-slider" aria-hidden="true"></span> |
| 42 | |
| 43 | <span id="hustle-unsub-edit-email-label" class="sui-toggle-label"><?php esc_html_e( 'Enable custom email copy', 'hustle' ); ?></span> |
| 44 | |
| 45 | </label> |
| 46 | |
| 47 | <div class="sui-border-frame sui-toggle-content" data-toggle-content="unsub-email" style="display: none;"> |
| 48 | |
| 49 | <!-- Email subject --> |
| 50 | <div class="sui-form-field"> |
| 51 | |
| 52 | <?php |
| 53 | $email_subject = array( |
| 54 | 'email_subject_label' => array( |
| 55 | 'id' => 'email-subject-label', |
| 56 | 'for' => 'email-subject', |
| 57 | 'type' => 'label', |
| 58 | 'value' => __( 'Email subject', 'hustle' ), |
| 59 | ), |
| 60 | 'email_subject' => array( |
| 61 | 'id' => 'email-subject', |
| 62 | 'name' => 'email_subject', |
| 63 | 'value' => $email_subject, |
| 64 | 'placeholder' => '', |
| 65 | 'type' => 'text', |
| 66 | ), |
| 67 | ); |
| 68 | |
| 69 | foreach ( $email_subject as $key => $option ) { |
| 70 | $this->render( 'general/option', $option ); |
| 71 | } |
| 72 | ?> |
| 73 | |
| 74 | </div> |
| 75 | |
| 76 | <!-- Email body --> |
| 77 | <div class="sui-form-field"> |
| 78 | |
| 79 | <label class="sui-label sui-label-editor" for="emailmessage"><?php esc_html_e( 'Email body', 'hustle' ); ?></label> |
| 80 | |
| 81 | <?php |
| 82 | wp_editor( |
| 83 | $email_body, |
| 84 | 'emailmessage', |
| 85 | array( |
| 86 | 'media_buttons' => false, |
| 87 | 'textarea_name' => 'email_message', |
| 88 | 'editor_css' => $editor_css, |
| 89 | 'tinymce' => array( |
| 90 | 'content_css' => self::$plugin_url . 'assets/css/sui-editor.min.css', |
| 91 | ), |
| 92 | 'editor_height' => 192, |
| 93 | 'drag_drop_upload' => false, |
| 94 | ) |
| 95 | ); |
| 96 | ?> |
| 97 | |
| 98 | <span class="sui-description"> |
| 99 | <?php /* translators: placeholder between 'strong' tags */ ?> |
| 100 | <?php printf( esc_html__( 'Use the placeholder %s to insert the unsubscription link.', 'hustle' ), '<strong>{hustle_unsubscribe_link}</strong>' ); ?> |
| 101 | </span> |
| 102 | |
| 103 | </div> |
| 104 | |
| 105 | </div> |
| 106 | |
| 107 | </div> |
| 108 | |
| 109 | </div> |
| 110 | |
| 111 | </div> |
| 112 |