@@ -281,6 +281,10 @@ |
||
| 281 | 281 | * before continuing |
| 282 | 282 | * @since 6.0.0 |
| 283 | 283 | */ |
| 284 | + |
|
| 285 | + /** |
|
| 286 | + * @param string $type |
|
| 287 | + */ |
|
| 284 | 288 | public function was_checkbox_checked( $type ) {
|
| 285 | 289 | return ( isset( $_POST[ 'yikes_mailchimp_checkbox_' . $type ] ) && $_POST[ 'yikes_mailchimp_checkbox_' . $type ] == 1 ); |
| 286 | 290 | } |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | // Prevent direct access to the file |
| 8 | - defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) );
|
|
| 8 | + defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 9 | 9 | |
| 10 | 10 | class Yikes_Easy_MC_Checkbox_Integration_Class {
|
| 11 | 11 | |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | if ( empty( $checkbox_options ) ) {
|
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | - if ( ! isset( $checkbox_options[ $type ] ) || ! isset( $checkbox_options[ $type ]['associated-list'] ) ) {
|
|
| 48 | + if ( ! isset( $checkbox_options[ $type ] ) || ! isset( $checkbox_options[ $type ][ 'associated-list' ] ) ) {
|
|
| 49 | 49 | return false; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - $list_ids = $checkbox_options[ $type ]['associated-list']; |
|
| 52 | + $list_ids = $checkbox_options[ $type ][ 'associated-list' ]; |
|
| 53 | 53 | $list_ids = is_array( $list_ids ) ? $list_ids : array( $list_ids ); |
| 54 | 54 | |
| 55 | 55 | // Go through each list... |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $data = $response->get_error_data(); |
| 85 | 85 | |
| 86 | 86 | // If the error response is a 404, they are not subscribed. |
| 87 | - if ( isset( $data['status'] ) && 404 == $data['status'] ) {
|
|
| 87 | + if ( isset( $data[ 'status' ] ) && 404 == $data[ 'status' ] ) {
|
|
| 88 | 88 | return false; |
| 89 | 89 | } else {
|
| 90 | 90 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | // Look at the status from the API |
| 103 | - $subscribed = 'subscribed' === $response['status']; |
|
| 103 | + $subscribed = 'subscribed' === $response[ 'status' ]; |
|
| 104 | 104 | |
| 105 | 105 | return apply_filters( 'yikes-mailchimp-integration-is-user-subscribed', $subscribed, $type ); |
| 106 | 106 | } |
@@ -116,22 +116,22 @@ discard block |
||
| 116 | 116 | wp_enqueue_style( 'yikes-easy-mailchimp-checkbox-integration-styles', plugin_dir_url( __FILE__ ) . '../css/yikes-inc-easy-mailchimp-checkbox-integration.min.css' ); |
| 117 | 117 | |
| 118 | 118 | // Get our options |
| 119 | - $checkbox_options = get_option( 'optin-checkbox-init' , array() ); |
|
| 120 | - $has_list_ids = isset( $checkbox_options[$this->type]['associated-list'] ) && $checkbox_options[$this->type]['associated-list'] != '-'; |
|
| 121 | - $has_list_ids = $has_list_ids && ! in_array( '-', $checkbox_options[$this->type]['associated-list'] ); |
|
| 119 | + $checkbox_options = get_option( 'optin-checkbox-init', array() ); |
|
| 120 | + $has_list_ids = isset( $checkbox_options[ $this->type ][ 'associated-list' ] ) && $checkbox_options[ $this->type ][ 'associated-list' ] != '-'; |
|
| 121 | + $has_list_ids = $has_list_ids && ! in_array( '-', $checkbox_options[ $this->type ][ 'associated-list' ] ); |
|
| 122 | 122 | |
| 123 | 123 | // We need to make sure we have a legit list ID right here. I don't think it will ever equal '-' |
| 124 | 124 | |
| 125 | 125 | if ( $has_list_ids ) {
|
| 126 | - $checked = ( $checkbox_options[$this->type]['precheck'] == 'true' ) ? 'checked' : ''; |
|
| 126 | + $checked = ( $checkbox_options[ $this->type ][ 'precheck' ] == 'true' ) ? 'checked' : ''; |
|
| 127 | 127 | // before checkbox HTML (comment, ...) |
| 128 | 128 | $before = '<!-- Easy Forms for MailChimp - https://www.yikesplugins.com/ -->'; |
| 129 | 129 | $before .= apply_filters( 'yikes-mailchimp-before-checkbox-html', '' ); |
| 130 | 130 | // checkbox |
| 131 | 131 | $content = '<p id="yikes-easy-mailchimp-' . $this->type . '-checkbox" class="yikes-easy-mailchimp-' . $this->type . '-checkbox">'; |
| 132 | 132 | $content .= '<label>'; |
| 133 | - $content .= '<input type="checkbox" name="yikes_mailchimp_checkbox_' . $this->type . '" value="1" '. $checked . ' /> '; |
|
| 134 | - $content .= ( isset( $checkbox_options[$this->type]['label'] ) && trim( $checkbox_options[$this->type]['label'] ) != '' ) ? trim( $checkbox_options[$this->type]['label'] ) : __( 'Sign me up for your mailing list.', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 133 | + $content .= '<input type="checkbox" name="yikes_mailchimp_checkbox_' . $this->type . '" value="1" ' . $checked . ' /> '; |
|
| 134 | + $content .= ( isset( $checkbox_options[ $this->type ][ 'label' ] ) && trim( $checkbox_options[ $this->type ][ 'label' ] ) != '' ) ? trim( $checkbox_options[ $this->type ][ 'label' ] ) : __( 'Sign me up for your mailing list.', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 135 | 135 | $content .= '</label>'; |
| 136 | 136 | $content .= '</p>'; |
| 137 | 137 | // after checkbox HTML (..., honeypot, closing comment) |
@@ -155,20 +155,20 @@ discard block |
||
| 155 | 155 | $options = get_option( 'optin-checkbox-init', '' ); |
| 156 | 156 | |
| 157 | 157 | // Make sure we have a list ID. |
| 158 | - if ( ! isset( $options[ $type ] ) || ! isset( $options[ $type ]['associated-list'] ) ) {
|
|
| 158 | + if ( ! isset( $options[ $type ] ) || ! isset( $options[ $type ][ 'associated-list' ] ) ) {
|
|
| 159 | 159 | // @todo: Throw some kind of error? |
| 160 | 160 | return; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | // Check for an IP address. |
| 164 | - $user_ip = sanitize_text_field( $_SERVER['REMOTE_ADDR'] ); |
|
| 165 | - if ( isset( $merge_vars['OPTIN_IP'] ) ) {
|
|
| 166 | - $user_ip = sanitize_text_field( $merge_vars['OPTIN_IP'] ); |
|
| 164 | + $user_ip = sanitize_text_field( $_SERVER[ 'REMOTE_ADDR' ] ); |
|
| 165 | + if ( isset( $merge_vars[ 'OPTIN_IP' ] ) ) {
|
|
| 166 | + $user_ip = sanitize_text_field( $merge_vars[ 'OPTIN_IP' ] ); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | // Build our data |
| 170 | - $list_ids = $options[ $type ]['associated-list']; |
|
| 171 | - $list_ids = is_array( $options[ $type ]['associated-list'] ) ? $options[ $type ]['associated-list'] : array( $options[ $type ]['associated-list'] ); |
|
| 170 | + $list_ids = $options[ $type ][ 'associated-list' ]; |
|
| 171 | + $list_ids = is_array( $options[ $type ][ 'associated-list' ] ) ? $options[ $type ][ 'associated-list' ] : array( $options[ $type ][ 'associated-list' ] ); |
|
| 172 | 172 | |
| 173 | 173 | // $interests = |
| 174 | 174 | |
@@ -183,8 +183,8 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | foreach ( $list_ids as $list_id ) {
|
| 185 | 185 | |
| 186 | - $interests = isset( $options[ $type ]['interest-groups'] ) ? $options[ $type ]['interest-groups'] : array(); |
|
| 187 | - $interests = isset( $interests[$list_id] ) ? $interests[$list_id] : $interests; |
|
| 186 | + $interests = isset( $options[ $type ][ 'interest-groups' ] ) ? $options[ $type ][ 'interest-groups' ] : array(); |
|
| 187 | + $interests = isset( $interests[ $list_id ] ) ? $interests[ $list_id ] : $interests; |
|
| 188 | 188 | |
| 189 | 189 | // Only re-format and add interest groups if not empty |
| 190 | 190 | if ( ! empty( $interests ) ) {
|
@@ -192,15 +192,15 @@ discard block |
||
| 192 | 192 | $groups = array(); |
| 193 | 193 | |
| 194 | 194 | // Need to reformat interest groups array as $interest_group_ID => true |
| 195 | - foreach( $interests as $interest ) {
|
|
| 195 | + foreach ( $interests as $interest ) {
|
|
| 196 | 196 | if ( is_array( $interest ) ) {
|
| 197 | - foreach( $interest as $group_id ) {
|
|
| 197 | + foreach ( $interest as $group_id ) {
|
|
| 198 | 198 | $groups[ $group_id ] = true; |
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - $data['interests'] = $groups; |
|
| 203 | + $data[ 'interests' ] = $groups; |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /** |
@@ -253,14 +253,14 @@ discard block |
||
| 253 | 253 | ); |
| 254 | 254 | |
| 255 | 255 | if ( ! empty( $user->first_name ) ) {
|
| 256 | - $merge_vars['NAME'] = $user->first_name; |
|
| 257 | - $merge_vars['FNAME'] = $user->first_name; |
|
| 256 | + $merge_vars[ 'NAME' ] = $user->first_name; |
|
| 257 | + $merge_vars[ 'FNAME' ] = $user->first_name; |
|
| 258 | 258 | } |
| 259 | 259 | if ( ! empty( $user->last_name ) ) {
|
| 260 | - $merge_vars['LNAME'] = $user->last_name; |
|
| 260 | + $merge_vars[ 'LNAME' ] = $user->last_name; |
|
| 261 | 261 | } |
| 262 | 262 | if ( ! empty( $user->first_name ) && ! empty( $user->last_name ) ) {
|
| 263 | - $merge_vars['NAME'] = sprintf( '%s %s', $user->first_name, $user->last_name ); |
|
| 263 | + $merge_vars[ 'NAME' ] = sprintf( '%s %s', $user->first_name, $user->last_name ); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | /** |
@@ -292,15 +292,15 @@ discard block |
||
| 292 | 292 | * @since 6.0.0 |
| 293 | 293 | **/ |
| 294 | 294 | public function yikes_reg_complete_msg( $errors, $redirect_to ) {
|
| 295 | - if( isset( $errors->errors['registered'] ) ) {
|
|
| 296 | - $email_error = get_option( 'yikes_register_subscription_error' , '' ); |
|
| 297 | - if( isset( $email_error ) && $email_error != '' ) {
|
|
| 295 | + if ( isset( $errors->errors[ 'registered' ] ) ) {
|
|
| 296 | + $email_error = get_option( 'yikes_register_subscription_error', '' ); |
|
| 297 | + if ( isset( $email_error ) && $email_error != '' ) {
|
|
| 298 | 298 | // Use the magic __get method to retrieve the errors array: |
| 299 | 299 | $tmp = $errors->errors; |
| 300 | 300 | $old = 'Registration complete. Please check your e-mail.'; |
| 301 | - foreach( $tmp['registered'] as $index => $msg ) {
|
|
| 302 | - if( $msg === $old ) {
|
|
| 303 | - $tmp['registered'][$index] = $old . ' <p class="message"><strong>' . __( 'Note' , 'yikes-inc-easy-mailchimp-extender' ) . '</strong>: ' . $email_error . '</p>'; |
|
| 301 | + foreach ( $tmp[ 'registered' ] as $index => $msg ) {
|
|
| 302 | + if ( $msg === $old ) {
|
|
| 303 | + $tmp[ 'registered' ][ $index ] = $old . ' <p class="message"><strong>' . __( 'Note', 'yikes-inc-easy-mailchimp-extender' ) . '</strong>: ' . $email_error . '</p>'; |
|
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | // Use the magic __set method to override the errors property: |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | // Prevent direct access to the file |
| 8 | 8 | defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) );
|
| 9 | 9 | |
| 10 | - class Yikes_Easy_MC_Checkbox_Integration_Class {
|
|
| 10 | + class Yikes_Easy_MC_Checkbox_Integration_Class { |
|
| 11 | 11 | |
| 12 | 12 | // declare our integration type |
| 13 | 13 | protected $type = 'integration'; |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | * |
| 25 | 25 | * @return bool Whether the current user is subscribed to a list. |
| 26 | 26 | */ |
| 27 | - public function is_user_already_subscribed( $type, $email = '' ) {
|
|
| 27 | + public function is_user_already_subscribed( $type, $email = '' ) { |
|
| 28 | 28 | // Make sure we have an email address to use. |
| 29 | - if ( empty( $email ) ) {
|
|
| 30 | - if ( ! is_user_logged_in() ) {
|
|
| 29 | + if ( empty( $email ) ) { |
|
| 30 | + if ( ! is_user_logged_in() ) { |
|
| 31 | 31 | return false; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -36,16 +36,16 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // Ensure we have a valid email. |
| 39 | - if ( ! is_email( $email ) ) {
|
|
| 39 | + if ( ! is_email( $email ) ) { |
|
| 40 | 40 | return false; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // Convert the integration type to a list ID |
| 44 | 44 | $checkbox_options = get_option( 'optin-checkbox-init', '' ); |
| 45 | - if ( empty( $checkbox_options ) ) {
|
|
| 45 | + if ( empty( $checkbox_options ) ) { |
|
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | - if ( ! isset( $checkbox_options[ $type ] ) || ! isset( $checkbox_options[ $type ]['associated-list'] ) ) {
|
|
| 48 | + if ( ! isset( $checkbox_options[ $type ] ) || ! isset( $checkbox_options[ $type ]['associated-list'] ) ) { |
|
| 49 | 49 | return false; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | $list_ids = is_array( $list_ids ) ? $list_ids : array( $list_ids ); |
| 54 | 54 | |
| 55 | 55 | // Go through each list... |
| 56 | - foreach ( $list_ids as $list_id ) {
|
|
| 56 | + foreach ( $list_ids as $list_id ) { |
|
| 57 | 57 | |
| 58 | - if ( ! $this->is_user_subscribed( $email, $list_id, $type ) ) {
|
|
| 58 | + if ( ! $this->is_user_subscribed( $email, $list_id, $type ) ) { |
|
| 59 | 59 | return false; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -75,18 +75,18 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @return bool Whether the email is subscribed to the list. |
| 77 | 77 | */ |
| 78 | - public function is_user_subscribed( $email, $list_id, $type ) {
|
|
| 78 | + public function is_user_subscribed( $email, $list_id, $type ) { |
|
| 79 | 79 | $email_hash = md5( $email ); |
| 80 | 80 | |
| 81 | 81 | // Check the API to see the status |
| 82 | 82 | $response = yikes_get_mc_api_manager()->get_list_handler()->get_member( $list_id, $email_hash, false ); |
| 83 | - if ( is_wp_error( $response ) ) {
|
|
| 83 | + if ( is_wp_error( $response ) ) { |
|
| 84 | 84 | $data = $response->get_error_data(); |
| 85 | 85 | |
| 86 | 86 | // If the error response is a 404, they are not subscribed. |
| 87 | - if ( isset( $data['status'] ) && 404 == $data['status'] ) {
|
|
| 87 | + if ( isset( $data['status'] ) && 404 == $data['status'] ) { |
|
| 88 | 88 | return false; |
| 89 | - } else {
|
|
| 89 | + } else { |
|
| 90 | 90 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 91 | 91 | $error_logging->maybe_write_to_log( |
| 92 | 92 | $response->get_error_code(), |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @return string |
| 111 | 111 | * @since 6.0.0 |
| 112 | 112 | */ |
| 113 | - public function yikes_get_checkbox() {
|
|
| 113 | + public function yikes_get_checkbox() { |
|
| 114 | 114 | |
| 115 | 115 | // Enqueue our checkbox styles whenever the checkbox is displayed |
| 116 | 116 | wp_enqueue_style( 'yikes-easy-mailchimp-checkbox-integration-styles', plugin_dir_url( __FILE__ ) . '../css/yikes-inc-easy-mailchimp-checkbox-integration.min.css' ); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | // We need to make sure we have a legit list ID right here. I don't think it will ever equal '-' |
| 124 | 124 | |
| 125 | - if ( $has_list_ids ) {
|
|
| 125 | + if ( $has_list_ids ) { |
|
| 126 | 126 | $checked = ( $checkbox_options[$this->type]['precheck'] == 'true' ) ? 'checked' : ''; |
| 127 | 127 | // before checkbox HTML (comment, ...) |
| 128 | 128 | $before = '<!-- Easy Forms for MailChimp - https://www.yikesplugins.com/ -->'; |
@@ -150,19 +150,19 @@ discard block |
||
| 150 | 150 | * @param string $type The integration type. |
| 151 | 151 | * @param array $merge_vars The array of form data to send. |
| 152 | 152 | */ |
| 153 | - public function subscribe_user_integration( $email, $type, $merge_vars ) {
|
|
| 153 | + public function subscribe_user_integration( $email, $type, $merge_vars ) { |
|
| 154 | 154 | // get checkbox data |
| 155 | 155 | $options = get_option( 'optin-checkbox-init', '' ); |
| 156 | 156 | |
| 157 | 157 | // Make sure we have a list ID. |
| 158 | - if ( ! isset( $options[ $type ] ) || ! isset( $options[ $type ]['associated-list'] ) ) {
|
|
| 158 | + if ( ! isset( $options[ $type ] ) || ! isset( $options[ $type ]['associated-list'] ) ) { |
|
| 159 | 159 | // @todo: Throw some kind of error? |
| 160 | 160 | return; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | // Check for an IP address. |
| 164 | 164 | $user_ip = sanitize_text_field( $_SERVER['REMOTE_ADDR'] ); |
| 165 | - if ( isset( $merge_vars['OPTIN_IP'] ) ) {
|
|
| 165 | + if ( isset( $merge_vars['OPTIN_IP'] ) ) { |
|
| 166 | 166 | $user_ip = sanitize_text_field( $merge_vars['OPTIN_IP'] ); |
| 167 | 167 | } |
| 168 | 168 | |
@@ -181,20 +181,20 @@ discard block |
||
| 181 | 181 | 'ip_signup' => $user_ip, |
| 182 | 182 | ); |
| 183 | 183 | |
| 184 | - foreach ( $list_ids as $list_id ) {
|
|
| 184 | + foreach ( $list_ids as $list_id ) { |
|
| 185 | 185 | |
| 186 | 186 | $interests = isset( $options[ $type ]['interest-groups'] ) ? $options[ $type ]['interest-groups'] : array(); |
| 187 | 187 | $interests = isset( $interests[$list_id] ) ? $interests[$list_id] : $interests; |
| 188 | 188 | |
| 189 | 189 | // Only re-format and add interest groups if not empty |
| 190 | - if ( ! empty( $interests ) ) {
|
|
| 190 | + if ( ! empty( $interests ) ) { |
|
| 191 | 191 | |
| 192 | 192 | $groups = array(); |
| 193 | 193 | |
| 194 | 194 | // Need to reformat interest groups array as $interest_group_ID => true |
| 195 | - foreach( $interests as $interest ) {
|
|
| 196 | - if ( is_array( $interest ) ) {
|
|
| 197 | - foreach( $interest as $group_id ) {
|
|
| 195 | + foreach( $interests as $interest ) { |
|
| 196 | + if ( is_array( $interest ) ) { |
|
| 197 | + foreach( $interest as $group_id ) { |
|
| 198 | 198 | $groups[ $group_id ] = true; |
| 199 | 199 | } |
| 200 | 200 | } |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | |
| 229 | 229 | // Subscribe the user to the list via the API. |
| 230 | 230 | $response = yikes_get_mc_api_manager()->get_list_handler()->member_subscribe( $list_id, $id, $data ); |
| 231 | - if ( is_wp_error( $response ) ) {
|
|
| 231 | + if ( is_wp_error( $response ) ) { |
|
| 232 | 232 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 233 | 233 | $error_logging->maybe_write_to_log( |
| 234 | 234 | $response->get_error_code(), |
@@ -245,21 +245,21 @@ discard block |
||
| 245 | 245 | * Build merge varaibles array |
| 246 | 246 | * @since 6.0.0 |
| 247 | 247 | */ |
| 248 | - public function user_merge_vars( WP_User $user ) {
|
|
| 248 | + public function user_merge_vars( WP_User $user ) { |
|
| 249 | 249 | |
| 250 | 250 | // Start with user_login as name, since that's always known |
| 251 | 251 | $merge_vars = array( |
| 252 | 252 | 'NAME' => $user->user_login, |
| 253 | 253 | ); |
| 254 | 254 | |
| 255 | - if ( ! empty( $user->first_name ) ) {
|
|
| 255 | + if ( ! empty( $user->first_name ) ) { |
|
| 256 | 256 | $merge_vars['NAME'] = $user->first_name; |
| 257 | 257 | $merge_vars['FNAME'] = $user->first_name; |
| 258 | 258 | } |
| 259 | - if ( ! empty( $user->last_name ) ) {
|
|
| 259 | + if ( ! empty( $user->last_name ) ) { |
|
| 260 | 260 | $merge_vars['LNAME'] = $user->last_name; |
| 261 | 261 | } |
| 262 | - if ( ! empty( $user->first_name ) && ! empty( $user->last_name ) ) {
|
|
| 262 | + if ( ! empty( $user->first_name ) && ! empty( $user->last_name ) ) { |
|
| 263 | 263 | $merge_vars['NAME'] = sprintf( '%s %s', $user->first_name, $user->last_name ); |
| 264 | 264 | } |
| 265 | 265 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | * before continuing |
| 282 | 282 | * @since 6.0.0 |
| 283 | 283 | */ |
| 284 | - public function was_checkbox_checked( $type ) {
|
|
| 284 | + public function was_checkbox_checked( $type ) { |
|
| 285 | 285 | return ( isset( $_POST[ 'yikes_mailchimp_checkbox_' . $type ] ) && $_POST[ 'yikes_mailchimp_checkbox_' . $type ] == 1 ); |
| 286 | 286 | } |
| 287 | 287 | |
@@ -291,15 +291,15 @@ discard block |
||
| 291 | 291 | * if the registration form checkbox integration is toggled on |
| 292 | 292 | * @since 6.0.0 |
| 293 | 293 | **/ |
| 294 | - public function yikes_reg_complete_msg( $errors, $redirect_to ) {
|
|
| 295 | - if( isset( $errors->errors['registered'] ) ) {
|
|
| 294 | + public function yikes_reg_complete_msg( $errors, $redirect_to ) { |
|
| 295 | + if( isset( $errors->errors['registered'] ) ) { |
|
| 296 | 296 | $email_error = get_option( 'yikes_register_subscription_error' , '' ); |
| 297 | - if( isset( $email_error ) && $email_error != '' ) {
|
|
| 297 | + if( isset( $email_error ) && $email_error != '' ) { |
|
| 298 | 298 | // Use the magic __get method to retrieve the errors array: |
| 299 | 299 | $tmp = $errors->errors; |
| 300 | 300 | $old = 'Registration complete. Please check your e-mail.'; |
| 301 | - foreach( $tmp['registered'] as $index => $msg ) {
|
|
| 302 | - if( $msg === $old ) {
|
|
| 301 | + foreach( $tmp['registered'] as $index => $msg ) { |
|
| 302 | + if( $msg === $old ) { |
|
| 303 | 303 | $tmp['registered'][$index] = $old . ' <p class="message"><strong>' . __( 'Note' , 'yikes-inc-easy-mailchimp-extender' ) . '</strong>: ' . $email_error . '</p>'; |
| 304 | 304 | } |
| 305 | 305 | } |
@@ -113,7 +113,7 @@ |
||
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | 115 | * @param int $order_id |
| 116 | - * @return boolean |
|
| 116 | + * @return boolean|null |
|
| 117 | 117 | */ |
| 118 | 118 | public function subscribe_from_woocommerce_checkout( $order_id ) { |
| 119 | 119 | $do_optin = get_post_meta( $order_id, 'yikes_easy_mailchimp_optin', true ); |
@@ -82,12 +82,12 @@ discard block |
||
| 82 | 82 | $precheck = isset( $checkbox_options[$this->type]['precheck'] ) && $checkbox_options[$this->type]['precheck'] == 'true' ? '1' : '0'; |
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | - * Filter where the checkbox goes. |
|
| 86 | - * |
|
| 87 | - * See this WooCo article for possible values: https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/ |
|
| 88 | - * |
|
| 89 | - * @param string | Which set of fields the checkbox should go into |
|
| 90 | - */ |
|
| 85 | + * Filter where the checkbox goes. |
|
| 86 | + * |
|
| 87 | + * See this WooCo article for possible values: https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/ |
|
| 88 | + * |
|
| 89 | + * @param string | Which set of fields the checkbox should go into |
|
| 90 | + */ |
|
| 91 | 91 | $field_placement = apply_filters( 'yikes-mailchimp-wooco-integration-checkbox-placement', 'billing' ); |
| 92 | 92 | |
| 93 | 93 | $fields[ $field_placement ]['yikes_mailchimp_checkbox_' . $this->type] = array( |
@@ -103,8 +103,8 @@ discard block |
||
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | - * @param int $order_id |
|
| 107 | - */ |
|
| 106 | + * @param int $order_id |
|
| 107 | + */ |
|
| 108 | 108 | public function save_woocommerce_checkout_checkbox_value( $order_id ) { |
| 109 | 109 | |
| 110 | 110 | // Update the order post meta |
@@ -112,9 +112,9 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | - * @param int $order_id |
|
| 116 | - * @return boolean |
|
| 117 | - */ |
|
| 115 | + * @param int $order_id |
|
| 116 | + * @return boolean |
|
| 117 | + */ |
|
| 118 | 118 | public function subscribe_from_woocommerce_checkout( $order_id ) { |
| 119 | 119 | $do_optin = get_post_meta( $order_id, 'yikes_easy_mailchimp_optin', true ); |
| 120 | 120 | |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | // Prevent direct access to the file |
| 11 | -defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 11 | +defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 12 | 12 | |
| 13 | 13 | class Yikes_Easy_MC_WooCommerce_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class { |
| 14 | 14 | |
@@ -42,21 +42,21 @@ discard block |
||
| 42 | 42 | public function add_checkout_field_html() { |
| 43 | 43 | |
| 44 | 44 | // Get checkbox data |
| 45 | - $checkbox_options = get_option( 'optin-checkbox-init' , array() ); |
|
| 45 | + $checkbox_options = get_option( 'optin-checkbox-init', array() ); |
|
| 46 | 46 | |
| 47 | 47 | // Only display the field if a list is set |
| 48 | - if ( isset( $checkbox_options[$this->type] ) && isset( $checkbox_options[$this->type]['associated-list'] ) && $checkbox_options[$this->type]['associated-list'] != '-' ) { |
|
| 48 | + if ( isset( $checkbox_options[ $this->type ] ) && isset( $checkbox_options[ $this->type ][ 'associated-list' ] ) && $checkbox_options[ $this->type ][ 'associated-list' ] != '-' ) { |
|
| 49 | 49 | |
| 50 | 50 | if ( $this->is_user_already_subscribed( $this->type ) ) { |
| 51 | 51 | return $fields; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - $precheck = isset( $checkbox_options[$this->type]['precheck'] ) && $checkbox_options[$this->type]['precheck'] == 'true'; |
|
| 54 | + $precheck = isset( $checkbox_options[ $this->type ][ 'precheck' ] ) && $checkbox_options[ $this->type ][ 'precheck' ] == 'true'; |
|
| 55 | 55 | |
| 56 | 56 | ?> |
| 57 | 57 | <label class="checkbox yikes-mailchimp-woocommerce-checkout-form-checkbox"> |
| 58 | 58 | <input type="checkbox" class="input-checkbox " name="yikes_mailchimp_checkbox_woocommerce_checkout_form" id="yikes_mailchimp_checkbox_woocommerce_checkout_form" value="1" <?php echo $precheck ? 'checked="checked"' : ''; ?>> |
| 59 | - <?php echo $checkbox_options[$this->type]['label']; ?> |
|
| 59 | + <?php echo $checkbox_options[ $this->type ][ 'label' ]; ?> |
|
| 60 | 60 | </label> |
| 61 | 61 | <?php |
| 62 | 62 | } |
@@ -70,16 +70,16 @@ discard block |
||
| 70 | 70 | public function add_checkout_field( $fields ) { |
| 71 | 71 | |
| 72 | 72 | // Get checkbox data |
| 73 | - $checkbox_options = get_option( 'optin-checkbox-init' , array() ); |
|
| 73 | + $checkbox_options = get_option( 'optin-checkbox-init', array() ); |
|
| 74 | 74 | |
| 75 | 75 | // Only display the field if a list is set |
| 76 | - if ( isset( $checkbox_options[$this->type] ) && isset( $checkbox_options[$this->type]['associated-list'] ) && $checkbox_options[$this->type]['associated-list'] != '-' ) { |
|
| 76 | + if ( isset( $checkbox_options[ $this->type ] ) && isset( $checkbox_options[ $this->type ][ 'associated-list' ] ) && $checkbox_options[ $this->type ][ 'associated-list' ] != '-' ) { |
|
| 77 | 77 | |
| 78 | 78 | if ( $this->is_user_already_subscribed( $this->type ) ) { |
| 79 | 79 | return $fields; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - $precheck = isset( $checkbox_options[$this->type]['precheck'] ) && $checkbox_options[$this->type]['precheck'] == 'true' ? '1' : '0'; |
|
| 82 | + $precheck = isset( $checkbox_options[ $this->type ][ 'precheck' ] ) && $checkbox_options[ $this->type ][ 'precheck' ] == 'true' ? '1' : '0'; |
|
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | 85 | * Filter where the checkbox goes. |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | $field_placement = apply_filters( 'yikes-mailchimp-wooco-integration-checkbox-placement', 'billing' ); |
| 92 | 92 | |
| 93 | - $fields[ $field_placement ]['yikes_mailchimp_checkbox_' . $this->type] = array( |
|
| 93 | + $fields[ $field_placement ][ 'yikes_mailchimp_checkbox_' . $this->type ] = array( |
|
| 94 | 94 | 'id' => 'yikes_mailchimp_checkbox_' . $this->type, |
| 95 | 95 | 'type' => 'checkbox', |
| 96 | 96 | 'class' => apply_filters( 'yikes-mailchimp-wooco-integration-checkbox-classes', array( 'form-row-wide' ) ), |
| 97 | - 'label' => $checkbox_options[$this->type]['label'], |
|
| 97 | + 'label' => $checkbox_options[ $this->type ][ 'label' ], |
|
| 98 | 98 | 'default' => $precheck, |
| 99 | 99 | ); |
| 100 | 100 | } |
@@ -1,15 +1,15 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | $form_data = array( |
| 3 | - 'field_name' => $_POST['field_name'], |
|
| 4 | - 'merge_tag' => $_POST['merge_tag'], |
|
| 5 | - 'field_type' => $_POST['field_type'], |
|
| 6 | - 'list_id' => $_POST['list_id'], |
|
| 3 | + 'field_name' => $_POST[ 'field_name' ], |
|
| 4 | + 'merge_tag' => $_POST[ 'merge_tag' ], |
|
| 5 | + 'field_type' => $_POST[ 'field_type' ], |
|
| 6 | + 'list_id' => $_POST[ 'list_id' ], |
|
| 7 | 7 | ); |
| 8 | 8 | |
| 9 | 9 | // Grab our list handler. |
| 10 | 10 | $list_handler = yikes_get_mc_api_manager()->get_list_handler(); |
| 11 | 11 | |
| 12 | -$available_merge_variables = $list_handler->get_merge_fields( $form_data['list_id'] ); |
|
| 12 | +$available_merge_variables = $list_handler->get_merge_fields( $form_data[ 'list_id' ] ); |
|
| 13 | 13 | if ( is_wp_error( $available_merge_variables ) ) { |
| 14 | 14 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 15 | 15 | $error_logging->maybe_write_to_log( |
@@ -28,17 +28,17 @@ discard block |
||
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | // find and return the location of this merge field in the array |
| 31 | -$index = $this->findMCListIndex( $form_data['merge_tag'], $available_merge_variables['merge_fields'], 'tag' ); |
|
| 31 | +$index = $this->findMCListIndex( $form_data[ 'merge_tag' ], $available_merge_variables[ 'merge_fields' ], 'tag' ); |
|
| 32 | 32 | |
| 33 | 33 | // store it and use it to pre-populate field data (only on initial add to form) |
| 34 | -$merge_field_data = $available_merge_variables['merge_fields'][ $index ]; |
|
| 34 | +$merge_field_data = $available_merge_variables[ 'merge_fields' ][ $index ]; |
|
| 35 | 35 | ?> |
| 36 | -<section class="draggable" id="<?php echo $form_data['field_name']; ?>"> |
|
| 36 | +<section class="draggable" id="<?php echo $form_data[ 'field_name' ]; ?>"> |
|
| 37 | 37 | <!-- top --> |
| 38 | 38 | <a href="#" class="expansion-section-title settings-sidebar"> |
| 39 | - <span class="dashicons dashicons-plus yikes-mc-expansion-toggle" title="<?php _e( 'Expand Field' , 'yikes-inc-easy-mailchimp-extender' ); ?>"></span> |
|
| 40 | - <?php echo stripslashes( $form_data['field_name'] ); ?> |
|
| 41 | - <span class="field-type-text"><small><?php echo __( 'type' , 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $form_data['field_type']; ?></small></span> |
|
| 39 | + <span class="dashicons dashicons-plus yikes-mc-expansion-toggle" title="<?php _e( 'Expand Field', 'yikes-inc-easy-mailchimp-extender' ); ?>"></span> |
|
| 40 | + <?php echo stripslashes( $form_data[ 'field_name' ] ); ?> |
|
| 41 | + <span class="field-type-text"><small><?php echo __( 'type', 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $form_data[ 'field_type' ]; ?></small></span> |
|
| 42 | 42 | </a> |
| 43 | 43 | <!-- expansion section --> |
| 44 | 44 | <div class="yikes-mc-settings-expansion-section"> |
@@ -46,14 +46,14 @@ discard block |
||
| 46 | 46 | <!-- Single or Double Opt-in --> |
| 47 | 47 | <p class="type-container form-field-container"><!-- necessary to prevent skipping on slideToggle(); --> |
| 48 | 48 | <!-- store the label --> |
| 49 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][label]" value="<?php echo htmlspecialchars( $form_data['field_name'] ); ?>" /> |
|
| 50 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][type]" value="<?php echo $form_data['field_type']; ?>" /> |
|
| 51 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][merge]" value="<?php echo $merge_field_data['tag']; ?>" /> |
|
| 52 | - <input type="hidden" class="field-<?php echo $merge_field_data['tag']; ?>-position position-input" name="field[<?php echo $merge_field_data['tag']; ?>][position]" value="" /> |
|
| 49 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][label]" value="<?php echo htmlspecialchars( $form_data[ 'field_name' ] ); ?>" /> |
|
| 50 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][type]" value="<?php echo $form_data[ 'field_type' ]; ?>" /> |
|
| 51 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][merge]" value="<?php echo $merge_field_data[ 'tag' ]; ?>" /> |
|
| 52 | + <input type="hidden" class="field-<?php echo $merge_field_data[ 'tag' ]; ?>-position position-input" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][position]" value="" /> |
|
| 53 | 53 | |
| 54 | - <?php if ( $form_data['field_type'] == 'radio' || $form_data['field_type'] == 'dropdown' ) { ?> |
|
| 55 | - <?php $choices = ( isset( $merge_field_data['options']['choices'] ) ) ? esc_attr( json_encode( $merge_field_data['options']['choices'] ) ) : ''; ?> |
|
| 56 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][choices]" value='<?php echo $choices; ?>' /> |
|
| 54 | + <?php if ( $form_data[ 'field_type' ] == 'radio' || $form_data[ 'field_type' ] == 'dropdown' ) { ?> |
|
| 55 | + <?php $choices = ( isset( $merge_field_data[ 'options' ][ 'choices' ] ) ) ? esc_attr( json_encode( $merge_field_data[ 'options' ][ 'choices' ] ) ) : ''; ?> |
|
| 56 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][choices]" value='<?php echo $choices; ?>' /> |
|
| 57 | 57 | <?php } ?> |
| 58 | 58 | |
| 59 | 59 | <table class="form-table form-field-container"> |
@@ -62,15 +62,15 @@ discard block |
||
| 62 | 62 | <tr valign="top"> |
| 63 | 63 | <td scope="row"> |
| 64 | 64 | <label for="merge-tag"> |
| 65 | - <?php _e( 'Merge Tag' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 65 | + <?php _e( 'Merge Tag', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 66 | 66 | </label> |
| 67 | 67 | </td> |
| 68 | 68 | <td> |
| 69 | - <input class="widefat merge-tag-text" type="text" readonly value="<?php echo $merge_field_data['tag']; ?>"> |
|
| 69 | + <input class="widefat merge-tag-text" type="text" readonly value="<?php echo $merge_field_data[ 'tag' ]; ?>"> |
|
| 70 | 70 | </td> |
| 71 | 71 | </tr> |
| 72 | 72 | |
| 73 | - <?php switch( $form_data['field_type'] ) { |
|
| 73 | + <?php switch ( $form_data[ 'field_type' ] ) { |
|
| 74 | 74 | |
| 75 | 75 | default: |
| 76 | 76 | break; |
@@ -87,12 +87,12 @@ discard block |
||
| 87 | 87 | <tr valign="top"> |
| 88 | 88 | <td scope="row"> |
| 89 | 89 | <label for="placeholder"> |
| 90 | - <?php _e( 'Placeholder' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 90 | + <?php _e( 'Placeholder', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 91 | 91 | </label> |
| 92 | 92 | </td> |
| 93 | 93 | <td> |
| 94 | - <input type="text" class="widefat" name="field[<?php echo $merge_field_data['tag']; ?>][placeholder]" value="<?php echo isset( $merge_field_data['placeholder'] ) ? stripslashes( wp_strip_all_tags( $merge_field_data['placeholder'] ) ): '' ; ?>" /> |
|
| 95 | - <p class="description"><small><?php _e( "Assign a placeholder value to this field.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 94 | + <input type="text" class="widefat" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][placeholder]" value="<?php echo isset( $merge_field_data[ 'placeholder' ] ) ? stripslashes( wp_strip_all_tags( $merge_field_data[ 'placeholder' ] ) ) : ''; ?>" /> |
|
| 95 | + <p class="description"><small><?php _e( "Assign a placeholder value to this field.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 96 | 96 | </td> |
| 97 | 97 | </tr> |
| 98 | 98 | |
@@ -101,27 +101,27 @@ discard block |
||
| 101 | 101 | * Loop over field types and store necessary formats |
| 102 | 102 | * ( date, birthday - dateformat ; phone - phoneformat ) |
| 103 | 103 | */ |
| 104 | - switch( $form_data['field_type'] ) { |
|
| 104 | + switch ( $form_data[ 'field_type' ] ) { |
|
| 105 | 105 | |
| 106 | 106 | /* Store the date format, for properly rendering dates on the front end */ |
| 107 | 107 | case 'date': |
| 108 | - $date_format = isset( $merge_field_data['options']['dateformat'] ) ? $merge_field_data['options']['dateformat'] : 'MM/DD/YYYY'; |
|
| 108 | + $date_format = isset( $merge_field_data[ 'options' ][ 'dateformat' ] ) ? $merge_field_data[ 'options' ][ 'dateformat' ] : 'MM/DD/YYYY'; |
|
| 109 | 109 | ?> |
| 110 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][date_format]" value="<?php echo strtolower( $date_format ); ?>" /> |
|
| 110 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][date_format]" value="<?php echo strtolower( $date_format ); ?>" /> |
|
| 111 | 111 | <?php |
| 112 | 112 | break; |
| 113 | 113 | |
| 114 | 114 | case 'birthday': |
| 115 | - $date_format = isset( $merge_field_data['options']['dateformat'] ) ? $merge_field_data['options']['dateformat'] : 'MM/DD'; |
|
| 115 | + $date_format = isset( $merge_field_data[ 'options' ][ 'dateformat' ] ) ? $merge_field_data[ 'options' ][ 'dateformat' ] : 'MM/DD'; |
|
| 116 | 116 | ?> |
| 117 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][date_format]" value="<?php echo strtolower( $date_format ); ?>" /> |
|
| 117 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][date_format]" value="<?php echo strtolower( $date_format ); ?>" /> |
|
| 118 | 118 | <?php |
| 119 | 119 | break; |
| 120 | 120 | |
| 121 | 121 | /* Store the phone format, for properly regex pattern */ |
| 122 | 122 | case 'phone': |
| 123 | 123 | ?> |
| 124 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][phone_format]" value="<?php echo $merge_field_data['options']['phone_format']; ?>" /> |
|
| 124 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][phone_format]" value="<?php echo $merge_field_data[ 'options' ][ 'phone_format' ]; ?>" /> |
|
| 125 | 125 | <?php |
| 126 | 126 | break; |
| 127 | 127 | } |
@@ -132,13 +132,13 @@ discard block |
||
| 132 | 132 | ?> |
| 133 | 133 | <tr valign="top"> |
| 134 | 134 | <td scope="row"> |
| 135 | - <label for="placeholder_<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 136 | - <?php _e( 'Placeholder' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 135 | + <label for="placeholder_<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 136 | + <?php _e( 'Placeholder', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 137 | 137 | </label> |
| 138 | 138 | </td> |
| 139 | 139 | <td> |
| 140 | - <input type="checkbox" class="widefat" name="field[<?php echo $merge_field_data['tag']; ?>][placeholder]" value="1" /> |
|
| 141 | - <span class="description"><small><?php _e( "Use placeholders for this field (these will be automatically filled in with field names).", 'yikes-inc-easy-mailchimp-extender' );?></small></span> |
|
| 140 | + <input type="checkbox" class="widefat" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][placeholder]" value="1" /> |
|
| 141 | + <span class="description"><small><?php _e( "Use placeholders for this field (these will be automatically filled in with field names).", 'yikes-inc-easy-mailchimp-extender' ); ?></small></span> |
|
| 142 | 142 | </td> |
| 143 | 143 | </tr> |
| 144 | 144 | <?php |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | ?> |
| 149 | 149 | |
| 150 | 150 | <!-- Default Value --> |
| 151 | - <?php switch( $form_data['field_type'] ) { |
|
| 151 | + <?php switch ( $form_data[ 'field_type' ] ) { |
|
| 152 | 152 | |
| 153 | 153 | default: |
| 154 | 154 | case 'text': |
@@ -156,17 +156,17 @@ discard block |
||
| 156 | 156 | <tr valign="top"> |
| 157 | 157 | <td scope="row"> |
| 158 | 158 | <label for="placeholder"> |
| 159 | - <?php _e( 'Default Value' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 159 | + <?php _e( 'Default Value', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 160 | 160 | </label> |
| 161 | 161 | </td> |
| 162 | 162 | <td> |
| 163 | - <input type="text" class="widefat" name="field[<?php echo $merge_field_data['tag']; ?>][default]" <?php if( $form_data['field_type'] != 'url' ) { ?> value="<?php echo isset( $merge_field_data['default_value'] ) ? stripslashes( wp_strip_all_tags( $merge_field_data['default_value'] ) ) : ''; ?>" <?php } else { ?> value="<?php echo isset( $merge_field_data['default_value'] ) ? stripslashes( wp_strip_all_tags( esc_url_raw( $merge_field_data['default_value'] ) ) ) : ''; } ?>" /> |
|
| 164 | - <p class="description"><small><?php _e( "Assign a default value to populate this field with on initial page load.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 163 | + <input type="text" class="widefat" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][default]" <?php if ( $form_data[ 'field_type' ] != 'url' ) { ?> value="<?php echo isset( $merge_field_data[ 'default_value' ] ) ? stripslashes( wp_strip_all_tags( $merge_field_data[ 'default_value' ] ) ) : ''; ?>" <?php } else { ?> value="<?php echo isset( $merge_field_data[ 'default_value' ] ) ? stripslashes( wp_strip_all_tags( esc_url_raw( $merge_field_data[ 'default_value' ] ) ) ) : ''; } ?>" /> |
|
| 164 | + <p class="description"><small><?php _e( "Assign a default value to populate this field with on initial page load.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 165 | 165 | <?php |
| 166 | - switch ( $form_data['field_type'] ) { |
|
| 166 | + switch ( $form_data[ 'field_type' ] ) { |
|
| 167 | 167 | case 'text': |
| 168 | 168 | ?> |
| 169 | - <p><small class="pre-defined-tag-link"><a href="#TB_inline?width=600&height=550&inlineId=pre-defined-tag-container" class="thickbox" onclick="storeGlobalClicked( jQuery( this ) );"><?php _e( 'View Pre-Defined Tags' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></p> |
|
| 169 | + <p><small class="pre-defined-tag-link"><a href="#TB_inline?width=600&height=550&inlineId=pre-defined-tag-container" class="thickbox" onclick="storeGlobalClicked( jQuery( this ) );"><?php _e( 'View Pre-Defined Tags', 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></p> |
|
| 170 | 170 | <?php |
| 171 | 171 | break; |
| 172 | 172 | } ?> |
@@ -180,28 +180,28 @@ discard block |
||
| 180 | 180 | <tr valign="top"> |
| 181 | 181 | <td scope="row"> |
| 182 | 182 | <label for="placeholder"> |
| 183 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 183 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 184 | 184 | </label> |
| 185 | 185 | </td> |
| 186 | 186 | <td> |
| 187 | - <?php $pre_selected = ! empty( $merge_field_data['default_choice'] ) ? $merge_field_data['default_choice'] : 'no-default'; ?> |
|
| 188 | - <label for="<?php echo $merge_field_data['tag'] . '-no-default'; ?>"> |
|
| 189 | - <input id="<?php echo $merge_field_data['tag'] . '-no-default'; ?>" |
|
| 187 | + <?php $pre_selected = ! empty( $merge_field_data[ 'default_choice' ] ) ? $merge_field_data[ 'default_choice' ] : 'no-default'; ?> |
|
| 188 | + <label for="<?php echo $merge_field_data[ 'tag' ] . '-no-default'; ?>"> |
|
| 189 | + <input id="<?php echo $merge_field_data[ 'tag' ] . '-no-default'; ?>" |
|
| 190 | 190 | type="radio" |
| 191 | - name="field[<?php echo $merge_field_data['tag']; ?>][default_choice]" |
|
| 191 | + name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][default_choice]" |
|
| 192 | 192 | value="no-default" <?php checked( $pre_selected, 'no-default' ); ?> |
| 193 | 193 | > |
| 194 | 194 | No Default |
| 195 | 195 | </label> |
| 196 | 196 | <?php |
| 197 | 197 | $x = 0; |
| 198 | - foreach ( $merge_field_data['options']['choices'] as $choice => $value ) { ?> |
|
| 198 | + foreach ( $merge_field_data[ 'options' ][ 'choices' ] as $choice => $value ) { ?> |
|
| 199 | 199 | <label> |
| 200 | - <input type="radio" name="field[<?php echo $merge_field_data['tag']; ?>][default_choice]" value="<?php echo $x; ?>" <?php checked( $pre_selected, $choice ); ?>><?php echo $value; ?> |
|
| 200 | + <input type="radio" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][default_choice]" value="<?php echo $x; ?>" <?php checked( $pre_selected, $choice ); ?>><?php echo $value; ?> |
|
| 201 | 201 | </label> |
| 202 | 202 | <?php $x++; |
| 203 | 203 | } ?> |
| 204 | - <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 204 | + <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 205 | 205 | </td> |
| 206 | 206 | </tr> |
| 207 | 207 | |
@@ -213,18 +213,18 @@ discard block |
||
| 213 | 213 | <tr valign="top"> |
| 214 | 214 | <td scope="row"> |
| 215 | 215 | <label for="placeholder"> |
| 216 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 216 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 217 | 217 | </label> |
| 218 | 218 | </td> |
| 219 | 219 | <td> |
| 220 | - <select type="default" name="field[<?php echo $merge_field_data['tag']; ?>][default_choice]"> |
|
| 221 | - <?php $pre_selected = ! empty( $merge_field_data['default_choice'] ) ? $merge_field_data['default_choice'] : 'no-default'; ?> |
|
| 220 | + <select type="default" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][default_choice]"> |
|
| 221 | + <?php $pre_selected = ! empty( $merge_field_data[ 'default_choice' ] ) ? $merge_field_data[ 'default_choice' ] : 'no-default'; ?> |
|
| 222 | 222 | <option value="no-default" <?php selected( $pre_selected, $choice ); ?>>No Default</option> |
| 223 | - <?php foreach ( $merge_field_data['options']['choices'] as $choice => $value ) { ?> |
|
| 223 | + <?php foreach ( $merge_field_data[ 'options' ][ 'choices' ] as $choice => $value ) { ?> |
|
| 224 | 224 | <option value="<?php echo $choice; ?>" <?php selected( $pre_selected, $choice ); ?>><?php echo stripslashes( $value ); ?></option> |
| 225 | 225 | <?php } ?> |
| 226 | 226 | </select> |
| 227 | - <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 227 | + <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 228 | 228 | </td> |
| 229 | 229 | </tr> |
| 230 | 230 | |
@@ -237,77 +237,77 @@ discard block |
||
| 237 | 237 | <tr valign="top"> |
| 238 | 238 | <td scope="row"> |
| 239 | 239 | <label for="placeholder"> |
| 240 | - <?php _e( 'Description' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 240 | + <?php _e( 'Description', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 241 | 241 | </label> |
| 242 | 242 | </td> |
| 243 | 243 | <td> |
| 244 | - <textarea class="widefat field-description-input" name="field[<?php echo $merge_field_data['tag']; ?>][description]"></textarea> |
|
| 245 | - <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 244 | + <textarea class="widefat field-description-input" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][description]"></textarea> |
|
| 245 | + <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 246 | 246 | </td> |
| 247 | 247 | </tr> |
| 248 | 248 | <!-- Description Above Field --> |
| 249 | 249 | <tr valign="top"> |
| 250 | 250 | <td scope="row"> |
| 251 | - <label for="description_above_<?php echo esc_attr( $merge_field_data['tag'] ); ?>"> |
|
| 252 | - <?php _e( 'Description Above Field' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 251 | + <label for="description_above_<?php echo esc_attr( $merge_field_data[ 'tag' ] ); ?>"> |
|
| 252 | + <?php _e( 'Description Above Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 253 | 253 | </label> |
| 254 | 254 | </td> |
| 255 | 255 | <td> |
| 256 | - <input type="checkbox" id="description_above_<?php echo esc_attr( $merge_field_data['tag'] ); ?>" class="widefat field-description-input" name="field[<?php echo $merge_field_data['tag']; ?>][description_above]" value="1" /> |
|
| 257 | - <span class="description"><small><?php _e( "By default the description will appear undearneath the field. Check this box if you'd like the description to appear above the field.", 'yikes-inc-easy-mailchimp-extender' );?></small></span> |
|
| 256 | + <input type="checkbox" id="description_above_<?php echo esc_attr( $merge_field_data[ 'tag' ] ); ?>" class="widefat field-description-input" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][description_above]" value="1" /> |
|
| 257 | + <span class="description"><small><?php _e( "By default the description will appear undearneath the field. Check this box if you'd like the description to appear above the field.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></span> |
|
| 258 | 258 | </td> |
| 259 | 259 | </tr> |
| 260 | 260 | <!-- Additional Classes --> |
| 261 | 261 | <tr valign="top"> |
| 262 | 262 | <td scope="row"> |
| 263 | 263 | <label for="placeholder"> |
| 264 | - <?php _e( 'Additional Classes' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 264 | + <?php _e( 'Additional Classes', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 265 | 265 | </label> |
| 266 | 266 | </td> |
| 267 | 267 | <td> |
| 268 | - <input type="text" class="widefat" name="field[<?php echo $merge_field_data['tag']; ?>][additional-classes]" value="<?php echo isset( $form_data['classes'] ) ? stripslashes( wp_strip_all_tags( $form_data['classes'] ) ) : '' ; ?>" /> |
|
| 269 | - <p class="description"><small><?php printf( __( "Assign additional classes to this field. %s.", 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/bundled-css-classes/' ) . '">' . __( 'View bundled classes', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' );?></small></p> |
|
| 268 | + <input type="text" class="widefat" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][additional-classes]" value="<?php echo isset( $form_data[ 'classes' ] ) ? stripslashes( wp_strip_all_tags( $form_data[ 'classes' ] ) ) : ''; ?>" /> |
|
| 269 | + <p class="description"><small><?php printf( __( "Assign additional classes to this field. %s.", 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/bundled-css-classes/' ) . '">' . __( 'View bundled classes', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ); ?></small></p> |
|
| 270 | 270 | </td> |
| 271 | 271 | </tr> |
| 272 | 272 | <!-- Required Toggle --> |
| 273 | 273 | <tr valign="top"> |
| 274 | 274 | <td scope="row"> |
| 275 | 275 | <label for="field-required"> |
| 276 | - <?php _e( 'Field Required?' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 276 | + <?php _e( 'Field Required?', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 277 | 277 | </label> |
| 278 | 278 | </td> |
| 279 | 279 | <td> |
| 280 | - <input type="checkbox" class="widefat" value="1" name="field[<?php echo $merge_field_data['tag']; ?>][require]" <?php checked( $merge_field_data['required'], 1 ); ?> <?php if( $merge_field_data['tag'] == 'EMAIL' ) { ?> disabled="disabled" checked="checked" title="<?php echo __( 'Email is a required field.' , 'yikes-inc-easy-mailchimp-extender' ); } ?>"> |
|
| 281 | - <p class="description"><small><?php _e( "Require this field to be filled in before the form can be submitted.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 280 | + <input type="checkbox" class="widefat" value="1" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][require]" <?php checked( $merge_field_data[ 'required' ], 1 ); ?> <?php if ( $merge_field_data[ 'tag' ] == 'EMAIL' ) { ?> disabled="disabled" checked="checked" title="<?php echo __( 'Email is a required field.', 'yikes-inc-easy-mailchimp-extender' ); } ?>"> |
|
| 281 | + <p class="description"><small><?php _e( "Require this field to be filled in before the form can be submitted.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 282 | 282 | </td> |
| 283 | 283 | </tr> |
| 284 | 284 | <!-- Visible Toggle --> |
| 285 | 285 | <tr valign="top"> |
| 286 | 286 | <td scope="row"> |
| 287 | 287 | <label for="hide-field"> |
| 288 | - <?php _e( 'Hide Field' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 288 | + <?php _e( 'Hide Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 289 | 289 | </label> |
| 290 | 290 | </td> |
| 291 | 291 | <td> |
| 292 | - <input type="checkbox" class="widefat" value="1" name="field[<?php echo $merge_field_data['tag']; ?>][hide]" <?php checked( $merge_field_data['public'], '' ); ?> <?php if( $merge_field_data['tag'] == 'EMAIL' ) { ?> disabled="disabled" title="<?php echo __( 'Cannot toggle email field visibility.' , 'yikes-inc-easy-mailchimp-extender' ); } ?>"> |
|
| 293 | - <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 292 | + <input type="checkbox" class="widefat" value="1" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][hide]" <?php checked( $merge_field_data[ 'public' ], '' ); ?> <?php if ( $merge_field_data[ 'tag' ] == 'EMAIL' ) { ?> disabled="disabled" title="<?php echo __( 'Cannot toggle email field visibility.', 'yikes-inc-easy-mailchimp-extender' ); } ?>"> |
|
| 293 | + <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 294 | 294 | </td> |
| 295 | 295 | </tr> |
| 296 | 296 | <!-- Toggle Field Label Visibility --> |
| 297 | 297 | <tr valign="top"> |
| 298 | 298 | <td scope="row"> |
| 299 | 299 | <label for="placeholder"> |
| 300 | - <?php _e( 'Hide Label' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 300 | + <?php _e( 'Hide Label', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 301 | 301 | </label> |
| 302 | 302 | </td> |
| 303 | 303 | <td> |
| 304 | - <input type="checkbox" name="field[<?php echo $merge_field_data['tag']; ?>][hide-label]" value="1" /> |
|
| 305 | - <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 304 | + <input type="checkbox" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][hide-label]" value="1" /> |
|
| 305 | + <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 306 | 306 | </td> |
| 307 | 307 | </tr> |
| 308 | 308 | <!-- Display Phone/Date Formats back to the user --> |
| 309 | 309 | <?php |
| 310 | - switch( $form_data['field_type'] ) { |
|
| 310 | + switch ( $form_data[ 'field_type' ] ) { |
|
| 311 | 311 | |
| 312 | 312 | /* Store the phone format, for properly regex pattern */ |
| 313 | 313 | case 'phone': |
@@ -318,23 +318,23 @@ discard block |
||
| 318 | 318 | <td scope="row"> |
| 319 | 319 | <label for="placeholder"> |
| 320 | 320 | <?php |
| 321 | - switch( $form_data['field_type'] ) { |
|
| 321 | + switch ( $form_data[ 'field_type' ] ) { |
|
| 322 | 322 | default: |
| 323 | 323 | case 'birthday': |
| 324 | - $type = __( 'Date Format' , 'yikes-inc-easy-mailchimp-extender' ); |
|
| 325 | - $format = $merge_field_data['options']['date_format']; |
|
| 324 | + $type = __( 'Date Format', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 325 | + $format = $merge_field_data[ 'options' ][ 'date_format' ]; |
|
| 326 | 326 | $format_name = 'date_format'; |
| 327 | 327 | break; |
| 328 | 328 | |
| 329 | 329 | case 'date': |
| 330 | - $type = __( 'Date Format' , 'yikes-inc-easy-mailchimp-extender' ); |
|
| 331 | - $format = $merge_field_data['options']['date_format']; |
|
| 330 | + $type = __( 'Date Format', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 331 | + $format = $merge_field_data[ 'options' ][ 'date_format' ]; |
|
| 332 | 332 | $format_name = 'date_format'; |
| 333 | 333 | break; |
| 334 | 334 | |
| 335 | 335 | case 'phone': |
| 336 | - $type = __( 'Phone Format' , 'yikes-inc-easy-mailchimp-extender' ); |
|
| 337 | - $format = ( ( $merge_field_data['options']['phone_format'] == 'none' ) ? __( 'International', 'yikes-inc-easy-mailchimp-extender' ) : $merge_field_data['options']['phone_format'] ); |
|
| 336 | + $type = __( 'Phone Format', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 337 | + $format = ( ( $merge_field_data[ 'options' ][ 'phone_format' ] == 'none' ) ? __( 'International', 'yikes-inc-easy-mailchimp-extender' ) : $merge_field_data[ 'options' ][ 'phone_format' ] ); |
|
| 338 | 338 | $format_name = 'phone_format'; |
| 339 | 339 | break; |
| 340 | 340 | } |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | </td> |
| 345 | 345 | <td> |
| 346 | 346 | <strong><?php echo $format; ?></strong> |
| 347 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][<?php echo $format_name; ?>]" value="<?php echo $format; ?>" /> |
|
| 347 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][<?php echo $format_name; ?>]" value="<?php echo $format; ?>" /> |
|
| 348 | 348 | <p class="description"><small> |
| 349 | 349 | <?php printf( __( 'To change the %s please head over to <a href="%s" title="MailChimp" target="_blank">MailChimp</a>. If you alter the format, you should re-import this field.', 'yikes-inc-easy-mailchimp-extender' ), strtolower( $type ), esc_url( 'http://www.mailchimp.com' ) ); ?> |
| 350 | 350 | </small></p> |
@@ -365,8 +365,8 @@ discard block |
||
| 365 | 365 | </td> |
| 366 | 366 | <td> |
| 367 | 367 | <span class="toggle-container"> |
| 368 | - <a href="#" class="hide-field"><?php _e( "Close" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 369 | - <a href="#" class="remove-field" alt="<?php echo $merge_field_data['tag']; ?>"><?php _e( "Remove Field" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 368 | + <a href="#" class="hide-field"><?php _e( "Close", 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 369 | + <a href="#" class="remove-field" alt="<?php echo $merge_field_data[ 'tag' ]; ?>"><?php _e( "Remove Field", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 370 | 370 | </span> |
| 371 | 371 | </td> |
| 372 | 372 | </tr> |
@@ -5,8 +5,8 @@ discard block |
||
| 5 | 5 | $error = 0; |
| 6 | 6 | |
| 7 | 7 | // Get our $_POST variables |
| 8 | -$list_id = isset( $_POST['list_id'] ) ? $_POST['list_id'] : ''; |
|
| 9 | -$interest_groups = isset( $_POST['interest_groups'] ) ? $_POST['interest_groups'] : array(); |
|
| 8 | +$list_id = isset( $_POST[ 'list_id' ] ) ? $_POST[ 'list_id' ] : ''; |
|
| 9 | +$interest_groups = isset( $_POST[ 'interest_groups' ] ) ? $_POST[ 'interest_groups' ] : array(); |
|
| 10 | 10 | |
| 11 | 11 | // Make sure our $_POST variables aren't empty |
| 12 | 12 | if ( empty( $list_id ) ) { |
@@ -49,20 +49,20 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | // Loop through the interest groups data (group_id, field_name, field_type) and add the fields to the form |
| 52 | -foreach( $interest_groups as $group ) { |
|
| 52 | +foreach ( $interest_groups as $group ) { |
|
| 53 | 53 | |
| 54 | 54 | // find and return the location of this merge field in the array |
| 55 | - $index = $this->findMCListIndex( $group['group_id'], $interest_groupings, 'id' ); |
|
| 55 | + $index = $this->findMCListIndex( $group[ 'group_id' ], $interest_groupings, 'id' ); |
|
| 56 | 56 | $field_data = $interest_groupings[ $index ]; |
| 57 | - $groups = wp_list_pluck( $field_data['items'], 'name' ); |
|
| 57 | + $groups = wp_list_pluck( $field_data[ 'items' ], 'name' ); |
|
| 58 | 58 | |
| 59 | 59 | ?> |
| 60 | - <section class="draggable" id="<?php echo $group['group_id']; ?>"> |
|
| 60 | + <section class="draggable" id="<?php echo $group[ 'group_id' ]; ?>"> |
|
| 61 | 61 | <!-- top --> |
| 62 | 62 | <a href="#" class="expansion-section-title settings-sidebar"> |
| 63 | - <span class="dashicons dashicons-plus yikes-mc-expansion-toggle" title="<?php _e( 'Expand Field' , 'yikes-inc-easy-mailchimp-extender' ); ?>"></span> |
|
| 64 | - <?php echo stripslashes( $group['field_name'] ); ?> |
|
| 65 | - <span class="field-type-text"><small><?php echo __( 'type' , 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $group['field_type']; ?></small></span> |
|
| 63 | + <span class="dashicons dashicons-plus yikes-mc-expansion-toggle" title="<?php _e( 'Expand Field', 'yikes-inc-easy-mailchimp-extender' ); ?>"></span> |
|
| 64 | + <?php echo stripslashes( $group[ 'field_name' ] ); ?> |
|
| 65 | + <span class="field-type-text"><small><?php echo __( 'type', 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $group[ 'field_type' ]; ?></small></span> |
|
| 66 | 66 | </a> |
| 67 | 67 | <!-- expansion section --> |
| 68 | 68 | <div class="yikes-mc-settings-expansion-section"> |
@@ -70,37 +70,37 @@ discard block |
||
| 70 | 70 | <!-- Single or Double Opt-in --> |
| 71 | 71 | <p class="type-container"><!-- necessary to prevent skipping on slideToggle(); --> |
| 72 | 72 | <!-- store the label --> |
| 73 | - <input type="hidden" name="field[<?php echo $group['group_id']; ?>][label]" value="<?php echo htmlspecialchars( $group['field_name'] ); ?>" /> |
|
| 74 | - <input type="hidden" name="field[<?php echo $group['group_id']; ?>][type]" value="<?php echo $group['field_type']; ?>" /> |
|
| 75 | - <input type="hidden" name="field[<?php echo $group['group_id']; ?>][group_id]" value="<?php echo $group['group_id']; ?>" /> |
|
| 76 | - <input type="hidden" name="field[<?php echo $group['group_id']; ?>][groups]" value='<?php echo esc_attr( json_encode( $groups, true ) ); ?>' /> |
|
| 73 | + <input type="hidden" name="field[<?php echo $group[ 'group_id' ]; ?>][label]" value="<?php echo htmlspecialchars( $group[ 'field_name' ] ); ?>" /> |
|
| 74 | + <input type="hidden" name="field[<?php echo $group[ 'group_id' ]; ?>][type]" value="<?php echo $group[ 'field_type' ]; ?>" /> |
|
| 75 | + <input type="hidden" name="field[<?php echo $group[ 'group_id' ]; ?>][group_id]" value="<?php echo $group[ 'group_id' ]; ?>" /> |
|
| 76 | + <input type="hidden" name="field[<?php echo $group[ 'group_id' ]; ?>][groups]" value='<?php echo esc_attr( json_encode( $groups, true ) ); ?>' /> |
|
| 77 | 77 | |
| 78 | 78 | |
| 79 | 79 | <table class="form-table form-field-container"> |
| 80 | 80 | |
| 81 | 81 | <!-- Default Value --> |
| 82 | - <?php switch( $group['field_type'] ) { |
|
| 82 | + <?php switch ( $group[ 'field_type' ] ) { |
|
| 83 | 83 | |
| 84 | 84 | case 'radio': |
| 85 | 85 | ?> |
| 86 | 86 | <tr valign="top"> |
| 87 | 87 | <td scope="row"> |
| 88 | 88 | <label for="placeholder"> |
| 89 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 89 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 90 | 90 | </label> |
| 91 | 91 | </td> |
| 92 | 92 | <td> |
| 93 | 93 | |
| 94 | - <?php $pre_selected = ! empty( $field_data['default_choice'] ) ? $field_data['default_choice'] : 'no-default'; ?> |
|
| 94 | + <?php $pre_selected = ! empty( $field_data[ 'default_choice' ] ) ? $field_data[ 'default_choice' ] : 'no-default'; ?> |
|
| 95 | 95 | |
| 96 | 96 | <!-- No Default option for radio buttons --> |
| 97 | - <input type="radio" name="field[<?php echo $group['group_id']; ?>][default_choice][]" value="no-default" <?php checked( $pre_selected, 'no-default' ); ?>>No Default |
|
| 97 | + <input type="radio" name="field[<?php echo $group[ 'group_id' ]; ?>][default_choice][]" value="no-default" <?php checked( $pre_selected, 'no-default' ); ?>>No Default |
|
| 98 | 98 | |
| 99 | - <?php foreach ( $field_data['items'] as $id => $interest_group ) { ?> |
|
| 100 | - <input type="radio" name="field[<?php echo $group['group_id']; ?>][default_choice][]" value="<?php echo esc_attr( $id ); ?>" <?php checked( $pre_selected, $id ); ?>><?php echo stripslashes( $interest_group['name'] ); |
|
| 99 | + <?php foreach ( $field_data[ 'items' ] as $id => $interest_group ) { ?> |
|
| 100 | + <input type="radio" name="field[<?php echo $group[ 'group_id' ]; ?>][default_choice][]" value="<?php echo esc_attr( $id ); ?>" <?php checked( $pre_selected, $id ); ?>><?php echo stripslashes( $interest_group[ 'name' ] ); |
|
| 101 | 101 | } ?> |
| 102 | 102 | |
| 103 | - <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 103 | + <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 104 | 104 | </td> |
| 105 | 105 | </tr> |
| 106 | 106 | |
@@ -114,19 +114,19 @@ discard block |
||
| 114 | 114 | <tr valign="top"> |
| 115 | 115 | <td scope="row"> |
| 116 | 116 | <label for="placeholder"> |
| 117 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 117 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 118 | 118 | </label> |
| 119 | 119 | </td> |
| 120 | 120 | <td> |
| 121 | 121 | <?php |
| 122 | - foreach ( $field_data['items'] as $id => $interest_group ) { |
|
| 123 | - $pre_selected = ! empty( $field_data['default_choice'] ) ? $field_data['default_choice'] : '0'; |
|
| 122 | + foreach ( $field_data[ 'items' ] as $id => $interest_group ) { |
|
| 123 | + $pre_selected = ! empty( $field_data[ 'default_choice' ] ) ? $field_data[ 'default_choice' ] : '0'; |
|
| 124 | 124 | ?> |
| 125 | - <input type="checkbox" name="field[<?php echo $group['group_id']; ?>][default_choice][]" value="<?php echo $id; ?>" <?php checked( $pre_selected, $id ); ?>><?php echo stripslashes( $interest_group['name'] ); ?> |
|
| 125 | + <input type="checkbox" name="field[<?php echo $group[ 'group_id' ]; ?>][default_choice][]" value="<?php echo $id; ?>" <?php checked( $pre_selected, $id ); ?>><?php echo stripslashes( $interest_group[ 'name' ] ); ?> |
|
| 126 | 126 | <?php |
| 127 | 127 | } |
| 128 | 128 | ?> |
| 129 | - <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 129 | + <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 130 | 130 | </td> |
| 131 | 131 | </tr> |
| 132 | 132 | |
@@ -138,18 +138,18 @@ discard block |
||
| 138 | 138 | <tr valign="top"> |
| 139 | 139 | <td scope="row"> |
| 140 | 140 | <label for="placeholder"> |
| 141 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 141 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 142 | 142 | </label> |
| 143 | 143 | </td> |
| 144 | 144 | <td> |
| 145 | - <select type="default" name="field[<?php echo $group['group_id']; ?>][default_choice]"> |
|
| 146 | - <?php $pre_selected = ! empty( $field_data['default_choice'] ) ? $field_data['default_choice'] : 'no-default'; ?> |
|
| 145 | + <select type="default" name="field[<?php echo $group[ 'group_id' ]; ?>][default_choice]"> |
|
| 146 | + <?php $pre_selected = ! empty( $field_data[ 'default_choice' ] ) ? $field_data[ 'default_choice' ] : 'no-default'; ?> |
|
| 147 | 147 | <option value="no-default">No Default</option> |
| 148 | - <?php foreach ( $field_data['items'] as $id => $interest_group ) { ?> |
|
| 149 | - <option value="<?php echo $id; ?>" <?php selected( $pre_selected, $id ); ?>><?php echo $interest_group['name']; ?></option> |
|
| 148 | + <?php foreach ( $field_data[ 'items' ] as $id => $interest_group ) { ?> |
|
| 149 | + <option value="<?php echo $id; ?>" <?php selected( $pre_selected, $id ); ?>><?php echo $interest_group[ 'name' ]; ?></option> |
|
| 150 | 150 | <?php } ?> |
| 151 | 151 | </select> |
| 152 | - <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 152 | + <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 153 | 153 | </td> |
| 154 | 154 | </tr> |
| 155 | 155 | |
@@ -161,25 +161,25 @@ discard block |
||
| 161 | 161 | <tr valign="top"> |
| 162 | 162 | <td scope="row"> |
| 163 | 163 | <label for="placeholder"> |
| 164 | - <?php _e( 'Description' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 164 | + <?php _e( 'Description', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 165 | 165 | </label> |
| 166 | 166 | </td> |
| 167 | 167 | <td> |
| 168 | - <textarea class="widefat field-description-input" name="field[<?php echo $group['group_id']; ?>][description]"></textarea> |
|
| 169 | - <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 168 | + <textarea class="widefat field-description-input" name="field[<?php echo $group[ 'group_id' ]; ?>][description]"></textarea> |
|
| 169 | + <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 170 | 170 | </td> |
| 171 | 171 | </tr> |
| 172 | 172 | |
| 173 | 173 | <!-- Description Above Field --> |
| 174 | 174 | <tr valign="top"> |
| 175 | 175 | <td scope="row"> |
| 176 | - <label for="description_above_<?php echo esc_attr( $group['group_id'] ); ?>"> |
|
| 177 | - <?php _e( 'Description Above Field' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 176 | + <label for="description_above_<?php echo esc_attr( $group[ 'group_id' ] ); ?>"> |
|
| 177 | + <?php _e( 'Description Above Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 178 | 178 | </label> |
| 179 | 179 | </td> |
| 180 | 180 | <td> |
| 181 | - <input type="checkbox" id="description_above_<?php echo esc_attr( $group['group_id'] ); ?>" class="widefat field-description-input" name="field[<?php echo $group['group_id']; ?>][description_above]" value="1" /> |
|
| 182 | - <span class="description"><small><?php _e( "By default the description will appear undearneath the field. Check this box if you'd like the description to appear above the field.", 'yikes-inc-easy-mailchimp-extender' );?></small></span> |
|
| 181 | + <input type="checkbox" id="description_above_<?php echo esc_attr( $group[ 'group_id' ] ); ?>" class="widefat field-description-input" name="field[<?php echo $group[ 'group_id' ]; ?>][description_above]" value="1" /> |
|
| 182 | + <span class="description"><small><?php _e( "By default the description will appear undearneath the field. Check this box if you'd like the description to appear above the field.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></span> |
|
| 183 | 183 | </td> |
| 184 | 184 | </tr> |
| 185 | 185 | |
@@ -187,48 +187,48 @@ discard block |
||
| 187 | 187 | <tr valign="top"> |
| 188 | 188 | <td scope="row"> |
| 189 | 189 | <label for="placeholder"> |
| 190 | - <?php _e( 'Additional Classes' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 190 | + <?php _e( 'Additional Classes', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 191 | 191 | </label> |
| 192 | 192 | </td> |
| 193 | 193 | <td> |
| 194 | - <input type="text" class="widefat" name="field[<?php echo $group['group_id']; ?>][additional-classes]" value="<?php echo isset( $group['classes'] ) ? stripslashes( wp_strip_all_tags( $group['classes'] ) ) : '' ; ?>" /> |
|
| 195 | - <p class="description"><small><?php printf( __( "Assign additional classes to this field. %s.", 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/bundled-css-classes/' ) . '">' . __( 'View bundled classes', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' );?></small></p> |
|
| 194 | + <input type="text" class="widefat" name="field[<?php echo $group[ 'group_id' ]; ?>][additional-classes]" value="<?php echo isset( $group[ 'classes' ] ) ? stripslashes( wp_strip_all_tags( $group[ 'classes' ] ) ) : ''; ?>" /> |
|
| 195 | + <p class="description"><small><?php printf( __( "Assign additional classes to this field. %s.", 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/bundled-css-classes/' ) . '">' . __( 'View bundled classes', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ); ?></small></p> |
|
| 196 | 196 | </td> |
| 197 | 197 | </tr> |
| 198 | 198 | <!-- Required Toggle --> |
| 199 | 199 | <tr valign="top"> |
| 200 | 200 | <td scope="row"> |
| 201 | 201 | <label for="field-required"> |
| 202 | - <?php _e( 'Field Required?' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 202 | + <?php _e( 'Field Required?', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 203 | 203 | </label> |
| 204 | 204 | </td> |
| 205 | 205 | <td> |
| 206 | - <input type="checkbox" class="widefat" value="1" name="field[<?php echo $group['group_id']; ?>][require]"> |
|
| 207 | - <p class="description"><small><?php _e( "Require this field to be filled in before the form can be submitted.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 206 | + <input type="checkbox" class="widefat" value="1" name="field[<?php echo $group[ 'group_id' ]; ?>][require]"> |
|
| 207 | + <p class="description"><small><?php _e( "Require this field to be filled in before the form can be submitted.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 208 | 208 | </td> |
| 209 | 209 | </tr> |
| 210 | 210 | <!-- Visible Toggle --> |
| 211 | 211 | <tr valign="top"> |
| 212 | 212 | <td scope="row"> |
| 213 | 213 | <label for="hide-field"> |
| 214 | - <?php _e( 'Hide Field' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 214 | + <?php _e( 'Hide Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 215 | 215 | </label> |
| 216 | 216 | </td> |
| 217 | 217 | <td> |
| 218 | - <input type="checkbox" class="widefat" value="1" name="field[<?php echo $group['group_id']; ?>][hide]"> |
|
| 219 | - <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 218 | + <input type="checkbox" class="widefat" value="1" name="field[<?php echo $group[ 'group_id' ]; ?>][hide]"> |
|
| 219 | + <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 220 | 220 | </td> |
| 221 | 221 | </tr> |
| 222 | 222 | <!-- Toggle Field Label Visibility --> |
| 223 | 223 | <tr valign="top"> |
| 224 | 224 | <td scope="row"> |
| 225 | 225 | <label for="placeholder"> |
| 226 | - <?php _e( 'Hide Label' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 226 | + <?php _e( 'Hide Label', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 227 | 227 | </label> |
| 228 | 228 | </td> |
| 229 | 229 | <td> |
| 230 | - <input type="checkbox" name="field[<?php echo $group['group_id']; ?>][hide-label]" value="1" /> |
|
| 231 | - <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 230 | + <input type="checkbox" name="field[<?php echo $group[ 'group_id' ]; ?>][hide-label]" value="1" /> |
|
| 231 | + <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 232 | 232 | </td> |
| 233 | 233 | </tr> |
| 234 | 234 | <!-- Toggle Buttons --> |
@@ -238,8 +238,8 @@ discard block |
||
| 238 | 238 | </td> |
| 239 | 239 | <td> |
| 240 | 240 | <span class="toggle-container"> |
| 241 | - <a href="#" class="hide-field"><?php _e( "Close" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 242 | - <a href="#" class="remove-field" alt="<?php echo $group['group_id']; ?>"><?php _e( "Remove Field" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 241 | + <a href="#" class="hide-field"><?php _e( "Close", 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 242 | + <a href="#" class="remove-field" alt="<?php echo $group[ 'group_id' ]; ?>"><?php _e( "Remove Field", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 243 | 243 | </span> |
| 244 | 244 | </td> |
| 245 | 245 | </tr> |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | /***********************/ |
| 102 | 102 | /** Create A Form **/ |
| 103 | 103 | /**********************/ |
| 104 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-create-form' ) {
|
|
| 104 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-create-form' ) {
|
|
| 105 | 105 | |
| 106 | 106 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_create_form' ) ); |
| 107 | 107 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | /***********************/ |
| 111 | 111 | /** Delete A Form **/ |
| 112 | 112 | /**********************/ |
| 113 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-delete-form' ) {
|
|
| 113 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-delete-form' ) {
|
|
| 114 | 114 | |
| 115 | 115 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_delete_form' ) ); |
| 116 | 116 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | /**********************************/ |
| 120 | 120 | /** Duplicate/Clone A Form **/ |
| 121 | 121 | /********************************/ |
| 122 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-duplicate-form' ) {
|
|
| 122 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-duplicate-form' ) {
|
|
| 123 | 123 | |
| 124 | 124 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_duplicate_form' ) ); |
| 125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | /*************************************/ |
| 129 | 129 | /** Reset Form Impression Stats **/ |
| 130 | 130 | /***********************************/ |
| 131 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-reset-stats' ) {
|
|
| 131 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-reset-stats' ) {
|
|
| 132 | 132 | |
| 133 | 133 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_reset_impression_stats' ) ); |
| 134 | 134 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | /**********************************/ |
| 138 | 138 | /** Update A Form **/ |
| 139 | 139 | /********************************/ |
| 140 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-update-form' ) {
|
|
| 140 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-update-form' ) {
|
|
| 141 | 141 | |
| 142 | 142 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_update_form' ) ); |
| 143 | 143 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | /**************************************************/ |
| 147 | 147 | /** Clear Store MailChimp Transient Data **/ |
| 148 | 148 | /*************************************************/ |
| 149 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-clear-transient-data' ) {
|
|
| 149 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-clear-transient-data' ) {
|
|
| 150 | 150 | |
| 151 | 151 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_clear_transient_data' ) ); |
| 152 | 152 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | /*******************************************/ |
| 156 | 156 | /** Remove a user from a mailing list **/ |
| 157 | 157 | /*****************************************/ |
| 158 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-unsubscribe-user' ) {
|
|
| 158 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-unsubscribe-user' ) {
|
|
| 159 | 159 | |
| 160 | 160 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_unsubscribe_user' ) ); |
| 161 | 161 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | /*******************************************/ |
| 165 | 165 | /** Create misisng error log file **/ |
| 166 | 166 | /*****************************************/ |
| 167 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-create-error-log' ) {
|
|
| 167 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-create-error-log' ) {
|
|
| 168 | 168 | |
| 169 | 169 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_create_missing_error_log' ) ); |
| 170 | 170 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | /**************************************************/ |
| 197 | 197 | /** Clear MailChimp Error Log Data **/ |
| 198 | 198 | /*************************************************/ |
| 199 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-clear-error-log' ) {
|
|
| 199 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-clear-error-log' ) {
|
|
| 200 | 200 | |
| 201 | 201 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_clear_error_log' ) ); |
| 202 | 202 | |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | /*********************************************/ |
| 206 | 206 | /** Export MailChimp Opt-in Forms **/ |
| 207 | 207 | /*******************************************/ |
| 208 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-export-forms' ) {
|
|
| 208 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-export-forms' ) {
|
|
| 209 | 209 | |
| 210 | 210 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_export_forms' ) ); |
| 211 | 211 | |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | /*********************************************/ |
| 215 | 215 | /** Export Plugin Settings **/ |
| 216 | 216 | /*******************************************/ |
| 217 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-export-settings' ) {
|
|
| 217 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-export-settings' ) {
|
|
| 218 | 218 | |
| 219 | 219 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_export_plugin_settings' ) ); |
| 220 | 220 | |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | /*******************************************/ |
| 224 | 224 | /** Import Class Inclusion **/ |
| 225 | 225 | /*****************************************/ |
| 226 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-import-forms' ) {
|
|
| 226 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-import-forms' ) {
|
|
| 227 | 227 | |
| 228 | 228 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_import_forms' ) ); |
| 229 | 229 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | /*******************************************/ |
| 233 | 233 | /** Premium Support Request **/ |
| 234 | 234 | /*****************************************/ |
| 235 | - if ( isset( $_POST['submit-premium-support-request'] ) ) {
|
|
| 235 | + if ( isset( $_POST[ 'submit-premium-support-request' ] ) ) {
|
|
| 236 | 236 | |
| 237 | 237 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_premium_support_request' ) ); |
| 238 | 238 | |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | /****************************************/ |
| 242 | 242 | /** Dismiss Options Migrations **/ |
| 243 | 243 | /****************************************/ |
| 244 | - if ( isset( $_REQUEST['dismiss_migration_nonce'] ) ) {
|
|
| 244 | + if ( isset( $_REQUEST[ 'dismiss_migration_nonce' ] ) ) {
|
|
| 245 | 245 | |
| 246 | 246 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_dismiss_option_migrate' ) ); |
| 247 | 247 | |
@@ -277,8 +277,8 @@ discard block |
||
| 277 | 277 | * @ return array $links New array of plugin actions |
| 278 | 278 | */ |
| 279 | 279 | public function easy_forms_plugin_action_links( $links ) {
|
| 280 | - $links[] = '<a href="'. esc_url( get_admin_url(null, 'admin.php?page=yikes-inc-easy-mailchimp-settings') ) .'">' . __( 'Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
| 281 | - $links[] = '<a href="' . esc_url( 'http://www.yikesplugins.com?utm_source=plugins-page&utm_medium=plugin-row&utm_campaign=admin' ) . '" target="_blank">' . __( 'More plugins by YIKES, Inc.', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
| 280 | + $links[ ] = '<a href="' . esc_url( get_admin_url( null, 'admin.php?page=yikes-inc-easy-mailchimp-settings' ) ) . '">' . __( 'Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
| 281 | + $links[ ] = '<a href="' . esc_url( 'http://www.yikesplugins.com?utm_source=plugins-page&utm_medium=plugin-row&utm_campaign=admin' ) . '" target="_blank">' . __( 'More plugins by YIKES, Inc.', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
| 282 | 282 | return $links; |
| 283 | 283 | } |
| 284 | 284 | |
@@ -379,17 +379,17 @@ discard block |
||
| 379 | 379 | */ |
| 380 | 380 | public function yikes_easy_mailchimp_export_forms() {
|
| 381 | 381 | // grab our nonce. |
| 382 | - $nonce = $_REQUEST['nonce']; |
|
| 382 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 383 | 383 | // grab the forms. |
| 384 | - $forms = isset( $_REQUEST['export_forms'] ) ? $_REQUEST['export_forms'] : array(); |
|
| 384 | + $forms = isset( $_REQUEST[ 'export_forms' ] ) ? $_REQUEST[ 'export_forms' ] : array(); |
|
| 385 | 385 | // validate nonce. |
| 386 | 386 | if ( ! wp_verify_nonce( $nonce, 'export-forms' ) ) {
|
| 387 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 387 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | // run the export function. |
| 391 | 391 | // parameters: ( $table_name, $form_ids, $file_name ). |
| 392 | - Yikes_Inc_Easy_MailChimp_Export_Class::yikes_mailchimp_form_export('Yikes-Inc-Easy-MailChimp-Forms-Export', $forms );
|
|
| 392 | + Yikes_Inc_Easy_MailChimp_Export_Class::yikes_mailchimp_form_export( 'Yikes-Inc-Easy-MailChimp-Forms-Export', $forms ); |
|
| 393 | 393 | // re-direct the user back to the page. |
| 394 | 394 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=import-export-forms' ) ) ); |
| 395 | 395 | die(); |
@@ -403,10 +403,10 @@ discard block |
||
| 403 | 403 | */ |
| 404 | 404 | public function yikes_easy_mailchimp_export_plugin_settings() {
|
| 405 | 405 | // grab our nonce |
| 406 | - $nonce = $_REQUEST['nonce']; |
|
| 406 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 407 | 407 | // validate nonce. |
| 408 | 408 | if ( ! wp_verify_nonce( $nonce, 'export-settings' ) ) {
|
| 409 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 409 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | // run the export function. |
@@ -423,10 +423,10 @@ discard block |
||
| 423 | 423 | */ |
| 424 | 424 | public function yikes_easy_mailchimp_import_forms() {
|
| 425 | 425 | // grab our nonce. |
| 426 | - $nonce = $_REQUEST['nonce']; |
|
| 426 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 427 | 427 | // validate nonce. |
| 428 | 428 | if ( ! wp_verify_nonce( $nonce, 'import-forms' ) ) {
|
| 429 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 429 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 430 | 430 | } |
| 431 | 431 | // include the export class. |
| 432 | 432 | if ( ! class_exists( 'Yikes_Inc_Easy_MailChimp_Import_Class' ) ) {
|
@@ -447,18 +447,18 @@ discard block |
||
| 447 | 447 | */ |
| 448 | 448 | public function yikes_easy_mailchimp_premium_support_request() {
|
| 449 | 449 | |
| 450 | - if ( isset( $_POST['action'] ) && $_POST['action'] != 'yikes-support-request' ) {
|
|
| 450 | + if ( isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] != 'yikes-support-request' ) {
|
|
| 451 | 451 | return __( 'We encountered an error. Please contact the YIKES Inc. support team.', 'yikes-inc-easy-mailchimp-extender' ); |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - $email = isset( $_POST['user-email'] ) ? $_POST['user-email'] : ''; |
|
| 455 | - $topic = isset( $_POST['support-topic'] ) ? $_POST['support-topic'] : ''; |
|
| 456 | - $issue = isset( $_POST['support-content'] ) ? $_POST['support-content'] : ''; |
|
| 457 | - $priority = isset( $_POST['support-priority'] ) ? $_POST['support-priority'] : 1; |
|
| 458 | - $license = isset( $_POST['license_key'] ) ? $_POST['license_key'] : ''; |
|
| 459 | - $plugin_name = isset( $_POST['plugin-name'] ) ? $_POST['plugin-name'] : ''; |
|
| 460 | - $plugin_slug = isset( $_POST['plugin-slug'] ) ? $_POST['plugin-slug'] : ''; |
|
| 461 | - $name = isset( $_POST['user-name'] ) ? $_POST['user-name'] : 'MailChimp Support'; |
|
| 454 | + $email = isset( $_POST[ 'user-email' ] ) ? $_POST[ 'user-email' ] : ''; |
|
| 455 | + $topic = isset( $_POST[ 'support-topic' ] ) ? $_POST[ 'support-topic' ] : ''; |
|
| 456 | + $issue = isset( $_POST[ 'support-content' ] ) ? $_POST[ 'support-content' ] : ''; |
|
| 457 | + $priority = isset( $_POST[ 'support-priority' ] ) ? $_POST[ 'support-priority' ] : 1; |
|
| 458 | + $license = isset( $_POST[ 'license_key' ] ) ? $_POST[ 'license_key' ] : ''; |
|
| 459 | + $plugin_name = isset( $_POST[ 'plugin-name' ] ) ? $_POST[ 'plugin-name' ] : ''; |
|
| 460 | + $plugin_slug = isset( $_POST[ 'plugin-slug' ] ) ? $_POST[ 'plugin-slug' ] : ''; |
|
| 461 | + $name = isset( $_POST[ 'user-name' ] ) ? $_POST[ 'user-name' ] : 'MailChimp Support'; |
|
| 462 | 462 | |
| 463 | 463 | $edd_item_id = $this->get_premium_license( $plugin_slug ); |
| 464 | 464 | |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | |
| 494 | 494 | public function get_premium_license( $plugin_slug ) {
|
| 495 | 495 | |
| 496 | - switch( $plugin_slug ) {
|
|
| 496 | + switch ( $plugin_slug ) {
|
|
| 497 | 497 | |
| 498 | 498 | case 'form-customizer': |
| 499 | 499 | return defined( 'YIKES_CUSTOMIZER_EDD_ITEM_ID' ) ? YIKES_CUSTOMIZER_EDD_ITEM_ID : ''; |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | // add a new option to store the plugin activation date/time. |
| 554 | 554 | // @since v6.0.0. |
| 555 | 555 | // this is used to notify the user that they should review after 2 weeks. |
| 556 | - if ( !get_option( 'yikes_easy_mailchimp_activation_date' ) ) {
|
|
| 556 | + if ( ! get_option( 'yikes_easy_mailchimp_activation_date' ) ) {
|
|
| 557 | 557 | add_option( 'yikes_easy_mailchimp_activation_date', strtotime( "now" ) ); |
| 558 | 558 | } |
| 559 | 559 | |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | $install_date = get_option( 'yikes_easy_mailchimp_activation_date' ); |
| 564 | 564 | $past_date = strtotime( '-14 days' ); |
| 565 | 565 | if ( $past_date >= $install_date && current_user_can( 'install_plugins' ) ) {
|
| 566 | - add_action( 'admin_notices', array( $this , 'yikes_easy_mailchimp_display_review_us_notice' ) ); |
|
| 566 | + add_action( 'admin_notices', array( $this, 'yikes_easy_mailchimp_display_review_us_notice' ) ); |
|
| 567 | 567 | } |
| 568 | 568 | } |
| 569 | 569 | |
@@ -576,13 +576,13 @@ discard block |
||
| 576 | 576 | */ |
| 577 | 577 | public function yikes_easy_mailchimp_display_review_us_notice() {
|
| 578 | 578 | /* Lets only display our admin notice on YT4WP pages to not annoy the hell out of people :) */ |
| 579 | - if ( in_array( get_current_screen()->base , array( 'dashboard', 'post', 'edit' ) ) || strpos( get_current_screen()->base ,'yikes-inc-easy-mailchimp') !== false ) {
|
|
| 579 | + if ( in_array( get_current_screen()->base, array( 'dashboard', 'post', 'edit' ) ) || strpos( get_current_screen()->base, 'yikes-inc-easy-mailchimp' ) !== false ) {
|
|
| 580 | 580 | |
| 581 | 581 | // The URL of the page the user is currently on |
| 582 | - $current_uri = isset( $_SERVER['REQUEST_URI'] ) && ! empty( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : false; |
|
| 583 | - $current_host = isset( $_SERVER['HTTP_HOST'] ) && ! empty( $_SERVER['HTTP_HOST'] ) ? $_SERVER['HTTP_HOST'] : false; |
|
| 582 | + $current_uri = isset( $_SERVER[ 'REQUEST_URI' ] ) && ! empty( $_SERVER[ 'REQUEST_URI' ] ) ? $_SERVER[ 'REQUEST_URI' ] : false; |
|
| 583 | + $current_host = isset( $_SERVER[ 'HTTP_HOST' ] ) && ! empty( $_SERVER[ 'HTTP_HOST' ] ) ? $_SERVER[ 'HTTP_HOST' ] : false; |
|
| 584 | 584 | $current_protocol = is_ssl() === true ? 'https://' : 'http://'; |
| 585 | - $current_url = ( $current_uri !== false && $current_host !== false ) ? $current_protocol . $current_host . $current_uri : admin_url(); |
|
| 585 | + $current_url = ( $current_uri !== false && $current_host !== false ) ? $current_protocol . $current_host . $current_uri : admin_url(); |
|
| 586 | 586 | |
| 587 | 587 | $plugin_name = '<strong>Easy Forms for MailChimp</strong>'; |
| 588 | 588 | // Review URL - Change to the URL of your plugin on WordPress.org. |
@@ -593,17 +593,17 @@ discard block |
||
| 593 | 593 | // Make sure all of our variables have values. |
| 594 | 594 | $reviewurl = ( ! empty( $reviewurl ) ) ? $reviewurl : ''; |
| 595 | 595 | $addons_url = ( ! empty( $addons_url ) ) ? $addons_url : ''; |
| 596 | - $nobugurl = ( ! empty( $nobugurl ) ) ? $nobugurl : ''; |
|
| 596 | + $nobugurl = ( ! empty( $nobugurl ) ) ? $nobugurl : ''; |
|
| 597 | 597 | |
| 598 | 598 | $review_message = '<div id="yikes-mailchimp-logo"></div>'; |
| 599 | 599 | $review_message .= sprintf( |
| 600 | 600 | __( 'It looks like you\'ve been using %1$s for 2 weeks now. We hope you\'re enjoying the features included with the free version. If so, please consider leaving us a review. Reviews only help to catch other users attention as well as provide us with feedback to grow and improve upon. If you\'re really enjoying the plugin, consider buying an add-on or developer license for some really awesome features and premium support.', 'yikes-inc-easy-mailchimp-extender' ) |
| 601 | 601 | . '<span class="button-container"> <a href="%2$s" target="_blank" class="button-secondary"><span class="dashicons dashicons-star-filled"></span>' |
| 602 | - . __( "Leave A Review" , 'yikes-inc-easy-mailchimp-extender' ) |
|
| 602 | + . __( "Leave A Review", 'yikes-inc-easy-mailchimp-extender' ) |
|
| 603 | 603 | . '</a> <a href="%3$s" class="button-secondary"><span class="dashicons dashicons-upload"></span>' |
| 604 | - . __( "View Addons" , 'yikes-inc-easy-mailchimp-extender' ) |
|
| 604 | + . __( "View Addons", 'yikes-inc-easy-mailchimp-extender' ) |
|
| 605 | 605 | . '</a> <a href="%4$s" class="button-secondary"><span class="dashicons dashicons-no-alt"></span>' |
| 606 | - . __( "Dismiss" , 'yikes-inc-easy-mailchimp-extender' ) |
|
| 606 | + . __( "Dismiss", 'yikes-inc-easy-mailchimp-extender' ) |
|
| 607 | 607 | . "</a> </span>", |
| 608 | 608 | $plugin_name, $reviewurl, $addons_url, $nobugurl ); |
| 609 | 609 | ?> |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | @since v3.1.1 |
| 621 | 621 | */ |
| 622 | 622 | public function yikes_easy_mailchimp_stop_bugging_me() {
|
| 623 | - if ( isset( $_GET['yikes_easy_mc_icons_nobug'] ) && (int) filter_var( $_GET['yikes_easy_mc_icons_nobug'], FILTER_SANITIZE_NUMBER_INT ) === 1 ) {
|
|
| 623 | + if ( isset( $_GET[ 'yikes_easy_mc_icons_nobug' ] ) && (int) filter_var( $_GET[ 'yikes_easy_mc_icons_nobug' ], FILTER_SANITIZE_NUMBER_INT ) === 1 ) {
|
|
| 624 | 624 | add_option( 'yikes_easy_mailchimp_review_stop_bugging_me', true ); |
| 625 | 625 | } |
| 626 | 626 | } |
@@ -658,7 +658,7 @@ discard block |
||
| 658 | 658 | // inlcude the js for tinymce. |
| 659 | 659 | public function yks_mc_add_tinymce_plugin( $plugin_array ) {
|
| 660 | 660 | |
| 661 | - $plugin_array['yks_mc_tinymce_button'] = plugins_url( '/js/min/yikes-inc-easy-mailchimp-tinymce-button.min.js', __FILE__ ); |
|
| 661 | + $plugin_array[ 'yks_mc_tinymce_button' ] = plugins_url( '/js/min/yikes-inc-easy-mailchimp-tinymce-button.min.js', __FILE__ ); |
|
| 662 | 662 | |
| 663 | 663 | return $plugin_array; |
| 664 | 664 | } |
@@ -679,13 +679,13 @@ discard block |
||
| 679 | 679 | if ( ! empty( $list_data ) ) {
|
| 680 | 680 | // build an array to pass to our javascript. |
| 681 | 681 | foreach ( $list_data as $id => $form ) {
|
| 682 | - $lists[] = array( |
|
| 683 | - 'text' => urlencode( $form['form_name'] ), |
|
| 682 | + $lists[ ] = array( |
|
| 683 | + 'text' => urlencode( $form[ 'form_name' ] ), |
|
| 684 | 684 | 'value' => $id, |
| 685 | 685 | ); |
| 686 | 686 | } |
| 687 | 687 | } else {
|
| 688 | - $lists[0] = array( |
|
| 688 | + $lists[ 0 ] = array( |
|
| 689 | 689 | 'text' => __( 'Please Import Some MailChimp Lists', 'yikes-inc-easy-mailchimp-extender' ), |
| 690 | 690 | 'value' => '-', |
| 691 | 691 | ); |
@@ -773,8 +773,8 @@ discard block |
||
| 773 | 773 | |
| 774 | 774 | wp_enqueue_style( 'wp-color-picker' ); |
| 775 | 775 | wp_enqueue_script( 'wp-color-picker' ); |
| 776 | - wp_enqueue_script( 'jquery.timepicker.js',YIKES_MC_URL . 'admin/js/jquery.timepicker.min.js', array( 'jquery' ) , $this->version, false ); |
|
| 777 | - wp_enqueue_script( 'edit-form-js', YIKES_MC_URL . 'admin/js/min/yikes-inc-easy-mailchimp-extender-edit-form.min.js', array( 'jquery.timepicker.js', 'jquery-ui-datepicker' ) , $this->version, false ); |
|
| 776 | + wp_enqueue_script( 'jquery.timepicker.js', YIKES_MC_URL . 'admin/js/jquery.timepicker.min.js', array( 'jquery' ), $this->version, false ); |
|
| 777 | + wp_enqueue_script( 'edit-form-js', YIKES_MC_URL . 'admin/js/min/yikes-inc-easy-mailchimp-extender-edit-form.min.js', array( 'jquery.timepicker.js', 'jquery-ui-datepicker' ), $this->version, false ); |
|
| 778 | 778 | |
| 779 | 779 | $localized_data = array( |
| 780 | 780 | 'ajax_url' => esc_url_raw( admin_url( 'admin-ajax.php' ) ), |
@@ -868,7 +868,7 @@ discard block |
||
| 868 | 868 | * Convert the php date format string to a js date format |
| 869 | 869 | */ |
| 870 | 870 | public function yikes_jQuery_datepicker_date_format( $site_option ) {
|
| 871 | - switch( $site_option ) {
|
|
| 871 | + switch ( $site_option ) {
|
|
| 872 | 872 | //Predefined WP date formats |
| 873 | 873 | default: |
| 874 | 874 | case 'F j, Y': |
@@ -1080,7 +1080,7 @@ discard block |
||
| 1080 | 1080 | |
| 1081 | 1081 | /* Register General Settings Section */ |
| 1082 | 1082 | |
| 1083 | - register_setting( 'yikes_inc_easy_mc_general_settings_page', 'yikes-mc-api-key', array( $this , 'yikes_mc_validate_api_key' ) ); |
|
| 1083 | + register_setting( 'yikes_inc_easy_mc_general_settings_page', 'yikes-mc-api-key', array( $this, 'yikes_mc_validate_api_key' ) ); |
|
| 1084 | 1084 | |
| 1085 | 1085 | register_setting( 'yikes_inc_easy_mc_general_settings_page', 'yikes-mailchimp-use-nonce' ); |
| 1086 | 1086 | |
@@ -1125,7 +1125,7 @@ discard block |
||
| 1125 | 1125 | add_settings_field( |
| 1126 | 1126 | 'optin-checkbox-init', |
| 1127 | 1127 | __( 'Select Checkboxes to Generate', 'yikes-inc-easy-mailchimp-extender' ), |
| 1128 | - '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1128 | + '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1129 | 1129 | 'yikes_inc_easy_mc_checkbox_settings' |
| 1130 | 1130 | ); |
| 1131 | 1131 | /* End Checkbox Settings */ |
@@ -1147,21 +1147,21 @@ discard block |
||
| 1147 | 1147 | add_settings_field( |
| 1148 | 1148 | 'yikes-mc-recaptcha-site-key', |
| 1149 | 1149 | __( 'Enter reCAPTCHA Site Key', 'yikes-inc-easy-mailchimp-extender' ), |
| 1150 | - '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1150 | + '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1151 | 1151 | 'yikes_easy_mc_settings_recpatcha_section' |
| 1152 | 1152 | ); |
| 1153 | 1153 | |
| 1154 | 1154 | add_settings_field( |
| 1155 | 1155 | 'yikes-mc-recaptcha-secret-key', |
| 1156 | 1156 | __( 'Enter reCAPTCHA Secret Key', 'yikes-inc-easy-mailchimp-extender' ), |
| 1157 | - '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1157 | + '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1158 | 1158 | 'yikes_easy_mc_settings_recpatcha_section' |
| 1159 | 1159 | ); |
| 1160 | 1160 | |
| 1161 | 1161 | add_settings_field( |
| 1162 | 1162 | 'yikes-mc-recaptcha-status', |
| 1163 | 1163 | __( 'Enable ReCaptcha', 'yikes-inc-easy-mailchimp-extender' ), |
| 1164 | - '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1164 | + '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1165 | 1165 | 'yikes_easy_mc_settings_recpatcha_section' |
| 1166 | 1166 | ); |
| 1167 | 1167 | |
@@ -1181,7 +1181,7 @@ discard block |
||
| 1181 | 1181 | add_settings_field( |
| 1182 | 1182 | 'yikes-mailchimp-debug-status', |
| 1183 | 1183 | __( 'Enable Debugging', 'yikes-inc-easy-mailchimp-extender' ), |
| 1184 | - '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1184 | + '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1185 | 1185 | 'yikes_easy_mc_settings_debug_section' |
| 1186 | 1186 | ); |
| 1187 | 1187 | |
@@ -1201,7 +1201,7 @@ discard block |
||
| 1201 | 1201 | update_option( 'yikes-mc-api-validation', 'invalid_api_key' ); |
| 1202 | 1202 | return ''; |
| 1203 | 1203 | } |
| 1204 | - $api_key = strip_tags ( trim( $input ) ); |
|
| 1204 | + $api_key = strip_tags( trim( $input ) ); |
|
| 1205 | 1205 | $dash_position = strpos( trim( $input ), '-' ); |
| 1206 | 1206 | if ( $dash_position !== false ) {
|
| 1207 | 1207 | $manager = new Yikes_Inc_Easy_MailChimp_API_Manager( $api_key ); |
@@ -1216,9 +1216,9 @@ discard block |
||
| 1216 | 1216 | update_option( 'yikes-mc-api-validation', 'valid_api_key' ); |
| 1217 | 1217 | // Clear the API key transient data |
| 1218 | 1218 | $this->delete_yikes_mailchimp_transients(); |
| 1219 | - } else {
|
|
| 1219 | + } else {
|
|
| 1220 | 1220 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 1221 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $response->get_error_message() , __( "Connecting to MailChimp" , 'yikes-inc-easy-mailchimp-extender' ) , __( "Settings Page/General Settings" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 1221 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $response->get_error_message(), __( "Connecting to MailChimp", 'yikes-inc-easy-mailchimp-extender' ), __( "Settings Page/General Settings", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 1222 | 1222 | update_option( 'yikes-mc-api-invalid-key-response', $response->get_error_message() ); |
| 1223 | 1223 | update_option( 'yikes-mc-api-validation', 'invalid_api_key' ); |
| 1224 | 1224 | } |
@@ -1267,11 +1267,11 @@ discard block |
||
| 1267 | 1267 | public function check_for_old_yks_mc_options() {
|
| 1268 | 1268 | $old_plugin_options = get_option( 'ykseme_storage' ); |
| 1269 | 1269 | // only perform options migrations if the site is not a multi-site setup |
| 1270 | - if ( !is_multisite() ) {
|
|
| 1270 | + if ( ! is_multisite() ) {
|
|
| 1271 | 1271 | if ( apply_filters( 'yikes_mc_old_options_filter', $old_plugin_options ) ) {
|
| 1272 | 1272 | // display a notice to the user that they should 'migrate' |
| 1273 | 1273 | // from the old plugin settings to the new ones |
| 1274 | - add_action( 'admin_notices', array( $this , 'display_options_migrate_notice' ) , 11 ); |
|
| 1274 | + add_action( 'admin_notices', array( $this, 'display_options_migrate_notice' ), 11 ); |
|
| 1275 | 1275 | } |
| 1276 | 1276 | } |
| 1277 | 1277 | } |
@@ -1304,11 +1304,11 @@ discard block |
||
| 1304 | 1304 | |
| 1305 | 1305 | // Confirm that the necessary forms table in the database exists, else bail |
| 1306 | 1306 | global $wpdb; |
| 1307 | - if ( $wpdb->get_var("show tables like '" . $wpdb->prefix . "yikes_easy_mc_forms'") != $wpdb->prefix . "yikes_easy_mc_forms" ) {
|
|
| 1307 | + if ( $wpdb->get_var( "show tables like '" . $wpdb->prefix . "yikes_easy_mc_forms'" ) != $wpdb->prefix . "yikes_easy_mc_forms" ) {
|
|
| 1308 | 1308 | return; |
| 1309 | 1309 | } |
| 1310 | 1310 | |
| 1311 | - if ( isset( $_GET['yikes-mc-options-migration-dismissed'] ) && $_GET['yikes-mc-options-migration-dismissed'] == 'true' ) {
|
|
| 1311 | + if ( isset( $_GET[ 'yikes-mc-options-migration-dismissed' ] ) && $_GET[ 'yikes-mc-options-migration-dismissed' ] == 'true' ) {
|
|
| 1312 | 1312 | // Delete the options, start a-new! (this will disable the migration notice altogether) |
| 1313 | 1313 | delete_option( 'widget_yikes_mc_widget' ); |
| 1314 | 1314 | delete_option( 'api_validation' ); |
@@ -1322,7 +1322,7 @@ discard block |
||
| 1322 | 1322 | } else {
|
| 1323 | 1323 | ?> |
| 1324 | 1324 | <div class="yikes-easy-mc-updated migrate-options-notice"> |
| 1325 | - <p><?php printf( __( "It looks like you're upgrading from a previous version of %s.", 'yikes-inc-easy-mailchimp-extender' ), '<strong>Us Easy Forms for MailChimp</strong>' ); ?> <?php printf( __( "In the newest version of %s, the options data structure has changed. We've also moved the mailing lists into its own database table to allow for some higher level customization. Now you can easily create multiple forms and assign them to the same mailing list." , 'yikes-inc-easy-mailchimp-extender' ), '<strong>Us Easy Forms for MailChimp</strong>' ); ?></p> |
|
| 1325 | + <p><?php printf( __( "It looks like you're upgrading from a previous version of %s.", 'yikes-inc-easy-mailchimp-extender' ), '<strong>Us Easy Forms for MailChimp</strong>' ); ?> <?php printf( __( "In the newest version of %s, the options data structure has changed. We've also moved the mailing lists into its own database table to allow for some higher level customization. Now you can easily create multiple forms and assign them to the same mailing list.", 'yikes-inc-easy-mailchimp-extender' ), '<strong>Us Easy Forms for MailChimp</strong>' ); ?></p> |
|
| 1326 | 1326 | <p><?php _e( "Before you continue, it's strongly recommended you the perform the migration to ensure the plugin continues to function properly.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
| 1327 | 1327 | <p><em><?php _e( "It's also strongly recommended that you take a backup of your database.", 'yikes-inc-easy-mailchimp-extender' ); ?></em></p> |
| 1328 | 1328 | <section id="migration-buttons"> |
@@ -1347,9 +1347,9 @@ discard block |
||
| 1347 | 1347 | * and return the index ( used to find the list name assigned to a form ) |
| 1348 | 1348 | * - http://stackoverflow.com/questions/6661530/php-multi-dimensional-array-search |
| 1349 | 1349 | */ |
| 1350 | - function findMCListID($id, $array) {
|
|
| 1351 | - foreach ($array as $key => $val) {
|
|
| 1352 | - if ($val['id'] === $id) {
|
|
| 1350 | + function findMCListID( $id, $array ) {
|
|
| 1351 | + foreach ( $array as $key => $val ) {
|
|
| 1352 | + if ( $val[ 'id' ] === $id ) {
|
|
| 1353 | 1353 | return $key; |
| 1354 | 1354 | } |
| 1355 | 1355 | } |
@@ -1359,8 +1359,8 @@ discard block |
||
| 1359 | 1359 | /* Ajax Migrate Options */ |
| 1360 | 1360 | function migrate_archived_options() {
|
| 1361 | 1361 | // all options prefixed with 'yikes-mc-' |
| 1362 | - $option_name = 'yikes-mc-'.$_POST['option_name']; |
|
| 1363 | - $option_value = $_POST['option_value']; |
|
| 1362 | + $option_name = 'yikes-mc-' . $_POST[ 'option_name' ]; |
|
| 1363 | + $option_value = $_POST[ 'option_value' ]; |
|
| 1364 | 1364 | if ( json_decode( $option_value ) ) {
|
| 1365 | 1365 | // decode our lists() array, and store it |
| 1366 | 1366 | $opt_value = json_decode( $option_value, true ); |
@@ -1374,22 +1374,22 @@ discard block |
||
| 1374 | 1374 | |
| 1375 | 1375 | /* Ajax Migrate Forms */ |
| 1376 | 1376 | function migrate_previously_setup_forms() {
|
| 1377 | - $option_name = $_POST['option_name']; |
|
| 1378 | - $done = $_POST['done_import']; |
|
| 1377 | + $option_name = $_POST[ 'option_name' ]; |
|
| 1378 | + $done = $_POST[ 'done_import' ]; |
|
| 1379 | 1379 | // Create some starter forms for the user |
| 1380 | 1380 | // based on previously imported lists (to our old version) |
| 1381 | 1381 | if ( $option_name == 'yikes-mc-lists' ) {
|
| 1382 | - $option_value = $_POST['option_value']; |
|
| 1383 | - $new_options = json_decode( stripslashes_deep( $option_value ) , true ); |
|
| 1382 | + $option_value = $_POST[ 'option_value' ]; |
|
| 1383 | + $new_options = json_decode( stripslashes_deep( $option_value ), true ); |
|
| 1384 | 1384 | |
| 1385 | - $list_id = $new_options['id']; |
|
| 1386 | - $form_name = $new_options['name']; |
|
| 1387 | - $fields = $new_options['fields']; // our fields array |
|
| 1385 | + $list_id = $new_options[ 'id' ]; |
|
| 1386 | + $form_name = $new_options[ 'name' ]; |
|
| 1387 | + $fields = $new_options[ 'fields' ]; // our fields array |
|
| 1388 | 1388 | |
| 1389 | - $custom_styles = isset( $new_options['custom_styles'] ) ? $new_options['custom_styles']: '0'; // store as an array with all of our styles |
|
| 1390 | - $custom_template = isset( $new_options['custom_template'] ) ? $new_options['custom_template'] : '0'; // store template data as an array ( active , template used ) |
|
| 1391 | - $redirect_user_on_submit = isset( $new_options['yks_mailchimp_redirect_'.$list_id] ) ? '1' : '0'; |
|
| 1392 | - $redirect_page = isset( $new_options['page_id_'.$list_id] ) ? $new_options['page_id_'.$list_id] : ''; |
|
| 1389 | + $custom_styles = isset( $new_options[ 'custom_styles' ] ) ? $new_options[ 'custom_styles' ] : '0'; // store as an array with all of our styles |
|
| 1390 | + $custom_template = isset( $new_options[ 'custom_template' ] ) ? $new_options[ 'custom_template' ] : '0'; // store template data as an array ( active , template used ) |
|
| 1391 | + $redirect_user_on_submit = isset( $new_options[ 'yks_mailchimp_redirect_' . $list_id ] ) ? '1' : '0'; |
|
| 1392 | + $redirect_page = isset( $new_options[ 'page_id_' . $list_id ] ) ? $new_options[ 'page_id_' . $list_id ] : ''; |
|
| 1393 | 1393 | |
| 1394 | 1394 | /* Insert Forms Function */ |
| 1395 | 1395 | $this->form_interface->create_form( array( |
@@ -1425,8 +1425,8 @@ discard block |
||
| 1425 | 1425 | * @since v5.6 - complete re-write |
| 1426 | 1426 | */ |
| 1427 | 1427 | public function generate_options_pages_sidebar_menu() {
|
| 1428 | - if ( isset( $_REQUEST['section'] ) ) {
|
|
| 1429 | - $selected = $_REQUEST['section']; |
|
| 1428 | + if ( isset( $_REQUEST[ 'section' ] ) ) {
|
|
| 1429 | + $selected = $_REQUEST[ 'section' ]; |
|
| 1430 | 1430 | } |
| 1431 | 1431 | $installed_addons = get_option( 'yikes-easy-mc-active-addons', array() ); |
| 1432 | 1432 | |
@@ -1443,25 +1443,25 @@ discard block |
||
| 1443 | 1443 | <h3><span><?php _e( 'Additional Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
| 1444 | 1444 | <div class="inside"> |
| 1445 | 1445 | <ul id="settings-nav"> |
| 1446 | - <li><?php if ( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'general-settings' || !isset( $_REQUEST['section'] ) ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'general-settings' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=general-settings' ) ) ); ?>"><?php _e( 'General Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1447 | - <li><?php if ( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'integration-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'integration-settings' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=integration-settings' ) ) ); ?>"><?php _e( 'Integration Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1448 | - <li><?php if ( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'recaptcha-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'recaptcha-settings' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) ); ?>"><?php _e( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1449 | - <li><?php if ( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'api-cache-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'api-cache-settings' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=api-cache-settings' ) ) ); ?>"><?php _e( 'API Cache Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1450 | - <li><?php if ( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'debug-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'debug-settings' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings' ) ) ); ?>"><?php _e( 'Debug Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1451 | - <li><?php if ( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'import-export-forms' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'import-export-forms' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=import-export-forms' ) ) ); ?>"><?php _e( 'Import/Export', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1446 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'general-settings' || ! isset( $_REQUEST[ 'section' ] ) ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'general-settings' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=general-settings' ) ) ); ?>"><?php _e( 'General Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1447 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'integration-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'integration-settings' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=integration-settings' ) ) ); ?>"><?php _e( 'Integration Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1448 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'recaptcha-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'recaptcha-settings' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) ); ?>"><?php _e( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1449 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'api-cache-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'api-cache-settings' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=api-cache-settings' ) ) ); ?>"><?php _e( 'API Cache Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1450 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'debug-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'debug-settings' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings' ) ) ); ?>"><?php _e( 'Debug Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1451 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'import-export-forms' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'import-export-forms' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=import-export-forms' ) ) ); ?>"><?php _e( 'Import/Export', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1452 | 1452 | </ul> |
| 1453 | 1453 | <?php |
| 1454 | 1454 | // create our add-on settings pages |
| 1455 | - if ( !empty( $installed_addons ) ) {
|
|
| 1455 | + if ( ! empty( $installed_addons ) ) {
|
|
| 1456 | 1456 | ?> |
| 1457 | 1457 | <hr class="add-on-settings-divider" /> |
| 1458 | 1458 | <strong><?php _e( 'Addon Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
| 1459 | 1459 | <ul id="addon-settings-nav"> |
| 1460 | 1460 | <?php |
| 1461 | - foreach( $installed_addons as $addon_name ) {
|
|
| 1461 | + foreach ( $installed_addons as $addon_name ) {
|
|
| 1462 | 1462 | ?> |
| 1463 | 1463 | <li> |
| 1464 | - <?php if ( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == $addon_name ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => $addon_name, 'addon' => 'true' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion='.$addon_name ) ) ); ?>"><?php echo ucwords( str_replace( '-', ' ', $addon_name ) ); ?></a></li>
|
|
| 1464 | + <?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == $addon_name ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => $addon_name, 'addon' => 'true' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=' . $addon_name ) ) ); ?>"><?php echo ucwords( str_replace( '-', ' ', $addon_name ) ); ?></a></li>
|
|
| 1465 | 1465 | <?php |
| 1466 | 1466 | } |
| 1467 | 1467 | ?> |
@@ -1510,19 +1510,19 @@ discard block |
||
| 1510 | 1510 | <select name="associated-list" id="associated-list" class=" input-field" <?php $this->is_user_mc_api_valid_form( true ); disabled( true, empty( $lists ) ); ?>> |
| 1511 | 1511 | <?php |
| 1512 | 1512 | if ( ! empty( $lists ) ) {
|
| 1513 | - foreach( $lists as $mailing_list ) {
|
|
| 1513 | + foreach ( $lists as $mailing_list ) {
|
|
| 1514 | 1514 | ?> |
| 1515 | - <option value="<?php echo $mailing_list['id']; ?>"><?php echo stripslashes( $mailing_list['name'] ) . ' (' . $mailing_list['stats']['member_count'] . ') '; ?></option>
|
|
| 1515 | + <option value="<?php echo $mailing_list[ 'id' ]; ?>"><?php echo stripslashes( $mailing_list[ 'name' ] ) . ' (' . $mailing_list[ 'stats' ][ 'member_count' ] . ') '; ?></option>
|
|
| 1516 | 1516 | <?php |
| 1517 | 1517 | } |
| 1518 | 1518 | } else {
|
| 1519 | 1519 | if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) {
|
| 1520 | 1520 | ?> |
| 1521 | - <option><?php echo __( "Please enter a valid API key." , 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
| 1521 | + <option><?php echo __( "Please enter a valid API key.", 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
| 1522 | 1522 | <?php |
| 1523 | 1523 | } else {
|
| 1524 | 1524 | ?> |
| 1525 | - <option><?php echo __( "No lists were found on the account." , 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
| 1525 | + <option><?php echo __( "No lists were found on the account.", 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
| 1526 | 1526 | <?php |
| 1527 | 1527 | |
| 1528 | 1528 | } |
@@ -1531,8 +1531,8 @@ discard block |
||
| 1531 | 1531 | </select> |
| 1532 | 1532 | |
| 1533 | 1533 | <?php |
| 1534 | - if ( isset( $_GET['transient-cleared'] ) ) {
|
|
| 1535 | - if ( 'true' === $_GET['transient-cleared'] ) {
|
|
| 1534 | + if ( isset( $_GET[ 'transient-cleared' ] ) ) {
|
|
| 1535 | + if ( 'true' === $_GET[ 'transient-cleared' ] ) {
|
|
| 1536 | 1536 | ?> |
| 1537 | 1537 | <div class="yikes-list-refreshed-notice"> |
| 1538 | 1538 | <p><?php esc_attr_e( 'MailChimp list data has been succesfully refreshed.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -1545,7 +1545,7 @@ discard block |
||
| 1545 | 1545 | if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'invalid_api_key' ) {
|
| 1546 | 1546 | ?> |
| 1547 | 1547 | <p class="description"> |
| 1548 | - <?php printf( __( 'Head over to <a href="http://www.MailChimp.com" title="%s">MailChimp</a> to create a new list.', 'yikes-inc-easy-mailchimp-extender' ) , __( 'Create a list', 'yikes-inc-easy-mailchimp-extender' ) ); ?> |
|
| 1548 | + <?php printf( __( 'Head over to <a href="http://www.MailChimp.com" title="%s">MailChimp</a> to create a new list.', 'yikes-inc-easy-mailchimp-extender' ), __( 'Create a list', 'yikes-inc-easy-mailchimp-extender' ) ); ?> |
|
| 1549 | 1549 | </p> |
| 1550 | 1550 | <?php |
| 1551 | 1551 | } |
@@ -1554,9 +1554,9 @@ discard block |
||
| 1554 | 1554 | </label> |
| 1555 | 1555 | <?php |
| 1556 | 1556 | if ( $this->is_user_mc_api_valid_form( false ) ) {
|
| 1557 | - echo submit_button( __( 'Create', 'yikes-inc-easy-mailchimp-extender' ) , 'primary', '', false , array( 'style' => 'margin:.75em 0 .5em 0;' ) ); |
|
| 1557 | + echo submit_button( __( 'Create', 'yikes-inc-easy-mailchimp-extender' ), 'primary', '', false, array( 'style' => 'margin:.75em 0 .5em 0;' ) ); |
|
| 1558 | 1558 | } else {
|
| 1559 | - echo '<p class="description">' . __( "Please enter a valid MailChimp API key to get started." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
| 1559 | + echo '<p class="description">' . __( "Please enter a valid MailChimp API key to get started.", 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
| 1560 | 1560 | ?> |
| 1561 | 1561 | <a href="<?php echo esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&settings-updated=true' ) ); ?>"><?php _e( 'general settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
| 1562 | 1562 | <?php |
@@ -1586,7 +1586,7 @@ discard block |
||
| 1586 | 1586 | $post_types = get_post_types(); |
| 1587 | 1587 | ?> |
| 1588 | 1588 | <label id="redirect-user-to-selection-label" for="redirect-user-to-selection" class="<?php if ( $redirect == '0' ) { echo 'yikes-easy-mc-hidden'; } ?>">
|
| 1589 | - <?php _e( "Select A Page or Post" , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 1589 | + <?php _e( "Select A Page or Post", 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 1590 | 1590 | <select id="redirect-user-to-selection" name="redirect-user-to-selection" onchange="shouldWeDisplayCustomURL( this );return;"> |
| 1591 | 1591 | <?php |
| 1592 | 1592 | |
@@ -1602,7 +1602,7 @@ discard block |
||
| 1602 | 1602 | $excluded_post_types = apply_filters( 'yikes-mailchimp-excluded-redirect-post-types', $excluded_post_types ); |
| 1603 | 1603 | |
| 1604 | 1604 | // loop over registered post types, and query! |
| 1605 | - foreach( $post_types as $registered_post_type ) {
|
|
| 1605 | + foreach ( $post_types as $registered_post_type ) {
|
|
| 1606 | 1606 | |
| 1607 | 1607 | // exclude a few built in custom post types and any defined by the filter |
| 1608 | 1608 | if ( ! in_array( $registered_post_type, $excluded_post_types ) ) {
|
@@ -1624,8 +1624,8 @@ discard block |
||
| 1624 | 1624 | ?> |
| 1625 | 1625 | <optgroup label="<?php echo ucwords( str_replace( '_', ' ', $registered_post_type ) ); ?>"> |
| 1626 | 1626 | <?php |
| 1627 | - foreach( $post_ids as $post_id ) {
|
|
| 1628 | - ?><option <?php selected( $redirect_page , $post_id ); ?> value="<?php echo $post_id; ?>"><?php echo get_the_title( $post_id ) ?></option><?php |
|
| 1627 | + foreach ( $post_ids as $post_id ) {
|
|
| 1628 | + ?><option <?php selected( $redirect_page, $post_id ); ?> value="<?php echo $post_id; ?>"><?php echo get_the_title( $post_id ) ?></option><?php |
|
| 1629 | 1629 | } |
| 1630 | 1630 | ?> |
| 1631 | 1631 | </optgroup> |
@@ -1641,7 +1641,7 @@ discard block |
||
| 1641 | 1641 | </select> |
| 1642 | 1642 | |
| 1643 | 1643 | <label name="custom-redirect-url" class="custom_redirect_url_label" <?php if ( ! isset( $redirect_page ) || $redirect_page != 'custom_url' ) { echo 'style="display:none;"'; } ?>>
|
| 1644 | - <?php _e( "Enter Custom URL" , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 1644 | + <?php _e( "Enter Custom URL", 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 1645 | 1645 | <input type="text" class="widefat custom-redirect-url" name="custom-redirect-url" value="<?php echo $custom_redirect_url; ?>" /> |
| 1646 | 1646 | </label> |
| 1647 | 1647 | |
@@ -1706,7 +1706,7 @@ discard block |
||
| 1706 | 1706 | </p> |
| 1707 | 1707 | </div> |
| 1708 | 1708 | |
| 1709 | - <p class="description sidebar-footer-text"><?php printf( __( "This plugin made with %s by %s" , 'yikes-inc-easy-mailchimp-extender' ), '<span class="dashicons dashicons-heart yikes-love"></span>', '<a href="http://www.yikesinc.com" target="_blank" title="YIKES Inc.">YIKES Inc.</a>' ); ?> </p> |
|
| 1709 | + <p class="description sidebar-footer-text"><?php printf( __( "This plugin made with %s by %s", 'yikes-inc-easy-mailchimp-extender' ), '<span class="dashicons dashicons-heart yikes-love"></span>', '<a href="http://www.yikesinc.com" target="_blank" title="YIKES Inc.">YIKES Inc.</a>' ); ?> </p> |
|
| 1710 | 1710 | |
| 1711 | 1711 | <section id="about-yikes-inc" class="inside"> |
| 1712 | 1712 | <a href="https://www.yikesinc.com" target="_blank" title="YIKES Inc."> |
@@ -1724,7 +1724,7 @@ discard block |
||
| 1724 | 1724 | <!-- review us container --> |
| 1725 | 1725 | <h3><?php _e( 'Easy Forms for MailChimp Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
| 1726 | 1726 | <div id="review-yikes-easy-mc" class="inside"> |
| 1727 | - <p><?php _e( "Check out available add-ons for some seriously enhanced features." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 1727 | + <p><?php _e( "Check out available add-ons for some seriously enhanced features.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 1728 | 1728 | <p><a class="button-secondary" href="<?php echo esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-addons' ) ); ?>" title="<?php _e( 'View Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'View Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?></a></p> |
| 1729 | 1729 | </div> |
| 1730 | 1730 | |
@@ -1751,11 +1751,11 @@ discard block |
||
| 1751 | 1751 | |
| 1752 | 1752 | // if no list id, die! |
| 1753 | 1753 | if ( ! $list_id ) {
|
| 1754 | - wp_die( __( "We've encountered an error. No list ID was sent." , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 1754 | + wp_die( __( "We've encountered an error. No list ID was sent.", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 1755 | 1755 | } |
| 1756 | 1756 | |
| 1757 | 1757 | if ( ! $merge_variables ) {
|
| 1758 | - wp_die( __( "We've encountered an error. Reload the page and try again. If the error persists, please reach out to support." , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 1758 | + wp_die( __( "We've encountered an error. Reload the page and try again. If the error persists, please reach out to support.", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 1759 | 1759 | } |
| 1760 | 1760 | |
| 1761 | 1761 | if ( ! empty( $form_fields ) ) {
|
@@ -1766,17 +1766,17 @@ discard block |
||
| 1766 | 1766 | $available_interest_groups = array(); |
| 1767 | 1767 | |
| 1768 | 1768 | // Default variables as arrays - these are used for holding the MailChimp merge field ID |
| 1769 | - $merge_field_ids = array(); |
|
| 1770 | - $mailchimp_merge_field_ids = array(); |
|
| 1769 | + $merge_field_ids = array(); |
|
| 1770 | + $mailchimp_merge_field_ids = array(); |
|
| 1771 | 1771 | |
| 1772 | 1772 | // loop over merge variables |
| 1773 | - if ( ! empty( $merge_variables['merge_fields'] ) ) {
|
|
| 1774 | - $available_merge_variables = wp_list_pluck( $merge_variables['merge_fields'], 'tag' ); |
|
| 1775 | - $mailchimp_merge_field_ids = wp_list_pluck( $merge_variables['merge_fields'], 'merge_id' ); |
|
| 1773 | + if ( ! empty( $merge_variables[ 'merge_fields' ] ) ) {
|
|
| 1774 | + $available_merge_variables = wp_list_pluck( $merge_variables[ 'merge_fields' ], 'tag' ); |
|
| 1775 | + $mailchimp_merge_field_ids = wp_list_pluck( $merge_variables[ 'merge_fields' ], 'merge_id' ); |
|
| 1776 | 1776 | |
| 1777 | 1777 | // Array will look like $merge_tag => $merge_id |
| 1778 | - foreach( $available_merge_variables as $index => $merge_tag ) {
|
|
| 1779 | - $merge_field_ids[$merge_tag] = $mailchimp_merge_field_ids[$index]; |
|
| 1778 | + foreach ( $available_merge_variables as $index => $merge_tag ) {
|
|
| 1779 | + $merge_field_ids[ $merge_tag ] = $mailchimp_merge_field_ids[ $index ]; |
|
| 1780 | 1780 | } |
| 1781 | 1781 | } |
| 1782 | 1782 | |
@@ -1791,46 +1791,46 @@ discard block |
||
| 1791 | 1791 | $excluded_fields = array_diff( $assigned_fields, $merged_fields ); |
| 1792 | 1792 | |
| 1793 | 1793 | $i = 1; |
| 1794 | - foreach( $form_fields as $field ) {
|
|
| 1794 | + foreach ( $form_fields as $field ) {
|
|
| 1795 | 1795 | |
| 1796 | - if ( isset( $field['merge'] ) ) {
|
|
| 1796 | + if ( isset( $field[ 'merge' ] ) ) {
|
|
| 1797 | 1797 | // @todo: don't use in_array() |
| 1798 | - $excluded_field = in_array( $field['merge'], $excluded_fields, true ); |
|
| 1798 | + $excluded_field = in_array( $field[ 'merge' ], $excluded_fields, true ); |
|
| 1799 | 1799 | ?> |
| 1800 | - <section class="draggable" id="<?php echo $field['merge']; ?>"> |
|
| 1800 | + <section class="draggable" id="<?php echo $field[ 'merge' ]; ?>"> |
|
| 1801 | 1801 | <!-- top --> |
| 1802 | 1802 | <a class="expansion-section-title settings-sidebar"> |
| 1803 | 1803 | <span class="dashicons dashicons-plus yikes-mc-expansion-toggle"></span> |
| 1804 | - <span class="yikes-mc-expansion-section-field-label"> <?php echo stripslashes( $field['label'] ); ?> </span> |
|
| 1804 | + <span class="yikes-mc-expansion-section-field-label"> <?php echo stripslashes( $field[ 'label' ] ); ?> </span> |
|
| 1805 | 1805 | <?php if ( $excluded_field ) { ?>
|
| 1806 | 1806 | <img src="<?php echo YIKES_MC_URL . 'includes/images/warning.svg'; ?>" class="field-doesnt-exist-notice" title="<?php _e( 'Field no longer exists.', 'yikes-inc-easy-mailchimp-extender' ); ?>" alt="<?php _e( 'Field no longer exists.', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
| 1807 | 1807 | <?php } ?> |
| 1808 | - <input maxlength="45" type="text" class="yikes-mc-edit-field-label-input" value="<?php echo stripslashes( $field['label'] ); ?>" /> |
|
| 1808 | + <input maxlength="45" type="text" class="yikes-mc-edit-field-label-input" value="<?php echo stripslashes( $field[ 'label' ] ); ?>" /> |
|
| 1809 | 1809 | <span class="dashicons dashicons-yes yikes-mc-save-field-label-edits-icon" title="<?php _e( 'Click to save changes.', 'yikes-inc-easy-mailchimp-extender' ); ?>"></span> |
| 1810 | 1810 | <span class="dashicons dashicons-edit yikes-mc-edit-field-label-icon" title="<?php _e( 'Click to edit the label', 'yikes-inc-easy-mailchimp-extender' ); ?>"></span> |
| 1811 | 1811 | <span class="yikes-mc-edit-field-label-message"></span> |
| 1812 | - <span class="field-type-text"><small><?php echo __( 'type', 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $field['type']; ?></small></span> |
|
| 1812 | + <span class="field-type-text"><small><?php echo __( 'type', 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $field[ 'type' ]; ?></small></span> |
|
| 1813 | 1813 | </a> |
| 1814 | 1814 | <!-- expansion section --> |
| 1815 | 1815 | <div class="yikes-mc-settings-expansion-section"> |
| 1816 | 1816 | |
| 1817 | 1817 | <?php if ( $excluded_field ) { ?>
|
| 1818 | - <p class="yikes-mc-warning-message"><?php _e( "This field no longer exists in this list. Delete this field from the form to prevent issues on your website." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 1818 | + <p class="yikes-mc-warning-message"><?php _e( "This field no longer exists in this list. Delete this field from the form to prevent issues on your website.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 1819 | 1819 | <?php } ?> |
| 1820 | 1820 | |
| 1821 | 1821 | <!-- store field data --> |
| 1822 | - <input type="hidden" class="yikes-mc-merge-field-label" name="field[<?php echo $field['merge']; ?>][label]" value="<?php echo htmlspecialchars( $field['label'] ); ?>" /> |
|
| 1823 | - <input type="hidden" class="yikes-mc-merge-field-type" name="field[<?php echo $field['merge']; ?>][type]" value="<?php echo $field['type']; ?>" /> |
|
| 1824 | - <input type="hidden" class="yikes-mc-merge-field-tag" name="field[<?php echo $field['merge']; ?>][merge]" value="<?php echo $field['merge']; ?>" /> |
|
| 1825 | - <input type="hidden" class="field-<?php echo $field['merge']; ?>-position position-input" name="field[<?php echo $field['merge']; ?>][position]" value="<?php echo $i++; ?>" /> |
|
| 1826 | - <?php if ( isset( $merge_field_ids[ $field['merge'] ] ) && is_int( $merge_field_ids[ $field['merge'] ] ) ) { ?>
|
|
| 1827 | - <input type="hidden" class="yikes-mc-merge-field-id" name="field[<?php echo $field['merge']; ?>][id]" value="<?php echo $merge_field_ids[ $field['merge'] ] ?>" /> |
|
| 1822 | + <input type="hidden" class="yikes-mc-merge-field-label" name="field[<?php echo $field[ 'merge' ]; ?>][label]" value="<?php echo htmlspecialchars( $field[ 'label' ] ); ?>" /> |
|
| 1823 | + <input type="hidden" class="yikes-mc-merge-field-type" name="field[<?php echo $field[ 'merge' ]; ?>][type]" value="<?php echo $field[ 'type' ]; ?>" /> |
|
| 1824 | + <input type="hidden" class="yikes-mc-merge-field-tag" name="field[<?php echo $field[ 'merge' ]; ?>][merge]" value="<?php echo $field[ 'merge' ]; ?>" /> |
|
| 1825 | + <input type="hidden" class="field-<?php echo $field[ 'merge' ]; ?>-position position-input" name="field[<?php echo $field[ 'merge' ]; ?>][position]" value="<?php echo $i++; ?>" /> |
|
| 1826 | + <?php if ( isset( $merge_field_ids[ $field[ 'merge' ] ] ) && is_int( $merge_field_ids[ $field[ 'merge' ] ] ) ) { ?>
|
|
| 1827 | + <input type="hidden" class="yikes-mc-merge-field-id" name="field[<?php echo $field[ 'merge' ]; ?>][id]" value="<?php echo $merge_field_ids[ $field[ 'merge' ] ] ?>" /> |
|
| 1828 | 1828 | <?php } ?> |
| 1829 | 1829 | |
| 1830 | - <?php if ( $field['type'] == 'radio' || $field['type'] == 'dropdown' || $field['type'] == 'select' ) {
|
|
| 1831 | - $choices = json_decode( $field['choices'], true ); |
|
| 1830 | + <?php if ( $field[ 'type' ] == 'radio' || $field[ 'type' ] == 'dropdown' || $field[ 'type' ] == 'select' ) {
|
|
| 1831 | + $choices = json_decode( $field[ 'choices' ], true ); |
|
| 1832 | 1832 | ?> |
| 1833 | - <input type="hidden" name="field[<?php echo $field['merge']; ?>][choices]" value='<?php echo esc_attr( json_encode( $choices ) ); ?>' /> |
|
| 1833 | + <input type="hidden" name="field[<?php echo $field[ 'merge' ]; ?>][choices]" value='<?php echo esc_attr( json_encode( $choices ) ); ?>' /> |
|
| 1834 | 1834 | <?php } ?> |
| 1835 | 1835 | |
| 1836 | 1836 | <!-- Single or Double Opt-in --> |
@@ -1846,12 +1846,12 @@ discard block |
||
| 1846 | 1846 | </label> |
| 1847 | 1847 | </td> |
| 1848 | 1848 | <td> |
| 1849 | - <input class="widefat merge-tag-text" type="text" readonly value="<?php echo $field['merge']; ?>"> |
|
| 1849 | + <input class="widefat merge-tag-text" type="text" readonly value="<?php echo $field[ 'merge' ]; ?>"> |
|
| 1850 | 1850 | </td> |
| 1851 | 1851 | </tr> |
| 1852 | 1852 | |
| 1853 | 1853 | <!-- Placeholder Value --> |
| 1854 | - <?php switch( $field['type'] ) {
|
|
| 1854 | + <?php switch ( $field[ 'type' ] ) {
|
|
| 1855 | 1855 | |
| 1856 | 1856 | case 'text': |
| 1857 | 1857 | case 'email': |
@@ -1865,13 +1865,13 @@ discard block |
||
| 1865 | 1865 | <!-- Placeholder --> |
| 1866 | 1866 | <tr valign="top"> |
| 1867 | 1867 | <td scope="row"> |
| 1868 | - <label for="placeholder_<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 1868 | + <label for="placeholder_<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 1869 | 1869 | <?php _e( 'Placeholder', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 1870 | 1870 | </label> |
| 1871 | 1871 | </td> |
| 1872 | 1872 | <td> |
| 1873 | - <input type="text" id="placeholder_<?php echo esc_attr( $field['merge'] ); ?>" class="widefat" name="field[<?php echo $field['merge']; ?>][placeholder]" value="<?php echo isset( $field['placeholder'] ) ? $field['placeholder'] : '' ; ?>" /> |
|
| 1874 | - <p class="description"><small><?php _e( "Assign a placeholder value to this field.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 1873 | + <input type="text" id="placeholder_<?php echo esc_attr( $field[ 'merge' ] ); ?>" class="widefat" name="field[<?php echo $field[ 'merge' ]; ?>][placeholder]" value="<?php echo isset( $field[ 'placeholder' ] ) ? $field[ 'placeholder' ] : ''; ?>" /> |
|
| 1874 | + <p class="description"><small><?php _e( "Assign a placeholder value to this field.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 1875 | 1875 | </td> |
| 1876 | 1876 | </tr> |
| 1877 | 1877 | <?php |
@@ -1882,13 +1882,13 @@ discard block |
||
| 1882 | 1882 | ?> |
| 1883 | 1883 | <tr valign="top"> |
| 1884 | 1884 | <td scope="row"> |
| 1885 | - <label for="placeholder_<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 1885 | + <label for="placeholder_<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 1886 | 1886 | <?php _e( 'Placeholder', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 1887 | 1887 | </label> |
| 1888 | 1888 | </td> |
| 1889 | 1889 | <td> |
| 1890 | - <input type="checkbox" id="placeholder_<?php echo esc_attr( $field['merge'] ); ?>" class="widefat" name="field[<?php echo $field['merge']; ?>][placeholder]" value="1" <?php echo isset( $field['placeholder'] ) && ! empty( $field['placeholder'] ) ? 'checked="checked"' : '' ; ?> /> |
|
| 1891 | - <span class="description"><small><?php _e( "Use placeholders for this field (these will be automatically filled in with field names).", 'yikes-inc-easy-mailchimp-extender' );?></small></span> |
|
| 1890 | + <input type="checkbox" id="placeholder_<?php echo esc_attr( $field[ 'merge' ] ); ?>" class="widefat" name="field[<?php echo $field[ 'merge' ]; ?>][placeholder]" value="1" <?php echo isset( $field[ 'placeholder' ] ) && ! empty( $field[ 'placeholder' ] ) ? 'checked="checked"' : ''; ?> /> |
|
| 1891 | + <span class="description"><small><?php _e( "Use placeholders for this field (these will be automatically filled in with field names).", 'yikes-inc-easy-mailchimp-extender' ); ?></small></span> |
|
| 1892 | 1892 | </td> |
| 1893 | 1893 | </tr> |
| 1894 | 1894 | <?php |
@@ -1898,7 +1898,7 @@ discard block |
||
| 1898 | 1898 | ?> |
| 1899 | 1899 | |
| 1900 | 1900 | <!-- Default Value --> |
| 1901 | - <?php switch( $field['type'] ) {
|
|
| 1901 | + <?php switch ( $field[ 'type' ] ) {
|
|
| 1902 | 1902 | default: |
| 1903 | 1903 | case 'text': |
| 1904 | 1904 | case 'number': |
@@ -1906,15 +1906,15 @@ discard block |
||
| 1906 | 1906 | ?> |
| 1907 | 1907 | <tr valign="top"> |
| 1908 | 1908 | <td scope="row"> |
| 1909 | - <label for="default_value_<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 1909 | + <label for="default_value_<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 1910 | 1910 | <?php _e( 'Default Value', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 1911 | 1911 | </label> |
| 1912 | 1912 | </td> |
| 1913 | 1913 | <td> |
| 1914 | - <input id="default_value_<?php echo esc_attr( $field['merge'] ); ?>" <?php if ( $field['type'] != 'number' ) { ?> type="text" <?php } else { ?> type="number" <?php } ?> class="widefat" name="field[<?php echo $field['merge']; ?>][default]" <?php if ( $field['type'] != 'url' ) { ?> value="<?php echo isset( $field['default'] ) ? stripslashes( wp_strip_all_tags( $field['default'] ) ) : ''; ?>" <?php } else { ?> value="<?php echo isset( $field['default'] ) ? stripslashes( wp_strip_all_tags( esc_url_raw( $field['default'] ) ) ) : ''; ?>" <?php } ?> />
|
|
| 1915 | - <p class="description"><small><?php _e( "Assign a default value to populate this field with on initial page load.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 1914 | + <input id="default_value_<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php if ( $field[ 'type' ] != 'number' ) { ?> type="text" <?php } else { ?> type="number" <?php } ?> class="widefat" name="field[<?php echo $field[ 'merge' ]; ?>][default]" <?php if ( $field[ 'type' ] != 'url' ) { ?> value="<?php echo isset( $field[ 'default' ] ) ? stripslashes( wp_strip_all_tags( $field[ 'default' ] ) ) : ''; ?>" <?php } else { ?> value="<?php echo isset( $field[ 'default' ] ) ? stripslashes( wp_strip_all_tags( esc_url_raw( $field[ 'default' ] ) ) ) : ''; ?>" <?php } ?> />
|
|
| 1915 | + <p class="description"><small><?php _e( "Assign a default value to populate this field with on initial page load.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 1916 | 1916 | <?php |
| 1917 | - switch( $field['type'] ) {
|
|
| 1917 | + switch ( $field[ 'type' ] ) {
|
|
| 1918 | 1918 | case 'text': |
| 1919 | 1919 | ?> |
| 1920 | 1920 | <p><small class="pre-defined-tag-link"><a href="#TB_inline?width=600&height=550&inlineId=pre-defined-tag-container" onclick="storeGlobalClicked( jQuery( this ) );" class="thickbox"><?php _e( 'View Pre-Defined Tags', 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></p> |
@@ -1936,28 +1936,28 @@ discard block |
||
| 1936 | 1936 | </td> |
| 1937 | 1937 | <td> |
| 1938 | 1938 | <?php |
| 1939 | - $field['default_choice'] = ! isset( $field['default_choice'] ) ? 'no-default' : $field['default_choice']; |
|
| 1939 | + $field[ 'default_choice' ] = ! isset( $field[ 'default_choice' ] ) ? 'no-default' : $field[ 'default_choice' ]; |
|
| 1940 | 1940 | $x = 0; |
| 1941 | 1941 | ?> |
| 1942 | - <label for="<?php echo $field['merge'] . '-no-default'; ?>"> |
|
| 1943 | - <input id="<?php echo $field['merge'] . '-no-default'; ?>" |
|
| 1942 | + <label for="<?php echo $field[ 'merge' ] . '-no-default'; ?>"> |
|
| 1943 | + <input id="<?php echo $field[ 'merge' ] . '-no-default'; ?>" |
|
| 1944 | 1944 | type="radio" |
| 1945 | - name="field[<?php echo $field['merge']; ?>][default_choice]" |
|
| 1946 | - value="no-default" <?php checked( $field['default_choice'], 'no-default' ); ?> |
|
| 1945 | + name="field[<?php echo $field[ 'merge' ]; ?>][default_choice]" |
|
| 1946 | + value="no-default" <?php checked( $field[ 'default_choice' ], 'no-default' ); ?> |
|
| 1947 | 1947 | > |
| 1948 | 1948 | No Default |
| 1949 | 1949 | </label> |
| 1950 | 1950 | <?php |
| 1951 | 1951 | foreach ( $choices as $choice => $value ) { ?>
|
| 1952 | - <label for="<?php echo $field['merge'].'-'.$x; ?>"> |
|
| 1953 | - <input id="<?php echo $field['merge'].'-'.$x; ?>" |
|
| 1952 | + <label for="<?php echo $field[ 'merge' ] . '-' . $x; ?>"> |
|
| 1953 | + <input id="<?php echo $field[ 'merge' ] . '-' . $x; ?>" |
|
| 1954 | 1954 | type="radio" |
| 1955 | - name="field[<?php echo $field['merge']; ?>][default_choice]" |
|
| 1956 | - value="<?php echo $x; ?>" <?php checked( $field['default_choice'], $x ); ?>> |
|
| 1955 | + name="field[<?php echo $field[ 'merge' ]; ?>][default_choice]" |
|
| 1956 | + value="<?php echo $x; ?>" <?php checked( $field[ 'default_choice' ], $x ); ?>> |
|
| 1957 | 1957 | <?php echo $value; ?> |
| 1958 | 1958 | </label> |
| 1959 | 1959 | <?php $x++; } ?> |
| 1960 | - <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 1960 | + <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 1961 | 1961 | </td> |
| 1962 | 1962 | </tr> |
| 1963 | 1963 | |
@@ -1973,13 +1973,13 @@ discard block |
||
| 1973 | 1973 | </label> |
| 1974 | 1974 | </td> |
| 1975 | 1975 | <td> |
| 1976 | - <select type="default" name="field[<?php echo $field['merge']; ?>][default_choice]"> |
|
| 1977 | - <option value="no-default" <?php selected( $field['default_choice'] , 'no-default' ); ?>>No Default</option> |
|
| 1978 | - <?php foreach( json_decode( $field['choices'], true ) as $choice => $value ) { ?>
|
|
| 1979 | - <option value="<?php echo $choice; ?>" <?php selected( $field['default_choice'] , $choice ); ?>><?php echo $value; ?></option> |
|
| 1976 | + <select type="default" name="field[<?php echo $field[ 'merge' ]; ?>][default_choice]"> |
|
| 1977 | + <option value="no-default" <?php selected( $field[ 'default_choice' ], 'no-default' ); ?>>No Default</option> |
|
| 1978 | + <?php foreach ( json_decode( $field[ 'choices' ], true ) as $choice => $value ) { ?>
|
|
| 1979 | + <option value="<?php echo $choice; ?>" <?php selected( $field[ 'default_choice' ], $choice ); ?>><?php echo $value; ?></option> |
|
| 1980 | 1980 | <?php } ?> |
| 1981 | 1981 | </select> |
| 1982 | - <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 1982 | + <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 1983 | 1983 | </td> |
| 1984 | 1984 | </tr> |
| 1985 | 1985 | |
@@ -1996,82 +1996,82 @@ discard block |
||
| 1996 | 1996 | <!-- Field Description --> |
| 1997 | 1997 | <tr valign="top"> |
| 1998 | 1998 | <td scope="row"> |
| 1999 | - <label for="description_<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 1999 | + <label for="description_<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 2000 | 2000 | <?php _e( 'Description', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2001 | 2001 | </label> |
| 2002 | 2002 | </td> |
| 2003 | 2003 | <td> |
| 2004 | - <textarea class="widefat field-description-input" id="description_<?php echo esc_attr( $field['merge'] ); ?>" name="field[<?php echo $field['merge']; ?>][description]"><?php echo isset( $field['description'] ) ? stripslashes( esc_html( $field['description'] ) ) : '' ; ?></textarea> |
|
| 2005 | - <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and will provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2004 | + <textarea class="widefat field-description-input" id="description_<?php echo esc_attr( $field[ 'merge' ] ); ?>" name="field[<?php echo $field[ 'merge' ]; ?>][description]"><?php echo isset( $field[ 'description' ] ) ? stripslashes( esc_html( $field[ 'description' ] ) ) : ''; ?></textarea> |
|
| 2005 | + <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and will provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2006 | 2006 | </td> |
| 2007 | 2007 | </tr> |
| 2008 | 2008 | <!-- Description Above Field --> |
| 2009 | 2009 | <tr valign="top"> |
| 2010 | 2010 | <td scope="row"> |
| 2011 | - <label for="description_above_<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 2011 | + <label for="description_above_<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 2012 | 2012 | <?php _e( 'Description Above Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2013 | 2013 | </label> |
| 2014 | 2014 | </td> |
| 2015 | 2015 | <td> |
| 2016 | - <input type="checkbox" id="description_above_<?php echo esc_attr( $field['merge'] ); ?>" class="widefat field-description-input" name="field[<?php echo $field['merge']; ?>][description_above]" value="1" <?php echo isset( $field['description_above'] ) && $field['description_above'] === '1' ? 'checked="checked"' : ''; ?> /> |
|
| 2017 | - <span class="description"><small><?php _e( "By default the description will appear undearneath the field. Check this box if you'd like the description to appear above the field.", 'yikes-inc-easy-mailchimp-extender' );?></small></span> |
|
| 2016 | + <input type="checkbox" id="description_above_<?php echo esc_attr( $field[ 'merge' ] ); ?>" class="widefat field-description-input" name="field[<?php echo $field[ 'merge' ]; ?>][description_above]" value="1" <?php echo isset( $field[ 'description_above' ] ) && $field[ 'description_above' ] === '1' ? 'checked="checked"' : ''; ?> /> |
|
| 2017 | + <span class="description"><small><?php _e( "By default the description will appear undearneath the field. Check this box if you'd like the description to appear above the field.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></span> |
|
| 2018 | 2018 | </td> |
| 2019 | 2019 | </tr> |
| 2020 | 2020 | <!-- Additional Classes --> |
| 2021 | 2021 | <tr valign="top"> |
| 2022 | 2022 | <td scope="row"> |
| 2023 | - <label for="classes_<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 2023 | + <label for="classes_<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 2024 | 2024 | <?php _e( 'Additional Classes', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2025 | 2025 | </label> |
| 2026 | 2026 | </td> |
| 2027 | 2027 | <td> |
| 2028 | - <input type="text" id="classes_<?php echo esc_attr( $field['merge'] ); ?>" class="widefat" name="field[<?php echo $field['merge']; ?>][additional-classes]" value="<?php echo isset( $field['additional-classes'] ) ? stripslashes( wp_strip_all_tags( $field['additional-classes'] ) ) : '' ; ?>" /> |
|
| 2029 | - <p class="description"><small><?php printf( __( "Assign additional classes to this field. %s.", 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/bundled-css-classes/' ) . '">' . __( 'View bundled classes', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' );?></small></p> |
|
| 2028 | + <input type="text" id="classes_<?php echo esc_attr( $field[ 'merge' ] ); ?>" class="widefat" name="field[<?php echo $field[ 'merge' ]; ?>][additional-classes]" value="<?php echo isset( $field[ 'additional-classes' ] ) ? stripslashes( wp_strip_all_tags( $field[ 'additional-classes' ] ) ) : ''; ?>" /> |
|
| 2029 | + <p class="description"><small><?php printf( __( "Assign additional classes to this field. %s.", 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/bundled-css-classes/' ) . '">' . __( 'View bundled classes', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ); ?></small></p> |
|
| 2030 | 2030 | </td> |
| 2031 | 2031 | </tr> |
| 2032 | 2032 | <!-- Required Toggle --> |
| 2033 | 2033 | <tr valign="top" class="yikes-checkbox-container yikes-checkbox-container-first"> |
| 2034 | 2034 | <td scope="row"> |
| 2035 | - <label for="field-required-<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 2035 | + <label for="field-required-<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 2036 | 2036 | <?php _e( 'Field Required?', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2037 | 2037 | </label> |
| 2038 | 2038 | </td> |
| 2039 | 2039 | <td> |
| 2040 | - <?php $checked = isset( $field['require'] ) ? $field['require'] : '0'; ?> |
|
| 2041 | - <input id="field-required-<?php echo esc_attr( $field['merge'] ); ?>" type="checkbox" class="widefat" value="1" name="field[<?php echo $field['merge']; ?>][require]" <?php checked( $checked , 1 ); ?> <?php if ( $field['merge'] == 'EMAIL' ) { ?> disabled="disabled" checked="checked" title="<?php echo __( 'Email is a required field.', 'yikes-inc-easy-mailchimp-extender' ); } ?>">
|
|
| 2042 | - <p class="description"><small><?php _e( "Require this field to be filled in before the form can be submitted.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2040 | + <?php $checked = isset( $field[ 'require' ] ) ? $field[ 'require' ] : '0'; ?> |
|
| 2041 | + <input id="field-required-<?php echo esc_attr( $field[ 'merge' ] ); ?>" type="checkbox" class="widefat" value="1" name="field[<?php echo $field[ 'merge' ]; ?>][require]" <?php checked( $checked, 1 ); ?> <?php if ( $field[ 'merge' ] == 'EMAIL' ) { ?> disabled="disabled" checked="checked" title="<?php echo __( 'Email is a required field.', 'yikes-inc-easy-mailchimp-extender' ); } ?>">
|
|
| 2042 | + <p class="description"><small><?php _e( "Require this field to be filled in before the form can be submitted.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2043 | 2043 | </td> |
| 2044 | 2044 | </tr> |
| 2045 | 2045 | <!-- Visible Toggle --> |
| 2046 | 2046 | <tr valign="top" class="yikes-checkbox-container"> |
| 2047 | 2047 | <td scope="row"> |
| 2048 | - <label for="hide-field-<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 2048 | + <label for="hide-field-<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 2049 | 2049 | <?php _e( 'Hide Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2050 | 2050 | </label> |
| 2051 | 2051 | </td> |
| 2052 | 2052 | <td> |
| 2053 | - <?php $hide = isset( $field['hide'] ) ? $field['hide'] : '0'; ?> |
|
| 2054 | - <input id="hide-field-<?php echo esc_attr( $field['merge'] ); ?>" type="checkbox" class="widefat" value="1" name="field[<?php echo $field['merge']; ?>][hide]" <?php checked( $hide , 1 ); ?> <?php if ( $field['merge'] == 'EMAIL' ) { ?> disabled="disabled" title="<?php echo __( 'Cannot toggle email field visibility.', 'yikes-inc-easy-mailchimp-extender' ); } ?>">
|
|
| 2055 | - <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2053 | + <?php $hide = isset( $field[ 'hide' ] ) ? $field[ 'hide' ] : '0'; ?> |
|
| 2054 | + <input id="hide-field-<?php echo esc_attr( $field[ 'merge' ] ); ?>" type="checkbox" class="widefat" value="1" name="field[<?php echo $field[ 'merge' ]; ?>][hide]" <?php checked( $hide, 1 ); ?> <?php if ( $field[ 'merge' ] == 'EMAIL' ) { ?> disabled="disabled" title="<?php echo __( 'Cannot toggle email field visibility.', 'yikes-inc-easy-mailchimp-extender' ); } ?>">
|
|
| 2055 | + <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2056 | 2056 | </td> |
| 2057 | 2057 | </tr> |
| 2058 | 2058 | <!-- Toggle Field Label Visibility --> |
| 2059 | 2059 | <tr valign="top" class="yikes-checkbox-container"> |
| 2060 | 2060 | <td scope="row"> |
| 2061 | - <label for="hide-label-<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 2061 | + <label for="hide-label-<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 2062 | 2062 | <?php _e( 'Hide Label', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2063 | 2063 | </label> |
| 2064 | 2064 | </td> |
| 2065 | 2065 | <td> |
| 2066 | - <?php $hide_label = isset( $field['hide-label'] ) ? $field['hide-label'] : '0'; ?> |
|
| 2067 | - <input id="hide-label-<?php echo esc_attr( $field['merge'] ); ?>" type="checkbox" name="field[<?php echo $field['merge']; ?>][hide-label]" value="1" <?php checked( $hide_label , 1 ); ?>/> |
|
| 2068 | - <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2066 | + <?php $hide_label = isset( $field[ 'hide-label' ] ) ? $field[ 'hide-label' ] : '0'; ?> |
|
| 2067 | + <input id="hide-label-<?php echo esc_attr( $field[ 'merge' ] ); ?>" type="checkbox" name="field[<?php echo $field[ 'merge' ]; ?>][hide-label]" value="1" <?php checked( $hide_label, 1 ); ?>/> |
|
| 2068 | + <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2069 | 2069 | </td> |
| 2070 | 2070 | </tr> |
| 2071 | 2071 | <!-- Display Phone/Date Formats back to the user --> |
| 2072 | 2072 | <!-- Phone Format Initial Load --> |
| 2073 | 2073 | <?php |
| 2074 | - switch( $field['type'] ) {
|
|
| 2074 | + switch ( $field[ 'type' ] ) {
|
|
| 2075 | 2075 | /* Store the phone format, for properly regex pattern */ |
| 2076 | 2076 | case 'phone': |
| 2077 | 2077 | case 'birthday': |
@@ -2081,23 +2081,23 @@ discard block |
||
| 2081 | 2081 | <td scope="row"> |
| 2082 | 2082 | <label for="placeholder"> |
| 2083 | 2083 | <?php |
| 2084 | - switch( $field['type'] ) {
|
|
| 2084 | + switch ( $field[ 'type' ] ) {
|
|
| 2085 | 2085 | default: |
| 2086 | 2086 | case 'birthday': |
| 2087 | 2087 | $type = __( 'Date Format', 'yikes-inc-easy-mailchimp-extender' ); |
| 2088 | - $format = ( isset( $field['date_format'] ) ) ? $field['date_format'] : 'MM/DD'; |
|
| 2088 | + $format = ( isset( $field[ 'date_format' ] ) ) ? $field[ 'date_format' ] : 'MM/DD'; |
|
| 2089 | 2089 | $format_name = 'date_format'; |
| 2090 | 2090 | break; |
| 2091 | 2091 | |
| 2092 | 2092 | case 'date': |
| 2093 | 2093 | $type = __( 'Date Format', 'yikes-inc-easy-mailchimp-extender' ); |
| 2094 | - $format = ( isset( $field['date_format'] ) ) ? $field['date_format'] : 'MM/DD/YYYY'; |
|
| 2094 | + $format = ( isset( $field[ 'date_format' ] ) ) ? $field[ 'date_format' ] : 'MM/DD/YYYY'; |
|
| 2095 | 2095 | $format_name = 'date_format'; |
| 2096 | 2096 | break; |
| 2097 | 2097 | |
| 2098 | 2098 | case 'phone': |
| 2099 | 2099 | $type = __( 'Phone Format', 'yikes-inc-easy-mailchimp-extender' ); |
| 2100 | - $format = isset( $field['phone_format'] ) && ! empty( $field['phone_format'] ) ? $field['phone_format'] : __( 'International', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 2100 | + $format = isset( $field[ 'phone_format' ] ) && ! empty( $field[ 'phone_format' ] ) ? $field[ 'phone_format' ] : __( 'International', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 2101 | 2101 | $format_name = 'phone_format'; |
| 2102 | 2102 | break; |
| 2103 | 2103 | } |
@@ -2107,7 +2107,7 @@ discard block |
||
| 2107 | 2107 | </td> |
| 2108 | 2108 | <td> |
| 2109 | 2109 | <strong><?php echo $format; ?></strong> |
| 2110 | - <input type="hidden" name="field[<?php echo $field['merge']; ?>][<?php echo $format_name; ?>]" value="<?php echo $format; ?>" /> |
|
| 2110 | + <input type="hidden" name="field[<?php echo $field[ 'merge' ]; ?>][<?php echo $format_name; ?>]" value="<?php echo $format; ?>" /> |
|
| 2111 | 2111 | <p class="description"><small> |
| 2112 | 2112 | <?php printf( __( 'To change the %s please head over to <a href="%s" title="MailChimp" target="_blank">MailChimp</a>. If you alter the format, you should re-import this field.', 'yikes-inc-easy-mailchimp-extender' ), strtolower( $type ), esc_url( 'http://www.mailchimp.com' ) ); ?> |
| 2113 | 2113 | </small></p> |
@@ -2128,8 +2128,8 @@ discard block |
||
| 2128 | 2128 | </td> |
| 2129 | 2129 | <td> |
| 2130 | 2130 | <span class="toggle-container"> |
| 2131 | - <a href="#" class="close-form-expansion"><?php _e( "Close" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 2132 | - <a href="#" class="remove-field" alt="<?php echo $field['merge']; ?>"><?php _e( "Remove Field" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 2131 | + <a href="#" class="close-form-expansion"><?php _e( "Close", 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 2132 | + <a href="#" class="remove-field" alt="<?php echo $field[ 'merge' ]; ?>"><?php _e( "Remove Field", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 2133 | 2133 | </span> |
| 2134 | 2134 | </td> |
| 2135 | 2135 | </tr> |
@@ -2147,35 +2147,35 @@ discard block |
||
| 2147 | 2147 | /**** Interest Group ****/ |
| 2148 | 2148 | |
| 2149 | 2149 | ?> |
| 2150 | - <section class="draggable" id="<?php echo $field['group_id']; ?>"> |
|
| 2150 | + <section class="draggable" id="<?php echo $field[ 'group_id' ]; ?>"> |
|
| 2151 | 2151 | <!-- top --> |
| 2152 | 2152 | <a href="#" class="expansion-section-title settings-sidebar"> |
| 2153 | - <span class="dashicons dashicons-plus yikes-mc-expansion-toggle"></span><?php echo stripslashes( $field['label'] ); ?> |
|
| 2154 | - <?php if ( in_array( $field['group_id'] , $excluded_fields ) ) { ?>
|
|
| 2153 | + <span class="dashicons dashicons-plus yikes-mc-expansion-toggle"></span><?php echo stripslashes( $field[ 'label' ] ); ?> |
|
| 2154 | + <?php if ( in_array( $field[ 'group_id' ], $excluded_fields ) ) { ?>
|
|
| 2155 | 2155 | <img src="<?php echo YIKES_MC_URL . 'includes/images/warning.svg'; ?>" class="field-no-longer-exists-warning" title="<?php _e( 'Field no longer exists.', 'yikes-inc-easy-mailchimp-extender' ); ?>" alt="<?php _e( 'Field no longer exists.', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
| 2156 | 2156 | <?php } ?> |
| 2157 | - <span class="field-type-text"><small><?php echo __( 'type', 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $field['type']; ?></small></span> |
|
| 2157 | + <span class="field-type-text"><small><?php echo __( 'type', 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $field[ 'type' ]; ?></small></span> |
|
| 2158 | 2158 | </a> |
| 2159 | 2159 | <!-- expansion section --> |
| 2160 | 2160 | <div class="yikes-mc-settings-expansion-section"> |
| 2161 | 2161 | |
| 2162 | 2162 | <!-- check if this field exists in the available interest group array --> |
| 2163 | - <?php if ( in_array( $field['group_id'] , $excluded_fields ) ) { ?>
|
|
| 2164 | - <p class="yikes-mc-warning-message"><?php _e( "This field no longer exists in this list. Delete this field from the form to prevent issues on the front end." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 2163 | + <?php if ( in_array( $field[ 'group_id' ], $excluded_fields ) ) { ?>
|
|
| 2164 | + <p class="yikes-mc-warning-message"><?php _e( "This field no longer exists in this list. Delete this field from the form to prevent issues on the front end.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 2165 | 2165 | <?php } ?> |
| 2166 | 2166 | |
| 2167 | 2167 | <!-- store the label --> |
| 2168 | - <input type="hidden" name="field[<?php echo $field['group_id']; ?>][label]" value="<?php echo htmlspecialchars( $field['label'] ); ?>" /> |
|
| 2169 | - <input type="hidden" name="field[<?php echo $field['group_id']; ?>][type]" value="<?php echo $field['type']; ?>" /> |
|
| 2170 | - <input type="hidden" name="field[<?php echo $field['group_id']; ?>][group_id]" value="<?php echo $field['group_id']; ?>" /> |
|
| 2171 | - <input type="hidden" name="field[<?php echo $field['group_id']; ?>][groups]" value='<?php echo esc_attr( json_encode( json_decode( $field['groups'], true ) ) ); ?>' /> |
|
| 2168 | + <input type="hidden" name="field[<?php echo $field[ 'group_id' ]; ?>][label]" value="<?php echo htmlspecialchars( $field[ 'label' ] ); ?>" /> |
|
| 2169 | + <input type="hidden" name="field[<?php echo $field[ 'group_id' ]; ?>][type]" value="<?php echo $field[ 'type' ]; ?>" /> |
|
| 2170 | + <input type="hidden" name="field[<?php echo $field[ 'group_id' ]; ?>][group_id]" value="<?php echo $field[ 'group_id' ]; ?>" /> |
|
| 2171 | + <input type="hidden" name="field[<?php echo $field[ 'group_id' ]; ?>][groups]" value='<?php echo esc_attr( json_encode( json_decode( $field[ 'groups' ], true ) ) ); ?>' /> |
|
| 2172 | 2172 | |
| 2173 | 2173 | <!-- Single or Double Opt-in --> |
| 2174 | 2174 | <p class="type-container"><!-- necessary to prevent skipping on slideToggle(); --> |
| 2175 | 2175 | |
| 2176 | 2176 | <table class="form-table form-field-container"> |
| 2177 | 2177 | <!-- Default Value --> |
| 2178 | - <?php switch( $field['type'] ) {
|
|
| 2178 | + <?php switch ( $field[ 'type' ] ) {
|
|
| 2179 | 2179 | default: |
| 2180 | 2180 | case 'radio': |
| 2181 | 2181 | case 'checkboxes': |
@@ -2188,7 +2188,7 @@ discard block |
||
| 2188 | 2188 | </td> |
| 2189 | 2189 | <td> |
| 2190 | 2190 | <?php |
| 2191 | - $field['default_choice'] = isset( $field['default_choice'] ) ? $field['default_choice'] : array(); |
|
| 2191 | + $field[ 'default_choice' ] = isset( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : array(); |
|
| 2192 | 2192 | // if ( $field['type'] != 'checkboxes' ) {
|
| 2193 | 2193 | // if ( ! isset( $field['default_choice'] ) ) {
|
| 2194 | 2194 | // $group_options = json_decode( stripslashes( $field['groups'] ), true ); |
@@ -2202,11 +2202,11 @@ discard block |
||
| 2202 | 2202 | |
| 2203 | 2203 | $default_shown = false; |
| 2204 | 2204 | |
| 2205 | - foreach ( json_decode( $field['groups'], true ) as $id => $group ) {
|
|
| 2206 | - $field_id = "{$field['group_id']}-{$id}";
|
|
| 2207 | - $field_type = 'hidden' == $field['type'] ? 'checkbox' : $field['type']; |
|
| 2205 | + foreach ( json_decode( $field[ 'groups' ], true ) as $id => $group ) {
|
|
| 2206 | + $field_id = "{$field[ 'group_id' ]}-{$id}";
|
|
| 2207 | + $field_type = 'hidden' == $field[ 'type' ] ? 'checkbox' : $field[ 'type' ]; |
|
| 2208 | 2208 | $field_type = 'checkboxes' == $field_type ? 'checkbox' : $field_type; |
| 2209 | - $field_name = "field[{$field['group_id']}][default_choice]";
|
|
| 2209 | + $field_name = "field[{$field[ 'group_id' ]}][default_choice]";
|
|
| 2210 | 2210 | $field_name = 'checkbox' == $field_type ? $field_name . '[]' : $field_name; |
| 2211 | 2211 | |
| 2212 | 2212 | // Determine if the current group is checked. |
@@ -2214,12 +2214,12 @@ discard block |
||
| 2214 | 2214 | switch ( $field_type ) {
|
| 2215 | 2215 | case 'radio': |
| 2216 | 2216 | default: |
| 2217 | - $checked = checked( $field['default_choice'], $id, false ); |
|
| 2217 | + $checked = checked( $field[ 'default_choice' ], $id, false ); |
|
| 2218 | 2218 | break; |
| 2219 | 2219 | |
| 2220 | 2220 | case 'checkbox': |
| 2221 | 2221 | case 'hidden': |
| 2222 | - if ( in_array( $id, (array) $field['default_choice'] ) ) {
|
|
| 2222 | + if ( in_array( $id, (array) $field[ 'default_choice' ] ) ) {
|
|
| 2223 | 2223 | $checked = checked( true, true, false ); |
| 2224 | 2224 | } |
| 2225 | 2225 | break; |
@@ -2234,7 +2234,7 @@ discard block |
||
| 2234 | 2234 | type="<?php echo $field_type; ?>" |
| 2235 | 2235 | name="<?php echo $field_name; ?>" |
| 2236 | 2236 | value="no-default" |
| 2237 | - <?php checked( $field['default_choice'], 'no-default' ); ?>> |
|
| 2237 | + <?php checked( $field[ 'default_choice' ], 'no-default' ); ?>> |
|
| 2238 | 2238 | No Default |
| 2239 | 2239 | </label> |
| 2240 | 2240 | <?php |
@@ -2250,7 +2250,7 @@ discard block |
||
| 2250 | 2250 | </label> |
| 2251 | 2251 | <?php |
| 2252 | 2252 | } ?> |
| 2253 | - <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2253 | + <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2254 | 2254 | </td> |
| 2255 | 2255 | </tr> |
| 2256 | 2256 | |
@@ -2266,13 +2266,13 @@ discard block |
||
| 2266 | 2266 | </label> |
| 2267 | 2267 | </td> |
| 2268 | 2268 | <td> |
| 2269 | - <select type="default" name="field[<?php echo $field['group_id']; ?>][default_choice]"> |
|
| 2269 | + <select type="default" name="field[<?php echo $field[ 'group_id' ]; ?>][default_choice]"> |
|
| 2270 | 2270 | <option value="no-default">No Default</option> |
| 2271 | - <?php foreach( json_decode( stripslashes_deep( $field['groups'] ) , true ) as $id => $group ) { ?>
|
|
| 2272 | - <option value="<?php echo $id; ?>" <?php selected( $field['default_choice'] , $id ); ?>><?php echo stripslashes( $group ); ?></option> |
|
| 2271 | + <?php foreach ( json_decode( stripslashes_deep( $field[ 'groups' ] ), true ) as $id => $group ) { ?>
|
|
| 2272 | + <option value="<?php echo $id; ?>" <?php selected( $field[ 'default_choice' ], $id ); ?>><?php echo stripslashes( $group ); ?></option> |
|
| 2273 | 2273 | <?php } ?> |
| 2274 | 2274 | </select> |
| 2275 | - <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2275 | + <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2276 | 2276 | </td> |
| 2277 | 2277 | </tr> |
| 2278 | 2278 | |
@@ -2285,78 +2285,78 @@ discard block |
||
| 2285 | 2285 | <!-- Field Description --> |
| 2286 | 2286 | <tr valign="top"> |
| 2287 | 2287 | <td scope="row"> |
| 2288 | - <label for="description_<?php echo esc_attr( $field['group_id'] ); ?>"> |
|
| 2288 | + <label for="description_<?php echo esc_attr( $field[ 'group_id' ] ); ?>"> |
|
| 2289 | 2289 | <?php _e( 'Description', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2290 | 2290 | </label> |
| 2291 | 2291 | </td> |
| 2292 | 2292 | <td> |
| 2293 | - <textarea id="description_<?php echo esc_attr( $field['group_id'] ); ?>" class="widefat field-description-input" name="field[<?php echo $field['group_id']; ?>][description]"><?php echo isset( $field['description'] ) ? stripslashes( esc_html( $field['description'] ) ) : '' ; ?></textarea> |
|
| 2294 | - <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2293 | + <textarea id="description_<?php echo esc_attr( $field[ 'group_id' ] ); ?>" class="widefat field-description-input" name="field[<?php echo $field[ 'group_id' ]; ?>][description]"><?php echo isset( $field[ 'description' ] ) ? stripslashes( esc_html( $field[ 'description' ] ) ) : ''; ?></textarea> |
|
| 2294 | + <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2295 | 2295 | </td> |
| 2296 | 2296 | </tr> |
| 2297 | 2297 | |
| 2298 | 2298 | <!-- Description Above Field --> |
| 2299 | 2299 | <tr valign="top"> |
| 2300 | 2300 | <td scope="row"> |
| 2301 | - <label for="description_above_<?php echo $field['group_id']; ?>"> |
|
| 2301 | + <label for="description_above_<?php echo $field[ 'group_id' ]; ?>"> |
|
| 2302 | 2302 | <?php _e( 'Description Above Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2303 | 2303 | </label> |
| 2304 | 2304 | </td> |
| 2305 | 2305 | <td> |
| 2306 | - <input type="checkbox" id="description_above_<?php echo $field['group_id']; ?>" class="widefat field-description-input" name="field[<?php echo $field['group_id']; ?>][description_above]" value="1" <?php echo isset( $field['description_above'] ) && $field['description_above'] === '1' ? 'checked="checked"' : ''; ?> /> |
|
| 2307 | - <span class="description"><small><?php _e( "By default the description will appear undearneath the field. Check this box if you'd like the description to appear above the field.", 'yikes-inc-easy-mailchimp-extender' );?></small></span> |
|
| 2306 | + <input type="checkbox" id="description_above_<?php echo $field[ 'group_id' ]; ?>" class="widefat field-description-input" name="field[<?php echo $field[ 'group_id' ]; ?>][description_above]" value="1" <?php echo isset( $field[ 'description_above' ] ) && $field[ 'description_above' ] === '1' ? 'checked="checked"' : ''; ?> /> |
|
| 2307 | + <span class="description"><small><?php _e( "By default the description will appear undearneath the field. Check this box if you'd like the description to appear above the field.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></span> |
|
| 2308 | 2308 | </td> |
| 2309 | 2309 | </tr> |
| 2310 | 2310 | |
| 2311 | 2311 | <!-- Additional Classes --> |
| 2312 | 2312 | <tr valign="top"> |
| 2313 | 2313 | <td scope="row"> |
| 2314 | - <label for="classes_<?php echo esc_attr( $field['group_id'] ); ?>"> |
|
| 2314 | + <label for="classes_<?php echo esc_attr( $field[ 'group_id' ] ); ?>"> |
|
| 2315 | 2315 | <?php _e( 'Additional Classes', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2316 | 2316 | </label> |
| 2317 | 2317 | </td> |
| 2318 | 2318 | <td> |
| 2319 | - <input type="text" id="classes_<?php echo esc_attr( $field['group_id'] ); ?>" class="widefat" name="field[<?php echo $field['group_id']; ?>][additional-classes]" value="<?php echo isset( $field['additional-classes'] ) ? stripslashes( wp_strip_all_tags( $field['additional-classes'] ) ) : '' ; ?>" /> |
|
| 2320 | - <p class="description"><small><?php printf( __( "Assign additional classes to this field. %s.", 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/bundled-css-classes/' ) . '">' . __( 'View bundled classes', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' );?></small></p> |
|
| 2319 | + <input type="text" id="classes_<?php echo esc_attr( $field[ 'group_id' ] ); ?>" class="widefat" name="field[<?php echo $field[ 'group_id' ]; ?>][additional-classes]" value="<?php echo isset( $field[ 'additional-classes' ] ) ? stripslashes( wp_strip_all_tags( $field[ 'additional-classes' ] ) ) : ''; ?>" /> |
|
| 2320 | + <p class="description"><small><?php printf( __( "Assign additional classes to this field. %s.", 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/bundled-css-classes/' ) . '">' . __( 'View bundled classes', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ); ?></small></p> |
|
| 2321 | 2321 | </td> |
| 2322 | 2322 | </tr> |
| 2323 | 2323 | <!-- Required Toggle --> |
| 2324 | 2324 | <tr valign="top"> |
| 2325 | 2325 | <td scope="row"> |
| 2326 | - <label for="field-required-<?php echo esc_attr( $field['group_id'] ); ?>"> |
|
| 2326 | + <label for="field-required-<?php echo esc_attr( $field[ 'group_id' ] ); ?>"> |
|
| 2327 | 2327 | <?php _e( 'Field Required?', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2328 | 2328 | </label> |
| 2329 | 2329 | </td> |
| 2330 | 2330 | <td> |
| 2331 | - <?php $checked = isset( $field['require'] ) ? $field['require'] : '0'; ?> |
|
| 2332 | - <input type="checkbox" id="field-required-<?php echo esc_attr( $field['group_id'] ); ?>" class="widefat" value="1" name="field[<?php echo $field['group_id']; ?>][require]" <?php checked( $checked , 1 ); ?>> |
|
| 2333 | - <p class="description"><small><?php _e( "Require this field to be filled in before the form can be submitted.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2331 | + <?php $checked = isset( $field[ 'require' ] ) ? $field[ 'require' ] : '0'; ?> |
|
| 2332 | + <input type="checkbox" id="field-required-<?php echo esc_attr( $field[ 'group_id' ] ); ?>" class="widefat" value="1" name="field[<?php echo $field[ 'group_id' ]; ?>][require]" <?php checked( $checked, 1 ); ?>> |
|
| 2333 | + <p class="description"><small><?php _e( "Require this field to be filled in before the form can be submitted.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2334 | 2334 | </td> |
| 2335 | 2335 | </tr> |
| 2336 | 2336 | <!-- Visible Toggle --> |
| 2337 | 2337 | <tr valign="top"> |
| 2338 | 2338 | <td scope="row"> |
| 2339 | - <label for="hide-field-<?php echo esc_attr( $field['group_id'] ); ?>"> |
|
| 2339 | + <label for="hide-field-<?php echo esc_attr( $field[ 'group_id' ] ); ?>"> |
|
| 2340 | 2340 | <?php _e( 'Hide Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2341 | 2341 | </label> |
| 2342 | 2342 | </td> |
| 2343 | 2343 | <td> |
| 2344 | - <?php $hide = isset( $field['hide'] ) ? $field['hide'] : '0'; ?> |
|
| 2345 | - <input type="checkbox" id="hide-field-<?php echo esc_attr( $field['group_id'] ); ?>" class="widefat" value="1" name="field[<?php echo $field['group_id']; ?>][hide]" <?php checked( $hide , 1 ); ?>> |
|
| 2346 | - <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2344 | + <?php $hide = isset( $field[ 'hide' ] ) ? $field[ 'hide' ] : '0'; ?> |
|
| 2345 | + <input type="checkbox" id="hide-field-<?php echo esc_attr( $field[ 'group_id' ] ); ?>" class="widefat" value="1" name="field[<?php echo $field[ 'group_id' ]; ?>][hide]" <?php checked( $hide, 1 ); ?>> |
|
| 2346 | + <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2347 | 2347 | </td> |
| 2348 | 2348 | </tr> |
| 2349 | 2349 | <!-- Toggle Field Label Visibility --> |
| 2350 | 2350 | <tr valign="top"> |
| 2351 | 2351 | <td scope="row"> |
| 2352 | - <label for="hide-label-<?php echo esc_attr( $field['group_id'] ); ?>"> |
|
| 2352 | + <label for="hide-label-<?php echo esc_attr( $field[ 'group_id' ] ); ?>"> |
|
| 2353 | 2353 | <?php _e( 'Hide Label', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2354 | 2354 | </label> |
| 2355 | 2355 | </td> |
| 2356 | 2356 | <td> |
| 2357 | - <?php $hide = isset( $field['hide-label'] ) ? $field['hide-label'] : '0'; ?> |
|
| 2358 | - <input type="checkbox" id="hide-label-<?php echo esc_attr( $field['group_id'] ); ?>" name="field[<?php echo $field['group_id']; ?>][hide-label]" value="1" <?php checked( $hide , 1 ); ?>/> |
|
| 2359 | - <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2357 | + <?php $hide = isset( $field[ 'hide-label' ] ) ? $field[ 'hide-label' ] : '0'; ?> |
|
| 2358 | + <input type="checkbox" id="hide-label-<?php echo esc_attr( $field[ 'group_id' ] ); ?>" name="field[<?php echo $field[ 'group_id' ]; ?>][hide-label]" value="1" <?php checked( $hide, 1 ); ?>/> |
|
| 2359 | + <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2360 | 2360 | </td> |
| 2361 | 2361 | </tr> |
| 2362 | 2362 | <!-- Toggle Buttons --> |
@@ -2366,8 +2366,8 @@ discard block |
||
| 2366 | 2366 | </td> |
| 2367 | 2367 | <td> |
| 2368 | 2368 | <span class="toggle-container"> |
| 2369 | - <a href="#" class="close-form-expansion"><?php _e( "Close" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 2370 | - <a href="#" class="remove-field" alt="<?php echo $field['group_id']; ?>"><?php _e( "Remove Field" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 2369 | + <a href="#" class="close-form-expansion"><?php _e( "Close", 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 2370 | + <a href="#" class="remove-field" alt="<?php echo $field[ 'group_id' ]; ?>"><?php _e( "Remove Field", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 2371 | 2371 | </span> |
| 2372 | 2372 | </td> |
| 2373 | 2373 | </tr> |
@@ -2388,7 +2388,7 @@ discard block |
||
| 2388 | 2388 | add_thickbox(); |
| 2389 | 2389 | // enqueue jquery qtip for our tooltip |
| 2390 | 2390 | wp_enqueue_script( 'jquery-qtip-tooltip', YIKES_MC_URL . 'admin/js/min/jquery.qtip.min.js', array( 'jquery' ) ); |
| 2391 | - wp_enqueue_style( 'jquery-qtip-style', YIKES_MC_URL . 'admin/css/jquery.qtip.min.css' ); |
|
| 2391 | + wp_enqueue_style( 'jquery-qtip-style', YIKES_MC_URL . 'admin/css/jquery.qtip.min.css' ); |
|
| 2392 | 2392 | $available_tags = array( |
| 2393 | 2393 | array( |
| 2394 | 2394 | 'tag' => '{page_title}',
|
@@ -2443,14 +2443,14 @@ discard block |
||
| 2443 | 2443 | <h3><?php _e( 'Pre Defined Tags', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
| 2444 | 2444 | <p class="description"><?php _e( 'You can use any of the following tags to populate a MailChimp text field with dynamic content. This can be used to determine which page the user signed up on, if the user was logged in and more.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
| 2445 | 2445 | <ul> |
| 2446 | - <?php foreach( apply_filters( 'yikes-mailchimp-custom-default-value-tags', $available_tags ) as $tag ) { ?>
|
|
| 2446 | + <?php foreach ( apply_filters( 'yikes-mailchimp-custom-default-value-tags', $available_tags ) as $tag ) { ?>
|
|
| 2447 | 2447 | <li class="tooltop-tag"> |
| 2448 | 2448 | <!-- link/tag --> |
| 2449 | - <a href="#" onclick="populateDefaultValue( '<?php echo $tag['tag']; ?>' );return false;" data-attr-tag="<?php echo $tag['tag']; ?>" title="<?php echo $tag['title']; ?>"><?php echo $tag['title']; ?></a> |
|
| 2449 | + <a href="#" onclick="populateDefaultValue( '<?php echo $tag[ 'tag' ]; ?>' );return false;" data-attr-tag="<?php echo $tag[ 'tag' ]; ?>" title="<?php echo $tag[ 'title' ]; ?>"><?php echo $tag[ 'title' ]; ?></a> |
|
| 2450 | 2450 | <!-- help icon --> |
| 2451 | 2451 | <span class="dashicons dashicons-editor-help"></span> |
| 2452 | 2452 | <!-- tooltip --> |
| 2453 | - <div class="tooltiptext qtip-bootstrap yikes-easy-mc-hidden"><?php echo $tag['description']; ?></div> |
|
| 2453 | + <div class="tooltiptext qtip-bootstrap yikes-easy-mc-hidden"><?php echo $tag[ 'description' ]; ?></div> |
|
| 2454 | 2454 | </li> |
| 2455 | 2455 | <?php } ?> |
| 2456 | 2456 | </ul> |
@@ -2466,46 +2466,46 @@ discard block |
||
| 2466 | 2466 | * - |
| 2467 | 2467 | * @parameters - $list_id - pass in the list ID to retreive merge variables from |
| 2468 | 2468 | */ |
| 2469 | - public function build_available_merge_vars( $form_fields , $available_merge_variables ) {
|
|
| 2469 | + public function build_available_merge_vars( $form_fields, $available_merge_variables ) {
|
|
| 2470 | 2470 | $fields_assigned_to_form = array(); |
| 2471 | 2471 | foreach ( $form_fields as $field ) {
|
| 2472 | - if ( isset( $field['merge'] ) ) {
|
|
| 2473 | - $fields_assigned_to_form[ $field['merge'] ] = true; |
|
| 2472 | + if ( isset( $field[ 'merge' ] ) ) {
|
|
| 2473 | + $fields_assigned_to_form[ $field[ 'merge' ] ] = true; |
|
| 2474 | 2474 | } |
| 2475 | 2475 | } |
| 2476 | 2476 | |
| 2477 | - if ( ! empty( $available_merge_variables['merge_fields'] ) ) {
|
|
| 2477 | + if ( ! empty( $available_merge_variables[ 'merge_fields' ] ) ) {
|
|
| 2478 | 2478 | ?> |
| 2479 | 2479 | <ul id="available-fields"><?php |
| 2480 | - foreach ( $available_merge_variables['merge_fields'] as $merge_var ) {
|
|
| 2481 | - if ( isset( $fields_assigned_to_form[ $merge_var['tag'] ] ) ) {
|
|
| 2480 | + foreach ( $available_merge_variables[ 'merge_fields' ] as $merge_var ) {
|
|
| 2481 | + if ( isset( $fields_assigned_to_form[ $merge_var[ 'tag' ] ] ) ) {
|
|
| 2482 | 2482 | ?> |
| 2483 | 2483 | <li class="available-form-field not-available" |
| 2484 | - alt="<?php echo $merge_var['tag']; ?>" |
|
| 2485 | - data-attr-field-type="<?php echo esc_attr( $merge_var['type'] ); ?>" |
|
| 2486 | - data-attr-field-name="<?php echo esc_attr( $merge_var['name'] ); ?>" |
|
| 2487 | - data-attr-form-id="<?php echo esc_attr( $available_merge_variables['list_id'] ); ?>" |
|
| 2484 | + alt="<?php echo $merge_var[ 'tag' ]; ?>" |
|
| 2485 | + data-attr-field-type="<?php echo esc_attr( $merge_var[ 'type' ] ); ?>" |
|
| 2486 | + data-attr-field-name="<?php echo esc_attr( $merge_var[ 'name' ] ); ?>" |
|
| 2487 | + data-attr-form-id="<?php echo esc_attr( $available_merge_variables[ 'list_id' ] ); ?>" |
|
| 2488 | 2488 | title="<?php esc_attr_e( 'Already assigned to your form', 'yikes-inc-easy-mailchimp-extender' ); ?>" |
| 2489 | 2489 | disabled="disabled"> |
| 2490 | - <?php echo stripslashes( $merge_var['name'] ); |
|
| 2491 | - if ( $merge_var['required'] ) {
|
|
| 2490 | + <?php echo stripslashes( $merge_var[ 'name' ] ); |
|
| 2491 | + if ( $merge_var[ 'required' ] ) {
|
|
| 2492 | 2492 | echo ' <span class="field-required" title="' . __( 'required field', 'yikes-inc-easy-mailchimp-extender' ) . '">*</span>'; |
| 2493 | 2493 | } ?> |
| 2494 | - <small class="field-type-text"><?php echo $merge_var['type']; ?></small> |
|
| 2494 | + <small class="field-type-text"><?php echo $merge_var[ 'type' ]; ?></small> |
|
| 2495 | 2495 | </li> |
| 2496 | 2496 | <?php |
| 2497 | 2497 | } else {
|
| 2498 | 2498 | ?> |
| 2499 | 2499 | <li class="available-form-field" |
| 2500 | - alt="<?php echo $merge_var['tag']; ?>" |
|
| 2501 | - data-attr-field-type="<?php echo esc_attr( $merge_var['type'] ); ?>" |
|
| 2502 | - data-attr-field-name="<?php echo esc_attr( $merge_var['name'] ); ?>" |
|
| 2503 | - data-attr-form-id="<?php echo esc_attr( $available_merge_variables['list_id'] ); ?>"> |
|
| 2504 | - <?php echo stripslashes( $merge_var['name'] ); |
|
| 2505 | - if ( $merge_var['required'] ) {
|
|
| 2500 | + alt="<?php echo $merge_var[ 'tag' ]; ?>" |
|
| 2501 | + data-attr-field-type="<?php echo esc_attr( $merge_var[ 'type' ] ); ?>" |
|
| 2502 | + data-attr-field-name="<?php echo esc_attr( $merge_var[ 'name' ] ); ?>" |
|
| 2503 | + data-attr-form-id="<?php echo esc_attr( $available_merge_variables[ 'list_id' ] ); ?>"> |
|
| 2504 | + <?php echo stripslashes( $merge_var[ 'name' ] ); |
|
| 2505 | + if ( $merge_var[ 'required' ] ) {
|
|
| 2506 | 2506 | echo ' <span class="field-required" title="' . __( 'required field', 'yikes-inc-easy-mailchimp-extender' ) . '">*</span>'; |
| 2507 | 2507 | } ?> |
| 2508 | - <small class="field-type-text"><?php echo $merge_var['type']; ?></small> |
|
| 2508 | + <small class="field-type-text"><?php echo $merge_var[ 'type' ]; ?></small> |
|
| 2509 | 2509 | </li> |
| 2510 | 2510 | <?php |
| 2511 | 2511 | } |
@@ -2527,12 +2527,12 @@ discard block |
||
| 2527 | 2527 | * - |
| 2528 | 2528 | * @parameters - $list_id - pass in the list ID to retreive merge variables from |
| 2529 | 2529 | */ |
| 2530 | - public function build_available_interest_groups( $form_fields , $available_interest_groups , $list_id ) {
|
|
| 2530 | + public function build_available_interest_groups( $form_fields, $available_interest_groups, $list_id ) {
|
|
| 2531 | 2531 | $fields_assigned_to_form = array(); |
| 2532 | 2532 | if ( ! empty( $form_fields ) ) {
|
| 2533 | 2533 | foreach ( $form_fields as $field ) {
|
| 2534 | - if ( isset( $field['group_id'] ) ) {
|
|
| 2535 | - $fields_assigned_to_form[ $field['group_id'] ] = true; |
|
| 2534 | + if ( isset( $field[ 'group_id' ] ) ) {
|
|
| 2535 | + $fields_assigned_to_form[ $field[ 'group_id' ] ] = true; |
|
| 2536 | 2536 | } |
| 2537 | 2537 | } |
| 2538 | 2538 | } |
@@ -2541,29 +2541,29 @@ discard block |
||
| 2541 | 2541 | ?> |
| 2542 | 2542 | <ul id="available-interest-groups"><?php |
| 2543 | 2543 | foreach ( $available_interest_groups as $interest_group ) {
|
| 2544 | - if ( isset( $fields_assigned_to_form[ $interest_group['id'] ] ) ) {
|
|
| 2544 | + if ( isset( $fields_assigned_to_form[ $interest_group[ 'id' ] ] ) ) {
|
|
| 2545 | 2545 | ?> |
| 2546 | 2546 | <li class="available-interest-group not-available" |
| 2547 | - alt="<?php echo $interest_group['id']; ?>" |
|
| 2548 | - data-attr-field-name="<?php echo htmlspecialchars( $interest_group['title'] ); ?>" |
|
| 2549 | - data-attr-field-type="<?php echo $interest_group['type']; ?>" |
|
| 2547 | + alt="<?php echo $interest_group[ 'id' ]; ?>" |
|
| 2548 | + data-attr-field-name="<?php echo htmlspecialchars( $interest_group[ 'title' ] ); ?>" |
|
| 2549 | + data-attr-field-type="<?php echo $interest_group[ 'type' ]; ?>" |
|
| 2550 | 2550 | data-attr-form-id="<?php echo $list_id; ?>" title="<?php _e( 'Already assigned to your form', 'yikes-inc-easy-mailchimp-extender' ); ?>" |
| 2551 | 2551 | disabled="disabled" |
| 2552 | 2552 | > |
| 2553 | - <?php echo stripslashes( $interest_group['title'] ); ?> |
|
| 2554 | - <small class="field-type-text"><?php echo $interest_group['type']; ?></small> |
|
| 2553 | + <?php echo stripslashes( $interest_group[ 'title' ] ); ?> |
|
| 2554 | + <small class="field-type-text"><?php echo $interest_group[ 'type' ]; ?></small> |
|
| 2555 | 2555 | </li> |
| 2556 | 2556 | <?php |
| 2557 | 2557 | } else {
|
| 2558 | 2558 | ?> |
| 2559 | 2559 | <li class="available-interest-group" |
| 2560 | - alt="<?php echo $interest_group['id']; ?>" |
|
| 2561 | - data-attr-field-name="<?php echo htmlspecialchars( $interest_group['title'] ); ?>" |
|
| 2562 | - data-attr-field-type="<?php echo $interest_group['type']; ?>" |
|
| 2560 | + alt="<?php echo $interest_group[ 'id' ]; ?>" |
|
| 2561 | + data-attr-field-name="<?php echo htmlspecialchars( $interest_group[ 'title' ] ); ?>" |
|
| 2562 | + data-attr-field-type="<?php echo $interest_group[ 'type' ]; ?>" |
|
| 2563 | 2563 | data-attr-form-id="<?php echo $list_id; ?>" |
| 2564 | 2564 | > |
| 2565 | - <?php echo stripslashes( $interest_group['title'] ); ?> |
|
| 2566 | - <small class="field-type-text"><?php echo $interest_group['type']; ?></small> |
|
| 2565 | + <?php echo stripslashes( $interest_group[ 'title' ] ); ?> |
|
| 2566 | + <small class="field-type-text"><?php echo $interest_group[ 'type' ]; ?></small> |
|
| 2567 | 2567 | </li> |
| 2568 | 2568 | <?php |
| 2569 | 2569 | } |
@@ -2585,15 +2585,15 @@ discard block |
||
| 2585 | 2585 | * - must clean up db tables , ensure what data is going in and what is needed... |
| 2586 | 2586 | */ |
| 2587 | 2587 | public function yikes_easy_mailchimp_create_form() {
|
| 2588 | - $nonce = $_REQUEST['nonce']; |
|
| 2588 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 2589 | 2589 | if ( ! wp_verify_nonce( $nonce, 'create_mailchimp_form' ) ) {
|
| 2590 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 2590 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 2591 | 2591 | } |
| 2592 | 2592 | |
| 2593 | 2593 | $result = $this->form_interface->create_form( array( |
| 2594 | - 'list_id' => sanitize_key( $_POST['associated-list'] ), |
|
| 2595 | - 'form_name' => stripslashes( $_POST['form-name'] ), |
|
| 2596 | - 'form_description' => stripslashes( $_POST['form-description'] ), |
|
| 2594 | + 'list_id' => sanitize_key( $_POST[ 'associated-list' ] ), |
|
| 2595 | + 'form_name' => stripslashes( $_POST[ 'form-name' ] ), |
|
| 2596 | + 'form_description' => stripslashes( $_POST[ 'form-description' ] ), |
|
| 2597 | 2597 | ) ); |
| 2598 | 2598 | |
| 2599 | 2599 | // if an error occurs during the form creation process |
@@ -2601,11 +2601,11 @@ discard block |
||
| 2601 | 2601 | // write it to the error log |
| 2602 | 2602 | // if the form was not created successfully |
| 2603 | 2603 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 2604 | - $error_logging->maybe_write_to_log( __( 'Error creating a new form', 'yikes-inc-easy-mailchimp-extender') , __( "Creating a new form" , 'yikes-inc-easy-mailchimp-extender' ) , __( "Forms" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 2604 | + $error_logging->maybe_write_to_log( __( 'Error creating a new form', 'yikes-inc-easy-mailchimp-extender' ), __( "Creating a new form", 'yikes-inc-easy-mailchimp-extender' ), __( "Forms", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 2605 | 2605 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&sql_error=' . urlencode( __( 'Error creating a new form', 'yikes-inc-easy-mailchimp-extender' ) ) ) ) ); |
| 2606 | 2606 | } else {
|
| 2607 | 2607 | // redirect the user to the new form edit page |
| 2608 | - wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $result) ) ); |
|
| 2608 | + wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $result ) ) ); |
|
| 2609 | 2609 | } |
| 2610 | 2610 | exit(); |
| 2611 | 2611 | } |
@@ -2618,11 +2618,11 @@ discard block |
||
| 2618 | 2618 | */ |
| 2619 | 2619 | public function yikes_easy_mailchimp_delete_form() {
|
| 2620 | 2620 | // grab & store our variables ( associated list & form name ) |
| 2621 | - $nonce = $_REQUEST['nonce']; |
|
| 2622 | - $post_id_to_delete = $_REQUEST['mailchimp-form']; |
|
| 2621 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 2622 | + $post_id_to_delete = $_REQUEST[ 'mailchimp-form' ]; |
|
| 2623 | 2623 | // verify our nonce |
| 2624 | - if ( ! wp_verify_nonce( $nonce, 'delete-mailchimp-form-'.$post_id_to_delete ) ) {
|
|
| 2625 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 2624 | + if ( ! wp_verify_nonce( $nonce, 'delete-mailchimp-form-' . $post_id_to_delete ) ) {
|
|
| 2625 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 2626 | 2626 | } |
| 2627 | 2627 | |
| 2628 | 2628 | $this->form_interface->delete_form( $post_id_to_delete ); |
@@ -2638,19 +2638,19 @@ discard block |
||
| 2638 | 2638 | */ |
| 2639 | 2639 | public function yikes_easy_mailchimp_duplicate_form() {
|
| 2640 | 2640 | // grab & store our variables ( associated list & form name ) |
| 2641 | - $nonce = $_REQUEST['nonce']; |
|
| 2642 | - $post_id_to_clone = $_REQUEST['mailchimp-form']; |
|
| 2641 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 2642 | + $post_id_to_clone = $_REQUEST[ 'mailchimp-form' ]; |
|
| 2643 | 2643 | // verify our nonce |
| 2644 | - if ( ! wp_verify_nonce( $nonce, 'duplicate-mailchimp-form-'.$post_id_to_clone ) ) {
|
|
| 2645 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 2644 | + if ( ! wp_verify_nonce( $nonce, 'duplicate-mailchimp-form-' . $post_id_to_clone ) ) {
|
|
| 2645 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 2646 | 2646 | } |
| 2647 | 2647 | |
| 2648 | 2648 | // Get the current form data. |
| 2649 | 2649 | $form_data = $this->form_interface->get_form( $post_id_to_clone ); |
| 2650 | 2650 | |
| 2651 | 2651 | // Update some of the data before duplication |
| 2652 | - $form_data['form_name'] .= ' - Copy - '; |
|
| 2653 | - $form_data['impressions'] = $form_data['submissions'] = 0; |
|
| 2652 | + $form_data[ 'form_name' ] .= ' - Copy - '; |
|
| 2653 | + $form_data[ 'impressions' ] = $form_data[ 'submissions' ] = 0; |
|
| 2654 | 2654 | |
| 2655 | 2655 | // Create the new form, and handle the result. |
| 2656 | 2656 | $result = $this->form_interface->create_form( $form_data ); |
@@ -2671,11 +2671,11 @@ discard block |
||
| 2671 | 2671 | */ |
| 2672 | 2672 | public function yikes_easy_mailchimp_reset_impression_stats() {
|
| 2673 | 2673 | // grab & store our variables ( associated list & form name ) |
| 2674 | - $nonce = $_REQUEST['nonce']; |
|
| 2675 | - $form_id_to_reset = $_REQUEST['mailchimp-form']; |
|
| 2674 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 2675 | + $form_id_to_reset = $_REQUEST[ 'mailchimp-form' ]; |
|
| 2676 | 2676 | // verify our nonce |
| 2677 | - if ( ! wp_verify_nonce( $nonce, 'reset-stats-mailchimp-form-'.$form_id_to_reset ) ) {
|
|
| 2678 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 2677 | + if ( ! wp_verify_nonce( $nonce, 'reset-stats-mailchimp-form-' . $form_id_to_reset ) ) {
|
|
| 2678 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 2679 | 2679 | } |
| 2680 | 2680 | |
| 2681 | 2681 | $result = $this->form_interface->update_form( |
@@ -2703,8 +2703,8 @@ discard block |
||
| 2703 | 2703 | */ |
| 2704 | 2704 | public function yikes_easy_mailchimp_update_form() {
|
| 2705 | 2705 | |
| 2706 | - $nonce = $_REQUEST['nonce']; |
|
| 2707 | - $form_id = $_REQUEST['id']; |
|
| 2706 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 2707 | + $form_id = $_REQUEST[ 'id' ]; |
|
| 2708 | 2708 | |
| 2709 | 2709 | // verify our nonce |
| 2710 | 2710 | if ( ! wp_verify_nonce( $nonce, 'update-mailchimp-form-' . $form_id ) ) {
|
@@ -2718,70 +2718,70 @@ discard block |
||
| 2718 | 2718 | } |
| 2719 | 2719 | |
| 2720 | 2720 | // Store our values! |
| 2721 | - $list_id = $_POST['associated-list']; |
|
| 2722 | - $form_name = stripslashes( $_POST['form-name'] ); |
|
| 2723 | - $form_description = sanitize_text_field( stripslashes( $_POST['form-description'] ) ); |
|
| 2724 | - $redirect_user_on_submit = $_POST['redirect-user-on-submission']; |
|
| 2725 | - $redirect_page = $_POST['redirect-user-to-selection']; |
|
| 2721 | + $list_id = $_POST[ 'associated-list' ]; |
|
| 2722 | + $form_name = stripslashes( $_POST[ 'form-name' ] ); |
|
| 2723 | + $form_description = sanitize_text_field( stripslashes( $_POST[ 'form-description' ] ) ); |
|
| 2724 | + $redirect_user_on_submit = $_POST[ 'redirect-user-on-submission' ]; |
|
| 2725 | + $redirect_page = $_POST[ 'redirect-user-to-selection' ]; |
|
| 2726 | 2726 | |
| 2727 | 2727 | // stripslashes_deep on save, to prevent foreign languages from added excessive backslashes |
| 2728 | - $assigned_fields = isset( $_POST['field'] ) ? stripslashes_deep( $_POST['field'] ): array(); |
|
| 2728 | + $assigned_fields = isset( $_POST[ 'field' ] ) ? stripslashes_deep( $_POST[ 'field' ] ) : array(); |
|
| 2729 | 2729 | |
| 2730 | 2730 | // setup our submission settings serialized array |
| 2731 | 2731 | $submission_settings = array( |
| 2732 | - 'ajax' => $_POST['form-ajax-submission'], |
|
| 2733 | - 'redirect_on_submission' => $_POST['redirect-user-on-submission'], |
|
| 2734 | - 'redirect_page' => $_POST['redirect-user-to-selection'], |
|
| 2735 | - 'custom_redirect_url' => esc_url( $_POST['custom-redirect-url'] ), |
|
| 2736 | - 'redirect_new_window' => $_POST['redirect_new_window'], |
|
| 2737 | - 'hide_form_post_signup' => $_POST['hide-form-post-signup'], |
|
| 2738 | - 'replace_interests' => $_POST['replace-interest-groups'], |
|
| 2732 | + 'ajax' => $_POST[ 'form-ajax-submission' ], |
|
| 2733 | + 'redirect_on_submission' => $_POST[ 'redirect-user-on-submission' ], |
|
| 2734 | + 'redirect_page' => $_POST[ 'redirect-user-to-selection' ], |
|
| 2735 | + 'custom_redirect_url' => esc_url( $_POST[ 'custom-redirect-url' ] ), |
|
| 2736 | + 'redirect_new_window' => $_POST[ 'redirect_new_window' ], |
|
| 2737 | + 'hide_form_post_signup' => $_POST[ 'hide-form-post-signup' ], |
|
| 2738 | + 'replace_interests' => $_POST[ 'replace-interest-groups' ], |
|
| 2739 | 2739 | ); |
| 2740 | 2740 | |
| 2741 | 2741 | // setup our opt-in settings serialized array |
| 2742 | 2742 | $optin_settings = array( |
| 2743 | - 'optin' => $_POST['single-double-optin'], |
|
| 2744 | - 'update_existing_user' => $_POST['update-existing-user'], |
|
| 2745 | - 'send_update_email' => $_POST['update-existing-email'], |
|
| 2743 | + 'optin' => $_POST[ 'single-double-optin' ], |
|
| 2744 | + 'update_existing_user' => $_POST[ 'update-existing-user' ], |
|
| 2745 | + 'send_update_email' => $_POST[ 'update-existing-email' ], |
|
| 2746 | 2746 | ); |
| 2747 | 2747 | |
| 2748 | 2748 | // Setup our error settings serialized array |
| 2749 | 2749 | $error_settings = array( |
| 2750 | - 'success' => trim( $_POST['yikes-easy-mc-success-message'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-success-message'] ) ) : '', |
|
| 2751 | - 'success-single-optin' => trim( $_POST['yikes-easy-mc-success-single-optin-message'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-success-single-optin-message'] ) ) : '', |
|
| 2752 | - 'success-resubscribed' => trim( $_POST['yikes-easy-mc-user-resubscribed-success-message'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-user-resubscribed-success-message'] ) ) : '', |
|
| 2753 | - 'general-error' => trim( $_POST['yikes-easy-mc-general-error-message'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-general-error-message'] ) ) : '', |
|
| 2754 | - 'already-subscribed' => trim( $_POST['yikes-easy-mc-user-subscribed-message'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-user-subscribed-message'] ) ) : '', |
|
| 2755 | - 'update-link' => trim( $_POST['yikes-easy-mc-user-update-link'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-user-update-link'] ) ) : '', |
|
| 2756 | - 'email-subject' => trim( $_POST['yikes-easy-mc-user-email-subject'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-user-email-subject'] ) ) : '', |
|
| 2757 | - 'email-body' => trim( $_POST['yikes-easy-mc-user-email-body'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-user-email-body'] ) ) : '', |
|
| 2758 | - 'update-email-success' => trim( $_POST['yikes-easy-mc-update-email-successful'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-update-email-successful'] ) ) : '', |
|
| 2759 | - 'update-email-failure' => trim( $_POST['yikes-easy-mc-update-email-failure'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-update-email-failure'] ) ) : '', |
|
| 2750 | + 'success' => trim( $_POST[ 'yikes-easy-mc-success-message' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-success-message' ] ) ) : '', |
|
| 2751 | + 'success-single-optin' => trim( $_POST[ 'yikes-easy-mc-success-single-optin-message' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-success-single-optin-message' ] ) ) : '', |
|
| 2752 | + 'success-resubscribed' => trim( $_POST[ 'yikes-easy-mc-user-resubscribed-success-message' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-user-resubscribed-success-message' ] ) ) : '', |
|
| 2753 | + 'general-error' => trim( $_POST[ 'yikes-easy-mc-general-error-message' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-general-error-message' ] ) ) : '', |
|
| 2754 | + 'already-subscribed' => trim( $_POST[ 'yikes-easy-mc-user-subscribed-message' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-user-subscribed-message' ] ) ) : '', |
|
| 2755 | + 'update-link' => trim( $_POST[ 'yikes-easy-mc-user-update-link' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-user-update-link' ] ) ) : '', |
|
| 2756 | + 'email-subject' => trim( $_POST[ 'yikes-easy-mc-user-email-subject' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-user-email-subject' ] ) ) : '', |
|
| 2757 | + 'email-body' => trim( $_POST[ 'yikes-easy-mc-user-email-body' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-user-email-body' ] ) ) : '', |
|
| 2758 | + 'update-email-success' => trim( $_POST[ 'yikes-easy-mc-update-email-successful' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-update-email-successful' ] ) ) : '', |
|
| 2759 | + 'update-email-failure' => trim( $_POST[ 'yikes-easy-mc-update-email-failure' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-update-email-failure' ] ) ) : '', |
|
| 2760 | 2760 | ); |
| 2761 | 2761 | |
| 2762 | 2762 | // Setup the new form settings array |
| 2763 | 2763 | // @since 6.0.3.8 |
| 2764 | 2764 | // To Do: Combine date & time so it's a single unix timestamp |
| 2765 | 2765 | $form_settings = array( |
| 2766 | - 'yikes-easy-mc-form-class-names' => trim( $_POST['yikes-easy-mc-form-class-names'] ), |
|
| 2767 | - 'yikes-easy-mc-inline-form' => $_POST['yikes-easy-mc-inline-form'][0], |
|
| 2768 | - 'yikes-easy-mc-submit-button-type' => $_POST['yikes-easy-mc-submit-button-type'][0], |
|
| 2769 | - 'yikes-easy-mc-submit-button-text' => trim( $_POST['yikes-easy-mc-submit-button-text'] ), |
|
| 2770 | - 'yikes-easy-mc-submit-button-image' => esc_url( trim( $_POST['yikes-easy-mc-submit-button-image'] ) ), |
|
| 2771 | - 'yikes-easy-mc-submit-button-classes' => trim( $_POST['yikes-easy-mc-submit-button-classes'] ), |
|
| 2772 | - 'yikes-easy-mc-form-schedule' => ( isset( $_POST['yikes-easy-mc-form-schedule'] ) ) ? '1' : '0', |
|
| 2773 | - 'yikes-easy-mc-form-restriction-start' => strtotime( $_POST['yikes-easy-mc-form-restriction-start-date'] . ' ' . $_POST['yikes-easy-mc-form-restriction-start-time'] ), |
|
| 2774 | - 'yikes-easy-mc-form-restriction-end' => strtotime( $_POST['yikes-easy-mc-form-restriction-end-date'] . ' ' . $_POST['yikes-easy-mc-form-restriction-end-time'] ), |
|
| 2775 | - 'yikes-easy-mc-form-restriction-pending-message' => trim( $_POST['yikes-easy-mc-form-restriction-pending-message'] ), |
|
| 2776 | - 'yikes-easy-mc-form-restriction-expired-message' => trim( $_POST['yikes-easy-mc-form-restriction-expired-message'] ), |
|
| 2777 | - 'yikes-easy-mc-form-login-required' => ( isset( $_POST['yikes-easy-mc-form-login-required'] ) ) ? '1' : '0', |
|
| 2778 | - 'yikes-easy-mc-form-restriction-login-message' => trim( $_POST['yikes-easy-mc-form-restriction-login-message'] ), |
|
| 2766 | + 'yikes-easy-mc-form-class-names' => trim( $_POST[ 'yikes-easy-mc-form-class-names' ] ), |
|
| 2767 | + 'yikes-easy-mc-inline-form' => $_POST[ 'yikes-easy-mc-inline-form' ][ 0 ], |
|
| 2768 | + 'yikes-easy-mc-submit-button-type' => $_POST[ 'yikes-easy-mc-submit-button-type' ][ 0 ], |
|
| 2769 | + 'yikes-easy-mc-submit-button-text' => trim( $_POST[ 'yikes-easy-mc-submit-button-text' ] ), |
|
| 2770 | + 'yikes-easy-mc-submit-button-image' => esc_url( trim( $_POST[ 'yikes-easy-mc-submit-button-image' ] ) ), |
|
| 2771 | + 'yikes-easy-mc-submit-button-classes' => trim( $_POST[ 'yikes-easy-mc-submit-button-classes' ] ), |
|
| 2772 | + 'yikes-easy-mc-form-schedule' => ( isset( $_POST[ 'yikes-easy-mc-form-schedule' ] ) ) ? '1' : '0', |
|
| 2773 | + 'yikes-easy-mc-form-restriction-start' => strtotime( $_POST[ 'yikes-easy-mc-form-restriction-start-date' ] . ' ' . $_POST[ 'yikes-easy-mc-form-restriction-start-time' ] ), |
|
| 2774 | + 'yikes-easy-mc-form-restriction-end' => strtotime( $_POST[ 'yikes-easy-mc-form-restriction-end-date' ] . ' ' . $_POST[ 'yikes-easy-mc-form-restriction-end-time' ] ), |
|
| 2775 | + 'yikes-easy-mc-form-restriction-pending-message' => trim( $_POST[ 'yikes-easy-mc-form-restriction-pending-message' ] ), |
|
| 2776 | + 'yikes-easy-mc-form-restriction-expired-message' => trim( $_POST[ 'yikes-easy-mc-form-restriction-expired-message' ] ), |
|
| 2777 | + 'yikes-easy-mc-form-login-required' => ( isset( $_POST[ 'yikes-easy-mc-form-login-required' ] ) ) ? '1' : '0', |
|
| 2778 | + 'yikes-easy-mc-form-restriction-login-message' => trim( $_POST[ 'yikes-easy-mc-form-restriction-login-message' ] ), |
|
| 2779 | 2779 | ); |
| 2780 | 2780 | |
| 2781 | 2781 | // additional custom fields (extensions / user defined fields) |
| 2782 | 2782 | $custom_fields = array(); |
| 2783 | - if ( isset( $_POST['custom-field'] ) ) {
|
|
| 2784 | - foreach ( $_POST['custom-field'] as $custom_field => $custom_value ) {
|
|
| 2783 | + if ( isset( $_POST[ 'custom-field' ] ) ) {
|
|
| 2784 | + foreach ( $_POST[ 'custom-field' ] as $custom_field => $custom_value ) {
|
|
| 2785 | 2785 | if ( is_array( $custom_value ) ) {
|
| 2786 | 2786 | $custom_fields[ $custom_field ] = array_filter( stripslashes_deep( $custom_value ) ); // array_filters to remove empty items (don't save them!) |
| 2787 | 2787 | } else {
|
@@ -2813,7 +2813,7 @@ discard block |
||
| 2813 | 2813 | $this->form_interface->update_form( $form_id, $form_updates ); |
| 2814 | 2814 | |
| 2815 | 2815 | /* Custom action hook which allows users to update specific options when a form is updated - used in add ons */ |
| 2816 | - do_action( 'yikes-mailchimp-save-form', $form_id, $custom_fields ); |
|
| 2816 | + do_action( 'yikes-mailchimp-save-form', $form_id, $custom_fields ); |
|
| 2817 | 2817 | |
| 2818 | 2818 | // redirect the user to the manage forms page, display confirmation |
| 2819 | 2819 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $form_id . '&updated-form=true' ) ) ); |
@@ -2824,11 +2824,11 @@ discard block |
||
| 2824 | 2824 | $email_body = '<p>' . __( 'Greetings,', 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
| 2825 | 2825 | |
| 2826 | 2826 | $email_body .= '<p>'; |
| 2827 | - $email_body .= __( 'A request has been made to update your MailChimp account profile information.', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 2828 | - $email_body .= __( ' To do so please use the following link: ', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 2829 | - $email_body .= '[link]'; |
|
| 2830 | - $email_body .= __( 'Update MailChimp Profile Info', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 2831 | - $email_body .= '[/link]'; |
|
| 2827 | + $email_body .= __( 'A request has been made to update your MailChimp account profile information.', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 2828 | + $email_body .= __( ' To do so please use the following link: ', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 2829 | + $email_body .= '[link]'; |
|
| 2830 | + $email_body .= __( 'Update MailChimp Profile Info', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 2831 | + $email_body .= '[/link]'; |
|
| 2832 | 2832 | $email_body .= '</p>'; |
| 2833 | 2833 | |
| 2834 | 2834 | $email_body .= '<p>' . __( 'If you did not request this update, please disregard this email.', 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
@@ -2844,13 +2844,13 @@ discard block |
||
| 2844 | 2844 | |
| 2845 | 2845 | /* Unsubscribe a given user from our list */ |
| 2846 | 2846 | public function yikes_easy_mailchimp_unsubscribe_user() {
|
| 2847 | - $nonce = $_REQUEST['nonce']; |
|
| 2848 | - $list_id = $_REQUEST['mailchimp-list']; |
|
| 2849 | - $email_id = $_REQUEST['email_id']; |
|
| 2847 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 2848 | + $list_id = $_REQUEST[ 'mailchimp-list' ]; |
|
| 2849 | + $email_id = $_REQUEST[ 'email_id' ]; |
|
| 2850 | 2850 | |
| 2851 | 2851 | // verify our nonce |
| 2852 | 2852 | if ( ! wp_verify_nonce( $nonce, 'unsubscribe-user-' . $email_id ) ) {
|
| 2853 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 2853 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 2854 | 2854 | } |
| 2855 | 2855 | |
| 2856 | 2856 | $response = yikes_get_mc_api_manager()->get_list_handler()->member_unsubscribe( $list_id, $email_id ); |
@@ -2869,21 +2869,21 @@ discard block |
||
| 2869 | 2869 | |
| 2870 | 2870 | public function yikes_easy_mailchimp_create_missing_error_log() {
|
| 2871 | 2871 | // grab our nonnce |
| 2872 | - $nonce = $_REQUEST['nonce']; |
|
| 2872 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 2873 | 2873 | // validate nonce |
| 2874 | - if ( !wp_verify_nonce( $nonce, 'create_error_log' ) ) {
|
|
| 2875 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 2874 | + if ( ! wp_verify_nonce( $nonce, 'create_error_log' ) ) {
|
|
| 2875 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 2876 | 2876 | } |
| 2877 | 2877 | // setup the path to the error log |
| 2878 | 2878 | $error_log = fopen( plugin_dir_path( __FILE__ ) . '../includes/error_log/yikes-easy-mailchimp-error-log.php', 'w' ); |
| 2879 | 2879 | try {
|
| 2880 | 2880 | // create the file |
| 2881 | - fwrite( $error_log , '' ); |
|
| 2881 | + fwrite( $error_log, '' ); |
|
| 2882 | 2882 | // close out |
| 2883 | 2883 | fclose( $error_log ); |
| 2884 | 2884 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings&error_log_created=true' ) ) ); |
| 2885 | 2885 | } catch ( Exception $e ) {
|
| 2886 | - wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings&error_log_created=false&error_message='.urlencode( $e->getMessage() ) ) ) ); |
|
| 2886 | + wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings&error_log_created=false&error_message=' . urlencode( $e->getMessage() ) ) ) ); |
|
| 2887 | 2887 | } |
| 2888 | 2888 | } |
| 2889 | 2889 | |
@@ -2894,9 +2894,9 @@ discard block |
||
| 2894 | 2894 | public function yikes_easy_mailchimp_clear_transient_data() {
|
| 2895 | 2895 | |
| 2896 | 2896 | // verify our nonce |
| 2897 | - $nonce = $_REQUEST['nonce']; |
|
| 2897 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 2898 | 2898 | if ( ! wp_verify_nonce( $nonce, 'clear-mc-transient-data' ) ) {
|
| 2899 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 2899 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 2900 | 2900 | } |
| 2901 | 2901 | |
| 2902 | 2902 | $this->delete_yikes_mailchimp_transients(); |
@@ -2905,10 +2905,10 @@ discard block |
||
| 2905 | 2905 | $referer = wp_get_referer(); |
| 2906 | 2906 | if ( $referer && ( strpos( $referer, 'yikes-inc-easy-mailchimp-settings' ) > 0 ) ) {
|
| 2907 | 2907 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=api-cache-settings&transient-cleared=true' ) ) ); |
| 2908 | - } elseif ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] === 'yikes-mailchimp-edit-form' && isset( $_REQUEST['id'] ) && ! empty( $_REQUEST['id'] ) ) {
|
|
| 2908 | + } elseif ( isset( $_REQUEST[ 'page' ] ) && $_REQUEST[ 'page' ] === 'yikes-mailchimp-edit-form' && isset( $_REQUEST[ 'id' ] ) && ! empty( $_REQUEST[ 'id' ] ) ) {
|
|
| 2909 | 2909 | |
| 2910 | 2910 | // else check if we were editing a form. |
| 2911 | - $id = filter_var( $_REQUEST['id'], FILTER_SANITIZE_NUMBER_INT ); |
|
| 2911 | + $id = filter_var( $_REQUEST[ 'id' ], FILTER_SANITIZE_NUMBER_INT ); |
|
| 2912 | 2912 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $id ) ) ); |
| 2913 | 2913 | } else {
|
| 2914 | 2914 | // else redirect to the manage forms page. |
@@ -2952,7 +2952,7 @@ discard block |
||
| 2952 | 2952 | */ |
| 2953 | 2953 | public function yikes_mailchimp_load_helper_class() {
|
| 2954 | 2954 | // check to see if it's already loaded up. |
| 2955 | - if ( !class_exists( 'Yikes_Inc_Easy_Mailchimp_Forms_Helper' ) ) {
|
|
| 2955 | + if ( ! class_exists( 'Yikes_Inc_Easy_Mailchimp_Forms_Helper' ) ) {
|
|
| 2956 | 2956 | // Include our main helper class file |
| 2957 | 2957 | include_once( YIKES_MC_PATH . 'admin/partials/helpers/init.php' ); |
| 2958 | 2958 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * @subpackage Yikes_Inc_Easy_Mailchimp_Forms/admin |
| 10 | 10 | * @author YIKES, Inc. <[email protected]> |
| 11 | 11 | */ |
| 12 | -class Yikes_Inc_Easy_Mailchimp_Forms_Admin {
|
|
| 12 | +class Yikes_Inc_Easy_Mailchimp_Forms_Admin { |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * The ID of this plugin. |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $yikes_inc_easy_mailchimp_extender, |
| 50 | 50 | $version, |
| 51 | 51 | Yikes_Inc_Easy_MailChimp_Extender_Form_Interface $form_interface |
| 52 | - ) {
|
|
| 52 | + ) { |
|
| 53 | 53 | $this->yikes_inc_easy_mailchimp_extender = $yikes_inc_easy_mailchimp_extender; |
| 54 | 54 | $this->version = $version; |
| 55 | 55 | $this->form_interface = $form_interface; |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @author Jeremy Pry |
| 62 | 62 | */ |
| 63 | - public function hooks() {
|
|
| 63 | + public function hooks() { |
|
| 64 | 64 | |
| 65 | 65 | // check for old plugin options and migrate if exist. |
| 66 | 66 | add_action( 'admin_menu', array( $this, 'register_admin_pages' ), 11 ); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | /***********************/ |
| 102 | 102 | /** Create A Form **/ |
| 103 | 103 | /**********************/ |
| 104 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-create-form' ) {
|
|
| 104 | + if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-create-form' ) { |
|
| 105 | 105 | |
| 106 | 106 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_create_form' ) ); |
| 107 | 107 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | /***********************/ |
| 111 | 111 | /** Delete A Form **/ |
| 112 | 112 | /**********************/ |
| 113 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-delete-form' ) {
|
|
| 113 | + if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-delete-form' ) { |
|
| 114 | 114 | |
| 115 | 115 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_delete_form' ) ); |
| 116 | 116 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | /**********************************/ |
| 120 | 120 | /** Duplicate/Clone A Form **/ |
| 121 | 121 | /********************************/ |
| 122 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-duplicate-form' ) {
|
|
| 122 | + if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-duplicate-form' ) { |
|
| 123 | 123 | |
| 124 | 124 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_duplicate_form' ) ); |
| 125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | /*************************************/ |
| 129 | 129 | /** Reset Form Impression Stats **/ |
| 130 | 130 | /***********************************/ |
| 131 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-reset-stats' ) {
|
|
| 131 | + if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-reset-stats' ) { |
|
| 132 | 132 | |
| 133 | 133 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_reset_impression_stats' ) ); |
| 134 | 134 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | /**********************************/ |
| 138 | 138 | /** Update A Form **/ |
| 139 | 139 | /********************************/ |
| 140 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-update-form' ) {
|
|
| 140 | + if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-update-form' ) { |
|
| 141 | 141 | |
| 142 | 142 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_update_form' ) ); |
| 143 | 143 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | /**************************************************/ |
| 147 | 147 | /** Clear Store MailChimp Transient Data **/ |
| 148 | 148 | /*************************************************/ |
| 149 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-clear-transient-data' ) {
|
|
| 149 | + if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-clear-transient-data' ) { |
|
| 150 | 150 | |
| 151 | 151 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_clear_transient_data' ) ); |
| 152 | 152 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | /*******************************************/ |
| 156 | 156 | /** Remove a user from a mailing list **/ |
| 157 | 157 | /*****************************************/ |
| 158 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-unsubscribe-user' ) {
|
|
| 158 | + if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-unsubscribe-user' ) { |
|
| 159 | 159 | |
| 160 | 160 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_unsubscribe_user' ) ); |
| 161 | 161 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | /*******************************************/ |
| 165 | 165 | /** Create misisng error log file **/ |
| 166 | 166 | /*****************************************/ |
| 167 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-create-error-log' ) {
|
|
| 167 | + if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-create-error-log' ) { |
|
| 168 | 168 | |
| 169 | 169 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_create_missing_error_log' ) ); |
| 170 | 170 | |
@@ -176,14 +176,14 @@ discard block |
||
| 176 | 176 | add_action( 'admin_head', array( $this, 'add_tinyMCE_buttons' ) ); |
| 177 | 177 | |
| 178 | 178 | // pass our lists data to tinyMCE button for use. |
| 179 | - foreach ( array( 'post.php', 'post-new.php' ) as $hook ) {
|
|
| 179 | + foreach ( array( 'post.php', 'post-new.php' ) as $hook ) { |
|
| 180 | 180 | |
| 181 | 181 | add_action( 'admin_enqueue_scripts', array( $this, 'tinymce_yikes_easy_mc' ) ); |
| 182 | 182 | |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | // display an admin notice for users on PHP < 5.3. |
| 186 | - if ( phpversion() < '5.3' ) {
|
|
| 186 | + if ( phpversion() < '5.3' ) { |
|
| 187 | 187 | add_action( "admin_notices", array( $this, 'display_php_warning' ), 999 ); |
| 188 | 188 | } |
| 189 | 189 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | /**************************************************/ |
| 197 | 197 | /** Clear MailChimp Error Log Data **/ |
| 198 | 198 | /*************************************************/ |
| 199 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-clear-error-log' ) {
|
|
| 199 | + if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-clear-error-log' ) { |
|
| 200 | 200 | |
| 201 | 201 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_clear_error_log' ) ); |
| 202 | 202 | |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | /*********************************************/ |
| 206 | 206 | /** Export MailChimp Opt-in Forms **/ |
| 207 | 207 | /*******************************************/ |
| 208 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-export-forms' ) {
|
|
| 208 | + if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-export-forms' ) { |
|
| 209 | 209 | |
| 210 | 210 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_export_forms' ) ); |
| 211 | 211 | |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | /*********************************************/ |
| 215 | 215 | /** Export Plugin Settings **/ |
| 216 | 216 | /*******************************************/ |
| 217 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-export-settings' ) {
|
|
| 217 | + if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-export-settings' ) { |
|
| 218 | 218 | |
| 219 | 219 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_export_plugin_settings' ) ); |
| 220 | 220 | |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | /*******************************************/ |
| 224 | 224 | /** Import Class Inclusion **/ |
| 225 | 225 | /*****************************************/ |
| 226 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-import-forms' ) {
|
|
| 226 | + if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-import-forms' ) { |
|
| 227 | 227 | |
| 228 | 228 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_import_forms' ) ); |
| 229 | 229 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | /*******************************************/ |
| 233 | 233 | /** Premium Support Request **/ |
| 234 | 234 | /*****************************************/ |
| 235 | - if ( isset( $_POST['submit-premium-support-request'] ) ) {
|
|
| 235 | + if ( isset( $_POST['submit-premium-support-request'] ) ) { |
|
| 236 | 236 | |
| 237 | 237 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_premium_support_request' ) ); |
| 238 | 238 | |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | /****************************************/ |
| 242 | 242 | /** Dismiss Options Migrations **/ |
| 243 | 243 | /****************************************/ |
| 244 | - if ( isset( $_REQUEST['dismiss_migration_nonce'] ) ) {
|
|
| 244 | + if ( isset( $_REQUEST['dismiss_migration_nonce'] ) ) { |
|
| 245 | 245 | |
| 246 | 246 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_dismiss_option_migrate' ) ); |
| 247 | 247 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | * @ param array $links Pre-existing plugin action links |
| 277 | 277 | * @ return array $links New array of plugin actions |
| 278 | 278 | */ |
| 279 | - public function easy_forms_plugin_action_links( $links ) {
|
|
| 279 | + public function easy_forms_plugin_action_links( $links ) { |
|
| 280 | 280 | $links[] = '<a href="'. esc_url( get_admin_url(null, 'admin.php?page=yikes-inc-easy-mailchimp-settings') ) .'">' . __( 'Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
| 281 | 281 | $links[] = '<a href="' . esc_url( 'http://www.yikesplugins.com?utm_source=plugins-page&utm_medium=plugin-row&utm_campaign=admin' ) . '" target="_blank">' . __( 'More plugins by YIKES, Inc.', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
| 282 | 282 | return $links; |
@@ -292,13 +292,13 @@ discard block |
||
| 292 | 292 | * |
| 293 | 293 | * @return string |
| 294 | 294 | */ |
| 295 | - public function yikes_easy_forms_admin_disclaimer( $footer_text ) {
|
|
| 295 | + public function yikes_easy_forms_admin_disclaimer( $footer_text ) { |
|
| 296 | 296 | $page = get_current_screen(); |
| 297 | 297 | $base = $page->base; |
| 298 | - if ( strpos( $base, 'yikes-inc-easy-mailchimp' ) !== false || strpos( $base, 'yikes-mailchimp' ) !== false ) {
|
|
| 298 | + if ( strpos( $base, 'yikes-inc-easy-mailchimp' ) !== false || strpos( $base, 'yikes-mailchimp' ) !== false ) { |
|
| 299 | 299 | $disclaimer_text = sprintf( '<em>' . __( 'Disclaimer: <strong>Easy Forms for MailChimp</strong> is in no way endorsed, affiliated or backed by MailChimp, or its parent company Rocket Science Group.', 'yikes-inc-easy-mailchimp-extender' ), '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="' . __( 'Thanks :)', 'yikes-inc-easy-mailchimp-extender' ) . '">', '</a></em>' ); |
| 300 | 300 | return $disclaimer_text; |
| 301 | - } else {
|
|
| 301 | + } else { |
|
| 302 | 302 | return $footer_text; |
| 303 | 303 | } |
| 304 | 304 | } |
@@ -310,32 +310,32 @@ discard block |
||
| 310 | 310 | * @since 6.0.0 |
| 311 | 311 | * @return parsed tag content |
| 312 | 312 | */ |
| 313 | - public function parse_mailchimp_default_tag( $default_tag ) {
|
|
| 314 | - if ( ! $default_tag || $default_tag == '' ) {
|
|
| 313 | + public function parse_mailchimp_default_tag( $default_tag ) { |
|
| 314 | + if ( ! $default_tag || $default_tag == '' ) { |
|
| 315 | 315 | return $default_tag; |
| 316 | 316 | } |
| 317 | 317 | global $post; |
| 318 | 318 | // page title. |
| 319 | - if ( $default_tag == '{page_title}' ) {
|
|
| 319 | + if ( $default_tag == '{page_title}' ) { |
|
| 320 | 320 | $default_tag = get_the_title( $post->ID ); |
| 321 | 321 | } |
| 322 | 322 | // page id. |
| 323 | - if ( $default_tag == '{page_id}' ) {
|
|
| 323 | + if ( $default_tag == '{page_id}' ) { |
|
| 324 | 324 | $default_tag = $post->ID; |
| 325 | 325 | } |
| 326 | 326 | // page url. |
| 327 | - if ( $default_tag == '{page_url}' ) {
|
|
| 327 | + if ( $default_tag == '{page_url}' ) { |
|
| 328 | 328 | $default_tag = get_permalink( $post->ID ); |
| 329 | 329 | } |
| 330 | 330 | // blog name. |
| 331 | - if ( $default_tag == '{blog_name}' ) {
|
|
| 331 | + if ( $default_tag == '{blog_name}' ) { |
|
| 332 | 332 | $default_tag = get_bloginfo( 'name' ); |
| 333 | 333 | } |
| 334 | 334 | // is user logged in. |
| 335 | - if ( $default_tag == '{user_logged_in}' ) {
|
|
| 336 | - if ( is_user_logged_in() ) {
|
|
| 335 | + if ( $default_tag == '{user_logged_in}' ) { |
|
| 336 | + if ( is_user_logged_in() ) { |
|
| 337 | 337 | $default_tag = 'Registered User'; |
| 338 | - } else {
|
|
| 338 | + } else { |
|
| 339 | 339 | $default_tag = 'Guest User'; |
| 340 | 340 | } |
| 341 | 341 | } |
@@ -349,21 +349,21 @@ discard block |
||
| 349 | 349 | * When a user clicks 'Clear Log' on the debug settings page, this funciton |
| 350 | 350 | * is used to clear the data out of our php file. |
| 351 | 351 | */ |
| 352 | - public function yikes_easy_mailchimp_clear_error_log() {
|
|
| 352 | + public function yikes_easy_mailchimp_clear_error_log() { |
|
| 353 | 353 | |
| 354 | 354 | // Get our error log class. |
| 355 | 355 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 356 | 356 | |
| 357 | 357 | // file put contents $returned error + other data. |
| 358 | - if ( file_exists( $error_logging->error_log_file_path ) ) {
|
|
| 358 | + if ( file_exists( $error_logging->error_log_file_path ) ) { |
|
| 359 | 359 | |
| 360 | 360 | $clear_log = file_put_contents( $error_logging->error_log_file_path, '' ); |
| 361 | 361 | |
| 362 | - if ( $clear_log === false ) {
|
|
| 362 | + if ( $clear_log === false ) { |
|
| 363 | 363 | |
| 364 | 364 | // redirect the user to the manage forms page, display error message. |
| 365 | 365 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings&error-log-cleared=false' ) ) ); |
| 366 | - } else {
|
|
| 366 | + } else { |
|
| 367 | 367 | |
| 368 | 368 | // redirect the user to the manage forms page, display confirmation. |
| 369 | 369 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings&error-log-cleared=true' ) ) ); |
@@ -377,13 +377,13 @@ discard block |
||
| 377 | 377 | * @since 6.0.0 |
| 378 | 378 | * @return CSV export file |
| 379 | 379 | */ |
| 380 | - public function yikes_easy_mailchimp_export_forms() {
|
|
| 380 | + public function yikes_easy_mailchimp_export_forms() { |
|
| 381 | 381 | // grab our nonce. |
| 382 | 382 | $nonce = $_REQUEST['nonce']; |
| 383 | 383 | // grab the forms. |
| 384 | 384 | $forms = isset( $_REQUEST['export_forms'] ) ? $_REQUEST['export_forms'] : array(); |
| 385 | 385 | // validate nonce. |
| 386 | - if ( ! wp_verify_nonce( $nonce, 'export-forms' ) ) {
|
|
| 386 | + if ( ! wp_verify_nonce( $nonce, 'export-forms' ) ) { |
|
| 387 | 387 | wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
| 388 | 388 | } |
| 389 | 389 | |
@@ -401,11 +401,11 @@ discard block |
||
| 401 | 401 | * @since 6.0.0 |
| 402 | 402 | * @return CSV export file |
| 403 | 403 | */ |
| 404 | - public function yikes_easy_mailchimp_export_plugin_settings() {
|
|
| 404 | + public function yikes_easy_mailchimp_export_plugin_settings() { |
|
| 405 | 405 | // grab our nonce |
| 406 | 406 | $nonce = $_REQUEST['nonce']; |
| 407 | 407 | // validate nonce. |
| 408 | - if ( ! wp_verify_nonce( $nonce, 'export-settings' ) ) {
|
|
| 408 | + if ( ! wp_verify_nonce( $nonce, 'export-settings' ) ) { |
|
| 409 | 409 | wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
| 410 | 410 | } |
| 411 | 411 | |
@@ -421,15 +421,15 @@ discard block |
||
| 421 | 421 | * Custom import function to import all or specific forms |
| 422 | 422 | * @since 6.0.0 |
| 423 | 423 | */ |
| 424 | - public function yikes_easy_mailchimp_import_forms() {
|
|
| 424 | + public function yikes_easy_mailchimp_import_forms() { |
|
| 425 | 425 | // grab our nonce. |
| 426 | 426 | $nonce = $_REQUEST['nonce']; |
| 427 | 427 | // validate nonce. |
| 428 | - if ( ! wp_verify_nonce( $nonce, 'import-forms' ) ) {
|
|
| 428 | + if ( ! wp_verify_nonce( $nonce, 'import-forms' ) ) { |
|
| 429 | 429 | wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
| 430 | 430 | } |
| 431 | 431 | // include the export class. |
| 432 | - if ( ! class_exists( 'Yikes_Inc_Easy_MailChimp_Import_Class' ) ) {
|
|
| 432 | + if ( ! class_exists( 'Yikes_Inc_Easy_MailChimp_Import_Class' ) ) { |
|
| 433 | 433 | include_once( YIKES_MC_PATH . 'includes/import-export/yikes-easy-mailchimp-import.class.php' ); |
| 434 | 434 | } |
| 435 | 435 | // run the import function. |
@@ -445,9 +445,9 @@ discard block |
||
| 445 | 445 | * Premium Support Request |
| 446 | 446 | * @since 6.0.0 |
| 447 | 447 | */ |
| 448 | - public function yikes_easy_mailchimp_premium_support_request() {
|
|
| 448 | + public function yikes_easy_mailchimp_premium_support_request() { |
|
| 449 | 449 | |
| 450 | - if ( isset( $_POST['action'] ) && $_POST['action'] != 'yikes-support-request' ) {
|
|
| 450 | + if ( isset( $_POST['action'] ) && $_POST['action'] != 'yikes-support-request' ) { |
|
| 451 | 451 | return __( 'We encountered an error. Please contact the YIKES Inc. support team.', 'yikes-inc-easy-mailchimp-extender' ); |
| 452 | 452 | } |
| 453 | 453 | |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | ) ); |
| 484 | 484 | |
| 485 | 485 | // Catch the error. |
| 486 | - if ( is_wp_error( $response ) ) {
|
|
| 486 | + if ( is_wp_error( $response ) ) { |
|
| 487 | 487 | wp_send_json_error( $response->getMessage() ); |
| 488 | 488 | } |
| 489 | 489 | |
@@ -491,9 +491,9 @@ discard block |
||
| 491 | 491 | $response_body = json_decode( wp_remote_retrieve_body( $response ) ); |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | - public function get_premium_license( $plugin_slug ) {
|
|
| 494 | + public function get_premium_license( $plugin_slug ) { |
|
| 495 | 495 | |
| 496 | - switch( $plugin_slug ) {
|
|
| 496 | + switch( $plugin_slug ) { |
|
| 497 | 497 | |
| 498 | 498 | case 'form-customizer': |
| 499 | 499 | return defined( 'YIKES_CUSTOMIZER_EDD_ITEM_ID' ) ? YIKES_CUSTOMIZER_EDD_ITEM_ID : ''; |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | * |
| 515 | 515 | * @since 6.0.0 |
| 516 | 516 | **/ |
| 517 | - public function yikes_easy_mailchimp_dismiss_option_migrate() {
|
|
| 517 | + public function yikes_easy_mailchimp_dismiss_option_migrate() { |
|
| 518 | 518 | // delete the options and allow the user to manually update things. |
| 519 | 519 | |
| 520 | 520 | // Verify the NONCE is valid. |
@@ -532,8 +532,8 @@ discard block |
||
| 532 | 532 | * |
| 533 | 533 | * @since 6.0.0 |
| 534 | 534 | */ |
| 535 | - public function load_error_logging_class() {
|
|
| 536 | - if ( get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
|
|
| 535 | + public function load_error_logging_class() { |
|
| 536 | + if ( get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
| 537 | 537 | // if error logging is enabled we should include our error logging class |
| 538 | 538 | /* Generate oure error logging table */ |
| 539 | 539 | require_once YIKES_MC_PATH . '/includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
@@ -548,21 +548,21 @@ discard block |
||
| 548 | 548 | * |
| 549 | 549 | * @since v6.0.0 |
| 550 | 550 | */ |
| 551 | - public function yikes_easy_mailchimp_check_installation_date() {
|
|
| 551 | + public function yikes_easy_mailchimp_check_installation_date() { |
|
| 552 | 552 | |
| 553 | 553 | // add a new option to store the plugin activation date/time. |
| 554 | 554 | // @since v6.0.0. |
| 555 | 555 | // this is used to notify the user that they should review after 2 weeks. |
| 556 | - if ( !get_option( 'yikes_easy_mailchimp_activation_date' ) ) {
|
|
| 556 | + if ( !get_option( 'yikes_easy_mailchimp_activation_date' ) ) { |
|
| 557 | 557 | add_option( 'yikes_easy_mailchimp_activation_date', strtotime( "now" ) ); |
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | $stop_bugging_me = get_option( 'yikes_easy_mailchimp_review_stop_bugging_me' ); |
| 561 | 561 | |
| 562 | - if ( ! $stop_bugging_me ) {
|
|
| 562 | + if ( ! $stop_bugging_me ) { |
|
| 563 | 563 | $install_date = get_option( 'yikes_easy_mailchimp_activation_date' ); |
| 564 | 564 | $past_date = strtotime( '-14 days' ); |
| 565 | - if ( $past_date >= $install_date && current_user_can( 'install_plugins' ) ) {
|
|
| 565 | + if ( $past_date >= $install_date && current_user_can( 'install_plugins' ) ) { |
|
| 566 | 566 | add_action( 'admin_notices', array( $this , 'yikes_easy_mailchimp_display_review_us_notice' ) ); |
| 567 | 567 | } |
| 568 | 568 | } |
@@ -574,9 +574,9 @@ discard block |
||
| 574 | 574 | asking for a review, and for user feedback |
| 575 | 575 | @since v6.0.0 |
| 576 | 576 | */ |
| 577 | - public function yikes_easy_mailchimp_display_review_us_notice() {
|
|
| 577 | + public function yikes_easy_mailchimp_display_review_us_notice() { |
|
| 578 | 578 | /* Lets only display our admin notice on YT4WP pages to not annoy the hell out of people :) */ |
| 579 | - if ( in_array( get_current_screen()->base , array( 'dashboard', 'post', 'edit' ) ) || strpos( get_current_screen()->base ,'yikes-inc-easy-mailchimp') !== false ) {
|
|
| 579 | + if ( in_array( get_current_screen()->base , array( 'dashboard', 'post', 'edit' ) ) || strpos( get_current_screen()->base ,'yikes-inc-easy-mailchimp') !== false ) { |
|
| 580 | 580 | |
| 581 | 581 | // The URL of the page the user is currently on |
| 582 | 582 | $current_uri = isset( $_SERVER['REQUEST_URI'] ) && ! empty( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : false; |
@@ -619,8 +619,8 @@ discard block |
||
| 619 | 619 | Remove the Review us notification when user clicks 'Dismiss' |
| 620 | 620 | @since v3.1.1 |
| 621 | 621 | */ |
| 622 | - public function yikes_easy_mailchimp_stop_bugging_me() {
|
|
| 623 | - if ( isset( $_GET['yikes_easy_mc_icons_nobug'] ) && (int) filter_var( $_GET['yikes_easy_mc_icons_nobug'], FILTER_SANITIZE_NUMBER_INT ) === 1 ) {
|
|
| 622 | + public function yikes_easy_mailchimp_stop_bugging_me() { |
|
| 623 | + if ( isset( $_GET['yikes_easy_mc_icons_nobug'] ) && (int) filter_var( $_GET['yikes_easy_mc_icons_nobug'], FILTER_SANITIZE_NUMBER_INT ) === 1 ) { |
|
| 624 | 624 | add_option( 'yikes_easy_mailchimp_review_stop_bugging_me', true ); |
| 625 | 625 | } |
| 626 | 626 | } |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | /* End Two Week Notification */ |
| 629 | 629 | |
| 630 | 630 | /* Display a warning users who are using PHP < 5.3 */ |
| 631 | - public function display_php_warning() {
|
|
| 631 | + public function display_php_warning() { |
|
| 632 | 632 | $message = __( 'Easy Forms for MailChimp requires a minimum of PHP 5.3. The plugin will not function properly until you update. Please reach out to your host provider for assistance.', 'yikes-inc-easy-mailchimp-extender' ); |
| 633 | 633 | echo "<div class='error'> <p><span class='dashicons dashicons-no-alt' style='color:rgb(231, 98, 98)'></span> $message</p></div>"; |
| 634 | 634 | } |
@@ -638,10 +638,10 @@ discard block |
||
| 638 | 638 | * TinyMCE Functions |
| 639 | 639 | */ |
| 640 | 640 | // load our button and pass in the JS form data variable. |
| 641 | - public function add_tinyMCE_buttons() {
|
|
| 641 | + public function add_tinyMCE_buttons() { |
|
| 642 | 642 | global $typenow; |
| 643 | 643 | // only on Post Type: post and page. |
| 644 | - if ( ! in_array( $typenow, array( 'post', 'page' ) ) ) {
|
|
| 644 | + if ( ! in_array( $typenow, array( 'post', 'page' ) ) ) { |
|
| 645 | 645 | return; |
| 646 | 646 | } |
| 647 | 647 | add_filter( 'mce_buttons', array( $this, 'yks_mc_add_tinymce_button' ) ); |
@@ -649,14 +649,14 @@ discard block |
||
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | // Add the button key for address via JS. |
| 652 | - public function yks_mc_add_tinymce_button( $buttons ) {
|
|
| 652 | + public function yks_mc_add_tinymce_button( $buttons ) { |
|
| 653 | 653 | array_push( $buttons, 'yks_mc_tinymce_button_key' ); |
| 654 | 654 | // Print all buttons. |
| 655 | 655 | return $buttons; |
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | // inlcude the js for tinymce. |
| 659 | - public function yks_mc_add_tinymce_plugin( $plugin_array ) {
|
|
| 659 | + public function yks_mc_add_tinymce_plugin( $plugin_array ) { |
|
| 660 | 660 | |
| 661 | 661 | $plugin_array['yks_mc_tinymce_button'] = plugins_url( '/js/min/yikes-inc-easy-mailchimp-tinymce-button.min.js', __FILE__ ); |
| 662 | 662 | |
@@ -668,23 +668,23 @@ discard block |
||
| 668 | 668 | * Pass our imported list data, to the JS file |
| 669 | 669 | * to build the drop down list in the modal |
| 670 | 670 | */ |
| 671 | - public function tinymce_yikes_easy_mc() {
|
|
| 671 | + public function tinymce_yikes_easy_mc() { |
|
| 672 | 672 | // check capabilities. |
| 673 | - if ( ! current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
|
|
| 673 | + if ( ! current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) { |
|
| 674 | 674 | return; |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | $list_data = $this->form_interface->get_all_forms(); |
| 678 | 678 | $lists = array(); |
| 679 | - if ( ! empty( $list_data ) ) {
|
|
| 679 | + if ( ! empty( $list_data ) ) { |
|
| 680 | 680 | // build an array to pass to our javascript. |
| 681 | - foreach ( $list_data as $id => $form ) {
|
|
| 681 | + foreach ( $list_data as $id => $form ) { |
|
| 682 | 682 | $lists[] = array( |
| 683 | 683 | 'text' => urlencode( $form['form_name'] ), |
| 684 | 684 | 'value' => $id, |
| 685 | 685 | ); |
| 686 | 686 | } |
| 687 | - } else {
|
|
| 687 | + } else { |
|
| 688 | 688 | $lists[0] = array( |
| 689 | 689 | 'text' => __( 'Please Import Some MailChimp Lists', 'yikes-inc-easy-mailchimp-extender' ), |
| 690 | 690 | 'value' => '-', |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | /** |
| 710 | 710 | * Fix the MailChimp icon spacing in the admin menu. |
| 711 | 711 | */ |
| 712 | - public function fix_menu_icon_spacing() {
|
|
| 712 | + public function fix_menu_icon_spacing() { |
|
| 713 | 713 | ?> |
| 714 | 714 | <style> |
| 715 | 715 | a[href="admin.php?page=yikes-inc-easy-mailchimp"] .wp-menu-image img {
|
@@ -724,7 +724,7 @@ discard block |
||
| 724 | 724 | * |
| 725 | 725 | * @since 6.0.0 |
| 726 | 726 | */ |
| 727 | - public function enqueue_styles() {
|
|
| 727 | + public function enqueue_styles() { |
|
| 728 | 728 | /** |
| 729 | 729 | * Enqueue our global dashboard styles. |
| 730 | 730 | */ |
@@ -733,14 +733,14 @@ discard block |
||
| 733 | 733 | /* |
| 734 | 734 | * Enqueue Add-ons styles. |
| 735 | 735 | */ |
| 736 | - if ( get_current_screen()->base == 'easy-forms_page_yikes-inc-easy-mailchimp-addons' ) {
|
|
| 736 | + if ( get_current_screen()->base == 'easy-forms_page_yikes-inc-easy-mailchimp-addons' ) { |
|
| 737 | 737 | wp_enqueue_style( 'yikes-inc-easy-mailchimp-extender-addons-styles', plugin_dir_url( __FILE__ ) . 'css/yikes-inc-easy-mailchimp-extender-addons.min.css', array(), $this->version, 'all' ); |
| 738 | 738 | } |
| 739 | 739 | |
| 740 | 740 | /* |
| 741 | 741 | * Enqueue Subscriber Profile Flags. |
| 742 | 742 | */ |
| 743 | - if ( get_current_screen()->base == 'admin_page_yikes-mailchimp-view-user' ) {
|
|
| 743 | + if ( get_current_screen()->base == 'admin_page_yikes-mailchimp-view-user' ) { |
|
| 744 | 744 | wp_enqueue_style( 'yikes-inc-easy-mailchimp-extender-subscriber-flags', plugin_dir_url( __FILE__ ) . 'css/flag-icon.min.css', array(), $this->version, 'all' ); |
| 745 | 745 | } |
| 746 | 746 | } |
@@ -749,7 +749,7 @@ discard block |
||
| 749 | 749 | * |
| 750 | 750 | * @since 6.0.0 |
| 751 | 751 | */ |
| 752 | - public function enqueue_scripts() {
|
|
| 752 | + public function enqueue_scripts() { |
|
| 753 | 753 | wp_enqueue_script( 'yikes-inc-easy-mailchimp-extender-admin-js', plugin_dir_url( __FILE__ ) . 'js/min/yikes-inc-easy-mailchimp-extender-admin.min.js', array( 'jquery', 'jquery-ui-sortable' ), $this->version, false ); |
| 754 | 754 | |
| 755 | 755 | $localized_data = array( |
@@ -764,7 +764,7 @@ discard block |
||
| 764 | 764 | |
| 765 | 765 | // Enqueue required scripts for the form editor |
| 766 | 766 | $screen = get_current_screen(); |
| 767 | - if ( ! isset( $screen->base ) || 'admin_page_yikes-mailchimp-edit-form' !== $screen->base ) {
|
|
| 767 | + if ( ! isset( $screen->base ) || 'admin_page_yikes-mailchimp-edit-form' !== $screen->base ) { |
|
| 768 | 768 | return; |
| 769 | 769 | } |
| 770 | 770 | |
@@ -810,12 +810,12 @@ discard block |
||
| 810 | 810 | /** |
| 811 | 811 | * Convert the php date format string to a js date format |
| 812 | 812 | */ |
| 813 | - public function yikes_jQuery_datepicker_date_format_php_to_js( $sFormat, $type ) {
|
|
| 814 | - switch ( $type ) {
|
|
| 813 | + public function yikes_jQuery_datepicker_date_format_php_to_js( $sFormat, $type ) { |
|
| 814 | + switch ( $type ) { |
|
| 815 | 815 | default: |
| 816 | 816 | case 'date': |
| 817 | 817 | // Standard Date Fields |
| 818 | - switch ( $sFormat ) {
|
|
| 818 | + switch ( $sFormat ) { |
|
| 819 | 819 | //Predefined WP date formats |
| 820 | 820 | case 'F j, Y': |
| 821 | 821 | case 'j F Y': |
@@ -838,7 +838,7 @@ discard block |
||
| 838 | 838 | break; |
| 839 | 839 | // Birthday Fields |
| 840 | 840 | case 'birthday': |
| 841 | - switch ( $sFormat ) {
|
|
| 841 | + switch ( $sFormat ) { |
|
| 842 | 842 | //Predefined WP date formats |
| 843 | 843 | case 'F j, Y': |
| 844 | 844 | case 'j F Y': |
@@ -867,8 +867,8 @@ discard block |
||
| 867 | 867 | /** |
| 868 | 868 | * Convert the php date format string to a js date format |
| 869 | 869 | */ |
| 870 | - public function yikes_jQuery_datepicker_date_format( $site_option ) {
|
|
| 871 | - switch( $site_option ) {
|
|
| 870 | + public function yikes_jQuery_datepicker_date_format( $site_option ) { |
|
| 871 | + switch( $site_option ) { |
|
| 872 | 872 | //Predefined WP date formats |
| 873 | 873 | default: |
| 874 | 874 | case 'F j, Y': |
@@ -888,7 +888,7 @@ discard block |
||
| 888 | 888 | * Register our admin pages |
| 889 | 889 | * used to display data back to the user |
| 890 | 890 | **/ |
| 891 | - public function register_admin_pages() {
|
|
| 891 | + public function register_admin_pages() { |
|
| 892 | 892 | |
| 893 | 893 | /* Top Level Menu 'Easy MailChimp' */ |
| 894 | 894 | add_menu_page( |
@@ -1011,7 +1011,7 @@ discard block |
||
| 1011 | 1011 | * when they click 'Go Pro' in the admin menu |
| 1012 | 1012 | * to do: populate with sales URL |
| 1013 | 1013 | */ |
| 1014 | - public function generateAddOnsPage() {
|
|
| 1014 | + public function generateAddOnsPage() { |
|
| 1015 | 1015 | require_once YIKES_MC_PATH . 'admin/partials/menu/add-ons.php'; // include our add-ons page |
| 1016 | 1016 | } |
| 1017 | 1017 | |
@@ -1020,7 +1020,7 @@ discard block |
||
| 1020 | 1020 | * |
| 1021 | 1021 | * @since 1.0.0 |
| 1022 | 1022 | */ |
| 1023 | - function generateManageFormsPage() {
|
|
| 1023 | + function generateManageFormsPage() { |
|
| 1024 | 1024 | require_once YIKES_MC_PATH . 'admin/partials/menu/manage-forms.php'; // include our manage forms page |
| 1025 | 1025 | } |
| 1026 | 1026 | |
@@ -1029,7 +1029,7 @@ discard block |
||
| 1029 | 1029 | * |
| 1030 | 1030 | * @since 1.0.0 |
| 1031 | 1031 | */ |
| 1032 | - function generateManageListsPage() {
|
|
| 1032 | + function generateManageListsPage() { |
|
| 1033 | 1033 | require_once YIKES_MC_PATH . 'admin/partials/menu/manage-lists.php'; // include our lists page |
| 1034 | 1034 | } |
| 1035 | 1035 | |
@@ -1038,7 +1038,7 @@ discard block |
||
| 1038 | 1038 | * |
| 1039 | 1039 | * @since 1.0.0 |
| 1040 | 1040 | */ |
| 1041 | - function generateSupportPage() {
|
|
| 1041 | + function generateSupportPage() { |
|
| 1042 | 1042 | |
| 1043 | 1043 | wp_enqueue_script( 'yikes-inc-easy-mailchimp-extender-support-scripts', plugin_dir_url( __FILE__ ) . 'js/support.js', array( 'jquery' ), $this->version, false ); |
| 1044 | 1044 | require_once YIKES_MC_PATH . 'admin/partials/menu/support.php'; |
@@ -1049,7 +1049,7 @@ discard block |
||
| 1049 | 1049 | * |
| 1050 | 1050 | * @since 1.0.0 |
| 1051 | 1051 | */ |
| 1052 | - function generateEditFormPage() {
|
|
| 1052 | + function generateEditFormPage() { |
|
| 1053 | 1053 | require_once YIKES_MC_PATH . 'admin/partials/edit-form.php'; // include our options page |
| 1054 | 1054 | } |
| 1055 | 1055 | |
@@ -1058,7 +1058,7 @@ discard block |
||
| 1058 | 1058 | * |
| 1059 | 1059 | * @since 1.0.0 |
| 1060 | 1060 | */ |
| 1061 | - function generateViewListPage() {
|
|
| 1061 | + function generateViewListPage() { |
|
| 1062 | 1062 | require_once YIKES_MC_PATH . 'admin/partials/view-list.php'; // include our options page |
| 1063 | 1063 | } |
| 1064 | 1064 | |
@@ -1067,7 +1067,7 @@ discard block |
||
| 1067 | 1067 | * |
| 1068 | 1068 | * @since 1.0.0 |
| 1069 | 1069 | */ |
| 1070 | - function generateViewUserPage() {
|
|
| 1070 | + function generateViewUserPage() { |
|
| 1071 | 1071 | require_once YIKES_MC_PATH . 'admin/partials/view-user.php'; // include our options page |
| 1072 | 1072 | } |
| 1073 | 1073 | |
@@ -1076,7 +1076,7 @@ discard block |
||
| 1076 | 1076 | * |
| 1077 | 1077 | * @since v.5.4 |
| 1078 | 1078 | **/ |
| 1079 | - function yikes_easy_mc_settings_init() {
|
|
| 1079 | + function yikes_easy_mc_settings_init() { |
|
| 1080 | 1080 | |
| 1081 | 1081 | /* Register General Settings Section */ |
| 1082 | 1082 | |
@@ -1196,27 +1196,27 @@ discard block |
||
| 1196 | 1196 | * Options Sanitization & Validation |
| 1197 | 1197 | * @since complete re-write |
| 1198 | 1198 | **/ |
| 1199 | - function yikes_mc_validate_api_key( $input ) {
|
|
| 1200 | - if ( $input === '' ) {
|
|
| 1199 | + function yikes_mc_validate_api_key( $input ) { |
|
| 1200 | + if ( $input === '' ) { |
|
| 1201 | 1201 | update_option( 'yikes-mc-api-validation', 'invalid_api_key' ); |
| 1202 | 1202 | return ''; |
| 1203 | 1203 | } |
| 1204 | 1204 | $api_key = strip_tags ( trim( $input ) ); |
| 1205 | 1205 | $dash_position = strpos( trim( $input ), '-' ); |
| 1206 | - if ( $dash_position !== false ) {
|
|
| 1206 | + if ( $dash_position !== false ) { |
|
| 1207 | 1207 | $manager = new Yikes_Inc_Easy_MailChimp_API_Manager( $api_key ); |
| 1208 | - } else {
|
|
| 1208 | + } else { |
|
| 1209 | 1209 | update_option( 'yikes-mc-api-invalid-key-response', __( 'Your API key appears to be invalid.', 'yikes-inc-easy-mailchimp-extender' ) ); |
| 1210 | 1210 | update_option( 'yikes-mc-api-validation', 'invalid_api_key' ); |
| 1211 | 1211 | return $api_key; |
| 1212 | 1212 | } |
| 1213 | 1213 | |
| 1214 | 1214 | $response = $manager->get_account_handler()->get_account( false ); |
| 1215 | - if ( ! is_wp_error( $response ) ) {
|
|
| 1215 | + if ( ! is_wp_error( $response ) ) { |
|
| 1216 | 1216 | update_option( 'yikes-mc-api-validation', 'valid_api_key' ); |
| 1217 | 1217 | // Clear the API key transient data |
| 1218 | 1218 | $this->delete_yikes_mailchimp_transients(); |
| 1219 | - } else {
|
|
| 1219 | + } else { |
|
| 1220 | 1220 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 1221 | 1221 | $error_logging->yikes_easy_mailchimp_write_to_error_log( $response->get_error_message() , __( "Connecting to MailChimp" , 'yikes-inc-easy-mailchimp-extender' ) , __( "Settings Page/General Settings" , 'yikes-inc-easy-mailchimp-extender' ) ); |
| 1222 | 1222 | update_option( 'yikes-mc-api-invalid-key-response', $response->get_error_message() ); |
@@ -1231,7 +1231,7 @@ discard block |
||
| 1231 | 1231 | * |
| 1232 | 1232 | * @since 1.0.0 |
| 1233 | 1233 | */ |
| 1234 | - function generatePageOptions() {
|
|
| 1234 | + function generatePageOptions() { |
|
| 1235 | 1235 | require_once YIKES_MC_PATH . 'admin/partials/menu/options.php'; // include our options page |
| 1236 | 1236 | } |
| 1237 | 1237 | |
@@ -1241,15 +1241,15 @@ discard block |
||
| 1241 | 1241 | * to form fields. (input, dropdowns, buttons etc.) |
| 1242 | 1242 | * @since v5.5 re-write |
| 1243 | 1243 | **/ |
| 1244 | - public function is_user_mc_api_valid_form( $echo = true ) {
|
|
| 1245 | - if ( $echo == true ) {
|
|
| 1246 | - if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) {
|
|
| 1244 | + public function is_user_mc_api_valid_form( $echo = true ) { |
|
| 1245 | + if ( $echo == true ) { |
|
| 1246 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) { |
|
| 1247 | 1247 | echo 'disabled="disabled"'; |
| 1248 | 1248 | } |
| 1249 | - } else {
|
|
| 1250 | - if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) {
|
|
| 1249 | + } else { |
|
| 1250 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) { |
|
| 1251 | 1251 | return false; |
| 1252 | - } else {
|
|
| 1252 | + } else { |
|
| 1253 | 1253 | return true; |
| 1254 | 1254 | } |
| 1255 | 1255 | } |
@@ -1264,11 +1264,11 @@ discard block |
||
| 1264 | 1264 | * @param string $yikes_inc_easy_mailchimp_extender The name of this plugin. |
| 1265 | 1265 | * @param string $version The version of this plugin. |
| 1266 | 1266 | */ |
| 1267 | - public function check_for_old_yks_mc_options() {
|
|
| 1267 | + public function check_for_old_yks_mc_options() { |
|
| 1268 | 1268 | $old_plugin_options = get_option( 'ykseme_storage' ); |
| 1269 | 1269 | // only perform options migrations if the site is not a multi-site setup |
| 1270 | - if ( !is_multisite() ) {
|
|
| 1271 | - if ( apply_filters( 'yikes_mc_old_options_filter', $old_plugin_options ) ) {
|
|
| 1270 | + if ( !is_multisite() ) { |
|
| 1271 | + if ( apply_filters( 'yikes_mc_old_options_filter', $old_plugin_options ) ) { |
|
| 1272 | 1272 | // display a notice to the user that they should 'migrate' |
| 1273 | 1273 | // from the old plugin settings to the new ones |
| 1274 | 1274 | add_action( 'admin_notices', array( $this , 'display_options_migrate_notice' ) , 11 ); |
@@ -1281,7 +1281,7 @@ discard block |
||
| 1281 | 1281 | * moving from 5.5 and beyond.. |
| 1282 | 1282 | * @since |
| 1283 | 1283 | */ |
| 1284 | - public function migrate_old_yks_mc_options() {
|
|
| 1284 | + public function migrate_old_yks_mc_options() { |
|
| 1285 | 1285 | // include our migrate options helper file |
| 1286 | 1286 | include_once YIKES_MC_PATH . 'admin/partials/upgrade-helpers/upgrade-migrate-options.php'; |
| 1287 | 1287 | } |
@@ -1300,15 +1300,15 @@ discard block |
||
| 1300 | 1300 | * @param string $yikes_inc_easy_mailchimp_extender The name of this plugin. |
| 1301 | 1301 | * @param string $version The version of this plugin. |
| 1302 | 1302 | */ |
| 1303 | - public function display_options_migrate_notice() {
|
|
| 1303 | + public function display_options_migrate_notice() { |
|
| 1304 | 1304 | |
| 1305 | 1305 | // Confirm that the necessary forms table in the database exists, else bail |
| 1306 | 1306 | global $wpdb; |
| 1307 | - if ( $wpdb->get_var("show tables like '" . $wpdb->prefix . "yikes_easy_mc_forms'") != $wpdb->prefix . "yikes_easy_mc_forms" ) {
|
|
| 1307 | + if ( $wpdb->get_var("show tables like '" . $wpdb->prefix . "yikes_easy_mc_forms'") != $wpdb->prefix . "yikes_easy_mc_forms" ) { |
|
| 1308 | 1308 | return; |
| 1309 | 1309 | } |
| 1310 | 1310 | |
| 1311 | - if ( isset( $_GET['yikes-mc-options-migration-dismissed'] ) && $_GET['yikes-mc-options-migration-dismissed'] == 'true' ) {
|
|
| 1311 | + if ( isset( $_GET['yikes-mc-options-migration-dismissed'] ) && $_GET['yikes-mc-options-migration-dismissed'] == 'true' ) { |
|
| 1312 | 1312 | // Delete the options, start a-new! (this will disable the migration notice altogether) |
| 1313 | 1313 | delete_option( 'widget_yikes_mc_widget' ); |
| 1314 | 1314 | delete_option( 'api_validation' ); |
@@ -1319,7 +1319,7 @@ discard block |
||
| 1319 | 1319 | <p><?php printf( __( "The previously stored options for %s have been cleared from the database. You should update the plugin options on the <a href='%s' title='Settings Page'>settings page</a> before continuing. You should also update the shortcodes used to generate your forms, and any widgets you may have previously set-up.", 'yikes-inc-easy-mailchimp-extender' ), '<strong>Us Easy Forms for MailChimp</strong>', admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings' ) ); ?></p> |
| 1320 | 1320 | </div> |
| 1321 | 1321 | <?php |
| 1322 | - } else {
|
|
| 1322 | + } else { |
|
| 1323 | 1323 | ?> |
| 1324 | 1324 | <div class="yikes-easy-mc-updated migrate-options-notice"> |
| 1325 | 1325 | <p><?php printf( __( "It looks like you're upgrading from a previous version of %s.", 'yikes-inc-easy-mailchimp-extender' ), '<strong>Us Easy Forms for MailChimp</strong>' ); ?> <?php printf( __( "In the newest version of %s, the options data structure has changed. We've also moved the mailing lists into its own database table to allow for some higher level customization. Now you can easily create multiple forms and assign them to the same mailing list." , 'yikes-inc-easy-mailchimp-extender' ), '<strong>Us Easy Forms for MailChimp</strong>' ); ?></p> |
@@ -1347,9 +1347,9 @@ discard block |
||
| 1347 | 1347 | * and return the index ( used to find the list name assigned to a form ) |
| 1348 | 1348 | * - http://stackoverflow.com/questions/6661530/php-multi-dimensional-array-search |
| 1349 | 1349 | */ |
| 1350 | - function findMCListID($id, $array) {
|
|
| 1351 | - foreach ($array as $key => $val) {
|
|
| 1352 | - if ($val['id'] === $id) {
|
|
| 1350 | + function findMCListID($id, $array) { |
|
| 1351 | + foreach ($array as $key => $val) { |
|
| 1352 | + if ($val['id'] === $id) { |
|
| 1353 | 1353 | return $key; |
| 1354 | 1354 | } |
| 1355 | 1355 | } |
@@ -1357,14 +1357,14 @@ discard block |
||
| 1357 | 1357 | } // end |
| 1358 | 1358 | |
| 1359 | 1359 | /* Ajax Migrate Options */ |
| 1360 | - function migrate_archived_options() {
|
|
| 1360 | + function migrate_archived_options() { |
|
| 1361 | 1361 | // all options prefixed with 'yikes-mc-' |
| 1362 | 1362 | $option_name = 'yikes-mc-'.$_POST['option_name']; |
| 1363 | 1363 | $option_value = $_POST['option_value']; |
| 1364 | - if ( json_decode( $option_value ) ) {
|
|
| 1364 | + if ( json_decode( $option_value ) ) { |
|
| 1365 | 1365 | // decode our lists() array, and store it |
| 1366 | 1366 | $opt_value = json_decode( $option_value, true ); |
| 1367 | - } else {
|
|
| 1367 | + } else { |
|
| 1368 | 1368 | $opt_value = $option_value; |
| 1369 | 1369 | } |
| 1370 | 1370 | update_option( $option_name, $opt_value ); |
@@ -1373,12 +1373,12 @@ discard block |
||
| 1373 | 1373 | } |
| 1374 | 1374 | |
| 1375 | 1375 | /* Ajax Migrate Forms */ |
| 1376 | - function migrate_previously_setup_forms() {
|
|
| 1376 | + function migrate_previously_setup_forms() { |
|
| 1377 | 1377 | $option_name = $_POST['option_name']; |
| 1378 | 1378 | $done = $_POST['done_import']; |
| 1379 | 1379 | // Create some starter forms for the user |
| 1380 | 1380 | // based on previously imported lists (to our old version) |
| 1381 | - if ( $option_name == 'yikes-mc-lists' ) {
|
|
| 1381 | + if ( $option_name == 'yikes-mc-lists' ) { |
|
| 1382 | 1382 | $option_value = $_POST['option_value']; |
| 1383 | 1383 | $new_options = json_decode( stripslashes_deep( $option_value ) , true ); |
| 1384 | 1384 | |
@@ -1410,9 +1410,9 @@ discard block |
||
| 1410 | 1410 | 'custom_fields' => '', |
| 1411 | 1411 | ) ); |
| 1412 | 1412 | } |
| 1413 | - if ( $done == 'done' ) {
|
|
| 1413 | + if ( $done == 'done' ) { |
|
| 1414 | 1414 | wp_send_json( array( 'form_name' => $form_name, 'completed_import' => true ) ); |
| 1415 | - } else {
|
|
| 1415 | + } else { |
|
| 1416 | 1416 | wp_send_json( array( 'form_name' => $form_name, 'completed_import' => false ) ); |
| 1417 | 1417 | } |
| 1418 | 1418 | wp_die(); |
@@ -1424,8 +1424,8 @@ discard block |
||
| 1424 | 1424 | * Render our sidebar menu on all of the setings pages (general, form, checkbox, recaptcha, popup, debug etc. ) |
| 1425 | 1425 | * @since v5.6 - complete re-write |
| 1426 | 1426 | */ |
| 1427 | - public function generate_options_pages_sidebar_menu() {
|
|
| 1428 | - if ( isset( $_REQUEST['section'] ) ) {
|
|
| 1427 | + public function generate_options_pages_sidebar_menu() { |
|
| 1428 | + if ( isset( $_REQUEST['section'] ) ) { |
|
| 1429 | 1429 | $selected = $_REQUEST['section']; |
| 1430 | 1430 | } |
| 1431 | 1431 | $installed_addons = get_option( 'yikes-easy-mc-active-addons', array() ); |
@@ -1452,13 +1452,13 @@ discard block |
||
| 1452 | 1452 | </ul> |
| 1453 | 1453 | <?php |
| 1454 | 1454 | // create our add-on settings pages |
| 1455 | - if ( !empty( $installed_addons ) ) {
|
|
| 1455 | + if ( !empty( $installed_addons ) ) { |
|
| 1456 | 1456 | ?> |
| 1457 | 1457 | <hr class="add-on-settings-divider" /> |
| 1458 | 1458 | <strong><?php _e( 'Addon Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
| 1459 | 1459 | <ul id="addon-settings-nav"> |
| 1460 | 1460 | <?php |
| 1461 | - foreach( $installed_addons as $addon_name ) {
|
|
| 1461 | + foreach( $installed_addons as $addon_name ) { |
|
| 1462 | 1462 | ?> |
| 1463 | 1463 | <li> |
| 1464 | 1464 | <?php if ( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == $addon_name ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => $addon_name, 'addon' => 'true' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion='.$addon_name ) ) ); ?>"><?php echo ucwords( str_replace( '-', ' ', $addon_name ) ); ?></a></li>
|
@@ -1478,7 +1478,7 @@ discard block |
||
| 1478 | 1478 | * Render our sidebar menu on all of the setings pages (general, form, checkbox, recaptcha, popup, debug etc. ) |
| 1479 | 1479 | * @since v5.6 - complete re-write |
| 1480 | 1480 | */ |
| 1481 | - public function generate_manage_forms_sidebar( $lists ) {
|
|
| 1481 | + public function generate_manage_forms_sidebar( $lists ) { |
|
| 1482 | 1482 | // create a custom URL to allow for creating fields |
| 1483 | 1483 | $url = esc_url_raw( |
| 1484 | 1484 | add_query_arg( |
@@ -1509,18 +1509,18 @@ discard block |
||
| 1509 | 1509 | <label for="associated-list"><strong><?php _e( 'Associated List', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
| 1510 | 1510 | <select name="associated-list" id="associated-list" class=" input-field" <?php $this->is_user_mc_api_valid_form( true ); disabled( true, empty( $lists ) ); ?>> |
| 1511 | 1511 | <?php |
| 1512 | - if ( ! empty( $lists ) ) {
|
|
| 1513 | - foreach( $lists as $mailing_list ) {
|
|
| 1512 | + if ( ! empty( $lists ) ) { |
|
| 1513 | + foreach( $lists as $mailing_list ) { |
|
| 1514 | 1514 | ?> |
| 1515 | 1515 | <option value="<?php echo $mailing_list['id']; ?>"><?php echo stripslashes( $mailing_list['name'] ) . ' (' . $mailing_list['stats']['member_count'] . ') '; ?></option>
|
| 1516 | 1516 | <?php |
| 1517 | 1517 | } |
| 1518 | - } else {
|
|
| 1519 | - if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) {
|
|
| 1518 | + } else { |
|
| 1519 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) { |
|
| 1520 | 1520 | ?> |
| 1521 | 1521 | <option><?php echo __( "Please enter a valid API key." , 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
| 1522 | 1522 | <?php |
| 1523 | - } else {
|
|
| 1523 | + } else { |
|
| 1524 | 1524 | ?> |
| 1525 | 1525 | <option><?php echo __( "No lists were found on the account." , 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
| 1526 | 1526 | <?php |
@@ -1531,8 +1531,8 @@ discard block |
||
| 1531 | 1531 | </select> |
| 1532 | 1532 | |
| 1533 | 1533 | <?php |
| 1534 | - if ( isset( $_GET['transient-cleared'] ) ) {
|
|
| 1535 | - if ( 'true' === $_GET['transient-cleared'] ) {
|
|
| 1534 | + if ( isset( $_GET['transient-cleared'] ) ) { |
|
| 1535 | + if ( 'true' === $_GET['transient-cleared'] ) { |
|
| 1536 | 1536 | ?> |
| 1537 | 1537 | <div class="yikes-list-refreshed-notice"> |
| 1538 | 1538 | <p><?php esc_attr_e( 'MailChimp list data has been succesfully refreshed.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -1541,8 +1541,8 @@ discard block |
||
| 1541 | 1541 | } |
| 1542 | 1542 | } |
| 1543 | 1543 | |
| 1544 | - if ( isset( $lists ) && empty( $lists ) ) {
|
|
| 1545 | - if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'invalid_api_key' ) {
|
|
| 1544 | + if ( isset( $lists ) && empty( $lists ) ) { |
|
| 1545 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'invalid_api_key' ) { |
|
| 1546 | 1546 | ?> |
| 1547 | 1547 | <p class="description"> |
| 1548 | 1548 | <?php printf( __( 'Head over to <a href="http://www.MailChimp.com" title="%s">MailChimp</a> to create a new list.', 'yikes-inc-easy-mailchimp-extender' ) , __( 'Create a list', 'yikes-inc-easy-mailchimp-extender' ) ); ?> |
@@ -1553,9 +1553,9 @@ discard block |
||
| 1553 | 1553 | ?> |
| 1554 | 1554 | </label> |
| 1555 | 1555 | <?php |
| 1556 | - if ( $this->is_user_mc_api_valid_form( false ) ) {
|
|
| 1556 | + if ( $this->is_user_mc_api_valid_form( false ) ) { |
|
| 1557 | 1557 | echo submit_button( __( 'Create', 'yikes-inc-easy-mailchimp-extender' ) , 'primary', '', false , array( 'style' => 'margin:.75em 0 .5em 0;' ) ); |
| 1558 | - } else {
|
|
| 1558 | + } else { |
|
| 1559 | 1559 | echo '<p class="description">' . __( "Please enter a valid MailChimp API key to get started." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
| 1560 | 1560 | ?> |
| 1561 | 1561 | <a href="<?php echo esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&settings-updated=true' ) ); ?>"><?php _e( 'general settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
@@ -1566,7 +1566,7 @@ discard block |
||
| 1566 | 1566 | |
| 1567 | 1567 | <!-- Clear API CACHE --> |
| 1568 | 1568 | <?php |
| 1569 | - if ( isset( $lists ) && ! empty( $lists ) ) {
|
|
| 1569 | + if ( isset( $lists ) && ! empty( $lists ) ) { |
|
| 1570 | 1570 | if ( false !== get_transient( 'yikes-easy-mailchimp-list-data' ) ) { ?>
|
| 1571 | 1571 | <form action="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-clear-transient-data', 'nonce' => wp_create_nonce( 'clear-mc-transient-data' ) ) ) ); ?>" method="post"> |
| 1572 | 1572 | <input type="submit" class="button-secondary clear-mailchimp-api-cache" value="<?php _e( 'Refresh Lists', 'yikes-inc-easy-mailchimp-extender' ); ?>" /> |
@@ -1582,7 +1582,7 @@ discard block |
||
| 1582 | 1582 | * Generate a dropdown of post and pages |
| 1583 | 1583 | * so the user can send the user to on form submission |
| 1584 | 1584 | */ |
| 1585 | - public function generate_page_redirect_dropdown( $redirect, $redirect_page, $custom_redirect_url ) {
|
|
| 1585 | + public function generate_page_redirect_dropdown( $redirect, $redirect_page, $custom_redirect_url ) { |
|
| 1586 | 1586 | $post_types = get_post_types(); |
| 1587 | 1587 | ?> |
| 1588 | 1588 | <label id="redirect-user-to-selection-label" for="redirect-user-to-selection" class="<?php if ( $redirect == '0' ) { echo 'yikes-easy-mc-hidden'; } ?>">
|
@@ -1602,10 +1602,10 @@ discard block |
||
| 1602 | 1602 | $excluded_post_types = apply_filters( 'yikes-mailchimp-excluded-redirect-post-types', $excluded_post_types ); |
| 1603 | 1603 | |
| 1604 | 1604 | // loop over registered post types, and query! |
| 1605 | - foreach( $post_types as $registered_post_type ) {
|
|
| 1605 | + foreach( $post_types as $registered_post_type ) { |
|
| 1606 | 1606 | |
| 1607 | 1607 | // exclude a few built in custom post types and any defined by the filter |
| 1608 | - if ( ! in_array( $registered_post_type, $excluded_post_types ) ) {
|
|
| 1608 | + if ( ! in_array( $registered_post_type, $excluded_post_types ) ) { |
|
| 1609 | 1609 | |
| 1610 | 1610 | // Grab only the post IDs - in the past we've created timeout issues on some servers with lots of posts |
| 1611 | 1611 | $wp_query_args = array( |
@@ -1620,11 +1620,11 @@ discard block |
||
| 1620 | 1620 | |
| 1621 | 1621 | $post_ids = ! empty( $wp_query_result->posts ) ? $wp_query_result->posts : array(); |
| 1622 | 1622 | |
| 1623 | - if ( ! empty ( $post_ids ) ) {
|
|
| 1623 | + if ( ! empty ( $post_ids ) ) { |
|
| 1624 | 1624 | ?> |
| 1625 | 1625 | <optgroup label="<?php echo ucwords( str_replace( '_', ' ', $registered_post_type ) ); ?>"> |
| 1626 | 1626 | <?php |
| 1627 | - foreach( $post_ids as $post_id ) {
|
|
| 1627 | + foreach( $post_ids as $post_id ) { |
|
| 1628 | 1628 | ?><option <?php selected( $redirect_page , $post_id ); ?> value="<?php echo $post_id; ?>"><?php echo get_the_title( $post_id ) ?></option><?php |
| 1629 | 1629 | } |
| 1630 | 1630 | ?> |
@@ -1655,14 +1655,14 @@ discard block |
||
| 1655 | 1655 | * |
| 1656 | 1656 | * Displayed in sidebars |
| 1657 | 1657 | */ |
| 1658 | - public function generate_show_some_love_container() {
|
|
| 1658 | + public function generate_show_some_love_container() { |
|
| 1659 | 1659 | // if no active add-ons are installed, |
| 1660 | 1660 | // lets display our branding and add-on sidebar |
| 1661 | - if ( get_option( 'yikes-easy-mc-active-addons', array() ) == array() ) {
|
|
| 1661 | + if ( get_option( 'yikes-easy-mc-active-addons', array() ) == array() ) { |
|
| 1662 | 1662 | |
| 1663 | 1663 | /* On Edit Forms Page Display Upsell to Customizer */ |
| 1664 | 1664 | $screen = get_current_screen(); |
| 1665 | - if ( isset( $screen ) && $screen->base == 'admin_page_yikes-mailchimp-edit-form' ) {
|
|
| 1665 | + if ( isset( $screen ) && $screen->base == 'admin_page_yikes-mailchimp-edit-form' ) { |
|
| 1666 | 1666 | ?> |
| 1667 | 1667 | |
| 1668 | 1668 | <div class="postbox yikes-easy-mc-postbox show-some-love-container"> |
@@ -1747,18 +1747,18 @@ discard block |
||
| 1747 | 1747 | * - |
| 1748 | 1748 | * @parameters - $list_id - pass in the list ID to retreive merge variables from |
| 1749 | 1749 | */ |
| 1750 | - public function generate_form_editor( $form_fields, $list_id, $merge_variables, $interest_groups ) {
|
|
| 1750 | + public function generate_form_editor( $form_fields, $list_id, $merge_variables, $interest_groups ) { |
|
| 1751 | 1751 | |
| 1752 | 1752 | // if no list id, die! |
| 1753 | - if ( ! $list_id ) {
|
|
| 1753 | + if ( ! $list_id ) { |
|
| 1754 | 1754 | wp_die( __( "We've encountered an error. No list ID was sent." , 'yikes-inc-easy-mailchimp-extender' ) ); |
| 1755 | 1755 | } |
| 1756 | 1756 | |
| 1757 | - if ( ! $merge_variables ) {
|
|
| 1757 | + if ( ! $merge_variables ) { |
|
| 1758 | 1758 | wp_die( __( "We've encountered an error. Reload the page and try again. If the error persists, please reach out to support." , 'yikes-inc-easy-mailchimp-extender' ) ); |
| 1759 | 1759 | } |
| 1760 | 1760 | |
| 1761 | - if ( ! empty( $form_fields ) ) {
|
|
| 1761 | + if ( ! empty( $form_fields ) ) { |
|
| 1762 | 1762 | |
| 1763 | 1763 | // find any fields that are assigned to this form, that don't exist in MailChimp |
| 1764 | 1764 | // or else were going to run into issues when we submit the form |
@@ -1770,18 +1770,18 @@ discard block |
||
| 1770 | 1770 | $mailchimp_merge_field_ids = array(); |
| 1771 | 1771 | |
| 1772 | 1772 | // loop over merge variables |
| 1773 | - if ( ! empty( $merge_variables['merge_fields'] ) ) {
|
|
| 1773 | + if ( ! empty( $merge_variables['merge_fields'] ) ) { |
|
| 1774 | 1774 | $available_merge_variables = wp_list_pluck( $merge_variables['merge_fields'], 'tag' ); |
| 1775 | 1775 | $mailchimp_merge_field_ids = wp_list_pluck( $merge_variables['merge_fields'], 'merge_id' ); |
| 1776 | 1776 | |
| 1777 | 1777 | // Array will look like $merge_tag => $merge_id |
| 1778 | - foreach( $available_merge_variables as $index => $merge_tag ) {
|
|
| 1778 | + foreach( $available_merge_variables as $index => $merge_tag ) { |
|
| 1779 | 1779 | $merge_field_ids[$merge_tag] = $mailchimp_merge_field_ids[$index]; |
| 1780 | 1780 | } |
| 1781 | 1781 | } |
| 1782 | 1782 | |
| 1783 | 1783 | // loop over interest groups |
| 1784 | - if ( ! empty( $interest_groups ) ) {
|
|
| 1784 | + if ( ! empty( $interest_groups ) ) { |
|
| 1785 | 1785 | $available_interest_groups = array_keys( $interest_groups ); |
| 1786 | 1786 | } |
| 1787 | 1787 | |
@@ -1791,9 +1791,9 @@ discard block |
||
| 1791 | 1791 | $excluded_fields = array_diff( $assigned_fields, $merged_fields ); |
| 1792 | 1792 | |
| 1793 | 1793 | $i = 1; |
| 1794 | - foreach( $form_fields as $field ) {
|
|
| 1794 | + foreach( $form_fields as $field ) { |
|
| 1795 | 1795 | |
| 1796 | - if ( isset( $field['merge'] ) ) {
|
|
| 1796 | + if ( isset( $field['merge'] ) ) { |
|
| 1797 | 1797 | // @todo: don't use in_array() |
| 1798 | 1798 | $excluded_field = in_array( $field['merge'], $excluded_fields, true ); |
| 1799 | 1799 | ?> |
@@ -1827,7 +1827,7 @@ discard block |
||
| 1827 | 1827 | <input type="hidden" class="yikes-mc-merge-field-id" name="field[<?php echo $field['merge']; ?>][id]" value="<?php echo $merge_field_ids[ $field['merge'] ] ?>" /> |
| 1828 | 1828 | <?php } ?> |
| 1829 | 1829 | |
| 1830 | - <?php if ( $field['type'] == 'radio' || $field['type'] == 'dropdown' || $field['type'] == 'select' ) {
|
|
| 1830 | + <?php if ( $field['type'] == 'radio' || $field['type'] == 'dropdown' || $field['type'] == 'select' ) { |
|
| 1831 | 1831 | $choices = json_decode( $field['choices'], true ); |
| 1832 | 1832 | ?> |
| 1833 | 1833 | <input type="hidden" name="field[<?php echo $field['merge']; ?>][choices]" value='<?php echo esc_attr( json_encode( $choices ) ); ?>' /> |
@@ -1851,7 +1851,7 @@ discard block |
||
| 1851 | 1851 | </tr> |
| 1852 | 1852 | |
| 1853 | 1853 | <!-- Placeholder Value --> |
| 1854 | - <?php switch( $field['type'] ) {
|
|
| 1854 | + <?php switch( $field['type'] ) { |
|
| 1855 | 1855 | |
| 1856 | 1856 | case 'text': |
| 1857 | 1857 | case 'email': |
@@ -1898,7 +1898,7 @@ discard block |
||
| 1898 | 1898 | ?> |
| 1899 | 1899 | |
| 1900 | 1900 | <!-- Default Value --> |
| 1901 | - <?php switch( $field['type'] ) {
|
|
| 1901 | + <?php switch( $field['type'] ) { |
|
| 1902 | 1902 | default: |
| 1903 | 1903 | case 'text': |
| 1904 | 1904 | case 'number': |
@@ -1914,7 +1914,7 @@ discard block |
||
| 1914 | 1914 | <input id="default_value_<?php echo esc_attr( $field['merge'] ); ?>" <?php if ( $field['type'] != 'number' ) { ?> type="text" <?php } else { ?> type="number" <?php } ?> class="widefat" name="field[<?php echo $field['merge']; ?>][default]" <?php if ( $field['type'] != 'url' ) { ?> value="<?php echo isset( $field['default'] ) ? stripslashes( wp_strip_all_tags( $field['default'] ) ) : ''; ?>" <?php } else { ?> value="<?php echo isset( $field['default'] ) ? stripslashes( wp_strip_all_tags( esc_url_raw( $field['default'] ) ) ) : ''; ?>" <?php } ?> />
|
| 1915 | 1915 | <p class="description"><small><?php _e( "Assign a default value to populate this field with on initial page load.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
| 1916 | 1916 | <?php |
| 1917 | - switch( $field['type'] ) {
|
|
| 1917 | + switch( $field['type'] ) { |
|
| 1918 | 1918 | case 'text': |
| 1919 | 1919 | ?> |
| 1920 | 1920 | <p><small class="pre-defined-tag-link"><a href="#TB_inline?width=600&height=550&inlineId=pre-defined-tag-container" onclick="storeGlobalClicked( jQuery( this ) );" class="thickbox"><?php _e( 'View Pre-Defined Tags', 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></p> |
@@ -2071,7 +2071,7 @@ discard block |
||
| 2071 | 2071 | <!-- Display Phone/Date Formats back to the user --> |
| 2072 | 2072 | <!-- Phone Format Initial Load --> |
| 2073 | 2073 | <?php |
| 2074 | - switch( $field['type'] ) {
|
|
| 2074 | + switch( $field['type'] ) { |
|
| 2075 | 2075 | /* Store the phone format, for properly regex pattern */ |
| 2076 | 2076 | case 'phone': |
| 2077 | 2077 | case 'birthday': |
@@ -2081,7 +2081,7 @@ discard block |
||
| 2081 | 2081 | <td scope="row"> |
| 2082 | 2082 | <label for="placeholder"> |
| 2083 | 2083 | <?php |
| 2084 | - switch( $field['type'] ) {
|
|
| 2084 | + switch( $field['type'] ) { |
|
| 2085 | 2085 | default: |
| 2086 | 2086 | case 'birthday': |
| 2087 | 2087 | $type = __( 'Date Format', 'yikes-inc-easy-mailchimp-extender' ); |
@@ -2142,7 +2142,7 @@ discard block |
||
| 2142 | 2142 | |
| 2143 | 2143 | |
| 2144 | 2144 | |
| 2145 | - } else {
|
|
| 2145 | + } else { |
|
| 2146 | 2146 | |
| 2147 | 2147 | /**** Interest Group ****/ |
| 2148 | 2148 | |
@@ -2175,7 +2175,7 @@ discard block |
||
| 2175 | 2175 | |
| 2176 | 2176 | <table class="form-table form-field-container"> |
| 2177 | 2177 | <!-- Default Value --> |
| 2178 | - <?php switch( $field['type'] ) {
|
|
| 2178 | + <?php switch( $field['type'] ) { |
|
| 2179 | 2179 | default: |
| 2180 | 2180 | case 'radio': |
| 2181 | 2181 | case 'checkboxes': |
@@ -2202,7 +2202,7 @@ discard block |
||
| 2202 | 2202 | |
| 2203 | 2203 | $default_shown = false; |
| 2204 | 2204 | |
| 2205 | - foreach ( json_decode( $field['groups'], true ) as $id => $group ) {
|
|
| 2205 | + foreach ( json_decode( $field['groups'], true ) as $id => $group ) { |
|
| 2206 | 2206 | $field_id = "{$field['group_id']}-{$id}";
|
| 2207 | 2207 | $field_type = 'hidden' == $field['type'] ? 'checkbox' : $field['type']; |
| 2208 | 2208 | $field_type = 'checkboxes' == $field_type ? 'checkbox' : $field_type; |
@@ -2211,7 +2211,7 @@ discard block |
||
| 2211 | 2211 | |
| 2212 | 2212 | // Determine if the current group is checked. |
| 2213 | 2213 | $checked = ''; |
| 2214 | - switch ( $field_type ) {
|
|
| 2214 | + switch ( $field_type ) { |
|
| 2215 | 2215 | case 'radio': |
| 2216 | 2216 | default: |
| 2217 | 2217 | $checked = checked( $field['default_choice'], $id, false ); |
@@ -2219,14 +2219,14 @@ discard block |
||
| 2219 | 2219 | |
| 2220 | 2220 | case 'checkbox': |
| 2221 | 2221 | case 'hidden': |
| 2222 | - if ( in_array( $id, (array) $field['default_choice'] ) ) {
|
|
| 2222 | + if ( in_array( $id, (array) $field['default_choice'] ) ) { |
|
| 2223 | 2223 | $checked = checked( true, true, false ); |
| 2224 | 2224 | } |
| 2225 | 2225 | break; |
| 2226 | 2226 | } |
| 2227 | 2227 | |
| 2228 | 2228 | // Allow users to not set a default choice for radio buttons. |
| 2229 | - if ( $field_type === 'radio' && $default_shown === false ) {
|
|
| 2229 | + if ( $field_type === 'radio' && $default_shown === false ) { |
|
| 2230 | 2230 | $default_shown = true; |
| 2231 | 2231 | ?> |
| 2232 | 2232 | <label for="<?php echo $field_id . 'no-default'; ?>"> |
@@ -2379,7 +2379,7 @@ discard block |
||
| 2379 | 2379 | <?php |
| 2380 | 2380 | } |
| 2381 | 2381 | } |
| 2382 | - } else {
|
|
| 2382 | + } else { |
|
| 2383 | 2383 | ?> |
| 2384 | 2384 | <h4 class="no-fields-assigned-notice non-draggable-yikes"><em><?php _e( 'No fields are assigned to this form. Select fields from the right hand column to add to this form.', 'yikes-inc-easy-mailchimp-extender' ); ?></em></h4> |
| 2385 | 2385 | <?php |
@@ -2466,19 +2466,19 @@ discard block |
||
| 2466 | 2466 | * - |
| 2467 | 2467 | * @parameters - $list_id - pass in the list ID to retreive merge variables from |
| 2468 | 2468 | */ |
| 2469 | - public function build_available_merge_vars( $form_fields , $available_merge_variables ) {
|
|
| 2469 | + public function build_available_merge_vars( $form_fields , $available_merge_variables ) { |
|
| 2470 | 2470 | $fields_assigned_to_form = array(); |
| 2471 | - foreach ( $form_fields as $field ) {
|
|
| 2472 | - if ( isset( $field['merge'] ) ) {
|
|
| 2471 | + foreach ( $form_fields as $field ) { |
|
| 2472 | + if ( isset( $field['merge'] ) ) { |
|
| 2473 | 2473 | $fields_assigned_to_form[ $field['merge'] ] = true; |
| 2474 | 2474 | } |
| 2475 | 2475 | } |
| 2476 | 2476 | |
| 2477 | - if ( ! empty( $available_merge_variables['merge_fields'] ) ) {
|
|
| 2477 | + if ( ! empty( $available_merge_variables['merge_fields'] ) ) { |
|
| 2478 | 2478 | ?> |
| 2479 | 2479 | <ul id="available-fields"><?php |
| 2480 | - foreach ( $available_merge_variables['merge_fields'] as $merge_var ) {
|
|
| 2481 | - if ( isset( $fields_assigned_to_form[ $merge_var['tag'] ] ) ) {
|
|
| 2480 | + foreach ( $available_merge_variables['merge_fields'] as $merge_var ) { |
|
| 2481 | + if ( isset( $fields_assigned_to_form[ $merge_var['tag'] ] ) ) { |
|
| 2482 | 2482 | ?> |
| 2483 | 2483 | <li class="available-form-field not-available" |
| 2484 | 2484 | alt="<?php echo $merge_var['tag']; ?>" |
@@ -2488,13 +2488,13 @@ discard block |
||
| 2488 | 2488 | title="<?php esc_attr_e( 'Already assigned to your form', 'yikes-inc-easy-mailchimp-extender' ); ?>" |
| 2489 | 2489 | disabled="disabled"> |
| 2490 | 2490 | <?php echo stripslashes( $merge_var['name'] ); |
| 2491 | - if ( $merge_var['required'] ) {
|
|
| 2491 | + if ( $merge_var['required'] ) { |
|
| 2492 | 2492 | echo ' <span class="field-required" title="' . __( 'required field', 'yikes-inc-easy-mailchimp-extender' ) . '">*</span>'; |
| 2493 | 2493 | } ?> |
| 2494 | 2494 | <small class="field-type-text"><?php echo $merge_var['type']; ?></small> |
| 2495 | 2495 | </li> |
| 2496 | 2496 | <?php |
| 2497 | - } else {
|
|
| 2497 | + } else { |
|
| 2498 | 2498 | ?> |
| 2499 | 2499 | <li class="available-form-field" |
| 2500 | 2500 | alt="<?php echo $merge_var['tag']; ?>" |
@@ -2502,7 +2502,7 @@ discard block |
||
| 2502 | 2502 | data-attr-field-name="<?php echo esc_attr( $merge_var['name'] ); ?>" |
| 2503 | 2503 | data-attr-form-id="<?php echo esc_attr( $available_merge_variables['list_id'] ); ?>"> |
| 2504 | 2504 | <?php echo stripslashes( $merge_var['name'] ); |
| 2505 | - if ( $merge_var['required'] ) {
|
|
| 2505 | + if ( $merge_var['required'] ) { |
|
| 2506 | 2506 | echo ' <span class="field-required" title="' . __( 'required field', 'yikes-inc-easy-mailchimp-extender' ) . '">*</span>'; |
| 2507 | 2507 | } ?> |
| 2508 | 2508 | <small class="field-type-text"><?php echo $merge_var['type']; ?></small> |
@@ -2527,21 +2527,21 @@ discard block |
||
| 2527 | 2527 | * - |
| 2528 | 2528 | * @parameters - $list_id - pass in the list ID to retreive merge variables from |
| 2529 | 2529 | */ |
| 2530 | - public function build_available_interest_groups( $form_fields , $available_interest_groups , $list_id ) {
|
|
| 2530 | + public function build_available_interest_groups( $form_fields , $available_interest_groups , $list_id ) { |
|
| 2531 | 2531 | $fields_assigned_to_form = array(); |
| 2532 | - if ( ! empty( $form_fields ) ) {
|
|
| 2533 | - foreach ( $form_fields as $field ) {
|
|
| 2534 | - if ( isset( $field['group_id'] ) ) {
|
|
| 2532 | + if ( ! empty( $form_fields ) ) { |
|
| 2533 | + foreach ( $form_fields as $field ) { |
|
| 2534 | + if ( isset( $field['group_id'] ) ) { |
|
| 2535 | 2535 | $fields_assigned_to_form[ $field['group_id'] ] = true; |
| 2536 | 2536 | } |
| 2537 | 2537 | } |
| 2538 | 2538 | } |
| 2539 | 2539 | |
| 2540 | - if ( ! empty( $available_interest_groups ) ) {
|
|
| 2540 | + if ( ! empty( $available_interest_groups ) ) { |
|
| 2541 | 2541 | ?> |
| 2542 | 2542 | <ul id="available-interest-groups"><?php |
| 2543 | - foreach ( $available_interest_groups as $interest_group ) {
|
|
| 2544 | - if ( isset( $fields_assigned_to_form[ $interest_group['id'] ] ) ) {
|
|
| 2543 | + foreach ( $available_interest_groups as $interest_group ) { |
|
| 2544 | + if ( isset( $fields_assigned_to_form[ $interest_group['id'] ] ) ) { |
|
| 2545 | 2545 | ?> |
| 2546 | 2546 | <li class="available-interest-group not-available" |
| 2547 | 2547 | alt="<?php echo $interest_group['id']; ?>" |
@@ -2554,7 +2554,7 @@ discard block |
||
| 2554 | 2554 | <small class="field-type-text"><?php echo $interest_group['type']; ?></small> |
| 2555 | 2555 | </li> |
| 2556 | 2556 | <?php |
| 2557 | - } else {
|
|
| 2557 | + } else { |
|
| 2558 | 2558 | ?> |
| 2559 | 2559 | <li class="available-interest-group" |
| 2560 | 2560 | alt="<?php echo $interest_group['id']; ?>" |
@@ -2584,9 +2584,9 @@ discard block |
||
| 2584 | 2584 | * and include it here for easy maintenance |
| 2585 | 2585 | * - must clean up db tables , ensure what data is going in and what is needed... |
| 2586 | 2586 | */ |
| 2587 | - public function yikes_easy_mailchimp_create_form() {
|
|
| 2587 | + public function yikes_easy_mailchimp_create_form() { |
|
| 2588 | 2588 | $nonce = $_REQUEST['nonce']; |
| 2589 | - if ( ! wp_verify_nonce( $nonce, 'create_mailchimp_form' ) ) {
|
|
| 2589 | + if ( ! wp_verify_nonce( $nonce, 'create_mailchimp_form' ) ) { |
|
| 2590 | 2590 | wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) ); |
| 2591 | 2591 | } |
| 2592 | 2592 | |
@@ -2597,13 +2597,13 @@ discard block |
||
| 2597 | 2597 | ) ); |
| 2598 | 2598 | |
| 2599 | 2599 | // if an error occurs during the form creation process |
| 2600 | - if ( false == $result ) {
|
|
| 2600 | + if ( false == $result ) { |
|
| 2601 | 2601 | // write it to the error log |
| 2602 | 2602 | // if the form was not created successfully |
| 2603 | 2603 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 2604 | 2604 | $error_logging->maybe_write_to_log( __( 'Error creating a new form', 'yikes-inc-easy-mailchimp-extender') , __( "Creating a new form" , 'yikes-inc-easy-mailchimp-extender' ) , __( "Forms" , 'yikes-inc-easy-mailchimp-extender' ) ); |
| 2605 | 2605 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&sql_error=' . urlencode( __( 'Error creating a new form', 'yikes-inc-easy-mailchimp-extender' ) ) ) ) ); |
| 2606 | - } else {
|
|
| 2606 | + } else { |
|
| 2607 | 2607 | // redirect the user to the new form edit page |
| 2608 | 2608 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $result) ) ); |
| 2609 | 2609 | } |
@@ -2616,12 +2616,12 @@ discard block |
||
| 2616 | 2616 | * and include it here for easy maintenance |
| 2617 | 2617 | * - must clean up db tables , ensure what data is going in and what is needed... |
| 2618 | 2618 | */ |
| 2619 | - public function yikes_easy_mailchimp_delete_form() {
|
|
| 2619 | + public function yikes_easy_mailchimp_delete_form() { |
|
| 2620 | 2620 | // grab & store our variables ( associated list & form name ) |
| 2621 | 2621 | $nonce = $_REQUEST['nonce']; |
| 2622 | 2622 | $post_id_to_delete = $_REQUEST['mailchimp-form']; |
| 2623 | 2623 | // verify our nonce |
| 2624 | - if ( ! wp_verify_nonce( $nonce, 'delete-mailchimp-form-'.$post_id_to_delete ) ) {
|
|
| 2624 | + if ( ! wp_verify_nonce( $nonce, 'delete-mailchimp-form-'.$post_id_to_delete ) ) { |
|
| 2625 | 2625 | wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
| 2626 | 2626 | } |
| 2627 | 2627 | |
@@ -2636,12 +2636,12 @@ discard block |
||
| 2636 | 2636 | * Duplicate an entire form ! |
| 2637 | 2637 | * Probably Move these to its own file, |
| 2638 | 2638 | */ |
| 2639 | - public function yikes_easy_mailchimp_duplicate_form() {
|
|
| 2639 | + public function yikes_easy_mailchimp_duplicate_form() { |
|
| 2640 | 2640 | // grab & store our variables ( associated list & form name ) |
| 2641 | 2641 | $nonce = $_REQUEST['nonce']; |
| 2642 | 2642 | $post_id_to_clone = $_REQUEST['mailchimp-form']; |
| 2643 | 2643 | // verify our nonce |
| 2644 | - if ( ! wp_verify_nonce( $nonce, 'duplicate-mailchimp-form-'.$post_id_to_clone ) ) {
|
|
| 2644 | + if ( ! wp_verify_nonce( $nonce, 'duplicate-mailchimp-form-'.$post_id_to_clone ) ) { |
|
| 2645 | 2645 | wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
| 2646 | 2646 | } |
| 2647 | 2647 | |
@@ -2655,10 +2655,10 @@ discard block |
||
| 2655 | 2655 | // Create the new form, and handle the result. |
| 2656 | 2656 | $result = $this->form_interface->create_form( $form_data ); |
| 2657 | 2657 | |
| 2658 | - if ( false === $result ) {
|
|
| 2658 | + if ( false === $result ) { |
|
| 2659 | 2659 | // redirect the user to the manage forms page, display error |
| 2660 | 2660 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp&duplicated-form=false' ) ) ); |
| 2661 | - } else {
|
|
| 2661 | + } else { |
|
| 2662 | 2662 | // redirect the user to the manage forms page, display confirmation |
| 2663 | 2663 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp&duplicated-form=true' ) ) ); |
| 2664 | 2664 | } |
@@ -2669,12 +2669,12 @@ discard block |
||
| 2669 | 2669 | /* |
| 2670 | 2670 | * Reset a forms impression stats |
| 2671 | 2671 | */ |
| 2672 | - public function yikes_easy_mailchimp_reset_impression_stats() {
|
|
| 2672 | + public function yikes_easy_mailchimp_reset_impression_stats() { |
|
| 2673 | 2673 | // grab & store our variables ( associated list & form name ) |
| 2674 | 2674 | $nonce = $_REQUEST['nonce']; |
| 2675 | 2675 | $form_id_to_reset = $_REQUEST['mailchimp-form']; |
| 2676 | 2676 | // verify our nonce |
| 2677 | - if ( ! wp_verify_nonce( $nonce, 'reset-stats-mailchimp-form-'.$form_id_to_reset ) ) {
|
|
| 2677 | + if ( ! wp_verify_nonce( $nonce, 'reset-stats-mailchimp-form-'.$form_id_to_reset ) ) { |
|
| 2678 | 2678 | wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
| 2679 | 2679 | } |
| 2680 | 2680 | |
@@ -2686,10 +2686,10 @@ discard block |
||
| 2686 | 2686 | ) |
| 2687 | 2687 | ); |
| 2688 | 2688 | |
| 2689 | - if ( false === $result ) {
|
|
| 2689 | + if ( false === $result ) { |
|
| 2690 | 2690 | // redirect the user to the manage forms page, display error |
| 2691 | 2691 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp&reset-stats=false' ) ) ); |
| 2692 | - } else {
|
|
| 2692 | + } else { |
|
| 2693 | 2693 | // redirect the user to the manage forms page, display confirmation |
| 2694 | 2694 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp&reset-stats=true' ) ) ); |
| 2695 | 2695 | } |
@@ -2701,13 +2701,13 @@ discard block |
||
| 2701 | 2701 | * Update an entire form ! |
| 2702 | 2702 | * Probably Move these to its own file, |
| 2703 | 2703 | */ |
| 2704 | - public function yikes_easy_mailchimp_update_form() {
|
|
| 2704 | + public function yikes_easy_mailchimp_update_form() { |
|
| 2705 | 2705 | |
| 2706 | 2706 | $nonce = $_REQUEST['nonce']; |
| 2707 | 2707 | $form_id = $_REQUEST['id']; |
| 2708 | 2708 | |
| 2709 | 2709 | // verify our nonce |
| 2710 | - if ( ! wp_verify_nonce( $nonce, 'update-mailchimp-form-' . $form_id ) ) {
|
|
| 2710 | + if ( ! wp_verify_nonce( $nonce, 'update-mailchimp-form-' . $form_id ) ) { |
|
| 2711 | 2711 | wp_die( |
| 2712 | 2712 | __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), |
| 2713 | 2713 | __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), |
@@ -2780,11 +2780,11 @@ discard block |
||
| 2780 | 2780 | |
| 2781 | 2781 | // additional custom fields (extensions / user defined fields) |
| 2782 | 2782 | $custom_fields = array(); |
| 2783 | - if ( isset( $_POST['custom-field'] ) ) {
|
|
| 2784 | - foreach ( $_POST['custom-field'] as $custom_field => $custom_value ) {
|
|
| 2785 | - if ( is_array( $custom_value ) ) {
|
|
| 2783 | + if ( isset( $_POST['custom-field'] ) ) { |
|
| 2784 | + foreach ( $_POST['custom-field'] as $custom_field => $custom_value ) { |
|
| 2785 | + if ( is_array( $custom_value ) ) { |
|
| 2786 | 2786 | $custom_fields[ $custom_field ] = array_filter( stripslashes_deep( $custom_value ) ); // array_filters to remove empty items (don't save them!) |
| 2787 | - } else {
|
|
| 2787 | + } else { |
|
| 2788 | 2788 | $custom_fields[ $custom_field ] = stripslashes( $custom_value ); |
| 2789 | 2789 | } |
| 2790 | 2790 | } |
@@ -2820,7 +2820,7 @@ discard block |
||
| 2820 | 2820 | exit(); |
| 2821 | 2821 | } |
| 2822 | 2822 | |
| 2823 | - public static function generate_default_email_body() {
|
|
| 2823 | + public static function generate_default_email_body() { |
|
| 2824 | 2824 | $email_body = '<p>' . __( 'Greetings,', 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
| 2825 | 2825 | |
| 2826 | 2826 | $email_body .= '<p>'; |
@@ -2843,18 +2843,18 @@ discard block |
||
| 2843 | 2843 | } |
| 2844 | 2844 | |
| 2845 | 2845 | /* Unsubscribe a given user from our list */ |
| 2846 | - public function yikes_easy_mailchimp_unsubscribe_user() {
|
|
| 2846 | + public function yikes_easy_mailchimp_unsubscribe_user() { |
|
| 2847 | 2847 | $nonce = $_REQUEST['nonce']; |
| 2848 | 2848 | $list_id = $_REQUEST['mailchimp-list']; |
| 2849 | 2849 | $email_id = $_REQUEST['email_id']; |
| 2850 | 2850 | |
| 2851 | 2851 | // verify our nonce |
| 2852 | - if ( ! wp_verify_nonce( $nonce, 'unsubscribe-user-' . $email_id ) ) {
|
|
| 2852 | + if ( ! wp_verify_nonce( $nonce, 'unsubscribe-user-' . $email_id ) ) { |
|
| 2853 | 2853 | wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
| 2854 | 2854 | } |
| 2855 | 2855 | |
| 2856 | 2856 | $response = yikes_get_mc_api_manager()->get_list_handler()->member_unsubscribe( $list_id, $email_id ); |
| 2857 | - if ( is_wp_error( $response ) ) {
|
|
| 2857 | + if ( is_wp_error( $response ) ) { |
|
| 2858 | 2858 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 2859 | 2859 | $error_logging->maybe_write_to_log( |
| 2860 | 2860 | $response->get_error_code(), |
@@ -2867,22 +2867,22 @@ discard block |
||
| 2867 | 2867 | exit; |
| 2868 | 2868 | } |
| 2869 | 2869 | |
| 2870 | - public function yikes_easy_mailchimp_create_missing_error_log() {
|
|
| 2870 | + public function yikes_easy_mailchimp_create_missing_error_log() { |
|
| 2871 | 2871 | // grab our nonnce |
| 2872 | 2872 | $nonce = $_REQUEST['nonce']; |
| 2873 | 2873 | // validate nonce |
| 2874 | - if ( !wp_verify_nonce( $nonce, 'create_error_log' ) ) {
|
|
| 2874 | + if ( !wp_verify_nonce( $nonce, 'create_error_log' ) ) { |
|
| 2875 | 2875 | wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
| 2876 | 2876 | } |
| 2877 | 2877 | // setup the path to the error log |
| 2878 | 2878 | $error_log = fopen( plugin_dir_path( __FILE__ ) . '../includes/error_log/yikes-easy-mailchimp-error-log.php', 'w' ); |
| 2879 | - try {
|
|
| 2879 | + try { |
|
| 2880 | 2880 | // create the file |
| 2881 | 2881 | fwrite( $error_log , '' ); |
| 2882 | 2882 | // close out |
| 2883 | 2883 | fclose( $error_log ); |
| 2884 | 2884 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings&error_log_created=true' ) ) ); |
| 2885 | - } catch ( Exception $e ) {
|
|
| 2885 | + } catch ( Exception $e ) { |
|
| 2886 | 2886 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings&error_log_created=false&error_message='.urlencode( $e->getMessage() ) ) ) ); |
| 2887 | 2887 | } |
| 2888 | 2888 | } |
@@ -2891,11 +2891,11 @@ discard block |
||
| 2891 | 2891 | * Clear Transient Data ! |
| 2892 | 2892 | * Probably Move these to its own file, |
| 2893 | 2893 | */ |
| 2894 | - public function yikes_easy_mailchimp_clear_transient_data() {
|
|
| 2894 | + public function yikes_easy_mailchimp_clear_transient_data() { |
|
| 2895 | 2895 | |
| 2896 | 2896 | // verify our nonce |
| 2897 | 2897 | $nonce = $_REQUEST['nonce']; |
| 2898 | - if ( ! wp_verify_nonce( $nonce, 'clear-mc-transient-data' ) ) {
|
|
| 2898 | + if ( ! wp_verify_nonce( $nonce, 'clear-mc-transient-data' ) ) { |
|
| 2899 | 2899 | wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
| 2900 | 2900 | } |
| 2901 | 2901 | |
@@ -2903,14 +2903,14 @@ discard block |
||
| 2903 | 2903 | |
| 2904 | 2904 | // if the request came from the settings page, redirect to the settings page. |
| 2905 | 2905 | $referer = wp_get_referer(); |
| 2906 | - if ( $referer && ( strpos( $referer, 'yikes-inc-easy-mailchimp-settings' ) > 0 ) ) {
|
|
| 2906 | + if ( $referer && ( strpos( $referer, 'yikes-inc-easy-mailchimp-settings' ) > 0 ) ) { |
|
| 2907 | 2907 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=api-cache-settings&transient-cleared=true' ) ) ); |
| 2908 | - } elseif ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] === 'yikes-mailchimp-edit-form' && isset( $_REQUEST['id'] ) && ! empty( $_REQUEST['id'] ) ) {
|
|
| 2908 | + } elseif ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] === 'yikes-mailchimp-edit-form' && isset( $_REQUEST['id'] ) && ! empty( $_REQUEST['id'] ) ) { |
|
| 2909 | 2909 | |
| 2910 | 2910 | // else check if we were editing a form. |
| 2911 | 2911 | $id = filter_var( $_REQUEST['id'], FILTER_SANITIZE_NUMBER_INT ); |
| 2912 | 2912 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $id ) ) ); |
| 2913 | - } else {
|
|
| 2913 | + } else { |
|
| 2914 | 2914 | // else redirect to the manage forms page. |
| 2915 | 2915 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp&transient-cleared=true' ) ) ); |
| 2916 | 2916 | } |
@@ -2926,17 +2926,17 @@ discard block |
||
| 2926 | 2926 | * @since 6.0.2 |
| 2927 | 2927 | * @return $list_id_array - array of list id's to loop over |
| 2928 | 2928 | */ |
| 2929 | - public function get_mailchimp_list_ids_on_account() {
|
|
| 2929 | + public function get_mailchimp_list_ids_on_account() { |
|
| 2930 | 2930 | $api_key = yikes_get_mc_api_key(); |
| 2931 | - if ( ! $api_key ) {
|
|
| 2931 | + if ( ! $api_key ) { |
|
| 2932 | 2932 | // if no api key is set/site is not connected, return an empty array. |
| 2933 | 2933 | return array(); |
| 2934 | 2934 | } |
| 2935 | 2935 | |
| 2936 | 2936 | $lists = get_transient( 'yikesinc_eme_list_ids' ); |
| 2937 | - if ( false === $lists ) {
|
|
| 2937 | + if ( false === $lists ) { |
|
| 2938 | 2938 | $lists = yikes_get_mc_api_manager()->get_list_handler()->get_list_ids(); |
| 2939 | - if ( is_wp_error( $lists ) ) {
|
|
| 2939 | + if ( is_wp_error( $lists ) ) { |
|
| 2940 | 2940 | return array(); |
| 2941 | 2941 | } |
| 2942 | 2942 | set_transient( 'yikesinc_eme_list_ids', $lists, HOUR_IN_SECONDS ); |
@@ -2950,9 +2950,9 @@ discard block |
||
| 2950 | 2950 | * |
| 2951 | 2951 | * @since 6.0 |
| 2952 | 2952 | */ |
| 2953 | - public function yikes_mailchimp_load_helper_class() {
|
|
| 2953 | + public function yikes_mailchimp_load_helper_class() { |
|
| 2954 | 2954 | // check to see if it's already loaded up. |
| 2955 | - if ( !class_exists( 'Yikes_Inc_Easy_Mailchimp_Forms_Helper' ) ) {
|
|
| 2955 | + if ( !class_exists( 'Yikes_Inc_Easy_Mailchimp_Forms_Helper' ) ) { |
|
| 2956 | 2956 | // Include our main helper class file |
| 2957 | 2957 | include_once( YIKES_MC_PATH . 'admin/partials/helpers/init.php' ); |
| 2958 | 2958 | } |
@@ -2965,11 +2965,11 @@ discard block |
||
| 2965 | 2965 | * @order requires that yikes-inc-easy-mailchimp-extender-admin.min.css be enqueued, so we can override the defaults (handle: yikes-inc-easy-mailchimp-extender-admin) |
| 2966 | 2966 | * @return print out custom styles to the admin header to alter the default blue color |
| 2967 | 2967 | */ |
| 2968 | - public function alter_yikes_easy_mc_color_scheme() {
|
|
| 2968 | + public function alter_yikes_easy_mc_color_scheme() { |
|
| 2969 | 2969 | // get the current set color scheme for the logged in user |
| 2970 | 2970 | $current_color_scheme = get_user_option( 'admin_color' ); |
| 2971 | 2971 | // switch over each color scheme, and set our variable |
| 2972 | - switch ( $current_color_scheme ) {
|
|
| 2972 | + switch ( $current_color_scheme ) { |
|
| 2973 | 2973 | default: |
| 2974 | 2974 | case 'fresh': // default blue (defined by this plugin) |
| 2975 | 2975 | $main_color = '#00a0d2'; |
@@ -3017,16 +3017,16 @@ discard block |
||
| 3017 | 3017 | /** |
| 3018 | 3018 | * Display premium support page if any add-ons are installed, otherwise display free support page |
| 3019 | 3019 | */ |
| 3020 | - public function display_support_page_content() {
|
|
| 3020 | + public function display_support_page_content() { |
|
| 3021 | 3021 | |
| 3022 | 3022 | $addons = get_option( 'yikes-easy-mc-active-addons', array() ); |
| 3023 | 3023 | |
| 3024 | 3024 | // If we have premium add-ons... |
| 3025 | - if ( ! empty( $addons ) ) {
|
|
| 3025 | + if ( ! empty( $addons ) ) { |
|
| 3026 | 3026 | |
| 3027 | 3027 | // Add our premium support partial. |
| 3028 | 3028 | include_once( YIKES_MC_PATH . 'admin/partials/helpers/premium-support.php' ); |
| 3029 | - } else {
|
|
| 3029 | + } else { |
|
| 3030 | 3030 | |
| 3031 | 3031 | // Otherwise add our free support partial. |
| 3032 | 3032 | include_once( YIKES_MC_PATH . 'admin/partials/helpers/free-support.php' ); |
@@ -3038,8 +3038,8 @@ discard block |
||
| 3038 | 3038 | * |
| 3039 | 3039 | * @since 6.0.4 |
| 3040 | 3040 | */ |
| 3041 | - public function check_yikes_mc_table_version() {
|
|
| 3042 | - if ( get_option( 'yikes_mc_database_version', '0.00' ) < '1.0' ) {
|
|
| 3041 | + public function check_yikes_mc_table_version() { |
|
| 3042 | + if ( get_option( 'yikes_mc_database_version', '0.00' ) < '1.0' ) { |
|
| 3043 | 3043 | require_once YIKES_MC_PATH . 'includes/class-yikes-inc-easy-mailchimp-extender-activator.php'; |
| 3044 | 3044 | global $wpdb; |
| 3045 | 3045 | Yikes_Inc_Easy_Mailchimp_Extender_Activator::_activate_yikes_easy_mailchimp( $wpdb ); |
@@ -3053,7 +3053,7 @@ discard block |
||
| 3053 | 3053 | * |
| 3054 | 3054 | * @since 6.0.4.4 |
| 3055 | 3055 | */ |
| 3056 | - public function process_subscriber_count_shortcode_in_form_descriptions( $form_description, $form_id ) {
|
|
| 3056 | + public function process_subscriber_count_shortcode_in_form_descriptions( $form_description, $form_id ) { |
|
| 3057 | 3057 | $form_description = str_replace( '[yikes-mailchimp-subscriber-count]', do_shortcode( '[yikes-mailchimp-subscriber-count form="' . $form_id . '"]' ), $form_description ); |
| 3058 | 3058 | return $form_description; |
| 3059 | 3059 | } |
@@ -3063,9 +3063,9 @@ discard block |
||
| 3063 | 3063 | * |
| 3064 | 3064 | * @since 6.0.3 |
| 3065 | 3065 | */ |
| 3066 | - public function generate_edit_forms_upsell_ad() {
|
|
| 3066 | + public function generate_edit_forms_upsell_ad() { |
|
| 3067 | 3067 | $upsell_ads = glob( YIKES_MC_PATH . 'includes/upsells/*.php' ); |
| 3068 | - if ( $upsell_ads && ! empty( $upsell_ads ) ) {
|
|
| 3068 | + if ( $upsell_ads && ! empty( $upsell_ads ) ) { |
|
| 3069 | 3069 | $ad_count = absint( count( $upsell_ads ) - 1 ); |
| 3070 | 3070 | $ad = $upsell_ads[ mt_rand( 0, $ad_count ) ]; |
| 3071 | 3071 | ob_start(); |
@@ -3082,11 +3082,11 @@ discard block |
||
| 3082 | 3082 | * Mainly used when the API key is altered, changed or removed. |
| 3083 | 3083 | * @since 6.1.3 |
| 3084 | 3084 | */ |
| 3085 | - public function delete_yikes_mailchimp_transients() {
|
|
| 3085 | + public function delete_yikes_mailchimp_transients() { |
|
| 3086 | 3086 | |
| 3087 | 3087 | // delete all of the list_id transients. |
| 3088 | 3088 | $list_ids = $this->get_mailchimp_list_ids_on_account(); |
| 3089 | - foreach ( $list_ids as $id ) {
|
|
| 3089 | + foreach ( $list_ids as $id ) { |
|
| 3090 | 3090 | delete_transient( "yikes_eme_list_{$id}" );
|
| 3091 | 3091 | delete_transient( "yikes_eme_merge_variables_{$id}" );
|
| 3092 | 3092 | delete_transient( "yikes_eme_interest_categories_{$id}" );
|
@@ -3106,13 +3106,13 @@ discard block |
||
| 3106 | 3106 | * |
| 3107 | 3107 | * @author Jeremy Pry |
| 3108 | 3108 | */ |
| 3109 | - public function check_db_version() {
|
|
| 3109 | + public function check_db_version() { |
|
| 3110 | 3110 | $option = get_option( 'yikes_easy_mailchimp_extender_version', '0.0.0' ); |
| 3111 | - if ( version_compare( $option, '6.2.0', '<' ) ) {
|
|
| 3111 | + if ( version_compare( $option, '6.2.0', '<' ) ) { |
|
| 3112 | 3112 | $this->convert_db_to_option(); |
| 3113 | 3113 | } |
| 3114 | 3114 | |
| 3115 | - if ( version_compare( $option, YIKES_MC_VERSION, '<' ) ) {
|
|
| 3115 | + if ( version_compare( $option, YIKES_MC_VERSION, '<' ) ) { |
|
| 3116 | 3116 | update_option( 'yikes_easy_mailchimp_extender_version', YIKES_MC_VERSION ); |
| 3117 | 3117 | } |
| 3118 | 3118 | } |
@@ -3122,7 +3122,7 @@ discard block |
||
| 3122 | 3122 | * |
| 3123 | 3123 | * @author Jeremy Pry |
| 3124 | 3124 | */ |
| 3125 | - public function convert_db_to_option() {
|
|
| 3125 | + public function convert_db_to_option() { |
|
| 3126 | 3126 | /** @var wpdb */ |
| 3127 | 3127 | global $wpdb; |
| 3128 | 3128 | |
@@ -3131,11 +3131,11 @@ discard block |
||
| 3131 | 3131 | $form_option = array(); |
| 3132 | 3132 | $form_ids = $db_interface->get_form_ids(); |
| 3133 | 3133 | |
| 3134 | - if ( empty( $form_ids ) ) {
|
|
| 3134 | + if ( empty( $form_ids ) ) { |
|
| 3135 | 3135 | return; |
| 3136 | 3136 | } |
| 3137 | 3137 | |
| 3138 | - foreach ( $form_ids as $form_id ) {
|
|
| 3138 | + foreach ( $form_ids as $form_id ) { |
|
| 3139 | 3139 | $form_option[ $form_id ] = $db_interface->get_form( $form_id ); |
| 3140 | 3140 | } |
| 3141 | 3141 | |
@@ -3147,7 +3147,7 @@ discard block |
||
| 3147 | 3147 | * |
| 3148 | 3148 | * @author Jeremy Pry |
| 3149 | 3149 | */ |
| 3150 | - public function register_optin_widget() {
|
|
| 3150 | + public function register_optin_widget() { |
|
| 3151 | 3151 | register_widget( 'Yikes_Inc_Easy_Mailchimp_Extender_Widget' ); |
| 3152 | 3152 | } |
| 3153 | 3153 | } |
@@ -30,54 +30,54 @@ discard block |
||
| 30 | 30 | $form_submitted = isset( $form_submitted ) ? $form_submitted : 0; |
| 31 | 31 | |
| 32 | 32 | /* If the user hasn't authenticated yet, lets kill off */ |
| 33 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) != 'valid_api_key' ) { |
|
| 34 | - return '<div class="invalid-api-key-error"><p>' . __( "Whoops, you're not connected to MailChimp. You need to enter a valid MailChimp API key." , 'yikes-inc-easy-mailchimp-extender' ) . '</p></div>'; |
|
| 33 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'valid_api_key' ) { |
|
| 34 | + return '<div class="invalid-api-key-error"><p>' . __( "Whoops, you're not connected to MailChimp. You need to enter a valid MailChimp API key.", 'yikes-inc-easy-mailchimp-extender' ) . '</p></div>'; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | // if the user forgot to specify a form ID, lets kill of and warn them. |
| 38 | - if( ! $atts['form'] ) { |
|
| 38 | + if ( ! $atts[ 'form' ] ) { |
|
| 39 | 39 | return __( 'Whoops, it looks like you forgot to specify a form to display.', 'yikes-inc-easy-mailchimp-extender' ); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | // store our variables |
| 43 | - $form_id = (int) $atts['form']; // form id (the id of the form in the database) |
|
| 43 | + $form_id = (int) $atts[ 'form' ]; // form id (the id of the form in the database) |
|
| 44 | 44 | $interface = yikes_easy_mailchimp_extender_get_form_interface(); |
| 45 | 45 | $form_data = $interface->get_form( $form_id ); |
| 46 | 46 | |
| 47 | 47 | // confirm we have some results, or return an error |
| 48 | 48 | if ( empty( $form_data ) ) { |
| 49 | - return __( "Oh no...This form doesn't exist. Head back to the manage forms page and select a different form." , 'yikes-inc-easy-mailchimp-extender' ); |
|
| 49 | + return __( "Oh no...This form doesn't exist. Head back to the manage forms page and select a different form.", 'yikes-inc-easy-mailchimp-extender' ); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /* |
| 53 | 53 | * Check if the user wants to use reCAPTCHA Spam Prevention |
| 54 | 54 | */ |
| 55 | - if ( get_option( 'yikes-mc-recaptcha-status' , '' ) == '1' ) { |
|
| 55 | + if ( get_option( 'yikes-mc-recaptcha-status', '' ) == '1' ) { |
|
| 56 | 56 | // allow users to manually set recaptcha (instead of globally - recaptcha="1"/recaptcha="0" - but still needs to be globally enabled on the settings page) |
| 57 | - if ( $atts['recaptcha'] != '0' ) { |
|
| 57 | + if ( $atts[ 'recaptcha' ] != '0' ) { |
|
| 58 | 58 | // if either of the Private the Secret key is left blank, we should display an error back to the user |
| 59 | - if( get_option( 'yikes-mc-recaptcha-site-key' , '' ) == '' ) { |
|
| 60 | - return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!" , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>'; |
|
| 59 | + if ( get_option( 'yikes-mc-recaptcha-site-key', '' ) == '' ) { |
|
| 60 | + return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!", 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>'; |
|
| 61 | 61 | } |
| 62 | - if( get_option( 'yikes-mc-recaptcha-secret-key' , '' ) == '' ) { |
|
| 63 | - return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA secret key!" , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>'; |
|
| 62 | + if ( get_option( 'yikes-mc-recaptcha-secret-key', '' ) == '' ) { |
|
| 63 | + return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA secret key!", 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>'; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - if( ! empty( $atts['recaptcha_type'] ) ) { |
|
| 67 | - echo $atts['recaptcha_type']; |
|
| 66 | + if ( ! empty( $atts[ 'recaptcha_type' ] ) ) { |
|
| 67 | + echo $atts[ 'recaptcha_type' ]; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // Store the site language (to load recaptcha in a specific language) |
| 71 | 71 | $locale = get_locale(); |
| 72 | 72 | $locale_split = explode( '_', $locale ); |
| 73 | 73 | // Setup reCAPTCHA parameters |
| 74 | - $lang = ( ! empty( $locale_split ) ? $locale_split[0] : $locale ); |
|
| 75 | - $lang = ( ! empty( $atts['recaptcha_lang'] ) ) ? $atts['recaptcha_lang'] : $lang; |
|
| 76 | - $type = ( ! empty( $atts['recaptcha_type'] ) ) ? strtolower( $atts['recaptcha_type'] ) : 'image'; // setup recaptcha type |
|
| 77 | - $theme= ( ! empty( $atts['recaptcha_theme'] ) ) ? strtolower( $atts['recaptcha_theme'] ) : 'light'; // setup recaptcha theme |
|
| 78 | - $size = ( ! empty( $atts['recaptcha_size'] ) ) ? strtolower( $atts['recaptcha_size'] ) : 'normal'; // setup recaptcha size |
|
| 79 | - $data_callback = ( ! empty( $atts['recaptcha_data_callback'] ) ) ? $atts['recaptcha_data_callback'] : false; // setup recaptcha size |
|
| 80 | - $expired_callback = ( ! empty( $atts['recaptcha_expired_callback'] ) ) ? $atts['recaptcha_expired_callback'] : false; // setup recaptcha size |
|
| 74 | + $lang = ( ! empty( $locale_split ) ? $locale_split[ 0 ] : $locale ); |
|
| 75 | + $lang = ( ! empty( $atts[ 'recaptcha_lang' ] ) ) ? $atts[ 'recaptcha_lang' ] : $lang; |
|
| 76 | + $type = ( ! empty( $atts[ 'recaptcha_type' ] ) ) ? strtolower( $atts[ 'recaptcha_type' ] ) : 'image'; // setup recaptcha type |
|
| 77 | + $theme = ( ! empty( $atts[ 'recaptcha_theme' ] ) ) ? strtolower( $atts[ 'recaptcha_theme' ] ) : 'light'; // setup recaptcha theme |
|
| 78 | + $size = ( ! empty( $atts[ 'recaptcha_size' ] ) ) ? strtolower( $atts[ 'recaptcha_size' ] ) : 'normal'; // setup recaptcha size |
|
| 79 | + $data_callback = ( ! empty( $atts[ 'recaptcha_data_callback' ] ) ) ? $atts[ 'recaptcha_data_callback' ] : false; // setup recaptcha size |
|
| 80 | + $expired_callback = ( ! empty( $atts[ 'recaptcha_expired_callback' ] ) ) ? $atts[ 'recaptcha_expired_callback' ] : false; // setup recaptcha size |
|
| 81 | 81 | // Pass the shortcode parameters through a filter |
| 82 | 82 | $recaptcha_shortcode_params = apply_filters( 'yikes-mailchimp-recaptcha-parameters', array( |
| 83 | 83 | 'language' => $lang, |
@@ -86,48 +86,48 @@ discard block |
||
| 86 | 86 | 'size' => $size, |
| 87 | 87 | 'success_callback' => $data_callback, |
| 88 | 88 | 'expired_callback' => $expired_callback, |
| 89 | - ), $atts['form'] ); |
|
| 89 | + ), $atts[ 'form' ] ); |
|
| 90 | 90 | |
| 91 | 91 | // enqueue Google recaptcha JS |
| 92 | - wp_register_script( 'google-recaptcha-js' , 'https://www.google.com/recaptcha/api.js?hl=' . $recaptcha_shortcode_params['language'] . '&onload=renderReCaptchaCallback&render=explicit', array( 'jquery', 'form-submission-helpers' ) , 'all' ); |
|
| 92 | + wp_register_script( 'google-recaptcha-js', 'https://www.google.com/recaptcha/api.js?hl=' . $recaptcha_shortcode_params[ 'language' ] . '&onload=renderReCaptchaCallback&render=explicit', array( 'jquery', 'form-submission-helpers' ), 'all' ); |
|
| 93 | 93 | wp_enqueue_script( 'google-recaptcha-js' ); |
| 94 | - $recaptcha_site_key = get_option( 'yikes-mc-recaptcha-site-key' , '' ); |
|
| 95 | - $recaptcha_box = '<div class="g-recaptcha" data-sitekey="' . esc_attr( $recaptcha_site_key ) . '" data-theme="' . esc_attr( $recaptcha_shortcode_params['theme'] ) . '" data-type="' . esc_attr( $recaptcha_shortcode_params['type'] ) . '" data-size="' . esc_attr( $recaptcha_shortcode_params['size'] ) . '" data-callback="' . esc_attr( $recaptcha_shortcode_params['success_callback'] ) . '" data-expired-callback="' . esc_attr( $recaptcha_shortcode_params['expired_callback'] ) . '"></div>'; |
|
| 94 | + $recaptcha_site_key = get_option( 'yikes-mc-recaptcha-site-key', '' ); |
|
| 95 | + $recaptcha_box = '<div class="g-recaptcha" data-sitekey="' . esc_attr( $recaptcha_site_key ) . '" data-theme="' . esc_attr( $recaptcha_shortcode_params[ 'theme' ] ) . '" data-type="' . esc_attr( $recaptcha_shortcode_params[ 'type' ] ) . '" data-size="' . esc_attr( $recaptcha_shortcode_params[ 'size' ] ) . '" data-callback="' . esc_attr( $recaptcha_shortcode_params[ 'success_callback' ] ) . '" data-expired-callback="' . esc_attr( $recaptcha_shortcode_params[ 'expired_callback' ] ) . '"></div>'; |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | // place our results into a separate variable for easy looping |
| 100 | - $additional_form_settings = ( isset( $form_data['form_settings'] ) ) ? $form_data['form_settings'] : false; |
|
| 100 | + $additional_form_settings = ( isset( $form_data[ 'form_settings' ] ) ) ? $form_data[ 'form_settings' ] : false; |
|
| 101 | 101 | |
| 102 | 102 | // store our options from the additional form settings array |
| 103 | - $form_classes = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-class-names'] : ''; |
|
| 104 | - $inline_form = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-inline-form'] : ''; |
|
| 105 | - $submit_button_type = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-submit-button-type'] : 'text'; |
|
| 106 | - $submit_button_text = ( $additional_form_settings && $additional_form_settings['yikes-easy-mc-submit-button-text'] != '' ) ? esc_attr( $additional_form_settings['yikes-easy-mc-submit-button-text'] ) : __( 'Submit', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 107 | - $submit_button_image = ( $additional_form_settings ) ? esc_url( $additional_form_settings['yikes-easy-mc-submit-button-image'] ) : ''; |
|
| 108 | - $submit_button_classes = ( $additional_form_settings ) ? ' ' . esc_attr( $additional_form_settings['yikes-easy-mc-submit-button-classes'] ) : ''; |
|
| 103 | + $form_classes = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-class-names' ] : ''; |
|
| 104 | + $inline_form = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-inline-form' ] : ''; |
|
| 105 | + $submit_button_type = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-submit-button-type' ] : 'text'; |
|
| 106 | + $submit_button_text = ( $additional_form_settings && $additional_form_settings[ 'yikes-easy-mc-submit-button-text' ] != '' ) ? esc_attr( $additional_form_settings[ 'yikes-easy-mc-submit-button-text' ] ) : __( 'Submit', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 107 | + $submit_button_image = ( $additional_form_settings ) ? esc_url( $additional_form_settings[ 'yikes-easy-mc-submit-button-image' ] ) : ''; |
|
| 108 | + $submit_button_classes = ( $additional_form_settings ) ? ' ' . esc_attr( $additional_form_settings[ 'yikes-easy-mc-submit-button-classes' ] ) : ''; |
|
| 109 | 109 | |
| 110 | 110 | // scheuldes |
| 111 | - $form_schedule_state = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-schedule'] : false; |
|
| 112 | - $form_schedule_start = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-start'] : '';; |
|
| 113 | - $form_schedule_end = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-end'] : ''; |
|
| 114 | - $form_pending_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-pending-message'] : ''; |
|
| 115 | - $form_expired_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-expired-message'] : ''; |
|
| 111 | + $form_schedule_state = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-schedule' ] : false; |
|
| 112 | + $form_schedule_start = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-start' ] : ''; ; |
|
| 113 | + $form_schedule_end = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-end' ] : ''; |
|
| 114 | + $form_pending_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-pending-message' ] : ''; |
|
| 115 | + $form_expired_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-expired-message' ] : ''; |
|
| 116 | 116 | |
| 117 | 117 | // register required |
| 118 | - $form_login_required = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-login-required'] : false; |
|
| 119 | - $form_login_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-login-message'] : ''; |
|
| 118 | + $form_login_required = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-login-required' ] : false; |
|
| 119 | + $form_login_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-login-message' ] : ''; |
|
| 120 | 120 | |
| 121 | 121 | // store number of fields |
| 122 | - $field_count = (int) count( $form_data['fields'] ); |
|
| 122 | + $field_count = (int) count( $form_data[ 'fields' ] ); |
|
| 123 | 123 | |
| 124 | 124 | // confirm we actually have fields, before looping |
| 125 | - if ( isset( $form_data['fields'] ) && ! empty( $form_data['fields'] ) ) { |
|
| 125 | + if ( isset( $form_data[ 'fields' ] ) && ! empty( $form_data[ 'fields' ] ) ) { |
|
| 126 | 126 | // loop over each field, if it's set to hidden -- subtract it from the field count |
| 127 | 127 | // this throws off the layout for inline forms setup below |
| 128 | - foreach ( $form_data['fields'] as $form_field ) { |
|
| 129 | - if ( isset( $form_field['hide'] ) && (string) $form_field['hide'] === '1' ) { |
|
| 130 | - $field_count --; |
|
| 128 | + foreach ( $form_data[ 'fields' ] as $form_field ) { |
|
| 129 | + if ( isset( $form_field[ 'hide' ] ) && (string) $form_field[ 'hide' ] === '1' ) { |
|
| 130 | + $field_count--; |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | } |
@@ -136,8 +136,8 @@ discard block |
||
| 136 | 136 | * If login is required, abort |
| 137 | 137 | * @since 6.0.3.8 |
| 138 | 138 | */ |
| 139 | - if( $form_login_required ) { |
|
| 140 | - if( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) { |
|
| 139 | + if ( $form_login_required ) { |
|
| 140 | + if ( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) { |
|
| 141 | 141 | ob_start(); |
| 142 | 142 | ?> |
| 143 | 143 | <div class="yikes-mailchimp-login-required yikes-mailchimp-form-<?php echo $form_id; ?>-login-required"> |
@@ -153,19 +153,19 @@ discard block |
||
| 153 | 153 | * Check if schedule is set for this form |
| 154 | 154 | * @since 6.0.3.8 |
| 155 | 155 | */ |
| 156 | - if( $form_schedule_state ) { |
|
| 156 | + if ( $form_schedule_state ) { |
|
| 157 | 157 | // store current date |
| 158 | 158 | $current_date = strtotime( current_time( 'm/d/Y g:iA' ) ); |
| 159 | 159 | |
| 160 | 160 | // the the current date is less than the form scheduled start date |
| 161 | - if( $current_date < $form_schedule_start ) { |
|
| 161 | + if ( $current_date < $form_schedule_start ) { |
|
| 162 | 162 | echo apply_filters( 'yikes-mailchimp-frontend-content', $form_pending_message, $form_id, $form_schedule_start ); |
| 163 | 163 | return; |
| 164 | 164 | // abort |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | // The current date is past or equal to the end date, aka form has now expired |
| 168 | - if( $current_date >= $form_schedule_end ) { |
|
| 168 | + if ( $current_date >= $form_schedule_end ) { |
|
| 169 | 169 | echo apply_filters( 'yikes-mailchimp-frontend-content', $form_expired_message, $form_id, $form_schedule_end ); |
| 170 | 170 | return; |
| 171 | 171 | // abort |
@@ -174,14 +174,14 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | // setup the submit button text |
| 176 | 176 | // shortcode parameter takes precedence over option |
| 177 | - $submit = ( ! empty( $atts['submit'] ) ) ? $atts['submit'] : $submit_button_text; |
|
| 177 | + $submit = ( ! empty( $atts[ 'submit' ] ) ) ? $atts[ 'submit' ] : $submit_button_text; |
|
| 178 | 178 | |
| 179 | 179 | /* |
| 180 | 180 | * Check for the constant to prevent styles from loading |
| 181 | 181 | * to exclude styles from loading, add `define( 'YIKES_MAILCHIMP_EXCLUDE_STYLES', true );` to functions.php |
| 182 | 182 | * @since 6.0.3.8 |
| 183 | 183 | */ |
| 184 | - if( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) { |
|
| 184 | + if ( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) { |
|
| 185 | 185 | // enqueue the form styles |
| 186 | 186 | wp_enqueue_style( 'yikes-inc-easy-mailchimp-public-styles', YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-extender-public.min.css' ); |
| 187 | 187 | } |
@@ -189,19 +189,19 @@ discard block |
||
| 189 | 189 | /** |
| 190 | 190 | * Check for form inline parameter |
| 191 | 191 | */ |
| 192 | - $form_inline = ( $atts['inline'] == 1 || $atts['inline'] == 'true' || get_theme_mod( 'form-inline-' . $form_id, '' ) === true ); // form-inline-{$form_id} comes from customizer extension |
|
| 192 | + $form_inline = ( $atts[ 'inline' ] == 1 || $atts[ 'inline' ] == 'true' || get_theme_mod( 'form-inline-' . $form_id, '' ) === true ); // form-inline-{$form_id} comes from customizer extension |
|
| 193 | 193 | // recheck from our form options |
| 194 | 194 | if ( ! $form_inline ) { |
| 195 | - $form_inline = (bool) $additional_form_settings['yikes-easy-mc-inline-form']; |
|
| 195 | + $form_inline = (bool) $additional_form_settings[ 'yikes-easy-mc-inline-form' ]; |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | /* If the current user is logged in, and an admin...lets display our 'Edit Form' link */ |
| 199 | - if( is_user_logged_in() ) { |
|
| 200 | - if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) { |
|
| 199 | + if ( is_user_logged_in() ) { |
|
| 200 | + if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) { |
|
| 201 | 201 | $edit_form_link = '<span class="edit-link">'; |
| 202 | - $edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $atts['form'] ) ) . '" title="' . __( 'Edit' , 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_data['form_name'] ) . '">' . __( 'Edit Form' , 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
| 202 | + $edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $atts[ 'form' ] ) ) . '" title="' . __( 'Edit', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_data[ 'form_name' ] ) . '">' . __( 'Edit Form', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
| 203 | 203 | $edit_form_link .= '</span>'; |
| 204 | - $edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $atts['form'], ucwords( $form_data['form_name'] ) ); |
|
| 204 | + $edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $atts[ 'form' ], ucwords( $form_data[ 'form_name' ] ) ); |
|
| 205 | 205 | } else { |
| 206 | 206 | $edit_form_link = ''; |
| 207 | 207 | } |
@@ -211,16 +211,16 @@ discard block |
||
| 211 | 211 | // or else MailChimp throws errors at you |
| 212 | 212 | // extract our array keys |
| 213 | 213 | // @todo Remove array_keys() and in_array() usage here. |
| 214 | - if( isset( $form_data['fields'] ) && ! empty( $form_data['fields'] ) ) { |
|
| 215 | - $array_keys = array_keys( $form_data['fields'] ); |
|
| 214 | + if ( isset( $form_data[ 'fields' ] ) && ! empty( $form_data[ 'fields' ] ) ) { |
|
| 215 | + $array_keys = array_keys( $form_data[ 'fields' ] ); |
|
| 216 | 216 | // check for EMAIL in that array |
| 217 | - if( !in_array( 'EMAIL', $array_keys ) && !in_array( 'email', $array_keys ) ) { |
|
| 218 | - return '<p>' . __( "An email field is required for all MailChimp forms. Please add an email field to this form." , 'yikes-inc-easy-mailchimp-extender' ) . '</p><p>' . $edit_form_link . '</p>'; |
|
| 217 | + if ( ! in_array( 'EMAIL', $array_keys ) && ! in_array( 'email', $array_keys ) ) { |
|
| 218 | + return '<p>' . __( "An email field is required for all MailChimp forms. Please add an email field to this form.", 'yikes-inc-easy-mailchimp-extender' ) . '</p><p>' . $edit_form_link . '</p>'; |
|
| 219 | 219 | } |
| 220 | 220 | } else { |
| 221 | - $error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
| 222 | - if( is_user_logged_in() ) { |
|
| 223 | - if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) { |
|
| 221 | + $error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form.", 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
| 222 | + if ( is_user_logged_in() ) { |
|
| 223 | + if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) { |
|
| 224 | 224 | return $error . $edit_form_link; |
| 225 | 225 | } |
| 226 | 226 | } else { |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - if( $form_inline ) { |
|
| 231 | + if ( $form_inline ) { |
|
| 232 | 232 | $field_width = (float) ( 100 / $field_count ); |
| 233 | 233 | $submit_button_width = (float) ( 20 / $field_count ); |
| 234 | 234 | $inline_offset = apply_filters( 'yikes-mailchimp-inline-offset', 1.0, $form_id ); |
@@ -293,17 +293,17 @@ discard block |
||
| 293 | 293 | * Set a custom title using custom_title="lorem ipsum" parameter in the shortcode |
| 294 | 294 | * - This takes precedence over the title set |
| 295 | 295 | */ |
| 296 | - if ( $atts['title'] ) { |
|
| 297 | - if ( ! empty( $atts['custom_title'] ) ) { |
|
| 296 | + if ( $atts[ 'title' ] ) { |
|
| 297 | + if ( ! empty( $atts[ 'custom_title' ] ) ) { |
|
| 298 | 298 | /** |
| 299 | 299 | * Filter the title that is displayed through the shortcode. |
| 300 | 300 | * |
| 301 | 301 | * @param string $title The title to display. |
| 302 | 302 | * @param int $form_id The form ID. |
| 303 | 303 | */ |
| 304 | - $title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts['custom_title'] ), $form_id ); |
|
| 304 | + $title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts[ 'custom_title' ] ), $form_id ); |
|
| 305 | 305 | } else { |
| 306 | - $title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_data['form_name'] ), $form_id ); |
|
| 306 | + $title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_data[ 'form_name' ] ), $form_id ); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | echo sprintf( '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-%1$s">%2$s</h3>', $form_id, $title ); |
@@ -313,24 +313,24 @@ discard block |
||
| 313 | 313 | * Allow users to specify a custom description for this form, no html support |
| 314 | 314 | * @since 6.0.3.8 |
| 315 | 315 | */ |
| 316 | - if ( $atts['description'] ) { |
|
| 317 | - if ( ! empty( $atts['custom_description'] ) ) { |
|
| 316 | + if ( $atts[ 'description' ] ) { |
|
| 317 | + if ( ! empty( $atts[ 'custom_description' ] ) ) { |
|
| 318 | 318 | /** |
| 319 | 319 | * Filter the description that is displayed through the shortcode. |
| 320 | 320 | * |
| 321 | 321 | * @param string $title The title to display. |
| 322 | 322 | * @param int $form_id The form ID. |
| 323 | 323 | */ |
| 324 | - $description = apply_filters( 'yikes-mailchimp-form-description', $atts['custom_description'], $form_id ); |
|
| 324 | + $description = apply_filters( 'yikes-mailchimp-form-description', $atts[ 'custom_description' ], $form_id ); |
|
| 325 | 325 | } else { |
| 326 | - $description = apply_filters( 'yikes-mailchimp-form-description', $form_data['form_description'], $form_id ); |
|
| 326 | + $description = apply_filters( 'yikes-mailchimp-form-description', $form_data[ 'form_description' ], $form_id ); |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | echo sprintf( '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-%1$s">%2$s</section>', $form_id, $description ); |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | // Check for AJAX |
| 333 | - if( ( ! empty( $atts['ajax'] ) && $atts['ajax'] == 1 ) || $form_data['submission_settings']['ajax'] == 1 ) { |
|
| 333 | + if ( ( ! empty( $atts[ 'ajax' ] ) && $atts[ 'ajax' ] == 1 ) || $form_data[ 'submission_settings' ][ 'ajax' ] == 1 ) { |
|
| 334 | 334 | |
| 335 | 335 | // Used in `yikes-mailchimp-redirect-url` filter |
| 336 | 336 | // Note: as of 6.4, this is now just the post ID - not the entire post object. |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | |
| 340 | 340 | // enqueue our ajax script |
| 341 | 341 | $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
| 342 | - wp_enqueue_script( 'yikes-easy-mc-ajax' , YIKES_MC_URL . "public/js/yikes-mc-ajax-forms{$min}.js" , array( 'jquery' ), YIKES_MC_VERSION, false ); |
|
| 342 | + wp_enqueue_script( 'yikes-easy-mc-ajax', YIKES_MC_URL . "public/js/yikes-mc-ajax-forms{$min}.js", array( 'jquery' ), YIKES_MC_VERSION, false ); |
|
| 343 | 343 | wp_localize_script( 'yikes-easy-mc-ajax', 'yikes_mailchimp_ajax', array( |
| 344 | 344 | 'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ), |
| 345 | 345 | 'page_data' => apply_filters( 'yikes-mailchimp-page-data', $page_data, $form_id ), |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | // Generic JavaScript functions for interacting with the form |
| 354 | - wp_enqueue_script( 'form-submission-helpers', YIKES_MC_URL . 'public/js/form-submission-helpers.min.js' , array( 'jquery' ), YIKES_MC_VERSION, false ); |
|
| 354 | + wp_enqueue_script( 'form-submission-helpers', YIKES_MC_URL . 'public/js/form-submission-helpers.min.js', array( 'jquery' ), YIKES_MC_VERSION, false ); |
|
| 355 | 355 | wp_localize_script( 'form-submission-helpers', 'form_submission_helpers', array( |
| 356 | 356 | 'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ), |
| 357 | 357 | 'preloader_url' => apply_filters( 'yikes-mailchimp-preloader', esc_url_raw( admin_url( 'images/wpspin_light.gif' ) ) ), |
@@ -369,67 +369,67 @@ discard block |
||
| 369 | 369 | |
| 370 | 370 | // render the form! |
| 371 | 371 | ?> |
| 372 | - <form id="<?php echo sanitize_title( $form_data['form_name'] ); ?>-<?php echo $form_id; ?>" class="yikes-easy-mc-form yikes-easy-mc-form-<?php echo $form_id . ' '; if ( $form_inline ) { echo 'yikes-mailchimp-form-inline '; } echo ' ' . apply_filters( 'yikes-mailchimp-form-class', $form_classes, $form_id ); if( !empty( $_POST ) && $form_submitted == 1 && $form_data['submission_settings']['hide_form_post_signup'] == 1 ) { echo ' yikes-easy-mc-display-none'; } ?>" method="POST" data-attr-form-id="<?php echo esc_attr( $form_id ); ?>"> |
|
| 372 | + <form id="<?php echo sanitize_title( $form_data[ 'form_name' ] ); ?>-<?php echo $form_id; ?>" class="yikes-easy-mc-form yikes-easy-mc-form-<?php echo $form_id . ' '; if ( $form_inline ) { echo 'yikes-mailchimp-form-inline '; } echo ' ' . apply_filters( 'yikes-mailchimp-form-class', $form_classes, $form_id ); if ( ! empty( $_POST ) && $form_submitted == 1 && $form_data[ 'submission_settings' ][ 'hide_form_post_signup' ] == 1 ) { echo ' yikes-easy-mc-display-none'; } ?>" method="POST" data-attr-form-id="<?php echo esc_attr( $form_id ); ?>"> |
|
| 373 | 373 | |
| 374 | 374 | <?php |
| 375 | 375 | // Set a default constant for hidden fields |
| 376 | 376 | $hidden_label_count = 0; |
| 377 | 377 | |
| 378 | 378 | // Loop over our form fields |
| 379 | - foreach( $form_data['fields'] as $field ) { |
|
| 379 | + foreach ( $form_data[ 'fields' ] as $field ) { |
|
| 380 | 380 | // input array |
| 381 | 381 | $field_array = array(); |
| 382 | 382 | // label array |
| 383 | 383 | $label_array = array(); |
| 384 | 384 | // label classes array |
| 385 | 385 | $label_class_array = array(); |
| 386 | - if( $field['additional-classes'] != '' ) { |
|
| 386 | + if ( $field[ 'additional-classes' ] != '' ) { |
|
| 387 | 387 | // split custom classes at spaces |
| 388 | - $custom_classes = explode( ' ' , $field['additional-classes'] ); |
|
| 388 | + $custom_classes = explode( ' ', $field[ 'additional-classes' ] ); |
|
| 389 | 389 | // check our custom class array for field-left/field-right |
| 390 | 390 | // if it's set we need to assign it to our label and remove it from the field classes |
| 391 | 391 | // input half left |
| 392 | - if( in_array( 'field-left-half' , $custom_classes ) ) { |
|
| 392 | + if ( in_array( 'field-left-half', $custom_classes ) ) { |
|
| 393 | 393 | // $label_array['class'] = 'class="field-left-half"'; |
| 394 | - $label_class_array[] = 'field-left-half'; |
|
| 395 | - $key = array_search( 'field-left-half' , $custom_classes ); |
|
| 396 | - unset( $custom_classes[$key] ); |
|
| 394 | + $label_class_array[ ] = 'field-left-half'; |
|
| 395 | + $key = array_search( 'field-left-half', $custom_classes ); |
|
| 396 | + unset( $custom_classes[ $key ] ); |
|
| 397 | 397 | } // input half right |
| 398 | - if( in_array( 'field-right-half' , $custom_classes ) ) { |
|
| 398 | + if ( in_array( 'field-right-half', $custom_classes ) ) { |
|
| 399 | 399 | // $label_array['class'] = 'class="field-right-half"'; |
| 400 | - $label_class_array[] = 'field-right-half'; |
|
| 401 | - $key = array_search( 'field-right-half' , $custom_classes ); |
|
| 402 | - unset( $custom_classes[$key] ); |
|
| 400 | + $label_class_array[ ] = 'field-right-half'; |
|
| 401 | + $key = array_search( 'field-right-half', $custom_classes ); |
|
| 402 | + unset( $custom_classes[ $key ] ); |
|
| 403 | 403 | } // input thirds (1/3 width, floated left) |
| 404 | - if( in_array( 'field-third' , $custom_classes ) ) { |
|
| 404 | + if ( in_array( 'field-third', $custom_classes ) ) { |
|
| 405 | 405 | // $label_array['class'] = 'class="field-third"'; |
| 406 | - $label_class_array[] = 'field-third'; |
|
| 407 | - $key = array_search( 'field-third' , $custom_classes ); |
|
| 408 | - unset( $custom_classes[$key] ); |
|
| 406 | + $label_class_array[ ] = 'field-third'; |
|
| 407 | + $key = array_search( 'field-third', $custom_classes ); |
|
| 408 | + unset( $custom_classes[ $key ] ); |
|
| 409 | 409 | } // 2 column radio |
| 410 | - if( in_array( 'option-2-col' , $custom_classes ) ) { |
|
| 410 | + if ( in_array( 'option-2-col', $custom_classes ) ) { |
|
| 411 | 411 | // $label_array['class'] = 'class="option-2-col"'; |
| 412 | - $label_class_array[] = 'option-2-col'; |
|
| 413 | - $key = array_search( 'option-2-col' , $custom_classes ); |
|
| 414 | - unset( $custom_classes[$key] ); |
|
| 412 | + $label_class_array[ ] = 'option-2-col'; |
|
| 413 | + $key = array_search( 'option-2-col', $custom_classes ); |
|
| 414 | + unset( $custom_classes[ $key ] ); |
|
| 415 | 415 | } // 3 column radio |
| 416 | - if( in_array( 'option-3-col' , $custom_classes ) ) { |
|
| 416 | + if ( in_array( 'option-3-col', $custom_classes ) ) { |
|
| 417 | 417 | // $label_array['class'] = 'class="option-3-col"'; |
| 418 | - $label_class_array[] = 'option-3-col'; |
|
| 419 | - $key = array_search( 'option-3-col' , $custom_classes ); |
|
| 420 | - unset( $custom_classes[$key] ); |
|
| 418 | + $label_class_array[ ] = 'option-3-col'; |
|
| 419 | + $key = array_search( 'option-3-col', $custom_classes ); |
|
| 420 | + unset( $custom_classes[ $key ] ); |
|
| 421 | 421 | } // 4 column radio |
| 422 | - if( in_array( 'option-4-col' , $custom_classes ) ) { |
|
| 422 | + if ( in_array( 'option-4-col', $custom_classes ) ) { |
|
| 423 | 423 | // $label_array['class'] = 'class="option-4-col"'; |
| 424 | - $label_class_array[] = 'option-4-col'; |
|
| 425 | - $key = array_search( 'option-4-col' , $custom_classes ); |
|
| 426 | - unset( $custom_classes[$key] ); |
|
| 424 | + $label_class_array[ ] = 'option-4-col'; |
|
| 425 | + $key = array_search( 'option-4-col', $custom_classes ); |
|
| 426 | + unset( $custom_classes[ $key ] ); |
|
| 427 | 427 | } // inline radio & checkboxes etc |
| 428 | - if( in_array( 'option-inline' , $custom_classes ) ) { |
|
| 428 | + if ( in_array( 'option-inline', $custom_classes ) ) { |
|
| 429 | 429 | // $label_array['class'] = 'class="option-inline"'; |
| 430 | - $label_class_array[] = 'option-inline'; |
|
| 431 | - $key = array_search( 'option-inline' , $custom_classes ); |
|
| 432 | - unset( $custom_classes[$key] ); |
|
| 430 | + $label_class_array[ ] = 'option-inline'; |
|
| 431 | + $key = array_search( 'option-inline', $custom_classes ); |
|
| 432 | + unset( $custom_classes[ $key ] ); |
|
| 433 | 433 | } |
| 434 | 434 | } else { |
| 435 | 435 | $custom_classes = array(); |
@@ -437,19 +437,19 @@ discard block |
||
| 437 | 437 | |
| 438 | 438 | // if the form is set to inline, add the inline class to our labels |
| 439 | 439 | // since @6.0.3.8 |
| 440 | - if( $form_inline ) { |
|
| 441 | - $label_class_array[] = 'label-inline'; |
|
| 440 | + if ( $form_inline ) { |
|
| 441 | + $label_class_array[ ] = 'label-inline'; |
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | - if( isset( $field['hide-label'] ) ) { |
|
| 445 | - if( absint( $field['hide-label'] ) === 1 ) { |
|
| 444 | + if ( isset( $field[ 'hide-label' ] ) ) { |
|
| 445 | + if ( absint( $field[ 'hide-label' ] ) === 1 ) { |
|
| 446 | 446 | $hidden_label_count++; |
| 447 | - $custom_classes[] = 'field-no-label'; |
|
| 447 | + $custom_classes[ ] = 'field-no-label'; |
|
| 448 | 448 | } |
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | /* Store tag variable based on field type */ |
| 452 | - if( isset( $field['merge'] ) ) { |
|
| 452 | + if ( isset( $field[ 'merge' ] ) ) { |
|
| 453 | 453 | $group = ''; |
| 454 | 454 | $tag = 'merge'; |
| 455 | 455 | } else { |
@@ -459,28 +459,28 @@ discard block |
||
| 459 | 459 | |
| 460 | 460 | // build up our array |
| 461 | 461 | $field_id_string = 'yikes-easy-mc-form-' . $form_id . '-' . $field[ $tag ]; |
| 462 | - $field_array['id'] = 'id="' . esc_attr( $field_id_string ) . '" '; |
|
| 463 | - $field_array['name'] = 'name="' . $group . esc_attr( $field[ $tag ] ) . '" '; |
|
| 464 | - $field_array['placeholder'] = isset( $field['placeholder'] ) ? 'placeholder="' . esc_attr( stripslashes( $field['placeholder'] ) ) . '" ' : ''; |
|
| 465 | - $field_array['classes'] = 'class="yikes-easy-mc-'.$field['type'] . ' ' . esc_attr( trim( implode( ' ' , $custom_classes ) ) ) . '" '; |
|
| 462 | + $field_array[ 'id' ] = 'id="' . esc_attr( $field_id_string ) . '" '; |
|
| 463 | + $field_array[ 'name' ] = 'name="' . $group . esc_attr( $field[ $tag ] ) . '" '; |
|
| 464 | + $field_array[ 'placeholder' ] = isset( $field[ 'placeholder' ] ) ? 'placeholder="' . esc_attr( stripslashes( $field[ 'placeholder' ] ) ) . '" ' : ''; |
|
| 465 | + $field_array[ 'classes' ] = 'class="yikes-easy-mc-' . $field[ 'type' ] . ' ' . esc_attr( trim( implode( ' ', $custom_classes ) ) ) . '" '; |
|
| 466 | 466 | |
| 467 | 467 | // email must always be required and visible |
| 468 | - if( $field['type'] == 'email' ) { |
|
| 469 | - $field_array['required'] = 'required="required"'; |
|
| 470 | - $label_array['visible'] = ''; |
|
| 471 | - $label_class_array[] = $field['merge'] . '-label'; |
|
| 472 | - $label_class_array[] = 'yikes-mailchimp-field-required'; |
|
| 468 | + if ( $field[ 'type' ] == 'email' ) { |
|
| 469 | + $field_array[ 'required' ] = 'required="required"'; |
|
| 470 | + $label_array[ 'visible' ] = ''; |
|
| 471 | + $label_class_array[ ] = $field[ 'merge' ] . '-label'; |
|
| 472 | + $label_class_array[ ] = 'yikes-mailchimp-field-required'; |
|
| 473 | 473 | } else { |
| 474 | - $field_array['required'] = isset( $field['require'] ) ? 'required="required"' : ''; |
|
| 475 | - $label_array['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : ''; |
|
| 476 | - $label_class_array[] = ( $tag === 'merge' ) ? $field['merge'] . '-label' : $field['group_id'] . '-label'; |
|
| 477 | - if ( isset( $field['require'] ) ) $label_class_array[] = 'yikes-mailchimp-field-required'; |
|
| 474 | + $field_array[ 'required' ] = isset( $field[ 'require' ] ) ? 'required="required"' : ''; |
|
| 475 | + $label_array[ 'visible' ] = isset( $field[ 'hide' ] ) ? 'style="display:none;"' : ''; |
|
| 476 | + $label_class_array[ ] = ( $tag === 'merge' ) ? $field[ 'merge' ] . '-label' : $field[ 'group_id' ] . '-label'; |
|
| 477 | + if ( isset( $field[ 'require' ] ) ) $label_class_array[ ] = 'yikes-mailchimp-field-required'; |
|
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | // if both hide label and hide field are checked, we gotta hide the field! |
| 481 | - if( isset( $field['hide' ] ) && $field['hide'] == 1 ) { |
|
| 482 | - if( isset( $field['hide-label' ] ) && $field['hide-label'] == 1 ) { |
|
| 483 | - $field_array['visible'] = 'style="display:none;"'; |
|
| 481 | + if ( isset( $field[ 'hide' ] ) && $field[ 'hide' ] == 1 ) { |
|
| 482 | + if ( isset( $field[ 'hide-label' ] ) && $field[ 'hide-label' ] == 1 ) { |
|
| 483 | + $field_array[ 'visible' ] = 'style="display:none;"'; |
|
| 484 | 484 | } |
| 485 | 485 | } |
| 486 | 486 | |
@@ -488,20 +488,20 @@ discard block |
||
| 488 | 488 | $label_class_array = function_exists( 'sanitize_html_class' ) ? array_map( 'sanitize_html_class', $label_class_array ) : $label_class_array; |
| 489 | 489 | |
| 490 | 490 | // Turn the clases into a string |
| 491 | - $label_array['classes'] = 'class="' . implode( ' ', $label_class_array ) . ' "'; |
|
| 491 | + $label_array[ 'classes' ] = 'class="' . implode( ' ', $label_class_array ) . ' "'; |
|
| 492 | 492 | |
| 493 | 493 | // Filter the field array data |
| 494 | 494 | $field_array = apply_filters( 'yikes-mailchimp-field-data', $field_array, $field, $form_id ); |
| 495 | 495 | |
| 496 | 496 | /* Loop Over Standard Fields (aka merge variables) */ |
| 497 | - if( isset( $field['merge'] ) ) { |
|
| 497 | + if ( isset( $field[ 'merge' ] ) ) { |
|
| 498 | 498 | |
| 499 | 499 | // Handle the Description logic in one spot, here: |
| 500 | - $show_description = isset( $field['description'] ) && trim( $field['description'] ) !== '' ? true : false; |
|
| 501 | - $description_above = isset( $field['description_above'] ) && $field['description_above'] === '1' ? true : false; |
|
| 500 | + $show_description = isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) !== '' ? true : false; |
|
| 501 | + $description_above = isset( $field[ 'description_above' ] ) && $field[ 'description_above' ] === '1' ? true : false; |
|
| 502 | 502 | if ( $show_description === true ) { |
| 503 | - $description = '<p class="form-field-description" id="form-field-description-' . $field['merge'] . '">'; |
|
| 504 | - $description .= apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); |
|
| 503 | + $description = '<p class="form-field-description" id="form-field-description-' . $field[ 'merge' ] . '">'; |
|
| 504 | + $description .= apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); |
|
| 505 | 505 | $description .= '</p>'; |
| 506 | 506 | |
| 507 | 507 | /** |
@@ -513,11 +513,11 @@ discard block |
||
| 513 | 513 | * @param string | $field['description'] | The field's description text |
| 514 | 514 | * @param int | $form_id |
| 515 | 515 | */ |
| 516 | - $description = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description-html', $description, esc_attr( stripslashes( $field['description'] ) ), $form_id ); |
|
| 516 | + $description = apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description-html', $description, esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); |
|
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | // loop over our fields by Type |
| 520 | - switch ( $field['type'] ) { |
|
| 520 | + switch ( $field[ 'type' ] ) { |
|
| 521 | 521 | |
| 522 | 522 | default: |
| 523 | 523 | case 'email': |
@@ -525,24 +525,24 @@ discard block |
||
| 525 | 525 | case 'number': |
| 526 | 526 | |
| 527 | 527 | // pass our default value through our filter to parse dynamic data by tag (used solely for 'text' type) |
| 528 | - $default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' ); |
|
| 528 | + $default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' ); |
|
| 529 | 529 | $default_value = apply_filters( 'yikes-mailchimp-process-default-tag', $default_value ); |
| 530 | - $default_value = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-default-value', $default_value, $field, $form_id ); |
|
| 530 | + $default_value = apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-default-value', $default_value, $field, $form_id ); |
|
| 531 | 531 | |
| 532 | 532 | ?> |
| 533 | - <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 533 | + <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 534 | 534 | |
| 535 | 535 | <!-- dictate label visibility --> |
| 536 | - <?php if( !isset( $field['hide-label'] ) ) { ?> |
|
| 537 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 538 | - <?php if( ! isset( $field['hide-label'] ) ) { echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ), $form_id ); } ?> |
|
| 536 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 537 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 538 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ), $form_id ); } ?> |
|
| 539 | 539 | </span> |
| 540 | 540 | <?php } ?> |
| 541 | 541 | |
| 542 | 542 | <!-- Description Above --> |
| 543 | 543 | <?php if ( $show_description === true && $description_above === true ) { echo $description; } ?> |
| 544 | 544 | |
| 545 | - <input <?php echo implode( ' ' , $field_array ); if( $field['type'] != 'email' && $field['type'] != 'number' ) { ?> type="text" <?php } else if( $field['type'] == 'email' ) { ?> type="email" <?php } else { ?> type="number" <?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[$field['merge']] ); } else { echo esc_attr( $default_value ); } ?>"> |
|
| 545 | + <input <?php echo implode( ' ', $field_array ); if ( $field[ 'type' ] != 'email' && $field[ 'type' ] != 'number' ) { ?> type="text" <?php } else if ( $field[ 'type' ] == 'email' ) { ?> type="email" <?php } else { ?> type="number" <?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[ $field[ 'merge' ] ] ); } else { echo esc_attr( $default_value ); } ?>"> |
|
| 546 | 546 | |
| 547 | 547 | <!-- Description Below --> |
| 548 | 548 | <?php if ( $show_description === true && $description_above === false ) { echo $description; } ?> |
@@ -554,23 +554,23 @@ discard block |
||
| 554 | 554 | |
| 555 | 555 | case 'url': |
| 556 | 556 | case 'imageurl': |
| 557 | - $default_value = ( isset( $field['default'] ) ) ? $field['default'] : ''; |
|
| 558 | - $default_value = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-default-value', $default_value, $field, $form_id ); |
|
| 557 | + $default_value = ( isset( $field[ 'default' ] ) ) ? $field[ 'default' ] : ''; |
|
| 558 | + $default_value = apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-default-value', $default_value, $field, $form_id ); |
|
| 559 | 559 | ?> |
| 560 | 560 | |
| 561 | - <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 561 | + <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 562 | 562 | |
| 563 | 563 | <!-- dictate label visibility --> |
| 564 | - <?php if( !isset( $field['hide-label'] ) ) { ?> |
|
| 565 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 566 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
| 564 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 565 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 566 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
| 567 | 567 | </span> |
| 568 | 568 | <?php } ?> |
| 569 | 569 | |
| 570 | 570 | <!-- Description Above --> |
| 571 | 571 | <?php if ( $show_description === true && $description_above === true ) { echo $description; } ?> |
| 572 | 572 | |
| 573 | - <input <?php echo implode( ' ' , $field_array ); ?> type="url" <?php if( $field['type'] == 'url' ) { ?> title="<?php _e( 'Please enter a valid URL to the website.' , 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } else { ?> title="<?php _e( 'Please enter a valid URL to the image.' , 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[$field['merge']] ); } else { echo esc_attr( $default_value ); } ?>" > |
|
| 573 | + <input <?php echo implode( ' ', $field_array ); ?> type="url" <?php if ( $field[ 'type' ] == 'url' ) { ?> title="<?php _e( 'Please enter a valid URL to the website.', 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } else { ?> title="<?php _e( 'Please enter a valid URL to the image.', 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[ $field[ 'merge' ] ] ); } else { echo esc_attr( $default_value ); } ?>" > |
|
| 574 | 574 | |
| 575 | 575 | <!-- Description Below --> |
| 576 | 576 | <?php if ( $show_description === true && $description_above === false ) { echo $description; } ?> |
@@ -581,24 +581,24 @@ discard block |
||
| 581 | 581 | break; |
| 582 | 582 | |
| 583 | 583 | case 'phone': |
| 584 | - $default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' ); |
|
| 585 | - $default_value = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-default-value', $default_value, $field, $form_id ); |
|
| 586 | - $phone_format = $field['phone_format']; |
|
| 584 | + $default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' ); |
|
| 585 | + $default_value = apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-default-value', $default_value, $field, $form_id ); |
|
| 586 | + $phone_format = $field[ 'phone_format' ]; |
|
| 587 | 587 | ?> |
| 588 | 588 | |
| 589 | - <label for="<?php echo esc_attr( $field_id_string ) ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 589 | + <label for="<?php echo esc_attr( $field_id_string ) ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 590 | 590 | |
| 591 | 591 | <!-- dictate label visibility --> |
| 592 | - <?php if( !isset( $field['hide-label'] ) ) { ?> |
|
| 593 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 594 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
| 592 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 593 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 594 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
| 595 | 595 | </span> |
| 596 | 596 | <?php } ?> |
| 597 | 597 | |
| 598 | 598 | <!-- Description Above --> |
| 599 | 599 | <?php if ( $show_description === true && $description_above === true ) { echo $description; } ?> |
| 600 | 600 | |
| 601 | - <input <?php echo implode( ' ' , $field_array ); ?> type="text" <?php if( $phone_format != 'US' ) { ?> data-phone-type="international" title="<?php _e( 'International Phone Number' , 'yikes-inc-easy-mailchimp-extender' ); ?>" pattern="<?php echo apply_filters( 'yikes-mailchimp-international-phone-pattern' , '[0-9,-,+]{1,}' ); ?>" <?php } else { ?> title="<?php _e( 'US Phone Number (###) ### - ####' , 'yikes-inc-easy-mailchimp-extender' ); ?>" data-phone-type="us" pattern="<?php echo apply_filters( 'yikes-mailchimp-us-phone-pattern' , '^(\([0-9]{3}\)|[0-9]{3}-)[0-9]{3}-[0-9]{4}$' ); ?>" <?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[$field['merge']] ); } else { echo esc_attr( $default_value ); } ?>"> |
|
| 601 | + <input <?php echo implode( ' ', $field_array ); ?> type="text" <?php if ( $phone_format != 'US' ) { ?> data-phone-type="international" title="<?php _e( 'International Phone Number', 'yikes-inc-easy-mailchimp-extender' ); ?>" pattern="<?php echo apply_filters( 'yikes-mailchimp-international-phone-pattern', '[0-9,-,+]{1,}' ); ?>" <?php } else { ?> title="<?php _e( 'US Phone Number (###) ### - ####', 'yikes-inc-easy-mailchimp-extender' ); ?>" data-phone-type="us" pattern="<?php echo apply_filters( 'yikes-mailchimp-us-phone-pattern', '^(\([0-9]{3}\)|[0-9]{3}-)[0-9]{3}-[0-9]{4}$' ); ?>" <?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[ $field[ 'merge' ] ] ); } else { echo esc_attr( $default_value ); } ?>"> |
|
| 602 | 602 | |
| 603 | 603 | <!-- Description Below --> |
| 604 | 604 | <?php if ( $show_description === true && $description_above === false ) { echo $description; } ?> |
@@ -608,23 +608,23 @@ discard block |
||
| 608 | 608 | break; |
| 609 | 609 | |
| 610 | 610 | case 'zip': |
| 611 | - $default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' ); |
|
| 612 | - $default_value = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-default-value', $default_value, $field, $form_id ); |
|
| 611 | + $default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' ); |
|
| 612 | + $default_value = apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-default-value', $default_value, $field, $form_id ); |
|
| 613 | 613 | |
| 614 | 614 | ?> |
| 615 | - <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 615 | + <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 616 | 616 | |
| 617 | 617 | <!-- dictate label visibility --> |
| 618 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 619 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 620 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
| 618 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 619 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 620 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
| 621 | 621 | </span> |
| 622 | 622 | <?php } ?> |
| 623 | 623 | |
| 624 | 624 | <!-- Description Above --> |
| 625 | 625 | <?php if ( $show_description === true && $description_above === true ) { echo $description; } ?> |
| 626 | 626 | |
| 627 | - <input <?php echo implode( ' ' , $field_array ); ?> type="text" pattern="\d{5,5}(-\d{4,4})?" title="<?php _e( '5 digit zip code, numbers only' , 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[$field['merge']] ); } else { echo esc_attr( $default_value ); } ?>"> |
|
| 627 | + <input <?php echo implode( ' ', $field_array ); ?> type="text" pattern="\d{5,5}(-\d{4,4})?" title="<?php _e( '5 digit zip code, numbers only', 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[ $field[ 'merge' ] ] ); } else { echo esc_attr( $default_value ); } ?>"> |
|
| 628 | 628 | |
| 629 | 629 | <!-- Description Below --> |
| 630 | 630 | <?php if ( $show_description === true && $description_above === false ) { echo $description; } ?> |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | case 'address': |
| 638 | 638 | |
| 639 | 639 | // required fields |
| 640 | - $required_fields = array( 'addr1' => 'address' , 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip' , 'country' => 'country' ); |
|
| 640 | + $required_fields = array( 'addr1' => 'address', 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip', 'country' => 'country' ); |
|
| 641 | 641 | |
| 642 | 642 | /** |
| 643 | 643 | * Filter to control the default country (the option pre-selected in the country dropdown). |
@@ -653,55 +653,55 @@ discard block |
||
| 653 | 653 | if ( $show_description === true && $description_above === true ) { echo $description; } |
| 654 | 654 | |
| 655 | 655 | // Placeholder logic |
| 656 | - if ( ! empty( $field_array['placeholder'] ) ) { |
|
| 656 | + if ( ! empty( $field_array[ 'placeholder' ] ) ) { |
|
| 657 | 657 | |
| 658 | 658 | $use_address_placeholder = true; |
| 659 | 659 | |
| 660 | 660 | // Don't use the address field's array placeholder - use the custom placeholder |
| 661 | - unset( $field_array['placeholder'] ); |
|
| 661 | + unset( $field_array[ 'placeholder' ] ); |
|
| 662 | 662 | } |
| 663 | 663 | |
| 664 | 664 | // store number for looping |
| 665 | 665 | $x = 1; |
| 666 | - foreach( $required_fields as $type => $label ) { |
|
| 666 | + foreach ( $required_fields as $type => $label ) { |
|
| 667 | 667 | |
| 668 | 668 | // set the field names for the address fields |
| 669 | - $field_array['name'] = 'name="' . $field[$tag] . '[' . $type . ']' . '"'; |
|
| 669 | + $field_array[ 'name' ] = 'name="' . $field[ $tag ] . '[' . $type . ']' . '"'; |
|
| 670 | 670 | |
| 671 | 671 | // Set the placeholder value if we need to |
| 672 | 672 | $placeholder = isset( $use_address_placeholder ) ? apply_filters( 'yikes-mailchimp-address-' . $type . '-placeholder', ucwords( $label ) ) : ''; |
| 673 | 673 | |
| 674 | 674 | // reset the label classes for left-half/right-half for addresses |
| 675 | - if( isset( $label_array['class'] ) ) { |
|
| 675 | + if ( isset( $label_array[ 'class' ] ) ) { |
|
| 676 | 676 | if ( $x % 2 == 0 ) { |
| 677 | - $label_array['class'] = str_replace( 'field-left-half', 'field-right-half', $label_array['class'] ); |
|
| 677 | + $label_array[ 'class' ] = str_replace( 'field-left-half', 'field-right-half', $label_array[ 'class' ] ); |
|
| 678 | 678 | } else { |
| 679 | - $label_array['class'] = str_replace( 'field-right-half', 'field-left-half', $label_array['class'] ); |
|
| 679 | + $label_array[ 'class' ] = str_replace( 'field-right-half', 'field-left-half', $label_array[ 'class' ] ); |
|
| 680 | 680 | } |
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | // Never force addr2 to be required |
| 684 | 684 | if ( $type === 'addr2' ) { |
| 685 | - $field_array['required'] = apply_filters( 'yikes-mailchimp-address-2-required', '', $form_id ); |
|
| 685 | + $field_array[ 'required' ] = apply_filters( 'yikes-mailchimp-address-2-required', '', $form_id ); |
|
| 686 | 686 | } |
| 687 | 687 | |
| 688 | - switch( $type ) { |
|
| 688 | + switch ( $type ) { |
|
| 689 | 689 | |
| 690 | 690 | default: |
| 691 | 691 | case 'addr1': |
| 692 | 692 | case 'addr2': |
| 693 | 693 | case 'city': |
| 694 | 694 | ?> |
| 695 | - <label for="<?php echo esc_attr( $field['merge'] ); ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 695 | + <label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ', $label_array ); ?>> |
|
| 696 | 696 | |
| 697 | 697 | <!-- dictate label visibility --> |
| 698 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 699 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 700 | - <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label' , esc_attr( $label ), $form_id ) ); ?> |
|
| 698 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 699 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 700 | + <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ), $form_id ) ); ?> |
|
| 701 | 701 | </span> |
| 702 | 702 | <?php } ?> |
| 703 | 703 | |
| 704 | - <input <?php echo implode( ' ' , $field_array ); ?> placeholder="<?php echo $placeholder; ?>" type="text" value="<?php if( isset( $_POST[$field['merge']][$type] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[$field['merge']][$type] ); } ?>"> |
|
| 704 | + <input <?php echo implode( ' ', $field_array ); ?> placeholder="<?php echo $placeholder; ?>" type="text" value="<?php if ( isset( $_POST[ $field[ 'merge' ] ][ $type ] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[ $field[ 'merge' ] ][ $type ] ); } ?>"> |
|
| 705 | 705 | |
| 706 | 706 | </label> |
| 707 | 707 | <?php |
@@ -710,16 +710,16 @@ discard block |
||
| 710 | 710 | |
| 711 | 711 | case 'state': |
| 712 | 712 | ?> |
| 713 | - <label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?> data-attr-name="state-dropdown"> |
|
| 713 | + <label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?> data-attr-name="state-dropdown"> |
|
| 714 | 714 | |
| 715 | 715 | <!-- dictate label visibility --> |
| 716 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 717 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 718 | - <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label' , esc_attr( $label ), $form_id ) ); ?> |
|
| 716 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 717 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 718 | + <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ), $form_id ) ); ?> |
|
| 719 | 719 | </span> |
| 720 | 720 | <?php } ?> |
| 721 | 721 | |
| 722 | - <select <?php echo implode( ' ' , $field_array ); ?>> |
|
| 722 | + <select <?php echo implode( ' ', $field_array ); ?>> |
|
| 723 | 723 | <?php |
| 724 | 724 | $state_and_province_list = file_get_contents( YIKES_MC_PATH . 'public/partials/shortcodes/templates/state-and-province-dropdown.php' ); |
| 725 | 725 | /** |
@@ -745,21 +745,21 @@ discard block |
||
| 745 | 745 | case 'zip': |
| 746 | 746 | |
| 747 | 747 | ?> |
| 748 | - <label for="<?php echo esc_attr( $field['merge'] ); ?>" placeholder="<?php echo $placeholder; ?>" <?php echo implode( ' ' , $label_array ); ?> data-attr-name="zip-input"<?php if ( ! isset( $countries_with_zip_code_field[ $default_country ] ) ) { ?> style="display: none;"<?php } ?>> |
|
| 748 | + <label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" placeholder="<?php echo $placeholder; ?>" <?php echo implode( ' ', $label_array ); ?> data-attr-name="zip-input"<?php if ( ! isset( $countries_with_zip_code_field[ $default_country ] ) ) { ?> style="display: none;"<?php } ?>> |
|
| 749 | 749 | |
| 750 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 751 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 752 | - <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label' , esc_attr( $label ), $form_id ) ); ?> |
|
| 750 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 751 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 752 | + <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ), $form_id ) ); ?> |
|
| 753 | 753 | </span> |
| 754 | 754 | <?php } ?> |
| 755 | 755 | |
| 756 | 756 | <?php |
| 757 | 757 | // If zip lookup plugin is installed, the ZIP field comes back as an array and we need to handle it differently... |
| 758 | - if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { |
|
| 759 | - if ( is_array( $_POST[$field['merge']] ) && isset( $_POST[$field['merge']]['zip'] ) ) { |
|
| 760 | - $zip_value = $_POST[$field['merge']]['zip']; |
|
| 758 | + if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { |
|
| 759 | + if ( is_array( $_POST[ $field[ 'merge' ] ] ) && isset( $_POST[ $field[ 'merge' ] ][ 'zip' ] ) ) { |
|
| 760 | + $zip_value = $_POST[ $field[ 'merge' ] ][ 'zip' ]; |
|
| 761 | 761 | } else { |
| 762 | - $zip_value = $_POST[$field['merge']]; |
|
| 762 | + $zip_value = $_POST[ $field[ 'merge' ] ]; |
|
| 763 | 763 | } |
| 764 | 764 | } else { |
| 765 | 765 | |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | } |
| 780 | 780 | ?> |
| 781 | 781 | |
| 782 | - <input <?php echo implode( ' ' , $field_array ); ?> placeholder="<?php echo $placeholder; ?>" type="text" pattern="<?php echo apply_filters( 'yikes-mailchimp-zip-pattern', '\d{5,5}(-\d{4,4})?', $form_id ); ?>" title="<?php _e( '5 digit zip code, numbers only' , 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php echo esc_attr( $zip_value ); ?>"> |
|
| 782 | + <input <?php echo implode( ' ', $field_array ); ?> placeholder="<?php echo $placeholder; ?>" type="text" pattern="<?php echo apply_filters( 'yikes-mailchimp-zip-pattern', '\d{5,5}(-\d{4,4})?', $form_id ); ?>" title="<?php _e( '5 digit zip code, numbers only', 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php echo esc_attr( $zip_value ); ?>"> |
|
| 783 | 783 | |
| 784 | 784 | </label> |
| 785 | 785 | <?php |
@@ -789,16 +789,16 @@ discard block |
||
| 789 | 789 | case 'country': |
| 790 | 790 | ?> |
| 791 | 791 | |
| 792 | - <label for="<?php echo esc_attr( $field['merge'] ); ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 792 | + <label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ', $label_array ); ?>> |
|
| 793 | 793 | |
| 794 | 794 | <!-- dictate label visibility --> |
| 795 | - <?php if( !isset( $field['hide-label'] ) ) { ?> |
|
| 796 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 797 | - <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label' , esc_attr( $label ), $form_id ) ); ?> |
|
| 795 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 796 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 797 | + <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ), $form_id ) ); ?> |
|
| 798 | 798 | </span> |
| 799 | 799 | <?php } ?> |
| 800 | 800 | |
| 801 | - <select <?php echo implode( ' ' , $field_array ); ?> data-country="true"> |
|
| 801 | + <select <?php echo implode( ' ', $field_array ); ?> data-country="true"> |
|
| 802 | 802 | <?php include( YIKES_MC_PATH . 'public/partials/shortcodes/templates/country-dropdown.php' ); ?> |
| 803 | 803 | </select> |
| 804 | 804 | </label> |
@@ -844,40 +844,40 @@ discard block |
||
| 844 | 844 | wp_register_script( 'yikes-datepicker-scripts', YIKES_MC_URL . 'public/js/yikes-datepicker-scripts.min.js', array( 'jquery-ui-datepicker' ), YIKES_MC_VERSION, false ); |
| 845 | 845 | wp_localize_script( 'yikes-datepicker-scripts', 'datepicker_settings', $datepicker_options ); |
| 846 | 846 | wp_enqueue_script( 'yikes-datepicker-scripts' ); |
| 847 | - wp_enqueue_style( 'jquery-datepicker-styles' , YIKES_MC_URL . 'public/css/jquery-ui.min.css' ); |
|
| 848 | - wp_enqueue_style( 'yikes-datepicker-styles' , YIKES_MC_URL . 'public/css/yikes-datepicker-styles.min.css' ); |
|
| 847 | + wp_enqueue_style( 'jquery-datepicker-styles', YIKES_MC_URL . 'public/css/jquery-ui.min.css' ); |
|
| 848 | + wp_enqueue_style( 'yikes-datepicker-styles', YIKES_MC_URL . 'public/css/yikes-datepicker-styles.min.css' ); |
|
| 849 | 849 | |
| 850 | - switch ( $field['type'] ) { |
|
| 850 | + switch ( $field[ 'type' ] ) { |
|
| 851 | 851 | default: |
| 852 | 852 | case 'date': |
| 853 | - $date_format = ( isset( $field['date_format'] ) ) ? $field['date_format'] : 'mm/dd/yyyy'; |
|
| 853 | + $date_format = ( isset( $field[ 'date_format' ] ) ) ? $field[ 'date_format' ] : 'mm/dd/yyyy'; |
|
| 854 | 854 | break; |
| 855 | 855 | |
| 856 | 856 | case 'birthday': |
| 857 | - $date_format = ( isset( $field['date_format'] ) ) ? strtolower( $field['date_format'] ) : 'mm/dd'; |
|
| 857 | + $date_format = ( isset( $field[ 'date_format' ] ) ) ? strtolower( $field[ 'date_format' ] ) : 'mm/dd'; |
|
| 858 | 858 | break; |
| 859 | 859 | } |
| 860 | 860 | |
| 861 | - $default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' ); |
|
| 862 | - $default_value = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-default-value', $default_value, $field, $form_id ); |
|
| 861 | + $default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' ); |
|
| 862 | + $default_value = apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-default-value', $default_value, $field, $form_id ); |
|
| 863 | 863 | |
| 864 | 864 | // store empty number for looping |
| 865 | 865 | $x = 0; |
| 866 | 866 | |
| 867 | 867 | ?> |
| 868 | - <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 868 | + <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 869 | 869 | |
| 870 | 870 | <!-- dictate label visibility --> |
| 871 | - <?php if( !isset( $field['hide-label'] ) ) { ?> |
|
| 872 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 873 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
| 871 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 872 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 873 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
| 874 | 874 | </span> |
| 875 | 875 | <?php } ?> |
| 876 | 876 | |
| 877 | 877 | <!-- Description Above --> |
| 878 | 878 | <?php if ( $show_description === true && $description_above === true ) { echo $description; } ?> |
| 879 | 879 | |
| 880 | - <input <?php echo implode( ' ' , $field_array ); ?> type="text" <?php if( $field['type'] == 'date' ) { ?> data-attr-type="date" <?php } else { ?> data-attr-type="birthday" <?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[$field['merge']] ); } else { echo esc_attr( $default_value ); } ?>" data-date-format="<?php echo esc_attr( strtolower( $date_format ) ); ?>"> |
|
| 880 | + <input <?php echo implode( ' ', $field_array ); ?> type="text" <?php if ( $field[ 'type' ] == 'date' ) { ?> data-attr-type="date" <?php } else { ?> data-attr-type="birthday" <?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[ $field[ 'merge' ] ] ); } else { echo esc_attr( $default_value ); } ?>" data-date-format="<?php echo esc_attr( strtolower( $date_format ) ); ?>"> |
|
| 881 | 881 | |
| 882 | 882 | <!-- Description Below --> |
| 883 | 883 | <?php if ( $show_description === true && $description_above === false ) { echo $description; } ?> |
@@ -888,26 +888,26 @@ discard block |
||
| 888 | 888 | break; |
| 889 | 889 | |
| 890 | 890 | case 'dropdown': |
| 891 | - $no_default = $field['default_choice'] === 'no-default' || isset( $field['default_choice'][0] ) && $field['default_choice'][0] === 'no-default'; |
|
| 892 | - $default_choice = is_array( $field['default_choice'] ) ? $field['default_choice'] : array( $field['default_choice'] ); |
|
| 891 | + $no_default = $field[ 'default_choice' ] === 'no-default' || isset( $field[ 'default_choice' ][ 0 ] ) && $field[ 'default_choice' ][ 0 ] === 'no-default'; |
|
| 892 | + $default_choice = is_array( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : array( $field[ 'default_choice' ] ); |
|
| 893 | 893 | |
| 894 | 894 | // store empty number for looping |
| 895 | 895 | $x = 0; |
| 896 | 896 | ?> |
| 897 | - <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 897 | + <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 898 | 898 | <!-- dictate label visibility --> |
| 899 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 900 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 901 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
| 899 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 900 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 901 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
| 902 | 902 | </span> |
| 903 | 903 | <?php } |
| 904 | 904 | |
| 905 | 905 | // decode for looping |
| 906 | - $choices = json_decode( $field['choices'], true ); |
|
| 906 | + $choices = json_decode( $field[ 'choices' ], true ); |
|
| 907 | 907 | |
| 908 | 908 | // If the form was submitted, but failed, let's default to the chosen option |
| 909 | - if( isset( $_POST[ $field['merge'] ] ) && $form_submitted === 0 ) { |
|
| 910 | - $default_choice = is_array( $_POST[ $field['merge'] ] ) ? $_POST[ $field['merge'] ] : array( $_POST[ $field['merge'] ] ); |
|
| 909 | + if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted === 0 ) { |
|
| 910 | + $default_choice = is_array( $_POST[ $field[ 'merge' ] ] ) ? $_POST[ $field[ 'merge' ] ] : array( $_POST[ $field[ 'merge' ] ] ); |
|
| 911 | 911 | } |
| 912 | 912 | |
| 913 | 913 | ?> |
@@ -915,11 +915,11 @@ discard block |
||
| 915 | 915 | <!-- Description Above --> |
| 916 | 916 | <?php if ( $show_description === true && $description_above === true ) { echo $description; } ?> |
| 917 | 917 | |
| 918 | - <select <?php echo implode( ' ' , $field_array ); ?>> |
|
| 918 | + <select <?php echo implode( ' ', $field_array ); ?>> |
|
| 919 | 919 | <?php |
| 920 | 920 | $no_default_name = apply_filters( 'yikes-mailchimp-dropdown-field-no-default-option-name', __( 'Select...', 'yikes-inc-easy-mailchimp-extender' ), $form_id ); |
| 921 | 921 | echo $no_default === true ? '<option value="">' . $no_default_name . '</option>' : ''; |
| 922 | - foreach( $choices as $choice ) { ?> |
|
| 922 | + foreach ( $choices as $choice ) { ?> |
|
| 923 | 923 | <option |
| 924 | 924 | value="<?php echo esc_attr( $choice ); ?>" |
| 925 | 925 | <?php if ( $no_default !== true && in_array( $x, $default_choice ) || in_array( $choice, $default_choice, true ) ) { echo 'selected="selected"'; } ?>> |
@@ -942,17 +942,17 @@ discard block |
||
| 942 | 942 | case 'radio': |
| 943 | 943 | case 'checkbox': |
| 944 | 944 | // remove the ID (as to not assign the same ID to every radio button) |
| 945 | - unset( $field_array['id'] ); |
|
| 946 | - $choices = json_decode( $field['choices'], true ); |
|
| 945 | + unset( $field_array[ 'id' ] ); |
|
| 946 | + $choices = json_decode( $field[ 'choices' ], true ); |
|
| 947 | 947 | |
| 948 | 948 | // assign a default choice |
| 949 | - $no_default = $field['default_choice'] === 'no-default' || isset( $field['default_choice'][0] ) && $field['default_choice'][0] === 'no-default'; |
|
| 950 | - $default_choice = ( isset( $field['default_choice'] ) && ! empty( $field['default_choice'] ) ) ? $field['default_choice'] : $choices[0]; |
|
| 949 | + $no_default = $field[ 'default_choice' ] === 'no-default' || isset( $field[ 'default_choice' ][ 0 ] ) && $field[ 'default_choice' ][ 0 ] === 'no-default'; |
|
| 950 | + $default_choice = ( isset( $field[ 'default_choice' ] ) && ! empty( $field[ 'default_choice' ] ) ) ? $field[ 'default_choice' ] : $choices[ 0 ]; |
|
| 951 | 951 | $default_choice = ( is_array( $default_choice ) ) ? $default_choice : array( $default_choice ); |
| 952 | 952 | |
| 953 | 953 | // If the form was submitted, but failed, let's default to the chosen option |
| 954 | - if( isset( $_POST[ $field['merge'] ] ) && $form_submitted === 0 ) { |
|
| 955 | - $default_choice = is_array( $_POST[ $field['merge'] ] ) ? $_POST[ $field['merge'] ] : array( $_POST[ $field['merge'] ] ); |
|
| 954 | + if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted === 0 ) { |
|
| 955 | + $default_choice = is_array( $_POST[ $field[ 'merge' ] ] ) ? $_POST[ $field[ 'merge' ] ] : array( $_POST[ $field[ 'merge' ] ] ); |
|
| 956 | 956 | } |
| 957 | 957 | |
| 958 | 958 | $count = count( $choices ); |
@@ -960,28 +960,28 @@ discard block |
||
| 960 | 960 | $x = 0; |
| 961 | 961 | |
| 962 | 962 | ?> |
| 963 | - <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 963 | + <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 964 | 964 | |
| 965 | 965 | <!-- dictate label visibility --> |
| 966 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 967 | - <span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?> checkbox-parent-label"> |
|
| 968 | - <?php echo esc_attr( apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label', stripslashes( $field['label'] ) ) ); ?> |
|
| 966 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 967 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?> checkbox-parent-label"> |
|
| 968 | + <?php echo esc_attr( apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', stripslashes( $field[ 'label' ] ) ) ); ?> |
|
| 969 | 969 | </span> |
| 970 | 970 | <?php } |
| 971 | 971 | |
| 972 | 972 | // <!-- Description Above --> |
| 973 | 973 | if ( $show_description === true && $description_above === true ) { echo $description; } |
| 974 | 974 | |
| 975 | - foreach( $choices as $choice ) { |
|
| 975 | + foreach ( $choices as $choice ) { |
|
| 976 | 976 | ?> |
| 977 | - <label for="<?php echo esc_attr( $field['merge'] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if( $i === $count ) { ?> last-selection<?php } ?>" <?php if( $i == 1 ) { echo $field_array['required']; } ?>> |
|
| 977 | + <label for="<?php echo esc_attr( $field[ 'merge' ] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ', $custom_classes ); if ( $i === $count ) { ?> last-selection<?php } ?>" <?php if ( $i == 1 ) { echo $field_array[ 'required' ]; } ?>> |
|
| 978 | 978 | <input |
| 979 | - type="<?php echo esc_attr( $field['type'] ); ?>" |
|
| 980 | - name="<?php echo esc_attr( $field['merge'] ); ?>" |
|
| 981 | - id="<?php echo esc_attr( $field['merge'] . '-' . $i ); ?>" |
|
| 979 | + type="<?php echo esc_attr( $field[ 'type' ] ); ?>" |
|
| 980 | + name="<?php echo esc_attr( $field[ 'merge' ] ); ?>" |
|
| 981 | + id="<?php echo esc_attr( $field[ 'merge' ] . '-' . $i ); ?>" |
|
| 982 | 982 | <?php if ( $no_default !== true && in_array( $x, $default_choice ) || in_array( $choice, $default_choice, true ) ) { echo 'checked="checked"'; } ?> |
| 983 | 983 | value="<?php echo esc_attr( $choice ); ?>"> |
| 984 | - <span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?>"><?php echo stripslashes( $choice ); ?></span> |
|
| 984 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"><?php echo stripslashes( $choice ); ?></span> |
|
| 985 | 985 | </label> |
| 986 | 986 | <?php |
| 987 | 987 | $i++; |
@@ -1002,11 +1002,11 @@ discard block |
||
| 1002 | 1002 | /**** Interest Groups ****/ |
| 1003 | 1003 | |
| 1004 | 1004 | // Handle the Description logic in one spot, here: |
| 1005 | - $show_description = isset( $field['description'] ) && trim( $field['description'] ) !== '' ? true : false; |
|
| 1006 | - $description_above = isset( $field['description_above'] ) && $field['description_above'] === '1' ? true : false; |
|
| 1005 | + $show_description = isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) !== '' ? true : false; |
|
| 1006 | + $description_above = isset( $field[ 'description_above' ] ) && $field[ 'description_above' ] === '1' ? true : false; |
|
| 1007 | 1007 | if ( $show_description === true ) { |
| 1008 | - $description = '<p class="form-field-description" id="form-field-description-' . $field['group_id'] . '">'; |
|
| 1009 | - $description .= apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); |
|
| 1008 | + $description = '<p class="form-field-description" id="form-field-description-' . $field[ 'group_id' ] . '">'; |
|
| 1009 | + $description .= apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); |
|
| 1010 | 1010 | $description .= '</p>'; |
| 1011 | 1011 | |
| 1012 | 1012 | /** |
@@ -1018,26 +1018,26 @@ discard block |
||
| 1018 | 1018 | * @param string | $field['description'] | The field's description text |
| 1019 | 1019 | * @param int | $form_id |
| 1020 | 1020 | */ |
| 1021 | - $description = apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description-html', $description, esc_attr( stripslashes( $field['description'] ) ), $form_id ); |
|
| 1021 | + $description = apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description-html', $description, esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); |
|
| 1022 | 1022 | } |
| 1023 | 1023 | |
| 1024 | 1024 | // Get the default choice(s) from the field settings and turn them into an array if not already |
| 1025 | - $default_choice = ( isset( $field['default_choice'] ) ) ? $field['default_choice'] : ''; |
|
| 1025 | + $default_choice = ( isset( $field[ 'default_choice' ] ) ) ? $field[ 'default_choice' ] : ''; |
|
| 1026 | 1026 | $default_choice = ( is_array( $default_choice ) ) ? $default_choice : array( $default_choice ); |
| 1027 | 1027 | |
| 1028 | 1028 | // get our groups |
| 1029 | - $groups = ( isset( $field['groups'] ) && ! empty( $field['groups'] ) ) ? json_decode( $field['groups'], true ) : array(); |
|
| 1029 | + $groups = ( isset( $field[ 'groups' ] ) && ! empty( $field[ 'groups' ] ) ) ? json_decode( $field[ 'groups' ], true ) : array(); |
|
| 1030 | 1030 | |
| 1031 | 1031 | $count = count( $groups ); |
| 1032 | 1032 | |
| 1033 | - if( $field['type'] === 'checkboxes' ) { |
|
| 1033 | + if ( $field[ 'type' ] === 'checkboxes' ) { |
|
| 1034 | 1034 | $type = 'checkbox'; |
| 1035 | - } else if( $field['type'] === 'radio' ) { |
|
| 1035 | + } else if ( $field[ 'type' ] === 'radio' ) { |
|
| 1036 | 1036 | $type = 'radio'; |
| 1037 | 1037 | } |
| 1038 | 1038 | |
| 1039 | 1039 | // loop over the interest group field types |
| 1040 | - switch ( $field['type'] ) { |
|
| 1040 | + switch ( $field[ 'type' ] ) { |
|
| 1041 | 1041 | |
| 1042 | 1042 | case 'checkboxes': |
| 1043 | 1043 | case 'radio': |
@@ -1045,11 +1045,11 @@ discard block |
||
| 1045 | 1045 | $x = 1; // used to find the last item of our array |
| 1046 | 1046 | |
| 1047 | 1047 | ?> |
| 1048 | - <label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 1049 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 1048 | + <label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 1049 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 1050 | 1050 | <!-- dictate label visibility --> |
| 1051 | - <span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label"> |
|
| 1052 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
| 1051 | + <span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label"> |
|
| 1052 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
| 1053 | 1053 | </span> |
| 1054 | 1054 | <?php |
| 1055 | 1055 | } |
@@ -1058,8 +1058,8 @@ discard block |
||
| 1058 | 1058 | if ( $show_description === true && $description_above === true ) { echo $description; } |
| 1059 | 1059 | |
| 1060 | 1060 | // Display Submission Errors |
| 1061 | - if( ! empty( $missing_required_checkbox_interest_groups ) ) { |
|
| 1062 | - if( in_array( $field['group_id'], $missing_required_checkbox_interest_groups ) ) { |
|
| 1061 | + if ( ! empty( $missing_required_checkbox_interest_groups ) ) { |
|
| 1062 | + if ( in_array( $field[ 'group_id' ], $missing_required_checkbox_interest_groups ) ) { |
|
| 1063 | 1063 | ?> |
| 1064 | 1064 | <p class="yikes-mailchimp-required-interest-group-error"> |
| 1065 | 1065 | <?php echo apply_filters( 'yikes-mailchimp-interest-group-checkbox-error', __( 'This field is required.', 'yikes-inc-easy-mailchimp-extender' ), $form_id ); ?> |
@@ -1071,20 +1071,20 @@ discard block |
||
| 1071 | 1071 | foreach ( $groups as $group_id => $name ) { |
| 1072 | 1072 | |
| 1073 | 1073 | // If the form was submitted and failed, set the submitted/chosen values as the default |
| 1074 | - if( isset( $_POST[ 'group-' . $field['group_id'] ] ) && $form_submitted === 0 ) { |
|
| 1074 | + if ( isset( $_POST[ 'group-' . $field[ 'group_id' ] ] ) && $form_submitted === 0 ) { |
|
| 1075 | 1075 | |
| 1076 | 1076 | // Format default choice as array |
| 1077 | - $default_choice = ( is_array( $_POST[ 'group-' . $field['group_id'] ] ) ) ? $_POST[ 'group-' . $field['group_id'] ] : array( $_POST[ 'group-' . $field['group_id'] ] ); |
|
| 1077 | + $default_choice = ( is_array( $_POST[ 'group-' . $field[ 'group_id' ] ] ) ) ? $_POST[ 'group-' . $field[ 'group_id' ] ] : array( $_POST[ 'group-' . $field[ 'group_id' ] ] ); |
|
| 1078 | 1078 | } |
| 1079 | 1079 | |
| 1080 | 1080 | ?> |
| 1081 | - <label for="<?php echo esc_attr( $field['group_id'] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if( $x === $count ) { ?> last-selection<?php } ?>"> |
|
| 1081 | + <label for="<?php echo esc_attr( $field[ 'group_id' ] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ', $custom_classes ); if ( $x === $count ) { ?> last-selection<?php } ?>"> |
|
| 1082 | 1082 | <input |
| 1083 | - <?php if( isset( $field['require'] ) && $field['require'] == 1 ) { if ( $field['type'] !== 'checkboxes' ) { ?> required="required" <?php } ?> |
|
| 1083 | + <?php if ( isset( $field[ 'require' ] ) && $field[ 'require' ] == 1 ) { if ( $field[ 'type' ] !== 'checkboxes' ) { ?> required="required" <?php } ?> |
|
| 1084 | 1084 | class="yikes-interest-group-required" <?php } ?> |
| 1085 | 1085 | type="<?php echo esc_attr( $type ); ?>" |
| 1086 | - name="group-<?php echo esc_attr( $field['group_id'] ); ?>[]" |
|
| 1087 | - id="<?php echo esc_attr( $field['group_id'] . '-' . $i ); ?>" |
|
| 1086 | + name="group-<?php echo esc_attr( $field[ 'group_id' ] ); ?>[]" |
|
| 1087 | + id="<?php echo esc_attr( $field[ 'group_id' ] . '-' . $i ); ?>" |
|
| 1088 | 1088 | <?php if ( in_array( $group_id, $default_choice ) ) { echo 'checked="checked"'; } ?> |
| 1089 | 1089 | value="<?php echo esc_attr( $group_id ); ?>"> |
| 1090 | 1090 | <?php echo esc_attr( $name ); ?> |
@@ -1106,32 +1106,32 @@ discard block |
||
| 1106 | 1106 | |
| 1107 | 1107 | ?> |
| 1108 | 1108 | |
| 1109 | - <label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 1109 | + <label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 1110 | 1110 | <!-- dictate label visibility --> |
| 1111 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 1112 | - <span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?>"> |
|
| 1113 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
| 1111 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 1112 | + <span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?>"> |
|
| 1113 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
| 1114 | 1114 | </span> |
| 1115 | 1115 | <?php } ?> |
| 1116 | 1116 | |
| 1117 | 1117 | <!-- Description Above --> |
| 1118 | 1118 | <?php if ( $show_description === true && $description_above === true ) { echo $description; } ?> |
| 1119 | 1119 | |
| 1120 | - <select <?php echo implode( ' ' , $field_array ); ?>> |
|
| 1120 | + <select <?php echo implode( ' ', $field_array ); ?>> |
|
| 1121 | 1121 | |
| 1122 | 1122 | <?php |
| 1123 | - $no_default = $field['default_choice'] === 'no-default' || isset( $field['default_choice'][0] ) && $field['default_choice'][0] === 'no-default'; |
|
| 1123 | + $no_default = $field[ 'default_choice' ] === 'no-default' || isset( $field[ 'default_choice' ][ 0 ] ) && $field[ 'default_choice' ][ 0 ] === 'no-default'; |
|
| 1124 | 1124 | $no_default_name = apply_filters( 'yikes-mailchimp-dropdown-ig-no-default-option-name', __( 'Select...', 'yikes-inc-easy-mailchimp-extender' ), $form_id ); |
| 1125 | 1125 | echo $no_default === true ? '<option value="">' . $no_default_name . '</option>' : ''; |
| 1126 | 1126 | |
| 1127 | 1127 | $i = 0; |
| 1128 | - foreach( $groups as $group_id => $name ) { |
|
| 1128 | + foreach ( $groups as $group_id => $name ) { |
|
| 1129 | 1129 | |
| 1130 | 1130 | // If the form was submitted and failed, set the submitted/chosen values as the default |
| 1131 | - if( isset( $_POST[ 'group-' . $field['group_id'] ] ) && $form_submitted === 0 ) { |
|
| 1131 | + if ( isset( $_POST[ 'group-' . $field[ 'group_id' ] ] ) && $form_submitted === 0 ) { |
|
| 1132 | 1132 | |
| 1133 | 1133 | // Format default choice as array |
| 1134 | - $default_choice = ( is_array( $_POST[ 'group-' . $field['group_id'] ] ) ) ? $_POST[ 'group-' . $field['group_id'] ] : array( $_POST[ 'group-' . $field['group_id'] ] ); |
|
| 1134 | + $default_choice = ( is_array( $_POST[ 'group-' . $field[ 'group_id' ] ] ) ) ? $_POST[ 'group-' . $field[ 'group_id' ] ] : array( $_POST[ 'group-' . $field[ 'group_id' ] ] ); |
|
| 1135 | 1135 | } |
| 1136 | 1136 | ?> |
| 1137 | 1137 | <option |
@@ -1159,12 +1159,12 @@ discard block |
||
| 1159 | 1159 | |
| 1160 | 1160 | ?> |
| 1161 | 1161 | |
| 1162 | - <label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 1162 | + <label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 1163 | 1163 | |
| 1164 | 1164 | <!-- dictate label visibility --> |
| 1165 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 1166 | - <span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label" style="display:none;"> |
|
| 1167 | - <?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
| 1165 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 1166 | + <span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label" style="display:none;"> |
|
| 1167 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
| 1168 | 1168 | </span> |
| 1169 | 1169 | <?php } |
| 1170 | 1170 | |
@@ -1174,17 +1174,17 @@ discard block |
||
| 1174 | 1174 | // Turn $default_choice into an array if it isn't already |
| 1175 | 1175 | $default_choice = ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice : array( $default_choice ); |
| 1176 | 1176 | |
| 1177 | - foreach( $groups as $group_id => $name ) { |
|
| 1177 | + foreach ( $groups as $group_id => $name ) { |
|
| 1178 | 1178 | ?> |
| 1179 | - <label for="<?php echo esc_attr( $field['group_id'] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if ( $x === $count ) { echo ' last-selection'; } ?>" style="display:none;"> |
|
| 1179 | + <label for="<?php echo esc_attr( $field[ 'group_id' ] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ', $custom_classes ); if ( $x === $count ) { echo ' last-selection'; } ?>" style="display:none;"> |
|
| 1180 | 1180 | <input |
| 1181 | 1181 | type="checkbox" |
| 1182 | - name="group-<?php echo esc_attr( $field['group_id'] ); ?>[]" |
|
| 1183 | - id="<?php echo esc_attr( $field['group_id'] ) . '-' . $i; ?>" |
|
| 1182 | + name="group-<?php echo esc_attr( $field[ 'group_id' ] ); ?>[]" |
|
| 1183 | + id="<?php echo esc_attr( $field[ 'group_id' ] ) . '-' . $i; ?>" |
|
| 1184 | 1184 | value="<?php echo esc_attr( $group_id ) ?>" |
| 1185 | 1185 | <?php if ( in_array( $group_id, $default_choice ) ) { echo 'checked="checked"'; } ?> |
| 1186 | 1186 | > |
| 1187 | - <?php echo esc_attr( stripslashes( str_replace( '' , '\'', $name ) ) ); ?> |
|
| 1187 | + <?php echo esc_attr( stripslashes( str_replace( '', '\'', $name ) ) ); ?> |
|
| 1188 | 1188 | </label> |
| 1189 | 1189 | <?php |
| 1190 | 1190 | $i++; |
@@ -1205,11 +1205,11 @@ discard block |
||
| 1205 | 1205 | do_action( 'yikes-mailchimp-additional-form-fields', $form_data ); |
| 1206 | 1206 | |
| 1207 | 1207 | /* if we've enabled reCAPTCHA protection */ |
| 1208 | - if( isset( $recaptcha_box ) ) { |
|
| 1208 | + if ( isset( $recaptcha_box ) ) { |
|
| 1209 | 1209 | echo $recaptcha_box; |
| 1210 | 1210 | } |
| 1211 | - if( is_user_logged_in() ) { |
|
| 1212 | - $admin_class = ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) ? ' admin-logged-in' : ''; |
|
| 1211 | + if ( is_user_logged_in() ) { |
|
| 1212 | + $admin_class = ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) ? ' admin-logged-in' : ''; |
|
| 1213 | 1213 | } else { |
| 1214 | 1214 | $admin_class = ''; |
| 1215 | 1215 | } |
@@ -1219,29 +1219,29 @@ discard block |
||
| 1219 | 1219 | <input type="hidden" name="yikes-mailchimp-honeypot" id="yikes-mailchimp-honeypot" value=""> |
| 1220 | 1220 | |
| 1221 | 1221 | <!-- List ID --> |
| 1222 | - <input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id" value="<?php echo esc_attr( $form_data['list_id'] ); ?>"> |
|
| 1222 | + <input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id" value="<?php echo esc_attr( $form_data[ 'list_id' ] ); ?>"> |
|
| 1223 | 1223 | |
| 1224 | 1224 | <!-- The form that is being submitted! Used to display error/success messages above the correct form --> |
| 1225 | 1225 | <input type="hidden" name="yikes-mailchimp-submitted-form" id="yikes-mailchimp-submitted-form" value="<?php echo esc_attr( $form_id ); ?>"> |
| 1226 | 1226 | |
| 1227 | 1227 | <!-- Submit Button --> |
| 1228 | 1228 | <?php |
| 1229 | - if( $form_inline ) { |
|
| 1229 | + if ( $form_inline ) { |
|
| 1230 | 1230 | $submit_button_label_classes = array( 'empty-label' ); |
| 1231 | 1231 | // If the number of fields, is equal to the hidden label count, add our class |
| 1232 | 1232 | // eg: All field labels are set to hidden. |
| 1233 | 1233 | if ( absint( $field_count ) === absint( $hidden_label_count ) ) { |
| 1234 | - $submit_button_label_classes[] = 'labels-hidden'; |
|
| 1234 | + $submit_button_label_classes[ ] = 'labels-hidden'; |
|
| 1235 | 1235 | } |
| 1236 | 1236 | echo '<label class="empty-form-inline-label submit-button-inline-label"><span class="' . implode( ' ', $submit_button_label_classes ) . '"> </span>'; |
| 1237 | 1237 | } |
| 1238 | 1238 | // display the image or text based button |
| 1239 | - if( $submit_button_type == 'text' ) { |
|
| 1240 | - echo apply_filters( 'yikes-mailchimp-form-submit-button', '<button type="submit" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-' . esc_attr( $form_data['id'] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data['id'] ) . '"> <span class="yikes-mailchimp-submit-button-span-text">' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data['id'] ) . '</span></button>', $form_data['id'] ); |
|
| 1239 | + if ( $submit_button_type == 'text' ) { |
|
| 1240 | + echo apply_filters( 'yikes-mailchimp-form-submit-button', '<button type="submit" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-' . esc_attr( $form_data[ 'id' ] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data[ 'id' ] ) . '"> <span class="yikes-mailchimp-submit-button-span-text">' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data[ 'id' ] ) . '</span></button>', $form_data[ 'id' ] ); |
|
| 1241 | 1241 | } else { |
| 1242 | - echo apply_filters( 'yikes-mailchimp-form-submit-button', '<input type="image" alt="' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data['id'] ) . '" src="' . $submit_button_image . '" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-image yikes-easy-mc-submit-button-' . esc_attr( $form_data['id'] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data['id'] ) . '">', $form_data['id'] ); |
|
| 1242 | + echo apply_filters( 'yikes-mailchimp-form-submit-button', '<input type="image" alt="' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data[ 'id' ] ) . '" src="' . $submit_button_image . '" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-image yikes-easy-mc-submit-button-' . esc_attr( $form_data[ 'id' ] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data[ 'id' ] ) . '">', $form_data[ 'id' ] ); |
|
| 1243 | 1243 | } |
| 1244 | - if( $form_inline ) { |
|
| 1244 | + if ( $form_inline ) { |
|
| 1245 | 1245 | echo '</label>'; |
| 1246 | 1246 | } |
| 1247 | 1247 | ?> |
@@ -1253,8 +1253,8 @@ discard block |
||
| 1253 | 1253 | |
| 1254 | 1254 | <?php |
| 1255 | 1255 | /* If the current user is logged in, and an admin...lets display our 'Edit Form' link */ |
| 1256 | - if( is_user_logged_in() ) { |
|
| 1257 | - if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) { |
|
| 1256 | + if ( is_user_logged_in() ) { |
|
| 1257 | + if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) { |
|
| 1258 | 1258 | echo $edit_form_link; |
| 1259 | 1259 | } |
| 1260 | 1260 | } |
@@ -1270,7 +1270,7 @@ discard block |
||
| 1270 | 1270 | * for non-admins |
| 1271 | 1271 | */ |
| 1272 | 1272 | if ( ! current_user_can( 'manage_options' ) ) { |
| 1273 | - $impressions = $form_data['impressions'] + 1; |
|
| 1273 | + $impressions = $form_data[ 'impressions' ] + 1; |
|
| 1274 | 1274 | $interface->update_form_field( $form_id, 'impressions', $impressions ); |
| 1275 | 1275 | } |
| 1276 | 1276 | |
@@ -474,7 +474,9 @@ discard block |
||
| 474 | 474 | $field_array['required'] = isset( $field['require'] ) ? 'required="required"' : ''; |
| 475 | 475 | $label_array['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : ''; |
| 476 | 476 | $label_class_array[] = ( $tag === 'merge' ) ? $field['merge'] . '-label' : $field['group_id'] . '-label'; |
| 477 | - if ( isset( $field['require'] ) ) $label_class_array[] = 'yikes-mailchimp-field-required'; |
|
| 477 | + if ( isset( $field['require'] ) ) { |
|
| 478 | + $label_class_array[] = 'yikes-mailchimp-field-required'; |
|
| 479 | + } |
|
| 478 | 480 | } |
| 479 | 481 | |
| 480 | 482 | // if both hide label and hide field are checked, we gotta hide the field! |
@@ -761,7 +763,7 @@ discard block |
||
| 761 | 763 | } else { |
| 762 | 764 | $zip_value = $_POST[$field['merge']]; |
| 763 | 765 | } |
| 764 | - } else { |
|
| 766 | + } else { |
|
| 765 | 767 | |
| 766 | 768 | /** |
| 767 | 769 | * A filter to set the default zip code value. |
@@ -1125,7 +1127,7 @@ discard block |
||
| 1125 | 1127 | echo $no_default === true ? '<option value="">' . $no_default_name . '</option>' : ''; |
| 1126 | 1128 | |
| 1127 | 1129 | $i = 0; |
| 1128 | - foreach( $groups as $group_id => $name ) { |
|
| 1130 | + foreach( $groups as $group_id => $name ) { |
|
| 1129 | 1131 | |
| 1130 | 1132 | // If the form was submitted and failed, set the submitted/chosen values as the default |
| 1131 | 1133 | if( isset( $_POST[ 'group-' . $field['group_id'] ] ) && $form_submitted === 0 ) { |
@@ -1174,7 +1176,7 @@ discard block |
||
| 1174 | 1176 | // Turn $default_choice into an array if it isn't already |
| 1175 | 1177 | $default_choice = ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice : array( $default_choice ); |
| 1176 | 1178 | |
| 1177 | - foreach( $groups as $group_id => $name ) { |
|
| 1179 | + foreach( $groups as $group_id => $name ) { |
|
| 1178 | 1180 | ?> |
| 1179 | 1181 | <label for="<?php echo esc_attr( $field['group_id'] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if ( $x === $count ) { echo ' last-selection'; } ?>" style="display:none;"> |
| 1180 | 1182 | <input |
@@ -22,13 +22,13 @@ |
||
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | // Verify Honeypot |
| 25 | - if ( ! empty( $_POST['hp'] ) ) { |
|
| 25 | + if ( ! empty( $_POST[ 'hp' ] ) ) { |
|
| 26 | 26 | wp_send_json_error( '2' ); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | // Get email, list ID |
| 30 | - $email = isset( $_POST['email'] ) ? $_POST['email'] : ''; |
|
| 31 | - $list_id = isset( $_POST['list_id'] ) ? $_POST['list_id'] : ''; |
|
| 30 | + $email = isset( $_POST[ 'email' ] ) ? $_POST[ 'email' ] : ''; |
|
| 31 | + $list_id = isset( $_POST[ 'list_id' ] ) ? $_POST[ 'list_id' ] : ''; |
|
| 32 | 32 | |
| 33 | 33 | if ( empty( $email ) || empty( $list_id ) ) { |
| 34 | 34 | wp_send_json_error( '3' ); |
@@ -12,20 +12,20 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | $values = is_array( $args ) ? array_merge( $defaults, $args ) : $defaults; |
| 14 | 14 | |
| 15 | - if ( empty( $values['list'] ) && empty( $values['form'] ) ) { |
|
| 15 | + if ( empty( $values[ 'list' ] ) && empty( $values[ 'form' ] ) ) { |
|
| 16 | 16 | return '<!-- YIKES Easy Forms Error: no list ID / form ID -->'; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - if ( ! empty( $values['form'] ) ) { |
|
| 19 | + if ( ! empty( $values[ 'form' ] ) ) { |
|
| 20 | 20 | |
| 21 | 21 | // Get the list ID from the form ID |
| 22 | 22 | $interface = yikes_easy_mailchimp_extender_get_form_interface(); |
| 23 | - $form_data = $interface->get_form( $values['form'] ); |
|
| 24 | - $list_id = isset( $form_data['list_id'] ) ? $form_data['list_id'] : null; |
|
| 23 | + $form_data = $interface->get_form( $values[ 'form' ] ); |
|
| 24 | + $list_id = isset( $form_data[ 'list_id' ] ) ? $form_data[ 'list_id' ] : null; |
|
| 25 | 25 | |
| 26 | - } else if ( ! empty( $values['list'] ) ) { |
|
| 26 | + } else if ( ! empty( $values[ 'list' ] ) ) { |
|
| 27 | 27 | |
| 28 | - $list_id = $values['list']; |
|
| 28 | + $list_id = $values[ 'list' ]; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | if ( empty( $list_id ) ) { |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | 'loader' => apply_filters( 'yikes-mailchimp-unsubscribe-loader', YIKES_MC_URL . 'includes/images/ripple.svg' ), |
| 44 | 44 | ) |
| 45 | 45 | ); |
| 46 | - wp_enqueue_script ( 'yikes-mailchimp-unsubscribe-script' ); |
|
| 46 | + wp_enqueue_script( 'yikes-mailchimp-unsubscribe-script' ); |
|
| 47 | 47 | |
| 48 | 48 | // Include our styles |
| 49 | 49 | wp_enqueue_style( 'yikes-mailchimp-unsubscribe-styles', plugin_dir_url( __FILE__ ) . '/unsubscribe.css', array(), YIKES_MC_VERSION, 'all' ); |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | <!-- Email --> |
| 62 | 62 | <?php do_action( 'yikes-mailchimp-unsubscribe-before-email' ); ?> |
| 63 | 63 | <label for="yikes-mailchimp-unsubscribe-email" class="EMAIL-label"> |
| 64 | - <span class="EMAIL-label"><?php echo $values['email_label']; ?></span> |
|
| 65 | - <input name="EMAIL" placeholder="<?php echo $values['email_placeholder']; ?>" class="yikes-mailchimp-unsubscribe-email" id="yikes-mailchimp-unsubscribe-email" required="required" type="email" value="<?php echo esc_attr( apply_filters( 'yikes-mailchimp-unsubscribe-email-default', '' ) ); ?>"> |
|
| 64 | + <span class="EMAIL-label"><?php echo $values[ 'email_label' ]; ?></span> |
|
| 65 | + <input name="EMAIL" placeholder="<?php echo $values[ 'email_placeholder' ]; ?>" class="yikes-mailchimp-unsubscribe-email" id="yikes-mailchimp-unsubscribe-email" required="required" type="email" value="<?php echo esc_attr( apply_filters( 'yikes-mailchimp-unsubscribe-email-default', '' ) ); ?>"> |
|
| 66 | 66 | </label> |
| 67 | 67 | <?php do_action( 'yikes-mailchimp-unsubscribe-after-email' ); ?> |
| 68 | 68 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | <!-- Submit Button --> |
| 76 | 76 | <button type="submit" class="yikes-mailchimp-unsubscribe-submit-button"> |
| 77 | - <span class="yikes-mailchimp-submit-button-span-text"><?php echo $values['submit_label']; ?></span> |
|
| 77 | + <span class="yikes-mailchimp-submit-button-span-text"><?php echo $values[ 'submit_label' ]; ?></span> |
|
| 78 | 78 | </button> |
| 79 | 79 | |
| 80 | 80 | <input type="hidden" class="yikes-mailchimp-unsubscribe-nonce" name="yikes-mailchimp-unsubscribe-nonce" value="<?php echo wp_create_nonce( 'yikes-mailchimp-unsubscribe' ); ?>"> |