@@ -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' ), |
@@ -129,14 +129,14 @@ discard block |
||
| 129 | 129 | $base_id = null; |
| 130 | 130 | |
| 131 | 131 | $is_single = gravityview_get_context() === 'single'; |
| 132 | - $lightbox = ! empty( $gravityview_view->atts['lightbox'] ); |
|
| 132 | + $lightbox = ! empty( $gravityview_view->atts[ 'lightbox' ] ); |
|
| 133 | 133 | $field_compat = $gravityview_view->getCurrentField(); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | $output_arr = array(); |
| 137 | 137 | |
| 138 | 138 | // Get an array of file paths for the field. |
| 139 | - $file_paths = \GV\Utils::get( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
| 139 | + $file_paths = \GV\Utils::get( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
| 140 | 140 | |
| 141 | 141 | // The $value JSON was probably truncated; let's check lead_detail_long. |
| 142 | 142 | if ( ! is_array( $file_paths ) ) { |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $rendered = null; |
| 156 | 156 | |
| 157 | 157 | // If the site is HTTPS, use HTTPS |
| 158 | - if ( function_exists('set_url_scheme') ) { |
|
| 158 | + if ( function_exists( 'set_url_scheme' ) ) { |
|
| 159 | 159 | $file_path = set_url_scheme( $file_path ); |
| 160 | 160 | } |
| 161 | 161 | |
@@ -166,8 +166,8 @@ discard block |
||
| 166 | 166 | $file_path_info = pathinfo( $file_path ); |
| 167 | 167 | |
| 168 | 168 | // If pathinfo() gave us the extension of the file, run the switch statement using that. |
| 169 | - $extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] ); |
|
| 170 | - $basename = $file_path_info['basename']; |
|
| 169 | + $extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] ); |
|
| 170 | + $basename = $file_path_info[ 'basename' ]; |
|
| 171 | 171 | |
| 172 | 172 | // Get the secure download URL |
| 173 | 173 | $is_secure = false; |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | $audio_settings = apply_filters( 'gravityview_audio_settings', array( |
| 208 | 208 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
| 209 | - 'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id'] |
|
| 209 | + 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ] |
|
| 210 | 210 | ), $context ); |
| 211 | 211 | |
| 212 | 212 | /** |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | */ |
| 243 | 243 | $video_settings = apply_filters( 'gravityview_video_settings', array( |
| 244 | 244 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
| 245 | - 'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id'] |
|
| 245 | + 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ] |
|
| 246 | 246 | ), $context ); |
| 247 | 247 | |
| 248 | 248 | /** |
@@ -275,13 +275,13 @@ discard block |
||
| 275 | 275 | $width = \GV\Utils::get( $field_settings, 'image_width', 250 ); |
| 276 | 276 | $image_atts = array( |
| 277 | 277 | 'src' => $file_path, |
| 278 | - 'class' => 'gv-image gv-field-id-' . $field_settings['id'], |
|
| 279 | - 'alt' => $field_settings['label'], |
|
| 280 | - 'width' => ( $is_single ? null : ( $width ? $width: 250 ) ) |
|
| 278 | + 'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ], |
|
| 279 | + 'alt' => $field_settings[ 'label' ], |
|
| 280 | + 'width' => ( $is_single ? null : ( $width ? $width : 250 ) ) |
|
| 281 | 281 | ); |
| 282 | 282 | |
| 283 | 283 | if ( $is_secure ) { |
| 284 | - $image_atts['validate_src'] = false; |
|
| 284 | + $image_atts[ 'validate_src' ] = false; |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | /** |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | |
| 303 | 303 | unset( $gv_entry ); |
| 304 | 304 | |
| 305 | - if ( $lightbox && empty( $field_settings['show_as_link'] ) ) { |
|
| 305 | + if ( $lightbox && empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 306 | 306 | $lightbox_link_atts = array( |
| 307 | 307 | 'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ), |
| 308 | 308 | 'class' => '', |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | // Show as link should render the image regardless. |
| 321 | - if ( ! empty( $field_settings['show_as_link'] ) ) { |
|
| 321 | + if ( ! empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 322 | 322 | $text = $rendered; |
| 323 | 323 | } |
| 324 | 324 | } |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | $disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', false, $field_compat, $context ); |
| 336 | 336 | |
| 337 | 337 | // Output textualized content where |
| 338 | - if ( ! $disable_wrapped_link && ( ! empty( $field_settings['link_to_file'] ) || ! empty( $field_settings['show_as_link'] ) ) ) { |
|
| 338 | + if ( ! $disable_wrapped_link && ( ! empty( $field_settings[ 'link_to_file' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) ) { |
|
| 339 | 339 | /** |
| 340 | 340 | * Modify the link text (defaults to the file name) |
| 341 | 341 | * |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | */ |
| 349 | 349 | $content = apply_filters( 'gravityview/fields/fileupload/link_content', $text, $field_compat, $context ); |
| 350 | 350 | |
| 351 | - if ( empty( $field_settings['show_as_link'] ) ) { |
|
| 351 | + if ( empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 352 | 352 | /** |
| 353 | 353 | * @filter `gravityview/fields/fileupload/link_atts` Modify the link attributes for a file upload field |
| 354 | 354 | * @param array|string $link_atts Array or attributes string |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | $content = empty( $rendered ) ? $text : $rendered; |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - $output_arr[] = array( |
|
| 367 | + $output_arr[ ] = array( |
|
| 368 | 368 | 'file_path' => $file_path, |
| 369 | 369 | 'content' => $content |
| 370 | 370 | ); |