Completed
Push — develop ( 4a998f...09e5ca )
by Zack
10:50
created
class-gravityview-plugin-hooks-gravity-forms-dropbox.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
 	 */
46 46
 	function filter_file_path( $file_path = '', $file_path_info = array(), $field_settings = array() ) {
47 47
 
48
-		$file_path = str_replace('www.dropbox.com', 'dl.dropboxusercontent.com', $file_path );
48
+		$file_path = str_replace( 'www.dropbox.com', 'dl.dropboxusercontent.com', $file_path );
49 49
 		$file_path = str_replace( '?dl=0', '', $file_path );
50 50
 
51 51
 		return $file_path;
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-fileupload.php 1 patch
Spacing   +32 added lines, -32 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
 		);
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 		$output_arr = array();
89 89
 
90 90
 		// Get an array of file paths for the field.
91
-		$file_paths = rgar( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value );
91
+		$file_paths = rgar( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value );
92 92
 
93 93
 		// The $value JSON was probably truncated; let's check lead_detail_long.
94 94
 		if ( ! is_array( $file_paths ) ) {
@@ -102,16 +102,16 @@  discard block
 block discarded – undo
102 102
 		}
103 103
 
104 104
 		// Process each file path
105
-		foreach( $file_paths as $file_path ) {
105
+		foreach ( $file_paths as $file_path ) {
106 106
 
107 107
 			// If the site is HTTPS, use HTTPS
108
-			if(function_exists('set_url_scheme')) { $file_path = set_url_scheme($file_path); }
108
+			if ( function_exists( 'set_url_scheme' ) ) { $file_path = set_url_scheme( $file_path ); }
109 109
 
110 110
 			// This is from Gravity Forms's code
111
-			$file_path = esc_attr(str_replace(" ", "%20", $file_path));
111
+			$file_path = esc_attr( str_replace( " ", "%20", $file_path ) );
112 112
 
113 113
 			// If the field is set to link to the single entry, link to it.
114
-			$link = !empty( $field_settings['show_as_link'] ) ? GravityView_API::entry_link( $entry, $field ) : $file_path;
114
+			$link = ! empty( $field_settings[ 'show_as_link' ] ) ? GravityView_API::entry_link( $entry, $field ) : $file_path;
115 115
 
116 116
 			/**
117 117
 			 * @filter `gravityview/fields/fileupload/file_path` Modify the file path before generating a link to it
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 			$file_path = apply_filters( 'gravityview/fields/fileupload/file_path', $file_path, $field_settings );
123 123
 
124 124
 			// Get file path information
125
-			$file_path_info = pathinfo($file_path);
125
+			$file_path_info = pathinfo( $file_path );
126 126
 
127 127
 			$html_format = NULL;
128 128
 
@@ -131,30 +131,30 @@  discard block
 block discarded – undo
131 131
 			$disable_wrapped_link = false;
132 132
 
133 133
 			// Is this an image?
134
-			$image = new GravityView_Image(array(
134
+			$image = new GravityView_Image( array(
135 135
 				'src' => $file_path,
136
-				'class' => 'gv-image gv-field-id-'.$field_settings['id'],
137
-				'alt' => $field_settings['label'],
138
-				'width' => (gravityview_get_context() === 'single' ? NULL : 250)
139
-			));
136
+				'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ],
137
+				'alt' => $field_settings[ 'label' ],
138
+				'width' => ( gravityview_get_context() === 'single' ? NULL : 250 )
139
+			) );
140 140
 
141 141
 			$content = $image->html();
142 142
 
143 143
 			// The new default content is the image, if it exists. If not, use the file name as the content.
144
-			$content = !empty( $content ) ? $content : $file_path_info['basename'];
144
+			$content = ! empty( $content ) ? $content : $file_path_info[ 'basename' ];
145 145
 
146 146
 			// If pathinfo() gave us the extension of the file, run the switch statement using that.
147
-			$extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] );
147
+			$extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] );
148 148
 
149 149
 
150
-			switch( true ) {
150
+			switch ( true ) {
151 151
 
152 152
 				// Audio file
153 153
 				case in_array( $extension, wp_get_audio_extensions() ):
154 154
 
155 155
 					$disable_lightbox = true;
156 156
 
157
-					if( shortcode_exists( 'audio' ) ) {
157
+					if ( shortcode_exists( 'audio' ) ) {
158 158
 
159 159
 						$disable_wrapped_link = true;
160 160
 
@@ -165,8 +165,8 @@  discard block
 block discarded – undo
165 165
 						 */
166 166
 						$audio_settings = apply_filters( 'gravityview_audio_settings', array(
167 167
 							'src' => $file_path,
168
-							'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id']
169
-						));
168
+							'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ]
169
+						) );
170 170
 
171 171
 						/**
172 172
 						 * Generate the audio shortcode
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 
185 185
 					$disable_lightbox = true;
186 186
 
187
-					if( shortcode_exists( 'video' ) ) {
187
+					if ( shortcode_exists( 'video' ) ) {
188 188
 
189 189
 						$disable_wrapped_link = true;
190 190
 
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
 						 */
196 196
 						$video_settings = apply_filters( 'gravityview_video_settings', array(
197 197
 							'src' => $file_path,
198
-							'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id']
199
-						));
198
+							'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ]
199
+						) );
200 200
 
201 201
 						/**
202 202
 						 * Generate the video shortcode
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 					break;
219 219
 
220 220
 				// if not image, do not set the lightbox (@since 1.5.3)
221
-				case !in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ):
221
+				case ! in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ):
222 222
 
223 223
 					$disable_lightbox = true;
224 224
 
@@ -228,10 +228,10 @@  discard block
 block discarded – undo
228 228
 
229 229
 			// If using Link to File, override the content.
230 230
 			// (We do this here so that the $disable_lightbox can be set. Yes, there's a little more processing time, but oh well.)
231
-			if( !empty( $field_settings['link_to_file'] ) ) {
231
+			if ( ! empty( $field_settings[ 'link_to_file' ] ) ) {
232 232
 
233 233
 				// Force the content to be the file name
234
-				$content =  $file_path_info["basename"];
234
+				$content = $file_path_info[ "basename" ];
235 235
 
236 236
 				// Restore the wrapped link
237 237
 				$disable_wrapped_link = false;
@@ -239,13 +239,13 @@  discard block
 block discarded – undo
239 239
 			}
240 240
 
241 241
 			// Whether to use lightbox or not
242
-			if( $disable_lightbox || empty( $gravityview_view->atts['lightbox'] ) || !empty( $field_settings['show_as_link'] ) ) {
242
+			if ( $disable_lightbox || empty( $gravityview_view->atts[ 'lightbox' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) {
243 243
 
244
-				$link_atts = empty( $field_settings['show_as_link'] ) ? array( 'target' => '_blank' ) : array();
244
+				$link_atts = empty( $field_settings[ 'show_as_link' ] ) ? array( 'target' => '_blank' ) : array();
245 245
 
246 246
 			} else {
247 247
 
248
-				$entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry );
248
+				$entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry );
249 249
 
250 250
 				$link_atts = array(
251 251
 					'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ),
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 			$disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', $disable_wrapped_link, $gravityview_view->getCurrentField() );
272 272
 
273 273
 			// If the HTML output hasn't been overridden by the switch statement above, use the default format
274
-			if( !empty( $content ) && empty( $disable_wrapped_link ) ) {
274
+			if ( ! empty( $content ) && empty( $disable_wrapped_link ) ) {
275 275
 
276 276
 				/**
277 277
 				 * Modify the link text (defaults to the file name)
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
                 $content = gravityview_get_link( $link, $content, $link_atts );
287 287
 			}
288 288
 
289
-			$output_arr[] = array(
289
+			$output_arr[ ] = array(
290 290
 				'file_path' => $file_path,
291 291
 				'content' => $content
292 292
 			);
Please login to merge, or discard this patch.