@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | ?> |
14 | 14 | <label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php |
15 | 15 | |
16 | - echo '<span class="gv-label">'.$this->get_field_label().'</span>'; |
|
16 | + echo '<span class="gv-label">' . $this->get_field_label() . '</span>'; |
|
17 | 17 | |
18 | 18 | echo $this->get_tooltip() . $this->get_field_desc(); |
19 | 19 | |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | |
27 | 27 | function render_input( $override_input = null ) { |
28 | 28 | |
29 | - if( isset( $override_input ) ) { |
|
29 | + if ( isset( $override_input ) ) { |
|
30 | 30 | echo $override_input; |
31 | 31 | return; |
32 | 32 | } |
33 | 33 | |
34 | 34 | ?> |
35 | 35 | <select name="<?php echo esc_attr( $this->name ); ?>[]" id="<?php echo $this->get_field_id(); ?>" multiple="multiple"> |
36 | - <?php foreach( $this->field['options'] as $value => $label ) : ?> |
|
36 | + <?php foreach ( $this->field[ 'options' ] as $value => $label ) : ?> |
|
37 | 37 | <option value="<?php echo esc_attr( $value ); ?>" <?php selected( in_array( $value, (array)$this->value ), true, true ); ?>><?php echo esc_html( $label ); ?></option> |
38 | 38 | <?php endforeach; ?> |
39 | 39 | </select> |
@@ -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,30 +53,30 @@ 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 | - do_action('gravityview_log_debug', sprintf( '%s[widget]: No View ID has been defined. Not showing the widget.', get_class($this)), $instance ); |
|
58 | + do_action( 'gravityview_log_debug', sprintf( '%s[widget]: No View ID has been defined. Not showing the widget.', get_class( $this ) ), $instance ); |
|
59 | 59 | |
60 | 60 | return; |
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( $new_instance['post_id'], $instance['view_id'] ); |
|
119 | + $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $new_instance[ 'post_id' ], $instance[ 'view_id' ] ); |
|
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('http://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( 'http://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> |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | add_filter( 'icl_ls_languages', array( $this, 'wpml_ls_filter' ) ); |
64 | 64 | |
65 | - add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link') ); |
|
65 | + add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link' ) ); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | function filter_gravityview_back_link( $link ) { |
83 | 83 | global $wpml_url_filters; |
84 | 84 | |
85 | - if( $wpml_url_filters ) { |
|
85 | + if ( $wpml_url_filters ) { |
|
86 | 86 | $link = $wpml_url_filters->permalink_filter( $link, GravityView_frontend::getInstance()->getPostId() ); |
87 | 87 | } |
88 | 88 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | private function remove_url_hooks() { |
100 | 100 | global $wpml_url_filters; |
101 | 101 | |
102 | - if( ! $wpml_url_filters ) { |
|
102 | + if ( ! $wpml_url_filters ) { |
|
103 | 103 | return; |
104 | 104 | } |
105 | 105 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | private function add_url_hooks() { |
123 | 123 | global $wpml_url_filters; |
124 | 124 | |
125 | - if( ! $wpml_url_filters ) { |
|
125 | + if ( ! $wpml_url_filters ) { |
|
126 | 126 | return; |
127 | 127 | } |
128 | 128 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | |
162 | 162 | $this->remove_url_hooks(); |
163 | 163 | |
164 | - if( $translations ) { |
|
164 | + if ( $translations ) { |
|
165 | 165 | foreach ( $languages as $lang_code => $language ) { |
166 | 166 | |
167 | 167 | $lang_post_id = $translations[ $lang_code ]->element_id; |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | break; |
195 | 195 | } |
196 | 196 | |
197 | - $languages[ $lang_code ]['url'] = $entry_link; |
|
197 | + $languages[ $lang_code ][ 'url' ] = $entry_link; |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 |
@@ -11,13 +11,13 @@ discard block |
||
11 | 11 | wp_nonce_field( 'gravityview_select_form', 'gravityview_select_form_nonce' ); |
12 | 12 | |
13 | 13 | //current value |
14 | -$current_form = (int) rgar( (array) $_GET, 'form_id', gravityview_get_form_id( $post->ID ) ); |
|
14 | +$current_form = (int)rgar( (array)$_GET, 'form_id', gravityview_get_form_id( $post->ID ) ); |
|
15 | 15 | |
16 | 16 | // If form is in trash or not existing, show error |
17 | 17 | GravityView_Admin::connected_form_warning( $current_form ); |
18 | 18 | |
19 | 19 | // check for available gravity forms |
20 | -$forms = gravityview_get_forms('any'); |
|
20 | +$forms = gravityview_get_forms( 'any' ); |
|
21 | 21 | ?> |
22 | 22 | <label for="gravityview_form_id" ><?php esc_html_e( 'Where would you like the data to come from for this View?', 'gravityview' ); ?></label> |
23 | 23 | |
@@ -28,24 +28,24 @@ discard block |
||
28 | 28 | ?> |
29 | 29 | <a class="button button-primary" href="#gv_start_fresh" title="<?php esc_attr_e( 'Use a Form Preset', 'gravityview' ); ?>"><?php esc_html_e( 'Use a Form Preset', 'gravityview' ); ?></a> |
30 | 30 | |
31 | - <?php if( !empty( $forms ) ) { ?> |
|
31 | + <?php if ( ! empty( $forms ) ) { ?> |
|
32 | 32 | <span> <?php esc_html_e( 'or use an existing form', 'gravityview' ); ?> </span> |
33 | 33 | <?php } |
34 | 34 | } |
35 | 35 | |
36 | 36 | // If there are no forms to select, show no forms. |
37 | - if( !empty( $forms ) ) { ?> |
|
37 | + if ( ! empty( $forms ) ) { ?> |
|
38 | 38 | <select name="gravityview_form_id" id="gravityview_form_id"> |
39 | 39 | <option value="" <?php selected( '', $current_form, true ); ?>>— <?php esc_html_e( 'list of forms', 'gravityview' ); ?> —</option> |
40 | - <?php foreach( $forms as $form ) { ?> |
|
41 | - <option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
40 | + <?php foreach ( $forms as $form ) { ?> |
|
41 | + <option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
42 | 42 | <?php } ?> |
43 | 43 | </select> |
44 | 44 | <?php } else { ?> |
45 | 45 | <select name="gravityview_form_id" id="gravityview_form_id" class="hidden"><option selected="selected" value=""></option></select> |
46 | 46 | <?php } ?> |
47 | 47 | |
48 | - <a class="button button-primary" <?php if( empty( $current_form ) ) { echo 'style="display:none;"'; } ?> id="gv_switch_view_button" href="#gv_switch_view" title="<?php esc_attr_e( 'Switch View', 'gravityview' ); ?>"><?php esc_html_e( 'Switch View Type', 'gravityview' ); ?></a> |
|
48 | + <a class="button button-primary" <?php if ( empty( $current_form ) ) { echo 'style="display:none;"'; } ?> id="gv_switch_view_button" href="#gv_switch_view" title="<?php esc_attr_e( 'Switch View', 'gravityview' ); ?>"><?php esc_html_e( 'Switch View Type', 'gravityview' ); ?></a> |
|
49 | 49 | </p> |
50 | 50 | |
51 | 51 | <?php // confirm dialog box ?> |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @return array Blacklist, with "total" added. If not edit context, original field blacklist. Otherwise, blacklist including total. |
52 | 52 | */ |
53 | - public function add_to_blacklist( $blacklist = array(), $context = NULL ){ |
|
53 | + public function add_to_blacklist( $blacklist = array(), $context = NULL ) { |
|
54 | 54 | |
55 | - if( empty( $context ) || $context !== 'edit' ) { |
|
55 | + if ( empty( $context ) || $context !== 'edit' ) { |
|
56 | 56 | return $blacklist; |
57 | 57 | } |
58 | 58 | |
59 | - $blacklist[] = 'total'; |
|
59 | + $blacklist[ ] = 'total'; |
|
60 | 60 | |
61 | 61 | return $blacklist; |
62 | 62 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | function edit_entry_recalculate_totals( $form = array(), $entry_id = 0, $Edit_Entry_Render = null ) { |
76 | 76 | |
77 | - $original_form = GFAPI::get_form( $form['id'] ); |
|
77 | + $original_form = GFAPI::get_form( $form[ 'id' ] ); |
|
78 | 78 | |
79 | 79 | $total_fields = GFCommon::get_fields_by_type( $original_form, 'total' ); |
80 | 80 | |
@@ -85,12 +85,12 @@ discard block |
||
85 | 85 | |
86 | 86 | /** @var GF_Field_Total $total_field */ |
87 | 87 | foreach ( $total_fields as $total_field ) { |
88 | - $entry["{$total_field->id}"] = GFCommon::get_order_total( $original_form, $entry ); |
|
88 | + $entry[ "{$total_field->id}" ] = GFCommon::get_order_total( $original_form, $entry ); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | $return_entry = GFAPI::update_entry( $entry ); |
92 | 92 | |
93 | - if( is_wp_error( $return_entry ) ) { |
|
93 | + if ( is_wp_error( $return_entry ) ) { |
|
94 | 94 | do_action( 'gravityview_log_error', __METHOD__ . ': Updating the entry total fields failed', $return_entry ); |
95 | 95 | } else { |
96 | 96 | do_action( 'gravityview_log_debug', __METHOD__ . ': Updating the entry total fields succeeded' ); |
@@ -50,7 +50,7 @@ |
||
50 | 50 | * |
51 | 51 | * @return array Blacklist, with "total" added. If not edit context, original field blacklist. Otherwise, blacklist including total. |
52 | 52 | */ |
53 | - public function add_to_blacklist( $blacklist = array(), $context = NULL ){ |
|
53 | + public function add_to_blacklist( $blacklist = array(), $context = NULL ) { |
|
54 | 54 | |
55 | 55 | if( empty( $context ) || $context !== 'edit' ) { |
56 | 56 | return $blacklist; |
@@ -313,6 +313,7 @@ |
||
313 | 313 | * Add a callback for lazy loading/counting. |
314 | 314 | * |
315 | 315 | * @param callable $callback The callback to call when needed. |
316 | + * @param string $type |
|
316 | 317 | * |
317 | 318 | * @return void |
318 | 319 | */ |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | |
104 | 104 | /** Call all lazy callbacks. */ |
105 | 105 | foreach ( $this->callbacks as $callback ) { |
106 | - if ( $callback[0] != 'count' ) { |
|
106 | + if ( $callback[ 0 ] != 'count' ) { |
|
107 | 107 | continue; |
108 | 108 | } |
109 | 109 | |
110 | - $total += $callback[1]( $this->filters ); |
|
110 | + $total += $callback[ 1 ]( $this->filters ); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return $total - $this->offset; |
@@ -161,11 +161,11 @@ discard block |
||
161 | 161 | |
162 | 162 | /** Call all lazy callbacks. */ |
163 | 163 | foreach ( $this->callbacks as $i => $callback ) { |
164 | - if ( $callback[0] != 'fetch' ) { |
|
164 | + if ( $callback[ 0 ] != 'fetch' ) { |
|
165 | 165 | continue; |
166 | 166 | } |
167 | 167 | |
168 | - $this->merge( $callback[1]( $this->filters, $this->sorts, $offset ) ); |
|
168 | + $this->merge( $callback[ 1 ]( $this->filters, $this->sorts, $offset ) ); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | $this->fetched = $this->count(); |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | return; |
322 | 322 | } |
323 | 323 | |
324 | - $this->callbacks []= array( $type, $callback ); |
|
324 | + $this->callbacks [ ] = array( $type, $callback ); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | /** |
@@ -38,7 +38,6 @@ |
||
38 | 38 | * Set an setting. |
39 | 39 | * |
40 | 40 | * @param mixed $key The key in this setting to retrieve. |
41 | - * @param mixed $default A default in case the key is not set. |
|
42 | 41 | * |
43 | 42 | * @api |
44 | 43 | * @since future |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @return void |
32 | 32 | */ |
33 | 33 | public function __set( $key, $value ) { |
34 | - $this->_context[$key] = $value; |
|
34 | + $this->_context[ $key ] = $value; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @return mixed|null |
46 | 46 | */ |
47 | 47 | public function __get( $key ) { |
48 | - return isset( $this->_context[$key] ) ? $this->_context[$key] : null; |
|
48 | + return isset( $this->_context[ $key ] ) ? $this->_context[ $key ] : null; |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 |
@@ -298,7 +298,7 @@ |
||
298 | 298 | /** |
299 | 299 | * Determines if a view exists to begin with. |
300 | 300 | * |
301 | - * @param int|\WP_Post|null $view_id The WordPress post ID, a \WP_Post object or null for global $post; |
|
301 | + * @param int|\WP_Post|null $view The WordPress post ID, a \WP_Post object or null for global $post; |
|
302 | 302 | * |
303 | 303 | * @api |
304 | 304 | * @since future |
@@ -202,12 +202,12 @@ |
||
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
205 | - * @filter `gravityview/configuration/fields` Filter the View fields' configuration array |
|
206 | - * @since 1.6.5 |
|
207 | - * |
|
208 | - * @param $fields array Multi-array of fields with first level being the field zones |
|
209 | - * @param $view_id int The View the fields are being pulled for |
|
210 | - */ |
|
205 | + * @filter `gravityview/configuration/fields` Filter the View fields' configuration array |
|
206 | + * @since 1.6.5 |
|
207 | + * |
|
208 | + * @param $fields array Multi-array of fields with first level being the field zones |
|
209 | + * @param $view_id int The View the fields are being pulled for |
|
210 | + */ |
|
211 | 211 | $configuration = apply_filters( 'gravityview/configuration/fields', (array)$view->_gravityview_directory_fields, $view->ID ); |
212 | 212 | |
213 | 213 | /** Get all fields. */ |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $supports = array( 'title', 'revisions' ); |
87 | 87 | |
88 | 88 | if ( $is_hierarchical ) { |
89 | - $supports[] = 'page-attributes'; |
|
89 | + $supports[ ] = 'page-attributes'; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | if ( ! $view->form ) { |
198 | 198 | gravityview()->log->error( 'View #{view_id} tried attaching non-existent Form #{form_id} to it.', array( |
199 | 199 | 'view_id' => $view->ID, |
200 | - 'form_id' => $view->_gravityview_form_id ? : 0, |
|
200 | + 'form_id' => $view->_gravityview_form_id ?: 0, |
|
201 | 201 | ) ); |
202 | 202 | } |
203 | 203 | |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | |
336 | 336 | gravityview()->log->notice( 'This is a \GV\View object should not be accessed as an array.' ); |
337 | 337 | |
338 | - if ( ! isset( $this[$offset] ) ) { |
|
338 | + if ( ! isset( $this[ $offset ] ) ) { |
|
339 | 339 | return null; |
340 | 340 | } |
341 | 341 | |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | return $this->template ? $this->template->ID : null; |
354 | 354 | default: |
355 | 355 | /** @todo move the rest out and get rid of _data completely! */ |
356 | - return $this->_data[$offset]; |
|
356 | + return $this->_data[ $offset ]; |
|
357 | 357 | } |
358 | 358 | } |
359 | 359 | |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | array( 'form' => $this->form ? gravityview_get_form( $this->form->ID ) : null ), |
403 | 403 | array( 'atts' => $this->settings->as_atts() ), |
404 | 404 | array( 'fields' => $this->fields->by_visible()->as_configuration() ), |
405 | - array( 'template_id' => $this->template? $this->template->ID : null ), |
|
405 | + array( 'template_id' => $this->template ? $this->template->ID : null ), |
|
406 | 406 | $this->_data |
407 | 407 | ); |
408 | 408 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | /** |
155 | 155 | * Sets the single entry ID and also the entry |
156 | - * @param bool|int|string $single_entry |
|
156 | + * @param boolean|string $single_entry |
|
157 | 157 | */ |
158 | 158 | public function setSingleEntry( $single_entry ) { |
159 | 159 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | /** |
172 | 172 | * Set the current entry |
173 | - * @param array|int $entry Entry array or entry slug or ID |
|
173 | + * @param boolean|string $entry Entry array or entry slug or ID |
|
174 | 174 | */ |
175 | 175 | public function setEntry( $entry ) { |
176 | 176 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * |
229 | 229 | * |
230 | 230 | * |
231 | - * @param null $view_id |
|
231 | + * @param string $view_id |
|
232 | 232 | */ |
233 | 233 | public function set_context_view_id( $view_id = null ) { |
234 | 234 | $multiple_views = defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ? gravityview()->views->count() > 1 : ( $this->getGvOutputData() && $this->getGvOutputData()->has_multiple_views() ); |
@@ -1213,7 +1213,7 @@ discard block |
||
1213 | 1213 | * |
1214 | 1214 | * @uses gravityview_get_entries() |
1215 | 1215 | * @access public |
1216 | - * @param array $args\n |
|
1216 | + * @param array $args |
|
1217 | 1217 | * - $id - View id |
1218 | 1218 | * - $page_size - Page |
1219 | 1219 | * - $sort_field - form field id to sort |
@@ -1370,7 +1370,6 @@ discard block |
||
1370 | 1370 | * @since 1.19.5 |
1371 | 1371 | * |
1372 | 1372 | * @param $args |
1373 | - * @param int $form_id |
|
1374 | 1373 | */ |
1375 | 1374 | public static function get_search_criteria_paging( $args ) { |
1376 | 1375 | |
@@ -1785,7 +1784,7 @@ discard block |
||
1785 | 1784 | /** |
1786 | 1785 | * Checks if field (column) is sortable |
1787 | 1786 | * |
1788 | - * @param string $field Field settings |
|
1787 | + * @param string $field_id Field settings |
|
1789 | 1788 | * @param array $form Gravity Forms form array |
1790 | 1789 | * |
1791 | 1790 | * @since 1.7 |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | } |
459 | 459 | |
460 | 460 | // User reported WooCommerce doesn't pass two args. |
461 | - if ( empty( $passed_post_id ) ) { |
|
461 | + if ( empty( $passed_post_id ) ) { |
|
462 | 462 | return $title; |
463 | 463 | } |
464 | 464 | |
@@ -494,8 +494,9 @@ discard block |
||
494 | 494 | } |
495 | 495 | |
496 | 496 | /** No matching form sources were found, happens when requesting an entry from a different form . */ |
497 | - if ( ! isset( $view ) ) |
|
498 | - return $title; |
|
497 | + if ( ! isset( $view ) ) { |
|
498 | + return $title; |
|
499 | + } |
|
499 | 500 | } else { |
500 | 501 | /** Deprecated. Use gravityview()->views->all() or gravityview()->request->all() */ |
501 | 502 | foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { |
@@ -1478,7 +1479,7 @@ discard block |
||
1478 | 1479 | */ |
1479 | 1480 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
1480 | 1481 | |
1481 | - switch( strtolower( $address_part ) ){ |
|
1482 | + switch( strtolower( $address_part ) ) { |
|
1482 | 1483 | case 'street': |
1483 | 1484 | $sort_field_id .= '.1'; |
1484 | 1485 | break; |
@@ -1563,7 +1564,7 @@ discard block |
||
1563 | 1564 | */ |
1564 | 1565 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
1565 | 1566 | |
1566 | - if ( empty( $single_entry ) ){ |
|
1567 | + if ( empty( $single_entry ) ) { |
|
1567 | 1568 | return false; |
1568 | 1569 | } else { |
1569 | 1570 | return $single_entry; |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | private function __construct() {} |
86 | 86 | |
87 | 87 | private function initialize() { |
88 | - add_action( 'wp', array( $this, 'parse_content'), 11 ); |
|
88 | + add_action( 'wp', array( $this, 'parse_content' ), 11 ); |
|
89 | 89 | add_filter( 'parse_query', array( $this, 'parse_query_fix_frontpage' ), 10 ); |
90 | - add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 ); |
|
90 | + add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 ); |
|
91 | 91 | |
92 | 92 | // Enqueue scripts and styles after GravityView_Template::register_styles() |
93 | 93 | add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 ); |
@@ -237,12 +237,12 @@ discard block |
||
237 | 237 | |
238 | 238 | $this->context_view_id = $view_id; |
239 | 239 | |
240 | - } elseif ( isset( $_GET['gvid'] ) && $multiple_views ) { |
|
240 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $multiple_views ) { |
|
241 | 241 | /** |
242 | 242 | * used on a has_multiple_views context |
243 | 243 | * @see GravityView_API::entry_link |
244 | 244 | */ |
245 | - $this->context_view_id = $_GET['gvid']; |
|
245 | + $this->context_view_id = $_GET[ 'gvid' ]; |
|
246 | 246 | |
247 | 247 | } elseif ( ! $multiple_views ) { |
248 | 248 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
@@ -285,25 +285,25 @@ discard block |
||
285 | 285 | global $wp_rewrite; |
286 | 286 | |
287 | 287 | $is_front_page = ( $query->is_home || $query->is_page ); |
288 | - $show_on_front = ( 'page' === get_option('show_on_front') ); |
|
289 | - $front_page_id = get_option('page_on_front'); |
|
288 | + $show_on_front = ( 'page' === get_option( 'show_on_front' ) ); |
|
289 | + $front_page_id = get_option( 'page_on_front' ); |
|
290 | 290 | |
291 | - if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
291 | + if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
292 | 292 | |
293 | 293 | // Force to be an array, potentially a query string ( entry=16 ) |
294 | 294 | $_query = wp_parse_args( $query->query ); |
295 | 295 | |
296 | 296 | // pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename. |
297 | - if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) { |
|
298 | - unset( $_query['pagename'] ); |
|
297 | + if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) { |
|
298 | + unset( $_query[ 'pagename' ] ); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | // this is where will break from core wordpress |
302 | 302 | /** @internal Don't use this filter; it will be unnecessary soon - it's just a patch for specific use case */ |
303 | 303 | $ignore = apply_filters( 'gravityview/internal/ignored_endpoints', array( 'preview', 'page', 'paged', 'cpage' ), $query ); |
304 | 304 | $endpoints = rgobj( $wp_rewrite, 'endpoints' ); |
305 | - foreach ( (array) $endpoints as $endpoint ) { |
|
306 | - $ignore[] = $endpoint[1]; |
|
305 | + foreach ( (array)$endpoints as $endpoint ) { |
|
306 | + $ignore[ ] = $endpoint[ 1 ]; |
|
307 | 307 | } |
308 | 308 | unset( $endpoints ); |
309 | 309 | |
@@ -313,21 +313,21 @@ discard block |
||
313 | 313 | // - The query includes keys that are associated with registered endpoints. `entry`, for example. |
314 | 314 | if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) { |
315 | 315 | |
316 | - $qv =& $query->query_vars; |
|
316 | + $qv = & $query->query_vars; |
|
317 | 317 | |
318 | 318 | // Prevent redirect when on the single entry endpoint |
319 | - if( self::is_single_entry() ) { |
|
319 | + if ( self::is_single_entry() ) { |
|
320 | 320 | add_filter( 'redirect_canonical', '__return_false' ); |
321 | 321 | } |
322 | 322 | |
323 | 323 | $query->is_page = true; |
324 | 324 | $query->is_home = false; |
325 | - $qv['page_id'] = $front_page_id; |
|
325 | + $qv[ 'page_id' ] = $front_page_id; |
|
326 | 326 | |
327 | 327 | // Correct <!--nextpage--> for page_on_front |
328 | - if ( ! empty( $qv['paged'] ) ) { |
|
329 | - $qv['page'] = $qv['paged']; |
|
330 | - unset( $qv['paged'] ); |
|
328 | + if ( ! empty( $qv[ 'paged' ] ) ) { |
|
329 | + $qv[ 'page' ] = $qv[ 'paged' ]; |
|
330 | + unset( $qv[ 'paged' ] ); |
|
331 | 331 | } |
332 | 332 | } |
333 | 333 | |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | |
361 | 361 | $this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); |
362 | 362 | |
363 | - $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); |
|
363 | + $post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null ); |
|
364 | 364 | $this->setPostId( $post_id ); |
365 | 365 | $post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; |
366 | 366 | $this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | |
397 | 397 | $search_method = GravityView_Widget_Search::getInstance()->get_search_method(); |
398 | 398 | |
399 | - if( 'post' === $search_method ) { |
|
399 | + if ( 'post' === $search_method ) { |
|
400 | 400 | $get = $_POST; |
401 | 401 | } else { |
402 | 402 | $get = $_GET; |
@@ -452,20 +452,20 @@ discard block |
||
452 | 452 | * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop |
453 | 453 | * @param array $entry Current entry |
454 | 454 | */ |
455 | - $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry ); |
|
455 | + $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry ); |
|
456 | 456 | |
457 | 457 | if ( ! $apply_outside_loop ) { |
458 | 458 | return $title; |
459 | 459 | } |
460 | 460 | |
461 | 461 | // User reported WooCommerce doesn't pass two args. |
462 | - if ( empty( $passed_post_id ) ) { |
|
462 | + if ( empty( $passed_post_id ) ) { |
|
463 | 463 | return $title; |
464 | 464 | } |
465 | 465 | |
466 | 466 | // Don't modify the title for anything other than the current view/post. |
467 | 467 | // This is true for embedded shortcodes and Views. |
468 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
468 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
469 | 469 | return $title; |
470 | 470 | } |
471 | 471 | |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | } else { |
489 | 489 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
490 | 490 | foreach ( gravityview()->views->all() as $_view ) { |
491 | - if ( intval( $_view->form->ID ) === intval( $entry['form_id'] ) ) { |
|
491 | + if ( intval( $_view->form->ID ) === intval( $entry[ 'form_id' ] ) ) { |
|
492 | 492 | $view = $_view; |
493 | 493 | break; |
494 | 494 | } |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | } else { |
501 | 501 | /** Deprecated. Use gravityview()->views->all() or gravityview()->request->all() */ |
502 | 502 | foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { |
503 | - if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) { |
|
503 | + if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) { |
|
504 | 504 | $view_meta = $view_data; |
505 | 505 | break; |
506 | 506 | } |
@@ -515,12 +515,12 @@ discard block |
||
515 | 515 | } |
516 | 516 | } else { |
517 | 517 | /** Deprecated stuff in the future. See the branch above. */ |
518 | - if ( ! empty( $view_meta['atts']['single_title'] ) ) { |
|
518 | + if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) { |
|
519 | 519 | |
520 | - $title = $view_meta['atts']['single_title']; |
|
520 | + $title = $view_meta[ 'atts' ][ 'single_title' ]; |
|
521 | 521 | |
522 | 522 | // We are allowing HTML in the fields, so no escaping the output |
523 | - $title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry ); |
|
523 | + $title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry ); |
|
524 | 524 | |
525 | 525 | $title = do_shortcode( $title ); |
526 | 526 | } |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | } |
559 | 559 | |
560 | 560 | // Only render in the loop. Fixes issues with the_content filter being applied in places like the sidebar |
561 | - if( ! in_the_loop() ) { |
|
561 | + if ( ! in_the_loop() ) { |
|
562 | 562 | return $content; |
563 | 563 | } |
564 | 564 | |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | |
634 | 634 | $context = GravityView_View::getInstance()->getContext(); |
635 | 635 | |
636 | - switch( $context ) { |
|
636 | + switch ( $context ) { |
|
637 | 637 | case 'directory': |
638 | 638 | $tab = __( 'Multiple Entries', 'gravityview' ); |
639 | 639 | break; |
@@ -647,12 +647,12 @@ discard block |
||
647 | 647 | } |
648 | 648 | |
649 | 649 | |
650 | - $title = sprintf( esc_html_x('The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab ); |
|
650 | + $title = sprintf( esc_html_x( 'The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab ); |
|
651 | 651 | $edit_link = admin_url( sprintf( 'post.php?post=%d&action=edit#%s-view', $view_id, $context ) ); |
652 | - $action_text = sprintf( esc_html__('Add fields to %s', 'gravityview' ), $tab ); |
|
652 | + $action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab ); |
|
653 | 653 | $message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' ); |
654 | 654 | |
655 | - $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url(plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) ); |
|
655 | + $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) ); |
|
656 | 656 | $output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message ); |
657 | 657 | |
658 | 658 | echo GVCommon::generate_notice( $output . $image, 'gv-error error', 'edit_gravityview', $view_id ); |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | public function render_view( $passed_args ) { |
684 | 684 | |
685 | 685 | // validate attributes |
686 | - if ( empty( $passed_args['id'] ) ) { |
|
686 | + if ( empty( $passed_args[ 'id' ] ) ) { |
|
687 | 687 | do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args ); |
688 | 688 | return null; |
689 | 689 | } |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | return null; |
706 | 706 | } |
707 | 707 | |
708 | - $view_id = $passed_args['id']; |
|
708 | + $view_id = $passed_args[ 'id' ]; |
|
709 | 709 | |
710 | 710 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
711 | 711 | $view = gravityview()->views->get( $view_id ); |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | $passed_args = array_filter( $passed_args, 'strlen' ); |
736 | 736 | |
737 | 737 | //Override shortcode args over View template settings |
738 | - $atts = wp_parse_args( $passed_args, $view_data['atts'] ); |
|
738 | + $atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] ); |
|
739 | 739 | |
740 | 740 | do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts ); |
741 | 741 | } |
@@ -759,14 +759,14 @@ discard block |
||
759 | 759 | * @since 1.15 |
760 | 760 | * @since 1.17.2 Added check for if a user has no caps but is logged in (member of multisite, but not any site). Treat as if logged-out. |
761 | 761 | */ |
762 | - if( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
762 | + if ( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
763 | 763 | |
764 | 764 | do_action( 'gravityview_log_debug', sprintf( '%s Returning: View %d is not visible by current user.', __METHOD__, $view_id ) ); |
765 | 765 | |
766 | 766 | return null; |
767 | 767 | } |
768 | 768 | |
769 | - if( $this->isGravityviewPostType() ) { |
|
769 | + if ( $this->isGravityviewPostType() ) { |
|
770 | 770 | |
771 | 771 | /** |
772 | 772 | * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode? |
@@ -782,10 +782,10 @@ discard block |
||
782 | 782 | $embed_only = $view->settings->get( 'embed_only' ); |
783 | 783 | } else { |
784 | 784 | /** Deprecated. View attributes moved to \GV\View::$settings. */ |
785 | - $embed_only = ! empty( $atts['embed_only'] ); |
|
785 | + $embed_only = ! empty( $atts[ 'embed_only' ] ); |
|
786 | 786 | } |
787 | 787 | |
788 | - if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
788 | + if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
789 | 789 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
790 | 790 | } |
791 | 791 | } |
@@ -801,13 +801,13 @@ discard block |
||
801 | 801 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
802 | 802 | $view_data = $view->as_data(); |
803 | 803 | $gravityview_view = new GravityView_View( $view_data ); |
804 | - $post_id = intval( $view->settings->get( 'post_id' ) ? : get_the_ID() ); |
|
804 | + $post_id = intval( $view->settings->get( 'post_id' ) ?: get_the_ID() ); |
|
805 | 805 | $template_id = $view->template ? $view->template->ID : null; |
806 | 806 | } else { |
807 | 807 | /** These constructs are deprecated. Use the new gravityview() wrapper. */ |
808 | 808 | $gravityview_view = new GravityView_View( $view_data ); |
809 | - $post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : get_the_ID(); |
|
810 | - $template_id = $view_data['template_id']; |
|
809 | + $post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : get_the_ID(); |
|
810 | + $template_id = $view_data[ 'template_id' ]; |
|
811 | 811 | } |
812 | 812 | |
813 | 813 | $gravityview_view->setPostId( $post_id ); |
@@ -818,20 +818,20 @@ discard block |
||
818 | 818 | do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' ); |
819 | 819 | |
820 | 820 | //fetch template and slug |
821 | - $view_slug = apply_filters( 'gravityview_template_slug_'. $template_id, 'table', 'directory' ); |
|
821 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $template_id, 'table', 'directory' ); |
|
822 | 822 | |
823 | 823 | do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug ); |
824 | 824 | |
825 | 825 | /** |
826 | 826 | * Disable fetching initial entries for views that don't need it (DataTables) |
827 | 827 | */ |
828 | - $get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true ); |
|
828 | + $get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true ); |
|
829 | 829 | |
830 | 830 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
831 | 831 | $hide_until_searched = $view->settings->get( 'hide_until_searched' ); |
832 | 832 | } else { |
833 | 833 | /** $atts is deprecated, use \GV\View:$settings */ |
834 | - $hide_until_searched = ! empty( $atts['hide_until_searched'] ); |
|
834 | + $hide_until_searched = ! empty( $atts[ 'hide_until_searched' ] ); |
|
835 | 835 | } |
836 | 836 | |
837 | 837 | /** |
@@ -849,12 +849,12 @@ discard block |
||
849 | 849 | $sort_columns = $view->settings->get( 'sort_columns' ); |
850 | 850 | } else { |
851 | 851 | /** $atts is deprecated, use \GV\View:$settings */ |
852 | - $sort_columns = ! empty( $atts['sort_columns'] ); |
|
852 | + $sort_columns = ! empty( $atts[ 'sort_columns' ] ); |
|
853 | 853 | } |
854 | 854 | |
855 | 855 | if ( $sort_columns ) { |
856 | 856 | // add filter to enable column sorting |
857 | - add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 ); |
|
857 | + add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 ); |
|
858 | 858 | } |
859 | 859 | |
860 | 860 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
@@ -862,19 +862,19 @@ discard block |
||
862 | 862 | } else { |
863 | 863 | /** $atts is deprecated, use \GV\View:$settings */ |
864 | 864 | /** $view_data is depreacted, use \GV\View properties */ |
865 | - $view_entries = self::get_view_entries( $atts, $view_data['form_id'] ); |
|
865 | + $view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] ); |
|
866 | 866 | } |
867 | 867 | |
868 | - do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) ); |
|
868 | + do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) ); |
|
869 | 869 | |
870 | 870 | } else { |
871 | 871 | |
872 | 872 | $view_entries = array( 'count' => null, 'entries' => null, 'paging' => null ); |
873 | 873 | |
874 | - do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' ); |
|
874 | + do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' ); |
|
875 | 875 | } |
876 | 876 | |
877 | - $gravityview_view->setPaging( $view_entries['paging'] ); |
|
877 | + $gravityview_view->setPaging( $view_entries[ 'paging' ] ); |
|
878 | 878 | $gravityview_view->setContext( 'directory' ); |
879 | 879 | $sections = array( 'header', 'body', 'footer' ); |
880 | 880 | |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | do_action( 'gravityview_render_entry_' . $view->ID ); |
892 | 892 | } else { |
893 | 893 | /** $view_data is depreacted, use \GV\View properties */ |
894 | - do_action( 'gravityview_render_entry_'.$view_data['id'] ); |
|
894 | + do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] ); |
|
895 | 895 | } |
896 | 896 | |
897 | 897 | $entry = $this->getEntry(); |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | do_action( 'gravityview_log_debug', '[render_view] Entry does not exist. This may be because of View filters limiting access.' ); |
903 | 903 | |
904 | 904 | // Only display warning once when multiple Views are embedded |
905 | - if( $view_id !== (int) GravityView_frontend::get_context_view_id() ) { |
|
905 | + if ( $view_id !== (int)GravityView_frontend::get_context_view_id() ) { |
|
906 | 906 | ob_end_clean(); |
907 | 907 | return null; |
908 | 908 | } |
@@ -927,7 +927,7 @@ discard block |
||
927 | 927 | // important: do not remove this as it prevents fake attempts of displaying entries from other views/forms |
928 | 928 | $multiple_views = defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ? gravityview()->views->count() > 1 : $this->getGvOutputData()->has_multiple_views(); |
929 | 929 | if ( $multiple_views && $view_id != $this->get_context_view_id() ) { |
930 | - do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: '. $view_id ); |
|
930 | + do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: ' . $view_id ); |
|
931 | 931 | ob_end_clean(); |
932 | 932 | return null; |
933 | 933 | } |
@@ -937,14 +937,14 @@ discard block |
||
937 | 937 | do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug ); |
938 | 938 | |
939 | 939 | //fetch entry detail |
940 | - $view_entries['count'] = 1; |
|
941 | - $view_entries['entries'][] = $entry; |
|
942 | - do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] ); |
|
940 | + $view_entries[ 'count' ] = 1; |
|
941 | + $view_entries[ 'entries' ][ ] = $entry; |
|
942 | + do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] ); |
|
943 | 943 | |
944 | 944 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
945 | 945 | $back_link_label = $view->settings->get( 'back_link_label', null ); |
946 | 946 | } else { |
947 | - $back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null; |
|
947 | + $back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null; |
|
948 | 948 | } |
949 | 949 | |
950 | 950 | // set back link label |
@@ -958,8 +958,8 @@ discard block |
||
958 | 958 | self::add_style( $template_id ); |
959 | 959 | |
960 | 960 | // Prepare to render view and set vars |
961 | - $gravityview_view->setEntries( $view_entries['entries'] ); |
|
962 | - $gravityview_view->setTotalEntries( $view_entries['count'] ); |
|
961 | + $gravityview_view->setEntries( $view_entries[ 'entries' ] ); |
|
962 | + $gravityview_view->setTotalEntries( $view_entries[ 'count' ] ); |
|
963 | 963 | |
964 | 964 | // If Edit |
965 | 965 | if ( 'edit' === gravityview_get_context() ) { |
@@ -976,7 +976,7 @@ discard block |
||
976 | 976 | |
977 | 977 | do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections ); |
978 | 978 | foreach ( $sections as $section ) { |
979 | - do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' ); |
|
979 | + do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' ); |
|
980 | 980 | $gravityview_view->render( $view_slug, $section, false ); |
981 | 981 | } |
982 | 982 | } |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | $datetime_format = 'Y-m-d H:i:s'; |
1031 | 1031 | $search_is_outside_view_bounds = false; |
1032 | 1032 | |
1033 | - if( ! empty( $search_criteria[ $key ] ) ) { |
|
1033 | + if ( ! empty( $search_criteria[ $key ] ) ) { |
|
1034 | 1034 | |
1035 | 1035 | $search_date = strtotime( $search_criteria[ $key ] ); |
1036 | 1036 | |
@@ -1058,14 +1058,14 @@ discard block |
||
1058 | 1058 | if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
1059 | 1059 | |
1060 | 1060 | // Then we override the search and re-set the start date |
1061 | - $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
1061 | + $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); |
|
1062 | 1062 | } |
1063 | 1063 | } |
1064 | 1064 | } |
1065 | 1065 | |
1066 | - if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
1066 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
1067 | 1067 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
1068 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
1068 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
1069 | 1069 | do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria ); |
1070 | 1070 | } |
1071 | 1071 | } |
@@ -1084,19 +1084,19 @@ discard block |
||
1084 | 1084 | public static function process_search_only_approved( $args, $search_criteria ) { |
1085 | 1085 | |
1086 | 1086 | /** @since 1.19 */ |
1087 | - if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
1087 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
1088 | 1088 | do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries; showing all approval statuses' ); |
1089 | 1089 | return $search_criteria; |
1090 | 1090 | } |
1091 | 1091 | |
1092 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
1092 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
1093 | 1093 | |
1094 | - $search_criteria['field_filters'][] = array( |
|
1094 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
1095 | 1095 | 'key' => GravityView_Entry_Approval::meta_key, |
1096 | 1096 | 'value' => GravityView_Entry_Approval_Status::APPROVED |
1097 | 1097 | ); |
1098 | 1098 | |
1099 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
1099 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
1100 | 1100 | |
1101 | 1101 | do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria ); |
1102 | 1102 | } |
@@ -1123,18 +1123,18 @@ discard block |
||
1123 | 1123 | */ |
1124 | 1124 | public static function is_entry_approved( $entry, $args = array() ) { |
1125 | 1125 | |
1126 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
1126 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
1127 | 1127 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
1128 | 1128 | return true; |
1129 | 1129 | } |
1130 | 1130 | |
1131 | 1131 | /** @since 1.19 */ |
1132 | - if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
1132 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
1133 | 1133 | do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries, so entry is approved for viewing' ); |
1134 | 1134 | return true; |
1135 | 1135 | } |
1136 | 1136 | |
1137 | - $is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key ); |
|
1137 | + $is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key ); |
|
1138 | 1138 | |
1139 | 1139 | return GravityView_Entry_Approval_Status::is_approved( $is_approved ); |
1140 | 1140 | } |
@@ -1168,29 +1168,29 @@ discard block |
||
1168 | 1168 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria ); |
1169 | 1169 | |
1170 | 1170 | // implicity search |
1171 | - if ( ! empty( $args['search_value'] ) ) { |
|
1171 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
1172 | 1172 | |
1173 | 1173 | // Search operator options. Options: `is` or `contains` |
1174 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
1174 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
1175 | 1175 | |
1176 | - $search_criteria['field_filters'][] = array( |
|
1176 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
1177 | 1177 | 'key' => rgget( 'search_field', $args ), // The field ID to search |
1178 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
1178 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
1179 | 1179 | 'operator' => $operator, |
1180 | 1180 | ); |
1181 | 1181 | |
1182 | 1182 | // Lock search mode to "all" with implicit presearch filter. |
1183 | - $search_criteria['field_filters']['mode'] = 'all'; |
|
1183 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; |
|
1184 | 1184 | } |
1185 | 1185 | |
1186 | - if( $search_criteria !== $original_search_criteria ) { |
|
1186 | + if ( $search_criteria !== $original_search_criteria ) { |
|
1187 | 1187 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria ); |
1188 | 1188 | } |
1189 | 1189 | |
1190 | 1190 | // Handle setting date range |
1191 | 1191 | $search_criteria = self::process_search_dates( $args, $search_criteria ); |
1192 | 1192 | |
1193 | - if( $search_criteria !== $original_search_criteria ) { |
|
1193 | + if ( $search_criteria !== $original_search_criteria ) { |
|
1194 | 1194 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria ); |
1195 | 1195 | } |
1196 | 1196 | |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
1202 | 1202 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
1203 | 1203 | */ |
1204 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
1204 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
1205 | 1205 | |
1206 | 1206 | return $search_criteria; |
1207 | 1207 | } |
@@ -1325,7 +1325,7 @@ discard block |
||
1325 | 1325 | 'search_criteria' => $search_criteria, |
1326 | 1326 | 'sorting' => self::updateViewSorting( $args, $form_id ), |
1327 | 1327 | 'paging' => $paging, |
1328 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
1328 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
1329 | 1329 | ); |
1330 | 1330 | |
1331 | 1331 | /** |
@@ -1350,7 +1350,7 @@ discard block |
||
1350 | 1350 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
1351 | 1351 | * @param array $args View configuration args. |
1352 | 1352 | */ |
1353 | - $parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id ); |
|
1353 | + $parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id ); |
|
1354 | 1354 | |
1355 | 1355 | do_action( 'gravityview_log_debug', __METHOD__ . ': $parameters passed to gravityview_get_entries(): ', $parameters ); |
1356 | 1356 | |
@@ -1375,17 +1375,17 @@ discard block |
||
1375 | 1375 | $default_page_size = apply_filters( 'gravityview_default_page_size', 25 ); |
1376 | 1376 | |
1377 | 1377 | // Paging & offset |
1378 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size; |
|
1378 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : $default_page_size; |
|
1379 | 1379 | |
1380 | 1380 | if ( -1 === $page_size ) { |
1381 | 1381 | $page_size = PHP_INT_MAX; |
1382 | 1382 | } |
1383 | 1383 | |
1384 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
1384 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
1385 | 1385 | $offset = ( $curr_page - 1 ) * $page_size; |
1386 | 1386 | |
1387 | - if ( ! empty( $args['offset'] ) ) { |
|
1388 | - $offset += intval( $args['offset'] ); |
|
1387 | + if ( ! empty( $args[ 'offset' ] ) ) { |
|
1388 | + $offset += intval( $args[ 'offset' ] ); |
|
1389 | 1389 | } |
1390 | 1390 | |
1391 | 1391 | $paging = array( |
@@ -1409,8 +1409,8 @@ discard block |
||
1409 | 1409 | */ |
1410 | 1410 | public static function updateViewSorting( $args, $form_id ) { |
1411 | 1411 | $sorting = array(); |
1412 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' ); |
|
1413 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' ); |
|
1412 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' ); |
|
1413 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' ); |
|
1414 | 1414 | |
1415 | 1415 | $sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id ); |
1416 | 1416 | |
@@ -1450,11 +1450,11 @@ discard block |
||
1450 | 1450 | |
1451 | 1451 | $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
1452 | 1452 | |
1453 | - if( ! $sort_field ) { |
|
1453 | + if ( ! $sort_field ) { |
|
1454 | 1454 | return $sort_field_id; |
1455 | 1455 | } |
1456 | 1456 | |
1457 | - switch ( $sort_field['type'] ) { |
|
1457 | + switch ( $sort_field[ 'type' ] ) { |
|
1458 | 1458 | |
1459 | 1459 | case 'address': |
1460 | 1460 | // Sorting by full address |
@@ -1471,7 +1471,7 @@ discard block |
||
1471 | 1471 | */ |
1472 | 1472 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
1473 | 1473 | |
1474 | - switch( strtolower( $address_part ) ){ |
|
1474 | + switch ( strtolower( $address_part ) ) { |
|
1475 | 1475 | case 'street': |
1476 | 1476 | $sort_field_id .= '.1'; |
1477 | 1477 | break; |
@@ -1556,7 +1556,7 @@ discard block |
||
1556 | 1556 | */ |
1557 | 1557 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
1558 | 1558 | |
1559 | - if ( empty( $single_entry ) ){ |
|
1559 | + if ( empty( $single_entry ) ) { |
|
1560 | 1560 | return false; |
1561 | 1561 | } else { |
1562 | 1562 | return $single_entry; |
@@ -1589,14 +1589,14 @@ discard block |
||
1589 | 1589 | $template_id = $view->template ? $view->template->ID : null; |
1590 | 1590 | $data = $view->as_data(); |
1591 | 1591 | } else { |
1592 | - $template_id = $data['template_id']; |
|
1592 | + $template_id = $data[ 'template_id' ]; |
|
1593 | 1593 | } |
1594 | 1594 | |
1595 | 1595 | /** |
1596 | 1596 | * Don't enqueue the scripts or styles if it's not going to be displayed. |
1597 | 1597 | * @since 1.15 |
1598 | 1598 | */ |
1599 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1599 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1600 | 1600 | continue; |
1601 | 1601 | } |
1602 | 1602 | |
@@ -1608,7 +1608,7 @@ discard block |
||
1608 | 1608 | $lightbox = $view->settings->get( 'lightbox' ); |
1609 | 1609 | } else { |
1610 | 1610 | /** View data attributes are now stored in \GV\View::$settings */ |
1611 | - $lightbox = ! empty( $data['atts']['lightbox'] ); |
|
1611 | + $lightbox = ! empty( $data[ 'atts' ][ 'lightbox' ] ); |
|
1612 | 1612 | } |
1613 | 1613 | |
1614 | 1614 | // If the thickbox is enqueued, add dependencies |
@@ -1618,13 +1618,13 @@ discard block |
||
1618 | 1618 | * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox` |
1619 | 1619 | * @param string $script_slug If you want to use a different lightbox script, return the name of it here. |
1620 | 1620 | */ |
1621 | - $js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
1621 | + $js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
1622 | 1622 | |
1623 | 1623 | /** |
1624 | 1624 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
1625 | 1625 | * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here. |
1626 | 1626 | */ |
1627 | - $css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
1627 | + $css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
1628 | 1628 | } |
1629 | 1629 | |
1630 | 1630 | /** |
@@ -1632,19 +1632,19 @@ discard block |
||
1632 | 1632 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
1633 | 1633 | * @since 1.15 |
1634 | 1634 | */ |
1635 | - if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
1636 | - $css_dependencies[] = 'dashicons'; |
|
1635 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
1636 | + $css_dependencies[ ] = 'dashicons'; |
|
1637 | 1637 | } |
1638 | 1638 | |
1639 | 1639 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
1640 | 1640 | |
1641 | 1641 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
1642 | 1642 | |
1643 | - wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true ); |
|
1643 | + wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ), GravityView_Plugin::version, true ); |
|
1644 | 1644 | |
1645 | 1645 | wp_enqueue_script( 'gravityview-fe-view' ); |
1646 | 1646 | |
1647 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
1647 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
1648 | 1648 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
1649 | 1649 | } |
1650 | 1650 | |
@@ -1712,7 +1712,7 @@ discard block |
||
1712 | 1712 | } elseif ( empty( $template_id ) ) { |
1713 | 1713 | do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' ); |
1714 | 1714 | } else { |
1715 | - do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) ); |
|
1715 | + do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) ); |
|
1716 | 1716 | } |
1717 | 1717 | |
1718 | 1718 | } |
@@ -1737,11 +1737,11 @@ discard block |
||
1737 | 1737 | * Not a table-based template; don't add sort icons |
1738 | 1738 | * @since 1.12 |
1739 | 1739 | */ |
1740 | - if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1740 | + if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1741 | 1741 | return $label; |
1742 | 1742 | } |
1743 | 1743 | |
1744 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
1744 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
1745 | 1745 | return $label; |
1746 | 1746 | } |
1747 | 1747 | |
@@ -1749,29 +1749,29 @@ discard block |
||
1749 | 1749 | |
1750 | 1750 | $class = 'gv-sort'; |
1751 | 1751 | |
1752 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
1752 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
1753 | 1753 | |
1754 | 1754 | $sort_args = array( |
1755 | - 'sort' => $field['id'], |
|
1755 | + 'sort' => $field[ 'id' ], |
|
1756 | 1756 | 'dir' => 'asc', |
1757 | 1757 | ); |
1758 | 1758 | |
1759 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
1759 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
1760 | 1760 | //toggle sorting direction. |
1761 | - if ( 'asc' === $sorting['direction'] ) { |
|
1762 | - $sort_args['dir'] = 'desc'; |
|
1761 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
1762 | + $sort_args[ 'dir' ] = 'desc'; |
|
1763 | 1763 | $class .= ' gv-icon-sort-desc'; |
1764 | 1764 | } else { |
1765 | - $sort_args['dir'] = 'asc'; |
|
1765 | + $sort_args[ 'dir' ] = 'asc'; |
|
1766 | 1766 | $class .= ' gv-icon-sort-asc'; |
1767 | 1767 | } |
1768 | 1768 | } else { |
1769 | 1769 | $class .= ' gv-icon-caret-up-down'; |
1770 | 1770 | } |
1771 | 1771 | |
1772 | - $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
1772 | + $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
1773 | 1773 | |
1774 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
1774 | + return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
1775 | 1775 | |
1776 | 1776 | } |
1777 | 1777 | |
@@ -1789,7 +1789,7 @@ discard block |
||
1789 | 1789 | |
1790 | 1790 | $field_type = $field_id; |
1791 | 1791 | |
1792 | - if( is_numeric( $field_id ) ) { |
|
1792 | + if ( is_numeric( $field_id ) ) { |
|
1793 | 1793 | $field = GFFormsModel::get_field( $form, $field_id ); |
1794 | 1794 | $field_type = $field->type; |
1795 | 1795 | } |
@@ -1812,7 +1812,7 @@ discard block |
||
1812 | 1812 | return false; |
1813 | 1813 | } |
1814 | 1814 | |
1815 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1815 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1816 | 1816 | |
1817 | 1817 | } |
1818 | 1818 |