@@ -5,16 +5,16 @@ |
||
5 | 5 | * For help on using, see our documentation [https://yikesplugins.com/support/knowledge-base/product/easy-forms-for-mailchimp/] |
6 | 6 | * @since 6.0 |
7 | 7 | */ |
8 | - if ( is_string( $form_data['custom_fields'] ) ) { |
|
9 | - $field_data = json_decode( $form_data['custom_fields'] , true ); |
|
10 | - } elseif ( is_array( $form_data['custom_fields'] ) ) { |
|
11 | - $field_data = $form_data['custom_fields']; |
|
8 | + if ( is_string( $form_data[ 'custom_fields' ] ) ) { |
|
9 | + $field_data = json_decode( $form_data[ 'custom_fields' ], true ); |
|
10 | + } elseif ( is_array( $form_data[ 'custom_fields' ] ) ) { |
|
11 | + $field_data = $form_data[ 'custom_fields' ]; |
|
12 | 12 | } |
13 | 13 | ?> |
14 | 14 | <label class="custom-field-section"> |
15 | - <strong><?php echo $field['label']; ?></strong> |
|
16 | - <input type="checkbox" class="widefat" name="custom-field[<?php echo $field['id']; ?>]" id="custom-field" value="1" <?php checked( isset( $field_data[$field['id']] ) ? $field_data[$field['id']] : 0, 1, true ); ?>> |
|
17 | - <?php if( isset( $field['description'] ) && $field['description'] != '' ) { ?> |
|
18 | - <p class="description"><?php echo $field['description']; ?></p> |
|
15 | + <strong><?php echo $field[ 'label' ]; ?></strong> |
|
16 | + <input type="checkbox" class="widefat" name="custom-field[<?php echo $field[ 'id' ]; ?>]" id="custom-field" value="1" <?php checked( isset( $field_data[ $field[ 'id' ] ] ) ? $field_data[ $field[ 'id' ] ] : 0, 1, true ); ?>> |
|
17 | + <?php if ( isset( $field[ 'description' ] ) && $field[ 'description' ] != '' ) { ?> |
|
18 | + <p class="description"><?php echo $field[ 'description' ]; ?></p> |
|
19 | 19 | <?php } ?> |
20 | 20 | </label> |
@@ -5,10 +5,10 @@ discard block |
||
5 | 5 | * For help on using, see our documentation [https://yikesplugins.com/support/knowledge-base/product/easy-forms-for-mailchimp/] |
6 | 6 | * @since 6.0 |
7 | 7 | */ |
8 | - if ( is_string( $form_data['custom_fields'] ) ) { |
|
9 | - $field_data = json_decode( $form_data['custom_fields'] , true ); |
|
10 | - } elseif ( is_array( $form_data['custom_fields'] ) ) { |
|
11 | - $field_data = $form_data['custom_fields']; |
|
8 | + if ( is_string( $form_data[ 'custom_fields' ] ) ) { |
|
9 | + $field_data = json_decode( $form_data[ 'custom_fields' ], true ); |
|
10 | + } elseif ( is_array( $form_data[ 'custom_fields' ] ) ) { |
|
11 | + $field_data = $form_data[ 'custom_fields' ]; |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // This will enqueue the Media Uploader script |
@@ -16,27 +16,27 @@ discard block |
||
16 | 16 | // And let's not forget the script we wrote earlier |
17 | 17 | wp_enqueue_script( 'yikes-mailchimp-file-field-script', plugin_dir_url( __FILE__ ) . 'js/yikes-mc-file-upload.js', array( 'jquery' ), '1.0', false ); |
18 | 18 | // print_r( $field_data ); |
19 | - wp_localize_script( 'yikes-mailchimp-file-field-script' , 'additional_data' , array( |
|
19 | + wp_localize_script( 'yikes-mailchimp-file-field-script', 'additional_data', array( |
|
20 | 20 | 'wp_includes_image_url' => includes_url() . 'images/media/' |
21 | 21 | ) ); |
22 | 22 | $i = 1; |
23 | 23 | // create an single item array when nothing is stored yet, loop for one field |
24 | - $field_data['incentive-attachment'] = ( isset( $field_data['incentive-attachment'] ) && !empty( $field_data['incentive-attachment'] ) ) ? $field_data['incentive-attachment'] : array( '' ); |
|
24 | + $field_data[ 'incentive-attachment' ] = ( isset( $field_data[ 'incentive-attachment' ] ) && ! empty( $field_data[ 'incentive-attachment' ] ) ) ? $field_data[ 'incentive-attachment' ] : array( '' ); |
|
25 | 25 | ?> |
26 | 26 | |
27 | 27 | <div class="yikes-mailchimp-file-field"> |
28 | - <label for="image_url" class="widefat"><strong><?php echo $field['label']; ?></strong></label> |
|
29 | - <?php foreach( $field_data['incentive-attachment'] as $attachment ) { ?> |
|
30 | - <input type="text" name="custom-field[<?php echo $field['id']; ?>][<?php echo $i; ?>]" id="custom-field[<?php echo $field['id']; ?>][<?php echo $i; ?>]" class="file-attachment" value="<?php echo isset( $field_data[$field['id']][$i] ) ? $field_data[$field['id']][$i] : ''; ?>"> |
|
31 | - <input type="button" name="upload-btn" id="upload-btn" class="button-secondary" data-attr-position="<?php echo $i; ?>" value="<?php _e( 'Upload File' , 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
28 | + <label for="image_url" class="widefat"><strong><?php echo $field[ 'label' ]; ?></strong></label> |
|
29 | + <?php foreach ( $field_data[ 'incentive-attachment' ] as $attachment ) { ?> |
|
30 | + <input type="text" name="custom-field[<?php echo $field[ 'id' ]; ?>][<?php echo $i; ?>]" id="custom-field[<?php echo $field[ 'id' ]; ?>][<?php echo $i; ?>]" class="file-attachment" value="<?php echo isset( $field_data[ $field[ 'id' ] ][ $i ] ) ? $field_data[ $field[ 'id' ] ][ $i ] : ''; ?>"> |
|
31 | + <input type="button" name="upload-btn" id="upload-btn" class="button-secondary" data-attr-position="<?php echo $i; ?>" value="<?php _e( 'Upload File', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
32 | 32 | <div class="file-container"> |
33 | 33 | <p class="file-remove-wrapper"> |
34 | - <a href="#" class="remove-file-button" data-attr-position="<?php echo $i; ?>"><?php _e( 'Remove File' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
34 | + <a href="#" class="remove-file-button" data-attr-position="<?php echo $i; ?>"><?php _e( 'Remove File', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
35 | 35 | </p> |
36 | 36 | </div> |
37 | 37 | <?php $i++; } ?> |
38 | - <?php if( isset( $field['repeat'] ) ) { ?> |
|
38 | + <?php if ( isset( $field[ 'repeat' ] ) ) { ?> |
|
39 | 39 | <a href="#" class="button-secondary add-new-incentive-attachment" data-attr-position="<?php echo $i; ?>"><span class="dashicons dashicons-plus"></span></a> |
40 | 40 | <?php } ?> |
41 | - <p class="description"><?php echo $field['description']; ?></p> |
|
41 | + <p class="description"><?php echo $field[ 'description' ]; ?></p> |
|
42 | 42 | </div> |
43 | 43 | \ No newline at end of file |
@@ -6,18 +6,18 @@ |
||
6 | 6 | * For help on using, see our documentation [https://yikesplugins.com/support/knowledge-base/product/easy-forms-for-mailchimp/] |
7 | 7 | * @since 6.0 |
8 | 8 | */ |
9 | - if ( is_string( $form_data['custom_fields'] ) ) { |
|
10 | - $field_data = json_decode( $form_data['custom_fields'] , true ); |
|
11 | - } elseif ( is_array( $form_data['custom_fields'] ) ) { |
|
12 | - $field_data = $form_data['custom_fields']; |
|
9 | + if ( is_string( $form_data[ 'custom_fields' ] ) ) { |
|
10 | + $field_data = json_decode( $form_data[ 'custom_fields' ], true ); |
|
11 | + } elseif ( is_array( $form_data[ 'custom_fields' ] ) ) { |
|
12 | + $field_data = $form_data[ 'custom_fields' ]; |
|
13 | 13 | } |
14 | 14 | |
15 | - $content = ( isset( $field_data[$field['id']] ) ) ? $field_data[$field['id']] : ( isset( $field['default'] ) ? $field['default'] : '' ); |
|
16 | - $wysiwyg_id = 'custom-field['.$field['id'].']'; |
|
15 | + $content = ( isset( $field_data[ $field[ 'id' ] ] ) ) ? $field_data[ $field[ 'id' ] ] : ( isset( $field[ 'default' ] ) ? $field[ 'default' ] : '' ); |
|
16 | + $wysiwyg_id = 'custom-field[' . $field[ 'id' ] . ']'; |
|
17 | 17 | ?> |
18 | 18 | |
19 | 19 | <div class="yikes-mailchimp-wysiwyg-field"> |
20 | - <label for="image_url" class="widefat"><strong><?php echo $field['label']; ?></strong></label> |
|
21 | - <?php wp_editor( $content, $field['id'], array( 'textarea_name' => $wysiwyg_id ) ); ?> |
|
22 | - <p class="description"><?php echo $field['description']; ?></p> |
|
20 | + <label for="image_url" class="widefat"><strong><?php echo $field[ 'label' ]; ?></strong></label> |
|
21 | + <?php wp_editor( $content, $field[ 'id' ], array( 'textarea_name' => $wysiwyg_id ) ); ?> |
|
22 | + <p class="description"><?php echo $field[ 'description' ]; ?></p> |
|
23 | 23 | </div> |
@@ -5,26 +5,26 @@ |
||
5 | 5 | * For help on using, see our documentation [https://yikesplugins.com/support/knowledge-base/product/easy-forms-for-mailchimp/] |
6 | 6 | * @since 6.0 |
7 | 7 | */ |
8 | - if ( is_string( $form_data['custom_fields'] ) ) { |
|
9 | - $field_data = json_decode( $form_data['custom_fields'] , true ); |
|
10 | - } elseif ( is_array( $form_data['custom_fields'] ) ) { |
|
11 | - $field_data = $form_data['custom_fields']; |
|
8 | + if ( is_string( $form_data[ 'custom_fields' ] ) ) { |
|
9 | + $field_data = json_decode( $form_data[ 'custom_fields' ], true ); |
|
10 | + } elseif ( is_array( $form_data[ 'custom_fields' ] ) ) { |
|
11 | + $field_data = $form_data[ 'custom_fields' ]; |
|
12 | 12 | } |
13 | 13 | ?> |
14 | 14 | <div class="custom-field-section"> |
15 | 15 | <!-- title --> |
16 | - <strong><?php echo $field['label']; ?></strong> |
|
16 | + <strong><?php echo $field[ 'label' ]; ?></strong> |
|
17 | 17 | <!-- radio buttons --> |
18 | 18 | <section class="custom-radio-holder"> |
19 | - <?php foreach( $field['options'] as $value => $label ) { ?> |
|
19 | + <?php foreach ( $field[ 'options' ] as $value => $label ) { ?> |
|
20 | 20 | <label class="custom-radio-label"> |
21 | - <input type="radio" name="custom-field[<?php echo $field['id']; ?>][]" id="custom-field" value="<?php echo $value; ?>" <?php if( isset( $field_data[$field['id']] ) ) { checked( $field_data[$field['id']] , $value ); } ?>> |
|
21 | + <input type="radio" name="custom-field[<?php echo $field[ 'id' ]; ?>][]" id="custom-field" value="<?php echo $value; ?>" <?php if ( isset( $field_data[ $field[ 'id' ] ] ) ) { checked( $field_data[ $field[ 'id' ] ], $value ); } ?>> |
|
22 | 22 | <?php echo $label; ?> |
23 | 23 | </label> |
24 | 24 | <?php } ?> |
25 | 25 | </section> |
26 | 26 | <!-- description --> |
27 | - <?php if( isset( $field['description'] ) && $field['description'] != '' ) { ?> |
|
28 | - <p class="description"><?php echo $field['description']; ?></p> |
|
27 | + <?php if ( isset( $field[ 'description' ] ) && $field[ 'description' ] != '' ) { ?> |
|
28 | + <p class="description"><?php echo $field[ 'description' ]; ?></p> |
|
29 | 29 | <?php } ?> |
30 | 30 | </div> |
31 | 31 | \ No newline at end of file |
@@ -302,9 +302,9 @@ |
||
302 | 302 | ?></ul><?php |
303 | 303 | } |
304 | 304 | /** |
305 | - * Custom action hook for our add-ons to hook into |
|
306 | - * @since 6.0.3.8 |
|
307 | - */ |
|
305 | + * Custom action hook for our add-ons to hook into |
|
306 | + * @since 6.0.3.8 |
|
307 | + */ |
|
308 | 308 | do_action( 'yikes-mailchimp-list-form-fields-metabox' ); |
309 | 309 | ?> |
310 | 310 |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! isset( $_REQUEST['list-id'] ) ) { |
|
2 | +if ( ! isset( $_REQUEST[ 'list-id' ] ) ) { |
|
3 | 3 | wp_die( __( 'Oops, we can\'t determine what List to view. Please go back and try again.' ) ); |
4 | 4 | } |
5 | 5 | |
6 | -$list_id = sanitize_key( $_REQUEST['list-id'] ); |
|
6 | +$list_id = sanitize_key( $_REQUEST[ 'list-id' ] ); |
|
7 | 7 | $list_helper = yikes_get_mc_api_manager()->get_list_handler(); |
8 | 8 | $api_key = yikes_get_mc_api_key(); |
9 | 9 | $dash_position = strpos( $api_key, '-' ); |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | // setup pagination variables |
63 | -$paged = isset( $_REQUEST['paged'] ) ? filter_var( $_REQUEST['paged'], FILTER_SANITIZE_NUMBER_INT ) : 0; |
|
63 | +$paged = isset( $_REQUEST[ 'paged' ] ) ? filter_var( $_REQUEST[ 'paged' ], FILTER_SANITIZE_NUMBER_INT ) : 0; |
|
64 | 64 | $limit = apply_filters( 'yikes_admin_list_subscriber_limit', 20 ); |
65 | -$page_offset = (int) $paged * (int) $limit; |
|
66 | -$sort_dir = isset( $_REQUEST['sort'] ) ? $_REQUEST['sort'] : 'DESC'; |
|
65 | +$page_offset = (int) $paged * (int) $limit; |
|
66 | +$sort_dir = isset( $_REQUEST[ 'sort' ] ) ? $_REQUEST[ 'sort' ] : 'DESC'; |
|
67 | 67 | |
68 | 68 | if ( $sort_dir === 'DESC' ) { |
69 | 69 | $opposite_sort_dir = 'ASC'; |
@@ -90,25 +90,25 @@ discard block |
||
90 | 90 | ?> |
91 | 91 | <div class="wrap"> |
92 | 92 | <!-- Freddie Logo --> |
93 | - <img src="<?php echo YIKES_MC_URL . 'includes/images/Mailchimp_Assets/Freddie_60px.png'; ?>" alt="<?php __( 'Freddie - Mailchimp Mascot' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
93 | + <img src="<?php echo YIKES_MC_URL . 'includes/images/Mailchimp_Assets/Freddie_60px.png'; ?>" alt="<?php __( 'Freddie - Mailchimp Mascot', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
94 | 94 | |
95 | - <h1>YIKES Easy Forms for Mailchimp | <?php echo $list_data['name']; ?></h1> |
|
95 | + <h1>YIKES Easy Forms for Mailchimp | <?php echo $list_data[ 'name' ]; ?></h1> |
|
96 | 96 | |
97 | 97 | <!-- Settings Page Description --> |
98 | - <p class="yikes-easy-mc-about-text about-text"><?php _e( 'View all subscribers below. View additional subscriber info, or add additional fields to this list.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
99 | - <!-- <p class="add-new-subscriber-button"><a href="#" onclick="jQuery(this).parent().next().slideToggle();" class="add-new-h2"><?php _e( 'New Subscriber' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></p> --> |
|
98 | + <p class="yikes-easy-mc-about-text about-text"><?php _e( 'View all subscribers below. View additional subscriber info, or add additional fields to this list.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
99 | + <!-- <p class="add-new-subscriber-button"><a href="#" onclick="jQuery(this).parent().next().slideToggle();" class="add-new-h2"><?php _e( 'New Subscriber', 'yikes-inc-easy-mailchimp-extender' ); ?></a></p> --> |
|
100 | 100 | |
101 | 101 | <?php |
102 | 102 | /* Display our admin notices here */ |
103 | 103 | // Unsubscribe user confirmation message |
104 | - if( isset( $_REQUEST['user-unsubscribed'] ) && $_REQUEST['user-unsubscribed'] == 'true' ) { |
|
104 | + if ( isset( $_REQUEST[ 'user-unsubscribed' ] ) && $_REQUEST[ 'user-unsubscribed' ] == 'true' ) { |
|
105 | 105 | ?> |
106 | 106 | <div class="updated manage-form-admin-notice"> |
107 | 107 | <p><?php _e( 'User successfully unsubscribed.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
108 | 108 | </div> |
109 | 109 | <?php |
110 | 110 | } |
111 | - if( isset( $_REQUEST['user-unsubscribed'] ) && $_REQUEST['user-unsubscribed'] == 'false' ) { |
|
111 | + if ( isset( $_REQUEST[ 'user-unsubscribed' ] ) && $_REQUEST[ 'user-unsubscribed' ] == 'false' ) { |
|
112 | 112 | ?> |
113 | 113 | <div class="error manage-form-admin-notice"> |
114 | 114 | <p><?php _e( "We've encountered an error trying to remove the subscriber. Please try again. If the error persists please get in contact with the YIKES Inc. support staff.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | ?> |
119 | 119 | |
120 | 120 | <section class="add-new-subscriber-form-container"> |
121 | - <h4><?php _e( 'Add New Subscriber' , 'yikes-inc-easy-mailchimp-extender' ); ?></h4> |
|
121 | + <h4><?php _e( 'Add New Subscriber', 'yikes-inc-easy-mailchimp-extender' ); ?></h4> |
|
122 | 122 | <form id="add-new-subcscriber"> |
123 | - <input type="text" class="regular-text" placeholder="<?php _e( 'User Email Address' , 'yikes-inc-easy-mailchimp-extender' ); ?>" /></p> |
|
123 | + <input type="text" class="regular-text" placeholder="<?php _e( 'User Email Address', 'yikes-inc-easy-mailchimp-extender' ); ?>" /></p> |
|
124 | 124 | <p><?php submit_button( 'Add Subscriber' ); ?></p> |
125 | 125 | </form> |
126 | 126 | </section> |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | <!-- TABLE HEAD --> |
143 | 143 | <thead> |
144 | 144 | <tr> |
145 | - <th id="user-email columnname" class="manage-column column-columnname" scope="col"><a id="user-email-sort" href="<?php echo esc_url_raw( add_query_arg( array( 'column' => 'email' , 'sort' => $opposite_sort_dir ) ) ); ?>"><?php _e( 'User Email' , 'yikes-inc-easy-mailchimp-extender' ); echo $icon;?></a></th> |
|
146 | - <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Email Client' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
145 | + <th id="user-email columnname" class="manage-column column-columnname" scope="col"><a id="user-email-sort" href="<?php echo esc_url_raw( add_query_arg( array( 'column' => 'email', 'sort' => $opposite_sort_dir ) ) ); ?>"><?php _e( 'User Email', 'yikes-inc-easy-mailchimp-extender' ); echo $icon; ?></a></th> |
|
146 | + <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Email Client', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
147 | 147 | </tr> |
148 | 148 | </thead> |
149 | 149 | <!-- end header --> |
@@ -151,8 +151,8 @@ discard block |
||
151 | 151 | <!-- FOOTER --> |
152 | 152 | <tfoot> |
153 | 153 | <tr> |
154 | - <th class="manage-column column-columnname" scope="col"><?php _e( 'User Email' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
155 | - <th class="manage-column column-columnname num" scope="col"><?php _e( 'Email Client' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
154 | + <th class="manage-column column-columnname" scope="col"><?php _e( 'User Email', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
155 | + <th class="manage-column column-columnname num" scope="col"><?php _e( 'Email Client', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
156 | 156 | </tr> |
157 | 157 | </tfoot> |
158 | 158 | <!-- end footer --> |
@@ -162,15 +162,15 @@ discard block |
||
162 | 162 | <?php if ( count( $subscribers_list ) > 0 ) { |
163 | 163 | $i = 1; |
164 | 164 | foreach ( $subscribers_list as $subscriber ) { |
165 | - $user_id = $subscriber['id']; |
|
165 | + $user_id = $subscriber[ 'id' ]; |
|
166 | 166 | $path = YIKES_MC_URL . "includes/images/na.png"; |
167 | 167 | $email_client_icon = "<img width='35' src='" . $path . "' alt='" . __( 'not set', 'yikes-inc-easy-mailchimp-extender' ) . "' title='" . __( 'not set', 'yikes-inc-easy-mailchimp-extender' ) . "'>"; |
168 | 168 | |
169 | 169 | ?> |
170 | 170 | <tr class="<?php if ( $i % 2 == 0 ) { echo 'alternate'; } ?>"> |
171 | 171 | <td class="column-columnname"> |
172 | - <a class="user-email row-title" href="mailto:<?php echo sanitize_email( $subscriber['email_address'] ); ?>"> |
|
173 | - <?php echo sanitize_email( $subscriber['email_address'] ); ?> |
|
172 | + <a class="user-email row-title" href="mailto:<?php echo sanitize_email( $subscriber[ 'email_address' ] ); ?>"> |
|
173 | + <?php echo sanitize_email( $subscriber[ 'email_address' ] ); ?> |
|
174 | 174 | </a> |
175 | 175 | <div class="row-actions"> |
176 | 176 | <?php $view_user_info_url = esc_url_raw( add_query_arg( array( |
@@ -184,17 +184,17 @@ discard block |
||
184 | 184 | 'nonce' => wp_create_nonce( 'unsubscribe-user-' . $user_id ), |
185 | 185 | 'email_id' => $user_id, |
186 | 186 | ) ) ); ?> |
187 | - <span><a href="<?php echo $url; ?>" onclick="return confirm('<?php printf( __( "Are you sure you want to unsubscribe %s from this mailing list?", 'yikes-inc-easy-mailchimp-extender' ), sanitize_email( $subscriber['email_address'] ) ); ?>');" class="yikes-delete-subscriber"><?php _e( "Unsubscribe", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
187 | + <span><a href="<?php echo $url; ?>" onclick="return confirm('<?php printf( __( "Are you sure you want to unsubscribe %s from this mailing list?", 'yikes-inc-easy-mailchimp-extender' ), sanitize_email( $subscriber[ 'email_address' ] ) ); ?>');" class="yikes-delete-subscriber"><?php _e( "Unsubscribe", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
188 | 188 | </div> |
189 | 189 | </td> |
190 | 190 | <td class="column-columnname num"><?php echo $email_client_icon; ?></td> |
191 | 191 | </tr> |
192 | 192 | <?php |
193 | - $i ++; |
|
193 | + $i++; |
|
194 | 194 | } |
195 | 195 | } else { ?> |
196 | 196 | <tr class="no-items"> |
197 | - <td class="colspanchange no-current-subscriber-notice" colspan="2"><em><?php _e( 'No one is currently subscribed to this list.' , 'yikes-inc-easy-mailchimp-extender' ); ?></em></td> |
|
197 | + <td class="colspanchange no-current-subscriber-notice" colspan="2"><em><?php _e( 'No one is currently subscribed to this list.', 'yikes-inc-easy-mailchimp-extender' ); ?></em></td> |
|
198 | 198 | </tr> |
199 | 199 | <?php } ?> |
200 | 200 | </tbody> |
@@ -206,11 +206,11 @@ discard block |
||
206 | 206 | <!-- pagination --> |
207 | 207 | <div class="tablenav"> |
208 | 208 | <div class="tablenav-pages"> |
209 | - <a class='first-page <?php if( $paged == 0 ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the first page" , 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => 0 ) ) ); ?>'>«</a> |
|
210 | - <a class='prev-page <?php if( $paged == 0 ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the previous page" , 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $paged - 1 ) ) ) ); ?>'>‹</a> |
|
211 | - <span class="paging-input"><input class='current-page' title='<?php _e( "Current page" , 'yikes-inc-easy-mailchimp-extender' ); ?>' type='text' name='paged' value='<?php if( $paged == 0 ) { echo '1'; } else { echo intval( $paged + 1 ); } ?>' size='1' /> <?php _e( 'of', 'yikes-inc-easy-mailchimp-extender' ); ?> <span class='total-pages'><?php echo $total_pages; ?></span></span> |
|
212 | - <a class='next-page <?php if( $paged == intval( $total_pages - 1 ) ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the next page" , 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $paged + 1 ) ) ) ); ?>'>›</a> |
|
213 | - <a class='last-page <?php if( $paged == intval( $total_pages - 1 ) ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the last page" , 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $total_pages - 1 ) ) ) ); ?>'>»</a> |
|
209 | + <a class='first-page <?php if ( $paged == 0 ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the first page", 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => 0 ) ) ); ?>'>«</a> |
|
210 | + <a class='prev-page <?php if ( $paged == 0 ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the previous page", 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $paged - 1 ) ) ) ); ?>'>‹</a> |
|
211 | + <span class="paging-input"><input class='current-page' title='<?php _e( "Current page", 'yikes-inc-easy-mailchimp-extender' ); ?>' type='text' name='paged' value='<?php if ( $paged == 0 ) { echo '1'; } else { echo intval( $paged + 1 ); } ?>' size='1' /> <?php _e( 'of', 'yikes-inc-easy-mailchimp-extender' ); ?> <span class='total-pages'><?php echo $total_pages; ?></span></span> |
|
212 | + <a class='next-page <?php if ( $paged == intval( $total_pages - 1 ) ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the next page", 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $paged + 1 ) ) ) ); ?>'>›</a> |
|
213 | + <a class='last-page <?php if ( $paged == intval( $total_pages - 1 ) ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the last page", 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $total_pages - 1 ) ) ) ); ?>'>»</a> |
|
214 | 214 | </div> |
215 | 215 | </div> |
216 | 216 | |
@@ -225,21 +225,21 @@ discard block |
||
225 | 225 | |
226 | 226 | <div class="postbox yikes-easy-mc-postbox"> |
227 | 227 | |
228 | - <h3><?php _e( 'List Overview' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
228 | + <h3><?php _e( 'List Overview', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
229 | 229 | |
230 | 230 | <?php |
231 | 231 | // store list rating |
232 | - $list_rating = $list_data['list_rating']; |
|
233 | - if( $list_rating > 0 ) { |
|
234 | - $list_rating_explosion = explode( '.' , $list_rating ); |
|
232 | + $list_rating = $list_data[ 'list_rating' ]; |
|
233 | + if ( $list_rating > 0 ) { |
|
234 | + $list_rating_explosion = explode( '.', $list_rating ); |
|
235 | 235 | $star_array = array(); |
236 | 236 | $x = 1; |
237 | - while( $list_rating_explosion[0] >= $x ) { |
|
238 | - $star_array[] = '<span class="dashicons dashicons-star-filled list-rating-star"></span>'; |
|
237 | + while ( $list_rating_explosion[ 0 ] >= $x ) { |
|
238 | + $star_array[ ] = '<span class="dashicons dashicons-star-filled list-rating-star"></span>'; |
|
239 | 239 | $x++; |
240 | 240 | } |
241 | - if( $list_rating_explosion[1] == '5' ) { |
|
242 | - $star_array[] = '<span class="dashicons dashicons-star-half list-rating-star"></span>'; |
|
241 | + if ( $list_rating_explosion[ 1 ] == '5' ) { |
|
242 | + $star_array[ ] = '<span class="dashicons dashicons-star-half list-rating-star"></span>'; |
|
243 | 243 | } |
244 | 244 | } else { |
245 | 245 | $star_array = array( 'n/a' ); |
@@ -247,40 +247,40 @@ discard block |
||
247 | 247 | ?> |
248 | 248 | <table class="form-table"> |
249 | 249 | <tr valign="top"> |
250 | - <td scope="row"><label for="tablecell"><strong><?php _e( 'List Rating' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
251 | - <td><?php echo implode( ' ' , $star_array ); ?></td> |
|
250 | + <td scope="row"><label for="tablecell"><strong><?php _e( 'List Rating', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
251 | + <td><?php echo implode( ' ', $star_array ); ?></td> |
|
252 | 252 | </tr> |
253 | 253 | <tr valign="top"> |
254 | - <td scope="row"><label for="tablecell"><strong><?php _e( 'Average Subscribers' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
255 | - <td><?php echo $list_data['stats']['avg_sub_rate']; ?><small> / <?php _e( 'month' , 'yikes-inc-easy-mailchimp-extender' ); ?></small></td> |
|
254 | + <td scope="row"><label for="tablecell"><strong><?php _e( 'Average Subscribers', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
255 | + <td><?php echo $list_data[ 'stats' ][ 'avg_sub_rate' ]; ?><small> / <?php _e( 'month', 'yikes-inc-easy-mailchimp-extender' ); ?></small></td> |
|
256 | 256 | </tr> |
257 | 257 | <tr valign="top"> |
258 | - <td scope="row"><label for="tablecell"><strong><?php _e( 'Subscriber Count' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
259 | - <td><?php echo intval( $list_data['stats']['member_count'] ); ?></td> |
|
258 | + <td scope="row"><label for="tablecell"><strong><?php _e( 'Subscriber Count', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
259 | + <td><?php echo intval( $list_data[ 'stats' ][ 'member_count' ] ); ?></td> |
|
260 | 260 | </tr> |
261 | 261 | <tr valign="top"> |
262 | - <td scope="row"><label for="tablecell"><strong><?php _e( 'New Since Last Campaign' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
263 | - <td><?php echo intval( $list_data['stats']['member_count_since_send'] ); ?></td> |
|
262 | + <td scope="row"><label for="tablecell"><strong><?php _e( 'New Since Last Campaign', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
263 | + <td><?php echo intval( $list_data[ 'stats' ][ 'member_count_since_send' ] ); ?></td> |
|
264 | 264 | </tr> |
265 | 265 | <tr valign="top"> |
266 | - <td scope="row"><label for="tablecell"><strong><?php _e( 'Created' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
267 | - <td><?php echo date( get_option('date_format') , strtotime( $list_data['date_created'] ) ); ?></td> |
|
266 | + <td scope="row"><label for="tablecell"><strong><?php _e( 'Created', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
267 | + <td><?php echo date( get_option( 'date_format' ), strtotime( $list_data[ 'date_created' ] ) ); ?></td> |
|
268 | 268 | </tr> |
269 | 269 | <tr valign="top"> |
270 | - <td scope="row"><label for="tablecell"><strong><?php _e( 'List Fields' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
271 | - <td><?php echo intval( $list_data['stats']['merge_field_count'] + 1 ); // add 1 for our email field.. ?></td> |
|
270 | + <td scope="row"><label for="tablecell"><strong><?php _e( 'List Fields', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
271 | + <td><?php echo intval( $list_data[ 'stats' ][ 'merge_field_count' ] + 1 ); // add 1 for our email field.. ?></td> |
|
272 | 272 | </tr> |
273 | 273 | <tr valign="top"> |
274 | - <td scope="row"><label for="tablecell"><strong><?php _e( 'Short Signup URL' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
275 | - <td><input type="text" class="widefat view-list-sidebar-input" value="<?php echo esc_url_raw( $list_data['subscribe_url_short'] ); ?>" readonly onclick="jQuery(this).select();"></td> |
|
274 | + <td scope="row"><label for="tablecell"><strong><?php _e( 'Short Signup URL', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
275 | + <td><input type="text" class="widefat view-list-sidebar-input" value="<?php echo esc_url_raw( $list_data[ 'subscribe_url_short' ] ); ?>" readonly onclick="jQuery(this).select();"></td> |
|
276 | 276 | </tr> |
277 | 277 | <tr valign="top"> |
278 | - <td scope="row"><label for="tablecell"><strong><?php _e( 'Default From Email' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
279 | - <td><input type="text" class="widefat view-list-sidebar-input" value="<?php echo sanitize_email( $list_data['campaign_defaults']['from_email'] ); ?>" readonly onclick="jQuery(this).select();"></td> |
|
278 | + <td scope="row"><label for="tablecell"><strong><?php _e( 'Default From Email', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
279 | + <td><input type="text" class="widefat view-list-sidebar-input" value="<?php echo sanitize_email( $list_data[ 'campaign_defaults' ][ 'from_email' ] ); ?>" readonly onclick="jQuery(this).select();"></td> |
|
280 | 280 | </tr> |
281 | 281 | <tr valign="top"> |
282 | - <td scope="row"><label for="tablecell"><strong><?php _e( 'Default From Name' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
283 | - <td><?php echo $list_data['campaign_defaults']['from_name']; ?></td> |
|
282 | + <td scope="row"><label for="tablecell"><strong><?php _e( 'Default From Name', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
283 | + <td><?php echo $list_data[ 'campaign_defaults' ][ 'from_name' ]; ?></td> |
|
284 | 284 | </tr> |
285 | 285 | </table> |
286 | 286 | |
@@ -290,14 +290,14 @@ discard block |
||
290 | 290 | <!-- Merge Field Info --> |
291 | 291 | <div class="postbox yikes-easy-mc-postbox"> |
292 | 292 | |
293 | - <h3><?php _e( 'Form Fields' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
293 | + <h3><?php _e( 'Form Fields', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
294 | 294 | <?php |
295 | - if( count( $merge_fields['merge_fields'] ) >= 1 ) { |
|
295 | + if ( count( $merge_fields[ 'merge_fields' ] ) >= 1 ) { |
|
296 | 296 | ?><ul class="merge-variable-ul"><?php |
297 | - echo '<li class="interest-group-count">' . sprintf( _n( '%d Field', '%d Fields', intval( count( $merge_fields['merge_fields'] ) ), 'yikes-inc-easy-mailchimp-extender' ), intval( count( $merge_fields['merge_fields'] ) ) ) . '</li>'; |
|
298 | - foreach( $merge_fields['merge_fields'] as $merge_field ) { |
|
297 | + echo '<li class="interest-group-count">' . sprintf( _n( '%d Field', '%d Fields', intval( count( $merge_fields[ 'merge_fields' ] ) ), 'yikes-inc-easy-mailchimp-extender' ), intval( count( $merge_fields[ 'merge_fields' ] ) ) ) . '</li>'; |
|
298 | + foreach ( $merge_fields[ 'merge_fields' ] as $merge_field ) { |
|
299 | 299 | // new action hook @since 6.0.3.8 |
300 | - echo '<li class="' . $merge_field['tag'] . '"><span class="dashicons dashicons-marker"></span>' . $merge_field['name'] . ' ' . do_action( 'yikes-mailchimp-list-field', $merge_field ) . '</li>'; |
|
300 | + echo '<li class="' . $merge_field[ 'tag' ] . '"><span class="dashicons dashicons-marker"></span>' . $merge_field[ 'name' ] . ' ' . do_action( 'yikes-mailchimp-list-field', $merge_field ) . '</li>'; |
|
301 | 301 | } |
302 | 302 | ?></ul><?php |
303 | 303 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | <div class="postbox yikes-easy-mc-postbox"> |
315 | 315 | |
316 | 316 | |
317 | - <h3><?php _e( 'Interest Groups Overview' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
317 | + <h3><?php _e( 'Interest Groups Overview', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
318 | 318 | <?php |
319 | 319 | if ( ! empty( $interest_groupings ) ) { |
320 | 320 | ?> |
@@ -322,8 +322,8 @@ discard block |
||
322 | 322 | echo '<li class="interest-group-count">' . sprintf( _n( '%d Interest Group', '%d Interest Groups', intval( count( $interest_groupings ) ), 'yikes-inc-easy-mailchimp-extender' ), intval( count( $interest_groupings ) ) ) . '</li>'; |
323 | 323 | foreach ( $interest_groupings as $interest_group ) { |
324 | 324 | // Build up the total subscribers |
325 | - $count = array_sum( wp_list_pluck( $interest_group['items'], 'subscriber_count' ) ); |
|
326 | - echo '<li><span class="dashicons dashicons-marker"></span>' . $interest_group['title'] . '<span class="interest-group-title"></span><small title="' . $count . ' ' . __( "subscribers assigned to this group", 'yikes-inc-easy-mailchimp-extender' ) . '">(' . $count . ')</small></li>'; |
|
325 | + $count = array_sum( wp_list_pluck( $interest_group[ 'items' ], 'subscriber_count' ) ); |
|
326 | + echo '<li><span class="dashicons dashicons-marker"></span>' . $interest_group[ 'title' ] . '<span class="interest-group-title"></span><small title="' . $count . ' ' . __( "subscribers assigned to this group", 'yikes-inc-easy-mailchimp-extender' ) . '">(' . $count . ')</small></li>'; |
|
327 | 327 | } |
328 | 328 | ?></ul><?php |
329 | 329 | } else { |
@@ -347,17 +347,17 @@ discard block |
||
347 | 347 | <div class="postbox yikes-easy-mc-postbox"> |
348 | 348 | |
349 | 349 | |
350 | - <h3><?php _e( 'Segments Overview' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
350 | + <h3><?php _e( 'Segments Overview', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
351 | 351 | <?php |
352 | - if( isset( $segments['saved'] ) && count( $segments['saved'] ) >= 1 ) { |
|
352 | + if ( isset( $segments[ 'saved' ] ) && count( $segments[ 'saved' ] ) >= 1 ) { |
|
353 | 353 | $i = 1; |
354 | 354 | ?><ul class="segment-ul"><?php |
355 | - echo '<li class="segment-group-count">' . sprintf( _n( '%d Segment', '%d Segments', intval( count( $segments['saved'] ) ), 'yikes-inc-easy-mailchimp-extender' ), intval( count( $segments['saved'] ) ) ) . '</li>'; |
|
356 | - foreach( $segments['saved'] as $segment ) { |
|
357 | - echo '<li><span class="dashicons dashicons-arrow-right"></span>' . $segment['name'] . ' <small><a href="#" onclick="jQuery(this).parent().parent().next().slideToggle();jQuery(this).toggleText();return false;" data-alt-text="' . __( 'hide conditions' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( "view conditions" , 'yikes-inc-easy-mailchimp-extender' ) . '</a></small></li>'; |
|
355 | + echo '<li class="segment-group-count">' . sprintf( _n( '%d Segment', '%d Segments', intval( count( $segments[ 'saved' ] ) ), 'yikes-inc-easy-mailchimp-extender' ), intval( count( $segments[ 'saved' ] ) ) ) . '</li>'; |
|
356 | + foreach ( $segments[ 'saved' ] as $segment ) { |
|
357 | + echo '<li><span class="dashicons dashicons-arrow-right"></span>' . $segment[ 'name' ] . ' <small><a href="#" onclick="jQuery(this).parent().parent().next().slideToggle();jQuery(this).toggleText();return false;" data-alt-text="' . __( 'hide conditions', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( "view conditions", 'yikes-inc-easy-mailchimp-extender' ) . '</a></small></li>'; |
|
358 | 358 | ?><div class="conditionals yikes-easy-mc-hidden"><?php |
359 | - foreach( $segment['segment_opts']['conditions'] as $condition ) { |
|
360 | - echo '<li><small>' . sprintf( __( 'condition #%s : If %s %s %s', 'yikes-inc-easy-mailchimp-extender' ), intval( $i ), $condition['field'], $condition['op'], $condition['value'] ) . '</small></li>'; |
|
359 | + foreach ( $segment[ 'segment_opts' ][ 'conditions' ] as $condition ) { |
|
360 | + echo '<li><small>' . sprintf( __( 'condition #%s : If %s %s %s', 'yikes-inc-easy-mailchimp-extender' ), intval( $i ), $condition[ 'field' ], $condition[ 'op' ], $condition[ 'value' ] ) . '</small></li>'; |
|
361 | 361 | $i++; |
362 | 362 | } |
363 | 363 | ?></div><?php |
@@ -372,9 +372,9 @@ discard block |
||
372 | 372 | } |
373 | 373 | ?> |
374 | 374 | <!-- |
375 | - <a class="edit-segments-button" href="#" onclick="return false;" class="button-primary"><?php _e( 'Edit Segments' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
375 | + <a class="edit-segments-button" href="#" onclick="return false;" class="button-primary"><?php _e( 'Edit Segments', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
376 | 376 | --> |
377 | - <p class="description edit-segment-description"><?php _e( 'To edit this lists segments, head over to' , 'yikes-inc-easy-mailchimp-extender' ); ?> <a href="http://www.Mailchimp.com" target="_blank">Mailchimp</a></p> |
|
377 | + <p class="description edit-segment-description"><?php _e( 'To edit this lists segments, head over to', 'yikes-inc-easy-mailchimp-extender' ); ?> <a href="http://www.Mailchimp.com" target="_blank">Mailchimp</a></p> |
|
378 | 378 | |
379 | 379 | </div> |
380 | 380 |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | return ''; |
27 | 27 | } |
28 | 28 | |
29 | - $form = ( ! empty( $attributes['form'] ) ) ? str_replace( '"', '', $attributes['form'] ) : false; |
|
30 | - $list_id = ( ! empty( $attributes['list'] ) ) ? $attributes['list'] : false; |
|
29 | + $form = ( ! empty( $attributes[ 'form' ] ) ) ? str_replace( '"', '', $attributes[ 'form' ] ) : false; |
|
30 | + $list_id = ( ! empty( $attributes[ 'list' ] ) ) ? $attributes[ 'list' ] : false; |
|
31 | 31 | |
32 | 32 | /* If no list ID was passed into the shortcode - bail */ |
33 | 33 | if ( ! $list_id && ! $form ) { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | return ''; |
53 | 53 | } |
54 | 54 | |
55 | - $list_id = sanitize_key( $form_data['list_id'] ); // associated list id (users who fill out the form will be subscribed to this list) |
|
55 | + $list_id = sanitize_key( $form_data[ 'list_id' ] ); // associated list id (users who fill out the form will be subscribed to this list) |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | // object buffer |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | } |
72 | 72 | |
73 | 73 | /* type cast the returned value as an integer */ |
74 | - echo (int) apply_filters( 'yikes-mailchimp-subscriber-count-value', $list_data['stats']['member_count'] ); |
|
74 | + echo (int) apply_filters( 'yikes-mailchimp-subscriber-count-value', $list_data[ 'stats' ][ 'member_count' ] ); |
|
75 | 75 | |
76 | 76 | return ob_get_clean(); |
77 | 77 |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | if ( $network_wide ) { |
35 | 35 | $old_blog = $wpdb->blogid; |
36 | 36 | // Get all blog ids |
37 | - $blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs"); |
|
37 | + $blogids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ); |
|
38 | 38 | foreach ( $blogids as $blog_id ) { |
39 | 39 | switch_to_blog( $blog_id ); |
40 | 40 | self::_activate_yikes_easy_mailchimp( $wpdb ); |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | custom_fields TEXT NOT NULL, |
91 | 91 | UNIQUE KEY id (id) |
92 | 92 | ) $charset_collate;"; |
93 | - require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
|
94 | - dbDelta($sql); |
|
93 | + require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
94 | + dbDelta( $sql ); |
|
95 | 95 | |
96 | 96 | // create an option for the date that the user initially activated the plugin |
97 | 97 | // used to display a two week notice, asking for a review or to upgrade |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @subpackage Yikes_Inc_Easy_Mailchimp_Extender/includes |
19 | 19 | * @author YIKES Inc. <[email protected]> |
20 | 20 | */ |
21 | -class Yikes_Inc_Easy_Mailchimp_Extender_Activator { |
|
21 | +class Yikes_Inc_Easy_Mailchimp_Extender_Activator { |
|
22 | 22 | /** |
23 | 23 | * Short Description. Activation hook. |
24 | 24 | * |
@@ -26,16 +26,16 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @since 6.0.0 |
28 | 28 | */ |
29 | - public static function activate( $network_wide ) { |
|
29 | + public static function activate( $network_wide ) { |
|
30 | 30 | global $wpdb; |
31 | 31 | |
32 | - if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
32 | + if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
33 | 33 | // check if it is a network activation - if so, run the activation function for each blog id |
34 | - if ( $network_wide ) { |
|
34 | + if ( $network_wide ) { |
|
35 | 35 | $old_blog = $wpdb->blogid; |
36 | 36 | // Get all blog ids |
37 | 37 | $blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs"); |
38 | - foreach ( $blogids as $blog_id ) { |
|
38 | + foreach ( $blogids as $blog_id ) { |
|
39 | 39 | switch_to_blog( $blog_id ); |
40 | 40 | self::_activate_yikes_easy_mailchimp( $wpdb ); |
41 | 41 | restore_current_blog(); |
@@ -44,7 +44,8 @@ discard block |
||
44 | 44 | return; |
45 | 45 | } |
46 | 46 | self::_activate_yikes_easy_mailchimp( $wpdb ); |
47 | - } else { /* end network activate */ |
|
47 | + } else { |
|
48 | +/* end network activate */ |
|
48 | 49 | self::_activate_yikes_easy_mailchimp( $wpdb ); |
49 | 50 | } |
50 | 51 | } |
@@ -56,7 +57,7 @@ discard block |
||
56 | 57 | * |
57 | 58 | * @since 6.0.0 |
58 | 59 | */ |
59 | - static function _activate_yikes_easy_mailchimp( $wpdb ) { |
|
60 | + static function _activate_yikes_easy_mailchimp( $wpdb ) { |
|
60 | 61 | |
61 | 62 | // single site |
62 | 63 | $custom_table_name = $wpdb->prefix . 'yikes_easy_mc_forms'; |
@@ -95,12 +96,12 @@ discard block |
||
95 | 96 | |
96 | 97 | // create an option for the date that the user initially activated the plugin |
97 | 98 | // used to display a two week notice, asking for a review or to upgrade |
98 | - if ( ! get_option( 'yikes_easy_mailchimp_activation_date' ) || get_option( 'yikes_easy_mailchimp_activation_date' ) == '' ) { |
|
99 | + if ( ! get_option( 'yikes_easy_mailchimp_activation_date' ) || get_option( 'yikes_easy_mailchimp_activation_date' ) == '' ) { |
|
99 | 100 | update_option( 'yikes_easy_mailchimp_activation_date', strtotime( 'now' ) ); |
100 | 101 | } |
101 | 102 | |
102 | 103 | // Create an option for the forms. |
103 | - if ( class_exists( 'Yikes_Inc_Easy_Mailchimp_Extender_Option_Forms' ) ) { |
|
104 | + if ( class_exists( 'Yikes_Inc_Easy_Mailchimp_Extender_Option_Forms' ) ) { |
|
104 | 105 | $option_class = new Yikes_Inc_Easy_Mailchimp_Extender_Option_Forms(); |
105 | 106 | $option_class->create_option(); |
106 | 107 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @return type The collection of actions and filters registered with WordPress. |
87 | 87 | */ |
88 | 88 | private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) { |
89 | - $hooks[] = array( |
|
89 | + $hooks[ ] = array( |
|
90 | 90 | 'hook' => $hook, |
91 | 91 | 'component' => $component, |
92 | 92 | 'callback' => $callback, |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function run() { |
104 | 104 | foreach ( $this->filters as $hook ) { |
105 | - add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
105 | + add_filter( $hook[ 'hook' ], array( $hook[ 'component' ], $hook[ 'callback' ] ), $hook[ 'priority' ], $hook[ 'accepted_args' ] ); |
|
106 | 106 | } |
107 | 107 | foreach ( $this->actions as $hook ) { |
108 | - add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
108 | + add_action( $hook[ 'hook' ], array( $hook[ 'component' ], $hook[ 'callback' ] ), $hook[ 'priority' ], $hook[ 'accepted_args' ] ); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | } |
112 | 112 | \ No newline at end of file |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @subpackage Yikes_Inc_Easy_Mailchimp_Extender/includes |
20 | 20 | * @author YIKES Inc. <[email protected]> |
21 | 21 | */ |
22 | -class Yikes_Inc_Easy_Mailchimp_Extender_Loader { |
|
22 | +class Yikes_Inc_Easy_Mailchimp_Extender_Loader { |
|
23 | 23 | /** |
24 | 24 | * The array of actions registered with WordPress. |
25 | 25 | * |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @since 6.0.0 |
43 | 43 | */ |
44 | - public function __construct() { |
|
44 | + public function __construct() { |
|
45 | 45 | $this->actions = array(); |
46 | 46 | $this->filters = array(); |
47 | 47 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @param int Optional $priority The priority at which the function should be fired. |
56 | 56 | * @param int Optional $accepted_args The number of arguments that should be passed to the $callback. |
57 | 57 | */ |
58 | - public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
58 | + public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
59 | 59 | $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); |
60 | 60 | } |
61 | 61 | /** |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param int Optional $priority The priority at which the function should be fired. |
69 | 69 | * @param int Optional $accepted_args The number of arguments that should be passed to the $callback. |
70 | 70 | */ |
71 | - public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
71 | + public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
72 | 72 | $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args ); |
73 | 73 | } |
74 | 74 | /** |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @param int Optional $accepted_args The number of arguments that should be passed to the $callback. |
86 | 86 | * @return type The collection of actions and filters registered with WordPress. |
87 | 87 | */ |
88 | - private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) { |
|
88 | + private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) { |
|
89 | 89 | $hooks[] = array( |
90 | 90 | 'hook' => $hook, |
91 | 91 | 'component' => $component, |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @since 6.0.0 |
102 | 102 | */ |
103 | - public function run() { |
|
104 | - foreach ( $this->filters as $hook ) { |
|
103 | + public function run() { |
|
104 | + foreach ( $this->filters as $hook ) { |
|
105 | 105 | add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
106 | 106 | } |
107 | - foreach ( $this->actions as $hook ) { |
|
107 | + foreach ( $this->actions as $hook ) { |
|
108 | 108 | add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
109 | 109 | } |
110 | 110 | } |
@@ -1051,6 +1051,7 @@ discard block |
||
1051 | 1051 | * @param string | $slug | The type of message we're looking for |
1052 | 1052 | * @param string | $response_text| The default response message |
1053 | 1053 | * @param array | $data | An array of data that may be needed to construct the user's error message |
1054 | + * @param string $slug |
|
1054 | 1055 | * @return string| $response_text| The $response_text (after it's potentially been changed) |
1055 | 1056 | */ |
1056 | 1057 | protected function check_for_user_defined_response_message( $slug, $response_text, $data = false ) { |
@@ -1198,6 +1199,7 @@ discard block |
||
1198 | 1199 | * |
1199 | 1200 | * @param string | $message | The response message |
1200 | 1201 | * @param bool | $is_success | Boolean signifying if we're returning a success message or an error message |
1202 | + * @param boolean $is_success |
|
1201 | 1203 | * @return string| The $message wrapping in HTML |
1202 | 1204 | */ |
1203 | 1205 | public function wrap_form_submission_response( $message, $is_success ) { |
@@ -1242,6 +1244,7 @@ discard block |
||
1242 | 1244 | * @param string | $response | The response message to display to the user |
1243 | 1245 | * @param array | $additional_fields | An array of additional fields to return |
1244 | 1246 | * @param bool | $return_response_non_ajax | Boolean deciding if we need to return a message |
1247 | + * @param integer $hide |
|
1245 | 1248 | * |
1246 | 1249 | * @return If AJAX, return $this->yikes_send_json_error(). If not AJAX, return an array || false. |
1247 | 1250 | */ |
@@ -3,234 +3,234 @@ discard block |
||
3 | 3 | class Yikes_Inc_Easy_Mailchimp_Extender_Process_Submission_Handler { |
4 | 4 | |
5 | 5 | /** |
6 | - * A flag signifying whether we're dealing with an AJAX submission or standard form submission |
|
7 | - * |
|
8 | - * @since 6.3.0 |
|
9 | - * @access protected |
|
10 | - * @var bool | $is_ajax |
|
11 | - */ |
|
6 | + * A flag signifying whether we're dealing with an AJAX submission or standard form submission |
|
7 | + * |
|
8 | + * @since 6.3.0 |
|
9 | + * @access protected |
|
10 | + * @var bool | $is_ajax |
|
11 | + */ |
|
12 | 12 | protected $is_ajax; |
13 | 13 | |
14 | 14 | /**** Hardcoded Internal Variables ****/ |
15 | 15 | |
16 | 16 | /** |
17 | - * An array of form fields we don't process |
|
18 | - * |
|
19 | - * @since 6.3.0 |
|
20 | - * @access protected |
|
21 | - * @var array | $skipped_form_fields |
|
22 | - */ |
|
17 | + * An array of form fields we don't process |
|
18 | + * |
|
19 | + * @since 6.3.0 |
|
20 | + * @access protected |
|
21 | + * @var array | $skipped_form_fields |
|
22 | + */ |
|
23 | 23 | protected $skipped_form_fields; |
24 | 24 | |
25 | 25 | /**** Form Variables ****/ |
26 | 26 | |
27 | 27 | /** |
28 | - * The ID of the corresponding YIKES Mailchimp form |
|
29 | - * |
|
30 | - * @since 6.3.0 |
|
31 | - * @access public |
|
32 | - * @var int | $form_id |
|
33 | - */ |
|
28 | + * The ID of the corresponding YIKES Mailchimp form |
|
29 | + * |
|
30 | + * @since 6.3.0 |
|
31 | + * @access public |
|
32 | + * @var int | $form_id |
|
33 | + */ |
|
34 | 34 | public $form_id; |
35 | 35 | |
36 | 36 | /** |
37 | - * The ID of the corresponding Mailchimp list |
|
38 | - * |
|
39 | - * @since 6.3.0 |
|
40 | - * @access public |
|
41 | - * @var int | $list_id |
|
42 | - */ |
|
37 | + * The ID of the corresponding Mailchimp list |
|
38 | + * |
|
39 | + * @since 6.3.0 |
|
40 | + * @access public |
|
41 | + * @var int | $list_id |
|
42 | + */ |
|
43 | 43 | public $list_id; |
44 | 44 | |
45 | 45 | /** |
46 | - * The submitted email |
|
47 | - * |
|
48 | - * @since 6.3.0 |
|
49 | - * @access public |
|
50 | - * @var string | $email |
|
51 | - */ |
|
46 | + * The submitted email |
|
47 | + * |
|
48 | + * @since 6.3.0 |
|
49 | + * @access public |
|
50 | + * @var string | $email |
|
51 | + */ |
|
52 | 52 | public $email; |
53 | 53 | |
54 | 54 | /** |
55 | - * The array of error messages defined by the user and attached to this form |
|
56 | - * |
|
57 | - * @since 6.3.0 |
|
58 | - * @access public |
|
59 | - * @var array | $error_messages |
|
60 | - */ |
|
55 | + * The array of error messages defined by the user and attached to this form |
|
56 | + * |
|
57 | + * @since 6.3.0 |
|
58 | + * @access public |
|
59 | + * @var array | $error_messages |
|
60 | + */ |
|
61 | 61 | public $error_messages; |
62 | 62 | |
63 | 63 | /**** Default Error Messages ****/ |
64 | 64 | |
65 | 65 | /** |
66 | - * The error message for no form ID |
|
67 | - * |
|
68 | - * @since 6.3.0 |
|
69 | - * @access public |
|
70 | - * @var string | $handle_empty_form_id_message |
|
71 | - */ |
|
66 | + * The error message for no form ID |
|
67 | + * |
|
68 | + * @since 6.3.0 |
|
69 | + * @access public |
|
70 | + * @var string | $handle_empty_form_id_message |
|
71 | + */ |
|
72 | 72 | public $handle_empty_form_id_message; |
73 | 73 | |
74 | 74 | /** |
75 | - * The error message for no form found |
|
76 | - * |
|
77 | - * @since 6.3.0 |
|
78 | - * @access public |
|
79 | - * @var string | $handle_empty_form_message |
|
80 | - */ |
|
75 | + * The error message for no form found |
|
76 | + * |
|
77 | + * @since 6.3.0 |
|
78 | + * @access public |
|
79 | + * @var string | $handle_empty_form_message |
|
80 | + */ |
|
81 | 81 | public $handle_empty_form_message; |
82 | 82 | |
83 | 83 | /** |
84 | - * The error message for missing form fields |
|
85 | - * |
|
86 | - * @since 6.3.0 |
|
87 | - * @access public |
|
88 | - * @var string | $handle_empty_fields_generic_message |
|
89 | - */ |
|
84 | + * The error message for missing form fields |
|
85 | + * |
|
86 | + * @since 6.3.0 |
|
87 | + * @access public |
|
88 | + * @var string | $handle_empty_fields_generic_message |
|
89 | + */ |
|
90 | 90 | public $handle_empty_fields_generic_message; |
91 | 91 | |
92 | 92 | /** |
93 | - * The error message for missing $list_handler class |
|
94 | - * |
|
95 | - * @since 6.3.0 |
|
96 | - * @access public |
|
97 | - * @var string | $handle_empty_list_handler_message |
|
98 | - */ |
|
93 | + * The error message for missing $list_handler class |
|
94 | + * |
|
95 | + * @since 6.3.0 |
|
96 | + * @access public |
|
97 | + * @var string | $handle_empty_list_handler_message |
|
98 | + */ |
|
99 | 99 | public $handle_empty_list_handler_message; |
100 | 100 | |
101 | 101 | /** |
102 | - * The error message for no email |
|
103 | - * |
|
104 | - * @since 6.3.0 |
|
105 | - * @access public |
|
106 | - * @var string | $handle_empty_email_message |
|
107 | - */ |
|
102 | + * The error message for no email |
|
103 | + * |
|
104 | + * @since 6.3.0 |
|
105 | + * @access public |
|
106 | + * @var string | $handle_empty_email_message |
|
107 | + */ |
|
108 | 108 | public $handle_empty_email_message; |
109 | 109 | |
110 | 110 | /** |
111 | - * The error message for a filled in honeypot |
|
112 | - * |
|
113 | - * @since 6.3.0 |
|
114 | - * @access public |
|
115 | - * @var string | $handle_non_empty_honeypot_message |
|
116 | - */ |
|
111 | + * The error message for a filled in honeypot |
|
112 | + * |
|
113 | + * @since 6.3.0 |
|
114 | + * @access public |
|
115 | + * @var string | $handle_non_empty_honeypot_message |
|
116 | + */ |
|
117 | 117 | public $handle_non_empty_honeypot_message; |
118 | 118 | |
119 | 119 | /** |
120 | - * The error message for existing users trying to update when it's disallowed |
|
121 | - * |
|
122 | - * @since 6.3.0 |
|
123 | - * @access public |
|
124 | - * @var string | $handle_disallowed_existing_user_update_message |
|
125 | - */ |
|
120 | + * The error message for existing users trying to update when it's disallowed |
|
121 | + * |
|
122 | + * @since 6.3.0 |
|
123 | + * @access public |
|
124 | + * @var string | $handle_disallowed_existing_user_update_message |
|
125 | + */ |
|
126 | 126 | public $handle_disallowed_existing_user_update_message; |
127 | 127 | |
128 | 128 | /** |
129 | - * The first half of the error message for updating an existing user when it's done via a profile link |
|
130 | - * |
|
131 | - * @since 6.3.0 |
|
132 | - * @access public |
|
133 | - * @var string | $handle_updating_existing_user_message |
|
134 | - */ |
|
129 | + * The first half of the error message for updating an existing user when it's done via a profile link |
|
130 | + * |
|
131 | + * @since 6.3.0 |
|
132 | + * @access public |
|
133 | + * @var string | $handle_updating_existing_user_message |
|
134 | + */ |
|
135 | 135 | public $handle_updating_existing_user_message; |
136 | 136 | |
137 | 137 | /** |
138 | - * The second half of the error message (the link) for updating an existing user when it's done via a profile link |
|
139 | - * |
|
140 | - * @since 6.3.0 |
|
141 | - * @access public |
|
142 | - * @var string | $handle_updating_existing_user_link_message |
|
143 | - */ |
|
138 | + * The second half of the error message (the link) for updating an existing user when it's done via a profile link |
|
139 | + * |
|
140 | + * @since 6.3.0 |
|
141 | + * @access public |
|
142 | + * @var string | $handle_updating_existing_user_link_message |
|
143 | + */ |
|
144 | 144 | public $handle_updating_existing_user_link_message; |
145 | 145 | |
146 | 146 | /** |
147 | - * A default, generic error message |
|
148 | - * |
|
149 | - * @since 6.3.0 |
|
150 | - * @access public |
|
151 | - * @var string | $default_error_response_message |
|
152 | - */ |
|
147 | + * A default, generic error message |
|
148 | + * |
|
149 | + * @since 6.3.0 |
|
150 | + * @access public |
|
151 | + * @var string | $default_error_response_message |
|
152 | + */ |
|
153 | 153 | public $default_error_response_message; |
154 | 154 | |
155 | 155 | /** |
156 | - * The error message for not filling out a required form field |
|
157 | - * |
|
158 | - * @since 6.3.0 |
|
159 | - * @access public |
|
160 | - * @var string | $handle_empty_required_field_message |
|
161 | - */ |
|
156 | + * The error message for not filling out a required form field |
|
157 | + * |
|
158 | + * @since 6.3.0 |
|
159 | + * @access public |
|
160 | + * @var string | $handle_empty_required_field_message |
|
161 | + */ |
|
162 | 162 | public $handle_empty_required_field_message; |
163 | 163 | |
164 | 164 | /** |
165 | - * The error message for not filling out a required interest group |
|
166 | - * |
|
167 | - * @since 6.3.0 |
|
168 | - * @access public |
|
169 | - * @var string | $handle_empty_required_interest_group_message |
|
170 | - */ |
|
165 | + * The error message for not filling out a required interest group |
|
166 | + * |
|
167 | + * @since 6.3.0 |
|
168 | + * @access public |
|
169 | + * @var string | $handle_empty_required_interest_group_message |
|
170 | + */ |
|
171 | 171 | public $handle_empty_required_interest_group_message; |
172 | 172 | |
173 | 173 | /** |
174 | - * The error message for nonce failures |
|
175 | - * |
|
176 | - * @since 6.3.0 |
|
177 | - * @access public |
|
178 | - * @var string | $handle_nonce_message |
|
179 | - */ |
|
174 | + * The error message for nonce failures |
|
175 | + * |
|
176 | + * @since 6.3.0 |
|
177 | + * @access public |
|
178 | + * @var string | $handle_nonce_message |
|
179 | + */ |
|
180 | 180 | public $handle_nonce_message; |
181 | 181 | |
182 | 182 | /** |
183 | - * The error message for a recaptcha that is not checked/filled out |
|
184 | - * |
|
185 | - * @since 6.3.0 |
|
186 | - * @access public |
|
187 | - * @var string | $handle_nonce_message |
|
188 | - */ |
|
183 | + * The error message for a recaptcha that is not checked/filled out |
|
184 | + * |
|
185 | + * @since 6.3.0 |
|
186 | + * @access public |
|
187 | + * @var string | $handle_nonce_message |
|
188 | + */ |
|
189 | 189 | public $handle_non_filled_recaptcha_message_message; |
190 | 190 | |
191 | 191 | /** |
192 | - * The error message for recaptcha errors that we're not sure of |
|
193 | - * |
|
194 | - * @since 6.3.0 |
|
195 | - * @access public |
|
196 | - * @var string | $handle_nonce_message |
|
197 | - */ |
|
192 | + * The error message for recaptcha errors that we're not sure of |
|
193 | + * |
|
194 | + * @since 6.3.0 |
|
195 | + * @access public |
|
196 | + * @var string | $handle_nonce_message |
|
197 | + */ |
|
198 | 198 | public $generic_recaptcha_error_message; |
199 | 199 | |
200 | 200 | /**** Default Success Messages ****/ |
201 | 201 | |
202 | 202 | /** |
203 | - * The success message for single-optin forms |
|
204 | - * |
|
205 | - * @since 6.3.0 |
|
206 | - * @access public |
|
207 | - * @var string | $default_response_single_optin_success_message |
|
208 | - */ |
|
203 | + * The success message for single-optin forms |
|
204 | + * |
|
205 | + * @since 6.3.0 |
|
206 | + * @access public |
|
207 | + * @var string | $default_response_single_optin_success_message |
|
208 | + */ |
|
209 | 209 | public $default_response_single_optin_success_message; |
210 | 210 | |
211 | 211 | /** |
212 | - * The default success message for double-optin forms |
|
213 | - * |
|
214 | - * @since 6.3.0 |
|
215 | - * @access public |
|
216 | - * @var string | $default_response_double_optin_success_message |
|
217 | - */ |
|
212 | + * The default success message for double-optin forms |
|
213 | + * |
|
214 | + * @since 6.3.0 |
|
215 | + * @access public |
|
216 | + * @var string | $default_response_double_optin_success_message |
|
217 | + */ |
|
218 | 218 | public $default_response_double_optin_success_message; |
219 | 219 | |
220 | 220 | /** |
221 | - * The default success message for already subscribed users re-subscribing |
|
222 | - * |
|
223 | - * @since 6.3.0 |
|
224 | - * @access public |
|
225 | - * @var string | $existing_subscriber_profile_update_message |
|
226 | - */ |
|
221 | + * The default success message for already subscribed users re-subscribing |
|
222 | + * |
|
223 | + * @since 6.3.0 |
|
224 | + * @access public |
|
225 | + * @var string | $existing_subscriber_profile_update_message |
|
226 | + */ |
|
227 | 227 | public $existing_subscriber_profile_update_message; |
228 | 228 | |
229 | 229 | /** |
230 | - * The construct function - sets all of our hardcoded variables |
|
231 | - * |
|
232 | - * @param bool | $is_ajax | Flag signifying whether this submission request is coming from an AJAX response or basic form submission |
|
233 | - */ |
|
230 | + * The construct function - sets all of our hardcoded variables |
|
231 | + * |
|
232 | + * @param bool | $is_ajax | Flag signifying whether this submission request is coming from an AJAX response or basic form submission |
|
233 | + */ |
|
234 | 234 | public function __construct( $is_ajax ) { |
235 | 235 | |
236 | 236 | // Set up our variables |
@@ -268,45 +268,45 @@ discard block |
||
268 | 268 | /**** Setters for our Form Variables ****/ |
269 | 269 | |
270 | 270 | /** |
271 | - * Set the form ID class property |
|
272 | - * |
|
273 | - * @since 6.3.0 |
|
274 | - * |
|
275 | - * @param int | $form_id | ID of the corresponding YIKES Mailchimp form |
|
276 | - */ |
|
271 | + * Set the form ID class property |
|
272 | + * |
|
273 | + * @since 6.3.0 |
|
274 | + * |
|
275 | + * @param int | $form_id | ID of the corresponding YIKES Mailchimp form |
|
276 | + */ |
|
277 | 277 | public function set_form_id( $form_id ) { |
278 | 278 | $this->form_id = $form_id; |
279 | 279 | } |
280 | 280 | |
281 | 281 | /** |
282 | - * Set the list ID class property |
|
283 | - * |
|
284 | - * @since 6.3.0 |
|
285 | - * |
|
286 | - * @param int | $list_id | ID of the corresponding Mailchimp list |
|
287 | - */ |
|
282 | + * Set the list ID class property |
|
283 | + * |
|
284 | + * @since 6.3.0 |
|
285 | + * |
|
286 | + * @param int | $list_id | ID of the corresponding Mailchimp list |
|
287 | + */ |
|
288 | 288 | public function set_list_id( $list_id ) { |
289 | 289 | $this->list_id = $list_id; |
290 | 290 | } |
291 | 291 | |
292 | 292 | /** |
293 | - * Set the email class property |
|
294 | - * |
|
295 | - * @since 6.3.0 |
|
296 | - * |
|
297 | - * @param string | $sanitized_email | The sanitized email |
|
298 | - */ |
|
293 | + * Set the email class property |
|
294 | + * |
|
295 | + * @since 6.3.0 |
|
296 | + * |
|
297 | + * @param string | $sanitized_email | The sanitized email |
|
298 | + */ |
|
299 | 299 | public function set_email( $sanitized_email ) { |
300 | 300 | $this->email = $sanitized_email; |
301 | 301 | } |
302 | 302 | |
303 | 303 | /** |
304 | - * Set the $error_messages class property |
|
305 | - * |
|
306 | - * @since 6.3.0 |
|
307 | - * |
|
308 | - * @param array | $error_messages | The array of user-defined error messages for this form |
|
309 | - */ |
|
304 | + * Set the $error_messages class property |
|
305 | + * |
|
306 | + * @since 6.3.0 |
|
307 | + * |
|
308 | + * @param array | $error_messages | The array of user-defined error messages for this form |
|
309 | + */ |
|
310 | 310 | public function set_error_messages( $error_messages ) { |
311 | 311 | $this->error_messages = $error_messages; |
312 | 312 | } |
@@ -315,24 +315,24 @@ discard block |
||
315 | 315 | /**** Simple Return Functions ****/ |
316 | 316 | |
317 | 317 | /** |
318 | - * Return a sanitized email |
|
319 | - * |
|
320 | - * @since 6.3.0 |
|
321 | - * |
|
322 | - * @param string | $email | The user's email |
|
323 | - * @return string| $email | The user's email, lowercased and sanitized |
|
324 | - */ |
|
318 | + * Return a sanitized email |
|
319 | + * |
|
320 | + * @since 6.3.0 |
|
321 | + * |
|
322 | + * @param string | $email | The user's email |
|
323 | + * @return string| $email | The user's email, lowercased and sanitized |
|
324 | + */ |
|
325 | 325 | public function get_sanitized_email( $email ) { |
326 | 326 | return sanitize_email( strtolower( $email ) ); |
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
330 | - * Return the class property $skipped_form_fields |
|
331 | - * |
|
332 | - * @since 6.3.0 |
|
333 | - * |
|
334 | - * @return array | $skipped_form_fields |
|
335 | - */ |
|
330 | + * Return the class property $skipped_form_fields |
|
331 | + * |
|
332 | + * @since 6.3.0 |
|
333 | + * |
|
334 | + * @return array | $skipped_form_fields |
|
335 | + */ |
|
336 | 336 | protected function get_skipped_merge_tags() { |
337 | 337 | return $this->skipped_form_fields; |
338 | 338 | } |
@@ -341,14 +341,14 @@ discard block |
||
341 | 341 | /**** Collection of functions handling the incoming form and interest group data ****/ |
342 | 342 | |
343 | 343 | /** |
344 | - * Loop through form data to sanitize, format, filter, and return. |
|
345 | - * |
|
346 | - * @since 6.3.0 |
|
347 | - * |
|
348 | - * @param array | $data | The array of user-submitted form values |
|
349 | - * @param array | $form_fields | The array of form field definitions for this YIKES Mailchimp form |
|
350 | - * @return array| $merge_variables| The array of sanitized and formatted form values |
|
351 | - */ |
|
344 | + * Loop through form data to sanitize, format, filter, and return. |
|
345 | + * |
|
346 | + * @since 6.3.0 |
|
347 | + * |
|
348 | + * @param array | $data | The array of user-submitted form values |
|
349 | + * @param array | $form_fields | The array of form field definitions for this YIKES Mailchimp form |
|
350 | + * @return array| $merge_variables| The array of sanitized and formatted form values |
|
351 | + */ |
|
352 | 352 | public function get_submitted_merge_values( $data, $form_fields ) { |
353 | 353 | |
354 | 354 | // Array to return |
@@ -400,14 +400,14 @@ discard block |
||
400 | 400 | } |
401 | 401 | |
402 | 402 | /** |
403 | - * Sanitize form values and return them |
|
404 | - * |
|
405 | - * @since 6.3.0 |
|
406 | - * |
|
407 | - * @param string | $key | The MERGE/Field-name for this value |
|
408 | - * @param mixed | $value | The form value - this could be an array or a string |
|
409 | - * @return mixed | $sanitized | The $value sanitized |
|
410 | - */ |
|
403 | + * Sanitize form values and return them |
|
404 | + * |
|
405 | + * @since 6.3.0 |
|
406 | + * |
|
407 | + * @param string | $key | The MERGE/Field-name for this value |
|
408 | + * @param mixed | $value | The form value - this could be an array or a string |
|
409 | + * @return mixed | $sanitized | The $value sanitized |
|
410 | + */ |
|
411 | 411 | protected function sanitize_form_values( $key, $value ) { |
412 | 412 | if ( is_scalar( $value ) ) { |
413 | 413 | $sanitized = sanitize_text_field( $value ); |
@@ -421,14 +421,14 @@ discard block |
||
421 | 421 | } |
422 | 422 | |
423 | 423 | /** |
424 | - * Check a date field's date format and pass it along to the appropriate function |
|
425 | - * |
|
426 | - * @since 6.3.0 |
|
427 | - * |
|
428 | - * @param string | $date | The unformatted date value |
|
429 | - * @param string | $date_format | The date format |
|
430 | - * @return string| $date | The date formatted according to the $date_format |
|
431 | - */ |
|
424 | + * Check a date field's date format and pass it along to the appropriate function |
|
425 | + * |
|
426 | + * @since 6.3.0 |
|
427 | + * |
|
428 | + * @param string | $date | The unformatted date value |
|
429 | + * @param string | $date_format | The date format |
|
430 | + * @return string| $date | The date formatted according to the $date_format |
|
431 | + */ |
|
432 | 432 | protected function handle_date_format_merge_values( $date, $date_format ) { |
433 | 433 | // Check if EU date format (for dates: 'DD/MM/YYYY', for birthdays: 'DD/MM') |
434 | 434 | if ( 'DD/MM/YYYY' === $date_format ) { |
@@ -441,13 +441,13 @@ discard block |
||
441 | 441 | } |
442 | 442 | |
443 | 443 | /** |
444 | - * Format a date field whose date format is dd/mm/yyyy |
|
445 | - * |
|
446 | - * @since 6.3.0 |
|
447 | - * |
|
448 | - * @param string | $date | A date in the format dd/mm/yyyy |
|
449 | - * @return string| $date | A date in the format mm/dd/yyyy |
|
450 | - */ |
|
444 | + * Format a date field whose date format is dd/mm/yyyy |
|
445 | + * |
|
446 | + * @since 6.3.0 |
|
447 | + * |
|
448 | + * @param string | $date | A date in the format dd/mm/yyyy |
|
449 | + * @return string| $date | A date in the format mm/dd/yyyy |
|
450 | + */ |
|
451 | 451 | protected function handle_dd_mm_yyyy_date( $date ) { |
452 | 452 | |
453 | 453 | // Mailchimp wants the dates as 'MM/DD/YYYY' regardless of user-specified format, so convert |
@@ -466,13 +466,13 @@ discard block |
||
466 | 466 | } |
467 | 467 | |
468 | 468 | /** |
469 | - * Format a birthday field whose date format is dd/mm |
|
470 | - * |
|
471 | - * @since 6.3.0 |
|
472 | - * |
|
473 | - * @param string | $birthday | A date in the format dd/mm |
|
474 | - * @return string| $birthday | A date in the format mm/dd |
|
475 | - */ |
|
469 | + * Format a birthday field whose date format is dd/mm |
|
470 | + * |
|
471 | + * @since 6.3.0 |
|
472 | + * |
|
473 | + * @param string | $birthday | A date in the format dd/mm |
|
474 | + * @return string| $birthday | A date in the format mm/dd |
|
475 | + */ |
|
476 | 476 | protected function handle_dd_mm_birthday( $birthday ) { |
477 | 477 | |
478 | 478 | // Mailchimp wants the birthdays as 'MM/DD' regardless of user-specified format, so convert |
@@ -492,14 +492,14 @@ discard block |
||
492 | 492 | |
493 | 493 | |
494 | 494 | /** |
495 | - * Create an array of available interest groups based on the $replace_interests flag |
|
496 | - * |
|
497 | - * @since 6.3.0 |
|
498 | - * |
|
499 | - * @param bool | $replace_interests| True if we're replacing interest groups, false if updating interest groups |
|
500 | - * @param class | $list_class | Class for interacting with the current list |
|
501 | - * @return array | $groups | Array of interest groups |
|
502 | - */ |
|
495 | + * Create an array of available interest groups based on the $replace_interests flag |
|
496 | + * |
|
497 | + * @since 6.3.0 |
|
498 | + * |
|
499 | + * @param bool | $replace_interests| True if we're replacing interest groups, false if updating interest groups |
|
500 | + * @param class | $list_class | Class for interacting with the current list |
|
501 | + * @return array | $groups | Array of interest groups |
|
502 | + */ |
|
503 | 503 | public function get_default_interest_groups( $replace_interests, $list_class ) { |
504 | 504 | |
505 | 505 | // If $replace_interests flag is true then loop through interest groups and set them all to false to start. |
@@ -537,15 +537,15 @@ discard block |
||
537 | 537 | |
538 | 538 | |
539 | 539 | /** |
540 | - * Loop through the interest group form data to sanitize, format, filter, and return. |
|
541 | - * |
|
542 | - * @since 6.3.0 |
|
543 | - * |
|
544 | - * @param array | $data | The array of user-submitted form values |
|
545 | - * @param array | $form_fields | The array of form field definitions for this YIKES Mailchimp form |
|
546 | - * @param array | $groups | The array of interest groups created by `get_default_interest_groups()` |
|
547 | - * @return array| $groups | The array of sanitized and formatted form values |
|
548 | - */ |
|
540 | + * Loop through the interest group form data to sanitize, format, filter, and return. |
|
541 | + * |
|
542 | + * @since 6.3.0 |
|
543 | + * |
|
544 | + * @param array | $data | The array of user-submitted form values |
|
545 | + * @param array | $form_fields | The array of form field definitions for this YIKES Mailchimp form |
|
546 | + * @param array | $groups | The array of interest groups created by `get_default_interest_groups()` |
|
547 | + * @return array| $groups | The array of sanitized and formatted form values |
|
548 | + */ |
|
549 | 549 | public function get_submitted_interest_groups( $data, $form_fields, $groups ) { |
550 | 550 | |
551 | 551 | // loop to push variables to our array |
@@ -574,13 +574,13 @@ discard block |
||
574 | 574 | } |
575 | 575 | |
576 | 576 | /** |
577 | - * yikes-mailchimp-filter-groups-before-submission |
|
578 | - * |
|
579 | - * Catch the interest groups before they get sent over to Mailchimp |
|
580 | - * @param array | $groups | User submitted interest group data |
|
581 | - * @optional int| $form_id| the ID of the form to filter |
|
582 | - * @since 6.3.0 |
|
583 | - */ |
|
577 | + * yikes-mailchimp-filter-groups-before-submission |
|
578 | + * |
|
579 | + * Catch the interest groups before they get sent over to Mailchimp |
|
580 | + * @param array | $groups | User submitted interest group data |
|
581 | + * @optional int| $form_id| the ID of the form to filter |
|
582 | + * @since 6.3.0 |
|
583 | + */ |
|
584 | 584 | $groups = apply_filters( 'yikes-mailchimp-filter-groups-before-submission', $groups, $this->form_id ); |
585 | 585 | $groups = apply_filters( 'yikes-mailchimp-filter-groups-before-submission-{$this->form_id}', $groups, $this->form_id ); |
586 | 586 | |
@@ -591,17 +591,17 @@ discard block |
||
591 | 591 | /**** Functions to Handle Subscribe API Response ****/ |
592 | 592 | |
593 | 593 | /** |
594 | - * Handle the response to a successful subscribe request |
|
595 | - * |
|
596 | - * @since 6.3.0 |
|
597 | - * |
|
598 | - * @param array | $submission_settings | Array of the form's submission settings |
|
599 | - * @param array | $page_data | Array of the page data |
|
600 | - * @param array | $merge_variables | Array of the submitted form variables |
|
601 | - * @param array | $notifications | Literally don't know what this is yet. |
|
602 | - * @param array | $optin_settings | Array of the form's optin settings |
|
603 | - * @param bool | $new_subscriber | True if a new subscriber, false if an existing one |
|
604 | - */ |
|
594 | + * Handle the response to a successful subscribe request |
|
595 | + * |
|
596 | + * @since 6.3.0 |
|
597 | + * |
|
598 | + * @param array | $submission_settings | Array of the form's submission settings |
|
599 | + * @param array | $page_data | Array of the page data |
|
600 | + * @param array | $merge_variables | Array of the submitted form variables |
|
601 | + * @param array | $notifications | Literally don't know what this is yet. |
|
602 | + * @param array | $optin_settings | Array of the form's optin settings |
|
603 | + * @param bool | $new_subscriber | True if a new subscriber, false if an existing one |
|
604 | + */ |
|
605 | 605 | public function handle_submission_response_success( $submission_settings, $page_data, $merge_variables, $notifications, $optin_settings, $new_subscriber ) { |
606 | 606 | |
607 | 607 | // Check if we should redirect, and collect the redirect info in an array |
@@ -610,27 +610,27 @@ discard block |
||
610 | 610 | // Fire off our actions |
611 | 611 | |
612 | 612 | /** |
613 | - * yikes-mailchimp-after-submission || yikes-mailchimp-after-submission-{$form_id} |
|
614 | - * |
|
615 | - * Catch the merge variables after they've been sent over to Mailchimp |
|
616 | - * @since 6.0.0 |
|
617 | - * |
|
618 | - * @param array | $merge_variables | The array of user submitted form data |
|
619 | - */ |
|
613 | + * yikes-mailchimp-after-submission || yikes-mailchimp-after-submission-{$form_id} |
|
614 | + * |
|
615 | + * Catch the merge variables after they've been sent over to Mailchimp |
|
616 | + * @since 6.0.0 |
|
617 | + * |
|
618 | + * @param array | $merge_variables | The array of user submitted form data |
|
619 | + */ |
|
620 | 620 | do_action( 'yikes-mailchimp-after-submission', $merge_variables, $this->form_id ); |
621 | 621 | do_action( "yikes-mailchimp-after-submission-{$this->form_id}", $merge_variables, $this->form_id ); |
622 | 622 | |
623 | 623 | /** |
624 | - * yikes-mailchimp-form-submission || yikes-mailchimp-form-submission-{$form_id} |
|
625 | - * |
|
626 | - * Catch our notifications and other form data |
|
627 | - * |
|
628 | - * @param string | $email | The user's email |
|
629 | - * @param array | $merge_variables | The array of user submitted form data |
|
630 | - * @param string | $form_id | The form ID |
|
631 | - * @param array | $notifications | Array of notification messages |
|
632 | - * |
|
633 | - */ |
|
624 | + * yikes-mailchimp-form-submission || yikes-mailchimp-form-submission-{$form_id} |
|
625 | + * |
|
626 | + * Catch our notifications and other form data |
|
627 | + * |
|
628 | + * @param string | $email | The user's email |
|
629 | + * @param array | $merge_variables | The array of user submitted form data |
|
630 | + * @param string | $form_id | The form ID |
|
631 | + * @param array | $notifications | Array of notification messages |
|
632 | + * |
|
633 | + */ |
|
634 | 634 | do_action( 'yikes-mailchimp-form-submission', $this->email, $merge_variables, $this->form_id, $notifications ); |
635 | 635 | do_action( "yikes-mailchimp-form-submission-{$this->form_id}", $this->email, $merge_variables, $this->form_id, $notifications ); |
636 | 636 | |
@@ -652,15 +652,15 @@ discard block |
||
652 | 652 | $default_response = ( $new_subscriber === false ) ? $this->check_for_user_defined_response_message( 'success-resubscribed', $this->existing_subscriber_profile_update_message ) : $default_response; |
653 | 653 | |
654 | 654 | /** |
655 | - * yikes-mailchimp-success-response |
|
656 | - * |
|
657 | - * Filter the success message displayed to the user |
|
658 | - * |
|
659 | - * @param string | $default_response | The response message that will be shown to the user if unchanged (see above for logic) |
|
660 | - * @param string | $form_id | The form ID |
|
661 | - * @param array | $merge_variables | The array of user submitted form data |
|
662 | - * |
|
663 | - */ |
|
655 | + * yikes-mailchimp-success-response |
|
656 | + * |
|
657 | + * Filter the success message displayed to the user |
|
658 | + * |
|
659 | + * @param string | $default_response | The response message that will be shown to the user if unchanged (see above for logic) |
|
660 | + * @param string | $form_id | The form ID |
|
661 | + * @param array | $merge_variables | The array of user submitted form data |
|
662 | + * |
|
663 | + */ |
|
664 | 664 | $response_message = apply_filters( 'yikes-mailchimp-success-response', $default_response, $this->form_id, $merge_variables ); |
665 | 665 | |
666 | 666 | // Construct our success array variables |
@@ -679,13 +679,13 @@ discard block |
||
679 | 679 | } |
680 | 680 | |
681 | 681 | /** |
682 | - * Handle an unsuccessful/error subscribe request |
|
683 | - * |
|
684 | - * @since 6.3.0 |
|
685 | - * |
|
686 | - * @param object | $subscribe_response | The response from the API |
|
687 | - * @param array | $form_fields | The array of form field definitions for this YIKES Mailchimp form |
|
688 | - */ |
|
682 | + * Handle an unsuccessful/error subscribe request |
|
683 | + * |
|
684 | + * @since 6.3.0 |
|
685 | + * |
|
686 | + * @param object | $subscribe_response | The response from the API |
|
687 | + * @param array | $form_fields | The array of form field definitions for this YIKES Mailchimp form |
|
688 | + */ |
|
689 | 689 | public function handle_submission_response_error( $subscribe_response, $form_fields ) { |
690 | 690 | |
691 | 691 | // Get the error data |
@@ -727,13 +727,13 @@ discard block |
||
727 | 727 | // Note: All of these functions return `return $this->yikes_fail()`. Check function for more info. |
728 | 728 | |
729 | 729 | /** |
730 | - * Check if the submitted form data is missing any required fields |
|
731 | - * |
|
732 | - * @since 6.3.0 |
|
733 | - * |
|
734 | - * @param array | $data | The array of user-submitted form values |
|
735 | - * @param array | $form_fields | The array of form field definitions for this YIKES Mailchimp form |
|
736 | - */ |
|
730 | + * Check if the submitted form data is missing any required fields |
|
731 | + * |
|
732 | + * @since 6.3.0 |
|
733 | + * |
|
734 | + * @param array | $data | The array of user-submitted form values |
|
735 | + * @param array | $form_fields | The array of form field definitions for this YIKES Mailchimp form |
|
736 | + */ |
|
737 | 737 | public function check_for_required_form_fields( $data, $form_fields ) { |
738 | 738 | |
739 | 739 | // Set up our defaults |
@@ -758,15 +758,15 @@ discard block |
||
758 | 758 | foreach( $value as $field => $val ) { |
759 | 759 | |
760 | 760 | /** |
761 | - * 'yikes-mailchimp-ignore-required-array-field' |
|
762 | - * |
|
763 | - * Filter the default array of fields we're ignoring. As of now, this is only for address fields because no other field is an array. |
|
764 | - * |
|
765 | - * @param array | Array of fields to ignore. Key of the array should be the field name. |
|
766 | - * @param int | $form_id |
|
767 | - * |
|
768 | - * @return Array of fields to ignore. |
|
769 | - */ |
|
761 | + * 'yikes-mailchimp-ignore-required-array-field' |
|
762 | + * |
|
763 | + * Filter the default array of fields we're ignoring. As of now, this is only for address fields because no other field is an array. |
|
764 | + * |
|
765 | + * @param array | Array of fields to ignore. Key of the array should be the field name. |
|
766 | + * @param int | $form_id |
|
767 | + * |
|
768 | + * @return Array of fields to ignore. |
|
769 | + */ |
|
770 | 770 | $ignored_fields = apply_filters( 'yikes-mailchimp-ignore-required-array-field', array( 'addr2' => true ), $this->form_id ); |
771 | 771 | |
772 | 772 | if ( empty( $val ) && ! isset( $ignored_fields[ $field ] ) ) { |
@@ -797,14 +797,14 @@ discard block |
||
797 | 797 | ); |
798 | 798 | |
799 | 799 | /** |
800 | - * yikes-mailchimp-required-form-field-missing |
|
801 | - * |
|
802 | - * Alter the response message shown to the user for missing required form fields |
|
803 | - * |
|
804 | - * @param string | $handle_empty_required_field_message | The default message displayed to the user |
|
805 | - * @param int | $form_id | The ID of the form |
|
806 | - * @param array | $missing_fields | Array of the missing required fields |
|
807 | - */ |
|
800 | + * yikes-mailchimp-required-form-field-missing |
|
801 | + * |
|
802 | + * Alter the response message shown to the user for missing required form fields |
|
803 | + * |
|
804 | + * @param string | $handle_empty_required_field_message | The default message displayed to the user |
|
805 | + * @param int | $form_id | The ID of the form |
|
806 | + * @param array | $missing_fields | Array of the missing required fields |
|
807 | + */ |
|
808 | 808 | $default_response = apply_filters( 'yikes-mailchimp-required-form-field-missing', $this->handle_empty_required_field_message, $this->form_id, $missing_fields ); |
809 | 809 | |
810 | 810 | // If we've found a missing field, return the array of field data |
@@ -813,13 +813,13 @@ discard block |
||
813 | 813 | } |
814 | 814 | |
815 | 815 | /** |
816 | - * Check if the submitted form interest group data is missing any required fields |
|
817 | - * |
|
818 | - * @since 6.3.0 |
|
819 | - * |
|
820 | - * @param array | $data | The array of user-submitted form values |
|
821 | - * @param array | $form_fields | The array of form field definitions for this YIKES Mailchimp form |
|
822 | - */ |
|
816 | + * Check if the submitted form interest group data is missing any required fields |
|
817 | + * |
|
818 | + * @since 6.3.0 |
|
819 | + * |
|
820 | + * @param array | $data | The array of user-submitted form values |
|
821 | + * @param array | $form_fields | The array of form field definitions for this YIKES Mailchimp form |
|
822 | + */ |
|
823 | 823 | public function check_for_required_interest_groups( $data, $form_fields ) { |
824 | 824 | |
825 | 825 | // Set up our defaults |
@@ -853,14 +853,14 @@ discard block |
||
853 | 853 | ); |
854 | 854 | |
855 | 855 | /** |
856 | - * yikes-mailchimp-required-interest-group-missing |
|
857 | - * |
|
858 | - * Alter the response message shown to the user for missing required form fields |
|
859 | - * |
|
860 | - * @param string | $handle_empty_required_interest_group_message | The default message displayed to the user |
|
861 | - * @param int | $form_id | The ID of the form |
|
862 | - * @param array | $missing_fields | Array of the missing required fields |
|
863 | - */ |
|
856 | + * yikes-mailchimp-required-interest-group-missing |
|
857 | + * |
|
858 | + * Alter the response message shown to the user for missing required form fields |
|
859 | + * |
|
860 | + * @param string | $handle_empty_required_interest_group_message | The default message displayed to the user |
|
861 | + * @param int | $form_id | The ID of the form |
|
862 | + * @param array | $missing_fields | Array of the missing required fields |
|
863 | + */ |
|
864 | 864 | $default_response = apply_filters( 'yikes-mailchimp-required-interest-group-missing', $this->handle_empty_required_interest_group_message, $this->form_id, $missing_fields ); |
865 | 865 | |
866 | 866 | // If we find a required interest group with an empty value, send an error |
@@ -869,13 +869,13 @@ discard block |
||
869 | 869 | } |
870 | 870 | |
871 | 871 | /** |
872 | - * Handle the reCAPTCHA |
|
873 | - * |
|
874 | - * @since 6.3.0 |
|
875 | - * |
|
876 | - * @param string | $recaptcha_response | The form value of the recaptcha field |
|
877 | - * @param int | $version | The version of recaptcha to use. |
|
878 | - */ |
|
872 | + * Handle the reCAPTCHA |
|
873 | + * |
|
874 | + * @since 6.3.0 |
|
875 | + * |
|
876 | + * @param string | $recaptcha_response | The form value of the recaptcha field |
|
877 | + * @param int | $version | The version of recaptcha to use. |
|
878 | + */ |
|
879 | 879 | public function handle_recaptcha( $recaptcha_response, $version = 2 ) { |
880 | 880 | |
881 | 881 | // Before we the hit the API, let's check that we actually got a response. |
@@ -883,11 +883,11 @@ discard block |
||
883 | 883 | if ( empty( $recaptcha_response ) ) { |
884 | 884 | |
885 | 885 | /** |
886 | - * yikes-mailchimp-recaptcha-required-error |
|
887 | - * |
|
888 | - * Catch the recaptcha errors before they're returned to the user |
|
889 | - * @param string | $recaptcha_errors | A string of recaptcha errors separated by a space |
|
890 | - */ |
|
886 | + * yikes-mailchimp-recaptcha-required-error |
|
887 | + * |
|
888 | + * Catch the recaptcha errors before they're returned to the user |
|
889 | + * @param string | $recaptcha_errors | A string of recaptcha errors separated by a space |
|
890 | + */ |
|
891 | 891 | $response = apply_filters( 'yikes-mailchimp-recaptcha-required-error', $this->handle_non_filled_recaptcha_message_message, $this->form_id ); |
892 | 892 | return $this->yikes_fail( $hide = 0, $error = 1, $response, array(), $return_response_non_ajax = true ); |
893 | 893 | } |
@@ -932,40 +932,40 @@ discard block |
||
932 | 932 | } |
933 | 933 | |
934 | 934 | /** |
935 | - * yikes-mailchimp-recaptcha-required-error |
|
936 | - * |
|
937 | - * Catch the recaptcha errors before they're returned to the user |
|
938 | - * @param string | $recaptcha_errors | A string of recaptcha errors separated by a space |
|
939 | - */ |
|
935 | + * yikes-mailchimp-recaptcha-required-error |
|
936 | + * |
|
937 | + * Catch the recaptcha errors before they're returned to the user |
|
938 | + * @param string | $recaptcha_errors | A string of recaptcha errors separated by a space |
|
939 | + */ |
|
940 | 940 | $response = apply_filters( 'yikes-mailchimp-recaptcha-required-error', implode( ' ', $recaptcha_errors ), $this->form_id ); |
941 | 941 | return $this->yikes_fail( $hide = 0, $error = 1, $response, array(), $return_response_non_ajax = true ); |
942 | 942 | } |
943 | 943 | } |
944 | 944 | |
945 | 945 | /** |
946 | - * Handle the nonce field |
|
947 | - * |
|
948 | - * @since 6.3.0 |
|
949 | - * |
|
950 | - * @param string | $nonce_value | The form value of the nonce |
|
951 | - * @param string | $nonce_name | The name of the nonce |
|
952 | - */ |
|
946 | + * Handle the nonce field |
|
947 | + * |
|
948 | + * @since 6.3.0 |
|
949 | + * |
|
950 | + * @param string | $nonce_value | The form value of the nonce |
|
951 | + * @param string | $nonce_name | The name of the nonce |
|
952 | + */ |
|
953 | 953 | public function handle_nonce( $nonce_value, $nonce_name ) { |
954 | 954 | |
955 | 955 | // First, check our option - this is set in the general settings page |
956 | 956 | if ( get_option( 'yikes-mailchimp-use-nonce' ) === '1' ) { |
957 | 957 | |
958 | 958 | /** |
959 | - * yikes-mailchimp-use-nonce-verification |
|
960 | - * |
|
961 | - * Decide if we're going to check the nonce value. |
|
962 | - * The reason we filter this is that some users are experiencing nonce issues repeatedly. |
|
963 | - * The default will always be to use the nonce. |
|
964 | - * |
|
965 | - * @param int | $form_id | The form id |
|
966 | - * |
|
967 | - * @return bool | True if we should check the nonce |
|
968 | - */ |
|
959 | + * yikes-mailchimp-use-nonce-verification |
|
960 | + * |
|
961 | + * Decide if we're going to check the nonce value. |
|
962 | + * The reason we filter this is that some users are experiencing nonce issues repeatedly. |
|
963 | + * The default will always be to use the nonce. |
|
964 | + * |
|
965 | + * @param int | $form_id | The form id |
|
966 | + * |
|
967 | + * @return bool | True if we should check the nonce |
|
968 | + */ |
|
969 | 969 | $use_nonce = apply_filters( 'yikes-mailchimp-use-nonce-verification', true, $this->form_id ); |
970 | 970 | |
971 | 971 | // We let the filter override the option because the filter is on a per-form basis |
@@ -978,24 +978,24 @@ discard block |
||
978 | 978 | } |
979 | 979 | |
980 | 980 | /** |
981 | - * Handle a merge_variables error |
|
982 | - * |
|
983 | - * @since 6.3.0 |
|
984 | - * |
|
985 | - * @param int | $error | Int $error = 1 if an error |
|
986 | - * @param string | $message | The message shown to the user |
|
987 | - */ |
|
981 | + * Handle a merge_variables error |
|
982 | + * |
|
983 | + * @since 6.3.0 |
|
984 | + * |
|
985 | + * @param int | $error | Int $error = 1 if an error |
|
986 | + * @param string | $message | The message shown to the user |
|
987 | + */ |
|
988 | 988 | public function handle_merge_variables_error( $error, $message ) { |
989 | 989 | return $this->yikes_fail( $hide = 0, $error, $message, array(), $return_response_non_ajax = true ); |
990 | 990 | } |
991 | 991 | |
992 | 992 | /** |
993 | - * Handle an empty email field and return the corresponding error message |
|
994 | - * |
|
995 | - * @since 6.3.0 |
|
996 | - * |
|
997 | - * @param string | $email |
|
998 | - */ |
|
993 | + * Handle an empty email field and return the corresponding error message |
|
994 | + * |
|
995 | + * @since 6.3.0 |
|
996 | + * |
|
997 | + * @param string | $email |
|
998 | + */ |
|
999 | 999 | public function handle_empty_email( $email ) { |
1000 | 1000 | if ( empty( $email ) ) { |
1001 | 1001 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_email_message ); |
@@ -1003,12 +1003,12 @@ discard block |
||
1003 | 1003 | } |
1004 | 1004 | |
1005 | 1005 | /** |
1006 | - * Check if the form is empty and return the corresponding error message |
|
1007 | - * |
|
1008 | - * @since 6.3.0 |
|
1009 | - * |
|
1010 | - * @param array | $form_data |
|
1011 | - */ |
|
1006 | + * Check if the form is empty and return the corresponding error message |
|
1007 | + * |
|
1008 | + * @since 6.3.0 |
|
1009 | + * |
|
1010 | + * @param array | $form_data |
|
1011 | + */ |
|
1012 | 1012 | public function handle_empty_form( $form_data ) { |
1013 | 1013 | if ( empty( $form_data ) ) { |
1014 | 1014 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_form_message ); |
@@ -1016,12 +1016,12 @@ discard block |
||
1016 | 1016 | } |
1017 | 1017 | |
1018 | 1018 | /** |
1019 | - * Check if the honeypot is NOT empty and return the corresponding error message |
|
1020 | - * |
|
1021 | - * @since 6.3.0 |
|
1022 | - * |
|
1023 | - * @param bool | $honey_pot_filled | True if the honeypot was filled out |
|
1024 | - */ |
|
1019 | + * Check if the honeypot is NOT empty and return the corresponding error message |
|
1020 | + * |
|
1021 | + * @since 6.3.0 |
|
1022 | + * |
|
1023 | + * @param bool | $honey_pot_filled | True if the honeypot was filled out |
|
1024 | + */ |
|
1025 | 1025 | public function handle_non_empty_honeypot( $honey_pot_filled ) { |
1026 | 1026 | if ( $honey_pot_filled === true ) { |
1027 | 1027 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_non_empty_honeypot_message ); |
@@ -1029,12 +1029,12 @@ discard block |
||
1029 | 1029 | } |
1030 | 1030 | |
1031 | 1031 | /** |
1032 | - * Loop through fields looking for null and return the corresponding error message |
|
1033 | - * |
|
1034 | - * @since 6.3.0 |
|
1035 | - * |
|
1036 | - * @param array | $fields_array | An array of fields to loop through and make sure they're not null |
|
1037 | - */ |
|
1032 | + * Loop through fields looking for null and return the corresponding error message |
|
1033 | + * |
|
1034 | + * @since 6.3.0 |
|
1035 | + * |
|
1036 | + * @param array | $fields_array | An array of fields to loop through and make sure they're not null |
|
1037 | + */ |
|
1038 | 1038 | public function handle_empty_fields_generic( $fields_array ) { |
1039 | 1039 | foreach( $fields_array as $field ) { |
1040 | 1040 | if ( $field === null ) { |
@@ -1044,12 +1044,12 @@ discard block |
||
1044 | 1044 | } |
1045 | 1045 | |
1046 | 1046 | /** |
1047 | - * Check if the list handler is empty and return the corresponding error message |
|
1048 | - * |
|
1049 | - * @since 6.3.0 |
|
1050 | - * |
|
1051 | - * @param class | $list_handler | A class that handles list functions |
|
1052 | - */ |
|
1047 | + * Check if the list handler is empty and return the corresponding error message |
|
1048 | + * |
|
1049 | + * @since 6.3.0 |
|
1050 | + * |
|
1051 | + * @param class | $list_handler | A class that handles list functions |
|
1052 | + */ |
|
1053 | 1053 | public function handle_empty_list_handler( $list_handler ) { |
1054 | 1054 | if ( empty( $list_handler ) ) { |
1055 | 1055 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_list_handler_message ); |
@@ -1057,12 +1057,12 @@ discard block |
||
1057 | 1057 | } |
1058 | 1058 | |
1059 | 1059 | /** |
1060 | - * Check if the form id is empty and return the corresponding error message |
|
1061 | - * |
|
1062 | - * @since 6.3.0 |
|
1063 | - * |
|
1064 | - * @param int | $form_id | The form ID |
|
1065 | - */ |
|
1060 | + * Check if the form id is empty and return the corresponding error message |
|
1061 | + * |
|
1062 | + * @since 6.3.0 |
|
1063 | + * |
|
1064 | + * @param int | $form_id | The form ID |
|
1065 | + */ |
|
1066 | 1066 | public function handle_empty_form_id( $form_id ) { |
1067 | 1067 | if ( empty( $form_id ) ) { |
1068 | 1068 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_form_id_message ); |
@@ -1070,10 +1070,10 @@ discard block |
||
1070 | 1070 | } |
1071 | 1071 | |
1072 | 1072 | /** |
1073 | - * Construct and filter the error message related to user's re-subscribing when it's not allowed |
|
1074 | - * |
|
1075 | - * @since 6.3.0 |
|
1076 | - */ |
|
1073 | + * Construct and filter the error message related to user's re-subscribing when it's not allowed |
|
1074 | + * |
|
1075 | + * @since 6.3.0 |
|
1076 | + */ |
|
1077 | 1077 | public function handle_disallowed_existing_user_update() { |
1078 | 1078 | |
1079 | 1079 | // Get the default response |
@@ -1086,10 +1086,10 @@ discard block |
||
1086 | 1086 | } |
1087 | 1087 | |
1088 | 1088 | /** |
1089 | - * Construct and filter the error message related to the profile link to update user's profile |
|
1090 | - * |
|
1091 | - * @since 6.3.0 |
|
1092 | - */ |
|
1089 | + * Construct and filter the error message related to the profile link to update user's profile |
|
1090 | + * |
|
1091 | + * @since 6.3.0 |
|
1092 | + */ |
|
1093 | 1093 | public function handle_updating_existing_user() { |
1094 | 1094 | |
1095 | 1095 | // Get the first half of the message |
@@ -1114,15 +1114,15 @@ discard block |
||
1114 | 1114 | /**** Helper Functions ****/ |
1115 | 1115 | |
1116 | 1116 | /** |
1117 | - * Check the user-defined $error_messages array for a message, filter it, and return it. These messages overwrite the defaults. |
|
1118 | - * |
|
1119 | - * @since 6.3.0 |
|
1120 | - * |
|
1121 | - * @param string | $slug | The type of message we're looking for |
|
1122 | - * @param string | $response_text| The default response message |
|
1123 | - * @param array | $data | An array of data that may be needed to construct the user's error message |
|
1124 | - * @return string| $response_text| The $response_text (after it's potentially been changed) |
|
1125 | - */ |
|
1117 | + * Check the user-defined $error_messages array for a message, filter it, and return it. These messages overwrite the defaults. |
|
1118 | + * |
|
1119 | + * @since 6.3.0 |
|
1120 | + * |
|
1121 | + * @param string | $slug | The type of message we're looking for |
|
1122 | + * @param string | $response_text| The default response message |
|
1123 | + * @param array | $data | An array of data that may be needed to construct the user's error message |
|
1124 | + * @return string| $response_text| The $response_text (after it's potentially been changed) |
|
1125 | + */ |
|
1126 | 1126 | protected function check_for_user_defined_response_message( $slug, $response_text, $data = false ) { |
1127 | 1127 | |
1128 | 1128 | switch( $slug ) { |
@@ -1136,13 +1136,13 @@ discard block |
||
1136 | 1136 | } |
1137 | 1137 | |
1138 | 1138 | /** |
1139 | - * yikes-easy-mailchimp-user-already-subscribed-text |
|
1140 | - * |
|
1141 | - * Catch the message for user's already subscrbed before we show it to the user |
|
1142 | - * @param string | $message | The response message |
|
1143 | - * @param int | $form_id | The form id |
|
1144 | - * @param string | $email | The user's email |
|
1145 | - */ |
|
1139 | + * yikes-easy-mailchimp-user-already-subscribed-text |
|
1140 | + * |
|
1141 | + * Catch the message for user's already subscrbed before we show it to the user |
|
1142 | + * @param string | $message | The response message |
|
1143 | + * @param int | $form_id | The form id |
|
1144 | + * @param string | $email | The user's email |
|
1145 | + */ |
|
1146 | 1146 | $response_text = apply_filters( 'yikes-mailchimp-user-already-subscribed-text', $response_text, $this->form_id, $this->email ); |
1147 | 1147 | |
1148 | 1148 | return $response_text; |
@@ -1161,13 +1161,13 @@ discard block |
||
1161 | 1161 | } |
1162 | 1162 | |
1163 | 1163 | /** |
1164 | - * yikes-easy-mailchimp-user-already-subscribed-link-text |
|
1165 | - * |
|
1166 | - * Catch the message for user's already subscrbed link text before we show it to the user |
|
1167 | - * |
|
1168 | - * @param string | $response_text | The response message that will be shown to the user |
|
1169 | - * @param string | $form_id | The form ID |
|
1170 | - */ |
|
1164 | + * yikes-easy-mailchimp-user-already-subscribed-link-text |
|
1165 | + * |
|
1166 | + * Catch the message for user's already subscrbed link text before we show it to the user |
|
1167 | + * |
|
1168 | + * @param string | $response_text | The response message that will be shown to the user |
|
1169 | + * @param string | $form_id | The form ID |
|
1170 | + */ |
|
1171 | 1171 | $response_text = apply_filters( 'yikes-mailchimp-user-already-subscribed-link-text', $response_text, $this->form_id ); |
1172 | 1172 | |
1173 | 1173 | return $response_text; |
@@ -1181,14 +1181,14 @@ discard block |
||
1181 | 1181 | } |
1182 | 1182 | |
1183 | 1183 | /** |
1184 | - * yikes-mailchimp-success-double-optin-response |
|
1185 | - * |
|
1186 | - * Filter the success message displayed to the user |
|
1187 | - * |
|
1188 | - * @param string | $response_text | The response message that will be shown to the user |
|
1189 | - * @param string | $form_id | The form ID |
|
1190 | - * |
|
1191 | - */ |
|
1184 | + * yikes-mailchimp-success-double-optin-response |
|
1185 | + * |
|
1186 | + * Filter the success message displayed to the user |
|
1187 | + * |
|
1188 | + * @param string | $response_text | The response message that will be shown to the user |
|
1189 | + * @param string | $form_id | The form ID |
|
1190 | + * |
|
1191 | + */ |
|
1192 | 1192 | $response_text = apply_filters( 'yikes-mailchimp-success-double-optin-response', $response_text, $this->form_id ); |
1193 | 1193 | |
1194 | 1194 | return $response_text; |
@@ -1201,14 +1201,14 @@ discard block |
||
1201 | 1201 | } |
1202 | 1202 | |
1203 | 1203 | /** |
1204 | - * yikes-mailchimp-success-single-optin-response |
|
1205 | - * |
|
1206 | - * Filter the success message displayed to the user |
|
1207 | - * |
|
1208 | - * @param string | $response_text | The response message that will be shown to the user |
|
1209 | - * @param string | $form_id | The form ID |
|
1210 | - * |
|
1211 | - */ |
|
1204 | + * yikes-mailchimp-success-single-optin-response |
|
1205 | + * |
|
1206 | + * Filter the success message displayed to the user |
|
1207 | + * |
|
1208 | + * @param string | $response_text | The response message that will be shown to the user |
|
1209 | + * @param string | $form_id | The form ID |
|
1210 | + * |
|
1211 | + */ |
|
1212 | 1212 | $response_text = apply_filters( 'yikes-mailchimp-success-single-optin-response', $response_text, $this->form_id ); |
1213 | 1213 | |
1214 | 1214 | return $response_text; |
@@ -1221,14 +1221,14 @@ discard block |
||
1221 | 1221 | } |
1222 | 1222 | |
1223 | 1223 | /** |
1224 | - * yikes-mailchimp-success-resubscribed-response |
|
1225 | - * |
|
1226 | - * Filter the success message displayed to the user |
|
1227 | - * |
|
1228 | - * @param string | $response_text | The response message that will be shown to the user |
|
1229 | - * @param string | $form_id | The form ID |
|
1230 | - * |
|
1231 | - */ |
|
1224 | + * yikes-mailchimp-success-resubscribed-response |
|
1225 | + * |
|
1226 | + * Filter the success message displayed to the user |
|
1227 | + * |
|
1228 | + * @param string | $response_text | The response message that will be shown to the user |
|
1229 | + * @param string | $form_id | The form ID |
|
1230 | + * |
|
1231 | + */ |
|
1232 | 1232 | $response_text = apply_filters( 'yikes-mailchimp-success-resubscribed-response', $response_text, $this->form_id ); |
1233 | 1233 | |
1234 | 1234 | return $response_text; |
@@ -1244,16 +1244,16 @@ discard block |
||
1244 | 1244 | } |
1245 | 1245 | |
1246 | 1246 | /** |
1247 | - * yikes-mailchimp-general-error-response |
|
1248 | - * |
|
1249 | - * Filter the error message displayed to the user |
|
1250 | - * |
|
1251 | - * @param string | $original_response_text | The original response message returned from the API |
|
1252 | - * @param string | $user_defined_response_text | The response message defined by the user |
|
1253 | - * @param string | $form_id | The form ID |
|
1254 | - * |
|
1255 | - * @return string | $response_text | The message that will be shown to the user |
|
1256 | - */ |
|
1247 | + * yikes-mailchimp-general-error-response |
|
1248 | + * |
|
1249 | + * Filter the error message displayed to the user |
|
1250 | + * |
|
1251 | + * @param string | $original_response_text | The original response message returned from the API |
|
1252 | + * @param string | $user_defined_response_text | The response message defined by the user |
|
1253 | + * @param string | $form_id | The form ID |
|
1254 | + * |
|
1255 | + * @return string | $response_text | The message that will be shown to the user |
|
1256 | + */ |
|
1257 | 1257 | $response_text = apply_filters( 'yikes-mailchimp-general-error-response', $original_response_text, $user_defined_response_text, $this->form_id ); |
1258 | 1258 | |
1259 | 1259 | return $response_text; |
@@ -1267,14 +1267,14 @@ discard block |
||
1267 | 1267 | } |
1268 | 1268 | |
1269 | 1269 | /** |
1270 | - * Wrap the response message in HTML for Non-AJAX form submissions |
|
1271 | - * |
|
1272 | - * @since 6.3.0 |
|
1273 | - * |
|
1274 | - * @param string | $message | The response message |
|
1275 | - * @param bool | $is_success | Boolean signifying if we're returning a success message or an error message |
|
1276 | - * @return string| The $message wrapping in HTML |
|
1277 | - */ |
|
1270 | + * Wrap the response message in HTML for Non-AJAX form submissions |
|
1271 | + * |
|
1272 | + * @since 6.3.0 |
|
1273 | + * |
|
1274 | + * @param string | $message | The response message |
|
1275 | + * @param bool | $is_success | Boolean signifying if we're returning a success message or an error message |
|
1276 | + * @return string| The $message wrapping in HTML |
|
1277 | + */ |
|
1278 | 1278 | public function wrap_form_submission_response( $message, $is_success ) { |
1279 | 1279 | |
1280 | 1280 | // If we're successful, we wrap the $message differently |
@@ -1288,14 +1288,14 @@ discard block |
||
1288 | 1288 | /**** Returning Success / Failure Functions ****/ |
1289 | 1289 | |
1290 | 1290 | /** |
1291 | - * Return success. Method of returning success based on the $is_ajax flag |
|
1292 | - * |
|
1293 | - * @since 6.3.0 |
|
1294 | - * |
|
1295 | - * @param array | $success_array | Array of success values to return |
|
1296 | - * |
|
1297 | - * @return If AJAX, return wp_send_json_success(). If not AJAX, set the global $process_submission_response variable and simply `return`. |
|
1298 | - */ |
|
1291 | + * Return success. Method of returning success based on the $is_ajax flag |
|
1292 | + * |
|
1293 | + * @since 6.3.0 |
|
1294 | + * |
|
1295 | + * @param array | $success_array | Array of success values to return |
|
1296 | + * |
|
1297 | + * @return If AJAX, return wp_send_json_success(). If not AJAX, set the global $process_submission_response variable and simply `return`. |
|
1298 | + */ |
|
1299 | 1299 | protected function yikes_success( $success_array ) { |
1300 | 1300 | if ( $this->is_ajax === true ) { |
1301 | 1301 | wp_send_json_success( $success_array ); |
@@ -1308,18 +1308,18 @@ discard block |
||
1308 | 1308 | } |
1309 | 1309 | |
1310 | 1310 | /** |
1311 | - * Return failure. Method of returning failure based on the $is_ajax flag |
|
1312 | - * |
|
1313 | - * @since 6.3.0 |
|
1314 | - * |
|
1315 | - * @param int | $hide | Flag whether to hide the form (1 = hide, 0 = do not hide) |
|
1316 | - * @param int | $error | Flag whether this is an error (1 = error, 0 = no error) |
|
1317 | - * @param string | $response | The response message to display to the user |
|
1318 | - * @param array | $additional_fields | An array of additional fields to return |
|
1319 | - * @param bool | $return_response_non_ajax | Boolean deciding if we need to return a message |
|
1320 | - * |
|
1321 | - * @return If AJAX, return $this->yikes_send_json_error(). If not AJAX, return an array || false. |
|
1322 | - */ |
|
1311 | + * Return failure. Method of returning failure based on the $is_ajax flag |
|
1312 | + * |
|
1313 | + * @since 6.3.0 |
|
1314 | + * |
|
1315 | + * @param int | $hide | Flag whether to hide the form (1 = hide, 0 = do not hide) |
|
1316 | + * @param int | $error | Flag whether this is an error (1 = error, 0 = no error) |
|
1317 | + * @param string | $response | The response message to display to the user |
|
1318 | + * @param array | $additional_fields | An array of additional fields to return |
|
1319 | + * @param bool | $return_response_non_ajax | Boolean deciding if we need to return a message |
|
1320 | + * |
|
1321 | + * @return If AJAX, return $this->yikes_send_json_error(). If not AJAX, return an array || false. |
|
1322 | + */ |
|
1323 | 1323 | protected function yikes_fail( $hide, $error, $response, $additional_fields = array(), $return_response_non_ajax = false ) { |
1324 | 1324 | if ( $this->is_ajax === true ) { |
1325 | 1325 | $this->yikes_send_json_error( $hide, $error, $response, $additional_fields ); |
@@ -1332,17 +1332,17 @@ discard block |
||
1332 | 1332 | } |
1333 | 1333 | |
1334 | 1334 | /** |
1335 | - * Wrapper function for wp_send_json_error() |
|
1336 | - * |
|
1337 | - * @since 6.3.0 |
|
1338 | - * |
|
1339 | - * @param int | $hide | Flag whether to hide the form (1 = hide, 0 = do not hide) |
|
1340 | - * @param int | $error | Flag whether this is an error (1 = error, 0 = no error) |
|
1341 | - * @param string | $translated_string | The response message to display to the user |
|
1342 | - * @param array | $additional_fields | An array of additional fields to return |
|
1343 | - * |
|
1344 | - * @return func | wp_send_json_error() |
|
1345 | - */ |
|
1335 | + * Wrapper function for wp_send_json_error() |
|
1336 | + * |
|
1337 | + * @since 6.3.0 |
|
1338 | + * |
|
1339 | + * @param int | $hide | Flag whether to hide the form (1 = hide, 0 = do not hide) |
|
1340 | + * @param int | $error | Flag whether this is an error (1 = error, 0 = no error) |
|
1341 | + * @param string | $translated_string | The response message to display to the user |
|
1342 | + * @param array | $additional_fields | An array of additional fields to return |
|
1343 | + * |
|
1344 | + * @return func | wp_send_json_error() |
|
1345 | + */ |
|
1346 | 1346 | protected function yikes_send_json_error( $hide, $error, $translated_string, $additional_fields = array() ) { |
1347 | 1347 | |
1348 | 1348 | // Default response array |
@@ -1366,14 +1366,14 @@ discard block |
||
1366 | 1366 | /** Static functions used in other places **/ |
1367 | 1367 | |
1368 | 1368 | /** |
1369 | - * Handle the redirect logic for successful submissions |
|
1370 | - * |
|
1371 | - * @since 6.3.0 |
|
1372 | - * |
|
1373 | - * @param array | $submission_settings | Array of the form's submission settings |
|
1374 | - * @param array | $page_data | Page ID |
|
1375 | - * @return array| $redirect_array | Array with two values: Redirection flag, Redirect URL |
|
1376 | - */ |
|
1369 | + * Handle the redirect logic for successful submissions |
|
1370 | + * |
|
1371 | + * @since 6.3.0 |
|
1372 | + * |
|
1373 | + * @param array | $submission_settings | Array of the form's submission settings |
|
1374 | + * @param array | $page_data | Page ID |
|
1375 | + * @return array| $redirect_array | Array with two values: Redirection flag, Redirect URL |
|
1376 | + */ |
|
1377 | 1377 | public static function handle_submission_response_success_redirect( $form_id, $submission_settings, $page_data ) { |
1378 | 1378 | |
1379 | 1379 | $default_redirect_time_ms = 1500; |
@@ -1406,23 +1406,23 @@ discard block |
||
1406 | 1406 | $redirect_url = 'custom_url' !== $redirect_page_setting ? get_permalink( $redirect_page_setting ) : $custom_redirect_setting; |
1407 | 1407 | |
1408 | 1408 | /** |
1409 | - * yikes-mailchimp-redirect-url |
|
1410 | - * |
|
1411 | - * Catch the redirect URL before it's shown to the user |
|
1412 | - * |
|
1413 | - * @param string | $redirect_url | The URL that we will redirect to |
|
1414 | - * @param string | $form_id | The ID of the current form being subscribed to |
|
1415 | - * @param array | $page_data | An array of data related to the page the form is on |
|
1416 | - */ |
|
1409 | + * yikes-mailchimp-redirect-url |
|
1410 | + * |
|
1411 | + * Catch the redirect URL before it's shown to the user |
|
1412 | + * |
|
1413 | + * @param string | $redirect_url | The URL that we will redirect to |
|
1414 | + * @param string | $form_id | The ID of the current form being subscribed to |
|
1415 | + * @param array | $page_data | An array of data related to the page the form is on |
|
1416 | + */ |
|
1417 | 1417 | $redirect_url = apply_filters( 'yikes-mailchimp-redirect-url', $redirect_url, $form_id, $page_data ); |
1418 | 1418 | |
1419 | 1419 | /** |
1420 | - * yikes-mailchimp-redirect-timer |
|
1421 | - * |
|
1422 | - * Catch the redirect timer before it's sent to the JavaScript file |
|
1423 | - * |
|
1424 | - * @param int | $default_redirect_time_ms | The default time (1500 milliseconds) to wait before redirecting |
|
1425 | - */ |
|
1420 | + * yikes-mailchimp-redirect-timer |
|
1421 | + * |
|
1422 | + * Catch the redirect timer before it's sent to the JavaScript file |
|
1423 | + * |
|
1424 | + * @param int | $default_redirect_time_ms | The default time (1500 milliseconds) to wait before redirecting |
|
1425 | + */ |
|
1426 | 1426 | $redirect_timer = apply_filters( 'yikes-mailchimp-redirect-timer', $default_redirect_time_ms, $form_id, $page_data ); |
1427 | 1427 | |
1428 | 1428 | $redirect_array['redirect_timer'] = $redirect_timer; |
@@ -255,13 +255,13 @@ discard block |
||
255 | 255 | $this->handle_updating_existing_user_link_message = __( 'To update your Mailchimp profile, please click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ); |
256 | 256 | $this->handle_empty_required_field_message = __( 'A required field is missing.', 'yikes-inc-easy-mailchimp-extender' ); |
257 | 257 | $this->handle_empty_required_interest_group_message = __( 'A required interest group is missing.', 'yikes-inc-easy-mailchimp-extender' ); |
258 | - $this->handle_nonce_message = __( 'Error: Sorry, the nonce security check didn\'t pass. Please reload the page and try again. You may want to try clearing your browser cache as a last attempt.' , 'yikes-inc-easy-mailchimp-extender' ); |
|
258 | + $this->handle_nonce_message = __( 'Error: Sorry, the nonce security check didn\'t pass. Please reload the page and try again. You may want to try clearing your browser cache as a last attempt.', 'yikes-inc-easy-mailchimp-extender' ); |
|
259 | 259 | $this->handle_non_filled_recaptcha_message_message = __( 'Please check the reCAPTCHA field.', 'yikes-inc-easy-mailchimp-extender' ); |
260 | 260 | $this->generic_recaptcha_error_message = __( 'Please refresh the page and try again.', 'yikes-inc-easy-mailchimp-extender' ); |
261 | 261 | |
262 | 262 | // Define our success messages |
263 | - $this->default_response_single_optin_success_message = __( 'Thank you for subscribing!' , 'yikes-inc-easy-mailchimp-extender' ); |
|
264 | - $this->default_response_double_optin_success_message = __( 'Thank you for subscribing. Check your email for the confirmation message.' , 'yikes-inc-easy-mailchimp-extender' ); |
|
263 | + $this->default_response_single_optin_success_message = __( 'Thank you for subscribing!', 'yikes-inc-easy-mailchimp-extender' ); |
|
264 | + $this->default_response_double_optin_success_message = __( 'Thank you for subscribing. Check your email for the confirmation message.', 'yikes-inc-easy-mailchimp-extender' ); |
|
265 | 265 | $this->existing_subscriber_profile_update_message = __( 'Thank you for already being a subscriber! Your profile info has been updated.', 'yikes-inc-easy-mailchimp-extender' ); |
266 | 266 | } |
267 | 267 | |
@@ -373,16 +373,16 @@ discard block |
||
373 | 373 | } |
374 | 374 | |
375 | 375 | // Check if the current iteration has a 'date_format' key set (i.e. date/birthday fields) |
376 | - if ( isset( $form_fields[ $merge_tag ]['date_format'] ) ) { |
|
377 | - $sanitized = $this->handle_date_format_merge_values( $sanitized, $form_fields[ $merge_tag ]['date_format'] ); |
|
376 | + if ( isset( $form_fields[ $merge_tag ][ 'date_format' ] ) ) { |
|
377 | + $sanitized = $this->handle_date_format_merge_values( $sanitized, $form_fields[ $merge_tag ][ 'date_format' ] ); |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | $merge_variables[ $merge_tag ] = $sanitized; |
381 | 381 | } |
382 | 382 | |
383 | 383 | // Make sure we send the lower-cased, sanitized email so it matches the one we're sending in the body of the request. |
384 | - if ( isset( $merge_variables['EMAIL'] ) ) { |
|
385 | - $merge_variables['EMAIL'] = $this->email; |
|
384 | + if ( isset( $merge_variables[ 'EMAIL' ] ) ) { |
|
385 | + $merge_variables[ 'EMAIL' ] = $this->email; |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | /** |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | if ( count( $pieces ) === 3 ) { |
460 | 460 | |
461 | 461 | // $pieces[1] = MM. $pieces[0] = DD. $date = MM/DD/YYYY |
462 | - $date = $pieces[1] . '/' . $pieces[0] . '/' . $pieces[2]; |
|
462 | + $date = $pieces[ 1 ] . '/' . $pieces[ 0 ] . '/' . $pieces[ 2 ]; |
|
463 | 463 | } |
464 | 464 | |
465 | 465 | return $date; |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | if ( count( $pieces ) === 2 ) { |
485 | 485 | |
486 | 486 | // $pieces[1] = MM. $pieces[0] = DD. $birthday = MM/DD |
487 | - $birthday = $pieces[1] . '/' . $pieces[0]; |
|
487 | + $birthday = $pieces[ 1 ] . '/' . $pieces[ 0 ]; |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | return $birthday; |
@@ -517,12 +517,12 @@ discard block |
||
517 | 517 | // Loop through the interest groups and create a single array like {group_id} => false |
518 | 518 | foreach ( $interest_groupings as $group_data ) { |
519 | 519 | |
520 | - if ( empty( $group_data['items'] ) || ! is_array( $group_data['items'] ) ) { |
|
520 | + if ( empty( $group_data[ 'items' ] ) || ! is_array( $group_data[ 'items' ] ) ) { |
|
521 | 521 | continue; |
522 | 522 | } |
523 | 523 | |
524 | - foreach ( $group_data['items'] as $item ) { |
|
525 | - $groups[ $item['id'] ] = false; |
|
524 | + foreach ( $group_data[ 'items' ] as $item ) { |
|
525 | + $groups[ $item[ 'id' ] ] = false; |
|
526 | 526 | } |
527 | 527 | |
528 | 528 | } |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | do_action( "yikes-mailchimp-form-submission-{$this->form_id}", $this->email, $merge_variables, $this->form_id, $notifications ); |
636 | 636 | |
637 | 637 | // Get the optin value |
638 | - $optin = isset( $optin_settings['optin'] ) ? (int) $optin_settings['optin'] : 0; |
|
638 | + $optin = isset( $optin_settings[ 'optin' ] ) ? (int) $optin_settings[ 'optin' ] : 0; |
|
639 | 639 | |
640 | 640 | if ( 1 === $optin ) { |
641 | 641 | |
@@ -665,13 +665,13 @@ discard block |
||
665 | 665 | |
666 | 666 | // Construct our success array variables |
667 | 667 | $return_success_array = array( |
668 | - 'hide' => $submission_settings['hide_form_post_signup'], |
|
668 | + 'hide' => $submission_settings[ 'hide_form_post_signup' ], |
|
669 | 669 | 'error' => 0, |
670 | 670 | 'response' => $response_message, |
671 | - 'redirection' => $redirect_array['redirection'], |
|
672 | - 'redirect' => $redirect_array['redirect'], |
|
673 | - 'new_window' => $redirect_array['new_window'], |
|
674 | - 'redirect_timer' => $redirect_array['redirect_timer'], |
|
671 | + 'redirection' => $redirect_array[ 'redirection' ], |
|
672 | + 'redirect' => $redirect_array[ 'redirect' ], |
|
673 | + 'new_window' => $redirect_array[ 'new_window' ], |
|
674 | + 'redirect_timer' => $redirect_array[ 'redirect_timer' ], |
|
675 | 675 | ); |
676 | 676 | |
677 | 677 | // Return success array |
@@ -693,12 +693,12 @@ discard block |
||
693 | 693 | $details = ''; |
694 | 694 | |
695 | 695 | // Loop through the error data and retrieve any fields and messages |
696 | - if ( isset( $error_data['data'] ) ) { |
|
697 | - foreach ( $error_data['data'] as $datum ) { |
|
698 | - if ( ! isset( $datum['field'], $datum['message'] ) ) { |
|
696 | + if ( isset( $error_data[ 'data' ] ) ) { |
|
697 | + foreach ( $error_data[ 'data' ] as $datum ) { |
|
698 | + if ( ! isset( $datum[ 'field' ], $datum[ 'message' ] ) ) { |
|
699 | 699 | continue; |
700 | 700 | } |
701 | - $details .= sprintf( '<br>Error with %1$s field: <strong>%2$s</strong>', $form_fields[ $datum['field'] ]['label'], $datum['message'] ); |
|
701 | + $details .= sprintf( '<br>Error with %1$s field: <strong>%2$s</strong>', $form_fields[ $datum[ 'field' ] ][ 'label' ], $datum[ 'message' ] ); |
|
702 | 702 | } |
703 | 703 | } |
704 | 704 | |
@@ -741,21 +741,21 @@ discard block |
||
741 | 741 | $missing_fields = array(); |
742 | 742 | |
743 | 743 | // Loop through submitted form data |
744 | - foreach( $data as $merge_tag => $value ) { |
|
744 | + foreach ( $data as $merge_tag => $value ) { |
|
745 | 745 | |
746 | 746 | // Skip interest groups |
747 | - if ( isset( $form_fields[ $merge_tag ]['group_id'] ) ) { |
|
747 | + if ( isset( $form_fields[ $merge_tag ][ 'group_id' ] ) ) { |
|
748 | 748 | continue; |
749 | 749 | } |
750 | 750 | |
751 | 751 | // check if this field is required |
752 | - if ( isset( $form_fields[ $merge_tag ] ) && isset( $form_fields[ $merge_tag ]['require'] ) && $form_fields[ $merge_tag ]['require'] === '1' ) { |
|
752 | + if ( isset( $form_fields[ $merge_tag ] ) && isset( $form_fields[ $merge_tag ][ 'require' ] ) && $form_fields[ $merge_tag ][ 'require' ] === '1' ) { |
|
753 | 753 | |
754 | 754 | // Check if the field(s) are empty |
755 | 755 | if ( is_array( $value ) ) { |
756 | 756 | |
757 | 757 | // Loop through the data and check if any are empty |
758 | - foreach( $value as $field => $val ) { |
|
758 | + foreach ( $value as $field => $val ) { |
|
759 | 759 | |
760 | 760 | /** |
761 | 761 | * 'yikes-mailchimp-ignore-required-array-field' |
@@ -774,13 +774,13 @@ discard block |
||
774 | 774 | |
775 | 775 | // Set the merge label (e.g. MMERGE6) as the key so we don't get the same field multiple times |
776 | 776 | // (e.g. For arrays, like an address, where multiple address fields are empty) |
777 | - $missing_fields[ $form_fields[ $merge_tag ]['merge'] ] = $form_fields[ $merge_tag ]; |
|
777 | + $missing_fields[ $form_fields[ $merge_tag ][ 'merge' ] ] = $form_fields[ $merge_tag ]; |
|
778 | 778 | } |
779 | 779 | } |
780 | 780 | |
781 | 781 | } else if ( empty( $value ) ) { |
782 | 782 | $field_is_missing = true; |
783 | - $missing_fields[ $form_fields[ $merge_tag ]['merge'] ] = $form_fields[ $merge_tag ]; |
|
783 | + $missing_fields[ $form_fields[ $merge_tag ][ 'merge' ] ] = $form_fields[ $merge_tag ]; |
|
784 | 784 | } |
785 | 785 | } |
786 | 786 | } |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | foreach ( $form_fields as $merge_tag => $field_data ) { |
831 | 831 | |
832 | 832 | // If an interest group and it's required |
833 | - if ( isset( $field_data['group_id'] ) && isset( $field_data['require'] ) && $field_data['require'] === '1' ) { |
|
833 | + if ( isset( $field_data[ 'group_id' ] ) && isset( $field_data[ 'require' ] ) && $field_data[ 'require' ] === '1' ) { |
|
834 | 834 | |
835 | 835 | // Check if it was submitted (meaning, check if it's set in our $data array) |
836 | 836 | if ( ! isset( $data[ 'group-' . $merge_tag ] ) ) { |
@@ -900,35 +900,35 @@ discard block |
||
900 | 900 | break; |
901 | 901 | |
902 | 902 | case 3: |
903 | - $recaptcha_secret_key = get_option( 'yikes-mc-recaptcha-secret-key-three' , '' ); |
|
903 | + $recaptcha_secret_key = get_option( 'yikes-mc-recaptcha-secret-key-three', '' ); |
|
904 | 904 | break; |
905 | 905 | } |
906 | 906 | |
907 | 907 | // Construct the API URL |
908 | - $url = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . $recaptcha_secret_key . '&response=' . $recaptcha_response . '&remoteip=' . $_SERVER['REMOTE_ADDR'] ); |
|
908 | + $url = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . $recaptcha_secret_key . '&response=' . $recaptcha_response . '&remoteip=' . $_SERVER[ 'REMOTE_ADDR' ] ); |
|
909 | 909 | $response = wp_remote_get( $url ); |
910 | - $response_body = json_decode( $response['body'], true ); |
|
910 | + $response_body = json_decode( $response[ 'body' ], true ); |
|
911 | 911 | |
912 | 912 | // Set up errors array |
913 | 913 | $recaptcha_errors = array(); |
914 | 914 | |
915 | 915 | // if we've hit an error, lets return the error! |
916 | - if ( true !== $response_body['success'] ) { |
|
916 | + if ( true !== $response_body[ 'success' ] ) { |
|
917 | 917 | |
918 | - if( isset( $response_body['error-codes'] ) ) { |
|
918 | + if ( isset( $response_body[ 'error-codes' ] ) ) { |
|
919 | 919 | |
920 | 920 | // Loop through response error codes |
921 | - foreach ( $response_body['error-codes'] as $error_code ) { |
|
921 | + foreach ( $response_body[ 'error-codes' ] as $error_code ) { |
|
922 | 922 | if ( 'missing-input-response' === $error_code ) { |
923 | 923 | $error_code = $this->handle_non_filled_recaptcha_message; |
924 | 924 | } |
925 | 925 | |
926 | 926 | // Add our error_code to the errors array |
927 | - $recaptcha_errors[] = $error_code; |
|
927 | + $recaptcha_errors[ ] = $error_code; |
|
928 | 928 | } |
929 | 929 | |
930 | 930 | } else { |
931 | - $recaptcha_errors[] = $this->generic_recaptcha_error_message; |
|
931 | + $recaptcha_errors[ ] = $this->generic_recaptcha_error_message; |
|
932 | 932 | } |
933 | 933 | |
934 | 934 | /** |
@@ -1036,7 +1036,7 @@ discard block |
||
1036 | 1036 | * @param array | $fields_array | An array of fields to loop through and make sure they're not null |
1037 | 1037 | */ |
1038 | 1038 | public function handle_empty_fields_generic( $fields_array ) { |
1039 | - foreach( $fields_array as $field ) { |
|
1039 | + foreach ( $fields_array as $field ) { |
|
1040 | 1040 | if ( $field === null ) { |
1041 | 1041 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_fields_generic_message ); |
1042 | 1042 | } |
@@ -1102,7 +1102,7 @@ discard block |
||
1102 | 1102 | |
1103 | 1103 | // Append our 'send-update-email' link and text |
1104 | 1104 | $response .= $link_start_tag; |
1105 | - $response .= $this->handle_updating_existing_user_link_message; |
|
1105 | + $response .= $this->handle_updating_existing_user_link_message; |
|
1106 | 1106 | $response .= $link_close_tag; |
1107 | 1107 | |
1108 | 1108 | // Check for a user-defined message |
@@ -1125,14 +1125,14 @@ discard block |
||
1125 | 1125 | */ |
1126 | 1126 | protected function check_for_user_defined_response_message( $slug, $response_text, $data = false ) { |
1127 | 1127 | |
1128 | - switch( $slug ) { |
|
1128 | + switch ( $slug ) { |
|
1129 | 1129 | case 'already-subscribed': |
1130 | 1130 | |
1131 | 1131 | // Check if this error message exists |
1132 | - if ( isset( $this->error_messages['already-subscribed'] ) && ! empty( $this->error_messages['already-subscribed'] ) ) { |
|
1132 | + if ( isset( $this->error_messages[ 'already-subscribed' ] ) && ! empty( $this->error_messages[ 'already-subscribed' ] ) ) { |
|
1133 | 1133 | |
1134 | 1134 | // Check if the substring (that we replace) '[email]' is located in the string and replace it |
1135 | - $response_text = str_replace( '[email]', $this->email, $this->error_messages['already-subscribed'] ); |
|
1135 | + $response_text = str_replace( '[email]', $this->email, $this->error_messages[ 'already-subscribed' ] ); |
|
1136 | 1136 | } |
1137 | 1137 | |
1138 | 1138 | /** |
@@ -1151,13 +1151,13 @@ discard block |
||
1151 | 1151 | case 'update-link': |
1152 | 1152 | |
1153 | 1153 | // Check if this error message exists |
1154 | - if ( $data !== false && isset( $this->error_messages['update-link'] ) && ! empty( $this->error_messages['update-link'] ) ) { |
|
1154 | + if ( $data !== false && isset( $this->error_messages[ 'update-link' ] ) && ! empty( $this->error_messages[ 'update-link' ] ) ) { |
|
1155 | 1155 | |
1156 | 1156 | // Check if the substring (that we replace) '[link]' is located in the string and replace it |
1157 | - $response_text = str_replace( '[link]', $data['link_start_tag'], $this->error_messages['update-link'] ); |
|
1157 | + $response_text = str_replace( '[link]', $data[ 'link_start_tag' ], $this->error_messages[ 'update-link' ] ); |
|
1158 | 1158 | |
1159 | 1159 | // Remove [/link] |
1160 | - $response_text = str_replace( '[/link]', $data['link_close_tag'], $response_text ); |
|
1160 | + $response_text = str_replace( '[/link]', $data[ 'link_close_tag' ], $response_text ); |
|
1161 | 1161 | } |
1162 | 1162 | |
1163 | 1163 | /** |
@@ -1176,8 +1176,8 @@ discard block |
||
1176 | 1176 | case 'success': |
1177 | 1177 | |
1178 | 1178 | // 'success' is the user-defined success message for double opt-in |
1179 | - if ( isset( $this->error_messages['success'] ) && ! empty( $this->error_messages['success'] ) ) { |
|
1180 | - $response_text = $this->error_messages['success']; |
|
1179 | + if ( isset( $this->error_messages[ 'success' ] ) && ! empty( $this->error_messages[ 'success' ] ) ) { |
|
1180 | + $response_text = $this->error_messages[ 'success' ]; |
|
1181 | 1181 | } |
1182 | 1182 | |
1183 | 1183 | /** |
@@ -1196,8 +1196,8 @@ discard block |
||
1196 | 1196 | |
1197 | 1197 | case 'success-single-optin': |
1198 | 1198 | |
1199 | - if ( isset( $this->error_messages['success-single-optin'] ) && ! empty( $this->error_messages['success-single-optin'] ) ) { |
|
1200 | - $response_text = $this->error_messages['success-single-optin']; |
|
1199 | + if ( isset( $this->error_messages[ 'success-single-optin' ] ) && ! empty( $this->error_messages[ 'success-single-optin' ] ) ) { |
|
1200 | + $response_text = $this->error_messages[ 'success-single-optin' ]; |
|
1201 | 1201 | } |
1202 | 1202 | |
1203 | 1203 | /** |
@@ -1216,8 +1216,8 @@ discard block |
||
1216 | 1216 | |
1217 | 1217 | case 'success-resubscribed': |
1218 | 1218 | |
1219 | - if ( isset( $this->error_messages['success-resubscribed'] ) && ! empty( $this->error_messages['success-resubscribed'] ) ) { |
|
1220 | - $response_text = $this->error_messages['success-resubscribed']; |
|
1219 | + if ( isset( $this->error_messages[ 'success-resubscribed' ] ) && ! empty( $this->error_messages[ 'success-resubscribed' ] ) ) { |
|
1220 | + $response_text = $this->error_messages[ 'success-resubscribed' ]; |
|
1221 | 1221 | } |
1222 | 1222 | |
1223 | 1223 | /** |
@@ -1239,8 +1239,8 @@ discard block |
||
1239 | 1239 | $original_response_text = $response_text; |
1240 | 1240 | $user_defined_response_text = ''; |
1241 | 1241 | |
1242 | - if ( isset( $this->error_messages['general-error'] ) && ! empty( $this->error_messages['general-error'] ) ) { |
|
1243 | - $user_defined_response_text = $this->error_messages['general-error']; |
|
1242 | + if ( isset( $this->error_messages[ 'general-error' ] ) && ! empty( $this->error_messages[ 'general-error' ] ) ) { |
|
1243 | + $user_defined_response_text = $this->error_messages[ 'general-error' ]; |
|
1244 | 1244 | } |
1245 | 1245 | |
1246 | 1246 | /** |
@@ -1302,7 +1302,7 @@ discard block |
||
1302 | 1302 | } else { |
1303 | 1303 | global $process_submission_response; |
1304 | 1304 | |
1305 | - $process_submission_response = isset( $success_array['response'] ) ? $success_array['response'] : ''; // DEFAULT SUCCESS? |
|
1305 | + $process_submission_response = isset( $success_array[ 'response' ] ) ? $success_array[ 'response' ] : ''; // DEFAULT SUCCESS? |
|
1306 | 1306 | $process_submission_response = $this->wrap_form_submission_response( $process_submission_response, $is_success = true ); |
1307 | 1307 | } |
1308 | 1308 | } |
@@ -1355,8 +1355,8 @@ discard block |
||
1355 | 1355 | // Add additional fields we've been supplied |
1356 | 1356 | if ( ! empty( $additional_fields ) ) { |
1357 | 1357 | |
1358 | - foreach( $additional_fields as $key => $value ) { |
|
1359 | - $response_array[$key] = $value; |
|
1358 | + foreach ( $additional_fields as $key => $value ) { |
|
1359 | + $response_array[ $key ] = $value; |
|
1360 | 1360 | } |
1361 | 1361 | } |
1362 | 1362 | |
@@ -1387,20 +1387,20 @@ discard block |
||
1387 | 1387 | ); |
1388 | 1388 | |
1389 | 1389 | // Let's confirm we have a value before trying to use it |
1390 | - $redirect_setting = isset( $submission_settings['redirect_on_submission'] ) ? $submission_settings['redirect_on_submission'] : false; |
|
1390 | + $redirect_setting = isset( $submission_settings[ 'redirect_on_submission' ] ) ? $submission_settings[ 'redirect_on_submission' ] : false; |
|
1391 | 1391 | |
1392 | 1392 | // Check the redirect flag |
1393 | 1393 | if ( '1' === $redirect_setting ) { |
1394 | 1394 | |
1395 | 1395 | // Supply return array with default value of 1 |
1396 | - $redirect_array['redirection'] = apply_filters( 'yikes-mailchimp-redirection', 1, $form_id, $page_data ); |
|
1396 | + $redirect_array[ 'redirection' ] = apply_filters( 'yikes-mailchimp-redirection', 1, $form_id, $page_data ); |
|
1397 | 1397 | |
1398 | 1398 | // Let's confirm we have redirect_page/custom_redirect_url/new_window values |
1399 | - $redirect_page_setting = isset( $submission_settings['redirect_page'] ) ? $submission_settings['redirect_page'] : false; |
|
1400 | - $custom_redirect_setting = isset( $submission_settings['custom_redirect_url'] ) ? $submission_settings['custom_redirect_url'] : false; |
|
1401 | - $redirect_new_window = isset( $submission_settings['redirect_new_window'] ) ? $submission_settings['redirect_new_window'] : false; |
|
1399 | + $redirect_page_setting = isset( $submission_settings[ 'redirect_page' ] ) ? $submission_settings[ 'redirect_page' ] : false; |
|
1400 | + $custom_redirect_setting = isset( $submission_settings[ 'custom_redirect_url' ] ) ? $submission_settings[ 'custom_redirect_url' ] : false; |
|
1401 | + $redirect_new_window = isset( $submission_settings[ 'redirect_new_window' ] ) ? $submission_settings[ 'redirect_new_window' ] : false; |
|
1402 | 1402 | |
1403 | - $redirect_array['new_window'] = apply_filters( 'yikes-mailchimp-redirect-new-window', $redirect_new_window, $form_id, $page_data ); |
|
1403 | + $redirect_array[ 'new_window' ] = apply_filters( 'yikes-mailchimp-redirect-new-window', $redirect_new_window, $form_id, $page_data ); |
|
1404 | 1404 | |
1405 | 1405 | // Check if we're redirecting to a custom_url or just the redirect_page |
1406 | 1406 | $redirect_url = 'custom_url' !== $redirect_page_setting ? get_permalink( $redirect_page_setting ) : $custom_redirect_setting; |
@@ -1425,9 +1425,9 @@ discard block |
||
1425 | 1425 | */ |
1426 | 1426 | $redirect_timer = apply_filters( 'yikes-mailchimp-redirect-timer', $default_redirect_time_ms, $form_id, $page_data ); |
1427 | 1427 | |
1428 | - $redirect_array['redirect_timer'] = $redirect_timer; |
|
1428 | + $redirect_array[ 'redirect_timer' ] = $redirect_timer; |
|
1429 | 1429 | |
1430 | - $redirect_array['redirect'] = $redirect_url; |
|
1430 | + $redirect_array[ 'redirect' ] = $redirect_url; |
|
1431 | 1431 | } |
1432 | 1432 | |
1433 | 1433 | return $redirect_array; |
@@ -1436,7 +1436,7 @@ discard block |
||
1436 | 1436 | public function maybe_add_tags( $form_data, $subscriber_data ) { |
1437 | 1437 | |
1438 | 1438 | // Add the form's tags |
1439 | - $form_tags = isset( $form_data['tags'] ) ? $form_data['tags'] : array(); |
|
1439 | + $form_tags = isset( $form_data[ 'tags' ] ) ? $form_data[ 'tags' ] : array(); |
|
1440 | 1440 | $form_tags = apply_filters( 'yikes_mailchimp_subscriber_tags', $form_tags, $form_data, $this->list_id, $subscriber_data ); |
1441 | 1441 | |
1442 | 1442 | if ( ! empty( $form_tags ) ) { |
@@ -1445,7 +1445,7 @@ discard block |
||
1445 | 1445 | $add_tag = apply_filters( 'yikes_mailchimp_subscriber_tag_active', true, $tag, $this->list_id, $subscriber_data ); |
1446 | 1446 | |
1447 | 1447 | if ( $add_tag ) { |
1448 | - $list_handler->create_member_tags( $this->list_id, $tag['id'], array( 'email_address' => $this->email ) ); |
|
1448 | + $list_handler->create_member_tags( $this->list_id, $tag[ 'id' ], array( 'email_address' => $this->email ) ); |
|
1449 | 1449 | } |
1450 | 1450 | } |
1451 | 1451 | } |