@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | public function remove_columns_from_searchable_fields( $fields ) { |
61 | 61 | |
62 | 62 | foreach ( $fields as $key => $field ) { |
63 | - if ( isset( $field['parent'] ) && $field['parent'] instanceof \GF_Field_List ) { |
|
63 | + if ( isset( $field[ 'parent' ] ) && $field[ 'parent' ] instanceof \GF_Field_List ) { |
|
64 | 64 | unset( $fields[ $key ] ); |
65 | 65 | } |
66 | 66 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | // Add the list columns |
87 | 87 | foreach ( $list_fields as $list_field ) { |
88 | 88 | |
89 | - if( empty( $list_field->enableColumns ) ) { |
|
89 | + if ( empty( $list_field->enableColumns ) ) { |
|
90 | 90 | continue; |
91 | 91 | } |
92 | 92 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | // If there are columns, add them under the parent field |
110 | - if( ! empty( $list_columns ) ) { |
|
110 | + if ( ! empty( $list_columns ) ) { |
|
111 | 111 | |
112 | 112 | $index = array_search( $list_field->id, array_keys( $fields ) ) + 1; |
113 | 113 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * Merge the $list_columns into the $fields array at $index |
116 | 116 | * @see https://stackoverflow.com/a/1783125 |
117 | 117 | */ |
118 | - $fields = array_slice( $fields, 0, $index, true) + $list_columns + array_slice( $fields, $index, null, true); |
|
118 | + $fields = array_slice( $fields, 0, $index, true ) + $list_columns + array_slice( $fields, $index, null, true ); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | unset( $list_columns, $index, $input_id ); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | |
143 | 143 | $list_rows = maybe_unserialize( $field_value ); |
144 | 144 | |
145 | - if( ! is_array( $list_rows ) ) { |
|
145 | + if ( ! is_array( $list_rows ) ) { |
|
146 | 146 | gravityview()->log->error( '$field_value did not unserialize', array( 'data' => $field_value ) ); |
147 | 147 | return null; |
148 | 148 | } |
@@ -152,18 +152,18 @@ discard block |
||
152 | 152 | // Each list row |
153 | 153 | foreach ( $list_rows as $list_row ) { |
154 | 154 | $current_column = 0; |
155 | - foreach ( (array) $list_row as $column_key => $column_value ) { |
|
155 | + foreach ( (array)$list_row as $column_key => $column_value ) { |
|
156 | 156 | |
157 | 157 | // If the label of the column matches $column_id, or the numeric key value matches, add the value |
158 | - if( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) { |
|
159 | - $column_values[] = $column_value; |
|
158 | + if ( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) { |
|
159 | + $column_values[ ] = $column_value; |
|
160 | 160 | } |
161 | 161 | $current_column++; |
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | 165 | // Return the array of values |
166 | - if( 'raw' === $format ) { |
|
166 | + if ( 'raw' === $format ) { |
|
167 | 167 | return $column_values; |
168 | 168 | } |
169 | 169 | // Return the Gravity Forms Field output |
@@ -186,22 +186,22 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function _filter_field_label( $label, $field, $form, $entry ) { |
188 | 188 | |
189 | - $field_object = RGFormsModel::get_field( $form, $field['id'] ); |
|
189 | + $field_object = RGFormsModel::get_field( $form, $field[ 'id' ] ); |
|
190 | 190 | |
191 | 191 | // Not a list field |
192 | - if( ! $field_object || 'list' !== $field_object->type ) { |
|
192 | + if ( ! $field_object || 'list' !== $field_object->type ) { |
|
193 | 193 | return $label; |
194 | 194 | } |
195 | 195 | |
196 | 196 | // Custom label is defined, so use it |
197 | - if( ! empty( $field['custom_label'] ) ) { |
|
197 | + if ( ! empty( $field[ 'custom_label' ] ) ) { |
|
198 | 198 | return $label; |
199 | 199 | } |
200 | 200 | |
201 | - $column_id = gravityview_get_input_id_from_id( $field['id'] ); |
|
201 | + $column_id = gravityview_get_input_id_from_id( $field[ 'id' ] ); |
|
202 | 202 | |
203 | 203 | // Parent field, not column field |
204 | - if( false === $column_id ) { |
|
204 | + if ( false === $column_id ) { |
|
205 | 205 | return $label; |
206 | 206 | } |
207 | 207 | |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | public static function get_column_label( GF_Field_List $field, $column_id, $backup_label = '' ) { |
223 | 223 | |
224 | 224 | // Doesn't have columns enabled |
225 | - if( ! isset( $field->choices ) || ! $field->enableColumns ) { |
|
225 | + if ( ! isset( $field->choices ) || ! $field->enableColumns ) { |
|
226 | 226 | return $backup_label; |
227 | 227 | } |
228 | 228 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public static function is_add_oembed_preview() { |
47 | 47 | /** The preview request is a parse-embed AJAX call without a type set. */ |
48 | - return ( self::is_ajax() && ! empty( $_POST['action'] ) && $_POST['action'] == 'parse-embed' && ! isset( $_POST['type'] ) ); |
|
48 | + return ( self::is_ajax() && ! empty( $_POST[ 'action' ] ) && $_POST[ 'action' ] == 'parse-embed' && ! isset( $_POST[ 'type' ] ) ); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @return boolean |
64 | 64 | */ |
65 | 65 | public static function is_rest() { |
66 | - return ! empty( $GLOBALS['wp']->query_vars['rest_route'] ); |
|
66 | + return ! empty( $GLOBALS[ 'wp' ]->query_vars[ 'rest_route' ] ); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -141,15 +141,15 @@ discard block |
||
141 | 141 | $get = $_GET; |
142 | 142 | } |
143 | 143 | |
144 | - unset( $get['mode'] ); |
|
144 | + unset( $get[ 'mode' ] ); |
|
145 | 145 | |
146 | 146 | $get = array_filter( $get, 'gravityview_is_not_empty_string' ); |
147 | 147 | |
148 | - if( $has_field_key = $this->_has_field_key( $get ) ) { |
|
148 | + if ( $has_field_key = $this->_has_field_key( $get ) ) { |
|
149 | 149 | return true; |
150 | 150 | } |
151 | 151 | |
152 | - return isset( $get['gv_search'] ) || isset( $get['gv_start'] ) || isset( $get['gv_end'] ) || isset( $get['gv_by'] ) || isset( $get['gv_id'] ); |
|
152 | + return isset( $get[ 'gv_search' ] ) || isset( $get[ 'gv_start' ] ) || isset( $get[ 'gv_end' ] ) || isset( $get[ 'gv_by' ] ) || isset( $get[ 'gv_id' ] ); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | /** |
@@ -172,13 +172,13 @@ discard block |
||
172 | 172 | |
173 | 173 | $meta = array(); |
174 | 174 | foreach ( $fields as $field ) { |
175 | - if( empty( $field->_gf_field_class_name ) ) { |
|
176 | - $meta[] = preg_quote( $field->name ); |
|
175 | + if ( empty( $field->_gf_field_class_name ) ) { |
|
176 | + $meta[ ] = preg_quote( $field->name ); |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
180 | 180 | foreach ( $get as $key => $value ) { |
181 | - if ( preg_match('/^filter_(([0-9_]+)|'. implode( '|', $meta ) .')$/sm', $key ) ) { |
|
181 | + if ( preg_match( '/^filter_(([0-9_]+)|' . implode( '|', $meta ) . ')$/sm', $key ) ) { |
|
182 | 182 | $has_field_key = true; |
183 | 183 | break; |
184 | 184 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public static function get_instance() { |
89 | 89 | |
90 | - if( empty( self::$instance ) ) { |
|
90 | + if ( empty( self::$instance ) ) { |
|
91 | 91 | self::$instance = new self; |
92 | 92 | } |
93 | 93 | |
@@ -121,9 +121,9 @@ discard block |
||
121 | 121 | |
122 | 122 | $operators = array_merge( self::$SUPPORTED_ARRAY_OPERATORS, self::$SUPPORTED_NUMERIC_OPERATORS, self::$SUPPORTED_SCALAR_OPERATORS, self::$SUPPORTED_CUSTOM_OPERATORS ); |
123 | 123 | |
124 | - if( $with_values ) { |
|
124 | + if ( $with_values ) { |
|
125 | 125 | $operators_with_values = array(); |
126 | - foreach( $operators as $key ) { |
|
126 | + foreach ( $operators as $key ) { |
|
127 | 127 | $operators_with_values[ $key ] = ''; |
128 | 128 | } |
129 | 129 | return $operators_with_values; |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | |
143 | 143 | $operators = $this->get_operators( false ); |
144 | 144 | |
145 | - if( !in_array( $operation, $operators ) ) { |
|
145 | + if ( ! in_array( $operation, $operators ) ) { |
|
146 | 146 | gravityview()->log->debug( ' Attempted to add invalid operation type. {operation}', array( 'operation' => $operation ) ); |
147 | 147 | return false; |
148 | 148 | } |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | return null; |
195 | 195 | } |
196 | 196 | |
197 | - if( empty( $atts ) ) { |
|
197 | + if ( empty( $atts ) ) { |
|
198 | 198 | gravityview()->log->error( '$atts are empty.', array( 'data' => $atts ) ); |
199 | 199 | return null; |
200 | 200 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $this->parse_atts(); |
210 | 210 | |
211 | 211 | // We need an "if" |
212 | - if( false === $this->if ) { |
|
212 | + if ( false === $this->if ) { |
|
213 | 213 | gravityview()->log->error( '$atts->if is empty.', array( 'data' => $this->passed_atts ) ); |
214 | 214 | return null; |
215 | 215 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $setup = $this->setup_operation_and_comparison(); |
218 | 218 | |
219 | 219 | // We need an operation and comparison value |
220 | - if( ! $setup ) { |
|
220 | + if ( ! $setup ) { |
|
221 | 221 | gravityview()->log->error( 'No valid operators were passed.', array( 'data' => $this->atts ) ); |
222 | 222 | return null; |
223 | 223 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | */ |
268 | 268 | private function get_output() { |
269 | 269 | |
270 | - if( $this->is_match ) { |
|
270 | + if ( $this->is_match ) { |
|
271 | 271 | $output = $this->content; |
272 | 272 | } else { |
273 | 273 | $output = $this->else_content; |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * @param string $output HTML/text output |
286 | 286 | * @param GVLogic_Shortcode $this This class |
287 | 287 | */ |
288 | - $output = apply_filters('gravityview/gvlogic/output', $output, $this ); |
|
288 | + $output = apply_filters( 'gravityview/gvlogic/output', $output, $this ); |
|
289 | 289 | |
290 | 290 | gravityview()->log->debug( 'Output: ', array( 'data' => $output ) ); |
291 | 291 | |
@@ -305,14 +305,14 @@ discard block |
||
305 | 305 | list( $before_else, $after_else ) = array_pad( explode( '[else]', $passed_content ), 2, NULL ); |
306 | 306 | list( $before_else_if, $after_else_if ) = array_pad( explode( '[else', $passed_content ), 2, NULL ); |
307 | 307 | |
308 | - $else_attr = isset( $this->atts['else'] ) ? $this->atts['else'] : NULL; |
|
308 | + $else_attr = isset( $this->atts[ 'else' ] ) ? $this->atts[ 'else' ] : NULL; |
|
309 | 309 | $else_content = isset( $after_else ) ? $after_else : $else_attr; |
310 | 310 | |
311 | 311 | // The content is everything OTHER than the [else] |
312 | 312 | $this->content = $before_else_if; |
313 | 313 | |
314 | 314 | if ( ! $this->is_match ) { |
315 | - if( $elseif_content = $this->process_elseif( $before_else ) ) { |
|
315 | + if ( $elseif_content = $this->process_elseif( $before_else ) ) { |
|
316 | 316 | $this->else_content = $elseif_content; |
317 | 317 | } else { |
318 | 318 | $this->else_content = $else_content; |
@@ -340,16 +340,16 @@ discard block |
||
340 | 340 | foreach ( $else_if_matches as $key => $else_if_match ) { |
341 | 341 | |
342 | 342 | // If $else_if_match[5] exists and has content, check for more shortcodes |
343 | - preg_match_all( '/' . $regex . '/', $else_if_match[5] . '[/else]', $recursive_matches, PREG_SET_ORDER ); |
|
343 | + preg_match_all( '/' . $regex . '/', $else_if_match[ 5 ] . '[/else]', $recursive_matches, PREG_SET_ORDER ); |
|
344 | 344 | |
345 | 345 | // If the logic passes, this is the value that should be used for $this->else_content |
346 | - $else_if_value = $else_if_match[5]; |
|
347 | - $check_elseif_match = $else_if_match[0]; |
|
346 | + $else_if_value = $else_if_match[ 5 ]; |
|
347 | + $check_elseif_match = $else_if_match[ 0 ]; |
|
348 | 348 | |
349 | 349 | // Retrieve the value of the match that is currently being checked, without any other [else] tags |
350 | - if( ! empty( $recursive_matches[0][0] ) ) { |
|
351 | - $else_if_value = str_replace( $recursive_matches[0][0], '', $else_if_value ); |
|
352 | - $check_elseif_match = str_replace( $recursive_matches[0][0], '', $check_elseif_match ); |
|
350 | + if ( ! empty( $recursive_matches[ 0 ][ 0 ] ) ) { |
|
351 | + $else_if_value = str_replace( $recursive_matches[ 0 ][ 0 ], '', $else_if_value ); |
|
352 | + $check_elseif_match = str_replace( $recursive_matches[ 0 ][ 0 ], '', $check_elseif_match ); |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | $check_elseif_match = str_replace( '[else', '[gvlogicelse', $check_elseif_match ); |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | } |
367 | 367 | |
368 | 368 | // Process any remaining [else] tags |
369 | - return $this->process_elseif( $else_if_match[5] ); |
|
369 | + return $this->process_elseif( $else_if_match[ 5 ] ); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | return false; |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | $this->atts = array_intersect_key( $this->passed_atts, $this->atts ); |
393 | 393 | |
394 | 394 | // Strip whitespace if it's not default false |
395 | - $this->if = ( isset( $this->atts['if'] ) && is_string( $this->atts['if'] ) ) ? trim( $this->atts['if'] ) : false; |
|
395 | + $this->if = ( isset( $this->atts[ 'if' ] ) && is_string( $this->atts[ 'if' ] ) ) ? trim( $this->atts[ 'if' ] ) : false; |
|
396 | 396 | |
397 | 397 | /** |
398 | 398 | * @action `gravityview/gvlogic/parse_atts/after` Modify shortcode attributes after it's been parsed |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | do_action( 'gravityview/gvlogic/parse_atts/after', $this ); |
404 | 404 | |
405 | 405 | // Make sure the "if" isn't processed in self::setup_operation_and_comparison() |
406 | - unset( $this->atts['if'] ); |
|
406 | + unset( $this->atts[ 'if' ] ); |
|
407 | 407 | } |
408 | 408 | } |
409 | 409 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | function modify_entry_value_workflow_final_status( $output, $entry, $field_settings, $field ) { |
43 | 43 | |
44 | - if( ! empty( $output ) ) { |
|
44 | + if ( ! empty( $output ) ) { |
|
45 | 45 | $output = gravity_flow()->translate_status_label( $output ); |
46 | 46 | } |
47 | 47 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | foreach ( $search_fields as & $search_field ) { |
66 | 66 | if ( $this->name === \GV\Utils::get( $search_field, 'key' ) ) { |
67 | - $search_field['choices'] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options(); |
|
67 | + $search_field[ 'choices' ] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options(); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | die; |
17 | 17 | } |
18 | 18 | |
19 | -if( ! class_exists( '\GV\Gamajo_Template_Loader' ) ) { |
|
19 | +if ( ! class_exists( '\GV\Gamajo_Template_Loader' ) ) { |
|
20 | 20 | require( GRAVITYVIEW_DIR . 'includes/lib/class-gamajo-template-loader.php' ); |
21 | 21 | } |
22 | 22 | |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | 'atts' => NULL, |
158 | 158 | ) ); |
159 | 159 | |
160 | - foreach ($atts as $key => $value) { |
|
161 | - if( is_null( $value ) ) { |
|
160 | + foreach ( $atts as $key => $value ) { |
|
161 | + if ( is_null( $value ) ) { |
|
162 | 162 | continue; |
163 | 163 | } |
164 | 164 | $this->{$key} = $value; |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | */ |
189 | 189 | static function getInstance( $passed_post = NULL ) { |
190 | 190 | |
191 | - if( empty( self::$instance ) ) { |
|
191 | + if ( empty( self::$instance ) ) { |
|
192 | 192 | self::$instance = new self( $passed_post ); |
193 | 193 | } |
194 | 194 | |
@@ -201,8 +201,8 @@ discard block |
||
201 | 201 | */ |
202 | 202 | public function getCurrentField( $key = NULL ) { |
203 | 203 | |
204 | - if( !empty( $key ) ) { |
|
205 | - if( isset( $this->_current_field[ $key ] ) ) { |
|
204 | + if ( ! empty( $key ) ) { |
|
205 | + if ( isset( $this->_current_field[ $key ] ) ) { |
|
206 | 206 | return $this->_current_field[ $key ]; |
207 | 207 | } |
208 | 208 | return NULL; |
@@ -213,16 +213,16 @@ discard block |
||
213 | 213 | |
214 | 214 | public function setCurrentFieldSetting( $key, $value ) { |
215 | 215 | |
216 | - if( !empty( $this->_current_field ) ) { |
|
217 | - $this->_current_field['field_settings'][ $key ] = $value; |
|
216 | + if ( ! empty( $this->_current_field ) ) { |
|
217 | + $this->_current_field[ 'field_settings' ][ $key ] = $value; |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | } |
221 | 221 | |
222 | 222 | public function getCurrentFieldSetting( $key ) { |
223 | - $settings = $this->getCurrentField('field_settings'); |
|
223 | + $settings = $this->getCurrentField( 'field_settings' ); |
|
224 | 224 | |
225 | - if( $settings && !empty( $settings[ $key ] ) ) { |
|
225 | + if ( $settings && ! empty( $settings[ $key ] ) ) { |
|
226 | 226 | return $settings[ $key ]; |
227 | 227 | } |
228 | 228 | |
@@ -253,8 +253,8 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public function getAtts( $key = NULL ) { |
255 | 255 | |
256 | - if( !empty( $key ) ) { |
|
257 | - if( isset( $this->atts[ $key ] ) ) { |
|
256 | + if ( ! empty( $key ) ) { |
|
257 | + if ( isset( $this->atts[ $key ] ) ) { |
|
258 | 258 | return $this->atts[ $key ]; |
259 | 259 | } |
260 | 260 | return NULL; |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | |
321 | 321 | $fields = empty( $this->fields ) ? NULL : $this->fields; |
322 | 322 | |
323 | - if( $fields && !empty( $key ) ) { |
|
323 | + if ( $fields && ! empty( $key ) ) { |
|
324 | 324 | $fields = isset( $fields[ $key ] ) ? $fields[ $key ] : NULL; |
325 | 325 | } |
326 | 326 | |
@@ -338,18 +338,18 @@ discard block |
||
338 | 338 | */ |
339 | 339 | public function getContextFields( $context = '' ) { |
340 | 340 | |
341 | - if( '' === $context ) { |
|
341 | + if ( '' === $context ) { |
|
342 | 342 | $context = $this->getContext(); |
343 | 343 | } |
344 | 344 | |
345 | 345 | $fields = $this->getFields(); |
346 | 346 | |
347 | - foreach ( (array) $fields as $key => $context_fields ) { |
|
347 | + foreach ( (array)$fields as $key => $context_fields ) { |
|
348 | 348 | |
349 | 349 | // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against |
350 | 350 | $matches = explode( '_', $key ); |
351 | 351 | |
352 | - if( isset( $matches[0] ) && $matches[0] === $context ) { |
|
352 | + if ( isset( $matches[ 0 ] ) && $matches[ 0 ] === $context ) { |
|
353 | 353 | return $context_fields; |
354 | 354 | } |
355 | 355 | } |
@@ -370,8 +370,8 @@ discard block |
||
370 | 370 | */ |
371 | 371 | public function getField( $key ) { |
372 | 372 | |
373 | - if( !empty( $key ) ) { |
|
374 | - if( isset( $this->fields[ $key ] ) ) { |
|
373 | + if ( ! empty( $key ) ) { |
|
374 | + if ( isset( $this->fields[ $key ] ) ) { |
|
375 | 375 | return $this->fields[ $key ]; |
376 | 376 | } |
377 | 377 | } |
@@ -477,8 +477,8 @@ discard block |
||
477 | 477 | public function getPaginationCounts() { |
478 | 478 | |
479 | 479 | $paging = $this->getPaging(); |
480 | - $offset = $paging['offset']; |
|
481 | - $page_size = $paging['page_size']; |
|
480 | + $offset = $paging[ 'offset' ]; |
|
481 | + $page_size = $paging[ 'page_size' ]; |
|
482 | 482 | $total = $this->getTotalEntries(); |
483 | 483 | |
484 | 484 | if ( empty( $total ) ) { |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | */ |
500 | 500 | list( $first, $last, $total ) = apply_filters( 'gravityview_pagination_counts', array( $first, $last, $total ) ); |
501 | 501 | |
502 | - return array( 'first' => (int) $first, 'last' => (int) $last, 'total' => (int) $total ); |
|
502 | + return array( 'first' => (int)$first, 'last' => (int)$last, 'total' => (int)$total ); |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | /** |
@@ -595,16 +595,16 @@ discard block |
||
595 | 595 | */ |
596 | 596 | public function getCurrentEntry() { |
597 | 597 | |
598 | - if( in_array( $this->getContext(), array( 'edit', 'single') ) ) { |
|
598 | + if ( in_array( $this->getContext(), array( 'edit', 'single' ) ) ) { |
|
599 | 599 | $entries = $this->getEntries(); |
600 | - $entry = $entries[0]; |
|
600 | + $entry = $entries[ 0 ]; |
|
601 | 601 | } else { |
602 | 602 | $entry = $this->_current_entry; |
603 | 603 | } |
604 | 604 | |
605 | 605 | /** @since 1.16 Fixes DataTables empty entry issue */ |
606 | - if ( empty( $entry ) && ! empty( $this->_current_field['entry'] ) ) { |
|
607 | - $entry = $this->_current_field['entry']; |
|
606 | + if ( empty( $entry ) && ! empty( $this->_current_field[ 'entry' ] ) ) { |
|
607 | + $entry = $this->_current_field[ 'entry' ]; |
|
608 | 608 | } |
609 | 609 | |
610 | 610 | return $entry; |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | public function renderZone( $zone = '', $atts = array(), $echo = true ) { |
645 | 645 | |
646 | 646 | if ( empty( $zone ) ) { |
647 | - gravityview()->log->error( 'No zone defined.'); |
|
647 | + gravityview()->log->error( 'No zone defined.' ); |
|
648 | 648 | return NULL; |
649 | 649 | } |
650 | 650 | |
@@ -653,16 +653,16 @@ discard block |
||
653 | 653 | 'context' => $this->getContext(), |
654 | 654 | 'entry' => $this->getCurrentEntry(), |
655 | 655 | 'form' => $this->getForm(), |
656 | - 'hide_empty' => $this->getAtts('hide_empty'), |
|
656 | + 'hide_empty' => $this->getAtts( 'hide_empty' ), |
|
657 | 657 | ); |
658 | 658 | |
659 | 659 | $final_atts = wp_parse_args( $atts, $defaults ); |
660 | 660 | |
661 | 661 | $output = ''; |
662 | 662 | |
663 | - $final_atts['zone_id'] = "{$final_atts['context']}_{$final_atts['slug']}-{$zone}"; |
|
663 | + $final_atts[ 'zone_id' ] = "{$final_atts[ 'context' ]}_{$final_atts[ 'slug' ]}-{$zone}"; |
|
664 | 664 | |
665 | - $fields = $this->getField( $final_atts['zone_id'] ); |
|
665 | + $fields = $this->getField( $final_atts[ 'zone_id' ] ); |
|
666 | 666 | |
667 | 667 | // Backward compatibility |
668 | 668 | if ( 'table' === $this->getTemplatePartSlug() ) { |
@@ -672,19 +672,19 @@ discard block |
||
672 | 672 | * @param \GravityView_View $this |
673 | 673 | * @deprecated Use `gravityview/template/table/fields` |
674 | 674 | */ |
675 | - $fields = apply_filters("gravityview_table_cells", $fields, $this ); |
|
675 | + $fields = apply_filters( "gravityview_table_cells", $fields, $this ); |
|
676 | 676 | } |
677 | 677 | |
678 | 678 | if ( empty( $fields ) ) { |
679 | 679 | |
680 | - gravityview()->log->error( 'Empty zone configuration for {zone_id}.', array( 'zone_id' => $final_atts['zone_id'] ) ); |
|
680 | + gravityview()->log->error( 'Empty zone configuration for {zone_id}.', array( 'zone_id' => $final_atts[ 'zone_id' ] ) ); |
|
681 | 681 | |
682 | 682 | return NULL; |
683 | 683 | } |
684 | 684 | |
685 | 685 | $field_output = ''; |
686 | 686 | foreach ( $fields as $field ) { |
687 | - $final_atts['field'] = $field; |
|
687 | + $final_atts[ 'field' ] = $field; |
|
688 | 688 | |
689 | 689 | $field_output .= gravityview_field_output( $final_atts ); |
690 | 690 | } |
@@ -701,17 +701,17 @@ discard block |
||
701 | 701 | return NULL; |
702 | 702 | } |
703 | 703 | |
704 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
705 | - $output .= '<div class="'.gravityview_sanitize_html_class( $final_atts['wrapper_class'] ).'">'; |
|
704 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
705 | + $output .= '<div class="' . gravityview_sanitize_html_class( $final_atts[ 'wrapper_class' ] ) . '">'; |
|
706 | 706 | } |
707 | 707 | |
708 | 708 | $output .= $field_output; |
709 | 709 | |
710 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
710 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
711 | 711 | $output .= '</div>'; |
712 | 712 | } |
713 | 713 | |
714 | - if( $echo ) { |
|
714 | + if ( $echo ) { |
|
715 | 715 | echo $output; |
716 | 716 | } |
717 | 717 | |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | */ |
730 | 730 | function locate_template( $template_names, $load = false, $require_once = true ) { |
731 | 731 | |
732 | - if( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
732 | + if ( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
733 | 733 | |
734 | 734 | $located = $this->located_templates[ $template_names ]; |
735 | 735 | |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | // Set $load to always false so we handle it here. |
739 | 739 | $located = parent::locate_template( $template_names, false, $require_once ); |
740 | 740 | |
741 | - if( is_string( $template_names ) ) { |
|
741 | + if ( is_string( $template_names ) ) { |
|
742 | 742 | $this->located_templates[ $template_names ] = $located; |
743 | 743 | } |
744 | 744 | } |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | * @return mixed|null The stored data. |
757 | 757 | */ |
758 | 758 | public function __get( $name ) { |
759 | - if( isset( $this->{$name} ) ) { |
|
759 | + if ( isset( $this->{$name} ) ) { |
|
760 | 760 | return $this->{$name}; |
761 | 761 | } else { |
762 | 762 | return NULL; |
@@ -785,17 +785,17 @@ discard block |
||
785 | 785 | $additional = array(); |
786 | 786 | |
787 | 787 | // form-19-table-body.php |
788 | - $additional[] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
788 | + $additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
789 | 789 | |
790 | - if( $view_id = $this->getViewId() ) { |
|
790 | + if ( $view_id = $this->getViewId() ) { |
|
791 | 791 | // view-3-table-body.php |
792 | - $additional[] = sprintf( 'view-%d-%s-%s.php', $view_id, $slug, $name ); |
|
792 | + $additional[ ] = sprintf( 'view-%d-%s-%s.php', $view_id, $slug, $name ); |
|
793 | 793 | } |
794 | 794 | |
795 | - if( $this->getPostId() ) { |
|
795 | + if ( $this->getPostId() ) { |
|
796 | 796 | |
797 | 797 | // page-19-table-body.php |
798 | - $additional[] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
798 | + $additional[ ] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
799 | 799 | } |
800 | 800 | |
801 | 801 | // Combine with existing table-body.php and table.php |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | |
818 | 818 | gravityview()->log->debug( 'Rendering Template File: {path}', array( 'path' => $template_file ) ); |
819 | 819 | |
820 | - if( !empty( $template_file) ) { |
|
820 | + if ( ! empty( $template_file ) ) { |
|
821 | 821 | |
822 | 822 | if ( $require_once ) { |
823 | 823 | require_once( $template_file ); |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | |
886 | 886 | // Prevent being called twice |
887 | 887 | if ( did_action( "gravityview/widgets/$zone/{$view->ID}/rendered" ) ) { |
888 | - gravityview()->log->debug( 'Not rendering {zone}; already rendered', array( 'zone' => $zone.'_'.$view->ID.'_widgets' ) ); |
|
888 | + gravityview()->log->debug( 'Not rendering {zone}; already rendered', array( 'zone' => $zone . '_' . $view->ID . '_widgets' ) ); |
|
889 | 889 | return; |
890 | 890 | } |
891 | 891 | |
@@ -907,7 +907,7 @@ discard block |
||
907 | 907 | * @param string $zone Current widget zone, either `header` or `footer` |
908 | 908 | * @param array $widgets Array of widget configurations for the current zone, as set by `gravityview_get_current_view_data()['widgets']` |
909 | 909 | */ |
910 | - $css_class = apply_filters('gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets->as_configuration() ); |
|
910 | + $css_class = apply_filters( 'gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets->as_configuration() ); |
|
911 | 911 | |
912 | 912 | $css_class = gravityview_sanitize_html_class( $css_class ); |
913 | 913 | |
@@ -915,15 +915,15 @@ discard block |
||
915 | 915 | ?> |
916 | 916 | <div class="<?php echo $css_class; ?>"> |
917 | 917 | <?php |
918 | - foreach( $rows as $row ) { |
|
919 | - foreach( $row as $col => $areas ) { |
|
918 | + foreach ( $rows as $row ) { |
|
919 | + foreach ( $row as $col => $areas ) { |
|
920 | 920 | $column = ( $col == '2-2' ) ? '1-2 gv-right' : "$col gv-left"; |
921 | 921 | ?> |
922 | 922 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
923 | 923 | <?php |
924 | 924 | if ( ! empty( $areas ) ) { |
925 | 925 | foreach ( $areas as $area ) { |
926 | - foreach ( $widgets->by_position( $zone . '_' . $area['areaid'] )->all() as $widget ) { |
|
926 | + foreach ( $widgets->by_position( $zone . '_' . $area[ 'areaid' ] )->all() as $widget ) { |
|
927 | 927 | do_action( sprintf( 'gravityview/widgets/%s/render', $widget->get_widget_id() ), $widget->configuration->all(), null, $view_id_or_context ); |
928 | 928 | } |
929 | 929 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | } |
93 | 93 | |
94 | 94 | public function __destruct() { |
95 | - remove_filter( $this->filter_prefix . '_get_template_part', $this->_add_id_specific_templates_callback );; |
|
95 | + remove_filter( $this->filter_prefix . '_get_template_part', $this->_add_id_specific_templates_callback ); ; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -175,55 +175,55 @@ discard block |
||
175 | 175 | |
176 | 176 | if ( $is_view && $post ) { |
177 | 177 | if ( $field_type ) { |
178 | - $specifics []= sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $field_type, $slug_name ); |
|
179 | - $inputType && $specifics []= sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $inputType, $slug_name ); |
|
180 | - $specifics []= sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $field_type ); |
|
181 | - $inputType && $specifics []= sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $inputType ); |
|
182 | - $specifics []= sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $field_type, $slug_name ); |
|
183 | - $inputType && $specifics []= sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $inputType, $slug_name ); |
|
184 | - $specifics []= sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $field_type ); |
|
185 | - $inputType && $specifics []= sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $inputType ); |
|
178 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $field_type, $slug_name ); |
|
179 | + $inputType && $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $inputType, $slug_name ); |
|
180 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $field_type ); |
|
181 | + $inputType && $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $inputType ); |
|
182 | + $specifics [ ] = sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $field_type, $slug_name ); |
|
183 | + $inputType && $specifics [ ] = sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $inputType, $slug_name ); |
|
184 | + $specifics [ ] = sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $field_type ); |
|
185 | + $inputType && $specifics [ ] = sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $inputType ); |
|
186 | 186 | } |
187 | 187 | |
188 | - $specifics []= sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $slug_name ); |
|
189 | - $specifics []= sprintf( '%spost-%d-view-%d-field.php', $slug_dir, $post->ID, $view_id ); |
|
190 | - $specifics []= sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
191 | - $specifics []= sprintf( '%spost-%d-field.php', $slug_dir, $post->ID ); |
|
188 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $slug_name ); |
|
189 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-field.php', $slug_dir, $post->ID, $view_id ); |
|
190 | + $specifics [ ] = sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
191 | + $specifics [ ] = sprintf( '%spost-%d-field.php', $slug_dir, $post->ID ); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** Field-specific */ |
195 | 195 | if ( $field_id && $form_id ) { |
196 | 196 | |
197 | 197 | if ( $field_id ) { |
198 | - $specifics []= sprintf( '%sform-%d-field-%d-%s.php', $slug_dir, $form_id, $field_id, $slug_name ); |
|
199 | - $specifics []= sprintf( '%sform-%d-field-%d.php', $slug_dir, $form_id, $field_id ); |
|
198 | + $specifics [ ] = sprintf( '%sform-%d-field-%d-%s.php', $slug_dir, $form_id, $field_id, $slug_name ); |
|
199 | + $specifics [ ] = sprintf( '%sform-%d-field-%d.php', $slug_dir, $form_id, $field_id ); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | if ( $field_type ) { |
203 | - $specifics []= sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $field_type, $slug_name ); |
|
204 | - $inputType && $specifics []= sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $inputType, $slug_name ); |
|
205 | - $specifics []= sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $field_type ); |
|
206 | - $inputType && $specifics []= sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $inputType ); |
|
207 | - |
|
208 | - $specifics []= sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $field_type, $slug_name ); |
|
209 | - $inputType && $specifics []= sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $inputType, $slug_name ); |
|
210 | - $specifics []= sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $field_type ); |
|
211 | - $inputType && $specifics []= sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $inputType ); |
|
212 | - |
|
213 | - $specifics []= sprintf( '%sfield-%s-%s.php', $slug_dir, $field_type, $slug_name ); |
|
214 | - $inputType && $specifics []= sprintf( '%sfield-%s-%s.php', $slug_dir, $inputType, $slug_name ); |
|
215 | - $specifics []= sprintf( '%sfield-%s.php', $slug_dir, $field_type ); |
|
216 | - $inputType && $specifics []= sprintf( '%sfield-%s.php', $slug_dir, $inputType ); |
|
203 | + $specifics [ ] = sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $field_type, $slug_name ); |
|
204 | + $inputType && $specifics [ ] = sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $inputType, $slug_name ); |
|
205 | + $specifics [ ] = sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $field_type ); |
|
206 | + $inputType && $specifics [ ] = sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $inputType ); |
|
207 | + |
|
208 | + $specifics [ ] = sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $field_type, $slug_name ); |
|
209 | + $inputType && $specifics [ ] = sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $inputType, $slug_name ); |
|
210 | + $specifics [ ] = sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $field_type ); |
|
211 | + $inputType && $specifics [ ] = sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $inputType ); |
|
212 | + |
|
213 | + $specifics [ ] = sprintf( '%sfield-%s-%s.php', $slug_dir, $field_type, $slug_name ); |
|
214 | + $inputType && $specifics [ ] = sprintf( '%sfield-%s-%s.php', $slug_dir, $inputType, $slug_name ); |
|
215 | + $specifics [ ] = sprintf( '%sfield-%s.php', $slug_dir, $field_type ); |
|
216 | + $inputType && $specifics [ ] = sprintf( '%sfield-%s.php', $slug_dir, $inputType ); |
|
217 | 217 | } |
218 | 218 | } |
219 | 219 | |
220 | 220 | if ( $form_id ) { |
221 | 221 | /** Generic field templates */ |
222 | - $specifics []= sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $slug_name ); |
|
223 | - $specifics []= sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $slug_name ); |
|
222 | + $specifics [ ] = sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $slug_name ); |
|
223 | + $specifics [ ] = sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $slug_name ); |
|
224 | 224 | |
225 | - $specifics []= sprintf( '%sview-%d-field.php', $slug_dir, $view_id ); |
|
226 | - $specifics []= sprintf( '%sform-%d-field.php', $slug_dir, $form_id ); |
|
225 | + $specifics [ ] = sprintf( '%sview-%d-field.php', $slug_dir, $view_id ); |
|
226 | + $specifics [ ] = sprintf( '%sform-%d-field.php', $slug_dir, $form_id ); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -231,12 +231,12 @@ discard block |
||
231 | 231 | * Ignore some types that conflict. |
232 | 232 | */ |
233 | 233 | if ( ! in_array( $field_type, array( 'notes' ) ) ) { |
234 | - $specifics []= sprintf( '%s.php', $field_type ); |
|
235 | - $specifics []= sprintf( 'fields/%s.php', $field_type ); |
|
234 | + $specifics [ ] = sprintf( '%s.php', $field_type ); |
|
235 | + $specifics [ ] = sprintf( 'fields/%s.php', $field_type ); |
|
236 | 236 | } |
237 | 237 | |
238 | - $specifics []= sprintf( '%sfield-%s.php', $slug_dir, $slug_name ); |
|
239 | - $specifics []= sprintf( '%sfield.php', $slug_dir ); |
|
238 | + $specifics [ ] = sprintf( '%sfield-%s.php', $slug_dir, $slug_name ); |
|
239 | + $specifics [ ] = sprintf( '%sfield.php', $slug_dir ); |
|
240 | 240 | |
241 | 241 | return array_merge( $specifics, $templates ); |
242 | 242 | }; |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | /** Prevent any PHP warnings that may be generated. */ |
267 | 267 | ob_start(); |
268 | 268 | |
269 | - $display_value = \GFCommon::get_lead_field_display( $this->field->field, $value, $this->entry['currency'], false, 'html' ); |
|
269 | + $display_value = \GFCommon::get_lead_field_display( $this->field->field, $value, $this->entry[ 'currency' ], false, 'html' ); |
|
270 | 270 | |
271 | 271 | if ( $errors = ob_get_clean() ) { |
272 | 272 | gravityview()->log->error( 'Errors when calling GFCommon::get_lead_field_display()', array( 'data' => $errors ) ); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | self::$file = plugin_dir_path( __FILE__ ); |
38 | 38 | |
39 | - if( is_admin() ) { |
|
39 | + if ( is_admin() ) { |
|
40 | 40 | $this->load_components( 'admin' ); |
41 | 41 | } |
42 | 42 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | static function getInstance() { |
57 | 57 | |
58 | - if( empty( self::$instance ) ) { |
|
58 | + if ( empty( self::$instance ) ) { |
|
59 | 59 | self::$instance = new GravityView_Edit_Entry; |
60 | 60 | } |
61 | 61 | |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | private function add_hooks() { |
82 | 82 | |
83 | 83 | // Add front-end access to Gravity Forms delete file action |
84 | - add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') ); |
|
84 | + add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file' ) ); |
|
85 | 85 | |
86 | 86 | // Make sure this hook is run for non-admins |
87 | - add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') ); |
|
87 | + add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file' ) ); |
|
88 | 88 | |
89 | 89 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 ); |
90 | 90 | |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | */ |
100 | 100 | private function addon_specific_hooks() { |
101 | 101 | |
102 | - if( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) { |
|
103 | - add_filter('gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script')); |
|
102 | + if ( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) { |
|
103 | + add_filter( 'gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script' ) ); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | } |
@@ -146,15 +146,15 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) { |
148 | 148 | |
149 | - $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id'] ); |
|
149 | + $nonce_key = self::get_nonce_key( $view_id, $entry[ 'form_id' ], $entry[ 'id' ] ); |
|
150 | 150 | |
151 | - $base = gv_entry_link( $entry, $post_id ? : $view_id ); |
|
151 | + $base = gv_entry_link( $entry, $post_id ?: $view_id ); |
|
152 | 152 | |
153 | 153 | $url = add_query_arg( array( |
154 | 154 | 'edit' => wp_create_nonce( $nonce_key ) |
155 | 155 | ), $base ); |
156 | 156 | |
157 | - if( $post_id ) { |
|
157 | + if ( $post_id ) { |
|
158 | 158 | $url = add_query_arg( array( 'gvid' => $view_id ), $url ); |
159 | 159 | } |
160 | 160 | |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | * Allow passing params to dynamically populate entry with values |
163 | 163 | * @since 1.9.2 |
164 | 164 | */ |
165 | - if( !empty( $field_values ) ) { |
|
165 | + if ( ! empty( $field_values ) ) { |
|
166 | 166 | |
167 | - if( is_array( $field_values ) ) { |
|
167 | + if ( is_array( $field_values ) ) { |
|
168 | 168 | // If already an array, no parse_str() needed |
169 | 169 | $params = $field_values; |
170 | 170 | } else { |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function modify_field_blacklist( $fields = array(), $context = NULL ) { |
187 | 187 | |
188 | - if( empty( $context ) || $context !== 'edit' ) { |
|
188 | + if ( empty( $context ) || $context !== 'edit' ) { |
|
189 | 189 | return $fields; |
190 | 190 | } |
191 | 191 | |
@@ -246,25 +246,25 @@ discard block |
||
246 | 246 | // If they can edit any entries (as defined in Gravity Forms) |
247 | 247 | // Or if they can edit other people's entries |
248 | 248 | // Then we're good. |
249 | - if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) { |
|
249 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry[ 'id' ] ) ) { |
|
250 | 250 | |
251 | 251 | gravityview()->log->debug( 'User has ability to edit all entries.' ); |
252 | 252 | |
253 | 253 | $user_can_edit = true; |
254 | 254 | |
255 | - } else if( !isset( $entry['created_by'] ) ) { |
|
255 | + } else if ( ! isset( $entry[ 'created_by' ] ) ) { |
|
256 | 256 | |
257 | - gravityview()->log->error( 'Entry `created_by` doesn\'t exist.'); |
|
257 | + gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' ); |
|
258 | 258 | |
259 | 259 | $user_can_edit = false; |
260 | 260 | |
261 | 261 | } else { |
262 | 262 | |
263 | 263 | // get user_edit setting |
264 | - if( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) { |
|
264 | + if ( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) { |
|
265 | 265 | // if View ID not specified or is the current view |
266 | 266 | // @deprecated path |
267 | - $user_edit = GravityView_View::getInstance()->getAtts('user_edit'); |
|
267 | + $user_edit = GravityView_View::getInstance()->getAtts( 'user_edit' ); |
|
268 | 268 | } else { |
269 | 269 | // in case is specified and not the current view |
270 | 270 | $user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' ); |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | $current_user = wp_get_current_user(); |
274 | 274 | |
275 | 275 | // User edit is disabled |
276 | - if( empty( $user_edit ) ) { |
|
276 | + if ( empty( $user_edit ) ) { |
|
277 | 277 | |
278 | 278 | gravityview()->log->debug( 'User Edit is disabled. Returning false.' ); |
279 | 279 | |
@@ -281,13 +281,13 @@ discard block |
||
281 | 281 | } |
282 | 282 | |
283 | 283 | // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good. |
284 | - else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
284 | + else if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) { |
|
285 | 285 | |
286 | 286 | gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) ); |
287 | 287 | |
288 | 288 | $user_can_edit = true; |
289 | 289 | |
290 | - } else if( ! is_user_logged_in() ) { |
|
290 | + } else if ( ! is_user_logged_in() ) { |
|
291 | 291 | |
292 | 292 | gravityview()->log->debug( 'No user defined; edit entry requires logged in user' ); |
293 | 293 | } |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | private function __construct() {} |
86 | 86 | |
87 | 87 | private function initialize() { |
88 | - add_action( 'wp', array( $this, 'parse_content'), 11 ); |
|
88 | + add_action( 'wp', array( $this, 'parse_content' ), 11 ); |
|
89 | 89 | add_filter( 'parse_query', array( $this, 'parse_query_fix_frontpage' ), 10 ); |
90 | - add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 ); |
|
90 | + add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 ); |
|
91 | 91 | |
92 | 92 | // Enqueue scripts and styles after GravityView_Template::register_styles() |
93 | 93 | add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 ); |
@@ -236,12 +236,12 @@ discard block |
||
236 | 236 | |
237 | 237 | $this->context_view_id = $view_id; |
238 | 238 | |
239 | - } elseif ( isset( $_GET['gvid'] ) && $multiple_views ) { |
|
239 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $multiple_views ) { |
|
240 | 240 | /** |
241 | 241 | * used on a has_multiple_views context |
242 | 242 | * @see GravityView_API::entry_link |
243 | 243 | */ |
244 | - $this->context_view_id = $_GET['gvid']; |
|
244 | + $this->context_view_id = $_GET[ 'gvid' ]; |
|
245 | 245 | |
246 | 246 | } elseif ( ! $multiple_views ) { |
247 | 247 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
@@ -278,25 +278,25 @@ discard block |
||
278 | 278 | global $wp_rewrite; |
279 | 279 | |
280 | 280 | $is_front_page = ( $query->is_home || $query->is_page ); |
281 | - $show_on_front = ( 'page' === get_option('show_on_front') ); |
|
282 | - $front_page_id = get_option('page_on_front'); |
|
281 | + $show_on_front = ( 'page' === get_option( 'show_on_front' ) ); |
|
282 | + $front_page_id = get_option( 'page_on_front' ); |
|
283 | 283 | |
284 | - if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
284 | + if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
285 | 285 | |
286 | 286 | // Force to be an array, potentially a query string ( entry=16 ) |
287 | 287 | $_query = wp_parse_args( $query->query ); |
288 | 288 | |
289 | 289 | // pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename. |
290 | - if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) { |
|
291 | - unset( $_query['pagename'] ); |
|
290 | + if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) { |
|
291 | + unset( $_query[ 'pagename' ] ); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | // this is where will break from core wordpress |
295 | 295 | /** @internal Don't use this filter; it will be unnecessary soon - it's just a patch for specific use case */ |
296 | 296 | $ignore = apply_filters( 'gravityview/internal/ignored_endpoints', array( 'preview', 'page', 'paged', 'cpage' ), $query ); |
297 | 297 | $endpoints = \GV\Utils::get( $wp_rewrite, 'endpoints' ); |
298 | - foreach ( (array) $endpoints as $endpoint ) { |
|
299 | - $ignore[] = $endpoint[1]; |
|
298 | + foreach ( (array)$endpoints as $endpoint ) { |
|
299 | + $ignore[ ] = $endpoint[ 1 ]; |
|
300 | 300 | } |
301 | 301 | unset( $endpoints ); |
302 | 302 | |
@@ -306,21 +306,21 @@ discard block |
||
306 | 306 | // - The query includes keys that are associated with registered endpoints. `entry`, for example. |
307 | 307 | if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) { |
308 | 308 | |
309 | - $qv =& $query->query_vars; |
|
309 | + $qv = & $query->query_vars; |
|
310 | 310 | |
311 | 311 | // Prevent redirect when on the single entry endpoint |
312 | - if( self::is_single_entry() ) { |
|
312 | + if ( self::is_single_entry() ) { |
|
313 | 313 | add_filter( 'redirect_canonical', '__return_false' ); |
314 | 314 | } |
315 | 315 | |
316 | 316 | $query->is_page = true; |
317 | 317 | $query->is_home = false; |
318 | - $qv['page_id'] = $front_page_id; |
|
318 | + $qv[ 'page_id' ] = $front_page_id; |
|
319 | 319 | |
320 | 320 | // Correct <!--nextpage--> for page_on_front |
321 | - if ( ! empty( $qv['paged'] ) ) { |
|
322 | - $qv['page'] = $qv['paged']; |
|
323 | - unset( $qv['paged'] ); |
|
321 | + if ( ! empty( $qv[ 'paged' ] ) ) { |
|
322 | + $qv[ 'page' ] = $qv[ 'paged' ]; |
|
323 | + unset( $qv[ 'paged' ] ); |
|
324 | 324 | } |
325 | 325 | } |
326 | 326 | |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | |
351 | 351 | $this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); |
352 | 352 | |
353 | - $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); |
|
353 | + $post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null ); |
|
354 | 354 | $this->setPostId( $post_id ); |
355 | 355 | $post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; |
356 | 356 | $this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | |
387 | 387 | $search_method = GravityView_Widget_Search::getInstance()->get_search_method(); |
388 | 388 | |
389 | - if( 'post' === $search_method ) { |
|
389 | + if ( 'post' === $search_method ) { |
|
390 | 390 | $get = $_POST; |
391 | 391 | } else { |
392 | 392 | $get = $_GET; |
@@ -443,20 +443,20 @@ discard block |
||
443 | 443 | * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop |
444 | 444 | * @param array $entry Current entry |
445 | 445 | */ |
446 | - $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry ); |
|
446 | + $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry ); |
|
447 | 447 | |
448 | 448 | if ( ! $apply_outside_loop ) { |
449 | 449 | return $title; |
450 | 450 | } |
451 | 451 | |
452 | 452 | // User reported WooCommerce doesn't pass two args. |
453 | - if ( empty( $passed_post_id ) ) { |
|
453 | + if ( empty( $passed_post_id ) ) { |
|
454 | 454 | return $title; |
455 | 455 | } |
456 | 456 | |
457 | 457 | // Don't modify the title for anything other than the current view/post. |
458 | 458 | // This is true for embedded shortcodes and Views. |
459 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
459 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
460 | 460 | return $title; |
461 | 461 | } |
462 | 462 | |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | $view_meta = $this->getGvOutputData()->get_view( $context_view_id ); |
469 | 469 | } else { |
470 | 470 | foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { |
471 | - if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) { |
|
471 | + if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) { |
|
472 | 472 | $view_meta = $view_data; |
473 | 473 | break; |
474 | 474 | } |
@@ -476,12 +476,12 @@ discard block |
||
476 | 476 | } |
477 | 477 | |
478 | 478 | /** Deprecated stuff in the future. See the branch above. */ |
479 | - if ( ! empty( $view_meta['atts']['single_title'] ) ) { |
|
479 | + if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) { |
|
480 | 480 | |
481 | - $title = $view_meta['atts']['single_title']; |
|
481 | + $title = $view_meta[ 'atts' ][ 'single_title' ]; |
|
482 | 482 | |
483 | 483 | // We are allowing HTML in the fields, so no escaping the output |
484 | - $title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry ); |
|
484 | + $title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry ); |
|
485 | 485 | |
486 | 486 | $title = do_shortcode( $title ); |
487 | 487 | } |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | |
553 | 553 | $context = GravityView_View::getInstance()->getContext(); |
554 | 554 | |
555 | - switch( $context ) { |
|
555 | + switch ( $context ) { |
|
556 | 556 | case 'directory': |
557 | 557 | $tab = __( 'Multiple Entries', 'gravityview' ); |
558 | 558 | break; |
@@ -566,12 +566,12 @@ discard block |
||
566 | 566 | } |
567 | 567 | |
568 | 568 | |
569 | - $title = sprintf( esc_html_x('The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab ); |
|
569 | + $title = sprintf( esc_html_x( 'The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab ); |
|
570 | 570 | $edit_link = admin_url( sprintf( 'post.php?post=%d&action=edit#%s-view', $view_id, $context ) ); |
571 | - $action_text = sprintf( esc_html__('Add fields to %s', 'gravityview' ), $tab ); |
|
571 | + $action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab ); |
|
572 | 572 | $message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' ); |
573 | 573 | |
574 | - $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url(plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) ); |
|
574 | + $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) ); |
|
575 | 575 | $output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message ); |
576 | 576 | |
577 | 577 | echo GVCommon::generate_notice( $output . $image, 'gv-error error', 'edit_gravityview', $view_id ); |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | $direct_access = apply_filters( 'gravityview_direct_access', true, $view->ID ); |
620 | 620 | $embed_only = $view->settings->get( 'embed_only' ); |
621 | 621 | |
622 | - if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
622 | + if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
623 | 623 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
624 | 624 | } |
625 | 625 | |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | $datetime_format = 'Y-m-d H:i:s'; |
667 | 667 | $search_is_outside_view_bounds = false; |
668 | 668 | |
669 | - if( ! empty( $search_criteria[ $key ] ) ) { |
|
669 | + if ( ! empty( $search_criteria[ $key ] ) ) { |
|
670 | 670 | |
671 | 671 | $search_date = strtotime( $search_criteria[ $key ] ); |
672 | 672 | |
@@ -694,14 +694,14 @@ discard block |
||
694 | 694 | if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
695 | 695 | |
696 | 696 | // Then we override the search and re-set the start date |
697 | - $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
697 | + $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); |
|
698 | 698 | } |
699 | 699 | } |
700 | 700 | } |
701 | 701 | |
702 | - if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
702 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
703 | 703 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
704 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
704 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
705 | 705 | gravityview()->log->error( 'Invalid search: the start date is after the end date.', array( 'data' => $return_search_criteria ) ); |
706 | 706 | } |
707 | 707 | } |
@@ -720,19 +720,19 @@ discard block |
||
720 | 720 | public static function process_search_only_approved( $args, $search_criteria ) { |
721 | 721 | |
722 | 722 | /** @since 1.19 */ |
723 | - if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
723 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
724 | 724 | gravityview()->log->debug( 'User can moderate entries; showing all approval statuses' ); |
725 | 725 | return $search_criteria; |
726 | 726 | } |
727 | 727 | |
728 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
728 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
729 | 729 | |
730 | - $search_criteria['field_filters'][] = array( |
|
730 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
731 | 731 | 'key' => GravityView_Entry_Approval::meta_key, |
732 | 732 | 'value' => GravityView_Entry_Approval_Status::APPROVED |
733 | 733 | ); |
734 | 734 | |
735 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
735 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
736 | 736 | |
737 | 737 | gravityview()->log->debug( '[process_search_only_approved] Search Criteria if show only approved: ', array( 'data' => $search_criteria ) ); |
738 | 738 | } |
@@ -759,18 +759,18 @@ discard block |
||
759 | 759 | */ |
760 | 760 | public static function is_entry_approved( $entry, $args = array() ) { |
761 | 761 | |
762 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
762 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
763 | 763 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
764 | 764 | return true; |
765 | 765 | } |
766 | 766 | |
767 | 767 | /** @since 1.19 */ |
768 | - if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
768 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
769 | 769 | gravityview()->log->debug( 'User can moderate entries, so entry is approved for viewing' ); |
770 | 770 | return true; |
771 | 771 | } |
772 | 772 | |
773 | - $is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key ); |
|
773 | + $is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key ); |
|
774 | 774 | |
775 | 775 | return GravityView_Entry_Approval_Status::is_approved( $is_approved ); |
776 | 776 | } |
@@ -794,7 +794,7 @@ discard block |
||
794 | 794 | * Compatibility with filters hooking in `gravityview_search_criteria` instead of `gravityview_fe_search_criteria`. |
795 | 795 | */ |
796 | 796 | $criteria = apply_filters( 'gravityview_search_criteria', array(), array( $form_id ), \GV\Utils::get( $args, 'id' ) ); |
797 | - $search_criteria = isset( $criteria['search_criteria'] ) ? $criteria['search_criteria'] : array( 'field_filters' => array() ); |
|
797 | + $search_criteria = isset( $criteria[ 'search_criteria' ] ) ? $criteria[ 'search_criteria' ] : array( 'field_filters' => array() ); |
|
798 | 798 | |
799 | 799 | /** |
800 | 800 | * @filter `gravityview_fe_search_criteria` Modify the search criteria |
@@ -810,29 +810,29 @@ discard block |
||
810 | 810 | gravityview()->log->debug( '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', array( 'data' =>$search_criteria ) ); |
811 | 811 | |
812 | 812 | // implicity search |
813 | - if ( ! empty( $args['search_value'] ) ) { |
|
813 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
814 | 814 | |
815 | 815 | // Search operator options. Options: `is` or `contains` |
816 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
816 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
817 | 817 | |
818 | - $search_criteria['field_filters'][] = array( |
|
818 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
819 | 819 | 'key' => \GV\Utils::_GET( 'search_field', \GV\Utils::get( $args, 'search_field' ) ), // The field ID to search |
820 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
820 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
821 | 821 | 'operator' => $operator, |
822 | 822 | ); |
823 | 823 | |
824 | 824 | // Lock search mode to "all" with implicit presearch filter. |
825 | - $search_criteria['field_filters']['mode'] = 'all'; |
|
825 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; |
|
826 | 826 | } |
827 | 827 | |
828 | - if( $search_criteria !== $original_search_criteria ) { |
|
828 | + if ( $search_criteria !== $original_search_criteria ) { |
|
829 | 829 | gravityview()->log->debug( '[get_search_criteria] Search Criteria after implicity search: ', array( 'data' => $search_criteria ) ); |
830 | 830 | } |
831 | 831 | |
832 | 832 | // Handle setting date range |
833 | 833 | $search_criteria = self::process_search_dates( $args, $search_criteria ); |
834 | 834 | |
835 | - if( $search_criteria !== $original_search_criteria ) { |
|
835 | + if ( $search_criteria !== $original_search_criteria ) { |
|
836 | 836 | gravityview()->log->debug( '[get_search_criteria] Search Criteria after date params: ', array( 'data' => $search_criteria ) ); |
837 | 837 | } |
838 | 838 | |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
844 | 844 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
845 | 845 | */ |
846 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
846 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
847 | 847 | |
848 | 848 | return $search_criteria; |
849 | 849 | } |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | 'search_criteria' => $search_criteria, |
957 | 957 | 'sorting' => self::updateViewSorting( $args, $form_id ), |
958 | 958 | 'paging' => $paging, |
959 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
959 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
960 | 960 | ); |
961 | 961 | |
962 | 962 | /** |
@@ -981,7 +981,7 @@ discard block |
||
981 | 981 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
982 | 982 | * @param array $args View configuration args. |
983 | 983 | */ |
984 | - $parameters = apply_filters( 'gravityview_get_entries_'.\GV\Utils::get( $args, 'id' ), $parameters, $args, $form_id ); |
|
984 | + $parameters = apply_filters( 'gravityview_get_entries_' . \GV\Utils::get( $args, 'id' ), $parameters, $args, $form_id ); |
|
985 | 985 | |
986 | 986 | gravityview()->log->debug( '$parameters passed to gravityview_get_entries(): ', array( 'data' => $parameters ) ); |
987 | 987 | |
@@ -1006,17 +1006,17 @@ discard block |
||
1006 | 1006 | $default_page_size = apply_filters( 'gravityview_default_page_size', 25 ); |
1007 | 1007 | |
1008 | 1008 | // Paging & offset |
1009 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size; |
|
1009 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : $default_page_size; |
|
1010 | 1010 | |
1011 | 1011 | if ( -1 === $page_size ) { |
1012 | 1012 | $page_size = PHP_INT_MAX; |
1013 | 1013 | } |
1014 | 1014 | |
1015 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
1015 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
1016 | 1016 | $offset = ( $curr_page - 1 ) * $page_size; |
1017 | 1017 | |
1018 | - if ( ! empty( $args['offset'] ) ) { |
|
1019 | - $offset += intval( $args['offset'] ); |
|
1018 | + if ( ! empty( $args[ 'offset' ] ) ) { |
|
1019 | + $offset += intval( $args[ 'offset' ] ); |
|
1020 | 1020 | } |
1021 | 1021 | |
1022 | 1022 | $paging = array( |
@@ -1040,8 +1040,8 @@ discard block |
||
1040 | 1040 | */ |
1041 | 1041 | public static function updateViewSorting( $args, $form_id ) { |
1042 | 1042 | $sorting = array(); |
1043 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : \GV\Utils::get( $args, 'sort_field' ); |
|
1044 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : \GV\Utils::get( $args, 'sort_direction' ); |
|
1043 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : \GV\Utils::get( $args, 'sort_field' ); |
|
1044 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : \GV\Utils::get( $args, 'sort_direction' ); |
|
1045 | 1045 | |
1046 | 1046 | $sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id ); |
1047 | 1047 | |
@@ -1058,12 +1058,12 @@ discard block |
||
1058 | 1058 | $form = GFAPI::get_form( $form_id ); |
1059 | 1059 | |
1060 | 1060 | // Get the first GF_Field field ID, set as the key for entry randomization |
1061 | - if( ! empty( $form['fields'] ) ) { |
|
1061 | + if ( ! empty( $form[ 'fields' ] ) ) { |
|
1062 | 1062 | |
1063 | 1063 | /** @var GF_Field $field */ |
1064 | - foreach ( $form['fields'] as $field ) { |
|
1064 | + foreach ( $form[ 'fields' ] as $field ) { |
|
1065 | 1065 | |
1066 | - if( ! is_a( $field, 'GF_Field' ) ) { |
|
1066 | + if ( ! is_a( $field, 'GF_Field' ) ) { |
|
1067 | 1067 | continue; |
1068 | 1068 | } |
1069 | 1069 | |
@@ -1107,11 +1107,11 @@ discard block |
||
1107 | 1107 | |
1108 | 1108 | $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
1109 | 1109 | |
1110 | - if( ! $sort_field ) { |
|
1110 | + if ( ! $sort_field ) { |
|
1111 | 1111 | return $sort_field_id; |
1112 | 1112 | } |
1113 | 1113 | |
1114 | - switch ( $sort_field['type'] ) { |
|
1114 | + switch ( $sort_field[ 'type' ] ) { |
|
1115 | 1115 | |
1116 | 1116 | case 'address': |
1117 | 1117 | // Sorting by full address |
@@ -1128,7 +1128,7 @@ discard block |
||
1128 | 1128 | */ |
1129 | 1129 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
1130 | 1130 | |
1131 | - switch( strtolower( $address_part ) ){ |
|
1131 | + switch ( strtolower( $address_part ) ) { |
|
1132 | 1132 | case 'street': |
1133 | 1133 | $sort_field_id .= '.1'; |
1134 | 1134 | break; |
@@ -1208,7 +1208,7 @@ discard block |
||
1208 | 1208 | */ |
1209 | 1209 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
1210 | 1210 | |
1211 | - if ( empty( $single_entry ) ){ |
|
1211 | + if ( empty( $single_entry ) ) { |
|
1212 | 1212 | return false; |
1213 | 1213 | } else { |
1214 | 1214 | return $single_entry; |
@@ -1230,7 +1230,7 @@ discard block |
||
1230 | 1230 | $views = $this->getGvOutputData()->get_views(); |
1231 | 1231 | |
1232 | 1232 | foreach ( $views as $view_id => $data ) { |
1233 | - $view = \GV\View::by_id( $data['id'] ); |
|
1233 | + $view = \GV\View::by_id( $data[ 'id' ] ); |
|
1234 | 1234 | $view_id = $view->ID; |
1235 | 1235 | $template_id = gravityview_get_template_id( $view->ID ); |
1236 | 1236 | $data = $view->as_data(); |
@@ -1239,7 +1239,7 @@ discard block |
||
1239 | 1239 | * Don't enqueue the scripts or styles if it's not going to be displayed. |
1240 | 1240 | * @since 1.15 |
1241 | 1241 | */ |
1242 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1242 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1243 | 1243 | continue; |
1244 | 1244 | } |
1245 | 1245 | |
@@ -1256,13 +1256,13 @@ discard block |
||
1256 | 1256 | * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox` |
1257 | 1257 | * @param string $script_slug If you want to use a different lightbox script, return the name of it here. |
1258 | 1258 | */ |
1259 | - $js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
1259 | + $js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
1260 | 1260 | |
1261 | 1261 | /** |
1262 | 1262 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
1263 | 1263 | * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here. |
1264 | 1264 | */ |
1265 | - $css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
1265 | + $css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
1266 | 1266 | } |
1267 | 1267 | |
1268 | 1268 | /** |
@@ -1270,19 +1270,19 @@ discard block |
||
1270 | 1270 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
1271 | 1271 | * @since 1.15 |
1272 | 1272 | */ |
1273 | - if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
1274 | - $css_dependencies[] = 'dashicons'; |
|
1273 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
1274 | + $css_dependencies[ ] = 'dashicons'; |
|
1275 | 1275 | } |
1276 | 1276 | |
1277 | 1277 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
1278 | 1278 | |
1279 | 1279 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
1280 | 1280 | |
1281 | - wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true ); |
|
1281 | + wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ), GravityView_Plugin::version, true ); |
|
1282 | 1282 | |
1283 | 1283 | wp_enqueue_script( 'gravityview-fe-view' ); |
1284 | 1284 | |
1285 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
1285 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
1286 | 1286 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
1287 | 1287 | } |
1288 | 1288 | |
@@ -1345,7 +1345,7 @@ discard block |
||
1345 | 1345 | public static function add_style( $template_id ) { |
1346 | 1346 | |
1347 | 1347 | if ( ! empty( $template_id ) && wp_style_is( 'gravityview_style_' . $template_id, 'registered' ) ) { |
1348 | - gravityview()->log->debug( 'Adding extra template style for {template_id}', array( 'template_id' => $template_id ) ); |
|
1348 | + gravityview()->log->debug( 'Adding extra template style for {template_id}', array( 'template_id' => $template_id ) ); |
|
1349 | 1349 | wp_enqueue_style( 'gravityview_style_' . $template_id ); |
1350 | 1350 | } elseif ( empty( $template_id ) ) { |
1351 | 1351 | gravityview()->log->error( 'Cannot add template style; template_id is empty' ); |
@@ -1376,11 +1376,11 @@ discard block |
||
1376 | 1376 | * Not a table-based template; don't add sort icons |
1377 | 1377 | * @since 1.12 |
1378 | 1378 | */ |
1379 | - if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1379 | + if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1380 | 1380 | return $label; |
1381 | 1381 | } |
1382 | 1382 | |
1383 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
1383 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
1384 | 1384 | return $label; |
1385 | 1385 | } |
1386 | 1386 | |
@@ -1388,29 +1388,29 @@ discard block |
||
1388 | 1388 | |
1389 | 1389 | $class = 'gv-sort'; |
1390 | 1390 | |
1391 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
1391 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
1392 | 1392 | |
1393 | 1393 | $sort_args = array( |
1394 | - 'sort' => $field['id'], |
|
1394 | + 'sort' => $field[ 'id' ], |
|
1395 | 1395 | 'dir' => 'asc', |
1396 | 1396 | ); |
1397 | 1397 | |
1398 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
1398 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
1399 | 1399 | //toggle sorting direction. |
1400 | - if ( 'asc' === $sorting['direction'] ) { |
|
1401 | - $sort_args['dir'] = 'desc'; |
|
1400 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
1401 | + $sort_args[ 'dir' ] = 'desc'; |
|
1402 | 1402 | $class .= ' gv-icon-sort-desc'; |
1403 | 1403 | } else { |
1404 | - $sort_args['dir'] = 'asc'; |
|
1404 | + $sort_args[ 'dir' ] = 'asc'; |
|
1405 | 1405 | $class .= ' gv-icon-sort-asc'; |
1406 | 1406 | } |
1407 | 1407 | } else { |
1408 | 1408 | $class .= ' gv-icon-caret-up-down'; |
1409 | 1409 | } |
1410 | 1410 | |
1411 | - $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
1411 | + $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
1412 | 1412 | |
1413 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
1413 | + return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
1414 | 1414 | |
1415 | 1415 | } |
1416 | 1416 | |
@@ -1428,7 +1428,7 @@ discard block |
||
1428 | 1428 | |
1429 | 1429 | $field_type = $field_id; |
1430 | 1430 | |
1431 | - if( is_numeric( $field_id ) ) { |
|
1431 | + if ( is_numeric( $field_id ) ) { |
|
1432 | 1432 | $field = GFFormsModel::get_field( $form, $field_id ); |
1433 | 1433 | $field_type = $field->type; |
1434 | 1434 | } |
@@ -1451,7 +1451,7 @@ discard block |
||
1451 | 1451 | return false; |
1452 | 1452 | } |
1453 | 1453 | |
1454 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1454 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1455 | 1455 | |
1456 | 1456 | } |
1457 | 1457 |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | 'type' => 'radio', |
65 | 65 | 'full_width' => true, |
66 | 66 | 'label' => esc_html__( 'Search Mode', 'gravityview' ), |
67 | - 'desc' => __('Should search results match all search fields, or any?', 'gravityview'), |
|
67 | + 'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ), |
|
68 | 68 | 'value' => 'any', |
69 | 69 | 'class' => 'hide-if-js', |
70 | 70 | 'options' => array( |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | // admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999 |
88 | 88 | add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 ); |
89 | - add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') ); |
|
89 | + add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
90 | 90 | add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
91 | 91 | |
92 | 92 | // ajax - get the searchable fields |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
225 | 225 | $script_source = empty( $script_min ) ? '/source' : ''; |
226 | 226 | |
227 | - wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version ); |
|
227 | + wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version ); |
|
228 | 228 | |
229 | 229 | wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array( |
230 | 230 | 'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ), |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * @return array Scripts allowed in no-conflict mode, plus the search widget script |
247 | 247 | */ |
248 | 248 | public function register_no_conflict( $allowed ) { |
249 | - $allowed[] = 'gravityview_searchwidget_admin'; |
|
249 | + $allowed[ ] = 'gravityview_searchwidget_admin'; |
|
250 | 250 | return $allowed; |
251 | 251 | } |
252 | 252 | |
@@ -259,24 +259,24 @@ discard block |
||
259 | 259 | */ |
260 | 260 | public static function get_searchable_fields() { |
261 | 261 | |
262 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) { |
|
262 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) { |
|
263 | 263 | exit( '0' ); |
264 | 264 | } |
265 | 265 | |
266 | 266 | $form = ''; |
267 | 267 | |
268 | 268 | // Fetch the form for the current View |
269 | - if ( ! empty( $_POST['view_id'] ) ) { |
|
269 | + if ( ! empty( $_POST[ 'view_id' ] ) ) { |
|
270 | 270 | |
271 | - $form = gravityview_get_form_id( $_POST['view_id'] ); |
|
271 | + $form = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
272 | 272 | |
273 | - } elseif ( ! empty( $_POST['formid'] ) ) { |
|
273 | + } elseif ( ! empty( $_POST[ 'formid' ] ) ) { |
|
274 | 274 | |
275 | - $form = (int) $_POST['formid']; |
|
275 | + $form = (int)$_POST[ 'formid' ]; |
|
276 | 276 | |
277 | - } elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
277 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
278 | 278 | |
279 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
279 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
280 | 280 | |
281 | 281 | } |
282 | 282 | |
@@ -325,8 +325,8 @@ discard block |
||
325 | 325 | ), |
326 | 326 | ); |
327 | 327 | |
328 | - foreach( $custom_fields as $custom_field_key => $custom_field ) { |
|
329 | - $output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field['type'], self::get_field_label( array('field' => $custom_field_key ) ), $custom_field['text'] ); |
|
328 | + foreach ( $custom_fields as $custom_field_key => $custom_field ) { |
|
329 | + $output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field[ 'type' ], self::get_field_label( array( 'field' => $custom_field_key ) ), $custom_field[ 'text' ] ); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | // Get fields with sub-inputs and no parent |
@@ -348,13 +348,13 @@ discard block |
||
348 | 348 | |
349 | 349 | foreach ( $fields as $id => $field ) { |
350 | 350 | |
351 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
351 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
352 | 352 | continue; |
353 | 353 | } |
354 | 354 | |
355 | - $types = self::get_search_input_types( $id, $field['type'] ); |
|
355 | + $types = self::get_search_input_types( $id, $field[ 'type' ] ); |
|
356 | 356 | |
357 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>'; |
|
357 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>'; |
|
358 | 358 | } |
359 | 359 | } |
360 | 360 | |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | public static function get_search_input_types( $field_id = '', $field_type = null ) { |
378 | 378 | |
379 | 379 | // @todo - This needs to be improved - many fields have . including products and addresses |
380 | - if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) { |
|
380 | + if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) { |
|
381 | 381 | $input_type = 'boolean'; // on/off checkbox |
382 | 382 | } elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) { |
383 | 383 | $input_type = 'multi'; //multiselect |
@@ -421,19 +421,19 @@ discard block |
||
421 | 421 | $post_id = 0; |
422 | 422 | |
423 | 423 | // We're in the WordPress Widget context, and an overriding post ID has been set. |
424 | - if ( ! empty( $widget_args['post_id'] ) ) { |
|
425 | - $post_id = absint( $widget_args['post_id'] ); |
|
424 | + if ( ! empty( $widget_args[ 'post_id' ] ) ) { |
|
425 | + $post_id = absint( $widget_args[ 'post_id' ] ); |
|
426 | 426 | } |
427 | 427 | // We're in the WordPress Widget context, and the base View ID should be used |
428 | - else if ( ! empty( $widget_args['view_id'] ) ) { |
|
429 | - $post_id = absint( $widget_args['view_id'] ); |
|
428 | + else if ( ! empty( $widget_args[ 'view_id' ] ) ) { |
|
429 | + $post_id = absint( $widget_args[ 'view_id' ] ); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | $args = gravityview_get_permalink_query_args( $post_id ); |
433 | 433 | |
434 | 434 | // Add hidden fields to the search form |
435 | 435 | foreach ( $args as $key => $value ) { |
436 | - $search_fields[] = array( |
|
436 | + $search_fields[ ] = array( |
|
437 | 437 | 'name' => $key, |
438 | 438 | 'input' => 'hidden', |
439 | 439 | 'value' => $value, |
@@ -472,22 +472,22 @@ discard block |
||
472 | 472 | /** |
473 | 473 | * Include the sidebar Widgets. |
474 | 474 | */ |
475 | - $widgets = (array) get_option( 'widget_gravityview_search', array() ); |
|
475 | + $widgets = (array)get_option( 'widget_gravityview_search', array() ); |
|
476 | 476 | |
477 | 477 | foreach ( $widgets as $widget ) { |
478 | - if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) { |
|
479 | - if( $_fields = json_decode( $widget['search_fields'], true ) ) { |
|
478 | + if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) { |
|
479 | + if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) { |
|
480 | 480 | foreach ( $_fields as $field ) { |
481 | - $searchable_fields [] = $with_full_field ? $field : $field['field']; |
|
481 | + $searchable_fields [ ] = $with_full_field ? $field : $field[ 'field' ]; |
|
482 | 482 | } |
483 | 483 | } |
484 | 484 | } |
485 | 485 | } |
486 | 486 | |
487 | 487 | foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) { |
488 | - if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) { |
|
488 | + if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) { |
|
489 | 489 | foreach ( $_fields as $field ) { |
490 | - $searchable_fields [] = $with_full_field ? $field : $field['field']; |
|
490 | + $searchable_fields [ ] = $with_full_field ? $field : $field[ 'field' ]; |
|
491 | 491 | } |
492 | 492 | } |
493 | 493 | } |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | */ |
505 | 505 | public function filter_entries( $search_criteria, $form_id = null, $args = array() ) { |
506 | 506 | |
507 | - if( 'post' === $this->search_method ) { |
|
507 | + if ( 'post' === $this->search_method ) { |
|
508 | 508 | $get = $_POST; |
509 | 509 | } else { |
510 | 510 | $get = $_GET; |
@@ -523,14 +523,14 @@ discard block |
||
523 | 523 | $get = gv_map_deep( $get, 'rawurldecode' ); |
524 | 524 | |
525 | 525 | // Make sure array key is set up |
526 | - $search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() ); |
|
526 | + $search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() ); |
|
527 | 527 | |
528 | 528 | $searchable_fields = $this->get_view_searchable_fields( $view ); |
529 | 529 | |
530 | 530 | // add free search |
531 | - if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) { |
|
531 | + if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) { |
|
532 | 532 | |
533 | - $search_all_value = trim( $get['gv_search'] ); |
|
533 | + $search_all_value = trim( $get[ 'gv_search' ] ); |
|
534 | 534 | |
535 | 535 | /** |
536 | 536 | * @filter `gravityview/search-all-split-words` Search for each word separately or the whole phrase? |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | } |
556 | 556 | |
557 | 557 | foreach ( $words as $word ) { |
558 | - $search_criteria['field_filters'][] = array( |
|
558 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
559 | 559 | 'key' => null, // The field ID to search |
560 | 560 | 'value' => $word, // The value to search |
561 | 561 | 'operator' => 'contains', // What to search in. Options: `is` or `contains` |
@@ -565,19 +565,19 @@ discard block |
||
565 | 565 | |
566 | 566 | // start date & end date |
567 | 567 | if ( in_array( 'entry_date', $searchable_fields ) ) { |
568 | - $curr_start = !empty( $get['gv_start'] ) ? $get['gv_start'] : ''; |
|
569 | - $curr_end = !empty( $get['gv_start'] ) ? $get['gv_end'] : ''; |
|
568 | + $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : ''; |
|
569 | + $curr_end = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_end' ] : ''; |
|
570 | 570 | |
571 | 571 | if ( $view ) { |
572 | 572 | /** |
573 | 573 | * Override start and end dates if View is limited to some already. |
574 | 574 | */ |
575 | - if ( $start_date =$view->settings->get( 'start_date' ) ) { |
|
575 | + if ( $start_date = $view->settings->get( 'start_date' ) ) { |
|
576 | 576 | if ( $start_timestamp = strtotime( $curr_start ) ) { |
577 | 577 | $curr_start = $start_timestamp < strtotime( $start_date ) ? $start_date : $curr_start; |
578 | 578 | } |
579 | 579 | } |
580 | - if ( $end_date =$view->settings->get( 'end_date' ) ) { |
|
580 | + if ( $end_date = $view->settings->get( 'end_date' ) ) { |
|
581 | 581 | if ( $end_timestamp = strtotime( $curr_end ) ) { |
582 | 582 | $curr_end = $end_timestamp > strtotime( $end_date ) ? $end_date : $curr_end; |
583 | 583 | } |
@@ -598,22 +598,22 @@ discard block |
||
598 | 598 | */ |
599 | 599 | if ( ! empty( $curr_start ) ) { |
600 | 600 | $curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) ); |
601 | - $search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
601 | + $search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | if ( ! empty( $curr_end ) ) { |
605 | 605 | // Fast-forward 24 hour on the end time |
606 | 606 | $curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS ); |
607 | - $search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
608 | - if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056 |
|
609 | - $search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 ); |
|
607 | + $search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
608 | + if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056 |
|
609 | + $search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 ); |
|
610 | 610 | } |
611 | 611 | } |
612 | 612 | } |
613 | 613 | |
614 | 614 | // search for a specific entry ID |
615 | 615 | if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) { |
616 | - $search_criteria['field_filters'][] = array( |
|
616 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
617 | 617 | 'key' => 'id', |
618 | 618 | 'value' => absint( $get[ 'gv_id' ] ), |
619 | 619 | 'operator' => '=', |
@@ -622,42 +622,42 @@ discard block |
||
622 | 622 | |
623 | 623 | // search for a specific Created_by ID |
624 | 624 | if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'created_by', $searchable_fields ) ) { |
625 | - $search_criteria['field_filters'][] = array( |
|
625 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
626 | 626 | 'key' => 'created_by', |
627 | - 'value' => absint( $get['gv_by'] ), |
|
627 | + 'value' => absint( $get[ 'gv_by' ] ), |
|
628 | 628 | 'operator' => '=', |
629 | 629 | ); |
630 | 630 | } |
631 | 631 | |
632 | 632 | |
633 | 633 | // Get search mode passed in URL |
634 | - $mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ? $get['mode'] : 'any'; |
|
634 | + $mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any'; |
|
635 | 635 | |
636 | 636 | // get the other search filters |
637 | 637 | foreach ( $get as $key => $value ) { |
638 | 638 | |
639 | - if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) { |
|
639 | + if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) { |
|
640 | 640 | continue; |
641 | 641 | } |
642 | 642 | |
643 | 643 | $filter_key = $this->convert_request_key_to_filter_key( $key ); |
644 | 644 | |
645 | 645 | // could return simple filter or multiple filters |
646 | - if ( ! in_array( 'search_all', $searchable_fields ) && ! in_array( $filter_key , $searchable_fields ) ) { |
|
646 | + if ( ! in_array( 'search_all', $searchable_fields ) && ! in_array( $filter_key, $searchable_fields ) ) { |
|
647 | 647 | continue; |
648 | 648 | } |
649 | 649 | |
650 | 650 | $filter = $this->prepare_field_filter( $filter_key, $value, $view ); |
651 | 651 | |
652 | - if ( isset( $filter[0]['value'] ) ) { |
|
653 | - $search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter ); |
|
652 | + if ( isset( $filter[ 0 ][ 'value' ] ) ) { |
|
653 | + $search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter ); |
|
654 | 654 | |
655 | 655 | // if date range type, set search mode to ALL |
656 | - if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) { |
|
656 | + if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) { |
|
657 | 657 | $mode = 'all'; |
658 | 658 | } |
659 | - } elseif( !empty( $filter ) ) { |
|
660 | - $search_criteria['field_filters'][] = $filter; |
|
659 | + } elseif ( ! empty( $filter ) ) { |
|
660 | + $search_criteria[ 'field_filters' ][ ] = $filter; |
|
661 | 661 | } |
662 | 662 | } |
663 | 663 | |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | * @since 1.5.1 |
667 | 667 | * @param[out,in] string $mode Search mode (`any` vs `all`) |
668 | 668 | */ |
669 | - $search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode ); |
|
669 | + $search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode ); |
|
670 | 670 | |
671 | 671 | gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) ); |
672 | 672 | |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | $field_id = str_replace( 'filter_', '', $key ); |
695 | 695 | |
696 | 696 | // calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox ) |
697 | - if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) { |
|
697 | + if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) { |
|
698 | 698 | $field_id = str_replace( '_', '.', $field_id ); |
699 | 699 | } |
700 | 700 | |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | |
730 | 730 | case 'select': |
731 | 731 | case 'radio': |
732 | - $filter['operator'] = 'is'; |
|
732 | + $filter[ 'operator' ] = 'is'; |
|
733 | 733 | break; |
734 | 734 | |
735 | 735 | case 'post_category': |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | |
744 | 744 | foreach ( $value as $val ) { |
745 | 745 | $cat = get_term( $val, 'category' ); |
746 | - $filter[] = array( |
|
746 | + $filter[ ] = array( |
|
747 | 747 | 'key' => $filter_key, |
748 | 748 | 'value' => esc_attr( $cat->name ) . ':' . $val, |
749 | 749 | 'operator' => 'is', |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | $filter = array(); |
763 | 763 | |
764 | 764 | foreach ( $value as $val ) { |
765 | - $filter[] = array( 'key' => $filter_key, 'value' => $val ); |
|
765 | + $filter[ ] = array( 'key' => $filter_key, 'value' => $val ); |
|
766 | 766 | } |
767 | 767 | |
768 | 768 | break; |
@@ -771,9 +771,9 @@ discard block |
||
771 | 771 | // convert checkbox on/off into the correct search filter |
772 | 772 | if ( false !== strpos( $filter_key, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) { |
773 | 773 | foreach ( $form_field->inputs as $k => $input ) { |
774 | - if ( $input['id'] == $filter_key ) { |
|
775 | - $filter['value'] = $form_field->choices[ $k ]['value']; |
|
776 | - $filter['operator'] = 'is'; |
|
774 | + if ( $input[ 'id' ] == $filter_key ) { |
|
775 | + $filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ]; |
|
776 | + $filter[ 'operator' ] = 'is'; |
|
777 | 777 | break; |
778 | 778 | } |
779 | 779 | } |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | $filter = array(); |
784 | 784 | |
785 | 785 | foreach ( $value as $val ) { |
786 | - $filter[] = array( |
|
786 | + $filter[ ] = array( |
|
787 | 787 | 'key' => $filter_key, |
788 | 788 | 'value' => $val, |
789 | 789 | 'operator' => 'is', |
@@ -804,9 +804,9 @@ discard block |
||
804 | 804 | foreach ( $words as $word ) { |
805 | 805 | if ( ! empty( $word ) && strlen( $word ) > 1 ) { |
806 | 806 | // Keep the same key for each filter |
807 | - $filter['value'] = $word; |
|
807 | + $filter[ 'value' ] = $word; |
|
808 | 808 | // Add a search for the value |
809 | - $filters[] = $filter; |
|
809 | + $filters[ ] = $filter; |
|
810 | 810 | } |
811 | 811 | } |
812 | 812 | |
@@ -820,19 +820,19 @@ discard block |
||
820 | 820 | |
821 | 821 | foreach ( $searchable_fields as $searchable_field ) { |
822 | 822 | |
823 | - if( $form_field->ID !== $searchable_field['field'] ) { |
|
823 | + if ( $form_field->ID !== $searchable_field[ 'field' ] ) { |
|
824 | 824 | continue; |
825 | 825 | } |
826 | 826 | |
827 | 827 | // Only exact-match dropdowns, not text search |
828 | - if( in_array( $searchable_field['input'], array( 'text', 'search' ), true ) ) { |
|
828 | + if ( in_array( $searchable_field[ 'input' ], array( 'text', 'search' ), true ) ) { |
|
829 | 829 | continue; |
830 | 830 | } |
831 | 831 | |
832 | 832 | $input_id = gravityview_get_input_id_from_id( $form_field->ID ); |
833 | 833 | |
834 | 834 | if ( 4 === $input_id ) { |
835 | - $filter['operator'] = 'is'; |
|
835 | + $filter[ 'operator' ] = 'is'; |
|
836 | 836 | }; |
837 | 837 | } |
838 | 838 | } |
@@ -857,19 +857,19 @@ discard block |
||
857 | 857 | * @since 1.16.3 |
858 | 858 | * Safeguard until GF implements '<=' operator |
859 | 859 | */ |
860 | - if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
860 | + if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
861 | 861 | $operator = '<'; |
862 | 862 | $date = date( 'Y-m-d', strtotime( $date . ' +1 day' ) ); |
863 | 863 | } |
864 | 864 | |
865 | - $filter[] = array( |
|
865 | + $filter[ ] = array( |
|
866 | 866 | 'key' => $filter_key, |
867 | 867 | 'value' => self::get_formatted_date( $date, 'Y-m-d' ), |
868 | 868 | 'operator' => $operator, |
869 | 869 | ); |
870 | 870 | } |
871 | 871 | } else { |
872 | - $filter['value'] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
872 | + $filter[ 'value' ] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
873 | 873 | } |
874 | 874 | |
875 | 875 | break; |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | 'ymd_dot' => 'Y.m.d', |
901 | 901 | ); |
902 | 902 | |
903 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
903 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
904 | 904 | $format = $datepicker[ $field->dateFormat ]; |
905 | 905 | } |
906 | 906 | |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | public function add_template_path( $file_paths ) { |
932 | 932 | |
933 | 933 | // Index 100 is the default GravityView template path. |
934 | - $file_paths[102] = self::$file . 'templates/'; |
|
934 | + $file_paths[ 102 ] = self::$file . 'templates/'; |
|
935 | 935 | |
936 | 936 | return $file_paths; |
937 | 937 | } |
@@ -950,7 +950,7 @@ discard block |
||
950 | 950 | $has_date = false; |
951 | 951 | |
952 | 952 | foreach ( $search_fields as $k => $field ) { |
953 | - if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
953 | + if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
954 | 954 | $has_date = true; |
955 | 955 | break; |
956 | 956 | } |
@@ -977,7 +977,7 @@ discard block |
||
977 | 977 | } |
978 | 978 | |
979 | 979 | // get configured search fields |
980 | - $search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : ''; |
|
980 | + $search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : ''; |
|
981 | 981 | |
982 | 982 | if ( empty( $search_fields ) || ! is_array( $search_fields ) ) { |
983 | 983 | gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) ); |
@@ -992,34 +992,34 @@ discard block |
||
992 | 992 | |
993 | 993 | $updated_field = $this->get_search_filter_details( $updated_field ); |
994 | 994 | |
995 | - switch ( $field['field'] ) { |
|
995 | + switch ( $field[ 'field' ] ) { |
|
996 | 996 | |
997 | 997 | case 'search_all': |
998 | - $updated_field['key'] = 'search_all'; |
|
999 | - $updated_field['input'] = 'search_all'; |
|
1000 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' ); |
|
998 | + $updated_field[ 'key' ] = 'search_all'; |
|
999 | + $updated_field[ 'input' ] = 'search_all'; |
|
1000 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' ); |
|
1001 | 1001 | break; |
1002 | 1002 | |
1003 | 1003 | case 'entry_date': |
1004 | - $updated_field['key'] = 'entry_date'; |
|
1005 | - $updated_field['input'] = 'entry_date'; |
|
1006 | - $updated_field['value'] = array( |
|
1004 | + $updated_field[ 'key' ] = 'entry_date'; |
|
1005 | + $updated_field[ 'input' ] = 'entry_date'; |
|
1006 | + $updated_field[ 'value' ] = array( |
|
1007 | 1007 | 'start' => $this->rgget_or_rgpost( 'gv_start' ), |
1008 | 1008 | 'end' => $this->rgget_or_rgpost( 'gv_end' ), |
1009 | 1009 | ); |
1010 | 1010 | break; |
1011 | 1011 | |
1012 | 1012 | case 'entry_id': |
1013 | - $updated_field['key'] = 'entry_id'; |
|
1014 | - $updated_field['input'] = 'entry_id'; |
|
1015 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' ); |
|
1013 | + $updated_field[ 'key' ] = 'entry_id'; |
|
1014 | + $updated_field[ 'input' ] = 'entry_id'; |
|
1015 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' ); |
|
1016 | 1016 | break; |
1017 | 1017 | |
1018 | 1018 | case 'created_by': |
1019 | - $updated_field['key'] = 'created_by'; |
|
1020 | - $updated_field['name'] = 'gv_by'; |
|
1021 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' ); |
|
1022 | - $updated_field['choices'] = self::get_created_by_choices(); |
|
1019 | + $updated_field[ 'key' ] = 'created_by'; |
|
1020 | + $updated_field[ 'name' ] = 'gv_by'; |
|
1021 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' ); |
|
1022 | + $updated_field[ 'choices' ] = self::get_created_by_choices(); |
|
1023 | 1023 | break; |
1024 | 1024 | } |
1025 | 1025 | |
@@ -1038,16 +1038,16 @@ discard block |
||
1038 | 1038 | */ |
1039 | 1039 | $gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args, $context ); |
1040 | 1040 | |
1041 | - $gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal'; |
|
1041 | + $gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal'; |
|
1042 | 1042 | |
1043 | 1043 | /** @since 1.14 */ |
1044 | - $gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any'; |
|
1044 | + $gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any'; |
|
1045 | 1045 | |
1046 | - $custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
1046 | + $custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
1047 | 1047 | |
1048 | 1048 | $gravityview_view->search_class = self::get_search_class( $custom_class ); |
1049 | 1049 | |
1050 | - $gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false; |
|
1050 | + $gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false; |
|
1051 | 1051 | |
1052 | 1052 | if ( $this->has_date_field( $search_fields ) ) { |
1053 | 1053 | // enqueue datepicker stuff only if needed! |
@@ -1069,10 +1069,10 @@ discard block |
||
1069 | 1069 | public static function get_search_class( $custom_class = '' ) { |
1070 | 1070 | $gravityview_view = GravityView_View::getInstance(); |
1071 | 1071 | |
1072 | - $search_class = 'gv-search-'.$gravityview_view->search_layout; |
|
1072 | + $search_class = 'gv-search-' . $gravityview_view->search_layout; |
|
1073 | 1073 | |
1074 | - if ( ! empty( $custom_class ) ) { |
|
1075 | - $search_class .= ' '.$custom_class; |
|
1074 | + if ( ! empty( $custom_class ) ) { |
|
1075 | + $search_class .= ' ' . $custom_class; |
|
1076 | 1076 | } |
1077 | 1077 | |
1078 | 1078 | /** |
@@ -1116,9 +1116,9 @@ discard block |
||
1116 | 1116 | |
1117 | 1117 | if ( ! $label ) { |
1118 | 1118 | |
1119 | - $label = isset( $form_field['label'] ) ? $form_field['label'] : ''; |
|
1119 | + $label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : ''; |
|
1120 | 1120 | |
1121 | - switch( $field['field'] ) { |
|
1121 | + switch ( $field[ 'field' ] ) { |
|
1122 | 1122 | case 'search_all': |
1123 | 1123 | $label = __( 'Search Entries:', 'gravityview' ); |
1124 | 1124 | break; |
@@ -1130,10 +1130,10 @@ discard block |
||
1130 | 1130 | break; |
1131 | 1131 | default: |
1132 | 1132 | // If this is a field input, not a field |
1133 | - if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) { |
|
1133 | + if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) { |
|
1134 | 1134 | |
1135 | 1135 | // Get the label for the field in question, which returns an array |
1136 | - $items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) ); |
|
1136 | + $items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) ); |
|
1137 | 1137 | |
1138 | 1138 | // Get the item with the `label` key |
1139 | 1139 | $values = wp_list_pluck( $items, 'label' ); |
@@ -1172,32 +1172,32 @@ discard block |
||
1172 | 1172 | $form = $gravityview_view->getForm(); |
1173 | 1173 | |
1174 | 1174 | // for advanced field ids (eg, first name / last name ) |
1175 | - $name = 'filter_' . str_replace( '.', '_', $field['field'] ); |
|
1175 | + $name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] ); |
|
1176 | 1176 | |
1177 | 1177 | // get searched value from $_GET/$_POST (string or array) |
1178 | 1178 | $value = $this->rgget_or_rgpost( $name ); |
1179 | 1179 | |
1180 | 1180 | // get form field details |
1181 | - $form_field = gravityview_get_field( $form, $field['field'] ); |
|
1181 | + $form_field = gravityview_get_field( $form, $field[ 'field' ] ); |
|
1182 | 1182 | |
1183 | 1183 | $filter = array( |
1184 | - 'key' => $field['field'], |
|
1184 | + 'key' => $field[ 'field' ], |
|
1185 | 1185 | 'name' => $name, |
1186 | 1186 | 'label' => self::get_field_label( $field, $form_field ), |
1187 | - 'input' => $field['input'], |
|
1187 | + 'input' => $field[ 'input' ], |
|
1188 | 1188 | 'value' => $value, |
1189 | - 'type' => $form_field['type'], |
|
1189 | + 'type' => $form_field[ 'type' ], |
|
1190 | 1190 | ); |
1191 | 1191 | |
1192 | 1192 | // collect choices |
1193 | - if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) { |
|
1194 | - $filter['choices'] = gravityview_get_terms_choices(); |
|
1195 | - } elseif ( ! empty( $form_field['choices'] ) ) { |
|
1196 | - $filter['choices'] = $form_field['choices']; |
|
1193 | + if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) { |
|
1194 | + $filter[ 'choices' ] = gravityview_get_terms_choices(); |
|
1195 | + } elseif ( ! empty( $form_field[ 'choices' ] ) ) { |
|
1196 | + $filter[ 'choices' ] = $form_field[ 'choices' ]; |
|
1197 | 1197 | } |
1198 | 1198 | |
1199 | - if ( 'date_range' === $field['input'] && empty( $value ) ) { |
|
1200 | - $filter['value'] = array( 'start' => '', 'end' => '' ); |
|
1199 | + if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) { |
|
1200 | + $filter[ 'value' ] = array( 'start' => '', 'end' => '' ); |
|
1201 | 1201 | } |
1202 | 1202 | |
1203 | 1203 | return $filter; |
@@ -1221,7 +1221,7 @@ discard block |
||
1221 | 1221 | |
1222 | 1222 | $choices = array(); |
1223 | 1223 | foreach ( $users as $user ) { |
1224 | - $choices[] = array( |
|
1224 | + $choices[ ] = array( |
|
1225 | 1225 | 'value' => $user->ID, |
1226 | 1226 | 'text' => $user->display_name, |
1227 | 1227 | ); |
@@ -1276,7 +1276,7 @@ discard block |
||
1276 | 1276 | */ |
1277 | 1277 | public function add_datepicker_js_dependency( $js_dependencies ) { |
1278 | 1278 | |
1279 | - $js_dependencies[] = 'jquery-ui-datepicker'; |
|
1279 | + $js_dependencies[ ] = 'jquery-ui-datepicker'; |
|
1280 | 1280 | |
1281 | 1281 | return $js_dependencies; |
1282 | 1282 | } |
@@ -1320,7 +1320,7 @@ discard block |
||
1320 | 1320 | 'isRTL' => is_rtl(), |
1321 | 1321 | ), $view_data ); |
1322 | 1322 | |
1323 | - $localizations['datepicker'] = $datepicker_settings; |
|
1323 | + $localizations[ 'datepicker' ] = $datepicker_settings; |
|
1324 | 1324 | |
1325 | 1325 | return $localizations; |
1326 | 1326 | |
@@ -1347,7 +1347,7 @@ discard block |
||
1347 | 1347 | * @return void |
1348 | 1348 | */ |
1349 | 1349 | private function maybe_enqueue_flexibility() { |
1350 | - if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
1350 | + if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) { |
|
1351 | 1351 | wp_enqueue_script( 'gv-flexibility' ); |
1352 | 1352 | } |
1353 | 1353 | } |
@@ -1369,7 +1369,7 @@ discard block |
||
1369 | 1369 | add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 ); |
1370 | 1370 | |
1371 | 1371 | $scheme = is_ssl() ? 'https://' : 'http://'; |
1372 | - wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
1372 | + wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
1373 | 1373 | |
1374 | 1374 | /** |
1375 | 1375 | * @filter `gravityview_search_datepicker_class` |