@@ -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 | |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | 'atts' => NULL, |
165 | 165 | ) ); |
166 | 166 | |
167 | - foreach ($atts as $key => $value) { |
|
168 | - if( is_null( $value ) ) { |
|
167 | + foreach ( $atts as $key => $value ) { |
|
168 | + if ( is_null( $value ) ) { |
|
169 | 169 | continue; |
170 | 170 | } |
171 | 171 | $this->{$key} = $value; |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | */ |
195 | 195 | static function getInstance( $passed_post = NULL ) { |
196 | 196 | |
197 | - if( empty( self::$instance ) ) { |
|
197 | + if ( empty( self::$instance ) ) { |
|
198 | 198 | self::$instance = new self( $passed_post ); |
199 | 199 | } |
200 | 200 | |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public function getCurrentField( $key = NULL ) { |
209 | 209 | |
210 | - if( !empty( $key ) ) { |
|
211 | - if( isset( $this->_current_field[ $key ] ) ) { |
|
210 | + if ( ! empty( $key ) ) { |
|
211 | + if ( isset( $this->_current_field[ $key ] ) ) { |
|
212 | 212 | return $this->_current_field[ $key ]; |
213 | 213 | } |
214 | 214 | return NULL; |
@@ -219,16 +219,16 @@ discard block |
||
219 | 219 | |
220 | 220 | public function setCurrentFieldSetting( $key, $value ) { |
221 | 221 | |
222 | - if( !empty( $this->_current_field ) ) { |
|
223 | - $this->_current_field['field_settings'][ $key ] = $value; |
|
222 | + if ( ! empty( $this->_current_field ) ) { |
|
223 | + $this->_current_field[ 'field_settings' ][ $key ] = $value; |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | } |
227 | 227 | |
228 | 228 | public function getCurrentFieldSetting( $key ) { |
229 | - $settings = $this->getCurrentField('field_settings'); |
|
229 | + $settings = $this->getCurrentField( 'field_settings' ); |
|
230 | 230 | |
231 | - if( $settings && !empty( $settings[ $key ] ) ) { |
|
231 | + if ( $settings && ! empty( $settings[ $key ] ) ) { |
|
232 | 232 | return $settings[ $key ]; |
233 | 233 | } |
234 | 234 | |
@@ -259,8 +259,8 @@ discard block |
||
259 | 259 | */ |
260 | 260 | public function getAtts( $key = NULL ) { |
261 | 261 | |
262 | - if( !empty( $key ) ) { |
|
263 | - if( isset( $this->atts[ $key ] ) ) { |
|
262 | + if ( ! empty( $key ) ) { |
|
263 | + if ( isset( $this->atts[ $key ] ) ) { |
|
264 | 264 | return $this->atts[ $key ]; |
265 | 265 | } |
266 | 266 | return NULL; |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | |
327 | 327 | $fields = empty( $this->fields ) ? NULL : $this->fields; |
328 | 328 | |
329 | - if( $fields && !empty( $key ) ) { |
|
329 | + if ( $fields && ! empty( $key ) ) { |
|
330 | 330 | $fields = isset( $fields[ $key ] ) ? $fields[ $key ] : NULL; |
331 | 331 | } |
332 | 332 | |
@@ -344,18 +344,18 @@ discard block |
||
344 | 344 | */ |
345 | 345 | public function getContextFields( $context = '' ) { |
346 | 346 | |
347 | - if( '' === $context ) { |
|
347 | + if ( '' === $context ) { |
|
348 | 348 | $context = $this->getContext(); |
349 | 349 | } |
350 | 350 | |
351 | 351 | $fields = $this->getFields(); |
352 | 352 | |
353 | - foreach ( (array) $fields as $key => $context_fields ) { |
|
353 | + foreach ( (array)$fields as $key => $context_fields ) { |
|
354 | 354 | |
355 | 355 | // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against |
356 | 356 | $matches = explode( '_', $key ); |
357 | 357 | |
358 | - if( isset( $matches[0] ) && $matches[0] === $context ) { |
|
358 | + if ( isset( $matches[ 0 ] ) && $matches[ 0 ] === $context ) { |
|
359 | 359 | return $context_fields; |
360 | 360 | } |
361 | 361 | } |
@@ -376,8 +376,8 @@ discard block |
||
376 | 376 | */ |
377 | 377 | public function getField( $key ) { |
378 | 378 | |
379 | - if( !empty( $key ) ) { |
|
380 | - if( isset( $this->fields[ $key ] ) ) { |
|
379 | + if ( ! empty( $key ) ) { |
|
380 | + if ( isset( $this->fields[ $key ] ) ) { |
|
381 | 381 | return $this->fields[ $key ]; |
382 | 382 | } |
383 | 383 | } |
@@ -483,8 +483,8 @@ discard block |
||
483 | 483 | public function getPaginationCounts() { |
484 | 484 | |
485 | 485 | $paging = $this->getPaging(); |
486 | - $offset = $paging['offset']; |
|
487 | - $page_size = $paging['page_size']; |
|
486 | + $offset = $paging[ 'offset' ]; |
|
487 | + $page_size = $paging[ 'page_size' ]; |
|
488 | 488 | $total = $this->getTotalEntries(); |
489 | 489 | |
490 | 490 | if ( empty( $total ) ) { |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | */ |
506 | 506 | list( $first, $last, $total ) = apply_filters( 'gravityview_pagination_counts', array( $first, $last, $total ) ); |
507 | 507 | |
508 | - return array( 'first' => (int) $first, 'last' => (int) $last, 'total' => (int) $total ); |
|
508 | + return array( 'first' => (int)$first, 'last' => (int)$last, 'total' => (int)$total ); |
|
509 | 509 | } |
510 | 510 | |
511 | 511 | /** |
@@ -601,16 +601,16 @@ discard block |
||
601 | 601 | */ |
602 | 602 | public function getCurrentEntry() { |
603 | 603 | |
604 | - if( in_array( $this->getContext(), array( 'edit', 'single') ) ) { |
|
604 | + if ( in_array( $this->getContext(), array( 'edit', 'single' ) ) ) { |
|
605 | 605 | $entries = $this->getEntries(); |
606 | - $entry = $entries[0]; |
|
606 | + $entry = $entries[ 0 ]; |
|
607 | 607 | } else { |
608 | 608 | $entry = $this->_current_entry; |
609 | 609 | } |
610 | 610 | |
611 | 611 | /** @since 1.16 Fixes DataTables empty entry issue */ |
612 | - if ( empty( $entry ) && ! empty( $this->_current_field['entry'] ) ) { |
|
613 | - $entry = $this->_current_field['entry']; |
|
612 | + if ( empty( $entry ) && ! empty( $this->_current_field[ 'entry' ] ) ) { |
|
613 | + $entry = $this->_current_field[ 'entry' ]; |
|
614 | 614 | } |
615 | 615 | |
616 | 616 | return $entry; |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | public function renderZone( $zone = '', $atts = array(), $echo = true ) { |
651 | 651 | |
652 | 652 | if ( empty( $zone ) ) { |
653 | - gravityview()->log->error( 'No zone defined.'); |
|
653 | + gravityview()->log->error( 'No zone defined.' ); |
|
654 | 654 | return NULL; |
655 | 655 | } |
656 | 656 | |
@@ -659,16 +659,16 @@ discard block |
||
659 | 659 | 'context' => $this->getContext(), |
660 | 660 | 'entry' => $this->getCurrentEntry(), |
661 | 661 | 'form' => $this->getForm(), |
662 | - 'hide_empty' => $this->getAtts('hide_empty'), |
|
662 | + 'hide_empty' => $this->getAtts( 'hide_empty' ), |
|
663 | 663 | ); |
664 | 664 | |
665 | 665 | $final_atts = wp_parse_args( $atts, $defaults ); |
666 | 666 | |
667 | 667 | $output = ''; |
668 | 668 | |
669 | - $final_atts['zone_id'] = "{$final_atts['context']}_{$final_atts['slug']}-{$zone}"; |
|
669 | + $final_atts[ 'zone_id' ] = "{$final_atts[ 'context' ]}_{$final_atts[ 'slug' ]}-{$zone}"; |
|
670 | 670 | |
671 | - $fields = $this->getField( $final_atts['zone_id'] ); |
|
671 | + $fields = $this->getField( $final_atts[ 'zone_id' ] ); |
|
672 | 672 | |
673 | 673 | // Backward compatibility |
674 | 674 | if ( 'table' === $this->getTemplatePartSlug() ) { |
@@ -678,19 +678,19 @@ discard block |
||
678 | 678 | * @param \GravityView_View $this |
679 | 679 | * @deprecated Use `gravityview/template/table/fields` |
680 | 680 | */ |
681 | - $fields = apply_filters("gravityview_table_cells", $fields, $this ); |
|
681 | + $fields = apply_filters( "gravityview_table_cells", $fields, $this ); |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | if ( empty( $fields ) ) { |
685 | 685 | |
686 | - gravityview()->log->warning( 'Empty zone configuration for {zone_id}.', array( 'zone_id' => $final_atts['zone_id'] ) ); |
|
686 | + gravityview()->log->warning( 'Empty zone configuration for {zone_id}.', array( 'zone_id' => $final_atts[ 'zone_id' ] ) ); |
|
687 | 687 | |
688 | 688 | return NULL; |
689 | 689 | } |
690 | 690 | |
691 | 691 | $field_output = ''; |
692 | 692 | foreach ( $fields as $field ) { |
693 | - $final_atts['field'] = $field; |
|
693 | + $final_atts[ 'field' ] = $field; |
|
694 | 694 | |
695 | 695 | $field_output .= gravityview_field_output( $final_atts ); |
696 | 696 | } |
@@ -707,17 +707,17 @@ discard block |
||
707 | 707 | return NULL; |
708 | 708 | } |
709 | 709 | |
710 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
711 | - $output .= '<div class="'.gravityview_sanitize_html_class( $final_atts['wrapper_class'] ).'">'; |
|
710 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
711 | + $output .= '<div class="' . gravityview_sanitize_html_class( $final_atts[ 'wrapper_class' ] ) . '">'; |
|
712 | 712 | } |
713 | 713 | |
714 | 714 | $output .= $field_output; |
715 | 715 | |
716 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
716 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
717 | 717 | $output .= '</div>'; |
718 | 718 | } |
719 | 719 | |
720 | - if( $echo ) { |
|
720 | + if ( $echo ) { |
|
721 | 721 | echo $output; |
722 | 722 | } |
723 | 723 | |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | */ |
736 | 736 | function locate_template( $template_names, $load = false, $require_once = true ) { |
737 | 737 | |
738 | - if( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
738 | + if ( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
739 | 739 | |
740 | 740 | $located = $this->located_templates[ $template_names ]; |
741 | 741 | |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | // Set $load to always false so we handle it here. |
745 | 745 | $located = parent::locate_template( $template_names, false, $require_once ); |
746 | 746 | |
747 | - if( is_string( $template_names ) ) { |
|
747 | + if ( is_string( $template_names ) ) { |
|
748 | 748 | $this->located_templates[ $template_names ] = $located; |
749 | 749 | } |
750 | 750 | } |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | * @return mixed|null The stored data. |
763 | 763 | */ |
764 | 764 | public function __get( $name ) { |
765 | - if( isset( $this->{$name} ) ) { |
|
765 | + if ( isset( $this->{$name} ) ) { |
|
766 | 766 | return $this->{$name}; |
767 | 767 | } else { |
768 | 768 | return NULL; |
@@ -791,17 +791,17 @@ discard block |
||
791 | 791 | $additional = array(); |
792 | 792 | |
793 | 793 | // form-19-table-body.php |
794 | - $additional[] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
794 | + $additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
795 | 795 | |
796 | - if( $view_id = $this->getViewId() ) { |
|
796 | + if ( $view_id = $this->getViewId() ) { |
|
797 | 797 | // view-3-table-body.php |
798 | - $additional[] = sprintf( 'view-%d-%s-%s.php', $view_id, $slug, $name ); |
|
798 | + $additional[ ] = sprintf( 'view-%d-%s-%s.php', $view_id, $slug, $name ); |
|
799 | 799 | } |
800 | 800 | |
801 | - if( $this->getPostId() ) { |
|
801 | + if ( $this->getPostId() ) { |
|
802 | 802 | |
803 | 803 | // page-19-table-body.php |
804 | - $additional[] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
804 | + $additional[ ] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
805 | 805 | } |
806 | 806 | |
807 | 807 | // Combine with existing table-body.php and table.php |
@@ -823,7 +823,7 @@ discard block |
||
823 | 823 | |
824 | 824 | gravityview()->log->debug( 'Rendering Template File: {path}', array( 'path' => $template_file ) ); |
825 | 825 | |
826 | - if( !empty( $template_file) ) { |
|
826 | + if ( ! empty( $template_file ) ) { |
|
827 | 827 | |
828 | 828 | if ( $require_once ) { |
829 | 829 | require_once( $template_file ); |
@@ -898,7 +898,7 @@ discard block |
||
898 | 898 | |
899 | 899 | // Prevent being called twice |
900 | 900 | if ( did_action( "gravityview/widgets/$zone/{$view->ID}/rendered" ) ) { |
901 | - gravityview()->log->debug( 'Not rendering {zone}; already rendered', array( 'zone' => $zone.'_'.$view->ID.'_widgets' ) ); |
|
901 | + gravityview()->log->debug( 'Not rendering {zone}; already rendered', array( 'zone' => $zone . '_' . $view->ID . '_widgets' ) ); |
|
902 | 902 | return; |
903 | 903 | } |
904 | 904 | |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | $default_css_class .= ' gv-widgets-no-results'; |
914 | 914 | } |
915 | 915 | |
916 | - if ( ! $total_entries && ! gravityview()->request->is_search() && 3 === (int) $view->settings->get( 'no_entries_options', '0' ) ) { |
|
916 | + if ( ! $total_entries && ! gravityview()->request->is_search() && 3 === (int)$view->settings->get( 'no_entries_options', '0' ) ) { |
|
917 | 917 | $default_css_class .= ' gv-hidden'; |
918 | 918 | } |
919 | 919 | |
@@ -924,7 +924,7 @@ discard block |
||
924 | 924 | * @param string $zone Current widget zone, either `header` or `footer` |
925 | 925 | * @param array $widgets Array of widget configurations for the current zone, as set by `gravityview_get_current_view_data()['widgets']` |
926 | 926 | */ |
927 | - $css_class = apply_filters('gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets->as_configuration() ); |
|
927 | + $css_class = apply_filters( 'gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets->as_configuration() ); |
|
928 | 928 | |
929 | 929 | $css_class = gravityview_sanitize_html_class( $css_class ); |
930 | 930 | |
@@ -932,15 +932,15 @@ discard block |
||
932 | 932 | ?> |
933 | 933 | <div class="<?php echo $css_class; ?>"> |
934 | 934 | <?php |
935 | - foreach( $rows as $row ) { |
|
936 | - foreach( $row as $col => $areas ) { |
|
935 | + foreach ( $rows as $row ) { |
|
936 | + foreach ( $row as $col => $areas ) { |
|
937 | 937 | $column = ( $col == '2-2' ) ? '1-2 gv-right' : "$col gv-left"; |
938 | 938 | ?> |
939 | 939 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
940 | 940 | <?php |
941 | 941 | if ( ! empty( $areas ) ) { |
942 | 942 | foreach ( $areas as $area ) { |
943 | - foreach ( $widgets->by_position( $zone . '_' . $area['areaid'] )->all() as $widget ) { |
|
943 | + foreach ( $widgets->by_position( $zone . '_' . $area[ 'areaid' ] )->all() as $widget ) { |
|
944 | 944 | do_action( sprintf( 'gravityview/widgets/%s/render', $widget->get_widget_id() ), $widget->configuration->all(), null, $view_id_or_context ); |
945 | 945 | } |
946 | 946 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | $powered_by = gravityview()->plugin->settings->get_gravitykit_setting( 'powered_by', 0 ); |
36 | 36 | |
37 | - if( empty( $powered_by ) ) { |
|
37 | + if ( empty( $powered_by ) ) { |
|
38 | 38 | return; |
39 | 39 | } |
40 | 40 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | $css_class = 'gv-powered-by'; |
49 | 49 | |
50 | - if ( ! $context->request->is_search() && 0 === $context->entries->count() && 3 === (int) $context->view->settings->get( 'no_entries_options', '0' ) ) { |
|
50 | + if ( ! $context->request->is_search() && 0 === $context->entries->count() && 3 === (int)$context->view->settings->get( 'no_entries_options', '0' ) ) { |
|
51 | 51 | $css_class .= ' gv-hidden'; |
52 | 52 | } |
53 | 53 | |
@@ -67,17 +67,17 @@ discard block |
||
67 | 67 | */ |
68 | 68 | protected function get_url() { |
69 | 69 | |
70 | - $url = sprintf( self::url, get_bloginfo('name' ) ); |
|
70 | + $url = sprintf( self::url, get_bloginfo( 'name' ) ); |
|
71 | 71 | |
72 | 72 | $affiliate_id = gravityview()->plugin->settings->get_gravitykit_setting( 'affiliate_id', '' ); |
73 | 73 | |
74 | - if( $affiliate_id && is_numeric( $affiliate_id ) ) { |
|
74 | + if ( $affiliate_id && is_numeric( $affiliate_id ) ) { |
|
75 | 75 | $url = add_query_arg( array( 'ref' => $affiliate_id ), $url ); |
76 | 76 | } |
77 | 77 | |
78 | 78 | $url = add_query_arg( array( |
79 | 79 | 'utm_source' => 'powered_by', |
80 | - 'utm_term' => get_bloginfo('name' ), |
|
80 | + 'utm_term' => get_bloginfo( 'name' ), |
|
81 | 81 | ), $url ); |
82 | 82 | |
83 | 83 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | $form = $gravityview_view->getForm(); |
32 | 32 | |
33 | - if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS['GravityView_API_field_label_override'] ) ) { |
|
33 | + if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS[ 'GravityView_API_field_label_override' ] ) ) { |
|
34 | 34 | /** Allow to fall through for back compatibility testing purposes. */ |
35 | 35 | } else { |
36 | 36 | return \GV\Mocks\GravityView_API_field_label( $form, $field, $entry, $force_show_label ); |
@@ -38,29 +38,29 @@ discard block |
||
38 | 38 | |
39 | 39 | $label = ''; |
40 | 40 | |
41 | - if( !empty( $field['show_label'] ) || $force_show_label ) { |
|
41 | + if ( ! empty( $field[ 'show_label' ] ) || $force_show_label ) { |
|
42 | 42 | |
43 | - $label = $field['label']; |
|
43 | + $label = $field[ 'label' ]; |
|
44 | 44 | |
45 | 45 | // Support Gravity Forms 1.9+ |
46 | - if( class_exists( 'GF_Field' ) ) { |
|
46 | + if ( class_exists( 'GF_Field' ) ) { |
|
47 | 47 | |
48 | - $field_object = RGFormsModel::get_field( $form, $field['id'] ); |
|
48 | + $field_object = RGFormsModel::get_field( $form, $field[ 'id' ] ); |
|
49 | 49 | |
50 | - if( $field_object ) { |
|
50 | + if ( $field_object ) { |
|
51 | 51 | |
52 | - $input = GFFormsModel::get_input( $field_object, $field['id'] ); |
|
52 | + $input = GFFormsModel::get_input( $field_object, $field[ 'id' ] ); |
|
53 | 53 | |
54 | 54 | // This is a complex field, with labels on a per-input basis |
55 | - if( $input ) { |
|
55 | + if ( $input ) { |
|
56 | 56 | |
57 | 57 | // Does the input have a custom label on a per-input basis? Otherwise, default label. |
58 | - $label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label']; |
|
58 | + $label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ]; |
|
59 | 59 | |
60 | 60 | } else { |
61 | 61 | |
62 | 62 | // This is a field with one label |
63 | - $label = $field_object->get_field_label( true, $field['label'] ); |
|
63 | + $label = $field_object->get_field_label( true, $field[ 'label' ] ); |
|
64 | 64 | |
65 | 65 | } |
66 | 66 | |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | // Use Gravity Forms label by default, but if a custom label is defined in GV, use it. |
72 | - if ( !empty( $field['custom_label'] ) ) { |
|
72 | + if ( ! empty( $field[ 'custom_label' ] ) ) { |
|
73 | 73 | |
74 | - $label = self::replace_variables( $field['custom_label'], $form, $entry ); |
|
74 | + $label = self::replace_variables( $field[ 'custom_label' ], $form, $entry ); |
|
75 | 75 | |
76 | 76 | } |
77 | 77 | |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | |
134 | 134 | $width = NULL; |
135 | 135 | |
136 | - if( !empty( $field['width'] ) ) { |
|
137 | - $width = absint( $field['width'] ); |
|
136 | + if ( ! empty( $field[ 'width' ] ) ) { |
|
137 | + $width = absint( $field[ 'width' ] ); |
|
138 | 138 | |
139 | 139 | // If using percentages, limit to 100% |
140 | - if( '%d%%' === $format && $width > 100 ) { |
|
140 | + if ( '%d%%' === $format && $width > 100 ) { |
|
141 | 141 | $width = 100; |
142 | 142 | } |
143 | 143 | |
@@ -157,42 +157,42 @@ discard block |
||
157 | 157 | public static function field_class( $field, $form = NULL, $entry = NULL ) { |
158 | 158 | $classes = array(); |
159 | 159 | |
160 | - if( !empty( $field['custom_class'] ) ) { |
|
160 | + if ( ! empty( $field[ 'custom_class' ] ) ) { |
|
161 | 161 | |
162 | - $custom_class = $field['custom_class']; |
|
162 | + $custom_class = $field[ 'custom_class' ]; |
|
163 | 163 | |
164 | - if( !empty( $entry ) ) { |
|
164 | + if ( ! empty( $entry ) ) { |
|
165 | 165 | |
166 | 166 | // We want the merge tag to be formatted as a class. The merge tag may be |
167 | 167 | // replaced by a multiple-word value that should be output as a single class. |
168 | 168 | // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
169 | - add_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
169 | + add_filter( 'gform_merge_tag_filter', 'sanitize_html_class' ); |
|
170 | 170 | |
171 | - $custom_class = self::replace_variables( $custom_class, $form, $entry); |
|
171 | + $custom_class = self::replace_variables( $custom_class, $form, $entry ); |
|
172 | 172 | |
173 | 173 | // And then we want life to return to normal |
174 | - remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
174 | + remove_filter( 'gform_merge_tag_filter', 'sanitize_html_class' ); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | // And now we want the spaces to be handled nicely. |
178 | - $classes[] = gravityview_sanitize_html_class( $custom_class ); |
|
178 | + $classes[ ] = gravityview_sanitize_html_class( $custom_class ); |
|
179 | 179 | |
180 | 180 | } |
181 | 181 | |
182 | - if(!empty($field['id'])) { |
|
183 | - if( !empty( $form ) && !empty( $form['id'] ) ) { |
|
184 | - $form_id = '-'.$form['id']; |
|
182 | + if ( ! empty( $field[ 'id' ] ) ) { |
|
183 | + if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) { |
|
184 | + $form_id = '-' . $form[ 'id' ]; |
|
185 | 185 | } else { |
186 | 186 | // @deprecated path. Form should always be given. |
187 | 187 | gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' ); |
188 | 188 | $gravityview_view = GravityView_View::getInstance(); |
189 | - $form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : ''; |
|
189 | + $form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : ''; |
|
190 | 190 | } |
191 | 191 | |
192 | - $classes[] = 'gv-field'.$form_id.'-'.$field['id']; |
|
192 | + $classes[ ] = 'gv-field' . $form_id . '-' . $field[ 'id' ]; |
|
193 | 193 | } |
194 | 194 | |
195 | - return esc_attr(implode(' ', $classes)); |
|
195 | + return esc_attr( implode( ' ', $classes ) ); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -207,11 +207,11 @@ discard block |
||
207 | 207 | * @return string Sanitized unique HTML `id` attribute for the field |
208 | 208 | */ |
209 | 209 | public static function field_html_attr_id( $field, $form = array(), $entry = array() ) { |
210 | - $id = $field['id']; |
|
210 | + $id = $field[ 'id' ]; |
|
211 | 211 | |
212 | 212 | if ( ! empty( $id ) ) { |
213 | - if ( ! empty( $form ) && ! empty( $form['id'] ) ) { |
|
214 | - $form_id = '-' . $form['id']; |
|
213 | + if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) { |
|
214 | + $form_id = '-' . $form[ 'id' ]; |
|
215 | 215 | } else { |
216 | 216 | // @deprecated path. Form should always be given. |
217 | 217 | gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' ); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : ''; |
220 | 220 | } |
221 | 221 | |
222 | - $id = 'gv-field' . $form_id . '-' . $field['id']; |
|
222 | + $id = 'gv-field' . $form_id . '-' . $field[ 'id' ]; |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | return esc_attr( $id ); |
@@ -258,14 +258,14 @@ discard block |
||
258 | 258 | */ |
259 | 259 | public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array(), $base_id = null ) { |
260 | 260 | |
261 | - if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) { |
|
261 | + if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) { |
|
262 | 262 | gravityview()->log->debug( 'Entry not defined; returning null', array( 'data' => $entry ) ); |
263 | 263 | return NULL; |
264 | 264 | } |
265 | 265 | |
266 | 266 | $href = self::entry_link( $entry, $base_id ); |
267 | 267 | |
268 | - if( '' === $href ) { |
|
268 | + if ( '' === $href ) { |
|
269 | 269 | return NULL; |
270 | 270 | } |
271 | 271 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | } else { |
304 | 304 | $gravityview_view = GravityView_View::getInstance(); |
305 | 305 | |
306 | - if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
306 | + if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
307 | 307 | $is_search = true; |
308 | 308 | } |
309 | 309 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | |
315 | 315 | $output = esc_html__( 'This search returned no results.', 'gk-gravityview' ); |
316 | 316 | |
317 | - if( $context ) { |
|
317 | + if ( $context ) { |
|
318 | 318 | $setting = $context->view->settings->get( 'no_search_results_text', $output ); |
319 | 319 | } |
320 | 320 | |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | |
323 | 323 | $output = esc_html__( 'No entries match your request.', 'gk-gravityview' ); |
324 | 324 | |
325 | - if( $context ) { |
|
325 | + if ( $context ) { |
|
326 | 326 | $setting = $context->view->settings->get( 'no_results_text', $output ); |
327 | 327 | } |
328 | 328 | } |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | $link = $directory_links[ 'gv_directory_link_' . $post_id ]; |
461 | 461 | } |
462 | 462 | |
463 | - if ( (int) $post_id === (int) get_option( 'page_on_front' ) ) { |
|
463 | + if ( (int)$post_id === (int)get_option( 'page_on_front' ) ) { |
|
464 | 464 | $link = home_url(); |
465 | 465 | } |
466 | 466 | |
@@ -475,13 +475,13 @@ discard block |
||
475 | 475 | |
476 | 476 | $args = array(); |
477 | 477 | |
478 | - if( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) { |
|
479 | - $args['pagenum'] = intval( $pagenum ); |
|
478 | + if ( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) { |
|
479 | + $args[ 'pagenum' ] = intval( $pagenum ); |
|
480 | 480 | } |
481 | 481 | |
482 | - if( $sort = \GV\Utils::_GET( 'sort' ) ) { |
|
483 | - $args['sort'] = $sort; |
|
484 | - $args['dir'] = \GV\Utils::_GET( 'dir' ); |
|
482 | + if ( $sort = \GV\Utils::_GET( 'sort' ) ) { |
|
483 | + $args[ 'sort' ] = $sort; |
|
484 | + $args[ 'dir' ] = \GV\Utils::_GET( 'dir' ); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | $link = add_query_arg( $args, $link ); |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | private static function get_custom_entry_slug( $id, $entry = array() ) { |
519 | 519 | |
520 | 520 | // Generate an unique hash to use as the default value |
521 | - $slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 ); |
|
521 | + $slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 ); |
|
522 | 522 | |
523 | 523 | /** |
524 | 524 | * @filter `gravityview_entry_slug` Modify the unique hash ID generated, if you want to improve usability or change the format. This will allow for custom URLs, such as `{entryid}-{first-name}` or even, if unique, `{first-name}-{last-name}` |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | $slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry ); |
530 | 530 | |
531 | 531 | // Make sure we have something - use the original ID as backup. |
532 | - if( empty( $slug ) ) { |
|
532 | + if ( empty( $slug ) ) { |
|
533 | 533 | $slug = $id; |
534 | 534 | } |
535 | 535 | |
@@ -623,15 +623,15 @@ discard block |
||
623 | 623 | * @param boolean $custom Should we process the custom entry slug? |
624 | 624 | */ |
625 | 625 | $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
626 | - if( $custom ) { |
|
626 | + if ( $custom ) { |
|
627 | 627 | // create the gravityview_unique_id and save it |
628 | 628 | |
629 | 629 | // Get the entry hash |
630 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
630 | + $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry ); |
|
631 | 631 | |
632 | - gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) ); |
|
632 | + gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry[ 'id' ], 'hash' => $hash ) ); |
|
633 | 633 | |
634 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) ); |
|
634 | + gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) ); |
|
635 | 635 | |
636 | 636 | } |
637 | 637 | } |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | |
658 | 658 | if ( ! empty( $entry ) && ! is_array( $entry ) ) { |
659 | 659 | $entry = GVCommon::get_entry( $entry ); |
660 | - } else if( empty( $entry ) ) { |
|
660 | + } else if ( empty( $entry ) ) { |
|
661 | 661 | // @deprecated path |
662 | 662 | $entry = GravityView_frontend::getInstance()->getEntry(); |
663 | 663 | } |
@@ -677,32 +677,32 @@ discard block |
||
677 | 677 | |
678 | 678 | $query_arg_name = \GV\Entry::get_endpoint_name(); |
679 | 679 | |
680 | - if ( ! empty( $entry['_multi'] ) ) { |
|
680 | + if ( ! empty( $entry[ '_multi' ] ) ) { |
|
681 | 681 | $entry_slugs = array(); |
682 | 682 | |
683 | - foreach ( $entry['_multi'] as $_multi ) { |
|
683 | + foreach ( $entry[ '_multi' ] as $_multi ) { |
|
684 | 684 | |
685 | - if( $gv_multi = \GV\GF_Entry::from_entry( $_multi ) ) { |
|
686 | - $entry_slugs[] = $gv_multi->get_slug(); |
|
685 | + if ( $gv_multi = \GV\GF_Entry::from_entry( $_multi ) ) { |
|
686 | + $entry_slugs[ ] = $gv_multi->get_slug(); |
|
687 | 687 | } else { |
688 | 688 | // TODO: This path isn't covered by unit tests |
689 | - $entry_slugs[] = \GravityView_API::get_entry_slug( $_multi['id'], $_multi ); |
|
689 | + $entry_slugs[ ] = \GravityView_API::get_entry_slug( $_multi[ 'id' ], $_multi ); |
|
690 | 690 | } |
691 | 691 | |
692 | 692 | unset( $gv_multi ); |
693 | 693 | |
694 | - $forms[] = $_multi['form_id']; |
|
694 | + $forms[ ] = $_multi[ 'form_id' ]; |
|
695 | 695 | } |
696 | 696 | |
697 | 697 | $entry_slug = implode( ',', $entry_slugs ); |
698 | 698 | } else { |
699 | 699 | |
700 | 700 | // Fallback when |
701 | - if( $gv_entry = \GV\GF_Entry::from_entry( $entry ) ) { |
|
701 | + if ( $gv_entry = \GV\GF_Entry::from_entry( $entry ) ) { |
|
702 | 702 | $entry_slug = $gv_entry->get_slug(); |
703 | 703 | } else { |
704 | 704 | // TODO: This path isn't covered by unit tests |
705 | - $entry_slug = \GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
705 | + $entry_slug = \GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
706 | 706 | } |
707 | 707 | |
708 | 708 | unset( $gv_entry ); |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | $args = gv_get_query_args(); |
722 | 722 | } |
723 | 723 | |
724 | - if ( get_option('permalink_structure') && ! is_preview() ) { |
|
724 | + if ( get_option( 'permalink_structure' ) && ! is_preview() ) { |
|
725 | 725 | |
726 | 726 | /** |
727 | 727 | * Make sure the $directory_link doesn't contain any query otherwise it will break when adding the entry slug. |
@@ -729,13 +729,13 @@ discard block |
||
729 | 729 | */ |
730 | 730 | $link_parts = explode( '?', $directory_link ); |
731 | 731 | |
732 | - $query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : ''; |
|
732 | + $query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : ''; |
|
733 | 733 | |
734 | - $directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query; |
|
734 | + $directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query; |
|
735 | 735 | |
736 | 736 | } else { |
737 | 737 | |
738 | - $args[] = array( $query_arg_name => $entry_slug ); |
|
738 | + $args[ ] = array( $query_arg_name => $entry_slug ); |
|
739 | 739 | } |
740 | 740 | |
741 | 741 | /** |
@@ -743,21 +743,21 @@ discard block |
||
743 | 743 | */ |
744 | 744 | if ( $add_directory_args ) { |
745 | 745 | |
746 | - if ( ! empty( $_GET['pagenum'] ) ) { |
|
747 | - $args['pagenum'] = intval( $_GET['pagenum'] ); |
|
746 | + if ( ! empty( $_GET[ 'pagenum' ] ) ) { |
|
747 | + $args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] ); |
|
748 | 748 | } |
749 | 749 | |
750 | 750 | /** |
751 | 751 | * @since 1.7 |
752 | 752 | */ |
753 | 753 | if ( $sort = \GV\Utils::_GET( 'sort' ) ) { |
754 | - $args['sort'] = $sort; |
|
755 | - $args['dir'] = \GV\Utils::_GET( 'dir' ); |
|
754 | + $args[ 'sort' ] = $sort; |
|
755 | + $args[ 'dir' ] = \GV\Utils::_GET( 'dir' ); |
|
756 | 756 | } |
757 | 757 | |
758 | 758 | } |
759 | 759 | |
760 | - if( $post_id ) { |
|
760 | + if ( $post_id ) { |
|
761 | 761 | $passed_post = get_post( $post_id ); |
762 | 762 | $views = \GV\View_Collection::from_post( $passed_post ); |
763 | 763 | $has_multiple_views = $views->count() > 1; |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | } |
767 | 767 | |
768 | 768 | if ( $has_multiple_views ) { |
769 | - $args['gvid'] = $view_id ? $view_id : gravityview_get_view_id(); |
|
769 | + $args[ 'gvid' ] = $view_id ? $view_id : gravityview_get_view_id(); |
|
770 | 770 | } |
771 | 771 | |
772 | 772 | return add_query_arg( $args, $directory_link ); |
@@ -838,7 +838,7 @@ discard block |
||
838 | 838 | } |
839 | 839 | |
840 | 840 | function gv_class( $field, $form = NULL, $entry = array() ) { |
841 | - return GravityView_API::field_class( $field, $form, $entry ); |
|
841 | + return GravityView_API::field_class( $field, $form, $entry ); |
|
842 | 842 | } |
843 | 843 | |
844 | 844 | /** |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | $view_id = 0; |
862 | 862 | if ( $context->view ) { |
863 | 863 | $view_id = $context->view->ID; |
864 | - if( $context->view->settings->get( 'hide_until_searched' ) ) { |
|
864 | + if ( $context->view->settings->get( 'hide_until_searched' ) ) { |
|
865 | 865 | $hide = ( empty( $context->entry ) && ! $context->request->is_search() ); |
866 | 866 | } |
867 | 867 | } |
@@ -884,7 +884,7 @@ discard block |
||
884 | 884 | if ( 0 === $total_entries ) { |
885 | 885 | $default_css_class .= ' gv-container-no-results'; |
886 | 886 | |
887 | - if ( ! gravityview()->request->is_search() && 3 === (int) $context->view->settings->get( 'no_entries_options', '0' ) ) { |
|
887 | + if ( ! gravityview()->request->is_search() && 3 === (int)$context->view->settings->get( 'no_entries_options', '0' ) ) { |
|
888 | 888 | $hide = true; |
889 | 889 | } |
890 | 890 | } |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | $default_css_class .= ' ' . $context->view->settings->get( 'class', '' ); |
898 | 898 | } |
899 | 899 | |
900 | - $css_class = trim( $passed_css_class . ' '. $default_css_class ); |
|
900 | + $css_class = trim( $passed_css_class . ' ' . $default_css_class ); |
|
901 | 901 | |
902 | 902 | /** |
903 | 903 | * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View |
@@ -924,7 +924,7 @@ discard block |
||
924 | 924 | |
925 | 925 | $value = GravityView_API::field_value( $entry, $field ); |
926 | 926 | |
927 | - if( $value === '' ) { |
|
927 | + if ( $value === '' ) { |
|
928 | 928 | /** |
929 | 929 | * @filter `gravityview_empty_value` What to display when a field is empty |
930 | 930 | * @param string $value (empty string) |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | */ |
1038 | 1038 | function gravityview_get_field_value( $entry, $field_id, $display_value ) { |
1039 | 1039 | |
1040 | - if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
1040 | + if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
1041 | 1041 | |
1042 | 1042 | // For the complete field value as generated by Gravity Forms |
1043 | 1043 | return $display_value; |
@@ -1071,16 +1071,16 @@ discard block |
||
1071 | 1071 | $terms = explode( ', ', $value ); |
1072 | 1072 | } |
1073 | 1073 | |
1074 | - foreach ($terms as $term_name ) { |
|
1074 | + foreach ( $terms as $term_name ) { |
|
1075 | 1075 | |
1076 | 1076 | // If we're processing a category, |
1077 | - if( $taxonomy === 'category' ) { |
|
1077 | + if ( $taxonomy === 'category' ) { |
|
1078 | 1078 | |
1079 | 1079 | // Use rgexplode to prevent errors if : doesn't exist |
1080 | 1080 | list( $term_name, $term_id ) = rgexplode( ':', $term_name, 2 ); |
1081 | 1081 | |
1082 | 1082 | // The explode was succesful; we have the category ID |
1083 | - if( !empty( $term_id )) { |
|
1083 | + if ( ! empty( $term_id ) ) { |
|
1084 | 1084 | $term = get_term_by( 'id', $term_id, $taxonomy ); |
1085 | 1085 | } else { |
1086 | 1086 | // We have to fall back to the name |
@@ -1093,7 +1093,7 @@ discard block |
||
1093 | 1093 | } |
1094 | 1094 | |
1095 | 1095 | // There's still a tag/category here. |
1096 | - if( $term ) { |
|
1096 | + if ( $term ) { |
|
1097 | 1097 | |
1098 | 1098 | $term_link = get_term_link( $term, $taxonomy ); |
1099 | 1099 | |
@@ -1102,11 +1102,11 @@ discard block |
||
1102 | 1102 | continue; |
1103 | 1103 | } |
1104 | 1104 | |
1105 | - $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
1105 | + $output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
1106 | 1106 | } |
1107 | 1107 | } |
1108 | 1108 | |
1109 | - return implode(', ', $output ); |
|
1109 | + return implode( ', ', $output ); |
|
1110 | 1110 | } |
1111 | 1111 | |
1112 | 1112 | /** |
@@ -1120,8 +1120,8 @@ discard block |
||
1120 | 1120 | |
1121 | 1121 | $output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' ); |
1122 | 1122 | |
1123 | - if( empty( $link ) ) { |
|
1124 | - return strip_tags( $output); |
|
1123 | + if ( empty( $link ) ) { |
|
1124 | + return strip_tags( $output ); |
|
1125 | 1125 | } |
1126 | 1126 | |
1127 | 1127 | return $output; |
@@ -1140,7 +1140,7 @@ discard block |
||
1140 | 1140 | $fe = GravityView_frontend::getInstance(); |
1141 | 1141 | |
1142 | 1142 | // Solve problem when loading content via admin-ajax.php |
1143 | - if( ! $fe->getGvOutputData() ) { |
|
1143 | + if ( ! $fe->getGvOutputData() ) { |
|
1144 | 1144 | |
1145 | 1145 | gravityview()->log->debug( 'gv_output_data not defined; parsing content.' ); |
1146 | 1146 | |
@@ -1148,7 +1148,7 @@ discard block |
||
1148 | 1148 | } |
1149 | 1149 | |
1150 | 1150 | // Make 100% sure that we're dealing with a properly called situation |
1151 | - if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
1151 | + if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
1152 | 1152 | |
1153 | 1153 | gravityview()->log->debug( 'gv_output_data not an object or get_view not callable.', array( 'data' => $fe->getGvOutputData() ) ); |
1154 | 1154 | |
@@ -1380,12 +1380,12 @@ discard block |
||
1380 | 1380 | function gravityview_get_files_array( $value, $gv_class = '', $context = null ) { |
1381 | 1381 | /** @define "GRAVITYVIEW_DIR" "../" */ |
1382 | 1382 | |
1383 | - if( !class_exists( 'GravityView_Field' ) ) { |
|
1384 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' ); |
|
1383 | + if ( ! class_exists( 'GravityView_Field' ) ) { |
|
1384 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' ); |
|
1385 | 1385 | } |
1386 | 1386 | |
1387 | - if( !class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
1388 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field-fileupload.php' ); |
|
1387 | + if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
1388 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field-fileupload.php' ); |
|
1389 | 1389 | } |
1390 | 1390 | |
1391 | 1391 | if ( is_null( $context ) ) { |
@@ -1496,21 +1496,21 @@ discard block |
||
1496 | 1496 | } else { |
1497 | 1497 | // @deprecated path |
1498 | 1498 | // Required fields. |
1499 | - if ( empty( $args['field'] ) || empty( $args['form'] ) ) { |
|
1499 | + if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) { |
|
1500 | 1500 | gravityview()->log->error( 'Field or form are empty.', array( 'data' => $args ) ); |
1501 | 1501 | return ''; |
1502 | 1502 | } |
1503 | 1503 | } |
1504 | 1504 | |
1505 | 1505 | if ( $context instanceof \GV\Template_Context ) { |
1506 | - $entry = $args['entry'] ? : ( $context->entry ? $context->entry->as_entry() : array() ); |
|
1507 | - $field = $args['field'] ? : ( $context->field ? $context->field->as_configuration() : array() ); |
|
1508 | - $form = $args['form'] ? : ( $context->view->form ? $context->view->form->form : array() ); |
|
1506 | + $entry = $args[ 'entry' ] ?: ( $context->entry ? $context->entry->as_entry() : array() ); |
|
1507 | + $field = $args[ 'field' ] ?: ( $context->field ? $context->field->as_configuration() : array() ); |
|
1508 | + $form = $args[ 'form' ] ?: ( $context->view->form ? $context->view->form->form : array() ); |
|
1509 | 1509 | } else { |
1510 | 1510 | // @deprecated path |
1511 | - $entry = empty( $args['entry'] ) ? array() : $args['entry']; |
|
1512 | - $field = $args['field']; |
|
1513 | - $form = $args['form']; |
|
1511 | + $entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ]; |
|
1512 | + $field = $args[ 'field' ]; |
|
1513 | + $form = $args[ 'form' ]; |
|
1514 | 1514 | } |
1515 | 1515 | |
1516 | 1516 | /** |
@@ -1530,43 +1530,43 @@ discard block |
||
1530 | 1530 | ); |
1531 | 1531 | |
1532 | 1532 | if ( $context instanceof \GV\Template_Context ) { |
1533 | - $placeholders['value'] = \GV\Utils::get( $args, 'value', '' ); |
|
1533 | + $placeholders[ 'value' ] = \GV\Utils::get( $args, 'value', '' ); |
|
1534 | 1534 | } else { |
1535 | 1535 | // @deprecated path |
1536 | - $placeholders['value'] = gv_value( $entry, $field ); |
|
1536 | + $placeholders[ 'value' ] = gv_value( $entry, $field ); |
|
1537 | 1537 | } |
1538 | 1538 | |
1539 | 1539 | // If the value is empty and we're hiding empty, return empty. |
1540 | - if ( $placeholders['value'] === '' && ! empty( $args['hide_empty'] ) ) { |
|
1540 | + if ( $placeholders[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) { |
|
1541 | 1541 | return ''; |
1542 | 1542 | } |
1543 | 1543 | |
1544 | - if ( $placeholders['value'] !== '' && ! empty( $args['wpautop'] ) ) { |
|
1545 | - $placeholders['value'] = wpautop( $placeholders['value'] ); |
|
1544 | + if ( $placeholders[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) { |
|
1545 | + $placeholders[ 'value' ] = wpautop( $placeholders[ 'value' ] ); |
|
1546 | 1546 | } |
1547 | 1547 | |
1548 | 1548 | // Get width setting, if exists |
1549 | - $placeholders['width'] = GravityView_API::field_width( $field ); |
|
1549 | + $placeholders[ 'width' ] = GravityView_API::field_width( $field ); |
|
1550 | 1550 | |
1551 | 1551 | // If replacing with CSS inline formatting, let's do it. |
1552 | - $placeholders['width:style'] = (string) GravityView_API::field_width( $field, 'width:' . $placeholders['width'] . '%;' ); |
|
1552 | + $placeholders[ 'width:style' ] = (string)GravityView_API::field_width( $field, 'width:' . $placeholders[ 'width' ] . '%;' ); |
|
1553 | 1553 | |
1554 | 1554 | // Grab the Class using `gv_class` |
1555 | - $placeholders['class'] = gv_class( $field, $form, $entry ); |
|
1556 | - $placeholders['field_id'] = GravityView_API::field_html_attr_id( $field, $form, $entry ); |
|
1555 | + $placeholders[ 'class' ] = gv_class( $field, $form, $entry ); |
|
1556 | + $placeholders[ 'field_id' ] = GravityView_API::field_html_attr_id( $field, $form, $entry ); |
|
1557 | 1557 | |
1558 | 1558 | if ( $context instanceof \GV\Template_Context ) { |
1559 | - $placeholders['label_value'] = \GV\Utils::get( $args, 'label', '' ); |
|
1559 | + $placeholders[ 'label_value' ] = \GV\Utils::get( $args, 'label', '' ); |
|
1560 | 1560 | } else { |
1561 | 1561 | // Default Label value |
1562 | - $placeholders['label_value'] = gv_label( $field, $entry ); |
|
1562 | + $placeholders[ 'label_value' ] = gv_label( $field, $entry ); |
|
1563 | 1563 | } |
1564 | 1564 | |
1565 | - $placeholders['label_value:data-label'] = trim( esc_attr( strip_tags( str_replace( '> ', '>', $placeholders['label_value'] ) ) ) ); |
|
1566 | - $placeholders['label_value:esc_attr'] = esc_attr( $placeholders['label_value'] ); |
|
1565 | + $placeholders[ 'label_value:data-label' ] = trim( esc_attr( strip_tags( str_replace( '> ', '>', $placeholders[ 'label_value' ] ) ) ) ); |
|
1566 | + $placeholders[ 'label_value:esc_attr' ] = esc_attr( $placeholders[ 'label_value' ] ); |
|
1567 | 1567 | |
1568 | - if ( empty( $placeholders['label'] ) && ! empty( $placeholders['label_value'] ) ){ |
|
1569 | - $placeholders['label'] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
1568 | + if ( empty( $placeholders[ 'label' ] ) && ! empty( $placeholders[ 'label_value' ] ) ) { |
|
1569 | + $placeholders[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
1570 | 1570 | } |
1571 | 1571 | |
1572 | 1572 | /** |
@@ -1577,7 +1577,7 @@ discard block |
||
1577 | 1577 | * @since 2.0 |
1578 | 1578 | * @param \GV\Template_Context $context The context. |
1579 | 1579 | */ |
1580 | - $html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args, $context ); |
|
1580 | + $html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args, $context ); |
|
1581 | 1581 | |
1582 | 1582 | /** |
1583 | 1583 | * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders |
@@ -1604,7 +1604,7 @@ discard block |
||
1604 | 1604 | foreach ( $placeholders as $tag => $value ) { |
1605 | 1605 | |
1606 | 1606 | // If the tag doesn't exist just skip it |
1607 | - if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){ |
|
1607 | + if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) { |
|
1608 | 1608 | continue; |
1609 | 1609 | } |
1610 | 1610 | |
@@ -1625,7 +1625,7 @@ discard block |
||
1625 | 1625 | $value = apply_filters( 'gravityview/field_output/context/' . $tag, $value, $args, $context ); |
1626 | 1626 | |
1627 | 1627 | // Finally do the replace |
1628 | - $html = str_replace( $search, (string) $value, $html ); |
|
1628 | + $html = str_replace( $search, (string)$value, $html ); |
|
1629 | 1629 | } |
1630 | 1630 | |
1631 | 1631 | /** |
@@ -126,12 +126,12 @@ discard block |
||
126 | 126 | * @uses {@var $counter} |
127 | 127 | * @param Template_Context $context |
128 | 128 | */ |
129 | - add_action( 'gravityview/template/view/render', $add_anchor_id_filter = function ( $context ) use ( &$counter ) { |
|
129 | + add_action( 'gravityview/template/view/render', $add_anchor_id_filter = function( $context ) use ( &$counter ) { |
|
130 | 130 | /** @see \GV\View::set_anchor_id() */ |
131 | 131 | $context->view->set_anchor_id( $counter[ $context->view->ID ] ); |
132 | 132 | } ); |
133 | 133 | |
134 | - $add_search_action_filter = function ( $action ) use ( $view ) { |
|
134 | + $add_search_action_filter = function( $action ) use ( $view ) { |
|
135 | 135 | return $action . '#' . esc_attr( $view->get_anchor_id() ); |
136 | 136 | }; |
137 | 137 | |
@@ -158,11 +158,11 @@ discard block |
||
158 | 158 | * This allows us to fake it till we make it. |
159 | 159 | */ |
160 | 160 | $parameters = $view->settings->as_atts(); |
161 | - if ( ! empty( $parameters['sort_field'] ) && is_array( $parameters['sort_field'] ) ) { |
|
161 | + if ( ! empty( $parameters[ 'sort_field' ] ) && is_array( $parameters[ 'sort_field' ] ) ) { |
|
162 | 162 | $has_multisort = true; |
163 | - $parameters['sort_field'] = reset( $parameters['sort_field'] ); |
|
164 | - if ( ! empty( $parameters['sort_direction'] ) && is_array( $parameters['sort_direction'] ) ) { |
|
165 | - $parameters['sort_direction'] = reset( $parameters['sort_direction'] ); |
|
163 | + $parameters[ 'sort_field' ] = reset( $parameters[ 'sort_field' ] ); |
|
164 | + if ( ! empty( $parameters[ 'sort_direction' ] ) && is_array( $parameters[ 'sort_direction' ] ) ) { |
|
165 | + $parameters[ 'sort_direction' ] = reset( $parameters[ 'sort_direction' ] ); |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | 'entries' => $entries, |
178 | 178 | 'request' => $request, |
179 | 179 | ), empty( $parameters ) ? array() : array( |
180 | - 'paging' => $parameters['paging'], |
|
181 | - 'sorting' => $parameters['sorting'], |
|
180 | + 'paging' => $parameters[ 'paging' ], |
|
181 | + 'sorting' => $parameters[ 'sorting' ], |
|
182 | 182 | ), empty( $post ) ? array() : array( |
183 | 183 | 'post' => $post, |
184 | 184 | ) ) ); |