@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | return; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - $this->widget_description = __('Display a Gravity Forms form.', 'gravityview' ); |
|
| 27 | + $this->widget_description = __( 'Display a Gravity Forms form.', 'gravityview' ); |
|
| 28 | 28 | |
| 29 | 29 | $default_values = array( |
| 30 | 30 | 'header' => 1, |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | add_filter( 'gravityview/widget/hide_until_searched/allowlist', array( $this, 'add_to_allowlist' ) ); |
| 67 | 67 | |
| 68 | - parent::__construct( __( 'Gravity Forms', 'gravityview' ) , 'gravityforms', $default_values, $settings ); |
|
| 68 | + parent::__construct( __( 'Gravity Forms', 'gravityview' ), 'gravityforms', $default_values, $settings ); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | function add_to_allowlist( $allowlist ) { |
| 110 | 110 | |
| 111 | - $allowlist[] = 'gravityforms'; |
|
| 111 | + $allowlist[ ] = 'gravityforms'; |
|
| 112 | 112 | |
| 113 | 113 | return $allowlist; |
| 114 | 114 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * @param string $content |
| 119 | 119 | * @param string $context |
| 120 | 120 | */ |
| 121 | - public function render_frontend( $widget_args, $content = '', $context = '') { |
|
| 121 | + public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
| 122 | 122 | |
| 123 | 123 | if ( ! $this->pre_render_frontend() ) { |
| 124 | 124 | return; |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | // The image source has ?raw=1; don't check for valid image extensions. |
| 55 | - $image_atts['validate_src'] = false; |
|
| 55 | + $image_atts[ 'validate_src' ] = false; |
|
| 56 | 56 | |
| 57 | 57 | return $image_atts; |
| 58 | 58 | } |
@@ -26,21 +26,21 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
| 28 | 28 | |
| 29 | - unset( $field_options['search_filter'] ); |
|
| 29 | + unset( $field_options[ 'search_filter' ] ); |
|
| 30 | 30 | |
| 31 | - if( 'edit' === $context ) { |
|
| 31 | + if ( 'edit' === $context ) { |
|
| 32 | 32 | return $field_options; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - $add_options['link_to_file'] = array( |
|
| 35 | + $add_options[ 'link_to_file' ] = array( |
|
| 36 | 36 | 'type' => 'checkbox', |
| 37 | 37 | 'label' => __( 'Display as a Link:', 'gravityview' ), |
| 38 | - 'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'), |
|
| 38 | + 'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ), |
|
| 39 | 39 | 'value' => false, |
| 40 | 40 | 'merge_tags' => false, |
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | - $add_options['image_width'] = array( |
|
| 43 | + $add_options[ 'image_width' ] = array( |
|
| 44 | 44 | 'type' => 'text', |
| 45 | 45 | 'label' => __( 'Custom Width:', 'gravityview' ), |
| 46 | 46 | 'desc' => __( 'Override the default image width (250).', 'gravityview' ), |
@@ -158,14 +158,14 @@ discard block |
||
| 158 | 158 | $base_id = null; |
| 159 | 159 | |
| 160 | 160 | $is_single = gravityview_get_context() === 'single'; |
| 161 | - $lightbox = ! empty( $gravityview_view->atts['lightbox'] ); |
|
| 161 | + $lightbox = ! empty( $gravityview_view->atts[ 'lightbox' ] ); |
|
| 162 | 162 | $field_compat = $gravityview_view->getCurrentField(); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | $output_arr = array(); |
| 166 | 166 | |
| 167 | 167 | // Get an array of file paths for the field. |
| 168 | - $file_paths = \GV\Utils::get( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
| 168 | + $file_paths = \GV\Utils::get( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
| 169 | 169 | |
| 170 | 170 | // The $value JSON was probably truncated; let's check lead_detail_long. |
| 171 | 171 | if ( ! is_array( $file_paths ) ) { |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $rendered = null; |
| 186 | 186 | |
| 187 | 187 | // If the site is HTTPS, use HTTPS |
| 188 | - if ( function_exists('set_url_scheme') ) { |
|
| 188 | + if ( function_exists( 'set_url_scheme' ) ) { |
|
| 189 | 189 | $file_path = set_url_scheme( $file_path ); |
| 190 | 190 | } |
| 191 | 191 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | $file_path_info = pathinfo( $file_path ); |
| 197 | 197 | |
| 198 | 198 | // If pathinfo() gave us the extension of the file, run the switch statement using that. |
| 199 | - $extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] ); |
|
| 199 | + $extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] ); |
|
| 200 | 200 | |
| 201 | 201 | /** |
| 202 | 202 | * @filter `gravityview/fields/fileupload/extension` Modify the file extension before it's used in display logic |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | $extension = apply_filters( 'gravityview/fields/fileupload/extension', $extension, $file_path ); |
| 208 | 208 | |
| 209 | - $basename = $file_path_info['basename']; |
|
| 209 | + $basename = $file_path_info[ 'basename' ]; |
|
| 210 | 210 | |
| 211 | 211 | // Get the secure download URL |
| 212 | 212 | $is_secure = false; |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | $audio_settings = apply_filters( 'gravityview_audio_settings', array( |
| 248 | 248 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
| 249 | - 'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id'] |
|
| 249 | + 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ] |
|
| 250 | 250 | ), $context ); |
| 251 | 251 | |
| 252 | 252 | /** |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | */ |
| 276 | 276 | $video_settings = apply_filters( 'gravityview_video_settings', array( |
| 277 | 277 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
| 278 | - 'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id'] |
|
| 278 | + 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ] |
|
| 279 | 279 | ), $context ); |
| 280 | 280 | |
| 281 | 281 | /** |
@@ -299,20 +299,20 @@ discard block |
||
| 299 | 299 | $file_path = add_query_arg( array( 'gv-iframe' => 'true' ), $file_path ); |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | - $field_settings['link_to_file'] = true; |
|
| 302 | + $field_settings[ 'link_to_file' ] = true; |
|
| 303 | 303 | |
| 304 | 304 | // Images |
| 305 | 305 | } else if ( in_array( $extension, GravityView_Image::get_image_extensions() ) ) { |
| 306 | 306 | $width = \GV\Utils::get( $field_settings, 'image_width', 250 ); |
| 307 | 307 | $image_atts = array( |
| 308 | 308 | 'src' => $file_path, |
| 309 | - 'class' => 'gv-image gv-field-id-' . $field_settings['id'], |
|
| 310 | - 'alt' => $field_settings['label'], |
|
| 311 | - 'width' => ( $is_single ? null : ( $width ? $width: 250 ) ) |
|
| 309 | + 'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ], |
|
| 310 | + 'alt' => $field_settings[ 'label' ], |
|
| 311 | + 'width' => ( $is_single ? null : ( $width ? $width : 250 ) ) |
|
| 312 | 312 | ); |
| 313 | 313 | |
| 314 | 314 | if ( $is_secure ) { |
| 315 | - $image_atts['validate_src'] = false; |
|
| 315 | + $image_atts[ 'validate_src' ] = false; |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | /** |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | |
| 334 | 334 | unset( $gv_entry ); |
| 335 | 335 | |
| 336 | - if ( $lightbox && empty( $field_settings['show_as_link'] ) ) { |
|
| 336 | + if ( $lightbox && empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 337 | 337 | |
| 338 | 338 | $lightbox_link_atts = array( |
| 339 | 339 | 'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ), |
@@ -348,13 +348,13 @@ discard block |
||
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | // Show as link should render the image regardless. |
| 351 | - if ( ! empty( $field_settings['show_as_link'] ) ) { |
|
| 351 | + if ( ! empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 352 | 352 | $text = $rendered; |
| 353 | 353 | } |
| 354 | 354 | } |
| 355 | 355 | // For all other non-media file types (ZIP, for example), always show as a link regardless of setting. |
| 356 | 356 | else { |
| 357 | - $field_settings['link_to_file'] = true; |
|
| 357 | + $field_settings[ 'link_to_file' ] = true; |
|
| 358 | 358 | $disable_lightbox = true; |
| 359 | 359 | } |
| 360 | 360 | |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | $disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', false, $field_compat, $context ); |
| 371 | 371 | |
| 372 | 372 | // Output textualized content where |
| 373 | - if ( ! $disable_wrapped_link && ( ! empty( $field_settings['link_to_file'] ) || ! empty( $field_settings['show_as_link'] ) ) ) { |
|
| 373 | + if ( ! $disable_wrapped_link && ( ! empty( $field_settings[ 'link_to_file' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) ) { |
|
| 374 | 374 | /** |
| 375 | 375 | * Modify the link text (defaults to the file name) |
| 376 | 376 | * |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | */ |
| 384 | 384 | $content = apply_filters( 'gravityview/fields/fileupload/link_content', $text, $field_compat, $context ); |
| 385 | 385 | |
| 386 | - if ( empty( $field_settings['show_as_link'] ) ) { |
|
| 386 | + if ( empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 387 | 387 | /** |
| 388 | 388 | * @filter `gravityview/fields/fileupload/link_atts` Modify the link attributes for a file upload field |
| 389 | 389 | * @since 2.0 Added $context |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | $content = empty( $rendered ) ? $text : $rendered; |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | - $output_arr[] = array( |
|
| 407 | + $output_arr[ ] = array( |
|
| 408 | 408 | 'file_path' => $file_path, |
| 409 | 409 | 'content' => $content |
| 410 | 410 | ); |