email-from.php
1 year ago
email-to.php
1 year ago
email.php
1 year ago
form.php
1 year ago
recipient.php
1 year ago
form.php
252 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Form Settings |
| 4 | * |
| 5 | * @since 1.13 |
| 6 | */ |
| 7 | |
| 8 | $pages_list = wpmtst_get_pages(); |
| 9 | $form_options = get_option( 'wpmtst_form_options' ); |
| 10 | |
| 11 | ?> |
| 12 | <input type="hidden" |
| 13 | name="wpmtst_form_options[default_recipient]" |
| 14 | value="<?php echo esc_attr( htmlentities( serialize( $form_options['default_recipient'] ) ) ); ?>"> |
| 15 | |
| 16 | <?php |
| 17 | /** |
| 18 | * ======================================== |
| 19 | * Labels & Messages |
| 20 | * ======================================== |
| 21 | */ |
| 22 | |
| 23 | ?> |
| 24 | <h2><?php esc_html_e( 'Form Labels & Messages', 'strong-testimonials' ); ?></h2> |
| 25 | |
| 26 | <?php do_action( 'wpmtst_before_form_settings', 'form-messages' ); ?> |
| 27 | |
| 28 | <table class="form-table compact" cellpadding="0" cellspacing="0"> |
| 29 | <?php |
| 30 | $messages = $form_options['messages']; |
| 31 | foreach ( $messages as $key => $message ) : |
| 32 | $required = isset( $message['required'] ) ? $message['required'] : true; |
| 33 | $description = isset( $message['description'] ) ? $message['description'] : __( 'description', 'strong-testimonials' ); |
| 34 | |
| 35 | $elid = str_replace( '-', '_', $key ); |
| 36 | // $string, $context, $name |
| 37 | $content = apply_filters( 'wpmtst_l10n', $message['text'], 'strong-testimonials-form-messages', $message['description'] ); |
| 38 | ?> |
| 39 | |
| 40 | <tr> |
| 41 | <th scope="row"> |
| 42 | <label for="<?php echo esc_attr( $elid ); ?>"> |
| 43 | <?php echo esc_html( $description ); ?> |
| 44 | </label> |
| 45 | <input type="hidden" name="wpmtst_form_options[messages][<?php echo esc_attr( $key ); ?>][description]" |
| 46 | value="<?php echo esc_attr( $message['description'] ); ?>"/> |
| 47 | </th> |
| 48 | <td> |
| 49 | <?php if ( 'submission_success' === $elid ) : ?> |
| 50 | <?php |
| 51 | $settings = array( |
| 52 | 'textarea_name' => "wpmtst_form_options[messages][$key][text]", |
| 53 | 'textarea_rows' => 10, |
| 54 | 'quicktags' => false, |
| 55 | ); |
| 56 | wp_editor( $content, $elid, $settings ); |
| 57 | ?> |
| 58 | <?php else : ?> |
| 59 | <?php if ( 'required_field' === $elid ) : ?> |
| 60 | <fieldset> |
| 61 | <label> |
| 62 | <input type="checkbox" |
| 63 | name="wpmtst_form_options[messages][<?php echo esc_attr( $key ); ?>][enabled]" |
| 64 | <?php checked( $message['enabled'] ); ?>> |
| 65 | <?php esc_html_e( 'Display required notice at top of form', 'strong-testimonials' ); ?> |
| 66 | </label> |
| 67 | </fieldset> |
| 68 | <?php endif; ?> |
| 69 | <input type="text" id="<?php echo esc_attr( $elid ); ?>" |
| 70 | name="wpmtst_form_options[messages][<?php echo esc_attr( $key ); ?>][text]" |
| 71 | value="<?php echo esc_attr( $content ); ?>" |
| 72 | <?php echo $required ? 'required' : ''; ?>/> |
| 73 | <?php endif; ?> |
| 74 | </td> |
| 75 | <td class="actions"> |
| 76 | <input type="button" class="button secondary restore-default-message" |
| 77 | value="<?php echo esc_html_x( 'restore default', 'singular', 'strong-testimonials' ); ?>" |
| 78 | data-target-id="<?php echo esc_attr( $elid ); ?>"/> |
| 79 | </td> |
| 80 | </tr> |
| 81 | |
| 82 | <?php endforeach; ?> |
| 83 | |
| 84 | <tr> |
| 85 | <td colspan="3"> |
| 86 | <input type="button" id="restore-default-messages" class="button" |
| 87 | name="restore-default-messages" |
| 88 | value="<?php esc_html_e( 'Restore Default Messages', 'strong-testimonials' ); ?>"/> |
| 89 | </td> |
| 90 | </tr> |
| 91 | </table> |
| 92 | |
| 93 | <table class="form-table" cellpadding="0" cellspacing="0"> |
| 94 | <tr> |
| 95 | <th scope="row" class="tall"> |
| 96 | <?php esc_html_e( 'Scroll', 'strong-testimonials' ); ?> |
| 97 | </th> |
| 98 | <td> |
| 99 | <fieldset> |
| 100 | <div> |
| 101 | <label> |
| 102 | <input type="checkbox" |
| 103 | name="wpmtst_form_options[scrolltop_error]" <?php checked( $form_options['scrolltop_error'] ); ?>/> |
| 104 | <?php |
| 105 | // translators: %s is a HTML input element for the scrolltop error offset value |
| 106 | printf( esc_html__( 'If errors, scroll to the first error minus %s pixels. On by default.', 'strong-testimonials' ), '<input type="text" name="wpmtst_form_options[scrolltop_error_offset]" value="' . esc_attr( $form_options['scrolltop_error_offset'] ) . '" size="3">' ); |
| 107 | ?> |
| 108 | </label> |
| 109 | </div> |
| 110 | <div> |
| 111 | <label class="block"> |
| 112 | <input type="checkbox" |
| 113 | name="wpmtst_form_options[scrolltop_success]" <?php checked( $form_options['scrolltop_success'] ); ?>/> |
| 114 | <?php |
| 115 | // translators: %s is a HTML input element for the scrolltop error offset value |
| 116 | printf( esc_html__( 'If success, scroll to the success message minus %s pixels. On by default.', 'strong-testimonials' ), '<input type="text" name="wpmtst_form_options[scrolltop_success_offset]" value="' . esc_attr( $form_options['scrolltop_success_offset'] ) . '" size="3">' ); |
| 117 | ?> |
| 118 | </label> |
| 119 | </div> |
| 120 | </fieldset> |
| 121 | </td> |
| 122 | </tr> |
| 123 | </table> |
| 124 | |
| 125 | <?php |
| 126 | /** |
| 127 | * ======================================== |
| 128 | * Actions |
| 129 | * ======================================== |
| 130 | */ |
| 131 | |
| 132 | ?> |
| 133 | <hr> |
| 134 | <h3><?php esc_html_e( 'Form Actions', 'strong-testimonials' ); ?></h3> |
| 135 | |
| 136 | <table class="form-table" cellpadding="0" cellspacing="0"> |
| 137 | |
| 138 | <?php do_action( 'wpmtst_before_form_actions', $form_options ); ?> |
| 139 | |
| 140 | <tr> |
| 141 | <th scope="row"> |
| 142 | <label for="redirect-page"> |
| 143 | <?php esc_html_e( 'Upon Successful Submission', 'strong-testimonials' ); ?> |
| 144 | <div class="wpmtst-tooltip"><span>[?]</span> |
| 145 | <div class="wpmtst-tooltip-content"><?php esc_html_e( 'This setting is overwritten by "Submit form without reloading the page (Ajax)" setting found in Form view in the "Views" section.', 'strong-testimonials' ); ?></div> |
| 146 | </div> |
| 147 | </label> |
| 148 | </th> |
| 149 | <td> |
| 150 | <div> |
| 151 | <label class="success-action"> |
| 152 | <input type="radio" name="wpmtst_form_options[success_action]" value="message" <?php checked( 'message', $form_options['success_action'] ); ?>/> <?php esc_html_e( 'display message', 'strong-testimonials' ); ?> |
| 153 | </label> |
| 154 | </div> |
| 155 | |
| 156 | <div> |
| 157 | <label class="success-action"> |
| 158 | <input type="radio" name="wpmtst_form_options[success_action]" value="id" <?php checked( 'id', $form_options['success_action'] ); ?>/> <?php esc_html_e( 'redirect to a page', 'strong-testimonials' ); ?> |
| 159 | </label> |
| 160 | |
| 161 | <select id="redirect-page" name="wpmtst_form_options[success_redirect_id]"> |
| 162 | |
| 163 | <option value=""><?php esc_html_e( '— select a page —', 'strong-testimonials' ); ?></option> |
| 164 | <?php foreach ( $pages_list as $pages ) : ?> |
| 165 | |
| 166 | <option value="<?php echo esc_attr( $pages->ID ); ?>" <?php selected( isset( $form_options['success_redirect_id'] ) ? $form_options['success_redirect_id'] : 0, $pages->ID ); ?>> |
| 167 | <?php echo esc_html( $pages->post_title ); ?> |
| 168 | </option> |
| 169 | |
| 170 | <?php endforeach; ?> |
| 171 | |
| 172 | </select> |
| 173 | |
| 174 | <div style="display: inline-block; text-indent: 20px;"> |
| 175 | <label> |
| 176 | <?php echo esc_html_x( 'or enter its ID or slug', 'to select a redirect page', 'strong-testimonials' ); ?> |
| 177 | |
| 178 | <input type="text" id="redirect-page-2" name="wpmtst_form_options[success_redirect_2]" size="30"> |
| 179 | </label> |
| 180 | </div> |
| 181 | </div> |
| 182 | |
| 183 | <div> |
| 184 | <label class="success-action"> |
| 185 | <input type="radio" name="wpmtst_form_options[success_action]" value="url" <?php checked( 'url', $form_options['success_action'] ); ?>/> |
| 186 | <?php esc_html_e( 'redirect to a URL', 'strong-testimonials' ); ?> |
| 187 | </label> |
| 188 | <label> |
| 189 | <input type="text" id="redirect-page-3" name="wpmtst_form_options[success_redirect_url]" value="<?php echo esc_attr( $form_options['success_redirect_url'] ); ?>" size="75"/> |
| 190 | </label> |
| 191 | </div> |
| 192 | |
| 193 | </td> |
| 194 | </tr> |
| 195 | |
| 196 | <tr> |
| 197 | <th scope="row"> |
| 198 | <label> |
| 199 | <?php esc_html_e( 'Post Status', 'strong-testimonials' ); ?> |
| 200 | </label> |
| 201 | </th> |
| 202 | <td> |
| 203 | <ul class="compact"> |
| 204 | <li> |
| 205 | <label> |
| 206 | <input type="radio" name="wpmtst_form_options[post_status]" value="pending" <?php checked( 'pending', $form_options['post_status'] ); ?>/> |
| 207 | <?php esc_html_e( 'Pending', 'strong-testimonials' ); ?> |
| 208 | </label> |
| 209 | </li> |
| 210 | <li> |
| 211 | <label> |
| 212 | <input type="radio" name="wpmtst_form_options[post_status]" value="publish" <?php checked( 'publish', $form_options['post_status'] ); ?>/> |
| 213 | <?php esc_html_e( 'Published', 'strong-testimonials' ); ?> |
| 214 | </label> |
| 215 | </li> |
| 216 | </ul> |
| 217 | </td> |
| 218 | </tr> |
| 219 | |
| 220 | <tr> |
| 221 | <th scope="row"> |
| 222 | <label for="wpmtst-options-admin-notify"> |
| 223 | <?php esc_html_e( 'Notification Email', 'strong-testimonials' ); ?> |
| 224 | </label> |
| 225 | </th> |
| 226 | |
| 227 | <td> |
| 228 | <div class="match-height"> |
| 229 | <fieldset> |
| 230 | <label for="wpmtst-options-admin-notify"> |
| 231 | <input id="wpmtst-options-admin-notify" type="checkbox" name="wpmtst_form_options[admin_notify]" <?php checked( $form_options['admin_notify'] ); ?>/> |
| 232 | <?php esc_html_e( 'Receive an email when new testimonials are submitted and waiting for approval.', 'strong-testimonials' ); ?> |
| 233 | </label> |
| 234 | </fieldset> |
| 235 | </div> |
| 236 | <div class="email-container" id="admin-notify-fields" <?php echo ( $form_options['admin_notify'] ) ? '' : 'style="display: none;"'; ?>> |
| 237 | <?php |
| 238 | require 'email-from.php'; |
| 239 | require 'email-to.php'; |
| 240 | require 'email.php'; |
| 241 | do_action( 'wpmtst_after_notification_fields', 'notification' ); |
| 242 | ?> |
| 243 | </div> |
| 244 | <?php do_action( 'wpmtst_after_notification_options', $form_options ); ?> |
| 245 | <?php do_action( 'wpmtst_after_mail_notification_settings' ); ?> |
| 246 | |
| 247 | </td> |
| 248 | </tr> |
| 249 | |
| 250 | </table> |
| 251 | |
| 252 | <?php do_action( 'wpmtst_after_form_settings', $form_options, 'wpmtst_form_options' ); ?> |