*/
namespace SmartPostShow\Blocks;
use SmartPostShow\Blocks\Helper;
if ( ! defined( 'ABSPATH' ) ) {
die;
}
/**
* Post Content render Class.
*/
class Template_Part {
/**
* Preloader
*
* @param bool $preloader_enable enable preloader.
* @param url $preloader_svg svg img url.
* @return void
*/
public static function preloader_front( $preloader_enable, $preloader_svg ) {
ob_start();
if ( $preloader_enable ) { ?>
' : '';
// Feature image replace to post content image or video.
if ( 'source' === $image_fallback_replace && empty( $feature_image ) ) {
$feature_image = Helper::get_media_from_content( $attributes, $data );
}
// Feature image replace to custom image or video.
if ( 'custom' === $image_fallback_replace && empty( $feature_image ) ) {
if ( 'img' === $toggle_custom_fallback_bg ) {
$feature_image = '
';
}
if ( 'video' === $toggle_custom_fallback_bg ) {
$feature_image = '';
}
}
if ( empty( $feature_image ) && $attachment_url ) {
$feature_image = '
';
}
$feature_image = ! empty( $feature_image ) ? $feature_image : '
';
preg_match( '/
]+src=["\']([^"\']+)["\']/', $feature_image, $video_feature_image );
$random_bg_color = self::random_color( $color_type );
$show_video_play_icon_class = '';
// Category hide in feature image area.
if ( $cat_hide ) {
$cat_hide = ! in_array( $category_position, array( '', 'beside-other-meta' ), true );
if ( $cat_hide && ( 'orientation_three' === $orientation || 'orientation_four' === $orientation ) ) {
$cat_hide = true;
}
}
if ( $enable_image ) {
ob_start()
?>
class="" data-post-id="">
< class="sp-smart-post-title ">
>
$category_list,
'post_tag' => $tag_list,
);
if ( '' === $cat_tab_category_type ) {
$taxonomy_list[ $cat_tab_category_type ] = $all_term_list;
}
if ( $show_category ) {
ob_start()
?>
$category_list,
'post_tag' => $tag_list,
);
if ( '' === $category_type ) {
$taxonomy_list[ $category_type ] = $all_term_list;
}
if ( $show_category ) {
ob_start()
?>
Min Read
' ',
'full-stop' => '.',
'straight-line' => '|',
'slash' => '/',
'back-slash' => '\',
);
/**
* Meta Separator Markup function
*
* @param string $attr meta separator type name.
*
* @return string html markup.
*/
public static function meta_separator( $attr ) {
if ( empty( $attr ) || 'normal-space' === $attr ) {
return '';
}
ob_start();
?>
self::author( $attributes, $data ),
'date' => 'orientation_two' !== $orientation ? self::date( $attributes, $data ) : null,
'comments' => self::comment( $data ),
'views' => self::views( $data ),
// 'likes' => self::like( $data ),
'reading-time' => self::read_time( $data, $attributes ),
'taxonomy' => 'beside-other-meta' === $category_position ? self::category_two( $attributes, $data ) : null,
);
// Social Share popup class.
$social_enable = ! empty( $attributes['socialShareEnableSocial'] ) ?? false;
$social_display_type = isset( $attributes['socialIconDisplayType'] ) ? $attributes['socialIconDisplayType'] : '';
$social_icon_position = isset( $attributes['socialShareIconPosition'] ) ? $attributes['socialShareIconPosition'] : '';
$social_condition = $social_enable && 'popup-share' === $social_display_type && 'space-between-meta' === $social_icon_position;
$social_share_classes = $social_condition ? ' sp-space-between' : '';
ob_start();
?>
role="button">
'',
'facebook' => 'https://www.facebook.com/sharer/sharer.php?u=' . $permalink,
'twitter' => 'https://twitter.com/intent/tweet?url=' . $permalink,
'x' => 'https://twitter.com/intent/tweet?url=' . $permalink,
'linkedin' => 'https://www.linkedin.com/sharing/share-offsite/?url=' . $permalink,
'pinterest' => 'https://pinterest.com/pin/create/button/?url=' . $permalink . '&media=' . $data['post_thumbnail_url'],
'instagram' => 'https://www.instagram.com/?url=' . $permalink,
'vkontakte' => 'https://vk.com/share.php?url=' . $permalink,
'digg' => 'http://digg.com/submit?url=' . $permalink,
'tumblr' => 'https://www.tumblr.com/widgets/share/tool?canonicalUrl=' . $permalink,
'reddit' => 'https://www.reddit.com/submit?url=' . $permalink,
'whatsapp' => 'https://api.whatsapp.com/send?text=' . $permalink,
'pocket' => 'https://getpocket.com/save?url=' . $permalink,
'xing' => 'https://www.xing.com/spi/shares/new?url=' . $permalink,
'mail' => 'mailto:?subject=&body=' . $permalink,
);
ob_start();
?>
$value ) {
if ( strpos( $key, 'sp-smart-filter-' ) === 0 ) {
$live_filter_parent[ $key ] = $value;
}
}
$parent_id = $live_filter_parent['uniqueId'] ?? '';
$field_alignment = $live_filter_parent['fieldAlignment'] ?? 'full';
?>
class="">
$attr ) {
if ( strpos( $key, 'sp-smart-taxonomy-filter-' ) === 0 ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo self::taxonomy_filter( $attr );
}
if ( strpos( $key, 'sp-author-filter-' ) === 0 ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo self::author_filter( $attr );
}
}
?>
false,
'date' => false,
'comments' => false,
'views' => false,
'likes' => false,
'reading-time' => false,
);
foreach ( $meta_data_attr as $item ) {
if ( isset( $item['value'] ) && array_key_exists( $item['value'], $flags ) ) {
$flags[ $item['value'] ] = ! empty( $item['show'] ) && 1 == $item['show'];
}
}
// Reading time array.
$reading_time = json_encode( $attributes['metaPerMin'] );
// Author.
$icon_type = isset( $attributes['metaUserIcon'] ) ? $attributes['metaUserIcon'] : 'outline';
$user_icon = Helper::get_author_icon( $icon_type );
$modal_popup = array( 'single-popup', 'multi-popup' );
// Post Badges.
$post_badges_show = isset( $attributes['postBadgesShow'] ) ? $attributes['postBadgesShow'] : false;
$post_badges_position = isset( $attributes['postBadgesPosition'] ) ? $attributes['postBadgesPosition'] : 'before-title';
$badges_global_typo = isset( $attributes['postBadgesGlobalTypography']['class'] ) ? $attributes['postBadgesGlobalTypography']['class'] : '';
if ( ! in_array( $open_link_in, $modal_popup ) ) {
return null;
}
ob_start();
?>