item
3 weeks ago
credit.php
3 weeks ago
error-message.php
3 weeks ago
header.php
3 weeks ago
index.php
3 weeks ago
likebox.php
3 weeks ago
header.php
116 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Custom Facebook Feed Header Template |
| 5 | * Adds account information and an avatar to the top of the feed |
| 6 | * |
| 7 | * @version 2.15 Custom Facebook Feed by Smash Balloon |
| 8 | */ |
| 9 | |
| 10 | use CustomFacebookFeed\CFF_Parse; |
| 11 | use CustomFacebookFeed\CFF_Utils; |
| 12 | use CustomFacebookFeed\CFF_Shortcode_Display; |
| 13 | |
| 14 | // Don't load directly |
| 15 | if (! defined('ABSPATH')) { |
| 16 | die('-1'); |
| 17 | } |
| 18 | |
| 19 | $cff_header_styles = $this_class->get_style_attribute('header'); |
| 20 | |
| 21 | |
| 22 | |
| 23 | // Check Header Type |
| 24 | if ($cff_header_type == "text") : // Start Text Header |
| 25 | $cff_icon_style = $this_class->get_style_attribute('header_icon'); |
| 26 | $cff_header_classes = CFF_Shortcode_Display::get_header_txt_classes($cff_header_outside); |
| 27 | ?> |
| 28 | <h3 class="cff-header <?php echo esc_attr($cff_header_classes) ?>" <?php echo $cff_header_styles ?>> |
| 29 | <span class="fa fab fa-<?php echo esc_attr($atts['headericon']) ?>" <?php echo $cff_icon_style ?> aria-hidden="true"></span> |
| 30 | <span class="header-text"><?php echo wp_kses_post(stripslashes($atts['headertext'])); ?></span> |
| 31 | </h3> |
| 32 | <?php |
| 33 | // End Text Header |
| 34 | elseif ($cff_header_type == "visual" && $cff_show_header) : // Start Visual Header |
| 35 | $header_details = CFF_Utils::fetch_header_data($page_id, $cff_is_group, $access_token, $cff_cache_time, false, $data_att_html); |
| 36 | if (isset($header_details->error)) { |
| 37 | return ''; |
| 38 | } |
| 39 | |
| 40 | $header_parts = CFF_Shortcode_Display::get_header_parts($atts); |
| 41 | $cff_header_cover = $header_parts['cover']; |
| 42 | $cff_header_name = $header_parts['name']; |
| 43 | $cff_header_bio = $header_parts['bio']; |
| 44 | $header_style_attribute = $this_class->get_style_attribute('header_visual'); |
| 45 | $header_bio_style_attribute = $this_class->get_style_attribute('header_bio'); |
| 46 | |
| 47 | $header_data = $header_details; |
| 48 | |
| 49 | |
| 50 | $link = CFF_Shortcode_Display::get_header_link($header_data, $page_id); |
| 51 | $avatar = CFF_Parse::get_avatar($header_data); |
| 52 | $avatar_img_src = CFF_Shortcode_Display::avatar_src($header_data, $atts); |
| 53 | |
| 54 | $name = CFF_Parse::get_name($header_data); |
| 55 | $cover_url = CFF_Parse::get_cover_source($header_data); |
| 56 | $cover_img_src = CFF_Shortcode_Display::cover_image_src($header_data, $atts); |
| 57 | |
| 58 | $likes_count = CFF_Parse::get_likes($header_data); |
| 59 | $bio = CFF_Parse::get_bio($header_data); |
| 60 | $should_show_bio = $bio !== '' ? $cff_header_bio : false; |
| 61 | $bio_class = $cff_header_bio ? ' cff-has-about' : ''; |
| 62 | $avatar_class = $cff_header_name ? ' cff-has-name' : ''; |
| 63 | $cover_class = $cff_header_cover ? ' cff-has-cover' : ''; |
| 64 | $header_font_size = CFF_Shortcode_Display::get_header_font_size($atts); |
| 65 | $header_hero_style = CFF_Shortcode_Display::get_header_height_style($atts); |
| 66 | |
| 67 | if (empty($cover_url)) { |
| 68 | $cff_header_cover = false; |
| 69 | $cover_class = ''; |
| 70 | } |
| 71 | if (empty($likes_count)) { |
| 72 | $cff_header_bio = false; |
| 73 | } |
| 74 | |
| 75 | |
| 76 | $square_logo = '<svg aria-hidden="true" focusable="false" data-prefix="fab" data-icon="facebook-square" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" class="svg-inline--fa fa-facebook-square fa-w-14"><path fill="currentColor" d="M400 32H48A48 48 0 0 0 0 80v352a48 48 0 0 0 48 48h137.25V327.69h-63V256h63v-54.64c0-62.15 37-96.48 93.67-96.48 27.14 0 55.52 4.84 55.52 4.84v61h-31.27c-30.81 0-40.42 19.12-40.42 38.73V256h68.78l-11 71.69h-57.78V480H400a48 48 0 0 0 48-48V80a48 48 0 0 0-48-48z" class=""></path></svg>'; |
| 77 | ?> |
| 78 | <div id="cff-visual-header-<?php echo esc_attr(preg_replace("/[^A-Za-z0-9]/", '', $page_id)); ?>" class="cff-visual-header<?php echo $avatar_class . $bio_class . $cover_class ?>"> |
| 79 | <?php CFF_Shortcode_Display::print_gdpr_notice('Visual Header'); ?> |
| 80 | <?php if ($cff_header_cover) : ?> |
| 81 | <div class="cff-header-hero"<?php echo $header_hero_style; ?>> |
| 82 | <img src="<?php echo esc_url($cover_img_src); ?>" alt="<?php echo esc_attr(sprintf(__('Cover for %s', 'custom-facebook-feed'), $name)); ?>" data-cover-url="<?php echo esc_url($cover_url); ?>"> |
| 83 | <?php if ($cff_header_bio) : ?> |
| 84 | <div class="cff-likes-box"> |
| 85 | <div class="cff-square-logo"><?php echo $square_logo; ?></div> |
| 86 | <div class="cff-likes-count"> |
| 87 | <?php echo number_format($likes_count, 0); ?> |
| 88 | </div> |
| 89 | </div> |
| 90 | <?php endif; ?> |
| 91 | </div> |
| 92 | <?php endif; ?> |
| 93 | <div class="cff-header-inner-wrap"> |
| 94 | <?php if ($cff_header_name && $avatar !== '') : ?> |
| 95 | <div class="cff-header-img"> |
| 96 | <a href="<?php echo esc_url($link); ?>" target="_blank" rel="nofollow noopener" title="<?php echo esc_attr($name); ?>"><img src="<?php echo esc_url($avatar_img_src); ?>" alt="<?php echo esc_attr($name); ?>" data-avatar="<?php echo esc_url($avatar); ?>"></a> |
| 97 | </div> |
| 98 | <?php endif; ?> |
| 99 | <div class="cff-header-text" <?php echo $header_style_attribute; ?>> |
| 100 | |
| 101 | <?php if ($cff_header_name) : ?> |
| 102 | <a href="<?php echo esc_url($link); ?>" target="_blank" rel="nofollow noopener" title="<?php echo esc_attr($name); ?>" class="cff-header-name"><h3 <?php echo $header_font_size; ?>><?php echo esc_html($name); ?></h3></a> |
| 103 | <?php endif; ?> |
| 104 | <?php if ($cff_header_bio && !$cff_header_cover) : ?> |
| 105 | <div class="cff-bio-info"> |
| 106 | <span class="cff-posts-count"><?php echo $square_logo . number_format($likes_count, 0); ?></span> |
| 107 | </div> |
| 108 | <?php endif; ?> |
| 109 | <?php if ($should_show_bio) : ?> |
| 110 | <p class="cff-bio"<?php echo $header_bio_style_attribute; ?>><?php echo str_replace('<br />', '<br>', esc_html(nl2br($bio))); ?></p> |
| 111 | <?php endif; ?> |
| 112 | </div> |
| 113 | </div> |
| 114 | </div> |
| 115 | <?php endif; // End Visual Header ?> |
| 116 |