@@ -26,21 +26,21 @@ discard block |
||
26 | 26 | |
27 | 27 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
28 | 28 | |
29 | - unset( $field_options['search_filter'] ); |
|
29 | + unset( $field_options[ 'search_filter' ] ); |
|
30 | 30 | |
31 | - if( 'edit' === $context ) { |
|
31 | + if ( 'edit' === $context ) { |
|
32 | 32 | return $field_options; |
33 | 33 | } |
34 | 34 | |
35 | - $add_options['link_to_file'] = array( |
|
35 | + $add_options[ 'link_to_file' ] = array( |
|
36 | 36 | 'type' => 'checkbox', |
37 | 37 | 'label' => __( 'Display as a Link:', 'gravityview' ), |
38 | - 'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'), |
|
38 | + 'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ), |
|
39 | 39 | 'value' => false, |
40 | 40 | 'merge_tags' => false, |
41 | 41 | ); |
42 | 42 | |
43 | - $add_options['image_width'] = array( |
|
43 | + $add_options[ 'image_width' ] = array( |
|
44 | 44 | 'type' => 'text', |
45 | 45 | 'label' => __( 'Custom Width:', 'gravityview' ), |
46 | 46 | 'desc' => __( 'Override the default image width (250).', 'gravityview' ), |
@@ -158,14 +158,14 @@ discard block |
||
158 | 158 | $base_id = null; |
159 | 159 | |
160 | 160 | $is_single = gravityview_get_context() === 'single'; |
161 | - $lightbox = ! empty( $gravityview_view->atts['lightbox'] ); |
|
161 | + $lightbox = ! empty( $gravityview_view->atts[ 'lightbox' ] ); |
|
162 | 162 | $field_compat = $gravityview_view->getCurrentField(); |
163 | 163 | } |
164 | 164 | |
165 | 165 | $output_arr = array(); |
166 | 166 | |
167 | 167 | // Get an array of file paths for the field. |
168 | - $file_paths = \GV\Utils::get( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
168 | + $file_paths = \GV\Utils::get( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
169 | 169 | |
170 | 170 | // The $value JSON was probably truncated; let's check lead_detail_long. |
171 | 171 | if ( ! is_array( $file_paths ) ) { |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $rendered = null; |
186 | 186 | |
187 | 187 | // If the site is HTTPS, use HTTPS |
188 | - if ( function_exists('set_url_scheme') ) { |
|
188 | + if ( function_exists( 'set_url_scheme' ) ) { |
|
189 | 189 | $file_path = set_url_scheme( $file_path ); |
190 | 190 | } |
191 | 191 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | $file_path_info = pathinfo( $file_path ); |
197 | 197 | |
198 | 198 | // If pathinfo() gave us the extension of the file, run the switch statement using that. |
199 | - $extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] ); |
|
199 | + $extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] ); |
|
200 | 200 | |
201 | 201 | /** |
202 | 202 | * @filter `gravityview/fields/fileupload/extension` Modify the file extension before it's used in display logic |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | $extension = apply_filters( 'gravityview/fields/fileupload/extension', $extension, $file_path ); |
208 | 208 | |
209 | - $basename = $file_path_info['basename']; |
|
209 | + $basename = $file_path_info[ 'basename' ]; |
|
210 | 210 | |
211 | 211 | // Get the secure download URL |
212 | 212 | $is_secure = false; |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | */ |
247 | 247 | $audio_settings = apply_filters( 'gravityview_audio_settings', array( |
248 | 248 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
249 | - 'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id'] |
|
249 | + 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ] |
|
250 | 250 | ), $context ); |
251 | 251 | |
252 | 252 | /** |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | */ |
276 | 276 | $video_settings = apply_filters( 'gravityview_video_settings', array( |
277 | 277 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
278 | - 'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id'] |
|
278 | + 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ] |
|
279 | 279 | ), $context ); |
280 | 280 | |
281 | 281 | /** |
@@ -299,20 +299,20 @@ discard block |
||
299 | 299 | $file_path = add_query_arg( array( 'gv-iframe' => 'true' ), $file_path ); |
300 | 300 | } |
301 | 301 | |
302 | - $field_settings['link_to_file'] = true; |
|
302 | + $field_settings[ 'link_to_file' ] = true; |
|
303 | 303 | |
304 | 304 | // Images |
305 | 305 | } else if ( in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ) ) { |
306 | 306 | $width = \GV\Utils::get( $field_settings, 'image_width', 250 ); |
307 | 307 | $image_atts = array( |
308 | 308 | 'src' => $file_path, |
309 | - 'class' => 'gv-image gv-field-id-' . $field_settings['id'], |
|
310 | - 'alt' => $field_settings['label'], |
|
311 | - 'width' => ( $is_single ? null : ( $width ? $width: 250 ) ) |
|
309 | + 'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ], |
|
310 | + 'alt' => $field_settings[ 'label' ], |
|
311 | + 'width' => ( $is_single ? null : ( $width ? $width : 250 ) ) |
|
312 | 312 | ); |
313 | 313 | |
314 | 314 | if ( $is_secure ) { |
315 | - $image_atts['validate_src'] = false; |
|
315 | + $image_atts[ 'validate_src' ] = false; |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | /** |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | |
334 | 334 | unset( $gv_entry ); |
335 | 335 | |
336 | - if ( $lightbox && empty( $field_settings['show_as_link'] ) ) { |
|
336 | + if ( $lightbox && empty( $field_settings[ 'show_as_link' ] ) ) { |
|
337 | 337 | $lightbox_link_atts = array( |
338 | 338 | 'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ), |
339 | 339 | 'class' => '', |
@@ -347,13 +347,13 @@ discard block |
||
347 | 347 | } |
348 | 348 | |
349 | 349 | // Show as link should render the image regardless. |
350 | - if ( ! empty( $field_settings['show_as_link'] ) ) { |
|
350 | + if ( ! empty( $field_settings[ 'show_as_link' ] ) ) { |
|
351 | 351 | $text = $rendered; |
352 | 352 | } |
353 | 353 | } |
354 | 354 | // For all other non-media file types (ZIP, for example), always show as a link regardless of setting. |
355 | 355 | else { |
356 | - $field_settings['link_to_file'] = true; |
|
356 | + $field_settings[ 'link_to_file' ] = true; |
|
357 | 357 | $disable_lightbox = true; |
358 | 358 | } |
359 | 359 | |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | $disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', false, $field_compat, $context ); |
370 | 370 | |
371 | 371 | // Output textualized content where |
372 | - if ( ! $disable_wrapped_link && ( ! empty( $field_settings['link_to_file'] ) || ! empty( $field_settings['show_as_link'] ) ) ) { |
|
372 | + if ( ! $disable_wrapped_link && ( ! empty( $field_settings[ 'link_to_file' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) ) { |
|
373 | 373 | /** |
374 | 374 | * Modify the link text (defaults to the file name) |
375 | 375 | * |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | */ |
383 | 383 | $content = apply_filters( 'gravityview/fields/fileupload/link_content', $text, $field_compat, $context ); |
384 | 384 | |
385 | - if ( empty( $field_settings['show_as_link'] ) ) { |
|
385 | + if ( empty( $field_settings[ 'show_as_link' ] ) ) { |
|
386 | 386 | /** |
387 | 387 | * @filter `gravityview/fields/fileupload/link_atts` Modify the link attributes for a file upload field |
388 | 388 | * @since 2.0 Added $context |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | $content = empty( $rendered ) ? $text : $rendered; |
404 | 404 | } |
405 | 405 | |
406 | - $output_arr[] = array( |
|
406 | + $output_arr[ ] = array( |
|
407 | 407 | 'file_path' => $file_path, |
408 | 408 | 'content' => $content |
409 | 409 | ); |
@@ -45,7 +45,7 @@ |
||
45 | 45 | function filter_file_path( $string = '' ) { |
46 | 46 | |
47 | 47 | $output = $string; |
48 | - $output = str_replace('www.dropbox.com', 'dl.dropboxusercontent.com', $output ); |
|
48 | + $output = str_replace( 'www.dropbox.com', 'dl.dropboxusercontent.com', $output ); |
|
49 | 49 | $output = str_replace( '?dl=0', '', $output ); |
50 | 50 | |
51 | 51 | return $output; |