@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | $is_table_layout = preg_match( '/table/ism', $template_id ); |
55 | 55 | |
56 | - if( 'field' === $field_type ) { |
|
56 | + if ( 'field' === $field_type ) { |
|
57 | 57 | |
58 | 58 | // Default options - fields |
59 | 59 | $field_options = array( |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | ); |
106 | 106 | |
107 | 107 | // Match Table as well as DataTables |
108 | - if( $is_table_layout && 'directory' === $context ) { |
|
109 | - $field_options['width'] = array( |
|
108 | + if ( $is_table_layout && 'directory' === $context ) { |
|
109 | + $field_options[ 'width' ] = array( |
|
110 | 110 | 'type' => 'number', |
111 | - 'label' => __('Percent Width', 'gk-gravityview'), |
|
112 | - 'desc' => __( 'Leave blank for column width to be based on the field content.', 'gk-gravityview'), |
|
111 | + 'label' => __( 'Percent Width', 'gk-gravityview' ), |
|
112 | + 'desc' => __( 'Leave blank for column width to be based on the field content.', 'gk-gravityview' ), |
|
113 | 113 | 'class' => 'code widefat', |
114 | 114 | 'value' => '', |
115 | 115 | 'priority' => 200, |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | // Remove suffix ":" from the labels to standardize style. Using trim() instead of rtrim() for i18n. |
123 | 123 | foreach ( $field_options as $key => $field_option ) { |
124 | - $field_options[ $key ]['label'] = trim( $field_option['label'], ':' ); |
|
124 | + $field_options[ $key ][ 'label' ] = trim( $field_option[ 'label' ], ':' ); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | */ |
147 | 147 | $field_options = apply_filters( "gravityview_template_{$input_type}_options", $field_options, $template_id, $field_id, $context, $input_type, $form_id ); |
148 | 148 | |
149 | - if ( 'directory' === $context && isset( $field_options['show_as_link'] ) && ! isset( $field_options['new_window'] ) ) { |
|
150 | - $field_options['new_window'] = array( |
|
149 | + if ( 'directory' === $context && isset( $field_options[ 'show_as_link' ] ) && ! isset( $field_options[ 'new_window' ] ) ) { |
|
150 | + $field_options[ 'new_window' ] = array( |
|
151 | 151 | 'type' => 'checkbox', |
152 | 152 | 'label' => __( 'Open link in a new tab or window?', 'gk-gravityview' ), |
153 | 153 | 'value' => false, |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | switch ( $key ) { |
169 | 169 | case 'show_as_link': |
170 | 170 | $_group = 'display'; |
171 | - $field_option['priority'] = 100; |
|
171 | + $field_option[ 'priority' ] = 100; |
|
172 | 172 | break; |
173 | 173 | default: |
174 | 174 | $_group = \GV\Utils::get( $field_option, 'group', 'display' ); |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | } |
184 | 184 | |
185 | 185 | $field_options = array(); |
186 | - foreach ( self::get_field_groups() as $group_key => $group_name ) { |
|
186 | + foreach ( self::get_field_groups() as $group_key => $group_name ) { |
|
187 | 187 | $field_options[ $group_key ] = \GV\Utils::get( $option_groups, $group_key, array() ); |
188 | 188 | } |
189 | 189 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | return 0; |
215 | 215 | } |
216 | 216 | |
217 | - return ( $a_priority < $b_priority ) ? - 1 : 1; |
|
217 | + return ( $a_priority < $b_priority ) ? -1 : 1; |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | 'manage_options' => __( 'Administrator', 'gk-gravityview' ), |
240 | 240 | ); |
241 | 241 | |
242 | - if( is_multisite() ) { |
|
243 | - $select_cap_choices['manage_network'] = __('Multisite Super Admin', 'gk-gravityview' ); |
|
242 | + if ( is_multisite() ) { |
|
243 | + $select_cap_choices[ 'manage_network' ] = __( 'Multisite Super Admin', 'gk-gravityview' ); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * @param string $context Optional. What context are we in? Example: `single` or `directory` |
254 | 254 | * @param string $input_type Optional. (textarea, list, select, etc.) |
255 | 255 | */ |
256 | - $select_cap_choices = apply_filters('gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type ); |
|
256 | + $select_cap_choices = apply_filters( 'gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type ); |
|
257 | 257 | |
258 | 258 | return $select_cap_choices; |
259 | 259 | } |
@@ -279,9 +279,9 @@ discard block |
||
279 | 279 | * @return string HTML of dialog box |
280 | 280 | */ |
281 | 281 | 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() ) { |
282 | - if( empty( $uniqid ) ) { |
|
282 | + if ( empty( $uniqid ) ) { |
|
283 | 283 | //generate a unique field id |
284 | - $uniqid = uniqid('', false); |
|
284 | + $uniqid = uniqid( '', false ); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | $grouped = ( 'field' === $field_type ); |
@@ -289,24 +289,24 @@ discard block |
||
289 | 289 | // get field/widget options |
290 | 290 | $option_groups = self::get_default_field_options( $field_type, $template_id, $field_id, $context, $input_type, $form_id, $grouped ); |
291 | 291 | |
292 | - if( ! $grouped ) { |
|
292 | + if ( ! $grouped ) { |
|
293 | 293 | $option_groups = array( $option_groups ); |
294 | 294 | } |
295 | 295 | |
296 | 296 | $option_groups = array_filter( $option_groups ); |
297 | 297 | |
298 | 298 | // two different post arrays, depending of the field type |
299 | - $name_prefix = $field_type .'s' .'['. $area .']['. $uniqid .']'; |
|
299 | + $name_prefix = $field_type . 's' . '[' . $area . '][' . $uniqid . ']'; |
|
300 | 300 | |
301 | 301 | // build output |
302 | - $hidden_fields = '<input type="hidden" class="field-key" name="'. $name_prefix .'[id]" value="'. esc_attr( $field_id ) .'">'; |
|
303 | - $hidden_fields .= '<input type="hidden" class="field-label" name="'. $name_prefix .'[label]" value="'. esc_attr( $field_label ) .'">'; |
|
302 | + $hidden_fields = '<input type="hidden" class="field-key" name="' . $name_prefix . '[id]" value="' . esc_attr( $field_id ) . '">'; |
|
303 | + $hidden_fields .= '<input type="hidden" class="field-label" name="' . $name_prefix . '[label]" value="' . esc_attr( $field_label ) . '">'; |
|
304 | 304 | |
305 | 305 | $form_title = ''; |
306 | 306 | if ( $form_id ) { |
307 | - $hidden_fields .= '<input type="hidden" class="field-form-id" name="'. $name_prefix .'[form_id]" value="'. esc_attr( $form_id ) .'">'; |
|
307 | + $hidden_fields .= '<input type="hidden" class="field-form-id" name="' . $name_prefix . '[form_id]" value="' . esc_attr( $form_id ) . '">'; |
|
308 | 308 | $form = GVCommon::get_form_or_form_template( $form_id ); |
309 | - $form_title = $form['title']; |
|
309 | + $form_title = $form[ 'title' ]; |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | // If there are no options, return what we got. |
@@ -314,14 +314,14 @@ discard block |
||
314 | 314 | return $hidden_fields . '<!-- No Options -->'; // The HTML comment is here for checking if the output is empty in render_label() |
315 | 315 | } |
316 | 316 | |
317 | - $settings_title = esc_attr( sprintf( __( '%s Settings', 'gk-gravityview' ) , strip_tags( html_entity_decode( $field_label ) ) ) ); |
|
317 | + $settings_title = esc_attr( sprintf( __( '%s Settings', 'gk-gravityview' ), strip_tags( html_entity_decode( $field_label ) ) ) ); |
|
318 | 318 | |
319 | 319 | $field_details = ''; |
320 | 320 | |
321 | 321 | // Get the pretty name for the input type |
322 | 322 | $gv_field = GravityView_Fields::get( $input_type ); |
323 | 323 | |
324 | - if( $gv_field ) { |
|
324 | + if ( $gv_field ) { |
|
325 | 325 | $input_type_label = $gv_field->label; |
326 | 326 | } else { |
327 | 327 | $input_type_label = $input_type; |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | } |
336 | 336 | |
337 | 337 | if ( $grouped ) { |
338 | - $group_name = rgar( self::get_field_groups(), $group_key, '' ); |
|
338 | + $group_name = rgar( self::get_field_groups(), $group_key, '' ); |
|
339 | 339 | $field_settings .= '<fieldset class="item-settings-group item-settings-group-' . esc_attr( $group_key ) . '">'; |
340 | 340 | $field_settings .= '<legend>' . esc_attr( $group_name ) . '</legend>'; |
341 | 341 | } |
@@ -352,15 +352,15 @@ discard block |
||
352 | 352 | } |
353 | 353 | |
354 | 354 | $show_if = ''; |
355 | - if ( ! empty( $option['requires'] ) ) { |
|
356 | - $show_if .= sprintf( ' data-requires="%s"', $option['requires'] ); |
|
355 | + if ( ! empty( $option[ 'requires' ] ) ) { |
|
356 | + $show_if .= sprintf( ' data-requires="%s"', $option[ 'requires' ] ); |
|
357 | 357 | } |
358 | 358 | |
359 | - if ( ! empty( $option['requires_not'] ) ) { |
|
360 | - $show_if .= sprintf( ' data-requires-not="%s"', $option['requires_not'] ); |
|
359 | + if ( ! empty( $option[ 'requires_not' ] ) ) { |
|
360 | + $show_if .= sprintf( ' data-requires-not="%s"', $option[ 'requires_not' ] ); |
|
361 | 361 | } |
362 | 362 | |
363 | - switch ( $option['type'] ) { |
|
363 | + switch ( $option[ 'type' ] ) { |
|
364 | 364 | // Hide hidden fields |
365 | 365 | case 'hidden': |
366 | 366 | $field_settings .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . ' screen-reader-text">' . $field_output . '</div>'; |
@@ -378,30 +378,30 @@ discard block |
||
378 | 378 | $item_details = ''; |
379 | 379 | $subtitle = ''; |
380 | 380 | |
381 | - if( 'field' === $field_type ) { |
|
382 | - $subtitle = ! empty( $item['subtitle'] ) ? '<div class="subtitle">' . $item['subtitle'] . '</div>' : ''; |
|
381 | + if ( 'field' === $field_type ) { |
|
382 | + $subtitle = ! empty( $item[ 'subtitle' ] ) ? '<div class="subtitle">' . $item[ 'subtitle' ] . '</div>' : ''; |
|
383 | 383 | |
384 | 384 | $item_details .= ' |
385 | 385 | <div class="gv-field-details--container"> |
386 | - <label class="gv-field-details--toggle">' . esc_html__( 'Field Details', 'gk-gravityview' ) .' <i class="dashicons dashicons-arrow-right"></i></label> |
|
386 | + <label class="gv-field-details--toggle">' . esc_html__( 'Field Details', 'gk-gravityview' ) . ' <i class="dashicons dashicons-arrow-right"></i></label> |
|
387 | 387 | <section class="gv-field-details gv-field-details--closed">'; |
388 | 388 | |
389 | 389 | if ( $field_id && is_numeric( $field_id ) ) { |
390 | 390 | $item_details .= ' |
391 | 391 | <div class="gv-field-detail gv-field-detail--field"> |
392 | - <span class="gv-field-detail--label">' . esc_html__( 'Field ID', 'gk-gravityview' ) .'</span><span class="gv-field-detail--value">#{{field_id}}</span> |
|
392 | + <span class="gv-field-detail--label">' . esc_html__( 'Field ID', 'gk-gravityview' ) . '</span><span class="gv-field-detail--value">#{{field_id}}</span> |
|
393 | 393 | </div>'; |
394 | 394 | } |
395 | 395 | |
396 | 396 | $item_details .= ' |
397 | 397 | <div class="gv-field-detail gv-field-detail--type"> |
398 | - <span class="gv-field-detail--label">' . esc_html_x( 'Type', 'The type of field being configured (eg: "Single Line Text")', 'gk-gravityview' ) .'</span><span class="gv-field-detail--value">{{input_type_label}}</span> |
|
398 | + <span class="gv-field-detail--label">' . esc_html_x( 'Type', 'The type of field being configured (eg: "Single Line Text")', 'gk-gravityview' ) . '</span><span class="gv-field-detail--value">{{input_type_label}}</span> |
|
399 | 399 | </div>'; |
400 | 400 | |
401 | - if( $form_id ) { |
|
401 | + if ( $form_id ) { |
|
402 | 402 | $item_details .= ' |
403 | 403 | <div class="gv-field-detail gv-field-detail--form"> |
404 | - <span class="gv-field-detail--label">' . esc_html__( 'Form', 'gk-gravityview' ) .'</span><span class="gv-field-detail--value">{{form_title}} (#{{form_id}})</span> |
|
404 | + <span class="gv-field-detail--label">' . esc_html__( 'Form', 'gk-gravityview' ) . '</span><span class="gv-field-detail--value">{{form_title}} (#{{form_id}})</span> |
|
405 | 405 | </div>'; |
406 | 406 | } |
407 | 407 | |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | </section> |
410 | 410 | </div>'; |
411 | 411 | } else { |
412 | - $subtitle = ! empty( $item['subtitle'] ) ? '<div class="subtitle">' . $item['subtitle'] . '</div>' : ''; |
|
412 | + $subtitle = ! empty( $item[ 'subtitle' ] ) ? '<div class="subtitle">' . $item[ 'subtitle' ] . '</div>' : ''; |
|
413 | 413 | $widget_details_content = \GV\Utils::get( $item, 'description', '' ); |
414 | 414 | |
415 | 415 | // Intentionally not escaping to allow HTML. |
@@ -476,17 +476,17 @@ discard block |
||
476 | 476 | * @deprecated setting index 'default' was replaced by 'value' |
477 | 477 | * @see GravityView_FieldType::get_field_defaults |
478 | 478 | */ |
479 | - if( !empty( $option['default'] ) && empty( $option['value'] ) ) { |
|
480 | - $option['value'] = $option['default']; |
|
481 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting '. $name .' details' ); |
|
479 | + if ( ! empty( $option[ 'default' ] ) && empty( $option[ 'value' ] ) ) { |
|
480 | + $option[ 'value' ] = $option[ 'default' ]; |
|
481 | + _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting ' . $name . ' details' ); |
|
482 | 482 | } |
483 | 483 | |
484 | 484 | // prepare to render option field type |
485 | - if( isset( $option['type'] ) ) { |
|
485 | + if ( isset( $option[ 'type' ] ) ) { |
|
486 | 486 | |
487 | 487 | $type_class = self::load_type_class( $option ); |
488 | 488 | |
489 | - if( class_exists( $type_class ) ) { |
|
489 | + if ( class_exists( $type_class ) ) { |
|
490 | 490 | |
491 | 491 | /** @type GravityView_FieldType $render_type */ |
492 | 492 | $render_type = new $type_class( $name, $option, $curr_value ); |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | * @param string $output field class name |
504 | 504 | * @param array $option option field data |
505 | 505 | */ |
506 | - $output = apply_filters( "gravityview/option/output/{$option['type']}" , $output, $option ); |
|
506 | + $output = apply_filters( "gravityview/option/output/{$option[ 'type' ]}", $output, $option ); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | } // isset option[type] |
@@ -538,27 +538,27 @@ discard block |
||
538 | 538 | * @deprecated setting index 'name' was replaced by 'label' |
539 | 539 | * @see GravityView_FieldType::get_field_defaults |
540 | 540 | */ |
541 | - if( isset( $setting['name'] ) && empty( $setting['label'] ) ) { |
|
542 | - $setting['label'] = $setting['name']; |
|
543 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting '. $key .' details' ); |
|
541 | + if ( isset( $setting[ 'name' ] ) && empty( $setting[ 'label' ] ) ) { |
|
542 | + $setting[ 'label' ] = $setting[ 'name' ]; |
|
543 | + _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting ' . $key . ' details' ); |
|
544 | 544 | } |
545 | 545 | |
546 | 546 | $name = esc_attr( sprintf( $name, $key ) ); |
547 | - $setting['id'] = esc_attr( sprintf( $id, $key ) ); |
|
548 | - $setting['tooltip'] = 'gv_' . $key; |
|
547 | + $setting[ 'id' ] = esc_attr( sprintf( $id, $key ) ); |
|
548 | + $setting[ 'tooltip' ] = 'gv_' . $key; |
|
549 | 549 | |
550 | 550 | // Use default if current setting isn't set. |
551 | - $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting['value']; |
|
551 | + $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting[ 'value' ]; |
|
552 | 552 | |
553 | 553 | // default setting type = text |
554 | - $setting['type'] = empty( $setting['type'] ) ? 'text' : $setting['type']; |
|
554 | + $setting[ 'type' ] = empty( $setting[ 'type' ] ) ? 'text' : $setting[ 'type' ]; |
|
555 | 555 | |
556 | 556 | // merge tags |
557 | - if( !isset( $setting['merge_tags'] ) ) { |
|
558 | - if( $setting['type'] === 'text' ) { |
|
559 | - $setting['merge_tags'] = true; |
|
557 | + if ( ! isset( $setting[ 'merge_tags' ] ) ) { |
|
558 | + if ( $setting[ 'type' ] === 'text' ) { |
|
559 | + $setting[ 'merge_tags' ] = true; |
|
560 | 560 | } else { |
561 | - $setting['merge_tags'] = false; |
|
561 | + $setting[ 'merge_tags' ] = false; |
|
562 | 562 | } |
563 | 563 | } |
564 | 564 | |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | |
567 | 567 | // render the setting |
568 | 568 | $type_class = self::load_type_class( $setting ); |
569 | - if( class_exists( $type_class ) ) { |
|
569 | + if ( class_exists( $type_class ) ) { |
|
570 | 570 | /** @type GravityView_FieldType $render_type */ |
571 | 571 | $render_type = new $type_class( $name, $setting, $curr_value ); |
572 | 572 | ob_start(); |
@@ -576,25 +576,25 @@ discard block |
||
576 | 576 | } |
577 | 577 | |
578 | 578 | // Check if setting is specific for a template |
579 | - if( !empty( $setting['show_in_template'] ) ) { |
|
580 | - if( !is_array( $setting['show_in_template'] ) ) { |
|
581 | - $setting['show_in_template'] = array( $setting['show_in_template'] ); |
|
579 | + if ( ! empty( $setting[ 'show_in_template' ] ) ) { |
|
580 | + if ( ! is_array( $setting[ 'show_in_template' ] ) ) { |
|
581 | + $setting[ 'show_in_template' ] = array( $setting[ 'show_in_template' ] ); |
|
582 | 582 | } |
583 | - $show_if = ' data-show-if="'. implode( ' ', $setting['show_in_template'] ).'"'; |
|
583 | + $show_if = ' data-show-if="' . implode( ' ', $setting[ 'show_in_template' ] ) . '"'; |
|
584 | 584 | } else { |
585 | 585 | $show_if = ''; |
586 | 586 | } |
587 | 587 | |
588 | - if( ! empty( $setting['requires'] ) ) { |
|
589 | - $show_if .= sprintf( ' data-requires="%s"', $setting['requires'] ); |
|
588 | + if ( ! empty( $setting[ 'requires' ] ) ) { |
|
589 | + $show_if .= sprintf( ' data-requires="%s"', $setting[ 'requires' ] ); |
|
590 | 590 | } |
591 | 591 | |
592 | - if( ! empty( $setting['requires_not'] ) ) { |
|
593 | - $show_if .= sprintf( ' data-requires-not="%s"', $setting['requires_not'] ); |
|
592 | + if ( ! empty( $setting[ 'requires_not' ] ) ) { |
|
593 | + $show_if .= sprintf( ' data-requires-not="%s"', $setting[ 'requires_not' ] ); |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | // output |
597 | - echo '<tr style="vertical-align: top;" '. $show_if .'>' . $output . '</tr>'; |
|
597 | + echo '<tr style="vertical-align: top;" ' . $show_if . '>' . $output . '</tr>'; |
|
598 | 598 | |
599 | 599 | } |
600 | 600 | |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | */ |
607 | 607 | public static function load_type_class( $field = NULL ) { |
608 | 608 | |
609 | - if( empty( $field['type'] ) ) { |
|
609 | + if ( empty( $field[ 'type' ] ) ) { |
|
610 | 610 | return NULL; |
611 | 611 | } |
612 | 612 | |
@@ -615,9 +615,9 @@ discard block |
||
615 | 615 | * @param string $class_suffix field class suffix; `GravityView_FieldType_{$class_suffix}` |
616 | 616 | * @param array $field field data |
617 | 617 | */ |
618 | - $type_class = apply_filters( "gravityview/setting/class/{$field['type']}", 'GravityView_FieldType_' . $field['type'], $field ); |
|
618 | + $type_class = apply_filters( "gravityview/setting/class/{$field[ 'type' ]}", 'GravityView_FieldType_' . $field[ 'type' ], $field ); |
|
619 | 619 | |
620 | - if( class_exists( $type_class ) ) { |
|
620 | + if ( class_exists( $type_class ) ) { |
|
621 | 621 | return $type_class; |
622 | 622 | } |
623 | 623 | |
@@ -626,9 +626,9 @@ discard block |
||
626 | 626 | * @param string $field_type_include_path field class file path |
627 | 627 | * @param array $field field data |
628 | 628 | */ |
629 | - $class_file = apply_filters( "gravityview/setting/class_file/{$field['type']}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field['type']}.php", $field ); |
|
629 | + $class_file = apply_filters( "gravityview/setting/class_file/{$field[ 'type' ]}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field[ 'type' ]}.php", $field ); |
|
630 | 630 | |
631 | - if( $class_file && file_exists( $class_file ) ) { |
|
631 | + if ( $class_file && file_exists( $class_file ) ) { |
|
632 | 632 | require_once( $class_file ); |
633 | 633 | } |
634 | 634 | |
@@ -650,8 +650,8 @@ discard block |
||
650 | 650 | |
651 | 651 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_checkbox::render_input' ); |
652 | 652 | |
653 | - $output = '<input name="'. esc_attr( $name ) .'" type="hidden" value="0">'; |
|
654 | - $output .= '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="checkbox" value="1" '. checked( $current, '1', false ) .' >'; |
|
653 | + $output = '<input name="' . esc_attr( $name ) . '" type="hidden" value="0">'; |
|
654 | + $output .= '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="checkbox" value="1" ' . checked( $current, '1', false ) . ' >'; |
|
655 | 655 | |
656 | 656 | return $output; |
657 | 657 | } |
@@ -671,22 +671,22 @@ discard block |
||
671 | 671 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_text::render_input' ); |
672 | 672 | |
673 | 673 | // Show the merge tags if the field is a list view |
674 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
674 | + $is_list = ( preg_match( '/_list-/ism', $name ) ); |
|
675 | 675 | |
676 | 676 | // Or is a single entry view |
677 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
677 | + $is_single = ( preg_match( '/single_/ism', $name ) ); |
|
678 | 678 | $show = ( $is_single || $is_list ); |
679 | 679 | |
680 | 680 | $class = ''; |
681 | 681 | // and $add_merge_tags is not false |
682 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
682 | + if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
683 | 683 | $class = 'gv-merge-tag-support mt-position-right mt-hide_all_fields '; |
684 | 684 | } |
685 | 685 | |
686 | - $class .= !empty( $args['class'] ) ? $args['class'] : 'widefat'; |
|
687 | - $type = !empty( $args['type'] ) ? $args['type'] : 'text'; |
|
686 | + $class .= ! empty( $args[ 'class' ] ) ? $args[ 'class' ] : 'widefat'; |
|
687 | + $type = ! empty( $args[ 'type' ] ) ? $args[ 'type' ] : 'text'; |
|
688 | 688 | |
689 | - return '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="'.esc_attr($type).'" value="'. esc_attr( $current ) .'" class="'.esc_attr( $class ).'">'; |
|
689 | + return '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="' . esc_attr( $type ) . '" value="' . esc_attr( $current ) . '" class="' . esc_attr( $class ) . '">'; |
|
690 | 690 | } |
691 | 691 | |
692 | 692 | /** |
@@ -703,21 +703,21 @@ discard block |
||
703 | 703 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_textarea::render_input' ); |
704 | 704 | |
705 | 705 | // Show the merge tags if the field is a list view |
706 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
706 | + $is_list = ( preg_match( '/_list-/ism', $name ) ); |
|
707 | 707 | |
708 | 708 | // Or is a single entry view |
709 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
709 | + $is_single = ( preg_match( '/single_/ism', $name ) ); |
|
710 | 710 | $show = ( $is_single || $is_list ); |
711 | 711 | |
712 | 712 | $class = ''; |
713 | 713 | // and $add_merge_tags is not false |
714 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
714 | + if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
715 | 715 | $class = 'gv-merge-tag-support mt-position-right mt-hide_all_fields '; |
716 | 716 | } |
717 | 717 | |
718 | - $class .= !empty( $args['class'] ) ? 'widefat '.$args['class'] : 'widefat'; |
|
718 | + $class .= ! empty( $args[ 'class' ] ) ? 'widefat ' . $args[ 'class' ] : 'widefat'; |
|
719 | 719 | |
720 | - return '<textarea name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" class="'.esc_attr( $class ).'">'. esc_textarea( $current ) .'</textarea>'; |
|
720 | + return '<textarea name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class ) . '">' . esc_textarea( $current ) . '</textarea>'; |
|
721 | 721 | } |
722 | 722 | |
723 | 723 | /** |
@@ -733,9 +733,9 @@ discard block |
||
733 | 733 | |
734 | 734 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_select::render_input' ); |
735 | 735 | |
736 | - $output = '<select name="'. $name .'" id="'. $id .'">'; |
|
737 | - foreach( $choices as $value => $label ) { |
|
738 | - $output .= '<option value="'. esc_attr( $value ) .'" '. selected( $value, $current, false ) .'>'. esc_html( $label ) .'</option>'; |
|
736 | + $output = '<select name="' . $name . '" id="' . $id . '">'; |
|
737 | + foreach ( $choices as $value => $label ) { |
|
738 | + $output .= '<option value="' . esc_attr( $value ) . '" ' . selected( $value, $current, false ) . '>' . esc_html( $label ) . '</option>'; |
|
739 | 739 | } |
740 | 740 | $output .= '</select>'; |
741 | 741 |