Code Duplication    Length = 28-28 lines in 2 locations

includes/fields/class-gravityview-field-fileupload.php 2 locations

@@ 102-129 (lines=28) @@
99
			switch( true ) {
100
101
				// Audio file
102
				case in_array( $extension, wp_get_audio_extensions() ):
103
104
					$disable_lightbox = true;
105
106
					if( shortcode_exists( 'audio' ) ) {
107
108
						$disable_wrapped_link = true;
109
110
						/**
111
						 * @filter `gravityview_audio_settings` Modify the settings passed to the `wp_video_shortcode()` function
112
						 * @since  1.2
113
						 * @param array $audio_settings Array with `src` and `class` keys
114
						 */
115
						$audio_settings = apply_filters( 'gravityview_audio_settings', array(
116
							'src' => $file_path,
117
							'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id']
118
						));
119
120
						/**
121
						 * Generate the audio shortcode
122
						 * @see http://codex.wordpress.org/Audio_Shortcode
123
						 * @see https://developer.wordpress.org/reference/functions/wp_audio_shortcode/
124
						 */
125
						$content = wp_audio_shortcode( $audio_settings );
126
127
					}
128
129
					break;
130
131
				// Video file
132
				case in_array( $extension, wp_get_video_extensions() ):
@@ 132-159 (lines=28) @@
129
					break;
130
131
				// Video file
132
				case in_array( $extension, wp_get_video_extensions() ):
133
134
					$disable_lightbox = true;
135
136
					if( shortcode_exists( 'video' ) ) {
137
138
						$disable_wrapped_link = true;
139
140
						/**
141
						 * @filter `gravityview_video_settings` Modify the settings passed to the `wp_video_shortcode()` function
142
						 * @since  1.2
143
						 * @param array $video_settings Array with `src` and `class` keys
144
						 */
145
						$video_settings = apply_filters( 'gravityview_video_settings', array(
146
							'src' => $file_path,
147
							'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id']
148
						));
149
150
						/**
151
						 * Generate the video shortcode
152
						 * @see http://codex.wordpress.org/Video_Shortcode
153
						 * @see https://developer.wordpress.org/reference/functions/wp_video_shortcode/
154
						 */
155
						$content = wp_video_shortcode( $video_settings );
156
157
					}
158
159
					break;
160
161
				// PDF
162
				case $extension === 'pdf':