@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | - if( isset( $_REQUEST['list-id'] ) ) { |
|
3 | - $list_id = sanitize_key( $_REQUEST['list-id'] ); |
|
2 | + if ( isset( $_REQUEST[ 'list-id' ] ) ) { |
|
3 | + $list_id = sanitize_key( $_REQUEST[ 'list-id' ] ); |
|
4 | 4 | $api_key = yikes_get_mc_api_key(); |
5 | 5 | $dash_position = strpos( $api_key, '-' ); |
6 | - if( $dash_position !== false ) { |
|
6 | + if ( $dash_position !== false ) { |
|
7 | 7 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/list.json'; |
8 | 8 | } |
9 | 9 | $list_data = wp_remote_post( $api_endpoint, array( |
@@ -15,40 +15,40 @@ discard block |
||
15 | 15 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ), |
16 | 16 | ) ); |
17 | 17 | $list_data = json_decode( wp_remote_retrieve_body( $list_data ), true ); |
18 | - if( isset( $list_data['error'] ) ) { |
|
19 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
18 | + if ( isset( $list_data[ 'error' ] ) ) { |
|
19 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
20 | 20 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
21 | 21 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
22 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data['error'], __( "Get Account Lists" , 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" ); |
|
22 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data[ 'error' ], __( "Get Account Lists", 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" ); |
|
23 | 23 | } |
24 | 24 | } |
25 | 25 | // reset our data so we can easily use it |
26 | - $list_data = $list_data['data'][0]; |
|
26 | + $list_data = $list_data[ 'data' ][ 0 ]; |
|
27 | 27 | |
28 | - if( $dash_position !== false ) { |
|
28 | + if ( $dash_position !== false ) { |
|
29 | 29 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/merge-vars.json'; |
30 | 30 | } |
31 | 31 | $merge_variables = wp_remote_post( $api_endpoint, array( |
32 | 32 | 'body' => array( |
33 | 33 | 'apikey' => $api_key, |
34 | - 'id' => array( $list_id ) , |
|
34 | + 'id' => array( $list_id ), |
|
35 | 35 | ), |
36 | 36 | 'timeout' => 10, |
37 | 37 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ), |
38 | 38 | ) ); |
39 | 39 | $merge_variables = json_decode( wp_remote_retrieve_body( $merge_variables ), true ); |
40 | - if( isset( $merge_variables['error'] ) ) { |
|
41 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
40 | + if ( isset( $merge_variables[ 'error' ] ) ) { |
|
41 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
42 | 42 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
43 | 43 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
44 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $merge_variables['error'], __( "Get Merge Variables" , 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" ); |
|
44 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $merge_variables[ 'error' ], __( "Get Merge Variables", 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" ); |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | // re-store our data |
48 | - $merge_variables = $merge_variables['data'][0]['merge_vars']; |
|
48 | + $merge_variables = $merge_variables[ 'data' ][ 0 ][ 'merge_vars' ]; |
|
49 | 49 | |
50 | 50 | // get the interest group data |
51 | - if( $dash_position !== false ) { |
|
51 | + if ( $dash_position !== false ) { |
|
52 | 52 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/interest-groupings.json'; |
53 | 53 | } |
54 | 54 | $interest_groupings = wp_remote_post( $api_endpoint, array( |
@@ -62,20 +62,20 @@ discard block |
||
62 | 62 | ) ); |
63 | 63 | $interest_groupings = json_decode( wp_remote_retrieve_body( $interest_groupings ), true ); |
64 | 64 | |
65 | - if( isset( $interest_groupings['error'] ) ) { |
|
66 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
65 | + if ( isset( $interest_groupings[ 'error' ] ) ) { |
|
66 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
67 | 67 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
68 | 68 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
69 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $interest_groupings['error'], __( "Get Interest Groups" , 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" ); |
|
69 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $interest_groupings[ 'error' ], __( "Get Interest Groups", 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" ); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
73 | 73 | $no_interest_groupings = '<p class="description">' . __( 'Interest groups are not enabled for this list.', 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
74 | 74 | |
75 | 75 | |
76 | - $no_segments = __( 'No segments set up for this list.' , 'yikes-inc-easy-mailchimp-extender' ); |
|
76 | + $no_segments = __( 'No segments set up for this list.', 'yikes-inc-easy-mailchimp-extender' ); |
|
77 | 77 | // get the segment data |
78 | - if( $dash_position !== false ) { |
|
78 | + if ( $dash_position !== false ) { |
|
79 | 79 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/segments.json'; |
80 | 80 | } |
81 | 81 | $segments = wp_remote_post( $api_endpoint, array( |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | |
91 | 91 | |
92 | 92 | // setup pagination variables |
93 | - $paged = isset( $_REQUEST['paged'] ) ? $_REQUEST['paged'] : '0'; |
|
93 | + $paged = isset( $_REQUEST[ 'paged' ] ) ? $_REQUEST[ 'paged' ] : '0'; |
|
94 | 94 | |
95 | - $limit = apply_filters( 'yikes_admin_list_subscriber_limit' , '20' ); |
|
95 | + $limit = apply_filters( 'yikes_admin_list_subscriber_limit', '20' ); |
|
96 | 96 | |
97 | - $sort_dir = isset( $_REQUEST['sort'] ) ? $_REQUEST['sort'] : 'DESC'; |
|
98 | - $column = isset( $_REQUEST['column'] ) ? $_REQUEST['column'] : 'optin_time'; |
|
97 | + $sort_dir = isset( $_REQUEST[ 'sort' ] ) ? $_REQUEST[ 'sort' ] : 'DESC'; |
|
98 | + $column = isset( $_REQUEST[ 'column' ] ) ? $_REQUEST[ 'column' ] : 'optin_time'; |
|
99 | 99 | |
100 | - if( $sort_dir == 'DESC' ) { |
|
100 | + if ( $sort_dir == 'DESC' ) { |
|
101 | 101 | $opposite_sort_dir = 'ASC'; |
102 | 102 | $icon = '<span class="dashicons dashicons-arrow-down"></span>'; |
103 | 103 | } else { |
@@ -105,12 +105,12 @@ discard block |
||
105 | 105 | $icon = '<span class="dashicons dashicons-arrow-up"></span>'; |
106 | 106 | } |
107 | 107 | |
108 | - if( !isset( $_REQUEST['sort'] ) ) { |
|
108 | + if ( ! isset( $_REQUEST[ 'sort' ] ) ) { |
|
109 | 109 | $icon = ''; |
110 | 110 | } |
111 | 111 | |
112 | 112 | // get all subscribed members |
113 | - if( $dash_position !== false ) { |
|
113 | + if ( $dash_position !== false ) { |
|
114 | 114 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/members.json'; |
115 | 115 | } |
116 | 116 | $subscribers_list = wp_remote_post( $api_endpoint, array( |
@@ -128,16 +128,16 @@ discard block |
||
128 | 128 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ), |
129 | 129 | ) ); |
130 | 130 | $subscribers_list = json_decode( wp_remote_retrieve_body( $subscribers_list ), true ); |
131 | - if( isset( $subscribers_list['error'] ) ) { |
|
132 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
131 | + if ( isset( $subscribers_list[ 'error' ] ) ) { |
|
132 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
133 | 133 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
134 | 134 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
135 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $subscribers_list['error'], __( "Get Subscriber Count" , 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" ); |
|
135 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $subscribers_list[ 'error' ], __( "Get Subscriber Count", 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" ); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
139 | - $total_pages = ceil( $subscribers_list['total'] / $limit ); |
|
140 | - if( $total_pages == 0 ) { |
|
139 | + $total_pages = ceil( $subscribers_list[ 'total' ] / $limit ); |
|
140 | + if ( $total_pages == 0 ) { |
|
141 | 141 | $total_pages = '1'; |
142 | 142 | } |
143 | 143 | |
@@ -146,25 +146,25 @@ discard block |
||
146 | 146 | ?> |
147 | 147 | <div class="wrap"> |
148 | 148 | <!-- Freddie Logo --> |
149 | - <img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php __( 'Freddie - MailChimp Mascot' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
149 | + <img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php __( 'Freddie - MailChimp Mascot', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
150 | 150 | |
151 | - <h1>YIKES Easy Forms for MailChimp | <?php echo $list_data['name']; ?></h1> |
|
151 | + <h1>YIKES Easy Forms for MailChimp | <?php echo $list_data[ 'name' ]; ?></h1> |
|
152 | 152 | |
153 | 153 | <!-- Settings Page Description --> |
154 | - <p class="yikes-easy-mc-about-text about-text"><?php _e( 'View all subscribers below. View additional subscriber info, or add additional fields to this list.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
155 | - <!-- <p class="add-new-subscriber-button"><a href="#" onclick="jQuery(this).parent().next().slideToggle();" class="add-new-h2"><?php _e( 'New Subscriber' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></p> --> |
|
154 | + <p class="yikes-easy-mc-about-text about-text"><?php _e( 'View all subscribers below. View additional subscriber info, or add additional fields to this list.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
155 | + <!-- <p class="add-new-subscriber-button"><a href="#" onclick="jQuery(this).parent().next().slideToggle();" class="add-new-h2"><?php _e( 'New Subscriber', 'yikes-inc-easy-mailchimp-extender' ); ?></a></p> --> |
|
156 | 156 | |
157 | 157 | <?php |
158 | 158 | /* Display our admin notices here */ |
159 | 159 | // Unsubscribe user confirmation message |
160 | - if( isset( $_REQUEST['user-unsubscribed'] ) && $_REQUEST['user-unsubscribed'] == 'true' ) { |
|
160 | + if ( isset( $_REQUEST[ 'user-unsubscribed' ] ) && $_REQUEST[ 'user-unsubscribed' ] == 'true' ) { |
|
161 | 161 | ?> |
162 | 162 | <div class="updated manage-form-admin-notice"> |
163 | 163 | <p><?php _e( 'User successfully unsubscribed.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
164 | 164 | </div> |
165 | 165 | <?php |
166 | 166 | } |
167 | - if( isset( $_REQUEST['user-unsubscribed'] ) && $_REQUEST['user-unsubscribed'] == 'false' ) { |
|
167 | + if ( isset( $_REQUEST[ 'user-unsubscribed' ] ) && $_REQUEST[ 'user-unsubscribed' ] == 'false' ) { |
|
168 | 168 | ?> |
169 | 169 | <div class="error manage-form-admin-notice"> |
170 | 170 | <p><?php _e( "We've encountered an error trying to remove the subscriber. Please try again. If the error persists please get in contact with the YIKES Inc. support staff.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | ?> |
175 | 175 | |
176 | 176 | <section class="add-new-subscriber-form-container"> |
177 | - <h4><?php _e( 'Add New Subscriber' , 'yikes-inc-easy-mailchimp-extender' ); ?></h4> |
|
177 | + <h4><?php _e( 'Add New Subscriber', 'yikes-inc-easy-mailchimp-extender' ); ?></h4> |
|
178 | 178 | <form id="add-new-subcscriber"> |
179 | - <input type="text" class="regular-text" placeholder="<?php _e( 'User Email Address' , 'yikes-inc-easy-mailchimp-extender' ); ?>" /></p> |
|
179 | + <input type="text" class="regular-text" placeholder="<?php _e( 'User Email Address', 'yikes-inc-easy-mailchimp-extender' ); ?>" /></p> |
|
180 | 180 | <p><?php echo submit_button( 'Add Subscriber' ); ?></p> |
181 | 181 | </form> |
182 | 182 | </section> |
@@ -198,8 +198,8 @@ discard block |
||
198 | 198 | <!-- TABLE HEAD --> |
199 | 199 | <thead> |
200 | 200 | <tr> |
201 | - <th id="user-email columnname" class="manage-column column-columnname" scope="col"><a id="user-email-sort" href="<?php echo esc_url_raw( add_query_arg( array( 'column' => 'email' , 'sort' => $opposite_sort_dir ) ) ); ?>"><?php _e( 'User Email' , 'yikes-inc-easy-mailchimp-extender' ); echo $icon;?></a></th> |
|
202 | - <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Email Client' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
201 | + <th id="user-email columnname" class="manage-column column-columnname" scope="col"><a id="user-email-sort" href="<?php echo esc_url_raw( add_query_arg( array( 'column' => 'email', 'sort' => $opposite_sort_dir ) ) ); ?>"><?php _e( 'User Email', 'yikes-inc-easy-mailchimp-extender' ); echo $icon; ?></a></th> |
|
202 | + <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Email Client', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
203 | 203 | </tr> |
204 | 204 | </thead> |
205 | 205 | <!-- end header --> |
@@ -207,38 +207,38 @@ discard block |
||
207 | 207 | <!-- FOOTER --> |
208 | 208 | <tfoot> |
209 | 209 | <tr> |
210 | - <th class="manage-column column-columnname" scope="col"><?php _e( 'User Email' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
211 | - <th class="manage-column column-columnname num" scope="col"><?php _e( 'Email Client' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
210 | + <th class="manage-column column-columnname" scope="col"><?php _e( 'User Email', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
211 | + <th class="manage-column column-columnname num" scope="col"><?php _e( 'Email Client', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
212 | 212 | </tr> |
213 | 213 | </tfoot> |
214 | 214 | <!-- end footer --> |
215 | 215 | |
216 | 216 | <!-- TABLE BODY --> |
217 | 217 | <tbody> |
218 | - <?php if( $subscribers_list['total'] > 0 ) { |
|
218 | + <?php if ( $subscribers_list[ 'total' ] > 0 ) { |
|
219 | 219 | $i = 1; |
220 | - foreach( $subscribers_list['data'] as $subscriber ) { |
|
221 | - $user_id = $subscriber['leid']; |
|
220 | + foreach ( $subscribers_list[ 'data' ] as $subscriber ) { |
|
221 | + $user_id = $subscriber[ 'leid' ]; |
|
222 | 222 | // setup the email client name and icon |
223 | - if( !empty( $subscriber['clients'] ) ) { |
|
224 | - $user_email_client_name = $subscriber['clients']['name']; |
|
225 | - $user_email_client_icon = "<img src='" . esc_url_raw( $subscriber['clients']['icon_url'] ) . "' alt=" . $user_email_client_name . " title=" . $user_email_client_name . ">"; |
|
223 | + if ( ! empty( $subscriber[ 'clients' ] ) ) { |
|
224 | + $user_email_client_name = $subscriber[ 'clients' ][ 'name' ]; |
|
225 | + $user_email_client_icon = "<img src='" . esc_url_raw( $subscriber[ 'clients' ][ 'icon_url' ] ) . "' alt=" . $user_email_client_name . " title=" . $user_email_client_name . ">"; |
|
226 | 226 | } else { |
227 | 227 | $path = YIKES_MC_URL . "includes/images/na.png"; |
228 | - $user_email_client_icon = "<img width='35' src='" . $path . "' alt='" . __( 'not set' , 'yikes-inc-easy-mailchimp-extender' ) . "' title='" . __( 'not set' , 'yikes-inc-easy-mailchimp-extender' ) . "'>"; |
|
228 | + $user_email_client_icon = "<img width='35' src='" . $path . "' alt='" . __( 'not set', 'yikes-inc-easy-mailchimp-extender' ) . "' title='" . __( 'not set', 'yikes-inc-easy-mailchimp-extender' ) . "'>"; |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | ?> |
232 | - <tr class="<?php if( $i % 2 == 0 ) { echo 'alternate'; } ?>"> |
|
232 | + <tr class="<?php if ( $i % 2 == 0 ) { echo 'alternate'; } ?>"> |
|
233 | 233 | <td class="column-columnname"> |
234 | - <a class="user-email row-title" href="mailto:<?php echo sanitize_email( $subscriber['email'] ); ?>"> |
|
235 | - <?php echo sanitize_email( $subscriber['email'] ); ?> |
|
234 | + <a class="user-email row-title" href="mailto:<?php echo sanitize_email( $subscriber[ 'email' ] ); ?>"> |
|
235 | + <?php echo sanitize_email( $subscriber[ 'email' ] ); ?> |
|
236 | 236 | </a> |
237 | 237 | <div class="row-actions"> |
238 | - <?php $view_user_info_url = esc_url_raw( add_query_arg( array( 'mailchimp-list' => $list_id , 'email-id' => $user_id ), admin_url() . 'admin.php?page=yikes-mailchimp-view-user' ) ); ?> |
|
239 | - <span><a href="<?php echo $view_user_info_url; ?>"><?php _e( "View Info." , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
240 | - <?php $url = esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-unsubscribe-user', 'mailchimp-list' => $list_id , 'nonce' => wp_create_nonce( 'unsubscribe-user-'.$user_id ), 'email_id' => $user_id ) ) ); ?> |
|
241 | - <span><a href="<?php echo $url; ?>" onclick="return confirm('<?php printf( __( "Are you sure you want to unsubscribe %s from this mailing list?" , 'yikes-inc-easy-mailchimp-extender' ), sanitize_email( $subscriber['email'] ) ); ?>');" class="yikes-delete-subscriber"><?php _e( "Unsubscribe" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
238 | + <?php $view_user_info_url = esc_url_raw( add_query_arg( array( 'mailchimp-list' => $list_id, 'email-id' => $user_id ), admin_url() . 'admin.php?page=yikes-mailchimp-view-user' ) ); ?> |
|
239 | + <span><a href="<?php echo $view_user_info_url; ?>"><?php _e( "View Info.", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
240 | + <?php $url = esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-unsubscribe-user', 'mailchimp-list' => $list_id, 'nonce' => wp_create_nonce( 'unsubscribe-user-' . $user_id ), 'email_id' => $user_id ) ) ); ?> |
|
241 | + <span><a href="<?php echo $url; ?>" onclick="return confirm('<?php printf( __( "Are you sure you want to unsubscribe %s from this mailing list?", 'yikes-inc-easy-mailchimp-extender' ), sanitize_email( $subscriber[ 'email' ] ) ); ?>');" class="yikes-delete-subscriber"><?php _e( "Unsubscribe", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
242 | 242 | </div> |
243 | 243 | </td> |
244 | 244 | <td class="column-columnname num"><?php echo $user_email_client_icon; ?></td> |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | } |
249 | 249 | } else { ?> |
250 | 250 | <tr class="no-items"> |
251 | - <td class="colspanchange no-current-subscriber-notice" colspan="2"><em><?php _e( 'No one is currently subscribed to this list.' , 'yikes-inc-easy-mailchimp-extender' ); ?></em></td> |
|
251 | + <td class="colspanchange no-current-subscriber-notice" colspan="2"><em><?php _e( 'No one is currently subscribed to this list.', 'yikes-inc-easy-mailchimp-extender' ); ?></em></td> |
|
252 | 252 | </tr> |
253 | 253 | <?php } ?> |
254 | 254 | </tbody> |
@@ -260,11 +260,11 @@ discard block |
||
260 | 260 | <!-- pagination --> |
261 | 261 | <div class="tablenav"> |
262 | 262 | <div class="tablenav-pages"> |
263 | - <a class='first-page <?php if( $paged == 0 ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the first page" , 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => 0 ) ) ); ?>'>«</a> |
|
264 | - <a class='prev-page <?php if( $paged == 0 ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the previous page" , 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $paged - 1 ) ) ) ); ?>'>‹</a> |
|
265 | - <span class="paging-input"><input class='current-page' title='<?php _e( "Current page" , 'yikes-inc-easy-mailchimp-extender' ); ?>' type='text' name='paged' value='<?php if( $paged == 0 ) { echo '1'; } else { echo intval( $paged + 1 ); } ?>' size='1' /> <?php _e( 'of', 'yikes-inc-easy-mailchimp-extender' ); ?> <span class='total-pages'><?php echo $total_pages; ?></span></span> |
|
266 | - <a class='next-page <?php if( $paged == intval( $total_pages - 1 ) ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the next page" , 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $paged + 1 ) ) ) ); ?>'>›</a> |
|
267 | - <a class='last-page <?php if( $paged == intval( $total_pages - 1 ) ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the last page" , 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $total_pages - 1 ) ) ) ); ?>'>»</a> |
|
263 | + <a class='first-page <?php if ( $paged == 0 ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the first page", 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => 0 ) ) ); ?>'>«</a> |
|
264 | + <a class='prev-page <?php if ( $paged == 0 ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the previous page", 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $paged - 1 ) ) ) ); ?>'>‹</a> |
|
265 | + <span class="paging-input"><input class='current-page' title='<?php _e( "Current page", 'yikes-inc-easy-mailchimp-extender' ); ?>' type='text' name='paged' value='<?php if ( $paged == 0 ) { echo '1'; } else { echo intval( $paged + 1 ); } ?>' size='1' /> <?php _e( 'of', 'yikes-inc-easy-mailchimp-extender' ); ?> <span class='total-pages'><?php echo $total_pages; ?></span></span> |
|
266 | + <a class='next-page <?php if ( $paged == intval( $total_pages - 1 ) ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the next page", 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $paged + 1 ) ) ) ); ?>'>›</a> |
|
267 | + <a class='last-page <?php if ( $paged == intval( $total_pages - 1 ) ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the last page", 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $total_pages - 1 ) ) ) ); ?>'>»</a> |
|
268 | 268 | </div> |
269 | 269 | </div> |
270 | 270 | |
@@ -279,21 +279,21 @@ discard block |
||
279 | 279 | |
280 | 280 | <div class="postbox yikes-easy-mc-postbox"> |
281 | 281 | |
282 | - <h3><?php _e( 'List Overview' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
282 | + <h3><?php _e( 'List Overview', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
283 | 283 | |
284 | 284 | <?php |
285 | 285 | // store list rating |
286 | - $list_rating = $list_data['list_rating']; |
|
287 | - if( $list_rating > 0 ) { |
|
288 | - $list_rating_explosion = explode( '.' , $list_rating ); |
|
286 | + $list_rating = $list_data[ 'list_rating' ]; |
|
287 | + if ( $list_rating > 0 ) { |
|
288 | + $list_rating_explosion = explode( '.', $list_rating ); |
|
289 | 289 | $star_array = array(); |
290 | 290 | $x = 1; |
291 | - while( $list_rating_explosion[0] >= $x ) { |
|
292 | - $star_array[] = '<span class="dashicons dashicons-star-filled list-rating-star"></span>'; |
|
291 | + while ( $list_rating_explosion[ 0 ] >= $x ) { |
|
292 | + $star_array[ ] = '<span class="dashicons dashicons-star-filled list-rating-star"></span>'; |
|
293 | 293 | $x++; |
294 | 294 | } |
295 | - if( $list_rating_explosion[1] == '5' ) { |
|
296 | - $star_array[] = '<span class="dashicons dashicons-star-half list-rating-star"></span>'; |
|
295 | + if ( $list_rating_explosion[ 1 ] == '5' ) { |
|
296 | + $star_array[ ] = '<span class="dashicons dashicons-star-half list-rating-star"></span>'; |
|
297 | 297 | } |
298 | 298 | } else { |
299 | 299 | $star_array = array( 'n/a' ); |
@@ -301,40 +301,40 @@ discard block |
||
301 | 301 | ?> |
302 | 302 | <table class="form-table"> |
303 | 303 | <tr valign="top"> |
304 | - <td scope="row"><label for="tablecell"><strong><?php _e( 'List Rating' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
305 | - <td><?php echo implode( ' ' , $star_array ); ?></td> |
|
304 | + <td scope="row"><label for="tablecell"><strong><?php _e( 'List Rating', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
305 | + <td><?php echo implode( ' ', $star_array ); ?></td> |
|
306 | 306 | </tr> |
307 | 307 | <tr valign="top"> |
308 | - <td scope="row"><label for="tablecell"><strong><?php _e( 'Average Subscribers' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
309 | - <td><?php echo $list_data['stats']['avg_sub_rate']; ?><small> / <?php _e( 'month' , 'yikes-inc-easy-mailchimp-extender' ); ?></small></td> |
|
308 | + <td scope="row"><label for="tablecell"><strong><?php _e( 'Average Subscribers', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
309 | + <td><?php echo $list_data[ 'stats' ][ 'avg_sub_rate' ]; ?><small> / <?php _e( 'month', 'yikes-inc-easy-mailchimp-extender' ); ?></small></td> |
|
310 | 310 | </tr> |
311 | 311 | <tr valign="top"> |
312 | - <td scope="row"><label for="tablecell"><strong><?php _e( 'Subscriber Count' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
313 | - <td><?php echo intval( $list_data['stats']['member_count'] ); ?></td> |
|
312 | + <td scope="row"><label for="tablecell"><strong><?php _e( 'Subscriber Count', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
313 | + <td><?php echo intval( $list_data[ 'stats' ][ 'member_count' ] ); ?></td> |
|
314 | 314 | </tr> |
315 | 315 | <tr valign="top"> |
316 | - <td scope="row"><label for="tablecell"><strong><?php _e( 'New Since Last Campaign' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
317 | - <td><?php echo intval( $list_data['stats']['member_count_since_send'] ); ?></td> |
|
316 | + <td scope="row"><label for="tablecell"><strong><?php _e( 'New Since Last Campaign', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
317 | + <td><?php echo intval( $list_data[ 'stats' ][ 'member_count_since_send' ] ); ?></td> |
|
318 | 318 | </tr> |
319 | 319 | <tr valign="top"> |
320 | - <td scope="row"><label for="tablecell"><strong><?php _e( 'Created' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
321 | - <td><?php echo date( get_option('date_format') , strtotime( $list_data['date_created'] ) ); ?></td> |
|
320 | + <td scope="row"><label for="tablecell"><strong><?php _e( 'Created', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
321 | + <td><?php echo date( get_option( 'date_format' ), strtotime( $list_data[ 'date_created' ] ) ); ?></td> |
|
322 | 322 | </tr> |
323 | 323 | <tr valign="top"> |
324 | - <td scope="row"><label for="tablecell"><strong><?php _e( 'List Fields' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
325 | - <td><?php echo intval( $list_data['stats']['merge_var_count'] + 1 ); // add 1 for our email field.. ?></td> |
|
324 | + <td scope="row"><label for="tablecell"><strong><?php _e( 'List Fields', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
325 | + <td><?php echo intval( $list_data[ 'stats' ][ 'merge_var_count' ] + 1 ); // add 1 for our email field.. ?></td> |
|
326 | 326 | </tr> |
327 | 327 | <tr valign="top"> |
328 | - <td scope="row"><label for="tablecell"><strong><?php _e( 'Short Signup URL' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
329 | - <td><input type="text" class="widefat view-list-sidebar-input" value="<?php echo esc_url_raw( $list_data['subscribe_url_short'] ); ?>" readonly onclick="jQuery(this).select();"></td> |
|
328 | + <td scope="row"><label for="tablecell"><strong><?php _e( 'Short Signup URL', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
329 | + <td><input type="text" class="widefat view-list-sidebar-input" value="<?php echo esc_url_raw( $list_data[ 'subscribe_url_short' ] ); ?>" readonly onclick="jQuery(this).select();"></td> |
|
330 | 330 | </tr> |
331 | 331 | <tr valign="top"> |
332 | - <td scope="row"><label for="tablecell"><strong><?php _e( 'Default From Email' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
333 | - <td><input type="text" class="widefat view-list-sidebar-input" value="<?php echo sanitize_email( $list_data['default_from_email'] ); ?>" readonly onclick="jQuery(this).select();"></td> |
|
332 | + <td scope="row"><label for="tablecell"><strong><?php _e( 'Default From Email', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
333 | + <td><input type="text" class="widefat view-list-sidebar-input" value="<?php echo sanitize_email( $list_data[ 'default_from_email' ] ); ?>" readonly onclick="jQuery(this).select();"></td> |
|
334 | 334 | </tr> |
335 | 335 | <tr valign="top"> |
336 | - <td scope="row"><label for="tablecell"><strong><?php _e( 'Default From Name' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
337 | - <td><?php echo $list_data['default_from_name']; ?></td> |
|
336 | + <td scope="row"><label for="tablecell"><strong><?php _e( 'Default From Name', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td> |
|
337 | + <td><?php echo $list_data[ 'default_from_name' ]; ?></td> |
|
338 | 338 | </tr> |
339 | 339 | </table> |
340 | 340 | |
@@ -344,14 +344,14 @@ discard block |
||
344 | 344 | <!-- Merge Field Info --> |
345 | 345 | <div class="postbox yikes-easy-mc-postbox"> |
346 | 346 | |
347 | - <h3><?php _e( 'Form Fields' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
347 | + <h3><?php _e( 'Form Fields', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
348 | 348 | <?php |
349 | - if( count( $merge_variables ) >= 1 ) { |
|
349 | + if ( count( $merge_variables ) >= 1 ) { |
|
350 | 350 | ?><ul class="merge-variable-ul"><?php |
351 | 351 | echo '<li class="interest-group-count">' . sprintf( _n( '%d Field', '%d Fields', intval( count( $merge_variables ) ), 'yikes-inc-easy-mailchimp-extender' ), intval( count( $merge_variables ) ) ) . '</li>'; |
352 | - foreach( $merge_variables as $merge_variable ) { |
|
352 | + foreach ( $merge_variables as $merge_variable ) { |
|
353 | 353 | // new action hook @since 6.0.3.8 |
354 | - echo '<li class="' . $merge_variable['tag'] . '"><span class="dashicons dashicons-marker"></span>' . $merge_variable['name'] . ' ' . do_action( 'yikes-mailchimp-list-field', $merge_variable ) . '</li>'; |
|
354 | + echo '<li class="' . $merge_variable[ 'tag' ] . '"><span class="dashicons dashicons-marker"></span>' . $merge_variable[ 'name' ] . ' ' . do_action( 'yikes-mailchimp-list-field', $merge_variable ) . '</li>'; |
|
355 | 355 | } |
356 | 356 | ?></ul><?php |
357 | 357 | } |
@@ -368,13 +368,13 @@ discard block |
||
368 | 368 | <div class="postbox yikes-easy-mc-postbox"> |
369 | 369 | |
370 | 370 | |
371 | - <h3><?php _e( 'Interest Groups Overview' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
371 | + <h3><?php _e( 'Interest Groups Overview', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
372 | 372 | <?php |
373 | - if( isset( $interest_groupings ) && ! isset( $interest_groupings['error'] ) ) { |
|
373 | + if ( isset( $interest_groupings ) && ! isset( $interest_groupings[ 'error' ] ) ) { |
|
374 | 374 | ?><ul class="interest-group-ul"><?php |
375 | 375 | echo '<li class="interest-group-count">' . sprintf( _n( '%d Interest Group', '%d Interest Groups', intval( count( $interest_groupings ) ), 'yikes-inc-easy-mailchimp-extender' ), intval( count( $interest_groupings ) ) ) . '</li>'; |
376 | - foreach( $interest_groupings as $interest_group ) { |
|
377 | - echo '<li><span class="dashicons dashicons-marker"></span>' . $interest_group['name'] . '<span class="interest-group-title"></span><small title="' . $interest_group['groups'][0]['subscribers'] . ' ' . __( "subscribers assigned to this group" , 'yikes-inc-easy-mailchimp-extender' ) . '">(' . $interest_group['groups'][0]['subscribers'] . ')</small></li>'; |
|
376 | + foreach ( $interest_groupings as $interest_group ) { |
|
377 | + echo '<li><span class="dashicons dashicons-marker"></span>' . $interest_group[ 'name' ] . '<span class="interest-group-title"></span><small title="' . $interest_group[ 'groups' ][ 0 ][ 'subscribers' ] . ' ' . __( "subscribers assigned to this group", 'yikes-inc-easy-mailchimp-extender' ) . '">(' . $interest_group[ 'groups' ][ 0 ][ 'subscribers' ] . ')</small></li>'; |
|
378 | 378 | } |
379 | 379 | ?></ul><?php |
380 | 380 | } else { |
@@ -397,17 +397,17 @@ discard block |
||
397 | 397 | <div class="postbox yikes-easy-mc-postbox"> |
398 | 398 | |
399 | 399 | |
400 | - <h3><?php _e( 'Segments Overview' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
400 | + <h3><?php _e( 'Segments Overview', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
401 | 401 | <?php |
402 | - if( isset( $segments['saved'] ) && count( $segments['saved'] ) >= 1 ) { |
|
402 | + if ( isset( $segments[ 'saved' ] ) && count( $segments[ 'saved' ] ) >= 1 ) { |
|
403 | 403 | $i = 1; |
404 | 404 | ?><ul class="segment-ul"><?php |
405 | - echo '<li class="segment-group-count">' . sprintf( _n( '%d Segment', '%d Segments', intval( count( $segments['saved'] ) ), 'yikes-inc-easy-mailchimp-extender' ), intval( count( $segments['saved'] ) ) ) . '</li>'; |
|
406 | - foreach( $segments['saved'] as $segment ) { |
|
407 | - echo '<li><span class="dashicons dashicons-arrow-right"></span>' . $segment['name'] . ' <small><a href="#" onclick="jQuery(this).parent().parent().next().slideToggle();jQuery(this).toggleText();return false;" data-alt-text="' . __( 'hide conditions' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( "view conditions" , 'yikes-inc-easy-mailchimp-extender' ) . '</a></small></li>'; |
|
405 | + echo '<li class="segment-group-count">' . sprintf( _n( '%d Segment', '%d Segments', intval( count( $segments[ 'saved' ] ) ), 'yikes-inc-easy-mailchimp-extender' ), intval( count( $segments[ 'saved' ] ) ) ) . '</li>'; |
|
406 | + foreach ( $segments[ 'saved' ] as $segment ) { |
|
407 | + echo '<li><span class="dashicons dashicons-arrow-right"></span>' . $segment[ 'name' ] . ' <small><a href="#" onclick="jQuery(this).parent().parent().next().slideToggle();jQuery(this).toggleText();return false;" data-alt-text="' . __( 'hide conditions', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( "view conditions", 'yikes-inc-easy-mailchimp-extender' ) . '</a></small></li>'; |
|
408 | 408 | ?><div class="conditionals yikes-easy-mc-hidden"><?php |
409 | - foreach( $segment['segment_opts']['conditions'] as $condition ) { |
|
410 | - echo '<li><small>' . sprintf( __( 'condition #%s : If %s %s %s', 'yikes-inc-easy-mailchimp-extender' ), intval( $i ), $condition['field'], $condition['op'], $condition['value'] ) . '</small></li>'; |
|
409 | + foreach ( $segment[ 'segment_opts' ][ 'conditions' ] as $condition ) { |
|
410 | + echo '<li><small>' . sprintf( __( 'condition #%s : If %s %s %s', 'yikes-inc-easy-mailchimp-extender' ), intval( $i ), $condition[ 'field' ], $condition[ 'op' ], $condition[ 'value' ] ) . '</small></li>'; |
|
411 | 411 | $i++; |
412 | 412 | } |
413 | 413 | ?></div><?php |
@@ -422,9 +422,9 @@ discard block |
||
422 | 422 | } |
423 | 423 | ?> |
424 | 424 | <!-- |
425 | - <a class="edit-segments-button" href="#" onclick="return false;" class="button-primary"><?php _e( 'Edit Segments' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
425 | + <a class="edit-segments-button" href="#" onclick="return false;" class="button-primary"><?php _e( 'Edit Segments', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
426 | 426 | --> |
427 | - <p class="description edit-segment-description"><?php _e( 'To edit this lists segments, head over to' , 'yikes-inc-easy-mailchimp-extender' ); ?> <a href="http://www.MailChimp.com" target="_blank">MailChimp</a></p> |
|
427 | + <p class="description edit-segment-description"><?php _e( 'To edit this lists segments, head over to', 'yikes-inc-easy-mailchimp-extender' ); ?> <a href="http://www.MailChimp.com" target="_blank">MailChimp</a></p> |
|
428 | 428 | |
429 | 429 | </div> |
430 | 430 |
@@ -9,22 +9,22 @@ discard block |
||
9 | 9 | * @form_ids array of form ID's to export ie: array( 1,4,5,6 ) (user can select specific forms) |
10 | 10 | * @file_name the name of the exported file |
11 | 11 | */ |
12 | - public static function yikes_mailchimp_form_export( $table_name, $form_ids , $file_name ) { |
|
12 | + public static function yikes_mailchimp_form_export( $table_name, $form_ids, $file_name ) { |
|
13 | 13 | global $wpdb; |
14 | 14 | $wpdb->show_errors(); |
15 | - if( is_array( $form_ids ) ) { |
|
16 | - $results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . $table_name . ' where ID in (' . implode( ', ' , $form_ids ) . ')' ); |
|
15 | + if ( is_array( $form_ids ) ) { |
|
16 | + $results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . $table_name . ' where ID in (' . implode( ', ', $form_ids ) . ')' ); |
|
17 | 17 | } else { |
18 | 18 | $results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . $table_name ); |
19 | 19 | } |
20 | 20 | |
21 | 21 | // Process report request |
22 | - if (! $results) { |
|
22 | + if ( ! $results ) { |
|
23 | 23 | $Error = $wpdb->print_error(); |
24 | - die("The following error was found: $Error"); |
|
24 | + die( "The following error was found: $Error" ); |
|
25 | 25 | } else { |
26 | 26 | // Set header row values |
27 | - $output_filename = $file_name . '-'. date( 'm-d-Y' ) . '.csv'; |
|
27 | + $output_filename = $file_name . '-' . date( 'm-d-Y' ) . '.csv'; |
|
28 | 28 | $output_handle = @fopen( 'php://output', 'w' ); |
29 | 29 | |
30 | 30 | header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' ); |
@@ -36,15 +36,15 @@ discard block |
||
36 | 36 | |
37 | 37 | $first = true; |
38 | 38 | // Parse results to csv format |
39 | - foreach ($results as $row) { |
|
39 | + foreach ( $results as $row ) { |
|
40 | 40 | |
41 | 41 | // Add table headers |
42 | - if($first){ |
|
42 | + if ( $first ) { |
|
43 | 43 | $titles = array(); |
44 | - foreach($row as $key=>$val){ |
|
45 | - $titles[] = $key; |
|
44 | + foreach ( $row as $key=>$val ) { |
|
45 | + $titles[ ] = $key; |
|
46 | 46 | } |
47 | - fputcsv($output_handle, $titles); |
|
47 | + fputcsv( $output_handle, $titles ); |
|
48 | 48 | $first = false; |
49 | 49 | } |
50 | 50 | |
@@ -68,25 +68,25 @@ discard block |
||
68 | 68 | |
69 | 69 | // get an array of all of our plugin settings (on the settings pages), to loop over |
70 | 70 | $plugin_settings = array(); |
71 | - $plugin_settings['yikes-mc-api-key'] = yikes_get_mc_api_key(); // api key |
|
72 | - $plugin_settings['yikes-mc-api-validation'] = get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ); // api key validation |
|
73 | - $plugin_settings['optin-checkbox-init'] = get_option( 'optin-checkbox-init', '' ); // checkbox settings |
|
74 | - $plugin_settings['yikes-mc-recaptcha-status'] = get_option( 'yikes-mc-recaptcha-status' , '' ); // recaptcha status |
|
75 | - $plugin_settings['yikes-mc-recaptcha-site-key'] = get_option( 'yikes-mc-recaptcha-site-key', '' ); // recaptcha site key |
|
76 | - $plugin_settings['yikes-mc-recaptcha-secret-key'] = get_option( 'yikes-mc-recaptcha-secret-key', '' ); // recaptcha secret key |
|
77 | - $plugin_settings['yikes-mailchimp-debug-status'] = get_option( 'yikes-mailchimp-debug-status' , '' ); // debug settings |
|
71 | + $plugin_settings[ 'yikes-mc-api-key' ] = yikes_get_mc_api_key(); // api key |
|
72 | + $plugin_settings[ 'yikes-mc-api-validation' ] = get_option( 'yikes-mc-api-validation', 'invalid_api_key' ); // api key validation |
|
73 | + $plugin_settings[ 'optin-checkbox-init' ] = get_option( 'optin-checkbox-init', '' ); // checkbox settings |
|
74 | + $plugin_settings[ 'yikes-mc-recaptcha-status' ] = get_option( 'yikes-mc-recaptcha-status', '' ); // recaptcha status |
|
75 | + $plugin_settings[ 'yikes-mc-recaptcha-site-key' ] = get_option( 'yikes-mc-recaptcha-site-key', '' ); // recaptcha site key |
|
76 | + $plugin_settings[ 'yikes-mc-recaptcha-secret-key' ] = get_option( 'yikes-mc-recaptcha-secret-key', '' ); // recaptcha secret key |
|
77 | + $plugin_settings[ 'yikes-mailchimp-debug-status' ] = get_option( 'yikes-mailchimp-debug-status', '' ); // debug settings |
|
78 | 78 | $titles = array(); |
79 | 79 | $content = array(); |
80 | - foreach ($plugin_settings as $option_name => $option_value ) { |
|
81 | - $titles[] = $option_name; |
|
80 | + foreach ( $plugin_settings as $option_name => $option_value ) { |
|
81 | + $titles[ ] = $option_name; |
|
82 | 82 | } |
83 | 83 | // Process report request |
84 | - if (! $plugin_settings) { |
|
84 | + if ( ! $plugin_settings ) { |
|
85 | 85 | $Error = $wpdb->print_error(); |
86 | - die("The following error was found: $Error"); |
|
86 | + die( "The following error was found: $Error" ); |
|
87 | 87 | } else { |
88 | 88 | // Set header row values |
89 | - $output_filename = $file_name . '-'. date( 'm-d-Y' ) . '.csv'; |
|
89 | + $output_filename = $file_name . '-' . date( 'm-d-Y' ) . '.csv'; |
|
90 | 90 | $output_handle = @fopen( 'php://output', 'w' ); |
91 | 91 | |
92 | 92 | header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' ); |
@@ -98,14 +98,14 @@ discard block |
||
98 | 98 | |
99 | 99 | $first = true; |
100 | 100 | // Parse results to csv format |
101 | - foreach ($plugin_settings as $option_name => $option_value ) { |
|
101 | + foreach ( $plugin_settings as $option_name => $option_value ) { |
|
102 | 102 | |
103 | 103 | // Add table headers |
104 | - if( $first ) { |
|
105 | - fputcsv($output_handle, $titles); |
|
104 | + if ( $first ) { |
|
105 | + fputcsv( $output_handle, $titles ); |
|
106 | 106 | $first = false; |
107 | 107 | } |
108 | - $content[] = $option_value; |
|
108 | + $content[ ] = $option_value; |
|
109 | 109 | |
110 | 110 | } |
111 | 111 | fputcsv( $output_handle, $content ); |