Custom Facebook Feed - Version 1.6.6.2

Version Description

  • New: Added support for group events
Download this release

Release Info

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

Code changes from version 1.6.6.1 to 1.6.6.2

README.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: smashballoon
3
Tags: facebook, custom, customizable, feed, events, seo, search engine, responsive, mobile, shortcode, social, status, posts
4
Requires at least: 3.0
5
Tested up to: 3.7.1
6
- Stable tag: 1.6.6.1
7
License: GPLv2 or later
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
@@ -109,6 +109,9 @@ You can embed your Facebook feed directly into a template file by using the Word
109
110
== Changelog ==
111
112
= 1.6.6.1 =
113
* Fix: Resolved jQuery UI draggable bug which was causing issues with drag and drop
114
3
Tags: facebook, custom, customizable, feed, events, seo, search engine, responsive, mobile, shortcode, social, status, posts
4
Requires at least: 3.0
5
Tested up to: 3.7.1
6
+ Stable tag: 1.6.6.2
7
License: GPLv2 or later
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
109
110
== Changelog ==
111
112
+ = 1.6.6.2 =
113
+ * New: Added support for group events
114
+
115
= 1.6.6.1 =
116
* Fix: Resolved jQuery UI draggable bug which was causing issues with drag and drop
117
custom-facebook-feed-admin.php CHANGED
@@ -376,8 +376,8 @@ function cff_style_page() {
376
'cff_sep_size' => '1'
377
);
378
//Save layout option in an array
379
- add_option( 'cff_style_settings', $options );
380
$options = wp_parse_args(get_option('cff_style_settings'), $defaults);
381
//Set the page variables
382
//Post types
383
$cff_show_links_type = $options[ 'cff_show_links_type' ];
@@ -456,7 +456,6 @@ function cff_style_page() {
456
$cff_like_box_faces = $options[ 'cff_like_box_faces' ];
457
458
$cff_show_media = $options[ 'cff_show_media' ];
459
- $cff_open_links = $options[ 'cff_open_links' ];
460
$cff_bg_color = $options[ 'cff_bg_color' ];
461
$cff_likebox_bg_color = $options[ 'cff_likebox_bg_color' ];
462
$cff_video_height = $options[ 'cff_video_height' ];
376
'cff_sep_size' => '1'
377
);
378
//Save layout option in an array
379
$options = wp_parse_args(get_option('cff_style_settings'), $defaults);
380
+ add_option( 'cff_style_settings', $options );
381
//Set the page variables
382
//Post types
383
$cff_show_links_type = $options[ 'cff_show_links_type' ];
456
$cff_like_box_faces = $options[ 'cff_like_box_faces' ];
457
458
$cff_show_media = $options[ 'cff_show_media' ];
459
$cff_bg_color = $options[ 'cff_bg_color' ];
460
$cff_likebox_bg_color = $options[ 'cff_likebox_bg_color' ];
461
$cff_video_height = $options[ 'cff_video_height' ];
custom-facebook-feed.php CHANGED
@@ -31,12 +31,7 @@ function display_cff($atts) {
31
//Style options
32
$options = get_option('cff_style_settings');
33
//Create the types string to set as shortcode default
34
- if($options[ 'cff_show_links_type' ]) $type_string .= 'links,';
35
- if($options[ 'cff_show_event_type' ]) $type_string .= 'events,';
36
- if($options[ 'cff_show_video_type' ]) $type_string .= 'videos,';
37
- if($options[ 'cff_show_photos_type' ]) $type_string .= 'photos,';
38
- if($options[ 'cff_show_status_type' ]) $type_string .= 'statuses,';
39
- //Create the types string to set as shortcode default
40
if($options[ 'cff_show_text' ]) $include_string .= 'text,';
41
if($options[ 'cff_show_desc' ]) $include_string .= 'desc,';
42
if($options[ 'cff_show_shared_links' ]) $include_string .= 'sharedlinks,';
@@ -64,7 +59,6 @@ function display_cff($atts) {
64
'showauthor' => $options[ 'cff_show_author' ],
65
'class' => $options[ 'cff_class' ],
66
'layout' => $options[ 'cff_preset_layout' ],
67
- 'type' => $type_string,
68
'include' => $include_string,
69
//Typography
70
'seemoretext' => $options[ 'cff_see_more_text' ],
@@ -148,12 +142,8 @@ function display_cff($atts) {
148
$cff_like_box_position = $atts[ 'likeboxpos' ];
149
$cff_like_box_outside = $atts[ 'likeboxoutside' ];
150
//Open links in new window?
151
- $cff_open_links = $options[ 'cff_open_links' ];
152
$target = 'target="_blank"';
153
- if ($cff_open_links) $target = 'target="_blank"';
154
/********** POST TYPES **********/
155
- $cff_types = $atts[ 'type' ];
156
- //Look for non-plural version of string in the types string in case user specifies singular in shortcode
157
$cff_show_links_type = true;
158
$cff_show_event_type = true;
159
$cff_show_video_type = true;
@@ -283,13 +273,6 @@ function display_cff($atts) {
283
$cff_video_width = 640;
284
$cff_video_height = $atts[ 'videoheight' ];
285
286
- if ($cff_thumb_layout) {
287
- if(empty($cff_video_height)) $cff_video_height = 100;
288
- } else if ($cff_half_layout) {
289
- if(empty($cff_video_height)) $cff_video_height = 180;
290
- } else {
291
- if(empty($cff_video_height)) $cff_video_height = 360;
292
- }
293
//Action
294
$cff_video_action = $atts[ 'videoaction' ];
295
//Separating Line
@@ -312,7 +295,7 @@ function display_cff($atts) {
312
//Get show posts attribute. If not set then default to 25
313
$show_posts = $atts['num'];
314
if (empty($show_posts)) $show_posts = 25;
315
- if ( $show_posts == 0 || $show_posts == undefined ) $show_posts = 25;
316
//Check whether the Access Token is present and valid
317
if ($access_token == '') {
318
echo 'Please enter a valid Access Token. You can do this in the Custom Facebook Feed plugin settings.<br /><br />';
@@ -353,9 +336,6 @@ function display_cff($atts) {
353
$content .= '<div id="cff" rel="'.$title_limit.'" class="';
354
if( !empty($cff_class) ) $content .= $cff_class . ' ';
355
if ( !empty($cff_feed_height) ) $content .= 'cff-fixed-height ';
356
- if ( $cff_thumb_layout ) $content .= 'cff-thumb-layout ';
357
- // if ( $cff_media_medium ) $content .= 'medium-image ';
358
- if ( $cff_half_layout ) $content .= 'cff-half-layout ';
359
$content .= '" ' . $cff_feed_styles . '>';
360
//Add like box to the inside of the top of feed
361
if ($cff_like_box_position == 'top' && $cff_show_like_box && !$cff_like_box_outside) $content .= $like_box;
@@ -394,13 +374,11 @@ function display_cff($atts) {
394
//Check the post type
395
$cff_post_type = $news->type;
396
if ($cff_post_type == 'link') {
397
- $story = $news->story;
398
//Check whether it's an event
399
- $created_event = 'created an event.';
400
- $shared_event = 'shared an event.';
401
- $created_event = stripos($story, $created_event);
402
- $shared_event = stripos($story, $shared_event);
403
- if ( $created_event || $shared_event ) $cff_post_type = 'event';
404
}
405
//Should we show this post or not?
406
$cff_show_post = false;
@@ -428,8 +406,17 @@ function display_cff($atts) {
428
if ( $cff_show_status_type && !empty($news->message) ) $cff_show_post = true;
429
break;
430
}
431
//Is it a duplicate post?
432
- if ( ($prev_post_message == $news->message) && ($prev_post_link == $news->link) && ($prev_post_description == $news->description) ) $cff_show_post = false;
433
//Check post type and display post if selected
434
if ( $cff_show_post ) {
435
//If it isn't then create the post
@@ -440,10 +427,11 @@ function display_cff($atts) {
440
//***COMPILE SECTION VARIABLES***//
441
//********************************//
442
//Set the post link
443
- $link = $news->link;
444
//Is it a shared album?
445
$shared_album_string = 'shared an album:';
446
- $shared_album = stripos($news->story, $shared_album_string);
447
if ( $shared_album ) {
448
$link = str_replace('photo.php?','media/set/?',$link);
449
}
@@ -516,15 +504,12 @@ function display_cff($atts) {
516
//Check for media
517
if ($cff_post_type == 'event') {
518
519
- //Get the event object
520
- $eventID = $PostID[1];
521
- if ( $shared_event ) {
522
- //Get the event id from the event URL. eg: http://www.facebook.com/events/123451234512345/
523
- $event_url = parse_url($link);
524
- $url_parts = explode('/', $event_url['path']);
525
- //Get the id from the parts
526
- $eventID = $url_parts[count($url_parts)-2];
527
- }
528
//Get the contents of the event using the WP HTTP API
529
$event_json = cff_fetchUrl('https://graph.facebook.com/'.$eventID.'?access_token=' . $access_token);
530
//Interpret data with JSON
@@ -582,13 +567,6 @@ function display_cff($atts) {
582
}
583
if ($cff_post_type == 'offer') $link_text = 'View Offer';
584
$cff_link = '<a class="' . $cff_viewpost_class . '" href="' . $link . '" title="' . $link_text . '" ' . $target . ' ' . $cff_link_styles . '>' . $link_text . '</a>';
585
- //Compile the meta and link if included
586
- if ($cff_show_meta) $cff_meta_total .= $cff_meta;
587
- if ($cff_show_link) $cff_meta_total .= $cff_link;
588
- $cff_meta_total .= '</div>';
589
- $cff_comments = '';
590
- //Compile comments if meta is included
591
- if ($cff_show_meta) $cff_meta_total .= $cff_comments;
592
//**************************//
593
//***CREATE THE POST HTML***//
594
//**************************//
@@ -623,9 +601,11 @@ function display_cff($atts) {
623
//End the post item
624
$content .= '</div><div class="cff-clear"></div>';
625
} // End post type check
626
- $prev_post_message = $news->message;
627
- $prev_post_link = $news->link;
628
- $prev_post_description = $news->description;
629
} // End the loop
630
} // End ALL POSTS
631
//Load more posts
31
//Style options
32
$options = get_option('cff_style_settings');
33
//Create the types string to set as shortcode default
34
+ $include_string = '';
35
if($options[ 'cff_show_text' ]) $include_string .= 'text,';
36
if($options[ 'cff_show_desc' ]) $include_string .= 'desc,';
37
if($options[ 'cff_show_shared_links' ]) $include_string .= 'sharedlinks,';
59
'showauthor' => $options[ 'cff_show_author' ],
60
'class' => $options[ 'cff_class' ],
61
'layout' => $options[ 'cff_preset_layout' ],
62
'include' => $include_string,
63
//Typography
64
'seemoretext' => $options[ 'cff_see_more_text' ],
142
$cff_like_box_position = $atts[ 'likeboxpos' ];
143
$cff_like_box_outside = $atts[ 'likeboxoutside' ];
144
//Open links in new window?
145
$target = 'target="_blank"';
146
/********** POST TYPES **********/
147
$cff_show_links_type = true;
148
$cff_show_event_type = true;
149
$cff_show_video_type = true;
273
$cff_video_width = 640;
274
$cff_video_height = $atts[ 'videoheight' ];
275
276
//Action
277
$cff_video_action = $atts[ 'videoaction' ];
278
//Separating Line
295
//Get show posts attribute. If not set then default to 25
296
$show_posts = $atts['num'];
297
if (empty($show_posts)) $show_posts = 25;
298
+ if ( $show_posts == 0 || $show_posts == 'undefined' ) $show_posts = 25;
299
//Check whether the Access Token is present and valid
300
if ($access_token == '') {
301
echo 'Please enter a valid Access Token. You can do this in the Custom Facebook Feed plugin settings.<br /><br />';
336
$content .= '<div id="cff" rel="'.$title_limit.'" class="';
337
if( !empty($cff_class) ) $content .= $cff_class . ' ';
338
if ( !empty($cff_feed_height) ) $content .= 'cff-fixed-height ';
339
$content .= '" ' . $cff_feed_styles . '>';
340
//Add like box to the inside of the top of feed
341
if ($cff_like_box_position == 'top' && $cff_show_like_box && !$cff_like_box_outside) $content .= $like_box;
374
//Check the post type
375
$cff_post_type = $news->type;
376
if ($cff_post_type == 'link') {
377
+ isset($news->story) ? $story = $news->story : $story = '';
378
//Check whether it's an event
379
+ $event_link_check = "facebook.com/events/";
380
+ $event_link_check = stripos($news->link, $event_link_check);
381
+ if ( $event_link_check ) $cff_post_type = 'event';
382
}
383
//Should we show this post or not?
384
$cff_show_post = false;
406
if ( $cff_show_status_type && !empty($news->message) ) $cff_show_post = true;
407
break;
408
}
409
+
410
//Is it a duplicate post?
411
+ if (!isset($prev_post_message)) $prev_post_message = '';
412
+ if (!isset($prev_post_link)) $prev_post_link = '';
413
+ if (!isset($prev_post_description)) $prev_post_description = '';
414
+ isset($news->message) ? $pm = $news->message : $pm = '';
415
+ isset($news->link) ? $pl = $news->link : $pl = '';
416
+ isset($news->description) ? $pd = $news->description : $pd = '';
417
+
418
+ if ( ($prev_post_message == $pm) && ($prev_post_link == $pl) && ($prev_post_description == $pd) ) $cff_show_post = false;
419
+
420
//Check post type and display post if selected
421
if ( $cff_show_post ) {
422
//If it isn't then create the post
427
//***COMPILE SECTION VARIABLES***//
428
//********************************//
429
//Set the post link
430
+ isset($news->link) ? $link = $news->link : $link = '';
431
//Is it a shared album?
432
$shared_album_string = 'shared an album:';
433
+ isset($news->story) ? $story = $news->story : $story = '';
434
+ $shared_album = stripos($story, $shared_album_string);
435
if ( $shared_album ) {
436
$link = str_replace('photo.php?','media/set/?',$link);
437
}
504
//Check for media
505
if ($cff_post_type == 'event') {
506
507
+ //Get the event id from the event URL. eg: http://www.facebook.com/events/123451234512345/
508
+ $event_url = parse_url($link);
509
+ $url_parts = explode('/', $event_url['path']);
510
+ //Get the id from the parts
511
+ $eventID = $url_parts[count($url_parts)-2];
512
+
513
//Get the contents of the event using the WP HTTP API
514
$event_json = cff_fetchUrl('https://graph.facebook.com/'.$eventID.'?access_token=' . $access_token);
515
//Interpret data with JSON
567
}
568
if ($cff_post_type == 'offer') $link_text = 'View Offer';
569
$cff_link = '<a class="' . $cff_viewpost_class . '" href="' . $link . '" title="' . $link_text . '" ' . $target . ' ' . $cff_link_styles . '>' . $link_text . '</a>';
570
//**************************//
571
//***CREATE THE POST HTML***//
572
//**************************//
601
//End the post item
602
$content .= '</div><div class="cff-clear"></div>';
603
} // End post type check
604
+
605
+ if (isset($news->message)) $prev_post_message = $news->message;
606
+ if (isset($news->link)) $prev_post_link = $news->link;
607
+ if (isset($news->description)) $prev_post_description = $news->description;
608
+
609
} // End the loop
610
} // End ALL POSTS
611
//Load more posts