Completed
Push — develop ( dba357...c5be34 )
by Gennady
18:03
created
includes/fields/class-gravityview-field-fileupload.php 1 patch
Spacing   +18 added lines, -18 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
 
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
194 194
 					 */
195 195
 					$audio_settings = apply_filters( 'gravityview_audio_settings', array(
196 196
 						'src' => $src,
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
 					/**
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 					 */
226 226
 					$video_settings = apply_filters( 'gravityview_video_settings', array(
227 227
 						'src' => $src,
228
-						'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id']
228
+						'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ]
229 229
 					), $context );
230 230
 
231 231
 					/**
@@ -251,13 +251,13 @@  discard block
 block discarded – undo
251 251
 			} else if ( in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ) ) {
252 252
 				$image_atts = array(
253 253
 					'src' => $file_path,
254
-					'class' => 'gv-image gv-field-id-'.$field_settings['id'],
255
-					'alt' => $field_settings['label'],
254
+					'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ],
255
+					'alt' => $field_settings[ 'label' ],
256 256
 					'width' => ( $is_single ? NULL : 250 )
257 257
 				);
258 258
 
259 259
 				if ( $is_secure ) {
260
-					$image_atts['validate_src'] = false;
260
+					$image_atts[ 'validate_src' ] = false;
261 261
 				}
262 262
 
263 263
 				/**
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 
271 271
 				$image = new GravityView_Image( $image_atts );
272 272
 
273
-				$entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry );
273
+				$entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry );
274 274
 
275 275
 				$text = $image->html();
276 276
 
277
-				if ( $lightbox && empty( $field_settings['show_as_link'] ) ) {
277
+				if ( $lightbox && empty( $field_settings[ 'show_as_link' ] ) ) {
278 278
 					$lightbox_link_atts = array(
279 279
 						'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ),
280 280
 						'class' => 'thickbox',
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 			$disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', false, $field_compat, $context );
299 299
 
300 300
 			// Output textualized content where 
301
-			if ( ! $disable_wrapped_link && ( ! empty( $field_settings['link_to_file'] ) && empty( $field_settings['show_as_link'] ) ) ) {
301
+			if ( ! $disable_wrapped_link && ( ! empty( $field_settings[ 'link_to_file' ] ) && empty( $field_settings[ 'show_as_link' ] ) ) ) {
302 302
 				$content = empty( $text ) ? $basename : $text;
303 303
 
304 304
 				/**
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 				$content = empty( $rendered ) ? ( empty( $text ) ? $basename : $text ) : $rendered;
328 328
 			}
329 329
 
330
-			$output_arr[] = array(
330
+			$output_arr[ ] = array(
331 331
 				'file_path' => $file_path,
332 332
 				'content' => $content
333 333
 			);
Please login to merge, or discard this patch.