build_author_html

The Facebook Feed build author html function.

Description

build_author_html( $mysinglefeed, $atts ); 

Parameters (2)

0. $mysinglefeed
The mysinglefeed.
1. $atts
The atts.

Usage

  1. if ( !function_exists( 'build_author_html' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'facebook-feed/facebook-feed-shortcode.php'; 
  3.  
  4. // The mysinglefeed. 
  5. $mysinglefeed = null; 
  6.  
  7. // The atts. 
  8. $atts = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = build_author_html($mysinglefeed, $atts); 
  12.  

Defined (1)

The function is defined in the following location(s).

/facebook-feed-shortcode.php  
  1. function build_author_html($mysinglefeed, $atts)  
  2. // Check if we need to apply inline styles  
  3. //Author 
  4. $wff_author_inline_style = 'style="'; 
  5. if ( !empty($atts['author_text_size']) && $atts['author_text_size'] != 'inherit' ) $wff_author_inline_style .= 'font-size:' . $atts['author_text_size'] . 'px; line-height:' . $atts['author_text_size'] . 'px; '; 
  6. if ( !empty($atts['line_height']) && $atts['line_height'] != 'inherit' ) $wff_author_inline_style .= 'line-height:' . $atts['line_height'].'px;'; 
  7. if ( !empty($atts['author_text_color']) ) $wff_author_inline_style .= 'color:' .$atts['author_text_color'] . ';'; 
  8. $wff_author_inline_style .= '"'; 
  9.  
  10. //img border size and color style 
  11. $wff_author_image_style = 'style="'; 
  12. if ( !empty($atts['author_img_border']) && $atts['author_img_border'] != 'none' ) $wff_author_image_style .= 'border:' . $atts['author_img_border'] . 'px solid '; 
  13. if ( !empty($atts['author_text_color']) ) $wff_author_image_style .= $atts['author_text_color'] .';'; 
  14. $wff_author_image_style .= '"'; 
  15.  
  16. $link_to_page = 'https://facebook.com/'.$atts['page_id']; 
  17.  
  18. // get update date 
  19. $time = strtotime($mysinglefeed->updated_time); 
  20.  
  21. //condition for date format 
  22. if($atts['author_date_format']=='default') { 
  23. $post_date_print = 'posted '.posted_time($time).' ago'; 
  24. else{ 
  25. $system_date_format = $atts['author_date_format']; 
  26. $post_date_print = date_i18n($system_date_format, $time); 
  27.  
  28. $authorname = '<div class = "wff-author-name"><p '.$wff_author_inline_style.' >'. $mysinglefeed->from->name . '</p><p class = "wff-date">'.$post_date_print.'</p></div>'; 
  29.  
  30. $authorimage = '<div class = "wff-author-image"><img '.$wff_author_image_style.' src = https://graph.facebook.com/' . $mysinglefeed->from->id . '/picture?type=square></div>'; 
  31.  
  32. $authortext = '<div class = "wff-fb-author-data" ><div class="wff-row"> 
  33. <div class="wff-facebook-feed-image-div">'.$authorimage.'</div> 
  34. <div class="wff-facebook-feed-title-div">'.$authorname.'</div> 
  35. </div></div><div class="cleafix"></div>'; 
  36.  
  37. if($atts['link_target']==1) { 
  38. $authortext = '<a class="wff-link-tab" href ='. $link_to_page .' target="_blank" >'.$authortext.'</a>'; 
  39. } else { 
  40. $authortext = '<a class="wff-link-tab" href ='. $link_to_page .'>'.$authortext.'</a>'; 
  41. $authortext = '<div class = "wff-author-wrapper">'.$authortext.'</div>'; 
  42.  
  43. return $authortext;