|
@@ -54,7 +54,7 @@ discard block |
|
|
block discarded – undo |
|
54
|
54
|
|
|
55
|
55
|
$gv_bulk_action = false; |
|
56
|
56
|
|
|
57
|
|
- if( version_compare( GFForms::$version, '2.0', '>=' ) ) { |
|
|
57
|
+ if ( version_compare( GFForms::$version, '2.0', '>=' ) ) { |
|
58
|
58
|
$bulk_action = ( '-1' !== \GV\Utils::_POST( 'action' ) ) ? \GV\Utils::_POST( 'action' ) : \GV\Utils::_POST( 'action2' ); |
|
59
|
59
|
} else { |
|
60
|
60
|
// GF 1.9.x - Bulk action 2 is the bottom bulk action select form. |
|
@@ -62,7 +62,7 @@ discard block |
|
|
block discarded – undo |
|
62
|
62
|
} |
|
63
|
63
|
|
|
64
|
64
|
// Check the $bulk_action value against GV actions, see if they're the same. I hate strpos(). |
|
65
|
|
- if( ! empty( $bulk_action ) && preg_match( '/^('. implode( '|', self::$bulk_action_prefixes ) .')/ism', $bulk_action ) ) { |
|
|
65
|
+ if ( ! empty( $bulk_action ) && preg_match( '/^(' . implode( '|', self::$bulk_action_prefixes ) . ')/ism', $bulk_action ) ) { |
|
66
|
66
|
$gv_bulk_action = $bulk_action; |
|
67
|
67
|
} |
|
68
|
68
|
|
|
@@ -86,7 +86,7 @@ discard block |
|
|
block discarded – undo |
|
86
|
86
|
|
|
87
|
87
|
// gforms_entry_list is the nonce that confirms we're on the right page |
|
88
|
88
|
// gforms_update_note is sent when bulk editing entry notes. We don't want to process then. |
|
89
|
|
- if ( ! ( $bulk_action && \GV\Utils::_POST( 'gforms_entry_list' ) && empty( $_POST['gforms_update_note'] ) ) ) { |
|
|
89
|
+ if ( ! ( $bulk_action && \GV\Utils::_POST( 'gforms_entry_list' ) && empty( $_POST[ 'gforms_update_note' ] ) ) ) { |
|
90
|
90
|
return; |
|
91
|
91
|
} |
|
92
|
92
|
|
|
@@ -106,13 +106,13 @@ discard block |
|
|
block discarded – undo |
|
106
|
106
|
} |
|
107
|
107
|
|
|
108
|
108
|
// All entries are set to be updated, not just the visible ones |
|
109
|
|
- if ( ! empty( $_POST['all_entries'] ) ) { |
|
|
109
|
+ if ( ! empty( $_POST[ 'all_entries' ] ) ) { |
|
110
|
110
|
|
|
111
|
111
|
// Convert the current entry search into GF-formatted search criteria |
|
112
|
112
|
$search = array( |
|
113
|
|
- 'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0, |
|
114
|
|
- 'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '', |
|
115
|
|
- 'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains', |
|
|
113
|
+ 'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0, |
|
|
114
|
+ 'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '', |
|
|
115
|
+ 'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains', |
|
116
|
116
|
); |
|
117
|
117
|
|
|
118
|
118
|
$search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id ); |
|
@@ -123,7 +123,7 @@ discard block |
|
|
block discarded – undo |
|
123
|
123
|
} else { |
|
124
|
124
|
|
|
125
|
125
|
// Changed from 'lead' to 'entry' in 2.0 |
|
126
|
|
- $entries = isset( $_POST['lead'] ) ? $_POST['lead'] : $_POST['entry']; |
|
|
126
|
+ $entries = isset( $_POST[ 'lead' ] ) ? $_POST[ 'lead' ] : $_POST[ 'entry' ]; |
|
127
|
127
|
|
|
128
|
128
|
} |
|
129
|
129
|
|
|
@@ -135,15 +135,15 @@ discard block |
|
|
block discarded – undo |
|
135
|
135
|
$entry_count = count( $entries ) > 1 ? sprintf( __( '%d entries', 'gravityview' ), count( $entries ) ) : __( '1 entry', 'gravityview' ); |
|
136
|
136
|
|
|
137
|
137
|
switch ( $approved_status ) { |
|
138
|
|
- case self::$bulk_action_prefixes['approve']: |
|
|
138
|
+ case self::$bulk_action_prefixes[ 'approve' ]: |
|
139
|
139
|
GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::APPROVED, $form_id ); |
|
140
|
140
|
self::$bulk_update_message = sprintf( __( '%s approved.', 'gravityview' ), $entry_count ); |
|
141
|
141
|
break; |
|
142
|
|
- case self::$bulk_action_prefixes['unapprove']: |
|
|
142
|
+ case self::$bulk_action_prefixes[ 'unapprove' ]: |
|
143
|
143
|
GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::UNAPPROVED, $form_id ); |
|
144
|
144
|
self::$bulk_update_message = sprintf( __( '%s unapproved.', 'gravityview' ), $entry_count ); |
|
145
|
145
|
break; |
|
146
|
|
- case self::$bulk_action_prefixes['disapprove']: |
|
|
146
|
+ case self::$bulk_action_prefixes[ 'disapprove' ]: |
|
147
|
147
|
GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::DISAPPROVED, $form_id ); |
|
148
|
148
|
self::$bulk_update_message = sprintf( __( '%s disapproved.', 'gravityview' ), $entry_count ); |
|
149
|
149
|
break; |
|
@@ -165,16 +165,16 @@ discard block |
|
|
block discarded – undo |
|
165
|
165
|
$bulk_actions = array( |
|
166
|
166
|
'GravityView' => array( |
|
167
|
167
|
array( |
|
168
|
|
- 'label' => GravityView_Entry_Approval_Status::get_string('approved', 'action'), |
|
169
|
|
- 'value' => sprintf( '%s-%d', self::$bulk_action_prefixes['approve'], $form_id ), |
|
|
168
|
+ 'label' => GravityView_Entry_Approval_Status::get_string( 'approved', 'action' ), |
|
|
169
|
+ 'value' => sprintf( '%s-%d', self::$bulk_action_prefixes[ 'approve' ], $form_id ), |
|
170
|
170
|
), |
|
171
|
171
|
array( |
|
172
|
|
- 'label' => GravityView_Entry_Approval_Status::get_string('disapproved', 'action'), |
|
173
|
|
- 'value' => sprintf( '%s-%d', self::$bulk_action_prefixes['disapprove'], $form_id ), |
|
|
172
|
+ 'label' => GravityView_Entry_Approval_Status::get_string( 'disapproved', 'action' ), |
|
|
173
|
+ 'value' => sprintf( '%s-%d', self::$bulk_action_prefixes[ 'disapprove' ], $form_id ), |
|
174
|
174
|
), |
|
175
|
175
|
array( |
|
176
|
|
- 'label' => GravityView_Entry_Approval_Status::get_string('unapproved', 'action'), |
|
177
|
|
- 'value' => sprintf( '%s-%d', self::$bulk_action_prefixes['unapprove'], $form_id ), |
|
|
176
|
+ 'label' => GravityView_Entry_Approval_Status::get_string( 'unapproved', 'action' ), |
|
|
177
|
+ 'value' => sprintf( '%s-%d', self::$bulk_action_prefixes[ 'unapprove' ], $form_id ), |
|
178
|
178
|
), |
|
179
|
179
|
), |
|
180
|
180
|
); |
|
@@ -191,13 +191,13 @@ discard block |
|
|
block discarded – undo |
|
191
|
191
|
// Sanitize the values, just to be sure. |
|
192
|
192
|
foreach ( $bulk_actions as $key => $group ) { |
|
193
|
193
|
|
|
194
|
|
- if( empty( $group ) ) { |
|
|
194
|
+ if ( empty( $group ) ) { |
|
195
|
195
|
continue; |
|
196
|
196
|
} |
|
197
|
197
|
|
|
198
|
198
|
foreach ( $group as $i => $action ) { |
|
199
|
|
- $bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] ); |
|
200
|
|
- $bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] ); |
|
|
199
|
+ $bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] ); |
|
|
200
|
+ $bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] ); |
|
201
|
201
|
} |
|
202
|
202
|
} |
|
203
|
203
|
|