@@ -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(); |
@@ -134,17 +134,17 @@ discard block |
||
134 | 134 | |
135 | 135 | add_filter( 'gravityview/sortable/field_blacklist', array( $this, '_filter_sortable_fields' ), 1 ); |
136 | 136 | |
137 | - if( $this->entry_meta_key ) { |
|
137 | + if ( $this->entry_meta_key ) { |
|
138 | 138 | add_filter( 'gform_entry_meta', array( $this, 'add_entry_meta' ) ); |
139 | 139 | add_filter( 'gravityview/common/sortable_fields', array( $this, 'add_sortable_field' ), 10, 2 ); |
140 | 140 | } |
141 | 141 | |
142 | - if( $this->_custom_merge_tag ) { |
|
142 | + if ( $this->_custom_merge_tag ) { |
|
143 | 143 | add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 ); |
144 | 144 | add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 ); |
145 | 145 | } |
146 | 146 | |
147 | - if( 'meta' === $this->group || '' !== $this->default_search_label ) { |
|
147 | + if ( 'meta' === $this->group || '' !== $this->default_search_label ) { |
|
148 | 148 | add_filter( 'gravityview_search_field_label', array( $this, 'set_default_search_label' ), 10, 3 ); |
149 | 149 | } |
150 | 150 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * Auto-assign label from Gravity Forms label, if exists |
153 | 153 | * @since 1.20 |
154 | 154 | */ |
155 | - if( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) { |
|
155 | + if ( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) { |
|
156 | 156 | $this->label = ucfirst( GF_Fields::get( $this->name )->get_form_editor_field_title() ); |
157 | 157 | } |
158 | 158 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | 'type' => $this->name |
180 | 180 | ); |
181 | 181 | |
182 | - $fields["{$this->entry_meta_key}"] = $added_field; |
|
182 | + $fields[ "{$this->entry_meta_key}" ] = $added_field; |
|
183 | 183 | |
184 | 184 | return $fields; |
185 | 185 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | */ |
200 | 200 | function set_default_search_label( $label = '', $gf_field = null, $field = array() ) { |
201 | 201 | |
202 | - if( $this->name === $field['field'] && '' === $label ) { |
|
202 | + if ( $this->name === $field[ 'field' ] && '' === $label ) { |
|
203 | 203 | $label = esc_html( $this->default_search_label ); |
204 | 204 | } |
205 | 205 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text. |
222 | 222 | */ |
223 | - public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
223 | + public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
224 | 224 | |
225 | 225 | // Is there is field merge tag? Strip whitespace off the ned, too. |
226 | 226 | preg_match_all( '/{' . preg_quote( $this->_custom_merge_tag ) . ':?(.*?)(?:\s)?}/ism', $text, $matches, PREG_SET_ORDER ); |
@@ -253,19 +253,19 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
255 | 255 | |
256 | - foreach( $matches as $match ) { |
|
256 | + foreach ( $matches as $match ) { |
|
257 | 257 | |
258 | - $full_tag = $match[0]; |
|
258 | + $full_tag = $match[ 0 ]; |
|
259 | 259 | |
260 | 260 | // Strip the Merge Tags |
261 | - $tag = str_replace( array( '{', '}'), '', $full_tag ); |
|
261 | + $tag = str_replace( array( '{', '}' ), '', $full_tag ); |
|
262 | 262 | |
263 | 263 | // Replace the value from the entry, if exists |
264 | - if( isset( $entry[ $tag ] ) ) { |
|
264 | + if ( isset( $entry[ $tag ] ) ) { |
|
265 | 265 | |
266 | 266 | $value = $entry[ $tag ]; |
267 | 267 | |
268 | - if( is_callable( array( $this, 'get_content') ) ) { |
|
268 | + if ( is_callable( array( $this, 'get_content' ) ) ) { |
|
269 | 269 | $value = $this->get_content( $value ); |
270 | 270 | } |
271 | 271 | |
@@ -338,8 +338,8 @@ discard block |
||
338 | 338 | */ |
339 | 339 | public function _filter_sortable_fields( $not_sortable ) { |
340 | 340 | |
341 | - if( ! $this->is_sortable ) { |
|
342 | - $not_sortable[] = $this->name; |
|
341 | + if ( ! $this->is_sortable ) { |
|
342 | + $not_sortable[ ] = $this->name; |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | return $not_sortable; |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | */ |
357 | 357 | function add_entry_meta( $entry_meta ) { |
358 | 358 | |
359 | - if( ! isset( $entry_meta["{$this->entry_meta_key}"] ) ) { |
|
359 | + if ( ! isset( $entry_meta[ "{$this->entry_meta_key}" ] ) ) { |
|
360 | 360 | |
361 | 361 | $added_meta = array( |
362 | 362 | 'label' => $this->label, |
@@ -365,13 +365,13 @@ discard block |
||
365 | 365 | ); |
366 | 366 | |
367 | 367 | if ( $this->entry_meta_update_callback && is_callable( $this->entry_meta_update_callback ) ) { |
368 | - $added_meta['update_entry_meta_callback'] = $this->entry_meta_update_callback; |
|
368 | + $added_meta[ 'update_entry_meta_callback' ] = $this->entry_meta_update_callback; |
|
369 | 369 | } |
370 | 370 | |
371 | - $entry_meta["{$this->entry_meta_key}"] = $added_meta; |
|
371 | + $entry_meta[ "{$this->entry_meta_key}" ] = $added_meta; |
|
372 | 372 | |
373 | 373 | } else { |
374 | - gravityview()->log->error( 'Entry meta already set: {meta_key}', array( 'meta_key' => $this->entry_meta_key, 'data' => $entry_meta["{$this->entry_meta_key}"] ) ); |
|
374 | + gravityview()->log->error( 'Entry meta already set: {meta_key}', array( 'meta_key' => $this->entry_meta_key, 'data' => $entry_meta[ "{$this->entry_meta_key}" ] ) ); |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | return $entry_meta; |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | 'date_display' => array( |
401 | 401 | 'type' => 'text', |
402 | 402 | 'label' => __( 'Override Date Format', 'gravityview' ), |
403 | - 'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview'), '<a href="https://wordpress.org/support/article/formatting-date-and-time/" rel="external">', '</a>' ), |
|
403 | + 'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview' ), '<a href="https://wordpress.org/support/article/formatting-date-and-time/" rel="external">', '</a>' ), |
|
404 | 404 | /** |
405 | 405 | * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time) |
406 | 406 | * @param[in,out] null|string $date_format Date Format (default: null) |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | |
427 | 427 | $options = $this->field_support_options(); |
428 | 428 | |
429 | - if( isset( $options[ $key ] ) ) { |
|
429 | + if ( isset( $options[ $key ] ) ) { |
|
430 | 430 | $field_options[ $key ] = $options[ $key ]; |
431 | 431 | } |
432 | 432 | |
@@ -490,11 +490,11 @@ discard block |
||
490 | 490 | $connected_form = \GV\Utils::_POST( 'form_id' ); |
491 | 491 | |
492 | 492 | // Otherwise, get the Form ID from the Post page |
493 | - if( empty( $connected_form ) ) { |
|
493 | + if ( empty( $connected_form ) ) { |
|
494 | 494 | $connected_form = gravityview_get_form_id( get_the_ID() ); |
495 | 495 | } |
496 | 496 | |
497 | - if( empty( $connected_form ) ) { |
|
497 | + if ( empty( $connected_form ) ) { |
|
498 | 498 | gravityview()->log->error( 'Form not found for form ID "{form_id}"', array( 'form_id' => $connected_form ) ); |
499 | 499 | return false; |
500 | 500 | } |
@@ -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'; |
@@ -505,8 +505,8 @@ discard block |
||
505 | 505 | */ |
506 | 506 | private function get_php_version() { |
507 | 507 | |
508 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ? |
|
509 | - $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion(); |
|
508 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] ) ? |
|
509 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] : phpversion(); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | /** |
@@ -518,8 +518,8 @@ discard block |
||
518 | 518 | */ |
519 | 519 | private function get_wordpress_version() { |
520 | 520 | |
521 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ? |
|
522 | - $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version']; |
|
521 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] ) ? |
|
522 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] : $GLOBALS[ 'wp_version' ]; |
|
523 | 523 | } |
524 | 524 | |
525 | 525 | /** |
@@ -531,14 +531,14 @@ discard block |
||
531 | 531 | */ |
532 | 532 | private function get_gravityforms_version() { |
533 | 533 | |
534 | - if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) { |
|
534 | + if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE' ] ) ) { |
|
535 | 535 | gravityview()->log->error( 'Gravity Forms is inactive or not installed.' ); |
536 | 536 | |
537 | 537 | return null; |
538 | 538 | } |
539 | 539 | |
540 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ? |
|
541 | - $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version; |
|
540 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] ) ? |
|
541 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] : \GFCommon::$version; |
|
542 | 542 | } |
543 | 543 | |
544 | 544 | /** |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | $items = get_posts( array( |
585 | 585 | 'post_type' => 'gravityview', |
586 | 586 | 'post_status' => 'any', |
587 | - 'numberposts' => - 1, |
|
587 | + 'numberposts' => -1, |
|
588 | 588 | 'fields' => 'ids', |
589 | 589 | ) ); |
590 | 590 | |
@@ -598,9 +598,9 @@ discard block |
||
598 | 598 | $tables = array(); |
599 | 599 | |
600 | 600 | if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) ) { |
601 | - $tables [] = \GFFormsModel::get_entry_meta_table_name(); |
|
601 | + $tables [ ] = \GFFormsModel::get_entry_meta_table_name(); |
|
602 | 602 | } elseif ( ! $this->is_GF_25() ) { |
603 | - $tables [] = \GFFormsModel::get_lead_meta_table_name(); |
|
603 | + $tables [ ] = \GFFormsModel::get_lead_meta_table_name(); |
|
604 | 604 | } |
605 | 605 | |
606 | 606 | foreach ( $tables as $meta_table ) { |
@@ -619,9 +619,9 @@ discard block |
||
619 | 619 | $tables = array(); |
620 | 620 | |
621 | 621 | if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) { |
622 | - $tables[] = \GFFormsModel::get_entry_notes_table_name(); |
|
622 | + $tables[ ] = \GFFormsModel::get_entry_notes_table_name(); |
|
623 | 623 | } elseif ( ! $this->is_GF_25() ) { |
624 | - $tables[] = \GFFormsModel::get_lead_notes_table_name(); |
|
624 | + $tables[ ] = \GFFormsModel::get_lead_notes_table_name(); |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | $disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' ); |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @return array Blacklist, with "total" added. If not edit context, original field blacklist. Otherwise, blacklist including total. |
52 | 52 | */ |
53 | - public function add_to_blacklist( $blacklist = array(), $context = NULL ){ |
|
53 | + public function add_to_blacklist( $blacklist = array(), $context = NULL ) { |
|
54 | 54 | |
55 | - if( empty( $context ) || $context !== 'edit' ) { |
|
55 | + if ( empty( $context ) || $context !== 'edit' ) { |
|
56 | 56 | return $blacklist; |
57 | 57 | } |
58 | 58 | |
59 | - $blacklist[] = 'total'; |
|
59 | + $blacklist[ ] = 'total'; |
|
60 | 60 | |
61 | 61 | return $blacklist; |
62 | 62 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | function edit_entry_recalculate_totals( $form = array(), $entry_id = 0, $Edit_Entry_Render = null ) { |
76 | 76 | |
77 | - $original_form = GFAPI::get_form( $form['id'] ); |
|
77 | + $original_form = GFAPI::get_form( $form[ 'id' ] ); |
|
78 | 78 | |
79 | 79 | $total_fields = GFCommon::get_fields_by_type( $original_form, 'total' ); |
80 | 80 | |
@@ -85,12 +85,12 @@ discard block |
||
85 | 85 | |
86 | 86 | /** @type GF_Field_Total $total_field */ |
87 | 87 | foreach ( $total_fields as $total_field ) { |
88 | - $entry["{$total_field->id}"] = GFCommon::get_order_total( $original_form, $entry ); |
|
88 | + $entry[ "{$total_field->id}" ] = GFCommon::get_order_total( $original_form, $entry ); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | $return_entry = GFAPI::update_entry( $entry ); |
92 | 92 | |
93 | - if( is_wp_error( $return_entry ) ) { |
|
93 | + if ( is_wp_error( $return_entry ) ) { |
|
94 | 94 | gravityview()->log->error( 'Updating the entry total fields failed', array( 'data' => $return_entry ) ); |
95 | 95 | } else { |
96 | 96 | gravityview()->log->debug( 'Updating the entry total fields succeeded' ); |
@@ -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 | } |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | function update_priority() { |
53 | 53 | global $wp_meta_boxes; |
54 | 54 | |
55 | - if ( ! empty( $wp_meta_boxes['gravityview'] ) ) { |
|
55 | + if ( ! empty( $wp_meta_boxes[ 'gravityview' ] ) ) { |
|
56 | 56 | foreach ( array( 'high', 'core', 'low' ) as $position ) { |
57 | - if ( isset( $wp_meta_boxes['gravityview']['normal'][ $position ] ) ) { |
|
58 | - foreach ( $wp_meta_boxes['gravityview']['normal'][ $position ] as $key => $meta_box ) { |
|
57 | + if ( isset( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ] ) ) { |
|
58 | + foreach ( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ] as $key => $meta_box ) { |
|
59 | 59 | if ( ! preg_match( '/^gravityview_/ism', $key ) ) { |
60 | - $wp_meta_boxes['gravityview']['advanced'][ $position ][ $key ] = $meta_box; |
|
61 | - unset( $wp_meta_boxes['gravityview']['normal'][ $position ][ $key ] ); |
|
60 | + $wp_meta_boxes[ 'gravityview' ][ 'advanced' ][ $position ][ $key ] = $meta_box; |
|
61 | + unset( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ][ $key ] ); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | foreach ( $metaboxes as $m ) { |
193 | 193 | |
194 | - $tab = new GravityView_Metabox_Tab( $m['id'], $m['title'], $m['file'], $m['icon-class'], $m['callback'], $m['callback_args'] ); |
|
194 | + $tab = new GravityView_Metabox_Tab( $m[ 'id' ], $m[ 'title' ], $m[ 'file' ], $m[ 'icon-class' ], $m[ 'callback' ], $m[ 'callback_args' ] ); |
|
195 | 195 | |
196 | 196 | GravityView_Metabox_Tabs::add( $tab ); |
197 | 197 | |
@@ -261,13 +261,13 @@ discard block |
||
261 | 261 | |
262 | 262 | $form = gravityview_get_form( $curr_form ); |
263 | 263 | |
264 | - $get_id_backup = isset( $_GET['id'] ) ? $_GET['id'] : null; |
|
264 | + $get_id_backup = isset( $_GET[ 'id' ] ) ? $_GET[ 'id' ] : null; |
|
265 | 265 | |
266 | - if ( isset( $form['id'] ) ) { |
|
266 | + if ( isset( $form[ 'id' ] ) ) { |
|
267 | 267 | $form_script = 'var form = ' . GFCommon::json_encode( $form ) . ';'; |
268 | 268 | |
269 | 269 | // The `gf_vars()` method needs a $_GET[id] variable set with the form ID. |
270 | - $_GET['id'] = $form['id']; |
|
270 | + $_GET[ 'id' ] = $form[ 'id' ]; |
|
271 | 271 | |
272 | 272 | } else { |
273 | 273 | $form_script = 'var form = new Form();'; |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | $output = '<script type="text/javascript" data-gv-merge-tags="1">' . $form_script . "\n" . GFCommon::gf_vars( false ) . '</script>'; |
277 | 277 | |
278 | 278 | // Restore previous $_GET setting |
279 | - $_GET['id'] = $get_id_backup; |
|
279 | + $_GET[ 'id' ] = $get_id_backup; |
|
280 | 280 | |
281 | 281 | return $output; |
282 | 282 | } |