| @@ -7,10 +7,9 @@ discard block | ||
| 7 | 7 | * @since 6.0.0 | 
| 8 | 8 | * Author: Yikes Inc. | https://www.yikesinc.com | 
| 9 | 9 | */ | 
| 10 | - class YIKES_Inc_Easy_MailChimp_Process_Ajax | |
| 11 | -	{ | |
| 10 | +	class YIKES_Inc_Easy_MailChimp_Process_Ajax { | |
| 12 | 11 | |
| 13 | -		public function __construct() {				 | |
| 12 | +		public function __construct() { | |
| 14 | 13 | // ajax send merge variable to form builder | 
| 15 | 14 | add_action( 'wp_ajax_add_field_to_form', array( $this , 'send_field_to_form' ), 10 ); | 
| 16 | 15 | // ajax send interest group to form builder | 
| @@ -74,10 +73,10 @@ discard block | ||
| 74 | 73 | // to allow users to pre-check anything they want to assign users appropriately | 
| 75 | 74 | /* note: this function is called statically from the integration settings page */ | 
| 76 | 75 |  		public static function check_list_for_interest_groups( $list_id='', $integration_type='', $load=false ) { | 
| 77 | -			if( ! $list_id ) { 	 | |
| 76 | +			if( ! $list_id ) { | |
| 78 | 77 | $list_id = $_POST['list_id']; | 
| 79 | 78 | } | 
| 80 | -			if( ! $integration_type ) {	 | |
| 79 | +			if( ! $integration_type ) { | |
| 81 | 80 | $integration_type = $_POST['integration']; | 
| 82 | 81 | } | 
| 83 | 82 | $api_key = trim( get_option( 'yikes-mc-api-key' , '' ) ); | 
| @@ -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': | 
| @@ -147,7 +147,7 @@ discard block | ||
| 147 | 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 | 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 | 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> | 
| @@ -170,7 +170,7 @@ discard block | ||
| 170 | 170 | <td> | 
| 171 | 171 | <?php | 
| 172 | 172 | $x = 0; | 
| 173 | -										foreach( $merge_field_data['choices'] as $choice => $value ) {  | |
| 173 | +										foreach( $merge_field_data['choices'] as $choice => $value ) { | |
| 174 | 174 | $pre_selected = !empty( $merge_field_data['default_choice'] ) ? $merge_field_data['default_choice'] : '0'; | 
| 175 | 175 | ?> | 
| 176 | 176 | <label> | 
| @@ -194,7 +194,7 @@ discard block | ||
| 194 | 194 | </td> | 
| 195 | 195 | <td> | 
| 196 | 196 | <select type="default" name="field[<?php echo $merge_field_data['tag']; ?>][default_choice]"> | 
| 197 | -										<?php foreach( $merge_field_data['choices'] as $choice => $value ) {  | |
| 197 | +										<?php foreach( $merge_field_data['choices'] as $choice => $value ) { | |
| 198 | 198 | $pre_selected = ! empty( $merge_field_data['default_choice'] ) ? $merge_field_data['default_choice'] : '0'; | 
| 199 | 199 | ?> | 
| 200 | 200 | <option value="<?php echo $choice; ?>" <?php selected( $pre_selected , $choice ); ?>><?php echo stripslashes( $value ); ?></option> | 
| @@ -22,7 +22,7 @@ discard block | ||
| 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'] ) ) {	 | |
| 25 | +	if( isset( $body['error'] ) ) { | |
| 26 | 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(); | 
| @@ -69,7 +69,7 @@ discard block | ||
| 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': | 
| @@ -97,7 +97,7 @@ discard block | ||
| 97 | 97 | </label> | 
| 98 | 98 | </td> | 
| 99 | 99 | <td> | 
| 100 | -									<?php foreach( $merge_field_data['choices'] as $choice => $value ) {  | |
| 100 | +									<?php foreach( $merge_field_data['choices'] as $choice => $value ) { | |
| 101 | 101 | $pre_selected = !empty( $merge_field_data['default_choice'] ) ? $merge_field_data['default_choice'] : '0'; | 
| 102 | 102 | ?> | 
| 103 | 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 ); ?> | 
| @@ -119,7 +119,7 @@ discard block | ||
| 119 | 119 | </td> | 
| 120 | 120 | <td> | 
| 121 | 121 | <select type="default" name="field[<?php echo $merge_field_data['tag']; ?>][default_choice]"> | 
| 122 | -										<?php foreach( $merge_field_data['choices'] as $choice => $value ) {  | |
| 122 | +										<?php foreach( $merge_field_data['choices'] as $choice => $value ) { | |
| 123 | 123 | $pre_selected = !empty( $merge_field_data['default_choice'] ) ? $merge_field_data['default_choice'] : '0'; | 
| 124 | 124 | ?> | 
| 125 | 125 | <option value="<?php echo $choice; ?>" <?php selected( $pre_selected , $choice ); ?>><?php echo stripslashes( $value ); ?></option> | 
| @@ -59,7 +59,7 @@ discard block | ||
| 59 | 59 | <table class="form-table form-field-container"> | 
| 60 | 60 | |
| 61 | 61 | <!-- Default Value --> | 
| 62 | -				<?php switch( $form_data_array['field_type'] ) {  | |
| 62 | +				<?php switch( $form_data_array['field_type'] ) { | |
| 63 | 63 | |
| 64 | 64 | default: | 
| 65 | 65 | case 'radio': | 
| @@ -71,7 +71,7 @@ discard block | ||
| 71 | 71 | </label> | 
| 72 | 72 | </td> | 
| 73 | 73 | <td> | 
| 74 | -									<?php $i = 0; foreach( $merge_field_data['groups'] as $interest_group ) {  | |
| 74 | +									<?php $i = 0; foreach( $merge_field_data['groups'] as $interest_group ) { | |
| 75 | 75 | $pre_selected = !empty( $merge_field_data['default_choice'] ) ? $merge_field_data['default_choice'] : '0'; | 
| 76 | 76 | ?> | 
| 77 | 77 | <input type="radio" name="field[<?php echo $form_data_array['group_id']; ?>][default_choice][]" value="<?php echo $i; ?>" <?php checked( $pre_selected , $i ); ?>><?php echo stripslashes( $interest_group['name'] ); ?> | 
| @@ -95,7 +95,7 @@ discard block | ||
| 95 | 95 | </label> | 
| 96 | 96 | </td> | 
| 97 | 97 | <td> | 
| 98 | -									<?php $i = 0; foreach( $merge_field_data['groups'] as $interest_group ) {  | |
| 98 | +									<?php $i = 0; foreach( $merge_field_data['groups'] as $interest_group ) { | |
| 99 | 99 | $pre_selected = !empty( $merge_field_data['default_choice'] ) ? $merge_field_data['default_choice'] : '0'; | 
| 100 | 100 | ?> | 
| 101 | 101 | <input type="checkbox" name="field[<?php echo $form_data_array['group_id']; ?>][default_choice][]" value="<?php echo $i; ?>" <?php checked( $pre_selected , $i ); ?>><?php echo stripslashes( $interest_group['name'] ); ?> | 
| @@ -120,7 +120,7 @@ discard block | ||
| 120 | 120 | </td> | 
| 121 | 121 | <td> | 
| 122 | 122 | <select type="default" name="field[<?php echo $form_data_array['group_id']; ?>][default_choice]"> | 
| 123 | -										<?php $i = 0; foreach( $merge_field_data['groups'] as $interest_group ) {  | |
| 123 | +										<?php $i = 0; foreach( $merge_field_data['groups'] as $interest_group ) { | |
| 124 | 124 | $pre_selected = !empty( $merge_field_data['default_choice'] ) ? $merge_field_data['default_choice'] : '0'; | 
| 125 | 125 | ?> | 
| 126 | 126 | <option value="<?php echo $i; ?>" <?php selected( $pre_selected , $i ); ?>><?php echo $interest_group['name']; ?></option> | 
| @@ -76,13 +76,13 @@ discard block | ||
| 76 | 76 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) | 
| 77 | 77 | ) ); | 
| 78 | 78 | $list_data = json_decode( wp_remote_retrieve_body( $list_data ), true ); | 
| 79 | -				if( isset( $list_data['error'] ) ) {	 | |
| 79 | +				if( isset( $list_data['error'] ) ) { | |
| 80 | 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 | 83 | $error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data['error'], __( "Get Account Lists" , 'yikes-inc-easy-mailchimp-extender' ), "Edit Form Page" ); | 
| 84 | 84 | } | 
| 85 | -				} else {				 | |
| 85 | +				} else { | |
| 86 | 86 | // set our transient | 
| 87 | 87 | set_transient( 'yikes-easy-mailchimp-list-data', $list_data, 1 * HOUR_IN_SECONDS ); | 
| 88 | 88 | } | 
| @@ -101,7 +101,7 @@ discard block | ||
| 101 | 101 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) | 
| 102 | 102 | ) ); | 
| 103 | 103 | $available_merge_variables = json_decode( wp_remote_retrieve_body( $available_merge_variables ), true ); | 
| 104 | -			if( isset( $available_merge_variables['error'] ) ) {	 | |
| 104 | +			if( isset( $available_merge_variables['error'] ) ) { | |
| 105 | 105 |  				if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { | 
| 106 | 106 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; | 
| 107 | 107 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); | 
| @@ -123,7 +123,7 @@ discard block | ||
| 123 | 123 | ) ); | 
| 124 | 124 | $interest_groupings = json_decode( wp_remote_retrieve_body( $interest_groupings ), true ); | 
| 125 | 125 | $no_interest_groupings = '<p class="description error-descripion">' . __( 'No Interest Groups Found' , 'yikes-inc-easy-mailchimp-extender' ) . '.</p>'; | 
| 126 | -			if( isset( $interest_groupings['error'] ) ) {	 | |
| 126 | +			if( isset( $interest_groupings['error'] ) ) { | |
| 127 | 127 |  				if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { | 
| 128 | 128 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; | 
| 129 | 129 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); | 
| @@ -137,7 +137,7 @@ discard block | ||
| 137 | 137 | } | 
| 138 | 138 | |
| 139 | 139 | /* Confirm we've retreived our form data */ | 
| 140 | -		if( empty( $form ) ) {  | |
| 140 | +		if( empty( $form ) ) { | |
| 141 | 141 | |
| 142 | 142 | wp_die( __( "We've encountered an error. Please try again. If the error persists, please contact support." , 'yikes-inc-easy-mailchimp-extender' ) , __( 'Error' , 'yikes-inc-easy-mailchimp-extender' ) ); | 
| 143 | 143 | |
| @@ -17,13 +17,13 @@ discard block | ||
| 17 | 17 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) | 
| 18 | 18 | ) ); | 
| 19 | 19 | $list_data = json_decode( wp_remote_retrieve_body( $list_data ), true ); | 
| 20 | -			if( isset( $list_data['error'] ) ) {	 | |
| 20 | +			if( isset( $list_data['error'] ) ) { | |
| 21 | 21 |  				if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { | 
| 22 | 22 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; | 
| 23 | 23 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); | 
| 24 | 24 | $error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data['error'], __( "Get Account Lists" , 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" ); | 
| 25 | 25 | } | 
| 26 | -			} else {		 | |
| 26 | +			} else { | |
| 27 | 27 | // set our transient | 
| 28 | 28 | set_transient( 'yikes-easy-mailchimp-list-data', $list_data, 1 * HOUR_IN_SECONDS ); | 
| 29 | 29 | } | 
| @@ -86,9 +86,9 @@ discard block | ||
| 86 | 86 | |
| 87 | 87 | <!-- TABLE BODY --> | 
| 88 | 88 | <tbody> | 
| 89 | -										<?php if( count( $list_data['total'] ) > 0 ) {  | |
| 89 | +										<?php if( count( $list_data['total'] ) > 0 ) { | |
| 90 | 90 | $i = 1; | 
| 91 | -												foreach( $list_data['data'] as $list ) {  | |
| 91 | +												foreach( $list_data['data'] as $list ) { | |
| 92 | 92 | ?> | 
| 93 | 93 |  											<tr class="<?php if( $i % 2 == 0 ) { echo 'alternate'; } ?>"> | 
| 94 | 94 | <th class="check-column" scope="row"><input type="checkbox" /></th> | 
| @@ -98,7 +98,7 @@ discard block | ||
| 98 | 98 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) | 
| 99 | 99 | ) ); | 
| 100 | 100 | $list_data = json_decode( wp_remote_retrieve_body( $list_data ), true ); | 
| 101 | -				if( isset( $list_data['error'] ) ) {	 | |
| 101 | +				if( isset( $list_data['error'] ) ) { | |
| 102 | 102 |  					if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { | 
| 103 | 103 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; | 
| 104 | 104 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); | 
| @@ -134,7 +134,7 @@ discard block | ||
| 134 | 134 | |
| 135 | 135 | <ul> | 
| 136 | 136 | <?php | 
| 137 | -			if( !empty( $active_plugins ) ) {  | |
| 137 | +			if( !empty( $active_plugins ) ) { | |
| 138 | 138 | |
| 139 | 139 |  				foreach( $active_plugins as $class => $value ) { | 
| 140 | 140 | // echo $class; | 
| @@ -27,7 +27,7 @@ discard block | ||
| 27 | 27 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) | 
| 28 | 28 | ) ); | 
| 29 | 29 | $list_data = json_decode( wp_remote_retrieve_body( $list_data ), true ); | 
| 30 | -			if( isset( $list_data['error'] ) ) {	 | |
| 30 | +			if( isset( $list_data['error'] ) ) { | |
| 31 | 31 |  				if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { | 
| 32 | 32 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; | 
| 33 | 33 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); | 
| @@ -152,9 +152,9 @@ discard block | ||
| 152 | 152 | |
| 153 | 153 | <!-- TABLE BODY --> | 
| 154 | 154 | <tbody> | 
| 155 | -										<?php if( count( $form_results ) > 0 ) {  | |
| 155 | +										<?php if( count( $form_results ) > 0 ) { | |
| 156 | 156 | $i = 1; | 
| 157 | -												foreach( $form_results as $form ) {  | |
| 157 | +												foreach( $form_results as $form ) { | |
| 158 | 158 | ?> | 
| 159 | 159 |  											<tr class="<?php if( $i % 2 == 0 ) { echo 'alternate'; } ?>"> | 
| 160 | 160 | <th class="check-column num" scope="row"><input type="checkbox" /></th> | 
| @@ -202,7 +202,7 @@ discard block | ||
| 202 | 202 | $conversion_rate = '%' . ( round( $form['submissions'] / $form['impressions'] , 2 ) * 100 ); | 
| 203 | 203 |  															if( $conversion_rate >= '%15' ) { | 
| 204 | 204 | $conversion_color = '#00cc00'; // green (unicorn!) | 
| 205 | -															} else if( $conversion_rate < '%15' && $conversion_rate >= '%10' ) {  | |
| 205 | +															} else if( $conversion_rate < '%15' && $conversion_rate >= '%10' ) { | |
| 206 | 206 | $conversion_color = '#0080FF'; // light blue (good) | 
| 207 | 207 |  															} else if( $conversion_rate < '%10' && $conversion_rate >= '%5' ) { | 
| 208 | 208 | $conversion_color = '#FFFF32'; // yellow (ok) | 
| @@ -10,7 +10,7 @@ discard block | ||
| 10 | 10 | $api_error_response = ''; | 
| 11 | 11 |  	} else { | 
| 12 | 12 | $api_connection = '<span id="connection-container" class="api-not-connected"><span class="dashicons dashicons-no-alt yikes-mc-api-not-connected"></span> ' . __( "Not Connected" , 'yikes-inc-easy-mailchimp-extender' ) . '</span>'; | 
| 13 | -		if( get_option( 'yikes-mc-api-invalid-key-response' , '' ) != '' ) {	 | |
| 13 | +		if( get_option( 'yikes-mc-api-invalid-key-response' , '' ) != '' ) { | |
| 14 | 14 | $api_error_response = '<p><small><i class="dashicons dashicons-no-alt"></i> ' . get_option( 'yikes-mc-api-invalid-key-response' , '' ) . '</small></p>'; | 
| 15 | 15 |  		} else { | 
| 16 | 16 | $api_error_response = ''; | 
| @@ -109,7 +109,7 @@ discard block | ||
| 109 | 109 | |
| 110 | 110 | <div class="postbox yikes-easy-mc-postbox"> | 
| 111 | 111 | |
| 112 | -							<?php if( !isset( $_REQUEST['section'] ) || $_REQUEST['section'] == '' ) {  | |
| 112 | +							<?php if( !isset( $_REQUEST['section'] ) || $_REQUEST['section'] == '' ) { | |
| 113 | 113 | include YIKES_MC_PATH . 'admin/partials/menu/options-sections/general-settings.php'; | 
| 114 | 114 |  							} else { | 
| 115 | 115 |  								if( isset( $_REQUEST['addon'] ) && $_REQUEST['addon'] == 'true' ) { |