Custom Facebook Feed - Version 1.9.8

Version Description

  • Tweak: The Access Token field is now hidden by default and is revealed by a checkbox
  • Fix: Fixed an issue with link colors not being applied to all links
  • Fix: Removed the link box container from posts which contain non-youtube/vimeo links
  • Fix: Links which don't contain a 'http://' protocol are now linked correctly
Download this release

Release Info

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

Code changes from version 1.9.7 to 1.9.8

README.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: smashballoon
3
  Tags: Facebook, Facebook feed, Facebook posts, Facebook wall, Facebook events, Facebook page, Facebook group, Facebook Like box, Customizable Facebook Feed, custom, customizable, seo, responsive, mobile, social
4
  Requires at least: 3.0
5
- Tested up to: 3.9
6
- Stable tag: 1.9.7
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -269,6 +269,12 @@ Credit [iMarketing Factory](http://www.imarketingfactory.com/facebook/ "The Impo
269
  9. It's super easy to display your Facebook feed in any page or post
270
 
271
  == Changelog ==
 
 
 
 
 
 
272
  = 1.9.7 =
273
  * Fix: Fixed an issue with a generic function name which was occasionally causing an error
274
 
2
  Contributors: smashballoon
3
  Tags: Facebook, Facebook feed, Facebook posts, Facebook wall, Facebook events, Facebook page, Facebook group, Facebook Like box, Customizable Facebook Feed, custom, customizable, seo, responsive, mobile, social
4
  Requires at least: 3.0
5
+ Tested up to: 3.9.1
6
+ Stable tag: 1.9.8
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
269
  9. It's super easy to display your Facebook feed in any page or post
270
 
271
  == Changelog ==
272
+ = 1.9.8 =
273
+ * Tweak: The Access Token field is now hidden by default and is revealed by a checkbox
274
+ * Fix: Fixed an issue with link colors not being applied to all links
275
+ * Fix: Removed the link box container from posts which contain non-youtube/vimeo links
276
+ * Fix: Links which don't contain a 'http://' protocol are now linked correctly
277
+
278
  = 1.9.7 =
279
  * Fix: Fixed an issue with a generic function name which was occasionally causing an error
280
 
css/cff-admin-style.css CHANGED
@@ -223,4 +223,9 @@
223
  #cff-admin .cff-layout:focus{
224
  background: #f6f6f6;
225
  cursor: default;
 
 
 
 
 
226
  }
223
  #cff-admin .cff-layout:focus{
224
  background: #f6f6f6;
225
  cursor: default;
226
+ }
227
+
228
+ /* Access Token field */
229
+ #cff-admin .cff-access-token-hidden{
230
+ display: none;
231
  }
custom-facebook-feed-admin.php CHANGED
@@ -35,6 +35,7 @@ add_action('admin_menu', 'cff_styling_menu');
35
  function cff_settings_page() {
36
  //Declare variables for fields
37
  $hidden_field_name = 'cff_submit_hidden';
 
38
  $access_token = 'cff_access_token';
39
  $page_id = 'cff_page_id';
40
  $cff_page_type = 'cff_page_type';
@@ -45,6 +46,7 @@ function cff_settings_page() {
45
  $cff_cache_time_unit = 'cff_cache_time_unit';
46
  $cff_locale = 'cff_locale';
47
  // Read in existing option value from database
 
48
  $access_token_val = get_option( $access_token );
49
  $page_id_val = get_option( $page_id );
50
  $cff_page_type_val = get_option( $cff_page_type, 'page' );
@@ -57,6 +59,7 @@ function cff_settings_page() {
57
  // See if the user has posted us some information. If they did, this hidden field will be set to 'Y'.
58
  if( isset($_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name ] == 'Y' ) {
59
  // Read their posted value
 
60
  $access_token_val = $_POST[ $access_token ];
61
  $page_id_val = $_POST[ $page_id ];
62
  $cff_page_type_val = $_POST[ $cff_page_type ];
@@ -67,6 +70,7 @@ function cff_settings_page() {
67
  $cff_cache_time_unit_val = $_POST[ $cff_cache_time_unit ];
68
  $cff_locale_val = $_POST[ $cff_locale ];
69
  // Save the posted value in the database
 
70
  update_option( $access_token, $access_token_val );
71
  update_option( $page_id, $page_id_val );
72
  update_option( $cff_page_type, $cff_page_type_val );
@@ -143,16 +147,21 @@ function cff_settings_page() {
143
  </tr>
144
 
145
  <tr valign="top">
146
- <th scope="row" style="padding-bottom: 10px;"><?php _e('Facebook Access Token <i style="font-weight: normal; font-size: 12px;">(Optional)</i>'); ?></th>
 
 
 
 
 
 
 
 
147
  <td>
148
  <input name="cff_access_token" id="cff_access_token" type="text" value="<?php esc_attr_e( $access_token_val ); ?>" size="45" />
149
- &nbsp;<a class="cff-tooltip-link" href="JavaScript:void(0);"><?php _e("What is this?"); ?></a>
150
 
151
  <div class="cff-notice cff-profile-error cff-access-token">
152
  <?php _e("<p>This doesn't appear to be an Access Token. Please be sure that you didn't enter your App Secret instead of your Access Token.<br />Your App ID and App Secret are used to obtain your Access Token; simply paste them into the fields in the last step of the <a href='http://smashballoon.com/custom-facebook-feed/access-token/' target='_blank'>Access Token instructions</a> and click '<b>Get my Access Token</b>'.</p>"); ?>
153
  </div>
154
-
155
- <p class="cff-tooltip cff-more-info"><?php _e("This is optional. If you have your own Facebook Access Token then you can enter it here. To get your own Access Token you can follow these <a href='http://smashballoon.com/custom-facebook-feed/access-token/' target='_blank'>step-by-step instructions</a>"); ?>.</p>
156
  </td>
157
  </tr>
158
  </tbody>
@@ -2443,7 +2452,7 @@ function cff_style_page() {
2443
  } //End Style_Page
2444
  //Enqueue admin styles
2445
  function cff_admin_style() {
2446
- wp_register_style( 'custom_wp_admin_css', plugin_dir_url( __FILE__ ) . 'css/cff-admin-style.css?4', false, '1.0.0' );
2447
  wp_enqueue_style( 'custom_wp_admin_css' );
2448
  wp_enqueue_style( 'cff-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css', array(), '4.0.3' );
2449
  wp_enqueue_style( 'wp-color-picker' );
@@ -2451,7 +2460,7 @@ function cff_admin_style() {
2451
  add_action( 'admin_enqueue_scripts', 'cff_admin_style' );
2452
  //Enqueue admin scripts
2453
  function cff_admin_scripts() {
2454
- wp_enqueue_script( 'cff_admin_script', plugin_dir_url( __FILE__ ) . 'js/cff-admin-scripts.js?4' );
2455
  if( !wp_script_is('jquery-ui-draggable') ) {
2456
  wp_enqueue_script(
2457
  array(
35
  function cff_settings_page() {
36
  //Declare variables for fields
37
  $hidden_field_name = 'cff_submit_hidden';
38
+ $show_access_token = 'cff_show_access_token';
39
  $access_token = 'cff_access_token';
40
  $page_id = 'cff_page_id';
41
  $cff_page_type = 'cff_page_type';
46
  $cff_cache_time_unit = 'cff_cache_time_unit';
47
  $cff_locale = 'cff_locale';
48
  // Read in existing option value from database
49
+ $show_access_token_val = get_option( $show_access_token );
50
  $access_token_val = get_option( $access_token );
51
  $page_id_val = get_option( $page_id );
52
  $cff_page_type_val = get_option( $cff_page_type, 'page' );
59
  // See if the user has posted us some information. If they did, this hidden field will be set to 'Y'.
60
  if( isset($_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name ] == 'Y' ) {
61
  // Read their posted value
62
+ $show_access_token_val = $_POST[ $show_access_token ];
63
  $access_token_val = $_POST[ $access_token ];
64
  $page_id_val = $_POST[ $page_id ];
65
  $cff_page_type_val = $_POST[ $cff_page_type ];
70
  $cff_cache_time_unit_val = $_POST[ $cff_cache_time_unit ];
71
  $cff_locale_val = $_POST[ $cff_locale ];
72
  // Save the posted value in the database
73
+ update_option( $show_access_token, $show_access_token_val );
74
  update_option( $access_token, $access_token_val );
75
  update_option( $page_id, $page_id_val );
76
  update_option( $cff_page_type, $cff_page_type_val );
147
  </tr>
148
 
149
  <tr valign="top">
150
+ <th scope="row" style="padding-bottom: 10px;"><?php _e('Enter my own Access Token <i style="font-weight: normal; font-size: 12px;">This is Optional</i>'); ?></th>
151
+ <td>
152
+ <input name="cff_show_access_token" type="checkbox" id="cff_show_access_token" <?php if($show_access_token_val == true) echo "checked"; ?> />&nbsp;<a class="cff-tooltip-link" href="JavaScript:void(0);"><?php _e("What is this?"); ?></a>
153
+ <p class="cff-tooltip cff-more-info"><?php _e("A Facebook Access Token is not required to use this plugin, but if you have your own that you'd like to use then you can check this box and enter it here. To get your own Access Token you can follow these <a href='http://smashballoon.com/custom-facebook-feed/access-token/' target='_blank'>step-by-step instructions</a>"); ?>.</p>
154
+ </td>
155
+ </tr>
156
+
157
+ <tr valign="top" class="cff-access-token-hidden">
158
+ <th scope="row" style="padding-bottom: 10px;"><?php _e('Facebook Access Token'); ?></th>
159
  <td>
160
  <input name="cff_access_token" id="cff_access_token" type="text" value="<?php esc_attr_e( $access_token_val ); ?>" size="45" />
 
161
 
162
  <div class="cff-notice cff-profile-error cff-access-token">
163
  <?php _e("<p>This doesn't appear to be an Access Token. Please be sure that you didn't enter your App Secret instead of your Access Token.<br />Your App ID and App Secret are used to obtain your Access Token; simply paste them into the fields in the last step of the <a href='http://smashballoon.com/custom-facebook-feed/access-token/' target='_blank'>Access Token instructions</a> and click '<b>Get my Access Token</b>'.</p>"); ?>
164
  </div>
 
 
165
  </td>
166
  </tr>
167
  </tbody>
2452
  } //End Style_Page
2453
  //Enqueue admin styles
2454
  function cff_admin_style() {
2455
+ wp_register_style( 'custom_wp_admin_css', plugin_dir_url( __FILE__ ) . 'css/cff-admin-style.css?5', false, '1.0.0' );
2456
  wp_enqueue_style( 'custom_wp_admin_css' );
2457
  wp_enqueue_style( 'cff-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css', array(), '4.0.3' );
2458
  wp_enqueue_style( 'wp-color-picker' );
2460
  add_action( 'admin_enqueue_scripts', 'cff_admin_style' );
2461
  //Enqueue admin scripts
2462
  function cff_admin_scripts() {
2463
+ wp_enqueue_script( 'cff_admin_script', plugin_dir_url( __FILE__ ) . 'js/cff-admin-scripts.js?5' );
2464
  if( !wp_script_is('jquery-ui-draggable') ) {
2465
  wp_enqueue_script(
2466
  array(
custom-facebook-feed.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Custom Facebook Feed
4
  Plugin URI: http://smashballoon.com/custom-facebook-feed
5
  Description: Add a completely customizable Facebook feed to your WordPress site
6
- Version: 1.9.7
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  License: GPLv2 or later
@@ -997,14 +997,34 @@ function display_cff($atts) {
997
  }
998
 
999
  /* VIDEO */
 
 
1000
  $cff_is_video_embed = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1001
  $cff_media = '';
1002
  if ($news->type == 'video') {
1003
- $cff_is_video_embed = true;
1004
  //Add the name to the description if it's a video embed
1005
  if($cff_is_video_embed) {
1006
  isset($news->name) ? $video_name = $news->name : $video_name = $link;
1007
  isset($news->description) ? $description_text = $news->description : $description_text = '';
 
1008
  $cff_description = '<div class="cff-desc-wrap cff-shared-link ';
1009
  if (empty($picture)) $cff_description .= 'cff-no-image';
1010
  if($cff_disable_link_box) $cff_description .= ' cff-no-styles"';
@@ -1018,6 +1038,9 @@ function display_cff($atts) {
1018
  }
1019
 
1020
  $cff_description .= '<p class="cff-post-desc" '.$cff_body_styles.'><span>' . cff_autolink( htmlspecialchars($description_text) ) . '</span></p></div>';
 
 
 
1021
  }
1022
  }
1023
 
@@ -1539,6 +1562,9 @@ function cff_activate() {
1539
  $options[ 'cff_show_link' ] = true;
1540
  $options[ 'cff_show_like_box' ] = true;
1541
  update_option( 'cff_style_settings', $options );
 
 
 
1542
  }
1543
  register_activation_hook( __FILE__, 'cff_activate' );
1544
  //Uninstall
@@ -1547,6 +1573,7 @@ function cff_uninstall()
1547
  if ( ! current_user_can( 'activate_plugins' ) )
1548
  return;
1549
  //Settings
 
1550
  delete_option( 'cff_access_token' );
1551
  delete_option( 'cff_page_id' );
1552
  delete_option( 'cff_num_show' );
@@ -1611,15 +1638,15 @@ $GLOBALS['autolink_options'] = array(
1611
 
1612
  function cff_autolink($text, $link_color='', $span_tag = false, $limit=100, $tagfill='class="cff-break-word"', $auto_title = true){
1613
 
1614
- $text = cff_autolink_do($text, '![a-z][a-z-]+://!i', $limit, $tagfill, $auto_title, $span_tag, $link_color);
1615
- $text = cff_autolink_do($text, '!(mailto|skype):!i', $limit, $tagfill, $auto_title, $span_tag, $link_color);
1616
- $text = cff_autolink_do($text, '!www\\.!i', $limit, $tagfill, $auto_title, 'http://', $span_tag, $link_color);
1617
  return $text;
1618
  }
1619
 
1620
  ####################################################################
1621
 
1622
- function cff_autolink_do($text, $sub, $limit, $tagfill, $auto_title, $span_tag, $link_color, $force_prefix=null){
1623
 
1624
  $text_l = StrToLower($text);
1625
  $cursor = 0;
@@ -1753,11 +1780,9 @@ function cff_autolink_do($text, $sub, $limit, $tagfill, $auto_title, $span_tag,
1753
  $link_url_enc = HtmlSpecialChars($link_url);
1754
  $display_url_enc = HtmlSpecialChars($display_url);
1755
 
1756
- if($span_tag == true){
1757
- $buffer .= "<span $tagfill>{$display_url_enc}</span>";
1758
- } else {
1759
- $buffer .= "<a target='_blank' style='color: #".$link_color."' href=\"{$link_url_enc}\"$tagfill>{$display_url_enc}</a>";
1760
- }
1761
 
1762
 
1763
  }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: 1.9.8
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  License: GPLv2 or later
997
  }
998
 
999
  /* VIDEO */
1000
+
1001
+ //Check to see whether it's an embedded video so that we can show the name above the post text if necessary
1002
  $cff_is_video_embed = false;
1003
+ if ($news->type == 'video'){
1004
+ $url = $news->source;
1005
+ //Embeddable video strings
1006
+ $youtube = 'youtube';
1007
+ $youtu = 'youtu';
1008
+ $vimeo = 'vimeo';
1009
+ $youtubeembed = 'youtube.com/embed';
1010
+ //Check whether it's a youtube video
1011
+ $youtube = stripos($url, $youtube);
1012
+ $youtu = stripos($url, $youtu);
1013
+ $youtubeembed = stripos($url, $youtubeembed);
1014
+ //Check whether it's a youtube video
1015
+ if($youtube || $youtu || $youtubeembed || (stripos($url, $vimeo) !== false)) {
1016
+ $cff_is_video_embed = true;
1017
+ }
1018
+ }
1019
+
1020
+
1021
  $cff_media = '';
1022
  if ($news->type == 'video') {
 
1023
  //Add the name to the description if it's a video embed
1024
  if($cff_is_video_embed) {
1025
  isset($news->name) ? $video_name = $news->name : $video_name = $link;
1026
  isset($news->description) ? $description_text = $news->description : $description_text = '';
1027
+ //Add the 'cff-shared-link' class so that embedded videos display in a box
1028
  $cff_description = '<div class="cff-desc-wrap cff-shared-link ';
1029
  if (empty($picture)) $cff_description .= 'cff-no-image';
1030
  if($cff_disable_link_box) $cff_description .= ' cff-no-styles"';
1038
  }
1039
 
1040
  $cff_description .= '<p class="cff-post-desc" '.$cff_body_styles.'><span>' . cff_autolink( htmlspecialchars($description_text) ) . '</span></p></div>';
1041
+ } else {
1042
+ isset($news->name) ? $video_name = $news->name : $video_name = $link;
1043
+ if( isset($news->name) ) $cff_description .= '<'.$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.'>';
1044
  }
1045
  }
1046
 
1562
  $options[ 'cff_show_link' ] = true;
1563
  $options[ 'cff_show_like_box' ] = true;
1564
  update_option( 'cff_style_settings', $options );
1565
+
1566
+ get_option('cff_show_access_token');
1567
+ update_option( 'cff_show_access_token', false );
1568
  }
1569
  register_activation_hook( __FILE__, 'cff_activate' );
1570
  //Uninstall
1573
  if ( ! current_user_can( 'activate_plugins' ) )
1574
  return;
1575
  //Settings
1576
+ delete_option( 'cff_show_access_token' );
1577
  delete_option( 'cff_access_token' );
1578
  delete_option( 'cff_page_id' );
1579
  delete_option( 'cff_num_show' );
1638
 
1639
  function cff_autolink($text, $link_color='', $span_tag = false, $limit=100, $tagfill='class="cff-break-word"', $auto_title = true){
1640
 
1641
+ $text = cff_autolink_do($text, $link_color, '![a-z][a-z-]+://!i', $limit, $tagfill, $auto_title, $span_tag);
1642
+ $text = cff_autolink_do($text, $link_color, '!(mailto|skype):!i', $limit, $tagfill, $auto_title, $span_tag);
1643
+ $text = cff_autolink_do($text, $link_color, '!www\\.!i', $limit, $tagfill, $auto_title, 'http://', $span_tag);
1644
  return $text;
1645
  }
1646
 
1647
  ####################################################################
1648
 
1649
+ function cff_autolink_do($text, $link_color, $sub, $limit, $tagfill, $auto_title, $span_tag, $force_prefix=null){
1650
 
1651
  $text_l = StrToLower($text);
1652
  $cursor = 0;
1780
  $link_url_enc = HtmlSpecialChars($link_url);
1781
  $display_url_enc = HtmlSpecialChars($display_url);
1782
 
1783
+
1784
+ if( substr( $link_url_enc, 0, 4 ) !== "http" ) $link_url_enc = 'http://' . $link_url_enc;
1785
+ $buffer .= "<a target='_blank' style='color: #".$link_color."' href=\"{$link_url_enc}\"$tagfill>{$display_url_enc}</a>";
 
 
1786
 
1787
 
1788
  }else{
js/cff-admin-scripts.js CHANGED
@@ -7,7 +7,9 @@ jQuery(document).ready(function() {
7
 
8
  //Check Access Token length
9
  jQuery("#cff_access_token").change(function() {
10
-
 
 
11
  var cff_token_string = jQuery('#cff_access_token').val(),
12
  cff_token_check = cff_token_string.indexOf('|');
13
 
@@ -16,9 +18,17 @@ jQuery(document).ready(function() {
16
  } else {
17
  jQuery('.cff-profile-error.cff-access-token').fadeOut();
18
  }
 
 
 
19
 
 
 
 
 
20
  });
21
 
 
22
  //Is this a page, group or profile?
23
  var cff_page_type = jQuery('.cff-page-type select').val(),
24
  $cff_page_type_options = jQuery('.cff-page-options'),
7
 
8
  //Check Access Token length
9
  jQuery("#cff_access_token").change(function() {
10
+ checkAccessTokenLength();
11
+ });
12
+ function checkAccessTokenLength(){
13
  var cff_token_string = jQuery('#cff_access_token').val(),
14
  cff_token_check = cff_token_string.indexOf('|');
15
 
18
  } else {
19
  jQuery('.cff-profile-error.cff-access-token').fadeOut();
20
  }
21
+ }
22
+ checkAccessTokenLength();
23
+
24
 
25
+ //Toggle Access Token field
26
+ if( jQuery('#cff_show_access_token').is(':checked') ) jQuery('.cff-access-token-hidden').show();
27
+ jQuery('#cff_show_access_token').change(function(){
28
+ jQuery('.cff-access-token-hidden').fadeToggle();
29
  });
30
 
31
+
32
  //Is this a page, group or profile?
33
  var cff_page_type = jQuery('.cff-page-type select').val(),
34
  $cff_page_type_options = jQuery('.cff-page-options'),