@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
24 | 24 | |
25 | - unset( $field_options['search_filter'] ); |
|
25 | + unset( $field_options[ 'search_filter' ] ); |
|
26 | 26 | |
27 | 27 | if ( 'edit' === $context ) { |
28 | 28 | return $field_options; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $add_options = array(); |
34 | 34 | |
35 | 35 | if ( $field->field->inputType === 'likert' && $field->field->gsurveyLikertEnableScoring ) { |
36 | - $add_options['score'] = array( |
|
36 | + $add_options[ 'score' ] = array( |
|
37 | 37 | 'type' => 'checkbox', |
38 | 38 | 'label' => __( 'Show score', 'gravityview' ), |
39 | 39 | 'desc' => __( 'Display likert score as a simple number.', 'gravityview' ), |
@@ -41,7 +41,7 @@ |
||
41 | 41 | * @return string If Gravity Flow not found, or entry not processed yet, returns initial value. Otherwise, returns name of workflow step. |
42 | 42 | */ |
43 | 43 | function modify_entry_value_workflow_current_status_timestamp( $output, $entry, $field_settings, $field ) { |
44 | - $timestamp = gform_get_meta( $entry['id'], 'workflow_current_status_timestamp' ); |
|
44 | + $timestamp = gform_get_meta( $entry[ 'id' ], 'workflow_current_status_timestamp' ); |
|
45 | 45 | |
46 | 46 | if ( ! $timestamp ) { |
47 | 47 | return $timestamp; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | parent::add_hooks(); |
35 | 35 | |
36 | - add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown'), 10, 2 ); |
|
36 | + add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown' ), 10, 2 ); |
|
37 | 37 | |
38 | 38 | add_filter( 'gravityview/admin/available_fields', array( $this, 'maybe_add_non_default_fields' ), 10, 3 ); |
39 | 39 | |
@@ -55,13 +55,13 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public static function get_status_options( $form_id = 0, $status_key = 'workflow_final_status' ) { |
57 | 57 | |
58 | - if( empty( $form_id ) ) { |
|
58 | + if ( empty( $form_id ) ) { |
|
59 | 59 | $form_id = GravityView_View::getInstance()->getFormId(); |
60 | 60 | } |
61 | 61 | |
62 | 62 | $entry_meta = gravity_flow()->get_entry_meta( array(), $form_id ); |
63 | 63 | |
64 | - return (array) \GV\Utils::get( $entry_meta, $status_key . '/filter/choices' ); |
|
64 | + return (array)\GV\Utils::get( $entry_meta, $status_key . '/filter/choices' ); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | $workflow_steps = $GFlow->get_steps(); |
85 | 85 | |
86 | - if( $workflow_steps ) { |
|
86 | + if ( $workflow_steps ) { |
|
87 | 87 | |
88 | 88 | foreach ( $workflow_steps as $step ) { |
89 | 89 | |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | ); |
96 | 96 | } |
97 | 97 | |
98 | - $fields['workflow_step'] = array( |
|
98 | + $fields[ 'workflow_step' ] = array( |
|
99 | 99 | 'label' => esc_html__( 'Workflow Step', 'gravityview' ), |
100 | 100 | 'type' => 'select', |
101 | 101 | ); |
102 | 102 | |
103 | - $fields['workflow_final_status'] = array( |
|
103 | + $fields[ 'workflow_final_status' ] = array( |
|
104 | 104 | 'label' => esc_html__( 'Workflow Status', 'gravityview' ), |
105 | 105 | 'type' => 'select', |
106 | 106 | ); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | if ( ( $insert_at = array_search( 'workflow_final_status', wp_list_pluck( $fields, 'key' ) ) ) !== false ) { |
117 | 117 | $fields_end = array_splice( $fields, $insert_at + 1 ); |
118 | 118 | |
119 | - $fields[] = array( |
|
119 | + $fields[ ] = array( |
|
120 | 120 | 'text' => __( 'Workflow Current Status Timestamp', 'gravityview' ), |
121 | 121 | 'operators' => array( '>', '<' ), |
122 | 122 | 'placeholder' => 'yyyy-mm-dd', |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | $keys_end = array_splice( $keys, $insert_at + 1 ); |
143 | 143 | $values_end = array_splice( $values, $insert_at + 1 ); |
144 | 144 | |
145 | - $keys[] = 'workflow_current_status_timestamp'; |
|
146 | - $values[] = array( |
|
145 | + $keys[ ] = 'workflow_current_status_timestamp'; |
|
146 | + $values[ ] = array( |
|
147 | 147 | 'label' => __( 'Workflow Current Status Timestamp', 'gravityview' ), |
148 | 148 | 'type' => 'workflow_current_status_timestamp', |
149 | 149 | ); |
@@ -47,16 +47,16 @@ |
||
47 | 47 | |
48 | 48 | foreach ( $shortcodes->get_shortcode_information( 'gravitypdf', $content ) as $shortcode ) { |
49 | 49 | // Let's make sure this entry ID is correct for the supplied form |
50 | - $form_id = $wpdb->get_var( $wpdb->prepare( "SELECT form_id FROM $table WHERE display_meta LIKE %s", '%"' . $wpdb->esc_like( $shortcode['attr']['id'] ) . '"%' ) ); |
|
50 | + $form_id = $wpdb->get_var( $wpdb->prepare( "SELECT form_id FROM $table WHERE display_meta LIKE %s", '%"' . $wpdb->esc_like( $shortcode[ 'attr' ][ 'id' ] ) . '"%' ) ); |
|
51 | 51 | |
52 | 52 | // Inject the needed entry ID |
53 | 53 | $replace = str_replace( |
54 | - sprintf( 'entry="%d"', $shortcode['attr']['entry'] ), |
|
55 | - sprintf( 'entry="%d"', $context->entry[ $form_id ]['id'] ), |
|
56 | - $shortcode['shortcode'] |
|
54 | + sprintf( 'entry="%d"', $shortcode[ 'attr' ][ 'entry' ] ), |
|
55 | + sprintf( 'entry="%d"', $context->entry[ $form_id ][ 'id' ] ), |
|
56 | + $shortcode[ 'shortcode' ] |
|
57 | 57 | ); |
58 | 58 | |
59 | - $content = str_replace( $shortcode['shortcode'], $replace, $content ); |
|
59 | + $content = str_replace( $shortcode[ 'shortcode' ], $replace, $content ); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | return $content; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * @see GFCommon::get_field_filter_settings Gravity Forms suggests checkboxes should just be "contains" |
14 | 14 | * @var array |
15 | 15 | */ |
16 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
16 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
17 | 17 | |
18 | 18 | var $is_searchable = true; |
19 | 19 | |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | // Set the $_field_id var |
46 | 46 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ); |
47 | 47 | |
48 | - if( $this->is_choice_value_enabled() ) { |
|
49 | - $field_options['choice_display'] = array( |
|
48 | + if ( $this->is_choice_value_enabled() ) { |
|
49 | + $field_options[ 'choice_display' ] = array( |
|
50 | 50 | 'type' => 'radio', |
51 | 51 | 'value' => 'value', |
52 | 52 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ); |
46 | 46 | |
47 | 47 | // It's not the parent field; it's an input |
48 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
48 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
49 | 49 | |
50 | - if( $this->is_choice_value_enabled() ) { |
|
50 | + if ( $this->is_choice_value_enabled() ) { |
|
51 | 51 | |
52 | 52 | $desc = esc_html__( 'This input has a label and a value. What should be displayed?', 'gravityview' ); |
53 | 53 | $default = 'value'; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | ); |
66 | 66 | } |
67 | 67 | |
68 | - $field_options['choice_display'] = array( |
|
68 | + $field_options[ 'choice_display' ] = array( |
|
69 | 69 | 'type' => 'radio', |
70 | 70 | 'class' => 'vertical', |
71 | 71 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | var $is_searchable = true; |
13 | 13 | |
14 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
14 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
15 | 15 | |
16 | 16 | var $_gf_field_class_name = 'GF_Field_Radio'; |
17 | 17 | |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | // Set the $_field_id var |
41 | 41 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ); |
42 | 42 | |
43 | - if( $this->is_choice_value_enabled() ) { |
|
44 | - $field_options['choice_display'] = array( |
|
43 | + if ( $this->is_choice_value_enabled() ) { |
|
44 | + $field_options[ 'choice_display' ] = array( |
|
45 | 45 | 'type' => 'radio', |
46 | 46 | 'value' => 'value', |
47 | 47 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -44,8 +44,8 @@ |
||
44 | 44 | // Set the $_field_id var |
45 | 45 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ); |
46 | 46 | |
47 | - if( $this->is_choice_value_enabled() ) { |
|
48 | - $field_options['choice_display'] = array( |
|
47 | + if ( $this->is_choice_value_enabled() ) { |
|
48 | + $field_options[ 'choice_display' ] = array( |
|
49 | 49 | 'type' => 'radio', |
50 | 50 | 'value' => 'value', |
51 | 51 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -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,29 +154,29 @@ 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 = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
157 | + $hide_settings_link = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
158 | 158 | $settings_link = sprintf( '<a href="#settings" class="dashicons-admin-generic dashicons %s" title="%s"></a>', $hide_settings_link, esc_attr( $settings_title ) ); |
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 | |
174 | 174 | $output = '<h5 class="selectable gfield field-id-' . esc_attr( $this->id ) . '">'; |
175 | 175 | |
176 | 176 | $label = esc_attr( $label ); |
177 | 177 | |
178 | - if ( ! empty( $this->item['parent'] ) ) { |
|
179 | - $label .= ' <small>(' . esc_attr( $this->item['parent']['label'] ) . ')</small>'; |
|
178 | + if ( ! empty( $this->item[ 'parent' ] ) ) { |
|
179 | + $label .= ' <small>(' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . ')</small>'; |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | // Name of field / widget |
@@ -192,10 +192,10 @@ discard block |
||
192 | 192 | |
193 | 193 | $output .= '</h5>'; |
194 | 194 | |
195 | - $container_class = ! empty( $this->item['parent'] ) ? ' gv-child-field' : ''; |
|
196 | - $data_form_id = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : ''; |
|
195 | + $container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : ''; |
|
196 | + $data_form_id = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : ''; |
|
197 | 197 | |
198 | - $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>'; |
|
198 | + $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 | 199 | |
200 | 200 | return $output; |
201 | 201 | } |