@@ -20,16 +20,16 @@ discard block |
||
20 | 20 | |
21 | 21 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
22 | 22 | |
23 | - unset( $field_options['search_filter'] ); |
|
23 | + unset( $field_options[ 'search_filter' ] ); |
|
24 | 24 | |
25 | - if( 'edit' === $context ) { |
|
25 | + if ( 'edit' === $context ) { |
|
26 | 26 | return $field_options; |
27 | 27 | } |
28 | 28 | |
29 | - $add_options['link_to_file'] = array( |
|
29 | + $add_options[ 'link_to_file' ] = array( |
|
30 | 30 | 'type' => 'checkbox', |
31 | 31 | 'label' => __( 'Display as a Link:', 'gravityview' ), |
32 | - 'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'), |
|
32 | + 'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ), |
|
33 | 33 | 'value' => false, |
34 | 34 | 'merge_tags' => false, |
35 | 35 | ); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $output_arr = array(); |
66 | 66 | |
67 | 67 | // Get an array of file paths for the field. |
68 | - $file_paths = rgar( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
68 | + $file_paths = rgar( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
69 | 69 | |
70 | 70 | // The $value JSON was probably truncated; let's check lead_detail_long. |
71 | 71 | if ( ! is_array( $file_paths ) ) { |
@@ -79,19 +79,19 @@ discard block |
||
79 | 79 | } |
80 | 80 | |
81 | 81 | // Process each file path |
82 | - foreach( $file_paths as $file_path ) { |
|
82 | + foreach ( $file_paths as $file_path ) { |
|
83 | 83 | |
84 | 84 | // If the site is HTTPS, use HTTPS |
85 | - if(function_exists('set_url_scheme')) { $file_path = set_url_scheme($file_path); } |
|
85 | + if ( function_exists( 'set_url_scheme' ) ) { $file_path = set_url_scheme( $file_path ); } |
|
86 | 86 | |
87 | 87 | // This is from Gravity Forms's code |
88 | - $file_path = esc_attr(str_replace(" ", "%20", $file_path)); |
|
88 | + $file_path = esc_attr( str_replace( " ", "%20", $file_path ) ); |
|
89 | 89 | |
90 | 90 | // If the field is set to link to the single entry, link to it. |
91 | - $link = !empty( $field_settings['show_as_link'] ) ? GravityView_API::entry_link( $entry, $field ) : $file_path; |
|
91 | + $link = ! empty( $field_settings[ 'show_as_link' ] ) ? GravityView_API::entry_link( $entry, $field ) : $file_path; |
|
92 | 92 | |
93 | 93 | // Get file path information |
94 | - $file_path_info = pathinfo($file_path); |
|
94 | + $file_path_info = pathinfo( $file_path ); |
|
95 | 95 | |
96 | 96 | $html_format = NULL; |
97 | 97 | |
@@ -100,30 +100,30 @@ discard block |
||
100 | 100 | $disable_wrapped_link = false; |
101 | 101 | |
102 | 102 | // Is this an image? |
103 | - $image = new GravityView_Image(array( |
|
103 | + $image = new GravityView_Image( array( |
|
104 | 104 | 'src' => $file_path, |
105 | - 'class' => 'gv-image gv-field-id-'.$field_settings['id'], |
|
106 | - 'alt' => $field_settings['label'], |
|
107 | - 'width' => (gravityview_get_context() === 'single' ? NULL : 250) |
|
108 | - )); |
|
105 | + 'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ], |
|
106 | + 'alt' => $field_settings[ 'label' ], |
|
107 | + 'width' => ( gravityview_get_context() === 'single' ? NULL : 250 ) |
|
108 | + ) ); |
|
109 | 109 | |
110 | 110 | $content = $image->html(); |
111 | 111 | |
112 | 112 | // The new default content is the image, if it exists. If not, use the file name as the content. |
113 | - $content = !empty( $content ) ? $content : $file_path_info['basename']; |
|
113 | + $content = ! empty( $content ) ? $content : $file_path_info[ 'basename' ]; |
|
114 | 114 | |
115 | 115 | // If pathinfo() gave us the extension of the file, run the switch statement using that. |
116 | - $extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] ); |
|
116 | + $extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] ); |
|
117 | 117 | |
118 | 118 | |
119 | - switch( true ) { |
|
119 | + switch ( true ) { |
|
120 | 120 | |
121 | 121 | // Audio file |
122 | 122 | case in_array( $extension, wp_get_audio_extensions() ): |
123 | 123 | |
124 | 124 | $disable_lightbox = true; |
125 | 125 | |
126 | - if( shortcode_exists( 'audio' ) ) { |
|
126 | + if ( shortcode_exists( 'audio' ) ) { |
|
127 | 127 | |
128 | 128 | $disable_wrapped_link = true; |
129 | 129 | |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | */ |
135 | 135 | $audio_settings = apply_filters( 'gravityview_audio_settings', array( |
136 | 136 | 'src' => $file_path, |
137 | - 'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id'] |
|
138 | - )); |
|
137 | + 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ] |
|
138 | + ) ); |
|
139 | 139 | |
140 | 140 | /** |
141 | 141 | * Generate the audio shortcode |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | $disable_lightbox = true; |
155 | 155 | |
156 | - if( shortcode_exists( 'video' ) ) { |
|
156 | + if ( shortcode_exists( 'video' ) ) { |
|
157 | 157 | |
158 | 158 | $disable_wrapped_link = true; |
159 | 159 | |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | */ |
165 | 165 | $video_settings = apply_filters( 'gravityview_video_settings', array( |
166 | 166 | 'src' => $file_path, |
167 | - 'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id'] |
|
168 | - )); |
|
167 | + 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ] |
|
168 | + ) ); |
|
169 | 169 | |
170 | 170 | /** |
171 | 171 | * Generate the video shortcode |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | break; |
188 | 188 | |
189 | 189 | // if not image, do not set the lightbox (@since 1.5.3) |
190 | - case !in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ): |
|
190 | + case ! in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ): |
|
191 | 191 | |
192 | 192 | $disable_lightbox = true; |
193 | 193 | |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | |
198 | 198 | // If using Link to File, override the content. |
199 | 199 | // (We do this here so that the $disable_lightbox can be set. Yes, there's a little more processing time, but oh well.) |
200 | - if( !empty( $field_settings['link_to_file'] ) ) { |
|
200 | + if ( ! empty( $field_settings[ 'link_to_file' ] ) ) { |
|
201 | 201 | |
202 | 202 | // Force the content to be the file name |
203 | - $content = $file_path_info["basename"]; |
|
203 | + $content = $file_path_info[ "basename" ]; |
|
204 | 204 | |
205 | 205 | // Restore the wrapped link |
206 | 206 | $disable_wrapped_link = false; |
@@ -208,13 +208,13 @@ discard block |
||
208 | 208 | } |
209 | 209 | |
210 | 210 | // Whether to use lightbox or not |
211 | - if( $disable_lightbox || empty( $gravityview_view->atts['lightbox'] ) || !empty( $field_settings['show_as_link'] ) ) { |
|
211 | + if ( $disable_lightbox || empty( $gravityview_view->atts[ 'lightbox' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) { |
|
212 | 212 | |
213 | - $link_atts = empty( $field_settings['show_as_link'] ) ? array( 'target' => '_blank' ) : array(); |
|
213 | + $link_atts = empty( $field_settings[ 'show_as_link' ] ) ? array( 'target' => '_blank' ) : array(); |
|
214 | 214 | |
215 | 215 | } else { |
216 | 216 | |
217 | - $entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
217 | + $entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
218 | 218 | |
219 | 219 | $link_atts = array( |
220 | 220 | 'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ), |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', $disable_wrapped_link, $gravityview_view->getCurrentField() ); |
241 | 241 | |
242 | 242 | // If the HTML output hasn't been overridden by the switch statement above, use the default format |
243 | - if( !empty( $content ) && empty( $disable_wrapped_link ) ) { |
|
243 | + if ( ! empty( $content ) && empty( $disable_wrapped_link ) ) { |
|
244 | 244 | |
245 | 245 | /** |
246 | 246 | * Modify the link text (defaults to the file name) |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | $content = gravityview_get_link( $link, $content, $link_atts ); |
256 | 256 | } |
257 | 257 | |
258 | - $output_arr[] = array( |
|
258 | + $output_arr[ ] = array( |
|
259 | 259 | 'file_path' => $file_path, |
260 | 260 | 'content' => $content |
261 | 261 | ); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | 'type' => 'radio', |
64 | 64 | 'full_width' => true, |
65 | 65 | 'label' => esc_html__( 'Search Mode', 'gravityview' ), |
66 | - 'desc' => __('Should search results match all search fields, or any?', 'gravityview'), |
|
66 | + 'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ), |
|
67 | 67 | 'value' => 'any', |
68 | 68 | 'class' => 'hide-if-js', |
69 | 69 | 'options' => array( |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | // admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999 |
87 | 87 | add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 ); |
88 | - add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') ); |
|
88 | + add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
89 | 89 | add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
90 | 90 | |
91 | 91 | // ajax - get the searchable fields |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
213 | 213 | $script_source = empty( $script_min ) ? '/source' : ''; |
214 | 214 | |
215 | - wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version ); |
|
215 | + wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version ); |
|
216 | 216 | |
217 | 217 | wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array( |
218 | 218 | 'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ), |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | * @return array Scripts allowed in no-conflict mode, plus the search widget script |
235 | 235 | */ |
236 | 236 | public function register_no_conflict( $allowed ) { |
237 | - $allowed[] = 'gravityview_searchwidget_admin'; |
|
237 | + $allowed[ ] = 'gravityview_searchwidget_admin'; |
|
238 | 238 | return $allowed; |
239 | 239 | } |
240 | 240 | |
@@ -247,24 +247,24 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public static function get_searchable_fields() { |
249 | 249 | |
250 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) { |
|
250 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) { |
|
251 | 251 | exit( '0' ); |
252 | 252 | } |
253 | 253 | |
254 | 254 | $form = ''; |
255 | 255 | |
256 | 256 | // Fetch the form for the current View |
257 | - if ( ! empty( $_POST['view_id'] ) ) { |
|
257 | + if ( ! empty( $_POST[ 'view_id' ] ) ) { |
|
258 | 258 | |
259 | - $form = gravityview_get_form_id( $_POST['view_id'] ); |
|
259 | + $form = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
260 | 260 | |
261 | - } elseif ( ! empty( $_POST['formid'] ) ) { |
|
261 | + } elseif ( ! empty( $_POST[ 'formid' ] ) ) { |
|
262 | 262 | |
263 | - $form = (int) $_POST['formid']; |
|
263 | + $form = (int)$_POST[ 'formid' ]; |
|
264 | 264 | |
265 | - } elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
265 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
266 | 266 | |
267 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
267 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
268 | 268 | |
269 | 269 | } |
270 | 270 | |
@@ -309,8 +309,8 @@ discard block |
||
309 | 309 | ) |
310 | 310 | ); |
311 | 311 | |
312 | - foreach( $custom_fields as $custom_field_key => $custom_field ) { |
|
313 | - $output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field['type'], self::get_field_label( array('field' => $custom_field_key ) ), $custom_field['text'] ); |
|
312 | + foreach ( $custom_fields as $custom_field_key => $custom_field ) { |
|
313 | + $output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field[ 'type' ], self::get_field_label( array( 'field' => $custom_field_key ) ), $custom_field[ 'text' ] ); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | // Get fields with sub-inputs and no parent |
@@ -332,13 +332,13 @@ discard block |
||
332 | 332 | |
333 | 333 | foreach ( $fields as $id => $field ) { |
334 | 334 | |
335 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
335 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
336 | 336 | continue; |
337 | 337 | } |
338 | 338 | |
339 | - $types = self::get_search_input_types( $id, $field['type'] ); |
|
339 | + $types = self::get_search_input_types( $id, $field[ 'type' ] ); |
|
340 | 340 | |
341 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>'; |
|
341 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>'; |
|
342 | 342 | } |
343 | 343 | } |
344 | 344 | |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | public static function get_search_input_types( $id = '', $field_type = null ) { |
361 | 361 | |
362 | 362 | // @todo - This needs to be improved - many fields have . including products and addresses |
363 | - if ( false !== strpos( (string) $id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) { |
|
363 | + if ( false !== strpos( (string)$id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) { |
|
364 | 364 | $input_type = 'boolean'; // on/off checkbox |
365 | 365 | } elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) { |
366 | 366 | $input_type = 'multi'; //multiselect |
@@ -402,19 +402,19 @@ discard block |
||
402 | 402 | $post_id = 0; |
403 | 403 | |
404 | 404 | // We're in the WordPress Widget context, and an overriding post ID has been set. |
405 | - if ( ! empty( $widget_args['post_id'] ) ) { |
|
406 | - $post_id = absint( $widget_args['post_id'] ); |
|
405 | + if ( ! empty( $widget_args[ 'post_id' ] ) ) { |
|
406 | + $post_id = absint( $widget_args[ 'post_id' ] ); |
|
407 | 407 | } |
408 | 408 | // We're in the WordPress Widget context, and the base View ID should be used |
409 | - else if ( ! empty( $widget_args['view_id'] ) ) { |
|
410 | - $post_id = absint( $widget_args['view_id'] ); |
|
409 | + else if ( ! empty( $widget_args[ 'view_id' ] ) ) { |
|
410 | + $post_id = absint( $widget_args[ 'view_id' ] ); |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | $args = gravityview_get_permalink_query_args( $post_id ); |
414 | 414 | |
415 | 415 | // Add hidden fields to the search form |
416 | 416 | foreach ( $args as $key => $value ) { |
417 | - $search_fields[] = array( |
|
417 | + $search_fields[ ] = array( |
|
418 | 418 | 'name' => $key, |
419 | 419 | 'input' => 'hidden', |
420 | 420 | 'value' => $value, |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | */ |
436 | 436 | public function filter_entries( $search_criteria ) { |
437 | 437 | |
438 | - if( 'post' === $this->search_method ) { |
|
438 | + if ( 'post' === $this->search_method ) { |
|
439 | 439 | $get = $_POST; |
440 | 440 | } else { |
441 | 441 | $get = $_GET; |
@@ -452,15 +452,15 @@ discard block |
||
452 | 452 | $get = gv_map_deep( $get, 'rawurldecode' ); |
453 | 453 | |
454 | 454 | // add free search |
455 | - if ( ! empty( $get['gv_search'] ) ) { |
|
455 | + if ( ! empty( $get[ 'gv_search' ] ) ) { |
|
456 | 456 | |
457 | 457 | // Search for a piece |
458 | - $words = explode( ' ', $get['gv_search'] ); |
|
458 | + $words = explode( ' ', $get[ 'gv_search' ] ); |
|
459 | 459 | |
460 | 460 | $words = array_filter( $words ); |
461 | 461 | |
462 | 462 | foreach ( $words as $word ) { |
463 | - $search_criteria['field_filters'][] = array( |
|
463 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
464 | 464 | 'key' => null, // The field ID to search |
465 | 465 | 'value' => $word, // The value to search |
466 | 466 | 'operator' => 'contains', // What to search in. Options: `is` or `contains` |
@@ -469,8 +469,8 @@ discard block |
||
469 | 469 | } |
470 | 470 | |
471 | 471 | //start date & end date |
472 | - $curr_start = !empty( $get['gv_start'] ) ? $get['gv_start'] : ''; |
|
473 | - $curr_end = !empty( $get['gv_start'] ) ? $get['gv_end'] : ''; |
|
472 | + $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : ''; |
|
473 | + $curr_end = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_end' ] : ''; |
|
474 | 474 | |
475 | 475 | /** |
476 | 476 | * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n |
@@ -485,16 +485,16 @@ discard block |
||
485 | 485 | /** |
486 | 486 | * Don't set $search_criteria['start_date'] if start_date is empty as it may lead to bad query results (GFAPI::get_entries) |
487 | 487 | */ |
488 | - if( !empty( $curr_start ) ) { |
|
489 | - $search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
488 | + if ( ! empty( $curr_start ) ) { |
|
489 | + $search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
490 | 490 | } |
491 | - if( !empty( $curr_end ) ) { |
|
492 | - $search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
491 | + if ( ! empty( $curr_end ) ) { |
|
492 | + $search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | // search for a specific entry ID |
496 | 496 | if ( ! empty( $get[ 'gv_id' ] ) ) { |
497 | - $search_criteria['field_filters'][] = array( |
|
497 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
498 | 498 | 'key' => 'id', |
499 | 499 | 'value' => absint( $get[ 'gv_id' ] ), |
500 | 500 | 'operator' => '=', |
@@ -503,36 +503,36 @@ discard block |
||
503 | 503 | |
504 | 504 | // search for a specific Created_by ID |
505 | 505 | if ( ! empty( $get[ 'gv_by' ] ) ) { |
506 | - $search_criteria['field_filters'][] = array( |
|
506 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
507 | 507 | 'key' => 'created_by', |
508 | - 'value' => absint( $get['gv_by'] ), |
|
508 | + 'value' => absint( $get[ 'gv_by' ] ), |
|
509 | 509 | 'operator' => '=', |
510 | 510 | ); |
511 | 511 | } |
512 | 512 | |
513 | 513 | |
514 | 514 | // Get search mode passed in URL |
515 | - $mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ? $get['mode'] : 'any'; |
|
515 | + $mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any'; |
|
516 | 516 | |
517 | 517 | // get the other search filters |
518 | 518 | foreach ( $get as $key => $value ) { |
519 | 519 | |
520 | - if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[0] ) ) ) { |
|
520 | + if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[ 0 ] ) ) ) { |
|
521 | 521 | continue; |
522 | 522 | } |
523 | 523 | |
524 | 524 | // could return simple filter or multiple filters |
525 | 525 | $filter = $this->prepare_field_filter( $key, $value ); |
526 | 526 | |
527 | - if ( isset( $filter[0]['value'] ) ) { |
|
528 | - $search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter ); |
|
527 | + if ( isset( $filter[ 0 ][ 'value' ] ) ) { |
|
528 | + $search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter ); |
|
529 | 529 | |
530 | 530 | // if date range type, set search mode to ALL |
531 | - if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) { |
|
531 | + if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) { |
|
532 | 532 | $mode = 'all'; |
533 | 533 | } |
534 | - } elseif( !empty( $filter ) ) { |
|
535 | - $search_criteria['field_filters'][] = $filter; |
|
534 | + } elseif ( ! empty( $filter ) ) { |
|
535 | + $search_criteria[ 'field_filters' ][ ] = $filter; |
|
536 | 536 | } |
537 | 537 | } |
538 | 538 | |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | * @since 1.5.1 |
542 | 542 | * @param[out,in] string $mode Search mode (`any` vs `all`) |
543 | 543 | */ |
544 | - $search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode ); |
|
544 | + $search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode ); |
|
545 | 545 | |
546 | 546 | do_action( 'gravityview_log_debug', sprintf( '%s[filter_entries] Returned Search Criteria: ', get_class( $this ) ), $search_criteria ); |
547 | 547 | |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | $field_id = str_replace( 'filter_', '', $key ); |
568 | 568 | |
569 | 569 | // calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox ) |
570 | - if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) { |
|
570 | + if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) { |
|
571 | 571 | $field_id = str_replace( '_', '.', $field_id ); |
572 | 572 | } |
573 | 573 | |
@@ -581,11 +581,11 @@ discard block |
||
581 | 581 | 'value' => $value, |
582 | 582 | ); |
583 | 583 | |
584 | - switch ( $form_field['type'] ) { |
|
584 | + switch ( $form_field[ 'type' ] ) { |
|
585 | 585 | |
586 | 586 | case 'select': |
587 | 587 | case 'radio': |
588 | - $filter['operator'] = 'is'; |
|
588 | + $filter[ 'operator' ] = 'is'; |
|
589 | 589 | break; |
590 | 590 | |
591 | 591 | case 'post_category': |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | |
600 | 600 | foreach ( $value as $val ) { |
601 | 601 | $cat = get_term( $val, 'category' ); |
602 | - $filter[] = array( |
|
602 | + $filter[ ] = array( |
|
603 | 603 | 'key' => $field_id, |
604 | 604 | 'value' => esc_attr( $cat->name ) . ':' . $val, |
605 | 605 | 'operator' => 'is', |
@@ -618,18 +618,18 @@ discard block |
||
618 | 618 | $filter = array(); |
619 | 619 | |
620 | 620 | foreach ( $value as $val ) { |
621 | - $filter[] = array( 'key' => $field_id, 'value' => $val ); |
|
621 | + $filter[ ] = array( 'key' => $field_id, 'value' => $val ); |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | break; |
625 | 625 | |
626 | 626 | case 'checkbox': |
627 | 627 | // convert checkbox on/off into the correct search filter |
628 | - if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field['inputs'] ) && ! empty( $form_field['choices'] ) ) { |
|
629 | - foreach ( $form_field['inputs'] as $k => $input ) { |
|
630 | - if ( $input['id'] == $field_id ) { |
|
631 | - $filter['value'] = $form_field['choices'][ $k ]['value']; |
|
632 | - $filter['operator'] = 'is'; |
|
628 | + if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field[ 'inputs' ] ) && ! empty( $form_field[ 'choices' ] ) ) { |
|
629 | + foreach ( $form_field[ 'inputs' ] as $k => $input ) { |
|
630 | + if ( $input[ 'id' ] == $field_id ) { |
|
631 | + $filter[ 'value' ] = $form_field[ 'choices' ][ $k ][ 'value' ]; |
|
632 | + $filter[ 'operator' ] = 'is'; |
|
633 | 633 | break; |
634 | 634 | } |
635 | 635 | } |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | $filter = array(); |
640 | 640 | |
641 | 641 | foreach ( $value as $val ) { |
642 | - $filter[] = array( |
|
642 | + $filter[ ] = array( |
|
643 | 643 | 'key' => $field_id, |
644 | 644 | 'value' => $val, |
645 | 645 | 'operator' => 'is', |
@@ -660,9 +660,9 @@ discard block |
||
660 | 660 | foreach ( $words as $word ) { |
661 | 661 | if ( ! empty( $word ) && strlen( $word ) > 1 ) { |
662 | 662 | // Keep the same key for each filter |
663 | - $filter['value'] = $word; |
|
663 | + $filter[ 'value' ] = $word; |
|
664 | 664 | // Add a search for the value |
665 | - $filters[] = $filter; |
|
665 | + $filters[ ] = $filter; |
|
666 | 666 | } |
667 | 667 | } |
668 | 668 | |
@@ -689,19 +689,19 @@ discard block |
||
689 | 689 | * @since 1.16.3 |
690 | 690 | * Safeguard until GF implements '<=' operator |
691 | 691 | */ |
692 | - if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
692 | + if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
693 | 693 | $operator = '<'; |
694 | 694 | $date = date( 'Y-m-d', strtotime( $date . ' +1 day' ) ); |
695 | 695 | } |
696 | 696 | |
697 | - $filter[] = array( |
|
697 | + $filter[ ] = array( |
|
698 | 698 | 'key' => $field_id, |
699 | 699 | 'value' => self::get_formatted_date( $date, 'Y-m-d' ), |
700 | 700 | 'operator' => $operator, |
701 | 701 | ); |
702 | 702 | } |
703 | 703 | } else { |
704 | - $filter['value'] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
704 | + $filter[ 'value' ] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
705 | 705 | } |
706 | 706 | |
707 | 707 | break; |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | 'ymd_dot' => 'Y.m.d', |
733 | 733 | ); |
734 | 734 | |
735 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
735 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
736 | 736 | $format = $datepicker[ $field->dateFormat ]; |
737 | 737 | } |
738 | 738 | |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | public function add_template_path( $file_paths ) { |
764 | 764 | |
765 | 765 | // Index 100 is the default GravityView template path. |
766 | - $file_paths[102] = self::$file . 'templates/'; |
|
766 | + $file_paths[ 102 ] = self::$file . 'templates/'; |
|
767 | 767 | |
768 | 768 | return $file_paths; |
769 | 769 | } |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | $has_date = false; |
783 | 783 | |
784 | 784 | foreach ( $search_fields as $k => $field ) { |
785 | - if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
785 | + if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
786 | 786 | $has_date = true; |
787 | 787 | break; |
788 | 788 | } |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | } |
810 | 810 | |
811 | 811 | // get configured search fields |
812 | - $search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : ''; |
|
812 | + $search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : ''; |
|
813 | 813 | |
814 | 814 | if ( empty( $search_fields ) || ! is_array( $search_fields ) ) { |
815 | 815 | do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend] No search fields configured for widget:', get_class( $this ) ), $widget_args ); |
@@ -824,34 +824,34 @@ discard block |
||
824 | 824 | |
825 | 825 | $updated_field = $this->get_search_filter_details( $updated_field ); |
826 | 826 | |
827 | - switch ( $field['field'] ) { |
|
827 | + switch ( $field[ 'field' ] ) { |
|
828 | 828 | |
829 | 829 | case 'search_all': |
830 | - $updated_field['key'] = 'search_all'; |
|
831 | - $updated_field['input'] = 'search_all'; |
|
832 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' ); |
|
830 | + $updated_field[ 'key' ] = 'search_all'; |
|
831 | + $updated_field[ 'input' ] = 'search_all'; |
|
832 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' ); |
|
833 | 833 | break; |
834 | 834 | |
835 | 835 | case 'entry_date': |
836 | - $updated_field['key'] = 'entry_date'; |
|
837 | - $updated_field['input'] = 'entry_date'; |
|
838 | - $updated_field['value'] = array( |
|
836 | + $updated_field[ 'key' ] = 'entry_date'; |
|
837 | + $updated_field[ 'input' ] = 'entry_date'; |
|
838 | + $updated_field[ 'value' ] = array( |
|
839 | 839 | 'start' => $this->rgget_or_rgpost( 'gv_start' ), |
840 | 840 | 'end' => $this->rgget_or_rgpost( 'gv_end' ), |
841 | 841 | ); |
842 | 842 | break; |
843 | 843 | |
844 | 844 | case 'entry_id': |
845 | - $updated_field['key'] = 'entry_id'; |
|
846 | - $updated_field['input'] = 'entry_id'; |
|
847 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' ); |
|
845 | + $updated_field[ 'key' ] = 'entry_id'; |
|
846 | + $updated_field[ 'input' ] = 'entry_id'; |
|
847 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' ); |
|
848 | 848 | break; |
849 | 849 | |
850 | 850 | case 'created_by': |
851 | - $updated_field['key'] = 'created_by'; |
|
852 | - $updated_field['name'] = 'gv_by'; |
|
853 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' ); |
|
854 | - $updated_field['choices'] = self::get_created_by_choices(); |
|
851 | + $updated_field[ 'key' ] = 'created_by'; |
|
852 | + $updated_field[ 'name' ] = 'gv_by'; |
|
853 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' ); |
|
854 | + $updated_field[ 'choices' ] = self::get_created_by_choices(); |
|
855 | 855 | break; |
856 | 856 | } |
857 | 857 | |
@@ -869,16 +869,16 @@ discard block |
||
869 | 869 | */ |
870 | 870 | $gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args ); |
871 | 871 | |
872 | - $gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal'; |
|
872 | + $gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal'; |
|
873 | 873 | |
874 | 874 | /** @since 1.14 */ |
875 | - $gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any'; |
|
875 | + $gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any'; |
|
876 | 876 | |
877 | - $custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
877 | + $custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
878 | 878 | |
879 | 879 | $gravityview_view->search_class = self::get_search_class( $custom_class ); |
880 | 880 | |
881 | - $gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false; |
|
881 | + $gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false; |
|
882 | 882 | |
883 | 883 | if ( $this->has_date_field( $search_fields ) ) { |
884 | 884 | // enqueue datepicker stuff only if needed! |
@@ -900,10 +900,10 @@ discard block |
||
900 | 900 | public static function get_search_class( $custom_class = '' ) { |
901 | 901 | $gravityview_view = GravityView_View::getInstance(); |
902 | 902 | |
903 | - $search_class = 'gv-search-'.$gravityview_view->search_layout; |
|
903 | + $search_class = 'gv-search-' . $gravityview_view->search_layout; |
|
904 | 904 | |
905 | - if ( ! empty( $custom_class ) ) { |
|
906 | - $search_class .= ' '.$custom_class; |
|
905 | + if ( ! empty( $custom_class ) ) { |
|
906 | + $search_class .= ' ' . $custom_class; |
|
907 | 907 | } |
908 | 908 | |
909 | 909 | /** |
@@ -945,11 +945,11 @@ discard block |
||
945 | 945 | |
946 | 946 | $label = rgget( 'label', $field ); |
947 | 947 | |
948 | - if( '' === $label ) { |
|
948 | + if ( '' === $label ) { |
|
949 | 949 | |
950 | - $label = isset( $form_field['label'] ) ? $form_field['label'] : ''; |
|
950 | + $label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : ''; |
|
951 | 951 | |
952 | - switch( $field['field'] ) { |
|
952 | + switch ( $field[ 'field' ] ) { |
|
953 | 953 | case 'search_all': |
954 | 954 | $label = __( 'Search Entries:', 'gravityview' ); |
955 | 955 | break; |
@@ -961,10 +961,10 @@ discard block |
||
961 | 961 | break; |
962 | 962 | default: |
963 | 963 | // If this is a field input, not a field |
964 | - if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) { |
|
964 | + if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) { |
|
965 | 965 | |
966 | 966 | // Get the label for the field in question, which returns an array |
967 | - $items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) ); |
|
967 | + $items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) ); |
|
968 | 968 | |
969 | 969 | // Get the item with the `label` key |
970 | 970 | $values = wp_list_pluck( $items, 'label' ); |
@@ -1003,32 +1003,32 @@ discard block |
||
1003 | 1003 | $form = $gravityview_view->getForm(); |
1004 | 1004 | |
1005 | 1005 | // for advanced field ids (eg, first name / last name ) |
1006 | - $name = 'filter_' . str_replace( '.', '_', $field['field'] ); |
|
1006 | + $name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] ); |
|
1007 | 1007 | |
1008 | 1008 | // get searched value from $_GET/$_POST (string or array) |
1009 | 1009 | $value = $this->rgget_or_rgpost( $name ); |
1010 | 1010 | |
1011 | 1011 | // get form field details |
1012 | - $form_field = gravityview_get_field( $form, $field['field'] ); |
|
1012 | + $form_field = gravityview_get_field( $form, $field[ 'field' ] ); |
|
1013 | 1013 | |
1014 | 1014 | $filter = array( |
1015 | - 'key' => $field['field'], |
|
1015 | + 'key' => $field[ 'field' ], |
|
1016 | 1016 | 'name' => $name, |
1017 | 1017 | 'label' => self::get_field_label( $field, $form_field ), |
1018 | - 'input' => $field['input'], |
|
1018 | + 'input' => $field[ 'input' ], |
|
1019 | 1019 | 'value' => $value, |
1020 | - 'type' => $form_field['type'], |
|
1020 | + 'type' => $form_field[ 'type' ], |
|
1021 | 1021 | ); |
1022 | 1022 | |
1023 | 1023 | // collect choices |
1024 | - if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) { |
|
1025 | - $filter['choices'] = gravityview_get_terms_choices(); |
|
1026 | - } elseif ( ! empty( $form_field['choices'] ) ) { |
|
1027 | - $filter['choices'] = $form_field['choices']; |
|
1024 | + if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) { |
|
1025 | + $filter[ 'choices' ] = gravityview_get_terms_choices(); |
|
1026 | + } elseif ( ! empty( $form_field[ 'choices' ] ) ) { |
|
1027 | + $filter[ 'choices' ] = $form_field[ 'choices' ]; |
|
1028 | 1028 | } |
1029 | 1029 | |
1030 | - if ( 'date_range' === $field['input'] && empty( $value ) ) { |
|
1031 | - $filter['value'] = array( 'start' => '', 'end' => '' ); |
|
1030 | + if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) { |
|
1031 | + $filter[ 'value' ] = array( 'start' => '', 'end' => '' ); |
|
1032 | 1032 | } |
1033 | 1033 | |
1034 | 1034 | return $filter; |
@@ -1052,7 +1052,7 @@ discard block |
||
1052 | 1052 | |
1053 | 1053 | $choices = array(); |
1054 | 1054 | foreach ( $users as $user ) { |
1055 | - $choices[] = array( |
|
1055 | + $choices[ ] = array( |
|
1056 | 1056 | 'value' => $user->ID, |
1057 | 1057 | 'text' => $user->display_name, |
1058 | 1058 | ); |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | */ |
1108 | 1108 | public function add_datepicker_js_dependency( $js_dependencies ) { |
1109 | 1109 | |
1110 | - $js_dependencies[] = 'jquery-ui-datepicker'; |
|
1110 | + $js_dependencies[ ] = 'jquery-ui-datepicker'; |
|
1111 | 1111 | |
1112 | 1112 | return $js_dependencies; |
1113 | 1113 | } |
@@ -1151,7 +1151,7 @@ discard block |
||
1151 | 1151 | 'isRTL' => is_rtl(), |
1152 | 1152 | ), $view_data ); |
1153 | 1153 | |
1154 | - $localizations['datepicker'] = $datepicker_settings; |
|
1154 | + $localizations[ 'datepicker' ] = $datepicker_settings; |
|
1155 | 1155 | |
1156 | 1156 | return $localizations; |
1157 | 1157 | |
@@ -1180,7 +1180,7 @@ discard block |
||
1180 | 1180 | * @return void |
1181 | 1181 | */ |
1182 | 1182 | private function maybe_enqueue_flexibility() { |
1183 | - if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
1183 | + if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) { |
|
1184 | 1184 | wp_enqueue_script( 'gv-flexibility' ); |
1185 | 1185 | } |
1186 | 1186 | } |
@@ -1202,7 +1202,7 @@ discard block |
||
1202 | 1202 | add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 ); |
1203 | 1203 | |
1204 | 1204 | $scheme = is_ssl() ? 'https://' : 'http://'; |
1205 | - wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
1205 | + wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
1206 | 1206 | |
1207 | 1207 | /** |
1208 | 1208 | * @filter `gravityview_search_datepicker_class` |
@@ -28,30 +28,30 @@ discard block |
||
28 | 28 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 ); |
29 | 29 | |
30 | 30 | // Tooltips |
31 | - add_filter( 'gform_tooltips', array( $this, 'tooltips') ); |
|
31 | + add_filter( 'gform_tooltips', array( $this, 'tooltips' ) ); |
|
32 | 32 | |
33 | 33 | // adding styles and scripts |
34 | - add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 ); |
|
35 | - add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
36 | - add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
37 | - add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
38 | - add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
39 | - |
|
40 | - add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 ); |
|
41 | - add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 ); |
|
42 | - add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 ); |
|
43 | - add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') ); |
|
44 | - add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 ); |
|
34 | + add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 ); |
|
35 | + add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
36 | + add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
37 | + add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
38 | + add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
39 | + |
|
40 | + add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 ); |
|
41 | + add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 ); |
|
42 | + add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 ); |
|
43 | + add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) ); |
|
44 | + add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 ); |
|
45 | 45 | |
46 | 46 | // @todo check if this hook is needed.. |
47 | 47 | //add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 ); |
48 | 48 | |
49 | 49 | // Add Connected Form column |
50 | - add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) ); |
|
50 | + add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) ); |
|
51 | 51 | |
52 | 52 | add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
53 | 53 | |
54 | - add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 ); |
|
54 | + add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 ); |
|
55 | 55 | |
56 | 56 | add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) ); |
57 | 57 | |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | public function filter_pre_get_posts_by_gravityview_form_id( &$query ) { |
67 | 67 | global $pagenow; |
68 | 68 | |
69 | - if ( !is_admin() ) { |
|
69 | + if ( ! is_admin() ) { |
|
70 | 70 | return; |
71 | 71 | } |
72 | 72 | |
73 | - if( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
73 | + if ( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
74 | 74 | return; |
75 | 75 | } |
76 | 76 | |
@@ -87,18 +87,18 @@ discard block |
||
87 | 87 | function add_view_dropdown() { |
88 | 88 | $current_screen = get_current_screen(); |
89 | 89 | |
90 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
90 | + if ( 'gravityview' !== $current_screen->post_type ) { |
|
91 | 91 | return; |
92 | 92 | } |
93 | 93 | |
94 | 94 | $forms = gravityview_get_forms(); |
95 | 95 | $current_form = rgget( 'gravityview_form_id' ); |
96 | 96 | // If there are no forms to select, show no forms. |
97 | - if( !empty( $forms ) ) { ?> |
|
97 | + if ( ! empty( $forms ) ) { ?> |
|
98 | 98 | <select name="gravityview_form_id" id="gravityview_form_id"> |
99 | 99 | <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option> |
100 | - <?php foreach( $forms as $form ) { ?> |
|
101 | - <option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
100 | + <?php foreach ( $forms as $form ) { ?> |
|
101 | + <option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
102 | 102 | <?php } ?> |
103 | 103 | </select> |
104 | 104 | <?php } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
113 | 113 | _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
114 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
114 | + GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id ); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | |
135 | 135 | $connected_views = gravityview_get_connected_views( $id ); |
136 | 136 | |
137 | - if( empty( $connected_views ) ) { |
|
137 | + if ( empty( $connected_views ) ) { |
|
138 | 138 | |
139 | - $menu_items['gravityview'] = array( |
|
139 | + $menu_items[ 'gravityview' ] = array( |
|
140 | 140 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
141 | 141 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
142 | 142 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -152,22 +152,22 @@ discard block |
||
152 | 152 | $sub_menu_items = array(); |
153 | 153 | foreach ( (array)$connected_views as $view ) { |
154 | 154 | |
155 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
155 | + if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
156 | 156 | continue; |
157 | 157 | } |
158 | 158 | |
159 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
159 | + $label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
160 | 160 | |
161 | - $sub_menu_items[] = array( |
|
161 | + $sub_menu_items[ ] = array( |
|
162 | 162 | 'label' => esc_attr( $label ), |
163 | - 'url' => admin_url( 'post.php?action=edit&post='.$view->ID ), |
|
163 | + 'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ), |
|
164 | 164 | ); |
165 | 165 | } |
166 | 166 | |
167 | 167 | // If there were no items added, then let's create the parent menu |
168 | - if( $sub_menu_items ) { |
|
168 | + if ( $sub_menu_items ) { |
|
169 | 169 | |
170 | - $sub_menu_items[] = array( |
|
170 | + $sub_menu_items[ ] = array( |
|
171 | 171 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
172 | 172 | 'link_class' => 'gv-create-view', |
173 | 173 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | ); |
177 | 177 | |
178 | 178 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
179 | - $sub_menu_items[] = array( |
|
179 | + $sub_menu_items[ ] = array( |
|
180 | 180 | 'url' => '#', |
181 | 181 | 'label' => '', |
182 | 182 | 'menu_class' => 'hidden', |
183 | 183 | 'capabilities' => '', |
184 | 184 | ); |
185 | 185 | |
186 | - $menu_items['gravityview'] = array( |
|
186 | + $menu_items[ 'gravityview' ] = array( |
|
187 | 187 | 'label' => __( 'Connected Views', 'gravityview' ), |
188 | 188 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
189 | 189 | 'title' => __( 'GravityView Views using this form as a data source', 'gravityview' ), |
@@ -212,8 +212,8 @@ discard block |
||
212 | 212 | $add = array( 'captcha', 'page' ); |
213 | 213 | |
214 | 214 | // Don't allowing editing the following values: |
215 | - if( $context === 'edit' ) { |
|
216 | - $add[] = 'post_id'; |
|
215 | + if ( $context === 'edit' ) { |
|
216 | + $add[ ] = 'post_id'; |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | $return = array_merge( $array, $add ); |
@@ -236,32 +236,32 @@ discard block |
||
236 | 236 | foreach ( $default_args as $key => $arg ) { |
237 | 237 | |
238 | 238 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
239 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
239 | + if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; } |
|
240 | 240 | |
241 | 241 | // By default, use `tooltip` if defined. |
242 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
242 | + $tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ]; |
|
243 | 243 | |
244 | 244 | // Otherwise, use the description as a tooltip. |
245 | - if( empty( $tooltip ) && !empty( $arg['desc'] ) ) { |
|
246 | - $tooltip = $arg['desc']; |
|
245 | + if ( empty( $tooltip ) && ! empty( $arg[ 'desc' ] ) ) { |
|
246 | + $tooltip = $arg[ 'desc' ]; |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | // If there's no tooltip set, continue |
250 | - if( empty( $tooltip ) ) { |
|
250 | + if ( empty( $tooltip ) ) { |
|
251 | 251 | continue; |
252 | 252 | } |
253 | 253 | |
254 | 254 | // Add the tooltip |
255 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
256 | - 'title' => $arg['label'], |
|
255 | + $gv_tooltips[ 'gv_' . $key ] = array( |
|
256 | + 'title' => $arg[ 'label' ], |
|
257 | 257 | 'value' => $tooltip, |
258 | 258 | ); |
259 | 259 | |
260 | 260 | } |
261 | 261 | |
262 | - $gv_tooltips['gv_css_merge_tags'] = array( |
|
263 | - 'title' => __('CSS Merge Tags', 'gravityview'), |
|
264 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' ) |
|
262 | + $gv_tooltips[ 'gv_css_merge_tags' ] = array( |
|
263 | + 'title' => __( 'CSS Merge Tags', 'gravityview' ), |
|
264 | + 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' ) |
|
265 | 265 | ); |
266 | 266 | |
267 | 267 | /** |
@@ -272,9 +272,9 @@ discard block |
||
272 | 272 | |
273 | 273 | foreach ( $gv_tooltips as $key => $tooltip ) { |
274 | 274 | |
275 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
275 | + $title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>'; |
|
276 | 276 | |
277 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
277 | + $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) ); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | return $tooltips; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | * |
289 | 289 | * @return void |
290 | 290 | */ |
291 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
291 | + public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
292 | 292 | |
293 | 293 | $output = ''; |
294 | 294 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
311 | 311 | $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
312 | 312 | |
313 | - $output = $template ? $template['label'] : $template_id_pretty; |
|
313 | + $output = $template ? $template[ 'label' ] : $template_id_pretty; |
|
314 | 314 | |
315 | 315 | break; |
316 | 316 | |
@@ -351,44 +351,44 @@ discard block |
||
351 | 351 | static public function get_connected_form_links( $form, $include_form_link = true ) { |
352 | 352 | |
353 | 353 | // Either the form is empty or the form ID is 0, not yet set. |
354 | - if( empty( $form ) ) { |
|
354 | + if ( empty( $form ) ) { |
|
355 | 355 | return ''; |
356 | 356 | } |
357 | 357 | |
358 | 358 | // The $form is passed as the form ID |
359 | - if( !is_array( $form ) ) { |
|
359 | + if ( ! is_array( $form ) ) { |
|
360 | 360 | $form = gravityview_get_form( $form ); |
361 | 361 | } |
362 | 362 | |
363 | - $form_id = $form['id']; |
|
363 | + $form_id = $form[ 'id' ]; |
|
364 | 364 | $links = array(); |
365 | 365 | |
366 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
366 | + if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
367 | 367 | $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
368 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
369 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>'; |
|
368 | + $form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>'; |
|
369 | + $links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>'; |
|
370 | 370 | } else { |
371 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
371 | + $form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>'; |
|
372 | 372 | } |
373 | 373 | |
374 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
374 | + if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
375 | 375 | $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
376 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>'; |
|
376 | + $links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>'; |
|
377 | 377 | } |
378 | 378 | |
379 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
379 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
380 | 380 | $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
381 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>'; |
|
381 | + $links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>'; |
|
382 | 382 | } |
383 | 383 | |
384 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
384 | + if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) { |
|
385 | 385 | $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
386 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>'; |
|
386 | + $links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>'; |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | $output = ''; |
390 | 390 | |
391 | - if( !empty( $include_form_link ) ) { |
|
391 | + if ( ! empty( $include_form_link ) ) { |
|
392 | 392 | $output .= $form_link; |
393 | 393 | } |
394 | 394 | |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | */ |
401 | 401 | $links = apply_filters( 'gravityview_connected_form_links', $links, $form ); |
402 | 402 | |
403 | - $output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>'; |
|
403 | + $output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>'; |
|
404 | 404 | |
405 | 405 | return $output; |
406 | 406 | } |
@@ -414,8 +414,8 @@ discard block |
||
414 | 414 | // Get the date column and save it for later to add back in. |
415 | 415 | // This adds it after the Data Source column. |
416 | 416 | // This way, we don't need to do array_slice, array_merge, etc. |
417 | - $date = $columns['date']; |
|
418 | - unset( $columns['date'] ); |
|
417 | + $date = $columns[ 'date' ]; |
|
418 | + unset( $columns[ 'date' ] ); |
|
419 | 419 | |
420 | 420 | $data_source_required_caps = array( |
421 | 421 | 'gravityforms_edit_forms', |
@@ -426,14 +426,14 @@ discard block |
||
426 | 426 | 'gravityforms_preview_forms', |
427 | 427 | ); |
428 | 428 | |
429 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
430 | - $columns['gv_connected_form'] = __( 'Data Source', 'gravityview' ); |
|
429 | + if ( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
430 | + $columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' ); |
|
431 | 431 | } |
432 | 432 | |
433 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
433 | + $columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
434 | 434 | |
435 | 435 | // Add the date back in. |
436 | - $columns['date'] = $date; |
|
436 | + $columns[ 'date' ] = $date; |
|
437 | 437 | |
438 | 438 | return $columns; |
439 | 439 | } |
@@ -447,12 +447,12 @@ discard block |
||
447 | 447 | */ |
448 | 448 | function save_postdata( $post_id ) { |
449 | 449 | |
450 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
450 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
451 | 451 | return; |
452 | 452 | } |
453 | 453 | |
454 | 454 | // validate post_type |
455 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
455 | + if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) { |
|
456 | 456 | return; |
457 | 457 | } |
458 | 458 | |
@@ -467,63 +467,63 @@ discard block |
||
467 | 467 | $statii = array(); |
468 | 468 | |
469 | 469 | // check if this is a start fresh View |
470 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
470 | + if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) { |
|
471 | 471 | |
472 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
472 | + $form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : ''; |
|
473 | 473 | // save form id |
474 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
474 | + $statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
475 | 475 | |
476 | 476 | } |
477 | 477 | |
478 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
478 | + if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) { |
|
479 | 479 | do_action( 'gravityview_log_error', __METHOD__ . ' - Current user does not have the capability to create a new Form.', wp_get_current_user() ); |
480 | 480 | return; |
481 | 481 | } |
482 | 482 | |
483 | 483 | // Was this a start fresh? |
484 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
485 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
484 | + if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) { |
|
485 | + $statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
486 | 486 | } else { |
487 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
487 | + $statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | // Check if we have a template id |
491 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
491 | + if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) { |
|
492 | 492 | |
493 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
493 | + $template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : ''; |
|
494 | 494 | |
495 | 495 | // now save template id |
496 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
496 | + $statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | |
500 | 500 | // save View Configuration metabox |
501 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
501 | + if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) { |
|
502 | 502 | |
503 | 503 | // template settings |
504 | - if( empty( $_POST['template_settings'] ) ) { |
|
505 | - $_POST['template_settings'] = array(); |
|
504 | + if ( empty( $_POST[ 'template_settings' ] ) ) { |
|
505 | + $_POST[ 'template_settings' ] = array(); |
|
506 | 506 | } |
507 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
507 | + $statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] ); |
|
508 | 508 | |
509 | 509 | $fields = array(); |
510 | 510 | |
511 | 511 | // Directory&single Visible Fields |
512 | - if( !empty( $preset_fields ) ) { |
|
512 | + if ( ! empty( $preset_fields ) ) { |
|
513 | 513 | |
514 | 514 | $fields = $preset_fields; |
515 | 515 | |
516 | - } elseif( !empty( $_POST['gv_fields'] ) ) { |
|
516 | + } elseif ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
517 | 517 | $fields = _gravityview_process_posted_fields(); |
518 | 518 | } |
519 | 519 | |
520 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
520 | + $statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
521 | 521 | |
522 | 522 | // Directory Visible Widgets |
523 | - if( empty( $_POST['widgets'] ) ) { |
|
524 | - $_POST['widgets'] = array(); |
|
523 | + if ( empty( $_POST[ 'widgets' ] ) ) { |
|
524 | + $_POST[ 'widgets' ] = array(); |
|
525 | 525 | } |
526 | - $statii['directory_widgets'] = gravityview_set_directory_widgets( $post_id, $_POST['widgets'] ); |
|
526 | + $statii[ 'directory_widgets' ] = gravityview_set_directory_widgets( $post_id, $_POST[ 'widgets' ] ); |
|
527 | 527 | |
528 | 528 | } // end save view configuration |
529 | 529 | |
@@ -533,9 +533,9 @@ discard block |
||
533 | 533 | * @param array $statii Array of statuses of the post meta saving processes. If saving worked, each key should be mapped to a value of the post ID (`directory_widgets` => `124`). If failed (or didn't change), the value will be false. |
534 | 534 | * @since 1.17.2 |
535 | 535 | */ |
536 | - do_action('gravityview_view_saved', $post_id, $statii ); |
|
536 | + do_action( 'gravityview_view_saved', $post_id, $statii ); |
|
537 | 537 | |
538 | - do_action('gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) ); |
|
538 | + do_action( 'gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) ); |
|
539 | 539 | } |
540 | 540 | |
541 | 541 | /** |
@@ -570,20 +570,20 @@ discard block |
||
570 | 570 | |
571 | 571 | $output = ''; |
572 | 572 | |
573 | - if( !empty( $fields ) ) { |
|
573 | + if ( ! empty( $fields ) ) { |
|
574 | 574 | |
575 | - foreach( $fields as $id => $details ) { |
|
575 | + foreach ( $fields as $id => $details ) { |
|
576 | 576 | |
577 | - if( in_array( $details['type'], $blacklist_field_types ) ) { |
|
577 | + if ( in_array( $details[ 'type' ], $blacklist_field_types ) ) { |
|
578 | 578 | continue; |
579 | 579 | } |
580 | 580 | |
581 | 581 | // Edit mode only allows editing the parent fields, not single inputs. |
582 | - if( $context === 'edit' && !empty( $details['parent'] ) ) { |
|
582 | + if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) { |
|
583 | 583 | continue; |
584 | 584 | } |
585 | 585 | |
586 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details ); |
|
586 | + $output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details ); |
|
587 | 587 | |
588 | 588 | } // End foreach |
589 | 589 | } |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | echo $output; |
592 | 592 | |
593 | 593 | // For the EDIT view we only want to allow the form fields. |
594 | - if( $context === 'edit' ) { |
|
594 | + if ( $context === 'edit' ) { |
|
595 | 595 | return; |
596 | 596 | } |
597 | 597 | |
@@ -615,16 +615,16 @@ discard block |
||
615 | 615 | $additional_fields = apply_filters( 'gravityview_additional_fields', array( |
616 | 616 | array( |
617 | 617 | 'label_text' => __( '+ Add All Fields', 'gravityview' ), |
618 | - 'desc' => __('Add all the available fields at once.', 'gravityview'), |
|
618 | + 'desc' => __( 'Add all the available fields at once.', 'gravityview' ), |
|
619 | 619 | 'field_id' => 'all-fields', |
620 | 620 | 'label_type' => 'field', |
621 | 621 | 'input_type' => NULL, |
622 | 622 | 'field_options' => NULL, |
623 | 623 | 'settings_html' => NULL, |
624 | 624 | ) |
625 | - )); |
|
625 | + ) ); |
|
626 | 626 | |
627 | - if( !empty( $additional_fields )) { |
|
627 | + if ( ! empty( $additional_fields ) ) { |
|
628 | 628 | foreach ( (array)$additional_fields as $item ) { |
629 | 629 | |
630 | 630 | // Prevent items from not having index set |
@@ -635,16 +635,16 @@ discard block |
||
635 | 635 | 'input_type' => NULL, |
636 | 636 | 'field_options' => NULL, |
637 | 637 | 'settings_html' => NULL, |
638 | - )); |
|
638 | + ) ); |
|
639 | 639 | |
640 | 640 | // Backward compat. |
641 | - if( !empty( $item['field_options'] ) ) { |
|
641 | + if ( ! empty( $item[ 'field_options' ] ) ) { |
|
642 | 642 | // Use settings_html from now on. |
643 | - $item['settings_html'] = $item['field_options']; |
|
643 | + $item[ 'settings_html' ] = $item[ 'field_options' ]; |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | // Render a label for each of them |
647 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item ); |
|
647 | + echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item ); |
|
648 | 648 | |
649 | 649 | } |
650 | 650 | } |
@@ -657,63 +657,63 @@ discard block |
||
657 | 657 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
658 | 658 | * @return array |
659 | 659 | */ |
660 | - function get_entry_default_fields($form, $zone) { |
|
660 | + function get_entry_default_fields( $form, $zone ) { |
|
661 | 661 | |
662 | 662 | $entry_default_fields = array(); |
663 | 663 | |
664 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
664 | + if ( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
665 | 665 | |
666 | 666 | $entry_default_fields = array( |
667 | 667 | 'id' => array( |
668 | - 'label' => __('Entry ID', 'gravityview'), |
|
668 | + 'label' => __( 'Entry ID', 'gravityview' ), |
|
669 | 669 | 'type' => 'id', |
670 | - 'desc' => __('The unique ID of the entry.', 'gravityview'), |
|
670 | + 'desc' => __( 'The unique ID of the entry.', 'gravityview' ), |
|
671 | 671 | ), |
672 | 672 | 'date_created' => array( |
673 | - 'label' => __('Entry Date', 'gravityview'), |
|
674 | - 'desc' => __('The date the entry was created.', 'gravityview'), |
|
673 | + 'label' => __( 'Entry Date', 'gravityview' ), |
|
674 | + 'desc' => __( 'The date the entry was created.', 'gravityview' ), |
|
675 | 675 | 'type' => 'date_created', |
676 | 676 | ), |
677 | 677 | 'source_url' => array( |
678 | - 'label' => __('Source URL', 'gravityview'), |
|
678 | + 'label' => __( 'Source URL', 'gravityview' ), |
|
679 | 679 | 'type' => 'source_url', |
680 | - 'desc' => __('The URL of the page where the form was submitted.', 'gravityview'), |
|
680 | + 'desc' => __( 'The URL of the page where the form was submitted.', 'gravityview' ), |
|
681 | 681 | ), |
682 | 682 | 'ip' => array( |
683 | - 'label' => __('User IP', 'gravityview'), |
|
683 | + 'label' => __( 'User IP', 'gravityview' ), |
|
684 | 684 | 'type' => 'ip', |
685 | - 'desc' => __('The IP Address of the user who created the entry.', 'gravityview'), |
|
685 | + 'desc' => __( 'The IP Address of the user who created the entry.', 'gravityview' ), |
|
686 | 686 | ), |
687 | 687 | 'created_by' => array( |
688 | - 'label' => __('User', 'gravityview'), |
|
688 | + 'label' => __( 'User', 'gravityview' ), |
|
689 | 689 | 'type' => 'created_by', |
690 | - 'desc' => __('Details of the logged-in user who created the entry (if any).', 'gravityview'), |
|
690 | + 'desc' => __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ), |
|
691 | 691 | ), |
692 | 692 | |
693 | 693 | /** |
694 | 694 | * @since 1.2 |
695 | 695 | */ |
696 | 696 | 'custom' => array( |
697 | - 'label' => __('Custom Content', 'gravityview'), |
|
697 | + 'label' => __( 'Custom Content', 'gravityview' ), |
|
698 | 698 | 'type' => 'custom', |
699 | - 'desc' => __('Insert custom text or HTML.', 'gravityview'), |
|
699 | + 'desc' => __( 'Insert custom text or HTML.', 'gravityview' ), |
|
700 | 700 | ), |
701 | 701 | |
702 | 702 | /** |
703 | 703 | * @since 1.7.2 |
704 | 704 | */ |
705 | 705 | 'other_entries' => array( |
706 | - 'label' => __('Other Entries', 'gravityview'), |
|
706 | + 'label' => __( 'Other Entries', 'gravityview' ), |
|
707 | 707 | 'type' => 'other_entries', |
708 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
708 | + 'desc' => __( 'Display other entries created by the entry creator.', 'gravityview' ), |
|
709 | 709 | ), |
710 | 710 | ); |
711 | 711 | |
712 | - if( 'single' !== $zone) { |
|
712 | + if ( 'single' !== $zone ) { |
|
713 | 713 | |
714 | - $entry_default_fields['entry_link'] = array( |
|
715 | - 'label' => __('Link to Entry', 'gravityview'), |
|
716 | - 'desc' => __('A dedicated link to the single entry with customizable text.', 'gravityview'), |
|
714 | + $entry_default_fields[ 'entry_link' ] = array( |
|
715 | + 'label' => __( 'Link to Entry', 'gravityview' ), |
|
716 | + 'desc' => __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ), |
|
717 | 717 | 'type' => 'entry_link', |
718 | 718 | ); |
719 | 719 | } |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | * @param string|array $form form_ID or form object |
728 | 728 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
729 | 729 | */ |
730 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
730 | + return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone ); |
|
731 | 731 | } |
732 | 732 | |
733 | 733 | /** |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | */ |
739 | 739 | function get_available_fields( $form = '', $zone = NULL ) { |
740 | 740 | |
741 | - if( empty( $form ) ) { |
|
741 | + if ( empty( $form ) ) { |
|
742 | 742 | do_action( 'gravityview_log_error', '[get_available_fields] $form is empty' ); |
743 | 743 | return array(); |
744 | 744 | } |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | $fields = gravityview_get_form_fields( $form, true ); |
748 | 748 | |
749 | 749 | // get meta fields ( only if form was already created ) |
750 | - if( !is_array( $form ) ) { |
|
750 | + if ( ! is_array( $form ) ) { |
|
751 | 751 | $meta_fields = gravityview_get_entry_meta( $form ); |
752 | 752 | } else { |
753 | 753 | $meta_fields = array(); |
@@ -771,11 +771,11 @@ discard block |
||
771 | 771 | |
772 | 772 | $widgets = $this->get_registered_widgets(); |
773 | 773 | |
774 | - if( !empty( $widgets ) ) { |
|
774 | + if ( ! empty( $widgets ) ) { |
|
775 | 775 | |
776 | - foreach( $widgets as $id => $details ) { |
|
776 | + foreach ( $widgets as $id => $details ) { |
|
777 | 777 | |
778 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
778 | + echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details ); |
|
779 | 779 | |
780 | 780 | } |
781 | 781 | } |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
810 | 810 | global $post; |
811 | 811 | |
812 | - if( $type === 'widget' ) { |
|
812 | + if ( $type === 'widget' ) { |
|
813 | 813 | $button_label = __( 'Add Widget', 'gravityview' ); |
814 | 814 | } else { |
815 | 815 | $button_label = __( 'Add Field', 'gravityview' ); |
@@ -818,15 +818,15 @@ discard block |
||
818 | 818 | $available_items = array(); |
819 | 819 | |
820 | 820 | // if saved values, get available fields to label everyone |
821 | - if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) { |
|
821 | + if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) { |
|
822 | 822 | |
823 | - if( !empty( $_POST['template_id'] ) ) { |
|
824 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
823 | + if ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
824 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
825 | 825 | } else { |
826 | 826 | $form = gravityview_get_form_id( $post->ID ); |
827 | 827 | } |
828 | 828 | |
829 | - if( 'field' === $type ) { |
|
829 | + if ( 'field' === $type ) { |
|
830 | 830 | $available_items = $this->get_available_fields( $form, $zone ); |
831 | 831 | } else { |
832 | 832 | $available_items = $this->get_registered_widgets(); |
@@ -834,39 +834,39 @@ discard block |
||
834 | 834 | |
835 | 835 | } |
836 | 836 | |
837 | - foreach( $rows as $row ) : |
|
838 | - foreach( $row as $col => $areas ) : |
|
839 | - $column = ($col == '2-2') ? '1-2' : $col; ?> |
|
837 | + foreach ( $rows as $row ) : |
|
838 | + foreach ( $row as $col => $areas ) : |
|
839 | + $column = ( $col == '2-2' ) ? '1-2' : $col; ?> |
|
840 | 840 | |
841 | 841 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
842 | 842 | |
843 | - <?php foreach( $areas as $area ) : ?> |
|
843 | + <?php foreach ( $areas as $area ) : ?> |
|
844 | 844 | |
845 | 845 | <div class="gv-droppable-area"> |
846 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"> |
|
846 | + <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"> |
|
847 | 847 | |
848 | 848 | <?php // render saved fields |
849 | 849 | |
850 | - if( !empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
850 | + if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
851 | 851 | |
852 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
852 | + foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) { |
|
853 | 853 | |
854 | 854 | $input_type = NULL; |
855 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
855 | + $original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false; |
|
856 | 856 | |
857 | - if( !$original_item ) { |
|
857 | + if ( ! $original_item ) { |
|
858 | 858 | |
859 | - do_action('gravityview_log_error', 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array('available_items' => $available_items, 'field' => $field )); |
|
859 | + do_action( 'gravityview_log_error', 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array( 'available_items' => $available_items, 'field' => $field ) ); |
|
860 | 860 | |
861 | 861 | $original_item = $field; |
862 | 862 | } else { |
863 | 863 | |
864 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL; |
|
864 | + $input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL; |
|
865 | 865 | |
866 | 866 | } |
867 | 867 | |
868 | 868 | // Field options dialog box |
869 | - $field_options = GravityView_Render_Settings::render_field_options( $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item ); |
|
869 | + $field_options = GravityView_Render_Settings::render_field_options( $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item ); |
|
870 | 870 | |
871 | 871 | $item = array( |
872 | 872 | 'input_type' => $input_type, |
@@ -875,16 +875,16 @@ discard block |
||
875 | 875 | ); |
876 | 876 | |
877 | 877 | // Merge the values with the current item to pass things like widget descriptions and original field names |
878 | - if( $original_item ) { |
|
878 | + if ( $original_item ) { |
|
879 | 879 | $item = wp_parse_args( $item, $original_item ); |
880 | 880 | } |
881 | 881 | |
882 | - switch( $type ) { |
|
882 | + switch ( $type ) { |
|
883 | 883 | case 'widget': |
884 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
884 | + echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
885 | 885 | break; |
886 | 886 | default: |
887 | - echo new GravityView_Admin_View_Field( $item['label'], $field['id'], $item, $field ); |
|
887 | + echo new GravityView_Admin_View_Field( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
888 | 888 | } |
889 | 889 | |
890 | 890 | |
@@ -894,11 +894,11 @@ discard block |
||
894 | 894 | |
895 | 895 | } // End if zone is not empty ?> |
896 | 896 | |
897 | - <span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type ); ?></span> |
|
897 | + <span class="drop-message"><?php echo sprintf( esc_attr__( '"+ %s" or drag existing %ss here.', 'gravityview' ), $button_label, $type ); ?></span> |
|
898 | 898 | </div> |
899 | 899 | <div class="gv-droppable-area-action"> |
900 | - <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"><?php echo '+ '.esc_html( $button_label ); ?></a> |
|
901 | - <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area['title'] ); ?></strong><?php if( !empty( $area['subtitle'] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area['subtitle'] ); ?></span><?php } ?></p> |
|
900 | + <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"><?php echo '+ ' . esc_html( $button_label ); ?></a> |
|
901 | + <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area[ 'title' ] ); ?></strong><?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area[ 'subtitle' ] ); ?></span><?php } ?></p> |
|
902 | 902 | </div> |
903 | 903 | </div> |
904 | 904 | |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | $default_widget_areas = GravityView_Plugin::get_default_widget_areas(); |
921 | 921 | |
922 | 922 | $widgets = array(); |
923 | - if( !empty( $post_id ) ) { |
|
923 | + if ( ! empty( $post_id ) ) { |
|
924 | 924 | $widgets = gravityview_get_directory_widgets( $post_id ); |
925 | 925 | } |
926 | 926 | |
@@ -950,7 +950,7 @@ discard block |
||
950 | 950 | */ |
951 | 951 | function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) { |
952 | 952 | |
953 | - if( empty( $template_id ) ) { |
|
953 | + if ( empty( $template_id ) ) { |
|
954 | 954 | do_action( 'gravityview_log_debug', '[render_directory_active_areas] $template_id is empty' ); |
955 | 955 | return ''; |
956 | 956 | } |
@@ -964,12 +964,12 @@ discard block |
||
964 | 964 | */ |
965 | 965 | $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
966 | 966 | |
967 | - if( empty( $template_areas ) ) { |
|
967 | + if ( empty( $template_areas ) ) { |
|
968 | 968 | |
969 | 969 | do_action( 'gravityview_log_debug', '[render_directory_active_areas] No areas defined. Maybe template %s is disabled.', $template_id ); |
970 | 970 | $output = '<div>'; |
971 | - $output .= '<h2 class="description" style="font-size: 16px; margin:0">'. sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>'.$template_id.'</em>' ) .'</h2>'; |
|
972 | - $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">'.esc_html__('The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview').'</p>'; |
|
971 | + $output .= '<h2 class="description" style="font-size: 16px; margin:0">' . sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>' . $template_id . '</em>' ) . '</h2>'; |
|
972 | + $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">' . esc_html__( 'The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview' ) . '</p>'; |
|
973 | 973 | $output .= '</div>'; |
974 | 974 | } else { |
975 | 975 | |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | |
985 | 985 | } |
986 | 986 | |
987 | - if( $echo ) { |
|
987 | + if ( $echo ) { |
|
988 | 988 | echo $output; |
989 | 989 | } |
990 | 990 | |
@@ -1004,27 +1004,27 @@ discard block |
||
1004 | 1004 | $is_widgets_page = ( $pagenow === 'widgets.php' ); |
1005 | 1005 | |
1006 | 1006 | // Add the GV font (with the Astronaut) |
1007 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
1007 | + wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
1008 | 1008 | |
1009 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
1009 | + wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
1010 | 1010 | |
1011 | 1011 | // Don't process any scripts below here if it's not a GravityView page. |
1012 | - if( !gravityview_is_admin_page($hook) && !$is_widgets_page ) { return; } |
|
1012 | + if ( ! gravityview_is_admin_page( $hook ) && ! $is_widgets_page ) { return; } |
|
1013 | 1013 | |
1014 | 1014 | // Only enqueue the following on single pages |
1015 | - if( gravityview_is_admin_page($hook, 'single') || $is_widgets_page ) { |
|
1015 | + if ( gravityview_is_admin_page( $hook, 'single' ) || $is_widgets_page ) { |
|
1016 | 1016 | |
1017 | 1017 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
1018 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version ); |
|
1018 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), GravityView_Plugin::version ); |
|
1019 | 1019 | |
1020 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
1020 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
1021 | 1021 | |
1022 | 1022 | //enqueue scripts |
1023 | 1023 | wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), GravityView_Plugin::version ); |
1024 | 1024 | |
1025 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
1025 | + wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
|
1026 | 1026 | 'cookiepath' => COOKIEPATH, |
1027 | - 'passed_form_id' => (bool) rgget( 'form_id' ), |
|
1027 | + 'passed_form_id' => (bool)rgget( 'form_id' ), |
|
1028 | 1028 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
1029 | 1029 | 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
1030 | 1030 | 'label_close' => __( 'Close', 'gravityview' ), |
@@ -1036,9 +1036,9 @@ discard block |
||
1036 | 1036 | 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
1037 | 1037 | 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
1038 | 1038 | 'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ), |
1039 | - )); |
|
1039 | + ) ); |
|
1040 | 1040 | |
1041 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
1041 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
1042 | 1042 | |
1043 | 1043 | self::enqueue_gravity_forms_scripts(); |
1044 | 1044 | |
@@ -1057,10 +1057,10 @@ discard block |
||
1057 | 1057 | ); |
1058 | 1058 | |
1059 | 1059 | if ( wp_is_mobile() ) { |
1060 | - $scripts[] = 'jquery-touch-punch'; |
|
1060 | + $scripts[ ] = 'jquery-touch-punch'; |
|
1061 | 1061 | } |
1062 | 1062 | |
1063 | - foreach ($scripts as $script) { |
|
1063 | + foreach ( $scripts as $script ) { |
|
1064 | 1064 | wp_enqueue_script( $script ); |
1065 | 1065 | } |
1066 | 1066 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | $entry = self::get_entry( $entry_slug, true ); |
126 | 126 | |
127 | - $form = self::get_form( $entry['form_id'] ); |
|
127 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
128 | 128 | |
129 | 129 | return $form; |
130 | 130 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | $results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging ); |
184 | 184 | |
185 | - $result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null; |
|
185 | + $result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null; |
|
186 | 186 | |
187 | 187 | return $result; |
188 | 188 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * |
198 | 198 | * @return array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms |
199 | 199 | */ |
200 | - public static function get_forms( $active = true, $trash = false ) { |
|
200 | + public static function get_forms( $active = true, $trash = false ) { |
|
201 | 201 | $forms = array(); |
202 | 202 | if ( class_exists( 'GFAPI' ) ) { |
203 | 203 | $forms = GFAPI::get_forms( $active, $trash ); |
@@ -225,9 +225,9 @@ discard block |
||
225 | 225 | $has_post_fields = false; |
226 | 226 | |
227 | 227 | if ( $form ) { |
228 | - foreach ( $form['fields'] as $field ) { |
|
229 | - if ( $include_parent_field || empty( $field['inputs'] ) ) { |
|
230 | - $fields["{$field['id']}"] = array( |
|
228 | + foreach ( $form[ 'fields' ] as $field ) { |
|
229 | + if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) { |
|
230 | + $fields[ "{$field[ 'id' ]}" ] = array( |
|
231 | 231 | 'label' => rgar( $field, 'label' ), |
232 | 232 | 'parent' => null, |
233 | 233 | 'type' => rgar( $field, 'type' ), |
@@ -236,10 +236,10 @@ discard block |
||
236 | 236 | ); |
237 | 237 | } |
238 | 238 | |
239 | - if ( $add_default_properties && ! empty( $field['inputs'] ) ) { |
|
240 | - foreach ( $field['inputs'] as $input ) { |
|
239 | + if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) { |
|
240 | + foreach ( $field[ 'inputs' ] as $input ) { |
|
241 | 241 | |
242 | - if( ! empty( $input['isHidden'] ) ) { |
|
242 | + if ( ! empty( $input[ 'isHidden' ] ) ) { |
|
243 | 243 | continue; |
244 | 244 | } |
245 | 245 | |
@@ -247,10 +247,10 @@ discard block |
||
247 | 247 | * @hack |
248 | 248 | * In case of email/email confirmation, the input for email has the same id as the parent field |
249 | 249 | */ |
250 | - if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) { |
|
250 | + if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) { |
|
251 | 251 | continue; |
252 | 252 | } |
253 | - $fields["{$input['id']}"] = array( |
|
253 | + $fields[ "{$input[ 'id' ]}" ] = array( |
|
254 | 254 | 'label' => rgar( $input, 'label' ), |
255 | 255 | 'customLabel' => rgar( $input, 'customLabel' ), |
256 | 256 | 'parent' => $field, |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | } |
263 | 263 | |
264 | 264 | |
265 | - if( GFCommon::is_product_field( $field['type'] ) ){ |
|
265 | + if ( GFCommon::is_product_field( $field[ 'type' ] ) ) { |
|
266 | 266 | $has_product_fields = true; |
267 | 267 | } |
268 | 268 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * @since 1.7 |
277 | 277 | */ |
278 | 278 | if ( $has_post_fields ) { |
279 | - $fields['post_id'] = array( |
|
279 | + $fields[ 'post_id' ] = array( |
|
280 | 280 | 'label' => __( 'Post ID', 'gravityview' ), |
281 | 281 | 'type' => 'post_id', |
282 | 282 | ); |
@@ -287,10 +287,10 @@ discard block |
||
287 | 287 | $payment_fields = GravityView_Fields::get_all( 'pricing' ); |
288 | 288 | |
289 | 289 | foreach ( $payment_fields as $payment_field ) { |
290 | - if( isset( $fields["{$payment_field->name}"] ) ) { |
|
290 | + if ( isset( $fields[ "{$payment_field->name}" ] ) ) { |
|
291 | 291 | continue; |
292 | 292 | } |
293 | - $fields["{$payment_field->name}"] = array( |
|
293 | + $fields[ "{$payment_field->name}" ] = array( |
|
294 | 294 | 'label' => $payment_field->label, |
295 | 295 | 'desc' => $payment_field->description, |
296 | 296 | 'type' => $payment_field->name, |
@@ -322,9 +322,9 @@ discard block |
||
322 | 322 | |
323 | 323 | $fields = array(); |
324 | 324 | |
325 | - foreach ( $extra_fields as $key => $field ){ |
|
326 | - if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
|
327 | - $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
|
325 | + foreach ( $extra_fields as $key => $field ) { |
|
326 | + if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) { |
|
327 | + $fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' ); |
|
328 | 328 | } |
329 | 329 | } |
330 | 330 | |
@@ -364,32 +364,32 @@ discard block |
||
364 | 364 | 'search_criteria' => null, |
365 | 365 | 'sorting' => null, |
366 | 366 | 'paging' => null, |
367 | - 'cache' => (isset( $passed_criteria['cache'] ) ? $passed_criteria['cache'] : true), |
|
367 | + 'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? $passed_criteria[ 'cache' ] : true ), |
|
368 | 368 | ); |
369 | 369 | |
370 | 370 | $criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults ); |
371 | 371 | |
372 | - if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) { |
|
373 | - foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) { |
|
372 | + if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
373 | + foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) { |
|
374 | 374 | |
375 | 375 | if ( ! is_array( $filter ) ) { |
376 | 376 | continue; |
377 | 377 | } |
378 | 378 | |
379 | 379 | // By default, we want searches to be wildcard for each field. |
380 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
380 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
381 | 381 | |
382 | 382 | /** |
383 | 383 | * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc) |
384 | 384 | * @param string $operator Existing search operator |
385 | 385 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
386 | 386 | */ |
387 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
387 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | // don't send just the [mode] without any field filter. |
391 | - if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) { |
|
392 | - unset( $criteria['search_criteria']['field_filters']['mode'] ); |
|
391 | + if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
392 | + unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] ); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | } |
@@ -400,21 +400,21 @@ discard block |
||
400 | 400 | * Prepare date formats to be in Gravity Forms DB format; |
401 | 401 | * $passed_criteria may include date formats incompatible with Gravity Forms. |
402 | 402 | */ |
403 | - foreach ( array('start_date', 'end_date' ) as $key ) { |
|
403 | + foreach ( array( 'start_date', 'end_date' ) as $key ) { |
|
404 | 404 | |
405 | - if ( ! empty( $criteria['search_criteria'][ $key ] ) ) { |
|
405 | + if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) { |
|
406 | 406 | |
407 | 407 | // Use date_create instead of new DateTime so it returns false if invalid date format. |
408 | - $date = date_create( $criteria['search_criteria'][ $key ] ); |
|
408 | + $date = date_create( $criteria[ 'search_criteria' ][ $key ] ); |
|
409 | 409 | |
410 | 410 | if ( $date ) { |
411 | 411 | // Gravity Forms wants dates in the `Y-m-d H:i:s` format. |
412 | - $criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
412 | + $criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
413 | 413 | } else { |
414 | 414 | // If it's an invalid date, unset it. Gravity Forms freaks out otherwise. |
415 | - unset( $criteria['search_criteria'][ $key ] ); |
|
415 | + unset( $criteria[ 'search_criteria' ][ $key ] ); |
|
416 | 416 | |
417 | - do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] ); |
|
417 | + do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] ); |
|
418 | 418 | } |
419 | 419 | } |
420 | 420 | } |
@@ -422,12 +422,12 @@ discard block |
||
422 | 422 | |
423 | 423 | // When multiple views are embedded, OR single entry, calculate the context view id and send it to the advanced filter |
424 | 424 | if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry() ) { |
425 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
425 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
426 | 426 | } elseif ( 'delete' === RGForms::get( 'action' ) ) { |
427 | - $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null; |
|
428 | - } elseif( !isset( $criteria['context_view_id'] ) ) { |
|
427 | + $criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null; |
|
428 | + } elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) { |
|
429 | 429 | // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
430 | - $criteria['context_view_id'] = null; |
|
430 | + $criteria[ 'context_view_id' ] = null; |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | /** |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | * @param array $form_ids Forms to search |
437 | 437 | * @param int $view_id ID of the view being used to search |
438 | 438 | */ |
439 | - $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] ); |
|
439 | + $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] ); |
|
440 | 440 | |
441 | 441 | return (array)$criteria; |
442 | 442 | |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | /** Reduce # of database calls */ |
468 | 468 | add_filter( 'gform_is_encrypted_field', '__return_false' ); |
469 | 469 | |
470 | - if ( ! empty( $criteria['cache'] ) ) { |
|
470 | + if ( ! empty( $criteria[ 'cache' ] ) ) { |
|
471 | 471 | |
472 | 472 | $Cache = new GravityView_Cache( $form_ids, $criteria ); |
473 | 473 | |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | |
476 | 476 | // Still update the total count when using cached results |
477 | 477 | if ( ! is_null( $total ) ) { |
478 | - $total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] ); |
|
478 | + $total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] ); |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | $return = $entries; |
@@ -495,9 +495,9 @@ discard block |
||
495 | 495 | $entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total ); |
496 | 496 | |
497 | 497 | // No entries returned from gravityview_before_get_entries |
498 | - if( is_null( $entries ) ) { |
|
498 | + if ( is_null( $entries ) ) { |
|
499 | 499 | |
500 | - $entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total ); |
|
500 | + $entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total ); |
|
501 | 501 | |
502 | 502 | if ( is_wp_error( $entries ) ) { |
503 | 503 | do_action( 'gravityview_log_error', $entries->get_error_message(), $entries ); |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | } |
507 | 507 | } |
508 | 508 | |
509 | - if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) { |
|
509 | + if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) { |
|
510 | 510 | |
511 | 511 | // Cache results |
512 | 512 | $Cache->set( $entries, 'entries' ); |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | */ |
594 | 594 | $check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry ); |
595 | 595 | |
596 | - if( $check_entry_display ) { |
|
596 | + if ( $check_entry_display ) { |
|
597 | 597 | // Is the entry allowed |
598 | 598 | $entry = self::check_entry_display( $entry ); |
599 | 599 | } |
@@ -626,12 +626,12 @@ discard block |
||
626 | 626 | |
627 | 627 | $value = false; |
628 | 628 | |
629 | - if( 'context' === $val1 ) { |
|
629 | + if ( 'context' === $val1 ) { |
|
630 | 630 | |
631 | 631 | $matching_contexts = array( $val2 ); |
632 | 632 | |
633 | 633 | // We allow for non-standard contexts. |
634 | - switch( $val2 ) { |
|
634 | + switch ( $val2 ) { |
|
635 | 635 | // Check for either single or edit |
636 | 636 | case 'singular': |
637 | 637 | $matching_contexts = array( 'single', 'edit' ); |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | return false; |
692 | 692 | } |
693 | 693 | |
694 | - if ( empty( $entry['form_id'] ) ) { |
|
694 | + if ( empty( $entry[ 'form_id' ] ) ) { |
|
695 | 695 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry ); |
696 | 696 | return false; |
697 | 697 | } |
@@ -699,26 +699,26 @@ discard block |
||
699 | 699 | $criteria = self::calculate_get_entries_criteria(); |
700 | 700 | |
701 | 701 | // Make sure the current View is connected to the same form as the Entry |
702 | - if( ! empty( $criteria['context_view_id'] ) ) { |
|
703 | - $context_view_id = intval( $criteria['context_view_id'] ); |
|
702 | + if ( ! empty( $criteria[ 'context_view_id' ] ) ) { |
|
703 | + $context_view_id = intval( $criteria[ 'context_view_id' ] ); |
|
704 | 704 | $context_form_id = gravityview_get_form_id( $context_view_id ); |
705 | - if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) { |
|
706 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] ); |
|
705 | + if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) { |
|
706 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] ); |
|
707 | 707 | return false; |
708 | 708 | } |
709 | 709 | } |
710 | 710 | |
711 | - if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) { |
|
711 | + if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) { |
|
712 | 712 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria ); |
713 | 713 | return $entry; |
714 | 714 | } |
715 | 715 | |
716 | - $search_criteria = $criteria['search_criteria']; |
|
716 | + $search_criteria = $criteria[ 'search_criteria' ]; |
|
717 | 717 | unset( $criteria ); |
718 | 718 | |
719 | 719 | // check entry status |
720 | - if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) { |
|
721 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria ); |
|
720 | + if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) { |
|
721 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria ); |
|
722 | 722 | return false; |
723 | 723 | } |
724 | 724 | |
@@ -726,37 +726,37 @@ discard block |
||
726 | 726 | // @todo: Does it make sense to apply the Date create filters to the single entry? |
727 | 727 | |
728 | 728 | // field_filters |
729 | - if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) { |
|
729 | + if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) { |
|
730 | 730 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria ); |
731 | 731 | return $entry; |
732 | 732 | } |
733 | 733 | |
734 | - $filters = $search_criteria['field_filters']; |
|
734 | + $filters = $search_criteria[ 'field_filters' ]; |
|
735 | 735 | unset( $search_criteria ); |
736 | 736 | |
737 | - $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all'; |
|
738 | - unset( $filters['mode'] ); |
|
737 | + $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all'; |
|
738 | + unset( $filters[ 'mode' ] ); |
|
739 | 739 | |
740 | - $form = self::get_form( $entry['form_id'] ); |
|
740 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
741 | 741 | |
742 | 742 | foreach ( $filters as $filter ) { |
743 | 743 | |
744 | - if ( ! isset( $filter['key'] ) ) { |
|
744 | + if ( ! isset( $filter[ 'key' ] ) ) { |
|
745 | 745 | continue; |
746 | 746 | } |
747 | 747 | |
748 | - $k = $filter['key']; |
|
748 | + $k = $filter[ 'key' ]; |
|
749 | 749 | |
750 | 750 | if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) { |
751 | 751 | $field_value = $entry[ $k ]; |
752 | 752 | $field = null; |
753 | 753 | } else { |
754 | 754 | $field = self::get_field( $form, $k ); |
755 | - $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
755 | + $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
756 | 756 | } |
757 | 757 | |
758 | - $operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is'; |
|
759 | - $is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field ); |
|
758 | + $operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is'; |
|
759 | + $is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field ); |
|
760 | 760 | |
761 | 761 | // verify if we are already free to go! |
762 | 762 | if ( ! $is_value_match && 'all' === $mode ) { |
@@ -814,18 +814,18 @@ discard block |
||
814 | 814 | * Gravity Forms code to adjust date to locally-configured Time Zone |
815 | 815 | * @see GFCommon::format_date() for original code |
816 | 816 | */ |
817 | - $date_gmt_time = mysql2date( 'G', $date_string ); |
|
817 | + $date_gmt_time = mysql2date( 'G', $date_string ); |
|
818 | 818 | $date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time ); |
819 | 819 | |
820 | - $format = rgar( $atts, 'format' ); |
|
821 | - $is_human = ! empty( $atts['human'] ); |
|
822 | - $is_diff = ! empty( $atts['diff'] ); |
|
823 | - $is_raw = ! empty( $atts['raw'] ); |
|
824 | - $is_timestamp = ! empty( $atts['timestamp'] ); |
|
825 | - $include_time = ! empty( $atts['time'] ); |
|
820 | + $format = rgar( $atts, 'format' ); |
|
821 | + $is_human = ! empty( $atts[ 'human' ] ); |
|
822 | + $is_diff = ! empty( $atts[ 'diff' ] ); |
|
823 | + $is_raw = ! empty( $atts[ 'raw' ] ); |
|
824 | + $is_timestamp = ! empty( $atts[ 'timestamp' ] ); |
|
825 | + $include_time = ! empty( $atts[ 'time' ] ); |
|
826 | 826 | |
827 | 827 | // If we're using time diff, we want to have a different default format |
828 | - if( empty( $format ) ) { |
|
828 | + if ( empty( $format ) ) { |
|
829 | 829 | /* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */ |
830 | 830 | $format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' ); |
831 | 831 | } |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | // If raw was specified, don't modify the stored value |
834 | 834 | if ( $is_raw ) { |
835 | 835 | $formatted_date = $date_string; |
836 | - } elseif( $is_timestamp ) { |
|
836 | + } elseif ( $is_timestamp ) { |
|
837 | 837 | $formatted_date = $date_local_timestamp; |
838 | 838 | } elseif ( $is_diff ) { |
839 | 839 | $formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) ); |
@@ -867,7 +867,7 @@ discard block |
||
867 | 867 | |
868 | 868 | $label = rgar( $field, 'label' ); |
869 | 869 | |
870 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
870 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
871 | 871 | $label = GFFormsModel::get_choice_text( $field, $field_value, $field_id ); |
872 | 872 | } |
873 | 873 | |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | * @return GF_Field|null Gravity Forms field object, or NULL: Gravity Forms GFFormsModel does not exist or field at $field_id doesn't exist. |
889 | 889 | */ |
890 | 890 | public static function get_field( $form, $field_id ) { |
891 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
891 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
892 | 892 | return GFFormsModel::get_field( $form, $field_id ); |
893 | 893 | } else { |
894 | 894 | return null; |
@@ -935,19 +935,19 @@ discard block |
||
935 | 935 | $shortcodes = array(); |
936 | 936 | |
937 | 937 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
938 | - if ( empty( $matches ) ){ |
|
938 | + if ( empty( $matches ) ) { |
|
939 | 939 | return false; |
940 | 940 | } |
941 | 941 | |
942 | 942 | foreach ( $matches as $shortcode ) { |
943 | - if ( $tag === $shortcode[2] ) { |
|
943 | + if ( $tag === $shortcode[ 2 ] ) { |
|
944 | 944 | |
945 | 945 | // Changed this to $shortcode instead of true so we get the parsed atts. |
946 | - $shortcodes[] = $shortcode; |
|
946 | + $shortcodes[ ] = $shortcode; |
|
947 | 947 | |
948 | - } else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) { |
|
949 | - foreach( $results as $result ) { |
|
950 | - $shortcodes[] = $result; |
|
948 | + } else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) { |
|
949 | + foreach ( $results as $result ) { |
|
950 | + $shortcodes[ ] = $result; |
|
951 | 951 | } |
952 | 952 | } |
953 | 953 | } |
@@ -1091,7 +1091,7 @@ discard block |
||
1091 | 1091 | public static function get_directory_fields( $post_id, $apply_filter = true ) { |
1092 | 1092 | $fields = get_post_meta( $post_id, '_gravityview_directory_fields', true ); |
1093 | 1093 | |
1094 | - if( $apply_filter ) { |
|
1094 | + if ( $apply_filter ) { |
|
1095 | 1095 | /** |
1096 | 1096 | * @filter `gravityview/configuration/fields` Filter the View fields' configuration array |
1097 | 1097 | * @since 1.6.5 |
@@ -1114,7 +1114,7 @@ discard block |
||
1114 | 1114 | * @return string html |
1115 | 1115 | */ |
1116 | 1116 | public static function get_sortable_fields( $formid, $current = '' ) { |
1117 | - $output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>'; |
|
1117 | + $output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>'; |
|
1118 | 1118 | |
1119 | 1119 | if ( empty( $formid ) ) { |
1120 | 1120 | return $output; |
@@ -1127,11 +1127,11 @@ discard block |
||
1127 | 1127 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null ); |
1128 | 1128 | |
1129 | 1129 | foreach ( $fields as $id => $field ) { |
1130 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1130 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
1131 | 1131 | continue; |
1132 | 1132 | } |
1133 | 1133 | |
1134 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>'; |
|
1134 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>'; |
|
1135 | 1135 | } |
1136 | 1136 | } |
1137 | 1137 | |
@@ -1166,9 +1166,9 @@ discard block |
||
1166 | 1166 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
1167 | 1167 | |
1168 | 1168 | // TODO: Convert to using array_filter |
1169 | - foreach( $fields as $id => $field ) { |
|
1169 | + foreach ( $fields as $id => $field ) { |
|
1170 | 1170 | |
1171 | - if( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1171 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
1172 | 1172 | unset( $fields[ $id ] ); |
1173 | 1173 | } |
1174 | 1174 | } |
@@ -1209,14 +1209,14 @@ discard block |
||
1209 | 1209 | * @param int|array $field field key or field array |
1210 | 1210 | * @return boolean |
1211 | 1211 | */ |
1212 | - public static function is_field_numeric( $form = null, $field = '' ) { |
|
1212 | + public static function is_field_numeric( $form = null, $field = '' ) { |
|
1213 | 1213 | |
1214 | 1214 | if ( ! is_array( $form ) && ! is_array( $field ) ) { |
1215 | 1215 | $form = self::get_form( $form ); |
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | // If entry meta, it's a string. Otherwise, numeric |
1219 | - if( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1219 | + if ( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1220 | 1220 | $type = $field; |
1221 | 1221 | } else { |
1222 | 1222 | $type = self::get_field_type( $form, $field ); |
@@ -1230,9 +1230,9 @@ discard block |
||
1230 | 1230 | $numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) ); |
1231 | 1231 | |
1232 | 1232 | // Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true |
1233 | - if( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1234 | - if( true === $gv_field->is_numeric ) { |
|
1235 | - $numeric_types[] = $gv_field->is_numeric; |
|
1233 | + if ( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1234 | + if ( true === $gv_field->is_numeric ) { |
|
1235 | + $numeric_types[ ] = $gv_field->is_numeric; |
|
1236 | 1236 | } |
1237 | 1237 | } |
1238 | 1238 | |
@@ -1382,18 +1382,18 @@ discard block |
||
1382 | 1382 | $final_atts = array_filter( $final_atts ); |
1383 | 1383 | |
1384 | 1384 | // If the href wasn't passed as an attribute, use the value passed to the function |
1385 | - if ( empty( $final_atts['href'] ) && ! empty( $href ) ) { |
|
1386 | - $final_atts['href'] = $href; |
|
1385 | + if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) { |
|
1386 | + $final_atts[ 'href' ] = $href; |
|
1387 | 1387 | } |
1388 | 1388 | |
1389 | - $final_atts['href'] = esc_url_raw( $href ); |
|
1389 | + $final_atts[ 'href' ] = esc_url_raw( $href ); |
|
1390 | 1390 | |
1391 | 1391 | /** |
1392 | 1392 | * Fix potential security issue with target=_blank |
1393 | 1393 | * @see https://dev.to/ben/the-targetblank-vulnerability-by-example |
1394 | 1394 | */ |
1395 | - if( '_blank' === rgar( $final_atts, 'target' ) ) { |
|
1396 | - $final_atts['rel'] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' ); |
|
1395 | + if ( '_blank' === rgar( $final_atts, 'target' ) ) { |
|
1396 | + $final_atts[ 'rel' ] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' ); |
|
1397 | 1397 | } |
1398 | 1398 | |
1399 | 1399 | // Sort the attributes alphabetically, to help testing |
@@ -1405,7 +1405,7 @@ discard block |
||
1405 | 1405 | $output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) ); |
1406 | 1406 | } |
1407 | 1407 | |
1408 | - if( '' !== $output ) { |
|
1408 | + if ( '' !== $output ) { |
|
1409 | 1409 | $output = '<a' . $output . '>' . $anchor_text . '</a>'; |
1410 | 1410 | } |
1411 | 1411 | |
@@ -1432,7 +1432,7 @@ discard block |
||
1432 | 1432 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
1433 | 1433 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
1434 | 1434 | } else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) { |
1435 | - $merged[] = $value; |
|
1435 | + $merged[ ] = $value; |
|
1436 | 1436 | } else { |
1437 | 1437 | $merged[ $key ] = $value; |
1438 | 1438 | } |
@@ -1465,7 +1465,7 @@ discard block |
||
1465 | 1465 | * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..) |
1466 | 1466 | * @param array $settings Settings array, with `number` key defining the # of users to display |
1467 | 1467 | */ |
1468 | - $get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1468 | + $get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1469 | 1469 | |
1470 | 1470 | return get_users( $get_users_settings ); |
1471 | 1471 | } |
@@ -1480,7 +1480,7 @@ discard block |
||
1480 | 1480 | * @return string |
1481 | 1481 | */ |
1482 | 1482 | public static function generate_notice( $notice, $class = '' ) { |
1483 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1483 | + return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>'; |
|
1484 | 1484 | } |
1485 | 1485 | |
1486 | 1486 | /** |
@@ -4,10 +4,10 @@ discard block |
||
4 | 4 | |
5 | 5 | function __construct() { |
6 | 6 | |
7 | - if( ! is_admin() ) { return; } |
|
7 | + if ( ! is_admin() ) { return; } |
|
8 | 8 | |
9 | 9 | // If Gravity Forms isn't active or compatibile, stop loading |
10 | - if( false === GravityView_Compatibility::is_valid() ) { |
|
10 | + if ( false === GravityView_Compatibility::is_valid() ) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-migrate.php' ); |
26 | 26 | |
27 | 27 | // Don't load tooltips if on Gravity Forms, otherwise it overrides translations |
28 | - if( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && !GFForms::is_gravity_page() ) { |
|
28 | + if ( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && ! GFForms::is_gravity_page() ) { |
|
29 | 29 | require_once( GFCommon::get_base_path() . '/tooltips.php' ); |
30 | 30 | } |
31 | 31 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) ); |
54 | 54 | add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) ); |
55 | 55 | |
56 | - add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) ); |
|
56 | + add_filter( 'plugin_action_links_' . plugin_basename( GRAVITYVIEW_FILE ), array( $this, 'plugin_action_links' ) ); |
|
57 | 57 | |
58 | 58 | add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 ); |
59 | 59 | |
@@ -68,22 +68,22 @@ discard block |
||
68 | 68 | public function backend_actions() { |
69 | 69 | |
70 | 70 | /** @define "GRAVITYVIEW_DIR" "../" */ |
71 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' ); |
|
72 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' ); |
|
73 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-item.php' ); |
|
74 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-field.php' ); |
|
75 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
76 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' ); |
|
77 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' ); |
|
78 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' ); |
|
79 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
71 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' ); |
|
72 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' ); |
|
73 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-item.php' ); |
|
74 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-field.php' ); |
|
75 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
76 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' ); |
|
77 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' ); |
|
78 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' ); |
|
79 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded |
83 | 83 | * |
84 | 84 | * Nice place to insert extensions' backend stuff |
85 | 85 | */ |
86 | - do_action('gravityview_include_backend_actions'); |
|
86 | + do_action( 'gravityview_include_backend_actions' ); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -99,12 +99,12 @@ discard block |
||
99 | 99 | |
100 | 100 | $actions = array(); |
101 | 101 | |
102 | - if( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
103 | - $actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
102 | + if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
103 | + $actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
104 | 104 | } |
105 | 105 | |
106 | - if( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
107 | - $actions[] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
106 | + if ( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
107 | + $actions[ ] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | return array_merge( $actions, $links ); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | // By default, there will only be one item being modified. |
133 | 133 | // When in the `bulk_post_updated_messages` filter, there will be passed a number |
134 | 134 | // of modified items that will override this array. |
135 | - $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
135 | + $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
136 | 136 | |
137 | 137 | // If we're starting fresh, a new form was created. |
138 | 138 | // We should let the user know this is the case. |
@@ -140,60 +140,60 @@ discard block |
||
140 | 140 | |
141 | 141 | $new_form_text = ''; |
142 | 142 | |
143 | - if( !empty( $start_fresh ) ) { |
|
143 | + if ( ! empty( $start_fresh ) ) { |
|
144 | 144 | |
145 | 145 | // Get the form that was created |
146 | 146 | $connected_form = gravityview_get_form_id( $post_id ); |
147 | 147 | |
148 | - if( !empty( $connected_form ) ) { |
|
148 | + if ( ! empty( $connected_form ) ) { |
|
149 | 149 | $form = gravityview_get_form( $connected_form ); |
150 | - $form_name = esc_attr( $form['title'] ); |
|
150 | + $form_name = esc_attr( $form[ 'title' ] ); |
|
151 | 151 | $image = self::get_floaty(); |
152 | - $new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>'; |
|
153 | - $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
152 | + $new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>'; |
|
153 | + $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
154 | 154 | |
155 | 155 | You can %sedit the form%s in Gravity Forms and the updated fields will be available here. Don’t forget to %scustomize the form settings%s. |
156 | - ', 'gravityview' ), '<strong>', '</strong>', '<a href="'.site_url( '?gf_page=preview&id='.$connected_form ).'">', '</a>', '<code>[gravityform id="'.$connected_form.'" name="'.$form_name.'"]</code>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&id='.$connected_form ).'">', '</a>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&view=settings&id='.$connected_form ).'">', '</a>'); |
|
156 | + ', 'gravityview' ), '<strong>', '</strong>', '<a href="' . site_url( '?gf_page=preview&id=' . $connected_form ) . '">', '</a>', '<code>[gravityform id="' . $connected_form . '" name="' . $form_name . '"]</code>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&id=' . $connected_form ) . '">', '</a>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&view=settings&id=' . $connected_form ) . '">', '</a>' ); |
|
157 | 157 | $new_form_text = wpautop( $new_form_text ); |
158 | 158 | |
159 | 159 | delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
163 | - $messages['gravityview'] = array( |
|
163 | + $messages[ 'gravityview' ] = array( |
|
164 | 164 | 0 => '', // Unused. Messages start at index 1. |
165 | 165 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
166 | - 1 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
166 | + 1 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
167 | 167 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
168 | - 2 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
168 | + 2 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
169 | 169 | 3 => __( 'View deleted.', 'gravityview' ), |
170 | 170 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
171 | - 4 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
171 | + 4 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
172 | 172 | /* translators: %s: date and time of the revision */ |
173 | - 5 => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
173 | + 5 => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false, |
|
174 | 174 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
175 | - 6 => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
175 | + 6 => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
176 | 176 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
177 | - 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
177 | + 7 => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
178 | 178 | 8 => __( 'View submitted.', 'gravityview' ), |
179 | 179 | 9 => sprintf( |
180 | 180 | /* translators: Date and time the View is scheduled to be published */ |
181 | 181 | __( 'View scheduled for: %1$s.', 'gravityview' ), |
182 | 182 | // translators: Publish box date format, see http://php.net/date |
183 | - date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
183 | + date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
184 | 184 | ) . $new_form_text, |
185 | 185 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
186 | - 10 => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
186 | + 10 => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
187 | 187 | |
188 | 188 | /** |
189 | 189 | * These apply to `bulk_post_updated_messages` |
190 | 190 | * @file wp-admin/edit.php |
191 | 191 | */ |
192 | - 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ), |
|
193 | - 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ), |
|
194 | - 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ), |
|
195 | - 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ), |
|
196 | - 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ), |
|
192 | + 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ), |
|
193 | + 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ), |
|
194 | + 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ), |
|
195 | + 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ), |
|
196 | + 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ), |
|
197 | 197 | ); |
198 | 198 | |
199 | 199 | return $messages; |
@@ -253,29 +253,29 @@ discard block |
||
253 | 253 | static function is_admin_page( $hook = '', $page = NULL ) { |
254 | 254 | global $current_screen, $plugin_page, $pagenow, $post; |
255 | 255 | |
256 | - if( ! is_admin() ) { return false; } |
|
256 | + if ( ! is_admin() ) { return false; } |
|
257 | 257 | |
258 | 258 | $is_page = false; |
259 | 259 | |
260 | - $is_gv_screen = (!empty($current_screen) && isset($current_screen->post_type) && $current_screen->post_type === 'gravityview'); |
|
260 | + $is_gv_screen = ( ! empty( $current_screen ) && isset( $current_screen->post_type ) && $current_screen->post_type === 'gravityview' ); |
|
261 | 261 | |
262 | - $is_gv_post_type_get = (isset($_GET['post_type']) && $_GET['post_type'] === 'gravityview'); |
|
262 | + $is_gv_post_type_get = ( isset( $_GET[ 'post_type' ] ) && $_GET[ 'post_type' ] === 'gravityview' ); |
|
263 | 263 | |
264 | - $is_gv_settings_get = isset( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings'; |
|
264 | + $is_gv_settings_get = isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings'; |
|
265 | 265 | |
266 | - if( empty( $post ) && $pagenow === 'post.php' && !empty( $_GET['post'] ) ) { |
|
267 | - $gv_post = get_post( intval( $_GET['post'] ) ); |
|
268 | - $is_gv_post_type = (!empty($gv_post) && !empty($gv_post->post_type) && $gv_post->post_type === 'gravityview'); |
|
266 | + if ( empty( $post ) && $pagenow === 'post.php' && ! empty( $_GET[ 'post' ] ) ) { |
|
267 | + $gv_post = get_post( intval( $_GET[ 'post' ] ) ); |
|
268 | + $is_gv_post_type = ( ! empty( $gv_post ) && ! empty( $gv_post->post_type ) && $gv_post->post_type === 'gravityview' ); |
|
269 | 269 | } else { |
270 | - $is_gv_post_type = (!empty($post) && !empty($post->post_type) && $post->post_type === 'gravityview'); |
|
270 | + $is_gv_post_type = ( ! empty( $post ) && ! empty( $post->post_type ) && $post->post_type === 'gravityview' ); |
|
271 | 271 | } |
272 | 272 | |
273 | - if( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
273 | + if ( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
274 | 274 | |
275 | 275 | // $_GET `post_type` variable |
276 | - if(in_array($pagenow, array( 'post.php' , 'post-new.php' )) ) { |
|
276 | + if ( in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) { |
|
277 | 277 | $is_page = 'single'; |
278 | - } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( !empty( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings' ) ) { |
|
278 | + } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( ! empty( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings' ) ) { |
|
279 | 279 | $is_page = 'settings'; |
280 | 280 | } else { |
281 | 281 | $is_page = 'views'; |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $hook ); |
291 | 291 | |
292 | 292 | // If the current page is the same as the compared page |
293 | - if( !empty( $page ) ) { |
|
293 | + if ( ! empty( $page ) ) { |
|
294 | 294 | return $is_page === $page; |
295 | 295 | } |
296 | 296 | |
@@ -311,6 +311,6 @@ discard block |
||
311 | 311 | * |
312 | 312 | * @return bool|string|void If `false`, not a GravityView page. `true` if $page is passed and is the same as current page. Otherwise, the name of the page (`single`, `settings`, or `views`) |
313 | 313 | */ |
314 | -function gravityview_is_admin_page($hook = '', $page = NULL) { |
|
314 | +function gravityview_is_admin_page( $hook = '', $page = NULL ) { |
|
315 | 315 | return GravityView_Admin::is_admin_page( $hook, $page ); |
316 | 316 | } |
@@ -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 ); |
@@ -234,15 +234,15 @@ discard block |
||
234 | 234 | |
235 | 235 | $this->context_view_id = $view_id; |
236 | 236 | |
237 | - } elseif ( isset( $_GET['gvid'] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
237 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
238 | 238 | /** |
239 | 239 | * used on a has_multiple_views context |
240 | 240 | * @see GravityView_API::entry_link |
241 | 241 | * @see GravityView_View_Data::getInstance()->has_multiple_views() |
242 | 242 | */ |
243 | - $this->context_view_id = $_GET['gvid']; |
|
243 | + $this->context_view_id = $_GET[ 'gvid' ]; |
|
244 | 244 | |
245 | - } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
245 | + } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
246 | 246 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
247 | 247 | $this->context_view_id = array_pop( $array_keys ); |
248 | 248 | unset( $array_keys ); |
@@ -277,24 +277,24 @@ discard block |
||
277 | 277 | global $wp_rewrite; |
278 | 278 | |
279 | 279 | $is_front_page = ( $query->is_home || $query->is_page ); |
280 | - $show_on_front = ( 'page' === get_option('show_on_front') ); |
|
281 | - $front_page_id = get_option('page_on_front'); |
|
280 | + $show_on_front = ( 'page' === get_option( 'show_on_front' ) ); |
|
281 | + $front_page_id = get_option( 'page_on_front' ); |
|
282 | 282 | |
283 | - if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
283 | + if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
284 | 284 | |
285 | 285 | // Force to be an array, potentially a query string ( entry=16 ) |
286 | 286 | $_query = wp_parse_args( $query->query ); |
287 | 287 | |
288 | 288 | // pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename. |
289 | - if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) { |
|
290 | - unset( $_query['pagename'] ); |
|
289 | + if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) { |
|
290 | + unset( $_query[ 'pagename' ] ); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | // this is where will break from core wordpress |
294 | 294 | $ignore = array( 'preview', 'page', 'paged', 'cpage' ); |
295 | 295 | $endpoints = rgobj( $wp_rewrite, 'endpoints' ); |
296 | - foreach ( (array) $endpoints as $endpoint ) { |
|
297 | - $ignore[] = $endpoint[1]; |
|
296 | + foreach ( (array)$endpoints as $endpoint ) { |
|
297 | + $ignore[ ] = $endpoint[ 1 ]; |
|
298 | 298 | } |
299 | 299 | unset( $endpoints ); |
300 | 300 | |
@@ -304,21 +304,21 @@ discard block |
||
304 | 304 | // - The query includes keys that are associated with registered endpoints. `entry`, for example. |
305 | 305 | if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) { |
306 | 306 | |
307 | - $qv =& $query->query_vars; |
|
307 | + $qv = & $query->query_vars; |
|
308 | 308 | |
309 | 309 | // Prevent redirect when on the single entry endpoint |
310 | - if( self::is_single_entry() ) { |
|
310 | + if ( self::is_single_entry() ) { |
|
311 | 311 | add_filter( 'redirect_canonical', '__return_false' ); |
312 | 312 | } |
313 | 313 | |
314 | 314 | $query->is_page = true; |
315 | 315 | $query->is_home = false; |
316 | - $qv['page_id'] = $front_page_id; |
|
316 | + $qv[ 'page_id' ] = $front_page_id; |
|
317 | 317 | |
318 | 318 | // Correct <!--nextpage--> for page_on_front |
319 | - if ( ! empty( $qv['paged'] ) ) { |
|
320 | - $qv['page'] = $qv['paged']; |
|
321 | - unset( $qv['paged'] ); |
|
319 | + if ( ! empty( $qv[ 'paged' ] ) ) { |
|
320 | + $qv[ 'page' ] = $qv[ 'paged' ]; |
|
321 | + unset( $qv[ 'paged' ] ); |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | global $post; |
337 | 337 | |
338 | 338 | // If in admin and NOT AJAX request, get outta here. |
339 | - if ( GravityView_Plugin::is_admin() ) { |
|
339 | + if ( GravityView_Plugin::is_admin() ) { |
|
340 | 340 | return; |
341 | 341 | } |
342 | 342 | |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | |
349 | 349 | $this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); |
350 | 350 | |
351 | - $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); |
|
351 | + $post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null ); |
|
352 | 352 | $this->setPostId( $post_id ); |
353 | 353 | $post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; |
354 | 354 | $this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | |
385 | 385 | $search_method = GravityView_Widget_Search::getInstance()->get_search_method(); |
386 | 386 | |
387 | - if( 'post' === $search_method ) { |
|
387 | + if ( 'post' === $search_method ) { |
|
388 | 388 | $get = $_POST; |
389 | 389 | } else { |
390 | 390 | $get = $_GET; |
@@ -440,20 +440,20 @@ discard block |
||
440 | 440 | * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop |
441 | 441 | * @param array $entry Current entry |
442 | 442 | */ |
443 | - $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry ); |
|
443 | + $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry ); |
|
444 | 444 | |
445 | 445 | if ( ! $apply_outside_loop ) { |
446 | 446 | return $title; |
447 | 447 | } |
448 | 448 | |
449 | 449 | // User reported WooCommerce doesn't pass two args. |
450 | - if ( empty( $passed_post_id ) ) { |
|
450 | + if ( empty( $passed_post_id ) ) { |
|
451 | 451 | return $title; |
452 | 452 | } |
453 | 453 | |
454 | 454 | // Don't modify the title for anything other than the current view/post. |
455 | 455 | // This is true for embedded shortcodes and Views. |
456 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
456 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
457 | 457 | return $title; |
458 | 458 | } |
459 | 459 | |
@@ -463,19 +463,19 @@ discard block |
||
463 | 463 | $view_meta = $this->getGvOutputData()->get_view( $context_view_id ); |
464 | 464 | } else { |
465 | 465 | foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { |
466 | - if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) { |
|
466 | + if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) { |
|
467 | 467 | $view_meta = $view_data; |
468 | 468 | break; |
469 | 469 | } |
470 | 470 | } |
471 | 471 | } |
472 | 472 | |
473 | - if ( ! empty( $view_meta['atts']['single_title'] ) ) { |
|
473 | + if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) { |
|
474 | 474 | |
475 | - $title = $view_meta['atts']['single_title']; |
|
475 | + $title = $view_meta[ 'atts' ][ 'single_title' ]; |
|
476 | 476 | |
477 | 477 | // We are allowing HTML in the fields, so no escaping the output |
478 | - $title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry ); |
|
478 | + $title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry ); |
|
479 | 479 | |
480 | 480 | $title = do_shortcode( $title ); |
481 | 481 | } |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | public function render_view( $passed_args ) { |
577 | 577 | |
578 | 578 | // validate attributes |
579 | - if ( empty( $passed_args['id'] ) ) { |
|
579 | + if ( empty( $passed_args[ 'id' ] ) ) { |
|
580 | 580 | do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args ); |
581 | 581 | return null; |
582 | 582 | } |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | return null; |
599 | 599 | } |
600 | 600 | |
601 | - $view_id = $passed_args['id']; |
|
601 | + $view_id = $passed_args[ 'id' ]; |
|
602 | 602 | |
603 | 603 | $view_data = $this->getGvOutputData()->get_view( $view_id, $passed_args ); |
604 | 604 | |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | $passed_args = array_filter( $passed_args, 'strlen' ); |
612 | 612 | |
613 | 613 | //Override shortcode args over View template settings |
614 | - $atts = wp_parse_args( $passed_args, $view_data['atts'] ); |
|
614 | + $atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] ); |
|
615 | 615 | |
616 | 616 | do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts ); |
617 | 617 | |
@@ -634,14 +634,14 @@ discard block |
||
634 | 634 | * @since 1.15 |
635 | 635 | * @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. |
636 | 636 | */ |
637 | - 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 ) ) { |
|
637 | + 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 ) ) { |
|
638 | 638 | |
639 | 639 | do_action( 'gravityview_log_debug', sprintf( '%s Returning: View %d is not visible by current user.', __METHOD__, $view_id ) ); |
640 | 640 | |
641 | 641 | return null; |
642 | 642 | } |
643 | 643 | |
644 | - if( $this->isGravityviewPostType() ) { |
|
644 | + if ( $this->isGravityviewPostType() ) { |
|
645 | 645 | |
646 | 646 | /** |
647 | 647 | * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode? |
@@ -653,9 +653,9 @@ discard block |
||
653 | 653 | */ |
654 | 654 | $direct_access = apply_filters( 'gravityview_direct_access', true, $view_id ); |
655 | 655 | |
656 | - $embed_only = ! empty( $atts['embed_only'] ); |
|
656 | + $embed_only = ! empty( $atts[ 'embed_only' ] ); |
|
657 | 657 | |
658 | - if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
658 | + if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
659 | 659 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
660 | 660 | } |
661 | 661 | } |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | |
671 | 671 | $gravityview_view = new GravityView_View( $view_data ); |
672 | 672 | |
673 | - $post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : $this->getPostId(); |
|
673 | + $post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : $this->getPostId(); |
|
674 | 674 | |
675 | 675 | $gravityview_view->setPostId( $post_id ); |
676 | 676 | |
@@ -680,20 +680,20 @@ discard block |
||
680 | 680 | do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' ); |
681 | 681 | |
682 | 682 | //fetch template and slug |
683 | - $view_slug = apply_filters( 'gravityview_template_slug_'. $view_data['template_id'], 'table', 'directory' ); |
|
683 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'directory' ); |
|
684 | 684 | |
685 | 685 | do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug ); |
686 | 686 | |
687 | 687 | /** |
688 | 688 | * Disable fetching initial entries for views that don't need it (DataTables) |
689 | 689 | */ |
690 | - $get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true ); |
|
690 | + $get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true ); |
|
691 | 691 | |
692 | 692 | /** |
693 | 693 | * Hide View data until search is performed |
694 | 694 | * @since 1.5.4 |
695 | 695 | */ |
696 | - if ( ! empty( $atts['hide_until_searched'] ) && ! $this->isSearch() ) { |
|
696 | + if ( ! empty( $atts[ 'hide_until_searched' ] ) && ! $this->isSearch() ) { |
|
697 | 697 | $gravityview_view->setHideUntilSearched( true ); |
698 | 698 | $get_entries = false; |
699 | 699 | } |
@@ -701,23 +701,23 @@ discard block |
||
701 | 701 | |
702 | 702 | if ( $get_entries ) { |
703 | 703 | |
704 | - if ( ! empty( $atts['sort_columns'] ) ) { |
|
704 | + if ( ! empty( $atts[ 'sort_columns' ] ) ) { |
|
705 | 705 | // add filter to enable column sorting |
706 | - add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 ); |
|
706 | + add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 ); |
|
707 | 707 | } |
708 | 708 | |
709 | - $view_entries = self::get_view_entries( $atts, $view_data['form_id'] ); |
|
709 | + $view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] ); |
|
710 | 710 | |
711 | - do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) ); |
|
711 | + do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) ); |
|
712 | 712 | |
713 | 713 | } else { |
714 | 714 | |
715 | 715 | $view_entries = array( 'count' => null, 'entries' => null, 'paging' => null ); |
716 | 716 | |
717 | - do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' ); |
|
717 | + do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' ); |
|
718 | 718 | } |
719 | 719 | |
720 | - $gravityview_view->setPaging( $view_entries['paging'] ); |
|
720 | + $gravityview_view->setPaging( $view_entries[ 'paging' ] ); |
|
721 | 721 | $gravityview_view->setContext( 'directory' ); |
722 | 722 | $sections = array( 'header', 'body', 'footer' ); |
723 | 723 | |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | * @action `gravityview_render_entry_{View ID}` Before rendering a single entry for a specific View ID |
732 | 732 | * @since 1.17 |
733 | 733 | */ |
734 | - do_action( 'gravityview_render_entry_'.$view_data['id'] ); |
|
734 | + do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] ); |
|
735 | 735 | |
736 | 736 | $entry = $this->getEntry(); |
737 | 737 | |
@@ -758,20 +758,20 @@ discard block |
||
758 | 758 | // We're in single view, but the view being processed is not the same view the single entry belongs to. |
759 | 759 | // important: do not remove this as it prevents fake attempts of displaying entries from other views/forms |
760 | 760 | if ( $this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id() ) { |
761 | - 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 ); |
|
761 | + 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 ); |
|
762 | 762 | return null; |
763 | 763 | } |
764 | 764 | |
765 | 765 | //fetch template and slug |
766 | - $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data['template_id'], 'table', 'single' ); |
|
766 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'single' ); |
|
767 | 767 | do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug ); |
768 | 768 | |
769 | 769 | //fetch entry detail |
770 | - $view_entries['count'] = 1; |
|
771 | - $view_entries['entries'][] = $entry; |
|
772 | - do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] ); |
|
770 | + $view_entries[ 'count' ] = 1; |
|
771 | + $view_entries[ 'entries' ][ ] = $entry; |
|
772 | + do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] ); |
|
773 | 773 | |
774 | - $back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null; |
|
774 | + $back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null; |
|
775 | 775 | |
776 | 776 | // set back link label |
777 | 777 | $gravityview_view->setBackLinkLabel( $back_link_label ); |
@@ -781,11 +781,11 @@ discard block |
||
781 | 781 | } |
782 | 782 | |
783 | 783 | // add template style |
784 | - self::add_style( $view_data['template_id'] ); |
|
784 | + self::add_style( $view_data[ 'template_id' ] ); |
|
785 | 785 | |
786 | 786 | // Prepare to render view and set vars |
787 | - $gravityview_view->setEntries( $view_entries['entries'] ); |
|
788 | - $gravityview_view->setTotalEntries( $view_entries['count'] ); |
|
787 | + $gravityview_view->setEntries( $view_entries[ 'entries' ] ); |
|
788 | + $gravityview_view->setTotalEntries( $view_entries[ 'count' ] ); |
|
789 | 789 | |
790 | 790 | // If Edit |
791 | 791 | if ( 'edit' === gravityview_get_context() ) { |
@@ -798,11 +798,11 @@ discard block |
||
798 | 798 | |
799 | 799 | } else { |
800 | 800 | // finaly we'll render some html |
801 | - $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data['template_id'] ); |
|
801 | + $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data[ 'template_id' ] ); |
|
802 | 802 | |
803 | 803 | do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections ); |
804 | 804 | foreach ( $sections as $section ) { |
805 | - do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' ); |
|
805 | + do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' ); |
|
806 | 806 | $gravityview_view->render( $view_slug, $section, false ); |
807 | 807 | } |
808 | 808 | } |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | $datetime_format = 'Y-m-d H:i:s'; |
857 | 857 | $search_is_outside_view_bounds = false; |
858 | 858 | |
859 | - if( ! empty( $search_criteria[ $key ] ) ) { |
|
859 | + if ( ! empty( $search_criteria[ $key ] ) ) { |
|
860 | 860 | |
861 | 861 | $search_date = strtotime( $search_criteria[ $key ] ); |
862 | 862 | |
@@ -884,14 +884,14 @@ discard block |
||
884 | 884 | if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
885 | 885 | |
886 | 886 | // Then we override the search and re-set the start date |
887 | - $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
887 | + $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); |
|
888 | 888 | } |
889 | 889 | } |
890 | 890 | } |
891 | 891 | |
892 | - if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
892 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
893 | 893 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
894 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
894 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
895 | 895 | do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria ); |
896 | 896 | } |
897 | 897 | } |
@@ -909,14 +909,14 @@ discard block |
||
909 | 909 | */ |
910 | 910 | public static function process_search_only_approved( $args, $search_criteria ) { |
911 | 911 | |
912 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
912 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
913 | 913 | |
914 | - $search_criteria['field_filters'][] = array( |
|
914 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
915 | 915 | 'key' => GravityView_Entry_Approval::meta_key, |
916 | 916 | 'value' => GravityView_Entry_Approval_Status::Approved |
917 | 917 | ); |
918 | 918 | |
919 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
919 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
920 | 920 | |
921 | 921 | do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria ); |
922 | 922 | } |
@@ -943,12 +943,12 @@ discard block |
||
943 | 943 | */ |
944 | 944 | public static function is_entry_approved( $entry, $args = array() ) { |
945 | 945 | |
946 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
946 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
947 | 947 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
948 | 948 | return true; |
949 | 949 | } |
950 | 950 | |
951 | - $is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key ); |
|
951 | + $is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key ); |
|
952 | 952 | |
953 | 953 | return GravityView_Entry_Approval_Status::is_approved( $is_approved ); |
954 | 954 | } |
@@ -982,26 +982,26 @@ discard block |
||
982 | 982 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria ); |
983 | 983 | |
984 | 984 | // implicity search |
985 | - if ( ! empty( $args['search_value'] ) ) { |
|
985 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
986 | 986 | |
987 | 987 | // Search operator options. Options: `is` or `contains` |
988 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
988 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
989 | 989 | |
990 | - $search_criteria['field_filters'][] = array( |
|
990 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
991 | 991 | 'key' => rgget( 'search_field', $args ), // The field ID to search |
992 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
992 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
993 | 993 | 'operator' => $operator, |
994 | 994 | ); |
995 | 995 | } |
996 | 996 | |
997 | - if( $search_criteria !== $original_search_criteria ) { |
|
997 | + if ( $search_criteria !== $original_search_criteria ) { |
|
998 | 998 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria ); |
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | // Handle setting date range |
1002 | 1002 | $search_criteria = self::process_search_dates( $args, $search_criteria ); |
1003 | 1003 | |
1004 | - if( $search_criteria !== $original_search_criteria ) { |
|
1004 | + if ( $search_criteria !== $original_search_criteria ) { |
|
1005 | 1005 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria ); |
1006 | 1006 | } |
1007 | 1007 | |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
1013 | 1013 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
1014 | 1014 | */ |
1015 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
1015 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
1016 | 1016 | |
1017 | 1017 | return $search_criteria; |
1018 | 1018 | } |
@@ -1058,16 +1058,16 @@ discard block |
||
1058 | 1058 | $search_criteria = self::get_search_criteria( $args, $form_id ); |
1059 | 1059 | |
1060 | 1060 | // Paging & offset |
1061 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
1061 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
1062 | 1062 | |
1063 | 1063 | if ( -1 === $page_size ) { |
1064 | 1064 | $page_size = PHP_INT_MAX; |
1065 | 1065 | } |
1066 | 1066 | |
1067 | - if ( isset( $args['offset'] ) ) { |
|
1068 | - $offset = intval( $args['offset'] ); |
|
1067 | + if ( isset( $args[ 'offset' ] ) ) { |
|
1068 | + $offset = intval( $args[ 'offset' ] ); |
|
1069 | 1069 | } else { |
1070 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
1070 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
1071 | 1071 | $offset = ( $curr_page - 1 ) * $page_size; |
1072 | 1072 | } |
1073 | 1073 | |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | 'search_criteria' => $search_criteria, |
1086 | 1086 | 'sorting' => $sorting, |
1087 | 1087 | 'paging' => $paging, |
1088 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
1088 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
1089 | 1089 | ); |
1090 | 1090 | |
1091 | 1091 | /** |
@@ -1110,7 +1110,7 @@ discard block |
||
1110 | 1110 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
1111 | 1111 | * @param array $args View configuration args. |
1112 | 1112 | */ |
1113 | - $parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id ); |
|
1113 | + $parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id ); |
|
1114 | 1114 | |
1115 | 1115 | do_action( 'gravityview_log_debug', __METHOD__ . ': $parameters passed to gravityview_get_entries(): ', $parameters ); |
1116 | 1116 | |
@@ -1150,8 +1150,8 @@ discard block |
||
1150 | 1150 | */ |
1151 | 1151 | public static function updateViewSorting( $args, $form_id ) { |
1152 | 1152 | $sorting = array(); |
1153 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' ); |
|
1154 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' ); |
|
1153 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' ); |
|
1154 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' ); |
|
1155 | 1155 | |
1156 | 1156 | $sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id ); |
1157 | 1157 | |
@@ -1191,7 +1191,7 @@ discard block |
||
1191 | 1191 | |
1192 | 1192 | $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
1193 | 1193 | |
1194 | - switch ( $sort_field['type'] ) { |
|
1194 | + switch ( $sort_field[ 'type' ] ) { |
|
1195 | 1195 | |
1196 | 1196 | case 'address': |
1197 | 1197 | // Sorting by full address |
@@ -1208,7 +1208,7 @@ discard block |
||
1208 | 1208 | */ |
1209 | 1209 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
1210 | 1210 | |
1211 | - switch( strtolower( $address_part ) ){ |
|
1211 | + switch ( strtolower( $address_part ) ) { |
|
1212 | 1212 | case 'street': |
1213 | 1213 | $sort_field_id .= '.1'; |
1214 | 1214 | break; |
@@ -1288,7 +1288,7 @@ discard block |
||
1288 | 1288 | */ |
1289 | 1289 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
1290 | 1290 | |
1291 | - if ( empty( $single_entry ) ){ |
|
1291 | + if ( empty( $single_entry ) ) { |
|
1292 | 1292 | return false; |
1293 | 1293 | } else { |
1294 | 1294 | return $single_entry; |
@@ -1315,7 +1315,7 @@ discard block |
||
1315 | 1315 | * Don't enqueue the scripts or styles if it's not going to be displayed. |
1316 | 1316 | * @since 1.15 |
1317 | 1317 | */ |
1318 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1318 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1319 | 1319 | continue; |
1320 | 1320 | } |
1321 | 1321 | |
@@ -1324,19 +1324,19 @@ discard block |
||
1324 | 1324 | $css_dependencies = array(); |
1325 | 1325 | |
1326 | 1326 | // If the thickbox is enqueued, add dependencies |
1327 | - if ( ! empty( $data['atts']['lightbox'] ) ) { |
|
1327 | + if ( ! empty( $data[ 'atts' ][ 'lightbox' ] ) ) { |
|
1328 | 1328 | |
1329 | 1329 | /** |
1330 | 1330 | * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox` |
1331 | 1331 | * @param string $script_slug If you want to use a different lightbox script, return the name of it here. |
1332 | 1332 | */ |
1333 | - $js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
1333 | + $js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
1334 | 1334 | |
1335 | 1335 | /** |
1336 | 1336 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
1337 | 1337 | * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here. |
1338 | 1338 | */ |
1339 | - $css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
1339 | + $css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
1340 | 1340 | } |
1341 | 1341 | |
1342 | 1342 | /** |
@@ -1344,25 +1344,25 @@ discard block |
||
1344 | 1344 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
1345 | 1345 | * @since 1.15 |
1346 | 1346 | */ |
1347 | - if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
1348 | - $css_dependencies[] = 'dashicons'; |
|
1347 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
1348 | + $css_dependencies[ ] = 'dashicons'; |
|
1349 | 1349 | } |
1350 | 1350 | |
1351 | 1351 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
1352 | 1352 | |
1353 | 1353 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
1354 | 1354 | |
1355 | - 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 ); |
|
1355 | + 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 ); |
|
1356 | 1356 | |
1357 | 1357 | wp_enqueue_script( 'gravityview-fe-view' ); |
1358 | 1358 | |
1359 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
1359 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
1360 | 1360 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
1361 | 1361 | } |
1362 | 1362 | |
1363 | 1363 | $this->enqueue_default_style( $css_dependencies ); |
1364 | 1364 | |
1365 | - self::add_style( $data['template_id'] ); |
|
1365 | + self::add_style( $data[ 'template_id' ] ); |
|
1366 | 1366 | } |
1367 | 1367 | |
1368 | 1368 | if ( 'wp_print_footer_scripts' === current_filter() ) { |
@@ -1424,7 +1424,7 @@ discard block |
||
1424 | 1424 | } elseif ( empty( $template_id ) ) { |
1425 | 1425 | do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' ); |
1426 | 1426 | } else { |
1427 | - do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) ); |
|
1427 | + do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) ); |
|
1428 | 1428 | } |
1429 | 1429 | |
1430 | 1430 | } |
@@ -1449,11 +1449,11 @@ discard block |
||
1449 | 1449 | * Not a table-based template; don't add sort icons |
1450 | 1450 | * @since 1.12 |
1451 | 1451 | */ |
1452 | - if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1452 | + if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1453 | 1453 | return $label; |
1454 | 1454 | } |
1455 | 1455 | |
1456 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
1456 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
1457 | 1457 | return $label; |
1458 | 1458 | } |
1459 | 1459 | |
@@ -1461,29 +1461,29 @@ discard block |
||
1461 | 1461 | |
1462 | 1462 | $class = 'gv-sort'; |
1463 | 1463 | |
1464 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
1464 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
1465 | 1465 | |
1466 | 1466 | $sort_args = array( |
1467 | - 'sort' => $field['id'], |
|
1467 | + 'sort' => $field[ 'id' ], |
|
1468 | 1468 | 'dir' => 'asc', |
1469 | 1469 | ); |
1470 | 1470 | |
1471 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
1471 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
1472 | 1472 | //toggle sorting direction. |
1473 | - if ( 'asc' === $sorting['direction'] ) { |
|
1474 | - $sort_args['dir'] = 'desc'; |
|
1473 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
1474 | + $sort_args[ 'dir' ] = 'desc'; |
|
1475 | 1475 | $class .= ' gv-icon-sort-desc'; |
1476 | 1476 | } else { |
1477 | - $sort_args['dir'] = 'asc'; |
|
1477 | + $sort_args[ 'dir' ] = 'asc'; |
|
1478 | 1478 | $class .= ' gv-icon-sort-asc'; |
1479 | 1479 | } |
1480 | 1480 | } else { |
1481 | 1481 | $class .= ' gv-icon-caret-up-down'; |
1482 | 1482 | } |
1483 | 1483 | |
1484 | - $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
1484 | + $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
1485 | 1485 | |
1486 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
1486 | + return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
1487 | 1487 | |
1488 | 1488 | } |
1489 | 1489 | |
@@ -1501,7 +1501,7 @@ discard block |
||
1501 | 1501 | |
1502 | 1502 | $field_type = $field_id; |
1503 | 1503 | |
1504 | - if( is_numeric( $field_id ) ) { |
|
1504 | + if ( is_numeric( $field_id ) ) { |
|
1505 | 1505 | $field = GFFormsModel::get_field( $form, $field_id ); |
1506 | 1506 | $field_type = $field->type; |
1507 | 1507 | } |
@@ -1524,7 +1524,7 @@ discard block |
||
1524 | 1524 | return false; |
1525 | 1525 | } |
1526 | 1526 | |
1527 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1527 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1528 | 1528 | |
1529 | 1529 | } |
1530 | 1530 |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | $disapproved_result = $wpdb->query( $wpdb->prepare( $sql, GravityView_Entry_Approval_Status::DISAPPROVED, '0' ) ); |
65 | 65 | |
66 | - if( false === $approved_result || false === $disapproved_result ) { |
|
66 | + if ( false === $approved_result || false === $disapproved_result ) { |
|
67 | 67 | do_action( 'gravityview_log_error', __METHOD__ . ': There was an error processing the query.', $wpdb->last_error ); |
68 | 68 | } else { |
69 | 69 | // All done: Meta values are migrated |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | $redux_settings = $this->get_redux_settings(); |
97 | 97 | |
98 | 98 | // No need to process |
99 | - if( false === $redux_settings ) { |
|
99 | + if ( false === $redux_settings ) { |
|
100 | 100 | return; |
101 | 101 | } |
102 | 102 | |
103 | - if( empty( $redux_settings['license_key_status'] ) ) { |
|
103 | + if ( empty( $redux_settings[ 'license_key_status' ] ) ) { |
|
104 | 104 | $redux_settings = $this->get_redux_license_status( $redux_settings ); |
105 | 105 | } |
106 | 106 | |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | GravityView_Settings::get_instance()->update_app_settings( $updated_settings ); |
115 | 115 | |
116 | 116 | // And now remove the previous option, so this is a one-time thing. |
117 | - delete_option('gravityview_settings'); |
|
118 | - delete_option('gravityview_settings-transients'); |
|
117 | + delete_option( 'gravityview_settings' ); |
|
118 | + delete_option( 'gravityview_settings-transients' ); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -131,16 +131,16 @@ discard block |
||
131 | 131 | |
132 | 132 | $data = array( |
133 | 133 | 'edd_action' => 'check_license', |
134 | - 'license' => rgget('license_key', $redux_settings ), |
|
134 | + 'license' => rgget( 'license_key', $redux_settings ), |
|
135 | 135 | 'update' => false, |
136 | 136 | 'format' => 'object', |
137 | 137 | ); |
138 | 138 | |
139 | 139 | $license_call = GravityView_Settings::get_instance()->get_license_handler()->license_call( $data ); |
140 | 140 | |
141 | - if( is_object( $license_call ) && isset( $license_call->license ) ) { |
|
142 | - $redux_settings['license_key_status'] = $license_call->license; |
|
143 | - $redux_settings['license_key_response'] = json_encode( $license_call ); |
|
141 | + if ( is_object( $license_call ) && isset( $license_call->license ) ) { |
|
142 | + $redux_settings[ 'license_key_status' ] = $license_call->license; |
|
143 | + $redux_settings[ 'license_key_response' ] = json_encode( $license_call ); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | return $redux_settings; |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | function get_redux_settings() { |
155 | 155 | |
156 | 156 | // Previous settings set by Redux |
157 | - $redux_option = get_option('gravityview_settings'); |
|
157 | + $redux_option = get_option( 'gravityview_settings' ); |
|
158 | 158 | |
159 | 159 | // No Redux settings? Don't proceed. |
160 | - if( false === $redux_option ) { |
|
160 | + if ( false === $redux_option ) { |
|
161 | 161 | return false; |
162 | 162 | } |
163 | 163 | |
@@ -167,21 +167,21 @@ discard block |
||
167 | 167 | 'no-conflict-mode' => ( rgget( 'no-conflict-mode', $redux_option ) ? '1' : '0' ), |
168 | 168 | ); |
169 | 169 | |
170 | - if( $license_array = rgget( 'license', $redux_option ) ) { |
|
170 | + if ( $license_array = rgget( 'license', $redux_option ) ) { |
|
171 | 171 | |
172 | - $redux_settings['license_key'] = $license_key = rgget( 'license', $license_array ); |
|
172 | + $redux_settings[ 'license_key' ] = $license_key = rgget( 'license', $license_array ); |
|
173 | 173 | |
174 | - $redux_last_changed_values = get_option('gravityview_settings-transients'); |
|
174 | + $redux_last_changed_values = get_option( 'gravityview_settings-transients' ); |
|
175 | 175 | |
176 | 176 | // This contains the last response for license validation |
177 | - if( !empty( $redux_last_changed_values ) && $saved_values = rgget( 'changed_values', $redux_last_changed_values ) ) { |
|
177 | + if ( ! empty( $redux_last_changed_values ) && $saved_values = rgget( 'changed_values', $redux_last_changed_values ) ) { |
|
178 | 178 | |
179 | - $saved_license = rgget('license', $saved_values ); |
|
179 | + $saved_license = rgget( 'license', $saved_values ); |
|
180 | 180 | |
181 | 181 | // Only use the last-saved values if they are for the same license |
182 | - if( $saved_license && rgget( 'license', $saved_license ) === $license_key ) { |
|
183 | - $redux_settings['license_key_status'] = rgget( 'status', $saved_license ); |
|
184 | - $redux_settings['license_key_response'] = rgget( 'response', $saved_license ); |
|
182 | + if ( $saved_license && rgget( 'license', $saved_license ) === $license_key ) { |
|
183 | + $redux_settings[ 'license_key_status' ] = rgget( 'status', $saved_license ); |
|
184 | + $redux_settings[ 'license_key_response' ] = rgget( 'response', $saved_license ); |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | } |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | /** ---- Migrate from old search widget to new search widget ---- */ |
194 | 194 | function update_search_on_views() { |
195 | 195 | |
196 | - if( !class_exists('GravityView_Widget_Search') ) { |
|
197 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/search-widget/class-search-widget.php' ); |
|
196 | + if ( ! class_exists( 'GravityView_Widget_Search' ) ) { |
|
197 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/search-widget/class-search-widget.php' ); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | // Loop through all the views |
@@ -206,20 +206,20 @@ discard block |
||
206 | 206 | |
207 | 207 | $views = get_posts( $query_args ); |
208 | 208 | |
209 | - foreach( $views as $view ) { |
|
209 | + foreach ( $views as $view ) { |
|
210 | 210 | |
211 | 211 | $widgets = gravityview_get_directory_widgets( $view->ID ); |
212 | 212 | $search_fields = null; |
213 | 213 | |
214 | - if( empty( $widgets ) || !is_array( $widgets ) ) { continue; } |
|
214 | + if ( empty( $widgets ) || ! is_array( $widgets ) ) { continue; } |
|
215 | 215 | |
216 | 216 | do_action( 'gravityview_log_debug', '[GravityView_Migrate/update_search_on_views] Loading View ID: ', $view->ID ); |
217 | 217 | |
218 | - foreach( $widgets as $area => $ws ) { |
|
219 | - foreach( $ws as $k => $widget ) { |
|
220 | - if( $widget['id'] !== 'search_bar' ) { continue; } |
|
218 | + foreach ( $widgets as $area => $ws ) { |
|
219 | + foreach ( $ws as $k => $widget ) { |
|
220 | + if ( $widget[ 'id' ] !== 'search_bar' ) { continue; } |
|
221 | 221 | |
222 | - if( is_null( $search_fields ) ) { |
|
222 | + if ( is_null( $search_fields ) ) { |
|
223 | 223 | $search_fields = $this->get_search_fields( $view->ID ); |
224 | 224 | } |
225 | 225 | |
@@ -227,24 +227,24 @@ discard block |
||
227 | 227 | // [search_free] => 1 |
228 | 228 | // [search_date] => 1 |
229 | 229 | $search_generic = array(); |
230 | - if( !empty( $widget['search_free'] ) ) { |
|
231 | - $search_generic[] = array( 'field' => 'search_all', 'input' => 'input_text' ); |
|
230 | + if ( ! empty( $widget[ 'search_free' ] ) ) { |
|
231 | + $search_generic[ ] = array( 'field' => 'search_all', 'input' => 'input_text' ); |
|
232 | 232 | } |
233 | - if( !empty( $widget['search_date'] ) ) { |
|
234 | - $search_generic[] = array( 'field' => 'entry_date', 'input' => 'date' ); |
|
233 | + if ( ! empty( $widget[ 'search_date' ] ) ) { |
|
234 | + $search_generic[ ] = array( 'field' => 'entry_date', 'input' => 'date' ); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | $search_config = array_merge( $search_generic, $search_fields ); |
238 | 238 | |
239 | 239 | // don't throw '[]' when json_encode an empty array |
240 | - if( empty( $search_config ) ) { |
|
240 | + if ( empty( $search_config ) ) { |
|
241 | 241 | $search_config = ''; |
242 | 242 | } else { |
243 | 243 | $search_config = json_encode( $search_config ); |
244 | 244 | } |
245 | 245 | |
246 | - $widgets[ $area ][ $k ]['search_fields'] = $search_config; |
|
247 | - $widgets[ $area ][ $k ]['search_layout'] = 'horizontal'; |
|
246 | + $widgets[ $area ][ $k ][ 'search_fields' ] = $search_config; |
|
247 | + $widgets[ $area ][ $k ][ 'search_layout' ] = 'horizontal'; |
|
248 | 248 | |
249 | 249 | do_action( 'gravityview_log_debug', '[GravityView_Migrate/update_search_on_views] Updated Widget: ', $widgets[ $area ][ $k ] ); |
250 | 250 | } |
@@ -272,26 +272,26 @@ discard block |
||
272 | 272 | // check view fields' settings |
273 | 273 | $fields = gravityview_get_directory_fields( $view_id, false ); |
274 | 274 | |
275 | - if( !empty( $fields ) && is_array( $fields ) ) { |
|
275 | + if ( ! empty( $fields ) && is_array( $fields ) ) { |
|
276 | 276 | |
277 | - foreach( $fields as $t => $fs ) { |
|
277 | + foreach ( $fields as $t => $fs ) { |
|
278 | 278 | |
279 | - foreach( $fs as $k => $field ) { |
|
279 | + foreach ( $fs as $k => $field ) { |
|
280 | 280 | // is field a search_filter ? |
281 | - if( empty( $field['search_filter'] ) ) { continue; } |
|
281 | + if ( empty( $field[ 'search_filter' ] ) ) { continue; } |
|
282 | 282 | |
283 | 283 | // get field type & calculate the input type (by default) |
284 | - $form_field = gravityview_get_field( $form, $field['id'] ); |
|
284 | + $form_field = gravityview_get_field( $form, $field[ 'id' ] ); |
|
285 | 285 | |
286 | - if( empty( $form_field['type'] ) ) { |
|
286 | + if ( empty( $form_field[ 'type' ] ) ) { |
|
287 | 287 | continue; |
288 | 288 | } |
289 | 289 | |
290 | 290 | // depending on the field type assign a group of possible search field types |
291 | - $type = GravityView_Widget_Search::get_search_input_types( $field['id'], $form_field['type'] ); |
|
291 | + $type = GravityView_Widget_Search::get_search_input_types( $field[ 'id' ], $form_field[ 'type' ] ); |
|
292 | 292 | |
293 | 293 | // add field to config |
294 | - $search_fields[] = array( 'field' => $field['id'], 'input' => $type ); |
|
294 | + $search_fields[ ] = array( 'field' => $field[ 'id' ], 'input' => $type ); |
|
295 | 295 | |
296 | 296 | } |
297 | 297 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public static function getInstance() { |
74 | 74 | |
75 | - if( empty( self::$instance ) ) { |
|
75 | + if ( empty( self::$instance ) ) { |
|
76 | 76 | self::$instance = new self; |
77 | 77 | } |
78 | 78 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | self::require_files(); |
85 | 85 | |
86 | - if( ! GravityView_Compatibility::is_valid() ) { |
|
86 | + if ( ! GravityView_Compatibility::is_valid() ) { |
|
87 | 87 | return; |
88 | 88 | } |
89 | 89 | |
@@ -98,14 +98,14 @@ discard block |
||
98 | 98 | */ |
99 | 99 | private static function require_files() { |
100 | 100 | require_once( GRAVITYVIEW_DIR . 'includes/helper-functions.php' ); |
101 | - require_once( GRAVITYVIEW_DIR . 'includes/class-common.php'); |
|
102 | - require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php'); |
|
101 | + require_once( GRAVITYVIEW_DIR . 'includes/class-common.php' ); |
|
102 | + require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php' ); |
|
103 | 103 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-compatibility.php' ); |
104 | 104 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-roles-capabilities.php' ); |
105 | 105 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-notices.php' ); |
106 | - require_once( GRAVITYVIEW_DIR .'includes/class-admin.php' ); |
|
107 | - require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php'); |
|
108 | - require_once( GRAVITYVIEW_DIR . 'includes/class-cache.php'); |
|
106 | + require_once( GRAVITYVIEW_DIR . 'includes/class-admin.php' ); |
|
107 | + require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php' ); |
|
108 | + require_once( GRAVITYVIEW_DIR . 'includes/class-cache.php' ); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -138,22 +138,22 @@ discard block |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-approval-status.php' ); |
141 | - include_once( GRAVITYVIEW_DIR .'includes/class-gravityview-entry-approval.php' ); |
|
141 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-approval.php' ); |
|
142 | 142 | |
143 | - include_once( GRAVITYVIEW_DIR .'includes/class-gravityview-entry-notes.php' ); |
|
144 | - include_once( GRAVITYVIEW_DIR .'includes/load-plugin-and-theme-hooks.php' ); |
|
143 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-notes.php' ); |
|
144 | + include_once( GRAVITYVIEW_DIR . 'includes/load-plugin-and-theme-hooks.php' ); |
|
145 | 145 | |
146 | 146 | // Load Extensions |
147 | 147 | // @todo: Convert to a scan of the directory or a method where this all lives |
148 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/edit-entry/class-edit-entry.php' ); |
|
149 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/delete-entry/class-delete-entry.php' ); |
|
150 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/entry-notes/class-gravityview-field-notes.php' ); |
|
148 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/edit-entry/class-edit-entry.php' ); |
|
149 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/delete-entry/class-delete-entry.php' ); |
|
150 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/entry-notes/class-gravityview-field-notes.php' ); |
|
151 | 151 | |
152 | 152 | // Load WordPress Widgets |
153 | - include_once( GRAVITYVIEW_DIR .'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
153 | + include_once( GRAVITYVIEW_DIR . 'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
154 | 154 | |
155 | 155 | // Load GravityView Widgets |
156 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/register-gravityview-widgets.php' ); |
|
156 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/register-gravityview-widgets.php' ); |
|
157 | 157 | |
158 | 158 | // Add oEmbed |
159 | 159 | include_once( GRAVITYVIEW_DIR . 'includes/class-oembed.php' ); |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
167 | 167 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-bar.php' ); |
168 | 168 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-list.php' ); |
169 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */ |
|
169 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php' ); /** @since 1.8.4 */ |
|
170 | 170 | include_once( GRAVITYVIEW_DIR . 'includes/class-data.php' ); |
171 | 171 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-shortcode.php' ); |
172 | 172 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-link-shortcode.php' ); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @return bool |
182 | 182 | */ |
183 | 183 | public static function is_network_activated() { |
184 | - return is_multisite() && ( function_exists('is_plugin_active_for_network') && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
184 | + return is_multisite() && ( function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * @since 1.7.5.1 |
247 | 247 | */ |
248 | 248 | public static function include_widget_class() { |
249 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
249 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | } |
269 | 269 | if ( ! $loaded ) { |
270 | 270 | $locale = apply_filters( 'plugin_locale', get_locale(), 'gravityview' ); |
271 | - $mofile = dirname( __FILE__ ) . '/languages/gravityview-'. $locale .'.mo'; |
|
271 | + $mofile = dirname( __FILE__ ) . '/languages/gravityview-' . $locale . '.mo'; |
|
272 | 272 | load_textdomain( 'gravityview', $mofile ); |
273 | 273 | } |
274 | 274 | |
@@ -299,12 +299,12 @@ discard block |
||
299 | 299 | */ |
300 | 300 | public function frontend_actions( $force = false ) { |
301 | 301 | |
302 | - if( self::is_admin() && ! $force ) { return; } |
|
302 | + if ( self::is_admin() && ! $force ) { return; } |
|
303 | 303 | |
304 | 304 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-image.php' ); |
305 | - include_once( GRAVITYVIEW_DIR .'includes/class-template.php' ); |
|
306 | - include_once( GRAVITYVIEW_DIR .'includes/class-api.php' ); |
|
307 | - include_once( GRAVITYVIEW_DIR .'includes/class-frontend-views.php' ); |
|
305 | + include_once( GRAVITYVIEW_DIR . 'includes/class-template.php' ); |
|
306 | + include_once( GRAVITYVIEW_DIR . 'includes/class-api.php' ); |
|
307 | + include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
|
308 | 308 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-change-entry-creator.php' ); |
309 | 309 | |
310 | 310 | |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | */ |
330 | 330 | public static function get_default_widget_areas() { |
331 | 331 | $default_areas = array( |
332 | - array( '1-1' => array( array( 'areaid' => 'top', 'title' => __('Top', 'gravityview' ) , 'subtitle' => '' ) ) ), |
|
333 | - array( '1-2' => array( array( 'areaid' => 'left', 'title' => __('Left', 'gravityview') , 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __('Right', 'gravityview') , 'subtitle' => '' ) ) ), |
|
332 | + array( '1-1' => array( array( 'areaid' => 'top', 'title' => __( 'Top', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
333 | + array( '1-2' => array( array( 'areaid' => 'left', 'title' => __( 'Left', 'gravityview' ), 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __( 'Right', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
334 | 334 | ); |
335 | 335 | |
336 | 336 | /** |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | * @param mixed $data Additional data to display |
349 | 349 | * @return void |
350 | 350 | */ |
351 | - public static function log_debug( $message, $data = null ){ |
|
351 | + public static function log_debug( $message, $data = null ) { |
|
352 | 352 | /** |
353 | 353 | * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
354 | 354 | * @param string $message Message to display |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | * @param string $message log message |
363 | 363 | * @return void |
364 | 364 | */ |
365 | - public static function log_error( $message, $data = null ){ |
|
365 | + public static function log_error( $message, $data = null ) { |
|
366 | 366 | /** |
367 | 367 | * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
368 | 368 | * @param string $message Error message to display |
@@ -373,4 +373,4 @@ discard block |
||
373 | 373 | |
374 | 374 | } // end class GravityView_Plugin |
375 | 375 | |
376 | -add_action('plugins_loaded', array('GravityView_Plugin', 'getInstance'), 1); |
|
376 | +add_action( 'plugins_loaded', array( 'GravityView_Plugin', 'getInstance' ), 1 ); |
@@ -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="http://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="http://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 ); |