@@ -24,21 +24,21 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
| 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 | ); |
| 40 | 40 | |
| 41 | - $add_options['image_width'] = array( |
|
| 41 | + $add_options[ 'image_width' ] = array( |
|
| 42 | 42 | 'type' => 'text', |
| 43 | 43 | 'label' => __( 'Custom Width:', 'gravityview' ), |
| 44 | 44 | 'desc' => __( 'Override the default image width (250).', 'gravityview' ), |
@@ -127,14 +127,14 @@ discard block |
||
| 127 | 127 | $base_id = null; |
| 128 | 128 | |
| 129 | 129 | $is_single = gravityview_get_context() === 'single'; |
| 130 | - $lightbox = ! empty( $gravityview_view->atts['lightbox'] ); |
|
| 130 | + $lightbox = ! empty( $gravityview_view->atts[ 'lightbox' ] ); |
|
| 131 | 131 | $field_compat = $gravityview_view->getCurrentField(); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | $output_arr = array(); |
| 135 | 135 | |
| 136 | 136 | // Get an array of file paths for the field. |
| 137 | - $file_paths = \GV\Utils::get( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
| 137 | + $file_paths = \GV\Utils::get( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
| 138 | 138 | |
| 139 | 139 | // The $value JSON was probably truncated; let's check lead_detail_long. |
| 140 | 140 | if ( ! is_array( $file_paths ) ) { |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $rendered = null; |
| 154 | 154 | |
| 155 | 155 | // If the site is HTTPS, use HTTPS |
| 156 | - if ( function_exists('set_url_scheme') ) { |
|
| 156 | + if ( function_exists( 'set_url_scheme' ) ) { |
|
| 157 | 157 | $file_path = set_url_scheme( $file_path ); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -164,8 +164,8 @@ discard block |
||
| 164 | 164 | $file_path_info = pathinfo( $file_path ); |
| 165 | 165 | |
| 166 | 166 | // If pathinfo() gave us the extension of the file, run the switch statement using that. |
| 167 | - $extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] ); |
|
| 168 | - $basename = $file_path_info['basename']; |
|
| 167 | + $extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] ); |
|
| 168 | + $basename = $file_path_info[ 'basename' ]; |
|
| 169 | 169 | |
| 170 | 170 | // Get the secure download URL |
| 171 | 171 | $is_secure = false; |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | $audio_settings = apply_filters( 'gravityview_audio_settings', array( |
| 204 | 204 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
| 205 | - 'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id'] |
|
| 205 | + 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ] |
|
| 206 | 206 | ), $context ); |
| 207 | 207 | |
| 208 | 208 | /** |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | $video_settings = apply_filters( 'gravityview_video_settings', array( |
| 240 | 240 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
| 241 | - 'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id'] |
|
| 241 | + 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ] |
|
| 242 | 242 | ), $context ); |
| 243 | 243 | |
| 244 | 244 | /** |
@@ -271,13 +271,13 @@ discard block |
||
| 271 | 271 | $width = \GV\Utils::get( $field_settings, 'image_width', 250 ); |
| 272 | 272 | $image_atts = array( |
| 273 | 273 | 'src' => $file_path, |
| 274 | - 'class' => 'gv-image gv-field-id-' . $field_settings['id'], |
|
| 275 | - 'alt' => $field_settings['label'], |
|
| 276 | - 'width' => ( $is_single ? null : ( $width ? $width: 250 ) ) |
|
| 274 | + 'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ], |
|
| 275 | + 'alt' => $field_settings[ 'label' ], |
|
| 276 | + 'width' => ( $is_single ? null : ( $width ? $width : 250 ) ) |
|
| 277 | 277 | ); |
| 278 | 278 | |
| 279 | 279 | if ( $is_secure ) { |
| 280 | - $image_atts['validate_src'] = false; |
|
| 280 | + $image_atts[ 'validate_src' ] = false; |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | /** |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | |
| 293 | 293 | $image = new GravityView_Image( $image_atts ); |
| 294 | 294 | |
| 295 | - $entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
| 295 | + $entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
| 296 | 296 | |
| 297 | 297 | /** |
| 298 | 298 | * @filter `gravityview/fields/fileupload/allow_insecure_lightbox` Allow insecure links to be shown for the lighbox. |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | */ |
| 304 | 304 | $override_security = apply_filters( 'gravityview/fields/fileupload/allow_insecure_lightbox', false, $file_path, $field_settings, $context ); |
| 305 | 305 | |
| 306 | - if ( $lightbox && empty( $field_settings['show_as_link'] ) && ( ! $is_secure || $override_security ) ) { |
|
| 306 | + if ( $lightbox && empty( $field_settings[ 'show_as_link' ] ) && ( ! $is_secure || $override_security ) ) { |
|
| 307 | 307 | $lightbox_link_atts = array( |
| 308 | 308 | 'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ), |
| 309 | 309 | 'class' => 'thickbox', |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | $lightbox_link_atts = apply_filters( 'gravityview/fields/fileupload/link_atts', $lightbox_link_atts, $field_compat, $context ); |
| 313 | 313 | |
| 314 | 314 | if ( $override_security ) { |
| 315 | - $image_atts['src'] = $insecure_file_path; |
|
| 315 | + $image_atts[ 'src' ] = $insecure_file_path; |
|
| 316 | 316 | $image = new GravityView_Image( $image_atts ); |
| 317 | 317 | $file_path = $insecure_file_path; |
| 318 | 318 | // :( a kitten died somewhere |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | // Show as link should render the image regardless. |
| 327 | - if ( ! empty( $field_settings['show_as_link'] ) ) { |
|
| 327 | + if ( ! empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 328 | 328 | $text = $rendered; |
| 329 | 329 | } |
| 330 | 330 | } |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | $disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', false, $field_compat, $context ); |
| 342 | 342 | |
| 343 | 343 | // Output textualized content where |
| 344 | - if ( ! $disable_wrapped_link && ( ! empty( $field_settings['link_to_file'] ) || ! empty( $field_settings['show_as_link'] ) ) ) { |
|
| 344 | + if ( ! $disable_wrapped_link && ( ! empty( $field_settings[ 'link_to_file' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) ) { |
|
| 345 | 345 | /** |
| 346 | 346 | * Modify the link text (defaults to the file name) |
| 347 | 347 | * |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | */ |
| 355 | 355 | $content = apply_filters( 'gravityview/fields/fileupload/link_content', $text, $field_compat, $context ); |
| 356 | 356 | |
| 357 | - if ( empty( $field_settings['show_as_link'] ) ) { |
|
| 357 | + if ( empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 358 | 358 | /** |
| 359 | 359 | * @filter `gravityview/fields/fileupload/link_atts` Modify the link attributes for a file upload field |
| 360 | 360 | * @param array|string $link_atts Array or attributes string |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | $content = empty( $rendered ) ? $text : $rendered; |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - $output_arr[] = array( |
|
| 373 | + $output_arr[ ] = array( |
|
| 374 | 374 | 'file_path' => $file_path, |
| 375 | 375 | 'content' => $content |
| 376 | 376 | ); |