@@ -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>YIKES Easy Forms for MailChimp | <?php _e( 'Manage Forms' , 'yikes-inc-easy-mailchimp-extender' ) ?></h1> |
|
28 | + <h1>YIKES 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 opt-in forms on the following page. Select a form to make edits to it.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
31 | + <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Create and manage your MailChimp opt-in forms on the following page. Select a form to make edits to it.', '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( $form['submissions'] / $form['impressions'] , 2 ) * 100 ); |
|
189 | - if( $conversion_rate >= '%15' ) { |
|
187 | + if ( $impressions != 0 ) { |
|
188 | + $conversion_rate = '%' . ( round( $form[ 'submissions' ] / $form[ 'impressions' ], 2 ) * 100 ); |
|
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> |
@@ -17,16 +17,16 @@ discard block |
||
17 | 17 | ?> |
18 | 18 | <div class="wrap"> |
19 | 19 | <!-- Freddie Logo --> |
20 | - <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" /> |
|
20 | + <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" /> |
|
21 | 21 | |
22 | - <h1>YIKES Easy Forms for MailChimp | <?php _e( 'Manage Mailing Lists' , 'yikes-inc-easy-mailchimp-extender' ); ?></h1> |
|
22 | + <h1>YIKES Easy Forms for MailChimp | <?php _e( 'Manage Mailing Lists', 'yikes-inc-easy-mailchimp-extender' ); ?></h1> |
|
23 | 23 | |
24 | 24 | <!-- Settings Page Description --> |
25 | - <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Make edits to your MailChimp lists on the following page. Select a list to make edits to it.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
25 | + <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Make edits to your MailChimp lists on the following page. Select a list to make edits to it.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
26 | 26 | |
27 | 27 | <?php |
28 | 28 | /* If the user hasn't authenticated yet, lets kill off */ |
29 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) != 'valid_api_key' ) { |
|
29 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'valid_api_key' ) { |
|
30 | 30 | |
31 | 31 | $error_string = sprintf( |
32 | 32 | 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' ), |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | <!-- TABLE HEAD --> |
63 | 63 | <thead> |
64 | 64 | <tr> |
65 | - <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'List Name' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
66 | - <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Subscriber Count' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
65 | + <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'List Name', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
66 | + <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Subscriber Count', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
67 | 67 | </tr> |
68 | 68 | </thead> |
69 | 69 | <!-- end header --> |
@@ -71,25 +71,25 @@ discard block |
||
71 | 71 | <!-- FOOTER --> |
72 | 72 | <tfoot> |
73 | 73 | <tr> |
74 | - <th class="manage-column column-columnname" scope="col"><?php _e( 'List Name' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
75 | - <th class="manage-column column-columnname num" scope="col"><?php _e( 'Subscriber Count' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
74 | + <th class="manage-column column-columnname" scope="col"><?php _e( 'List Name', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
75 | + <th class="manage-column column-columnname num" scope="col"><?php _e( 'Subscriber Count', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
76 | 76 | </tr> |
77 | 77 | </tfoot> |
78 | 78 | <!-- end footer --> |
79 | 79 | |
80 | 80 | <!-- TABLE BODY --> |
81 | 81 | <tbody> |
82 | - <?php if( count( $list_data ) > 0 ) { |
|
82 | + <?php if ( count( $list_data ) > 0 ) { |
|
83 | 83 | $i = 1; |
84 | - foreach( $list_data as $list ) { |
|
84 | + foreach ( $list_data as $list ) { |
|
85 | 85 | ?> |
86 | - <tr class="<?php if( $i % 2 == 0 ) { echo 'alternate'; } ?>"> |
|
86 | + <tr class="<?php if ( $i % 2 == 0 ) { echo 'alternate'; } ?>"> |
|
87 | 87 | <td class="column-columnname"> |
88 | - <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"> |
|
89 | - <?php echo stripslashes( $list['name'] ); ?> |
|
88 | + <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"> |
|
89 | + <?php echo stripslashes( $list[ 'name' ] ); ?> |
|
90 | 90 | </a> |
91 | 91 | <div class="row-actions"> |
92 | - <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> |
|
92 | + <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> |
|
93 | 93 | <?php |
94 | 94 | /* |
95 | 95 | * Custom action to allow users to add additional action links |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | ?> |
100 | 100 | </div> |
101 | 101 | </td> |
102 | - <td class="column-columnname num"><?php echo $list['stats']['member_count']; ?></td> |
|
102 | + <td class="column-columnname num"><?php echo $list[ 'stats' ][ 'member_count' ]; ?></td> |
|
103 | 103 | </tr> |
104 | 104 | <?php |
105 | 105 | $i++; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } else { |
108 | 108 | ?> |
109 | 109 | <tr class="no-items"> |
110 | - <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> |
|
110 | + <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> |
|
111 | 111 | </tr> |
112 | 112 | <?php } ?> |
113 | 113 | </tbody> |
@@ -2,36 +2,36 @@ |
||
2 | 2 | /* The template file for displaying our stats in the Admin dashboard widget */ |
3 | 3 | ?> |
4 | 4 | <section id="yikes-easy-mc-widget-stat-holder"> |
5 | - <h3><?php echo $list_data['lists'][0]['name']; ?> <small><a href="<?php echo esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-view-list&list-id=' . $list_data['lists'][0]['id'] . '' ) ); ?>" title="<?php _e( 'view List' , 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'view list' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></h3> |
|
5 | + <h3><?php echo $list_data[ 'lists' ][ 0 ][ 'name' ]; ?> <small><a href="<?php echo esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-view-list&list-id=' . $list_data[ 'lists' ][ 0 ][ 'id' ] . '' ) ); ?>" title="<?php _e( 'view List', 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'view list', 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></h3> |
|
6 | 6 | |
7 | 7 | <table class="yikes-easy-mc-stats-table"> |
8 | 8 | <thead class="yikes-easy-mc-hidden"> |
9 | 9 | <tr> |
10 | - <th><?php _e( 'Subscribers' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
11 | - <th><?php _e( 'Unsubscribed' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
12 | - <th><?php _e( 'New Since Send' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
13 | - <th><?php _e( 'Avg. Sub. Rate' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
10 | + <th><?php _e( 'Subscribers', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
11 | + <th><?php _e( 'Unsubscribed', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
12 | + <th><?php _e( 'New Since Send', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
13 | + <th><?php _e( 'Avg. Sub. Rate', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
14 | 14 | </tr> |
15 | 15 | </thead> |
16 | 16 | <tbody> |
17 | 17 | <tr class="yikes-easy-mc-table-stats-tr yikes-easy-mc-table-stats-tr-first"> |
18 | - <td title="<?php _e( 'Number of active subscribers.' , 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
19 | - <p class="yikes-easy-mc-dashboard-stat"><?php echo $list_data['lists'][0]['stats']['member_count']; ?></p> |
|
20 | - <p class="yikes-easy-mc-stat-list-label"><?php _e( 'subscribers' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
18 | + <td title="<?php _e( 'Number of active subscribers.', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
19 | + <p class="yikes-easy-mc-dashboard-stat"><?php echo $list_data[ 'lists' ][ 0 ][ 'stats' ][ 'member_count' ]; ?></p> |
|
20 | + <p class="yikes-easy-mc-stat-list-label"><?php _e( 'subscribers', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
21 | 21 | </td> |
22 | - <td title="<?php _e( 'Number of users who have unsusbscribed.' , 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
23 | - <p class="yikes-easy-mc-dashboard-stat"><?php echo $list_data['lists'][0]['stats']['unsubscribe_count']; ?></p> |
|
24 | - <p class="yikes-easy-mc-stat-list-label"><?php _e( 'unsubscribed' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
22 | + <td title="<?php _e( 'Number of users who have unsusbscribed.', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
23 | + <p class="yikes-easy-mc-dashboard-stat"><?php echo $list_data[ 'lists' ][ 0 ][ 'stats' ][ 'unsubscribe_count' ]; ?></p> |
|
24 | + <p class="yikes-easy-mc-stat-list-label"><?php _e( 'unsubscribed', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
25 | 25 | </td> |
26 | 26 | </tr> |
27 | 27 | <tr class="yikes-easy-mc-table-stats-tr yikes-easy-mc-table-stats-tr-second"> |
28 | - <td title="<?php _e( 'Number of new subscribers since the last campaign was sent.' , 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
29 | - <p class="yikes-easy-mc-dashboard-stat"><?php echo $list_data['lists'][0]['stats']['member_count_since_send']; ?></p> |
|
30 | - <p class="yikes-easy-mc-stat-list-label"><?php _e( 'new since send' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
28 | + <td title="<?php _e( 'Number of new subscribers since the last campaign was sent.', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
29 | + <p class="yikes-easy-mc-dashboard-stat"><?php echo $list_data[ 'lists' ][ 0 ][ 'stats' ][ 'member_count_since_send' ]; ?></p> |
|
30 | + <p class="yikes-easy-mc-stat-list-label"><?php _e( 'new since send', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
31 | 31 | </td> |
32 | - <td title="<?php _e( 'Average number of subscribers per month.' , 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
33 | - <p class="yikes-easy-mc-dashboard-stat"><?php echo $list_data['lists'][0]['stats']['avg_sub_rate']; ?></p> |
|
34 | - <p class="yikes-easy-mc-stat-list-label"><?php _e( 'avg. sub. rate' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
32 | + <td title="<?php _e( 'Average number of subscribers per month.', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
33 | + <p class="yikes-easy-mc-dashboard-stat"><?php echo $list_data[ 'lists' ][ 0 ][ 'stats' ][ 'avg_sub_rate' ]; ?></p> |
|
34 | + <p class="yikes-easy-mc-stat-list-label"><?php _e( 'avg. sub. rate', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
35 | 35 | </td> |
36 | 36 | </tr> |
37 | 37 | </tbody> |
@@ -48,14 +48,14 @@ discard block |
||
48 | 48 | if ( current_user_can( apply_filters( 'yikes-mailchimp-admin-widget-capability', apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) ) { |
49 | 49 | /* List Stats Dashboard Widget */ |
50 | 50 | wp_add_dashboard_widget( |
51 | - 'yikes_easy_mc_list_stats_widget', // Widget slug. |
|
52 | - __( 'MailChimp List Stats', 'yikes-inc-easy-mailchimp-extender' ), // Title. |
|
51 | + 'yikes_easy_mc_list_stats_widget', // Widget slug. |
|
52 | + __( 'MailChimp List Stats', 'yikes-inc-easy-mailchimp-extender' ), // Title. |
|
53 | 53 | array( $this, 'list_stats_dashboard_widget' ) // Display function. |
54 | 54 | ); |
55 | 55 | /* Chimp Chatter Dashboard Widget */ |
56 | 56 | wp_add_dashboard_widget( |
57 | - 'yikes_easy_mc_account_activity_widget', // Widget slug. |
|
58 | - __( 'MailChimp Account Activity', 'yikes-inc-easy-mailchimp-extender' ), // Title. |
|
57 | + 'yikes_easy_mc_account_activity_widget', // Widget slug. |
|
58 | + __( 'MailChimp Account Activity', 'yikes-inc-easy-mailchimp-extender' ), // Title. |
|
59 | 59 | array( $this, 'account_activity_dashboard_widget' ) // Display function. |
60 | 60 | ); |
61 | 61 | } |
@@ -67,22 +67,22 @@ discard block |
||
67 | 67 | function list_stats_dashboard_widget() { |
68 | 68 | // Get our list data! |
69 | 69 | $list_data = yikes_get_mc_api_manager()->get_list_handler()->get_lists(); |
70 | - if ( isset( $list_data['error'] ) ) { |
|
70 | + if ( isset( $list_data[ 'error' ] ) ) { |
|
71 | 71 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
72 | - $error_logging->maybe_write_to_log( $list_data['error'], __( "Get Account Lists", 'yikes-inc-easy-mailchimp-extender' ), "Dashboard Activity Widget" ); |
|
72 | + $error_logging->maybe_write_to_log( $list_data[ 'error' ], __( "Get Account Lists", 'yikes-inc-easy-mailchimp-extender' ), "Dashboard Activity Widget" ); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | ?> |
76 | 76 | <!-- Dropdown to Change the list --> |
77 | - <?php if ( ! empty( $list_data['lists'] ) ) { |
|
77 | + <?php if ( ! empty( $list_data[ 'lists' ] ) ) { |
|
78 | 78 | ?> |
79 | 79 | <section class="inside-widget yikes-dashboard-widget-section"> |
80 | 80 | <strong class="select-list-title"><?php _e( 'Select a list', 'yikes-inc-easy-mailchimp-extender' ) ?>:</strong> |
81 | 81 | <select id="yikes-easy-mc-dashboard-change-list" class="widefat"> |
82 | 82 | <?php |
83 | - foreach ( $list_data['lists'] as $list ) { |
|
83 | + foreach ( $list_data[ 'lists' ] as $list ) { |
|
84 | 84 | ?> |
85 | - <option value="<?php echo $list['id']; ?>"><?php echo $list['name']; ?></option> |
|
85 | + <option value="<?php echo $list[ 'id' ]; ?>"><?php echo $list[ 'name' ]; ?></option> |
|
86 | 86 | <?php |
87 | 87 | } |
88 | 88 | ?> |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | /***********************/ |
105 | 105 | /** Create A Form **/ |
106 | 106 | /**********************/ |
107 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-create-form' ) { |
|
107 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-create-form' ) { |
|
108 | 108 | |
109 | 109 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_create_form' ) ); |
110 | 110 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | /***********************/ |
114 | 114 | /** Delete A Form **/ |
115 | 115 | /**********************/ |
116 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-delete-form' ) { |
|
116 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-delete-form' ) { |
|
117 | 117 | |
118 | 118 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_delete_form' ) ); |
119 | 119 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | /**********************************/ |
123 | 123 | /** Duplicate/Clone A Form **/ |
124 | 124 | /********************************/ |
125 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-duplicate-form' ) { |
|
125 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-duplicate-form' ) { |
|
126 | 126 | |
127 | 127 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_duplicate_form' ) ); |
128 | 128 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | /*************************************/ |
132 | 132 | /** Reset Form Impression Stats **/ |
133 | 133 | /***********************************/ |
134 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-reset-stats' ) { |
|
134 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-reset-stats' ) { |
|
135 | 135 | |
136 | 136 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_reset_impression_stats' ) ); |
137 | 137 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | /**********************************/ |
141 | 141 | /** Update A Form **/ |
142 | 142 | /********************************/ |
143 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-update-form' ) { |
|
143 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-update-form' ) { |
|
144 | 144 | |
145 | 145 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_update_form' ) ); |
146 | 146 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | /**************************************************/ |
150 | 150 | /** Clear Store MailChimp Transient Data **/ |
151 | 151 | /*************************************************/ |
152 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-clear-transient-data' ) { |
|
152 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-clear-transient-data' ) { |
|
153 | 153 | |
154 | 154 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_clear_transient_data' ) ); |
155 | 155 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | /*******************************************/ |
159 | 159 | /** Remove a user from a mailing list **/ |
160 | 160 | /*****************************************/ |
161 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-unsubscribe-user' ) { |
|
161 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-unsubscribe-user' ) { |
|
162 | 162 | |
163 | 163 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_unsubscribe_user' ) ); |
164 | 164 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | /*******************************************/ |
168 | 168 | /** Create misisng error log file **/ |
169 | 169 | /*****************************************/ |
170 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-create-error-log' ) { |
|
170 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-create-error-log' ) { |
|
171 | 171 | |
172 | 172 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_create_missing_error_log' ) ); |
173 | 173 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | /**************************************************/ |
200 | 200 | /** Clear MailChimp Error Log Data **/ |
201 | 201 | /*************************************************/ |
202 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-clear-error-log' ) { |
|
202 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-clear-error-log' ) { |
|
203 | 203 | |
204 | 204 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_clear_error_log' ) ); |
205 | 205 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | /*********************************************/ |
209 | 209 | /** Export MailChimp Opt-in Forms **/ |
210 | 210 | /*******************************************/ |
211 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-export-forms' ) { |
|
211 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-export-forms' ) { |
|
212 | 212 | |
213 | 213 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_export_forms' ) ); |
214 | 214 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | /*********************************************/ |
218 | 218 | /** Export Plugin Settings **/ |
219 | 219 | /*******************************************/ |
220 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-export-settings' ) { |
|
220 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-export-settings' ) { |
|
221 | 221 | |
222 | 222 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_export_plugin_settings' ) ); |
223 | 223 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | /*******************************************/ |
227 | 227 | /** Import Class Inclusion **/ |
228 | 228 | /*****************************************/ |
229 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-import-forms' ) { |
|
229 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-import-forms' ) { |
|
230 | 230 | |
231 | 231 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_import_forms' ) ); |
232 | 232 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | /*******************************************/ |
236 | 236 | /** Premium Support Request **/ |
237 | 237 | /*****************************************/ |
238 | - if ( isset( $_POST['submit-premium-support-request'] ) ) { |
|
238 | + if ( isset( $_POST[ 'submit-premium-support-request' ] ) ) { |
|
239 | 239 | |
240 | 240 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_premium_support_request' ) ); |
241 | 241 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | /****************************************/ |
245 | 245 | /** Dismiss Options Migrations **/ |
246 | 246 | /****************************************/ |
247 | - if ( isset( $_REQUEST['dismiss_migration_nonce'] ) ) { |
|
247 | + if ( isset( $_REQUEST[ 'dismiss_migration_nonce' ] ) ) { |
|
248 | 248 | |
249 | 249 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_dismiss_option_migrate' ) ); |
250 | 250 | |
@@ -280,8 +280,8 @@ discard block |
||
280 | 280 | * @ return array $links New array of plugin actions |
281 | 281 | */ |
282 | 282 | public function easy_forms_plugin_action_links( $links ) { |
283 | - $links[] = '<a href="'. esc_url( get_admin_url(null, 'admin.php?page=yikes-inc-easy-mailchimp-settings') ) .'">' . __( 'Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
284 | - $links[] = '<a href="' . esc_url( 'http://www.yikesplugins.com?utm_source=plugins-page&utm_medium=plugin-row&utm_campaign=admin' ) . '" target="_blank">' . __( 'More plugins by YIKES' , 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
283 | + $links[ ] = '<a href="' . esc_url( get_admin_url( null, 'admin.php?page=yikes-inc-easy-mailchimp-settings' ) ) . '">' . __( 'Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
284 | + $links[ ] = '<a href="' . esc_url( 'http://www.yikesplugins.com?utm_source=plugins-page&utm_medium=plugin-row&utm_campaign=admin' ) . '" target="_blank">' . __( 'More plugins by YIKES', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
285 | 285 | return $links; |
286 | 286 | } |
287 | 287 | |
@@ -314,29 +314,29 @@ discard block |
||
314 | 314 | * @return parsed tag content |
315 | 315 | */ |
316 | 316 | public function parse_mailchimp_default_tag( $default_tag ) { |
317 | - if( ! $default_tag || $default_tag == '' ) { |
|
317 | + if ( ! $default_tag || $default_tag == '' ) { |
|
318 | 318 | return $default_tag; |
319 | 319 | } |
320 | 320 | global $post; |
321 | 321 | // page title |
322 | - if( $default_tag == '{page_title}' ) { |
|
322 | + if ( $default_tag == '{page_title}' ) { |
|
323 | 323 | $default_tag = get_the_title( $post->ID ); |
324 | 324 | } |
325 | 325 | // page id |
326 | - if( $default_tag == '{page_title}' ) { |
|
326 | + if ( $default_tag == '{page_title}' ) { |
|
327 | 327 | $default_tag = $post->ID; |
328 | 328 | } |
329 | 329 | // page url |
330 | - if( $default_tag == '{page_url}' ) { |
|
330 | + if ( $default_tag == '{page_url}' ) { |
|
331 | 331 | $default_tag = get_permalink( $post->ID ); |
332 | 332 | } |
333 | 333 | // blog name |
334 | - if( $default_tag == '{blog_name}' ) { |
|
334 | + if ( $default_tag == '{blog_name}' ) { |
|
335 | 335 | $default_tag = get_bloginfo( 'name' ); |
336 | 336 | } |
337 | 337 | // is user logged in |
338 | - if( $default_tag == '{user_logged_in}' ) { |
|
339 | - if( is_user_logged_in() ) { |
|
338 | + if ( $default_tag == '{user_logged_in}' ) { |
|
339 | + if ( is_user_logged_in() ) { |
|
340 | 340 | $default_tag = 'Registered User'; |
341 | 341 | } else { |
342 | 342 | $default_tag = 'Guest User'; |
@@ -354,12 +354,12 @@ discard block |
||
354 | 354 | */ |
355 | 355 | public function yikes_easy_mailchimp_clear_error_log() { |
356 | 356 | // file put contents $returned error + other data |
357 | - if( file_exists( YIKES_MC_PATH . 'includes/error_log/yikes-easy-mailchimp-error-log.php' ) ) { |
|
357 | + if ( file_exists( YIKES_MC_PATH . 'includes/error_log/yikes-easy-mailchimp-error-log.php' ) ) { |
|
358 | 358 | $clear_log = file_put_contents( |
359 | 359 | YIKES_MC_PATH . 'includes/error_log/yikes-easy-mailchimp-error-log.php', |
360 | 360 | '' |
361 | 361 | ); |
362 | - if( $clear_log === false ) { |
|
362 | + if ( $clear_log === false ) { |
|
363 | 363 | // redirect the user to the manage forms page, display error message |
364 | 364 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings&error-log-cleared=false' ) ) ); |
365 | 365 | } else { |
@@ -377,17 +377,17 @@ discard block |
||
377 | 377 | */ |
378 | 378 | public function yikes_easy_mailchimp_export_forms() { |
379 | 379 | // grab our nonce |
380 | - $nonce = $_REQUEST['nonce']; |
|
380 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
381 | 381 | // grab the forms |
382 | - $forms = isset( $_REQUEST['export_forms'] ) ? $_REQUEST['export_forms'] : array(); |
|
382 | + $forms = isset( $_REQUEST[ 'export_forms' ] ) ? $_REQUEST[ 'export_forms' ] : array(); |
|
383 | 383 | // validate nonce |
384 | - if( ! wp_verify_nonce( $nonce, 'export-forms' ) ) { |
|
385 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
384 | + if ( ! wp_verify_nonce( $nonce, 'export-forms' ) ) { |
|
385 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | // run the export function |
389 | 389 | // parameters: ( $table_name, $form_ids, $file_name ) |
390 | - Yikes_Inc_Easy_MailChimp_Export_Class::yikes_mailchimp_form_export('Yikes-Inc-Easy-MailChimp-Forms-Export', $forms ); |
|
390 | + Yikes_Inc_Easy_MailChimp_Export_Class::yikes_mailchimp_form_export( 'Yikes-Inc-Easy-MailChimp-Forms-Export', $forms ); |
|
391 | 391 | // re-direct the user back to the page |
392 | 392 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=import-export-forms' ) ) ); |
393 | 393 | die(); |
@@ -401,10 +401,10 @@ discard block |
||
401 | 401 | */ |
402 | 402 | public function yikes_easy_mailchimp_export_plugin_settings() { |
403 | 403 | // grab our nonce |
404 | - $nonce = $_REQUEST['nonce']; |
|
404 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
405 | 405 | // validate nonce |
406 | - if( ! wp_verify_nonce( $nonce, 'export-settings' ) ) { |
|
407 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
406 | + if ( ! wp_verify_nonce( $nonce, 'export-settings' ) ) { |
|
407 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
408 | 408 | } |
409 | 409 | |
410 | 410 | // run the export function |
@@ -421,13 +421,13 @@ discard block |
||
421 | 421 | */ |
422 | 422 | public function yikes_easy_mailchimp_import_forms() { |
423 | 423 | // grab our nonce |
424 | - $nonce = $_REQUEST['nonce']; |
|
424 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
425 | 425 | // validate nonce |
426 | - if( ! wp_verify_nonce( $nonce, 'import-forms' ) ) { |
|
427 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
426 | + if ( ! wp_verify_nonce( $nonce, 'import-forms' ) ) { |
|
427 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
428 | 428 | } |
429 | 429 | // include the export class |
430 | - if( ! class_exists( 'Yikes_Inc_Easy_MailChimp_Import_Class' ) ) { |
|
430 | + if ( ! class_exists( 'Yikes_Inc_Easy_MailChimp_Import_Class' ) ) { |
|
431 | 431 | include_once( YIKES_MC_PATH . 'includes/import-export/yikes-easy-mailchimp-import.class.php' ); |
432 | 432 | } |
433 | 433 | // run the import function |
@@ -445,15 +445,15 @@ discard block |
||
445 | 445 | */ |
446 | 446 | public function yikes_easy_mailchimp_premium_support_request() { |
447 | 447 | |
448 | - if( isset( $_POST['action'] ) && $_POST['action'] != 'yikes-support-request' ) { |
|
449 | - return __( 'We encountered an error. Please contact the YIKES Inc. support team.' , 'yikes-inc-easy-mailchimp-extender' ); |
|
448 | + if ( isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] != 'yikes-support-request' ) { |
|
449 | + return __( 'We encountered an error. Please contact the YIKES Inc. support team.', 'yikes-inc-easy-mailchimp-extender' ); |
|
450 | 450 | } |
451 | 451 | |
452 | - $license = $_POST['license_key']; |
|
453 | - $user_email = $_POST['user-email']; |
|
454 | - $support_topic = $_POST['support-topic']; |
|
455 | - $support_priority = $_POST['support-priority']; |
|
456 | - $support_content = $_POST['support-content']; |
|
452 | + $license = $_POST[ 'license_key' ]; |
|
453 | + $user_email = $_POST[ 'user-email' ]; |
|
454 | + $support_topic = $_POST[ 'support-topic' ]; |
|
455 | + $support_priority = $_POST[ 'support-priority' ]; |
|
456 | + $support_content = $_POST[ 'support-content' ]; |
|
457 | 457 | |
458 | 458 | // wp_die( print_r( $support_content) ); |
459 | 459 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | ) ); |
478 | 478 | |
479 | 479 | // catch the error |
480 | - if( is_wp_error( $response ) ) { |
|
480 | + if ( is_wp_error( $response ) ) { |
|
481 | 481 | wp_die( $response->getMessage() ); |
482 | 482 | return; |
483 | 483 | } |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | $create_ticket_response = wp_remote_retrieve_body( $response ); |
487 | 487 | |
488 | 488 | // display it |
489 | - if( $create_ticket_response ) |
|
489 | + if ( $create_ticket_response ) |
|
490 | 490 | echo $create_ticket_response; |
491 | 491 | |
492 | 492 | } |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | // delete the options and allow the user to manually updadte things |
501 | 501 | |
502 | 502 | // Verify the NONCE is valid |
503 | - check_admin_referer( 'yikes-mc-dismiss-migration' , 'dismiss_migration_nonce' ); |
|
503 | + check_admin_referer( 'yikes-mc-dismiss-migration', 'dismiss_migration_nonce' ); |
|
504 | 504 | |
505 | 505 | // re-direct the user back to the page |
506 | 506 | wp_redirect( esc_url_raw( admin_url( 'index.php?yikes-mc-options-migration-dismissed="true"' ) ) ); |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | * @since 6.0.0 |
516 | 516 | */ |
517 | 517 | public function load_error_logging_class() { |
518 | - if( get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
518 | + if ( get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
519 | 519 | // if error logging is enabled we should include our error logging class |
520 | 520 | /* Generate oure error logging table */ |
521 | 521 | require_once YIKES_MC_PATH . '/includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
@@ -534,17 +534,17 @@ discard block |
||
534 | 534 | // add a new option to store the plugin activation date/time |
535 | 535 | // @since v6.0.0 |
536 | 536 | // this is used to notify the user that they should review after 2 weeks |
537 | - if ( !get_option( 'yikes_easy_mailchimp_activation_date' ) ) { |
|
537 | + if ( ! get_option( 'yikes_easy_mailchimp_activation_date' ) ) { |
|
538 | 538 | add_option( 'yikes_easy_mailchimp_activation_date', strtotime( "now" ) ); |
539 | 539 | } |
540 | 540 | |
541 | 541 | $stop_bugging_me = get_option( 'yikes_easy_mailchimp_review_stop_bugging_me' ); |
542 | 542 | |
543 | - if( !$stop_bugging_me ) { |
|
543 | + if ( ! $stop_bugging_me ) { |
|
544 | 544 | $install_date = get_option( 'yikes_easy_mailchimp_activation_date' ); |
545 | 545 | $past_date = strtotime( '-14 days' ); |
546 | 546 | if ( $past_date >= $install_date && current_user_can( 'install_plugins' ) ) { |
547 | - add_action( 'admin_notices', array( $this , 'yikes_easy_mailchimp_display_review_us_notice' ) ); |
|
547 | + add_action( 'admin_notices', array( $this, 'yikes_easy_mailchimp_display_review_us_notice' ) ); |
|
548 | 548 | } |
549 | 549 | } |
550 | 550 | |
@@ -557,13 +557,13 @@ discard block |
||
557 | 557 | */ |
558 | 558 | public function yikes_easy_mailchimp_display_review_us_notice() { |
559 | 559 | /* Lets only display our admin notice on YT4WP pages to not annoy the hell out of people :) */ |
560 | - if ( in_array( get_current_screen()->base , array( 'dashboard' , 'post' , 'edit' ) ) || strpos( get_current_screen()->base ,'yikes-inc-easy-mailchimp') !== false ) { |
|
560 | + if ( in_array( get_current_screen()->base, array( 'dashboard', 'post', 'edit' ) ) || strpos( get_current_screen()->base, 'yikes-inc-easy-mailchimp' ) !== false ) { |
|
561 | 561 | // Review URL - Change to the URL of your plugin on WordPress.org |
562 | 562 | $reviewurl = 'https://wordpress.org/support/view/plugin-reviews/yikes-inc-easy-mailchimp-extender'; |
563 | 563 | $addons_url = esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-addons' ) ); |
564 | 564 | $nobugurl = esc_url_raw( add_query_arg( 'yikes_easy_mc_icons_nobug', '1', admin_url() ) ); |
565 | 565 | $review_message = '<div id="yikes-mailchimp-logo"></div>'; |
566 | - $review_message .= sprintf( __( "It looks like you've been using %s for 2 weeks now. We hope you're enjoying the features included with the free version. If so, please consider leaving us a review. Reviews only help to catch other users attention as well as provide us with feedback to grow and improve upon. If you're really enjoying the plugin, consider buying an add-on or developer license for some really awesome features and premium support." , 'yikes-inc-easy-mailchimp-extender' ) . "<span class='button-container'> <a href='%s' target='_blank' class='button-secondary'><span class='dashicons dashicons-star-filled'></span>" . __( "Leave A Review" , 'yikes-inc-easy-mailchimp-extender' ) . "</a> <a href='%s' class='button-secondary'><span class='dashicons dashicons-upload'></span>" . __( "View Addons" , 'yikes-inc-easy-mailchimp-extender' ) . "</a> <a href='%s' class='button-secondary'><span class='dashicons dashicons-no-alt'></span>" . __( "Dismiss" , 'yikes-inc-easy-mailchimp-extender' ) . "</a> </span>", '<strong>Easy Forms for MailChimp by YIKES Inc.</strong>', $reviewurl, $addons_url, $nobugurl ) . ''; |
|
566 | + $review_message .= sprintf( __( "It looks like you've been using %s for 2 weeks now. We hope you're enjoying the features included with the free version. If so, please consider leaving us a review. Reviews only help to catch other users attention as well as provide us with feedback to grow and improve upon. If you're really enjoying the plugin, consider buying an add-on or developer license for some really awesome features and premium support.", 'yikes-inc-easy-mailchimp-extender' ) . "<span class='button-container'> <a href='%s' target='_blank' class='button-secondary'><span class='dashicons dashicons-star-filled'></span>" . __( "Leave A Review", 'yikes-inc-easy-mailchimp-extender' ) . "</a> <a href='%s' class='button-secondary'><span class='dashicons dashicons-upload'></span>" . __( "View Addons", 'yikes-inc-easy-mailchimp-extender' ) . "</a> <a href='%s' class='button-secondary'><span class='dashicons dashicons-no-alt'></span>" . __( "Dismiss", 'yikes-inc-easy-mailchimp-extender' ) . "</a> </span>", '<strong>Easy Forms for MailChimp by YIKES Inc.</strong>', $reviewurl, $addons_url, $nobugurl ) . ''; |
|
567 | 567 | ?> |
568 | 568 | <div id="review-yikes-easy-mailchimp-notice"> |
569 | 569 | <?php echo $review_message; ?> |
@@ -579,8 +579,8 @@ discard block |
||
579 | 579 | */ |
580 | 580 | public function yikes_easy_mailchimp_stop_bugging_me() { |
581 | 581 | $nobug = ""; |
582 | - if ( isset( $_GET['yikes_easy_mc_icons_nobug'] ) ) { |
|
583 | - $nobug = (int) esc_attr( $_GET['yikes_easy_mc_icons_nobug'] ); |
|
582 | + if ( isset( $_GET[ 'yikes_easy_mc_icons_nobug' ] ) ) { |
|
583 | + $nobug = (int) esc_attr( $_GET[ 'yikes_easy_mc_icons_nobug' ] ); |
|
584 | 584 | } |
585 | 585 | if ( 1 == $nobug ) { |
586 | 586 | add_option( 'yikes_easy_mailchimp_review_stop_bugging_me', TRUE ); |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | |
592 | 592 | /* Display a warning users who are using PHP < 5.3 */ |
593 | 593 | public function display_php_warning() { |
594 | - $message = __( 'YIKES Inc. Easy Forms for MailChimp requires a minimum of PHP 5.3. The plugin will not function properly until you update. Reach out to your host provider for assistance.' , 'yikes-inc-easy-mailchimp-extender' ); |
|
594 | + $message = __( 'YIKES Inc. Easy Forms for MailChimp requires a minimum of PHP 5.3. The plugin will not function properly until you update. Reach out to your host provider for assistance.', 'yikes-inc-easy-mailchimp-extender' ); |
|
595 | 595 | echo "<div class='error'> <p><span class='dashicons dashicons-no-alt' style='color:rgb(231, 98, 98)'></span> $message</p></div>"; |
596 | 596 | } |
597 | 597 | |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | public function add_tinyMCE_buttons() { |
603 | 603 | global $typenow; |
604 | 604 | // only on Post Type: post and page |
605 | - if( ! in_array( $typenow, array( 'post', 'page' ) ) ) { |
|
605 | + if ( ! in_array( $typenow, array( 'post', 'page' ) ) ) { |
|
606 | 606 | return; |
607 | 607 | } |
608 | 608 | add_filter( 'mce_buttons', array( $this, 'yks_mc_add_tinymce_button' ) ); |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | // inlcude the js for tinymce |
620 | 620 | public function yks_mc_add_tinymce_plugin( $plugin_array ) { |
621 | 621 | |
622 | - $plugin_array['yks_mc_tinymce_button'] = plugins_url( '/js/min/yikes-inc-easy-mailchimp-tinymce-button.min.js', __FILE__ ); |
|
622 | + $plugin_array[ 'yks_mc_tinymce_button' ] = plugins_url( '/js/min/yikes-inc-easy-mailchimp-tinymce-button.min.js', __FILE__ ); |
|
623 | 623 | |
624 | 624 | return $plugin_array; |
625 | 625 | |
@@ -632,23 +632,23 @@ discard block |
||
632 | 632 | */ |
633 | 633 | public function tinymce_yikes_easy_mc() { |
634 | 634 | // check capabilities |
635 | - if( ! current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) { |
|
635 | + if ( ! current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) { |
|
636 | 636 | return; |
637 | 637 | } |
638 | 638 | |
639 | 639 | $list_data = $this->form_interface->get_all_forms(); |
640 | 640 | $lists = array(); |
641 | - if( !empty( $list_data ) ) { |
|
641 | + if ( ! empty( $list_data ) ) { |
|
642 | 642 | // build an array to pass to our javascript |
643 | - foreach( $list_data as $id => $form ) { |
|
644 | - $lists[] = array( |
|
645 | - 'text' => urlencode( $form['form_name'] ), |
|
643 | + foreach ( $list_data as $id => $form ) { |
|
644 | + $lists[ ] = array( |
|
645 | + 'text' => urlencode( $form[ 'form_name' ] ), |
|
646 | 646 | 'value' => $id, |
647 | 647 | ); |
648 | 648 | } |
649 | 649 | } else { |
650 | - $lists[0] = array( |
|
651 | - 'text' => __( 'Please Import Some MailChimp Lists' , 'yikes-inc-easy-mailchimp-extender' ), |
|
650 | + $lists[ 0 ] = array( |
|
651 | + 'text' => __( 'Please Import Some MailChimp Lists', 'yikes-inc-easy-mailchimp-extender' ), |
|
652 | 652 | 'value' => '-' |
653 | 653 | ); |
654 | 654 | } |
@@ -658,10 +658,10 @@ discard block |
||
658 | 658 | 'forms' => json_encode( $lists ), |
659 | 659 | 'button_title' => __( 'Easy Forms for MailChimp by YIKES', 'yikes-inc-easy-mailchimp-extender' ), |
660 | 660 | 'popup_title' => __( 'Easy Forms for MailChimp by YIKES', 'yikes-inc-easy-mailchimp-extender' ), |
661 | - 'list_id_label' => __( 'MailChimp Opt-In Form' , 'yikes-inc-easy-mailchimp-extender' ), |
|
662 | - 'show_title_label' => __( 'Display Form Title' , 'yikes-inc-easy-mailchimp-extender' ), |
|
663 | - 'show_description_label' => __( 'Display Form Description' , 'yikes-inc-easy-mailchimp-extender' ), |
|
664 | - 'submit_button_text_label' => __( 'Custom Submit Button Text' , 'yikes-inc-easy-mailchimp-extender' ), |
|
661 | + 'list_id_label' => __( 'MailChimp Opt-In Form', 'yikes-inc-easy-mailchimp-extender' ), |
|
662 | + 'show_title_label' => __( 'Display Form Title', 'yikes-inc-easy-mailchimp-extender' ), |
|
663 | + 'show_description_label' => __( 'Display Form Description', 'yikes-inc-easy-mailchimp-extender' ), |
|
664 | + 'submit_button_text_label' => __( 'Custom Submit Button Text', 'yikes-inc-easy-mailchimp-extender' ), |
|
665 | 665 | 'submit_button_message' => '<em>' . __( 'If left empty, the button will use the default submit button text .', 'yikes-inc-easy-mailchimp-extender' ) . '</em>', |
666 | 666 | 'alert_translated' => sprintf( __( 'You need to <a href=%s title="%s">create a form</a> before you can add one to a page or post.', 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ), __( 'Create a form', 'yikes-inc-easy-mailchimp-extender' ) ), |
667 | 667 | ) ); |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | if ( get_option( 'yikes_mailchimp_activation_redirect', 'true' ) == 'true' ) { |
678 | 678 | update_option( 'yikes_mailchimp_activation_redirect', 'false' ); |
679 | 679 | /* If the user had this plugin activated prior to today, redirect to 'Whats New' */ |
680 | - if( get_option( 'yikes_easy_mailchimp_activation_date', strtotime( 'now' ) ) == strtotime( 'now' ) ) { |
|
680 | + if ( get_option( 'yikes_easy_mailchimp_activation_date', strtotime( 'now' ) ) == strtotime( 'now' ) ) { |
|
681 | 681 | wp_redirect( esc_url( admin_url( 'admin.php?page=yikes-mailchimp-welcome' ) ) ); |
682 | 682 | } else { |
683 | 683 | /* Else redirect the user over to the 'Getting Started' tab */ |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | * @since 6.0.0 |
730 | 730 | */ |
731 | 731 | public function enqueue_scripts() { |
732 | - wp_enqueue_script( 'yikes-inc-easy-mailchimp-extender-admin-js', plugin_dir_url( __FILE__ ) . 'js/min/yikes-inc-easy-mailchimp-extender-admin.min.js', array( 'jquery' , 'jquery-ui-sortable' ), $this->version, false ); |
|
732 | + wp_enqueue_script( 'yikes-inc-easy-mailchimp-extender-admin-js', plugin_dir_url( __FILE__ ) . 'js/min/yikes-inc-easy-mailchimp-extender-admin.min.js', array( 'jquery', 'jquery-ui-sortable' ), $this->version, false ); |
|
733 | 733 | |
734 | 734 | $localized_data = array( |
735 | 735 | 'admin_url' => esc_url_raw( admin_url() ), |
@@ -739,7 +739,7 @@ discard block |
||
739 | 739 | 'preloader_url' => esc_url_raw( admin_url( '/images/wpspin_light.gif' ) ), |
740 | 740 | ); |
741 | 741 | |
742 | - wp_localize_script( 'yikes-inc-easy-mailchimp-extender-admin-js' , 'object_data' , $localized_data ); |
|
742 | + wp_localize_script( 'yikes-inc-easy-mailchimp-extender-admin-js', 'object_data', $localized_data ); |
|
743 | 743 | |
744 | 744 | // Enqueue required scripts for the form editor |
745 | 745 | $screen = get_current_screen(); |
@@ -752,8 +752,8 @@ discard block |
||
752 | 752 | |
753 | 753 | wp_enqueue_style( 'wp-color-picker' ); |
754 | 754 | wp_enqueue_script( 'wp-color-picker' ); |
755 | - wp_enqueue_script( 'jquery.timepicker.js',YIKES_MC_URL . 'admin/js/jquery.timepicker.min.js' , array( 'jquery' ) , $this->version, false ); |
|
756 | - wp_enqueue_script( 'edit-form-js' , YIKES_MC_URL . 'admin/js/min/yikes-inc-easy-mailchimp-extender-edit-form.min.js' , array( 'jquery.timepicker.js', 'jquery-ui-datepicker' ) , $this->version, false ); |
|
755 | + wp_enqueue_script( 'jquery.timepicker.js', YIKES_MC_URL . 'admin/js/jquery.timepicker.min.js', array( 'jquery' ), $this->version, false ); |
|
756 | + wp_enqueue_script( 'edit-form-js', YIKES_MC_URL . 'admin/js/min/yikes-inc-easy-mailchimp-extender-edit-form.min.js', array( 'jquery.timepicker.js', 'jquery-ui-datepicker' ), $this->version, false ); |
|
757 | 757 | |
758 | 758 | $localized_data = array( |
759 | 759 | 'ajax_url' => esc_url_raw( admin_url( 'admin-ajax.php' ) ), |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | 'isRTL' => $wp_locale->is_rtl(), |
779 | 779 | 'start_date_exceeds_end_date_error' => __( 'Error: The start date and time cannot occur after the end date and time. Chosen date reverted to previous selection.', 'yikes-inc-easy-mailchimp-extender' ), |
780 | 780 | ); |
781 | - wp_localize_script( 'edit-form-js' , 'yikes_mailchimp_edit_form' , $localized_data ); |
|
781 | + wp_localize_script( 'edit-form-js', 'yikes_mailchimp_edit_form', $localized_data ); |
|
782 | 782 | } |
783 | 783 | |
784 | 784 | /** |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | * Convert the php date format string to a js date format |
841 | 841 | */ |
842 | 842 | public function yikes_jQuery_datepicker_date_format( $site_option ) { |
843 | - switch( $site_option ) { |
|
843 | + switch ( $site_option ) { |
|
844 | 844 | //Predefined WP date formats |
845 | 845 | default: |
846 | 846 | case 'F j, Y': |
@@ -1093,7 +1093,7 @@ discard block |
||
1093 | 1093 | |
1094 | 1094 | /* Register General Settings Section */ |
1095 | 1095 | |
1096 | - register_setting( 'yikes_inc_easy_mc_general_settings_page', 'yikes-mc-api-key', array( $this , 'yikes_mc_validate_api_key' ) ); |
|
1096 | + register_setting( 'yikes_inc_easy_mc_general_settings_page', 'yikes-mc-api-key', array( $this, 'yikes_mc_validate_api_key' ) ); |
|
1097 | 1097 | |
1098 | 1098 | add_settings_section( |
1099 | 1099 | 'yikes_easy_mc_settings_general_section_callback', |
@@ -1136,16 +1136,16 @@ discard block |
||
1136 | 1136 | add_settings_field( |
1137 | 1137 | 'optin-checkbox-init', |
1138 | 1138 | __( 'Select Checkboxes to Generate', 'yikes-inc-easy-mailchimp-extender' ), |
1139 | - '', // callback + validation inside of admin/partials/menu/options.php |
|
1139 | + '', // callback + validation inside of admin/partials/menu/options.php |
|
1140 | 1140 | 'yikes_inc_easy_mc_checkbox_settings' |
1141 | 1141 | ); |
1142 | 1142 | /* End Checkbox Settings */ |
1143 | 1143 | |
1144 | 1144 | /* reCAPTCHA Settings */ |
1145 | 1145 | |
1146 | - register_setting( 'yikes_inc_easy_mc_recaptcha_settings_page' , 'yikes-mc-recaptcha-status' ); |
|
1147 | - register_setting( 'yikes_inc_easy_mc_recaptcha_settings_page' , 'yikes-mc-recaptcha-site-key' ); |
|
1148 | - register_setting( 'yikes_inc_easy_mc_recaptcha_settings_page' , 'yikes-mc-recaptcha-secret-key' ); |
|
1146 | + register_setting( 'yikes_inc_easy_mc_recaptcha_settings_page', 'yikes-mc-recaptcha-status' ); |
|
1147 | + register_setting( 'yikes_inc_easy_mc_recaptcha_settings_page', 'yikes-mc-recaptcha-site-key' ); |
|
1148 | + register_setting( 'yikes_inc_easy_mc_recaptcha_settings_page', 'yikes-mc-recaptcha-secret-key' ); |
|
1149 | 1149 | |
1150 | 1150 | /* Register reCAPTCHA Settings Section */ |
1151 | 1151 | add_settings_section( |
@@ -1158,28 +1158,28 @@ discard block |
||
1158 | 1158 | add_settings_field( |
1159 | 1159 | 'yikes-mc-recaptcha-site-key', |
1160 | 1160 | __( 'Enter reCAPTCHA Site Key', 'yikes-inc-easy-mailchimp-extender' ), |
1161 | - '', // callback + validation inside of admin/partials/menu/options.php |
|
1161 | + '', // callback + validation inside of admin/partials/menu/options.php |
|
1162 | 1162 | 'yikes_easy_mc_settings_recpatcha_section' |
1163 | 1163 | ); |
1164 | 1164 | |
1165 | 1165 | add_settings_field( |
1166 | 1166 | 'yikes-mc-recaptcha-secret-key', |
1167 | 1167 | __( 'Enter reCAPTCHA Secret Key', 'yikes-inc-easy-mailchimp-extender' ), |
1168 | - '', // callback + validation inside of admin/partials/menu/options.php |
|
1168 | + '', // callback + validation inside of admin/partials/menu/options.php |
|
1169 | 1169 | 'yikes_easy_mc_settings_recpatcha_section' |
1170 | 1170 | ); |
1171 | 1171 | |
1172 | 1172 | add_settings_field( |
1173 | 1173 | 'yikes-mc-recaptcha-status', |
1174 | 1174 | __( 'Enable ReCaptcha', 'yikes-inc-easy-mailchimp-extender' ), |
1175 | - '', // callback + validation inside of admin/partials/menu/options.php |
|
1175 | + '', // callback + validation inside of admin/partials/menu/options.php |
|
1176 | 1176 | 'yikes_easy_mc_settings_recpatcha_section' |
1177 | 1177 | ); |
1178 | 1178 | |
1179 | 1179 | /* End reCAPTCHA Settings */ |
1180 | 1180 | |
1181 | 1181 | /* Debug Settings */ |
1182 | - register_setting( 'yikes_inc_easy_mc_debug_settings_page' , 'yikes-mailchimp-debug-status' ); |
|
1182 | + register_setting( 'yikes_inc_easy_mc_debug_settings_page', 'yikes-mailchimp-debug-status' ); |
|
1183 | 1183 | |
1184 | 1184 | /* Register Debug Settings Section */ |
1185 | 1185 | add_settings_section( |
@@ -1192,7 +1192,7 @@ discard block |
||
1192 | 1192 | add_settings_field( |
1193 | 1193 | 'yikes-mailchimp-debug-status', |
1194 | 1194 | __( 'Enable Debugging', 'yikes-inc-easy-mailchimp-extender' ), |
1195 | - '', // callback + validation inside of admin/partials/menu/options.php |
|
1195 | + '', // callback + validation inside of admin/partials/menu/options.php |
|
1196 | 1196 | 'yikes_easy_mc_settings_debug_section' |
1197 | 1197 | ); |
1198 | 1198 | |
@@ -1208,30 +1208,30 @@ discard block |
||
1208 | 1208 | * @since complete re-write |
1209 | 1209 | **/ |
1210 | 1210 | function yikes_mc_validate_api_key( $input ) { |
1211 | - if( $input === '' ) { |
|
1212 | - update_option( 'yikes-mc-api-validation' , 'invalid_api_key' ); |
|
1211 | + if ( $input === '' ) { |
|
1212 | + update_option( 'yikes-mc-api-validation', 'invalid_api_key' ); |
|
1213 | 1213 | return ''; |
1214 | 1214 | } |
1215 | - $api_key = strip_tags ( trim( $input ) ); |
|
1215 | + $api_key = strip_tags( trim( $input ) ); |
|
1216 | 1216 | $dash_position = strpos( trim( $input ), '-' ); |
1217 | - if( $dash_position !== false ) { |
|
1217 | + if ( $dash_position !== false ) { |
|
1218 | 1218 | $manager = new Yikes_Inc_Easy_MailChimp_API_Manager( $api_key ); |
1219 | 1219 | } else { |
1220 | 1220 | update_option( 'yikes-mc-api-invalid-key-response', __( 'Your API key appears to be invalid.', 'yikes-inc-easy-mailchimp-extender' ) ); |
1221 | - update_option( 'yikes-mc-api-validation' , 'invalid_api_key' ); |
|
1221 | + update_option( 'yikes-mc-api-validation', 'invalid_api_key' ); |
|
1222 | 1222 | return $api_key; |
1223 | 1223 | } |
1224 | 1224 | |
1225 | 1225 | $response = $manager->get_account_handler()->get_account( false ); |
1226 | - if( ! is_wp_error( $response ) ) { |
|
1227 | - update_option( 'yikes-mc-api-validation' , 'valid_api_key' ); |
|
1226 | + if ( ! is_wp_error( $response ) ) { |
|
1227 | + update_option( 'yikes-mc-api-validation', 'valid_api_key' ); |
|
1228 | 1228 | // Clear the API key transient data |
1229 | 1229 | $this->delete_yikes_mailchimp_transients(); |
1230 | - } else { |
|
1230 | + } else { |
|
1231 | 1231 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
1232 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $response->get_error_message() , __( "Connecting to MailChimp" , 'yikes-inc-easy-mailchimp-extender' ) , __( "Settings Page/General Settings" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
1233 | - update_option( 'yikes-mc-api-invalid-key-response' , $response->get_error_message() ); |
|
1234 | - update_option( 'yikes-mc-api-validation' , 'invalid_api_key' ); |
|
1232 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $response->get_error_message(), __( "Connecting to MailChimp", 'yikes-inc-easy-mailchimp-extender' ), __( "Settings Page/General Settings", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
1233 | + update_option( 'yikes-mc-api-invalid-key-response', $response->get_error_message() ); |
|
1234 | + update_option( 'yikes-mc-api-validation', 'invalid_api_key' ); |
|
1235 | 1235 | } |
1236 | 1236 | // returned the api key |
1237 | 1237 | return $api_key; |
@@ -1252,13 +1252,13 @@ discard block |
||
1252 | 1252 | * to form fields. (input, dropdowns, buttons etc.) |
1253 | 1253 | * @since v5.5 re-write |
1254 | 1254 | **/ |
1255 | - public function is_user_mc_api_valid_form( $echo=true ) { |
|
1256 | - if( $echo == true ) { |
|
1257 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) == 'invalid_api_key' ) { |
|
1255 | + public function is_user_mc_api_valid_form( $echo = true ) { |
|
1256 | + if ( $echo == true ) { |
|
1257 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) { |
|
1258 | 1258 | echo 'disabled="disabled"'; |
1259 | 1259 | } |
1260 | 1260 | } else { |
1261 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) == 'invalid_api_key' ) { |
|
1261 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) { |
|
1262 | 1262 | return false; |
1263 | 1263 | } else { |
1264 | 1264 | return true; |
@@ -1278,11 +1278,11 @@ discard block |
||
1278 | 1278 | public function check_for_old_yks_mc_options() { |
1279 | 1279 | $old_plugin_options = get_option( 'ykseme_storage' ); |
1280 | 1280 | // only perform options migrations if the site is not a multi-site setup |
1281 | - if ( !is_multisite() ) { |
|
1282 | - if( apply_filters( 'yikes_mc_old_options_filter' , $old_plugin_options ) ) { |
|
1281 | + if ( ! is_multisite() ) { |
|
1282 | + if ( apply_filters( 'yikes_mc_old_options_filter', $old_plugin_options ) ) { |
|
1283 | 1283 | // display a notice to the user that they should 'migrate' |
1284 | 1284 | // from the old plugin settings to the new ones |
1285 | - add_action( 'admin_notices', array( $this , 'display_options_migrate_notice' ) , 11 ); |
|
1285 | + add_action( 'admin_notices', array( $this, 'display_options_migrate_notice' ), 11 ); |
|
1286 | 1286 | } |
1287 | 1287 | } |
1288 | 1288 | } |
@@ -1315,11 +1315,11 @@ discard block |
||
1315 | 1315 | |
1316 | 1316 | // Confirm that the necessary forms table in the database exists, else bail |
1317 | 1317 | global $wpdb; |
1318 | - if( $wpdb->get_var("show tables like '" . $wpdb->prefix . "yikes_easy_mc_forms'") != $wpdb->prefix . "yikes_easy_mc_forms" ) { |
|
1318 | + if ( $wpdb->get_var( "show tables like '" . $wpdb->prefix . "yikes_easy_mc_forms'" ) != $wpdb->prefix . "yikes_easy_mc_forms" ) { |
|
1319 | 1319 | return; |
1320 | 1320 | } |
1321 | 1321 | |
1322 | - if( isset( $_GET['yikes-mc-options-migration-dismissed'] ) && $_GET['yikes-mc-options-migration-dismissed'] == 'true' ) { |
|
1322 | + if ( isset( $_GET[ 'yikes-mc-options-migration-dismissed' ] ) && $_GET[ 'yikes-mc-options-migration-dismissed' ] == 'true' ) { |
|
1323 | 1323 | // Delete the options, start a-new! (this will disable the migration notice altogether) |
1324 | 1324 | delete_option( 'widget_yikes_mc_widget' ); |
1325 | 1325 | delete_option( 'api_validation' ); |
@@ -1333,18 +1333,18 @@ discard block |
||
1333 | 1333 | } else { |
1334 | 1334 | ?> |
1335 | 1335 | <div class="yikes-easy-mc-updated migrate-options-notice"> |
1336 | - <p><?php printf( __( "It looks like you're upgrading from a previous version of %s.", 'yikes-inc-easy-mailchimp-extender' ), '<strong>YIKES Inc. Easy Forms for MailChimp</strong>' ); ?> <?php printf( __( "In the newest version of %s, the options data structure has changed. We've also moved the mailing lists into its own database table to allow for some higher level customization. Now you can easily create multiple forms and assign them to the same mailing list." , 'yikes-inc-easy-mailchimp-extender' ), '<strong>YIKES Inc. Easy Forms for MailChimp</strong>' ); ?></p> |
|
1336 | + <p><?php printf( __( "It looks like you're upgrading from a previous version of %s.", 'yikes-inc-easy-mailchimp-extender' ), '<strong>YIKES Inc. Easy Forms for MailChimp</strong>' ); ?> <?php printf( __( "In the newest version of %s, the options data structure has changed. We've also moved the mailing lists into its own database table to allow for some higher level customization. Now you can easily create multiple forms and assign them to the same mailing list.", 'yikes-inc-easy-mailchimp-extender' ), '<strong>YIKES Inc. Easy Forms for MailChimp</strong>' ); ?></p> |
|
1337 | 1337 | <p><?php _e( "Before you continue, it's strongly recommended you the perform the migration to ensure the plugin continues to function properly.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
1338 | 1338 | <p><em><?php _e( "It's also strongly recommended that you take a backup of your database.", 'yikes-inc-easy-mailchimp-extender' ); ?></em></p> |
1339 | 1339 | <section id="migration-buttons"> |
1340 | 1340 | <!-- migrate button --> |
1341 | 1341 | <form> |
1342 | 1342 | <input type="hidden" name="yikes-mc-update-option-structure" value="yikes-mc-update-option-structure" /> |
1343 | - <a href="<?php echo wp_nonce_url( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-update' ) ), 'yikes-mc-migrate-options' , 'migrate_options_nonce' ); ?>" class="button-secondary"><?php _e( 'Perform Migration' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
1343 | + <a href="<?php echo wp_nonce_url( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-update' ) ), 'yikes-mc-migrate-options', 'migrate_options_nonce' ); ?>" class="button-secondary"><?php _e( 'Perform Migration', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
1344 | 1344 | </form> |
1345 | 1345 | <!-- dismiss button --> |
1346 | 1346 | <form> |
1347 | - <a href="<?php echo wp_nonce_url( esc_url_raw( admin_url() ), 'yikes-mc-dismiss-migration' , 'dismiss_migration_nonce' ); ?>" class="button-secondary"><?php _e( 'Dismiss Notice' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
1347 | + <a href="<?php echo wp_nonce_url( esc_url_raw( admin_url() ), 'yikes-mc-dismiss-migration', 'dismiss_migration_nonce' ); ?>" class="button-secondary"><?php _e( 'Dismiss Notice', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
1348 | 1348 | </form> |
1349 | 1349 | </section> |
1350 | 1350 | |
@@ -1358,9 +1358,9 @@ discard block |
||
1358 | 1358 | * and return the index ( used to find the list name assigned to a form ) |
1359 | 1359 | * - http://stackoverflow.com/questions/6661530/php-multi-dimensional-array-search |
1360 | 1360 | */ |
1361 | - function findMCListID($id, $array) { |
|
1362 | - foreach ($array as $key => $val) { |
|
1363 | - if ($val['id'] === $id) { |
|
1361 | + function findMCListID( $id, $array ) { |
|
1362 | + foreach ( $array as $key => $val ) { |
|
1363 | + if ( $val[ 'id' ] === $id ) { |
|
1364 | 1364 | return $key; |
1365 | 1365 | } |
1366 | 1366 | } |
@@ -1370,9 +1370,9 @@ discard block |
||
1370 | 1370 | /* Ajax Migrate Options */ |
1371 | 1371 | function migrate_archived_options() { |
1372 | 1372 | // all options prefixed with 'yikes-mc-' |
1373 | - $option_name = 'yikes-mc-'.$_POST['option_name']; |
|
1374 | - $option_value = $_POST['option_value']; |
|
1375 | - if( json_decode( $option_value ) ) { |
|
1373 | + $option_name = 'yikes-mc-' . $_POST[ 'option_name' ]; |
|
1374 | + $option_value = $_POST[ 'option_value' ]; |
|
1375 | + if ( json_decode( $option_value ) ) { |
|
1376 | 1376 | // decode our lists() array, and store it |
1377 | 1377 | $opt_value = json_decode( $option_value, true ); |
1378 | 1378 | } else { |
@@ -1385,23 +1385,23 @@ discard block |
||
1385 | 1385 | |
1386 | 1386 | /* Ajax Migrate Forms */ |
1387 | 1387 | function migrate_previously_setup_forms() { |
1388 | - $option_name = $_POST['option_name']; |
|
1389 | - $done = $_POST['done_import']; |
|
1388 | + $option_name = $_POST[ 'option_name' ]; |
|
1389 | + $done = $_POST[ 'done_import' ]; |
|
1390 | 1390 | // Create some starter forms for the user |
1391 | 1391 | // based on previously imported lists (to our old version) |
1392 | - if( $option_name == 'yikes-mc-lists' ) { |
|
1393 | - $option_value = $_POST['option_value']; |
|
1394 | - $new_options = json_decode( stripslashes_deep( $option_value ) , true ); |
|
1392 | + if ( $option_name == 'yikes-mc-lists' ) { |
|
1393 | + $option_value = $_POST[ 'option_value' ]; |
|
1394 | + $new_options = json_decode( stripslashes_deep( $option_value ), true ); |
|
1395 | 1395 | |
1396 | - $list_id = $new_options['id']; |
|
1397 | - $form_name = $new_options['name']; |
|
1398 | - $fields = $new_options['fields']; // our fields array |
|
1396 | + $list_id = $new_options[ 'id' ]; |
|
1397 | + $form_name = $new_options[ 'name' ]; |
|
1398 | + $fields = $new_options[ 'fields' ]; // our fields array |
|
1399 | 1399 | |
1400 | - $custom_styles = isset( $new_options['custom_styles'] ) ? $new_options['custom_styles']: '0'; // store as an array with all of our styles |
|
1401 | - $custom_template = isset( $new_options['custom_template'] ) ? $new_options['custom_template'] : '0'; // store template data as an array ( active , template used ) |
|
1402 | - $send_welcome_email = isset( $new_options['yks_mailchimp_send_welcome_'.$list_id] ) ? '0' : '1'; |
|
1403 | - $redirect_user_on_submit = isset( $new_options['yks_mailchimp_redirect_'.$list_id] ) ? '1' : '0'; |
|
1404 | - $redirect_page = isset( $new_options['page_id_'.$list_id] ) ? $new_options['page_id_'.$list_id] : ''; |
|
1400 | + $custom_styles = isset( $new_options[ 'custom_styles' ] ) ? $new_options[ 'custom_styles' ] : '0'; // store as an array with all of our styles |
|
1401 | + $custom_template = isset( $new_options[ 'custom_template' ] ) ? $new_options[ 'custom_template' ] : '0'; // store template data as an array ( active , template used ) |
|
1402 | + $send_welcome_email = isset( $new_options[ 'yks_mailchimp_send_welcome_' . $list_id ] ) ? '0' : '1'; |
|
1403 | + $redirect_user_on_submit = isset( $new_options[ 'yks_mailchimp_redirect_' . $list_id ] ) ? '1' : '0'; |
|
1404 | + $redirect_page = isset( $new_options[ 'page_id_' . $list_id ] ) ? $new_options[ 'page_id_' . $list_id ] : ''; |
|
1405 | 1405 | |
1406 | 1406 | /* Insert Forms Function */ |
1407 | 1407 | $this->form_interface->create_form( array( |
@@ -1423,7 +1423,7 @@ discard block |
||
1423 | 1423 | 'custom_fields' => '', |
1424 | 1424 | ) ); |
1425 | 1425 | } |
1426 | - if( $done == 'done' ) { |
|
1426 | + if ( $done == 'done' ) { |
|
1427 | 1427 | wp_send_json( array( 'form_name' => $form_name, 'completed_import' => true ) ); |
1428 | 1428 | } else { |
1429 | 1429 | wp_send_json( array( 'form_name' => $form_name, 'completed_import' => false ) ); |
@@ -1438,35 +1438,35 @@ discard block |
||
1438 | 1438 | * @since v5.6 - complete re-write |
1439 | 1439 | */ |
1440 | 1440 | public function generate_options_pages_sidebar_menu() { |
1441 | - if( isset( $_REQUEST['section'] ) ) { |
|
1442 | - $selected = $_REQUEST['section']; |
|
1441 | + if ( isset( $_REQUEST[ 'section' ] ) ) { |
|
1442 | + $selected = $_REQUEST[ 'section' ]; |
|
1443 | 1443 | } |
1444 | - $installed_addons = get_option( 'yikes-easy-mc-active-addons' , array() ); |
|
1444 | + $installed_addons = get_option( 'yikes-easy-mc-active-addons', array() ); |
|
1445 | 1445 | // sort our addons array alphabetically so they appear in similar orders across all sites |
1446 | 1446 | asort( $installed_addons ); |
1447 | 1447 | ?> |
1448 | - <h3><span><?php _e( 'Additional Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
1448 | + <h3><span><?php _e( 'Additional Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
1449 | 1449 | <div class="inside"> |
1450 | 1450 | <ul id="settings-nav"> |
1451 | - <li><?php if( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'general-settings' || !isset( $_REQUEST['section'] ) ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'general-settings' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=general-settings' ) ) ); ?>"><?php _e( 'General Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></li> |
|
1452 | - <li><?php if( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'integration-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'integration-settings' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=integration-settings' ) ) ); ?>"><?php _e( 'Integration Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></li> |
|
1453 | - <li><?php if( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'recaptcha-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'recaptcha-settings' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) ); ?>"><?php _e( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></li> |
|
1454 | - <li><?php if( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'api-cache-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'api-cache-settings' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=api-cache-settings' ) ) ); ?>"><?php _e( 'API Cache Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></li> |
|
1455 | - <li><?php if( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'debug-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'debug-settings' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings' ) ) ); ?>"><?php _e( 'Debug Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></li> |
|
1456 | - <li><?php if( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'import-export-forms' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'import-export-forms' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=import-export-forms' ) ) ); ?>"><?php _e( 'Import/Export' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></li> |
|
1451 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'general-settings' || ! isset( $_REQUEST[ 'section' ] ) ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'general-settings' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=general-settings' ) ) ); ?>"><?php _e( 'General Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li> |
|
1452 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'integration-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'integration-settings' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=integration-settings' ) ) ); ?>"><?php _e( 'Integration Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li> |
|
1453 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'recaptcha-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'recaptcha-settings' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) ); ?>"><?php _e( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li> |
|
1454 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'api-cache-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'api-cache-settings' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=api-cache-settings' ) ) ); ?>"><?php _e( 'API Cache Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li> |
|
1455 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'debug-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'debug-settings' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings' ) ) ); ?>"><?php _e( 'Debug Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li> |
|
1456 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'import-export-forms' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'import-export-forms' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=import-export-forms' ) ) ); ?>"><?php _e( 'Import/Export', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li> |
|
1457 | 1457 | </ul> |
1458 | 1458 | <?php |
1459 | 1459 | // create our add-on settings pages |
1460 | - if( !empty( $installed_addons ) ) { |
|
1460 | + if ( ! empty( $installed_addons ) ) { |
|
1461 | 1461 | ?> |
1462 | 1462 | <hr class="add-on-settings-divider" /> |
1463 | - <strong><?php _e( 'Addon Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
1463 | + <strong><?php _e( 'Addon Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
1464 | 1464 | <ul id="addon-settings-nav"> |
1465 | 1465 | <?php |
1466 | - foreach( $installed_addons as $addon_name ) { |
|
1466 | + foreach ( $installed_addons as $addon_name ) { |
|
1467 | 1467 | ?> |
1468 | 1468 | <li> |
1469 | - <?php if( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == $addon_name ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => $addon_name, 'addon' => 'true' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion='.$addon_name ) ) ); ?>"><?php echo ucwords( str_replace( '-' , ' ' , $addon_name ) ); ?></a></li> |
|
1469 | + <?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == $addon_name ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => $addon_name, 'addon' => 'true' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=' . $addon_name ) ) ); ?>"><?php echo ucwords( str_replace( '-', ' ', $addon_name ) ); ?></a></li> |
|
1470 | 1470 | <?php |
1471 | 1471 | } |
1472 | 1472 | ?> |
@@ -1494,7 +1494,7 @@ discard block |
||
1494 | 1494 | ) |
1495 | 1495 | ); |
1496 | 1496 | ?> |
1497 | - <h3><?php _e( 'Create a New Signup Form' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
1497 | + <h3><?php _e( 'Create a New Signup Form', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
1498 | 1498 | |
1499 | 1499 | <div class="inside"> |
1500 | 1500 | |
@@ -1503,31 +1503,31 @@ discard block |
||
1503 | 1503 | <form id="import-list-to-site" method="POST" action="<?php echo $url; ?>"> |
1504 | 1504 | <input type="hidden" name="import-list-to-site" value="1" /> |
1505 | 1505 | <!-- Name your new form --> |
1506 | - <label for="form-name"><strong><?php _e( 'Form Name' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
1507 | - <input type="text" class="widefat input-field" placeholder="<?php _e( 'Form Name' , 'yikes-inc-easy-mailchimp-extender' ); ?>" name="form-name" id="form-name" <?php $this->is_user_mc_api_valid_form( true ); ?> required> |
|
1506 | + <label for="form-name"><strong><?php _e( 'Form Name', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
1507 | + <input type="text" class="widefat input-field" placeholder="<?php _e( 'Form Name', 'yikes-inc-easy-mailchimp-extender' ); ?>" name="form-name" id="form-name" <?php $this->is_user_mc_api_valid_form( true ); ?> required> |
|
1508 | 1508 | </label> |
1509 | 1509 | <!-- Name your new form --> |
1510 | - <label for="form-description"><strong><?php _e( 'Form Description' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
1511 | - <textarea class="widefat input-field form-description" placeholder="<?php _e( 'Form Description' , 'yikes-inc-easy-mailchimp-extender' ); ?>" name="form-description" id="form-description" <?php $this->is_user_mc_api_valid_form( true ); ?>></textarea> |
|
1510 | + <label for="form-description"><strong><?php _e( 'Form Description', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
1511 | + <textarea class="widefat input-field form-description" placeholder="<?php _e( 'Form Description', 'yikes-inc-easy-mailchimp-extender' ); ?>" name="form-description" id="form-description" <?php $this->is_user_mc_api_valid_form( true ); ?>></textarea> |
|
1512 | 1512 | </label> |
1513 | 1513 | <!-- Associate this form with a list! --> |
1514 | - <label for="associated-list"><strong><?php _e( 'Associated List' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
1514 | + <label for="associated-list"><strong><?php _e( 'Associated List', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
1515 | 1515 | <select name="associated-list" id="associated-list" class=" input-field" <?php $this->is_user_mc_api_valid_form( true ); disabled( true, empty( $lists ) ); ?>> |
1516 | 1516 | <?php |
1517 | 1517 | if ( ! empty( $lists ) ) { |
1518 | - foreach( $lists as $mailing_list ) { |
|
1518 | + foreach ( $lists as $mailing_list ) { |
|
1519 | 1519 | ?> |
1520 | - <option value="<?php echo $mailing_list['id']; ?>"><?php echo stripslashes( $mailing_list['name'] ) . ' (' . $mailing_list['stats']['member_count'] . ') '; ?></option> |
|
1520 | + <option value="<?php echo $mailing_list[ 'id' ]; ?>"><?php echo stripslashes( $mailing_list[ 'name' ] ) . ' (' . $mailing_list[ 'stats' ][ 'member_count' ] . ') '; ?></option> |
|
1521 | 1521 | <?php |
1522 | 1522 | } |
1523 | 1523 | } else { |
1524 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) == 'invalid_api_key' ) { |
|
1524 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) { |
|
1525 | 1525 | ?> |
1526 | - <option><?php echo __( "Please enter a valid API key." , 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
1526 | + <option><?php echo __( "Please enter a valid API key.", 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
1527 | 1527 | <?php |
1528 | 1528 | } else { |
1529 | 1529 | ?> |
1530 | - <option><?php echo __( "No lists were found on the account." , 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
1530 | + <option><?php echo __( "No lists were found on the account.", 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
1531 | 1531 | <?php |
1532 | 1532 | |
1533 | 1533 | } |
@@ -1536,8 +1536,8 @@ discard block |
||
1536 | 1536 | </select> |
1537 | 1537 | |
1538 | 1538 | <?php |
1539 | - if ( isset( $_GET['transient-cleared'] ) ) { |
|
1540 | - if ( 'true' === $_GET['transient-cleared'] ) { |
|
1539 | + if ( isset( $_GET[ 'transient-cleared' ] ) ) { |
|
1540 | + if ( 'true' === $_GET[ 'transient-cleared' ] ) { |
|
1541 | 1541 | ?> |
1542 | 1542 | <div class="yikes-list-refreshed-notice"> |
1543 | 1543 | <p><?php esc_attr_e( 'MailChimp list data has been succesfully refreshed.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -1546,11 +1546,11 @@ discard block |
||
1546 | 1546 | } |
1547 | 1547 | } |
1548 | 1548 | |
1549 | - if( isset( $lists ) && empty( $lists ) ) { |
|
1550 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) != 'invalid_api_key' ) { |
|
1549 | + if ( isset( $lists ) && empty( $lists ) ) { |
|
1550 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'invalid_api_key' ) { |
|
1551 | 1551 | ?> |
1552 | 1552 | <p class="description"> |
1553 | - <?php printf( __( 'Head over to <a href="http://www.MailChimp.com" title="%s">MailChimp</a> to create a new list.', 'yikes-inc-easy-mailchimp-extender' ) , __( 'Create a list' , 'yikes-inc-easy-mailchimp-extender' ) ); ?> |
|
1553 | + <?php printf( __( 'Head over to <a href="http://www.MailChimp.com" title="%s">MailChimp</a> to create a new list.', 'yikes-inc-easy-mailchimp-extender' ), __( 'Create a list', 'yikes-inc-easy-mailchimp-extender' ) ); ?> |
|
1554 | 1554 | </p> |
1555 | 1555 | <?php |
1556 | 1556 | } |
@@ -1558,12 +1558,12 @@ discard block |
||
1558 | 1558 | ?> |
1559 | 1559 | </label> |
1560 | 1560 | <?php |
1561 | - if( $this->is_user_mc_api_valid_form( false ) ) { |
|
1562 | - echo submit_button( __( 'Create', 'yikes-inc-easy-mailchimp-extender' ) , 'primary' , '' , false , array( 'style' => 'margin:.75em 0 .5em 0;' ) ); |
|
1561 | + if ( $this->is_user_mc_api_valid_form( false ) ) { |
|
1562 | + echo submit_button( __( 'Create', 'yikes-inc-easy-mailchimp-extender' ), 'primary', '', false, array( 'style' => 'margin:.75em 0 .5em 0;' ) ); |
|
1563 | 1563 | } else { |
1564 | - echo '<p class="description">' . __( "Please enter a valid MailChimp API key to get started." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
1564 | + echo '<p class="description">' . __( "Please enter a valid MailChimp API key to get started.", 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
1565 | 1565 | ?> |
1566 | - <a href="<?php echo esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&settings-updated=true' ) ); ?>"><?php _e( 'general settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
1566 | + <a href="<?php echo esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&settings-updated=true' ) ); ?>"><?php _e( 'general settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
1567 | 1567 | <?php |
1568 | 1568 | } |
1569 | 1569 | ?> |
@@ -1571,10 +1571,10 @@ discard block |
||
1571 | 1571 | |
1572 | 1572 | <!-- Clear API CACHE --> |
1573 | 1573 | <?php |
1574 | - if( isset( $lists ) && ! empty( $lists ) ) { |
|
1574 | + if ( isset( $lists ) && ! empty( $lists ) ) { |
|
1575 | 1575 | if ( false !== get_transient( 'yikes-easy-mailchimp-list-data' ) ) { ?> |
1576 | - <form action="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-clear-transient-data' , 'nonce' => wp_create_nonce( 'clear-mc-transient-data' ) ) ) ); ?>" method="post"> |
|
1577 | - <input type="submit" class="button-secondary clear-mailchimp-api-cache" value="<?php _e( 'Refresh Lists' , 'yikes-inc-easy-mailchimp-extender' ); ?>" /> |
|
1576 | + <form action="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-clear-transient-data', 'nonce' => wp_create_nonce( 'clear-mc-transient-data' ) ) ) ); ?>" method="post"> |
|
1577 | + <input type="submit" class="button-secondary clear-mailchimp-api-cache" value="<?php _e( 'Refresh Lists', 'yikes-inc-easy-mailchimp-extender' ); ?>" /> |
|
1578 | 1578 | </form> |
1579 | 1579 | <?php } |
1580 | 1580 | } |
@@ -1590,14 +1590,14 @@ discard block |
||
1590 | 1590 | public function generate_page_redirect_dropdown( $redirect, $redirect_page, $custom_redirect_url ) { |
1591 | 1591 | $post_types = get_post_types(); |
1592 | 1592 | ?> |
1593 | - <label id="redirect-user-to-selection-label" for="redirect-user-to-selection" class="<?php if( $redirect == '0' ) { echo 'yikes-easy-mc-hidden'; } ?>"> |
|
1594 | - <?php _e( "Select A Page or Post" , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1593 | + <label id="redirect-user-to-selection-label" for="redirect-user-to-selection" class="<?php if ( $redirect == '0' ) { echo 'yikes-easy-mc-hidden'; } ?>"> |
|
1594 | + <?php _e( "Select A Page or Post", 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1595 | 1595 | <select id="redirect-user-to-selection" name="redirect-user-to-selection" onchange="shouldWeDisplayCustomURL( this );return;"> |
1596 | 1596 | <?php |
1597 | 1597 | // loop over registered post types, and query! |
1598 | - foreach( $post_types as $registered_post_type ) { |
|
1598 | + foreach ( $post_types as $registered_post_type ) { |
|
1599 | 1599 | // exclude a few built in custom post types |
1600 | - if( ! in_array( $registered_post_type , array( 'attachment' , 'revision' , 'nav_menu_item' ) ) ) { |
|
1600 | + if ( ! in_array( $registered_post_type, array( 'attachment', 'revision', 'nav_menu_item' ) ) ) { |
|
1601 | 1601 | // run our query, to retreive the posts |
1602 | 1602 | $pages = get_posts( array( |
1603 | 1603 | 'order' => 'ASC', |
@@ -1607,12 +1607,12 @@ discard block |
||
1607 | 1607 | 'numberposts' => -1 |
1608 | 1608 | ) ); |
1609 | 1609 | // only show cpt's that have posts assigned |
1610 | - if( !empty( $pages ) ) { |
|
1610 | + if ( ! empty( $pages ) ) { |
|
1611 | 1611 | ?> |
1612 | - <optgroup label="<?php echo ucwords( str_replace( '_' , ' ' , $registered_post_type ) ); ?>"> |
|
1612 | + <optgroup label="<?php echo ucwords( str_replace( '_', ' ', $registered_post_type ) ); ?>"> |
|
1613 | 1613 | <?php |
1614 | - foreach( $pages as $page ) { |
|
1615 | - ?><option <?php selected( $redirect_page , $page->ID ); ?> value="<?php echo $page->ID; ?>"><?php echo $page->post_title; ?></option><?php |
|
1614 | + foreach ( $pages as $page ) { |
|
1615 | + ?><option <?php selected( $redirect_page, $page->ID ); ?> value="<?php echo $page->ID; ?>"><?php echo $page->post_title; ?></option><?php |
|
1616 | 1616 | } |
1617 | 1617 | ?> |
1618 | 1618 | <option <?php selected( $redirect_page, 'custom_url' ); ?> value="custom_url"><?php echo __( 'Custom URL', 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
@@ -1624,8 +1624,8 @@ discard block |
||
1624 | 1624 | ?> |
1625 | 1625 | </select> |
1626 | 1626 | |
1627 | - <label name="custom-redirect-url" class="custom_redirect_url_label" <?php if( ! isset( $redirect_page ) || $redirect_page != 'custom_url' ) { echo 'style="display:none;"'; } ?>> |
|
1628 | - <?php _e( "Enter Custom URL" , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1627 | + <label name="custom-redirect-url" class="custom_redirect_url_label" <?php if ( ! isset( $redirect_page ) || $redirect_page != 'custom_url' ) { echo 'style="display:none;"'; } ?>> |
|
1628 | + <?php _e( "Enter Custom URL", 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1629 | 1629 | <input type="text" class="widefat custom-redirect-url" name="custom-redirect-url" value="<?php echo $custom_redirect_url; ?>" /> |
1630 | 1630 | </label> |
1631 | 1631 | |
@@ -1642,11 +1642,11 @@ discard block |
||
1642 | 1642 | public function generate_show_some_love_container() { |
1643 | 1643 | // if no active add-ons are installed, |
1644 | 1644 | // lets display our branding and add-on sidebar |
1645 | - if( get_option( 'yikes-easy-mc-active-addons' , array() ) == array() ) { |
|
1645 | + if ( get_option( 'yikes-easy-mc-active-addons', array() ) == array() ) { |
|
1646 | 1646 | |
1647 | 1647 | /* On Edit Forms Page Display Upsell to Customizer */ |
1648 | 1648 | $screen = get_current_screen(); |
1649 | - if( isset( $screen ) && $screen->base == 'admin_page_yikes-mailchimp-edit-form' ) { |
|
1649 | + if ( isset( $screen ) && $screen->base == 'admin_page_yikes-mailchimp-edit-form' ) { |
|
1650 | 1650 | ?> |
1651 | 1651 | |
1652 | 1652 | <div class="postbox yikes-easy-mc-postbox show-some-love-container"> |
@@ -1660,11 +1660,11 @@ discard block |
||
1660 | 1660 | <div class="postbox yikes-easy-mc-postbox show-some-love-container"> |
1661 | 1661 | |
1662 | 1662 | <!-- review us container --> |
1663 | - <h3 data-alt-text="<?php _e( 'About YIKES Inc.', 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'Show YIKES Inc. Some Love' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
1663 | + <h3 data-alt-text="<?php _e( 'About YIKES Inc.', 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'Show YIKES Inc. Some Love', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
1664 | 1664 | <div id="review-yikes-easy-mc" class="inside"> |
1665 | 1665 | |
1666 | 1666 | <p> |
1667 | - <?php _e( 'Leave a review' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1667 | + <?php _e( 'Leave a review', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1668 | 1668 | <p class="star-container"> |
1669 | 1669 | <a href="https://wordpress.org/support/view/plugin-reviews/yikes-inc-easy-mailchimp-extender" target="_blank"> |
1670 | 1670 | <b class="dashicons dashicons-star-filled"></b> |
@@ -1676,21 +1676,21 @@ discard block |
||
1676 | 1676 | </p> |
1677 | 1677 | </p> |
1678 | 1678 | |
1679 | - <?php _e( 'Tweet about it' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1679 | + <?php _e( 'Tweet about it', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1680 | 1680 | <p class="sidebar-container"> |
1681 | 1681 | <a href="https://twitter.com/share" class="twitter-share-button" data-url="https://wordpress.org/plugins/yikes-inc-easy-mailchimp-extender/" data-text="I'm using the Easy Forms for MailChimp plugin by @YikesInc to grow my mailing list - it's awesome! -" data-hashtags="MailChimp">Tweet</a> |
1682 | 1682 | <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script> |
1683 | 1683 | </p> |
1684 | 1684 | |
1685 | - <?php _e( 'Vote that the plugin works' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1685 | + <?php _e( 'Vote that the plugin works', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1686 | 1686 | <p class="sidebar-container"> |
1687 | 1687 | <a href="https://wordpress.org/plugins/yikes-inc-easy-mailchimp-extender/" target="_blank"> |
1688 | - <?php _e( 'Vote for Compatibility' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1688 | + <?php _e( 'Vote for Compatibility', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1689 | 1689 | </a> |
1690 | 1690 | </p> |
1691 | 1691 | </div> |
1692 | 1692 | |
1693 | - <p class="description sidebar-footer-text"><?php printf( __( "This plugin made with %s by %s" , 'yikes-inc-easy-mailchimp-extender' ), '<span class="dashicons dashicons-heart yikes-love"></span>', '<a href="http://www.yikesinc.com" target="_blank" title="YIKES Inc.">YIKES Inc.</a>' ); ?> </p> |
|
1693 | + <p class="description sidebar-footer-text"><?php printf( __( "This plugin made with %s by %s", 'yikes-inc-easy-mailchimp-extender' ), '<span class="dashicons dashicons-heart yikes-love"></span>', '<a href="http://www.yikesinc.com" target="_blank" title="YIKES Inc.">YIKES Inc.</a>' ); ?> </p> |
|
1694 | 1694 | |
1695 | 1695 | <section id="about-yikes-inc" class="inside"> |
1696 | 1696 | <a href="https://www.yikesinc.com" target="_blank" title="YIKES Inc."> |
@@ -1706,10 +1706,10 @@ discard block |
||
1706 | 1706 | <div class="postbox yikes-easy-mc-postbox"> |
1707 | 1707 | |
1708 | 1708 | <!-- review us container --> |
1709 | - <h3><?php _e( 'Easy Forms for MailChimp Add-Ons' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
1709 | + <h3><?php _e( 'Easy Forms for MailChimp Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
1710 | 1710 | <div id="review-yikes-easy-mc" class="inside"> |
1711 | - <p><?php _e( "Check out available add-ons for some seriously enhanced features." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
1712 | - <p><a class="button-secondary" href="<?php echo esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-addons' ) ); ?>" title="<?php _e( 'View Add-Ons' , 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'View Add-Ons' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></p> |
|
1711 | + <p><?php _e( "Check out available add-ons for some seriously enhanced features.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
1712 | + <p><a class="button-secondary" href="<?php echo esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-addons' ) ); ?>" title="<?php _e( 'View Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'View Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?></a></p> |
|
1713 | 1713 | </div> |
1714 | 1714 | |
1715 | 1715 | </div> |
@@ -1734,15 +1734,15 @@ discard block |
||
1734 | 1734 | public function generate_form_editor( $form_fields, $list_id, $merge_variables, $interest_groups ) { |
1735 | 1735 | |
1736 | 1736 | // if no list id, die! |
1737 | - if( ! $list_id ) { |
|
1738 | - wp_die( __( "We've encountered an error. No list ID was sent." , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
1737 | + if ( ! $list_id ) { |
|
1738 | + wp_die( __( "We've encountered an error. No list ID was sent.", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
1739 | 1739 | } |
1740 | 1740 | |
1741 | - if( ! $merge_variables ) { |
|
1742 | - wp_die( __( "We've encountered an error. Reload the page and try again. If the error persists, please reach out to support." , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
1741 | + if ( ! $merge_variables ) { |
|
1742 | + wp_die( __( "We've encountered an error. Reload the page and try again. If the error persists, please reach out to support.", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
1743 | 1743 | } |
1744 | 1744 | |
1745 | - if( ! empty( $form_fields ) ) { |
|
1745 | + if ( ! empty( $form_fields ) ) { |
|
1746 | 1746 | |
1747 | 1747 | // find any fields that are assigned to this form, that don't exist in MailChimp |
1748 | 1748 | // or else were going to run into issues when we submit the form |
@@ -1750,8 +1750,8 @@ discard block |
||
1750 | 1750 | $available_interest_groups = array(); |
1751 | 1751 | |
1752 | 1752 | // loop over merge variables |
1753 | - if ( ! empty( $merge_variables['merge_fields'] ) ) { |
|
1754 | - $available_merge_variables = wp_list_pluck( $merge_variables['merge_fields'], 'tag' ); |
|
1753 | + if ( ! empty( $merge_variables[ 'merge_fields' ] ) ) { |
|
1754 | + $available_merge_variables = wp_list_pluck( $merge_variables[ 'merge_fields' ], 'tag' ); |
|
1755 | 1755 | } |
1756 | 1756 | |
1757 | 1757 | // loop over interest groups |
@@ -1765,38 +1765,38 @@ discard block |
||
1765 | 1765 | $excluded_fields = array_diff( $assigned_fields, $merged_fields ); |
1766 | 1766 | |
1767 | 1767 | $i = 1; |
1768 | - foreach( $form_fields as $field ) { |
|
1768 | + foreach ( $form_fields as $field ) { |
|
1769 | 1769 | |
1770 | - if ( isset( $field['merge'] ) ) { |
|
1770 | + if ( isset( $field[ 'merge' ] ) ) { |
|
1771 | 1771 | // @todo: don't use in_array() |
1772 | - $excluded_field = in_array( $field['merge'], $excluded_fields, true ); |
|
1772 | + $excluded_field = in_array( $field[ 'merge' ], $excluded_fields, true ); |
|
1773 | 1773 | ?> |
1774 | - <section class="draggable" id="<?php echo $field['merge']; ?>"> |
|
1774 | + <section class="draggable" id="<?php echo $field[ 'merge' ]; ?>"> |
|
1775 | 1775 | <!-- top --> |
1776 | 1776 | <a href="#" class="expansion-section-title settings-sidebar"> |
1777 | - <span class="dashicons dashicons-plus"></span><?php echo stripslashes( $field['label'] ); ?> |
|
1777 | + <span class="dashicons dashicons-plus"></span><?php echo stripslashes( $field[ 'label' ] ); ?> |
|
1778 | 1778 | <?php if ( $excluded_field ) { ?> |
1779 | - <img src="<?php echo YIKES_MC_URL . 'includes/images/warning.svg'; ?>" class="field-doesnt-exist-notice" title="<?php _e( 'Field no longer exists.' , 'yikes-inc-easy-mailchimp-extender' ); ?>" alt="<?php _e( 'Field no longer exists.' , 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
1779 | + <img src="<?php echo YIKES_MC_URL . 'includes/images/warning.svg'; ?>" class="field-doesnt-exist-notice" title="<?php _e( 'Field no longer exists.', 'yikes-inc-easy-mailchimp-extender' ); ?>" alt="<?php _e( 'Field no longer exists.', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
1780 | 1780 | <?php } ?> |
1781 | - <span class="field-type-text"><small><?php echo __( 'type' , 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $field['type']; ?></small></span> |
|
1781 | + <span class="field-type-text"><small><?php echo __( 'type', 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $field[ 'type' ]; ?></small></span> |
|
1782 | 1782 | </a> |
1783 | 1783 | <!-- expansion section --> |
1784 | 1784 | <div class="yikes-mc-settings-expansion-section"> |
1785 | 1785 | |
1786 | 1786 | <?php if ( $excluded_field ) { ?> |
1787 | - <p class="yikes-mc-warning-message"><?php _e( "This field no longer exists in this list. Delete this field from the form to prevent issues on your website." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
1787 | + <p class="yikes-mc-warning-message"><?php _e( "This field no longer exists in this list. Delete this field from the form to prevent issues on your website.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
1788 | 1788 | <?php } ?> |
1789 | 1789 | |
1790 | 1790 | <!-- store the label --> |
1791 | - <input type="hidden" name="field[<?php echo $field['merge']; ?>][label]" value="<?php echo $field['label']; ?>" /> |
|
1792 | - <input type="hidden" name="field[<?php echo $field['merge']; ?>][type]" value="<?php echo $field['type']; ?>" /> |
|
1793 | - <input type="hidden" name="field[<?php echo $field['merge']; ?>][merge]" value="<?php echo $field['merge']; ?>" /> |
|
1794 | - <input type="hidden" class="field-<?php echo $field['merge']; ?>-position position-input" name="field[<?php echo $field['merge']; ?>][position]" value="<?php echo $i++; ?>" /> |
|
1791 | + <input type="hidden" name="field[<?php echo $field[ 'merge' ]; ?>][label]" value="<?php echo $field[ 'label' ]; ?>" /> |
|
1792 | + <input type="hidden" name="field[<?php echo $field[ 'merge' ]; ?>][type]" value="<?php echo $field[ 'type' ]; ?>" /> |
|
1793 | + <input type="hidden" name="field[<?php echo $field[ 'merge' ]; ?>][merge]" value="<?php echo $field[ 'merge' ]; ?>" /> |
|
1794 | + <input type="hidden" class="field-<?php echo $field[ 'merge' ]; ?>-position position-input" name="field[<?php echo $field[ 'merge' ]; ?>][position]" value="<?php echo $i++; ?>" /> |
|
1795 | 1795 | |
1796 | - <?php if ( $field['type'] == 'radio' || $field['type'] == 'dropdown' || $field['type'] == 'select' ) { |
|
1797 | - $choices = json_decode( $field['choices'], true ); |
|
1796 | + <?php if ( $field[ 'type' ] == 'radio' || $field[ 'type' ] == 'dropdown' || $field[ 'type' ] == 'select' ) { |
|
1797 | + $choices = json_decode( $field[ 'choices' ], true ); |
|
1798 | 1798 | ?> |
1799 | - <input type="hidden" name="field[<?php echo $field['merge']; ?>][choices]" value='<?php echo esc_attr( json_encode( $choices ) ); ?>' /> |
|
1799 | + <input type="hidden" name="field[<?php echo $field[ 'merge' ]; ?>][choices]" value='<?php echo esc_attr( json_encode( $choices ) ); ?>' /> |
|
1800 | 1800 | <?php } ?> |
1801 | 1801 | |
1802 | 1802 | <!-- Single or Double Opt-in --> |
@@ -1808,16 +1808,16 @@ discard block |
||
1808 | 1808 | <tr valign="top"> |
1809 | 1809 | <td scope="row"> |
1810 | 1810 | <label for="merge-tag"> |
1811 | - <?php _e( 'Merge Tag' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1811 | + <?php _e( 'Merge Tag', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1812 | 1812 | </label> |
1813 | 1813 | </td> |
1814 | 1814 | <td> |
1815 | - <input class="widefat merge-tag-text" type="text" readonly value="<?php echo $field['merge']; ?>"> |
|
1815 | + <input class="widefat merge-tag-text" type="text" readonly value="<?php echo $field[ 'merge' ]; ?>"> |
|
1816 | 1816 | </td> |
1817 | 1817 | </tr> |
1818 | 1818 | |
1819 | 1819 | <!-- Placeholder Value --> |
1820 | - <?php switch( $field['type'] ) { |
|
1820 | + <?php switch ( $field[ 'type' ] ) { |
|
1821 | 1821 | |
1822 | 1822 | case 'text': |
1823 | 1823 | case 'email': |
@@ -1832,12 +1832,12 @@ discard block |
||
1832 | 1832 | <tr valign="top"> |
1833 | 1833 | <td scope="row"> |
1834 | 1834 | <label for="placeholder"> |
1835 | - <?php _e( 'Placeholder' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1835 | + <?php _e( 'Placeholder', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1836 | 1836 | </label> |
1837 | 1837 | </td> |
1838 | 1838 | <td> |
1839 | - <input type="text" class="widefat" name="field[<?php echo $field['merge']; ?>][placeholder]" value="<?php echo isset( $field['placeholder'] ) ? $field['placeholder'] : '' ; ?>" /> |
|
1840 | - <p class="description"><small><?php _e( "Assign a placeholder value to this field.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
1839 | + <input type="text" class="widefat" name="field[<?php echo $field[ 'merge' ]; ?>][placeholder]" value="<?php echo isset( $field[ 'placeholder' ] ) ? $field[ 'placeholder' ] : ''; ?>" /> |
|
1840 | + <p class="description"><small><?php _e( "Assign a placeholder value to this field.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
1841 | 1841 | </td> |
1842 | 1842 | </tr> |
1843 | 1843 | <?php |
@@ -1846,7 +1846,7 @@ discard block |
||
1846 | 1846 | ?> |
1847 | 1847 | |
1848 | 1848 | <!-- Default Value --> |
1849 | - <?php switch( $field['type'] ) { |
|
1849 | + <?php switch ( $field[ 'type' ] ) { |
|
1850 | 1850 | default: |
1851 | 1851 | case 'text': |
1852 | 1852 | case 'number': |
@@ -1855,17 +1855,17 @@ discard block |
||
1855 | 1855 | <tr valign="top"> |
1856 | 1856 | <td scope="row"> |
1857 | 1857 | <label for="placeholder"> |
1858 | - <?php _e( 'Default Value' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1858 | + <?php _e( 'Default Value', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1859 | 1859 | </label> |
1860 | 1860 | </td> |
1861 | 1861 | <td> |
1862 | - <input <?php if( $field['type'] != 'number' ) { ?> type="text" <?php } else { ?> type="number" <?php } ?> class="widefat" name="field[<?php echo $field['merge']; ?>][default]" <?php if( $field['type'] != 'url' ) { ?> value="<?php echo isset( $field['default'] ) ? stripslashes( wp_strip_all_tags( $field['default'] ) ) : ''; ?>" <?php } else { ?> value="<?php echo isset( $field['default'] ) ? stripslashes( wp_strip_all_tags( esc_url_raw( $field['default'] ) ) ) : ''; ?>" <?php } ?> /> |
|
1863 | - <p class="description"><small><?php _e( "Assign a default value to populate this field with on initial page load.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
1862 | + <input <?php if ( $field[ 'type' ] != 'number' ) { ?> type="text" <?php } else { ?> type="number" <?php } ?> class="widefat" name="field[<?php echo $field[ 'merge' ]; ?>][default]" <?php if ( $field[ 'type' ] != 'url' ) { ?> value="<?php echo isset( $field[ 'default' ] ) ? stripslashes( wp_strip_all_tags( $field[ 'default' ] ) ) : ''; ?>" <?php } else { ?> value="<?php echo isset( $field[ 'default' ] ) ? stripslashes( wp_strip_all_tags( esc_url_raw( $field[ 'default' ] ) ) ) : ''; ?>" <?php } ?> /> |
|
1863 | + <p class="description"><small><?php _e( "Assign a default value to populate this field with on initial page load.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
1864 | 1864 | <?php |
1865 | - switch( $field['type'] ) { |
|
1865 | + switch ( $field[ 'type' ] ) { |
|
1866 | 1866 | case 'text': |
1867 | 1867 | ?> |
1868 | - <p><small class="pre-defined-tag-link"><a href="#TB_inline?width=600&height=550&inlineId=pre-defined-tag-container" onclick="storeGlobalClicked( jQuery( this ) );" class="thickbox"><?php _e( 'View Pre-Defined Tags' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></p> |
|
1868 | + <p><small class="pre-defined-tag-link"><a href="#TB_inline?width=600&height=550&inlineId=pre-defined-tag-container" onclick="storeGlobalClicked( jQuery( this ) );" class="thickbox"><?php _e( 'View Pre-Defined Tags', 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></p> |
|
1869 | 1869 | <?php |
1870 | 1870 | break; |
1871 | 1871 | } ?> |
@@ -1879,25 +1879,25 @@ discard block |
||
1879 | 1879 | <tr valign="top"> |
1880 | 1880 | <td scope="row"> |
1881 | 1881 | <label for="placeholder"> |
1882 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1882 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1883 | 1883 | </label> |
1884 | 1884 | </td> |
1885 | 1885 | <td> |
1886 | 1886 | <?php |
1887 | - if ( ! isset( $field['default_choice'] ) ) { |
|
1888 | - $field['default_choice'] = 0; |
|
1887 | + if ( ! isset( $field[ 'default_choice' ] ) ) { |
|
1888 | + $field[ 'default_choice' ] = 0; |
|
1889 | 1889 | } |
1890 | 1890 | $x = 0; |
1891 | 1891 | foreach ( $choices as $choice => $value ) { ?> |
1892 | - <label for="<?php echo $field['merge'].'-'.$x; ?>"> |
|
1893 | - <input id="<?php echo $field['merge'].'-'.$x; ?>" |
|
1892 | + <label for="<?php echo $field[ 'merge' ] . '-' . $x; ?>"> |
|
1893 | + <input id="<?php echo $field[ 'merge' ] . '-' . $x; ?>" |
|
1894 | 1894 | type="radio" |
1895 | - name="field[<?php echo $field['merge']; ?>][default_choice]" |
|
1896 | - value="<?php echo $x; ?>" <?php checked( $field['default_choice'], $x ); ?>> |
|
1895 | + name="field[<?php echo $field[ 'merge' ]; ?>][default_choice]" |
|
1896 | + value="<?php echo $x; ?>" <?php checked( $field[ 'default_choice' ], $x ); ?>> |
|
1897 | 1897 | <?php echo $value; ?> |
1898 | 1898 | </label> |
1899 | 1899 | <?php $x++; } ?> |
1900 | - <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
1900 | + <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
1901 | 1901 | </td> |
1902 | 1902 | </tr> |
1903 | 1903 | |
@@ -1909,16 +1909,16 @@ discard block |
||
1909 | 1909 | <tr valign="top"> |
1910 | 1910 | <td scope="row"> |
1911 | 1911 | <label for="placeholder"> |
1912 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1912 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1913 | 1913 | </label> |
1914 | 1914 | </td> |
1915 | 1915 | <td> |
1916 | - <select type="default" name="field[<?php echo $field['merge']; ?>][default_choice]"> |
|
1917 | - <?php foreach( json_decode( $field['choices'], true ) as $choice => $value ) { ?> |
|
1918 | - <option value="<?php echo $choice; ?>" <?php selected( $field['default_choice'] , $choice ); ?>><?php echo $value; ?></option> |
|
1916 | + <select type="default" name="field[<?php echo $field[ 'merge' ]; ?>][default_choice]"> |
|
1917 | + <?php foreach ( json_decode( $field[ 'choices' ], true ) as $choice => $value ) { ?> |
|
1918 | + <option value="<?php echo $choice; ?>" <?php selected( $field[ 'default_choice' ], $choice ); ?>><?php echo $value; ?></option> |
|
1919 | 1919 | <?php } ?> |
1920 | 1920 | </select> |
1921 | - <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
1921 | + <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
1922 | 1922 | </td> |
1923 | 1923 | </tr> |
1924 | 1924 | |
@@ -1938,69 +1938,69 @@ discard block |
||
1938 | 1938 | <tr valign="top"> |
1939 | 1939 | <td scope="row"> |
1940 | 1940 | <label for="placeholder"> |
1941 | - <?php _e( 'Description' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1941 | + <?php _e( 'Description', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1942 | 1942 | </label> |
1943 | 1943 | </td> |
1944 | 1944 | <td> |
1945 | - <textarea class="widefat field-description-input" name="field[<?php echo $field['merge']; ?>][description]"><?php echo isset( $field['description'] ) ? stripslashes( esc_html( $field['description'] ) ) : '' ; ?></textarea> |
|
1946 | - <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and will provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
1945 | + <textarea class="widefat field-description-input" name="field[<?php echo $field[ 'merge' ]; ?>][description]"><?php echo isset( $field[ 'description' ] ) ? stripslashes( esc_html( $field[ 'description' ] ) ) : ''; ?></textarea> |
|
1946 | + <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and will provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
1947 | 1947 | </td> |
1948 | 1948 | </tr> |
1949 | 1949 | <!-- Additional Classes --> |
1950 | 1950 | <tr valign="top"> |
1951 | 1951 | <td scope="row"> |
1952 | 1952 | <label for="placeholder"> |
1953 | - <?php _e( 'Additional Classes' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1953 | + <?php _e( 'Additional Classes', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1954 | 1954 | </label> |
1955 | 1955 | </td> |
1956 | 1956 | <td> |
1957 | - <input type="text" class="widefat" name="field[<?php echo $field['merge']; ?>][additional-classes]" value="<?php echo isset( $field['additional-classes'] ) ? stripslashes( wp_strip_all_tags( $field['additional-classes'] ) ) : '' ; ?>" /> |
|
1958 | - <p class="description"><small><?php printf( __( "Assign additional classes to this field. %s.", 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/bundled-css-classes/' ) . '">' . __( 'View bundled classes', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' );?></small></p> |
|
1957 | + <input type="text" class="widefat" name="field[<?php echo $field[ 'merge' ]; ?>][additional-classes]" value="<?php echo isset( $field[ 'additional-classes' ] ) ? stripslashes( wp_strip_all_tags( $field[ 'additional-classes' ] ) ) : ''; ?>" /> |
|
1958 | + <p class="description"><small><?php printf( __( "Assign additional classes to this field. %s.", 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/bundled-css-classes/' ) . '">' . __( 'View bundled classes', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ); ?></small></p> |
|
1959 | 1959 | </td> |
1960 | 1960 | </tr> |
1961 | 1961 | <!-- Required Toggle --> |
1962 | 1962 | <tr valign="top"> |
1963 | 1963 | <td scope="row"> |
1964 | 1964 | <label for="field-required"> |
1965 | - <?php _e( 'Field Required?' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1965 | + <?php _e( 'Field Required?', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1966 | 1966 | </label> |
1967 | 1967 | </td> |
1968 | 1968 | <td> |
1969 | - <?php $checked = isset( $field['require'] ) ? $field['require'] : '0'; ?> |
|
1970 | - <input type="checkbox" class="widefat" value="1" name="field[<?php echo $field['merge']; ?>][require]" <?php checked( $checked , 1 ); ?> <?php if( $field['merge'] == 'EMAIL' ) { ?> disabled="disabled" checked="checked" title="<?php echo __( 'Email is a required field.' , 'yikes-inc-easy-mailchimp-extender' ); } ?>"> |
|
1971 | - <p class="description"><small><?php _e( "Require this field to be filled in before the form can be submitted.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
1969 | + <?php $checked = isset( $field[ 'require' ] ) ? $field[ 'require' ] : '0'; ?> |
|
1970 | + <input type="checkbox" class="widefat" value="1" name="field[<?php echo $field[ 'merge' ]; ?>][require]" <?php checked( $checked, 1 ); ?> <?php if ( $field[ 'merge' ] == 'EMAIL' ) { ?> disabled="disabled" checked="checked" title="<?php echo __( 'Email is a required field.', 'yikes-inc-easy-mailchimp-extender' ); } ?>"> |
|
1971 | + <p class="description"><small><?php _e( "Require this field to be filled in before the form can be submitted.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
1972 | 1972 | </td> |
1973 | 1973 | </tr> |
1974 | 1974 | <!-- Visible Toggle --> |
1975 | 1975 | <tr valign="top"> |
1976 | 1976 | <td scope="row"> |
1977 | 1977 | <label for="hide-field"> |
1978 | - <?php _e( 'Hide Field' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1978 | + <?php _e( 'Hide Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1979 | 1979 | </label> |
1980 | 1980 | </td> |
1981 | 1981 | <td> |
1982 | - <?php $hide = isset( $field['hide'] ) ? $field['hide'] : '0'; ?> |
|
1983 | - <input type="checkbox" class="widefat" value="1" name="field[<?php echo $field['merge']; ?>][hide]" <?php checked( $hide , 1 ); ?> <?php if( $field['merge'] == 'EMAIL' ) { ?> disabled="disabled" title="<?php echo __( 'Cannot toggle email field visibility.' , 'yikes-inc-easy-mailchimp-extender' ); } ?>"> |
|
1984 | - <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
1982 | + <?php $hide = isset( $field[ 'hide' ] ) ? $field[ 'hide' ] : '0'; ?> |
|
1983 | + <input type="checkbox" class="widefat" value="1" name="field[<?php echo $field[ 'merge' ]; ?>][hide]" <?php checked( $hide, 1 ); ?> <?php if ( $field[ 'merge' ] == 'EMAIL' ) { ?> disabled="disabled" title="<?php echo __( 'Cannot toggle email field visibility.', 'yikes-inc-easy-mailchimp-extender' ); } ?>"> |
|
1984 | + <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
1985 | 1985 | </td> |
1986 | 1986 | </tr> |
1987 | 1987 | <!-- Toggle Field Label Visibility --> |
1988 | 1988 | <tr valign="top"> |
1989 | 1989 | <td scope="row"> |
1990 | 1990 | <label for="placeholder"> |
1991 | - <?php _e( 'Hide Label' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1991 | + <?php _e( 'Hide Label', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1992 | 1992 | </label> |
1993 | 1993 | </td> |
1994 | 1994 | <td> |
1995 | - <?php $hide_label = isset( $field['hide-label'] ) ? $field['hide-label'] : '0'; ?> |
|
1996 | - <input type="checkbox" name="field[<?php echo $field['merge']; ?>][hide-label]" value="1" <?php checked( $hide_label , 1 ); ?>/> |
|
1997 | - <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
1995 | + <?php $hide_label = isset( $field[ 'hide-label' ] ) ? $field[ 'hide-label' ] : '0'; ?> |
|
1996 | + <input type="checkbox" name="field[<?php echo $field[ 'merge' ]; ?>][hide-label]" value="1" <?php checked( $hide_label, 1 ); ?>/> |
|
1997 | + <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
1998 | 1998 | </td> |
1999 | 1999 | </tr> |
2000 | 2000 | <!-- Display Phone/Date Formats back to the user --> |
2001 | 2001 | <!-- Phone Format Initial Load --> |
2002 | 2002 | <?php |
2003 | - switch( $field['type'] ) { |
|
2003 | + switch ( $field[ 'type' ] ) { |
|
2004 | 2004 | /* Store the phone format, for properly regex pattern */ |
2005 | 2005 | case 'phone': |
2006 | 2006 | case 'birthday': |
@@ -2010,23 +2010,23 @@ discard block |
||
2010 | 2010 | <td scope="row"> |
2011 | 2011 | <label for="placeholder"> |
2012 | 2012 | <?php |
2013 | - switch( $field['type'] ) { |
|
2013 | + switch ( $field[ 'type' ] ) { |
|
2014 | 2014 | default: |
2015 | 2015 | case 'birthday': |
2016 | - $type = __( 'Date Format' , 'yikes-inc-easy-mailchimp-extender' ); |
|
2017 | - $format = ( isset( $field['date_format'] ) ) ? $field['date_format'] : 'MM/DD'; |
|
2016 | + $type = __( 'Date Format', 'yikes-inc-easy-mailchimp-extender' ); |
|
2017 | + $format = ( isset( $field[ 'date_format' ] ) ) ? $field[ 'date_format' ] : 'MM/DD'; |
|
2018 | 2018 | $format_name = 'date_format'; |
2019 | 2019 | break; |
2020 | 2020 | |
2021 | 2021 | case 'date': |
2022 | - $type = __( 'Date Format' , 'yikes-inc-easy-mailchimp-extender' ); |
|
2023 | - $format = ( isset( $field['date_format'] ) ) ? $field['date_format'] : 'MM/DD/YYYY'; |
|
2022 | + $type = __( 'Date Format', 'yikes-inc-easy-mailchimp-extender' ); |
|
2023 | + $format = ( isset( $field[ 'date_format' ] ) ) ? $field[ 'date_format' ] : 'MM/DD/YYYY'; |
|
2024 | 2024 | $format_name = 'date_format'; |
2025 | 2025 | break; |
2026 | 2026 | |
2027 | 2027 | case 'phone': |
2028 | - $type = __( 'Phone Format' , 'yikes-inc-easy-mailchimp-extender' ); |
|
2029 | - $format = isset( $field['phone_format'] ) && ! empty( $field['phone_format'] ) ? $field['phone_format'] : __( 'International', 'yikes-inc-easy-mailchimp-extender' ); |
|
2028 | + $type = __( 'Phone Format', 'yikes-inc-easy-mailchimp-extender' ); |
|
2029 | + $format = isset( $field[ 'phone_format' ] ) && ! empty( $field[ 'phone_format' ] ) ? $field[ 'phone_format' ] : __( 'International', 'yikes-inc-easy-mailchimp-extender' ); |
|
2030 | 2030 | $format_name = 'phone_format'; |
2031 | 2031 | break; |
2032 | 2032 | } |
@@ -2036,7 +2036,7 @@ discard block |
||
2036 | 2036 | </td> |
2037 | 2037 | <td> |
2038 | 2038 | <strong><?php echo $format; ?></strong> |
2039 | - <input type="hidden" name="field[<?php echo $field['merge']; ?>][<?php echo $format_name; ?>]" value="<?php echo $format; ?>" /> |
|
2039 | + <input type="hidden" name="field[<?php echo $field[ 'merge' ]; ?>][<?php echo $format_name; ?>]" value="<?php echo $format; ?>" /> |
|
2040 | 2040 | <p class="description"><small> |
2041 | 2041 | <?php printf( __( 'To change the %s please head over to <a href="%s" title="MailChimp" target="_blank">MailChimp</a>. If you alter the format, you should re-import this field.', 'yikes-inc-easy-mailchimp-extender' ), strtolower( $type ), esc_url( 'http://www.mailchimp.com' ) ); ?> |
2042 | 2042 | </small></p> |
@@ -2057,8 +2057,8 @@ discard block |
||
2057 | 2057 | </td> |
2058 | 2058 | <td> |
2059 | 2059 | <span class="toggle-container"> |
2060 | - <a href="#" class="close-form-expansion"><?php _e( "Close" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
2061 | - <a href="#" class="remove-field" alt="<?php echo $field['merge']; ?>"><?php _e( "Remove Field" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
2060 | + <a href="#" class="close-form-expansion"><?php _e( "Close", 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
2061 | + <a href="#" class="remove-field" alt="<?php echo $field[ 'merge' ]; ?>"><?php _e( "Remove Field", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
2062 | 2062 | </span> |
2063 | 2063 | </td> |
2064 | 2064 | </tr> |
@@ -2074,35 +2074,35 @@ discard block |
||
2074 | 2074 | } else { // THIS IS AN INTEREST GROUP! |
2075 | 2075 | |
2076 | 2076 | ?> |
2077 | - <section class="draggable" id="<?php echo $field['group_id']; ?>"> |
|
2077 | + <section class="draggable" id="<?php echo $field[ 'group_id' ]; ?>"> |
|
2078 | 2078 | <!-- top --> |
2079 | 2079 | <a href="#" class="expansion-section-title settings-sidebar"> |
2080 | - <span class="dashicons dashicons-plus"></span><?php echo stripslashes( $field['label'] ); ?> |
|
2081 | - <?php if( in_array( $field['group_id'] , $excluded_fields ) ) { ?> |
|
2082 | - <img src="<?php echo YIKES_MC_URL . 'includes/images/warning.svg'; ?>" class="field-no-longer-exists-warning" title="<?php _e( 'Field no longer exists.' , 'yikes-inc-easy-mailchimp-extender' ); ?>" alt="<?php _e( 'Field no longer exists.' , 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
2080 | + <span class="dashicons dashicons-plus"></span><?php echo stripslashes( $field[ 'label' ] ); ?> |
|
2081 | + <?php if ( in_array( $field[ 'group_id' ], $excluded_fields ) ) { ?> |
|
2082 | + <img src="<?php echo YIKES_MC_URL . 'includes/images/warning.svg'; ?>" class="field-no-longer-exists-warning" title="<?php _e( 'Field no longer exists.', 'yikes-inc-easy-mailchimp-extender' ); ?>" alt="<?php _e( 'Field no longer exists.', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
2083 | 2083 | <?php } ?> |
2084 | - <span class="field-type-text"><small><?php echo __( 'type' , 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $field['type']; ?></small></span> |
|
2084 | + <span class="field-type-text"><small><?php echo __( 'type', 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $field[ 'type' ]; ?></small></span> |
|
2085 | 2085 | </a> |
2086 | 2086 | <!-- expansion section --> |
2087 | 2087 | <div class="yikes-mc-settings-expansion-section"> |
2088 | 2088 | |
2089 | 2089 | <!-- check if this field exists in the available interest group array --> |
2090 | - <?php if( in_array( $field['group_id'] , $excluded_fields ) ) { ?> |
|
2091 | - <p class="yikes-mc-warning-message"><?php _e( "This field no longer exists in this list. Delete this field from the form to prevent issues on the front end." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
2090 | + <?php if ( in_array( $field[ 'group_id' ], $excluded_fields ) ) { ?> |
|
2091 | + <p class="yikes-mc-warning-message"><?php _e( "This field no longer exists in this list. Delete this field from the form to prevent issues on the front end.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
2092 | 2092 | <?php } ?> |
2093 | 2093 | |
2094 | 2094 | <!-- store the label --> |
2095 | - <input type="hidden" name="field[<?php echo $field['group_id']; ?>][label]" value="<?php echo $field['label']; ?>" /> |
|
2096 | - <input type="hidden" name="field[<?php echo $field['group_id']; ?>][type]" value="<?php echo $field['type']; ?>" /> |
|
2097 | - <input type="hidden" name="field[<?php echo $field['group_id']; ?>][group_id]" value="<?php echo $field['group_id']; ?>" /> |
|
2098 | - <input type="hidden" name="field[<?php echo $field['group_id']; ?>][groups]" value='<?php echo esc_attr( json_encode( json_decode( $field['groups'], true ) ) ); ?>' /> |
|
2095 | + <input type="hidden" name="field[<?php echo $field[ 'group_id' ]; ?>][label]" value="<?php echo $field[ 'label' ]; ?>" /> |
|
2096 | + <input type="hidden" name="field[<?php echo $field[ 'group_id' ]; ?>][type]" value="<?php echo $field[ 'type' ]; ?>" /> |
|
2097 | + <input type="hidden" name="field[<?php echo $field[ 'group_id' ]; ?>][group_id]" value="<?php echo $field[ 'group_id' ]; ?>" /> |
|
2098 | + <input type="hidden" name="field[<?php echo $field[ 'group_id' ]; ?>][groups]" value='<?php echo esc_attr( json_encode( json_decode( $field[ 'groups' ], true ) ) ); ?>' /> |
|
2099 | 2099 | |
2100 | 2100 | <!-- Single or Double Opt-in --> |
2101 | 2101 | <p class="type-container"><!-- necessary to prevent skipping on slideToggle(); --> |
2102 | 2102 | |
2103 | 2103 | <table class="form-table form-field-container"> |
2104 | 2104 | <!-- Default Value --> |
2105 | - <?php switch( $field['type'] ) { |
|
2105 | + <?php switch ( $field[ 'type' ] ) { |
|
2106 | 2106 | |
2107 | 2107 | default: |
2108 | 2108 | case 'radio': |
@@ -2111,22 +2111,22 @@ discard block |
||
2111 | 2111 | <tr valign="top"> |
2112 | 2112 | <td scope="row"> |
2113 | 2113 | <label for="placeholder"> |
2114 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2114 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2115 | 2115 | </label> |
2116 | 2116 | </td> |
2117 | 2117 | <td> |
2118 | 2118 | <?php |
2119 | - if( $field['type'] != 'checkboxes' ) { |
|
2120 | - if( ! isset( $field['default_choice'] ) ) { $field['default_choice'] = json_decode( stripslashes( $field['groups'] ) , true ); } |
|
2119 | + if ( $field[ 'type' ] != 'checkboxes' ) { |
|
2120 | + if ( ! isset( $field[ 'default_choice' ] ) ) { $field[ 'default_choice' ] = json_decode( stripslashes( $field[ 'groups' ] ), true ); } |
|
2121 | 2121 | } else { |
2122 | - if ( ! isset( $field['default_choice'] ) ) { $field['default_choice'] = array(); } |
|
2122 | + if ( ! isset( $field[ 'default_choice' ] ) ) { $field[ 'default_choice' ] = array(); } |
|
2123 | 2123 | } |
2124 | 2124 | |
2125 | - foreach( json_decode( $field['groups'], true ) as $id => $group ) { |
|
2126 | - $field_id = "{$field['group_id']}-{$id}"; |
|
2127 | - $field_type = 'hidden' == $field['type'] ? 'radio' : $field['type']; |
|
2125 | + foreach ( json_decode( $field[ 'groups' ], true ) as $id => $group ) { |
|
2126 | + $field_id = "{$field[ 'group_id' ]}-{$id}"; |
|
2127 | + $field_type = 'hidden' == $field[ 'type' ] ? 'radio' : $field[ 'type' ]; |
|
2128 | 2128 | $field_type = 'checkboxes' == $field_type ? 'checkbox' : $field_type; |
2129 | - $field_name = "field[{$field['group_id']}][default_choice]"; |
|
2129 | + $field_name = "field[{$field[ 'group_id' ]}][default_choice]"; |
|
2130 | 2130 | $field_name = 'checkbox' == $field_type ? $field_name . '[]' : $field_name; |
2131 | 2131 | |
2132 | 2132 | // Determine if the current group is checked. |
@@ -2135,11 +2135,11 @@ discard block |
||
2135 | 2135 | case 'radio': |
2136 | 2136 | case 'hidden': |
2137 | 2137 | default: |
2138 | - $checked = checked( $field['default_choice'], $id, false ); |
|
2138 | + $checked = checked( $field[ 'default_choice' ], $id, false ); |
|
2139 | 2139 | break; |
2140 | 2140 | |
2141 | 2141 | case 'checkbox': |
2142 | - if ( in_array( $id, (array) $field['default_choice'] ) ) { |
|
2142 | + if ( in_array( $id, (array) $field[ 'default_choice' ] ) ) { |
|
2143 | 2143 | $checked = checked( true, true, false ); |
2144 | 2144 | } |
2145 | 2145 | } |
@@ -2150,11 +2150,11 @@ discard block |
||
2150 | 2150 | type="<?php echo $field_type; ?>" |
2151 | 2151 | name="<?php echo $field_name; ?>" |
2152 | 2152 | value="<?php echo $id; ?>" <?php echo $checked; ?>> |
2153 | - <?php echo stripslashes( str_replace( '\'' , '' , $group ) ); ?> |
|
2153 | + <?php echo stripslashes( str_replace( '\'', '', $group ) ); ?> |
|
2154 | 2154 | </label> |
2155 | 2155 | <?php |
2156 | 2156 | } ?> |
2157 | - <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
2157 | + <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
2158 | 2158 | </td> |
2159 | 2159 | </tr> |
2160 | 2160 | |
@@ -2166,16 +2166,16 @@ discard block |
||
2166 | 2166 | <tr valign="top"> |
2167 | 2167 | <td scope="row"> |
2168 | 2168 | <label for="placeholder"> |
2169 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2169 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2170 | 2170 | </label> |
2171 | 2171 | </td> |
2172 | 2172 | <td> |
2173 | - <select type="default" name="field[<?php echo $field['group_id']; ?>][default_choice]"> |
|
2174 | - <?php foreach( json_decode( stripslashes_deep( $field['groups'] ) , true ) as $id => $group ) { ?> |
|
2175 | - <option value="<?php echo $id; ?>" <?php selected( $field['default_choice'] , $id ); ?>><?php echo stripslashes( $group ); ?></option> |
|
2173 | + <select type="default" name="field[<?php echo $field[ 'group_id' ]; ?>][default_choice]"> |
|
2174 | + <?php foreach ( json_decode( stripslashes_deep( $field[ 'groups' ] ), true ) as $id => $group ) { ?> |
|
2175 | + <option value="<?php echo $id; ?>" <?php selected( $field[ 'default_choice' ], $id ); ?>><?php echo stripslashes( $group ); ?></option> |
|
2176 | 2176 | <?php } ?> |
2177 | 2177 | </select> |
2178 | - <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
2178 | + <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
2179 | 2179 | </td> |
2180 | 2180 | </tr> |
2181 | 2181 | |
@@ -2189,12 +2189,12 @@ discard block |
||
2189 | 2189 | <tr valign="top"> |
2190 | 2190 | <td scope="row"> |
2191 | 2191 | <label for="placeholder"> |
2192 | - <?php _e( 'Description' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2192 | + <?php _e( 'Description', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2193 | 2193 | </label> |
2194 | 2194 | </td> |
2195 | 2195 | <td> |
2196 | - <textarea class="widefat field-description-input" name="field[<?php echo $field['group_id']; ?>][description]"><?php echo isset( $field['description'] ) ? stripslashes( esc_html( $field['description'] ) ) : '' ; ?></textarea> |
|
2197 | - <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
2196 | + <textarea class="widefat field-description-input" name="field[<?php echo $field[ 'group_id' ]; ?>][description]"><?php echo isset( $field[ 'description' ] ) ? stripslashes( esc_html( $field[ 'description' ] ) ) : ''; ?></textarea> |
|
2197 | + <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
2198 | 2198 | </td> |
2199 | 2199 | </tr> |
2200 | 2200 | |
@@ -2202,51 +2202,51 @@ discard block |
||
2202 | 2202 | <tr valign="top"> |
2203 | 2203 | <td scope="row"> |
2204 | 2204 | <label for="placeholder"> |
2205 | - <?php _e( 'Additional Classes' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2205 | + <?php _e( 'Additional Classes', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2206 | 2206 | </label> |
2207 | 2207 | </td> |
2208 | 2208 | <td> |
2209 | - <input type="text" class="widefat" name="field[<?php echo $field['group_id']; ?>][additional-classes]" value="<?php echo isset( $field['additional-classes'] ) ? stripslashes( wp_strip_all_tags( $field['additional-classes'] ) ) : '' ; ?>" /> |
|
2210 | - <p class="description"><small><?php printf( __( "Assign additional classes to this field. %s.", 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/bundled-css-classes/' ) . '">' . __( 'View bundled classes', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' );?></small></p> |
|
2209 | + <input type="text" class="widefat" name="field[<?php echo $field[ 'group_id' ]; ?>][additional-classes]" value="<?php echo isset( $field[ 'additional-classes' ] ) ? stripslashes( wp_strip_all_tags( $field[ 'additional-classes' ] ) ) : ''; ?>" /> |
|
2210 | + <p class="description"><small><?php printf( __( "Assign additional classes to this field. %s.", 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/bundled-css-classes/' ) . '">' . __( 'View bundled classes', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ); ?></small></p> |
|
2211 | 2211 | </td> |
2212 | 2212 | </tr> |
2213 | 2213 | <!-- Required Toggle --> |
2214 | 2214 | <tr valign="top"> |
2215 | 2215 | <td scope="row"> |
2216 | 2216 | <label for="field-required"> |
2217 | - <?php _e( 'Field Required?' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2217 | + <?php _e( 'Field Required?', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2218 | 2218 | </label> |
2219 | 2219 | </td> |
2220 | 2220 | <td> |
2221 | - <?php $checked = isset( $field['require'] ) ? $field['require'] : '0'; ?> |
|
2222 | - <input type="checkbox" class="widefat" value="1" name="field[<?php echo $field['group_id']; ?>][require]" <?php checked( $checked , 1 ); ?>> |
|
2223 | - <p class="description"><small><?php _e( "Require this field to be filled in before the form can be submitted.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
2221 | + <?php $checked = isset( $field[ 'require' ] ) ? $field[ 'require' ] : '0'; ?> |
|
2222 | + <input type="checkbox" class="widefat" value="1" name="field[<?php echo $field[ 'group_id' ]; ?>][require]" <?php checked( $checked, 1 ); ?>> |
|
2223 | + <p class="description"><small><?php _e( "Require this field to be filled in before the form can be submitted.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
2224 | 2224 | </td> |
2225 | 2225 | </tr> |
2226 | 2226 | <!-- Visible Toggle --> |
2227 | 2227 | <tr valign="top"> |
2228 | 2228 | <td scope="row"> |
2229 | 2229 | <label for="hide-field"> |
2230 | - <?php _e( 'Hide Field' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2230 | + <?php _e( 'Hide Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2231 | 2231 | </label> |
2232 | 2232 | </td> |
2233 | 2233 | <td> |
2234 | - <?php $hide = isset( $field['hide'] ) ? $field['hide'] : '0'; ?> |
|
2235 | - <input type="checkbox" class="widefat" value="1" name="field[<?php echo $field['group_id']; ?>][hide]" <?php checked( $hide , 1 ); ?>> |
|
2236 | - <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
2234 | + <?php $hide = isset( $field[ 'hide' ] ) ? $field[ 'hide' ] : '0'; ?> |
|
2235 | + <input type="checkbox" class="widefat" value="1" name="field[<?php echo $field[ 'group_id' ]; ?>][hide]" <?php checked( $hide, 1 ); ?>> |
|
2236 | + <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
2237 | 2237 | </td> |
2238 | 2238 | </tr> |
2239 | 2239 | <!-- Toggle Field Label Visibility --> |
2240 | 2240 | <tr valign="top"> |
2241 | 2241 | <td scope="row"> |
2242 | 2242 | <label for="placeholder"> |
2243 | - <?php _e( 'Hide Label' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2243 | + <?php _e( 'Hide Label', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2244 | 2244 | </label> |
2245 | 2245 | </td> |
2246 | 2246 | <td> |
2247 | - <?php $hide = isset( $field['hide-label'] ) ? $field['hide-label'] : '0'; ?> |
|
2248 | - <input type="checkbox" name="field[<?php echo $field['group_id']; ?>][hide-label]" value="1" <?php checked( $hide , 1 ); ?>/> |
|
2249 | - <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
2247 | + <?php $hide = isset( $field[ 'hide-label' ] ) ? $field[ 'hide-label' ] : '0'; ?> |
|
2248 | + <input type="checkbox" name="field[<?php echo $field[ 'group_id' ]; ?>][hide-label]" value="1" <?php checked( $hide, 1 ); ?>/> |
|
2249 | + <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
2250 | 2250 | </td> |
2251 | 2251 | </tr> |
2252 | 2252 | <!-- Toggle Buttons --> |
@@ -2256,8 +2256,8 @@ discard block |
||
2256 | 2256 | </td> |
2257 | 2257 | <td> |
2258 | 2258 | <span class="toggle-container"> |
2259 | - <a href="#" class="close-form-expansion"><?php _e( "Close" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
2260 | - <a href="#" class="remove-field" alt="<?php echo $field['group_id']; ?>"><?php _e( "Remove Field" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
2259 | + <a href="#" class="close-form-expansion"><?php _e( "Close", 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
2260 | + <a href="#" class="remove-field" alt="<?php echo $field[ 'group_id' ]; ?>"><?php _e( "Remove Field", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
2261 | 2261 | </span> |
2262 | 2262 | </td> |
2263 | 2263 | </tr> |
@@ -2271,38 +2271,38 @@ discard block |
||
2271 | 2271 | } |
2272 | 2272 | } else { |
2273 | 2273 | ?> |
2274 | - <h4 class="no-fields-assigned-notice non-draggable-yikes"><em><?php _e( 'No fields are assigned to this form. Select fields from the right hand column to add to this form.' , 'yikes-inc-easy-mailchimp-extender' ); ?></em></h4> |
|
2274 | + <h4 class="no-fields-assigned-notice non-draggable-yikes"><em><?php _e( 'No fields are assigned to this form. Select fields from the right hand column to add to this form.', 'yikes-inc-easy-mailchimp-extender' ); ?></em></h4> |
|
2275 | 2275 | <?php |
2276 | 2276 | } |
2277 | 2277 | /* Pre Defined Merge Tag Container - Always rendered so the modal appears and links are clickable on initial page load */ |
2278 | 2278 | add_thickbox(); |
2279 | 2279 | // enqueue jquery qtip for our tooltip |
2280 | - wp_enqueue_script( 'jquery-qtip-tooltip' , YIKES_MC_URL . 'admin/js/min/jquery.qtip.min.js' , array( 'jquery' ) ); |
|
2281 | - wp_enqueue_style( 'jquery-qtip-style' , YIKES_MC_URL . 'admin/css/jquery.qtip.min.css' ); |
|
2280 | + wp_enqueue_script( 'jquery-qtip-tooltip', YIKES_MC_URL . 'admin/js/min/jquery.qtip.min.js', array( 'jquery' ) ); |
|
2281 | + wp_enqueue_style( 'jquery-qtip-style', YIKES_MC_URL . 'admin/css/jquery.qtip.min.css' ); |
|
2282 | 2282 | $available_tags = array( |
2283 | 2283 | array( |
2284 | 2284 | 'tag' => '{page_title}', |
2285 | - 'description' => '<h4 class="tooltip-title">' . __( 'Page Title', 'yikes-inc-easy-mailchimp-extender' ) . ' | <small>{page_title}</small></h4><hr />' . __( 'Pre-populate the field with the current page or post title that the user is on when opting in to your mailing list.' , 'yikes-inc-easy-mailchimp-extender' ), |
|
2285 | + 'description' => '<h4 class="tooltip-title">' . __( 'Page Title', 'yikes-inc-easy-mailchimp-extender' ) . ' | <small>{page_title}</small></h4><hr />' . __( 'Pre-populate the field with the current page or post title that the user is on when opting in to your mailing list.', 'yikes-inc-easy-mailchimp-extender' ), |
|
2286 | 2286 | 'title' => __( 'Page Title', 'yikes-inc-easy-mailchimp-extender' ) |
2287 | 2287 | ), |
2288 | 2288 | array( |
2289 | 2289 | 'tag' => '{page_id}', |
2290 | - 'description' => '<h4 class="tooltip-title">' . __( 'Page ID', 'yikes-inc-easy-mailchimp-extender' ) . ' | <small>{page_id}</small></h4><hr />' . __( 'Pre-populate the field with the current page or post ID that the user is on when opting in to your mailing list.' , 'yikes-inc-easy-mailchimp-extender' ), |
|
2290 | + 'description' => '<h4 class="tooltip-title">' . __( 'Page ID', 'yikes-inc-easy-mailchimp-extender' ) . ' | <small>{page_id}</small></h4><hr />' . __( 'Pre-populate the field with the current page or post ID that the user is on when opting in to your mailing list.', 'yikes-inc-easy-mailchimp-extender' ), |
|
2291 | 2291 | 'title' => __( 'Page ID', 'yikes-inc-easy-mailchimp-extender' ) |
2292 | 2292 | ), |
2293 | 2293 | array( |
2294 | 2294 | 'tag' => '{page_url}', |
2295 | - 'description' => '<h4 class="tooltip-title">' . __( 'Page URL', 'yikes-inc-easy-mailchimp-extender' ) . ' | <small>{page_url}</small></h4><hr />' . __( 'Pre-populate the field with the current page URL that the user is on when opting in to your mailing list.' , 'yikes-inc-easy-mailchimp-extender' ), |
|
2295 | + 'description' => '<h4 class="tooltip-title">' . __( 'Page URL', 'yikes-inc-easy-mailchimp-extender' ) . ' | <small>{page_url}</small></h4><hr />' . __( 'Pre-populate the field with the current page URL that the user is on when opting in to your mailing list.', 'yikes-inc-easy-mailchimp-extender' ), |
|
2296 | 2296 | 'title' => __( 'Page URL', 'yikes-inc-easy-mailchimp-extender' ) |
2297 | 2297 | ), |
2298 | 2298 | array( |
2299 | 2299 | 'tag' => '{blog_name}', |
2300 | - 'description' => '<h4 class="tooltip-title">' . __( 'Blog Name', 'yikes-inc-easy-mailchimp-extender' ) . ' | <small>{blog_name}</small></h4><hr />' . __( 'Pre-populate the field with the current blog name that the user is on when opting in to your mailing list. This is especially helpful for multi-site networks.' , 'yikes-inc-easy-mailchimp-extender' ), |
|
2300 | + 'description' => '<h4 class="tooltip-title">' . __( 'Blog Name', 'yikes-inc-easy-mailchimp-extender' ) . ' | <small>{blog_name}</small></h4><hr />' . __( 'Pre-populate the field with the current blog name that the user is on when opting in to your mailing list. This is especially helpful for multi-site networks.', 'yikes-inc-easy-mailchimp-extender' ), |
|
2301 | 2301 | 'title' => __( 'Blog Name', 'yikes-inc-easy-mailchimp-extender' ) |
2302 | 2302 | ), |
2303 | 2303 | array( |
2304 | 2304 | 'tag' => '{user_logged_in}', |
2305 | - 'description' => '<h4 class="tooltip-title">' . __( 'User Logged In', 'yikes-inc-easy-mailchimp-extender' ) . ' | <small>{user_logged_in}</small></h4><hr />' . __( 'Detects if a user is logged in and pre-populates the field with an appropriate value.' , 'yikes-inc-easy-mailchimp-extender' ), |
|
2305 | + 'description' => '<h4 class="tooltip-title">' . __( 'User Logged In', 'yikes-inc-easy-mailchimp-extender' ) . ' | <small>{user_logged_in}</small></h4><hr />' . __( 'Detects if a user is logged in and pre-populates the field with an appropriate value.', 'yikes-inc-easy-mailchimp-extender' ), |
|
2306 | 2306 | 'title' => __( 'User Logged In', 'yikes-inc-easy-mailchimp-extender' ) |
2307 | 2307 | ), |
2308 | 2308 | ); |
@@ -2330,17 +2330,17 @@ discard block |
||
2330 | 2330 | <div id="pre-defined-tag-container"> |
2331 | 2331 | <input type="hidden" value="" class="clicked-input"> |
2332 | 2332 | <div id="pre-defined-tag-interior-container"> |
2333 | - <h3><?php _e( 'Pre Defined Tags' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
2334 | - <p class="description"><?php _e( 'You can use any of the following tags to populate a MailChimp text field with dynamic content. This can be used to determine which page the user signed up on, if the user was logged in and more.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
2333 | + <h3><?php _e( 'Pre Defined Tags', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
2334 | + <p class="description"><?php _e( 'You can use any of the following tags to populate a MailChimp text field with dynamic content. This can be used to determine which page the user signed up on, if the user was logged in and more.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
2335 | 2335 | <ul> |
2336 | - <?php foreach( apply_filters( 'yikes-mailchimp-custom-default-value-tags' , $available_tags ) as $tag ) { ?> |
|
2336 | + <?php foreach ( apply_filters( 'yikes-mailchimp-custom-default-value-tags', $available_tags ) as $tag ) { ?> |
|
2337 | 2337 | <li class="tooltop-tag"> |
2338 | 2338 | <!-- link/tag --> |
2339 | - <a href="#" onclick="populateDefaultValue( '<?php echo $tag['tag']; ?>' );return false;" data-attr-tag="<?php echo $tag['tag']; ?>" title="<?php echo $tag['title']; ?>"><?php echo $tag['title']; ?></a> |
|
2339 | + <a href="#" onclick="populateDefaultValue( '<?php echo $tag[ 'tag' ]; ?>' );return false;" data-attr-tag="<?php echo $tag[ 'tag' ]; ?>" title="<?php echo $tag[ 'title' ]; ?>"><?php echo $tag[ 'title' ]; ?></a> |
|
2340 | 2340 | <!-- help icon --> |
2341 | 2341 | <span class="dashicons dashicons-editor-help"></span> |
2342 | 2342 | <!-- tooltip --> |
2343 | - <div class="tooltiptext qtip-bootstrap yikes-easy-mc-hidden"><?php echo $tag['description']; ?></div> |
|
2343 | + <div class="tooltiptext qtip-bootstrap yikes-easy-mc-hidden"><?php echo $tag[ 'description' ]; ?></div> |
|
2344 | 2344 | </li> |
2345 | 2345 | <?php } ?> |
2346 | 2346 | </ul> |
@@ -2356,46 +2356,46 @@ discard block |
||
2356 | 2356 | * - |
2357 | 2357 | * @parameters - $list_id - pass in the list ID to retreive merge variables from |
2358 | 2358 | */ |
2359 | - public function build_available_merge_vars( $form_fields , $available_merge_variables ) { |
|
2359 | + public function build_available_merge_vars( $form_fields, $available_merge_variables ) { |
|
2360 | 2360 | $fields_assigned_to_form = array(); |
2361 | 2361 | foreach ( $form_fields as $field ) { |
2362 | - if ( isset( $field['merge'] ) ) { |
|
2363 | - $fields_assigned_to_form[ $field['merge'] ] = true; |
|
2362 | + if ( isset( $field[ 'merge' ] ) ) { |
|
2363 | + $fields_assigned_to_form[ $field[ 'merge' ] ] = true; |
|
2364 | 2364 | } |
2365 | 2365 | } |
2366 | 2366 | |
2367 | - if ( ! empty( $available_merge_variables['merge_fields'] ) ) { |
|
2367 | + if ( ! empty( $available_merge_variables[ 'merge_fields' ] ) ) { |
|
2368 | 2368 | ?> |
2369 | 2369 | <ul id="available-fields"><?php |
2370 | - foreach ( $available_merge_variables['merge_fields'] as $merge_var ) { |
|
2371 | - if ( isset( $fields_assigned_to_form[ $merge_var['tag'] ] ) ) { |
|
2370 | + foreach ( $available_merge_variables[ 'merge_fields' ] as $merge_var ) { |
|
2371 | + if ( isset( $fields_assigned_to_form[ $merge_var[ 'tag' ] ] ) ) { |
|
2372 | 2372 | ?> |
2373 | 2373 | <li class="available-form-field not-available" |
2374 | - alt="<?php echo $merge_var['tag']; ?>" |
|
2375 | - data-attr-field-type="<?php echo esc_attr( $merge_var['type'] ); ?>" |
|
2376 | - data-attr-field-name="<?php echo esc_attr( $merge_var['name'] ); ?>" |
|
2377 | - data-attr-form-id="<?php echo esc_attr( $available_merge_variables['list_id'] ); ?>" |
|
2374 | + alt="<?php echo $merge_var[ 'tag' ]; ?>" |
|
2375 | + data-attr-field-type="<?php echo esc_attr( $merge_var[ 'type' ] ); ?>" |
|
2376 | + data-attr-field-name="<?php echo esc_attr( $merge_var[ 'name' ] ); ?>" |
|
2377 | + data-attr-form-id="<?php echo esc_attr( $available_merge_variables[ 'list_id' ] ); ?>" |
|
2378 | 2378 | title="<?php esc_attr_e( 'Already assigned to your form', 'yikes-inc-easy-mailchimp-extender' ); ?>" |
2379 | 2379 | disabled="disabled"> |
2380 | - <?php echo stripslashes( $merge_var['name'] ); |
|
2381 | - if ( $merge_var['required'] ) { |
|
2380 | + <?php echo stripslashes( $merge_var[ 'name' ] ); |
|
2381 | + if ( $merge_var[ 'required' ] ) { |
|
2382 | 2382 | echo ' <span class="field-required" title="' . __( 'required field', 'yikes-inc-easy-mailchimp-extender' ) . '">*</span>'; |
2383 | 2383 | } ?> |
2384 | - <small class="field-type-text"><?php echo $merge_var['type']; ?></small> |
|
2384 | + <small class="field-type-text"><?php echo $merge_var[ 'type' ]; ?></small> |
|
2385 | 2385 | </li> |
2386 | 2386 | <?php |
2387 | 2387 | } else { |
2388 | 2388 | ?> |
2389 | 2389 | <li class="available-form-field" |
2390 | - alt="<?php echo $merge_var['tag']; ?>" |
|
2391 | - data-attr-field-type="<?php echo esc_attr( $merge_var['type'] ); ?>" |
|
2392 | - data-attr-field-name="<?php echo esc_attr( $merge_var['name'] ); ?>" |
|
2393 | - data-attr-form-id="<?php echo esc_attr( $available_merge_variables['list_id'] ); ?>"> |
|
2394 | - <?php echo stripslashes( $merge_var['name'] ); |
|
2395 | - if ( $merge_var['required'] ) { |
|
2390 | + alt="<?php echo $merge_var[ 'tag' ]; ?>" |
|
2391 | + data-attr-field-type="<?php echo esc_attr( $merge_var[ 'type' ] ); ?>" |
|
2392 | + data-attr-field-name="<?php echo esc_attr( $merge_var[ 'name' ] ); ?>" |
|
2393 | + data-attr-form-id="<?php echo esc_attr( $available_merge_variables[ 'list_id' ] ); ?>"> |
|
2394 | + <?php echo stripslashes( $merge_var[ 'name' ] ); |
|
2395 | + if ( $merge_var[ 'required' ] ) { |
|
2396 | 2396 | echo ' <span class="field-required" title="' . __( 'required field', 'yikes-inc-easy-mailchimp-extender' ) . '">*</span>'; |
2397 | 2397 | } ?> |
2398 | - <small class="field-type-text"><?php echo $merge_var['type']; ?></small> |
|
2398 | + <small class="field-type-text"><?php echo $merge_var[ 'type' ]; ?></small> |
|
2399 | 2399 | </li> |
2400 | 2400 | <?php |
2401 | 2401 | } |
@@ -2417,12 +2417,12 @@ discard block |
||
2417 | 2417 | * - |
2418 | 2418 | * @parameters - $list_id - pass in the list ID to retreive merge variables from |
2419 | 2419 | */ |
2420 | - public function build_available_interest_groups( $form_fields , $available_interest_groups , $list_id ) { |
|
2420 | + public function build_available_interest_groups( $form_fields, $available_interest_groups, $list_id ) { |
|
2421 | 2421 | $fields_assigned_to_form = array(); |
2422 | 2422 | if ( ! empty( $form_fields ) ) { |
2423 | 2423 | foreach ( $form_fields as $field ) { |
2424 | - if ( isset( $field['group_id'] ) ) { |
|
2425 | - $fields_assigned_to_form[ $field['group_id'] ] = true; |
|
2424 | + if ( isset( $field[ 'group_id' ] ) ) { |
|
2425 | + $fields_assigned_to_form[ $field[ 'group_id' ] ] = true; |
|
2426 | 2426 | } |
2427 | 2427 | } |
2428 | 2428 | } |
@@ -2431,16 +2431,16 @@ discard block |
||
2431 | 2431 | ?> |
2432 | 2432 | <ul id="available-interest-groups"><?php |
2433 | 2433 | foreach ( $available_interest_groups as $interest_group ) { |
2434 | - if ( isset( $fields_assigned_to_form[ $interest_group['id'] ] ) ) { |
|
2434 | + if ( isset( $fields_assigned_to_form[ $interest_group[ 'id' ] ] ) ) { |
|
2435 | 2435 | ?> |
2436 | - <li class="available-interest-group not-available" alt="<?php echo $interest_group['id']; ?>" data-attr-field-name="<?php echo stripslashes( $interest_group['title'] ); ?>" data-attr-field-type="<?php echo $interest_group['type']; ?>" data-attr-form-id="<?php echo $list_id; ?>" title="<?php _e( 'Already assigned to your form', 'yikes-inc-easy-mailchimp-extender' ); ?>" disabled="disabled"><?php echo stripslashes( $interest_group['title'] ); ?> |
|
2437 | - <small class="field-type-text"><?php echo $interest_group['type']; ?></small> |
|
2436 | + <li class="available-interest-group not-available" alt="<?php echo $interest_group[ 'id' ]; ?>" data-attr-field-name="<?php echo stripslashes( $interest_group[ 'title' ] ); ?>" data-attr-field-type="<?php echo $interest_group[ 'type' ]; ?>" data-attr-form-id="<?php echo $list_id; ?>" title="<?php _e( 'Already assigned to your form', 'yikes-inc-easy-mailchimp-extender' ); ?>" disabled="disabled"><?php echo stripslashes( $interest_group[ 'title' ] ); ?> |
|
2437 | + <small class="field-type-text"><?php echo $interest_group[ 'type' ]; ?></small> |
|
2438 | 2438 | </li> |
2439 | 2439 | <?php |
2440 | 2440 | } else { |
2441 | 2441 | ?> |
2442 | - <li class="available-interest-group" alt="<?php echo $interest_group['id']; ?>" data-attr-field-name="<?php echo stripslashes( $interest_group['title'] ); ?>" data-attr-field-type="<?php echo $interest_group['type']; ?>" data-attr-form-id="<?php echo $list_id; ?>"><?php echo stripslashes( $interest_group['title'] ); ?> |
|
2443 | - <small class="field-type-text"><?php echo $interest_group['type']; ?></small> |
|
2442 | + <li class="available-interest-group" alt="<?php echo $interest_group[ 'id' ]; ?>" data-attr-field-name="<?php echo stripslashes( $interest_group[ 'title' ] ); ?>" data-attr-field-type="<?php echo $interest_group[ 'type' ]; ?>" data-attr-form-id="<?php echo $list_id; ?>"><?php echo stripslashes( $interest_group[ 'title' ] ); ?> |
|
2443 | + <small class="field-type-text"><?php echo $interest_group[ 'type' ]; ?></small> |
|
2444 | 2444 | </li> |
2445 | 2445 | <?php |
2446 | 2446 | } |
@@ -2462,15 +2462,15 @@ discard block |
||
2462 | 2462 | * - must clean up db tables , ensure what data is going in and what is needed... |
2463 | 2463 | */ |
2464 | 2464 | public function yikes_easy_mailchimp_create_form() { |
2465 | - $nonce = $_REQUEST['nonce']; |
|
2466 | - if( ! wp_verify_nonce( $nonce, 'create_mailchimp_form' ) ) { |
|
2467 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
2465 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
2466 | + if ( ! wp_verify_nonce( $nonce, 'create_mailchimp_form' ) ) { |
|
2467 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
2468 | 2468 | } |
2469 | 2469 | |
2470 | 2470 | $result = $this->form_interface->create_form( array( |
2471 | - 'list_id' => sanitize_key( $_POST['associated-list'] ), |
|
2472 | - 'form_name' => stripslashes( $_POST['form-name'] ), |
|
2473 | - 'form_description' => stripslashes( $_POST['form-description'] ), |
|
2471 | + 'list_id' => sanitize_key( $_POST[ 'associated-list' ] ), |
|
2472 | + 'form_name' => stripslashes( $_POST[ 'form-name' ] ), |
|
2473 | + 'form_description' => stripslashes( $_POST[ 'form-description' ] ), |
|
2474 | 2474 | ) ); |
2475 | 2475 | |
2476 | 2476 | // if an error occurs during the form creation process |
@@ -2478,11 +2478,11 @@ discard block |
||
2478 | 2478 | // write it to the error log |
2479 | 2479 | // if the form was not created successfully |
2480 | 2480 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
2481 | - $error_logging->maybe_write_to_log( __( 'Error creating a new form', 'yikes-inc-easy-mailchimp-extender') , __( "Creating a new form" , 'yikes-inc-easy-mailchimp-extender' ) , __( "Forms" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
2481 | + $error_logging->maybe_write_to_log( __( 'Error creating a new form', 'yikes-inc-easy-mailchimp-extender' ), __( "Creating a new form", 'yikes-inc-easy-mailchimp-extender' ), __( "Forms", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
2482 | 2482 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&sql_error=' . urlencode( __( 'Error creating a new form', 'yikes-inc-easy-mailchimp-extender' ) ) ) ) ); |
2483 | 2483 | } else { |
2484 | 2484 | // redirect the user to the new form edit page |
2485 | - wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $result) ) ); |
|
2485 | + wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $result ) ) ); |
|
2486 | 2486 | } |
2487 | 2487 | exit(); |
2488 | 2488 | } |
@@ -2495,11 +2495,11 @@ discard block |
||
2495 | 2495 | */ |
2496 | 2496 | public function yikes_easy_mailchimp_delete_form() { |
2497 | 2497 | // grab & store our variables ( associated list & form name ) |
2498 | - $nonce = $_REQUEST['nonce']; |
|
2499 | - $post_id_to_delete = $_REQUEST['mailchimp-form']; |
|
2498 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
2499 | + $post_id_to_delete = $_REQUEST[ 'mailchimp-form' ]; |
|
2500 | 2500 | // verify our nonce |
2501 | - if( ! wp_verify_nonce( $nonce, 'delete-mailchimp-form-'.$post_id_to_delete ) ) { |
|
2502 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
2501 | + if ( ! wp_verify_nonce( $nonce, 'delete-mailchimp-form-' . $post_id_to_delete ) ) { |
|
2502 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
2503 | 2503 | } |
2504 | 2504 | |
2505 | 2505 | $this->form_interface->delete_form( $post_id_to_delete ); |
@@ -2515,19 +2515,19 @@ discard block |
||
2515 | 2515 | */ |
2516 | 2516 | public function yikes_easy_mailchimp_duplicate_form() { |
2517 | 2517 | // grab & store our variables ( associated list & form name ) |
2518 | - $nonce = $_REQUEST['nonce']; |
|
2519 | - $post_id_to_clone = $_REQUEST['mailchimp-form']; |
|
2518 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
2519 | + $post_id_to_clone = $_REQUEST[ 'mailchimp-form' ]; |
|
2520 | 2520 | // verify our nonce |
2521 | - if( ! wp_verify_nonce( $nonce, 'duplicate-mailchimp-form-'.$post_id_to_clone ) ) { |
|
2522 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
2521 | + if ( ! wp_verify_nonce( $nonce, 'duplicate-mailchimp-form-' . $post_id_to_clone ) ) { |
|
2522 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
2523 | 2523 | } |
2524 | 2524 | |
2525 | 2525 | // Get the current form data. |
2526 | 2526 | $form_data = $this->form_interface->get_form( $post_id_to_clone ); |
2527 | 2527 | |
2528 | 2528 | // Update some of the data before duplication |
2529 | - $form_data['form_name'] .= ' - Copy - '; |
|
2530 | - $form_data['impressions'] = $form_data['submissions'] = 0; |
|
2529 | + $form_data[ 'form_name' ] .= ' - Copy - '; |
|
2530 | + $form_data[ 'impressions' ] = $form_data[ 'submissions' ] = 0; |
|
2531 | 2531 | |
2532 | 2532 | // Create the new form, and handle the result. |
2533 | 2533 | $result = $this->form_interface->create_form( $form_data ); |
@@ -2548,11 +2548,11 @@ discard block |
||
2548 | 2548 | */ |
2549 | 2549 | public function yikes_easy_mailchimp_reset_impression_stats() { |
2550 | 2550 | // grab & store our variables ( associated list & form name ) |
2551 | - $nonce = $_REQUEST['nonce']; |
|
2552 | - $form_id_to_reset = $_REQUEST['mailchimp-form']; |
|
2551 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
2552 | + $form_id_to_reset = $_REQUEST[ 'mailchimp-form' ]; |
|
2553 | 2553 | // verify our nonce |
2554 | - if( ! wp_verify_nonce( $nonce, 'reset-stats-mailchimp-form-'.$form_id_to_reset ) ) { |
|
2555 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
2554 | + if ( ! wp_verify_nonce( $nonce, 'reset-stats-mailchimp-form-' . $form_id_to_reset ) ) { |
|
2555 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
2556 | 2556 | } |
2557 | 2557 | |
2558 | 2558 | $result = $this->form_interface->update_form( |
@@ -2580,8 +2580,8 @@ discard block |
||
2580 | 2580 | */ |
2581 | 2581 | public function yikes_easy_mailchimp_update_form() { |
2582 | 2582 | // grab & store our variables ( associated list & form name ) |
2583 | - $nonce = $_REQUEST['nonce']; |
|
2584 | - $form_id = $_REQUEST['id']; |
|
2583 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
2584 | + $form_id = $_REQUEST[ 'id' ]; |
|
2585 | 2585 | |
2586 | 2586 | // verify our nonce |
2587 | 2587 | if ( ! wp_verify_nonce( $nonce, 'update-mailchimp-form-' . $form_id ) ) { |
@@ -2595,66 +2595,66 @@ discard block |
||
2595 | 2595 | } |
2596 | 2596 | |
2597 | 2597 | // store our values! |
2598 | - $list_id = $_POST['associated-list']; |
|
2599 | - $form_name = stripslashes( $_POST['form-name'] ); |
|
2600 | - $form_description = sanitize_text_field( stripslashes( $_POST['form-description'] ) ); |
|
2601 | - $send_welcome_email = $_POST['send-welcome-email']; |
|
2602 | - $redirect_user_on_submit = $_POST['redirect-user-on-submission']; |
|
2603 | - $redirect_page = $_POST['redirect-user-to-selection']; |
|
2598 | + $list_id = $_POST[ 'associated-list' ]; |
|
2599 | + $form_name = stripslashes( $_POST[ 'form-name' ] ); |
|
2600 | + $form_description = sanitize_text_field( stripslashes( $_POST[ 'form-description' ] ) ); |
|
2601 | + $send_welcome_email = $_POST[ 'send-welcome-email' ]; |
|
2602 | + $redirect_user_on_submit = $_POST[ 'redirect-user-on-submission' ]; |
|
2603 | + $redirect_page = $_POST[ 'redirect-user-to-selection' ]; |
|
2604 | 2604 | |
2605 | 2605 | // stripslashes_deep on save, to prevent foreign languages from added excessive backslashes |
2606 | - $assigned_fields = isset( $_POST['field'] ) ? stripslashes_deep( $_POST['field'] ): array(); |
|
2606 | + $assigned_fields = isset( $_POST[ 'field' ] ) ? stripslashes_deep( $_POST[ 'field' ] ) : array(); |
|
2607 | 2607 | |
2608 | 2608 | // setup our submission settings serialized array |
2609 | 2609 | $submission_settings = array( |
2610 | - 'ajax' => $_POST['form-ajax-submission'], |
|
2611 | - 'redirect_on_submission' => $_POST['redirect-user-on-submission'], |
|
2612 | - 'redirect_page' => $_POST['redirect-user-to-selection'], |
|
2613 | - 'custom_redirect_url' => esc_url( $_POST['custom-redirect-url'] ), |
|
2614 | - 'hide_form_post_signup' => $_POST['hide-form-post-signup'], |
|
2615 | - 'replace_interests' => $_POST['replace-interest-groups'], |
|
2610 | + 'ajax' => $_POST[ 'form-ajax-submission' ], |
|
2611 | + 'redirect_on_submission' => $_POST[ 'redirect-user-on-submission' ], |
|
2612 | + 'redirect_page' => $_POST[ 'redirect-user-to-selection' ], |
|
2613 | + 'custom_redirect_url' => esc_url( $_POST[ 'custom-redirect-url' ] ), |
|
2614 | + 'hide_form_post_signup' => $_POST[ 'hide-form-post-signup' ], |
|
2615 | + 'replace_interests' => $_POST[ 'replace-interest-groups' ], |
|
2616 | 2616 | ); |
2617 | 2617 | |
2618 | 2618 | // setup our opt-in settings serialized array |
2619 | 2619 | $optin_settings = array( |
2620 | - 'optin' => $_POST['single-double-optin'], |
|
2621 | - 'update_existing_user' => $_POST['update-existing-user'], |
|
2622 | - 'send_update_email' => $_POST['update-existing-email'], |
|
2623 | - 'send_welcome_email' => $_POST['send-welcome-email'], |
|
2620 | + 'optin' => $_POST[ 'single-double-optin' ], |
|
2621 | + 'update_existing_user' => $_POST[ 'update-existing-user' ], |
|
2622 | + 'send_update_email' => $_POST[ 'update-existing-email' ], |
|
2623 | + 'send_welcome_email' => $_POST[ 'send-welcome-email' ], |
|
2624 | 2624 | ); |
2625 | 2625 | |
2626 | 2626 | // setup our error settings serialized array |
2627 | 2627 | $error_settings = array( |
2628 | - 'success' => trim( $_POST['yikes-easy-mc-success-message'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-success-message'] ) ) : '', |
|
2629 | - 'general-error' => trim( $_POST['yikes-easy-mc-general-error-message'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-general-error-message'] ) ) : '', |
|
2630 | - 'invalid-email' => trim( $_POST['yikes-easy-mc-invalid-email-message'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-invalid-email-message'] ) ) : '', |
|
2631 | - 'already-subscribed' => trim( $_POST['yikes-easy-mc-user-subscribed-message'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-user-subscribed-message'] ) ) : '', |
|
2632 | - 'update-link' => trim( $_POST['yikes-easy-mc-user-update-link'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-user-update-link'] ) ) : '', |
|
2628 | + 'success' => trim( $_POST[ 'yikes-easy-mc-success-message' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-success-message' ] ) ) : '', |
|
2629 | + 'general-error' => trim( $_POST[ 'yikes-easy-mc-general-error-message' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-general-error-message' ] ) ) : '', |
|
2630 | + 'invalid-email' => trim( $_POST[ 'yikes-easy-mc-invalid-email-message' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-invalid-email-message' ] ) ) : '', |
|
2631 | + 'already-subscribed' => trim( $_POST[ 'yikes-easy-mc-user-subscribed-message' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-user-subscribed-message' ] ) ) : '', |
|
2632 | + 'update-link' => trim( $_POST[ 'yikes-easy-mc-user-update-link' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-user-update-link' ] ) ) : '', |
|
2633 | 2633 | ); |
2634 | 2634 | |
2635 | 2635 | // Setup the new form settings array |
2636 | 2636 | // @since 6.0.3.8 |
2637 | 2637 | // To Do: Combine date & time so it's a single unix timestamp |
2638 | 2638 | $form_settings = array( |
2639 | - 'yikes-easy-mc-form-class-names' => trim( $_POST['yikes-easy-mc-form-class-names'] ), |
|
2640 | - 'yikes-easy-mc-inline-form' => $_POST['yikes-easy-mc-inline-form'][0], |
|
2641 | - 'yikes-easy-mc-submit-button-type' => $_POST['yikes-easy-mc-submit-button-type'][0], |
|
2642 | - 'yikes-easy-mc-submit-button-text' => trim( $_POST['yikes-easy-mc-submit-button-text'] ), |
|
2643 | - 'yikes-easy-mc-submit-button-image' => esc_url( trim( $_POST['yikes-easy-mc-submit-button-image'] ) ), |
|
2644 | - 'yikes-easy-mc-submit-button-classes' => trim( $_POST['yikes-easy-mc-submit-button-classes'] ), |
|
2645 | - 'yikes-easy-mc-form-schedule' => ( isset( $_POST['yikes-easy-mc-form-schedule'] ) ) ? '1' : '0', |
|
2646 | - 'yikes-easy-mc-form-restriction-start' => strtotime( $_POST['yikes-easy-mc-form-restriction-start-date'] . ' ' . $_POST['yikes-easy-mc-form-restriction-start-time'] ), |
|
2647 | - 'yikes-easy-mc-form-restriction-end' => strtotime( $_POST['yikes-easy-mc-form-restriction-end-date'] . ' ' . $_POST['yikes-easy-mc-form-restriction-end-time'] ), |
|
2648 | - 'yikes-easy-mc-form-restriction-pending-message' => trim( $_POST['yikes-easy-mc-form-restriction-pending-message'] ), |
|
2649 | - 'yikes-easy-mc-form-restriction-expired-message' => trim( $_POST['yikes-easy-mc-form-restriction-expired-message'] ), |
|
2650 | - 'yikes-easy-mc-form-login-required' => ( isset( $_POST['yikes-easy-mc-form-login-required'] ) ) ? '1' : '0', |
|
2651 | - 'yikes-easy-mc-form-restriction-login-message' => trim( $_POST['yikes-easy-mc-form-restriction-login-message'] ), |
|
2639 | + 'yikes-easy-mc-form-class-names' => trim( $_POST[ 'yikes-easy-mc-form-class-names' ] ), |
|
2640 | + 'yikes-easy-mc-inline-form' => $_POST[ 'yikes-easy-mc-inline-form' ][ 0 ], |
|
2641 | + 'yikes-easy-mc-submit-button-type' => $_POST[ 'yikes-easy-mc-submit-button-type' ][ 0 ], |
|
2642 | + 'yikes-easy-mc-submit-button-text' => trim( $_POST[ 'yikes-easy-mc-submit-button-text' ] ), |
|
2643 | + 'yikes-easy-mc-submit-button-image' => esc_url( trim( $_POST[ 'yikes-easy-mc-submit-button-image' ] ) ), |
|
2644 | + 'yikes-easy-mc-submit-button-classes' => trim( $_POST[ 'yikes-easy-mc-submit-button-classes' ] ), |
|
2645 | + 'yikes-easy-mc-form-schedule' => ( isset( $_POST[ 'yikes-easy-mc-form-schedule' ] ) ) ? '1' : '0', |
|
2646 | + 'yikes-easy-mc-form-restriction-start' => strtotime( $_POST[ 'yikes-easy-mc-form-restriction-start-date' ] . ' ' . $_POST[ 'yikes-easy-mc-form-restriction-start-time' ] ), |
|
2647 | + 'yikes-easy-mc-form-restriction-end' => strtotime( $_POST[ 'yikes-easy-mc-form-restriction-end-date' ] . ' ' . $_POST[ 'yikes-easy-mc-form-restriction-end-time' ] ), |
|
2648 | + 'yikes-easy-mc-form-restriction-pending-message' => trim( $_POST[ 'yikes-easy-mc-form-restriction-pending-message' ] ), |
|
2649 | + 'yikes-easy-mc-form-restriction-expired-message' => trim( $_POST[ 'yikes-easy-mc-form-restriction-expired-message' ] ), |
|
2650 | + 'yikes-easy-mc-form-login-required' => ( isset( $_POST[ 'yikes-easy-mc-form-login-required' ] ) ) ? '1' : '0', |
|
2651 | + 'yikes-easy-mc-form-restriction-login-message' => trim( $_POST[ 'yikes-easy-mc-form-restriction-login-message' ] ), |
|
2652 | 2652 | ); |
2653 | 2653 | |
2654 | 2654 | // additional custom fields (extensions / user defined fields) |
2655 | 2655 | $custom_fields = array(); |
2656 | - if ( isset( $_POST['custom-field'] ) ) { |
|
2657 | - foreach ( $_POST['custom-field'] as $custom_field => $custom_value ) { |
|
2656 | + if ( isset( $_POST[ 'custom-field' ] ) ) { |
|
2657 | + foreach ( $_POST[ 'custom-field' ] as $custom_field => $custom_value ) { |
|
2658 | 2658 | if ( is_array( $custom_value ) ) { |
2659 | 2659 | $custom_fields[ $custom_field ] = array_filter( stripslashes_deep( $custom_value ) ); // array_filters to remove empty items (don't save them!) |
2660 | 2660 | } else { |
@@ -2685,7 +2685,7 @@ discard block |
||
2685 | 2685 | $this->form_interface->update_form( $form_id, $form_updates ); |
2686 | 2686 | |
2687 | 2687 | /* Custom action hook which allows users to update specific options when a form is updated - used in add ons */ |
2688 | - do_action( 'yikes-mailchimp-save-form', $form_id, $custom_fields ); |
|
2688 | + do_action( 'yikes-mailchimp-save-form', $form_id, $custom_fields ); |
|
2689 | 2689 | |
2690 | 2690 | // redirect the user to the manage forms page, display confirmation |
2691 | 2691 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $form_id . '&updated-form=true' ) ) ); |
@@ -2694,13 +2694,13 @@ discard block |
||
2694 | 2694 | |
2695 | 2695 | /* Unsubscribe a given user from our list */ |
2696 | 2696 | public function yikes_easy_mailchimp_unsubscribe_user() { |
2697 | - $nonce = $_REQUEST['nonce']; |
|
2698 | - $list_id = $_REQUEST['mailchimp-list']; |
|
2699 | - $email_id = $_REQUEST['email_id']; |
|
2697 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
2698 | + $list_id = $_REQUEST[ 'mailchimp-list' ]; |
|
2699 | + $email_id = $_REQUEST[ 'email_id' ]; |
|
2700 | 2700 | |
2701 | 2701 | // verify our nonce |
2702 | - if( ! wp_verify_nonce( $nonce, 'unsubscribe-user-' . $email_id ) ) { |
|
2703 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
2702 | + if ( ! wp_verify_nonce( $nonce, 'unsubscribe-user-' . $email_id ) ) { |
|
2703 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
2704 | 2704 | } |
2705 | 2705 | |
2706 | 2706 | $response = yikes_get_mc_api_manager()->get_list_handler()->member_unsubscribe( $list_id, $email_id ); |
@@ -2719,21 +2719,21 @@ discard block |
||
2719 | 2719 | |
2720 | 2720 | public function yikes_easy_mailchimp_create_missing_error_log() { |
2721 | 2721 | // grab our nonnce |
2722 | - $nonce = $_REQUEST['nonce']; |
|
2722 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
2723 | 2723 | // validate nonce |
2724 | - if( !wp_verify_nonce( $nonce, 'create_error_log' ) ) { |
|
2725 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
2724 | + if ( ! wp_verify_nonce( $nonce, 'create_error_log' ) ) { |
|
2725 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
2726 | 2726 | } |
2727 | 2727 | // setup the path to the error log |
2728 | - $error_log = fopen( plugin_dir_path( __FILE__ ) . '../includes/error_log/yikes-easy-mailchimp-error-log.php' , 'w' ); |
|
2728 | + $error_log = fopen( plugin_dir_path( __FILE__ ) . '../includes/error_log/yikes-easy-mailchimp-error-log.php', 'w' ); |
|
2729 | 2729 | try { |
2730 | 2730 | // create the file |
2731 | - fwrite( $error_log , '' ); |
|
2731 | + fwrite( $error_log, '' ); |
|
2732 | 2732 | // close out |
2733 | 2733 | fclose( $error_log ); |
2734 | 2734 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings&error_log_created=true' ) ) ); |
2735 | 2735 | } catch ( Exception $e ) { |
2736 | - wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings&error_log_created=false&error_message='.urlencode( $e->getMessage() ) ) ) ); |
|
2736 | + wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings&error_log_created=false&error_message=' . urlencode( $e->getMessage() ) ) ) ); |
|
2737 | 2737 | } |
2738 | 2738 | } |
2739 | 2739 | |
@@ -2744,9 +2744,9 @@ discard block |
||
2744 | 2744 | public function yikes_easy_mailchimp_clear_transient_data() { |
2745 | 2745 | |
2746 | 2746 | // verify our nonce |
2747 | - $nonce = $_REQUEST['nonce']; |
|
2748 | - if( ! wp_verify_nonce( $nonce, 'clear-mc-transient-data' ) ) { |
|
2749 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
2747 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
2748 | + if ( ! wp_verify_nonce( $nonce, 'clear-mc-transient-data' ) ) { |
|
2749 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
2750 | 2750 | } |
2751 | 2751 | |
2752 | 2752 | // delete all of the list_id transients |
@@ -2809,7 +2809,7 @@ discard block |
||
2809 | 2809 | */ |
2810 | 2810 | public function yikes_mailchimp_load_helper_class() { |
2811 | 2811 | // check to see if it's already loaded up |
2812 | - if( !class_exists( 'Yikes_Inc_Easy_Mailchimp_Forms_Helper' ) ) { |
|
2812 | + if ( ! class_exists( 'Yikes_Inc_Easy_Mailchimp_Forms_Helper' ) ) { |
|
2813 | 2813 | // Include our main helper class file |
2814 | 2814 | include_once( YIKES_MC_PATH . 'admin/partials/helpers/init.php' ); |
2815 | 2815 | } |
@@ -2886,7 +2886,7 @@ discard block |
||
2886 | 2886 | * @since 6.0.4 |
2887 | 2887 | */ |
2888 | 2888 | public function check_yikes_mc_table_version() { |
2889 | - if( get_option( 'yikes_mc_database_version', '0.00' ) < '1.0' ) { |
|
2889 | + if ( get_option( 'yikes_mc_database_version', '0.00' ) < '1.0' ) { |
|
2890 | 2890 | require_once YIKES_MC_PATH . 'includes/class-yikes-inc-easy-mailchimp-extender-activator.php'; |
2891 | 2891 | global $wpdb; |
2892 | 2892 | Yikes_Inc_Easy_Mailchimp_Extender_Activator::_activate_yikes_easy_mailchimp( $wpdb ); |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | } |
80 | 80 | |
81 | 81 | // If the API gave an error or there are no more lists, break. |
82 | - if ( isset( $response['error'] ) ) { |
|
83 | - return new WP_Error( $response['title'], $response['detail'] ); |
|
82 | + if ( isset( $response[ 'error' ] ) ) { |
|
83 | + return new WP_Error( $response[ 'title' ], $response[ 'detail' ] ); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | if ( empty( $response[ $item_key ] ) ) { |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | // Update the total number of items if it's still zero. |
91 | 91 | if ( 0 === $total ) { |
92 | - $total = intval( $response['total_items'] ); |
|
92 | + $total = intval( $response[ 'total_items' ] ); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | // Store each new list. |
@@ -192,15 +192,15 @@ discard block |
||
192 | 192 | * @return array|WP_Error Array of data when there was no error, or a WP_Error. |
193 | 193 | */ |
194 | 194 | protected function maybe_return_error( $response ) { |
195 | - if ( isset( $response['error'] ) ) { |
|
196 | - $title = isset( $response['title'] ) ? $response['title'] : $response['name']; |
|
197 | - $detail = isset( $response['detail'] ) ? $response['detail'] : $response['error']; |
|
195 | + if ( isset( $response[ 'error' ] ) ) { |
|
196 | + $title = isset( $response[ 'title' ] ) ? $response[ 'title' ] : $response[ 'name' ]; |
|
197 | + $detail = isset( $response[ 'detail' ] ) ? $response[ 'detail' ] : $response[ 'error' ]; |
|
198 | 198 | |
199 | 199 | return new WP_Error( |
200 | 200 | $title, |
201 | 201 | $detail, |
202 | 202 | array( |
203 | - 'status' => (int) $response['status'], |
|
203 | + 'status' => (int) $response[ 'status' ], |
|
204 | 204 | ) |
205 | 205 | ); |
206 | 206 | } |
@@ -228,9 +228,9 @@ discard block |
||
228 | 228 | |
229 | 229 | // MailChimp uses the application/problem+json type for errors |
230 | 230 | $headers = wp_remote_retrieve_headers( $response ); |
231 | - if ( isset( $headers['content-type'] ) ) { |
|
232 | - if ( false !== strpos( $headers['content-type'], 'application/problem+json' ) ) { |
|
233 | - $body['error'] = true; |
|
231 | + if ( isset( $headers[ 'content-type' ] ) ) { |
|
232 | + if ( false !== strpos( $headers[ 'content-type' ], 'application/problem+json' ) ) { |
|
233 | + $body[ 'error' ] = true; |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @return array|WP_Error |
104 | 104 | */ |
105 | 105 | public function patch( $path = '', $headers = array(), $params = array() ) { |
106 | - if ( ! isset( $params['body'] ) || empty( $params['body'] ) ) { |
|
106 | + if ( ! isset( $params[ 'body' ] ) || empty( $params[ 'body' ] ) ) { |
|
107 | 107 | return new WP_Error( |
108 | 108 | 'yikesinc_eme_missing_body', |
109 | 109 | sprintf( |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @return array|WP_Error |
131 | 131 | */ |
132 | 132 | public function post( $path = '', $headers = array(), $params = array() ) { |
133 | - if ( ! isset( $params['body'] ) || empty( $params['body'] ) ) { |
|
133 | + if ( ! isset( $params[ 'body' ] ) || empty( $params[ 'body' ] ) ) { |
|
134 | 134 | return new WP_Error( |
135 | 135 | 'yikesinc_eme_missing_body', |
136 | 136 | sprintf( |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @return array|WP_Error |
158 | 158 | */ |
159 | 159 | public function put( $path = '', $headers = array(), $params = array() ) { |
160 | - if ( ! isset( $params['body'] ) || empty( $params['body'] ) ) { |
|
160 | + if ( ! isset( $params[ 'body' ] ) || empty( $params[ 'body' ] ) ) { |
|
161 | 161 | return new WP_Error( |
162 | 162 | 'yikesinc_eme_missing_body', |
163 | 163 | sprintf( |
@@ -288,13 +288,13 @@ discard block |
||
288 | 288 | $authorized_args = $this->get_authorized_args(); |
289 | 289 | |
290 | 290 | // If we have body data, maybe convert it to JSON. |
291 | - if ( isset( $params['body'] ) && ( is_array( $params['body'] ) || is_object( $params['body'] ) ) ) { |
|
292 | - $params['body'] = json_encode( wp_parse_args( $authorized_args['body'], $params['body'] ) ); |
|
293 | - $headers['Content-Type'] = 'application/json'; |
|
291 | + if ( isset( $params[ 'body' ] ) && ( is_array( $params[ 'body' ] ) || is_object( $params[ 'body' ] ) ) ) { |
|
292 | + $params[ 'body' ] = json_encode( wp_parse_args( $authorized_args[ 'body' ], $params[ 'body' ] ) ); |
|
293 | + $headers[ 'Content-Type' ] = 'application/json'; |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | // Combine the given headers and auth headers |
297 | - $headers = wp_parse_args( $authorized_args['headers'], $headers ); |
|
297 | + $headers = wp_parse_args( $authorized_args[ 'headers' ], $headers ); |
|
298 | 298 | /** |
299 | 299 | * Filter the headers used for a request to the MailChimp API. |
300 | 300 | * |
@@ -358,12 +358,12 @@ discard block |
||
358 | 358 | |
359 | 359 | // Version 2.0 uses body authorization |
360 | 360 | if ( version_compare( '3.0', $this->api_version, '>' ) ) { |
361 | - $args['body'] = $this->get_auth_body(); |
|
361 | + $args[ 'body' ] = $this->get_auth_body(); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | // Version 3.0 uses authorization headers. |
365 | 365 | if ( version_compare( '3.0', $this->api_version, '<=' ) ) { |
366 | - $args['headers'] = $this->get_auth_headers(); |
|
366 | + $args[ 'headers' ] = $this->get_auth_headers(); |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | return $args; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | ); |
172 | 172 | |
173 | 173 | array_unshift( $merge_fields, $email_field ); |
174 | - $merge_object['merge_fields'] = $merge_fields; |
|
174 | + $merge_object[ 'merge_fields' ] = $merge_fields; |
|
175 | 175 | set_transient( "yikes_eme_merge_variables_{$list_id}", $merge_object, HOUR_IN_SECONDS ); |
176 | 176 | |
177 | 177 | return $merge_object; |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | return $interests; |
212 | 212 | } |
213 | 213 | |
214 | - $category['items'] = $interests; |
|
214 | + $category[ 'items' ] = $interests; |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | set_transient( "yikes_eme_interest_categories_{$list_id}", $categories, HOUR_IN_SECONDS ); |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | |
97 | 97 | $this->api_key = $api_key; |
98 | 98 | $parts = $this->get_api_key_parts(); |
99 | - $this->key = $parts['key']; |
|
100 | - $this->dc = $parts['dc']; |
|
99 | + $this->key = $parts[ 'key' ]; |
|
100 | + $this->dc = $parts[ 'dc' ]; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | $parts = explode( '-', $this->api_key ); |
123 | 123 | |
124 | 124 | return array( |
125 | - 'key' => $parts[0], |
|
126 | - 'dc' => isset( $parts[1] ) ? $parts[1] : '', |
|
125 | + 'key' => $parts[ 0 ], |
|
126 | + 'dc' => isset( $parts[ 1 ] ) ? $parts[ 1 ] : '', |
|
127 | 127 | ); |
128 | 128 | } |
129 | 129 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @return Yikes_Inc_Easy_MailChimp_API |
168 | 168 | */ |
169 | 169 | public function get_api( $version = '' ) { |
170 | - $version = $version ?: $this->get_default_api_version(); |
|
170 | + $version = $version ? : $this->get_default_api_version(); |
|
171 | 171 | |
172 | 172 | if ( ! array_key_exists( $version, $this->api ) || null === $this->api[ $version ] ) { |
173 | 173 | $this->api[ $version ] = new Yikes_Inc_Easy_MailChimp_API( $this->get_datacenter(), $this->get_api_key(), $version ); |