|
@@ -152,17 +152,17 @@ discard block |
|
|
block discarded – undo |
|
152
|
152
|
|
|
153
|
153
|
add_filter( 'gravityview/sortable/field_blocklist', array( $this, '_filter_sortable_fields' ), 1 ); |
|
154
|
154
|
|
|
155
|
|
- if( $this->entry_meta_key ) { |
|
|
155
|
+ if ( $this->entry_meta_key ) { |
|
156
|
156
|
add_filter( 'gform_entry_meta', array( $this, 'add_entry_meta' ) ); |
|
157
|
157
|
add_filter( 'gravityview/common/sortable_fields', array( $this, 'add_sortable_field' ), 10, 2 ); |
|
158
|
158
|
} |
|
159
|
159
|
|
|
160
|
|
- if( $this->_custom_merge_tag ) { |
|
|
160
|
+ if ( $this->_custom_merge_tag ) { |
|
161
|
161
|
add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 ); |
|
162
|
162
|
add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 ); |
|
163
|
163
|
} |
|
164
|
164
|
|
|
165
|
|
- if( 'meta' === $this->group || '' !== $this->default_search_label ) { |
|
|
165
|
+ if ( 'meta' === $this->group || '' !== $this->default_search_label ) { |
|
166
|
166
|
add_filter( 'gravityview_search_field_label', array( $this, 'set_default_search_label' ), 10, 3 ); |
|
167
|
167
|
} |
|
168
|
168
|
|
|
@@ -170,7 +170,7 @@ discard block |
|
|
block discarded – undo |
|
170
|
170
|
* Auto-assign label from Gravity Forms label, if exists |
|
171
|
171
|
* @since 1.20 |
|
172
|
172
|
*/ |
|
173
|
|
- if( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) { |
|
|
173
|
+ if ( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) { |
|
174
|
174
|
$this->label = ucfirst( GF_Fields::get( $this->name )->get_form_editor_field_title() ); |
|
175
|
175
|
} |
|
176
|
176
|
|
|
@@ -223,7 +223,7 @@ discard block |
|
|
block discarded – undo |
|
223
|
223
|
$gf_field = GF_Fields::get( $this->name ); |
|
224
|
224
|
|
|
225
|
225
|
// If the field exists and is a GF_Field, return the icon. |
|
226
|
|
- if( $gf_field && $gf_field instanceof GF_Field ) { |
|
|
226
|
+ if ( $gf_field && $gf_field instanceof GF_Field ) { |
|
227
|
227
|
return $gf_field->get_form_editor_field_icon(); |
|
228
|
228
|
} |
|
229
|
229
|
|
|
@@ -246,7 +246,7 @@ discard block |
|
|
block discarded – undo |
|
246
|
246
|
'type' => $this->name |
|
247
|
247
|
); |
|
248
|
248
|
|
|
249
|
|
- $fields["{$this->entry_meta_key}"] = $added_field; |
|
|
249
|
+ $fields[ "{$this->entry_meta_key}" ] = $added_field; |
|
250
|
250
|
|
|
251
|
251
|
return $fields; |
|
252
|
252
|
} |
|
@@ -266,7 +266,7 @@ discard block |
|
|
block discarded – undo |
|
266
|
266
|
*/ |
|
267
|
267
|
function set_default_search_label( $label = '', $gf_field = null, $field = array() ) { |
|
268
|
268
|
|
|
269
|
|
- if( $this->name === $field['field'] && '' === $label ) { |
|
|
269
|
+ if ( $this->name === $field[ 'field' ] && '' === $label ) { |
|
270
|
270
|
$label = esc_html( $this->default_search_label ); |
|
271
|
271
|
} |
|
272
|
272
|
|
|
@@ -287,7 +287,7 @@ discard block |
|
|
block discarded – undo |
|
287
|
287
|
* |
|
288
|
288
|
* @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text. |
|
289
|
289
|
*/ |
|
290
|
|
- public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
|
290
|
+ public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
291
|
291
|
|
|
292
|
292
|
// Prevent potential errors coming from upstream/other add-ons. |
|
293
|
293
|
if ( ! is_string( $text ) ) { |
|
@@ -325,19 +325,19 @@ discard block |
|
|
block discarded – undo |
|
325
|
325
|
*/ |
|
326
|
326
|
public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
327
|
327
|
|
|
328
|
|
- foreach( $matches as $match ) { |
|
|
328
|
+ foreach ( $matches as $match ) { |
|
329
|
329
|
|
|
330
|
|
- $full_tag = $match[0]; |
|
|
330
|
+ $full_tag = $match[ 0 ]; |
|
331
|
331
|
|
|
332
|
332
|
// Strip the Merge Tags |
|
333
|
|
- $tag = str_replace( array( '{', '}'), '', $full_tag ); |
|
|
333
|
+ $tag = str_replace( array( '{', '}' ), '', $full_tag ); |
|
334
|
334
|
|
|
335
|
335
|
// Replace the value from the entry, if exists |
|
336
|
|
- if( isset( $entry[ $tag ] ) ) { |
|
|
336
|
+ if ( isset( $entry[ $tag ] ) ) { |
|
337
|
337
|
|
|
338
|
338
|
$value = $entry[ $tag ]; |
|
339
|
339
|
|
|
340
|
|
- if( is_callable( array( $this, 'get_content') ) ) { |
|
|
340
|
+ if ( is_callable( array( $this, 'get_content' ) ) ) { |
|
341
|
341
|
$value = $this->get_content( $value ); |
|
342
|
342
|
} |
|
343
|
343
|
|
|
@@ -410,8 +410,8 @@ discard block |
|
|
block discarded – undo |
|
410
|
410
|
*/ |
|
411
|
411
|
public function _filter_sortable_fields( $not_sortable ) { |
|
412
|
412
|
|
|
413
|
|
- if( ! $this->is_sortable ) { |
|
414
|
|
- $not_sortable[] = $this->name; |
|
|
413
|
+ if ( ! $this->is_sortable ) { |
|
|
414
|
+ $not_sortable[ ] = $this->name; |
|
415
|
415
|
} |
|
416
|
416
|
|
|
417
|
417
|
return $not_sortable; |
|
@@ -428,7 +428,7 @@ discard block |
|
|
block discarded – undo |
|
428
|
428
|
*/ |
|
429
|
429
|
function add_entry_meta( $entry_meta ) { |
|
430
|
430
|
|
|
431
|
|
- if( ! isset( $entry_meta["{$this->entry_meta_key}"] ) ) { |
|
|
431
|
+ if ( ! isset( $entry_meta[ "{$this->entry_meta_key}" ] ) ) { |
|
432
|
432
|
|
|
433
|
433
|
$added_meta = array( |
|
434
|
434
|
'label' => $this->label, |
|
@@ -437,13 +437,13 @@ discard block |
|
|
block discarded – undo |
|
437
|
437
|
); |
|
438
|
438
|
|
|
439
|
439
|
if ( $this->entry_meta_update_callback && is_callable( $this->entry_meta_update_callback ) ) { |
|
440
|
|
- $added_meta['update_entry_meta_callback'] = $this->entry_meta_update_callback; |
|
|
440
|
+ $added_meta[ 'update_entry_meta_callback' ] = $this->entry_meta_update_callback; |
|
441
|
441
|
} |
|
442
|
442
|
|
|
443
|
|
- $entry_meta["{$this->entry_meta_key}"] = $added_meta; |
|
|
443
|
+ $entry_meta[ "{$this->entry_meta_key}" ] = $added_meta; |
|
444
|
444
|
|
|
445
|
445
|
} else { |
|
446
|
|
- gravityview()->log->error( 'Entry meta already set: {meta_key}', array( 'meta_key' => $this->entry_meta_key, 'data' => $entry_meta["{$this->entry_meta_key}"] ) ); |
|
|
446
|
+ gravityview()->log->error( 'Entry meta already set: {meta_key}', array( 'meta_key' => $this->entry_meta_key, 'data' => $entry_meta[ "{$this->entry_meta_key}" ] ) ); |
|
447
|
447
|
} |
|
448
|
448
|
|
|
449
|
449
|
return $entry_meta; |
|
@@ -478,7 +478,7 @@ discard block |
|
|
block discarded – undo |
|
478
|
478
|
'date_display' => array( |
|
479
|
479
|
'type' => 'text', |
|
480
|
480
|
'label' => __( 'Override Date Format', 'gk-gravityview' ), |
|
481
|
|
- 'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gk-gravityview'), '<a href="https://wordpress.org/support/article/formatting-date-and-time/" rel="external">', '</a>' ), |
|
|
481
|
+ 'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gk-gravityview' ), '<a href="https://wordpress.org/support/article/formatting-date-and-time/" rel="external">', '</a>' ), |
|
482
|
482
|
/** |
|
483
|
483
|
* @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time) |
|
484
|
484
|
* @param null|string $date_format Date Format (default: null) |
|
@@ -514,7 +514,7 @@ discard block |
|
|
block discarded – undo |
|
514
|
514
|
|
|
515
|
515
|
$options = $this->field_support_options(); |
|
516
|
516
|
|
|
517
|
|
- if( isset( $options[ $key ] ) ) { |
|
|
517
|
+ if ( isset( $options[ $key ] ) ) { |
|
518
|
518
|
$field_options[ $key ] = $options[ $key ]; |
|
519
|
519
|
} |
|
520
|
520
|
|
|
@@ -578,11 +578,11 @@ discard block |
|
|
block discarded – undo |
|
578
|
578
|
$connected_form = \GV\Utils::_POST( 'form_id' ); |
|
579
|
579
|
|
|
580
|
580
|
// Otherwise, get the Form ID from the Post page |
|
581
|
|
- if( empty( $connected_form ) ) { |
|
|
581
|
+ if ( empty( $connected_form ) ) { |
|
582
|
582
|
$connected_form = gravityview_get_form_id( get_the_ID() ); |
|
583
|
583
|
} |
|
584
|
584
|
|
|
585
|
|
- if( empty( $connected_form ) ) { |
|
|
585
|
+ if ( empty( $connected_form ) ) { |
|
586
|
586
|
gravityview()->log->error( 'Form not found for form ID "{form_id}"', array( 'form_id' => $connected_form ) ); |
|
587
|
587
|
return false; |
|
588
|
588
|
} |