admin
2 months ago
css
2 months ago
js
2 months ago
public
2 months ago
album-default.php
2 months ago
album-stack.php
2 months ago
class-albums-extension.php
2 months ago
class-foogallery-album.php
2 months ago
class-posttypes.php
2 months ago
foogallery-albums.png
2 months ago
functions.php
2 months ago
album-stack.php
92 lines
| 1 | <?php |
| 2 | /** |
| 3 | * FooGallery All-In-One Stack Album template |
| 4 | */ |
| 5 | global $current_foogallery_album; |
| 6 | global $current_foogallery_album_arguments; |
| 7 | global $current_foogallery; |
| 8 | |
| 9 | |
| 10 | $args = foogallery_album_template_setting( 'thumbnail_dimensions', array() ); |
| 11 | $args['crop'] = true; |
| 12 | $lightbox = foogallery_album_template_setting( 'lightbox', 'unknown' ); |
| 13 | if ( $lightbox === 'foogallery' ) { |
| 14 | $lightbox = 'unknown'; |
| 15 | } |
| 16 | $random_angle = foogallery_album_template_setting( 'random_angle', 'false' ); |
| 17 | $gutter = foogallery_album_template_setting( 'gutter', '40' ); |
| 18 | $pile_angles = foogallery_album_template_setting( 'pile_angles', '2' ); |
| 19 | $foogallery_album_caption_alignment = sanitize_key( foogallery_album_template_setting( 'caption_alignment', 'center' ) ); |
| 20 | if ( ! in_array( $foogallery_album_caption_alignment, array( 'left', 'center', 'right' ), true ) ) { |
| 21 | $foogallery_album_caption_alignment = 'center'; |
| 22 | } |
| 23 | $foogallery_album_show_gallery_description_in_caption = 'on' === foogallery_album_template_setting( 'show_gallery_description_in_caption', '' ); |
| 24 | |
| 25 | $data_options = array( |
| 26 | 'itemWidth' => intval( $args['width'] ), |
| 27 | 'itemHeight' => intval( $args['height'] ), |
| 28 | 'gutter' => intval( $gutter ), |
| 29 | 'angleStep' => intval( $pile_angles ), |
| 30 | 'randomAngle' => 'true' === $random_angle |
| 31 | ); |
| 32 | |
| 33 | $data_options = foogallery_json_encode( $data_options ); |
| 34 | |
| 35 | if ( !function_exists( 'foogallery_album_all_in_one_stack_render_gallery_attachment2' ) ) { |
| 36 | function foogallery_album_all_in_one_stack_render_gallery_attachment2( $gallery, $attachment, $args ) { |
| 37 | echo '<li class="fg-pile-item">'; |
| 38 | $args['link_attributes']['class'] = apply_filters( 'foogallery_album_stack_link_class_name', 'fg-pile-item-thumb' ); |
| 39 | |
| 40 | $anchor_html = foogallery_attachment_html_anchor_opening( $attachment, $args ); |
| 41 | $anchor_html = str_replace( 'fg-thumb', '', $anchor_html ); |
| 42 | echo $anchor_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 43 | |
| 44 | $image_html = foogallery_attachment_html_image( $attachment, $args ); |
| 45 | $image_html = str_replace( 'fg-image', 'fg-pile-item-image', $image_html ); |
| 46 | echo $image_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 47 | |
| 48 | $captions = foogallery_build_attachment_html_caption( $attachment, $args ); |
| 49 | if ( $captions !== false ) { |
| 50 | echo '<span class="fg-pile-item-caption">'; |
| 51 | if ( array_key_exists( 'title', $captions ) ) { |
| 52 | echo '<span class="fg-pile-item-title">' . $captions['title'] . '</span>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 53 | } |
| 54 | if ( array_key_exists( 'desc', $captions ) ) { |
| 55 | echo '<span class="fg-pile-item-desc">' . $captions['desc'] . '</span>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 56 | } |
| 57 | echo '</span>'; |
| 58 | } |
| 59 | |
| 60 | echo '</a>'; |
| 61 | echo '</li>'; |
| 62 | } |
| 63 | } |
| 64 | ?> |
| 65 | <div id="foogallery-album-<?php echo esc_attr( $current_foogallery_album->ID ); ?>" class="foogallery-container foogallery-stack-album" data-foogallery="<?php echo esc_attr( $data_options ); ?>"> |
| 66 | <div class="fg-header"> |
| 67 | <h2 class="fg-header-title"><?php echo esc_html( $current_foogallery_album->name ); ?></h2> |
| 68 | <span class="fg-header-back">←</span> |
| 69 | <h3 class="fg-header-active"></h3> |
| 70 | </div> |
| 71 | <div class="fg-piles"> |
| 72 | <?php |
| 73 | foreach ( $current_foogallery_album->galleries() as $gallery ) { |
| 74 | $foogallery_album_gallery_description = $foogallery_album_show_gallery_description_in_caption ? foogallery_album_gallery_description_html( $gallery ) : ''; |
| 75 | ?><ul class="fg-pile <?php echo esc_attr( $lightbox ); ?>" data-title="<?php echo esc_attr( $gallery->name ); ?>" data-caption-alignment="<?php echo esc_attr( $foogallery_album_caption_alignment ); ?>"<?php echo ! empty( $foogallery_album_gallery_description ) ? ' data-description="' . esc_attr( $foogallery_album_gallery_description ) . '"' : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Attribute value escaped above. ?>><?php |
| 76 | $current_foogallery = $gallery; |
| 77 | $featured_attachment = $gallery->featured_attachment(); |
| 78 | //render the featured attachment first |
| 79 | foogallery_album_all_in_one_stack_render_gallery_attachment2( $gallery, $featured_attachment, $args, $lightbox ); |
| 80 | |
| 81 | foreach ( $gallery->attachments() as $attachment ) { |
| 82 | if ( $featured_attachment->ID !== $attachment->ID ) { |
| 83 | //render all but the featured attachment |
| 84 | foogallery_album_all_in_one_stack_render_gallery_attachment2( $gallery, $attachment, $args, $lightbox ); |
| 85 | } |
| 86 | } |
| 87 | ?></ul><?php |
| 88 | } |
| 89 | ?> |
| 90 | </div> |
| 91 | </div> |
| 92 |