SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/views/image_gallery_wide_grid.php

  1. <?php
  2. /*
  3.  * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
  4.  * :tabSize=4:indentSize=4:noTabs=true:wrap=false:maxLineLen=120:mode=php:
  5.  *
  6.  * Copyright (C) 2015 Karmabunny Pty Ltd.
  7.  *
  8.  * This file is a part of SproutCMS.
  9.  *
  10.  * SproutCMS is free software: you can redistribute it and/or modify it under the terms
  11.  * of the GNU General Public License as published by the Free Software Foundation, either
  12.  * version 3 of the License, or (at your option) any later version.
  13.  *
  14.  * For more information, visit <http://getsproutcms.com>.
  15.  */
  16.  
  17. use Sprout\Helpers\Enc;
  18. use Sprout\Helpers\File;
  19. use Sprout\Helpers\Needs;
  20.  
  21.  
  22. Needs::fileGroup('magnific_popup');
  23. Needs::fileGroup('image_gallery_wide');
  24.  
  25. // Create unique identifier to allow multiple on a page
  26. $unique = md5(microtime(true));
  27. ?>
  28.  
  29. <?php if (!empty($images)): ?>
  30. <div class="-clearfix image-gallery-cols image-gallery-col-<?php echo Enc::html($row_count); ?> <?php if ($captions): ?>image-gallery-has-captions<?php endif; ?>">
  31. <?php foreach ($images as $image): ?>
  32. <?php if (!empty($image['filename']) and File::exists($image['filename'])): ?>
  33. <div class="image-gallery-thumb" <?php if ($idx++ > $num_thumbs): ?> style="display: none;" <?php endif; ?>>
  34. <a href="<?php echo Enc::html(File::resizeUrl($image['filename'], $config['full_size'])); ?>"
  35. <?php if ($captions): ?> title="<?php echo Enc::html($image['name'] . ' - ' . $image['description']); ?>"<?php endif; ?>
  36. class="thumb gallery-<?php echo Enc::html($unique); ?>">
  37. <img src="<?php echo Enc::html(File::resizeUrl($image['filename'], $config['thumb_size_' . Enc::html($row_count) . ''] . '-' . $cropping)) ?>" alt="<?php echo Enc::html($image['name']); ?>">
  38. </a>
  39. <?php if ($captions): ?>
  40. <p class="image-gallery-caption"><?php echo Enc::html($image['name']); ?></p>
  41. <?php endif; ?>
  42. </div>
  43. <?php endif; ?>
  44. <?php endforeach; ?>
  45. </div>
  46.  
  47. <script type="text/javascript">
  48. if(jQuery().magnificPopup) {
  49. $('.gallery-<?php echo Enc::js($unique); ?>').magnificPopup({
  50. type: 'image',
  51. gallery: {
  52. enabled: true
  53. }
  54. });
  55. }
  56. </script>
  57. <?php endif; ?>
  58.