@@ -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,14 +294,14 @@ 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', |
301 | 301 | ); |
302 | 302 | |
303 | 303 | if ( $override_security ) { |
304 | - $image_atts['src'] = $insecure_file_path; |
|
304 | + $image_atts[ 'src' ] = $insecure_file_path; |
|
305 | 305 | $image = new GravityView_Image( $image_atts ); |
306 | 306 | $file_path = $insecure_file_path; |
307 | 307 | // :( a kitten died somewhere |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | } |
314 | 314 | |
315 | 315 | // Show as link should render the image regardless. |
316 | - if ( ! empty( $field_settings['show_as_link'] ) ) { |
|
316 | + if ( ! empty( $field_settings[ 'show_as_link' ] ) ) { |
|
317 | 317 | $text = $rendered; |
318 | 318 | } |
319 | 319 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | $disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', false, $field_compat, $context ); |
331 | 331 | |
332 | 332 | // Output textualized content where |
333 | - if ( ! $disable_wrapped_link && ( ! empty( $field_settings['link_to_file'] ) || ! empty( $field_settings['show_as_link'] ) ) ) { |
|
333 | + if ( ! $disable_wrapped_link && ( ! empty( $field_settings[ 'link_to_file' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) ) { |
|
334 | 334 | /** |
335 | 335 | * Modify the link text (defaults to the file name) |
336 | 336 | * |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | */ |
344 | 344 | $content = apply_filters( 'gravityview/fields/fileupload/link_content', $text, $field_compat, $context ); |
345 | 345 | |
346 | - if ( empty( $field_settings['show_as_link'] ) ) { |
|
346 | + if ( empty( $field_settings[ 'show_as_link' ] ) ) { |
|
347 | 347 | /** |
348 | 348 | * @filter `gravityview/fields/fileupload/link_atts` Modify the link attributes for a file upload field |
349 | 349 | * @param array|string $link_atts Array or attributes string |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | $content = empty( $rendered ) ? $text : $rendered; |
360 | 360 | } |
361 | 361 | |
362 | - $output_arr[] = array( |
|
362 | + $output_arr[ ] = array( |
|
363 | 363 | 'file_path' => $file_path, |
364 | 364 | 'content' => $content |
365 | 365 | ); |