Server : Apache System : Linux server.lienzindia.com 4.18.0-348.7.1.el8_5.x86_64 #1 SMP Wed Dec 22 13:25:12 UTC 2021 x86_64 User : plutus ( 1007) PHP Version : 7.4.33 Disable Function : NONE Directory : /home/plutus/public_html/wp-content/themes/vrm/inc/ |
Upload File : |
<?php namespace TotalTheme; \defined( 'ABSPATH' ) || exit; /** * Display format icons over featured images. * * @todo change to use wpex_hook_entry_media_after for better consistency. */ class Thumbnail_Format_Icons { /** * Constructor. */ public function __construct() { \add_filter( 'wpex_get_entry_media_after', [ $this, 'icon_html' ] ); } /** * Check if the thumbnail format icon html is enabled. */ protected function is_enabled(): bool { $check = ( 'post' === \get_post_type() ); /** * Filters whether the format icons are enabled. * * @param bool $check */ $check = \apply_filters( 'totaltheme/thumbnail_format_icons/is_enabled', $check ); /*** deprecated */ $check = \apply_filters( 'wpex_thumbnails_have_format_icons', $check ); $check = \apply_filters( 'wpex_has_post_thumbnail_format_icon', $check ); return (bool) $check; } /** * Return correct icon class. */ protected function icon_class( $format = '' ): string { switch ( $format ) { case 'video': $icon_class = 'ticon ticon-play'; break; case 'audio': $icon_class = 'ticon ticon-music'; break; case 'gallery': $icon_class = 'ticon ticon-file-photo-o'; break; case 'quote': $icon_class = 'ticon ticon-quote-left'; break; default: $icon_class = 'ticon ticon-file-text-o'; break; } /** * Filters the post format icon classname * * @param string $icon_class */ $icon_class = \apply_filters( 'wpex_get_thumbnail_format_icon_class', $icon_class, $format ); return (string) $icon_class; } /** * Get thumbnail format icon. */ public function icon_html( $media_after = '' ) { if ( ! $this->is_enabled() ) { return $media_after; } $post_format = \get_post_format(); $icon_class = $this->icon_class( $post_format ); if ( ! $icon_class ) { return $media_after; } if ( \str_starts_with( $icon_class, 'ticon ticon-' ) ) { $icon_html = Theme_Icons::get_icon( \str_replace( 'ticon ticon-', '', $icon_class ) ); } else { $icon_html = '<span class="' . \esc_attr( $icon_class ) . '"></span>'; } /** * Filters the thumbnail post format icon html. * * @param string $icon_html * @param string $post_format * * @todo rename filter. */ $icon_html = \apply_filters( 'wpex_get_thumbnail_format_icon_html', $icon_html, $post_format ); if ( $icon_html ) { $class = [ 'wpex-thumbnail-format-icon', 'wpex-block', 'wpex-right-0', 'wpex-bottom-0', 'wpex-mr-15', 'wpex-mb-15', 'wpex-absolute', 'wpex-text-white', 'wpex-text-center', 'wpex-leading-none', 'wpex-opacity-0', 'wpex-onload-opacity-100', ]; /** * Filters the post thumbnail format icon class. * * @param string $class * @param string $post_format */ $class = \apply_filters( 'wpex_post_thumbnail_format_icon_class', $class, $post_format ); $icon_html = '<i class="' . \esc_attr( \implode( ' ', $class ) ) . '" aria-hidden="true">' . $icon_html . '</i>'; return $media_after . $icon_html; } } }