@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | parent::add_hooks(); |
35 | 35 | |
36 | - add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown'), 10, 2 ); |
|
36 | + add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown' ), 10, 2 ); |
|
37 | 37 | |
38 | 38 | add_filter( 'gravityview/admin/available_fields', array( $this, 'maybe_add_non_default_fields' ), 10, 3 ); |
39 | 39 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @return void |
54 | 54 | */ |
55 | 55 | public function clear_cache_after_workflow( $form, $entry_id, $step_id, $starting_step_id ) { |
56 | - do_action( 'gravityview_clear_form_cache', $form['id'] ); |
|
56 | + do_action( 'gravityview_clear_form_cache', $form[ 'id' ] ); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public static function get_status_options( $form_id = 0, $status_key = 'workflow_final_status' ) { |
72 | 72 | |
73 | - if( empty( $form_id ) ) { |
|
73 | + if ( empty( $form_id ) ) { |
|
74 | 74 | $form_id = GravityView_View::getInstance()->getFormId(); |
75 | 75 | } |
76 | 76 | |
77 | 77 | $entry_meta = gravity_flow()->get_entry_meta( array(), $form_id ); |
78 | 78 | |
79 | - return (array) \GV\Utils::get( $entry_meta, $status_key . '/filter/choices' ); |
|
79 | + return (array)\GV\Utils::get( $entry_meta, $status_key . '/filter/choices' ); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | $workflow_steps = $GFlow->get_steps(); |
100 | 100 | |
101 | - if( $workflow_steps ) { |
|
101 | + if ( $workflow_steps ) { |
|
102 | 102 | |
103 | 103 | foreach ( $workflow_steps as $step ) { |
104 | 104 | |
@@ -110,12 +110,12 @@ discard block |
||
110 | 110 | ); |
111 | 111 | } |
112 | 112 | |
113 | - $fields['workflow_step'] = array( |
|
113 | + $fields[ 'workflow_step' ] = array( |
|
114 | 114 | 'label' => esc_html__( 'Workflow Step', 'gravityview' ), |
115 | 115 | 'type' => 'select', |
116 | 116 | ); |
117 | 117 | |
118 | - $fields['workflow_final_status'] = array( |
|
118 | + $fields[ 'workflow_final_status' ] = array( |
|
119 | 119 | 'label' => esc_html__( 'Workflow Status', 'gravityview' ), |
120 | 120 | 'type' => 'select', |
121 | 121 | ); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | if ( ( $insert_at = array_search( 'workflow_final_status', wp_list_pluck( $fields, 'key' ) ) ) !== false ) { |
132 | 132 | $fields_end = array_splice( $fields, $insert_at + 1 ); |
133 | 133 | |
134 | - $fields[] = array( |
|
134 | + $fields[ ] = array( |
|
135 | 135 | 'text' => __( 'Workflow Current Status Timestamp', 'gravityview' ), |
136 | 136 | 'operators' => array( '>', '<' ), |
137 | 137 | 'placeholder' => 'yyyy-mm-dd', |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | $keys_end = array_splice( $keys, $insert_at + 1 ); |
158 | 158 | $values_end = array_splice( $values, $insert_at + 1 ); |
159 | 159 | |
160 | - $keys[] = 'workflow_current_status_timestamp'; |
|
161 | - $values[] = array( |
|
160 | + $keys[ ] = 'workflow_current_status_timestamp'; |
|
161 | + $values[ ] = array( |
|
162 | 162 | 'label' => __( 'Workflow Current Status Timestamp', 'gravityview' ), |
163 | 163 | 'type' => 'workflow_current_status_timestamp', |
164 | 164 | ); |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | 'class' => '', |
44 | 44 | ) ); |
45 | 45 | |
46 | - if ( ! $view_id = $atts['id'] ? : $atts['view_id'] ) { |
|
47 | - if ( $atts['detail'] && $view = $request->is_view() ) { |
|
46 | + if ( ! $view_id = $atts[ 'id' ] ?: $atts[ 'view_id' ] ) { |
|
47 | + if ( $atts[ 'detail' ] && $view = $request->is_view() ) { |
|
48 | 48 | $view_id = $view->ID; |
49 | 49 | } |
50 | 50 | } |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
117 | - $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID ); |
|
117 | + $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID ); |
|
118 | 118 | |
119 | 119 | /** |
120 | 120 | * View details. |
121 | 121 | */ |
122 | - if ( $atts['detail'] ) { |
|
122 | + if ( $atts[ 'detail' ] ) { |
|
123 | 123 | $entries = $view->get_entries( $request ); |
124 | 124 | return self::_return( $this->detail( $view, $entries, $atts ) ); |
125 | 125 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | return self::_return( '' ); |
137 | 137 | } |
138 | 138 | |
139 | - if ( $entry['status'] != 'active' ) { |
|
139 | + if ( $entry[ 'status' ] != 'active' ) { |
|
140 | 140 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
141 | 141 | return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) ); |
142 | 142 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } |
148 | 148 | |
149 | 149 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
150 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
150 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
151 | 151 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
152 | 152 | return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) ); |
153 | 153 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $entryset = $entry->is_multi() ? $entry->entries : array( $entry ); |
171 | 171 | |
172 | 172 | foreach ( $entryset as $e ) { |
173 | - if ( $e['status'] != 'active' ) { |
|
173 | + if ( $e[ 'status' ] != 'active' ) { |
|
174 | 174 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $e->ID ) ); |
175 | 175 | return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) ); |
176 | 176 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | } |
182 | 182 | |
183 | 183 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
184 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
184 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
185 | 185 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $e->ID ) ); |
186 | 186 | return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) ); |
187 | 187 | } |
@@ -206,10 +206,10 @@ discard block |
||
206 | 206 | |
207 | 207 | // Mock the request with the actual View, not the global one |
208 | 208 | $mock_request = new \GV\Mock_Request(); |
209 | - $mock_request->returns['is_view'] = $view; |
|
210 | - $mock_request->returns['is_entry'] = $request->is_entry( $view->form ? $view->form->ID : 0 ); |
|
211 | - $mock_request->returns['is_edit_entry'] = $request->is_edit_entry( $view->form ? $view->form->ID : 0 ); |
|
212 | - $mock_request->returns['is_search'] = $request->is_search(); |
|
209 | + $mock_request->returns[ 'is_view' ] = $view; |
|
210 | + $mock_request->returns[ 'is_entry' ] = $request->is_entry( $view->form ? $view->form->ID : 0 ); |
|
211 | + $mock_request->returns[ 'is_edit_entry' ] = $request->is_edit_entry( $view->form ? $view->form->ID : 0 ); |
|
212 | + $mock_request->returns[ 'is_search' ] = $request->is_search(); |
|
213 | 213 | |
214 | 214 | $request = $mock_request; |
215 | 215 | } |
@@ -245,16 +245,16 @@ discard block |
||
245 | 245 | $filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' ); |
246 | 246 | |
247 | 247 | // Only keep the passed attributes after making sure that they're valid pairs |
248 | - $filtered_atts = array_intersect_key( (array) $passed_atts, $filtered_atts ); |
|
248 | + $filtered_atts = array_intersect_key( (array)$passed_atts, $filtered_atts ); |
|
249 | 249 | |
250 | 250 | $atts = array(); |
251 | 251 | |
252 | - foreach( $filtered_atts as $key => $passed_value ) { |
|
252 | + foreach ( $filtered_atts as $key => $passed_value ) { |
|
253 | 253 | |
254 | 254 | // Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by} |
255 | 255 | $passed_value = \GravityView_Merge_Tags::replace_variables( $passed_value ); |
256 | 256 | |
257 | - switch( $defaults[ $key ]['type'] ) { |
|
257 | + switch ( $defaults[ $key ][ 'type' ] ) { |
|
258 | 258 | |
259 | 259 | /** |
260 | 260 | * Make sure number fields are numeric. |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @see http://php.net/manual/en/function.is-numeric.php#107326 |
263 | 263 | */ |
264 | 264 | case 'number': |
265 | - if( is_numeric( $passed_value ) ) { |
|
265 | + if ( is_numeric( $passed_value ) ) { |
|
266 | 266 | $atts[ $key ] = ( $passed_value + 0 ); |
267 | 267 | } |
268 | 268 | break; |
@@ -277,8 +277,8 @@ discard block |
||
277 | 277 | */ |
278 | 278 | case 'select': |
279 | 279 | case 'radio': |
280 | - $options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options']; |
|
281 | - if( in_array( $passed_value, array_keys( $options ) ) ) { |
|
280 | + $options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ]; |
|
281 | + if ( in_array( $passed_value, array_keys( $options ) ) ) { |
|
282 | 282 | $atts[ $key ] = $passed_value; |
283 | 283 | } |
284 | 284 | break; |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | } |
291 | 291 | } |
292 | 292 | |
293 | - $atts['detail'] = \GV\Utils::get( $passed_atts, 'detail', null ); |
|
293 | + $atts[ 'detail' ] = \GV\Utils::get( $passed_atts, 'detail', null ); |
|
294 | 294 | |
295 | 295 | return $atts; |
296 | 296 | } |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | private function detail( $view, $entries, $atts ) { |
308 | 308 | $output = ''; |
309 | 309 | |
310 | - switch ( $key = $atts['detail'] ): |
|
310 | + switch ( $key = $atts[ 'detail' ] ): |
|
311 | 311 | case 'total_entries': |
312 | 312 | $output = number_format_i18n( $entries->total() ); |
313 | 313 | break; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function set_provider( $provider = null ) { |
40 | 40 | |
41 | - if( gravityview()->request->is_admin() ) { |
|
41 | + if ( gravityview()->request->is_admin() ) { |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | // We're switching providers; remove the hooks that were added. |
60 | - if( self::$active_provider ) { |
|
60 | + if ( self::$active_provider ) { |
|
61 | 61 | self::$active_provider->remove_hooks(); |
62 | 62 | } |
63 | 63 |
@@ -21,13 +21,13 @@ |
||
21 | 21 | $plugin_hooks_files = glob( $include_path . 'class-gravityview-plugin-hooks-*.php' ); |
22 | 22 | |
23 | 23 | // Load all plugin files automatically |
24 | -foreach ( (array) $plugin_hooks_files as $plugin_hooks_file ) { |
|
24 | +foreach ( (array)$plugin_hooks_files as $plugin_hooks_file ) { |
|
25 | 25 | include $plugin_hooks_file; |
26 | 26 | } |
27 | 27 | |
28 | 28 | $theme_hooks_files = glob( $include_path . 'class-gravityview-theme-hooks-*.php' ); |
29 | 29 | |
30 | 30 | // Load all theme files automatically |
31 | -foreach ( (array) $theme_hooks_files as $theme_hooks_file ) { |
|
31 | +foreach ( (array)$theme_hooks_files as $theme_hooks_file ) { |
|
32 | 32 | include $theme_hooks_file; |
33 | 33 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | add_filter( 'icl_ls_languages', array( $this, 'wpml_ls_filter' ) ); |
66 | 66 | |
67 | - add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link') ); |
|
67 | + add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link' ) ); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | function filter_gravityview_back_link( $link ) { |
85 | 85 | global $wpml_url_filters; |
86 | 86 | |
87 | - if( $wpml_url_filters ) { |
|
87 | + if ( $wpml_url_filters ) { |
|
88 | 88 | $link = $wpml_url_filters->permalink_filter( $link, GravityView_frontend::getInstance()->getPostId() ); |
89 | 89 | } |
90 | 90 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | private function remove_url_hooks() { |
102 | 102 | global $wpml_url_filters; |
103 | 103 | |
104 | - if( ! $wpml_url_filters ) { |
|
104 | + if ( ! $wpml_url_filters ) { |
|
105 | 105 | return; |
106 | 106 | } |
107 | 107 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | private function add_url_hooks() { |
130 | 130 | global $wpml_url_filters; |
131 | 131 | |
132 | - if( ! $wpml_url_filters ) { |
|
132 | + if ( ! $wpml_url_filters ) { |
|
133 | 133 | return; |
134 | 134 | } |
135 | 135 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | break; |
227 | 227 | } |
228 | 228 | |
229 | - $languages[ $lang_code ]['url'] = $entry_link; |
|
229 | + $languages[ $lang_code ][ 'url' ] = $entry_link; |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | $this->add_url_hooks(); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | add_filter( 'gravityview/sorting/time', array( $this, 'modify_sort_id' ), 10, 2 ); |
64 | 64 | |
65 | - add_filter('gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 ); |
|
65 | + add_filter( 'gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 ); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -103,35 +103,35 @@ discard block |
||
103 | 103 | public function _maybe_filter_gravity_forms_query( $criteria, $form_ids, $view_id ) { |
104 | 104 | |
105 | 105 | // If the search is not being sorted, return early |
106 | - if( empty( $criteria['sorting']['key'] ) ) { |
|
106 | + if ( empty( $criteria[ 'sorting' ][ 'key' ] ) ) { |
|
107 | 107 | return $criteria; |
108 | 108 | } |
109 | 109 | |
110 | - $pieces = explode( $this->_sort_divider, $criteria['sorting']['key'] ); |
|
110 | + $pieces = explode( $this->_sort_divider, $criteria[ 'sorting' ][ 'key' ] ); |
|
111 | 111 | |
112 | 112 | /** |
113 | 113 | * If the sort key does not match the key set in modify_sort_id(), do not modify the Gravity Forms query SQL |
114 | 114 | * @see modify_sort_id() |
115 | 115 | */ |
116 | - if( empty( $pieces[1] ) ) { |
|
116 | + if ( empty( $pieces[ 1 ] ) ) { |
|
117 | 117 | return $criteria; |
118 | 118 | } |
119 | 119 | |
120 | 120 | // Pass these to the _modify_query_sort_by_time_hack() method |
121 | - $this->_time_format = $pieces[1]; |
|
122 | - $this->_date_format = $pieces[2]; |
|
121 | + $this->_time_format = $pieces[ 1 ]; |
|
122 | + $this->_date_format = $pieces[ 2 ]; |
|
123 | 123 | |
124 | 124 | // Remove fake input IDs (5.1 doesn't exist. Use 5) |
125 | - $criteria['sorting']['key'] = floor( $pieces[0] ); |
|
125 | + $criteria[ 'sorting' ][ 'key' ] = floor( $pieces[ 0 ] ); |
|
126 | 126 | |
127 | 127 | /** |
128 | 128 | * Make sure sorting is numeric (# of seconds). IMPORTANT. |
129 | 129 | * @see GVCommon::is_field_numeric() is_numeric should also be set here |
130 | 130 | */ |
131 | - $criteria['sorting']['is_numeric'] = true; |
|
131 | + $criteria[ 'sorting' ][ 'is_numeric' ] = true; |
|
132 | 132 | |
133 | 133 | // Modify the Gravity Forms WP Query |
134 | - add_filter('query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
134 | + add_filter( 'query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
135 | 135 | |
136 | 136 | return $criteria; |
137 | 137 | } |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | * then we want to modify the query. |
153 | 153 | * @see GFFormsModel::sort_by_field_query() |
154 | 154 | */ |
155 | - if( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
155 | + if ( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
156 | 156 | |
157 | - if( $this->_time_format === '24' ) { |
|
157 | + if ( $this->_time_format === '24' ) { |
|
158 | 158 | $sql_str_to_date = "STR_TO_DATE( `value`, '%H:%i' )"; |
159 | 159 | } else { |
160 | 160 | $sql_str_to_date = "STR_TO_DATE( `value`, '%h:%i %p' )"; |
@@ -200,18 +200,18 @@ discard block |
||
200 | 200 | // Set variables |
201 | 201 | parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ); |
202 | 202 | |
203 | - if( 'edit' === $context ) { |
|
203 | + if ( 'edit' === $context ) { |
|
204 | 204 | return $field_options; |
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
208 | 208 | * Set default date format based on field ID and Form ID |
209 | 209 | */ |
210 | - add_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
210 | + add_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
211 | 211 | |
212 | - $this->add_field_support('date_display', $field_options ); |
|
212 | + $this->add_field_support( 'date_display', $field_options ); |
|
213 | 213 | |
214 | - remove_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
214 | + remove_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
215 | 215 | |
216 | 216 | return $field_options; |
217 | 217 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | private function _get_time_format() { |
227 | 227 | global $post; |
228 | 228 | |
229 | - $current_form = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : gravityview_get_form_id( $post->ID ); |
|
229 | + $current_form = isset( $_POST[ 'form_id' ] ) ? intval( $_POST[ 'form_id' ] ) : gravityview_get_form_id( $post->ID ); |
|
230 | 230 | |
231 | 231 | return self::_get_time_format_for_field( $this->_field_id, $current_form ); |
232 | 232 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | // GF defaults to 12, so should we. |
246 | 246 | $time_format = '12'; |
247 | 247 | |
248 | - if( $form_id ) { |
|
248 | + if ( $form_id ) { |
|
249 | 249 | $form = GFAPI::get_form( $form_id ); |
250 | 250 | |
251 | 251 | if ( $form ) { |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $default = 'h:i A'; |
293 | 293 | |
294 | 294 | // This doesn't take into account 24-hour |
295 | - switch( $field_input_id ) { |
|
295 | + switch ( $field_input_id ) { |
|
296 | 296 | // Hours |
297 | 297 | case 1: |
298 | 298 | return ( $time_format === '12' ) ? 'h' : 'H'; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | function edit_entry_fix_hidden_fields( $fields ) { |
50 | 50 | |
51 | 51 | /** @type GF_Field $field */ |
52 | - foreach( $fields as &$field ) { |
|
52 | + foreach ( $fields as &$field ) { |
|
53 | 53 | |
54 | 54 | if ( 'hidden' === $field->type ) { |
55 | 55 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | $reveal_hidden_field = apply_filters( 'gravityview/edit_entry/reveal_hidden_field', false, $field ); |
64 | 64 | |
65 | - if( ! $reveal_hidden_field ) { |
|
65 | + if ( ! $reveal_hidden_field ) { |
|
66 | 66 | continue; |
67 | 67 | } |
68 | 68 |
@@ -50,7 +50,7 @@ |
||
50 | 50 | public function edit_entry_fix_uid_fields( $fields ) { |
51 | 51 | |
52 | 52 | /** @type \GF_Field $field */ |
53 | - foreach( $fields as &$field ) { |
|
53 | + foreach ( $fields as &$field ) { |
|
54 | 54 | if ( 'uid' === $field->type ) { |
55 | 55 | |
56 | 56 | // Replace GF_Field with GF_Field_Text, copying all the data from $field |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * @return \GV\Field The field implementation from configuration (\GV\GF_Field, \GV\Internal_Field). |
167 | 167 | */ |
168 | 168 | public static function from_configuration( $configuration ) { |
169 | - if ( empty( $configuration['id'] ) ) { |
|
169 | + if ( empty( $configuration[ 'id' ] ) ) { |
|
170 | 170 | $field = new self(); |
171 | 171 | gravityview()->log->error( 'Trying to get field from configuration without a field ID.', array( 'data' => $configuration ) ); |
172 | 172 | $field->update_configuration( $configuration ); |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | } else { |
180 | 180 | $trace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ); |
181 | 181 | } |
182 | - $trace = $trace[1]; |
|
183 | - if ( $trace['function'] == 'from_configuration' && $trace['class'] == __CLASS__ ) { |
|
182 | + $trace = $trace[ 1 ]; |
|
183 | + if ( $trace[ 'function' ] == 'from_configuration' && $trace[ 'class' ] == __CLASS__ ) { |
|
184 | 184 | $field = new self(); |
185 | 185 | gravityview()->log->error( 'Infinite loop protection tripped. Returning default class here.' ); |
186 | 186 | $field->update_configuration( $configuration ); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | } |
189 | 189 | |
190 | 190 | /** @type \GV\GF_Field|\GV\Internal_Field $field_class Determine the field implementation to use, and try to use. */ |
191 | - $field_class = is_numeric( $configuration['id'] ) ? '\GV\GF_Field' : '\GV\Internal_Field'; |
|
191 | + $field_class = is_numeric( $configuration[ 'id' ] ) ? '\GV\GF_Field' : '\GV\Internal_Field'; |
|
192 | 192 | |
193 | 193 | /** |
194 | 194 | * @filter `gravityview/field/class` Filter the field class about to be created from the configuration. |
@@ -227,24 +227,24 @@ discard block |
||
227 | 227 | public function update_configuration( $configuration ) { |
228 | 228 | $configuration = wp_parse_args( $configuration, $this->as_configuration() ); |
229 | 229 | |
230 | - if ( $this->ID != $configuration['id'] ) { |
|
230 | + if ( $this->ID != $configuration[ 'id' ] ) { |
|
231 | 231 | /** Smelling trouble here... */ |
232 | 232 | gravityview()->log->warning( 'ID is being changed for {field_class} instance, but implementation is not. Use ::from_configuration instead', array( 'field_class', __CLASS__ ) ); |
233 | 233 | } |
234 | 234 | |
235 | - $this->ID = $configuration['id']; |
|
236 | - $this->label = $configuration['label']; |
|
237 | - $this->show_label = $configuration['show_label'] == '1'; |
|
238 | - $this->custom_label = $configuration['custom_label']; |
|
239 | - $this->custom_class = $configuration['custom_class']; |
|
240 | - $this->cap = $configuration['only_loggedin'] == '1' ? $configuration['only_loggedin_cap'] : ''; |
|
241 | - $this->search_filter = $configuration['search_filter'] == '1'; |
|
242 | - $this->show_as_link = $configuration['show_as_link'] == '1'; |
|
235 | + $this->ID = $configuration[ 'id' ]; |
|
236 | + $this->label = $configuration[ 'label' ]; |
|
237 | + $this->show_label = $configuration[ 'show_label' ] == '1'; |
|
238 | + $this->custom_label = $configuration[ 'custom_label' ]; |
|
239 | + $this->custom_class = $configuration[ 'custom_class' ]; |
|
240 | + $this->cap = $configuration[ 'only_loggedin' ] == '1' ? $configuration[ 'only_loggedin_cap' ] : ''; |
|
241 | + $this->search_filter = $configuration[ 'search_filter' ] == '1'; |
|
242 | + $this->show_as_link = $configuration[ 'show_as_link' ] == '1'; |
|
243 | 243 | |
244 | 244 | /** Shared among all field types (sort of). */ |
245 | 245 | $shared_configuration_keys = array( |
246 | 246 | 'id', 'label', 'show_label', 'custom_label', 'custom_class', |
247 | - 'only_loggedin' ,'only_loggedin_cap', 'search_filter', 'show_as_link', |
|
247 | + 'only_loggedin', 'only_loggedin_cap', 'search_filter', 'show_as_link', |
|
248 | 248 | ); |
249 | 249 | |
250 | 250 | /** Everything else goes into the properties for now. @todo subclasses! */ |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | |
274 | 274 | /** A custom label is available. */ |
275 | 275 | if ( ! empty( $this->custom_label ) ) { |
276 | - return \GravityView_API::replace_variables( $this->custom_label, $source ? $source->form ? : null : null, $entry ? $entry->as_entry() : null ); |
|
276 | + return \GravityView_API::replace_variables( $this->custom_label, $source ? $source->form ?: null : null, $entry ? $entry->as_entry() : null ); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | return ''; |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | * @return mixed|null The value for the given configuration key, null if doesn't exist. |
360 | 360 | */ |
361 | 361 | public function __get( $key ) { |
362 | - switch( $key ) { |
|
362 | + switch ( $key ) { |
|
363 | 363 | default: |
364 | 364 | if ( isset( $this->configuration[ $key ] ) ) { |
365 | 365 | return $this->configuration[ $key ]; |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | * @return boolean Whether this $key is set or not. |
378 | 378 | */ |
379 | 379 | public function __isset( $key ) { |
380 | - switch( $key ) { |
|
380 | + switch ( $key ) { |
|
381 | 381 | default: |
382 | 382 | return isset( $this->configuration[ $key ] ); |
383 | 383 | } |