@@ -33,14 +33,14 @@ discard block |
||
33 | 33 | $defaults = self::get_field_defaults(); |
34 | 34 | |
35 | 35 | // Backward compatibility |
36 | - if( !empty( $field['choices'] ) ) { |
|
37 | - $field['options'] = $field['choices']; |
|
38 | - unset( $field['choices'] ); |
|
36 | + if ( ! empty( $field[ 'choices' ] ) ) { |
|
37 | + $field[ 'options' ] = $field[ 'choices' ]; |
|
38 | + unset( $field[ 'choices' ] ); |
|
39 | 39 | } |
40 | 40 | |
41 | - $this->field = wp_parse_args( $field, $defaults ); |
|
41 | + $this->field = wp_parse_args( $field, $defaults ); |
|
42 | 42 | |
43 | - $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value; |
|
43 | + $this->value = is_null( $curr_value ) ? $this->field[ 'value' ] : $curr_value; |
|
44 | 44 | |
45 | 45 | } |
46 | 46 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | |
81 | 81 | function get_tooltip() { |
82 | - if( ! function_exists('gform_tooltip') ) { |
|
82 | + if ( ! function_exists( 'gform_tooltip' ) ) { |
|
83 | 83 | return null; |
84 | 84 | } |
85 | 85 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | 'url' => '#', |
90 | 90 | ) ); |
91 | 91 | |
92 | - return !empty( $this->field['tooltip'] ) ? ' '. $this->tooltip( $this->field['tooltip'], false, true, $article ) : null; |
|
92 | + return ! empty( $this->field[ 'tooltip' ] ) ? ' ' . $this->tooltip( $this->field[ 'tooltip' ], false, true, $article ) : null; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * Below this line has been modified by GravityView. |
133 | 133 | */ |
134 | 134 | |
135 | - if ( empty( $tooltip_text ) && empty( $article['id'] ) ) { |
|
135 | + if ( empty( $tooltip_text ) && empty( $article[ 'id' ] ) ) { |
|
136 | 136 | return ''; |
137 | 137 | } |
138 | 138 | |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | * @return string |
169 | 169 | */ |
170 | 170 | function get_field_id() { |
171 | - if( isset( $this->field['id'] ) ) { |
|
172 | - return esc_attr( $this->field['id'] ); |
|
171 | + if ( isset( $this->field[ 'id' ] ) ) { |
|
172 | + return esc_attr( $this->field[ 'id' ] ); |
|
173 | 173 | } |
174 | 174 | return esc_attr( sanitize_html_class( $this->name ) ); |
175 | 175 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @return string |
180 | 180 | */ |
181 | 181 | function get_field_label() { |
182 | - return esc_html( trim( $this->field['label'] ) ); |
|
182 | + return esc_html( trim( $this->field[ 'label' ] ) ); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @return string |
191 | 191 | */ |
192 | 192 | function get_field_left_label() { |
193 | - return ! empty( $this->field['left_label'] ) ? esc_html( trim( $this->field['left_label'] ) ) : NULL; |
|
193 | + return ! empty( $this->field[ 'left_label' ] ) ? esc_html( trim( $this->field[ 'left_label' ] ) ) : NULL; |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @return string |
199 | 199 | */ |
200 | 200 | function get_label_class() { |
201 | - return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
201 | + return 'gv-label-' . sanitize_html_class( $this->field[ 'type' ] ); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * @return string |
208 | 208 | */ |
209 | 209 | function get_field_desc() { |
210 | - return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
210 | + return ! empty( $this->field[ 'desc' ] ) ? '<span class="howto">' . $this->field[ 'desc' ] . '</span>' : ''; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | */ |
241 | 241 | function render_setting( $override_input = NULL ) { |
242 | 242 | |
243 | - if( !empty( $this->field['full_width'] ) ) { ?> |
|
243 | + if ( ! empty( $this->field[ 'full_width' ] ) ) { ?> |
|
244 | 244 | <th scope="row" colspan="2"> |
245 | 245 | <div> |
246 | 246 | <label for="<?php echo $this->get_field_id(); ?>"> |
@@ -10,107 +10,107 @@ discard block |
||
10 | 10 | * |
11 | 11 | * @var string |
12 | 12 | */ |
13 | - protected $name; |
|
13 | + protected $name; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Field settings |
17 | 17 | * |
18 | 18 | * @var array |
19 | 19 | */ |
20 | - protected $field; |
|
20 | + protected $field; |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Field current value |
24 | 24 | * |
25 | 25 | * @var mixed |
26 | 26 | */ |
27 | - protected $value; |
|
28 | - |
|
29 | - function __construct( $name = '', $field = array(), $curr_value = NULL ) { |
|
30 | - |
|
31 | - $this->name = $name; |
|
32 | - |
|
33 | - $defaults = self::get_field_defaults(); |
|
34 | - |
|
35 | - // Backward compatibility |
|
36 | - if( !empty( $field['choices'] ) ) { |
|
37 | - $field['options'] = $field['choices']; |
|
38 | - unset( $field['choices'] ); |
|
39 | - } |
|
40 | - |
|
41 | - $this->field = wp_parse_args( $field, $defaults ); |
|
42 | - |
|
43 | - $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value; |
|
44 | - |
|
45 | - } |
|
46 | - |
|
47 | - /** |
|
48 | - * Returns the default details for a field option |
|
49 | - * |
|
50 | - * - default // default option value, in case nothing is defined (@deprecated) |
|
51 | - * - desc // option description |
|
52 | - * - value // the option default value |
|
53 | - * - label // the option label |
|
54 | - * - left_label // In case of checkboxes, left label will appear on the left of the checkbox |
|
55 | - * - id // the field id |
|
56 | - * - type // the option type ( text, checkbox, select, ... ) |
|
57 | - * - options // when type is select, define the select options ('choices' is @deprecated) |
|
58 | - * - merge_tags // if the option supports merge tags feature |
|
59 | - * - class // (new) define extra classes for the field |
|
60 | - * - tooltip // |
|
61 | - * |
|
62 | - * @return array |
|
63 | - */ |
|
64 | - public static function get_field_defaults() { |
|
65 | - return array( |
|
66 | - 'desc' => '', |
|
67 | - 'value' => null, |
|
68 | - 'label' => '', |
|
69 | - 'left_label' => null, |
|
70 | - 'id' => null, |
|
71 | - 'type' => 'text', |
|
72 | - 'options' => null, |
|
73 | - 'merge_tags' => true, |
|
74 | - 'class' => '', |
|
75 | - 'tooltip' => null, |
|
76 | - 'requires' => null |
|
77 | - ); |
|
78 | - } |
|
79 | - |
|
80 | - |
|
81 | - function get_tooltip() { |
|
82 | - if( ! function_exists('gform_tooltip') ) { |
|
83 | - return null; |
|
84 | - } |
|
85 | - |
|
86 | - $article = wp_parse_args( \GV\Utils::get( $this->field, 'article', array() ), array( |
|
87 | - 'id' => '', |
|
88 | - 'type' => 'modal', |
|
89 | - 'url' => '#', |
|
90 | - ) ); |
|
91 | - |
|
92 | - return !empty( $this->field['tooltip'] ) ? ' '. $this->tooltip( $this->field['tooltip'], false, true, $article ) : null; |
|
93 | - } |
|
94 | - |
|
95 | - /** |
|
96 | - * Displays the tooltip |
|
97 | - * |
|
98 | - * @since 2.8.1 |
|
99 | - * |
|
100 | - * @global $__gf_tooltips |
|
101 | - * |
|
102 | - * @param string $name The name of the tooltip to be displayed |
|
103 | - * @param string $css_class Optional. The CSS class to apply toi the element. Defaults to empty string. |
|
104 | - * @param bool $return Optional. If the tooltip should be returned instead of output. Defaults to false (output) |
|
105 | - * @param array $article Optional. Details about support doc article connected to the tooltip. { |
|
106 | - * @type string $id Unique ID of article for Beacon API |
|
107 | - * @type string $url URL of support doc article |
|
108 | - * @type string $type Type of Beacon element to open. {@see https://developer.helpscout.com/beacon-2/web/javascript-api/#beaconarticle} |
|
109 | - * } |
|
110 | - * |
|
111 | - * @return string |
|
112 | - */ |
|
113 | - function tooltip( $name, $css_class = '', $return = false, $article = array() ) { |
|
27 | + protected $value; |
|
28 | + |
|
29 | + function __construct( $name = '', $field = array(), $curr_value = NULL ) { |
|
30 | + |
|
31 | + $this->name = $name; |
|
32 | + |
|
33 | + $defaults = self::get_field_defaults(); |
|
34 | + |
|
35 | + // Backward compatibility |
|
36 | + if( !empty( $field['choices'] ) ) { |
|
37 | + $field['options'] = $field['choices']; |
|
38 | + unset( $field['choices'] ); |
|
39 | + } |
|
40 | + |
|
41 | + $this->field = wp_parse_args( $field, $defaults ); |
|
42 | + |
|
43 | + $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value; |
|
44 | + |
|
45 | + } |
|
46 | + |
|
47 | + /** |
|
48 | + * Returns the default details for a field option |
|
49 | + * |
|
50 | + * - default // default option value, in case nothing is defined (@deprecated) |
|
51 | + * - desc // option description |
|
52 | + * - value // the option default value |
|
53 | + * - label // the option label |
|
54 | + * - left_label // In case of checkboxes, left label will appear on the left of the checkbox |
|
55 | + * - id // the field id |
|
56 | + * - type // the option type ( text, checkbox, select, ... ) |
|
57 | + * - options // when type is select, define the select options ('choices' is @deprecated) |
|
58 | + * - merge_tags // if the option supports merge tags feature |
|
59 | + * - class // (new) define extra classes for the field |
|
60 | + * - tooltip // |
|
61 | + * |
|
62 | + * @return array |
|
63 | + */ |
|
64 | + public static function get_field_defaults() { |
|
65 | + return array( |
|
66 | + 'desc' => '', |
|
67 | + 'value' => null, |
|
68 | + 'label' => '', |
|
69 | + 'left_label' => null, |
|
70 | + 'id' => null, |
|
71 | + 'type' => 'text', |
|
72 | + 'options' => null, |
|
73 | + 'merge_tags' => true, |
|
74 | + 'class' => '', |
|
75 | + 'tooltip' => null, |
|
76 | + 'requires' => null |
|
77 | + ); |
|
78 | + } |
|
79 | + |
|
80 | + |
|
81 | + function get_tooltip() { |
|
82 | + if( ! function_exists('gform_tooltip') ) { |
|
83 | + return null; |
|
84 | + } |
|
85 | + |
|
86 | + $article = wp_parse_args( \GV\Utils::get( $this->field, 'article', array() ), array( |
|
87 | + 'id' => '', |
|
88 | + 'type' => 'modal', |
|
89 | + 'url' => '#', |
|
90 | + ) ); |
|
91 | + |
|
92 | + return !empty( $this->field['tooltip'] ) ? ' '. $this->tooltip( $this->field['tooltip'], false, true, $article ) : null; |
|
93 | + } |
|
94 | + |
|
95 | + /** |
|
96 | + * Displays the tooltip |
|
97 | + * |
|
98 | + * @since 2.8.1 |
|
99 | + * |
|
100 | + * @global $__gf_tooltips |
|
101 | + * |
|
102 | + * @param string $name The name of the tooltip to be displayed |
|
103 | + * @param string $css_class Optional. The CSS class to apply toi the element. Defaults to empty string. |
|
104 | + * @param bool $return Optional. If the tooltip should be returned instead of output. Defaults to false (output) |
|
105 | + * @param array $article Optional. Details about support doc article connected to the tooltip. { |
|
106 | + * @type string $id Unique ID of article for Beacon API |
|
107 | + * @type string $url URL of support doc article |
|
108 | + * @type string $type Type of Beacon element to open. {@see https://developer.helpscout.com/beacon-2/web/javascript-api/#beaconarticle} |
|
109 | + * } |
|
110 | + * |
|
111 | + * @return string |
|
112 | + */ |
|
113 | + function tooltip( $name, $css_class = '', $return = false, $article = array() ) { |
|
114 | 114 | global $__gf_tooltips; //declared as global to improve WPML performance |
115 | 115 | |
116 | 116 | $css_class = empty( $css_class ) ? 'tooltip' : $css_class; |
@@ -128,17 +128,17 @@ discard block |
||
128 | 128 | $tooltip_class = isset( $__gf_tooltips[ $name ] ) ? "tooltip_{$name}" : ''; |
129 | 129 | $tooltip_class = esc_attr( $tooltip_class ); |
130 | 130 | |
131 | - /** |
|
132 | - * Below this line has been modified by GravityView. |
|
133 | - */ |
|
131 | + /** |
|
132 | + * Below this line has been modified by GravityView. |
|
133 | + */ |
|
134 | 134 | |
135 | 135 | if ( empty( $tooltip_text ) && empty( $article['id'] ) ) { |
136 | 136 | return ''; |
137 | 137 | } |
138 | 138 | |
139 | 139 | $url = '#'; |
140 | - $atts = 'onclick="return false;" onkeypress="return false;"'; |
|
141 | - $anchor_text = '<i class=\'fa fa-question-circle\'></i>'; |
|
140 | + $atts = 'onclick="return false;" onkeypress="return false;"'; |
|
141 | + $anchor_text = '<i class=\'fa fa-question-circle\'></i>'; |
|
142 | 142 | $css_class = gravityview_sanitize_html_class( 'gf_tooltip ' . $css_class . ' ' . $tooltip_class ); |
143 | 143 | |
144 | 144 | $tooltip = sprintf( '<a href="%s" %s class="%s" title="%s" role="button">%s</a>', |
@@ -149,11 +149,11 @@ discard block |
||
149 | 149 | $anchor_text |
150 | 150 | ); |
151 | 151 | |
152 | - /** |
|
153 | - * Modify the tooltip HTML before outputting |
|
154 | - * @internal |
|
155 | - * @see GravityView_Support_Port::maybe_add_article_to_tooltip() |
|
156 | - */ |
|
152 | + /** |
|
153 | + * Modify the tooltip HTML before outputting |
|
154 | + * @internal |
|
155 | + * @see GravityView_Support_Port::maybe_add_article_to_tooltip() |
|
156 | + */ |
|
157 | 157 | $tooltip = apply_filters( 'gravityview/tooltips/tooltip', $tooltip, $article, $url, $atts, $css_class, $tooltip_text, $anchor_text ); |
158 | 158 | |
159 | 159 | if ( ! $return ) { |
@@ -163,84 +163,84 @@ discard block |
||
163 | 163 | return $tooltip; |
164 | 164 | } |
165 | 165 | |
166 | - /** |
|
167 | - * Build input id based on the name |
|
168 | - * @return string |
|
169 | - */ |
|
170 | - function get_field_id() { |
|
171 | - if( isset( $this->field['id'] ) ) { |
|
172 | - return esc_attr( $this->field['id'] ); |
|
173 | - } |
|
174 | - return esc_attr( sanitize_html_class( $this->name ) ); |
|
175 | - } |
|
176 | - |
|
177 | - /** |
|
178 | - * Retrieve field label |
|
179 | - * @return string |
|
180 | - */ |
|
181 | - function get_field_label() { |
|
182 | - return esc_html( trim( $this->field['label'] ) ); |
|
183 | - } |
|
166 | + /** |
|
167 | + * Build input id based on the name |
|
168 | + * @return string |
|
169 | + */ |
|
170 | + function get_field_id() { |
|
171 | + if( isset( $this->field['id'] ) ) { |
|
172 | + return esc_attr( $this->field['id'] ); |
|
173 | + } |
|
174 | + return esc_attr( sanitize_html_class( $this->name ) ); |
|
175 | + } |
|
176 | + |
|
177 | + /** |
|
178 | + * Retrieve field label |
|
179 | + * @return string |
|
180 | + */ |
|
181 | + function get_field_label() { |
|
182 | + return esc_html( trim( $this->field['label'] ) ); |
|
183 | + } |
|
184 | 184 | |
185 | 185 | /** |
186 | 186 | * Retrieve field left label |
187 | - * |
|
188 | - * @since 1.7 |
|
189 | - * |
|
187 | + * |
|
188 | + * @since 1.7 |
|
189 | + * |
|
190 | 190 | * @return string |
191 | 191 | */ |
192 | 192 | function get_field_left_label() { |
193 | 193 | return ! empty( $this->field['left_label'] ) ? esc_html( trim( $this->field['left_label'] ) ) : NULL; |
194 | 194 | } |
195 | 195 | |
196 | - /** |
|
197 | - * Retrieve field label class |
|
198 | - * @return string |
|
199 | - */ |
|
200 | - function get_label_class() { |
|
201 | - return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
202 | - } |
|
203 | - |
|
204 | - |
|
205 | - /** |
|
206 | - * Retrieve field description |
|
207 | - * @return string |
|
208 | - */ |
|
209 | - function get_field_desc() { |
|
210 | - return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
211 | - } |
|
212 | - |
|
213 | - |
|
214 | - /** |
|
215 | - * Verify if field should have merge tags |
|
216 | - * @return boolean |
|
217 | - */ |
|
218 | - function show_merge_tags() { |
|
219 | - // Show the merge tags if the field is a list view |
|
220 | - $is_list = preg_match( '/_list-/ism', $this->name ); |
|
221 | - // Or is a single entry view |
|
222 | - $is_single = preg_match( '/single_/ism', $this->name ); |
|
223 | - |
|
224 | - return ( $is_single || $is_list ); |
|
225 | - } |
|
226 | - |
|
227 | - |
|
228 | - |
|
229 | - /** |
|
230 | - * important! Override this class |
|
231 | - * outputs the field option html |
|
232 | - */ |
|
233 | - function render_option() { |
|
234 | - // to replace on each field |
|
235 | - } |
|
236 | - |
|
237 | - /** |
|
238 | - * important! Override this class if needed |
|
239 | - * outputs the field setting html |
|
240 | - */ |
|
241 | - function render_setting( $override_input = NULL ) { |
|
242 | - |
|
243 | - if( !empty( $this->field['full_width'] ) ) { ?> |
|
196 | + /** |
|
197 | + * Retrieve field label class |
|
198 | + * @return string |
|
199 | + */ |
|
200 | + function get_label_class() { |
|
201 | + return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
202 | + } |
|
203 | + |
|
204 | + |
|
205 | + /** |
|
206 | + * Retrieve field description |
|
207 | + * @return string |
|
208 | + */ |
|
209 | + function get_field_desc() { |
|
210 | + return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
211 | + } |
|
212 | + |
|
213 | + |
|
214 | + /** |
|
215 | + * Verify if field should have merge tags |
|
216 | + * @return boolean |
|
217 | + */ |
|
218 | + function show_merge_tags() { |
|
219 | + // Show the merge tags if the field is a list view |
|
220 | + $is_list = preg_match( '/_list-/ism', $this->name ); |
|
221 | + // Or is a single entry view |
|
222 | + $is_single = preg_match( '/single_/ism', $this->name ); |
|
223 | + |
|
224 | + return ( $is_single || $is_list ); |
|
225 | + } |
|
226 | + |
|
227 | + |
|
228 | + |
|
229 | + /** |
|
230 | + * important! Override this class |
|
231 | + * outputs the field option html |
|
232 | + */ |
|
233 | + function render_option() { |
|
234 | + // to replace on each field |
|
235 | + } |
|
236 | + |
|
237 | + /** |
|
238 | + * important! Override this class if needed |
|
239 | + * outputs the field setting html |
|
240 | + */ |
|
241 | + function render_setting( $override_input = NULL ) { |
|
242 | + |
|
243 | + if( !empty( $this->field['full_width'] ) ) { ?> |
|
244 | 244 | <th scope="row" colspan="2"> |
245 | 245 | <div> |
246 | 246 | <label for="<?php echo $this->get_field_id(); ?>"> |
@@ -260,14 +260,14 @@ discard block |
||
260 | 260 | </td> |
261 | 261 | <?php } |
262 | 262 | |
263 | - } |
|
263 | + } |
|
264 | 264 | |
265 | - /** |
|
266 | - * important! Override this class |
|
267 | - * outputs the input html part |
|
268 | - */ |
|
269 | - function render_input( $override_input ) { |
|
270 | - echo ''; |
|
271 | - } |
|
265 | + /** |
|
266 | + * important! Override this class |
|
267 | + * outputs the input html part |
|
268 | + */ |
|
269 | + function render_input( $override_input ) { |
|
270 | + echo ''; |
|
271 | + } |
|
272 | 272 | |
273 | 273 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * Try subkeys after split. |
92 | 92 | */ |
93 | 93 | if ( count( $parts = explode( '/', $key, 2 ) ) > 1 ) { |
94 | - return self::get( self::get( $array, $parts[0] ), $parts[1], $default ); |
|
94 | + return self::get( self::get( $array, $parts[ 0 ] ), $parts[ 1 ], $default ); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | return $default; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | public static function gf_query_debug( $query ) { |
146 | 146 | $introspect = $query->_introspect(); |
147 | 147 | return array( |
148 | - 'where' => $query->_where_unwrap( $introspect['where'] ) |
|
148 | + 'where' => $query->_where_unwrap( $introspect[ 'where' ] ) |
|
149 | 149 | ); |
150 | 150 | } |
151 | 151 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | if ( $condition->expressions ) { |
159 | 159 | $conditions = array(); |
160 | 160 | foreach ( $condition->expressions as $expression ) { |
161 | - $conditions[] = self::gf_query_strip_condition_column_aliases( $expression ); |
|
161 | + $conditions[ ] = self::gf_query_strip_condition_column_aliases( $expression ); |
|
162 | 162 | } |
163 | 163 | return call_user_func_array( |
164 | 164 | array( '\GF_Query_Condition', $condition->operator == 'AND' ? '_and' : '_or' ), |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
49 | 49 | |
50 | - if( 'edit' === $context ) { |
|
50 | + if ( 'edit' === $context ) { |
|
51 | 51 | return $field_options; |
52 | 52 | } |
53 | 53 | |
54 | - $this->add_field_support('date_display', $field_options ); |
|
54 | + $this->add_field_support( 'date_display', $field_options ); |
|
55 | 55 | |
56 | 56 | return $field_options; |
57 | 57 | } |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | public function get_content( $output = '', $entry = array(), $field_settings = array(), $field = array() ) { |
72 | 72 | |
73 | 73 | /** Overridden by a template. */ |
74 | - if( \GV\Utils::get( $field, 'field_path' ) !== gravityview()->plugin->dir( 'templates/fields/field-html.php' ) ) { |
|
74 | + if ( \GV\Utils::get( $field, 'field_path' ) !== gravityview()->plugin->dir( 'templates/fields/field-html.php' ) ) { |
|
75 | 75 | return $output; |
76 | 76 | } |
77 | 77 | |
78 | - return GVCommon::format_date( $field['value'], 'format=' . \GV\Utils::get( $field_settings, 'date_display' ) ); |
|
78 | + return GVCommon::format_date( $field[ 'value' ], 'format=' . \GV\Utils::get( $field_settings, 'date_display' ) ); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | parent::add_hooks(); |
35 | 35 | |
36 | - add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown'), 10, 2 ); |
|
36 | + add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown' ), 10, 2 ); |
|
37 | 37 | |
38 | 38 | add_filter( 'gravityview/admin/available_fields', array( $this, 'maybe_add_non_default_fields' ), 10, 3 ); |
39 | 39 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @return void |
54 | 54 | */ |
55 | 55 | public function clear_cache_after_workflow( $form, $entry_id, $step_id, $starting_step_id ) { |
56 | - do_action( 'gravityview_clear_form_cache', $form['id'] ); |
|
56 | + do_action( 'gravityview_clear_form_cache', $form[ 'id' ] ); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public static function get_status_options( $form_id = 0, $status_key = 'workflow_final_status' ) { |
72 | 72 | |
73 | - if( empty( $form_id ) ) { |
|
73 | + if ( empty( $form_id ) ) { |
|
74 | 74 | $form_id = GravityView_View::getInstance()->getFormId(); |
75 | 75 | } |
76 | 76 | |
77 | 77 | $entry_meta = gravity_flow()->get_entry_meta( array(), $form_id ); |
78 | 78 | |
79 | - return (array) \GV\Utils::get( $entry_meta, $status_key . '/filter/choices' ); |
|
79 | + return (array)\GV\Utils::get( $entry_meta, $status_key . '/filter/choices' ); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | $workflow_steps = $GFlow->get_steps(); |
100 | 100 | |
101 | - if( $workflow_steps ) { |
|
101 | + if ( $workflow_steps ) { |
|
102 | 102 | |
103 | 103 | foreach ( $workflow_steps as $step ) { |
104 | 104 | |
@@ -110,12 +110,12 @@ discard block |
||
110 | 110 | ); |
111 | 111 | } |
112 | 112 | |
113 | - $fields['workflow_step'] = array( |
|
113 | + $fields[ 'workflow_step' ] = array( |
|
114 | 114 | 'label' => esc_html__( 'Workflow Step', 'gravityview' ), |
115 | 115 | 'type' => 'select', |
116 | 116 | ); |
117 | 117 | |
118 | - $fields['workflow_final_status'] = array( |
|
118 | + $fields[ 'workflow_final_status' ] = array( |
|
119 | 119 | 'label' => esc_html__( 'Workflow Status', 'gravityview' ), |
120 | 120 | 'type' => 'select', |
121 | 121 | ); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | if ( ( $insert_at = array_search( 'workflow_final_status', wp_list_pluck( $fields, 'key' ) ) ) !== false ) { |
132 | 132 | $fields_end = array_splice( $fields, $insert_at + 1 ); |
133 | 133 | |
134 | - $fields[] = array( |
|
134 | + $fields[ ] = array( |
|
135 | 135 | 'text' => __( 'Workflow Current Status Timestamp', 'gravityview' ), |
136 | 136 | 'operators' => array( '>', '<' ), |
137 | 137 | 'placeholder' => 'yyyy-mm-dd', |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | $keys_end = array_splice( $keys, $insert_at + 1 ); |
158 | 158 | $values_end = array_splice( $values, $insert_at + 1 ); |
159 | 159 | |
160 | - $keys[] = 'workflow_current_status_timestamp'; |
|
161 | - $values[] = array( |
|
160 | + $keys[ ] = 'workflow_current_status_timestamp'; |
|
161 | + $values[ ] = array( |
|
162 | 162 | 'label' => __( 'Workflow Current Status Timestamp', 'gravityview' ), |
163 | 163 | 'type' => 'workflow_current_status_timestamp', |
164 | 164 | ); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function set_provider( $provider = null ) { |
40 | 40 | |
41 | - if( gravityview()->request->is_admin() ) { |
|
41 | + if ( gravityview()->request->is_admin() ) { |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | // We're switching providers; remove the hooks that were added. |
60 | - if( self::$active_provider ) { |
|
60 | + if ( self::$active_provider ) { |
|
61 | 61 | self::$active_provider->remove_hooks(); |
62 | 62 | } |
63 | 63 |
@@ -10,7 +10,9 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
13 | +if ( ! defined( 'ABSPATH' ) ) { |
|
14 | + exit; |
|
15 | +} |
|
14 | 16 | |
15 | 17 | /** |
16 | 18 | * Allows plugins to use their own update API. |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | $this->plugin_file = $_plugin_file; |
50 | 50 | $this->name = plugin_basename( $_plugin_file ); |
51 | 51 | $this->slug = basename( $_plugin_file, '.php' ); |
52 | - $this->version = $_api_data['version']; |
|
53 | - $this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false; |
|
54 | - $this->beta = ! empty( $this->api_data['beta'] ) ? true : false; |
|
52 | + $this->version = $_api_data[ 'version' ]; |
|
53 | + $this->wp_override = isset( $_api_data[ 'wp_override' ] ) ? (bool)$_api_data[ 'wp_override' ] : false; |
|
54 | + $this->beta = ! empty( $this->api_data[ 'beta' ] ) ? true : false; |
|
55 | 55 | $this->failed_request_cache_key = 'edd_sl_failed_http_' . md5( $this->api_url ); |
56 | 56 | |
57 | 57 | $edd_plugin_data[ $this->slug ] = $this->api_data; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | printf( |
230 | 230 | /* translators: the plugin name. */ |
231 | 231 | esc_html__( 'There is a new version of %1$s available.', 'gravityview' ), |
232 | - esc_html( $plugin['Name'] ) |
|
232 | + esc_html( $plugin[ 'Name' ] ) |
|
233 | 233 | ); |
234 | 234 | |
235 | 235 | if ( ! current_user_can( 'update_plugins' ) ) { |
@@ -274,8 +274,8 @@ discard block |
||
274 | 274 | * @return array |
275 | 275 | */ |
276 | 276 | private function get_active_plugins() { |
277 | - $active_plugins = (array) get_option( 'active_plugins' ); |
|
278 | - $active_network_plugins = (array) get_site_option( 'active_sitewide_plugins' ); |
|
277 | + $active_plugins = (array)get_option( 'active_plugins' ); |
|
278 | + $active_network_plugins = (array)get_site_option( 'active_sitewide_plugins' ); |
|
279 | 279 | |
280 | 280 | return array_merge( $active_plugins, array_keys( $active_network_plugins ) ); |
281 | 281 | } |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | public function http_request_args( $args, $url ) { |
394 | 394 | |
395 | 395 | if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) { |
396 | - $args['sslverify'] = $this->verify_ssl(); |
|
396 | + $args[ 'sslverify' ] = $this->verify_ssl(); |
|
397 | 397 | } |
398 | 398 | return $args; |
399 | 399 | |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | private function api_request( $_action, $_data ) { |
414 | 414 | $data = array_merge( $this->api_data, $_data ); |
415 | 415 | |
416 | - if ( $data['slug'] !== $this->slug ) { |
|
416 | + if ( $data[ 'slug' ] !== $this->slug ) { |
|
417 | 417 | return; |
418 | 418 | } |
419 | 419 | |
@@ -477,15 +477,15 @@ discard block |
||
477 | 477 | */ |
478 | 478 | public function show_changelog() { |
479 | 479 | |
480 | - if ( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' !== $_REQUEST['edd_sl_action'] ) { |
|
480 | + if ( empty( $_REQUEST[ 'edd_sl_action' ] ) || 'view_plugin_changelog' !== $_REQUEST[ 'edd_sl_action' ] ) { |
|
481 | 481 | return; |
482 | 482 | } |
483 | 483 | |
484 | - if ( empty( $_REQUEST['plugin'] ) ) { |
|
484 | + if ( empty( $_REQUEST[ 'plugin' ] ) ) { |
|
485 | 485 | return; |
486 | 486 | } |
487 | 487 | |
488 | - if ( empty( $_REQUEST['slug'] ) || $this->slug !== $_REQUEST['slug'] ) { |
|
488 | + if ( empty( $_REQUEST[ 'slug' ] ) || $this->slug !== $_REQUEST[ 'slug' ] ) { |
|
489 | 489 | return; |
490 | 490 | } |
491 | 491 | |
@@ -496,8 +496,8 @@ discard block |
||
496 | 496 | $version_info = $this->get_repo_api_data(); |
497 | 497 | if ( isset( $version_info->sections ) ) { |
498 | 498 | $sections = $this->convert_object_to_array( $version_info->sections ); |
499 | - if ( ! empty( $sections['changelog'] ) ) { |
|
500 | - echo '<div style="background:#fff;padding:10px;">' . wp_kses_post( $sections['changelog'] ) . '</div>'; |
|
499 | + if ( ! empty( $sections[ 'changelog' ] ) ) { |
|
500 | + echo '<div style="background:#fff;padding:10px;">' . wp_kses_post( $sections[ 'changelog' ] ) . '</div>'; |
|
501 | 501 | } |
502 | 502 | } |
503 | 503 | |
@@ -512,12 +512,12 @@ discard block |
||
512 | 512 | private function get_version_from_remote() { |
513 | 513 | $api_params = array( |
514 | 514 | 'edd_action' => 'get_version', |
515 | - 'license' => ! empty( $this->api_data['license'] ) ? $this->api_data['license'] : '', |
|
516 | - 'item_name' => isset( $this->api_data['item_name'] ) ? $this->api_data['item_name'] : false, |
|
517 | - 'item_id' => isset( $this->api_data['item_id'] ) ? $this->api_data['item_id'] : false, |
|
518 | - 'version' => isset( $this->api_data['version'] ) ? $this->api_data['version'] : false, |
|
515 | + 'license' => ! empty( $this->api_data[ 'license' ] ) ? $this->api_data[ 'license' ] : '', |
|
516 | + 'item_name' => isset( $this->api_data[ 'item_name' ] ) ? $this->api_data[ 'item_name' ] : false, |
|
517 | + 'item_id' => isset( $this->api_data[ 'item_id' ] ) ? $this->api_data[ 'item_id' ] : false, |
|
518 | + 'version' => isset( $this->api_data[ 'version' ] ) ? $this->api_data[ 'version' ] : false, |
|
519 | 519 | 'slug' => $this->slug, |
520 | - 'author' => $this->api_data['author'], |
|
520 | + 'author' => $this->api_data[ 'author' ], |
|
521 | 521 | 'url' => home_url(), |
522 | 522 | 'beta' => $this->beta, |
523 | 523 | 'php_version' => phpversion(), |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | |
567 | 567 | if ( ! empty( $request->sections ) ) { |
568 | 568 | foreach ( $request->sections as $key => $section ) { |
569 | - $request->$key = (array) $section; |
|
569 | + $request->$key = (array)$section; |
|
570 | 570 | } |
571 | 571 | } |
572 | 572 | |
@@ -588,17 +588,17 @@ discard block |
||
588 | 588 | $cache = get_option( $cache_key ); |
589 | 589 | |
590 | 590 | // Cache is expired |
591 | - if ( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) { |
|
591 | + if ( empty( $cache[ 'timeout' ] ) || time() > $cache[ 'timeout' ] ) { |
|
592 | 592 | return false; |
593 | 593 | } |
594 | 594 | |
595 | 595 | // We need to turn the icons into an array, thanks to WP Core forcing these into an object at some point. |
596 | - $cache['value'] = json_decode( $cache['value'] ); |
|
597 | - if ( ! empty( $cache['value']->icons ) ) { |
|
598 | - $cache['value']->icons = (array) $cache['value']->icons; |
|
596 | + $cache[ 'value' ] = json_decode( $cache[ 'value' ] ); |
|
597 | + if ( ! empty( $cache[ 'value' ]->icons ) ) { |
|
598 | + $cache[ 'value' ]->icons = (array)$cache[ 'value' ]->icons; |
|
599 | 599 | } |
600 | 600 | |
601 | - return $cache['value']; |
|
601 | + return $cache[ 'value' ]; |
|
602 | 602 | |
603 | 603 | } |
604 | 604 | |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | update_option( $cache_key, $data, 'no' ); |
623 | 623 | |
624 | 624 | // Delete the duplicate option |
625 | - delete_option( 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ) ); |
|
625 | + delete_option( 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data[ 'license' ] . $this->beta ) ) ); |
|
626 | 626 | } |
627 | 627 | |
628 | 628 | /** |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | * @return bool |
633 | 633 | */ |
634 | 634 | private function verify_ssl() { |
635 | - return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this ); |
|
635 | + return (bool)apply_filters( 'edd_sl_api_request_verify_ssl', true, $this ); |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | /** |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | * @return string |
643 | 643 | */ |
644 | 644 | private function get_cache_key() { |
645 | - $string = $this->slug . $this->api_data['license'] . $this->beta; |
|
645 | + $string = $this->slug . $this->api_data[ 'license' ] . $this->beta; |
|
646 | 646 | |
647 | 647 | return 'edd_sl_' . md5( serialize( $string ) ); |
648 | 648 | } |
@@ -21,13 +21,13 @@ |
||
21 | 21 | $plugin_hooks_files = glob( $include_path . 'class-gravityview-plugin-hooks-*.php' ); |
22 | 22 | |
23 | 23 | // Load all plugin files automatically |
24 | -foreach ( (array) $plugin_hooks_files as $plugin_hooks_file ) { |
|
24 | +foreach ( (array)$plugin_hooks_files as $plugin_hooks_file ) { |
|
25 | 25 | include $plugin_hooks_file; |
26 | 26 | } |
27 | 27 | |
28 | 28 | $theme_hooks_files = glob( $include_path . 'class-gravityview-theme-hooks-*.php' ); |
29 | 29 | |
30 | 30 | // Load all theme files automatically |
31 | -foreach ( (array) $theme_hooks_files as $theme_hooks_file ) { |
|
31 | +foreach ( (array)$theme_hooks_files as $theme_hooks_file ) { |
|
32 | 32 | include $theme_hooks_file; |
33 | 33 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | add_filter( 'icl_ls_languages', array( $this, 'wpml_ls_filter' ) ); |
66 | 66 | |
67 | - add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link') ); |
|
67 | + add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link' ) ); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | function filter_gravityview_back_link( $link ) { |
85 | 85 | global $wpml_url_filters; |
86 | 86 | |
87 | - if( $wpml_url_filters ) { |
|
87 | + if ( $wpml_url_filters ) { |
|
88 | 88 | $link = $wpml_url_filters->permalink_filter( $link, GravityView_frontend::getInstance()->getPostId() ); |
89 | 89 | } |
90 | 90 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | private function remove_url_hooks() { |
102 | 102 | global $wpml_url_filters; |
103 | 103 | |
104 | - if( ! $wpml_url_filters ) { |
|
104 | + if ( ! $wpml_url_filters ) { |
|
105 | 105 | return; |
106 | 106 | } |
107 | 107 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | private function add_url_hooks() { |
130 | 130 | global $wpml_url_filters; |
131 | 131 | |
132 | - if( ! $wpml_url_filters ) { |
|
132 | + if ( ! $wpml_url_filters ) { |
|
133 | 133 | return; |
134 | 134 | } |
135 | 135 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | break; |
227 | 227 | } |
228 | 228 | |
229 | - $languages[ $lang_code ]['url'] = $entry_link; |
|
229 | + $languages[ $lang_code ][ 'url' ] = $entry_link; |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | $this->add_url_hooks(); |
@@ -421,7 +421,7 @@ |
||
421 | 421 | </header> |
422 | 422 | <div class="gform-settings-panel__content" style="padding: 0 1rem 1.25rem"> |
423 | 423 | |
424 | -HTML; |
|
424 | +html; |
|
425 | 425 | } else { |
426 | 426 | echo '<div class="gv-uninstall-form-wrapper" style="font-size: 110%; padding: 15px 0;">'; |
427 | 427 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $setting_tabs = parent::get_app_settings_tabs(); |
119 | 119 | |
120 | 120 | foreach ( $setting_tabs as &$tab ) { |
121 | - if ( 'uninstall' !== $tab['name'] ) { |
|
121 | + if ( 'uninstall' !== $tab[ 'name' ] ) { |
|
122 | 122 | continue; |
123 | 123 | } |
124 | 124 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | // Add trash can icon to resemble the look and feel of the GF Settings page |
132 | - $tab['icon'] = 'dashicons-trash'; |
|
132 | + $tab[ 'icon' ] = 'dashicons-trash'; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | return array_filter( $setting_tabs ); |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function register_no_conflict( $items ) { |
146 | 146 | |
147 | - $items[] = 'gform_settings'; |
|
148 | - $items[] = 'gv-admin-edd-license'; |
|
147 | + $items[ ] = 'gform_settings'; |
|
148 | + $items[ ] = 'gv-admin-edd-license'; |
|
149 | 149 | |
150 | 150 | return $items; |
151 | 151 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | $href = add_query_arg( array( 'post_type' => 'gravityview', 'page' => 'gravityview_settings', 'view' => 'uninstall' ), admin_url( 'edit.php' ) ); |
198 | 198 | |
199 | - $uninstall_button = '<a href="' . esc_url( $href ) . '" class="' . gravityview_sanitize_html_class( $html_class ). '">' . esc_html__( 'Uninstall GravityView', 'gravityview' ) . '</a>'; |
|
199 | + $uninstall_button = '<a href="' . esc_url( $href ) . '" class="' . gravityview_sanitize_html_class( $html_class ) . '">' . esc_html__( 'Uninstall GravityView', 'gravityview' ) . '</a>'; |
|
200 | 200 | |
201 | 201 | $html .= $uninstall_button; |
202 | 202 | |
@@ -215,10 +215,10 @@ discard block |
||
215 | 215 | */ |
216 | 216 | public function settings_save( $field, $echo = true ) { |
217 | 217 | |
218 | - $field['type'] = 'submit'; |
|
219 | - $field['name'] = 'gform-settings-save'; |
|
220 | - $field['class'] = 'button button-primary primary button-hero'; |
|
221 | - $field['value'] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) ); |
|
218 | + $field[ 'type' ] = 'submit'; |
|
219 | + $field[ 'name' ] = 'gform-settings-save'; |
|
220 | + $field[ 'class' ] = 'button button-primary primary button-hero'; |
|
221 | + $field[ 'value' ] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) ); |
|
222 | 222 | |
223 | 223 | $html = $this->as_html( $field, false ); |
224 | 224 | |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public function modify_app_settings_menu_title( $setting_tabs ) { |
242 | 242 | |
243 | - $setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview' ); |
|
244 | - $setting_tabs[0]['icon'] = 'dashicons-admin-settings'; |
|
243 | + $setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' ); |
|
244 | + $setting_tabs[ 0 ][ 'icon' ] = 'dashicons-admin-settings'; |
|
245 | 245 | |
246 | 246 | return $setting_tabs; |
247 | 247 | } |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | $i = 0; |
490 | 490 | while ( $i < 11 ) { |
491 | 491 | echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>'; |
492 | - $i ++; |
|
492 | + $i++; |
|
493 | 493 | } |
494 | 494 | ?> |
495 | 495 | </ul> |
@@ -694,14 +694,14 @@ discard block |
||
694 | 694 | */ |
695 | 695 | public function as_html( $field, $echo = true ) { |
696 | 696 | |
697 | - $field['type'] = ( isset( $field['type'] ) && in_array( $field['type'], array( 'submit', 'reset', 'button' ) ) ) ? $field['type'] : 'submit'; |
|
697 | + $field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit'; |
|
698 | 698 | |
699 | 699 | $attributes = $this->get_field_attributes( $field ); |
700 | 700 | $default_value = Utils::get( $field, 'value', Utils::get( $field, 'default_value' ) ); |
701 | - $value = $this->get( $field['name'], $default_value ); |
|
701 | + $value = $this->get( $field[ 'name' ], $default_value ); |
|
702 | 702 | |
703 | - $attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary primary gfbutton'; |
|
704 | - $name = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_' . $field['name']; |
|
703 | + $attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary primary gfbutton'; |
|
704 | + $name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ]; |
|
705 | 705 | |
706 | 706 | if ( empty( $value ) ) { |
707 | 707 | $value = __( 'Update Settings', 'gravityview' ); |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | $attributes = $this->get_field_attributes( $field ); |
711 | 711 | |
712 | 712 | $html = '<input |
713 | - type="' . $field['type'] . '" |
|
713 | + type="' . $field[ 'type' ] . '" |
|
714 | 714 | name="' . esc_attr( $name ) . '" |
715 | 715 | value="' . $value . '" ' . |
716 | 716 | implode( ' ', $attributes ) . |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | */ |
745 | 745 | public function is_save_postback() { |
746 | 746 | |
747 | - return isset( $_POST['gform-settings-save'] ) && isset( $_POST['_gravityview_save_settings_nonce'] ); |
|
747 | + return isset( $_POST[ 'gform-settings-save' ] ) && isset( $_POST[ '_gravityview_save_settings_nonce' ] ); |
|
748 | 748 | } |
749 | 749 | |
750 | 750 | /** |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | |
857 | 857 | $scripts = parent::scripts(); |
858 | 858 | |
859 | - $scripts[] = array( |
|
859 | + $scripts[ ] = array( |
|
860 | 860 | 'handle' => 'gform_tooltip_init', |
861 | 861 | 'enqueue' => array( |
862 | 862 | array( |
@@ -884,11 +884,11 @@ discard block |
||
884 | 884 | ); |
885 | 885 | |
886 | 886 | // This file was removed from 2.5 |
887 | - if( ! gravityview()->plugin->is_GF_25() ) { |
|
888 | - $deps[] = 'gform_tooltip'; |
|
887 | + if ( ! gravityview()->plugin->is_GF_25() ) { |
|
888 | + $deps[ ] = 'gform_tooltip'; |
|
889 | 889 | } |
890 | 890 | |
891 | - $styles[] = array( |
|
891 | + $styles[ ] = array( |
|
892 | 892 | 'handle' => 'gravityview_settings', |
893 | 893 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
894 | 894 | 'version' => Plugin::$version, |
@@ -975,7 +975,7 @@ discard block |
||
975 | 975 | 'name' => 'support-email', |
976 | 976 | 'type' => 'text', |
977 | 977 | 'validate' => 'email', |
978 | - 'default_value' => $default_settings['support-email'], |
|
978 | + 'default_value' => $default_settings[ 'support-email' ], |
|
979 | 979 | 'label' => __( 'Support Email', 'gravityview' ), |
980 | 980 | 'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ), |
981 | 981 | 'class' => 'code regular-text', |
@@ -987,7 +987,7 @@ discard block |
||
987 | 987 | 'name' => 'support_port', |
988 | 988 | 'type' => 'radio', |
989 | 989 | 'label' => __( 'Show Support Port?', 'gravityview' ), |
990 | - 'default_value' => $default_settings['support_port'], |
|
990 | + 'default_value' => $default_settings[ 'support_port' ], |
|
991 | 991 | 'horizontal' => 1, |
992 | 992 | 'choices' => array( |
993 | 993 | array( |
@@ -1006,7 +1006,7 @@ discard block |
||
1006 | 1006 | 'name' => 'no-conflict-mode', |
1007 | 1007 | 'type' => 'radio', |
1008 | 1008 | 'label' => __( 'No-Conflict Mode', 'gravityview' ), |
1009 | - 'default_value' => $default_settings['no-conflict-mode'], |
|
1009 | + 'default_value' => $default_settings[ 'no-conflict-mode' ], |
|
1010 | 1010 | 'horizontal' => 1, |
1011 | 1011 | 'choices' => array( |
1012 | 1012 | array( |
@@ -1028,7 +1028,7 @@ discard block |
||
1028 | 1028 | 'name' => 'rest_api', |
1029 | 1029 | 'type' => 'radio', |
1030 | 1030 | 'label' => __( 'REST API', 'gravityview' ), |
1031 | - 'default_value' => $default_settings['rest_api'], |
|
1031 | + 'default_value' => $default_settings[ 'rest_api' ], |
|
1032 | 1032 | 'horizontal' => 1, |
1033 | 1033 | 'choices' => array( |
1034 | 1034 | array( |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | 'name' => 'powered_by', |
1048 | 1048 | 'type' => 'checkbox', |
1049 | 1049 | 'label' => __( 'Display "Powered By" Link', 'gravityview' ), |
1050 | - 'default_value' => $default_settings['powered_by'], |
|
1050 | + 'default_value' => $default_settings[ 'powered_by' ], |
|
1051 | 1051 | 'choices' => array( |
1052 | 1052 | array( |
1053 | 1053 | 'label' => esc_html__( 'Display a "Powered by GravityView" link', 'gravityview' ), |
@@ -1072,7 +1072,7 @@ discard block |
||
1072 | 1072 | 'name' => 'beta', |
1073 | 1073 | 'type' => 'checkbox', |
1074 | 1074 | 'label' => __( 'Become a Beta Tester', 'gravityview' ), |
1075 | - 'default_value' => $default_settings['beta'], |
|
1075 | + 'default_value' => $default_settings[ 'beta' ], |
|
1076 | 1076 | 'horizontal' => 1, |
1077 | 1077 | 'choices' => array( |
1078 | 1078 | array( |
@@ -1106,17 +1106,17 @@ discard block |
||
1106 | 1106 | * @since 1.7.4 |
1107 | 1107 | */ |
1108 | 1108 | foreach ( $fields as &$field ) { |
1109 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : Utils::get( $field, 'id' ); |
|
1110 | - $field['label'] = isset( $field['label'] ) ? $field['label'] : Utils::get( $field, 'title' ); |
|
1111 | - $field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : Utils::get( $field, 'default' ); |
|
1112 | - $field['description'] = isset( $field['description'] ) ? $field['description'] : Utils::get( $field, 'subtitle' ); |
|
1109 | + $field[ 'name' ] = isset( $field[ 'name' ] ) ? $field[ 'name' ] : Utils::get( $field, 'id' ); |
|
1110 | + $field[ 'label' ] = isset( $field[ 'label' ] ) ? $field[ 'label' ] : Utils::get( $field, 'title' ); |
|
1111 | + $field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : Utils::get( $field, 'default' ); |
|
1112 | + $field[ 'description' ] = isset( $field[ 'description' ] ) ? $field[ 'description' ] : Utils::get( $field, 'subtitle' ); |
|
1113 | 1113 | |
1114 | 1114 | if ( $disabled_attribute ) { |
1115 | - $field['disabled'] = $disabled_attribute; |
|
1115 | + $field[ 'disabled' ] = $disabled_attribute; |
|
1116 | 1116 | } |
1117 | 1117 | |
1118 | - if ( empty( $field['disabled'] ) ) { |
|
1119 | - unset( $field['disabled'] ); |
|
1118 | + if ( empty( $field[ 'disabled' ] ) ) { |
|
1119 | + unset( $field[ 'disabled' ] ); |
|
1120 | 1120 | } |
1121 | 1121 | } |
1122 | 1122 | |
@@ -1128,23 +1128,23 @@ discard block |
||
1128 | 1128 | 'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates & support.', 'gravityview' ), |
1129 | 1129 | 'type' => 'edd_license', |
1130 | 1130 | 'data-pending-text' => __( 'Verifying license…', 'gravityview' ), |
1131 | - 'default_value' => $default_settings['license_key'], |
|
1131 | + 'default_value' => $default_settings[ 'license_key' ], |
|
1132 | 1132 | 'class' => ( '' == $this->get( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key', |
1133 | 1133 | ), |
1134 | 1134 | array( |
1135 | 1135 | 'name' => 'license_key_response', |
1136 | - 'default_value' => $default_settings['license_key_response'], |
|
1136 | + 'default_value' => $default_settings[ 'license_key_response' ], |
|
1137 | 1137 | 'type' => 'hidden', |
1138 | 1138 | ), |
1139 | 1139 | array( |
1140 | 1140 | 'name' => 'license_key_status', |
1141 | - 'default_value' => $default_settings['license_key_status'], |
|
1141 | + 'default_value' => $default_settings[ 'license_key_status' ], |
|
1142 | 1142 | 'type' => 'hidden', |
1143 | 1143 | ), |
1144 | 1144 | ); |
1145 | 1145 | |
1146 | 1146 | if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
1147 | - $license_fields[0] = array_merge( $license_fields[0], array( |
|
1147 | + $license_fields[ 0 ] = array_merge( $license_fields[ 0 ], array( |
|
1148 | 1148 | 'disabled' => true, |
1149 | 1149 | 'title' => __( 'The license key is defined by your site\'s configuration file.', 'gravityview' ), |
1150 | 1150 | ) ); |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | |
1156 | 1156 | if ( \gravityview()->plugin->is_GF_25() ) { |
1157 | 1157 | |
1158 | - $sections[] = array( |
|
1158 | + $sections[ ] = array( |
|
1159 | 1159 | 'title' => __( 'GravityView License', 'gravityview' ), |
1160 | 1160 | 'class' => 'gform-settings-panel--full gv-settings-panel--license', |
1161 | 1161 | 'description' => $version_info, |
@@ -1173,7 +1173,7 @@ discard block |
||
1173 | 1173 | ) ); |
1174 | 1174 | } |
1175 | 1175 | |
1176 | - $sections[] = array( |
|
1176 | + $sections[ ] = array( |
|
1177 | 1177 | 'title' => ( gravityview()->plugin->is_GF_25() ? __( 'GravityView Settings', 'gravityview' ) : null ), |
1178 | 1178 | 'class' => 'gform-settings-panel--full gv-settings-panel--core', |
1179 | 1179 | 'fields' => $fields, |
@@ -1197,8 +1197,8 @@ discard block |
||
1197 | 1197 | |
1198 | 1198 | if ( $disabled_attribute ) { |
1199 | 1199 | foreach ( $extension_sections as &$section ) { |
1200 | - foreach ( $section['fields'] as &$field ) { |
|
1201 | - $field['disabled'] = $disabled_attribute; |
|
1200 | + foreach ( $section[ 'fields' ] as &$field ) { |
|
1201 | + $field[ 'disabled' ] = $disabled_attribute; |
|
1202 | 1202 | } |
1203 | 1203 | } |
1204 | 1204 | } |
@@ -1264,7 +1264,7 @@ discard block |
||
1264 | 1264 | public function settings_edd_license( $field, $echo = true ) { |
1265 | 1265 | |
1266 | 1266 | if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
1267 | - $field['input_type'] = 'password'; |
|
1267 | + $field[ 'input_type' ] = 'password'; |
|
1268 | 1268 | } |
1269 | 1269 | |
1270 | 1270 | $text = $this->settings_text( $field, false ); |
@@ -1316,7 +1316,7 @@ discard block |
||
1316 | 1316 | |
1317 | 1317 | ?> |
1318 | 1318 | |
1319 | - <tr id="gaddon-setting-row-<?php echo esc_attr( $field['name'] ); ?>"> |
|
1319 | + <tr id="gaddon-setting-row-<?php echo esc_attr( $field[ 'name' ] ); ?>"> |
|
1320 | 1320 | <td colspan="2"> |
1321 | 1321 | <?php $this->single_setting( $field ); ?> |
1322 | 1322 | </td> |
@@ -1342,8 +1342,8 @@ discard block |
||
1342 | 1342 | */ |
1343 | 1343 | public function single_setting_row( $field ) { |
1344 | 1344 | |
1345 | - $field['gv_description'] = Utils::get( $field, 'description' ); |
|
1346 | - $field['description'] = Utils::get( $field, 'subtitle' ); |
|
1345 | + $field[ 'gv_description' ] = Utils::get( $field, 'description' ); |
|
1346 | + $field[ 'description' ] = Utils::get( $field, 'subtitle' ); |
|
1347 | 1347 | parent::single_setting_row( $field ); |
1348 | 1348 | } |
1349 | 1349 | |
@@ -1404,8 +1404,8 @@ discard block |
||
1404 | 1404 | // then we assume it's changed. If it's changed, unset the status and the previous response. |
1405 | 1405 | if ( ! $added_message && ( $local_key !== $response_key ) ) { |
1406 | 1406 | |
1407 | - unset( $posted_settings['license_key_response'] ); |
|
1408 | - unset( $posted_settings['license_key_status'] ); |
|
1407 | + unset( $posted_settings[ 'license_key_response' ] ); |
|
1408 | + unset( $posted_settings[ 'license_key_status' ] ); |
|
1409 | 1409 | |
1410 | 1410 | \GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
1411 | 1411 |