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