@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @return string |
27 | 27 | */ |
28 | 28 | public function the_field( \GV\Field $field, $extras = null ) { |
29 | - $form = \GV\GF_Form::by_id( $field->form_id ) ? : $this->view->form; |
|
29 | + $form = \GV\GF_Form::by_id( $field->form_id ) ?: $this->view->form; |
|
30 | 30 | $entry = $this->entry->from_field( $field ); |
31 | 31 | |
32 | 32 | if ( ! $entry ) { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | $renderer = new Field_Renderer(); |
37 | - $source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ? : $this->view->form ) : new Internal_Source(); |
|
37 | + $source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ?: $this->view->form ) : new Internal_Source(); |
|
38 | 38 | |
39 | 39 | $value = $renderer->render( $field, $this->view, $source, $entry, $this->request ); |
40 | 40 | |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | $hide_empty = apply_filters( 'gravityview/render/hide-empty-zone', Utils::get( $extras, 'hide_empty', $this->view->settings->get( 'hide_empty', false ) ), $context ); |
63 | 63 | |
64 | 64 | if ( is_numeric( $field->ID ) ) { |
65 | - $extras['field'] = $field->as_configuration(); |
|
65 | + $extras[ 'field' ] = $field->as_configuration(); |
|
66 | 66 | } |
67 | 67 | |
68 | - $extras['entry'] = $this->entry->as_entry(); |
|
69 | - $extras['hide_empty'] = $hide_empty; |
|
70 | - $extras['label'] = $label; |
|
71 | - $extras['value'] = $value; |
|
68 | + $extras[ 'entry' ] = $this->entry->as_entry(); |
|
69 | + $extras[ 'hide_empty' ] = $hide_empty; |
|
70 | + $extras[ 'label' ] = $label; |
|
71 | + $extras[ 'value' ] = $value; |
|
72 | 72 | |
73 | 73 | return \gravityview_field_output( $extras, $context ); |
74 | 74 | } |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | public function the_field( \GV\Field $field, \GV\Entry $entry, $extras = null ) { |
30 | 30 | $form = $this->view->form; |
31 | 31 | |
32 | - if ( isset( $this->view->unions[ $entry['form_id'] ] ) ) { |
|
33 | - if ( isset( $this->view->unions[ $entry['form_id'] ][ $field->ID ] ) ) { |
|
34 | - $field = $this->view->unions[ $entry['form_id'] ][ $field->ID ]; |
|
32 | + if ( isset( $this->view->unions[ $entry[ 'form_id' ] ] ) ) { |
|
33 | + if ( isset( $this->view->unions[ $entry[ 'form_id' ] ][ $field->ID ] ) ) { |
|
34 | + $field = $this->view->unions[ $entry[ 'form_id' ] ][ $field->ID ]; |
|
35 | 35 | } elseif ( ! $field instanceof Internal_Field ) { |
36 | 36 | $field = Internal_Field::from_configuration( array( 'id' => 'custom' ) ); |
37 | 37 | } |
@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | $hide_empty = apply_filters( 'gravityview/render/hide-empty-zone', Utils::get( $extras, 'hide_empty', $this->view->settings->get( 'hide_empty', false ) ), $context ); |
82 | 82 | |
83 | 83 | if ( is_numeric( $field->ID ) ) { |
84 | - $extras['field'] = $field->as_configuration(); |
|
84 | + $extras[ 'field' ] = $field->as_configuration(); |
|
85 | 85 | } |
86 | 86 | |
87 | - $extras['entry'] = $entry->as_entry(); |
|
88 | - $extras['hide_empty'] = $hide_empty; |
|
89 | - $extras['label'] = $label; |
|
90 | - $extras['value'] = $value; |
|
87 | + $extras[ 'entry' ] = $entry->as_entry(); |
|
88 | + $extras[ 'hide_empty' ] = $hide_empty; |
|
89 | + $extras[ 'label' ] = $label; |
|
90 | + $extras[ 'value' ] = $value; |
|
91 | 91 | |
92 | 92 | return \gravityview_field_output( $extras, $context ); |
93 | 93 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | die; |
17 | 17 | } |
18 | 18 | |
19 | -if( ! class_exists( '\GV\Gamajo_Template_Loader' ) ) { |
|
19 | +if ( ! class_exists( '\GV\Gamajo_Template_Loader' ) ) { |
|
20 | 20 | require( GRAVITYVIEW_DIR . 'future/lib/class-gamajo-template-loader.php' ); |
21 | 21 | } |
22 | 22 | |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | 'atts' => NULL, |
158 | 158 | ) ); |
159 | 159 | |
160 | - foreach ($atts as $key => $value) { |
|
161 | - if( is_null( $value ) ) { |
|
160 | + foreach ( $atts as $key => $value ) { |
|
161 | + if ( is_null( $value ) ) { |
|
162 | 162 | continue; |
163 | 163 | } |
164 | 164 | $this->{$key} = $value; |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | */ |
189 | 189 | static function getInstance( $passed_post = NULL ) { |
190 | 190 | |
191 | - if( empty( self::$instance ) ) { |
|
191 | + if ( empty( self::$instance ) ) { |
|
192 | 192 | self::$instance = new self( $passed_post ); |
193 | 193 | } |
194 | 194 | |
@@ -201,8 +201,8 @@ discard block |
||
201 | 201 | */ |
202 | 202 | public function getCurrentField( $key = NULL ) { |
203 | 203 | |
204 | - if( !empty( $key ) ) { |
|
205 | - if( isset( $this->_current_field[ $key ] ) ) { |
|
204 | + if ( ! empty( $key ) ) { |
|
205 | + if ( isset( $this->_current_field[ $key ] ) ) { |
|
206 | 206 | return $this->_current_field[ $key ]; |
207 | 207 | } |
208 | 208 | return NULL; |
@@ -213,16 +213,16 @@ discard block |
||
213 | 213 | |
214 | 214 | public function setCurrentFieldSetting( $key, $value ) { |
215 | 215 | |
216 | - if( !empty( $this->_current_field ) ) { |
|
217 | - $this->_current_field['field_settings'][ $key ] = $value; |
|
216 | + if ( ! empty( $this->_current_field ) ) { |
|
217 | + $this->_current_field[ 'field_settings' ][ $key ] = $value; |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | } |
221 | 221 | |
222 | 222 | public function getCurrentFieldSetting( $key ) { |
223 | - $settings = $this->getCurrentField('field_settings'); |
|
223 | + $settings = $this->getCurrentField( 'field_settings' ); |
|
224 | 224 | |
225 | - if( $settings && !empty( $settings[ $key ] ) ) { |
|
225 | + if ( $settings && ! empty( $settings[ $key ] ) ) { |
|
226 | 226 | return $settings[ $key ]; |
227 | 227 | } |
228 | 228 | |
@@ -253,8 +253,8 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public function getAtts( $key = NULL ) { |
255 | 255 | |
256 | - if( !empty( $key ) ) { |
|
257 | - if( isset( $this->atts[ $key ] ) ) { |
|
256 | + if ( ! empty( $key ) ) { |
|
257 | + if ( isset( $this->atts[ $key ] ) ) { |
|
258 | 258 | return $this->atts[ $key ]; |
259 | 259 | } |
260 | 260 | return NULL; |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | |
321 | 321 | $fields = empty( $this->fields ) ? NULL : $this->fields; |
322 | 322 | |
323 | - if( $fields && !empty( $key ) ) { |
|
323 | + if ( $fields && ! empty( $key ) ) { |
|
324 | 324 | $fields = isset( $fields[ $key ] ) ? $fields[ $key ] : NULL; |
325 | 325 | } |
326 | 326 | |
@@ -338,18 +338,18 @@ discard block |
||
338 | 338 | */ |
339 | 339 | public function getContextFields( $context = '' ) { |
340 | 340 | |
341 | - if( '' === $context ) { |
|
341 | + if ( '' === $context ) { |
|
342 | 342 | $context = $this->getContext(); |
343 | 343 | } |
344 | 344 | |
345 | 345 | $fields = $this->getFields(); |
346 | 346 | |
347 | - foreach ( (array) $fields as $key => $context_fields ) { |
|
347 | + foreach ( (array)$fields as $key => $context_fields ) { |
|
348 | 348 | |
349 | 349 | // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against |
350 | 350 | $matches = explode( '_', $key ); |
351 | 351 | |
352 | - if( isset( $matches[0] ) && $matches[0] === $context ) { |
|
352 | + if ( isset( $matches[ 0 ] ) && $matches[ 0 ] === $context ) { |
|
353 | 353 | return $context_fields; |
354 | 354 | } |
355 | 355 | } |
@@ -370,8 +370,8 @@ discard block |
||
370 | 370 | */ |
371 | 371 | public function getField( $key ) { |
372 | 372 | |
373 | - if( !empty( $key ) ) { |
|
374 | - if( isset( $this->fields[ $key ] ) ) { |
|
373 | + if ( ! empty( $key ) ) { |
|
374 | + if ( isset( $this->fields[ $key ] ) ) { |
|
375 | 375 | return $this->fields[ $key ]; |
376 | 376 | } |
377 | 377 | } |
@@ -477,8 +477,8 @@ discard block |
||
477 | 477 | public function getPaginationCounts() { |
478 | 478 | |
479 | 479 | $paging = $this->getPaging(); |
480 | - $offset = $paging['offset']; |
|
481 | - $page_size = $paging['page_size']; |
|
480 | + $offset = $paging[ 'offset' ]; |
|
481 | + $page_size = $paging[ 'page_size' ]; |
|
482 | 482 | $total = $this->getTotalEntries(); |
483 | 483 | |
484 | 484 | if ( empty( $total ) ) { |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | */ |
500 | 500 | list( $first, $last, $total ) = apply_filters( 'gravityview_pagination_counts', array( $first, $last, $total ) ); |
501 | 501 | |
502 | - return array( 'first' => (int) $first, 'last' => (int) $last, 'total' => (int) $total ); |
|
502 | + return array( 'first' => (int)$first, 'last' => (int)$last, 'total' => (int)$total ); |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | /** |
@@ -595,16 +595,16 @@ discard block |
||
595 | 595 | */ |
596 | 596 | public function getCurrentEntry() { |
597 | 597 | |
598 | - if( in_array( $this->getContext(), array( 'edit', 'single') ) ) { |
|
598 | + if ( in_array( $this->getContext(), array( 'edit', 'single' ) ) ) { |
|
599 | 599 | $entries = $this->getEntries(); |
600 | - $entry = $entries[0]; |
|
600 | + $entry = $entries[ 0 ]; |
|
601 | 601 | } else { |
602 | 602 | $entry = $this->_current_entry; |
603 | 603 | } |
604 | 604 | |
605 | 605 | /** @since 1.16 Fixes DataTables empty entry issue */ |
606 | - if ( empty( $entry ) && ! empty( $this->_current_field['entry'] ) ) { |
|
607 | - $entry = $this->_current_field['entry']; |
|
606 | + if ( empty( $entry ) && ! empty( $this->_current_field[ 'entry' ] ) ) { |
|
607 | + $entry = $this->_current_field[ 'entry' ]; |
|
608 | 608 | } |
609 | 609 | |
610 | 610 | return $entry; |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | public function renderZone( $zone = '', $atts = array(), $echo = true ) { |
645 | 645 | |
646 | 646 | if ( empty( $zone ) ) { |
647 | - gravityview()->log->error( 'No zone defined.'); |
|
647 | + gravityview()->log->error( 'No zone defined.' ); |
|
648 | 648 | return NULL; |
649 | 649 | } |
650 | 650 | |
@@ -653,16 +653,16 @@ discard block |
||
653 | 653 | 'context' => $this->getContext(), |
654 | 654 | 'entry' => $this->getCurrentEntry(), |
655 | 655 | 'form' => $this->getForm(), |
656 | - 'hide_empty' => $this->getAtts('hide_empty'), |
|
656 | + 'hide_empty' => $this->getAtts( 'hide_empty' ), |
|
657 | 657 | ); |
658 | 658 | |
659 | 659 | $final_atts = wp_parse_args( $atts, $defaults ); |
660 | 660 | |
661 | 661 | $output = ''; |
662 | 662 | |
663 | - $final_atts['zone_id'] = "{$final_atts['context']}_{$final_atts['slug']}-{$zone}"; |
|
663 | + $final_atts[ 'zone_id' ] = "{$final_atts[ 'context' ]}_{$final_atts[ 'slug' ]}-{$zone}"; |
|
664 | 664 | |
665 | - $fields = $this->getField( $final_atts['zone_id'] ); |
|
665 | + $fields = $this->getField( $final_atts[ 'zone_id' ] ); |
|
666 | 666 | |
667 | 667 | // Backward compatibility |
668 | 668 | if ( 'table' === $this->getTemplatePartSlug() ) { |
@@ -672,19 +672,19 @@ discard block |
||
672 | 672 | * @param \GravityView_View $this |
673 | 673 | * @deprecated Use `gravityview/template/table/fields` |
674 | 674 | */ |
675 | - $fields = apply_filters("gravityview_table_cells", $fields, $this ); |
|
675 | + $fields = apply_filters( "gravityview_table_cells", $fields, $this ); |
|
676 | 676 | } |
677 | 677 | |
678 | 678 | if ( empty( $fields ) ) { |
679 | 679 | |
680 | - gravityview()->log->error( 'Empty zone configuration for {zone_id}.', array( 'zone_id' => $final_atts['zone_id'] ) ); |
|
680 | + gravityview()->log->error( 'Empty zone configuration for {zone_id}.', array( 'zone_id' => $final_atts[ 'zone_id' ] ) ); |
|
681 | 681 | |
682 | 682 | return NULL; |
683 | 683 | } |
684 | 684 | |
685 | 685 | $field_output = ''; |
686 | 686 | foreach ( $fields as $field ) { |
687 | - $final_atts['field'] = $field; |
|
687 | + $final_atts[ 'field' ] = $field; |
|
688 | 688 | |
689 | 689 | $field_output .= gravityview_field_output( $final_atts ); |
690 | 690 | } |
@@ -701,17 +701,17 @@ discard block |
||
701 | 701 | return NULL; |
702 | 702 | } |
703 | 703 | |
704 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
705 | - $output .= '<div class="'.gravityview_sanitize_html_class( $final_atts['wrapper_class'] ).'">'; |
|
704 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
705 | + $output .= '<div class="' . gravityview_sanitize_html_class( $final_atts[ 'wrapper_class' ] ) . '">'; |
|
706 | 706 | } |
707 | 707 | |
708 | 708 | $output .= $field_output; |
709 | 709 | |
710 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
710 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
711 | 711 | $output .= '</div>'; |
712 | 712 | } |
713 | 713 | |
714 | - if( $echo ) { |
|
714 | + if ( $echo ) { |
|
715 | 715 | echo $output; |
716 | 716 | } |
717 | 717 | |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | */ |
730 | 730 | function locate_template( $template_names, $load = false, $require_once = true ) { |
731 | 731 | |
732 | - if( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
732 | + if ( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
733 | 733 | |
734 | 734 | $located = $this->located_templates[ $template_names ]; |
735 | 735 | |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | // Set $load to always false so we handle it here. |
739 | 739 | $located = parent::locate_template( $template_names, false, $require_once ); |
740 | 740 | |
741 | - if( is_string( $template_names ) ) { |
|
741 | + if ( is_string( $template_names ) ) { |
|
742 | 742 | $this->located_templates[ $template_names ] = $located; |
743 | 743 | } |
744 | 744 | } |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | * @return mixed|null The stored data. |
757 | 757 | */ |
758 | 758 | public function __get( $name ) { |
759 | - if( isset( $this->{$name} ) ) { |
|
759 | + if ( isset( $this->{$name} ) ) { |
|
760 | 760 | return $this->{$name}; |
761 | 761 | } else { |
762 | 762 | return NULL; |
@@ -785,17 +785,17 @@ discard block |
||
785 | 785 | $additional = array(); |
786 | 786 | |
787 | 787 | // form-19-table-body.php |
788 | - $additional[] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
788 | + $additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
789 | 789 | |
790 | - if( $view_id = $this->getViewId() ) { |
|
790 | + if ( $view_id = $this->getViewId() ) { |
|
791 | 791 | // view-3-table-body.php |
792 | - $additional[] = sprintf( 'view-%d-%s-%s.php', $view_id, $slug, $name ); |
|
792 | + $additional[ ] = sprintf( 'view-%d-%s-%s.php', $view_id, $slug, $name ); |
|
793 | 793 | } |
794 | 794 | |
795 | - if( $this->getPostId() ) { |
|
795 | + if ( $this->getPostId() ) { |
|
796 | 796 | |
797 | 797 | // page-19-table-body.php |
798 | - $additional[] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
798 | + $additional[ ] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
799 | 799 | } |
800 | 800 | |
801 | 801 | // Combine with existing table-body.php and table.php |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | |
818 | 818 | gravityview()->log->debug( 'Rendering Template File: {path}', array( 'path' => $template_file ) ); |
819 | 819 | |
820 | - if( !empty( $template_file) ) { |
|
820 | + if ( ! empty( $template_file ) ) { |
|
821 | 821 | |
822 | 822 | if ( $require_once ) { |
823 | 823 | require_once( $template_file ); |
@@ -892,7 +892,7 @@ discard block |
||
892 | 892 | |
893 | 893 | // Prevent being called twice |
894 | 894 | if ( did_action( "gravityview/widgets/$zone/{$view->ID}/rendered" ) ) { |
895 | - gravityview()->log->debug( 'Not rendering {zone}; already rendered', array( 'zone' => $zone.'_'.$view->ID.'_widgets' ) ); |
|
895 | + gravityview()->log->debug( 'Not rendering {zone}; already rendered', array( 'zone' => $zone . '_' . $view->ID . '_widgets' ) ); |
|
896 | 896 | return; |
897 | 897 | } |
898 | 898 | |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | * @param string $zone Current widget zone, either `header` or `footer` |
915 | 915 | * @param array $widgets Array of widget configurations for the current zone, as set by `gravityview_get_current_view_data()['widgets']` |
916 | 916 | */ |
917 | - $css_class = apply_filters('gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets->as_configuration() ); |
|
917 | + $css_class = apply_filters( 'gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets->as_configuration() ); |
|
918 | 918 | |
919 | 919 | $css_class = gravityview_sanitize_html_class( $css_class ); |
920 | 920 | |
@@ -922,15 +922,15 @@ discard block |
||
922 | 922 | ?> |
923 | 923 | <div class="<?php echo $css_class; ?>"> |
924 | 924 | <?php |
925 | - foreach( $rows as $row ) { |
|
926 | - foreach( $row as $col => $areas ) { |
|
925 | + foreach ( $rows as $row ) { |
|
926 | + foreach ( $row as $col => $areas ) { |
|
927 | 927 | $column = ( $col == '2-2' ) ? '1-2 gv-right' : "$col gv-left"; |
928 | 928 | ?> |
929 | 929 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
930 | 930 | <?php |
931 | 931 | if ( ! empty( $areas ) ) { |
932 | 932 | foreach ( $areas as $area ) { |
933 | - foreach ( $widgets->by_position( $zone . '_' . $area['areaid'] )->all() as $widget ) { |
|
933 | + foreach ( $widgets->by_position( $zone . '_' . $area[ 'areaid' ] )->all() as $widget ) { |
|
934 | 934 | do_action( sprintf( 'gravityview/widgets/%s/render', $widget->get_widget_id() ), $widget->configuration->all(), null, $view_id_or_context ); |
935 | 935 | } |
936 | 936 | } |
@@ -28,18 +28,18 @@ |
||
28 | 28 | |
29 | 29 | $sort_fields_input = '<select name="template_settings[sort_field][]" class="gravityview_sort_field" id="gravityview_sort_field_%d">%s</select>'; |
30 | 30 | |
31 | - if ( is_array( $current_settings['sort_field'] ) ) { |
|
32 | - $primary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings['sort_field'][0] ); |
|
33 | - $secondary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings['sort_field'][1] ); |
|
31 | + if ( is_array( $current_settings[ 'sort_field' ] ) ) { |
|
32 | + $primary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings[ 'sort_field' ][ 0 ] ); |
|
33 | + $secondary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings[ 'sort_field' ][ 1 ] ); |
|
34 | 34 | } else { |
35 | - $primary_sort_fields = $secondary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings['sort_field'] ); |
|
35 | + $primary_sort_fields = $secondary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings[ 'sort_field' ] ); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | // Splice the sort direction |
39 | 39 | $_directions = array(); |
40 | 40 | foreach ( (array)\GV\Utils::get( $current_settings, 'sort_direction', array() ) as $i => $direction ) { |
41 | 41 | if ( ! $i ) { |
42 | - $_directions['sort_direction'] = $direction; |
|
42 | + $_directions[ 'sort_direction' ] = $direction; |
|
43 | 43 | } else { |
44 | 44 | $_directions[ sprintf( 'sort_direction_%d', $i + 1 ) ] = $direction; |
45 | 45 | } |
@@ -69,22 +69,22 @@ discard block |
||
69 | 69 | if ( is_array( $sorts ) ) { |
70 | 70 | foreach ( (array)$sorts as $key => $direction ) { |
71 | 71 | if ( $key == $context->field->ID ) { |
72 | - $sorting['key'] = $context->field->ID; |
|
73 | - $sorting['direction'] = strtolower( $direction ); |
|
72 | + $sorting[ 'key' ] = $context->field->ID; |
|
73 | + $sorting[ 'direction' ] = strtolower( $direction ); |
|
74 | 74 | break; |
75 | 75 | } |
76 | 76 | } |
77 | 77 | } else { |
78 | 78 | if ( $sorts == $context->field->ID ) { |
79 | - $sorting['key'] = $context->field->ID; |
|
80 | - $sorting['direction'] = strtolower( Utils::_GET( 'dir', '' ) ); |
|
79 | + $sorting[ 'key' ] = $context->field->ID; |
|
80 | + $sorting[ 'direction' ] = strtolower( Utils::_GET( 'dir', '' ) ); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | } else { |
84 | 84 | foreach ( (array)$context->view->settings->get( 'sort_field', array() ) as $i => $sort_field ) { |
85 | 85 | if ( $sort_field == $context->field->ID ) { |
86 | - $sorting['key'] = $sort_field; |
|
87 | - $sorting['direction'] = strtolower( Utils::get( $directions, $i, '' ) ); |
|
86 | + $sorting[ 'key' ] = $sort_field; |
|
87 | + $sorting[ 'direction' ] = strtolower( Utils::get( $directions, $i, '' ) ); |
|
88 | 88 | break; // Only get the first sort |
89 | 89 | } |
90 | 90 | } |
@@ -100,21 +100,21 @@ discard block |
||
100 | 100 | ); |
101 | 101 | |
102 | 102 | // If we are already sorting by the current field... |
103 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
103 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
104 | 104 | |
105 | - switch( $sorting['direction'] ) { |
|
105 | + switch ( $sorting[ 'direction' ] ) { |
|
106 | 106 | // No sort |
107 | 107 | case '': |
108 | - $sort_args[1] = 'asc'; |
|
108 | + $sort_args[ 1 ] = 'asc'; |
|
109 | 109 | $class .= ' gv-icon-caret-up-down'; |
110 | 110 | break; |
111 | 111 | case 'desc': |
112 | - $sort_args[1] = ''; |
|
112 | + $sort_args[ 1 ] = ''; |
|
113 | 113 | $class .= ' gv-icon-sort-asc'; |
114 | 114 | break; |
115 | 115 | case 'asc': |
116 | 116 | default: |
117 | - $sort_args[1] = 'desc'; |
|
117 | + $sort_args[ 1 ] = 'desc'; |
|
118 | 118 | $class .= ' gv-icon-sort-desc'; |
119 | 119 | break; |
120 | 120 | } |
@@ -127,15 +127,15 @@ discard block |
||
127 | 127 | $url = remove_query_arg( 'sort', $url ); |
128 | 128 | $multisort_url = self::_get_multisort_url( $url, $sort_args, $context->field->ID ); |
129 | 129 | |
130 | - $url = add_query_arg( $sort_args[0], $sort_args[1], $url ); |
|
130 | + $url = add_query_arg( $sort_args[ 0 ], $sort_args[ 1 ], $url ); |
|
131 | 131 | |
132 | - $return = '<a href="'. esc_url_raw( $url ) .'"'; |
|
132 | + $return = '<a href="' . esc_url_raw( $url ) . '"'; |
|
133 | 133 | |
134 | 134 | if ( ! empty( $multisort_url ) ) { |
135 | - $return .= ' data-multisort-href="'. esc_url_raw( $multisort_url ) . '"'; |
|
135 | + $return .= ' data-multisort-href="' . esc_url_raw( $multisort_url ) . '"'; |
|
136 | 136 | } |
137 | 137 | |
138 | - $return .= ' class="'. $class .'" ></a> '. $column_label; |
|
138 | + $return .= ' class="' . $class . '" ></a> ' . $column_label; |
|
139 | 139 | |
140 | 140 | return $return; |
141 | 141 | } |
@@ -168,19 +168,19 @@ discard block |
||
168 | 168 | if ( ! in_array( $field_id, $keys = array_keys( $sorts ) ) ) { |
169 | 169 | if ( count( $keys ) ) { |
170 | 170 | $multisort_url = add_query_arg( sprintf( 'sort[%s]', end( $keys ) ), $sorts[ end( $keys ) ], $multisort_url ); |
171 | - $multisort_url = add_query_arg( $sort_args[0], $sort_args[1], $multisort_url ); |
|
171 | + $multisort_url = add_query_arg( $sort_args[ 0 ], $sort_args[ 1 ], $multisort_url ); |
|
172 | 172 | } else { |
173 | - $multisort_url = add_query_arg( $sort_args[0], $sort_args[1], $multisort_url ); |
|
173 | + $multisort_url = add_query_arg( $sort_args[ 0 ], $sort_args[ 1 ], $multisort_url ); |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 | // Otherwise, we are just updating the sort order |
177 | 177 | else { |
178 | 178 | |
179 | 179 | // Pass empty value to unset |
180 | - if( '' === $sort_args[1] ) { |
|
180 | + if ( '' === $sort_args[ 1 ] ) { |
|
181 | 181 | unset( $sorts[ $field_id ] ); |
182 | 182 | } else { |
183 | - $sorts[ $field_id ] = $sort_args[1]; |
|
183 | + $sorts[ $field_id ] = $sort_args[ 1 ]; |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | $multisort_url = add_query_arg( array( 'sort' => $sorts ), $multisort_url ); |
@@ -318,9 +318,9 @@ discard block |
||
318 | 318 | do_action( 'gravityview_table_cells_before', \GravityView_View::getInstance() ); |
319 | 319 | |
320 | 320 | foreach ( $fields->all() as $field ) { |
321 | - if ( isset( $this->view->unions[ $entry['form_id'] ] ) ) { |
|
322 | - if ( isset( $this->view->unions[ $entry['form_id'] ][ $field->ID ] ) ) { |
|
323 | - $field = $this->view->unions[ $entry['form_id'] ][ $field->ID ]; |
|
321 | + if ( isset( $this->view->unions[ $entry[ 'form_id' ] ] ) ) { |
|
322 | + if ( isset( $this->view->unions[ $entry[ 'form_id' ] ][ $field->ID ] ) ) { |
|
323 | + $field = $this->view->unions[ $entry[ 'form_id' ] ][ $field->ID ]; |
|
324 | 324 | } else { |
325 | 325 | if ( ! $field instanceof Internal_Field ) { |
326 | 326 | $field = Internal_Field::from_configuration( array( 'id' => 'custom' ) ); |
@@ -104,11 +104,11 @@ discard block |
||
104 | 104 | |
105 | 105 | /** Call all lazy callbacks. */ |
106 | 106 | foreach ( $this->callbacks as $callback ) { |
107 | - if ( $callback[0] != 'count' ) { |
|
107 | + if ( $callback[ 0 ] != 'count' ) { |
|
108 | 108 | continue; |
109 | 109 | } |
110 | 110 | |
111 | - $total += $callback[1]( $this->filters ); |
|
111 | + $total += $callback[ 1 ]( $this->filters ); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | if ( ! $total ) { |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | foreach ( $this->all() as $entry ) { |
150 | 150 | $entry = $entry->as_entry(); |
151 | - $result[] = Utils::get( $entry, $key, null ); |
|
151 | + $result[ ] = Utils::get( $entry, $key, null ); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | return $result; |
@@ -206,11 +206,11 @@ discard block |
||
206 | 206 | |
207 | 207 | /** Call all lazy callbacks. */ |
208 | 208 | foreach ( $this->callbacks as $i => $callback ) { |
209 | - if ( $callback[0] != 'fetch' ) { |
|
209 | + if ( $callback[ 0 ] != 'fetch' ) { |
|
210 | 210 | continue; |
211 | 211 | } |
212 | 212 | |
213 | - $this->merge( $callback[1]( $this->filters, $this->sorts, $offset ) ); |
|
213 | + $this->merge( $callback[ 1 ]( $this->filters, $this->sorts, $offset ) ); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | $this->fetched = parent::count(); |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | return; |
367 | 367 | } |
368 | 368 | |
369 | - $this->callbacks []= array( $type, $callback ); |
|
369 | + $this->callbacks [ ] = array( $type, $callback ); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | /** |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | |
32 | 32 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
33 | 33 | |
34 | - if( 'edit' === $context ) { |
|
34 | + if ( 'edit' === $context ) { |
|
35 | 35 | return $field_options; |
36 | 36 | } |
37 | 37 | |
38 | - $this->add_field_support('date_display', $field_options ); |
|
38 | + $this->add_field_support( 'date_display', $field_options ); |
|
39 | 39 | |
40 | 40 | return $field_options; |
41 | 41 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $field_input_id = gravityview_get_input_id_from_id( $field_id ); |
84 | 84 | |
85 | 85 | $date_field_output = ''; |
86 | - switch( $field_input_id ) { |
|
86 | + switch ( $field_input_id ) { |
|
87 | 87 | case 1: |
88 | 88 | $date_field_output = \GV\Utils::get( $parsed_date, 'month' ); |
89 | 89 | break; |
@@ -24,13 +24,13 @@ |
||
24 | 24 | |
25 | 25 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
26 | 26 | |
27 | - unset( $field_options['show_as_link'] ); |
|
27 | + unset( $field_options[ 'show_as_link' ] ); |
|
28 | 28 | |
29 | - if( 'edit' === $context ) { |
|
29 | + if ( 'edit' === $context ) { |
|
30 | 30 | return $field_options; |
31 | 31 | } |
32 | 32 | |
33 | - $this->add_field_support('dynamic_data', $field_options ); |
|
33 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
34 | 34 | |
35 | 35 | return $field_options; |
36 | 36 | } |
@@ -28,13 +28,13 @@ |
||
28 | 28 | |
29 | 29 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
30 | 30 | |
31 | - if( 'edit' === $context ) { |
|
31 | + if ( 'edit' === $context ) { |
|
32 | 32 | return $field_options; |
33 | 33 | } |
34 | 34 | |
35 | - $this->add_field_support('link_to_post', $field_options ); |
|
35 | + $this->add_field_support( 'link_to_post', $field_options ); |
|
36 | 36 | |
37 | - $this->add_field_support('dynamic_data', $field_options ); |
|
37 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
38 | 38 | |
39 | 39 | return $field_options; |
40 | 40 | } |