build_my_video_html

The Facebook Feed build my video html function.

Description

build_my_video_html( $mysinglefeed, $atts ); 

Parameters (2)

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

Usage

  1. if ( !function_exists( 'build_my_video_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_my_video_html($mysinglefeed, $atts); 
  12.  

Defined (1)

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

/facebook-feed-shortcode.php  
  1. function build_my_video_html ($mysinglefeed , $atts) 
  2. if (isset($mysinglefeed->story)) 
  3. // if story exists then use the story in the post text 
  4. $my_post_text = $mysinglefeed->story;  
  5. if (isset($mysinglefeed->message)) 
  6. // if story exists then use the story in the post text 
  7. $my_post_text = $mysinglefeed->message;  
  8. $my_post_text = makeLinks($my_post_text, $atts['link_target']); 
  9. if(!preg_match('/((http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2, 3}(\/\S*)?)#(\w*[a-zA-Z_]+\w*)/', $my_post_text)) { 
  10. $my_post_text = make_hash_link($my_post_text, $atts['link_target']); 
  11.  
  12. // Build Post description  
  13. // first hyper link the name 
  14. $name_var = (isset($mysinglefeed->name) ? $mysinglefeed->name : ''); 
  15. $name_url = (isset($mysinglefeed->link) ? $mysinglefeed->link : ''); 
  16.  
  17. $link_post_desc = (isset($mysinglefeed->description) ? $mysinglefeed->description : ''); 
  18. $link_post_desc = makeLinks($link_post_desc, $atts['link_target']); 
  19. if(!preg_match('/((http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2, 3}(\/\S*)?)#(\w*[a-zA-Z_]+\w*)/', $link_post_desc)) { 
  20. $link_post_desc = make_hash_link($link_post_desc, $atts['link_target']); 
  21. }  
  22. if (array_key_exists('message_tags', $mysinglefeed )) 
  23. // now add the hyperlink to tags  
  24. foreach ( $mysinglefeed->message_tags as $mymessagetag) 
  25. {  
  26. $mymessagetagname = $mymessagetag[0]->name;  
  27. if($atts['link_target']==1) { 
  28. $tag_link = '<a class="wff-link-tab" href="http://facebook.com/' . $mymessagetag[0]->id . '" style="color: red;" target="_blank">' . $mymessagetag[0]->name . '</a>'; 
  29. } else { 
  30. $tag_link = '<a class="wff-link-tab" href="http://facebook.com/' . $mymessagetag[0]->id . '" style="color: red;" >' . $mymessagetag[0]->name . '</a>'; 
  31. $my_post_text = str_replace($mymessagetagname, $tag_link, $my_post_text); 
  32. }  
  33. $the_resource_id_array = explode("_", $mysinglefeed->id); 
  34. $the_resource_id = $the_resource_id_array[1]; 
  35.  
  36. $post_resource_link = 'https://facebook.com/'.$atts['page_id'] .'/posts/'.$the_resource_id;  
  37.  
  38. //call post text inline style 
  39. $limited_style_wrapper = limited_post_text_inline_style($atts); 
  40. $full_style_wrapper = full_post_text_inline_style($atts); 
  41. $line_height_style = feed_line_height($atts); 
  42. /**---------------------read more text---------------------------*/ 
  43. $str_without_tag = strip_tags($my_post_text); 
  44. $char_count = strlen($str_without_tag); 
  45.  
  46. if((!empty($atts['char_limit'])) && ($atts['char_limit'] < $char_count) ) 
  47. $short_sentence = substr($str_without_tag, 0, $atts['char_limit']); 
  48.  
  49. $short_sentence = makeLinks ($short_sentence, $atts['link_target']); // link the urls 
  50. if(!preg_match('/((http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2, 3}(\/\S*)?)#(\w*[a-zA-Z_]+\w*)/', $short_sentence)) { 
  51. $short_sentence = make_hash_link ($short_sentence, $atts['link_target']); 
  52. if (array_key_exists('message_tags', $mysinglefeed )) 
  53. foreach( $mysinglefeed->message_tags as $mymessagetag)// now add the hyperlink to tags  
  54. {  
  55. $mymessagetagname = $mymessagetag[0]->name;  
  56. if($atts['link_target']==1) {  
  57. $tag_link = '<a class="wff-link-tab" href="http://facebook.com/' . $mymessagetag[0]->id . '" style="color: red;" target="_blank">' . $mymessagetag[0]->name . '</a>'; 
  58. } else { 
  59. $tag_link = '<a class="wff-link-tab" href="http://facebook.com/' . $mymessagetag[0]->id . '" style="color: red;" >' . $mymessagetag[0]->name . '</a>'; 
  60. $short_sentence = str_replace($mymessagetagname, $tag_link, $short_sentence); 
  61. }  
  62.  
  63. $mytext = '<p class = "wff-post-text" '.$limited_style_wrapper.'>'.$short_sentence.'...<span><a class="wff-more-link">'.$atts['read_more'].'</a></span></p>';  
  64. $mytext .= '<p class="more-content" '.$full_style_wrapper.'>'.$my_post_text.'...<span><a class="wff-less-link" style="display:none">'.$atts['read_less'].'</a></span></p>'; 
  65. }  
  66. else{ 
  67. $mytext = '<p class = "wff-post-text" '.$limited_style_wrapper.'>'.$my_post_text.'</p>'; 
  68. /**------------------------------------------------*/ 
  69. if(isset($mysinglefeed->description)) { 
  70. if($atts['link_target']==1) {  
  71. $build_link_title = '<p class = "wff-link-title" '.$line_height_style.'><a class="wff-link-tab" target="_blank" href =' .$name_url.'>'.$name_var.'</a></p>';  
  72. } else { 
  73. $build_link_title = '<p class = "wff-link-title" '.$line_height_style.'><a class="wff-link-tab" href =' .$name_url.'>'.$name_var.'</a></p>'; 
  74. }  
  75. $mytext .= '<div class = "wff-shared-link-wrapper">'.$build_link_title.'<p class = "wff-post-description" '.$line_height_style.'>'.$link_post_desc.'</p></div>'; 
  76.  
  77. //$mytext .= $build_post_desc_html ; 
  78. if($atts['link_target']==1) { 
  79. $mytext .= '<div class = "wff-view-on-facebook"><a class="wff-link-tab" href = '. $post_resource_link.' target = "_blank">'.$atts['page_link_text'].'</a></div>'; 
  80. } else { 
  81. $mytext .= '<div class = "wff-view-on-facebook"><a class="wff-link-tab" href = '. $post_resource_link.' >'.$atts['page_link_text'].'</a></div>'; 
  82. return $mytext;