Completed
Push — develop ( baf699...34d491 )
by Gennady
16:27 queued 40s
created
includes/fields/class-gravityview-field-fileupload.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -24,16 +24,16 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
145 145
 			$text = $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
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 			$file_path_info = pathinfo( $file_path );
169 169
 
170 170
 			// If pathinfo() gave us the extension of the file, run the switch statement using that.
171
-			$extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] );
171
+			$extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] );
172 172
 
173 173
 			// Audio
174 174
 			if ( in_array( $extension, wp_get_audio_extensions() ) ) {
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 					 */
183 183
 					$audio_settings = apply_filters( 'gravityview_audio_settings', array(
184 184
 						'src' => $file_path,
185
-						'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id']
185
+						'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ]
186 186
 					), $context );
187 187
 
188 188
 					/**
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 					 */
207 207
 					$video_settings = apply_filters( 'gravityview_video_settings', array(
208 208
 						'src' => $file_path,
209
-						'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id']
209
+						'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ]
210 210
 					), $context );
211 211
 
212 212
 					/**
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
 			} else if ( in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ) ) {
227 227
 				$image_atts = array(
228 228
 					'src' => $file_path,
229
-					'class' => 'gv-image gv-field-id-'.$field_settings['id'],
230
-					'alt' => $field_settings['label'],
229
+					'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ],
230
+					'alt' => $field_settings[ 'label' ],
231 231
 					'width' => ( $is_single ? NULL : 250 )
232 232
 				);
233 233
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
 				$image = new GravityView_Image( $image_atts );
243 243
 
244
-				$entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry );
244
+				$entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry );
245 245
 
246 246
 				$text = $image->html();
247 247
 
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 			$disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', false, $field_compat, $context );
270 270
 
271 271
 			// Output textualized content where 
272
-			if ( ! $disable_wrapped_link && ! empty( $field_settings['link_to_file'] ) && empty( $field_settings['show_as_link'] ) ) {
273
-				$content = empty( $text ) ? $file_path_info['basename'] : $text;
272
+			if ( ! $disable_wrapped_link && ! empty( $field_settings[ 'link_to_file' ] ) && empty( $field_settings[ 'show_as_link' ] ) ) {
273
+				$content = empty( $text ) ? $file_path_info[ 'basename' ] : $text;
274 274
 
275 275
 				/**
276 276
 				 * Modify the link text (defaults to the file name)
@@ -295,10 +295,10 @@  discard block
 block discarded – undo
295 295
 
296 296
 				$content = gravityview_get_link( $file_path, $content, $link_atts );
297 297
 			} else {
298
-				$content = empty( $rendered ) ? ( empty( $text ) ? $file_path_info['basename'] : $text ) : $rendered;
298
+				$content = empty( $rendered ) ? ( empty( $text ) ? $file_path_info[ 'basename' ] : $text ) : $rendered;
299 299
 			}
300 300
 
301
-			$output_arr[] = array(
301
+			$output_arr[ ] = array(
302 302
 				'file_path' => $file_path,
303 303
 				'content' => $content
304 304
 			);
Please login to merge, or discard this patch.