@@ -7,12 +7,12 @@ |
||
| 7 | 7 | <div class="wrap"> |
| 8 | 8 | |
| 9 | 9 | <!-- Freddie Logo --> |
| 10 | - <img src="<?php echo esc_url( YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png' ); ?>" alt="<?php esc_attr_e( 'Freddie - MailChimp Mascot' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
| 10 | + <img src="<?php echo esc_url( YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png' ); ?>" alt="<?php esc_attr_e( 'Freddie - MailChimp Mascot', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
| 11 | 11 | |
| 12 | - <h1>YIKES Easy Forms for MailChimp | <?php echo esc_attr__( 'Add-Ons' , 'yikes-inc-easy-mailchimp-extender' ); ?> <a href="https://yikesplugins.com/plugins/?plugins=MailChimp" target="_blank" class="button-primary coming-soon-button" title="<?php esc_attr_e( 'View All Add-Ons' , 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php esc_attr_e( 'View All Add-Ons' , 'yikes-inc-easy-mailchimp-extender' ); ?> <span class="dashicons dashicons-external"></span></a></h1> |
|
| 12 | + <h1>YIKES Easy Forms for MailChimp | <?php echo esc_attr__( 'Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?> <a href="https://yikesplugins.com/plugins/?plugins=MailChimp" target="_blank" class="button-primary coming-soon-button" title="<?php esc_attr_e( 'View All Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php esc_attr_e( 'View All Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?> <span class="dashicons dashicons-external"></span></a></h1> |
|
| 13 | 13 | |
| 14 | 14 | <!-- Addons Page Description --> |
| 15 | - <p class="yikes-easy-mc-about-text about-text"><?php esc_attr_e( "Below you'll find a list of add-ons available for YIKES Easy Forms for MailChimp. Each add-on extends the base functionality of the free plugin." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 15 | + <p class="yikes-easy-mc-about-text about-text"><?php esc_attr_e( "Below you'll find a list of add-ons available for YIKES Easy Forms for MailChimp. Each add-on extends the base functionality of the free plugin.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 16 | 16 | |
| 17 | 17 | <!-- Add-On Container --> |
| 18 | 18 | <section id="add-ons"> |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | |
| 33 | 33 | <div class="addon-footer-wrap give-clearfix"> |
| 34 | 34 | <a href="<?php echo esc_attr( $permalink ); ?>" title="<?php echo esc_attr( $add_on_title ); ?>" class="button-secondary" target="_blank"> |
| 35 | - <?php esc_attr_e( 'View Add-on' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 35 | + <?php esc_attr_e( 'View Add-on', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 36 | 36 | <span class="dashicons dashicons-external"></span></a> |
| 37 | 37 | </div> |
| 38 | 38 | |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | |
| 33 | 33 | <div class="addon-footer-wrap give-clearfix"> |
| 34 | 34 | <a href="<?php echo esc_attr( $permalink ); ?>" title="<?php echo esc_attr( $add_on_title ); ?>" class="button-secondary" target="_blank"> |
| 35 | - <?php esc_attr_e( 'View Add-on' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 35 | + <?php esc_attr_e( 'View Add-on', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 36 | 36 | <span class="dashicons dashicons-external"></span></a> |
| 37 | 37 | </div> |
| 38 | 38 | |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | |
| 33 | 33 | <div class="addon-footer-wrap give-clearfix"> |
| 34 | 34 | <a href="<?php echo esc_attr( $permalink ); ?>" title="<?php echo esc_attr( $add_on_title ); ?>" class="button-secondary" target="_blank"> |
| 35 | - <?php esc_attr_e( 'View Add-on' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 35 | + <?php esc_attr_e( 'View Add-on', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 36 | 36 | <span class="dashicons dashicons-external"></span></a> |
| 37 | 37 | </div> |
| 38 | 38 | |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | |
| 33 | 33 | <div class="addon-footer-wrap give-clearfix"> |
| 34 | 34 | <a href="<?php echo esc_attr( $permalink ); ?>" title="<?php echo esc_attr( $add_on_title ); ?>" class="button-secondary" target="_blank"> |
| 35 | - <?php esc_attr_e( 'View Add-on' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 35 | + <?php esc_attr_e( 'View Add-on', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 36 | 36 | <span class="dashicons dashicons-external"></span></a> |
| 37 | 37 | </div> |
| 38 | 38 | |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | printf( '<h2>' . esc_attr__( 'Popular Knowledge Base Articles', 'yikes-inc-easy-mailchimp-extender' ) . '</h2>' ); |
| 31 | 31 | printf( '<ol>' ); |
| 32 | 32 | foreach ( $knowledge_base_links as $kb_link ) { |
| 33 | - echo wp_kses_post( '<li><a href="' . esc_url( $kb_link['href'] ) . '" title="' . esc_attr( $kb_link['title'] ) . '" target="_blank">' . esc_attr( $kb_link['title'] ) . '</a></li>' ); |
|
| 33 | + echo wp_kses_post( '<li><a href="' . esc_url( $kb_link[ 'href' ] ) . '" title="' . esc_attr( $kb_link[ 'title' ] ) . '" target="_blank">' . esc_attr( $kb_link[ 'title' ] ) . '</a></li>' ); |
|
| 34 | 34 | } |
| 35 | 35 | printf( '</ol>' ); |
| 36 | 36 | } |
@@ -12,42 +12,42 @@ discard block |
||
| 12 | 12 | array( |
| 13 | 13 | 'form' => '', // pass in a form, which will retreive the associated list ID -- takes precendence |
| 14 | 14 | 'list' => '', // pass in a specific list ID |
| 15 | - ), $attributes , 'yikes-mailchimp-subscriber-count' ) |
|
| 15 | + ), $attributes, 'yikes-mailchimp-subscriber-count' ) |
|
| 16 | 16 | ); |
| 17 | 17 | |
| 18 | 18 | /* If the user hasn't authenticated yet - bail */ |
| 19 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) != 'valid_api_key' ) { |
|
| 20 | - if( WP_DEBUG ) { |
|
| 19 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'valid_api_key' ) { |
|
| 20 | + if ( WP_DEBUG ) { |
|
| 21 | 21 | return '<strong>' . __( "You don't appear to be connected to MailChimp.", "yikes-inc-easy-mailchimp-extender" ) . '</strong>'; |
| 22 | 22 | } |
| 23 | 23 | return; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - $form = ( ! empty( $attributes['form'] ) ) ? str_replace( '"', '', $attributes['form'] ) : false; // replace the sanitize quotes to perform a proper query |
|
| 27 | - $list_id = ( ! empty( $attributes['list'] ) ) ? $attributes['list'] : false; |
|
| 26 | + $form = ( ! empty( $attributes[ 'form' ] ) ) ? str_replace( '"', '', $attributes[ 'form' ] ) : false; // replace the sanitize quotes to perform a proper query |
|
| 27 | + $list_id = ( ! empty( $attributes[ 'list' ] ) ) ? $attributes[ 'list' ] : false; |
|
| 28 | 28 | |
| 29 | 29 | /* If no list ID was passed into the shortcode - bail */ |
| 30 | - if( ! $list_id && ! $form) { |
|
| 31 | - if( WP_DEBUG ) { |
|
| 30 | + if ( ! $list_id && ! $form ) { |
|
| 31 | + if ( WP_DEBUG ) { |
|
| 32 | 32 | return '<strong>' . __( 'You forgot to include the list or form ID.', 'yikes-inc-easy-mailchimp-extender' ) . '</strong>'; |
| 33 | 33 | } |
| 34 | 34 | return; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /* if a form ID and a list ID were passed in, use the form ID */ |
| 38 | - if( ( $form ) || ( $form && $list_id ) ) { |
|
| 38 | + if ( ( $form ) || ( $form && $list_id ) ) { |
|
| 39 | 39 | global $wpdb; |
| 40 | 40 | // return it as an array, so we can work with it to build our form below |
| 41 | 41 | $form_results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms WHERE id = ' . $form . '', ARRAY_A ); |
| 42 | 42 | // confirm we have some results, or return an error |
| 43 | - if( ! $form_results ) { |
|
| 44 | - if( WP_DEBUG ) { |
|
| 45 | - 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' ); |
|
| 43 | + if ( ! $form_results ) { |
|
| 44 | + if ( WP_DEBUG ) { |
|
| 45 | + 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' ); |
|
| 46 | 46 | } |
| 47 | 47 | return; |
| 48 | 48 | } |
| 49 | - $form_data = $form_results[0]; |
|
| 50 | - $list_id = sanitize_key( $form_data['list_id'] ); // associated list id (users who fill out the form will be subscribed to this list) |
|
| 49 | + $form_data = $form_results[ 0 ]; |
|
| 50 | + $list_id = sanitize_key( $form_data[ 'list_id' ] ); // associated list id (users who fill out the form will be subscribed to this list) |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | // object buffer |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | // get the api key |
| 60 | 60 | $api_key = yikes_get_mc_api_key(); |
| 61 | 61 | $dash_position = strpos( $api_key, '-' ); |
| 62 | - if( $dash_position !== false ) { |
|
| 62 | + if ( $dash_position !== false ) { |
|
| 63 | 63 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/list.json'; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -76,23 +76,23 @@ discard block |
||
| 76 | 76 | ) ); |
| 77 | 77 | |
| 78 | 78 | $subscriber_count_response = json_decode( wp_remote_retrieve_body( $subscriber_count_response ), true ); |
| 79 | - if( isset( $subscriber_count_response['error'] ) ) { |
|
| 80 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
| 79 | + if ( isset( $subscriber_count_response[ 'error' ] ) ) { |
|
| 80 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
| 81 | 81 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
| 82 | 82 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 83 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $subscriber_count_response['error'], __( "Get Account Lists" , 'yikes-inc-easy-mailchimp-extender' ), "yikes-mailchimp-subscriber-count.php" ); |
|
| 83 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $subscriber_count_response[ 'error' ], __( "Get Account Lists", 'yikes-inc-easy-mailchimp-extender' ), "yikes-mailchimp-subscriber-count.php" ); |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | // if more than one list is returned, something went wrong - bail |
| 87 | - if( $subscriber_count_response['total'] != 1 ) { |
|
| 88 | - if( WP_DEBUG ) { |
|
| 87 | + if ( $subscriber_count_response[ 'total' ] != 1 ) { |
|
| 88 | + if ( WP_DEBUG ) { |
|
| 89 | 89 | return '<strong>' . sprintf( __( "It looks like this list wasn't found. Double check the list with with ID '%s' exists.", "yikes-inc-easy-mailchimp-extender" ), $list_id ) . '</strong>'; |
| 90 | 90 | } |
| 91 | 91 | return; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /* type cast the returned value as an integer */ |
| 95 | - echo (int) apply_filters( 'yikes-mailchimp-subscriber-count-value', $subscriber_count_response['data'][0]['stats']['member_count'] ); |
|
| 95 | + echo (int) apply_filters( 'yikes-mailchimp-subscriber-count-value', $subscriber_count_response[ 'data' ][ 0 ][ 'stats' ][ 'member_count' ] ); |
|
| 96 | 96 | |
| 97 | 97 | } catch ( Exception $error ) { |
| 98 | 98 | echo $error->getMessage(); |
@@ -10,35 +10,35 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | $api_key = yikes_get_mc_api_key(); |
| 12 | 12 | $dash_position = strpos( $api_key, '-' ); |
| 13 | - if( $dash_position !== false ) { |
|
| 13 | + if ( $dash_position !== false ) { |
|
| 14 | 14 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/merge-vars.json'; |
| 15 | 15 | } |
| 16 | 16 | $available_merge_variables = wp_remote_post( $api_endpoint, array( |
| 17 | 17 | 'body' => array( |
| 18 | 18 | 'apikey' => $api_key, |
| 19 | - 'id' => array( $form_data_array['list_id'] ), |
|
| 19 | + 'id' => array( $form_data_array[ 'list_id' ] ), |
|
| 20 | 20 | ), |
| 21 | 21 | 'timeout' => 10, |
| 22 | 22 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) |
| 23 | 23 | ) ); |
| 24 | 24 | $body = json_decode( wp_remote_retrieve_body( $available_merge_variables ), true ); |
| 25 | - if( isset( $body['error'] ) ) { |
|
| 26 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
| 25 | + if ( isset( $body[ 'error' ] ) ) { |
|
| 26 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
| 27 | 27 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
| 28 | 28 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 29 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $body['error'], __( "Get Merge Variables" , 'yikes-inc-easy-mailchimp-extender' ), "process_ajax.php" ); |
|
| 29 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $body[ 'error' ], __( "Get Merge Variables", 'yikes-inc-easy-mailchimp-extender' ), "process_ajax.php" ); |
|
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | // find and return the location of this merge field in the array |
| 33 | - $index = $this->findMCListIndex( $form_data_array['merge_tag'] , $body['data'][0]['merge_vars'], 'tag' ); |
|
| 33 | + $index = $this->findMCListIndex( $form_data_array[ 'merge_tag' ], $body[ 'data' ][ 0 ][ 'merge_vars' ], 'tag' ); |
|
| 34 | 34 | // store it and use it to pre-populate field data (only on initial add to form) |
| 35 | - $merge_field_data = $body['data'][0]['merge_vars'][$index]; |
|
| 35 | + $merge_field_data = $body[ 'data' ][ 0 ][ 'merge_vars' ][ $index ]; |
|
| 36 | 36 | ?> |
| 37 | -<section class="draggable" id="<?php echo $form_data_array['field_name']; ?>"> |
|
| 37 | +<section class="draggable" id="<?php echo $form_data_array[ 'field_name' ]; ?>"> |
|
| 38 | 38 | <!-- top --> |
| 39 | 39 | <a href="#" class="expansion-section-title settings-sidebar"> |
| 40 | - <span class="dashicons dashicons-plus"></span><?php echo $form_data_array['field_name']; ?> |
|
| 41 | - <span class="field-type-text"><small><?php echo __( 'type' , 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $form_data_array['field_type']; ?></small></span> |
|
| 40 | + <span class="dashicons dashicons-plus"></span><?php echo $form_data_array[ 'field_name' ]; ?> |
|
| 41 | + <span class="field-type-text"><small><?php echo __( 'type', 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $form_data_array[ 'field_type' ]; ?></small></span> |
|
| 42 | 42 | </a> |
| 43 | 43 | <!-- expansion section --> |
| 44 | 44 | <div class="yikes-mc-settings-expansion-section"> |
@@ -46,13 +46,13 @@ 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 $form_data_array['field_name']; ?>" /> |
|
| 50 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][type]" value="<?php echo $form_data_array['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 $form_data_array[ 'field_name' ]; ?>" /> |
|
| 50 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][type]" value="<?php echo $form_data_array[ '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_array['field_type'] == 'radio' || $form_data_array['field_type'] == 'dropdown' ) { ?> |
|
| 55 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][choices]" value='<?php echo stripslashes( json_encode( $merge_field_data['choices'] ) ); ?>' /> |
|
| 54 | + <?php if ( $form_data_array[ 'field_type' ] == 'radio' || $form_data_array[ 'field_type' ] == 'dropdown' ) { ?> |
|
| 55 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][choices]" value='<?php echo stripslashes( json_encode( $merge_field_data[ 'choices' ] ) ); ?>' /> |
|
| 56 | 56 | <?php } ?> |
| 57 | 57 | |
| 58 | 58 | <table class="form-table form-field-container"> |
@@ -60,16 +60,16 @@ discard block |
||
| 60 | 60 | <tr valign="top"> |
| 61 | 61 | <td scope="row"> |
| 62 | 62 | <label for="placeholder"> |
| 63 | - <?php _e( 'Placeholder' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 63 | + <?php _e( 'Placeholder', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 64 | 64 | </label> |
| 65 | 65 | </td> |
| 66 | 66 | <td> |
| 67 | - <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'] ) ) : '' ; ?>" /> |
|
| 68 | - <p class="description"><small><?php _e( "Assign a placeholder value to this field.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 67 | + <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' ] ) ) : ''; ?>" /> |
|
| 68 | + <p class="description"><small><?php _e( "Assign a placeholder value to this field.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 69 | 69 | </td> |
| 70 | 70 | </tr> |
| 71 | 71 | <!-- Default Value --> |
| 72 | - <?php switch( $form_data_array['field_type'] ) { |
|
| 72 | + <?php switch ( $form_data_array[ 'field_type' ] ) { |
|
| 73 | 73 | |
| 74 | 74 | default: |
| 75 | 75 | case 'text': |
@@ -77,12 +77,12 @@ discard block |
||
| 77 | 77 | <tr valign="top"> |
| 78 | 78 | <td scope="row"> |
| 79 | 79 | <label for="placeholder"> |
| 80 | - <?php _e( 'Default Value' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 80 | + <?php _e( 'Default Value', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 81 | 81 | </label> |
| 82 | 82 | </td> |
| 83 | 83 | <td> |
| 84 | - <input type="text" class="widefat" name="field[<?php echo $merge_field_data['tag']; ?>][default]" <?php if( $form_data_array['field_type'] != 'url' ) { ?> value="<?php echo isset( $merge_field_data['default'] ) ? stripslashes( wp_strip_all_tags( $merge_field_data['default'] ) ) : ''; ?>" <?php } else { ?> value="<?php echo isset( $merge_field_data['default'] ) ? stripslashes( wp_strip_all_tags( esc_url_raw( $merge_field_data['default'] ) ) ) : ''; } ?>" /> |
|
| 85 | - <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> |
|
| 84 | + <input type="text" class="widefat" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][default]" <?php if ( $form_data_array[ 'field_type' ] != 'url' ) { ?> value="<?php echo isset( $merge_field_data[ 'default' ] ) ? stripslashes( wp_strip_all_tags( $merge_field_data[ 'default' ] ) ) : ''; ?>" <?php } else { ?> value="<?php echo isset( $merge_field_data[ 'default' ] ) ? stripslashes( wp_strip_all_tags( esc_url_raw( $merge_field_data[ 'default' ] ) ) ) : ''; } ?>" /> |
|
| 85 | + <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> |
|
| 86 | 86 | </td> |
| 87 | 87 | </tr> |
| 88 | 88 | <?php |
@@ -93,16 +93,16 @@ discard block |
||
| 93 | 93 | <tr valign="top"> |
| 94 | 94 | <td scope="row"> |
| 95 | 95 | <label for="placeholder"> |
| 96 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 96 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 97 | 97 | </label> |
| 98 | 98 | </td> |
| 99 | 99 | <td> |
| 100 | - <?php foreach( $merge_field_data['choices'] as $choice => $value ) { |
|
| 101 | - $pre_selected = !empty( $merge_field_data['default_choice'] ) ? $merge_field_data['default_choice'] : '0'; |
|
| 100 | + <?php foreach ( $merge_field_data[ 'choices' ] as $choice => $value ) { |
|
| 101 | + $pre_selected = ! empty( $merge_field_data[ 'default_choice' ] ) ? $merge_field_data[ 'default_choice' ] : '0'; |
|
| 102 | 102 | ?> |
| 103 | - <input type="radio" name="field[<?php echo $merge_field_data['tag']; ?>][default_choice]" value="<?php echo $choice; ?>" <?php checked( $pre_selected , $choice ); ?>><?php echo stripslashes( $value ); ?> |
|
| 103 | + <input type="radio" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][default_choice]" value="<?php echo $choice; ?>" <?php checked( $pre_selected, $choice ); ?>><?php echo stripslashes( $value ); ?> |
|
| 104 | 104 | <?php } ?> |
| 105 | - <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 105 | + <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 106 | 106 | </td> |
| 107 | 107 | </tr> |
| 108 | 108 | |
@@ -114,18 +114,18 @@ 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 | - <select type="default" name="field[<?php echo $merge_field_data['tag']; ?>][default_choice]"> |
|
| 122 | - <?php foreach( $merge_field_data['choices'] as $choice => $value ) { |
|
| 123 | - $pre_selected = !empty( $merge_field_data['default_choice'] ) ? $merge_field_data['default_choice'] : '0'; |
|
| 121 | + <select type="default" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][default_choice]"> |
|
| 122 | + <?php foreach ( $merge_field_data[ 'choices' ] as $choice => $value ) { |
|
| 123 | + $pre_selected = ! empty( $merge_field_data[ 'default_choice' ] ) ? $merge_field_data[ 'default_choice' ] : '0'; |
|
| 124 | 124 | ?> |
| 125 | - <option value="<?php echo $choice; ?>" <?php selected( $pre_selected , $choice ); ?>><?php echo stripslashes( $value ); ?></option> |
|
| 125 | + <option value="<?php echo $choice; ?>" <?php selected( $pre_selected, $choice ); ?>><?php echo stripslashes( $value ); ?></option> |
|
| 126 | 126 | <?php } ?> |
| 127 | 127 | </select> |
| 128 | - <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 128 | + <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 129 | 129 | </td> |
| 130 | 130 | </tr> |
| 131 | 131 | |
@@ -139,36 +139,36 @@ discard block |
||
| 139 | 139 | <tr valign="top"> |
| 140 | 140 | <td scope="row"> |
| 141 | 141 | <label for="placeholder"> |
| 142 | - <?php _e( 'Additional Classes' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 142 | + <?php _e( 'Additional Classes', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 143 | 143 | </label> |
| 144 | 144 | </td> |
| 145 | 145 | <td> |
| 146 | - <input type="text" class="widefat" name="field[<?php echo $merge_field_data['tag']; ?>][additional-classes]" value="<?php echo isset( $form_data_array['classes'] ) ? stripslashes( esc_html( $form_data_array['classes'] ) ) : '' ; ?>" /> |
|
| 147 | - <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> |
|
| 146 | + <input type="text" class="widefat" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][additional-classes]" value="<?php echo isset( $form_data_array[ 'classes' ] ) ? stripslashes( esc_html( $form_data_array[ 'classes' ] ) ) : ''; ?>" /> |
|
| 147 | + <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> |
|
| 148 | 148 | </td> |
| 149 | 149 | </tr> |
| 150 | 150 | <!-- Required Toggle --> |
| 151 | 151 | <tr valign="top"> |
| 152 | 152 | <td scope="row"> |
| 153 | 153 | <label for="field-required"> |
| 154 | - <?php _e( 'Field Required?' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 154 | + <?php _e( 'Field Required?', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 155 | 155 | </label> |
| 156 | 156 | </td> |
| 157 | 157 | <td> |
| 158 | - <input type="checkbox" class="widefat" value="1" name="field[<?php echo $merge_field_data['tag']; ?>][require]" <?php checked( $merge_field_data['req'] , 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' ); } ?>"> |
|
| 159 | - <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> |
|
| 158 | + <input type="checkbox" class="widefat" value="1" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][require]" <?php checked( $merge_field_data[ 'req' ], 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' ); } ?>"> |
|
| 159 | + <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> |
|
| 160 | 160 | </td> |
| 161 | 161 | </tr> |
| 162 | 162 | <!-- Visible Toggle --> |
| 163 | 163 | <tr valign="top"> |
| 164 | 164 | <td scope="row"> |
| 165 | 165 | <label for="hide-field"> |
| 166 | - <?php _e( 'Hide Field' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 166 | + <?php _e( 'Hide Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 167 | 167 | </label> |
| 168 | 168 | </td> |
| 169 | 169 | <td> |
| 170 | - <input type="checkbox" class="widefat" value="1" name="field[<?php echo $merge_field_data['tag']; ?>][hide]" <?php if( empty( $merge_field_data['show'] ) ) { echo 'checked="checked"'; } ?> <?php if( $merge_field_data['tag'] == 'EMAIL' ) { ?> disabled="disabled" title="<?php echo __( 'Cannot toggle email field visibility.' , 'yikes-inc-easy-mailchimp-extender' ); } ?>"> |
|
| 171 | - <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 170 | + <input type="checkbox" class="widefat" value="1" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][hide]" <?php if ( empty( $merge_field_data[ 'show' ] ) ) { echo 'checked="checked"'; } ?> <?php if ( $merge_field_data[ 'tag' ] == 'EMAIL' ) { ?> disabled="disabled" title="<?php echo __( 'Cannot toggle email field visibility.', 'yikes-inc-easy-mailchimp-extender' ); } ?>"> |
|
| 171 | + <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 172 | 172 | </td> |
| 173 | 173 | </tr> |
| 174 | 174 | <!-- Toggle Buttons --> |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | </td> |
| 179 | 179 | <td> |
| 180 | 180 | <span class="toggle-container"> |
| 181 | - <a href="#" class="hide-field"><?php _e( "Close" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 182 | - <a href="#" class="remove-field" alt="<?php echo $merge_field_data['tag']; ?>"><?php _e( "Remove Field" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 181 | + <a href="#" class="hide-field"><?php _e( "Close", 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 182 | + <a href="#" class="remove-field" alt="<?php echo $merge_field_data[ 'tag' ]; ?>"><?php _e( "Remove Field", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 183 | 183 | </span> |
| 184 | 184 | </td> |
| 185 | 185 | </tr> |
@@ -3,41 +3,41 @@ discard block |
||
| 3 | 3 | // or build our default selection arrays etc. |
| 4 | 4 | $api_key = yikes_get_mc_api_key(); |
| 5 | 5 | $dash_position = strpos( $api_key, '-' ); |
| 6 | - if( $dash_position !== false ) { |
|
| 6 | + if ( $dash_position !== false ) { |
|
| 7 | 7 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/merge-vars.json'; |
| 8 | 8 | } |
| 9 | 9 | $available_merge_variables = wp_remote_post( $api_endpoint, array( |
| 10 | 10 | 'body' => array( |
| 11 | 11 | 'apikey' => $api_key, |
| 12 | - 'id' => array( $form_data_array['list_id'] ), |
|
| 12 | + 'id' => array( $form_data_array[ 'list_id' ] ), |
|
| 13 | 13 | ), |
| 14 | 14 | 'timeout' => 10, |
| 15 | 15 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) |
| 16 | 16 | ) ); |
| 17 | 17 | $body = json_decode( wp_remote_retrieve_body( $available_merge_variables ), true ); |
| 18 | - if( isset( $body['error'] ) ) { |
|
| 19 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
| 18 | + if ( isset( $body[ 'error' ] ) ) { |
|
| 19 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
| 20 | 20 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
| 21 | 21 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 22 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $body['error'], __( "Get Merge Variables" , 'yikes-inc-easy-mailchimp-extender' ) , __( "Add Field to Form" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 22 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $body[ 'error' ], __( "Get Merge Variables", 'yikes-inc-easy-mailchimp-extender' ), __( "Add Field to Form", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 23 | 23 | } |
| 24 | 24 | ?> |
| 25 | 25 | <section class="draggable" id="error-container"> |
| 26 | - <p><span class="dashicons dashicons-no-alt"></span> <?php printf( __( 'Error: %s', 'yikes-inc-easy-mailchimp-extender' ), $body['error'] ); ?></p> |
|
| 26 | + <p><span class="dashicons dashicons-no-alt"></span> <?php printf( __( 'Error: %s', 'yikes-inc-easy-mailchimp-extender' ), $body[ 'error' ] ); ?></p> |
|
| 27 | 27 | </section> |
| 28 | 28 | <?php |
| 29 | 29 | return; |
| 30 | 30 | } |
| 31 | 31 | // find and return the location of this merge field in the array |
| 32 | - $index = $this->findMCListIndex( $form_data_array['merge_tag'] , $body['data'][0]['merge_vars'], 'tag' ); |
|
| 32 | + $index = $this->findMCListIndex( $form_data_array[ 'merge_tag' ], $body[ 'data' ][ 0 ][ 'merge_vars' ], 'tag' ); |
|
| 33 | 33 | // store it and use it to pre-populate field data (only on initial add to form) |
| 34 | - $merge_field_data = $body['data'][0]['merge_vars'][$index]; |
|
| 34 | + $merge_field_data = $body[ 'data' ][ 0 ][ 'merge_vars' ][ $index ]; |
|
| 35 | 35 | ?> |
| 36 | -<section class="draggable" id="<?php echo $form_data_array['field_name']; ?>"> |
|
| 36 | +<section class="draggable" id="<?php echo $form_data_array[ 'field_name' ]; ?>"> |
|
| 37 | 37 | <!-- top --> |
| 38 | 38 | <a href="#" class="expansion-section-title settings-sidebar"> |
| 39 | - <span class="dashicons dashicons-plus" title="<?php _e( 'Expand Field' , 'yikes-inc-easy-mailchimp-extender' ); ?>"></span><?php echo stripslashes( $form_data_array['field_name'] ); ?> |
|
| 40 | - <span class="field-type-text"><small><?php echo __( 'type' , 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $form_data_array['field_type']; ?></small></span> |
|
| 39 | + <span class="dashicons dashicons-plus" title="<?php _e( 'Expand Field', 'yikes-inc-easy-mailchimp-extender' ); ?>"></span><?php echo stripslashes( $form_data_array[ 'field_name' ] ); ?> |
|
| 40 | + <span class="field-type-text"><small><?php echo __( 'type', 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $form_data_array[ 'field_type' ]; ?></small></span> |
|
| 41 | 41 | </a> |
| 42 | 42 | <!-- expansion section --> |
| 43 | 43 | <div class="yikes-mc-settings-expansion-section"> |
@@ -45,14 +45,14 @@ discard block |
||
| 45 | 45 | <!-- Single or Double Opt-in --> |
| 46 | 46 | <p class="type-container form-field-container"><!-- necessary to prevent skipping on slideToggle(); --> |
| 47 | 47 | <!-- store the label --> |
| 48 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][label]" value="<?php echo $form_data_array['field_name']; ?>" /> |
|
| 49 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][type]" value="<?php echo $form_data_array['field_type']; ?>" /> |
|
| 50 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][merge]" value="<?php echo $merge_field_data['tag']; ?>" /> |
|
| 51 | - <input type="hidden" class="field-<?php echo $merge_field_data['tag']; ?>-position position-input" name="field[<?php echo $merge_field_data['tag']; ?>][position]" value="" /> |
|
| 48 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][label]" value="<?php echo $form_data_array[ 'field_name' ]; ?>" /> |
|
| 49 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][type]" value="<?php echo $form_data_array[ 'field_type' ]; ?>" /> |
|
| 50 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][merge]" value="<?php echo $merge_field_data[ 'tag' ]; ?>" /> |
|
| 51 | + <input type="hidden" class="field-<?php echo $merge_field_data[ 'tag' ]; ?>-position position-input" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][position]" value="" /> |
|
| 52 | 52 | |
| 53 | - <?php if ( $form_data_array['field_type'] == 'radio' || $form_data_array['field_type'] == 'dropdown' ) { ?> |
|
| 54 | - <?php $choices = ( isset( $merge_field_data['choices'] ) ) ? esc_attr( json_encode( $merge_field_data['choices'] ) ) : ''; ?> |
|
| 55 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][choices]" value='<?php echo $choices; ?>' /> |
|
| 53 | + <?php if ( $form_data_array[ 'field_type' ] == 'radio' || $form_data_array[ 'field_type' ] == 'dropdown' ) { ?> |
|
| 54 | + <?php $choices = ( isset( $merge_field_data[ 'choices' ] ) ) ? esc_attr( json_encode( $merge_field_data[ 'choices' ] ) ) : ''; ?> |
|
| 55 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][choices]" value='<?php echo $choices; ?>' /> |
|
| 56 | 56 | <?php } ?> |
| 57 | 57 | |
| 58 | 58 | <table class="form-table form-field-container"> |
@@ -61,15 +61,15 @@ discard block |
||
| 61 | 61 | <tr valign="top"> |
| 62 | 62 | <td scope="row"> |
| 63 | 63 | <label for="merge-tag"> |
| 64 | - <?php _e( 'Merge Tag' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 64 | + <?php _e( 'Merge Tag', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 65 | 65 | </label> |
| 66 | 66 | </td> |
| 67 | 67 | <td> |
| 68 | - <input class="widefat merge-tag-text" type="text" readonly value="<?php echo $merge_field_data['tag']; ?>"> |
|
| 68 | + <input class="widefat merge-tag-text" type="text" readonly value="<?php echo $merge_field_data[ 'tag' ]; ?>"> |
|
| 69 | 69 | </td> |
| 70 | 70 | </tr> |
| 71 | 71 | |
| 72 | - <?php switch( $form_data_array['field_type'] ) { |
|
| 72 | + <?php switch ( $form_data_array[ 'field_type' ] ) { |
|
| 73 | 73 | |
| 74 | 74 | default: |
| 75 | 75 | 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_array['field_type'] ) { |
|
| 104 | + switch ( $form_data_array[ '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['dateformat'] ) ) ? $merge_field_data['dateformat'] : 'MM/DD/YYYY'; |
|
| 108 | + $date_format = ( isset( $merge_field_data[ 'dateformat' ] ) ) ? $merge_field_data[ 'dateformat' ] : 'MM/DD/YYYY'; |
|
| 109 | 109 | ?> |
| 110 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][date_format]" value="<?php echo strtolower( $merge_field_data['dateformat'] ); ?>" /> |
|
| 110 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][date_format]" value="<?php echo strtolower( $merge_field_data[ 'dateformat' ] ); ?>" /> |
|
| 111 | 111 | <?php |
| 112 | 112 | break; |
| 113 | 113 | |
| 114 | 114 | case 'birthday': |
| 115 | - $date_format = ( isset( $merge_field_data['dateformat'] ) ) ? $merge_field_data['dateformat'] : 'MM/DD'; |
|
| 115 | + $date_format = ( isset( $merge_field_data[ 'dateformat' ] ) ) ? $merge_field_data[ '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['phoneformat']; ?>" /> |
|
| 124 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][phone_format]" value="<?php echo $merge_field_data[ 'phoneformat' ]; ?>" /> |
|
| 125 | 125 | <?php |
| 126 | 126 | break; |
| 127 | 127 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | ?> |
| 133 | 133 | |
| 134 | 134 | <!-- Default Value --> |
| 135 | - <?php switch( $form_data_array['field_type'] ) { |
|
| 135 | + <?php switch ( $form_data_array[ 'field_type' ] ) { |
|
| 136 | 136 | |
| 137 | 137 | default: |
| 138 | 138 | case 'text': |
@@ -140,17 +140,17 @@ discard block |
||
| 140 | 140 | <tr valign="top"> |
| 141 | 141 | <td scope="row"> |
| 142 | 142 | <label for="placeholder"> |
| 143 | - <?php _e( 'Default Value' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 143 | + <?php _e( 'Default Value', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 144 | 144 | </label> |
| 145 | 145 | </td> |
| 146 | 146 | <td> |
| 147 | - <input type="text" class="widefat" name="field[<?php echo $merge_field_data['tag']; ?>][default]" <?php if( $form_data_array['field_type'] != 'url' ) { ?> value="<?php echo isset( $merge_field_data['default'] ) ? stripslashes( wp_strip_all_tags( $merge_field_data['default'] ) ) : ''; ?>" <?php } else { ?> value="<?php echo isset( $merge_field_data['default'] ) ? stripslashes( wp_strip_all_tags( esc_url_raw( $merge_field_data['default'] ) ) ) : ''; } ?>" /> |
|
| 148 | - <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> |
|
| 147 | + <input type="text" class="widefat" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][default]" <?php if ( $form_data_array[ 'field_type' ] != 'url' ) { ?> value="<?php echo isset( $merge_field_data[ 'default' ] ) ? stripslashes( wp_strip_all_tags( $merge_field_data[ 'default' ] ) ) : ''; ?>" <?php } else { ?> value="<?php echo isset( $merge_field_data[ 'default' ] ) ? stripslashes( wp_strip_all_tags( esc_url_raw( $merge_field_data[ 'default' ] ) ) ) : ''; } ?>" /> |
|
| 148 | + <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> |
|
| 149 | 149 | <?php |
| 150 | - switch( $form_data_array['field_type'] ) { |
|
| 150 | + switch ( $form_data_array[ 'field_type' ] ) { |
|
| 151 | 151 | case 'text': |
| 152 | 152 | ?> |
| 153 | - <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> |
|
| 153 | + <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> |
|
| 154 | 154 | <?php |
| 155 | 155 | break; |
| 156 | 156 | } ?> |
@@ -164,20 +164,20 @@ discard block |
||
| 164 | 164 | <tr valign="top"> |
| 165 | 165 | <td scope="row"> |
| 166 | 166 | <label for="placeholder"> |
| 167 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 167 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 168 | 168 | </label> |
| 169 | 169 | </td> |
| 170 | 170 | <td> |
| 171 | 171 | <?php |
| 172 | 172 | $x = 0; |
| 173 | - foreach( $merge_field_data['choices'] as $choice => $value ) { |
|
| 174 | - $pre_selected = !empty( $merge_field_data['default_choice'] ) ? $merge_field_data['default_choice'] : '0'; |
|
| 173 | + foreach ( $merge_field_data[ 'choices' ] as $choice => $value ) { |
|
| 174 | + $pre_selected = ! empty( $merge_field_data[ 'default_choice' ] ) ? $merge_field_data[ 'default_choice' ] : '0'; |
|
| 175 | 175 | ?> |
| 176 | 176 | <label> |
| 177 | - <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; ?> |
|
| 177 | + <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; ?> |
|
| 178 | 178 | </label> |
| 179 | 179 | <?php $x++; } ?> |
| 180 | - <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 180 | + <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 181 | 181 | </td> |
| 182 | 182 | </tr> |
| 183 | 183 | |
@@ -189,18 +189,18 @@ discard block |
||
| 189 | 189 | <tr valign="top"> |
| 190 | 190 | <td scope="row"> |
| 191 | 191 | <label for="placeholder"> |
| 192 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 192 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 193 | 193 | </label> |
| 194 | 194 | </td> |
| 195 | 195 | <td> |
| 196 | - <select type="default" name="field[<?php echo $merge_field_data['tag']; ?>][default_choice]"> |
|
| 197 | - <?php foreach( $merge_field_data['choices'] as $choice => $value ) { |
|
| 198 | - $pre_selected = ! empty( $merge_field_data['default_choice'] ) ? $merge_field_data['default_choice'] : '0'; |
|
| 196 | + <select type="default" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][default_choice]"> |
|
| 197 | + <?php foreach ( $merge_field_data[ 'choices' ] as $choice => $value ) { |
|
| 198 | + $pre_selected = ! empty( $merge_field_data[ 'default_choice' ] ) ? $merge_field_data[ 'default_choice' ] : '0'; |
|
| 199 | 199 | ?> |
| 200 | - <option value="<?php echo $choice; ?>" <?php selected( $pre_selected , $choice ); ?>><?php echo stripslashes( $value ); ?></option> |
|
| 200 | + <option value="<?php echo $choice; ?>" <?php selected( $pre_selected, $choice ); ?>><?php echo stripslashes( $value ); ?></option> |
|
| 201 | 201 | <?php } ?> |
| 202 | 202 | </select> |
| 203 | - <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 203 | + <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 204 | 204 | </td> |
| 205 | 205 | </tr> |
| 206 | 206 | |
@@ -214,65 +214,65 @@ discard block |
||
| 214 | 214 | <tr valign="top"> |
| 215 | 215 | <td scope="row"> |
| 216 | 216 | <label for="placeholder"> |
| 217 | - <?php _e( 'Description' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 217 | + <?php _e( 'Description', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 218 | 218 | </label> |
| 219 | 219 | </td> |
| 220 | 220 | <td> |
| 221 | - <textarea class="widefat field-description-input" name="field[<?php echo $merge_field_data['tag']; ?>][description]"></textarea> |
|
| 222 | - <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> |
|
| 221 | + <textarea class="widefat field-description-input" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][description]"></textarea> |
|
| 222 | + <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> |
|
| 223 | 223 | </td> |
| 224 | 224 | </tr> |
| 225 | 225 | <!-- Additional Classes --> |
| 226 | 226 | <tr valign="top"> |
| 227 | 227 | <td scope="row"> |
| 228 | 228 | <label for="placeholder"> |
| 229 | - <?php _e( 'Additional Classes' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 229 | + <?php _e( 'Additional Classes', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 230 | 230 | </label> |
| 231 | 231 | </td> |
| 232 | 232 | <td> |
| 233 | - <input type="text" class="widefat" name="field[<?php echo $merge_field_data['tag']; ?>][additional-classes]" value="<?php echo isset( $form_data_array['classes'] ) ? stripslashes( wp_strip_all_tags( $form_data_array['classes'] ) ) : '' ; ?>" /> |
|
| 234 | - <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> |
|
| 233 | + <input type="text" class="widefat" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][additional-classes]" value="<?php echo isset( $form_data_array[ 'classes' ] ) ? stripslashes( wp_strip_all_tags( $form_data_array[ 'classes' ] ) ) : ''; ?>" /> |
|
| 234 | + <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> |
|
| 235 | 235 | </td> |
| 236 | 236 | </tr> |
| 237 | 237 | <!-- Required Toggle --> |
| 238 | 238 | <tr valign="top"> |
| 239 | 239 | <td scope="row"> |
| 240 | 240 | <label for="field-required"> |
| 241 | - <?php _e( 'Field Required?' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 241 | + <?php _e( 'Field Required?', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 242 | 242 | </label> |
| 243 | 243 | </td> |
| 244 | 244 | <td> |
| 245 | - <input type="checkbox" class="widefat" value="1" name="field[<?php echo $merge_field_data['tag']; ?>][require]" <?php checked( $merge_field_data['req'], 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' ); } ?>"> |
|
| 246 | - <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> |
|
| 245 | + <input type="checkbox" class="widefat" value="1" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][require]" <?php checked( $merge_field_data[ 'req' ], 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' ); } ?>"> |
|
| 246 | + <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> |
|
| 247 | 247 | </td> |
| 248 | 248 | </tr> |
| 249 | 249 | <!-- Visible Toggle --> |
| 250 | 250 | <tr valign="top"> |
| 251 | 251 | <td scope="row"> |
| 252 | 252 | <label for="hide-field"> |
| 253 | - <?php _e( 'Hide Field' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 253 | + <?php _e( 'Hide Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 254 | 254 | </label> |
| 255 | 255 | </td> |
| 256 | 256 | <td> |
| 257 | - <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' ); } ?>"> |
|
| 258 | - <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 257 | + <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' ); } ?>"> |
|
| 258 | + <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 259 | 259 | </td> |
| 260 | 260 | </tr> |
| 261 | 261 | <!-- Toggle Field Label Visibility --> |
| 262 | 262 | <tr valign="top"> |
| 263 | 263 | <td scope="row"> |
| 264 | 264 | <label for="placeholder"> |
| 265 | - <?php _e( 'Hide Label' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 265 | + <?php _e( 'Hide Label', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 266 | 266 | </label> |
| 267 | 267 | </td> |
| 268 | 268 | <td> |
| 269 | - <input type="checkbox" name="field[<?php echo $merge_field_data['tag']; ?>][hide-label]" value="1" /> |
|
| 270 | - <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 269 | + <input type="checkbox" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][hide-label]" value="1" /> |
|
| 270 | + <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 271 | 271 | </td> |
| 272 | 272 | </tr> |
| 273 | 273 | <!-- Display Phone/Date Formats back to the user --> |
| 274 | 274 | <?php |
| 275 | - switch( $form_data_array['field_type'] ) { |
|
| 275 | + switch ( $form_data_array[ 'field_type' ] ) { |
|
| 276 | 276 | |
| 277 | 277 | /* Store the phone format, for properly regex pattern */ |
| 278 | 278 | case 'phone': |
@@ -283,23 +283,23 @@ discard block |
||
| 283 | 283 | <td scope="row"> |
| 284 | 284 | <label for="placeholder"> |
| 285 | 285 | <?php |
| 286 | - switch( $form_data_array['field_type'] ) { |
|
| 286 | + switch ( $form_data_array[ 'field_type' ] ) { |
|
| 287 | 287 | default: |
| 288 | 288 | case 'birthday': |
| 289 | - $type = __( 'Date Format' , 'yikes-inc-easy-mailchimp-extender' ); |
|
| 290 | - $format = $merge_field_data['dateformat']; |
|
| 289 | + $type = __( 'Date Format', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 290 | + $format = $merge_field_data[ 'dateformat' ]; |
|
| 291 | 291 | $format_name = 'date_format'; |
| 292 | 292 | break; |
| 293 | 293 | |
| 294 | 294 | case 'date': |
| 295 | - $type = __( 'Date Format' , 'yikes-inc-easy-mailchimp-extender' ); |
|
| 296 | - $format = $merge_field_data['dateformat']; |
|
| 295 | + $type = __( 'Date Format', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 296 | + $format = $merge_field_data[ 'dateformat' ]; |
|
| 297 | 297 | $format_name = 'date_format'; |
| 298 | 298 | break; |
| 299 | 299 | |
| 300 | 300 | case 'phone': |
| 301 | - $type = __( 'Phone Format' , 'yikes-inc-easy-mailchimp-extender' ); |
|
| 302 | - $format = ( ( $merge_field_data['phoneformat'] == 'none' ) ? __( 'International', 'yikes-inc-easy-mailchimp-extender' ) : $merge_field_data['phoneformat'] ); |
|
| 301 | + $type = __( 'Phone Format', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 302 | + $format = ( ( $merge_field_data[ 'phoneformat' ] == 'none' ) ? __( 'International', 'yikes-inc-easy-mailchimp-extender' ) : $merge_field_data[ 'phoneformat' ] ); |
|
| 303 | 303 | $format_name = 'phone_format'; |
| 304 | 304 | break; |
| 305 | 305 | } |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | </td> |
| 310 | 310 | <td> |
| 311 | 311 | <strong><?php echo $format; ?></strong> |
| 312 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][<?php echo $format_name; ?>]" value="<?php echo $format; ?>" /> |
|
| 312 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][<?php echo $format_name; ?>]" value="<?php echo $format; ?>" /> |
|
| 313 | 313 | <p class="description"><small> |
| 314 | 314 | <?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' ) ); ?> |
| 315 | 315 | </small></p> |
@@ -330,8 +330,8 @@ discard block |
||
| 330 | 330 | </td> |
| 331 | 331 | <td> |
| 332 | 332 | <span class="toggle-container"> |
| 333 | - <a href="#" class="hide-field"><?php _e( "Close" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 334 | - <a href="#" class="remove-field" alt="<?php echo $merge_field_data['tag']; ?>"><?php _e( "Remove Field" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 333 | + <a href="#" class="hide-field"><?php _e( "Close", 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 334 | + <a href="#" class="remove-field" alt="<?php echo $merge_field_data[ 'tag' ]; ?>"><?php _e( "Remove Field", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 335 | 335 | </span> |
| 336 | 336 | </td> |
| 337 | 337 | </tr> |