Custom Facebook Feed - Version 1.9.3

Version Description

Download this release

Release Info

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

Code changes from version 1.9.1 to 1.9.3

README.txt CHANGED
@@ -2,8 +2,8 @@
2
  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.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -270,6 +270,12 @@ Credit [iMarketing Factory](http://www.imarketingfactory.com/facebook/ "The Impo
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
@@ -282,7 +288,6 @@ Credit [iMarketing Factory](http://www.imarketingfactory.com/facebook/ "The Impo
282
  * Tweak: Moved the Feed Header options to the Typography page
283
  * Tweak: Moved the Ajax setting to the Misc page
284
  * Tweak: Now removes any query strings attached to the Page ID
285
- * Fix: Fixed an issue with HTML characters not rendering correctly when linking the post text
286
  * Fix: Fixed an issue with some themes causing the clear element to prevent links being clickable
287
  * Fix: Some minor bug fixes
288
 
2
  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.9
6
+ Stable tag: 1.9.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
270
 
271
  == Changelog ==
272
 
273
+ = 1.9.2 =
274
+ * Fix: Added title and alt attributes to the post author profile picture
275
+ * Fix: Improved the reliability of the post tag linking
276
+ * Fix: Fixed an issue with HTML characters not rendering correctly when linking the post text
277
+ * Fix: Improved the reliability of the CSS clearing method used on the feed container
278
+
279
  = 1.9.1 =
280
  * Fix: Fixed an issue with the 'textlink' shortcode option
281
  * Fix: Fixed an bug with post text sometimes being duplicated when linked
288
  * Tweak: Moved the Feed Header options to the Typography page
289
  * Tweak: Moved the Ajax setting to the Misc page
290
  * Tweak: Now removes any query strings attached to the Page ID
 
291
  * Fix: Fixed an issue with some themes causing the clear element to prevent links being clickable
292
  * Fix: Some minor bug fixes
293
 
css/cff-style.css CHANGED
@@ -3,13 +3,18 @@
3
  /**************/
4
  /* Feed container */
5
  #cff {
6
- float: left;
7
  width: 100%;
8
  margin: 0 auto;
9
  -webkit-box-sizing: border-box;
10
  -moz-box-sizing: border-box;
11
  box-sizing: border-box;
12
  }
 
 
 
 
 
13
  /* Individual post item */
14
  #cff .cff-item{
15
  float: left;
@@ -225,7 +230,7 @@
225
  }
226
 
227
  /* Clear fix */
228
- .cff-clear:after {
229
  clear: both;
230
  content: ".";
231
  display: block;
@@ -235,9 +240,8 @@
235
  .cff-clear {
236
  display: inline-block;
237
  display: block;
238
- /* Needs to be position static to override themes which set it to be relative*/
239
  position: static;
240
- }
241
  /*********************/
242
  /*** STYLE OPTIONS ***/
243
  /*********************/
3
  /**************/
4
  /* Feed container */
5
  #cff {
6
+ /*float: left;*/
7
  width: 100%;
8
  margin: 0 auto;
9
  -webkit-box-sizing: border-box;
10
  -moz-box-sizing: border-box;
11
  box-sizing: border-box;
12
  }
13
+ #cff:after{
14
+ content: "";
15
+ display: table;
16
+ clear: both;
17
+ }
18
  /* Individual post item */
19
  #cff .cff-item{
20
  float: left;
230
  }
231
 
232
  /* Clear fix */
233
+ /*.cff-clear:after {
234
  clear: both;
235
  content: ".";
236
  display: block;
240
  .cff-clear {
241
  display: inline-block;
242
  display: block;
 
243
  position: static;
244
+ }*/
245
  /*********************/
246
  /*** STYLE OPTIONS ***/
247
  /*********************/
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.1
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  License: GPLv2 or later
@@ -736,8 +736,7 @@ function display_cff($atts) {
736
  //Set the author image as a variable. If it already exists then don't query the api for it again.
737
  $cff_author_img_var = '$cff_author_img_' . $news->from->id;
738
  if ( !isset($$cff_author_img_var) ) $$cff_author_img_var = 'https://graph.facebook.com/' . $news->from->id . '/picture?type=square';
739
-
740
- $cff_author .= '<img src="'.$$cff_author_img_var.'" width=50 height=50>';
741
  $cff_author .= '<span class="cff-page-name">'.$news->from->name.'</span>';
742
  $cff_author .= '</a>';
743
 
@@ -786,52 +785,59 @@ function display_cff($atts) {
786
  //Use message_tags or story_tags?
787
  ( isset($news->message_tags) )? $text_tags = $news->message_tags : $text_tags = $news->story_tags;
788
 
789
- //Does the Post Text contain any html tags? - the & symbol is the best indicator of this
790
- $html_check = stripos($post_text, '&');
791
 
792
- //If it contains HTML tags then use the name replace method
793
- $html_check = true;
794
- //always use the text replace method
795
- if( $html_check ) {
796
- //Loop through the tags
797
- foreach($text_tags as $message_tag ) {
798
- $tag_name = $message_tag[0]->name;
799
- $tag_link = '<a href="http://facebook.com/' . $message_tag[0]->id . '" style="color: #'.str_replace('#', '', $atts['textlinkcolor']).';" target="_blank">' . $message_tag[0]->name . '</a>';
800
 
801
- $post_text = str_replace($tag_name, $tag_link, $post_text);
802
- }
 
 
 
 
 
 
803
 
804
- } else {
805
- //If it doesn't contain HTMl tags then use the offset to replace message tags
806
- $message_tags_arr = array();
807
-
808
- $i = 0;
809
- foreach($text_tags as $message_tag ) {
810
- $i++;
811
- $message_tags_arr = array_push_assoc(
812
- $message_tags_arr,
813
- $i,
814
- array(
815
- 'id' => $message_tag[0]->id,
816
- 'name' => $message_tag[0]->name,
817
- 'type' => $message_tag[0]->type,
818
- 'offset' => $message_tag[0]->offset,
819
- 'length' => $message_tag[0]->length
820
- )
821
- );
822
- }
 
 
 
 
 
 
 
 
 
823
 
824
- for($i = count($message_tags_arr); $i >= 1; $i--) {
825
-
826
- $b = '<a href="http://facebook.com/' . $message_tags_arr[$i]['id'] . '" target="_blank">' . $message_tags_arr[$i]['name'] . '</a>';
827
- $c = $message_tags_arr[$i]['offset'];
828
- $d = $message_tags_arr[$i]['length'];
829
 
830
- $post_text = substr_replace( $post_text, $b, $c, $d);
831
 
832
- }
833
 
834
- }
835
 
836
  } //END MESSAGE TAGS
837
 
@@ -839,7 +845,7 @@ function display_cff($atts) {
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']) ) . ' ';
@@ -1043,7 +1049,7 @@ function display_cff($atts) {
1043
  if($cff_show_link) $cff_post_item .= $cff_link;
1044
 
1045
  //End the post item
1046
- $cff_post_item .= '</div><div class="cff-clear"></div>';
1047
 
1048
  //PUSH TO ARRAY
1049
  $cff_posts_array = array_push_assoc($cff_posts_array, strtotime($post_time), $cff_post_item);
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.2
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  License: GPLv2 or later
736
  //Set the author image as a variable. If it already exists then don't query the api for it again.
737
  $cff_author_img_var = '$cff_author_img_' . $news->from->id;
738
  if ( !isset($$cff_author_img_var) ) $$cff_author_img_var = 'https://graph.facebook.com/' . $news->from->id . '/picture?type=square';
739
+ $cff_author .= '<img src="'.$$cff_author_img_var.'" title="'.$news->from->name.'" alt="'.$news->from->name.'" width=50 height=50>';
 
740
  $cff_author .= '<span class="cff-page-name">'.$news->from->name.'</span>';
741
  $cff_author .= '</a>';
742
 
785
  //Use message_tags or story_tags?
786
  ( isset($news->message_tags) )? $text_tags = $news->message_tags : $text_tags = $news->story_tags;
787
 
788
+ //If message tags and message is being used as the post text, or same with story. This stops story tags being used to replace the message inadvertently.
789
+ if( ( $cff_post_text_type == 'message' && isset($news->message_tags) ) || ( $cff_post_text_type == 'story' && !isset($news->message_tags) ) ) {
790
 
791
+ //Does the Post Text contain any html tags? - the & symbol is the best indicator of this
792
+ $html_check_1 = stripos($post_text, '&');
793
+ $html_check_2 = stripos($post_text, '’');
794
+ $html_check_3 = stripos($post_text, '“');
 
 
 
 
795
 
796
+ //If it contains HTML tags then use the name replace method
797
+ // $html_check = true;
798
+ //always use the text replace method
799
+ if( $html_check_1 || $html_check_2 || $html_check_3 ) {
800
+ //Loop through the tags
801
+ foreach($text_tags as $message_tag ) {
802
+ $tag_name = $message_tag[0]->name;
803
+ $tag_link = '<a href="http://facebook.com/' . $message_tag[0]->id . '" style="color: #'.str_replace('#', '', $atts['textlinkcolor']).';" target="_blank">' . $message_tag[0]->name . '</a>';
804
 
805
+ $post_text = str_replace($tag_name, $tag_link, $post_text);
806
+ }
807
+
808
+ } else {
809
+ //If it doesn't contain HTMl tags then use the offset to replace message tags
810
+ $message_tags_arr = array();
811
+
812
+ $i = 0;
813
+ foreach($text_tags as $message_tag ) {
814
+ $i++;
815
+ $message_tags_arr = array_push_assoc(
816
+ $message_tags_arr,
817
+ $i,
818
+ array(
819
+ 'id' => $message_tag[0]->id,
820
+ 'name' => $message_tag[0]->name,
821
+ 'type' => $message_tag[0]->type,
822
+ 'offset' => $message_tag[0]->offset,
823
+ 'length' => $message_tag[0]->length
824
+ )
825
+ );
826
+ }
827
+
828
+ for($i = count($message_tags_arr); $i >= 1; $i--) {
829
+
830
+ $b = '<a href="http://facebook.com/' . $message_tags_arr[$i]['id'] . '" target="_blank">' . $message_tags_arr[$i]['name'] . '</a>';
831
+ $c = $message_tags_arr[$i]['offset'];
832
+ $d = $message_tags_arr[$i]['length'];
833
 
834
+ $post_text = substr_replace( $post_text, $b, $c, $d);
 
 
 
 
835
 
836
+ }
837
 
838
+ } // end if/else
839
 
840
+ } // end message check
841
 
842
  } //END MESSAGE TAGS
843
 
845
  //If the text is wrapped in a link then don't hyperlink any text within
846
  if ($cff_title_link) {
847
  //Wrap links in a span so we can break the text if it's too long
848
+ $cff_post_text .= cff_wrap_span( $post_text ) . ' ';
849
  } else {
850
  //Don't use htmlspecialchars for post_text as it's added above so that it doesn't mess up the message_tag offsets
851
  $cff_post_text .= cff_autolink( $post_text, $link_color=str_replace('#', '', $atts['textlinkcolor']) ) . ' ';
1049
  if($cff_show_link) $cff_post_item .= $cff_link;
1050
 
1051
  //End the post item
1052
+ $cff_post_item .= '</div>';
1053
 
1054
  //PUSH TO ARRAY
1055
  $cff_posts_array = array_push_assoc($cff_posts_array, strtotime($post_time), $cff_post_item);
js/cff-admin-scripts.js CHANGED
@@ -59,15 +59,6 @@ jQuery(document).ready(function() {
59
  jQuery('#cff-header-icon-example').removeClass().addClass('fa fa-' + $self.val() );
60
  });
61
 
62
- //Icon style
63
- var iconStyles = 'color: #' + jQuery('#cff-header-icon-color').val() + '; font-size: ' + jQuery('#cff-header-icon-size').val() + 'px;';
64
- jQuery('#cff-header-icon-example').attr('style', iconStyles);
65
-
66
- jQuery('#cff-header-icon-size, #cff-header-icon-color').change(function() {
67
- var iconStyles = 'color: #' + jQuery('#cff-header-icon-color').val() + '; font-size: ' + jQuery('#cff-header-icon-size').val() + 'px;';
68
- jQuery('#cff-header-icon-example').attr('style', iconStyles);
69
- });
70
-
71
 
72
  //Test Facebook API connection button
73
  jQuery('#cff-api-test').click(function(e){
59
  jQuery('#cff-header-icon-example').removeClass().addClass('fa fa-' + $self.val() );
60
  });
61
 
 
 
 
 
 
 
 
 
 
62
 
63
  //Test Facebook API connection button
64
  jQuery('#cff-api-test').click(function(e){