function fts_twitter_func($atts) { global $connection; $twitter_show_follow_btn = get_option('twitter_show_follow_btn'); $twitter_show_follow_btn_where = get_option('twitter_show_follow_btn_where'); $twitter_show_follow_count = get_option('twitter_show_follow_count'); include_once ABSPATH . 'wp-admin/includes/plugin.php'; //$fts_functions = new feed_them_social_functions; $twitter_allow_shortlink_conversion = get_option('twitter_allow_shortlink_conversion'); $twitter_allow_videos = get_option('twitter_allow_videos'); if (isset($twitter_allow_shortlink_conversion) && $twitter_allow_shortlink_conversion == 'yes' && isset($twitter_allow_shortlink_conversion) && $twitter_allow_shortlink_conversion == 'yes') { wp_enqueue_script('fts-longurl-js', plugins_url('feed-them-social/feeds/js/jquery.longurl.js')); } // option to allow this action or not from the Twitter Options page if (is_plugin_active('feed-them-premium/feed-them-premium.php')) { include WP_CONTENT_DIR . '/plugins/feed-them-premium/feeds/twitter/twitter-feed.php'; if ($popup == 'yes') { // it's ok if these styles & scripts load at the bottom of the page $fts_fix_magnific = get_option('fts_fix_magnific') ? get_option('fts_fix_magnific') : ''; if (isset($fts_fix_magnific) && $fts_fix_magnific !== '1') { wp_enqueue_style('fts-popup', plugins_url('feed-them-social/feeds/css/magnific-popup.css')); } wp_enqueue_script('fts-popup-js', plugins_url('feed-them-social/feeds/js/magnific-popup.js')); } } else { extract(shortcode_atts(array('twitter_name' => '', 'twitter_height' => '', 'description_image' => '', 'search' => ''), $atts)); $tweets_count = '5'; } ob_start(); $numTweets = $tweets_count; $name = $twitter_name; $excludeReplies = true; if (!empty($search)) { $data_cache = 'twitter_data_cache_' . $search . '_num' . $numTweets . ''; } else { $data_cache = 'twitter_data_cache_' . $name . '_num' . $numTweets . ''; } //Check Cache if (false !== ($transient_exists = $this->fts_check_feed_cache_exists($data_cache))) { $fetchedTweets = $this->fts_get_feed_cache($data_cache); $cache_used = true; } else { include_once WP_CONTENT_DIR . '/plugins/feed-them-social/feeds/twitter/twitteroauth/twitteroauth.php'; $fts_twitter_custom_consumer_key = get_option('fts_twitter_custom_consumer_key'); $fts_twitter_custom_consumer_secret = get_option('fts_twitter_custom_consumer_secret'); $fts_twitter_custom_access_token = get_option('fts_twitter_custom_access_token'); $fts_twitter_custom_access_token_secret = get_option('fts_twitter_custom_access_token_secret'); //Use custom api info if (!empty($fts_twitter_custom_consumer_key) && !empty($fts_twitter_custom_consumer_secret) && !empty($fts_twitter_custom_access_token) && !empty($fts_twitter_custom_access_token_secret)) { $connection = new TwitterOAuthFTS($fts_twitter_custom_consumer_key, $fts_twitter_custom_consumer_secret, $fts_twitter_custom_access_token, $fts_twitter_custom_access_token_secret); } else { $connection = new TwitterOAuthFTS('dOIIcGrhWgooKquMWWXg', 'qzAE4t4xXbsDyGIcJxabUz3n6fgqWlg8N02B6zM', '1184502104-Cjef1xpCPwPobP5X8bvgOTbwblsmeGGsmkBzwdB', 'd789TWA8uwwfBDjkU0iJNPDz1UenRPTeJXbmZZ4xjY'); } // $videosDecode = 'https://api.twitter.com/1.1/statuses/oembed.json?id=507185938620219395'; // If excluding replies, we need to fetch more than requested as the // total is fetched first, and then replies removed. $totalToFetch = $excludeReplies ? max(50, $numTweets * 3) : $numTweets; $description_image = !empty($description_image) ? $description_image : ""; // $url_of_status = !empty($url_of_status) ? $url_of_status : ""; // $widget_type_for_videos = !empty($widget_type_for_videos) ? $widget_type_for_videos : ""; if (!empty($search)) { $fetchedTweets = $connection->get('search/tweets', array('q' => $search, 'count' => $totalToFetch, 'result_type' => 'recent')); } else { $fetchedTweets = $connection->get('statuses/user_timeline', array('screen_name' => $name, 'count' => $totalToFetch, 'exclude_replies' => $excludeReplies, 'images' => $description_image)); } // echo'<pre>'; // print_r($fetchedTweets); // echo'</pre>'; if (!empty($search)) { $fetchedTweets = $fetchedTweets->statuses; } else { $fetchedTweets = $fetchedTweets; } // $screen_name = $q; } //END ELSE //Error Check if (isset($fetchedTweets->errors)) { $error_check = '<div>Oops, Somethings wrong. ' . $fetchedTweets->errors[0]->message . '.</div>'; if ($fetchedTweets->errors[0]->code == 32) { $error_check .= ' Please check that you have entered your Twitter API token information correctly.'; } if ($fetchedTweets->errors[0]->code == 34) { $error_check .= ' Please check the Twitter Username you have entered is correct.'; } } elseif (empty($fetchedTweets) && !isset($fetchedTweets->errors)) { $error_check = '<div>This account has no tweets. Please Tweet to see this feed.</div>'; } //IS RATE LIMIT REACHED? if (isset($fetchedTweets->errors)) { echo '<pre>'; print_r($fetchedTweets->errors); echo 'If you are seeing Rate Limited Exceeded please go to our Twitter Options page and follow the instructions under the header Twitter API Token.'; echo '</pre>'; } // Did the fetch fail? if (isset($error_check)) { echo $error_check; } else { if (!empty($fetchedTweets)) { //Cache It if (!isset($cache_used)) { $this->fts_create_feed_cache($data_cache, $fetchedTweets); } // Fetch succeeded. // Now update the array to store just what we need. // (Done here instead of PHP doing this for every page load) $limitToDisplay = min($numTweets, count($fetchedTweets)); for ($i = 0; $i < $limitToDisplay; $i++) { $tweet = $fetchedTweets[$i]; // Core info. $name = isset($tweet->user->name) ? $tweet->user->name : ""; $screen_name = isset($tweet->user->screen_name) ? $tweet->user->screen_name : ""; $protocol = isset($_SERVER["HTTPS"]) ? 'https://' : 'http://'; $not_protocol = !isset($_SERVER["HTTPS"]) ? 'https://' : 'http://'; $permalink = $protocol . 'twitter.com/' . $screen_name . '/status/' . $tweet->id_str; $user_permalink = $protocol . 'twitter.com/#!/' . $screen_name; //Is Media Set if (isset($tweet->entities->media[0]->media_url)) { $media_url = $tweet->entities->media[0]->media_url; $media_url = str_replace($not_protocol, $protocol, $media_url); } else { $media_url = ''; } // $widget_type_for_videos = $tweet->widget_type_for_videos; /* Alternative image sizes method: http://dev.twitter.com/doc/get/users/profile_image/:screen_name */ $image = isset($tweet->user->profile_image_url) ? $tweet->user->profile_image_url : ""; $image = str_replace($not_protocol, $protocol, $image); // Message. Convert links to real links. $pattern = array('/http:(\\S)+/', '/https:(\\S)+/', '/([^a-zA-Z0-9-_&])@([0-9a-zA-Z_]+)/', '/([^a-zA-Z0-9-_&])#([0-9a-zA-Z_]+)/'); $replace = array(' <a href="${0}" target="_blank" rel="nofollow">${0}</a>', ' <a href="${0}" target="_blank" rel="nofollow">${0}</a>', ' <a href="' . $protocol . 'twitter.com/$2" target="_blank" rel="nofollow">@$2</a>', ' <a href="' . $protocol . 'twitter.com/search?q=%23$2&src=hash" target="_blank" rel="nofollow">#$2</a>'); $text = preg_replace($pattern, $replace, $tweet->text); // Need to get time in Unix format. $times = isset($tweet->created_at) ? $tweet->created_at : ""; $ftsCustomDate = get_option('fts-custom-date'); $ftsCustomTime = get_option('fts-custom-time'); $CustomDateCheck = get_option('fts-date-and-time-format'); if ($ftsCustomDate == '' && $ftsCustomTime == '') { $CustomDateFormatTwitter = get_option('fts-date-and-time-format'); } else { if ($ftsCustomDate !== '' || $ftsCustomTime !== '') { $CustomDateFormatTwitter = get_option('fts-custom-date') . ' ' . get_option('fts-custom-time'); } else { $CustomDateFormatTwitter = 'F jS, Y \\a\\t g:ia'; } } date_default_timezone_set(get_option('fts-timezone')); if ($CustomDateCheck == 'one-day-ago') { $times = strtotime($times) - 3 * 3600; $date = date_create(date('F jS, Y g:ia', $times)); $timestamp = date_timestamp_get($date); $getFtsAgo = new feed_them_social_functions(); $uTime = $getFtsAgo->fts_ago($times); } else { $uTime = date($CustomDateFormatTwitter, strtotime($times) - 3 * 3600); } $id = isset($tweet->id) ? $tweet->id : ""; $fts_twitter_full_width = get_option('twitter_full_width'); $followers_count = isset($tweet->user->followers_count) ? $tweet->user->followers_count : ""; // $urls string is used so we can parse out video files $urls = isset($tweet->entities->urls[0]->expanded_url) ? $tweet->entities->urls[0]->expanded_url : ""; // Now make the new array. $tweets[] = array('text' => $text, 'name' => $name, 'screen_name' => $screen_name, 'user_permalink' => $user_permalink, 'permalink' => $permalink, 'image' => $image, 'time' => $uTime, 'media_url' => $media_url, 'id' => $id, 'urls' => $urls); } //End FOR fts-twitter-full-width // echo '<pre>'; // print_r($tweets); // echo '</pre>'; $twitter_allow_shortlink_conversion = get_option('twitter_allow_shortlink_conversion'); ?> <div id="twitter-feed-<?php print $twitter_name; ?> " class="fts-twitter-div<?php if ($twitter_height !== 'auto' && empty($twitter_height) == NULL) { ?> fts-twitter-scrollable<?php } if (isset($popup) && $popup == 'yes') { ?> popup-gallery-twitter<?php } ?> " <?php if ($twitter_height !== 'auto' && empty($twitter_height) == NULL) { ?> style="height:<?php echo $twitter_height; ?> "<?php } ?> > <?php //****************** // SOCIAL BUTTON //****************** if (!empty($search)) { $screen_name = $twitter_name; } if (isset($twitter_show_follow_btn) && $twitter_show_follow_btn == 'yes' && $twitter_show_follow_btn_where == 'twitter-follow-above' && $twitter_name !== '') { echo '<div class="twitter-social-btn-top">'; $this->social_follow_button('twitter', $screen_name); echo '</div>'; } // option to allow the followers plus count to show if (isset($twitter_show_follow_count) && $twitter_show_follow_count == 'yes' && $search == '') { print '<div class="twitter-followers-fts"><a href="' . $user_permalink . '" target="_blank" class="black">' . __('Followers:', 'feed-them-social') . '</a> ' . number_format($followers_count) . '</div>'; } ?> <?php foreach ($tweets as $t) { $twitter_allow_videos = get_option('twitter_allow_videos'); if (!empty($t['urls']) && $twitter_allow_videos !== 'no') { $type = 'twitterFeed'; $fts_dynamic_vid_name_string = trim($this->rand_string_twitter(10) . '_' . $type); $fts_dynamic_name = ''; if (isset($fts_dynamic_vid_name_string)) { $fts_dynamic_name = 'feed_dynamic_class' . $fts_dynamic_vid_name_string; } // ajax part $time = time(); $nonce = wp_create_nonce($time . "load-more-nonce"); ?> <script type="text/javascript"> jQuery(document).ready(function () { <?php // option to allow this action or not from the Twitter Options page if (isset($twitter_allow_shortlink_conversion) && $twitter_allow_shortlink_conversion == 'yes') { // API that converts shortlinks. longurlplease.com print 'jQuery.longurlplease();'; } ?> jQuery('.<?php echo $fts_dynamic_name; ?> a.fts-twitter-load-video').click(function(){ var fts_link = jQuery(this).attr('href'); var fts_security = "<?php echo $nonce; ?> "; var fts_post_id = "<?php echo $t['id']; ?> "; var fts_time = "<?php echo $time; ?> "; console.log('Submit Function'); jQuery.ajax({ data: {action: "fts_load_videos", fts_link: fts_link, fts_security: fts_security, fts_time: fts_time, fts_post_id: fts_post_id}, type: 'GET', url: myAjaxFTS, beforeSend: function() { jQuery('.<?php echo $fts_dynamic_name; ?> .fts-video-loading-notice').fadeIn(); }, success: function(data) { jQuery('.<?php echo $fts_dynamic_name; ?> .fts-video-loading-notice').hide(); jQuery('.<?php echo $fts_dynamic_name; ?> .fts-video-wrapper').append(data).filter('.<?php echo $fts_dynamic_name; ?> .fts-video-wrapper').html(); jQuery('a.<?php echo $fts_dynamic_name; ?> .twitter-video').hide(); jQuery('a.<?php echo $fts_dynamic_name; ?> ').hide(); jQuery('a.<?php echo $fts_dynamic_name; ?> .fts-close-media').show(); jQuery('.<?php echo $fts_dynamic_name; ?> .fts-video-wrapper-padding').slideDown(); console.log('Well Done and got this from sever: ' + data); } }); // end of ajax() return false; }) jQuery('.<?php echo $fts_dynamic_name; ?> .fts-close-media').click(function(){ jQuery('a.<?php echo $fts_dynamic_name; ?> .fts-close-media span.fts-show-media-text').toggle(); jQuery('a.<?php echo $fts_dynamic_name; ?> .fts-close-media span.fts-hide-media-text').toggle(); jQuery('.<?php echo $fts_dynamic_name; ?> .fts-video-wrapper-padding').slideToggle(); return false; }) }); </script> <?php } // END if not empty $t['urls'] $fts_dynamic_name = isset($fts_dynamic_name) ? $fts_dynamic_name : ''; ?> <div class="fts-tweeter-wrap <?php echo $fts_dynamic_name; ?> "> <div class="tweeter-info"> <?php if ($fts_twitter_full_width !== 'yes') { ?> <div class="fts-twitter-image"><a href="<?php print $t['user_permalink']; ?> " target="_blank" class="black"><img class="twitter-image" src="<?php print $t['image']; ?> " alt="<?php print $t['screen_name']; ?> "/></a></div> <?php } ?> <div class="<?php if ($fts_twitter_full_width == 'yes') { ?> fts-twitter-full-width<?php } else { ?> right<?php } ?> "> <div class="uppercase bold"><a href="<?php print $t['user_permalink']; ?> " target="_blank" class="black">@<?php print $t['screen_name']; ?> </a></div> <span class="time"><a href="<?php print $t['permalink']; ?> " target="_blank"><?php print $t['time']; ?> </a></span><br/> <span class="fts-twitter-text"><?php print nl2br($t['text']); ?> <div class="fts-twitter-caption"><a href="<?php print $t['permalink']; ?> " class="fts-view-on-twitter-link" target="_blank"><?php echo _e('View on Twitter', 'feed-them-social'); ?> </a></div> </span> <?php if ($t['media_url'] !== '') { ?> <a href="<?php if (isset($popup) && $popup == 'yes') { print $t['media_url']; } else { print $t['permalink']; } ?> " class="fts-twitter-link-image" target="_blank"><img class="fts-twitter-description-image" src="<?php print $t['media_url']; ?> " alt="<?php print $t['screen_name']; ?> photo" /></a> <?php } $tFinal = $t['urls']; $twitter_allow_videos = get_option('twitter_allow_videos'); if ($twitter_allow_videos !== 'no') { if (!empty($tFinal)) { // && strpos($tFinal, 'vimeo') > 0 || strpos($tFinal, 'amp.twimg.com') > 0 || strpos($tFinal, 'youtube') > 0 || strpos($tFinal, 'youtu.be') > 0 print '<div class="fts-video-wrapper-padding"><div class="fts-video-wrapper"></div></div>'; print '<div class="fts-video-show-hide-btns-wrap ' . $fts_dynamic_name . '_bts_wrap" style="display:none">'; print '<a href="' . $tFinal . '" class="fts-twitter-load-video-wrapper fts-twitter-load-video ' . $fts_dynamic_name . '" onclick="return false;">' . __('Show Media', 'feed-them-social') . '<span class="fts-video-loading-notice" style="display:none; ">' . __(', Loading...', 'feed-them-social') . '</span></a>'; print '<a href="' . $tFinal . '" class="fts-twitter-load-video-wrapper fts-close-media ' . $fts_dynamic_name . '" onclick="return false;"><span class="fts-hide-media-text">' . __('Hide Media', 'feed-them-social') . '</span><span class="fts-show-media-text">' . __('Show Media', 'feed-them-social') . '</span></a>'; print '</div>'; ?> <script type="text/javascript"> setTimeout(function() { var url = jQuery("a.fts-twitter-load-video-wrapper.<?php echo $fts_dynamic_name; ?> ").attr("href"); if (url.indexOf("soundcloud") >= 0 || url.indexOf("vine") >= 0 || url.indexOf("vimeo") >= 0 || url.indexOf("youtube") >= 0 || url.indexOf("youtu.be") >= 0 || url.indexOf("amp.twimg.com") >= 0 || url.indexOf("vine") >= 0 ) { if(url.indexOf("vimeo.com/blog/") >= 0 || url.indexOf("vimeo.com/ondemand/") >= 0 || url.indexOf("-youtube") >= 0 || url.indexOf("-vine") >= 0 || url.indexOf("-soundcloud") >= 0){ jQuery('.fts-video-show-hide-btns-wrap.<?php echo $fts_dynamic_name; ?> _bts_wrap').hide(); } else { jQuery('.fts-video-show-hide-btns-wrap.<?php echo $fts_dynamic_name; ?> _bts_wrap').show(); } } }, 1000); </script> <?php } } ?> </div> <div class="fts-twitter-reply-wrap"> <a href="<?php print $t['permalink']; ?> " target="_blank"> <div class="fts-twitter-reply"></div> </a></div> <div class="clear"></div> </div> </div> <?php } ?> <div class="clear"></div> </div> <?php if ($twitter_height !== 'auto' && empty($twitter_height) == NULL) { ?> <script> // this makes it so the page does not scroll if you reach the end of scroll bar or go back to top jQuery.fn.isolatedScrollTwitter = function() { this.bind('mousewheel DOMMouseScroll', function (e) { var delta = e.wheelDelta || (e.originalEvent && e.originalEvent.wheelDelta) || -e.detail, bottomOverflow = this.scrollTop + jQuery(this).outerHeight() - this.scrollHeight >= 0, topOverflow = this.scrollTop <= 0; if ((delta < 0 && bottomOverflow) || (delta > 0 && topOverflow)) { e.preventDefault(); } }); return this; }; jQuery('.fts-twitter-scrollable').isolatedScrollTwitter(); </script> <?php } } // END IF $fetchedTweets } //END ELSE //****************** // SOCIAL BUTTON //****************** if (isset($twitter_show_follow_btn) && $twitter_show_follow_btn == 'yes' && $twitter_show_follow_btn_where == 'twitter-follow-below' && $twitter_name !== '') { echo '<div class="twitter-social-btn-bottom">'; $this->social_follow_button('twitter', $screen_name); echo '</div>'; } return ob_get_clean(); }
function feed_post_types($set_zero, $FBtype, $post_data, $FB_Shortcode, $response_post_array, $single_event_array_response = null) { //Reviews Plugin if (is_plugin_active('feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php')) { $FTS_Facebook_Reviews = new FTS_Facebook_Reviews(); } $fts_dynamic_vid_name_string = trim($this->rand_string(10) . '_' . $FB_Shortcode['type']); if ($set_zero == $FB_Shortcode['posts']) { return; } //Create Facebook Variables $FBfinalstory = ''; $first_dir = ''; $FBpicture = isset($post_data->picture) ? $post_data->picture : ""; $FBlink = isset($post_data->link) ? $post_data->link : ""; $FBname = isset($post_data->name) ? $post_data->name : ''; $FBcaption = isset($post_data->caption) ? $post_data->caption : ""; $FBmessage = isset($post_data->message) ? $post_data->message : (isset($post_data->review_text) ? $post_data->review_text : '') . ''; $FBdescription = isset($post_data->description) ? $post_data->description : ""; $FBstory = isset($post_data->story) ? $post_data->story : ""; $FBicon = isset($post_data->icon) ? $post_data->icon : ""; $FBby = isset($post_data->properties->text) ? $post_data->properties->text : ""; $FBbylink = isset($post_data->properties->href) ? $post_data->properties->href : ""; $FBpost_share_count = isset($post_data->shares->count) ? $post_data->shares->count : ""; $FBpost_like_count_array = isset($post_data->likes->data) ? $post_data->likes->data : ""; $FBpost_comments_count_array = isset($post_data->comments->data) ? $post_data->comments->data : ""; $FBpost_object_id = isset($post_data->object_id) ? $post_data->object_id : ""; $FBalbum_photo_count = isset($post_data->count) ? $post_data->count : ""; $FBalbum_cover = isset($post_data->cover_photo->id) ? $post_data->cover_photo->id : ""; // youtube and vimeo embed url $FBvideo_embed = isset($post_data->source) ? $post_data->source : ""; $FBvideo = isset($post_data->embed_html) ? $post_data->embed_html : ""; $FBvideoPicture = isset($post_data->format[2]->picture) ? $post_data->format[2]->picture : ""; if ($FBalbum_cover) { $photo_data = json_decode($response_post_array[$FBalbum_cover . '_photo']); } if (isset($post_data->id)) { $FBpost_id = $post_data->id; $FBpost_full_ID = explode('_', $FBpost_id); if (isset($FBpost_full_ID[0])) { $FBpost_user_id = $FBpost_full_ID[0]; } if (isset($FBpost_full_ID[1])) { $FBpost_single_id = $FBpost_full_ID[1]; } } if ($FB_Shortcode['type'] == 'albums' && !$FBalbum_cover) { unset($post_data); continue; } //Create Post Data Key if (isset($post_data->object_id)) { $post_data_key = $post_data->object_id; } else { $post_data_key = $post_data->id; } //Count Likes/Shares/ $lcs_array = $this->get_likes_shares_comments($response_post_array, $post_data_key, $FBpost_share_count); $FBlocation = isset($post_data->location) ? $post_data->location : ""; $FBembed_vid = isset($post_data->embed_html) ? $post_data->embed_html : ""; $FBfromName = isset($post_data->from->name) ? $post_data->from->name : ""; $FBfromName = preg_quote($FBfromName, "/"); $FBstory = isset($post_data->story) ? $post_data->story : ""; $ftsCustomDate = get_option('fts-custom-date'); $ftsCustomTime = get_option('fts-custom-time'); $CustomDateCheck = get_option('fts-date-and-time-format'); if ($ftsCustomDate == '' && $ftsCustomTime == '') { $CustomDateFormat = get_option('fts-date-and-time-format'); } else { if ($ftsCustomDate !== '' || $ftsCustomTime !== '') { $CustomDateFormat = get_option('fts-custom-date') . ' ' . get_option('fts-custom-time'); } else { $CustomDateFormat = 'F jS, Y \\a\\t g:ia'; } } $createdTime = isset($post_data->created_time) ? $post_data->created_time : ''; $CustomTimeFormat = strtotime($createdTime); if (!empty($FBstory)) { $FBfinalstory = preg_replace('/\\b' . $FBfromName . 's*?\\b(?=([^"]*"[^"]*")*[^"]*$)/i', '', $FBstory, 1); } $FTS_FB_OUTPUT = ''; $fts_hide_photos_type = get_option('fb_hide_images_in_posts'); switch ($FBtype) { case 'video': $FTS_FB_OUTPUT .= '<div class="fts-jal-single-fb-post fts-fb-video-post-wrap" '; if (isset($FB_Shortcode['grid']) && $FB_Shortcode['grid'] == 'yes') { $FTS_FB_OUTPUT .= 'style="width:' . $FB_Shortcode['colmn_width'] . '; margin:' . $FB_Shortcode['space_between_posts'] . '"'; } $FTS_FB_OUTPUT .= '>'; break; case 'app': case 'cover': case 'profile': case 'mobile': case 'wall': case 'normal': case 'photo': $FTS_FB_OUTPUT .= '<div class="fts-jal-single-fb-post fts-fb-photo-post-wrap" '; if ($FB_Shortcode['type'] == 'album_photos' || $FB_Shortcode['type'] == 'albums') { $FTS_FB_OUTPUT .= 'style="width:' . $FB_Shortcode['image_width'] . ' !important; height:' . $FB_Shortcode['image_height'] . '!important; margin:' . $FB_Shortcode['space_between_photos'] . '!important"'; } if (isset($FB_Shortcode['grid']) && $FB_Shortcode['grid'] == 'yes') { $FTS_FB_OUTPUT .= 'style="width:' . $FB_Shortcode['colmn_width'] . '; margin:' . $FB_Shortcode['space_between_posts'] . '"'; } $FTS_FB_OUTPUT .= '>'; break; case 'album': default: $FTS_FB_OUTPUT .= '<div class="fts-jal-single-fb-post" '; if (isset($FB_Shortcode['grid']) && $FB_Shortcode['grid'] == 'yes') { $FTS_FB_OUTPUT .= 'style="width:' . $FB_Shortcode['colmn_width'] . '; margin:' . $FB_Shortcode['space_between_posts'] . '"'; } $FTS_FB_OUTPUT .= '>'; break; } //output Single Post Wrap //Don't $FTS_FB_OUTPUT .= if Events Feed if ($FB_Shortcode['type'] !== 'events') { //Right Wrap $FTS_FB_OUTPUT .= '<div class="fts-jal-fb-right-wrap">'; //Top Wrap (Exluding : albums, album_photos, and hiding) $FTS_FB_OUTPUT .= $FB_Shortcode['type'] == 'album_photos' && $FB_Shortcode['hide_date_likes_comments'] == 'yes' || $FB_Shortcode['type'] == 'albums' && $FB_Shortcode['hide_date_likes_comments'] == 'yes' ? '' : '<div class="fts-jal-fb-top-wrap">'; //User Thumbnail $FTS_FB_OUTPUT .= '<div class="fts-jal-fb-user-thumb">'; $FTS_FB_OUTPUT .= '<a href="http://facebook.com/' . ($FB_Shortcode['type'] == 'reviews' ? $post_data->reviewer->id : $post_data->from->id) . '" target="_blank"><img border="0" alt="' . ($FB_Shortcode['type'] == 'reviews' ? $post_data->reviewer->name : $post_data->from->name) . '" src="https://graph.facebook.com/' . ($FB_Shortcode['type'] == 'reviews' ? $post_data->reviewer->id : $post_data->from->id) . '/picture"/></a>'; $FTS_FB_OUTPUT .= '</div>'; if ($FB_Shortcode['type'] == 'album_photos' && $FB_Shortcode['hide_date_likes_comments'] == 'yes' || $FB_Shortcode['type'] == 'albums' && $FB_Shortcode['hide_date_likes_comments'] == 'yes') { } else { date_default_timezone_set(get_option('fts-timezone')); $fb_hide_shared_by_etc_text = get_option('fb_hide_shared_by_etc_text'); $fb_hide_shared_by_etc_text = isset($fb_hide_shared_by_etc_text) && $fb_hide_shared_by_etc_text == 'no' ? '' : $FBfinalstory; //UserName $FTS_FB_OUTPUT .= $FB_Shortcode['type'] == 'reviews' && is_plugin_active('feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php') ? '<span class="fts-jal-fb-user-name"><a href="http://facebook.com/' . $post_data->reviewer->id . '/" target="_blank">' . $post_data->reviewer->name . '</a>' . $FTS_Facebook_Reviews->reviews_rating_format($FB_Shortcode, $post_data->rating) . '</span>' : '<span class="fts-jal-fb-user-name"><a href="http://facebook.com/profile.php?id=' . $post_data->from->id . '" target="_blank">' . $post_data->from->name . '</a>' . $fb_hide_shared_by_etc_text . '</span>'; // custom one day ago check if ($CustomDateCheck == 'one-day-ago') { $date = date_create(date('F jS, Y g:ia', $CustomTimeFormat)); $timestamp = date_timestamp_get($date); $getFtsAgo = new feed_them_social_functions(); $fts_final_date = $getFtsAgo->fts_ago($timestamp); } else { $fts_final_date = date($CustomDateFormat, $CustomTimeFormat); } //PostTime $FTS_FB_OUTPUT .= '<span class="fts-jal-fb-post-time">' . $fts_final_date . '</span><div class="clear"></div>'; //Comments Count $FBpost_id_final = substr($FBpost_id, strpos($FBpost_id, "_") + 1); //filter messages to have urls //Output Message if ($FBmessage) { // here we trim the words for the premium version. The $FB_Shortcode['words'] string actually comes from the javascript if (is_plugin_active('feed-them-premium/feed-them-premium.php') && array_key_exists('words', $FB_Shortcode) || is_plugin_active('feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php') && array_key_exists('words', $FB_Shortcode)) { $more = isset($more) ? $more : ""; $trimmed_content = $this->fts_custom_trim_words($FBmessage, $FB_Shortcode['words'], $more); $FTS_FB_OUTPUT .= !empty($trimmed_content) ? '<div class="fts-jal-fb-message">' . $trimmed_content . '</div><div class="clear"></div>' : ''; //If POPUP //$FTS_FB_OUTPUT .= $FB_Shortcode['popup'] == 'yes' ? '<div class="fts-fb-caption"><a href="'.$FBlink.'" class="fts-view-on-facebook-link" target="_blank">'.__('View on Facebook', 'feed-them-social').'</a></div> ' : ''; } else { $FB_final_message = $this->fts_facebook_tag_filter($FBmessage); $FTS_FB_OUTPUT .= '<div class="fts-jal-fb-message">'; $FTS_FB_OUTPUT .= nl2br($FB_final_message); //If POPUP // $FTS_FB_OUTPUT .= $FB_Shortcode['popup'] == 'yes' ? '<div class="fts-fb-caption"><a href="'.$FBlink.'" class="fts-view-on-facebook-link" target="_blank">'.__('View on Facebook', 'feed-them-social').'</a></div> ' : ''; $FTS_FB_OUTPUT .= '<div class="clear"></div></div> '; } } elseif (!$FBmessage && $FB_Shortcode['type'] == 'album_photos' || !$FBmessage && $FB_Shortcode['type'] == 'albums') { $FTS_FB_OUTPUT .= '<div class="fts-jal-fb-description-wrap">'; $FTS_FB_OUTPUT .= $FBname ? $this->fts_facebook_post_desc($FBname, $FB_Shortcode, $FBtype, NULL, $FBby) : ''; //Output Photo Caption $FTS_FB_OUTPUT .= $FBcaption ? $this->fts_facebook_post_cap($FBcaption, $FB_Shortcode, $FBtype) : ''; //Photo Count $FTS_FB_OUTPUT .= $FBalbum_photo_count ? $FBalbum_photo_count . ' Photos' : ''; //Location $FTS_FB_OUTPUT .= $FBlocation ? $this->fts_facebook_location($FBtype, $FBlocation) : ''; //Output Photo Description $FTS_FB_OUTPUT .= $FBdescription ? $this->fts_facebook_post_desc($FBdescription, $FB_Shortcode, $FBtype, NULL, $FBby) : ''; //Output Photo Description if (isset($FB_Shortcode['popup']) && $FB_Shortcode['popup'] == 'yes') { $FTS_FB_OUTPUT .= '<div class="fts-fb-caption fts-fb-album-view-link" style="display:block;">'; if ($FBalbum_cover) { $FTS_FB_OUTPUT .= '<a href="https://graph.facebook.com/' . $FBalbum_cover . '/picture" class="fts-view-album-photos-large" target="_blank">' . __('View Photo', 'feed-them-social') . '</a></div>'; } elseif (isset($FB_Shortcode['video_album']) && $FB_Shortcode['video_album'] == 'yes') { if ($FB_Shortcode['play_btn'] !== 'yes') { $FTS_FB_OUTPUT .= '<a href="' . $post_data->source . '" data-poster="' . $post_data->format[3]->picture . '" id="fts-view-vid1-' . $fts_dynamic_vid_name_string . '" class="fts-view-fb-videos-large fts-view-fb-videos-btn fb-video-popup-' . $fts_dynamic_vid_name_string . '">' . __('View Video', 'feed-them-social') . '</a>'; } $FTS_FB_OUTPUT .= '</div>'; } else { $FTS_FB_OUTPUT .= '<a href="https://graph.facebook.com/' . $FBpost_id . '/picture" class="fts-view-album-photos-large" target="_blank">' . __('View Photo', 'feed-them-social') . '</a></div>'; } $FTS_FB_OUTPUT .= '<div class="fts-fb-caption"><a class="view-on-facebook-albums-link" href="' . $FBlink . '" target="_blank">' . __('View on Facebook', 'feed-them-social') . '</a></div>'; } $FTS_FB_OUTPUT .= '<div class="clear"></div></div>'; } $FTS_FB_OUTPUT .= '</div>'; // end .fts-jal-fb-top-wrap } } //end if for show name date and comments //Post Type Build $fts_show_post = false; switch ($FBtype) { //************************************************** // START STATUS POST //************************************************** case 'status': // && !$FBpicture == '' makes it so the attachment unavailable message does not show up if (!$FBpicture && !$FBname && !$FBdescription && !$FBpicture == '') { $FTS_FB_OUTPUT .= '<div class="fts-jal-fb-link-wrap">'; //Output Link Picture $FTS_FB_OUTPUT .= $FBpicture ? $this->fts_facebook_post_photo($FBlink, $FB_Shortcode, $post_data->from->name, $post_data->picture) : ''; if ($FBname || $FBcaption || $FBdescription) { $FTS_FB_OUTPUT .= '<div class="fts-jal-fb-description-wrap">'; //Output Link Name $FTS_FB_OUTPUT .= $FBname ? $this->fts_facebook_post_name($FBlink, $FBname, $FBtype) : ''; //Output Link Caption if ($FBcaption == 'Attachment Unavailable. This attachment may have been removed or the person who shared it may not have permission to share it with you.') { $FTS_FB_OUTPUT .= '<div class="fts-jal-fb-caption" style="width:100% !important">'; _e('This user\'s permissions are keeping you from seeing this post. Please Click "View on Facebook" to view this post on this group\'s facebook wall.', 'feed-them-social'); $FTS_FB_OUTPUT .= '</div>'; } else { $FTS_FB_OUTPUT .= $this->fts_facebook_post_cap($FBcaption, $FB_Shortcode, $FBtype); } //Output Link Description $FTS_FB_OUTPUT .= $FBdescription ? $this->fts_facebook_post_desc($FBdescription, $FB_Shortcode, $FBtype) : ''; $FTS_FB_OUTPUT .= '<div class="clear"></div></div>'; } $FTS_FB_OUTPUT .= '<div class="clear"></div></div>'; } break; //************************************************** // Start Multiple Events //************************************************** //************************************************** // Start Multiple Events //************************************************** case 'events': $single_event_id = $post_data->id; $single_event_info = json_decode($single_event_array_response['event_single_' . $single_event_id . '_info']); $single_event_location = json_decode($single_event_array_response['event_single_' . $single_event_id . '_location']); $single_event_cover_photo = json_decode($single_event_array_response['event_single_' . $single_event_id . '_cover_photo']); //echo'<pre>'; //print_r($single_event_info); //echo'</pre>'; //Event Cover Photo $event_cover_photo = isset($single_event_cover_photo->cover->source) ? $single_event_cover_photo->cover->source : ""; $event_description = isset($single_event_info->description) ? $single_event_info->description : ""; $FTS_FB_OUTPUT .= '<div class="fts-jal-fb-right-wrap fts-events-list-wrap">'; //Link Picture $FB_event_name = isset($single_event_info->name) ? $single_event_info->name : ""; $FB_event_location = isset($single_event_location->place->name) ? $single_event_location->place->name : ""; $FB_event_city = isset($single_event_location->place->location->city) ? $single_event_location->place->location->city . ', ' : ""; $FB_event_state = isset($single_event_location->place->location->state) ? $single_event_location->place->location->state : ""; $FB_event_street = isset($single_event_location->place->location->street) ? $single_event_location->place->location->street : ""; $FB_event_zip = isset($single_event_location->place->location->zip) ? ' ' . $single_event_location->place->location->zip : ""; $FB_event_latitude = isset($single_event_location->place->location->latitude) ? $single_event_location->place->location->latitude : ""; $FB_event_longitude = isset($single_event_location->place->location->longitude) ? $single_event_location->place->location->longitude : ""; date_default_timezone_set(get_option('fts-timezone')); // custom one day ago check if ($CustomDateCheck == 'one-day-ago') { $FB_event_start_time = date('l, F jS, Y \\a\\t g:ia', strtotime($single_event_info->start_time)); } else { $FB_event_start_time = date($CustomDateFormat, strtotime($single_event_info->start_time)); } //Output Photo Description if (!empty($event_cover_photo)) { $FTS_FB_OUTPUT .= isset($FB_Shortcode['popup']) && $FB_Shortcode['popup'] == 'yes' && is_plugin_active('feed-them-premium/feed-them-premium.php') ? '<a href="' . $event_cover_photo . '" class="fts-jal-fb-picture fts-fb-large-photo" target="_blank"><img class="fts-fb-event-photo" src="' . $event_cover_photo . '"></a>' : '<a href="http://facebook.com/events/' . $single_event_id . '" target="_blank" class="fts-jal-fb-picture fts-fb-large-photo"><img class="fts-fb-event-photo" src="' . $event_cover_photo . '" /></a>'; } $FTS_FB_OUTPUT .= '<div class="fts-jal-fb-message">'; //Link Name $FTS_FB_OUTPUT .= $FB_event_name ? $this->fts_facebook_post_name('http://facebook.com/events/' . $single_event_id . '', $FB_event_name, $FBtype) : ''; //Link Caption $FTS_FB_OUTPUT .= $FB_event_start_time ? '<div class="fts-fb-event-time">' . $FB_event_start_time . '</div>' : ''; //Link Description if (!empty($FB_event_location)) { $FTS_FB_OUTPUT .= '<div class="fts-fb-location"><span class="fts-fb-location-title">' . $FB_event_location . '</span>'; //Street Adress $FTS_FB_OUTPUT .= $FB_event_street; //City & State $FTS_FB_OUTPUT .= ($FB_event_city or $FB_event_state) ? '<br/>' . $FB_event_city . $FB_event_state . $FB_event_zip : ''; $FTS_FB_OUTPUT .= '</div>'; } //Get Directions if (!empty($FB_event_latitude) && !empty($FB_event_longitude)) { $FTS_FB_OUTPUT .= '<a target="_blank" class="fts-fb-get-directions" href="https://www.google.com/maps/dir/Current+Location/' . $FB_event_latitude . ',' . $FB_event_longitude . ' ">Get Directions</a>'; } if (!empty($single_event_ticket_info) && !empty($single_event_ticket_info)) { $FTS_FB_OUTPUT .= '<a target="_blank" class="fts-fb-ticket-info" href="' . $single_event_ticket_info->ticket_uri . '">Ticket Info</a>'; } //Output Message if (!empty($FB_Shortcode['words']) && $event_description && is_plugin_active('feed-them-premium/feed-them-premium.php')) { // here we trim the words for the premium version. The $FB_Shortcode['words'] string actually comes from the javascript $FTS_FB_OUTPUT .= $this->fts_facebook_post_desc($event_description, $FB_Shortcode, $FBtype, NULL, $FBby, $FB_Shortcode['type']); } else { $FTS_FB_OUTPUT .= $this->fts_facebook_post_desc($event_description, $FBtype, NULL, $FBby, $FB_Shortcode['type']); } $FTS_FB_OUTPUT .= '<div class="clear"></div></div>'; break; //************************************************** // START LINK POST //************************************************** //************************************************** // START LINK POST //************************************************** case 'link': $FTS_FB_OUTPUT .= '<div class="fts-jal-fb-link-wrap">'; //start url check $url = $FBlink; $url_parts = parse_url($url); $host = $url_parts['host']; if ($host == 'www.facebook.com') { $spliturl = $url_parts['path']; $path_components = explode('/', $spliturl); $first_dir = $path_components[1]; $event_id_number = isset($path_components[2]) && $path_components[2] ? $path_components[2] : ''; } //end url check if ($host == 'www.facebook.com' and $first_dir == 'events') { $event_url = 'https://graph.facebook.com/' . $event_id_number . '/?access_token=' . $access_token . ''; $event_data = json_decode(file_get_contents($event_url)); $FB_event_name = isset($event_data->name) ? $event_data->name : ""; $FB_event_location = isset($event_data->location) ? $event_data->location : ""; $FB_event_city = isset($event_data->venue->city) ? $event_data->venue->city : ""; $FB_event_state = isset($event_data->venue->state) ? $event_data->venue->state : ""; date_default_timezone_set(get_option('fts-timezone')); $date = date('Y-m-d'); // custom one day ago check if ($CustomDateCheck == 'one-day-ago') { $FB_event_start_time = date('l, F jS, Y \\a\\t g:ia', strtotime($event_data->start_time)); } else { $FB_event_start_time = date($CustomDateFormat, strtotime($event_data->start_time)); } //Link Wrap $FTS_FB_OUTPUT .= '<a href="' . $FBlink . '" target="_blank" class="fts-jal-fb-picture"><img class="fts-fb-event-photo" src="http://graph.facebook.com/' . $event_id_number . '/picture"></img></a>'; $FTS_FB_OUTPUT .= '<div class="fts-jal-fb-description-wrap">'; //Output Link Name $FTS_FB_OUTPUT .= $FB_event_name ? $this->fts_facebook_post_name($FBlink, $FB_event_name, $FBtype) : ''; //Output Link Caption $FTS_FB_OUTPUT .= $FB_event_start_time ? '<div class="fts-fb-event-time">' . $FB_event_start_time . '</div>' : ''; //Output Link Description if (!empty($FB_event_location)) { //Location $FTS_FB_OUTPUT .= '<div class="fts-fb-location">' . $FB_event_location; //City & State $FTS_FB_OUTPUT .= $FB_event_city || $FB_event_state ? ' in ' . $FB_event_city . ', ' . $FB_event_state . '' : ''; $FTS_FB_OUTPUT .= '</div>'; } $FTS_FB_OUTPUT .= '<div class="clear"></div></div>'; } //end if event //Output Link Picture $FTS_FB_OUTPUT .= $FBpicture ? $this->fts_facebook_post_photo($FBlink, $FB_Shortcode, $post_data->from->name, $post_data->picture) : ''; $FB_Shortcode['words'] = isset($FB_Shortcode['words']) ? $FB_Shortcode['words'] : ""; //Description Wrap $FTS_FB_OUTPUT .= '<div class="fts-jal-fb-description-wrap">'; //Output Link Name $FTS_FB_OUTPUT .= $FBname ? $this->fts_facebook_post_name($FBlink, $FBname, $FBtype) : ''; //Output Link Caption $FTS_FB_OUTPUT .= $FBcaption ? $this->fts_facebook_post_cap($FBcaption, $FB_Shortcode, $FBtype) : ''; //Output Link Description $FTS_FB_OUTPUT .= $FBdescription ? $this->fts_facebook_post_desc($FBdescription, $FB_Shortcode, $FBtype) : ''; $FTS_FB_OUTPUT .= '<div class="clear"></div></div>'; $FTS_FB_OUTPUT .= '<div class="clear"></div></div>'; break; //************************************************** // START VIDEO POST //************************************************** //************************************************** // START VIDEO POST //************************************************** case 'video': $video_data = json_decode($response_post_array[$post_data_key . '_video']); $FTS_FB_OUTPUT .= '<div class="fts-jal-fb-vid-wrap">'; if (!empty($FBpicture)) { if (strpos($FBvideo_embed, 'fbcdn') > 0 && !empty($video_data->format)) { if (!empty($video_data->format)) { foreach ($video_data->format as $video_data_format) { if ($video_data_format->filter == 'native') { $FTS_FB_OUTPUT .= '<div class="fts-fluid-videoWrapper-html5">'; $FTS_FB_OUTPUT .= '<video controls poster="' . $video_data_format->picture . '" width="100%;" style="max-width:100%;">'; $FTS_FB_OUTPUT .= '<source src="' . $video_data->source . '" type="video/mp4">'; $FTS_FB_OUTPUT .= '</video>'; $FTS_FB_OUTPUT .= '</div>'; } } $FTS_FB_OUTPUT .= '<div class="slicker-facebook-album-photoshadow"></div>'; } } else { if (strpos($FBvideo_embed, 'fbcdn') > 0 && empty($video_data->format)) { $fts_dynamic_vid_name_string = trim($this->rand_string(10) . '_' . $FB_Shortcode['type']); $fts_dynamic_vid_name = 'feed_dynamic_video_class' . $fts_dynamic_vid_name_string; $FTS_FB_OUTPUT .= '<div class="fts-jal-fb-vid-picture ' . $fts_dynamic_vid_name . '"><img border="0" alt="' . $post_data->from->name . '" src="' . $post_data->picture . '"/> <div class="fts-jal-fb-vid-play-btn"></div>'; $FTS_FB_OUTPUT .= '<div class="fts-fluid-videoWrapper-html5"><video id="' . $fts_dynamic_vid_name . '" controls width="100%;" style="max-width:100%;"><source src="" type="video/mp4"></video></div><div class="slicker-facebook-album-photoshadow"></div></div>'; $FTS_FB_OUTPUT .= '<script>jQuery(document).ready(function() {'; $FTS_FB_OUTPUT .= 'jQuery(".' . $fts_dynamic_vid_name . '").bind("click", function() {'; $FTS_FB_OUTPUT .= 'jQuery(this).addClass("fts-vid-div");'; $FTS_FB_OUTPUT .= 'if(jQuery(this).hasClass("fts-jal-fb-vid-picture")){var video = jQuery("#' . $fts_dynamic_vid_name . '"); video[0].src = "' . $video_data->source . '";video[0].load(); video[0].play();}'; $FTS_FB_OUTPUT .= 'jQuery(this).removeClass("fts-jal-fb-vid-picture"); '; if (isset($FB_Shortcode['grid']) && $FB_Shortcode['grid'] == 'yes') { $FTS_FB_OUTPUT .= 'jQuery(".fts-slicker-facebook-posts").masonry( "reloadItems");'; $FTS_FB_OUTPUT .= 'jQuery(".fts-slicker-facebook-posts").masonry( "layout" );'; } $FTS_FB_OUTPUT .= '});'; $FTS_FB_OUTPUT .= '});</script>'; } else { //Create Dynamic Class Name $fts_dynamic_vid_name_string = trim($this->rand_string(10) . '_' . $FB_Shortcode['type']); $fts_dynamic_vid_name = 'feed_dynamic_video_class' . $fts_dynamic_vid_name_string; $FTS_FB_OUTPUT .= '<div class="fts-jal-fb-vid-picture ' . $fts_dynamic_vid_name . '"><img border="0" alt="' . $post_data->from->name . '" src="' . $post_data->picture . '"/> <div class="fts-jal-fb-vid-play-btn"></div></div>'; // strip Youtube URL then ouput Iframe and script if (strpos($FBlink, 'youtube') > 0) { // $pattern = '#^(?:https?://)?(?:www\.)?(?:youtu\.be/|youtube\.com(?:/embed/|/v/|/watch\?v=|/watch\?.+&v=))([\w-]{11})(?:.+)?$#x'; // preg_match($pattern, $FBlink, $matches); // $youtubeURLfinal = $matches[1]; $FTS_FB_OUTPUT .= '<script>jQuery(document).ready(function() {'; $FTS_FB_OUTPUT .= 'jQuery(".' . $fts_dynamic_vid_name . '").click(function() {'; $FTS_FB_OUTPUT .= 'jQuery(this).addClass("fts-vid-div");'; $FTS_FB_OUTPUT .= 'jQuery(this).removeClass("fts-jal-fb-vid-picture");'; // $FTS_FB_OUTPUT .= 'jQuery(this).prepend(\'<div class="fts-fluid-videoWrapper"><iframe height="281" class="video'.$FBpost_id.'" src="https://www.youtube.com/embed/'.$youtubeURLfinal.'?autoplay=1" frameborder="0" allowfullscreen></iframe></div>\');'; $FTS_FB_OUTPUT .= 'jQuery(this).prepend(\'<div class="fts-fluid-videoWrapper"><iframe height="281" class="video' . $FBpost_id . '" src="' . $FBvideo_embed . '" frameborder="0" allowfullscreen></iframe></div>\');'; if (isset($FB_Shortcode['grid']) && $FB_Shortcode['grid'] == 'yes') { $FTS_FB_OUTPUT .= 'jQuery(".fts-slicker-facebook-posts").masonry( "reloadItems");'; $FTS_FB_OUTPUT .= 'jQuery(".fts-slicker-facebook-posts").masonry( "layout" );'; } $FTS_FB_OUTPUT .= '});'; $FTS_FB_OUTPUT .= '});</script>'; } else { if (strpos($FBlink, 'youtu.be') > 0) { // $pattern = '#^(?:https?://)?(?:www\.)?(?:youtu\.be/|youtube\.com(?:/embed/|/v/|/watch\?v=|/watch\?.+&v=))([\w-]{11})(?:.+)?$#x'; // preg_match($pattern, $FBlink, $matches); // $youtubeURLfinal = $matches[1]; $FTS_FB_OUTPUT .= '<script>'; $FTS_FB_OUTPUT .= 'jQuery(document).ready(function() {'; $FTS_FB_OUTPUT .= 'jQuery(".' . $fts_dynamic_vid_name . '").click(function() {'; $FTS_FB_OUTPUT .= 'jQuery(this).addClass("fts-vid-div");'; $FTS_FB_OUTPUT .= 'jQuery(this).removeClass("fts-jal-fb-vid-picture");'; // $FTS_FB_OUTPUT .= 'jQuery(this).prepend(\'<div class="fts-fluid-videoWrapper"><iframe height="281" class="video'.$FBpost_id.'" src="http://www.youtube.com/embed/'.$youtubeURLfinal.'?autoplay=1" frameborder="0" allowfullscreen></iframe></div>\');'; $FTS_FB_OUTPUT .= 'jQuery(this).prepend(\'<div class="fts-fluid-videoWrapper"><iframe height="281" class="video' . $FBpost_id . '" src="' . $FBvideo_embed . '" frameborder="0" allowfullscreen></iframe></div>\');'; if (isset($FB_Shortcode['grid']) && $FB_Shortcode['grid'] == 'yes') { $FTS_FB_OUTPUT .= 'jQuery(".fts-slicker-facebook-posts").masonry( "reloadItems");'; $FTS_FB_OUTPUT .= 'jQuery(".fts-slicker-facebook-posts").masonry( "layout" );'; } $FTS_FB_OUTPUT .= '});'; $FTS_FB_OUTPUT .= '});'; $FTS_FB_OUTPUT .= '</script>'; } else { if (strpos($FBlink, 'vimeo') > 0) { // $pattern = '/(\d+)/'; // preg_match($pattern, $FBlink, $matches); // $vimeoURLfinal = $matches[0]; $FTS_FB_OUTPUT .= '<script>'; $FTS_FB_OUTPUT .= 'jQuery(document).ready(function() {'; $FTS_FB_OUTPUT .= 'jQuery(".' . $fts_dynamic_vid_name . '").click(function() {'; $FTS_FB_OUTPUT .= 'jQuery(this).addClass("fts-vid-div");'; $FTS_FB_OUTPUT .= 'jQuery(this).removeClass("fts-jal-fb-vid-picture");'; // $FTS_FB_OUTPUT .= 'jQuery(this).prepend(\'<div class="fts-fluid-videoWrapper"><iframe src="http://player.vimeo.com/video/'.$vimeoURLfinal.'?autoplay=1" class="video'.$FBpost_id.'" height="390" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>\');'; $FTS_FB_OUTPUT .= 'jQuery(this).prepend(\'<div class="fts-fluid-videoWrapper"><iframe src="' . $FBvideo_embed . '" class="video' . $FBpost_id . '" height="390" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>\');'; if (isset($FB_Shortcode['grid']) && $FB_Shortcode['grid'] == 'yes') { $FTS_FB_OUTPUT .= 'jQuery(".fts-slicker-facebook-posts").masonry( "reloadItems");'; $FTS_FB_OUTPUT .= 'jQuery(".fts-slicker-facebook-posts").masonry( "layout" );'; } $FTS_FB_OUTPUT .= '});'; $FTS_FB_OUTPUT .= '});'; $FTS_FB_OUTPUT .= '</script>'; } else { if (strpos($FBlink, 'soundcloud') > 0) { //Get the SoundCloud URL $url = $FBlink; //Get the JSON data of song details with embed code from SoundCloud oEmbed $getValues = file_get_contents('http://soundcloud.com/oembed?format=js&url=' . $url . '&auto_play=true&iframe=true'); //Clean the Json to decode $decodeiFrame = substr($getValues, 1, -2); //json decode to convert it as an array $jsonObj = json_decode($decodeiFrame); //Change the height of the embed player if you want else uncomment below line // echo str_replace('height="400"', 'height="140"', $jsonObj->html); $FTS_FB_OUTPUT .= '<script>'; $FTS_FB_OUTPUT .= 'jQuery(document).ready(function() {'; $FTS_FB_OUTPUT .= 'jQuery(".' . $fts_dynamic_vid_name . '").click(function() {'; $FTS_FB_OUTPUT .= 'jQuery(this).addClass("fts-vid-div");'; $FTS_FB_OUTPUT .= 'jQuery(this).removeClass("fts-jal-fb-vid-picture");'; $FTS_FB_OUTPUT .= ' jQuery(this).prepend(\'<div class="fts-fluid-videoWrapper">' . $jsonObj->html . '</div>\');'; if (isset($FB_Shortcode['grid']) && $FB_Shortcode['grid'] == 'yes') { $FTS_FB_OUTPUT .= 'jQuery(".fts-slicker-facebook-posts").masonry( "reloadItems");'; $FTS_FB_OUTPUT .= 'jQuery(".fts-slicker-facebook-posts").masonry( "layout" );'; } $FTS_FB_OUTPUT .= '});'; $FTS_FB_OUTPUT .= '});'; $FTS_FB_OUTPUT .= '</script>'; } } } } } } } if ($FBname || $FBcaption || $FBdescription) { $FTS_FB_OUTPUT .= '<div class="fts-jal-fb-description-wrap fb-id' . $FBpost_id . '">'; //Output Video Name $FTS_FB_OUTPUT .= $FBname ? $this->fts_facebook_post_name($FBlink, $FBname, $FBtype, $FBpost_id) : ''; //Output Video Caption $FTS_FB_OUTPUT .= $FBcaption ? $this->fts_facebook_post_cap($FBcaption, $FB_Shortcode, $FBtype, $FBpost_id) : ''; //Output Video Description $FTS_FB_OUTPUT .= $FBdescription ? $this->fts_facebook_post_desc($FBdescription, $FB_Shortcode, $FBtype, $FBpost_id) : ''; $FTS_FB_OUTPUT .= '<div class="clear"></div></div>'; } $FTS_FB_OUTPUT .= '<div class="clear"></div></div>'; break; //************************************************** //START PHOTO POST //************************************************** //************************************************** //START PHOTO POST //************************************************** case 'photo': if (isset($fts_hide_photos_type) && $fts_hide_photos_type == 'yes' && $FB_Shortcode['type'] !== 'album_photos' && $FB_Shortcode['video_album'] !== 'yes') { break; } //Wrapping with if statement to prevent Notice on some facebook page feeds. if ($FB_Shortcode['type'] == 'group') { $photo_source = json_decode($response_post_array[$post_data_key . '_group_post_photo']); } //Group or page? $photo_source_final = isset($photo_source->full_picture) && $FB_Shortcode['type'] == 'group' ? $photo_source->full_picture : 'https://graph.facebook.com/' . $FBpost_object_id . '/picture'; $FTS_FB_OUTPUT .= '<div class="fts-jal-fb-link-wrap fts-album-photos-wrap"'; if ($FB_Shortcode['type'] == 'album_photos' || $FB_Shortcode['type'] == 'albums') { $FTS_FB_OUTPUT .= 'style="line-height:' . $FB_Shortcode['image_height'] . ' !important;"'; } $FTS_FB_OUTPUT .= '>'; $FTS_FB_OUTPUT .= isset($FB_Shortcode['popup']) && $FB_Shortcode['popup'] == 'yes' ? '<div class="fts-fb-caption"><a href="' . $FBlink . '" class="fts-view-on-facebook-link" target="_blank">' . __('View on Facebook', 'feed-them-social') . '</a></div> ' : ''; //Output Photo Picture if ($FBpost_object_id) { if ($FBpost_object_id) { $FTS_FB_OUTPUT .= '<a href="' . (isset($FB_Shortcode['popup']) && $FB_Shortcode['popup'] == 'yes' ? $photo_source_final : $FBlink) . '" target="_blank" class="fts-jal-fb-picture fts-fb-large-photo"><img border="0" alt="' . $post_data->from->name . '" src="' . $photo_source_final . '"></a>'; } else { $FTS_FB_OUTPUT .= '<a href="' . (isset($FB_Shortcode['popup']) && $FB_Shortcode['popup'] == 'yes' ? $photo_source_final : $FBlink) . '" target="_blank" class="fts-jal-fb-picture fts-fb-large-photo"><img border="0" alt="' . $post_data->from->name . '" src="' . $photo_source_final . '"></a>'; } } elseif ($FBpicture) { if ($FBpost_object_id) { $FTS_FB_OUTPUT .= $this->fts_facebook_post_photo($FBlink, $FB_Shortcode, $post_data->from->name, 'https://graph.facebook.com/' . $FBpost_object_id . '/picture'); } else { $FTS_FB_OUTPUT .= isset($FB_Shortcode['video_album']) && $FB_Shortcode['video_album'] == 'yes' ? $this->fts_facebook_post_photo($FBlink, $FB_Shortcode, $post_data->from->name, $post_data->format[1]->picture) : $this->fts_facebook_post_photo($FBlink, $FB_Shortcode, $post_data->from->name, 'https://graph.facebook.com/' . $FBpost_id . '/picture/'); } } $FTS_FB_OUTPUT .= '<div class="slicker-facebook-album-photoshadow"></div>'; // FB Video play button for facebook videos. This button takes data from our a tag and along with additional js in the magnific-popup.js we can now load html5 videos. SO lightweight this way because no pre-loading of videos are on the page. We only show the posterboard on mobile devices because tablets and desktops will auto load the videos. SRL if (isset($FB_Shortcode['video_album']) && $FB_Shortcode['video_album'] == 'yes') { if ($FB_Shortcode['play_btn'] == 'yes') { $fb_play_btn_visible = isset($FB_Shortcode['play_btn_visible']) && $FB_Shortcode['play_btn_visible'] == 'yes' ? ' visible-video-button' : ''; $FTS_FB_OUTPUT .= '<a href="' . $post_data->source . '" data-poster="' . $post_data->format[3]->picture . '" id="fts-view-vid1-' . $fts_dynamic_vid_name_string . '" title="' . $FBdescription . '" class="fts-view-fb-videos-btn fb-video-popup-' . $fts_dynamic_vid_name_string . $fb_play_btn_visible . ' fts-slicker-backg" style="height:' . $FB_Shortcode['play_btn_size'] . ' !important; width:' . $FB_Shortcode['play_btn_size'] . '; line-height: ' . $FB_Shortcode['play_btn_size'] . '; font-size:' . $FB_Shortcode['play_btn_size'] . '"><span class="fts-fb-video-icon" style="height:' . $FB_Shortcode['play_btn_size'] . ' width:' . $FB_Shortcode['play_btn_size'] . '; line-height:' . $FB_Shortcode['play_btn_size'] . '; font-size:' . $FB_Shortcode['play_btn_size'] . '"></span></a>'; } } if (!$FB_Shortcode['type'] == 'album_photos') { $FTS_FB_OUTPUT .= '<div class="fts-jal-fb-description-wrap" style="display:none">'; //Output Photo Name $FTS_FB_OUTPUT .= $FBname ? $this->fts_facebook_post_name($FBlink, $FBname, $FBtype) : ''; //Output Photo Caption $FTS_FB_OUTPUT .= $FBcaption ? $this->fts_facebook_post_cap($FBcaption, $FB_Shortcode, $FBtype) : ''; //Output Photo Description $FTS_FB_OUTPUT .= $FBdescription ? $this->fts_facebook_post_desc($FBdescription, $FB_Shortcode, $FBtype, NULL, $FBby) : ''; $FTS_FB_OUTPUT .= '<div class="clear"></div></div>'; } $FTS_FB_OUTPUT .= '<div class="clear"></div></div>'; break; //************************************************** // START ALBUM POST //************************************************** //************************************************** // START ALBUM POST //************************************************** case 'app': case 'cover': case 'profile': case 'mobile': case 'wall': case 'normal': case 'album': $FTS_FB_OUTPUT .= '<div class="fts-jal-fb-link-wrap fts-album-photos-wrap"'; if ($FB_Shortcode['type'] == 'album_photos' || $FB_Shortcode['type'] == 'albums') { $FTS_FB_OUTPUT .= 'style="line-height:' . $FB_Shortcode['image_height'] . ' !important;"'; } $FTS_FB_OUTPUT .= '>'; //Output Photo Picture $FTS_FB_OUTPUT .= $FBalbum_cover ? $this->fts_facebook_post_photo($FBlink, $FB_Shortcode, $post_data->from->name, $post_data->cover_photo->id) : ''; $FTS_FB_OUTPUT .= '<div class="slicker-facebook-album-photoshadow"></div>'; if (!$FB_Shortcode['type'] == 'albums') { $FTS_FB_OUTPUT .= '<div class="fts-jal-fb-description-wrap">'; //Output Photo Name $FTS_FB_OUTPUT .= $FBname ? $this->fts_facebook_post_name($FBlink, $FBname, $FBtype) : ''; //Output Photo Caption $FTS_FB_OUTPUT .= $FBcaption ? $this->fts_facebook_post_cap($FBcaption, $FB_Shortcode, $FBtype) : ''; //Output Photo Description $FTS_FB_OUTPUT .= $FBdescription ? $this->fts_facebook_post_desc($FBdescription, $FB_Shortcode, $FBtype, NULL, $FBby) : ''; $FTS_FB_OUTPUT .= '<div class="clear"></div></div>'; } $FTS_FB_OUTPUT .= '<div class="clear"></div></div>'; break; } $FTS_FB_OUTPUT .= '<div class="clear"></div>'; $FTS_FB_OUTPUT .= '</div>'; $FBpost_single_id = isset($FBpost_single_id) ? $FBpost_single_id : ""; $final_FBpost_like_count = isset($final_FBpost_like_count) ? $final_FBpost_like_count : ""; $final_FBpost_comments_count = isset($final_FBpost_comments_count) ? $final_FBpost_comments_count : ""; $single_event_id = isset($single_event_id) ? $single_event_id : ""; $FTS_FB_OUTPUT .= $this->fts_facebook_post_see_more($FBlink, $lcs_array, $FBtype, $FBpost_id, $FB_Shortcode, $FBpost_user_id, $FBpost_single_id, $single_event_id, $post_data); $FTS_FB_OUTPUT .= '<div class="clear"></div>'; $FTS_FB_OUTPUT .= '</div>'; return $FTS_FB_OUTPUT; }