@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | */ |
24 | 24 | do_action( 'gravityview_search_widget_fields_before', $this ); |
25 | 25 | |
26 | - foreach( $this->search_fields as $search_field ) { |
|
26 | + foreach ( $this->search_fields as $search_field ) { |
|
27 | 27 | $gravityview_view->search_field = $search_field; |
28 | - $this->render( 'search-field', $search_field['input'], false ); |
|
28 | + $this->render( 'search-field', $search_field[ 'input' ], false ); |
|
29 | 29 | |
30 | 30 | // show/hide the search button if there are input type fields |
31 | - if( !$has_inputs && $search_field['input'] != 'link' ) { |
|
31 | + if ( ! $has_inputs && $search_field[ 'input' ] != 'link' ) { |
|
32 | 32 | $has_inputs = true; |
33 | 33 | } |
34 | 34 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | do_action( 'gravityview_search_widget_fields_after', $this ); |
41 | 41 | |
42 | - if( $has_inputs ) { ?> |
|
42 | + if ( $has_inputs ) { ?> |
|
43 | 43 | <div class="gv-search-box gv-search-box-submit"> |
44 | 44 | <?php |
45 | 45 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | 'type' => 'radio', |
57 | 57 | 'full_width' => true, |
58 | 58 | 'label' => esc_html__( 'Search Mode', 'gravityview' ), |
59 | - 'desc' => __('Should search results match all search fields, or any?', 'gravityview'), |
|
59 | + 'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ), |
|
60 | 60 | 'value' => 'any', |
61 | 61 | 'class' => 'hide-if-js', |
62 | 62 | 'options' => array( |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
112 | 112 | $script_source = empty( $script_min ) ? '/source' : ''; |
113 | 113 | |
114 | - 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 ); |
|
114 | + 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 ); |
|
115 | 115 | |
116 | 116 | |
117 | 117 | /** |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * Add admin script to the whitelist |
164 | 164 | */ |
165 | 165 | public function register_no_conflict( $required ) { |
166 | - $required[] = 'gravityview_searchwidget_admin'; |
|
166 | + $required[ ] = 'gravityview_searchwidget_admin'; |
|
167 | 167 | return $required; |
168 | 168 | } |
169 | 169 | |
@@ -176,24 +176,24 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public static function get_searchable_fields() { |
178 | 178 | |
179 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) { |
|
179 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) { |
|
180 | 180 | exit( '0' ); |
181 | 181 | } |
182 | 182 | |
183 | 183 | $form = ''; |
184 | 184 | |
185 | 185 | // Fetch the form for the current View |
186 | - if ( ! empty( $_POST['view_id'] ) ) { |
|
186 | + if ( ! empty( $_POST[ 'view_id' ] ) ) { |
|
187 | 187 | |
188 | - $form = gravityview_get_form_id( $_POST['view_id'] ); |
|
188 | + $form = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
189 | 189 | |
190 | - } elseif ( ! empty( $_POST['formid'] ) ) { |
|
190 | + } elseif ( ! empty( $_POST[ 'formid' ] ) ) { |
|
191 | 191 | |
192 | - $form = (int) $_POST['formid']; |
|
192 | + $form = (int)$_POST[ 'formid' ]; |
|
193 | 193 | |
194 | - } elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
194 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
195 | 195 | |
196 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
196 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
197 | 197 | |
198 | 198 | } |
199 | 199 | |
@@ -241,8 +241,8 @@ discard block |
||
241 | 241 | ) |
242 | 242 | ); |
243 | 243 | |
244 | - foreach( $custom_fields as $custom_field_key => $custom_field ) { |
|
245 | - $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'] ); |
|
244 | + foreach ( $custom_fields as $custom_field_key => $custom_field ) { |
|
245 | + $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' ] ); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | if ( ! empty( $fields ) ) { |
@@ -251,13 +251,13 @@ discard block |
||
251 | 251 | |
252 | 252 | foreach ( $fields as $id => $field ) { |
253 | 253 | |
254 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
254 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
255 | 255 | continue; |
256 | 256 | } |
257 | 257 | |
258 | - $types = self::get_search_input_types( $id, $field['type'] ); |
|
258 | + $types = self::get_search_input_types( $id, $field[ 'type' ] ); |
|
259 | 259 | |
260 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>'; |
|
260 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>'; |
|
261 | 261 | } |
262 | 262 | } |
263 | 263 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | public static function get_search_input_types( $id = '', $field_type = null ) { |
280 | 280 | |
281 | 281 | // @todo - This needs to be improved - many fields have . including products and addresses |
282 | - if ( false !== strpos( (string) $id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) { |
|
282 | + if ( false !== strpos( (string)$id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) { |
|
283 | 283 | // on/off checkbox |
284 | 284 | $input_type = 'boolean'; |
285 | 285 | } elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) { |
@@ -326,19 +326,19 @@ discard block |
||
326 | 326 | $post_id = 0; |
327 | 327 | |
328 | 328 | // We're in the WordPress Widget context, and an overriding post ID has been set. |
329 | - if ( ! empty( $widget_args['post_id'] ) ) { |
|
330 | - $post_id = absint( $widget_args['post_id'] ); |
|
329 | + if ( ! empty( $widget_args[ 'post_id' ] ) ) { |
|
330 | + $post_id = absint( $widget_args[ 'post_id' ] ); |
|
331 | 331 | } |
332 | 332 | // We're in the WordPress Widget context, and the base View ID should be used |
333 | - else if ( ! empty( $widget_args['view_id'] ) ) { |
|
334 | - $post_id = absint( $widget_args['view_id'] ); |
|
333 | + else if ( ! empty( $widget_args[ 'view_id' ] ) ) { |
|
334 | + $post_id = absint( $widget_args[ 'view_id' ] ); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | $args = gravityview_get_permalink_query_args( $post_id ); |
338 | 338 | |
339 | 339 | // Add hidden fields to the search form |
340 | 340 | foreach ( $args as $key => $value ) { |
341 | - $search_fields[] = array( |
|
341 | + $search_fields[ ] = array( |
|
342 | 342 | 'name' => $key, |
343 | 343 | 'input' => 'hidden', |
344 | 344 | 'value' => $value, |
@@ -366,15 +366,15 @@ discard block |
||
366 | 366 | } |
367 | 367 | |
368 | 368 | // add free search |
369 | - if ( ! empty( $_GET['gv_search'] ) ) { |
|
369 | + if ( ! empty( $_GET[ 'gv_search' ] ) ) { |
|
370 | 370 | |
371 | 371 | // Search for a piece |
372 | - $words = explode( ' ', stripslashes_deep( urldecode( $_GET['gv_search'] ) ) ); |
|
372 | + $words = explode( ' ', stripslashes_deep( urldecode( $_GET[ 'gv_search' ] ) ) ); |
|
373 | 373 | |
374 | 374 | $words = array_filter( $words ); |
375 | 375 | |
376 | 376 | foreach ( $words as $word ) { |
377 | - $search_criteria['field_filters'][] = array( |
|
377 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
378 | 378 | 'key' => null, // The field ID to search |
379 | 379 | 'value' => $word, // The value to search |
380 | 380 | 'operator' => 'contains', // What to search in. Options: `is` or `contains` |
@@ -394,13 +394,13 @@ discard block |
||
394 | 394 | * @param[in] string $context Where the filter is being called from. `search` in this case. |
395 | 395 | */ |
396 | 396 | $adjust_tz = apply_filters( 'gravityview_date_created_adjust_timezone', true, 'search' ); |
397 | - $search_criteria['start_date'] = ( $adjust_tz && !empty( $curr_start ) ) ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
398 | - $search_criteria['end_date'] = ( $adjust_tz && !empty( $curr_end ) ) ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
397 | + $search_criteria[ 'start_date' ] = ( $adjust_tz && ! empty( $curr_start ) ) ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
398 | + $search_criteria[ 'end_date' ] = ( $adjust_tz && ! empty( $curr_end ) ) ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
399 | 399 | |
400 | 400 | |
401 | 401 | // search for a specific entry ID |
402 | 402 | if ( ! empty( $_GET[ 'gv_id' ] ) ) { |
403 | - $search_criteria['field_filters'][] = array( |
|
403 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
404 | 404 | 'key' => 'id', |
405 | 405 | 'value' => absint( $_GET[ 'gv_id' ] ), |
406 | 406 | 'operator' => '=', |
@@ -409,9 +409,9 @@ discard block |
||
409 | 409 | |
410 | 410 | // search for a specific Created_by ID |
411 | 411 | if ( ! empty( $_GET[ 'gv_by' ] ) ) { |
412 | - $search_criteria['field_filters'][] = array( |
|
412 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
413 | 413 | 'key' => 'created_by', |
414 | - 'value' => absint( $_GET['gv_by'] ), |
|
414 | + 'value' => absint( $_GET[ 'gv_by' ] ), |
|
415 | 415 | 'operator' => '=', |
416 | 416 | ); |
417 | 417 | } |
@@ -423,22 +423,22 @@ discard block |
||
423 | 423 | // get the other search filters |
424 | 424 | foreach ( $_GET as $key => $value ) { |
425 | 425 | |
426 | - if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[0] ) ) ) { |
|
426 | + if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[ 0 ] ) ) ) { |
|
427 | 427 | continue; |
428 | 428 | } |
429 | 429 | |
430 | 430 | // could return simple filter or multiple filters |
431 | 431 | $filter = $this->prepare_field_filter( $key, $value ); |
432 | 432 | |
433 | - if ( isset( $filter[0]['value'] ) ) { |
|
434 | - $search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter ); |
|
433 | + if ( isset( $filter[ 0 ][ 'value' ] ) ) { |
|
434 | + $search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter ); |
|
435 | 435 | |
436 | 436 | // if date range type, set search mode to ALL |
437 | - if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>', '<' ) ) ) { |
|
437 | + if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>', '<' ) ) ) { |
|
438 | 438 | $mode = 'all'; |
439 | 439 | } |
440 | - } elseif( !empty( $filter ) ) { |
|
441 | - $search_criteria['field_filters'][] = $filter; |
|
440 | + } elseif ( ! empty( $filter ) ) { |
|
441 | + $search_criteria[ 'field_filters' ][ ] = $filter; |
|
442 | 442 | } |
443 | 443 | } |
444 | 444 | |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | * @since 1.5.1 |
448 | 448 | * @param[out,in] string $mode Search mode (`any` vs `all`) |
449 | 449 | */ |
450 | - $search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode ); |
|
450 | + $search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode ); |
|
451 | 451 | |
452 | 452 | do_action( 'gravityview_log_debug', sprintf( '%s[filter_entries] Returned Search Criteria: ', get_class( $this ) ), $search_criteria ); |
453 | 453 | |
@@ -481,11 +481,11 @@ discard block |
||
481 | 481 | 'value' => $value, |
482 | 482 | ); |
483 | 483 | |
484 | - switch ( $form_field['type'] ) { |
|
484 | + switch ( $form_field[ 'type' ] ) { |
|
485 | 485 | |
486 | 486 | case 'select': |
487 | 487 | case 'radio': |
488 | - $filter['operator'] = 'is'; |
|
488 | + $filter[ 'operator' ] = 'is'; |
|
489 | 489 | break; |
490 | 490 | |
491 | 491 | case 'post_category': |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | |
500 | 500 | foreach ( $value as $val ) { |
501 | 501 | $cat = get_term( $val, 'category' ); |
502 | - $filter[] = array( |
|
502 | + $filter[ ] = array( |
|
503 | 503 | 'key' => $field_id, |
504 | 504 | 'value' => esc_attr( $cat->name ) . ':' . $val, |
505 | 505 | 'operator' => 'is', |
@@ -518,18 +518,18 @@ discard block |
||
518 | 518 | $filter = array(); |
519 | 519 | |
520 | 520 | foreach ( $value as $val ) { |
521 | - $filter[] = array( 'key' => $field_id, 'value' => $val ); |
|
521 | + $filter[ ] = array( 'key' => $field_id, 'value' => $val ); |
|
522 | 522 | } |
523 | 523 | |
524 | 524 | break; |
525 | 525 | |
526 | 526 | case 'checkbox': |
527 | 527 | // convert checkbox on/off into the correct search filter |
528 | - if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field['inputs'] ) && ! empty( $form_field['choices'] ) ) { |
|
529 | - foreach ( $form_field['inputs'] as $k => $input ) { |
|
530 | - if ( $input['id'] == $field_id ) { |
|
531 | - $filter['value'] = $form_field['choices'][ $k ]['value']; |
|
532 | - $filter['operator'] = 'is'; |
|
528 | + if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field[ 'inputs' ] ) && ! empty( $form_field[ 'choices' ] ) ) { |
|
529 | + foreach ( $form_field[ 'inputs' ] as $k => $input ) { |
|
530 | + if ( $input[ 'id' ] == $field_id ) { |
|
531 | + $filter[ 'value' ] = $form_field[ 'choices' ][ $k ][ 'value' ]; |
|
532 | + $filter[ 'operator' ] = 'is'; |
|
533 | 533 | break; |
534 | 534 | } |
535 | 535 | } |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | $filter = array(); |
540 | 540 | |
541 | 541 | foreach ( $value as $val ) { |
542 | - $filter[] = array( |
|
542 | + $filter[ ] = array( |
|
543 | 543 | 'key' => $field_id, |
544 | 544 | 'value' => $val, |
545 | 545 | 'operator' => 'is', |
@@ -560,9 +560,9 @@ discard block |
||
560 | 560 | foreach ( $words as $word ) { |
561 | 561 | if ( ! empty( $word ) && strlen( $word ) > 1 ) { |
562 | 562 | // Keep the same key for each filter |
563 | - $filter['value'] = $word; |
|
563 | + $filter[ 'value' ] = $word; |
|
564 | 564 | // Add a search for the value |
565 | - $filters[] = $filter; |
|
565 | + $filters[ ] = $filter; |
|
566 | 566 | } |
567 | 567 | } |
568 | 568 | |
@@ -584,14 +584,14 @@ discard block |
||
584 | 584 | } |
585 | 585 | $operator = 'start' === $k ? '>' : '<'; |
586 | 586 | |
587 | - $filter[] = array( |
|
587 | + $filter[ ] = array( |
|
588 | 588 | 'key' => $field_id, |
589 | 589 | 'value' => self::get_formatted_date( $date, 'Y-m-d' ), |
590 | 590 | 'operator' => $operator, |
591 | 591 | ); |
592 | 592 | } |
593 | 593 | } else { |
594 | - $filter['value'] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
594 | + $filter[ 'value' ] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
595 | 595 | } |
596 | 596 | |
597 | 597 | break; |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | 'ymd_dot' => 'Y.m.d', |
623 | 623 | ); |
624 | 624 | |
625 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
625 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
626 | 626 | $format = $datepicker[ $field->dateFormat ]; |
627 | 627 | } |
628 | 628 | |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | public function add_template_path( $file_paths ) { |
654 | 654 | |
655 | 655 | // Index 100 is the default GravityView template path. |
656 | - $file_paths[102] = self::$file . 'templates/'; |
|
656 | + $file_paths[ 102 ] = self::$file . 'templates/'; |
|
657 | 657 | |
658 | 658 | return $file_paths; |
659 | 659 | } |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | } |
676 | 676 | |
677 | 677 | // get configured search fields |
678 | - $search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : ''; |
|
678 | + $search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : ''; |
|
679 | 679 | |
680 | 680 | if ( empty( $search_fields ) || ! is_array( $search_fields ) ) { |
681 | 681 | do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend] No search fields configured for widget:', get_class( $this ) ), $widget_args ); |
@@ -689,24 +689,24 @@ discard block |
||
689 | 689 | |
690 | 690 | $updated_field = $field; |
691 | 691 | |
692 | - if ( in_array( $field['input'], array( 'date', 'date_range' ) ) ) { |
|
692 | + if ( in_array( $field[ 'input' ], array( 'date', 'date_range' ) ) ) { |
|
693 | 693 | $has_date = true; |
694 | 694 | } |
695 | 695 | |
696 | 696 | $updated_field = $this->get_search_filter_details( $updated_field ); |
697 | 697 | |
698 | - switch ( $field['field'] ) { |
|
698 | + switch ( $field[ 'field' ] ) { |
|
699 | 699 | |
700 | 700 | case 'search_all': |
701 | - $updated_field['key'] = 'search_all'; |
|
702 | - $updated_field['input'] = 'search_all'; |
|
703 | - $updated_field['value'] = esc_attr( stripslashes_deep( rgget( 'gv_search' ) ) ); |
|
701 | + $updated_field[ 'key' ] = 'search_all'; |
|
702 | + $updated_field[ 'input' ] = 'search_all'; |
|
703 | + $updated_field[ 'value' ] = esc_attr( stripslashes_deep( rgget( 'gv_search' ) ) ); |
|
704 | 704 | break; |
705 | 705 | |
706 | 706 | case 'entry_date': |
707 | - $updated_field['key'] = 'entry_date'; |
|
708 | - $updated_field['input'] = 'entry_date'; |
|
709 | - $updated_field['value'] = array( |
|
707 | + $updated_field[ 'key' ] = 'entry_date'; |
|
708 | + $updated_field[ 'input' ] = 'entry_date'; |
|
709 | + $updated_field[ 'value' ] = array( |
|
710 | 710 | 'start' => esc_attr( stripslashes_deep( rgget( 'gv_start' ) ) ), |
711 | 711 | 'end' => esc_attr( stripslashes_deep( rgget( 'gv_end' ) ) ), |
712 | 712 | ); |
@@ -714,16 +714,16 @@ discard block |
||
714 | 714 | break; |
715 | 715 | |
716 | 716 | case 'entry_id': |
717 | - $updated_field['key'] = 'entry_id'; |
|
718 | - $updated_field['input'] = 'entry_id'; |
|
719 | - $updated_field['value'] = esc_attr( stripslashes_deep( rgget( 'gv_id' ) ) ); |
|
717 | + $updated_field[ 'key' ] = 'entry_id'; |
|
718 | + $updated_field[ 'input' ] = 'entry_id'; |
|
719 | + $updated_field[ 'value' ] = esc_attr( stripslashes_deep( rgget( 'gv_id' ) ) ); |
|
720 | 720 | break; |
721 | 721 | |
722 | 722 | case 'created_by': |
723 | - $updated_field['key'] = 'created_by'; |
|
724 | - $updated_field['name'] = 'gv_by'; |
|
725 | - $updated_field['value'] = esc_attr( stripslashes_deep( rgget( 'gv_by' ) ) ); |
|
726 | - $updated_field['choices'] = self::get_created_by_choices(); |
|
723 | + $updated_field[ 'key' ] = 'created_by'; |
|
724 | + $updated_field[ 'name' ] = 'gv_by'; |
|
725 | + $updated_field[ 'value' ] = esc_attr( stripslashes_deep( rgget( 'gv_by' ) ) ); |
|
726 | + $updated_field[ 'choices' ] = self::get_created_by_choices(); |
|
727 | 727 | break; |
728 | 728 | } |
729 | 729 | |
@@ -741,16 +741,16 @@ discard block |
||
741 | 741 | */ |
742 | 742 | $gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args ); |
743 | 743 | |
744 | - $gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal'; |
|
744 | + $gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal'; |
|
745 | 745 | |
746 | 746 | /** @since 1.14 */ |
747 | - $gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any'; |
|
747 | + $gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any'; |
|
748 | 748 | |
749 | - $custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
749 | + $custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
750 | 750 | |
751 | 751 | $gravityview_view->search_class = self::get_search_class( $custom_class ); |
752 | 752 | |
753 | - $gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false; |
|
753 | + $gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false; |
|
754 | 754 | |
755 | 755 | if ( $has_date ) { |
756 | 756 | // enqueue datepicker stuff only if needed! |
@@ -770,10 +770,10 @@ discard block |
||
770 | 770 | public static function get_search_class( $custom_class = '' ) { |
771 | 771 | $gravityview_view = GravityView_View::getInstance(); |
772 | 772 | |
773 | - $search_class = 'gv-search-'.$gravityview_view->search_layout; |
|
773 | + $search_class = 'gv-search-' . $gravityview_view->search_layout; |
|
774 | 774 | |
775 | - if ( ! empty( $custom_class ) ) { |
|
776 | - $search_class .= ' '.$custom_class; |
|
775 | + if ( ! empty( $custom_class ) ) { |
|
776 | + $search_class .= ' ' . $custom_class; |
|
777 | 777 | } |
778 | 778 | |
779 | 779 | /** |
@@ -816,11 +816,11 @@ discard block |
||
816 | 816 | |
817 | 817 | $label = rgget( 'label', $field ); |
818 | 818 | |
819 | - if( '' === $label ) { |
|
819 | + if ( '' === $label ) { |
|
820 | 820 | |
821 | - $label = isset( $form_field['label'] ) ? $form_field['label'] : ''; |
|
821 | + $label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : ''; |
|
822 | 822 | |
823 | - switch( $field['field'] ) { |
|
823 | + switch ( $field[ 'field' ] ) { |
|
824 | 824 | case 'search_all': |
825 | 825 | $label = __( 'Search Entries:', 'gravityview' ); |
826 | 826 | break; |
@@ -838,10 +838,10 @@ discard block |
||
838 | 838 | break; |
839 | 839 | default: |
840 | 840 | // If this is a field input, not a field |
841 | - if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) { |
|
841 | + if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) { |
|
842 | 842 | |
843 | 843 | // Get the label for the field in question, which returns an array |
844 | - $items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) ); |
|
844 | + $items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) ); |
|
845 | 845 | |
846 | 846 | // Get the item with the `label` key |
847 | 847 | $values = wp_list_pluck( $items, 'label' ); |
@@ -878,32 +878,32 @@ discard block |
||
878 | 878 | $form = $gravityview_view->getForm(); |
879 | 879 | |
880 | 880 | // for advanced field ids (eg, first name / last name ) |
881 | - $name = 'filter_' . str_replace( '.', '_', $field['field'] ); |
|
881 | + $name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] ); |
|
882 | 882 | |
883 | 883 | // get searched value from $_GET (string or array) |
884 | 884 | $value = rgget( $name ); |
885 | 885 | |
886 | 886 | // get form field details |
887 | - $form_field = gravityview_get_field( $form, $field['field'] ); |
|
887 | + $form_field = gravityview_get_field( $form, $field[ 'field' ] ); |
|
888 | 888 | |
889 | 889 | $filter = array( |
890 | - 'key' => $field['field'], |
|
890 | + 'key' => $field[ 'field' ], |
|
891 | 891 | 'name' => $name, |
892 | 892 | 'label' => self::get_field_label( $field, $form_field ), |
893 | - 'input' => $field['input'], |
|
893 | + 'input' => $field[ 'input' ], |
|
894 | 894 | 'value' => $value, |
895 | - 'type' => $form_field['type'], |
|
895 | + 'type' => $form_field[ 'type' ], |
|
896 | 896 | ); |
897 | 897 | |
898 | 898 | // collect choices |
899 | - if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) { |
|
900 | - $filter['choices'] = gravityview_get_terms_choices(); |
|
901 | - } elseif ( ! empty( $form_field['choices'] ) ) { |
|
902 | - $filter['choices'] = $form_field['choices']; |
|
899 | + if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) { |
|
900 | + $filter[ 'choices' ] = gravityview_get_terms_choices(); |
|
901 | + } elseif ( ! empty( $form_field[ 'choices' ] ) ) { |
|
902 | + $filter[ 'choices' ] = $form_field[ 'choices' ]; |
|
903 | 903 | } |
904 | 904 | |
905 | - if ( 'date_range' === $field['input'] && empty( $value ) ) { |
|
906 | - $filter['value'] = array( 'start' => '', 'end' => '' ); |
|
905 | + if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) { |
|
906 | + $filter[ 'value' ] = array( 'start' => '', 'end' => '' ); |
|
907 | 907 | } |
908 | 908 | |
909 | 909 | return $filter; |
@@ -927,7 +927,7 @@ discard block |
||
927 | 927 | |
928 | 928 | $choices = array(); |
929 | 929 | foreach ( $users as $user ) { |
930 | - $choices[] = array( |
|
930 | + $choices[ ] = array( |
|
931 | 931 | 'value' => $user->ID, |
932 | 932 | 'text' => $user->display_name, |
933 | 933 | ); |
@@ -961,7 +961,7 @@ discard block |
||
961 | 961 | */ |
962 | 962 | public function add_datepicker_js_dependency( $js_dependencies ) { |
963 | 963 | |
964 | - $js_dependencies[] = 'jquery-ui-datepicker'; |
|
964 | + $js_dependencies[ ] = 'jquery-ui-datepicker'; |
|
965 | 965 | |
966 | 966 | return $js_dependencies; |
967 | 967 | } |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | 'isRTL' => is_rtl(), |
1006 | 1006 | ), $view_data ); |
1007 | 1007 | |
1008 | - $localizations['datepicker'] = $datepicker_settings; |
|
1008 | + $localizations[ 'datepicker' ] = $datepicker_settings; |
|
1009 | 1009 | |
1010 | 1010 | return $localizations; |
1011 | 1011 | |
@@ -1028,7 +1028,7 @@ discard block |
||
1028 | 1028 | add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 ); |
1029 | 1029 | |
1030 | 1030 | $scheme = is_ssl() ? 'https://' : 'http://'; |
1031 | - wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
1031 | + wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
1032 | 1032 | |
1033 | 1033 | /** |
1034 | 1034 | * @filter `gravityview_search_datepicker_class` |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | function __construct() { |
19 | 19 | |
20 | - $this->widget_description = __('Insert custom text or HTML as a widget', 'gravityview' ); |
|
20 | + $this->widget_description = __( 'Insert custom text or HTML as a widget', 'gravityview' ); |
|
21 | 21 | |
22 | 22 | $default_values = array( |
23 | 23 | 'header' => 1, |
@@ -42,39 +42,39 @@ discard block |
||
42 | 42 | ), |
43 | 43 | ); |
44 | 44 | |
45 | - parent::__construct( __( 'Custom Content', 'gravityview' ) , 'custom_content', $default_values, $settings ); |
|
45 | + parent::__construct( __( 'Custom Content', 'gravityview' ), 'custom_content', $default_values, $settings ); |
|
46 | 46 | } |
47 | 47 | |
48 | - public function render_frontend( $widget_args, $content = '', $context = '') { |
|
48 | + public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
49 | 49 | |
50 | - if( !$this->pre_render_frontend() ) { |
|
50 | + if ( ! $this->pre_render_frontend() ) { |
|
51 | 51 | return; |
52 | 52 | } |
53 | 53 | |
54 | - if( !empty( $widget_args['title'] ) ) { |
|
55 | - echo $widget_args['title']; |
|
54 | + if ( ! empty( $widget_args[ 'title' ] ) ) { |
|
55 | + echo $widget_args[ 'title' ]; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
59 | 59 | // Make sure the class is loaded in DataTables |
60 | - if( !class_exists( 'GFFormDisplay' ) ) { |
|
60 | + if ( ! class_exists( 'GFFormDisplay' ) ) { |
|
61 | 61 | include_once( GFCommon::get_base_path() . '/form_display.php' ); |
62 | 62 | } |
63 | 63 | |
64 | - $widget_args['content'] = trim( rtrim( $widget_args['content'] ) ); |
|
64 | + $widget_args[ 'content' ] = trim( rtrim( $widget_args[ 'content' ] ) ); |
|
65 | 65 | |
66 | 66 | // No custom content |
67 | - if( empty( $widget_args['content'] ) ) { |
|
68 | - do_action('gravityview_log_debug', sprintf( '%s[render_frontend]: No content.', get_class($this)) ); |
|
67 | + if ( empty( $widget_args[ 'content' ] ) ) { |
|
68 | + do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend]: No content.', get_class( $this ) ) ); |
|
69 | 69 | return; |
70 | 70 | } |
71 | 71 | |
72 | 72 | // Add paragraphs? |
73 | - if( !empty( $widget_args['wpautop'] ) ) { |
|
74 | - $widget_args['content'] = wpautop( $widget_args['content'] ); |
|
73 | + if ( ! empty( $widget_args[ 'wpautop' ] ) ) { |
|
74 | + $widget_args[ 'content' ] = wpautop( $widget_args[ 'content' ] ); |
|
75 | 75 | } |
76 | 76 | |
77 | - $content = $widget_args['content']; |
|
77 | + $content = $widget_args[ 'content' ]; |
|
78 | 78 | |
79 | 79 | $content = GravityView_Merge_Tags::replace_variables( $content ); |
80 | 80 | |
@@ -84,10 +84,10 @@ discard block |
||
84 | 84 | |
85 | 85 | |
86 | 86 | // Add custom class |
87 | - $class = !empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
87 | + $class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
88 | 88 | $class = gravityview_sanitize_html_class( $class ); |
89 | 89 | |
90 | - echo '<div class="gv-widget-custom-content '.$class.'">'. $content .'</div>'; |
|
90 | + echo '<div class="gv-widget-custom-content ' . $class . '">' . $content . '</div>'; |
|
91 | 91 | |
92 | 92 | } |
93 | 93 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | function __construct() { |
18 | 18 | |
19 | - $this->widget_description = __('Summary of the number of visible entries out of the total results.', 'gravityview' ); |
|
19 | + $this->widget_description = __( 'Summary of the number of visible entries out of the total results.', 'gravityview' ); |
|
20 | 20 | |
21 | 21 | $default_values = array( |
22 | 22 | 'header' => 1, |
@@ -25,18 +25,18 @@ discard block |
||
25 | 25 | |
26 | 26 | $settings = array(); |
27 | 27 | |
28 | - parent::__construct( __( 'Show Pagination Info', 'gravityview' ) , 'page_info', $default_values, $settings ); |
|
28 | + parent::__construct( __( 'Show Pagination Info', 'gravityview' ), 'page_info', $default_values, $settings ); |
|
29 | 29 | } |
30 | 30 | |
31 | - public function render_frontend( $widget_args, $content = '', $context = '') { |
|
31 | + public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
32 | 32 | $gravityview_view = GravityView_View::getInstance(); |
33 | 33 | |
34 | - if( !$this->pre_render_frontend() ) { |
|
34 | + if ( ! $this->pre_render_frontend() ) { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
38 | - if( !empty( $widget_args['title'] ) ) { |
|
39 | - echo $widget_args['title']; |
|
38 | + if ( ! empty( $widget_args[ 'title' ] ) ) { |
|
39 | + echo $widget_args[ 'title' ]; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | $pagination_counts = $gravityview_view->getPaginationCounts(); |
@@ -45,16 +45,16 @@ discard block |
||
45 | 45 | |
46 | 46 | $output = ''; |
47 | 47 | |
48 | - if( ! empty( $pagination_counts ) ) { |
|
48 | + if ( ! empty( $pagination_counts ) ) { |
|
49 | 49 | |
50 | - $first = $pagination_counts['first']; |
|
51 | - $last = $pagination_counts['last']; |
|
52 | - $total = $pagination_counts['total']; |
|
50 | + $first = $pagination_counts[ 'first' ]; |
|
51 | + $last = $pagination_counts[ 'last' ]; |
|
52 | + $total = $pagination_counts[ 'total' ]; |
|
53 | 53 | |
54 | - $class = !empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
54 | + $class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
55 | 55 | $class = gravityview_sanitize_html_class( $class ); |
56 | 56 | |
57 | - $output = '<div class="gv-widget-pagination '.$class.'"><p>'. sprintf(__( 'Displaying %1$s - %2$s of %3$s', 'gravityview' ), number_format_i18n( $first ), number_format_i18n( $last ), number_format_i18n( $total ) ) . '</p></div>'; |
|
57 | + $output = '<div class="gv-widget-pagination ' . $class . '"><p>' . sprintf( __( 'Displaying %1$s - %2$s of %3$s', 'gravityview' ), number_format_i18n( $first ), number_format_i18n( $last ), number_format_i18n( $total ) ) . '</p></div>'; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -11,38 +11,38 @@ discard block |
||
11 | 11 | |
12 | 12 | function __construct() { |
13 | 13 | |
14 | - $this->widget_description = __('Links to multiple pages of results.', 'gravityview' ); |
|
14 | + $this->widget_description = __( 'Links to multiple pages of results.', 'gravityview' ); |
|
15 | 15 | |
16 | 16 | $default_values = array( 'header' => 1, 'footer' => 1 ); |
17 | 17 | $settings = array( 'show_all' => array( |
18 | 18 | 'type' => 'checkbox', |
19 | 19 | 'label' => __( 'Show each page number', 'gravityview' ), |
20 | - 'desc' => __('Show every page number instead of summary (eg: 1 2 3 ... 8 »)', 'gravityview'), |
|
20 | + 'desc' => __( 'Show every page number instead of summary (eg: 1 2 3 ... 8 »)', 'gravityview' ), |
|
21 | 21 | 'value' => false |
22 | - )); |
|
23 | - parent::__construct( __( 'Page Links', 'gravityview' ) , 'page_links', $default_values, $settings ); |
|
22 | + ) ); |
|
23 | + parent::__construct( __( 'Page Links', 'gravityview' ), 'page_links', $default_values, $settings ); |
|
24 | 24 | |
25 | 25 | } |
26 | 26 | |
27 | - public function render_frontend( $widget_args, $content = '', $context = '') { |
|
27 | + public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
28 | 28 | $gravityview_view = GravityView_View::getInstance(); |
29 | 29 | |
30 | - if( !$this->pre_render_frontend() ) { |
|
30 | + if ( ! $this->pre_render_frontend() ) { |
|
31 | 31 | return; |
32 | 32 | } |
33 | 33 | |
34 | - $page_size = $gravityview_view->paging['page_size']; |
|
34 | + $page_size = $gravityview_view->paging[ 'page_size' ]; |
|
35 | 35 | $total = $gravityview_view->total_entries; |
36 | 36 | |
37 | 37 | $atts = shortcode_atts( array( |
38 | - 'show_all' => !empty( $this->settings['show_all']['default'] ), |
|
38 | + 'show_all' => ! empty( $this->settings[ 'show_all' ][ 'default' ] ), |
|
39 | 39 | ), $widget_args, 'gravityview_widget_page_links' ); |
40 | 40 | |
41 | 41 | // displaying info |
42 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
42 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
43 | 43 | |
44 | 44 | $page_link_args = array( |
45 | - 'base' => add_query_arg('pagenum','%#%', gv_directory_link() ), |
|
45 | + 'base' => add_query_arg( 'pagenum', '%#%', gv_directory_link() ), |
|
46 | 46 | 'format' => '&pagenum=%#%', |
47 | 47 | 'add_args' => array(), // |
48 | 48 | 'prev_text' => '«', |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | 'mid_size' => 2, |
53 | 53 | 'total' => empty( $page_size ) ? 0 : ceil( $total / $page_size ), |
54 | 54 | 'current' => $curr_page, |
55 | - 'show_all' => !empty( $atts['show_all'] ), // to be available at backoffice |
|
55 | + 'show_all' => ! empty( $atts[ 'show_all' ] ), // to be available at backoffice |
|
56 | 56 | ); |
57 | 57 | |
58 | 58 | /** |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | * @since 1.1.4 |
61 | 61 | * @param array $page_link_args Array of arguments for the `paginate_links()` function. [Read more about `paginate_links()`](http://developer.wordpress.org/reference/functions/paginate_links/) |
62 | 62 | */ |
63 | - $page_link_args = apply_filters('gravityview_page_links_args', $page_link_args ); |
|
63 | + $page_link_args = apply_filters( 'gravityview_page_links_args', $page_link_args ); |
|
64 | 64 | |
65 | 65 | $page_links = paginate_links( $page_link_args ); |
66 | 66 | |
67 | - if( !empty( $page_links )) { |
|
68 | - $class = !empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
67 | + if ( ! empty( $page_links ) ) { |
|
68 | + $class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
69 | 69 | $class = gravityview_sanitize_html_class( $class ); |
70 | - echo '<div class="gv-widget-page-links '.$class.'">'. $page_links .'</div>'; |
|
70 | + echo '<div class="gv-widget-page-links ' . $class . '">' . $page_links . '</div>'; |
|
71 | 71 | } else { |
72 | 72 | do_action( 'gravityview_log_debug', 'GravityView_Widget_Page_Links[render_frontend] No page links; paginate_links() returned empty response.' ); |
73 | 73 | } |
@@ -170,25 +170,25 @@ discard block |
||
170 | 170 | public function get_output() { |
171 | 171 | |
172 | 172 | // No Entries |
173 | - if( empty( $this->entries ) ) { |
|
174 | - return '<div class="gv-no-results">'.$this->empty_message.'</div>'; |
|
173 | + if ( empty( $this->entries ) ) { |
|
174 | + return '<div class="gv-no-results">' . $this->empty_message . '</div>'; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | $output = ''; |
178 | 178 | $current_entry = GravityView_View::getInstance()->getCurrentEntry(); |
179 | 179 | |
180 | - $output .= '<'. $this->wrapper_tag .'>'; |
|
180 | + $output .= '<' . $this->wrapper_tag . '>'; |
|
181 | 181 | |
182 | - foreach( $this->entries as $entry ) { |
|
182 | + foreach ( $this->entries as $entry ) { |
|
183 | 183 | |
184 | - if( $this->skip_entry( $entry, $current_entry ) ) { |
|
184 | + if ( $this->skip_entry( $entry, $current_entry ) ) { |
|
185 | 185 | continue; |
186 | 186 | } |
187 | 187 | |
188 | 188 | $output .= $this->get_item_output( $entry ); |
189 | 189 | } |
190 | 190 | |
191 | - $output .= '</'. $this->wrapper_tag .'>'; |
|
191 | + $output .= '</' . $this->wrapper_tag . '>'; |
|
192 | 192 | |
193 | 193 | /** |
194 | 194 | * @filter `gravityview/widget/recent-entries/output` Modify the HTML of the Recent Entries widget output |
@@ -211,15 +211,15 @@ discard block |
||
211 | 211 | private function skip_entry( $entry, $current_entry ) { |
212 | 212 | |
213 | 213 | // If skip entry is off, or there's no current entry, return false |
214 | - if( empty( $this->skip_current_entry ) || empty( $current_entry ) ) { |
|
214 | + if ( empty( $this->skip_current_entry ) || empty( $current_entry ) ) { |
|
215 | 215 | return false; |
216 | 216 | } |
217 | 217 | |
218 | 218 | // If in Single or Edit mode, $current_entry will be an array. |
219 | - $current_entry_id = is_array( $current_entry ) ? $current_entry['id'] : $current_entry; |
|
219 | + $current_entry_id = is_array( $current_entry ) ? $current_entry[ 'id' ] : $current_entry; |
|
220 | 220 | |
221 | 221 | // If the entry ID matches the current entry, yes: skip |
222 | - if( $entry['id'] === $current_entry_id ) { |
|
222 | + if ( $entry[ 'id' ] === $current_entry_id ) { |
|
223 | 223 | return true; |
224 | 224 | } |
225 | 225 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | |
247 | 247 | $item_output = gravityview_get_link( $link, $this->link_format ); |
248 | 248 | |
249 | - if( !empty( $this->after_link ) ) { |
|
249 | + if ( ! empty( $this->after_link ) ) { |
|
250 | 250 | |
251 | 251 | /** |
252 | 252 | * @filter `gravityview/entry-list/after-link` Modify the content displayed after the entry link in an entry list |
@@ -255,14 +255,14 @@ discard block |
||
255 | 255 | * @param array $entry Gravity Forms entry array |
256 | 256 | * @param GravityView_Entry_List $this The current class instance |
257 | 257 | */ |
258 | - $after_link = apply_filters( 'gravityview/entry-list/after-link', '<div>'.$this->after_link.'</div>', $entry, $this ); |
|
258 | + $after_link = apply_filters( 'gravityview/entry-list/after-link', '<div>' . $this->after_link . '</div>', $entry, $this ); |
|
259 | 259 | |
260 | 260 | $item_output .= $after_link; |
261 | 261 | } |
262 | 262 | |
263 | 263 | $item_output = GravityView_API::replace_variables( $item_output, $this->form, $entry ); |
264 | 264 | |
265 | - $item_output = '<'. $this->item_tag .'>'. $item_output .'</'. $this->item_tag .'>'; |
|
265 | + $item_output = '<' . $this->item_tag . '>' . $item_output . '</' . $this->item_tag . '>'; |
|
266 | 266 | |
267 | 267 | /** |
268 | 268 | * @filter `gravityview/entry-list/item` Modify each item's output in an entry list |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function __construct( $prevent_multiple_instances = '' ) { |
73 | 73 | |
74 | - if( $prevent_multiple_instances === 'get_instance' ) { |
|
74 | + if ( $prevent_multiple_instances === 'get_instance' ) { |
|
75 | 75 | return parent::__construct(); |
76 | 76 | } |
77 | 77 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public static function get_instance() { |
85 | 85 | |
86 | - if( empty( self::$instance ) ) { |
|
86 | + if ( empty( self::$instance ) ) { |
|
87 | 87 | self::$instance = new self( 'get_instance' ); |
88 | 88 | } |
89 | 89 | |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | * Prevent Gravity Forms from showing the uninstall tab on the settings page |
107 | 107 | * @hack |
108 | 108 | */ |
109 | - if( $caps === $this->_capabilities_uninstall ) { |
|
109 | + if ( $caps === $this->_capabilities_uninstall ) { |
|
110 | 110 | return false; |
111 | 111 | } |
112 | 112 | |
113 | - if( empty( $caps ) ) { |
|
113 | + if ( empty( $caps ) ) { |
|
114 | 114 | $caps = array( 'gravityview_full_access' ); |
115 | 115 | } |
116 | 116 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | add_filter( 'gform_addon_app_settings_menu_gravityview', array( $this, 'modify_app_settings_menu_title' ) ); |
134 | 134 | |
135 | 135 | /** @since 1.7.6 */ |
136 | - add_action('network_admin_menu', array( $this, 'add_network_menu' ) ); |
|
136 | + add_action( 'network_admin_menu', array( $this, 'add_network_menu' ) ); |
|
137 | 137 | |
138 | 138 | parent::init_admin(); |
139 | 139 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function modify_app_settings_menu_title( $setting_tabs ) { |
149 | 149 | |
150 | - $setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview'); |
|
150 | + $setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' ); |
|
151 | 151 | |
152 | 152 | return $setting_tabs; |
153 | 153 | } |
@@ -164,11 +164,11 @@ discard block |
||
164 | 164 | */ |
165 | 165 | private function _load_license_handler() { |
166 | 166 | |
167 | - if( !empty( $this->License_Handler ) ) { |
|
167 | + if ( ! empty( $this->License_Handler ) ) { |
|
168 | 168 | return; |
169 | 169 | } |
170 | 170 | |
171 | - require_once( GRAVITYVIEW_DIR . 'includes/class-gv-license-handler.php'); |
|
171 | + require_once( GRAVITYVIEW_DIR . 'includes/class-gv-license-handler.php' ); |
|
172 | 172 | |
173 | 173 | $this->License_Handler = GV_License_Handler::get_instance( $this ); |
174 | 174 | } |
@@ -180,60 +180,60 @@ discard block |
||
180 | 180 | function license_key_notice() { |
181 | 181 | |
182 | 182 | // Only show on GravityView pages |
183 | - if( ! gravityview_is_admin_page() ) { |
|
183 | + if ( ! gravityview_is_admin_page() ) { |
|
184 | 184 | return; |
185 | 185 | } |
186 | 186 | |
187 | - $license_status = self::getSetting('license_key_status'); |
|
188 | - $license_id = self::getSetting('license_key'); |
|
187 | + $license_status = self::getSetting( 'license_key_status' ); |
|
188 | + $license_id = self::getSetting( 'license_key' ); |
|
189 | 189 | $license_id = empty( $license_id ) ? 'license' : $license_id; |
190 | 190 | |
191 | - $message = esc_html__('Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview'); |
|
191 | + $message = esc_html__( 'Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview' ); |
|
192 | 192 | |
193 | 193 | /** |
194 | 194 | * I wanted to remove the period from after the buttons in the string, |
195 | 195 | * but didn't want to mess up the translation strings for the translators. |
196 | 196 | */ |
197 | 197 | $message = mb_substr( $message, 0, mb_strlen( $message ) - 1 ); |
198 | - $title = __('Inactive License', 'gravityview'); |
|
198 | + $title = __( 'Inactive License', 'gravityview' ); |
|
199 | 199 | $status = ''; |
200 | 200 | $update_below = false; |
201 | 201 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
202 | 202 | switch ( $license_status ) { |
203 | 203 | case 'invalid': |
204 | - $title = __('Invalid License', 'gravityview'); |
|
205 | - $status = __('is invalid', 'gravityview'); |
|
204 | + $title = __( 'Invalid License', 'gravityview' ); |
|
205 | + $status = __( 'is invalid', 'gravityview' ); |
|
206 | 206 | break; |
207 | 207 | case 'deactivated': |
208 | - $status = __('is inactive', 'gravityview'); |
|
209 | - $update_below = __('Activate your license key below.', 'gravityview'); |
|
208 | + $status = __( 'is inactive', 'gravityview' ); |
|
209 | + $update_below = __( 'Activate your license key below.', 'gravityview' ); |
|
210 | 210 | break; |
211 | 211 | /** @noinspection PhpMissingBreakStatementInspection */ |
212 | 212 | case '': |
213 | 213 | $license_status = 'site_inactive'; |
214 | 214 | // break intentionally left blank |
215 | 215 | case 'site_inactive': |
216 | - $status = __('has not been activated', 'gravityview'); |
|
217 | - $update_below = __('Activate your license key below.', 'gravityview'); |
|
216 | + $status = __( 'has not been activated', 'gravityview' ); |
|
217 | + $update_below = __( 'Activate your license key below.', 'gravityview' ); |
|
218 | 218 | break; |
219 | 219 | } |
220 | - $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content='.$license_status.'&utm_campaign=Admin%20Notice'; |
|
220 | + $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content=' . $license_status . '&utm_campaign=Admin%20Notice'; |
|
221 | 221 | |
222 | 222 | // Show a different notice on settings page for inactive licenses (hide the buttons) |
223 | - if( $update_below && gravityview_is_admin_page( '', 'settings' ) ) { |
|
223 | + if ( $update_below && gravityview_is_admin_page( '', 'settings' ) ) { |
|
224 | 224 | $message = sprintf( $message, $status, '<div class="hidden">', '', '', '</div><a href="#" onclick="jQuery(\'#license_key\').focus(); return false;">' . $update_below . '</a>' ); |
225 | 225 | } else { |
226 | 226 | $message = sprintf( $message, $status, "\n\n" . '<a href="' . $primary_button_link . '" class="button button-primary">', '</a>', '<a href="' . esc_url( $url ) . '" class="button button-secondary">', '</a>' ); |
227 | 227 | } |
228 | 228 | |
229 | - if( !empty( $status ) ) { |
|
229 | + if ( ! empty( $status ) ) { |
|
230 | 230 | GravityView_Admin_Notices::add_notice( array( |
231 | 231 | 'message' => $message, |
232 | 232 | 'class' => 'updated', |
233 | 233 | 'title' => $title, |
234 | 234 | 'cap' => 'gravityview_edit_settings', |
235 | - 'dismiss' => sha1( $license_status.'_'.$license_id ), |
|
236 | - )); |
|
235 | + 'dismiss' => sha1( $license_status . '_' . $license_id ), |
|
236 | + ) ); |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | |
246 | 246 | $styles = parent::styles(); |
247 | 247 | |
248 | - $styles[] = array( |
|
248 | + $styles[ ] = array( |
|
249 | 249 | 'handle' => 'gravityview_settings', |
250 | 250 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
251 | 251 | 'version' => GravityView_Plugin::version, |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | * @return void |
269 | 269 | */ |
270 | 270 | public function add_network_menu() { |
271 | - if( GravityView_Plugin::is_network_activated() ) { |
|
271 | + if ( GravityView_Plugin::is_network_activated() ) { |
|
272 | 272 | add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' ); |
273 | 273 | } |
274 | 274 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * If multisite and not network admin, we don't want the settings to show. |
286 | 286 | * @since 1.7.6 |
287 | 287 | */ |
288 | - $show_submenu = !is_multisite() || is_main_site() || !GravityView_Plugin::is_network_activated() || ( is_network_admin() && GravityView_Plugin::is_network_activated() ); |
|
288 | + $show_submenu = ! is_multisite() || is_main_site() || ! GravityView_Plugin::is_network_activated() || ( is_network_admin() && GravityView_Plugin::is_network_activated() ); |
|
289 | 289 | |
290 | 290 | /** |
291 | 291 | * Override whether to show the Settings menu on a per-blog basis. |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | */ |
295 | 295 | $show_submenu = apply_filters( 'gravityview/show-settings-menu', $show_submenu ); |
296 | 296 | |
297 | - if( $show_submenu ) { |
|
297 | + if ( $show_submenu ) { |
|
298 | 298 | add_submenu_page( 'edit.php?post_type=gravityview', __( 'Settings', 'gravityview' ), __( 'Settings', 'gravityview' ), $this->_capabilities_app_settings, $this->_slug . '_settings', array( $this, 'app_tab_page' ) ); |
299 | 299 | } |
300 | 300 | } |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | /** |
326 | 326 | * Backward compatibility with Redux |
327 | 327 | */ |
328 | - if( $setting_name === 'license' ) { |
|
328 | + if ( $setting_name === 'license' ) { |
|
329 | 329 | return array( |
330 | 330 | 'license' => parent::get_app_setting( 'license_key' ), |
331 | 331 | 'status' => parent::get_app_setting( 'license_key_status' ), |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | |
390 | 390 | $return = $text . $activation; |
391 | 391 | |
392 | - if( $echo ) { |
|
392 | + if ( $echo ) { |
|
393 | 393 | echo $return; |
394 | 394 | } |
395 | 395 | |
@@ -416,15 +416,15 @@ discard block |
||
416 | 416 | */ |
417 | 417 | public function settings_submit( $field, $echo = true ) { |
418 | 418 | |
419 | - $field['type'] = ( isset($field['type']) && in_array( $field['type'], array('submit','reset','button') ) ) ? $field['type'] : 'submit'; |
|
419 | + $field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit'; |
|
420 | 420 | |
421 | 421 | $attributes = $this->get_field_attributes( $field ); |
422 | 422 | $default_value = rgar( $field, 'value' ) ? rgar( $field, 'value' ) : rgar( $field, 'default_value' ); |
423 | - $value = $this->get_setting( $field['name'], $default_value ); |
|
423 | + $value = $this->get_setting( $field[ 'name' ], $default_value ); |
|
424 | 424 | |
425 | 425 | |
426 | - $attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary gfbutton'; |
|
427 | - $name = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_'.$field['name']; |
|
426 | + $attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary gfbutton'; |
|
427 | + $name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ]; |
|
428 | 428 | |
429 | 429 | if ( empty( $value ) ) { |
430 | 430 | $value = __( 'Update Settings', 'gravityview' ); |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $attributes = $this->get_field_attributes( $field ); |
434 | 434 | |
435 | 435 | $html = '<input |
436 | - type="' . $field['type'] . '" |
|
436 | + type="' . $field[ 'type' ] . '" |
|
437 | 437 | name="' . esc_attr( $name ) . '" |
438 | 438 | value="' . $value . '" ' . |
439 | 439 | implode( ' ', $attributes ) . |
@@ -455,16 +455,16 @@ discard block |
||
455 | 455 | * @return string |
456 | 456 | */ |
457 | 457 | public function settings_save( $field, $echo = true ) { |
458 | - $field['type'] = 'submit'; |
|
459 | - $field['name'] = 'gform-settings-save'; |
|
460 | - $field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton'; |
|
458 | + $field[ 'type' ] = 'submit'; |
|
459 | + $field[ 'name' ] = 'gform-settings-save'; |
|
460 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] : 'button-primary gfbutton'; |
|
461 | 461 | |
462 | 462 | if ( ! rgar( $field, 'value' ) ) |
463 | - $field['value'] = __( 'Update Settings', 'gravityview' ); |
|
463 | + $field[ 'value' ] = __( 'Update Settings', 'gravityview' ); |
|
464 | 464 | |
465 | 465 | $output = $this->settings_submit( $field, false ); |
466 | 466 | |
467 | - if( $echo ) { |
|
467 | + if ( $echo ) { |
|
468 | 468 | echo $output; |
469 | 469 | } |
470 | 470 | |
@@ -478,11 +478,11 @@ discard block |
||
478 | 478 | */ |
479 | 479 | public function single_setting_label( $field ) { |
480 | 480 | |
481 | - echo $field['label']; |
|
481 | + echo $field[ 'label' ]; |
|
482 | 482 | |
483 | 483 | |
484 | - if ( isset( $field['tooltip'] ) ) { |
|
485 | - echo ' ' . gform_tooltip( $field['tooltip'], rgar( $field, 'tooltip_class' ), true ); |
|
484 | + if ( isset( $field[ 'tooltip' ] ) ) { |
|
485 | + echo ' ' . gform_tooltip( $field[ 'tooltip' ], rgar( $field, 'tooltip_class' ), true ); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | if ( rgar( $field, 'required' ) ) { |
@@ -490,8 +490,8 @@ discard block |
||
490 | 490 | } |
491 | 491 | |
492 | 492 | // Added by GravityView |
493 | - if ( isset( $field['description'] ) ) { |
|
494 | - echo '<span class="description">'. $field['description'] .'</span>'; |
|
493 | + if ( isset( $field[ 'description' ] ) ) { |
|
494 | + echo '<span class="description">' . $field[ 'description' ] . '</span>'; |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | } |
@@ -553,11 +553,11 @@ discard block |
||
553 | 553 | |
554 | 554 | // If the posted key doesn't match the activated/deactivated key (set using the Activate License button, AJAX response), |
555 | 555 | // then we assume it's changed. If it's changed, unset the status and the previous response. |
556 | - if( $local_key !== $response_key ) { |
|
556 | + if ( $local_key !== $response_key ) { |
|
557 | 557 | |
558 | - unset( $posted_settings['license_key_response'] ); |
|
559 | - unset( $posted_settings['license_key_status'] ); |
|
560 | - GFCommon::add_error_message( __('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
558 | + unset( $posted_settings[ 'license_key_response' ] ); |
|
559 | + unset( $posted_settings[ 'license_key_status' ] ); |
|
560 | + GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | return $posted_settings; |
@@ -592,25 +592,25 @@ discard block |
||
592 | 592 | 'label' => __( 'License Key', 'gravityview' ), |
593 | 593 | 'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates & support.', 'gravityview' ), |
594 | 594 | 'type' => 'edd_license', |
595 | - 'data-pending-text' => __('Verifying license…', 'gravityview'), |
|
596 | - 'default_value' => $default_settings['license_key'], |
|
595 | + 'data-pending-text' => __( 'Verifying license…', 'gravityview' ), |
|
596 | + 'default_value' => $default_settings[ 'license_key' ], |
|
597 | 597 | 'class' => ( '' == $this->get_app_setting( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key', |
598 | 598 | ), |
599 | 599 | array( |
600 | 600 | 'name' => 'license_key_response', |
601 | - 'default_value' => $default_settings['license_key_response'], |
|
601 | + 'default_value' => $default_settings[ 'license_key_response' ], |
|
602 | 602 | 'type' => 'hidden', |
603 | 603 | ), |
604 | 604 | array( |
605 | 605 | 'name' => 'license_key_status', |
606 | - 'default_value' => $default_settings['license_key_status'], |
|
606 | + 'default_value' => $default_settings[ 'license_key_status' ], |
|
607 | 607 | 'type' => 'hidden', |
608 | 608 | ), |
609 | 609 | array( |
610 | 610 | 'name' => 'support-email', |
611 | 611 | 'type' => 'text', |
612 | 612 | 'validate' => 'email', |
613 | - 'default_value' => $default_settings['support-email'], |
|
613 | + 'default_value' => $default_settings[ 'support-email' ], |
|
614 | 614 | 'label' => __( 'Support Email', 'gravityview' ), |
615 | 615 | 'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ), |
616 | 616 | 'class' => 'code regular-text', |
@@ -622,44 +622,44 @@ discard block |
||
622 | 622 | 'name' => 'support_port', |
623 | 623 | 'type' => 'radio', |
624 | 624 | 'label' => __( 'Show Support Port?', 'gravityview' ), |
625 | - 'default_value' => $default_settings['support_port'], |
|
625 | + 'default_value' => $default_settings[ 'support_port' ], |
|
626 | 626 | 'horizontal' => 1, |
627 | 627 | 'choices' => array( |
628 | 628 | array( |
629 | - 'label' => _x('Show', 'Setting: Show or Hide', 'gravityview'), |
|
629 | + 'label' => _x( 'Show', 'Setting: Show or Hide', 'gravityview' ), |
|
630 | 630 | 'value' => '1', |
631 | 631 | ), |
632 | 632 | array( |
633 | - 'label' => _x('Hide', 'Setting: Show or Hide', 'gravityview'), |
|
633 | + 'label' => _x( 'Hide', 'Setting: Show or Hide', 'gravityview' ), |
|
634 | 634 | 'value' => '0', |
635 | 635 | ), |
636 | 636 | ), |
637 | - 'tooltip' => '<p><img src="' . esc_url_raw( plugins_url('assets/images/screenshots/beacon.png', GRAVITYVIEW_FILE ) ) . '" alt="' . esc_attr__( 'The Support Port looks like this.', 'gravityview' ) . '" class="alignright" style="max-width:40px; margin:.5em;" />' . esc_html__('The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gravityview') . '</p>', |
|
637 | + 'tooltip' => '<p><img src="' . esc_url_raw( plugins_url( 'assets/images/screenshots/beacon.png', GRAVITYVIEW_FILE ) ) . '" alt="' . esc_attr__( 'The Support Port looks like this.', 'gravityview' ) . '" class="alignright" style="max-width:40px; margin:.5em;" />' . esc_html__( 'The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gravityview' ) . '</p>', |
|
638 | 638 | 'description' => __( 'Show the Support Port on GravityView pages?', 'gravityview' ), |
639 | 639 | ), |
640 | 640 | array( |
641 | 641 | 'name' => 'no-conflict-mode', |
642 | 642 | 'type' => 'radio', |
643 | 643 | 'label' => __( 'No-Conflict Mode', 'gravityview' ), |
644 | - 'default_value' => $default_settings['no-conflict-mode'], |
|
644 | + 'default_value' => $default_settings[ 'no-conflict-mode' ], |
|
645 | 645 | 'horizontal' => 1, |
646 | 646 | 'choices' => array( |
647 | 647 | array( |
648 | - 'label' => _x('On', 'Setting: On or off', 'gravityview'), |
|
648 | + 'label' => _x( 'On', 'Setting: On or off', 'gravityview' ), |
|
649 | 649 | 'value' => '1', |
650 | 650 | ), |
651 | 651 | array( |
652 | - 'label' => _x('Off', 'Setting: On or off', 'gravityview'), |
|
652 | + 'label' => _x( 'Off', 'Setting: On or off', 'gravityview' ), |
|
653 | 653 | 'value' => '0', |
654 | 654 | ), |
655 | 655 | ), |
656 | - 'description' => __( 'Set this to ON to prevent extraneous scripts and styles from being printed on GravityView admin pages, reducing conflicts with other plugins and themes.', 'gravityview' ) . ' ' . __('If your Edit View tabs are ugly, enable this setting.', 'gravityview'), |
|
656 | + 'description' => __( 'Set this to ON to prevent extraneous scripts and styles from being printed on GravityView admin pages, reducing conflicts with other plugins and themes.', 'gravityview' ) . ' ' . __( 'If your Edit View tabs are ugly, enable this setting.', 'gravityview' ), |
|
657 | 657 | ), |
658 | 658 | array( |
659 | 659 | 'name' => 'delete-on-uninstall', |
660 | 660 | 'type' => 'radio', |
661 | 661 | 'label' => __( 'Remove Data on Delete?', 'gravityview' ), |
662 | - 'default_value' => $default_settings['delete-on-uninstall'], |
|
662 | + 'default_value' => $default_settings[ 'delete-on-uninstall' ], |
|
663 | 663 | 'horizontal' => 1, |
664 | 664 | 'choices' => array( |
665 | 665 | array( |
@@ -685,20 +685,20 @@ discard block |
||
685 | 685 | * @since 1.7.4 |
686 | 686 | */ |
687 | 687 | foreach ( $fields as &$field ) { |
688 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : rgget('id', $field ); |
|
689 | - $field['label'] = isset( $field['label'] ) ? $field['label'] : rgget('title', $field ); |
|
690 | - $field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : rgget('default', $field ); |
|
691 | - $field['description'] = isset( $field['description'] ) ? $field['description'] : rgget('subtitle', $field ); |
|
688 | + $field[ 'name' ] = isset( $field[ 'name' ] ) ? $field[ 'name' ] : rgget( 'id', $field ); |
|
689 | + $field[ 'label' ] = isset( $field[ 'label' ] ) ? $field[ 'label' ] : rgget( 'title', $field ); |
|
690 | + $field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : rgget( 'default', $field ); |
|
691 | + $field[ 'description' ] = isset( $field[ 'description' ] ) ? $field[ 'description' ] : rgget( 'subtitle', $field ); |
|
692 | 692 | |
693 | - if( $disabled_attribute ) { |
|
694 | - $field['disabled'] = $disabled_attribute; |
|
693 | + if ( $disabled_attribute ) { |
|
694 | + $field[ 'disabled' ] = $disabled_attribute; |
|
695 | 695 | } |
696 | 696 | } |
697 | 697 | |
698 | 698 | |
699 | 699 | $sections = array( |
700 | 700 | array( |
701 | - 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ), |
|
701 | + 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), GravityView_Plugin::version ) ), |
|
702 | 702 | 'fields' => $fields, |
703 | 703 | ) |
704 | 704 | ); |
@@ -709,8 +709,8 @@ discard block |
||
709 | 709 | 'type' => 'save', |
710 | 710 | ); |
711 | 711 | |
712 | - if( $disabled_attribute ) { |
|
713 | - $button['disabled'] = $disabled_attribute; |
|
712 | + if ( $disabled_attribute ) { |
|
713 | + $button[ 'disabled' ] = $disabled_attribute; |
|
714 | 714 | } |
715 | 715 | |
716 | 716 | |
@@ -730,20 +730,20 @@ discard block |
||
730 | 730 | // If there are extensions, add a section for them |
731 | 731 | if ( ! empty( $extension_sections ) ) { |
732 | 732 | |
733 | - if( $disabled_attribute ) { |
|
733 | + if ( $disabled_attribute ) { |
|
734 | 734 | foreach ( $extension_sections as &$section ) { |
735 | - foreach ( $section['fields'] as &$field ) { |
|
736 | - $field['disabled'] = $disabled_attribute; |
|
735 | + foreach ( $section[ 'fields' ] as &$field ) { |
|
736 | + $field[ 'disabled' ] = $disabled_attribute; |
|
737 | 737 | } |
738 | 738 | } |
739 | 739 | } |
740 | 740 | |
741 | - $k = count( $extension_sections ) - 1 ; |
|
742 | - $extension_sections[ $k ]['fields'][] = $button; |
|
741 | + $k = count( $extension_sections ) - 1; |
|
742 | + $extension_sections[ $k ][ 'fields' ][ ] = $button; |
|
743 | 743 | $sections = array_merge( $sections, $extension_sections ); |
744 | 744 | } else { |
745 | 745 | // add the 'update settings' button to the general section |
746 | - $sections[0]['fields'][] = $button; |
|
746 | + $sections[ 0 ][ 'fields' ][ ] = $button; |
|
747 | 747 | } |
748 | 748 | |
749 | 749 | return $sections; |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | do_action( 'gravityview_log_debug', __FUNCTION__ . ' $passed_atts: ', $passed_atts ); |
50 | 50 | |
51 | 51 | // Get details about the current View |
52 | - if( !empty( $passed_atts['detail'] ) ) { |
|
53 | - return $this->get_view_detail( $passed_atts['detail'] ); |
|
52 | + if ( ! empty( $passed_atts[ 'detail' ] ) ) { |
|
53 | + return $this->get_view_detail( $passed_atts[ 'detail' ] ); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | $atts = $this->parse_and_sanitize_atts( $passed_atts ); |
@@ -90,12 +90,12 @@ discard block |
||
90 | 90 | |
91 | 91 | $atts = array(); |
92 | 92 | |
93 | - foreach( $filtered_atts as $key => $passed_value ) { |
|
93 | + foreach ( $filtered_atts as $key => $passed_value ) { |
|
94 | 94 | |
95 | 95 | // Allow using {get} merge tags in shortcode attributes |
96 | 96 | $passed_value = GravityView_Merge_Tags::replace_get_variables( $passed_value ); |
97 | 97 | |
98 | - switch( $defaults[ $key ]['type'] ) { |
|
98 | + switch ( $defaults[ $key ][ 'type' ] ) { |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * Make sure number fields are numeric. |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @see http://php.net/manual/en/function.is-numeric.php#107326 |
104 | 104 | */ |
105 | 105 | case 'number': |
106 | - if( is_numeric( $passed_value ) ) { |
|
106 | + if ( is_numeric( $passed_value ) ) { |
|
107 | 107 | $atts[ $key ] = ( $passed_value + 0 ); |
108 | 108 | } |
109 | 109 | break; |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | */ |
119 | 119 | case 'select': |
120 | 120 | case 'radio': |
121 | - $options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options']; |
|
122 | - if( in_array( $passed_value, array_keys( $options ) ) ) { |
|
121 | + $options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ]; |
|
122 | + if ( in_array( $passed_value, array_keys( $options ) ) ) { |
|
123 | 123 | $atts[ $key ] = $passed_value; |
124 | 124 | } |
125 | 125 | break; |
@@ -148,21 +148,21 @@ discard block |
||
148 | 148 | $gravityview_view = GravityView_View::getInstance(); |
149 | 149 | $return = ''; |
150 | 150 | |
151 | - switch( $detail ) { |
|
151 | + switch ( $detail ) { |
|
152 | 152 | case 'total_entries': |
153 | 153 | $return = number_format_i18n( $gravityview_view->getTotalEntries() ); |
154 | 154 | break; |
155 | 155 | case 'first_entry': |
156 | 156 | $paging = $gravityview_view->getPaginationCounts(); |
157 | - $return = empty( $paging ) ? '' : number_format_i18n( $paging['first'] ); |
|
157 | + $return = empty( $paging ) ? '' : number_format_i18n( $paging[ 'first' ] ); |
|
158 | 158 | break; |
159 | 159 | case 'last_entry': |
160 | 160 | $paging = $gravityview_view->getPaginationCounts(); |
161 | - $return = empty( $paging ) ? '' : number_format_i18n( $paging['last'] ); |
|
161 | + $return = empty( $paging ) ? '' : number_format_i18n( $paging[ 'last' ] ); |
|
162 | 162 | break; |
163 | 163 | case 'page_size': |
164 | 164 | $paging = $gravityview_view->getPaging(); |
165 | - $return = number_format_i18n( $paging['page_size'] ); |
|
165 | + $return = number_format_i18n( $paging[ 'page_size' ] ); |
|
166 | 166 | break; |
167 | 167 | } |
168 | 168 |
@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | |
8 | 8 | function __construct() { |
9 | 9 | |
10 | - add_action( 'gravityview_log_error', array( $this, 'log_error'), 10, 2 ); |
|
10 | + add_action( 'gravityview_log_error', array( $this, 'log_error' ), 10, 2 ); |
|
11 | 11 | |
12 | - add_action( 'gravityview_log_debug', array( $this, 'log_debug'), 10, 2 ); |
|
12 | + add_action( 'gravityview_log_debug', array( $this, 'log_debug' ), 10, 2 ); |
|
13 | 13 | |
14 | 14 | // Enable debug with Gravity Forms Logging Add-on |
15 | 15 | add_filter( 'gform_logging_supported', array( $this, 'enable_gform_logging' ) ); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | include_once( GRAVITYVIEW_DIR . 'includes/class-debug-bar.php' ); |
35 | 35 | } |
36 | 36 | |
37 | - $panels[] = new GravityView_Debug_Bar; |
|
37 | + $panels[ ] = new GravityView_Debug_Bar; |
|
38 | 38 | |
39 | 39 | return $panels; |
40 | 40 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param array $supported_plugins List of plugins |
45 | 45 | */ |
46 | 46 | public function enable_gform_logging( $supported_plugins ) { |
47 | - $supported_plugins['gravityview'] = 'GravityView'; |
|
47 | + $supported_plugins[ 'gravityview' ] = 'GravityView'; |
|
48 | 48 | return $supported_plugins; |
49 | 49 | } |
50 | 50 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @return string "print_r" or "var_export" |
73 | 73 | */ |
74 | 74 | static function get_print_function() { |
75 | - if( ob_get_level() > 0 ) { |
|
75 | + if ( ob_get_level() > 0 ) { |
|
76 | 76 | $function = 'var_export'; |
77 | 77 | } else { |
78 | 78 | $function = 'print_r'; |
@@ -88,36 +88,36 @@ discard block |
||
88 | 88 | $notice = array( |
89 | 89 | 'message' => $function( $message, true ), |
90 | 90 | 'data' => $data, |
91 | - 'backtrace' => function_exists('wp_debug_backtrace_summary') ? wp_debug_backtrace_summary( null, 3 ) : '', |
|
91 | + 'backtrace' => function_exists( 'wp_debug_backtrace_summary' ) ? wp_debug_backtrace_summary( null, 3 ) : '', |
|
92 | 92 | ); |
93 | 93 | |
94 | - if( !in_array( $notice, self::$notices ) ) { |
|
95 | - self::$notices[] = $notice; |
|
94 | + if ( ! in_array( $notice, self::$notices ) ) { |
|
95 | + self::$notices[ ] = $notice; |
|
96 | 96 | } |
97 | 97 | |
98 | - if ( class_exists("GFLogging") ) { |
|
98 | + if ( class_exists( "GFLogging" ) ) { |
|
99 | 99 | GFLogging::include_logger(); |
100 | - GFLogging::log_message( 'gravityview', $function( $message, true ) . $function($data, true), KLogger::DEBUG ); |
|
100 | + GFLogging::log_message( 'gravityview', $function( $message, true ) . $function( $data, true ), KLogger::DEBUG ); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | - static function log_error( $message = '', $data = null ) { |
|
104 | + static function log_error( $message = '', $data = null ) { |
|
105 | 105 | |
106 | 106 | $function = self::get_print_function(); |
107 | 107 | |
108 | 108 | $error = array( |
109 | 109 | 'message' => $message, |
110 | 110 | 'data' => $data, |
111 | - 'backtrace' => function_exists('wp_debug_backtrace_summary') ? wp_debug_backtrace_summary( null, 3 ) : '', |
|
111 | + 'backtrace' => function_exists( 'wp_debug_backtrace_summary' ) ? wp_debug_backtrace_summary( null, 3 ) : '', |
|
112 | 112 | ); |
113 | 113 | |
114 | - if( !in_array( $error, self::$errors ) ) { |
|
115 | - self::$errors[] = $error; |
|
114 | + if ( ! in_array( $error, self::$errors ) ) { |
|
115 | + self::$errors[ ] = $error; |
|
116 | 116 | } |
117 | 117 | |
118 | - if ( class_exists("GFLogging") ) { |
|
118 | + if ( class_exists( "GFLogging" ) ) { |
|
119 | 119 | GFLogging::include_logger(); |
120 | - GFLogging::log_message( 'gravityview', $function ( $message, true ) . $function ($data, true), KLogger::ERROR ); |
|
120 | + GFLogging::log_message( 'gravityview', $function( $message, true ) . $function( $data, true ), KLogger::ERROR ); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 |