Custom Facebook Feed - Version 2.1

Version Description

  • New: Added an option to preserve/save your plugin options after uninstalling the plugin. This makes manually updating the plugin much easier.
  • New: Added a 'Settings' link to the plugin on the Plugins page
  • New: Added a field to the Misc settings page which allows users to enter their Facebook App ID in order to remove a couple of browser console warnings caused by the Facebook Like box widget
  • Tweak: Reduced the size of the author's Facebook profile picture from 50px to 40px to match Facebook
  • Tweak: The link description text is now 12px in size by default
  • Tweak: Added some default character limits to the post text and descriptions
  • Tweak: If the post author is being hidden then change the default date position to be the bottom of the post
  • Fix: The post author link is no longer the full width of the post and is only wrapped around the author image and name which helps prevent inadvertently clicking on the post author
  • Fix: Added a fb-root element to the Like box to prevent a browser console warning
  • Fix: Renamed the ShowError function to prevent conflicts
  • Fix: Fixed an issue with the 'seconds' custom text string not being saved correctly
  • Fix: When linking the post text to the Facebook post the correct text color is now applied
Download this release

Release Info

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

Code changes from version 2.0.1 to 2.1

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 media
4
Requires at least: 3.0
5
Tested up to: 4.0
6
- Stable tag: 2.0.1
7
License: GPLv2 or later
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
@@ -271,6 +271,20 @@ Credit iMarketing Factory - "The Importance of Facebook for Small Businesses"
271
9. It's super easy to display your Facebook feed in any page or post
272
273
== Changelog ==
274
= 2.0.1 =
275
* Tweak: Improved error handling and added an [Error Message reference](https://smashballoon.com/custom-facebook-feed/docs/errors/) to the website
276
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 media
4
Requires at least: 3.0
5
Tested up to: 4.0
6
+ Stable tag: 2.1
7
License: GPLv2 or later
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
271
9. It's super easy to display your Facebook feed in any page or post
272
273
== Changelog ==
274
+ = 2.1 =
275
+ * New: Added an option to preserve/save your plugin options after uninstalling the plugin. This makes manually updating the plugin much easier.
276
+ * New: Added a 'Settings' link to the plugin on the Plugins page
277
+ * New: Added a field to the Misc settings page which allows users to enter their Facebook App ID in order to remove a couple of browser console warnings caused by the Facebook Like box widget
278
+ * Tweak: Reduced the size of the author's Facebook profile picture from 50px to 40px to match Facebook
279
+ * Tweak: The link description text is now 12px in size by default
280
+ * Tweak: Added some default character limits to the post text and descriptions
281
+ * Tweak: If the post author is being hidden then change the default date position to be the bottom of the post
282
+ * Fix: The post author link is no longer the full width of the post and is only wrapped around the author image and name which helps prevent inadvertently clicking on the post author
283
+ * Fix: Added a fb-root element to the Like box to prevent a browser console warning
284
+ * Fix: Renamed the ShowError function to prevent conflicts
285
+ * Fix: Fixed an issue with the 'seconds' custom text string not being saved correctly
286
+ * Fix: When linking the post text to the Facebook post the correct text color is now applied
287
+
288
= 2.0.1 =
289
* Tweak: Improved error handling and added an [Error Message reference](https://smashballoon.com/custom-facebook-feed/docs/errors/) to the website
290
css/cff-style.css CHANGED
@@ -106,42 +106,54 @@
106
width: 100%;
107
}
108
#cff .cff-author a{
109
- /*float: left;*/
110
display: block;
111
min-width: 100%\9;
112
}
113
#cff .cff-author img{
114
float: left;
115
- margin: 0 15px 0 0;
116
}
117
- #cff .cff-author span{
118
display: table-cell;
119
vertical-align: middle;
120
- height: 50px;
121
margin: 0;
122
font-weight: bold;
123
}
124
#cff .cff-author a{
125
text-decoration: none;
126
}
127
128
/* Author Date */
129
- #cff .cff-author .cff-page-name.cff-author-date,
130
- #cff .cff-author .cff-date{
131
- float: none;
132
width: auto;
133
- clear: none;
134
- margin: 0;
135
font-weight: bold;
136
}
137
#cff .cff-author .cff-date{
138
- float: none;
139
color: #9197a3;
140
font-weight: normal;
141
- margin-top: 3px;
142
}
143
#cff .cff-author .cff-page-name.cff-author-date{
144
- padding-top: 5px;
145
}
146
147
/*************/
@@ -165,6 +177,11 @@
165
width: 100%;
166
padding: 5px 10px;
167
margin: 10px 0 5px 0;
168
background: rgba(0,0,0,0.02);
169
border: 1px solid rgba(0,0,0,0.07);
170
@@ -195,14 +212,14 @@
195
font-weight: bold;
196
}
197
#cff p.cff-link-title{
198
- margin: 0;
199
}
200
#cff .cff-text-link{
201
float: left;
202
clear: none;
203
width: 72%;
204
margin-left: 3%;
205
- padding: 5px 0;
206
}
207
#cff .cff-link-caption{
208
font-size: 12px;
106
width: 100%;
107
}
108
#cff .cff-author a{
109
+ float: left;
110
display: block;
111
+ /*width: 100%;*/
112
min-width: 100%\9;
113
}
114
+ #cff .cff-author-img{
115
+ float: left;
116
+ width: 40px;
117
+ margin: 0 0 0 -100% !important;
118
+ }
119
#cff .cff-author img{
120
float: left;
121
}
122
+ #cff .cff-author .cff-author-text span{
123
display: table-cell;
124
vertical-align: middle;
125
+ height: 40px;
126
margin: 0;
127
font-weight: bold;
128
+
129
+ /* For when there's no date immediately under author: */
130
+ padding-left: 50px;
131
+ float: none;
132
}
133
#cff .cff-author a{
134
text-decoration: none;
135
}
136
137
/* Author Date */
138
+ #cff .cff-author .cff-author-text{
139
+ float: left;
140
+ width: 100%;
141
+ }
142
+ #cff .cff-author .cff-author-text *{
143
+ float: left;
144
+ clear: both;
145
width: auto;
146
+ margin: 0 0 0 50px;
147
font-weight: bold;
148
}
149
#cff .cff-author .cff-date{
150
color: #9197a3;
151
font-weight: normal;
152
+ margin-top: 0px;
153
}
154
#cff .cff-author .cff-page-name.cff-author-date{
155
+ float: left;
156
+ padding: 2px 0 0 0;
157
}
158
159
/*************/
177
width: 100%;
178
padding: 5px 10px;
179
margin: 10px 0 5px 0;
180
+
181
+ /* IE8 */
182
+ background: #f9f9f9;
183
+ border: 1px solid #d9d9d9;
184
+
185
background: rgba(0,0,0,0.02);
186
border: 1px solid rgba(0,0,0,0.07);
187
212
font-weight: bold;
213
}
214
#cff p.cff-link-title{
215
+ margin: 5px 0 0 0;
216
}
217
#cff .cff-text-link{
218
float: left;
219
clear: none;
220
width: 72%;
221
margin-left: 3%;
222
+ padding: 0 0 5px 0;
223
}
224
#cff .cff-link-caption{
225
font-size: 12px;
custom-facebook-feed-admin.php CHANGED
@@ -421,7 +421,7 @@ function cff_style_page() {
421
'cff_title_weight' => 'inherit',
422
'cff_title_color' => '',
423
'cff_posttext_link_color' => '',
424
- 'cff_body_size' => 'inherit',
425
'cff_body_weight' => 'inherit',
426
'cff_body_color' => '',
427
'cff_link_title_format' => 'p',
@@ -498,6 +498,7 @@ function cff_style_page() {
498
'cff_link_hashtags' => true,
499
'cff_event_title_link' => false,
500
'cff_video_action' => 'post',
501
'cff_sep_color' => '',
502
'cff_sep_size' => '1',
503
@@ -668,6 +669,9 @@ function cff_style_page() {
668
$cff_show_author = $options[ 'cff_show_author' ];
669
$cff_class = $options[ 'cff_class' ];
670
$cff_open_links = $options[ 'cff_open_links' ];
671
672
//Page Header
673
$cff_show_header = $options[ 'cff_show_header' ];
@@ -701,8 +705,8 @@ function cff_style_page() {
701
$cff_title_length = 'cff_title_length';
702
$cff_body_length = 'cff_body_length';
703
// Read in existing option value from database
704
- $cff_title_length_val = get_option( $cff_title_length );
705
- $cff_body_length_val = get_option( $cff_body_length );
706
707
//Ajax
708
$cff_ajax = 'cff_ajax';
@@ -996,7 +1000,9 @@ function cff_style_page() {
996
if (isset($_POST[ 'cff_video_action' ])) $cff_video_action = $_POST[ 'cff_video_action' ];
997
if (isset($_POST[ 'cff_open_links' ])) $cff_open_links = $_POST[ 'cff_open_links' ];
998
999
- $cff_ajax_val = $_POST[ $cff_ajax ];
1000
1001
//Meta
1002
$options[ 'cff_icon_style' ] = $cff_icon_style;
@@ -1024,6 +1030,8 @@ function cff_style_page() {
1024
$options[ 'cff_open_links' ] = $cff_open_links;
1025
1026
update_option( $cff_ajax, $cff_ajax_val );
1027
}
1028
//Update the Custom Text / Translate options
1029
if( isset($_POST[ $style_custom_text_hidden_field_name ]) && $_POST[ $style_custom_text_hidden_field_name ] == 'Y' ) {
@@ -2370,7 +2378,7 @@ function cff_style_page() {
2370
<table class="form-table">
2371
<tbody>
2372
<tr>
2373
- <th><label for="cff_ajax" class="bump-left"><?php _e('Is your theme loading the Facebook feed via Ajax?'); ?></label></th>
2374
<td>
2375
<input name="cff_ajax" type="checkbox" id="cff_ajax" <?php if($cff_ajax_val == true) echo "checked"; ?> />
2376
<label for="cff_ajax"><?php _e('Yes'); ?></label>
@@ -2378,6 +2386,23 @@ function cff_style_page() {
2378
<p class="cff-tooltip cff-more-info"><?php _e('Some modern WordPress themes use Ajax to load content into the page after it has loaded. If your theme uses Ajax to load the Custom Facebook Feed content into the page then check this box. If you are not sure then please check with the theme author.'); ?></p>
2379
</td>
2380
</tr>
2381
</tbody>
2382
</table>
2383
@@ -2438,7 +2463,7 @@ function cff_style_page() {
2438
<input name="cff_translate_second" type="text" value="<?php esc_attr_e( $cff_translate_second ); ?>" size="20" />
2439
<br />
2440
<label for="cff_translate_seconds"><?php _e("seconds"); ?></label>
2441
- <input name="cff_translate_seconds" type="text" value="<?php esc_attr_e( $cff_translate_second ); ?>" size="20" />
2442
<br />
2443
<label for="cff_translate_minute"><?php _e("minute"); ?></label>
2444
<input name="cff_translate_minute" type="text" value="<?php esc_attr_e( $cff_translate_minute ); ?>" size="20" />
@@ -2493,7 +2518,7 @@ function cff_style_page() {
2493
} //End Style_Page
2494
//Enqueue admin styles
2495
function cff_admin_style() {
2496
- wp_register_style( 'custom_wp_admin_css', plugin_dir_url( __FILE__ ) . 'css/cff-admin-style.css?5', false, '1.0.0' );
2497
wp_enqueue_style( 'custom_wp_admin_css' );
2498
wp_enqueue_style( 'cff-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css', array(), '4.0.3' );
2499
wp_enqueue_style( 'wp-color-picker' );
@@ -2501,7 +2526,7 @@ function cff_admin_style() {
2501
add_action( 'admin_enqueue_scripts', 'cff_admin_style' );
2502
//Enqueue admin scripts
2503
function cff_admin_scripts() {
2504
- wp_enqueue_script( 'cff_admin_script', plugin_dir_url( __FILE__ ) . 'js/cff-admin-scripts.js?6' );
2505
if( !wp_script_is('jquery-ui-draggable') ) {
2506
wp_enqueue_script(
2507
array(
@@ -2519,4 +2544,16 @@ function cff_admin_scripts() {
2519
);
2520
}
2521
add_action( 'admin_enqueue_scripts', 'cff_admin_scripts' );
2522
?>
421
'cff_title_weight' => 'inherit',
422
'cff_title_color' => '',
423
'cff_posttext_link_color' => '',
424
+ 'cff_body_size' => '12',
425
'cff_body_weight' => 'inherit',
426
'cff_body_color' => '',
427
'cff_link_title_format' => 'p',
498
'cff_link_hashtags' => true,
499
'cff_event_title_link' => false,
500
'cff_video_action' => 'post',
501
+ 'cff_app_id' => '',
502
'cff_sep_color' => '',
503
'cff_sep_size' => '1',
504
669
$cff_show_author = $options[ 'cff_show_author' ];
670
$cff_class = $options[ 'cff_class' ];
671
$cff_open_links = $options[ 'cff_open_links' ];
672
+ $cff_app_id = $options[ 'cff_app_id' ];
673
+ $cff_preserve_settings = 'cff_preserve_settings';
674
+ $cff_preserve_settings_val = get_option( $cff_preserve_settings );
675
676
//Page Header
677
$cff_show_header = $options[ 'cff_show_header' ];
705
$cff_title_length = 'cff_title_length';
706
$cff_body_length = 'cff_body_length';
707
// Read in existing option value from database
708
+ $cff_title_length_val = get_option( $cff_title_length, '400' );
709
+ $cff_body_length_val = get_option( $cff_body_length, '200' );
710
711
//Ajax
712
$cff_ajax = 'cff_ajax';
1000
if (isset($_POST[ 'cff_video_action' ])) $cff_video_action = $_POST[ 'cff_video_action' ];
1001
if (isset($_POST[ 'cff_open_links' ])) $cff_open_links = $_POST[ 'cff_open_links' ];
1002
1003
+ (isset($_POST[ $cff_ajax ])) ? $cff_ajax_val = $_POST[ 'cff_ajax' ] : $cff_ajax_val = '';
1004
+ if (isset($_POST[ 'cff_app_id' ])) $cff_app_id = $_POST[ 'cff_app_id' ];
1005
+ $cff_preserve_settings_val = $_POST[ $cff_preserve_settings ];
1006
1007
//Meta
1008
$options[ 'cff_icon_style' ] = $cff_icon_style;
1030
$options[ 'cff_open_links' ] = $cff_open_links;
1031
1032
update_option( $cff_ajax, $cff_ajax_val );
1033
+ $options[ 'cff_app_id' ] = $cff_app_id;
1034
+ update_option( $cff_preserve_settings, $cff_preserve_settings_val );
1035
}
1036
//Update the Custom Text / Translate options
1037
if( isset($_POST[ $style_custom_text_hidden_field_name ]) && $_POST[ $style_custom_text_hidden_field_name ] == 'Y' ) {
2378
<table class="form-table">
2379
<tbody>
2380
<tr>
2381
+ <th class="bump-left"><label for="cff_ajax" class="bump-left"><?php _e('Is your theme loading the Facebook feed via Ajax?'); ?></label></th>
2382
<td>
2383
<input name="cff_ajax" type="checkbox" id="cff_ajax" <?php if($cff_ajax_val == true) echo "checked"; ?> />
2384
<label for="cff_ajax"><?php _e('Yes'); ?></label>
2386
<p class="cff-tooltip cff-more-info"><?php _e('Some modern WordPress themes use Ajax to load content into the page after it has loaded. If your theme uses Ajax to load the Custom Facebook Feed content into the page then check this box. If you are not sure then please check with the theme author.'); ?></p>
2387
</td>
2388
</tr>
2389
+ <tr>
2390
+ <th class="bump-left"><label for="cff_app_id" class="bump-left"><?php _e('Facebook App ID'); ?></label></th>
2391
+ <td>
2392
+ <input name="cff_app_id" type="text" value="<?php esc_attr_e( $cff_app_id ); ?>" size="18" />
2393
+ <a class="cff-tooltip-link" href="JavaScript:void(0);"><?php _e('What is this?'); ?></a>
2394
+ <p class="cff-tooltip cff-more-info"><?php _e("If you've registered as a Facebook developer and have an App ID then you can enter it here. You can add your website to your Facebook App by going to your App Settings, clicking 'Add Platform' and then entering your website URL."); ?></p>
2395
+ </td>
2396
+ </tr>
2397
+ <tr>
2398
+ <th class="bump-left"><label for="cff_preserve_settings" class="bump-left"><?php _e("Preserve settings when plugin is removed"); ?></label></th>
2399
+ <td>
2400
+ <input name="cff_preserve_settings" type="checkbox" id="cff_preserve_settings" <?php if($cff_preserve_settings_val == true) echo "checked"; ?> />
2401
+ <label for="cff_preserve_settings"><?php _e('Yes'); ?></label>
2402
+ <a class="cff-tooltip-link" href="JavaScript:void(0);"><?php _e('What does this mean?'); ?></a>
2403
+ <p class="cff-tooltip cff-more-info"><?php _e('When removing the plugin your settings are automatically deleted from your database. Checking this box will prevent any settings from being deleted. This means that you can uninstall and reinstall the plugin without losing your settings.'); ?></p>
2404
+ </td>
2405
+ </tr>
2406
</tbody>
2407
</table>
2408
2463
<input name="cff_translate_second" type="text" value="<?php esc_attr_e( $cff_translate_second ); ?>" size="20" />
2464
<br />
2465
<label for="cff_translate_seconds"><?php _e("seconds"); ?></label>
2466
+ <input name="cff_translate_seconds" type="text" value="<?php esc_attr_e( $cff_translate_seconds ); ?>" size="20" />
2467
<br />
2468
<label for="cff_translate_minute"><?php _e("minute"); ?></label>
2469
<input name="cff_translate_minute" type="text" value="<?php esc_attr_e( $cff_translate_minute ); ?>" size="20" />
2518
} //End Style_Page
2519
//Enqueue admin styles
2520
function cff_admin_style() {
2521
+ wp_register_style( 'custom_wp_admin_css', plugin_dir_url( __FILE__ ) . 'css/cff-admin-style.css?7', false, '1.0.0' );
2522
wp_enqueue_style( 'custom_wp_admin_css' );
2523
wp_enqueue_style( 'cff-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css', array(), '4.0.3' );
2524
wp_enqueue_style( 'wp-color-picker' );
2526
add_action( 'admin_enqueue_scripts', 'cff_admin_style' );
2527
//Enqueue admin scripts
2528
function cff_admin_scripts() {
2529
+ wp_enqueue_script( 'cff_admin_script', plugin_dir_url( __FILE__ ) . 'js/cff-admin-scripts.js?7' );
2530
if( !wp_script_is('jquery-ui-draggable') ) {
2531
wp_enqueue_script(
2532
array(
2544
);
2545
}
2546
add_action( 'admin_enqueue_scripts', 'cff_admin_scripts' );
2547
+
2548
+ // Add a Settings link to the plugin on the Plugins page
2549
+ $cff_plugin_file = 'custom-facebook-feed/custom-facebook-feed.php';
2550
+ add_filter( "plugin_action_links_{$cff_plugin_file}", 'cff_add_settings_link', 10, 2 );
2551
+
2552
+ //modify the link by unshifting the array
2553
+ function cff_add_settings_link( $links, $file ) {
2554
+ $cff_settings_link = '<a href="' . admin_url( 'admin.php?page=cff-top' ) . '">' . __( 'Settings', 'cff-top' ) . '</a>';
2555
+ array_unshift( $links, $cff_settings_link );
2556
+
2557
+ return $links;
2558
+ }
2559
?>
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: 2.0.1
7
Author: Smash Balloon
8
Author URI: http://smashballoon.com/
9
License: GPLv2 or later
@@ -465,6 +465,7 @@ function display_cff($atts) {
465
($cff_post_bg_color !== '#' && $cff_post_bg_color !== '') ? $cff_post_bg_color_check = true : $cff_post_bg_color_check = false;
466
($cff_sep_color !== '#' && $cff_sep_color !== '') ? $cff_sep_color_check = true : $cff_sep_color_check = false;
467
468
//CFF item styles
469
if( $cff_sep_color_check || $cff_post_bg_color_check ){
470
$cff_item_styles = 'style="';
@@ -571,10 +572,12 @@ function display_cff($atts) {
571
if ( !isset($cff_like_box_faces) || empty($cff_like_box_faces) ) $cff_like_box_faces = 'false';
572
573
//Set like box variable
574
$like_box = '<div class="cff-likebox';
575
if ($cff_like_box_outside) $like_box .= ' cff-outside';
576
$like_box .= ($cff_like_box_position == 'top') ? ' top' : ' bottom';
577
- $like_box .= '" ' . $cff_likebox_styles . '><script src="https://connect.facebook.net/' . $cff_locale . '/all.js#xfbml=1"></script><fb:like-box href="http://www.facebook.com/' . $page_id . '" show_faces="'.$cff_like_box_faces.'" stream="false" header="false" colorscheme="'. $cff_like_box_colorscheme .'" show_border="'. $cff_like_box_border .'" data-height="'.$cff_likebox_height.'"></fb:like-box></div>';
578
//Don't show like box if it's a group
579
if($cff_is_group) $like_box = '';
580
@@ -665,8 +668,8 @@ function display_cff($atts) {
665
666
//If there's no data then show a pretty error message
667
if( empty($FBdata->data) ) {
668
- $cff_content .= '<div class="cff-error-msg"><p>Unable to display Facebook posts.<br/><a href="javascript:void(0);" id="cff-show-error" onclick="showError()">Show error</a>';
669
- $cff_content .= '<script type="text/javascript">function showError() { document.getElementById("cff-error-reason").style.display = "block"; document.getElementById("cff-show-error").style.display = "none"; }</script>';
670
$cff_content .= '</p><div id="cff-error-reason">';
671
672
if( isset($FBdata->error->message) ) $cff_content .= 'Error: ' . $FBdata->error->message;
@@ -804,24 +807,29 @@ function display_cff($atts) {
804
805
$post_time = $news->created_time;
806
$cff_date = '<p class="cff-date" '.$cff_date_styles.'>'. $cff_date_before . ' ' . cff_getdate(strtotime($post_time), $cff_date_formatting, $cff_date_custom) . ' ' . $cff_date_after;
807
- if($cff_date_position == 'below') $cff_date .= '<span class="cff-date-dot">&nbsp;&middot;&nbsp;&nbsp;</span>';
808
$cff_date .= '</p>';
809
810
//POST AUTHOR
811
- $cff_author = '<div class="cff-author"><a href="https://facebook.com/' . $news->from->id . '" '.$target.' title="'.$news->from->name.' on Facebook" '.$cff_author_styles.'>';
812
- //Set the author image as a variable. If it already exists then don't query the api for it again.
813
- $cff_author_img_var = '$cff_author_img_' . $news->from->id;
814
- if ( !isset($cff_author_img_var) ) $cff_author_img_var = 'https://graph.facebook.com/' . $news->from->id . '/picture?type=square';
815
- $cff_author .= '<img src="'.$cff_author_img_var.'" title="'.$news->from->name.'" alt="'.$news->from->name.'" width=50 height=50>';
816
817
if($cff_date_position !== 'above' && $cff_date_position !== 'below'){
818
$cff_author .= '<p class="cff-page-name cff-author-date">'.$news->from->name.'</p>';
819
$cff_author .= $cff_date;
820
} else {
821
$cff_author .= '<span class="cff-page-name">'.$news->from->name.'</span>';
822
}
823
824
- $cff_author .= '</a></div>';
825
826
827
//POST TEXT
@@ -829,7 +837,7 @@ function display_cff($atts) {
829
if (!isset($cff_translate_photos_text) || empty($cff_translate_photos_text)) $cff_translate_photos_text = 'photos';
830
$cff_post_text = '<' . $cff_title_format . ' class="cff-post-text" ' . $cff_title_styles . '>';
831
$cff_post_text .= '<span class="cff-text">';
832
- if ($cff_title_link) $cff_post_text .= '<a class="cff-post-text-link" href="'.$link.'" '.$target.'>';
833
//Which content should we use?
834
$cff_post_text_type = '';
835
//Use the story
@@ -1152,7 +1160,7 @@ function display_cff($atts) {
1152
//LINK
1153
if($cff_show_shared_links) $cff_post_item .= $cff_shared_link;
1154
//DATE BELOW
1155
- if ($cff_show_date && $cff_date_position == 'below') $cff_post_item .= $cff_date;
1156
//EVENT
1157
if($cff_show_event_title || $cff_show_event_details) $cff_post_item .= $cff_event;
1158
//VIEW ON FACEBOOK LINK
@@ -1202,9 +1210,9 @@ function display_cff($atts) {
1202
if ($ajax_theme) {
1203
$cff_link_hashtags = $atts['linkhashtags'];
1204
($cff_link_hashtags == 'true' || $cff_link_hashtags == 'on') ? $cff_link_hashtags = 'true' : $cff_link_hashtags = 'false';
1205
- if ($cff_title_link) $cff_link_hashtags = 'false';
1206
$cff_content .= '<script type="text/javascript">var cfflinkhashtags = "' . $cff_link_hashtags . '";</script>';
1207
- $cff_content .= '<script type="text/javascript" src="' . plugins_url( '/js/cff-scripts.js?10' , __FILE__ ) . '"></script>';
1208
}
1209
1210
$cff_content .= '</div>';
@@ -1603,7 +1611,7 @@ add_filter('widget_text', 'do_shortcode');
1603
add_action( 'wp_enqueue_scripts', 'cff_add_my_stylesheet' );
1604
function cff_add_my_stylesheet() {
1605
// Respects SSL, Style.css is relative to the current file
1606
- wp_register_style( 'cff', plugins_url('css/cff-style.css?6', __FILE__) );
1607
wp_enqueue_style( 'cff' );
1608
wp_enqueue_style( 'cff-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css', array(), '4.0.3' );
1609
}
@@ -1611,7 +1619,7 @@ function cff_add_my_stylesheet() {
1611
add_action( 'wp_enqueue_scripts', 'cff_scripts_method' );
1612
function cff_scripts_method() {
1613
//Register the script to make it available
1614
- wp_register_script( 'cffscripts', plugins_url( '/js/cff-scripts.js?6' , __FILE__ ), array('jquery'), '1.8', true );
1615
//Enqueue it to load it onto the page
1616
wp_enqueue_script('cffscripts');
1617
}
@@ -1645,6 +1653,11 @@ function cff_uninstall()
1645
{
1646
if ( ! current_user_can( 'activate_plugins' ) )
1647
return;
1648
//Settings
1649
delete_option( 'cff_show_access_token' );
1650
delete_option( 'cff_access_token' );
@@ -1655,6 +1668,8 @@ function cff_uninstall()
1655
delete_option('cff_cache_time');
1656
delete_option('cff_cache_time_unit');
1657
delete_option( 'cff_locale' );
1658
//Style & Layout
1659
delete_option( 'cff_title_length' );
1660
delete_option( 'cff_body_length' );
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: 2.1
7
Author: Smash Balloon
8
Author URI: http://smashballoon.com/
9
License: GPLv2 or later
465
($cff_post_bg_color !== '#' && $cff_post_bg_color !== '') ? $cff_post_bg_color_check = true : $cff_post_bg_color_check = false;
466
($cff_sep_color !== '#' && $cff_sep_color !== '') ? $cff_sep_color_check = true : $cff_sep_color_check = false;
467
468
+ $cff_item_styles = '';
469
//CFF item styles
470
if( $cff_sep_color_check || $cff_post_bg_color_check ){
471
$cff_item_styles = 'style="';
572
if ( !isset($cff_like_box_faces) || empty($cff_like_box_faces) ) $cff_like_box_faces = 'false';
573
574
//Set like box variable
575
+ isset( $options[ 'cff_app_id' ] ) ? $cff_app_id = $options[ 'cff_app_id' ] : $cff_app_id = '';
576
+ ( isset($cff_app_id) && !empty($cff_app_id) ) ? $cff_like_box_params = '&appId=' .$cff_app_id : $cff_like_box_params = '';
577
$like_box = '<div class="cff-likebox';
578
if ($cff_like_box_outside) $like_box .= ' cff-outside';
579
$like_box .= ($cff_like_box_position == 'top') ? ' top' : ' bottom';
580
+ $like_box .= '" ' . $cff_likebox_styles . '><script src="https://connect.facebook.net/' . $cff_locale . '/all.js#xfbml=1 '.$cff_like_box_params.'"></script><fb:like-box href="http://www.facebook.com/' . $page_id . '" show_faces="'.$cff_like_box_faces.'" stream="false" header="false" colorscheme="'. $cff_like_box_colorscheme .'" show_border="'. $cff_like_box_border .'" data-height="'.$cff_likebox_height.'"></fb:like-box><div id="fb-root"></div></div>';
581
//Don't show like box if it's a group
582
if($cff_is_group) $like_box = '';
583
668
669
//If there's no data then show a pretty error message
670
if( empty($FBdata->data) ) {
671
+ $cff_content .= '<div class="cff-error-msg"><p>Unable to display Facebook posts.<br/><a href="javascript:void(0);" id="cff-show-error" onclick="cffShowError()">Show error</a>';
672
+ $cff_content .= '<script type="text/javascript">function cffShowError() { document.getElementById("cff-error-reason").style.display = "block"; document.getElementById("cff-show-error").style.display = "none"; }</script>';
673
$cff_content .= '</p><div id="cff-error-reason">';
674
675
if( isset($FBdata->error->message) ) $cff_content .= 'Error: ' . $FBdata->error->message;
807
808
$post_time = $news->created_time;
809
$cff_date = '<p class="cff-date" '.$cff_date_styles.'>'. $cff_date_before . ' ' . cff_getdate(strtotime($post_time), $cff_date_formatting, $cff_date_custom) . ' ' . $cff_date_after;
810
+ if($cff_date_position == 'below' || (!$cff_show_author && $cff_date_position == 'author') ) $cff_date .= '<span class="cff-date-dot">&nbsp;&middot;&nbsp;&nbsp;</span>';
811
$cff_date .= '</p>';
812
813
//POST AUTHOR
814
+ $cff_author = '<div class="cff-author">';
815
816
+ //Author text
817
+ $cff_author .= '<a href="https://facebook.com/' . $news->from->id . '" '.$target.' title="'.$news->from->name.' on Facebook" '.$cff_author_styles.'><div class="cff-author-text">';
818
if($cff_date_position !== 'above' && $cff_date_position !== 'below'){
819
$cff_author .= '<p class="cff-page-name cff-author-date">'.$news->from->name.'</p>';
820
$cff_author .= $cff_date;
821
} else {
822
$cff_author .= '<span class="cff-page-name">'.$news->from->name.'</span>';
823
}
824
+ $cff_author .= '</div>';
825
826
+ //Author image
827
+ //Set the author image as a variable. If it already exists then don't query the api for it again.
828
+ $cff_author_img_var = '$cff_author_img_' . $news->from->id;
829
+ if ( !isset($cff_author_img_var) ) $cff_author_img_var = 'https://graph.facebook.com/' . $news->from->id . '/picture?type=square';
830
+ $cff_author .= '<div class="cff-author-img"><img src="'.$cff_author_img_var.'" title="'.$news->from->name.'" alt="'.$news->from->name.'" width=40 height=40></div>';
831
+
832
+ $cff_author .= '</a></div>'; //End .cff-author
833
834
835
//POST TEXT
837
if (!isset($cff_translate_photos_text) || empty($cff_translate_photos_text)) $cff_translate_photos_text = 'photos';
838
$cff_post_text = '<' . $cff_title_format . ' class="cff-post-text" ' . $cff_title_styles . '>';
839
$cff_post_text .= '<span class="cff-text">';
840
+ if ($cff_title_link) $cff_post_text .= '<a class="cff-post-text-link" '.$cff_title_styles.' href="'.$link.'" '.$target.'>';
841
//Which content should we use?
842
$cff_post_text_type = '';
843
//Use the story
1160
//LINK
1161
if($cff_show_shared_links) $cff_post_item .= $cff_shared_link;
1162
//DATE BELOW
1163
+ if ( (!$cff_show_author && $cff_date_position == 'author') || $cff_show_date && $cff_date_position == 'below') $cff_post_item .= $cff_date;
1164
//EVENT
1165
if($cff_show_event_title || $cff_show_event_details) $cff_post_item .= $cff_event;
1166
//VIEW ON FACEBOOK LINK
1210
if ($ajax_theme) {
1211
$cff_link_hashtags = $atts['linkhashtags'];
1212
($cff_link_hashtags == 'true' || $cff_link_hashtags == 'on') ? $cff_link_hashtags = 'true' : $cff_link_hashtags = 'false';
1213
+ if($cff_title_link == 'true' || $cff_title_link == 'on') $cff_link_hashtags = 'false';
1214
$cff_content .= '<script type="text/javascript">var cfflinkhashtags = "' . $cff_link_hashtags . '";</script>';
1215
+ $cff_content .= '<script type="text/javascript" src="' . plugins_url( '/js/cff-scripts.js?11' , __FILE__ ) . '"></script>';
1216
}
1217
1218
$cff_content .= '</div>';
1611
add_action( 'wp_enqueue_scripts', 'cff_add_my_stylesheet' );
1612
function cff_add_my_stylesheet() {
1613
// Respects SSL, Style.css is relative to the current file
1614
+ wp_register_style( 'cff', plugins_url('css/cff-style.css?7', __FILE__) );
1615
wp_enqueue_style( 'cff' );
1616
wp_enqueue_style( 'cff-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css', array(), '4.0.3' );
1617
}
1619
add_action( 'wp_enqueue_scripts', 'cff_scripts_method' );
1620
function cff_scripts_method() {
1621
//Register the script to make it available
1622
+ wp_register_script( 'cffscripts', plugins_url( '/js/cff-scripts.js?7' , __FILE__ ), array('jquery'), '1.9', true );
1623
//Enqueue it to load it onto the page
1624
wp_enqueue_script('cffscripts');
1625
}
1653
{
1654
if ( ! current_user_can( 'activate_plugins' ) )
1655
return;
1656
+
1657
+ //If the user is preserving the settings then don't delete them
1658
+ $cff_preserve_settings = get_option('cff_preserve_settings');
1659
+ if($cff_preserve_settings) return;
1660
+
1661
//Settings
1662
delete_option( 'cff_show_access_token' );
1663
delete_option( 'cff_access_token' );
1668
delete_option('cff_cache_time');
1669
delete_option('cff_cache_time_unit');
1670
delete_option( 'cff_locale' );
1671
+ delete_option( 'cff_ajax' );
1672
+ delete_option( 'cff_preserve_settings' );
1673
//Style & Layout
1674
delete_option( 'cff_title_length' );
1675
delete_option( 'cff_body_length' );