Custom Facebook Feed - Version 2.9.1

Version Description

  • New: Added support for v3.3 of the Facebook API.
  • Fix: The Access Token selection area was being cut off on small screens when a lot of Facebook pages were listed.
Download this release

Release Info

Developer smashballoon
Plugin Icon 128x128 Custom Facebook Feed
Version 2.9.1
Comparing to
See all releases

Code changes from version 2.9 to 2.9.1

Files changed (3) hide show
  1. README.txt +13 -9
  2. css/cff-admin-style.css +3 -2
  3. custom-facebook-feed.php +104 -81
README.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: smashballoon
3
  Tags: Facebook, Facebook feed, Facebook posts, Facebook wall, Facebook page
4
  Requires at least: 3.0
5
  Tested up to: 5.2
6
- Stable tag: 2.9
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -265,22 +265,26 @@ You no longer need your own Access Token to use the Custom Facebook Feed Plugin,
265
 
266
  == Changelog ==
267
 
 
 
 
 
268
  = 2.9 =
269
- * New: You can now select between a "Regular" or "Boxed" post style. Settings for this can be found at: `Customize > Style Posts > Post Item`. A Box Shadow setting has been added to the "Boxed" post style.
270
- * New: Added some settings to control the size and color of the shared link URLs and descriptions. These can be found at: `Customize > Style Posts > Shared Link Boxes`.
271
- * New: Improved the Access Token retrieval process to make it more intuitive.
272
  * Tweak: Avatar images are now circular to match Facebook.
273
  * Tweak: Animated the social media icons when the "Share" button is clicked.
274
- * Tweak: Changed the way the Like Box loads to avoid a conflict with the Facebook Messenger widget. It no longer uses the Facebook JavaScript SDK.
275
  * Tweak: Changed the elements used for icons from `<i>` to `<span>` to aid accessibility.
276
  * Tweak: Removed the Google+ share option as the platform has been deprecated.
277
  * Tweak: Removed the share widgets from the footer of the admin so that they're only loaded when the "Share the plugin" button is clicked.
278
- * Fix: The plugin now uses the built-in WordPress HTTP API to get data from Facebook instead of making it's own cURL requests.
279
- * Fix: Fixed an issue where the avatars of people posting to the Facebook page weren't being displayed. Individual Facebook API requests for avatars have now been removed and bundled into the main API request.
280
- * Fix: If the link to the profile of a visitor posting to your page is not available then remove the link from the avatar and author name.
281
  * Fix: Fixed an accessibility error caused by the share icons being empty links.
282
  * Fix: Removed the use of the ENT_HTML5 constant as it isn't supported in PHP 5.4.
283
- * Fix: Fixed a rare issue with tags in post stories when the locale was set to be Greek.
284
 
285
  = 2.8 =
286
  * New: Added support for Facebook Notes in timeline feeds. If your Facebook timeline feed contains a note then the plugin will now get the content from the note and display it within the Facebook post.
3
  Tags: Facebook, Facebook feed, Facebook posts, Facebook wall, Facebook page
4
  Requires at least: 3.0
5
  Tested up to: 5.2
6
+ Stable tag: 2.9.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
265
 
266
  == Changelog ==
267
 
268
+ = 2.9.1 =
269
+ * New: Added support for v3.3 of the Facebook API.
270
+ * Fix: The Access Token selection area was being cut off on small screens when a lot of Facebook pages were listed.
271
+
272
  = 2.9 =
273
+ * New: You can now select between a "Regular" or "Boxed" post style. Settings for this can be found at: `Facebook Feed > Customize > Style Posts > Post Item`. A Box Shadow setting has been added to the "Boxed" post style.
274
+ * New: Added some settings to control the size and color of the Facebook shared link URLs and descriptions. These can be found at: `Facebook Feed > Customize > Style Posts > Shared Link Boxes`.
275
+ * New: Improved the Facebook Access Token retrieval process to make it more intuitive.
276
  * Tweak: Avatar images are now circular to match Facebook.
277
  * Tweak: Animated the social media icons when the "Share" button is clicked.
278
+ * Tweak: Changed the way the Facebook Like Box loads to avoid a conflict with the Facebook Messenger widget. It no longer uses the Facebook JavaScript SDK.
279
  * Tweak: Changed the elements used for icons from `<i>` to `<span>` to aid accessibility.
280
  * Tweak: Removed the Google+ share option as the platform has been deprecated.
281
  * Tweak: Removed the share widgets from the footer of the admin so that they're only loaded when the "Share the plugin" button is clicked.
282
+ * Fix: The plugin now uses the built-in WordPress HTTP API to get data from Facebook instead of making it's own cURL requests to the Facebook API.
283
+ * Fix: Fixed an issue where the avatars of people posting to the Facebook page weren't being displayed. Individual Facebook API requests for avatars have now been removed and bundled into the main Facebook API request.
284
+ * Fix: If the link to the Facebook profile of a visitor posting to your page is not available then remove the link from the avatar and author name.
285
  * Fix: Fixed an accessibility error caused by the share icons being empty links.
286
  * Fix: Removed the use of the ENT_HTML5 constant as it isn't supported in PHP 5.4.
287
+ * Fix: Fixed a rare issue with tags in Facebook post stories when the locale was set to be Greek.
288
 
289
  = 2.8 =
290
  * New: Added support for Facebook Notes in timeline feeds. If your Facebook timeline feed contains a note then the plugin will now get the content from the note and display it within the Facebook post.
css/cff-admin-style.css CHANGED
@@ -437,6 +437,7 @@
437
 
438
  /* Quick start */
439
  #cff-admin .cff_quickstart{
 
440
  display: inline-block;
441
  margin: 15px 0 0 0;
442
  padding: 15px 20px;
@@ -956,7 +957,7 @@
956
  }
957
  #cff-admin .cff_modal_box{
958
  position: absolute;
959
- top: 160px;
960
  left: 50%;
961
  width: 480px;
962
  margin: 0 0 0 -245px;
@@ -993,7 +994,7 @@
993
  display: block;
994
  }
995
  #cff-admin .cff-pages-wrap{
996
- max-height: 400px;
997
  overflow-y: auto;
998
  }
999
  #cff-admin .cff_modal_tokens .cff_modal_box p{
437
 
438
  /* Quick start */
439
  #cff-admin .cff_quickstart{
440
+ float: left;
441
  display: inline-block;
442
  margin: 15px 0 0 0;
443
  padding: 15px 20px;
957
  }
958
  #cff-admin .cff_modal_box{
959
  position: absolute;
960
+ top: 140px;
961
  left: 50%;
962
  width: 480px;
963
  margin: 0 0 0 -245px;
994
  display: block;
995
  }
996
  #cff-admin .cff-pages-wrap{
997
+ max-height: 310px;
998
  overflow-y: auto;
999
  }
1000
  #cff-admin .cff_modal_tokens .cff_modal_box p{
custom-facebook-feed.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Custom Facebook Feed
4
  Plugin URI: http://smashballoon.com/custom-facebook-feed
5
  Description: Add completely customizable Facebook feeds to your WordPress site
6
- Version: 2.9
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  License: GPLv2 or later
@@ -24,7 +24,7 @@ along with this program; if not, write to the Free Software
24
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
  */
26
 
27
- define('CFFVER', '2.9');
28
 
29
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
30
  //Include admin
@@ -886,7 +886,7 @@ function display_cff($atts) {
886
  //ALL POSTS
887
  if (!$cff_events_only){
888
 
889
- $cff_posts_json_url = 'https://graph.facebook.com/' . $page_id . '/' . $graph_query . '?fields=id,from{picture,id,name,link},message,message_tags,story,story_tags,link,source,name,caption,description,type,status_type,object_id,created_time,backdated_time,call_to_action&access_token=' . $access_token . '&limit=' . $cff_post_limit . '&locale=' . $cff_locale . $cff_ssl;
890
 
891
  if( $cff_show_access_token && strlen($access_token) > 130 ){
892
  //If using a Page Access Token then set caching time to be minimum of 5 minutes
@@ -999,8 +999,26 @@ function display_cff($atts) {
999
  $PostID = explode("_", $cff_post_id);
1000
  }
1001
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1002
  //Check the post type
1003
- $cff_post_type = $news->type;
 
 
1004
  if ($cff_post_type == 'link') {
1005
  isset($news->story) ? $story = $news->story : $story = '';
1006
  //Check whether it's an event
@@ -1032,7 +1050,7 @@ function display_cff($atts) {
1032
  case 'offer':
1033
  $cff_show_post = true;
1034
  break;
1035
- case 'status':
1036
  //Check whether it's a status (author comment or like)
1037
  if ( $cff_show_status_type && !empty($news->message) ) $cff_show_post = true;
1038
  break;
@@ -1088,7 +1106,7 @@ function display_cff($atts) {
1088
  }
1089
 
1090
  //Check the post type
1091
- isset($news->type) ? $cff_post_type = $news->type : $cff_post_type = '';
1092
  if ($cff_post_type == 'link') {
1093
  isset($news->story) ? $story = $news->story : $story = '';
1094
  //Check whether it's an event
@@ -1453,56 +1471,30 @@ function display_cff($atts) {
1453
  }
1454
 
1455
 
1456
- //Add the story and message together
1457
- $post_text = '';
1458
-
1459
- //DESCRIPTION
1460
- $cff_description = '';
1461
- if ( !empty($news->description) || !empty($news->caption) ) {
1462
- $description_text = '';
1463
- if ( !empty($news->description) ) {
1464
- $description_text = $news->description;
1465
- } else {
1466
- $description_text = $news->caption;
1467
- }
1468
-
1469
- //If the description is the same as the post text then don't show it
1470
- if( $description_text == $cff_story_raw || $description_text == $cff_message_raw || $description_text == $cff_name_raw ){
1471
- $cff_description = '';
1472
- } else {
1473
- //Add links and create HTML
1474
- $cff_description .= '<span class="cff-post-desc" '.$cff_body_styles.'>';
1475
-
1476
- if ($cff_title_link) {
1477
- $cff_description_tagged = cff_wrap_span( htmlspecialchars($description_text) );
1478
- } else {
1479
- $cff_description_text = cff_autolink( htmlspecialchars($description_text), $link_color=$cff_posttext_link_color );
1480
- $cff_description_tagged = cff_desc_tags($cff_description_text);
1481
- }
1482
- $cff_description .= $cff_description_tagged;
1483
- $cff_description .= ' </span>';
1484
- }
1485
-
1486
- if( $cff_post_type == 'event' ) $cff_description = '';
1487
- }
1488
-
1489
  //Check to see whether it's an embedded video so that we can show the name above the post text if necessary
1490
  $cff_soundcloud = false;
1491
  $cff_is_video_embed = false;
1492
- if ($news->type == 'video'){
1493
- isset($news->source) ? $url = $news->source : $url = '';
 
 
 
 
 
 
1494
  //Embeddable video strings
1495
  $youtube = 'youtube';
1496
  $youtu = 'youtu';
1497
  $vimeo = 'vimeo';
1498
  $youtubeembed = 'youtube.com/embed';
1499
- $soundcloud = 'player.soundcloud.com';
1500
  $swf = '.swf';
1501
  //Check whether it's a youtube video
1502
  $youtube = stripos($url, $youtube);
1503
  $youtu = stripos($url, $youtu);
1504
  $youtubeembed = stripos($url, $youtubeembed);
1505
  //Check whether it's a SoundCloud embed
 
1506
  $soundcloudembed = stripos($url, $soundcloud);
1507
  //Check whether it's a youtube video
1508
  if($youtube || $youtu || $youtubeembed || (stripos($url, $vimeo) !== false)) {
@@ -1511,7 +1503,6 @@ function display_cff($atts) {
1511
  //If it's soundcloud then add it into the shared link box at the bottom of the post
1512
  if( $soundcloudembed ) $cff_soundcloud = true;
1513
 
1514
-
1515
  $cff_video_name = '';
1516
  //If the name exists and it's a non-embedded video then show the name at the top of the post text
1517
  if( isset($news->name) && !$cff_is_video_embed ){
@@ -1531,11 +1522,44 @@ function display_cff($atts) {
1531
  }
1532
  }
1533
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1534
  //Add the message
1535
  if($cff_show_text) $post_text .= $post_text_message;
1536
 
1537
  //If it's a shared video post then add the video name after the post text above the video description so it's all one chunk
1538
- if ($news->type == 'video'){
1539
  if( !empty($cff_description) && $cff_description != '' ){
1540
  if( (!empty($post_text) && $post_text != '') && !empty($cff_video_name) ) $post_text .= '<br /><br />';
1541
  $post_text .= $cff_video_name;
@@ -1544,7 +1568,7 @@ function display_cff($atts) {
1544
 
1545
 
1546
  //Use the name
1547
- if (!empty($news->name) && empty($news->story) && empty($news->message)) {
1548
  $cff_name_raw = $news->name;
1549
  $post_text = htmlspecialchars($cff_name_raw);
1550
  $cff_post_text_type = 'name';
@@ -1572,38 +1596,32 @@ function display_cff($atts) {
1572
 
1573
 
1574
  //Create note
1575
- if ($news->status_type == 'created_note') {
1576
 
1577
- //Is it SSL?
1578
- $cff_ssl = '';
1579
- if (is_ssl()) $cff_ssl = '&return_ssl_resources=true';
1580
-
1581
- //Get the contents of the event
1582
- $note_json_url = 'https://graph.facebook.com/'.$cff_post_id.'?fields=attachments&access_token=' . $access_token . $cff_ssl;
1583
-
1584
- // Get any existing copy of our transient data
1585
  $transient_name = 'cff_tle_' . $cff_post_id;
1586
  $transient_name = substr($transient_name, 0, 45);
 
 
1587
 
1588
- if ( false === ( $cff_note_json = get_transient( $transient_name ) ) || $cff_note_json === null ) {
1589
- //Get the contents of the Facebook page
1590
- $cff_note_json = cff_fetchUrl($note_json_url);
1591
- //Cache the JSON for 180 days as the note info probably isn't going to change
1592
- set_transient( $transient_name, $cff_note_json, 60 * 60 * 24 * 180 );
 
 
1593
  } else {
1594
- $cff_note_json = get_transient( $transient_name );
1595
- //If we can't find the transient then fall back to just getting the json from the api
1596
- if ($cff_note_json == false) $cff_note_json = cff_fetchUrl($note_json_url);
 
 
 
 
 
1597
  }
1598
 
1599
- //Interpret data with JSON
1600
- $cff_note_obj = json_decode($cff_note_json);
1601
- $cff_note_object = $cff_note_obj->attachments->data[0];
1602
-
1603
- isset($cff_note_object->title) ? $cff_note_title = htmlentities($cff_note_object->title, ENT_QUOTES, 'UTF-8') : $cff_note_title = '';
1604
- isset($cff_note_object->description) ? $cff_note_description = htmlentities($cff_note_object->description, ENT_QUOTES, 'UTF-8') : $cff_note_description = '';
1605
- isset($cff_note_object->url) ? $cff_note_link = $cff_note_object->url : $cff_note_link = '';
1606
- isset( $cff_note_object->media->image->src ) ? $cff_note_media_src = $cff_note_object->media->image->src : $cff_note_media_src = false;
1607
 
1608
  //Note details
1609
  $cff_note = '<span class="cff-details">';
@@ -1650,6 +1668,9 @@ function display_cff($atts) {
1650
  //'See More' link
1651
  $cff_post_text .= '<span class="cff-expand">... <a href="#" style="color: #'.$cff_posttext_link_color.'"><span class="cff-more">' . $cff_see_more_text . '</span><span class="cff-less">' . $cff_see_less_text . '</span></a></span>';
1652
  $cff_post_text .= '</' . $cff_title_format . '>';
 
 
 
1653
  }
1654
 
1655
  //Add a call to action button if included
@@ -1687,7 +1708,7 @@ function display_cff($atts) {
1687
  //LINK
1688
  $cff_shared_link = '';
1689
  //Display shared link
1690
- if ($cff_post_type == 'link' || $cff_soundcloud) {
1691
 
1692
  $cff_shared_link .= '<div class="cff-shared-link';
1693
  if($cff_disable_link_box) $cff_shared_link .= ' cff-no-styles';
@@ -1718,7 +1739,7 @@ function display_cff($atts) {
1718
  if( strlen($cff_link_url_size_html) > 1 ) $cff_link_styles_html .= $cff_link_url_size_html;
1719
  if( strlen($cff_link_url_color_html) > 1 || strlen($cff_link_url_size_html) > 1 ) $cff_link_styles_html .= '"';
1720
 
1721
- if(!empty($cff_link_caption)) $cff_shared_link .= '<p class="cff-link-caption" '.$cff_link_styles_html.'>'.$cff_link_caption.'</p>';
1722
  if ($cff_show_desc) {
1723
  //Truncate desc
1724
  if (!empty($body_limit)) {
@@ -1759,7 +1780,7 @@ function display_cff($atts) {
1759
 
1760
  //Check to see whether it's an embedded video so that we can show the name above the post text if necessary
1761
  $cff_is_video_embed = false;
1762
- if ( $news->type == 'video' && isset($news->source) ){
1763
  $url = $news->source;
1764
  //Embeddable video strings
1765
  $youtube = 'youtube';
@@ -1778,7 +1799,7 @@ function display_cff($atts) {
1778
 
1779
 
1780
  $cff_media = '';
1781
- if ($news->type == 'video') {
1782
  //Add the name to the description if it's a video embed
1783
  if($cff_is_video_embed) {
1784
  isset($news->name) ? $video_name = $news->name : $video_name = $link;
@@ -1857,6 +1878,7 @@ function display_cff($atts) {
1857
  if (!isset($cff_translate_video_text) || empty($cff_translate_video_text)) $cff_translate_video_text = 'Video';
1858
 
1859
  $cff_media_link = '';
 
1860
  if( $cff_show_media_link && ($cff_post_type == 'photo' || $cff_post_type == 'video') ){
1861
  $cff_media_link .= '<p class="cff-media-link"><a href="'.$link.'" '.$target.' style="color: #'.$cff_posttext_link_color.';"><span style="padding-right: 5px;" class="fa fas fa-';
1862
  if($cff_post_type == 'photo') $cff_media_link .= 'picture-o fa-image" aria-hidden="true"></span>'. $cff_translate_photo_text;
@@ -1870,13 +1892,14 @@ function display_cff($atts) {
1870
  //**************************//
1871
  //Start the container
1872
  $cff_post_item = '<div class="cff-item ';
1873
- if ($cff_post_type == 'link') $cff_post_item .= 'cff-link-item';
1874
- if ($cff_post_type == 'event') $cff_post_item .= 'cff-timeline-event';
1875
- if ($cff_post_type == 'photo') $cff_post_item .= 'cff-photo-post';
1876
- if ($cff_post_type == 'video') $cff_post_item .= 'cff-video-post';
1877
- if ($cff_post_type == 'swf') $cff_post_item .= 'cff-swf-post';
1878
- if ($cff_post_type == 'status') $cff_post_item .= 'cff-status-post';
1879
- if ($cff_post_type == 'offer') $cff_post_item .= 'cff-offer-post';
 
1880
  if ($cff_album) $cff_post_item .= ' cff-album';
1881
 
1882
  if ($cff_post_bg_color_check || $cff_post_style == "boxed") $cff_post_item .= ' cff-box';
3
  Plugin Name: Custom Facebook Feed
4
  Plugin URI: http://smashballoon.com/custom-facebook-feed
5
  Description: Add completely customizable Facebook feeds to your WordPress site
6
+ Version: 2.9.1
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  License: GPLv2 or later
24
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
  */
26
 
27
+ define('CFFVER', '2.9.1');
28
 
29
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
30
  //Include admin
886
  //ALL POSTS
887
  if (!$cff_events_only){
888
 
889
+ $cff_posts_json_url = 'https://graph.facebook.com/v3.3/' . $page_id . '/' . $graph_query . '?fields=id,from{picture,id,name,link},message,message_tags,story,story_tags,status_type,created_time,backdated_time,call_to_action,attachments{title,description,media_type,unshimmed_url,target{id},media{source}}&access_token=' . $access_token . '&limit=' . $cff_post_limit . '&locale=' . $cff_locale . $cff_ssl;
890
 
891
  if( $cff_show_access_token && strlen($access_token) > 130 ){
892
  //If using a Page Access Token then set caching time to be minimum of 5 minutes
999
  $PostID = explode("_", $cff_post_id);
1000
  }
1001
 
1002
+ //Reassign variable changes from API v3.3 update
1003
+ $news->link = '';
1004
+ $news->description = '';
1005
+ $news->name = '';
1006
+ $news->caption = '';
1007
+ $news->source = '';
1008
+ $news->object_id = '';
1009
+ if( isset($news->attachments->data[0]->unshimmed_url) ) $news->link = $news->attachments->data[0]->unshimmed_url;
1010
+ if( isset($news->attachments->data[0]->description) ) $news->description = $news->attachments->data[0]->description;
1011
+ if( isset($news->attachments->data[0]->target->id) ) $news->object_id = $news->attachments->data[0]->target->id;
1012
+ if( isset($news->attachments->data[0]->media->source) ) $news->source = $news->attachments->data[0]->media->source;
1013
+ if( isset($news->attachments->data[0]->title) ){
1014
+ $news->name = $news->attachments->data[0]->title;
1015
+ $news->caption = $news->attachments->data[0]->title;
1016
+ }
1017
+
1018
  //Check the post type
1019
+ $cff_post_type = 'status';
1020
+ if( isset($news->attachments->data[0]->media_type) ) $cff_post_type = $news->attachments->data[0]->media_type;
1021
+
1022
  if ($cff_post_type == 'link') {
1023
  isset($news->story) ? $story = $news->story : $story = '';
1024
  //Check whether it's an event
1050
  case 'offer':
1051
  $cff_show_post = true;
1052
  break;
1053
+ default:
1054
  //Check whether it's a status (author comment or like)
1055
  if ( $cff_show_status_type && !empty($news->message) ) $cff_show_post = true;
1056
  break;
1106
  }
1107
 
1108
  //Check the post type
1109
+ isset($cff_post_type) ? $cff_post_type = $cff_post_type : $cff_post_type = '';
1110
  if ($cff_post_type == 'link') {
1111
  isset($news->story) ? $story = $news->story : $story = '';
1112
  //Check whether it's an event
1471
  }
1472
 
1473
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1474
  //Check to see whether it's an embedded video so that we can show the name above the post text if necessary
1475
  $cff_soundcloud = false;
1476
  $cff_is_video_embed = false;
1477
+ if ($cff_post_type == 'video' || $cff_post_type == 'music'){
1478
+ if( isset($news->source) && !empty($news->source) ){
1479
+ $url = $news->source;
1480
+ } else if ( isset($news->link) ) {
1481
+ $url = $news->link;
1482
+ } else {
1483
+ $url = '';
1484
+ }
1485
  //Embeddable video strings
1486
  $youtube = 'youtube';
1487
  $youtu = 'youtu';
1488
  $vimeo = 'vimeo';
1489
  $youtubeembed = 'youtube.com/embed';
1490
+ $soundcloud = 'soundcloud.com';
1491
  $swf = '.swf';
1492
  //Check whether it's a youtube video
1493
  $youtube = stripos($url, $youtube);
1494
  $youtu = stripos($url, $youtu);
1495
  $youtubeembed = stripos($url, $youtubeembed);
1496
  //Check whether it's a SoundCloud embed
1497
+
1498
  $soundcloudembed = stripos($url, $soundcloud);
1499
  //Check whether it's a youtube video
1500
  if($youtube || $youtu || $youtubeembed || (stripos($url, $vimeo) !== false)) {
1503
  //If it's soundcloud then add it into the shared link box at the bottom of the post
1504
  if( $soundcloudembed ) $cff_soundcloud = true;
1505
 
 
1506
  $cff_video_name = '';
1507
  //If the name exists and it's a non-embedded video then show the name at the top of the post text
1508
  if( isset($news->name) && !$cff_is_video_embed ){
1522
  }
1523
  }
1524
 
1525
+ //Add the story and message together
1526
+ $post_text = '';
1527
+
1528
+ //DESCRIPTION
1529
+ $cff_description = '';
1530
+ if ( !empty($news->description) || !empty($news->caption) ) {
1531
+ $description_text = '';
1532
+
1533
+ if ( !empty($news->description) ) {
1534
+ $description_text = $news->description;
1535
+ }
1536
+
1537
+ //If the description is the same as the post text then don't show it
1538
+ if( $description_text == $cff_story_raw || $description_text == $cff_message_raw || $description_text == $cff_name_raw ){
1539
+ $cff_description = '';
1540
+ } else {
1541
+ //Add links and create HTML
1542
+ $cff_description .= '<span class="cff-post-desc" '.$cff_body_styles.'>';
1543
+
1544
+ if ($cff_title_link) {
1545
+ $cff_description_tagged = cff_wrap_span( htmlspecialchars($description_text) );
1546
+ } else {
1547
+ $cff_description_text = cff_autolink( htmlspecialchars($description_text), $link_color=$cff_posttext_link_color );
1548
+ $cff_description_tagged = cff_desc_tags($cff_description_text);
1549
+ }
1550
+
1551
+ $cff_description .= $cff_description_tagged;
1552
+ $cff_description .= ' </span>';
1553
+ }
1554
+
1555
+ if( $cff_post_type == 'event' || $cff_is_video_embed || $cff_soundcloud ) $cff_description = '';
1556
+ }
1557
+
1558
  //Add the message
1559
  if($cff_show_text) $post_text .= $post_text_message;
1560
 
1561
  //If it's a shared video post then add the video name after the post text above the video description so it's all one chunk
1562
+ if ($cff_post_type == 'video'){
1563
  if( !empty($cff_description) && $cff_description != '' ){
1564
  if( (!empty($post_text) && $post_text != '') && !empty($cff_video_name) ) $post_text .= '<br /><br />';
1565
  $post_text .= $cff_video_name;
1568
 
1569
 
1570
  //Use the name
1571
+ if (!empty($news->name) && empty($news->message)) {
1572
  $cff_name_raw = $news->name;
1573
  $post_text = htmlspecialchars($cff_name_raw);
1574
  $cff_post_text_type = 'name';
1596
 
1597
 
1598
  //Create note
1599
+ if ($cff_post_type == 'note') {
1600
 
1601
+ // Get any existing copy of our transient data from previous versions
 
 
 
 
 
 
 
1602
  $transient_name = 'cff_tle_' . $cff_post_id;
1603
  $transient_name = substr($transient_name, 0, 45);
1604
+ if ( false !== ( $cff_note_json = get_transient( $transient_name ) ) ) {
1605
+ $cff_note_json = get_transient( $transient_name );
1606
 
1607
+ //Interpret data with JSON
1608
+ $cff_note_obj = json_decode($cff_note_json);
1609
+ $cff_note_object = $cff_note_obj->attachments->data[0];
1610
+ isset($cff_note_object->title) ? $cff_note_title = htmlentities($cff_note_object->title, ENT_QUOTES, 'UTF-8') : $cff_note_title = '';
1611
+ isset($cff_note_object->description) ? $cff_note_description = htmlentities($cff_note_object->description, ENT_QUOTES, 'UTF-8') : $cff_note_description = '';
1612
+ isset($cff_note_object->url) ? $cff_note_link = $cff_note_object->url : $cff_note_link = '';
1613
+ isset( $cff_note_object->media->image->src ) ? $cff_note_media_src = $cff_note_object->media->image->src : $cff_note_media_src = false;
1614
  } else {
1615
+ $attachment_data = '';
1616
+ if(isset($news->attachments->data[0])){
1617
+ $attachment_data = $news->attachments->data[0];
1618
+ isset($attachment_data->title) ? $cff_note_title = htmlentities($attachment_data->title, ENT_QUOTES, 'UTF-8') : $cff_note_title = '';
1619
+ isset($attachment_data->description) ? $cff_note_description = htmlentities($attachment_data->description, ENT_QUOTES, 'UTF-8') : $cff_note_description = '';
1620
+ isset($attachment_data->unshimmed_url) ? $cff_note_link = $attachment_data->unshimmed_url : $cff_note_link = '';
1621
+ $cff_note_media_src = '';
1622
+ }
1623
  }
1624
 
 
 
 
 
 
 
 
 
1625
 
1626
  //Note details
1627
  $cff_note = '<span class="cff-details">';
1668
  //'See More' link
1669
  $cff_post_text .= '<span class="cff-expand">... <a href="#" style="color: #'.$cff_posttext_link_color.'"><span class="cff-more">' . $cff_see_more_text . '</span><span class="cff-less">' . $cff_see_less_text . '</span></a></span>';
1670
  $cff_post_text .= '</' . $cff_title_format . '>';
1671
+
1672
+ //Facebook returns the text as "'s cover photo" for some reason, so ignore it
1673
+ if( $post_text == "'s cover photo" ) $cff_post_text = '';
1674
  }
1675
 
1676
  //Add a call to action button if included
1708
  //LINK
1709
  $cff_shared_link = '';
1710
  //Display shared link
1711
+ if ($cff_post_type == 'link' || $cff_soundcloud || $cff_is_video_embed) {
1712
 
1713
  $cff_shared_link .= '<div class="cff-shared-link';
1714
  if($cff_disable_link_box) $cff_shared_link .= ' cff-no-styles';
1739
  if( strlen($cff_link_url_size_html) > 1 ) $cff_link_styles_html .= $cff_link_url_size_html;
1740
  if( strlen($cff_link_url_color_html) > 1 || strlen($cff_link_url_size_html) > 1 ) $cff_link_styles_html .= '"';
1741
 
1742
+ // if(!empty($cff_link_caption)) $cff_shared_link .= '<p class="cff-link-caption" '.$cff_link_styles_html.'>'.$cff_link_caption.'</p>';
1743
  if ($cff_show_desc) {
1744
  //Truncate desc
1745
  if (!empty($body_limit)) {
1780
 
1781
  //Check to see whether it's an embedded video so that we can show the name above the post text if necessary
1782
  $cff_is_video_embed = false;
1783
+ if ( $cff_post_type == 'video' && isset($news->source) ){
1784
  $url = $news->source;
1785
  //Embeddable video strings
1786
  $youtube = 'youtube';
1799
 
1800
 
1801
  $cff_media = '';
1802
+ if ($cff_post_type == 'video') {
1803
  //Add the name to the description if it's a video embed
1804
  if($cff_is_video_embed) {
1805
  isset($news->name) ? $video_name = $news->name : $video_name = $link;
1878
  if (!isset($cff_translate_video_text) || empty($cff_translate_video_text)) $cff_translate_video_text = 'Video';
1879
 
1880
  $cff_media_link = '';
1881
+
1882
  if( $cff_show_media_link && ($cff_post_type == 'photo' || $cff_post_type == 'video') ){
1883
  $cff_media_link .= '<p class="cff-media-link"><a href="'.$link.'" '.$target.' style="color: #'.$cff_posttext_link_color.';"><span style="padding-right: 5px;" class="fa fas fa-';
1884
  if($cff_post_type == 'photo') $cff_media_link .= 'picture-o fa-image" aria-hidden="true"></span>'. $cff_translate_photo_text;
1892
  //**************************//
1893
  //Start the container
1894
  $cff_post_item = '<div class="cff-item ';
1895
+ $cff_post_type_class = 'cff-status-post';
1896
+ if ($cff_post_type == 'link') $cff_post_type_class = 'cff-link-item';
1897
+ if ($cff_post_type == 'event') $cff_post_type_class = 'cff-timeline-event';
1898
+ if ($cff_post_type == 'photo') $cff_post_type_class = 'cff-photo-post';
1899
+ if ($cff_post_type == 'video') $cff_post_type_class = 'cff-video-post';
1900
+ if ($cff_post_type == 'swf') $cff_post_type_class = 'cff-swf-post';
1901
+ if ($cff_post_type == 'offer') $cff_post_type_class = 'cff-offer-post';
1902
+ $cff_post_item .= $cff_post_type_class;
1903
  if ($cff_album) $cff_post_item .= ' cff-album';
1904
 
1905
  if ($cff_post_bg_color_check || $cff_post_style == "boxed") $cff_post_item .= ' cff-box';