@@ -6,13 +6,13 @@ discard block |
||
6 | 6 | $all_forms = $form_interface->get_all_forms(); |
7 | 7 | |
8 | 8 | /* Store Data if User is Authorized */ |
9 | -if( $this->is_user_mc_api_valid_form( false ) == 'valid' ) { |
|
9 | +if ( $this->is_user_mc_api_valid_form( false ) == 'valid' ) { |
|
10 | 10 | $list_data = yikes_get_mc_api_manager()->get_list_handler()->get_lists(); |
11 | 11 | if ( is_wp_error( $list_data ) ) { |
12 | 12 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
13 | 13 | $error_logging->maybe_write_to_log( |
14 | 14 | $list_data->get_error_code(), |
15 | - __( "Get Account Lists" , 'yikes-inc-easy-mailchimp-extender' ), |
|
15 | + __( "Get Account Lists", 'yikes-inc-easy-mailchimp-extender' ), |
|
16 | 16 | "Manage Forms Page" |
17 | 17 | ); |
18 | 18 | $list_data = array(); |
@@ -23,24 +23,24 @@ discard block |
||
23 | 23 | ?> |
24 | 24 | <div class="wrap"> |
25 | 25 | <!-- Freddie Logo --> |
26 | - <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" /> |
|
26 | + <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" /> |
|
27 | 27 | |
28 | - <h1>Easy Forms for Mailchimp | <?php _e( 'Manage Forms' , 'yikes-inc-easy-mailchimp-extender' ) ?></h1> |
|
28 | + <h1>Easy Forms for Mailchimp | <?php _e( 'Manage Forms', 'yikes-inc-easy-mailchimp-extender' ) ?></h1> |
|
29 | 29 | |
30 | 30 | <!-- Settings Page Description --> |
31 | - <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Create and manage your Mailchimp forms.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
31 | + <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Create and manage your Mailchimp forms.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
32 | 32 | |
33 | 33 | <!-- Action Notices --> |
34 | 34 | <?php |
35 | 35 | |
36 | 36 | /* If the user hasn't authenticated yet, lets kill off */ |
37 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) != 'valid_api_key' ) { |
|
38 | - wp_die( '<div class="error"><p>' . sprintf( __( 'You need to connect to Mailchimp before you can start creating forms. Head over to the <a href="%s" title="Settings Page">Settings Page</a> and enter your API key.' , 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings' ) ) ) . '</p></div>' , 500 ); |
|
37 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'valid_api_key' ) { |
|
38 | + wp_die( '<div class="error"><p>' . sprintf( __( 'You need to connect to Mailchimp before you can start creating forms. Head over to the <a href="%s" title="Settings Page">Settings Page</a> and enter your API key.', 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings' ) ) ) . '</p></div>', 500 ); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /* Display our admin notices here */ |
42 | 42 | // delete form success |
43 | - if( isset( $_REQUEST['deleted-form'] ) && $_REQUEST['deleted-form'] == 'true' ) { |
|
43 | + if ( isset( $_REQUEST[ 'deleted-form' ] ) && $_REQUEST[ 'deleted-form' ] == 'true' ) { |
|
44 | 44 | ?> |
45 | 45 | <div class="updated manage-form-admin-notice"> |
46 | 46 | <p><?php _e( 'Opt-in form successfully deleted.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | <?php |
49 | 49 | } |
50 | 50 | // duplicate form success |
51 | - if( isset( $_REQUEST['duplicated-form'] ) && $_REQUEST['duplicated-form'] == 'true' ) { |
|
51 | + if ( isset( $_REQUEST[ 'duplicated-form' ] ) && $_REQUEST[ 'duplicated-form' ] == 'true' ) { |
|
52 | 52 | ?> |
53 | 53 | <div class="updated manage-form-admin-notice"> |
54 | 54 | <p><?php _e( 'Mailchimp Form successfully cloned.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | <?php |
57 | 57 | } |
58 | 58 | // duplicate form error |
59 | - if( isset( $_REQUEST['duplicated-form'] ) && $_REQUEST['duplicated-form'] == 'false' ) { |
|
59 | + if ( isset( $_REQUEST[ 'duplicated-form' ] ) && $_REQUEST[ 'duplicated-form' ] == 'false' ) { |
|
60 | 60 | ?> |
61 | 61 | <div class="error manage-form-admin-notice"> |
62 | 62 | <p><?php _e( 'There was an error trying to clone your form. Please try again. If this error persists, please contact the YIKES Inc. support team.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | <?php |
65 | 65 | } |
66 | 66 | // reset form submission stats success |
67 | - if( isset( $_REQUEST['reset-stats'] ) && $_REQUEST['reset-stats'] == 'true' ) { |
|
67 | + if ( isset( $_REQUEST[ 'reset-stats' ] ) && $_REQUEST[ 'reset-stats' ] == 'true' ) { |
|
68 | 68 | ?> |
69 | 69 | <div class="updated manage-form-admin-notice"> |
70 | 70 | <p><?php _e( 'Form submission stats/rates successfully reset.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | <?php |
73 | 73 | } |
74 | 74 | // reset form submission stats error |
75 | - if( isset( $_REQUEST['reset-stats'] ) && $_REQUEST['reset-stats'] == 'false' ) { |
|
75 | + if ( isset( $_REQUEST[ 'reset-stats' ] ) && $_REQUEST[ 'reset-stats' ] == 'false' ) { |
|
76 | 76 | ?> |
77 | 77 | <div class="error manage-form-admin-notice"> |
78 | 78 | <p><?php _e( 'There was an error trying to reset the form submission stats/rates. Please try again. If this error persists, please contact the YIKES Inc. support team.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | <thead> |
100 | 100 | <tr> |
101 | 101 | <th id="cb" class="manage-column column-cb check-column num" scope="col"><input type="checkbox" /></th> |
102 | - <th id="columnname" class="manage-column column-columnname num yikes-form-id-number" scope="col"><?php _e( 'ID' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
103 | - <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'Form Name' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
104 | - <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'Form Description' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
105 | - <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'List' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
106 | - <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Impressions' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
107 | - <th id="columnname" class="manage-column column-columnname num" scope="col" ><?php _e( 'Submissions' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
108 | - <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Conversion Rate' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
102 | + <th id="columnname" class="manage-column column-columnname num yikes-form-id-number" scope="col"><?php _e( 'ID', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
103 | + <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'Form Name', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
104 | + <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'Form Description', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
105 | + <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'List', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
106 | + <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Impressions', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
107 | + <th id="columnname" class="manage-column column-columnname num" scope="col" ><?php _e( 'Submissions', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
108 | + <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Conversion Rate', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
109 | 109 | </tr> |
110 | 110 | </thead> |
111 | 111 | <!-- end header --> |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | <tfoot> |
115 | 115 | <tr> |
116 | 116 | <th class="manage-column column-cb check-column num" scope="col"><input type="checkbox" /></th> |
117 | - <th id="columnname" class="manage-column column-columnname num yikes-form-id-number" scope="col"><?php _e( 'ID' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
118 | - <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'Form Name' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
119 | - <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'Form Description' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
120 | - <th class="manage-column column-columnname" scope="col"><?php _e( 'List' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
121 | - <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Impressions' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
122 | - <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Submissions' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
123 | - <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Conversion Rate' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
117 | + <th id="columnname" class="manage-column column-columnname num yikes-form-id-number" scope="col"><?php _e( 'ID', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
118 | + <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'Form Name', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
119 | + <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'Form Description', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
120 | + <th class="manage-column column-columnname" scope="col"><?php _e( 'List', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
121 | + <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Impressions', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
122 | + <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Submissions', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
123 | + <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Conversion Rate', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
124 | 124 | </tr> |
125 | 125 | </tfoot> |
126 | 126 | <!-- end footer --> |
@@ -130,40 +130,40 @@ discard block |
||
130 | 130 | <?php |
131 | 131 | if ( count( $all_forms ) > 0 ) { |
132 | 132 | $i = 1; |
133 | - foreach( $all_forms as $id => $form ) { |
|
133 | + foreach ( $all_forms as $id => $form ) { |
|
134 | 134 | ?> |
135 | - <tr class="<?php if( $i % 2 == 0 ) { echo 'alternate'; } ?>"> |
|
135 | + <tr class="<?php if ( $i % 2 == 0 ) { echo 'alternate'; } ?>"> |
|
136 | 136 | <th class="check-column num" scope="row"><input type="checkbox" /></th> |
137 | 137 | <td class="column-columnname num"><span class="form-id-container"><?php echo intval( $id ); ?></span></td> |
138 | 138 | <td class="column-columnname"> |
139 | 139 | <!-- row title/link --> |
140 | - <a href="<?php echo esc_url_raw( add_query_arg( array( 'id' => $id ) , admin_url( 'admin.php?page=yikes-mailchimp-edit-form' ) ) ); ?>" class="row-title"> |
|
141 | - <?php echo stripslashes( $form['form_name'] ); ?> |
|
140 | + <a href="<?php echo esc_url_raw( add_query_arg( array( 'id' => $id ), admin_url( 'admin.php?page=yikes-mailchimp-edit-form' ) ) ); ?>" class="row-title"> |
|
141 | + <?php echo stripslashes( $form[ 'form_name' ] ); ?> |
|
142 | 142 | </a> |
143 | 143 | <div class="row-actions"> |
144 | - <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'id' => $id ) , admin_url( 'admin.php?page=yikes-mailchimp-edit-form' ) ) ); ?>"><?php _e( "Edit" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
145 | - <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-duplicate-form', 'mailchimp-form' => $id , 'nonce' => wp_create_nonce( 'duplicate-mailchimp-form-'.$id ) ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?>"><?php _e( "Duplicate" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
146 | - <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-reset-stats', 'mailchimp-form' => $id , 'nonce' => wp_create_nonce( 'reset-stats-mailchimp-form-'.$id ) ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?>"><?php _e( "Reset Stats" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
147 | - <span><a href="#" class="view-yikes-mc-form-shortcode" data-alt-text="<?php _e( 'Stats' , 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( "Shortcode" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
144 | + <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'id' => $id ), admin_url( 'admin.php?page=yikes-mailchimp-edit-form' ) ) ); ?>"><?php _e( "Edit", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
145 | + <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-duplicate-form', 'mailchimp-form' => $id, 'nonce' => wp_create_nonce( 'duplicate-mailchimp-form-' . $id ) ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?>"><?php _e( "Duplicate", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
146 | + <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-reset-stats', 'mailchimp-form' => $id, 'nonce' => wp_create_nonce( 'reset-stats-mailchimp-form-' . $id ) ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?>"><?php _e( "Reset Stats", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
147 | + <span><a href="#" class="view-yikes-mc-form-shortcode" data-alt-text="<?php _e( 'Stats', 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( "Shortcode", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
148 | 148 | <?php |
149 | 149 | /* |
150 | 150 | * Custom action to allow users to add additional action links |
151 | 151 | * to each form. We use this in our add-ons. |
152 | 152 | * - Delete should remain last |
153 | 153 | */ |
154 | - do_action( 'yikes-mailchimp-custom-form-actions' , $id ); |
|
154 | + do_action( 'yikes-mailchimp-custom-form-actions', $id ); |
|
155 | 155 | ?> |
156 | - <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-delete-form', 'mailchimp-form' => $id , 'nonce' => wp_create_nonce( 'delete-mailchimp-form-'.$id ) ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?>" class="yikes-delete-mailchimp-form" onclick="return confirm('<?php printf( __( 'Are you sure you want to delete the %s form? This cannot be undone.' , 'yikes-inc-easy-mailchimp-extender' ), stripslashes( $form['form_name'] ) ); ?>');"><?php _e( "Delete" , 'yikes-inc-easy-mailchimp-extender' ); ?></a></span> |
|
156 | + <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-delete-form', 'mailchimp-form' => $id, 'nonce' => wp_create_nonce( 'delete-mailchimp-form-' . $id ) ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?>" class="yikes-delete-mailchimp-form" onclick="return confirm('<?php printf( __( 'Are you sure you want to delete the %s form? This cannot be undone.', 'yikes-inc-easy-mailchimp-extender' ), stripslashes( $form[ 'form_name' ] ) ); ?>');"><?php _e( "Delete", 'yikes-inc-easy-mailchimp-extender' ); ?></a></span> |
|
157 | 157 | </div> |
158 | 158 | </td> |
159 | 159 | |
160 | - <td class="column-columnname"><?php echo isset( $form['form_description'] ) ? str_replace( '[yikes-mailchimp-subscriber-count]', do_shortcode( '[yikes-mailchimp-subscriber-count form="' . $id . '"]' ), $form['form_description'] ) : ''; ?></td> |
|
160 | + <td class="column-columnname"><?php echo isset( $form[ 'form_description' ] ) ? str_replace( '[yikes-mailchimp-subscriber-count]', do_shortcode( '[yikes-mailchimp-subscriber-count form="' . $id . '"]' ), $form[ 'form_description' ] ) : ''; ?></td> |
|
161 | 161 | <td class="column-columnname"> |
162 | 162 | <?php |
163 | 163 | if ( $list_data && count( $list_data ) > 0 ) { |
164 | 164 | $parsed = wp_list_pluck( $list_data, 'name', 'id' ); |
165 | - if ( isset( $parsed[ $form['list_id'] ] ) ) { |
|
166 | - echo esc_textarea( $parsed[ $form['list_id'] ] ); |
|
165 | + if ( isset( $parsed[ $form[ 'list_id' ] ] ) ) { |
|
166 | + echo esc_textarea( $parsed[ $form[ 'list_id' ] ] ); |
|
167 | 167 | } else { |
168 | 168 | echo '<strong>' . __( 'List Not Found', 'yikes-inc-easy-mailchimp-extender' ) . '</strong>'; |
169 | 169 | } |
@@ -172,25 +172,25 @@ discard block |
||
172 | 172 | |
173 | 173 | <td class="column-columnname num stat-container"> |
174 | 174 | <?php |
175 | - $impressions = number_format( $form['impressions'] ); |
|
176 | - echo '<span title="' . __( 'Impressions' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . $impressions . '</span>'; |
|
175 | + $impressions = number_format( $form[ 'impressions' ] ); |
|
176 | + echo '<span title="' . __( 'Impressions', 'yikes-inc-easy-mailchimp-extender' ) . '">' . $impressions . '</span>'; |
|
177 | 177 | ?> |
178 | 178 | </td> |
179 | 179 | <td class="column-columnname num stat-container"> |
180 | 180 | <?php |
181 | - $submissions = number_format( $form['submissions'] ); |
|
182 | - echo '<span title="' . __( 'Submissions' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . $submissions . '</span>'; |
|
181 | + $submissions = number_format( $form[ 'submissions' ] ); |
|
182 | + echo '<span title="' . __( 'Submissions', 'yikes-inc-easy-mailchimp-extender' ) . '">' . $submissions . '</span>'; |
|
183 | 183 | ?> |
184 | 184 | </td> |
185 | 185 | <td class="column-columnname num stat-container"> |
186 | 186 | <?php |
187 | - if( $impressions != 0 ) { |
|
188 | - $conversion_rate = ( round( 100 * $form['submissions'] / $form['impressions'] , 3 ) ); |
|
189 | - if( $conversion_rate >= '15' ) { |
|
187 | + if ( $impressions != 0 ) { |
|
188 | + $conversion_rate = ( round( 100 * $form[ 'submissions' ] / $form[ 'impressions' ], 3 ) ); |
|
189 | + if ( $conversion_rate >= '15' ) { |
|
190 | 190 | $conversion_color = '#00cc00'; // green (unicorn!) |
191 | - } else if( $conversion_rate < '15' && $conversion_rate >= '10' ) { |
|
191 | + } else if ( $conversion_rate < '15' && $conversion_rate >= '10' ) { |
|
192 | 192 | $conversion_color = '#0080FF'; // light blue (good) |
193 | - } else if( $conversion_rate < '10' && $conversion_rate >= '5' ) { |
|
193 | + } else if ( $conversion_rate < '10' && $conversion_rate >= '5' ) { |
|
194 | 194 | $conversion_color = '#FFFF32'; // yellow (ok) |
195 | 195 | } else { |
196 | 196 | $conversion_color = '#FF0000'; // red (no bueno) |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $conversion_rate = '0'; |
200 | 200 | $conversion_color = '#333333'; |
201 | 201 | } |
202 | - echo '<span style="color:' . esc_attr( $conversion_color ) . ';" title="' . esc_attr__( 'Conversion Rate' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . $conversion_rate . '%</span>'; |
|
202 | + echo '<span style="color:' . esc_attr( $conversion_color ) . ';" title="' . esc_attr__( 'Conversion Rate', 'yikes-inc-easy-mailchimp-extender' ) . '">' . $conversion_rate . '%</span>'; |
|
203 | 203 | ?> |
204 | 204 | </td> |
205 | 205 | <!-- shortcode --> |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | } |
213 | 213 | } else { ?> |
214 | 214 | <tr class="no-items"> |
215 | - <td class="colspanchange no-mailchimp-forms-found" colspan="8"><em><?php _e( 'No Mailchimp forms found. Use the form to the right to create a new one.' , 'yikes-inc-easy-mailchimp-extender' ); ?></em></td> |
|
215 | + <td class="colspanchange no-mailchimp-forms-found" colspan="8"><em><?php _e( 'No Mailchimp forms found. Use the form to the right to create a new one.', 'yikes-inc-easy-mailchimp-extender' ); ?></em></td> |
|
216 | 216 | </tr> |
217 | 217 | <?php } ?> |
218 | 218 | </tbody> |
@@ -5,13 +5,13 @@ discard block |
||
5 | 5 | */ |
6 | 6 | |
7 | 7 | /* Get and Store Option Values */ |
8 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) === 'valid_api_key' ) { |
|
9 | - $api_connection = '<span id="connection-container" class="api-connected" title="' . __( "Your site is currently connected to the Mailchimp API" , "yikes-inc-easy-mailchimp-extender" ) . '"><span class="dashicons dashicons-yes yikes-mc-api-connected"></span> ' . __( "Connected" , 'yikes-inc-easy-mailchimp-extender' ) . '</span>'; |
|
8 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) === 'valid_api_key' ) { |
|
9 | + $api_connection = '<span id="connection-container" class="api-connected" title="' . __( "Your site is currently connected to the Mailchimp API", "yikes-inc-easy-mailchimp-extender" ) . '"><span class="dashicons dashicons-yes yikes-mc-api-connected"></span> ' . __( "Connected", 'yikes-inc-easy-mailchimp-extender' ) . '</span>'; |
|
10 | 10 | $api_error_response = ''; |
11 | 11 | } else { |
12 | - $api_connection = '<span id="connection-container" class="api-not-connected"><span class="dashicons dashicons-no-alt yikes-mc-api-not-connected"></span> ' . __( "Not Connected" , 'yikes-inc-easy-mailchimp-extender' ) . '</span>'; |
|
13 | - if( get_option( 'yikes-mc-api-invalid-key-response' , '' ) != '' ) { |
|
14 | - $api_error_response = '<p><small><i class="dashicons dashicons-no-alt"></i> ' . get_option( 'yikes-mc-api-invalid-key-response' , '' ) . '</small></p>'; |
|
12 | + $api_connection = '<span id="connection-container" class="api-not-connected"><span class="dashicons dashicons-no-alt yikes-mc-api-not-connected"></span> ' . __( "Not Connected", 'yikes-inc-easy-mailchimp-extender' ) . '</span>'; |
|
13 | + if ( get_option( 'yikes-mc-api-invalid-key-response', '' ) != '' ) { |
|
14 | + $api_error_response = '<p><small><i class="dashicons dashicons-no-alt"></i> ' . get_option( 'yikes-mc-api-invalid-key-response', '' ) . '</small></p>'; |
|
15 | 15 | } else { |
16 | 16 | $api_error_response = ''; |
17 | 17 | } |
@@ -23,23 +23,23 @@ discard block |
||
23 | 23 | * @since 6.2.2 |
24 | 24 | * |
25 | 25 | */ |
26 | - if ( isset( $_REQUEST['section'] ) ) { |
|
27 | - $_REQUEST['section'] = preg_replace('/[^\w-]/', '', strip_tags ( $_REQUEST['section'] ) ); |
|
26 | + if ( isset( $_REQUEST[ 'section' ] ) ) { |
|
27 | + $_REQUEST[ 'section' ] = preg_replace( '/[^\w-]/', '', strip_tags( $_REQUEST[ 'section' ] ) ); |
|
28 | 28 | } |
29 | 29 | ?> |
30 | 30 | <!-- Actual Settings Form --> |
31 | 31 | <div class="wrap"> |
32 | 32 | |
33 | 33 | <!-- Freddie Logo --> |
34 | - <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" /> |
|
34 | + <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" /> |
|
35 | 35 | |
36 | - <h1>Easy Forms for Mailchimp | <?php if ( isset( $_REQUEST['section'] ) ) { echo ucwords( str_replace( '-', ' ', $_REQUEST['section'] ) ); } else { echo __( 'General Settings' , 'yikes-inc-easy-mailchimp-extender' ); } ?></h1> |
|
36 | + <h1>Easy Forms for Mailchimp | <?php if ( isset( $_REQUEST[ 'section' ] ) ) { echo ucwords( str_replace( '-', ' ', $_REQUEST[ 'section' ] ) ); } else { echo __( 'General Settings', 'yikes-inc-easy-mailchimp-extender' ); } ?></h1> |
|
37 | 37 | |
38 | 38 | <!-- Settings Page Description --> |
39 | - <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Manage the overall settings for Easy forms for Mailchimp.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
39 | + <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Manage the overall settings for Easy forms for Mailchimp.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
40 | 40 | <?php |
41 | 41 | /* Success Messages on Options Updated */ |
42 | - if( isset( $_REQUEST['settings-updated'] ) && $_REQUEST['settings-updated'] == 'true' ) { |
|
42 | + if ( isset( $_REQUEST[ 'settings-updated' ] ) && $_REQUEST[ 'settings-updated' ] == 'true' ) { |
|
43 | 43 | ?> |
44 | 44 | <div class="updated manage-form-admin-notice"> |
45 | 45 | <p><?php _e( 'Settings successfully updated.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | <?php |
48 | 48 | } |
49 | 49 | /* Mailchimp API Cleared Successfully message */ |
50 | - if( isset( $_REQUEST['transient-cleared'] ) && $_REQUEST['transient-cleared'] == 'true' ) { |
|
50 | + if ( isset( $_REQUEST[ 'transient-cleared' ] ) && $_REQUEST[ 'transient-cleared' ] == 'true' ) { |
|
51 | 51 | ?> |
52 | 52 | <div class="updated manage-form-admin-notice"> |
53 | 53 | <p><?php _e( 'Mailchimp API Cache successfully cleared.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | /* Error Log Clear Messages */ |
58 | 58 | /* Success Messages on Options Updated */ |
59 | - if( isset( $_REQUEST['error-log-cleared'] ) && $_REQUEST['error-log-cleared'] == 'true' ) { |
|
59 | + if ( isset( $_REQUEST[ 'error-log-cleared' ] ) && $_REQUEST[ 'error-log-cleared' ] == 'true' ) { |
|
60 | 60 | ?> |
61 | 61 | <div class="updated manage-form-admin-notice"> |
62 | 62 | <p><?php _e( 'Error log successfully cleared.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | <?php |
65 | 65 | } |
66 | 66 | /* Mailchimp API Cleared Successfully message */ |
67 | - if( isset( $_REQUEST['error-log-cleared'] ) && $_REQUEST['error-log-cleared'] == 'false' ) { |
|
67 | + if ( isset( $_REQUEST[ 'error-log-cleared' ] ) && $_REQUEST[ 'error-log-cleared' ] == 'false' ) { |
|
68 | 68 | ?> |
69 | 69 | <div class="error manage-form-admin-notice"> |
70 | 70 | <p><?php _e( "Whoops! We've encountered an error while trying to clear the error log. Please refresh the page and try again. If the error persists please get in touch with the YIKES Inc. support team.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -73,28 +73,28 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | /* Display a success message if our error log was sucessfully created, or display an error if not */ |
76 | - if( isset( $_GET['error_log_created'] ) && $_GET['error_log_created'] == 'true' ) { |
|
76 | + if ( isset( $_GET[ 'error_log_created' ] ) && $_GET[ 'error_log_created' ] == 'true' ) { |
|
77 | 77 | ?> |
78 | 78 | <div class="updated"> |
79 | 79 | <p><?php _e( 'Error log successfully created. You may now start logging errors.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
80 | 80 | </div> |
81 | 81 | <?php |
82 | - } else if( isset( $_GET['error_log_created'] ) && $_GET['error_log_created'] == 'false' ) { |
|
82 | + } else if ( isset( $_GET[ 'error_log_created' ] ) && $_GET[ 'error_log_created' ] == 'false' ) { |
|
83 | 83 | ?> |
84 | 84 | <div class="error"> |
85 | - <p><?php echo esc_attr( urldecode( $_GET['error_message'] ) , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
85 | + <p><?php echo esc_attr( urldecode( $_GET[ 'error_message' ] ), 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
86 | 86 | </div> |
87 | 87 | <?php |
88 | 88 | } |
89 | 89 | |
90 | 90 | /* Display a success message if the user successfully imported some forms */ |
91 | - if( isset( $_GET['section'] ) && $_GET['section'] == 'import-export-forms' && isset( $_GET['import-forms'] ) && $_GET['import-forms'] == 'true' ) { |
|
91 | + if ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] == 'import-export-forms' && isset( $_GET[ 'import-forms' ] ) && $_GET[ 'import-forms' ] == 'true' ) { |
|
92 | 92 | ?> |
93 | 93 | <div class="updated"> |
94 | 94 | <p><?php printf( __( 'Opt-in forms successfully imported. <a href="%s" title="View Forms">View Forms</a>', 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?></p> |
95 | 95 | </div> |
96 | 96 | <?php |
97 | - } elseif( isset( $_GET['section'] ) && $_GET['section'] == 'import-export-forms' && isset( $_GET['import-settings'] ) && $_GET['import-settings'] == 'true' ) { |
|
97 | + } elseif ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] == 'import-export-forms' && isset( $_GET[ 'import-settings' ] ) && $_GET[ 'import-settings' ] == 'true' ) { |
|
98 | 98 | ?> |
99 | 99 | <div class="updated"> |
100 | 100 | <p><?php printf( __( 'YIKES Easy Forms for Mailchimp settings successfully imported.', 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?></p> |
@@ -115,11 +115,11 @@ discard block |
||
115 | 115 | |
116 | 116 | <div class="postbox yikes-easy-mc-postbox"> |
117 | 117 | |
118 | - <?php if( !isset( $_REQUEST['section'] ) || $_REQUEST['section'] == '' ) { |
|
118 | + <?php if ( ! isset( $_REQUEST[ 'section' ] ) || $_REQUEST[ 'section' ] == '' ) { |
|
119 | 119 | include YIKES_MC_PATH . 'admin/partials/menu/options-sections/general-settings.php'; |
120 | 120 | } else { |
121 | - if( isset( $_REQUEST['addon'] ) && $_REQUEST['addon'] == 'true' ) { |
|
122 | - include apply_filters( 'yikes-mailchimp-'.$_REQUEST['section'].'-options-path' , '' ); |
|
121 | + if ( isset( $_REQUEST[ 'addon' ] ) && $_REQUEST[ 'addon' ] == 'true' ) { |
|
122 | + include apply_filters( 'yikes-mailchimp-' . $_REQUEST[ 'section' ] . '-options-path', '' ); |
|
123 | 123 | } else { |
124 | 124 | // White list a set of files that are allowed to be included here |
125 | 125 | $file_base = 'admin/partials/menu/options-sections/'; |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | $file_base . 'recaptcha-settings.php', |
133 | 133 | ); |
134 | 134 | // Ensure the included file is allowed and whitelisted above, before including it |
135 | - if ( 0 === validate_file( 'admin/partials/menu/options-sections/' . $_REQUEST['section'] . '.php', $acceptable_files ) ) { |
|
136 | - include YIKES_MC_PATH . 'admin/partials/menu/options-sections/' . $_REQUEST['section'] . '.php'; |
|
135 | + if ( 0 === validate_file( 'admin/partials/menu/options-sections/' . $_REQUEST[ 'section' ] . '.php', $acceptable_files ) ) { |
|
136 | + include YIKES_MC_PATH . 'admin/partials/menu/options-sections/' . $_REQUEST[ 'section' ] . '.php'; |
|
137 | 137 | } else { |
138 | 138 | wp_die( esc_attr__( 'Invalid file. If this error persists, please contact support.', 'yikes-inc-easy-mailchimp' ) ); |
139 | 139 | } |
@@ -27,16 +27,16 @@ discard block |
||
27 | 27 | ?> |
28 | 28 | <div class="wrap"> |
29 | 29 | <!-- Freddie Logo --> |
30 | - <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" /> |
|
30 | + <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" /> |
|
31 | 31 | |
32 | - <h1>Easy Forms for Mailchimp | <?php _e( 'Manage Mailing Lists' , 'yikes-inc-easy-mailchimp-extender' ); ?></h1> |
|
32 | + <h1>Easy Forms for Mailchimp | <?php _e( 'Manage Mailing Lists', 'yikes-inc-easy-mailchimp-extender' ); ?></h1> |
|
33 | 33 | |
34 | 34 | <!-- Settings Page Description --> |
35 | - <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Make edits to your Mailchimp lists.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
35 | + <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Make edits to your Mailchimp lists.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
36 | 36 | |
37 | 37 | <?php |
38 | 38 | /* If the user hasn't authenticated yet, lets kill off */ |
39 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) != 'valid_api_key' ) { |
|
39 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'valid_api_key' ) { |
|
40 | 40 | |
41 | 41 | $error_string = sprintf( |
42 | 42 | esc_html__( 'You need to connect to Mailchimp before you can start creating forms. Head over to the %s and enter your API key.', 'yikes-inc-easy-mailchimp-extender' ), |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | <!-- TABLE HEAD --> |
73 | 73 | <thead> |
74 | 74 | <tr> |
75 | - <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'List Name' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
76 | - <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Subscriber Count' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
75 | + <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'List Name', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
76 | + <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Subscriber Count', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
77 | 77 | </tr> |
78 | 78 | </thead> |
79 | 79 | <!-- end header --> |
@@ -81,25 +81,25 @@ discard block |
||
81 | 81 | <!-- FOOTER --> |
82 | 82 | <tfoot> |
83 | 83 | <tr> |
84 | - <th class="manage-column column-columnname" scope="col"><?php _e( 'List Name' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
85 | - <th class="manage-column column-columnname num" scope="col"><?php _e( 'Subscriber Count' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
84 | + <th class="manage-column column-columnname" scope="col"><?php _e( 'List Name', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
85 | + <th class="manage-column column-columnname num" scope="col"><?php _e( 'Subscriber Count', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
86 | 86 | </tr> |
87 | 87 | </tfoot> |
88 | 88 | <!-- end footer --> |
89 | 89 | |
90 | 90 | <!-- TABLE BODY --> |
91 | 91 | <tbody> |
92 | - <?php if( count( $list_data ) > 0 ) { |
|
92 | + <?php if ( count( $list_data ) > 0 ) { |
|
93 | 93 | $i = 1; |
94 | - foreach( $list_data as $list ) { |
|
94 | + foreach ( $list_data as $list ) { |
|
95 | 95 | ?> |
96 | - <tr class="<?php if( $i % 2 == 0 ) { echo 'alternate'; } ?>"> |
|
96 | + <tr class="<?php if ( $i % 2 == 0 ) { echo 'alternate'; } ?>"> |
|
97 | 97 | <td class="column-columnname"> |
98 | - <a href="<?php echo esc_url_raw( add_query_arg( array( 'list-id' => $list['id'] ) , admin_url( 'admin.php?page=yikes-mailchimp-view-list' ) ) ); ?>" class="row-title"> |
|
99 | - <?php echo stripslashes( $list['name'] ); ?> |
|
98 | + <a href="<?php echo esc_url_raw( add_query_arg( array( 'list-id' => $list[ 'id' ] ), admin_url( 'admin.php?page=yikes-mailchimp-view-list' ) ) ); ?>" class="row-title"> |
|
99 | + <?php echo stripslashes( $list[ 'name' ] ); ?> |
|
100 | 100 | </a> |
101 | 101 | <div class="row-actions"> |
102 | - <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'list-id' => $list['id'] ) , admin_url( 'admin.php?page=yikes-mailchimp-view-list' ) ) ); ?>"><?php _e( "View" , 'yikes-inc-easy-mailchimp-extender' ); ?></a></span> |
|
102 | + <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'list-id' => $list[ 'id' ] ), admin_url( 'admin.php?page=yikes-mailchimp-view-list' ) ) ); ?>"><?php _e( "View", 'yikes-inc-easy-mailchimp-extender' ); ?></a></span> |
|
103 | 103 | <?php |
104 | 104 | /* |
105 | 105 | * Custom action to allow users to add additional action links |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | ?> |
110 | 110 | </div> |
111 | 111 | </td> |
112 | - <td class="column-columnname num"><?php echo $list['stats']['member_count']; ?></td> |
|
112 | + <td class="column-columnname num"><?php echo $list[ 'stats' ][ 'member_count' ]; ?></td> |
|
113 | 113 | </tr> |
114 | 114 | <?php |
115 | 115 | $i++; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | } else { |
118 | 118 | ?> |
119 | 119 | <tr class="no-items"> |
120 | - <td class="colspanchange no-mailchimp-lists-found" colspan="3"><em><?php printf( __( 'No Mailchimp lists found. Head over to <a href="%s" title="Mailchimp.com">Mailchimp.com</a> to setup your first mailing list. Once thats done you can head back here to customize it!' , 'yikes-inc-easy-mailchimp-extender' ), esc_url( 'http://mailchimp.com/' ) ); ?></em></td> |
|
120 | + <td class="colspanchange no-mailchimp-lists-found" colspan="3"><em><?php printf( __( 'No Mailchimp lists found. Head over to <a href="%s" title="Mailchimp.com">Mailchimp.com</a> to setup your first mailing list. Once thats done you can head back here to customize it!', 'yikes-inc-easy-mailchimp-extender' ), esc_url( 'http://mailchimp.com/' ) ); ?></em></td> |
|
121 | 121 | </tr> |
122 | 122 | <?php } ?> |
123 | 123 | </tbody> |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | <div class="postbox yikes-easy-mc-postbox"> |
138 | 138 | <div class="inside"> |
139 | 139 | |
140 | - <a href="https://us3.admin.mailchimp.com/" title="<?php _e( 'Mailchimp Site' , 'yikes-inc-easy-mailchimp-extender' ); ?>" target="_blank"> |
|
141 | - <img src="<?php echo YIKES_MC_URL . 'includes/images/Mailchimp_Assets/mailchimp-logo.png'; ?>" title="<?php _e( 'Mailchimp Site' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="list-page-mailchimp-logo"> |
|
140 | + <a href="https://us3.admin.mailchimp.com/" title="<?php _e( 'Mailchimp Site', 'yikes-inc-easy-mailchimp-extender' ); ?>" target="_blank"> |
|
141 | + <img src="<?php echo YIKES_MC_URL . 'includes/images/Mailchimp_Assets/mailchimp-logo.png'; ?>" title="<?php _e( 'Mailchimp Site', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="list-page-mailchimp-logo"> |
|
142 | 142 | </a> |
143 | 143 | |
144 | 144 | </div> |
@@ -148,42 +148,42 @@ discard block |
||
148 | 148 | <div class="postbox yikes-easy-mc-postbox list-page-sidebar"> |
149 | 149 | <div class="inside"> |
150 | 150 | |
151 | - <h2 class="account-status"><?php echo $account_details['username']; ?> <small>(<?php echo $account_details['role']; ?>)</small></h2> |
|
151 | + <h2 class="account-status"><?php echo $account_details[ 'username' ]; ?> <small>(<?php echo $account_details[ 'role' ]; ?>)</small></h2> |
|
152 | 152 | |
153 | - <img class="mailchimp-avatar" src="<?php echo esc_url_raw( $account_details['avatar_url'] ); ?>" title="<?php echo $account_details['username'] . ' ' . __( "Mailchimp avatar" , 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
153 | + <img class="mailchimp-avatar" src="<?php echo esc_url_raw( $account_details[ 'avatar_url' ] ); ?>" title="<?php echo $account_details[ 'username' ] . ' ' . __( "Mailchimp avatar", 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
154 | 154 | |
155 | 155 | <table class="form-table" id="account-details-table"> |
156 | 156 | <tr valign="top"> |
157 | 157 | <td scope="row"> |
158 | 158 | <label for="tablecell"> |
159 | - <strong><?php _e( 'Company' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
159 | + <strong><?php _e( 'Company', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
160 | 160 | </label> |
161 | 161 | </td> |
162 | - <td><?php echo $account_details['contact']['company']; ?><br /><?php echo $account_details['contact']['city'] . ', ' . $account_details['contact']['state']; ?></td> |
|
162 | + <td><?php echo $account_details[ 'contact' ][ 'company' ]; ?><br /><?php echo $account_details[ 'contact' ][ 'city' ] . ', ' . $account_details[ 'contact' ][ 'state' ]; ?></td> |
|
163 | 163 | </tr> |
164 | 164 | <tr valign="top"> |
165 | 165 | <td scope="row"> |
166 | 166 | <label for="tablecell"> |
167 | - <strong><?php _e( 'Industry' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
167 | + <strong><?php _e( 'Industry', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
168 | 168 | </label> |
169 | 169 | </td> |
170 | - <td><?php echo $account_details['account_industry']; ?></td> |
|
170 | + <td><?php echo $account_details[ 'account_industry' ]; ?></td> |
|
171 | 171 | </tr> |
172 | 172 | <tr valign="top"> |
173 | 173 | <td scope="row"> |
174 | 174 | <label for="tablecell"> |
175 | - <strong><?php _e( 'Member Since' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
175 | + <strong><?php _e( 'Member Since', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
176 | 176 | </label> |
177 | 177 | </td> |
178 | - <td><?php echo date( get_option('date_format') , strtotime( $account_details['member_since'] ) ); ?></td> |
|
178 | + <td><?php echo date( get_option( 'date_format' ), strtotime( $account_details[ 'member_since' ] ) ); ?></td> |
|
179 | 179 | </tr> |
180 | 180 | <tr valign="top"> |
181 | 181 | <td scope="row"> |
182 | 182 | <label for="tablecell"> |
183 | - <strong><?php _e( 'Plan Type' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
183 | + <strong><?php _e( 'Plan Type', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
184 | 184 | </label> |
185 | 185 | </td> |
186 | - <td><?php echo ucwords( $account_details['pricing_plan_type'] ); ?></td> |
|
186 | + <td><?php echo ucwords( $account_details[ 'pricing_plan_type' ] ); ?></td> |
|
187 | 187 | </tr> |
188 | 188 | </table> |
189 | 189 |
@@ -54,23 +54,23 @@ discard block |
||
54 | 54 | |
55 | 55 | // Easy Digital Downloads. |
56 | 56 | if ( class_exists( 'Easy_Digital_Downloads' ) ) { |
57 | - $active_plugins['easy_digital_downloads_checkout_form'] = __( 'Easy Digital Downloads Checkout', 'yikes-inc-easy-mailchimp-extender' ); |
|
57 | + $active_plugins[ 'easy_digital_downloads_checkout_form' ] = __( 'Easy Digital Downloads Checkout', 'yikes-inc-easy-mailchimp-extender' ); |
|
58 | 58 | } |
59 | 59 | // WooCommerce. |
60 | 60 | if ( class_exists( 'WooCommerce' ) ) { |
61 | - $active_plugins['woocommerce_checkout_form'] = __( 'WooCommerce Checkout', 'yikes-inc-easy-mailchimp-extender' ); |
|
61 | + $active_plugins[ 'woocommerce_checkout_form' ] = __( 'WooCommerce Checkout', 'yikes-inc-easy-mailchimp-extender' ); |
|
62 | 62 | } |
63 | 63 | // BuddyPress. |
64 | 64 | if ( class_exists( 'BuddyPress' ) ) { |
65 | - $active_plugins['buddypress_form'] = __( 'BuddyPress Registration', 'yikes-inc-easy-mailchimp-extender' ); |
|
65 | + $active_plugins[ 'buddypress_form' ] = __( 'BuddyPress Registration', 'yikes-inc-easy-mailchimp-extender' ); |
|
66 | 66 | } |
67 | 67 | // bbPress. |
68 | 68 | if ( class_exists( 'bbPress' ) ) { |
69 | - $active_plugins['bbpress_forms'] = __( 'bbPress', 'yikes-inc-easy-mailchimp-extender' ); |
|
69 | + $active_plugins[ 'bbpress_forms' ] = __( 'bbPress', 'yikes-inc-easy-mailchimp-extender' ); |
|
70 | 70 | } |
71 | 71 | // Contact Form 7. |
72 | 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' ); |
|
73 | + $active_plugins[ 'contact_form_7' ] = __( 'Contact Form 7', 'yikes-inc-easy-mailchimp-extender' ); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | // store our checkbox options. |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
88 | 88 | $error_logging->maybe_write_to_log( |
89 | 89 | $list_data->get_error_code(), |
90 | - __( "Get Account Lists" , 'yikes-inc-easy-mailchimp-extender' ), |
|
90 | + __( "Get Account Lists", 'yikes-inc-easy-mailchimp-extender' ), |
|
91 | 91 | "Integration Settings Page" |
92 | 92 | ); |
93 | 93 | } |
@@ -118,26 +118,26 @@ discard block |
||
118 | 118 | <?php |
119 | 119 | if ( ! empty( $active_plugins ) ) { |
120 | 120 | |
121 | - foreach( $active_plugins as $class => $value ) { |
|
121 | + foreach ( $active_plugins as $class => $value ) { |
|
122 | 122 | |
123 | - $checked = isset( $options[$class]['value'] ) ? 'checked="checked"' : ''; |
|
124 | - $hidden = ! isset( $options[$class]['value'] ) ? 'yikes-easy-mc-hidden' : ''; |
|
125 | - $checkbox_label = isset( $options[$class]['label'] ) ? esc_attr( $options[$class]['label'] ) : ''; |
|
126 | - $precheck_checkbox = isset( $options[$class]['precheck'] ) ? $options[$class]['precheck'] : ''; |
|
127 | - $selected_list = isset( $options[$class]['associated-list'] ) ? $options[$class]['associated-list'] : '-'; |
|
128 | - $list_interest_groups = isset( $options[$class]['interest-groups'] ) ? $options[$class]['interest-groups'] : false; |
|
123 | + $checked = isset( $options[ $class ][ 'value' ] ) ? 'checked="checked"' : ''; |
|
124 | + $hidden = ! isset( $options[ $class ][ 'value' ] ) ? 'yikes-easy-mc-hidden' : ''; |
|
125 | + $checkbox_label = isset( $options[ $class ][ 'label' ] ) ? esc_attr( $options[ $class ][ 'label' ] ) : ''; |
|
126 | + $precheck_checkbox = isset( $options[ $class ][ 'precheck' ] ) ? $options[ $class ][ 'precheck' ] : ''; |
|
127 | + $selected_list = isset( $options[ $class ][ 'associated-list' ] ) ? $options[ $class ][ 'associated-list' ] : '-'; |
|
128 | + $list_interest_groups = isset( $options[ $class ][ 'interest-groups' ] ) ? $options[ $class ][ 'interest-groups' ] : false; |
|
129 | 129 | |
130 | 130 | // Force the selected list to be an array (@since 6.4). |
131 | 131 | $selected_list = is_array( $selected_list ) ? $selected_list : array( $selected_list ); |
132 | 132 | ?> |
133 | 133 | <li class="yikes-mailchimp-checkbox-integration-item"> |
134 | 134 | <label> |
135 | - <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> |
|
135 | + <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> |
|
136 | 136 | </label> |
137 | 137 | </li> |
138 | 138 | <!-- checkbox settings, text - associated list etc. --> |
139 | 139 | <li class="optin-checkbox-init[<?php echo $class; ?>]-settings <?php echo $hidden; ?>"> |
140 | - <?php if( $class == 'contact_form_7' ) { ?> |
|
140 | + <?php if ( $class == 'contact_form_7' ) { ?> |
|
141 | 141 | <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> |
142 | 142 | <?php } ?> |
143 | 143 | <p style="margin-top:0;padding-top:0;margin-bottom:0;padding-bottom:0;"> |
@@ -147,24 +147,24 @@ discard block |
||
147 | 147 | <?php |
148 | 148 | if ( count( $list_data ) > 0 ) { |
149 | 149 | ?> |
150 | - <?php foreach( $list_data as $list ) { ?> |
|
150 | + <?php foreach ( $list_data as $list ) { ?> |
|
151 | 151 | |
152 | 152 | <?php |
153 | - $list_interest_groups = isset( $list_interest_groups[ $list['id'] ] ) ? $list_interest_groups[ $list['id'] ] : $list_interest_groups; |
|
153 | + $list_interest_groups = isset( $list_interest_groups[ $list[ 'id' ] ] ) ? $list_interest_groups[ $list[ 'id' ] ] : $list_interest_groups; |
|
154 | 154 | ?> |
155 | 155 | |
156 | - <label class="yikes-mailchimp-checkbox-integration-list" for="list-<?php echo $class ?>-<?php echo $list['id']; ?>"> |
|
156 | + <label class="yikes-mailchimp-checkbox-integration-list" for="list-<?php echo $class ?>-<?php echo $list[ 'id' ]; ?>"> |
|
157 | 157 | <input type="checkbox" class="checkbox-settings-list-item" data-integration="<?php echo $class; ?>" |
158 | 158 | name="optin-checkbox-init[<?php echo $class; ?>][associated-list][]" |
159 | - value="<?php echo $list['id']; ?>" <?php echo in_array( $list['id'], $selected_list ) ? 'checked="checked"' : ''; ?> |
|
160 | - id="list-<?php echo $class ?>-<?php echo $list['id']; ?>"> |
|
161 | - <?php echo $list['name']; ?> |
|
159 | + value="<?php echo $list[ 'id' ]; ?>" <?php echo in_array( $list[ 'id' ], $selected_list ) ? 'checked="checked"' : ''; ?> |
|
160 | + id="list-<?php echo $class ?>-<?php echo $list[ 'id' ]; ?>"> |
|
161 | + <?php echo $list[ 'name' ]; ?> |
|
162 | 162 | </label> |
163 | 163 | |
164 | 164 | <!-- If interest groups have been selected already, load them here --> |
165 | 165 | <?php |
166 | - if ( in_array( $list['id'], $selected_list ) && $list_interest_groups ) { |
|
167 | - YIKES_Inc_Easy_Mailchimp_Process_Ajax::check_list_for_interest_groups( $list['id'], $class, true ); |
|
166 | + if ( in_array( $list[ 'id' ], $selected_list ) && $list_interest_groups ) { |
|
167 | + YIKES_Inc_Easy_Mailchimp_Process_Ajax::check_list_for_interest_groups( $list[ 'id' ], $class, true ); |
|
168 | 168 | } |
169 | 169 | ?> |
170 | 170 | |
@@ -185,8 +185,8 @@ discard block |
||
185 | 185 | <label class="optin-checkbox-label"> |
186 | 186 | <strong><?php _e( 'Precheck Checkbox?', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
187 | 187 | <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"> |
188 | - <option value="true" <?php selected( $precheck_checkbox , 'true' ); ?>><?php _e( 'Yes', 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
189 | - <option value="false" <?php selected( $precheck_checkbox , 'false' ); ?>><?php _e( 'No', 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
188 | + <option value="true" <?php selected( $precheck_checkbox, 'true' ); ?>><?php _e( 'Yes', 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
189 | + <option value="false" <?php selected( $precheck_checkbox, 'false' ); ?>><?php _e( 'No', 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
190 | 190 | </select> |
191 | 191 | </label> |
192 | 192 | </p> |
@@ -53,23 +53,23 @@ discard block |
||
53 | 53 | ); |
54 | 54 | |
55 | 55 | // Easy Digital Downloads. |
56 | - if ( class_exists( 'Easy_Digital_Downloads' ) ) { |
|
56 | + if ( class_exists( 'Easy_Digital_Downloads' ) ) { |
|
57 | 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' ) ) { |
|
60 | + if ( class_exists( 'WooCommerce' ) ) { |
|
61 | 61 | $active_plugins['woocommerce_checkout_form'] = __( 'WooCommerce Checkout', 'yikes-inc-easy-mailchimp-extender' ); |
62 | 62 | } |
63 | 63 | // BuddyPress. |
64 | - if ( class_exists( 'BuddyPress' ) ) { |
|
64 | + if ( class_exists( 'BuddyPress' ) ) { |
|
65 | 65 | $active_plugins['buddypress_form'] = __( 'BuddyPress Registration', 'yikes-inc-easy-mailchimp-extender' ); |
66 | 66 | } |
67 | 67 | // bbPress. |
68 | - if ( class_exists( 'bbPress' ) ) { |
|
68 | + if ( class_exists( 'bbPress' ) ) { |
|
69 | 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' ) ) { |
|
72 | + if ( is_plugin_active( 'contact-form-7/wp-contact-form-7.php' ) ) { |
|
73 | 73 | $active_plugins['contact_form_7'] = __( 'Contact Form 7', 'yikes-inc-easy-mailchimp-extender' ); |
74 | 74 | } |
75 | 75 | |
@@ -81,9 +81,9 @@ discard block |
||
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 | $list_data = yikes_get_mc_api_manager()->get_list_handler()->get_lists(); |
86 | - if ( is_wp_error( $list_data ) ) { |
|
86 | + if ( is_wp_error( $list_data ) ) { |
|
87 | 87 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
88 | 88 | $error_logging->maybe_write_to_log( |
89 | 89 | $list_data->get_error_code(), |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | "Integration Settings Page" |
92 | 92 | ); |
93 | 93 | } |
94 | - } else { |
|
94 | + } else { |
|
95 | 95 | ?> |
96 | 96 | <div class="inside"> |
97 | 97 | <?php |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | |
117 | 117 | <ul> |
118 | 118 | <?php |
119 | - if ( ! empty( $active_plugins ) ) { |
|
119 | + if ( ! empty( $active_plugins ) ) { |
|
120 | 120 | |
121 | - foreach( $active_plugins as $class => $value ) { |
|
121 | + foreach( $active_plugins as $class => $value ) { |
|
122 | 122 | |
123 | 123 | $checked = isset( $options[$class]['value'] ) ? 'checked="checked"' : ''; |
124 | 124 | $hidden = ! isset( $options[$class]['value'] ) ? 'yikes-easy-mc-hidden' : ''; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | <!-- Associated Lists --> |
146 | 146 | <div class="checkbox-lists"><strong><?php _e( 'Choose Lists: ', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
147 | 147 | <?php |
148 | - if ( count( $list_data ) > 0 ) { |
|
148 | + if ( count( $list_data ) > 0 ) { |
|
149 | 149 | ?> |
150 | 150 | <?php foreach( $list_data as $list ) { ?> |
151 | 151 | |
@@ -163,14 +163,14 @@ discard block |
||
163 | 163 | |
164 | 164 | <!-- If interest groups have been selected already, load them here --> |
165 | 165 | <?php |
166 | - if ( in_array( $list['id'], $selected_list ) && $list_interest_groups ) { |
|
166 | + if ( in_array( $list['id'], $selected_list ) && $list_interest_groups ) { |
|
167 | 167 | YIKES_Inc_Easy_Mailchimp_Process_Ajax::check_list_for_interest_groups( $list['id'], $class, true ); |
168 | 168 | } |
169 | 169 | ?> |
170 | 170 | |
171 | 171 | <?php } ?> |
172 | 172 | <?php |
173 | - } else { |
|
173 | + } else { |
|
174 | 174 | echo '<p class="description no-lists-setup-notice"><strong>' . __( 'You have not setup any lists. Head over to Mailchimp and setup your first list.', 'yikes-inc-easy-mailchimp-extender' ) . '</strong></p>'; |
175 | 175 | } |
176 | 176 | ?> |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | </li> |
194 | 194 | <?php |
195 | 195 | } |
196 | - } else { |
|
196 | + } else { |
|
197 | 197 | ?> |
198 | 198 | <li> |
199 | 199 | <?php _e( 'Nothing is active.', 'yikes-inc-easy-mailchimp-extender' ); ?> |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @subpackage Yikes_Inc_Easy_Mailchimp_Extender/includes |
26 | 26 | * @author YIKES Inc. <[email protected]> |
27 | 27 | */ |
28 | -class Yikes_Inc_Easy_Mailchimp_Extender { |
|
28 | +class Yikes_Inc_Easy_Mailchimp_Extender { |
|
29 | 29 | /** |
30 | 30 | * The loader that's responsible for maintaining and registering all hooks that power |
31 | 31 | * the plugin. |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @param Yikes_Inc_Easy_Mailchimp_Extender_Form_Interface $form_interface |
72 | 72 | */ |
73 | - public function __construct( Yikes_Inc_Easy_Mailchimp_Extender_Form_Interface $form_interface ) { |
|
73 | + public function __construct( Yikes_Inc_Easy_Mailchimp_Extender_Form_Interface $form_interface ) { |
|
74 | 74 | $this->version = YIKES_MC_VERSION; |
75 | 75 | $this->form_interface = $form_interface; |
76 | 76 | $this->load_dependencies(); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @since 1.0.0 |
94 | 94 | * @access private |
95 | 95 | */ |
96 | - private function load_dependencies() { |
|
96 | + private function load_dependencies() { |
|
97 | 97 | /** |
98 | 98 | * The class responsible for orchestrating the actions and filters of the |
99 | 99 | * core plugin. |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * @since 1.0.0 |
122 | 122 | * @access private |
123 | 123 | */ |
124 | - private function define_admin_hooks() { |
|
124 | + private function define_admin_hooks() { |
|
125 | 125 | $plugin_admin = new Yikes_Inc_Easy_Mailchimp_Forms_Admin( $this->get_yikes_inc_easy_mailchimp_extender(), $this->get_version(), $this->form_interface ); |
126 | 126 | $plugin_admin->hooks(); |
127 | 127 | $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @since 1.0.0 |
135 | 135 | * @access private |
136 | 136 | */ |
137 | - private function define_public_hooks() { |
|
137 | + private function define_public_hooks() { |
|
138 | 138 | $plugin_public = new Yikes_Inc_Easy_Mailchimp_Extender_Public( $this->get_yikes_inc_easy_mailchimp_extender(), $this->get_version() ); |
139 | 139 | } |
140 | 140 | /** |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * |
143 | 143 | * @since 1.0.0 |
144 | 144 | */ |
145 | - public function run() { |
|
145 | + public function run() { |
|
146 | 146 | $this->loader->run(); |
147 | 147 | } |
148 | 148 | /** |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * @since 1.0.0 |
153 | 153 | * @return string The name of the plugin. |
154 | 154 | */ |
155 | - public function get_yikes_inc_easy_mailchimp_extender() { |
|
155 | + public function get_yikes_inc_easy_mailchimp_extender() { |
|
156 | 156 | return $this->yikes_inc_easy_mailchimp_extender; |
157 | 157 | } |
158 | 158 | /** |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * @since 1.0.0 |
162 | 162 | * @return Yikes_Inc_Easy_Mailchimp_Extender_Loader Orchestrates the hooks of the plugin. |
163 | 163 | */ |
164 | - public function get_loader() { |
|
164 | + public function get_loader() { |
|
165 | 165 | return $this->loader; |
166 | 166 | } |
167 | 167 | /** |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @since 1.0.0 |
171 | 171 | * @return string The version number of the plugin. |
172 | 172 | */ |
173 | - public function get_version() { |
|
173 | + public function get_version() { |
|
174 | 174 | return $this->version; |
175 | 175 | } |
176 | 176 | } |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | |
73 | 73 | $this->api_key = $api_key; |
74 | 74 | $parts = $this->get_api_key_parts(); |
75 | - $this->key = $parts['key']; |
|
76 | - $this->dc = $parts['dc']; |
|
75 | + $this->key = $parts[ 'key' ]; |
|
76 | + $this->dc = $parts[ 'dc' ]; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | $parts = explode( '-', $this->api_key ); |
99 | 99 | |
100 | 100 | return array( |
101 | - 'key' => $parts[0], |
|
102 | - 'dc' => isset( $parts[1] ) ? $parts[1] : '', |
|
101 | + 'key' => $parts[ 0 ], |
|
102 | + 'dc' => isset( $parts[ 1 ] ) ? $parts[ 1 ] : '', |
|
103 | 103 | ); |
104 | 104 | } |
105 | 105 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @return Yikes_Inc_Easy_Mailchimp_API |
144 | 144 | */ |
145 | 145 | public function get_api( $version = '' ) { |
146 | - $version = $version ?: $this->get_default_api_version(); |
|
146 | + $version = $version ? : $this->get_default_api_version(); |
|
147 | 147 | |
148 | 148 | if ( ! array_key_exists( $version, $this->api ) || null === $this->api[ $version ] ) { |
149 | 149 | $this->api[ $version ] = new Yikes_Inc_Easy_Mailchimp_API( $this->get_datacenter(), $this->get_api_key(), $version ); |
@@ -17,7 +17,7 @@ |
||
17 | 17 | // required..* |
18 | 18 | include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
19 | 19 | /* Visual Composer */ |
20 | - if( is_plugin_active( 'js_composer/js_composer.php' ) ) { |
|
20 | + if ( is_plugin_active( 'js_composer/js_composer.php' ) ) { |
|
21 | 21 | new YIKES_Mailchimp_Visual_Composer_Extension(); |
22 | 22 | } |
23 | 23 | } |
@@ -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,11 +58,11 @@ discard block |
||
58 | 58 | @since v6.0.4.1 |
59 | 59 | */ |
60 | 60 | public function sendUpdateProfileEmail() { |
61 | - $user_email = filter_var( $_POST['user_email'], FILTER_SANITIZE_STRING ); |
|
61 | + $user_email = filter_var( $_POST[ 'user_email' ], FILTER_SANITIZE_STRING ); |
|
62 | 62 | $user_id = md5( $user_email ); |
63 | - $list_id = filter_var( $_POST['list_id'], FILTER_SANITIZE_STRING ); |
|
64 | - $form_id = filter_var( $_POST['form_id'], FILTER_SANITIZE_NUMBER_INT ); |
|
65 | - $page_id = filter_var( $_POST['page_id'], FILTER_SANITIZE_NUMBER_INT ); |
|
63 | + $list_id = filter_var( $_POST[ 'list_id' ], FILTER_SANITIZE_STRING ); |
|
64 | + $form_id = filter_var( $_POST[ 'form_id' ], FILTER_SANITIZE_NUMBER_INT ); |
|
65 | + $page_id = filter_var( $_POST[ 'page_id' ], FILTER_SANITIZE_NUMBER_INT ); |
|
66 | 66 | $full_site_url = get_bloginfo( 'url' ); |
67 | 67 | $manager = yikes_get_mc_api_manager(); |
68 | 68 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | 'class.public_ajax.php' |
80 | 80 | ); |
81 | 81 | $is_error = true; |
82 | - $errors[] = $list_details->get_error_message(); |
|
82 | + $errors[ ] = $list_details->get_error_message(); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | // Subscriber details API call. |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
89 | 89 | $error_logging->maybe_write_to_log( $subscriber_account_details->get_error_code(), __( 'Send Update Profile Email - Get Member Info.', 'yikes-inc-easy-mailchimp-extender' ), 'class.public_ajax.php' ); |
90 | 90 | $is_error = true; |
91 | - $errors[] = $subscriber_account_details->get_error_message(); |
|
91 | + $errors[ ] = $subscriber_account_details->get_error_message(); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | // Form details API call. |
@@ -96,22 +96,22 @@ discard block |
||
96 | 96 | if ( ! empty( $interface ) && method_exists( $interface, 'get_form' ) && ! empty( $form_id ) ) { |
97 | 97 | $form_data = $interface->get_form( $form_id ); |
98 | 98 | if ( ! empty( $form_data ) ) { |
99 | - if ( isset( $form_data['error_messages'] ) ) { |
|
99 | + if ( isset( $form_data[ 'error_messages' ] ) ) { |
|
100 | 100 | |
101 | - if ( isset( $form_data['error_messages']['email-body'] ) && ! empty( $form_data['error_messages']['email-body'] ) ) { |
|
102 | - $email_body = apply_filters( 'the_content', $form_data['error_messages']['email-body'] ); |
|
101 | + if ( isset( $form_data[ 'error_messages' ][ 'email-body' ] ) && ! empty( $form_data[ 'error_messages' ][ 'email-body' ] ) ) { |
|
102 | + $email_body = apply_filters( 'the_content', $form_data[ 'error_messages' ][ 'email-body' ] ); |
|
103 | 103 | } |
104 | 104 | |
105 | - if ( isset( $form_data['error_messages']['email-subject'] ) && ! empty( $form_data['error_messages']['email-subject'] ) ) { |
|
106 | - $email_subject = $form_data['error_messages']['email-subject']; |
|
105 | + if ( isset( $form_data[ 'error_messages' ][ 'email-subject' ] ) && ! empty( $form_data[ 'error_messages' ][ 'email-subject' ] ) ) { |
|
106 | + $email_subject = $form_data[ 'error_messages' ][ 'email-subject' ]; |
|
107 | 107 | } |
108 | 108 | |
109 | - if ( isset( $form_data['error_messages']['update-email-success'] ) && ! empty( $form_data['error_messages']['update-email-success'] ) ) { |
|
110 | - $update_email_success_message = $form_data['error_messages']['update-email-success']; |
|
109 | + if ( isset( $form_data[ 'error_messages' ][ 'update-email-success' ] ) && ! empty( $form_data[ 'error_messages' ][ 'update-email-success' ] ) ) { |
|
110 | + $update_email_success_message = $form_data[ 'error_messages' ][ 'update-email-success' ]; |
|
111 | 111 | } |
112 | 112 | |
113 | - if ( isset( $form_data['error_messages']['update-email-failure'] ) && ! empty( $form_data['error_messages']['update-email-failure'] ) ) { |
|
114 | - $update_email_failed_message = $form_data['error_messages']['update-email-failure']; |
|
113 | + if ( isset( $form_data[ 'error_messages' ][ 'update-email-failure' ] ) && ! empty( $form_data[ 'error_messages' ][ 'update-email-failure' ] ) ) { |
|
114 | + $update_email_failed_message = $form_data[ 'error_messages' ][ 'update-email-failure' ]; |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | } |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | } |
133 | 133 | |
134 | 134 | // Construct the headers & email message content. |
135 | - $subscriber_id = $subscriber_account_details['unique_email_id']; |
|
136 | - $update_link_href = str_replace( '/subscribe', '/profile', $list_details['subscribe_url_long'] ); |
|
135 | + $subscriber_id = $subscriber_account_details[ 'unique_email_id' ]; |
|
136 | + $update_link_href = str_replace( '/subscribe', '/profile', $list_details[ 'subscribe_url_long' ] ); |
|
137 | 137 | $update_link_href = add_query_arg( 'e', $subscriber_id, $update_link_href ); |
138 | 138 | $update_link_tag = '<a href="' . $update_link_href . '">'; |
139 | - $headers = 'From: ' . $list_details['campaign_defaults']['from_name'] . ' <' . $list_details['campaign_defaults']['from_email'] . '>' . "\r\n"; |
|
139 | + $headers = 'From: ' . $list_details[ 'campaign_defaults' ][ 'from_name' ] . ' <' . $list_details[ 'campaign_defaults' ][ 'from_email' ] . '>' . "\r\n"; |
|
140 | 140 | $headers .= 'Content-type: text/html'; |
141 | 141 | |
142 | 142 | if ( ! isset( $email_subject ) ) { |
@@ -178,26 +178,26 @@ discard block |
||
178 | 178 | $email_body = str_replace( array( '[subscriber_id]', '[SUBSCRIBER_ID]' ), $subscriber_id, $email_body ); |
179 | 179 | |
180 | 180 | // We let the user use [form_name] for the form's name so replace [form_name] with the form's name. |
181 | - $email_body = str_replace( array( '[form_name]', '[FORM_NAME]' ), $form_data['form_name'], $email_body ); |
|
181 | + $email_body = str_replace( array( '[form_name]', '[FORM_NAME]' ), $form_data[ 'form_name' ], $email_body ); |
|
182 | 182 | |
183 | 183 | // We let the user use [fname] and [lname] so replace those. |
184 | - $email_body = str_replace( array( '[fname]', '[FNAME]' ), isset( $subscriber_account_details['merge_fields']['FNAME'] ) ? $subscriber_account_details['merge_fields']['FNAME'] : '', $email_body ); |
|
185 | - $email_body = str_replace( array( '[lname]', '[LNAME]' ), isset( $subscriber_account_details['merge_fields']['LNAME'] ) ? $subscriber_account_details['merge_fields']['LNAME'] : '', $email_body ); |
|
184 | + $email_body = str_replace( array( '[fname]', '[FNAME]' ), isset( $subscriber_account_details[ 'merge_fields' ][ 'FNAME' ] ) ? $subscriber_account_details[ 'merge_fields' ][ 'FNAME' ] : '', $email_body ); |
|
185 | + $email_body = str_replace( array( '[lname]', '[LNAME]' ), isset( $subscriber_account_details[ 'merge_fields' ][ 'LNAME' ] ) ? $subscriber_account_details[ 'merge_fields' ][ 'LNAME' ] : '', $email_body ); |
|
186 | 186 | |
187 | 187 | /* Confirm that the email was sent */ |
188 | 188 | if ( wp_mail( $user_email, apply_filters( 'yikes-mailchimp-update-email-subject', $email_subject ), apply_filters( 'yikes-mailchimp-update-email-content', $email_body, $update_link_href ), $headers ) ) { |
189 | 189 | |
190 | 190 | $update_email_success_message = apply_filters( 'yikes-mailchimp-update-email-success-message', $update_email_success_message, $form_id, $user_email ); |
191 | - $submission_settings = isset( $form_data['submission_settings'] ) ? $form_data['submission_settings'] : null; |
|
191 | + $submission_settings = isset( $form_data[ 'submission_settings' ] ) ? $form_data[ 'submission_settings' ] : null; |
|
192 | 192 | $redirect_settings = Yikes_Inc_Easy_Mailchimp_Extender_Process_Submission_Handler::handle_submission_response_success_redirect( $form_id, $submission_settings, $page_id ); |
193 | 193 | |
194 | 194 | wp_send_json_success( |
195 | 195 | array( |
196 | 196 | 'response_text' => '<div class="yikes-easy-mc-success-message">' . $update_email_success_message . '</div>', |
197 | - 'redirection' => $redirect_settings['redirection'], |
|
198 | - 'redirect' => $redirect_settings['redirect'], |
|
199 | - 'redirect_timer' => $redirect_settings['redirect_timer'], |
|
200 | - 'new_window' => $redirect_settings['new_window'], |
|
197 | + 'redirection' => $redirect_settings[ 'redirection' ], |
|
198 | + 'redirect' => $redirect_settings[ 'redirect' ], |
|
199 | + 'redirect_timer' => $redirect_settings[ 'redirect_timer' ], |
|
200 | + 'new_window' => $redirect_settings[ 'new_window' ], |
|
201 | 201 | ) |
202 | 202 | ); |
203 | 203 | } else { |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | |
47 | 47 | // Convert the integration type to a list ID. |
48 | 48 | $checkbox_options = get_option( 'optin-checkbox-init', '' ); |
49 | - if ( empty( $checkbox_options ) || ! isset( $checkbox_options[ $type ] ) || ! isset( $checkbox_options[ $type ]['associated-list'] ) ) { |
|
49 | + if ( empty( $checkbox_options ) || ! isset( $checkbox_options[ $type ] ) || ! isset( $checkbox_options[ $type ][ 'associated-list' ] ) ) { |
|
50 | 50 | return false; |
51 | 51 | } |
52 | 52 | |
53 | - $list_ids = $checkbox_options[ $type ]['associated-list']; |
|
53 | + $list_ids = $checkbox_options[ $type ][ 'associated-list' ]; |
|
54 | 54 | $list_ids = is_array( $list_ids ) ? $list_ids : array( $list_ids ); |
55 | 55 | |
56 | 56 | // Go through each list... |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $data = $response->get_error_data(); |
85 | 85 | |
86 | 86 | // If the error response is a 404, they are not subscribed. |
87 | - if ( isset( $data['status'] ) && 404 === (int) $data['status'] ) { |
|
87 | + if ( isset( $data[ 'status' ] ) && 404 === (int) $data[ 'status' ] ) { |
|
88 | 88 | return false; |
89 | 89 | } else { |
90 | 90 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | // Look at the status from the API. |
103 | - $subscribed = 'subscribed' === $response['status']; |
|
103 | + $subscribed = 'subscribed' === $response[ 'status' ]; |
|
104 | 104 | |
105 | 105 | return apply_filters( 'yikes-mailchimp-integration-is-user-subscribed', $subscribed, $type ); |
106 | 106 | } |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | |
115 | 115 | // Get our options. |
116 | 116 | $checkbox_options = get_option( 'optin-checkbox-init', array() ); |
117 | - $has_list_ids = isset( $checkbox_options[ $this->type ]['associated-list'] ) && '-' !== $checkbox_options[ $this->type ]['associated-list']; |
|
118 | - $has_list_ids = $has_list_ids && ! in_array( '-', $checkbox_options[ $this->type ]['associated-list'], true ); |
|
117 | + $has_list_ids = isset( $checkbox_options[ $this->type ][ 'associated-list' ] ) && '-' !== $checkbox_options[ $this->type ][ 'associated-list' ]; |
|
118 | + $has_list_ids = $has_list_ids && ! in_array( '-', $checkbox_options[ $this->type ][ 'associated-list' ], true ); |
|
119 | 119 | |
120 | 120 | if ( $has_list_ids ) { |
121 | - $label = isset( $checkbox_options[ $this->type ]['label'] ) && ! empty( $checkbox_options[ $this->type ]['label'] ) ? trim( $checkbox_options[ $this->type ]['label'] ) : __( 'Sign me up for your mailing list.', 'yikes-inc-easy-mailchimp-extender' ); |
|
122 | - $checked = 'true' === $checkbox_options[ $this->type ]['precheck'] ? 'checked="checked"' : ''; |
|
121 | + $label = isset( $checkbox_options[ $this->type ][ 'label' ] ) && ! empty( $checkbox_options[ $this->type ][ 'label' ] ) ? trim( $checkbox_options[ $this->type ][ 'label' ] ) : __( 'Sign me up for your mailing list.', 'yikes-inc-easy-mailchimp-extender' ); |
|
122 | + $checked = 'true' === $checkbox_options[ $this->type ][ 'precheck' ] ? 'checked="checked"' : ''; |
|
123 | 123 | $before = apply_filters( 'yikes-mailchimp-before-checkbox-html', '' ); |
124 | 124 | $content = '<p id="yikes-easy-mailchimp-' . esc_attr( $this->type ) . '-checkbox" class="yikes-easy-mailchimp-' . esc_attr( $this->type ) . '-checkbox">'; |
125 | 125 | $content .= '<label>'; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $options = get_option( 'optin-checkbox-init', '' ); |
150 | 150 | |
151 | 151 | // Make sure we have a list ID. |
152 | - if ( ! isset( $options[ $type ] ) || ! isset( $options[ $type ]['associated-list'] ) ) { |
|
152 | + if ( ! isset( $options[ $type ] ) || ! isset( $options[ $type ][ 'associated-list' ] ) ) { |
|
153 | 153 | // @todo: Throw some kind of error? |
154 | 154 | return; |
155 | 155 | } |
@@ -157,14 +157,14 @@ discard block |
||
157 | 157 | $email = sanitize_email( $email ); |
158 | 158 | |
159 | 159 | // Check for an IP address. |
160 | - $user_ip = sanitize_text_field( $_SERVER['REMOTE_ADDR'] ); |
|
161 | - if ( isset( $merge_vars['OPTIN_IP'] ) ) { |
|
162 | - $user_ip = sanitize_text_field( $merge_vars['OPTIN_IP'] ); |
|
160 | + $user_ip = sanitize_text_field( $_SERVER[ 'REMOTE_ADDR' ] ); |
|
161 | + if ( isset( $merge_vars[ 'OPTIN_IP' ] ) ) { |
|
162 | + $user_ip = sanitize_text_field( $merge_vars[ 'OPTIN_IP' ] ); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | // Build our request data. |
166 | - $list_ids = $options[ $type ]['associated-list']; |
|
167 | - $list_ids = is_array( $options[ $type ]['associated-list'] ) ? $options[ $type ]['associated-list'] : array( $options[ $type ]['associated-list'] ); |
|
166 | + $list_ids = $options[ $type ][ 'associated-list' ]; |
|
167 | + $list_ids = is_array( $options[ $type ][ 'associated-list' ] ) ? $options[ $type ][ 'associated-list' ] : array( $options[ $type ][ 'associated-list' ] ); |
|
168 | 168 | $id = md5( $email ); |
169 | 169 | $data = array( |
170 | 170 | 'email_address' => $email, |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | |
177 | 177 | foreach ( $list_ids as $list_id ) { |
178 | 178 | |
179 | - $interests = isset( $options[ $type ]['interest-groups'] ) ? $options[ $type ]['interest-groups'] : array(); |
|
179 | + $interests = isset( $options[ $type ][ 'interest-groups' ] ) ? $options[ $type ][ 'interest-groups' ] : array(); |
|
180 | 180 | $interests = isset( $interests[ $list_id ] ) ? $interests[ $list_id ] : $interests; |
181 | 181 | |
182 | 182 | // Only re-format and add interest groups if not empty. |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
195 | - $data['interests'] = $groups; |
|
195 | + $data[ 'interests' ] = $groups; |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | $list_id = apply_filters( 'yikes-mailchimp-checkbox-integration-list-id', $list_id, $data, $type, $integration_vars ); |
219 | 219 | |
220 | 220 | // Don't send an empty merge fields array. |
221 | - if ( empty( $data['merge_fields'] ) ) { |
|
222 | - unset( $data['merge_fields'] ); |
|
221 | + if ( empty( $data[ 'merge_fields' ] ) ) { |
|
222 | + unset( $data[ 'merge_fields' ] ); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | // Subscribe the user to the list via the API. |
@@ -249,10 +249,10 @@ discard block |
||
249 | 249 | $merge_vars = array(); |
250 | 250 | |
251 | 251 | if ( ! empty( $user->first_name ) ) { |
252 | - $merge_vars['FNAME'] = $user->first_name; |
|
252 | + $merge_vars[ 'FNAME' ] = $user->first_name; |
|
253 | 253 | } |
254 | 254 | if ( ! empty( $user->last_name ) ) { |
255 | - $merge_vars['LNAME'] = $user->last_name; |
|
255 | + $merge_vars[ 'LNAME' ] = $user->last_name; |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | /** |
10 | 10 | * Main Checkbox Integration class. |
11 | 11 | */ |
12 | -class Yikes_Easy_MC_Checkbox_Integration_Class { |
|
12 | +class Yikes_Easy_MC_Checkbox_Integration_Class { |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * The integration type. |
@@ -28,10 +28,10 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return bool Whether the current user is subscribed to a list. |
30 | 30 | */ |
31 | - public function is_user_already_subscribed( $type, $email = '' ) { |
|
31 | + public function is_user_already_subscribed( $type, $email = '' ) { |
|
32 | 32 | // Make sure we have an email address to use. |
33 | - if ( empty( $email ) ) { |
|
34 | - if ( ! is_user_logged_in() ) { |
|
33 | + if ( empty( $email ) ) { |
|
34 | + if ( ! is_user_logged_in() ) { |
|
35 | 35 | return false; |
36 | 36 | } |
37 | 37 | |
@@ -40,13 +40,13 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | // Ensure we have a valid email. |
43 | - if ( ! is_email( $email ) ) { |
|
43 | + if ( ! is_email( $email ) ) { |
|
44 | 44 | return false; |
45 | 45 | } |
46 | 46 | |
47 | 47 | // Convert the integration type to a list ID. |
48 | 48 | $checkbox_options = get_option( 'optin-checkbox-init', '' ); |
49 | - if ( empty( $checkbox_options ) || ! isset( $checkbox_options[ $type ] ) || ! isset( $checkbox_options[ $type ]['associated-list'] ) ) { |
|
49 | + if ( empty( $checkbox_options ) || ! isset( $checkbox_options[ $type ] ) || ! isset( $checkbox_options[ $type ]['associated-list'] ) ) { |
|
50 | 50 | return false; |
51 | 51 | } |
52 | 52 | |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | $list_ids = is_array( $list_ids ) ? $list_ids : array( $list_ids ); |
55 | 55 | |
56 | 56 | // Go through each list... |
57 | - foreach ( $list_ids as $list_id ) { |
|
58 | - if ( ! $this->is_user_subscribed( $email, $list_id, $type ) ) { |
|
57 | + foreach ( $list_ids as $list_id ) { |
|
58 | + if ( ! $this->is_user_subscribed( $email, $list_id, $type ) ) { |
|
59 | 59 | return false; |
60 | 60 | } |
61 | 61 | } |
@@ -74,19 +74,19 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @return bool Whether the email is subscribed to the list. |
76 | 76 | */ |
77 | - public function is_user_subscribed( $email, $list_id, $type ) { |
|
77 | + public function is_user_subscribed( $email, $list_id, $type ) { |
|
78 | 78 | $email = sanitize_email( $email ); |
79 | 79 | $email_hash = md5( $email ); |
80 | 80 | |
81 | 81 | // Check the API to see the status. |
82 | 82 | $response = yikes_get_mc_api_manager()->get_list_handler()->get_member( $list_id, $email_hash, false ); |
83 | - if ( is_wp_error( $response ) ) { |
|
83 | + if ( is_wp_error( $response ) ) { |
|
84 | 84 | $data = $response->get_error_data(); |
85 | 85 | |
86 | 86 | // If the error response is a 404, they are not subscribed. |
87 | - if ( isset( $data['status'] ) && 404 === (int) $data['status'] ) { |
|
87 | + if ( isset( $data['status'] ) && 404 === (int) $data['status'] ) { |
|
88 | 88 | return false; |
89 | - } else { |
|
89 | + } else { |
|
90 | 90 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
91 | 91 | $error_logging->maybe_write_to_log( |
92 | 92 | $response->get_error_code(), |
@@ -110,14 +110,14 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return string The HTML for the checkbox. |
112 | 112 | */ |
113 | - public function yikes_get_checkbox() { |
|
113 | + public function yikes_get_checkbox() { |
|
114 | 114 | |
115 | 115 | // Get our options. |
116 | 116 | $checkbox_options = get_option( 'optin-checkbox-init', array() ); |
117 | 117 | $has_list_ids = isset( $checkbox_options[ $this->type ]['associated-list'] ) && '-' !== $checkbox_options[ $this->type ]['associated-list']; |
118 | 118 | $has_list_ids = $has_list_ids && ! in_array( '-', $checkbox_options[ $this->type ]['associated-list'], true ); |
119 | 119 | |
120 | - if ( $has_list_ids ) { |
|
120 | + if ( $has_list_ids ) { |
|
121 | 121 | $label = isset( $checkbox_options[ $this->type ]['label'] ) && ! empty( $checkbox_options[ $this->type ]['label'] ) ? trim( $checkbox_options[ $this->type ]['label'] ) : __( 'Sign me up for your mailing list.', 'yikes-inc-easy-mailchimp-extender' ); |
122 | 122 | $checked = 'true' === $checkbox_options[ $this->type ]['precheck'] ? 'checked="checked"' : ''; |
123 | 123 | $before = apply_filters( 'yikes-mailchimp-before-checkbox-html', '' ); |
@@ -145,11 +145,11 @@ discard block |
||
145 | 145 | * @param array $merge_vars The array of form data to send. |
146 | 146 | * @param array $integration_vars An array of additional information that can be used to filter the subscribe request. |
147 | 147 | */ |
148 | - public function subscribe_user_integration( $email, $type, $merge_vars, $integration_vars = array() ) { |
|
148 | + public function subscribe_user_integration( $email, $type, $merge_vars, $integration_vars = array() ) { |
|
149 | 149 | $options = get_option( 'optin-checkbox-init', '' ); |
150 | 150 | |
151 | 151 | // Make sure we have a list ID. |
152 | - if ( ! isset( $options[ $type ] ) || ! isset( $options[ $type ]['associated-list'] ) ) { |
|
152 | + if ( ! isset( $options[ $type ] ) || ! isset( $options[ $type ]['associated-list'] ) ) { |
|
153 | 153 | // @todo: Throw some kind of error? |
154 | 154 | return; |
155 | 155 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | // Check for an IP address. |
160 | 160 | $user_ip = sanitize_text_field( $_SERVER['REMOTE_ADDR'] ); |
161 | - if ( isset( $merge_vars['OPTIN_IP'] ) ) { |
|
161 | + if ( isset( $merge_vars['OPTIN_IP'] ) ) { |
|
162 | 162 | $user_ip = sanitize_text_field( $merge_vars['OPTIN_IP'] ); |
163 | 163 | } |
164 | 164 | |
@@ -174,19 +174,19 @@ discard block |
||
174 | 174 | 'ip_signup' => $user_ip, |
175 | 175 | ); |
176 | 176 | |
177 | - foreach ( $list_ids as $list_id ) { |
|
177 | + foreach ( $list_ids as $list_id ) { |
|
178 | 178 | |
179 | 179 | $interests = isset( $options[ $type ]['interest-groups'] ) ? $options[ $type ]['interest-groups'] : array(); |
180 | 180 | $interests = isset( $interests[ $list_id ] ) ? $interests[ $list_id ] : $interests; |
181 | 181 | |
182 | 182 | // Only re-format and add interest groups if not empty. |
183 | - if ( ! empty( $interests ) ) { |
|
183 | + if ( ! empty( $interests ) ) { |
|
184 | 184 | $groups = array(); |
185 | 185 | |
186 | 186 | // Need to reformat interest groups array as $interest_group_ID => true. |
187 | - foreach ( $interests as $interest ) { |
|
188 | - if ( is_array( $interest ) ) { |
|
189 | - foreach ( $interest as $group_id ) { |
|
187 | + foreach ( $interests as $interest ) { |
|
188 | + if ( is_array( $interest ) ) { |
|
189 | + foreach ( $interest as $group_id ) { |
|
190 | 190 | $groups[ $group_id ] = true; |
191 | 191 | } |
192 | 192 | } |
@@ -218,14 +218,14 @@ discard block |
||
218 | 218 | $list_id = apply_filters( 'yikes-mailchimp-checkbox-integration-list-id', $list_id, $data, $type, $integration_vars ); |
219 | 219 | |
220 | 220 | // Don't send an empty merge fields array. |
221 | - if ( empty( $data['merge_fields'] ) ) { |
|
221 | + if ( empty( $data['merge_fields'] ) ) { |
|
222 | 222 | unset( $data['merge_fields'] ); |
223 | 223 | } |
224 | 224 | |
225 | 225 | // Subscribe the user to the list via the API. |
226 | 226 | $response = yikes_get_mc_api_manager()->get_list_handler()->member_subscribe( $list_id, $id, $data ); |
227 | 227 | |
228 | - if ( is_wp_error( $response ) ) { |
|
228 | + if ( is_wp_error( $response ) ) { |
|
229 | 229 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
230 | 230 | $error_logging->maybe_write_to_log( |
231 | 231 | $response->get_error_code(), |
@@ -243,15 +243,15 @@ discard block |
||
243 | 243 | * |
244 | 244 | * @param WP_User $user A WP User. |
245 | 245 | */ |
246 | - public function user_merge_vars( WP_User $user ) { |
|
246 | + public function user_merge_vars( WP_User $user ) { |
|
247 | 247 | |
248 | 248 | // Setup our array. |
249 | 249 | $merge_vars = array(); |
250 | 250 | |
251 | - if ( ! empty( $user->first_name ) ) { |
|
251 | + if ( ! empty( $user->first_name ) ) { |
|
252 | 252 | $merge_vars['FNAME'] = $user->first_name; |
253 | 253 | } |
254 | - if ( ! empty( $user->last_name ) ) { |
|
254 | + if ( ! empty( $user->last_name ) ) { |
|
255 | 255 | $merge_vars['LNAME'] = $user->last_name; |
256 | 256 | } |
257 | 257 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | * |
276 | 276 | * @return bool True if the checkbox was checked. |
277 | 277 | */ |
278 | - public function was_checkbox_checked( $type ) { |
|
278 | + public function was_checkbox_checked( $type ) { |
|
279 | 279 | return isset( $_POST[ 'yikes_mailchimp_checkbox_' . $type ] ) && '1' === filter_var( $_POST[ 'yikes_mailchimp_checkbox_' . $type ], FILTER_SANITIZE_STRING ); |
280 | 280 | } |
281 | 281 | } |