@@ -24,16 +24,16 @@ discard block |
||
24 | 24 | |
25 | 25 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
26 | 26 | |
27 | - unset( $field_options['search_filter'] ); |
|
27 | + unset( $field_options[ 'search_filter' ] ); |
|
28 | 28 | |
29 | - if( 'edit' === $context ) { |
|
29 | + if ( 'edit' === $context ) { |
|
30 | 30 | return $field_options; |
31 | 31 | } |
32 | 32 | |
33 | - $add_options['link_to_file'] = array( |
|
33 | + $add_options[ 'link_to_file' ] = array( |
|
34 | 34 | 'type' => 'checkbox', |
35 | 35 | 'label' => __( 'Display as a Link:', 'gravityview' ), |
36 | - 'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'), |
|
36 | + 'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ), |
|
37 | 37 | 'value' => false, |
38 | 38 | 'merge_tags' => false, |
39 | 39 | ); |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | $base_id = null; |
120 | 120 | |
121 | 121 | $is_single = gravityview_get_context() === 'single'; |
122 | - $lightbox = ! empty( $gravityview_view->atts['lightbox'] ); |
|
122 | + $lightbox = ! empty( $gravityview_view->atts[ 'lightbox' ] ); |
|
123 | 123 | $field_compat = $gravityview_view->getCurrentField(); |
124 | 124 | } |
125 | 125 | |
126 | 126 | $output_arr = array(); |
127 | 127 | |
128 | 128 | // Get an array of file paths for the field. |
129 | - $file_paths = \GV\Utils::get( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
129 | + $file_paths = \GV\Utils::get( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
130 | 130 | |
131 | 131 | // The $value JSON was probably truncated; let's check lead_detail_long. |
132 | 132 | if ( ! is_array( $file_paths ) ) { |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $rendered = null; |
146 | 146 | |
147 | 147 | // If the site is HTTPS, use HTTPS |
148 | - if ( function_exists('set_url_scheme') ) { |
|
148 | + if ( function_exists( 'set_url_scheme' ) ) { |
|
149 | 149 | $file_path = set_url_scheme( $file_path ); |
150 | 150 | } |
151 | 151 | |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | $file_path_info = pathinfo( $file_path ); |
157 | 157 | |
158 | 158 | // If pathinfo() gave us the extension of the file, run the switch statement using that. |
159 | - $extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] ); |
|
160 | - $basename = $file_path_info['basename']; |
|
159 | + $extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] ); |
|
160 | + $basename = $file_path_info[ 'basename' ]; |
|
161 | 161 | |
162 | 162 | // Get the secure download URL |
163 | 163 | $is_secure = false; |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | */ |
195 | 195 | $audio_settings = apply_filters( 'gravityview_audio_settings', array( |
196 | 196 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
197 | - 'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id'] |
|
197 | + 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ] |
|
198 | 198 | ), $context ); |
199 | 199 | |
200 | 200 | /** |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | */ |
231 | 231 | $video_settings = apply_filters( 'gravityview_video_settings', array( |
232 | 232 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
233 | - 'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id'] |
|
233 | + 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ] |
|
234 | 234 | ), $context ); |
235 | 235 | |
236 | 236 | /** |
@@ -262,13 +262,13 @@ discard block |
||
262 | 262 | } else if ( in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ) ) { |
263 | 263 | $image_atts = array( |
264 | 264 | 'src' => $file_path, |
265 | - 'class' => 'gv-image gv-field-id-' . $field_settings['id'], |
|
266 | - 'alt' => $field_settings['label'], |
|
265 | + 'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ], |
|
266 | + 'alt' => $field_settings[ 'label' ], |
|
267 | 267 | 'width' => ( $is_single ? null : 250 ) |
268 | 268 | ); |
269 | 269 | |
270 | 270 | if ( $is_secure ) { |
271 | - $image_atts['validate_src'] = false; |
|
271 | + $image_atts[ 'validate_src' ] = false; |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | /** |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | |
284 | 284 | $image = new GravityView_Image( $image_atts ); |
285 | 285 | |
286 | - $entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
286 | + $entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
287 | 287 | |
288 | 288 | /** |
289 | 289 | * @filter `gravityview/fields/fileupload/allow_insecure_lightbox` Allow insecure links to be shown for the lighbox. |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | */ |
295 | 295 | $override_security = apply_filters( 'gravityview/fields/fileupload/allow_insecure_lightbox', false, $file_path, $field_settings, $context ); |
296 | 296 | |
297 | - if ( $lightbox && empty( $field_settings['show_as_link'] ) && ( ! $is_secure || $override_security ) ) { |
|
297 | + if ( $lightbox && empty( $field_settings[ 'show_as_link' ] ) && ( ! $is_secure || $override_security ) ) { |
|
298 | 298 | $lightbox_link_atts = array( |
299 | 299 | 'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ), |
300 | 300 | 'class' => 'thickbox', |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | $lightbox_link_atts = apply_filters( 'gravityview/fields/fileupload/link_atts', $lightbox_link_atts, $field_compat, $context ); |
304 | 304 | |
305 | 305 | if ( $override_security ) { |
306 | - $image_atts['src'] = $insecure_file_path; |
|
306 | + $image_atts[ 'src' ] = $insecure_file_path; |
|
307 | 307 | $image = new GravityView_Image( $image_atts ); |
308 | 308 | $file_path = $insecure_file_path; |
309 | 309 | // :( a kitten died somewhere |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | } |
316 | 316 | |
317 | 317 | // Show as link should render the image regardless. |
318 | - if ( ! empty( $field_settings['show_as_link'] ) ) { |
|
318 | + if ( ! empty( $field_settings[ 'show_as_link' ] ) ) { |
|
319 | 319 | $text = $rendered; |
320 | 320 | } |
321 | 321 | } |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | $disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', false, $field_compat, $context ); |
333 | 333 | |
334 | 334 | // Output textualized content where |
335 | - if ( ! $disable_wrapped_link && ( ! empty( $field_settings['link_to_file'] ) || ! empty( $field_settings['show_as_link'] ) ) ) { |
|
335 | + if ( ! $disable_wrapped_link && ( ! empty( $field_settings[ 'link_to_file' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) ) { |
|
336 | 336 | /** |
337 | 337 | * Modify the link text (defaults to the file name) |
338 | 338 | * |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | */ |
346 | 346 | $content = apply_filters( 'gravityview/fields/fileupload/link_content', $text, $field_compat, $context ); |
347 | 347 | |
348 | - if ( empty( $field_settings['show_as_link'] ) ) { |
|
348 | + if ( empty( $field_settings[ 'show_as_link' ] ) ) { |
|
349 | 349 | /** |
350 | 350 | * @filter `gravityview/fields/fileupload/link_atts` Modify the link attributes for a file upload field |
351 | 351 | * @param array|string $link_atts Array or attributes string |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | $content = empty( $rendered ) ? $text : $rendered; |
362 | 362 | } |
363 | 363 | |
364 | - $output_arr[] = array( |
|
364 | + $output_arr[ ] = array( |
|
365 | 365 | 'file_path' => $file_path, |
366 | 366 | 'content' => $content |
367 | 367 | ); |