@@ -109,18 +109,18 @@ |
||
109 | 109 | try { |
110 | 110 | $products_data = $product_manager->get_products_data( [ 'key_by' => 'id' ] ); |
111 | 111 | } catch ( Exception $e ) { |
112 | - $products_data = []; |
|
112 | + $products_data = [ ]; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | foreach ( $placeholders as $placeholder ) { |
116 | - if ( GravityKit\GravityView\Foundation\Helpers\Arr::get( $products_data, "{$placeholder['download_id']}.active" ) ) { |
|
116 | + if ( GravityKit\GravityView\Foundation\Helpers\Arr::get( $products_data, "{$placeholder[ 'download_id' ]}.active" ) ) { |
|
117 | 117 | // Template will be loaded by the extension. |
118 | 118 | continue; |
119 | 119 | } |
120 | 120 | |
121 | - $placeholder['type'] = 'custom'; |
|
122 | - $placeholder['included'] = ! empty( GravityKitFoundation::helpers()->array->get( $products_data, "{$placeholder['download_id']}.licenses" ) ); |
|
121 | + $placeholder[ 'type' ] = 'custom'; |
|
122 | + $placeholder[ 'included' ] = ! empty( GravityKitFoundation::helpers()->array->get( $products_data, "{$placeholder[ 'download_id' ]}.licenses" ) ); |
|
123 | 123 | |
124 | - new GravityView_Placeholder_Template( $placeholder['slug'], $placeholder ); |
|
124 | + new GravityView_Placeholder_Template( $placeholder[ 'slug' ], $placeholder ); |
|
125 | 125 | } |
126 | 126 | } |
@@ -27,17 +27,17 @@ discard block |
||
27 | 27 | * @return \GV\GF_Field|null The field implementation or null on error. |
28 | 28 | */ |
29 | 29 | public static function from_configuration( $configuration ) { |
30 | - if ( empty( $configuration['id'] ) || ! is_numeric( $configuration['id'] ) ) { |
|
30 | + if ( empty( $configuration[ 'id' ] ) || ! is_numeric( $configuration[ 'id' ] ) ) { |
|
31 | 31 | gravityview()->log->error( 'Invalid configuration[id] supplied: {id}', array( 'data' => $configuration, 'id' => \GV\Utils::get( $configuration, 'id' ) ) ); |
32 | 32 | return null; |
33 | 33 | } |
34 | 34 | |
35 | - if ( empty( $configuration['form_id'] ) || ! $form = \GV\GF_Form::by_id( $configuration['form_id'] ) ) { |
|
35 | + if ( empty( $configuration[ 'form_id' ] ) || ! $form = \GV\GF_Form::by_id( $configuration[ 'form_id' ] ) ) { |
|
36 | 36 | gravityview()->log->error( 'Invalid configuration[form_id] supplied: {form_id}', array( 'data' => $configuration, 'form_id' => \GV\Utils::get( $configuration, 'form_id' ) ) ); |
37 | 37 | return null; |
38 | 38 | } |
39 | 39 | |
40 | - $field = self::by_id( $form, $configuration['id'] ); |
|
40 | + $field = self::by_id( $form, $configuration[ 'id' ] ); |
|
41 | 41 | |
42 | 42 | if ( ! $field ) { |
43 | 43 | gravityview()->log->error( 'Invalid configuration: Field not found by [id] supplied: {id}', array( 'data' => $configuration, 'id' => \GV\Utils::get( $configuration, 'id' ) ) ); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | /** This is a complex Gravity Forms input. */ |
118 | 118 | if ( $input = \GFFormsModel::get_input( $this->field, $this->ID ) ) { |
119 | - $label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label']; |
|
119 | + $label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ]; |
|
120 | 120 | } else { |
121 | 121 | /** This is a field with one label. */ |
122 | 122 | $label = $this->field->get_field_label( true, $this->label ); |
@@ -29,12 +29,12 @@ |
||
29 | 29 | */ |
30 | 30 | public static function from_configuration( $configuration ) { |
31 | 31 | |
32 | - if ( empty( $configuration['id'] ) || ! is_string( $configuration['id'] ) ) { |
|
32 | + if ( empty( $configuration[ 'id' ] ) || ! is_string( $configuration[ 'id' ] ) ) { |
|
33 | 33 | gravityview()->log->error( 'Invalid configuration[id] supplied for internal field: {id}', array( 'data' => $configuration, 'id' => \GV\Utils::get( $configuration, 'id' ) ) ); |
34 | 34 | return null; |
35 | 35 | } |
36 | 36 | |
37 | - $field = self::by_id( $configuration['id'] ); |
|
37 | + $field = self::by_id( $configuration[ 'id' ] ); |
|
38 | 38 | |
39 | 39 | $field->update_configuration( $configuration ); |
40 | 40 |
@@ -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; |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | */ |
196 | 196 | static function getInstance( $passed_post = NULL ) { |
197 | 197 | |
198 | - if( empty( self::$instance ) ) { |
|
198 | + if ( empty( self::$instance ) ) { |
|
199 | 199 | self::$instance = new self( $passed_post ); |
200 | 200 | } |
201 | 201 | |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function getCurrentField( $key = NULL ) { |
210 | 210 | |
211 | - if( !empty( $key ) ) { |
|
212 | - if( isset( $this->_current_field[ $key ] ) ) { |
|
211 | + if ( ! empty( $key ) ) { |
|
212 | + if ( isset( $this->_current_field[ $key ] ) ) { |
|
213 | 213 | return $this->_current_field[ $key ]; |
214 | 214 | } |
215 | 215 | return NULL; |
@@ -220,16 +220,16 @@ discard block |
||
220 | 220 | |
221 | 221 | public function setCurrentFieldSetting( $key, $value ) { |
222 | 222 | |
223 | - if( !empty( $this->_current_field ) ) { |
|
224 | - $this->_current_field['field_settings'][ $key ] = $value; |
|
223 | + if ( ! empty( $this->_current_field ) ) { |
|
224 | + $this->_current_field[ 'field_settings' ][ $key ] = $value; |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | } |
228 | 228 | |
229 | 229 | public function getCurrentFieldSetting( $key ) { |
230 | - $settings = $this->getCurrentField('field_settings'); |
|
230 | + $settings = $this->getCurrentField( 'field_settings' ); |
|
231 | 231 | |
232 | - if( $settings && !empty( $settings[ $key ] ) ) { |
|
232 | + if ( $settings && ! empty( $settings[ $key ] ) ) { |
|
233 | 233 | return $settings[ $key ]; |
234 | 234 | } |
235 | 235 | |
@@ -260,8 +260,8 @@ discard block |
||
260 | 260 | */ |
261 | 261 | public function getAtts( $key = NULL ) { |
262 | 262 | |
263 | - if( !empty( $key ) ) { |
|
264 | - if( isset( $this->atts[ $key ] ) ) { |
|
263 | + if ( ! empty( $key ) ) { |
|
264 | + if ( isset( $this->atts[ $key ] ) ) { |
|
265 | 265 | return $this->atts[ $key ]; |
266 | 266 | } |
267 | 267 | return NULL; |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | |
328 | 328 | $fields = empty( $this->fields ) ? NULL : $this->fields; |
329 | 329 | |
330 | - if( $fields && !empty( $key ) ) { |
|
330 | + if ( $fields && ! empty( $key ) ) { |
|
331 | 331 | $fields = isset( $fields[ $key ] ) ? $fields[ $key ] : NULL; |
332 | 332 | } |
333 | 333 | |
@@ -345,18 +345,18 @@ discard block |
||
345 | 345 | */ |
346 | 346 | public function getContextFields( $context = '' ) { |
347 | 347 | |
348 | - if( '' === $context ) { |
|
348 | + if ( '' === $context ) { |
|
349 | 349 | $context = $this->getContext(); |
350 | 350 | } |
351 | 351 | |
352 | 352 | $fields = $this->getFields(); |
353 | 353 | |
354 | - foreach ( (array) $fields as $key => $context_fields ) { |
|
354 | + foreach ( (array)$fields as $key => $context_fields ) { |
|
355 | 355 | |
356 | 356 | // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against |
357 | 357 | $matches = explode( '_', $key ); |
358 | 358 | |
359 | - if( isset( $matches[0] ) && $matches[0] === $context ) { |
|
359 | + if ( isset( $matches[ 0 ] ) && $matches[ 0 ] === $context ) { |
|
360 | 360 | return $context_fields; |
361 | 361 | } |
362 | 362 | } |
@@ -377,8 +377,8 @@ discard block |
||
377 | 377 | */ |
378 | 378 | public function getField( $key ) { |
379 | 379 | |
380 | - if( !empty( $key ) ) { |
|
381 | - if( isset( $this->fields[ $key ] ) ) { |
|
380 | + if ( ! empty( $key ) ) { |
|
381 | + if ( isset( $this->fields[ $key ] ) ) { |
|
382 | 382 | return $this->fields[ $key ]; |
383 | 383 | } |
384 | 384 | } |
@@ -484,8 +484,8 @@ discard block |
||
484 | 484 | public function getPaginationCounts() { |
485 | 485 | |
486 | 486 | $paging = $this->getPaging(); |
487 | - $offset = $paging['offset']; |
|
488 | - $page_size = $paging['page_size']; |
|
487 | + $offset = $paging[ 'offset' ]; |
|
488 | + $page_size = $paging[ 'page_size' ]; |
|
489 | 489 | $total = $this->getTotalEntries(); |
490 | 490 | |
491 | 491 | if ( empty( $total ) ) { |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | */ |
507 | 507 | list( $first, $last, $total ) = apply_filters( 'gravityview_pagination_counts', array( $first, $last, $total ) ); |
508 | 508 | |
509 | - return array( 'first' => (int) $first, 'last' => (int) $last, 'total' => (int) $total ); |
|
509 | + return array( 'first' => (int)$first, 'last' => (int)$last, 'total' => (int)$total ); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | /** |
@@ -602,16 +602,16 @@ discard block |
||
602 | 602 | */ |
603 | 603 | public function getCurrentEntry() { |
604 | 604 | |
605 | - if( in_array( $this->getContext(), array( 'edit', 'single') ) ) { |
|
605 | + if ( in_array( $this->getContext(), array( 'edit', 'single' ) ) ) { |
|
606 | 606 | $entries = $this->getEntries(); |
607 | - $entry = $entries[0]; |
|
607 | + $entry = $entries[ 0 ]; |
|
608 | 608 | } else { |
609 | 609 | $entry = $this->_current_entry; |
610 | 610 | } |
611 | 611 | |
612 | 612 | /** @since 1.16 Fixes DataTables empty entry issue */ |
613 | - if ( empty( $entry ) && ! empty( $this->_current_field['entry'] ) ) { |
|
614 | - $entry = $this->_current_field['entry']; |
|
613 | + if ( empty( $entry ) && ! empty( $this->_current_field[ 'entry' ] ) ) { |
|
614 | + $entry = $this->_current_field[ 'entry' ]; |
|
615 | 615 | } |
616 | 616 | |
617 | 617 | return $entry; |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | public function renderZone( $zone = '', $atts = array(), $echo = true ) { |
652 | 652 | |
653 | 653 | if ( empty( $zone ) ) { |
654 | - gravityview()->log->error( 'No zone defined.'); |
|
654 | + gravityview()->log->error( 'No zone defined.' ); |
|
655 | 655 | return NULL; |
656 | 656 | } |
657 | 657 | |
@@ -660,16 +660,16 @@ discard block |
||
660 | 660 | 'context' => $this->getContext(), |
661 | 661 | 'entry' => $this->getCurrentEntry(), |
662 | 662 | 'form' => $this->getForm(), |
663 | - 'hide_empty' => $this->getAtts('hide_empty'), |
|
663 | + 'hide_empty' => $this->getAtts( 'hide_empty' ), |
|
664 | 664 | ); |
665 | 665 | |
666 | 666 | $final_atts = wp_parse_args( $atts, $defaults ); |
667 | 667 | |
668 | 668 | $output = ''; |
669 | 669 | |
670 | - $final_atts['zone_id'] = "{$final_atts['context']}_{$final_atts['slug']}-{$zone}"; |
|
670 | + $final_atts[ 'zone_id' ] = "{$final_atts[ 'context' ]}_{$final_atts[ 'slug' ]}-{$zone}"; |
|
671 | 671 | |
672 | - $fields = $this->getField( $final_atts['zone_id'] ); |
|
672 | + $fields = $this->getField( $final_atts[ 'zone_id' ] ); |
|
673 | 673 | |
674 | 674 | // Backward compatibility |
675 | 675 | if ( 'table' === $this->getTemplatePartSlug() ) { |
@@ -679,19 +679,19 @@ discard block |
||
679 | 679 | * @param \GravityView_View $this |
680 | 680 | * @deprecated Use `gravityview/template/table/fields` |
681 | 681 | */ |
682 | - $fields = apply_filters("gravityview_table_cells", $fields, $this ); |
|
682 | + $fields = apply_filters( "gravityview_table_cells", $fields, $this ); |
|
683 | 683 | } |
684 | 684 | |
685 | 685 | if ( empty( $fields ) ) { |
686 | 686 | |
687 | - gravityview()->log->warning( 'Empty zone configuration for {zone_id}.', array( 'zone_id' => $final_atts['zone_id'] ) ); |
|
687 | + gravityview()->log->warning( 'Empty zone configuration for {zone_id}.', array( 'zone_id' => $final_atts[ 'zone_id' ] ) ); |
|
688 | 688 | |
689 | 689 | return NULL; |
690 | 690 | } |
691 | 691 | |
692 | 692 | $field_output = ''; |
693 | 693 | foreach ( $fields as $field ) { |
694 | - $final_atts['field'] = $field; |
|
694 | + $final_atts[ 'field' ] = $field; |
|
695 | 695 | |
696 | 696 | $field_output .= gravityview_field_output( $final_atts ); |
697 | 697 | } |
@@ -708,17 +708,17 @@ discard block |
||
708 | 708 | return NULL; |
709 | 709 | } |
710 | 710 | |
711 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
712 | - $output .= '<div class="'.gravityview_sanitize_html_class( $final_atts['wrapper_class'] ).'">'; |
|
711 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
712 | + $output .= '<div class="' . gravityview_sanitize_html_class( $final_atts[ 'wrapper_class' ] ) . '">'; |
|
713 | 713 | } |
714 | 714 | |
715 | 715 | $output .= $field_output; |
716 | 716 | |
717 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
717 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
718 | 718 | $output .= '</div>'; |
719 | 719 | } |
720 | 720 | |
721 | - if( $echo ) { |
|
721 | + if ( $echo ) { |
|
722 | 722 | echo $output; |
723 | 723 | } |
724 | 724 | |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | */ |
737 | 737 | function locate_template( $template_names, $load = false, $require_once = true ) { |
738 | 738 | |
739 | - if( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
739 | + if ( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
740 | 740 | |
741 | 741 | $located = $this->located_templates[ $template_names ]; |
742 | 742 | |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | // Set $load to always false so we handle it here. |
746 | 746 | $located = parent::locate_template( $template_names, false, $require_once ); |
747 | 747 | |
748 | - if( is_string( $template_names ) ) { |
|
748 | + if ( is_string( $template_names ) ) { |
|
749 | 749 | $this->located_templates[ $template_names ] = $located; |
750 | 750 | } |
751 | 751 | } |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | * @return mixed|null The stored data. |
764 | 764 | */ |
765 | 765 | public function __get( $name ) { |
766 | - if( isset( $this->{$name} ) ) { |
|
766 | + if ( isset( $this->{$name} ) ) { |
|
767 | 767 | return $this->{$name}; |
768 | 768 | } else { |
769 | 769 | return NULL; |
@@ -792,17 +792,17 @@ discard block |
||
792 | 792 | $additional = array(); |
793 | 793 | |
794 | 794 | // form-19-table-body.php |
795 | - $additional[] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
795 | + $additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
796 | 796 | |
797 | - if( $view_id = $this->getViewId() ) { |
|
797 | + if ( $view_id = $this->getViewId() ) { |
|
798 | 798 | // view-3-table-body.php |
799 | - $additional[] = sprintf( 'view-%d-%s-%s.php', $view_id, $slug, $name ); |
|
799 | + $additional[ ] = sprintf( 'view-%d-%s-%s.php', $view_id, $slug, $name ); |
|
800 | 800 | } |
801 | 801 | |
802 | - if( $this->getPostId() ) { |
|
802 | + if ( $this->getPostId() ) { |
|
803 | 803 | |
804 | 804 | // page-19-table-body.php |
805 | - $additional[] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
805 | + $additional[ ] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
806 | 806 | } |
807 | 807 | |
808 | 808 | // Combine with existing table-body.php and table.php |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | |
825 | 825 | gravityview()->log->debug( 'Rendering Template File: {path}', array( 'path' => $template_file ) ); |
826 | 826 | |
827 | - if( !empty( $template_file) ) { |
|
827 | + if ( ! empty( $template_file ) ) { |
|
828 | 828 | |
829 | 829 | if ( $require_once ) { |
830 | 830 | require_once( $template_file ); |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | |
900 | 900 | // Prevent being called twice |
901 | 901 | if ( did_action( "gravityview/widgets/$zone/{$view->ID}/rendered" ) ) { |
902 | - gravityview()->log->debug( 'Not rendering {zone}; already rendered', array( 'zone' => $zone.'_'.$view->ID.'_widgets' ) ); |
|
902 | + gravityview()->log->debug( 'Not rendering {zone}; already rendered', array( 'zone' => $zone . '_' . $view->ID . '_widgets' ) ); |
|
903 | 903 | return; |
904 | 904 | } |
905 | 905 | |
@@ -921,7 +921,7 @@ discard block |
||
921 | 921 | * @param string $zone Current widget zone, either `header` or `footer` |
922 | 922 | * @param array $widgets Array of widget configurations for the current zone, as set by `gravityview_get_current_view_data()['widgets']` |
923 | 923 | */ |
924 | - $css_class = apply_filters('gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets->as_configuration() ); |
|
924 | + $css_class = apply_filters( 'gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets->as_configuration() ); |
|
925 | 925 | |
926 | 926 | $css_class = gravityview_sanitize_html_class( $css_class ); |
927 | 927 | |
@@ -929,15 +929,15 @@ discard block |
||
929 | 929 | ?> |
930 | 930 | <div class="<?php echo $css_class; ?>"> |
931 | 931 | <?php |
932 | - foreach( $rows as $row ) { |
|
933 | - foreach( $row as $col => $areas ) { |
|
932 | + foreach ( $rows as $row ) { |
|
933 | + foreach ( $row as $col => $areas ) { |
|
934 | 934 | $column = ( $col == '2-2' ) ? '1-2 gv-right' : "$col gv-left"; |
935 | 935 | ?> |
936 | 936 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
937 | 937 | <?php |
938 | 938 | if ( ! empty( $areas ) ) { |
939 | 939 | foreach ( $areas as $area ) { |
940 | - foreach ( $widgets->by_position( $zone . '_' . $area['areaid'] )->all() as $widget ) { |
|
940 | + foreach ( $widgets->by_position( $zone . '_' . $area[ 'areaid' ] )->all() as $widget ) { |
|
941 | 941 | do_action( sprintf( 'gravityview/widgets/%s/render', $widget->get_widget_id() ), $widget->configuration->all(), null, $view_id_or_context ); |
942 | 942 | } |
943 | 943 | } |
@@ -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 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | } else { |
303 | 303 | $gravityview_view = GravityView_View::getInstance(); |
304 | 304 | |
305 | - if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
305 | + if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
306 | 306 | $is_search = true; |
307 | 307 | } |
308 | 308 | } |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | |
314 | 314 | $output = esc_html__( 'This search returned no results.', 'gk-gravityview' ); |
315 | 315 | |
316 | - if( $context ) { |
|
316 | + if ( $context ) { |
|
317 | 317 | $setting = $context->view->settings->get( 'no_search_results_text', $output ); |
318 | 318 | } |
319 | 319 | |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | |
322 | 322 | $output = esc_html__( 'No entries match your request.', 'gk-gravityview' ); |
323 | 323 | |
324 | - if( $context ) { |
|
324 | + if ( $context ) { |
|
325 | 325 | $setting = $context->view->settings->get( 'no_results_text', $output ); |
326 | 326 | } |
327 | 327 | } |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | $link = $directory_links[ 'gv_directory_link_' . $post_id ]; |
454 | 454 | } |
455 | 455 | |
456 | - if ( (int) $post_id === (int) get_option( 'page_on_front' ) ) { |
|
456 | + if ( (int)$post_id === (int)get_option( 'page_on_front' ) ) { |
|
457 | 457 | $link = home_url(); |
458 | 458 | } |
459 | 459 | |
@@ -468,13 +468,13 @@ discard block |
||
468 | 468 | |
469 | 469 | $args = array(); |
470 | 470 | |
471 | - if( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) { |
|
472 | - $args['pagenum'] = intval( $pagenum ); |
|
471 | + if ( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) { |
|
472 | + $args[ 'pagenum' ] = intval( $pagenum ); |
|
473 | 473 | } |
474 | 474 | |
475 | - if( $sort = \GV\Utils::_GET( 'sort' ) ) { |
|
476 | - $args['sort'] = $sort; |
|
477 | - $args['dir'] = \GV\Utils::_GET( 'dir' ); |
|
475 | + if ( $sort = \GV\Utils::_GET( 'sort' ) ) { |
|
476 | + $args[ 'sort' ] = $sort; |
|
477 | + $args[ 'dir' ] = \GV\Utils::_GET( 'dir' ); |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | $link = add_query_arg( $args, $link ); |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | private static function get_custom_entry_slug( $id, $entry = array() ) { |
512 | 512 | |
513 | 513 | // Generate an unique hash to use as the default value |
514 | - $slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 ); |
|
514 | + $slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 ); |
|
515 | 515 | |
516 | 516 | /** |
517 | 517 | * @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}` |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | $slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry ); |
523 | 523 | |
524 | 524 | // Make sure we have something - use the original ID as backup. |
525 | - if( empty( $slug ) ) { |
|
525 | + if ( empty( $slug ) ) { |
|
526 | 526 | $slug = $id; |
527 | 527 | } |
528 | 528 | |
@@ -616,15 +616,15 @@ discard block |
||
616 | 616 | * @param boolean $custom Should we process the custom entry slug? |
617 | 617 | */ |
618 | 618 | $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
619 | - if( $custom ) { |
|
619 | + if ( $custom ) { |
|
620 | 620 | // create the gravityview_unique_id and save it |
621 | 621 | |
622 | 622 | // Get the entry hash |
623 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
623 | + $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry ); |
|
624 | 624 | |
625 | - gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) ); |
|
625 | + gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry[ 'id' ], 'hash' => $hash ) ); |
|
626 | 626 | |
627 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) ); |
|
627 | + gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) ); |
|
628 | 628 | |
629 | 629 | } |
630 | 630 | } |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | |
651 | 651 | if ( ! empty( $entry ) && ! is_array( $entry ) ) { |
652 | 652 | $entry = GVCommon::get_entry( $entry ); |
653 | - } else if( empty( $entry ) ) { |
|
653 | + } else if ( empty( $entry ) ) { |
|
654 | 654 | // @deprecated path |
655 | 655 | $entry = GravityView_frontend::getInstance()->getEntry(); |
656 | 656 | } |
@@ -670,32 +670,32 @@ discard block |
||
670 | 670 | |
671 | 671 | $query_arg_name = \GV\Entry::get_endpoint_name(); |
672 | 672 | |
673 | - if ( ! empty( $entry['_multi'] ) ) { |
|
673 | + if ( ! empty( $entry[ '_multi' ] ) ) { |
|
674 | 674 | $entry_slugs = array(); |
675 | 675 | |
676 | - foreach ( $entry['_multi'] as $_multi ) { |
|
676 | + foreach ( $entry[ '_multi' ] as $_multi ) { |
|
677 | 677 | |
678 | - if( $gv_multi = \GV\GF_Entry::from_entry( $_multi ) ) { |
|
679 | - $entry_slugs[] = $gv_multi->get_slug(); |
|
678 | + if ( $gv_multi = \GV\GF_Entry::from_entry( $_multi ) ) { |
|
679 | + $entry_slugs[ ] = $gv_multi->get_slug(); |
|
680 | 680 | } else { |
681 | 681 | // TODO: This path isn't covered by unit tests |
682 | - $entry_slugs[] = \GravityView_API::get_entry_slug( $_multi['id'], $_multi ); |
|
682 | + $entry_slugs[ ] = \GravityView_API::get_entry_slug( $_multi[ 'id' ], $_multi ); |
|
683 | 683 | } |
684 | 684 | |
685 | 685 | unset( $gv_multi ); |
686 | 686 | |
687 | - $forms[] = $_multi['form_id']; |
|
687 | + $forms[ ] = $_multi[ 'form_id' ]; |
|
688 | 688 | } |
689 | 689 | |
690 | 690 | $entry_slug = implode( ',', $entry_slugs ); |
691 | 691 | } else { |
692 | 692 | |
693 | 693 | // Fallback when |
694 | - if( $gv_entry = \GV\GF_Entry::from_entry( $entry ) ) { |
|
694 | + if ( $gv_entry = \GV\GF_Entry::from_entry( $entry ) ) { |
|
695 | 695 | $entry_slug = $gv_entry->get_slug(); |
696 | 696 | } else { |
697 | 697 | // TODO: This path isn't covered by unit tests |
698 | - $entry_slug = \GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
698 | + $entry_slug = \GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
699 | 699 | } |
700 | 700 | |
701 | 701 | unset( $gv_entry ); |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | $args = gv_get_query_args(); |
715 | 715 | } |
716 | 716 | |
717 | - if ( get_option('permalink_structure') && ! is_preview() ) { |
|
717 | + if ( get_option( 'permalink_structure' ) && ! is_preview() ) { |
|
718 | 718 | |
719 | 719 | /** |
720 | 720 | * Make sure the $directory_link doesn't contain any query otherwise it will break when adding the entry slug. |
@@ -722,13 +722,13 @@ discard block |
||
722 | 722 | */ |
723 | 723 | $link_parts = explode( '?', $directory_link ); |
724 | 724 | |
725 | - $query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : ''; |
|
725 | + $query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : ''; |
|
726 | 726 | |
727 | - $directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query; |
|
727 | + $directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query; |
|
728 | 728 | |
729 | 729 | } else { |
730 | 730 | |
731 | - $args[] = array( $query_arg_name => $entry_slug ); |
|
731 | + $args[ ] = array( $query_arg_name => $entry_slug ); |
|
732 | 732 | } |
733 | 733 | |
734 | 734 | /** |
@@ -736,21 +736,21 @@ discard block |
||
736 | 736 | */ |
737 | 737 | if ( $add_directory_args ) { |
738 | 738 | |
739 | - if ( ! empty( $_GET['pagenum'] ) ) { |
|
740 | - $args['pagenum'] = intval( $_GET['pagenum'] ); |
|
739 | + if ( ! empty( $_GET[ 'pagenum' ] ) ) { |
|
740 | + $args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] ); |
|
741 | 741 | } |
742 | 742 | |
743 | 743 | /** |
744 | 744 | * @since 1.7 |
745 | 745 | */ |
746 | 746 | if ( $sort = \GV\Utils::_GET( 'sort' ) ) { |
747 | - $args['sort'] = $sort; |
|
748 | - $args['dir'] = \GV\Utils::_GET( 'dir' ); |
|
747 | + $args[ 'sort' ] = $sort; |
|
748 | + $args[ 'dir' ] = \GV\Utils::_GET( 'dir' ); |
|
749 | 749 | } |
750 | 750 | |
751 | 751 | } |
752 | 752 | |
753 | - if( $post_id ) { |
|
753 | + if ( $post_id ) { |
|
754 | 754 | $passed_post = get_post( $post_id ); |
755 | 755 | $views = \GV\View_Collection::from_post( $passed_post ); |
756 | 756 | $has_multiple_views = $views->count() > 1; |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | } |
760 | 760 | |
761 | 761 | if ( $has_multiple_views ) { |
762 | - $args['gvid'] = $view_id ? $view_id : gravityview_get_view_id(); |
|
762 | + $args[ 'gvid' ] = $view_id ? $view_id : gravityview_get_view_id(); |
|
763 | 763 | } |
764 | 764 | |
765 | 765 | return add_query_arg( $args, $directory_link ); |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | } |
832 | 832 | |
833 | 833 | function gv_class( $field, $form = NULL, $entry = array() ) { |
834 | - return GravityView_API::field_class( $field, $form, $entry ); |
|
834 | + return GravityView_API::field_class( $field, $form, $entry ); |
|
835 | 835 | } |
836 | 836 | |
837 | 837 | /** |
@@ -854,7 +854,7 @@ discard block |
||
854 | 854 | $view_id = 0; |
855 | 855 | if ( $context->view ) { |
856 | 856 | $view_id = $context->view->ID; |
857 | - if( $context->view->settings->get( 'hide_until_searched' ) ) { |
|
857 | + if ( $context->view->settings->get( 'hide_until_searched' ) ) { |
|
858 | 858 | $hide_until_searched = ( empty( $context->entry ) && ! $context->request->is_search() ); |
859 | 859 | } |
860 | 860 | } |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | $default_css_class .= ' ' . $context->view->settings->get( 'class', '' ); |
887 | 887 | } |
888 | 888 | |
889 | - $css_class = trim( $passed_css_class . ' '. $default_css_class ); |
|
889 | + $css_class = trim( $passed_css_class . ' ' . $default_css_class ); |
|
890 | 890 | |
891 | 891 | /** |
892 | 892 | * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | |
914 | 914 | $value = GravityView_API::field_value( $entry, $field ); |
915 | 915 | |
916 | - if( $value === '' ) { |
|
916 | + if ( $value === '' ) { |
|
917 | 917 | /** |
918 | 918 | * @filter `gravityview_empty_value` What to display when a field is empty |
919 | 919 | * @param string $value (empty string) |
@@ -1026,7 +1026,7 @@ discard block |
||
1026 | 1026 | */ |
1027 | 1027 | function gravityview_get_field_value( $entry, $field_id, $display_value ) { |
1028 | 1028 | |
1029 | - if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
1029 | + if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
1030 | 1030 | |
1031 | 1031 | // For the complete field value as generated by Gravity Forms |
1032 | 1032 | return $display_value; |
@@ -1060,16 +1060,16 @@ discard block |
||
1060 | 1060 | $terms = explode( ', ', $value ); |
1061 | 1061 | } |
1062 | 1062 | |
1063 | - foreach ($terms as $term_name ) { |
|
1063 | + foreach ( $terms as $term_name ) { |
|
1064 | 1064 | |
1065 | 1065 | // If we're processing a category, |
1066 | - if( $taxonomy === 'category' ) { |
|
1066 | + if ( $taxonomy === 'category' ) { |
|
1067 | 1067 | |
1068 | 1068 | // Use rgexplode to prevent errors if : doesn't exist |
1069 | 1069 | list( $term_name, $term_id ) = rgexplode( ':', $term_name, 2 ); |
1070 | 1070 | |
1071 | 1071 | // The explode was succesful; we have the category ID |
1072 | - if( !empty( $term_id )) { |
|
1072 | + if ( ! empty( $term_id ) ) { |
|
1073 | 1073 | $term = get_term_by( 'id', $term_id, $taxonomy ); |
1074 | 1074 | } else { |
1075 | 1075 | // We have to fall back to the name |
@@ -1082,7 +1082,7 @@ discard block |
||
1082 | 1082 | } |
1083 | 1083 | |
1084 | 1084 | // There's still a tag/category here. |
1085 | - if( $term ) { |
|
1085 | + if ( $term ) { |
|
1086 | 1086 | |
1087 | 1087 | $term_link = get_term_link( $term, $taxonomy ); |
1088 | 1088 | |
@@ -1091,11 +1091,11 @@ discard block |
||
1091 | 1091 | continue; |
1092 | 1092 | } |
1093 | 1093 | |
1094 | - $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
1094 | + $output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
1095 | 1095 | } |
1096 | 1096 | } |
1097 | 1097 | |
1098 | - return implode(', ', $output ); |
|
1098 | + return implode( ', ', $output ); |
|
1099 | 1099 | } |
1100 | 1100 | |
1101 | 1101 | /** |
@@ -1109,8 +1109,8 @@ discard block |
||
1109 | 1109 | |
1110 | 1110 | $output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' ); |
1111 | 1111 | |
1112 | - if( empty( $link ) ) { |
|
1113 | - return strip_tags( $output); |
|
1112 | + if ( empty( $link ) ) { |
|
1113 | + return strip_tags( $output ); |
|
1114 | 1114 | } |
1115 | 1115 | |
1116 | 1116 | return $output; |
@@ -1129,7 +1129,7 @@ discard block |
||
1129 | 1129 | $fe = GravityView_frontend::getInstance(); |
1130 | 1130 | |
1131 | 1131 | // Solve problem when loading content via admin-ajax.php |
1132 | - if( ! $fe->getGvOutputData() ) { |
|
1132 | + if ( ! $fe->getGvOutputData() ) { |
|
1133 | 1133 | |
1134 | 1134 | gravityview()->log->debug( 'gv_output_data not defined; parsing content.' ); |
1135 | 1135 | |
@@ -1137,7 +1137,7 @@ discard block |
||
1137 | 1137 | } |
1138 | 1138 | |
1139 | 1139 | // Make 100% sure that we're dealing with a properly called situation |
1140 | - if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
1140 | + if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
1141 | 1141 | |
1142 | 1142 | gravityview()->log->debug( 'gv_output_data not an object or get_view not callable.', array( 'data' => $fe->getGvOutputData() ) ); |
1143 | 1143 | |
@@ -1368,12 +1368,12 @@ discard block |
||
1368 | 1368 | function gravityview_get_files_array( $value, $gv_class = '', $context = null ) { |
1369 | 1369 | /** @define "GRAVITYVIEW_DIR" "../" */ |
1370 | 1370 | |
1371 | - if( !class_exists( 'GravityView_Field' ) ) { |
|
1372 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' ); |
|
1371 | + if ( ! class_exists( 'GravityView_Field' ) ) { |
|
1372 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' ); |
|
1373 | 1373 | } |
1374 | 1374 | |
1375 | - if( !class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
1376 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field-fileupload.php' ); |
|
1375 | + if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
1376 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field-fileupload.php' ); |
|
1377 | 1377 | } |
1378 | 1378 | |
1379 | 1379 | if ( is_null( $context ) ) { |
@@ -1484,21 +1484,21 @@ discard block |
||
1484 | 1484 | } else { |
1485 | 1485 | // @deprecated path |
1486 | 1486 | // Required fields. |
1487 | - if ( empty( $args['field'] ) || empty( $args['form'] ) ) { |
|
1487 | + if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) { |
|
1488 | 1488 | gravityview()->log->error( 'Field or form are empty.', array( 'data' => $args ) ); |
1489 | 1489 | return ''; |
1490 | 1490 | } |
1491 | 1491 | } |
1492 | 1492 | |
1493 | 1493 | if ( $context instanceof \GV\Template_Context ) { |
1494 | - $entry = $args['entry'] ? : ( $context->entry ? $context->entry->as_entry() : array() ); |
|
1495 | - $field = $args['field'] ? : ( $context->field ? $context->field->as_configuration() : array() ); |
|
1496 | - $form = $args['form'] ? : ( $context->view->form ? $context->view->form->form : array() ); |
|
1494 | + $entry = $args[ 'entry' ] ?: ( $context->entry ? $context->entry->as_entry() : array() ); |
|
1495 | + $field = $args[ 'field' ] ?: ( $context->field ? $context->field->as_configuration() : array() ); |
|
1496 | + $form = $args[ 'form' ] ?: ( $context->view->form ? $context->view->form->form : array() ); |
|
1497 | 1497 | } else { |
1498 | 1498 | // @deprecated path |
1499 | - $entry = empty( $args['entry'] ) ? array() : $args['entry']; |
|
1500 | - $field = $args['field']; |
|
1501 | - $form = $args['form']; |
|
1499 | + $entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ]; |
|
1500 | + $field = $args[ 'field' ]; |
|
1501 | + $form = $args[ 'form' ]; |
|
1502 | 1502 | } |
1503 | 1503 | |
1504 | 1504 | /** |
@@ -1518,43 +1518,43 @@ discard block |
||
1518 | 1518 | ); |
1519 | 1519 | |
1520 | 1520 | if ( $context instanceof \GV\Template_Context ) { |
1521 | - $placeholders['value'] = \GV\Utils::get( $args, 'value', '' ); |
|
1521 | + $placeholders[ 'value' ] = \GV\Utils::get( $args, 'value', '' ); |
|
1522 | 1522 | } else { |
1523 | 1523 | // @deprecated path |
1524 | - $placeholders['value'] = gv_value( $entry, $field ); |
|
1524 | + $placeholders[ 'value' ] = gv_value( $entry, $field ); |
|
1525 | 1525 | } |
1526 | 1526 | |
1527 | 1527 | // If the value is empty and we're hiding empty, return empty. |
1528 | - if ( $placeholders['value'] === '' && ! empty( $args['hide_empty'] ) ) { |
|
1528 | + if ( $placeholders[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) { |
|
1529 | 1529 | return ''; |
1530 | 1530 | } |
1531 | 1531 | |
1532 | - if ( $placeholders['value'] !== '' && ! empty( $args['wpautop'] ) ) { |
|
1533 | - $placeholders['value'] = wpautop( $placeholders['value'] ); |
|
1532 | + if ( $placeholders[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) { |
|
1533 | + $placeholders[ 'value' ] = wpautop( $placeholders[ 'value' ] ); |
|
1534 | 1534 | } |
1535 | 1535 | |
1536 | 1536 | // Get width setting, if exists |
1537 | - $placeholders['width'] = GravityView_API::field_width( $field ); |
|
1537 | + $placeholders[ 'width' ] = GravityView_API::field_width( $field ); |
|
1538 | 1538 | |
1539 | 1539 | // If replacing with CSS inline formatting, let's do it. |
1540 | - $placeholders['width:style'] = (string) GravityView_API::field_width( $field, 'width:' . $placeholders['width'] . '%;' ); |
|
1540 | + $placeholders[ 'width:style' ] = (string)GravityView_API::field_width( $field, 'width:' . $placeholders[ 'width' ] . '%;' ); |
|
1541 | 1541 | |
1542 | 1542 | // Grab the Class using `gv_class` |
1543 | - $placeholders['class'] = gv_class( $field, $form, $entry ); |
|
1544 | - $placeholders['field_id'] = GravityView_API::field_html_attr_id( $field, $form, $entry ); |
|
1543 | + $placeholders[ 'class' ] = gv_class( $field, $form, $entry ); |
|
1544 | + $placeholders[ 'field_id' ] = GravityView_API::field_html_attr_id( $field, $form, $entry ); |
|
1545 | 1545 | |
1546 | 1546 | if ( $context instanceof \GV\Template_Context ) { |
1547 | - $placeholders['label_value'] = \GV\Utils::get( $args, 'label', '' ); |
|
1547 | + $placeholders[ 'label_value' ] = \GV\Utils::get( $args, 'label', '' ); |
|
1548 | 1548 | } else { |
1549 | 1549 | // Default Label value |
1550 | - $placeholders['label_value'] = gv_label( $field, $entry ); |
|
1550 | + $placeholders[ 'label_value' ] = gv_label( $field, $entry ); |
|
1551 | 1551 | } |
1552 | 1552 | |
1553 | - $placeholders['label_value:data-label'] = trim( esc_attr( strip_tags( str_replace( '> ', '>', $placeholders['label_value'] ) ) ) ); |
|
1554 | - $placeholders['label_value:esc_attr'] = esc_attr( $placeholders['label_value'] ); |
|
1553 | + $placeholders[ 'label_value:data-label' ] = trim( esc_attr( strip_tags( str_replace( '> ', '>', $placeholders[ 'label_value' ] ) ) ) ); |
|
1554 | + $placeholders[ 'label_value:esc_attr' ] = esc_attr( $placeholders[ 'label_value' ] ); |
|
1555 | 1555 | |
1556 | - if ( empty( $placeholders['label'] ) && ! empty( $placeholders['label_value'] ) ){ |
|
1557 | - $placeholders['label'] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
1556 | + if ( empty( $placeholders[ 'label' ] ) && ! empty( $placeholders[ 'label_value' ] ) ) { |
|
1557 | + $placeholders[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
1558 | 1558 | } |
1559 | 1559 | |
1560 | 1560 | /** |
@@ -1565,7 +1565,7 @@ discard block |
||
1565 | 1565 | * @since 2.0 |
1566 | 1566 | * @param \GV\Template_Context $context The context. |
1567 | 1567 | */ |
1568 | - $html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args, $context ); |
|
1568 | + $html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args, $context ); |
|
1569 | 1569 | |
1570 | 1570 | /** |
1571 | 1571 | * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders |
@@ -1592,7 +1592,7 @@ discard block |
||
1592 | 1592 | foreach ( $placeholders as $tag => $value ) { |
1593 | 1593 | |
1594 | 1594 | // If the tag doesn't exist just skip it |
1595 | - if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){ |
|
1595 | + if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) { |
|
1596 | 1596 | continue; |
1597 | 1597 | } |
1598 | 1598 | |
@@ -1613,7 +1613,7 @@ discard block |
||
1613 | 1613 | $value = apply_filters( 'gravityview/field_output/context/' . $tag, $value, $args, $context ); |
1614 | 1614 | |
1615 | 1615 | // Finally do the replace |
1616 | - $html = str_replace( $search, (string) $value, $html ); |
|
1616 | + $html = str_replace( $search, (string)$value, $html ); |
|
1617 | 1617 | } |
1618 | 1618 | |
1619 | 1619 | /** |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | function load() { |
136 | 136 | |
137 | 137 | /** @define "GRAVITYVIEW_DIR" "../../../" */ |
138 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
138 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); |
|
139 | 139 | |
140 | 140 | // Don't display an embedded form when editing an entry |
141 | 141 | add_action( 'wp_head', array( $this, 'prevent_render_form' ) ); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | add_action( 'wp', array( $this, 'prevent_maybe_process_form' ), 8 ); |
146 | 146 | add_action( 'admin_init', array( $this, 'prevent_maybe_process_form' ), 8 ); |
147 | 147 | |
148 | - add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry') ); |
|
148 | + add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry' ) ); |
|
149 | 149 | |
150 | 150 | add_action( 'gravityview_edit_entry', array( $this, 'init' ), 10, 4 ); |
151 | 151 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | add_filter( 'gform_plupload_settings', array( $this, 'modify_fileupload_settings' ), 10, 3 ); |
157 | 157 | |
158 | 158 | // Add fields expected by GFFormDisplay::validate() |
159 | - add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation') ); |
|
159 | + add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation' ) ); |
|
160 | 160 | |
161 | 161 | // Fix multiselect value for GF 2.2 |
162 | 162 | add_filter( 'gravityview/edit_entry/field_value_multiselect', array( $this, 'fix_multiselect_value_serialization' ), 10, 3 ); |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @return void |
174 | 174 | */ |
175 | 175 | public function prevent_render_form() { |
176 | - if( $this->is_edit_entry() ) { |
|
177 | - if( 'wp_head' === current_filter() ) { |
|
176 | + if ( $this->is_edit_entry() ) { |
|
177 | + if ( 'wp_head' === current_filter() ) { |
|
178 | 178 | add_filter( 'gform_shortcode_form', '__return_empty_string' ); |
179 | 179 | } else { |
180 | 180 | remove_filter( 'gform_shortcode_form', '__return_empty_string' ); |
@@ -189,17 +189,17 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function prevent_maybe_process_form() { |
191 | 191 | |
192 | - if( ! $this->is_edit_entry_submission() ) { |
|
192 | + if ( ! $this->is_edit_entry_submission() ) { |
|
193 | 193 | return; |
194 | 194 | } |
195 | 195 | |
196 | 196 | gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] Removing GFForms::maybe_process_form() action.' ); |
197 | 197 | |
198 | - remove_action( 'wp', array( 'RGForms', 'maybe_process_form'), 9 ); |
|
199 | - remove_action( 'wp', array( 'GFForms', 'maybe_process_form'), 9 ); |
|
198 | + remove_action( 'wp', array( 'RGForms', 'maybe_process_form' ), 9 ); |
|
199 | + remove_action( 'wp', array( 'GFForms', 'maybe_process_form' ), 9 ); |
|
200 | 200 | |
201 | - remove_action( 'admin_init', array( 'GFForms', 'maybe_process_form'), 9 ); |
|
202 | - remove_action( 'admin_init', array( 'RGForms', 'maybe_process_form'), 9 ); |
|
201 | + remove_action( 'admin_init', array( 'GFForms', 'maybe_process_form' ), 9 ); |
|
202 | + remove_action( 'admin_init', array( 'RGForms', 'maybe_process_form' ), 9 ); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | /** |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | |
211 | 211 | $is_edit_entry = |
212 | 212 | ( GravityView_frontend::is_single_entry() || gravityview()->request->is_entry() ) |
213 | - && ( ! empty( $_GET['edit'] ) ); |
|
213 | + && ( ! empty( $_GET[ 'edit' ] ) ); |
|
214 | 214 | |
215 | 215 | return ( $is_edit_entry || $this->is_edit_entry_submission() ); |
216 | 216 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @return boolean |
222 | 222 | */ |
223 | 223 | public function is_edit_entry_submission() { |
224 | - return !empty( $_POST[ self::$nonce_field ] ); |
|
224 | + return ! empty( $_POST[ self::$nonce_field ] ); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
@@ -243,14 +243,14 @@ discard block |
||
243 | 243 | } else { |
244 | 244 | $gravityview_view = GravityView_View::getInstance(); |
245 | 245 | $entries = $gravityview_view->getEntries(); |
246 | - self::$original_entry = $entries[0]; |
|
247 | - $this->entry = $entries[0]; |
|
246 | + self::$original_entry = $entries[ 0 ]; |
|
247 | + $this->entry = $entries[ 0 ]; |
|
248 | 248 | } |
249 | 249 | |
250 | - self::$original_form = GFAPI::get_form( $this->entry['form_id'] ); |
|
250 | + self::$original_form = GFAPI::get_form( $this->entry[ 'form_id' ] ); |
|
251 | 251 | $this->form = self::$original_form; |
252 | 252 | |
253 | - $this->form_id = $this->entry['form_id']; |
|
253 | + $this->form_id = $this->entry[ 'form_id' ]; |
|
254 | 254 | |
255 | 255 | $this->view_id = $view ? $view->ID : $gravityview_view->getViewId(); |
256 | 256 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | |
259 | 259 | $this->post_id = \GV\Utils::get( $post, 'ID', null ); |
260 | 260 | |
261 | - self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry['id'] ); |
|
261 | + self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry[ 'id' ] ); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | /** |
@@ -320,15 +320,15 @@ discard block |
||
320 | 320 | private function print_scripts() { |
321 | 321 | $gravityview_view = GravityView_View::getInstance(); |
322 | 322 | |
323 | - wp_register_script( 'gform_gravityforms', GFCommon::get_base_url().'/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) ); |
|
323 | + wp_register_script( 'gform_gravityforms', GFCommon::get_base_url() . '/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) ); |
|
324 | 324 | |
325 | 325 | GFFormDisplay::enqueue_form_scripts( $this->form ? $this->form : $gravityview_view->getForm(), false ); |
326 | 326 | |
327 | 327 | wp_localize_script( 'gravityview-fe-view', 'gvGlobals', array( 'cookiepath' => COOKIEPATH ) ); |
328 | 328 | |
329 | - wp_enqueue_script( 'sack'); // Sack is required for images. |
|
330 | - wp_enqueue_script( 'gform_gravityforms'); |
|
331 | - wp_enqueue_script( 'gravityview-fe-view'); |
|
329 | + wp_enqueue_script( 'sack' ); // Sack is required for images. |
|
330 | + wp_enqueue_script( 'gform_gravityforms' ); |
|
331 | + wp_enqueue_script( 'gravityview-fe-view' ); |
|
332 | 332 | |
333 | 333 | // File download/delete icons |
334 | 334 | wp_enqueue_style( 'gform_admin_icons' ); |
@@ -342,19 +342,19 @@ discard block |
||
342 | 342 | */ |
343 | 343 | private function process_save( $gv_data ) { |
344 | 344 | |
345 | - if ( empty( $_POST ) || ! isset( $_POST['lid'] ) ) { |
|
345 | + if ( empty( $_POST ) || ! isset( $_POST[ 'lid' ] ) ) { |
|
346 | 346 | return; |
347 | 347 | } |
348 | 348 | |
349 | 349 | // Make sure the entry, view, and form IDs are all correct |
350 | 350 | $valid = $this->verify_nonce(); |
351 | 351 | |
352 | - if ( !$valid ) { |
|
352 | + if ( ! $valid ) { |
|
353 | 353 | gravityview()->log->error( 'Nonce validation failed.' ); |
354 | 354 | return; |
355 | 355 | } |
356 | 356 | |
357 | - if ( $this->entry['id'] !== $_POST['lid'] ) { |
|
357 | + if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) { |
|
358 | 358 | gravityview()->log->error( 'Entry ID did not match posted entry ID.' ); |
359 | 359 | return; |
360 | 360 | } |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | |
366 | 366 | $this->validate(); |
367 | 367 | |
368 | - if( $this->is_valid ) { |
|
368 | + if ( $this->is_valid ) { |
|
369 | 369 | |
370 | 370 | gravityview()->log->debug( 'Submission is valid.' ); |
371 | 371 | |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | /** |
378 | 378 | * @hack to avoid the capability validation of the method save_lead for GF 1.9+ |
379 | 379 | */ |
380 | - unset( $_GET['page'] ); |
|
380 | + unset( $_GET[ 'page' ] ); |
|
381 | 381 | |
382 | 382 | add_filter( 'gform_use_post_value_for_conditional_logic_save_entry', '__return_true' ); |
383 | 383 | |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | * @param GravityView_Edit_Entry_Render $this This object |
390 | 390 | * @param GravityView_View_Data $gv_data The View data |
391 | 391 | */ |
392 | - do_action( 'gravityview/edit_entry/before_update', $form, $this->entry['id'], $this, $gv_data ); |
|
392 | + do_action( 'gravityview/edit_entry/before_update', $form, $this->entry[ 'id' ], $this, $gv_data ); |
|
393 | 393 | |
394 | 394 | GFFormsModel::save_lead( $form, $this->entry ); |
395 | 395 | |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | * @param GravityView_Edit_Entry_Render $this This object |
420 | 420 | * @param GravityView_View_Data $gv_data The View data |
421 | 421 | */ |
422 | - do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'], $this, $gv_data ); |
|
422 | + do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ], $this, $gv_data ); |
|
423 | 423 | |
424 | 424 | } else { |
425 | 425 | gravityview()->log->error( 'Submission is NOT valid.', array( 'entry' => $this->entry ) ); |
@@ -455,10 +455,10 @@ discard block |
||
455 | 455 | |
456 | 456 | if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) { |
457 | 457 | $entry_meta_table = GFFormsModel::get_entry_meta_table_name(); |
458 | - $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) ); |
|
458 | + $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $this->entry[ 'id' ] ) ); |
|
459 | 459 | } else { |
460 | 460 | $lead_detail_table = GFFormsModel::get_lead_details_table_name(); |
461 | - $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) ); |
|
461 | + $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry[ 'id' ] ) ); |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | foreach ( $this->entry as $input_id => $field_value ) { |
@@ -476,11 +476,11 @@ discard block |
||
476 | 476 | |
477 | 477 | $empty_value = $field->get_value_save_entry( |
478 | 478 | is_array( $field->get_entry_inputs() ) ? array() : '', |
479 | - $this->form, '', $this->entry['id'], $this->entry |
|
479 | + $this->form, '', $this->entry[ 'id' ], $this->entry |
|
480 | 480 | ); |
481 | 481 | |
482 | 482 | if ( $field->has_calculation() ) { |
483 | - $this->unset_hidden_calculations[] = $field->id; // Unset |
|
483 | + $this->unset_hidden_calculations[ ] = $field->id; // Unset |
|
484 | 484 | $empty_value = ''; |
485 | 485 | } |
486 | 486 | |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | private function preset_approval_fields() { |
510 | 510 | $has_approved_field = false; |
511 | 511 | |
512 | - foreach ( self::$original_form['fields'] as $field ) { |
|
512 | + foreach ( self::$original_form[ 'fields' ] as $field ) { |
|
513 | 513 | if ( $field->gravityview_approved ) { |
514 | 514 | $has_approved_field = true; |
515 | 515 | break; |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | |
523 | 523 | $is_field_hidden = true; |
524 | 524 | |
525 | - foreach ( $this->form['fields'] as $field ) { |
|
525 | + foreach ( $this->form[ 'fields' ] as $field ) { |
|
526 | 526 | if ( $field->gravityview_approved ) { |
527 | 527 | $is_field_hidden = false; |
528 | 528 | break; |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | |
548 | 548 | remove_filter( 'gravityview/approve_entries/update_unapproved_meta', array( $this, 'prevent_update_unapproved_meta' ), 9 ); |
549 | 549 | |
550 | - if ( ! $value = gform_get_meta( $entry['id'], 'is_approved' ) ) { |
|
550 | + if ( ! $value = gform_get_meta( $entry[ 'id' ], 'is_approved' ) ) { |
|
551 | 551 | |
552 | 552 | $value = GravityView_Entry_Approval_Status::UNAPPROVED; |
553 | 553 | |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | } |
613 | 613 | |
614 | 614 | /** No file is being uploaded. */ |
615 | - if ( empty( $_FILES[ $input_name ]['name'] ) ) { |
|
615 | + if ( empty( $_FILES[ $input_name ][ 'name' ] ) ) { |
|
616 | 616 | /** So return the original upload, with $value as backup (it can be empty during edit form rendering) */ |
617 | 617 | return rgar( $entry, $input_id, $value ); |
618 | 618 | } |
@@ -630,11 +630,11 @@ discard block |
||
630 | 630 | * @return mixed |
631 | 631 | */ |
632 | 632 | public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) { |
633 | - if( ! $this->is_edit_entry() ) { |
|
633 | + if ( ! $this->is_edit_entry() ) { |
|
634 | 634 | return $plupload_init; |
635 | 635 | } |
636 | 636 | |
637 | - $plupload_init['gf_vars']['max_files'] = 0; |
|
637 | + $plupload_init[ 'gf_vars' ][ 'max_files' ] = 0; |
|
638 | 638 | |
639 | 639 | return $plupload_init; |
640 | 640 | } |
@@ -649,26 +649,26 @@ discard block |
||
649 | 649 | $form = $this->filter_conditional_logic( $this->form ); |
650 | 650 | |
651 | 651 | /** @type GF_Field $field */ |
652 | - foreach( $form['fields'] as $k => &$field ) { |
|
652 | + foreach ( $form[ 'fields' ] as $k => &$field ) { |
|
653 | 653 | |
654 | 654 | /** |
655 | 655 | * Remove the fields with calculation formulas before save to avoid conflicts with GF logic |
656 | 656 | * @since 1.16.3 |
657 | 657 | */ |
658 | - if( $field->has_calculation() ) { |
|
659 | - unset( $form['fields'][ $k ] ); |
|
658 | + if ( $field->has_calculation() ) { |
|
659 | + unset( $form[ 'fields' ][ $k ] ); |
|
660 | 660 | } |
661 | 661 | |
662 | 662 | $field->adminOnly = false; |
663 | 663 | |
664 | - if( isset( $field->inputs ) && is_array( $field->inputs ) ) { |
|
665 | - foreach( $field->inputs as $key => $input ) { |
|
666 | - $field->inputs[ $key ][ 'id' ] = (string)$input['id']; |
|
664 | + if ( isset( $field->inputs ) && is_array( $field->inputs ) ) { |
|
665 | + foreach ( $field->inputs as $key => $input ) { |
|
666 | + $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ]; |
|
667 | 667 | } |
668 | 668 | } |
669 | 669 | } |
670 | 670 | |
671 | - $form['fields'] = array_values( $form['fields'] ); |
|
671 | + $form[ 'fields' ] = array_values( $form[ 'fields' ] ); |
|
672 | 672 | |
673 | 673 | return $form; |
674 | 674 | } |
@@ -680,14 +680,14 @@ discard block |
||
680 | 680 | $update = false; |
681 | 681 | |
682 | 682 | // get the most up to date entry values |
683 | - $entry = GFAPI::get_entry( $this->entry['id'] ); |
|
683 | + $entry = GFAPI::get_entry( $this->entry[ 'id' ] ); |
|
684 | 684 | |
685 | 685 | if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) { |
686 | 686 | $entry_meta_table = GFFormsModel::get_entry_meta_table_name(); |
687 | - $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $entry['id'] ) ); |
|
687 | + $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $entry[ 'id' ] ) ); |
|
688 | 688 | } else { |
689 | 689 | $lead_detail_table = GFFormsModel::get_lead_details_table_name(); |
690 | - $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $entry['id'] ) ); |
|
690 | + $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $entry[ 'id' ] ) ); |
|
691 | 691 | } |
692 | 692 | |
693 | 693 | |
@@ -704,24 +704,24 @@ discard block |
||
704 | 704 | $inputs = $field->get_entry_inputs(); |
705 | 705 | if ( is_array( $inputs ) ) { |
706 | 706 | foreach ( $inputs as $input ) { |
707 | - list( $field_id, $input_id ) = rgexplode( '.', $input['id'], 2 ); |
|
707 | + list( $field_id, $input_id ) = rgexplode( '.', $input[ 'id' ], 2 ); |
|
708 | 708 | |
709 | 709 | if ( 'product' === $field->type ) { |
710 | - $input_name = 'input_' . str_replace( '.', '_', $input['id'] ); |
|
710 | + $input_name = 'input_' . str_replace( '.', '_', $input[ 'id' ] ); |
|
711 | 711 | |
712 | 712 | // Only allow quantity to be set if it's allowed to be edited |
713 | 713 | if ( in_array( $field_id, $allowed_fields ) && $input_id == 3 ) { |
714 | 714 | } else { // otherwise set to what it previously was |
715 | - $_POST[ $input_name ] = $entry[ $input['id'] ]; |
|
715 | + $_POST[ $input_name ] = $entry[ $input[ 'id' ] ]; |
|
716 | 716 | } |
717 | 717 | } else { |
718 | 718 | // Set to what it previously was if it's not editable |
719 | 719 | if ( ! in_array( $field_id, $allowed_fields ) ) { |
720 | - $_POST[ $input_name ] = $entry[ $input['id'] ]; |
|
720 | + $_POST[ $input_name ] = $entry[ $input[ 'id' ] ]; |
|
721 | 721 | } |
722 | 722 | } |
723 | 723 | |
724 | - GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input['id'] ); |
|
724 | + GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input[ 'id' ] ); |
|
725 | 725 | } |
726 | 726 | } else { |
727 | 727 | // Set to what it previously was if it's not editable |
@@ -761,19 +761,19 @@ discard block |
||
761 | 761 | |
762 | 762 | $input_name = 'input_' . $field_id; |
763 | 763 | |
764 | - if ( !empty( $_FILES[ $input_name ]['name'] ) ) { |
|
764 | + if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) { |
|
765 | 765 | |
766 | 766 | // We have a new image |
767 | 767 | |
768 | - $value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] ); |
|
768 | + $value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] ); |
|
769 | 769 | |
770 | 770 | $ary = ! empty( $value ) ? explode( '|:|', $value ) : array(); |
771 | 771 | $ary = stripslashes_deep( $ary ); |
772 | 772 | $img_url = \GV\Utils::get( $ary, 0 ); |
773 | 773 | |
774 | - $img_title = count( $ary ) > 1 ? $ary[1] : ''; |
|
775 | - $img_caption = count( $ary ) > 2 ? $ary[2] : ''; |
|
776 | - $img_description = count( $ary ) > 3 ? $ary[3] : ''; |
|
774 | + $img_title = count( $ary ) > 1 ? $ary[ 1 ] : ''; |
|
775 | + $img_caption = count( $ary ) > 2 ? $ary[ 2 ] : ''; |
|
776 | + $img_description = count( $ary ) > 3 ? $ary[ 3 ] : ''; |
|
777 | 777 | |
778 | 778 | $image_meta = array( |
779 | 779 | 'post_excerpt' => $img_caption, |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | |
783 | 783 | //adding title only if it is not empty. It will default to the file name if it is not in the array |
784 | 784 | if ( ! empty( $img_title ) ) { |
785 | - $image_meta['post_title'] = $img_title; |
|
785 | + $image_meta[ 'post_title' ] = $img_title; |
|
786 | 786 | } |
787 | 787 | |
788 | 788 | /** |
@@ -840,15 +840,15 @@ discard block |
||
840 | 840 | */ |
841 | 841 | private function maybe_update_post_fields( $form ) { |
842 | 842 | |
843 | - if( empty( $this->entry['post_id'] ) ) { |
|
843 | + if ( empty( $this->entry[ 'post_id' ] ) ) { |
|
844 | 844 | gravityview()->log->debug( 'This entry has no post fields. Continuing...' ); |
845 | 845 | return; |
846 | 846 | } |
847 | 847 | |
848 | - $post_id = $this->entry['post_id']; |
|
848 | + $post_id = $this->entry[ 'post_id' ]; |
|
849 | 849 | |
850 | 850 | // Security check |
851 | - if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) { |
|
851 | + if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) { |
|
852 | 852 | gravityview()->log->error( 'The current user does not have the ability to edit Post #{post_id}', array( 'post_id' => $post_id ) ); |
853 | 853 | return; |
854 | 854 | } |
@@ -861,25 +861,25 @@ discard block |
||
861 | 861 | |
862 | 862 | $field = RGFormsModel::get_field( $form, $field_id ); |
863 | 863 | |
864 | - if( ! $field ) { |
|
864 | + if ( ! $field ) { |
|
865 | 865 | continue; |
866 | 866 | } |
867 | 867 | |
868 | - if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) { |
|
868 | + if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) { |
|
869 | 869 | |
870 | 870 | // Get the value of the field, including $_POSTed value |
871 | 871 | $value = RGFormsModel::get_field_value( $field ); |
872 | 872 | |
873 | 873 | // Use temporary entry variable, to make values available to fill_post_template() and update_post_image() |
874 | 874 | $entry_tmp = $this->entry; |
875 | - $entry_tmp["{$field_id}"] = $value; |
|
875 | + $entry_tmp[ "{$field_id}" ] = $value; |
|
876 | 876 | |
877 | - switch( $field->type ) { |
|
877 | + switch ( $field->type ) { |
|
878 | 878 | |
879 | 879 | case 'post_title': |
880 | 880 | $post_title = $value; |
881 | 881 | if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) { |
882 | - $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp ); |
|
882 | + $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp ); |
|
883 | 883 | } |
884 | 884 | $updated_post->post_title = $post_title; |
885 | 885 | $updated_post->post_name = $post_title; |
@@ -889,7 +889,7 @@ discard block |
||
889 | 889 | case 'post_content': |
890 | 890 | $post_content = $value; |
891 | 891 | if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) { |
892 | - $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true ); |
|
892 | + $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true ); |
|
893 | 893 | } |
894 | 894 | $updated_post->post_content = $post_content; |
895 | 895 | unset( $post_content ); |
@@ -907,11 +907,11 @@ discard block |
||
907 | 907 | $value = $value[ $field_id ]; |
908 | 908 | } |
909 | 909 | |
910 | - if( ! empty( $field->customFieldTemplateEnabled ) ) { |
|
910 | + if ( ! empty( $field->customFieldTemplateEnabled ) ) { |
|
911 | 911 | $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true ); |
912 | 912 | } |
913 | 913 | |
914 | - $value = $field->get_value_save_entry( $value, $form, '', $this->entry['id'], $this->entry ); |
|
914 | + $value = $field->get_value_save_entry( $value, $form, '', $this->entry[ 'id' ], $this->entry ); |
|
915 | 915 | |
916 | 916 | update_post_meta( $post_id, $field->postCustomFieldName, $value ); |
917 | 917 | break; |
@@ -923,7 +923,7 @@ discard block |
||
923 | 923 | } |
924 | 924 | |
925 | 925 | // update entry after |
926 | - $this->entry["{$field_id}"] = $value; |
|
926 | + $this->entry[ "{$field_id}" ] = $value; |
|
927 | 927 | |
928 | 928 | $update_entry = true; |
929 | 929 | |
@@ -932,11 +932,11 @@ discard block |
||
932 | 932 | |
933 | 933 | } |
934 | 934 | |
935 | - if( $update_entry ) { |
|
935 | + if ( $update_entry ) { |
|
936 | 936 | |
937 | 937 | $return_entry = GFAPI::update_entry( $this->entry ); |
938 | 938 | |
939 | - if( is_wp_error( $return_entry ) ) { |
|
939 | + if ( is_wp_error( $return_entry ) ) { |
|
940 | 940 | gravityview()->log->error( 'Updating the entry post fields failed', array( 'data' => array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) ) ); |
941 | 941 | } else { |
942 | 942 | gravityview()->log->debug( 'Updating the entry post fields for post #{post_id} succeeded', array( 'post_id' => $post_id ) ); |
@@ -946,7 +946,7 @@ discard block |
||
946 | 946 | |
947 | 947 | $return_post = wp_update_post( $updated_post, true ); |
948 | 948 | |
949 | - if( is_wp_error( $return_post ) ) { |
|
949 | + if ( is_wp_error( $return_post ) ) { |
|
950 | 950 | $return_post->add_data( $updated_post, '$updated_post' ); |
951 | 951 | gravityview()->log->error( 'Updating the post content failed', array( 'data' => compact( 'updated_post', 'return_post' ) ) ); |
952 | 952 | } else { |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | $output = GFCommon::replace_variables( $output, $form, $entry, false, false, false ); |
981 | 981 | |
982 | 982 | // replace conditional shortcodes |
983 | - if( $do_shortcode ) { |
|
983 | + if ( $do_shortcode ) { |
|
984 | 984 | $output = do_shortcode( $output ); |
985 | 985 | } |
986 | 986 | |
@@ -999,19 +999,19 @@ discard block |
||
999 | 999 | */ |
1000 | 1000 | private function after_update() { |
1001 | 1001 | |
1002 | - do_action( 'gform_after_update_entry', self::$original_form, $this->entry['id'], self::$original_entry ); |
|
1003 | - do_action( "gform_after_update_entry_{$this->form['id']}", self::$original_form, $this->entry['id'], self::$original_entry ); |
|
1002 | + do_action( 'gform_after_update_entry', self::$original_form, $this->entry[ 'id' ], self::$original_entry ); |
|
1003 | + do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", self::$original_form, $this->entry[ 'id' ], self::$original_entry ); |
|
1004 | 1004 | |
1005 | 1005 | // Re-define the entry now that we've updated it. |
1006 | - $entry = RGFormsModel::get_lead( $this->entry['id'] ); |
|
1006 | + $entry = RGFormsModel::get_lead( $this->entry[ 'id' ] ); |
|
1007 | 1007 | |
1008 | 1008 | $entry = GFFormsModel::set_entry_meta( $entry, self::$original_form ); |
1009 | 1009 | |
1010 | 1010 | if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '<' ) ) { |
1011 | 1011 | // We need to clear the cache because Gravity Forms caches the field values, which |
1012 | 1012 | // we have just updated. |
1013 | - foreach ($this->form['fields'] as $key => $field) { |
|
1014 | - GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id ); |
|
1013 | + foreach ( $this->form[ 'fields' ] as $key => $field ) { |
|
1014 | + GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id ); |
|
1015 | 1015 | } |
1016 | 1016 | } |
1017 | 1017 | |
@@ -1021,11 +1021,11 @@ discard block |
||
1021 | 1021 | * @since develop |
1022 | 1022 | */ |
1023 | 1023 | if ( $allowed_feeds = $this->view->settings->get( 'edit_feeds', array() ) ) { |
1024 | - $feeds = GFAPI::get_feeds( null, $entry['form_id'] ); |
|
1024 | + $feeds = GFAPI::get_feeds( null, $entry[ 'form_id' ] ); |
|
1025 | 1025 | if ( ! is_wp_error( $feeds ) ) { |
1026 | 1026 | $registered_feeds = array(); |
1027 | 1027 | foreach ( GFAddOn::get_registered_addons() as $registered_feed ) { |
1028 | - if ( is_subclass_of( $registered_feed, 'GFFeedAddOn' ) ) { |
|
1028 | + if ( is_subclass_of( $registered_feed, 'GFFeedAddOn' ) ) { |
|
1029 | 1029 | if ( method_exists( $registered_feed, 'get_instance' ) ) { |
1030 | 1030 | $registered_feed = call_user_func( array( $registered_feed, 'get_instance' ) ); |
1031 | 1031 | $registered_feeds[ $registered_feed->get_slug() ] = $registered_feed; |
@@ -1033,8 +1033,8 @@ discard block |
||
1033 | 1033 | } |
1034 | 1034 | } |
1035 | 1035 | foreach ( $feeds as $feed ) { |
1036 | - if ( in_array( $feed['id'], $allowed_feeds ) ) { |
|
1037 | - if ( $feed_object = \GV\Utils::get( $registered_feeds, $feed['addon_slug'] ) ) { |
|
1036 | + if ( in_array( $feed[ 'id' ], $allowed_feeds ) ) { |
|
1037 | + if ( $feed_object = \GV\Utils::get( $registered_feeds, $feed[ 'addon_slug' ] ) ) { |
|
1038 | 1038 | $returned_entry = $feed_object->process_feed( $feed, $entry, self::$original_form ); |
1039 | 1039 | if ( is_array( $returned_entry ) && rgar( $returned_entry, 'id' ) ) { |
1040 | 1040 | $entry = $returned_entry; |
@@ -1062,9 +1062,9 @@ discard block |
||
1062 | 1062 | |
1063 | 1063 | $view = \GV\View::by_id( $this->view_id ); |
1064 | 1064 | |
1065 | - if( $view->settings->get( 'edit_locking' ) ) { |
|
1065 | + if ( $view->settings->get( 'edit_locking' ) ) { |
|
1066 | 1066 | $locking = new GravityView_Edit_Entry_Locking(); |
1067 | - $locking->maybe_lock_object( $this->entry['id'] ); |
|
1067 | + $locking->maybe_lock_object( $this->entry[ 'id' ] ); |
|
1068 | 1068 | } |
1069 | 1069 | |
1070 | 1070 | ?> |
@@ -1077,7 +1077,7 @@ discard block |
||
1077 | 1077 | |
1078 | 1078 | <div class="gv-edit-entry-wrapper"><?php |
1079 | 1079 | |
1080 | - $javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this ); |
|
1080 | + $javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this ); |
|
1081 | 1081 | |
1082 | 1082 | /** |
1083 | 1083 | * Fixes weird wpautop() issue |
@@ -1093,7 +1093,7 @@ discard block |
||
1093 | 1093 | * @param string $edit_entry_title Modify the "Edit Entry" title |
1094 | 1094 | * @param GravityView_Edit_Entry_Render $this This object |
1095 | 1095 | */ |
1096 | - $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gk-gravityview'), $this ); |
|
1096 | + $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gk-gravityview' ), $this ); |
|
1097 | 1097 | |
1098 | 1098 | echo esc_attr( $edit_entry_title ); |
1099 | 1099 | ?></span> |
@@ -1170,18 +1170,18 @@ discard block |
||
1170 | 1170 | */ |
1171 | 1171 | $labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id ); |
1172 | 1172 | |
1173 | - $this->is_paged_submitted = \GV\Utils::_POST( 'save' ) === $labels['submit']; |
|
1173 | + $this->is_paged_submitted = \GV\Utils::_POST( 'save' ) === $labels[ 'submit' ]; |
|
1174 | 1174 | } |
1175 | 1175 | |
1176 | 1176 | $back_link = remove_query_arg( array( 'page', 'view', 'edit', 'gvid' ) ); |
1177 | 1177 | |
1178 | - if( ! $this->is_valid ){ |
|
1178 | + if ( ! $this->is_valid ) { |
|
1179 | 1179 | |
1180 | 1180 | // Keeping this compatible with Gravity Forms. |
1181 | - $validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gk-gravityview') . " " . __('Errors have been highlighted below.', 'gk-gravityview') . "</div>"; |
|
1182 | - $message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form); |
|
1181 | + $validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gk-gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gk-gravityview' ) . "</div>"; |
|
1182 | + $message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form ); |
|
1183 | 1183 | |
1184 | - echo GVCommon::generate_notice( $message , 'gv-error' ); |
|
1184 | + echo GVCommon::generate_notice( $message, 'gv-error' ); |
|
1185 | 1185 | |
1186 | 1186 | } elseif ( false === $this->is_paged_submitted ) { |
1187 | 1187 | // Paged form that hasn't been submitted on the last page yet |
@@ -1194,7 +1194,7 @@ discard block |
||
1194 | 1194 | * @param int $view_id View ID |
1195 | 1195 | * @param array $entry Gravity Forms entry array |
1196 | 1196 | */ |
1197 | - $message = apply_filters( 'gravityview/edit_entry/page/success', $entry_updated_message , $this->view_id, $this->entry ); |
|
1197 | + $message = apply_filters( 'gravityview/edit_entry/page/success', $entry_updated_message, $this->view_id, $this->entry ); |
|
1198 | 1198 | |
1199 | 1199 | echo GVCommon::generate_notice( $message ); |
1200 | 1200 | } else { |
@@ -1206,23 +1206,23 @@ discard block |
||
1206 | 1206 | |
1207 | 1207 | case '0': |
1208 | 1208 | $redirect_url = $back_link; |
1209 | - $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gk-gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' ); |
|
1209 | + $entry_updated_message = sprintf( esc_attr_x( 'Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gk-gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', '</a>' ); |
|
1210 | 1210 | break; |
1211 | 1211 | |
1212 | 1212 | case '1': |
1213 | 1213 | $redirect_url = $directory_link = GravityView_API::directory_link(); |
1214 | - $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to %s%s', 'Replacement 1 is HTML. Replacement 2 is the title of the page where the user will be taken. Replacement 3 is HTML.','gk-gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' ); |
|
1214 | + $entry_updated_message = sprintf( esc_attr_x( 'Entry Updated. %sReturning to %s%s', 'Replacement 1 is HTML. Replacement 2 is the title of the page where the user will be taken. Replacement 3 is HTML.', 'gk-gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' ); |
|
1215 | 1215 | break; |
1216 | 1216 | |
1217 | 1217 | case '2': |
1218 | 1218 | $redirect_url = $edit_redirect_url; |
1219 | 1219 | $redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' ); |
1220 | - $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sRedirecting to %s%s', 'Replacement 1 is HTML. Replacement 2 is the URL where the user will be taken. Replacement 3 is HTML.','gk-gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' ); |
|
1220 | + $entry_updated_message = sprintf( esc_attr_x( 'Entry Updated. %sRedirecting to %s%s', 'Replacement 1 is HTML. Replacement 2 is the URL where the user will be taken. Replacement 3 is HTML.', 'gk-gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' ); |
|
1221 | 1221 | break; |
1222 | 1222 | |
1223 | 1223 | case '': |
1224 | 1224 | default: |
1225 | - $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gk-gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' ); |
|
1225 | + $entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gk-gravityview' ), '<a href="' . esc_url( $back_link ) . '">', '</a>' ); |
|
1226 | 1226 | break; |
1227 | 1227 | } |
1228 | 1228 | |
@@ -1263,8 +1263,8 @@ discard block |
||
1263 | 1263 | */ |
1264 | 1264 | do_action( 'gravityview/edit-entry/render/before', $this ); |
1265 | 1265 | |
1266 | - add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 ); |
|
1267 | - add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') ); |
|
1266 | + add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 ); |
|
1267 | + add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) ); |
|
1268 | 1268 | add_filter( 'gform_next_button', array( $this, 'render_form_buttons' ) ); |
1269 | 1269 | add_filter( 'gform_previous_button', array( $this, 'render_form_buttons' ) ); |
1270 | 1270 | add_filter( 'gform_disable_view_counter', '__return_true' ); |
@@ -1273,14 +1273,14 @@ discard block |
||
1273 | 1273 | add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 ); |
1274 | 1274 | |
1275 | 1275 | // We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin. |
1276 | - unset( $_GET['page'] ); |
|
1276 | + unset( $_GET[ 'page' ] ); |
|
1277 | 1277 | |
1278 | 1278 | $this->show_next_button = false; |
1279 | 1279 | $this->show_previous_button = false; |
1280 | 1280 | |
1281 | 1281 | // TODO: Verify multiple-page forms |
1282 | 1282 | if ( GFCommon::has_pages( $this->form ) && apply_filters( 'gravityview/features/paged-edit', false ) ) { |
1283 | - if ( intval( $page_number = \GV\Utils::_POST( 'gform_source_page_number_' . $this->form['id'], 0 ) ) ) { |
|
1283 | + if ( intval( $page_number = \GV\Utils::_POST( 'gform_source_page_number_' . $this->form[ 'id' ], 0 ) ) ) { |
|
1284 | 1284 | |
1285 | 1285 | $labels = array( |
1286 | 1286 | 'cancel' => __( 'Cancel', 'gk-gravityview' ), |
@@ -1299,20 +1299,20 @@ discard block |
||
1299 | 1299 | */ |
1300 | 1300 | $labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id ); |
1301 | 1301 | |
1302 | - GFFormDisplay::$submission[ $this->form['id'] ][ 'form' ] = $this->form; |
|
1303 | - GFFormDisplay::$submission[ $this->form['id'] ][ 'is_valid' ] = true; |
|
1302 | + GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'form' ] = $this->form; |
|
1303 | + GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'is_valid' ] = true; |
|
1304 | 1304 | |
1305 | - if ( \GV\Utils::_POST( 'save' ) === $labels['next'] ) { |
|
1305 | + if ( \GV\Utils::_POST( 'save' ) === $labels[ 'next' ] ) { |
|
1306 | 1306 | $last_page = \GFFormDisplay::get_max_page_number( $this->form ); |
1307 | 1307 | |
1308 | 1308 | while ( ++$page_number < $last_page && RGFormsModel::is_page_hidden( $this->form, $page_number, \GV\Utils::_POST( 'gform_field_values' ) ) ) { |
1309 | 1309 | } // Advance to next visible page |
1310 | - } elseif ( \GV\Utils::_POST( 'save' ) === $labels['previous'] ) { |
|
1310 | + } elseif ( \GV\Utils::_POST( 'save' ) === $labels[ 'previous' ] ) { |
|
1311 | 1311 | while ( --$page_number > 1 && RGFormsModel::is_page_hidden( $this->form, $page_number, \GV\Utils::_POST( 'gform_field_values' ) ) ) { |
1312 | 1312 | } // Advance to next visible page |
1313 | 1313 | } |
1314 | 1314 | |
1315 | - GFFormDisplay::$submission[ $this->form['id'] ]['page_number'] = $page_number; |
|
1315 | + GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'page_number' ] = $page_number; |
|
1316 | 1316 | } |
1317 | 1317 | |
1318 | 1318 | if ( ( $page_number = intval( $page_number ) ) < 2 ) { |
@@ -1338,7 +1338,7 @@ discard block |
||
1338 | 1338 | |
1339 | 1339 | ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic |
1340 | 1340 | |
1341 | - $html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry ); |
|
1341 | + $html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry ); |
|
1342 | 1342 | |
1343 | 1343 | ob_get_clean(); |
1344 | 1344 | |
@@ -1366,7 +1366,7 @@ discard block |
||
1366 | 1366 | * @return string |
1367 | 1367 | */ |
1368 | 1368 | public function render_form_buttons() { |
1369 | - return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this ); |
|
1369 | + return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this ); |
|
1370 | 1370 | } |
1371 | 1371 | |
1372 | 1372 | |
@@ -1385,15 +1385,15 @@ discard block |
||
1385 | 1385 | */ |
1386 | 1386 | public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) { |
1387 | 1387 | |
1388 | - if( $form['id'] != $this->form_id ) { |
|
1388 | + if ( $form[ 'id' ] != $this->form_id ) { |
|
1389 | 1389 | return $form; |
1390 | 1390 | } |
1391 | 1391 | |
1392 | 1392 | // In case we have validated the form, use it to inject the validation results into the form render |
1393 | - if( isset( $this->form_after_validation ) && $this->form_after_validation['id'] === $form['id'] ) { |
|
1393 | + if ( isset( $this->form_after_validation ) && $this->form_after_validation[ 'id' ] === $form[ 'id' ] ) { |
|
1394 | 1394 | $form = $this->form_after_validation; |
1395 | 1395 | } else { |
1396 | - $form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id ); |
|
1396 | + $form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id ); |
|
1397 | 1397 | } |
1398 | 1398 | |
1399 | 1399 | $form = $this->filter_conditional_logic( $form ); |
@@ -1401,8 +1401,8 @@ discard block |
||
1401 | 1401 | $form = $this->prefill_conditional_logic( $form ); |
1402 | 1402 | |
1403 | 1403 | // for now we don't support Save and Continue feature. |
1404 | - if( ! self::$supports_save_and_continue ) { |
|
1405 | - unset( $form['save'] ); |
|
1404 | + if ( ! self::$supports_save_and_continue ) { |
|
1405 | + unset( $form[ 'save' ] ); |
|
1406 | 1406 | } |
1407 | 1407 | |
1408 | 1408 | $form = $this->unselect_default_values( $form ); |
@@ -1425,29 +1425,29 @@ discard block |
||
1425 | 1425 | */ |
1426 | 1426 | public function verify_user_can_edit_post( $field_content = '', $field = null, $value = '', $lead_id = 0, $form_id = 0 ) { |
1427 | 1427 | |
1428 | - if( ! GFCommon::is_post_field( $field ) ) { |
|
1428 | + if ( ! GFCommon::is_post_field( $field ) ) { |
|
1429 | 1429 | return $field_content; |
1430 | 1430 | } |
1431 | 1431 | |
1432 | 1432 | $message = null; |
1433 | 1433 | |
1434 | 1434 | // First, make sure they have the capability to edit the post. |
1435 | - if( null === get_post( $this->entry['post_id'] ) ) { |
|
1435 | + if ( null === get_post( $this->entry[ 'post_id' ] ) ) { |
|
1436 | 1436 | /** |
1437 | 1437 | * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists |
1438 | 1438 | * @param string $message The existing "This field is not editable; the post no longer exists." text |
1439 | 1439 | */ |
1440 | - $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gk-gravityview' ) ); |
|
1441 | - } elseif( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) { |
|
1440 | + $message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gk-gravityview' ) ); |
|
1441 | + } elseif ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) { |
|
1442 | 1442 | /** |
1443 | 1443 | * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post |
1444 | 1444 | * @param string $message The existing "You don't have permission..." text |
1445 | 1445 | */ |
1446 | - $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don’t have permission to edit this post.', 'gk-gravityview') ); |
|
1446 | + $message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don’t have permission to edit this post.', 'gk-gravityview' ) ); |
|
1447 | 1447 | } |
1448 | 1448 | |
1449 | - if( $message ) { |
|
1450 | - $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) ); |
|
1449 | + if ( $message ) { |
|
1450 | + $field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) ); |
|
1451 | 1451 | } |
1452 | 1452 | |
1453 | 1453 | return $field_content; |
@@ -1471,8 +1471,8 @@ discard block |
||
1471 | 1471 | |
1472 | 1472 | // If the form has been submitted, then we don't need to pre-fill the values, |
1473 | 1473 | // Except for fileupload type and when a field input is overridden- run always!! |
1474 | - if( |
|
1475 | - ( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) ) |
|
1474 | + if ( |
|
1475 | + ( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) ) |
|
1476 | 1476 | && false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) |
1477 | 1477 | && ! GFCommon::is_product_field( $field->type ) |
1478 | 1478 | || ! empty( $field_content ) |
@@ -1492,7 +1492,7 @@ discard block |
||
1492 | 1492 | $return = null; |
1493 | 1493 | |
1494 | 1494 | /** @var GravityView_Field $gv_field */ |
1495 | - if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) { |
|
1495 | + if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) { |
|
1496 | 1496 | $return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field ); |
1497 | 1497 | } else { |
1498 | 1498 | $return = $field->get_field_input( $this->form, $field_value, $this->entry ); |
@@ -1501,7 +1501,7 @@ discard block |
||
1501 | 1501 | // If there was output, it's an error |
1502 | 1502 | $warnings = ob_get_clean(); |
1503 | 1503 | |
1504 | - if( !empty( $warnings ) ) { |
|
1504 | + if ( ! empty( $warnings ) ) { |
|
1505 | 1505 | gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) ); |
1506 | 1506 | } |
1507 | 1507 | |
@@ -1526,7 +1526,7 @@ discard block |
||
1526 | 1526 | $override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field ); |
1527 | 1527 | |
1528 | 1528 | // We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs) |
1529 | - if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) { |
|
1529 | + if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) { |
|
1530 | 1530 | |
1531 | 1531 | $field_value = array(); |
1532 | 1532 | |
@@ -1535,10 +1535,10 @@ discard block |
||
1535 | 1535 | |
1536 | 1536 | foreach ( (array)$field->inputs as $input ) { |
1537 | 1537 | |
1538 | - $input_id = strval( $input['id'] ); |
|
1538 | + $input_id = strval( $input[ 'id' ] ); |
|
1539 | 1539 | |
1540 | 1540 | if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) { |
1541 | - $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ]; |
|
1541 | + $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ]; |
|
1542 | 1542 | $allow_pre_populated = false; |
1543 | 1543 | } |
1544 | 1544 | |
@@ -1546,7 +1546,7 @@ discard block |
||
1546 | 1546 | |
1547 | 1547 | $pre_value = $field->get_value_submission( array(), false ); |
1548 | 1548 | |
1549 | - $field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value; |
|
1549 | + $field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value; |
|
1550 | 1550 | |
1551 | 1551 | } else { |
1552 | 1552 | |
@@ -1557,13 +1557,13 @@ discard block |
||
1557 | 1557 | |
1558 | 1558 | // saved field entry value (if empty, fallback to the pre-populated value, if exists) |
1559 | 1559 | // or pre-populated value if not empty and set to override saved value |
1560 | - $field_value = isset( $this->entry[ $id ] ) && ! gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value; |
|
1560 | + $field_value = isset( $this->entry[ $id ] ) && ! gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value; |
|
1561 | 1561 | |
1562 | 1562 | // in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs. |
1563 | - if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) { |
|
1563 | + if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) { |
|
1564 | 1564 | $categories = array(); |
1565 | 1565 | foreach ( explode( ',', $field_value ) as $cat_string ) { |
1566 | - $categories[] = GFCommon::format_post_category( $cat_string, true ); |
|
1566 | + $categories[ ] = GFCommon::format_post_category( $cat_string, true ); |
|
1567 | 1567 | } |
1568 | 1568 | $field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories ); |
1569 | 1569 | } |
@@ -1591,7 +1591,7 @@ discard block |
||
1591 | 1591 | * @param GF_Field $field Gravity Forms field object |
1592 | 1592 | * @param GravityView_Edit_Entry_Render $this Current object |
1593 | 1593 | */ |
1594 | - $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this ); |
|
1594 | + $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this ); |
|
1595 | 1595 | |
1596 | 1596 | return $field_value; |
1597 | 1597 | } |
@@ -1608,12 +1608,12 @@ discard block |
||
1608 | 1608 | */ |
1609 | 1609 | public function gform_pre_validation( $form ) { |
1610 | 1610 | |
1611 | - if( ! $this->verify_nonce() ) { |
|
1611 | + if ( ! $this->verify_nonce() ) { |
|
1612 | 1612 | return $form; |
1613 | 1613 | } |
1614 | 1614 | |
1615 | 1615 | // Fix PHP warning regarding undefined index. |
1616 | - foreach ( $form['fields'] as &$field) { |
|
1616 | + foreach ( $form[ 'fields' ] as &$field ) { |
|
1617 | 1617 | |
1618 | 1618 | // This is because we're doing admin form pretending to be front-end, so Gravity Forms |
1619 | 1619 | // expects certain field array items to be set. |
@@ -1621,7 +1621,7 @@ discard block |
||
1621 | 1621 | $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL; |
1622 | 1622 | } |
1623 | 1623 | |
1624 | - switch( RGFormsModel::get_input_type( $field ) ) { |
|
1624 | + switch ( RGFormsModel::get_input_type( $field ) ) { |
|
1625 | 1625 | |
1626 | 1626 | /** |
1627 | 1627 | * this whole fileupload hack is because in the admin, Gravity Forms simply doesn't update any fileupload field if it's empty, but it DOES in the frontend. |
@@ -1635,26 +1635,26 @@ discard block |
||
1635 | 1635 | // Set the previous value |
1636 | 1636 | $entry = $this->get_entry(); |
1637 | 1637 | |
1638 | - $input_name = 'input_'.$field->id; |
|
1639 | - $form_id = $form['id']; |
|
1638 | + $input_name = 'input_' . $field->id; |
|
1639 | + $form_id = $form[ 'id' ]; |
|
1640 | 1640 | |
1641 | 1641 | $value = NULL; |
1642 | 1642 | |
1643 | 1643 | // Use the previous entry value as the default. |
1644 | - if( isset( $entry[ $field->id ] ) ) { |
|
1644 | + if ( isset( $entry[ $field->id ] ) ) { |
|
1645 | 1645 | $value = $entry[ $field->id ]; |
1646 | 1646 | } |
1647 | 1647 | |
1648 | 1648 | // If this is a single upload file |
1649 | - if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) { |
|
1650 | - $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] ); |
|
1651 | - $value = $file_path['url']; |
|
1649 | + if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) { |
|
1650 | + $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] ); |
|
1651 | + $value = $file_path[ 'url' ]; |
|
1652 | 1652 | |
1653 | 1653 | } else { |
1654 | 1654 | |
1655 | 1655 | // Fix PHP warning on line 1498 of form_display.php for post_image fields |
1656 | 1656 | // Fix PHP Notice: Undefined index: size in form_display.php on line 1511 |
1657 | - $_FILES[ $input_name ] = array('name' => '', 'size' => '' ); |
|
1657 | + $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' ); |
|
1658 | 1658 | |
1659 | 1659 | } |
1660 | 1660 | |
@@ -1664,7 +1664,7 @@ discard block |
||
1664 | 1664 | if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) { |
1665 | 1665 | $value = empty( $value ) ? '[]' : $value; |
1666 | 1666 | $value = stripslashes_deep( $value ); |
1667 | - $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array() ); |
|
1667 | + $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() ); |
|
1668 | 1668 | } else if ( GFCommon::is_json( $value ) ) { |
1669 | 1669 | // Existing file; let GF derive the value from the `$_gf_uploaded_files` object (see `\GF_Field_FileUpload::get_multifile_value()`) |
1670 | 1670 | global $_gf_uploaded_files; |
@@ -1684,8 +1684,8 @@ discard block |
||
1684 | 1684 | |
1685 | 1685 | case 'number': |
1686 | 1686 | // Fix "undefined index" issue at line 1286 in form_display.php |
1687 | - if( !isset( $_POST['input_'.$field->id ] ) ) { |
|
1688 | - $_POST['input_'.$field->id ] = NULL; |
|
1687 | + if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) { |
|
1688 | + $_POST[ 'input_' . $field->id ] = NULL; |
|
1689 | 1689 | } |
1690 | 1690 | break; |
1691 | 1691 | } |
@@ -1722,7 +1722,7 @@ discard block |
||
1722 | 1722 | * You can enter whatever you want! |
1723 | 1723 | * We try validating, and customize the results using `self::custom_validation()` |
1724 | 1724 | */ |
1725 | - add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4); |
|
1725 | + add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 ); |
|
1726 | 1726 | |
1727 | 1727 | // Needed by the validate funtion |
1728 | 1728 | $failed_validation_page = NULL; |
@@ -1730,14 +1730,14 @@ discard block |
||
1730 | 1730 | |
1731 | 1731 | // Prevent entry limit from running when editing an entry, also |
1732 | 1732 | // prevent form scheduling from preventing editing |
1733 | - unset( $this->form['limitEntries'], $this->form['scheduleForm'] ); |
|
1733 | + unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] ); |
|
1734 | 1734 | |
1735 | 1735 | // Hide fields depending on Edit Entry settings |
1736 | - $this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id ); |
|
1736 | + $this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id ); |
|
1737 | 1737 | |
1738 | 1738 | $this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page ); |
1739 | 1739 | |
1740 | - remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 ); |
|
1740 | + remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 ); |
|
1741 | 1741 | } |
1742 | 1742 | |
1743 | 1743 | |
@@ -1765,7 +1765,7 @@ discard block |
||
1765 | 1765 | |
1766 | 1766 | $gv_valid = true; |
1767 | 1767 | |
1768 | - foreach ( $validation_results['form']['fields'] as $key => &$field ) { |
|
1768 | + foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) { |
|
1769 | 1769 | $value = RGFormsModel::get_field_value( $field ); |
1770 | 1770 | $field_type = RGFormsModel::get_input_type( $field ); |
1771 | 1771 | $is_required = ! empty( $field->isRequired ); |
@@ -1773,7 +1773,7 @@ discard block |
||
1773 | 1773 | |
1774 | 1774 | // Manually validate required fields as they can be skipped be skipped by GF's validation |
1775 | 1775 | // This can happen when the field is considered "hidden" (see `GFFormDisplay::validate`) due to unmet conditional logic |
1776 | - if ( $is_required && !$failed_validation && rgblank( $value ) ) { |
|
1776 | + if ( $is_required && ! $failed_validation && rgblank( $value ) ) { |
|
1777 | 1777 | $field->failed_validation = true; |
1778 | 1778 | $field->validation_message = esc_html__( 'This field is required.', 'gk-gravityview' ); |
1779 | 1779 | |
@@ -1797,7 +1797,7 @@ discard block |
||
1797 | 1797 | if ( \GV\Utils::get( $field, 'maxFiles' ) && \GV\Utils::get( $field, 'multipleFiles' ) ) { |
1798 | 1798 | $input_name = 'input_' . $field->id; |
1799 | 1799 | //uploaded |
1800 | - $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array(); |
|
1800 | + $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array(); |
|
1801 | 1801 | |
1802 | 1802 | //existent |
1803 | 1803 | $entry = $this->get_entry(); |
@@ -1816,7 +1816,7 @@ discard block |
||
1816 | 1816 | $gv_valid = false; |
1817 | 1817 | |
1818 | 1818 | // in case of error make sure the newest upload files are removed from the upload input |
1819 | - GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null; |
|
1819 | + GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null; |
|
1820 | 1820 | } |
1821 | 1821 | } |
1822 | 1822 | |
@@ -1824,7 +1824,7 @@ discard block |
||
1824 | 1824 | } |
1825 | 1825 | |
1826 | 1826 | // This field has failed validation. |
1827 | - if( !empty( $field->failed_validation ) ) { |
|
1827 | + if ( ! empty( $field->failed_validation ) ) { |
|
1828 | 1828 | |
1829 | 1829 | gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'data' => array( 'field' => $field, 'value' => $value ) ) ); |
1830 | 1830 | |
@@ -1842,19 +1842,19 @@ discard block |
||
1842 | 1842 | } |
1843 | 1843 | |
1844 | 1844 | // You can't continue inside a switch, so we do it after. |
1845 | - if( empty( $field->failed_validation ) ) { |
|
1845 | + if ( empty( $field->failed_validation ) ) { |
|
1846 | 1846 | continue; |
1847 | 1847 | } |
1848 | 1848 | |
1849 | 1849 | // checks if the No Duplicates option is not validating entry against itself, since |
1850 | 1850 | // we're editing a stored entry, it would also assume it's a duplicate. |
1851 | - if( !empty( $field->noDuplicates ) ) { |
|
1851 | + if ( ! empty( $field->noDuplicates ) ) { |
|
1852 | 1852 | |
1853 | 1853 | $entry = $this->get_entry(); |
1854 | 1854 | |
1855 | 1855 | // If the value of the entry is the same as the stored value |
1856 | 1856 | // Then we can assume it's not a duplicate, it's the same. |
1857 | - if( !empty( $entry ) && $value == $entry[ $field->id ] ) { |
|
1857 | + if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) { |
|
1858 | 1858 | //if value submitted was not changed, then don't validate |
1859 | 1859 | $field->failed_validation = false; |
1860 | 1860 | |
@@ -1867,7 +1867,7 @@ discard block |
||
1867 | 1867 | } |
1868 | 1868 | |
1869 | 1869 | // if here then probably we are facing the validation 'At least one field must be filled out' |
1870 | - if( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) { |
|
1870 | + if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) { |
|
1871 | 1871 | unset( $field->validation_message ); |
1872 | 1872 | $field->failed_validation = false; |
1873 | 1873 | continue; |
@@ -1879,12 +1879,12 @@ discard block |
||
1879 | 1879 | |
1880 | 1880 | } |
1881 | 1881 | |
1882 | - $validation_results['is_valid'] = $gv_valid; |
|
1882 | + $validation_results[ 'is_valid' ] = $gv_valid; |
|
1883 | 1883 | |
1884 | 1884 | gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Validation results.', array( 'data' => $validation_results ) ); |
1885 | 1885 | |
1886 | 1886 | // We'll need this result when rendering the form ( on GFFormDisplay::get_form ) |
1887 | - $this->form_after_validation = $validation_results['form']; |
|
1887 | + $this->form_after_validation = $validation_results[ 'form' ]; |
|
1888 | 1888 | |
1889 | 1889 | return $validation_results; |
1890 | 1890 | } |
@@ -1897,7 +1897,7 @@ discard block |
||
1897 | 1897 | */ |
1898 | 1898 | public function get_entry() { |
1899 | 1899 | |
1900 | - if( empty( $this->entry ) ) { |
|
1900 | + if ( empty( $this->entry ) ) { |
|
1901 | 1901 | // Get the database value of the entry that's being edited |
1902 | 1902 | $this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() ); |
1903 | 1903 | } |
@@ -1929,10 +1929,10 @@ discard block |
||
1929 | 1929 | } |
1930 | 1930 | |
1931 | 1931 | // If edit tab not yet configured, show all fields |
1932 | - $edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL; |
|
1932 | + $edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL; |
|
1933 | 1933 | |
1934 | 1934 | // Hide fields depending on admin settings |
1935 | - $fields = $this->filter_fields( $form['fields'], $edit_fields ); |
|
1935 | + $fields = $this->filter_fields( $form[ 'fields' ], $edit_fields ); |
|
1936 | 1936 | |
1937 | 1937 | // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't. |
1938 | 1938 | $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id ); |
@@ -1965,7 +1965,7 @@ discard block |
||
1965 | 1965 | */ |
1966 | 1966 | private function filter_fields( $fields, $configured_fields ) { |
1967 | 1967 | |
1968 | - if( empty( $fields ) || !is_array( $fields ) ) { |
|
1968 | + if ( empty( $fields ) || ! is_array( $fields ) ) { |
|
1969 | 1969 | return $fields; |
1970 | 1970 | } |
1971 | 1971 | |
@@ -1982,12 +1982,12 @@ discard block |
||
1982 | 1982 | |
1983 | 1983 | // Remove the fields that have calculation properties and keep them to be used later |
1984 | 1984 | // @since 1.16.2 |
1985 | - if( $field->has_calculation() ) { |
|
1986 | - $this->fields_with_calculation[] = $field; |
|
1985 | + if ( $field->has_calculation() ) { |
|
1986 | + $this->fields_with_calculation[ ] = $field; |
|
1987 | 1987 | // don't remove the calculation fields on form render. |
1988 | 1988 | } |
1989 | 1989 | |
1990 | - if( in_array( $field->type, $field_type_blocklist ) ) { |
|
1990 | + if ( in_array( $field->type, $field_type_blocklist ) ) { |
|
1991 | 1991 | unset( $fields[ $key ] ); |
1992 | 1992 | } |
1993 | 1993 | } |
@@ -2017,7 +2017,7 @@ discard block |
||
2017 | 2017 | continue; // Never include when no fields are configured |
2018 | 2018 | } |
2019 | 2019 | |
2020 | - $out_fields[] = $field; |
|
2020 | + $out_fields[ ] = $field; |
|
2021 | 2021 | } |
2022 | 2022 | |
2023 | 2023 | return array_values( $out_fields ); |
@@ -2028,8 +2028,8 @@ discard block |
||
2028 | 2028 | |
2029 | 2029 | /** @var GF_Field $field */ |
2030 | 2030 | foreach ( $fields as $field ) { |
2031 | - if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) { |
|
2032 | - $edit_fields[] = $this->merge_field_properties( $field, $configured_field ); |
|
2031 | + if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) { |
|
2032 | + $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field ); |
|
2033 | 2033 | break; |
2034 | 2034 | } |
2035 | 2035 | |
@@ -2052,14 +2052,14 @@ discard block |
||
2052 | 2052 | |
2053 | 2053 | $return_field = $field; |
2054 | 2054 | |
2055 | - if( empty( $field_setting['show_label'] ) ) { |
|
2055 | + if ( empty( $field_setting[ 'show_label' ] ) ) { |
|
2056 | 2056 | $return_field->label = ''; |
2057 | - } elseif ( !empty( $field_setting['custom_label'] ) ) { |
|
2058 | - $return_field->label = $field_setting['custom_label']; |
|
2057 | + } elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) { |
|
2058 | + $return_field->label = $field_setting[ 'custom_label' ]; |
|
2059 | 2059 | } |
2060 | 2060 | |
2061 | - if( !empty( $field_setting['custom_class'] ) ) { |
|
2062 | - $return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] ); |
|
2061 | + if ( ! empty( $field_setting[ 'custom_class' ] ) ) { |
|
2062 | + $return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] ); |
|
2063 | 2063 | } |
2064 | 2064 | |
2065 | 2065 | /** |
@@ -2097,16 +2097,16 @@ discard block |
||
2097 | 2097 | */ |
2098 | 2098 | $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id ); |
2099 | 2099 | |
2100 | - if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) { |
|
2101 | - foreach( $fields as $k => $field ) { |
|
2102 | - if( $field->adminOnly ) { |
|
2100 | + if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) { |
|
2101 | + foreach ( $fields as $k => $field ) { |
|
2102 | + if ( $field->adminOnly ) { |
|
2103 | 2103 | unset( $fields[ $k ] ); |
2104 | 2104 | } |
2105 | 2105 | } |
2106 | 2106 | return array_values( $fields ); |
2107 | 2107 | } |
2108 | 2108 | |
2109 | - foreach( $fields as &$field ) { |
|
2109 | + foreach ( $fields as &$field ) { |
|
2110 | 2110 | $field->adminOnly = false; |
2111 | 2111 | } |
2112 | 2112 | |
@@ -2127,7 +2127,7 @@ discard block |
||
2127 | 2127 | */ |
2128 | 2128 | private function unselect_default_values( $form ) { |
2129 | 2129 | |
2130 | - foreach ( $form['fields'] as &$field ) { |
|
2130 | + foreach ( $form[ 'fields' ] as &$field ) { |
|
2131 | 2131 | |
2132 | 2132 | if ( empty( $field->choices ) ) { |
2133 | 2133 | continue; |
@@ -2135,7 +2135,7 @@ discard block |
||
2135 | 2135 | |
2136 | 2136 | foreach ( $field->choices as &$choice ) { |
2137 | 2137 | if ( \GV\Utils::get( $choice, 'isSelected' ) ) { |
2138 | - $choice['isSelected'] = false; |
|
2138 | + $choice[ 'isSelected' ] = false; |
|
2139 | 2139 | } |
2140 | 2140 | } |
2141 | 2141 | } |
@@ -2160,22 +2160,22 @@ discard block |
||
2160 | 2160 | */ |
2161 | 2161 | function prefill_conditional_logic( $form ) { |
2162 | 2162 | |
2163 | - if( ! GFFormDisplay::has_conditional_logic( $form ) ) { |
|
2163 | + if ( ! GFFormDisplay::has_conditional_logic( $form ) ) { |
|
2164 | 2164 | return $form; |
2165 | 2165 | } |
2166 | 2166 | |
2167 | 2167 | // Have Conditional Logic pre-fill fields as if the data were default values |
2168 | 2168 | /** @var GF_Field $field */ |
2169 | - foreach ( $form['fields'] as &$field ) { |
|
2169 | + foreach ( $form[ 'fields' ] as &$field ) { |
|
2170 | 2170 | |
2171 | - if( 'checkbox' === $field->type ) { |
|
2171 | + if ( 'checkbox' === $field->type ) { |
|
2172 | 2172 | foreach ( $field->get_entry_inputs() as $key => $input ) { |
2173 | - $input_id = $input['id']; |
|
2173 | + $input_id = $input[ 'id' ]; |
|
2174 | 2174 | $choice = $field->choices[ $key ]; |
2175 | 2175 | $value = \GV\Utils::get( $this->entry, $input_id ); |
2176 | 2176 | $match = RGFormsModel::choice_value_match( $field, $choice, $value ); |
2177 | - if( $match ) { |
|
2178 | - $field->choices[ $key ]['isSelected'] = true; |
|
2177 | + if ( $match ) { |
|
2178 | + $field->choices[ $key ][ 'isSelected' ] = true; |
|
2179 | 2179 | } |
2180 | 2180 | } |
2181 | 2181 | } else { |
@@ -2183,15 +2183,15 @@ discard block |
||
2183 | 2183 | // We need to run through each field to set the default values |
2184 | 2184 | foreach ( $this->entry as $field_id => $field_value ) { |
2185 | 2185 | |
2186 | - if( floatval( $field_id ) === floatval( $field->id ) ) { |
|
2186 | + if ( floatval( $field_id ) === floatval( $field->id ) ) { |
|
2187 | 2187 | |
2188 | - if( 'list' === $field->type ) { |
|
2188 | + if ( 'list' === $field->type ) { |
|
2189 | 2189 | $list_rows = maybe_unserialize( $field_value ); |
2190 | 2190 | |
2191 | 2191 | $list_field_value = array(); |
2192 | - foreach ( (array) $list_rows as $row ) { |
|
2193 | - foreach ( (array) $row as $column ) { |
|
2194 | - $list_field_value[] = $column; |
|
2192 | + foreach ( (array)$list_rows as $row ) { |
|
2193 | + foreach ( (array)$row as $column ) { |
|
2194 | + $list_field_value[ ] = $column; |
|
2195 | 2195 | } |
2196 | 2196 | } |
2197 | 2197 | |
@@ -2224,32 +2224,32 @@ discard block |
||
2224 | 2224 | * @see https://github.com/gravityview/GravityView/issues/840 |
2225 | 2225 | * @since develop |
2226 | 2226 | */ |
2227 | - $the_form = GFAPI::get_form( $form['id'] ); |
|
2227 | + $the_form = GFAPI::get_form( $form[ 'id' ] ); |
|
2228 | 2228 | $editable_ids = array(); |
2229 | - foreach ( $form['fields'] as $field ) { |
|
2230 | - $editable_ids[] = $field['id']; // wp_list_pluck is destructive in this context |
|
2229 | + foreach ( $form[ 'fields' ] as $field ) { |
|
2230 | + $editable_ids[ ] = $field[ 'id' ]; // wp_list_pluck is destructive in this context |
|
2231 | 2231 | } |
2232 | 2232 | $remove_conditions_rule = array(); |
2233 | - foreach ( $the_form['fields'] as $field ) { |
|
2234 | - if ( ! empty( $field->conditionalLogic ) && ! empty( $field->conditionalLogic['rules'] ) ) { |
|
2235 | - foreach ( $field->conditionalLogic['rules'] as $i => $rule ) { |
|
2236 | - if ( ! in_array( $rule['fieldId'], $editable_ids ) ) { |
|
2233 | + foreach ( $the_form[ 'fields' ] as $field ) { |
|
2234 | + if ( ! empty( $field->conditionalLogic ) && ! empty( $field->conditionalLogic[ 'rules' ] ) ) { |
|
2235 | + foreach ( $field->conditionalLogic[ 'rules' ] as $i => $rule ) { |
|
2236 | + if ( ! in_array( $rule[ 'fieldId' ], $editable_ids ) ) { |
|
2237 | 2237 | /** |
2238 | 2238 | * This conditional field is not editable in this View. |
2239 | 2239 | * We need to remove the rule, but only if it matches. |
2240 | 2240 | */ |
2241 | - if ( $_field = GFAPI::get_field( $the_form, $rule['fieldId'] ) ) { |
|
2241 | + if ( $_field = GFAPI::get_field( $the_form, $rule[ 'fieldId' ] ) ) { |
|
2242 | 2242 | $value = $_field->get_value_export( $this->entry ); |
2243 | - } elseif ( isset( $this->entry[ $rule['fieldId'] ] ) ) { |
|
2244 | - $value = $this->entry[ $rule['fieldId'] ]; |
|
2243 | + } elseif ( isset( $this->entry[ $rule[ 'fieldId' ] ] ) ) { |
|
2244 | + $value = $this->entry[ $rule[ 'fieldId' ] ]; |
|
2245 | 2245 | } else { |
2246 | - $value = gform_get_meta( $this->entry['id'], $rule['fieldId'] ); |
|
2246 | + $value = gform_get_meta( $this->entry[ 'id' ], $rule[ 'fieldId' ] ); |
|
2247 | 2247 | } |
2248 | 2248 | |
2249 | - $match = GFFormsModel::matches_operation( $value, $rule['value'], $rule['operator'] ); |
|
2249 | + $match = GFFormsModel::matches_operation( $value, $rule[ 'value' ], $rule[ 'operator' ] ); |
|
2250 | 2250 | |
2251 | 2251 | if ( $match ) { |
2252 | - $remove_conditions_rule[] = array( $field['id'], $i ); |
|
2252 | + $remove_conditions_rule[ ] = array( $field[ 'id' ], $i ); |
|
2253 | 2253 | } |
2254 | 2254 | } |
2255 | 2255 | } |
@@ -2257,21 +2257,21 @@ discard block |
||
2257 | 2257 | } |
2258 | 2258 | |
2259 | 2259 | if ( $remove_conditions_rule ) { |
2260 | - foreach ( $form['fields'] as &$field ) { |
|
2260 | + foreach ( $form[ 'fields' ] as &$field ) { |
|
2261 | 2261 | foreach ( $remove_conditions_rule as $_remove_conditions_r ) { |
2262 | 2262 | |
2263 | 2263 | list( $rule_field_id, $rule_i ) = $_remove_conditions_r; |
2264 | 2264 | |
2265 | - if ( $field['id'] == $rule_field_id ) { |
|
2266 | - unset( $field->conditionalLogic['rules'][ $rule_i ] ); |
|
2267 | - gravityview()->log->debug( 'Removed conditional rule #{rule} for field {field_id}', array( 'rule' => $rule_i, 'field_id' => $field['id'] ) ); |
|
2265 | + if ( $field[ 'id' ] == $rule_field_id ) { |
|
2266 | + unset( $field->conditionalLogic[ 'rules' ][ $rule_i ] ); |
|
2267 | + gravityview()->log->debug( 'Removed conditional rule #{rule} for field {field_id}', array( 'rule' => $rule_i, 'field_id' => $field[ 'id' ] ) ); |
|
2268 | 2268 | } |
2269 | 2269 | } |
2270 | 2270 | } |
2271 | 2271 | } |
2272 | 2272 | |
2273 | 2273 | /** Normalize the indices... */ |
2274 | - $form['fields'] = array_values( $form['fields'] ); |
|
2274 | + $form[ 'fields' ] = array_values( $form[ 'fields' ] ); |
|
2275 | 2275 | |
2276 | 2276 | /** |
2277 | 2277 | * @filter `gravityview/edit_entry/conditional_logic` Should the Edit Entry form use Gravity Forms conditional logic showing/hiding of fields? |
@@ -2281,16 +2281,16 @@ discard block |
||
2281 | 2281 | */ |
2282 | 2282 | $use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form ); |
2283 | 2283 | |
2284 | - if( $use_conditional_logic ) { |
|
2284 | + if ( $use_conditional_logic ) { |
|
2285 | 2285 | return $form; |
2286 | 2286 | } |
2287 | 2287 | |
2288 | - foreach( $form['fields'] as &$field ) { |
|
2288 | + foreach ( $form[ 'fields' ] as &$field ) { |
|
2289 | 2289 | /* @var GF_Field $field */ |
2290 | 2290 | $field->conditionalLogic = null; |
2291 | 2291 | } |
2292 | 2292 | |
2293 | - unset( $form['button']['conditionalLogic'] ); |
|
2293 | + unset( $form[ 'button' ][ 'conditionalLogic' ] ); |
|
2294 | 2294 | |
2295 | 2295 | return $form; |
2296 | 2296 | |
@@ -2307,7 +2307,7 @@ discard block |
||
2307 | 2307 | */ |
2308 | 2308 | public function manage_conditional_logic( $has_conditional_logic, $form ) { |
2309 | 2309 | |
2310 | - if( ! $this->is_edit_entry() ) { |
|
2310 | + if ( ! $this->is_edit_entry() ) { |
|
2311 | 2311 | return $has_conditional_logic; |
2312 | 2312 | } |
2313 | 2313 | |
@@ -2339,44 +2339,44 @@ discard block |
||
2339 | 2339 | * 2. There are two entries embedded using oEmbed |
2340 | 2340 | * 3. One of the entries has just been saved |
2341 | 2341 | */ |
2342 | - if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) { |
|
2342 | + if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) { |
|
2343 | 2343 | |
2344 | 2344 | $error = true; |
2345 | 2345 | |
2346 | 2346 | } |
2347 | 2347 | |
2348 | - if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) { |
|
2348 | + if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) { |
|
2349 | 2349 | |
2350 | 2350 | $error = true; |
2351 | 2351 | |
2352 | - } elseif( ! $this->verify_nonce() ) { |
|
2352 | + } elseif ( ! $this->verify_nonce() ) { |
|
2353 | 2353 | |
2354 | 2354 | /** |
2355 | 2355 | * If the Entry is embedded, there may be two entries on the same page. |
2356 | 2356 | * If that's the case, and one is being edited, the other should fail gracefully and not display an error. |
2357 | 2357 | */ |
2358 | - if( GravityView_oEmbed::getInstance()->get_entry_id() ) { |
|
2358 | + if ( GravityView_oEmbed::getInstance()->get_entry_id() ) { |
|
2359 | 2359 | $error = true; |
2360 | 2360 | } else { |
2361 | - $error = __( 'The link to edit this entry is not valid; it may have expired.', 'gk-gravityview'); |
|
2361 | + $error = __( 'The link to edit this entry is not valid; it may have expired.', 'gk-gravityview' ); |
|
2362 | 2362 | } |
2363 | 2363 | |
2364 | 2364 | } |
2365 | 2365 | |
2366 | - if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry, $this->view ) ) { |
|
2367 | - $error = __( 'You do not have permission to edit this entry.', 'gk-gravityview'); |
|
2366 | + if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry, $this->view ) ) { |
|
2367 | + $error = __( 'You do not have permission to edit this entry.', 'gk-gravityview' ); |
|
2368 | 2368 | } |
2369 | 2369 | |
2370 | - if( $this->entry['status'] === 'trash' ) { |
|
2371 | - $error = __('You cannot edit the entry; it is in the trash.', 'gk-gravityview' ); |
|
2370 | + if ( $this->entry[ 'status' ] === 'trash' ) { |
|
2371 | + $error = __( 'You cannot edit the entry; it is in the trash.', 'gk-gravityview' ); |
|
2372 | 2372 | } |
2373 | 2373 | |
2374 | 2374 | // No errors; everything's fine here! |
2375 | - if( empty( $error ) ) { |
|
2375 | + if ( empty( $error ) ) { |
|
2376 | 2376 | return true; |
2377 | 2377 | } |
2378 | 2378 | |
2379 | - if( $echo && $error !== true ) { |
|
2379 | + if ( $echo && $error !== true ) { |
|
2380 | 2380 | |
2381 | 2381 | $error = esc_html( $error ); |
2382 | 2382 | |
@@ -2384,10 +2384,10 @@ discard block |
||
2384 | 2384 | * @since 1.9 |
2385 | 2385 | */ |
2386 | 2386 | if ( ! empty( $this->entry ) ) { |
2387 | - $error .= ' ' . gravityview_get_link( '#', _x('Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gk-gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) ); |
|
2387 | + $error .= ' ' . gravityview_get_link( '#', _x( 'Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gk-gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) ); |
|
2388 | 2388 | } |
2389 | 2389 | |
2390 | - echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error'); |
|
2390 | + echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' ); |
|
2391 | 2391 | } |
2392 | 2392 | |
2393 | 2393 | gravityview()->log->error( '{error}', array( 'error' => $error ) ); |
@@ -2407,17 +2407,17 @@ discard block |
||
2407 | 2407 | |
2408 | 2408 | $error = NULL; |
2409 | 2409 | |
2410 | - if( ! $this->check_user_cap_edit_field( $field ) ) { |
|
2411 | - $error = __( 'You do not have permission to edit this field.', 'gk-gravityview'); |
|
2410 | + if ( ! $this->check_user_cap_edit_field( $field ) ) { |
|
2411 | + $error = __( 'You do not have permission to edit this field.', 'gk-gravityview' ); |
|
2412 | 2412 | } |
2413 | 2413 | |
2414 | 2414 | // No errors; everything's fine here! |
2415 | - if( empty( $error ) ) { |
|
2415 | + if ( empty( $error ) ) { |
|
2416 | 2416 | return true; |
2417 | 2417 | } |
2418 | 2418 | |
2419 | - if( $echo ) { |
|
2420 | - echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error'); |
|
2419 | + if ( $echo ) { |
|
2420 | + echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' ); |
|
2421 | 2421 | } |
2422 | 2422 | |
2423 | 2423 | gravityview()->log->error( '{error}', array( 'error' => $error ) ); |
@@ -2438,14 +2438,14 @@ discard block |
||
2438 | 2438 | private function check_user_cap_edit_field( $field ) { |
2439 | 2439 | |
2440 | 2440 | // If they can edit any entries (as defined in Gravity Forms), we're good. |
2441 | - if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) { |
|
2441 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) { |
|
2442 | 2442 | return true; |
2443 | 2443 | } |
2444 | 2444 | |
2445 | - $field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false; |
|
2445 | + $field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false; |
|
2446 | 2446 | |
2447 | - if( $field_cap ) { |
|
2448 | - return GVCommon::has_cap( $field['allow_edit_cap'] ); |
|
2447 | + if ( $field_cap ) { |
|
2448 | + return GVCommon::has_cap( $field[ 'allow_edit_cap' ] ); |
|
2449 | 2449 | } |
2450 | 2450 | |
2451 | 2451 | return false; |
@@ -2459,17 +2459,17 @@ discard block |
||
2459 | 2459 | public function verify_nonce() { |
2460 | 2460 | |
2461 | 2461 | // Verify form submitted for editing single |
2462 | - if( $this->is_edit_entry_submission() ) { |
|
2462 | + if ( $this->is_edit_entry_submission() ) { |
|
2463 | 2463 | $valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field ); |
2464 | 2464 | } |
2465 | 2465 | |
2466 | 2466 | // Verify |
2467 | - else if( ! $this->is_edit_entry() ) { |
|
2467 | + else if ( ! $this->is_edit_entry() ) { |
|
2468 | 2468 | $valid = false; |
2469 | 2469 | } |
2470 | 2470 | |
2471 | 2471 | else { |
2472 | - $valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key ); |
|
2472 | + $valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key ); |
|
2473 | 2473 | } |
2474 | 2474 | |
2475 | 2475 | /** |
@@ -2529,7 +2529,7 @@ discard block |
||
2529 | 2529 | */ |
2530 | 2530 | $labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id ); |
2531 | 2531 | |
2532 | - return (array) $labels; |
|
2532 | + return (array)$labels; |
|
2533 | 2533 | } |
2534 | 2534 | |
2535 | 2535 | } //end class |
@@ -27,35 +27,35 @@ discard block |
||
27 | 27 | add_filter( 'gravityview_blocklist_field_types', array( $this, 'default_field_blocklist' ), 10, 2 ); |
28 | 28 | |
29 | 29 | // Tooltips |
30 | - add_filter( 'gform_tooltips', array( $this, 'tooltips') ); |
|
30 | + add_filter( 'gform_tooltips', array( $this, 'tooltips' ) ); |
|
31 | 31 | |
32 | 32 | add_filter( 'admin_body_class', array( $this, 'add_gf_version_css_class' ) ); |
33 | 33 | |
34 | 34 | // adding styles and scripts |
35 | - add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 ); |
|
36 | - add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
37 | - add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
38 | - add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
39 | - add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
40 | - |
|
41 | - add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 5 ); |
|
42 | - add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 ); |
|
43 | - add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers'), 10, 2 ); |
|
44 | - add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 ); |
|
45 | - add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') ); |
|
46 | - add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 ); |
|
47 | - add_filter( 'gravityview/view/configuration/fields', array( $this, 'set_default_view_fields'), 10, 3 ); |
|
35 | + add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 ); |
|
36 | + add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
37 | + add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
38 | + add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
39 | + add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
40 | + |
|
41 | + add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 5 ); |
|
42 | + add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 ); |
|
43 | + add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers' ), 10, 2 ); |
|
44 | + add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 ); |
|
45 | + add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) ); |
|
46 | + add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 ); |
|
47 | + add_filter( 'gravityview/view/configuration/fields', array( $this, 'set_default_view_fields' ), 10, 3 ); |
|
48 | 48 | |
49 | 49 | // @todo check if this hook is needed.. |
50 | 50 | //add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 ); |
51 | 51 | |
52 | 52 | // Add Connected Form column |
53 | - add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) ); |
|
53 | + add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) ); |
|
54 | 54 | |
55 | 55 | add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
56 | 56 | add_action( 'gform_form_actions', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
57 | 57 | |
58 | - add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 ); |
|
58 | + add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 ); |
|
59 | 59 | |
60 | 60 | add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) ); |
61 | 61 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $major_version = explode( '.', GFForms::$version ); |
88 | 88 | |
89 | 89 | if ( 2 <= sizeof( $major_version ) ) { |
90 | - $class .= ' gf-minor-version-' . esc_attr( $major_version[0] . '-' . $major_version[1] ); |
|
90 | + $class .= ' gf-minor-version-' . esc_attr( $major_version[ 0 ] . '-' . $major_version[ 1 ] ); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | return $class; |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | */ |
103 | 103 | function suggest_support_articles( $localization_data = array() ) { |
104 | 104 | |
105 | - if( ! gravityview()->request->is_view( false ) ) { |
|
105 | + if ( ! gravityview()->request->is_view( false ) ) { |
|
106 | 106 | return $localization_data; |
107 | 107 | } |
108 | 108 | |
109 | - $localization_data['suggest'] = array( |
|
109 | + $localization_data[ 'suggest' ] = array( |
|
110 | 110 | '57ef23539033602e61d4a560', |
111 | 111 | '54c67bb9e4b0512429885513', |
112 | 112 | '54c67bb9e4b0512429885512', |
@@ -135,20 +135,20 @@ discard block |
||
135 | 135 | return; |
136 | 136 | } |
137 | 137 | |
138 | - if ( ! isset( $query->query_vars['post_type'] ) ) { |
|
138 | + if ( ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
139 | 139 | return; |
140 | 140 | } |
141 | 141 | |
142 | - if ( 'gravityview' !== $query->query_vars['post_type'] ) { |
|
142 | + if ( 'gravityview' !== $query->query_vars[ 'post_type' ] ) { |
|
143 | 143 | return; |
144 | 144 | } |
145 | 145 | |
146 | - $form_id = (int) \GV\Utils::_GET( 'gravityview_form_id' ); |
|
146 | + $form_id = (int)\GV\Utils::_GET( 'gravityview_form_id' ); |
|
147 | 147 | |
148 | 148 | $meta_query = array(); |
149 | 149 | |
150 | 150 | if ( $form_id ) { |
151 | - $meta_query[] = array( |
|
151 | + $meta_query[ ] = array( |
|
152 | 152 | 'key' => '_gravityview_form_id', |
153 | 153 | 'value' => $form_id, |
154 | 154 | ); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $layout_id = \GV\Utils::_GET( 'gravityview_layout' ); |
158 | 158 | |
159 | 159 | if ( $layout_id ) { |
160 | - $meta_query[] = array( |
|
160 | + $meta_query[ ] = array( |
|
161 | 161 | 'key' => '_gravityview_directory_template', |
162 | 162 | 'value' => esc_attr( $layout_id ), |
163 | 163 | ); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | public function add_view_dropdown() { |
175 | 175 | $current_screen = get_current_screen(); |
176 | 176 | |
177 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
177 | + if ( 'gravityview' !== $current_screen->post_type ) { |
|
178 | 178 | return; |
179 | 179 | } |
180 | 180 | |
@@ -182,12 +182,12 @@ discard block |
||
182 | 182 | $current_form = \GV\Utils::_GET( 'gravityview_form_id' ); |
183 | 183 | |
184 | 184 | // If there are no forms to select, show no forms. |
185 | - if( ! empty( $forms ) ) { ?> |
|
185 | + if ( ! empty( $forms ) ) { ?> |
|
186 | 186 | <label for="gravityview_form_id" class="screen-reader-text"><?php esc_html_e( 'Filter Views by form', 'gk-gravityview' ); ?></label> |
187 | 187 | <select name="gravityview_form_id" id="gravityview_form_id"> |
188 | 188 | <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gk-gravityview' ); ?></option> |
189 | - <?php foreach( $forms as $form ) { ?> |
|
190 | - <option value="<?php echo esc_attr( $form['id'] ); ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
189 | + <?php foreach ( $forms as $form ) { ?> |
|
190 | + <option value="<?php echo esc_attr( $form[ 'id' ] ); ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
191 | 191 | <?php } ?> |
192 | 192 | </select> |
193 | 193 | <?php } |
@@ -196,26 +196,26 @@ discard block |
||
196 | 196 | $current_layout = \GV\Utils::_GET( 'gravityview_layout' ); |
197 | 197 | |
198 | 198 | // If there are no forms to select, show no forms. |
199 | - if( ! empty( $layouts ) ) { ?> |
|
199 | + if ( ! empty( $layouts ) ) { ?> |
|
200 | 200 | <label for="gravityview_layout_name" class="screen-reader-text"><?php esc_html_e( 'Filter Views by layout', 'gk-gravityview' ); ?></label> |
201 | 201 | <select name="gravityview_layout" id="gravityview_layout_name"> |
202 | 202 | <option value="" <?php selected( '', $current_layout, true ); ?>><?php esc_html_e( 'All layouts', 'gk-gravityview' ); ?></option> |
203 | 203 | <optgroup label="<?php esc_html_e( 'Layouts', 'gk-gravityview' ); ?>"> |
204 | - <?php foreach( $layouts as $layout_id => $layout ) { |
|
205 | - if ( in_array( $layout['type'], array( 'preset', 'internal' ), true ) ) { |
|
204 | + <?php foreach ( $layouts as $layout_id => $layout ) { |
|
205 | + if ( in_array( $layout[ 'type' ], array( 'preset', 'internal' ), true ) ) { |
|
206 | 206 | continue; |
207 | 207 | } |
208 | 208 | ?> |
209 | - <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout['label'] ); ?></option> |
|
209 | + <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout[ 'label' ] ); ?></option> |
|
210 | 210 | <?php } ?> |
211 | 211 | </optgroup> |
212 | 212 | <optgroup label="<?php esc_html_e( 'Form Presets', 'gk-gravityview' ); ?>"> |
213 | - <?php foreach( $layouts as $layout_id => $layout ) { |
|
214 | - if ( ! in_array( $layout['type'], array( 'preset' ), true ) ) { |
|
213 | + <?php foreach ( $layouts as $layout_id => $layout ) { |
|
214 | + if ( ! in_array( $layout[ 'type' ], array( 'preset' ), true ) ) { |
|
215 | 215 | continue; |
216 | 216 | } |
217 | 217 | ?> |
218 | - <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout['label'] ); ?></option> |
|
218 | + <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout[ 'label' ] ); ?></option> |
|
219 | 219 | <?php } ?> |
220 | 220 | </optgroup> |
221 | 221 | </select> |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | */ |
230 | 230 | public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
231 | 231 | _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
232 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
232 | + GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id ); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | /** |
@@ -259,13 +259,13 @@ discard block |
||
259 | 259 | |
260 | 260 | $priority = 0; |
261 | 261 | |
262 | - if( 'form_list' === GFForms::get_page() ) { |
|
262 | + if ( 'form_list' === GFForms::get_page() ) { |
|
263 | 263 | $priority = 790; |
264 | 264 | } |
265 | 265 | |
266 | - if( empty( $connected_views ) ) { |
|
266 | + if ( empty( $connected_views ) ) { |
|
267 | 267 | |
268 | - $menu_items['gravityview'] = array( |
|
268 | + $menu_items[ 'gravityview' ] = array( |
|
269 | 269 | 'label' => esc_attr__( 'Create a View', 'gk-gravityview' ), |
270 | 270 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', // Only appears in GF pre-2.5 |
271 | 271 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gk-gravityview' ), |
@@ -281,23 +281,23 @@ discard block |
||
281 | 281 | $sub_menu_items = array(); |
282 | 282 | foreach ( (array)$connected_views as $view ) { |
283 | 283 | |
284 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
284 | + if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
285 | 285 | continue; |
286 | 286 | } |
287 | 287 | |
288 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gk-gravityview' ), $view->ID ) : $view->post_title; |
|
288 | + $label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gk-gravityview' ), $view->ID ) : $view->post_title; |
|
289 | 289 | |
290 | - $sub_menu_items[] = array( |
|
290 | + $sub_menu_items[ ] = array( |
|
291 | 291 | 'label' => esc_attr( $label ), |
292 | - 'url' => admin_url( 'post.php?action=edit&post='.$view->ID ), |
|
292 | + 'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ), |
|
293 | 293 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
294 | 294 | ); |
295 | 295 | } |
296 | 296 | |
297 | 297 | // If there were no items added, then let's create the parent menu |
298 | - if( $sub_menu_items ) { |
|
298 | + if ( $sub_menu_items ) { |
|
299 | 299 | |
300 | - $sub_menu_items[] = array( |
|
300 | + $sub_menu_items[ ] = array( |
|
301 | 301 | 'label' => esc_attr__( 'Create a View', 'gk-gravityview' ), |
302 | 302 | 'icon' => '<span class="dashicons dashicons-plus"></span>', |
303 | 303 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gk-gravityview' ), |
@@ -306,14 +306,14 @@ discard block |
||
306 | 306 | ); |
307 | 307 | |
308 | 308 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
309 | - $sub_menu_items[] = array( |
|
309 | + $sub_menu_items[ ] = array( |
|
310 | 310 | 'url' => '#', |
311 | 311 | 'label' => '', |
312 | 312 | 'menu_class' => 'hidden', |
313 | 313 | 'capabilities' => '', |
314 | 314 | ); |
315 | 315 | |
316 | - $menu_items['gravityview'] = array( |
|
316 | + $menu_items[ 'gravityview' ] = array( |
|
317 | 317 | 'label' => __( 'Connected Views', 'gk-gravityview' ), |
318 | 318 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
319 | 319 | 'title' => __( 'GravityView Views using this form as a data source', 'gk-gravityview' ), |
@@ -344,8 +344,8 @@ discard block |
||
344 | 344 | $add = array( 'captcha', 'page' ); |
345 | 345 | |
346 | 346 | // Don't allowing editing the following values: |
347 | - if( $context === 'edit' ) { |
|
348 | - $add[] = 'post_id'; |
|
347 | + if ( $context === 'edit' ) { |
|
348 | + $add[ ] = 'post_id'; |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | $return = array_merge( $array, $add ); |
@@ -376,27 +376,27 @@ discard block |
||
376 | 376 | foreach ( $default_args as $key => $arg ) { |
377 | 377 | |
378 | 378 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
379 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
379 | + if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; } |
|
380 | 380 | |
381 | 381 | // By default, use `tooltip` if defined. |
382 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
382 | + $tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ]; |
|
383 | 383 | |
384 | 384 | // If there's no tooltip set, continue |
385 | - if( empty( $tooltip ) ) { |
|
385 | + if ( empty( $tooltip ) ) { |
|
386 | 386 | continue; |
387 | 387 | } |
388 | 388 | |
389 | 389 | // Add the tooltip |
390 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
391 | - 'title' => $arg['label'], |
|
390 | + $gv_tooltips[ 'gv_' . $key ] = array( |
|
391 | + 'title' => $arg[ 'label' ], |
|
392 | 392 | 'value' => $tooltip, |
393 | 393 | ); |
394 | 394 | |
395 | 395 | } |
396 | 396 | |
397 | - $gv_tooltips['gv_css_merge_tags'] = array( |
|
398 | - 'title' => __('CSS Merge Tags', 'gk-gravityview'), |
|
399 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gk-gravityview'), '<code>', '</code>' ) |
|
397 | + $gv_tooltips[ 'gv_css_merge_tags' ] = array( |
|
398 | + 'title' => __( 'CSS Merge Tags', 'gk-gravityview' ), |
|
399 | + 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gk-gravityview' ), '<code>', '</code>' ) |
|
400 | 400 | ); |
401 | 401 | |
402 | 402 | /** |
@@ -414,9 +414,9 @@ discard block |
||
414 | 414 | |
415 | 415 | foreach ( $gv_tooltips as $key => $tooltip ) { |
416 | 416 | |
417 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
417 | + $title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>'; |
|
418 | 418 | |
419 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
419 | + $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) ); |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | return $tooltips; |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | * |
431 | 431 | * @return void |
432 | 432 | */ |
433 | - public function add_custom_column_content( $column_name = null, $post_id = 0 ) { |
|
433 | + public function add_custom_column_content( $column_name = null, $post_id = 0 ) { |
|
434 | 434 | |
435 | 435 | $output = ''; |
436 | 436 | |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
453 | 453 | $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
454 | 454 | |
455 | - $output = $template ? $template['label'] : $template_id_pretty; |
|
455 | + $output = $template ? $template[ 'label' ] : $template_id_pretty; |
|
456 | 456 | |
457 | 457 | break; |
458 | 458 | |
@@ -493,12 +493,12 @@ discard block |
||
493 | 493 | static public function get_connected_form_links( $form, $include_form_link = true ) { |
494 | 494 | |
495 | 495 | // Either the form is empty or the form ID is 0, not yet set. |
496 | - if( empty( $form ) ) { |
|
496 | + if ( empty( $form ) ) { |
|
497 | 497 | return ''; |
498 | 498 | } |
499 | 499 | |
500 | 500 | // The $form is passed as the form ID |
501 | - if( !is_array( $form ) ) { |
|
501 | + if ( ! is_array( $form ) ) { |
|
502 | 502 | $form = gravityview_get_form( $form ); |
503 | 503 | } |
504 | 504 | |
@@ -506,35 +506,35 @@ discard block |
||
506 | 506 | return ''; |
507 | 507 | } |
508 | 508 | |
509 | - $form_id = $form['id']; |
|
509 | + $form_id = $form[ 'id' ]; |
|
510 | 510 | $links = array(); |
511 | 511 | |
512 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
512 | + if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
513 | 513 | $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
514 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
515 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gk-gravityview') ).'</span>'; |
|
514 | + $form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>'; |
|
515 | + $links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gk-gravityview' ) ) . '</span>'; |
|
516 | 516 | } else { |
517 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
517 | + $form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>'; |
|
518 | 518 | } |
519 | 519 | |
520 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
520 | + if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
521 | 521 | $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
522 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gk-gravityview') ).'</span>'; |
|
522 | + $links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gk-gravityview' ) ) . '</span>'; |
|
523 | 523 | } |
524 | 524 | |
525 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
525 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
526 | 526 | $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
527 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gk-gravityview'), 'title='.__('Edit settings for this form', 'gk-gravityview') ).'</span>'; |
|
527 | + $links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gk-gravityview' ), 'title=' . __( 'Edit settings for this form', 'gk-gravityview' ) ) . '</span>'; |
|
528 | 528 | } |
529 | 529 | |
530 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
530 | + if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) { |
|
531 | 531 | $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
532 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gk-gravityview'), 'title='.__('Preview this form', 'gk-gravityview') ).'</span>'; |
|
532 | + $links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gk-gravityview' ), 'title=' . __( 'Preview this form', 'gk-gravityview' ) ) . '</span>'; |
|
533 | 533 | } |
534 | 534 | |
535 | 535 | $output = ''; |
536 | 536 | |
537 | - if( !empty( $include_form_link ) ) { |
|
537 | + if ( ! empty( $include_form_link ) ) { |
|
538 | 538 | $output .= $form_link; |
539 | 539 | } |
540 | 540 | |
@@ -549,11 +549,11 @@ discard block |
||
549 | 549 | $css_class = 'row-actions'; |
550 | 550 | |
551 | 551 | // Is Screen Options > View mode set to "Extended view"? If so, keep actions visible. |
552 | - if( 'excerpt' === get_user_setting( 'posts_list_mode', 'list' ) ) { |
|
552 | + if ( 'excerpt' === get_user_setting( 'posts_list_mode', 'list' ) ) { |
|
553 | 553 | $css_class = 'row-actions visible'; |
554 | 554 | } |
555 | 555 | |
556 | - $output .= '<div class="' . $css_class . '">'. implode( ' | ', $links ) .'</div>'; |
|
556 | + $output .= '<div class="' . $css_class . '">' . implode( ' | ', $links ) . '</div>'; |
|
557 | 557 | |
558 | 558 | return $output; |
559 | 559 | } |
@@ -567,8 +567,8 @@ discard block |
||
567 | 567 | // Get the date column and save it for later to add back in. |
568 | 568 | // This adds it after the Data Source column. |
569 | 569 | // This way, we don't need to do array_slice, array_merge, etc. |
570 | - $date = $columns['date']; |
|
571 | - unset( $columns['date'] ); |
|
570 | + $date = $columns[ 'date' ]; |
|
571 | + unset( $columns[ 'date' ] ); |
|
572 | 572 | |
573 | 573 | $data_source_required_caps = array( |
574 | 574 | 'gravityforms_edit_forms', |
@@ -579,14 +579,14 @@ discard block |
||
579 | 579 | 'gravityforms_preview_forms', |
580 | 580 | ); |
581 | 581 | |
582 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
583 | - $columns['gv_connected_form'] = __( 'Data Source', 'gk-gravityview' ); |
|
582 | + if ( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
583 | + $columns[ 'gv_connected_form' ] = __( 'Data Source', 'gk-gravityview' ); |
|
584 | 584 | } |
585 | 585 | |
586 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gk-gravityview' ); |
|
586 | + $columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gk-gravityview' ); |
|
587 | 587 | |
588 | 588 | // Add the date back in. |
589 | - $columns['date'] = $date; |
|
589 | + $columns[ 'date' ] = $date; |
|
590 | 590 | |
591 | 591 | return $columns; |
592 | 592 | } |
@@ -599,12 +599,12 @@ discard block |
||
599 | 599 | */ |
600 | 600 | function save_postdata( $post_id ) { |
601 | 601 | |
602 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
602 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
603 | 603 | return; |
604 | 604 | } |
605 | 605 | |
606 | 606 | // validate post_type |
607 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
607 | + if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) { |
|
608 | 608 | return; |
609 | 609 | } |
610 | 610 | |
@@ -619,63 +619,63 @@ discard block |
||
619 | 619 | $statii = array(); |
620 | 620 | |
621 | 621 | // check if this is a start fresh View |
622 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
622 | + if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) { |
|
623 | 623 | |
624 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
624 | + $form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : ''; |
|
625 | 625 | // save form id |
626 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
626 | + $statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
627 | 627 | |
628 | 628 | } |
629 | 629 | |
630 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
630 | + if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) { |
|
631 | 631 | gravityview()->log->error( 'Current user does not have the capability to create a new Form.', array( 'data' => wp_get_current_user() ) ); |
632 | 632 | return; |
633 | 633 | } |
634 | 634 | |
635 | 635 | // Was this a start fresh? |
636 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
637 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
636 | + if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) { |
|
637 | + $statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
638 | 638 | } else { |
639 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
639 | + $statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
640 | 640 | } |
641 | 641 | |
642 | 642 | // Check if we have a template id |
643 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
643 | + if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) { |
|
644 | 644 | |
645 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
645 | + $template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : ''; |
|
646 | 646 | |
647 | 647 | // now save template id |
648 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
648 | + $statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
649 | 649 | } |
650 | 650 | |
651 | 651 | |
652 | 652 | // save View Configuration metabox |
653 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
653 | + if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) { |
|
654 | 654 | |
655 | 655 | // template settings |
656 | - if( empty( $_POST['template_settings'] ) ) { |
|
657 | - $_POST['template_settings'] = array(); |
|
656 | + if ( empty( $_POST[ 'template_settings' ] ) ) { |
|
657 | + $_POST[ 'template_settings' ] = array(); |
|
658 | 658 | } |
659 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
659 | + $statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] ); |
|
660 | 660 | |
661 | 661 | // guard against unloaded View configuration page |
662 | - if ( isset( $_POST['gv_fields'] ) && isset( $_POST['gv_fields_done'] ) ) { |
|
662 | + if ( isset( $_POST[ 'gv_fields' ] ) && isset( $_POST[ 'gv_fields_done' ] ) ) { |
|
663 | 663 | $fields = array(); |
664 | 664 | |
665 | - if ( ! empty( $_POST['gv_fields'] ) ) { |
|
665 | + if ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
666 | 666 | $fields = _gravityview_process_posted_fields(); |
667 | 667 | } |
668 | 668 | |
669 | 669 | $fields = wp_slash( $fields ); |
670 | 670 | |
671 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
671 | + $statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
672 | 672 | } |
673 | 673 | |
674 | 674 | // Directory Visible Widgets |
675 | - if( empty( $_POST['widgets'] ) ) { |
|
676 | - $_POST['widgets'] = array(); |
|
675 | + if ( empty( $_POST[ 'widgets' ] ) ) { |
|
676 | + $_POST[ 'widgets' ] = array(); |
|
677 | 677 | } |
678 | - $statii['directory_widgets'] = gravityview_set_directory_widgets( $post_id, $_POST['widgets'] ); |
|
678 | + $statii[ 'directory_widgets' ] = gravityview_set_directory_widgets( $post_id, $_POST[ 'widgets' ] ); |
|
679 | 679 | |
680 | 680 | } // end save view configuration |
681 | 681 | |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | * @param array $statii Array of statuses of the post meta saving processes. If saving worked, each key should be mapped to a value of the post ID (`directory_widgets` => `124`). If failed (or didn't change), the value will be false. |
686 | 686 | * @since 1.17.2 |
687 | 687 | */ |
688 | - do_action('gravityview_view_saved', $post_id, $statii ); |
|
688 | + do_action( 'gravityview_view_saved', $post_id, $statii ); |
|
689 | 689 | |
690 | 690 | gravityview()->log->debug( '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array( 'data' => array_map( 'intval', $statii ) ) ); |
691 | 691 | } |
@@ -734,20 +734,20 @@ discard block |
||
734 | 734 | |
735 | 735 | $output = ''; |
736 | 736 | |
737 | - if( !empty( $fields ) ) { |
|
737 | + if ( ! empty( $fields ) ) { |
|
738 | 738 | |
739 | - foreach( $fields as $id => $details ) { |
|
739 | + foreach ( $fields as $id => $details ) { |
|
740 | 740 | |
741 | - if( in_array( $details['type'], (array) $blocklist_field_types ) ) { |
|
741 | + if ( in_array( $details[ 'type' ], (array)$blocklist_field_types ) ) { |
|
742 | 742 | continue; |
743 | 743 | } |
744 | 744 | |
745 | 745 | // Edit mode only allows editing the parent fields, not single inputs. |
746 | - if( $context === 'edit' && ! empty( $details['parent'] ) ) { |
|
746 | + if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) { |
|
747 | 747 | continue; |
748 | 748 | } |
749 | 749 | |
750 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details, array(), $form_id, $form ); |
|
750 | + $output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details, array(), $form_id, $form ); |
|
751 | 751 | |
752 | 752 | } // End foreach |
753 | 753 | } |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | echo $output; |
756 | 756 | |
757 | 757 | // For the EDIT view we only want to allow the form fields. |
758 | - if( $context === 'edit' ) { |
|
758 | + if ( $context === 'edit' ) { |
|
759 | 759 | return; |
760 | 760 | } |
761 | 761 | |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | $additional_fields = array( |
777 | 777 | array( |
778 | 778 | 'label_text' => __( 'Add All Form Fields', 'gk-gravityview' ), |
779 | - 'desc' => __('Insert all the form fields at once.', 'gk-gravityview'), |
|
779 | + 'desc' => __( 'Insert all the form fields at once.', 'gk-gravityview' ), |
|
780 | 780 | 'field_id' => 'all-fields', |
781 | 781 | 'label_type' => 'field', |
782 | 782 | 'input_type' => null, |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | */ |
793 | 793 | $additional_fields = apply_filters( 'gravityview_additional_fields', $additional_fields ); |
794 | 794 | |
795 | - foreach ( (array) $additional_fields as $item ) { |
|
795 | + foreach ( (array)$additional_fields as $item ) { |
|
796 | 796 | |
797 | 797 | // Prevent items from not having index set |
798 | 798 | $item = wp_parse_args( $item, array( |
@@ -803,16 +803,16 @@ discard block |
||
803 | 803 | 'field_options' => null, |
804 | 804 | 'settings_html' => null, |
805 | 805 | 'icon' => null, |
806 | - )); |
|
806 | + ) ); |
|
807 | 807 | |
808 | 808 | // Backward compat. |
809 | - if( !empty( $item['field_options'] ) ) { |
|
809 | + if ( ! empty( $item[ 'field_options' ] ) ) { |
|
810 | 810 | // Use settings_html from now on. |
811 | - $item['settings_html'] = $item['field_options']; |
|
811 | + $item[ 'settings_html' ] = $item[ 'field_options' ]; |
|
812 | 812 | } |
813 | 813 | |
814 | 814 | // Render a label for each of them |
815 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item, $settings = array(), $form_id, $form ); |
|
815 | + echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item, $settings = array(), $form_id, $form ); |
|
816 | 816 | |
817 | 817 | } |
818 | 818 | |
@@ -824,12 +824,12 @@ discard block |
||
824 | 824 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
825 | 825 | * @return array |
826 | 826 | */ |
827 | - function get_entry_default_fields($form, $zone) { |
|
827 | + function get_entry_default_fields( $form, $zone ) { |
|
828 | 828 | |
829 | 829 | $entry_default_fields = array(); |
830 | 830 | |
831 | 831 | // if in zone directory or single |
832 | - if( in_array( $zone, array( 'directory', 'single' ), true ) ) { |
|
832 | + if ( in_array( $zone, array( 'directory', 'single' ), true ) ) { |
|
833 | 833 | |
834 | 834 | $meta_fields = GravityView_Fields::get_all( array( 'meta', 'gravityview', 'add-ons' ) ); |
835 | 835 | |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | * @param string|array $form form_ID or form object |
847 | 847 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
848 | 848 | */ |
849 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
849 | + return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone ); |
|
850 | 850 | } |
851 | 851 | |
852 | 852 | /** |
@@ -857,7 +857,7 @@ discard block |
||
857 | 857 | */ |
858 | 858 | function get_available_fields( $form = '', $zone = NULL ) { |
859 | 859 | |
860 | - if( empty( $form ) ) { |
|
860 | + if ( empty( $form ) ) { |
|
861 | 861 | gravityview()->log->error( '$form is empty' ); |
862 | 862 | return array(); |
863 | 863 | } |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | $fields = gravityview_get_form_fields( $form, true ); |
867 | 867 | |
868 | 868 | // get meta fields ( only if form was already created ) |
869 | - if( !is_array( $form ) ) { |
|
869 | + if ( ! is_array( $form ) ) { |
|
870 | 870 | $meta_fields = gravityview_get_entry_meta( $form ); |
871 | 871 | } else { |
872 | 872 | $meta_fields = array(); |
@@ -879,8 +879,8 @@ discard block |
||
879 | 879 | $fields = $fields + $meta_fields + $default_fields; |
880 | 880 | |
881 | 881 | // Move Custom Content to top |
882 | - if ( isset( $fields['custom'] ) ) { |
|
883 | - $fields = array( 'custom' => $fields['custom'] ) + $fields; |
|
882 | + if ( isset( $fields[ 'custom' ] ) ) { |
|
883 | + $fields = array( 'custom' => $fields[ 'custom' ] ) + $fields; |
|
884 | 884 | } |
885 | 885 | |
886 | 886 | $gv_fields = GravityView_Fields::get_all(); |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | foreach ( $fields as &$field ) { |
889 | 889 | foreach ( $gv_fields as $gv_field ) { |
890 | 890 | if ( \GV\Utils::get( $field, 'type' ) === $gv_field->name ) { |
891 | - $field['icon'] = $gv_field->get_icon(); |
|
891 | + $field[ 'icon' ] = $gv_field->get_icon(); |
|
892 | 892 | } |
893 | 893 | } |
894 | 894 | } |
@@ -916,7 +916,7 @@ discard block |
||
916 | 916 | } |
917 | 917 | |
918 | 918 | foreach ( $widgets as $id => $details ) { |
919 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
919 | + echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details ); |
|
920 | 920 | } |
921 | 921 | |
922 | 922 | } |
@@ -946,7 +946,7 @@ discard block |
||
946 | 946 | function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
947 | 947 | global $post; |
948 | 948 | |
949 | - if( $type === 'widget' ) { |
|
949 | + if ( $type === 'widget' ) { |
|
950 | 950 | $button_label = __( 'Add Widget', 'gk-gravityview' ); |
951 | 951 | } else { |
952 | 952 | $button_label = __( 'Add Field', 'gk-gravityview' ); |
@@ -973,14 +973,14 @@ discard block |
||
973 | 973 | $form = false; |
974 | 974 | |
975 | 975 | // if saved values, get available fields to label everyone |
976 | - if( !empty( $values ) && ( !empty( $post->ID ) || ! empty( $_POST['template_id'] ) || ! empty( $_POST['form_id'] ) ) ) { |
|
976 | + if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) || ! empty( $_POST[ 'form_id' ] ) ) ) { |
|
977 | 977 | |
978 | - if ( ! empty( $_POST['form_id'] ) ) { |
|
979 | - $form_id = (int) \GV\Utils::_POST( 'form_id', 0 ); |
|
978 | + if ( ! empty( $_POST[ 'form_id' ] ) ) { |
|
979 | + $form_id = (int)\GV\Utils::_POST( 'form_id', 0 ); |
|
980 | 980 | $form = gravityview_get_form( $form_id ); |
981 | - } elseif( ! empty( $_POST['template_id'] ) ) { |
|
982 | - $form_id = esc_attr( $_POST['template_id'] ); |
|
983 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
981 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
982 | + $form_id = esc_attr( $_POST[ 'template_id' ] ); |
|
983 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
984 | 984 | } else { |
985 | 985 | $form_id = gravityview_get_form_id( $post->ID ); |
986 | 986 | $form = gravityview_get_form( $form_id ); |
@@ -1001,47 +1001,47 @@ discard block |
||
1001 | 1001 | } |
1002 | 1002 | } |
1003 | 1003 | |
1004 | - foreach( $rows as $row ) : |
|
1005 | - foreach( $row as $col => $areas ) : |
|
1006 | - $column = ($col == '2-2') ? '1-2' : $col; ?> |
|
1004 | + foreach ( $rows as $row ) : |
|
1005 | + foreach ( $row as $col => $areas ) : |
|
1006 | + $column = ( $col == '2-2' ) ? '1-2' : $col; ?> |
|
1007 | 1007 | |
1008 | 1008 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
1009 | 1009 | |
1010 | - <?php foreach( $areas as $area ) : ?> |
|
1010 | + <?php foreach ( $areas as $area ) : ?> |
|
1011 | 1011 | |
1012 | - <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
1013 | - <p class="gv-droppable-area-title" <?php if ( 'widget' === $type && empty( $area['subtitle'] ) ) { echo ' style="margin: 0; padding: 0;"'; } ?>> |
|
1014 | - <strong <?php if ( 'widget' === $type ) { echo 'class="screen-reader-text"'; } ?>><?php echo esc_html( $area['title'] ); ?></strong> |
|
1012 | + <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
1013 | + <p class="gv-droppable-area-title" <?php if ( 'widget' === $type && empty( $area[ 'subtitle' ] ) ) { echo ' style="margin: 0; padding: 0;"'; } ?>> |
|
1014 | + <strong <?php if ( 'widget' === $type ) { echo 'class="screen-reader-text"'; } ?>><?php echo esc_html( $area[ 'title' ] ); ?></strong> |
|
1015 | 1015 | |
1016 | 1016 | <?php if ( 'widget' !== $type ) { ?> |
1017 | - <a class="clear-all-fields alignright" role="button" href="#" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"><?php esc_html_e( 'Clear all fields', 'gk-gravityview' ); ?></a> |
|
1017 | + <a class="clear-all-fields alignright" role="button" href="#" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"><?php esc_html_e( 'Clear all fields', 'gk-gravityview' ); ?></a> |
|
1018 | 1018 | <?php } ?> |
1019 | 1019 | |
1020 | - <?php if ( ! empty( $area['subtitle'] ) ) { ?> |
|
1021 | - <span class="gv-droppable-area-subtitle"><span class="gf_tooltip gv_tooltip tooltip" title="<?php echo esc_attr( $area['subtitle'] ); ?>"></span></span> |
|
1020 | + <?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?> |
|
1021 | + <span class="gv-droppable-area-subtitle"><span class="gf_tooltip gv_tooltip tooltip" title="<?php echo esc_attr( $area[ 'subtitle' ] ); ?>"></span></span> |
|
1022 | 1022 | <?php } ?> |
1023 | 1023 | </p> |
1024 | 1024 | <div class="active-drop-container active-drop-container-<?php echo esc_attr( $type ); ?>"> |
1025 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"><?php // render saved fields |
|
1026 | - if( ! empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
1025 | + <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"><?php // render saved fields |
|
1026 | + if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
1027 | 1027 | |
1028 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
1028 | + foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) { |
|
1029 | 1029 | |
1030 | 1030 | // Maybe has a form ID |
1031 | - $form_id = empty( $field['form_id'] ) ? $form_id : $field['form_id']; |
|
1031 | + $form_id = empty( $field[ 'form_id' ] ) ? $form_id : $field[ 'form_id' ]; |
|
1032 | 1032 | |
1033 | 1033 | $input_type = null; |
1034 | 1034 | |
1035 | 1035 | if ( $form_id ) { |
1036 | - $original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ; |
|
1036 | + $original_item = isset( $available_items[ $form_id ] [ $field[ 'id' ] ] ) ? $available_items[ $form_id ] [ $field[ 'id' ] ] : false; |
|
1037 | 1037 | } else { |
1038 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
1038 | + $original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false; |
|
1039 | 1039 | } |
1040 | 1040 | |
1041 | 1041 | if ( ! $original_item ) { |
1042 | 1042 | |
1043 | 1043 | global $pagenow; |
1044 | - if ( 'post-new.php' !== $pagenow ) { |
|
1044 | + if ( 'post-new.php' !== $pagenow ) { |
|
1045 | 1045 | gravityview()->log->error( 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array( |
1046 | 1046 | ' data' => array( |
1047 | 1047 | 'available_items' => $available_items, |
@@ -1053,10 +1053,10 @@ discard block |
||
1053 | 1053 | $original_item = $field; |
1054 | 1054 | } |
1055 | 1055 | |
1056 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : null; |
|
1056 | + $input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : null; |
|
1057 | 1057 | |
1058 | 1058 | // Field options dialog box |
1059 | - $field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item ); |
|
1059 | + $field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item ); |
|
1060 | 1060 | |
1061 | 1061 | $item = array( |
1062 | 1062 | 'input_type' => $input_type, |
@@ -1069,12 +1069,12 @@ discard block |
||
1069 | 1069 | $item = wp_parse_args( $item, $original_item ); |
1070 | 1070 | } |
1071 | 1071 | |
1072 | - switch( $type ) { |
|
1072 | + switch ( $type ) { |
|
1073 | 1073 | case 'widget': |
1074 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
1074 | + echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
1075 | 1075 | break; |
1076 | 1076 | default: |
1077 | - echo new GravityView_Admin_View_Field( $field['label'], $field['id'], $item, $field, $form_id, $form ); |
|
1077 | + echo new GravityView_Admin_View_Field( $field[ 'label' ], $field[ 'id' ], $item, $field, $form_id, $form ); |
|
1078 | 1078 | } |
1079 | 1079 | } |
1080 | 1080 | |
@@ -1082,7 +1082,7 @@ discard block |
||
1082 | 1082 | <div class="gv-droppable-area-action"> |
1083 | 1083 | <a href="#" class="gv-add-field button button-link button-hero" title="" |
1084 | 1084 | data-objecttype="<?php echo esc_attr( $type ); ?>" |
1085 | - data-areaid="<?php echo esc_attr( $zone . '_' . $area['areaid'] ); ?>" |
|
1085 | + data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" |
|
1086 | 1086 | data-context="<?php echo esc_attr( $zone ); ?>" |
1087 | 1087 | data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '<span class="dashicons dashicons-plus-alt"></span>' . esc_html( $button_label ); ?></a> |
1088 | 1088 | </div> |
@@ -1115,7 +1115,7 @@ discard block |
||
1115 | 1115 | // This is a new View, prefill the widgets |
1116 | 1116 | $widgets = array( |
1117 | 1117 | 'header_top' => array( |
1118 | - substr( md5( microtime( true ) ), 0, 13 ) => array ( |
|
1118 | + substr( md5( microtime( true ) ), 0, 13 ) => array( |
|
1119 | 1119 | 'id' => 'search_bar', |
1120 | 1120 | 'label' => __( 'Search Bar', 'gk-gravityview' ), |
1121 | 1121 | 'search_layout' => 'horizontal', |
@@ -1190,12 +1190,12 @@ discard block |
||
1190 | 1190 | if ( $post ) { |
1191 | 1191 | $source_form_id = gravityview_get_form_id( $post->ID ); |
1192 | 1192 | if ( $source_form_id ) { |
1193 | - $form_ids[] = $source_form_id; |
|
1193 | + $form_ids[ ] = $source_form_id; |
|
1194 | 1194 | } |
1195 | 1195 | |
1196 | 1196 | $joined_forms = \GV\View::get_joined_forms( $post->ID ); |
1197 | 1197 | foreach ( $joined_forms as $joined_form ) { |
1198 | - $form_ids[] = $joined_form->ID; |
|
1198 | + $form_ids[ ] = $joined_form->ID; |
|
1199 | 1199 | } |
1200 | 1200 | } |
1201 | 1201 | foreach ( array_unique( $form_ids ) as $form_id ) { |
@@ -1236,7 +1236,7 @@ discard block |
||
1236 | 1236 | * @return string HTML of the active areas |
1237 | 1237 | */ |
1238 | 1238 | function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = 0, $echo = false, $form_id = 0 ) { |
1239 | - if( empty( $template_id ) ) { |
|
1239 | + if ( empty( $template_id ) ) { |
|
1240 | 1240 | gravityview()->log->debug( '[render_directory_active_areas] {template_id} is empty', array( 'template_id' => $template_id ) ); |
1241 | 1241 | return ''; |
1242 | 1242 | } |
@@ -1250,13 +1250,13 @@ discard block |
||
1250 | 1250 | */ |
1251 | 1251 | $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
1252 | 1252 | |
1253 | - if( empty( $template_areas ) ) { |
|
1253 | + if ( empty( $template_areas ) ) { |
|
1254 | 1254 | |
1255 | 1255 | gravityview()->log->error( '[render_directory_active_areas] No areas defined. Maybe template {template_id} is disabled.', array( 'data' => $template_id ) ); |
1256 | 1256 | |
1257 | 1257 | $output = '<div>'; |
1258 | - $output .= '<h2 class="description" style="font-size: 16px; margin:0">'. sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gk-gravityview' ), '<em>'.$template_id.'</em>' ) .'</h2>'; |
|
1259 | - $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">'.esc_html__('The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gk-gravityview').'</p>'; |
|
1258 | + $output .= '<h2 class="description" style="font-size: 16px; margin:0">' . sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gk-gravityview' ), '<em>' . $template_id . '</em>' ) . '</h2>'; |
|
1259 | + $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">' . esc_html__( 'The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gk-gravityview' ) . '</p>'; |
|
1260 | 1260 | $output .= '</div>'; |
1261 | 1261 | } else { |
1262 | 1262 | |
@@ -1268,7 +1268,7 @@ discard block |
||
1268 | 1268 | |
1269 | 1269 | } |
1270 | 1270 | |
1271 | - if( $echo ) { |
|
1271 | + if ( $echo ) { |
|
1272 | 1272 | echo $output; |
1273 | 1273 | } |
1274 | 1274 | |
@@ -1299,7 +1299,7 @@ discard block |
||
1299 | 1299 | |
1300 | 1300 | foreach ( $columns as $column_id => $column ) { |
1301 | 1301 | |
1302 | - $gv_field = GravityView_Fields::get_instance( $column['type'] ); |
|
1302 | + $gv_field = GravityView_Fields::get_instance( $column[ 'type' ] ); |
|
1303 | 1303 | |
1304 | 1304 | $directory_fields[ uniqid( '', true ) ] = array( |
1305 | 1305 | 'label' => \GV\Utils::get( $column, 'label' ), |
@@ -1314,7 +1314,7 @@ discard block |
||
1314 | 1314 | $form = GV\GF_Form::by_id( $form_id ); |
1315 | 1315 | $entry_fields = array(); |
1316 | 1316 | |
1317 | - foreach( $form->form['fields'] as $gv_field ) { |
|
1317 | + foreach ( $form->form[ 'fields' ] as $gv_field ) { |
|
1318 | 1318 | |
1319 | 1319 | $entry_fields[ uniqid( '', true ) ] = array( |
1320 | 1320 | 'label' => $gv_field->label, |
@@ -1362,18 +1362,18 @@ discard block |
||
1362 | 1362 | } |
1363 | 1363 | |
1364 | 1364 | // Add the GV font (with the Astronaut) |
1365 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version ); |
|
1365 | + wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), \GV\Plugin::$version ); |
|
1366 | 1366 | wp_register_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), \GV\Plugin::$version ); |
1367 | 1367 | |
1368 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), \GV\Plugin::$version, true ); |
|
1368 | + wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), \GV\Plugin::$version, true ); |
|
1369 | 1369 | |
1370 | - if( GFForms::get_page() === 'form_list' ) { |
|
1370 | + if ( GFForms::get_page() === 'form_list' ) { |
|
1371 | 1371 | wp_enqueue_style( 'gravityview_views_styles' ); |
1372 | 1372 | return; |
1373 | 1373 | } |
1374 | 1374 | |
1375 | 1375 | // Don't process any scripts below here if it's not a GravityView page. |
1376 | - if( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) { |
|
1376 | + if ( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) { |
|
1377 | 1377 | return; |
1378 | 1378 | } |
1379 | 1379 | |
@@ -1381,7 +1381,7 @@ discard block |
||
1381 | 1381 | |
1382 | 1382 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
1383 | 1383 | |
1384 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version ); |
|
1384 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), \GV\Plugin::$version ); |
|
1385 | 1385 | |
1386 | 1386 | // Enqueue scripts |
1387 | 1387 | wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), \GV\Plugin::$version ); |
@@ -1389,8 +1389,8 @@ discard block |
||
1389 | 1389 | wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
1390 | 1390 | 'cookiepath' => COOKIEPATH, |
1391 | 1391 | 'admin_cookiepath' => ADMIN_COOKIE_PATH, |
1392 | - 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
1393 | - 'has_merge_tag_listener' => (bool) version_compare( GFForms::$version, '2.6.4', '>=' ), |
|
1392 | + 'passed_form_id' => (bool)\GV\Utils::_GET( 'form_id' ), |
|
1393 | + 'has_merge_tag_listener' => (bool)version_compare( GFForms::$version, '2.6.4', '>=' ), |
|
1394 | 1394 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
1395 | 1395 | 'label_viewname' => __( 'Enter View name here', 'gk-gravityview' ), |
1396 | 1396 | 'label_reorder_search_fields' => __( 'Reorder Search Fields', 'gk-gravityview' ), |
@@ -1417,7 +1417,7 @@ discard block |
||
1417 | 1417 | wp_enqueue_style( 'gravityview_views_styles' ); |
1418 | 1418 | |
1419 | 1419 | // 2.5 changed how Merge Tags are enqueued |
1420 | - if ( is_callable( array( 'GFCommon', 'output_hooks_javascript') ) ) { |
|
1420 | + if ( is_callable( array( 'GFCommon', 'output_hooks_javascript' ) ) ) { |
|
1421 | 1421 | GFCommon::output_hooks_javascript(); |
1422 | 1422 | } |
1423 | 1423 | } |
@@ -1441,7 +1441,7 @@ discard block |
||
1441 | 1441 | ); |
1442 | 1442 | |
1443 | 1443 | if ( wp_is_mobile() ) { |
1444 | - $scripts[] = 'jquery-touch-punch'; |
|
1444 | + $scripts[ ] = 'jquery-touch-punch'; |
|
1445 | 1445 | } |
1446 | 1446 | |
1447 | 1447 | wp_enqueue_script( $scripts ); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $return = $input_type; |
47 | 47 | |
48 | - if( 'survey' === $field_type ) { |
|
48 | + if ( 'survey' === $field_type ) { |
|
49 | 49 | $return = 'select'; |
50 | 50 | } |
51 | 51 | |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | public function fix_survey_fields( $fields ) { |
66 | 66 | |
67 | 67 | /** @var GF_Field $field */ |
68 | - foreach( $fields as &$field ) { |
|
69 | - if( 'survey' === $field->type ) { |
|
68 | + foreach ( $fields as &$field ) { |
|
69 | + if ( 'survey' === $field->type ) { |
|
70 | 70 | $field->allowsPrepopulate = true; |
71 | 71 | } |
72 | 72 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @return void |
83 | 83 | */ |
84 | 84 | function add_render_hooks() { |
85 | - add_filter( 'gform_field_value', array( $this, 'fix_survey_field_value'), 10, 3 ); |
|
85 | + add_filter( 'gform_field_value', array( $this, 'fix_survey_field_value' ), 10, 3 ); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @return void |
96 | 96 | */ |
97 | 97 | function remove_render_hooks() { |
98 | - remove_filter( 'gform_field_value', array( $this, 'fix_survey_field_value'), 10 ); |
|
98 | + remove_filter( 'gform_field_value', array( $this, 'fix_survey_field_value' ), 10 ); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -113,14 +113,14 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function fix_survey_field_value( $value, $field, $name ) { |
115 | 115 | |
116 | - if( 'survey' === $field->type ) { |
|
116 | + if ( 'survey' === $field->type ) { |
|
117 | 117 | |
118 | - $entry = GravityView_Edit_Entry::getInstance()->instances['render']->get_entry(); |
|
118 | + $entry = GravityView_Edit_Entry::getInstance()->instances[ 'render' ]->get_entry(); |
|
119 | 119 | |
120 | 120 | // We need to run through each survey row until we find a match for expected values |
121 | 121 | foreach ( $entry as $field_id => $field_value ) { |
122 | 122 | |
123 | - if ( (int) $field_id !== (int) $field->id ) { |
|
123 | + if ( (int)$field_id !== (int)$field->id ) { |
|
124 | 124 | continue; |
125 | 125 | } |
126 | 126 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | list( $row_val, $col_val ) = explode( ':', $field_value, 2 ); |
129 | 129 | |
130 | 130 | // If the $name matches the $row_val, we are processing the correct row |
131 | - if( $row_val === $name ) { |
|
131 | + if ( $row_val === $name ) { |
|
132 | 132 | $value = $field_value; |
133 | 133 | break; |
134 | 134 | } |