abilities
2 months ago
admin
2 months ago
compatibility
2 months ago
extensions
2 months ago
foopluginbase
2 months ago
public
2 months ago
thumbs
2 months ago
asset-manifest.php
2 months ago
class-attachment-filters.php
2 months ago
class-command-palette.php
2 months ago
class-foogallery-animated-gif-support.php
2 months ago
class-foogallery-attachment-custom-class.php
2 months ago
class-foogallery-attachment-filename.php
2 months ago
class-foogallery-attachment-type.php
2 months ago
class-foogallery-attachment.php
2 months ago
class-foogallery-cache.php
2 months ago
class-foogallery-common-fields.php
2 months ago
class-foogallery-crop-position.php
2 months ago
class-foogallery-datasource-media_library.php
2 months ago
class-foogallery-debug.php
2 months ago
class-foogallery-delayed-runtime-loader.php
2 months ago
class-foogallery-extensions-compatibility.php
2 months ago
class-foogallery-force-https.php
2 months ago
class-foogallery-lazyload.php
2 months ago
class-foogallery-license-constant-handler.php
2 months ago
class-foogallery-lightbox.php
2 months ago
class-foogallery-paging.php
2 months ago
class-foogallery-password-protect.php
2 months ago
class-foogallery-sitemaps.php
2 months ago
class-foogallery-widget.php
2 months ago
class-foogallery.php
2 months ago
class-gallery-advanced-settings.php
2 months ago
class-il8n.php
2 months ago
class-override-thumbnail.php
2 months ago
class-posttypes.php
2 months ago
class-previews.php
2 months ago
class-retina.php
2 months ago
class-thumbnail-dimensions.php
2 months ago
class-thumbnails.php
2 months ago
class-version-check.php
2 months ago
constants.php
2 months ago
functions.php
2 months ago
includes.php
2 months ago
index.php
2 months ago
render-functions.php
2 months ago
class-attachment-filters.php
56 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Create some template specific filters for overriding html attributes when rendering galleries |
| 4 | * |
| 5 | * So, instead of hooking into 'foogallery_attachment_html_image_attributes' and checking that the gallery template being used is 'default', |
| 6 | * now rather just hook into 'foogallery_attachment_html_image_attributes-default'. |
| 7 | */ |
| 8 | |
| 9 | if ( ! class_exists( 'FooGallery_Attachment_Filters' ) ) { |
| 10 | class FooGallery_Attachment_Filters { |
| 11 | |
| 12 | function __construct() { |
| 13 | add_filter( 'foogallery_attachment_html_image_attributes', array( $this, 'attachment_html_image_attributes' ), 20, 3 ); |
| 14 | add_filter( 'foogallery_attachment_html_link_attributes', array( $this, 'attachment_html_link_attributes' ), 20, 3 ); |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * Apply a template-specific filter for overriding the image attributes |
| 19 | * |
| 20 | * @param $attr array |
| 21 | * @param $args array |
| 22 | * @param $attachment FooGalleryAttachment |
| 23 | * |
| 24 | * @return array |
| 25 | */ |
| 26 | function attachment_html_image_attributes( $attr, $args, $attachment ) { |
| 27 | global $current_foogallery; |
| 28 | |
| 29 | if ( $current_foogallery && $current_foogallery->gallery_template ) { |
| 30 | $attr = apply_filters( "foogallery_attachment_html_image_attributes-{$current_foogallery->gallery_template}", $attr, $args, $attachment ); |
| 31 | } |
| 32 | |
| 33 | return $attr; |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Apply a template-specific filter for overriding the link attributes |
| 38 | * |
| 39 | * @param $attr array |
| 40 | * @param $args array |
| 41 | * @param $attachment FooGalleryAttachment |
| 42 | * |
| 43 | * @return array |
| 44 | */ |
| 45 | function attachment_html_link_attributes( $attr, $args, $attachment ) { |
| 46 | global $current_foogallery; |
| 47 | |
| 48 | if ( $current_foogallery && $current_foogallery->gallery_template ) { |
| 49 | $attr = apply_filters( "foogallery_attachment_html_link_attributes-{$current_foogallery->gallery_template}", $attr, $args, $attachment ); |
| 50 | } |
| 51 | |
| 52 | return $attr; |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 |