@@ -88,15 +88,15 @@ |
||
88 | 88 | */ |
89 | 89 | public function maybe_modify_button_label( $label = '', $atts = array() ) { |
90 | 90 | |
91 | - if( $this->template_id !== \GV\Utils::get( $atts, 'template_id' ) ) { |
|
91 | + if ( $this->template_id !== \GV\Utils::get( $atts, 'template_id' ) ) { |
|
92 | 92 | return $label; |
93 | 93 | } |
94 | 94 | |
95 | - if( 'field' !== \GV\Utils::get( $atts, 'type' ) ) { |
|
95 | + if ( 'field' !== \GV\Utils::get( $atts, 'type' ) ) { |
|
96 | 96 | return $label; |
97 | 97 | } |
98 | 98 | |
99 | - if( 'edit' === \GV\Utils::get( $atts, 'zone' ) ) { |
|
99 | + if ( 'edit' === \GV\Utils::get( $atts, 'zone' ) ) { |
|
100 | 100 | return $label; |
101 | 101 | } |
102 | 102 |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | continue; |
63 | 63 | } |
64 | 64 | |
65 | - $field_id = intval( floor( $search_field['key'] ) ); |
|
66 | - $input_id = gravityview_get_input_id_from_id( $search_field['key'] ); |
|
65 | + $field_id = intval( floor( $search_field[ 'key' ] ) ); |
|
66 | + $input_id = gravityview_get_input_id_from_id( $search_field[ 'key' ] ); |
|
67 | 67 | $form = GravityView_View::getInstance()->getForm(); |
68 | 68 | |
69 | 69 | /** @var GF_Field_Address $address_field */ |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $choices = array(); |
73 | 73 | |
74 | 74 | $method_name = 'get_choices_' . self::get_input_type_from_input_id( $input_id ); |
75 | - if( method_exists( $this, $method_name ) ) { |
|
75 | + if ( method_exists( $this, $method_name ) ) { |
|
76 | 76 | /** |
77 | 77 | * @uses GravityView_Field_Address::get_choices_country() |
78 | 78 | * @uses GravityView_Field_Address::get_choices_state() |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | $choices = $this->{$method_name}( $address_field, $form ); |
81 | 81 | } |
82 | 82 | |
83 | - if( ! empty( $choices ) ) { |
|
84 | - $search_field['choices'] = $choices; |
|
85 | - $search_field['type'] = \GV\Utils::get( $search_field, 'input'); |
|
83 | + if ( ! empty( $choices ) ) { |
|
84 | + $search_field[ 'choices' ] = $choices; |
|
85 | + $search_field[ 'type' ] = \GV\Utils::get( $search_field, 'input' ); |
|
86 | 86 | } else { |
87 | - $search_field['type'] = 'text'; |
|
88 | - $search_field['input'] = 'input_text'; |
|
87 | + $search_field[ 'type' ] = 'text'; |
|
88 | + $search_field[ 'input' ] = 'input_text'; |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $country_choices = array(); |
111 | 111 | |
112 | 112 | foreach ( $countries as $key => $country ) { |
113 | - $country_choices[] = array( |
|
113 | + $country_choices[ ] = array( |
|
114 | 114 | 'value' => $country, |
115 | 115 | 'text' => $country, |
116 | 116 | ); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | private function get_choices_state( $address_field, $form ) { |
137 | 137 | |
138 | - $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form['id'] ) : $address_field->addressType; |
|
138 | + $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form[ 'id' ] ) : $address_field->addressType; |
|
139 | 139 | |
140 | 140 | $state_choices = array(); |
141 | 141 | |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | $states = GFCommon::get_canadian_provinces(); |
148 | 148 | break; |
149 | 149 | default: |
150 | - $address_types = $address_field->get_address_types( $form['id'] ); |
|
151 | - $states = empty( $address_types[ $address_type ]['states'] ) ? array() : $address_types[ $address_type ]['states']; |
|
150 | + $address_types = $address_field->get_address_types( $form[ 'id' ] ); |
|
151 | + $states = empty( $address_types[ $address_type ][ 'states' ] ) ? array() : $address_types[ $address_type ][ 'states' ]; |
|
152 | 152 | break; |
153 | 153 | } |
154 | 154 | |
@@ -157,19 +157,19 @@ discard block |
||
157 | 157 | $state_subchoices = array(); |
158 | 158 | |
159 | 159 | foreach ( $state as $key => $substate ) { |
160 | - $state_subchoices[] = array( |
|
160 | + $state_subchoices[ ] = array( |
|
161 | 161 | 'value' => is_numeric( $key ) ? $substate : $key, |
162 | 162 | 'text' => $substate, |
163 | 163 | ); |
164 | 164 | } |
165 | 165 | |
166 | - $state_choices[] = array( |
|
166 | + $state_choices[ ] = array( |
|
167 | 167 | 'text' => $key, |
168 | 168 | 'value' => $state_subchoices, |
169 | 169 | ); |
170 | 170 | |
171 | 171 | } else { |
172 | - $state_choices[] = array( |
|
172 | + $state_choices[ ] = array( |
|
173 | 173 | 'value' => is_numeric( $key ) ? $state : $key, |
174 | 174 | 'text' => $state, |
175 | 175 | ); |
@@ -193,13 +193,13 @@ discard block |
||
193 | 193 | // Use the same inputs as the "text" input type allows |
194 | 194 | $text_inputs = \GV\Utils::get( $input_types, 'text' ); |
195 | 195 | |
196 | - $input_types['street'] = $text_inputs; |
|
197 | - $input_types['street2'] = $text_inputs; |
|
198 | - $input_types['city'] = $text_inputs; |
|
196 | + $input_types[ 'street' ] = $text_inputs; |
|
197 | + $input_types[ 'street2' ] = $text_inputs; |
|
198 | + $input_types[ 'city' ] = $text_inputs; |
|
199 | 199 | |
200 | - $input_types['state'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
201 | - $input_types['zip'] = array( 'input_text' ); |
|
202 | - $input_types['country'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
200 | + $input_types[ 'state' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
201 | + $input_types[ 'zip' ] = array( 'input_text' ); |
|
202 | + $input_types[ 'country' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
203 | 203 | |
204 | 204 | return $input_types; |
205 | 205 | } |
@@ -220,12 +220,12 @@ discard block |
||
220 | 220 | // Is this search field for an input (eg: 4.2) or the whole address field (eg: 4)? |
221 | 221 | $input_id = gravityview_get_input_id_from_id( $field_id ); |
222 | 222 | |
223 | - if( 'address' !== $field_type && $input_id ) { |
|
223 | + if ( 'address' !== $field_type && $input_id ) { |
|
224 | 224 | return $input_type; |
225 | 225 | } |
226 | 226 | |
227 | 227 | // If the input ID matches an expected address input, set to that. Otherwise, keep existing input type. |
228 | - if( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
228 | + if ( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
229 | 229 | $input_type = $address_field_name; |
230 | 230 | } |
231 | 231 | |
@@ -273,20 +273,20 @@ discard block |
||
273 | 273 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
274 | 274 | |
275 | 275 | // If this is NOT the full address field, return default options. |
276 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
276 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
277 | 277 | return $field_options; |
278 | 278 | } |
279 | 279 | |
280 | - if( 'edit' === $context ) { |
|
280 | + if ( 'edit' === $context ) { |
|
281 | 281 | return $field_options; |
282 | 282 | } |
283 | 283 | |
284 | 284 | $add_options = array(); |
285 | 285 | |
286 | - $add_options['show_map_link'] = array( |
|
286 | + $add_options[ 'show_map_link' ] = array( |
|
287 | 287 | 'type' => 'checkbox', |
288 | 288 | 'label' => __( 'Show Map Link:', 'gravityview' ), |
289 | - 'desc' => __('Display a "Map It" link below the address', 'gravityview'), |
|
289 | + 'desc' => __( 'Display a "Map It" link below the address', 'gravityview' ), |
|
290 | 290 | 'value' => true, |
291 | 291 | 'merge_tags' => false, |
292 | 292 | ); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | $is_table_layout = preg_match( '/table/ism', $template_id ); |
32 | 32 | |
33 | - if( 'field' === $field_type ) { |
|
33 | + if ( 'field' === $field_type ) { |
|
34 | 34 | |
35 | 35 | // Default options - fields |
36 | 36 | $field_options = array( |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | 'custom_class' => array( |
50 | 50 | 'type' => 'text', |
51 | 51 | 'label' => __( 'Custom CSS Class:', 'gravityview' ), |
52 | - 'desc' => __( 'This class will be added to the field container', 'gravityview'), |
|
52 | + 'desc' => __( 'This class will be added to the field container', 'gravityview' ), |
|
53 | 53 | 'value' => '', |
54 | 54 | 'merge_tags' => true, |
55 | 55 | 'tooltip' => 'gv_css_merge_tags', |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | ); |
71 | 71 | |
72 | 72 | // Match Table as well as DataTables |
73 | - if( $is_table_layout && 'directory' === $context ) { |
|
74 | - $field_options['width'] = array( |
|
73 | + if ( $is_table_layout && 'directory' === $context ) { |
|
74 | + $field_options[ 'width' ] = array( |
|
75 | 75 | 'type' => 'number', |
76 | - 'label' => __('Percent Width', 'gravityview'), |
|
77 | - 'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview'), |
|
76 | + 'label' => __( 'Percent Width', 'gravityview' ), |
|
77 | + 'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview' ), |
|
78 | 78 | 'class' => 'code widefat', |
79 | 79 | 'value' => '', |
80 | 80 | ); |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | 'manage_options' => __( 'Administrator', 'gravityview' ), |
130 | 130 | ); |
131 | 131 | |
132 | - if( is_multisite() ) { |
|
133 | - $select_cap_choices['manage_network'] = __('Multisite Super Admin', 'gravityview' ); |
|
132 | + if ( is_multisite() ) { |
|
133 | + $select_cap_choices[ 'manage_network' ] = __( 'Multisite Super Admin', 'gravityview' ); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @param string $context Optional. What context are we in? Example: `single` or `directory` |
144 | 144 | * @param string $input_type Optional. (textarea, list, select, etc.) |
145 | 145 | */ |
146 | - $select_cap_choices = apply_filters('gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type ); |
|
146 | + $select_cap_choices = apply_filters( 'gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type ); |
|
147 | 147 | |
148 | 148 | return $select_cap_choices; |
149 | 149 | } |
@@ -171,27 +171,27 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public static function render_field_options( $form_id, $field_type, $template_id, $field_id, $field_label, $area, $input_type = NULL, $uniqid = '', $current = '', $context = 'single', $item = array() ) { |
173 | 173 | |
174 | - if( empty( $uniqid ) ) { |
|
174 | + if ( empty( $uniqid ) ) { |
|
175 | 175 | //generate a unique field id |
176 | - $uniqid = uniqid('', false); |
|
176 | + $uniqid = uniqid( '', false ); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | // get field/widget options |
180 | 180 | $options = self::get_default_field_options( $field_type, $template_id, $field_id, $context, $input_type, $form_id ); |
181 | 181 | |
182 | 182 | // two different post arrays, depending of the field type |
183 | - $name_prefix = $field_type .'s' .'['. $area .']['. $uniqid .']'; |
|
183 | + $name_prefix = $field_type . 's' . '[' . $area . '][' . $uniqid . ']'; |
|
184 | 184 | |
185 | 185 | // build output |
186 | 186 | $output = ''; |
187 | - $output .= '<input type="hidden" class="field-key" name="'. $name_prefix .'[id]" value="'. esc_attr( $field_id ) .'">'; |
|
188 | - $output .= '<input type="hidden" class="field-label" name="'. $name_prefix .'[label]" value="'. esc_attr( $field_label ) .'">'; |
|
187 | + $output .= '<input type="hidden" class="field-key" name="' . $name_prefix . '[id]" value="' . esc_attr( $field_id ) . '">'; |
|
188 | + $output .= '<input type="hidden" class="field-label" name="' . $name_prefix . '[label]" value="' . esc_attr( $field_label ) . '">'; |
|
189 | 189 | if ( $form_id ) { |
190 | - $output .= '<input type="hidden" class="field-form-id" name="'. $name_prefix .'[form_id]" value="'. esc_attr( $form_id ) .'">'; |
|
190 | + $output .= '<input type="hidden" class="field-form-id" name="' . $name_prefix . '[form_id]" value="' . esc_attr( $form_id ) . '">'; |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | // If there are no options, return what we got. |
194 | - if(empty($options)) { |
|
194 | + if ( empty( $options ) ) { |
|
195 | 195 | |
196 | 196 | // This is here for checking if the output is empty in render_label() |
197 | 197 | $output .= '<!-- No Options -->'; |
@@ -199,33 +199,33 @@ discard block |
||
199 | 199 | return $output; |
200 | 200 | } |
201 | 201 | |
202 | - $output .= '<div class="gv-dialog-options" title="'. esc_attr( sprintf( __( 'Options: %s', 'gravityview' ) , strip_tags( html_entity_decode( $field_label ) ) ) ) .'">'; |
|
202 | + $output .= '<div class="gv-dialog-options" title="' . esc_attr( sprintf( __( 'Options: %s', 'gravityview' ), strip_tags( html_entity_decode( $field_label ) ) ) ) . '">'; |
|
203 | 203 | |
204 | 204 | /** |
205 | 205 | * @since 1.8 |
206 | 206 | */ |
207 | - if( !empty( $item['subtitle'] ) ) { |
|
208 | - $output .= '<div class="subtitle">' . $item['subtitle'] . '</div>'; |
|
207 | + if ( ! empty( $item[ 'subtitle' ] ) ) { |
|
208 | + $output .= '<div class="subtitle">' . $item[ 'subtitle' ] . '</div>'; |
|
209 | 209 | } |
210 | 210 | |
211 | - foreach( $options as $key => $option ) { |
|
211 | + foreach ( $options as $key => $option ) { |
|
212 | 212 | |
213 | 213 | $value = isset( $current[ $key ] ) ? $current[ $key ] : NULL; |
214 | 214 | |
215 | - $field_output = self::render_field_option( $name_prefix . '['. $key .']' , $option, $value); |
|
215 | + $field_output = self::render_field_option( $name_prefix . '[' . $key . ']', $option, $value ); |
|
216 | 216 | |
217 | 217 | // The setting is empty |
218 | - if( empty( $field_output ) ) { |
|
218 | + if ( empty( $field_output ) ) { |
|
219 | 219 | continue; |
220 | 220 | } |
221 | 221 | |
222 | - switch( $option['type'] ) { |
|
222 | + switch ( $option[ 'type' ] ) { |
|
223 | 223 | // Hide hidden fields |
224 | 224 | case 'hidden': |
225 | - $output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . ' screen-reader-text">'. $field_output . '</div>'; |
|
225 | + $output .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . ' screen-reader-text">' . $field_output . '</div>'; |
|
226 | 226 | break; |
227 | 227 | default: |
228 | - $output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . '">'. $field_output .'</div>'; |
|
228 | + $output .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . '">' . $field_output . '</div>'; |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
@@ -254,17 +254,17 @@ discard block |
||
254 | 254 | * @deprecated setting index 'default' was replaced by 'value' |
255 | 255 | * @see GravityView_FieldType::get_field_defaults |
256 | 256 | */ |
257 | - if( !empty( $option['default'] ) && empty( $option['value'] ) ) { |
|
258 | - $option['value'] = $option['default']; |
|
259 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting '. $name .' details' ); |
|
257 | + if ( ! empty( $option[ 'default' ] ) && empty( $option[ 'value' ] ) ) { |
|
258 | + $option[ 'value' ] = $option[ 'default' ]; |
|
259 | + _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting ' . $name . ' details' ); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | // prepare to render option field type |
263 | - if( isset( $option['type'] ) ) { |
|
263 | + if ( isset( $option[ 'type' ] ) ) { |
|
264 | 264 | |
265 | 265 | $type_class = self::load_type_class( $option ); |
266 | 266 | |
267 | - if( class_exists( $type_class ) ) { |
|
267 | + if ( class_exists( $type_class ) ) { |
|
268 | 268 | |
269 | 269 | /** @var GravityView_FieldType $render_type */ |
270 | 270 | $render_type = new $type_class( $name, $option, $curr_value ); |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | * @param[in,out] string $output field class name |
282 | 282 | * @param[in] array $option option field data |
283 | 283 | */ |
284 | - $output = apply_filters( "gravityview/option/output/{$option['type']}" , $output, $option ); |
|
284 | + $output = apply_filters( "gravityview/option/output/{$option[ 'type' ]}", $output, $option ); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | } // isset option[type] |
@@ -316,27 +316,27 @@ discard block |
||
316 | 316 | * @deprecated setting index 'name' was replaced by 'label' |
317 | 317 | * @see GravityView_FieldType::get_field_defaults |
318 | 318 | */ |
319 | - if( isset( $setting['name'] ) && empty( $setting['label'] ) ) { |
|
320 | - $setting['label'] = $setting['name']; |
|
321 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting '. $key .' details' ); |
|
319 | + if ( isset( $setting[ 'name' ] ) && empty( $setting[ 'label' ] ) ) { |
|
320 | + $setting[ 'label' ] = $setting[ 'name' ]; |
|
321 | + _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting ' . $key . ' details' ); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | $name = esc_attr( sprintf( $name, $key ) ); |
325 | - $setting['id'] = esc_attr( sprintf( $id, $key ) ); |
|
326 | - $setting['tooltip'] = 'gv_' . $key; |
|
325 | + $setting[ 'id' ] = esc_attr( sprintf( $id, $key ) ); |
|
326 | + $setting[ 'tooltip' ] = 'gv_' . $key; |
|
327 | 327 | |
328 | 328 | // Use default if current setting isn't set. |
329 | - $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting['value']; |
|
329 | + $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting[ 'value' ]; |
|
330 | 330 | |
331 | 331 | // default setting type = text |
332 | - $setting['type'] = empty( $setting['type'] ) ? 'text' : $setting['type']; |
|
332 | + $setting[ 'type' ] = empty( $setting[ 'type' ] ) ? 'text' : $setting[ 'type' ]; |
|
333 | 333 | |
334 | 334 | // merge tags |
335 | - if( !isset( $setting['merge_tags'] ) ) { |
|
336 | - if( $setting['type'] === 'text' ) { |
|
337 | - $setting['merge_tags'] = true; |
|
335 | + if ( ! isset( $setting[ 'merge_tags' ] ) ) { |
|
336 | + if ( $setting[ 'type' ] === 'text' ) { |
|
337 | + $setting[ 'merge_tags' ] = true; |
|
338 | 338 | } else { |
339 | - $setting['merge_tags'] = false; |
|
339 | + $setting[ 'merge_tags' ] = false; |
|
340 | 340 | } |
341 | 341 | } |
342 | 342 | |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | |
345 | 345 | // render the setting |
346 | 346 | $type_class = self::load_type_class( $setting ); |
347 | - if( class_exists( $type_class ) ) { |
|
347 | + if ( class_exists( $type_class ) ) { |
|
348 | 348 | /** @var GravityView_FieldType $render_type */ |
349 | 349 | $render_type = new $type_class( $name, $setting, $curr_value ); |
350 | 350 | ob_start(); |
@@ -353,25 +353,25 @@ discard block |
||
353 | 353 | } |
354 | 354 | |
355 | 355 | // Check if setting is specific for a template |
356 | - if( !empty( $setting['show_in_template'] ) ) { |
|
357 | - if( !is_array( $setting['show_in_template'] ) ) { |
|
358 | - $setting['show_in_template'] = array( $setting['show_in_template'] ); |
|
356 | + if ( ! empty( $setting[ 'show_in_template' ] ) ) { |
|
357 | + if ( ! is_array( $setting[ 'show_in_template' ] ) ) { |
|
358 | + $setting[ 'show_in_template' ] = array( $setting[ 'show_in_template' ] ); |
|
359 | 359 | } |
360 | - $show_if = ' data-show-if="'. implode( ' ', $setting['show_in_template'] ).'"'; |
|
360 | + $show_if = ' data-show-if="' . implode( ' ', $setting[ 'show_in_template' ] ) . '"'; |
|
361 | 361 | } else { |
362 | 362 | $show_if = ''; |
363 | 363 | } |
364 | 364 | |
365 | - if( ! empty( $setting['requires'] ) ) { |
|
366 | - $show_if .= sprintf( ' data-requires="%s"', $setting['requires'] ); |
|
365 | + if ( ! empty( $setting[ 'requires' ] ) ) { |
|
366 | + $show_if .= sprintf( ' data-requires="%s"', $setting[ 'requires' ] ); |
|
367 | 367 | } |
368 | 368 | |
369 | - if( ! empty( $setting['requires_not'] ) ) { |
|
370 | - $show_if .= sprintf( ' data-requires-not="%s"', $setting['requires_not'] ); |
|
369 | + if ( ! empty( $setting[ 'requires_not' ] ) ) { |
|
370 | + $show_if .= sprintf( ' data-requires-not="%s"', $setting[ 'requires_not' ] ); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | // output |
374 | - echo '<tr style="vertical-align: top;" '. $show_if .'>' . $output . '</tr>'; |
|
374 | + echo '<tr style="vertical-align: top;" ' . $show_if . '>' . $output . '</tr>'; |
|
375 | 375 | |
376 | 376 | } |
377 | 377 | |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | */ |
384 | 384 | public static function load_type_class( $field = NULL ) { |
385 | 385 | |
386 | - if( empty( $field['type'] ) ) { |
|
386 | + if ( empty( $field[ 'type' ] ) ) { |
|
387 | 387 | return NULL; |
388 | 388 | } |
389 | 389 | |
@@ -392,9 +392,9 @@ discard block |
||
392 | 392 | * @param string $class_suffix field class suffix; `GravityView_FieldType_{$class_suffix}` |
393 | 393 | * @param array $field field data |
394 | 394 | */ |
395 | - $type_class = apply_filters( "gravityview/setting/class/{$field['type']}", 'GravityView_FieldType_' . $field['type'], $field ); |
|
395 | + $type_class = apply_filters( "gravityview/setting/class/{$field[ 'type' ]}", 'GravityView_FieldType_' . $field[ 'type' ], $field ); |
|
396 | 396 | |
397 | - if( class_exists( $type_class ) ) { |
|
397 | + if ( class_exists( $type_class ) ) { |
|
398 | 398 | return $type_class; |
399 | 399 | } |
400 | 400 | |
@@ -403,9 +403,9 @@ discard block |
||
403 | 403 | * @param string $field_type_include_path field class file path |
404 | 404 | * @param array $field field data |
405 | 405 | */ |
406 | - $class_file = apply_filters( "gravityview/setting/class_file/{$field['type']}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field['type']}.php", $field ); |
|
406 | + $class_file = apply_filters( "gravityview/setting/class_file/{$field[ 'type' ]}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field[ 'type' ]}.php", $field ); |
|
407 | 407 | |
408 | - if( $class_file && file_exists( $class_file ) ) { |
|
408 | + if ( $class_file && file_exists( $class_file ) ) { |
|
409 | 409 | require_once( $class_file ); |
410 | 410 | } |
411 | 411 | |
@@ -427,8 +427,8 @@ discard block |
||
427 | 427 | |
428 | 428 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_checkbox::render_input' ); |
429 | 429 | |
430 | - $output = '<input name="'. esc_attr( $name ) .'" type="hidden" value="0">'; |
|
431 | - $output .= '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="checkbox" value="1" '. checked( $current, '1', false ) .' >'; |
|
430 | + $output = '<input name="' . esc_attr( $name ) . '" type="hidden" value="0">'; |
|
431 | + $output .= '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="checkbox" value="1" ' . checked( $current, '1', false ) . ' >'; |
|
432 | 432 | |
433 | 433 | return $output; |
434 | 434 | } |
@@ -448,22 +448,22 @@ discard block |
||
448 | 448 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_text::render_input' ); |
449 | 449 | |
450 | 450 | // Show the merge tags if the field is a list view |
451 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
451 | + $is_list = ( preg_match( '/_list-/ism', $name ) ); |
|
452 | 452 | |
453 | 453 | // Or is a single entry view |
454 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
454 | + $is_single = ( preg_match( '/single_/ism', $name ) ); |
|
455 | 455 | $show = ( $is_single || $is_list ); |
456 | 456 | |
457 | 457 | $class = ''; |
458 | 458 | // and $add_merge_tags is not false |
459 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
459 | + if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
460 | 460 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
461 | 461 | } |
462 | 462 | |
463 | - $class .= !empty( $args['class'] ) ? $args['class'] : 'widefat'; |
|
464 | - $type = !empty( $args['type'] ) ? $args['type'] : 'text'; |
|
463 | + $class .= ! empty( $args[ 'class' ] ) ? $args[ 'class' ] : 'widefat'; |
|
464 | + $type = ! empty( $args[ 'type' ] ) ? $args[ 'type' ] : 'text'; |
|
465 | 465 | |
466 | - return '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="'.esc_attr($type).'" value="'. esc_attr( $current ) .'" class="'.esc_attr( $class ).'">'; |
|
466 | + return '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="' . esc_attr( $type ) . '" value="' . esc_attr( $current ) . '" class="' . esc_attr( $class ) . '">'; |
|
467 | 467 | } |
468 | 468 | |
469 | 469 | /** |
@@ -480,21 +480,21 @@ discard block |
||
480 | 480 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_textarea::render_input' ); |
481 | 481 | |
482 | 482 | // Show the merge tags if the field is a list view |
483 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
483 | + $is_list = ( preg_match( '/_list-/ism', $name ) ); |
|
484 | 484 | |
485 | 485 | // Or is a single entry view |
486 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
486 | + $is_single = ( preg_match( '/single_/ism', $name ) ); |
|
487 | 487 | $show = ( $is_single || $is_list ); |
488 | 488 | |
489 | 489 | $class = ''; |
490 | 490 | // and $add_merge_tags is not false |
491 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
491 | + if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
492 | 492 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
493 | 493 | } |
494 | 494 | |
495 | - $class .= !empty( $args['class'] ) ? 'widefat '.$args['class'] : 'widefat'; |
|
495 | + $class .= ! empty( $args[ 'class' ] ) ? 'widefat ' . $args[ 'class' ] : 'widefat'; |
|
496 | 496 | |
497 | - return '<textarea name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" class="'.esc_attr( $class ).'">'. esc_textarea( $current ) .'</textarea>'; |
|
497 | + return '<textarea name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class ) . '">' . esc_textarea( $current ) . '</textarea>'; |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | /** |
@@ -510,9 +510,9 @@ discard block |
||
510 | 510 | |
511 | 511 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_select::render_input' ); |
512 | 512 | |
513 | - $output = '<select name="'. $name .'" id="'. $id .'">'; |
|
514 | - foreach( $choices as $value => $label ) { |
|
515 | - $output .= '<option value="'. esc_attr( $value ) .'" '. selected( $value, $current, false ) .'>'. esc_html( $label ) .'</option>'; |
|
513 | + $output = '<select name="' . $name . '" id="' . $id . '">'; |
|
514 | + foreach ( $choices as $value => $label ) { |
|
515 | + $output .= '<option value="' . esc_attr( $value ) . '" ' . selected( $value, $current, false ) . '>' . esc_html( $label ) . '</option>'; |
|
516 | 516 | } |
517 | 517 | $output .= '</select>'; |
518 | 518 |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param string $name The key name (will be prefixed). |
53 | 53 | * @param mixed $default The default value if not found (Default: null) |
54 | 54 | * |
55 | - * @return mixed The value or $default if not found. |
|
55 | + * @return string The value or $default if not found. |
|
56 | 56 | */ |
57 | 57 | public static function _SERVER( $name, $default = null ) { |
58 | 58 | return self::get( $_SERVER, $name, $default ); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @param mixed $value The value to return from the closure. |
128 | 128 | * |
129 | - * @return Closure The closure with the $value bound. |
|
129 | + * @return \Closure The closure with the $value bound. |
|
130 | 130 | */ |
131 | 131 | public static function _return( $value ) { |
132 | 132 | return function() use ( $value ) { return $value; }; |
@@ -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' ), |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | */ |
45 | 45 | protected $form_id; |
46 | 46 | |
47 | - function __construct( $title = '', $item_id = '', $item = array(), $settings = array(), $form_id = null) { |
|
47 | + function __construct( $title = '', $item_id = '', $item = array(), $settings = array(), $form_id = null ) { |
|
48 | 48 | |
49 | 49 | // Backward compat |
50 | - if ( ! empty( $item['type'] ) ) { |
|
51 | - $item['input_type'] = $item['type']; |
|
52 | - unset( $item['type'] ); |
|
50 | + if ( ! empty( $item[ 'type' ] ) ) { |
|
51 | + $item[ 'input_type' ] = $item[ 'type' ]; |
|
52 | + unset( $item[ 'type' ] ); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | if ( $admin_label = \GV\Utils::get( $settings, 'admin_label' ) ) { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $this->id = $item_id; |
76 | 76 | $this->form_id = $form_id; |
77 | 77 | $this->settings = $settings; |
78 | - $this->label_type = $item['label_type']; |
|
78 | + $this->label_type = $item[ 'label_type' ]; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | |
120 | 120 | foreach ( $field_info_items as $item ) { |
121 | 121 | |
122 | - if( \GV\Utils::get( $item, 'hide_in_picker', false ) ) { |
|
122 | + if ( \GV\Utils::get( $item, 'hide_in_picker', false ) ) { |
|
123 | 123 | continue; |
124 | 124 | } |
125 | 125 | |
126 | - $class = isset( $item['class'] ) ? sanitize_html_class( $item['class'] ) . ' description' : 'description'; |
|
126 | + $class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description'; |
|
127 | 127 | // Add the title in case the value's long, in which case, it'll be truncated by CSS. |
128 | 128 | $output .= '<span class="' . $class . '">'; |
129 | - $output .= esc_html( $item['value'] ); |
|
129 | + $output .= esc_html( $item[ 'value' ] ); |
|
130 | 130 | $output .= '</span>'; |
131 | 131 | } |
132 | 132 | |
@@ -154,21 +154,21 @@ discard block |
||
154 | 154 | |
155 | 155 | // $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know. |
156 | 156 | // TODO: Un-hack this |
157 | - $hide_settings_link_class = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
158 | - $settings_link = sprintf( '<button class="gv-field-settings" title="%1$s" aria-label="%1$s"><span class="dashicons-admin-generic dashicons %2$s"></span></button>', esc_attr( $settings_title ), $hide_settings_link_class ); |
|
157 | + $hide_settings_link_class = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
158 | + $settings_link = sprintf( '<button class="gv-field-settings" title="%1$s" aria-label="%1$s"><span class="dashicons-admin-generic dashicons %2$s"></span></button>', esc_attr( $settings_title ), $hide_settings_link_class ); |
|
159 | 159 | |
160 | 160 | // Should we show the icon that the field is being used as a link to single entry? |
161 | - $hide_show_as_link_class = empty( $this->settings['show_as_link'] ) ? 'hide-if-js' : ''; |
|
161 | + $hide_show_as_link_class = empty( $this->settings[ 'show_as_link' ] ) ? 'hide-if-js' : ''; |
|
162 | 162 | $show_as_link = '<span class="dashicons dashicons-admin-links ' . $hide_show_as_link_class . '" title="' . esc_attr( $single_link_title ) . '"></span>'; |
163 | 163 | |
164 | 164 | // When a field label is empty, use the Field ID |
165 | 165 | $label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title; |
166 | 166 | |
167 | 167 | // If there's a custom label, and show label is checked, use that as the field heading |
168 | - if ( ! empty( $this->settings['custom_label'] ) && ! empty( $this->settings['show_label'] ) ) { |
|
169 | - $label = $this->settings['custom_label']; |
|
170 | - } else if ( ! empty( $this->item['customLabel'] ) ) { |
|
171 | - $label = $this->item['customLabel']; |
|
168 | + if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) { |
|
169 | + $label = $this->settings[ 'custom_label' ]; |
|
170 | + } else if ( ! empty( $this->item[ 'customLabel' ] ) ) { |
|
171 | + $label = $this->item[ 'customLabel' ]; |
|
172 | 172 | } |
173 | 173 | $label = esc_attr( $label ); |
174 | 174 | |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | $output .= '<h5 class="selectable gfield field-id-' . esc_attr( $this->id ) . '">'; |
178 | 178 | |
179 | 179 | $parent_label = ''; |
180 | - if ( ! empty( $this->item['parent'] ) ) { |
|
181 | - $parent_label = ' <small>(' . esc_attr( $this->item['parent']['label'] ) . ')</small>'; |
|
180 | + if ( ! empty( $this->item[ 'parent' ] ) ) { |
|
181 | + $parent_label = ' <small>(' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . ')</small>'; |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | // Name of field / widget |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | |
194 | 194 | $output .= '</h5>'; |
195 | 195 | |
196 | - $container_class = ! empty( $this->item['parent'] ) ? ' gv-child-field' : ''; |
|
197 | - $data_form_id = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : ''; |
|
196 | + $container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : ''; |
|
197 | + $data_form_id = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : ''; |
|
198 | 198 | |
199 | - $output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . ' data-inputtype="' . esc_attr( $this->item['input_type'] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item['settings_html'] . '</div>'; |
|
199 | + $output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . ' data-inputtype="' . esc_attr( $this->item[ 'input_type' ] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item[ 'settings_html' ] . '</div>'; |
|
200 | 200 | |
201 | 201 | return $output; |
202 | 202 | } |
@@ -37,23 +37,23 @@ discard block |
||
37 | 37 | |
38 | 38 | $merge_tags = array( |
39 | 39 | array( |
40 | - 'label' => __('Entry Creator: Display Name', 'gravityview'), |
|
40 | + 'label' => __( 'Entry Creator: Display Name', 'gravityview' ), |
|
41 | 41 | 'tag' => '{created_by:display_name}' |
42 | 42 | ), |
43 | 43 | array( |
44 | - 'label' => __('Entry Creator: Email', 'gravityview'), |
|
44 | + 'label' => __( 'Entry Creator: Email', 'gravityview' ), |
|
45 | 45 | 'tag' => '{created_by:user_email}' |
46 | 46 | ), |
47 | 47 | array( |
48 | - 'label' => __('Entry Creator: Username', 'gravityview'), |
|
48 | + 'label' => __( 'Entry Creator: Username', 'gravityview' ), |
|
49 | 49 | 'tag' => '{created_by:user_login}' |
50 | 50 | ), |
51 | 51 | array( |
52 | - 'label' => __('Entry Creator: User ID', 'gravityview'), |
|
52 | + 'label' => __( 'Entry Creator: User ID', 'gravityview' ), |
|
53 | 53 | 'tag' => '{created_by:ID}' |
54 | 54 | ), |
55 | 55 | array( |
56 | - 'label' => __('Entry Creator: Roles', 'gravityview'), |
|
56 | + 'label' => __( 'Entry Creator: Roles', 'gravityview' ), |
|
57 | 57 | 'tag' => '{created_by:roles}' |
58 | 58 | ), |
59 | 59 | ); |
@@ -81,19 +81,19 @@ discard block |
||
81 | 81 | public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
82 | 82 | |
83 | 83 | // If there are no matches OR the Entry `created_by` isn't set or is 0 (no user) |
84 | - if( empty( $matches ) || empty( $entry['created_by'] ) ) { |
|
84 | + if ( empty( $matches ) || empty( $entry[ 'created_by' ] ) ) { |
|
85 | 85 | return $text; |
86 | 86 | } |
87 | 87 | |
88 | 88 | // Get the creator of the entry |
89 | - $entry_creator = new WP_User( $entry['created_by'] ); |
|
89 | + $entry_creator = new WP_User( $entry[ 'created_by' ] ); |
|
90 | 90 | |
91 | 91 | foreach ( $matches as $match ) { |
92 | 92 | |
93 | - $full_tag = $match[0]; |
|
94 | - $property = $match[1]; |
|
93 | + $full_tag = $match[ 0 ]; |
|
94 | + $property = $match[ 1 ]; |
|
95 | 95 | |
96 | - switch( $property ) { |
|
96 | + switch ( $property ) { |
|
97 | 97 | case '': |
98 | 98 | $value = $entry_creator->ID; |
99 | 99 | break; |
@@ -119,11 +119,11 @@ discard block |
||
119 | 119 | |
120 | 120 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
121 | 121 | |
122 | - if( 'edit' === $context ) { |
|
122 | + if ( 'edit' === $context ) { |
|
123 | 123 | return $field_options; |
124 | 124 | } |
125 | 125 | |
126 | - $field_options['name_display'] = array( |
|
126 | + $field_options[ 'name_display' ] = array( |
|
127 | 127 | 'type' => 'select', |
128 | 128 | 'label' => __( 'User Format', 'gravityview' ), |
129 | 129 | 'desc' => __( 'How should the User information be displayed?', 'gravityview' ), |
@@ -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 |
@@ -134,28 +134,28 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function add_network_menu() { |
136 | 136 | |
137 | - if ( ! gravityview()->plugin->is_network_activated() ) { |
|
137 | + if ( ! gravityview()->plugin->is_network_activated() ) { |
|
138 | 138 | return; |
139 | 139 | } |
140 | 140 | |
141 | - add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' ); |
|
141 | + add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' ); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
145 | - * Uninstall all traces of GravityView |
|
146 | - * |
|
147 | - * Note: method is public because parent method is public |
|
148 | - * |
|
145 | + * Uninstall all traces of GravityView |
|
146 | + * |
|
147 | + * Note: method is public because parent method is public |
|
148 | + * |
|
149 | 149 | * @return bool |
150 | 150 | */ |
151 | 151 | public function uninstall() { |
152 | 152 | gravityview()->plugin->uninstall(); |
153 | 153 | |
154 | 154 | /** |
155 | - * Set the path so that Gravity Forms can de-activate GravityView |
|
156 | - * @see GFAddOn::uninstall_addon |
|
157 | - * @uses deactivate_plugins() |
|
158 | - */ |
|
155 | + * Set the path so that Gravity Forms can de-activate GravityView |
|
156 | + * @see GFAddOn::uninstall_addon |
|
157 | + * @uses deactivate_plugins() |
|
158 | + */ |
|
159 | 159 | $this->_path = GRAVITYVIEW_FILE; |
160 | 160 | |
161 | 161 | return true; |
@@ -185,42 +185,42 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
188 | - * Get an array of reasons why the plugin might be uninstalled |
|
189 | - * |
|
190 | - * @since 1.17.5 |
|
191 | - * |
|
188 | + * Get an array of reasons why the plugin might be uninstalled |
|
189 | + * |
|
190 | + * @since 1.17.5 |
|
191 | + * |
|
192 | 192 | * @return array Array of reasons with the label and followup questions for each uninstall reason |
193 | 193 | */ |
194 | 194 | private function get_uninstall_reasons() { |
195 | 195 | $reasons = array( |
196 | 196 | 'will-continue' => array( |
197 | - 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
198 | - ), |
|
197 | + 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
198 | + ), |
|
199 | 199 | 'no-longer-need' => array( |
200 | - 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
201 | - ), |
|
200 | + 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
201 | + ), |
|
202 | 202 | 'doesnt-work' => array( |
203 | - 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
204 | - ), |
|
203 | + 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
204 | + ), |
|
205 | 205 | 'found-other' => array( |
206 | - 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
207 | - 'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ), |
|
208 | - ), |
|
206 | + 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
207 | + 'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ), |
|
208 | + ), |
|
209 | 209 | 'other' => array( |
210 | - 'label' => esc_html__( 'Other', 'gravityview' ), |
|
211 | - ), |
|
210 | + 'label' => esc_html__( 'Other', 'gravityview' ), |
|
211 | + ), |
|
212 | 212 | ); |
213 | 213 | |
214 | 214 | shuffle( $reasons ); |
215 | 215 | |
216 | 216 | return $reasons; |
217 | - } |
|
217 | + } |
|
218 | 218 | |
219 | 219 | /** |
220 | - * Display a feedback form when the plugin is uninstalled |
|
221 | - * |
|
222 | - * @since 1.17.5 |
|
223 | - * |
|
220 | + * Display a feedback form when the plugin is uninstalled |
|
221 | + * |
|
222 | + * @since 1.17.5 |
|
223 | + * |
|
224 | 224 | * @return string HTML of the uninstallation form |
225 | 225 | */ |
226 | 226 | public function uninstall_form() { |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | <h2><?php esc_html_e( 'Why did you uninstall GravityView?', 'gravityview' ); ?></h2> |
301 | 301 | <ul> |
302 | 302 | <?php |
303 | - $reasons = $this->get_uninstall_reasons(); |
|
303 | + $reasons = $this->get_uninstall_reasons(); |
|
304 | 304 | foreach ( $reasons as $reason ) { |
305 | 305 | printf( '<li><label><input name="reason" type="radio" value="other" data-followup="%s"> %s</label></li>', Utils::get( $reason, 'followup' ), Utils::get( $reason, 'label' ) ); |
306 | 306 | } |
@@ -394,12 +394,12 @@ discard block |
||
394 | 394 | } |
395 | 395 | |
396 | 396 | public function app_settings_tab() { |
397 | - parent::app_settings_tab(); |
|
397 | + parent::app_settings_tab(); |
|
398 | 398 | |
399 | 399 | if ( $this->maybe_uninstall() ) { |
400 | - echo $this->uninstall_form(); |
|
400 | + echo $this->uninstall_form(); |
|
401 | 401 | } |
402 | - } |
|
402 | + } |
|
403 | 403 | |
404 | 404 | /** |
405 | 405 | * The Settings title |
@@ -562,8 +562,8 @@ discard block |
||
562 | 562 | type="' . $field['type'] . '" |
563 | 563 | name="' . esc_attr( $name ) . '" |
564 | 564 | value="' . $value . '" ' . |
565 | - implode( ' ', $attributes ) . |
|
566 | - ' />'; |
|
565 | + implode( ' ', $attributes ) . |
|
566 | + ' />'; |
|
567 | 567 | |
568 | 568 | if ( $echo ) { |
569 | 569 | echo $html; |
@@ -581,12 +581,12 @@ discard block |
||
581 | 581 | } |
582 | 582 | |
583 | 583 | /** |
584 | - * Check whether GravityView is being saved |
|
585 | - * |
|
586 | - * The generic is_save_postback() is true for all addons |
|
587 | - * |
|
588 | - * @since 2.0.8 |
|
589 | - * |
|
584 | + * Check whether GravityView is being saved |
|
585 | + * |
|
586 | + * The generic is_save_postback() is true for all addons |
|
587 | + * |
|
588 | + * @since 2.0.8 |
|
589 | + * |
|
590 | 590 | * @return bool |
591 | 591 | */ |
592 | 592 | public function is_save_postback() { |
@@ -600,16 +600,16 @@ discard block |
||
600 | 600 | */ |
601 | 601 | public function license_key_notice() { |
602 | 602 | |
603 | - if( $this->is_save_postback() ) { |
|
604 | - $settings = $this->get_posted_settings(); |
|
605 | - $license_key = defined( 'GRAVITYVIEW_LICENSE_KEY' ) ? GRAVITYVIEW_LICENSE_KEY : \GV\Utils::get( $settings, 'license_key' ); |
|
606 | - $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' ); |
|
607 | - } else { |
|
608 | - $license_status = $this->get( 'license_key_status', 'inactive' ); |
|
609 | - $license_key = $this->get( 'license_key' ); |
|
610 | - } |
|
603 | + if( $this->is_save_postback() ) { |
|
604 | + $settings = $this->get_posted_settings(); |
|
605 | + $license_key = defined( 'GRAVITYVIEW_LICENSE_KEY' ) ? GRAVITYVIEW_LICENSE_KEY : \GV\Utils::get( $settings, 'license_key' ); |
|
606 | + $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' ); |
|
607 | + } else { |
|
608 | + $license_status = $this->get( 'license_key_status', 'inactive' ); |
|
609 | + $license_key = $this->get( 'license_key' ); |
|
610 | + } |
|
611 | 611 | |
612 | - $license_id = empty( $license_key ) ? 'license' : $license_key; |
|
612 | + $license_id = empty( $license_key ) ? 'license' : $license_key; |
|
613 | 613 | |
614 | 614 | $message = esc_html__( 'Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview' ); |
615 | 615 | |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | $update_below = false; |
627 | 627 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
628 | 628 | |
629 | - switch ( $license_status ) { |
|
629 | + switch ( $license_status ) { |
|
630 | 630 | /** @since 1.17 */ |
631 | 631 | case 'expired': |
632 | 632 | $title = __( 'Expired License', 'gravityview' ); |
@@ -664,13 +664,13 @@ discard block |
||
664 | 664 | return; |
665 | 665 | } |
666 | 666 | |
667 | - \GravityView_Admin_Notices::add_notice( array( |
|
668 | - 'message' => $message, |
|
669 | - 'class' => 'notice notice-warning', |
|
670 | - 'title' => $title, |
|
671 | - 'cap' => 'gravityview_edit_settings', |
|
672 | - 'dismiss' => sha1( $license_status . '_' . $license_id . '_' . date( 'z' ) ), // Show every day, instead of every 8 weeks (which is the default) |
|
673 | - ) ); |
|
667 | + \GravityView_Admin_Notices::add_notice( array( |
|
668 | + 'message' => $message, |
|
669 | + 'class' => 'notice notice-warning', |
|
670 | + 'title' => $title, |
|
671 | + 'cap' => 'gravityview_edit_settings', |
|
672 | + 'dismiss' => sha1( $license_status . '_' . $license_id . '_' . date( 'z' ) ), // Show every day, instead of every 8 weeks (which is the default) |
|
673 | + ) ); |
|
674 | 674 | } |
675 | 675 | |
676 | 676 | /** |
@@ -684,12 +684,12 @@ discard block |
||
684 | 684 | } |
685 | 685 | |
686 | 686 | /** |
687 | - * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason. |
|
688 | - * |
|
689 | - * @since 1.21.5 |
|
690 | - * |
|
691 | - * @see GFAddOn::scripts() |
|
692 | - * |
|
687 | + * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason. |
|
688 | + * |
|
689 | + * @since 1.21.5 |
|
690 | + * |
|
691 | + * @see GFAddOn::scripts() |
|
692 | + * |
|
693 | 693 | * @return array Array of scripts |
694 | 694 | */ |
695 | 695 | public function scripts() { |
@@ -698,10 +698,10 @@ discard block |
||
698 | 698 | $scripts[] = array( |
699 | 699 | 'handle' => 'gform_tooltip_init', |
700 | 700 | 'enqueue' => array( |
701 | - array( |
|
702 | - 'admin_page' => array( 'app_settings' ) |
|
703 | - ) |
|
704 | - ) |
|
701 | + array( |
|
702 | + 'admin_page' => array( 'app_settings' ) |
|
703 | + ) |
|
704 | + ) |
|
705 | 705 | ); |
706 | 706 | |
707 | 707 | return $scripts; |
@@ -719,10 +719,10 @@ discard block |
||
719 | 719 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
720 | 720 | 'version' => Plugin::$version, |
721 | 721 | 'deps' => array( |
722 | - 'gform_admin', |
|
722 | + 'gform_admin', |
|
723 | 723 | 'gaddon_form_settings_css', |
724 | - 'gform_tooltip', |
|
725 | - 'gform_font_awesome', |
|
724 | + 'gform_tooltip', |
|
725 | + 'gform_font_awesome', |
|
726 | 726 | ), |
727 | 727 | 'enqueue' => array( |
728 | 728 | array( 'admin_page' => array( |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | array( |
891 | 891 | 'label' => esc_html__( 'Show me beta versions if they are available.', 'gravityview' ), |
892 | 892 | 'value' => '1', |
893 | - 'name' => 'beta', |
|
893 | + 'name' => 'beta', |
|
894 | 894 | ), |
895 | 895 | ), |
896 | 896 | 'description' => __( 'You will have early access to the latest GravityView features and improvements. There may be bugs! If you encounter an issue, help make GravityView better by reporting it!', 'gravityview' ), |
@@ -928,38 +928,38 @@ discard block |
||
928 | 928 | |
929 | 929 | if ( empty( $field['disabled'] ) ) { |
930 | 930 | unset( $field['disabled'] ); |
931 | - } |
|
931 | + } |
|
932 | 932 | } |
933 | 933 | |
934 | - $sections = array( |
|
935 | - array( |
|
936 | - 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ), |
|
937 | - 'fields' => $fields, |
|
938 | - ) |
|
939 | - ); |
|
934 | + $sections = array( |
|
935 | + array( |
|
936 | + 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ), |
|
937 | + 'fields' => $fields, |
|
938 | + ) |
|
939 | + ); |
|
940 | 940 | |
941 | - // custom 'update settings' button |
|
942 | - $button = array( |
|
943 | - 'class' => 'button button-primary button-hero', |
|
944 | - 'type' => 'save', |
|
945 | - ); |
|
941 | + // custom 'update settings' button |
|
942 | + $button = array( |
|
943 | + 'class' => 'button button-primary button-hero', |
|
944 | + 'type' => 'save', |
|
945 | + ); |
|
946 | 946 | |
947 | 947 | if ( $disabled_attribute ) { |
948 | 948 | $button['disabled'] = $disabled_attribute; |
949 | 949 | } |
950 | 950 | |
951 | - /** |
|
952 | - * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
953 | - * Extensions can tap in here to insert their own section and settings. |
|
954 | - * <code> |
|
955 | - * $sections[] = array( |
|
956 | - * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
957 | - * 'fields' => $settings, |
|
958 | - * ); |
|
959 | - * </code> |
|
960 | - * @param array $extension_settings Empty array, ready for extension settings! |
|
961 | - */ |
|
962 | - $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
951 | + /** |
|
952 | + * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
953 | + * Extensions can tap in here to insert their own section and settings. |
|
954 | + * <code> |
|
955 | + * $sections[] = array( |
|
956 | + * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
957 | + * 'fields' => $settings, |
|
958 | + * ); |
|
959 | + * </code> |
|
960 | + * @param array $extension_settings Empty array, ready for extension settings! |
|
961 | + */ |
|
962 | + $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
963 | 963 | |
964 | 964 | // If there are extensions, add a section for them |
965 | 965 | if ( ! empty( $extension_sections ) ) { |
@@ -972,13 +972,13 @@ discard block |
||
972 | 972 | } |
973 | 973 | } |
974 | 974 | |
975 | - $k = count( $extension_sections ) - 1 ; |
|
976 | - $extension_sections[ $k ]['fields'][] = $button; |
|
975 | + $k = count( $extension_sections ) - 1 ; |
|
976 | + $extension_sections[ $k ]['fields'][] = $button; |
|
977 | 977 | $sections = array_merge( $sections, $extension_sections ); |
978 | 978 | } else { |
979 | - // add the 'update settings' button to the general section |
|
980 | - $sections[0]['fields'][] = $button; |
|
981 | - } |
|
979 | + // add the 'update settings' button to the general section |
|
980 | + $sections[0]['fields'][] = $button; |
|
981 | + } |
|
982 | 982 | |
983 | 983 | return $sections; |
984 | 984 | } |
@@ -1032,9 +1032,9 @@ discard block |
||
1032 | 1032 | */ |
1033 | 1033 | protected function settings_edd_license( $field, $echo = true ) { |
1034 | 1034 | |
1035 | - if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
|
1036 | - $field['input_type'] = 'password'; |
|
1037 | - } |
|
1035 | + if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
|
1036 | + $field['input_type'] = 'password'; |
|
1037 | + } |
|
1038 | 1038 | |
1039 | 1039 | $text = $this->settings_text( $field, false ); |
1040 | 1040 | |
@@ -1051,9 +1051,9 @@ discard block |
||
1051 | 1051 | |
1052 | 1052 | /** |
1053 | 1053 | * Allow pure HTML settings row |
1054 | - * |
|
1055 | - * @since 2.0.6 |
|
1056 | - * |
|
1054 | + * |
|
1055 | + * @since 2.0.6 |
|
1056 | + * |
|
1057 | 1057 | * @param array $field |
1058 | 1058 | * @param bool $echo Whether to echo the |
1059 | 1059 | * |
@@ -1119,19 +1119,19 @@ discard block |
||
1119 | 1119 | } |
1120 | 1120 | |
1121 | 1121 | /** |
1122 | - * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it |
|
1123 | - * |
|
1124 | - * Converts `$field['description']` to `$field['gv_description']` |
|
1125 | - * Converts `$field['subtitle']` to `$field['description']` |
|
1126 | - * |
|
1127 | - * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description` |
|
1128 | - * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description |
|
1129 | - * |
|
1130 | - * @since 1.21.5.2 |
|
1131 | - * |
|
1122 | + * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it |
|
1123 | + * |
|
1124 | + * Converts `$field['description']` to `$field['gv_description']` |
|
1125 | + * Converts `$field['subtitle']` to `$field['description']` |
|
1126 | + * |
|
1127 | + * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description` |
|
1128 | + * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description |
|
1129 | + * |
|
1130 | + * @since 1.21.5.2 |
|
1131 | + * |
|
1132 | 1132 | * @param array $field |
1133 | - * |
|
1134 | - * @return void |
|
1133 | + * |
|
1134 | + * @return void |
|
1135 | 1135 | */ |
1136 | 1136 | public function single_setting_row( $field ) { |
1137 | 1137 | $field['gv_description'] = Utils::get( $field, 'description' ); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @return array |
103 | 103 | */ |
104 | 104 | public function modify_app_settings_menu_title( $setting_tabs ) { |
105 | - $setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview' ); |
|
105 | + $setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' ); |
|
106 | 106 | return $setting_tabs; |
107 | 107 | } |
108 | 108 | |
@@ -308,15 +308,15 @@ discard block |
||
308 | 308 | </ul> |
309 | 309 | <div class="gv-followup widefat"> |
310 | 310 | <p><strong><label for="gv-reason-details"><?php esc_html_e( 'Comments', 'gravityview' ); ?></label></strong></p> |
311 | - <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview') ?>" placeholder="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview'); ?>" class="large-text"></textarea> |
|
311 | + <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ) ?>" placeholder="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ); ?>" class="large-text"></textarea> |
|
312 | 312 | </div> |
313 | 313 | <div class="scale-description"> |
314 | 314 | <p><strong><?php esc_html_e( 'How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p> |
315 | 315 | <ul class="inline"> |
316 | 316 | <?php |
317 | 317 | $i = 0; |
318 | - while( $i < 11 ) { |
|
319 | - echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_'.$i.'" value="'.$i.'" type="radio"> '.$i.'</label></li>'; |
|
318 | + while ( $i < 11 ) { |
|
319 | + echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>'; |
|
320 | 320 | $i++; |
321 | 321 | } |
322 | 322 | ?> |
@@ -549,15 +549,15 @@ discard block |
||
549 | 549 | * @return string The HTML |
550 | 550 | */ |
551 | 551 | public function as_html( $field, $echo = true ) { |
552 | - $field['type'] = ( isset( $field['type'] ) && in_array( $field['type'], array( 'submit','reset','button' ) ) ) ? $field['type'] : 'submit'; |
|
552 | + $field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit'; |
|
553 | 553 | |
554 | 554 | $attributes = $this->get_field_attributes( $field ); |
555 | 555 | $default_value = Utils::get( $field, 'value', Utils::get( $field, 'default_value' ) ); |
556 | - $value = $this->get( $field['name'], $default_value ); |
|
556 | + $value = $this->get( $field[ 'name' ], $default_value ); |
|
557 | 557 | |
558 | 558 | |
559 | - $attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary gfbutton'; |
|
560 | - $name = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_' . $field['name']; |
|
559 | + $attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary gfbutton'; |
|
560 | + $name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ]; |
|
561 | 561 | |
562 | 562 | if ( empty( $value ) ) { |
563 | 563 | $value = __( 'Update Settings', 'gravityview' ); |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | $attributes = $this->get_field_attributes( $field ); |
567 | 567 | |
568 | 568 | $html = '<input |
569 | - type="' . $field['type'] . '" |
|
569 | + type="' . $field[ 'type' ] . '" |
|
570 | 570 | name="' . esc_attr( $name ) . '" |
571 | 571 | value="' . $value . '" ' . |
572 | 572 | implode( ' ', $attributes ) . |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | * @return bool |
598 | 598 | */ |
599 | 599 | public function is_save_postback() { |
600 | - return isset( $_POST['gform-settings-save'] ) && isset( $_POST['_gravityview_save_settings_nonce'] ); |
|
600 | + return isset( $_POST[ 'gform-settings-save' ] ) && isset( $_POST[ '_gravityview_save_settings_nonce' ] ); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | /** |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | */ |
608 | 608 | public function license_key_notice() { |
609 | 609 | |
610 | - if( $this->is_save_postback() ) { |
|
610 | + if ( $this->is_save_postback() ) { |
|
611 | 611 | $settings = $this->get_posted_settings(); |
612 | 612 | $license_key = defined( 'GRAVITYVIEW_LICENSE_KEY' ) ? GRAVITYVIEW_LICENSE_KEY : \GV\Utils::get( $settings, 'license_key' ); |
613 | 613 | $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' ); |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | * but didn't want to mess up the translation strings for the translators. |
629 | 629 | */ |
630 | 630 | $message = mb_substr( $message, 0, mb_strlen( $message ) - 1 ); |
631 | - $title = __( 'Inactive License', 'gravityview'); |
|
631 | + $title = __( 'Inactive License', 'gravityview' ); |
|
632 | 632 | $status = ''; |
633 | 633 | $update_below = false; |
634 | 634 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | $update_below = __( 'Activate your license key below.', 'gravityview' ); |
659 | 659 | break; |
660 | 660 | } |
661 | - $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content='.$license_status.'&utm_campaign=Admin%20Notice'; |
|
661 | + $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content=' . $license_status . '&utm_campaign=Admin%20Notice'; |
|
662 | 662 | |
663 | 663 | // Show a different notice on settings page for inactive licenses (hide the buttons) |
664 | 664 | if ( $update_below && gravityview()->request->is_admin( '', 'settings' ) ) { |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | public function scripts() { |
703 | 703 | $scripts = parent::scripts(); |
704 | 704 | |
705 | - $scripts[] = array( |
|
705 | + $scripts[ ] = array( |
|
706 | 706 | 'handle' => 'gform_tooltip_init', |
707 | 707 | 'enqueue' => array( |
708 | 708 | array( |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | public function styles() { |
722 | 722 | $styles = parent::styles(); |
723 | 723 | |
724 | - $styles[] = array( |
|
724 | + $styles[ ] = array( |
|
725 | 725 | 'handle' => 'gravityview_settings', |
726 | 726 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
727 | 727 | 'version' => Plugin::$version, |
@@ -810,26 +810,26 @@ discard block |
||
810 | 810 | 'label' => __( 'License Key', 'gravityview' ), |
811 | 811 | 'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates & support.', 'gravityview' ) . $this->get_license_handler()->license_details( $this->get_app_setting( 'license_key_response' ) ), |
812 | 812 | 'type' => 'edd_license', |
813 | - 'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ), |
|
813 | + 'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ), |
|
814 | 814 | 'data-pending-text' => __( 'Verifying license…', 'gravityview' ), |
815 | - 'default_value' => $default_settings['license_key'], |
|
815 | + 'default_value' => $default_settings[ 'license_key' ], |
|
816 | 816 | 'class' => ( '' == $this->get( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key', |
817 | 817 | ), |
818 | 818 | array( |
819 | 819 | 'name' => 'license_key_response', |
820 | - 'default_value' => $default_settings['license_key_response'], |
|
820 | + 'default_value' => $default_settings[ 'license_key_response' ], |
|
821 | 821 | 'type' => 'hidden', |
822 | 822 | ), |
823 | 823 | array( |
824 | 824 | 'name' => 'license_key_status', |
825 | - 'default_value' => $default_settings['license_key_status'], |
|
825 | + 'default_value' => $default_settings[ 'license_key_status' ], |
|
826 | 826 | 'type' => 'hidden', |
827 | 827 | ), |
828 | 828 | array( |
829 | 829 | 'name' => 'support-email', |
830 | 830 | 'type' => 'text', |
831 | 831 | 'validate' => 'email', |
832 | - 'default_value' => $default_settings['support-email'], |
|
832 | + 'default_value' => $default_settings[ 'support-email' ], |
|
833 | 833 | 'label' => __( 'Support Email', 'gravityview' ), |
834 | 834 | 'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ), |
835 | 835 | 'class' => 'code regular-text', |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | 'name' => 'support_port', |
842 | 842 | 'type' => 'radio', |
843 | 843 | 'label' => __( 'Show Support Port?', 'gravityview' ), |
844 | - 'default_value' => $default_settings['support_port'], |
|
844 | + 'default_value' => $default_settings[ 'support_port' ], |
|
845 | 845 | 'horizontal' => 1, |
846 | 846 | 'choices' => array( |
847 | 847 | array( |
@@ -860,7 +860,7 @@ discard block |
||
860 | 860 | 'name' => 'no-conflict-mode', |
861 | 861 | 'type' => 'radio', |
862 | 862 | 'label' => __( 'No-Conflict Mode', 'gravityview' ), |
863 | - 'default_value' => $default_settings['no-conflict-mode'], |
|
863 | + 'default_value' => $default_settings[ 'no-conflict-mode' ], |
|
864 | 864 | 'horizontal' => 1, |
865 | 865 | 'choices' => array( |
866 | 866 | array( |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | 'name' => 'rest_api', |
883 | 883 | 'type' => 'radio', |
884 | 884 | 'label' => __( 'REST API', 'gravityview' ), |
885 | - 'default_value' => $default_settings['rest_api'], |
|
885 | + 'default_value' => $default_settings[ 'rest_api' ], |
|
886 | 886 | 'horizontal' => 1, |
887 | 887 | 'choices' => array( |
888 | 888 | array( |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | 'name' => 'beta', |
902 | 902 | 'type' => 'checkbox', |
903 | 903 | 'label' => __( 'Become a Beta Tester', 'gravityview' ), |
904 | - 'default_value' => $default_settings['beta'], |
|
904 | + 'default_value' => $default_settings[ 'beta' ], |
|
905 | 905 | 'horizontal' => 1, |
906 | 906 | 'choices' => array( |
907 | 907 | array( |
@@ -934,17 +934,17 @@ discard block |
||
934 | 934 | * @since 1.7.4 |
935 | 935 | */ |
936 | 936 | foreach ( $fields as &$field ) { |
937 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : Utils::get( $field, 'id' ); |
|
938 | - $field['label'] = isset( $field['label'] ) ? $field['label'] : Utils::get( $field, 'title' ); |
|
939 | - $field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : Utils::get( $field, 'default' ); |
|
940 | - $field['description'] = isset( $field['description'] ) ? $field['description'] : Utils::get( $field, 'subtitle' ); |
|
937 | + $field[ 'name' ] = isset( $field[ 'name' ] ) ? $field[ 'name' ] : Utils::get( $field, 'id' ); |
|
938 | + $field[ 'label' ] = isset( $field[ 'label' ] ) ? $field[ 'label' ] : Utils::get( $field, 'title' ); |
|
939 | + $field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : Utils::get( $field, 'default' ); |
|
940 | + $field[ 'description' ] = isset( $field[ 'description' ] ) ? $field[ 'description' ] : Utils::get( $field, 'subtitle' ); |
|
941 | 941 | |
942 | 942 | if ( $disabled_attribute ) { |
943 | - $field['disabled'] = $disabled_attribute; |
|
943 | + $field[ 'disabled' ] = $disabled_attribute; |
|
944 | 944 | } |
945 | 945 | |
946 | - if ( empty( $field['disabled'] ) ) { |
|
947 | - unset( $field['disabled'] ); |
|
946 | + if ( empty( $field[ 'disabled' ] ) ) { |
|
947 | + unset( $field[ 'disabled' ] ); |
|
948 | 948 | } |
949 | 949 | } |
950 | 950 | |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | ); |
963 | 963 | |
964 | 964 | if ( $disabled_attribute ) { |
965 | - $button['disabled'] = $disabled_attribute; |
|
965 | + $button[ 'disabled' ] = $disabled_attribute; |
|
966 | 966 | } |
967 | 967 | |
968 | 968 | /** |
@@ -981,20 +981,20 @@ discard block |
||
981 | 981 | // If there are extensions, add a section for them |
982 | 982 | if ( ! empty( $extension_sections ) ) { |
983 | 983 | |
984 | - if( $disabled_attribute ) { |
|
984 | + if ( $disabled_attribute ) { |
|
985 | 985 | foreach ( $extension_sections as &$section ) { |
986 | - foreach ( $section['fields'] as &$field ) { |
|
987 | - $field['disabled'] = $disabled_attribute; |
|
986 | + foreach ( $section[ 'fields' ] as &$field ) { |
|
987 | + $field[ 'disabled' ] = $disabled_attribute; |
|
988 | 988 | } |
989 | 989 | } |
990 | 990 | } |
991 | 991 | |
992 | - $k = count( $extension_sections ) - 1 ; |
|
993 | - $extension_sections[ $k ]['fields'][] = $button; |
|
992 | + $k = count( $extension_sections ) - 1; |
|
993 | + $extension_sections[ $k ][ 'fields' ][ ] = $button; |
|
994 | 994 | $sections = array_merge( $sections, $extension_sections ); |
995 | 995 | } else { |
996 | 996 | // add the 'update settings' button to the general section |
997 | - $sections[0]['fields'][] = $button; |
|
997 | + $sections[ 0 ][ 'fields' ][ ] = $button; |
|
998 | 998 | } |
999 | 999 | |
1000 | 1000 | return $sections; |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | protected function settings_edd_license( $field, $echo = true ) { |
1051 | 1051 | |
1052 | 1052 | if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
1053 | - $field['input_type'] = 'password'; |
|
1053 | + $field[ 'input_type' ] = 'password'; |
|
1054 | 1054 | } |
1055 | 1055 | |
1056 | 1056 | $text = $this->settings_text( $field, false ); |
@@ -1099,7 +1099,7 @@ discard block |
||
1099 | 1099 | public function single_setting_row_html( $field ) { |
1100 | 1100 | ?> |
1101 | 1101 | |
1102 | - <tr id="gaddon-setting-row-<?php echo esc_attr( $field['name'] ); ?>"> |
|
1102 | + <tr id="gaddon-setting-row-<?php echo esc_attr( $field[ 'name' ] ); ?>"> |
|
1103 | 1103 | <td colspan="2"> |
1104 | 1104 | <?php $this->single_setting( $field ); ?> |
1105 | 1105 | </td> |
@@ -1117,10 +1117,10 @@ discard block |
||
1117 | 1117 | * @return string |
1118 | 1118 | */ |
1119 | 1119 | public function settings_save( $field, $echo = true ) { |
1120 | - $field['type'] = 'submit'; |
|
1121 | - $field['name'] = 'gform-settings-save'; |
|
1122 | - $field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton'; |
|
1123 | - $field['value'] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) ); |
|
1120 | + $field[ 'type' ] = 'submit'; |
|
1121 | + $field[ 'name' ] = 'gform-settings-save'; |
|
1122 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] : 'button-primary gfbutton'; |
|
1123 | + $field[ 'value' ] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) ); |
|
1124 | 1124 | |
1125 | 1125 | $output = $this->settings_submit( $field, false ); |
1126 | 1126 | |
@@ -1151,8 +1151,8 @@ discard block |
||
1151 | 1151 | * @return void |
1152 | 1152 | */ |
1153 | 1153 | public function single_setting_row( $field ) { |
1154 | - $field['gv_description'] = Utils::get( $field, 'description' ); |
|
1155 | - $field['description'] = Utils::get( $field, 'subtitle' ); |
|
1154 | + $field[ 'gv_description' ] = Utils::get( $field, 'description' ); |
|
1155 | + $field[ 'description' ] = Utils::get( $field, 'subtitle' ); |
|
1156 | 1156 | parent::single_setting_row( $field ); |
1157 | 1157 | } |
1158 | 1158 | |
@@ -1164,7 +1164,7 @@ discard block |
||
1164 | 1164 | public function single_setting_label( $field ) { |
1165 | 1165 | parent::single_setting_label( $field ); |
1166 | 1166 | if ( $description = Utils::get( $field, 'gv_description' ) ) { |
1167 | - echo '<span class="description">'. $description .'</span>'; |
|
1167 | + echo '<span class="description">' . $description . '</span>'; |
|
1168 | 1168 | } |
1169 | 1169 | } |
1170 | 1170 | |
@@ -1209,10 +1209,10 @@ discard block |
||
1209 | 1209 | // then we assume it's changed. If it's changed, unset the status and the previous response. |
1210 | 1210 | if ( ! $added_message && ( $local_key !== $response_key ) ) { |
1211 | 1211 | |
1212 | - unset( $posted_settings['license_key_response'] ); |
|
1213 | - unset( $posted_settings['license_key_status'] ); |
|
1212 | + unset( $posted_settings[ 'license_key_response' ] ); |
|
1213 | + unset( $posted_settings[ 'license_key_status' ] ); |
|
1214 | 1214 | |
1215 | - \GFCommon::add_error_message( __('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
1215 | + \GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
1216 | 1216 | |
1217 | 1217 | $added_message = true; |
1218 | 1218 | } |
@@ -73,7 +73,7 @@ |
||
73 | 73 | * |
74 | 74 | * @param array $allowlist Array of widgets to show before a search is performed, if the setting is enabled. |
75 | 75 | * |
76 | - * @return array |
|
76 | + * @return string[] |
|
77 | 77 | */ |
78 | 78 | function add_to_allowlist( $allowlist ) { |
79 | 79 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | function __construct() { |
15 | 15 | |
16 | - $this->widget_description = __('Display a Gravity Forms form.', 'gravityview' ); |
|
16 | + $this->widget_description = __( 'Display a Gravity Forms form.', 'gravityview' ); |
|
17 | 17 | |
18 | 18 | $default_values = array( |
19 | 19 | 'header' => 1, |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | add_filter( 'gravityview/widget/hide_until_searched/whitelist', array( $this, 'add_to_allowlist' ) ); |
56 | 56 | |
57 | - parent::__construct( __( 'Gravity Forms', 'gravityview' ) , 'gravityforms', $default_values, $settings ); |
|
57 | + parent::__construct( __( 'Gravity Forms', 'gravityview' ), 'gravityforms', $default_values, $settings ); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -78,13 +78,13 @@ discard block |
||
78 | 78 | * gravityview_get_forms() is currently running too early as widgets_init runs before init and |
79 | 79 | * when most Gravity Forms plugins register their own fields like GP Terms of Service. |
80 | 80 | */ |
81 | - if( \GV\Admin_Request::is_admin() && ! GFForms::is_gravity_page() ) { |
|
81 | + if ( \GV\Admin_Request::is_admin() && ! GFForms::is_gravity_page() ) { |
|
82 | 82 | |
83 | 83 | // check for available gravity forms |
84 | 84 | $forms = gravityview_get_forms(); |
85 | 85 | |
86 | 86 | foreach ( $forms as $form ) { |
87 | - $choices[ $form['id'] ] = $form['title']; |
|
87 | + $choices[ $form[ 'id' ] ] = $form[ 'title' ]; |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | function add_to_allowlist( $allowlist ) { |
102 | 102 | |
103 | - $allowlist[] = 'gravityforms'; |
|
103 | + $allowlist[ ] = 'gravityforms'; |
|
104 | 104 | |
105 | 105 | return $allowlist; |
106 | 106 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @param string $content |
111 | 111 | * @param string $context |
112 | 112 | */ |
113 | - public function render_frontend( $widget_args, $content = '', $context = '') { |
|
113 | + public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
114 | 114 | |
115 | 115 | if ( ! $this->pre_render_frontend() ) { |
116 | 116 | return; |