Custom Facebook Feed - Version 2.2

Version Description

  • New: Added a text area to the Support tab which contains all of the plugin settings and site info for easier troubleshooting
  • New: You can now set the number of Facebook posts to '0' if you just want to show the Facebook Like box widget and no posts
  • Tweak: If the user doesn't add a unit to the width, height or padding then automatically add 'px'
  • Tweak: Added social media sharing links to the bottom of the settings page and an option to add a credit link to the bottom of the feed
  • Fix: Fixed an issue with Facebook hashtags not being linked when followed immediately by punctuation
  • Fix: When displaying a shared link if the caption is the same as the link URL then don't display it
  • Fix: Added a space before the feed header's style attribute to remove HTML validation error
  • Fix: Prefixed the 'top' and 'bottom' classes used on the Facebook Like box to prevent CSS conflicts
  • Fix: Fixed an issue with the link color not being applied to Facebook hashtag links
Download this release

Release Info

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

Code changes from version 2.1.3 to 2.2

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.1.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -271,6 +271,17 @@ 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.1.3 =
275
  * Fix: Fixed an issue with the Facebook Access Token used in the plugin hitting its request limit
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.2
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.2 =
275
+ * New: Added a text area to the Support tab which contains all of the plugin settings and site info for easier troubleshooting
276
+ * New: You can now set the number of Facebook posts to '0' if you just want to show the Facebook Like box widget and no posts
277
+ * Tweak: If the user doesn't add a unit to the width, height or padding then automatically add 'px'
278
+ * Tweak: Added social media sharing links to the bottom of the settings page and an option to add a credit link to the bottom of the feed
279
+ * Fix: Fixed an issue with Facebook hashtags not being linked when followed immediately by punctuation
280
+ * Fix: When displaying a shared link if the caption is the same as the link URL then don't display it
281
+ * Fix: Added a space before the feed header's style attribute to remove HTML validation error
282
+ * Fix: Prefixed the 'top' and 'bottom' classes used on the Facebook Like box to prevent CSS conflicts
283
+ * Fix: Fixed an issue with the link color not being applied to Facebook hashtag links
284
+
285
  = 2.1.3 =
286
  * Fix: Fixed an issue with the Facebook Access Token used in the plugin hitting its request limit
287
 
css/cff-style.css CHANGED
@@ -286,10 +286,10 @@
286
  height: 100%;
287
  }
288
  /*Like box is not inside of #cff*/
289
- .cff-likebox.top.cff-outside{
290
  margin-bottom: 10px;
291
  }
292
- .cff-likebox.bottom.cff-outside{
293
  margin-top: 10px;
294
  }
295
 
@@ -327,4 +327,16 @@
327
  display: none;
328
  padding: 5px 0 0 0;
329
  clear: both;
 
 
 
 
 
 
 
 
 
 
 
 
330
  }
286
  height: 100%;
287
  }
288
  /*Like box is not inside of #cff*/
289
+ .cff-likebox.cff-top.cff-outside{
290
  margin-bottom: 10px;
291
  }
292
+ .cff-likebox.cff-bottom.cff-outside{
293
  margin-top: 10px;
294
  }
295
 
327
  display: none;
328
  padding: 5px 0 0 0;
329
  clear: both;
330
+ }
331
+
332
+ /* Credit link */
333
+ #cff .cff-credit{
334
+ font-size: 11px;
335
+ }
336
+ #cff .cff-credit a{
337
+ text-decoration: none;
338
+ }
339
+ #cff .cff-credit .fa{
340
+ padding-right: 5px;
341
+ font-size: 13px;
342
  }
custom-facebook-feed-admin.php CHANGED
@@ -331,6 +331,38 @@ function cff_settings_page() {
331
  <br />
332
  <a href="https://smashballoon.com/custom-facebook-feed/demo" target="_blank"><img src="<?php echo plugins_url( 'img/pro.png' , __FILE__ ) ?>" /></a>
333
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
  <?php } //End config tab ?>
335
 
336
 
@@ -354,26 +386,74 @@ function cff_settings_page() {
354
  </ul>
355
 
356
  <br />
357
- <p><?php _e('Still need help? <a href="https://smashballoon.com/custom-facebook-feed/support/" target="_blank">Request support</a>.'); ?></p>
358
 
359
  <br />
360
- <h3><?php _e('System Info'); ?></h3>
361
- <p>PHP Version: <b><?php echo PHP_VERSION . "\n"; ?></b></p>
362
- <p>Web Server Info: <b><?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?></b></p>
363
- <p>PHP allow_url_fopen: <b><?php echo ini_get( 'allow_url_fopen' ) ? "<span style='color: green;'>Yes</span>" : "<span style='color: red;'>No</span>"; ?></b></p>
364
- <p>PHP cURL: <b><?php echo is_callable('curl_init') ? "<span style='color: green;'>Yes</span>" : "<span style='color: red;'>No</span>" ?></b></p>
365
- <p>JSON: <b><?php echo function_exists("json_decode") ? "<span style='color: green;'>Yes</span>" : "<span style='color: red;'>No</span>" ?></b></p>
366
-
367
- <button class="button secondary-button" id="cff-api-test">Test connection to Facebook API</button>
368
-
369
- <div id="cff-api-test-result">
370
- <?php
371
- $access_token = get_option( $access_token );
372
- if ( $access_token == '' || empty($access_token) ) $access_token = '1436737606570258|MGh1BX4_b_D9HzJtKe702cwMRPI';
373
- ?>
374
- <?php $posts_json = cff_fetchUrl("https://graph.facebook.com/".get_option( trim($page_id) )."/feed?access_token=". trim($access_token) ."&limit=1"); ?>
375
- <textarea readonly="readonly" onclick="this.focus();this.select()" title="To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac)."><?php echo $posts_json; ?></textarea>
376
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
377
 
378
  <?php } ?>
379
 
@@ -499,6 +579,7 @@ function cff_style_page() {
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
 
@@ -670,6 +751,7 @@ function cff_style_page() {
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
 
@@ -1002,6 +1084,7 @@ function cff_style_page() {
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
@@ -1031,6 +1114,7 @@ function cff_style_page() {
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
@@ -2403,6 +2487,14 @@ function cff_style_page() {
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
 
@@ -2511,9 +2603,43 @@ function cff_style_page() {
2511
  </table>
2512
 
2513
  <?php submit_button(); ?>
 
2514
  <?php } //End Custom Text tab ?>
2515
 
2516
  </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2517
  <?php
2518
  } //End Style_Page
2519
  //Enqueue admin styles
331
  <br />
332
  <a href="https://smashballoon.com/custom-facebook-feed/demo" target="_blank"><img src="<?php echo plugins_url( 'img/pro.png' , __FILE__ ) ?>" /></a>
333
 
334
+ <hr />
335
+ <h3><?php _e('Like the plugin? Help spread the word!'); ?></h3>
336
+
337
+ <!-- TWITTER -->
338
+ <a href="https://twitter.com/share" class="twitter-share-button" data-url="https://wordpress.org/plugins/custom-facebook-feed/" data-text="Display your Facebook posts on your site your way using the Custom Facebook Feed WordPress plugin!" data-via="smashballoon" data-dnt="true">Tweet</a>
339
+ <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
340
+ <style type="text/css">
341
+ #twitter-widget-0{ float: left; width: 100px !important; }
342
+ .IN-widget{ margin-right: 20px; }
343
+ </style>
344
+
345
+ <!-- FACEBOOK -->
346
+ <div id="fb-root" style="display: none;"></div>
347
+ <script>(function(d, s, id) {
348
+ var js, fjs = d.getElementsByTagName(s)[0];
349
+ if (d.getElementById(id)) return;
350
+ js = d.createElement(s); js.id = id;
351
+ js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&appId=640861236031365&version=v2.0";
352
+ fjs.parentNode.insertBefore(js, fjs);
353
+ }(document, 'script', 'facebook-jssdk'));</script>
354
+ <div class="fb-like" data-href="https://wordpress.org/plugins/custom-facebook-feed/" data-layout="button_count" data-action="like" data-show-faces="false" data-share="true" style="display: block; float: left; margin-right: 20px;"></div>
355
+
356
+ <!-- LINKEDIN -->
357
+ <script src="//platform.linkedin.com/in.js" type="text/javascript">
358
+ lang: en_US
359
+ </script>
360
+ <script type="IN/Share" data-url="https://wordpress.org/plugins/custom-facebook-feed/"></script>
361
+
362
+ <!-- GOOGLE + -->
363
+ <script src="https://apis.google.com/js/platform.js" async defer></script>
364
+ <div class="g-plusone" data-size="medium" data-href="https://wordpress.org/plugins/custom-facebook-feed/"></div>
365
+
366
  <?php } //End config tab ?>
367
 
368
 
386
  </ul>
387
 
388
  <br />
389
+ <p><?php _e('Still need help? <a href="http://smashballoon.com/custom-facebook-feed/support/" target="_blank">Request support</a>. Please include your <b>System Info</b> below with all support requests.'); ?></p>
390
 
391
  <br />
392
+ <h3><?php _e('System Info &nbsp; <i style="color: #666; font-size: 11px; font-weight: normal;">Click the text below to select all</i>'); ?></h3>
393
+
394
+ <?php
395
+ $access_token = get_option( $access_token );
396
+ if ( $access_token == '' || empty($access_token) ) $access_token = '611606915581035|RdRHbHtrHseQw4C7SDUBFWIrJLA';
397
+ ?>
398
+ <?php $posts_json = cff_fetchUrl("https://graph.facebook.com/".get_option( trim($page_id) )."/feed?access_token=". trim($access_token) ."&limit=1"); ?>
399
+
400
+
401
+ <textarea readonly="readonly" onclick="this.focus();this.select()" title="To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac)." style="width: 70%; height: 500px; white-space: pre; font-family: Menlo,Monaco,monospace;">
402
+ ## SITE/SERVER INFO: ##
403
+ Site URL: <?php echo site_url() . "\n"; ?>
404
+ Home URL: <?php echo home_url() . "\n"; ?>
405
+ WordPress Version: <?php echo get_bloginfo( 'version' ) . "\n"; ?>
406
+ PHP Version: <?php echo PHP_VERSION . "\n"; ?>
407
+ Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?>
408
+ PHP allow_url_fopen: <?php echo ini_get( 'allow_url_fopen' ) ? "Yes" . "\n" : "No" . "\n"; ?>
409
+ PHP cURL: <?php echo is_callable('curl_init') ? "Yes" . "\n" : "No" . "\n"; ?>
410
+ JSON: <?php echo function_exists("json_decode") ? "Yes" . "\n" : "No" . "\n" ?>
411
+
412
+ ## ACTIVE PLUGINS: ##
413
+ <?php
414
+ $plugins = get_plugins();
415
+ $active_plugins = get_option( 'active_plugins', array() );
416
+
417
+ foreach ( $plugins as $plugin_path => $plugin ) {
418
+ // If the plugin isn't active, don't show it.
419
+ if ( ! in_array( $plugin_path, $active_plugins ) )
420
+ continue;
421
+
422
+ echo $plugin['Name'] . ': ' . $plugin['Version'] ."\n";
423
+ }
424
+ ?>
425
+
426
+ ## PLUGIN SETTINGS: ##
427
+ Use own Access Token: <?php echo get_option( 'cff_show_access_token' ) ."\n"; ?>
428
+ Access Token: <?php echo get_option( 'cff_access_token' ) ."\n"; ?>
429
+ Page ID: <?php echo get_option( 'cff_page_id' ) ."\n"; ?>
430
+ Page Type: <?php echo get_option( 'cff_page_type' ) ."\n"; ?>
431
+ Number of Posts: <?php echo get_option( 'cff_num_show' ) ."\n"; ?>
432
+ Post Limit: <?php echo get_option( 'cff_post_limit' ) ."\n"; ?>
433
+ Show Posts by: <?php echo get_option( 'cff_show_others' ) ."\n"; ?>
434
+ Cache Time: <?php echo get_option( 'cff_cache_time' ) ."\n"; ?>
435
+ Cache Unit: <?php echo get_option( 'cff_cache_time_unit' ) ."\n"; ?>
436
+ Locale: <?php echo get_option( 'cff_locale' ) ."\n"; ?>
437
+ Timezone: <?php $options = get_option( 'cff_style_settings', array() );
438
+ echo $options[ 'cff_timezone' ] ."\n"; ?>
439
+
440
+ ## EXTENSIONS: ##
441
+ Extensions Plugin: <?php echo get_option('cff_extensions_status') ."\n"; ?>
442
+ Date Range From: <?php echo get_option( 'cff_date_from' ) ."\n"; ?>
443
+ Date Range Until: <?php echo get_option( 'cff_date_until' ) ."\n"; ?>
444
+ Featured Post: <?php echo get_option( 'cff_featured_post_id' ) ."\n"; ?>
445
+ Lightbox: <?php echo get_option( 'cff_lightbox' ) ."\n"; ?>
446
+
447
+ ## CUSTOMIZE: ##
448
+ <?php
449
+ while (list($key, $val) = each($options)) {
450
+ echo "$key => $val\n";
451
+ }
452
+ ?>
453
+
454
+ ## FACEBOOK API RESPONSE: ##
455
+ <?php echo $posts_json; ?>
456
+ </textarea>
457
 
458
  <?php } ?>
459
 
579
  'cff_event_title_link' => false,
580
  'cff_video_action' => 'post',
581
  'cff_app_id' => '',
582
+ 'cff_show_credit' => '',
583
  'cff_sep_color' => '',
584
  'cff_sep_size' => '1',
585
 
751
  $cff_class = $options[ 'cff_class' ];
752
  $cff_open_links = $options[ 'cff_open_links' ];
753
  $cff_app_id = $options[ 'cff_app_id' ];
754
+ $cff_show_credit = $options[ 'cff_show_credit' ];
755
  $cff_preserve_settings = 'cff_preserve_settings';
756
  $cff_preserve_settings_val = get_option( $cff_preserve_settings );
757
 
1084
 
1085
  (isset($_POST[ $cff_ajax ])) ? $cff_ajax_val = $_POST[ 'cff_ajax' ] : $cff_ajax_val = '';
1086
  if (isset($_POST[ 'cff_app_id' ])) $cff_app_id = $_POST[ 'cff_app_id' ];
1087
+ (isset($_POST[ 'cff_show_credit' ])) ? $cff_show_credit = $_POST[ 'cff_show_credit' ] : $cff_show_credit = '';
1088
  $cff_preserve_settings_val = $_POST[ $cff_preserve_settings ];
1089
 
1090
  //Meta
1114
 
1115
  update_option( $cff_ajax, $cff_ajax_val );
1116
  $options[ 'cff_app_id' ] = $cff_app_id;
1117
+ $options[ 'cff_show_credit' ] = $cff_show_credit;
1118
  update_option( $cff_preserve_settings, $cff_preserve_settings_val );
1119
  }
1120
  //Update the Custom Text / Translate options
2487
  <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>
2488
  </td>
2489
  </tr>
2490
+ <tr>
2491
+ <th class="bump-left"><label for="cff_show_credit" class="bump-left"><?php _e("Display credit link"); ?></label></th>
2492
+ <td>
2493
+ <input name="cff_show_credit" type="checkbox" id="cff_show_credit" <?php if($cff_show_credit == true) echo "checked"; ?> />
2494
+ <label for="cff_show_credit"><?php _e('Yes'); ?></label>
2495
+ <i style="color: #666; font-size: 11px; margin-left: 5px;"><?php _e('Display a link at the bottom of the feed to help promote the plugin'); ?></i>
2496
+ </td>
2497
+ </tr>
2498
  </tbody>
2499
  </table>
2500
 
2603
  </table>
2604
 
2605
  <?php submit_button(); ?>
2606
+ <a href="https://smashballoon.com/custom-facebook-feed/demo" target="_blank"><img src="<?php echo plugins_url( 'img/pro.png' , __FILE__ ) ?>" /></a>
2607
  <?php } //End Custom Text tab ?>
2608
 
2609
  </form>
2610
+
2611
+ <hr />
2612
+ <h3><?php _e('Like the plugin? Help spread the word!'); ?></h3>
2613
+
2614
+ <!-- TWITTER -->
2615
+ <a href="https://twitter.com/share" class="twitter-share-button" data-url="https://wordpress.org/plugins/custom-facebook-feed/" data-text="Display your Facebook posts on your site your way using the Custom Facebook Feed WordPress plugin!" data-via="smashballoon" data-dnt="true">Tweet</a>
2616
+ <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
2617
+ <style type="text/css">
2618
+ #twitter-widget-0{ float: left; width: 100px !important; }
2619
+ .IN-widget{ margin-right: 20px; }
2620
+ </style>
2621
+
2622
+ <!-- FACEBOOK -->
2623
+ <div id="fb-root" style="display: none;"></div>
2624
+ <script>(function(d, s, id) {
2625
+ var js, fjs = d.getElementsByTagName(s)[0];
2626
+ if (d.getElementById(id)) return;
2627
+ js = d.createElement(s); js.id = id;
2628
+ js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&appId=640861236031365&version=v2.0";
2629
+ fjs.parentNode.insertBefore(js, fjs);
2630
+ }(document, 'script', 'facebook-jssdk'));</script>
2631
+ <div class="fb-like" data-href="https://wordpress.org/plugins/custom-facebook-feed/" data-layout="button_count" data-action="like" data-show-faces="false" data-share="true" style="display: block; float: left; margin-right: 20px;"></div>
2632
+
2633
+ <!-- LINKEDIN -->
2634
+ <script src="//platform.linkedin.com/in.js" type="text/javascript">
2635
+ lang: en_US
2636
+ </script>
2637
+ <script type="IN/Share" data-url="https://wordpress.org/plugins/custom-facebook-feed/"></script>
2638
+
2639
+ <!-- GOOGLE + -->
2640
+ <script src="https://apis.google.com/js/platform.js" async defer></script>
2641
+ <div class="g-plusone" data-size="medium" data-href="https://wordpress.org/plugins/custom-facebook-feed/"></div>
2642
+
2643
  <?php
2644
  } //End Style_Page
2645
  //Enqueue admin styles
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.1.3
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  License: GPLv2 or later
@@ -146,6 +146,7 @@ function display_cff($atts) {
146
  'likeboxheight' => isset($options[ 'cff_likebox_height' ]) ? $options[ 'cff_likebox_height' ] : '',
147
  'likeboxfaces' => isset($options[ 'cff_like_box_faces' ]) ? $options[ 'cff_like_box_faces' ] : '',
148
  'likeboxborder' => isset($options[ 'cff_like_box_border' ]) ? $options[ 'cff_like_box_border' ] : '',
 
149
 
150
  //Page Header
151
  'showheader' => isset($options[ 'cff_show_header' ]) ? $options[ 'cff_show_header' ] : '',
@@ -176,9 +177,15 @@ function display_cff($atts) {
176
  $cff_page_type = $atts[ 'pagetype' ];
177
  ($cff_page_type == 'group') ? $cff_is_group = true : $cff_is_group = false;
178
 
179
- $cff_feed_width = $atts['width'];
 
 
180
  $cff_feed_height = $atts[ 'height' ];
 
 
181
  $cff_feed_padding = $atts[ 'padding' ];
 
 
182
  $cff_bg_color = $atts[ 'bgcolor' ];
183
  $cff_show_author = $atts[ 'showauthornew' ];
184
  $cff_cache_time = $atts[ 'cachetime' ];
@@ -404,6 +411,8 @@ function display_cff($atts) {
404
  if ($cff_like_box_text_color == 'white') $cff_like_box_colorscheme = 'dark';
405
 
406
  $cff_likebox_width = $atts[ 'likeboxwidth' ];
 
 
407
  $cff_likebox_height = $atts[ 'likeboxheight' ];
408
  $cff_likebox_height = preg_replace('/px$/', '', $cff_likebox_height);
409
 
@@ -429,6 +438,8 @@ function display_cff($atts) {
429
  //Get feed header settings
430
  $cff_header_bg_color = $atts['headerbg'];
431
  $cff_header_padding = $atts['headerpadding'];
 
 
432
  $cff_header_text_size = $atts['headertextsize'];
433
  $cff_header_text_weight = $atts['headertextweight'];
434
  $cff_header_text_color = $atts['headertextcolor'];
@@ -500,7 +511,7 @@ function display_cff($atts) {
500
  //Get show posts attribute. If not set then default to 25
501
  $show_posts = $atts['num'];
502
  if (empty($show_posts)) $show_posts = 25;
503
- if ( $show_posts == 0 || $show_posts == 'undefined' ) $show_posts = 25;
504
 
505
  //If the 'Enter my own Access Token' box is unchecked then don't use the user's access token, even if there's one in the field
506
  get_option('cff_show_access_token') ? $cff_show_access_token = true : $cff_show_access_token = false;
@@ -587,7 +598,7 @@ function display_cff($atts) {
587
  ( isset($cff_app_id) && !empty($cff_app_id) ) ? $cff_like_box_params = '&appId=' .$cff_app_id : $cff_like_box_params = '';
588
  $like_box = '<div class="cff-likebox';
589
  if ($cff_like_box_outside) $like_box .= ' cff-outside';
590
- $like_box .= ($cff_like_box_position == 'top') ? ' top' : ' bottom';
591
  $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>';
592
  //Don't show like box if it's a group
593
  if($cff_is_group) $like_box = '';
@@ -607,7 +618,7 @@ function display_cff($atts) {
607
 
608
  $cff_header = '<h3 class="cff-header';
609
  if ($cff_header_outside) $cff_header .= ' cff-outside';
610
- $cff_header .= '"' . $cff_header_styles . '>';
611
  $cff_header .= '<i class="fa fa-' . $cff_header_icon . '"';
612
  if(!empty($cff_header_icon_color) || !empty($cff_header_icon_size)) $cff_header .= ' style="';
613
  if(!empty($cff_header_icon_color)) $cff_header .= 'color: #' . str_replace('#', '', $cff_header_icon_color) . ';';
@@ -617,6 +628,11 @@ function display_cff($atts) {
617
  $cff_header .= '<span class="header-text" style="height: '.$cff_header_icon_size.'px;">' . $cff_header_text . '</span>';
618
  $cff_header .= '</h3>';
619
 
 
 
 
 
 
620
 
621
  //***START FEED***
622
  $cff_content = '';
@@ -851,8 +867,11 @@ function display_cff($atts) {
851
  $cff_translate_photos_text = $atts['photostext'];
852
  if (!isset($cff_translate_photos_text) || empty($cff_translate_photos_text)) $cff_translate_photos_text = 'photos';
853
  $cff_post_text = '<' . $cff_title_format . ' class="cff-post-text" ' . $cff_title_styles . '>';
854
- $cff_post_text .= '<span class="cff-text">';
 
 
855
  if ($cff_title_link) $cff_post_text .= '<a class="cff-post-text-link" '.$cff_title_styles.' href="'.$link.'" '.$target.'>';
 
856
  //Which content should we use?
857
  $cff_post_text_type = '';
858
  //Use the story
@@ -977,7 +996,7 @@ function display_cff($atts) {
977
  if (!empty($body_limit)) {
978
  if (strlen($description_text) > $body_limit) $description_text = substr($description_text, 0, $body_limit) . '...';
979
  }
980
- $cff_description .= '<p class="cff-post-desc" '.$cff_body_styles.'><span>' . cff_autolink( htmlspecialchars($description_text) ) . ' </span></p>';
981
 
982
  //If the post text and description/caption are the same then don't show the description
983
  if($post_text == $description_text) $cff_description = '';
@@ -1000,9 +1019,10 @@ function display_cff($atts) {
1000
  //The link title:
1001
  $cff_shared_link .= '"><'.$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.'>';
1002
  //The link source:
1003
- if(!empty($news->caption)) $cff_shared_link .= '<p class="cff-link-caption" style="color:#' . str_replace('#', '', $cff_link_url_color) . ';">'.$news->caption.'</p>';
 
1004
  if ($cff_show_desc) {
1005
- $cff_shared_link .= $cff_description;
1006
  }
1007
  $cff_shared_link .= '</div>';
1008
  }
@@ -1219,6 +1239,11 @@ function display_cff($atts) {
1219
  date_default_timezone_set( $cff_orig_timezone );
1220
  //Add the Like Box inside
1221
  if ($cff_like_box_position == 'bottom' && $cff_show_like_box && !$cff_like_box_outside) $cff_content .= $like_box;
 
 
 
 
 
1222
  //End the feed
1223
  $cff_content .= '</div><div class="cff-clear"></div>';
1224
  //Add the Like Box outside
@@ -1632,7 +1657,7 @@ add_filter('widget_text', 'do_shortcode');
1632
  add_action( 'wp_enqueue_scripts', 'cff_add_my_stylesheet' );
1633
  function cff_add_my_stylesheet() {
1634
  // Respects SSL, Style.css is relative to the current file
1635
- wp_register_style( 'cff', plugins_url('css/cff-style.css?8', __FILE__) );
1636
  wp_enqueue_style( 'cff' );
1637
  wp_enqueue_style( 'cff-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css', array(), '4.0.3' );
1638
  }
@@ -1640,7 +1665,7 @@ function cff_add_my_stylesheet() {
1640
  add_action( 'wp_enqueue_scripts', 'cff_scripts_method' );
1641
  function cff_scripts_method() {
1642
  //Register the script to make it available
1643
- wp_register_script( 'cffscripts', plugins_url( '/js/cff-scripts.js?7' , __FILE__ ), array('jquery'), '1.9', true );
1644
  //Enqueue it to load it onto the page
1645
  wp_enqueue_script('cffscripts');
1646
  }
@@ -1902,7 +1927,7 @@ function cff_autolink_do($text, $link_color, $sub, $limit, $tagfill, $auto_title
1902
 
1903
 
1904
  if( substr( $link_url_enc, 0, 4 ) !== "http" ) $link_url_enc = 'http://' . $link_url_enc;
1905
- $buffer .= "<a target='_blank' style='color: #".$link_color."' href=\"{$link_url_enc}\"$tagfill>{$display_url_enc}</a>";
1906
 
1907
 
1908
  }else{
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.2
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  License: GPLv2 or later
146
  'likeboxheight' => isset($options[ 'cff_likebox_height' ]) ? $options[ 'cff_likebox_height' ] : '',
147
  'likeboxfaces' => isset($options[ 'cff_like_box_faces' ]) ? $options[ 'cff_like_box_faces' ] : '',
148
  'likeboxborder' => isset($options[ 'cff_like_box_border' ]) ? $options[ 'cff_like_box_border' ] : '',
149
+ 'credit' => isset($options[ 'cff_show_credit' ]) ? $options[ 'cff_show_credit' ] : '',
150
 
151
  //Page Header
152
  'showheader' => isset($options[ 'cff_show_header' ]) ? $options[ 'cff_show_header' ] : '',
177
  $cff_page_type = $atts[ 'pagetype' ];
178
  ($cff_page_type == 'group') ? $cff_is_group = true : $cff_is_group = false;
179
 
180
+ $cff_feed_width = $atts[ 'width' ];
181
+ if ( is_numeric(substr($cff_feed_width, -1, 1)) ) $cff_feed_width = $cff_feed_width . 'px';
182
+
183
  $cff_feed_height = $atts[ 'height' ];
184
+ if ( is_numeric(substr($cff_feed_height, -1, 1)) ) $cff_feed_height = $cff_feed_height . 'px';
185
+
186
  $cff_feed_padding = $atts[ 'padding' ];
187
+ if ( is_numeric(substr($cff_feed_padding, -1, 1)) ) $cff_feed_padding = $cff_feed_padding . 'px';
188
+
189
  $cff_bg_color = $atts[ 'bgcolor' ];
190
  $cff_show_author = $atts[ 'showauthornew' ];
191
  $cff_cache_time = $atts[ 'cachetime' ];
411
  if ($cff_like_box_text_color == 'white') $cff_like_box_colorscheme = 'dark';
412
 
413
  $cff_likebox_width = $atts[ 'likeboxwidth' ];
414
+ if ( is_numeric(substr($cff_likebox_width, -1, 1)) ) $cff_likebox_width = $cff_likebox_width . 'px';
415
+
416
  $cff_likebox_height = $atts[ 'likeboxheight' ];
417
  $cff_likebox_height = preg_replace('/px$/', '', $cff_likebox_height);
418
 
438
  //Get feed header settings
439
  $cff_header_bg_color = $atts['headerbg'];
440
  $cff_header_padding = $atts['headerpadding'];
441
+ if ( is_numeric(substr($cff_header_padding, -1, 1)) ) $cff_header_padding = $cff_header_padding . 'px';
442
+
443
  $cff_header_text_size = $atts['headertextsize'];
444
  $cff_header_text_weight = $atts['headertextweight'];
445
  $cff_header_text_color = $atts['headertextcolor'];
511
  //Get show posts attribute. If not set then default to 25
512
  $show_posts = $atts['num'];
513
  if (empty($show_posts)) $show_posts = 25;
514
+ if ( $show_posts == 'undefined' ) $show_posts = 25;
515
 
516
  //If the 'Enter my own Access Token' box is unchecked then don't use the user's access token, even if there's one in the field
517
  get_option('cff_show_access_token') ? $cff_show_access_token = true : $cff_show_access_token = false;
598
  ( isset($cff_app_id) && !empty($cff_app_id) ) ? $cff_like_box_params = '&appId=' .$cff_app_id : $cff_like_box_params = '';
599
  $like_box = '<div class="cff-likebox';
600
  if ($cff_like_box_outside) $like_box .= ' cff-outside';
601
+ $like_box .= ($cff_like_box_position == 'top') ? ' cff-top' : ' cff-bottom';
602
  $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>';
603
  //Don't show like box if it's a group
604
  if($cff_is_group) $like_box = '';
618
 
619
  $cff_header = '<h3 class="cff-header';
620
  if ($cff_header_outside) $cff_header .= ' cff-outside';
621
+ $cff_header .= '" ' . $cff_header_styles . '>';
622
  $cff_header .= '<i class="fa fa-' . $cff_header_icon . '"';
623
  if(!empty($cff_header_icon_color) || !empty($cff_header_icon_size)) $cff_header .= ' style="';
624
  if(!empty($cff_header_icon_color)) $cff_header .= 'color: #' . str_replace('#', '', $cff_header_icon_color) . ';';
628
  $cff_header .= '<span class="header-text" style="height: '.$cff_header_icon_size.'px;">' . $cff_header_text . '</span>';
629
  $cff_header .= '</h3>';
630
 
631
+ //If the number of posts is set to zero then don't show any and set limit to one
632
+ if ( ($atts['num'] == '0' || $atts['num'] == 0) && $atts['num'] !== ''){
633
+ $show_posts = 0;
634
+ $cff_post_limit = 1;
635
+ }
636
 
637
  //***START FEED***
638
  $cff_content = '';
867
  $cff_translate_photos_text = $atts['photostext'];
868
  if (!isset($cff_translate_photos_text) || empty($cff_translate_photos_text)) $cff_translate_photos_text = 'photos';
869
  $cff_post_text = '<' . $cff_title_format . ' class="cff-post-text" ' . $cff_title_styles . '>';
870
+
871
+ //Start HTML for post text
872
+ $cff_post_text .= '<span class="cff-text" rel="'.str_replace('#', '', $atts['textlinkcolor'] ).'">';
873
  if ($cff_title_link) $cff_post_text .= '<a class="cff-post-text-link" '.$cff_title_styles.' href="'.$link.'" '.$target.'>';
874
+
875
  //Which content should we use?
876
  $cff_post_text_type = '';
877
  //Use the story
996
  if (!empty($body_limit)) {
997
  if (strlen($description_text) > $body_limit) $description_text = substr($description_text, 0, $body_limit) . '...';
998
  }
999
+ $cff_description .= '<p class="cff-post-desc" '.$cff_body_styles.'><span>' . cff_autolink( htmlspecialchars($description_text), $link_color=str_replace('#', '', $atts['textlinkcolor']) ) . ' </span></p>';
1000
 
1001
  //If the post text and description/caption are the same then don't show the description
1002
  if($post_text == $description_text) $cff_description = '';
1019
  //The link title:
1020
  $cff_shared_link .= '"><'.$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.'>';
1021
  //The link source:
1022
+ (!empty($news->caption)) ? $cff_link_caption = $news->caption : $cff_link_caption = '';
1023
+ if(!empty($cff_link_caption)) $cff_shared_link .= '<p class="cff-link-caption" style="color:#' . str_replace('#', '', $cff_link_url_color) . ';">'.$cff_link_caption.'</p>';
1024
  if ($cff_show_desc) {
1025
+ if( $description_text != $cff_link_caption ) $cff_shared_link .= $cff_description;
1026
  }
1027
  $cff_shared_link .= '</div>';
1028
  }
1239
  date_default_timezone_set( $cff_orig_timezone );
1240
  //Add the Like Box inside
1241
  if ($cff_like_box_position == 'bottom' && $cff_show_like_box && !$cff_like_box_outside) $cff_content .= $like_box;
1242
+ /* Credit link */
1243
+ $cff_show_credit = $atts['credit'];
1244
+ ($cff_show_credit == 'true' || $cff_show_credit == 'on') ? $cff_show_credit = true : $cff_show_credit = false;
1245
+
1246
+ if($cff_show_credit) $cff_content .= '<p class="cff-credit"><a href="https://smashballoon.com/custom-facebook-feed/" target="_blank" style="color: #'.$link_color=str_replace('#', '', $atts['textlinkcolor'] ).'"><i class="fa fa-facebook-square"></i>The Custom Facebook Feed plugin</a></p>';
1247
  //End the feed
1248
  $cff_content .= '</div><div class="cff-clear"></div>';
1249
  //Add the Like Box outside
1657
  add_action( 'wp_enqueue_scripts', 'cff_add_my_stylesheet' );
1658
  function cff_add_my_stylesheet() {
1659
  // Respects SSL, Style.css is relative to the current file
1660
+ wp_register_style( 'cff', plugins_url('css/cff-style.css?10', __FILE__) );
1661
  wp_enqueue_style( 'cff' );
1662
  wp_enqueue_style( 'cff-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css', array(), '4.0.3' );
1663
  }
1665
  add_action( 'wp_enqueue_scripts', 'cff_scripts_method' );
1666
  function cff_scripts_method() {
1667
  //Register the script to make it available
1668
+ wp_register_script( 'cffscripts', plugins_url( '/js/cff-scripts.js?10' , __FILE__ ), array('jquery'), '1.9', true );
1669
  //Enqueue it to load it onto the page
1670
  wp_enqueue_script('cffscripts');
1671
  }
1927
 
1928
 
1929
  if( substr( $link_url_enc, 0, 4 ) !== "http" ) $link_url_enc = 'http://' . $link_url_enc;
1930
+ $buffer .= "<a target='_blank' style='color:#".$link_color."' href=\"{$link_url_enc}\"$tagfill>{$display_url_enc}</a>";
1931
 
1932
 
1933
  }else{
js/cff-scripts.js CHANGED
@@ -48,6 +48,7 @@ jQuery(document).ready(function() {
48
  $more.show();
49
  $less.hide();
50
  }
 
51
  });
52
 
53
  //Hide the shared link box if it's empty
@@ -56,25 +57,36 @@ jQuery(document).ready(function() {
56
  $sharedLink.remove();
57
  }
58
 
59
- //Link hashtags
60
- var cffTextStr = $self.find('.cff-text').html(),
61
- cffDescStr = $self.find('.cff-post-desc').html(),
62
- regex = /(?:\s|^)(?:#(?!\d+(?:\s|$)))(\w+)(?=\s|$)/gi,
63
- linkcolor = $self.find('.cff-text').attr('rel');
 
64
 
65
- function replacer(hash){
66
- var replacementString = jQuery.trim(hash);
67
- return ' <a href="https://www.facebook.com/hashtag/'+ replacementString.substring(1) +'" target="_blank" style="color: #' + linkcolor + '">' + replacementString + '</a>';
68
- }
 
 
 
 
 
 
69
 
70
- if(cfflinkhashtags == 'true'){
71
- //Replace hashtags in text
72
- var $cffText = $self.find('.cff-text');
73
- if($cffText.length > 0) $cffText.html( cffTextStr.replace( regex , replacer ) );
74
- }
 
 
75
 
76
- //Replace hashtags in desc
77
- if( $self.find('.cff-post-desc').length > 0 ) $self.find('.cff-post-desc').html( cffDescStr.replace( regex , replacer ) );
 
 
78
 
79
  });
80
  });
48
  $more.show();
49
  $less.hide();
50
  }
51
+ cffLinkHashtags();
52
  });
53
 
54
  //Hide the shared link box if it's empty
57
  $sharedLink.remove();
58
  }
59
 
60
+ function cffLinkHashtags(){
61
+ //Link hashtags
62
+ var cffTextStr = $self.find('.cff-text').html(),
63
+ cffDescStr = $self.find('.cff-post-desc').html(),
64
+ regex = /(^|\s)#(\w*[a-zA-Z_]+\w*)/gi,
65
+ linkcolor = $self.find('.cff-text').attr('rel');
66
 
67
+ function replacer(hash){
68
+ //Remove white space at beginning of hash
69
+ var replacementString = jQuery.trim(hash);
70
+ //If the hash is a hex code then don't replace it with a link as it's likely in the style attr, eg: "color: #ff0000"
71
+ if ( /^#[0-9A-F]{6}$/i.test( replacementString ) ){
72
+ return replacementString;
73
+ } else {
74
+ return ' <a href="https://www.facebook.com/hashtag/'+ replacementString.substring(1) +'" target="_blank" style="color:#' + linkcolor + '">' + replacementString + '</a>';
75
+ }
76
+ }
77
 
78
+ if(cfflinkhashtags == 'true'){
79
+ //Replace hashtags in text
80
+ var $cffText = $self.find('.cff-text');
81
+ //Add a space after all <br> tags so that #hashtags immediatelly after them are also converted to hashtag links. Without the space they aren't captured by the regex.
82
+ cffTextStr = cffTextStr.replace(/<br>/g, "<br> ");
83
+ if($cffText.length > 0) $cffText.html( cffTextStr.replace( regex , replacer ) );
84
+ }
85
 
86
+ //Replace hashtags in desc
87
+ if( $self.find('.cff-post-desc').length > 0 ) $self.find('.cff-post-desc').html( cffDescStr.replace( regex , replacer ) );
88
+ }
89
+ cffLinkHashtags();
90
 
91
  });
92
  });