|
@@ -38,7 +38,7 @@ discard block |
|
|
block discarded – undo |
|
38
|
38
|
|
|
39
|
39
|
$this->label = esc_html__( 'Number Sequence', 'gravityview' ); |
|
40
|
40
|
|
|
41
|
|
- add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'field_tooltips') ); |
|
|
41
|
+ add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'field_tooltips' ) ); |
|
42
|
42
|
|
|
43
|
43
|
parent::__construct(); |
|
44
|
44
|
} |
|
@@ -52,9 +52,9 @@ discard block |
|
|
block discarded – undo |
|
52
|
52
|
|
|
53
|
53
|
$return = $tooltips; |
|
54
|
54
|
|
|
55
|
|
- $return['reverse_sequence'] = array( |
|
56
|
|
- 'title' => __('Reverse the order of the result numbers', 'gravityview'), |
|
57
|
|
- 'value' => __('Output the number sequence in descending order. If enabled, numbers will count down from high to low.', 'gravityview'), |
|
|
55
|
+ $return[ 'reverse_sequence' ] = array( |
|
|
56
|
+ 'title' => __( 'Reverse the order of the result numbers', 'gravityview' ), |
|
|
57
|
+ 'value' => __( 'Output the number sequence in descending order. If enabled, numbers will count down from high to low.', 'gravityview' ), |
|
58
|
58
|
); |
|
59
|
59
|
|
|
60
|
60
|
return $return; |
|
@@ -62,13 +62,13 @@ discard block |
|
|
block discarded – undo |
|
62
|
62
|
|
|
63
|
63
|
public function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
64
|
64
|
|
|
65
|
|
- unset ( $field_options['search_filter'] ); |
|
|
65
|
+ unset ( $field_options[ 'search_filter' ] ); |
|
66
|
66
|
|
|
67
|
67
|
$new_fields = array( |
|
68
|
68
|
'start' => array( |
|
69
|
69
|
'type' => 'number', |
|
70
|
70
|
'label' => __( 'First Number in the Sequence', 'gravityview' ), |
|
71
|
|
- 'desc' => __('For each entry, the displayed number will increase by one. When displaying ten entries, the first entry will display "1", and the last entry will show "10".', 'gravityview'), |
|
|
71
|
+ 'desc' => __( 'For each entry, the displayed number will increase by one. When displaying ten entries, the first entry will display "1", and the last entry will show "10".', 'gravityview' ), |
|
72
|
72
|
'value' => '1', |
|
73
|
73
|
'merge_tags' => false, |
|
74
|
74
|
), |
|
@@ -124,7 +124,7 @@ discard block |
|
|
block discarded – undo |
|
124
|
124
|
$return = $text; |
|
125
|
125
|
|
|
126
|
126
|
$context = new \GV\Template_Context(); |
|
127
|
|
- $context->view = \GV\View::by_id( $view_data['view_id'] ); |
|
|
127
|
+ $context->view = \GV\View::by_id( $view_data[ 'view_id' ] ); |
|
128
|
128
|
$context->entry = \GV\GF_Entry::from_entry( $entry ); |
|
129
|
129
|
|
|
130
|
130
|
$gv_field = \GV\Internal_Field::by_id( 'sequence' ); |
|
@@ -134,8 +134,8 @@ discard block |
|
|
block discarded – undo |
|
134
|
134
|
|
|
135
|
135
|
foreach ( $matches as $match ) { |
|
136
|
136
|
|
|
137
|
|
- $full_tag = $match[0]; |
|
138
|
|
- $property = $match[1]; |
|
|
137
|
+ $full_tag = $match[ 0 ]; |
|
|
138
|
+ $property = $match[ 1 ]; |
|
139
|
139
|
|
|
140
|
140
|
$gv_field->reverse = false; |
|
141
|
141
|
$gv_field->start = 1; |
|
@@ -154,12 +154,12 @@ discard block |
|
|
block discarded – undo |
|
154
|
154
|
|
|
155
|
155
|
// If there is a field with the ID of the start number, the merge tag won't work. |
|
156
|
156
|
// In that case, you can use "=" instead: `{sequence start=10}` |
|
157
|
|
- if( 1 === sizeof( $maybe_start ) ) { |
|
|
157
|
+ if ( 1 === sizeof( $maybe_start ) ) { |
|
158
|
158
|
$maybe_start = explode( '=', $modifier ); |
|
159
|
159
|
} |
|
160
|
160
|
|
|
161
|
161
|
if ( 'start' === rgar( $maybe_start, 0 ) && is_numeric( rgar( $maybe_start, 1 ) ) ) { |
|
162
|
|
- $gv_field->start = (int) rgar( $maybe_start, 1 ); |
|
|
162
|
+ $gv_field->start = (int)rgar( $maybe_start, 1 ); |
|
163
|
163
|
} |
|
164
|
164
|
} |
|
165
|
165
|
|
|
@@ -170,7 +170,7 @@ discard block |
|
|
block discarded – undo |
|
170
|
170
|
$merge_tag_context_modifiers = $merge_tag_context . '/' . var_export( $gv_field->reverse, true ) . '/' . $gv_field->start; |
|
171
|
171
|
|
|
172
|
172
|
if ( ! isset( $merge_tag_sequences[ $merge_tag_context_modifiers ] ) ) { |
|
173
|
|
- $gv_field->UID = $legacy_field['UID'] . '/' . var_export( $gv_field->reverse, true ) . '/' . $gv_field->start; |
|
|
173
|
+ $gv_field->UID = $legacy_field[ 'UID' ] . '/' . var_export( $gv_field->reverse, true ) . '/' . $gv_field->start; |
|
174
|
174
|
$context->field = $gv_field; |
|
175
|
175
|
$sequence = $merge_tag_sequences[ $merge_tag_context_modifiers ] = $this->get_sequence( $context ); |
|
176
|
176
|
} else { |
|
@@ -215,7 +215,7 @@ discard block |
|
|
block discarded – undo |
|
215
|
215
|
$total = $context->view->get_entries()->total(); |
|
216
|
216
|
remove_filter( 'gform_gf_query_sql', $callback ); |
|
217
|
217
|
|
|
218
|
|
- unset( $sql_query['paginate'] ); |
|
|
218
|
+ unset( $sql_query[ 'paginate' ] ); |
|
219
|
219
|
|
|
220
|
220
|
global $wpdb; |
|
221
|
221
|
|