Completed
Pull Request — staging (#840)
by
unknown
16:43
created
src/View/PostEscapedView.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
 	 * @return string Rendered HTML.
56 56
 	 * @throws FailedToLoadView If the View URI could not be loaded.
57 57
 	 */
58
-	public function render( array $context = [] ) {
58
+	public function render( array $context = [ ] ) {
59 59
 		return wp_kses_post( $this->view->render( $context ) );
60 60
 	}
61 61
 
Please login to merge, or discard this patch.
src/View/View.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 	 * @return string Rendered HTML.
34 34
 	 * @throws FailedToLoadView If the View URI could not be loaded.
35 35
 	 */
36
-	public function render( array $context = [] );
36
+	public function render( array $context = [ ] );
37 37
 
38 38
 	/**
39 39
 	 * Render a partial view.
Please login to merge, or discard this patch.
src/Shortcode/BaseShortcode.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	public function register() {
41 41
 		$this->register_assets();
42 42
 
43
-		add_action( 'init', function () {
43
+		add_action( 'init', function() {
44 44
 			add_shortcode( $this->get_tag(), [ $this, 'process_shortcode' ] );
45 45
 		} );
46 46
 	}
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 *
71 71
 	 * @return string Rendered HTML.
72 72
 	 */
73
-	public function render( array $context = [] ) {
73
+	public function render( array $context = [ ] ) {
74 74
 		try {
75 75
 			$this->enqueue_assets();
76 76
 			$view = new PostEscapedView( new TemplatedView( $this->get_view_uri() ) );
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @return array Context to pass onto view.
111 111
 	 */
112 112
 	protected function get_context( array $atts ) {
113
-		return [];
113
+		return [ ];
114 114
 	}
115 115
 
116 116
 	/**
Please login to merge, or discard this patch.
src/View/FormEscapedView.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 *
95 95
 	 * @var array
96 96
 	 */
97
-	private $allowed_tags = [];
97
+	private $allowed_tags = [ ];
98 98
 
99 99
 	/**
100 100
 	 * Instantiate a FormEscapedView object.
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @return string Rendered HTML.
142 142
 	 * @throws FailedToLoadView If the View URI could not be loaded.
143 143
 	 */
144
-	public function render( array $context = [] ) {
144
+	public function render( array $context = [ ] ) {
145 145
 		return wp_kses( $this->view->render( $context ), $this->allowed_tags );
146 146
 	}
147 147
 
Please login to merge, or discard this patch.
src/Model/OptinForm.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 * @return bool Whether the form was successfully updated.
49 49
 	 */
50 50
 	public function update_form( $form_id, $data ) {
51
-		$data['id'] = $form_id;
51
+		$data[ 'id' ] = $form_id;
52 52
 		$all_forms  = $this->get_all_forms();
53 53
 
54 54
 		if ( ! isset( $all_forms[ $form_id ] ) ) {
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		$all_ids         = $this->get_form_ids();
80 80
 		$last_id         = end( $all_ids );
81 81
 		$new_id          = false === $last_id ? 1 : $last_id + 1;
82
-		$form_data['id'] = $new_id;
82
+		$form_data[ 'id' ] = $new_id;
83 83
 
84 84
 		// Ensure our data is consistently sorted
85 85
 		ksort( $form_data );
Please login to merge, or discard this patch.
src/Exception/InvalidRecaptcha.php 3 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,6 @@  discard block
 block discarded – undo
23 23
 	 *
24 24
 	 * @since %VERSION%
25 25
 	 *
26
-	 * @param string $field Class name of the service that was not recognized.
27 26
 	 *
28 27
 	 * @return static
29 28
 	 */
@@ -41,7 +40,6 @@  discard block
 block discarded – undo
41 40
 	 *
42 41
 	 * @since %VERSION%
43 42
 	 *
44
-	 * @param string $field Class name of the service that was not recognized.
45 43
 	 *
46 44
 	 * @return static
47 45
 	 */
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -29,25 +29,25 @@
 block discarded – undo
29 29
 	 */
30 30
 	public static function from_site_key() {
31 31
 		$message = sprintf(
32
-            __( 'Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!' , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>'
32
+				__( 'Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!' , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>'
33 33
 		);
34 34
 
35 35
 		return new static( $message );
36 36
 	}
37 37
 
38
-    /**
39
-	 * Create a new instance of the exception for a field class name that is
40
-	 * not recognized.
41
-	 *
42
-	 * @since %VERSION%
43
-	 *
44
-	 * @param string $field Class name of the service that was not recognized.
45
-	 *
46
-	 * @return static
47
-	 */
38
+	 /**
39
+	  * Create a new instance of the exception for a field class name that is
40
+	  * not recognized.
41
+	  *
42
+	  * @since %VERSION%
43
+	  *
44
+	  * @param string $field Class name of the service that was not recognized.
45
+	  *
46
+	  * @return static
47
+	  */
48 48
 	public static function from_secret_key() {
49 49
 		$message = sprintf(
50
-            __( 'Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!' , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>'
50
+				__( 'Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!' , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>'
51 51
 		);
52 52
 
53 53
 		return new static( $message );
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public static function from_site_key() {
31 31
 		$message = sprintf(
32
-            __( 'Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!' , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>'
32
+            __( 'Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!', 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>'
33 33
 		);
34 34
 
35 35
 		return new static( $message );
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public static function from_secret_key() {
49 49
 		$message = sprintf(
50
-            __( 'Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!' , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>'
50
+            __( 'Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!', 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>'
51 51
 		);
52 52
 
53 53
 		return new static( $message );
Please login to merge, or discard this patch.
src/Field/BaseInput.php 4 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,6 @@
 block discarded – undo
9 9
 
10 10
 namespace YIKES\EasyForms\Field;
11 11
 
12
-use YIKES\EasyForms\Exception\MustExtend;
13
-
14 12
 /**
15 13
  * Class BaseInput
16 14
  *
Please login to merge, or discard this patch.
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -57,10 +57,8 @@
 block discarded – undo
57 57
 	/**
58 58
 	 * Construct Field
59 59
 	 *
60
-	 * @param string $id          Fields ID.
61 60
 	 * @param array  $classes     Field and label classes.
62 61
 	 * @param string $placeholder Fields placeholder.
63
-	 * @param string $name        Field name.
64 62
 	 */
65 63
 	public function __construct( $classes, $placeholder, $label, $value, $description, $merge, $form_id, $hidden ) {
66 64
 		$this->classes     = $classes;
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 	}
103 103
 
104 104
 	public function get_id() {
105
-        return 'yikes-easy-mc-form-' . $this->form_id . '-' . $this->merge;
106
-    }
105
+		  return 'yikes-easy-mc-form-' . $this->form_id . '-' . $this->merge;
106
+	 }
107 107
 
108 108
 	public function get_value() {
109 109
 		return $this->value;
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 		</p>
140 140
 
141 141
         <?php
142
-        endif;
142
+		  endif;
143 143
 		?>
144 144
 		<input type="<?= esc_attr( $this->get_type() ); ?>"
145 145
 			class="<?= esc_attr( implode( ' ' , $this->field_classes() ) ); ?>"
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 *
32 32
 	 * @var array
33 33
 	 */
34
-	private $classes = [];
34
+	private $classes = [ ];
35 35
 
36 36
 	/**
37 37
 	 * Field placeholder.
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
 	}
91 91
 
92 92
 	public function field_classes() {
93
-		return $this->classes['field_classes'];
93
+		return $this->classes[ 'field_classes' ];
94 94
 	}
95 95
 
96 96
 	public function label_classes() {
97
-		return $this->classes['label_classes'];
97
+		return $this->classes[ 'label_classes' ];
98 98
 	}
99 99
 
100 100
 	public function get_name() {
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
 	}
111 111
 
112 112
 	public function set_description( $description ) {
113
-		$this->show_desc   = $description['show_description'];
114
-		$this->desc_above  = $description['description_above'];
115
-		$this->description = $description['description'];
113
+		$this->show_desc   = $description[ 'show_description' ];
114
+		$this->desc_above  = $description[ 'description_above' ];
115
+		$this->description = $description[ 'description' ];
116 116
 	}
117 117
 
118 118
 	/**
@@ -122,12 +122,12 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function render() {
124 124
 		?>
125
-		<label for="<?= esc_attr( $this->get_id() ); ?>" class="<?= esc_html( implode( ' ' , $this->label_classes() ) ); ?>" <?= esc_html( implode( ' ' , $this->label['props'] ) ); ?> >
125
+		<label for="<?= esc_attr( $this->get_id() ); ?>" class="<?= esc_html( implode( ' ', $this->label_classes() ) ); ?>" <?= esc_html( implode( ' ', $this->label[ 'props' ] ) ); ?> >
126 126
 
127 127
 		<!-- dictate label visibility -->
128
-		<?php if ( ! isset( $this->label['hide-label'] ) ) { ?>
128
+		<?php if ( ! isset( $this->label[ 'hide-label' ] ) ) { ?>
129 129
 			<span class="<?= esc_attr( $this->merge ) . '-label'; ?>">
130
-				<?= esc_html( apply_filters( 'yikes-mailchimp-'. $this->merge .'-label' , esc_attr( $this->label['value'] ), $this->form_id ) ); ?>
130
+				<?= esc_html( apply_filters( 'yikes-mailchimp-' . $this->merge . '-label', esc_attr( $this->label[ 'value' ] ), $this->form_id ) ); ?>
131 131
 			</span>
132 132
 		<?php }
133 133
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
         endif;
143 143
 		?>
144 144
 		<input type="<?= esc_attr( $this->get_type() ); ?>"
145
-			class="<?= esc_attr( implode( ' ' , $this->field_classes() ) ); ?>"
145
+			class="<?= esc_attr( implode( ' ', $this->field_classes() ) ); ?>"
146 146
 			name="<?= esc_attr( $this->get_name() ); ?>"
147 147
 			placeholder="<?= esc_attr( $this->get_placeholder() ); ?>"
148 148
 			id="<?= esc_attr( $this->get_id() ); ?>"
Please login to merge, or discard this patch.
src/Field/Hidden.php 1 patch
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,6 @@
 block discarded – undo
9 9
 
10 10
 namespace YIKES\EasyForms\Field;
11 11
 
12
-use YIKES\EasyForms\Exception\InvalidField;
13
-
14 12
 /**
15 13
  * Class Hidden
16 14
  *
Please login to merge, or discard this patch.
src/Form/FieldBuilder.php 3 patches
Doc Comments   +19 added lines patch added patch discarded remove patch
@@ -10,6 +10,10 @@  discard block
 block discarded – undo
10 10
 namespace YIKES\EasyForms\Form;
11 11
 
12 12
 trait FieldBuilder {
13
+
14
+    /**
15
+     * @param string $field
16
+     */
13 17
     protected function get_field_classes( $field ) {
14 18
         $field_classes = [];
15 19
         $label_classes = [];
@@ -77,6 +81,9 @@  discard block
 block discarded – undo
77 81
         $this->hidden_label_count = $this->hidden_label_count++;
78 82
     }
79 83
 
84
+    /**
85
+     * @param string $field
86
+     */
80 87
     protected function get_label( $field ) {
81 88
         $label = [];
82 89
         if( $field['type'] == 'email' ) {
@@ -93,6 +100,9 @@  discard block
 block discarded – undo
93 100
         return $label;
94 101
     }
95 102
 
103
+    /**
104
+     * @param string $field
105
+     */
96 106
     protected function get_value( $field ) {
97 107
         // pass our default value through our filter to parse dynamic data by tag (used solely for 'text' type)
98 108
         $default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
@@ -100,10 +110,16 @@  discard block
 block discarded – undo
100 110
         return apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-default-value', $default_value, $field, $this->form_id );
101 111
     }
102 112
 
113
+    /**
114
+     * @param string $field
115
+     */
103 116
     protected function get_placeholder( $field ) {
104 117
         return isset( $field['placeholder'] ) ? $field['placeholder'] : '';
105 118
     }
106 119
 
120
+    /**
121
+     * @param string $field
122
+     */
107 123
     protected function get_hidden( $field ) {
108 124
         $visible = true;
109 125
         // if both hide label and hide field are checked, we gotta hide the field!
@@ -115,6 +131,9 @@  discard block
 block discarded – undo
115 131
         return $visible;
116 132
     }
117 133
 
134
+    /**
135
+     * @param string $field
136
+     */
118 137
     protected function get_description( $field ) {
119 138
         $show_description  = false;
120 139
         $description_above = false;
Please login to merge, or discard this patch.
Indentation   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -10,129 +10,129 @@
 block discarded – undo
10 10
 namespace YIKES\EasyForms\Form;
11 11
 
12 12
 trait FieldBuilder {
13
-    protected function get_field_classes( $field ) {
14
-        $field_classes = [];
15
-        $label_classes = [];
13
+	 protected function get_field_classes( $field ) {
14
+		  $field_classes = [];
15
+		  $label_classes = [];
16 16
 
17
-        if( $field['additional-classes'] != '' ) {
17
+		  if( $field['additional-classes'] != '' ) {
18 18
 
19
-            $field_classes = explode( ' ' , $field['additional-classes'] );
19
+				$field_classes = explode( ' ' , $field['additional-classes'] );
20 20
 
21
-            if( in_array( 'field-left-half' , $field_classes ) ) {
22
-                $$label_classes[] = 'field-left-half';
23
-                $key = array_search( 'field-left-half' , $field_classes );
24
-                unset( $field_classes[$key] );
25
-            } // input half right
26
-            if( in_array( 'field-right-half' , $field_classes ) ) {
27
-                $$label_classes[] = 'field-right-half';
28
-                $key = array_search( 'field-right-half' , $field_classes );
29
-                unset( $field_classes[$key] );
30
-            } // input thirds (1/3 width, floated left)
31
-            if( in_array( 'field-third' , $field_classes ) ) {
32
-                $$label_classes[] = 'field-third';
33
-                $key = array_search( 'field-third' , $field_classes );
34
-                unset( $field_classes[$key] );
35
-            } // 2 column radio
36
-            if( in_array( 'option-2-col' , $field_classes ) ) {
37
-                $$label_classes[] = 'option-2-col';
38
-                $key = array_search( 'option-2-col' , $field_classes );
39
-                unset( $field_classes[$key] );
40
-            } // 3 column radio
41
-            if( in_array( 'option-3-col' , $field_classes ) ) {
42
-                $$label_classes[] = 'option-3-col';
43
-                $key = array_search( 'option-3-col' , $field_classes );
44
-                unset( $field_classes[$key] );
45
-            } // 4 column radio
46
-            if( in_array( 'option-4-col' , $field_classes ) ) {
47
-                $$label_classes[] = 'option-4-col';
48
-                $key = array_search( 'option-4-col' , $field_classes );
49
-                unset( $field_classes[$key] );
50
-            } // inline radio & checkboxes etc
51
-            if( in_array( 'option-inline' , $field_classes ) ) {
52
-                $$label_classes[] = 'option-inline';
53
-                $key = array_search( 'option-inline' , $field_classes );
54
-                unset( $field_classes[$key] );
55
-            }
56
-        }
21
+				if( in_array( 'field-left-half' , $field_classes ) ) {
22
+					 $$label_classes[] = 'field-left-half';
23
+					 $key = array_search( 'field-left-half' , $field_classes );
24
+					 unset( $field_classes[$key] );
25
+				} // input half right
26
+				if( in_array( 'field-right-half' , $field_classes ) ) {
27
+					 $$label_classes[] = 'field-right-half';
28
+					 $key = array_search( 'field-right-half' , $field_classes );
29
+					 unset( $field_classes[$key] );
30
+				} // input thirds (1/3 width, floated left)
31
+				if( in_array( 'field-third' , $field_classes ) ) {
32
+					 $$label_classes[] = 'field-third';
33
+					 $key = array_search( 'field-third' , $field_classes );
34
+					 unset( $field_classes[$key] );
35
+				} // 2 column radio
36
+				if( in_array( 'option-2-col' , $field_classes ) ) {
37
+					 $$label_classes[] = 'option-2-col';
38
+					 $key = array_search( 'option-2-col' , $field_classes );
39
+					 unset( $field_classes[$key] );
40
+				} // 3 column radio
41
+				if( in_array( 'option-3-col' , $field_classes ) ) {
42
+					 $$label_classes[] = 'option-3-col';
43
+					 $key = array_search( 'option-3-col' , $field_classes );
44
+					 unset( $field_classes[$key] );
45
+				} // 4 column radio
46
+				if( in_array( 'option-4-col' , $field_classes ) ) {
47
+					 $$label_classes[] = 'option-4-col';
48
+					 $key = array_search( 'option-4-col' , $field_classes );
49
+					 unset( $field_classes[$key] );
50
+				} // inline radio & checkboxes etc
51
+				if( in_array( 'option-inline' , $field_classes ) ) {
52
+					 $$label_classes[] = 'option-inline';
53
+					 $key = array_search( 'option-inline' , $field_classes );
54
+					 unset( $field_classes[$key] );
55
+				}
56
+		  }
57 57
 
58
-        // if the form is set to inline, add the inline class to our labels
59
-        if( $this->form_inline ) {
60
-            $label_classes[] = 'label-inline';
61
-        }
58
+		  // if the form is set to inline, add the inline class to our labels
59
+		  if( $this->form_inline ) {
60
+				$label_classes[] = 'label-inline';
61
+		  }
62 62
         
63
-        if( isset( $field['hide-label'] ) ) {
64
-            if( absint( $field['hide-label'] ) === 1 ) {
65
-                $this->increase_hidden_label_count();
66
-                $field_classes[] = 'field-no-label';
67
-            }
68
-        }
63
+		  if( isset( $field['hide-label'] ) ) {
64
+				if( absint( $field['hide-label'] ) === 1 ) {
65
+					 $this->increase_hidden_label_count();
66
+					 $field_classes[] = 'field-no-label';
67
+				}
68
+		  }
69 69
 
70
-        return [
71
-            'field_classes' => $field_classes,
72
-            'label_classes' => $label_classes,
73
-        ];
74
-    }
70
+		  return [
71
+				'field_classes' => $field_classes,
72
+				'label_classes' => $label_classes,
73
+		  ];
74
+	 }
75 75
 
76
-    protected function increase_hidden_label_count() {
77
-        $this->hidden_label_count = $this->hidden_label_count++;
78
-    }
76
+	 protected function increase_hidden_label_count() {
77
+		  $this->hidden_label_count = $this->hidden_label_count++;
78
+	 }
79 79
 
80
-    protected function get_label( $field ) {
81
-        $label = [];
82
-        if( $field['type'] == 'email' ) {
83
-            $label['props']['visible'] = '';
84
-        } else {
85
-            $label['props']['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : '';
86
-        }
87
-        if ( isset( $field['hide-label'] ) ) {
88
-            $label['hide-label'] = true;
89
-        }
90
-        if ( isset( $field['label'] ) ) {
91
-            $label['value'] = $field['label'];
92
-        }
93
-        return $label;
94
-    }
80
+	 protected function get_label( $field ) {
81
+		  $label = [];
82
+		  if( $field['type'] == 'email' ) {
83
+				$label['props']['visible'] = '';
84
+		  } else {
85
+				$label['props']['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : '';
86
+		  }
87
+		  if ( isset( $field['hide-label'] ) ) {
88
+				$label['hide-label'] = true;
89
+		  }
90
+		  if ( isset( $field['label'] ) ) {
91
+				$label['value'] = $field['label'];
92
+		  }
93
+		  return $label;
94
+	 }
95 95
 
96
-    protected function get_value( $field ) {
97
-        // pass our default value through our filter to parse dynamic data by tag (used solely for 'text' type)
98
-        $default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
99
-        $default_value = apply_filters( 'yikes-mailchimp-process-default-tag', $default_value );
100
-        return apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-default-value', $default_value, $field, $this->form_id );
101
-    }
96
+	 protected function get_value( $field ) {
97
+		  // pass our default value through our filter to parse dynamic data by tag (used solely for 'text' type)
98
+		  $default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
99
+		  $default_value = apply_filters( 'yikes-mailchimp-process-default-tag', $default_value );
100
+		  return apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-default-value', $default_value, $field, $this->form_id );
101
+	 }
102 102
 
103
-    protected function get_placeholder( $field ) {
104
-        return isset( $field['placeholder'] ) ? $field['placeholder'] : '';
105
-    }
103
+	 protected function get_placeholder( $field ) {
104
+		  return isset( $field['placeholder'] ) ? $field['placeholder'] : '';
105
+	 }
106 106
 
107
-    protected function get_hidden( $field ) {
108
-        $visible = true;
109
-        // if both hide label and hide field are checked, we gotta hide the field!
110
-        if( isset( $field['hide' ] ) && $field['hide'] == 1 ) {
111
-            if( isset( $field['hide-label' ] ) && $field['hide-label'] == 1 ) {
112
-                $visible = false;
113
-            }
114
-        }
115
-        return $visible;
116
-    }
107
+	 protected function get_hidden( $field ) {
108
+		  $visible = true;
109
+		  // if both hide label and hide field are checked, we gotta hide the field!
110
+		  if( isset( $field['hide' ] ) && $field['hide'] == 1 ) {
111
+				if( isset( $field['hide-label' ] ) && $field['hide-label'] == 1 ) {
112
+					 $visible = false;
113
+				}
114
+		  }
115
+		  return $visible;
116
+	 }
117 117
 
118
-    protected function get_description( $field ) {
119
-        $show_description  = false;
120
-        $description_above = false;
121
-        $description       = '';
118
+	 protected function get_description( $field ) {
119
+		  $show_description  = false;
120
+		  $description_above = false;
121
+		  $description       = '';
122 122
 
123
-        if ( isset( $field['description'] ) && trim( $field['description'] ) !== '' ) {
124
-            $show_description = true;
125
-            $description = $field['description'];
126
-        }
123
+		  if ( isset( $field['description'] ) && trim( $field['description'] ) !== '' ) {
124
+				$show_description = true;
125
+				$description = $field['description'];
126
+		  }
127 127
 
128
-        if ( isset( $field['description_above'] ) && $field['description_above'] === '1' ) {
129
-            $description_above = true;
130
-        }
128
+		  if ( isset( $field['description_above'] ) && $field['description_above'] === '1' ) {
129
+				$description_above = true;
130
+		  }
131 131
         
132
-        return [
133
-            'show_description'  => $show_description,
134
-            'description_above' => $description_above,
135
-            'description'       => $description,
136
-        ];
137
-    }
132
+		  return [
133
+				'show_description'  => $show_description,
134
+				'description_above' => $description_above,
135
+				'description'       => $description,
136
+		  ];
137
+	 }
138 138
 }
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -11,59 +11,59 @@  discard block
 block discarded – undo
11 11
 
12 12
 trait FieldBuilder {
13 13
     protected function get_field_classes( $field ) {
14
-        $field_classes = [];
15
-        $label_classes = [];
14
+        $field_classes = [ ];
15
+        $label_classes = [ ];
16 16
 
17
-        if( $field['additional-classes'] != '' ) {
17
+        if ( $field[ 'additional-classes' ] != '' ) {
18 18
 
19
-            $field_classes = explode( ' ' , $field['additional-classes'] );
19
+            $field_classes = explode( ' ', $field[ 'additional-classes' ] );
20 20
 
21
-            if( in_array( 'field-left-half' , $field_classes ) ) {
22
-                $$label_classes[] = 'field-left-half';
23
-                $key = array_search( 'field-left-half' , $field_classes );
24
-                unset( $field_classes[$key] );
21
+            if ( in_array( 'field-left-half', $field_classes ) ) {
22
+                $$label_classes[ ] = 'field-left-half';
23
+                $key = array_search( 'field-left-half', $field_classes );
24
+                unset( $field_classes[ $key ] );
25 25
             } // input half right
26
-            if( in_array( 'field-right-half' , $field_classes ) ) {
27
-                $$label_classes[] = 'field-right-half';
28
-                $key = array_search( 'field-right-half' , $field_classes );
29
-                unset( $field_classes[$key] );
26
+            if ( in_array( 'field-right-half', $field_classes ) ) {
27
+                $$label_classes[ ] = 'field-right-half';
28
+                $key = array_search( 'field-right-half', $field_classes );
29
+                unset( $field_classes[ $key ] );
30 30
             } // input thirds (1/3 width, floated left)
31
-            if( in_array( 'field-third' , $field_classes ) ) {
32
-                $$label_classes[] = 'field-third';
33
-                $key = array_search( 'field-third' , $field_classes );
34
-                unset( $field_classes[$key] );
31
+            if ( in_array( 'field-third', $field_classes ) ) {
32
+                $$label_classes[ ] = 'field-third';
33
+                $key = array_search( 'field-third', $field_classes );
34
+                unset( $field_classes[ $key ] );
35 35
             } // 2 column radio
36
-            if( in_array( 'option-2-col' , $field_classes ) ) {
37
-                $$label_classes[] = 'option-2-col';
38
-                $key = array_search( 'option-2-col' , $field_classes );
39
-                unset( $field_classes[$key] );
36
+            if ( in_array( 'option-2-col', $field_classes ) ) {
37
+                $$label_classes[ ] = 'option-2-col';
38
+                $key = array_search( 'option-2-col', $field_classes );
39
+                unset( $field_classes[ $key ] );
40 40
             } // 3 column radio
41
-            if( in_array( 'option-3-col' , $field_classes ) ) {
42
-                $$label_classes[] = 'option-3-col';
43
-                $key = array_search( 'option-3-col' , $field_classes );
44
-                unset( $field_classes[$key] );
41
+            if ( in_array( 'option-3-col', $field_classes ) ) {
42
+                $$label_classes[ ] = 'option-3-col';
43
+                $key = array_search( 'option-3-col', $field_classes );
44
+                unset( $field_classes[ $key ] );
45 45
             } // 4 column radio
46
-            if( in_array( 'option-4-col' , $field_classes ) ) {
47
-                $$label_classes[] = 'option-4-col';
48
-                $key = array_search( 'option-4-col' , $field_classes );
49
-                unset( $field_classes[$key] );
46
+            if ( in_array( 'option-4-col', $field_classes ) ) {
47
+                $$label_classes[ ] = 'option-4-col';
48
+                $key = array_search( 'option-4-col', $field_classes );
49
+                unset( $field_classes[ $key ] );
50 50
             } // inline radio & checkboxes etc
51
-            if( in_array( 'option-inline' , $field_classes ) ) {
52
-                $$label_classes[] = 'option-inline';
53
-                $key = array_search( 'option-inline' , $field_classes );
54
-                unset( $field_classes[$key] );
51
+            if ( in_array( 'option-inline', $field_classes ) ) {
52
+                $$label_classes[ ] = 'option-inline';
53
+                $key = array_search( 'option-inline', $field_classes );
54
+                unset( $field_classes[ $key ] );
55 55
             }
56 56
         }
57 57
 
58 58
         // if the form is set to inline, add the inline class to our labels
59
-        if( $this->form_inline ) {
60
-            $label_classes[] = 'label-inline';
59
+        if ( $this->form_inline ) {
60
+            $label_classes[ ] = 'label-inline';
61 61
         }
62 62
         
63
-        if( isset( $field['hide-label'] ) ) {
64
-            if( absint( $field['hide-label'] ) === 1 ) {
63
+        if ( isset( $field[ 'hide-label' ] ) ) {
64
+            if ( absint( $field[ 'hide-label' ] ) === 1 ) {
65 65
                 $this->increase_hidden_label_count();
66
-                $field_classes[] = 'field-no-label';
66
+                $field_classes[ ] = 'field-no-label';
67 67
             }
68 68
         }
69 69
 
@@ -78,37 +78,37 @@  discard block
 block discarded – undo
78 78
     }
79 79
 
80 80
     protected function get_label( $field ) {
81
-        $label = [];
82
-        if( $field['type'] == 'email' ) {
83
-            $label['props']['visible'] = '';
81
+        $label = [ ];
82
+        if ( $field[ 'type' ] == 'email' ) {
83
+            $label[ 'props' ][ 'visible' ] = '';
84 84
         } else {
85
-            $label['props']['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : '';
85
+            $label[ 'props' ][ 'visible' ] = isset( $field[ 'hide' ] ) ? 'style="display:none;"' : '';
86 86
         }
87
-        if ( isset( $field['hide-label'] ) ) {
88
-            $label['hide-label'] = true;
87
+        if ( isset( $field[ 'hide-label' ] ) ) {
88
+            $label[ 'hide-label' ] = true;
89 89
         }
90
-        if ( isset( $field['label'] ) ) {
91
-            $label['value'] = $field['label'];
90
+        if ( isset( $field[ 'label' ] ) ) {
91
+            $label[ 'value' ] = $field[ 'label' ];
92 92
         }
93 93
         return $label;
94 94
     }
95 95
 
96 96
     protected function get_value( $field ) {
97 97
         // pass our default value through our filter to parse dynamic data by tag (used solely for 'text' type)
98
-        $default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
98
+        $default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
99 99
         $default_value = apply_filters( 'yikes-mailchimp-process-default-tag', $default_value );
100
-        return apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-default-value', $default_value, $field, $this->form_id );
100
+        return apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-default-value', $default_value, $field, $this->form_id );
101 101
     }
102 102
 
103 103
     protected function get_placeholder( $field ) {
104
-        return isset( $field['placeholder'] ) ? $field['placeholder'] : '';
104
+        return isset( $field[ 'placeholder' ] ) ? $field[ 'placeholder' ] : '';
105 105
     }
106 106
 
107 107
     protected function get_hidden( $field ) {
108 108
         $visible = true;
109 109
         // if both hide label and hide field are checked, we gotta hide the field!
110
-        if( isset( $field['hide' ] ) && $field['hide'] == 1 ) {
111
-            if( isset( $field['hide-label' ] ) && $field['hide-label'] == 1 ) {
110
+        if ( isset( $field[ 'hide' ] ) && $field[ 'hide' ] == 1 ) {
111
+            if ( isset( $field[ 'hide-label' ] ) && $field[ 'hide-label' ] == 1 ) {
112 112
                 $visible = false;
113 113
             }
114 114
         }
@@ -120,12 +120,12 @@  discard block
 block discarded – undo
120 120
         $description_above = false;
121 121
         $description       = '';
122 122
 
123
-        if ( isset( $field['description'] ) && trim( $field['description'] ) !== '' ) {
123
+        if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) !== '' ) {
124 124
             $show_description = true;
125
-            $description = $field['description'];
125
+            $description = $field[ 'description' ];
126 126
         }
127 127
 
128
-        if ( isset( $field['description_above'] ) && $field['description_above'] === '1' ) {
128
+        if ( isset( $field[ 'description_above' ] ) && $field[ 'description_above' ] === '1' ) {
129 129
             $description_above = true;
130 130
         }
131 131
         
Please login to merge, or discard this patch.