@@ -104,18 +104,18 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public function allowed_atts( $atts = array() ) { |
| 106 | 106 | |
| 107 | - $atts['data-fancybox'] = null; |
|
| 108 | - $atts['data-fancybox-trigger'] = null; |
|
| 109 | - $atts['data-fancybox-index'] = null; |
|
| 110 | - $atts['data-src'] = null; |
|
| 111 | - $atts['data-type'] = null; |
|
| 112 | - $atts['data-width'] = null; |
|
| 113 | - $atts['data-height'] = null; |
|
| 114 | - $atts['data-srcset'] = null; |
|
| 115 | - $atts['data-caption'] = null; |
|
| 116 | - $atts['data-options'] = null; |
|
| 117 | - $atts['data-filter'] = null; |
|
| 118 | - $atts['data-type'] = null; |
|
| 107 | + $atts[ 'data-fancybox' ] = null; |
|
| 108 | + $atts[ 'data-fancybox-trigger' ] = null; |
|
| 109 | + $atts[ 'data-fancybox-index' ] = null; |
|
| 110 | + $atts[ 'data-src' ] = null; |
|
| 111 | + $atts[ 'data-type' ] = null; |
|
| 112 | + $atts[ 'data-width' ] = null; |
|
| 113 | + $atts[ 'data-height' ] = null; |
|
| 114 | + $atts[ 'data-srcset' ] = null; |
|
| 115 | + $atts[ 'data-caption' ] = null; |
|
| 116 | + $atts[ 'data-options' ] = null; |
|
| 117 | + $atts[ 'data-filter' ] = null; |
|
| 118 | + $atts[ 'data-type' ] = null; |
|
| 119 | 119 | |
| 120 | 120 | return $atts; |
| 121 | 121 | } |
@@ -130,18 +130,18 @@ discard block |
||
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | // Prevent empty content from getting added to the lightbox gallery |
| 133 | - if ( is_array( $additional_details ) && empty( $additional_details['file_path'] ) ) { |
|
| 133 | + if ( is_array( $additional_details ) && empty( $additional_details[ 'file_path' ] ) ) { |
|
| 134 | 134 | return $link_atts; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - $link_atts['class'] = \GV\Utils::get( $link_atts, 'class' ) . ' gravityview-fancybox'; |
|
| 137 | + $link_atts[ 'class' ] = \GV\Utils::get( $link_atts, 'class' ) . ' gravityview-fancybox'; |
|
| 138 | 138 | |
| 139 | - $link_atts['class'] = sanitize_html_class( $link_atts['class'] ); |
|
| 139 | + $link_atts[ 'class' ] = sanitize_html_class( $link_atts[ 'class' ] ); |
|
| 140 | 140 | |
| 141 | 141 | if ( $context && ! empty( $context->field->field ) ) { |
| 142 | 142 | if ( $context->field->field->multipleFiles ) { |
| 143 | 143 | $entry = $context->entry->as_entry(); |
| 144 | - $link_atts['data-fancybox'] = 'gallery-' . sprintf( "%s-%s-%s", $entry['form_id'], $context->field->ID, $context->entry->get_slug() ); |
|
| 144 | + $link_atts[ 'data-fancybox' ] = 'gallery-' . sprintf( "%s-%s-%s", $entry[ 'form_id' ], $context->field->ID, $context->entry->get_slug() ); |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | ), |
| 157 | 157 | ); |
| 158 | 158 | |
| 159 | - $link_atts['data-options'] = json_encode( $fancybox_settings ); |
|
| 159 | + $link_atts[ 'data-options' ] = json_encode( $fancybox_settings ); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | return $link_atts; |
@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | add_filter( 'gravityview/fields/fileupload/link_atts', array( $this, 'fileupload_link_atts' ), 10, 4 ); |
| 24 | 24 | add_filter( 'gravityview/get_link/allowed_atts', array( $this, 'allowed_atts' ) ); |
| 25 | 25 | |
| 26 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts') ); |
|
| 27 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles') ); |
|
| 26 | + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
|
| 27 | + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); |
|
| 28 | 28 | |
| 29 | 29 | add_action( 'wp_footer', array( $this, 'output_footer' ) ); |
| 30 | 30 | } |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | remove_filter( 'gravityview/fields/fileupload/link_atts', array( $this, 'fileupload_link_atts' ), 10 ); |
| 45 | 45 | remove_filter( 'gravityview/get_link/allowed_atts', array( $this, 'allowed_atts' ) ); |
| 46 | 46 | |
| 47 | - remove_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts') ); |
|
| 48 | - remove_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles') ); |
|
| 47 | + remove_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
|
| 48 | + remove_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); |
|
| 49 | 49 | |
| 50 | 50 | remove_action( 'wp_footer', array( $this, 'output_footer' ) ); |
| 51 | 51 | } |
@@ -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' ), |
@@ -129,14 +129,14 @@ discard block |
||
| 129 | 129 | $base_id = null; |
| 130 | 130 | |
| 131 | 131 | $is_single = gravityview_get_context() === 'single'; |
| 132 | - $lightbox = ! empty( $gravityview_view->atts['lightbox'] ); |
|
| 132 | + $lightbox = ! empty( $gravityview_view->atts[ 'lightbox' ] ); |
|
| 133 | 133 | $field_compat = $gravityview_view->getCurrentField(); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | $output_arr = array(); |
| 137 | 137 | |
| 138 | 138 | // Get an array of file paths for the field. |
| 139 | - $file_paths = \GV\Utils::get( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
| 139 | + $file_paths = \GV\Utils::get( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
| 140 | 140 | |
| 141 | 141 | // The $value JSON was probably truncated; let's check lead_detail_long. |
| 142 | 142 | if ( ! is_array( $file_paths ) ) { |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $rendered = null; |
| 156 | 156 | |
| 157 | 157 | // If the site is HTTPS, use HTTPS |
| 158 | - if ( function_exists('set_url_scheme') ) { |
|
| 158 | + if ( function_exists( 'set_url_scheme' ) ) { |
|
| 159 | 159 | $file_path = set_url_scheme( $file_path ); |
| 160 | 160 | } |
| 161 | 161 | |
@@ -166,8 +166,8 @@ discard block |
||
| 166 | 166 | $file_path_info = pathinfo( $file_path ); |
| 167 | 167 | |
| 168 | 168 | // If pathinfo() gave us the extension of the file, run the switch statement using that. |
| 169 | - $extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] ); |
|
| 170 | - $basename = $file_path_info['basename']; |
|
| 169 | + $extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] ); |
|
| 170 | + $basename = $file_path_info[ 'basename' ]; |
|
| 171 | 171 | |
| 172 | 172 | // Get the secure download URL |
| 173 | 173 | $is_secure = false; |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | $audio_settings = apply_filters( 'gravityview_audio_settings', array( |
| 208 | 208 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
| 209 | - 'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id'] |
|
| 209 | + 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ] |
|
| 210 | 210 | ), $context ); |
| 211 | 211 | |
| 212 | 212 | /** |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | */ |
| 243 | 243 | $video_settings = apply_filters( 'gravityview_video_settings', array( |
| 244 | 244 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
| 245 | - 'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id'] |
|
| 245 | + 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ] |
|
| 246 | 246 | ), $context ); |
| 247 | 247 | |
| 248 | 248 | /** |
@@ -270,20 +270,20 @@ discard block |
||
| 270 | 270 | // PDF needs to be displayed in an IFRAME |
| 271 | 271 | $file_path = add_query_arg( array( 'gv-iframe' => 'true' ), $file_path ); |
| 272 | 272 | |
| 273 | - $field_settings['link_to_file'] = true; |
|
| 273 | + $field_settings[ 'link_to_file' ] = true; |
|
| 274 | 274 | |
| 275 | 275 | // Images |
| 276 | 276 | } else if ( in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ) ) { |
| 277 | 277 | $width = \GV\Utils::get( $field_settings, 'image_width', 250 ); |
| 278 | 278 | $image_atts = array( |
| 279 | 279 | 'src' => $file_path, |
| 280 | - 'class' => 'gv-image gv-field-id-' . $field_settings['id'], |
|
| 281 | - 'alt' => $field_settings['label'], |
|
| 282 | - 'width' => ( $is_single ? null : ( $width ? $width: 250 ) ) |
|
| 280 | + 'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ], |
|
| 281 | + 'alt' => $field_settings[ 'label' ], |
|
| 282 | + 'width' => ( $is_single ? null : ( $width ? $width : 250 ) ) |
|
| 283 | 283 | ); |
| 284 | 284 | |
| 285 | 285 | if ( $is_secure ) { |
| 286 | - $image_atts['validate_src'] = false; |
|
| 286 | + $image_atts[ 'validate_src' ] = false; |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | /** |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | |
| 305 | 305 | unset( $gv_entry ); |
| 306 | 306 | |
| 307 | - if ( $lightbox && empty( $field_settings['show_as_link'] ) ) { |
|
| 307 | + if ( $lightbox && empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 308 | 308 | $lightbox_link_atts = array( |
| 309 | 309 | 'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ), |
| 310 | 310 | 'class' => '', |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | // Show as link should render the image regardless. |
| 323 | - if ( ! empty( $field_settings['show_as_link'] ) ) { |
|
| 323 | + if ( ! empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 324 | 324 | $text = $rendered; |
| 325 | 325 | } |
| 326 | 326 | } |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | $disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', false, $field_compat, $context ); |
| 338 | 338 | |
| 339 | 339 | // Output textualized content where |
| 340 | - if ( ! $disable_wrapped_link && ( ! empty( $field_settings['link_to_file'] ) || ! empty( $field_settings['show_as_link'] ) ) ) { |
|
| 340 | + if ( ! $disable_wrapped_link && ( ! empty( $field_settings[ 'link_to_file' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) ) { |
|
| 341 | 341 | /** |
| 342 | 342 | * Modify the link text (defaults to the file name) |
| 343 | 343 | * |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | */ |
| 351 | 351 | $content = apply_filters( 'gravityview/fields/fileupload/link_content', $text, $field_compat, $context ); |
| 352 | 352 | |
| 353 | - if ( empty( $field_settings['show_as_link'] ) ) { |
|
| 353 | + if ( empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 354 | 354 | /** |
| 355 | 355 | * @filter `gravityview/fields/fileupload/link_atts` Modify the link attributes for a file upload field |
| 356 | 356 | * @since 2.0 Added $context |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | $content = empty( $rendered ) ? $text : $rendered; |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - $output_arr[] = array( |
|
| 374 | + $output_arr[ ] = array( |
|
| 375 | 375 | 'file_path' => $file_path, |
| 376 | 376 | 'content' => $content |
| 377 | 377 | ); |