99 */
1010class MC4WP_Ninja_Forms_Action extends NF_Abstracts_Action
1111{
12- protected $ _name = 'mc4wp_subscribe ' ;
13- protected $ _nicename = 'Mailchimp ' ;
14- protected $ _tags = array ( 'newsletter ' );
15- protected $ _timing = 'normal ' ;
16- protected $ _priority = '10 ' ;
17- protected $ _settings = array ();
12+ protected $ _name = 'mc4wp_subscribe ' ;
13+ protected $ _nicename = 'Mailchimp ' ;
14+ protected $ _tags = array ( 'newsletter ' );
15+ protected $ _timing = 'normal ' ;
16+ protected $ _priority = '10 ' ;
17+ protected $ _settings = array ();
1818 protected $ _setting_labels = array (
1919 'list ' => 'List ' ,
2020 'fields ' => 'List Field Mapping ' ,
@@ -24,7 +24,7 @@ public function __construct()
2424 {
2525 parent ::__construct ();
2626
27- $ this ->_settings ['double_optin ' ] = array (
27+ $ this ->_settings ['double_optin ' ] = array (
2828 'name ' => 'double_optin ' ,
2929 'type ' => 'select ' ,
3030 'label ' => 'Use double opt-in? ' ,
@@ -61,15 +61,15 @@ public function __construct()
6161 ),
6262 );
6363
64- add_action ( 'wp_ajax_nf_ ' . $ this ->_name . '_get_lists ' , array ($ this , '_get_lists ' ));
64+ add_action ('wp_ajax_nf_ ' . $ this ->_name . '_get_lists ' , array ($ this , '_get_lists ' ));
6565 add_action ('init ' , array ($ this , 'translate_props ' ));
6666
6767 $ this ->get_list_settings ();
6868 }
6969
7070 public function translate_props ()
7171 {
72- $ this ->_settings ['double_optin ' ]['label ' ] = __ ('Use double opt-in? ' , 'mailchimp-for-wp ' );
72+ $ this ->_settings ['double_optin ' ]['label ' ] = __ ('Use double opt-in? ' , 'mailchimp-for-wp ' );
7373 $ this ->_settings ['update_existing ' ]['label ' ] = __ ('Update existing subscribers? ' , 'mailchimp-for-wp ' );
7474
7575 $ this ->_settings [ $ this ->get_name () . 'newsletter_list_fields ' ]['label ' ] = __ ('List Field Mapping ' , 'mailchimp-for-wp ' );
@@ -116,10 +116,10 @@ public function process($action_settings, $form_id, $data)
116116
117117 public function ajax_get_lists_handler ()
118118 {
119- check_ajax_referer ( 'ninja_forms_builder_nonce ' , 'security ' );
119+ check_ajax_referer ('ninja_forms_builder_nonce ' , 'security ' );
120120 $ lists = $ this ->get_lists ();
121- array_unshift ( $ return , array ( 'value ' => 0 , 'label ' => '- ' , 'fields ' => array (), 'groups ' => array () ) );
122- echo wp_json_encode ( array ( 'lists ' => $ return ) );
121+ array_unshift ($ return , array ( 'value ' => 0 , 'label ' => '- ' , 'fields ' => array (), 'groups ' => array () ));
122+ echo wp_json_encode (array ( 'lists ' => $ return ));
123123 wp_die ();
124124 }
125125
@@ -158,11 +158,13 @@ private function get_list_settings()
158158 'list ' => 'List ' ,
159159 'fields ' => 'List Field Mapping ' ,
160160 );
161- $ labels = array_merge ( $ label_defaults , $ this ->_setting_labels );
162- $ prefix = $ this ->get_name ();
163- $ lists = $ this ->get_lists ();
161+ $ labels = array_merge ($ label_defaults , $ this ->_setting_labels );
162+ $ prefix = $ this ->get_name ();
163+ $ lists = $ this ->get_lists ();
164164
165- if ( empty ( $ lists ) ) return ;
165+ if (empty ($ lists )) {
166+ return ;
167+ }
166168
167169 $ this ->_settings [ $ prefix . 'newsletter_list ' ] = array (
168170 'name ' => 'newsletter_list ' ,
@@ -175,24 +177,23 @@ private function get_list_settings()
175177 );
176178
177179 $ fields = array ();
178- foreach ( $ lists as $ list ) {
180+ foreach ( $ lists as $ list ) {
179181 $ this ->_settings [ $ prefix . 'newsletter_list ' ][ 'options ' ][] = $ list ;
180182
181183 //Check to see if list has fields array set.
182- if ( isset ( $ list [ 'fields ' ] ) ) {
183-
184- foreach ( $ list [ 'fields ' ] as $ field ) {
185- $ name = $ list [ 'value ' ] . '_ ' . $ field [ 'value ' ];
184+ if (isset ($ list [ 'fields ' ])) {
185+ foreach ($ list [ 'fields ' ] as $ field ) {
186+ $ name = $ list [ 'value ' ] . '_ ' . $ field [ 'value ' ];
186187 $ fields [] = array (
187188 'name ' => $ name ,
188189 'type ' => 'textbox ' ,
189190 'label ' => $ field [ 'label ' ],
190191 'width ' => 'full ' ,
191192 'use_merge_tags ' => array (
192193 'exclude ' => array (
193- 'user ' , 'post ' , 'system ' , 'querystrings '
194- )
195- )
194+ 'user ' , 'post ' , 'system ' , 'querystrings ' ,
195+ ),
196+ ),
196197 );
197198 }
198199 }
@@ -203,7 +204,7 @@ private function get_list_settings()
203204 'label ' => 'List Field Mapping ' ,
204205 'type ' => 'fieldset ' ,
205206 'group ' => 'primary ' ,
206- 'settings ' => array ()
207+ 'settings ' => array (),
207208 );
208209 }
209210}
0 commit comments