@@ -19,12 +19,12 @@ |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | function render_input( $override_input = null ) { |
22 | - if( isset( $override_input ) ) { |
|
22 | + if ( isset( $override_input ) ) { |
|
23 | 23 | echo $override_input; |
24 | 24 | return; |
25 | 25 | } |
26 | 26 | |
27 | - foreach( $this->field['options'] as $value => $label ) : ?> |
|
27 | + foreach ( $this->field[ 'options' ] as $value => $label ) : ?> |
|
28 | 28 | <label class="<?php echo $this->get_label_class(); ?>"> |
29 | 29 | <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>-<?php echo esc_attr( $value ); ?>" type="radio" value="<?php echo esc_attr( $value ); ?>" <?php checked( $value, $this->value, true ); ?> /> <?php echo esc_html( $label ); ?> |
30 | 30 | </label> |
@@ -38,8 +38,8 @@ |
||
38 | 38 | // Set the $_field_id var |
39 | 39 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type ); |
40 | 40 | |
41 | - if( $this->is_choice_value_enabled() ) { |
|
42 | - $field_options['choice_display'] = array( |
|
41 | + if ( $this->is_choice_value_enabled() ) { |
|
42 | + $field_options[ 'choice_display' ] = array( |
|
43 | 43 | 'type' => 'radio', |
44 | 44 | 'value' => 'value', |
45 | 45 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -48,25 +48,25 @@ |
||
48 | 48 | |
49 | 49 | $quiz_fields = GFAPI::get_fields_by_type( $form, 'quiz' ); |
50 | 50 | |
51 | - if( ! empty( $quiz_fields ) ) { |
|
51 | + if ( ! empty( $quiz_fields ) ) { |
|
52 | 52 | |
53 | - $fields['gquiz_score'] = array( |
|
53 | + $fields[ 'gquiz_score' ] = array( |
|
54 | 54 | 'label' => __( 'Quiz Score Total', 'gravityview' ), |
55 | 55 | 'type' => 'quiz_score', |
56 | 56 | 'desc' => __( 'Displays the number of correct Quiz answers the user submitted.', 'gravityview' ), |
57 | 57 | ); |
58 | - $fields['gquiz_percent'] = array( |
|
58 | + $fields[ 'gquiz_percent' ] = array( |
|
59 | 59 | 'label' => __( 'Quiz Percentage Grade', 'gravityview' ), |
60 | 60 | 'type' => 'quiz_percent', |
61 | 61 | 'desc' => __( 'Displays the percentage of correct Quiz answers the user submitted.', 'gravityview' ), |
62 | 62 | ); |
63 | - $fields['gquiz_grade'] = array( |
|
63 | + $fields[ 'gquiz_grade' ] = array( |
|
64 | 64 | /* translators: This is a field type used by the Gravity Forms Quiz Addon. "A" is 100-90, "B" is 89-80, "C" is 79-70, etc. */ |
65 | 65 | 'label' => __( 'Quiz Letter Grade', 'gravityview' ), |
66 | 66 | 'type' => 'quiz_grade', |
67 | 67 | 'desc' => __( 'Displays the Grade the user achieved based on Letter Grading configured in the Quiz Settings.', 'gravityview' ), |
68 | 68 | ); |
69 | - $fields['gquiz_is_pass'] = array( |
|
69 | + $fields[ 'gquiz_is_pass' ] = array( |
|
70 | 70 | 'label' => __( 'Quiz Pass/Fail', 'gravityview' ), |
71 | 71 | 'type' => 'quiz_is_pass', |
72 | 72 | 'desc' => __( 'Displays either Passed or Failed based on the Pass/Fail settings configured in the Quiz Settings.', 'gravityview' ), |
@@ -49,7 +49,7 @@ |
||
49 | 49 | * |
50 | 50 | * @return string If a custom field label isn't set, return the field label for the password field |
51 | 51 | */ |
52 | - function field_label( $label = '', $field = array(), $form = array(), $entry = array() ){ |
|
52 | + function field_label( $label = '', $field = array(), $form = array(), $entry = array() ) { |
|
53 | 53 | |
54 | 54 | // If using a custom label, no need to fetch the parent label |
55 | 55 | if( ! is_numeric( $field['id'] ) || ! empty( $field['custom_label'] ) ) { |
@@ -49,17 +49,17 @@ discard block |
||
49 | 49 | * |
50 | 50 | * @return string If a custom field label isn't set, return the field label for the password field |
51 | 51 | */ |
52 | - function field_label( $label = '', $field = array(), $form = array(), $entry = array() ){ |
|
52 | + function field_label( $label = '', $field = array(), $form = array(), $entry = array() ) { |
|
53 | 53 | |
54 | 54 | // If using a custom label, no need to fetch the parent label |
55 | - if( ! is_numeric( $field['id'] ) || ! empty( $field['custom_label'] ) ) { |
|
55 | + if ( ! is_numeric( $field[ 'id' ] ) || ! empty( $field[ 'custom_label' ] ) ) { |
|
56 | 56 | return $label; |
57 | 57 | } |
58 | 58 | |
59 | - $field_object = GFFormsModel::get_field( $form, $field['id'] ); |
|
59 | + $field_object = GFFormsModel::get_field( $form, $field[ 'id' ] ); |
|
60 | 60 | |
61 | - if( $field_object && 'password' === $field_object->type ) { |
|
62 | - $label = $field['label']; |
|
61 | + if ( $field_object && 'password' === $field_object->type ) { |
|
62 | + $label = $field[ 'label' ]; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | return $label; |
@@ -79,17 +79,17 @@ discard block |
||
79 | 79 | function add_form_fields( $fields = array(), $form = array(), $include_parent_field = true ) { |
80 | 80 | |
81 | 81 | foreach ( $fields as $key => $field ) { |
82 | - if( 'password' === $field['type'] ) { |
|
82 | + if ( 'password' === $field[ 'type' ] ) { |
|
83 | 83 | |
84 | 84 | // The Enter Password input |
85 | - if( floor( $key ) === floatval( $key ) ) { |
|
85 | + if ( floor( $key ) === floatval( $key ) ) { |
|
86 | 86 | |
87 | - if( ! empty( $field['parent'] ) ) { |
|
88 | - $field['label'] = $field['parent']->label; |
|
89 | - $field['adminOnly'] = $field['parent']->adminOnly; |
|
90 | - $field['adminLabel'] = $field['parent']->adminLabel; |
|
87 | + if ( ! empty( $field[ 'parent' ] ) ) { |
|
88 | + $field[ 'label' ] = $field[ 'parent' ]->label; |
|
89 | + $field[ 'adminOnly' ] = $field[ 'parent' ]->adminOnly; |
|
90 | + $field[ 'adminLabel' ] = $field[ 'parent' ]->adminLabel; |
|
91 | 91 | // Don't show as a child input |
92 | - unset( $field['parent'] ); |
|
92 | + unset( $field[ 'parent' ] ); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | $fields[ $key ] = $field; |
@@ -38,7 +38,7 @@ |
||
38 | 38 | * @param \GV\Entry $entry The entry. |
39 | 39 | * @param \GV\Request $request The request context. |
40 | 40 | * |
41 | - * @return mixed $value The filtered value. |
|
41 | + * @return string $value The filtered value. |
|
42 | 42 | */ |
43 | 43 | public function get_value( $value, $field, $view, $source, $entry, $request ) { |
44 | 44 | /** Passwords should never be exposed. */ |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | 'slug' => 'edit', |
25 | 25 | 'type' => 'internal', |
26 | 26 | 'label' => __( 'Edit Table', 'gravityview' ), |
27 | - 'description' => __('Display items in a table view.', 'gravityview'), |
|
28 | - 'logo' => plugins_url('includes/presets/default-table/logo-default-table.png', GRAVITYVIEW_FILE), |
|
27 | + 'description' => __( 'Display items in a table view.', 'gravityview' ), |
|
28 | + 'logo' => plugins_url( 'includes/presets/default-table/logo-default-table.png', GRAVITYVIEW_FILE ), |
|
29 | 29 | 'css_source' => gravityview_css_url( 'table-view.css', GRAVITYVIEW_DIR . 'templates/css/' ), |
30 | 30 | ); |
31 | 31 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | '1-1' => array( |
43 | 43 | array( |
44 | 44 | 'areaid' => 'edit-fields', |
45 | - 'title' => __('Visible Edit Fields', 'gravityview' ) |
|
45 | + 'title' => __( 'Visible Edit Fields', 'gravityview' ) |
|
46 | 46 | ) |
47 | 47 | ) |
48 | 48 | ) |
@@ -36,7 +36,6 @@ |
||
36 | 36 | * @since 1.16.4 |
37 | 37 | * @since 1.17 Moved to GravityView_Plugin_Hooks_Gravity_Forms_Survey class |
38 | 38 | * |
39 | - * @param array $form |
|
40 | 39 | * |
41 | 40 | * @return array Form, with all fields set to `allowsPrepopulate => true` |
42 | 41 | */ |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $return = $input_type; |
47 | 47 | |
48 | - if( 'survey' === $field_type ) { |
|
48 | + if ( 'survey' === $field_type ) { |
|
49 | 49 | $return = 'select'; |
50 | 50 | } |
51 | 51 | |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | public function fix_survey_fields( $fields ) { |
66 | 66 | |
67 | 67 | /** @var GF_Field $field */ |
68 | - foreach( $fields as &$field ) { |
|
69 | - if( 'survey' === $field->type ) { |
|
68 | + foreach ( $fields as &$field ) { |
|
69 | + if ( 'survey' === $field->type ) { |
|
70 | 70 | $field->allowsPrepopulate = true; |
71 | 71 | } |
72 | 72 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @return void |
83 | 83 | */ |
84 | 84 | function add_render_hooks() { |
85 | - add_filter( 'gform_field_value', array( $this, 'fix_survey_field_value'), 10, 3 ); |
|
85 | + add_filter( 'gform_field_value', array( $this, 'fix_survey_field_value' ), 10, 3 ); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @return void |
96 | 96 | */ |
97 | 97 | function remove_render_hooks() { |
98 | - remove_filter( 'gform_field_value', array( $this, 'fix_survey_field_value'), 10 ); |
|
98 | + remove_filter( 'gform_field_value', array( $this, 'fix_survey_field_value' ), 10 ); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function fix_survey_field_value( $value, $field, $name ) { |
115 | 115 | |
116 | - if( 'survey' === $field->type ) { |
|
116 | + if ( 'survey' === $field->type ) { |
|
117 | 117 | |
118 | - $entry = GravityView_Edit_Entry::getInstance()->instances['render']->get_entry(); |
|
118 | + $entry = GravityView_Edit_Entry::getInstance()->instances[ 'render' ]->get_entry(); |
|
119 | 119 | |
120 | 120 | // We need to run through each survey row until we find a match for expected values |
121 | 121 | foreach ( $entry as $field_id => $field_value ) { |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | list( $row_val, $col_val ) = explode( ':', $field_value, 2 ); |
129 | 129 | |
130 | 130 | // If the $name matches the $row_val, we are processing the correct row |
131 | - if( $row_val === $name ) { |
|
131 | + if ( $row_val === $name ) { |
|
132 | 132 | $value = $field_value; |
133 | 133 | break; |
134 | 134 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @return void |
31 | 31 | */ |
32 | 32 | private function add_hooks() { |
33 | - add_filter( 'gravityview/edit_entry/field_value_post_custom_field', array( $this, 'edit_entry_field_value'), 10, 2 ); |
|
33 | + add_filter( 'gravityview/edit_entry/field_value_post_custom_field', array( $this, 'edit_entry_field_value' ), 10, 2 ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function edit_entry_field_value( $field_value, $field ) { |
47 | 47 | |
48 | - if( 'list' === $field->inputType ) { |
|
48 | + if ( 'list' === $field->inputType ) { |
|
49 | 49 | $field_value = is_string( $field_value ) ? json_decode( $field_value, true ) : $field_value; |
50 | 50 | |
51 | 51 | if ( ! is_array( $field_value ) ) { |
@@ -12,10 +12,10 @@ |
||
12 | 12 | |
13 | 13 | $field_info_items = array(); |
14 | 14 | |
15 | - if( !empty( $this->item['description'] ) ) { |
|
15 | + if ( ! empty( $this->item[ 'description' ] ) ) { |
|
16 | 16 | |
17 | - $field_info_items[] = array( |
|
18 | - 'value' => $this->item['description'] |
|
17 | + $field_info_items[ ] = array( |
|
18 | + 'value' => $this->item[ 'description' ] |
|
19 | 19 | ); |
20 | 20 | |
21 | 21 | } |
@@ -15,29 +15,29 @@ |
||
15 | 15 | $field_info_items = array(); |
16 | 16 | |
17 | 17 | // Fields with IDs, not like Source URL or Entry ID |
18 | - if( is_numeric( $this->id ) ) { |
|
18 | + if ( is_numeric( $this->id ) ) { |
|
19 | 19 | |
20 | - $field_type_title = GFCommon::get_field_type_title( $this->item['input_type'] ); |
|
20 | + $field_type_title = GFCommon::get_field_type_title( $this->item[ 'input_type' ] ); |
|
21 | 21 | |
22 | - $field_info_items[] = array( |
|
23 | - 'value' => sprintf( __('Type: %s', 'gravityview'), $field_type_title ) |
|
22 | + $field_info_items[ ] = array( |
|
23 | + 'value' => sprintf( __( 'Type: %s', 'gravityview' ), $field_type_title ) |
|
24 | 24 | ); |
25 | 25 | |
26 | - $field_info_items[] = array( |
|
27 | - 'value' => sprintf( __('Field ID: %s', 'gravityview'), $this->id ), |
|
26 | + $field_info_items[ ] = array( |
|
27 | + 'value' => sprintf( __( 'Field ID: %s', 'gravityview' ), $this->id ), |
|
28 | 28 | ); |
29 | 29 | |
30 | 30 | } |
31 | 31 | |
32 | - if( !empty( $this->item['desc'] ) ) { |
|
33 | - $field_info_items[] = array( |
|
34 | - 'value' => $this->item['desc'] |
|
32 | + if ( ! empty( $this->item[ 'desc' ] ) ) { |
|
33 | + $field_info_items[ ] = array( |
|
34 | + 'value' => $this->item[ 'desc' ] |
|
35 | 35 | ); |
36 | 36 | } |
37 | 37 | |
38 | - if( !empty( $this->item['adminLabel'] ) ) { |
|
39 | - $field_info_items[] = array( |
|
40 | - 'value' => sprintf( __('Admin Label: %s', 'gravityview' ), $this->item['adminLabel'] ), |
|
38 | + if ( ! empty( $this->item[ 'adminLabel' ] ) ) { |
|
39 | + $field_info_items[ ] = array( |
|
40 | + 'value' => sprintf( __( 'Admin Label: %s', 'gravityview' ), $this->item[ 'adminLabel' ] ), |
|
41 | 41 | 'class' => 'gv-sublabel' |
42 | 42 | ); |
43 | 43 | } |