Custom Facebook Feed - Version 2.4.1

Version Description

  • New: If a post contains either a photo or video then an icon and link are now added to view it on Facebook. You can disable this by unchecking the "Media Link" option in the following location: Customize > Post Layout > Show/Hide. You can also remove it by using the "exclude" shortcode option: exclude="medialink". You can translate or change the text for this link on the "Custom Text / Translate" settings page.
  • Tweak: Tested with WordPress 4.5
  • Fix: Fixed an issue where the "Share" button in the plugin Like Box wasn't working correctly
  • Fix: Added support for wp-config proxy settings. Credit to @usrlocaldick for the patch.
Download this release

Release Info

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

Code changes from version 2.4 to 2.4.1

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 groups, Facebook fans, Facebook likes, Facebook followers, Facebooks, Face book, posts, Facebook postings, Facebook feeds, Facebook pages, Facebook Like Box, Facebook plugin, Facebook plug-in, Facebook walls, Facebook hashtag, Facebook embed, Customizable Facebook Feed, custom, customizable, seo, responsive, mobile, social media
4
Requires at least: 3.0
5
- Tested up to: 4.4.2
6
- Stable tag: 2.4
7
License: GPLv2 or later
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
@@ -361,6 +361,12 @@ Credit iMarketing Factory - "The Importance of Facebook for Small Businesses"
361
9. It's super easy to display your Facebook feed in any page or post
362
363
== Changelog ==
364
= 2.4 =
365
* New: Added a setting to allow you to use a fixed pixel width for the Facebook feed on desktop but switch to a 100% width responsive layout on mobile
366
* New: You can now click on the name of a setting on the admin pages to reveal the corresponding shortcode for that setting
2
Contributors: smashballoon
3
Tags: Facebook, Facebook feed, Facebook posts, Facebook wall, Facebook events, Facebook page, Facebook group, Facebook groups, Facebook fans, Facebook likes, Facebook followers, Facebooks, Face book, posts, Facebook postings, Facebook feeds, Facebook pages, Facebook Like Box, Facebook plugin, Facebook plug-in, Facebook walls, Facebook hashtag, Facebook embed, Customizable Facebook Feed, custom, customizable, seo, responsive, mobile, social media
4
Requires at least: 3.0
5
+ Tested up to: 4.5
6
+ Stable tag: 2.4.1
7
License: GPLv2 or later
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
361
9. It's super easy to display your Facebook feed in any page or post
362
363
== Changelog ==
364
+ = 2.4.1 =
365
+ * New: If a post contains either a photo or video then an icon and link are now added to view it on Facebook. You can disable this by unchecking the "Media Link" option in the following location: Customize > Post Layout > Show/Hide. You can also remove it by using the "exclude" shortcode option: exclude="medialink". You can translate or change the text for this link on the "Custom Text / Translate" settings page.
366
+ * Tweak: Tested with WordPress 4.5
367
+ * Fix: Fixed an issue where the "Share" button in the plugin Like Box wasn't working correctly
368
+ * Fix: Added support for wp-config proxy settings. Credit to [@usrlocaldick](https://wordpress.org/support/topic/proxy-support-1) for the patch.
369
+
370
= 2.4 =
371
* New: Added a setting to allow you to use a fixed pixel width for the Facebook feed on desktop but switch to a 100% width responsive layout on mobile
372
* New: You can now click on the name of a setting on the admin pages to reveal the corresponding shortcode for that setting
custom-facebook-feed-admin.php CHANGED
@@ -598,6 +598,7 @@ function cff_style_page() {
598
'cff_show_shared_links' => true,
599
'cff_show_date' => true,
600
'cff_show_media' => true,
601
'cff_show_event_title' => true,
602
'cff_show_event_details' => true,
603
'cff_show_meta' => true,
@@ -730,6 +731,8 @@ function cff_style_page() {
730
'cff_show_facebook_share' => true,
731
732
'cff_translate_photos_text' => 'photos',
733
734
//Translate - date
735
'cff_translate_second' => 'second',
@@ -767,6 +770,7 @@ function cff_style_page() {
767
$cff_show_shared_links = $options[ 'cff_show_shared_links' ];
768
$cff_show_date = $options[ 'cff_show_date' ];
769
$cff_show_media = $options[ 'cff_show_media' ];
770
$cff_show_event_title = $options[ 'cff_show_event_title' ];
771
$cff_show_event_details = $options[ 'cff_show_event_details' ];
772
$cff_show_meta = $options[ 'cff_show_meta' ];
@@ -841,6 +845,8 @@ function cff_style_page() {
841
$cff_translate_ago = $options[ 'cff_translate_ago' ];
842
//Photos translate
843
$cff_translate_photos_text = $options[ 'cff_translate_photos_text' ];
844
845
//View on Facebook link
846
$cff_link_size = $options[ 'cff_link_size' ];
@@ -976,6 +982,7 @@ function cff_style_page() {
976
(isset($_POST[ 'cff_show_shared_links' ]) ) ? $cff_show_shared_links = $_POST[ 'cff_show_shared_links' ] : $cff_show_shared_links = '';
977
(isset($_POST[ 'cff_show_date' ]) ) ? $cff_show_date = $_POST[ 'cff_show_date' ] : $cff_show_date = '';
978
(isset($_POST[ 'cff_show_media' ]) ) ? $cff_show_media = $_POST[ 'cff_show_media' ] : $cff_show_media = '';
979
(isset($_POST[ 'cff_show_event_title' ]) ) ? $cff_show_event_title = $_POST[ 'cff_show_event_title' ] : $cff_show_event_title = '';
980
(isset($_POST[ 'cff_show_event_details' ]) ) ? $cff_show_event_details = $_POST[ 'cff_show_event_details' ] : $cff_show_event_details = '';
981
(isset($_POST[ 'cff_show_meta' ]) ) ? $cff_show_meta = $_POST[ 'cff_show_meta' ] : $cff_show_meta = '';
@@ -995,6 +1002,7 @@ function cff_style_page() {
995
$options[ 'cff_show_shared_links' ] = $cff_show_shared_links;
996
$options[ 'cff_show_date' ] = $cff_show_date;
997
$options[ 'cff_show_media' ] = $cff_show_media;
998
$options[ 'cff_show_event_title' ] = $cff_show_event_title;
999
$options[ 'cff_show_event_details' ] = $cff_show_event_details;
1000
$options[ 'cff_show_meta' ] = $cff_show_meta;
@@ -1311,6 +1319,8 @@ function cff_style_page() {
1311
1312
//Social translate
1313
if (isset($_POST[ 'cff_translate_photos_text' ])) $cff_translate_photos_text = $_POST[ 'cff_translate_photos_text' ];
1314
1315
//Date translate
1316
if (isset($_POST[ 'cff_translate_second' ])) $cff_translate_second = $_POST[ 'cff_translate_second' ];
@@ -1337,6 +1347,8 @@ function cff_style_page() {
1337
1338
//Social translate
1339
$options[ 'cff_translate_photos_text' ] = $cff_translate_photos_text;
1340
1341
//Date translate
1342
$options[ 'cff_translate_second' ] = $cff_translate_second;
@@ -1582,6 +1594,11 @@ function cff_style_page() {
1582
<input type="checkbox" id="cff_show_media" disabled />
1583
<label for="cff_show_media"><?php _e('Photos/videos', 'custom-facebook-feed'); ?></label>
1584
</div>
1585
<div>
1586
<input type="checkbox" name="cff_show_shared_links" id="cff_show_shared_links" <?php if($cff_show_shared_links == true) echo 'checked="checked"' ?> />
1587
<label for="cff_show_shared_links"><?php _e('Shared links', 'custom-facebook-feed'); ?></label>
@@ -2887,6 +2904,7 @@ function cff_style_page() {
2887
<span>Quick links: </span>
2888
<a href="#text">Post Text</a>
2889
<a href="#action">Post Action Links</a>
2890
<a href="#date">Date</a>
2891
</p>
2892
@@ -2930,11 +2948,23 @@ function cff_style_page() {
2930
<td class="cff-context"><?php _e('Used for sharing the Facebook post via Social Media', 'custom-facebook-feed'); ?></td>
2931
</tr>
2932
2933
- <tr id="date"><!-- Quick link -->
2934
<td><label for="cff_translate_photos_text" class="bump-left"><?php _e('photos', 'custom-facebook-feed'); ?></label></td>
2935
<td><input name="cff_translate_photos_text" type="text" value="<?php echo stripslashes( esc_attr( $cff_translate_photos_text ) ); ?>" /></td>
2936
<td class="cff-context"><?php _e('Added to the end of an album name. Eg. (6 photos)', 'custom-facebook-feed'); ?></td>
2937
</tr>
2938
2939
<tr class="cff-table-header"><th colspan="3"><?php _e('Date', 'custom-facebook-feed'); ?></th></tr>
2940
<tr>
598
'cff_show_shared_links' => true,
599
'cff_show_date' => true,
600
'cff_show_media' => true,
601
+ 'cff_show_media_link' => true,
602
'cff_show_event_title' => true,
603
'cff_show_event_details' => true,
604
'cff_show_meta' => true,
731
'cff_show_facebook_share' => true,
732
733
'cff_translate_photos_text' => 'photos',
734
+ 'cff_translate_photo_text' => 'Photo',
735
+ 'cff_translate_video_text' => 'Video',
736
737
//Translate - date
738
'cff_translate_second' => 'second',
770
$cff_show_shared_links = $options[ 'cff_show_shared_links' ];
771
$cff_show_date = $options[ 'cff_show_date' ];
772
$cff_show_media = $options[ 'cff_show_media' ];
773
+ $cff_show_media_link = $options[ 'cff_show_media_link' ];
774
$cff_show_event_title = $options[ 'cff_show_event_title' ];
775
$cff_show_event_details = $options[ 'cff_show_event_details' ];
776
$cff_show_meta = $options[ 'cff_show_meta' ];
845
$cff_translate_ago = $options[ 'cff_translate_ago' ];
846
//Photos translate
847
$cff_translate_photos_text = $options[ 'cff_translate_photos_text' ];
848
+ $cff_translate_photo_text = $options[ 'cff_translate_photo_text' ];
849
+ $cff_translate_video_text = $options[ 'cff_translate_video_text' ];
850
851
//View on Facebook link
852
$cff_link_size = $options[ 'cff_link_size' ];
982
(isset($_POST[ 'cff_show_shared_links' ]) ) ? $cff_show_shared_links = $_POST[ 'cff_show_shared_links' ] : $cff_show_shared_links = '';
983
(isset($_POST[ 'cff_show_date' ]) ) ? $cff_show_date = $_POST[ 'cff_show_date' ] : $cff_show_date = '';
984
(isset($_POST[ 'cff_show_media' ]) ) ? $cff_show_media = $_POST[ 'cff_show_media' ] : $cff_show_media = '';
985
+ (isset($_POST[ 'cff_show_media_link' ]) ) ? $cff_show_media_link = $_POST[ 'cff_show_media_link' ] : $cff_show_media_link = '';
986
(isset($_POST[ 'cff_show_event_title' ]) ) ? $cff_show_event_title = $_POST[ 'cff_show_event_title' ] : $cff_show_event_title = '';
987
(isset($_POST[ 'cff_show_event_details' ]) ) ? $cff_show_event_details = $_POST[ 'cff_show_event_details' ] : $cff_show_event_details = '';
988
(isset($_POST[ 'cff_show_meta' ]) ) ? $cff_show_meta = $_POST[ 'cff_show_meta' ] : $cff_show_meta = '';
1002
$options[ 'cff_show_shared_links' ] = $cff_show_shared_links;
1003
$options[ 'cff_show_date' ] = $cff_show_date;
1004
$options[ 'cff_show_media' ] = $cff_show_media;
1005
+ $options[ 'cff_show_media_link' ] = $cff_show_media_link;
1006
$options[ 'cff_show_event_title' ] = $cff_show_event_title;
1007
$options[ 'cff_show_event_details' ] = $cff_show_event_details;
1008
$options[ 'cff_show_meta' ] = $cff_show_meta;
1319
1320
//Social translate
1321
if (isset($_POST[ 'cff_translate_photos_text' ])) $cff_translate_photos_text = $_POST[ 'cff_translate_photos_text' ];
1322
+ if (isset($_POST[ 'cff_translate_photo_text' ])) $cff_translate_photo_text = $_POST[ 'cff_translate_photo_text' ];
1323
+ if (isset($_POST[ 'cff_translate_video_text' ])) $cff_translate_video_text = $_POST[ 'cff_translate_video_text' ];
1324
1325
//Date translate
1326
if (isset($_POST[ 'cff_translate_second' ])) $cff_translate_second = $_POST[ 'cff_translate_second' ];
1347
1348
//Social translate
1349
$options[ 'cff_translate_photos_text' ] = $cff_translate_photos_text;
1350
+ $options[ 'cff_translate_photo_text' ] = $cff_translate_photo_text;
1351
+ $options[ 'cff_translate_video_text' ] = $cff_translate_video_text;
1352
1353
//Date translate
1354
$options[ 'cff_translate_second' ] = $cff_translate_second;
1594
<input type="checkbox" id="cff_show_media" disabled />
1595
<label for="cff_show_media"><?php _e('Photos/videos', 'custom-facebook-feed'); ?></label>
1596
</div>
1597
+ <div>
1598
+ <input type="checkbox" name="cff_show_media_link" id="cff_show_media_link" <?php if($cff_show_media_link == true) echo 'checked="checked"' ?> />
1599
+ <label for="cff_show_media_link"><?php _e('Media link', 'custom-facebook-feed'); ?></label><a class="cff-tooltip-link" href="JavaScript:void(0);"><?php _e('What is this?'); ?></a>
1600
+ <p class="cff-tooltip cff-more-info"><?php _e('Display an icon and link to Facebook if the post contains either a photo or video'); ?></p>
1601
+ </div>
1602
<div>
1603
<input type="checkbox" name="cff_show_shared_links" id="cff_show_shared_links" <?php if($cff_show_shared_links == true) echo 'checked="checked"' ?> />
1604
<label for="cff_show_shared_links"><?php _e('Shared links', 'custom-facebook-feed'); ?></label>
2904
<span>Quick links: </span>
2905
<a href="#text">Post Text</a>
2906
<a href="#action">Post Action Links</a>
2907
+ <a href="#medialink">Media Links</a>
2908
<a href="#date">Date</a>
2909
</p>
2910
2948
<td class="cff-context"><?php _e('Used for sharing the Facebook post via Social Media', 'custom-facebook-feed'); ?></td>
2949
</tr>
2950
2951
+ <tr id="medialink"><!-- Quick link -->
2952
<td><label for="cff_translate_photos_text" class="bump-left"><?php _e('photos', 'custom-facebook-feed'); ?></label></td>
2953
<td><input name="cff_translate_photos_text" type="text" value="<?php echo stripslashes( esc_attr( $cff_translate_photos_text ) ); ?>" /></td>
2954
<td class="cff-context"><?php _e('Added to the end of an album name. Eg. (6 photos)', 'custom-facebook-feed'); ?></td>
2955
</tr>
2956
+
2957
+ <tr class="cff-table-header"><th colspan="3"><?php _e('Media Links', 'custom-facebook-feed'); ?></th></tr>
2958
+ <tr>
2959
+ <td><label for="cff_translate_photo_text" class="bump-left"><?php _e('Photo', 'custom-facebook-feed'); ?></label></td>
2960
+ <td><input name="cff_translate_photo_text" type="text" value="<?php echo stripslashes( esc_attr( $cff_translate_photo_text ) ); ?>" /></td>
2961
+ <td class="cff-context"><?php _e('Used to link to photos on Facebook', 'custom-facebook-feed'); ?></td>
2962
+ </tr>
2963
+ <tr id="date"><!-- Quick link -->
2964
+ <td><label for="cff_translate_video_text" class="bump-left"><?php _e('Video', 'custom-facebook-feed'); ?></label></td>
2965
+ <td><input name="cff_translate_video_text" type="text" value="<?php echo stripslashes( esc_attr( $cff_translate_video_text ) ); ?>" /></td>
2966
+ <td class="cff-context"><?php _e('Used to link to videos on Facebook', 'custom-facebook-feed'); ?></td>
2967
+ </tr>
2968
2969
<tr class="cff-table-header"><th colspan="3"><?php _e('Date', 'custom-facebook-feed'); ?></th></tr>
2970
<tr>
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.4
7
Author: Smash Balloon
8
Author URI: http://smashballoon.com/
9
License: GPLv2 or later
@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
//Include admin
27
include dirname( __FILE__ ) .'/custom-facebook-feed-admin.php';
28
29
- define('CFFVER', '2.4');
30
31
// Add shortcodes
32
add_shortcode('custom-facebook-feed', 'display_cff');
@@ -42,6 +42,11 @@ function display_cff($atts) {
42
if($options[ 'cff_show_shared_links' ]) $include_string .= 'sharedlinks,';
43
if($options[ 'cff_show_date' ]) $include_string .= 'date,';
44
if($options[ 'cff_show_media' ]) $include_string .= 'media,';
45
if($options[ 'cff_show_event_title' ]) $include_string .= 'eventtitle,';
46
if($options[ 'cff_show_event_details' ]) $include_string .= 'eventdetails,';
47
if($options[ 'cff_show_meta' ]) $include_string .= 'social,';
@@ -183,6 +188,8 @@ function display_cff($atts) {
183
'seemoretext' => isset( $options[ 'cff_see_more_text' ] ) ? stripslashes( esc_attr( $options[ 'cff_see_more_text' ] ) ) : '',
184
'seelesstext' => isset( $options[ 'cff_see_less_text' ] ) ? stripslashes( esc_attr( $options[ 'cff_see_less_text' ] ) ) : '',
185
'photostext' => isset( $options[ 'cff_translate_photos_text' ] ) ? stripslashes( esc_attr( $options[ 'cff_translate_photos_text' ] ) ) : '',
186
187
'facebooklinktext' => isset( $options[ 'cff_facebook_link_text' ] ) ? stripslashes( esc_attr( $options[ 'cff_facebook_link_text' ] ) ) : '',
188
'sharelinktext' => isset( $options[ 'cff_facebook_share_text' ] ) ? stripslashes( esc_attr( $options[ 'cff_facebook_share_text' ] ) ) : '',
@@ -256,6 +263,7 @@ function display_cff($atts) {
256
$cff_show_shared_links = false;
257
$cff_show_date = false;
258
$cff_show_media = false;
259
$cff_show_event_title = false;
260
$cff_show_event_details = false;
261
$cff_show_meta = false;
@@ -267,6 +275,7 @@ function display_cff($atts) {
267
if ( stripos($cff_includes, 'sharedlink') !== false ) $cff_show_shared_links = true;
268
if ( stripos($cff_includes, 'date') !== false ) $cff_show_date = true;
269
if ( stripos($cff_includes, 'media') !== false ) $cff_show_media = true;
270
if ( stripos($cff_includes, 'eventtitle') !== false ) $cff_show_event_title = true;
271
if ( stripos($cff_includes, 'eventdetail') !== false ) $cff_show_event_details = true;
272
if ( stripos($cff_includes, 'social') !== false ) $cff_show_meta = true;
@@ -283,6 +292,7 @@ function display_cff($atts) {
283
if ( stripos($cff_excludes, 'sharedlink') !== false ) $cff_show_shared_links = false;
284
if ( stripos($cff_excludes, 'date') !== false ) $cff_show_date = false;
285
if ( stripos($cff_excludes, 'media') !== false ) $cff_show_media = false;
286
if ( stripos($cff_excludes, 'eventtitle') !== false ) $cff_show_event_title = false;
287
if ( stripos($cff_excludes, 'eventdetail') !== false ) $cff_show_event_details = false;
288
if ( stripos($cff_excludes, 'social') !== false ) $cff_show_meta = false;
@@ -702,8 +712,8 @@ function display_cff($atts) {
702
if ( !isset($cff_likebox_width) || empty($cff_likebox_width) || $cff_likebox_width == '' ) $cff_likebox_width = 300;
703
704
//Set like box variable
705
- isset( $options[ 'cff_app_id' ] ) ? $cff_app_id = $options[ 'cff_app_id' ] : $cff_app_id = '';
706
- ( isset($cff_app_id) && !empty($cff_app_id) ) ? $cff_like_box_params = '&app_id=' .$cff_app_id : $cff_like_box_params = '';
707
$like_box = '<div class="cff-likebox';
708
if ($cff_like_box_outside) $like_box .= ' cff-outside';
709
$like_box .= ($cff_like_box_position == 'top') ? ' cff-top' : ' cff-bottom';
@@ -1099,17 +1109,6 @@ function display_cff($atts) {
1099
$post_text = htmlspecialchars($news->name);
1100
$cff_post_text_type = 'name';
1101
}
1102
- // if ($cff_album) {
1103
- // if (!empty($news->name)) {
1104
- // $post_text = htmlspecialchars($news->name);
1105
- // $cff_post_text_type = 'name';
1106
- // }
1107
- // if (!empty($news->message) && empty($news->name)) {
1108
- // $post_text = htmlspecialchars($news->message);
1109
- // $cff_post_text_type = 'message';
1110
- // }
1111
- // if ($num_photos > 1) $post_text .= ' (' . trim($num_photos) . ' '.$cff_translate_photos_text.')';
1112
- // }
1113
1114
1115
//MESSAGE TAGS
@@ -1397,11 +1396,6 @@ function display_cff($atts) {
1397
//Link to the Facebook post if it's a link or a video
1398
if($cff_post_type == 'link' || $cff_post_type == 'video') $link = "https://www.facebook.com/" . $page_id . "/posts/" . $PostID[1];
1399
1400
- //If it's a shared post then change the link to use the Post ID so that it links to the shared post and not the original post that's being shared
1401
- if( isset($news->status_type) ){
1402
- if( $news->status_type == 'shared_story' ) $link = "https://www.facebook.com/" . $cff_post_id;
1403
- }
1404
-
1405
//Social media sharing URLs
1406
$cff_share_facebook = 'https://www.facebook.com/sharer/sharer.php?u=' . urlencode($link);
1407
$cff_share_twitter = 'https://twitter.com/intent/tweet?text=' . urlencode($link);
@@ -1409,6 +1403,10 @@ function display_cff($atts) {
1409
$cff_share_linkedin = 'https://www.linkedin.com/shareArticle?mini=true&amp;url=' . urlencode($link) . '&amp;title=' . rawurlencode( strip_tags($cff_post_text) );
1410
$cff_share_email = 'mailto:?subject=Facebook&amp;body=' . urlencode($link) . '%20-%20' . rawurlencode( strip_tags($cff_post_text) );
1411
1412
1413
//If it's an offer post then change the text
1414
if ($cff_post_type == 'offer') $link_text = 'View Offer';
@@ -1434,6 +1432,22 @@ function display_cff($atts) {
1434
}
1435
1436
1437
//**************************//
1438
//***CREATE THE POST HTML***//
1439
//**************************//
@@ -1456,6 +1470,7 @@ function display_cff($atts) {
1456
if ($cff_show_date && $cff_date_position == 'above') $cff_post_item .= $cff_date;
1457
//POST TEXT
1458
if($cff_show_text) $cff_post_item .= $cff_post_text;
1459
//DESCRIPTION
1460
if($cff_show_desc && $cff_post_type != 'offer' && $cff_post_type != 'link') $cff_post_item .= $cff_description;
1461
//LINK
@@ -1470,6 +1485,9 @@ function display_cff($atts) {
1470
if ( (!$cff_show_author && $cff_date_position == 'author') || $cff_show_date && $cff_date_position == 'below') {
1471
if($cff_show_date && $cff_post_type == 'event') $cff_post_item .= $cff_date;
1472
}
1473
//VIEW ON FACEBOOK LINK
1474
if($cff_show_link) $cff_post_item .= $cff_link;
1475
@@ -1548,6 +1566,20 @@ function cff_fetchUrl($url){
1548
//Use cURL
1549
if(is_callable('curl_init')){
1550
$ch = curl_init();
1551
curl_setopt($ch, CURLOPT_URL, $url);
1552
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
1553
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
@@ -1575,6 +1607,20 @@ function cff_fetchUrl($url){
1575
//Auto detect
1576
if(is_callable('curl_init')){
1577
$ch = curl_init();
1578
curl_setopt($ch, CURLOPT_URL, $url);
1579
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
1580
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
@@ -2004,6 +2050,7 @@ function cff_activate() {
2004
$options[ 'cff_show_shared_links' ] = true;
2005
$options[ 'cff_show_date' ] = true;
2006
$options[ 'cff_show_media' ] = true;
2007
$options[ 'cff_show_event_title' ] = true;
2008
$options[ 'cff_show_event_details' ] = true;
2009
$options[ 'cff_show_meta' ] = true;
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.4.1
7
Author: Smash Balloon
8
Author URI: http://smashballoon.com/
9
License: GPLv2 or later
26
//Include admin
27
include dirname( __FILE__ ) .'/custom-facebook-feed-admin.php';
28
29
+ define('CFFVER', '2.4.1');
30
31
// Add shortcodes
32
add_shortcode('custom-facebook-feed', 'display_cff');
42
if($options[ 'cff_show_shared_links' ]) $include_string .= 'sharedlinks,';
43
if($options[ 'cff_show_date' ]) $include_string .= 'date,';
44
if($options[ 'cff_show_media' ]) $include_string .= 'media,';
45
+ if( isset($options[ 'cff_show_media_link' ]) ){ //If not set yet then show link by default
46
+ if($options[ 'cff_show_media_link' ]) $include_string .= 'medialink,';
47
+ } else {
48
+ $include_string .= 'medialink,';
49
+ }
50
if($options[ 'cff_show_event_title' ]) $include_string .= 'eventtitle,';
51
if($options[ 'cff_show_event_details' ]) $include_string .= 'eventdetails,';
52
if($options[ 'cff_show_meta' ]) $include_string .= 'social,';
188
'seemoretext' => isset( $options[ 'cff_see_more_text' ] ) ? stripslashes( esc_attr( $options[ 'cff_see_more_text' ] ) ) : '',
189
'seelesstext' => isset( $options[ 'cff_see_less_text' ] ) ? stripslashes( esc_attr( $options[ 'cff_see_less_text' ] ) ) : '',
190
'photostext' => isset( $options[ 'cff_translate_photos_text' ] ) ? stripslashes( esc_attr( $options[ 'cff_translate_photos_text' ] ) ) : '',
191
+ 'phototext' => isset( $options[ 'cff_translate_photo_text' ] ) ? stripslashes( esc_attr( $options[ 'cff_translate_photo_text' ] ) ) : '',
192
+ 'videotext' => isset( $options[ 'cff_translate_video_text' ] ) ? stripslashes( esc_attr( $options[ 'cff_translate_video_text' ] ) ) : '',
193
194
'facebooklinktext' => isset( $options[ 'cff_facebook_link_text' ] ) ? stripslashes( esc_attr( $options[ 'cff_facebook_link_text' ] ) ) : '',
195
'sharelinktext' => isset( $options[ 'cff_facebook_share_text' ] ) ? stripslashes( esc_attr( $options[ 'cff_facebook_share_text' ] ) ) : '',
263
$cff_show_shared_links = false;
264
$cff_show_date = false;
265
$cff_show_media = false;
266
+ $cff_show_media_link = false;
267
$cff_show_event_title = false;
268
$cff_show_event_details = false;
269
$cff_show_meta = false;
275
if ( stripos($cff_includes, 'sharedlink') !== false ) $cff_show_shared_links = true;
276
if ( stripos($cff_includes, 'date') !== false ) $cff_show_date = true;
277
if ( stripos($cff_includes, 'media') !== false ) $cff_show_media = true;
278
+ if ( stripos($cff_includes, 'medialink') !== false ) $cff_show_media_link = true;
279
if ( stripos($cff_includes, 'eventtitle') !== false ) $cff_show_event_title = true;
280
if ( stripos($cff_includes, 'eventdetail') !== false ) $cff_show_event_details = true;
281
if ( stripos($cff_includes, 'social') !== false ) $cff_show_meta = true;
292
if ( stripos($cff_excludes, 'sharedlink') !== false ) $cff_show_shared_links = false;
293
if ( stripos($cff_excludes, 'date') !== false ) $cff_show_date = false;
294
if ( stripos($cff_excludes, 'media') !== false ) $cff_show_media = false;
295
+ if ( stripos($cff_excludes, 'medialink') !== false ) $cff_show_media_link = false;
296
if ( stripos($cff_excludes, 'eventtitle') !== false ) $cff_show_event_title = false;
297
if ( stripos($cff_excludes, 'eventdetail') !== false ) $cff_show_event_details = false;
298
if ( stripos($cff_excludes, 'social') !== false ) $cff_show_meta = false;
712
if ( !isset($cff_likebox_width) || empty($cff_likebox_width) || $cff_likebox_width == '' ) $cff_likebox_width = 300;
713
714
//Set like box variable
715
+ isset( $options[ 'cff_app_id' ] ) && !empty( $options[ 'cff_app_id' ] ) ? $cff_app_id = $options[ 'cff_app_id' ] : $cff_app_id = '712681982206086';
716
+ $cff_like_box_params = '&appId=' .$cff_app_id;
717
$like_box = '<div class="cff-likebox';
718
if ($cff_like_box_outside) $like_box .= ' cff-outside';
719
$like_box .= ($cff_like_box_position == 'top') ? ' cff-top' : ' cff-bottom';
1109
$post_text = htmlspecialchars($news->name);
1110
$cff_post_text_type = 'name';
1111
}
1112
1113
1114
//MESSAGE TAGS
1396
//Link to the Facebook post if it's a link or a video
1397
if($cff_post_type == 'link' || $cff_post_type == 'video') $link = "https://www.facebook.com/" . $page_id . "/posts/" . $PostID[1];
1398
1399
//Social media sharing URLs
1400
$cff_share_facebook = 'https://www.facebook.com/sharer/sharer.php?u=' . urlencode($link);
1401
$cff_share_twitter = 'https://twitter.com/intent/tweet?text=' . urlencode($link);
1403
$cff_share_linkedin = 'https://www.linkedin.com/shareArticle?mini=true&amp;url=' . urlencode($link) . '&amp;title=' . rawurlencode( strip_tags($cff_post_text) );
1404
$cff_share_email = 'mailto:?subject=Facebook&amp;body=' . urlencode($link) . '%20-%20' . rawurlencode( strip_tags($cff_post_text) );
1405
1406
+ //If it's a shared post then change the link to use the Post ID so that it links to the shared post and not the original post that's being shared
1407
+ if( isset($news->status_type) ){
1408
+ if( $news->status_type == 'shared_story' ) $link = "https://www.facebook.com/" . $cff_post_id;
1409
+ }
1410
1411
//If it's an offer post then change the text
1412
if ($cff_post_type == 'offer') $link_text = 'View Offer';
1432
}
1433
1434
1435
+ /* MEDIA LINK */
1436
+ $cff_translate_photo_text = $atts['phototext'];
1437
+ if (!isset($cff_translate_photo_text) || empty($cff_translate_photo_text)) $cff_translate_photo_text = 'Photo';
1438
+ $cff_translate_video_text = $atts['videotext'];
1439
+ if (!isset($cff_translate_video_text) || empty($cff_translate_video_text)) $cff_translate_video_text = 'Video';
1440
+
1441
+ $cff_media_link = '';
1442
+ if( $cff_show_media_link && ($cff_post_type == 'photo' || $cff_post_type == 'video') ){
1443
+ $cff_media_link .= '<p class="cff-media-link"><a href="'.$link.'" '.$target.' style="color: #'.$cff_posttext_link_color.';"><i style="padding-right: 5px;" class="fa fa-';
1444
+ if($cff_post_type == 'photo') $cff_media_link .= 'picture-o"></i>'. $cff_translate_photo_text;
1445
+ // if($cff_post_type == 'video') $cff_media_link .= 'file-video-o';
1446
+ if($cff_post_type == 'video') $cff_media_link .= 'video-camera"></i>'. $cff_translate_video_text;
1447
+ $cff_media_link .= '</a></p>';
1448
+ }
1449
+
1450
+
1451
//**************************//
1452
//***CREATE THE POST HTML***//
1453
//**************************//
1470
if ($cff_show_date && $cff_date_position == 'above') $cff_post_item .= $cff_date;
1471
//POST TEXT
1472
if($cff_show_text) $cff_post_item .= $cff_post_text;
1473
+
1474
//DESCRIPTION
1475
if($cff_show_desc && $cff_post_type != 'offer' && $cff_post_type != 'link') $cff_post_item .= $cff_description;
1476
//LINK
1485
if ( (!$cff_show_author && $cff_date_position == 'author') || $cff_show_date && $cff_date_position == 'below') {
1486
if($cff_show_date && $cff_post_type == 'event') $cff_post_item .= $cff_date;
1487
}
1488
+
1489
+ //MEDIA LINK
1490
+ if($cff_show_media_link) $cff_post_item .= $cff_media_link;
1491
//VIEW ON FACEBOOK LINK
1492
if($cff_show_link) $cff_post_item .= $cff_link;
1493
1566
//Use cURL
1567
if(is_callable('curl_init')){
1568
$ch = curl_init();
1569
+ // Use global proxy settings
1570
+ if (defined('WP_PROXY_HOST')) {
1571
+ curl_setopt($ch, CURLOPT_PROXY, WP_PROXY_HOST);
1572
+ }
1573
+ if (defined('WP_PROXY_PORT')) {
1574
+ curl_setopt($ch, CURLOPT_PROXYPORT, WP_PROXY_PORT);
1575
+ }
1576
+ if (defined('WP_PROXY_USERNAME')){
1577
+ $auth = WP_PROXY_USERNAME;
1578
+ if (defined('WP_PROXY_PASSWORD')){
1579
+ $auth .= ':' . WP_PROXY_PASSWORD;
1580
+ }
1581
+ curl_setopt($ch, CURLOPT_PROXYUSERPWD, $auth);
1582
+ }
1583
curl_setopt($ch, CURLOPT_URL, $url);
1584
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
1585
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
1607
//Auto detect
1608
if(is_callable('curl_init')){
1609
$ch = curl_init();
1610
+ // Use global proxy settings
1611
+ if (defined('WP_PROXY_HOST')) {
1612
+ curl_setopt($ch, CURLOPT_PROXY, WP_PROXY_HOST);
1613
+ }
1614
+ if (defined('WP_PROXY_PORT')) {
1615
+ curl_setopt($ch, CURLOPT_PROXYPORT, WP_PROXY_PORT);
1616
+ }
1617
+ if (defined('WP_PROXY_USERNAME')){
1618
+ $auth = WP_PROXY_USERNAME;
1619
+ if (defined('WP_PROXY_PASSWORD')){
1620
+ $auth .= ':' . WP_PROXY_PASSWORD;
1621
+ }
1622
+ curl_setopt($ch, CURLOPT_PROXYUSERPWD, $auth);
1623
+ }
1624
curl_setopt($ch, CURLOPT_URL, $url);
1625
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
1626
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
2050
$options[ 'cff_show_shared_links' ] = true;
2051
$options[ 'cff_show_date' ] = true;
2052
$options[ 'cff_show_media' ] = true;
2053
+ $options[ 'cff_show_media_link' ] = true;
2054
$options[ 'cff_show_event_title' ] = true;
2055
$options[ 'cff_show_event_details' ] = true;
2056
$options[ 'cff_show_meta' ] = true;