@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | /** |
32 | 32 | * @action `gravityview_search_widget_field_before` Before each search input is rendered (other than the submit button) |
33 | 33 | * @param GravityView_Widget_Search $this GravityView Widget instance |
34 | - * @param array $search_field |
|
34 | + * @param array $search_field |
|
35 | 35 | */ |
36 | 36 | do_action( 'gravityview_search_widget_field_before', $this, $search_field ); |
37 | 37 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | /** |
47 | 47 | * @action `gravityview_search_widget_field_after` After each search input is rendered (other than the submit button) |
48 | 48 | * @param GravityView_Widget_Search $this GravityView Widget instance |
49 | - * @param array $search_field |
|
49 | + * @param array $search_field |
|
50 | 50 | */ |
51 | 51 | do_action( 'gravityview_search_widget_field_after', $this, $search_field ); |
52 | 52 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | do_action( 'gravityview_search_widget_fields_after', $this ); |
59 | 59 | |
60 | 60 | if( $has_inputs ) { |
61 | - $this->render( 'search-field', 'submit', false ); |
|
62 | - } |
|
61 | + $this->render( 'search-field', 'submit', false ); |
|
62 | + } |
|
63 | 63 | ?> |
64 | 64 | </form> |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | do_action( 'gravityview_search_widget_fields_before', $this ); |
28 | 28 | |
29 | - foreach( array_merge( $this->search_fields, $this->permalink_fields ) as $search_field ) { |
|
29 | + foreach ( array_merge( $this->search_fields, $this->permalink_fields ) as $search_field ) { |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * @action `gravityview_search_widget_field_before` Before each search input is rendered (other than the submit button) |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | do_action( 'gravityview_search_widget_field_before', $this, $search_field ); |
37 | 37 | |
38 | 38 | $gravityview_view->search_field = $search_field; |
39 | - $this->render( 'search-field', $search_field['input'], false ); |
|
39 | + $this->render( 'search-field', $search_field[ 'input' ], false ); |
|
40 | 40 | |
41 | 41 | // show/hide the search button if there are input type fields |
42 | - if( !$has_inputs && $search_field['input'] != 'link' ) { |
|
42 | + if ( ! $has_inputs && $search_field[ 'input' ] != 'link' ) { |
|
43 | 43 | $has_inputs = true; |
44 | 44 | } |
45 | 45 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | do_action( 'gravityview_search_widget_fields_after', $this ); |
59 | 59 | |
60 | - if( $has_inputs ) { |
|
60 | + if ( $has_inputs ) { |
|
61 | 61 | $this->render( 'search-field', 'submit', false ); |
62 | 62 | } |
63 | 63 | ?> |
@@ -10,22 +10,22 @@ |
||
10 | 10 | $search_field = $gravityview_view->search_field; |
11 | 11 | |
12 | 12 | // Make sure that there are choices to display |
13 | -if( empty( $search_field['choices'] ) ) { |
|
13 | +if ( empty( $search_field[ 'choices' ] ) ) { |
|
14 | 14 | gravityview()->log->debug( 'search-field-radio.php - No choices for field' ); |
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
18 | 18 | ?> |
19 | 19 | <div class="gv-search-box gv-search-field-radio"> |
20 | - <?php if( ! gv_empty( $search_field['label'], false, false ) ) { ?> |
|
21 | - <label for=search-box-<?php echo esc_attr( $search_field['name'] ); ?>><?php echo esc_html( $search_field['label'] ); ?></label> |
|
20 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { ?> |
|
21 | + <label for=search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
22 | 22 | <?php } ?> |
23 | 23 | <p> |
24 | - <?php foreach( $search_field['choices'] as $choice ) { ?> |
|
24 | + <?php foreach ( $search_field[ 'choices' ] as $choice ) { ?> |
|
25 | 25 | |
26 | - <label for="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" class="gv-check-radio"> |
|
27 | - <input type="radio" name="<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $choice['value'] ); ?>" id="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" <?php checked( $choice['value'], $search_field['value'], true ); ?>> |
|
28 | - <?php echo esc_html( $choice['text'] ); ?> |
|
26 | + <label for="search-box-<?php echo sanitize_html_class( $search_field[ 'name' ] . $choice[ 'value' ] . $choice[ 'text' ] ); ?>" class="gv-check-radio"> |
|
27 | + <input type="radio" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $choice[ 'value' ] ); ?>" id="search-box-<?php echo sanitize_html_class( $search_field[ 'name' ] . $choice[ 'value' ] . $choice[ 'text' ] ); ?>" <?php checked( $choice[ 'value' ], $search_field[ 'value' ], true ); ?>> |
|
28 | + <?php echo esc_html( $choice[ 'text' ] ); ?> |
|
29 | 29 | </label> |
30 | 30 | |
31 | 31 | <?php } ?> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | $search_field = $gravityview_view->search_field; |
11 | 11 | |
12 | 12 | // Make sure that there are choices to display |
13 | -if( empty( $search_field['choices'] ) ) { |
|
13 | +if ( empty( $search_field[ 'choices' ] ) ) { |
|
14 | 14 | gravityview()->log->debug( 'search-field-multiselect.php - No choices for field' ); |
15 | 15 | return; |
16 | 16 | } |
@@ -21,19 +21,19 @@ discard block |
||
21 | 21 | * @param string $default_option Default: `—` (—) |
22 | 22 | * @param string $field_type Field type: "select" or "multiselect" |
23 | 23 | */ |
24 | -$default_option = apply_filters('gravityview/extension/search/select_default', '—', 'multiselect' ); |
|
24 | +$default_option = apply_filters( 'gravityview/extension/search/select_default', '—', 'multiselect' ); |
|
25 | 25 | |
26 | 26 | ?> |
27 | 27 | <div class="gv-search-box gv-search-field-multiselect"> |
28 | - <?php if( ! gv_empty( $search_field['label'], false, false ) ) { ?> |
|
29 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label> |
|
28 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { ?> |
|
29 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
30 | 30 | <?php } ?> |
31 | 31 | <p> |
32 | - <select name="<?php echo esc_attr( $search_field['name'] ); ?>[]" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" multiple> |
|
33 | - <option value="" <?php gv_selected( '', $search_field['value'], true ); ?>><?php echo esc_html( $default_option ); ?></option> |
|
32 | + <select name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>[]" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" multiple> |
|
33 | + <option value="" <?php gv_selected( '', $search_field[ 'value' ], true ); ?>><?php echo esc_html( $default_option ); ?></option> |
|
34 | 34 | <?php |
35 | - foreach( $search_field['choices'] as $choice ) : ?> |
|
36 | - <option value="<?php echo esc_attr( $choice['value'] ); ?>" <?php gv_selected( $choice['value'], $search_field['value'], true ); ?>><?php echo esc_html( $choice['text'] ); ?></option> |
|
35 | + foreach ( $search_field[ 'choices' ] as $choice ) : ?> |
|
36 | + <option value="<?php echo esc_attr( $choice[ 'value' ] ); ?>" <?php gv_selected( $choice[ 'value' ], $search_field[ 'value' ], true ); ?>><?php echo esc_html( $choice[ 'text' ] ); ?></option> |
|
37 | 37 | <?php endforeach; ?> |
38 | 38 | </select> |
39 | 39 | </p> |
@@ -28,11 +28,11 @@ |
||
28 | 28 | |
29 | 29 | $show_mt = $this->show_merge_tags(); |
30 | 30 | |
31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
32 | - $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
|
33 | - } |
|
34 | - $class .= \GV\Utils::get( $this->field, 'class', 'widefat' ); |
|
35 | - $placeholder = \GV\Utils::get( $this->field, 'placeholder' ); |
|
31 | + if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
32 | + $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
|
33 | + } |
|
34 | + $class .= \GV\Utils::get( $this->field, 'class', 'widefat' ); |
|
35 | + $placeholder = \GV\Utils::get( $this->field, 'placeholder' ); |
|
36 | 36 | ?> |
37 | 37 | <input name="<?php echo esc_attr( $this->name ); ?>" placeholder="<?php echo esc_attr( $placeholder ); ?>" id="<?php echo $this->get_field_id(); ?>" type="text" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
38 | 38 | <?php |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | ?> |
9 | 9 | <label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php |
10 | 10 | |
11 | - echo '<span class="gv-label">'.$this->get_field_label().'</span>'; |
|
11 | + echo '<span class="gv-label">' . $this->get_field_label() . '</span>'; |
|
12 | 12 | echo $this->get_tooltip() . $this->get_field_desc(); |
13 | 13 | ?><div> |
14 | 14 | <?php $this->render_input(); ?> |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | function render_input( $override_input = null ) { |
21 | 21 | |
22 | - if( isset( $override_input ) ) { |
|
22 | + if ( isset( $override_input ) ) { |
|
23 | 23 | echo $override_input; |
24 | 24 | return; |
25 | 25 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | $show_mt = $this->show_merge_tags(); |
30 | 30 | |
31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
31 | + if ( $show_mt && $this->field[ 'merge_tags' ] !== false || $this->field[ 'merge_tags' ] === 'force' ) { |
|
32 | 32 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
33 | 33 | } |
34 | 34 | $class .= \GV\Utils::get( $this->field, 'class', 'widefat' ); |
@@ -42,7 +42,7 @@ |
||
42 | 42 | static function getInstance() { |
43 | 43 | gravityview()->log->notice( '\GravityView_oEmbed is deprecated. Use \GV\oEmbed instead.' ); |
44 | 44 | |
45 | - if( empty( self::$instance ) ) { |
|
45 | + if ( empty( self::$instance ) ) { |
|
46 | 46 | self::$instance = new self; |
47 | 47 | self::$instance->initialize(); |
48 | 48 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | $widget_ops = array( |
13 | 13 | 'classname' => 'widget_gravityview_search', |
14 | - 'description' => __( 'A search form for a specific GravityView.', 'gravityview') |
|
14 | + 'description' => __( 'A search form for a specific GravityView.', 'gravityview' ) |
|
15 | 15 | ); |
16 | 16 | |
17 | 17 | $widget_display = array( |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | private function load_required_files() { |
37 | - if( !class_exists( 'GravityView_Widget_Search' ) ) { |
|
37 | + if ( ! class_exists( 'GravityView_Widget_Search' ) ) { |
|
38 | 38 | gravityview_register_gravityview_widgets(); |
39 | 39 | } |
40 | 40 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | public function widget( $args, $instance ) { |
54 | 54 | |
55 | 55 | // Don't show unless a View ID has been set. |
56 | - if( empty( $instance['view_id'] ) ) { |
|
56 | + if ( empty( $instance[ 'view_id' ] ) ) { |
|
57 | 57 | |
58 | 58 | gravityview()->log->debug( 'No View ID has been defined. Not showing the widget.', array( 'data' => $instance ) ); |
59 | 59 | |
@@ -61,22 +61,22 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | /** This filter is documented in wp-includes/default-widgets.php */ |
64 | - $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); |
|
64 | + $title = apply_filters( 'widget_title', empty( $instance[ 'title' ] ) ? '' : $instance[ 'title' ], $instance, $this->id_base ); |
|
65 | 65 | |
66 | - echo $args['before_widget']; |
|
66 | + echo $args[ 'before_widget' ]; |
|
67 | 67 | |
68 | 68 | if ( $title ) { |
69 | - echo $args['before_title'] . $title . $args['after_title']; |
|
69 | + echo $args[ 'before_title' ] . $title . $args[ 'after_title' ]; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | // @todo Add to the widget configuration form |
73 | - $instance['search_layout'] = apply_filters( 'gravityview/widget/search/layout', 'vertical', $instance ); |
|
73 | + $instance[ 'search_layout' ] = apply_filters( 'gravityview/widget/search/layout', 'vertical', $instance ); |
|
74 | 74 | |
75 | - $instance['context'] = 'wp_widget'; |
|
75 | + $instance[ 'context' ] = 'wp_widget'; |
|
76 | 76 | |
77 | 77 | // form |
78 | - $instance['form_id'] = GVCommon::get_meta_form_id( $instance['view_id'] ); |
|
79 | - $instance['form'] = GVCommon::get_form( $instance['form_id'] ); |
|
78 | + $instance[ 'form_id' ] = GVCommon::get_meta_form_id( $instance[ 'view_id' ] ); |
|
79 | + $instance[ 'form' ] = GVCommon::get_form( $instance[ 'form_id' ] ); |
|
80 | 80 | |
81 | 81 | // We don't want to overwrite existing context, etc. |
82 | 82 | $previous_view = GravityView_View::getInstance(); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | new GravityView_View( $previous_view ); |
94 | 94 | |
95 | - echo $args['after_widget']; |
|
95 | + echo $args[ 'after_widget' ]; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -102,27 +102,27 @@ discard block |
||
102 | 102 | |
103 | 103 | $instance = $old_instance; |
104 | 104 | |
105 | - if( $this->is_preview() ) { |
|
105 | + if ( $this->is_preview() ) { |
|
106 | 106 | //Oh! Sorry but still not fully compatible with customizer |
107 | 107 | return $instance; |
108 | 108 | } |
109 | 109 | |
110 | - $new_instance = wp_parse_args( (array) $new_instance, self::get_defaults() ); |
|
110 | + $new_instance = wp_parse_args( (array)$new_instance, self::get_defaults() ); |
|
111 | 111 | |
112 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
113 | - $instance['view_id'] = absint( $new_instance['view_id'] ); |
|
114 | - $instance['search_fields'] = $new_instance['search_fields']; |
|
115 | - $instance['post_id'] = $new_instance['post_id']; |
|
116 | - $instance['search_clear'] = $new_instance['search_clear']; |
|
117 | - $instance['search_mode'] = $new_instance['search_mode']; |
|
112 | + $instance[ 'title' ] = strip_tags( $new_instance[ 'title' ] ); |
|
113 | + $instance[ 'view_id' ] = absint( $new_instance[ 'view_id' ] ); |
|
114 | + $instance[ 'search_fields' ] = $new_instance[ 'search_fields' ]; |
|
115 | + $instance[ 'post_id' ] = $new_instance[ 'post_id' ]; |
|
116 | + $instance[ 'search_clear' ] = $new_instance[ 'search_clear' ]; |
|
117 | + $instance[ 'search_mode' ] = $new_instance[ 'search_mode' ]; |
|
118 | 118 | |
119 | - $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance['post_id'], $instance['view_id'], true ); |
|
119 | + $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance[ 'post_id' ], $instance[ 'view_id' ], true ); |
|
120 | 120 | |
121 | 121 | //check if post_id is a valid post with embedded View |
122 | - $instance['error_post_id'] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
122 | + $instance[ 'error_post_id' ] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
123 | 123 | |
124 | 124 | // Share that the widget isn't brand new |
125 | - $instance['updated'] = 1; |
|
125 | + $instance[ 'updated' ] = 1; |
|
126 | 126 | |
127 | 127 | return $instance; |
128 | 128 | } |
@@ -133,28 +133,28 @@ discard block |
||
133 | 133 | public function form( $instance ) { |
134 | 134 | |
135 | 135 | // @todo Make compatible with Customizer |
136 | - if( $this->is_preview() ) { |
|
136 | + if ( $this->is_preview() ) { |
|
137 | 137 | |
138 | - $warning = sprintf( esc_html__( 'This widget is not configurable from this screen. Please configure it on the %sWidgets page%s.', 'gravityview' ), '<a href="'.admin_url('widgets.php').'">', '</a>' ); |
|
138 | + $warning = sprintf( esc_html__( 'This widget is not configurable from this screen. Please configure it on the %sWidgets page%s.', 'gravityview' ), '<a href="' . admin_url( 'widgets.php' ) . '">', '</a>' ); |
|
139 | 139 | |
140 | 140 | echo wpautop( GravityView_Admin::get_floaty() . $warning ); |
141 | 141 | |
142 | 142 | return; |
143 | 143 | } |
144 | 144 | |
145 | - $instance = wp_parse_args( (array) $instance, self::get_defaults() ); |
|
145 | + $instance = wp_parse_args( (array)$instance, self::get_defaults() ); |
|
146 | 146 | |
147 | - $title = $instance['title']; |
|
148 | - $view_id = $instance['view_id']; |
|
149 | - $post_id = $instance['post_id']; |
|
150 | - $search_fields = $instance['search_fields']; |
|
151 | - $search_clear = $instance['search_clear']; |
|
152 | - $search_mode = $instance['search_mode']; |
|
147 | + $title = $instance[ 'title' ]; |
|
148 | + $view_id = $instance[ 'view_id' ]; |
|
149 | + $post_id = $instance[ 'post_id' ]; |
|
150 | + $search_fields = $instance[ 'search_fields' ]; |
|
151 | + $search_clear = $instance[ 'search_clear' ]; |
|
152 | + $search_mode = $instance[ 'search_mode' ]; |
|
153 | 153 | |
154 | 154 | $views = GVCommon::get_all_views(); |
155 | 155 | |
156 | 156 | // If there are no views set up yet, we get outta here. |
157 | - if( empty( $views ) ) { ?> |
|
157 | + if ( empty( $views ) ) { ?> |
|
158 | 158 | <div id="select_gravityview_view"> |
159 | 159 | <div class="wrap"><?php echo GravityView_Admin::no_views_text(); ?></div> |
160 | 160 | </div> |
@@ -162,17 +162,17 @@ discard block |
||
162 | 162 | } |
163 | 163 | ?> |
164 | 164 | |
165 | - <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'gravityview'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p> |
|
165 | + <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'gravityview' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p> |
|
166 | 166 | |
167 | 167 | <?php |
168 | 168 | /** |
169 | 169 | * Display errors generated for invalid embed IDs |
170 | 170 | * @see GravityView_View_Data::is_valid_embed_id |
171 | 171 | */ |
172 | - if( isset( $instance['updated'] ) && empty( $instance['view_id'] ) ) { |
|
172 | + if ( isset( $instance[ 'updated' ] ) && empty( $instance[ 'view_id' ] ) ) { |
|
173 | 173 | ?> |
174 | 174 | <div class="error inline hide-on-view-change"> |
175 | - <p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p> |
|
175 | + <p><?php esc_html_e( 'Please select a View to search.', 'gravityview' ); ?></p> |
|
176 | 176 | </div> |
177 | 177 | <?php |
178 | 178 | unset ( $error ); |
@@ -181,12 +181,12 @@ discard block |
||
181 | 181 | |
182 | 182 | <p> |
183 | 183 | <label for="gravityview_view_id"><?php _e( 'View:', 'gravityview' ); ?></label> |
184 | - <select id="gravityview_view_id" name="<?php echo $this->get_field_name('view_id'); ?>" class="widefat"> |
|
184 | + <select id="gravityview_view_id" name="<?php echo $this->get_field_name( 'view_id' ); ?>" class="widefat"> |
|
185 | 185 | <option value=""><?php esc_html_e( '— Select a View —', 'gravityview' ); ?></option> |
186 | 186 | <?php |
187 | - foreach( $views as $view_option ) { |
|
188 | - $title = empty( $view_option->post_title ) ? __('(no title)', 'gravityview') : $view_option->post_title; |
|
189 | - echo '<option value="'. $view_option->ID .'" ' . selected( esc_attr( $view_id ), $view_option->ID, false ) . '>'. esc_html( sprintf('%s #%d', $title, $view_option->ID ) ) .'</option>'; |
|
187 | + foreach ( $views as $view_option ) { |
|
188 | + $title = empty( $view_option->post_title ) ? __( '(no title)', 'gravityview' ) : $view_option->post_title; |
|
189 | + echo '<option value="' . $view_option->ID . '" ' . selected( esc_attr( $view_id ), $view_option->ID, false ) . '>' . esc_html( sprintf( '%s #%d', $title, $view_option->ID ) ) . '</option>'; |
|
190 | 190 | } |
191 | 191 | ?> |
192 | 192 | </select> |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | * Display errors generated for invalid embed IDs |
199 | 199 | * @see GravityView_View_Data::is_valid_embed_id |
200 | 200 | */ |
201 | - if( !empty( $instance['error_post_id'] ) ) { |
|
201 | + if ( ! empty( $instance[ 'error_post_id' ] ) ) { |
|
202 | 202 | ?> |
203 | 203 | <div class="error inline"> |
204 | - <p><?php echo $instance['error_post_id']; ?></p> |
|
204 | + <p><?php echo $instance[ 'error_post_id' ]; ?></p> |
|
205 | 205 | </div> |
206 | 206 | <?php |
207 | 207 | unset ( $error ); |
@@ -209,40 +209,40 @@ discard block |
||
209 | 209 | ?> |
210 | 210 | |
211 | 211 | <p> |
212 | - <label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
213 | - <input class="code" size="3" id="<?php echo $this->get_field_id('post_id'); ?>" name="<?php echo $this->get_field_name('post_id'); ?>" type="text" value="<?php echo esc_attr( $post_id ); ?>" /> |
|
212 | + <label for="<?php echo $this->get_field_id( 'post_id' ); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
213 | + <input class="code" size="3" id="<?php echo $this->get_field_id( 'post_id' ); ?>" name="<?php echo $this->get_field_name( 'post_id' ); ?>" type="text" value="<?php echo esc_attr( $post_id ); ?>" /> |
|
214 | 214 | <span class="howto"><?php |
215 | - esc_html_e('To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
216 | - echo ' '.gravityview_get_link('https://docs.gravityview.co/article/222-the-search-widget', __('Learn more…', 'gravityview' ), 'target=_blank' ); |
|
215 | + esc_html_e( 'To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
216 | + echo ' ' . gravityview_get_link( 'https://docs.gravityview.co/article/222-the-search-widget', __( 'Learn more…', 'gravityview' ), 'target=_blank' ); |
|
217 | 217 | ?></span> |
218 | 218 | </p> |
219 | 219 | |
220 | 220 | <p> |
221 | - <label for="<?php echo $this->get_field_id('search_clear'); ?>"><?php esc_html_e( 'Show Clear button', 'gravityview' ); ?>:</label> |
|
222 | - <input name="<?php echo $this->get_field_name('search_clear'); ?>" type="hidden" value="0"> |
|
223 | - <input id="<?php echo $this->get_field_id('search_clear'); ?>" name="<?php echo $this->get_field_name('search_clear'); ?>" type="checkbox" class="checkbox" value="1" <?php checked( $search_clear, 1, true ); ?>> |
|
221 | + <label for="<?php echo $this->get_field_id( 'search_clear' ); ?>"><?php esc_html_e( 'Show Clear button', 'gravityview' ); ?>:</label> |
|
222 | + <input name="<?php echo $this->get_field_name( 'search_clear' ); ?>" type="hidden" value="0"> |
|
223 | + <input id="<?php echo $this->get_field_id( 'search_clear' ); ?>" name="<?php echo $this->get_field_name( 'search_clear' ); ?>" type="checkbox" class="checkbox" value="1" <?php checked( $search_clear, 1, true ); ?>> |
|
224 | 224 | </p> |
225 | 225 | |
226 | 226 | <p> |
227 | 227 | <label><?php esc_html_e( 'Search Mode', 'gravityview' ); ?>:</label> |
228 | - <label for="<?php echo $this->get_field_id('search_mode'); ?>_any"> |
|
229 | - <input id="<?php echo $this->get_field_id('search_mode'); ?>_any" name="<?php echo $this->get_field_name('search_mode'); ?>" type="radio" class="radio" value="any" <?php checked( $search_mode, 'any', true ); ?>> |
|
228 | + <label for="<?php echo $this->get_field_id( 'search_mode' ); ?>_any"> |
|
229 | + <input id="<?php echo $this->get_field_id( 'search_mode' ); ?>_any" name="<?php echo $this->get_field_name( 'search_mode' ); ?>" type="radio" class="radio" value="any" <?php checked( $search_mode, 'any', true ); ?>> |
|
230 | 230 | <?php esc_html_e( 'Match Any Fields', 'gravityview' ); ?> |
231 | 231 | </label> |
232 | - <label for="<?php echo $this->get_field_id('search_mode'); ?>_all"> |
|
233 | - <input id="<?php echo $this->get_field_id('search_mode'); ?>_all" name="<?php echo $this->get_field_name('search_mode'); ?>" type="radio" class="radio" value="all" <?php checked( $search_mode, 'all', true ); ?>> |
|
232 | + <label for="<?php echo $this->get_field_id( 'search_mode' ); ?>_all"> |
|
233 | + <input id="<?php echo $this->get_field_id( 'search_mode' ); ?>_all" name="<?php echo $this->get_field_name( 'search_mode' ); ?>" type="radio" class="radio" value="all" <?php checked( $search_mode, 'all', true ); ?>> |
|
234 | 234 | <?php esc_html_e( 'Match All Fields', 'gravityview' ); ?> |
235 | 235 | </label> |
236 | - <span class="howto"><?php esc_html_e('Should search results match all search fields, or any?', 'gravityview' ); ?></span |
|
236 | + <span class="howto"><?php esc_html_e( 'Should search results match all search fields, or any?', 'gravityview' ); ?></span |
|
237 | 237 | </p> |
238 | 238 | |
239 | 239 | <hr /> |
240 | 240 | |
241 | 241 | <?php // @todo: move style to CSS ?> |
242 | 242 | <div style="margin-bottom: 1em;"> |
243 | - <label class="screen-reader-text" for="<?php echo $this->get_field_id('search_fields'); ?>"><?php _e( 'Searchable fields:', 'gravityview' ); ?></label> |
|
244 | - <div class="gv-widget-search-fields" title="<?php esc_html_e('Search Fields', 'gravityview'); ?>"> |
|
245 | - <input id="<?php echo $this->get_field_id('search_fields'); ?>" name="<?php echo $this->get_field_name('search_fields'); ?>" type="hidden" value="<?php echo esc_attr( $search_fields ); ?>" class="gv-search-fields-value"> |
|
243 | + <label class="screen-reader-text" for="<?php echo $this->get_field_id( 'search_fields' ); ?>"><?php _e( 'Searchable fields:', 'gravityview' ); ?></label> |
|
244 | + <div class="gv-widget-search-fields" title="<?php esc_html_e( 'Search Fields', 'gravityview' ); ?>"> |
|
245 | + <input id="<?php echo $this->get_field_id( 'search_fields' ); ?>" name="<?php echo $this->get_field_name( 'search_fields' ); ?>" type="hidden" value="<?php echo esc_attr( $search_fields ); ?>" class="gv-search-fields-value"> |
|
246 | 246 | </div> |
247 | 247 | |
248 | 248 | </div> |
@@ -333,8 +333,8 @@ discard block |
||
333 | 333 | * @param mixed $field_id Field ID or Field array |
334 | 334 | * @return string field type |
335 | 335 | */ |
336 | -function gravityview_get_field_type( $form = null , $field_id = '' ) { |
|
337 | - return GVCommon::get_field_type( $form, $field_id ); |
|
336 | +function gravityview_get_field_type( $form = null, $field_id = '' ) { |
|
337 | + return GVCommon::get_field_type( $form, $field_id ); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | |
@@ -347,8 +347,8 @@ discard block |
||
347 | 347 | * @return string HTML of the output. Empty string if $view_id is empty. |
348 | 348 | */ |
349 | 349 | function get_gravityview( $view_id = '', $atts = array() ) { |
350 | - if( !empty( $view_id ) ) { |
|
351 | - $atts['id'] = $view_id; |
|
350 | + if ( ! empty( $view_id ) ) { |
|
351 | + $atts[ 'id' ] = $view_id; |
|
352 | 352 | $args = wp_parse_args( $atts, \GV\View_Settings::defaults() ); |
353 | 353 | $GravityView_frontend = GravityView_frontend::getInstance(); |
354 | 354 | $GravityView_frontend->setGvOutputData( GravityView_View_Data::getInstance( $view_id ) ); |
@@ -391,19 +391,19 @@ discard block |
||
391 | 391 | */ |
392 | 392 | function gravityview_view_has_single_checkbox_or_radio( $form, $view_fields ) { |
393 | 393 | |
394 | - if( class_exists('GFFormsModel') && $form_fields = GFFormsModel::get_fields_by_type( $form, array( 'checkbox', 'radio' ) ) ) { |
|
394 | + if ( class_exists( 'GFFormsModel' ) && $form_fields = GFFormsModel::get_fields_by_type( $form, array( 'checkbox', 'radio' ) ) ) { |
|
395 | 395 | |
396 | 396 | /** @var GF_Field_Radio|GF_Field_Checkbox $form_field */ |
397 | - foreach( $form_fields as $form_field ) { |
|
397 | + foreach ( $form_fields as $form_field ) { |
|
398 | 398 | $field_id = $form_field->id; |
399 | - foreach( $view_fields as $zone ) { |
|
399 | + foreach ( $view_fields as $zone ) { |
|
400 | 400 | |
401 | 401 | // ACF compatibility; ACF-added fields aren't arrays |
402 | 402 | if ( ! is_array( $zone ) ) { continue; } |
403 | 403 | |
404 | - foreach( $zone as $field ) { |
|
404 | + foreach ( $zone as $field ) { |
|
405 | 405 | // If it's an input, not the parent and the parent ID matches a checkbox or radio |
406 | - if( ( strpos( $field['id'], '.' ) > 0 ) && floor( $field['id'] ) === floor( $field_id ) ) { |
|
406 | + if ( ( strpos( $field[ 'id' ], '.' ) > 0 ) && floor( $field[ 'id' ] ) === floor( $field_id ) ) { |
|
407 | 407 | return true; |
408 | 408 | } |
409 | 409 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * Return array of fields' id and label, for a given Form ID |
59 | 59 | * |
60 | 60 | * @see GVCommon::get_form_fields() |
61 | - * @param string|array $form_id (default: '') or $form object |
|
61 | + * @param string|array $form (default: '') or $form object |
|
62 | 62 | * @return array |
63 | 63 | */ |
64 | 64 | function gravityview_get_form_fields( $form = '', $add_default_properties = false, $include_parent_field = true ) { |
@@ -216,7 +216,6 @@ discard block |
||
216 | 216 | * |
217 | 217 | * @see GravityView_Template::template_id |
218 | 218 | * |
219 | - * @param int $view_id The ID of the View to get the layout of |
|
220 | 219 | * |
221 | 220 | * @return string GravityView_Template::template_id value. Empty string if not. |
222 | 221 | */ |
@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | |
21 | 21 | function __construct() { |
22 | 22 | |
23 | - add_action( 'media_buttons', array( $this, 'add_shortcode_button'), 30); |
|
23 | + add_action( 'media_buttons', array( $this, 'add_shortcode_button' ), 30 ); |
|
24 | 24 | |
25 | - add_action( 'admin_footer', array( $this, 'add_shortcode_popup') ); |
|
25 | + add_action( 'admin_footer', array( $this, 'add_shortcode_popup' ) ); |
|
26 | 26 | |
27 | 27 | // adding styles and scripts |
28 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
28 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); |
|
29 | 29 | |
30 | 30 | // ajax - populate sort fields based on the selected view |
31 | 31 | add_action( 'wp_ajax_gv_sortable_fields', array( $this, 'get_sortable_fields' ) ); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | function is_post_editor_screen() { |
42 | 42 | global $current_screen, $pagenow; |
43 | - return !empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow , array( 'post.php' , 'post-new.php' ) ); |
|
43 | + return ! empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow, array( 'post.php', 'post-new.php' ) ); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -55,15 +55,15 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * @since 1.15.3 |
57 | 57 | */ |
58 | - if( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) { |
|
58 | + if ( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) { |
|
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | - if( !$this->is_post_editor_screen() ) { |
|
62 | + if ( ! $this->is_post_editor_screen() ) { |
|
63 | 63 | return; |
64 | 64 | } |
65 | 65 | ?> |
66 | - <a href="#TB_inline?width=600&height=800&inlineId=select_gravityview_view" class="thickbox hide-if-no-js button gform_media_link" id="add_gravityview" title="<?php esc_attr_e("Insert View", 'gravityview'); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a> |
|
66 | + <a href="#TB_inline?width=600&height=800&inlineId=select_gravityview_view" class="thickbox hide-if-no-js button gform_media_link" id="add_gravityview" title="<?php esc_attr_e( "Insert View", 'gravityview' ); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a> |
|
67 | 67 | <?php |
68 | 68 | |
69 | 69 | } |
@@ -79,16 +79,16 @@ discard block |
||
79 | 79 | function add_shortcode_popup() { |
80 | 80 | global $post; |
81 | 81 | |
82 | - if( !$this->is_post_editor_screen() ) { |
|
82 | + if ( ! $this->is_post_editor_screen() ) { |
|
83 | 83 | return; |
84 | 84 | } |
85 | 85 | |
86 | - $post_type = get_post_type_object($post->post_type); |
|
86 | + $post_type = get_post_type_object( $post->post_type ); |
|
87 | 87 | |
88 | - $views = get_posts( array('post_type' => 'gravityview', 'posts_per_page' => -1 ) ); |
|
88 | + $views = get_posts( array( 'post_type' => 'gravityview', 'posts_per_page' => -1 ) ); |
|
89 | 89 | |
90 | 90 | // If there are no views set up yet, we get outta here. |
91 | - if( empty( $views ) ) { |
|
91 | + if ( empty( $views ) ) { |
|
92 | 92 | echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Admin::no_views_text() . '</div></div>'; |
93 | 93 | return; |
94 | 94 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | <div class="wrap"> |
100 | 100 | |
101 | 101 | <h2 class=""><?php esc_html_e( 'Embed a View', 'gravityview' ); ?></h2> |
102 | - <p class="subtitle"><?php printf( esc_attr ( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview') ), $post_type->labels->singular_name, '<a href="https://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p> |
|
102 | + <p class="subtitle"><?php printf( esc_attr( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview' ) ), $post_type->labels->singular_name, '<a href="https://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p> |
|
103 | 103 | |
104 | 104 | <div> |
105 | 105 | <h3><label for="gravityview_id"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label></h3> |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | <select name="gravityview_id" id="gravityview_id"> |
108 | 108 | <option value=""><?php esc_html_e( '— Select a View to Insert —', 'gravityview' ); ?></option> |
109 | 109 | <?php |
110 | - foreach( $views as $view ) { |
|
111 | - $title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title; |
|
112 | - echo '<option value="'. $view->ID .'">'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>'; |
|
110 | + foreach ( $views as $view ) { |
|
111 | + $title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title; |
|
112 | + echo '<option value="' . $view->ID . '">' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>'; |
|
113 | 113 | } |
114 | 114 | ?> |
115 | 115 | </select> |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | foreach ( $settings as $key => $setting ) { |
127 | 127 | |
128 | - if( empty( $setting['show_in_shortcode'] ) ) { continue; } |
|
128 | + if ( empty( $setting[ 'show_in_shortcode' ] ) ) { continue; } |
|
129 | 129 | |
130 | 130 | GravityView_Render_Settings::render_setting_row( $key, array(), NULL, 'gravityview_%s', 'gravityview_%s' ); |
131 | 131 | } |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | </table> |
135 | 135 | |
136 | 136 | <div class="submit"> |
137 | - <input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e('Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" /> |
|
138 | - <input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e("Cancel", 'gravityview'); ?>" /> |
|
137 | + <input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e( 'Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" /> |
|
138 | + <input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e( "Cancel", 'gravityview' ); ?>" /> |
|
139 | 139 | </div> |
140 | 140 | |
141 | 141 | </div> |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | function add_scripts_and_styles() { |
158 | 158 | |
159 | - if( ! $this->is_post_editor_screen() ) { |
|
159 | + if ( ! $this->is_post_editor_screen() ) { |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | |
@@ -167,22 +167,22 @@ discard block |
||
167 | 167 | |
168 | 168 | $protocol = is_ssl() ? 'https://' : 'http://'; |
169 | 169 | |
170 | - wp_enqueue_style( 'jquery-ui-datepicker', $protocol.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version ); |
|
170 | + wp_enqueue_style( 'jquery-ui-datepicker', $protocol . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version ); |
|
171 | 171 | |
172 | 172 | //enqueue styles |
173 | - wp_register_style( 'gravityview_postedit_styles', plugins_url('assets/css/admin-post-edit.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
173 | + wp_register_style( 'gravityview_postedit_styles', plugins_url( 'assets/css/admin-post-edit.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
174 | 174 | wp_enqueue_style( 'gravityview_postedit_styles' ); |
175 | 175 | |
176 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
176 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
177 | 177 | |
178 | 178 | // custom js |
179 | - wp_register_script( 'gravityview_postedit_scripts', plugins_url('assets/js/admin-post-edit'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version ); |
|
179 | + wp_register_script( 'gravityview_postedit_scripts', plugins_url( 'assets/js/admin-post-edit' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version ); |
|
180 | 180 | wp_enqueue_script( 'gravityview_postedit_scripts' ); |
181 | - wp_localize_script('gravityview_postedit_scripts', 'gvGlobals', array( |
|
182 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode'), |
|
181 | + wp_localize_script( 'gravityview_postedit_scripts', 'gvGlobals', array( |
|
182 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode' ), |
|
183 | 183 | 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
184 | - 'alert_1' => esc_html__( 'Please select a View', 'gravityview'), |
|
185 | - )); |
|
184 | + 'alert_1' => esc_html__( 'Please select a View', 'gravityview' ), |
|
185 | + ) ); |
|
186 | 186 | |
187 | 187 | } |
188 | 188 | |
@@ -198,16 +198,16 @@ discard block |
||
198 | 198 | function get_sortable_fields() { |
199 | 199 | |
200 | 200 | // Not properly formatted request |
201 | - if ( empty( $_POST['viewid'] ) || !is_numeric( $_POST['viewid'] ) ) { |
|
201 | + if ( empty( $_POST[ 'viewid' ] ) || ! is_numeric( $_POST[ 'viewid' ] ) ) { |
|
202 | 202 | exit( false ); |
203 | 203 | } |
204 | 204 | |
205 | 205 | // Not valid request |
206 | - if( empty( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxaddshortcode' ) ) { |
|
206 | + if ( empty( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxaddshortcode' ) ) { |
|
207 | 207 | exit( false ); |
208 | 208 | } |
209 | 209 | |
210 | - $viewid = (int)$_POST['viewid']; |
|
210 | + $viewid = (int)$_POST[ 'viewid' ]; |
|
211 | 211 | |
212 | 212 | // fetch form id assigned to the view |
213 | 213 | $formid = gravityview_get_form_id( $viewid ); |
@@ -109,7 +109,7 @@ |
||
109 | 109 | $field_data = array( |
110 | 110 | 'label' => \GV\Utils::get( $edit_field, 'custom_label' ), |
111 | 111 | 'customLabel' => \GV\Utils::get( $edit_field, 'custom_label' ), |
112 | - 'content' => \GV\Utils::get( $edit_field, 'content' ), |
|
112 | + 'content' => \GV\Utils::get( $edit_field, 'content' ), |
|
113 | 113 | ); |
114 | 114 | |
115 | 115 | // Replace merge tags in the content |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) { |
58 | 58 | |
59 | - $entry_default_fields['custom'] = array( |
|
59 | + $entry_default_fields[ 'custom' ] = array( |
|
60 | 60 | 'label' => $this->label, |
61 | 61 | 'type' => $this->name, |
62 | 62 | 'desc' => $this->description, |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
71 | 71 | |
72 | - unset ( $field_options['search_filter'], $field_options['show_as_link'], $field_options['new_window'] ); |
|
72 | + unset ( $field_options[ 'search_filter' ], $field_options[ 'show_as_link' ], $field_options[ 'new_window' ] ); |
|
73 | 73 | |
74 | 74 | $new_fields = array( |
75 | 75 | 'content' => array( |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | ); |
109 | 109 | |
110 | 110 | if ( 'edit' === $context ) { |
111 | - unset( $field_options['custom_label'], $field_options['show_label'], $field_options['allow_edit_cap'], $new_fields['wpautop'], $new_fields['oembed'] ); |
|
111 | + unset( $field_options[ 'custom_label' ], $field_options[ 'show_label' ], $field_options[ 'allow_edit_cap' ], $new_fields[ 'wpautop' ], $new_fields[ 'oembed' ] ); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | return $new_fields + $field_options; |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | |
143 | 143 | // Loop through the configured Edit Entry fields and add Custom Content fields if there are any |
144 | 144 | // TODO: Make this available to other custom GV field types |
145 | - foreach ( (array) $edit_fields as $edit_field ) { |
|
145 | + foreach ( (array)$edit_fields as $edit_field ) { |
|
146 | 146 | |
147 | - if( 'custom' === \GV\Utils::get( $edit_field, 'id') ) { |
|
147 | + if ( 'custom' === \GV\Utils::get( $edit_field, 'id' ) ) { |
|
148 | 148 | |
149 | 149 | $field_data = array( |
150 | 150 | 'label' => \GV\Utils::get( $edit_field, 'custom_label' ), |
@@ -157,13 +157,13 @@ discard block |
||
157 | 157 | $field_data[ $key ] = GravityView_Merge_Tags::replace_variables( $field_datum, $form, $entry->as_entry(), false, false ); |
158 | 158 | } |
159 | 159 | |
160 | - $field_data['cssClass'] = \GV\Utils::get( $edit_field, 'custom_class' ); |
|
160 | + $field_data[ 'cssClass' ] = \GV\Utils::get( $edit_field, 'custom_class' ); |
|
161 | 161 | |
162 | - $new_fields[] = new GF_Field_HTML( $field_data ); |
|
162 | + $new_fields[ ] = new GF_Field_HTML( $field_data ); |
|
163 | 163 | |
164 | 164 | } else { |
165 | - if( isset( $fields[ $i ] ) ) { |
|
166 | - $new_fields[] = $fields[ $i ]; |
|
165 | + if ( isset( $fields[ $i ] ) ) { |
|
166 | + $new_fields[ ] = $fields[ $i ]; |
|
167 | 167 | } |
168 | 168 | $i++; |
169 | 169 | } |