@@ -8,28 +8,28 @@ discard block |
||
8 | 8 | // grab our global form_data; |
9 | 9 | global $form_data; |
10 | 10 | ?> |
11 | - <label class="hidden-setting-label yikes-easy-mc-hidden" for="form" id=<?php esc_attr_e( $section_data['id'] ); ?>> |
|
11 | + <label class="hidden-setting-label yikes-easy-mc-hidden" for="form" id=<?php esc_attr_e( $section_data[ 'id' ] ); ?>> |
|
12 | 12 | <div id="poststuff"> |
13 | - <div id="post-body" class="metabox-holder <?php if( self::is_custom_section_two_column( $section_data ) ) { ?> columns-2 <?php } else { ?> columns-1 <?php } ?>"> |
|
13 | + <div id="post-body" class="metabox-holder <?php if ( self::is_custom_section_two_column( $section_data ) ) { ?> columns-2 <?php } else { ?> columns-1 <?php } ?>"> |
|
14 | 14 | <div id="post-body-content"> |
15 | 15 | <div class="meta-box-sortables ui-sortable"> |
16 | 16 | <div class="postbox yikes-easy-mc-postbox"> |
17 | - <h3 class="edit-form-title"><span><?php echo $section_data['main_title']; ?></span></h3> |
|
18 | - <div class="inside <?php esc_attr_e( $section_data['id'] ); ?>-container"> |
|
17 | + <h3 class="edit-form-title"><span><?php echo $section_data[ 'main_title' ]; ?></span></h3> |
|
18 | + <div class="inside <?php esc_attr_e( $section_data[ 'id' ] ); ?>-container"> |
|
19 | 19 | <?php |
20 | - if( isset( $section_data['main_description'] ) && $section_data['main_description'] != '' ) { |
|
20 | + if ( isset( $section_data[ 'main_description' ] ) && $section_data[ 'main_description' ] != '' ) { |
|
21 | 21 | ?> |
22 | - <p><?php echo $section_data['main_description']; ?></p> |
|
22 | + <p><?php echo $section_data[ 'main_description' ]; ?></p> |
|
23 | 23 | <?php |
24 | 24 | } |
25 | - $main_field_data = $section_data['main_fields']; |
|
26 | - foreach( $main_field_data as $field ) { |
|
27 | - if( $field['type'] == 'custom' ) { |
|
25 | + $main_field_data = $section_data[ 'main_fields' ]; |
|
26 | + foreach ( $main_field_data as $field ) { |
|
27 | + if ( $field[ 'type' ] == 'custom' ) { |
|
28 | 28 | // execute the custom callback |
29 | - $field['callback'](); |
|
29 | + $field[ 'callback' ](); |
|
30 | 30 | } else { |
31 | 31 | // include our field files |
32 | - include( YIKES_MC_PATH . 'admin/partials/helpers/fields/yikes-mailchimp-' . $field['type'] . '-field.php' ); |
|
32 | + include( YIKES_MC_PATH . 'admin/partials/helpers/fields/yikes-mailchimp-' . $field[ 'type' ] . '-field.php' ); |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 | ?> |
@@ -39,27 +39,27 @@ discard block |
||
39 | 39 | </div> |
40 | 40 | |
41 | 41 | <!-- check for single/double box --> |
42 | - <?php if( self::is_custom_section_two_column( $section_data ) ) { ?> |
|
42 | + <?php if ( self::is_custom_section_two_column( $section_data ) ) { ?> |
|
43 | 43 | <!-- begin sidebar --> |
44 | 44 | <div id="postbox-container-1" class="postbox-container"> |
45 | 45 | <div class="meta-box-sortables"> |
46 | 46 | <div class="postbox yikes-easy-mc-postbox"> |
47 | - <h3 class="edit-form-title"><span><?php echo $section_data['sidebar_title']; ?></span></h3> |
|
48 | - <div class="inside <?php esc_attr_e( $section_data['id'] ); ?>-sidebar-container"> |
|
47 | + <h3 class="edit-form-title"><span><?php echo $section_data[ 'sidebar_title' ]; ?></span></h3> |
|
48 | + <div class="inside <?php esc_attr_e( $section_data[ 'id' ] ); ?>-sidebar-container"> |
|
49 | 49 | <?php |
50 | - if( isset( $section_data['sidebar_description'] ) && $section_data['sidebar_description'] != '' ) { |
|
50 | + if ( isset( $section_data[ 'sidebar_description' ] ) && $section_data[ 'sidebar_description' ] != '' ) { |
|
51 | 51 | ?> |
52 | - <p><?php echo $section_data['sidebar_description']; ?></p> |
|
52 | + <p><?php echo $section_data[ 'sidebar_description' ]; ?></p> |
|
53 | 53 | <?php |
54 | 54 | } |
55 | - $sidebar_field_data = $section_data['sidebar_fields']; |
|
56 | - foreach( $sidebar_field_data as $field ) { |
|
57 | - if( $field['type'] == 'custom' ) { |
|
55 | + $sidebar_field_data = $section_data[ 'sidebar_fields' ]; |
|
56 | + foreach ( $sidebar_field_data as $field ) { |
|
57 | + if ( $field[ 'type' ] == 'custom' ) { |
|
58 | 58 | // execute the custom callback |
59 | - $field['callback'](); |
|
59 | + $field[ 'callback' ](); |
|
60 | 60 | } else { |
61 | 61 | // include our field files |
62 | - include( YIKES_MC_PATH . 'admin/partials/helpers/fields/yikes-mailchimp-' . $field['type'] . '-field.php' ); |
|
62 | + include( YIKES_MC_PATH . 'admin/partials/helpers/fields/yikes-mailchimp-' . $field[ 'type' ] . '-field.php' ); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | ?> |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | // Widget name will appear in UI |
15 | 15 | __( 'Easy MailChimp Forms', 'yikes-inc-easy-mailchimp-extender' ), |
16 | 16 | // Widget description |
17 | - array( 'description' => __( 'MailChimp opt-in widget for your sidebar.', 'yikes-inc-easy-mailchimp-extender' ), ) |
|
17 | + array( 'description' => __( 'MailChimp opt-in widget for your sidebar.', 'yikes-inc-easy-mailchimp-extender' ),) |
|
18 | 18 | ); |
19 | 19 | |
20 | 20 | } |
@@ -27,41 +27,41 @@ discard block |
||
27 | 27 | global $wpdb; |
28 | 28 | $form_results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms LIMIT 1', ARRAY_A ); |
29 | 29 | |
30 | - $title = isset( $instance['title'] ) ? apply_filters( 'widget_title', $instance['title'] ) : __( 'MailChimp Signup Form', 'yikes-inc-easy-mailchimp-extender' ); |
|
31 | - $form_id = isset( $instance['form_id'] ) ? $instance['form_id'] : $form_results[0]['id']; |
|
32 | - $form_description = isset( $instance['form_description'] ) ? $instance['form_description'] : ''; |
|
33 | - $submit_button_text = isset( $instance['submit_text'] ) ? $instance['submit_text'] : __( 'Submit' , 'yikes-inc-easy-mailchimp-extender' ); |
|
30 | + $title = isset( $instance[ 'title' ] ) ? apply_filters( 'widget_title', $instance[ 'title' ] ) : __( 'MailChimp Signup Form', 'yikes-inc-easy-mailchimp-extender' ); |
|
31 | + $form_id = isset( $instance[ 'form_id' ] ) ? $instance[ 'form_id' ] : $form_results[ 0 ][ 'id' ]; |
|
32 | + $form_description = isset( $instance[ 'form_description' ] ) ? $instance[ 'form_description' ] : ''; |
|
33 | + $submit_button_text = isset( $instance[ 'submit_text' ] ) ? $instance[ 'submit_text' ] : __( 'Submit', 'yikes-inc-easy-mailchimp-extender' ); |
|
34 | 34 | |
35 | 35 | $shortcode_attributes = array(); |
36 | 36 | // Build our array based on settings chosen |
37 | - $sortcode_attributes[] = 'form="' . $form_id .'"'; |
|
37 | + $sortcode_attributes[ ] = 'form="' . $form_id . '"'; |
|
38 | 38 | // form description |
39 | - if( !empty( $form_description ) ) { |
|
40 | - $sortcode_attributes[] = 'description="1"'; |
|
39 | + if ( ! empty( $form_description ) ) { |
|
40 | + $sortcode_attributes[ ] = 'description="1"'; |
|
41 | 41 | } |
42 | 42 | // submit button text |
43 | - $sortcode_attributes[] = 'submit="' . $submit_button_text .'"'; |
|
43 | + $sortcode_attributes[ ] = 'submit="' . $submit_button_text . '"'; |
|
44 | 44 | |
45 | 45 | // before and after widget arguments are defined by themes |
46 | - echo $args['before_widget']; |
|
46 | + echo $args[ 'before_widget' ]; |
|
47 | 47 | |
48 | 48 | if ( ! empty( $title ) ) |
49 | - echo $args['before_title'] . $title . $args['after_title']; |
|
49 | + echo $args[ 'before_title' ] . $title . $args[ 'after_title' ]; |
|
50 | 50 | |
51 | 51 | // Custom action hooks to place content in the widget before the form |
52 | 52 | // See FAQ for examples on usage |
53 | - do_action( 'yikes-mailchimp-before-form-'.$form_id ); |
|
53 | + do_action( 'yikes-mailchimp-before-form-' . $form_id ); |
|
54 | 54 | do_action( 'yikes-mailchimp-before-form' ); |
55 | 55 | |
56 | 56 | // This is where you run the code and display the output |
57 | - echo do_shortcode( '[yikes-mailchimp ' . implode( ' ' , $sortcode_attributes ) . ']' ); |
|
57 | + echo do_shortcode( '[yikes-mailchimp ' . implode( ' ', $sortcode_attributes ) . ']' ); |
|
58 | 58 | |
59 | 59 | // Custom action hooks to place content in the widget after the form |
60 | 60 | // See FAQ for examples on usage |
61 | - do_action( 'yikes-mailchimp-after-form-'.$form_id ); |
|
61 | + do_action( 'yikes-mailchimp-after-form-' . $form_id ); |
|
62 | 62 | do_action( 'yikes-mailchimp-after-form' ); |
63 | 63 | |
64 | - echo $args['after_widget']; |
|
64 | + echo $args[ 'after_widget' ]; |
|
65 | 65 | |
66 | 66 | } |
67 | 67 | |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | global $wpdb; |
73 | 73 | $form_results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms', ARRAY_A ); |
74 | 74 | |
75 | - if( empty( $form_results ) ) { |
|
75 | + if ( empty( $form_results ) ) { |
|
76 | 76 | ?> |
77 | 77 | <section class="no-forms-widget"> |
78 | - <strong><span class="dashicons dashicons-no-alt no-forms-found-icon"></span><?php echo sprintf( __( 'No forms found. It looks like you need to <a href="%s" title="%s">%s</a>.', 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ), __( 'Create a form' , 'yikes-inc-easy-mailchimp-extender' ), __( 'create a form' , 'yikes-inc-easy-mailchimp-extender' ) ); ?></strong> |
|
78 | + <strong><span class="dashicons dashicons-no-alt no-forms-found-icon"></span><?php echo sprintf( __( 'No forms found. It looks like you need to <a href="%s" title="%s">%s</a>.', 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ), __( 'Create a form', 'yikes-inc-easy-mailchimp-extender' ), __( 'create a form', 'yikes-inc-easy-mailchimp-extender' ) ); ?></strong> |
|
79 | 79 | </section> |
80 | 80 | <?php |
81 | 81 | return; |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | $submit_text = __( 'Submit', 'yikes-inc-easy-mailchimp-extender' ); |
103 | 103 | } |
104 | 104 | |
105 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) == 'invalid_api_key' ) { |
|
105 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) { |
|
106 | 106 | ?> |
107 | - <p class="enter-valid-api-error-widget"><strong><?php _e( 'Please enter a valid MailChimp API key to connect your site to MailChimp.' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
107 | + <p class="enter-valid-api-error-widget"><strong><?php _e( 'Please enter a valid MailChimp API key to connect your site to MailChimp.', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
108 | 108 | <?php |
109 | 109 | return; |
110 | 110 | } |
@@ -121,9 +121,9 @@ discard block |
||
121 | 121 | <select id="<?php echo $this->get_field_id( 'form_id' ); ?>" name="<?php echo $this->get_field_name( 'form_id' ); ?>" class="widefat"> |
122 | 122 | <?php |
123 | 123 | // build our array |
124 | - foreach( $form_results as $form ) { |
|
124 | + foreach ( $form_results as $form ) { |
|
125 | 125 | ?> |
126 | - <option <?php selected( $selected_form , $form['id'] ); ?> name="<?php echo $this->get_field_name( 'form_id' ); ?>" value="<?php echo $form['id']; ?>"><?php echo stripslashes( $form['form_name'] ); ?></option> |
|
126 | + <option <?php selected( $selected_form, $form[ 'id' ] ); ?> name="<?php echo $this->get_field_name( 'form_id' ); ?>" value="<?php echo $form[ 'id' ]; ?>"><?php echo stripslashes( $form[ 'form_name' ] ); ?></option> |
|
127 | 127 | <?php |
128 | 128 | } |
129 | 129 | ?> |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | <p> |
134 | 134 | <label for="<?php echo $this->get_field_id( 'form_description' ); ?>"><?php _e( 'Display Form Description:' ); ?></label> |
135 | - <input class="widefat" id="<?php echo $this->get_field_id( 'form_description' ); ?>" name="<?php echo $this->get_field_name( 'form_description' ); ?>" type="checkbox" value="1" <?php if( isset( $instance['form_description'] ) ) { checked( $instance['form_description'] , 1 ); } ?> /> |
|
135 | + <input class="widefat" id="<?php echo $this->get_field_id( 'form_description' ); ?>" name="<?php echo $this->get_field_name( 'form_description' ); ?>" type="checkbox" value="1" <?php if ( isset( $instance[ 'form_description' ] ) ) { checked( $instance[ 'form_description' ], 1 ); } ?> /> |
|
136 | 136 | </p> |
137 | 137 | |
138 | 138 | <p> |
@@ -145,10 +145,10 @@ discard block |
||
145 | 145 | // Updating widget replacing old instances with new |
146 | 146 | public function update( $new_instance, $old_instance ) { |
147 | 147 | $instance = array(); |
148 | - $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : ''; |
|
149 | - $instance['form_id'] = $new_instance['form_id']; |
|
150 | - $instance['form_description'] = isset( $new_instance['form_description'] ) ? '1' : ''; |
|
151 | - $instance['submit_text'] = ( ! empty( $new_instance['submit_text'] ) ) ? strip_tags( $new_instance['submit_text'] ) : 'Submit'; |
|
148 | + $instance[ 'title' ] = ( ! empty( $new_instance[ 'title' ] ) ) ? strip_tags( $new_instance[ 'title' ] ) : ''; |
|
149 | + $instance[ 'form_id' ] = $new_instance[ 'form_id' ]; |
|
150 | + $instance[ 'form_description' ] = isset( $new_instance[ 'form_description' ] ) ? '1' : ''; |
|
151 | + $instance[ 'submit_text' ] = ( ! empty( $new_instance[ 'submit_text' ] ) ) ? strip_tags( $new_instance[ 'submit_text' ] ) : 'Submit'; |
|
152 | 152 | return $instance; |
153 | 153 | } |
154 | 154 |
@@ -9,30 +9,30 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // enqueue the styles for our migration page.. |
12 | - wp_enqueue_style( 'yikes_mc_migrate_option_styles' , YIKES_MC_URL . 'admin/css/yikes-inc-easy-mailchimp-migrate-option-styles.css' ); |
|
13 | - wp_enqueue_style( 'animate-css' , YIKES_MC_URL . 'admin/css/animate.min.css' ); |
|
12 | + wp_enqueue_style( 'yikes_mc_migrate_option_styles', YIKES_MC_URL . 'admin/css/yikes-inc-easy-mailchimp-migrate-option-styles.css' ); |
|
13 | + wp_enqueue_style( 'animate-css', YIKES_MC_URL . 'admin/css/animate.min.css' ); |
|
14 | 14 | |
15 | 15 | // store our old options |
16 | 16 | $old_plugin_options = get_option( 'ykseme_storage' ); |
17 | 17 | |
18 | 18 | $global_error_messages = array( |
19 | - 'success' => __( $old_plugin_options['single-optin-message'] , 'yikes-inc-easy-mailchimp-extender' ), |
|
20 | - 'general-error' => __( "Whoops! It looks like something went wrong. Please try again." , 'yikes-inc-easy-mailchimp-extender' ), |
|
21 | - 'invalid-email' => __( "Please provide a valid email address." , 'yikes-inc-easy-mailchimp-extender' ), |
|
22 | - 'email-exists-error' => __( "The provided email is already subscribed to this list." , 'yikes-inc-easy-mailchimp-extender' ) |
|
19 | + 'success' => __( $old_plugin_options[ 'single-optin-message' ], 'yikes-inc-easy-mailchimp-extender' ), |
|
20 | + 'general-error' => __( "Whoops! It looks like something went wrong. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), |
|
21 | + 'invalid-email' => __( "Please provide a valid email address.", 'yikes-inc-easy-mailchimp-extender' ), |
|
22 | + 'email-exists-error' => __( "The provided email is already subscribed to this list.", 'yikes-inc-easy-mailchimp-extender' ) |
|
23 | 23 | ); |
24 | 24 | |
25 | 25 | // if old options are defined... |
26 | - if( $old_plugin_options ) { |
|
26 | + if ( $old_plugin_options ) { |
|
27 | 27 | |
28 | 28 | // Verify the NONCE is valid |
29 | - check_admin_referer( 'yikes-mc-migrate-options' , 'migrate_options_nonce' ); |
|
29 | + check_admin_referer( 'yikes-mc-migrate-options', 'migrate_options_nonce' ); |
|
30 | 30 | |
31 | 31 | ?> |
32 | 32 | |
33 | 33 | <div class="wrap" style="text-align:center;"> |
34 | - <h3><?php _e( 'Migrating old plugin options' , 'yikes-inc-easy-mailchimp-extender' ); ?><span class="upgrading-ellipse-one">.</span><span class="upgrading-ellipse-two">.</span><span class="upgrading-ellipse-three">.</h3> |
|
35 | - <p><?php _e( 'please be patient while your options are updated and the process has completed' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
34 | + <h3><?php _e( 'Migrating old plugin options', 'yikes-inc-easy-mailchimp-extender' ); ?><span class="upgrading-ellipse-one">.</span><span class="upgrading-ellipse-two">.</span><span class="upgrading-ellipse-three">.</h3> |
|
35 | + <p><?php _e( 'please be patient while your options are updated and the process has completed', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
36 | 36 | <!-- empty list, populate when options get updated --> |
37 | 37 | <ul id="options-updated" class="yikes-easy-mc-hidden"> |
38 | 38 | <hr /> |
@@ -46,82 +46,82 @@ discard block |
||
46 | 46 | |
47 | 47 | // loop over our old options, and store them in a new option value |
48 | 48 | $do_not_migrate_options = array( |
49 | - 'ssl_verify_peer', 'api_validation' , 'widget_yikes_mc_widget' , 'flavor' , 'single-optin-message' , 'double-optin-message' , |
|
50 | - 'mailchimp-optIn-default-list' , 'version' , 'yks-mailchimp-jquery-datepicker' , 'ssl_verify_peer' , 'optIn-checkbox' , 'yks-mailchimp-optin-checkbox-text', |
|
51 | - 'yks-mailchimp-required-text' , 'optin' |
|
49 | + 'ssl_verify_peer', 'api_validation', 'widget_yikes_mc_widget', 'flavor', 'single-optin-message', 'double-optin-message', |
|
50 | + 'mailchimp-optIn-default-list', 'version', 'yks-mailchimp-jquery-datepicker', 'ssl_verify_peer', 'optIn-checkbox', 'yks-mailchimp-optin-checkbox-text', |
|
51 | + 'yks-mailchimp-required-text', 'optin' |
|
52 | 52 | ); |
53 | 53 | |
54 | - foreach( $old_plugin_options as $option_name => $option_value ) { |
|
54 | + foreach ( $old_plugin_options as $option_name => $option_value ) { |
|
55 | 55 | |
56 | - if( ! in_array( $option_name , $do_not_migrate_options ) ) { |
|
56 | + if ( ! in_array( $option_name, $do_not_migrate_options ) ) { |
|
57 | 57 | // ajax request to update our options one by one.. |
58 | 58 | // if its an array, we need to json encode it |
59 | - if( is_array( $option_value ) ) { |
|
59 | + if ( is_array( $option_value ) ) { |
|
60 | 60 | |
61 | - if( $option_name == 'lists' ) { |
|
61 | + if ( $option_name == 'lists' ) { |
|
62 | 62 | |
63 | - if( ! empty( $option_value ) ) { |
|
63 | + if ( ! empty( $option_value ) ) { |
|
64 | 64 | $settings = 1; |
65 | 65 | $form_length = count( $option_value ); |
66 | - foreach( $option_value as $mailchimp_form ) { |
|
66 | + foreach ( $option_value as $mailchimp_form ) { |
|
67 | 67 | // update and pass our placeholder value |
68 | 68 | reset( $mailchimp_form ); |
69 | - $form_id = $mailchimp_form['id']; |
|
69 | + $form_id = $mailchimp_form[ 'id' ]; |
|
70 | 70 | |
71 | - $fields = $mailchimp_form['fields']; |
|
71 | + $fields = $mailchimp_form[ 'fields' ]; |
|
72 | 72 | reset( $fields ); |
73 | 73 | $first_field_key = key( $fields ); |
74 | 74 | $array_keys = array_keys( $fields ); |
75 | 75 | |
76 | 76 | $x = 1; |
77 | 77 | |
78 | - foreach( $array_keys as $parent_key ) { |
|
78 | + foreach ( $array_keys as $parent_key ) { |
|
79 | 79 | |
80 | 80 | // alter the field keys so they show up after an import |
81 | 81 | $split_parent_key = explode( '-', $parent_key ); |
82 | 82 | |
83 | - $new_parent_key = ( isset( $split_parent_key[1] ) ) ? strtoupper( $split_parent_key[1] ) : $parent_key; |
|
83 | + $new_parent_key = ( isset( $split_parent_key[ 1 ] ) ) ? strtoupper( $split_parent_key[ 1 ] ) : $parent_key; |
|
84 | 84 | |
85 | - $mailchimp_form['fields'][$new_parent_key] = $mailchimp_form['fields'][$parent_key]; |
|
85 | + $mailchimp_form[ 'fields' ][ $new_parent_key ] = $mailchimp_form[ 'fields' ][ $parent_key ]; |
|
86 | 86 | |
87 | - unset( $mailchimp_form['fields'][$parent_key] ); |
|
87 | + unset( $mailchimp_form[ 'fields' ][ $parent_key ] ); |
|
88 | 88 | |
89 | 89 | // update our placeholder key to be 'placeholder' |
90 | - $mailchimp_form['fields'][$new_parent_key]['placeholder'] = isset( $mailchimp_form['fields'][$new_parent_key]['placeholder-'.$form_id.'-'.$x] ) ? $mailchimp_form['fields'][$new_parent_key]['placeholder-'.$form_id.'-'.$x] : ''; |
|
90 | + $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'placeholder' ] = isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'placeholder-' . $form_id . '-' . $x ] ) ? $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'placeholder-' . $form_id . '-' . $x ] : ''; |
|
91 | 91 | // update field classes |
92 | - $mailchimp_form['fields'][$new_parent_key]['additional-classes'] = isset( $mailchimp_form['fields'][$new_parent_key]['custom-field-class-'.$form_id.'-'.$x] ) ? $mailchimp_form['fields'][$new_parent_key]['custom-field-class-'.$form_id.'-'.$x] : ''; |
|
92 | + $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'additional-classes' ] = isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'custom-field-class-' . $form_id . '-' . $x ] ) ? $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'custom-field-class-' . $form_id . '-' . $x ] : ''; |
|
93 | 93 | // update help field - populate description |
94 | - $mailchimp_form['fields'][$new_parent_key]['description'] = isset( $mailchimp_form['fields'][$new_parent_key]['help'] ) ? $mailchimp_form['fields'][$new_parent_key]['help'] : ''; |
|
94 | + $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'description' ] = isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'help' ] ) ? $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'help' ] : ''; |
|
95 | 95 | // remove the old placeholder structure |
96 | - unset( $mailchimp_form['fields'][$new_parent_key]['placeholder-'.$form_id.'-'.$x] ); |
|
96 | + unset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'placeholder-' . $form_id . '-' . $x ] ); |
|
97 | 97 | // remove old custom class structure |
98 | - unset( $mailchimp_form['fields'][$new_parent_key]['custom-field-class-'.$form_id.'-'.$x] ); |
|
98 | + unset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'custom-field-class-' . $form_id . '-' . $x ] ); |
|
99 | 99 | // remove old help/description |
100 | - unset( $mailchimp_form['fields'][$new_parent_key]['help'] ); |
|
100 | + unset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'help' ] ); |
|
101 | 101 | |
102 | 102 | // check if choices is set, and encode them |
103 | - if( isset( $mailchimp_form['fields'][$new_parent_key]['choices'] ) && ! empty( $mailchimp_form['fields'][$new_parent_key]['choices'] ) ) { |
|
104 | - $mailchimp_form['fields'][$new_parent_key]['choices'] = addslashes( addslashes( json_encode( $mailchimp_form['fields'][$new_parent_key]['choices'] ) ) ); |
|
103 | + if ( isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'choices' ] ) && ! empty( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'choices' ] ) ) { |
|
104 | + $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'choices' ] = addslashes( addslashes( json_encode( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'choices' ] ) ) ); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | // update 'default' to 'default-choice' for radio/dropdown |
108 | - if( isset( $mailchimp_form['fields'][$new_parent_key]['type'] ) && in_array( $mailchimp_form['fields'][$new_parent_key]['type'], array( 'radio', 'dropdown' ) ) ) { |
|
109 | - $mailchimp_form['fields'][$new_parent_key]['default_choice'] = $mailchimp_form['fields'][$new_parent_key]['default']; |
|
110 | - unset( $mailchimp_form['fields'][$new_parent_key]['default'] ); |
|
108 | + if ( isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ] ) && in_array( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ], array( 'radio', 'dropdown' ) ) ) { |
|
109 | + $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'default_choice' ] = $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'default' ]; |
|
110 | + unset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'default' ] ); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | // update 'date_format' on 'birthday' and 'date' fields |
114 | - if( isset( $mailchimp_form['fields'][$new_parent_key]['type'] ) && in_array( $mailchimp_form['fields'][$new_parent_key]['type'], array( 'date', 'birthday' ) ) ) { |
|
115 | - if( $mailchimp_form['fields'][$new_parent_key]['type'] == 'date' ) { // date |
|
116 | - $mailchimp_form['fields'][$new_parent_key]['date_format'] = 'MM/DD'; // mailchimp default (can be altered) |
|
114 | + if ( isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ] ) && in_array( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ], array( 'date', 'birthday' ) ) ) { |
|
115 | + if ( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ] == 'date' ) { // date |
|
116 | + $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'date_format' ] = 'MM/DD'; // mailchimp default (can be altered) |
|
117 | 117 | } else { // birthday |
118 | - $mailchimp_form['fields'][$new_parent_key]['date_format'] = 'MM/DD/YYYY'; // mailchimp default (can be altered) |
|
118 | + $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'date_format' ] = 'MM/DD/YYYY'; // mailchimp default (can be altered) |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
122 | 122 | // update 'phone_format' on 'phone' |
123 | - if( isset( $mailchimp_form['fields'][$new_parent_key]['type'] ) && in_array( $mailchimp_form['fields'][$new_parent_key]['type'], array( 'phone' ) ) ) { |
|
124 | - $mailchimp_form['fields'][$new_parent_key]['phone_format'] = 'phone_format '; // phone format |
|
123 | + if ( isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ] ) && in_array( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ], array( 'phone' ) ) ) { |
|
124 | + $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'phone_format' ] = 'phone_format '; // phone format |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | $x++; |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | $.post( ajaxurl, mc_data, function(response) { |
140 | 140 | jQuery( '#options-updated' ).show(); |
141 | - jQuery( '#options-updated' ).append( '<li class="animated fadeInDown"><?php echo '<strong>'; ?>' + response.form_name + '<?php echo '</strong> ' . __( "successfully imported." , 'yikes-inc-easy-mailchimp-extender' ); ?></li>' ); |
|
141 | + jQuery( '#options-updated' ).append( '<li class="animated fadeInDown"><?php echo '<strong>'; ?>' + response.form_name + '<?php echo '</strong> ' . __( "successfully imported.", 'yikes-inc-easy-mailchimp-extender' ); ?></li>' ); |
|
142 | 142 | if( response.completed_import ) { |
143 | 143 | setTimeout( function() { |
144 | 144 | // finished with the loop...lets let the user know....and then redirect them.... |
@@ -147,13 +147,13 @@ discard block |
||
147 | 147 | jQuery( '.upgrading-ellipse-two' ).remove(); |
148 | 148 | jQuery( '.upgrading-ellipse-three' ).remove(); |
149 | 149 | jQuery( '.wrap' ).find( 'h3' ).next().fadeOut(); |
150 | - jQuery( '#options-updated' ).append( '<li class="animated fadeInDown migration-complete-notification"><em><?php _e( "Migration Complete. Please wait..." , 'yikes-inc-easy-mailchimp-extender' ); ?> </em> <img src="<?php echo esc_url_raw( admin_url( "images/wpspin_light.gif" ) ); ?>" /></li>' ); |
|
150 | + jQuery( '#options-updated' ).append( '<li class="animated fadeInDown migration-complete-notification"><em><?php _e( "Migration Complete. Please wait...", 'yikes-inc-easy-mailchimp-extender' ); ?> </em> <img src="<?php echo esc_url_raw( admin_url( "images/wpspin_light.gif" ) ); ?>" /></li>' ); |
|
151 | 151 | // redirect our user to the main plugin page... |
152 | 152 | setTimeout( function() { |
153 | 153 | <?php |
154 | 154 | // migrate options that didnt make it (they were never stored in the 'ykseme_storage' options array) |
155 | - add_option( 'yikes-mc-api-validation' , get_option( 'api_validation' , 'invalid_api_key' ) ); |
|
156 | - add_option( 'yikes-mc-error-messages' , $global_error_messages ); |
|
155 | + add_option( 'yikes-mc-api-validation', get_option( 'api_validation', 'invalid_api_key' ) ); |
|
156 | + add_option( 'yikes-mc-error-messages', $global_error_messages ); |
|
157 | 157 | // delete our old options after a successful migration (and some new ones that are no longer needed) |
158 | 158 | delete_option( 'widget_yikes_mc_widget' ); |
159 | 159 | delete_option( 'api_validation' ); |
@@ -174,26 +174,26 @@ discard block |
||
174 | 174 | } |
175 | 175 | /* Rename our ReCaptcha Options */ |
176 | 176 | /* Public Site Key */ |
177 | - if( $option_name == 'recaptcha-api-key' ) { |
|
177 | + if ( $option_name == 'recaptcha-api-key' ) { |
|
178 | 178 | $option_name = 'recaptcha-site-key'; |
179 | 179 | } |
180 | 180 | /* Private Key */ |
181 | - if( $option_name == 'recaptcha-private-api-key' ) { |
|
181 | + if ( $option_name == 'recaptcha-private-api-key' ) { |
|
182 | 182 | $option_name = 'recaptcha-secret-key'; |
183 | 183 | } |
184 | 184 | /* Change 'recaptcha-setting' to 'recaptcha-status' */ |
185 | 185 | /* Status */ |
186 | - if( $option_name == 'recaptcha-setting' ) { |
|
186 | + if ( $option_name == 'recaptcha-setting' ) { |
|
187 | 187 | $option_name = 'recaptcha-status'; |
188 | 188 | } |
189 | 189 | /* End re-name ReCaptcha options */ |
190 | 190 | |
191 | 191 | |
192 | - if( is_array( $option_value ) ) { |
|
192 | + if ( is_array( $option_value ) ) { |
|
193 | 193 | $option_value = json_encode( $option_value ); |
194 | 194 | } |
195 | 195 | // do noit migrate the lists option, it's not useful to us |
196 | - if( $option_name != 'lists' ) { |
|
196 | + if ( $option_name != 'lists' ) { |
|
197 | 197 | ?> |
198 | 198 | var data = { |
199 | 199 | 'action': 'migrate_old_plugin_settings', |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | |
204 | 204 | $.post( ajaxurl, data, function(response) { |
205 | 205 | jQuery( '#options-updated' ).show(); |
206 | - jQuery( '#options-updated' ).append( '<li class="animated fadeInDown"><?php echo '<strong>' . ucwords( str_replace( '_' , ' ' , str_replace( '-' , ' ' , $option_name ) ) ) . '</strong> ' . __( "successfully imported." , 'yikes-inc-easy-mailchimp-extender' ); ?></li>' ); |
|
206 | + jQuery( '#options-updated' ).append( '<li class="animated fadeInDown"><?php echo '<strong>' . ucwords( str_replace( '_', ' ', str_replace( '-', ' ', $option_name ) ) ) . '</strong> ' . __( "successfully imported.", 'yikes-inc-easy-mailchimp-extender' ); ?></li>' ); |
|
207 | 207 | }); |
208 | 208 | <?php |
209 | 209 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | }, 2000 ); |
228 | 228 | </script> |
229 | 229 | <?php |
230 | - wp_die( '<strong>' . __( 'Old plugin options do not exist. Redirecting you...' , 'yikes-inc-easy-mailchimp-extender' ) . '</strong>' , 500 ); |
|
230 | + wp_die( '<strong>' . __( 'Old plugin options do not exist. Redirecting you...', 'yikes-inc-easy-mailchimp-extender' ) . '</strong>', 500 ); |
|
231 | 231 | ?> |
232 | 232 | </div> |
233 | 233 | <?php |
@@ -18,7 +18,7 @@ |
||
18 | 18 | ), $atts ) |
19 | 19 | ); |
20 | 20 | |
21 | - return '<p><em>' . __( 'This MailChimp shortcode is now deprecated. Please insert the new shortcode to display this form.' , 'yikes-inc-easy-mailchimp-extender' ) . '</em></p>'; |
|
21 | + return '<p><em>' . __( 'This MailChimp shortcode is now deprecated. Please insert the new shortcode to display this form.', 'yikes-inc-easy-mailchimp-extender' ) . '</em></p>'; |
|
22 | 22 | |
23 | 23 | } |
24 | 24 | add_shortcode( 'yks-mailchimp-list', 'process_depracated_mailchimp_shortcode' ); ?> |
25 | 25 | \ No newline at end of file |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | // Prevent direct access to the file |
9 | - defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
9 | + defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
10 | 10 | |
11 | 11 | class Yikes_Easy_MC_bbPress_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class { |
12 | 12 | |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function output_checkbox() { |
33 | 33 | // if the user is already subscribed, abort and don't render the checkbox |
34 | - if( $this->is_user_already_subscribed( $this->type ) == '1' ) { |
|
34 | + if ( $this->is_user_already_subscribed( $this->type ) == '1' ) { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | echo $this->yikes_get_checkbox(); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function subscribe_from_bbpress( $anonymous_data, $user_id, $trigger ) { |
47 | 47 | $user_data = get_userdata( $user_id ); |
48 | - return $this->subscribe_user_integration( $user_data->user_email, $this->type , array( |
|
48 | + return $this->subscribe_user_integration( $user_data->user_email, $this->type, array( |
|
49 | 49 | 'FNAME' => $user_data->first_name, |
50 | 50 | 'LNAME' => $user_data->last_name, |
51 | 51 | 'NAE' => $user_data->first_name, |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // Prevent direct access to the file |
10 | - defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
10 | + defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
11 | 11 | |
12 | 12 | class Yikes_Easy_MC_EDD_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class { |
13 | 13 | |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | add_action( 'edd_purchase_form_user_info_fields', array( $this, 'output_checkbox' ) ); |
24 | - add_action( 'edd_insert_payment', array( $this, 'update_payment_post_meta' ) , 99999 ); |
|
25 | - add_action( 'edd_complete_purchase', array( $this, 'subscribe_from_edd_purchase'), 50 ); |
|
24 | + add_action( 'edd_insert_payment', array( $this, 'update_payment_post_meta' ), 99999 ); |
|
25 | + add_action( 'edd_complete_purchase', array( $this, 'subscribe_from_edd_purchase' ), 50 ); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | * Outputs a checkbox |
31 | 31 | */ |
32 | 32 | public function output_checkbox() { |
33 | - if( $this->is_user_already_subscribed( $this->type ) == '1' ) { |
|
33 | + if ( $this->is_user_already_subscribed( $this->type ) == '1' ) { |
|
34 | 34 | return; |
35 | 35 | } |
36 | 36 | // render our field if the user isn't current subscribed |
37 | - echo do_action( 'yikes-mailchimp-before-checkbox' , $this->type ); |
|
37 | + echo do_action( 'yikes-mailchimp-before-checkbox', $this->type ); |
|
38 | 38 | echo $this->yikes_get_checkbox(); |
39 | - echo do_action( 'yikes-mailchimp-after-checkbox' , $this->type ); |
|
39 | + echo do_action( 'yikes-mailchimp-after-checkbox', $this->type ); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function update_payment_post_meta( $payment_id = 0, $payment_data = array() ) { |
49 | 49 | // don't save anything if the checkbox was not checked |
50 | - if( ! $this->was_checkbox_checked( $this->type ) ) { |
|
50 | + if ( ! $this->was_checkbox_checked( $this->type ) ) { |
|
51 | 51 | update_post_meta( $payment_id, '_yikes_easy_mc_optin', '0' ); |
52 | 52 | return; |
53 | 53 | } |
@@ -60,25 +60,25 @@ discard block |
||
60 | 60 | * @return bool|string |
61 | 61 | */ |
62 | 62 | public function subscribe_from_edd_purchase( $payment_id ) { |
63 | - $meta = get_post_meta( $payment_id , '_yikes_easy_mc_optin' , true ); |
|
64 | - if( $meta == '0' ) { |
|
63 | + $meta = get_post_meta( $payment_id, '_yikes_easy_mc_optin', true ); |
|
64 | + if ( $meta == '0' ) { |
|
65 | 65 | return false; |
66 | 66 | } |
67 | 67 | $email = (string) edd_get_payment_user_email( $payment_id ); |
68 | 68 | $merge_vars = array(); |
69 | 69 | // add first and last name to merge vars, if given |
70 | 70 | $user_info = (array) edd_get_payment_meta_user_info( $payment_id ); |
71 | - if( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
72 | - $merge_vars['NAME'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
71 | + if ( isset( $user_info[ 'first_name' ] ) && isset( $user_info[ 'last_name' ] ) ) { |
|
72 | + $merge_vars[ 'NAME' ] = $user_info[ 'first_name' ] . ' ' . $user_info[ 'last_name' ]; |
|
73 | 73 | } |
74 | - if( isset( $user_info['first_name'] ) ) { |
|
75 | - $merge_vars['FNAME'] = $user_info['first_name']; |
|
74 | + if ( isset( $user_info[ 'first_name' ] ) ) { |
|
75 | + $merge_vars[ 'FNAME' ] = $user_info[ 'first_name' ]; |
|
76 | 76 | } |
77 | - if( isset( $user_info['last_name'] ) ) { |
|
78 | - $merge_vars['LNAME'] = $user_info['last_name']; |
|
77 | + if ( isset( $user_info[ 'last_name' ] ) ) { |
|
78 | + $merge_vars[ 'LNAME' ] = $user_info[ 'last_name' ]; |
|
79 | 79 | } |
80 | 80 | // subscribe the user |
81 | - $this->subscribe_user_integration( sanitize_email( $email ) , $this->type , $merge_vars ); |
|
81 | + $this->subscribe_user_integration( sanitize_email( $email ), $this->type, $merge_vars ); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | // Prevent direct access to the file |
9 | - defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
9 | + defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
10 | 10 | |
11 | 11 | class Yikes_Easy_MC_Comment_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class { |
12 | 12 | |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | * Outputs a checkbox, if user is not already subscribed |
28 | 28 | */ |
29 | 29 | public function output_checkbox( $comment_field ) { |
30 | - if( $this->is_user_already_subscribed( $this->type ) == '1' ) { |
|
30 | + if ( $this->is_user_already_subscribed( $this->type ) == '1' ) { |
|
31 | 31 | return $comment_field; |
32 | 32 | } |
33 | - echo do_action( 'yikes-mailchimp-before-checkbox' , $this->type ); |
|
33 | + echo do_action( 'yikes-mailchimp-before-checkbox', $this->type ); |
|
34 | 34 | echo $comment_field . $this->yikes_get_checkbox(); |
35 | - echo do_action( 'yikes-mailchimp-after-checkbox' , $this->type ); |
|
35 | + echo do_action( 'yikes-mailchimp-after-checkbox', $this->type ); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @since 6.0.0 |
43 | 43 | **/ |
44 | - public function subscribe_from_comment( $comment_id , $comment_approved ) { |
|
44 | + public function subscribe_from_comment( $comment_id, $comment_approved ) { |
|
45 | 45 | // was sign-up checkbox checked? |
46 | 46 | if ( $this->was_checkbox_checked( $this->type ) === false ) { |
47 | 47 | return false; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | 'OPTIN_IP' => $comment_data->comment_author_IP, |
59 | 59 | ); |
60 | 60 | // subscribe the user |
61 | - $this->subscribe_user_integration( sanitize_email( $comment_data->comment_author_email ) , $this->type , $merge_vars ); |
|
61 | + $this->subscribe_user_integration( sanitize_email( $comment_data->comment_author_email ), $this->type, $merge_vars ); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | // Prevent direct access to the file |
9 | - defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
9 | + defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
10 | 10 | |
11 | 11 | class Yikes_Easy_MC_BuddyPress_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class { |
12 | 12 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * Outputs a checkbox, if user is not already subscribed |
22 | 22 | */ |
23 | 23 | public function output_checkbox() { |
24 | - if( $this->is_user_already_subscribed( $this->type ) == '1' ) { |
|
24 | + if ( $this->is_user_already_subscribed( $this->type ) == '1' ) { |
|
25 | 25 | return; |
26 | 26 | } |
27 | 27 | ?> |
@@ -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 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function get_position() { |
34 | 34 | $opts = $this->get_options(); |
35 | - return $opts['woocommerce_position']; |
|
35 | + return $opts[ 'woocommerce_position' ]; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -42,22 +42,22 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function add_checkout_field( $fields ) { |
44 | 44 | // get checkbox data |
45 | - $checkbox_options = get_option( 'optin-checkbox-init' , '' ); |
|
45 | + $checkbox_options = get_option( 'optin-checkbox-init', '' ); |
|
46 | 46 | // only display the field if a list is set |
47 | - if( isset( $checkbox_options ) && $checkbox_options[$this->type]['associated-list'] != '-' ) { |
|
48 | - if( $this->is_user_already_subscribed( $this->type ) == '1' ) { |
|
47 | + if ( isset( $checkbox_options ) && $checkbox_options[ $this->type ][ 'associated-list' ] != '-' ) { |
|
48 | + if ( $this->is_user_already_subscribed( $this->type ) == '1' ) { |
|
49 | 49 | return $fields; |
50 | 50 | } |
51 | - if( isset( $checkbox_options[$this->type]['precheck'] ) && $checkbox_options[$this->type]['precheck'] == 'true' ) { |
|
51 | + if ( isset( $checkbox_options[ $this->type ][ 'precheck' ] ) && $checkbox_options[ $this->type ][ 'precheck' ] == 'true' ) { |
|
52 | 52 | $precheck = '1'; |
53 | 53 | } else { |
54 | 54 | $precheck = '0'; |
55 | 55 | } |
56 | - $fields[ 'billing' ]['yikes_mailchimp_checkbox_'.$this->type] = array( |
|
57 | - 'id' => 'yikes_mailchimp_checkbox_'.$this->type, |
|
56 | + $fields[ 'billing' ][ 'yikes_mailchimp_checkbox_' . $this->type ] = array( |
|
57 | + 'id' => 'yikes_mailchimp_checkbox_' . $this->type, |
|
58 | 58 | 'type' => 'checkbox', |
59 | 59 | 'class' => array(), |
60 | - 'label' => $checkbox_options[$this->type]['label'], |
|
60 | + 'label' => $checkbox_options[ $this->type ][ 'label' ], |
|
61 | 61 | 'default' => $precheck, |
62 | 62 | ); |
63 | 63 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function subscribe_from_woocommerce_checkout( $order_id ) { |
80 | 80 | $do_optin = get_post_meta( $order_id, 'yikes_easy_mailchimp_optin', true ); |
81 | - if( $do_optin == '1' ) { |
|
81 | + if ( $do_optin == '1' ) { |
|
82 | 82 | $order = new WC_Order( $order_id ); |
83 | 83 | $email = $order->billing_email; |
84 | 84 | $merge_vars = array( |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | 'LNAME' => $order->billing_last_name, |
88 | 88 | ); |
89 | 89 | // subscribe the user |
90 | - $this->subscribe_user_integration( sanitize_email( $email ) , $this->type , $merge_vars ); |
|
90 | + $this->subscribe_user_integration( sanitize_email( $email ), $this->type, $merge_vars ); |
|
91 | 91 | } |
92 | 92 | return false; |
93 | 93 | } |