@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // lets confirm the user has a valid API key stored |
3 | - if( $this->is_user_mc_api_valid_form( false ) == 'valid' ) { |
|
3 | + if ( $this->is_user_mc_api_valid_form( false ) == 'valid' ) { |
|
4 | 4 | // store the API key |
5 | 5 | $api_key = yikes_get_mc_api_key(); |
6 | 6 | $dash_position = strpos( $api_key, '-' ); |
7 | 7 | /// Check for a transients, if not - set them up |
8 | 8 | if ( false === ( $profile_info = get_transient( 'yikes-easy-mailchimp-profile-data' ) ) ) { |
9 | - if( $dash_position !== false ) { |
|
9 | + if ( $dash_position !== false ) { |
|
10 | 10 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/users/profile.json'; |
11 | 11 | } |
12 | 12 | $profile_info = wp_remote_post( $api_endpoint, array( |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) |
18 | 18 | ) ); |
19 | 19 | $profile_info = json_decode( wp_remote_retrieve_body( $profile_info ), true ); |
20 | - if( isset( $profile_info['error'] ) ) { |
|
21 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
20 | + if ( isset( $profile_info[ 'error' ] ) ) { |
|
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 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $profile_info['error'], __( "Get Profile Info." , 'yikes-inc-easy-mailchimp-extender' ), "Account Details Page" ); |
|
24 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $profile_info[ 'error' ], __( "Get Profile Info.", 'yikes-inc-easy-mailchimp-extender' ), "Account Details Page" ); |
|
25 | 25 | } |
26 | 26 | return; |
27 | 27 | } else { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | } |
31 | 31 | } |
32 | 32 | if ( false === ( $account_details = get_transient( 'yikes-easy-mailchimp-account-data' ) ) ) { |
33 | - if( $dash_position !== false ) { |
|
33 | + if ( $dash_position !== false ) { |
|
34 | 34 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/helper/account-details.json'; |
35 | 35 | } |
36 | 36 | $account_details = wp_remote_post( $api_endpoint, array( |
@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) |
42 | 42 | ) ); |
43 | 43 | $account_details = json_decode( wp_remote_retrieve_body( $account_details ), true ); |
44 | - if( isset( $account_details['error'] ) ) { |
|
45 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
44 | + if ( isset( $account_details[ 'error' ] ) ) { |
|
45 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
46 | 46 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
47 | 47 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
48 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $account_details['error'], __( "Get Account Details" , 'yikes-inc-easy-mailchimp-extender' ), "Account Details Page" ); |
|
48 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $account_details[ 'error' ], __( "Get Account Details", 'yikes-inc-easy-mailchimp-extender' ), "Account Details Page" ); |
|
49 | 49 | } |
50 | 50 | } else { |
51 | 51 | // set our transient for one hour |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | if ( false === ( $account_activity = get_transient( 'yikes-easy-mailchimp-account-activity' ) ) ) { |
56 | 56 | // retreive our list data |
57 | - if( $dash_position !== false ) { |
|
57 | + if ( $dash_position !== false ) { |
|
58 | 58 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/helper/chimp-chatter.json'; |
59 | 59 | } |
60 | 60 | $account_activity = wp_remote_post( $api_endpoint, array( |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) |
66 | 66 | ) ); |
67 | 67 | $account_activity = json_decode( wp_remote_retrieve_body( $account_activity ), true ); |
68 | - if( isset( $account_activity['error'] ) ) { |
|
69 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
68 | + if ( isset( $account_activity[ 'error' ] ) ) { |
|
69 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
70 | 70 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
71 | 71 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
72 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $account_activity['error'], __( "Get Chimp Chatter" , 'yikes-inc-easy-mailchimp-extender' ), "Account Details Page" ); |
|
72 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $account_activity[ 'error' ], __( "Get Chimp Chatter", 'yikes-inc-easy-mailchimp-extender' ), "Account Details Page" ); |
|
73 | 73 | } |
74 | 74 | } else { |
75 | 75 | // set our transient for one hour |
@@ -77,16 +77,16 @@ discard block |
||
77 | 77 | } |
78 | 78 | } |
79 | 79 | } else { |
80 | - wp_die( __( 'It looks like you need to re-validate your MailChimp API key before you can continue.' , 'yikes-inc-easy-mailchimp-extender' ) , 500 ); |
|
80 | + wp_die( __( 'It looks like you need to re-validate your MailChimp API key before you can continue.', 'yikes-inc-easy-mailchimp-extender' ), 500 ); |
|
81 | 81 | } |
82 | 82 | ?> |
83 | 83 | <div class="wrap" id="account-details"> |
84 | 84 | <!-- Freddie Logo --> |
85 | - <img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php _e( 'Freddie - MailChimp Mascot' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
85 | + <img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php _e( 'Freddie - MailChimp Mascot', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
86 | 86 | |
87 | - <h1><?php _e( 'Account Overview' , 'yikes-inc-easy-mailchimp-extender' ); echo ' | ' . $profile_info['username']; ?></h1> |
|
87 | + <h1><?php _e( 'Account Overview', 'yikes-inc-easy-mailchimp-extender' ); echo ' | ' . $profile_info[ 'username' ]; ?></h1> |
|
88 | 88 | <!-- Account Overview Page Description --> |
89 | - <p class="yikes-easy-mc-about-text about-text"><?php _e( "Below you'll find a brief overview of account activity as well as some account and profile info." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
89 | + <p class="yikes-easy-mc-about-text about-text"><?php _e( "Below you'll find a brief overview of account activity as well as some account and profile info.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
90 | 90 | |
91 | 91 | <div id="poststuff"> |
92 | 92 | <div id="post-body" class="metabox-holder columns-2"> |
@@ -96,16 +96,16 @@ discard block |
||
96 | 96 | <!-- <div class="postbox yikes-easy-mc-postbox" id="chimp-chatter"> |
97 | 97 | <div class="inside"> --> |
98 | 98 | |
99 | - <h1><?php _e( 'Chimp Chatter' , 'yikes-inc-easy-mailchimp-extender' ); ?></h1> |
|
99 | + <h1><?php _e( 'Chimp Chatter', 'yikes-inc-easy-mailchimp-extender' ); ?></h1> |
|
100 | 100 | |
101 | 101 | <?php |
102 | 102 | $date_format = get_option( 'date_format' ); |
103 | 103 | $time_format = get_option( 'time_format' ); |
104 | 104 | $x = 1; |
105 | 105 | $end = count( $account_activity ); |
106 | - foreach( $account_activity as $activity ) { |
|
107 | - $split_type = explode( ':',str_replace('-',' ',$activity['type'])); |
|
108 | - switch( $activity['type'] ) { |
|
106 | + foreach ( $account_activity as $activity ) { |
|
107 | + $split_type = explode( ':', str_replace( '-', ' ', $activity[ 'type' ] ) ); |
|
108 | + switch ( $activity[ 'type' ] ) { |
|
109 | 109 | case 'lists:new-subscriber': |
110 | 110 | case 'lists:profile-updates': |
111 | 111 | case 'campaigns:facebook-likes': |
@@ -123,60 +123,60 @@ discard block |
||
123 | 123 | $section_class = 'chimp-chatter-neutral'; |
124 | 124 | break; |
125 | 125 | } |
126 | - if( $x < 5 ) { |
|
126 | + if ( $x < 5 ) { |
|
127 | 127 | ?> |
128 | 128 | <!--- <section class="chimp-chatter-container <?php echo esc_attr( $section_class ); ?>"> |
129 | - <div class="chatter-type"><?php echo ucwords( $split_type[1] ); ?></div> |
|
129 | + <div class="chatter-type"><?php echo ucwords( $split_type[ 1 ] ); ?></div> |
|
130 | 130 | <p class="chatter-message description"> |
131 | - <?php echo $activity['message']; ?> |
|
131 | + <?php echo $activity[ 'message' ]; ?> |
|
132 | 132 | </p> |
133 | 133 | <p class="chatter-time"> |
134 | - <?php echo get_date_from_gmt( $activity['update_time'], 'F jS, Y h:i a' ); ?> |
|
134 | + <?php echo get_date_from_gmt( $activity[ 'update_time' ], 'F jS, Y h:i a' ); ?> |
|
135 | 135 | </p> |
136 | 136 | </section> --> |
137 | 137 | |
138 | - <section class="postbox yikes-easy-mc-postbox chimp-chatter-postbox <?php echo esc_attr( $section_class ); if( $x % 2 == 0 ) { echo ' even'; } ?>"> |
|
138 | + <section class="postbox yikes-easy-mc-postbox chimp-chatter-postbox <?php echo esc_attr( $section_class ); if ( $x % 2 == 0 ) { echo ' even'; } ?>"> |
|
139 | 139 | <div class="inside"> |
140 | - <div class="chatter-type"><?php echo ucwords( $split_type[1] ); ?></div> |
|
140 | + <div class="chatter-type"><?php echo ucwords( $split_type[ 1 ] ); ?></div> |
|
141 | 141 | <p class="chatter-message description"> |
142 | - <?php echo $activity['message']; ?> |
|
142 | + <?php echo $activity[ 'message' ]; ?> |
|
143 | 143 | </p> |
144 | 144 | <p class="chatter-time"> |
145 | - <?php echo get_date_from_gmt( $activity['update_time'], 'F jS, Y h:i a' ); ?> |
|
145 | + <?php echo get_date_from_gmt( $activity[ 'update_time' ], 'F jS, Y h:i a' ); ?> |
|
146 | 146 | </p> |
147 | 147 | </div> |
148 | 148 | </section> |
149 | 149 | <?php |
150 | 150 | } else { |
151 | - if( $x == 7 ) { |
|
151 | + if ( $x == 7 ) { |
|
152 | 152 | ?> |
153 | 153 | <div id="hidden-chatter" class="yikes-easy-mc-hidden"> |
154 | 154 | <?php |
155 | 155 | } |
156 | 156 | ?> |
157 | 157 | <!-- <section class="chimp-chatter-container <?php echo esc_attr( $section_class ); ?>"> |
158 | - <div class="chatter-type"><?php echo ucwords( $split_type[1] ); ?></div> |
|
158 | + <div class="chatter-type"><?php echo ucwords( $split_type[ 1 ] ); ?></div> |
|
159 | 159 | <p class="chatter-message description"> |
160 | - <?php echo $activity['message']; ?> |
|
160 | + <?php echo $activity[ 'message' ]; ?> |
|
161 | 161 | </p> |
162 | 162 | <p class="chatter-time"> |
163 | - <?php echo get_date_from_gmt( $activity['update_time'], 'F jS, Y h:i a' ); ?> |
|
163 | + <?php echo get_date_from_gmt( $activity[ 'update_time' ], 'F jS, Y h:i a' ); ?> |
|
164 | 164 | </p> |
165 | 165 | </section> --> |
166 | 166 | |
167 | - <section class="postbox yikes-easy-mc-postbox chimp-chatter-postbox <?php echo esc_attr( $section_class ); if( $x % 2 == 0 ) { echo ' even'; } ?>"> |
|
167 | + <section class="postbox yikes-easy-mc-postbox chimp-chatter-postbox <?php echo esc_attr( $section_class ); if ( $x % 2 == 0 ) { echo ' even'; } ?>"> |
|
168 | 168 | <div class="inside"> |
169 | - <div class="chatter-type"><?php echo ucwords( $split_type[1] ); ?></div> |
|
169 | + <div class="chatter-type"><?php echo ucwords( $split_type[ 1 ] ); ?></div> |
|
170 | 170 | <p class="chatter-message description"> |
171 | - <?php echo $activity['message']; ?> |
|
171 | + <?php echo $activity[ 'message' ]; ?> |
|
172 | 172 | </p> |
173 | 173 | <p class="chatter-time"> |
174 | - <?php echo get_date_from_gmt( $activity['update_time'], 'F jS, Y h:i a' ); ?> |
|
174 | + <?php echo get_date_from_gmt( $activity[ 'update_time' ], 'F jS, Y h:i a' ); ?> |
|
175 | 175 | </p> |
176 | 176 | </div> |
177 | 177 | </section> |
178 | 178 | <?php |
179 | - if( $x == $end ) { |
|
179 | + if ( $x == $end ) { |
|
180 | 180 | ?> |
181 | 181 | </div> |
182 | 182 | <?php |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | ?> |
188 | 188 | |
189 | 189 | <div class="chimpchatter-button-container"> |
190 | - <a href="#" onclick="jQuery(this).parents().find('#hidden-chatter').slideToggle();jQuery(this).fadeOut();return false;" class="button-primary"><?php _e( 'View All Activity' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
190 | + <a href="#" onclick="jQuery(this).parents().find('#hidden-chatter').slideToggle();jQuery(this).fadeOut();return false;" class="button-primary"><?php _e( 'View All Activity', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
191 | 191 | </div> |
192 | 192 | |
193 | 193 | <!-- </div> --> |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | <div class="postbox yikes-easy-mc-postbox"> |
209 | 209 | <div class="inside"> |
210 | 210 | |
211 | - <a href="https://us3.admin.mailchimp.com/" title="<?php _e( 'MailChimp Site' , 'yikes-inc-easy-mailchimp-extender' ); ?>" target="_blank"> |
|
212 | - <img src="<?php echo YIKES_MC_URL . 'includes/images/Welcome_Page/mailchimp-logo.png'; ?>" title="<?php _e( 'MailChimp Site' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="chimp-chatter-mailchimp-logo"> |
|
211 | + <a href="https://us3.admin.mailchimp.com/" title="<?php _e( 'MailChimp Site', 'yikes-inc-easy-mailchimp-extender' ); ?>" target="_blank"> |
|
212 | + <img src="<?php echo YIKES_MC_URL . 'includes/images/Welcome_Page/mailchimp-logo.png'; ?>" title="<?php _e( 'MailChimp Site', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="chimp-chatter-mailchimp-logo"> |
|
213 | 213 | </a> |
214 | 214 | |
215 | 215 | </div> |
@@ -219,60 +219,60 @@ discard block |
||
219 | 219 | <div class="postbox yikes-easy-mc-postbox chimp-chatter-sidebar"> |
220 | 220 | <div class="inside"> |
221 | 221 | |
222 | - <h2 class="account-status"><?php if( $account_details['has_activated'] == 1 ) { ?><div class="circle-account-active" title="<?php _e( "Account Active" , 'yikes-inc-easy-mailchimp-extender' ); ?>"></div><?php } else { ?><div class="circle-account-inactive" title="<?php _e( "Account Inactive" , 'yikes-inc-easy-mailchimp-extender' ); ?>"></div><?php } echo $profile_info['name']; ?> <small>(<?php echo $profile_info['role']; ?>)</small></h2> |
|
222 | + <h2 class="account-status"><?php if ( $account_details[ 'has_activated' ] == 1 ) { ?><div class="circle-account-active" title="<?php _e( "Account Active", 'yikes-inc-easy-mailchimp-extender' ); ?>"></div><?php } else { ?><div class="circle-account-inactive" title="<?php _e( "Account Inactive", 'yikes-inc-easy-mailchimp-extender' ); ?>"></div><?php } echo $profile_info[ 'name' ]; ?> <small>(<?php echo $profile_info[ 'role' ]; ?>)</small></h2> |
|
223 | 223 | |
224 | - <img class="mailchimp-avatar" src="<?php echo esc_url_raw( $profile_info['avatar'] ); ?>" title="<?php echo $profile_info['username'] . ' ' . __( "MailChimp avatar" , 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
224 | + <img class="mailchimp-avatar" src="<?php echo esc_url_raw( $profile_info[ 'avatar' ] ); ?>" title="<?php echo $profile_info[ 'username' ] . ' ' . __( "MailChimp avatar", 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
225 | 225 | |
226 | 226 | <table class="form-table" id="account-details-table"> |
227 | 227 | <tr valign="top"> |
228 | 228 | <td scope="row"> |
229 | 229 | <label for="tablecell"> |
230 | - <strong><?php _e( 'Company' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
230 | + <strong><?php _e( 'Company', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
231 | 231 | </label> |
232 | 232 | </td> |
233 | - <td><?php echo $account_details['contact']['company']; ?><br /><?php echo $account_details['contact']['city'] . ', ' . $account_details['contact']['state']; ?></td> |
|
233 | + <td><?php echo $account_details[ 'contact' ][ 'company' ]; ?><br /><?php echo $account_details[ 'contact' ][ 'city' ] . ', ' . $account_details[ 'contact' ][ 'state' ]; ?></td> |
|
234 | 234 | </tr> |
235 | 235 | <tr valign="top"> |
236 | 236 | <td scope="row"> |
237 | 237 | <label for="tablecell"> |
238 | - <strong><?php _e( 'Industry' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
238 | + <strong><?php _e( 'Industry', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
239 | 239 | </label> |
240 | 240 | </td> |
241 | - <td><?php echo $account_details['industry']; ?></td> |
|
241 | + <td><?php echo $account_details[ 'industry' ]; ?></td> |
|
242 | 242 | </tr> |
243 | 243 | <tr valign="top"> |
244 | 244 | <td scope="row"> |
245 | 245 | <label for="tablecell"> |
246 | - <strong><?php _e( 'Member Since' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
246 | + <strong><?php _e( 'Member Since', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
247 | 247 | </label> |
248 | 248 | </td> |
249 | - <td><?php echo date( get_option('date_format') , strtotime( $account_details['member_since'] ) ); ?></td> |
|
249 | + <td><?php echo date( get_option( 'date_format' ), strtotime( $account_details[ 'member_since' ] ) ); ?></td> |
|
250 | 250 | </tr> |
251 | 251 | <tr valign="top"> |
252 | 252 | <td scope="row"> |
253 | 253 | <label for="tablecell"> |
254 | - <strong><?php _e( 'Plan Type' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
254 | + <strong><?php _e( 'Plan Type', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
255 | 255 | </label> |
256 | 256 | </td> |
257 | - <td><?php echo ucwords( $account_details['plan_type'] ); ?></td> |
|
257 | + <td><?php echo ucwords( $account_details[ 'plan_type' ] ); ?></td> |
|
258 | 258 | </tr> |
259 | - <?php if( $account_details['plan_type'] == 'payasyougo' || $account_details['plan_type'] == 'free' ) { ?> |
|
259 | + <?php if ( $account_details[ 'plan_type' ] == 'payasyougo' || $account_details[ 'plan_type' ] == 'free' ) { ?> |
|
260 | 260 | <tr valign="top"> |
261 | 261 | <td scope="row"> |
262 | 262 | <label for="tablecell"> |
263 | - <strong><?php _e( 'Emails Left' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
263 | + <strong><?php _e( 'Emails Left', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
264 | 264 | </label> |
265 | 265 | </td> |
266 | - <td><?php echo number_format( $account_details['emails_left'] ); ?></td> |
|
266 | + <td><?php echo number_format( $account_details[ 'emails_left' ] ); ?></td> |
|
267 | 267 | </tr> |
268 | 268 | <?php } ?> |
269 | 269 | <tr valign="top"> |
270 | 270 | <td scope="row"> |
271 | 271 | <label for="tablecell"> |
272 | - <strong><?php _e( 'Affiliate Link' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
272 | + <strong><?php _e( 'Affiliate Link', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
273 | 273 | </label> |
274 | 274 | </td> |
275 | - <td><a href="#" onclick="jQuery(this).hide().next().fadeIn('fast');return false;" class="button-secondary"><?php _e( 'View Link', 'yikes-inc-easy-mailchimp-extender' ); ?></a><input type="text" class="widefat mailchimp-affiliate-link" readonly value="<?php echo esc_url_raw( $account_details['affiliate_link'] ); ?>" onclick="jQuery(this).select();return false;"></td> |
|
275 | + <td><a href="#" onclick="jQuery(this).hide().next().fadeIn('fast');return false;" class="button-secondary"><?php _e( 'View Link', 'yikes-inc-easy-mailchimp-extender' ); ?></a><input type="text" class="widefat mailchimp-affiliate-link" readonly value="<?php echo esc_url_raw( $account_details[ 'affiliate_link' ] ); ?>" onclick="jQuery(this).select();return false;"></td> |
|
276 | 276 | </tr> |
277 | 277 | </table> |
278 | 278 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | $yikes_mc_api_constant = ( defined( 'YIKES_MC_API_KEY' ) ) ? true : false; |
9 | 9 | ?> |
10 | 10 | |
11 | -<h3><span><?php _e( 'General Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></span><?php echo $api_connection; ?></h3> |
|
11 | +<h3><span><?php _e( 'General Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></span><?php echo $api_connection; ?></h3> |
|
12 | 12 | <div class="inside"> |
13 | 13 | |
14 | 14 | <!-- Settings Form --> |
@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | <!-- MailChimp API Input Field --> |
22 | 22 | <label for="yks-mailchimp-api-key"> |
23 | 23 | |
24 | - <p><?php _e( 'Enter your API key in the field below to connect your site to your MailChimp account.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
24 | + <p><?php _e( 'Enter your API key in the field below to connect your site to your MailChimp account.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
25 | 25 | |
26 | - <p><strong><?php _e( 'MailChimp API Key' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
26 | + <p><strong><?php _e( 'MailChimp API Key', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
27 | 27 | |
28 | - <input autocomplete="off" <?php if ( $yikes_mc_api_constant ) { echo 'readonly="readonly"'; } if( strlen( yikes_get_mc_api_key() ) > 0 ) { ?> type="password" <?php } else { ?> type="text" <?php } ?> value="<?php echo yikes_get_mc_api_key(); ?>" placeholder="<?php _e( 'MailChimp API Key' , 'yikes-inc-easy-mailchimp-extender' ); ?>" name="yikes-mc-api-key" id="yikes-mc-api-key" class="settings-page-input" /> |
|
28 | + <input autocomplete="off" <?php if ( $yikes_mc_api_constant ) { echo 'readonly="readonly"'; } if ( strlen( yikes_get_mc_api_key() ) > 0 ) { ?> type="password" <?php } else { ?> type="text" <?php } ?> value="<?php echo yikes_get_mc_api_key(); ?>" placeholder="<?php _e( 'MailChimp API Key', 'yikes-inc-easy-mailchimp-extender' ); ?>" name="yikes-mc-api-key" id="yikes-mc-api-key" class="settings-page-input" /> |
|
29 | 29 | |
30 | 30 | <?php if ( $yikes_mc_api_constant ) { ?> |
31 | 31 | <p class="description"><?php printf( __( "Your MailChimp API key has been defined using the %s constant, in a PHP file.", "yikes-inc-easy-mailchimp-extender" ), '<code>YIKES_MC_API_KEY</code>' ); ?></p> |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | <?php echo $api_error_response; ?> |
35 | 35 | |
36 | 36 | <?php if ( ! $yikes_mc_api_constant ) { ?> |
37 | - <p class="description"><small><a href="https://admin.mailchimp.com/account/api" target="_blank" title="<?php _e( 'Get your API key here' , 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'Get your API key here' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></p> |
|
37 | + <p class="description"><small><a href="https://admin.mailchimp.com/account/api" target="_blank" title="<?php _e( 'Get your API key here', 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'Get your API key here', 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></p> |
|
38 | 38 | <?php } ?> |
39 | 39 | </label> |
40 | 40 |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // enqueue jquery qtip for our tooltip |
14 | - wp_enqueue_script( 'jquery-qtip-tooltip', YIKES_MC_URL . 'admin/js/min/jquery.qtip.min.js' , array( 'jquery' ) ); |
|
15 | - wp_enqueue_style( 'jquery-qtip-style', YIKES_MC_URL . 'admin/css/jquery.qtip.min.css' ); |
|
14 | + wp_enqueue_script( 'jquery-qtip-tooltip', YIKES_MC_URL . 'admin/js/min/jquery.qtip.min.js', array( 'jquery' ) ); |
|
15 | + wp_enqueue_style( 'jquery-qtip-style', YIKES_MC_URL . 'admin/css/jquery.qtip.min.css' ); |
|
16 | 16 | |
17 | 17 | ?> |
18 | 18 | <script> |
@@ -43,50 +43,50 @@ discard block |
||
43 | 43 | ); |
44 | 44 | |
45 | 45 | $class_descriptions = array( |
46 | - 'comment_form' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/wordpress-banner-logo.png" title="' . __( 'WordPress' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Enabling the WordPress core comment form opt-in checkbox will display a checkbox to your current users when leaving a comment (if they are not currently subscribed).' , 'yikes-inc-easy-mailchimp-extender' ), |
|
47 | - 'registration_form' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/wordpress-banner-logo.png" title="' . __( 'WordPress' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Enabling the WordPress core registration form opt-in checkbox will display a checkbox to new users when registering for your site.' , 'yikes-inc-easy-mailchimp-extender' ), |
|
48 | - 'woocommerce_checkout_form' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/woocommerce-banner.png" title="' . __( 'WooCommerce Store' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Enabling the WooCommerce checkout opt-in form allows you to capture email addresses from users who make purchases in your store. This option will add an opt-in checkbox to the checkout page.' , 'yikes-inc-easy-mailchimp-extender' ), |
|
49 | - 'easy_digital_downloads_checkout_form' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/edd-banner.png" title="' . __( 'Easy Digital Downloads' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Enabling the Easy Digital Downloads checkout opt-in allows users who make a purchase to opt-in to your mailing list during checkout.' , 'yikes-inc-easy-mailchimp-extender' ), |
|
50 | - 'buddypress_form' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/buddypress-banner.png" title="' . __( 'BuddyPress' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Enabling the BuddyPress opt-in allows users who register for your site to be automatically added to the mailing list of your choice.' , 'yikes-inc-easy-mailchimp-extender' ), |
|
51 | - 'bbpress_forms' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/bbpress-banner.png" title="' . __( 'bbPress' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Enabling the bbPress opt-in enables users who register to use the forums on your site to be automatically added to the mailing list of your choice.' , 'yikes-inc-easy-mailchimp-extender' ), |
|
52 | - 'contact_form_7' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/cf7-banner.png" title="' . __( 'Contact Form 7' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Once the Contact Form 7 integration is active you can use our custom shortcode [yikes_mailchimp_checkbox] in your contact forms to subscribe users to a pre-selected list.' , 'yikes-inc-easy-mailchimp-extender' ), |
|
46 | + 'comment_form' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/wordpress-banner-logo.png" title="' . __( 'WordPress', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Enabling the WordPress core comment form opt-in checkbox will display a checkbox to your current users when leaving a comment (if they are not currently subscribed).', 'yikes-inc-easy-mailchimp-extender' ), |
|
47 | + 'registration_form' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/wordpress-banner-logo.png" title="' . __( 'WordPress', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Enabling the WordPress core registration form opt-in checkbox will display a checkbox to new users when registering for your site.', 'yikes-inc-easy-mailchimp-extender' ), |
|
48 | + 'woocommerce_checkout_form' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/woocommerce-banner.png" title="' . __( 'WooCommerce Store', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Enabling the WooCommerce checkout opt-in form allows you to capture email addresses from users who make purchases in your store. This option will add an opt-in checkbox to the checkout page.', 'yikes-inc-easy-mailchimp-extender' ), |
|
49 | + 'easy_digital_downloads_checkout_form' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/edd-banner.png" title="' . __( 'Easy Digital Downloads', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Enabling the Easy Digital Downloads checkout opt-in allows users who make a purchase to opt-in to your mailing list during checkout.', 'yikes-inc-easy-mailchimp-extender' ), |
|
50 | + 'buddypress_form' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/buddypress-banner.png" title="' . __( 'BuddyPress', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Enabling the BuddyPress opt-in allows users who register for your site to be automatically added to the mailing list of your choice.', 'yikes-inc-easy-mailchimp-extender' ), |
|
51 | + 'bbpress_forms' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/bbpress-banner.png" title="' . __( 'bbPress', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Enabling the bbPress opt-in enables users who register to use the forums on your site to be automatically added to the mailing list of your choice.', 'yikes-inc-easy-mailchimp-extender' ), |
|
52 | + 'contact_form_7' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/cf7-banner.png" title="' . __( 'Contact Form 7', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Once the Contact Form 7 integration is active you can use our custom shortcode [yikes_mailchimp_checkbox] in your contact forms to subscribe users to a pre-selected list.', 'yikes-inc-easy-mailchimp-extender' ), |
|
53 | 53 | ); |
54 | 54 | |
55 | 55 | // Easy Digital Downloads |
56 | - if( class_exists( 'Easy_Digital_Downloads' ) ) { |
|
57 | - $active_plugins['easy_digital_downloads_checkout_form'] = __( 'Easy Digital Downloads Checkout', 'yikes-inc-easy-mailchimp-extender' ); |
|
56 | + if ( class_exists( 'Easy_Digital_Downloads' ) ) { |
|
57 | + $active_plugins[ 'easy_digital_downloads_checkout_form' ] = __( 'Easy Digital Downloads Checkout', 'yikes-inc-easy-mailchimp-extender' ); |
|
58 | 58 | } |
59 | 59 | // WooCommerce |
60 | - if( class_exists( 'WooCommerce' ) ) { |
|
61 | - $active_plugins['woocommerce_checkout_form'] = __( 'WooCommerce Checkout', 'yikes-inc-easy-mailchimp-extender' ); |
|
60 | + if ( class_exists( 'WooCommerce' ) ) { |
|
61 | + $active_plugins[ 'woocommerce_checkout_form' ] = __( 'WooCommerce Checkout', 'yikes-inc-easy-mailchimp-extender' ); |
|
62 | 62 | } |
63 | 63 | // BuddyPress |
64 | - if( class_exists( 'BuddyPress' ) ) { |
|
65 | - $active_plugins['buddypress_form'] = __( 'BuddyPress Registration', 'yikes-inc-easy-mailchimp-extender' ); |
|
64 | + if ( class_exists( 'BuddyPress' ) ) { |
|
65 | + $active_plugins[ 'buddypress_form' ] = __( 'BuddyPress Registration', 'yikes-inc-easy-mailchimp-extender' ); |
|
66 | 66 | } |
67 | 67 | // bbPress |
68 | - if( class_exists( 'bbPress' ) ) { |
|
69 | - $active_plugins['bbpress_forms'] = __( 'bbPress', 'yikes-inc-easy-mailchimp-extender' ); |
|
68 | + if ( class_exists( 'bbPress' ) ) { |
|
69 | + $active_plugins[ 'bbpress_forms' ] = __( 'bbPress', 'yikes-inc-easy-mailchimp-extender' ); |
|
70 | 70 | } |
71 | 71 | // Contact Form 7 |
72 | - if( is_plugin_active( 'contact-form-7/wp-contact-form-7.php' ) ) { |
|
73 | - $active_plugins['contact_form_7'] = __( 'Contact Form 7', 'yikes-inc-easy-mailchimp-extender' ); |
|
72 | + if ( is_plugin_active( 'contact-form-7/wp-contact-form-7.php' ) ) { |
|
73 | + $active_plugins[ 'contact_form_7' ] = __( 'Contact Form 7', 'yikes-inc-easy-mailchimp-extender' ); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | // store our checkbox options |
77 | - $options = get_option( 'optin-checkbox-init' , '' ); |
|
77 | + $options = get_option( 'optin-checkbox-init', '' ); |
|
78 | 78 | ?> |
79 | -<h3><span><?php _e( 'Integration Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
79 | +<h3><span><?php _e( 'Integration Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
80 | 80 | |
81 | 81 | |
82 | 82 | <?php |
83 | 83 | // lets confirm the user has a valid API key stored |
84 | - if( $this->is_user_mc_api_valid_form( false ) == 'valid' ) { |
|
84 | + if ( $this->is_user_mc_api_valid_form( false ) == 'valid' ) { |
|
85 | 85 | /// Check for a transient, if not - set one up for one hour |
86 | 86 | if ( false === ( $list_data = get_transient( 'yikes-easy-mailchimp-list-data' ) ) ) { |
87 | 87 | $api_key = yikes_get_mc_api_key(); |
88 | 88 | $dash_position = strpos( $api_key, '-' ); |
89 | - if( $dash_position !== false ) { |
|
89 | + if ( $dash_position !== false ) { |
|
90 | 90 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/list.json'; |
91 | 91 | } |
92 | 92 | $list_data = wp_remote_post( $api_endpoint, array( |
@@ -98,11 +98,11 @@ 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'] ) ) { |
|
102 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
101 | + if ( isset( $list_data[ 'error' ] ) ) { |
|
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(); |
105 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data['error'], __( "Get Account Lists" , 'yikes-inc-easy-mailchimp-extender' ), "Integration Settings Page" ); |
|
105 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data[ 'error' ], __( "Get Account Lists", 'yikes-inc-easy-mailchimp-extender' ), "Integration Settings Page" ); |
|
106 | 106 | } |
107 | 107 | } else { |
108 | 108 | // set our transient |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | ?> |
114 | 114 | <div class="inside"> |
115 | 115 | <?php |
116 | - echo sprintf( __( 'Please %s to setup your integrations.', 'yikes-inc-easy-mailchimp-extender' ), '<a href="' . esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=general-settings' ) ) . '" title="' . __( 'General Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'enter a valid MailChimp API key' , 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ); |
|
116 | + echo sprintf( __( 'Please %s to setup your integrations.', 'yikes-inc-easy-mailchimp-extender' ), '<a href="' . esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=general-settings' ) ) . '" title="' . __( 'General Settings', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'enter a valid MailChimp API key', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ); |
|
117 | 117 | ?> |
118 | 118 | </div> |
119 | 119 | <?php |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | <div class="inside"> |
125 | 125 | |
126 | 126 | <p> |
127 | - <?php _e( 'Select which plugins or features Easy Forms for MailChimp by Yikes Inc. should integrate with. Depending on which plugins or features you choose to integrate with, an opt-in checkbox will be generated. For example, the comment form checkbox will generate a checkbox below the standard WordPress comment form to add any new commenters to a pre-determined MailChimp mailing list.' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
127 | + <?php _e( 'Select which plugins or features Easy Forms for MailChimp by Yikes Inc. should integrate with. Depending on which plugins or features you choose to integrate with, an opt-in checkbox will be generated. For example, the comment form checkbox will generate a checkbox below the standard WordPress comment form to add any new commenters to a pre-determined MailChimp mailing list.', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
128 | 128 | </p> |
129 | 129 | |
130 | 130 | <!-- Settings Form --> |
@@ -134,54 +134,54 @@ discard block |
||
134 | 134 | |
135 | 135 | <ul> |
136 | 136 | <?php |
137 | - if( !empty( $active_plugins ) ) { |
|
137 | + if ( ! empty( $active_plugins ) ) { |
|
138 | 138 | |
139 | - foreach( $active_plugins as $class => $value ) { |
|
139 | + foreach ( $active_plugins as $class => $value ) { |
|
140 | 140 | // echo $class; |
141 | - $checked = isset( $options[$class]['value'] ) ? 'checked="checked"' : ''; |
|
142 | - $hidden = !isset( $options[$class]['value'] ) ? 'yikes-easy-mc-hidden' : ''; |
|
143 | - $checkbox_label = isset( $options[$class]['label'] ) ? esc_attr__( $options[$class]['label'] ) : ''; |
|
144 | - $precheck_checkbox = isset( $options[$class]['precheck'] ) ? $options[$class]['precheck'] : ''; |
|
145 | - $selected_list = isset( $options[$class]['associated-list'] ) ? $options[$class]['associated-list'] : '-'; |
|
146 | - $list_interest_groups = isset( $options[$class]['interest-groups'] ) ? $options[$class]['interest-groups'] : false; |
|
141 | + $checked = isset( $options[ $class ][ 'value' ] ) ? 'checked="checked"' : ''; |
|
142 | + $hidden = ! isset( $options[ $class ][ 'value' ] ) ? 'yikes-easy-mc-hidden' : ''; |
|
143 | + $checkbox_label = isset( $options[ $class ][ 'label' ] ) ? esc_attr__( $options[ $class ][ 'label' ] ) : ''; |
|
144 | + $precheck_checkbox = isset( $options[ $class ][ 'precheck' ] ) ? $options[ $class ][ 'precheck' ] : ''; |
|
145 | + $selected_list = isset( $options[ $class ][ 'associated-list' ] ) ? $options[ $class ][ 'associated-list' ] : '-'; |
|
146 | + $list_interest_groups = isset( $options[ $class ][ 'interest-groups' ] ) ? $options[ $class ][ 'interest-groups' ] : false; |
|
147 | 147 | ?> |
148 | 148 | <li> |
149 | 149 | <label> |
150 | - <input type="checkbox" name="optin-checkbox-init[<?php echo $class; ?>][value]" value="on" <?php echo $checked; ?> onclick="jQuery(this).parents('li').next().stop().slideToggle();"><?php echo ucwords( $value ); ?><span class="dashicons dashicons-editor-help"></span><div class="tooltiptext qtip-bootstrap" style="display:none;"><?php echo $class_descriptions[$class]; ?></div> |
|
150 | + <input type="checkbox" name="optin-checkbox-init[<?php echo $class; ?>][value]" value="on" <?php echo $checked; ?> onclick="jQuery(this).parents('li').next().stop().slideToggle();"><?php echo ucwords( $value ); ?><span class="dashicons dashicons-editor-help"></span><div class="tooltiptext qtip-bootstrap" style="display:none;"><?php echo $class_descriptions[ $class ]; ?></div> |
|
151 | 151 | </label> |
152 | 152 | </li> |
153 | 153 | <!-- checkbox settings, text - associated list etc. --> |
154 | 154 | <li class="optin-checkbox-init[<?php echo $class; ?>]-settings <?php echo $hidden; ?>"> |
155 | - <?php if( $class == 'contact_form_7' ) { ?> |
|
155 | + <?php if ( $class == 'contact_form_7' ) { ?> |
|
156 | 156 | <p style="margin-top:0;"><small class="contact-form-7-notice"><?php printf( __( 'Use %s in Contact Form 7 to display the checkbox.', 'yikes-inc-easy-mailchimp-extender' ), '<code>[yikes_mailchimp_checkbox]</code>' ); ?></small></p> |
157 | 157 | <?php } ?> |
158 | 158 | <p style="margin-top:0;padding-top:0;margin-bottom:0;padding-bottom:0;"> |
159 | 159 | <!-- checkbox associated list --> |
160 | - <label><?php _e( 'Associated List' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
160 | + <label><?php _e( 'Associated List', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
161 | 161 | <?php |
162 | - if( $list_data['total'] > 0 ) { |
|
162 | + if ( $list_data[ 'total' ] > 0 ) { |
|
163 | 163 | ?> |
164 | 164 | <select class="optin-checkbox-init[<?php echo $class; ?>][associated-list] checkbox-settings-list-dropdown" data-attr-integration="<?php echo $class; ?>" name="optin-checkbox-init[<?php echo $class; ?>][associated-list]" onchange="checkForInterestGroups( jQuery( this ), jQuery( this ).find( 'option:selected' ).val(), jQuery( this ).attr( 'data-attr-integration' ) );return false;"> |
165 | - <option value="-" <?php selected( $selected_list , '-' ); ?>><?php _e( 'Select a List' , 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
166 | - <?php foreach( $list_data['data'] as $list ) { ?> |
|
167 | - <option value="<?php echo $list['id']; ?>" <?php selected( $selected_list , $list['id'] ); ?>><?php echo $list['name']; ?></option> |
|
165 | + <option value="-" <?php selected( $selected_list, '-' ); ?>><?php _e( 'Select a List', 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
166 | + <?php foreach ( $list_data[ 'data' ] as $list ) { ?> |
|
167 | + <option value="<?php echo $list[ 'id' ]; ?>" <?php selected( $selected_list, $list[ 'id' ] ); ?>><?php echo $list[ 'name' ]; ?></option> |
|
168 | 168 | <?php } ?> |
169 | 169 | </select> |
170 | 170 | <?php |
171 | 171 | } else { |
172 | - echo '<p class="description no-lists-setup-notice"><strong>' . __( 'You have not setup any lists. You should head over to MailChimp and setup your first list.' , 'yikes-inc-easy-mailchimp-extender' ) . '</strong></p>'; |
|
172 | + echo '<p class="description no-lists-setup-notice"><strong>' . __( 'You have not setup any lists. You should head over to MailChimp and setup your first list.', 'yikes-inc-easy-mailchimp-extender' ) . '</strong></p>'; |
|
173 | 173 | } |
174 | 174 | ?> |
175 | 175 | </label> |
176 | 176 | <!-- checkbox text label --> |
177 | - <label><?php _e( 'Checkbox Label' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
177 | + <label><?php _e( 'Checkbox Label', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
178 | 178 | <input type="text" class="optin-checkbox-init[<?php echo $class; ?>][label] optin-checkbox-label-input" name="optin-checkbox-init[<?php echo $class; ?>][label]" value="<?php echo $checkbox_label; ?>"> |
179 | 179 | </label> |
180 | 180 | <!-- prechecked? --> |
181 | - <label><?php _e( 'Precheck Checkbox' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
181 | + <label><?php _e( 'Precheck Checkbox', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
182 | 182 | <select id="optin-checkbox-init[<?php echo $class; ?>][precheck]" name="optin-checkbox-init[<?php echo $class; ?>][precheck]" class="optin-checkbox-init[<?php echo $class; ?>][precheck] checkbox-settings-list-dropdown"> |
183 | - <option value="true" <?php selected( $precheck_checkbox , 'true' ); ?>><?php _e( 'Yes' , 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
184 | - <option value="false" <?php selected( $precheck_checkbox , 'false' ); ?>><?php _e( 'No' , 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
183 | + <option value="true" <?php selected( $precheck_checkbox, 'true' ); ?>><?php _e( 'Yes', 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
184 | + <option value="false" <?php selected( $precheck_checkbox, 'false' ); ?>><?php _e( 'No', 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
185 | 185 | </select> |
186 | 186 | </label> |
187 | 187 | |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | $interest_groupings = get_transient( $selected_list . '_interest_group' ); |
193 | 193 | $integration_type = $class; |
194 | 194 | require( YIKES_MC_PATH . 'admin/partials/menu/options-sections/templates/integration-interest-groups.php' ); |
195 | - } else if( $selected_list != '-' && $list_interest_groups ) { |
|
196 | - $list_id = $options[$class]['associated-list']; |
|
195 | + } else if ( $selected_list != '-' && $list_interest_groups ) { |
|
196 | + $list_id = $options[ $class ][ 'associated-list' ]; |
|
197 | 197 | $integration_type = $class; |
198 | 198 | YIKES_Inc_Easy_MailChimp_Process_Ajax::check_list_for_interest_groups( $list_id, $integration_type, true ); |
199 | 199 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | } else { |
209 | 209 | ?> |
210 | 210 | <li> |
211 | - <?php _e( 'Nothing is active.' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
211 | + <?php _e( 'Nothing is active.', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
212 | 212 | </li> |
213 | 213 | <?php |
214 | 214 | } |
@@ -3,15 +3,15 @@ discard block |
||
3 | 3 | $form_interface = yikes_easy_mailchimp_extender_get_form_interface(); |
4 | 4 | $all_forms = $form_interface->get_all_forms(); |
5 | 5 | ?> |
6 | -<h3><span><?php _e( 'Import/Export Forms & Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
6 | +<h3><span><?php _e( 'Import/Export Forms & Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
7 | 7 | |
8 | 8 | <div class="inside"> |
9 | 9 | |
10 | 10 | <!-- Export Form --> |
11 | - <form action="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-export-forms' , 'nonce' => wp_create_nonce( 'export-forms' ) ) ) ); ?>" method="post"> |
|
12 | - <p><strong><?php _e( "Export Forms" , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
11 | + <form action="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-export-forms', 'nonce' => wp_create_nonce( 'export-forms' ) ) ) ); ?>" method="post"> |
|
12 | + <p><strong><?php _e( "Export Forms", 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
13 | 13 | <p class="description"> |
14 | - <?php _e( "Select the forms you would like to export. When you click the download button below, Easy Forms for MailChimp will create a CSV file for you to save to your computer. Once you've saved the download file, you can use the Import tool to import the forms to this or any other site." , "yikes-inc-easy-mailchimp-extender" ); ?> |
|
14 | + <?php _e( "Select the forms you would like to export. When you click the download button below, Easy Forms for MailChimp will create a CSV file for you to save to your computer. Once you've saved the download file, you can use the Import tool to import the forms to this or any other site.", "yikes-inc-easy-mailchimp-extender" ); ?> |
|
15 | 15 | </p> |
16 | 16 | |
17 | 17 | <?php if ( empty( $all_forms ) ) { ?> |
@@ -20,44 +20,44 @@ discard block |
||
20 | 20 | </p> |
21 | 21 | <?php } else { ?> |
22 | 22 | <!-- custom list so users can export specific forms --> |
23 | - <a class="toggle-custom-lists button-secondary" onclick="jQuery(this).next().slideToggle();return false;"><?php _e( 'Select Forms' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
23 | + <a class="toggle-custom-lists button-secondary" onclick="jQuery(this).next().slideToggle();return false;"><?php _e( 'Select Forms', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
24 | 24 | <ul class="export-custom-forms-list"> |
25 | - <p class="description"><?php _e( 'Select which forms to export. Leave all checkboxes unchecked to export all of your forms.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
26 | - <?php foreach( $all_forms as $id => $form ) { ?> |
|
27 | - <li><label><input type="checkbox" name="export_forms[]" value="<?php echo (int) $id; ?>"><?php echo esc_html( $form['form_name'] ); ?></label></li> |
|
25 | + <p class="description"><?php _e( 'Select which forms to export. Leave all checkboxes unchecked to export all of your forms.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
26 | + <?php foreach ( $all_forms as $id => $form ) { ?> |
|
27 | + <li><label><input type="checkbox" name="export_forms[]" value="<?php echo (int) $id; ?>"><?php echo esc_html( $form[ 'form_name' ] ); ?></label></li> |
|
28 | 28 | <?php } ?> |
29 | 29 | </ul> |
30 | 30 | <?php } ?> |
31 | 31 | <!-- check if any of our transients contain data --> |
32 | - <p><input type="submit" class="button-primary" value="<?php _e( 'Export Opt-in Forms' , 'yikes-inc-easy-mailchimp-extender' ); ?>" /></p> |
|
32 | + <p><input type="submit" class="button-primary" value="<?php _e( 'Export Opt-in Forms', 'yikes-inc-easy-mailchimp-extender' ); ?>" /></p> |
|
33 | 33 | </form> |
34 | 34 | |
35 | 35 | <hr /> |
36 | 36 | |
37 | 37 | <!-- Export Form --> |
38 | - <form action="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-export-settings' , 'nonce' => wp_create_nonce( 'export-settings' ) ) ) ); ?>" method="post"> |
|
39 | - <p><strong><?php _e( "Export Settings" , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
38 | + <form action="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-export-settings', 'nonce' => wp_create_nonce( 'export-settings' ) ) ) ); ?>" method="post"> |
|
39 | + <p><strong><?php _e( "Export Settings", 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
40 | 40 | <p class="description"> |
41 | - <?php _e( "Export YIKES Easy Forms for MailChimp plugin settings." , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
41 | + <?php _e( "Export YIKES Easy Forms for MailChimp plugin settings.", 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
42 | 42 | </p> |
43 | 43 | |
44 | 44 | <!-- check if any of our transients contain data --> |
45 | - <p><input type="submit" class="button-primary" value="<?php _e( 'Export Plugin Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?>" /></p> |
|
45 | + <p><input type="submit" class="button-primary" value="<?php _e( 'Export Plugin Settings', 'yikes-inc-easy-mailchimp-extender' ); ?>" /></p> |
|
46 | 46 | </form> |
47 | 47 | |
48 | 48 | <hr /> |
49 | 49 | |
50 | 50 | <!-- Import Form --> |
51 | - <form action="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-import-forms' , 'nonce' => wp_create_nonce( 'import-forms' ) ) ) ); ?>" method="post" enctype="multipart/form-data"> |
|
52 | - <p><strong><?php _e( "Import" , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
51 | + <form action="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-import-forms', 'nonce' => wp_create_nonce( 'import-forms' ) ) ) ); ?>" method="post" enctype="multipart/form-data"> |
|
52 | + <p><strong><?php _e( "Import", 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
53 | 53 | <p class="description"> |
54 | - <?php _e( "Select the Easy Forms for MailChimp export file you would like to import. You can use this field to import your opt-in forms or settings. " , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
54 | + <?php _e( "Select the Easy Forms for MailChimp export file you would like to import. You can use this field to import your opt-in forms or settings. ", 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
55 | 55 | </p> |
56 | 56 | <label> |
57 | 57 | <input type="file" name="csv" id="forms_to_import"> |
58 | 58 | </label> |
59 | 59 | <!-- check if any of our transients contain data --> |
60 | - <p><input type="submit" class="button-primary" value="<?php _e( 'Import' , 'yikes-inc-easy-mailchimp-extender' ); ?>" /></p> |
|
60 | + <p><input type="submit" class="button-primary" value="<?php _e( 'Import', 'yikes-inc-easy-mailchimp-extender' ); ?>" /></p> |
|
61 | 61 | </form> |
62 | 62 | |
63 | 63 | </div> <!-- .inside --> |
@@ -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' ); |
@@ -12,23 +12,23 @@ 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; |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | $form_data = $interface->get_form( $form ); |
41 | 41 | |
42 | 42 | // confirm we have some results, or return an error |
43 | - if( ! $form_data ) { |
|
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_data ) { |
|
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 | 49 | |
50 | - $list_id = sanitize_key( $form_data['list_id'] ); // associated list id (users who fill out the form will be subscribed to this list) |
|
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(); |
@@ -11,16 +11,16 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public function __construct() { |
13 | 13 | // ajax process form submission |
14 | - add_action( 'wp_ajax_nopriv_process_form_submission', array( $this , 'process_form_submission' ), 10 ); |
|
15 | - add_action( 'wp_ajax_process_form_submission', array( $this , 'process_form_submission' ), 10 ); |
|
14 | + add_action( 'wp_ajax_nopriv_process_form_submission', array( $this, 'process_form_submission' ), 10 ); |
|
15 | + add_action( 'wp_ajax_process_form_submission', array( $this, 'process_form_submission' ), 10 ); |
|
16 | 16 | |
17 | 17 | // ajax send update emails |
18 | - add_action( 'wp_ajax_nopriv_easy_forms_send_email', array( $this , 'sendUpdateProfileEmail' ), 10 ); |
|
19 | - add_action( 'wp_ajax_easy_forms_send_email', array( $this , 'sendUpdateProfileEmail' ), 10 ); |
|
18 | + add_action( 'wp_ajax_nopriv_easy_forms_send_email', array( $this, 'sendUpdateProfileEmail' ), 10 ); |
|
19 | + add_action( 'wp_ajax_easy_forms_send_email', array( $this, 'sendUpdateProfileEmail' ), 10 ); |
|
20 | 20 | |
21 | 21 | // increase submission count for a given form on successful submit |
22 | - add_action( 'wp_ajax_nopriv_increase_submission_count' , array( $this , 'increase_submission_count' ), 10 ); |
|
23 | - add_action( 'wp_ajax_increase_submission_count' , array( $this , 'increase_submission_count' ), 10 ); |
|
22 | + add_action( 'wp_ajax_nopriv_increase_submission_count', array( $this, 'increase_submission_count' ), 10 ); |
|
23 | + add_action( 'wp_ajax_increase_submission_count', array( $this, 'increase_submission_count' ), 10 ); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /* |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * Increase the submission count for a given form. |
38 | 38 | */ |
39 | 39 | public function increase_submission_count() { |
40 | - $form_id = intval( $_POST['form_id'] ); |
|
40 | + $form_id = intval( $_POST[ 'form_id' ] ); |
|
41 | 41 | $interface = yikes_easy_mailchimp_extender_get_form_interface(); |
42 | 42 | $form = $interface->get_form( $form_id ); |
43 | 43 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | // Update the form. |
50 | - $submission_count = isset( $form['submissions'] ) ? $form['submissions'] + 1 : 1; |
|
50 | + $submission_count = isset( $form[ 'submissions' ] ) ? $form[ 'submissions' ] + 1 : 1; |
|
51 | 51 | $interface->update_form_field( $form_id, 'submissions', $submission_count ); |
52 | 52 | |
53 | 53 | exit(); |
@@ -58,17 +58,17 @@ discard block |
||
58 | 58 | @since v6.0.4.1 |
59 | 59 | */ |
60 | 60 | public function sendUpdateProfileEmail() { |
61 | - $user_email = $_POST['user_email']; |
|
62 | - $list_id = $_POST['list_id']; |
|
61 | + $user_email = $_POST[ 'user_email' ]; |
|
62 | + $list_id = $_POST[ 'list_id' ]; |
|
63 | 63 | |
64 | 64 | $api_key = yikes_get_mc_api_key(); |
65 | 65 | $dash_position = strpos( $api_key, '-' ); |
66 | - $explode_key = explode( '-' , $api_key ); |
|
67 | - $data_center = $explode_key[1]; |
|
68 | - $full_site_url = get_bloginfo('url'); |
|
66 | + $explode_key = explode( '-', $api_key ); |
|
67 | + $data_center = $explode_key[ 1 ]; |
|
68 | + $full_site_url = get_bloginfo( 'url' ); |
|
69 | 69 | |
70 | 70 | // list details api call |
71 | - if( $dash_position !== false ) { |
|
71 | + if ( $dash_position !== false ) { |
|
72 | 72 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/list.json'; |
73 | 73 | } |
74 | 74 | $list_details = wp_remote_post( $api_endpoint, array( |
@@ -82,16 +82,16 @@ discard block |
||
82 | 82 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) |
83 | 83 | ) ); |
84 | 84 | $list_details = json_decode( wp_remote_retrieve_body( $list_details ), true ); |
85 | - if( isset( $list_details['error'] ) ) { |
|
86 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
85 | + if ( isset( $list_details[ 'error' ] ) ) { |
|
86 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
87 | 87 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
88 | 88 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
89 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $list_details['error'], __( "Send Update Profile Email - Get Account Lists" , 'yikes-inc-easy-mailchimp-extender' ), "class.public_ajax.php" ); |
|
89 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $list_details[ 'error' ], __( "Send Update Profile Email - Get Account Lists", 'yikes-inc-easy-mailchimp-extender' ), "class.public_ajax.php" ); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
93 | 93 | // account details api call |
94 | - if( $dash_position !== false ) { |
|
94 | + if ( $dash_position !== false ) { |
|
95 | 95 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/helper/account-details.json'; |
96 | 96 | } |
97 | 97 | $account_details = wp_remote_post( $api_endpoint, array( |
@@ -102,16 +102,16 @@ discard block |
||
102 | 102 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) |
103 | 103 | ) ); |
104 | 104 | $account_details = json_decode( wp_remote_retrieve_body( $account_details ), true ); |
105 | - if( isset( $account_details['error'] ) ) { |
|
106 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
105 | + if ( isset( $account_details[ 'error' ] ) ) { |
|
106 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
107 | 107 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
108 | 108 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
109 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $account_details['error'], __( "Send Update Profile Email - Get Account Details" , 'yikes-inc-easy-mailchimp-extender' ), "class.public_ajax.php" ); |
|
109 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $account_details[ 'error' ], __( "Send Update Profile Email - Get Account Details", 'yikes-inc-easy-mailchimp-extender' ), "class.public_ajax.php" ); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
113 | 113 | // subscriber details api call |
114 | - if( $dash_position !== false ) { |
|
114 | + if ( $dash_position !== false ) { |
|
115 | 115 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/member-info.json'; |
116 | 116 | } |
117 | 117 | $subscriber_account_details = wp_remote_post( $api_endpoint, array( |
@@ -126,27 +126,27 @@ discard block |
||
126 | 126 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) |
127 | 127 | ) ); |
128 | 128 | $subscriber_account_details = json_decode( wp_remote_retrieve_body( $subscriber_account_details ), true ); |
129 | - if( isset( $subscriber_account_details['error'] ) ) { |
|
130 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
129 | + if ( isset( $subscriber_account_details[ 'error' ] ) ) { |
|
130 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
131 | 131 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
132 | 132 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
133 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $subscriber_account_details['error'], __( "Send Update Profile Email - Get Member Info." , 'yikes-inc-easy-mailchimp-extender' ), "class.public_ajax.php" ); |
|
133 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $subscriber_account_details[ 'error' ], __( "Send Update Profile Email - Get Member Info.", 'yikes-inc-easy-mailchimp-extender' ), "class.public_ajax.php" ); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | 137 | // check for errors in any of the calls |
138 | - if( isset( $list_details['error'] ) || isset( $account_details['error'] ) || isset( $subscriber_account_details['error'] ) ) { |
|
139 | - $error_message = ( isset( $list_details['error'] ) ) ? $list_details['error'] : false; |
|
140 | - if( ! $error_message ) { |
|
141 | - $error_message = ( isset( $account_details['error'] ) ) ? $account_details['error'] : false; |
|
142 | - if( ! $error_message ) { |
|
143 | - $error_message = ( isset( $subscriber_account_details['error'] ) ) ? $subscriber_account_details['error'] : false; |
|
144 | - if( ! $error_message ) { |
|
138 | + if ( isset( $list_details[ 'error' ] ) || isset( $account_details[ 'error' ] ) || isset( $subscriber_account_details[ 'error' ] ) ) { |
|
139 | + $error_message = ( isset( $list_details[ 'error' ] ) ) ? $list_details[ 'error' ] : false; |
|
140 | + if ( ! $error_message ) { |
|
141 | + $error_message = ( isset( $account_details[ 'error' ] ) ) ? $account_details[ 'error' ] : false; |
|
142 | + if ( ! $error_message ) { |
|
143 | + $error_message = ( isset( $subscriber_account_details[ 'error' ] ) ) ? $subscriber_account_details[ 'error' ] : false; |
|
144 | + if ( ! $error_message ) { |
|
145 | 145 | $error_message = ''; |
146 | 146 | } |
147 | 147 | } |
148 | 148 | } |
149 | - $errorMessage = sprintf( __( 'Error sending update profile email. <strong>Error: %s</strong>. Please contact the site administrator.' , 'yikes-inc-easy-mailchimp-extender' ), $error_message ); |
|
149 | + $errorMessage = sprintf( __( 'Error sending update profile email. <strong>Error: %s</strong>. Please contact the site administrator.', 'yikes-inc-easy-mailchimp-extender' ), $error_message ); |
|
150 | 150 | wp_send_json_error( |
151 | 151 | array( |
152 | 152 | 'response_text' => '<div class="yikes-easy-mc-error-message">✕ ' . $errorMessage . '</div>', |
@@ -156,11 +156,11 @@ discard block |
||
156 | 156 | } |
157 | 157 | |
158 | 158 | // send the email! |
159 | - $subscriber_id = $subscriber_account_details['data'][0]['id']; |
|
160 | - $explode_url = explode( '.' , $account_details['contact']['url'] ); |
|
161 | - $update_link_href = 'http://' . $explode_url[1] . '.' . $data_center . '.list-manage1.com/profile?u=' . $account_details['user_id'] . '&id=' . $list_id .'&e=' . $subscriber_id; |
|
159 | + $subscriber_id = $subscriber_account_details[ 'data' ][ 0 ][ 'id' ]; |
|
160 | + $explode_url = explode( '.', $account_details[ 'contact' ][ 'url' ] ); |
|
161 | + $update_link_href = 'http://' . $explode_url[ 1 ] . '.' . $data_center . '.list-manage1.com/profile?u=' . $account_details[ 'user_id' ] . '&id=' . $list_id . '&e=' . $subscriber_id; |
|
162 | 162 | $subject = 'MailChimp Profile Update'; |
163 | - $headers = 'From: ' . $list_details['data'][0]['default_from_name'] . ' <' . $list_details['data'][0]['default_from_email'] . '>' . "\r\n"; |
|
163 | + $headers = 'From: ' . $list_details[ 'data' ][ 0 ][ 'default_from_name' ] . ' <' . $list_details[ 'data' ][ 0 ][ 'default_from_email' ] . '>' . "\r\n"; |
|
164 | 164 | $headers .= 'Content-type: text/html'; |
165 | 165 | $email_content = '<p>Greetings,</p> <p>A request has been made to update your MailChimp account profile information. To do so please use the following link: <a href="' . $update_link_href . '" title="Update MailChimp Profile">Update MailChimp Profile Info.</a>'; |
166 | 166 | $email_content .= "<p>If you did not request this update, please disregard this email.</p>"; |
@@ -173,14 +173,14 @@ discard block |
||
173 | 173 | if ( wp_mail( $user_email, apply_filters( 'yikes-mailchimp-update-email-subject', $subject ), apply_filters( 'yikes-mailchimp-update-email-content', $email_content, $update_link_href ), $headers ) ) { |
174 | 174 | wp_send_json_success( |
175 | 175 | array( |
176 | - 'response_text' => '<div class="yikes-easy-mc-success-message">' . sprintf( __( '%s Update email successfully sent. Please check your inbox for the message.' , 'yikes-inc-easy-mailchimp-extender' ), '✔' ) . '</div>', |
|
176 | + 'response_text' => '<div class="yikes-easy-mc-success-message">' . sprintf( __( '%s Update email successfully sent. Please check your inbox for the message.', 'yikes-inc-easy-mailchimp-extender' ), '✔' ) . '</div>', |
|
177 | 177 | ) |
178 | 178 | ); |
179 | 179 | exit; |
180 | 180 | } else { |
181 | 181 | wp_send_json_error( |
182 | 182 | array( |
183 | - 'response_text' => '<div class="yikes-easy-mc-error-message">' . sprintf( __( '%s Email failed to send. Please contact the site administrator.' , 'yikes-inc-easy-mailchimp-extender' ), '✕' ) . '</div>', |
|
183 | + 'response_text' => '<div class="yikes-easy-mc-error-message">' . sprintf( __( '%s Email failed to send. Please contact the site administrator.', 'yikes-inc-easy-mailchimp-extender' ), '✕' ) . '</div>', |
|
184 | 184 | ) |
185 | 185 | ); |
186 | 186 | exit; |
@@ -99,7 +99,7 @@ |
||
99 | 99 | if ( ! empty( $all_forms ) ) { |
100 | 100 | // build an array to pass to our javascript |
101 | 101 | foreach ( $all_forms as $id => $form ) { |
102 | - $lists[ $form['form_name'] ] = $id; |
|
102 | + $lists[ $form[ 'form_name' ] ] = $id; |
|
103 | 103 | } |
104 | 104 | } else { |
105 | 105 | $lists[ __( 'Please Import Some MailChimp Lists', 'yikes-inc-easy-mailchimp-extender' ) ] = '-'; |
@@ -9,14 +9,14 @@ discard block |
||
9 | 9 | * @table_name - table name to impot data to |
10 | 10 | */ |
11 | 11 | public static function yikes_mailchimp_import_forms( $csv_file ) { |
12 | - if ( ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] !== 'yikes-easy-mc-import-forms' ) { |
|
12 | + if ( ! isset( $_REQUEST[ 'action' ] ) || $_REQUEST[ 'action' ] !== 'yikes-easy-mc-import-forms' ) { |
|
13 | 13 | wp_die( __( 'There was an error during import. If you continue to run into issues, please reach out to the Yikes Inc. support team.', 'yikes-inc-easy-mailchimp-extender' ) ); |
14 | 14 | } |
15 | 15 | |
16 | - $name = $csv_file['csv']['name']; |
|
16 | + $name = $csv_file[ 'csv' ][ 'name' ]; |
|
17 | 17 | $ext_array = explode( '.', $name ); |
18 | 18 | $ext = end( $ext_array ); |
19 | - $tmp_name = $csv_file['csv']['tmp_name']; |
|
19 | + $tmp_name = $csv_file[ 'csv' ][ 'tmp_name' ]; |
|
20 | 20 | |
21 | 21 | // Ensure we have a valid file extension. |
22 | 22 | if ( 'csv' !== $ext ) { |
@@ -41,17 +41,17 @@ discard block |
||
41 | 41 | |
42 | 42 | // Check if this is a settings import by confirming the first option is 'yikes-mc-api-key' |
43 | 43 | // @todo: this should be a separate method. |
44 | - if( $line[0] == 'yikes-mc-api-key' ) { |
|
45 | - $options = fgetcsv($file, 10000, ','); |
|
44 | + if ( $line[ 0 ] == 'yikes-mc-api-key' ) { |
|
45 | + $options = fgetcsv( $file, 10000, ',' ); |
|
46 | 46 | $new_settings = array(); |
47 | 47 | $x = 0; |
48 | 48 | // build our new array $key => $value pair |
49 | - foreach( $line as $option_name ) { |
|
50 | - $new_settings[$option_name] = $options[$x]; |
|
49 | + foreach ( $line as $option_name ) { |
|
50 | + $new_settings[ $option_name ] = $options[ $x ]; |
|
51 | 51 | $x++; |
52 | 52 | } |
53 | 53 | // update the options in the databse |
54 | - foreach( $new_settings as $option_name => $option_value ) { |
|
54 | + foreach ( $new_settings as $option_name => $option_value ) { |
|
55 | 55 | update_option( $option_name, $option_value ); |
56 | 56 | } |
57 | 57 | } else { // if it's not, then it's an opt-in forms import |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $row++; |
81 | 81 | } |
82 | 82 | |
83 | - fclose($file); |
|
83 | + fclose( $file ); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /* |
@@ -91,20 +91,20 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public static function yikes_mailchimp_import_type( $csv_file ) { |
93 | 93 | // confirm |
94 | - if( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-import-forms' ) { |
|
95 | - $name = $csv_file['csv']['name']; |
|
96 | - $ext_array = explode('.', $name); |
|
94 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-import-forms' ) { |
|
95 | + $name = $csv_file[ 'csv' ][ 'name' ]; |
|
96 | + $ext_array = explode( '.', $name ); |
|
97 | 97 | $ext = end( $ext_array ); |
98 | - $tmpName = $csv_file['csv']['tmp_name']; |
|
99 | - if($ext === 'csv') { |
|
100 | - if(($handle = fopen($tmpName, 'r')) !== FALSE) { |
|
101 | - $num = count($handle); |
|
102 | - $file = fopen( $tmpName, 'r'); |
|
98 | + $tmpName = $csv_file[ 'csv' ][ 'tmp_name' ]; |
|
99 | + if ( $ext === 'csv' ) { |
|
100 | + if ( ( $handle = fopen( $tmpName, 'r' ) ) !== FALSE ) { |
|
101 | + $num = count( $handle ); |
|
102 | + $file = fopen( $tmpName, 'r' ); |
|
103 | 103 | $row = 1; |
104 | - $first_line_data = fgetcsv($file, 10000, ','); |
|
105 | - if( count( $first_line_data ) > 1 ) { |
|
104 | + $first_line_data = fgetcsv( $file, 10000, ',' ); |
|
105 | + if ( count( $first_line_data ) > 1 ) { |
|
106 | 106 | // Check if this is a settings import by confirming the first option is 'yikes-mc-api-key' |
107 | - if( $first_line_data[0] == 'yikes-mc-api-key' ) { |
|
107 | + if ( $first_line_data[ 0 ] == 'yikes-mc-api-key' ) { |
|
108 | 108 | $import_type = 'import-settings'; |
109 | 109 | } else { |
110 | 110 | $import_type = 'import-forms'; |
@@ -54,7 +54,8 @@ |
||
54 | 54 | foreach( $new_settings as $option_name => $option_value ) { |
55 | 55 | update_option( $option_name, $option_value ); |
56 | 56 | } |
57 | - } else { // if it's not, then it's an opt-in forms import |
|
57 | + } else { |
|
58 | +// if it's not, then it's an opt-in forms import |
|
58 | 59 | // If this is the first row, then it should be title data. |
59 | 60 | if ( 1 === $row ) { |
60 | 61 | $titles = $line; |