@@ -110,18 +110,18 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | public function allowed_atts( $atts = array() ) { |
| 112 | 112 | |
| 113 | - $atts['data-fancybox'] = null; |
|
| 114 | - $atts['data-fancybox-trigger'] = null; |
|
| 115 | - $atts['data-fancybox-index'] = null; |
|
| 116 | - $atts['data-src'] = null; |
|
| 117 | - $atts['data-type'] = null; |
|
| 118 | - $atts['data-width'] = null; |
|
| 119 | - $atts['data-height'] = null; |
|
| 120 | - $atts['data-srcset'] = null; |
|
| 121 | - $atts['data-caption'] = null; |
|
| 122 | - $atts['data-options'] = null; |
|
| 123 | - $atts['data-filter'] = null; |
|
| 124 | - $atts['data-type'] = null; |
|
| 113 | + $atts[ 'data-fancybox' ] = null; |
|
| 114 | + $atts[ 'data-fancybox-trigger' ] = null; |
|
| 115 | + $atts[ 'data-fancybox-index' ] = null; |
|
| 116 | + $atts[ 'data-src' ] = null; |
|
| 117 | + $atts[ 'data-type' ] = null; |
|
| 118 | + $atts[ 'data-width' ] = null; |
|
| 119 | + $atts[ 'data-height' ] = null; |
|
| 120 | + $atts[ 'data-srcset' ] = null; |
|
| 121 | + $atts[ 'data-caption' ] = null; |
|
| 122 | + $atts[ 'data-options' ] = null; |
|
| 123 | + $atts[ 'data-filter' ] = null; |
|
| 124 | + $atts[ 'data-type' ] = null; |
|
| 125 | 125 | |
| 126 | 126 | return $atts; |
| 127 | 127 | } |
@@ -136,23 +136,23 @@ discard block |
||
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | // Prevent empty content from getting added to the lightbox gallery |
| 139 | - if ( is_array( $additional_details ) && empty( $additional_details['file_path'] ) ) { |
|
| 139 | + if ( is_array( $additional_details ) && empty( $additional_details[ 'file_path' ] ) ) { |
|
| 140 | 140 | return $link_atts; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | // Prevent empty content from getting added to the lightbox gallery |
| 144 | - if ( is_array( $additional_details ) && ! empty( $additional_details['disable_lightbox'] ) ) { |
|
| 144 | + if ( is_array( $additional_details ) && ! empty( $additional_details[ 'disable_lightbox' ] ) ) { |
|
| 145 | 145 | return $link_atts; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - $link_atts['class'] = \GV\Utils::get( $link_atts, 'class' ) . ' gravityview-fancybox'; |
|
| 148 | + $link_atts[ 'class' ] = \GV\Utils::get( $link_atts, 'class' ) . ' gravityview-fancybox'; |
|
| 149 | 149 | |
| 150 | - $link_atts['class'] = gravityview_sanitize_html_class( $link_atts['class'] ); |
|
| 150 | + $link_atts[ 'class' ] = gravityview_sanitize_html_class( $link_atts[ 'class' ] ); |
|
| 151 | 151 | |
| 152 | 152 | if ( $context && ! empty( $context->field->field ) ) { |
| 153 | 153 | if ( $context->field->field->multipleFiles ) { |
| 154 | 154 | $entry = $context->entry->as_entry(); |
| 155 | - $link_atts['data-fancybox'] = 'gallery-' . sprintf( "%s-%s-%s", $entry['form_id'], $context->field->ID, $context->entry->get_slug() ); |
|
| 155 | + $link_atts[ 'data-fancybox' ] = 'gallery-' . sprintf( "%s-%s-%s", $entry[ 'form_id' ], $context->field->ID, $context->entry->get_slug() ); |
|
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | ), |
| 168 | 168 | ); |
| 169 | 169 | |
| 170 | - $link_atts['data-options'] = json_encode( $fancybox_settings ); |
|
| 170 | + $link_atts[ 'data-options' ] = json_encode( $fancybox_settings ); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | 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( 'gravityview/template/after', array( $this, 'print_scripts' ) ); |
| 30 | 30 | |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | remove_filter( 'gravityview/fields/fileupload/link_atts', array( $this, 'fileupload_link_atts' ), 10 ); |
| 93 | 93 | remove_filter( 'gravityview/get_link/allowed_atts', array( $this, 'allowed_atts' ) ); |
| 94 | 94 | |
| 95 | - remove_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts') ); |
|
| 96 | - remove_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles') ); |
|
| 95 | + remove_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
|
| 96 | + remove_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); |
|
| 97 | 97 | |
| 98 | 98 | remove_action( 'wp_footer', array( $this, 'output_footer' ) ); |
| 99 | 99 | } |
@@ -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 ) ) { |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | $rendered = null; |
| 157 | 157 | |
| 158 | 158 | // If the site is HTTPS, use HTTPS |
| 159 | - if ( function_exists('set_url_scheme') ) { |
|
| 159 | + if ( function_exists( 'set_url_scheme' ) ) { |
|
| 160 | 160 | $file_path = set_url_scheme( $file_path ); |
| 161 | 161 | } |
| 162 | 162 | |
@@ -167,8 +167,8 @@ discard block |
||
| 167 | 167 | $file_path_info = pathinfo( $file_path ); |
| 168 | 168 | |
| 169 | 169 | // If pathinfo() gave us the extension of the file, run the switch statement using that. |
| 170 | - $extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] ); |
|
| 171 | - $basename = $file_path_info['basename']; |
|
| 170 | + $extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] ); |
|
| 171 | + $basename = $file_path_info[ 'basename' ]; |
|
| 172 | 172 | |
| 173 | 173 | // Get the secure download URL |
| 174 | 174 | $is_secure = false; |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | */ |
| 209 | 209 | $audio_settings = apply_filters( 'gravityview_audio_settings', array( |
| 210 | 210 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
| 211 | - 'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id'] |
|
| 211 | + 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ] |
|
| 212 | 212 | ), $context ); |
| 213 | 213 | |
| 214 | 214 | /** |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | $video_settings = apply_filters( 'gravityview_video_settings', array( |
| 246 | 246 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
| 247 | - 'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id'] |
|
| 247 | + 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ] |
|
| 248 | 248 | ), $context ); |
| 249 | 249 | |
| 250 | 250 | /** |
@@ -275,20 +275,20 @@ discard block |
||
| 275 | 275 | $file_path = add_query_arg( array( 'gv-iframe' => 'true' ), $file_path ); |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - $field_settings['link_to_file'] = true; |
|
| 278 | + $field_settings[ 'link_to_file' ] = true; |
|
| 279 | 279 | |
| 280 | 280 | // Images |
| 281 | 281 | } else if ( in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ) ) { |
| 282 | 282 | $width = \GV\Utils::get( $field_settings, 'image_width', 250 ); |
| 283 | 283 | $image_atts = array( |
| 284 | 284 | 'src' => $file_path, |
| 285 | - 'class' => 'gv-image gv-field-id-' . $field_settings['id'], |
|
| 286 | - 'alt' => $field_settings['label'], |
|
| 287 | - 'width' => ( $is_single ? null : ( $width ? $width: 250 ) ) |
|
| 285 | + 'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ], |
|
| 286 | + 'alt' => $field_settings[ 'label' ], |
|
| 287 | + 'width' => ( $is_single ? null : ( $width ? $width : 250 ) ) |
|
| 288 | 288 | ); |
| 289 | 289 | |
| 290 | 290 | if ( $is_secure ) { |
| 291 | - $image_atts['validate_src'] = false; |
|
| 291 | + $image_atts[ 'validate_src' ] = false; |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | /** |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | |
| 310 | 310 | unset( $gv_entry ); |
| 311 | 311 | |
| 312 | - if ( $lightbox && empty( $field_settings['show_as_link'] ) ) { |
|
| 312 | + if ( $lightbox && empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 313 | 313 | $lightbox_link_atts = array( |
| 314 | 314 | 'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ), |
| 315 | 315 | 'class' => '', |
@@ -323,13 +323,13 @@ discard block |
||
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | // Show as link should render the image regardless. |
| 326 | - if ( ! empty( $field_settings['show_as_link'] ) ) { |
|
| 326 | + if ( ! empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 327 | 327 | $text = $rendered; |
| 328 | 328 | } |
| 329 | 329 | } |
| 330 | 330 | // For all other non-media file types (ZIP, for example), always show as a link regardless of setting. |
| 331 | 331 | else { |
| 332 | - $field_settings['link_to_file'] = true; |
|
| 332 | + $field_settings[ 'link_to_file' ] = true; |
|
| 333 | 333 | $disable_lightbox = true; |
| 334 | 334 | } |
| 335 | 335 | |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | $disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', false, $field_compat, $context ); |
| 346 | 346 | |
| 347 | 347 | // Output textualized content where |
| 348 | - if ( ! $disable_wrapped_link && ( ! empty( $field_settings['link_to_file'] ) || ! empty( $field_settings['show_as_link'] ) ) ) { |
|
| 348 | + if ( ! $disable_wrapped_link && ( ! empty( $field_settings[ 'link_to_file' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) ) { |
|
| 349 | 349 | /** |
| 350 | 350 | * Modify the link text (defaults to the file name) |
| 351 | 351 | * |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | */ |
| 359 | 359 | $content = apply_filters( 'gravityview/fields/fileupload/link_content', $text, $field_compat, $context ); |
| 360 | 360 | |
| 361 | - if ( empty( $field_settings['show_as_link'] ) ) { |
|
| 361 | + if ( empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 362 | 362 | /** |
| 363 | 363 | * @filter `gravityview/fields/fileupload/link_atts` Modify the link attributes for a file upload field |
| 364 | 364 | * @since 2.0 Added $context |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | $content = empty( $rendered ) ? $text : $rendered; |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | - $output_arr[] = array( |
|
| 382 | + $output_arr[ ] = array( |
|
| 383 | 383 | 'file_path' => $file_path, |
| 384 | 384 | 'content' => $content |
| 385 | 385 | ); |