WD Facebook Feed – Custom Facebook Feed Plugin - Version 1.0.35

Version Description

  • Fixed: Crash on front end when API returns error
  • Improved: Use another access token if API request limit of current token is exceeded
Download this release

Release Info

Developer webdorado
Plugin Icon 128x128 WD Facebook Feed – Custom Facebook Feed Plugin
Version 1.0.35
Comparing to
See all releases

Code changes from version 1.0.34 to 1.0.35

facebook-feed-wd.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: WD Facebook Feed
5
  * Plugin URI: https://web-dorado.com/products/wordpress-facebook-feed-plugin.html
6
  * Description:WD Facebook Feed is a completely customizable, responsive solution to help you display your Facebook feed on your WordPress website.
7
- * Version: 1.0.34
8
  * Author: WebDorado
9
  * Author URI: https://web-dorado.com/wordpress-plugins-bundle.html
10
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
@@ -81,6 +81,20 @@ add_action( 'admin_menu', 'ffwd_menu_panel' );
81
  add_action( 'init', 'ffwd_silently_update' );
82
 
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  if ( ! isset( $_REQUEST['ajax'] ) ) {
85
  if ( ! class_exists( "DoradoWeb" ) ) {
86
  require_once( WD_FFWD_DIR . '/wd/start.php' );
@@ -1000,7 +1014,7 @@ if ( !function_exists('wd_bps_install_notice_status') ) {
1000
 
1001
  function ffwd_version() {
1002
 
1003
- $version = '1.0.34';
1004
 
1005
  if ( get_option( 'ffwd_version' ) === false ) {
1006
  add_option( 'ffwd_version', $version );
4
  * Plugin Name: WD Facebook Feed
5
  * Plugin URI: https://web-dorado.com/products/wordpress-facebook-feed-plugin.html
6
  * Description:WD Facebook Feed is a completely customizable, responsive solution to help you display your Facebook feed on your WordPress website.
7
+ * Version: 1.0.35
8
  * Author: WebDorado
9
  * Author URI: https://web-dorado.com/wordpress-plugins-bundle.html
10
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
81
  add_action( 'init', 'ffwd_silently_update' );
82
 
83
 
84
+ add_filter('wp_get_default_privacy_policy_content', 'ffwd_privacy_policy');
85
+ function ffwd_privacy_policy($content){
86
+ $title = __('Facebook Feed WD', "ffwd");
87
+
88
+ $pp_link = '<a target="_blank" href="https://www.facebook.com/policy/">' . __('Privacy Policy', "ffwd") . '</a>';
89
+ $text = sprintf(__('Inform visitors that your website makes use of Facebook API to receive public data for facebook feed. Provide message that may request you to delete their Facebook data if it is accidentally cached in your website database with feed data. If you enabled “show page plugin” option for Facebook feed, Facebook will load some JS and embedded content which may track visitors. Facebook embeds are regulated under terms of Facebook %s', "ffwd"), $pp_link);
90
+ $text .= "<br/>";
91
+ $text .= __('TenWeb Disclaimer: The above text is for informational purposes only and is not a legal advice. You must not rely on it as an alternative to legal advice. You should contact your legal counsel to obtain advice with respect to your particular case.', "ffwd");
92
+ $pp_text = '<h3>' . $title . '</h3>' . '<p class="wp-policy-help">' . $text . '</p>';
93
+
94
+ $content .= $pp_text;
95
+ return $content;
96
+ }
97
+
98
  if ( ! isset( $_REQUEST['ajax'] ) ) {
99
  if ( ! class_exists( "DoradoWeb" ) ) {
100
  require_once( WD_FFWD_DIR . '/wd/start.php' );
1014
 
1015
  function ffwd_version() {
1016
 
1017
+ $version = '1.0.35';
1018
 
1019
  if ( get_option( 'ffwd_version' ) === false ) {
1020
  add_option( 'ffwd_version', $version );
framework/WDFacebookFeed.php CHANGED
@@ -66,12 +66,45 @@ class WDFacebookFeed {
66
  '1739880636336728|e786c42c6cbe13b28b8f4a83afbebbcd',
67
  '1683088998649596|73282ca4410752d64621e693cc19524e',
68
  '987113411398480|3e2d346234b086dba07e5c6f5c87caaa',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  );
70
 
71
  protected static $save = true;
72
  protected static $edit_feed = false;
73
  protected static $update_mode = 'keep_old';
74
  protected static $fb_id;
 
75
 
76
  public static $client_side_check = array();
77
  ////////////////////////////////////////////////////////////////////////////////////////
@@ -92,11 +125,14 @@ class WDFacebookFeed {
92
  public static function execute() {
93
  if (function_exists('current_user_can')) {
94
  if (!current_user_can('manage_options')) {
95
- die('Access Denied');
 
 
 
96
  }
97
  }
98
  else {
99
- die('Access Denied');
100
  }
101
  require_once(WD_FFWD_DIR . '/framework/WDW_FFWD_Library.php');
102
  $action = WDW_FFWD_Library::get('action');
@@ -714,7 +750,7 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? esc_htm
714
  continue;
715
 
716
  if($next['type']=='status' && !isset($next['description']) && !isset($next['message']) && !isset($next['name']))
717
- continue;
718
 
719
  if(count(self::$complite_timeline_data) < self::$limit)
720
  array_push(self::$complite_timeline_data, $next);
@@ -1595,7 +1631,10 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? esc_htm
1595
  $dropped_id = (isset($_POST['ids']) && $_POST['ids'] != '') ? $_POST['ids'] : '';
1596
  $yes = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'wd_fb_data WHERE `id` = "%d"', $dropped_id));
1597
  echo $yes;
1598
- die();
 
 
 
1599
  }
1600
 
1601
  public static function check_logged_in_user() {
@@ -1618,9 +1657,19 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? esc_htm
1618
  }
1619
  }
1620
 
1621
- public static function wd_fb_massage($mood, $massage) {
1622
- echo json_encode(array($mood, $massage));
1623
- wp_die();
 
 
 
 
 
 
 
 
 
 
1624
  }
1625
 
1626
  public static function check_fb_type() {
@@ -1632,34 +1681,60 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? esc_htm
1632
  self::wd_fb_massage('error', 'no such FB type');
1633
  }
1634
 
1635
- public static function decap_do_curl($uri) {
 
 
 
 
1636
  $facebook_graph_results = null;
1637
  $facebook_graph_url = $uri; //TODO: Add URL checking here, else error out
1638
- //Attempt CURL
1639
- if (extension_loaded('curl')){
1640
- $ch = curl_init();
1641
- curl_setopt($ch, CURLOPT_URL, $facebook_graph_url);
1642
- curl_setopt($ch, CURLOPT_HEADER, 0);
1643
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
1644
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
1645
- if(!$facebook_graph_results = curl_exec($ch)) {
1646
- printf('<p>cURL Error: %1$s %2$s</p>', curl_errno($ch), curl_error($ch));
1647
- printf('<p>Please try entering <strong>%s</strong> into your URL bar and seeing if the page loads.', $facebook_graph_url);
1648
- }
1649
- if(curl_errno($ch) == 7) {
1650
- print '<p><strong>Your server cannot communicate with Facebook\'s servers. This means your server does not support IPv6 or is having issues resolving facebook.com. Please contact your hosting provider.';
1651
- }
1652
- curl_close($ch);
1653
- } else {
1654
- print ('Sorry, your server does not allow remote fopen or have CURL');
1655
  }
1656
- $facebook_graph_results = json_decode($facebook_graph_results, true);
1657
- if (array_key_exists("error", $facebook_graph_results)) {
1658
- if ($facebook_graph_results['error']['code'] == 2) {
1659
- return self::decap_do_curl($facebook_graph_url);
1660
- }
1661
  }
 
 
 
 
1662
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1663
  return $facebook_graph_results;
1664
  }
1665
 
66
  '1739880636336728|e786c42c6cbe13b28b8f4a83afbebbcd',
67
  '1683088998649596|73282ca4410752d64621e693cc19524e',
68
  '987113411398480|3e2d346234b086dba07e5c6f5c87caaa',
69
+
70
+
71
+
72
+
73
+ '1795317140689602|e25d547c4f12164254f85eead086b0a7',
74
+ '181607922248075|d0787a2cfff89efd23b9fe1ffafa45db',
75
+ '1851314935096786|0de2a9ec77d745d6941850696ce166f9',
76
+ '1983264355330375|e5c100f6d4b768abb560e7df1771ac89',
77
+ '274376249625432|03d7cc70158f4b720a124c11aad5606e',
78
+ '927474184059774|ekzzwIV9JnvG-ELYWut9wIvf4Y0',
79
+ '157849737751172|1wgUYn-UwVvoiZkvROi7yi2aIRw',
80
+ '140081703552|rtuoT3AGRIzb-z_PPUlOnN9iYA0',
81
+ '322095208287051|pbCTS6jPuhjR18sl2UPhKQw7eyY',
82
+ '1439406912938596|4JDCXisJ2d-1EWeObBt27DybH5c',
83
+ '1042396375891598|gn2HiZgDgjTbCMcXsSb6VK91PqM',
84
+ '348613608818294|d4gRX7tNppCrI-DrOGof_O8gwvg',
85
+ '502797619766223|fuoqcs_7_9HPokY0C296S4VtB0o',
86
+ '1591407604237466|cHUFs9XDDJa7LDUW9zBxirwGAHE',
87
+ '277269689412168|o3k5mzmHsT-prqc2qizxk_DoXEQ',
88
+ '386881278380301|NW_PiECD9TLVe0UNMsB5H9HkPEo',
89
+ '697312047120344|p8ST5dkrub6IoBZsClmyRBTScB0',
90
+ '1134584793234186|763Jh88I-PuO8_slARazfgucxFg',
91
+ '257106408010811|MwCorr7qsyIeU_GjdPFIEw3-_P8',
92
+ '1693018934313805|VYDjx69NpsgkDEAm79cYD0fxJBk',
93
+ '1298990730176646|rU4QhoOaYPWQng6-k_QdxRoVNaA',
94
+ '1788677371359317|UU7yeB5dsKOT8xLsLA9xSNu4OMQ',
95
+ '1876405409266356|VT8hdBxkbAf6-PCq-TosrtiMilU',
96
+ '128947497630881|rlgLr8wtMUWRw7hbcLcsgoa01-k',
97
+ '963645750343660|1mgCt1EhXAI0o51tYpZ7O6dThKM',
98
+ '177899259380474|JgdlhmU-J0dq55bKng0xywDIgIo',
99
+ '1106367462776766|Pj4xBlwzMH53yCQw7-h_prMExQg',
100
+ '131153380694449|jxU6_J0SobvxNG-pzJW8MKsI0w8'
101
  );
102
 
103
  protected static $save = true;
104
  protected static $edit_feed = false;
105
  protected static $update_mode = 'keep_old';
106
  protected static $fb_id;
107
+ private static $ffwd_fb_massage = true;
108
 
109
  public static $client_side_check = array();
110
  ////////////////////////////////////////////////////////////////////////////////////////
125
  public static function execute() {
126
  if (function_exists('current_user_can')) {
127
  if (!current_user_can('manage_options')) {
128
+ if (defined( 'DOING_AJAX' ) && DOING_AJAX )
129
+ {
130
+ die('Access Denied');
131
+ }
132
  }
133
  }
134
  else {
135
+ die('Access Denied');
136
  }
137
  require_once(WD_FFWD_DIR . '/framework/WDW_FFWD_Library.php');
138
  $action = WDW_FFWD_Library::get('action');
750
  continue;
751
 
752
  if($next['type']=='status' && !isset($next['description']) && !isset($next['message']) && !isset($next['name']))
753
+ continue;
754
 
755
  if(count(self::$complite_timeline_data) < self::$limit)
756
  array_push(self::$complite_timeline_data, $next);
1631
  $dropped_id = (isset($_POST['ids']) && $_POST['ids'] != '') ? $_POST['ids'] : '';
1632
  $yes = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'wd_fb_data WHERE `id` = "%d"', $dropped_id));
1633
  echo $yes;
1634
+ if (defined( 'DOING_AJAX' ) && DOING_AJAX )
1635
+ {
1636
+ die();
1637
+ }
1638
  }
1639
 
1640
  public static function check_logged_in_user() {
1657
  }
1658
  }
1659
 
1660
+ public static function wd_fb_massage($mood, $massage)
1661
+ {
1662
+ if(self::$ffwd_fb_massage){
1663
+ echo json_encode(array($mood, $massage));
1664
+ self::$ffwd_fb_massage = false;
1665
+
1666
+ if ( is_admin() && defined( 'DOING_AJAX' ) && DOING_AJAX )
1667
+ {
1668
+ wp_die();
1669
+ }
1670
+ }else{
1671
+ return;
1672
+ }
1673
  }
1674
 
1675
  public static function check_fb_type() {
1681
  self::wd_fb_massage('error', 'no such FB type');
1682
  }
1683
 
1684
+ public static function decap_do_curl($uri)
1685
+ {
1686
+
1687
+
1688
+
1689
  $facebook_graph_results = null;
1690
  $facebook_graph_url = $uri; //TODO: Add URL checking here, else error out
1691
+
1692
+ //Attempt CURL
1693
+ if (extension_loaded('curl')) {
1694
+ $ch = curl_init();
1695
+ curl_setopt($ch, CURLOPT_URL, $facebook_graph_url);
1696
+ curl_setopt($ch, CURLOPT_HEADER, 0);
1697
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
1698
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
1699
+ if (!$facebook_graph_results = curl_exec($ch)) {
1700
+ printf('<p>cURL Error: %1$s %2$s</p>', curl_errno($ch), curl_error($ch));
1701
+ printf('<p>Please try entering <strong>%s</strong> into your URL bar and seeing if the page loads.', $facebook_graph_url);
 
 
 
 
 
 
1702
  }
1703
+ if (curl_errno($ch) == 7) {
1704
+ print '<p><strong>Your server cannot communicate with Facebook\'s servers. This means your server does not support IPv6 or is having issues resolving facebook.com. Please contact your hosting provider.';
 
 
 
1705
  }
1706
+ curl_close($ch);
1707
+ } else {
1708
+ self::wd_fb_massage('error', 'Sorry, your server does not allow remote fopen or have CURL');
1709
+ }
1710
 
1711
+
1712
+ $facebook_graph_results = json_decode($facebook_graph_results, true);
1713
+ if (array_key_exists("error", $facebook_graph_results)) {
1714
+ if ($facebook_graph_results['error']['code'] == 2) {
1715
+ return self::decap_do_curl($facebook_graph_url);
1716
+ }
1717
+ }
1718
+ if(isset($facebook_graph_results["error"]) && count(self::$access_tokens)>1){
1719
+ if(isset($facebook_graph_results['error']['code']) && $facebook_graph_results['error']['code']== 4){
1720
+ if (($key = array_search(self::$access_token, self::$access_tokens)) !== false) {
1721
+ unset(self::$access_tokens[$key]);
1722
+ self::$access_token = null;
1723
+
1724
+ $rand_key = array_rand(self::$access_tokens);
1725
+ self::$access_token = self::$access_tokens[$rand_key];
1726
+
1727
+ $parts = parse_url($uri);
1728
+ $queryParams = array();
1729
+ parse_str($parts['query'], $queryParams);
1730
+ $queryParams["access_token"] = self::$access_token;
1731
+
1732
+ $queryString = http_build_query($queryParams);
1733
+ $url = "https://graph.facebook.com".$parts['path'] . '?' . $queryString;
1734
+ return self::decap_do_curl($url);
1735
+ }
1736
+ }
1737
+ }
1738
  return $facebook_graph_results;
1739
  }
1740
 
frontend/views/FFWDViewAlbum_compact.php CHANGED
@@ -575,7 +575,13 @@ class FFWDViewAlbum_compact {
575
  var js, fjs = d.getElementsByTagName(s)[0];
576
  if (d.getElementById(id)) return;
577
  js = d.createElement(s); js.id = id;
578
- js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId=1509500312675877";
 
 
 
 
 
 
579
  fjs.parentNode.insertBefore(js, fjs);
580
  }(document, 'script', 'facebook-jssdk'));
581
  </script>
575
  var js, fjs = d.getElementsByTagName(s)[0];
576
  if (d.getElementById(id)) return;
577
  js = d.createElement(s); js.id = id;
578
+ <?php
579
+ if(isset($ffwd_info["fb_plugin"]) && $ffwd_info["fb_plugin"] === "1"){
580
+ ?>
581
+ js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId=1509500312675877";
582
+ <?php
583
+ }
584
+ ?>
585
  fjs.parentNode.insertBefore(js, fjs);
586
  }(document, 'script', 'facebook-jssdk'));
587
  </script>
frontend/views/FFWDViewBlog_style.php CHANGED
@@ -1083,7 +1083,13 @@ class FFWDViewBlog_style {
1083
  var js, fjs = d.getElementsByTagName(s)[0];
1084
  if (d.getElementById(id)) return;
1085
  js = d.createElement(s); js.id = id;
1086
- js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId=1509500312675877";
 
 
 
 
 
 
1087
  fjs.parentNode.insertBefore(js, fjs);
1088
  }(document, 'script', 'facebook-jssdk'));
1089
  </script>
1083
  var js, fjs = d.getElementsByTagName(s)[0];
1084
  if (d.getElementById(id)) return;
1085
  js = d.createElement(s); js.id = id;
1086
+ <?php
1087
+ if(isset($ffwd_info["fb_plugin"]) && $ffwd_info["fb_plugin"] === "1"){
1088
+ ?>
1089
+ js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId=1509500312675877";
1090
+ <?php
1091
+ }
1092
+ ?>
1093
  fjs.parentNode.insertBefore(js, fjs);
1094
  }(document, 'script', 'facebook-jssdk'));
1095
  </script>
frontend/views/FFWDViewThumbnails.php CHANGED
@@ -368,7 +368,13 @@ $ffwd_info['thumb_height']= $params['thumb_height'];
368
  var js, fjs = d.getElementsByTagName(s)[0];
369
  if (d.getElementById(id)) return;
370
  js = d.createElement(s); js.id = id;
371
- js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId=1509500312675877";
 
 
 
 
 
 
372
  fjs.parentNode.insertBefore(js, fjs);
373
  }(document, 'script', 'facebook-jssdk'));
374
  </script>
368
  var js, fjs = d.getElementsByTagName(s)[0];
369
  if (d.getElementById(id)) return;
370
  js = d.createElement(s); js.id = id;
371
+ <?php
372
+ if(isset($ffwd_info["fb_plugin"]) && $ffwd_info["fb_plugin"] === "1"){
373
+ ?>
374
+ js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId=1509500312675877";
375
+ <?php
376
+ }
377
+ ?>
378
  fjs.parentNode.insertBefore(js, fjs);
379
  }(document, 'script', 'facebook-jssdk'));
380
  </script>
frontend/views/FFWDViewThumbnails_masonry.php CHANGED
@@ -444,7 +444,13 @@ class FFWDViewThumbnails_masonry {
444
  var js, fjs = d.getElementsByTagName(s)[0];
445
  if (d.getElementById(id)) return;
446
  js = d.createElement(s); js.id = id;
447
- js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId=1509500312675877";
 
 
 
 
 
 
448
  fjs.parentNode.insertBefore(js, fjs);
449
  }(document, 'script', 'facebook-jssdk'));
450
  </script>
444
  var js, fjs = d.getElementsByTagName(s)[0];
445
  if (d.getElementById(id)) return;
446
  js = d.createElement(s); js.id = id;
447
+ <?php
448
+ if(isset($ffwd_info["fb_plugin"]) && $ffwd_info["fb_plugin"] === "1"){
449
+ ?>
450
+ js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId=1509500312675877";
451
+ <?php
452
+ }
453
+ ?>
454
  fjs.parentNode.insertBefore(js, fjs);
455
  }(document, 'script', 'facebook-jssdk'));
456
  </script>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: customizable facebook feed, facebook, facebook events, facebook feed, face
4
  Requires at least: 3.4
5
  Requires PHP: 5.2
6
  Tested up to: 4.9
7
- Stable tag: 1.0.34
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -95,10 +95,15 @@ With a Facebook page feed, you can filter out the content based on user roles, a
95
  ###IMPORTANT:
96
  If you think you found a bug in WD Facebook Feed or have any problem/question concerning this plugin, please check out [Support Forum](https://wordpress.org/support/plugin/wd-facebook-feed) . If you do not find a solution here, do not hesitate to [click here to contact us](https://web-dorado.com/support/contact-us.html).
97
 
98
-
 
99
 
100
  == Changelog ==
101
 
 
 
 
 
102
  = 1.0.34 =
103
  * Fixed: Bug on video post
104
 
4
  Requires at least: 3.4
5
  Requires PHP: 5.2
6
  Tested up to: 4.9
7
+ Stable tag: 1.0.35
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
95
  ###IMPORTANT:
96
  If you think you found a bug in WD Facebook Feed or have any problem/question concerning this plugin, please check out [Support Forum](https://wordpress.org/support/plugin/wd-facebook-feed) . If you do not find a solution here, do not hesitate to [click here to contact us](https://web-dorado.com/support/contact-us.html).
97
 
98
+ == Privacy Policy =
99
+ The plugin uses Facebook API to get public data from Facebook. All the received data is cached in WordPress database for some short customizable period to provide optimization. You can delete or update cached data. You can optionally enable like button for Facebook page. If you do so, Facebook will load some JS and embedded content which may track visitors. Facebook embeds are regulated under terms of Facebook privacy policy https://www.facebook.com/policy.php.
100
 
101
  == Changelog ==
102
 
103
+ = 1.0.35 =
104
+ * Fixed: Crash on front end when API returns error
105
+ * Improved: Use another access token if API request limit of current token is exceeded
106
+
107
  = 1.0.34 =
108
  * Fixed: Bug on video post
109