@@ -48,25 +48,25 @@ |
||
48 | 48 | |
49 | 49 | $quiz_fields = GFAPI::get_fields_by_type( $form, 'quiz' ); |
50 | 50 | |
51 | - if( ! empty( $quiz_fields ) ) { |
|
51 | + if ( ! empty( $quiz_fields ) ) { |
|
52 | 52 | |
53 | - $fields['gquiz_score'] = array( |
|
53 | + $fields[ 'gquiz_score' ] = array( |
|
54 | 54 | 'label' => __( 'Quiz Score Total', 'gravityview' ), |
55 | 55 | 'type' => 'quiz_score', |
56 | 56 | 'desc' => __( 'Displays the number of correct Quiz answers the user submitted.', 'gravityview' ), |
57 | 57 | ); |
58 | - $fields['gquiz_percent'] = array( |
|
58 | + $fields[ 'gquiz_percent' ] = array( |
|
59 | 59 | 'label' => __( 'Quiz Percentage Grade', 'gravityview' ), |
60 | 60 | 'type' => 'quiz_percent', |
61 | 61 | 'desc' => __( 'Displays the percentage of correct Quiz answers the user submitted.', 'gravityview' ), |
62 | 62 | ); |
63 | - $fields['gquiz_grade'] = array( |
|
63 | + $fields[ 'gquiz_grade' ] = array( |
|
64 | 64 | /* translators: This is a field type used by the Gravity Forms Quiz Addon. "A" is 100-90, "B" is 89-80, "C" is 79-70, etc. */ |
65 | 65 | 'label' => __( 'Quiz Letter Grade', 'gravityview' ), |
66 | 66 | 'type' => 'quiz_grade', |
67 | 67 | 'desc' => __( 'Displays the Grade the user achieved based on Letter Grading configured in the Quiz Settings.', 'gravityview' ), |
68 | 68 | ); |
69 | - $fields['gquiz_is_pass'] = array( |
|
69 | + $fields[ 'gquiz_is_pass' ] = array( |
|
70 | 70 | 'label' => __( 'Quiz Pass/Fail', 'gravityview' ), |
71 | 71 | 'type' => 'quiz_is_pass', |
72 | 72 | 'desc' => __( 'Displays either Passed or Failed based on the Pass/Fail settings configured in the Quiz Settings.', 'gravityview' ), |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | // Add the list columns |
63 | 63 | foreach ( $list_fields as $list_field ) { |
64 | 64 | |
65 | - if( empty( $list_field->enableColumns ) ) { |
|
65 | + if ( empty( $list_field->enableColumns ) ) { |
|
66 | 66 | continue; |
67 | 67 | } |
68 | 68 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | // If there are columns, add them under the parent field |
86 | - if( ! empty( $list_columns ) ) { |
|
86 | + if ( ! empty( $list_columns ) ) { |
|
87 | 87 | $index = array_search( $list_field->id, array_keys( $fields ) ); |
88 | 88 | array_splice( $fields, ( $index + 1 ), 0, $list_columns ); |
89 | 89 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | $list_rows = maybe_unserialize( $field_value ); |
114 | 114 | |
115 | - if( ! is_array( $list_rows ) ) { |
|
115 | + if ( ! is_array( $list_rows ) ) { |
|
116 | 116 | do_action( 'gravityview_log_error', __METHOD__ . ' - $field_value did not unserialize', $field_value ); |
117 | 117 | return null; |
118 | 118 | } |
@@ -125,15 +125,15 @@ discard block |
||
125 | 125 | foreach ( $list_row as $column_key => $column_value ) { |
126 | 126 | |
127 | 127 | // If the label of the column matches $column_id, or the numeric key value matches, add the value |
128 | - if( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) { |
|
129 | - $column_values[] = $column_value; |
|
128 | + if ( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) { |
|
129 | + $column_values[ ] = $column_value; |
|
130 | 130 | } |
131 | 131 | $current_column++; |
132 | 132 | } |
133 | 133 | } |
134 | 134 | |
135 | 135 | // Return the array of values |
136 | - if( 'raw' === $format ) { |
|
136 | + if ( 'raw' === $format ) { |
|
137 | 137 | return $column_values; |
138 | 138 | } |
139 | 139 | // Return the Gravity Forms Field output |
@@ -156,22 +156,22 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function _filter_field_label( $label, $field, $form, $entry ) { |
158 | 158 | |
159 | - $field_object = RGFormsModel::get_field( $form, $field['id'] ); |
|
159 | + $field_object = RGFormsModel::get_field( $form, $field[ 'id' ] ); |
|
160 | 160 | |
161 | 161 | // Not a list field |
162 | - if( ! $field_object || 'list' !== $field_object->type ) { |
|
162 | + if ( ! $field_object || 'list' !== $field_object->type ) { |
|
163 | 163 | return $label; |
164 | 164 | } |
165 | 165 | |
166 | 166 | // Custom label is defined, so use it |
167 | - if( ! empty( $field['custom_label'] ) ) { |
|
167 | + if ( ! empty( $field[ 'custom_label' ] ) ) { |
|
168 | 168 | return $label; |
169 | 169 | } |
170 | 170 | |
171 | - $column_id = gravityview_get_input_id_from_id( $field['id'] ); |
|
171 | + $column_id = gravityview_get_input_id_from_id( $field[ 'id' ] ); |
|
172 | 172 | |
173 | 173 | // Parent field, not column field |
174 | - if( false === $column_id ) { |
|
174 | + if ( false === $column_id ) { |
|
175 | 175 | return $label; |
176 | 176 | } |
177 | 177 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | public static function get_column_label( GF_Field_List $field, $column_id, $backup_label = '' ) { |
193 | 193 | |
194 | 194 | // Doesn't have columns enabled |
195 | - if( ! isset( $field->choices ) || ! $field->enableColumns ) { |
|
195 | + if ( ! isset( $field->choices ) || ! $field->enableColumns ) { |
|
196 | 196 | return $backup_label; |
197 | 197 | } |
198 | 198 |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | $entry = self::get_entry( $entry_slug, true ); |
126 | 126 | |
127 | - $form = self::get_form( $entry['form_id'] ); |
|
127 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
128 | 128 | |
129 | 129 | return $form; |
130 | 130 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | |
176 | 176 | $results = GFAPI::get_entries( 0, $search_criteria, null, $paging ); |
177 | 177 | |
178 | - $result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null; |
|
178 | + $result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null; |
|
179 | 179 | |
180 | 180 | return $result; |
181 | 181 | } |
@@ -193,9 +193,9 @@ discard block |
||
193 | 193 | if ( class_exists( 'GFAPI' ) ) { |
194 | 194 | $gf_forms = GFAPI::get_forms(); |
195 | 195 | foreach ( $gf_forms as $form ) { |
196 | - $forms[] = array( |
|
197 | - 'id' => $form['id'], |
|
198 | - 'title' => $form['title'], |
|
196 | + $forms[ ] = array( |
|
197 | + 'id' => $form[ 'id' ], |
|
198 | + 'title' => $form[ 'title' ], |
|
199 | 199 | ); |
200 | 200 | } |
201 | 201 | } |
@@ -222,10 +222,10 @@ discard block |
||
222 | 222 | $has_post_fields = false; |
223 | 223 | |
224 | 224 | if ( $form ) { |
225 | - foreach ( $form['fields'] as $field ) { |
|
225 | + foreach ( $form[ 'fields' ] as $field ) { |
|
226 | 226 | |
227 | - if ( $include_parent_field || empty( $field['inputs'] ) ) { |
|
228 | - $fields["{$field->id}"] = array( |
|
227 | + if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) { |
|
228 | + $fields[ "{$field->id}" ] = array( |
|
229 | 229 | 'label' => rgar( $field, 'label' ), |
230 | 230 | 'parent' => null, |
231 | 231 | 'type' => rgar( $field, 'type' ), |
@@ -240,10 +240,10 @@ discard block |
||
240 | 240 | * @hack |
241 | 241 | * In case of email/email confirmation, the input for email has the same id as the parent field |
242 | 242 | */ |
243 | - if( 'email' === $field->type && false === strpos( $input['id'], '.' ) ) { |
|
243 | + if ( 'email' === $field->type && false === strpos( $input[ 'id' ], '.' ) ) { |
|
244 | 244 | continue; |
245 | 245 | } |
246 | - $fields["{$input['id']}"] = array( |
|
246 | + $fields[ "{$input[ 'id' ]}" ] = array( |
|
247 | 247 | 'label' => rgar( $input, 'label' ), |
248 | 248 | 'customLabel' => rgar( $input, 'customLabel' ), |
249 | 249 | 'parent' => $field, |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | } |
256 | 256 | |
257 | 257 | |
258 | - if( GFCommon::is_product_field( $field->type ) ){ |
|
258 | + if ( GFCommon::is_product_field( $field->type ) ) { |
|
259 | 259 | $has_product_fields = true; |
260 | 260 | } |
261 | 261 | |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | * @since 1.7 |
270 | 270 | */ |
271 | 271 | if ( $has_post_fields ) { |
272 | - $fields['post_id'] = array( |
|
272 | + $fields[ 'post_id' ] = array( |
|
273 | 273 | 'label' => __( 'Post ID', 'gravityview' ), |
274 | 274 | 'type' => 'post_id', |
275 | 275 | ); |
@@ -280,10 +280,10 @@ discard block |
||
280 | 280 | $payment_fields = GravityView_Fields::get_all( 'pricing' ); |
281 | 281 | |
282 | 282 | foreach ( $payment_fields as $payment_field ) { |
283 | - if( isset( $fields["{$payment_field->name}"] ) ) { |
|
283 | + if ( isset( $fields[ "{$payment_field->name}" ] ) ) { |
|
284 | 284 | continue; |
285 | 285 | } |
286 | - $fields["{$payment_field->name}"] = array( |
|
286 | + $fields[ "{$payment_field->name}" ] = array( |
|
287 | 287 | 'label' => $payment_field->label, |
288 | 288 | 'desc' => $payment_field->description, |
289 | 289 | 'type' => $payment_field->name, |
@@ -315,9 +315,9 @@ discard block |
||
315 | 315 | |
316 | 316 | $fields = array(); |
317 | 317 | |
318 | - foreach ( $extra_fields as $key => $field ){ |
|
319 | - if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
|
320 | - $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
|
318 | + foreach ( $extra_fields as $key => $field ) { |
|
319 | + if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) { |
|
320 | + $fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' ); |
|
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
@@ -357,32 +357,32 @@ discard block |
||
357 | 357 | 'search_criteria' => null, |
358 | 358 | 'sorting' => null, |
359 | 359 | 'paging' => null, |
360 | - 'cache' => (isset( $passed_criteria['cache'] ) ? $passed_criteria['cache'] : true), |
|
360 | + 'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? $passed_criteria[ 'cache' ] : true ), |
|
361 | 361 | ); |
362 | 362 | |
363 | 363 | $criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults ); |
364 | 364 | |
365 | - if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) { |
|
366 | - foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) { |
|
365 | + if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
366 | + foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) { |
|
367 | 367 | |
368 | 368 | if ( ! is_array( $filter ) ) { |
369 | 369 | continue; |
370 | 370 | } |
371 | 371 | |
372 | 372 | // By default, we want searches to be wildcard for each field. |
373 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
373 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
374 | 374 | |
375 | 375 | /** |
376 | 376 | * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc) |
377 | 377 | * @param string $operator Existing search operator |
378 | 378 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
379 | 379 | */ |
380 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
380 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | // don't send just the [mode] without any field filter. |
384 | - if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) { |
|
385 | - unset( $criteria['search_criteria']['field_filters']['mode'] ); |
|
384 | + if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
385 | + unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] ); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | } |
@@ -393,21 +393,21 @@ discard block |
||
393 | 393 | * Prepare date formats to be in Gravity Forms DB format; |
394 | 394 | * $passed_criteria may include date formats incompatible with Gravity Forms. |
395 | 395 | */ |
396 | - foreach ( array('start_date', 'end_date' ) as $key ) { |
|
396 | + foreach ( array( 'start_date', 'end_date' ) as $key ) { |
|
397 | 397 | |
398 | - if ( ! empty( $criteria['search_criteria'][ $key ] ) ) { |
|
398 | + if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) { |
|
399 | 399 | |
400 | 400 | // Use date_create instead of new DateTime so it returns false if invalid date format. |
401 | - $date = date_create( $criteria['search_criteria'][ $key ] ); |
|
401 | + $date = date_create( $criteria[ 'search_criteria' ][ $key ] ); |
|
402 | 402 | |
403 | 403 | if ( $date ) { |
404 | 404 | // Gravity Forms wants dates in the `Y-m-d H:i:s` format. |
405 | - $criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
405 | + $criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
406 | 406 | } else { |
407 | 407 | // If it's an invalid date, unset it. Gravity Forms freaks out otherwise. |
408 | - unset( $criteria['search_criteria'][ $key ] ); |
|
408 | + unset( $criteria[ 'search_criteria' ][ $key ] ); |
|
409 | 409 | |
410 | - do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] ); |
|
410 | + do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] ); |
|
411 | 411 | } |
412 | 412 | } |
413 | 413 | } |
@@ -415,12 +415,12 @@ discard block |
||
415 | 415 | |
416 | 416 | // When multiple views are embedded, OR single entry, calculate the context view id and send it to the advanced filter |
417 | 417 | if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry() ) { |
418 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
418 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
419 | 419 | } elseif ( 'delete' === RGForms::get( 'action' ) ) { |
420 | - $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null; |
|
421 | - } elseif( !isset( $criteria['context_view_id'] ) ) { |
|
420 | + $criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null; |
|
421 | + } elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) { |
|
422 | 422 | // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
423 | - $criteria['context_view_id'] = null; |
|
423 | + $criteria[ 'context_view_id' ] = null; |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | /** |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * @param array $form_ids Forms to search |
430 | 430 | * @param int $view_id ID of the view being used to search |
431 | 431 | */ |
432 | - $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] ); |
|
432 | + $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] ); |
|
433 | 433 | |
434 | 434 | return (array)$criteria; |
435 | 435 | |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | /** Reduce # of database calls */ |
461 | 461 | add_filter( 'gform_is_encrypted_field', '__return_false' ); |
462 | 462 | |
463 | - if ( ! empty( $criteria['cache'] ) ) { |
|
463 | + if ( ! empty( $criteria[ 'cache' ] ) ) { |
|
464 | 464 | |
465 | 465 | $Cache = new GravityView_Cache( $form_ids, $criteria ); |
466 | 466 | |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | |
469 | 469 | // Still update the total count when using cached results |
470 | 470 | if ( ! is_null( $total ) ) { |
471 | - $total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] ); |
|
471 | + $total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] ); |
|
472 | 472 | } |
473 | 473 | |
474 | 474 | $return = $entries; |
@@ -488,9 +488,9 @@ discard block |
||
488 | 488 | $entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total ); |
489 | 489 | |
490 | 490 | // No entries returned from gravityview_before_get_entries |
491 | - if( is_null( $entries ) ) { |
|
491 | + if ( is_null( $entries ) ) { |
|
492 | 492 | |
493 | - $entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total ); |
|
493 | + $entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total ); |
|
494 | 494 | |
495 | 495 | if ( is_wp_error( $entries ) ) { |
496 | 496 | do_action( 'gravityview_log_error', $entries->get_error_message(), $entries ); |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | } |
500 | 500 | } |
501 | 501 | |
502 | - if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) { |
|
502 | + if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) { |
|
503 | 503 | |
504 | 504 | // Cache results |
505 | 505 | $Cache->set( $entries, 'entries' ); |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | */ |
587 | 587 | $check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry ); |
588 | 588 | |
589 | - if( $check_entry_display ) { |
|
589 | + if ( $check_entry_display ) { |
|
590 | 590 | // Is the entry allowed |
591 | 591 | $entry = self::check_entry_display( $entry ); |
592 | 592 | } |
@@ -619,12 +619,12 @@ discard block |
||
619 | 619 | |
620 | 620 | $value = false; |
621 | 621 | |
622 | - if( 'context' === $val1 ) { |
|
622 | + if ( 'context' === $val1 ) { |
|
623 | 623 | |
624 | 624 | $matching_contexts = array( $val2 ); |
625 | 625 | |
626 | 626 | // We allow for non-standard contexts. |
627 | - switch( $val2 ) { |
|
627 | + switch ( $val2 ) { |
|
628 | 628 | // Check for either single or edit |
629 | 629 | case 'singular': |
630 | 630 | $matching_contexts = array( 'single', 'edit' ); |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | return false; |
685 | 685 | } |
686 | 686 | |
687 | - if ( empty( $entry['form_id'] ) ) { |
|
687 | + if ( empty( $entry[ 'form_id' ] ) ) { |
|
688 | 688 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry ); |
689 | 689 | return false; |
690 | 690 | } |
@@ -692,26 +692,26 @@ discard block |
||
692 | 692 | $criteria = self::calculate_get_entries_criteria(); |
693 | 693 | |
694 | 694 | // Make sure the current View is connected to the same form as the Entry |
695 | - if( ! empty( $criteria['context_view_id'] ) ) { |
|
696 | - $context_view_id = intval( $criteria['context_view_id'] ); |
|
695 | + if ( ! empty( $criteria[ 'context_view_id' ] ) ) { |
|
696 | + $context_view_id = intval( $criteria[ 'context_view_id' ] ); |
|
697 | 697 | $context_form_id = gravityview_get_form_id( $context_view_id ); |
698 | - if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) { |
|
699 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] ); |
|
698 | + if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) { |
|
699 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] ); |
|
700 | 700 | return false; |
701 | 701 | } |
702 | 702 | } |
703 | 703 | |
704 | - if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) { |
|
704 | + if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) { |
|
705 | 705 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria ); |
706 | 706 | return $entry; |
707 | 707 | } |
708 | 708 | |
709 | - $search_criteria = $criteria['search_criteria']; |
|
709 | + $search_criteria = $criteria[ 'search_criteria' ]; |
|
710 | 710 | unset( $criteria ); |
711 | 711 | |
712 | 712 | // check entry status |
713 | - if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) { |
|
714 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria ); |
|
713 | + if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) { |
|
714 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria ); |
|
715 | 715 | return false; |
716 | 716 | } |
717 | 717 | |
@@ -719,37 +719,37 @@ discard block |
||
719 | 719 | // @todo: Does it make sense to apply the Date create filters to the single entry? |
720 | 720 | |
721 | 721 | // field_filters |
722 | - if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) { |
|
722 | + if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) { |
|
723 | 723 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria ); |
724 | 724 | return $entry; |
725 | 725 | } |
726 | 726 | |
727 | - $filters = $search_criteria['field_filters']; |
|
727 | + $filters = $search_criteria[ 'field_filters' ]; |
|
728 | 728 | unset( $search_criteria ); |
729 | 729 | |
730 | - $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all'; |
|
731 | - unset( $filters['mode'] ); |
|
730 | + $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all'; |
|
731 | + unset( $filters[ 'mode' ] ); |
|
732 | 732 | |
733 | - $form = self::get_form( $entry['form_id'] ); |
|
733 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
734 | 734 | |
735 | 735 | foreach ( $filters as $filter ) { |
736 | 736 | |
737 | - if ( ! isset( $filter['key'] ) ) { |
|
737 | + if ( ! isset( $filter[ 'key' ] ) ) { |
|
738 | 738 | continue; |
739 | 739 | } |
740 | 740 | |
741 | - $k = $filter['key']; |
|
741 | + $k = $filter[ 'key' ]; |
|
742 | 742 | |
743 | 743 | if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) { |
744 | 744 | $field_value = $entry[ $k ]; |
745 | 745 | $field = null; |
746 | 746 | } else { |
747 | 747 | $field = self::get_field( $form, $k ); |
748 | - $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
748 | + $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
749 | 749 | } |
750 | 750 | |
751 | - $operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is'; |
|
752 | - $is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field ); |
|
751 | + $operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is'; |
|
752 | + $is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field ); |
|
753 | 753 | |
754 | 754 | // verify if we are already free to go! |
755 | 755 | if ( ! $is_value_match && 'all' === $mode ) { |
@@ -807,18 +807,18 @@ discard block |
||
807 | 807 | * Gravity Forms code to adjust date to locally-configured Time Zone |
808 | 808 | * @see GFCommon::format_date() for original code |
809 | 809 | */ |
810 | - $date_gmt_time = mysql2date( 'G', $date_string ); |
|
810 | + $date_gmt_time = mysql2date( 'G', $date_string ); |
|
811 | 811 | $date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time ); |
812 | 812 | |
813 | - $format = rgar( $atts, 'format' ); |
|
814 | - $is_human = ! empty( $atts['human'] ); |
|
815 | - $is_diff = ! empty( $atts['diff'] ); |
|
816 | - $is_raw = ! empty( $atts['raw'] ); |
|
817 | - $is_timestamp = ! empty( $atts['timestamp'] ); |
|
818 | - $include_time = ! empty( $atts['time'] ); |
|
813 | + $format = rgar( $atts, 'format' ); |
|
814 | + $is_human = ! empty( $atts[ 'human' ] ); |
|
815 | + $is_diff = ! empty( $atts[ 'diff' ] ); |
|
816 | + $is_raw = ! empty( $atts[ 'raw' ] ); |
|
817 | + $is_timestamp = ! empty( $atts[ 'timestamp' ] ); |
|
818 | + $include_time = ! empty( $atts[ 'time' ] ); |
|
819 | 819 | |
820 | 820 | // If we're using time diff, we want to have a different default format |
821 | - if( empty( $format ) ) { |
|
821 | + if ( empty( $format ) ) { |
|
822 | 822 | /* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */ |
823 | 823 | $format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' ); |
824 | 824 | } |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | // If raw was specified, don't modify the stored value |
827 | 827 | if ( $is_raw ) { |
828 | 828 | $formatted_date = $date_string; |
829 | - } elseif( $is_timestamp ) { |
|
829 | + } elseif ( $is_timestamp ) { |
|
830 | 830 | $formatted_date = $date_local_timestamp; |
831 | 831 | } elseif ( $is_diff ) { |
832 | 832 | $formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) ); |
@@ -860,7 +860,7 @@ discard block |
||
860 | 860 | |
861 | 861 | $label = rgar( $field, 'label' ); |
862 | 862 | |
863 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
863 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
864 | 864 | $label = GFFormsModel::get_choice_text( $field, $field_value, $field_id ); |
865 | 865 | } |
866 | 866 | |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | * @return GF_Field|null Gravity Forms field object, or NULL: Gravity Forms GFFormsModel does not exist or field at $field_id doesn't exist. |
882 | 882 | */ |
883 | 883 | public static function get_field( $form, $field_id ) { |
884 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
884 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
885 | 885 | return GFFormsModel::get_field( $form, $field_id ); |
886 | 886 | } else { |
887 | 887 | return null; |
@@ -928,19 +928,19 @@ discard block |
||
928 | 928 | $shortcodes = array(); |
929 | 929 | |
930 | 930 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
931 | - if ( empty( $matches ) ){ |
|
931 | + if ( empty( $matches ) ) { |
|
932 | 932 | return false; |
933 | 933 | } |
934 | 934 | |
935 | 935 | foreach ( $matches as $shortcode ) { |
936 | - if ( $tag === $shortcode[2] ) { |
|
936 | + if ( $tag === $shortcode[ 2 ] ) { |
|
937 | 937 | |
938 | 938 | // Changed this to $shortcode instead of true so we get the parsed atts. |
939 | - $shortcodes[] = $shortcode; |
|
939 | + $shortcodes[ ] = $shortcode; |
|
940 | 940 | |
941 | - } else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) { |
|
942 | - foreach( $results as $result ) { |
|
943 | - $shortcodes[] = $result; |
|
941 | + } else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) { |
|
942 | + foreach ( $results as $result ) { |
|
943 | + $shortcodes[ ] = $result; |
|
944 | 944 | } |
945 | 945 | } |
946 | 946 | } |
@@ -1101,7 +1101,7 @@ discard block |
||
1101 | 1101 | * @return string html |
1102 | 1102 | */ |
1103 | 1103 | public static function get_sortable_fields( $formid, $current = '' ) { |
1104 | - $output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>'; |
|
1104 | + $output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>'; |
|
1105 | 1105 | |
1106 | 1106 | if ( empty( $formid ) ) { |
1107 | 1107 | return $output; |
@@ -1114,11 +1114,11 @@ discard block |
||
1114 | 1114 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null ); |
1115 | 1115 | |
1116 | 1116 | foreach ( $fields as $id => $field ) { |
1117 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1117 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
1118 | 1118 | continue; |
1119 | 1119 | } |
1120 | 1120 | |
1121 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>'; |
|
1121 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>'; |
|
1122 | 1122 | } |
1123 | 1123 | } |
1124 | 1124 | |
@@ -1153,9 +1153,9 @@ discard block |
||
1153 | 1153 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
1154 | 1154 | |
1155 | 1155 | // TODO: Convert to using array_filter |
1156 | - foreach( $fields as $id => $field ) { |
|
1156 | + foreach ( $fields as $id => $field ) { |
|
1157 | 1157 | |
1158 | - if( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1158 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
1159 | 1159 | unset( $fields[ $id ] ); |
1160 | 1160 | } |
1161 | 1161 | } |
@@ -1196,14 +1196,14 @@ discard block |
||
1196 | 1196 | * @param int|array $field field key or field array |
1197 | 1197 | * @return boolean |
1198 | 1198 | */ |
1199 | - public static function is_field_numeric( $form = null, $field = '' ) { |
|
1199 | + public static function is_field_numeric( $form = null, $field = '' ) { |
|
1200 | 1200 | |
1201 | 1201 | if ( ! is_array( $form ) && ! is_array( $field ) ) { |
1202 | 1202 | $form = self::get_form( $form ); |
1203 | 1203 | } |
1204 | 1204 | |
1205 | 1205 | // If entry meta, it's a string. Otherwise, numeric |
1206 | - if( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1206 | + if ( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1207 | 1207 | $type = $field; |
1208 | 1208 | } else { |
1209 | 1209 | $type = self::get_field_type( $form, $field ); |
@@ -1217,9 +1217,9 @@ discard block |
||
1217 | 1217 | $numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) ); |
1218 | 1218 | |
1219 | 1219 | // Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true |
1220 | - if( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1221 | - if( true === $gv_field->is_numeric ) { |
|
1222 | - $numeric_types[] = $gv_field->is_numeric; |
|
1220 | + if ( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1221 | + if ( true === $gv_field->is_numeric ) { |
|
1222 | + $numeric_types[ ] = $gv_field->is_numeric; |
|
1223 | 1223 | } |
1224 | 1224 | } |
1225 | 1225 | |
@@ -1369,11 +1369,11 @@ discard block |
||
1369 | 1369 | $final_atts = array_filter( $final_atts ); |
1370 | 1370 | |
1371 | 1371 | // If the href wasn't passed as an attribute, use the value passed to the function |
1372 | - if ( empty( $final_atts['href'] ) && ! empty( $href ) ) { |
|
1373 | - $final_atts['href'] = $href; |
|
1372 | + if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) { |
|
1373 | + $final_atts[ 'href' ] = $href; |
|
1374 | 1374 | } |
1375 | 1375 | |
1376 | - $final_atts['href'] = esc_url_raw( $href ); |
|
1376 | + $final_atts[ 'href' ] = esc_url_raw( $href ); |
|
1377 | 1377 | |
1378 | 1378 | // Sort the attributes alphabetically, to help testing |
1379 | 1379 | ksort( $final_atts ); |
@@ -1384,7 +1384,7 @@ discard block |
||
1384 | 1384 | $output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) ); |
1385 | 1385 | } |
1386 | 1386 | |
1387 | - if( '' !== $output ) { |
|
1387 | + if ( '' !== $output ) { |
|
1388 | 1388 | $output = '<a' . $output . '>' . $anchor_text . '</a>'; |
1389 | 1389 | } |
1390 | 1390 | |
@@ -1408,7 +1408,7 @@ discard block |
||
1408 | 1408 | public static function array_merge_recursive_distinct( array &$array1, array &$array2 ) { |
1409 | 1409 | $merged = $array1; |
1410 | 1410 | |
1411 | - foreach ( $array2 as $key => &$value ) { |
|
1411 | + foreach ( $array2 as $key => &$value ) { |
|
1412 | 1412 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
1413 | 1413 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
1414 | 1414 | } else { |
@@ -1443,7 +1443,7 @@ discard block |
||
1443 | 1443 | * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..) |
1444 | 1444 | * @param array $settings Settings array, with `number` key defining the # of users to display |
1445 | 1445 | */ |
1446 | - $get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1446 | + $get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1447 | 1447 | |
1448 | 1448 | return get_users( $get_users_settings ); |
1449 | 1449 | } |
@@ -1458,7 +1458,7 @@ discard block |
||
1458 | 1458 | * @return string |
1459 | 1459 | */ |
1460 | 1460 | public static function generate_notice( $notice, $class = '' ) { |
1461 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1461 | + return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>'; |
|
1462 | 1462 | } |
1463 | 1463 | |
1464 | 1464 | /** |
@@ -49,17 +49,17 @@ discard block |
||
49 | 49 | * |
50 | 50 | * @return string If a custom field label isn't set, return the field label for the password field |
51 | 51 | */ |
52 | - function field_label( $label = '', $field = array(), $form = array(), $entry = array() ){ |
|
52 | + function field_label( $label = '', $field = array(), $form = array(), $entry = array() ) { |
|
53 | 53 | |
54 | 54 | // If using a custom label, no need to fetch the parent label |
55 | - if( ! is_numeric( $field['id'] ) || ! empty( $field['custom_label'] ) ) { |
|
55 | + if ( ! is_numeric( $field[ 'id' ] ) || ! empty( $field[ 'custom_label' ] ) ) { |
|
56 | 56 | return $label; |
57 | 57 | } |
58 | 58 | |
59 | - $field_object = GFFormsModel::get_field( $form, $field['id'] ); |
|
59 | + $field_object = GFFormsModel::get_field( $form, $field[ 'id' ] ); |
|
60 | 60 | |
61 | - if( $field_object && 'password' === $field_object->type ) { |
|
62 | - $label = $field['label']; |
|
61 | + if ( $field_object && 'password' === $field_object->type ) { |
|
62 | + $label = $field[ 'label' ]; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | return $label; |
@@ -79,16 +79,16 @@ discard block |
||
79 | 79 | function add_form_fields( $fields = array(), $form = array(), $include_parent_field = true ) { |
80 | 80 | |
81 | 81 | foreach ( $fields as $key => $field ) { |
82 | - if( 'password' === $field['type'] ) { |
|
82 | + if ( 'password' === $field[ 'type' ] ) { |
|
83 | 83 | |
84 | 84 | // The Enter Password input |
85 | - if( floor( $key ) === floatval( $key ) ) { |
|
86 | - $field['label'] = $field['parent']->label; |
|
87 | - $field['adminOnly'] = $field['parent']->adminOnly; |
|
88 | - $field['adminLabel'] = $field['parent']->adminLabel; |
|
85 | + if ( floor( $key ) === floatval( $key ) ) { |
|
86 | + $field[ 'label' ] = $field[ 'parent' ]->label; |
|
87 | + $field[ 'adminOnly' ] = $field[ 'parent' ]->adminOnly; |
|
88 | + $field[ 'adminLabel' ] = $field[ 'parent' ]->adminLabel; |
|
89 | 89 | |
90 | 90 | // Don't show as a child input |
91 | - unset( $field['parent'] ); |
|
91 | + unset( $field[ 'parent' ] ); |
|
92 | 92 | |
93 | 93 | $fields[ $key ] = $field; |
94 | 94 | } else { |
@@ -28,30 +28,30 @@ discard block |
||
28 | 28 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 ); |
29 | 29 | |
30 | 30 | // Tooltips |
31 | - add_filter( 'gform_tooltips', array( $this, 'tooltips') ); |
|
31 | + add_filter( 'gform_tooltips', array( $this, 'tooltips' ) ); |
|
32 | 32 | |
33 | 33 | // adding styles and scripts |
34 | - add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 ); |
|
35 | - add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
36 | - add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
37 | - add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
38 | - add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
39 | - |
|
40 | - add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 ); |
|
41 | - add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 ); |
|
42 | - add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 ); |
|
43 | - add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') ); |
|
44 | - add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 ); |
|
34 | + add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 ); |
|
35 | + add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
36 | + add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
37 | + add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
38 | + add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
39 | + |
|
40 | + add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 ); |
|
41 | + add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 ); |
|
42 | + add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 ); |
|
43 | + add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) ); |
|
44 | + add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 ); |
|
45 | 45 | |
46 | 46 | // @todo check if this hook is needed.. |
47 | 47 | //add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 ); |
48 | 48 | |
49 | 49 | // Add Connected Form column |
50 | - add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) ); |
|
50 | + add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) ); |
|
51 | 51 | |
52 | 52 | add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
53 | 53 | |
54 | - add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 ); |
|
54 | + add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 ); |
|
55 | 55 | |
56 | 56 | add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) ); |
57 | 57 | |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | public function filter_pre_get_posts_by_gravityview_form_id( &$query ) { |
67 | 67 | global $pagenow; |
68 | 68 | |
69 | - if ( !is_admin() ) { |
|
69 | + if ( ! is_admin() ) { |
|
70 | 70 | return; |
71 | 71 | } |
72 | 72 | |
73 | - if( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
73 | + if ( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
74 | 74 | return; |
75 | 75 | } |
76 | 76 | |
@@ -87,18 +87,18 @@ discard block |
||
87 | 87 | function add_view_dropdown() { |
88 | 88 | $current_screen = get_current_screen(); |
89 | 89 | |
90 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
90 | + if ( 'gravityview' !== $current_screen->post_type ) { |
|
91 | 91 | return; |
92 | 92 | } |
93 | 93 | |
94 | 94 | $forms = gravityview_get_forms(); |
95 | 95 | $current_form = rgget( 'gravityview_form_id' ); |
96 | 96 | // If there are no forms to select, show no forms. |
97 | - if( !empty( $forms ) ) { ?> |
|
97 | + if ( ! empty( $forms ) ) { ?> |
|
98 | 98 | <select name="gravityview_form_id" id="gravityview_form_id"> |
99 | 99 | <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option> |
100 | - <?php foreach( $forms as $form ) { ?> |
|
101 | - <option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
100 | + <?php foreach ( $forms as $form ) { ?> |
|
101 | + <option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
102 | 102 | <?php } ?> |
103 | 103 | </select> |
104 | 104 | <?php } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
113 | 113 | _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
114 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
114 | + GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id ); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -134,37 +134,37 @@ discard block |
||
134 | 134 | |
135 | 135 | $connected_views = gravityview_get_connected_views( $id ); |
136 | 136 | |
137 | - if( empty( $connected_views ) ) { |
|
137 | + if ( empty( $connected_views ) ) { |
|
138 | 138 | return $menu_items; |
139 | 139 | } |
140 | 140 | |
141 | 141 | $sub_menu_items = array(); |
142 | 142 | foreach ( (array)$connected_views as $view ) { |
143 | 143 | |
144 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
144 | + if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
145 | 145 | continue; |
146 | 146 | } |
147 | 147 | |
148 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
148 | + $label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
149 | 149 | |
150 | - $sub_menu_items[] = array( |
|
150 | + $sub_menu_items[ ] = array( |
|
151 | 151 | 'label' => esc_attr( $label ), |
152 | - 'url' => admin_url( 'post.php?action=edit&post='.$view->ID ), |
|
152 | + 'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ), |
|
153 | 153 | ); |
154 | 154 | } |
155 | 155 | |
156 | 156 | // If there were no items added, then let's create the parent menu |
157 | - if( $sub_menu_items ) { |
|
157 | + if ( $sub_menu_items ) { |
|
158 | 158 | |
159 | 159 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
160 | - $sub_menu_items[] = array( |
|
160 | + $sub_menu_items[ ] = array( |
|
161 | 161 | 'url' => '#', |
162 | 162 | 'label' => '', |
163 | 163 | 'menu_class' => 'hidden', |
164 | 164 | 'capabilities' => '', |
165 | 165 | ); |
166 | 166 | |
167 | - $menu_items['gravityview'] = array( |
|
167 | + $menu_items[ 'gravityview' ] = array( |
|
168 | 168 | 'label' => __( 'Connected Views', 'gravityview' ), |
169 | 169 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
170 | 170 | 'title' => __( 'GravityView Views using this form as a data source', 'gravityview' ), |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | $add = array( 'captcha', 'page' ); |
195 | 195 | |
196 | 196 | // Don't allowing editing the following values: |
197 | - if( $context === 'edit' ) { |
|
198 | - $add[] = 'post_id'; |
|
197 | + if ( $context === 'edit' ) { |
|
198 | + $add[ ] = 'post_id'; |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | $return = array_merge( $array, $add ); |
@@ -218,32 +218,32 @@ discard block |
||
218 | 218 | foreach ( $default_args as $key => $arg ) { |
219 | 219 | |
220 | 220 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
221 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
221 | + if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; } |
|
222 | 222 | |
223 | 223 | // By default, use `tooltip` if defined. |
224 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
224 | + $tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ]; |
|
225 | 225 | |
226 | 226 | // Otherwise, use the description as a tooltip. |
227 | - if( empty( $tooltip ) && !empty( $arg['desc'] ) ) { |
|
228 | - $tooltip = $arg['desc']; |
|
227 | + if ( empty( $tooltip ) && ! empty( $arg[ 'desc' ] ) ) { |
|
228 | + $tooltip = $arg[ 'desc' ]; |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | // If there's no tooltip set, continue |
232 | - if( empty( $tooltip ) ) { |
|
232 | + if ( empty( $tooltip ) ) { |
|
233 | 233 | continue; |
234 | 234 | } |
235 | 235 | |
236 | 236 | // Add the tooltip |
237 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
238 | - 'title' => $arg['label'], |
|
237 | + $gv_tooltips[ 'gv_' . $key ] = array( |
|
238 | + 'title' => $arg[ 'label' ], |
|
239 | 239 | 'value' => $tooltip, |
240 | 240 | ); |
241 | 241 | |
242 | 242 | } |
243 | 243 | |
244 | - $gv_tooltips['gv_css_merge_tags'] = array( |
|
245 | - 'title' => __('CSS Merge Tags', 'gravityview'), |
|
246 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' ) |
|
244 | + $gv_tooltips[ 'gv_css_merge_tags' ] = array( |
|
245 | + 'title' => __( 'CSS Merge Tags', 'gravityview' ), |
|
246 | + 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' ) |
|
247 | 247 | ); |
248 | 248 | |
249 | 249 | /** |
@@ -254,9 +254,9 @@ discard block |
||
254 | 254 | |
255 | 255 | foreach ( $gv_tooltips as $key => $tooltip ) { |
256 | 256 | |
257 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
257 | + $title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>'; |
|
258 | 258 | |
259 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
259 | + $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) ); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | return $tooltips; |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * |
271 | 271 | * @return void |
272 | 272 | */ |
273 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
273 | + public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
274 | 274 | |
275 | 275 | $output = ''; |
276 | 276 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
293 | 293 | $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
294 | 294 | |
295 | - $output = $template ? $template['label'] : $template_id_pretty; |
|
295 | + $output = $template ? $template[ 'label' ] : $template_id_pretty; |
|
296 | 296 | |
297 | 297 | break; |
298 | 298 | |
@@ -333,44 +333,44 @@ discard block |
||
333 | 333 | static public function get_connected_form_links( $form, $include_form_link = true ) { |
334 | 334 | |
335 | 335 | // Either the form is empty or the form ID is 0, not yet set. |
336 | - if( empty( $form ) ) { |
|
336 | + if ( empty( $form ) ) { |
|
337 | 337 | return ''; |
338 | 338 | } |
339 | 339 | |
340 | 340 | // The $form is passed as the form ID |
341 | - if( !is_array( $form ) ) { |
|
341 | + if ( ! is_array( $form ) ) { |
|
342 | 342 | $form = gravityview_get_form( $form ); |
343 | 343 | } |
344 | 344 | |
345 | - $form_id = $form['id']; |
|
345 | + $form_id = $form[ 'id' ]; |
|
346 | 346 | $links = array(); |
347 | 347 | |
348 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
348 | + if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
349 | 349 | $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
350 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
351 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>'; |
|
350 | + $form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>'; |
|
351 | + $links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>'; |
|
352 | 352 | } else { |
353 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
353 | + $form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>'; |
|
354 | 354 | } |
355 | 355 | |
356 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
356 | + if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
357 | 357 | $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
358 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>'; |
|
358 | + $links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>'; |
|
359 | 359 | } |
360 | 360 | |
361 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
361 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
362 | 362 | $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
363 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>'; |
|
363 | + $links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>'; |
|
364 | 364 | } |
365 | 365 | |
366 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
366 | + if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) { |
|
367 | 367 | $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
368 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>'; |
|
368 | + $links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>'; |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | $output = ''; |
372 | 372 | |
373 | - if( !empty( $include_form_link ) ) { |
|
373 | + if ( ! empty( $include_form_link ) ) { |
|
374 | 374 | $output .= $form_link; |
375 | 375 | } |
376 | 376 | |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | */ |
383 | 383 | $links = apply_filters( 'gravityview_connected_form_links', $links, $form ); |
384 | 384 | |
385 | - $output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>'; |
|
385 | + $output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>'; |
|
386 | 386 | |
387 | 387 | return $output; |
388 | 388 | } |
@@ -396,8 +396,8 @@ discard block |
||
396 | 396 | // Get the date column and save it for later to add back in. |
397 | 397 | // This adds it after the Data Source column. |
398 | 398 | // This way, we don't need to do array_slice, array_merge, etc. |
399 | - $date = $columns['date']; |
|
400 | - unset( $columns['date'] ); |
|
399 | + $date = $columns[ 'date' ]; |
|
400 | + unset( $columns[ 'date' ] ); |
|
401 | 401 | |
402 | 402 | $data_source_required_caps = array( |
403 | 403 | 'gravityforms_edit_forms', |
@@ -408,14 +408,14 @@ discard block |
||
408 | 408 | 'gravityforms_preview_forms', |
409 | 409 | ); |
410 | 410 | |
411 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
412 | - $columns['gv_connected_form'] = __( 'Data Source', 'gravityview' ); |
|
411 | + if ( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
412 | + $columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' ); |
|
413 | 413 | } |
414 | 414 | |
415 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
415 | + $columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
416 | 416 | |
417 | 417 | // Add the date back in. |
418 | - $columns['date'] = $date; |
|
418 | + $columns[ 'date' ] = $date; |
|
419 | 419 | |
420 | 420 | return $columns; |
421 | 421 | } |
@@ -429,12 +429,12 @@ discard block |
||
429 | 429 | */ |
430 | 430 | function save_postdata( $post_id ) { |
431 | 431 | |
432 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
432 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
433 | 433 | return; |
434 | 434 | } |
435 | 435 | |
436 | 436 | // validate post_type |
437 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
437 | + if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) { |
|
438 | 438 | return; |
439 | 439 | } |
440 | 440 | |
@@ -449,67 +449,67 @@ discard block |
||
449 | 449 | $statii = array(); |
450 | 450 | |
451 | 451 | // check if this is a start fresh View |
452 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
452 | + if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) { |
|
453 | 453 | |
454 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
454 | + $form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : ''; |
|
455 | 455 | // save form id |
456 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
456 | + $statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
457 | 457 | |
458 | 458 | } |
459 | 459 | |
460 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
460 | + if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) { |
|
461 | 461 | do_action( 'gravityview_log_error', __METHOD__ . ' - Current user does not have the capability to create a new Form.', wp_get_current_user() ); |
462 | 462 | return; |
463 | 463 | } |
464 | 464 | |
465 | 465 | // Was this a start fresh? |
466 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
467 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
466 | + if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) { |
|
467 | + $statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
468 | 468 | } else { |
469 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
469 | + $statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | // Check if we have a template id |
473 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
473 | + if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) { |
|
474 | 474 | |
475 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
475 | + $template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : ''; |
|
476 | 476 | |
477 | 477 | // now save template id |
478 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
478 | + $statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | |
482 | 482 | // save View Configuration metabox |
483 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
483 | + if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) { |
|
484 | 484 | |
485 | 485 | // template settings |
486 | - if( empty( $_POST['template_settings'] ) ) { |
|
487 | - $_POST['template_settings'] = array(); |
|
486 | + if ( empty( $_POST[ 'template_settings' ] ) ) { |
|
487 | + $_POST[ 'template_settings' ] = array(); |
|
488 | 488 | } |
489 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
489 | + $statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] ); |
|
490 | 490 | |
491 | 491 | $fields = array(); |
492 | 492 | |
493 | 493 | // Directory&single Visible Fields |
494 | - if( !empty( $preset_fields ) ) { |
|
494 | + if ( ! empty( $preset_fields ) ) { |
|
495 | 495 | |
496 | 496 | $fields = $preset_fields; |
497 | 497 | |
498 | - } elseif( !empty( $_POST['fields'] ) ) { |
|
498 | + } elseif ( ! empty( $_POST[ 'fields' ] ) ) { |
|
499 | 499 | $fields = _gravityview_process_posted_fields(); |
500 | 500 | } |
501 | 501 | |
502 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
502 | + $statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
503 | 503 | |
504 | 504 | // Directory Visible Widgets |
505 | - if( empty( $_POST['widgets'] ) ) { |
|
506 | - $_POST['widgets'] = array(); |
|
505 | + if ( empty( $_POST[ 'widgets' ] ) ) { |
|
506 | + $_POST[ 'widgets' ] = array(); |
|
507 | 507 | } |
508 | - $statii['directory_widgets'] = update_post_meta( $post_id, '_gravityview_directory_widgets', $_POST['widgets'] ); |
|
508 | + $statii[ 'directory_widgets' ] = update_post_meta( $post_id, '_gravityview_directory_widgets', $_POST[ 'widgets' ] ); |
|
509 | 509 | |
510 | 510 | } // end save view configuration |
511 | 511 | |
512 | - do_action('gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) ); |
|
512 | + do_action( 'gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) ); |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | /** |
@@ -541,20 +541,20 @@ discard block |
||
541 | 541 | |
542 | 542 | $output = ''; |
543 | 543 | |
544 | - if( !empty( $fields ) ) { |
|
544 | + if ( ! empty( $fields ) ) { |
|
545 | 545 | |
546 | - foreach( $fields as $id => $details ) { |
|
546 | + foreach ( $fields as $id => $details ) { |
|
547 | 547 | |
548 | - if( in_array( $details['type'], $blacklist_field_types ) ) { |
|
548 | + if ( in_array( $details[ 'type' ], $blacklist_field_types ) ) { |
|
549 | 549 | continue; |
550 | 550 | } |
551 | 551 | |
552 | 552 | // Edit mode only allows editing the parent fields, not single inputs. |
553 | - if( $context === 'edit' && !empty( $details['parent'] ) ) { |
|
553 | + if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) { |
|
554 | 554 | continue; |
555 | 555 | } |
556 | 556 | |
557 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details ); |
|
557 | + $output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details ); |
|
558 | 558 | |
559 | 559 | } // End foreach |
560 | 560 | } |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | echo $output; |
563 | 563 | |
564 | 564 | // For the EDIT view we only want to allow the form fields. |
565 | - if( $context === 'edit' ) { |
|
565 | + if ( $context === 'edit' ) { |
|
566 | 566 | return; |
567 | 567 | } |
568 | 568 | |
@@ -586,16 +586,16 @@ discard block |
||
586 | 586 | $additional_fields = apply_filters( 'gravityview_additional_fields', array( |
587 | 587 | array( |
588 | 588 | 'label_text' => __( '+ Add All Fields', 'gravityview' ), |
589 | - 'desc' => __('Add all the available fields at once.', 'gravityview'), |
|
589 | + 'desc' => __( 'Add all the available fields at once.', 'gravityview' ), |
|
590 | 590 | 'field_id' => 'all-fields', |
591 | 591 | 'label_type' => 'field', |
592 | 592 | 'input_type' => NULL, |
593 | 593 | 'field_options' => NULL, |
594 | 594 | 'settings_html' => NULL, |
595 | 595 | ) |
596 | - )); |
|
596 | + ) ); |
|
597 | 597 | |
598 | - if( !empty( $additional_fields )) { |
|
598 | + if ( ! empty( $additional_fields ) ) { |
|
599 | 599 | foreach ( (array)$additional_fields as $item ) { |
600 | 600 | |
601 | 601 | // Prevent items from not having index set |
@@ -606,16 +606,16 @@ discard block |
||
606 | 606 | 'input_type' => NULL, |
607 | 607 | 'field_options' => NULL, |
608 | 608 | 'settings_html' => NULL, |
609 | - )); |
|
609 | + ) ); |
|
610 | 610 | |
611 | 611 | // Backward compat. |
612 | - if( !empty( $item['field_options'] ) ) { |
|
612 | + if ( ! empty( $item[ 'field_options' ] ) ) { |
|
613 | 613 | // Use settings_html from now on. |
614 | - $item['settings_html'] = $item['field_options']; |
|
614 | + $item[ 'settings_html' ] = $item[ 'field_options' ]; |
|
615 | 615 | } |
616 | 616 | |
617 | 617 | // Render a label for each of them |
618 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item ); |
|
618 | + echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item ); |
|
619 | 619 | |
620 | 620 | } |
621 | 621 | } |
@@ -628,72 +628,72 @@ discard block |
||
628 | 628 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
629 | 629 | * @return array |
630 | 630 | */ |
631 | - function get_entry_default_fields($form, $zone) { |
|
631 | + function get_entry_default_fields( $form, $zone ) { |
|
632 | 632 | |
633 | 633 | $entry_default_fields = array(); |
634 | 634 | |
635 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
635 | + if ( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
636 | 636 | |
637 | 637 | $entry_default_fields = array( |
638 | 638 | 'id' => array( |
639 | - 'label' => __('Entry ID', 'gravityview'), |
|
639 | + 'label' => __( 'Entry ID', 'gravityview' ), |
|
640 | 640 | 'type' => 'id', |
641 | - 'desc' => __('The unique ID of the entry.', 'gravityview'), |
|
641 | + 'desc' => __( 'The unique ID of the entry.', 'gravityview' ), |
|
642 | 642 | ), |
643 | 643 | 'date_created' => array( |
644 | - 'label' => __('Entry Date', 'gravityview'), |
|
645 | - 'desc' => __('The date the entry was created.', 'gravityview'), |
|
644 | + 'label' => __( 'Entry Date', 'gravityview' ), |
|
645 | + 'desc' => __( 'The date the entry was created.', 'gravityview' ), |
|
646 | 646 | 'type' => 'date_created', |
647 | 647 | ), |
648 | 648 | 'source_url' => array( |
649 | - 'label' => __('Source URL', 'gravityview'), |
|
649 | + 'label' => __( 'Source URL', 'gravityview' ), |
|
650 | 650 | 'type' => 'source_url', |
651 | - 'desc' => __('The URL of the page where the form was submitted.', 'gravityview'), |
|
651 | + 'desc' => __( 'The URL of the page where the form was submitted.', 'gravityview' ), |
|
652 | 652 | ), |
653 | 653 | 'ip' => array( |
654 | - 'label' => __('User IP', 'gravityview'), |
|
654 | + 'label' => __( 'User IP', 'gravityview' ), |
|
655 | 655 | 'type' => 'ip', |
656 | - 'desc' => __('The IP Address of the user who created the entry.', 'gravityview'), |
|
656 | + 'desc' => __( 'The IP Address of the user who created the entry.', 'gravityview' ), |
|
657 | 657 | ), |
658 | 658 | 'created_by' => array( |
659 | - 'label' => __('User', 'gravityview'), |
|
659 | + 'label' => __( 'User', 'gravityview' ), |
|
660 | 660 | 'type' => 'created_by', |
661 | - 'desc' => __('Details of the logged-in user who created the entry (if any).', 'gravityview'), |
|
661 | + 'desc' => __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ), |
|
662 | 662 | ), |
663 | 663 | |
664 | 664 | /** |
665 | 665 | * @since 1.2 |
666 | 666 | */ |
667 | 667 | 'custom' => array( |
668 | - 'label' => __('Custom Content', 'gravityview'), |
|
668 | + 'label' => __( 'Custom Content', 'gravityview' ), |
|
669 | 669 | 'type' => 'custom', |
670 | - 'desc' => __('Insert custom text or HTML.', 'gravityview'), |
|
670 | + 'desc' => __( 'Insert custom text or HTML.', 'gravityview' ), |
|
671 | 671 | ), |
672 | 672 | |
673 | 673 | /** |
674 | 674 | * @since 1.7.2 |
675 | 675 | */ |
676 | 676 | 'other_entries' => array( |
677 | - 'label' => __('Other Entries', 'gravityview'), |
|
677 | + 'label' => __( 'Other Entries', 'gravityview' ), |
|
678 | 678 | 'type' => 'other_entries', |
679 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
679 | + 'desc' => __( 'Display other entries created by the entry creator.', 'gravityview' ), |
|
680 | 680 | ), |
681 | 681 | |
682 | 682 | /** |
683 | 683 | * @since 1.14 |
684 | 684 | */ |
685 | 685 | 'notes' => array( |
686 | - 'label' => __('Entry Notes', 'gravityview'), |
|
686 | + 'label' => __( 'Entry Notes', 'gravityview' ), |
|
687 | 687 | 'type' => 'notes', |
688 | - 'desc' => __('Entry notes (if any).', 'gravityview'), |
|
688 | + 'desc' => __( 'Entry notes (if any).', 'gravityview' ), |
|
689 | 689 | ), |
690 | 690 | ); |
691 | 691 | |
692 | - if( 'single' !== $zone) { |
|
692 | + if ( 'single' !== $zone ) { |
|
693 | 693 | |
694 | - $entry_default_fields['entry_link'] = array( |
|
695 | - 'label' => __('Link to Entry', 'gravityview'), |
|
696 | - 'desc' => __('A dedicated link to the single entry with customizable text.', 'gravityview'), |
|
694 | + $entry_default_fields[ 'entry_link' ] = array( |
|
695 | + 'label' => __( 'Link to Entry', 'gravityview' ), |
|
696 | + 'desc' => __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ), |
|
697 | 697 | 'type' => 'entry_link', |
698 | 698 | ); |
699 | 699 | } |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | * @param string|array $form form_ID or form object |
708 | 708 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
709 | 709 | */ |
710 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
710 | + return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone ); |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | /** |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | */ |
719 | 719 | function get_available_fields( $form = '', $zone = NULL ) { |
720 | 720 | |
721 | - if( empty( $form ) ) { |
|
721 | + if ( empty( $form ) ) { |
|
722 | 722 | do_action( 'gravityview_log_error', '[get_available_fields] $form is empty' ); |
723 | 723 | return array(); |
724 | 724 | } |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | $fields = gravityview_get_form_fields( $form, true ); |
728 | 728 | |
729 | 729 | // get meta fields ( only if form was already created ) |
730 | - if( !is_array( $form ) ) { |
|
730 | + if ( ! is_array( $form ) ) { |
|
731 | 731 | $meta_fields = gravityview_get_entry_meta( $form ); |
732 | 732 | } else { |
733 | 733 | $meta_fields = array(); |
@@ -751,11 +751,11 @@ discard block |
||
751 | 751 | |
752 | 752 | $widgets = $this->get_registered_widgets(); |
753 | 753 | |
754 | - if( !empty( $widgets ) ) { |
|
754 | + if ( ! empty( $widgets ) ) { |
|
755 | 755 | |
756 | - foreach( $widgets as $id => $details ) { |
|
756 | + foreach ( $widgets as $id => $details ) { |
|
757 | 757 | |
758 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
758 | + echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details ); |
|
759 | 759 | |
760 | 760 | } |
761 | 761 | } |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
790 | 790 | global $post; |
791 | 791 | |
792 | - if( $type === 'widget' ) { |
|
792 | + if ( $type === 'widget' ) { |
|
793 | 793 | $button_label = __( 'Add Widget', 'gravityview' ); |
794 | 794 | } else { |
795 | 795 | $button_label = __( 'Add Field', 'gravityview' ); |
@@ -798,15 +798,15 @@ discard block |
||
798 | 798 | $available_items = array(); |
799 | 799 | |
800 | 800 | // if saved values, get available fields to label everyone |
801 | - if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) { |
|
801 | + if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) { |
|
802 | 802 | |
803 | - if( !empty( $_POST['template_id'] ) ) { |
|
804 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
803 | + if ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
804 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
805 | 805 | } else { |
806 | 806 | $form = gravityview_get_form_id( $post->ID ); |
807 | 807 | } |
808 | 808 | |
809 | - if( 'field' === $type ) { |
|
809 | + if ( 'field' === $type ) { |
|
810 | 810 | $available_items = $this->get_available_fields( $form, $zone ); |
811 | 811 | } else { |
812 | 812 | $available_items = $this->get_registered_widgets(); |
@@ -814,39 +814,39 @@ discard block |
||
814 | 814 | |
815 | 815 | } |
816 | 816 | |
817 | - foreach( $rows as $row ) : |
|
818 | - foreach( $row as $col => $areas ) : |
|
819 | - $column = ($col == '2-2') ? '1-2' : $col; ?> |
|
817 | + foreach ( $rows as $row ) : |
|
818 | + foreach ( $row as $col => $areas ) : |
|
819 | + $column = ( $col == '2-2' ) ? '1-2' : $col; ?> |
|
820 | 820 | |
821 | 821 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
822 | 822 | |
823 | - <?php foreach( $areas as $area ) : ?> |
|
823 | + <?php foreach ( $areas as $area ) : ?> |
|
824 | 824 | |
825 | 825 | <div class="gv-droppable-area"> |
826 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"> |
|
826 | + <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"> |
|
827 | 827 | |
828 | 828 | <?php // render saved fields |
829 | 829 | |
830 | - if( !empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
830 | + if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
831 | 831 | |
832 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
832 | + foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) { |
|
833 | 833 | |
834 | 834 | $input_type = NULL; |
835 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
835 | + $original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false; |
|
836 | 836 | |
837 | - if( !$original_item ) { |
|
837 | + if ( ! $original_item ) { |
|
838 | 838 | |
839 | - do_action('gravityview_log_error', 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array('available_items' => $available_items, 'field' => $field )); |
|
839 | + do_action( 'gravityview_log_error', 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array( 'available_items' => $available_items, 'field' => $field ) ); |
|
840 | 840 | |
841 | 841 | $original_item = $field; |
842 | 842 | } else { |
843 | 843 | |
844 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL; |
|
844 | + $input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL; |
|
845 | 845 | |
846 | 846 | } |
847 | 847 | |
848 | 848 | // Field options dialog box |
849 | - $field_options = GravityView_Render_Settings::render_field_options( $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item ); |
|
849 | + $field_options = GravityView_Render_Settings::render_field_options( $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item ); |
|
850 | 850 | |
851 | 851 | $item = array( |
852 | 852 | 'input_type' => $input_type, |
@@ -855,16 +855,16 @@ discard block |
||
855 | 855 | ); |
856 | 856 | |
857 | 857 | // Merge the values with the current item to pass things like widget descriptions and original field names |
858 | - if( $original_item ) { |
|
858 | + if ( $original_item ) { |
|
859 | 859 | $item = wp_parse_args( $item, $original_item ); |
860 | 860 | } |
861 | 861 | |
862 | - switch( $type ) { |
|
862 | + switch ( $type ) { |
|
863 | 863 | case 'widget': |
864 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
864 | + echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
865 | 865 | break; |
866 | 866 | default: |
867 | - echo new GravityView_Admin_View_Field( $item['label'], $field['id'], $item, $field ); |
|
867 | + echo new GravityView_Admin_View_Field( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | |
@@ -874,11 +874,11 @@ discard block |
||
874 | 874 | |
875 | 875 | } // End if zone is not empty ?> |
876 | 876 | |
877 | - <span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type ); ?></span> |
|
877 | + <span class="drop-message"><?php echo sprintf( esc_attr__( '"+ %s" or drag existing %ss here.', 'gravityview' ), $button_label, $type ); ?></span> |
|
878 | 878 | </div> |
879 | 879 | <div class="gv-droppable-area-action"> |
880 | - <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"><?php echo '+ '.esc_html( $button_label ); ?></a> |
|
881 | - <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area['title'] ); ?></strong><?php if( !empty( $area['subtitle'] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area['subtitle'] ); ?></span><?php } ?></p> |
|
880 | + <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"><?php echo '+ ' . esc_html( $button_label ); ?></a> |
|
881 | + <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area[ 'title' ] ); ?></strong><?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area[ 'subtitle' ] ); ?></span><?php } ?></p> |
|
882 | 882 | </div> |
883 | 883 | </div> |
884 | 884 | |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | $default_widget_areas = GravityView_Plugin::get_default_widget_areas(); |
901 | 901 | |
902 | 902 | $widgets = array(); |
903 | - if( !empty( $post_id ) ) { |
|
903 | + if ( ! empty( $post_id ) ) { |
|
904 | 904 | $widgets = get_post_meta( $post_id, '_gravityview_directory_widgets', true ); |
905 | 905 | |
906 | 906 | } |
@@ -931,19 +931,19 @@ discard block |
||
931 | 931 | */ |
932 | 932 | function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) { |
933 | 933 | |
934 | - if( empty( $template_id ) ) { |
|
934 | + if ( empty( $template_id ) ) { |
|
935 | 935 | do_action( 'gravityview_log_debug', '[render_directory_active_areas] $template_id is empty' ); |
936 | 936 | return; |
937 | 937 | } |
938 | 938 | |
939 | 939 | $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
940 | 940 | |
941 | - if( empty( $template_areas ) ) { |
|
941 | + if ( empty( $template_areas ) ) { |
|
942 | 942 | |
943 | 943 | do_action( 'gravityview_log_debug', '[render_directory_active_areas] No areas defined. Maybe template %s is disabled.', $template_id ); |
944 | 944 | $output = '<div>'; |
945 | - $output .= '<h2 class="description" style="font-size: 16px; margin:0">'. sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>'.$template_id.'</em>' ) .'</h2>'; |
|
946 | - $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">'.esc_html__('The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview').'</p>'; |
|
945 | + $output .= '<h2 class="description" style="font-size: 16px; margin:0">' . sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>' . $template_id . '</em>' ) . '</h2>'; |
|
946 | + $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">' . esc_html__( 'The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview' ) . '</p>'; |
|
947 | 947 | $output .= '</div>'; |
948 | 948 | } else { |
949 | 949 | |
@@ -958,7 +958,7 @@ discard block |
||
958 | 958 | |
959 | 959 | } |
960 | 960 | |
961 | - if( $echo ) { |
|
961 | + if ( $echo ) { |
|
962 | 962 | echo $output; |
963 | 963 | } |
964 | 964 | |
@@ -978,25 +978,25 @@ discard block |
||
978 | 978 | $is_widgets_page = ( $pagenow === 'widgets.php' ); |
979 | 979 | |
980 | 980 | // Add the GV font (with the Astronaut) |
981 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
981 | + wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
982 | 982 | |
983 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
983 | + wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
984 | 984 | |
985 | 985 | // Don't process any scripts below here if it's not a GravityView page. |
986 | - if( !gravityview_is_admin_page($hook) && !$is_widgets_page ) { return; } |
|
986 | + if ( ! gravityview_is_admin_page( $hook ) && ! $is_widgets_page ) { return; } |
|
987 | 987 | |
988 | 988 | // Only enqueue the following on single pages |
989 | - if( gravityview_is_admin_page($hook, 'single') || $is_widgets_page ) { |
|
989 | + if ( gravityview_is_admin_page( $hook, 'single' ) || $is_widgets_page ) { |
|
990 | 990 | |
991 | 991 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
992 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version ); |
|
992 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), GravityView_Plugin::version ); |
|
993 | 993 | |
994 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
994 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
995 | 995 | |
996 | 996 | //enqueue scripts |
997 | 997 | wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), GravityView_Plugin::version ); |
998 | 998 | |
999 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
999 | + wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
|
1000 | 1000 | 'cookiepath' => COOKIEPATH, |
1001 | 1001 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
1002 | 1002 | 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
@@ -1009,9 +1009,9 @@ discard block |
||
1009 | 1009 | 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
1010 | 1010 | 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
1011 | 1011 | 'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ), |
1012 | - )); |
|
1012 | + ) ); |
|
1013 | 1013 | |
1014 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
1014 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
1015 | 1015 | |
1016 | 1016 | self::enqueue_gravity_forms_scripts(); |
1017 | 1017 | |
@@ -1030,10 +1030,10 @@ discard block |
||
1030 | 1030 | ); |
1031 | 1031 | |
1032 | 1032 | if ( wp_is_mobile() ) { |
1033 | - $scripts[] = 'jquery-touch-punch'; |
|
1033 | + $scripts[ ] = 'jquery-touch-punch'; |
|
1034 | 1034 | } |
1035 | 1035 | |
1036 | - foreach ($scripts as $script) { |
|
1036 | + foreach ( $scripts as $script ) { |
|
1037 | 1037 | wp_enqueue_script( $script ); |
1038 | 1038 | } |
1039 | 1039 | } |
@@ -1042,11 +1042,11 @@ discard block |
||
1042 | 1042 | |
1043 | 1043 | $filter = current_filter(); |
1044 | 1044 | |
1045 | - if( preg_match('/script/ism', $filter ) ) { |
|
1045 | + if ( preg_match( '/script/ism', $filter ) ) { |
|
1046 | 1046 | $allow_scripts = array( 'jquery-ui-core', 'jquery-ui-dialog', 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'gravityview_views_scripts', 'gravityview-support', 'gravityview-jquery-cookie', 'gravityview_views_datepicker', |
1047 | 1047 | 'sack', 'gform_gravityforms', 'gform_forms', 'gform_form_admin', 'jquery-ui-autocomplete' ); |
1048 | 1048 | $registered = array_merge( $registered, $allow_scripts ); |
1049 | - } elseif( preg_match('/style/ism', $filter ) ) { |
|
1049 | + } elseif ( preg_match( '/style/ism', $filter ) ) { |
|
1050 | 1050 | $allow_styles = array( 'dashicons', 'wp-jquery-ui-dialog', 'gravityview_views_styles', 'gravityview_global', 'gravityview_views_datepicker' ); |
1051 | 1051 | $registered = array_merge( $registered, $allow_styles ); |
1052 | 1052 | } |
@@ -32,19 +32,19 @@ discard block |
||
32 | 32 | // If there's an overriding CSS file in the current template folder, use it. |
33 | 33 | $template_css_path = trailingslashit( get_stylesheet_directory() ) . 'gravityview/css/' . $css_file; |
34 | 34 | |
35 | - if( file_exists( $template_css_path ) ) { |
|
35 | + if ( file_exists( $template_css_path ) ) { |
|
36 | 36 | $path = trailingslashit( get_stylesheet_directory_uri() ) . 'gravityview/css/' . $css_file; |
37 | - do_action( 'gravityview_log_debug', __FUNCTION__ . ': Stylesheet override ('. esc_attr( $css_file ) .')' ); |
|
37 | + do_action( 'gravityview_log_debug', __FUNCTION__ . ': Stylesheet override (' . esc_attr( $css_file ) . ')' ); |
|
38 | 38 | } else { |
39 | 39 | // Default: use GravityView CSS file |
40 | 40 | |
41 | 41 | // If no path is provided, assume default plugin templates CSS folder |
42 | - if( '' === $dir_path ) { |
|
42 | + if ( '' === $dir_path ) { |
|
43 | 43 | $dir_path = GRAVITYVIEW_DIR . 'templates/css/'; |
44 | 44 | } |
45 | 45 | |
46 | 46 | // plugins_url() expects a path to a file, not directory. We append a file to be stripped. |
47 | - $path = plugins_url( $css_file, trailingslashit( $dir_path ) . 'stripped-by-plugin_basename.php' ); |
|
47 | + $path = plugins_url( $css_file, trailingslashit( $dir_path ) . 'stripped-by-plugin_basename.php' ); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return $path; |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | |
83 | 83 | $parsed_permalink = parse_url( get_permalink( $id ) ); |
84 | 84 | |
85 | - $permalink_args = isset( $parsed_permalink['query'] ) ? $parsed_permalink['query'] : false; |
|
85 | + $permalink_args = isset( $parsed_permalink[ 'query' ] ) ? $parsed_permalink[ 'query' ] : false; |
|
86 | 86 | |
87 | - if( empty( $permalink_args ) ) { |
|
87 | + if ( empty( $permalink_args ) ) { |
|
88 | 88 | return array(); |
89 | 89 | } |
90 | 90 | |
@@ -109,15 +109,15 @@ discard block |
||
109 | 109 | function gv_selected( $value, $current, $echo = true, $type = 'selected' ) { |
110 | 110 | |
111 | 111 | $output = ''; |
112 | - if( is_array( $current ) ) { |
|
113 | - if( in_array( $value, $current ) ) { |
|
112 | + if ( is_array( $current ) ) { |
|
113 | + if ( in_array( $value, $current ) ) { |
|
114 | 114 | $output = __checked_selected_helper( true, true, false, $type ); |
115 | 115 | } |
116 | 116 | } else { |
117 | 117 | $output = __checked_selected_helper( $value, $current, false, $type ); |
118 | 118 | } |
119 | 119 | |
120 | - if( $echo ) { |
|
120 | + if ( $echo ) { |
|
121 | 121 | echo $output; |
122 | 122 | } |
123 | 123 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | |
128 | -if( ! function_exists( 'gravityview_sanitize_html_class' ) ) { |
|
128 | +if ( ! function_exists( 'gravityview_sanitize_html_class' ) ) { |
|
129 | 129 | |
130 | 130 | /** |
131 | 131 | * sanitize_html_class doesn't handle spaces (multiple classes). We remedy that. |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | function gravityview_strip_whitespace( $string ) { |
173 | 173 | $string = normalize_whitespace( $string ); |
174 | - return preg_replace('/[\r\n\t ]+/', ' ', $string ); |
|
174 | + return preg_replace( '/[\r\n\t ]+/', ' ', $string ); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * @return string Included file contents |
186 | 186 | */ |
187 | 187 | function gravityview_ob_include( $file_path, $object = NULL ) { |
188 | - if( ! file_exists( $file_path ) ) { |
|
188 | + if ( ! file_exists( $file_path ) ) { |
|
189 | 189 | do_action( 'gravityview_log_error', __FUNCTION__ . ': File path does not exist. ', $file_path ); |
190 | 190 | return ''; |
191 | 191 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | */ |
202 | 202 | function gravityview_get_floaty() { |
203 | 203 | |
204 | - if( function_exists('is_rtl') && is_rtl() ) { |
|
204 | + if ( function_exists( 'is_rtl' ) && is_rtl() ) { |
|
205 | 205 | $style = 'margin:10px 10px 10px 0;'; |
206 | 206 | $class = 'alignright'; |
207 | 207 | } else { |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $class = 'alignleft'; |
210 | 210 | } |
211 | 211 | |
212 | - return '<img src="'.plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ).'" class="'.$class.'" height="87" width="66" alt="The GravityView Astronaut Says:" style="'.$style.'" />'; |
|
212 | + return '<img src="' . plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) . '" class="' . $class . '" height="87" width="66" alt="The GravityView Astronaut Says:" style="' . $style . '" />'; |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -232,9 +232,9 @@ discard block |
||
232 | 232 | function gravityview_number_format( $number, $decimals = '' ) { |
233 | 233 | global $wp_locale; |
234 | 234 | |
235 | - if( '' === $decimals ) { |
|
235 | + if ( '' === $decimals ) { |
|
236 | 236 | |
237 | - $decimal_point = isset( $wp_locale ) ? $wp_locale->number_format['decimal_point'] : '.'; |
|
237 | + $decimal_point = isset( $wp_locale ) ? $wp_locale->number_format[ 'decimal_point' ] : '.'; |
|
238 | 238 | |
239 | 239 | /** |
240 | 240 | * Calculate the position of the decimal point in the number |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | $parts = parse_url( $value ); |
264 | 264 | |
265 | 265 | // No domain? Strange...show the original text. |
266 | - if( empty( $parts['host'] ) ) { |
|
266 | + if ( empty( $parts[ 'host' ] ) ) { |
|
267 | 267 | return $value; |
268 | 268 | } |
269 | 269 | |
@@ -276,16 +276,16 @@ discard block |
||
276 | 276 | * @param boolean $enable Whether to strip the scheme. Return false to show scheme. (default: true)\n |
277 | 277 | * If true: `http://example.com => example.com` |
278 | 278 | */ |
279 | - if( false === apply_filters('gravityview_anchor_text_striphttp', true) ) { |
|
279 | + if ( false === apply_filters( 'gravityview_anchor_text_striphttp', true ) ) { |
|
280 | 280 | |
281 | - if( isset( $parts['scheme'] ) ) { |
|
282 | - $return .= $parts['scheme']; |
|
281 | + if ( isset( $parts[ 'scheme' ] ) ) { |
|
282 | + $return .= $parts[ 'scheme' ]; |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | } |
286 | 286 | |
287 | 287 | // The domain, which may contain a subdomain |
288 | - $domain = $parts['host']; |
|
288 | + $domain = $parts[ 'host' ]; |
|
289 | 289 | |
290 | 290 | /** |
291 | 291 | * @filter `gravityview_anchor_text_stripwww` Strip www from the domain? |
@@ -293,10 +293,10 @@ discard block |
||
293 | 293 | * @param boolean $enable Whether to strip www. Return false to show www. (default: true)\n |
294 | 294 | * If true: `www.example.com => example.com` |
295 | 295 | */ |
296 | - $strip_www = apply_filters('gravityview_anchor_text_stripwww', true ); |
|
296 | + $strip_www = apply_filters( 'gravityview_anchor_text_stripwww', true ); |
|
297 | 297 | |
298 | - if( $strip_www ) { |
|
299 | - $domain = str_replace('www.', '', $domain ); |
|
298 | + if ( $strip_www ) { |
|
299 | + $domain = str_replace( 'www.', '', $domain ); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | /** |
@@ -306,11 +306,11 @@ discard block |
||
306 | 306 | * If true: `http://demo.example.com => example.com` \n |
307 | 307 | * If false: `http://demo.example.com => demo.example.com` |
308 | 308 | */ |
309 | - $strip_subdomains = apply_filters('gravityview_anchor_text_nosubdomain', true); |
|
309 | + $strip_subdomains = apply_filters( 'gravityview_anchor_text_nosubdomain', true ); |
|
310 | 310 | |
311 | - if( $strip_subdomains ) { |
|
311 | + if ( $strip_subdomains ) { |
|
312 | 312 | |
313 | - $domain = _gravityview_strip_subdomain( $parts['host'] ); |
|
313 | + $domain = _gravityview_strip_subdomain( $parts[ 'host' ] ); |
|
314 | 314 | |
315 | 315 | } |
316 | 316 | |
@@ -324,12 +324,12 @@ discard block |
||
324 | 324 | * If true: `http://example.com/sub/directory/page.html => example.com` \n |
325 | 325 | * If false: `http://example.com/sub/directory/page.html => example.com/sub/directory/page.html` |
326 | 326 | */ |
327 | - $root_only = apply_filters('gravityview_anchor_text_rootonly', true); |
|
327 | + $root_only = apply_filters( 'gravityview_anchor_text_rootonly', true ); |
|
328 | 328 | |
329 | - if( empty( $root_only ) ) { |
|
329 | + if ( empty( $root_only ) ) { |
|
330 | 330 | |
331 | - if( isset( $parts['path'] ) ) { |
|
332 | - $return .= $parts['path']; |
|
331 | + if ( isset( $parts[ 'path' ] ) ) { |
|
332 | + $return .= $parts[ 'path' ]; |
|
333 | 333 | } |
334 | 334 | } |
335 | 335 | |
@@ -339,12 +339,12 @@ discard block |
||
339 | 339 | * @param boolean $enable Whether to enable "root only". Return false to show full path. (default: true)\n |
340 | 340 | * If true: `http://example.com/?query=example => example.com` |
341 | 341 | */ |
342 | - $strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true ); |
|
342 | + $strip_query_string = apply_filters( 'gravityview_anchor_text_noquerystring', true ); |
|
343 | 343 | |
344 | - if( empty( $strip_query_string ) ) { |
|
344 | + if ( empty( $strip_query_string ) ) { |
|
345 | 345 | |
346 | - if( isset( $parts['query'] ) ) { |
|
347 | - $return .= '?'.$parts['query']; |
|
346 | + if ( isset( $parts[ 'query' ] ) ) { |
|
347 | + $return .= '?' . $parts[ 'query' ]; |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | } |
@@ -361,8 +361,8 @@ discard block |
||
361 | 361 | */ |
362 | 362 | function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) { |
363 | 363 | |
364 | - if( preg_match("/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) { |
|
365 | - return $matches['domain']; |
|
364 | + if ( preg_match( "/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) { |
|
365 | + return $matches[ 'domain' ]; |
|
366 | 366 | } else { |
367 | 367 | return $string_maybe_has_subdomain; |
368 | 368 | } |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | */ |
384 | 384 | function gv_empty( $value, $zero_is_empty = true, $allow_string_booleans = true ) { |
385 | 385 | |
386 | - if( |
|
386 | + if ( |
|
387 | 387 | ! isset( $value ) // If it's not set, it's empty! |
388 | 388 | || false === $value |
389 | 389 | || null === $value |
@@ -394,20 +394,20 @@ discard block |
||
394 | 394 | return true; |
395 | 395 | } |
396 | 396 | |
397 | - if( is_string( $value ) && $allow_string_booleans ) { |
|
397 | + if ( is_string( $value ) && $allow_string_booleans ) { |
|
398 | 398 | |
399 | 399 | $value = trim( $value ); |
400 | 400 | $value = strtolower( $value ); |
401 | 401 | |
402 | 402 | if ( in_array( $value, array( 'yes', 'true' ), true ) ) { |
403 | 403 | $value = true; |
404 | - } else if( in_array( $value, array( 'no', 'false' ), true ) ) { |
|
404 | + } else if ( in_array( $value, array( 'no', 'false' ), true ) ) { |
|
405 | 405 | $value = false; |
406 | 406 | } |
407 | 407 | } |
408 | 408 | |
409 | 409 | // If zero isn't empty, then if $value is a number and it's empty, it's zero. Thus, return false. |
410 | - if( ! $zero_is_empty && is_numeric( $value ) && empty( $value ) ) { |
|
410 | + if ( ! $zero_is_empty && is_numeric( $value ) && empty( $value ) ) { |
|
411 | 411 | return false; |
412 | 412 | } |
413 | 413 | |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | |
431 | 431 | // Use the original function, if exists. |
432 | 432 | // Requires WP 4.4+ |
433 | - if( function_exists( 'map_deep') ) { |
|
433 | + if ( function_exists( 'map_deep' ) ) { |
|
434 | 434 | return map_deep( $value, $callback ); |
435 | 435 | } |
436 | 436 | |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | |
496 | 496 | $exploded = explode( '.', "{$field_id}" ); |
497 | 497 | |
498 | - return isset( $exploded[1] ) ? intval( $exploded[1] ) : false; |
|
498 | + return isset( $exploded[ 1 ] ) ? intval( $exploded[ 1 ] ) : false; |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | /** |
@@ -536,13 +536,13 @@ discard block |
||
536 | 536 | */ |
537 | 537 | $args = apply_filters( 'gravityview_get_terms_choices_args', $args ); |
538 | 538 | |
539 | - $terms = get_terms( $args['taxonomy'], $args ); |
|
539 | + $terms = get_terms( $args[ 'taxonomy' ], $args ); |
|
540 | 540 | |
541 | 541 | $choices = array(); |
542 | 542 | |
543 | 543 | if ( is_array( $terms ) ) { |
544 | 544 | foreach ( $terms as $term_id => $term_name ) { |
545 | - $choices[] = array( |
|
545 | + $choices[ ] = array( |
|
546 | 546 | 'text' => $term_name, |
547 | 547 | 'value' => $term_id |
548 | 548 | ); |
@@ -566,21 +566,21 @@ discard block |
||
566 | 566 | function _gravityview_process_posted_fields() { |
567 | 567 | $fields = array(); |
568 | 568 | |
569 | - if( !empty( $_POST['fields'] ) ) { |
|
570 | - if ( ! is_array( $_POST['fields'] ) ) { |
|
569 | + if ( ! empty( $_POST[ 'fields' ] ) ) { |
|
570 | + if ( ! is_array( $_POST[ 'fields' ] ) ) { |
|
571 | 571 | |
572 | 572 | // We are not using parse_str() due to max_input_vars limitation with large View configurations |
573 | 573 | $fields_holder = array(); |
574 | - GVCommon::gv_parse_str( $_POST['fields'], $fields_holder ); |
|
574 | + GVCommon::gv_parse_str( $_POST[ 'fields' ], $fields_holder ); |
|
575 | 575 | |
576 | - if ( isset( $fields_holder['fields'] ) ) { |
|
577 | - $fields = $fields_holder['fields']; |
|
576 | + if ( isset( $fields_holder[ 'fields' ] ) ) { |
|
577 | + $fields = $fields_holder[ 'fields' ]; |
|
578 | 578 | } else { |
579 | 579 | do_action( 'gravityview_log_error', '[save_postdata] No `fields` key was found after parsing $fields string', $fields_holder ); |
580 | 580 | } |
581 | 581 | |
582 | 582 | } else { |
583 | - $fields = $_POST['fields']; |
|
583 | + $fields = $_POST[ 'fields' ]; |
|
584 | 584 | } |
585 | 585 | } |
586 | 586 |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | 'type' => 'radio', |
64 | 64 | 'full_width' => true, |
65 | 65 | 'label' => esc_html__( 'Search Mode', 'gravityview' ), |
66 | - 'desc' => __('Should search results match all search fields, or any?', 'gravityview'), |
|
66 | + 'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ), |
|
67 | 67 | 'value' => 'any', |
68 | 68 | 'class' => 'hide-if-js', |
69 | 69 | 'options' => array( |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | // admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999 |
87 | 87 | add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 ); |
88 | - add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') ); |
|
88 | + add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
89 | 89 | add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
90 | 90 | |
91 | 91 | // ajax - get the searchable fields |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
150 | 150 | $script_source = empty( $script_min ) ? '/source' : ''; |
151 | 151 | |
152 | - wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version ); |
|
152 | + wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version ); |
|
153 | 153 | |
154 | 154 | |
155 | 155 | /** |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @return array Scripts allowed in no-conflict mode, plus the search widget script |
205 | 205 | */ |
206 | 206 | public function register_no_conflict( $allowed ) { |
207 | - $allowed[] = 'gravityview_searchwidget_admin'; |
|
207 | + $allowed[ ] = 'gravityview_searchwidget_admin'; |
|
208 | 208 | return $allowed; |
209 | 209 | } |
210 | 210 | |
@@ -217,24 +217,24 @@ discard block |
||
217 | 217 | */ |
218 | 218 | public static function get_searchable_fields() { |
219 | 219 | |
220 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) { |
|
220 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) { |
|
221 | 221 | exit( '0' ); |
222 | 222 | } |
223 | 223 | |
224 | 224 | $form = ''; |
225 | 225 | |
226 | 226 | // Fetch the form for the current View |
227 | - if ( ! empty( $_POST['view_id'] ) ) { |
|
227 | + if ( ! empty( $_POST[ 'view_id' ] ) ) { |
|
228 | 228 | |
229 | - $form = gravityview_get_form_id( $_POST['view_id'] ); |
|
229 | + $form = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
230 | 230 | |
231 | - } elseif ( ! empty( $_POST['formid'] ) ) { |
|
231 | + } elseif ( ! empty( $_POST[ 'formid' ] ) ) { |
|
232 | 232 | |
233 | - $form = (int) $_POST['formid']; |
|
233 | + $form = (int)$_POST[ 'formid' ]; |
|
234 | 234 | |
235 | - } elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
235 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
236 | 236 | |
237 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
237 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
238 | 238 | |
239 | 239 | } |
240 | 240 | |
@@ -279,8 +279,8 @@ discard block |
||
279 | 279 | ) |
280 | 280 | ); |
281 | 281 | |
282 | - foreach( $custom_fields as $custom_field_key => $custom_field ) { |
|
283 | - $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'] ); |
|
282 | + foreach ( $custom_fields as $custom_field_key => $custom_field ) { |
|
283 | + $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' ] ); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | // Get fields with sub-inputs and no parent |
@@ -302,13 +302,13 @@ discard block |
||
302 | 302 | |
303 | 303 | foreach ( $fields as $id => $field ) { |
304 | 304 | |
305 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
305 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
306 | 306 | continue; |
307 | 307 | } |
308 | 308 | |
309 | - $types = self::get_search_input_types( $id, $field['type'] ); |
|
309 | + $types = self::get_search_input_types( $id, $field[ 'type' ] ); |
|
310 | 310 | |
311 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>'; |
|
311 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>'; |
|
312 | 312 | } |
313 | 313 | } |
314 | 314 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | public static function get_search_input_types( $id = '', $field_type = null ) { |
331 | 331 | |
332 | 332 | // @todo - This needs to be improved - many fields have . including products and addresses |
333 | - if ( false !== strpos( (string) $id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) { |
|
333 | + if ( false !== strpos( (string)$id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) { |
|
334 | 334 | $input_type = 'boolean'; // on/off checkbox |
335 | 335 | } elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) { |
336 | 336 | $input_type = 'multi'; //multiselect |
@@ -372,19 +372,19 @@ discard block |
||
372 | 372 | $post_id = 0; |
373 | 373 | |
374 | 374 | // We're in the WordPress Widget context, and an overriding post ID has been set. |
375 | - if ( ! empty( $widget_args['post_id'] ) ) { |
|
376 | - $post_id = absint( $widget_args['post_id'] ); |
|
375 | + if ( ! empty( $widget_args[ 'post_id' ] ) ) { |
|
376 | + $post_id = absint( $widget_args[ 'post_id' ] ); |
|
377 | 377 | } |
378 | 378 | // We're in the WordPress Widget context, and the base View ID should be used |
379 | - else if ( ! empty( $widget_args['view_id'] ) ) { |
|
380 | - $post_id = absint( $widget_args['view_id'] ); |
|
379 | + else if ( ! empty( $widget_args[ 'view_id' ] ) ) { |
|
380 | + $post_id = absint( $widget_args[ 'view_id' ] ); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | $args = gravityview_get_permalink_query_args( $post_id ); |
384 | 384 | |
385 | 385 | // Add hidden fields to the search form |
386 | 386 | foreach ( $args as $key => $value ) { |
387 | - $search_fields[] = array( |
|
387 | + $search_fields[ ] = array( |
|
388 | 388 | 'name' => $key, |
389 | 389 | 'input' => 'hidden', |
390 | 390 | 'value' => $value, |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | */ |
406 | 406 | public function filter_entries( $search_criteria ) { |
407 | 407 | |
408 | - if( 'post' === $this->search_method ) { |
|
408 | + if ( 'post' === $this->search_method ) { |
|
409 | 409 | $get = $_POST; |
410 | 410 | } else { |
411 | 411 | $get = $_GET; |
@@ -422,15 +422,15 @@ discard block |
||
422 | 422 | $get = gv_map_deep( $get, 'urldecode' ); |
423 | 423 | |
424 | 424 | // add free search |
425 | - if ( ! empty( $get['gv_search'] ) ) { |
|
425 | + if ( ! empty( $get[ 'gv_search' ] ) ) { |
|
426 | 426 | |
427 | 427 | // Search for a piece |
428 | - $words = explode( ' ', $get['gv_search'] ); |
|
428 | + $words = explode( ' ', $get[ 'gv_search' ] ); |
|
429 | 429 | |
430 | 430 | $words = array_filter( $words ); |
431 | 431 | |
432 | 432 | foreach ( $words as $word ) { |
433 | - $search_criteria['field_filters'][] = array( |
|
433 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
434 | 434 | 'key' => null, // The field ID to search |
435 | 435 | 'value' => $word, // The value to search |
436 | 436 | 'operator' => 'contains', // What to search in. Options: `is` or `contains` |
@@ -439,8 +439,8 @@ discard block |
||
439 | 439 | } |
440 | 440 | |
441 | 441 | //start date & end date |
442 | - $curr_start = !empty( $get['gv_start'] ) ? $get['gv_start'] : ''; |
|
443 | - $curr_end = !empty( $get['gv_start'] ) ? $get['gv_end'] : ''; |
|
442 | + $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : ''; |
|
443 | + $curr_end = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_end' ] : ''; |
|
444 | 444 | |
445 | 445 | /** |
446 | 446 | * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n |
@@ -455,16 +455,16 @@ discard block |
||
455 | 455 | /** |
456 | 456 | * Don't set $search_criteria['start_date'] if start_date is empty as it may lead to bad query results (GFAPI::get_entries) |
457 | 457 | */ |
458 | - if( !empty( $curr_start ) ) { |
|
459 | - $search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
458 | + if ( ! empty( $curr_start ) ) { |
|
459 | + $search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
460 | 460 | } |
461 | - if( !empty( $curr_end ) ) { |
|
462 | - $search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
461 | + if ( ! empty( $curr_end ) ) { |
|
462 | + $search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
463 | 463 | } |
464 | 464 | |
465 | 465 | // search for a specific entry ID |
466 | 466 | if ( ! empty( $get[ 'gv_id' ] ) ) { |
467 | - $search_criteria['field_filters'][] = array( |
|
467 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
468 | 468 | 'key' => 'id', |
469 | 469 | 'value' => absint( $get[ 'gv_id' ] ), |
470 | 470 | 'operator' => '=', |
@@ -473,36 +473,36 @@ discard block |
||
473 | 473 | |
474 | 474 | // search for a specific Created_by ID |
475 | 475 | if ( ! empty( $get[ 'gv_by' ] ) ) { |
476 | - $search_criteria['field_filters'][] = array( |
|
476 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
477 | 477 | 'key' => 'created_by', |
478 | - 'value' => absint( $get['gv_by'] ), |
|
478 | + 'value' => absint( $get[ 'gv_by' ] ), |
|
479 | 479 | 'operator' => '=', |
480 | 480 | ); |
481 | 481 | } |
482 | 482 | |
483 | 483 | |
484 | 484 | // Get search mode passed in URL |
485 | - $mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ? $get['mode'] : 'any'; |
|
485 | + $mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any'; |
|
486 | 486 | |
487 | 487 | // get the other search filters |
488 | 488 | foreach ( $get as $key => $value ) { |
489 | 489 | |
490 | - if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[0] ) ) ) { |
|
490 | + if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[ 0 ] ) ) ) { |
|
491 | 491 | continue; |
492 | 492 | } |
493 | 493 | |
494 | 494 | // could return simple filter or multiple filters |
495 | 495 | $filter = $this->prepare_field_filter( $key, $value ); |
496 | 496 | |
497 | - if ( isset( $filter[0]['value'] ) ) { |
|
498 | - $search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter ); |
|
497 | + if ( isset( $filter[ 0 ][ 'value' ] ) ) { |
|
498 | + $search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter ); |
|
499 | 499 | |
500 | 500 | // if date range type, set search mode to ALL |
501 | - if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) { |
|
501 | + if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) { |
|
502 | 502 | $mode = 'all'; |
503 | 503 | } |
504 | - } elseif( !empty( $filter ) ) { |
|
505 | - $search_criteria['field_filters'][] = $filter; |
|
504 | + } elseif ( ! empty( $filter ) ) { |
|
505 | + $search_criteria[ 'field_filters' ][ ] = $filter; |
|
506 | 506 | } |
507 | 507 | } |
508 | 508 | |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | * @since 1.5.1 |
512 | 512 | * @param[out,in] string $mode Search mode (`any` vs `all`) |
513 | 513 | */ |
514 | - $search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode ); |
|
514 | + $search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode ); |
|
515 | 515 | |
516 | 516 | do_action( 'gravityview_log_debug', sprintf( '%s[filter_entries] Returned Search Criteria: ', get_class( $this ) ), $search_criteria ); |
517 | 517 | |
@@ -549,11 +549,11 @@ discard block |
||
549 | 549 | 'value' => $value, |
550 | 550 | ); |
551 | 551 | |
552 | - switch ( $form_field['type'] ) { |
|
552 | + switch ( $form_field[ 'type' ] ) { |
|
553 | 553 | |
554 | 554 | case 'select': |
555 | 555 | case 'radio': |
556 | - $filter['operator'] = 'is'; |
|
556 | + $filter[ 'operator' ] = 'is'; |
|
557 | 557 | break; |
558 | 558 | |
559 | 559 | case 'post_category': |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | |
568 | 568 | foreach ( $value as $val ) { |
569 | 569 | $cat = get_term( $val, 'category' ); |
570 | - $filter[] = array( |
|
570 | + $filter[ ] = array( |
|
571 | 571 | 'key' => $field_id, |
572 | 572 | 'value' => esc_attr( $cat->name ) . ':' . $val, |
573 | 573 | 'operator' => 'is', |
@@ -586,18 +586,18 @@ discard block |
||
586 | 586 | $filter = array(); |
587 | 587 | |
588 | 588 | foreach ( $value as $val ) { |
589 | - $filter[] = array( 'key' => $field_id, 'value' => $val ); |
|
589 | + $filter[ ] = array( 'key' => $field_id, 'value' => $val ); |
|
590 | 590 | } |
591 | 591 | |
592 | 592 | break; |
593 | 593 | |
594 | 594 | case 'checkbox': |
595 | 595 | // convert checkbox on/off into the correct search filter |
596 | - if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field['inputs'] ) && ! empty( $form_field['choices'] ) ) { |
|
597 | - foreach ( $form_field['inputs'] as $k => $input ) { |
|
598 | - if ( $input['id'] == $field_id ) { |
|
599 | - $filter['value'] = $form_field['choices'][ $k ]['value']; |
|
600 | - $filter['operator'] = 'is'; |
|
596 | + if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field[ 'inputs' ] ) && ! empty( $form_field[ 'choices' ] ) ) { |
|
597 | + foreach ( $form_field[ 'inputs' ] as $k => $input ) { |
|
598 | + if ( $input[ 'id' ] == $field_id ) { |
|
599 | + $filter[ 'value' ] = $form_field[ 'choices' ][ $k ][ 'value' ]; |
|
600 | + $filter[ 'operator' ] = 'is'; |
|
601 | 601 | break; |
602 | 602 | } |
603 | 603 | } |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | $filter = array(); |
608 | 608 | |
609 | 609 | foreach ( $value as $val ) { |
610 | - $filter[] = array( |
|
610 | + $filter[ ] = array( |
|
611 | 611 | 'key' => $field_id, |
612 | 612 | 'value' => $val, |
613 | 613 | 'operator' => 'is', |
@@ -628,9 +628,9 @@ discard block |
||
628 | 628 | foreach ( $words as $word ) { |
629 | 629 | if ( ! empty( $word ) && strlen( $word ) > 1 ) { |
630 | 630 | // Keep the same key for each filter |
631 | - $filter['value'] = $word; |
|
631 | + $filter[ 'value' ] = $word; |
|
632 | 632 | // Add a search for the value |
633 | - $filters[] = $filter; |
|
633 | + $filters[ ] = $filter; |
|
634 | 634 | } |
635 | 635 | } |
636 | 636 | |
@@ -657,19 +657,19 @@ discard block |
||
657 | 657 | * @since 1.16.3 |
658 | 658 | * Safeguard until GF implements '<=' operator |
659 | 659 | */ |
660 | - if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
660 | + if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
661 | 661 | $operator = '<'; |
662 | 662 | $date = date( 'Y-m-d', strtotime( $date . ' +1 day' ) ); |
663 | 663 | } |
664 | 664 | |
665 | - $filter[] = array( |
|
665 | + $filter[ ] = array( |
|
666 | 666 | 'key' => $field_id, |
667 | 667 | 'value' => self::get_formatted_date( $date, 'Y-m-d' ), |
668 | 668 | 'operator' => $operator, |
669 | 669 | ); |
670 | 670 | } |
671 | 671 | } else { |
672 | - $filter['value'] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
672 | + $filter[ 'value' ] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
673 | 673 | } |
674 | 674 | |
675 | 675 | break; |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | 'ymd_dot' => 'Y.m.d', |
701 | 701 | ); |
702 | 702 | |
703 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
703 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
704 | 704 | $format = $datepicker[ $field->dateFormat ]; |
705 | 705 | } |
706 | 706 | |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | public function add_template_path( $file_paths ) { |
732 | 732 | |
733 | 733 | // Index 100 is the default GravityView template path. |
734 | - $file_paths[102] = self::$file . 'templates/'; |
|
734 | + $file_paths[ 102 ] = self::$file . 'templates/'; |
|
735 | 735 | |
736 | 736 | return $file_paths; |
737 | 737 | } |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | } |
755 | 755 | |
756 | 756 | // get configured search fields |
757 | - $search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : ''; |
|
757 | + $search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : ''; |
|
758 | 758 | |
759 | 759 | if ( empty( $search_fields ) || ! is_array( $search_fields ) ) { |
760 | 760 | do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend] No search fields configured for widget:', get_class( $this ) ), $widget_args ); |
@@ -768,24 +768,24 @@ discard block |
||
768 | 768 | |
769 | 769 | $updated_field = $field; |
770 | 770 | |
771 | - if ( in_array( $field['input'], array( 'date', 'date_range' ) ) ) { |
|
771 | + if ( in_array( $field[ 'input' ], array( 'date', 'date_range' ) ) ) { |
|
772 | 772 | $has_date = true; |
773 | 773 | } |
774 | 774 | |
775 | 775 | $updated_field = $this->get_search_filter_details( $updated_field ); |
776 | 776 | |
777 | - switch ( $field['field'] ) { |
|
777 | + switch ( $field[ 'field' ] ) { |
|
778 | 778 | |
779 | 779 | case 'search_all': |
780 | - $updated_field['key'] = 'search_all'; |
|
781 | - $updated_field['input'] = 'search_all'; |
|
782 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' ); |
|
780 | + $updated_field[ 'key' ] = 'search_all'; |
|
781 | + $updated_field[ 'input' ] = 'search_all'; |
|
782 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' ); |
|
783 | 783 | break; |
784 | 784 | |
785 | 785 | case 'entry_date': |
786 | - $updated_field['key'] = 'entry_date'; |
|
787 | - $updated_field['input'] = 'entry_date'; |
|
788 | - $updated_field['value'] = array( |
|
786 | + $updated_field[ 'key' ] = 'entry_date'; |
|
787 | + $updated_field[ 'input' ] = 'entry_date'; |
|
788 | + $updated_field[ 'value' ] = array( |
|
789 | 789 | 'start' => $this->rgget_or_rgpost( 'gv_start' ), |
790 | 790 | 'end' => $this->rgget_or_rgpost( 'gv_end' ), |
791 | 791 | ); |
@@ -793,16 +793,16 @@ discard block |
||
793 | 793 | break; |
794 | 794 | |
795 | 795 | case 'entry_id': |
796 | - $updated_field['key'] = 'entry_id'; |
|
797 | - $updated_field['input'] = 'entry_id'; |
|
798 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' ); |
|
796 | + $updated_field[ 'key' ] = 'entry_id'; |
|
797 | + $updated_field[ 'input' ] = 'entry_id'; |
|
798 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' ); |
|
799 | 799 | break; |
800 | 800 | |
801 | 801 | case 'created_by': |
802 | - $updated_field['key'] = 'created_by'; |
|
803 | - $updated_field['name'] = 'gv_by'; |
|
804 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' ); |
|
805 | - $updated_field['choices'] = self::get_created_by_choices(); |
|
802 | + $updated_field[ 'key' ] = 'created_by'; |
|
803 | + $updated_field[ 'name' ] = 'gv_by'; |
|
804 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' ); |
|
805 | + $updated_field[ 'choices' ] = self::get_created_by_choices(); |
|
806 | 806 | break; |
807 | 807 | } |
808 | 808 | |
@@ -820,16 +820,16 @@ discard block |
||
820 | 820 | */ |
821 | 821 | $gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args ); |
822 | 822 | |
823 | - $gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal'; |
|
823 | + $gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal'; |
|
824 | 824 | |
825 | 825 | /** @since 1.14 */ |
826 | - $gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any'; |
|
826 | + $gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any'; |
|
827 | 827 | |
828 | - $custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
828 | + $custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
829 | 829 | |
830 | 830 | $gravityview_view->search_class = self::get_search_class( $custom_class ); |
831 | 831 | |
832 | - $gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false; |
|
832 | + $gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false; |
|
833 | 833 | |
834 | 834 | if ( $has_date ) { |
835 | 835 | // enqueue datepicker stuff only if needed! |
@@ -851,10 +851,10 @@ discard block |
||
851 | 851 | public static function get_search_class( $custom_class = '' ) { |
852 | 852 | $gravityview_view = GravityView_View::getInstance(); |
853 | 853 | |
854 | - $search_class = 'gv-search-'.$gravityview_view->search_layout; |
|
854 | + $search_class = 'gv-search-' . $gravityview_view->search_layout; |
|
855 | 855 | |
856 | - if ( ! empty( $custom_class ) ) { |
|
857 | - $search_class .= ' '.$custom_class; |
|
856 | + if ( ! empty( $custom_class ) ) { |
|
857 | + $search_class .= ' ' . $custom_class; |
|
858 | 858 | } |
859 | 859 | |
860 | 860 | /** |
@@ -896,11 +896,11 @@ discard block |
||
896 | 896 | |
897 | 897 | $label = rgget( 'label', $field ); |
898 | 898 | |
899 | - if( '' === $label ) { |
|
899 | + if ( '' === $label ) { |
|
900 | 900 | |
901 | - $label = isset( $form_field['label'] ) ? $form_field['label'] : ''; |
|
901 | + $label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : ''; |
|
902 | 902 | |
903 | - switch( $field['field'] ) { |
|
903 | + switch ( $field[ 'field' ] ) { |
|
904 | 904 | case 'search_all': |
905 | 905 | $label = __( 'Search Entries:', 'gravityview' ); |
906 | 906 | break; |
@@ -918,10 +918,10 @@ discard block |
||
918 | 918 | break; |
919 | 919 | default: |
920 | 920 | // If this is a field input, not a field |
921 | - if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) { |
|
921 | + if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) { |
|
922 | 922 | |
923 | 923 | // Get the label for the field in question, which returns an array |
924 | - $items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) ); |
|
924 | + $items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) ); |
|
925 | 925 | |
926 | 926 | // Get the item with the `label` key |
927 | 927 | $values = wp_list_pluck( $items, 'label' ); |
@@ -958,32 +958,32 @@ discard block |
||
958 | 958 | $form = $gravityview_view->getForm(); |
959 | 959 | |
960 | 960 | // for advanced field ids (eg, first name / last name ) |
961 | - $name = 'filter_' . str_replace( '.', '_', $field['field'] ); |
|
961 | + $name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] ); |
|
962 | 962 | |
963 | 963 | // get searched value from $_GET/$_POST (string or array) |
964 | 964 | $value = $this->rgget_or_rgpost( $name ); |
965 | 965 | |
966 | 966 | // get form field details |
967 | - $form_field = gravityview_get_field( $form, $field['field'] ); |
|
967 | + $form_field = gravityview_get_field( $form, $field[ 'field' ] ); |
|
968 | 968 | |
969 | 969 | $filter = array( |
970 | - 'key' => $field['field'], |
|
970 | + 'key' => $field[ 'field' ], |
|
971 | 971 | 'name' => $name, |
972 | 972 | 'label' => self::get_field_label( $field, $form_field ), |
973 | - 'input' => $field['input'], |
|
973 | + 'input' => $field[ 'input' ], |
|
974 | 974 | 'value' => $value, |
975 | - 'type' => $form_field['type'], |
|
975 | + 'type' => $form_field[ 'type' ], |
|
976 | 976 | ); |
977 | 977 | |
978 | 978 | // collect choices |
979 | - if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) { |
|
980 | - $filter['choices'] = gravityview_get_terms_choices(); |
|
981 | - } elseif ( ! empty( $form_field['choices'] ) ) { |
|
982 | - $filter['choices'] = $form_field['choices']; |
|
979 | + if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) { |
|
980 | + $filter[ 'choices' ] = gravityview_get_terms_choices(); |
|
981 | + } elseif ( ! empty( $form_field[ 'choices' ] ) ) { |
|
982 | + $filter[ 'choices' ] = $form_field[ 'choices' ]; |
|
983 | 983 | } |
984 | 984 | |
985 | - if ( 'date_range' === $field['input'] && empty( $value ) ) { |
|
986 | - $filter['value'] = array( 'start' => '', 'end' => '' ); |
|
985 | + if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) { |
|
986 | + $filter[ 'value' ] = array( 'start' => '', 'end' => '' ); |
|
987 | 987 | } |
988 | 988 | |
989 | 989 | return $filter; |
@@ -1007,7 +1007,7 @@ discard block |
||
1007 | 1007 | |
1008 | 1008 | $choices = array(); |
1009 | 1009 | foreach ( $users as $user ) { |
1010 | - $choices[] = array( |
|
1010 | + $choices[ ] = array( |
|
1011 | 1011 | 'value' => $user->ID, |
1012 | 1012 | 'text' => $user->display_name, |
1013 | 1013 | ); |
@@ -1062,7 +1062,7 @@ discard block |
||
1062 | 1062 | */ |
1063 | 1063 | public function add_datepicker_js_dependency( $js_dependencies ) { |
1064 | 1064 | |
1065 | - $js_dependencies[] = 'jquery-ui-datepicker'; |
|
1065 | + $js_dependencies[ ] = 'jquery-ui-datepicker'; |
|
1066 | 1066 | |
1067 | 1067 | return $js_dependencies; |
1068 | 1068 | } |
@@ -1106,7 +1106,7 @@ discard block |
||
1106 | 1106 | 'isRTL' => is_rtl(), |
1107 | 1107 | ), $view_data ); |
1108 | 1108 | |
1109 | - $localizations['datepicker'] = $datepicker_settings; |
|
1109 | + $localizations[ 'datepicker' ] = $datepicker_settings; |
|
1110 | 1110 | |
1111 | 1111 | return $localizations; |
1112 | 1112 | |
@@ -1135,7 +1135,7 @@ discard block |
||
1135 | 1135 | * @return void |
1136 | 1136 | */ |
1137 | 1137 | private function maybe_enqueue_flexibility() { |
1138 | - if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
1138 | + if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) { |
|
1139 | 1139 | wp_enqueue_script( 'gv-flexibility' ); |
1140 | 1140 | } |
1141 | 1141 | } |
@@ -1157,7 +1157,7 @@ discard block |
||
1157 | 1157 | add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 ); |
1158 | 1158 | |
1159 | 1159 | $scheme = is_ssl() ? 'https://' : 'http://'; |
1160 | - wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
1160 | + wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
1161 | 1161 | |
1162 | 1162 | /** |
1163 | 1163 | * @filter `gravityview_search_datepicker_class` |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | 'slug' => 'edit', |
25 | 25 | 'type' => 'internal', |
26 | 26 | 'label' => __( 'Edit Table', 'gravityview' ), |
27 | - 'description' => __('Display items in a table view.', 'gravityview'), |
|
28 | - 'logo' => plugins_url('includes/presets/default-table/logo-default-table.png', GRAVITYVIEW_FILE), |
|
27 | + 'description' => __( 'Display items in a table view.', 'gravityview' ), |
|
28 | + 'logo' => plugins_url( 'includes/presets/default-table/logo-default-table.png', GRAVITYVIEW_FILE ), |
|
29 | 29 | 'css_source' => gravityview_css_url( 'table-view.css', GRAVITYVIEW_DIR . 'templates/css/' ), |
30 | 30 | ); |
31 | 31 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | '1-1' => array( |
43 | 43 | array( |
44 | 44 | 'areaid' => 'edit-fields', |
45 | - 'title' => __('Visible Edit Fields', 'gravityview' ) |
|
45 | + 'title' => __( 'Visible Edit Fields', 'gravityview' ) |
|
46 | 46 | ) |
47 | 47 | ) |
48 | 48 | ) |