Custom Facebook Feed - Version 1.9.1

Version Description

  • Fix: Fixed an issue with the 'textlink' shortcode option
  • Fix: Fixed an bug with post text sometimes being duplicated when linked
  • Fix: Removed error_reporting(0);
Download this release

Release Info

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

Code changes from version 1.9.0 to 1.9.1

Files changed (2) hide show
  1. README.txt +7 -2
  2. custom-facebook-feed.php +52 -6
README.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: smashballoon
3
  Tags: Facebook, Facebook feed, Facebook posts, Facebook wall, Facebook events, Facebook page, Facebook group, Facebook Like box, Customizable Facebook Feed, custom, customizable, seo, responsive, mobile, social
4
  Requires at least: 3.0
5
  Tested up to: 3.8.1
6
- Stable tag: 1.9.0
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -28,7 +28,7 @@ Display a **completely customizable**, **responsive** and **search engine crawla
28
  * Show **events** from your Facebook feed with name, date/time, location and description
29
  * Add your own **custom CSS**
30
  * **Caching** means that your Facebook posts load lightning fast. Set your own caching time - check for new posts on Facebook every few seconds, minutes, hours or days. You decide.
31
- * Super **simple to set up**. Just enter your Facebook page ID and you're done.
32
  * Show and hide certain parts of each Facebook post
33
  * Show or hide the Facebook profile picture and name of the author above each post
34
  * Display Facebook posts by just the page owner, everyone who posts on your Facebook page, or only other people
@@ -270,6 +270,11 @@ Credit [iMarketing Factory](http://www.imarketingfactory.com/facebook/ "The Impo
270
 
271
  == Changelog ==
272
 
 
 
 
 
 
273
  = 1.9.0 =
274
  * New: Added the ability to change the text size and color of the post author
275
  * New: Define the format, size and color of shared link titles
3
  Tags: Facebook, Facebook feed, Facebook posts, Facebook wall, Facebook events, Facebook page, Facebook group, Facebook Like box, Customizable Facebook Feed, custom, customizable, seo, responsive, mobile, social
4
  Requires at least: 3.0
5
  Tested up to: 3.8.1
6
+ Stable tag: 1.9.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
28
  * Show **events** from your Facebook feed with name, date/time, location and description
29
  * Add your own **custom CSS**
30
  * **Caching** means that your Facebook posts load lightning fast. Set your own caching time - check for new posts on Facebook every few seconds, minutes, hours or days. You decide.
31
+ * **Super simple to set up**. Just enter your Facebook page ID and you're done.
32
  * Show and hide certain parts of each Facebook post
33
  * Show or hide the Facebook profile picture and name of the author above each post
34
  * Display Facebook posts by just the page owner, everyone who posts on your Facebook page, or only other people
270
 
271
  == Changelog ==
272
 
273
+ = 1.9.1 =
274
+ * Fix: Fixed an issue with the 'textlink' shortcode option
275
+ * Fix: Fixed an bug with post text sometimes being duplicated when linked
276
+ * Fix: Removed error_reporting(0);
277
+
278
  = 1.9.0 =
279
  * New: Added the ability to change the text size and color of the post author
280
  * New: Define the format, size and color of shared link titles
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 a completely customizable Facebook feed to your WordPress site
6
- Version: 1.9.0
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  License: GPLv2 or later
@@ -278,6 +278,9 @@ function display_cff($atts) {
278
  $cff_title_styles .= '"';
279
  $cff_title_link = $atts[ 'textlink' ];
280
 
 
 
 
281
  //Author
282
  $cff_author_size = $atts[ 'authorsize' ];
283
  $cff_author_color = $atts[ 'authorcolor' ];
@@ -743,7 +746,7 @@ function display_cff($atts) {
743
  if (!isset($cff_translate_photos_text) || empty($cff_translate_photos_text)) $cff_translate_photos_text = 'photos';
744
  $cff_post_text = '<' . $cff_title_format . ' class="cff-post-text" ' . $cff_title_styles . '>';
745
  $cff_post_text .= '<span class="cff-text">';
746
- if ($cff_title_link == 'true') $cff_post_text .= '<a class="cff-post-text-link" href="'.$link.'" '.$target.'>';
747
  //Which content should we use?
748
  $cff_post_text_type = '';
749
  //Use the story
@@ -779,7 +782,7 @@ function display_cff($atts) {
779
  //If the post tags option doesn't exist yet (ie. on plugin update) then set them as true
780
  if ( !array_key_exists( 'cff_post_tags', $options ) ) $cff_post_tags = true;
781
  //Add message and story tags if there are any and the post text is the message or the story
782
- if( $cff_post_tags && ( isset($news->message_tags) || isset($news->story_tags) ) && ($cff_post_text_type == 'message' || $cff_post_text_type == 'story') && $cff_title_link != 'true' ){
783
  //Use message_tags or story_tags?
784
  ( isset($news->message_tags) )? $text_tags = $news->message_tags : $text_tags = $news->story_tags;
785
 
@@ -836,7 +839,7 @@ function display_cff($atts) {
836
  //If the text is wrapped in a link then don't hyperlink any text within
837
  if ($cff_title_link) {
838
  //Wrap links in a span so we can break the text if it's too long
839
- $cff_post_text .= cff_autolink( $post_text, true ) . ' ';
840
  } else {
841
  //Don't use htmlspecialchars for post_text as it's added above so that it doesn't mess up the message_tag offsets
842
  $cff_post_text .= cff_autolink( $post_text, $link_color=str_replace('#', '', $atts['textlinkcolor']) ) . ' ';
@@ -982,7 +985,7 @@ function display_cff($atts) {
982
  $cff_description = '<div class="cff-desc-wrap ';
983
  if (empty($picture)) $cff_description .= 'cff-no-image';
984
 
985
- $cff_description .= '"><'.$cff_link_title_format.' class="cff-link-title" '.$cff_link_title_styles.'><a href="'.$link.'" '.$target.' style="color:#' . str_replace('#', '', $cff_link_title_color) . ';">'. $news->name . '</a></'.$cff_link_title_format.'>';
986
 
987
  if (!empty($body_limit)) {
988
  if (strlen($description_text) > $body_limit) $description_text = substr($description_text, 0, $body_limit) . '...';
@@ -1113,6 +1116,49 @@ function cff_fetchUrl($url){
1113
  return $feedData;
1114
  }
1115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1116
  //2013-04-28T21:06:56+0000
1117
  //Time stamp function - used for posts
1118
  function cff_getdate($original, $date_format, $custom_date) {
@@ -1807,5 +1853,5 @@ function cff_autolink_email($text, $tagfill=''){
1807
 
1808
 
1809
  //Comment out the line below to view errors
1810
- error_reporting(0);
1811
  ?>
3
  Plugin Name: Custom Facebook Feed
4
  Plugin URI: http://smashballoon.com/custom-facebook-feed
5
  Description: Add a completely customizable Facebook feed to your WordPress site
6
+ Version: 1.9.1
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  License: GPLv2 or later
278
  $cff_title_styles .= '"';
279
  $cff_title_link = $atts[ 'textlink' ];
280
 
281
+ ( $cff_title_link == 'on' || $cff_title_link == 'true' || $cff_title_link == true ) ? $cff_title_link = true : $cff_title_link = false;
282
+ if( $atts[ 'textlink' ] == 'false' ) $cff_title_link = false;
283
+
284
  //Author
285
  $cff_author_size = $atts[ 'authorsize' ];
286
  $cff_author_color = $atts[ 'authorcolor' ];
746
  if (!isset($cff_translate_photos_text) || empty($cff_translate_photos_text)) $cff_translate_photos_text = 'photos';
747
  $cff_post_text = '<' . $cff_title_format . ' class="cff-post-text" ' . $cff_title_styles . '>';
748
  $cff_post_text .= '<span class="cff-text">';
749
+ if ($cff_title_link) $cff_post_text .= '<a class="cff-post-text-link" href="'.$link.'" '.$target.'>';
750
  //Which content should we use?
751
  $cff_post_text_type = '';
752
  //Use the story
782
  //If the post tags option doesn't exist yet (ie. on plugin update) then set them as true
783
  if ( !array_key_exists( 'cff_post_tags', $options ) ) $cff_post_tags = true;
784
  //Add message and story tags if there are any and the post text is the message or the story
785
+ if( $cff_post_tags && ( isset($news->message_tags) || isset($news->story_tags) ) && ($cff_post_text_type == 'message' || $cff_post_text_type == 'story') && !$cff_title_link ){
786
  //Use message_tags or story_tags?
787
  ( isset($news->message_tags) )? $text_tags = $news->message_tags : $text_tags = $news->story_tags;
788
 
839
  //If the text is wrapped in a link then don't hyperlink any text within
840
  if ($cff_title_link) {
841
  //Wrap links in a span so we can break the text if it's too long
842
+ $cff_post_text .= cff_wrap_span( htmlspecialchars($post_text) ) . ' ';
843
  } else {
844
  //Don't use htmlspecialchars for post_text as it's added above so that it doesn't mess up the message_tag offsets
845
  $cff_post_text .= cff_autolink( $post_text, $link_color=str_replace('#', '', $atts['textlinkcolor']) ) . ' ';
985
  $cff_description = '<div class="cff-desc-wrap ';
986
  if (empty($picture)) $cff_description .= 'cff-no-image';
987
 
988
+ if( isset($news->name) ) $cff_description .= '"><'.$cff_link_title_format.' class="cff-link-title" '.$cff_link_title_styles.'><a href="'.$link.'" '.$target.' style="color:#' . str_replace('#', '', $cff_link_title_color) . ';">'. $news->name . '</a></'.$cff_link_title_format.'>';
989
 
990
  if (!empty($body_limit)) {
991
  if (strlen($description_text) > $body_limit) $description_text = substr($description_text, 0, $body_limit) . '...';
1116
  return $feedData;
1117
  }
1118
 
1119
+ //Make links into span instead when the post text is made clickable
1120
+ function cff_wrap_span($text) {
1121
+ $pattern = '#\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))#';
1122
+ return preg_replace_callback($pattern, 'cff_wrap_span_callback', $text);
1123
+ }
1124
+ function cff_wrap_span_callback($matches) {
1125
+ $max_url_length = 100;
1126
+ $max_depth_if_over_length = 2;
1127
+ $ellipsis = '&hellip;';
1128
+ $target = 'target="_blank"';
1129
+ $url_full = $matches[0];
1130
+ $url_short = '';
1131
+ if (strlen($url_full) > $max_url_length) {
1132
+ $parts = parse_url($url_full);
1133
+ $url_short = $parts['scheme'] . '://' . preg_replace('/^www\./', '', $parts['host']) . '/';
1134
+ $path_components = explode('/', trim($parts['path'], '/'));
1135
+ foreach ($path_components as $dir) {
1136
+ $url_string_components[] = $dir . '/';
1137
+ }
1138
+ if (!empty($parts['query'])) {
1139
+ $url_string_components[] = '?' . $parts['query'];
1140
+ }
1141
+ if (!empty($parts['fragment'])) {
1142
+ $url_string_components[] = '#' . $parts['fragment'];
1143
+ }
1144
+ for ($k = 0; $k < count($url_string_components); $k++) {
1145
+ $curr_component = $url_string_components[$k];
1146
+ if ($k >= $max_depth_if_over_length || strlen($url_short) + strlen($curr_component) > $max_url_length) {
1147
+ if ($k == 0 && strlen($url_short) < $max_url_length) {
1148
+ // Always show a portion of first directory
1149
+ $url_short .= substr($curr_component, 0, $max_url_length - strlen($url_short));
1150
+ }
1151
+ $url_short .= $ellipsis;
1152
+ break;
1153
+ }
1154
+ $url_short .= $curr_component;
1155
+ }
1156
+ } else {
1157
+ $url_short = $url_full;
1158
+ }
1159
+ return "<span class='cff-break-word'>$url_short</span>";
1160
+ }
1161
+
1162
  //2013-04-28T21:06:56+0000
1163
  //Time stamp function - used for posts
1164
  function cff_getdate($original, $date_format, $custom_date) {
1853
 
1854
 
1855
  //Comment out the line below to view errors
1856
+ // error_reporting(0);
1857
  ?>